import{Et as e,Lt as t,P as n,St as r,Tt as i,Vt as a,Zt as o,bt as s,dn as c,gt as l,hn as u,ln as d,st as f,vt as p,wt as m,xt as h,yt as g,zt as _}from"./design-system-components-Y2tugS6v.mjs";import{bi as v,ki as y}from"./composables-DDr4AJUl.mjs";import"./src-C-XpxEWy.mjs";import{t as b}from"./isEmpty-CAr0KXdv.mjs";import{r as x,t as S}from"./piniaStores-Bqibtp2q.mjs";import{a as C,r as w}from"./editor-FaPkxGlF.mjs";import{i as T,n as E,r as D,t as O}from"./AppContextualHelper-kFwcwx_k.mjs";var k=e({name:`AppResources`,props:{app:{type:Object,required:!0,default:()=>void 0}},setup(e){return{resources:p(()=>(e.app.resources||[]).filter(e=>{if(b(e.url)||b(e.label))return!1;try{new URL(e.url)}catch{return!1}return!0}))}}}),A={class:`mb-0 p-0`},j=[`href`],M={"data-testid":`resource-label`};function N(e,n,i,o,c,d){let f=a(`oc-icon`);return t(),r(`ul`,A,[(t(!0),r(l,null,_(e.resources,e=>(t(),r(`li`,{key:e.label},[g(`a`,{href:e.url,"data-testid":`resource-link`,target:`_blank`,class:`inline-flex items-center`},[e.icon?(t(),s(f,{key:0,"data-testid":`resource-icon`,name:e.icon,size:`medium`,class:`mr-1`},null,8,[`name`])):h(``,!0),n[0]||=m(),g(`span`,M,u(e.label),1)],8,j)]))),128))])}var P=f(k,[[`render`,N]]),F=e({name:`AppVersions`,components:{AppActions:D},props:{app:{type:Object,required:!0,default:()=>void 0}},setup(e){let{$gettext:t}=n();return{data:p(()=>(e.app.versions||[]).filter(e=>{if(b(e.version)||b(e.url))return!1;try{new URL(e.url)}catch{return!1}return!0}).map(e=>({...e,minOpenCloud:e.minOpenCloud?`v${e.minOpenCloud}`:`-`,id:e.version}))),fields:p(()=>[{name:`version`,type:`slot`,width:`expand`,wrap:`truncate`,title:t(`App Version`)},{name:`minOpenCloud`,type:`raw`,width:`shrink`,wrap:`nowrap`,title:t(`OpenCloud Version`)},{name:`actions`,type:`slot`,alignH:`right`,width:`shrink`,wrap:`nowrap`,title:``}])}}});function I(e,n,r,c,l,d){let f=a(`oc-tag`),p=a(`app-actions`),g=a(`oc-table`);return t(),s(g,{class:`w-full`,data:e.data,fields:e.fields,"padding-x":`remove`},{version:o(({item:n})=>[m(`
      v`+u(n.version)+` `,1),n.version===e.app.mostRecentVersion.version?(t(),s(f,{key:0,size:`small`,class:`ml-2`},{default:o(()=>[m(u(e.$gettext(`most recent`)),1)]),_:1})):h(``,!0)]),actions:o(({item:t})=>[i(p,{app:e.app,version:t},null,8,[`app`,`version`])]),_:1},8,[`data`,`fields`])}var L=f(F,[[`render`,I]]),R=e({props:{app:{type:Object,required:!0,default:()=>void 0}},setup(e){return{authors:p(()=>(e.app.authors||[]).filter(e=>{if(b(e.name))return!1;if(!b(e.url))try{new URL(e.url)}catch{return!1}return!0}))}}}),z={class:`mb-0 p-0`},B=[`href`],V={key:1,"data-testid":`author-label`};function H(e,n,i,a,o,s){return t(),r(`ul`,z,[(t(!0),r(l,null,_(e.authors,e=>(t(),r(`li`,{key:e.name,class:`app-author-item`},[e.url?(t(),r(`a`,{key:0,href:e.url,"data-testid":`author-link`,target:`_blank`},u(e.name),9,B)):(t(),r(`span`,V,u(e.name),1))]))),128))])}var U=e({components:{AppContextualHelper:O,AppImageGallery:E,AppAuthors:f(R,[[`render`,H]]),AppResources:P,AppTags:T,AppVersions:L,TextEditorContent:w},setup(){let e=v(`appId`),t=p(()=>decodeURIComponent(c(e))),n=S(),r=y(),i=p(()=>n.getById(c(t)));return{app:i,APPID:x,appDescriptionEditor:C({contentType:`markdown`,modelValue:d(()=>c(i)?.description??``),readonly:!0}),onTagClicked:e=>{r.push({name:`${x}-list`,query:{filter:e}})}}}}),W=[`textContent`],G={class:`app-content bg-role-surface-container flex flex-col`},K={class:`flex items-center`},q={class:`my-2 truncate app-details-title`},J={class:`ml-2 text-role-on-surface-variant text-sm mt-2`},Y={class:`my-0`},X={key:0},Z={key:1},Q={key:2},$={key:3},ee={key:4};function te(e,n,c,l,d,f){let p=a(`oc-icon`),_=a(`router-link`),v=a(`app-image-gallery`),y=a(`TextEditorContent`),b=a(`app-tags`),x=a(`app-authors`),S=a(`app-resources`),C=a(`app-contextual-helper`),w=a(`app-versions`),T=a(`oc-card`);return t(),s(T,{class:`app-details mx-auto bg-role-surface-container border max-w-2xl shadow-none`,"header-class":`p-0 items-start`},{header:o(()=>[i(_,{to:{name:`${e.APPID}-list`},class:`flex flex-row items-center app-details-back p-1`},{default:o(()=>[i(p,{name:`arrow-left-s`,"fill-type":`line`}),n[0]||=m(),g(`span`,{textContent:u(e.$gettext(`Back to list`))},null,8,W)]),_:1},8,[`to`]),n[1]||=m(),i(v,{app:e.app,"show-pagination":!0,class:`w-full`},null,8,[`app`])]),default:o(()=>[n[14]||=m(),g(`div`,G,[g(`div`,K,[g(`h2`,q,u(e.app.name),1),n[2]||=m(),g(`span`,J,`
          v`+u(e.app.mostRecentVersion.version),1)]),n[8]||=m(),g(`p`,Y,u(e.app.subtitle),1),n[9]||=m(),e.app.description?(t(),r(`div`,X,[g(`h3`,null,u(e.$gettext(`Details`)),1),n[3]||=m(),i(y,{class:`my-2`,editor:e.appDescriptionEditor},null,8,[`editor`])])):h(``,!0),n[10]||=m(),e.app.tags?(t(),r(`div`,Z,[g(`h3`,null,u(e.$gettext(`Tags`)),1),n[4]||=m(),i(b,{app:e.app,onClick:e.onTagClicked},null,8,[`app`,`onClick`])])):h(``,!0),n[11]||=m(),e.app.authors?(t(),r(`div`,Q,[g(`h3`,null,u(e.$gettext(`Author`)),1),n[5]||=m(),i(x,{app:e.app},null,8,[`app`])])):h(``,!0),n[12]||=m(),e.app.resources?(t(),r(`div`,$,[g(`h3`,null,u(e.$gettext(`Resources`)),1),n[6]||=m(),i(S,{app:e.app},null,8,[`app`])])):h(``,!0),n[13]||=m(),e.app.versions?(t(),r(`div`,ee,[g(`h3`,null,[m(u(e.$gettext(`Releases`))+` `,1),i(C)]),n[7]||=m(),i(w,{app:e.app},null,8,[`app`])])):h(``,!0)])]),_:1})}var ne=f(U,[[`render`,te]]);export{ne as default};