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