import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t}from"./jsx-runtime-CiQ1k8xo.js";import{lt as n}from"./vscode-api-DjORcpSo.js";import{t as r}from"./use-stable-callback-CvFJzJNa.js";import{t as i}from"./get-resize-observer-entry-size-6_LDgIWP.js";var a=e(t(),1),o=(0,a.createContext)(null),s=Symbol(`resizeObserverCallbacks`),c=Symbol(`resizeObserverLastEntry`);function l(){return typeof ResizeObserver>`u`?null:new ResizeObserver(e=>{for(let t of e){let e=t.target;e[c]=t,e[s]?.forEach(e=>e(t))}})}function u({callback:e,element:t,observer:n}){let r=t[s];if(r!=null){r.add(e);let n=t[c];n!=null&&e(n);return}t[s]=new Set([e]),n?.observe(t)}function d({callback:e,element:t,observer:n}){let r=t[s];r!=null&&(r.delete(e),!(r.size>0)&&(t[s]=void 0,t[c]=void 0,n?.unobserve(t)))}var f=n();function p(e){let t=(0,f.c)(5),n=(0,a.useContext)(o),i=(0,a.useRef)(null),s;t[0]===e?s=t[1]:(s=t=>{let n=i.current;n!=null&&e(t,n)},t[0]=e,t[1]=s);let c=r(s),l;return t[2]!==n||t[3]!==c?(l=e=>{if(n==null)throw Error(`useResizeObserver must be used within ResizeObserverProvider.`);i.current!=null&&d({callback:c,element:i.current,observer:n}),i.current=e,e!=null&&u({callback:c,element:e,observer:n})},t[2]=n,t[3]=c,t[4]=l):l=t[4],r(l)}function m(){let e=(0,f.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={width:null,height:null},e[0]=t):t=e[0];let[n,r]=(0,a.useState)(t),i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=e=>{let{width:t,height:n}=e.contentRect;r({width:t,height:n})},e[1]=i):i=e[1];let o=p(i),s;return e[2]!==n||e[3]!==o?(s=[o,n],e[2]=n,e[3]=o,e[4]=s):s=e[4],s}function h(){let e=(0,f.c)(4),[t,n]=(0,a.useState)(null),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=e=>{n(i(e).width)},e[0]=r):r=e[0];let o=p(r),s;return e[1]!==o||e[2]!==t?(s=[o,t],e[1]=o,e[2]=t,e[3]=s):s=e[3],s}export{o as a,l as i,p as n,h as r,m as t};
//# sourceMappingURL=use-resize-observer-pZWTsQ9C.js.map