function t(t,n={}){const e=n.margin??8,i=n.selector??".context-menu",c=document.querySelector(i);if(!c)return{x:Math.max(e,t.clientX),y:Math.max(e,t.clientY)};const o=window.innerWidth,l=window.innerHeight,r=c.getBoundingClientRect(),a=r.width,h=r.height;let x=t.clientX,m=t.clientY;if(x+a>o-e&&(x=o-a-e),m+h>l-e){const n=t.clientY;m=n>l-t.clientY&&n>=h+e?t.clientY-h:l-h-e}return x=Math.max(e,x),m=Math.max(e,m),{x:x,y:m}}export{t as c};
