import{__toESM as e,jsx as t,require_react as n,require_react_dom as r}from"./index-w-YpLVZ3.js";var i=e(n());function a(e,t,n=500){let[r,a]=(0,i.useState)(0);return(0,i.useEffect)(()=>{let i=setTimeout(()=>{r===1&&e(),a(0)},n);return r===2&&t(),()=>clearTimeout(i)},[r]),()=>a(e=>e+1)}const o=()=>{let[e,t]=(0,i.useState)({x:0,y:0});return(0,i.useEffect)(()=>{let e=e=>{t({x:e.pageX,y:e.pageY})},n=e=>{t({x:e.touches[0].pageX,y:e.touches[0].pageY})};return window.addEventListener(`mousemove`,e),window.addEventListener(`touchmove`,n),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`touchmove`,n)}},[]),e},s=document.getElementById(`roots-absolute`);var c=e(r());const l=({children:e,newX:n,newY:r})=>{let a=(0,i.useRef)(document.createElement(`div`));return(0,i.useEffect)(()=>(s.appendChild(a.current),()=>{s.removeChild(a.current)}),[]),(0,c.createPortal)(t(`div`,{style:{position:`absolute`,left:n-23.047,top:r-23.047,height:60,width:60,zIndex:9999},children:e}),a.current)};export{l as RootsPortal,o as useMousePosition,a as useSingleAndDoubleClick};
//# sourceMappingURL=roots-portal-BZOQ8jnS.js.map