import{$ as e,B as t,F as n,H as r,K as i,L as a,R as o,T as s,V as c,W as l,X as u,nt as d,ot as f,st as p,z as m}from"./vue-quasar-CzR5lecU.js";import{r as h}from"./index-C94eCAzg.js";var g={name:`CollectionActionMenu`,props:{app:{type:Object,required:!0}},setup(t){let n=d(null),r=o(()=>{let e=t.app.collectionActionMenu.value;return{left:`${Math.max(12,Math.min(e.x,window.innerWidth-248-12))}px`,top:`${Math.max(40,Math.min(e.y,window.innerHeight-230-12))}px`}});e(()=>t.app.collectionActionMenu.value.open,async e=>{e&&(await i(),n.value?.querySelector(`button`)?.focus())});function a(e){if(e.key===`Escape`){t.app.closeCollectionActionMenu();return}if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let r=[...n.value.querySelectorAll(`button:not(:disabled)`)];if(!r.length)return;e.preventDefault();let i=r.indexOf(document.activeElement),a=e.key===`Home`?0:e.key===`End`?r.length-1:i;e.key===`ArrowDown`&&(a=(i+1)%r.length),e.key===`ArrowUp`&&(a=(i-1+r.length)%r.length),r[a]?.focus()}return{...t.app,menuRef:n,menuStyle:r,onKeydown:a}}},_=[`aria-label`],v={class:`collection-action-menu__title`},y={class:`collection-action-menu__items`};function b(e,i,o,d,h,g){return u(),t(a,{to:`body`},[e.collectionActionMenu.open?(u(),r(`div`,{key:0,class:`collection-action-layer`,onMousedown:i[6]||=n((...t)=>e.closeCollectionActionMenu&&e.closeCollectionActionMenu(...t),[`self`]),onContextmenu:i[7]||=n((...t)=>e.closeCollectionActionMenu&&e.closeCollectionActionMenu(...t),[`prevent`,`self`])},[m(`section`,{ref:`menuRef`,class:`collection-action-menu`,style:f(d.menuStyle),role:`menu`,"aria-label":`Actions for ${e.collectionActionMenu.item?.title||`collection`}`,onKeydown:i[4]||=(...e)=>d.onKeydown&&d.onKeydown(...e),onContextmenu:i[5]||=n(()=>{},[`prevent`])},[m(`div`,v,[m(`strong`,null,p(e.collectionActionMenu.item?.title),1),m(`span`,null,p(e.itemTypeLabel(e.collectionActionMenu.item)),1)]),m(`div`,y,[m(`button`,{type:`button`,role:`menuitem`,onClick:i[0]||=t=>e.runCollectionAction(`open`)},[l(s,{name:`open_in_new`}),i[8]||=m(`span`,null,`Open`,-1)]),m(`button`,{type:`button`,role:`menuitem`,onClick:i[1]||=t=>e.runCollectionAction(`play`)},[l(s,{name:`play_arrow`}),i[9]||=m(`span`,null,`Play`,-1)]),m(`button`,{type:`button`,role:`menuitem`,onClick:i[2]||=t=>e.runCollectionAction(`shuffle`)},[l(s,{name:`shuffle`}),i[10]||=m(`span`,null,`Shuffle`,-1)]),m(`button`,{type:`button`,role:`menuitem`,onClick:i[3]||=t=>e.runCollectionAction(`share`)},[l(s,{name:`ios_share`}),i[11]||=m(`span`,null,`Share`,-1)])])],44,_)],32)):c(``,!0)])}var x=h(g,[[`render`,b]]);export{x as default};