import{ae as $,v as q,V as W,a7 as G,k as J,af as B,q as C,i as d,h as _,a4 as m,G as Q,J as U,R as M,O as K,f as c,ag as T,p as A,e as Y,ah as S,ai as y,aj as H,ak as X,al as D,j,m as Z,T as tt,d as O,H as N,am as et,P as st,an as I,ao as rt,ap as it,aq as nt,ar as at,as as ht,at as ot,au as lt,av as ft,aw as L,I as ut,ax as ct,a0 as dt,ay as x,Q as R,az as _t,a2 as pt,W as gt,aA as vt,z as yt,S as bt,aB as Et,C as mt}from"./ACtANFiy.js";import{b as wt}from"./BFDYvPbj.js";function Tt(e){let t=0,r=W(0),i;return()=>{$()&&(q(r),G(()=>(t===0&&(i=J(()=>e(()=>B(r)))),t+=1,()=>{C(()=>{t-=1,t===0&&(i?.(),i=void 0,B(r))})})))}}var Rt=it|nt|at;function St(e,t,r){new Nt(e,t,r)}class Nt{parent;#s=!1;#e;#g=_?d:null;#i;#u;#n;#r=null;#t=null;#a=null;#h=null;#o=null;#c=0;#l=0;#d=!1;#f=null;#b=Tt(()=>(this.#f=W(this.#c),()=>{this.#f=null}));constructor(t,r,i){this.#e=t,this.#i=r,this.#u=i,this.parent=m.b,this.#s=!!this.#i.pending,this.#n=Q(()=>{if(m.b=this,_){const s=this.#g;U(),s.nodeType===M&&s.data===K?this.#m():this.#E()}else{var n=this.#v();try{this.#r=c(()=>i(n))}catch(s){this.error(s)}this.#l>0?this.#p():this.#s=!1}return()=>{this.#o?.remove()}},Rt),_&&(this.#e=d)}#E(){try{this.#r=c(()=>this.#u(this.#e))}catch(t){this.error(t)}this.#s=!1}#m(){const t=this.#i.pending;t&&(this.#t=c(()=>t(this.#e)),T.enqueue(()=>{var r=this.#v();this.#r=this.#_(()=>(T.ensure(),c(()=>this.#u(r)))),this.#l>0?this.#p():(A(this.#t,()=>{this.#t=null}),this.#s=!1)}))}#v(){var t=this.#e;return this.#s&&(this.#o=Y(),this.#e.before(this.#o),t=this.#o),t}is_pending(){return this.#s||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#i.pending}#_(t){var r=m,i=D,n=j;S(this.#n),y(this.#n),H(this.#n.ctx);try{return t()}catch(s){return X(s),null}finally{S(r),y(i),H(n)}}#p(){const t=this.#i.pending;this.#r!==null&&(this.#h=document.createDocumentFragment(),this.#h.append(this.#o),Z(this.#r,this.#h)),this.#t===null&&(this.#t=c(()=>t(this.#e)))}#y(t){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(t);return}this.#l+=t,this.#l===0&&(this.#s=!1,this.#t&&A(this.#t,()=>{this.#t=null}),this.#h&&(this.#e.before(this.#h),this.#h=null))}update_pending_count(t){this.#y(t),this.#c+=t,this.#f&&tt(this.#f,this.#c)}get_effect_pending(){return this.#b(),q(this.#f)}error(t){var r=this.#i.onerror;let i=this.#i.failed;if(this.#d||!r&&!i)throw t;this.#r&&(O(this.#r),this.#r=null),this.#t&&(O(this.#t),this.#t=null),this.#a&&(O(this.#a),this.#a=null),_&&(N(this.#g),et(),N(st()));var n=!1,s=!1;const a=()=>{if(n){ht();return}n=!0,s&&rt(),T.ensure(),this.#c=0,this.#a!==null&&A(this.#a,()=>{this.#a=null}),this.#s=this.has_pending_snippet(),this.#r=this.#_(()=>(this.#d=!1,c(()=>this.#u(this.#e)))),this.#l>0?this.#p():this.#s=!1};var f=D;try{y(null),s=!0,r?.(t,a),s=!1}catch(l){I(l,this.#n&&this.#n.parent)}finally{y(f)}i&&C(()=>{this.#a=this.#_(()=>{T.ensure(),this.#d=!0;try{return c(()=>{i(this.#e,()=>t,()=>a)})}catch(l){return I(l,this.#n.parent),null}finally{this.#d=!1}})})}}const kt=["touchstart","touchmove"];function At(e){return kt.includes(e)}const Ot=new Set,P=new Set;function Dt(e,t,r,i={}){function n(s){if(i.capture||E.call(t,s),!s.cancelBubble)return lt(()=>r?.call(this,s))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?C(()=>{t.addEventListener(e,n,i)}):t.addEventListener(e,n,i),n}function Ct(e,t,r,i,n){var s={capture:i,passive:n},a=Dt(e,t,r,s);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&ot(()=>{t.removeEventListener(e,a,s)})}let V=null;function E(e){var t=this,r=t.ownerDocument,i=e.type,n=e.composedPath?.()||[],s=n[0]||e.target;V=e;var a=0,f=V===e&&e.__root;if(f){var l=n.indexOf(f);if(l!==-1&&(t===document||t===window)){e.__root=t;return}var p=n.indexOf(t);if(p===-1)return;l<=p&&(a=l)}if(s=n[a]||e.target,s!==t){ft(e,"currentTarget",{configurable:!0,get(){return s||r}});var k=D,u=m;y(null),S(null);try{for(var h,o=[];s!==null;){var g=s.assignedSlot||s.parentNode||s.host||null;try{var b=s["__"+i];b!=null&&(!s.disabled||e.target===s)&&b.call(s,e)}catch(w){h?o.push(w):h=w}if(e.cancelBubble||g===t||g===null)break;s=g}if(h){for(let w of o)queueMicrotask(()=>{throw w});throw h}}finally{e.__root=t,delete e.currentTarget,y(k),S(u)}}}function Mt(e,t){var r=t==null?"":typeof t=="object"?t+"":t;r!==(e.__t??=e.nodeValue)&&(e.__t=r,e.nodeValue=r+"")}function Lt(e,t){return z(e,t)}function Bt(e,t){L(),t.intro=t.intro??!1;const r=t.target,i=_,n=d;try{for(var s=ut(r);s&&(s.nodeType!==M||s.data!==ct);)s=dt(s);if(!s)throw x;R(!0),N(s);const a=z(e,{...t,anchor:s});return R(!1),a}catch(a){if(a instanceof Error&&a.message.split(` `).some(f=>f.startsWith("https://svelte.dev/e/")))throw a;return a!==x&&console.warn("Failed to hydrate: ",a),t.recover===!1&&_t(),L(),pt(r),R(!1),Lt(e,t)}finally{R(i),N(n)}}const v=new Map;function z(e,{target:t,anchor:r,props:i={},events:n,context:s,intro:a=!0}){L();var f=new Set,l=u=>{for(var h=0;h{var u=r??t.appendChild(Y());return St(u,{pending:()=>{}},h=>{if(s){yt({});var o=j;o.c=s}if(n&&(i.$$events=n),_&&wt(h,null),p=e(h,i)||{},_&&(m.nodes_end=d,d===null||d.nodeType!==M||d.data!==bt))throw Et(),x;s&&mt()}),()=>{for(var h of f){t.removeEventListener(h,E);var o=v.get(h);--o===0?(document.removeEventListener(h,E),v.delete(h)):v.set(h,o)}P.delete(l),u!==r&&u.parentNode?.removeChild(u)}});return F.set(p,k),p}let F=new WeakMap;function Ht(e,t){const r=F.get(e);return r?(F.delete(e),r(t)):Promise.resolve()}export{Ct as e,Bt as h,Lt as m,Mt as s,Ht as u};