import{B as q,l as I,C as M,D as U,i as j,E as S,F as B,e as u,h as c,G as E,H as G,I as J,J as F,K,b as d,L as g,p as R,a as P,M as x,N as v,O as C,P as Q,Q as L,f as V,m as X,R as Z,d as w,S as b,T as z,U as ee,V as Y,W as te,X as se,Y as ie,Z as ne,_ as re,$ as N,a0 as ae,a1 as he,a2 as oe,a3 as D,a4 as y,a5 as fe,a6 as le,a7 as _e,a8 as de,t as ue,a9 as ce,aa as pe,x as ge}from"./zXDdy2c_.js";import{b as ve,r as H,h as m,i as ye,c as me}from"./DDNfEvut.js";function Ee(i){let e=0,t=M(0),n;return()=>{q()&&(I(t),U(()=>(e===0&&(n=j(()=>i(()=>S(t)))),e+=1,()=>{B(()=>{e-=1,e===0&&(n?.(),n=void 0,S(t))})})))}}var be=se|ie|ne;function Te(i,e,t){new Re(i,e,t)}class Re{parent;#s=!1;#t;#g=c?u:null;#n;#_;#r;#i=null;#e=null;#a=null;#h=null;#o=null;#d=0;#f=0;#u=!1;#l=null;#m=Ee(()=>(this.#l=M(this.#d),()=>{this.#l=null}));constructor(e,t,n){this.#t=e,this.#n=t,this.#_=n,this.parent=E.b,this.#s=!!this.#n.pending,this.#r=G(()=>{if(E.b=this,c){const s=this.#g;J(),s.nodeType===F&&s.data===K?this.#b():this.#E()}else{var o=this.#v();try{this.#i=d(()=>n(o))}catch(s){this.error(s)}this.#f>0?this.#p():this.#s=!1}return()=>{this.#o?.remove()}},be),c&&(this.#t=u)}#E(){try{this.#i=d(()=>this.#_(this.#t))}catch(e){this.error(e)}this.#s=!1}#b(){const e=this.#n.pending;e&&(this.#e=d(()=>e(this.#t)),g.enqueue(()=>{var t=this.#v();this.#i=this.#c(()=>(g.ensure(),d(()=>this.#_(t)))),this.#f>0?this.#p():(R(this.#e,()=>{this.#e=null}),this.#s=!1)}))}#v(){var e=this.#t;return this.#s&&(this.#o=P(),this.#t.before(this.#o),e=this.#o),e}is_pending(){return this.#s||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#n.pending}#c(e){var t=E,n=L,o=V;x(this.#r),v(this.#r),C(this.#r.ctx);try{return e()}catch(s){return Q(s),null}finally{x(t),v(n),C(o)}}#p(){const e=this.#n.pending;this.#i!==null&&(this.#h=document.createDocumentFragment(),this.#h.append(this.#o),X(this.#i,this.#h)),this.#e===null&&(this.#e=d(()=>e(this.#t)))}#y(e){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(e);return}this.#f+=e,this.#f===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.#d+=e,this.#l&&Z(this.#l,this.#d)}get_effect_pending(){return this.#m(),I(this.#l)}error(e){var t=this.#n.onerror;let n=this.#n.failed;if(this.#u||!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&&(b(this.#g),z(),b(ee()));var o=!1,s=!1;const a=()=>{if(o){re();return}o=!0,s&&te(),g.ensure(),this.#d=0,this.#a!==null&&R(this.#a,()=>{this.#a=null}),this.#s=this.has_pending_snippet(),this.#i=this.#c(()=>(this.#u=!1,d(()=>this.#_(this.#t)))),this.#f>0?this.#p():this.#s=!1};var f=L;try{v(null),s=!0,t?.(e,a),s=!1}catch(l){Y(l,this.#r&&this.#r.parent)}finally{v(f)}n&&B(()=>{this.#a=this.#c(()=>{g.ensure(),this.#u=!0;try{return d(()=>{n(this.#t,()=>e,()=>a)})}catch(l){return Y(l,this.#r.parent),null}finally{this.#u=!1}})})}}function Ae(i,e){var t=e==null?"":typeof e=="object"?e+"":e;t!==(i.__t??=i.nodeValue)&&(i.__t=t,i.nodeValue=t+"")}function we(i,e){return W(i,e)}function Fe(i,e){N(),e.intro=e.intro??!1;const t=e.target,n=c,o=u;try{for(var s=ae(t);s&&(s.nodeType!==F||s.data!==he);)s=oe(s);if(!s)throw D;y(!0),b(s);const a=W(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&&fe(),N(),le(t),y(!1),we(i,e)}finally{y(n),b(o)}}const p=new Map;function W(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 O=ye(r);e.addEventListener(r,m,{passive:O});var k=p.get(r);k===void 0?(document.addEventListener(r,m,{passive:O}),p.set(r,1)):p.set(r,k+1)}}};l(_e(ve)),H.add(l);var T=void 0,$=de(()=>{var _=t??e.appendChild(P());return Te(_,{pending:()=>{}},h=>{if(s){ue({});var r=V;r.c=s}if(o&&(n.$$events=o),c&&me(h,null),T=i(h,n)||{},c&&(E.nodes_end=u,u===null||u.nodeType!==F||u.data!==ce))throw pe(),D;s&&ge()}),()=>{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 A.set(T,$),T}let A=new WeakMap;function Oe(i,e){const t=A.get(i);return t?(A.delete(i),t(e)):Promise.resolve()}export{Ee as c,Fe as h,we as m,Ae as s,Oe as u};
