import{o as e}from"./rolldown-runtime-C_s2cVnS.js";import{h as t}from"./vendor-react-nmZsNlRz.js";var n=e(t(),1),r=new WeakMap,i=null;function a(){return typeof ResizeObserver>`u`?null:(i||=new ResizeObserver(e=>{let t=new Map;for(let n of e){let e=r.get(n.target);if(e)for(let r of e){let e=t.get(r);e?e.push(n):t.set(r,[n])}}for(let[e,n]of t)e(n)}),i)}function o(e,...t){let i=(0,n.useRef)(t);i.current=t,(0,n.useLayoutEffect)(()=>{let t=a();if(!t){e([]);return}let n=[];for(let a of i.current){let i=a.current;if(!i)continue;let o=r.get(i);o?o.add(e):(r.set(i,new Set([e])),t.observe(i)),n.push(i)}if(n.length!==0)return()=>{for(let i of n){let n=r.get(i);n&&(n.delete(e),n.size===0&&(r.delete(i),t.unobserve(i)))}}},[e])}export{o as t};