import{o as n,a as e,i as t,w as i,b as r,n as o,c as s,u as a,r as d,d as u,g as c,e as l,f as p,p as f,h}from"./chunk-BRI0aX6c.js";var v="undefined"!=typeof window,w=(n,e)=>({top:0,left:0,right:n,bottom:e,width:n,height:e}),g=n=>{const e=a(n);if(e===window){const n=e.innerWidth,t=e.innerHeight;return w(n,t)}return(null==e?void 0:e.getBoundingClientRect)?e.getBoundingClientRect():w(0,0)};function y(e){const t=u(e,null);if(t){const e=c(),{link:i,unlink:r,internalChildren:o}=t;return i(e),n(()=>r(e)),{parent:t,index:l(()=>o.indexOf(e))}}return{parent:null,index:d(-1)}}var x,m,k=(n,e)=>{const t=n.indexOf(e);return-1===t?n.findIndex(n=>void 0!==e.key&&null!==e.key&&n.type===e.type&&n.key===e.key):t};function b(n){const e=p([]),t=p([]),i=c();return{children:e,linkChildren:r=>{f(n,Object.assign({link:n=>{n.proxy&&(t.push(n),e.push(n.proxy),function(n,e,t){const i=function(n){const e=[],t=n=>{Array.isArray(n)&&n.forEach(n=>{var i;h(n)&&(e.push(n),(null==(i=n.component)?void 0:i.subTree)&&(e.push(n.component.subTree),t(n.component.subTree.children)),n.children&&t(n.children))})};return t(n),e}(n.subTree.children);t.sort((n,e)=>k(i,n.vnode)-k(i,e.vnode));const r=t.map(n=>n.proxy);e.sort((n,e)=>r.indexOf(n)-r.indexOf(e))}(i,e,t))},unlink:n=>{const i=t.indexOf(n);e.splice(i,1),t.splice(i,1)},children:e,internalChildren:t},r))}}}function O(n){let e;r(()=>{n(),o(()=>{e=!0})}),s(()=>{e&&n()})}function C(r,o,s={}){if(!v)return;const{target:d=window,passive:u=!1,capture:c=!1}=s;let l,p=!1;const f=n=>{if(p)return;const e=a(n);e&&!l&&(e.addEventListener(r,o,{capture:c,passive:u}),l=!0)},h=n=>{if(p)return;const e=a(n);e&&l&&(e.removeEventListener(r,o,c),l=!1)};let w;return n(()=>h(d)),e(()=>h(d)),O(()=>f(d)),t(d)&&(w=i(d,(n,e)=>{h(e),f(n)})),()=>{null==w||w(),h(d),p=!0}}function T(){if(!x&&(x=d(0),m=d(0),v)){const n=()=>{x.value=window.innerWidth,m.value=window.innerHeight};n(),window.addEventListener("resize",n,{passive:!0}),window.addEventListener("orientationchange",n,{passive:!0})}return{width:x,height:m}}var E=/scroll|auto|overlay/i,L=v?window:void 0;function B(n){return"HTML"!==n.tagName&&"BODY"!==n.tagName&&1===n.nodeType}function H(n,e=L){let t=n;for(;t&&t!==e&&B(t);){const{overflowY:n}=window.getComputedStyle(t);if(E.test(n))return t;t=t.parentNode}return e}export{g as a,b,y as c,C as d,H as g,O as o,T as u};
