import{h as m,i as B,j as x,k as C,l as O,s as w,w as S,c as b,m as R}from"./iframe-Bl-fVlm8.js";function W(t,o){return C()?(O(t,o),!0):!1}const A=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;function M(t){return Array.isArray(t)?t:[t]}function k(t){return x()}function z(t,o=!0,n){k()?m(t,n):o?t():B(t)}const y=A?window:void 0;function l(t){var o;const n=R(t);return(o=n==null?void 0:n.$el)!==null&&o!==void 0?o:n}function _(){const t=w(!1),o=x();return o&&m(()=>{t.value=!0},o),t}function E(t){const o=_();return b(()=>(o.value,!!t()))}function G(t,o,n={}){const{window:d=y,...a}=n;let r;const s=E(()=>d&&"ResizeObserver"in d),i=()=>{r&&(r.disconnect(),r=void 0)},v=S(b(()=>{const u=R(t);return Array.isArray(u)?u.map(e=>l(e)):[l(u)]}),u=>{if(i(),s.value&&d){r=new ResizeObserver(o);for(const e of u)e&&r.observe(e,a)}},{immediate:!0,flush:"post"}),h=()=>{i(),v()};return W(h),{isSupported:s,stop:h}}function $(t,o={width:0,height:0},n={}){const{window:d=y,box:a="content-box"}=n,r=b(()=>{var e;return(e=l(t))===null||e===void 0||(e=e.namespaceURI)===null||e===void 0?void 0:e.includes("svg")}),s=w(o.width),i=w(o.height),{stop:v}=G(t,([e])=>{const g=a==="border-box"?e.borderBoxSize:a==="content-box"?e.contentBoxSize:e.devicePixelContentBoxSize;if(d&&r.value){const f=l(t);if(f){const c=f.getBoundingClientRect();s.value=c.width,i.value=c.height}}else if(g){const f=M(g);s.value=f.reduce((c,{inlineSize:p})=>c+p,0),i.value=f.reduce((c,{blockSize:p})=>c+p,0)}else s.value=e.contentRect.width,i.value=e.contentRect.height},n);z(()=>{const e=l(t);e&&(s.value="offsetWidth"in e?e.offsetWidth:o.width,i.value="offsetHeight"in e?e.offsetHeight:o.height)});const h=S(()=>l(t),e=>{s.value=e?o.width:0,i.value=e?o.height:0});function u(){v(),h()}return{width:s,height:i,stop:u}}export{$ as u};
