import{$ as e,B as t,F as n,H as r,I as i,K as a,L as o,R as s,T as c,V as l,W as u,X as d,Z as f,at as p,nt as m,st as h,x as g,y as _,z as v}from"./vue-quasar-CzR5lecU.js";import{r as y}from"./index-C94eCAzg.js";var b={name:`SongShareDialog`,props:{app:{type:Object,required:!0}},setup(t){let n=m(null),r=s(()=>typeof navigator<`u`&&!!navigator.share),i=s(()=>t.app.songShareDialog.value.collection||t.app.songShareDialog.value.song||t.app.songShareDialog.value.payload||{}),o=s(()=>i.value.title||`Shared item`),c=s(()=>t.app.songShareDialog.value.collection?[i.value.subtitle,i.value.itemCount].filter(Boolean).join(` • `):[i.value.artist,i.value.album].filter(Boolean).join(` • `)),l=s(()=>i.value.thumbnailUrl||``),u=s(()=>t.app.songShareDialog.value.collection?`album`:`music_note`);e(()=>t.app.songShareDialog.value.open,async e=>{e&&(await a(),n.value?.querySelector(`button:not(:disabled), a[href]`)?.focus())});function d(e){e.key===`Escape`&&t.app.closeSongShareDialog()}return{...t.app,artworkUrl:l,dialogRef:n,emptyIcon:u,itemSubtitle:c,itemTitle:o,nativeShareAvailable:r,onDialogKeydown:d,dialogItem:i}}},x=[`aria-label`],S={class:`song-share-dialog__track`},C={key:1,class:`song-share-dialog__cover song-share-dialog__cover--empty`},w={class:`song-share-dialog__copy`},T={class:`song-share-dialog__actions`},E=[`disabled`],D=[`disabled`],O=[`disabled`],k={key:0,class:`song-share-dialog__status`},A={key:1,class:`song-share-dialog__status song-share-dialog__status--error`},j={key:2,class:`song-share-dialog__services`},M=[`onClick`],N={class:`song-share-dialog__service-mark`,"aria-hidden":`true`},P=[`src`],F={key:1},I={class:`song-share-dialog__service-copy`},L={class:`song-share-dialog__service-action`},R={key:0,class:`song-share-dialog__empty`};function z(e,a,s,m,y,b){return d(),t(o,{to:`body`},[e.songShareDialog.open?(d(),r(`div`,{key:0,class:`song-share-dialog-layer`,onMousedown:a[5]||=n((...t)=>e.closeSongShareDialog&&e.closeSongShareDialog(...t),[`self`])},[v(`section`,{ref:`dialogRef`,class:`song-share-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Share ${m.itemTitle}`,onKeydown:a[4]||=(...e)=>m.onDialogKeydown&&m.onDialogKeydown(...e)},[v(`button`,{type:`button`,class:`song-share-dialog__close`,"aria-label":`Close`,onClick:a[0]||=(...t)=>e.closeSongShareDialog&&e.closeSongShareDialog(...t)},[u(c,{name:`close`})]),v(`div`,S,[m.artworkUrl?(d(),t(_,{key:0,src:m.artworkUrl,class:`song-share-dialog__cover`},null,8,[`src`])):(d(),r(`span`,C,[u(c,{name:m.emptyIcon},null,8,[`name`])])),v(`span`,w,[v(`strong`,null,h(m.itemTitle),1),v(`span`,null,h(m.itemSubtitle),1)])]),v(`div`,T,[v(`button`,{type:`button`,disabled:!e.songShareDialog.shareUrl,onClick:a[1]||=(...t)=>e.copySongShareUrl&&e.copySongShareUrl(...t)},[u(c,{name:`content_copy`}),a[6]||=v(`span`,null,`Copy link`,-1)],8,E),v(`button`,{type:`button`,disabled:!e.songShareDialog.shareUrl,onClick:a[2]||=t=>e.openSongShareUrl(e.songShareDialog.shareUrl)},[u(c,{name:`open_in_new`}),a[7]||=v(`span`,null,`Open page`,-1)],8,D),m.nativeShareAvailable?(d(),r(`button`,{key:0,type:`button`,disabled:!e.songShareDialog.shareUrl,onClick:a[3]||=(...t)=>e.nativeShareSongUrl&&e.nativeShareSongUrl(...t)},[u(c,{name:`ios_share`}),a[8]||=v(`span`,null,`Share`,-1)],8,O)):l(``,!0)]),e.songShareDialog.loading?(d(),r(`div`,k,[u(g,{size:`18px`}),a[9]||=v(`span`,null,`Creating link...`,-1)])):e.songShareDialog.error?(d(),r(`div`,A,[u(c,{name:`warning`}),v(`span`,null,h(e.songShareDialog.error),1)])):(d(),r(`div`,j,[(d(!0),r(i,null,f(e.songShareDialog.links,t=>(d(),r(`button`,{key:`${t.platform}-${t.url}`,type:`button`,class:p([`song-share-dialog__service`,e.songSharePlatformClass(t)]),onClick:n=>e.openSongShareUrl(t.url)},[v(`span`,N,[e.songSharePlatformLogoUrl(t)?(d(),r(`img`,{key:0,src:e.songSharePlatformLogoUrl(t),alt:``},null,8,P)):(d(),r(`span`,F,h(t.label.slice(0,1)),1))]),v(`span`,I,[v(`strong`,null,h(t.label),1),v(`span`,null,h(e.songShareLinkKind(t)),1)]),v(`span`,L,h(e.songShareActionText(t)),1)],10,M))),128)),e.songShareDialog.links.length?l(``,!0):(d(),r(`p`,R,` Orchard created the share page. Copy the link to send it. `))]))],40,x)],32)):l(``,!0)])}var B=y(b,[[`render`,z]]);export{B as default};