import{Et as e,Lt as t,P as n,St as r,Tt as i,Vt as a,Zt as o,an as s,bt as c,dn as l,fn as u,gt as d,hn as f,st as p,vt as m,wt as h,xt as g,yt as _,zt as v}from"./design-system-components-Y2tugS6v.mjs";import{Br as y}from"./composables-DDr4AJUl.mjs";import{q as b}from"./src-C-XpxEWy.mjs";var x=e({name:`AppTags`,props:{app:{type:Object,required:!0,default:()=>void 0}},emits:[`click`],setup(e,{emit:t}){return{emitClick:e=>{t(`click`,e)}}}}),S={class:`flex gap-1`},C={class:`mark-element`};function w(e,n,i,s,l,u){let p=a(`oc-tag`);return t(),r(`div`,S,[(t(!0),r(d,null,v(e.app.tags,n=>(t(),c(p,{key:`app-tag-${e.app.id}-${n}`,"data-testid":`tag-button`,size:`small`,class:`whitespace-nowrap cursor-pointer`,type:`button`,onClick:t=>e.emitClick(n)},{default:o(()=>[_(`span`,C,f(n),1)]),_:2},1032,[`onClick`]))),128))])}var T=p(x,[[`render`,w]]),E=()=>{let{$gettext:e}=n();return{downloadAppAction:{name:`download-app`,icon:`download`,label:()=>e(`Download`),handler:e=>{let t=e.version||e.app.mostRecentVersion,n=t.filename||t.url.split(`/`).pop();y(t.url,n)},isVisible:()=>!0,appearance:`outline`}}},D=e({name:`AppActions`,components:{ActionMenuItem:b},props:{app:{type:Object,required:!0,default:()=>void 0},version:{type:Object,required:!1,default:null}},setup(){let{downloadAppAction:e}=E();return{actions:m(()=>[e])}}});function O(e,n,i,s,l,u){let f=a(`action-menu-item`),p=a(`oc-list`);return t(),c(p,{class:`app-actions flex justify-start gap-3`},{default:o(()=>[(t(!0),r(d,null,v(e.actions,n=>(t(),c(f,{key:`app-action-${n.name}`,size:`small`,action:n,"action-options":{app:e.app,version:e.version},"button-classes":[`raw-hover-surface`]},null,8,[`action`,`action-options`]))),128))]),_:1})}var k=p(D,[[`render`,O]]),A=e({name:`AppImageGallery`,props:{app:{type:Object,required:!0,default:()=>void 0},showPagination:{type:Boolean,required:!1,default:!1}},setup(e){let t=m(()=>[e.app.coverImage,...e.app.screenshots]),n=s(0);return{currentImage:m(()=>l(t)[l(n)]),currentImageIndex:n,images:t,hasPagination:m(()=>e.showPagination&&l(t).length>1),ribbonColorClasses:m(()=>{switch(e.app.badge?.color){case`primary`:return[`bg-role-primary`,`text-role-on-primary`];case`danger`:return[`bg-role-error`,`text-role-on-error`];default:return[`bg-role-primary`,`text-role-on-primary`]}}),nextImage:()=>{n.value=(l(n)+1)%l(t).length},previousImage:()=>{n.value=(l(n)-1+l(t).length)%l(t).length},setImageIndex:e=>{n.value=e}}}}),j={class:`relative`},M={class:`app-image w-full`},N={key:1,class:`fallback-icon bg-white flex items-center justify-center w-full aspect-3/2`},P={key:1,class:`app-image-navigation bg-white/80 flex justify-center items-center flex-row m-0 py-2 w-full absolute bottom-0`};function F(e,n,s,l,p,m){let y=a(`oc-image`),b=a(`oc-icon`),x=a(`oc-button`);return t(),r(`div`,j,[e.app.badge?(t(),r(`div`,{key:0,class:u([`app-image-ribbon z-10 text-right size-[7rem] overflow-hidden absolute top-0 right-0`,[`app-image-ribbon-${e.app.badge.color}`]])},[_(`span`,{class:u([`text-xs font-bold text-center leading-6 w-[10rem] block absolute top-[1.8rem] right-[-2.2rem] transform-[rotate(45deg)]`,e.ribbonColorClasses])},f(e.app.badge.label),3)],2)):g(``,!0),n[2]||=h(),_(`div`,M,[e.currentImage?.url?(t(),c(y,{key:0,src:e.currentImage?.url,class:`w-full max-w-full object-cover aspect-3/2`},null,8,[`src`])):(t(),r(`div`,N,[i(b,{name:`computer`,size:`xxlarge`})]))]),n[3]||=h(),e.hasPagination?(t(),r(`ul`,P,[_(`li`,null,[i(x,{"data-testid":`prev-image`,class:`p-1`,appearance:`raw`,onClick:e.previousImage},{default:o(()=>[i(b,{name:`arrow-left-s`})]),_:1},8,[`onClick`])]),n[0]||=h(),(t(!0),r(d,null,v(e.images,(n,a)=>(t(),r(`li`,{key:`gallery-page-${a}`},[i(x,{"data-testid":`set-image`,class:`p-2`,appearance:`raw`,onClick:t=>e.setImageIndex(a)},{default:o(()=>[i(b,{name:`circle`,size:`small`,"fill-type":a===e.currentImageIndex?`fill`:`line`},null,8,[`fill-type`])]),_:2},1032,[`onClick`])]))),128)),n[1]||=h(),_(`li`,null,[i(x,{"data-testid":`next-image`,class:`p-1`,appearance:`raw`,onClick:e.nextImage},{default:o(()=>[i(b,{name:`arrow-right-s`})]),_:1},8,[`onClick`])])])):g(``,!0)])}var I=p(A,[[`render`,F]]),L={};function R(e,n){let r=a(`oc-contextual-helper`);return t(),c(r,{title:e.$gettext(`How to install?`),text:e.$gettext(`The App Store app lets you download apps as .zip files. Please follow the link below to learn how to install these apps into your OpenCloud.`),"read-more-link":`https://docs.opencloud.eu/docs/admin/configuration/web-applications`},null,8,[`title`,`text`])}var z=p(L,[[`render`,R]]);export{T as i,I as n,k as r,z as t};