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