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