import{z as C,h as I,H as k,j as _,A as H,B as T,C as u,D as g,m as f,F as L,G as R,I as E,k as F,J as M,K as Y,L as j,M as S,N as V,O as $,i as z,p as B,P as G,a as J,o as K}from"./index.Chpxrmiw.js";import{c as P,r as N,h as v,d as W,i as q}from"./legacy.BFrtrUTY.js";let r;function Q(){r=void 0}function x(a){let e=null,t=_;var o;if(_){for(e=f,r===void 0&&(r=L(document.head));r!==null&&(r.nodeType!==8||r.data!==H);)r=T(r);r===null?u(!1):r=g(T(r))}_||(o=document.head.appendChild(C()));try{I(()=>a(o),k)}finally{t&&(u(!0),r=f,g(e))}}function ee(a,e){var t=e==null?"":typeof e=="object"?e+"":e;t!==(a.__t??(a.__t=a.nodeValue))&&(a.__t=t,a.nodeValue=t==null?"":t+"")}function U(a,e){return O(a,e)}function ae(a,e){R(),e.intro=e.intro??!1;const t=e.target,o=_,y=f;try{for(var n=L(t);n&&(n.nodeType!==8||n.data!==H);)n=T(n);if(!n)throw E;u(!0),g(n),F();const h=O(a,{...e,anchor:n});if(f===null||f.nodeType!==8||f.data!==M)throw Y(),E;return u(!1),h}catch(h){if(h===E)return e.recover===!1&&j(),R(),S(t),u(!1),U(a,e);throw h}finally{u(o),g(y),Q()}}const l=new Map;function O(a,{target:e,anchor:t,props:o={},events:y,context:n,intro:h=!0}){R();var m=new Set,w=i=>{for(var s=0;s<i.length;s++){var d=i[s];if(!m.has(d)){m.add(d);var c=q(d);e.addEventListener(d,v,{passive:c});var D=l.get(d);D===void 0?(document.addEventListener(d,v,{passive:c}),l.set(d,1)):l.set(d,D+1)}}};w(V(P)),N.add(w);var p=void 0,b=$(()=>{var i=t??e.appendChild(C());return z(()=>{if(n){B({});var s=K;s.c=n}y&&(o.$$events=y),_&&W(i,null),p=a(i,o)||{},_&&(G.nodes_end=f),n&&J()}),()=>{var c;for(var s of m){e.removeEventListener(s,v);var d=l.get(s);--d===0?(document.removeEventListener(s,v),l.delete(s)):l.set(s,d)}N.delete(w),A.delete(p),i!==t&&((c=i.parentNode)==null||c.removeChild(i))}});return A.set(p,b),p}let A=new WeakMap;function te(a){const e=A.get(a);e&&e()}export{x as a,ae as h,U as m,ee as s,te as u};
