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