import{D as A,E as I,F as V,G as j,l as B,H as z,i as G,I as x,J as P,e as d,h as c,K as b,L as J,M as K,N as O,O as Q,b as u,P as g,p as R,a as $,Q as L,R as v,S as Y,T as X,U as C,f as W,m as Z,V as ee,d as w,W as E,X as te,Y as se,Z as M,_ as ie,$ as ne,a0 as re,a1 as ae,a2 as he,a3 as N,a4 as oe,a5 as fe,a6 as le,a7 as D,a8 as y,a9 as _e,aa as ue,ab as de,ac as ce,ad as pe,ae as ge,af as ve,w as ye,ag as me,ah as be,z as Ee}from"./Dv3HkdC9.js";import{b as Te,r as H,h as m,i as Re,c as we}from"./Ju_n_C2_.js";function Ne(i){let e=0,t=V(0),n;return A&&I(t,"createSubscriber version"),()=>{j()&&(B(t),z(()=>(e===0&&(n=G(()=>i(()=>x(t)))),e+=1,()=>{P(()=>{e-=1,e===0&&(n?.(),n=void 0,x(t))})})))}}var De=ne|re|ae;function Se(i,e,t){new Ae(i,e,t)}class Ae{parent;#s=!1;#t;#g=c?d:null;#n;#_;#r;#i=null;#e=null;#a=null;#h=null;#f=null;#u=0;#l=0;#d=!1;#o=null;#m=Ne(()=>(this.#o=V(this.#u),A&&I(this.#o,"$effect.pending()"),()=>{this.#o=null}));constructor(e,t,n){this.#t=e,this.#n=t,this.#_=n,this.parent=b.b,this.#s=!!this.#n.pending,this.#r=J(()=>{if(b.b=this,c){const s=this.#g;K(),s.nodeType===O&&s.data===Q?this.#E():this.#b()}else{var o=this.#v();try{this.#i=u(()=>n(o))}catch(s){this.error(s)}this.#l>0?this.#p():this.#s=!1}return()=>{this.#f?.remove()}},De),c&&(this.#t=d)}#b(){try{this.#i=u(()=>this.#_(this.#t))}catch(e){this.error(e)}this.#s=!1}#E(){const e=this.#n.pending;e&&(this.#e=u(()=>e(this.#t)),g.enqueue(()=>{var t=this.#v();this.#i=this.#c(()=>(g.ensure(),u(()=>this.#_(t)))),this.#l>0?this.#p():(R(this.#e,()=>{this.#e=null}),this.#s=!1)}))}#v(){var e=this.#t;return this.#s&&(this.#f=$(),this.#t.before(this.#f),e=this.#f),e}is_pending(){return this.#s||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#n.pending}#c(e){var t=b,n=C,o=W;L(this.#r),v(this.#r),Y(this.#r.ctx);try{return e()}catch(s){return X(s),null}finally{L(t),v(n),Y(o)}}#p(){const e=this.#n.pending;this.#i!==null&&(this.#h=document.createDocumentFragment(),this.#h.append(this.#f),Z(this.#i,this.#h)),this.#e===null&&(this.#e=u(()=>e(this.#t)))}#y(e){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(e);return}this.#l+=e,this.#l===0&&(this.#s=!1,this.#e&&R(this.#e,()=>{this.#e=null}),this.#h&&(this.#t.before(this.#h),this.#h=null))}update_pending_count(e){this.#y(e),this.#u+=e,this.#o&&ee(this.#o,this.#u)}get_effect_pending(){return this.#m(),B(this.#o)}error(e){var t=this.#n.onerror;let n=this.#n.failed;if(this.#d||!t&&!n)throw e;this.#i&&(w(this.#i),this.#i=null),this.#e&&(w(this.#e),this.#e=null),this.#a&&(w(this.#a),this.#a=null),c&&(E(this.#g),te(),E(se()));var o=!1,s=!1;const a=()=>{if(o){he();return}o=!0,s&&ie(),g.ensure(),this.#u=0,this.#a!==null&&R(this.#a,()=>{this.#a=null}),this.#s=this.has_pending_snippet(),this.#i=this.#c(()=>(this.#d=!1,u(()=>this.#_(this.#t)))),this.#l>0?this.#p():this.#s=!1};var f=C;try{v(null),s=!0,t?.(e,a),s=!1}catch(l){M(l,this.#r&&this.#r.parent)}finally{v(f)}n&&P(()=>{this.#a=this.#c(()=>{g.ensure(),this.#d=!0;try{return u(()=>{n(this.#t,()=>e,()=>a)})}catch(l){return M(l,this.#r.parent),null}finally{this.#d=!1}})})}}function xe(i,e){var t=e==null?"":typeof e=="object"?e+"":e;t!==(i.__t??=i.nodeValue)&&(i.__t=t,i.nodeValue=t+"")}function Oe(i,e){return q(i,e)}function Le(i,e){N(),e.intro=e.intro??!1;const t=e.target,n=c,o=d;try{for(var s=oe(t);s&&(s.nodeType!==O||s.data!==fe);)s=le(s);if(!s)throw D;y(!0),E(s);const a=q(i,{...e,anchor:s});return y(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
`).some(f=>f.startsWith("https://svelte.dev/e/")))throw a;return a!==D&&console.warn("Failed to hydrate: ",a),e.recover===!1&&_e(),N(),ue(t),y(!1),Oe(i,e)}finally{y(n),E(o)}}const p=new Map;function q(i,{target:e,anchor:t,props:n={},events:o,context:s,intro:a=!0}){N();var f=new Set,l=_=>{for(var h=0;h<_.length;h++){var r=_[h];if(!f.has(r)){f.add(r);var F=Re(r);e.addEventListener(r,m,{passive:F});var k=p.get(r);k===void 0?(document.addEventListener(r,m,{passive:F}),p.set(r,1)):p.set(r,k+1)}}};l(ge(Te)),H.add(l);var T=void 0,U=ve(()=>{var _=t??e.appendChild($());return Se(_,{pending:()=>{}},h=>{if(s){ye({});var r=W;r.c=s}if(o&&(n.$$events=o),c&&we(h,null),T=i(h,n)||{},c&&(b.nodes_end=d,d===null||d.nodeType!==O||d.data!==me))throw be(),D;s&&Ee()}),()=>{for(var h of f){e.removeEventListener(h,m);var r=p.get(h);--r===0?(document.removeEventListener(h,m),p.delete(h)):p.set(h,r)}H.delete(l),_!==t&&_.parentNode?.removeChild(_)}});return S.set(T,U),T}let S=new WeakMap;function Ye(i,e){const t=S.get(i);return t?(S.delete(i),t(e)):(A&&(de in i?ce():pe()),Promise.resolve())}export{Ne as c,Le as h,Oe as m,xe as s,Ye as u};
