import{aT as ee,g as z,r as te,h as re,aU as W,a3 as T,aG as U,X as v,R as p,i as E,aV as H,b as se,Z as ie,ay as ne,aW as B,ab as g,N as X,aa as F,n as P,ac as ae,aX as fe,aY as N,aZ as D,a_ as $,a$ as oe,b0 as he,b1 as Z,c as G,aA as le,a9 as M,W as O,ak as ce,a0 as de,b2 as S,E as ue,Q as _e,b3 as pe,b4 as ge,j as ve,b5 as ye,M as be,b6 as x,Y as Ee,T as J,b7 as me,U as we,au as L,V as R,b8 as Te,aK as Se,b9 as Re,aD as Ae,p as Ne,az as De,at as Oe,a as ke}from"./I3maXEMG.js";import{b as Fe}from"./ZuEhUEDa.js";function Me(t){let e=0,r=U(0),i;return()=>{ee()&&(z(r),te(()=>(e===0&&(i=re(()=>t(()=>W(r)))),e+=1,()=>{T(()=>{e-=1,e===0&&(i?.(),i=void 0,W(r))})})))}}var xe=ue|_e;function Le(t,e,r,i){new Ye(t,e,r,i)}class Ye{parent;is_pending=!1;transform_error;#t;#_=p?v:null;#i;#h;#e;#n=null;#r=null;#s=null;#a=null;#l=0;#o=0;#c=!1;#p=new Set;#g=new Set;#f=null;#b=Me(()=>(this.#f=U(this.#l),()=>{this.#f=null}));constructor(e,r,i,n){this.#t=e,this.#i=r,this.#h=s=>{var a=E;a.b=this,a.f|=H,i(s)},this.parent=E.b,this.transform_error=n??this.parent?.transform_error??(s=>s),this.#e=se(()=>{if(p){const s=this.#_;ie();const a=s.data===ne;if(s.data.startsWith(B)){const f=JSON.parse(s.data.slice(B.length));this.#m(f)}else a?this.#w():this.#E()}else this.#v()},xe),p&&(this.#t=v)}#E(){try{this.#n=g(()=>this.#h(this.#t))}catch(e){this.error(e)}}#m(e){const r=this.#i.failed;r&&(this.#s=g(()=>{r(this.#t,()=>e,()=>()=>{})}))}#w(){const e=this.#i.pending;e&&(this.is_pending=!0,this.#r=g(()=>e(this.#t)),T(()=>{var r=this.#a=document.createDocumentFragment(),i=X();r.append(i),this.#n=this.#u(()=>g(()=>this.#h(i))),this.#o===0&&(this.#t.before(r),this.#a=null,F(this.#r,()=>{this.#r=null}),this.#d(P))}))}#v(){try{if(this.is_pending=this.has_pending_snippet(),this.#o=0,this.#l=0,this.#n=g(()=>{this.#h(this.#t)}),this.#o>0){var e=this.#a=document.createDocumentFragment();ae(this.#n,e);const r=this.#i.pending;this.#r=g(()=>r(this.#t))}else this.#d(P)}catch(r){this.error(r)}}#d(e){this.is_pending=!1,e.transfer_effects(this.#p,this.#g)}defer_effect(e){fe(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=E,i=Z,n=G;N(this.#e),D(this.#e),$(this.#e.ctx);try{return oe.ensure(),e()}catch(s){return he(s),null}finally{N(r),D(i),$(n)}}#y(e,r){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(e,r);return}this.#o+=e,this.#o===0&&(this.#d(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.#c)&&(this.#c=!0,T(()=>{this.#c=!1,this.#f&&le(this.#f,this.#l)}))}get_effect_pending(){return this.#b(),z(this.#f)}error(e){var r=this.#i.onerror;let i=this.#i.failed;if(!r&&!i)throw e;this.#n&&(M(this.#n),this.#n=null),this.#r&&(M(this.#r),this.#r=null),this.#s&&(M(this.#s),this.#s=null),p&&(O(this.#_),ce(),O(de()));var n=!1,s=!1;const a=()=>{if(n){ge();return}n=!0,s&&pe(),this.#s!==null&&F(this.#s,()=>{this.#s=null}),this.#u(()=>{this.#v()})},d=f=>{try{s=!0,r?.(f,a),s=!1}catch(o){S(o,this.#e&&this.#e.parent)}i&&(this.#s=this.#u(()=>{try{return g(()=>{var o=E;o.b=this,o.f|=H,i(this.#t,()=>f,()=>a)})}catch(o){return S(o,this.#e.parent),null}}))};T(()=>{var f;try{f=this.transform_error(e)}catch(o){S(o,this.#e&&this.#e.parent);return}f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(d,o=>S(o,this.#e&&this.#e.parent)):d(f)})}}const Ce=["touchstart","touchmove"];function Ie(t){return Ce.includes(t)}const w=Symbol("events"),K=new Set,Y=new Set;function Pe(t){if(!p)return;t.removeAttribute("onload"),t.removeAttribute("onerror");const e=t.__e;e!==void 0&&(t.__e=void 0,queueMicrotask(()=>{t.isConnected&&t.dispatchEvent(e)}))}function Ve(t,e,r,i={}){function n(s){if(i.capture||C.call(e,s),!s.cancelBubble)return ye(()=>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 $e(t,e,r,i,n){var s={capture:i,passive:n},a=Ve(t,e,r,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&ve(()=>{e.removeEventListener(t,a,s)})}function qe(t,e,r){(e[w]??={})[t]=r}function je(t){for(var e=0;e<t.length;e++)K.add(t[e]);for(var r of Y)r(t)}let q=null;function C(t){var e=this,r=e.ownerDocument,i=t.type,n=t.composedPath?.()||[],s=n[0]||t.target;q=t;var a=0,d=q===t&&t[w];if(d){var f=n.indexOf(d);if(f!==-1&&(e===document||e===window)){t[w]=e;return}var o=n.indexOf(e);if(o===-1)return;f<=o&&(a=f)}if(s=n[a]||t.target,s!==e){be(t,"currentTarget",{configurable:!0,get(){return s||r}});var y=Z,m=E;D(null),N(null);try{for(var _,l=[];s!==null;){var h=s.assignedSlot||s.parentNode||s.host||null;try{var c=s[w]?.[i];c!=null&&(!s.disabled||t.target===s)&&c.call(s,t)}catch(u){_?l.push(u):_=u}if(t.cancelBubble||h===e||h===null)break;s=h}if(_){for(let u of l)queueMicrotask(()=>{throw u});throw _}}finally{t[w]=e,delete t.currentTarget,D(y),N(m)}}}let j=!0;function ze(t,e){var r=e==null?"":typeof e=="object"?`${e}`:e;r!==(t.__t??=t.nodeValue)&&(t.__t=r,t.nodeValue=`${r}`)}function We(t,e){return Q(t,e)}function Ue(t,e){x(),e.intro=e.intro??!1;const r=e.target,i=p,n=v;try{for(var s=Ee(r);s&&(s.nodeType!==J||s.data!==me);)s=we(s);if(!s)throw L;R(!0),O(s);const a=Q(t,{...e,anchor:s});return R(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
`).some(d=>d.startsWith("https://svelte.dev/e/")))throw a;return a!==L&&console.warn("Failed to hydrate: ",a),e.recover===!1&&Te(),x(),Se(r),R(!1),We(t,e)}finally{R(i),O(n)}}const A=new Map;function Q(t,{target:e,anchor:r,props:i={},events:n,context:s,intro:a=!0,transformError:d}){x();var f=void 0,o=Re(()=>{var y=r??e.appendChild(X());Le(y,{pending:()=>{}},l=>{Ne({});var h=G;if(s&&(h.c=s),n&&(i.$$events=n),p&&Fe(l,null),j=a,f=t(l,i)||{},j=!0,p&&(E.nodes.end=v,v===null||v.nodeType!==J||v.data!==De))throw Oe(),L;ke()},d);var m=new Set,_=l=>{for(var h=0;h<l.length;h++){var c=l[h];if(!m.has(c)){m.add(c);var u=Ie(c);for(const k of[e,document]){var b=A.get(k);b===void 0&&(b=new Map,A.set(k,b));var V=b.get(c);V===void 0?(k.addEventListener(c,C,{passive:u}),b.set(c,1)):b.set(c,V+1)}}}};return _(Ae(K)),Y.add(_),()=>{for(var l of m)for(const u of[e,document]){var h=A.get(u),c=h.get(l);--c==0?(u.removeEventListener(l,C),h.delete(l),h.size===0&&A.delete(u)):h.set(l,c)}Y.delete(_),y!==r&&y.parentNode?.removeChild(y)}});return I.set(f,o),f}let I=new WeakMap;function Xe(t,e){const r=I.get(t);return r?(I.delete(t),r(e)):Promise.resolve()}export{qe as a,j as b,je as d,$e as e,Ue as h,We as m,Pe as r,ze as s,Xe as u};
