import{r}from"./index-n-59FgrC.js";const f={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};function a(c){const t=r.useRef(0),e=r.useRef(null),[u,s]=r.useState(f),n=r.useMemo(()=>typeof window<"u"?new ResizeObserver(o=>{const i=o[0];i&&(cancelAnimationFrame(t.current),t.current=requestAnimationFrame(()=>{e.current&&s(i.contentRect)}))}):null,[]);return r.useEffect(()=>(e.current&&(n==null||n.observe(e.current,c)),()=>{n==null||n.disconnect(),t.current&&cancelAnimationFrame(t.current)}),[e.current]),[e,u]}function l(c){const[t,{width:e,height:u}]=a(c);return{ref:t,width:e,height:u}}export{a,l as u};
