import{b as p,a as d,c,Z as u,j as w,g as v,i as g,q as h,s as M,t as x,k,T as y}from"./vue-Cm77DuTi.js";import{M as _}from"./MkMenu-Dn2NfCb3.js";import{c as C}from"./contains-OYmYIG20.js";import{aM as b,_ as $}from"./app-QjDgb7aF.js";import"./charts-3gEHPHRq.js";import"./media-DuCIZ-3n.js";const B=p({__name:"MkContextMenu",props:{items:{},ev:{}},emits:["closed"],setup(s,{emit:f}){const a=s,m=f,o=d(),l=d(b("high"));c(()=>{let e=a.ev.pageX+1,t=a.ev.pageY+1;const n=o.value.offsetWidth,r=o.value.offsetHeight;e+n-window.pageXOffset>window.innerWidth&&(e=window.innerWidth-n+window.pageXOffset),t+r-window.pageYOffset>window.innerHeight&&(t=window.innerHeight-r+window.pageYOffset),t<0&&(t=0),e<0&&(e=0),o.value.style.top=`${t}px`,o.value.style.left=`${e}px`,document.body.addEventListener("mousedown",i)}),u(()=>{document.body.removeEventListener("mousedown",i)});function i(e){!C(o.value,e.target)&&o.value!==e.target&&m("closed")}return(e,t)=>(w(),v(y,{name:e.$store.state.animation?"fade":"",appear:""},{default:g(()=>[h("div",{ref_key:"rootEl",ref:o,class:"nvlagfpb",style:x({zIndex:l.value}),onContextmenu:M(()=>{},["prevent","stop"])},[k(_,{items:s.items,align:"left",onClose:t[0]||(t[0]=n=>e.$emit("closed"))},null,8,["items"])],36)]),_:1},8,["name"]))}}),X=$(B,[["__scopeId","data-v-0c80f4b2"]]);export{X as default};
//# sourceMappingURL=MkContextMenu-CqXltqxK.js.map
