import{disposables as r}from'./disposables.js';const c={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function a(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function p(e,t,i){let n=r();if(t.kind==="Tracked"){let o=function(){d!==a(e)&&(n.dispose(),i())};var f=o;let{position:d}=t,s=new ResizeObserver(o);s.observe(e),n.add(()=>s.disconnect()),n.addEventListener(window,"scroll",o,{passive:!0}),n.addEventListener(window,"resize",o)}return()=>n.dispose()}export{c as ElementPositionState,a as computeVisualPosition,p as detectMovement};
