import{S as U,q,U as B,V as z,i as K,W as L,X as H,e as d,h as _,F as b,L as Q,I as X,O as I,Y as Z,b as c,Z as T,p as O,a as W,_ as S,$ as y,a0 as M,a1 as G,a2 as A,g as $,m as J,a3 as tt,d as k,K as N,n as et,a4 as st,a5 as P,a6 as it,M as rt,a7 as nt,a8 as at,a9 as ht,aa as ot,ab as F,D as lt,ac as ft,P as ut,ad as x,Q as w,ae as ct,af as dt,ag as _t,ah as pt,w as gt,ai as vt,aj as yt,z as mt}from"./BtrLzPHK.js";import{b as bt}from"./C-JP16Co.js";function Et(e){let t=0,i=B(0),r;return()=>{U()&&(q(i),z(()=>(t===0&&(r=K(()=>e(()=>L(i)))),t+=1,()=>{H(()=>{t-=1,t===0&&(r?.(),r=void 0,L(i))})})))}}var Tt=rt|nt|at;function wt(e,t,i){new Rt(e,t,i)}class Rt{parent;#s=!1;#e;#g=_?d:null;#r;#u;#n;#i=null;#t=null;#a=null;#h=null;#o=null;#c=0;#l=0;#d=!1;#f=null;#m=Et(()=>(this.#f=B(this.#c),()=>{this.#f=null}));constructor(t,i,r){this.#e=t,this.#r=i,this.#u=r,this.parent=b.b,this.#s=!!this.#r.pending,this.#n=Q(()=>{if(b.b=this,_){const s=this.#g;X(),s.nodeType===I&&s.data===Z?this.#E():this.#b()}else{var a=this.#v();try{this.#i=c(()=>r(a))}catch(s){this.error(s)}this.#l>0?this.#p():this.#s=!1}return()=>{this.#o?.remove()}},Tt),_&&(this.#e=d)}#b(){try{this.#i=c(()=>this.#u(this.#e))}catch(t){this.error(t)}this.#s=!1}#E(){const t=this.#r.pending;t&&(this.#t=c(()=>t(this.#e)),T.enqueue(()=>{var i=this.#v();this.#i=this.#_(()=>(T.ensure(),c(()=>this.#u(i)))),this.#l>0?this.#p():(O(this.#t,()=>{this.#t=null}),this.#s=!1)}))}#v(){var t=this.#e;return this.#s&&(this.#o=W(),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.#r.pending}#_(t){var i=b,r=A,a=$;S(this.#n),y(this.#n),M(this.#n.ctx);try{return t()}catch(s){return G(s),null}finally{S(i),y(r),M(a)}}#p(){const t=this.#r.pending;this.#i!==null&&(this.#h=document.createDocumentFragment(),this.#h.append(this.#o),J(this.#i,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&&O(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.#m(),q(this.#f)}error(t){var i=this.#r.onerror;let r=this.#r.failed;if(this.#d||!i&&!r)throw t;this.#i&&(k(this.#i),this.#i=null),this.#t&&(k(this.#t),this.#t=null),this.#a&&(k(this.#a),this.#a=null),_&&(N(this.#g),et(),N(st()));var a=!1,s=!1;const o=()=>{if(a){ht();return}a=!0,s&&it(),T.ensure(),this.#c=0,this.#a!==null&&O(this.#a,()=>{this.#a=null}),this.#s=this.has_pending_snippet(),this.#i=this.#_(()=>(this.#d=!1,c(()=>this.#u(this.#e)))),this.#l>0?this.#p():this.#s=!1};var f=A;try{y(null),s=!0,i?.(t,o),s=!1}catch(l){P(l,this.#n&&this.#n.parent)}finally{y(f)}r&&H(()=>{this.#a=this.#_(()=>{T.ensure(),this.#d=!0;try{return c(()=>{r(this.#e,()=>t,()=>o)})}catch(l){return P(l,this.#n.parent),null}finally{this.#d=!1}})})}}const St=["touchstart","touchmove"];function Nt(e){return St.includes(e)}const Dt=new Set,V=new Set;let Y=null;function R(e){var t=this,i=t.ownerDocument,r=e.type,a=e.composedPath?.()||[],s=a[0]||e.target;Y=e;var o=0,f=Y===e&&e.__root;if(f){var l=a.indexOf(f);if(l!==-1&&(t===document||t===window)){e.__root=t;return}var p=a.indexOf(t);if(p===-1)return;l<=p&&(o=l)}if(s=a[o]||e.target,s!==t){ot(e,"currentTarget",{configurable:!0,get(){return s||i}});var D=A,u=b;y(null),S(null);try{for(var n,h=[];s!==null;){var g=s.assignedSlot||s.parentNode||s.host||null;try{var m=s["__"+r];m!=null&&(!s.disabled||e.target===s)&&m.call(s,e)}catch(E){n?h.push(E):n=E}if(e.cancelBubble||g===t||g===null)break;s=g}if(n){for(let E of h)queueMicrotask(()=>{throw E});throw n}}finally{e.__root=t,delete e.currentTarget,y(D),S(u)}}}function Ft(e,t){var i=t==null?"":typeof t=="object"?t+"":t;i!==(e.__t??=e.nodeValue)&&(e.__t=i,e.nodeValue=i+"")}function Ot(e,t){return j(e,t)}function xt(e,t){F(),t.intro=t.intro??!1;const i=t.target,r=_,a=d;try{for(var s=lt(i);s&&(s.nodeType!==I||s.data!==ft);)s=ut(s);if(!s)throw x;w(!0),N(s);const o=j(e,{...t,anchor:s});return w(!1),o}catch(o){if(o instanceof Error&&o.message.split(`
`).some(f=>f.startsWith("https://svelte.dev/e/")))throw o;return o!==x&&console.warn("Failed to hydrate: ",o),t.recover===!1&&ct(),F(),dt(i),w(!1),Ot(e,t)}finally{w(r),N(a)}}const v=new Map;function j(e,{target:t,anchor:i,props:r={},events:a,context:s,intro:o=!0}){F();var f=new Set,l=u=>{for(var n=0;n<u.length;n++){var h=u[n];if(!f.has(h)){f.add(h);var g=Nt(h);t.addEventListener(h,R,{passive:g});var m=v.get(h);m===void 0?(document.addEventListener(h,R,{passive:g}),v.set(h,1)):v.set(h,m+1)}}};l(_t(Dt)),V.add(l);var p=void 0,D=pt(()=>{var u=i??t.appendChild(W());return wt(u,{pending:()=>{}},n=>{if(s){gt({});var h=$;h.c=s}if(a&&(r.$$events=a),_&&bt(n,null),p=e(n,r)||{},_&&(b.nodes.end=d,d===null||d.nodeType!==I||d.data!==vt))throw yt(),x;s&&mt()}),()=>{for(var n of f){t.removeEventListener(n,R);var h=v.get(n);--h===0?(document.removeEventListener(n,R),v.delete(n)):v.set(n,h)}V.delete(l),u!==i&&u.parentNode?.removeChild(u)}});return C.set(p,D),p}let C=new WeakMap;function Ct(e,t){const i=C.get(e);return i?(C.delete(e),i(t)):Promise.resolve()}export{xt as h,Ot as m,Ft as s,Ct as u};
