import{t as O,w as I,c as P,n as A,i as W,d as T,e as L,f as $}from"./oBAm95WQ.js";import{B as M,ao as b,r as y,G as z,g as k,W as F,l as G}from"./CChoqk00.js";const x=$?window:void 0;function v(n){var o;const i=b(n);return(o=i==null?void 0:i.$el)!=null?o:i}function E(...n){const o=[],i=()=>{o.forEach(t=>t()),o.length=0},c=(t,r,l,p)=>(t.addEventListener(r,l,p),()=>t.removeEventListener(r,l,p)),d=M(()=>{const t=O(b(n[0])).filter(r=>r!=null);return t.every(r=>typeof r!="string")?t:void 0}),m=I(()=>{var t,r;return[(r=(t=d.value)==null?void 0:t.map(l=>v(l)))!=null?r:[x].filter(l=>l!=null),O(b(d.value?n[1]:n[0])),O(z(d.value?n[2]:n[1])),b(d.value?n[3]:n[2])]},([t,r,l,p])=>{if(i(),!(t!=null&&t.length)||!(r!=null&&r.length)||!(l!=null&&l.length))return;const s=T(p)?{...p}:p;o.push(...t.flatMap(a=>r.flatMap(g=>l.map(w=>c(a,g,w,s)))))},{flush:"post"}),f=()=>{m(),i()};return P(i),f}let B=!1;function q(n,o,i={}){const{window:c=x,ignore:d=[],capture:m=!0,detectIframe:f=!1}=i;if(!c)return A;if(W&&!B){B=!0;const e={passive:!0};Array.from(c.document.body.children).forEach(u=>E(u,"click",A,e)),E(c.document.documentElement,"click",A,e)}let t=!0;const r=e=>b(d).some(u=>{if(typeof u=="string")return Array.from(c.document.querySelectorAll(u)).some(h=>h===e.target||e.composedPath().includes(h));{const h=v(u);return h&&(e.target===h||e.composedPath().includes(h))}});function l(e){const u=b(e);return u&&u.$.subTree.shapeFlag===16}function p(e,u){const h=b(e),R=h.$.subTree&&h.$.subTree.children;return R==null||!Array.isArray(R)?!1:R.some(S=>S.el===u.target||u.composedPath().includes(S.el))}const s=e=>{const u=v(n);if(e.target!=null&&!(!(u instanceof Element)&&l(n)&&p(n,e))&&!(!u||u===e.target||e.composedPath().includes(u))){if(e.detail===0&&(t=!r(e)),!t){t=!0;return}o(e)}};let a=!1;const g=[E(c,"click",e=>{a||(a=!0,setTimeout(()=>{a=!1},0),s(e))},{passive:!0,capture:m}),E(c,"pointerdown",e=>{const u=v(n);t=!r(e)&&!!(u&&!e.composedPath().includes(u))},{passive:!0}),f&&E(c,"blur",e=>{setTimeout(()=>{var u;const h=v(n);((u=c.document.activeElement)==null?void 0:u.tagName)==="IFRAME"&&!(h!=null&&h.contains(c.document.activeElement))&&o(e)},0)},{passive:!0})].filter(Boolean);return()=>g.forEach(e=>e())}function H(){const n=y(!1),o=G();return o&&F(()=>{n.value=!0},o),n}function C(n){const o=H();return M(()=>(o.value,!!n()))}function N(n,o,i={}){const{window:c=x,...d}=i;let m;const f=C(()=>c&&"ResizeObserver"in c),t=()=>{m&&(m.disconnect(),m=void 0)},r=M(()=>{const s=b(n);return Array.isArray(s)?s.map(a=>v(a)):[v(s)]}),l=k(r,s=>{if(t(),f.value&&c){m=new ResizeObserver(o);for(const a of s)a&&m.observe(a,d)}},{immediate:!0,flush:"post"}),p=()=>{t(),l()};return P(p),{isSupported:f,stop:p}}function D(n,o={width:0,height:0},i={}){const{window:c=x,box:d="content-box"}=i,m=M(()=>{var s,a;return(a=(s=v(n))==null?void 0:s.namespaceURI)==null?void 0:a.includes("svg")}),f=y(o.width),t=y(o.height),{stop:r}=N(n,([s])=>{const a=d==="border-box"?s.borderBoxSize:d==="content-box"?s.contentBoxSize:s.devicePixelContentBoxSize;if(c&&m.value){const g=v(n);if(g){const w=g.getBoundingClientRect();f.value=w.width,t.value=w.height}}else if(a){const g=O(a);f.value=g.reduce((w,{inlineSize:e})=>w+e,0),t.value=g.reduce((w,{blockSize:e})=>w+e,0)}else f.value=s.contentRect.width,t.value=s.contentRect.height},i);L(()=>{const s=v(n);s&&(f.value="offsetWidth"in s?s.offsetWidth:o.width,t.value="offsetHeight"in s?s.offsetHeight:o.height)});const l=k(()=>v(n),s=>{f.value=s?o.width:0,t.value=s?o.height:0});function p(){r(),l()}return{width:f,height:t,stop:p}}function U(n={}){const{window:o=x}=n,i=o==null?void 0:o.navigator,c=C(()=>i&&"language"in i),d=y(i==null?void 0:i.language);return E(o,"languagechange",()=>{i&&(d.value=i.language)},{passive:!0}),{isSupported:c,language:d}}export{E as a,U as b,q as o,D as u};
