import hardening: recurring events are not supported (yet), make the poster aware
diff --git a/README.md b/README.md index 04ebd54..c9b7d7c 100644 --- a/README.md +++ b/README.md
@@ -601,6 +601,7 @@ | a title longer than the limit | trimmed, with a note | | a `mailto:` or other non-http `URL` | dropped, with a note | | `RRULE` | imported as a single occurrence, with a note | +| `RECURRENCE-ID` (a moved occurrence) | imported as its own event, under the series' `UID` | | `STATUS:CANCELLED`, or no `DTSTART` | skipped, and counted in the file's warnings | | `VTODO`, `VJOURNAL` | ignored; only `VEVENT` is an event | @@ -610,6 +611,11 @@ validated and the permission checked before any of them is written, so a file either lands completely or not at all. +A `UID` is therefore not unique within an import, and neither is a warning: +a series and each of its moved occurrences share one `UID`, and two entries can +raise word-for-word the same note. Nothing that renders or stores a preview may +treat either as an identifier. + At most 200 events and 1 MiB per file. ### From a script
diff --git a/backend/tests/test_icsimport.py b/backend/tests/test_icsimport.py index 65d4d17..7fa83b9 100644 --- a/backend/tests/test_icsimport.py +++ b/backend/tests/test_icsimport.py
@@ -205,6 +205,24 @@ assert len(result.candidates) == 1 assert any("repeats" in warning for warning in result.candidates[0].warnings) + def test_a_modified_occurrence_keeps_the_uid_of_the_event_it_belongs_to(self) -> None: + """UIDs are not unique, so nothing downstream may treat one as an identifier. + + This is how every exporter writes a repeating event with an exception: + the series, then one VEVENT per moved occurrence, all under one UID. The + import preview keyed its list on the UID and fell over on a real file. + """ + document = calendar( + event(UID="1@t", SUMMARY="Weekly", DTSTART="20260710T090000Z", RRULE="FREQ=WEEKLY;COUNT=5"), + event(UID="1@t", SUMMARY="Weekly (moved)", DTSTART="20260717T110000Z", RECURRENCE_ID="20260717T090000Z"), + ) + candidates = parse(document).candidates + assert [candidate.title for candidate in candidates] == ["Weekly", "Weekly (moved)"] + assert {candidate.uid for candidate in candidates} == {"1@t"} + + def test_an_event_with_no_uid_still_imports(self) -> None: + assert only(calendar(event(SUMMARY="Anonymous", DTSTART="20260710T090000Z"))).uid is None + def test_cancelled_events_are_left_out(self) -> None: document = calendar( TIMED,
diff --git a/frontend/dist/assets/index-DwsHFb2B.js b/frontend/dist/assets/index-RGVtRUlj.js similarity index 78% rename from frontend/dist/assets/index-DwsHFb2B.js rename to frontend/dist/assets/index-RGVtRUlj.js index c67e8f2..9e6a518 100644 --- a/frontend/dist/assets/index-DwsHFb2B.js +++ b/frontend/dist/assets/index-RGVtRUlj.js
@@ -1,12 +1,12 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(s){if(s.ep)return;s.ep=!0;const l=n(s);fetch(s.href,l)}})();const Ga=!1;var mr=Array.isArray,ll=Array.prototype.indexOf,or=Array.prototype.includes,wr=Array.from,Ka=Object.defineProperty,wn=Object.getOwnPropertyDescriptor,ol=Object.getOwnPropertyDescriptors,il=Object.prototype,cl=Array.prototype,Ja=Object.getPrototypeOf,ma=Object.isExtensible;const ul=()=>{};function vl(e){for(var t=0;t<e.length;t++)e[t]()}function Xa(){var e,t,n=new Promise((r,s)=>{e=r,t=s});return{promise:n,resolve:e,reject:t}}const qe=2,kn=4,br=8,Qa=1<<24,mt=16,dt=32,Yt=64,Nr=128,Jr=256,vt=512,Le=1024,Ce=2048,yt=4096,Ve=8192,nt=16384,zn=32768,ir=1<<25,xn=65536,cr=1<<17,fl=1<<18,Dn=1<<19,dl=1<<20,Ct=1<<25,on=65536,ur=1<<21,bn=1<<22,Xt=1<<23,an=Symbol("$state"),$a=Symbol("component"),hl=Symbol("legacy props"),pl=Symbol(""),es=Symbol("attributes"),Rr=Symbol("class"),Fr=Symbol("style"),Ur=Symbol("text"),rr=Symbol("form reset"),Vn=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},_l=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml"),gl=1,ml=2,ts=4,wl=8,bl=16,yl=1,kl=4,xl=8,Tl=16,El=1,Sl=2,Pe=Symbol("uninitialized"),Al="http://www.w3.org/1999/xhtml";function zl(){console.warn("https://svelte.dev/e/derived_inert")}function Dl(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Cl(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function ns(e){return e===this.v}function jl(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function rs(e){return!jl(e,this.v)}function Ml(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Pl(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Ll(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ol(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Il(e){throw new Error("https://svelte.dev/e/effect_orphan")}function ql(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Nl(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function Rl(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Fl(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Ul(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Hl(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}let Yl=!1,Ge=null;function Tn(e){Ge=e}function Je(e,t=!1,n){Ge={p:Ge,i:!1,c:null,e:null,s:e,x:null,r:de,l:null}}function Xe(e){var t=Ge,n=t.e;if(n!==null){t.e=null;for(var r of n)ks(r)}return t.i=!0,Ge=t.p,Xr(e)}function Xr(e={}){return Ka(e,$a,{value:!0}),e}function as(){return!0}let nn=[];function ss(){var e=nn;nn=[],vl(e)}function Ft(e){if(nn.length===0&&!Fn){var t=nn;queueMicrotask(()=>{t===nn&&ss()})}nn.push(e)}function Zl(){for(;nn.length>0;)ss()}const Bl=-7169;function ze(e,t){e.f=e.f&Bl|t}function Qr(e){(e.f&vt)!==0||e.deps===null?ze(e,Le):ze(e,yt)}function ls(e){if(e!==null)for(const t of e)(t.f&qe)===0||(t.f&on)===0||(t.f^=on,ls(t.deps))}function os(e,t,n){(e.f&Ce)!==0?t.add(e):(e.f&yt)!==0&&n.add(e),ls(e.deps),ze(e,Le)}let $n=!1;function Wl(e){var t=$n;try{return $n=!1,[e(),$n]}finally{$n=t}}let wa=!1;function Vl(){wa||(wa=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t[rr]?.()})},{capture:!0}))}function Cn(e){var t=pe,n=de;ht(null),It(null);try{return e()}finally{ht(t),It(n)}}function $r(e,t,n,r=n){e.addEventListener(t,()=>Cn(n));const s=e[rr];s?e[rr]=()=>{s(),r(!0)}:e[rr]=()=>r(!0),Vl()}function Gl(e,t,n,r){const s=Hn;var l=e.filter(h=>!h.settled),o=t.map(s);if(n.length===0&&l.length===0){r(o);return}var c=de,i=Kl(),v=l.length===1?l[0].promise:l.length>1?Promise.all(l.map(h=>h.promise)):null;function _(h){if((c.f&nt)===0){i();try{r([...o,...h])}catch(y){zt(y,c)}vr()}}var f=is();if(n.length===0){v.then(()=>_([])).finally(f);return}function d(){Promise.all(n.map(h=>Jl(h))).then(_).catch(h=>zt(h,c)).finally(f)}v?v.then(()=>{i(),d(),vr()}):d()}function Kl(){var e=de,t=pe,n=Ge,r=ue;return function(l=!0){It(e),ht(t),Tn(n),l&&(e.f&nt)===0&&(r?.activate(),r?.apply())}}function vr(e=!0){It(null),ht(null),Tn(null),e&&ue?.deactivate()}function is(){var e=de,t=e.b,n=ue,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function Hn(e){var t=qe|Ce;return de!==null&&(de.f|=Dn),{ctx:Ge,deps:null,effects:null,equals:ns,f:t,fn:e,reactions:null,rv:0,v:Pe,wv:0,parent:de,ac:null}}const Ln=Symbol("obsolete");function Jl(e,t,n){let r=de;r===null&&Ml();var s=void 0,l=cn(Pe),o=!pe,c=new Set;return vo(()=>{var i=de,v=Xa();s=v.promise;try{Promise.resolve(e()).then(v.resolve,h=>{h!==Vn&&v.reject(h)}).finally(vr)}catch(h){v.reject(h),vr()}var _=ue;if(o){if((i.f&zn)!==0)var f=is();if(r.b?.is_rendered())_.async_deriveds.get(i)?.reject(Ln);else for(const h of c.values())h.reject(Ln);c.add(v),_.async_deriveds.set(i,v)}const d=(h,y=void 0)=>{f?.(),c.delete(v),y!==Ln&&(_.activate(),y?(l.f|=Xt,En(l,y)):((l.f&Xt)!==0&&(l.f^=Xt),En(l,h)),_.deactivate())};v.promise.then(d,h=>d(null,h||"unknown"))}),aa(()=>{for(const i of c)i.reject(Ln)}),new Promise(i=>{function v(_){function f(){_===s?i(l):v(s)}_.then(f,f)}v(s)})}function ee(e){const t=Hn(e);return zs(t),t}function cs(e){const t=Hn(e);return t.equals=rs,t}function Xl(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)rt(t[n])}}function ea(e){var t,n=de,r=e.parent;if(!Zt&&r!==null&&e.v!==Pe&&(r.f&(nt|Ve))!==0)return zl(),e.v;It(r);try{e.f&=~on,Xl(e),t=Ms(e)}finally{It(n)}return t}function us(e){var t=ea(e);if(!e.equals(t)&&(e.wv=Cs(),(!ue?.is_fork||e.deps===null)&&(ue!==null?(ue.capture(e,t,!0),Hr?.capture(e,t,!0)):e.v=t,e.deps===null))){ze(e,Le);return}Zt||(wt!==null?(ra()||ue?.is_fork)&&wt.set(e,t):Qr(e))}function Ql(e){if(e.effects!==null)for(const t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac!==null&&Cn(()=>{t.ac.abort(Vn),t.ac=null}),t.fn!==null&&(t.teardown=ul),Zn(t,0),la(t))}function vs(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&t.fn!==null&&Sn(t)}let Ar=null,hn=null,ue=null,Hr=null,wt=null,Yr=null,Fn=!1,zr=!1,_n=null,ar=null;var ba=0;let $l=1;class tn{id=$l++;#t=!1;linked=!0;#l=null;#e=null;async_deriveds=new Map;current=new Map;previous=new Map;#i=new Set;#r=new Set;#s=0;#n=new Map;#o=null;#a=[];#p=[];#c=new Set;#u=new Set;#f=new Map;#_=new Set;is_fork=!1;#v=!1;constructor(){hn===null?Ar=hn=this:(hn.#e=this,this.#l=hn),hn=this}#w(){if(this.is_fork)return!0;for(const r of this.#n.keys()){for(var t=r,n=!1;t.parent!==null;){if(this.#f.has(t)){n=!0;break}t=t.parent}if(!n)return!0}return!1}skip_effect(t){this.#f.has(t)||this.#f.set(t,{d:[],m:[]}),this.#_.delete(t)}unskip_effect(t,n=r=>this.schedule(r)){var r=this.#f.get(t);if(r){this.#f.delete(t);for(var s of r.d)ze(s,Ce),n(s);for(s of r.m)ze(s,yt),n(s)}this.#_.add(t)}#g(){this.#t=!0,ba++>1e3&&(this.#h(),to());for(const i of this.#c)this.#u.delete(i),ze(i,Ce),this.schedule(i);for(const i of this.#u)ze(i,yt),this.schedule(i);const t=this.#a;this.#a=[],this.apply();var n=_n=[],r=[],s=ar=[];for(const i of t)try{this.#y(i,n,r)}catch(v){throw hs(i),this.#w()||this.discard(),v}if(ue=null,s.length>0){var l=tn.ensure();for(const i of s)l.schedule(i)}if(_n=null,ar=null,this.#w()){this.#d(r),this.#d(n);for(const[i,v]of this.#f)ds(i,v);s.length>0&&ue.#g();return}const o=this.#b();if(o){this.#d(r),this.#d(n),o.#k(this);return}this.#c.clear(),this.#u.clear();for(const i of this.#i)i(this);this.#i.clear(),Hr=this,ya(r),ya(n),Hr=null,this.#o?.resolve();var c=ue;if(this.#s===0&&(this.#a.length===0||c!==null)&&this.#h(),this.#a.length>0)if(c!==null){const i=c;i.#a.push(...this.#a.filter(v=>!i.#a.includes(v)))}else c=this;c!==null&&(Pt.clear(),c.#g())}#y(t,n,r){t.f^=Le;for(var s=t.first;s!==null;){var l=s.f,o=(l&(dt|Yt))!==0,c=o&&(l&Le)!==0,i=c||(l&Ve)!==0||this.#f.has(s);if(!i&&s.fn!==null){o?s.f^=Le:(l&kn)!==0?n.push(s):Kn(s)&&((l&mt)!==0&&this.#u.add(s),Sn(s));var v=s.first;if(v!==null){s=v;continue}}for(;s!==null;){var _=s.next;if(_!==null){s=_;break}s=s.parent}}}#b(){for(var t=this.#l;t!==null;){if(!t.is_fork){for(const[n,[,r]]of this.current)if(t.current.has(n)&&!r)return t}t=t.#l}return null}#k(t){for(const[r,s]of t.current)!this.previous.has(r)&&t.previous.has(r)&&this.previous.set(r,t.previous.get(r)),this.current.set(r,s);for(const[r,s]of t.async_deriveds){const l=this.async_deriveds.get(r);l&&s.promise.then(l.resolve).catch(l.reject)}t.async_deriveds.clear(),this.transfer_effects(t.#c,t.#u);const n=r=>{var s=r.reactions;if(s!==null&&!((r.f&qe)!==0&&(r.f&(Ce|yt))===0))for(const c of s){var l=c.f;if((l&qe)!==0)n(c);else{var o=c;l&(bn|mt)&&!this.async_deriveds.has(o)&&(this.#u.delete(o),ze(o,Ce),this.schedule(o))}}};for(const r of this.current.keys())n(r);this.oncommit(()=>t.discard()),t.#h(),ue=this,this.#g()}#d(t){for(var n=0;n<t.length;n+=1)os(t[n],this.#c,this.#u)}capture(t,n,r=!1){t.v!==Pe&&!this.previous.has(t)&&this.previous.set(t,t.v),(t.f&Xt)===0&&(this.current.set(t,[n,r]),wt?.set(t,n)),this.is_fork||(t.v=n)}activate(){ue=this}deactivate(){ue=null,wt=null}flush(){try{zr=!0,ue=this,this.#g()}finally{ba=0,Yr=null,_n=null,ar=null,zr=!1,ue=null,wt=null,Pt.clear()}}discard(){for(const t of this.#r)t(this);this.#r.clear();for(const t of this.async_deriveds.values())t.reject(Ln);this.#h(),this.#o?.resolve()}register_created_effect(t){this.#p.push(t)}#m(){for(let f=Ar;f!==null;f=f.#e){var t=f.id<this.id,n=[];for(const[d,[h,y]]of this.current){if(f.current.has(d)){var r=f.current.get(d)[0];if(t&&h!==r)f.current.set(d,[h,y]);else continue}n.push(d)}if(t)for(const[d,h]of this.async_deriveds){const y=f.async_deriveds.get(d);y&&h.promise.then(y.resolve).catch(y.reject)}var s=[...f.current.keys()].filter(d=>!f.current.get(d)[1]);if(!(!f.#t||s.length===0)){var l=s.filter(d=>!this.current.has(d));if(l.length===0)t&&f.discard();else if(n.length>0){if(t)for(const d of this.#_)f.unskip_effect(d,h=>{(h.f&(mt|bn))!==0?f.schedule(h):f.#d([h])});f.activate();var o=new Set,c=new Map;for(var i of n)fs(i,l,o,c);c=new Map;var v=[...f.current].filter(([d,h])=>{const y=this.current.get(d);return y?y[0]!==h[0]||y[1]!==h[1]:!0}).map(([d])=>d);if(v.length>0)for(const d of this.#p)(d.f&(nt|Ve|cr))===0&&ta(d,v,c)&&((d.f&(bn|mt))!==0?(ze(d,Ce),f.schedule(d)):f.#c.add(d));if(f.#a.length>0&&!f.#v){f.apply();for(var _ of f.#a)f.#y(_,[],[]);f.#a=[]}f.deactivate()}}}}increment(t,n){if(this.#s+=1,t){let r=this.#n.get(n)??0;this.#n.set(n,r+1)}}decrement(t,n){if(this.#s-=1,t){let r=this.#n.get(n)??0;r===1?this.#n.delete(n):this.#n.set(n,r-1)}this.#v||(this.#v=!0,Ft(()=>{this.#v=!1,this.linked&&this.flush()}))}transfer_effects(t,n){for(const r of t)this.#c.add(r);for(const r of n)this.#u.add(r);t.clear(),n.clear()}oncommit(t){this.#i.add(t)}ondiscard(t){this.#r.add(t)}settled(){return(this.#o??=Xa()).promise}static ensure(){if(ue===null){const t=ue=new tn;!zr&&!Fn&&Ft(()=>{t.#t||t.flush()})}return ue}apply(){{wt=null;return}}schedule(t){if(Yr=t,t.b?.is_pending&&(t.f&(kn|br|Qa))!==0&&(t.f&zn)===0){t.b.defer_effect(t);return}for(var n=t;n.parent!==null;){n=n.parent;var r=n.f;if(_n!==null&&n===de&&(pe===null||(pe.f&qe)===0))return;if((r&(Yt|dt))!==0){if((r&Le)===0)return;n.f^=Le}}this.#a.push(n)}#h(){if(this.linked){var t=this.#l,n=this.#e;t===null?Ar=n:t.#e=n,n===null?hn=t:n.#l=t,this.linked=!1}}}function eo(e){var t=Fn;Fn=!0;try{for(var n;;){if(Zl(),ue===null)return n;ue.flush()}}finally{Fn=t}}function to(){try{ql()}catch(e){zt(e,Yr)}}let Rt=null;function ya(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if((r.f&(nt|Ve))===0&&Kn(r)&&(Rt=new Set,Sn(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&Es(r),Rt?.size>0)){Pt.clear();for(const s of Rt){if((s.f&(nt|Ve))!==0)continue;const l=[s];let o=s.parent;for(;o!==null;)Rt.has(o)&&(Rt.delete(o),l.push(o)),o=o.parent;for(let c=l.length-1;c>=0;c--){const i=l[c];(i.f&(nt|Ve))===0&&Sn(i)}}Rt.clear()}}Rt=null}}function fs(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const s of e.reactions){const l=s.f;(l&qe)!==0?fs(s,t,n,r):(l&(bn|mt))!==0&&(l&Ce)===0&&ta(s,t,r)&&(ze(s,Ce),na(s))}}function ta(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const s of e.deps){if(or.call(t,s))return!0;if((s.f&qe)!==0&&ta(s,t,n))return n.set(s,!0),!0}return n.set(e,!1),!1}function na(e){ue.schedule(e)}function ds(e,t){if(!((e.f&dt)!==0&&(e.f&Le)!==0)){(e.f&Ce)!==0?t.d.push(e):(e.f&yt)!==0&&t.m.push(e),ze(e,Le);for(var n=e.first;n!==null;)ds(n,t),n=n.next}}function hs(e){ze(e,Le);for(var t=e.first;t!==null;)hs(t),t=t.next}let fr=new Set;const Pt=new Map;let ps=!1;function cn(e,t){var n={f:0,v:e,reactions:null,equals:ns,rv:0,wv:0};return n}function ce(e,t){const n=cn(e);return zs(n),n}function no(e,t=!1,n=!0){const r=cn(e);return t||(r.equals=rs),r}function k(e,t,n=!1){pe!==null&&(!bt||(pe.f&cr)!==0)&&as()&&(pe.f&(qe|mt|bn|cr))!==0&&(Lt===null||!Lt.has(e))&&Ul();let r=n?Ze(t):t;return En(e,r,ar)}function En(e,t,n=null){if(!e.equals(t)){Zt?Pt.set(e,t):Pt.has(e)||Pt.set(e,e.v);var r=tn.ensure();if(r.capture(e,t),(e.f&qe)!==0){const s=e;(e.f&Ce)!==0&&ea(s),wt===null&&Qr(s)}e.wv=Cs(),_s(e,Ce,n),de!==null&&(de.f&Le)!==0&&(de.f&(dt|Yt))===0&&(it===null?po([e]):it.push(e)),!r.is_fork&&fr.size>0&&!ps&&ro()}return t}function ro(){ps=!1;for(const e of fr){(e.f&Le)!==0&&ze(e,yt);let t;try{t=Kn(e)}catch{t=!0}t&&Sn(e)}fr.clear()}function Un(e){k(e,e.v+1)}function _s(e,t,n){var r=e.reactions;if(r!==null)for(var s=r.length,l=0;l<s;l++){var o=r[l],c=o.f,i=(c&Ce)===0;if(i&&ze(o,t),(c&cr)!==0)fr.add(o);else if((c&qe)!==0){var v=o;wt?.delete(v),(c&on)===0&&(c&vt&&(de===null||(de.f&ur)===0)&&(o.f|=on),_s(v,yt,n))}else if(i){var _=o;(c&mt)!==0&&Rt!==null&&Rt.add(_),n!==null?n.push(_):na(_)}}}function Ze(e){if(typeof e!="object"||e===null||an in e||$a in e)return e;const t=Ja(e);if(t!==il&&t!==cl)return e;var n=new Map,r=mr(e),s=ce(0),l=ln,o=c=>{if(ln===l)return c();var i=pe,v=ln;ht(null),Ta(l);var _=c();return ht(i),Ta(v),_};return r&&n.set("length",ce(e.length)),new Proxy(e,{defineProperty(c,i,v){(!("value"in v)||v.configurable===!1||v.enumerable===!1||v.writable===!1)&&Rl();var _=n.get(i);return _===void 0?o(()=>{var f=ce(v.value);return n.set(i,f),f}):k(_,v.value,!0),!0},deleteProperty(c,i){var v=n.get(i);if(v===void 0){if(i in c){const _=o(()=>ce(Pe));n.set(i,_),Un(s)}}else k(v,Pe),Un(s);return!0},get(c,i,v){if(i===an)return e;var _=n.get(i),f=i in c;if(_===void 0&&(!f||wn(c,i)?.writable)&&(_=o(()=>{var h=Ze(f?c[i]:Pe),y=ce(h);return y}),n.set(i,_)),_!==void 0){var d=a(_);return d===Pe?void 0:d}return Reflect.get(c,i,v)},getOwnPropertyDescriptor(c,i){var v=Reflect.getOwnPropertyDescriptor(c,i);if(v&&"value"in v){var _=n.get(i);_&&(v.value=a(_))}else if(v===void 0){var f=n.get(i),d=f?.v;if(f!==void 0&&d!==Pe)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return v},has(c,i){if(i===an)return!0;var v=n.get(i),_=v!==void 0&&v.v!==Pe||Reflect.has(c,i);if(v!==void 0||de!==null&&(!_||wn(c,i)?.writable)){v===void 0&&(v=o(()=>{var d=_?Ze(c[i]):Pe,h=ce(d);return h}),n.set(i,v));var f=a(v);if(f===Pe)return!1}return _},set(c,i,v,_){var f=n.get(i),d=i in c;if(r&&i==="length")for(var h=v;h<f.v;h+=1){var y=n.get(h+"");y!==void 0?k(y,Pe):h in c&&(y=o(()=>ce(Pe)),n.set(h+"",y))}if(f===void 0)(!d||wn(c,i)?.writable)&&(f=o(()=>ce(void 0)),k(f,Ze(v)),n.set(i,f));else{d=f.v!==Pe;var B=o(()=>Ze(v));k(f,B)}var w=Reflect.getOwnPropertyDescriptor(c,i);if(w?.set&&w.set.call(_,v),!d){if(r&&typeof i=="string"){var j=n.get("length"),F=Number(i);Number.isInteger(F)&&F>=j.v&&k(j,F+1)}Un(s)}return!0},ownKeys(c){a(s);var i=Reflect.ownKeys(c).filter(f=>{var d=n.get(f);return d===void 0||d.v!==Pe});for(var[v,_]of n)_.v!==Pe&&!(v in c)&&i.push(v);return i},setPrototypeOf(){Fl()}})}function ka(e){try{if(e!==null&&typeof e=="object"&&an in e)return e[an]}catch{}return e}function gs(e,t){return Object.is(ka(e),ka(t))}var dr,ms,ws,bs;function ao(){if(dr===void 0){dr=window,ms=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;ws=wn(t,"firstChild").get,bs=wn(t,"nextSibling").get,ma(e)&&(e[Rr]=void 0,e[es]=null,e[Fr]=void 0,e.__e=void 0),ma(n)&&(n[Ur]=void 0)}}function Ut(e=""){return document.createTextNode(e)}function Yn(e){return ws.call(e)}function Gn(e){return bs.call(e)}function p(e,t){return Yn(e)}function un(e,t=!1){{var n=Yn(e);return n instanceof Comment&&n.data===""?Gn(n):n}}function N(e,t=!1){return Yn(e)}function u(e,t=1,n=!1){let r=e;for(;t--;)r=Gn(r);return r}function so(e){e.textContent=""}function ys(){return!1}function lo(e,t,n){return n?document.createElement(e,{is:n}):document.createElement(e)}function oo(e){var t=de;if(t===null)return pe.f|=Xt,e;if((t.f&zn)===0&&(t.f&kn)===0)throw e;zt(e,t)}function zt(e,t){if(!(t!==null&&(t.f&nt)!==0)){for(;t!==null;){if((t.f&Nr)!==0&&(t.f&(nt|ir))===0){if((t.f&zn)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}}function io(e){de===null&&(pe===null&&Il(),Ol()),Zt&&Ll()}function co(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Vt(e,t){var n=de;n!==null&&(n.f&Ve)!==0&&(e|=Ve);var r={ctx:Ge,deps:null,nodes:null,f:e|Ce|vt,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};ue?.register_created_effect(r);var s=r;if((e&kn)!==0)_n!==null?_n.push(r):tn.ensure().schedule(r);else if(t!==null){try{Sn(r)}catch(o){throw rt(r),o}s.deps===null&&s.teardown===null&&s.nodes===null&&s.first===s.last&&(s.f&Dn)===0&&(s=s.first,(e&mt)!==0&&(e&xn)!==0&&s!==null&&(s.f|=xn))}if(s!==null&&(s.parent=n,n!==null&&co(s,n),pe!==null&&(pe.f&qe)!==0&&(e&Yt)===0)){var l=pe;(l.effects??=[]).push(s)}return r}function ra(){return pe!==null&&!bt}function aa(e){const t=Vt(br,null);return ze(t,Le),t.teardown=e,t}function At(e){io();var t=de.f,n=!pe&&(t&dt)!==0&&Ge!==null&&!Ge.i;if(n){var r=Ge;(r.e??=[]).push(e)}else return ks(e)}function ks(e){return Vt(kn|dl,e)}function uo(e){tn.ensure();const t=Vt(Yt|Dn,e);return(n={})=>new Promise(r=>{n.outro?sn(t,()=>{rt(t),r(void 0)}):(rt(t),r(void 0))})}function xs(e){return Vt(kn,e)}function vo(e){return Vt(bn|Dn,e)}function yr(e,t=0){return Vt(br|t,e)}function z(e,t=[],n=[],r=[]){Gl(r,t,n,s=>{Vt(br,()=>{e(...s.map(a))})})}function sa(e,t=0){var n=Vt(mt|t,e);return n}function ut(e){return Vt(dt|Dn,e)}function Ts(e){var t=e.teardown;if(t!==null){const n=Zt,r=pe;xa(!0),ht(null);try{t.call(null)}catch(s){zt(s,e.parent)}finally{xa(n),ht(r)}}}function la(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const s=n.ac;s!==null&&Cn(()=>{s.abort(Vn)});var r=n.next;(n.f&Yt)!==0?n.parent=null:rt(n,t),n=r}}function fo(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&dt)===0&&rt(t),t=n}}function rt(e,t=!0){var n=!1;(t||(e.f&fl)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(ho(e.nodes.start,e.nodes.end),n=!0),e.f|=ir,la(e,t&&!n),Zn(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(const l of r)l.stop();Ts(e),e.f^=ir,e.f|=nt;var s=e.parent;s!==null&&s.first!==null&&Es(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function ho(e,t){for(;e!==null;){var n=e===t?null:Gn(e);e.remove(),e=n}}function Es(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function sn(e,t,n=!0){var r=[];e.f|=Jr,Ss(e,r,!0);var s=()=>{n&&rt(e),t&&t()},l=r.length;if(l>0){var o=()=>--l||s();for(var c of r)c.out(o)}else s()}function Ss(e,t,n){if((e.f&Ve)===0){e.f^=Ve;var r=e.nodes&&e.nodes.t;if(r!==null)for(const c of r)(c.is_global||n)&&t.push(c);for(var s=e.first;s!==null;){var l=s.next;if((s.f&Yt)===0){var o=(s.f&xn)!==0||(s.f&dt)!==0&&(e.f&mt)!==0;Ss(s,t,o?n:!1)}s=l}}}function hr(e){e.f&=~Jr,As(e,!0)}function As(e,t){if((e.f&Jr)===0&&(e.f&Ve)!==0){e.f^=Ve,(e.f&Le)===0&&(ze(e,Ce),tn.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,s=(n.f&xn)!==0||(n.f&dt)!==0;As(n,s?t:!1),n=r}var l=e.nodes&&e.nodes.t;if(l!==null)for(const o of l)(o.is_global||t)&&o.in()}}function oa(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var s=n===r?null:Gn(n);t.append(n),n=s}}let sr=!1,Zt=!1;function xa(e){Zt=e}let pe=null,bt=!1;function ht(e){pe=e}let de=null;function It(e){de=e}let Lt=null;function zs(e){pe!==null&&(Lt??=new Set).add(e)}let et=null,lt=0,it=null;function po(e){it=e}let Ds=1,rn=0,ln=rn;function Ta(e){ln=e}function Cs(){return++Ds}function Kn(e){var t=e.f;if((t&Ce)!==0)return!0;if(t&qe&&(e.f&=~on),(t&yt)!==0){for(var n=e.deps,r=n.length,s=0;s<r;s++){var l=n[s];if(Kn(l)&&us(l),l.wv>e.wv)return!0}(t&vt)!==0&&wt===null&&ze(e,Le)}return!1}function js(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Lt!==null&&Lt.has(e)))for(var s=0;s<r.length;s++){var l=r[s];(l.f&qe)!==0?js(l,t,!1):t===l&&(n?ze(l,Ce):(l.f&Le)!==0&&ze(l,yt),na(l))}}function Ms(e){var t=et,n=lt,r=it,s=pe,l=Lt,o=Ge,c=bt,i=ln,v=e.f;et=null,lt=0,it=null,pe=(v&(dt|Yt))===0?e:null,Lt=null,Tn(e.ctx),bt=!1,ln=++rn,e.ac!==null&&(Cn(()=>{e.ac.abort(Vn)}),e.ac=null);try{e.f|=ur;var _=e.fn,f=_();e.f|=zn;var d=Ea(e);if(as()&&it!==null&&!bt&&d!==null&&(e.f&(qe|yt|Ce))===0)for(var h=0;h<it.length;h++)js(it[h],e);if(s!==null&&s!==e){if(rn++,s.deps!==null)for(let y=0;y<n;y+=1)s.deps[y].rv=rn;if(t!==null)for(const y of t)y.rv=rn;it!==null&&(r===null?r=it:r.push(...it))}return(e.f&Xt)!==0&&(e.f^=Xt),f}catch(y){return Ea(e),oo(y)}finally{e.f^=ur,et=t,lt=n,it=r,pe=s,Lt=l,Tn(o),bt=c,ln=i}}function Ea(e){var t=e.deps,n=ue?.is_fork;if(et!==null){var r;if(n||Zn(e,lt),t!==null&<>0)for(t.length=lt+et.length,r=0;r<et.length;r++)t[lt+r]=et[r];else e.deps=t=et;if(ra()&&(e.f&vt)!==0)for(r=lt;r<t.length;r++)(t[r].reactions??=[]).push(e)}else!n&&t!==null&<<t.length&&(Zn(e,lt),t.length=lt);return t}function _o(e,t){let n=t.reactions;if(n!==null){var r=ll.call(n,e);if(r!==-1){var s=n.length-1;s===0?n=t.reactions=null:(n[r]=n[s],n.pop())}}if(n===null&&(t.f&qe)!==0&&(et===null||!or.call(et,t))){var l=t;(l.f&vt)!==0&&(l.f^=vt,l.f&=~on),l.v!==Pe&&Qr(l),l.ac!==null&&Cn(()=>{l.ac.abort(Vn),l.ac=null,ze(l,Ce)}),Ql(l),Zn(l,0)}}function Zn(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)_o(e,n[r])}function Sn(e){var t=e.f;if((t&nt)===0){ze(e,Le);var n=de,r=sr;de=e,sr=(t&(dt|Yt))===0;try{(t&(mt|Qa))!==0?fo(e):la(e),Ts(e);var s=Ms(e);e.teardown=typeof s=="function"?s:null,e.wv=Ds;var l;Ga&&Yl&&(e.f&Ce)!==0&&e.deps}finally{sr=r,de=n}}}async function go(){await Promise.resolve(),eo()}function a(e){var t=e.f,n=(t&qe)!==0;if(pe!==null&&!bt){var r=de!==null&&(de.f&nt)!==0;if(!r&&(Lt===null||!Lt.has(e))){var s=pe.deps;if((pe.f&ur)!==0)e.rv<rn&&(e.rv=rn,et===null&&s!==null&&s[lt]===e?lt++:et===null?et=[e]:et.push(e));else{pe.deps??=[],or.call(pe.deps,e)||pe.deps.push(e);var l=e.reactions;l===null?e.reactions=[pe]:or.call(l,pe)||l.push(pe)}}}if(Zt&&Pt.has(e))return Pt.get(e);if(n){var o=e;if(Zt){var c=o.v;return((o.f&Le)===0&&o.reactions!==null||Ls(o))&&(c=ea(o)),Pt.set(o,c),c}var i=(o.f&vt)===0&&!bt&&pe!==null&&(sr||(pe.f&vt)!==0),v=(o.f&zn)===0;Kn(o)&&(i&&(o.f|=vt),us(o)),i&&!v&&(vs(o),Ps(o))}if(wt?.has(e))return wt.get(e);if((e.f&Xt)!==0)throw e.v;return e.v}function Ps(e){if(e.f|=vt,e.deps!==null)for(const t of e.deps)(t.reactions??=[]).push(e),(t.f&qe)!==0&&(t.f&vt)===0&&(vs(t),Ps(t))}function Ls(e){if(e.v===Pe)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(Pt.has(t)||(t.f&qe)!==0&&Ls(t))return!0;return!1}function Jn(e){var t=bt;try{return bt=!0,e()}finally{bt=t}}const mo=["touchstart","touchmove"];function wo(e){return mo.includes(e)}const On=Symbol("events"),Os=new Set,Zr=new Set;function bo(e,t,n,r={}){function s(l){if(r.capture||Br.call(t,l),!l.cancelBubble)return Cn(()=>n?.call(this,l))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Ft(()=>{t.addEventListener(e,s,r)}):t.addEventListener(e,s,r),s}function gn(e,t,n,r,s){var l={capture:r,passive:s},o=bo(e,t,n,l);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&aa(()=>{t.removeEventListener(e,o,l)})}function Q(e,t,n){(t[On]??={})[e]=n}function ot(e){for(var t=0;t<e.length;t++)Os.add(e[t]);for(var n of Zr)n(e)}let Dr=null,Cr=!1;function Br(e){var t=this,n=t.ownerDocument,r=e.type,s=e.composedPath?.()||[],l=s[0]||e.target;Dr=e,Cr||(Cr=!0,setTimeout(()=>{Cr=!1,Dr=null}));var o=0,c=Dr===e&&e[On];if(c){var i=s.indexOf(c);if(i!==-1&&(t===document||t===window)){e[On]=t;return}var v=s.indexOf(t);if(v===-1)return;i<=v&&(o=i)}if(l=s[o]||e.target,l!==t){Ka(e,"currentTarget",{configurable:!0,get(){return l||n}});var _=pe,f=de;ht(null),It(null);try{for(var d,h=[];l!==null&&l!==t;){try{var y=l[On]?.[r];y!=null&&(!l.disabled||e.target===l)&&y.call(l,e)}catch(B){d?h.push(B):d=B}if(e.cancelBubble)break;o++,l=o<s.length?s[o]:null}if(d){for(let B of h)queueMicrotask(()=>{throw B});throw d}}finally{e[On]=t,delete e.currentTarget,ht(_),It(f)}}}const yo=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function ko(e){return yo?.createHTML(e)??e}function xo(e){var t=lo("template");return t.innerHTML=ko(e.replaceAll("<!>","<!---->")),t.content}function pr(e,t){var n=de;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function b(e,t){var n=(t&El)!==0,r=(t&Sl)!==0,s,l=!e.startsWith("<!>");return()=>{s===void 0&&(s=xo(l?e:"<!>"+e),n||(s=Yn(s)));var o=r||ms?document.importNode(s,!0):s.cloneNode(!0);if(n){var c=Yn(o),i=o.lastChild;pr(c,i)}else pr(o,o);return o}}function Mn(e=""){{var t=Ut(e+"");return pr(t,t),t}}function To(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Ut();return e.append(t,n),pr(t,n),e}function g(e,t){e!==null&&e.before(t)}function Eo(e){let t=0,n=cn(0),r;return()=>{ra()&&(a(n),yr(()=>(t===0&&(r=Jn(()=>e(()=>Un(n)))),t+=1,()=>{Ft(()=>{t-=1,t===0&&(r?.(),r=void 0,Un(n))})})))}}var So=xn|Dn;function Ao(e,t,n,r){new zo(e,t,n,r)}class zo{parent;is_pending=!1;transform_error;#t;#l=null;#e;#i;#r;#s=null;#n=null;#o=null;#a=null;#p=0;#c=0;#u=!1;#f=new Set;#_=new Set;#v=null;#w=Eo(()=>(this.#v=cn(this.#p),()=>{this.#v=null}));constructor(t,n,r,s){this.#t=t,this.#e=n,this.#i=l=>{var o=de;o.b=this,o.f|=Nr,r(l)},this.parent=de.b,this.transform_error=s??this.parent?.transform_error??(l=>l),this.#r=sa(()=>{this.#d()},So)}#g(){try{this.#s=ut(()=>this.#i(this.#t))}catch(t){this.error(t)}}#y(t){const n=this.#e.failed,{reset:r,invoke_onerror:s}=this.#b(t);Ft(s),n&&(this.#o=ut(()=>{n(this.#t,()=>t,()=>r)}))}#b(t){var n=!1,r=!1;const s=()=>{if(n){Cl();return}n=!0,r&&Hl(),this.#o!==null&&sn(this.#o,()=>{this.#o=null}),this.#h(()=>{this.#d()})};return{reset:s,invoke_onerror:()=>{try{r=!0,this.#e.onerror?.(t,s),r=!1}catch(o){zt(o,this.#r&&this.#r.parent)}}}}#k(){const t=this.#e.pending;t&&(this.is_pending=!0,this.#n=ut(()=>t(this.#t)),Ft(()=>{var n=this.#a=document.createDocumentFragment(),r=Ut(),s=!1;if(n.append(r),this.#s=this.#h(()=>{try{return ut(()=>this.#i(r))}catch(l){try{this.error(l),s=!0}catch(o){zt(o,this.#r.parent)}return null}}),this.#s===null){this.#a=null,s&&this.#m(ue);return}this.#c===0&&(this.#t.before(n),this.#a=null,sn(this.#n,()=>{this.#n=null}),this.#m(ue))}))}#d(){try{if(this.is_pending=this.has_pending_snippet(),this.#c=0,this.#p=0,this.#s=ut(()=>{this.#i(this.#t)}),this.#c>0){var t=this.#a=document.createDocumentFragment();oa(this.#s,t);const n=this.#e.pending;this.#n=ut(()=>n(this.#t))}else this.#m(ue)}catch(n){this.error(n)}}#m(t){this.is_pending=!1,t.transfer_effects(this.#f,this.#_)}defer_effect(t){os(t,this.#f,this.#_)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#e.pending}#h(t){var n=de,r=pe,s=Ge;It(this.#r),ht(this.#r),Tn(this.#r.ctx);try{return tn.ensure(),t()}finally{It(n),ht(r),Tn(s)}}#x(t,n){if(!this.has_pending_snippet()){this.parent&&this.parent.#x(t,n);return}this.#c+=t,this.#c===0&&(this.#m(n),this.#n&&sn(this.#n,()=>{this.#n=null}),this.#a&&(this.#t.before(this.#a),this.#a=null))}update_pending_count(t,n){this.#x(t,n),this.#p+=t,!(!this.#v||this.#u)&&(this.#u=!0,Ft(()=>{this.#u=!1,this.#v&&En(this.#v,this.#p)}))}get_effect_pending(){return this.#w(),a(this.#v)}error(t){if(!this.#e.onerror&&!this.#e.failed)throw t;ue?.is_fork?(this.#s&&ue.skip_effect(this.#s),this.#n&&ue.skip_effect(this.#n),this.#o&&ue.skip_effect(this.#o),ue.oncommit(()=>{this.#T(t)})):this.#T(t)}#T(t){this.#s&&(rt(this.#s),this.#s=null),this.#n&&(rt(this.#n),this.#n=null),this.#o&&(rt(this.#o),this.#o=null);let n=this.#e.failed;const r=s=>{const{reset:l,invoke_onerror:o}=this.#b(s);o(),n&&(this.#o=this.#h(()=>{try{return ut(()=>{var c=de;c.b=this,c.f|=Nr,n(this.#t,()=>s,()=>l)})}catch(c){return zt(c,this.#r.parent),null}}))};Ft(()=>{var s;try{s=this.transform_error(t)}catch(l){zt(l,this.#r&&this.#r.parent);return}s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(r,l=>zt(l,this.#r&&this.#r.parent)):r(s)})}}function C(e,t){var n=t==null?"":typeof t=="object"?`${t}`:t;n!==(e[Ur]??=e.nodeValue)&&(e[Ur]=n,e.nodeValue=`${n}`)}function Sa(e,t){return Do(e,t)}const er=new Map;function Do(e,{target:t,anchor:n,props:r={},events:s,context:l,intro:o=!0,transformError:c}){ao();var i=void 0,v=uo(()=>{var _=n??t.appendChild(Ut());Ao(_,{pending:()=>{}},h=>{Je({});var y=Ge;l&&(y.c=l),s&&(r.$$events=s),i=e(h,r)||Xr(),Xe()},c);var f=new Set,d=h=>{for(var y=0;y<h.length;y++){var B=h[y];if(!f.has(B)){f.add(B);var w=wo(B);for(const M of[t,document]){var j=er.get(M);j===void 0&&(j=new Map,er.set(M,j));var F=j.get(B);F===void 0?(M.addEventListener(B,Br,{passive:w}),j.set(B,1)):j.set(B,F+1)}}}};return d(wr(Os)),Zr.add(d),()=>{for(var h of f)for(const w of[t,document]){var y=er.get(w),B=y.get(h);--B==0?(w.removeEventListener(h,Br),y.delete(h),y.size===0&&er.delete(w)):y.set(h,B)}Zr.delete(d),_!==n&&_.parentNode?.removeChild(_)}});return Co.set(i,v),i}let Co=new WeakMap;class jo{anchor;#t=new Map;#l=new Map;#e=new Map;#i=new Set;#r=!0;constructor(t,n=!0){this.anchor=t,this.#r=n}#s=t=>{if(this.#t.has(t)){var n=this.#t.get(t),r=this.#l.get(n);if(r)hr(r),this.#i.delete(n);else{var s=this.#e.get(n);s&&(hr(s.effect),this.#l.set(n,s.effect),this.#e.delete(n),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),r=s.effect)}for(const[l,o]of this.#t){if(this.#t.delete(l),l===t)break;const c=this.#e.get(o);c&&(rt(c.effect),this.#e.delete(o))}for(const[l,o]of this.#l){if(l===n||this.#i.has(l))continue;const c=()=>{if(Array.from(this.#t.values()).includes(l)){var v=document.createDocumentFragment();oa(o,v),v.append(Ut()),this.#e.set(l,{effect:o,fragment:v})}else rt(o);this.#i.delete(l),this.#l.delete(l)};this.#r||!r?(this.#i.add(l),sn(o,c,!1)):c()}}};#n=t=>{this.#t.delete(t);const n=Array.from(this.#t.values());for(const[r,s]of this.#e)n.includes(r)||(rt(s.effect),this.#e.delete(r))};ensure(t,n){var r=ue,s=ys();if(n&&!this.#l.has(t)&&!this.#e.has(t))if(s){var l=document.createDocumentFragment(),o=Ut();l.append(o),this.#e.set(t,{effect:ut(()=>n(o)),fragment:l})}else this.#l.set(t,ut(()=>n(this.anchor)));if(this.#t.set(r,t),s){for(const[c,i]of this.#l)c===t?r.unskip_effect(i):r.skip_effect(i);for(const[c,i]of this.#e)c===t?r.unskip_effect(i.effect):r.skip_effect(i.effect);r.oncommit(this.#s),r.ondiscard(this.#n)}else this.#s(r)}}function J(e,t,n=!1){var r=new jo(e),s=n?xn:0;function l(o,c){r.ensure(o,c)}sa(()=>{var o=!1;t((c,i=0)=>{o=!0,l(i,c)}),o||l(-1,null)},s)}function mn(e,t){return t}function Mo(e,t,n){for(var r=[],s=t.length,l,o=t.length,c=0;c<s;c++){let f=t[c];sn(f,()=>{if(l){if(l.pending.delete(f),l.done.add(f),l.pending.size===0){var d=e.outrogroups;Wr(e,wr(l.done)),d.delete(l),d.size===0&&(e.outrogroups=null)}}else o-=1},!1)}if(o===0){var i=r.length===0&&n!==null&&e.pending.size===0;if(i){var v=n,_=v.parentNode;so(_),_.append(v),e.items.clear()}Wr(e,t,!i)}else l={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(l)}function Wr(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(const o of e.pending.values())for(const c of o)r.add(e.items.get(c).e)}for(var s=0;s<t.length;s++){var l=t[s];if(r?.has(l)){l.f|=Ct;const o=document.createDocumentFragment();oa(l,o)}else rt(t[s],n)}}var Aa;function oe(e,t,n,r,s,l=null){var o=e,c=new Map,i=(t&ts)!==0;if(i){var v=e;o=v.appendChild(Ut())}var _=null,f=cs(()=>{var M=n();return mr(M)?M:M==null?[]:wr(M)}),d,h=new Map,y=!0;function B(M){(F.effect.f&nt)===0&&(F.pending.delete(M),F.fallback=_,Po(F,d,o,t,r),_!==null&&(d.length===0?(_.f&Ct)===0?hr(_):(_.f^=Ct,In(_,null,o)):sn(_,()=>{_=null})))}function w(M){F.pending.delete(M)}var j=sa(()=>{d=a(f);for(var M=d.length,D=new Set,P=ue,I=ys(),W=0;W<M;W+=1){var L=d[W],x=r(L,W),T=y?null:c.get(x);T?(T.v&&En(T.v,L),T.i&&En(T.i,W),I&&P.unskip_effect(T.e)):(T=Lo(c,y?o:Aa??=Ut(),L,x,W,s,t,n),y||(T.e.f|=Ct),c.set(x,T)),D.add(x)}if(M===0&&l&&!_&&(y?_=ut(()=>l(o)):(_=ut(()=>l(Aa??=Ut())),_.f|=Ct)),M>D.size&&Pl(),!y)if(h.set(P,D),I){for(const[U,V]of c)D.has(U)||P.skip_effect(V.e);P.oncommit(B),P.ondiscard(w)}else B(P);a(f)}),F={effect:j,items:c,pending:h,outrogroups:null,fallback:_};y=!1}function Pn(e){for(;e!==null&&(e.f&dt)===0;)e=e.next;return e}function Po(e,t,n,r,s){var l=(r&wl)!==0,o=t.length,c=e.items,i=Pn(e.effect.first),v,_=null,f,d=[],h=[],y,B,w,j;if(l)for(j=0;j<o;j+=1)y=t[j],B=s(y,j),w=c.get(B).e,(w.f&Ct)===0&&(w.nodes?.a?.measure(),(f??=new Set).add(w));for(j=0;j<o;j+=1){if(y=t[j],B=s(y,j),w=c.get(B).e,e.outrogroups!==null)for(const T of e.outrogroups)T.pending.delete(w),T.done.delete(w);if((w.f&Ve)!==0&&(hr(w),l&&(w.nodes?.a?.unfix(),(f??=new Set).delete(w))),(w.f&Ct)!==0)if(w.f^=Ct,w===i)In(w,null,n);else{var F=_?_.next:i;w===e.effect.last&&(e.effect.last=w.prev),w.prev&&(w.prev.next=w.next),w.next&&(w.next.prev=w.prev),Gt(e,_,w),Gt(e,w,F),In(w,F,n),_=w,d=[],h=[],i=Pn(_.next);continue}if(w!==i){if(v!==void 0&&v.has(w)){if(d.length<h.length){var M=h[0],D;_=M.prev;var P=d[0],I=d[d.length-1];for(D=0;D<d.length;D+=1)In(d[D],M,n);for(D=0;D<h.length;D+=1)v.delete(h[D]);Gt(e,P.prev,I.next),Gt(e,_,P),Gt(e,I,M),i=M,_=I,j-=1,d=[],h=[]}else v.delete(w),In(w,i,n),Gt(e,w.prev,w.next),Gt(e,w,_===null?e.effect.first:_.next),Gt(e,_,w),_=w;continue}for(d=[],h=[];i!==null&&i!==w;)(v??=new Set).add(i),h.push(i),i=Pn(i.next);if(i===null)continue}(w.f&Ct)===0&&d.push(w),_=w,i=Pn(w.next)}if(e.outrogroups!==null){for(const T of e.outrogroups)T.pending.size===0&&(Wr(e,wr(T.done)),e.outrogroups?.delete(T));e.outrogroups.size===0&&(e.outrogroups=null)}if(i!==null||v!==void 0){var W=[];if(v!==void 0)for(w of v)(w.f&Ve)===0&&W.push(w);for(;i!==null;)(i.f&Ve)===0&&i!==e.fallback&&W.push(i),i=Pn(i.next);var L=W.length;if(L>0){var x=(r&ts)!==0&&o===0?n:null;if(l){for(j=0;j<L;j+=1)W[j].nodes?.a?.measure();for(j=0;j<L;j+=1)W[j].nodes?.a?.fix()}Mo(e,W,x)}}l&&Ft(()=>{if(f!==void 0)for(w of f)w.nodes?.a?.apply()})}function Lo(e,t,n,r,s,l,o,c){var i=(o&gl)!==0?(o&bl)===0?no(n,!1,!1):cn(n):null,v=(o&ml)!==0?cn(s):null;return{v:i,i:v,e:ut(()=>(l(t,i??n,v??s,c),()=>{e.delete(r)}))}}function In(e,t,n){if(e.nodes)for(var r=e.nodes.start,s=e.nodes.end,l=t&&(t.f&Ct)===0?t.nodes.start:n;r!==null;){var o=Gn(r);if(l.before(r),r===s)return;r=o}}function Gt(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}const za=[...` -\r\f \v\uFEFF`];function Oo(e,t,n){var r=e==null?"":""+e;if(t&&(r=r?r+" "+t:t),n){for(var s of Object.keys(n))if(n[s])r=r?r+" "+s:s;else if(r.length)for(var l=s.length,o=0;(o=r.indexOf(s,o))>=0;){var c=o+l;(o===0||za.includes(r[o-1]))&&(c===r.length||za.includes(r[c]))?r=(o===0?"":r.substring(0,o))+r.substring(c+1):o=c}}return r===""?null:r}function Io(e,t){return e==null?null:String(e)}function Ie(e,t,n,r,s,l){var o=e[Rr];if(o!==n||o===void 0){var c=Oo(n,r,l);c==null?e.removeAttribute("class"):e.className=c,e[Rr]=n}else if(l&&s!==l)for(var i in l){var v=!!l[i];(s==null||v!==!!s[i])&&e.classList.toggle(i,v)}return l}function Bt(e,t,n,r){var s=e[Fr];if(s!==t){var l=Io(t);l==null?e.removeAttribute("style"):e.style.cssText=l,e[Fr]=t}return r}function qo(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function No(e,t){var n=e.__defaultValue,r=e.multiple,s=r?n??[]:null;if(!(r&&!mr(s))){e.selectedIndex;for(var l of e.options){var o=yn(l);qo(l,r?s.includes(o):gs(o,n))}}}function Ot(e,t,n=!1){if(e.multiple){if(t==null)return;if(!mr(t))return Dl();for(var r of e.options)r.selected=t.includes(yn(r));return}for(r of e.options){var s=yn(r);if(gs(s,t)){r.selected=!0;return}}(!n||t!==void 0)&&(e.selectedIndex=-1)}function jt(e){var t=new MutationObserver(n=>{n.every(Ro)||("__defaultValue"in e&&No(e),"__value"in e&&Ot(e,e.__value))});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),aa(()=>{t.disconnect()})}function Da(e,t,n=t){var r=new WeakSet,s=!0;$r(e,"change",l=>{var o=l?"[selected]":":checked",c;if(e.multiple)c=[].map.call(e.querySelectorAll(o),yn);else{var i=e.querySelector(o)??e.querySelector("option:not([disabled])");c=i&&yn(i)}n(c),e.__value=c,ue!==null&&r.add(ue)}),xs(()=>{var l=t();if(e===document.activeElement){var o=ue;if(r.has(o))return}if(Ot(e,l,s),s&&l===void 0){var c=e.querySelector(":checked");c!==null&&(l=yn(c),n(l))}e.__value=l,s=!1})}function yn(e){return"__value"in e?e.__value:e.value}function Ro(e){if(e.target.closest("selectedcontent")!==null)return!0;if(e.type==="childList"){var t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(n=>n.nodeName==="SELECTEDCONTENT")}return!1}const Fo=Symbol("is custom element"),Uo=Symbol("is html"),Ho=_l?"progress":"PROGRESS";function qn(e,t){var n=ia(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==Ho)||(e.value=t??"")}function Ca(e,t){var n=ia(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function ge(e,t,n,r){var s=ia(e);s[t]!==(s[t]=n)&&(t==="loading"&&(e[pl]=n),n==null?e.removeAttribute(t):typeof n!="string"&&Yo(e).has(t)?e[t]=n:e.setAttribute(t,n))}function ia(e){return e[es]??={[Fo]:e.nodeName.includes("-"),[Uo]:e.namespaceURI===Al}}var ja=new Map;function Yo(e){var t=e.getAttribute("is")||e.nodeName,n=ja.get(t);if(n)return n;ja.set(t,n=new Set);for(var r,s=e,l=Element.prototype;l!==s;){r=ol(s);for(var o in r)r[o].set&&o!=="innerHTML"&&o!=="textContent"&&o!=="innerText"&&n.add(o);s=Ja(s)}return n}function tr(e,t,n=t){var r=new WeakSet;$r(e,"input",async s=>{var l=s?e.defaultValue:e.value;if(l=jr(e)?Mr(l):l,n(l),ue!==null&&r.add(ue),await go(),l!==(l=t())){var o=e.selectionStart,c=e.selectionEnd,i=e.value.length;if(e.value=l??"",c!==null){var v=e.value.length;o===c&&c===i&&v>i?(e.selectionStart=v,e.selectionEnd=v):(e.selectionStart=o,e.selectionEnd=Math.min(c,v))}}}),Jn(t)==null&&e.value&&(n(jr(e)?Mr(e.value):e.value),ue!==null&&r.add(ue)),yr(()=>{var s=t();if(e===document.activeElement){var l=ue;if(r.has(l))return}jr(e)&&s===Mr(e.value)||e.type==="date"&&!s&&!e.value||s!==e.value&&(e.value=s??"")})}function Zo(e,t,n=t){$r(e,"change",r=>{var s=r?e.defaultChecked:e.checked;n(s)}),Jn(t)==null&&n(e.checked),yr(()=>{var r=t();e.checked=!!r})}function jr(e){var t=e.type;return t==="number"||t==="range"}function Mr(e){return e===""?null:+e}function Pr(e,t){return e===t||e?.[an]===t}function Is(e=Xr(),t,n,r){var s=Ge.r,l=de;return xs(()=>{var o,c;return yr(()=>{o=c,c=[],Jn(()=>{Pr(n(...c),e)||(t(e,...c),o&&Pr(n(...o),e)&&t(null,...o))})}),()=>{let i=l;for(;i!==s&&i.parent!==null&&i.parent.f&ir;)i=i.parent;const v=()=>{c&&Pr(n(...c),e)&&t(null,...c)},_=i.teardown;i.teardown=()=>{v(),_?.()}}}),e}function Ye(e,t,n,r){var s=!0,l=(n&xl)!==0,o=(n&Tl)!==0,c=r,i=!0,v=void 0,_=()=>o&&s?(v??=Hn(r),a(v)):(i&&(i=!1,c=o?Jn(r):r),c);let f;if(l){var d=an in e||hl in e;f=wn(e,t)?.set??(d&&t in e?D=>e[t]=D:void 0)}var h,y=!1;l?[h,y]=Wl(()=>e[t]):h=e[t],h===void 0&&r!==void 0&&(h=_(),f&&(Nl(),f(h)));var B;if(B=()=>{var D=e[t];return D===void 0?_():(i=!0,D)},(n&kl)===0)return B;if(f){var w=e.$$legacy;return(function(D,P){return arguments.length>0?((!P||w||y)&&f(P?B():D),D):B()})}var j=!1,F=((n&yl)!==0?Hn:cs)(()=>(j=!1,B()));l&&a(F);var M=de;return(function(D,P){if(arguments.length>0){const I=P?a(F):l?Ze(D):D;return k(F,I),j=!0,c!==void 0&&(c=I),D}return Zt&&j||(M.f&nt)!==0?F.v:a(F)})}const Bo="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(Bo);const ca=["personal","project","foundation"],qs=["day","week","month","year","agenda"];function Ns(){const e=Wo().pathname;return e==="/"?"":e.replace(/\/+$/,"")}function Wo(){const e=globalThis.document?.baseURI;try{return new URL(e??"/",globalThis.location?.href??"http://localhost/")}catch{return new URL("http://localhost/")}}function Wt(e){const t=e.startsWith("/")?e:`/${e}`;return`${Ns()}${t}`||"/"}function Qt(e){return Wt(`/api${e.startsWith("/")?e:`/${e}`}`)}function Vr(e){return Wt(`/${e.replace(/^\/+/,"")}`)}function Rs(e){const t=Ns();return t?e===t?"/":e.startsWith(`${t}/`)?e.slice(t.length)||"/":null:e||"/"}const Fs="/auth";function Us(e=Wt("/")){return`${Wt(Fs)}?login=${e}`}function Hs(e=Wt("/")){return`${Wt(Fs)}?logout=${e}`}class Dt extends Error{status;field;constructor(t,n,r=null){super(t),this.name="ApiError",this.status=n,this.field=r}get needsLogin(){return this.status===401}}async function St(e,t,n){const r=typeof FormData<"u"&&n instanceof FormData;let s;try{s=await fetch(Qt(t),{method:e,credentials:"same-origin",headers:{Accept:"application/json","X-No-Redirect":"1",...n===void 0||r?{}:{"Content-Type":"application/json"}},...n===void 0?{}:{body:r?n:JSON.stringify(n)}})}catch{throw new Dt("Could not reach the calendar service.",0)}if(s.status===204)return;const l=await s.text();let o=null;if(l)try{o=JSON.parse(l)}catch{o=null}if(!s.ok){const c=o??{};throw new Dt(c.error??`Request failed with status ${s.status}`,s.status,c.field??null)}return o}function Ma(e){const t=new URLSearchParams,n=s=>s instanceof Date?s.toISOString():s;e.start&&t.set("start",n(e.start)),e.end&&t.set("end",n(e.end));for(const s of e.categories??[])t.append("category",s);for(const s of e.projects??[])t.append("project",s);e.visibility&&e.visibility!=="all"&&t.set("visibility",e.visibility),e.owner&&t.set("owner",e.owner),e.q&&t.set("q",e.q),e.sort&&t.set("sort",e.sort),e.limit&&t.set("limit",String(e.limit));const r=t.toString();return r?`?${r}`:""}const ct={session:()=>St("GET","/session"),calendars:()=>St("GET","/calendars"),events:async(e={})=>(await St("GET",`/events${Ma(e)}`)).events,event:async e=>(await St("GET",`/events/${e}`)).event,byShortlink:async e=>(await St("GET",`/shortlink/${encodeURIComponent(e)}`)).event,create:async e=>(await St("POST","/events",e)).event,update:async(e,t)=>(await St("PUT",`/events/${e}`,t)).event,remove:e=>St("DELETE",`/events/${e}`),previewImport:e=>{const t=new FormData;return t.append("file",e),St("POST","/import/preview",t)},runImport:(e,t)=>{const n=new FormData;return n.append("file",e),n.append("category",t.category),t.visibility&&n.append("visibility",t.visibility),t.project&&n.append("project",t.project),St("POST","/import",n)},icsUrl:e=>Qt(`/events/${e}.ics`),feedUrl:(e={})=>Qt(`/events.ics${Ma(e)}`)},Vo=6e4,Go=60*Vo,kr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],vn=["January","February","March","April","May","June","July","August","September","October","November","December"],ua=1;function We(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function va(e){const t=We(e);return t.setDate(t.getDate()+1),t}function Ht(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n}function Ys(e,t){const n=new Date(e),r=n.getDate();n.setDate(1),n.setMonth(n.getMonth()+t);const s=Jo(n.getFullYear(),n.getMonth());return n.setDate(Math.min(r,s)),n}function Ko(e,t){return Ys(e,t*12)}function Jo(e,t){return new Date(e,t+1,0).getDate()}function fa(e,t=ua){const n=We(e),r=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-r),n}function Zs(e){const t=We(e);return t.setDate(1),t}function Bs(e){const t=Zs(e);return t.setMonth(0),t}function Xo(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Bn(e,t=new Date){return Xo(e,t)}function lr(e){const t=e.getDay();return t===0||t===6}function da(e,t=ua){const n=fa(Zs(e),t);return Array.from({length:42},(r,s)=>Ht(n,s))}function Ws(e,t=ua){const n=fa(e,t);return Array.from({length:7},(r,s)=>Ht(n,s))}function Qo(e){const t=Bs(e);return Array.from({length:12},(n,r)=>new Date(t.getFullYear(),r,1))}function $o(e,t){switch(e){case"day":return{start:We(t),end:va(t)};case"week":{const n=fa(t);return{start:n,end:Ht(n,7)}}case"year":{const n=Bs(t);return{start:n,end:new Date(n.getFullYear()+1,0,1)}}case"agenda":{const n=We(t);return{start:n,end:Ht(n,90)}}default:{const n=da(t);return{start:n[0],end:Ht(n[41],1)}}}}function ei(e,t,n){switch(e){case"day":return Ht(t,n);case"week":return Ht(t,7*n);case"year":return Ko(t,n);case"agenda":return Ht(t,30*n);default:return Ys(t,n)}}function kt(e){const t=String(e.getFullYear()).padStart(4,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function ti(e){const[t,n,r]=e.split("-").map(Number);return new Date(t,(n??1)-1,r??1)}function Ue(e){return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}function Be(e){return`${e.getDate()} ${vn[e.getMonth()]} ${e.getFullYear()}`}function Lr(e){return`${vn[e.getMonth()]} ${e.getFullYear()}`}function ni(e,t){switch(e){case"day":return Be(t);case"week":{const n=Ws(t),r=n[0],s=n[6];return r.getMonth()===s.getMonth()?`${r.getDate()} - ${s.getDate()} ${Lr(r)}`:r.getFullYear()===s.getFullYear()?`${r.getDate()} ${vn[r.getMonth()]} - ${s.getDate()} ${Lr(s)}`:`${Be(r)} - ${Be(s)}`}case"year":return String(t.getFullYear());case"agenda":return`From ${Be(t)}`;default:return Lr(t)}}function ri(e){return`${kt(e)}T${Ue(e)}`}function ai(e){return kt(e)}function _r(e){return new Date(e)}function Jt(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}const ft="local",Ke="UTC";function Mt(e){return e===ft}function tt(e){return Mt(e)?fn():e}function Gr(e){return-e.getTimezoneOffset()*6e4}const Pa=new Map;function si(e){let t=Pa.get(e);return t||(t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),Pa.set(e,t)),t}function gr(e,t){let n;try{n=si(t).formatToParts(e)}catch{return 0}const r=l=>Number(n.find(o=>o.type===l)?.value??0);return Date.UTC(r("year"),r("month")-1,r("day"),r("hour"),r("minute"),r("second"))-Math.floor(e.getTime()/1e3)*1e3}function pn(e,t){const n=e.getTime()+gr(e,t);let r=new Date(n-Gr(e));for(let s=0;s<2;s+=1){const l=new Date(n-Gr(r));if(l.getTime()===r.getTime())return r;r=l}return r}function Nn(e,t){const n=e.getTime()+Gr(e);let r=new Date(n-gr(e,t));for(let s=0;s<2;s+=1){const l=new Date(n-gr(r,t));if(l.getTime()===r.getTime())return r;r=l}return r}function $t(e,t){return Mt(t)?new Date(e.getTime()):pn(e,t)}function Kt(e,t){return Mt(t)?new Date(e.getTime()):Nn(e,t)}function en(e){return $t(new Date,e)}function fn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||Ke}catch{return Ke}}function li(e){if(e===0)return Ke;const t=e<0?"-":"+",n=Math.abs(Math.round(e/6e4)),r=String(Math.floor(n/60)).padStart(2,"0"),s=String(n%60).padStart(2,"0");return`UTC${t}${r}:${s}`}function Vs(e,t){try{return new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"short"}).formatToParts(e).find(r=>r.type==="timeZoneName")?.value??t}catch{return t}}function Wn(e){if(e===Ke)return Ke;const t=e.split("/");return(t[t.length-1]??e).replace(/_/g," ")}function xt(e,t=new Date){const n=li(gr(t,e)),r=Vs(t,e);return e===Ke?Ke:r.startsWith("GMT")||r===n?`${Wn(e)} (${n})`:`${Wn(e)} (${r}, ${n})`}function An(e,t=new Date){const n=tt(e);return Mt(e)?`Local - ${xt(n,t)}`:xt(n,t)}function Xn(e,t=new Date){const n=tt(e);if(n===Ke)return Ke;const r=Vs(t,n);return r.startsWith("GMT")?Wn(n):r}function La(e,t=new Date){const n=tt(e);return Mt(e)?`Times are shown in ${n}, your browser's timezone (${xt(n,t)}).`:`Times are shown in ${n} (${xt(n,t)}).`}const ha=[{region:"Coordinated",zones:[Ke]},{region:"Americas",zones:["Pacific/Honolulu","America/Anchorage","America/Los_Angeles","America/Denver","America/Chicago","America/New_York","America/Halifax","America/Bogota","America/Sao_Paulo","America/Argentina/Buenos_Aires"]},{region:"Europe and Africa",zones:["Europe/London","Europe/Lisbon","Europe/Paris","Europe/Berlin","Europe/Madrid","Europe/Rome","Europe/Stockholm","Europe/Warsaw","Europe/Athens","Europe/Kyiv","Europe/Moscow","Africa/Casablanca","Africa/Lagos","Africa/Cairo","Africa/Nairobi","Africa/Johannesburg"]},{region:"Asia",zones:["Asia/Jerusalem","Asia/Dubai","Asia/Karachi","Asia/Kolkata","Asia/Kathmandu","Asia/Dhaka","Asia/Bangkok","Asia/Jakarta","Asia/Shanghai","Asia/Hong_Kong","Asia/Singapore","Asia/Seoul","Asia/Tokyo"]},{region:"Oceania",zones:["Australia/Perth","Australia/Adelaide","Australia/Brisbane","Australia/Sydney","Pacific/Auckland"]}];function Oa(){return ha.flatMap(e=>e.zones)}function Gs(e){if(!e||e===ft)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}function oi(){const e=Intl.supportedValuesOf;let t;try{t=e?e("timeZone"):Oa()}catch{t=Oa()}return[...new Set([Ke,fn(),...t])].sort()}function Rn(e,t=Ke){const n=(e??"").trim();return n?n.toLowerCase()===ft?ft:n.toLowerCase()==="utc"?Ke:Gs(n)?n:t:t}function Or(e,t){const n=new Set(t===void 0?[]:[tt(t)]),r=[];for(const s of e){const l=tt(s);n.has(l)||(n.add(l),r.push(s))}return r}function ii(e,t,n,r=24){return Array.from({length:r},(s,l)=>{const o=new Date(e);return o.setHours(l,0,0,0),Ue($t(Kt(o,t),n))})}function at(e,t="local"){const n=_r(e.start);return e.all_day?new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()):$t(n,t)}function Qn(e,t="local"){const n=_r(e.end);return e.all_day?new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()):$t(n,t)}function Ia(e){return Math.max(0,_r(e.end).getTime()-_r(e.start).getTime())}function ci(e,t,n,r="local"){return at(e,r)<n&&Qn(e,r)>t}function xr(e,t,n="local"){return ci(e,We(t),va(t),n)}function ui(e,t,n="local"){const r=new Map;for(const l of t)r.set(kt(l),[]);for(const l of e)for(const o of t)xr(l,o,n)&&r.get(kt(o)).push(l);const s=Tr(n);for(const l of r.values())l.sort(s);return r}function vi(e,t,n="local"){if(e.all_day!==t.all_day)return e.all_day?-1:1;const r=at(e,n).getTime()-at(t,n).getTime();if(r!==0)return r;const s=Ia(t)-Ia(e);return s!==0?s:e.title.localeCompare(t.title)}function Tr(e="local"){return(t,n)=>vi(t,n,e)}const fi=20/1440;function di(e,t,n="local"){const r=We(t).getTime(),s=va(t).getTime(),l=s-r,c=e.filter(f=>!f.all_day&&xr(f,t,n)).sort(Tr(n)).map(f=>{const d=Math.max(at(f,n).getTime(),r),h=Math.min(Qn(f,n).getTime(),s);return{event:f,top:(d-r)/l,height:Math.max((h-d)/l,fi),column:0,columns:1}});let i=[],v=-1/0;const _=()=>{if(i.length===0)return;const f=Math.max(...i.map(d=>d.column))+1;for(const d of i)d.columns=f;i=[],v=-1/0};for(const f of c){f.top>=v&&_();const d=new Set(i.filter(y=>y.top+y.height>f.top).map(y=>y.column));let h=0;for(;d.has(h);)h+=1;f.column=h,i.push(f),v=Math.max(v,f.top+f.height)}return _(),c}function hi(e,t,n="local"){return e.filter(r=>r.all_day&&xr(r,t,n)).sort(Tr(n))}function Ks(e,t="local"){const n=[],r=new Map;for(const s of e){const l=at(s,t),o=kt(l);let c=r.get(o);c||(c=[],r.set(o,c),n.push({key:o,date:We(l),events:c})),c.push(s)}return n}function Er(e){return e.category==="project"?e.project??"project":e.category==="foundation"?"foundation":"personal"}const qa=[8,28,48,96,150,176,200,220,256,286,310,335];function Js(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return qa[t%qa.length]}function jn(e){return e.category==="personal"?265:e.category==="foundation"?0:Js(e.project??"")}function pa(e){switch(e){case"personal":return"Personal";case"project":return"Project";case"foundation":return"Foundation"}}function Na(e){return{categories:new Set(ca),projects:new Set(e?.projects??[]),visibility:"all",search:"",sort:"start"}}function pi(e,t,n=[]){if(!t.categories.has(e.category))return!1;if(e.category==="project"){const s=e.project??"";if(n.includes(s)&&!t.projects.has(s))return!1}if(t.visibility!=="all"&&e.visibility!==t.visibility)return!1;const r=t.search.trim().toLowerCase();return!(r&&![e.title,e.description,e.location,e.project??""].join(" ").toLowerCase().includes(r))}function _i(e,t,n=[]){return e.filter(r=>pi(r,t,n))}function gi(e,t,n="local"){const r=[...e];switch(t){case"-start":r.sort((s,l)=>at(l,n).getTime()-at(s,n).getTime());break;case"title":r.sort((s,l)=>s.title.localeCompare(l.title));break;case"-title":r.sort((s,l)=>l.title.localeCompare(s.title));break;default:r.sort(Tr(n));break}return r}function mi(e,t){const n=new Set(t?.projects??[]);for(const r of e)r.category==="project"&&r.project&&n.add(r.project);return[...n].sort()}function Ra(e,t){const n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}const wi=Go;function Xs(e){const t=e?.can_create;return t?t.project.length>0?"project":t.personal?"personal":t.foundation?"foundation":null:null}function bi(e){return Xs(e)!==null}function yi(e,t,n){const r=Xs(t)??"personal",s=new Date(e);return s.getTime()===We(e).getTime()&&s.setHours(9,0,0,0),{title:"",category:r,visibility:r==="personal"?"private":"public",start:Jt(s),end:Jt(new Date(s.getTime()+wi)),all_day:!1,description:"",location:"",url:"",project:r==="project"?t?.can_create.project[0]??null:null,timezone:n??fn()}}function ki(e){return{title:e.title,category:e.category,visibility:e.visibility,start:e.start,end:e.end,all_day:e.all_day,description:e.description,location:e.location,url:e.url,project:e.project,timezone:e.timezone||"UTC"}}function xi(e,t){if(!t?.authenticated)return!1;switch(e.category){case"personal":return e.owner===t.uid;case"foundation":return t.is_member;case"project":{const n=e.project??"";return n?e.visibility==="private"?t.committees.includes(n):t.projects.includes(n):!1}}}var Ti=b("<option> </option>"),Ei=b("<optgroup></optgroup>"),Si=b('<div class="zones svelte-p7ai4p" role="group" aria-label="Display timezone"><button type="button"><span class="lead svelte-p7ai4p">Local</span> <span class="detail svelte-p7ai4p"> </span></button> <label><select aria-label="Show the calendar in another timezone" class="svelte-p7ai4p"></select> <span class="badge svelte-p7ai4p" aria-hidden="true"> </span></label></div>');function Ai(e,t){Je(t,!0);let n=ee(()=>new Date),r=ee(fn),s=ee(()=>xt(a(r),a(n)));function l(j){t.onalternate(j),t.onzone(j)}var o=Si(),c=p(o);let i;var v=u(p(c),2),_=N(v,!0),f=u(c,2);let d;var h=p(f);oe(h,21,()=>ha,j=>j.region,(j,F)=>{var M=Ei();oe(M,20,()=>a(F).zones,D=>D,(D,P)=>{var I=Ti(),W=N(I,!0),L={};z(x=>{C(W,x),L!==(L=P)&&(I.value=(I.__value=L)??"")},[()=>xt(P,a(n))]),g(D,I)}),z(()=>ge(M,"label",a(F).region)),g(j,M)});var y;jt(h);var B=u(h,2),w=N(B,!0);z((j,F,M,D,P,I)=>{i=Ie(c,1,"zone svelte-p7ai4p",null,i,{active:j}),ge(c,"aria-pressed",F),ge(c,"title",M),C(_,a(s)),d=Ie(f,1,"zone select svelte-p7ai4p",null,d,{active:D}),ge(f,"title",P),y!==(y=t.alternate)&&(h.value=(h.__value=y)??"",Ot(h,y)),C(w,I)},[()=>Mt(t.zone),()=>Mt(t.zone),()=>La(ft,a(n)),()=>!Mt(t.zone),()=>La(t.alternate,a(n)),()=>Xn(t.alternate,a(n))]),Q("click",c,()=>t.onzone(ft)),Q("change",h,j=>l(j.currentTarget.value)),Q("click",h,()=>{Mt(t.zone)&&t.onzone(t.alternate)}),g(e,o),Xe()}ot(["click","change"]);var zi=b('<span class="spinner svelte-oiwvqb" role="status" aria-label="Loading"></span>'),Di=b('<button type="button" role="tab"> </button>'),Ci=b('<button type="button" class="btn" title="Import events from an .ics file">Import</button> <button type="button" class="btn primary">New event</button>',1),ji=b('<span class="who svelte-oiwvqb"> </span> <a class="btn">Log out</a>',1),Mi=b('<a class="btn primary">Log in</a>'),Pi=b('<header class="svelte-oiwvqb"><div class="brand svelte-oiwvqb"><button type="button" class="filters-toggle svelte-oiwvqb" aria-label="Toggle filters">☰</button> <img alt="" width="28" height="28" class="svelte-oiwvqb"/> <h1 class="svelte-oiwvqb"> </h1></div> <div class="nav svelte-oiwvqb"><button type="button" class="btn">Today</button> <div class="stepper svelte-oiwvqb"><button type="button" class="btn svelte-oiwvqb" aria-label="Previous">‹</button> <button type="button" class="btn svelte-oiwvqb" aria-label="Next">›</button></div> <h2 aria-live="polite" class="svelte-oiwvqb"> </h2> <!></div> <div class="views svelte-oiwvqb" role="tablist" aria-label="Calendar view"></div> <!> <div class="account svelte-oiwvqb"><button type="button">Help</button> <button type="button" title="HTTP API documentation">API</button> <!> <!></div></header>');function Li(e,t){Je(t,!0);let n=ee(()=>ni(t.view,t.cursor));var r=Pi(),s=p(r),l=p(s),o=u(l,2),c=u(o,2),i=N(c,!0),v=u(s,2),_=p(v),f=u(_,2),d=p(f),h=u(d,2),y=u(f,2),B=N(y,!0),w=u(y,2);{var j=A=>{var O=zi();g(A,O)};J(w,A=>{t.loading&&A(j)})}var F=u(v,2);oe(F,20,()=>qs,A=>A,(A,O)=>{var R=Di();let te;var G=N(R,!0);z(()=>{te=Ie(R,1,"view svelte-oiwvqb",null,te,{active:t.view===O}),ge(R,"aria-selected",t.view===O),C(G,O)}),Q("click",R,()=>t.onview(O)),g(A,R)});var M=u(F,2);Ai(M,{get zone(){return t.zone},get alternate(){return t.alternateZone},get onzone(){return t.onzone},get onalternate(){return t.onalternatezone}});var D=u(M,2),P=p(D);let I;var W=u(P,2);let L;var x=u(W,2);{var T=A=>{var O=Ci(),R=un(O),te=u(R,2);Q("click",R,function(...G){t.onimport?.apply(this,G)}),Q("click",te,function(...G){t.oncreate?.apply(this,G)}),g(A,O)};J(x,A=>{t.canCreate&&A(T)})}var U=u(x,2);{var V=A=>{var O=ji(),R=un(O),te=N(R,!0),G=u(R,2);z(le=>{ge(R,"title",t.session.email??""),C(te,t.session.fullname||t.session.uid),ge(G,"href",le)},[()=>t.session.logout_url??Hs()]),g(A,O)},S=A=>{var O=Mi();z(R=>ge(O,"href",R),[()=>t.session?.login_url??Us()]),g(A,O)};J(U,A=>{t.session?.authenticated?A(V):A(S,-1)})}z(A=>{ge(o,"src",A),C(i,t.title),C(B,a(n)),I=Ie(P,1,"btn svelte-oiwvqb",null,I,{active:t.helpOpen}),L=Ie(W,1,"btn svelte-oiwvqb",null,L,{active:t.docsOpen})},[()=>Vr("icon.png")]),Q("click",l,function(...A){t.ontogglefilters?.apply(this,A)}),Q("click",_,function(...A){t.ontoday?.apply(this,A)}),Q("click",d,()=>t.onstep(-1)),Q("click",h,()=>t.onstep(1)),Q("click",P,function(...A){t.onhelp?.apply(this,A)}),Q("click",W,function(...A){t.ondocs?.apply(this,A)}),g(e,r),Xe()}ot(["click"]);var Oi=b('<label class="check svelte-x10slk"><input type="checkbox"/> <span class="swatch svelte-x10slk"></span> </label>'),Ii=b('<span class="role svelte-x10slk" title="You are on this committee">PMC</span>'),qi=b('<label class="check svelte-x10slk"><input type="checkbox"/> <span class="swatch svelte-x10slk"></span> <!></label>'),Ni=b('<section class="svelte-x10slk"><h3 class="svelte-x10slk">Projects <span class="bulk svelte-x10slk"><button type="button" class="svelte-x10slk">all</button> <button type="button" class="svelte-x10slk">none</button></span></h3> <div class="projects svelte-x10slk"></div></section>'),Ri=b('<section class="svelte-x10slk"><h3 class="svelte-x10slk">Sort</h3> <label class="field svelte-x10slk"><select class="svelte-x10slk"><option>Soonest first</option><option>Latest first</option><option>Title A-Z</option><option>Title Z-A</option></select></label></section>'),Fi=b('<li class="svelte-x10slk"><span class="svelte-x10slk"> </span> <button type="button" class="svelte-x10slk">×</button></li>'),Ui=b('<ul class="chips svelte-x10slk"></ul>'),Fa=b("<option> </option>"),Hi=b("<optgroup></optgroup>"),Yi=b('<label class="field svelte-x10slk"><span class="visually-hidden">Also show another timezone</span> <select class="svelte-x10slk"><option>Also show...</option><!><!></select></label>'),Zi=b(`<aside class="svelte-x10slk"><label class="search svelte-x10slk"><span class="visually-hidden">Search events</span> <input type="search" placeholder="Search events..." class="svelte-x10slk"/></label> <section class="svelte-x10slk"><h3 class="svelte-x10slk">Calendars</h3> <!></section> <!> <section class="svelte-x10slk"><h3 class="svelte-x10slk">Visibility</h3> <label class="field svelte-x10slk"><select class="svelte-x10slk"><option>Everything I can see</option><option>Public only</option><option>Private only</option></select></label></section> <!> <section class="timezones svelte-x10slk"><h3 class="svelte-x10slk">Timezones</h3> <p class="muted svelte-x10slk">Drawn in <strong> </strong>, which you can change at the top of +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(s){if(s.ep)return;s.ep=!0;const l=n(s);fetch(s.href,l)}})();const Ga=!1;var mr=Array.isArray,ll=Array.prototype.indexOf,or=Array.prototype.includes,wr=Array.from,Ka=Object.defineProperty,wn=Object.getOwnPropertyDescriptor,ol=Object.getOwnPropertyDescriptors,il=Object.prototype,cl=Array.prototype,Ja=Object.getPrototypeOf,ma=Object.isExtensible;const ul=()=>{};function vl(e){for(var t=0;t<e.length;t++)e[t]()}function Xa(){var e,t,n=new Promise((r,s)=>{e=r,t=s});return{promise:n,resolve:e,reject:t}}const qe=2,kn=4,br=8,Qa=1<<24,mt=16,dt=32,Zt=64,Nr=128,Jr=256,vt=512,Le=1024,Ce=2048,yt=4096,Ve=8192,nt=16384,zn=32768,ir=1<<25,xn=65536,cr=1<<17,fl=1<<18,Dn=1<<19,dl=1<<20,Ct=1<<25,cn=65536,ur=1<<21,bn=1<<22,Qt=1<<23,sn=Symbol("$state"),$a=Symbol("component"),hl=Symbol("legacy props"),pl=Symbol(""),es=Symbol("attributes"),Rr=Symbol("class"),Fr=Symbol("style"),Ur=Symbol("text"),rr=Symbol("form reset"),Vn=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},_l=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml"),gl=1,ml=2,ts=4,wl=8,bl=16,yl=1,kl=4,xl=8,Tl=16,El=1,Sl=2,Pe=Symbol("uninitialized"),Al="http://www.w3.org/1999/xhtml";function zl(){console.warn("https://svelte.dev/e/derived_inert")}function Dl(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Cl(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function ns(e){return e===this.v}function jl(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function rs(e){return!jl(e,this.v)}function Ml(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Pl(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Ll(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ol(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Il(e){throw new Error("https://svelte.dev/e/effect_orphan")}function ql(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Nl(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function Rl(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Fl(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Ul(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Hl(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}let Yl=!1,Ge=null;function Tn(e){Ge=e}function Je(e,t=!1,n){Ge={p:Ge,i:!1,c:null,e:null,s:e,x:null,r:de,l:null}}function Xe(e){var t=Ge,n=t.e;if(n!==null){t.e=null;for(var r of n)ks(r)}return t.i=!0,Ge=t.p,Xr(e)}function Xr(e={}){return Ka(e,$a,{value:!0}),e}function as(){return!0}let rn=[];function ss(){var e=rn;rn=[],vl(e)}function Ft(e){if(rn.length===0&&!Fn){var t=rn;queueMicrotask(()=>{t===rn&&ss()})}rn.push(e)}function Zl(){for(;rn.length>0;)ss()}const Bl=-7169;function ze(e,t){e.f=e.f&Bl|t}function Qr(e){(e.f&vt)!==0||e.deps===null?ze(e,Le):ze(e,yt)}function ls(e){if(e!==null)for(const t of e)(t.f&qe)===0||(t.f&cn)===0||(t.f^=cn,ls(t.deps))}function os(e,t,n){(e.f&Ce)!==0?t.add(e):(e.f&yt)!==0&&n.add(e),ls(e.deps),ze(e,Le)}let $n=!1;function Wl(e){var t=$n;try{return $n=!1,[e(),$n]}finally{$n=t}}let wa=!1;function Vl(){wa||(wa=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t[rr]?.()})},{capture:!0}))}function Cn(e){var t=he,n=de;ht(null),It(null);try{return e()}finally{ht(t),It(n)}}function $r(e,t,n,r=n){e.addEventListener(t,()=>Cn(n));const s=e[rr];s?e[rr]=()=>{s(),r(!0)}:e[rr]=()=>r(!0),Vl()}function Gl(e,t,n,r){const s=Hn;var l=e.filter(h=>!h.settled),o=t.map(s);if(n.length===0&&l.length===0){r(o);return}var c=de,i=Kl(),v=l.length===1?l[0].promise:l.length>1?Promise.all(l.map(h=>h.promise)):null;function _(h){if((c.f&nt)===0){i();try{r([...o,...h])}catch(y){zt(y,c)}vr()}}var f=is();if(n.length===0){v.then(()=>_([])).finally(f);return}function d(){Promise.all(n.map(h=>Jl(h))).then(_).catch(h=>zt(h,c)).finally(f)}v?v.then(()=>{i(),d(),vr()}):d()}function Kl(){var e=de,t=he,n=Ge,r=ue;return function(l=!0){It(e),ht(t),Tn(n),l&&(e.f&nt)===0&&(r?.activate(),r?.apply())}}function vr(e=!0){It(null),ht(null),Tn(null),e&&ue?.deactivate()}function is(){var e=de,t=e.b,n=ue,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function Hn(e){var t=qe|Ce;return de!==null&&(de.f|=Dn),{ctx:Ge,deps:null,effects:null,equals:ns,f:t,fn:e,reactions:null,rv:0,v:Pe,wv:0,parent:de,ac:null}}const Ln=Symbol("obsolete");function Jl(e,t,n){let r=de;r===null&&Ml();var s=void 0,l=un(Pe),o=!he,c=new Set;return vo(()=>{var i=de,v=Xa();s=v.promise;try{Promise.resolve(e()).then(v.resolve,h=>{h!==Vn&&v.reject(h)}).finally(vr)}catch(h){v.reject(h),vr()}var _=ue;if(o){if((i.f&zn)!==0)var f=is();if(r.b?.is_rendered())_.async_deriveds.get(i)?.reject(Ln);else for(const h of c.values())h.reject(Ln);c.add(v),_.async_deriveds.set(i,v)}const d=(h,y=void 0)=>{f?.(),c.delete(v),y!==Ln&&(_.activate(),y?(l.f|=Qt,En(l,y)):((l.f&Qt)!==0&&(l.f^=Qt),En(l,h)),_.deactivate())};v.promise.then(d,h=>d(null,h||"unknown"))}),aa(()=>{for(const i of c)i.reject(Ln)}),new Promise(i=>{function v(_){function f(){_===s?i(l):v(s)}_.then(f,f)}v(s)})}function ee(e){const t=Hn(e);return zs(t),t}function cs(e){const t=Hn(e);return t.equals=rs,t}function Xl(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)rt(t[n])}}function ea(e){var t,n=de,r=e.parent;if(!Bt&&r!==null&&e.v!==Pe&&(r.f&(nt|Ve))!==0)return zl(),e.v;It(r);try{e.f&=~cn,Xl(e),t=Ms(e)}finally{It(n)}return t}function us(e){var t=ea(e);if(!e.equals(t)&&(e.wv=Cs(),(!ue?.is_fork||e.deps===null)&&(ue!==null?(ue.capture(e,t,!0),Hr?.capture(e,t,!0)):e.v=t,e.deps===null))){ze(e,Le);return}Bt||(wt!==null?(ra()||ue?.is_fork)&&wt.set(e,t):Qr(e))}function Ql(e){if(e.effects!==null)for(const t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac!==null&&Cn(()=>{t.ac.abort(Vn),t.ac=null}),t.fn!==null&&(t.teardown=ul),Zn(t,0),la(t))}function vs(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&t.fn!==null&&Sn(t)}let Ar=null,pn=null,ue=null,Hr=null,wt=null,Yr=null,Fn=!1,zr=!1,gn=null,ar=null;var ba=0;let $l=1;class nn{id=$l++;#t=!1;linked=!0;#l=null;#e=null;async_deriveds=new Map;current=new Map;previous=new Map;#i=new Set;#r=new Set;#s=0;#n=new Map;#o=null;#a=[];#p=[];#c=new Set;#u=new Set;#f=new Map;#_=new Set;is_fork=!1;#v=!1;constructor(){pn===null?Ar=pn=this:(pn.#e=this,this.#l=pn),pn=this}#w(){if(this.is_fork)return!0;for(const r of this.#n.keys()){for(var t=r,n=!1;t.parent!==null;){if(this.#f.has(t)){n=!0;break}t=t.parent}if(!n)return!0}return!1}skip_effect(t){this.#f.has(t)||this.#f.set(t,{d:[],m:[]}),this.#_.delete(t)}unskip_effect(t,n=r=>this.schedule(r)){var r=this.#f.get(t);if(r){this.#f.delete(t);for(var s of r.d)ze(s,Ce),n(s);for(s of r.m)ze(s,yt),n(s)}this.#_.add(t)}#g(){this.#t=!0,ba++>1e3&&(this.#h(),to());for(const i of this.#c)this.#u.delete(i),ze(i,Ce),this.schedule(i);for(const i of this.#u)ze(i,yt),this.schedule(i);const t=this.#a;this.#a=[],this.apply();var n=gn=[],r=[],s=ar=[];for(const i of t)try{this.#y(i,n,r)}catch(v){throw hs(i),this.#w()||this.discard(),v}if(ue=null,s.length>0){var l=nn.ensure();for(const i of s)l.schedule(i)}if(gn=null,ar=null,this.#w()){this.#d(r),this.#d(n);for(const[i,v]of this.#f)ds(i,v);s.length>0&&ue.#g();return}const o=this.#b();if(o){this.#d(r),this.#d(n),o.#k(this);return}this.#c.clear(),this.#u.clear();for(const i of this.#i)i(this);this.#i.clear(),Hr=this,ya(r),ya(n),Hr=null,this.#o?.resolve();var c=ue;if(this.#s===0&&(this.#a.length===0||c!==null)&&this.#h(),this.#a.length>0)if(c!==null){const i=c;i.#a.push(...this.#a.filter(v=>!i.#a.includes(v)))}else c=this;c!==null&&(Pt.clear(),c.#g())}#y(t,n,r){t.f^=Le;for(var s=t.first;s!==null;){var l=s.f,o=(l&(dt|Zt))!==0,c=o&&(l&Le)!==0,i=c||(l&Ve)!==0||this.#f.has(s);if(!i&&s.fn!==null){o?s.f^=Le:(l&kn)!==0?n.push(s):Kn(s)&&((l&mt)!==0&&this.#u.add(s),Sn(s));var v=s.first;if(v!==null){s=v;continue}}for(;s!==null;){var _=s.next;if(_!==null){s=_;break}s=s.parent}}}#b(){for(var t=this.#l;t!==null;){if(!t.is_fork){for(const[n,[,r]]of this.current)if(t.current.has(n)&&!r)return t}t=t.#l}return null}#k(t){for(const[r,s]of t.current)!this.previous.has(r)&&t.previous.has(r)&&this.previous.set(r,t.previous.get(r)),this.current.set(r,s);for(const[r,s]of t.async_deriveds){const l=this.async_deriveds.get(r);l&&s.promise.then(l.resolve).catch(l.reject)}t.async_deriveds.clear(),this.transfer_effects(t.#c,t.#u);const n=r=>{var s=r.reactions;if(s!==null&&!((r.f&qe)!==0&&(r.f&(Ce|yt))===0))for(const c of s){var l=c.f;if((l&qe)!==0)n(c);else{var o=c;l&(bn|mt)&&!this.async_deriveds.has(o)&&(this.#u.delete(o),ze(o,Ce),this.schedule(o))}}};for(const r of this.current.keys())n(r);this.oncommit(()=>t.discard()),t.#h(),ue=this,this.#g()}#d(t){for(var n=0;n<t.length;n+=1)os(t[n],this.#c,this.#u)}capture(t,n,r=!1){t.v!==Pe&&!this.previous.has(t)&&this.previous.set(t,t.v),(t.f&Qt)===0&&(this.current.set(t,[n,r]),wt?.set(t,n)),this.is_fork||(t.v=n)}activate(){ue=this}deactivate(){ue=null,wt=null}flush(){try{zr=!0,ue=this,this.#g()}finally{ba=0,Yr=null,gn=null,ar=null,zr=!1,ue=null,wt=null,Pt.clear()}}discard(){for(const t of this.#r)t(this);this.#r.clear();for(const t of this.async_deriveds.values())t.reject(Ln);this.#h(),this.#o?.resolve()}register_created_effect(t){this.#p.push(t)}#m(){for(let f=Ar;f!==null;f=f.#e){var t=f.id<this.id,n=[];for(const[d,[h,y]]of this.current){if(f.current.has(d)){var r=f.current.get(d)[0];if(t&&h!==r)f.current.set(d,[h,y]);else continue}n.push(d)}if(t)for(const[d,h]of this.async_deriveds){const y=f.async_deriveds.get(d);y&&h.promise.then(y.resolve).catch(y.reject)}var s=[...f.current.keys()].filter(d=>!f.current.get(d)[1]);if(!(!f.#t||s.length===0)){var l=s.filter(d=>!this.current.has(d));if(l.length===0)t&&f.discard();else if(n.length>0){if(t)for(const d of this.#_)f.unskip_effect(d,h=>{(h.f&(mt|bn))!==0?f.schedule(h):f.#d([h])});f.activate();var o=new Set,c=new Map;for(var i of n)fs(i,l,o,c);c=new Map;var v=[...f.current].filter(([d,h])=>{const y=this.current.get(d);return y?y[0]!==h[0]||y[1]!==h[1]:!0}).map(([d])=>d);if(v.length>0)for(const d of this.#p)(d.f&(nt|Ve|cr))===0&&ta(d,v,c)&&((d.f&(bn|mt))!==0?(ze(d,Ce),f.schedule(d)):f.#c.add(d));if(f.#a.length>0&&!f.#v){f.apply();for(var _ of f.#a)f.#y(_,[],[]);f.#a=[]}f.deactivate()}}}}increment(t,n){if(this.#s+=1,t){let r=this.#n.get(n)??0;this.#n.set(n,r+1)}}decrement(t,n){if(this.#s-=1,t){let r=this.#n.get(n)??0;r===1?this.#n.delete(n):this.#n.set(n,r-1)}this.#v||(this.#v=!0,Ft(()=>{this.#v=!1,this.linked&&this.flush()}))}transfer_effects(t,n){for(const r of t)this.#c.add(r);for(const r of n)this.#u.add(r);t.clear(),n.clear()}oncommit(t){this.#i.add(t)}ondiscard(t){this.#r.add(t)}settled(){return(this.#o??=Xa()).promise}static ensure(){if(ue===null){const t=ue=new nn;!zr&&!Fn&&Ft(()=>{t.#t||t.flush()})}return ue}apply(){{wt=null;return}}schedule(t){if(Yr=t,t.b?.is_pending&&(t.f&(kn|br|Qa))!==0&&(t.f&zn)===0){t.b.defer_effect(t);return}for(var n=t;n.parent!==null;){n=n.parent;var r=n.f;if(gn!==null&&n===de&&(he===null||(he.f&qe)===0))return;if((r&(Zt|dt))!==0){if((r&Le)===0)return;n.f^=Le}}this.#a.push(n)}#h(){if(this.linked){var t=this.#l,n=this.#e;t===null?Ar=n:t.#e=n,n===null?pn=t:n.#l=t,this.linked=!1}}}function eo(e){var t=Fn;Fn=!0;try{for(var n;;){if(Zl(),ue===null)return n;ue.flush()}}finally{Fn=t}}function to(){try{ql()}catch(e){zt(e,Yr)}}let Rt=null;function ya(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if((r.f&(nt|Ve))===0&&Kn(r)&&(Rt=new Set,Sn(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&Es(r),Rt?.size>0)){Pt.clear();for(const s of Rt){if((s.f&(nt|Ve))!==0)continue;const l=[s];let o=s.parent;for(;o!==null;)Rt.has(o)&&(Rt.delete(o),l.push(o)),o=o.parent;for(let c=l.length-1;c>=0;c--){const i=l[c];(i.f&(nt|Ve))===0&&Sn(i)}}Rt.clear()}}Rt=null}}function fs(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const s of e.reactions){const l=s.f;(l&qe)!==0?fs(s,t,n,r):(l&(bn|mt))!==0&&(l&Ce)===0&&ta(s,t,r)&&(ze(s,Ce),na(s))}}function ta(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const s of e.deps){if(or.call(t,s))return!0;if((s.f&qe)!==0&&ta(s,t,n))return n.set(s,!0),!0}return n.set(e,!1),!1}function na(e){ue.schedule(e)}function ds(e,t){if(!((e.f&dt)!==0&&(e.f&Le)!==0)){(e.f&Ce)!==0?t.d.push(e):(e.f&yt)!==0&&t.m.push(e),ze(e,Le);for(var n=e.first;n!==null;)ds(n,t),n=n.next}}function hs(e){ze(e,Le);for(var t=e.first;t!==null;)hs(t),t=t.next}let fr=new Set;const Pt=new Map;let ps=!1;function un(e,t){var n={f:0,v:e,reactions:null,equals:ns,rv:0,wv:0};return n}function ce(e,t){const n=un(e);return zs(n),n}function no(e,t=!1,n=!0){const r=un(e);return t||(r.equals=rs),r}function k(e,t,n=!1){he!==null&&(!bt||(he.f&cr)!==0)&&as()&&(he.f&(qe|mt|bn|cr))!==0&&(Lt===null||!Lt.has(e))&&Ul();let r=n?Ze(t):t;return En(e,r,ar)}function En(e,t,n=null){if(!e.equals(t)){Bt?Pt.set(e,t):Pt.has(e)||Pt.set(e,e.v);var r=nn.ensure();if(r.capture(e,t),(e.f&qe)!==0){const s=e;(e.f&Ce)!==0&&ea(s),wt===null&&Qr(s)}e.wv=Cs(),_s(e,Ce,n),de!==null&&(de.f&Le)!==0&&(de.f&(dt|Zt))===0&&(it===null?po([e]):it.push(e)),!r.is_fork&&fr.size>0&&!ps&&ro()}return t}function ro(){ps=!1;for(const e of fr){(e.f&Le)!==0&&ze(e,yt);let t;try{t=Kn(e)}catch{t=!0}t&&Sn(e)}fr.clear()}function Un(e){k(e,e.v+1)}function _s(e,t,n){var r=e.reactions;if(r!==null)for(var s=r.length,l=0;l<s;l++){var o=r[l],c=o.f,i=(c&Ce)===0;if(i&&ze(o,t),(c&cr)!==0)fr.add(o);else if((c&qe)!==0){var v=o;wt?.delete(v),(c&cn)===0&&(c&vt&&(de===null||(de.f&ur)===0)&&(o.f|=cn),_s(v,yt,n))}else if(i){var _=o;(c&mt)!==0&&Rt!==null&&Rt.add(_),n!==null?n.push(_):na(_)}}}function Ze(e){if(typeof e!="object"||e===null||sn in e||$a in e)return e;const t=Ja(e);if(t!==il&&t!==cl)return e;var n=new Map,r=mr(e),s=ce(0),l=on,o=c=>{if(on===l)return c();var i=he,v=on;ht(null),Ta(l);var _=c();return ht(i),Ta(v),_};return r&&n.set("length",ce(e.length)),new Proxy(e,{defineProperty(c,i,v){(!("value"in v)||v.configurable===!1||v.enumerable===!1||v.writable===!1)&&Rl();var _=n.get(i);return _===void 0?o(()=>{var f=ce(v.value);return n.set(i,f),f}):k(_,v.value,!0),!0},deleteProperty(c,i){var v=n.get(i);if(v===void 0){if(i in c){const _=o(()=>ce(Pe));n.set(i,_),Un(s)}}else k(v,Pe),Un(s);return!0},get(c,i,v){if(i===sn)return e;var _=n.get(i),f=i in c;if(_===void 0&&(!f||wn(c,i)?.writable)&&(_=o(()=>{var h=Ze(f?c[i]:Pe),y=ce(h);return y}),n.set(i,_)),_!==void 0){var d=a(_);return d===Pe?void 0:d}return Reflect.get(c,i,v)},getOwnPropertyDescriptor(c,i){var v=Reflect.getOwnPropertyDescriptor(c,i);if(v&&"value"in v){var _=n.get(i);_&&(v.value=a(_))}else if(v===void 0){var f=n.get(i),d=f?.v;if(f!==void 0&&d!==Pe)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return v},has(c,i){if(i===sn)return!0;var v=n.get(i),_=v!==void 0&&v.v!==Pe||Reflect.has(c,i);if(v!==void 0||de!==null&&(!_||wn(c,i)?.writable)){v===void 0&&(v=o(()=>{var d=_?Ze(c[i]):Pe,h=ce(d);return h}),n.set(i,v));var f=a(v);if(f===Pe)return!1}return _},set(c,i,v,_){var f=n.get(i),d=i in c;if(r&&i==="length")for(var h=v;h<f.v;h+=1){var y=n.get(h+"");y!==void 0?k(y,Pe):h in c&&(y=o(()=>ce(Pe)),n.set(h+"",y))}if(f===void 0)(!d||wn(c,i)?.writable)&&(f=o(()=>ce(void 0)),k(f,Ze(v)),n.set(i,f));else{d=f.v!==Pe;var Y=o(()=>Ze(v));k(f,Y)}var w=Reflect.getOwnPropertyDescriptor(c,i);if(w?.set&&w.set.call(_,v),!d){if(r&&typeof i=="string"){var j=n.get("length"),F=Number(i);Number.isInteger(F)&&F>=j.v&&k(j,F+1)}Un(s)}return!0},ownKeys(c){a(s);var i=Reflect.ownKeys(c).filter(f=>{var d=n.get(f);return d===void 0||d.v!==Pe});for(var[v,_]of n)_.v!==Pe&&!(v in c)&&i.push(v);return i},setPrototypeOf(){Fl()}})}function ka(e){try{if(e!==null&&typeof e=="object"&&sn in e)return e[sn]}catch{}return e}function gs(e,t){return Object.is(ka(e),ka(t))}var dr,ms,ws,bs;function ao(){if(dr===void 0){dr=window,ms=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;ws=wn(t,"firstChild").get,bs=wn(t,"nextSibling").get,ma(e)&&(e[Rr]=void 0,e[es]=null,e[Fr]=void 0,e.__e=void 0),ma(n)&&(n[Ur]=void 0)}}function Ht(e=""){return document.createTextNode(e)}function Yn(e){return ws.call(e)}function Gn(e){return bs.call(e)}function p(e,t){return Yn(e)}function vn(e,t=!1){{var n=Yn(e);return n instanceof Comment&&n.data===""?Gn(n):n}}function N(e,t=!1){return Yn(e)}function u(e,t=1,n=!1){let r=e;for(;t--;)r=Gn(r);return r}function so(e){e.textContent=""}function ys(){return!1}function lo(e,t,n){return n?document.createElement(e,{is:n}):document.createElement(e)}function oo(e){var t=de;if(t===null)return he.f|=Qt,e;if((t.f&zn)===0&&(t.f&kn)===0)throw e;zt(e,t)}function zt(e,t){if(!(t!==null&&(t.f&nt)!==0)){for(;t!==null;){if((t.f&Nr)!==0&&(t.f&(nt|ir))===0){if((t.f&zn)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}}function io(e){de===null&&(he===null&&Il(),Ol()),Bt&&Ll()}function co(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Gt(e,t){var n=de;n!==null&&(n.f&Ve)!==0&&(e|=Ve);var r={ctx:Ge,deps:null,nodes:null,f:e|Ce|vt,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};ue?.register_created_effect(r);var s=r;if((e&kn)!==0)gn!==null?gn.push(r):nn.ensure().schedule(r);else if(t!==null){try{Sn(r)}catch(o){throw rt(r),o}s.deps===null&&s.teardown===null&&s.nodes===null&&s.first===s.last&&(s.f&Dn)===0&&(s=s.first,(e&mt)!==0&&(e&xn)!==0&&s!==null&&(s.f|=xn))}if(s!==null&&(s.parent=n,n!==null&&co(s,n),he!==null&&(he.f&qe)!==0&&(e&Zt)===0)){var l=he;(l.effects??=[]).push(s)}return r}function ra(){return he!==null&&!bt}function aa(e){const t=Gt(br,null);return ze(t,Le),t.teardown=e,t}function At(e){io();var t=de.f,n=!he&&(t&dt)!==0&&Ge!==null&&!Ge.i;if(n){var r=Ge;(r.e??=[]).push(e)}else return ks(e)}function ks(e){return Gt(kn|dl,e)}function uo(e){nn.ensure();const t=Gt(Zt|Dn,e);return(n={})=>new Promise(r=>{n.outro?ln(t,()=>{rt(t),r(void 0)}):(rt(t),r(void 0))})}function xs(e){return Gt(kn,e)}function vo(e){return Gt(bn|Dn,e)}function yr(e,t=0){return Gt(br|t,e)}function z(e,t=[],n=[],r=[]){Gl(r,t,n,s=>{Gt(br,()=>{e(...s.map(a))})})}function sa(e,t=0){var n=Gt(mt|t,e);return n}function ut(e){return Gt(dt|Dn,e)}function Ts(e){var t=e.teardown;if(t!==null){const n=Bt,r=he;xa(!0),ht(null);try{t.call(null)}catch(s){zt(s,e.parent)}finally{xa(n),ht(r)}}}function la(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const s=n.ac;s!==null&&Cn(()=>{s.abort(Vn)});var r=n.next;(n.f&Zt)!==0?n.parent=null:rt(n,t),n=r}}function fo(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&dt)===0&&rt(t),t=n}}function rt(e,t=!0){var n=!1;(t||(e.f&fl)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(ho(e.nodes.start,e.nodes.end),n=!0),e.f|=ir,la(e,t&&!n),Zn(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(const l of r)l.stop();Ts(e),e.f^=ir,e.f|=nt;var s=e.parent;s!==null&&s.first!==null&&Es(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function ho(e,t){for(;e!==null;){var n=e===t?null:Gn(e);e.remove(),e=n}}function Es(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function ln(e,t,n=!0){var r=[];e.f|=Jr,Ss(e,r,!0);var s=()=>{n&&rt(e),t&&t()},l=r.length;if(l>0){var o=()=>--l||s();for(var c of r)c.out(o)}else s()}function Ss(e,t,n){if((e.f&Ve)===0){e.f^=Ve;var r=e.nodes&&e.nodes.t;if(r!==null)for(const c of r)(c.is_global||n)&&t.push(c);for(var s=e.first;s!==null;){var l=s.next;if((s.f&Zt)===0){var o=(s.f&xn)!==0||(s.f&dt)!==0&&(e.f&mt)!==0;Ss(s,t,o?n:!1)}s=l}}}function hr(e){e.f&=~Jr,As(e,!0)}function As(e,t){if((e.f&Jr)===0&&(e.f&Ve)!==0){e.f^=Ve,(e.f&Le)===0&&(ze(e,Ce),nn.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,s=(n.f&xn)!==0||(n.f&dt)!==0;As(n,s?t:!1),n=r}var l=e.nodes&&e.nodes.t;if(l!==null)for(const o of l)(o.is_global||t)&&o.in()}}function oa(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var s=n===r?null:Gn(n);t.append(n),n=s}}let sr=!1,Bt=!1;function xa(e){Bt=e}let he=null,bt=!1;function ht(e){he=e}let de=null;function It(e){de=e}let Lt=null;function zs(e){he!==null&&(Lt??=new Set).add(e)}let et=null,lt=0,it=null;function po(e){it=e}let Ds=1,an=0,on=an;function Ta(e){on=e}function Cs(){return++Ds}function Kn(e){var t=e.f;if((t&Ce)!==0)return!0;if(t&qe&&(e.f&=~cn),(t&yt)!==0){for(var n=e.deps,r=n.length,s=0;s<r;s++){var l=n[s];if(Kn(l)&&us(l),l.wv>e.wv)return!0}(t&vt)!==0&&wt===null&&ze(e,Le)}return!1}function js(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Lt!==null&&Lt.has(e)))for(var s=0;s<r.length;s++){var l=r[s];(l.f&qe)!==0?js(l,t,!1):t===l&&(n?ze(l,Ce):(l.f&Le)!==0&&ze(l,yt),na(l))}}function Ms(e){var t=et,n=lt,r=it,s=he,l=Lt,o=Ge,c=bt,i=on,v=e.f;et=null,lt=0,it=null,he=(v&(dt|Zt))===0?e:null,Lt=null,Tn(e.ctx),bt=!1,on=++an,e.ac!==null&&(Cn(()=>{e.ac.abort(Vn)}),e.ac=null);try{e.f|=ur;var _=e.fn,f=_();e.f|=zn;var d=Ea(e);if(as()&&it!==null&&!bt&&d!==null&&(e.f&(qe|yt|Ce))===0)for(var h=0;h<it.length;h++)js(it[h],e);if(s!==null&&s!==e){if(an++,s.deps!==null)for(let y=0;y<n;y+=1)s.deps[y].rv=an;if(t!==null)for(const y of t)y.rv=an;it!==null&&(r===null?r=it:r.push(...it))}return(e.f&Qt)!==0&&(e.f^=Qt),f}catch(y){return Ea(e),oo(y)}finally{e.f^=ur,et=t,lt=n,it=r,he=s,Lt=l,Tn(o),bt=c,on=i}}function Ea(e){var t=e.deps,n=ue?.is_fork;if(et!==null){var r;if(n||Zn(e,lt),t!==null&<>0)for(t.length=lt+et.length,r=0;r<et.length;r++)t[lt+r]=et[r];else e.deps=t=et;if(ra()&&(e.f&vt)!==0)for(r=lt;r<t.length;r++)(t[r].reactions??=[]).push(e)}else!n&&t!==null&<<t.length&&(Zn(e,lt),t.length=lt);return t}function _o(e,t){let n=t.reactions;if(n!==null){var r=ll.call(n,e);if(r!==-1){var s=n.length-1;s===0?n=t.reactions=null:(n[r]=n[s],n.pop())}}if(n===null&&(t.f&qe)!==0&&(et===null||!or.call(et,t))){var l=t;(l.f&vt)!==0&&(l.f^=vt,l.f&=~cn),l.v!==Pe&&Qr(l),l.ac!==null&&Cn(()=>{l.ac.abort(Vn),l.ac=null,ze(l,Ce)}),Ql(l),Zn(l,0)}}function Zn(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)_o(e,n[r])}function Sn(e){var t=e.f;if((t&nt)===0){ze(e,Le);var n=de,r=sr;de=e,sr=(t&(dt|Zt))===0;try{(t&(mt|Qa))!==0?fo(e):la(e),Ts(e);var s=Ms(e);e.teardown=typeof s=="function"?s:null,e.wv=Ds;var l;Ga&&Yl&&(e.f&Ce)!==0&&e.deps}finally{sr=r,de=n}}}async function go(){await Promise.resolve(),eo()}function a(e){var t=e.f,n=(t&qe)!==0;if(he!==null&&!bt){var r=de!==null&&(de.f&nt)!==0;if(!r&&(Lt===null||!Lt.has(e))){var s=he.deps;if((he.f&ur)!==0)e.rv<an&&(e.rv=an,et===null&&s!==null&&s[lt]===e?lt++:et===null?et=[e]:et.push(e));else{he.deps??=[],or.call(he.deps,e)||he.deps.push(e);var l=e.reactions;l===null?e.reactions=[he]:or.call(l,he)||l.push(he)}}}if(Bt&&Pt.has(e))return Pt.get(e);if(n){var o=e;if(Bt){var c=o.v;return((o.f&Le)===0&&o.reactions!==null||Ls(o))&&(c=ea(o)),Pt.set(o,c),c}var i=(o.f&vt)===0&&!bt&&he!==null&&(sr||(he.f&vt)!==0),v=(o.f&zn)===0;Kn(o)&&(i&&(o.f|=vt),us(o)),i&&!v&&(vs(o),Ps(o))}if(wt?.has(e))return wt.get(e);if((e.f&Qt)!==0)throw e.v;return e.v}function Ps(e){if(e.f|=vt,e.deps!==null)for(const t of e.deps)(t.reactions??=[]).push(e),(t.f&qe)!==0&&(t.f&vt)===0&&(vs(t),Ps(t))}function Ls(e){if(e.v===Pe)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(Pt.has(t)||(t.f&qe)!==0&&Ls(t))return!0;return!1}function Jn(e){var t=bt;try{return bt=!0,e()}finally{bt=t}}const mo=["touchstart","touchmove"];function wo(e){return mo.includes(e)}const On=Symbol("events"),Os=new Set,Zr=new Set;function bo(e,t,n,r={}){function s(l){if(r.capture||Br.call(t,l),!l.cancelBubble)return Cn(()=>n?.call(this,l))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Ft(()=>{t.addEventListener(e,s,r)}):t.addEventListener(e,s,r),s}function mn(e,t,n,r,s){var l={capture:r,passive:s},o=bo(e,t,n,l);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&aa(()=>{t.removeEventListener(e,o,l)})}function Q(e,t,n){(t[On]??={})[e]=n}function ot(e){for(var t=0;t<e.length;t++)Os.add(e[t]);for(var n of Zr)n(e)}let Dr=null,Cr=!1;function Br(e){var t=this,n=t.ownerDocument,r=e.type,s=e.composedPath?.()||[],l=s[0]||e.target;Dr=e,Cr||(Cr=!0,setTimeout(()=>{Cr=!1,Dr=null}));var o=0,c=Dr===e&&e[On];if(c){var i=s.indexOf(c);if(i!==-1&&(t===document||t===window)){e[On]=t;return}var v=s.indexOf(t);if(v===-1)return;i<=v&&(o=i)}if(l=s[o]||e.target,l!==t){Ka(e,"currentTarget",{configurable:!0,get(){return l||n}});var _=he,f=de;ht(null),It(null);try{for(var d,h=[];l!==null&&l!==t;){try{var y=l[On]?.[r];y!=null&&(!l.disabled||e.target===l)&&y.call(l,e)}catch(Y){d?h.push(Y):d=Y}if(e.cancelBubble)break;o++,l=o<s.length?s[o]:null}if(d){for(let Y of h)queueMicrotask(()=>{throw Y});throw d}}finally{e[On]=t,delete e.currentTarget,ht(_),It(f)}}}const yo=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function ko(e){return yo?.createHTML(e)??e}function xo(e){var t=lo("template");return t.innerHTML=ko(e.replaceAll("<!>","<!---->")),t.content}function pr(e,t){var n=de;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function b(e,t){var n=(t&El)!==0,r=(t&Sl)!==0,s,l=!e.startsWith("<!>");return()=>{s===void 0&&(s=xo(l?e:"<!>"+e),n||(s=Yn(s)));var o=r||ms?document.importNode(s,!0):s.cloneNode(!0);if(n){var c=Yn(o),i=o.lastChild;pr(c,i)}else pr(o,o);return o}}function Mn(e=""){{var t=Ht(e+"");return pr(t,t),t}}function To(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Ht();return e.append(t,n),pr(t,n),e}function g(e,t){e!==null&&e.before(t)}function Eo(e){let t=0,n=un(0),r;return()=>{ra()&&(a(n),yr(()=>(t===0&&(r=Jn(()=>e(()=>Un(n)))),t+=1,()=>{Ft(()=>{t-=1,t===0&&(r?.(),r=void 0,Un(n))})})))}}var So=xn|Dn;function Ao(e,t,n,r){new zo(e,t,n,r)}class zo{parent;is_pending=!1;transform_error;#t;#l=null;#e;#i;#r;#s=null;#n=null;#o=null;#a=null;#p=0;#c=0;#u=!1;#f=new Set;#_=new Set;#v=null;#w=Eo(()=>(this.#v=un(this.#p),()=>{this.#v=null}));constructor(t,n,r,s){this.#t=t,this.#e=n,this.#i=l=>{var o=de;o.b=this,o.f|=Nr,r(l)},this.parent=de.b,this.transform_error=s??this.parent?.transform_error??(l=>l),this.#r=sa(()=>{this.#d()},So)}#g(){try{this.#s=ut(()=>this.#i(this.#t))}catch(t){this.error(t)}}#y(t){const n=this.#e.failed,{reset:r,invoke_onerror:s}=this.#b(t);Ft(s),n&&(this.#o=ut(()=>{n(this.#t,()=>t,()=>r)}))}#b(t){var n=!1,r=!1;const s=()=>{if(n){Cl();return}n=!0,r&&Hl(),this.#o!==null&&ln(this.#o,()=>{this.#o=null}),this.#h(()=>{this.#d()})};return{reset:s,invoke_onerror:()=>{try{r=!0,this.#e.onerror?.(t,s),r=!1}catch(o){zt(o,this.#r&&this.#r.parent)}}}}#k(){const t=this.#e.pending;t&&(this.is_pending=!0,this.#n=ut(()=>t(this.#t)),Ft(()=>{var n=this.#a=document.createDocumentFragment(),r=Ht(),s=!1;if(n.append(r),this.#s=this.#h(()=>{try{return ut(()=>this.#i(r))}catch(l){try{this.error(l),s=!0}catch(o){zt(o,this.#r.parent)}return null}}),this.#s===null){this.#a=null,s&&this.#m(ue);return}this.#c===0&&(this.#t.before(n),this.#a=null,ln(this.#n,()=>{this.#n=null}),this.#m(ue))}))}#d(){try{if(this.is_pending=this.has_pending_snippet(),this.#c=0,this.#p=0,this.#s=ut(()=>{this.#i(this.#t)}),this.#c>0){var t=this.#a=document.createDocumentFragment();oa(this.#s,t);const n=this.#e.pending;this.#n=ut(()=>n(this.#t))}else this.#m(ue)}catch(n){this.error(n)}}#m(t){this.is_pending=!1,t.transfer_effects(this.#f,this.#_)}defer_effect(t){os(t,this.#f,this.#_)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#e.pending}#h(t){var n=de,r=he,s=Ge;It(this.#r),ht(this.#r),Tn(this.#r.ctx);try{return nn.ensure(),t()}finally{It(n),ht(r),Tn(s)}}#x(t,n){if(!this.has_pending_snippet()){this.parent&&this.parent.#x(t,n);return}this.#c+=t,this.#c===0&&(this.#m(n),this.#n&&ln(this.#n,()=>{this.#n=null}),this.#a&&(this.#t.before(this.#a),this.#a=null))}update_pending_count(t,n){this.#x(t,n),this.#p+=t,!(!this.#v||this.#u)&&(this.#u=!0,Ft(()=>{this.#u=!1,this.#v&&En(this.#v,this.#p)}))}get_effect_pending(){return this.#w(),a(this.#v)}error(t){if(!this.#e.onerror&&!this.#e.failed)throw t;ue?.is_fork?(this.#s&&ue.skip_effect(this.#s),this.#n&&ue.skip_effect(this.#n),this.#o&&ue.skip_effect(this.#o),ue.oncommit(()=>{this.#T(t)})):this.#T(t)}#T(t){this.#s&&(rt(this.#s),this.#s=null),this.#n&&(rt(this.#n),this.#n=null),this.#o&&(rt(this.#o),this.#o=null);let n=this.#e.failed;const r=s=>{const{reset:l,invoke_onerror:o}=this.#b(s);o(),n&&(this.#o=this.#h(()=>{try{return ut(()=>{var c=de;c.b=this,c.f|=Nr,n(this.#t,()=>s,()=>l)})}catch(c){return zt(c,this.#r.parent),null}}))};Ft(()=>{var s;try{s=this.transform_error(t)}catch(l){zt(l,this.#r&&this.#r.parent);return}s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(r,l=>zt(l,this.#r&&this.#r.parent)):r(s)})}}function C(e,t){var n=t==null?"":typeof t=="object"?`${t}`:t;n!==(e[Ur]??=e.nodeValue)&&(e[Ur]=n,e.nodeValue=`${n}`)}function Sa(e,t){return Do(e,t)}const er=new Map;function Do(e,{target:t,anchor:n,props:r={},events:s,context:l,intro:o=!0,transformError:c}){ao();var i=void 0,v=uo(()=>{var _=n??t.appendChild(Ht());Ao(_,{pending:()=>{}},h=>{Je({});var y=Ge;l&&(y.c=l),s&&(r.$$events=s),i=e(h,r)||Xr(),Xe()},c);var f=new Set,d=h=>{for(var y=0;y<h.length;y++){var Y=h[y];if(!f.has(Y)){f.add(Y);var w=wo(Y);for(const M of[t,document]){var j=er.get(M);j===void 0&&(j=new Map,er.set(M,j));var F=j.get(Y);F===void 0?(M.addEventListener(Y,Br,{passive:w}),j.set(Y,1)):j.set(Y,F+1)}}}};return d(wr(Os)),Zr.add(d),()=>{for(var h of f)for(const w of[t,document]){var y=er.get(w),Y=y.get(h);--Y==0?(w.removeEventListener(h,Br),y.delete(h),y.size===0&&er.delete(w)):y.set(h,Y)}Zr.delete(d),_!==n&&_.parentNode?.removeChild(_)}});return Co.set(i,v),i}let Co=new WeakMap;class jo{anchor;#t=new Map;#l=new Map;#e=new Map;#i=new Set;#r=!0;constructor(t,n=!0){this.anchor=t,this.#r=n}#s=t=>{if(this.#t.has(t)){var n=this.#t.get(t),r=this.#l.get(n);if(r)hr(r),this.#i.delete(n);else{var s=this.#e.get(n);s&&(hr(s.effect),this.#l.set(n,s.effect),this.#e.delete(n),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),r=s.effect)}for(const[l,o]of this.#t){if(this.#t.delete(l),l===t)break;const c=this.#e.get(o);c&&(rt(c.effect),this.#e.delete(o))}for(const[l,o]of this.#l){if(l===n||this.#i.has(l))continue;const c=()=>{if(Array.from(this.#t.values()).includes(l)){var v=document.createDocumentFragment();oa(o,v),v.append(Ht()),this.#e.set(l,{effect:o,fragment:v})}else rt(o);this.#i.delete(l),this.#l.delete(l)};this.#r||!r?(this.#i.add(l),ln(o,c,!1)):c()}}};#n=t=>{this.#t.delete(t);const n=Array.from(this.#t.values());for(const[r,s]of this.#e)n.includes(r)||(rt(s.effect),this.#e.delete(r))};ensure(t,n){var r=ue,s=ys();if(n&&!this.#l.has(t)&&!this.#e.has(t))if(s){var l=document.createDocumentFragment(),o=Ht();l.append(o),this.#e.set(t,{effect:ut(()=>n(o)),fragment:l})}else this.#l.set(t,ut(()=>n(this.anchor)));if(this.#t.set(r,t),s){for(const[c,i]of this.#l)c===t?r.unskip_effect(i):r.skip_effect(i);for(const[c,i]of this.#e)c===t?r.unskip_effect(i.effect):r.skip_effect(i.effect);r.oncommit(this.#s),r.ondiscard(this.#n)}else this.#s(r)}}function J(e,t,n=!1){var r=new jo(e),s=n?xn:0;function l(o,c){r.ensure(o,c)}sa(()=>{var o=!1;t((c,i=0)=>{o=!0,l(i,c)}),o||l(-1,null)},s)}function Ut(e,t){return t}function Mo(e,t,n){for(var r=[],s=t.length,l,o=t.length,c=0;c<s;c++){let f=t[c];ln(f,()=>{if(l){if(l.pending.delete(f),l.done.add(f),l.pending.size===0){var d=e.outrogroups;Wr(e,wr(l.done)),d.delete(l),d.size===0&&(e.outrogroups=null)}}else o-=1},!1)}if(o===0){var i=r.length===0&&n!==null&&e.pending.size===0;if(i){var v=n,_=v.parentNode;so(_),_.append(v),e.items.clear()}Wr(e,t,!i)}else l={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(l)}function Wr(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(const o of e.pending.values())for(const c of o)r.add(e.items.get(c).e)}for(var s=0;s<t.length;s++){var l=t[s];if(r?.has(l)){l.f|=Ct;const o=document.createDocumentFragment();oa(l,o)}else rt(t[s],n)}}var Aa;function oe(e,t,n,r,s,l=null){var o=e,c=new Map,i=(t&ts)!==0;if(i){var v=e;o=v.appendChild(Ht())}var _=null,f=cs(()=>{var M=n();return mr(M)?M:M==null?[]:wr(M)}),d,h=new Map,y=!0;function Y(M){(F.effect.f&nt)===0&&(F.pending.delete(M),F.fallback=_,Po(F,d,o,t,r),_!==null&&(d.length===0?(_.f&Ct)===0?hr(_):(_.f^=Ct,In(_,null,o)):ln(_,()=>{_=null})))}function w(M){F.pending.delete(M)}var j=sa(()=>{d=a(f);for(var M=d.length,D=new Set,P=ue,I=ys(),Z=0;Z<M;Z+=1){var L=d[Z],x=r(L,Z),T=y?null:c.get(x);T?(T.v&&En(T.v,L),T.i&&En(T.i,Z),I&&P.unskip_effect(T.e)):(T=Lo(c,y?o:Aa??=Ht(),L,x,Z,s,t,n),y||(T.e.f|=Ct),c.set(x,T)),D.add(x)}if(M===0&&l&&!_&&(y?_=ut(()=>l(o)):(_=ut(()=>l(Aa??=Ht())),_.f|=Ct)),M>D.size&&Pl(),!y)if(h.set(P,D),I){for(const[U,V]of c)D.has(U)||P.skip_effect(V.e);P.oncommit(Y),P.ondiscard(w)}else Y(P);a(f)}),F={effect:j,items:c,pending:h,outrogroups:null,fallback:_};y=!1}function Pn(e){for(;e!==null&&(e.f&dt)===0;)e=e.next;return e}function Po(e,t,n,r,s){var l=(r&wl)!==0,o=t.length,c=e.items,i=Pn(e.effect.first),v,_=null,f,d=[],h=[],y,Y,w,j;if(l)for(j=0;j<o;j+=1)y=t[j],Y=s(y,j),w=c.get(Y).e,(w.f&Ct)===0&&(w.nodes?.a?.measure(),(f??=new Set).add(w));for(j=0;j<o;j+=1){if(y=t[j],Y=s(y,j),w=c.get(Y).e,e.outrogroups!==null)for(const T of e.outrogroups)T.pending.delete(w),T.done.delete(w);if((w.f&Ve)!==0&&(hr(w),l&&(w.nodes?.a?.unfix(),(f??=new Set).delete(w))),(w.f&Ct)!==0)if(w.f^=Ct,w===i)In(w,null,n);else{var F=_?_.next:i;w===e.effect.last&&(e.effect.last=w.prev),w.prev&&(w.prev.next=w.next),w.next&&(w.next.prev=w.prev),Kt(e,_,w),Kt(e,w,F),In(w,F,n),_=w,d=[],h=[],i=Pn(_.next);continue}if(w!==i){if(v!==void 0&&v.has(w)){if(d.length<h.length){var M=h[0],D;_=M.prev;var P=d[0],I=d[d.length-1];for(D=0;D<d.length;D+=1)In(d[D],M,n);for(D=0;D<h.length;D+=1)v.delete(h[D]);Kt(e,P.prev,I.next),Kt(e,_,P),Kt(e,I,M),i=M,_=I,j-=1,d=[],h=[]}else v.delete(w),In(w,i,n),Kt(e,w.prev,w.next),Kt(e,w,_===null?e.effect.first:_.next),Kt(e,_,w),_=w;continue}for(d=[],h=[];i!==null&&i!==w;)(v??=new Set).add(i),h.push(i),i=Pn(i.next);if(i===null)continue}(w.f&Ct)===0&&d.push(w),_=w,i=Pn(w.next)}if(e.outrogroups!==null){for(const T of e.outrogroups)T.pending.size===0&&(Wr(e,wr(T.done)),e.outrogroups?.delete(T));e.outrogroups.size===0&&(e.outrogroups=null)}if(i!==null||v!==void 0){var Z=[];if(v!==void 0)for(w of v)(w.f&Ve)===0&&Z.push(w);for(;i!==null;)(i.f&Ve)===0&&i!==e.fallback&&Z.push(i),i=Pn(i.next);var L=Z.length;if(L>0){var x=(r&ts)!==0&&o===0?n:null;if(l){for(j=0;j<L;j+=1)Z[j].nodes?.a?.measure();for(j=0;j<L;j+=1)Z[j].nodes?.a?.fix()}Mo(e,Z,x)}}l&&Ft(()=>{if(f!==void 0)for(w of f)w.nodes?.a?.apply()})}function Lo(e,t,n,r,s,l,o,c){var i=(o&gl)!==0?(o&bl)===0?no(n,!1,!1):un(n):null,v=(o&ml)!==0?un(s):null;return{v:i,i:v,e:ut(()=>(l(t,i??n,v??s,c),()=>{e.delete(r)}))}}function In(e,t,n){if(e.nodes)for(var r=e.nodes.start,s=e.nodes.end,l=t&&(t.f&Ct)===0?t.nodes.start:n;r!==null;){var o=Gn(r);if(l.before(r),r===s)return;r=o}}function Kt(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}const za=[...` +\r\f \v\uFEFF`];function Oo(e,t,n){var r=e==null?"":""+e;if(t&&(r=r?r+" "+t:t),n){for(var s of Object.keys(n))if(n[s])r=r?r+" "+s:s;else if(r.length)for(var l=s.length,o=0;(o=r.indexOf(s,o))>=0;){var c=o+l;(o===0||za.includes(r[o-1]))&&(c===r.length||za.includes(r[c]))?r=(o===0?"":r.substring(0,o))+r.substring(c+1):o=c}}return r===""?null:r}function Io(e,t){return e==null?null:String(e)}function Ie(e,t,n,r,s,l){var o=e[Rr];if(o!==n||o===void 0){var c=Oo(n,r,l);c==null?e.removeAttribute("class"):e.className=c,e[Rr]=n}else if(l&&s!==l)for(var i in l){var v=!!l[i];(s==null||v!==!!s[i])&&e.classList.toggle(i,v)}return l}function Wt(e,t,n,r){var s=e[Fr];if(s!==t){var l=Io(t);l==null?e.removeAttribute("style"):e.style.cssText=l,e[Fr]=t}return r}function qo(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function No(e,t){var n=e.__defaultValue,r=e.multiple,s=r?n??[]:null;if(!(r&&!mr(s))){e.selectedIndex;for(var l of e.options){var o=yn(l);qo(l,r?s.includes(o):gs(o,n))}}}function Ot(e,t,n=!1){if(e.multiple){if(t==null)return;if(!mr(t))return Dl();for(var r of e.options)r.selected=t.includes(yn(r));return}for(r of e.options){var s=yn(r);if(gs(s,t)){r.selected=!0;return}}(!n||t!==void 0)&&(e.selectedIndex=-1)}function jt(e){var t=new MutationObserver(n=>{n.every(Ro)||("__defaultValue"in e&&No(e),"__value"in e&&Ot(e,e.__value))});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),aa(()=>{t.disconnect()})}function Da(e,t,n=t){var r=new WeakSet,s=!0;$r(e,"change",l=>{var o=l?"[selected]":":checked",c;if(e.multiple)c=[].map.call(e.querySelectorAll(o),yn);else{var i=e.querySelector(o)??e.querySelector("option:not([disabled])");c=i&&yn(i)}n(c),e.__value=c,ue!==null&&r.add(ue)}),xs(()=>{var l=t();if(e===document.activeElement){var o=ue;if(r.has(o))return}if(Ot(e,l,s),s&&l===void 0){var c=e.querySelector(":checked");c!==null&&(l=yn(c),n(l))}e.__value=l,s=!1})}function yn(e){return"__value"in e?e.__value:e.value}function Ro(e){if(e.target.closest("selectedcontent")!==null)return!0;if(e.type==="childList"){var t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(n=>n.nodeName==="SELECTEDCONTENT")}return!1}const Fo=Symbol("is custom element"),Uo=Symbol("is html"),Ho=_l?"progress":"PROGRESS";function qn(e,t){var n=ia(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==Ho)||(e.value=t??"")}function Ca(e,t){var n=ia(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function ge(e,t,n,r){var s=ia(e);s[t]!==(s[t]=n)&&(t==="loading"&&(e[pl]=n),n==null?e.removeAttribute(t):typeof n!="string"&&Yo(e).has(t)?e[t]=n:e.setAttribute(t,n))}function ia(e){return e[es]??={[Fo]:e.nodeName.includes("-"),[Uo]:e.namespaceURI===Al}}var ja=new Map;function Yo(e){var t=e.getAttribute("is")||e.nodeName,n=ja.get(t);if(n)return n;ja.set(t,n=new Set);for(var r,s=e,l=Element.prototype;l!==s;){r=ol(s);for(var o in r)r[o].set&&o!=="innerHTML"&&o!=="textContent"&&o!=="innerText"&&n.add(o);s=Ja(s)}return n}function tr(e,t,n=t){var r=new WeakSet;$r(e,"input",async s=>{var l=s?e.defaultValue:e.value;if(l=jr(e)?Mr(l):l,n(l),ue!==null&&r.add(ue),await go(),l!==(l=t())){var o=e.selectionStart,c=e.selectionEnd,i=e.value.length;if(e.value=l??"",c!==null){var v=e.value.length;o===c&&c===i&&v>i?(e.selectionStart=v,e.selectionEnd=v):(e.selectionStart=o,e.selectionEnd=Math.min(c,v))}}}),Jn(t)==null&&e.value&&(n(jr(e)?Mr(e.value):e.value),ue!==null&&r.add(ue)),yr(()=>{var s=t();if(e===document.activeElement){var l=ue;if(r.has(l))return}jr(e)&&s===Mr(e.value)||e.type==="date"&&!s&&!e.value||s!==e.value&&(e.value=s??"")})}function Zo(e,t,n=t){$r(e,"change",r=>{var s=r?e.defaultChecked:e.checked;n(s)}),Jn(t)==null&&n(e.checked),yr(()=>{var r=t();e.checked=!!r})}function jr(e){var t=e.type;return t==="number"||t==="range"}function Mr(e){return e===""?null:+e}function Pr(e,t){return e===t||e?.[sn]===t}function Is(e=Xr(),t,n,r){var s=Ge.r,l=de;return xs(()=>{var o,c;return yr(()=>{o=c,c=[],Jn(()=>{Pr(n(...c),e)||(t(e,...c),o&&Pr(n(...o),e)&&t(null,...o))})}),()=>{let i=l;for(;i!==s&&i.parent!==null&&i.parent.f&ir;)i=i.parent;const v=()=>{c&&Pr(n(...c),e)&&t(null,...c)},_=i.teardown;i.teardown=()=>{v(),_?.()}}}),e}function Ye(e,t,n,r){var s=!0,l=(n&xl)!==0,o=(n&Tl)!==0,c=r,i=!0,v=void 0,_=()=>o&&s?(v??=Hn(r),a(v)):(i&&(i=!1,c=o?Jn(r):r),c);let f;if(l){var d=sn in e||hl in e;f=wn(e,t)?.set??(d&&t in e?D=>e[t]=D:void 0)}var h,y=!1;l?[h,y]=Wl(()=>e[t]):h=e[t],h===void 0&&r!==void 0&&(h=_(),f&&(Nl(),f(h)));var Y;if(Y=()=>{var D=e[t];return D===void 0?_():(i=!0,D)},(n&kl)===0)return Y;if(f){var w=e.$$legacy;return(function(D,P){return arguments.length>0?((!P||w||y)&&f(P?Y():D),D):Y()})}var j=!1,F=((n&yl)!==0?Hn:cs)(()=>(j=!1,Y()));l&&a(F);var M=de;return(function(D,P){if(arguments.length>0){const I=P?a(F):l?Ze(D):D;return k(F,I),j=!0,c!==void 0&&(c=I),D}return Bt&&j||(M.f&nt)!==0?F.v:a(F)})}const Bo="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(Bo);const ca=["personal","project","foundation"],qs=["day","week","month","year","agenda"];function Ns(){const e=Wo().pathname;return e==="/"?"":e.replace(/\/+$/,"")}function Wo(){const e=globalThis.document?.baseURI;try{return new URL(e??"/",globalThis.location?.href??"http://localhost/")}catch{return new URL("http://localhost/")}}function Vt(e){const t=e.startsWith("/")?e:`/${e}`;return`${Ns()}${t}`||"/"}function $t(e){return Vt(`/api${e.startsWith("/")?e:`/${e}`}`)}function Vr(e){return Vt(`/${e.replace(/^\/+/,"")}`)}function Rs(e){const t=Ns();return t?e===t?"/":e.startsWith(`${t}/`)?e.slice(t.length)||"/":null:e||"/"}const Fs="/auth";function Us(e=Vt("/")){return`${Vt(Fs)}?login=${e}`}function Hs(e=Vt("/")){return`${Vt(Fs)}?logout=${e}`}class Dt extends Error{status;field;constructor(t,n,r=null){super(t),this.name="ApiError",this.status=n,this.field=r}get needsLogin(){return this.status===401}}async function St(e,t,n){const r=typeof FormData<"u"&&n instanceof FormData;let s;try{s=await fetch($t(t),{method:e,credentials:"same-origin",headers:{Accept:"application/json","X-No-Redirect":"1",...n===void 0||r?{}:{"Content-Type":"application/json"}},...n===void 0?{}:{body:r?n:JSON.stringify(n)}})}catch{throw new Dt("Could not reach the calendar service.",0)}if(s.status===204)return;const l=await s.text();let o=null;if(l)try{o=JSON.parse(l)}catch{o=null}if(!s.ok){const c=o??{};throw new Dt(c.error??`Request failed with status ${s.status}`,s.status,c.field??null)}return o}function Ma(e){const t=new URLSearchParams,n=s=>s instanceof Date?s.toISOString():s;e.start&&t.set("start",n(e.start)),e.end&&t.set("end",n(e.end));for(const s of e.categories??[])t.append("category",s);for(const s of e.projects??[])t.append("project",s);e.visibility&&e.visibility!=="all"&&t.set("visibility",e.visibility),e.owner&&t.set("owner",e.owner),e.q&&t.set("q",e.q),e.sort&&t.set("sort",e.sort),e.limit&&t.set("limit",String(e.limit));const r=t.toString();return r?`?${r}`:""}const ct={session:()=>St("GET","/session"),calendars:()=>St("GET","/calendars"),events:async(e={})=>(await St("GET",`/events${Ma(e)}`)).events,event:async e=>(await St("GET",`/events/${e}`)).event,byShortlink:async e=>(await St("GET",`/shortlink/${encodeURIComponent(e)}`)).event,create:async e=>(await St("POST","/events",e)).event,update:async(e,t)=>(await St("PUT",`/events/${e}`,t)).event,remove:e=>St("DELETE",`/events/${e}`),previewImport:e=>{const t=new FormData;return t.append("file",e),St("POST","/import/preview",t)},runImport:(e,t)=>{const n=new FormData;return n.append("file",e),n.append("category",t.category),t.visibility&&n.append("visibility",t.visibility),t.project&&n.append("project",t.project),St("POST","/import",n)},icsUrl:e=>$t(`/events/${e}.ics`),feedUrl:(e={})=>$t(`/events.ics${Ma(e)}`)},Vo=6e4,Go=60*Vo,kr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],fn=["January","February","March","April","May","June","July","August","September","October","November","December"],ua=1;function We(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function va(e){const t=We(e);return t.setDate(t.getDate()+1),t}function Yt(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n}function Ys(e,t){const n=new Date(e),r=n.getDate();n.setDate(1),n.setMonth(n.getMonth()+t);const s=Jo(n.getFullYear(),n.getMonth());return n.setDate(Math.min(r,s)),n}function Ko(e,t){return Ys(e,t*12)}function Jo(e,t){return new Date(e,t+1,0).getDate()}function fa(e,t=ua){const n=We(e),r=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-r),n}function Zs(e){const t=We(e);return t.setDate(1),t}function Bs(e){const t=Zs(e);return t.setMonth(0),t}function Xo(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Bn(e,t=new Date){return Xo(e,t)}function lr(e){const t=e.getDay();return t===0||t===6}function da(e,t=ua){const n=fa(Zs(e),t);return Array.from({length:42},(r,s)=>Yt(n,s))}function Ws(e,t=ua){const n=fa(e,t);return Array.from({length:7},(r,s)=>Yt(n,s))}function Qo(e){const t=Bs(e);return Array.from({length:12},(n,r)=>new Date(t.getFullYear(),r,1))}function $o(e,t){switch(e){case"day":return{start:We(t),end:va(t)};case"week":{const n=fa(t);return{start:n,end:Yt(n,7)}}case"year":{const n=Bs(t);return{start:n,end:new Date(n.getFullYear()+1,0,1)}}case"agenda":{const n=We(t);return{start:n,end:Yt(n,90)}}default:{const n=da(t);return{start:n[0],end:Yt(n[41],1)}}}}function ei(e,t,n){switch(e){case"day":return Yt(t,n);case"week":return Yt(t,7*n);case"year":return Ko(t,n);case"agenda":return Yt(t,30*n);default:return Ys(t,n)}}function kt(e){const t=String(e.getFullYear()).padStart(4,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function ti(e){const[t,n,r]=e.split("-").map(Number);return new Date(t,(n??1)-1,r??1)}function Ue(e){return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}function Be(e){return`${e.getDate()} ${fn[e.getMonth()]} ${e.getFullYear()}`}function Lr(e){return`${fn[e.getMonth()]} ${e.getFullYear()}`}function ni(e,t){switch(e){case"day":return Be(t);case"week":{const n=Ws(t),r=n[0],s=n[6];return r.getMonth()===s.getMonth()?`${r.getDate()} - ${s.getDate()} ${Lr(r)}`:r.getFullYear()===s.getFullYear()?`${r.getDate()} ${fn[r.getMonth()]} - ${s.getDate()} ${Lr(s)}`:`${Be(r)} - ${Be(s)}`}case"year":return String(t.getFullYear());case"agenda":return`From ${Be(t)}`;default:return Lr(t)}}function ri(e){return`${kt(e)}T${Ue(e)}`}function ai(e){return kt(e)}function _r(e){return new Date(e)}function Xt(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}const ft="local",Ke="UTC";function Mt(e){return e===ft}function tt(e){return Mt(e)?dn():e}function Gr(e){return-e.getTimezoneOffset()*6e4}const Pa=new Map;function si(e){let t=Pa.get(e);return t||(t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),Pa.set(e,t)),t}function gr(e,t){let n;try{n=si(t).formatToParts(e)}catch{return 0}const r=l=>Number(n.find(o=>o.type===l)?.value??0);return Date.UTC(r("year"),r("month")-1,r("day"),r("hour"),r("minute"),r("second"))-Math.floor(e.getTime()/1e3)*1e3}function _n(e,t){const n=e.getTime()+gr(e,t);let r=new Date(n-Gr(e));for(let s=0;s<2;s+=1){const l=new Date(n-Gr(r));if(l.getTime()===r.getTime())return r;r=l}return r}function Nn(e,t){const n=e.getTime()+Gr(e);let r=new Date(n-gr(e,t));for(let s=0;s<2;s+=1){const l=new Date(n-gr(r,t));if(l.getTime()===r.getTime())return r;r=l}return r}function en(e,t){return Mt(t)?new Date(e.getTime()):_n(e,t)}function Jt(e,t){return Mt(t)?new Date(e.getTime()):Nn(e,t)}function tn(e){return en(new Date,e)}function dn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||Ke}catch{return Ke}}function li(e){if(e===0)return Ke;const t=e<0?"-":"+",n=Math.abs(Math.round(e/6e4)),r=String(Math.floor(n/60)).padStart(2,"0"),s=String(n%60).padStart(2,"0");return`UTC${t}${r}:${s}`}function Vs(e,t){try{return new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"short"}).formatToParts(e).find(r=>r.type==="timeZoneName")?.value??t}catch{return t}}function Wn(e){if(e===Ke)return Ke;const t=e.split("/");return(t[t.length-1]??e).replace(/_/g," ")}function xt(e,t=new Date){const n=li(gr(t,e)),r=Vs(t,e);return e===Ke?Ke:r.startsWith("GMT")||r===n?`${Wn(e)} (${n})`:`${Wn(e)} (${r}, ${n})`}function An(e,t=new Date){const n=tt(e);return Mt(e)?`Local - ${xt(n,t)}`:xt(n,t)}function Xn(e,t=new Date){const n=tt(e);if(n===Ke)return Ke;const r=Vs(t,n);return r.startsWith("GMT")?Wn(n):r}function La(e,t=new Date){const n=tt(e);return Mt(e)?`Times are shown in ${n}, your browser's timezone (${xt(n,t)}).`:`Times are shown in ${n} (${xt(n,t)}).`}const ha=[{region:"Coordinated",zones:[Ke]},{region:"Americas",zones:["Pacific/Honolulu","America/Anchorage","America/Los_Angeles","America/Denver","America/Chicago","America/New_York","America/Halifax","America/Bogota","America/Sao_Paulo","America/Argentina/Buenos_Aires"]},{region:"Europe and Africa",zones:["Europe/London","Europe/Lisbon","Europe/Paris","Europe/Berlin","Europe/Madrid","Europe/Rome","Europe/Stockholm","Europe/Warsaw","Europe/Athens","Europe/Kyiv","Europe/Moscow","Africa/Casablanca","Africa/Lagos","Africa/Cairo","Africa/Nairobi","Africa/Johannesburg"]},{region:"Asia",zones:["Asia/Jerusalem","Asia/Dubai","Asia/Karachi","Asia/Kolkata","Asia/Kathmandu","Asia/Dhaka","Asia/Bangkok","Asia/Jakarta","Asia/Shanghai","Asia/Hong_Kong","Asia/Singapore","Asia/Seoul","Asia/Tokyo"]},{region:"Oceania",zones:["Australia/Perth","Australia/Adelaide","Australia/Brisbane","Australia/Sydney","Pacific/Auckland"]}];function Oa(){return ha.flatMap(e=>e.zones)}function Gs(e){if(!e||e===ft)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}function oi(){const e=Intl.supportedValuesOf;let t;try{t=e?e("timeZone"):Oa()}catch{t=Oa()}return[...new Set([Ke,dn(),...t])].sort()}function Rn(e,t=Ke){const n=(e??"").trim();return n?n.toLowerCase()===ft?ft:n.toLowerCase()==="utc"?Ke:Gs(n)?n:t:t}function Or(e,t){const n=new Set(t===void 0?[]:[tt(t)]),r=[];for(const s of e){const l=tt(s);n.has(l)||(n.add(l),r.push(s))}return r}function ii(e,t,n,r=24){return Array.from({length:r},(s,l)=>{const o=new Date(e);return o.setHours(l,0,0,0),Ue(en(Jt(o,t),n))})}function at(e,t="local"){const n=_r(e.start);return e.all_day?new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()):en(n,t)}function Qn(e,t="local"){const n=_r(e.end);return e.all_day?new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()):en(n,t)}function Ia(e){return Math.max(0,_r(e.end).getTime()-_r(e.start).getTime())}function ci(e,t,n,r="local"){return at(e,r)<n&&Qn(e,r)>t}function xr(e,t,n="local"){return ci(e,We(t),va(t),n)}function ui(e,t,n="local"){const r=new Map;for(const l of t)r.set(kt(l),[]);for(const l of e)for(const o of t)xr(l,o,n)&&r.get(kt(o)).push(l);const s=Tr(n);for(const l of r.values())l.sort(s);return r}function vi(e,t,n="local"){if(e.all_day!==t.all_day)return e.all_day?-1:1;const r=at(e,n).getTime()-at(t,n).getTime();if(r!==0)return r;const s=Ia(t)-Ia(e);return s!==0?s:e.title.localeCompare(t.title)}function Tr(e="local"){return(t,n)=>vi(t,n,e)}const fi=20/1440;function di(e,t,n="local"){const r=We(t).getTime(),s=va(t).getTime(),l=s-r,c=e.filter(f=>!f.all_day&&xr(f,t,n)).sort(Tr(n)).map(f=>{const d=Math.max(at(f,n).getTime(),r),h=Math.min(Qn(f,n).getTime(),s);return{event:f,top:(d-r)/l,height:Math.max((h-d)/l,fi),column:0,columns:1}});let i=[],v=-1/0;const _=()=>{if(i.length===0)return;const f=Math.max(...i.map(d=>d.column))+1;for(const d of i)d.columns=f;i=[],v=-1/0};for(const f of c){f.top>=v&&_();const d=new Set(i.filter(y=>y.top+y.height>f.top).map(y=>y.column));let h=0;for(;d.has(h);)h+=1;f.column=h,i.push(f),v=Math.max(v,f.top+f.height)}return _(),c}function hi(e,t,n="local"){return e.filter(r=>r.all_day&&xr(r,t,n)).sort(Tr(n))}function Ks(e,t="local"){const n=[],r=new Map;for(const s of e){const l=at(s,t),o=kt(l);let c=r.get(o);c||(c=[],r.set(o,c),n.push({key:o,date:We(l),events:c})),c.push(s)}return n}function Er(e){return e.category==="project"?e.project??"project":e.category==="foundation"?"foundation":"personal"}const qa=[8,28,48,96,150,176,200,220,256,286,310,335];function Js(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return qa[t%qa.length]}function jn(e){return e.category==="personal"?265:e.category==="foundation"?0:Js(e.project??"")}function pa(e){switch(e){case"personal":return"Personal";case"project":return"Project";case"foundation":return"Foundation"}}function Na(e){return{categories:new Set(ca),projects:new Set(e?.projects??[]),visibility:"all",search:"",sort:"start"}}function pi(e,t,n=[]){if(!t.categories.has(e.category))return!1;if(e.category==="project"){const s=e.project??"";if(n.includes(s)&&!t.projects.has(s))return!1}if(t.visibility!=="all"&&e.visibility!==t.visibility)return!1;const r=t.search.trim().toLowerCase();return!(r&&![e.title,e.description,e.location,e.project??""].join(" ").toLowerCase().includes(r))}function _i(e,t,n=[]){return e.filter(r=>pi(r,t,n))}function gi(e,t,n="local"){const r=[...e];switch(t){case"-start":r.sort((s,l)=>at(l,n).getTime()-at(s,n).getTime());break;case"title":r.sort((s,l)=>s.title.localeCompare(l.title));break;case"-title":r.sort((s,l)=>l.title.localeCompare(s.title));break;default:r.sort(Tr(n));break}return r}function mi(e,t){const n=new Set(t?.projects??[]);for(const r of e)r.category==="project"&&r.project&&n.add(r.project);return[...n].sort()}function Ra(e,t){const n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}const wi=Go;function Xs(e){const t=e?.can_create;return t?t.project.length>0?"project":t.personal?"personal":t.foundation?"foundation":null:null}function bi(e){return Xs(e)!==null}function yi(e,t,n){const r=Xs(t)??"personal",s=new Date(e);return s.getTime()===We(e).getTime()&&s.setHours(9,0,0,0),{title:"",category:r,visibility:r==="personal"?"private":"public",start:Xt(s),end:Xt(new Date(s.getTime()+wi)),all_day:!1,description:"",location:"",url:"",project:r==="project"?t?.can_create.project[0]??null:null,timezone:n??dn()}}function ki(e){return{title:e.title,category:e.category,visibility:e.visibility,start:e.start,end:e.end,all_day:e.all_day,description:e.description,location:e.location,url:e.url,project:e.project,timezone:e.timezone||"UTC"}}function xi(e,t){if(!t?.authenticated)return!1;switch(e.category){case"personal":return e.owner===t.uid;case"foundation":return t.is_member;case"project":{const n=e.project??"";return n?e.visibility==="private"?t.committees.includes(n):t.projects.includes(n):!1}}}var Ti=b("<option> </option>"),Ei=b("<optgroup></optgroup>"),Si=b('<div class="zones svelte-p7ai4p" role="group" aria-label="Display timezone"><button type="button"><span class="lead svelte-p7ai4p">Local</span> <span class="detail svelte-p7ai4p"> </span></button> <label><select aria-label="Show the calendar in another timezone" class="svelte-p7ai4p"></select> <span class="badge svelte-p7ai4p" aria-hidden="true"> </span></label></div>');function Ai(e,t){Je(t,!0);let n=ee(()=>new Date),r=ee(dn),s=ee(()=>xt(a(r),a(n)));function l(j){t.onalternate(j),t.onzone(j)}var o=Si(),c=p(o);let i;var v=u(p(c),2),_=N(v,!0),f=u(c,2);let d;var h=p(f);oe(h,21,()=>ha,j=>j.region,(j,F)=>{var M=Ei();oe(M,20,()=>a(F).zones,D=>D,(D,P)=>{var I=Ti(),Z=N(I,!0),L={};z(x=>{C(Z,x),L!==(L=P)&&(I.value=(I.__value=L)??"")},[()=>xt(P,a(n))]),g(D,I)}),z(()=>ge(M,"label",a(F).region)),g(j,M)});var y;jt(h);var Y=u(h,2),w=N(Y,!0);z((j,F,M,D,P,I)=>{i=Ie(c,1,"zone svelte-p7ai4p",null,i,{active:j}),ge(c,"aria-pressed",F),ge(c,"title",M),C(_,a(s)),d=Ie(f,1,"zone select svelte-p7ai4p",null,d,{active:D}),ge(f,"title",P),y!==(y=t.alternate)&&(h.value=(h.__value=y)??"",Ot(h,y)),C(w,I)},[()=>Mt(t.zone),()=>Mt(t.zone),()=>La(ft,a(n)),()=>!Mt(t.zone),()=>La(t.alternate,a(n)),()=>Xn(t.alternate,a(n))]),Q("click",c,()=>t.onzone(ft)),Q("change",h,j=>l(j.currentTarget.value)),Q("click",h,()=>{Mt(t.zone)&&t.onzone(t.alternate)}),g(e,o),Xe()}ot(["click","change"]);var zi=b('<span class="spinner svelte-oiwvqb" role="status" aria-label="Loading"></span>'),Di=b('<button type="button" role="tab"> </button>'),Ci=b('<button type="button" class="btn" title="Import events from an .ics file">Import</button> <button type="button" class="btn primary">New event</button>',1),ji=b('<span class="who svelte-oiwvqb"> </span> <a class="btn">Log out</a>',1),Mi=b('<a class="btn primary">Log in</a>'),Pi=b('<header class="svelte-oiwvqb"><div class="brand svelte-oiwvqb"><button type="button" class="filters-toggle svelte-oiwvqb" aria-label="Toggle filters">☰</button> <img alt="" width="28" height="28" class="svelte-oiwvqb"/> <h1 class="svelte-oiwvqb"> </h1></div> <div class="nav svelte-oiwvqb"><button type="button" class="btn">Today</button> <div class="stepper svelte-oiwvqb"><button type="button" class="btn svelte-oiwvqb" aria-label="Previous">‹</button> <button type="button" class="btn svelte-oiwvqb" aria-label="Next">›</button></div> <h2 aria-live="polite" class="svelte-oiwvqb"> </h2> <!></div> <div class="views svelte-oiwvqb" role="tablist" aria-label="Calendar view"></div> <!> <div class="account svelte-oiwvqb"><button type="button">Help</button> <button type="button" title="HTTP API documentation">API</button> <!> <!></div></header>');function Li(e,t){Je(t,!0);let n=ee(()=>ni(t.view,t.cursor));var r=Pi(),s=p(r),l=p(s),o=u(l,2),c=u(o,2),i=N(c,!0),v=u(s,2),_=p(v),f=u(_,2),d=p(f),h=u(d,2),y=u(f,2),Y=N(y,!0),w=u(y,2);{var j=A=>{var O=zi();g(A,O)};J(w,A=>{t.loading&&A(j)})}var F=u(v,2);oe(F,20,()=>qs,A=>A,(A,O)=>{var R=Di();let te;var G=N(R,!0);z(()=>{te=Ie(R,1,"view svelte-oiwvqb",null,te,{active:t.view===O}),ge(R,"aria-selected",t.view===O),C(G,O)}),Q("click",R,()=>t.onview(O)),g(A,R)});var M=u(F,2);Ai(M,{get zone(){return t.zone},get alternate(){return t.alternateZone},get onzone(){return t.onzone},get onalternate(){return t.onalternatezone}});var D=u(M,2),P=p(D);let I;var Z=u(P,2);let L;var x=u(Z,2);{var T=A=>{var O=Ci(),R=vn(O),te=u(R,2);Q("click",R,function(...G){t.onimport?.apply(this,G)}),Q("click",te,function(...G){t.oncreate?.apply(this,G)}),g(A,O)};J(x,A=>{t.canCreate&&A(T)})}var U=u(x,2);{var V=A=>{var O=ji(),R=vn(O),te=N(R,!0),G=u(R,2);z(le=>{ge(R,"title",t.session.email??""),C(te,t.session.fullname||t.session.uid),ge(G,"href",le)},[()=>t.session.logout_url??Hs()]),g(A,O)},S=A=>{var O=Mi();z(R=>ge(O,"href",R),[()=>t.session?.login_url??Us()]),g(A,O)};J(U,A=>{t.session?.authenticated?A(V):A(S,-1)})}z(A=>{ge(o,"src",A),C(i,t.title),C(Y,a(n)),I=Ie(P,1,"btn svelte-oiwvqb",null,I,{active:t.helpOpen}),L=Ie(Z,1,"btn svelte-oiwvqb",null,L,{active:t.docsOpen})},[()=>Vr("icon.png")]),Q("click",l,function(...A){t.ontogglefilters?.apply(this,A)}),Q("click",_,function(...A){t.ontoday?.apply(this,A)}),Q("click",d,()=>t.onstep(-1)),Q("click",h,()=>t.onstep(1)),Q("click",P,function(...A){t.onhelp?.apply(this,A)}),Q("click",Z,function(...A){t.ondocs?.apply(this,A)}),g(e,r),Xe()}ot(["click"]);var Oi=b('<label class="check svelte-x10slk"><input type="checkbox"/> <span class="swatch svelte-x10slk"></span> </label>'),Ii=b('<span class="role svelte-x10slk" title="You are on this committee">PMC</span>'),qi=b('<label class="check svelte-x10slk"><input type="checkbox"/> <span class="swatch svelte-x10slk"></span> <!></label>'),Ni=b('<section class="svelte-x10slk"><h3 class="svelte-x10slk">Projects <span class="bulk svelte-x10slk"><button type="button" class="svelte-x10slk">all</button> <button type="button" class="svelte-x10slk">none</button></span></h3> <div class="projects svelte-x10slk"></div></section>'),Ri=b('<section class="svelte-x10slk"><h3 class="svelte-x10slk">Sort</h3> <label class="field svelte-x10slk"><select class="svelte-x10slk"><option>Soonest first</option><option>Latest first</option><option>Title A-Z</option><option>Title Z-A</option></select></label></section>'),Fi=b('<li class="svelte-x10slk"><span class="svelte-x10slk"> </span> <button type="button" class="svelte-x10slk">×</button></li>'),Ui=b('<ul class="chips svelte-x10slk"></ul>'),Fa=b("<option> </option>"),Hi=b("<optgroup></optgroup>"),Yi=b('<label class="field svelte-x10slk"><span class="visually-hidden">Also show another timezone</span> <select class="svelte-x10slk"><option>Also show...</option><!><!></select></label>'),Zi=b(`<aside class="svelte-x10slk"><label class="search svelte-x10slk"><span class="visually-hidden">Search events</span> <input type="search" placeholder="Search events..." class="svelte-x10slk"/></label> <section class="svelte-x10slk"><h3 class="svelte-x10slk">Calendars</h3> <!></section> <!> <section class="svelte-x10slk"><h3 class="svelte-x10slk">Visibility</h3> <label class="field svelte-x10slk"><select class="svelte-x10slk"><option>Everything I can see</option><option>Public only</option><option>Private only</option></select></label></section> <!> <section class="timezones svelte-x10slk"><h3 class="svelte-x10slk">Timezones</h3> <p class="muted svelte-x10slk">Drawn in <strong> </strong>, which you can change at the top of the page.</p> <!> <!> <p class="muted small svelte-x10slk">Comparison clocks appear beside the week and day grids, on agenda rows, and in an event's - details.</p></section> <section class="subscribe svelte-x10slk"><h3 class="svelte-x10slk">Subscribe</h3> <p class="muted svelte-x10slk">Add the events you can see to your own calendar application with this iCalendar feed.</p> <a class="btn">Download .ics</a></section></aside>`);function Bi(e,t){Je(t,!0);let n=Ye(t,"maxCompareZones",3,3);function r(q){t.onchange({...t.filters,categories:Ra(t.filters.categories,q)})}function s(q){t.onchange({...t.filters,projects:Ra(t.filters.projects,q)})}function l(q){t.onchange({...t.filters,projects:new Set(q?t.projects:[])})}let o=ee(()=>new Date),c=ee(()=>new Set([tt(t.zone),...t.compareZones.map(tt)])),i=ee(()=>t.compareZones.length<n());function v(q){!q||a(c).has(tt(q))||t.oncomparezones([...t.compareZones,q])}function _(q){t.oncomparezones(t.compareZones.filter(X=>X!==q))}var f=Zi(),d=p(f),h=u(p(d),2),y=u(d,2),B=u(p(y),2);oe(B,16,()=>ca,q=>q,(q,X)=>{var ie=Oi(),ve=p(ie),we=u(ve,2),xe=u(we);z((ye,K)=>{Ca(ve,ye),Bt(we,`--hue: ${X==="personal"?265:X==="foundation"?0:210}`),C(xe,` ${K??""}`)},[()=>t.filters.categories.has(X),()=>pa(X)]),Q("change",ve,()=>r(X)),g(q,ie)});var w=u(y,2);{var j=q=>{var X=Ni(),ie=p(X),ve=u(p(ie)),we=p(ve),xe=u(we,2),ye=u(ie,2);oe(ye,20,()=>t.projects,K=>K,(K,m)=>{var Y=qi(),se=p(Y),fe=u(se,2),ke=u(fe),Ne=u(ke);{var He=Re=>{var st=Ii();g(Re,st)},je=ee(()=>t.calendars?.committees.includes(m));J(Ne,Re=>{a(je)&&Re(He)})}z((Re,st)=>{Ca(se,Re),Bt(fe,`--hue: ${st??""}`),C(ke,` ${m??""} `)},[()=>t.filters.projects.has(m),()=>Js(m)]),Q("change",se,()=>s(m)),g(K,Y)}),Q("click",we,()=>l(!0)),Q("click",xe,()=>l(!1)),g(q,X)};J(w,q=>{t.projects.length>0&&q(j)})}var F=u(w,2),M=u(p(F),2),D=p(M),P=p(D);P.value=P.__value="all";var I=u(P);I.value=I.__value="public";var W=u(I);W.value=W.__value="private";var L;jt(D);var x=u(F,2);{var T=q=>{var X=Ri(),ie=u(p(X),2),ve=p(ie),we=p(ve);we.value=we.__value="start";var xe=u(we);xe.value=xe.__value="-start";var ye=u(xe);ye.value=ye.__value="title";var K=u(ye);K.value=K.__value="-title";var m;jt(ve),z(()=>{m!==(m=t.filters.sort)&&(ve.value=(ve.__value=m)??"",Ot(ve,m))}),Q("change",ve,Y=>t.onchange({...t.filters,sort:Y.currentTarget.value})),g(q,X)};J(x,q=>{t.view==="agenda"&&q(T)})}var U=u(x,2),V=u(p(U),2),S=u(p(V)),A=N(S,!0),O=u(V,2);{var R=q=>{var X=Ui();oe(X,20,()=>t.compareZones,ie=>ie,(ie,ve)=>{var we=Fi(),xe=p(we),ye=N(xe,!0),K=u(xe,2);z((m,Y,se)=>{ge(xe,"title",m),C(ye,Y),ge(K,"aria-label",se)},[()=>xt(tt(ve),a(o)),()=>An(ve,a(o)),()=>`Stop showing ${tt(ve)}`]),Q("click",K,()=>_(ve)),g(ie,we)}),g(q,X)};J(O,q=>{t.compareZones.length>0&&q(R)})}var te=u(O,2);{var G=q=>{var X=Yi(),ie=u(p(X),2),ve=p(ie);ve.value=ve.__value="";var we=u(ve);{var xe=m=>{var Y=Fa(),se=N(Y),fe={};z(ke=>{C(se,`Local - ${ke??""}`),fe!==(fe=ft)&&(Y.value=(Y.__value=fe)??"")},[()=>xt(fn(),a(o))]),g(m,Y)},ye=ee(()=>!a(c).has(fn()));J(we,m=>{a(ye)&&m(xe)})}var K=u(we);oe(K,17,()=>ha,m=>m.region,(m,Y)=>{var se=Hi();oe(se,20,()=>a(Y).zones.filter(fe=>!a(c).has(fe)),fe=>fe,(fe,ke)=>{var Ne=Fa(),He=N(Ne,!0),je={};z(Re=>{C(He,Re),je!==(je=ke)&&(Ne.value=(Ne.__value=je)??"")},[()=>xt(ke,a(o))]),g(fe,Ne)}),z(()=>ge(se,"label",a(Y).region)),g(m,se)}),ie.value=ie.__value="",Q("change",ie,m=>{v(m.currentTarget.value),m.currentTarget.value=""}),g(q,X)};J(te,q=>{a(i)&&q(G)})}var le=u(U,2),ae=u(p(le),4);z(q=>{qn(h,t.filters.search),L!==(L=t.filters.visibility)&&(D.value=(D.__value=L)??"",Ot(D,L)),C(A,q),ge(ae,"href",t.feedUrl)},[()=>An(t.zone,a(o))]),Q("input",h,q=>t.onchange({...t.filters,search:q.currentTarget.value})),Q("change",D,q=>t.onchange({...t.filters,visibility:q.currentTarget.value})),g(e,f),Xe()}ot(["input","change","click"]);var Wi=b('<span class="time svelte-9ackhu"> </span>'),Vi=b('<span class="lock svelte-9ackhu" aria-label="Private event">🔒</span>'),Gi=b('<button type="button"><!> <span class="title svelte-9ackhu"> </span> <!></button>');function Qs(e,t){Je(t,!0);let n=Ye(t,"variant",3,"chip"),r=Ye(t,"showTime",3,!0),s=Ye(t,"zone",3,"local"),l=ee(()=>jn(t.event)),o=ee(()=>t.event.all_day?"All day":Ue(at(t.event,s()))),c=ee(()=>Er(t.event));var i=Gi();let v;var _=p(i);{var f=w=>{var j=Wi(),F=N(j,!0);z(()=>C(F,a(o))),g(w,j)};J(_,w=>{r()&&w(f)})}var d=u(_,2),h=N(d,!0),y=u(d,2);{var B=w=>{var j=Vi();g(w,j)};J(y,w=>{t.event.visibility==="private"&&w(B)})}z(()=>{v=Ie(i,1,`chip ${n()??""}`,"svelte-9ackhu",v,{private:t.event.visibility==="private"}),Bt(i,`--hue: ${a(l)??""}`),ge(i,"title",`${t.event.title??""} - ${a(c)??""}${t.event.location?` - ${t.event.location}`:""}`),C(h,t.event.title)}),Q("click",i,w=>{w.stopPropagation(),t.onselect(t.event)}),g(e,i),Xe()}ot(["click"]);var Ki=b('<div class="weekday svelte-9032xz" role="columnheader"> </div>'),Ji=b('<span class="monthname svelte-9032xz"> </span>'),Xi=b('<button type="button" class="more svelte-9032xz"> </button>'),Qi=b('<div><button type="button" class="daynumber svelte-9032xz"><!> </button> <div class="events svelte-9032xz"><!> <!></div></div>'),$i=b('<div class="month svelte-9032xz"><div class="weekdays svelte-9032xz" role="row"></div> <div class="grid svelte-9032xz"></div></div>');function ec(e,t){Je(t,!0);let n=Ye(t,"zone",3,"local"),r=ee(()=>en(n()));const s=3;let l=ee(()=>da(t.cursor)),o=ee(()=>ui(t.events,a(l),n())),c=ee(()=>t.cursor.getMonth());var i=$i(),v=p(i);oe(v,20,()=>kr,f=>f,(f,d)=>{var h=Ki(),y=N(h,!0);z(()=>C(y,d)),g(f,h)});var _=u(v,2);oe(_,21,()=>a(l),f=>kt(f),(f,d)=>{const h=ee(()=>kt(a(d))),y=ee(()=>a(o).get(a(h))??[]);var B=Qi();let w;var j=p(B),F=p(j);{var M=T=>{var U=Ji(),V=N(U,!0);z(S=>C(V,S),[()=>vn[a(d).getMonth()].slice(0,3)]),g(T,U)},D=ee(()=>a(d).getDate()===1);J(F,T=>{a(D)&&T(M)})}var P=u(F),I=u(j,2),W=p(I);oe(W,17,()=>a(y).slice(0,s),T=>T.id,(T,U)=>{Qs(T,{get event(){return a(U)},get zone(){return n()},get onselect(){return t.onselect}})});var L=u(W,2);{var x=T=>{var U=Xi(),V=N(U);z(()=>C(V,`+${a(y).length-s} more`)),Q("click",U,()=>t.onpickday(a(d))),g(T,U)};J(L,T=>{a(y).length>s&&T(x)})}z((T,U,V,S)=>{w=Ie(B,1,"cell svelte-9032xz",null,w,{"other-month":T,weekend:U,today:V}),C(P,` ${S??""}`)},[()=>a(d).getMonth()!==a(c),()=>lr(a(d)),()=>Bn(a(d),a(r)),()=>a(d).getDate()]),Q("click",j,()=>t.onpickday(a(d))),g(f,B)}),g(e,i),Xe()}ot(["click"]);var tc=b('<div class="gutter zonehead svelte-5umrtz"> </div>'),nc=b('<span class="badge svelte-5umrtz"> </span>'),rc=b('<button type="button"><span class="dow svelte-5umrtz"> </span> <span class="dom svelte-5umrtz"> </span> <!></button>'),ac=b('<div class="gutter svelte-5umrtz"><span> </span></div>'),Ua=b("<div></div>"),sc=b('<div class="allday svelte-5umrtz"><!> <!></div>'),lc=b('<div class="hour svelte-5umrtz"><span class="svelte-5umrtz"> </span></div>'),oc=b('<div class="slot svelte-5umrtz"></div>'),ic=b('<button type="button"><span class="timed-time svelte-5umrtz"> </span> <span class="timed-title svelte-5umrtz"> </span></button>'),cc=b("<div><!> <!></div>"),uc=b('<div><div class="headers svelte-5umrtz"><!> <!></div> <!> <div class="scroll svelte-5umrtz"><div class="body svelte-5umrtz"><!> <!></div></div></div>');function Ha(e,t){Je(t,!0);let n=Ye(t,"days",3,7),r=Ye(t,"zone",3,"local"),s=Ye(t,"compareZones",19,()=>[]);const l=Array.from({length:24},(L,x)=>x);let o=ee(()=>en(r())),c=ee(()=>n()===1?[new Date(t.cursor)]:Ws(t.cursor)),i=ee(()=>a(c).map(L=>hi(t.events,L,r()))),v=ee(()=>a(i).some(L=>L.length>0)),_=ee(()=>a(c).map(L=>di(t.events,L,r()))),f=ee(()=>[...s(),r()]),d=ee(()=>a(f).map(L=>L===r()?l.map(x=>`${String(x).padStart(2,"0")}:00`):ii(a(c)[0],r(),L)));var h=uc();let y;var B=p(h),w=p(B);oe(w,17,()=>a(f),mn,(L,x)=>{var T=tc(),U=N(T,!0);z((V,S)=>{ge(T,"title",V),C(U,S)},[()=>xt(tt(a(x))),()=>Xn(a(x))]),g(L,T)});var j=u(w,2);oe(j,19,()=>a(c),L=>kt(L),(L,x,T)=>{var U=rc();let V;var S=p(U),A=N(S,!0),O=u(S,2),R=N(O,!0),te=u(O,2);{var G=le=>{var ae=nc(),q=N(ae,!0);z(()=>C(q,a(i)[a(T)].length)),g(le,ae)};J(te,le=>{a(i)[a(T)].length>0&&le(G)})}z((le,ae,q,X)=>{V=Ie(U,1,"dayhead svelte-5umrtz",null,V,{today:le,weekend:ae}),C(A,q),C(R,X)},[()=>Bn(a(x),a(o)),()=>lr(a(x)),()=>kr[(a(x).getDay()+6)%7],()=>a(x).getDate()]),Q("click",U,()=>t.onpickday(a(x))),g(L,U)});var F=u(B,2);{var M=L=>{var x=sc(),T=p(x);oe(T,17,()=>a(f),mn,(V,S,A)=>{var O=ac(),R=p(O),te=N(R,!0);z(()=>C(te,A===a(f).length-1?"All day":"")),g(V,O)});var U=u(T,2);oe(U,19,()=>a(c),V=>kt(V),(V,S,A)=>{var O=Ua();let R;oe(O,21,()=>a(i)[a(A)],te=>te.id,(te,G)=>{Qs(te,{get event(){return a(G)},get zone(){return r()},get onselect(){return t.onselect},showTime:!1})}),z(te=>R=Ie(O,1,"allday-cell svelte-5umrtz",null,R,{weekend:te}),[()=>lr(a(S))]),g(V,O)}),g(L,x)};J(F,L=>{a(v)&&L(M)})}var D=u(F,2),P=p(D),I=p(P);oe(I,17,()=>a(f),mn,(L,x,T)=>{var U=Ua();let V;oe(U,21,()=>a(d)[T],mn,(S,A)=>{var O=lc(),R=p(O),te=N(R,!0);z(()=>C(te,a(A))),g(S,O)}),z(()=>V=Ie(U,1,"gutter hours svelte-5umrtz",null,V,{secondary:T<a(f).length-1})),g(L,U)});var W=u(I,2);oe(W,19,()=>a(c),L=>kt(L),(L,x,T)=>{var U=cc();let V;var S=p(U);oe(S,16,()=>l,O=>O,(O,R)=>{var te=oc();g(O,te)});var A=u(S,2);oe(A,17,()=>a(_)[a(T)],O=>O.event.id,(O,R)=>{var te=ic();let G;var le=p(te),ae=N(le,!0),q=u(le,2),X=N(q,!0);z((ie,ve)=>{G=Ie(te,1,"timed svelte-5umrtz",null,G,{private:a(R).event.visibility==="private"}),Bt(te,`--hue: ${ie??""}; + details.</p></section> <section class="subscribe svelte-x10slk"><h3 class="svelte-x10slk">Subscribe</h3> <p class="muted svelte-x10slk">Add the events you can see to your own calendar application with this iCalendar feed.</p> <a class="btn">Download .ics</a></section></aside>`);function Bi(e,t){Je(t,!0);let n=Ye(t,"maxCompareZones",3,3);function r(q){t.onchange({...t.filters,categories:Ra(t.filters.categories,q)})}function s(q){t.onchange({...t.filters,projects:Ra(t.filters.projects,q)})}function l(q){t.onchange({...t.filters,projects:new Set(q?t.projects:[])})}let o=ee(()=>new Date),c=ee(()=>new Set([tt(t.zone),...t.compareZones.map(tt)])),i=ee(()=>t.compareZones.length<n());function v(q){!q||a(c).has(tt(q))||t.oncomparezones([...t.compareZones,q])}function _(q){t.oncomparezones(t.compareZones.filter(X=>X!==q))}var f=Zi(),d=p(f),h=u(p(d),2),y=u(d,2),Y=u(p(y),2);oe(Y,16,()=>ca,q=>q,(q,X)=>{var ie=Oi(),ve=p(ie),we=u(ve,2),xe=u(we);z((ye,K)=>{Ca(ve,ye),Wt(we,`--hue: ${X==="personal"?265:X==="foundation"?0:210}`),C(xe,` ${K??""}`)},[()=>t.filters.categories.has(X),()=>pa(X)]),Q("change",ve,()=>r(X)),g(q,ie)});var w=u(y,2);{var j=q=>{var X=Ni(),ie=p(X),ve=u(p(ie)),we=p(ve),xe=u(we,2),ye=u(ie,2);oe(ye,20,()=>t.projects,K=>K,(K,m)=>{var H=qi(),se=p(H),fe=u(se,2),ke=u(fe),Ne=u(ke);{var He=Re=>{var st=Ii();g(Re,st)},je=ee(()=>t.calendars?.committees.includes(m));J(Ne,Re=>{a(je)&&Re(He)})}z((Re,st)=>{Ca(se,Re),Wt(fe,`--hue: ${st??""}`),C(ke,` ${m??""} `)},[()=>t.filters.projects.has(m),()=>Js(m)]),Q("change",se,()=>s(m)),g(K,H)}),Q("click",we,()=>l(!0)),Q("click",xe,()=>l(!1)),g(q,X)};J(w,q=>{t.projects.length>0&&q(j)})}var F=u(w,2),M=u(p(F),2),D=p(M),P=p(D);P.value=P.__value="all";var I=u(P);I.value=I.__value="public";var Z=u(I);Z.value=Z.__value="private";var L;jt(D);var x=u(F,2);{var T=q=>{var X=Ri(),ie=u(p(X),2),ve=p(ie),we=p(ve);we.value=we.__value="start";var xe=u(we);xe.value=xe.__value="-start";var ye=u(xe);ye.value=ye.__value="title";var K=u(ye);K.value=K.__value="-title";var m;jt(ve),z(()=>{m!==(m=t.filters.sort)&&(ve.value=(ve.__value=m)??"",Ot(ve,m))}),Q("change",ve,H=>t.onchange({...t.filters,sort:H.currentTarget.value})),g(q,X)};J(x,q=>{t.view==="agenda"&&q(T)})}var U=u(x,2),V=u(p(U),2),S=u(p(V)),A=N(S,!0),O=u(V,2);{var R=q=>{var X=Ui();oe(X,20,()=>t.compareZones,ie=>ie,(ie,ve)=>{var we=Fi(),xe=p(we),ye=N(xe,!0),K=u(xe,2);z((m,H,se)=>{ge(xe,"title",m),C(ye,H),ge(K,"aria-label",se)},[()=>xt(tt(ve),a(o)),()=>An(ve,a(o)),()=>`Stop showing ${tt(ve)}`]),Q("click",K,()=>_(ve)),g(ie,we)}),g(q,X)};J(O,q=>{t.compareZones.length>0&&q(R)})}var te=u(O,2);{var G=q=>{var X=Yi(),ie=u(p(X),2),ve=p(ie);ve.value=ve.__value="";var we=u(ve);{var xe=m=>{var H=Fa(),se=N(H),fe={};z(ke=>{C(se,`Local - ${ke??""}`),fe!==(fe=ft)&&(H.value=(H.__value=fe)??"")},[()=>xt(dn(),a(o))]),g(m,H)},ye=ee(()=>!a(c).has(dn()));J(we,m=>{a(ye)&&m(xe)})}var K=u(we);oe(K,17,()=>ha,m=>m.region,(m,H)=>{var se=Hi();oe(se,20,()=>a(H).zones.filter(fe=>!a(c).has(fe)),fe=>fe,(fe,ke)=>{var Ne=Fa(),He=N(Ne,!0),je={};z(Re=>{C(He,Re),je!==(je=ke)&&(Ne.value=(Ne.__value=je)??"")},[()=>xt(ke,a(o))]),g(fe,Ne)}),z(()=>ge(se,"label",a(H).region)),g(m,se)}),ie.value=ie.__value="",Q("change",ie,m=>{v(m.currentTarget.value),m.currentTarget.value=""}),g(q,X)};J(te,q=>{a(i)&&q(G)})}var le=u(U,2),ae=u(p(le),4);z(q=>{qn(h,t.filters.search),L!==(L=t.filters.visibility)&&(D.value=(D.__value=L)??"",Ot(D,L)),C(A,q),ge(ae,"href",t.feedUrl)},[()=>An(t.zone,a(o))]),Q("input",h,q=>t.onchange({...t.filters,search:q.currentTarget.value})),Q("change",D,q=>t.onchange({...t.filters,visibility:q.currentTarget.value})),g(e,f),Xe()}ot(["input","change","click"]);var Wi=b('<span class="time svelte-9ackhu"> </span>'),Vi=b('<span class="lock svelte-9ackhu" aria-label="Private event">🔒</span>'),Gi=b('<button type="button"><!> <span class="title svelte-9ackhu"> </span> <!></button>');function Qs(e,t){Je(t,!0);let n=Ye(t,"variant",3,"chip"),r=Ye(t,"showTime",3,!0),s=Ye(t,"zone",3,"local"),l=ee(()=>jn(t.event)),o=ee(()=>t.event.all_day?"All day":Ue(at(t.event,s()))),c=ee(()=>Er(t.event));var i=Gi();let v;var _=p(i);{var f=w=>{var j=Wi(),F=N(j,!0);z(()=>C(F,a(o))),g(w,j)};J(_,w=>{r()&&w(f)})}var d=u(_,2),h=N(d,!0),y=u(d,2);{var Y=w=>{var j=Vi();g(w,j)};J(y,w=>{t.event.visibility==="private"&&w(Y)})}z(()=>{v=Ie(i,1,`chip ${n()??""}`,"svelte-9ackhu",v,{private:t.event.visibility==="private"}),Wt(i,`--hue: ${a(l)??""}`),ge(i,"title",`${t.event.title??""} - ${a(c)??""}${t.event.location?` - ${t.event.location}`:""}`),C(h,t.event.title)}),Q("click",i,w=>{w.stopPropagation(),t.onselect(t.event)}),g(e,i),Xe()}ot(["click"]);var Ki=b('<div class="weekday svelte-9032xz" role="columnheader"> </div>'),Ji=b('<span class="monthname svelte-9032xz"> </span>'),Xi=b('<button type="button" class="more svelte-9032xz"> </button>'),Qi=b('<div><button type="button" class="daynumber svelte-9032xz"><!> </button> <div class="events svelte-9032xz"><!> <!></div></div>'),$i=b('<div class="month svelte-9032xz"><div class="weekdays svelte-9032xz" role="row"></div> <div class="grid svelte-9032xz"></div></div>');function ec(e,t){Je(t,!0);let n=Ye(t,"zone",3,"local"),r=ee(()=>tn(n()));const s=3;let l=ee(()=>da(t.cursor)),o=ee(()=>ui(t.events,a(l),n())),c=ee(()=>t.cursor.getMonth());var i=$i(),v=p(i);oe(v,20,()=>kr,f=>f,(f,d)=>{var h=Ki(),y=N(h,!0);z(()=>C(y,d)),g(f,h)});var _=u(v,2);oe(_,21,()=>a(l),f=>kt(f),(f,d)=>{const h=ee(()=>kt(a(d))),y=ee(()=>a(o).get(a(h))??[]);var Y=Qi();let w;var j=p(Y),F=p(j);{var M=T=>{var U=Ji(),V=N(U,!0);z(S=>C(V,S),[()=>fn[a(d).getMonth()].slice(0,3)]),g(T,U)},D=ee(()=>a(d).getDate()===1);J(F,T=>{a(D)&&T(M)})}var P=u(F),I=u(j,2),Z=p(I);oe(Z,17,()=>a(y).slice(0,s),T=>T.id,(T,U)=>{Qs(T,{get event(){return a(U)},get zone(){return n()},get onselect(){return t.onselect}})});var L=u(Z,2);{var x=T=>{var U=Xi(),V=N(U);z(()=>C(V,`+${a(y).length-s} more`)),Q("click",U,()=>t.onpickday(a(d))),g(T,U)};J(L,T=>{a(y).length>s&&T(x)})}z((T,U,V,S)=>{w=Ie(Y,1,"cell svelte-9032xz",null,w,{"other-month":T,weekend:U,today:V}),C(P,` ${S??""}`)},[()=>a(d).getMonth()!==a(c),()=>lr(a(d)),()=>Bn(a(d),a(r)),()=>a(d).getDate()]),Q("click",j,()=>t.onpickday(a(d))),g(f,Y)}),g(e,i),Xe()}ot(["click"]);var tc=b('<div class="gutter zonehead svelte-5umrtz"> </div>'),nc=b('<span class="badge svelte-5umrtz"> </span>'),rc=b('<button type="button"><span class="dow svelte-5umrtz"> </span> <span class="dom svelte-5umrtz"> </span> <!></button>'),ac=b('<div class="gutter svelte-5umrtz"><span> </span></div>'),Ua=b("<div></div>"),sc=b('<div class="allday svelte-5umrtz"><!> <!></div>'),lc=b('<div class="hour svelte-5umrtz"><span class="svelte-5umrtz"> </span></div>'),oc=b('<div class="slot svelte-5umrtz"></div>'),ic=b('<button type="button"><span class="timed-time svelte-5umrtz"> </span> <span class="timed-title svelte-5umrtz"> </span></button>'),cc=b("<div><!> <!></div>"),uc=b('<div><div class="headers svelte-5umrtz"><!> <!></div> <!> <div class="scroll svelte-5umrtz"><div class="body svelte-5umrtz"><!> <!></div></div></div>');function Ha(e,t){Je(t,!0);let n=Ye(t,"days",3,7),r=Ye(t,"zone",3,"local"),s=Ye(t,"compareZones",19,()=>[]);const l=Array.from({length:24},(L,x)=>x);let o=ee(()=>tn(r())),c=ee(()=>n()===1?[new Date(t.cursor)]:Ws(t.cursor)),i=ee(()=>a(c).map(L=>hi(t.events,L,r()))),v=ee(()=>a(i).some(L=>L.length>0)),_=ee(()=>a(c).map(L=>di(t.events,L,r()))),f=ee(()=>[...s(),r()]),d=ee(()=>a(f).map(L=>L===r()?l.map(x=>`${String(x).padStart(2,"0")}:00`):ii(a(c)[0],r(),L)));var h=uc();let y;var Y=p(h),w=p(Y);oe(w,17,()=>a(f),Ut,(L,x)=>{var T=tc(),U=N(T,!0);z((V,S)=>{ge(T,"title",V),C(U,S)},[()=>xt(tt(a(x))),()=>Xn(a(x))]),g(L,T)});var j=u(w,2);oe(j,19,()=>a(c),L=>kt(L),(L,x,T)=>{var U=rc();let V;var S=p(U),A=N(S,!0),O=u(S,2),R=N(O,!0),te=u(O,2);{var G=le=>{var ae=nc(),q=N(ae,!0);z(()=>C(q,a(i)[a(T)].length)),g(le,ae)};J(te,le=>{a(i)[a(T)].length>0&&le(G)})}z((le,ae,q,X)=>{V=Ie(U,1,"dayhead svelte-5umrtz",null,V,{today:le,weekend:ae}),C(A,q),C(R,X)},[()=>Bn(a(x),a(o)),()=>lr(a(x)),()=>kr[(a(x).getDay()+6)%7],()=>a(x).getDate()]),Q("click",U,()=>t.onpickday(a(x))),g(L,U)});var F=u(Y,2);{var M=L=>{var x=sc(),T=p(x);oe(T,17,()=>a(f),Ut,(V,S,A)=>{var O=ac(),R=p(O),te=N(R,!0);z(()=>C(te,A===a(f).length-1?"All day":"")),g(V,O)});var U=u(T,2);oe(U,19,()=>a(c),V=>kt(V),(V,S,A)=>{var O=Ua();let R;oe(O,21,()=>a(i)[a(A)],te=>te.id,(te,G)=>{Qs(te,{get event(){return a(G)},get zone(){return r()},get onselect(){return t.onselect},showTime:!1})}),z(te=>R=Ie(O,1,"allday-cell svelte-5umrtz",null,R,{weekend:te}),[()=>lr(a(S))]),g(V,O)}),g(L,x)};J(F,L=>{a(v)&&L(M)})}var D=u(F,2),P=p(D),I=p(P);oe(I,17,()=>a(f),Ut,(L,x,T)=>{var U=Ua();let V;oe(U,21,()=>a(d)[T],Ut,(S,A)=>{var O=lc(),R=p(O),te=N(R,!0);z(()=>C(te,a(A))),g(S,O)}),z(()=>V=Ie(U,1,"gutter hours svelte-5umrtz",null,V,{secondary:T<a(f).length-1})),g(L,U)});var Z=u(I,2);oe(Z,19,()=>a(c),L=>kt(L),(L,x,T)=>{var U=cc();let V;var S=p(U);oe(S,16,()=>l,O=>O,(O,R)=>{var te=oc();g(O,te)});var A=u(S,2);oe(A,17,()=>a(_)[a(T)],O=>O.event.id,(O,R)=>{var te=ic();let G;var le=p(te),ae=N(le,!0),q=u(le,2),X=N(q,!0);z((ie,ve)=>{G=Ie(te,1,"timed svelte-5umrtz",null,G,{private:a(R).event.visibility==="private"}),Wt(te,`--hue: ${ie??""}; top: ${a(R).top*100}%; height: ${a(R).height*100}%; left: calc(${a(R).column/a(R).columns*100}% + 2px); - width: calc(${1/a(R).columns*100}% - 4px);`),ge(te,"title",a(R).event.title),C(ae,ve),C(X,a(R).event.title)},[()=>jn(a(R).event),()=>Ue(at(a(R).event,r()))]),Q("click",te,()=>t.onselect(a(R).event)),g(O,te)}),z((O,R)=>V=Ie(U,1,"daycol svelte-5umrtz",null,V,{weekend:O,today:R}),[()=>lr(a(x)),()=>Bn(a(x),a(o))]),g(L,U)}),z(()=>{y=Ie(h,1,"week svelte-5umrtz",null,y,{single:a(c).length===1}),Bt(h,`--cols: ${a(c).length??""}; --gutters: ${a(f).length??""}`)}),g(e,h),Xe()}ot(["click"]);var vc=b('<div class="dow svelte-1ligxd8"> </div>'),fc=b('<i class="svelte-1ligxd8"></i>'),dc=b('<button type="button"><span class="num svelte-1ligxd8"> </span> <span class="dots svelte-1ligxd8"></span></button>'),hc=b('<section class="month svelte-1ligxd8"><button type="button" class="title svelte-1ligxd8"> </button> <div class="mini svelte-1ligxd8"><!> <!></div></section>'),pc=b('<div class="year svelte-1ligxd8"></div>');function _c(e,t){Je(t,!0);let n=Ye(t,"zone",3,"local"),r=ee(()=>en(n()));const s=3;function l(i){return t.events.filter(v=>xr(v,i,n())).slice(0,s)}let o=ee(()=>Qo(t.cursor));var c=pc();oe(c,21,()=>a(o),i=>i.getMonth(),(i,v)=>{var _=hc(),f=p(_),d=N(f,!0),h=u(f,2),y=p(h);oe(y,16,()=>["M","T","W","T","F","S","S"],mn,(w,j)=>{var F=vc(),M=N(F,!0);z(()=>C(M,j)),g(w,F)});var B=u(y,2);oe(B,17,()=>da(a(v)).slice(0,42),w=>kt(w),(w,j)=>{const F=ee(()=>a(j).getMonth()===a(v).getMonth()),M=ee(()=>a(F)?l(a(j)):[]);var D=dc();let P;var I=p(D),W=N(I,!0),L=u(I,2);oe(L,21,()=>a(M),x=>x.id,(x,T)=>{var U=fc();z(V=>Bt(U,`--hue: ${V??""}`),[()=>jn(a(T))]),g(x,U)}),z((x,T,U)=>{P=Ie(D,1,"day svelte-1ligxd8",null,P,{outside:!a(F),today:x}),ge(D,"aria-label",T),C(W,U)},[()=>Bn(a(j),a(r)),()=>`${a(j).getDate()} ${vn[a(j).getMonth()]}${a(M).length?`, ${a(M).length} events`:""}`,()=>a(j).getDate()]),Q("click",D,()=>t.onpickday(a(j))),g(w,D)}),z(w=>C(d,w),[()=>vn[a(v).getMonth()]]),Q("click",f,()=>t.onpickmonth(a(v))),g(i,_)}),g(e,c),Xe()}ot(["click"]);var gc=b('<p class="empty muted svelte-pgbq8n">No events match the current filters.</p>'),mc=b('<span class="alsoat svelte-pgbq8n"> </span>'),wc=b('<span class="tag private svelte-pgbq8n">private</span>'),bc=b('<span class="where muted svelte-pgbq8n"> </span>'),yc=b('<li><button type="button" class="row svelte-pgbq8n"><span class="when svelte-pgbq8n"> </span> <!> <span class="title svelte-pgbq8n"> </span> <span class="tag svelte-pgbq8n"> </span> <!> <!></button></li>'),kc=b('<section class="svelte-pgbq8n"><h3><span class="dow svelte-pgbq8n"> </span> </h3> <ul class="svelte-pgbq8n"></ul></section>'),xc=b('<div class="agenda svelte-pgbq8n"><!> <!></div>');function Tc(e,t){Je(t,!0);let n=Ye(t,"zone",3,"local"),r=Ye(t,"compareZones",19,()=>[]),s=ee(()=>en(n())),l=ee(()=>Ks(t.events,n()));function o(d){return d.all_day?"All day":`${Ue(at(d,n()))} - ${Ue(Qn(d,n()))}`}function c(d){return d.all_day?[]:r().map(h=>({key:h,text:`${Ue(at(d,h))} ${Xn(h)}`}))}var i=xc(),v=p(i);{var _=d=>{var h=gc();g(d,h)};J(v,d=>{a(l).length===0&&d(_)})}var f=u(v,2);oe(f,17,()=>a(l),d=>d.key,(d,h)=>{var y=kc(),B=p(y);let w;var j=p(B),F=N(j,!0),M=u(j),D=u(B,2);oe(D,21,()=>a(h).events,P=>P.id,(P,I)=>{var W=yc(),L=p(W),x=p(L),T=N(x,!0),U=u(x,2);oe(U,17,()=>c(a(I)),ae=>ae.key,(ae,q)=>{var X=mc(),ie=N(X,!0);z(()=>C(ie,a(q).text)),g(ae,X)});var V=u(U,2),S=N(V,!0),A=u(V,2),O=N(A,!0),R=u(A,2);{var te=ae=>{var q=wc();g(ae,q)};J(R,ae=>{a(I).visibility==="private"&&ae(te)})}var G=u(R,2);{var le=ae=>{var q=bc(),X=N(q,!0);z(()=>C(X,a(I).location)),g(ae,q)};J(G,ae=>{a(I).location&&ae(le)})}z((ae,q,X)=>{Bt(L,`--hue: ${ae??""}`),C(T,q),C(S,a(I).title),C(O,X)},[()=>jn(a(I)),()=>o(a(I)),()=>Er(a(I))]),Q("click",L,()=>t.onselect(a(I))),g(P,W)}),z((P,I,W)=>{w=Ie(B,1,"svelte-pgbq8n",null,w,{today:P}),C(F,I),C(M,` ${W??""}`)},[()=>Bn(a(h).date,a(s)),()=>kr[(a(h).date.getDay()+6)%7],()=>Be(a(h).date)]),g(d,y)}),g(e,i),Xe()}ot(["click"]);var Ec=b('<p class="error svelte-qx7ml8" role="alert"> </p>'),nr=b("<option> </option>"),Sc=b('<label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Project</span> <select></select></label>'),Ac=b('<label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Visibility</span> <select></select></label>'),zc=b(`<label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Timezone of these times</span> <select></select> <small class="hint muted svelte-qx7ml8">Enter the times as they will be in this zone. Everybody else sees them converted to - their own clock.</small></label>`),Ya=b('<input type="date" required=""/>'),Za=b('<input type="datetime-local" required=""/>'),Dc=b('<button type="button" class="btn danger">Delete</button>'),Cc=b('<form><h2 class="svelte-qx7ml8"> </h2> <label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Title</span> <input required="" maxlength="200" placeholder="What is happening?"/></label> <div class="pair svelte-qx7ml8"><label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Calendar</span> <select></select></label> <!> <!></div> <label class="check svelte-qx7ml8"><input type="checkbox"/> All day</label> <!> <div class="pair svelte-qx7ml8"><label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Starts</span> <!></label> <label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Ends</span> <!></label></div> <label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Location</span> <input maxlength="300" placeholder="Room, city or a meeting link"/></label> <label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Link</span> <input type="url" maxlength="2048" placeholder="https://..."/></label> <label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Description</span> <textarea maxlength="20000"></textarea></label> <footer class="svelte-qx7ml8"><!> <span class="spacer svelte-qx7ml8"></span> <button type="button" class="btn">Cancel</button> <button type="submit" class="btn primary"> </button></footer></form>'),jc=b('<li class="svelte-qx7ml8"><span class="clockzone svelte-qx7ml8"> </span> <span class="clocktime svelte-qx7ml8"> </span></li>'),Mc=b('<ul class="clocks svelte-qx7ml8"></ul>'),Pc=b('<p class="svelte-qx7ml8"><strong>Where</strong> </p>'),Lc=b('<p class="svelte-qx7ml8"><strong>Link</strong> <a rel="noreferrer noopener"> </a></p>'),Oc=b('<p class="description svelte-qx7ml8"> </p>'),Ic=b('<button type="button" class="btn">Edit</button>'),qc=b('<article class="svelte-qx7ml8"><header class="svelte-qx7ml8"><span class="tag svelte-qx7ml8"> </span> <span> </span></header> <h2 class="svelte-qx7ml8"> </h2> <p class="when svelte-qx7ml8"> <span class="zonehint muted svelte-qx7ml8"> </span></p> <!> <!> <!> <!> <p class="shortlink svelte-qx7ml8"><strong>Shortlink</strong> <a class="svelte-qx7ml8"> </a> <button type="button" class="btn">Copy</button></p> <p class="muted owner svelte-qx7ml8"> </p> <footer class="svelte-qx7ml8"><a class="btn">Download .ics</a> <span class="spacer svelte-qx7ml8"></span> <!> <button type="button" class="btn primary">Close</button></footer></article>'),Nc=b('<div class="backdrop svelte-qx7ml8"><div class="dialog svelte-qx7ml8" role="dialog" tabindex="-1" aria-modal="true"><!> <!></div></div>');function Rc(e,t){Je(t,!0);let n=Ye(t,"zone",3,"local"),r=Ye(t,"compareZones",19,()=>[]);const s=oi();let l=ce(null),o=null;At(()=>{t.draft!==o&&(o=t.draft,k(l,t.draft?{...t.draft}:null,!0))});let c=ee(()=>{const S=t.calendars?.can_create;if(!S)return[];const A=[];return S.personal&&A.push("personal"),S.project.length>0&&A.push("project"),S.foundation&&A.push("foundation"),A}),i=ee(()=>a(l)?.visibility==="private"?t.calendars?.can_create.project_private??[]:t.calendars?.can_create.project??[]),v=ee(()=>a(l)?a(l).category==="personal"?["private"]:a(l).category==="foundation"?["public","private"]:(t.calendars?.can_create.project_private??[]).length>0?["public","private"]:["public"]:["public"]);function _(S){a(l)&&(a(l).category=S,S==="personal"?(a(l).visibility="private",a(l).project=null):S==="foundation"?(a(l).project=null,a(l).visibility==="private"&&!t.calendars?.can_create.foundation&&(a(l).visibility="public")):a(l).project??=t.calendars?.can_create.project[0]??null)}function f(S){S.preventDefault(),a(l)&&t.onsave({...a(l)})}function d(S){S.key==="Escape"&&t.onclose()}function h(){t.event?.shortlink_url&&navigator.clipboard?.writeText(t.event.shortlink_url)}function y(S){const A=at(S,n()),O=Qn(S,n());if(S.all_day){const R=new Date(O.getTime()-1);return R.toDateString()===A.toDateString()?`${Be(A)} (all day)`:`${Be(A)} - ${Be(R)} (all day)`}return A.toDateString()===O.toDateString()?`${Be(A)}, ${Ue(A)} - ${Ue(O)}`:`${Be(A)} ${Ue(A)} - ${Be(O)} ${Ue(O)}`}let B=ee(()=>{const S=t.event;if(!S||S.all_day)return[];const A=new Date(S.start),O=new Date(S.end),R=at(S,n()).getTime(),te=[],G=new Set([tt(n())]),le=(ae,q="")=>{const X=tt(ae);if(G.has(X))return;G.add(X);const ie=pn(A,X);if(ie.getTime()===R&&!q)return;const ve=Mt(ae)?`Local - ${Wn(X)}`:Wn(X);te.push({key:X,label:`${ve}${q}`,when:`${Ue(ie)} - ${Ue(pn(O,X))}`})};le(S.timezone||"UTC"," (organiser)");for(const ae of r())le(ae);return te});function w(S,A){!a(l)||!S||(a(l).start=Jt(A?new Date(Date.UTC(...F(S))):Nn(new Date(S),a(l).timezone)))}function j(S,A){if(!(!a(l)||!S))if(A){const[O,R,te]=F(S);a(l).end=Jt(new Date(Date.UTC(O,R,te+1)))}else a(l).end=Jt(Nn(new Date(S),a(l).timezone))}function F(S){const A=ti(S);return[A.getFullYear(),A.getMonth(),A.getDate()]}function M(S){return a(l)?ri(pn(new Date(S),a(l).timezone)):""}function D(S,A=!1){const O=new Date(S),R=A?new Date(O.getTime()-1):O;return ai(new Date(R.getUTCFullYear(),R.getUTCMonth(),R.getUTCDate()))}function P(S){if(!a(l))return;const A=pn(new Date(a(l).start),a(l).timezone),O=pn(new Date(a(l).end),a(l).timezone);a(l).timezone=S,a(l).start=Jt(Nn(A,S)),a(l).end=Jt(Nn(O,S))}var I=Nc();gn("keydown",dr,d);var W=p(I),L=p(W);{var x=S=>{var A=Ec(),O=N(A,!0);z(()=>C(O,t.error)),g(S,A)};J(L,S=>{t.error&&S(x)})}var T=u(L,2);{var U=S=>{var A=Cc(),O=p(A),R=N(O,!0),te=u(O,2),G=u(p(te),2),le=u(te,2),ae=p(le),q=u(p(ae),2);oe(q,20,()=>a(c),$=>$,($,H)=>{var Z=nr(),ne=N(Z,!0),_e={};z(be=>{C(ne,be),_e!==(_e=H)&&(Z.value=(Z.__value=_e)??"")},[()=>pa(H)]),g($,Z)});var X;jt(q);var ie=u(ae,2);{var ve=$=>{var H=Sc(),Z=u(p(H),2);oe(Z,20,()=>a(i),ne=>ne,(ne,_e)=>{var be=nr(),Ee=N(be,!0),Se={};z(()=>{C(Ee,_e),Se!==(Se=_e)&&(be.value=(be.__value=Se)??"")}),g(ne,be)}),jt(Z),Da(Z,()=>a(l).project,ne=>a(l).project=ne),g($,H)};J(ie,$=>{a(l).category==="project"&&$(ve)})}var we=u(ie,2);{var xe=$=>{var H=Ac(),Z=u(p(H),2);oe(Z,20,()=>a(v),ne=>ne,(ne,_e)=>{var be=nr(),Ee=N(be,!0),Se={};z(()=>{C(Ee,_e),Se!==(Se=_e)&&(be.value=(be.__value=Se)??"")}),g(ne,be)}),jt(Z),Da(Z,()=>a(l).visibility,ne=>a(l).visibility=ne),g($,H)};J(we,$=>{a(l).category!=="personal"&&$(xe)})}var ye=u(le,2),K=p(ye),m=u(ye,2);{var Y=$=>{var H=zc(),Z=u(p(H),2);oe(Z,20,()=>s,_e=>_e,(_e,be)=>{var Ee=nr(),Se=N(Ee,!0),Qe={};z(()=>{C(Se,be),Qe!==(Qe=be)&&(Ee.value=(Ee.__value=Qe)??"")}),g(_e,Ee)});var ne;jt(Z),z(()=>{ne!==(ne=a(l).timezone)&&(Z.value=(Z.__value=ne)??"",Ot(Z,ne))}),Q("change",Z,_e=>P(_e.currentTarget.value)),g($,H)};J(m,$=>{a(l).all_day||$(Y)})}var se=u(m,2),fe=p(se),ke=u(p(fe),2);{var Ne=$=>{var H=Ya();z(Z=>qn(H,Z),[()=>D(a(l).start)]),Q("change",H,Z=>w(Z.currentTarget.value,!0)),g($,H)},He=$=>{var H=Za();z(Z=>qn(H,Z),[()=>M(a(l).start)]),Q("change",H,Z=>w(Z.currentTarget.value,!1)),g($,H)};J(ke,$=>{a(l).all_day?$(Ne):$(He,-1)})}var je=u(fe,2),Re=u(p(je),2);{var st=$=>{var H=Ya();z(Z=>qn(H,Z),[()=>D(a(l).end,!0)]),Q("change",H,Z=>j(Z.currentTarget.value,!0)),g($,H)},pt=$=>{var H=Za();z(Z=>qn(H,Z),[()=>M(a(l).end)]),Q("change",H,Z=>j(Z.currentTarget.value,!1)),g($,H)};J(Re,$=>{a(l).all_day?$(st):$(pt,-1)})}var _t=u(se,2),Te=u(p(_t),2),Oe=u(_t,2),Tt=u(p(Oe),2),gt=u(Oe,2),qt=u(p(gt),2),me=u(gt,2),Ae=p(me);{var De=$=>{var H=Dc();z(()=>H.disabled=t.saving),Q("click",H,function(...Z){t.ondelete?.apply(this,Z)}),g($,H)};J(Ae,$=>{t.event&&$(De)})}var Fe=u(Ae,4),Et=u(Fe,2),Nt=N(Et,!0);z(()=>{C(R,t.event?"Edit event":"New event"),q.disabled=a(c).length<=1&&!t.event,X!==(X=a(l).category)&&(q.value=(q.__value=X)??"",Ot(q,X)),Fe.disabled=t.saving,Et.disabled=t.saving,C(Nt,t.saving?"Saving...":"Save")}),gn("submit",A,f),tr(G,()=>a(l).title,$=>a(l).title=$),Q("change",q,$=>_($.currentTarget.value)),Zo(K,()=>a(l).all_day,$=>a(l).all_day=$),tr(Te,()=>a(l).location,$=>a(l).location=$),tr(Tt,()=>a(l).url,$=>a(l).url=$),tr(qt,()=>a(l).description,$=>a(l).description=$),Q("click",Fe,function(...$){t.onclose?.apply(this,$)}),g(S,A)},V=S=>{var A=qc(),O=p(A),R=p(O),te=N(R,!0),G=u(R,2);let le;var ae=N(G,!0),q=u(O,2),X=N(q,!0),ie=u(q,2),ve=p(ie),we=u(ve),xe=N(we,!0),ye=u(ie,2);{var K=me=>{var Ae=Mc();oe(Ae,21,()=>a(B),De=>De.key,(De,Fe)=>{var Et=jc(),Nt=p(Et),$=N(Nt,!0),H=u(Nt,2),Z=N(H,!0);z(ne=>{ge(Nt,"title",ne),C($,a(Fe).label),C(Z,a(Fe).when)},[()=>xt(a(Fe).key)]),g(De,Et)}),g(me,Ae)};J(ye,me=>{a(B).length>0&&me(K)})}var m=u(ye,2);{var Y=me=>{var Ae=Pc(),De=u(p(Ae));z(()=>C(De,` ${t.event.location??""}`)),g(me,Ae)};J(m,me=>{t.event.location&&me(Y)})}var se=u(m,2);{var fe=me=>{var Ae=Lc(),De=u(p(Ae),2),Fe=N(De,!0);z(()=>{ge(De,"href",t.event.url),C(Fe,t.event.url)}),g(me,Ae)};J(se,me=>{t.event.url&&me(fe)})}var ke=u(se,2);{var Ne=me=>{var Ae=Oc(),De=N(Ae,!0);z(()=>C(De,t.event.description)),g(me,Ae)};J(ke,me=>{t.event.description&&me(Ne)})}var He=u(ke,2),je=u(p(He),2),Re=N(je,!0),st=u(je,2),pt=u(He,2),_t=N(pt),Te=u(pt,2),Oe=p(Te),Tt=u(Oe,4);{var gt=me=>{var Ae=Ic();Q("click",Ae,function(...De){t.onedit?.apply(this,De)}),g(me,Ae)};J(Tt,me=>{t.editable&&me(gt)})}var qt=u(Tt,2);z((me,Ae,De,Fe)=>{C(te,me),le=Ie(G,1,"tag svelte-qx7ml8",null,le,{private:t.event.visibility==="private"}),C(ae,t.event.visibility),C(X,t.event.title),C(ve,`${Ae??""} `),C(xe,De),ge(je,"href",t.event.shortlink_url),C(Re,t.event.shortlink_url),C(_t,`Added by ${t.event.owner??""}`),ge(Oe,"href",Fe)},[()=>Er(t.event),()=>y(t.event),()=>t.event.all_day?"":An(n()),()=>ct.icsUrl(t.event.id)]),Q("click",st,h),Q("click",qt,function(...me){t.onclose?.apply(this,me)}),g(S,A)};J(T,S=>{a(l)?S(U):t.event&&S(V,1)})}z(S=>{ge(W,"aria-label",a(l)?"Edit event":t.event?.title??"Event"),Bt(W,`--hue: ${S??""}`)},[()=>t.event?jn(t.event):210]),Q("click",I,function(...S){t.onclose?.apply(this,S)}),Q("click",W,S=>S.stopPropagation()),g(e,I),Xe()}ot(["click","change"]);var Fc=b('<th scope="col" class="svelte-rmw6w0"> </th>'),Uc=b('<span class="yes svelte-rmw6w0" aria-label="yes">✓</span>'),Hc=b('<span class="no svelte-rmw6w0" aria-label="no">–</span>'),Yc=b('<span class="note svelte-rmw6w0"> </span>'),Zc=b('<td class="svelte-rmw6w0"><!></td>'),Bc=b('<tr><th scope="row" class="svelte-rmw6w0"> </th><!></tr>'),Wc=b("You are currently comparing against <strong> </strong>.",1),Vc=b(`<p class="svelte-rmw6w0">You are signed in. <a>Log out</a> when you + width: calc(${1/a(R).columns*100}% - 4px);`),ge(te,"title",a(R).event.title),C(ae,ve),C(X,a(R).event.title)},[()=>jn(a(R).event),()=>Ue(at(a(R).event,r()))]),Q("click",te,()=>t.onselect(a(R).event)),g(O,te)}),z((O,R)=>V=Ie(U,1,"daycol svelte-5umrtz",null,V,{weekend:O,today:R}),[()=>lr(a(x)),()=>Bn(a(x),a(o))]),g(L,U)}),z(()=>{y=Ie(h,1,"week svelte-5umrtz",null,y,{single:a(c).length===1}),Wt(h,`--cols: ${a(c).length??""}; --gutters: ${a(f).length??""}`)}),g(e,h),Xe()}ot(["click"]);var vc=b('<div class="dow svelte-1ligxd8"> </div>'),fc=b('<i class="svelte-1ligxd8"></i>'),dc=b('<button type="button"><span class="num svelte-1ligxd8"> </span> <span class="dots svelte-1ligxd8"></span></button>'),hc=b('<section class="month svelte-1ligxd8"><button type="button" class="title svelte-1ligxd8"> </button> <div class="mini svelte-1ligxd8"><!> <!></div></section>'),pc=b('<div class="year svelte-1ligxd8"></div>');function _c(e,t){Je(t,!0);let n=Ye(t,"zone",3,"local"),r=ee(()=>tn(n()));const s=3;function l(i){return t.events.filter(v=>xr(v,i,n())).slice(0,s)}let o=ee(()=>Qo(t.cursor));var c=pc();oe(c,21,()=>a(o),i=>i.getMonth(),(i,v)=>{var _=hc(),f=p(_),d=N(f,!0),h=u(f,2),y=p(h);oe(y,16,()=>["M","T","W","T","F","S","S"],Ut,(w,j)=>{var F=vc(),M=N(F,!0);z(()=>C(M,j)),g(w,F)});var Y=u(y,2);oe(Y,17,()=>da(a(v)).slice(0,42),w=>kt(w),(w,j)=>{const F=ee(()=>a(j).getMonth()===a(v).getMonth()),M=ee(()=>a(F)?l(a(j)):[]);var D=dc();let P;var I=p(D),Z=N(I,!0),L=u(I,2);oe(L,21,()=>a(M),x=>x.id,(x,T)=>{var U=fc();z(V=>Wt(U,`--hue: ${V??""}`),[()=>jn(a(T))]),g(x,U)}),z((x,T,U)=>{P=Ie(D,1,"day svelte-1ligxd8",null,P,{outside:!a(F),today:x}),ge(D,"aria-label",T),C(Z,U)},[()=>Bn(a(j),a(r)),()=>`${a(j).getDate()} ${fn[a(j).getMonth()]}${a(M).length?`, ${a(M).length} events`:""}`,()=>a(j).getDate()]),Q("click",D,()=>t.onpickday(a(j))),g(w,D)}),z(w=>C(d,w),[()=>fn[a(v).getMonth()]]),Q("click",f,()=>t.onpickmonth(a(v))),g(i,_)}),g(e,c),Xe()}ot(["click"]);var gc=b('<p class="empty muted svelte-pgbq8n">No events match the current filters.</p>'),mc=b('<span class="alsoat svelte-pgbq8n"> </span>'),wc=b('<span class="tag private svelte-pgbq8n">private</span>'),bc=b('<span class="where muted svelte-pgbq8n"> </span>'),yc=b('<li><button type="button" class="row svelte-pgbq8n"><span class="when svelte-pgbq8n"> </span> <!> <span class="title svelte-pgbq8n"> </span> <span class="tag svelte-pgbq8n"> </span> <!> <!></button></li>'),kc=b('<section class="svelte-pgbq8n"><h3><span class="dow svelte-pgbq8n"> </span> </h3> <ul class="svelte-pgbq8n"></ul></section>'),xc=b('<div class="agenda svelte-pgbq8n"><!> <!></div>');function Tc(e,t){Je(t,!0);let n=Ye(t,"zone",3,"local"),r=Ye(t,"compareZones",19,()=>[]),s=ee(()=>tn(n())),l=ee(()=>Ks(t.events,n()));function o(d){return d.all_day?"All day":`${Ue(at(d,n()))} - ${Ue(Qn(d,n()))}`}function c(d){return d.all_day?[]:r().map(h=>({key:h,text:`${Ue(at(d,h))} ${Xn(h)}`}))}var i=xc(),v=p(i);{var _=d=>{var h=gc();g(d,h)};J(v,d=>{a(l).length===0&&d(_)})}var f=u(v,2);oe(f,17,()=>a(l),d=>d.key,(d,h)=>{var y=kc(),Y=p(y);let w;var j=p(Y),F=N(j,!0),M=u(j),D=u(Y,2);oe(D,21,()=>a(h).events,P=>P.id,(P,I)=>{var Z=yc(),L=p(Z),x=p(L),T=N(x,!0),U=u(x,2);oe(U,17,()=>c(a(I)),ae=>ae.key,(ae,q)=>{var X=mc(),ie=N(X,!0);z(()=>C(ie,a(q).text)),g(ae,X)});var V=u(U,2),S=N(V,!0),A=u(V,2),O=N(A,!0),R=u(A,2);{var te=ae=>{var q=wc();g(ae,q)};J(R,ae=>{a(I).visibility==="private"&&ae(te)})}var G=u(R,2);{var le=ae=>{var q=bc(),X=N(q,!0);z(()=>C(X,a(I).location)),g(ae,q)};J(G,ae=>{a(I).location&&ae(le)})}z((ae,q,X)=>{Wt(L,`--hue: ${ae??""}`),C(T,q),C(S,a(I).title),C(O,X)},[()=>jn(a(I)),()=>o(a(I)),()=>Er(a(I))]),Q("click",L,()=>t.onselect(a(I))),g(P,Z)}),z((P,I,Z)=>{w=Ie(Y,1,"svelte-pgbq8n",null,w,{today:P}),C(F,I),C(M,` ${Z??""}`)},[()=>Bn(a(h).date,a(s)),()=>kr[(a(h).date.getDay()+6)%7],()=>Be(a(h).date)]),g(d,y)}),g(e,i),Xe()}ot(["click"]);var Ec=b('<p class="error svelte-qx7ml8" role="alert"> </p>'),nr=b("<option> </option>"),Sc=b('<label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Project</span> <select></select></label>'),Ac=b('<label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Visibility</span> <select></select></label>'),zc=b(`<label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Timezone of these times</span> <select></select> <small class="hint muted svelte-qx7ml8">Enter the times as they will be in this zone. Everybody else sees them converted to + their own clock.</small></label>`),Ya=b('<input type="date" required=""/>'),Za=b('<input type="datetime-local" required=""/>'),Dc=b('<button type="button" class="btn danger">Delete</button>'),Cc=b('<form><h2 class="svelte-qx7ml8"> </h2> <label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Title</span> <input required="" maxlength="200" placeholder="What is happening?"/></label> <div class="pair svelte-qx7ml8"><label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Calendar</span> <select></select></label> <!> <!></div> <label class="check svelte-qx7ml8"><input type="checkbox"/> All day</label> <!> <div class="pair svelte-qx7ml8"><label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Starts</span> <!></label> <label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Ends</span> <!></label></div> <label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Location</span> <input maxlength="300" placeholder="Room, city or a meeting link"/></label> <label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Link</span> <input type="url" maxlength="2048" placeholder="https://..."/></label> <label class="row svelte-qx7ml8"><span class="svelte-qx7ml8">Description</span> <textarea maxlength="20000"></textarea></label> <footer class="svelte-qx7ml8"><!> <span class="spacer svelte-qx7ml8"></span> <button type="button" class="btn">Cancel</button> <button type="submit" class="btn primary"> </button></footer></form>'),jc=b('<li class="svelte-qx7ml8"><span class="clockzone svelte-qx7ml8"> </span> <span class="clocktime svelte-qx7ml8"> </span></li>'),Mc=b('<ul class="clocks svelte-qx7ml8"></ul>'),Pc=b('<p class="svelte-qx7ml8"><strong>Where</strong> </p>'),Lc=b('<p class="svelte-qx7ml8"><strong>Link</strong> <a rel="noreferrer noopener"> </a></p>'),Oc=b('<p class="description svelte-qx7ml8"> </p>'),Ic=b('<button type="button" class="btn">Edit</button>'),qc=b('<article class="svelte-qx7ml8"><header class="svelte-qx7ml8"><span class="tag svelte-qx7ml8"> </span> <span> </span></header> <h2 class="svelte-qx7ml8"> </h2> <p class="when svelte-qx7ml8"> <span class="zonehint muted svelte-qx7ml8"> </span></p> <!> <!> <!> <!> <p class="shortlink svelte-qx7ml8"><strong>Shortlink</strong> <a class="svelte-qx7ml8"> </a> <button type="button" class="btn">Copy</button></p> <p class="muted owner svelte-qx7ml8"> </p> <footer class="svelte-qx7ml8"><a class="btn">Download .ics</a> <span class="spacer svelte-qx7ml8"></span> <!> <button type="button" class="btn primary">Close</button></footer></article>'),Nc=b('<div class="backdrop svelte-qx7ml8"><div class="dialog svelte-qx7ml8" role="dialog" tabindex="-1" aria-modal="true"><!> <!></div></div>');function Rc(e,t){Je(t,!0);let n=Ye(t,"zone",3,"local"),r=Ye(t,"compareZones",19,()=>[]);const s=oi();let l=ce(null),o=null;At(()=>{t.draft!==o&&(o=t.draft,k(l,t.draft?{...t.draft}:null,!0))});let c=ee(()=>{const S=t.calendars?.can_create;if(!S)return[];const A=[];return S.personal&&A.push("personal"),S.project.length>0&&A.push("project"),S.foundation&&A.push("foundation"),A}),i=ee(()=>a(l)?.visibility==="private"?t.calendars?.can_create.project_private??[]:t.calendars?.can_create.project??[]),v=ee(()=>a(l)?a(l).category==="personal"?["private"]:a(l).category==="foundation"?["public","private"]:(t.calendars?.can_create.project_private??[]).length>0?["public","private"]:["public"]:["public"]);function _(S){a(l)&&(a(l).category=S,S==="personal"?(a(l).visibility="private",a(l).project=null):S==="foundation"?(a(l).project=null,a(l).visibility==="private"&&!t.calendars?.can_create.foundation&&(a(l).visibility="public")):a(l).project??=t.calendars?.can_create.project[0]??null)}function f(S){S.preventDefault(),a(l)&&t.onsave({...a(l)})}function d(S){S.key==="Escape"&&t.onclose()}function h(){t.event?.shortlink_url&&navigator.clipboard?.writeText(t.event.shortlink_url)}function y(S){const A=at(S,n()),O=Qn(S,n());if(S.all_day){const R=new Date(O.getTime()-1);return R.toDateString()===A.toDateString()?`${Be(A)} (all day)`:`${Be(A)} - ${Be(R)} (all day)`}return A.toDateString()===O.toDateString()?`${Be(A)}, ${Ue(A)} - ${Ue(O)}`:`${Be(A)} ${Ue(A)} - ${Be(O)} ${Ue(O)}`}let Y=ee(()=>{const S=t.event;if(!S||S.all_day)return[];const A=new Date(S.start),O=new Date(S.end),R=at(S,n()).getTime(),te=[],G=new Set([tt(n())]),le=(ae,q="")=>{const X=tt(ae);if(G.has(X))return;G.add(X);const ie=_n(A,X);if(ie.getTime()===R&&!q)return;const ve=Mt(ae)?`Local - ${Wn(X)}`:Wn(X);te.push({key:X,label:`${ve}${q}`,when:`${Ue(ie)} - ${Ue(_n(O,X))}`})};le(S.timezone||"UTC"," (organiser)");for(const ae of r())le(ae);return te});function w(S,A){!a(l)||!S||(a(l).start=Xt(A?new Date(Date.UTC(...F(S))):Nn(new Date(S),a(l).timezone)))}function j(S,A){if(!(!a(l)||!S))if(A){const[O,R,te]=F(S);a(l).end=Xt(new Date(Date.UTC(O,R,te+1)))}else a(l).end=Xt(Nn(new Date(S),a(l).timezone))}function F(S){const A=ti(S);return[A.getFullYear(),A.getMonth(),A.getDate()]}function M(S){return a(l)?ri(_n(new Date(S),a(l).timezone)):""}function D(S,A=!1){const O=new Date(S),R=A?new Date(O.getTime()-1):O;return ai(new Date(R.getUTCFullYear(),R.getUTCMonth(),R.getUTCDate()))}function P(S){if(!a(l))return;const A=_n(new Date(a(l).start),a(l).timezone),O=_n(new Date(a(l).end),a(l).timezone);a(l).timezone=S,a(l).start=Xt(Nn(A,S)),a(l).end=Xt(Nn(O,S))}var I=Nc();mn("keydown",dr,d);var Z=p(I),L=p(Z);{var x=S=>{var A=Ec(),O=N(A,!0);z(()=>C(O,t.error)),g(S,A)};J(L,S=>{t.error&&S(x)})}var T=u(L,2);{var U=S=>{var A=Cc(),O=p(A),R=N(O,!0),te=u(O,2),G=u(p(te),2),le=u(te,2),ae=p(le),q=u(p(ae),2);oe(q,20,()=>a(c),$=>$,($,W)=>{var B=nr(),ne=N(B,!0),pe={};z(be=>{C(ne,be),pe!==(pe=W)&&(B.value=(B.__value=pe)??"")},[()=>pa(W)]),g($,B)});var X;jt(q);var ie=u(ae,2);{var ve=$=>{var W=Sc(),B=u(p(W),2);oe(B,20,()=>a(i),ne=>ne,(ne,pe)=>{var be=nr(),Ee=N(be,!0),Se={};z(()=>{C(Ee,pe),Se!==(Se=pe)&&(be.value=(be.__value=Se)??"")}),g(ne,be)}),jt(B),Da(B,()=>a(l).project,ne=>a(l).project=ne),g($,W)};J(ie,$=>{a(l).category==="project"&&$(ve)})}var we=u(ie,2);{var xe=$=>{var W=Ac(),B=u(p(W),2);oe(B,20,()=>a(v),ne=>ne,(ne,pe)=>{var be=nr(),Ee=N(be,!0),Se={};z(()=>{C(Ee,pe),Se!==(Se=pe)&&(be.value=(be.__value=Se)??"")}),g(ne,be)}),jt(B),Da(B,()=>a(l).visibility,ne=>a(l).visibility=ne),g($,W)};J(we,$=>{a(l).category!=="personal"&&$(xe)})}var ye=u(le,2),K=p(ye),m=u(ye,2);{var H=$=>{var W=zc(),B=u(p(W),2);oe(B,20,()=>s,pe=>pe,(pe,be)=>{var Ee=nr(),Se=N(Ee,!0),Qe={};z(()=>{C(Se,be),Qe!==(Qe=be)&&(Ee.value=(Ee.__value=Qe)??"")}),g(pe,Ee)});var ne;jt(B),z(()=>{ne!==(ne=a(l).timezone)&&(B.value=(B.__value=ne)??"",Ot(B,ne))}),Q("change",B,pe=>P(pe.currentTarget.value)),g($,W)};J(m,$=>{a(l).all_day||$(H)})}var se=u(m,2),fe=p(se),ke=u(p(fe),2);{var Ne=$=>{var W=Ya();z(B=>qn(W,B),[()=>D(a(l).start)]),Q("change",W,B=>w(B.currentTarget.value,!0)),g($,W)},He=$=>{var W=Za();z(B=>qn(W,B),[()=>M(a(l).start)]),Q("change",W,B=>w(B.currentTarget.value,!1)),g($,W)};J(ke,$=>{a(l).all_day?$(Ne):$(He,-1)})}var je=u(fe,2),Re=u(p(je),2);{var st=$=>{var W=Ya();z(B=>qn(W,B),[()=>D(a(l).end,!0)]),Q("change",W,B=>j(B.currentTarget.value,!0)),g($,W)},pt=$=>{var W=Za();z(B=>qn(W,B),[()=>M(a(l).end)]),Q("change",W,B=>j(B.currentTarget.value,!1)),g($,W)};J(Re,$=>{a(l).all_day?$(st):$(pt,-1)})}var _t=u(se,2),Te=u(p(_t),2),Oe=u(_t,2),Tt=u(p(Oe),2),gt=u(Oe,2),qt=u(p(gt),2),me=u(gt,2),Ae=p(me);{var De=$=>{var W=Dc();z(()=>W.disabled=t.saving),Q("click",W,function(...B){t.ondelete?.apply(this,B)}),g($,W)};J(Ae,$=>{t.event&&$(De)})}var Fe=u(Ae,4),Et=u(Fe,2),Nt=N(Et,!0);z(()=>{C(R,t.event?"Edit event":"New event"),q.disabled=a(c).length<=1&&!t.event,X!==(X=a(l).category)&&(q.value=(q.__value=X)??"",Ot(q,X)),Fe.disabled=t.saving,Et.disabled=t.saving,C(Nt,t.saving?"Saving...":"Save")}),mn("submit",A,f),tr(G,()=>a(l).title,$=>a(l).title=$),Q("change",q,$=>_($.currentTarget.value)),Zo(K,()=>a(l).all_day,$=>a(l).all_day=$),tr(Te,()=>a(l).location,$=>a(l).location=$),tr(Tt,()=>a(l).url,$=>a(l).url=$),tr(qt,()=>a(l).description,$=>a(l).description=$),Q("click",Fe,function(...$){t.onclose?.apply(this,$)}),g(S,A)},V=S=>{var A=qc(),O=p(A),R=p(O),te=N(R,!0),G=u(R,2);let le;var ae=N(G,!0),q=u(O,2),X=N(q,!0),ie=u(q,2),ve=p(ie),we=u(ve),xe=N(we,!0),ye=u(ie,2);{var K=me=>{var Ae=Mc();oe(Ae,21,()=>a(Y),De=>De.key,(De,Fe)=>{var Et=jc(),Nt=p(Et),$=N(Nt,!0),W=u(Nt,2),B=N(W,!0);z(ne=>{ge(Nt,"title",ne),C($,a(Fe).label),C(B,a(Fe).when)},[()=>xt(a(Fe).key)]),g(De,Et)}),g(me,Ae)};J(ye,me=>{a(Y).length>0&&me(K)})}var m=u(ye,2);{var H=me=>{var Ae=Pc(),De=u(p(Ae));z(()=>C(De,` ${t.event.location??""}`)),g(me,Ae)};J(m,me=>{t.event.location&&me(H)})}var se=u(m,2);{var fe=me=>{var Ae=Lc(),De=u(p(Ae),2),Fe=N(De,!0);z(()=>{ge(De,"href",t.event.url),C(Fe,t.event.url)}),g(me,Ae)};J(se,me=>{t.event.url&&me(fe)})}var ke=u(se,2);{var Ne=me=>{var Ae=Oc(),De=N(Ae,!0);z(()=>C(De,t.event.description)),g(me,Ae)};J(ke,me=>{t.event.description&&me(Ne)})}var He=u(ke,2),je=u(p(He),2),Re=N(je,!0),st=u(je,2),pt=u(He,2),_t=N(pt),Te=u(pt,2),Oe=p(Te),Tt=u(Oe,4);{var gt=me=>{var Ae=Ic();Q("click",Ae,function(...De){t.onedit?.apply(this,De)}),g(me,Ae)};J(Tt,me=>{t.editable&&me(gt)})}var qt=u(Tt,2);z((me,Ae,De,Fe)=>{C(te,me),le=Ie(G,1,"tag svelte-qx7ml8",null,le,{private:t.event.visibility==="private"}),C(ae,t.event.visibility),C(X,t.event.title),C(ve,`${Ae??""} `),C(xe,De),ge(je,"href",t.event.shortlink_url),C(Re,t.event.shortlink_url),C(_t,`Added by ${t.event.owner??""}`),ge(Oe,"href",Fe)},[()=>Er(t.event),()=>y(t.event),()=>t.event.all_day?"":An(n()),()=>ct.icsUrl(t.event.id)]),Q("click",st,h),Q("click",qt,function(...me){t.onclose?.apply(this,me)}),g(S,A)};J(T,S=>{a(l)?S(U):t.event&&S(V,1)})}z(S=>{ge(Z,"aria-label",a(l)?"Edit event":t.event?.title??"Event"),Wt(Z,`--hue: ${S??""}`)},[()=>t.event?jn(t.event):210]),Q("click",I,function(...S){t.onclose?.apply(this,S)}),Q("click",Z,S=>S.stopPropagation()),g(e,I),Xe()}ot(["click","change"]);var Fc=b('<th scope="col" class="svelte-rmw6w0"> </th>'),Uc=b('<span class="yes svelte-rmw6w0" aria-label="yes">✓</span>'),Hc=b('<span class="no svelte-rmw6w0" aria-label="no">–</span>'),Yc=b('<span class="note svelte-rmw6w0"> </span>'),Zc=b('<td class="svelte-rmw6w0"><!></td>'),Bc=b('<tr><th scope="row" class="svelte-rmw6w0"> </th><!></tr>'),Wc=b("You are currently comparing against <strong> </strong>.",1),Vc=b(`<p class="svelte-rmw6w0">You are signed in. <a>Log out</a> when you are done, particularly on a shared machine.</p>`),Gc=b(`<p class="svelte-rmw6w0"><a>Log in</a> with your Apache account. You will be sent to the foundation's OAuth service and back again. Nothing is stored here beyond your username and the projects and committees you belong to.</p>`),Kc=b(`<div class="help svelte-rmw6w0"><div class="sheet svelte-rmw6w0"><header class="svelte-rmw6w0"><h2 class="svelte-rmw6w0">Using the ASF Community Calendar</h2> <button type="button" class="btn">Back to the calendar</button></header> <p class="status svelte-rmw6w0"> </p> <section class="svelte-rmw6w0"><h3 class="svelte-rmw6w0">The three calendars</h3> <p class="svelte-rmw6w0">Every event belongs to one of three calendars, and that is what decides who can see it and @@ -61,8 +61,8 @@ else. The <strong>API</strong> button at the top of the page opens the reference, with a "try it out" button on each endpoint that calls this deployment for real.</p> <p class="muted small svelte-rmw6w0">The description is generated from the running service, so it always matches what is actually deployed. Machine-readable copies live at <a>openapi.json</a> and <a>openapi.yaml</a>, ready for a client generator.</p></section> <section class="svelte-rmw6w0"><h3 class="svelte-rmw6w0">Signing in</h3> <!> <p class="muted small svelte-rmw6w0">If your affiliations have changed recently and the calendar has not noticed, log out and back - in; the lists are read when you sign in.</p></section> <footer class="svelte-rmw6w0"><button type="button" class="btn primary">Back to the calendar</button></footer></div></div>`);function Jc(e,t){Je(t,!0);let n=Ye(t,"compareZones",19,()=>[]);const r=["Anyone","Project member","Committee member","Foundation member"],s=[{what:"See public project events",cells:[!0,!0,!0,!0]},{what:"See public foundation events",cells:[!0,!0,!0,!0]},{what:"Subscribe to the iCalendar feed",cells:[!0,!0,!0,!0]},{what:"Open an event by its shortlink",cells:["public events",!0,!0,!0]},{what:"Keep personal events",cells:[!1,!0,!0,!0]},{what:"Add and edit public events for a project",cells:[!1,"own projects","own projects","own projects"]},{what:"See private events of a project",cells:[!1,!1,"own committees","own committees"]},{what:"Add and edit private project events",cells:[!1,!1,"own committees","own committees"]},{what:"See private foundation events",cells:[!1,!1,!1,!0]},{what:"Add and edit foundation events",cells:[!1,!1,!1,!0]}];let l=ee(()=>`${globalThis.location?.origin??""}${Wt("/embed/agenda")}?project=httpd&limit=8`),o=ee(()=>{if(!t.calendars?.authenticated)return"You are browsing anonymously, so you can see public events only.";const K=[];return t.calendars.projects.length>0&&K.push(`a member of ${t.calendars.projects.join(", ")}`),t.calendars.committees.length>0&&K.push(`on the ${t.calendars.committees.join(", ")} committee${t.calendars.committees.length>1?"s":""}`),t.calendars.is_member&&K.push("a foundation member"),K.length===0?`You are signed in as ${t.calendars.uid}.`:`You are signed in as ${t.calendars.uid}, ${K.join(", and ")}.`});var c=Kc(),i=p(c),v=p(i),_=u(p(v),2),f=u(v,2),d=N(f,!0),h=u(f,4),y=u(p(h),4),B=p(y),w=p(B),j=p(w),F=u(p(j));oe(F,16,()=>r,K=>K,(K,m)=>{var Y=Fc(),se=N(Y,!0);z(()=>C(se,m)),g(K,Y)});var M=u(w);oe(M,21,()=>s,K=>K.what,(K,m)=>{var Y=Bc(),se=p(Y),fe=N(se,!0),ke=u(se);oe(ke,17,()=>a(m).cells,mn,(Ne,He)=>{var je=Zc(),Re=p(je);{var st=Te=>{var Oe=Uc();g(Te,Oe)},pt=Te=>{var Oe=Hc();g(Te,Oe)},_t=Te=>{var Oe=Yc(),Tt=N(Oe,!0);z(()=>C(Tt,a(He))),g(Te,Oe)};J(Re,Te=>{a(He)===!0?Te(st):a(He)===!1?Te(pt,1):Te(_t,-1)})}g(Ne,je)}),z(()=>C(fe,a(m).what)),g(K,Y)});var D=u(h,6),P=u(p(D),4),I=p(P),W=u(p(I),5),L=N(W,!0),x=u(W),T=u(x),U=N(T,!0),V=u(I,2),S=u(p(V),2);{var A=K=>{var m=Wc(),Y=u(un(m)),se=N(Y,!0);z(fe=>C(se,fe),[()=>n().map(fe=>tt(fe)).join(", ")]),g(K,m)};J(S,K=>{n().length>0&&K(A)})}var O=u(D,8),R=u(p(O),4),te=N(R),G=u(O,2),le=u(p(G),4),ae=u(p(le)),q=u(ae,2),X=u(G,2),ie=u(p(X),2);{var ve=K=>{var m=Vc(),Y=u(p(m));z(se=>ge(Y,"href",se),[()=>t.session.logout_url??Hs()]),g(K,m)},we=K=>{var m=Gc(),Y=p(m);z(se=>ge(Y,"href",se),[()=>t.session?.login_url??Us()]),g(K,m)};J(ie,K=>{t.session?.authenticated?K(ve):K(we,-1)})}var xe=u(X,2),ye=N(xe);z((K,m,Y,se,fe)=>{C(d,a(o)),C(L,K),C(x,` - ${m??""} - and the picker beside - it holds any of the major timezones, starting on UTC. It is currently set to `),C(U,Y),C(te,`<iframe src="${a(l)??""}" width="100%" height="420"></iframe>`),ge(ae,"href",se),ge(q,"href",fe)},[()=>fn(),()=>An("local"),()=>An(t.zone),()=>Qt("/openapi.json"),()=>Qt("/openapi.yaml")]),Q("click",_,function(...K){t.onclose?.apply(this,K)}),Q("click",ye,function(...K){t.onclose?.apply(this,K)}),g(e,c),Xe()}ot(["click"]);var Xc=b('<p class="note svelte-fzlhf">Loading the API documentation...</p>'),Qc=b('<p class="note error svelte-fzlhf" role="alert"> </p>'),$c=b(`<div class="docs svelte-fzlhf"><header class="svelte-fzlhf"><div><h2 class="svelte-fzlhf">HTTP API</h2> <p class="muted svelte-fzlhf">Generated from the running service, so it always describes this deployment. Machine-readable - copies: <a>openapi.json</a> and <a>openapi.yaml</a>.</p></div> <button type="button" class="btn">Back to the calendar</button></header> <!> <div class="swagger svelte-fzlhf"></div></div>`);function eu(e,t){Je(t,!0);let n=ce(null),r=ce("loading"),s=ce(null);const l="vendor/swagger-ui-bundle.js",o="vendor/swagger-ui.css";function c(D){const P=document.querySelector(`script[data-swagger="${D}"]`);return P?P.dataset.loaded==="yes"?Promise.resolve():new Promise((I,W)=>{P.addEventListener("load",()=>I()),P.addEventListener("error",()=>W(new Error(D)))}):new Promise((I,W)=>{const L=document.createElement("script");L.src=D,L.async=!0,L.dataset.swagger=D,L.addEventListener("load",()=>{L.dataset.loaded="yes",I()}),L.addEventListener("error",()=>W(new Error(D))),document.head.appendChild(L)})}function i(D){const P=document.createElement("link");return P.rel="stylesheet",P.href=D,P.dataset.swagger="styles",document.head.appendChild(P),P}At(()=>{if(!a(n))return;const D=i(Vr(o));let P=!1;return(async()=>{try{await c(Vr(l));const I=globalThis.SwaggerUIBundle;if(!I)throw new Error("SwaggerUIBundle did not register itself");if(P||!a(n))return;I({url:Qt("/openapi.json"),domNode:a(n),deepLinking:!1,docExpansion:"list",defaultModelsExpandDepth:1,tryItOutEnabled:!0,persistAuthorization:!1,supportedSubmitMethods:["get","post","put","patch","delete"],requestInterceptor:W=>(W.headers["X-No-Redirect"]="1",W.credentials="same-origin",W)}),k(r,"ready")}catch(I){k(s,I instanceof Error&&I.message.includes(l)?"Swagger UI could not be loaded. If this is a development server, run 'npm run build' in frontend/ so the vendored files are in place.":"Swagger UI could not be started.",!0),k(r,"failed")}})(),()=>{P=!0,D.remove()}});var v=$c(),_=p(v),f=p(_),d=u(p(f),2),h=u(p(d)),y=u(h,2),B=u(f,2),w=u(_,2);{var j=D=>{var P=Xc();g(D,P)},F=D=>{var P=Qc(),I=N(P,!0);z(()=>C(I,a(s))),g(D,P)};J(w,D=>{a(r)==="loading"?D(j):a(r)==="failed"&&D(F,1)})}var M=u(w,2);Is(M,D=>k(n,D),()=>a(n)),z((D,P)=>{ge(h,"href",D),ge(y,"href",P)},[()=>Qt("/openapi.json"),()=>Qt("/openapi.yaml")]),Q("click",B,function(...D){t.onclose?.apply(this,D)}),g(e,v),Xe()}ot(["click"]);function tu(){return{category:null,project:null,visibility:null}}function $s(e){const t=e?.can_create;if(!t)return[];const n=[];return t.personal&&n.push("personal"),t.project.length>0&&n.push("project"),t.foundation&&n.push("foundation"),n}function _a(e,t){const n=e?.can_create;return n?t==="private"?n.project_private:n.project:[]}function ga(e,t){if(e==="personal")return[];if(e==="foundation")return t?.can_create.foundation?["public","private"]:[];if(e==="project"){const n=t?.can_create;return n?n.project_private.length>0?["public","private"]:["public"]:[]}return[]}function nu(e,t){const n=[],r=$s(t);if(e.category===null?n.push("which calendar these events belong to"):r.includes(e.category)||n.push("a calendar you are allowed to add to"),e.category!==null&&e.category!=="personal"&&(e.visibility===null?n.push("whether they are public or private"):ga(e.category,t).includes(e.visibility)||n.push("a visibility you are allowed to use")),e.category==="project"){const s=_a(t,e.visibility);e.project===null?n.push("which project they belong to"):s.includes(e.project)||n.push("a project you are allowed to add to")}return{ready:n.length===0,missing:n}}function ru(e){if(e.category===null)throw new Error("resolveSettings called before a category was chosen");return{category:e.category,project:e.category==="project"?e.project:null,visibility:e.category==="personal"?null:e.visibility}}function au(e,t){const n={...e};return n.category!=="project"&&(n.project=null),n.category==="personal"&&(n.visibility=null),n.category==="project"&&n.project!==null&&(_a(t,n.visibility).includes(n.project)||(n.project=null)),n.visibility!==null&&n.category!==null&&(ga(n.category,t).includes(n.visibility)||(n.visibility=null)),n}function su(e){return/\.ics$/i.test(e.name)||e.type==="text/calendar"}var lu=b('<p class="error svelte-12rmzzv" role="alert"> </p>'),ou=b('<p class="note svelte-12rmzzv">Reading the file...</p>'),iu=b('<span class="muted"> </span>'),cu=b('<p class="warning svelte-12rmzzv"> </p>'),uu=b('<span class="where muted svelte-12rmzzv"> </span>'),vu=b('<span class="warning inline svelte-12rmzzv"> </span>'),fu=b('<li class="svelte-12rmzzv"><span class="title svelte-12rmzzv"> </span> <span class="when svelte-12rmzzv"> </span> <!> <!></li>'),Ir=b("<option> </option>"),du=b('<label class="row svelte-12rmzzv"><span class="svelte-12rmzzv">Visibility</span> <select><option>Choose...</option><!></select></label>'),hu=b('<label class="row svelte-12rmzzv"><span class="svelte-12rmzzv">Project</span> <select><option>Choose...</option><!></select></label>'),pu=b('<p class="muted small svelte-12rmzzv">Personal events are always private to you.</p>'),_u=b('<p class="missing svelte-12rmzzv" role="status"> </p>'),gu=b('<section class="preview svelte-12rmzzv"><h3 class="svelte-12rmzzv"> <!></h3> <!> <ul class="svelte-12rmzzv"></ul></section> <section class="settings svelte-12rmzzv"><h3 class="svelte-12rmzzv">Where should they go?</h3> <div class="pair svelte-12rmzzv"><label class="row svelte-12rmzzv"><span class="svelte-12rmzzv">Calendar</span> <select><option>Choose...</option><!></select></label> <!> <!></div> <!> <!></section>',1),mu=b('<div class="backdrop svelte-12rmzzv"><div class="dialog svelte-12rmzzv" role="dialog" tabindex="-1" aria-modal="true" aria-label="Import an iCalendar file"><h2 class="svelte-12rmzzv">Import events from a calendar file</h2> <!> <div><label class="btn svelte-12rmzzv">Choose a file <input type="file" accept=".ics,text/calendar" class="svelte-12rmzzv"/></label> <span class="muted"><!></span></div> <!> <!> <footer class="svelte-12rmzzv"><span class="spacer svelte-12rmzzv"></span> <button type="button" class="btn">Cancel</button> <button type="button" class="btn primary"><!></button></footer></div></div>');function wu(e,t){Je(t,!0);let n=Ye(t,"zone",3,"local"),r=ce(null),s=ce(null),l=ce(Ze(tu())),o=ce(!1),c=ce(!1),i=ce(null),v=ce(!1),_=ee(()=>$s(t.calendars)),f=ee(()=>ga(a(l).category,t.calendars)),d=ee(()=>_a(t.calendars,a(l).visibility)),h=ee(()=>nu(a(l),t.calendars)),y=ee(()=>a(s)!==null&&a(s).count>0&&a(h).ready&&!a(c));function B(m){k(l,au({...a(l),...m},t.calendars),!0)}async function w(m){if(m){k(r,m,!0),k(s,null),k(i,null),k(o,!0);try{k(s,await ct.previewImport(m),!0),su(m)||k(i,null)}catch(Y){k(i,Y instanceof Dt?Y.message:"That file could not be read.",!0),k(r,null)}finally{k(o,!1)}}}async function j(){if(!(!a(r)||!a(y))){k(c,!0),k(i,null);try{const m=await ct.runImport(a(r),ru(a(l)));t.onimported(m.count)}catch(m){k(i,m instanceof Dt?m.message:"Those events could not be saved.",!0)}finally{k(c,!1)}}}function F(m){m.preventDefault(),k(v,!1),w(m.dataTransfer?.files?.[0])}function M(m){m.key==="Escape"&&t.onclose()}function D(m){const Y=$t(new Date(m.start),n());if(m.all_day){const fe=$t(new Date(new Date(m.end).getTime()-1),n());return fe.toDateString()===Y.toDateString()?`${Be(Y)} (all day)`:`${Be(Y)} - ${Be(fe)} (all day)`}const se=$t(new Date(m.end),n());return`${Be(Y)}, ${Ue(Y)} - ${Ue(se)} ${Xn(n())}`}let P=ee(()=>(a(s)?.warnings.length??0)+(a(s)?.events??[]).reduce((m,Y)=>m+Y.warnings.length,0));var I=mu();gn("keydown",dr,M);var W=p(I),L=u(p(W),2);{var x=m=>{var Y=lu(),se=N(Y,!0);z(()=>C(se,a(i))),g(m,Y)};J(L,m=>{a(i)&&m(x)})}var T=u(L,2);let U;var V=p(T),S=u(p(V)),A=u(V,2),O=p(A);{var R=m=>{var Y=Mn();z(()=>C(Y,a(r).name)),g(m,Y)},te=m=>{var Y=Mn("or drop an .ics file here");g(m,Y)};J(O,m=>{a(r)?m(R):m(te,-1)})}var G=u(T,2);{var le=m=>{var Y=ou();g(m,Y)};J(G,m=>{a(o)&&m(le)})}var ae=u(G,2);{var q=m=>{var Y=gu(),se=un(Y),fe=p(se),ke=p(fe),Ne=u(ke);{var He=H=>{var Z=iu(),ne=N(Z);z(()=>C(ne,`- ${a(P)??""} thing${a(P)===1?"":"s"} to note`)),g(H,Z)};J(Ne,H=>{a(P)>0&&H(He)})}var je=u(fe,2);oe(je,16,()=>a(s).warnings,H=>H,(H,Z)=>{var ne=cu(),_e=N(ne,!0);z(()=>C(_e,Z)),g(H,ne)});var Re=u(je,2);oe(Re,23,()=>a(s).events,(H,Z)=>H.uid??Z,(H,Z)=>{var ne=fu(),_e=p(ne),be=N(_e,!0),Ee=u(_e,2),Se=N(Ee,!0),Qe=u(Ee,2);{var E=he=>{var $e=uu(),dn=N($e,!0);z(()=>C(dn,a(Z).location)),g(he,$e)};J(Qe,he=>{a(Z).location&&he(E)})}var re=u(Qe,2);oe(re,16,()=>a(Z).warnings,he=>he,(he,$e)=>{var dn=vu(),Sr=N(dn,!0);z(()=>C(Sr,$e)),g(he,dn)}),z(he=>{C(be,a(Z).title),C(Se,he)},[()=>D(a(Z))]),g(H,ne)});var st=u(se,2),pt=u(p(st),2),_t=p(pt),Te=u(p(_t),2),Oe=p(Te);Oe.value=Oe.__value="";var Tt=u(Oe);oe(Tt,16,()=>a(_),H=>H,(H,Z)=>{var ne=Ir(),_e=N(ne,!0),be={};z(Ee=>{C(_e,Ee),be!==(be=Z)&&(ne.value=(ne.__value=be)??"")},[()=>pa(Z)]),g(H,ne)});var gt;jt(Te);var qt=u(_t,2);{var me=H=>{var Z=du(),ne=u(p(Z),2),_e=p(ne);_e.value=_e.__value="";var be=u(_e);oe(be,16,()=>a(f),Se=>Se,(Se,Qe)=>{var E=Ir(),re=N(E,!0),he={};z(()=>{C(re,Qe),he!==(he=Qe)&&(E.value=(E.__value=he)??"")}),g(Se,E)});var Ee;jt(ne),z(()=>{Ee!==(Ee=a(l).visibility??"")&&(ne.value=(ne.__value=Ee)??"",Ot(ne,Ee))}),Q("change",ne,Se=>B({visibility:Se.currentTarget.value||null})),g(H,Z)};J(qt,H=>{a(l).category!==null&&a(l).category!=="personal"&&H(me)})}var Ae=u(qt,2);{var De=H=>{var Z=hu(),ne=u(p(Z),2),_e=p(ne);_e.value=_e.__value="";var be=u(_e);oe(be,16,()=>a(d),Se=>Se,(Se,Qe)=>{var E=Ir(),re=N(E,!0),he={};z(()=>{C(re,Qe),he!==(he=Qe)&&(E.value=(E.__value=he)??"")}),g(Se,E)});var Ee;jt(ne),z(()=>{Ee!==(Ee=a(l).project??"")&&(ne.value=(ne.__value=Ee)??"",Ot(ne,Ee))}),Q("change",ne,Se=>B({project:Se.currentTarget.value||null})),g(H,Z)};J(Ae,H=>{a(l).category==="project"&&H(De)})}var Fe=u(pt,2);{var Et=H=>{var Z=pu();g(H,Z)};J(Fe,H=>{a(l).category==="personal"&&H(Et)})}var Nt=u(Fe,2);{var $=H=>{var Z=_u(),ne=N(Z);z(_e=>C(ne,`Still to choose: ${_e??""}.`),[()=>a(h).missing.join(", ")]),g(H,Z)};J(Nt,H=>{a(h).ready||H($)})}z(()=>{C(ke,`${a(s).count??""} - ${a(s).count===1?"event":"events"} found `),gt!==(gt=a(l).category??"")&&(Te.value=(Te.__value=gt)??"",Ot(Te,gt))}),Q("change",Te,H=>B({category:H.currentTarget.value||null})),g(m,Y)};J(ae,m=>{a(s)&&m(q)})}var X=u(ae,2),ie=u(p(X),2),ve=u(ie,2),we=p(ve);{var xe=m=>{var Y=Mn("Importing...");g(m,Y)},ye=m=>{var Y=Mn();z(()=>C(Y,`Import ${a(s).count??""} ${a(s).count===1?"event":"events"}`)),g(m,Y)},K=m=>{var Y=Mn("Import");g(m,Y)};J(we,m=>{a(c)?m(xe):a(s)?m(ye,1):m(K,-1)})}z(()=>{U=Ie(T,1,"dropzone svelte-12rmzzv",null,U,{dragging:a(v)}),ie.disabled=a(c),ve.disabled=!a(y)}),Q("click",I,function(...m){t.onclose?.apply(this,m)}),Q("click",W,m=>m.stopPropagation()),gn("dragover",T,m=>{m.preventDefault(),k(v,!0)}),gn("dragleave",T,()=>k(v,!1)),gn("drop",T,F),Q("change",S,m=>w(m.currentTarget.files?.[0])),Q("click",ie,function(...m){t.onclose?.apply(this,m)}),Q("click",ve,j),g(e,I),Xe()}ot(["click","change"]);var bu=b('<p class="banner svelte-1n46o8q" role="alert"> <button type="button" class="btn">Dismiss</button></p>'),yu=b('<!> <main class="svelte-1n46o8q"><!></main>',1),ku=b('<div class="layout svelte-1n46o8q"><!> <!> <div class="body svelte-1n46o8q"><!></div></div> <!> <!>',1);function xu(e,t){Je(t,!0);const n="asf-calendar-view",r="asf-calendar-zone",s="asf-calendar-alt-zone",l="asf-calendar-compare-zones",o=3,c=/^\/e\/([A-Za-z0-9]+)\/?$/,i="/help",v="/docs";function _(){return Rs(globalThis.location?.pathname??"/")}function f(E){try{return globalThis.localStorage?.getItem(E)??null}catch{return null}}function d(E,re){try{globalThis.localStorage?.setItem(E,re)}catch{}}function h(){const E=f(n);return qs.includes(E??"")?E:"month"}function y(){return Rn(f(r),ft)}function B(){const E=Rn(f(s),Ke);return E===ft?Ke:E}function w(){const E=f(l);return E?Or(E.split(",").map(re=>Rn(re,"")).filter(re=>!!re)).slice(0,o):[]}function j(){return!!f(r)}let F=ce(Ze(h())),M=ce(Ze(y())),D=ce(Ze(B())),P=ce(Ze(w())),I=ce(Ze(We(en(y())))),W=ce(_()===i),L=ce(_()===v),x=ce(Ze([])),T=ce(null),U=ce(null),V=ce(Ze(Na(null))),S=ce(!1),A=ce(!1),O=ce(null),R=ce(null),te=ce(!0),G=ce(null),le=ce(null),ae=ce(!1),q=ee(()=>$o(a(F),a(I))),X=ee(()=>mi(a(x),a(U))),ie=ee(()=>gi(_i(a(x),a(V),a(X)),a(V).sort,a(M))),ve=ee(()=>a(U)?.title??"ASF Community Calendar"),we=ee(()=>a(G)?xi(a(G),a(U)):!1),xe=ee(()=>ct.feedUrl({start:Kt(a(q).start,a(M)),end:Kt(a(q).end,a(M)),categories:[...a(V).categories],visibility:a(V).visibility,q:a(V).search||void 0}));async function ye(){try{const[E,re]=await Promise.all([ct.session(),ct.calendars()]);k(T,E,!0),k(U,re,!0),k(V,Na(re),!0),j()||k(M,Rn(re.default_display_zone,a(M)),!0)}catch(E){k(O,E instanceof Dt?E.message:String(E),!0)}}let K=0;async function m(E,re){const he=++K;k(S,!0);try{const $e=await ct.events({start:E,end:re});he===K&&(k(x,$e,!0),k(O,null))}catch($e){he===K&&k(O,$e instanceof Dt?$e.message:String($e),!0)}finally{he===K&&k(S,!1)}}At(()=>{const E=Kt(a(q).start,a(M)),re=Kt(a(q).end,a(M));m(E,re)}),At(()=>{d(n,a(F))}),At(()=>{d(r,a(M))}),At(()=>{d(s,a(D))}),At(()=>{d(l,a(P).join(","))});async function Y(){const E=_();if(E===null)return;k(W,E===i),k(L,E===v);const re=c.exec(E);if(re)try{const he=await ct.byShortlink(re[1]);k(G,he,!0),k(I,We($t(new Date(he.start),a(M))),!0)}catch(he){k(O,he instanceof Dt&&he.needsLogin?"That event is not public. Log in to see whether you have access.":"That shortlink does not point at an event you can see.",!0)}}function se(E){if(!globalThis.history)return;const re=Wt(E);globalThis.location.pathname!==re&&globalThis.history.pushState({},"",re)}function fe(E){if(!globalThis.location)return;if(!E){se("/");return}const re=new URL(E.shortlink_url,globalThis.location.href).pathname;globalThis.location.pathname!==re&&globalThis.history.pushState({},"",re)}At(()=>{Y();const E=()=>{Y()};return globalThis.addEventListener?.("popstate",E),()=>globalThis.removeEventListener?.("popstate",E)}),ye();function ke(E){k(G,E,!0),k(le,null),k(R,null),fe(E)}function Ne(){k(G,null),k(le,null),k(R,null),fe(null)}function He(E=en(a(M))){k(G,null),k(R,null),k(W,!1),k(L,!1),k(le,yi(Kt(E,a(M)),a(U)),!0)}function je(){k(G,null),k(le,null),k(R,null),k(W,!1),k(L,!1),k(ae,!0)}async function Re(E){k(ae,!1),await m(Kt(a(q).start,a(M)),Kt(a(q).end,a(M))),k(O,E===0?"Nothing was imported.":null,!0)}function st(){a(G)&&k(le,ki(a(G)),!0)}async function pt(E){k(A,!0),k(R,null);try{const re=a(G)?await ct.update(a(G).id,E):await ct.create(E);k(x,[...a(x).filter(he=>he.id!==re.id),re],!0),k(G,re,!0),k(le,null),fe(re)}catch(re){k(R,re instanceof Dt?re.message:String(re),!0)}finally{k(A,!1)}}async function _t(){if(a(G)&&globalThis.confirm?.(`Delete "${a(G).title}"? This cannot be undone.`)){k(A,!0),k(R,null);try{await ct.remove(a(G).id),k(x,a(x).filter(E=>E.id!==a(G).id),!0),Ne()}catch(E){k(R,E instanceof Dt?E.message:String(E),!0)}finally{k(A,!1)}}}function Te(E){k(I,We(E),!0),k(F,"day")}function Oe(E){k(I,We(E),!0),k(F,"month")}function Tt(E){k(M,E,!0),k(P,Or(a(P),E),!0)}function gt(E){k(P,Or(E,a(M)).slice(0,o),!0)}function qt(){k(W,!a(W)),a(W)&&k(L,!1),se(a(W)?i:"/")}function me(){k(L,!a(L)),a(L)&&k(W,!1),se(a(L)?v:"/")}var Ae=ku(),De=un(Ae),Fe=p(De);{let E=ee(()=>bi(a(U)));Li(Fe,{get title(){return a(ve)},get view(){return a(F)},get cursor(){return a(I)},get session(){return a(T)},get loading(){return a(S)},get canCreate(){return a(E)},get zone(){return a(M)},get alternateZone(){return a(D)},get helpOpen(){return a(W)},get docsOpen(){return a(L)},onview:re=>{k(F,re,!0),k(W,!1),k(L,!1)},onstep:re=>k(I,ei(a(F),a(I),re),!0),ontoday:()=>k(I,We(en(a(M))),!0),oncreate:()=>He(a(I)),onimport:je,ontogglefilters:()=>k(te,!a(te)),onzone:Tt,onalternatezone:re=>k(D,re,!0),onhelp:qt,ondocs:me})}var Et=u(Fe,2);{var Nt=E=>{var re=bu(),he=p(re),$e=u(he);z(()=>C(he,`${a(O)??""} `)),Q("click",$e,()=>k(O,null)),g(E,re)};J(Et,E=>{a(O)&&E(Nt)})}var $=u(Et,2),H=p($);{var Z=E=>{Jc(E,{get calendars(){return a(U)},get session(){return a(T)},get zone(){return a(M)},get compareZones(){return a(P)},onclose:qt})},ne=E=>{eu(E,{onclose:me})},_e=E=>{var re=yu(),he=un(re);{var $e=Me=>{Bi(Me,{get filters(){return a(V)},get calendars(){return a(U)},get projects(){return a(X)},get view(){return a(F)},get feedUrl(){return a(xe)},get zone(){return a(M)},get compareZones(){return a(P)},maxCompareZones:o,onchange:sl=>k(V,sl,!0),oncomparezones:gt})};J(he,Me=>{a(te)&&Me($e)})}var dn=u(he,2),Sr=p(dn);{var el=Me=>{ec(Me,{get cursor(){return a(I)},get events(){return a(ie)},get zone(){return a(M)},onselect:ke,onpickday:Te})},tl=Me=>{Ha(Me,{get cursor(){return a(I)},get events(){return a(ie)},get zone(){return a(M)},get compareZones(){return a(P)},onselect:ke,onpickday:Te})},nl=Me=>{Ha(Me,{get cursor(){return a(I)},get events(){return a(ie)},get zone(){return a(M)},get compareZones(){return a(P)},days:1,onselect:ke,onpickday:Te})},rl=Me=>{_c(Me,{get cursor(){return a(I)},get events(){return a(ie)},get zone(){return a(M)},onpickday:Te,onpickmonth:Oe})},al=Me=>{Tc(Me,{get events(){return a(ie)},get zone(){return a(M)},get compareZones(){return a(P)},onselect:ke})};J(Sr,Me=>{a(F)==="month"?Me(el):a(F)==="week"?Me(tl,1):a(F)==="day"?Me(nl,2):a(F)==="year"?Me(rl,3):Me(al,-1)})}g(E,re)};J(H,E=>{a(W)?E(Z):a(L)?E(ne,1):E(_e,-1)})}var be=u(De,2);{var Ee=E=>{wu(E,{get calendars(){return a(U)},get zone(){return a(M)},onclose:()=>k(ae,!1),onimported:Re})};J(be,E=>{a(ae)&&E(Ee)})}var Se=u(be,2);{var Qe=E=>{Rc(E,{get event(){return a(G)},get draft(){return a(le)},get calendars(){return a(U)},get saving(){return a(A)},get error(){return a(R)},get editable(){return a(we)},get zone(){return a(M)},get compareZones(){return a(P)},onclose:Ne,onedit:st,onsave:pt,ondelete:_t})};J(Se,E=>{(a(G)||a(le))&&E(Qe)})}g(e,Ae),Xe()}ot(["click"]);const Ba="/embed/agenda",Tu=60,Eu=20,Su=366,Au=100;function zu(e){const t=Rs(e);return t===Ba||t===`${Ba}/`}function Du(e,t,n){return Math.min(n,Math.max(t,e))}function Wa(e,t,n,r,s){const l=e.get(t);if(l===null||l.trim()==="")return n;const o=Number(l);return Number.isFinite(o)?Du(Math.trunc(o),r,s):n}function qr(e,t,n){const r=e.get(t);return r===null?n:r===""?!0:!["0","false","no","off"].includes(r.trim().toLowerCase())}function Va(e,...t){const n=[];for(const r of t)for(const s of e.getAll(r))n.push(...s.split(",").map(l=>l.trim()));return n.filter(Boolean)}function Cu(e){const t=new URLSearchParams(e.startsWith("?")?e.slice(1):e),n=Va(t,"category","categories").map(i=>i.toLowerCase()).filter(i=>ca.includes(i)),r=(t.get("theme")??"auto").toLowerCase(),s=r==="light"||r==="dark"?r:"auto",l=t.get("zone"),o=l&&(l.toLowerCase()===ft||Gs(l))?Rn(l,ft):ft,c=t.get("title");return{categories:n,projects:Va(t,"project","projects").map(i=>i.toLowerCase()),days:Wa(t,"days",Tu,1,Su),limit:Wa(t,"limit",Eu,1,Au),search:t.get("q")?.trim()??"",zone:o,title:c===null?null:c.trim()||null,showZone:qr(t,"showzone",!0),transparent:qr(t,"transparent",!1),theme:s,showCredit:qr(t,"credit",!0)}}const ju="asf-calendar-embed:height";function Mu(e){return{type:ju,height:Math.ceil(e)}}var Pu=b('<h1 class="svelte-15ivk09"> </h1>'),Lu=b('<p class="note svelte-15ivk09">Loading events...</p>'),Ou=b('<p class="note error svelte-15ivk09" role="alert"> </p>'),Iu=b('<p class="note svelte-15ivk09">No events coming up.</p>'),qu=b('<span class="where"> </span>'),Nu=b('<li class="svelte-15ivk09"><a target="_blank" rel="noopener noreferrer" class="svelte-15ivk09"><span class="when svelte-15ivk09"> </span> <span class="title svelte-15ivk09"> </span></a> <span class="meta svelte-15ivk09"><span class="tag svelte-15ivk09"> </span> <!></span></li>'),Ru=b('<section class="svelte-15ivk09"><h2 class="svelte-15ivk09"> </h2> <ul class="svelte-15ivk09"></ul></section>'),Fu=b('<p class="zone svelte-15ivk09"> </p>'),Uu=b('<p class="credit svelte-15ivk09"><a target="_blank" rel="noopener noreferrer" class="svelte-15ivk09">ASF Community Calendar</a></p>'),Hu=b("<div><!> <!> <!> <!></div>");function Yu(e,t){Je(t,!0);let n=Ye(t,"search",19,()=>globalThis.location?.search??""),r=ee(()=>Cu(n())),s=ce(Ze([])),l=ce(!0),o=ce(null),c=ee(()=>Ks(a(s),a(r).zone)),i=ce(null);async function v(){k(l,!0);const x=We(en(a(r).zone));try{k(s,await ct.events({start:x,end:Ht(x,a(r).days),categories:a(r).categories,projects:a(r).projects,q:a(r).search||void 0,sort:"start",limit:a(r).limit}),!0),k(o,null)}catch(T){k(o,T instanceof Dt?T.message:"The calendar could not be reached.",!0)}finally{k(l,!1)}}At(()=>{a(r),v()}),At(()=>{if(!a(i))return;a(c),a(l);const x=()=>{const U=Math.max(a(i)?.scrollHeight??0,globalThis.document?.documentElement?.scrollHeight??0);globalThis.parent?.postMessage(Mu(U),"*")};if(x(),typeof ResizeObserver>"u")return;const T=new ResizeObserver(x);return T.observe(a(i)),()=>T.disconnect()});function _(x){return`${kr[(x.getDay()+6)%7]} ${x.getDate()} ${vn[x.getMonth()]}`}function f(x){return x.all_day?"All day":`${Ue(at(x,a(r).zone))} - ${Ue(Qn(x,a(r).zone))}`}var d=Hu();let h;var y=p(d);{var B=x=>{var T=Pu(),U=N(T,!0);z(()=>C(U,a(r).title)),g(x,T)};J(y,x=>{a(r).title&&x(B)})}var w=u(y,2);{var j=x=>{var T=Lu();g(x,T)},F=x=>{var T=Ou(),U=N(T,!0);z(()=>C(U,a(o))),g(x,T)},M=x=>{var T=Iu();g(x,T)},D=x=>{var T=To(),U=un(T);oe(U,17,()=>a(c),V=>V.key,(V,S)=>{var A=Ru(),O=p(A),R=N(O,!0),te=u(O,2);oe(te,21,()=>a(S).events,G=>G.id,(G,le)=>{var ae=Nu(),q=p(ae),X=p(q),ie=N(X,!0),ve=u(X,2),we=N(ve,!0),xe=u(q,2),ye=p(xe),K=N(ye,!0),m=u(ye,2);{var Y=se=>{var fe=qu(),ke=N(fe,!0);z(()=>C(ke,a(le).location)),g(se,fe)};J(m,se=>{a(le).location&&se(Y)})}z((se,fe,ke)=>{Bt(ae,`--hue: ${se??""}`),ge(q,"href",a(le).shortlink_url),C(ie,fe),C(we,a(le).title),C(K,ke)},[()=>jn(a(le)),()=>f(a(le)),()=>Er(a(le))]),g(G,ae)}),z(G=>C(R,G),[()=>_(a(S).date)]),g(V,A)}),g(x,T)};J(w,x=>{a(l)?x(j):a(o)?x(F,1):a(c).length===0?x(M,2):x(D,-1)})}var P=u(w,2);{var I=x=>{var T=Fu(),U=N(T);z((V,S)=>{ge(T,"title",V),C(U,`Times shown in ${S??""}`)},[()=>An(a(r).zone),()=>Xn(a(r).zone)]),g(x,T)};J(P,x=>{a(r).showZone&&!a(l)&&!a(o)&&x(I)})}var W=u(P,2);{var L=x=>{var T=Uu(),U=N(T);z(V=>ge(U,"href",V),[()=>Wt("/")]),g(x,T)};J(W,x=>{a(r).showCredit&&x(L)})}Is(d,x=>k(i,x),()=>a(i)),z(()=>{h=Ie(d,1,"embed svelte-15ivk09",null,h,{transparent:a(r).transparent}),ge(d,"data-theme",a(r).theme==="auto"?null:a(r).theme)}),g(e,d),Xe()}const Kr=document.getElementById("app");if(!Kr)throw new Error("No #app element to mount into");function Zu(){return zu(globalThis.location?.pathname??"/")?(document.documentElement.classList.add("embedded"),Sa(Yu,{target:Kr})):Sa(xu,{target:Kr})}Zu(); -//# sourceMappingURL=index-DwsHFb2B.js.map + in; the lists are read when you sign in.</p></section> <footer class="svelte-rmw6w0"><button type="button" class="btn primary">Back to the calendar</button></footer></div></div>`);function Jc(e,t){Je(t,!0);let n=Ye(t,"compareZones",19,()=>[]);const r=["Anyone","Project member","Committee member","Foundation member"],s=[{what:"See public project events",cells:[!0,!0,!0,!0]},{what:"See public foundation events",cells:[!0,!0,!0,!0]},{what:"Subscribe to the iCalendar feed",cells:[!0,!0,!0,!0]},{what:"Open an event by its shortlink",cells:["public events",!0,!0,!0]},{what:"Keep personal events",cells:[!1,!0,!0,!0]},{what:"Add and edit public events for a project",cells:[!1,"own projects","own projects","own projects"]},{what:"See private events of a project",cells:[!1,!1,"own committees","own committees"]},{what:"Add and edit private project events",cells:[!1,!1,"own committees","own committees"]},{what:"See private foundation events",cells:[!1,!1,!1,!0]},{what:"Add and edit foundation events",cells:[!1,!1,!1,!0]}];let l=ee(()=>`${globalThis.location?.origin??""}${Vt("/embed/agenda")}?project=httpd&limit=8`),o=ee(()=>{if(!t.calendars?.authenticated)return"You are browsing anonymously, so you can see public events only.";const K=[];return t.calendars.projects.length>0&&K.push(`a member of ${t.calendars.projects.join(", ")}`),t.calendars.committees.length>0&&K.push(`on the ${t.calendars.committees.join(", ")} committee${t.calendars.committees.length>1?"s":""}`),t.calendars.is_member&&K.push("a foundation member"),K.length===0?`You are signed in as ${t.calendars.uid}.`:`You are signed in as ${t.calendars.uid}, ${K.join(", and ")}.`});var c=Kc(),i=p(c),v=p(i),_=u(p(v),2),f=u(v,2),d=N(f,!0),h=u(f,4),y=u(p(h),4),Y=p(y),w=p(Y),j=p(w),F=u(p(j));oe(F,16,()=>r,K=>K,(K,m)=>{var H=Fc(),se=N(H,!0);z(()=>C(se,m)),g(K,H)});var M=u(w);oe(M,21,()=>s,K=>K.what,(K,m)=>{var H=Bc(),se=p(H),fe=N(se,!0),ke=u(se);oe(ke,17,()=>a(m).cells,Ut,(Ne,He)=>{var je=Zc(),Re=p(je);{var st=Te=>{var Oe=Uc();g(Te,Oe)},pt=Te=>{var Oe=Hc();g(Te,Oe)},_t=Te=>{var Oe=Yc(),Tt=N(Oe,!0);z(()=>C(Tt,a(He))),g(Te,Oe)};J(Re,Te=>{a(He)===!0?Te(st):a(He)===!1?Te(pt,1):Te(_t,-1)})}g(Ne,je)}),z(()=>C(fe,a(m).what)),g(K,H)});var D=u(h,6),P=u(p(D),4),I=p(P),Z=u(p(I),5),L=N(Z,!0),x=u(Z),T=u(x),U=N(T,!0),V=u(I,2),S=u(p(V),2);{var A=K=>{var m=Wc(),H=u(vn(m)),se=N(H,!0);z(fe=>C(se,fe),[()=>n().map(fe=>tt(fe)).join(", ")]),g(K,m)};J(S,K=>{n().length>0&&K(A)})}var O=u(D,8),R=u(p(O),4),te=N(R),G=u(O,2),le=u(p(G),4),ae=u(p(le)),q=u(ae,2),X=u(G,2),ie=u(p(X),2);{var ve=K=>{var m=Vc(),H=u(p(m));z(se=>ge(H,"href",se),[()=>t.session.logout_url??Hs()]),g(K,m)},we=K=>{var m=Gc(),H=p(m);z(se=>ge(H,"href",se),[()=>t.session?.login_url??Us()]),g(K,m)};J(ie,K=>{t.session?.authenticated?K(ve):K(we,-1)})}var xe=u(X,2),ye=N(xe);z((K,m,H,se,fe)=>{C(d,a(o)),C(L,K),C(x,` - ${m??""} - and the picker beside + it holds any of the major timezones, starting on UTC. It is currently set to `),C(U,H),C(te,`<iframe src="${a(l)??""}" width="100%" height="420"></iframe>`),ge(ae,"href",se),ge(q,"href",fe)},[()=>dn(),()=>An("local"),()=>An(t.zone),()=>$t("/openapi.json"),()=>$t("/openapi.yaml")]),Q("click",_,function(...K){t.onclose?.apply(this,K)}),Q("click",ye,function(...K){t.onclose?.apply(this,K)}),g(e,c),Xe()}ot(["click"]);var Xc=b('<p class="note svelte-fzlhf">Loading the API documentation...</p>'),Qc=b('<p class="note error svelte-fzlhf" role="alert"> </p>'),$c=b(`<div class="docs svelte-fzlhf"><header class="svelte-fzlhf"><div><h2 class="svelte-fzlhf">HTTP API</h2> <p class="muted svelte-fzlhf">Generated from the running service, so it always describes this deployment. Machine-readable + copies: <a>openapi.json</a> and <a>openapi.yaml</a>.</p></div> <button type="button" class="btn">Back to the calendar</button></header> <!> <div class="swagger svelte-fzlhf"></div></div>`);function eu(e,t){Je(t,!0);let n=ce(null),r=ce("loading"),s=ce(null);const l="vendor/swagger-ui-bundle.js",o="vendor/swagger-ui.css";function c(D){const P=document.querySelector(`script[data-swagger="${D}"]`);return P?P.dataset.loaded==="yes"?Promise.resolve():new Promise((I,Z)=>{P.addEventListener("load",()=>I()),P.addEventListener("error",()=>Z(new Error(D)))}):new Promise((I,Z)=>{const L=document.createElement("script");L.src=D,L.async=!0,L.dataset.swagger=D,L.addEventListener("load",()=>{L.dataset.loaded="yes",I()}),L.addEventListener("error",()=>Z(new Error(D))),document.head.appendChild(L)})}function i(D){const P=document.createElement("link");return P.rel="stylesheet",P.href=D,P.dataset.swagger="styles",document.head.appendChild(P),P}At(()=>{if(!a(n))return;const D=i(Vr(o));let P=!1;return(async()=>{try{await c(Vr(l));const I=globalThis.SwaggerUIBundle;if(!I)throw new Error("SwaggerUIBundle did not register itself");if(P||!a(n))return;I({url:$t("/openapi.json"),domNode:a(n),deepLinking:!1,docExpansion:"list",defaultModelsExpandDepth:1,tryItOutEnabled:!0,persistAuthorization:!1,supportedSubmitMethods:["get","post","put","patch","delete"],requestInterceptor:Z=>(Z.headers["X-No-Redirect"]="1",Z.credentials="same-origin",Z)}),k(r,"ready")}catch(I){k(s,I instanceof Error&&I.message.includes(l)?"Swagger UI could not be loaded. If this is a development server, run 'npm run build' in frontend/ so the vendored files are in place.":"Swagger UI could not be started.",!0),k(r,"failed")}})(),()=>{P=!0,D.remove()}});var v=$c(),_=p(v),f=p(_),d=u(p(f),2),h=u(p(d)),y=u(h,2),Y=u(f,2),w=u(_,2);{var j=D=>{var P=Xc();g(D,P)},F=D=>{var P=Qc(),I=N(P,!0);z(()=>C(I,a(s))),g(D,P)};J(w,D=>{a(r)==="loading"?D(j):a(r)==="failed"&&D(F,1)})}var M=u(w,2);Is(M,D=>k(n,D),()=>a(n)),z((D,P)=>{ge(h,"href",D),ge(y,"href",P)},[()=>$t("/openapi.json"),()=>$t("/openapi.yaml")]),Q("click",Y,function(...D){t.onclose?.apply(this,D)}),g(e,v),Xe()}ot(["click"]);function tu(){return{category:null,project:null,visibility:null}}function $s(e){const t=e?.can_create;if(!t)return[];const n=[];return t.personal&&n.push("personal"),t.project.length>0&&n.push("project"),t.foundation&&n.push("foundation"),n}function _a(e,t){const n=e?.can_create;return n?t==="private"?n.project_private:n.project:[]}function ga(e,t){if(e==="personal")return[];if(e==="foundation")return t?.can_create.foundation?["public","private"]:[];if(e==="project"){const n=t?.can_create;return n?n.project_private.length>0?["public","private"]:["public"]:[]}return[]}function nu(e,t){const n=[],r=$s(t);if(e.category===null?n.push("which calendar these events belong to"):r.includes(e.category)||n.push("a calendar you are allowed to add to"),e.category!==null&&e.category!=="personal"&&(e.visibility===null?n.push("whether they are public or private"):ga(e.category,t).includes(e.visibility)||n.push("a visibility you are allowed to use")),e.category==="project"){const s=_a(t,e.visibility);e.project===null?n.push("which project they belong to"):s.includes(e.project)||n.push("a project you are allowed to add to")}return{ready:n.length===0,missing:n}}function ru(e){if(e.category===null)throw new Error("resolveSettings called before a category was chosen");return{category:e.category,project:e.category==="project"?e.project:null,visibility:e.category==="personal"?null:e.visibility}}function au(e,t){const n={...e};return n.category!=="project"&&(n.project=null),n.category==="personal"&&(n.visibility=null),n.category==="project"&&n.project!==null&&(_a(t,n.visibility).includes(n.project)||(n.project=null)),n.visibility!==null&&n.category!==null&&(ga(n.category,t).includes(n.visibility)||(n.visibility=null)),n}function su(e){return/\.ics$/i.test(e.name)||e.type==="text/calendar"}var lu=b('<p class="error svelte-12rmzzv" role="alert"> </p>'),ou=b('<p class="note svelte-12rmzzv">Reading the file...</p>'),iu=b('<span class="muted"> </span>'),cu=b('<p class="warning svelte-12rmzzv"> </p>'),uu=b('<span class="where muted svelte-12rmzzv"> </span>'),vu=b('<span class="warning inline svelte-12rmzzv"> </span>'),fu=b('<li class="svelte-12rmzzv"><span class="title svelte-12rmzzv"> </span> <span class="when svelte-12rmzzv"> </span> <!> <!></li>'),Ir=b("<option> </option>"),du=b('<label class="row svelte-12rmzzv"><span class="svelte-12rmzzv">Visibility</span> <select><option>Choose...</option><!></select></label>'),hu=b('<label class="row svelte-12rmzzv"><span class="svelte-12rmzzv">Project</span> <select><option>Choose...</option><!></select></label>'),pu=b('<p class="muted small svelte-12rmzzv">Personal events are always private to you.</p>'),_u=b('<p class="missing svelte-12rmzzv" role="status"> </p>'),gu=b('<section class="preview svelte-12rmzzv"><h3 class="svelte-12rmzzv"> <!></h3> <!> <ul class="svelte-12rmzzv"></ul></section> <section class="settings svelte-12rmzzv"><h3 class="svelte-12rmzzv">Where should they go?</h3> <div class="pair svelte-12rmzzv"><label class="row svelte-12rmzzv"><span class="svelte-12rmzzv">Calendar</span> <select><option>Choose...</option><!></select></label> <!> <!></div> <!> <!></section>',1),mu=b('<div class="backdrop svelte-12rmzzv"><div class="dialog svelte-12rmzzv" role="dialog" tabindex="-1" aria-modal="true" aria-label="Import an iCalendar file"><h2 class="svelte-12rmzzv">Import events from a calendar file</h2> <!> <div><label class="btn svelte-12rmzzv">Choose a file <input type="file" accept=".ics,text/calendar" class="svelte-12rmzzv"/></label> <span class="muted"><!></span></div> <!> <!> <footer class="svelte-12rmzzv"><span class="spacer svelte-12rmzzv"></span> <button type="button" class="btn">Cancel</button> <button type="button" class="btn primary"><!></button></footer></div></div>');function wu(e,t){Je(t,!0);let n=Ye(t,"zone",3,"local"),r=ce(null),s=ce(null),l=ce(Ze(tu())),o=ce(!1),c=ce(!1),i=ce(null),v=ce(!1),_=ee(()=>$s(t.calendars)),f=ee(()=>ga(a(l).category,t.calendars)),d=ee(()=>_a(t.calendars,a(l).visibility)),h=ee(()=>nu(a(l),t.calendars)),y=ee(()=>a(s)!==null&&a(s).count>0&&a(h).ready&&!a(c));function Y(m){k(l,au({...a(l),...m},t.calendars),!0)}async function w(m){if(m){k(r,m,!0),k(s,null),k(i,null),k(o,!0);try{k(s,await ct.previewImport(m),!0),su(m)||k(i,null)}catch(H){k(i,H instanceof Dt?H.message:"That file could not be read.",!0),k(r,null)}finally{k(o,!1)}}}async function j(){if(!(!a(r)||!a(y))){k(c,!0),k(i,null);try{const m=await ct.runImport(a(r),ru(a(l)));t.onimported(m.count)}catch(m){k(i,m instanceof Dt?m.message:"Those events could not be saved.",!0)}finally{k(c,!1)}}}function F(m){m.preventDefault(),k(v,!1),w(m.dataTransfer?.files?.[0])}function M(m){m.key==="Escape"&&t.onclose()}function D(m){const H=en(new Date(m.start),n());if(m.all_day){const fe=en(new Date(new Date(m.end).getTime()-1),n());return fe.toDateString()===H.toDateString()?`${Be(H)} (all day)`:`${Be(H)} - ${Be(fe)} (all day)`}const se=en(new Date(m.end),n());return`${Be(H)}, ${Ue(H)} - ${Ue(se)} ${Xn(n())}`}let P=ee(()=>(a(s)?.warnings.length??0)+(a(s)?.events??[]).reduce((m,H)=>m+H.warnings.length,0));var I=mu();mn("keydown",dr,M);var Z=p(I),L=u(p(Z),2);{var x=m=>{var H=lu(),se=N(H,!0);z(()=>C(se,a(i))),g(m,H)};J(L,m=>{a(i)&&m(x)})}var T=u(L,2);let U;var V=p(T),S=u(p(V)),A=u(V,2),O=p(A);{var R=m=>{var H=Mn();z(()=>C(H,a(r).name)),g(m,H)},te=m=>{var H=Mn("or drop an .ics file here");g(m,H)};J(O,m=>{a(r)?m(R):m(te,-1)})}var G=u(T,2);{var le=m=>{var H=ou();g(m,H)};J(G,m=>{a(o)&&m(le)})}var ae=u(G,2);{var q=m=>{var H=gu(),se=vn(H),fe=p(se),ke=p(fe),Ne=u(ke);{var He=W=>{var B=iu(),ne=N(B);z(()=>C(ne,`- ${a(P)??""} thing${a(P)===1?"":"s"} to note`)),g(W,B)};J(Ne,W=>{a(P)>0&&W(He)})}var je=u(fe,2);oe(je,17,()=>a(s).warnings,Ut,(W,B)=>{var ne=cu(),pe=N(ne,!0);z(()=>C(pe,a(B))),g(W,ne)});var Re=u(je,2);oe(Re,21,()=>a(s).events,Ut,(W,B)=>{var ne=fu(),pe=p(ne),be=N(pe,!0),Ee=u(pe,2),Se=N(Ee,!0),Qe=u(Ee,2);{var E=_e=>{var $e=uu(),hn=N($e,!0);z(()=>C(hn,a(B).location)),g(_e,$e)};J(Qe,_e=>{a(B).location&&_e(E)})}var re=u(Qe,2);oe(re,17,()=>a(B).warnings,Ut,(_e,$e)=>{var hn=vu(),Sr=N(hn,!0);z(()=>C(Sr,a($e))),g(_e,hn)}),z(_e=>{C(be,a(B).title),C(Se,_e)},[()=>D(a(B))]),g(W,ne)});var st=u(se,2),pt=u(p(st),2),_t=p(pt),Te=u(p(_t),2),Oe=p(Te);Oe.value=Oe.__value="";var Tt=u(Oe);oe(Tt,16,()=>a(_),W=>W,(W,B)=>{var ne=Ir(),pe=N(ne,!0),be={};z(Ee=>{C(pe,Ee),be!==(be=B)&&(ne.value=(ne.__value=be)??"")},[()=>pa(B)]),g(W,ne)});var gt;jt(Te);var qt=u(_t,2);{var me=W=>{var B=du(),ne=u(p(B),2),pe=p(ne);pe.value=pe.__value="";var be=u(pe);oe(be,16,()=>a(f),Se=>Se,(Se,Qe)=>{var E=Ir(),re=N(E,!0),_e={};z(()=>{C(re,Qe),_e!==(_e=Qe)&&(E.value=(E.__value=_e)??"")}),g(Se,E)});var Ee;jt(ne),z(()=>{Ee!==(Ee=a(l).visibility??"")&&(ne.value=(ne.__value=Ee)??"",Ot(ne,Ee))}),Q("change",ne,Se=>Y({visibility:Se.currentTarget.value||null})),g(W,B)};J(qt,W=>{a(l).category!==null&&a(l).category!=="personal"&&W(me)})}var Ae=u(qt,2);{var De=W=>{var B=hu(),ne=u(p(B),2),pe=p(ne);pe.value=pe.__value="";var be=u(pe);oe(be,16,()=>a(d),Se=>Se,(Se,Qe)=>{var E=Ir(),re=N(E,!0),_e={};z(()=>{C(re,Qe),_e!==(_e=Qe)&&(E.value=(E.__value=_e)??"")}),g(Se,E)});var Ee;jt(ne),z(()=>{Ee!==(Ee=a(l).project??"")&&(ne.value=(ne.__value=Ee)??"",Ot(ne,Ee))}),Q("change",ne,Se=>Y({project:Se.currentTarget.value||null})),g(W,B)};J(Ae,W=>{a(l).category==="project"&&W(De)})}var Fe=u(pt,2);{var Et=W=>{var B=pu();g(W,B)};J(Fe,W=>{a(l).category==="personal"&&W(Et)})}var Nt=u(Fe,2);{var $=W=>{var B=_u(),ne=N(B);z(pe=>C(ne,`Still to choose: ${pe??""}.`),[()=>a(h).missing.join(", ")]),g(W,B)};J(Nt,W=>{a(h).ready||W($)})}z(()=>{C(ke,`${a(s).count??""} + ${a(s).count===1?"event":"events"} found `),gt!==(gt=a(l).category??"")&&(Te.value=(Te.__value=gt)??"",Ot(Te,gt))}),Q("change",Te,W=>Y({category:W.currentTarget.value||null})),g(m,H)};J(ae,m=>{a(s)&&m(q)})}var X=u(ae,2),ie=u(p(X),2),ve=u(ie,2),we=p(ve);{var xe=m=>{var H=Mn("Importing...");g(m,H)},ye=m=>{var H=Mn();z(()=>C(H,`Import ${a(s).count??""} ${a(s).count===1?"event":"events"}`)),g(m,H)},K=m=>{var H=Mn("Import");g(m,H)};J(we,m=>{a(c)?m(xe):a(s)?m(ye,1):m(K,-1)})}z(()=>{U=Ie(T,1,"dropzone svelte-12rmzzv",null,U,{dragging:a(v)}),ie.disabled=a(c),ve.disabled=!a(y)}),Q("click",I,function(...m){t.onclose?.apply(this,m)}),Q("click",Z,m=>m.stopPropagation()),mn("dragover",T,m=>{m.preventDefault(),k(v,!0)}),mn("dragleave",T,()=>k(v,!1)),mn("drop",T,F),Q("change",S,m=>w(m.currentTarget.files?.[0])),Q("click",ie,function(...m){t.onclose?.apply(this,m)}),Q("click",ve,j),g(e,I),Xe()}ot(["click","change"]);var bu=b('<p class="banner svelte-1n46o8q" role="alert"> <button type="button" class="btn">Dismiss</button></p>'),yu=b('<!> <main class="svelte-1n46o8q"><!></main>',1),ku=b('<div class="layout svelte-1n46o8q"><!> <!> <div class="body svelte-1n46o8q"><!></div></div> <!> <!>',1);function xu(e,t){Je(t,!0);const n="asf-calendar-view",r="asf-calendar-zone",s="asf-calendar-alt-zone",l="asf-calendar-compare-zones",o=3,c=/^\/e\/([A-Za-z0-9]+)\/?$/,i="/help",v="/docs";function _(){return Rs(globalThis.location?.pathname??"/")}function f(E){try{return globalThis.localStorage?.getItem(E)??null}catch{return null}}function d(E,re){try{globalThis.localStorage?.setItem(E,re)}catch{}}function h(){const E=f(n);return qs.includes(E??"")?E:"month"}function y(){return Rn(f(r),ft)}function Y(){const E=Rn(f(s),Ke);return E===ft?Ke:E}function w(){const E=f(l);return E?Or(E.split(",").map(re=>Rn(re,"")).filter(re=>!!re)).slice(0,o):[]}function j(){return!!f(r)}let F=ce(Ze(h())),M=ce(Ze(y())),D=ce(Ze(Y())),P=ce(Ze(w())),I=ce(Ze(We(tn(y())))),Z=ce(_()===i),L=ce(_()===v),x=ce(Ze([])),T=ce(null),U=ce(null),V=ce(Ze(Na(null))),S=ce(!1),A=ce(!1),O=ce(null),R=ce(null),te=ce(!0),G=ce(null),le=ce(null),ae=ce(!1),q=ee(()=>$o(a(F),a(I))),X=ee(()=>mi(a(x),a(U))),ie=ee(()=>gi(_i(a(x),a(V),a(X)),a(V).sort,a(M))),ve=ee(()=>a(U)?.title??"ASF Community Calendar"),we=ee(()=>a(G)?xi(a(G),a(U)):!1),xe=ee(()=>ct.feedUrl({start:Jt(a(q).start,a(M)),end:Jt(a(q).end,a(M)),categories:[...a(V).categories],visibility:a(V).visibility,q:a(V).search||void 0}));async function ye(){try{const[E,re]=await Promise.all([ct.session(),ct.calendars()]);k(T,E,!0),k(U,re,!0),k(V,Na(re),!0),j()||k(M,Rn(re.default_display_zone,a(M)),!0)}catch(E){k(O,E instanceof Dt?E.message:String(E),!0)}}let K=0;async function m(E,re){const _e=++K;k(S,!0);try{const $e=await ct.events({start:E,end:re});_e===K&&(k(x,$e,!0),k(O,null))}catch($e){_e===K&&k(O,$e instanceof Dt?$e.message:String($e),!0)}finally{_e===K&&k(S,!1)}}At(()=>{const E=Jt(a(q).start,a(M)),re=Jt(a(q).end,a(M));m(E,re)}),At(()=>{d(n,a(F))}),At(()=>{d(r,a(M))}),At(()=>{d(s,a(D))}),At(()=>{d(l,a(P).join(","))});async function H(){const E=_();if(E===null)return;k(Z,E===i),k(L,E===v);const re=c.exec(E);if(re)try{const _e=await ct.byShortlink(re[1]);k(G,_e,!0),k(I,We(en(new Date(_e.start),a(M))),!0)}catch(_e){k(O,_e instanceof Dt&&_e.needsLogin?"That event is not public. Log in to see whether you have access.":"That shortlink does not point at an event you can see.",!0)}}function se(E){if(!globalThis.history)return;const re=Vt(E);globalThis.location.pathname!==re&&globalThis.history.pushState({},"",re)}function fe(E){if(!globalThis.location)return;if(!E){se("/");return}const re=new URL(E.shortlink_url,globalThis.location.href).pathname;globalThis.location.pathname!==re&&globalThis.history.pushState({},"",re)}At(()=>{H();const E=()=>{H()};return globalThis.addEventListener?.("popstate",E),()=>globalThis.removeEventListener?.("popstate",E)}),ye();function ke(E){k(G,E,!0),k(le,null),k(R,null),fe(E)}function Ne(){k(G,null),k(le,null),k(R,null),fe(null)}function He(E=tn(a(M))){k(G,null),k(R,null),k(Z,!1),k(L,!1),k(le,yi(Jt(E,a(M)),a(U)),!0)}function je(){k(G,null),k(le,null),k(R,null),k(Z,!1),k(L,!1),k(ae,!0)}async function Re(E){k(ae,!1),await m(Jt(a(q).start,a(M)),Jt(a(q).end,a(M))),k(O,E===0?"Nothing was imported.":null,!0)}function st(){a(G)&&k(le,ki(a(G)),!0)}async function pt(E){k(A,!0),k(R,null);try{const re=a(G)?await ct.update(a(G).id,E):await ct.create(E);k(x,[...a(x).filter(_e=>_e.id!==re.id),re],!0),k(G,re,!0),k(le,null),fe(re)}catch(re){k(R,re instanceof Dt?re.message:String(re),!0)}finally{k(A,!1)}}async function _t(){if(a(G)&&globalThis.confirm?.(`Delete "${a(G).title}"? This cannot be undone.`)){k(A,!0),k(R,null);try{await ct.remove(a(G).id),k(x,a(x).filter(E=>E.id!==a(G).id),!0),Ne()}catch(E){k(R,E instanceof Dt?E.message:String(E),!0)}finally{k(A,!1)}}}function Te(E){k(I,We(E),!0),k(F,"day")}function Oe(E){k(I,We(E),!0),k(F,"month")}function Tt(E){k(M,E,!0),k(P,Or(a(P),E),!0)}function gt(E){k(P,Or(E,a(M)).slice(0,o),!0)}function qt(){k(Z,!a(Z)),a(Z)&&k(L,!1),se(a(Z)?i:"/")}function me(){k(L,!a(L)),a(L)&&k(Z,!1),se(a(L)?v:"/")}var Ae=ku(),De=vn(Ae),Fe=p(De);{let E=ee(()=>bi(a(U)));Li(Fe,{get title(){return a(ve)},get view(){return a(F)},get cursor(){return a(I)},get session(){return a(T)},get loading(){return a(S)},get canCreate(){return a(E)},get zone(){return a(M)},get alternateZone(){return a(D)},get helpOpen(){return a(Z)},get docsOpen(){return a(L)},onview:re=>{k(F,re,!0),k(Z,!1),k(L,!1)},onstep:re=>k(I,ei(a(F),a(I),re),!0),ontoday:()=>k(I,We(tn(a(M))),!0),oncreate:()=>He(a(I)),onimport:je,ontogglefilters:()=>k(te,!a(te)),onzone:Tt,onalternatezone:re=>k(D,re,!0),onhelp:qt,ondocs:me})}var Et=u(Fe,2);{var Nt=E=>{var re=bu(),_e=p(re),$e=u(_e);z(()=>C(_e,`${a(O)??""} `)),Q("click",$e,()=>k(O,null)),g(E,re)};J(Et,E=>{a(O)&&E(Nt)})}var $=u(Et,2),W=p($);{var B=E=>{Jc(E,{get calendars(){return a(U)},get session(){return a(T)},get zone(){return a(M)},get compareZones(){return a(P)},onclose:qt})},ne=E=>{eu(E,{onclose:me})},pe=E=>{var re=yu(),_e=vn(re);{var $e=Me=>{Bi(Me,{get filters(){return a(V)},get calendars(){return a(U)},get projects(){return a(X)},get view(){return a(F)},get feedUrl(){return a(xe)},get zone(){return a(M)},get compareZones(){return a(P)},maxCompareZones:o,onchange:sl=>k(V,sl,!0),oncomparezones:gt})};J(_e,Me=>{a(te)&&Me($e)})}var hn=u(_e,2),Sr=p(hn);{var el=Me=>{ec(Me,{get cursor(){return a(I)},get events(){return a(ie)},get zone(){return a(M)},onselect:ke,onpickday:Te})},tl=Me=>{Ha(Me,{get cursor(){return a(I)},get events(){return a(ie)},get zone(){return a(M)},get compareZones(){return a(P)},onselect:ke,onpickday:Te})},nl=Me=>{Ha(Me,{get cursor(){return a(I)},get events(){return a(ie)},get zone(){return a(M)},get compareZones(){return a(P)},days:1,onselect:ke,onpickday:Te})},rl=Me=>{_c(Me,{get cursor(){return a(I)},get events(){return a(ie)},get zone(){return a(M)},onpickday:Te,onpickmonth:Oe})},al=Me=>{Tc(Me,{get events(){return a(ie)},get zone(){return a(M)},get compareZones(){return a(P)},onselect:ke})};J(Sr,Me=>{a(F)==="month"?Me(el):a(F)==="week"?Me(tl,1):a(F)==="day"?Me(nl,2):a(F)==="year"?Me(rl,3):Me(al,-1)})}g(E,re)};J(W,E=>{a(Z)?E(B):a(L)?E(ne,1):E(pe,-1)})}var be=u(De,2);{var Ee=E=>{wu(E,{get calendars(){return a(U)},get zone(){return a(M)},onclose:()=>k(ae,!1),onimported:Re})};J(be,E=>{a(ae)&&E(Ee)})}var Se=u(be,2);{var Qe=E=>{Rc(E,{get event(){return a(G)},get draft(){return a(le)},get calendars(){return a(U)},get saving(){return a(A)},get error(){return a(R)},get editable(){return a(we)},get zone(){return a(M)},get compareZones(){return a(P)},onclose:Ne,onedit:st,onsave:pt,ondelete:_t})};J(Se,E=>{(a(G)||a(le))&&E(Qe)})}g(e,Ae),Xe()}ot(["click"]);const Ba="/embed/agenda",Tu=60,Eu=20,Su=366,Au=100;function zu(e){const t=Rs(e);return t===Ba||t===`${Ba}/`}function Du(e,t,n){return Math.min(n,Math.max(t,e))}function Wa(e,t,n,r,s){const l=e.get(t);if(l===null||l.trim()==="")return n;const o=Number(l);return Number.isFinite(o)?Du(Math.trunc(o),r,s):n}function qr(e,t,n){const r=e.get(t);return r===null?n:r===""?!0:!["0","false","no","off"].includes(r.trim().toLowerCase())}function Va(e,...t){const n=[];for(const r of t)for(const s of e.getAll(r))n.push(...s.split(",").map(l=>l.trim()));return n.filter(Boolean)}function Cu(e){const t=new URLSearchParams(e.startsWith("?")?e.slice(1):e),n=Va(t,"category","categories").map(i=>i.toLowerCase()).filter(i=>ca.includes(i)),r=(t.get("theme")??"auto").toLowerCase(),s=r==="light"||r==="dark"?r:"auto",l=t.get("zone"),o=l&&(l.toLowerCase()===ft||Gs(l))?Rn(l,ft):ft,c=t.get("title");return{categories:n,projects:Va(t,"project","projects").map(i=>i.toLowerCase()),days:Wa(t,"days",Tu,1,Su),limit:Wa(t,"limit",Eu,1,Au),search:t.get("q")?.trim()??"",zone:o,title:c===null?null:c.trim()||null,showZone:qr(t,"showzone",!0),transparent:qr(t,"transparent",!1),theme:s,showCredit:qr(t,"credit",!0)}}const ju="asf-calendar-embed:height";function Mu(e){return{type:ju,height:Math.ceil(e)}}var Pu=b('<h1 class="svelte-15ivk09"> </h1>'),Lu=b('<p class="note svelte-15ivk09">Loading events...</p>'),Ou=b('<p class="note error svelte-15ivk09" role="alert"> </p>'),Iu=b('<p class="note svelte-15ivk09">No events coming up.</p>'),qu=b('<span class="where"> </span>'),Nu=b('<li class="svelte-15ivk09"><a target="_blank" rel="noopener noreferrer" class="svelte-15ivk09"><span class="when svelte-15ivk09"> </span> <span class="title svelte-15ivk09"> </span></a> <span class="meta svelte-15ivk09"><span class="tag svelte-15ivk09"> </span> <!></span></li>'),Ru=b('<section class="svelte-15ivk09"><h2 class="svelte-15ivk09"> </h2> <ul class="svelte-15ivk09"></ul></section>'),Fu=b('<p class="zone svelte-15ivk09"> </p>'),Uu=b('<p class="credit svelte-15ivk09"><a target="_blank" rel="noopener noreferrer" class="svelte-15ivk09">ASF Community Calendar</a></p>'),Hu=b("<div><!> <!> <!> <!></div>");function Yu(e,t){Je(t,!0);let n=Ye(t,"search",19,()=>globalThis.location?.search??""),r=ee(()=>Cu(n())),s=ce(Ze([])),l=ce(!0),o=ce(null),c=ee(()=>Ks(a(s),a(r).zone)),i=ce(null);async function v(){k(l,!0);const x=We(tn(a(r).zone));try{k(s,await ct.events({start:x,end:Yt(x,a(r).days),categories:a(r).categories,projects:a(r).projects,q:a(r).search||void 0,sort:"start",limit:a(r).limit}),!0),k(o,null)}catch(T){k(o,T instanceof Dt?T.message:"The calendar could not be reached.",!0)}finally{k(l,!1)}}At(()=>{a(r),v()}),At(()=>{if(!a(i))return;a(c),a(l);const x=()=>{const U=Math.max(a(i)?.scrollHeight??0,globalThis.document?.documentElement?.scrollHeight??0);globalThis.parent?.postMessage(Mu(U),"*")};if(x(),typeof ResizeObserver>"u")return;const T=new ResizeObserver(x);return T.observe(a(i)),()=>T.disconnect()});function _(x){return`${kr[(x.getDay()+6)%7]} ${x.getDate()} ${fn[x.getMonth()]}`}function f(x){return x.all_day?"All day":`${Ue(at(x,a(r).zone))} - ${Ue(Qn(x,a(r).zone))}`}var d=Hu();let h;var y=p(d);{var Y=x=>{var T=Pu(),U=N(T,!0);z(()=>C(U,a(r).title)),g(x,T)};J(y,x=>{a(r).title&&x(Y)})}var w=u(y,2);{var j=x=>{var T=Lu();g(x,T)},F=x=>{var T=Ou(),U=N(T,!0);z(()=>C(U,a(o))),g(x,T)},M=x=>{var T=Iu();g(x,T)},D=x=>{var T=To(),U=vn(T);oe(U,17,()=>a(c),V=>V.key,(V,S)=>{var A=Ru(),O=p(A),R=N(O,!0),te=u(O,2);oe(te,21,()=>a(S).events,G=>G.id,(G,le)=>{var ae=Nu(),q=p(ae),X=p(q),ie=N(X,!0),ve=u(X,2),we=N(ve,!0),xe=u(q,2),ye=p(xe),K=N(ye,!0),m=u(ye,2);{var H=se=>{var fe=qu(),ke=N(fe,!0);z(()=>C(ke,a(le).location)),g(se,fe)};J(m,se=>{a(le).location&&se(H)})}z((se,fe,ke)=>{Wt(ae,`--hue: ${se??""}`),ge(q,"href",a(le).shortlink_url),C(ie,fe),C(we,a(le).title),C(K,ke)},[()=>jn(a(le)),()=>f(a(le)),()=>Er(a(le))]),g(G,ae)}),z(G=>C(R,G),[()=>_(a(S).date)]),g(V,A)}),g(x,T)};J(w,x=>{a(l)?x(j):a(o)?x(F,1):a(c).length===0?x(M,2):x(D,-1)})}var P=u(w,2);{var I=x=>{var T=Fu(),U=N(T);z((V,S)=>{ge(T,"title",V),C(U,`Times shown in ${S??""}`)},[()=>An(a(r).zone),()=>Xn(a(r).zone)]),g(x,T)};J(P,x=>{a(r).showZone&&!a(l)&&!a(o)&&x(I)})}var Z=u(P,2);{var L=x=>{var T=Uu(),U=N(T);z(V=>ge(U,"href",V),[()=>Vt("/")]),g(x,T)};J(Z,x=>{a(r).showCredit&&x(L)})}Is(d,x=>k(i,x),()=>a(i)),z(()=>{h=Ie(d,1,"embed svelte-15ivk09",null,h,{transparent:a(r).transparent}),ge(d,"data-theme",a(r).theme==="auto"?null:a(r).theme)}),g(e,d),Xe()}const Kr=document.getElementById("app");if(!Kr)throw new Error("No #app element to mount into");function Zu(){return zu(globalThis.location?.pathname??"/")?(document.documentElement.classList.add("embedded"),Sa(Yu,{target:Kr})):Sa(xu,{target:Kr})}Zu(); +//# sourceMappingURL=index-RGVtRUlj.js.map
diff --git a/frontend/dist/assets/index-DwsHFb2B.js.map b/frontend/dist/assets/index-RGVtRUlj.js.map similarity index 72% rename from frontend/dist/assets/index-DwsHFb2B.js.map rename to frontend/dist/assets/index-RGVtRUlj.js.map index e330903..64f53e9 100644 --- a/frontend/dist/assets/index-DwsHFb2B.js.map +++ b/frontend/dist/assets/index-RGVtRUlj.js.map
@@ -1 +1 @@ -{"version":3,"file":"index-DwsHFb2B.js","sources":["../../node_modules/esm-env/false.js","../../node_modules/svelte/src/internal/shared/utils.js","../../node_modules/svelte/src/internal/client/constants.js","../../node_modules/svelte/src/constants.js","../../node_modules/svelte/src/internal/client/warnings.js","../../node_modules/svelte/src/internal/client/reactivity/equality.js","../../node_modules/svelte/src/internal/client/errors.js","../../node_modules/svelte/src/internal/flags/index.js","../../node_modules/svelte/src/internal/client/context.js","../../node_modules/svelte/src/internal/client/dom/task.js","../../node_modules/svelte/src/internal/client/reactivity/status.js","../../node_modules/svelte/src/internal/client/reactivity/utils.js","../../node_modules/svelte/src/internal/client/reactivity/store.js","../../node_modules/svelte/src/internal/client/dom/elements/misc.js","../../node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js","../../node_modules/svelte/src/internal/client/reactivity/async.js","../../node_modules/svelte/src/internal/client/reactivity/deriveds.js","../../node_modules/svelte/src/internal/client/reactivity/batch.js","../../node_modules/svelte/src/internal/client/reactivity/sources.js","../../node_modules/svelte/src/internal/client/proxy.js","../../node_modules/svelte/src/internal/client/dom/operations.js","../../node_modules/svelte/src/internal/client/error-handling.js","../../node_modules/svelte/src/internal/client/reactivity/effects.js","../../node_modules/svelte/src/internal/client/runtime.js","../../node_modules/svelte/src/utils.js","../../node_modules/svelte/src/internal/client/dom/elements/events.js","../../node_modules/svelte/src/internal/client/dom/reconciler.js","../../node_modules/svelte/src/internal/client/dom/template.js","../../node_modules/svelte/src/reactivity/create-subscriber.js","../../node_modules/svelte/src/internal/client/dom/blocks/boundary.js","../../node_modules/svelte/src/internal/client/render.js","../../node_modules/svelte/src/internal/client/dom/blocks/branches.js","../../node_modules/svelte/src/internal/client/dom/blocks/if.js","../../node_modules/svelte/src/internal/client/dom/blocks/each.js","../../node_modules/svelte/src/internal/shared/attributes.js","../../node_modules/svelte/src/internal/client/dom/elements/class.js","../../node_modules/svelte/src/internal/client/dom/elements/style.js","../../node_modules/svelte/src/internal/client/dom/elements/bindings/select.js","../../node_modules/svelte/src/internal/client/dom/elements/attributes.js","../../node_modules/svelte/src/internal/client/dom/elements/bindings/input.js","../../node_modules/svelte/src/internal/client/dom/elements/bindings/this.js","../../node_modules/svelte/src/internal/client/reactivity/props.js","../../node_modules/svelte/src/version.js","../../node_modules/svelte/src/internal/disclose-version.js","../../src/lib/types.ts","../../src/lib/base.ts","../../src/lib/api.ts","../../src/lib/dates.ts","../../src/lib/timezone.ts","../../src/lib/events.ts","../../src/lib/filters.ts","../../src/lib/drafts.ts","../../src/components/TimezoneSwitch.svelte","../../src/components/Header.svelte","../../src/components/FilterPanel.svelte","../../src/components/EventChip.svelte","../../src/components/MonthView.svelte","../../src/components/WeekView.svelte","../../src/components/YearView.svelte","../../src/components/AgendaView.svelte","../../src/components/EventDialog.svelte","../../src/components/HelpPage.svelte","../../src/components/ApiDocs.svelte","../../src/lib/importing.ts","../../src/components/ImportDialog.svelte","../../src/App.svelte","../../src/lib/embed.ts","../../src/components/EmbedAgenda.svelte","../../src/main.ts"],"sourcesContent":["export default false;\n","// Store the references to globals in case someone tries to monkey patch these, causing the below\n// to de-opt (this occurs often when using popular extensions).\nexport var is_array = Array.isArray;\nexport var index_of = Array.prototype.indexOf;\nexport var includes = Array.prototype.includes;\nexport var array_from = Array.from;\nexport var object_keys = Object.keys;\nexport var define_property = Object.defineProperty;\nexport var get_descriptor = Object.getOwnPropertyDescriptor;\nexport var get_descriptors = Object.getOwnPropertyDescriptors;\nexport var object_prototype = Object.prototype;\nexport var array_prototype = Array.prototype;\nexport var get_prototype_of = Object.getPrototypeOf;\nexport var is_extensible = Object.isExtensible;\nexport var has_own_property = Object.prototype.hasOwnProperty;\n\n/**\n * @param {any} thing\n * @returns {thing is Function}\n */\nexport function is_function(thing) {\n\treturn typeof thing === 'function';\n}\n\nexport const noop = () => {};\n\n// Adapted from https://github.com/then/is-promise/blob/master/index.js\n// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE\n\n/**\n * @template [T=any]\n * @param {any} value\n * @returns {value is PromiseLike<T>}\n */\nexport function is_promise(value) {\n\treturn typeof value?.then === 'function';\n}\n\n/** @param {Function} fn */\nexport function run(fn) {\n\treturn fn();\n}\n\n/** @param {Array<() => void>} arr */\nexport function run_all(arr) {\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tarr[i]();\n\t}\n}\n\n/**\n * TODO replace with Promise.withResolvers once supported widely enough\n * @template [T=void]\n */\nexport function deferred() {\n\t/** @type {(value: T) => void} */\n\tvar resolve;\n\n\t/** @type {(reason: any) => void} */\n\tvar reject;\n\n\t/** @type {Promise<T>} */\n\tvar promise = new Promise((res, rej) => {\n\t\tresolve = res;\n\t\treject = rej;\n\t});\n\n\t// @ts-expect-error\n\treturn { promise, resolve, reject };\n}\n\n/**\n * @template V\n * @param {V} value\n * @param {V | (() => V)} fallback\n * @param {boolean} [lazy]\n * @returns {V}\n */\nexport function fallback(value, fallback, lazy = false) {\n\treturn value === undefined\n\t\t? lazy\n\t\t\t? /** @type {() => V} */ (fallback)()\n\t\t\t: /** @type {V} */ (fallback)\n\t\t: value;\n}\n\n/**\n * When encountering a situation like `let [a, b, c] = $derived(blah())`,\n * we need to stash an intermediate value that `a`, `b`, and `c` derive\n * from, in case it's an iterable\n * @template T\n * @param {ArrayLike<T> | Iterable<T>} value\n * @param {number} [n]\n * @returns {Array<T>}\n */\nexport function to_array(value, n) {\n\t// return arrays unchanged\n\tif (Array.isArray(value)) {\n\t\treturn value;\n\t}\n\n\t// if value is not iterable, or `n` is unspecified (indicates a rest\n\t// element, which means we're not concerned about unbounded iterables)\n\t// convert to an array with `Array.from`\n\tif (n === undefined || !(Symbol.iterator in value)) {\n\t\treturn Array.from(value);\n\t}\n\n\t// otherwise, populate an array with `n` values\n\n\t/** @type {T[]} */\n\tconst array = [];\n\n\tfor (const element of value) {\n\t\tarray.push(element);\n\t\tif (array.length === n) break;\n\t}\n\n\treturn array;\n}\n\n/**\n * @param {Record<string | symbol, unknown>} obj\n * @param {Array<string | symbol>} keys\n * @returns {Record<string | symbol, unknown>}\n */\nexport function exclude_from_object(obj, keys) {\n\t/** @type {Record<string | symbol, unknown>} */\n\tvar result = {};\n\n\tfor (var key in obj) {\n\t\tif (!keys.includes(key)) {\n\t\t\tresult[key] = obj[key];\n\t\t}\n\t}\n\n\tfor (var symbol of Object.getOwnPropertySymbols(obj)) {\n\t\tif (Object.propertyIsEnumerable.call(obj, symbol) && !keys.includes(symbol)) {\n\t\t\tresult[symbol] = obj[symbol];\n\t\t}\n\t}\n\n\treturn result;\n}\n","// General flags\nexport const DERIVED = 1 << 1;\nexport const EFFECT = 1 << 2;\nexport const RENDER_EFFECT = 1 << 3;\n/**\n * An effect that does not destroy its child effects when it reruns.\n * Runs as part of render effects, i.e. not eagerly as part of tree traversal or effect flushing.\n */\nexport const MANAGED_EFFECT = 1 << 24;\n/**\n * An effect that does not destroy its child effects when it reruns (like MANAGED_EFFECT).\n * Runs eagerly as part of tree traversal or effect flushing.\n */\nexport const BLOCK_EFFECT = 1 << 4;\nexport const BRANCH_EFFECT = 1 << 5;\nexport const ROOT_EFFECT = 1 << 6;\nexport const BOUNDARY_EFFECT = 1 << 7;\n/**\n * Set on the effect that `pause_effect` was called on, i.e. the root of a paused subtree,\n * as opposed to its descendants which are merely `INERT`. This allows `resume_effect` on\n * an ancestor to skip subtrees that were paused for their own reasons (such as a block\n * whose condition is still false) rather than resurrecting them\n */\nexport const PAUSED = 1 << 8;\n/**\n * Indicates that a reaction is connected to an effect root — either it is an effect,\n * or it is a derived that is depended on by at least one effect. If a derived has\n * no dependents, we can disconnect it from the graph, allowing it to either be\n * GC'd or reconnected later if an effect comes to depend on it again\n */\nexport const CONNECTED = 1 << 9;\nexport const CLEAN = 1 << 10;\nexport const DIRTY = 1 << 11;\nexport const MAYBE_DIRTY = 1 << 12;\nexport const INERT = 1 << 13;\nexport const DESTROYED = 1 << 14;\n/** Set once a reaction has run for the first time */\nexport const REACTION_RAN = 1 << 15;\n/** Effect is in the process of getting destroyed. Can be observed in child teardown functions */\nexport const DESTROYING = 1 << 25;\n\n// Flags exclusive to effects\n/**\n * 'Transparent' effects do not create a transition boundary.\n * This is on a block effect 99% of the time but may also be on a branch effect if its parent block effect was pruned\n */\nexport const EFFECT_TRANSPARENT = 1 << 16;\nexport const EAGER_EFFECT = 1 << 17;\nexport const HEAD_EFFECT = 1 << 18;\nexport const EFFECT_PRESERVED = 1 << 19;\nexport const USER_EFFECT = 1 << 20;\nexport const EFFECT_OFFSCREEN = 1 << 25;\n\n// Flags exclusive to deriveds\n/**\n * Tells that we marked this derived and its reactions as visited during the \"mark as (maybe) dirty\"-phase.\n * Will be lifted during execution of the derived and during checking its dirty state (both are necessary\n * because a derived might be checked but not executed). This is a pure performance optimization flag and\n * should not be used for any other purpose!\n */\nexport const WAS_MARKED = 1 << 16;\n\n// Flags used for async\nexport const REACTION_IS_UPDATING = 1 << 21;\nexport const ASYNC = 1 << 22;\n\nexport const ERROR_VALUE = 1 << 23;\n\nexport const STATE_SYMBOL = Symbol('$state');\n/** Marks component export objects, so that `proxy(...)` leaves them untouched */\nexport const COMPONENT_SYMBOL = Symbol('component');\nexport const LEGACY_PROPS = Symbol('legacy props');\nexport const LOADING_ATTR_SYMBOL = Symbol('');\nexport const PROXY_PATH_SYMBOL = Symbol('proxy path');\nexport const ATTRIBUTES_CACHE = Symbol('attributes');\nexport const CLASS_CACHE = Symbol('class');\nexport const STYLE_CACHE = Symbol('style');\nexport const TEXT_CACHE = Symbol('text');\nexport const FORM_RESET_HANDLER = Symbol('form reset');\n/** An anchor might change, via this symbol on the original anchor we can tell HMR about the updated anchor */\nexport const HMR_ANCHOR = Symbol('hmr anchor');\n\n/** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */\nexport const STALE_REACTION = new (class StaleReactionError extends Error {\n\tname = 'StaleReactionError';\n\tmessage = 'The reaction that called `getAbortSignal()` was re-run or destroyed';\n})();\n\nexport const IS_XHTML =\n\t// We gotta write it like this because after downleveling the pure comment may end up in the wrong location\n\t!!globalThis.document?.contentType &&\n\t/* @__PURE__ */ globalThis.document.contentType.includes('xml');\nexport const ELEMENT_NODE = 1;\nexport const TEXT_NODE = 3;\nexport const COMMENT_NODE = 8;\nexport const DOCUMENT_FRAGMENT_NODE = 11;\n","export const EACH_ITEM_REACTIVE = 1;\nexport const EACH_INDEX_REACTIVE = 1 << 1;\n/** See EachBlock interface metadata.is_controlled for an explanation what this is */\nexport const EACH_IS_CONTROLLED = 1 << 2;\nexport const EACH_IS_ANIMATED = 1 << 3;\nexport const EACH_ITEM_IMMUTABLE = 1 << 4;\n\nexport const PROPS_IS_IMMUTABLE = 1;\nexport const PROPS_IS_RUNES = 1 << 1;\nexport const PROPS_IS_UPDATED = 1 << 2;\nexport const PROPS_IS_BINDABLE = 1 << 3;\nexport const PROPS_IS_LAZY_INITIAL = 1 << 4;\n\nexport const TRANSITION_IN = 1;\nexport const TRANSITION_OUT = 1 << 1;\nexport const TRANSITION_GLOBAL = 1 << 2;\n\nexport const TEMPLATE_FRAGMENT = 1;\nexport const TEMPLATE_USE_IMPORT_NODE = 1 << 1;\nexport const TEMPLATE_USE_SVG = 1 << 2;\nexport const TEMPLATE_USE_MATHML = 1 << 3;\n\nexport const HYDRATION_START = '[';\n/** used to indicate that an `{:else}...` block was rendered */\nexport const HYDRATION_START_ELSE = '[!';\n/** used to indicate that a boundary's `failed` snippet was rendered on the server */\nexport const HYDRATION_START_FAILED = '[?';\nexport const HYDRATION_END = ']';\nexport const HYDRATION_ERROR = {};\n\nexport const ELEMENT_IS_NAMESPACED = 1;\nexport const ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;\nexport const ELEMENT_IS_INPUT = 1 << 2;\n\nexport const UNINITIALIZED = Symbol('uninitialized');\n\n// Dev-time component properties\nexport const FILENAME = Symbol('filename');\nexport const HMR = Symbol('hmr');\n\nexport const NAMESPACE_HTML = 'http://www.w3.org/1999/xhtml';\nexport const NAMESPACE_SVG = 'http://www.w3.org/2000/svg';\nexport const NAMESPACE_MATHML = 'http://www.w3.org/1998/Math/MathML';\n\n// we use a list of ignorable runtime warnings because not every runtime warning\n// can be ignored and we want to keep the validation for svelte-ignore in place\nexport const IGNORABLE_RUNTIME_WARNINGS = /** @type {const} */ ([\n\t'await_waterfall',\n\t'await_reactivity_loss',\n\t'state_snapshot_uncloneable',\n\t'binding_property_non_reactive',\n\t'hydration_attribute_changed',\n\t'hydration_html_changed',\n\t'ownership_invalid_binding',\n\t'ownership_invalid_mutation'\n]);\n\n/**\n * Whitespace inside one of these elements will not result in\n * a whitespace node being created in any circumstances. (This\n * list is almost certainly very incomplete)\n * TODO this is currently unused\n */\nexport const ELEMENTS_WITHOUT_TEXT = ['audio', 'datalist', 'dl', 'optgroup', 'select', 'video'];\n\nexport const ATTACHMENT_KEY = '@attach';\n","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\nvar bold = 'font-weight: bold';\nvar normal = 'font-weight: normal';\n\n/**\n * Assignment to `%property%` property (%location%) will evaluate to the right-hand side, not the value of `%property%` following the assignment. This may result in unexpected behaviour.\n * @param {string} property\n * @param {string} location\n */\nexport function assignment_value_stale(property, location) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] assignment_value_stale\\n%cAssignment to \\`${property}\\` property (${location}) will evaluate to the right-hand side, not the value of \\`${property}\\` following the assignment. This may result in unexpected behaviour.\\nhttps://svelte.dev/e/assignment_value_stale`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/assignment_value_stale`);\n\t}\n}\n\n/**\n * Detected reactivity loss when reading `%name%`. This happens when state is read in an async function after an earlier `await`\n * @param {string} name\n */\nexport function await_reactivity_loss(name) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] await_reactivity_loss\\n%cDetected reactivity loss when reading \\`${name}\\`. This happens when state is read in an async function after an earlier \\`await\\`\\nhttps://svelte.dev/e/await_reactivity_loss`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/await_reactivity_loss`);\n\t}\n}\n\n/**\n * An async derived, `%name%` (%location%) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app\n * @param {string} name\n * @param {string} location\n */\nexport function await_waterfall(name, location) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] await_waterfall\\n%cAn async derived, \\`${name}\\` (${location}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app\\nhttps://svelte.dev/e/await_waterfall`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/await_waterfall`);\n\t}\n}\n\n/**\n * `%binding%` (%location%) is binding to a non-reactive property\n * @param {string} binding\n * @param {string | undefined | null} [location]\n */\nexport function binding_property_non_reactive(binding, location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] binding_property_non_reactive\\n%c${location\n\t\t\t\t? `\\`${binding}\\` (${location}) is binding to a non-reactive property`\n\t\t\t\t: `\\`${binding}\\` is binding to a non-reactive property`}\\nhttps://svelte.dev/e/binding_property_non_reactive`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/binding_property_non_reactive`);\n\t}\n}\n\n/**\n * Your `console.%method%` contained `$state` proxies. Consider using `$inspect(...)` or `$state.snapshot(...)` instead\n * @param {string} method\n */\nexport function console_log_state(method) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] console_log_state\\n%cYour \\`console.${method}\\` contained \\`$state\\` proxies. Consider using \\`$inspect(...)\\` or \\`$state.snapshot(...)\\` instead\\nhttps://svelte.dev/e/console_log_state`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/console_log_state`);\n\t}\n}\n\n/**\n * Reading a derived belonging to a now-destroyed effect may result in stale values\n */\nexport function derived_inert() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] derived_inert\\n%cReading a derived belonging to a now-destroyed effect may result in stale values\\nhttps://svelte.dev/e/derived_inert`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/derived_inert`);\n\t}\n}\n\n/**\n * %handler% should be a function. Did you mean to %suggestion%?\n * @param {string} handler\n * @param {string} suggestion\n */\nexport function event_handler_invalid(handler, suggestion) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] event_handler_invalid\\n%c${handler} should be a function. Did you mean to ${suggestion}?\\nhttps://svelte.dev/e/event_handler_invalid`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/event_handler_invalid`);\n\t}\n}\n\n/**\n * Expected to find a hydratable with key `%key%` during hydration, but did not.\n * @param {string} key\n */\nexport function hydratable_missing_but_expected(key) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] hydratable_missing_but_expected\\n%cExpected to find a hydratable with key \\`${key}\\` during hydration, but did not.\\nhttps://svelte.dev/e/hydratable_missing_but_expected`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydratable_missing_but_expected`);\n\t}\n}\n\n/**\n * The `%attribute%` attribute on `%html%` changed its value between server and client renders. The client value, `%value%`, will be ignored in favour of the server value\n * @param {string} attribute\n * @param {string} html\n * @param {string} value\n */\nexport function hydration_attribute_changed(attribute, html, value) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] hydration_attribute_changed\\n%cThe \\`${attribute}\\` attribute on \\`${html}\\` changed its value between server and client renders. The client value, \\`${value}\\`, will be ignored in favour of the server value\\nhttps://svelte.dev/e/hydration_attribute_changed`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_attribute_changed`);\n\t}\n}\n\n/**\n * The value of an `{@html ...}` block %location% changed between server and client renders. The client value will be ignored in favour of the server value\n * @param {string | undefined | null} [location]\n */\nexport function hydration_html_changed(location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] hydration_html_changed\\n%c${location\n\t\t\t\t? `The value of an \\`{@html ...}\\` block ${location} changed between server and client renders. The client value will be ignored in favour of the server value`\n\t\t\t\t: 'The value of an `{@html ...}` block changed between server and client renders. The client value will be ignored in favour of the server value'}\\nhttps://svelte.dev/e/hydration_html_changed`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_html_changed`);\n\t}\n}\n\n/**\n * Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location%\n * @param {string | undefined | null} [location]\n */\nexport function hydration_mismatch(location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] hydration_mismatch\\n%c${location\n\t\t\t\t? `Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${location}`\n\t\t\t\t: 'Hydration failed because the initial UI does not match what was rendered on the server'}\\nhttps://svelte.dev/e/hydration_mismatch`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_mismatch`);\n\t}\n}\n\n/**\n * The `render` function passed to `createRawSnippet` should return HTML for a single element\n */\nexport function invalid_raw_snippet_render() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] invalid_raw_snippet_render\\n%cThe \\`render\\` function passed to \\`createRawSnippet\\` should return HTML for a single element\\nhttps://svelte.dev/e/invalid_raw_snippet_render`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/invalid_raw_snippet_render`);\n\t}\n}\n\n/**\n * Detected a migrated `$:` reactive block in `%filename%` that both accesses and updates the same reactive value. This may cause recursive updates when converted to an `$effect`.\n * @param {string} filename\n */\nexport function legacy_recursive_reactive_block(filename) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] legacy_recursive_reactive_block\\n%cDetected a migrated \\`$:\\` reactive block in \\`${filename}\\` that both accesses and updates the same reactive value. This may cause recursive updates when converted to an \\`$effect\\`.\\nhttps://svelte.dev/e/legacy_recursive_reactive_block`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/legacy_recursive_reactive_block`);\n\t}\n}\n\n/**\n * Tried to unmount a component that was not mounted\n */\nexport function lifecycle_double_unmount() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] lifecycle_double_unmount\\n%cTried to unmount a component that was not mounted\\nhttps://svelte.dev/e/lifecycle_double_unmount`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/lifecycle_double_unmount`);\n\t}\n}\n\n/**\n * %parent% passed property `%prop%` to %child% with `bind:`, but its parent component %owner% did not declare `%prop%` as a binding. Consider creating a binding between %owner% and %parent% (e.g. `bind:%prop%={...}` instead of `%prop%={...}`)\n * @param {string} parent\n * @param {string} prop\n * @param {string} child\n * @param {string} owner\n */\nexport function ownership_invalid_binding(parent, prop, child, owner) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] ownership_invalid_binding\\n%c${parent} passed property \\`${prop}\\` to ${child} with \\`bind:\\`, but its parent component ${owner} did not declare \\`${prop}\\` as a binding. Consider creating a binding between ${owner} and ${parent} (e.g. \\`bind:${prop}={...}\\` instead of \\`${prop}={...}\\`)\\nhttps://svelte.dev/e/ownership_invalid_binding`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/ownership_invalid_binding`);\n\t}\n}\n\n/**\n * Mutating unbound props (`%name%`, at %location%) is strongly discouraged. Consider using `bind:%prop%={...}` in %parent% (or using a callback) instead\n * @param {string} name\n * @param {string} location\n * @param {string} prop\n * @param {string} parent\n */\nexport function ownership_invalid_mutation(name, location, prop, parent) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] ownership_invalid_mutation\\n%cMutating unbound props (\\`${name}\\`, at ${location}) is strongly discouraged. Consider using \\`bind:${prop}={...}\\` in ${parent} (or using a callback) instead\\nhttps://svelte.dev/e/ownership_invalid_mutation`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/ownership_invalid_mutation`);\n\t}\n}\n\n/**\n * The `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\n */\nexport function select_multiple_invalid_value() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] select_multiple_invalid_value\\n%cThe \\`value\\` property of a \\`<select multiple>\\` element should be an array, but it received a non-array value. The selection will be kept as is.\\nhttps://svelte.dev/e/select_multiple_invalid_value`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/select_multiple_invalid_value`);\n\t}\n}\n\n/**\n * Reactive `$state(...)` proxies and the values they proxy have different identities. Because of this, comparisons with `%operator%` will produce unexpected results\n * @param {string} operator\n */\nexport function state_proxy_equality_mismatch(operator) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] state_proxy_equality_mismatch\\n%cReactive \\`$state(...)\\` proxies and the values they proxy have different identities. Because of this, comparisons with \\`${operator}\\` will produce unexpected results\\nhttps://svelte.dev/e/state_proxy_equality_mismatch`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/state_proxy_equality_mismatch`);\n\t}\n}\n\n/**\n * A `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\n */\nexport function svelte_boundary_reset_noop() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] svelte_boundary_reset_noop\\n%cA \\`<svelte:boundary>\\` \\`reset\\` function only resets the boundary the first time it is called\\nhttps://svelte.dev/e/svelte_boundary_reset_noop`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);\n\t}\n}\n\n/**\n * The `slide` transition does not work correctly for elements with `display: %value%`\n * @param {string} value\n */\nexport function transition_slide_display(value) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] transition_slide_display\\n%cThe \\`slide\\` transition does not work correctly for elements with \\`display: ${value}\\`\\nhttps://svelte.dev/e/transition_slide_display`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/transition_slide_display`);\n\t}\n}","/** @import { Equals } from '#client' */\n\n/** @type {Equals} */\nexport function equals(value) {\n\treturn value === this.v;\n}\n\n/**\n * @param {unknown} a\n * @param {unknown} b\n * @returns {boolean}\n */\nexport function safe_not_equal(a, b) {\n\treturn a != a\n\t\t? b == b\n\t\t: a !== b || (a !== null && typeof a === 'object') || typeof a === 'function';\n}\n\n/**\n * @param {unknown} a\n * @param {unknown} b\n * @returns {boolean}\n */\nexport function not_equal(a, b) {\n\treturn a !== b;\n}\n\n/** @type {Equals} */\nexport function safe_equals(value) {\n\treturn !safe_not_equal(value, this.v);\n}\n","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\nexport * from '../shared/errors.js';\n\n/**\n * Cannot create a `$derived(...)` with an `await` expression outside of an effect tree\n * @returns {never}\n */\nexport function async_derived_orphan() {\n\tif (DEV) {\n\t\tconst error = new Error(`async_derived_orphan\\nCannot create a \\`$derived(...)\\` with an \\`await\\` expression outside of an effect tree\\nhttps://svelte.dev/e/async_derived_orphan`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/async_derived_orphan`);\n\t}\n}\n\n/**\n * Using `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\n * @returns {never}\n */\nexport function bind_invalid_checkbox_value() {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_invalid_checkbox_value\\nUsing \\`bind:value\\` together with a checkbox input is not allowed. Use \\`bind:checked\\` instead\\nhttps://svelte.dev/e/bind_invalid_checkbox_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_invalid_checkbox_value`);\n\t}\n}\n\n/**\n * Component %component% has an export named `%key%` that a consumer component is trying to access using `bind:%key%`, which is disallowed. Instead, use `bind:this` (e.g. `<%name% bind:this={component} />`) and then access the property on the bound component instance (e.g. `component.%key%`)\n * @param {string} component\n * @param {string} key\n * @param {string} name\n * @returns {never}\n */\nexport function bind_invalid_export(component, key, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_invalid_export\\nComponent ${component} has an export named \\`${key}\\` that a consumer component is trying to access using \\`bind:${key}\\`, which is disallowed. Instead, use \\`bind:this\\` (e.g. \\`<${name} bind:this={component} />\\`) and then access the property on the bound component instance (e.g. \\`component.${key}\\`)\\nhttps://svelte.dev/e/bind_invalid_export`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_invalid_export`);\n\t}\n}\n\n/**\n * A component is attempting to bind to a non-bindable property `%key%` belonging to %component% (i.e. `<%name% bind:%key%={...}>`). To mark a property as bindable: `let { %key% = $bindable() } = $props()`\n * @param {string} key\n * @param {string} component\n * @param {string} name\n * @returns {never}\n */\nexport function bind_not_bindable(key, component, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_not_bindable\\nA component is attempting to bind to a non-bindable property \\`${key}\\` belonging to ${component} (i.e. \\`<${name} bind:${key}={...}>\\`). To mark a property as bindable: \\`let { ${key} = $bindable() } = $props()\\`\\nhttps://svelte.dev/e/bind_not_bindable`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_not_bindable`);\n\t}\n}\n\n/**\n * Calling `%method%` on a component instance (of %component%) is no longer valid in Svelte 5\n * @param {string} method\n * @param {string} component\n * @returns {never}\n */\nexport function component_api_changed(method, component) {\n\tif (DEV) {\n\t\tconst error = new Error(`component_api_changed\\nCalling \\`${method}\\` on a component instance (of ${component}) is no longer valid in Svelte 5\\nhttps://svelte.dev/e/component_api_changed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/component_api_changed`);\n\t}\n}\n\n/**\n * Attempted to instantiate %component% with `new %name%`, which is no longer valid in Svelte 5. If this component is not under your control, set the `compatibility.componentApi` compiler option to `4` to keep it working.\n * @param {string} component\n * @param {string} name\n * @returns {never}\n */\nexport function component_api_invalid_new(component, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`component_api_invalid_new\\nAttempted to instantiate ${component} with \\`new ${name}\\`, which is no longer valid in Svelte 5. If this component is not under your control, set the \\`compatibility.componentApi\\` compiler option to \\`4\\` to keep it working.\\nhttps://svelte.dev/e/component_api_invalid_new`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/component_api_invalid_new`);\n\t}\n}\n\n/**\n * A derived value cannot reference itself recursively\n * @returns {never}\n */\nexport function derived_references_self() {\n\tif (DEV) {\n\t\tconst error = new Error(`derived_references_self\\nA derived value cannot reference itself recursively\\nhttps://svelte.dev/e/derived_references_self`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/derived_references_self`);\n\t}\n}\n\n/**\n * Keyed each block has duplicate key `%value%` at indexes %a% and %b%\n * @param {string} a\n * @param {string} b\n * @param {string | undefined | null} [value]\n * @returns {never}\n */\nexport function each_key_duplicate(a, b, value) {\n\tif (DEV) {\n\t\tconst error = new Error(`each_key_duplicate\\n${value\n\t\t\t? `Keyed each block has duplicate key \\`${value}\\` at indexes ${a} and ${b}`\n\t\t\t: `Keyed each block has duplicate key at indexes ${a} and ${b}`}\\nhttps://svelte.dev/e/each_key_duplicate`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/each_key_duplicate`);\n\t}\n}\n\n/**\n * Keyed each block has key that is not idempotent — the key for item at index %index% was `%a%` but is now `%b%`. Keys must be the same each time for a given item\n * @param {string} index\n * @param {string} a\n * @param {string} b\n * @returns {never}\n */\nexport function each_key_volatile(index, a, b) {\n\tif (DEV) {\n\t\tconst error = new Error(`each_key_volatile\\nKeyed each block has key that is not idempotent — the key for item at index ${index} was \\`${a}\\` but is now \\`${b}\\`. Keys must be the same each time for a given item\\nhttps://svelte.dev/e/each_key_volatile`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/each_key_volatile`);\n\t}\n}\n\n/**\n * `%rune%` cannot be used inside an effect cleanup function\n * @param {string} rune\n * @returns {never}\n */\nexport function effect_in_teardown(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_in_teardown\\n\\`${rune}\\` cannot be used inside an effect cleanup function\\nhttps://svelte.dev/e/effect_in_teardown`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_in_teardown`);\n\t}\n}\n\n/**\n * Effect cannot be created inside a `$derived` value that was not itself created inside an effect\n * @returns {never}\n */\nexport function effect_in_unowned_derived() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_in_unowned_derived\\nEffect cannot be created inside a \\`$derived\\` value that was not itself created inside an effect\\nhttps://svelte.dev/e/effect_in_unowned_derived`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_in_unowned_derived`);\n\t}\n}\n\n/**\n * `%rune%` can only be used inside an effect (e.g. during component initialisation)\n * @param {string} rune\n * @returns {never}\n */\nexport function effect_orphan(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_orphan\\n\\`${rune}\\` can only be used inside an effect (e.g. during component initialisation)\\nhttps://svelte.dev/e/effect_orphan`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_orphan`);\n\t}\n}\n\n/**\n * `$effect.pending()` can only be called inside an effect or derived\n * @returns {never}\n */\nexport function effect_pending_outside_reaction() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_pending_outside_reaction\\n\\`$effect.pending()\\` can only be called inside an effect or derived\\nhttps://svelte.dev/e/effect_pending_outside_reaction`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_pending_outside_reaction`);\n\t}\n}\n\n/**\n * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\n * @returns {never}\n */\nexport function effect_update_depth_exceeded() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_update_depth_exceeded\\nMaximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\\nhttps://svelte.dev/e/effect_update_depth_exceeded`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);\n\t}\n}\n\n/**\n * Cannot use `flushSync` inside an effect\n * @returns {never}\n */\nexport function flush_sync_in_effect() {\n\tif (DEV) {\n\t\tconst error = new Error(`flush_sync_in_effect\\nCannot use \\`flushSync\\` inside an effect\\nhttps://svelte.dev/e/flush_sync_in_effect`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/flush_sync_in_effect`);\n\t}\n}\n\n/**\n * Cannot commit a fork that was already discarded\n * @returns {never}\n */\nexport function fork_discarded() {\n\tif (DEV) {\n\t\tconst error = new Error(`fork_discarded\\nCannot commit a fork that was already discarded\\nhttps://svelte.dev/e/fork_discarded`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/fork_discarded`);\n\t}\n}\n\n/**\n * Cannot create a fork inside an effect or when state changes are pending\n * @returns {never}\n */\nexport function fork_timing() {\n\tif (DEV) {\n\t\tconst error = new Error(`fork_timing\\nCannot create a fork inside an effect or when state changes are pending\\nhttps://svelte.dev/e/fork_timing`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/fork_timing`);\n\t}\n}\n\n/**\n * `getAbortSignal()` can only be called inside an effect or derived\n * @returns {never}\n */\nexport function get_abort_signal_outside_reaction() {\n\tif (DEV) {\n\t\tconst error = new Error(`get_abort_signal_outside_reaction\\n\\`getAbortSignal()\\` can only be called inside an effect or derived\\nhttps://svelte.dev/e/get_abort_signal_outside_reaction`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/get_abort_signal_outside_reaction`);\n\t}\n}\n\n/**\n * Expected to find a hydratable with key `%key%` during hydration, but did not.\n * @param {string} key\n * @returns {never}\n */\nexport function hydratable_missing_but_required(key) {\n\tif (DEV) {\n\t\tconst error = new Error(`hydratable_missing_but_required\\nExpected to find a hydratable with key \\`${key}\\` during hydration, but did not.\\nhttps://svelte.dev/e/hydratable_missing_but_required`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/hydratable_missing_but_required`);\n\t}\n}\n\n/**\n * Failed to hydrate the application\n * @returns {never}\n */\nexport function hydration_failed() {\n\tif (DEV) {\n\t\tconst error = new Error(`hydration_failed\\nFailed to hydrate the application\\nhttps://svelte.dev/e/hydration_failed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/hydration_failed`);\n\t}\n}\n\n/**\n * Could not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\n * @returns {never}\n */\nexport function invalid_snippet() {\n\tif (DEV) {\n\t\tconst error = new Error(`invalid_snippet\\nCould not \\`{@render}\\` snippet due to the expression being \\`null\\` or \\`undefined\\`. Consider using optional chaining \\`{@render snippet?.()}\\`\\nhttps://svelte.dev/e/invalid_snippet`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invalid_snippet`);\n\t}\n}\n\n/**\n * `%name%(...)` cannot be used in runes mode\n * @param {string} name\n * @returns {never}\n */\nexport function lifecycle_legacy_only(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`lifecycle_legacy_only\\n\\`${name}(...)\\` cannot be used in runes mode\\nhttps://svelte.dev/e/lifecycle_legacy_only`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/lifecycle_legacy_only`);\n\t}\n}\n\n/**\n * Cannot do `bind:%key%={undefined}` when `%key%` has a fallback value\n * @param {string} key\n * @returns {never}\n */\nexport function props_invalid_value(key) {\n\tif (DEV) {\n\t\tconst error = new Error(`props_invalid_value\\nCannot do \\`bind:${key}={undefined}\\` when \\`${key}\\` has a fallback value\\nhttps://svelte.dev/e/props_invalid_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/props_invalid_value`);\n\t}\n}\n\n/**\n * Rest element properties of `$props()` such as `%property%` are readonly\n * @param {string} property\n * @returns {never}\n */\nexport function props_rest_readonly(property) {\n\tif (DEV) {\n\t\tconst error = new Error(`props_rest_readonly\\nRest element properties of \\`$props()\\` such as \\`${property}\\` are readonly\\nhttps://svelte.dev/e/props_rest_readonly`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/props_rest_readonly`);\n\t}\n}\n\n/**\n * The `%rune%` rune is only available inside `.svelte` and `.svelte.js/ts` files\n * @param {string} rune\n * @returns {never}\n */\nexport function rune_outside_svelte(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`rune_outside_svelte\\nThe \\`${rune}\\` rune is only available inside \\`.svelte\\` and \\`.svelte.js/ts\\` files\\nhttps://svelte.dev/e/rune_outside_svelte`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/rune_outside_svelte`);\n\t}\n}\n\n/**\n * `setContext` must be called when a component first initializes, not in a subsequent effect or after an `await` expression\n * @returns {never}\n */\nexport function set_context_after_init() {\n\tif (DEV) {\n\t\tconst error = new Error(`set_context_after_init\\n\\`setContext\\` must be called when a component first initializes, not in a subsequent effect or after an \\`await\\` expression\\nhttps://svelte.dev/e/set_context_after_init`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/set_context_after_init`);\n\t}\n}\n\n/**\n * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\n * @returns {never}\n */\nexport function state_descriptors_fixed() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_descriptors_fixed\\nProperty descriptors defined on \\`$state\\` objects must contain \\`value\\` and always be \\`enumerable\\`, \\`configurable\\` and \\`writable\\`.\\nhttps://svelte.dev/e/state_descriptors_fixed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_descriptors_fixed`);\n\t}\n}\n\n/**\n * Cannot set prototype of `$state` object\n * @returns {never}\n */\nexport function state_prototype_fixed() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_prototype_fixed\\nCannot set prototype of \\`$state\\` object\\nhttps://svelte.dev/e/state_prototype_fixed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_prototype_fixed`);\n\t}\n}\n\n/**\n * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\n * @returns {never}\n */\nexport function state_unsafe_mutation() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_unsafe_mutation\\nUpdating state inside \\`$derived(...)\\`, \\`$inspect(...)\\` or a template expression is forbidden. If the value should not be reactive, declare it without \\`$state\\`\\nhttps://svelte.dev/e/state_unsafe_mutation`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_unsafe_mutation`);\n\t}\n}\n\n/**\n * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\n * @returns {never}\n */\nexport function svelte_boundary_reset_onerror() {\n\tif (DEV) {\n\t\tconst error = new Error(`svelte_boundary_reset_onerror\\nA \\`<svelte:boundary>\\` \\`reset\\` function cannot be called while an error is still being handled\\nhttps://svelte.dev/e/svelte_boundary_reset_onerror`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);\n\t}\n}","/** True if experimental.async=true */\nexport let async_mode_flag = false;\n/** True if we're not certain that we only have Svelte 5 code in the compilation */\nexport let legacy_mode_flag = false;\n/** True if $inspect.trace is used */\nexport let tracing_mode_flag = false;\n\nexport function enable_async_mode_flag() {\n\tasync_mode_flag = true;\n}\n\n/** ONLY USE THIS DURING TESTING */\nexport function disable_async_mode_flag() {\n\tasync_mode_flag = false;\n}\n\nexport function enable_legacy_mode_flag() {\n\tlegacy_mode_flag = true;\n}\n\nexport function enable_tracing_mode_flag() {\n\ttracing_mode_flag = true;\n}\n","/** @import { ComponentContext, DevStackEntry, Effect } from '#client' */\nimport { DEV } from 'esm-env';\nimport * as e from './errors.js';\nimport { active_effect, active_reaction } from './runtime.js';\nimport { create_user_effect } from './reactivity/effects.js';\nimport { async_mode_flag, legacy_mode_flag } from '../flags/index.js';\nimport { FILENAME } from '../../constants.js';\nimport { BRANCH_EFFECT, COMPONENT_SYMBOL } from './constants.js';\nimport { define_property } from '../shared/utils.js';\nimport { create_context, get_or_init_context_map } from '../shared/context.js';\n\n/** @type {ComponentContext | null} */\nexport let component_context = null;\n\n/** @param {ComponentContext | null} context */\nexport function set_component_context(context) {\n\tcomponent_context = context;\n}\n\n/** @type {DevStackEntry | null} */\nexport let dev_stack = null;\n\n/** @param {DevStackEntry | null} stack */\nexport function set_dev_stack(stack) {\n\tdev_stack = stack;\n}\n\n/**\n * Execute a callback with a new dev stack entry\n * @param {() => any} callback - Function to execute\n * @param {DevStackEntry['type']} type - Type of block/component\n * @param {any} component - Component function\n * @param {number} line - Line number\n * @param {number} column - Column number\n * @param {Record<string, any>} [additional] - Any additional properties to add to the dev stack entry\n * @returns {any}\n */\nexport function add_svelte_meta(callback, type, component, line, column, additional) {\n\tconst parent = dev_stack;\n\n\tdev_stack = {\n\t\ttype,\n\t\tfile: component[FILENAME],\n\t\tline,\n\t\tcolumn,\n\t\tparent,\n\t\t...additional\n\t};\n\n\ttry {\n\t\treturn callback();\n\t} finally {\n\t\tdev_stack = parent;\n\t}\n}\n\n/**\n * The current component function. Different from current component context:\n * ```html\n * <!-- App.svelte -->\n * <Foo>\n * <Bar /> <!-- context == Foo.svelte, function == App.svelte -->\n * </Foo>\n * ```\n * @type {ComponentContext['function']}\n */\nexport let dev_current_component_function = null;\n\n/** @param {ComponentContext['function']} fn */\nexport function set_dev_current_component_function(fn) {\n\tdev_current_component_function = fn;\n}\n\n/**\n * Returns a `[get, set, has]` triplet of functions for working with context in a type-safe way.\n *\n * `get` will throw an error if `set` has not yet been called in the current component or any of\n * its ancestors.\n *\n * @template T\n * @returns {[() => T, (context: T) => T, () => boolean]}\n * @since 5.40.0\n */\nexport function createContext() {\n\treturn /** @type {[() => T, (context: T) => T, () => boolean]} */ (\n\t\tcreate_context(getContext, setContext, hasContext)\n\t);\n}\n\n/**\n * Retrieves the context set with the specified `key` in the current component or any of its\n * ancestors. If multiple components set the same key, the value from the closest one is returned.\n * A `setContext` call in the current component is only visible to `getContext` calls that run after it.\n * Must be called during component initialisation.\n *\n * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative.\n *\n * @template T\n * @param {any} key\n * @returns {T}\n */\nexport function getContext(key) {\n\tconst context_map = get_or_init_context_map(component_context, 'getContext');\n\tconst result = /** @type {T} */ (context_map.get(key));\n\treturn result;\n}\n\n/**\n * Associates an arbitrary `context` object with the current component and the specified `key`\n * and returns that object. The context is then available to the component itself and all of its\n * descendants (including slotted content) with `getContext`.\n *\n * Like lifecycle functions, this must be called during component initialisation.\n *\n * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative.\n *\n * @template T\n * @param {any} key\n * @param {T} context\n * @returns {T}\n */\nexport function setContext(key, context) {\n\tconst context_map = get_or_init_context_map(component_context, 'setContext');\n\n\tif (async_mode_flag) {\n\t\tvar flags = /** @type {Effect} */ (active_effect).f;\n\t\tvar valid =\n\t\t\t!active_reaction &&\n\t\t\t(flags & BRANCH_EFFECT) !== 0 &&\n\t\t\t// pop() runs synchronously, so this indicates we're setting context after an await\n\t\t\t!(/** @type {ComponentContext} */ (component_context).i);\n\n\t\tif (!valid) {\n\t\t\te.set_context_after_init();\n\t\t}\n\t}\n\n\tcontext_map.set(key, context);\n\treturn context;\n}\n\n/**\n * Checks whether a given `key` has been set in the context of the current component or any of\n * its ancestors. Must be called during component initialisation.\n *\n * @param {any} key\n * @returns {boolean}\n */\nexport function hasContext(key) {\n\tconst context_map = get_or_init_context_map(component_context, 'hasContext');\n\treturn context_map.has(key);\n}\n\n/**\n * Retrieves the whole context map that belongs to the current component, including entries\n * inherited from its ancestors. Must be called during component initialisation. Useful, for\n * example, if you programmatically create a component and want to pass the existing context to it.\n *\n * @template {Map<any, any>} [T=Map<any, any>]\n * @returns {T}\n */\nexport function getAllContexts() {\n\tconst context_map = get_or_init_context_map(component_context, 'getAllContexts');\n\treturn /** @type {T} */ (context_map);\n}\n\n/**\n * @param {Record<string, unknown>} props\n * @param {any} runes\n * @param {Function} [fn]\n * @returns {void}\n */\nexport function push(props, runes = false, fn) {\n\tcomponent_context = {\n\t\tp: component_context,\n\t\ti: false,\n\t\tc: null,\n\t\te: null,\n\t\ts: props,\n\t\tx: null,\n\t\tr: /** @type {Effect} */ (active_effect),\n\t\tl: legacy_mode_flag && !runes ? { s: null, u: null, $: [] } : null\n\t};\n\n\tif (DEV) {\n\t\t// component function\n\t\tcomponent_context.function = fn;\n\t\tdev_current_component_function = fn;\n\t}\n}\n\n/**\n * @template {Record<string, any>} T\n * @param {T} [component]\n * @returns {T}\n */\nexport function pop(component) {\n\tvar context = /** @type {ComponentContext} */ (component_context);\n\tvar effects = context.e;\n\n\tif (effects !== null) {\n\t\tcontext.e = null;\n\n\t\tfor (var fn of effects) {\n\t\t\tcreate_user_effect(fn);\n\t\t}\n\t}\n\n\tif (component !== undefined) {\n\t\tcontext.x = component;\n\t}\n\n\tcontext.i = true;\n\n\tcomponent_context = context.p;\n\n\tif (DEV) {\n\t\tdev_current_component_function = component_context?.function ?? null;\n\t}\n\n\treturn mark_as_component(component);\n}\n\n/**\n * Add a symbol to the object (or create one if undefined) to mark it as a component so it isn't proxified.\n * @param {any} component\n */\nexport function mark_as_component(component = {}) {\n\tdefine_property(component, COMPONENT_SYMBOL, { value: true });\n\treturn component;\n}\n\n/** @returns {boolean} */\nexport function is_runes() {\n\treturn !legacy_mode_flag || (component_context !== null && component_context.l === null);\n}\n","import { run_all } from '../../shared/utils.js';\nimport { is_flushing_sync } from '../reactivity/batch.js';\n\n/** @type {Array<() => void>} */\nlet micro_tasks = [];\n\nfunction run_micro_tasks() {\n\tvar tasks = micro_tasks;\n\tmicro_tasks = [];\n\trun_all(tasks);\n}\n\n/**\n * @param {() => void} fn\n */\nexport function queue_micro_task(fn) {\n\tif (micro_tasks.length === 0 && !is_flushing_sync) {\n\t\tvar tasks = micro_tasks;\n\t\tqueueMicrotask(() => {\n\t\t\t// If this is false, a flushSync happened in the meantime. Do _not_ run new scheduled microtasks in that case\n\t\t\t// as the ordering of microtasks would be broken at that point - consider this case:\n\t\t\t// - queue_micro_task schedules microtask A to flush task X\n\t\t\t// - synchronously after, flushSync runs, processing task X\n\t\t\t// - synchronously after, some other microtask B is scheduled, but not through queue_micro_task but for example a Promise.resolve() in user code\n\t\t\t// - synchronously after, queue_micro_task schedules microtask C to flush task Y\n\t\t\t// - one tick later, microtask A now resolves, flushing task Y before microtask B, which is incorrect\n\t\t\t// This if check prevents that race condition (that realistically will only happen in tests)\n\t\t\tif (tasks === micro_tasks) run_micro_tasks();\n\t\t});\n\t}\n\n\tmicro_tasks.push(fn);\n}\n\n/**\n * Synchronously run any queued tasks.\n */\nexport function flush_tasks() {\n\twhile (micro_tasks.length > 0) {\n\t\trun_micro_tasks();\n\t}\n}\n","/** @import { Derived, Signal } from '#client' */\nimport { CLEAN, CONNECTED, DIRTY, MAYBE_DIRTY } from '#client/constants';\n\nconst STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);\n\n/**\n * @param {Signal} signal\n * @param {number} status\n */\nexport function set_signal_status(signal, status) {\n\tsignal.f = (signal.f & STATUS_MASK) | status;\n}\n\n/**\n * Set a derived's status to CLEAN or MAYBE_DIRTY based on its connection state.\n * @param {Derived} derived\n */\nexport function update_derived_status(derived) {\n\t// Only mark as MAYBE_DIRTY if disconnected and has dependencies.\n\tif ((derived.f & CONNECTED) !== 0 || derived.deps === null) {\n\t\tset_signal_status(derived, CLEAN);\n\t} else {\n\t\tset_signal_status(derived, MAYBE_DIRTY);\n\t}\n}\n","/** @import { Derived, Effect, Value } from '#client' */\nimport { CLEAN, DERIVED, DIRTY, MAYBE_DIRTY, WAS_MARKED } from '#client/constants';\nimport { set_signal_status } from './status.js';\n\n/**\n * @param {Value[] | null} deps\n */\nfunction clear_marked(deps) {\n\tif (deps === null) return;\n\n\tfor (const dep of deps) {\n\t\tif ((dep.f & DERIVED) === 0 || (dep.f & WAS_MARKED) === 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tdep.f ^= WAS_MARKED;\n\n\t\tclear_marked(/** @type {Derived} */ (dep).deps);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {Set<Effect>} dirty_effects\n * @param {Set<Effect>} maybe_dirty_effects\n */\nexport function defer_effect(effect, dirty_effects, maybe_dirty_effects) {\n\tif ((effect.f & DIRTY) !== 0) {\n\t\tdirty_effects.add(effect);\n\t} else if ((effect.f & MAYBE_DIRTY) !== 0) {\n\t\tmaybe_dirty_effects.add(effect);\n\t}\n\n\t// Since we're not executing these effects now, we need to clear any WAS_MARKED flags\n\t// so that other batches can correctly reach these effects during their own traversal\n\tclear_marked(effect.deps);\n\n\t// mark as clean so they get scheduled if they depend on pending async state\n\tset_signal_status(effect, CLEAN);\n}\n","/** @import { StoreReferencesContainer } from '#client' */\n/** @import { Store } from '#shared' */\nimport { subscribe_to_store } from '../../../store/utils.js';\nimport { get as get_store } from '../../../store/shared/index.js';\nimport { define_property, noop } from '../../shared/utils.js';\nimport { get } from '../runtime.js';\nimport { teardown } from './effects.js';\nimport { mutable_source, set } from './sources.js';\nimport { DEV } from 'esm-env';\n\n/**\n * We set this to `true` when updating a store so that we correctly\n * schedule effects if the update takes place inside a `$:` effect\n */\nexport let legacy_is_updating_store = false;\n\n/**\n * Whether or not the prop currently being read is a store binding, as in\n * `<Child bind:x={$y} />`. If it is, we treat the prop as mutable even in\n * runes mode, and skip `binding_property_non_reactive` validation\n */\nlet is_store_binding = false;\n\nlet IS_UNMOUNTED = Symbol('unmounted');\n\n/**\n * Gets the current value of a store. If the store isn't subscribed to yet, it will create a proxy\n * signal that will be updated when the store is. The store references container is needed to\n * track reassignments to stores and to track the correct component context.\n * @template V\n * @param {Store<V> | null | undefined} store\n * @param {string} store_name\n * @param {StoreReferencesContainer} stores\n * @returns {V}\n */\nexport function store_get(store, store_name, stores) {\n\tconst entry = (stores[store_name] ??= {\n\t\tstore: null,\n\t\tsource: mutable_source(undefined),\n\t\tunsubscribe: noop\n\t});\n\n\tif (DEV) {\n\t\tentry.source.label = store_name;\n\t}\n\n\t// if the component that setup this is already unmounted we don't want to register a subscription\n\tif (entry.store !== store && !(IS_UNMOUNTED in stores)) {\n\t\tentry.unsubscribe();\n\t\tentry.store = store ?? null;\n\n\t\tif (store == null) {\n\t\t\tentry.source.v = undefined; // see synchronous callback comment below\n\t\t\tentry.unsubscribe = noop;\n\t\t} else {\n\t\t\tvar is_synchronous_callback = true;\n\n\t\t\tentry.unsubscribe = subscribe_to_store(store, (v) => {\n\t\t\t\tif (is_synchronous_callback) {\n\t\t\t\t\t// If the first updates to the store value (possibly multiple of them) are synchronously\n\t\t\t\t\t// inside a derived, we will hit the `state_unsafe_mutation` error if we `set` the value\n\t\t\t\t\tentry.source.v = v;\n\t\t\t\t} else {\n\t\t\t\t\tset(entry.source, v);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tis_synchronous_callback = false;\n\t\t}\n\t}\n\n\t// if the component that setup this stores is already unmounted the source will be out of sync\n\t// so we just use the `get` for the stores, less performant but it avoids to create a memory leak\n\t// and it will keep the value consistent\n\tif (store && IS_UNMOUNTED in stores) {\n\t\treturn get_store(store);\n\t}\n\n\treturn get(entry.source);\n}\n\n/**\n * Unsubscribe from a store if it's not the same as the one in the store references container.\n * We need this in addition to `store_get` because someone could unsubscribe from a store but\n * then never subscribe to the new one (if any), causing the subscription to stay open wrongfully.\n * @param {Store<any> | null | undefined} store\n * @param {string} store_name\n * @param {StoreReferencesContainer} stores\n */\nexport function store_unsub(store, store_name, stores) {\n\t/** @type {StoreReferencesContainer[''] | undefined} */\n\tlet entry = stores[store_name];\n\n\tif (entry && entry.store !== store) {\n\t\t// Don't reset store yet, so that store_get above can resubscribe to new store if necessary\n\t\tentry.unsubscribe();\n\t\tentry.unsubscribe = noop;\n\t}\n\n\treturn store;\n}\n\n/**\n * Sets the new value of a store and returns that value.\n * @template V\n * @param {Store<V>} store\n * @param {V} value\n * @returns {V}\n */\nexport function store_set(store, value) {\n\tupdate_with_flag(store, value);\n\treturn value;\n}\n\n/**\n * @param {StoreReferencesContainer} stores\n * @param {string} store_name\n */\nexport function invalidate_store(stores, store_name) {\n\tvar entry = stores[store_name];\n\tif (entry.store !== null) {\n\t\tstore_set(entry.store, entry.source.v);\n\t}\n}\n\n/**\n * Unsubscribes from all auto-subscribed stores on destroy\n * @returns {[StoreReferencesContainer, ()=>void]}\n */\nexport function setup_stores() {\n\t/** @type {StoreReferencesContainer} */\n\tconst stores = {};\n\n\tfunction cleanup() {\n\t\tteardown(() => {\n\t\t\tfor (var store_name in stores) {\n\t\t\t\tconst ref = stores[store_name];\n\t\t\t\tref.unsubscribe();\n\t\t\t}\n\t\t\tdefine_property(stores, IS_UNMOUNTED, {\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: true\n\t\t\t});\n\t\t});\n\t}\n\n\treturn [stores, cleanup];\n}\n\n/**\n * @param {Store<V>} store\n * @param {V} value\n * @template V\n */\nfunction update_with_flag(store, value) {\n\tlegacy_is_updating_store = true;\n\n\ttry {\n\t\tstore.set(value);\n\t} finally {\n\t\tlegacy_is_updating_store = false;\n\t}\n}\n\n/**\n * Updates a store with a new value.\n * @param {Store<V>} store the store to update\n * @param {any} expression the expression that mutates the store\n * @param {V} new_value the new store value\n * @template V\n */\nexport function store_mutate(store, expression, new_value) {\n\tupdate_with_flag(store, new_value);\n\treturn expression;\n}\n\n/**\n * @param {Store<number>} store\n * @param {number} store_value\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_store(store, store_value, d = 1) {\n\tupdate_with_flag(store, store_value + d);\n\treturn store_value;\n}\n\n/**\n * @param {Store<number>} store\n * @param {number} store_value\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_pre_store(store, store_value, d = 1) {\n\tconst value = store_value + d;\n\tupdate_with_flag(store, value);\n\treturn value;\n}\n\n/**\n * Called inside prop getters to communicate that the prop is a store binding\n */\nexport function mark_store_binding() {\n\tis_store_binding = true;\n}\n\n/**\n * Returns a tuple that indicates whether `fn()` reads a prop that is a store binding.\n * Used to prevent `binding_property_non_reactive` validation false positives and\n * ensure that these props are treated as mutable even in runes mode\n * @template T\n * @param {() => T} fn\n * @returns {[T, boolean]}\n */\nexport function capture_store_binding(fn) {\n\tvar previous_is_store_binding = is_store_binding;\n\n\ttry {\n\t\tis_store_binding = false;\n\t\treturn [fn(), is_store_binding];\n\t} finally {\n\t\tis_store_binding = previous_is_store_binding;\n\t}\n}\n","import { hydrating } from '../hydration.js';\nimport { clear_text_content, get_first_child } from '../operations.js';\nimport { queue_micro_task } from '../task.js';\nimport { FORM_RESET_HANDLER } from '../../constants.js';\n\n/**\n * @param {HTMLElement} dom\n * @param {boolean} value\n * @returns {void}\n */\nexport function autofocus(dom, value) {\n\tif (value) {\n\t\tconst body = document.body;\n\t\tdom.autofocus = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tif (document.activeElement === body) {\n\t\t\t\tdom.focus();\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * The child of a textarea actually corresponds to the defaultValue property, so we need\n * to remove it upon hydration to avoid a bug when someone resets the form value.\n * @param {HTMLTextAreaElement} dom\n * @returns {void}\n */\nexport function remove_textarea_child(dom) {\n\tif (hydrating && get_first_child(dom) !== null) {\n\t\tclear_text_content(dom);\n\t}\n}\n\nlet listening_to_form_reset = false;\n\nexport function add_form_reset_listener() {\n\tif (!listening_to_form_reset) {\n\t\tlistening_to_form_reset = true;\n\t\tdocument.addEventListener(\n\t\t\t'reset',\n\t\t\t(evt) => {\n\t\t\t\t// Needs to happen one tick later or else the dom properties of the form\n\t\t\t\t// elements have not updated to their reset values yet\n\t\t\t\tPromise.resolve().then(() => {\n\t\t\t\t\tif (!evt.defaultPrevented) {\n\t\t\t\t\t\tfor (const e of /**@type {HTMLFormElement} */ (evt.target).elements) {\n\t\t\t\t\t\t\t/** @type {any} */ (e)[FORM_RESET_HANDLER]?.();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\t// In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)\n\t\t\t{ capture: true }\n\t\t);\n\t}\n}\n","import { teardown } from '../../../reactivity/effects.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../../runtime.js';\nimport { FORM_RESET_HANDLER } from '../../../constants.js';\nimport { add_form_reset_listener } from '../misc.js';\n\n/**\n * Fires the handler once immediately (unless corresponding arg is set to `false`),\n * then listens to the given events until the render effect context is destroyed\n * @param {EventTarget} target\n * @param {Array<string>} events\n * @param {(event?: Event) => void} handler\n * @param {any} call_handler_immediately\n */\nexport function listen(target, events, handler, call_handler_immediately = true) {\n\tif (call_handler_immediately) {\n\t\thandler();\n\t}\n\n\tfor (var name of events) {\n\t\ttarget.addEventListener(name, handler);\n\t}\n\n\tteardown(() => {\n\t\tfor (var name of events) {\n\t\t\ttarget.removeEventListener(name, handler);\n\t\t}\n\t});\n}\n\n/**\n * @template T\n * @param {() => T} fn\n */\nexport function without_reactive_context(fn) {\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\ttry {\n\t\treturn fn();\n\t} finally {\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t}\n}\n\n/**\n * Listen to the given event, and then instantiate a global form reset listener if not already done,\n * to notify all bindings when the form is reset\n * @param {HTMLElement} element\n * @param {string} event\n * @param {(is_reset?: true) => void} handler\n * @param {(is_reset?: true) => void} [on_reset]\n */\nexport function listen_to_event_and_reset_event(element, event, handler, on_reset = handler) {\n\telement.addEventListener(event, () => without_reactive_context(handler));\n\tconst prev = /** @type {any} */ (element)[FORM_RESET_HANDLER];\n\tif (prev) {\n\t\t// special case for checkbox that can have multiple binds (group & checked)\n\t\t/** @type {any} */ (element)[FORM_RESET_HANDLER] = () => {\n\t\t\tprev();\n\t\t\ton_reset(true);\n\t\t};\n\t} else {\n\t\t/** @type {any} */ (element)[FORM_RESET_HANDLER] = () => on_reset(true);\n\t}\n\n\tadd_form_reset_listener();\n}\n","/** @import { Blocker, Effect, Source, Value } from '#client' */\nimport { DESTROYED, STALE_REACTION } from '#client/constants';\nimport { DEV } from 'esm-env';\nimport {\n\tcomponent_context,\n\tdev_stack,\n\tis_runes,\n\tset_component_context,\n\tset_dev_stack\n} from '../context.js';\nimport { invoke_error_boundary } from '../error-handling.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../runtime.js';\nimport { Batch, current_batch } from './batch.js';\nimport {\n\tasync_derived,\n\treactivity_loss_tracker,\n\tderived,\n\tderived_safe_equal,\n\tset_reactivity_loss_tracker\n} from './deriveds.js';\nimport { aborted } from './effects.js';\n\n/**\n * @param {Blocker[]} blockers\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {(values: Value[]) => any} fn\n */\nexport function flatten(blockers, sync, async, fn) {\n\tconst d = is_runes() ? derived : derived_safe_equal;\n\n\t// Filter out already-settled blockers - no need to wait for them\n\tvar pending = blockers.filter((b) => !b.settled);\n\n\tvar deriveds = sync.map(d);\n\n\tif (DEV) {\n\t\tderiveds.forEach((d, i) => {\n\t\t\t// TODO this is kinda useful for debugging but a lousy implementation —\n\t\t\t// maybe the compiler could pass through the template string\n\t\t\td.label = sync[i]\n\t\t\t\t.toString()\n\t\t\t\t.replace('() => ', '')\n\t\t\t\t.replaceAll('$.eager(() => ', '$state.eager(')\n\t\t\t\t.replace(/\\$\\.get\\((.+?)\\)/g, (_, id) => id);\n\t\t});\n\t}\n\n\tif (async.length === 0 && pending.length === 0) {\n\t\tfn(deriveds);\n\t\treturn;\n\t}\n\n\tvar parent = /** @type {Effect} */ (active_effect);\n\n\tvar restore = capture();\n\tvar blocker_promise =\n\t\tpending.length === 1\n\t\t\t? pending[0].promise\n\t\t\t: pending.length > 1\n\t\t\t\t? Promise.all(pending.map((b) => b.promise))\n\t\t\t\t: null;\n\n\t/**\n\t * @param {Source[]} async\n\t */\n\tfunction finish(async) {\n\t\tif ((parent.f & DESTROYED) !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\trestore();\n\n\t\ttry {\n\t\t\tfn([...deriveds, ...async]);\n\t\t} catch (error) {\n\t\t\tinvoke_error_boundary(error, parent);\n\t\t}\n\n\t\tunset_context();\n\t}\n\n\tvar decrement_pending = increment_pending();\n\n\t// Fast path: blockers but no async expressions\n\tif (async.length === 0) {\n\t\t/** @type {Promise<any>} */ (blocker_promise).then(() => finish([])).finally(decrement_pending);\n\t\treturn;\n\t}\n\n\t// Full path: has async expressions\n\tfunction run() {\n\t\tPromise.all(async.map((expression) => async_derived(expression)))\n\t\t\t.then(finish)\n\t\t\t.catch((error) => invoke_error_boundary(error, parent))\n\t\t\t.finally(decrement_pending);\n\t}\n\n\tif (blocker_promise) {\n\t\tblocker_promise.then(() => {\n\t\t\trestore();\n\t\t\trun();\n\t\t\tunset_context();\n\t\t});\n\t} else {\n\t\trun();\n\t}\n}\n\n/**\n * @param {Blocker[]} blockers\n * @param {(values: Value[]) => any} fn\n */\nexport function run_after_blockers(blockers, fn) {\n\tflatten(blockers, [], [], fn);\n}\n\n/**\n * Captures the current effect context so that we can restore it after\n * some asynchronous work has happened (so that e.g. `await a + b`\n * causes `b` to be registered as a dependency).\n */\nexport function capture() {\n\tvar previous_effect = /** @type {Effect} */ (active_effect);\n\tvar previous_reaction = active_reaction;\n\tvar previous_component_context = component_context;\n\tvar previous_batch = /** @type {Batch} */ (current_batch);\n\n\tif (DEV) {\n\t\tvar previous_dev_stack = dev_stack;\n\t}\n\n\treturn function restore(activate_batch = true) {\n\t\tset_active_effect(previous_effect);\n\t\tset_active_reaction(previous_reaction);\n\t\tset_component_context(previous_component_context);\n\n\t\tif (activate_batch && (previous_effect.f & DESTROYED) === 0) {\n\t\t\t// TODO we only need optional chaining here because `{#await ...}` blocks\n\t\t\t// are anomalous. Once we retire them we can get rid of it\n\t\t\tprevious_batch?.activate();\n\t\t\tprevious_batch?.apply();\n\t\t}\n\n\t\tif (DEV) {\n\t\t\tset_reactivity_loss_tracker(null);\n\t\t\tset_dev_stack(previous_dev_stack);\n\t\t}\n\t};\n}\n\n/** `true` between a `save` thunk restoring a context and the end of that synchronous segment */\nvar restored = false;\n\n/**\n * Wraps an `await` expression in such a way that the effect context that was\n * active before the expression evaluated can be reapplied afterwards —\n * `await a + b` becomes `(await $.save(a))() + b`\n * @template T\n * @param {Promise<T>} promise\n * @returns {Promise<() => T>}\n */\nexport async function save(promise) {\n\tvar restore = capture();\n\t// the context restored by an earlier `save` in this expression must not\n\t// outlive the synchronous segment that is about to end at this `await`\n\tunsave();\n\tvar value = await promise;\n\n\treturn () => {\n\t\trestore();\n\t\trestored = true;\n\t\treturn value;\n\t};\n}\n\n/**\n * Unset the context if a `save` thunk restored it in the current synchronous segment,\n * so that a foreign microtask can never run inside a restored reaction context.\n * Called at every suspension point, and at the end of async expression bodies —\n * `async () => (await $.save(a))().b` becomes `async () => { try { return (await $.save(a))().b; } finally { $.unsave(); } }`\n * @template T\n * @param {T} [value]\n * @returns {T}\n */\nexport function unsave(value) {\n\tif (restored) unset_context();\n\treturn /** @type {T} */ (value);\n}\n\n/**\n * Reset `current_async_effect` after the `promise` resolves, so\n * that we can emit `await_reactivity_loss` warnings\n * @template T\n * @param {Promise<T>} promise\n * @returns {Promise<() => T>}\n */\nexport async function track_reactivity_loss(promise) {\n\tunsave();\n\tvar previous_reactivity_loss_tracker = reactivity_loss_tracker;\n\t// Ensure that unrelated reads after an async operation is kicked off don't cause false positives\n\tqueueMicrotask(() => {\n\t\tif (reactivity_loss_tracker === previous_reactivity_loss_tracker) {\n\t\t\tset_reactivity_loss_tracker(null);\n\t\t}\n\t});\n\n\tvar value = await promise;\n\n\treturn () => {\n\t\tset_reactivity_loss_tracker(previous_reactivity_loss_tracker);\n\t\t// While this can result in false negatives it also guards against the more important\n\t\t// false positives that would occur if this is the last in a chain of async operations,\n\t\t// and the reactivity_loss_tracker would then stay around until the next async operation happens.\n\t\tqueueMicrotask(() => {\n\t\t\tif (reactivity_loss_tracker === previous_reactivity_loss_tracker) {\n\t\t\t\tset_reactivity_loss_tracker(null);\n\t\t\t}\n\t\t});\n\n\t\treturn value;\n\t};\n}\n\n/**\n * Used in `for await` loops in DEV, so\n * that we can emit `await_reactivity_loss` warnings\n * after each `async_iterator` result resolves and\n * after the `async_iterator` return resolves (if it runs)\n * @template T\n * @template TReturn\n * @param {Iterable<T> | AsyncIterable<T>} iterable\n * @returns {AsyncGenerator<T, TReturn | undefined>}\n */\nexport async function* for_await_track_reactivity_loss(iterable) {\n\t// This is based on the algorithms described in ECMA-262:\n\t// ForIn/OfBodyEvaluation\n\t// https://tc39.es/ecma262/multipage/ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset\n\t// AsyncIteratorClose\n\t// https://tc39.es/ecma262/multipage/abstract-operations.html#sec-asynciteratorclose\n\n\t/** @type {AsyncIterator<T, TReturn>} */\n\t// @ts-ignore\n\tconst iterator = iterable[Symbol.asyncIterator]?.() ?? iterable[Symbol.iterator]?.();\n\n\tif (iterator === undefined) {\n\t\tthrow new TypeError('value is not async iterable');\n\t}\n\n\t// eslint-disable-next-line no-useless-assignment\n\tlet invoke_return = true;\n\n\ttry {\n\t\twhile (true) {\n\t\t\tconst { done, value } = (await track_reactivity_loss(iterator.next()))();\n\t\t\tif (done) {\n\t\t\t\tinvoke_return = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvar prev = reactivity_loss_tracker;\n\t\t\ttry {\n\t\t\t\tyield value;\n\t\t\t} catch (e) {\n\t\t\t\tset_reactivity_loss_tracker(prev);\n\t\t\t\t// If the yield throws, we need to call `return` but not return its value, instead rethrow\n\t\t\t\tif (iterator.return !== undefined) {\n\t\t\t\t\t(await track_reactivity_loss(iterator.return()))();\n\t\t\t\t}\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t\tset_reactivity_loss_tracker(prev);\n\t\t}\n\t} catch (error) {\n\t\tinvoke_return = false;\n\t\tthrow error;\n\t} finally {\n\t\t// If the iterator had an abrupt completion (break) and `return` is defined on the iterator, call it and return the value\n\t\tif (invoke_return && iterator.return !== undefined) {\n\t\t\t// eslint-disable-next-line no-unsafe-finally\n\t\t\treturn /** @type {TReturn} */ ((await track_reactivity_loss(iterator.return()))().value);\n\t\t}\n\t}\n}\n\nexport function unset_context(deactivate_batch = true) {\n\trestored = false;\n\tset_active_effect(null);\n\tset_active_reaction(null);\n\tset_component_context(null);\n\tif (deactivate_batch) current_batch?.deactivate();\n\n\tif (DEV) {\n\t\tset_reactivity_loss_tracker(null);\n\t\tset_dev_stack(null);\n\t}\n}\n\n/**\n * @param {Array<() => void | Promise<void>>} thunks\n */\nexport function run(thunks) {\n\tconst restore = capture();\n\n\tconst decrement_pending = increment_pending();\n\n\tvar active = /** @type {Effect} */ (active_effect);\n\n\t/** @type {null | { error: any }} */\n\tvar errored = null;\n\n\t/** @param {any} error */\n\tconst handle_error = (error) => {\n\t\terrored = { error }; // wrap in object in case a promise rejects with a falsy value\n\n\t\tif (!aborted(active)) {\n\t\t\tinvoke_error_boundary(error, active);\n\t\t}\n\t};\n\n\tvar promise = Promise.resolve(thunks[0]()).catch(handle_error);\n\n\t/** @type {Blocker} */\n\tvar blocker = { promise, settled: false };\n\tvar blockers = [blocker];\n\n\tpromise.finally(() => {\n\t\tblocker.settled = true;\n\t\tunset_context();\n\t});\n\n\tfor (const fn of thunks.slice(1)) {\n\t\tpromise = promise\n\t\t\t.then(() => {\n\t\t\t\trestore();\n\n\t\t\t\ttry {\n\t\t\t\t\tif (errored) {\n\t\t\t\t\t\tthrow errored.error;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (aborted(active)) {\n\t\t\t\t\t\tthrow STALE_REACTION;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn fn();\n\t\t\t\t} finally {\n\t\t\t\t\t// We gotta unset context directly in case the function returns a promise, in which case\n\t\t\t\t\t// unset_context in .finally() would be too late ...\n\t\t\t\t\tunset_context();\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(handle_error);\n\n\t\tconst blocker = { promise, settled: false };\n\t\tblockers.push(blocker);\n\n\t\tpromise.finally(() => {\n\t\t\tblocker.settled = true;\n\t\t\t// ... but we also need it after such a promise has resolved in case it restores our context\n\t\t\tunset_context();\n\t\t});\n\t}\n\n\tpromise\n\t\t// wait one more tick, so that template effects are\n\t\t// guaranteed to run before `$effect(...)`\n\t\t.then(() => Promise.resolve())\n\t\t.finally(decrement_pending);\n\n\treturn blockers;\n}\n\n/**\n * @param {Blocker[]} blockers\n */\nexport function wait(blockers) {\n\treturn Promise.all(blockers.map((b) => b.promise));\n}\n\n/**\n * @returns {(skip?: boolean) => void}\n */\nexport function increment_pending() {\n\tvar effect = /** @type {Effect} */ (active_effect);\n\tvar boundary = effect.b; // undefined if called outside the render tree, e.g. a standalone $effect.root\n\tvar batch = /** @type {Batch} */ (current_batch);\n\tvar blocking = !!boundary?.is_rendered();\n\n\tboundary?.update_pending_count(1, batch);\n\tbatch.increment(blocking, effect);\n\n\treturn () => {\n\t\tboundary?.update_pending_count(-1, batch);\n\t\tbatch.decrement(blocking, effect);\n\t};\n}\n","/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */\n/** @import { Batch } from './batch.js'; */\n/** @import { Boundary } from '../dom/blocks/boundary.js'; */\nimport { DEV } from 'esm-env';\nimport {\n\tERROR_VALUE,\n\tDERIVED,\n\tDIRTY,\n\tEFFECT_PRESERVED,\n\tSTALE_REACTION,\n\tASYNC,\n\tWAS_MARKED,\n\tDESTROYED,\n\tCLEAN,\n\tREACTION_RAN,\n\tINERT\n} from '#client/constants';\nimport {\n\tactive_reaction,\n\tactive_effect,\n\tupdate_reaction,\n\tincrement_write_version,\n\tset_active_effect,\n\tpush_reaction_value,\n\tis_destroying_effect,\n\tupdate_effect,\n\tremove_reactions,\n\tskipped_deps,\n\tnew_deps\n} from '../runtime.js';\nimport { without_reactive_context } from '../dom/elements/bindings/shared.js';\nimport { equals, safe_equals } from './equality.js';\nimport * as e from '../errors.js';\nimport * as w from '../warnings.js';\nimport {\n\tasync_effect,\n\tdestroy_effect,\n\tdestroy_effect_children,\n\teffect_tracking,\n\tteardown\n} from './effects.js';\nimport { eager_effects, internal_set, set_eager_effects, source } from './sources.js';\nimport { get_error } from '../../shared/dev.js';\nimport { async_mode_flag, tracing_mode_flag } from '../../flags/index.js';\nimport { component_context } from '../context.js';\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { batch_values, current_batch, previous_batch } from './batch.js';\nimport { increment_pending, unset_context } from './async.js';\nimport { deferred, includes, noop } from '../../shared/utils.js';\nimport { set_signal_status, update_derived_status } from './status.js';\n\n/**\n * This allows us to track 'reactivity loss' that occurs when signals\n * are read after a non-context-restoring `await`. Dev-only\n * @type {{ effect: Effect, effect_deps: Set<Value>, warned: boolean } | null}\n */\nexport let reactivity_loss_tracker = null;\n\n/** @param {{ effect: Effect, effect_deps: Set<Value>, warned: boolean } | null} v */\nexport function set_reactivity_loss_tracker(v) {\n\treactivity_loss_tracker = v;\n}\n\nexport const recent_async_deriveds = new Set();\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function derived(fn) {\n\tvar flags = DERIVED | DIRTY;\n\n\tif (active_effect !== null) {\n\t\t// Since deriveds are evaluated lazily, any effects created inside them are\n\t\t// created too late to ensure that the parent effect is added to the tree\n\t\tactive_effect.f |= EFFECT_PRESERVED;\n\t}\n\n\t/** @type {Derived<V>} */\n\tconst signal = {\n\t\tctx: component_context,\n\t\tdeps: null,\n\t\teffects: null,\n\t\tequals,\n\t\tf: flags,\n\t\tfn,\n\t\treactions: null,\n\t\trv: 0,\n\t\tv: /** @type {V} */ (UNINITIALIZED),\n\t\twv: 0,\n\t\tparent: active_effect,\n\t\tac: null\n\t};\n\n\tif (DEV && tracing_mode_flag) {\n\t\tsignal.created = get_error('created at');\n\t}\n\n\treturn signal;\n}\n\nexport const OBSOLETE = Symbol('obsolete');\n\n/**\n * @template V\n * @param {() => V | Promise<V>} fn\n * @param {string} [label]\n * @param {string} [location] If provided, print a warning if the value is not read immediately after update\n * @returns {Promise<Source<V>>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function async_derived(fn, label, location) {\n\tlet parent = /** @type {Effect | null} */ (active_effect);\n\n\tif (parent === null) {\n\t\te.async_derived_orphan();\n\t}\n\n\tvar promise = /** @type {Promise<V>} */ (/** @type {unknown} */ (undefined));\n\tvar signal = source(/** @type {V} */ (UNINITIALIZED));\n\n\tif (DEV) signal.label = label ?? fn.toString();\n\n\t// only suspend in async deriveds created on initialisation\n\tvar should_suspend = !active_reaction;\n\n\t/** @type {Set<ReturnType<typeof deferred<V>>>} */\n\tvar deferreds = new Set();\n\n\tasync_effect(() => {\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\tif (DEV) {\n\t\t\treactivity_loss_tracker = { effect, effect_deps: new Set(), warned: false };\n\t\t}\n\n\t\t/** @type {ReturnType<typeof deferred<V>>} */\n\t\tvar d = deferred();\n\t\tpromise = d.promise;\n\n\t\ttry {\n\t\t\t// If this code is changed at some point, make sure to still access the then property\n\t\t\t// of fn() to read any signals it might access, so that we track them as dependencies.\n\t\t\t// We call `unset_context` to undo any `save` calls that happen inside `fn()`\n\t\t\tPromise.resolve(fn())\n\t\t\t\t.then(d.resolve, (e) => {\n\t\t\t\t\t// if the promise was rejected by the user, via `getAbortSignal`, then\n\t\t\t\t\t// wait for a subsequent resolution instead of flushing the batch\n\t\t\t\t\tif (e !== STALE_REACTION) d.reject(e);\n\t\t\t\t})\n\t\t\t\t.finally(unset_context);\n\t\t} catch (error) {\n\t\t\td.reject(error);\n\t\t\tunset_context();\n\t\t}\n\n\t\tif (DEV) {\n\t\t\tif (reactivity_loss_tracker) {\n\t\t\t\t// Reused deps from previous run (indices 0 to skipped_deps-1)\n\t\t\t\t// We deliberately only track direct dependencies of the async expression to encourage\n\t\t\t\t// dependencies being directly visible at the point of the expression\n\t\t\t\tif (effect.deps !== null) {\n\t\t\t\t\tfor (let i = 0; i < skipped_deps; i += 1) {\n\t\t\t\t\t\treactivity_loss_tracker.effect_deps.add(effect.deps[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// New deps discovered this run\n\t\t\t\tif (new_deps !== null) {\n\t\t\t\t\tfor (let i = 0; i < new_deps.length; i += 1) {\n\t\t\t\t\t\treactivity_loss_tracker.effect_deps.add(new_deps[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treactivity_loss_tracker = null;\n\t\t}\n\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\n\t\tif (should_suspend) {\n\t\t\t// we only increment the batch's pending state for updates, not creation, otherwise\n\t\t\t// we will decrement to zero before the work that depends on this promise (e.g. a\n\t\t\t// template effect) has initialized, causing the batch to resolve prematurely\n\t\t\tif ((effect.f & REACTION_RAN) !== 0) {\n\t\t\t\tvar decrement_pending = increment_pending();\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t// boundary can be null if the async derived is inside an $effect.root not connected to the component render tree\n\t\t\t\tparent.b?.is_rendered()\n\t\t\t) {\n\t\t\t\tbatch.async_deriveds.get(effect)?.reject(OBSOLETE);\n\t\t\t} else {\n\t\t\t\t// While the boundary is still showing pending, a new run supersedes all older in-flight runs\n\t\t\t\t// for this async expression. Cancel eagerly so resolution cannot commit stale values.\n\t\t\t\tfor (const d of deferreds.values()) {\n\t\t\t\t\td.reject(OBSOLETE);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdeferreds.add(d);\n\t\t\tbatch.async_deriveds.set(effect, d);\n\t\t}\n\n\t\t/**\n\t\t * @param {any} value\n\t\t * @param {unknown} error\n\t\t */\n\t\tconst handler = (value, error = undefined) => {\n\t\t\tif (DEV) {\n\t\t\t\treactivity_loss_tracker = null;\n\t\t\t}\n\n\t\t\tdecrement_pending?.();\n\t\t\tdeferreds.delete(d);\n\n\t\t\tif (error === OBSOLETE) return;\n\n\t\t\tbatch.activate();\n\n\t\t\tif (error) {\n\t\t\t\tsignal.f |= ERROR_VALUE;\n\n\t\t\t\t// @ts-expect-error the error is the wrong type, but we don't care\n\t\t\t\tinternal_set(signal, error);\n\t\t\t} else {\n\t\t\t\tif ((signal.f & ERROR_VALUE) !== 0) {\n\t\t\t\t\tsignal.f ^= ERROR_VALUE;\n\t\t\t\t}\n\n\t\t\t\tif (DEV && location !== undefined && !signal.equals(value)) {\n\t\t\t\t\trecent_async_deriveds.add(signal);\n\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (recent_async_deriveds.has(signal) && (effect.f & DESTROYED) === 0) {\n\t\t\t\t\t\t\tw.await_waterfall(/** @type {string} */ (signal.label), location);\n\t\t\t\t\t\t\trecent_async_deriveds.delete(signal);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tinternal_set(signal, value);\n\t\t\t}\n\n\t\t\tbatch.deactivate();\n\t\t};\n\n\t\td.promise.then(handler, (e) => handler(null, e || 'unknown'));\n\t});\n\n\tteardown(() => {\n\t\tfor (const d of deferreds) {\n\t\t\td.reject(OBSOLETE);\n\t\t}\n\t});\n\n\tif (DEV) {\n\t\t// add a flag that lets this be printed as a derived\n\t\t// when using `$inspect.trace()`\n\t\tsignal.f |= ASYNC;\n\t}\n\n\treturn new Promise((fulfil) => {\n\t\t/** @param {Promise<V>} p */\n\t\tfunction next(p) {\n\t\t\tfunction go() {\n\t\t\t\tif (p === promise) {\n\t\t\t\t\tfulfil(signal);\n\t\t\t\t} else {\n\t\t\t\t\t// if the effect re-runs before the initial promise\n\t\t\t\t\t// resolves, delay resolution until we have a value\n\t\t\t\t\tnext(promise);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tp.then(go, go);\n\t\t}\n\n\t\tnext(promise);\n\t});\n}\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function user_derived(fn) {\n\tconst d = derived(fn);\n\n\tif (!async_mode_flag) push_reaction_value(d);\n\n\treturn d;\n}\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function derived_safe_equal(fn) {\n\tconst signal = derived(fn);\n\tsignal.equals = safe_equals;\n\treturn signal;\n}\n\n/**\n * @param {Derived} derived\n * @returns {void}\n */\nexport function destroy_derived_effects(derived) {\n\tvar effects = derived.effects;\n\n\tif (effects !== null) {\n\t\tderived.effects = null;\n\n\t\tfor (var i = 0; i < effects.length; i += 1) {\n\t\t\tdestroy_effect(/** @type {Effect} */ (effects[i]));\n\t\t}\n\t}\n}\n\n/**\n * The currently updating deriveds, used to detect infinite recursion\n * in dev mode and provide a nicer error than 'too much recursion'\n * @type {Derived[]}\n */\nlet stack = [];\n\n/**\n * @template T\n * @param {Derived} derived\n * @returns {T}\n */\nexport function execute_derived(derived) {\n\tvar value;\n\tvar prev_active_effect = active_effect;\n\tvar parent = derived.parent;\n\n\tif (\n\t\t!is_destroying_effect &&\n\t\tparent !== null &&\n\t\tderived.v !== UNINITIALIZED && // if it was never evaluated before, it's guaranteed to fail downstream, so we try to execute instead\n\t\t(parent.f & (DESTROYED | INERT)) !== 0\n\t) {\n\t\tw.derived_inert();\n\n\t\treturn derived.v;\n\t}\n\n\tset_active_effect(parent);\n\n\tif (DEV) {\n\t\tlet prev_eager_effects = eager_effects;\n\t\tset_eager_effects(new Set());\n\t\ttry {\n\t\t\tif (includes.call(stack, derived)) {\n\t\t\t\te.derived_references_self();\n\t\t\t}\n\n\t\t\tstack.push(derived);\n\n\t\t\tderived.f &= ~WAS_MARKED;\n\t\t\tdestroy_derived_effects(derived);\n\t\t\tvalue = update_reaction(derived);\n\t\t} finally {\n\t\t\tset_active_effect(prev_active_effect);\n\t\t\tset_eager_effects(prev_eager_effects);\n\t\t\tstack.pop();\n\t\t}\n\t} else {\n\t\ttry {\n\t\t\tderived.f &= ~WAS_MARKED;\n\t\t\tdestroy_derived_effects(derived);\n\t\t\tvalue = update_reaction(derived);\n\t\t} finally {\n\t\t\tset_active_effect(prev_active_effect);\n\t\t}\n\t}\n\n\treturn value;\n}\n\n/**\n * @param {Derived} derived\n * @returns {void}\n */\nexport function update_derived(derived) {\n\tvar value = execute_derived(derived);\n\n\tif (!derived.equals(value)) {\n\t\tderived.wv = increment_write_version();\n\n\t\t// in a fork, we don't update the underlying value, just `batch_values`.\n\t\t// the underlying value will be updated when the fork is committed.\n\t\t// otherwise, the next time we get here after a 'real world' state\n\t\t// change, `derived.equals` may incorrectly return `true`\n\t\tif (!current_batch?.is_fork || derived.deps === null) {\n\t\t\tif (current_batch !== null) {\n\t\t\t\t// We also write to previous_batch because if it exists, it is a sign that we're\n\t\t\t\t// currently in the process of flushing effects. These updates to deriveds may belong\n\t\t\t\t// to the previous batch, not the new one (which can already exist if an earlier\n\t\t\t\t// effect wrote to a source). This can cause bugs when running batch.#commit() later,\n\t\t\t\t// but not adding it to current_batch can, too, so we add it to both.\n\t\t\t\t// See https://github.com/sveltejs/svelte/pull/18117 for more details.\n\t\t\t\tcurrent_batch.capture(derived, value, true);\n\t\t\t\tprevious_batch?.capture(derived, value, true);\n\t\t\t} else {\n\t\t\t\tderived.v = value;\n\t\t\t}\n\n\t\t\t// deriveds without dependencies should never be recomputed\n\t\t\tif (derived.deps === null) {\n\t\t\t\tset_signal_status(derived, CLEAN);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\t// don't mark derived clean if we're reading it inside a\n\t// cleanup function, or it will cache a stale value\n\tif (is_destroying_effect) {\n\t\treturn;\n\t}\n\n\t// During time traveling we don't want to reset the status so that\n\t// traversal of the graph in the other batches still happens\n\tif (batch_values !== null) {\n\t\t// only cache the value if we're in a tracking context, otherwise we won't\n\t\t// clear the cache in `mark_reactions` when dependencies are updated\n\t\tif (effect_tracking() || current_batch?.is_fork) {\n\t\t\tbatch_values.set(derived, value);\n\t\t}\n\t} else {\n\t\tupdate_derived_status(derived);\n\t}\n}\n\n/**\n * @param {Derived} derived\n */\nexport function freeze_derived_effects(derived) {\n\tif (derived.effects === null) return;\n\n\tfor (const e of derived.effects) {\n\t\t// if the effect has a teardown function or abort signal, call it\n\t\tif (e.teardown || e.ac) {\n\t\t\te.teardown?.();\n\t\t\tif (e.ac !== null) {\n\t\t\t\twithout_reactive_context(() => {\n\t\t\t\t\t/** @type {AbortController} */ (e.ac).abort(STALE_REACTION);\n\t\t\t\t\te.ac = null;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// make it a noop so it doesn't get called again if the derived\n\t\t\t// is unfrozen. we don't set it to `null`, because the existence\n\t\t\t// of a teardown function is what determines whether the\n\t\t\t// effect runs again during unfreezing (but not for teardown-only effects)\n\t\t\tif (e.fn !== null) e.teardown = noop;\n\n\t\t\tremove_reactions(e, 0);\n\t\t\tdestroy_effect_children(e);\n\t\t}\n\t}\n}\n\n/**\n * @param {Derived} derived\n */\nexport function unfreeze_derived_effects(derived) {\n\tif (derived.effects === null) return;\n\n\tfor (const e of derived.effects) {\n\t\t// if the effect was previously frozen — indicated by the presence\n\t\t// of a teardown function — unfreeze it\n\t\tif (e.teardown && e.fn !== null) {\n\t\t\tupdate_effect(e);\n\t\t}\n\t}\n}\n","/** @import { Fork } from 'svelte' */\n/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */\nimport {\n\tBLOCK_EFFECT,\n\tBRANCH_EFFECT,\n\tCLEAN,\n\tDESTROYED,\n\tDIRTY,\n\tEFFECT,\n\tASYNC,\n\tINERT,\n\tRENDER_EFFECT,\n\tROOT_EFFECT,\n\tMAYBE_DIRTY,\n\tDERIVED,\n\tEAGER_EFFECT,\n\tERROR_VALUE,\n\tMANAGED_EFFECT,\n\tREACTION_RAN,\n\tDESTROYING\n} from '#client/constants';\nimport { async_mode_flag } from '../../flags/index.js';\nimport { deferred, define_property, includes } from '../../shared/utils.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tincrement_write_version,\n\tis_dirty,\n\tupdate_effect\n} from '../runtime.js';\nimport * as e from '../errors.js';\nimport { flush_tasks, queue_micro_task } from '../dom/task.js';\nimport { DEV } from 'esm-env';\nimport { invoke_error_boundary } from '../error-handling.js';\nimport { flush_eager_effects, old_values, set_eager_effects, source, update } from './sources.js';\nimport { eager_effect, teardown, unlink_effect } from './effects.js';\nimport { defer_effect } from './utils.js';\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { set_signal_status } from './status.js';\nimport { legacy_is_updating_store } from './store.js';\nimport { invariant } from '../../shared/dev.js';\nimport { log_effect_tree } from '../dev/debug.js';\nimport { OBSOLETE } from './deriveds.js';\n\n/** @type {Batch | null} */\nlet first_batch = null;\n\n/** @type {Batch | null} */\nlet last_batch = null;\n\n/** @type {Batch | null} */\nexport let current_batch = null;\n\n/**\n * This is needed to avoid overwriting inputs\n * @type {Batch | null}\n */\nexport let previous_batch = null;\n\n/**\n * When time travelling (i.e. working in one batch, while other batches\n * still have ongoing work), we ignore the real values of affected\n * signals in favour of their values within the batch\n * @type {Map<Value, any> | null}\n */\nexport let batch_values = null;\n\n/** @type {Effect | null} */\nlet last_scheduled_effect = null;\n\nexport let is_flushing_sync = false;\nlet is_processing = false;\n\n/**\n * During traversal, this is an array. Newly created effects are (if not immediately\n * executed) pushed to this array, rather than going through the scheduling\n * rigamarole that would cause another turn of the flush loop.\n * @type {Effect[] | null}\n */\nexport let collected_effects = null;\n\n/**\n * An array of effects that are marked during traversal as a result of a `set`\n * (not `internal_set`) call. These will be added to the next batch and\n * trigger another `batch.process()`\n * @type {Effect[] | null}\n * @deprecated when we get rid of legacy mode and stores, we can get rid of this\n */\nexport let legacy_updates = null;\n\nvar flush_count = 0;\n\n/** @type {Set<Value>} */\nvar source_stacks = new Set();\n\nlet uid = 1;\n\nexport class Batch {\n\tid = uid++;\n\n\t/** True as soon as `#process` was called */\n\t#started = false;\n\n\tlinked = true;\n\n\t/** @type {Batch | null} */\n\t#prev = null;\n\n\t/** @type {Batch | null} */\n\t#next = null;\n\n\t/** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */\n\tasync_deriveds = new Map();\n\n\t/**\n\t * The current values of any signals that are updated in this batch.\n\t * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)\n\t * They keys of this map are identical to `this.#previous`\n\t * @type {Map<Value, [any, boolean]>}\n\t */\n\tcurrent = new Map();\n\n\t/**\n\t * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.\n\t * They keys of this map are identical to `this.#current`\n\t * @type {Map<Value, any>}\n\t */\n\tprevious = new Map();\n\n\t/**\n\t * When the batch is committed (and the DOM is updated), we need to remove old branches\n\t * and append new ones by calling the functions added inside (if/each/key/etc) blocks\n\t * @type {Set<(batch: Batch) => void>}\n\t */\n\t#commit_callbacks = new Set();\n\n\t/**\n\t * If a fork is discarded, we need to destroy any effects that are no longer needed\n\t * @type {Set<(batch: Batch) => void>}\n\t */\n\t#discard_callbacks = new Set();\n\n\t/**\n\t * The number of async effects that are currently in flight\n\t */\n\t#pending = 0;\n\n\t/**\n\t * Async effects that are currently in flight, _not_ inside a pending boundary\n\t * @type {Map<Effect, number>}\n\t */\n\t#blocking_pending = new Map();\n\n\t/**\n\t * A deferred that resolves when the batch is committed, used with `settled()`\n\t * TODO replace with Promise.withResolvers once supported widely enough\n\t * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}\n\t */\n\t#deferred = null;\n\n\t/**\n\t * The root effects that need to be flushed\n\t * @type {Effect[]}\n\t */\n\t#roots = [];\n\n\t/**\n\t * Effects created while this batch was active.\n\t * @type {Effect[]}\n\t */\n\t#new_effects = [];\n\n\t/**\n\t * Deferred effects (which run after async work has completed) that are DIRTY\n\t * @type {Set<Effect>}\n\t */\n\t#dirty_effects = new Set();\n\n\t/**\n\t * Deferred effects that are MAYBE_DIRTY\n\t * @type {Set<Effect>}\n\t */\n\t#maybe_dirty_effects = new Set();\n\n\t/**\n\t * A map of branches that still exist, but will be destroyed when this batch\n\t * is committed — we skip over these during `process`.\n\t * The value contains child effects that were dirty/maybe_dirty before being reset,\n\t * so they can be rescheduled if the branch survives.\n\t * @type {Map<Effect, { d: Effect[], m: Effect[] }>}\n\t */\n\t#skipped_branches = new Map();\n\n\t/**\n\t * Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing\n\t * @type {Set<Effect>}\n\t */\n\t#unskipped_branches = new Set();\n\n\tis_fork = false;\n\n\t#decrement_queued = false;\n\n\tconstructor() {\n\t\t// link batch\n\t\tif (last_batch === null) {\n\t\t\tfirst_batch = last_batch = this;\n\t\t} else {\n\t\t\tlast_batch.#next = this;\n\t\t\tthis.#prev = last_batch;\n\t\t}\n\n\t\tlast_batch = this;\n\t}\n\n\t#is_deferred() {\n\t\tif (this.is_fork) return true;\n\n\t\tfor (const effect of this.#blocking_pending.keys()) {\n\t\t\tvar e = effect;\n\t\t\tvar skipped = false;\n\n\t\t\twhile (e.parent !== null) {\n\t\t\t\tif (this.#skipped_branches.has(e)) {\n\t\t\t\t\tskipped = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\te = e.parent;\n\t\t\t}\n\n\t\t\tif (!skipped) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Add an effect to the #skipped_branches map and reset its children\n\t * @param {Effect} effect\n\t */\n\tskip_effect(effect) {\n\t\tif (!this.#skipped_branches.has(effect)) {\n\t\t\tthis.#skipped_branches.set(effect, { d: [], m: [] });\n\t\t}\n\t\tthis.#unskipped_branches.delete(effect);\n\t}\n\n\t/**\n\t * Remove an effect from the #skipped_branches map and reschedule\n\t * any tracked dirty/maybe_dirty child effects\n\t * @param {Effect} effect\n\t * @param {(e: Effect) => void} callback\n\t */\n\tunskip_effect(effect, callback = (e) => this.schedule(e)) {\n\t\tvar tracked = this.#skipped_branches.get(effect);\n\t\tif (tracked) {\n\t\t\tthis.#skipped_branches.delete(effect);\n\n\t\t\tfor (var e of tracked.d) {\n\t\t\t\tset_signal_status(e, DIRTY);\n\t\t\t\tcallback(e);\n\t\t\t}\n\n\t\t\tfor (e of tracked.m) {\n\t\t\t\tset_signal_status(e, MAYBE_DIRTY);\n\t\t\t\tcallback(e);\n\t\t\t}\n\t\t}\n\t\tthis.#unskipped_branches.add(effect);\n\t}\n\n\t#process() {\n\t\tthis.#started = true;\n\n\t\tif (flush_count++ > 1000) {\n\t\t\tthis.#unlink();\n\t\t\tinfinite_loop_guard();\n\t\t}\n\n\t\tif (DEV) {\n\t\t\t// track all the values that were updated during this flush,\n\t\t\t// so that they can be reset afterwards\n\t\t\tfor (const value of this.current.keys()) {\n\t\t\t\tsource_stacks.add(value);\n\t\t\t}\n\t\t}\n\n\t\t// We always reschedule previously-deferred effects, not just when\n\t\t// #is_deferred() is true, because traversing the tree could make\n\t\t// an if block that contains the last blocking pending effect falsy,\n\t\t// causing the block to no longer be deferred.\n\t\tfor (const e of this.#dirty_effects) {\n\t\t\tthis.#maybe_dirty_effects.delete(e);\n\t\t\tset_signal_status(e, DIRTY);\n\t\t\tthis.schedule(e);\n\t\t}\n\n\t\tfor (const e of this.#maybe_dirty_effects) {\n\t\t\tset_signal_status(e, MAYBE_DIRTY);\n\t\t\tthis.schedule(e);\n\t\t}\n\n\t\tconst roots = this.#roots;\n\t\tthis.#roots = [];\n\n\t\tthis.apply();\n\n\t\t/** @type {Effect[]} */\n\t\tvar effects = (collected_effects = []);\n\n\t\t/** @type {Effect[]} */\n\t\tvar render_effects = [];\n\n\t\t/**\n\t\t * @type {Effect[]}\n\t\t * @deprecated when we get rid of legacy mode and stores, we can get rid of this\n\t\t */\n\t\tvar updates = (legacy_updates = []);\n\n\t\tfor (const root of roots) {\n\t\t\ttry {\n\t\t\t\tthis.#traverse(root, effects, render_effects);\n\t\t\t} catch (e) {\n\t\t\t\treset_all(root);\n\t\t\t\t// If there's no async work left, this branch is now dead and needs\n\t\t\t\t// to be discarded to not become a zombie that is never cleaned up.\n\t\t\t\t// See https://github.com/sveltejs/svelte/issues/18221#issuecomment-4497918414\n\t\t\t\t// for a (non-minimal) reproduction that demonstrates a case where this is necessary\n\t\t\t\t// to not get follow-up false-positives via \"batch has scheduled roots\" invariant errors.\n\t\t\t\tif (!this.#is_deferred()) this.discard();\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\n\t\t// any writes should take effect in a subsequent batch\n\t\tcurrent_batch = null;\n\n\t\tif (updates.length > 0) {\n\t\t\tvar batch = Batch.ensure();\n\t\t\tfor (const e of updates) {\n\t\t\t\tbatch.schedule(e);\n\t\t\t}\n\t\t}\n\n\t\tcollected_effects = null;\n\t\tlegacy_updates = null;\n\n\t\t// if the batch has outstanding pending work, stash effects and bail\n\t\tif (this.#is_deferred()) {\n\t\t\tthis.#defer_effects(render_effects);\n\t\t\tthis.#defer_effects(effects);\n\n\t\t\tfor (const [e, t] of this.#skipped_branches) {\n\t\t\t\treset_branch(e, t);\n\t\t\t}\n\n\t\t\tif (updates.length > 0) {\n\t\t\t\t/** @type {Batch} */ (/** @type {unknown} */ (current_batch)).#process();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst earlier_batch = this.#find_earlier_batch();\n\n\t\tif (earlier_batch) {\n\t\t\t// If this batch collected deferred effects during traversal, they still need\n\t\t\t// to run after being merged into the earlier batch.\n\t\t\tthis.#defer_effects(render_effects);\n\t\t\tthis.#defer_effects(effects);\n\t\t\tearlier_batch.#merge(this);\n\t\t\treturn;\n\t\t}\n\n\t\t// clear effects. Those that are still needed will be rescheduled through unskipping the skipped branches.\n\t\tthis.#dirty_effects.clear();\n\t\tthis.#maybe_dirty_effects.clear();\n\n\t\t// append/remove branches\n\t\tfor (const fn of this.#commit_callbacks) fn(this);\n\t\tthis.#commit_callbacks.clear();\n\n\t\tprevious_batch = this;\n\t\tflush_queued_effects(render_effects);\n\t\tflush_queued_effects(effects);\n\t\tprevious_batch = null;\n\n\t\tthis.#deferred?.resolve();\n\n\t\tvar next_batch = /** @type {Batch | null} */ (/** @type {unknown} */ (current_batch));\n\n\t\tif (this.#pending === 0 && (this.#roots.length === 0 || next_batch !== null)) {\n\t\t\tthis.#unlink();\n\n\t\t\t// Order matters here - we need to commit and THEN continue flushing new batches, not the other way around,\n\t\t\t// else we could start flushing a new batch and then, if it has pending work, rebase it right afterwards, which is wrong.\n\t\t\t// In sync mode flushSync can cause #commit to wrongfully think that there needs to be a rebase, so we only do it in async mode\n\t\t\t// TODO fix the underlying cause, otherwise this will likely regress when non-async mode is removed\n\t\t\tif (async_mode_flag) {\n\t\t\t\tthis.#commit();\n\t\t\t\t// Rebases can activate other batches or null it out, therefore restore the new one here\n\t\t\t\tcurrent_batch = next_batch;\n\t\t\t}\n\t\t}\n\n\t\t// Edge case: During traversal new branches might create effects that run immediately and set state,\n\t\t// causing an effect and therefore a root to be scheduled again. We need to traverse the current batch\n\t\t// once more in that case - most of the time this will just clean up dirty branches.\n\t\tif (this.#roots.length > 0) {\n\t\t\tif (next_batch !== null) {\n\t\t\t\tconst batch = next_batch;\n\t\t\t\tbatch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r)));\n\t\t\t} else {\n\t\t\t\tnext_batch = this;\n\t\t\t}\n\t\t}\n\n\t\tif (next_batch !== null) {\n\t\t\told_values.clear();\n\t\t\tnext_batch.#process();\n\t\t}\n\t}\n\n\t/**\n\t * Traverse the effect tree, executing effects or stashing\n\t * them for later execution as appropriate\n\t * @param {Effect} root\n\t * @param {Effect[]} effects\n\t * @param {Effect[]} render_effects\n\t */\n\t#traverse(root, effects, render_effects) {\n\t\troot.f ^= CLEAN;\n\n\t\tvar effect = root.first;\n\n\t\twhile (effect !== null) {\n\t\t\tvar flags = effect.f;\n\t\t\tvar is_branch = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;\n\t\t\tvar is_skippable_branch = is_branch && (flags & CLEAN) !== 0;\n\n\t\t\tvar skip = is_skippable_branch || (flags & INERT) !== 0 || this.#skipped_branches.has(effect);\n\n\t\t\tif (!skip && effect.fn !== null) {\n\t\t\t\tif (is_branch) {\n\t\t\t\t\teffect.f ^= CLEAN;\n\t\t\t\t} else if ((flags & EFFECT) !== 0) {\n\t\t\t\t\teffects.push(effect);\n\t\t\t\t} else if (async_mode_flag && (flags & (RENDER_EFFECT | MANAGED_EFFECT)) !== 0) {\n\t\t\t\t\trender_effects.push(effect);\n\t\t\t\t} else if (is_dirty(effect)) {\n\t\t\t\t\tif ((flags & BLOCK_EFFECT) !== 0) this.#maybe_dirty_effects.add(effect);\n\t\t\t\t\tupdate_effect(effect);\n\t\t\t\t}\n\n\t\t\t\tvar child = effect.first;\n\n\t\t\t\tif (child !== null) {\n\t\t\t\t\teffect = child;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twhile (effect !== null) {\n\t\t\t\tvar next = effect.next;\n\n\t\t\t\tif (next !== null) {\n\t\t\t\t\teffect = next;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\teffect = effect.parent;\n\t\t\t}\n\t\t}\n\t}\n\n\t#find_earlier_batch() {\n\t\tvar batch = this.#prev;\n\n\t\twhile (batch !== null) {\n\t\t\tif (!batch.is_fork) {\n\t\t\t\t// if the batches are connected, break\n\t\t\t\tfor (const [value, [, is_derived]] of this.current) {\n\t\t\t\t\tif (batch.current.has(value) && !is_derived) {\n\t\t\t\t\t\treturn batch;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbatch = batch.#prev;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#merge(batch) {\n\t\tfor (const [source, value] of batch.current) {\n\t\t\tif (!this.previous.has(source) && batch.previous.has(source)) {\n\t\t\t\tthis.previous.set(source, batch.previous.get(source));\n\t\t\t}\n\n\t\t\tthis.current.set(source, value);\n\t\t}\n\n\t\tfor (const [effect, deferred] of batch.async_deriveds) {\n\t\t\tconst d = this.async_deriveds.get(effect);\n\t\t\tif (d) deferred.promise.then(d.resolve).catch(d.reject);\n\t\t}\n\n\t\t// Clear them or else those that are still pending might get rejected on discard (after merged-into batch is done).\n\t\t// This can happen when batch Y merged into X and Y has a pending boundary and therefore still-pending async deriveds inside.\n\t\tbatch.async_deriveds.clear();\n\n\t\t// Mark is not guaranteed not touch these, so we transfer them\n\t\tthis.transfer_effects(batch.#dirty_effects, batch.#maybe_dirty_effects);\n\n\t\t/**\n\t\t * mark all effects that depend on `batch.current`, except the\n\t\t * async effects that we just resolved (TODO unless they depend\n\t\t * on values in this batch that are NOT in the later batch?).\n\t\t * Through this we also will populate the correct #skipped_branches,\n\t\t * oncommit callbacks etc, so we don't need to merge them separately.\n\t\t * @param {Value} value\n\t\t */\n\t\tconst mark = (value) => {\n\t\t\tvar reactions = value.reactions;\n\t\t\tif (reactions === null) return;\n\t\t\t// skip if value is derived and is neither dirty nor maybe dirty. transitive\n\t\t\t// deriveds (a derived depending on another derived) are only MAYBE_DIRTY, so\n\t\t\t// we must continue traversing them to reach the effects that depend on them\n\t\t\tif ((value.f & DERIVED) !== 0 && (value.f & (DIRTY | MAYBE_DIRTY)) === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfor (const reaction of reactions) {\n\t\t\t\tvar flags = reaction.f;\n\n\t\t\t\tif ((flags & DERIVED) !== 0) {\n\t\t\t\t\tmark(/** @type {Derived} */ (reaction));\n\t\t\t\t} else {\n\t\t\t\t\tvar effect = /** @type {Effect} */ (reaction);\n\n\t\t\t\t\tif (flags & (ASYNC | BLOCK_EFFECT) && !this.async_deriveds.has(effect)) {\n\t\t\t\t\t\tthis.#maybe_dirty_effects.delete(effect);\n\t\t\t\t\t\tset_signal_status(effect, DIRTY);\n\t\t\t\t\t\tthis.schedule(effect);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tfor (const source of this.current.keys()) {\n\t\t\tmark(source);\n\t\t}\n\n\t\tthis.oncommit(() => batch.discard());\n\t\tbatch.#unlink();\n\n\t\tcurrent_batch = this;\n\t\tthis.#process();\n\t}\n\n\t/**\n\t * @param {Effect[]} effects\n\t */\n\t#defer_effects(effects) {\n\t\tfor (var i = 0; i < effects.length; i += 1) {\n\t\t\tdefer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);\n\t\t}\n\t}\n\n\t/**\n\t * Associate a change to a given source with the current\n\t * batch, noting its previous and current values\n\t * @param {Value} source\n\t * @param {any} value\n\t * @param {boolean} [is_derived]\n\t */\n\tcapture(source, value, is_derived = false) {\n\t\tif (source.v !== UNINITIALIZED && !this.previous.has(source)) {\n\t\t\tthis.previous.set(source, source.v);\n\t\t}\n\n\t\t// Don't save errors in `batch_values`, or they won't be thrown in `runtime.js#get`\n\t\tif ((source.f & ERROR_VALUE) === 0) {\n\t\t\tthis.current.set(source, [value, is_derived]);\n\t\t\tbatch_values?.set(source, value);\n\t\t}\n\n\t\tif (!this.is_fork) {\n\t\t\tsource.v = value;\n\t\t}\n\t}\n\n\tactivate() {\n\t\tcurrent_batch = this;\n\t}\n\n\tdeactivate() {\n\t\tcurrent_batch = null;\n\t\tbatch_values = null;\n\t}\n\n\tflush() {\n\t\ttry {\n\t\t\tif (DEV) {\n\t\t\t\tsource_stacks.clear();\n\t\t\t}\n\n\t\t\tis_processing = true;\n\t\t\tcurrent_batch = this;\n\n\t\t\tthis.#process();\n\t\t} finally {\n\t\t\tflush_count = 0;\n\t\t\tlast_scheduled_effect = null;\n\t\t\tcollected_effects = null;\n\t\t\tlegacy_updates = null;\n\t\t\tis_processing = false;\n\n\t\t\tcurrent_batch = null;\n\t\t\tbatch_values = null;\n\n\t\t\told_values.clear();\n\n\t\t\tif (DEV) {\n\t\t\t\tfor (const source of source_stacks) {\n\t\t\t\t\tsource.updated = null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tdiscard() {\n\t\tfor (const fn of this.#discard_callbacks) fn(this);\n\t\tthis.#discard_callbacks.clear();\n\n\t\tfor (const deferred of this.async_deriveds.values()) {\n\t\t\tdeferred.reject(OBSOLETE);\n\t\t}\n\n\t\tthis.#unlink();\n\t\tthis.#deferred?.resolve();\n\t}\n\n\t/**\n\t * @param {Effect} effect\n\t */\n\tregister_created_effect(effect) {\n\t\tthis.#new_effects.push(effect);\n\t}\n\n\t#commit() {\n\t\t// If there are other pending batches, they now need to be 'rebased' —\n\t\t// in other words, we re-run block/async effects with the newly\n\t\t// committed state, unless the batch in question has a more\n\t\t// recent value for a given source\n\t\tfor (let batch = first_batch; batch !== null; batch = batch.#next) {\n\t\t\tvar is_earlier = batch.id < this.id;\n\n\t\t\t/** @type {Source[]} */\n\t\t\tvar sources = [];\n\n\t\t\tfor (const [source, [value, is_derived]] of this.current) {\n\t\t\t\tif (batch.current.has(source)) {\n\t\t\t\t\tvar batch_value = /** @type {[any, boolean]} */ (batch.current.get(source))[0]; // faster than destructuring\n\n\t\t\t\t\tif (is_earlier && value !== batch_value) {\n\t\t\t\t\t\t// bring the value up to date\n\t\t\t\t\t\tbatch.current.set(source, [value, is_derived]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// same value or later batch has more recent value,\n\t\t\t\t\t\t// no need to re-run these effects\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsources.push(source);\n\t\t\t}\n\n\t\t\tif (is_earlier) {\n\t\t\t\t// TODO do we need to restart these in some cases, instead of\n\t\t\t\t// immediately resolving them? Likely not because of how this.apply() works.\n\t\t\t\tfor (const [effect, deferred] of this.async_deriveds) {\n\t\t\t\t\tconst d = batch.async_deriveds.get(effect);\n\t\t\t\t\tif (d) deferred.promise.then(d.resolve).catch(d.reject);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar current = [...batch.current.keys()].filter(\n\t\t\t\t(source) => !(/** @type {[any, boolean]} */ (batch.current.get(source))[1])\n\t\t\t);\n\n\t\t\t// If not started yet or no sources to update (which is e.g. possible for the very first batch) then bail\n\t\t\tif (!batch.#started || current.length === 0) continue;\n\n\t\t\t// Re-run async/block effects that depend on distinct values changed in both batches (ignoring deriveds)\n\t\t\tvar others = current.filter((source) => !this.current.has(source));\n\n\t\t\tif (others.length === 0) {\n\t\t\t\tif (is_earlier) {\n\t\t\t\t\t// this batch is now obsolete and can be discarded\n\t\t\t\t\tbatch.discard();\n\t\t\t\t}\n\t\t\t} else if (sources.length > 0) {\n\t\t\t\t// The microtask queue can contain the batch already scheduled to run right\n\t\t\t\t// after this one is finished, so throwing the invariant would be wrong here.\n\t\t\t\tif (DEV && !batch.#decrement_queued) {\n\t\t\t\t\tinvariant(batch.#roots.length === 0, 'Batch has scheduled roots');\n\t\t\t\t}\n\n\t\t\t\t// A batch was unskipped in a later batch -> tell prior batches to unskip it, too\n\t\t\t\tif (is_earlier) {\n\t\t\t\t\tfor (const unskipped of this.#unskipped_branches) {\n\t\t\t\t\t\tbatch.unskip_effect(unskipped, (e) => {\n\t\t\t\t\t\t\tif ((e.f & (BLOCK_EFFECT | ASYNC)) !== 0) {\n\t\t\t\t\t\t\t\tbatch.schedule(e);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tbatch.#defer_effects([e]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbatch.activate();\n\n\t\t\t\t/** @type {Set<Value>} */\n\t\t\t\tvar marked = new Set();\n\n\t\t\t\t/** @type {Map<Reaction, boolean>} */\n\t\t\t\tvar checked = new Map();\n\n\t\t\t\tfor (var source of sources) {\n\t\t\t\t\tmark_effects(source, others, marked, checked);\n\t\t\t\t}\n\n\t\t\t\tchecked = new Map();\n\t\t\t\tvar current_unequal = [...batch.current]\n\t\t\t\t\t.filter(([c, v1]) => {\n\t\t\t\t\t\tconst v2 = this.current.get(c);\n\t\t\t\t\t\tif (!v2) return true;\n\t\t\t\t\t\t// Either their values are different or one is a derived but not the other\n\t\t\t\t\t\treturn v2[0] !== v1[0] || v2[1] !== v1[1];\n\t\t\t\t\t})\n\t\t\t\t\t.map(([c]) => c);\n\n\t\t\t\tif (current_unequal.length > 0) {\n\t\t\t\t\tfor (const effect of this.#new_effects) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t(effect.f & (DESTROYED | INERT | EAGER_EFFECT)) === 0 &&\n\t\t\t\t\t\t\tdepends_on(effect, current_unequal, checked)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tif ((effect.f & (ASYNC | BLOCK_EFFECT)) !== 0) {\n\t\t\t\t\t\t\t\tset_signal_status(effect, DIRTY);\n\t\t\t\t\t\t\t\tbatch.schedule(effect);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tbatch.#dirty_effects.add(effect);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Only apply and traverse when we know we triggered async work with marking the effects\n\t\t\t\t// and know this won't run anyway right afterwards\n\t\t\t\tif (batch.#roots.length > 0 && !batch.#decrement_queued) {\n\t\t\t\t\tbatch.apply();\n\n\t\t\t\t\tfor (var root of batch.#roots) {\n\t\t\t\t\t\tbatch.#traverse(root, [], []);\n\t\t\t\t\t}\n\n\t\t\t\t\tbatch.#roots = [];\n\t\t\t\t}\n\n\t\t\t\tbatch.deactivate();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {boolean} blocking\n\t * @param {Effect} effect\n\t */\n\tincrement(blocking, effect) {\n\t\tthis.#pending += 1;\n\n\t\tif (blocking) {\n\t\t\tlet blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;\n\t\t\tthis.#blocking_pending.set(effect, blocking_pending_count + 1);\n\t\t}\n\t}\n\n\t/**\n\t * @param {boolean} blocking\n\t * @param {Effect} effect\n\t */\n\tdecrement(blocking, effect) {\n\t\tthis.#pending -= 1;\n\n\t\tif (blocking) {\n\t\t\tlet blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;\n\n\t\t\tif (blocking_pending_count === 1) {\n\t\t\t\tthis.#blocking_pending.delete(effect);\n\t\t\t} else {\n\t\t\t\tthis.#blocking_pending.set(effect, blocking_pending_count - 1);\n\t\t\t}\n\t\t}\n\n\t\tif (this.#decrement_queued) return;\n\t\tthis.#decrement_queued = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tthis.#decrement_queued = false;\n\n\t\t\tif (this.linked) {\n\t\t\t\tthis.flush();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * @param {Set<Effect>} dirty_effects\n\t * @param {Set<Effect>} maybe_dirty_effects\n\t */\n\ttransfer_effects(dirty_effects, maybe_dirty_effects) {\n\t\tfor (const e of dirty_effects) {\n\t\t\tthis.#dirty_effects.add(e);\n\t\t}\n\n\t\tfor (const e of maybe_dirty_effects) {\n\t\t\tthis.#maybe_dirty_effects.add(e);\n\t\t}\n\n\t\tdirty_effects.clear();\n\t\tmaybe_dirty_effects.clear();\n\t}\n\n\t/** @param {(batch: Batch) => void} fn */\n\toncommit(fn) {\n\t\tthis.#commit_callbacks.add(fn);\n\t}\n\n\t/** @param {(batch: Batch) => void} fn */\n\tondiscard(fn) {\n\t\tthis.#discard_callbacks.add(fn);\n\t}\n\n\tsettled() {\n\t\treturn (this.#deferred ??= deferred()).promise;\n\t}\n\n\tstatic ensure() {\n\t\tif (current_batch === null) {\n\t\t\tconst batch = (current_batch = new Batch());\n\n\t\t\tif (!is_processing && !is_flushing_sync) {\n\t\t\t\tqueue_micro_task(() => {\n\t\t\t\t\tif (!batch.#started) {\n\t\t\t\t\t\tbatch.flush();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn current_batch;\n\t}\n\n\tapply() {\n\t\tif (!async_mode_flag || (!this.is_fork && this.#prev === null && this.#next === null)) {\n\t\t\tbatch_values = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// if there are multiple batches, we are 'time travelling' —\n\t\t// we need to override values with the ones in this batch...\n\t\tbatch_values = new Map();\n\t\tfor (const [source, [value]] of this.current) {\n\t\t\tbatch_values.set(source, value);\n\t\t}\n\n\t\t// ...and undo changes belonging to other batches unless they intersect\n\t\tfor (let batch = first_batch; batch !== null; batch = batch.#next) {\n\t\t\tif (batch === this || batch.is_fork) continue;\n\n\t\t\t// If two batches intersect, the latter batch will be merged into the earlier batch,\n\t\t\t// and we should treat them as a single set of changes\n\t\t\tvar intersects = false;\n\n\t\t\tif (batch.id < this.id) {\n\t\t\t\tfor (const [source, [, is_derived]] of batch.current) {\n\t\t\t\t\t// Derived values don't partake in the intersection mechanism, because a derived could\n\t\t\t\t\t// be triggered in one batch already but not the other one yet, causing a false-positive\n\t\t\t\t\tif (is_derived) continue;\n\n\t\t\t\t\tif (this.current.has(source)) {\n\t\t\t\t\t\tintersects = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Since the latter batch merges into the earlier (if it resolves before the earlier one),\n\t\t\t// we treat the earlier values as \"already applied\". This way we don't need to rerun async\n\t\t\t// effects of the earlier batch in case they are merged.\n\t\t\t// As a result you can think of batch_values as having the latest values of all intersecting\n\t\t\t// batches up until this batch.\n\t\t\tif (!intersects) {\n\t\t\t\tfor (const [source, previous] of batch.previous) {\n\t\t\t\t\tif (!batch_values.has(source)) {\n\t\t\t\t\t\tbatch_values.set(source, previous);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {Effect} effect\n\t */\n\tschedule(effect) {\n\t\tlast_scheduled_effect = effect;\n\n\t\t// defer render effects inside a pending boundary\n\t\t// TODO the `REACTION_RAN` check is only necessary because of legacy `$:` effects AFAICT — we can remove later\n\t\tif (\n\t\t\teffect.b?.is_pending &&\n\t\t\t(effect.f & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0 &&\n\t\t\t(effect.f & REACTION_RAN) === 0\n\t\t) {\n\t\t\teffect.b.defer_effect(effect);\n\t\t\treturn;\n\t\t}\n\n\t\tvar e = effect;\n\n\t\twhile (e.parent !== null) {\n\t\t\te = e.parent;\n\t\t\tvar flags = e.f;\n\n\t\t\t// if the effect is being scheduled because a parent (each/await/etc) block\n\t\t\t// updated an internal source, or because a branch is being unskipped,\n\t\t\t// bail out or we'll cause a second flush\n\t\t\tif (collected_effects !== null && e === active_effect) {\n\t\t\t\tif (async_mode_flag) return;\n\n\t\t\t\t// in sync mode, render effects run during traversal. in an extreme edge case\n\t\t\t\t// — namely that we're setting a value inside a derived read during traversal —\n\t\t\t\t// they can be made dirty after they have already been visited, in which\n\t\t\t\t// case we shouldn't bail out. we also shouldn't bail out if we're\n\t\t\t\t// updating a store inside a `$:`, since this might invalidate\n\t\t\t\t// effects that were already visited\n\t\t\t\tif (\n\t\t\t\t\t(active_reaction === null || (active_reaction.f & DERIVED) === 0) &&\n\t\t\t\t\t!legacy_is_updating_store\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ((flags & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {\n\t\t\t\tif ((flags & CLEAN) === 0) {\n\t\t\t\t\t// branch is already dirty, bail\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\te.f ^= CLEAN;\n\t\t\t}\n\t\t}\n\n\t\tthis.#roots.push(e);\n\t}\n\n\t#unlink() {\n\t\t// #merge calls #unlink, discard later on does it again - prevent\n\t\t// running it multiple times to not corrupt the linked list\n\t\tif (!this.linked) return;\n\n\t\tvar prev = this.#prev;\n\t\tvar next = this.#next;\n\n\t\tif (prev === null) {\n\t\t\tfirst_batch = next;\n\t\t} else {\n\t\t\tprev.#next = next;\n\t\t}\n\n\t\tif (next === null) {\n\t\t\tlast_batch = prev;\n\t\t} else {\n\t\t\tnext.#prev = prev;\n\t\t}\n\n\t\tthis.linked = false;\n\t}\n}\n\n// TODO Svelte@6 think about removing the callback argument.\n/**\n * Synchronously flush any pending updates.\n * Returns void if no callback is provided, otherwise returns the result of calling the callback.\n * @template [T=void]\n * @param {(() => T) | undefined} [fn]\n * @returns {T}\n */\nexport function flushSync(fn) {\n\tvar was_flushing_sync = is_flushing_sync;\n\tis_flushing_sync = true;\n\n\ttry {\n\t\tvar result;\n\n\t\tif (fn) {\n\t\t\tif (current_batch !== null && !current_batch.is_fork) {\n\t\t\t\tcurrent_batch.flush();\n\t\t\t}\n\n\t\t\tresult = fn();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tflush_tasks();\n\n\t\t\tif (current_batch === null) {\n\t\t\t\treturn /** @type {T} */ (result);\n\t\t\t}\n\n\t\t\tcurrent_batch.flush();\n\t\t}\n\t} finally {\n\t\tis_flushing_sync = was_flushing_sync;\n\t}\n}\n\nfunction infinite_loop_guard() {\n\tif (DEV) {\n\t\tvar updates = new Map();\n\n\t\tfor (const source of /** @type {Batch} */ (current_batch).current.keys()) {\n\t\t\tfor (const [stack, update] of source.updated ?? []) {\n\t\t\t\tvar entry = updates.get(stack);\n\n\t\t\t\tif (!entry) {\n\t\t\t\t\tentry = { error: update.error, count: 0 };\n\t\t\t\t\tupdates.set(stack, entry);\n\t\t\t\t}\n\n\t\t\t\tentry.count += update.count;\n\t\t\t}\n\t\t}\n\n\t\tfor (const update of updates.values()) {\n\t\t\tif (update.error) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error(update.error);\n\t\t\t}\n\t\t}\n\t}\n\n\ttry {\n\t\te.effect_update_depth_exceeded();\n\t} catch (error) {\n\t\tif (DEV) {\n\t\t\t// stack contains no useful information, replace it\n\t\t\tdefine_property(error, 'stack', { value: '' });\n\t\t}\n\n\t\t// Best effort: invoke the boundary nearest the most recent\n\t\t// effect and hope that it's relevant to the infinite loop\n\t\tinvoke_error_boundary(error, last_scheduled_effect);\n\t}\n}\n\n/** @type {Set<Effect> | null} */\nexport let eager_block_effects = null;\n\n/**\n * @param {Array<Effect>} effects\n * @returns {void}\n */\nfunction flush_queued_effects(effects) {\n\tvar length = effects.length;\n\tif (length === 0) return;\n\n\tvar i = 0;\n\n\twhile (i < length) {\n\t\tvar effect = effects[i++];\n\n\t\tif ((effect.f & (DESTROYED | INERT)) === 0 && is_dirty(effect)) {\n\t\t\teager_block_effects = new Set();\n\n\t\t\tupdate_effect(effect);\n\n\t\t\t// Effects with no dependencies or teardown do not get added to the effect tree.\n\t\t\t// Deferred effects (e.g. `$effect(...)`) _are_ added to the tree because we\n\t\t\t// don't know if we need to keep them until they are executed. Doing the check\n\t\t\t// here (rather than in `update_effect`) allows us to skip the work for\n\t\t\t// immediate effects.\n\t\t\tif (\n\t\t\t\teffect.deps === null &&\n\t\t\t\teffect.first === null &&\n\t\t\t\teffect.nodes === null &&\n\t\t\t\teffect.teardown === null &&\n\t\t\t\teffect.ac === null\n\t\t\t) {\n\t\t\t\t// remove this effect from the graph\n\t\t\t\tunlink_effect(effect);\n\t\t\t}\n\n\t\t\t// If update_effect() has a flushSync() in it, we may have flushed another flush_queued_effects(),\n\t\t\t// which already handled this logic and did set eager_block_effects to null.\n\t\t\tif (eager_block_effects?.size > 0) {\n\t\t\t\told_values.clear();\n\n\t\t\t\tfor (const e of eager_block_effects) {\n\t\t\t\t\t// Skip eager effects that have already been unmounted\n\t\t\t\t\tif ((e.f & (DESTROYED | INERT)) !== 0) continue;\n\n\t\t\t\t\t// Run effects in order from ancestor to descendant, else we could run into nullpointers\n\t\t\t\t\t/** @type {Effect[]} */\n\t\t\t\t\tconst ordered_effects = [e];\n\t\t\t\t\tlet ancestor = e.parent;\n\t\t\t\t\twhile (ancestor !== null) {\n\t\t\t\t\t\tif (eager_block_effects.has(ancestor)) {\n\t\t\t\t\t\t\teager_block_effects.delete(ancestor);\n\t\t\t\t\t\t\tordered_effects.push(ancestor);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tancestor = ancestor.parent;\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (let j = ordered_effects.length - 1; j >= 0; j--) {\n\t\t\t\t\t\tconst e = ordered_effects[j];\n\t\t\t\t\t\t// Skip eager effects that have already been unmounted\n\t\t\t\t\t\tif ((e.f & (DESTROYED | INERT)) !== 0) continue;\n\t\t\t\t\t\tupdate_effect(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\teager_block_effects.clear();\n\t\t\t}\n\t\t}\n\t}\n\n\teager_block_effects = null;\n}\n\n/**\n * This is similar to `mark_reactions`, but it only marks async/block effects\n * depending on `value` and at least one of the other `sources`, so that\n * these effects can re-run after another batch has been committed\n * @param {Value} value\n * @param {Source[]} sources\n * @param {Set<Value>} marked\n * @param {Map<Reaction, boolean>} checked\n */\nfunction mark_effects(value, sources, marked, checked) {\n\tif (marked.has(value)) return;\n\tmarked.add(value);\n\n\tif (value.reactions !== null) {\n\t\tfor (const reaction of value.reactions) {\n\t\t\tconst flags = reaction.f;\n\n\t\t\tif ((flags & DERIVED) !== 0) {\n\t\t\t\tmark_effects(/** @type {Derived} */ (reaction), sources, marked, checked);\n\t\t\t} else if (\n\t\t\t\t(flags & (ASYNC | BLOCK_EFFECT)) !== 0 &&\n\t\t\t\t(flags & DIRTY) === 0 &&\n\t\t\t\tdepends_on(reaction, sources, checked)\n\t\t\t) {\n\t\t\t\tset_signal_status(reaction, DIRTY);\n\t\t\t\tschedule_effect(/** @type {Effect} */ (reaction));\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * When committing a fork, we need to trigger eager effects so that\n * any `$state.eager(...)` expressions update immediately. This\n * function allows us to discover them\n * @param {Value} value\n * @param {Set<Effect>} effects\n */\nfunction mark_eager_effects(value, effects) {\n\tif (value.reactions === null) return;\n\n\tfor (const reaction of value.reactions) {\n\t\tconst flags = reaction.f;\n\n\t\tif ((flags & DERIVED) !== 0) {\n\t\t\tmark_eager_effects(/** @type {Derived} */ (reaction), effects);\n\t\t} else if ((flags & EAGER_EFFECT) !== 0) {\n\t\t\tset_signal_status(reaction, DIRTY);\n\t\t\teffects.add(/** @type {Effect} */ (reaction));\n\t\t}\n\t}\n}\n\n/**\n * @param {Reaction} reaction\n * @param {Source[]} sources\n * @param {Map<Reaction, boolean>} checked\n */\nfunction depends_on(reaction, sources, checked) {\n\tconst depends = checked.get(reaction);\n\tif (depends !== undefined) return depends;\n\n\tif (reaction.deps !== null) {\n\t\tfor (const dep of reaction.deps) {\n\t\t\tif (includes.call(sources, dep)) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif ((dep.f & DERIVED) !== 0 && depends_on(/** @type {Derived} */ (dep), sources, checked)) {\n\t\t\t\tchecked.set(/** @type {Derived} */ (dep), true);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\n\tchecked.set(reaction, false);\n\n\treturn false;\n}\n\n/**\n * @param {Effect} effect\n * @returns {void}\n */\nexport function schedule_effect(effect) {\n\t/** @type {Batch} */ (current_batch).schedule(effect);\n}\n\n/** @type {Source<number>[]} */\nlet eager_versions = [];\n\nfunction eager_flush() {\n\tflushSync(() => {\n\t\tconst eager = eager_versions;\n\t\teager_versions = [];\n\t\tfor (const version of eager) {\n\t\t\tupdate(version);\n\t\t}\n\t});\n}\n\n/** @type {Map<Reaction, Source<number>>} */\nvar version_map = new Map();\n\n/**\n * Implementation of `$state.eager(fn())`\n * @template T\n * @param {() => T} fn\n * @returns {T}\n */\nexport function eager(fn) {\n\tvar initial = true;\n\tvar value = /** @type {T} */ (undefined);\n\n\tif (active_reaction === null) {\n\t\treturn fn();\n\t}\n\n\tlet parent = active_reaction;\n\n\tlet version = version_map.get(parent) ?? source(0);\n\tversion_map.set(parent, version);\n\n\tteardown(() => {\n\t\tif (parent.f & DESTROYING) version_map.delete(parent);\n\t});\n\n\tget(version);\n\n\teager_effect(() => {\n\t\tif (initial) {\n\t\t\t// the first time this runs, we create an eager effect\n\t\t\t// that will run eagerly whenever the expression changes\n\t\t\tvar previous_batch_values = batch_values;\n\n\t\t\ttry {\n\t\t\t\tbatch_values = null;\n\t\t\t\tvalue = fn();\n\t\t\t} finally {\n\t\t\t\tbatch_values = previous_batch_values;\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// the second time this effect runs, it's to schedule a\n\t\t// `version` update. since this will recreate the effect,\n\t\t// we don't need to evaluate the expression here\n\t\tif (eager_versions.length === 0) {\n\t\t\tqueue_micro_task(eager_flush);\n\t\t}\n\n\t\teager_versions.push(version);\n\t});\n\n\tinitial = false;\n\n\treturn value;\n}\n\n/**\n * Mark all the effects inside a skipped branch CLEAN, so that\n * they can be correctly rescheduled later. Tracks dirty and maybe_dirty\n * effects so they can be rescheduled if the branch survives.\n * @param {Effect} effect\n * @param {{ d: Effect[], m: Effect[] }} tracked\n */\nfunction reset_branch(effect, tracked) {\n\t// clean branch = nothing dirty inside, no need to traverse further\n\tif ((effect.f & BRANCH_EFFECT) !== 0 && (effect.f & CLEAN) !== 0) {\n\t\treturn;\n\t}\n\n\tif ((effect.f & DIRTY) !== 0) {\n\t\ttracked.d.push(effect);\n\t} else if ((effect.f & MAYBE_DIRTY) !== 0) {\n\t\ttracked.m.push(effect);\n\t}\n\n\tset_signal_status(effect, CLEAN);\n\n\tvar e = effect.first;\n\twhile (e !== null) {\n\t\treset_branch(e, tracked);\n\t\te = e.next;\n\t}\n}\n\n/**\n * Mark an entire effect tree clean following an error\n * @param {Effect} effect\n */\nfunction reset_all(effect) {\n\tset_signal_status(effect, CLEAN);\n\n\tvar e = effect.first;\n\twhile (e !== null) {\n\t\treset_all(e);\n\t\te = e.next;\n\t}\n}\n\n/**\n * Creates a 'fork', in which state changes are evaluated but not applied to the DOM.\n * This is useful for speculatively loading data (for example) when you suspect that\n * the user is about to take some action.\n *\n * Frameworks like SvelteKit can use this to preload data when the user touches or\n * hovers over a link, making any subsequent navigation feel instantaneous.\n *\n * The `fn` parameter is a synchronous function that modifies some state. The\n * state changes will be reverted after the fork is initialised, then reapplied\n * if and when the fork is eventually committed.\n *\n * When it becomes clear that a fork will _not_ be committed (e.g. because the\n * user navigated elsewhere), it must be discarded to avoid leaking memory.\n *\n * @param {() => void} fn\n * @returns {Fork}\n * @since 5.42\n */\nexport function fork(fn) {\n\tif (!async_mode_flag) {\n\t\te.experimental_async_required('fork');\n\t}\n\n\tif (current_batch !== null) {\n\t\te.fork_timing();\n\t}\n\n\tvar batch = Batch.ensure();\n\tbatch.is_fork = true;\n\tbatch_values = new Map();\n\n\tvar committed = false;\n\tvar settled = batch.settled();\n\n\tflushSync(fn);\n\n\treturn {\n\t\tcommit: async () => {\n\t\t\tif (committed) {\n\t\t\t\tawait settled;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!batch.linked) {\n\t\t\t\te.fork_discarded();\n\t\t\t}\n\n\t\t\tcommitted = true;\n\n\t\t\tbatch.is_fork = false;\n\n\t\t\t// apply changes and update write versions so deriveds see the change\n\t\t\tfor (var [source, [value]] of batch.current) {\n\t\t\t\tsource.v = value;\n\t\t\t\tsource.wv = increment_write_version();\n\t\t\t}\n\n\t\t\t// trigger any `$state.eager(...)` expressions with the new state.\n\t\t\t// eager effects don't get scheduled like other effects, so we\n\t\t\t// can't just encounter them during traversal, we need to\n\t\t\t// proactively flush them\n\t\t\t// TODO maybe there's a better implementation?\n\t\t\tflushSync(() => {\n\t\t\t\t/** @type {Set<Effect>} */\n\t\t\t\tvar eager_effects = new Set();\n\n\t\t\t\tfor (var source of batch.current.keys()) {\n\t\t\t\t\tmark_eager_effects(source, eager_effects);\n\t\t\t\t}\n\n\t\t\t\tset_eager_effects(eager_effects);\n\t\t\t\tflush_eager_effects();\n\t\t\t});\n\n\t\t\tbatch.flush();\n\t\t\tawait settled;\n\t\t},\n\t\tdiscard: () => {\n\t\t\t// cause any MAYBE_DIRTY deriveds to update\n\t\t\t// if they depend on things thath changed\n\t\t\t// inside the discarded fork\n\t\t\tfor (var source of batch.current.keys()) {\n\t\t\t\tsource.wv = increment_write_version();\n\t\t\t}\n\n\t\t\tif (!committed && batch.linked) {\n\t\t\t\tbatch.discard();\n\t\t\t}\n\t\t}\n\t};\n}\n\n/**\n * Forcibly remove all current batches, to prevent cross-talk between tests\n */\nexport function clear() {\n\tfirst_batch = last_batch = null;\n}\n","/** @import { Derived, Effect, Source, Value } from '#client' */\nimport { DEV } from 'esm-env';\nimport {\n\tactive_reaction,\n\tactive_effect,\n\tuntracked_writes,\n\tget,\n\tset_untracked_writes,\n\tuntrack,\n\tincrement_write_version,\n\tupdate_effect,\n\tcurrent_sources,\n\tis_dirty,\n\tuntracking,\n\tis_destroying_effect,\n\tpush_reaction_value\n} from '../runtime.js';\nimport { equals, safe_equals } from './equality.js';\nimport {\n\tCLEAN,\n\tDERIVED,\n\tDIRTY,\n\tBRANCH_EFFECT,\n\tEAGER_EFFECT,\n\tMAYBE_DIRTY,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tASYNC,\n\tWAS_MARKED,\n\tCONNECTED,\n\tREACTION_IS_UPDATING\n} from '#client/constants';\nimport * as e from '../errors.js';\nimport { legacy_mode_flag, tracing_mode_flag } from '../../flags/index.js';\nimport { tag_proxy } from '../dev/tracing.js';\nimport { get_error } from '../../shared/dev.js';\nimport { component_context, is_runes } from '../context.js';\nimport {\n\tBatch,\n\tbatch_values,\n\teager_block_effects,\n\tschedule_effect,\n\tlegacy_updates\n} from './batch.js';\nimport { proxy } from '../proxy.js';\nimport { execute_derived } from './deriveds.js';\nimport { set_signal_status, update_derived_status } from './status.js';\n\n/** @type {Set<Effect>} */\nexport let eager_effects = new Set();\n\n/** @type {Map<Source, any>} */\nexport const old_values = new Map();\n\n/**\n * @param {Set<any>} v\n */\nexport function set_eager_effects(v) {\n\teager_effects = v;\n}\n\nlet eager_effects_deferred = false;\n\nexport function set_eager_effects_deferred() {\n\teager_effects_deferred = true;\n}\n\n/**\n * @template V\n * @param {V} v\n * @param {Error | null} [stack]\n * @returns {Source<V>}\n */\n// TODO rename this to `state` throughout the codebase\nexport function source(v, stack) {\n\t/** @type {Value} */\n\tvar signal = {\n\t\tf: 0, // TODO ideally we could skip this altogether, but it causes type errors\n\t\tv,\n\t\treactions: null,\n\t\tequals,\n\t\trv: 0,\n\t\twv: 0\n\t};\n\n\tif (DEV && tracing_mode_flag) {\n\t\tsignal.created = stack ?? get_error('created at');\n\t\tsignal.updated = null;\n\t\tsignal.set_during_effect = false;\n\t\tsignal.trace = null;\n\t}\n\n\treturn signal;\n}\n\n/**\n * @template V\n * @param {V} v\n * @param {Error | null} [stack]\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function state(v, stack) {\n\tconst s = source(v, stack);\n\n\tpush_reaction_value(s);\n\n\treturn s;\n}\n\n/**\n * @template V\n * @param {V} initial_value\n * @param {boolean} [immutable]\n * @returns {Source<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function mutable_source(initial_value, immutable = false, trackable = true) {\n\tconst s = source(initial_value);\n\tif (!immutable) {\n\t\ts.equals = safe_equals;\n\t}\n\n\t// bind the signal to the component context, in case we need to\n\t// track updates to trigger beforeUpdate/afterUpdate callbacks\n\tif (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) {\n\t\t(component_context.l.s ??= []).push(s);\n\t}\n\n\treturn s;\n}\n\n/**\n * @template V\n * @param {Value<V>} source\n * @param {V} value\n */\nexport function mutate(source, value) {\n\tset(\n\t\tsource,\n\t\tuntrack(() => get(source))\n\t);\n\treturn value;\n}\n\n/**\n * @template V\n * @param {Source<V>} source\n * @param {V} value\n * @param {boolean} [should_proxy]\n * @returns {V}\n */\nexport function set(source, value, should_proxy = false) {\n\tif (\n\t\tactive_reaction !== null &&\n\t\t// since we are untracking the function inside `$inspect.with` we need to add this check\n\t\t// to ensure we error if state is set inside an inspect effect\n\t\t(!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) &&\n\t\tis_runes() &&\n\t\t(active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 &&\n\t\t(current_sources === null || !current_sources.has(source))\n\t) {\n\t\te.state_unsafe_mutation();\n\t}\n\n\tlet new_value = should_proxy ? proxy(value) : value;\n\n\tif (DEV) {\n\t\ttag_proxy(new_value, /** @type {string} */ (source.label));\n\t}\n\n\treturn internal_set(source, new_value, legacy_updates);\n}\n\n/**\n * @template V\n * @param {Source<V>} source\n * @param {V} value\n * @param {Effect[] | null} [updated_during_traversal]\n * @returns {V}\n */\nexport function internal_set(source, value, updated_during_traversal = null) {\n\tif (!source.equals(value)) {\n\t\tif (is_destroying_effect) {\n\t\t\told_values.set(source, value);\n\t\t} else if (!old_values.has(source)) {\n\t\t\t// only record the value from before the first write in this flush, otherwise a\n\t\t\t// teardown would see the value from before whichever write happened to be last\n\t\t\told_values.set(source, source.v);\n\t\t}\n\n\t\tvar batch = Batch.ensure();\n\t\tbatch.capture(source, value);\n\n\t\tif (DEV) {\n\t\t\tif (tracing_mode_flag || active_effect !== null) {\n\t\t\t\tsource.updated ??= new Map();\n\n\t\t\t\t// For performance reasons, when not using $inspect.trace, we only start collecting stack traces\n\t\t\t\t// after the same source has been updated more than 5 times in the same flush cycle.\n\t\t\t\tconst count = (source.updated.get('')?.count ?? 0) + 1;\n\t\t\t\tsource.updated.set('', { error: /** @type {any} */ (null), count });\n\n\t\t\t\tif (tracing_mode_flag || count > 5) {\n\t\t\t\t\tconst error = get_error('updated at');\n\n\t\t\t\t\tif (error !== null) {\n\t\t\t\t\t\tlet entry = source.updated.get(error.stack);\n\n\t\t\t\t\t\tif (!entry) {\n\t\t\t\t\t\t\tentry = { error, count: 0 };\n\t\t\t\t\t\t\tsource.updated.set(error.stack, entry);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tentry.count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (active_effect !== null) {\n\t\t\t\tsource.set_during_effect = true;\n\t\t\t}\n\t\t}\n\n\t\tif ((source.f & DERIVED) !== 0) {\n\t\t\tconst derived = /** @type {Derived} */ (source);\n\n\t\t\t// if we are assigning to a dirty derived we set it to clean/maybe dirty but we also eagerly execute it to track the dependencies\n\t\t\tif ((source.f & DIRTY) !== 0) {\n\t\t\t\texecute_derived(derived);\n\t\t\t}\n\n\t\t\t// During time traveling we don't want to reset the status so that\n\t\t\t// traversal of the graph in the other batches still happens\n\t\t\tif (batch_values === null) {\n\t\t\t\tupdate_derived_status(derived);\n\t\t\t}\n\t\t}\n\n\t\tsource.wv = increment_write_version();\n\n\t\t// For debugging, in case you want to know which reactions are being scheduled:\n\t\t// log_reactions(source);\n\t\tmark_reactions(source, DIRTY, updated_during_traversal);\n\n\t\t// It's possible that the current reaction might not have up-to-date dependencies\n\t\t// whilst it's actively running. So in the case of ensuring it registers the reaction\n\t\t// properly for itself, we need to ensure the current effect actually gets\n\t\t// scheduled. i.e: `$effect(() => x++)`\n\t\tif (\n\t\t\tis_runes() &&\n\t\t\tactive_effect !== null &&\n\t\t\t(active_effect.f & CLEAN) !== 0 &&\n\t\t\t(active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0\n\t\t) {\n\t\t\tif (untracked_writes === null) {\n\t\t\t\tset_untracked_writes([source]);\n\t\t\t} else {\n\t\t\t\tuntracked_writes.push(source);\n\t\t\t}\n\t\t}\n\n\t\tif (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) {\n\t\t\tflush_eager_effects();\n\t\t}\n\t}\n\n\treturn value;\n}\n\nexport function flush_eager_effects() {\n\teager_effects_deferred = false;\n\n\tfor (const effect of eager_effects) {\n\t\t// Mark clean inspect-effects as maybe dirty and then check their dirtiness\n\t\t// instead of just updating the effects - this way we avoid overfiring.\n\t\tif ((effect.f & CLEAN) !== 0) {\n\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t}\n\n\t\tlet dirty;\n\n\t\ttry {\n\t\t\tdirty = is_dirty(effect);\n\t\t} catch {\n\t\t\t// Dirty-checking can evaluate derived dependencies and throw in cases where\n\t\t\t// parent effects are about to destroy this eager effect. Run the effect so\n\t\t\t// its own error handling can deal with transient failures.\n\t\t\tdirty = true;\n\t\t}\n\n\t\tif (dirty) {\n\t\t\tupdate_effect(effect);\n\t\t}\n\t}\n\n\teager_effects.clear();\n}\n\n/**\n * @template {number | bigint} T\n * @param {Source<T>} source\n * @param {1 | -1} [d]\n * @returns {T}\n */\nexport function update(source, d = 1) {\n\tvar value = get(source);\n\tvar result = d === 1 ? value++ : value--;\n\n\tset(source, value);\n\n\t// @ts-expect-error\n\treturn result;\n}\n\n/**\n * @template {number | bigint} T\n * @param {Source<T>} source\n * @param {1 | -1} [d]\n * @returns {T}\n */\nexport function update_pre(source, d = 1) {\n\tvar value = get(source);\n\n\t// @ts-expect-error\n\t// eslint-disable-next-line no-useless-assignment -- `++`/`--` used for return value, not side effect on `value`\n\treturn set(source, d === 1 ? ++value : --value);\n}\n\n/**\n * Silently (without using `get`) increment a source\n * @param {Source<number>} source\n */\nexport function increment(source) {\n\tset(source, source.v + 1);\n}\n\n/**\n * @param {Value} signal\n * @param {number} status should be DIRTY or MAYBE_DIRTY\n * @param {Effect[] | null} updated_during_traversal\n * @returns {void}\n */\nfunction mark_reactions(signal, status, updated_during_traversal) {\n\tvar reactions = signal.reactions;\n\tif (reactions === null) return;\n\n\tvar runes = is_runes();\n\tvar length = reactions.length;\n\n\tfor (var i = 0; i < length; i++) {\n\t\tvar reaction = reactions[i];\n\t\tvar flags = reaction.f;\n\n\t\t// In legacy mode, skip the current effect to prevent infinite loops\n\t\tif (!runes && reaction === active_effect) continue;\n\n\t\tvar not_dirty = (flags & DIRTY) === 0;\n\n\t\t// don't set a DIRTY reaction to MAYBE_DIRTY\n\t\tif (not_dirty) {\n\t\t\tset_signal_status(reaction, status);\n\t\t}\n\n\t\tif ((flags & EAGER_EFFECT) !== 0) {\n\t\t\t// Eager effects need to run immediately:\n\t\t\t// - for $inspect so that the stack trace makes sense\n\t\t\t// - for $state.eager because they might be without an effect parent\n\t\t\teager_effects.add(/** @type {Effect} */ (reaction));\n\t\t} else if ((flags & DERIVED) !== 0) {\n\t\t\tvar derived = /** @type {Derived} */ (reaction);\n\n\t\t\tbatch_values?.delete(derived);\n\n\t\t\tif ((flags & WAS_MARKED) === 0) {\n\t\t\t\t// Only connected deriveds being executed outside the update cycle can be reliably unmarked right away\n\t\t\t\tif (\n\t\t\t\t\tflags & CONNECTED &&\n\t\t\t\t\t(active_effect === null || (active_effect.f & REACTION_IS_UPDATING) === 0)\n\t\t\t\t) {\n\t\t\t\t\treaction.f |= WAS_MARKED;\n\t\t\t\t}\n\n\t\t\t\tmark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);\n\t\t\t}\n\t\t} else if (not_dirty) {\n\t\t\tvar effect = /** @type {Effect} */ (reaction);\n\n\t\t\tif ((flags & BLOCK_EFFECT) !== 0 && eager_block_effects !== null) {\n\t\t\t\teager_block_effects.add(effect);\n\t\t\t}\n\n\t\t\tif (updated_during_traversal !== null) {\n\t\t\t\tupdated_during_traversal.push(effect);\n\t\t\t} else {\n\t\t\t\tschedule_effect(effect);\n\t\t\t}\n\t\t}\n\t}\n}\n","/** @import { Source } from '#client' */\nimport { DEV } from 'esm-env';\nimport {\n\tget,\n\tactive_effect,\n\tupdate_version,\n\tactive_reaction,\n\tset_update_version,\n\tset_active_reaction\n} from './runtime.js';\nimport {\n\tarray_prototype,\n\tget_descriptor,\n\tget_prototype_of,\n\tis_array,\n\tobject_prototype\n} from '../shared/utils.js';\nimport {\n\tstate as source,\n\tset,\n\tincrement,\n\tflush_eager_effects,\n\tset_eager_effects_deferred\n} from './reactivity/sources.js';\nimport { COMPONENT_SYMBOL, PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants';\nimport { UNINITIALIZED } from '../../constants.js';\nimport * as e from './errors.js';\nimport { tag } from './dev/tracing.js';\nimport { get_error } from '../shared/dev.js';\nimport { tracing_mode_flag } from '../flags/index.js';\n\n// TODO move all regexes into shared module?\nconst regex_is_valid_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;\n\n/**\n * @template T\n * @param {T} value\n * @returns {T}\n */\nexport function proxy(value) {\n\t// if non-proxyable, a component instance, or already a proxy, return `value`\n\tif (\n\t\ttypeof value !== 'object' ||\n\t\tvalue === null ||\n\t\tSTATE_SYMBOL in value ||\n\t\tCOMPONENT_SYMBOL in value\n\t) {\n\t\treturn value;\n\t}\n\n\tconst prototype = get_prototype_of(value);\n\n\tif (prototype !== object_prototype && prototype !== array_prototype) {\n\t\treturn value;\n\t}\n\n\t/** @type {Map<any, Source<any>>} */\n\tvar sources = new Map();\n\tvar is_proxied_array = is_array(value);\n\tvar version = source(0);\n\n\tvar stack = DEV && tracing_mode_flag ? get_error('created at') : null;\n\tvar parent_version = update_version;\n\n\t/**\n\t * Executes the proxy in the context of the reaction it was originally created in, if any\n\t * @template T\n\t * @param {() => T} fn\n\t */\n\tvar with_parent = (fn) => {\n\t\tif (update_version === parent_version) {\n\t\t\treturn fn();\n\t\t}\n\n\t\t// child source is being created after the initial proxy —\n\t\t// prevent it from being associated with the current reaction\n\t\tvar reaction = active_reaction;\n\t\tvar version = update_version;\n\n\t\tset_active_reaction(null);\n\t\tset_update_version(parent_version);\n\n\t\tvar result = fn();\n\n\t\tset_active_reaction(reaction);\n\t\tset_update_version(version);\n\n\t\treturn result;\n\t};\n\n\tif (is_proxied_array) {\n\t\t// We need to create the length source eagerly to ensure that\n\t\t// mutations to the array are properly synced with our proxy\n\t\tsources.set('length', source(/** @type {any[]} */ (value).length, stack));\n\t\tif (DEV) {\n\t\t\tvalue = /** @type {any} */ (inspectable_array(/** @type {any[]} */ (value)));\n\t\t}\n\t}\n\n\t/** Used in dev for $inspect.trace() */\n\tvar path = '';\n\tlet updating = false;\n\t/** @param {string} new_path */\n\tfunction update_path(new_path) {\n\t\tif (updating) return;\n\t\tupdating = true;\n\t\tpath = new_path;\n\n\t\ttag(version, `${path} version`);\n\n\t\t// rename all child sources and child proxies\n\t\tfor (const [prop, source] of sources) {\n\t\t\ttag(source, get_label(path, prop));\n\t\t}\n\t\tupdating = false;\n\t}\n\n\treturn new Proxy(/** @type {any} */ (value), {\n\t\tdefineProperty(_, prop, descriptor) {\n\t\t\tif (\n\t\t\t\t!('value' in descriptor) ||\n\t\t\t\tdescriptor.configurable === false ||\n\t\t\t\tdescriptor.enumerable === false ||\n\t\t\t\tdescriptor.writable === false\n\t\t\t) {\n\t\t\t\t// we disallow non-basic descriptors, because unless they are applied to the\n\t\t\t\t// target object — which we avoid, so that state can be forked — we will run\n\t\t\t\t// afoul of the various invariants\n\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/getOwnPropertyDescriptor#invariants\n\t\t\t\te.state_descriptors_fixed();\n\t\t\t}\n\t\t\tvar s = sources.get(prop);\n\t\t\tif (s === undefined) {\n\t\t\t\twith_parent(() => {\n\t\t\t\t\tvar s = source(descriptor.value, stack);\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t\tif (DEV && typeof prop === 'string') {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t\treturn s;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tset(s, descriptor.value, true);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\tdeleteProperty(target, prop) {\n\t\t\tvar s = sources.get(prop);\n\n\t\t\tif (s === undefined) {\n\t\t\t\tif (prop in target) {\n\t\t\t\t\tconst s = with_parent(() => source(UNINITIALIZED, stack));\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t\tincrement(version);\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tset(s, UNINITIALIZED);\n\t\t\t\tincrement(version);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\tget(target, prop, receiver) {\n\t\t\tif (prop === STATE_SYMBOL) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tif (DEV && prop === PROXY_PATH_SYMBOL) {\n\t\t\t\treturn update_path;\n\t\t\t}\n\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar exists = prop in target;\n\n\t\t\t// create a source, but only if it's an own property and not a prototype property\n\t\t\tif (s === undefined && (!exists || get_descriptor(target, prop)?.writable)) {\n\t\t\t\ts = with_parent(() => {\n\t\t\t\t\tvar p = proxy(exists ? target[prop] : UNINITIALIZED);\n\t\t\t\t\tvar s = source(p, stack);\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\n\t\t\t\t\treturn s;\n\t\t\t\t});\n\n\t\t\t\tsources.set(prop, s);\n\t\t\t}\n\n\t\t\tif (s !== undefined) {\n\t\t\t\tvar v = get(s);\n\t\t\t\treturn v === UNINITIALIZED ? undefined : v;\n\t\t\t}\n\n\t\t\treturn Reflect.get(target, prop, receiver);\n\t\t},\n\n\t\tgetOwnPropertyDescriptor(target, prop) {\n\t\t\tvar descriptor = Reflect.getOwnPropertyDescriptor(target, prop);\n\n\t\t\tif (descriptor && 'value' in descriptor) {\n\t\t\t\tvar s = sources.get(prop);\n\t\t\t\tif (s) descriptor.value = get(s);\n\t\t\t} else if (descriptor === undefined) {\n\t\t\t\tvar source = sources.get(prop);\n\t\t\t\tvar value = source?.v;\n\n\t\t\t\tif (source !== undefined && value !== UNINITIALIZED) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\twritable: true\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn descriptor;\n\t\t},\n\n\t\thas(target, prop) {\n\t\t\tif (prop === STATE_SYMBOL) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar has = (s !== undefined && s.v !== UNINITIALIZED) || Reflect.has(target, prop);\n\n\t\t\tif (\n\t\t\t\ts !== undefined ||\n\t\t\t\t(active_effect !== null && (!has || get_descriptor(target, prop)?.writable))\n\t\t\t) {\n\t\t\t\tif (s === undefined) {\n\t\t\t\t\ts = with_parent(() => {\n\t\t\t\t\t\tvar p = has ? proxy(target[prop]) : UNINITIALIZED;\n\t\t\t\t\t\tvar s = source(p, stack);\n\n\t\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn s;\n\t\t\t\t\t});\n\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t}\n\n\t\t\t\tvar value = get(s);\n\t\t\t\tif (value === UNINITIALIZED) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn has;\n\t\t},\n\n\t\tset(target, prop, value, receiver) {\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar has = prop in target;\n\n\t\t\t// variable.length = value -> clear all signals with index >= value\n\t\t\tif (is_proxied_array && prop === 'length') {\n\t\t\t\tfor (var i = value; i < /** @type {Source<number>} */ (s).v; i += 1) {\n\t\t\t\t\tvar other_s = sources.get(i + '');\n\t\t\t\t\tif (other_s !== undefined) {\n\t\t\t\t\t\tset(other_s, UNINITIALIZED);\n\t\t\t\t\t} else if (i in target) {\n\t\t\t\t\t\t// If the item exists in the original, we need to create an uninitialized source,\n\t\t\t\t\t\t// else a later read of the property would result in a source being created with\n\t\t\t\t\t\t// the value of the original item at that index.\n\t\t\t\t\t\tother_s = with_parent(() => source(UNINITIALIZED, stack));\n\t\t\t\t\t\tsources.set(i + '', other_s);\n\n\t\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\t\ttag(other_s, get_label(path, i));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we haven't yet created a source for this property, we need to ensure\n\t\t\t// we do so otherwise if we read it later, then the write won't be tracked and\n\t\t\t// the heuristics of effects will be different vs if we had read the proxied\n\t\t\t// object property before writing to that property.\n\t\t\tif (s === undefined) {\n\t\t\t\tif (!has || get_descriptor(target, prop)?.writable) {\n\t\t\t\t\ts = with_parent(() => source(undefined, stack));\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t\tset(s, proxy(value));\n\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thas = s.v !== UNINITIALIZED;\n\n\t\t\t\tvar p = with_parent(() => proxy(value));\n\t\t\t\tset(s, p);\n\t\t\t}\n\n\t\t\tvar descriptor = Reflect.getOwnPropertyDescriptor(target, prop);\n\n\t\t\t// Set the new value before updating any signals so that any listeners get the new value\n\t\t\tif (descriptor?.set) {\n\t\t\t\tdescriptor.set.call(receiver, value);\n\t\t\t}\n\n\t\t\tif (!has) {\n\t\t\t\t// If we have mutated an array directly, we might need to\n\t\t\t\t// signal that length has also changed. Do it before updating metadata\n\t\t\t\t// to ensure that iterating over the array as a result of a metadata update\n\t\t\t\t// will not cause the length to be out of sync.\n\t\t\t\tif (is_proxied_array && typeof prop === 'string') {\n\t\t\t\t\tvar ls = /** @type {Source<number>} */ (sources.get('length'));\n\t\t\t\t\tvar n = Number(prop);\n\n\t\t\t\t\tif (Number.isInteger(n) && n >= ls.v) {\n\t\t\t\t\t\tset(ls, n + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tincrement(version);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\townKeys(target) {\n\t\t\tget(version);\n\n\t\t\tvar own_keys = Reflect.ownKeys(target).filter((key) => {\n\t\t\t\tvar source = sources.get(key);\n\t\t\t\treturn source === undefined || source.v !== UNINITIALIZED;\n\t\t\t});\n\n\t\t\tfor (var [key, source] of sources) {\n\t\t\t\tif (source.v !== UNINITIALIZED && !(key in target)) {\n\t\t\t\t\town_keys.push(key);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn own_keys;\n\t\t},\n\n\t\tsetPrototypeOf() {\n\t\t\te.state_prototype_fixed();\n\t\t}\n\t});\n}\n\n/**\n * @param {string} path\n * @param {string | symbol} prop\n */\nfunction get_label(path, prop) {\n\tif (typeof prop === 'symbol') return `${path}[Symbol(${prop.description ?? ''})]`;\n\tif (regex_is_valid_identifier.test(prop)) return `${path}.${prop}`;\n\treturn /^\\d+$/.test(prop) ? `${path}[${prop}]` : `${path}['${prop}']`;\n}\n\n/**\n * @param {any} value\n */\nexport function get_proxied_value(value) {\n\ttry {\n\t\tif (value !== null && typeof value === 'object' && STATE_SYMBOL in value) {\n\t\t\treturn value[STATE_SYMBOL];\n\t\t}\n\t} catch {\n\t\t// the above if check can throw an error if the value in question\n\t\t// is the contentWindow of an iframe on another domain, in which\n\t\t// case we want to just return the value (because it's definitely\n\t\t// not a proxied value) so we don't break any JavaScript interacting\n\t\t// with that iframe (such as various payment companies client side\n\t\t// JavaScript libraries interacting with their iframes on the same\n\t\t// domain)\n\t}\n\n\treturn value;\n}\n\n/**\n * @param {any} a\n * @param {any} b\n */\nexport function is(a, b) {\n\treturn Object.is(get_proxied_value(a), get_proxied_value(b));\n}\n\nconst ARRAY_MUTATING_METHODS = new Set([\n\t'copyWithin',\n\t'fill',\n\t'pop',\n\t'push',\n\t'reverse',\n\t'shift',\n\t'sort',\n\t'splice',\n\t'unshift'\n]);\n\n/**\n * Wrap array mutating methods so $inspect is triggered only once and\n * to prevent logging an array in intermediate state (e.g. with an empty slot)\n * @param {any[]} array\n */\nfunction inspectable_array(array) {\n\treturn new Proxy(array, {\n\t\tget(target, prop, receiver) {\n\t\t\tvar value = Reflect.get(target, prop, receiver);\n\t\t\tif (!ARRAY_MUTATING_METHODS.has(/** @type {string} */ (prop))) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @this {any[]}\n\t\t\t * @param {any[]} args\n\t\t\t */\n\t\t\treturn function (...args) {\n\t\t\t\tset_eager_effects_deferred();\n\t\t\t\tvar result = value.apply(this, args);\n\t\t\t\tflush_eager_effects();\n\t\t\t\treturn result;\n\t\t\t};\n\t\t}\n\t});\n}\n","/** @import { Effect, TemplateNode } from '#client' */\nimport { hydrate_node, hydrating, reset, set_hydrate_node } from './hydration.js';\nimport { DEV } from 'esm-env';\nimport { init_array_prototype_warnings } from '../dev/equality.js';\nimport { get_descriptor, is_extensible } from '../../shared/utils.js';\nimport { active_effect } from '../runtime.js';\nimport { async_mode_flag } from '../../flags/index.js';\nimport {\n\tATTRIBUTES_CACHE,\n\tCLASS_CACHE,\n\tREACTION_RAN,\n\tSTYLE_CACHE,\n\tTEXT_CACHE,\n\tTEXT_NODE\n} from '#client/constants';\nimport { eager_block_effects } from '../reactivity/batch.js';\nimport { NAMESPACE_HTML } from '../../../constants.js';\n\n// export these for reference in the compiled code, making global name deduplication unnecessary\n/** @type {Window} */\nexport var $window;\n\n/** @type {Document} */\nexport var $document;\n\n/** @type {boolean} */\nexport var is_firefox;\n\n/** @type {() => Node | null} */\nvar first_child_getter;\n/** @type {() => Node | null} */\nvar next_sibling_getter;\n\n/**\n * Initialize these lazily to avoid issues when using the runtime in a server context\n * where these globals are not available while avoiding a separate server entry point\n */\nexport function init_operations() {\n\tif ($window !== undefined) {\n\t\treturn;\n\t}\n\n\t$window = window;\n\t$document = document;\n\tis_firefox = /Firefox/.test(navigator.userAgent);\n\n\tvar element_prototype = Element.prototype;\n\tvar node_prototype = Node.prototype;\n\tvar text_prototype = Text.prototype;\n\n\t// @ts-ignore\n\tfirst_child_getter = get_descriptor(node_prototype, 'firstChild').get;\n\t// @ts-ignore\n\tnext_sibling_getter = get_descriptor(node_prototype, 'nextSibling').get;\n\n\tif (is_extensible(element_prototype)) {\n\t\t// the following assignments improve perf of lookups on DOM nodes\n\t\t/** @type {any} */ (element_prototype)[CLASS_CACHE] = undefined;\n\t\t/** @type {any} */ (element_prototype)[ATTRIBUTES_CACHE] = null;\n\t\t/** @type {any} */ (element_prototype)[STYLE_CACHE] = undefined;\n\t\t// @ts-expect-error\n\t\telement_prototype.__e = undefined;\n\t}\n\n\tif (is_extensible(text_prototype)) {\n\t\t/** @type {any} */ (text_prototype)[TEXT_CACHE] = undefined;\n\t}\n\n\tif (DEV) {\n\t\t// @ts-expect-error\n\t\telement_prototype.__svelte_meta = null;\n\n\t\tinit_array_prototype_warnings();\n\t}\n}\n\n/**\n * @param {string} value\n * @returns {Text}\n */\nexport function create_text(value = '') {\n\treturn document.createTextNode(value);\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function get_first_child(node) {\n\treturn /** @type {TemplateNode | null} */ (first_child_getter.call(node));\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function get_next_sibling(node) {\n\treturn /** @type {TemplateNode | null} */ (next_sibling_getter.call(node));\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @template {Node} N\n * @param {N} node\n * @param {boolean} is_text\n * @returns {TemplateNode | null}\n */\nexport function child(node, is_text) {\n\tif (!hydrating) {\n\t\treturn get_first_child(node);\n\t}\n\n\tvar child = get_first_child(hydrate_node);\n\n\t// Child can be null if we have an element with a single child, like `<p>{text}</p>`, where `text` is empty\n\tif (child === null) {\n\t\tchild = hydrate_node.appendChild(create_text());\n\t} else if (is_text && child.nodeType !== TEXT_NODE) {\n\t\tvar text = create_text();\n\t\tchild?.before(text);\n\t\tset_hydrate_node(text);\n\t\treturn text;\n\t}\n\n\tif (is_text) {\n\t\tmerge_text_nodes(/** @type {Text} */ (child));\n\t}\n\n\tset_hydrate_node(child);\n\treturn child;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {TemplateNode} node\n * @param {boolean} [is_text]\n * @returns {TemplateNode | null}\n */\nexport function first_child(node, is_text = false) {\n\tif (!hydrating) {\n\t\tvar first = get_first_child(node);\n\n\t\t// TODO prevent user comments with the empty string when preserveComments is true\n\t\tif (first instanceof Comment && first.data === '') return get_next_sibling(first);\n\n\t\treturn first;\n\t}\n\n\tif (is_text) {\n\t\t// if an {expression} is empty during SSR, there might be no\n\t\t// text node to hydrate — we must therefore create one\n\t\tif (hydrate_node?.nodeType !== TEXT_NODE) {\n\t\t\tvar text = create_text();\n\n\t\t\thydrate_node?.before(text);\n\t\t\tset_hydrate_node(text);\n\t\t\treturn text;\n\t\t}\n\n\t\tmerge_text_nodes(/** @type {Text} */ (hydrate_node));\n\t}\n\n\treturn hydrate_node;\n}\n\n/**\n * `child`, for the very common case of an element with exactly one child. Resetting the\n * hydration cursor is part of the same step, so the compiler doesn't have to emit a\n * separate `reset` call for every `<p>{text}</p>` in an app.\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {TemplateNode} node\n * @param {boolean} [is_text]\n * @returns {TemplateNode | null}\n */\nexport function only_child(node, is_text = false) {\n\tif (!hydrating) {\n\t\treturn get_first_child(node);\n\t}\n\n\tvar first = child(node, is_text);\n\treset(node);\n\n\treturn first;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {TemplateNode} node\n * @param {number} count\n * @param {boolean} is_text\n * @returns {TemplateNode | null}\n */\nexport function sibling(node, count = 1, is_text = false) {\n\tlet next_sibling = hydrating ? hydrate_node : node;\n\tvar last_sibling;\n\n\twhile (count--) {\n\t\tlast_sibling = next_sibling;\n\t\tnext_sibling = /** @type {TemplateNode} */ (get_next_sibling(next_sibling));\n\t}\n\n\tif (!hydrating) {\n\t\treturn next_sibling;\n\t}\n\n\tif (is_text) {\n\t\t// if a sibling {expression} is empty during SSR, there might be no\n\t\t// text node to hydrate — we must therefore create one\n\t\tif (next_sibling?.nodeType !== TEXT_NODE) {\n\t\t\tvar text = create_text();\n\t\t\t// If the next sibling is `null` and we're handling text then it's because\n\t\t\t// the SSR content was empty for the text, so we need to generate a new text\n\t\t\t// node and insert it after the last sibling\n\t\t\tif (next_sibling === null) {\n\t\t\t\tlast_sibling?.after(text);\n\t\t\t} else {\n\t\t\t\tnext_sibling.before(text);\n\t\t\t}\n\t\t\tset_hydrate_node(text);\n\t\t\treturn text;\n\t\t}\n\n\t\tmerge_text_nodes(/** @type {Text} */ (next_sibling));\n\t}\n\n\tset_hydrate_node(next_sibling);\n\treturn next_sibling;\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n * @returns {void}\n */\nexport function clear_text_content(node) {\n\tnode.textContent = '';\n}\n\n/**\n * Returns `true` if we're updating the current block, for example `condition` in\n * an `{#if condition}` block just changed. In this case, the branch should be\n * appended (or removed) at the same time as other updates within the\n * current `<svelte:boundary>`\n */\nexport function should_defer_append() {\n\tif (!async_mode_flag) return false;\n\tif (eager_block_effects !== null) return false;\n\n\tvar flags = /** @type {Effect} */ (active_effect).f;\n\treturn (flags & REACTION_RAN) !== 0;\n}\n\n/**\n * Branching here is intentional and load-bearing for perf. `createElement(tag)`\n * hits a fast path in Blink that `createElementNS(NAMESPACE_HTML, tag)` doesn't,\n * and passing an explicit `undefined` as the trailing options arg measurably\n * slows both APIs. Funnelling every case through a single `createElementNS(ns,\n * tag, options)` call would be smaller but slower on the HTML path.\n *\n * @template {keyof HTMLElementTagNameMap | string} T\n * @param {T} tag\n * @param {string} [namespace]\n * @param {string} [is]\n * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element}\n */\nexport function create_element(tag, namespace, is) {\n\tif (namespace == null || namespace === NAMESPACE_HTML) {\n\t\treturn /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */ (\n\t\t\tis ? document.createElement(tag, { is }) : document.createElement(tag)\n\t\t);\n\t}\n\treturn /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */ (\n\t\tis ? document.createElementNS(namespace, tag, { is }) : document.createElementNS(namespace, tag)\n\t);\n}\n\nexport function create_fragment() {\n\treturn document.createDocumentFragment();\n}\n\n/**\n * @param {string} data\n * @returns\n */\nexport function create_comment(data = '') {\n\treturn document.createComment(data);\n}\n\n/**\n * @param {Element} element\n * @param {string} key\n * @param {string} value\n * @returns\n */\nexport function set_attribute(element, key, value = '') {\n\tif (key.startsWith('xlink:')) {\n\t\telement.setAttributeNS('http://www.w3.org/1999/xlink', key, value);\n\t\treturn;\n\t}\n\treturn element.setAttribute(key, value);\n}\n\n/**\n * Browsers split text nodes larger than 65536 bytes when parsing.\n * For hydration to succeed, we need to stitch them back together\n * @param {Text} text\n */\nexport function merge_text_nodes(text) {\n\tif (/** @type {string} */ (text.nodeValue).length < 65536) {\n\t\treturn;\n\t}\n\n\tlet next = text.nextSibling;\n\n\twhile (next !== null && next.nodeType === TEXT_NODE) {\n\t\tnext.remove();\n\n\t\t/** @type {string} */ (text.nodeValue) += /** @type {string} */ (next.nodeValue);\n\n\t\tnext = text.nextSibling;\n\t}\n}\n","/** @import { Derived, Effect } from '#client' */\n/** @import { Boundary } from './dom/blocks/boundary.js' */\nimport { DEV } from 'esm-env';\nimport { FILENAME } from '../../constants.js';\nimport { is_firefox } from './dom/operations.js';\nimport {\n\tERROR_VALUE,\n\tBOUNDARY_EFFECT,\n\tREACTION_RAN,\n\tEFFECT,\n\tDESTROYED,\n\tDESTROYING\n} from './constants.js';\nimport { define_property, get_descriptor } from '../shared/utils.js';\nimport { active_effect, active_reaction } from './runtime.js';\n\nconst adjustments = new WeakMap();\n\n/**\n * @param {unknown} error\n */\nexport function handle_error(error) {\n\tvar effect = active_effect;\n\n\t// for unowned deriveds, don't throw until we read the value\n\tif (effect === null) {\n\t\t/** @type {Derived} */ (active_reaction).f |= ERROR_VALUE;\n\t\treturn error;\n\t}\n\n\tif (DEV && error instanceof Error && !adjustments.has(error)) {\n\t\tadjustments.set(error, get_adjustments(error, effect));\n\t}\n\n\t// if the error occurred while creating this subtree, we let it\n\t// bubble up until it hits a boundary that can handle it, unless\n\t// it's an $effect in which case it doesn't run immediately\n\tif ((effect.f & REACTION_RAN) === 0 && (effect.f & EFFECT) === 0) {\n\t\tif (DEV && !effect.parent && error instanceof Error) {\n\t\t\tapply_adjustments(error);\n\t\t}\n\n\t\tthrow error;\n\t}\n\n\t// otherwise we bubble up the effect tree ourselves\n\tinvoke_error_boundary(error, effect);\n}\n\n/**\n * @param {unknown} error\n * @param {Effect | null} effect\n */\nexport function invoke_error_boundary(error, effect) {\n\tif (effect !== null && (effect.f & DESTROYED) !== 0) {\n\t\treturn;\n\t}\n\n\twhile (effect !== null) {\n\t\t// Skip boundaries that are destroyed/destroying and cannot meaningfully handle the error.\n\t\tif ((effect.f & BOUNDARY_EFFECT) !== 0 && (effect.f & (DESTROYED | DESTROYING)) === 0) {\n\t\t\tif ((effect.f & REACTION_RAN) === 0) {\n\t\t\t\t// we are still creating the boundary effect\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t/** @type {Boundary} */ (effect.b).error(error);\n\t\t\t\treturn;\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\t\t}\n\n\t\teffect = effect.parent;\n\t}\n\n\tif (DEV && error instanceof Error) {\n\t\tapply_adjustments(error);\n\t}\n\n\tthrow error;\n}\n\n/**\n * Add useful information to the error message/stack in development\n * @param {Error} error\n * @param {Effect} effect\n */\nfunction get_adjustments(error, effect) {\n\tconst message_descriptor = get_descriptor(error, 'message');\n\n\t// if the message was already changed and it's not configurable we can't change it\n\t// or it will throw a different error swallowing the original error\n\tif (message_descriptor && !message_descriptor.configurable) return;\n\n\tvar indent = is_firefox ? ' ' : '\\t';\n\tvar component_stack = `\\n${indent}in ${effect.fn?.name || '<unknown>'}`;\n\tvar context = effect.ctx;\n\n\twhile (context !== null) {\n\t\tcomponent_stack += `\\n${indent}in ${context.function?.[FILENAME].split('/').pop()}`;\n\t\tcontext = context.p;\n\t}\n\n\treturn {\n\t\tmessage: error.message + `\\n${component_stack}\\n`,\n\t\tstack: error.stack\n\t\t\t?.split('\\n')\n\t\t\t.filter((line) => !line.includes('svelte/src/internal'))\n\t\t\t.join('\\n')\n\t};\n}\n\n/**\n * @param {Error} error\n */\nfunction apply_adjustments(error) {\n\tconst adjusted = adjustments.get(error);\n\n\tif (adjusted) {\n\t\tdefine_property(error, 'message', {\n\t\t\tvalue: adjusted.message\n\t\t});\n\n\t\tdefine_property(error, 'stack', {\n\t\t\tvalue: adjusted.stack\n\t\t});\n\t}\n}\n","/** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */\nimport {\n\tis_dirty,\n\tactive_effect,\n\tactive_reaction,\n\tupdate_effect,\n\tget,\n\tis_destroying_effect,\n\tremove_reactions,\n\tset_active_reaction,\n\tset_is_destroying_effect,\n\tuntrack,\n\tuntracking,\n\tset_active_effect\n} from '../runtime.js';\nimport {\n\tDIRTY,\n\tBRANCH_EFFECT,\n\tRENDER_EFFECT,\n\tEFFECT,\n\tDESTROYED,\n\tINERT,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tEFFECT_TRANSPARENT,\n\tDERIVED,\n\tCLEAN,\n\tEAGER_EFFECT,\n\tHEAD_EFFECT,\n\tMAYBE_DIRTY,\n\tEFFECT_PRESERVED,\n\tSTALE_REACTION,\n\tUSER_EFFECT,\n\tASYNC,\n\tCONNECTED,\n\tMANAGED_EFFECT,\n\tDESTROYING,\n\tPAUSED\n} from '#client/constants';\nimport { invoke_error_boundary } from '../error-handling.js';\nimport * as e from '../errors.js';\nimport { DEV } from 'esm-env';\nimport { define_property } from '../../shared/utils.js';\nimport { get_next_sibling } from '../dom/operations.js';\nimport { component_context, dev_current_component_function, dev_stack } from '../context.js';\nimport { Batch, collected_effects, current_batch } from './batch.js';\nimport { flatten } from './async.js';\nimport { without_reactive_context } from '../dom/elements/bindings/shared.js';\nimport { set_signal_status } from './status.js';\n\n/**\n * @param {'$effect' | '$effect.pre' | '$inspect'} rune\n */\nexport function validate_effect(rune) {\n\tif (active_effect === null) {\n\t\tif (active_reaction === null) {\n\t\t\te.effect_orphan(rune);\n\t\t}\n\n\t\te.effect_in_unowned_derived();\n\t}\n\n\tif (is_destroying_effect) {\n\t\te.effect_in_teardown(rune);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {Effect} parent_effect\n */\nfunction push_effect(effect, parent_effect) {\n\tvar parent_last = parent_effect.last;\n\tif (parent_last === null) {\n\t\tparent_effect.last = parent_effect.first = effect;\n\t} else {\n\t\tparent_last.next = effect;\n\t\teffect.prev = parent_last;\n\t\tparent_effect.last = effect;\n\t}\n}\n\n/**\n * @param {number} type\n * @param {null | (() => void | (() => void))} fn\n * @returns {Effect}\n */\nfunction create_effect(type, fn) {\n\tvar parent = active_effect;\n\n\tif (DEV) {\n\t\t// Ensure the parent is never an inspect effect\n\t\twhile (parent !== null && (parent.f & EAGER_EFFECT) !== 0) {\n\t\t\tparent = parent.parent;\n\t\t}\n\t}\n\n\tif (parent !== null && (parent.f & INERT) !== 0) {\n\t\ttype |= INERT;\n\t}\n\n\t/** @type {Effect} */\n\tvar effect = {\n\t\tctx: component_context,\n\t\tdeps: null,\n\t\tnodes: null,\n\t\tf: type | DIRTY | CONNECTED,\n\t\tfirst: null,\n\t\tfn,\n\t\tlast: null,\n\t\tnext: null,\n\t\tparent,\n\t\tb: parent && parent.b,\n\t\tprev: null,\n\t\tteardown: null,\n\t\twv: 0,\n\t\tac: null\n\t};\n\n\tif (DEV) {\n\t\teffect.component_function = dev_current_component_function;\n\t}\n\n\tcurrent_batch?.register_created_effect(effect);\n\n\t/** @type {Effect | null} */\n\tvar e = effect;\n\n\tif ((type & EFFECT) !== 0) {\n\t\tif (collected_effects !== null) {\n\t\t\t// created during traversal — collect and run afterwards\n\t\t\tcollected_effects.push(effect);\n\t\t} else {\n\t\t\t// schedule for later\n\t\t\tBatch.ensure().schedule(effect);\n\t\t}\n\t} else if (fn !== null) {\n\t\ttry {\n\t\t\tupdate_effect(effect);\n\t\t} catch (e) {\n\t\t\tdestroy_effect(effect);\n\t\t\tthrow e;\n\t\t}\n\n\t\t// if an effect doesn't need to be kept in the tree (because it\n\t\t// won't re-run, has no DOM, and has no teardown etc)\n\t\t// then we skip it and go to its child (if any)\n\t\tif (\n\t\t\te.deps === null &&\n\t\t\te.teardown === null &&\n\t\t\te.nodes === null &&\n\t\t\te.first === e.last && // either `null`, or a singular child\n\t\t\t(e.f & EFFECT_PRESERVED) === 0\n\t\t) {\n\t\t\te = e.first;\n\t\t\tif ((type & BLOCK_EFFECT) !== 0 && (type & EFFECT_TRANSPARENT) !== 0 && e !== null) {\n\t\t\t\te.f |= EFFECT_TRANSPARENT;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (e !== null) {\n\t\te.parent = parent;\n\n\t\tif (parent !== null) {\n\t\t\tpush_effect(e, parent);\n\t\t}\n\n\t\t// if we're in a derived, add the effect there too\n\t\tif (\n\t\t\tactive_reaction !== null &&\n\t\t\t(active_reaction.f & DERIVED) !== 0 &&\n\t\t\t(type & ROOT_EFFECT) === 0\n\t\t) {\n\t\t\tvar derived = /** @type {Derived} */ (active_reaction);\n\t\t\t(derived.effects ??= []).push(e);\n\t\t}\n\t}\n\n\treturn effect;\n}\n\n/**\n * Internal representation of `$effect.tracking()`\n * @returns {boolean}\n */\nexport function effect_tracking() {\n\treturn active_reaction !== null && !untracking;\n}\n\n/**\n * @param {() => void} fn\n */\nexport function teardown(fn) {\n\tconst effect = create_effect(RENDER_EFFECT, null);\n\tset_signal_status(effect, CLEAN);\n\teffect.teardown = fn;\n\treturn effect;\n}\n\n/**\n * Internal representation of `$effect(...)`\n * @param {() => void | (() => void)} fn\n */\nexport function user_effect(fn) {\n\tvalidate_effect('$effect');\n\n\tif (DEV) {\n\t\tdefine_property(fn, 'name', {\n\t\t\tvalue: '$effect'\n\t\t});\n\t}\n\n\t// Non-nested `$effect(...)` in a component should be deferred\n\t// until the component is mounted\n\tvar flags = /** @type {Effect} */ (active_effect).f;\n\tvar defer =\n\t\t!active_reaction &&\n\t\t(flags & BRANCH_EFFECT) !== 0 &&\n\t\tcomponent_context !== null &&\n\t\t!component_context.i;\n\n\tif (defer) {\n\t\t// Top-level `$effect(...)` in an unmounted component — defer until mount\n\t\tvar context = /** @type {ComponentContext} */ (component_context);\n\t\t(context.e ??= []).push(fn);\n\t} else {\n\t\t// Everything else — create immediately\n\t\treturn create_user_effect(fn);\n\t}\n}\n\n/**\n * @param {() => void | (() => void)} fn\n */\nexport function create_user_effect(fn) {\n\treturn create_effect(EFFECT | USER_EFFECT, fn);\n}\n\n/**\n * Internal representation of `$effect.pre(...)`\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function user_pre_effect(fn) {\n\tvalidate_effect('$effect.pre');\n\tif (DEV) {\n\t\tdefine_property(fn, 'name', {\n\t\t\tvalue: '$effect.pre'\n\t\t});\n\t}\n\treturn create_effect(RENDER_EFFECT | USER_EFFECT, fn);\n}\n\n/** @param {() => void | (() => void)} fn */\nexport function eager_effect(fn) {\n\treturn create_effect(EAGER_EFFECT, fn);\n}\n\n/**\n * Internal representation of `$effect.root(...)`\n * @param {() => void | (() => void)} fn\n * @returns {() => void}\n */\nexport function effect_root(fn) {\n\tBatch.ensure();\n\tconst effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn);\n\n\treturn () => {\n\t\tdestroy_effect(effect);\n\t};\n}\n\n/**\n * An effect root whose children can transition out\n * @param {() => void} fn\n * @returns {(options?: { outro?: boolean }) => Promise<void>}\n */\nexport function component_root(fn) {\n\tBatch.ensure();\n\tconst effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn);\n\n\treturn (options = {}) => {\n\t\treturn new Promise((fulfil) => {\n\t\t\tif (options.outro) {\n\t\t\t\tpause_effect(effect, () => {\n\t\t\t\t\tdestroy_effect(effect);\n\t\t\t\t\tfulfil(undefined);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tdestroy_effect(effect);\n\t\t\t\tfulfil(undefined);\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function effect(fn) {\n\treturn create_effect(EFFECT, fn);\n}\n\n/**\n * Internal representation of `$: ..`\n * @param {() => any} deps\n * @param {() => void | (() => void)} fn\n */\nexport function legacy_pre_effect(deps, fn) {\n\tvar context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\t/** @type {{ effect: null | Effect, ran: boolean, deps: () => any }} */\n\tvar token = { effect: null, ran: false, deps };\n\n\tcontext.l.$.push(token);\n\n\ttoken.effect = render_effect(() => {\n\t\tdeps();\n\n\t\t// If this legacy pre effect has already run before the end of the reset, then\n\t\t// bail out to emulate the same behavior.\n\t\tif (token.ran) return;\n\n\t\ttoken.ran = true;\n\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t// here, we lie: by setting `active_effect` to be the parent branch, any writes\n\t\t// that happen inside `fn` will _not_ cause an unnecessary reschedule, because\n\t\t// the affected effects will be children of `active_effect`. this is safe\n\t\t// because these effects are known to run in the correct order\n\t\ttry {\n\t\t\tset_active_effect(effect.parent);\n\t\t\tuntrack(fn);\n\t\t} finally {\n\t\t\tset_active_effect(effect);\n\t\t}\n\t});\n}\n\nexport function legacy_pre_effect_reset() {\n\tvar context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\trender_effect(() => {\n\t\t// Run dirty `$:` statements\n\t\tfor (var token of context.l.$) {\n\t\t\ttoken.deps();\n\n\t\t\tvar effect = token.effect;\n\n\t\t\t// If the effect is CLEAN, then make it MAYBE_DIRTY. This ensures we traverse through\n\t\t\t// the effects dependencies and correctly ensure each dependency is up-to-date.\n\t\t\tif ((effect.f & CLEAN) !== 0 && effect.deps !== null) {\n\t\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t\t}\n\n\t\t\tif (is_dirty(effect)) {\n\t\t\t\tupdate_effect(effect);\n\t\t\t}\n\n\t\t\ttoken.ran = false;\n\t\t}\n\t});\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function async_effect(fn) {\n\treturn create_effect(ASYNC | EFFECT_PRESERVED, fn);\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function render_effect(fn, flags = 0) {\n\treturn create_effect(RENDER_EFFECT | flags, fn);\n}\n\n/**\n * @param {(...expressions: any) => void | (() => void)} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n */\nexport function template_effect(fn, sync = [], async = [], blockers = []) {\n\tflatten(blockers, sync, async, (values) => {\n\t\tcreate_effect(RENDER_EFFECT, () => {\n\t\t\tfn(...values.map(get));\n\t\t});\n\t});\n}\n\n/**\n * Like `template_effect`, but with an effect which is deferred until the batch commits\n * @param {(...expressions: any) => void | (() => void)} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n */\nexport function deferred_template_effect(fn, sync = [], async = [], blockers = []) {\n\tflatten(blockers, sync, async, (values) => {\n\t\tcreate_effect(EFFECT, () => fn(...values.map(get)));\n\t});\n}\n\n/**\n * @param {(() => void)} fn\n * @param {number} flags\n */\nexport function block(fn, flags = 0) {\n\tvar effect = create_effect(BLOCK_EFFECT | flags, fn);\n\tif (DEV) {\n\t\teffect.dev_stack = dev_stack;\n\t}\n\treturn effect;\n}\n\n/**\n * @param {(() => void)} fn\n * @param {number} flags\n */\nexport function managed(fn, flags = 0) {\n\tvar effect = create_effect(MANAGED_EFFECT | flags, fn);\n\tif (DEV) {\n\t\teffect.dev_stack = dev_stack;\n\t}\n\treturn effect;\n}\n\n/**\n * @param {(() => void)} fn\n */\nexport function branch(fn) {\n\treturn create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn);\n}\n\n/**\n * @param {Effect} effect\n */\nexport function execute_effect_teardown(effect) {\n\tvar teardown = effect.teardown;\n\tif (teardown !== null) {\n\t\tconst previously_destroying_effect = is_destroying_effect;\n\t\tconst previous_reaction = active_reaction;\n\t\tset_is_destroying_effect(true);\n\t\tset_active_reaction(null);\n\t\ttry {\n\t\t\tteardown.call(null);\n\t\t} catch (error) {\n\t\t\t// Route teardown errors through the boundary system so that a live\n\t\t\t// ancestor <svelte:boundary> can handle them. Boundaries that are\n\t\t\t// themselves mid-teardown are skipped by invoke_error_boundary.\n\t\t\tinvoke_error_boundary(error, effect.parent);\n\t\t} finally {\n\t\t\tset_is_destroying_effect(previously_destroying_effect);\n\t\t\tset_active_reaction(previous_reaction);\n\t\t}\n\t}\n}\n\n/**\n * @param {Effect} signal\n * @param {boolean} remove_dom\n * @returns {void}\n */\nexport function destroy_effect_children(signal, remove_dom = false) {\n\tvar effect = signal.first;\n\tsignal.first = signal.last = null;\n\n\twhile (effect !== null) {\n\t\tconst controller = effect.ac;\n\n\t\tif (controller !== null) {\n\t\t\twithout_reactive_context(() => {\n\t\t\t\tcontroller.abort(STALE_REACTION);\n\t\t\t});\n\t\t}\n\n\t\tvar next = effect.next;\n\n\t\tif ((effect.f & ROOT_EFFECT) !== 0) {\n\t\t\t// this is now an independent root\n\t\t\teffect.parent = null;\n\t\t} else {\n\t\t\tdestroy_effect(effect, remove_dom);\n\t\t}\n\n\t\teffect = next;\n\t}\n}\n\n/**\n * @param {Effect} signal\n * @returns {void}\n */\nexport function destroy_block_effect_children(signal) {\n\tvar effect = signal.first;\n\n\twhile (effect !== null) {\n\t\tvar next = effect.next;\n\t\tif ((effect.f & BRANCH_EFFECT) === 0) {\n\t\t\tdestroy_effect(effect);\n\t\t}\n\t\teffect = next;\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {boolean} [remove_dom]\n * @returns {void}\n */\nexport function destroy_effect(effect, remove_dom = true) {\n\tvar removed = false;\n\n\tif (\n\t\t(remove_dom || (effect.f & HEAD_EFFECT) !== 0) &&\n\t\teffect.nodes !== null &&\n\t\teffect.nodes.end !== null\n\t) {\n\t\tremove_effect_dom(effect.nodes.start, /** @type {TemplateNode} */ (effect.nodes.end));\n\t\tremoved = true;\n\t}\n\n\teffect.f |= DESTROYING;\n\tdestroy_effect_children(effect, remove_dom && !removed);\n\tremove_reactions(effect, 0);\n\n\tvar transitions = effect.nodes && effect.nodes.t;\n\n\tif (transitions !== null) {\n\t\tfor (const transition of transitions) {\n\t\t\ttransition.stop();\n\t\t}\n\t}\n\n\texecute_effect_teardown(effect);\n\n\teffect.f ^= DESTROYING;\n\teffect.f |= DESTROYED;\n\n\tvar parent = effect.parent;\n\n\t// If the parent doesn't have any children, then skip this work altogether\n\tif (parent !== null && parent.first !== null) {\n\t\tunlink_effect(effect);\n\t}\n\n\tif (DEV) {\n\t\teffect.component_function = null;\n\t}\n\n\t// `first` and `child` are nulled out in destroy_effect_children\n\t// we don't null out `parent` so that error propagation can work correctly\n\teffect.next =\n\t\teffect.prev =\n\t\teffect.teardown =\n\t\teffect.ctx =\n\t\teffect.deps =\n\t\teffect.fn =\n\t\teffect.nodes =\n\t\teffect.ac =\n\t\teffect.b =\n\t\t\tnull;\n}\n\n/**\n *\n * @param {TemplateNode | null} node\n * @param {TemplateNode} end\n */\nexport function remove_effect_dom(node, end) {\n\twhile (node !== null) {\n\t\t/** @type {TemplateNode | null} */\n\t\tvar next = node === end ? null : get_next_sibling(node);\n\n\t\tnode.remove();\n\t\tnode = next;\n\t}\n}\n\n/**\n * Detach an effect from the effect tree, freeing up memory and\n * reducing the amount of work that happens on subsequent traversals\n * @param {Effect} effect\n */\nexport function unlink_effect(effect) {\n\tvar parent = effect.parent;\n\tvar prev = effect.prev;\n\tvar next = effect.next;\n\n\tif (prev !== null) prev.next = next;\n\tif (next !== null) next.prev = prev;\n\n\tif (parent !== null) {\n\t\tif (parent.first === effect) parent.first = next;\n\t\tif (parent.last === effect) parent.last = prev;\n\t}\n}\n\n/**\n * When a block effect is removed, we don't immediately destroy it or yank it\n * out of the DOM, because it might have transitions. Instead, we 'pause' it.\n * It stays around (in memory, and in the DOM) until outro transitions have\n * completed, and if the state change is reversed then we _resume_ it.\n * A paused effect does not update, and the DOM subtree becomes inert.\n * @param {Effect} effect\n * @param {() => void} [callback]\n * @param {boolean} [destroy]\n */\nexport function pause_effect(effect, callback, destroy = true) {\n\t/** @type {TransitionManager[]} */\n\tvar transitions = [];\n\n\teffect.f |= PAUSED;\n\tpause_children(effect, transitions, true);\n\n\tvar fn = () => {\n\t\tif (destroy) destroy_effect(effect);\n\t\tif (callback) callback();\n\t};\n\n\tvar remaining = transitions.length;\n\tif (remaining > 0) {\n\t\tvar check = () => --remaining || fn();\n\t\tfor (var transition of transitions) {\n\t\t\ttransition.out(check);\n\t\t}\n\t} else {\n\t\tfn();\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {TransitionManager[]} transitions\n * @param {boolean} local\n */\nfunction pause_children(effect, transitions, local) {\n\tif ((effect.f & INERT) !== 0) return;\n\teffect.f ^= INERT;\n\n\tvar t = effect.nodes && effect.nodes.t;\n\n\tif (t !== null) {\n\t\tfor (const transition of t) {\n\t\t\tif (transition.is_global || local) {\n\t\t\t\ttransitions.push(transition);\n\t\t\t}\n\t\t}\n\t}\n\n\tvar child = effect.first;\n\n\twhile (child !== null) {\n\t\tvar sibling = child.next;\n\n\t\t// If this child is a root effect, then it will become an independent root when its parent\n\t\t// is destroyed, it should therefore not become inert nor partake in transitions.\n\t\tif ((child.f & ROOT_EFFECT) === 0) {\n\t\t\tvar transparent =\n\t\t\t\t(child.f & EFFECT_TRANSPARENT) !== 0 ||\n\t\t\t\t// If this is a branch effect without a block effect parent,\n\t\t\t\t// it means the parent block effect was pruned. In that case,\n\t\t\t\t// transparency information was transferred to the branch effect.\n\t\t\t\t((child.f & BRANCH_EFFECT) !== 0 && (effect.f & BLOCK_EFFECT) !== 0);\n\t\t\t// TODO we don't need to call pause_children recursively with a linked list in place\n\t\t\t// it's slightly more involved though as we have to account for `transparent` changing\n\t\t\t// through the tree.\n\t\t\tpause_children(child, transitions, transparent ? local : false);\n\t\t}\n\n\t\tchild = sibling;\n\t}\n}\n\n/**\n * The opposite of `pause_effect`. We call this if (for example)\n * `x` becomes falsy then truthy: `{#if x}...{/if}`\n * @param {Effect} effect\n */\nexport function resume_effect(effect) {\n\teffect.f &= ~PAUSED;\n\tresume_children(effect, true);\n}\n\n/**\n * @param {Effect} effect\n * @param {boolean} local\n */\nfunction resume_children(effect, local) {\n\t// this subtree was paused for its own reasons (e.g. a block whose condition\n\t// is still false) — its controller will resume or destroy it\n\tif ((effect.f & PAUSED) !== 0) return;\n\n\tif ((effect.f & INERT) === 0) return;\n\teffect.f ^= INERT;\n\n\t// If a dependency of this effect changed while it was paused,\n\t// schedule the effect to update. we don't use `is_dirty`\n\t// here because we don't want to eagerly recompute a derived like\n\t// `{#if foo}{foo.bar()}{/if}` if `foo` is now `undefined\n\tif ((effect.f & CLEAN) === 0) {\n\t\tset_signal_status(effect, DIRTY);\n\t\tBatch.ensure().schedule(effect); // Assumption: This happens during the commit phase of the batch, causing another flush, but it's safe\n\t}\n\n\tvar child = effect.first;\n\n\twhile (child !== null) {\n\t\tvar sibling = child.next;\n\t\tvar transparent = (child.f & EFFECT_TRANSPARENT) !== 0 || (child.f & BRANCH_EFFECT) !== 0;\n\t\t// TODO we don't need to call resume_children recursively with a linked list in place\n\t\t// it's slightly more involved though as we have to account for `transparent` changing\n\t\t// through the tree.\n\t\tresume_children(child, transparent ? local : false);\n\t\tchild = sibling;\n\t}\n\n\tvar t = effect.nodes && effect.nodes.t;\n\n\tif (t !== null) {\n\t\tfor (const transition of t) {\n\t\t\tif (transition.is_global || local) {\n\t\t\t\ttransition.in();\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function aborted(effect = /** @type {Effect} */ (active_effect)) {\n\treturn (effect.f & DESTROYED) !== 0;\n}\n\n/**\n * @param {Effect} effect\n * @param {DocumentFragment} fragment\n */\nexport function move_effect(effect, fragment) {\n\tif (!effect.nodes) return;\n\n\t/** @type {TemplateNode | null} */\n\tvar node = effect.nodes.start;\n\tvar end = effect.nodes.end;\n\n\twhile (node !== null) {\n\t\t/** @type {TemplateNode | null} */\n\t\tvar next = node === end ? null : get_next_sibling(node);\n\n\t\tfragment.append(node);\n\t\tnode = next;\n\t}\n}\n","/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */\nimport { DEV } from 'esm-env';\nimport { get_descriptors, get_prototype_of, includes, index_of } from '../shared/utils.js';\nimport {\n\tdestroy_block_effect_children,\n\tdestroy_effect_children,\n\teffect_tracking,\n\texecute_effect_teardown\n} from './reactivity/effects.js';\nimport {\n\tDIRTY,\n\tMAYBE_DIRTY,\n\tCLEAN,\n\tDERIVED,\n\tDESTROYED,\n\tBRANCH_EFFECT,\n\tSTATE_SYMBOL,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tCONNECTED,\n\tREACTION_IS_UPDATING,\n\tSTALE_REACTION,\n\tERROR_VALUE,\n\tWAS_MARKED,\n\tMANAGED_EFFECT,\n\tREACTION_RAN\n} from './constants.js';\nimport { old_values } from './reactivity/sources.js';\nimport {\n\treactivity_loss_tracker,\n\texecute_derived,\n\tfreeze_derived_effects,\n\trecent_async_deriveds,\n\tunfreeze_derived_effects,\n\tupdate_derived\n} from './reactivity/deriveds.js';\nimport { async_mode_flag, tracing_mode_flag } from '../flags/index.js';\nimport { tracing_expressions } from './dev/tracing.js';\nimport { get_error } from '../shared/dev.js';\nimport {\n\tcomponent_context,\n\tdev_current_component_function,\n\tdev_stack,\n\tis_runes,\n\tset_component_context,\n\tset_dev_current_component_function,\n\tset_dev_stack\n} from './context.js';\nimport {\n\tBatch,\n\tbatch_values,\n\tcurrent_batch,\n\tflushSync,\n\tprevious_batch,\n\tschedule_effect\n} from './reactivity/batch.js';\nimport { handle_error } from './error-handling.js';\nimport { UNINITIALIZED } from '../../constants.js';\nimport { captured_signals } from './legacy.js';\nimport { without_reactive_context } from './dom/elements/bindings/shared.js';\nimport { set_signal_status, update_derived_status } from './reactivity/status.js';\nimport * as w from './warnings.js';\n\n/**\n * True if updating in an effect context that is reactive (i.e. not branch/root effects)\n */\nlet is_updating_effect = false;\n\nexport let is_destroying_effect = false;\n\n/** @param {boolean} value */\nexport function set_is_destroying_effect(value) {\n\tis_destroying_effect = value;\n}\n\n/** @type {null | Reaction} */\nexport let active_reaction = null;\n\nexport let untracking = false;\n\n/** @param {null | Reaction} reaction */\nexport function set_active_reaction(reaction) {\n\tactive_reaction = reaction;\n}\n\n/** @type {null | Effect} */\nexport let active_effect = null;\n\n/** @param {null | Effect} effect */\nexport function set_active_effect(effect) {\n\tactive_effect = effect;\n}\n\n/**\n * When sources are created within a reaction, reading and writing\n * them within that reaction should not cause a re-run\n * @type {null | Set<Source>}\n */\nexport let current_sources = null;\n\n/** @param {Value} value */\nexport function push_reaction_value(value) {\n\tif (active_reaction !== null && (!async_mode_flag || (active_reaction.f & DERIVED) !== 0)) {\n\t\t(current_sources ??= new Set()).add(value);\n\t}\n}\n\n/**\n * The dependencies of the reaction that is currently being executed. In many cases,\n * the dependencies are unchanged between runs, and so this will be `null` unless\n * and until a new dependency is accessed — we track this via `skipped_deps`\n * @type {null | Value[]}\n */\nexport let new_deps = null;\n\nexport let skipped_deps = 0;\n\n/**\n * Tracks writes that the effect it's executed in doesn't listen to yet,\n * so that the dependency can be added to the effect later on if it then reads it\n * @type {null | Source[]}\n */\nexport let untracked_writes = null;\n\n/** @param {null | Source[]} value */\nexport function set_untracked_writes(value) {\n\tuntracked_writes = value;\n}\n\n/**\n * @type {number} Used by sources and deriveds for handling updates.\n * Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing\n **/\nexport let write_version = 1;\n\n/** @type {number} Used to version each read of a source of derived to avoid duplicating dependencies inside a reaction */\nlet read_version = 0;\n\nexport let update_version = read_version;\n\n/** @param {number} value */\nexport function set_update_version(value) {\n\tupdate_version = value;\n}\n\nexport function increment_write_version() {\n\treturn ++write_version;\n}\n\n/**\n * Determines whether a derived or effect is dirty.\n * If it is MAYBE_DIRTY, will set the status to CLEAN\n * @param {Reaction} reaction\n * @returns {boolean}\n */\nexport function is_dirty(reaction) {\n\tvar flags = reaction.f;\n\n\tif ((flags & DIRTY) !== 0) {\n\t\treturn true;\n\t}\n\n\tif (flags & DERIVED) {\n\t\treaction.f &= ~WAS_MARKED;\n\t}\n\n\tif ((flags & MAYBE_DIRTY) !== 0) {\n\t\tvar dependencies = /** @type {Value[]} */ (reaction.deps);\n\t\tvar length = dependencies.length;\n\n\t\tfor (var i = 0; i < length; i++) {\n\t\t\tvar dependency = dependencies[i];\n\n\t\t\tif (is_dirty(/** @type {Derived} */ (dependency))) {\n\t\t\t\tupdate_derived(/** @type {Derived} */ (dependency));\n\t\t\t}\n\n\t\t\tif (dependency.wv > reaction.wv) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t(flags & CONNECTED) !== 0 &&\n\t\t\t// During time traveling we don't want to reset the status so that\n\t\t\t// traversal of the graph in the other batches still happens\n\t\t\tbatch_values === null\n\t\t) {\n\t\t\tset_signal_status(reaction, CLEAN);\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * @param {Value} signal\n * @param {Effect} effect\n * @param {boolean} [root]\n */\nfunction schedule_possible_effect_self_invalidation(signal, effect, root = true) {\n\tvar reactions = signal.reactions;\n\tif (reactions === null) return;\n\n\tif (!async_mode_flag && current_sources !== null && current_sources.has(signal)) {\n\t\treturn;\n\t}\n\n\tfor (var i = 0; i < reactions.length; i++) {\n\t\tvar reaction = reactions[i];\n\n\t\tif ((reaction.f & DERIVED) !== 0) {\n\t\t\tschedule_possible_effect_self_invalidation(/** @type {Derived} */ (reaction), effect, false);\n\t\t} else if (effect === reaction) {\n\t\t\tif (root) {\n\t\t\t\tset_signal_status(reaction, DIRTY);\n\t\t\t} else if ((reaction.f & CLEAN) !== 0) {\n\t\t\t\tset_signal_status(reaction, MAYBE_DIRTY);\n\t\t\t}\n\t\t\tschedule_effect(/** @type {Effect} */ (reaction));\n\t\t}\n\t}\n}\n\n/** @param {Reaction} reaction */\nexport function update_reaction(reaction) {\n\tvar previous_deps = new_deps;\n\tvar previous_skipped_deps = skipped_deps;\n\tvar previous_untracked_writes = untracked_writes;\n\tvar previous_reaction = active_reaction;\n\tvar previous_sources = current_sources;\n\tvar previous_component_context = component_context;\n\tvar previous_untracking = untracking;\n\tvar previous_update_version = update_version;\n\n\tvar flags = reaction.f;\n\n\tnew_deps = /** @type {null | Value[]} */ (null);\n\tskipped_deps = 0;\n\tuntracked_writes = null;\n\tactive_reaction = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) === 0 ? reaction : null;\n\n\tcurrent_sources = null;\n\tset_component_context(reaction.ctx);\n\tuntracking = false;\n\tupdate_version = ++read_version;\n\n\tif (reaction.ac !== null) {\n\t\twithout_reactive_context(() => {\n\t\t\t/** @type {AbortController} */ (reaction.ac).abort(STALE_REACTION);\n\t\t});\n\n\t\treaction.ac = null;\n\t}\n\n\ttry {\n\t\treaction.f |= REACTION_IS_UPDATING;\n\t\tvar fn = /** @type {Function} */ (reaction.fn);\n\t\tvar result = fn();\n\t\treaction.f |= REACTION_RAN;\n\t\tvar deps = update_dependencies(reaction);\n\n\t\t// If we're inside an effect and we have untracked writes, then we need to\n\t\t// ensure that if any of those untracked writes result in re-invalidation\n\t\t// of the current effect, then that happens accordingly\n\t\tif (\n\t\t\tis_runes() &&\n\t\t\tuntracked_writes !== null &&\n\t\t\t!untracking &&\n\t\t\tdeps !== null &&\n\t\t\t(reaction.f & (DERIVED | MAYBE_DIRTY | DIRTY)) === 0\n\t\t) {\n\t\t\tfor (var i = 0; i < /** @type {Source[]} */ (untracked_writes).length; i++) {\n\t\t\t\tschedule_possible_effect_self_invalidation(\n\t\t\t\t\tuntracked_writes[i],\n\t\t\t\t\t/** @type {Effect} */ (reaction)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// If we are returning to an previous reaction then\n\t\t// we need to increment the read version to ensure that\n\t\t// any dependencies in this reaction aren't marked with\n\t\t// the same version\n\t\tif (previous_reaction !== null && previous_reaction !== reaction) {\n\t\t\tread_version++;\n\n\t\t\t// update the `rv` of the previous reaction's deps — both existing and new —\n\t\t\t// so that they are not added again\n\t\t\tif (previous_reaction.deps !== null) {\n\t\t\t\tfor (let i = 0; i < previous_skipped_deps; i += 1) {\n\t\t\t\t\tprevious_reaction.deps[i].rv = read_version;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (previous_deps !== null) {\n\t\t\t\tfor (const dep of previous_deps) {\n\t\t\t\t\tdep.rv = read_version;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (untracked_writes !== null) {\n\t\t\t\tif (previous_untracked_writes === null) {\n\t\t\t\t\tprevious_untracked_writes = untracked_writes;\n\t\t\t\t} else {\n\t\t\t\t\tprevious_untracked_writes.push(.../** @type {Source[]} */ (untracked_writes));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ((reaction.f & ERROR_VALUE) !== 0) {\n\t\t\treaction.f ^= ERROR_VALUE;\n\t\t}\n\n\t\treturn result;\n\t} catch (error) {\n\t\t// still commit the deps read before the throw, otherwise deriveds connected by this run keep no reader and the reaction never re-runs when they change\n\t\tupdate_dependencies(reaction);\n\n\t\treturn handle_error(error);\n\t} finally {\n\t\treaction.f ^= REACTION_IS_UPDATING;\n\t\tnew_deps = previous_deps;\n\t\tskipped_deps = previous_skipped_deps;\n\t\tuntracked_writes = previous_untracked_writes;\n\t\tactive_reaction = previous_reaction;\n\t\tcurrent_sources = previous_sources;\n\t\tset_component_context(previous_component_context);\n\t\tuntracking = previous_untracking;\n\t\tupdate_version = previous_update_version;\n\t}\n}\n\n/**\n * @param {Reaction} reaction\n */\nfunction update_dependencies(reaction) {\n\tvar deps = reaction.deps;\n\n\t// Don't remove reactions during fork;\n\t// they must remain for when fork is discarded\n\tvar is_fork = current_batch?.is_fork;\n\n\tif (new_deps !== null) {\n\t\tvar i;\n\n\t\tif (!is_fork) {\n\t\t\tremove_reactions(reaction, skipped_deps);\n\t\t}\n\n\t\tif (deps !== null && skipped_deps > 0) {\n\t\t\tdeps.length = skipped_deps + new_deps.length;\n\t\t\tfor (i = 0; i < new_deps.length; i++) {\n\t\t\t\tdeps[skipped_deps + i] = new_deps[i];\n\t\t\t}\n\t\t} else {\n\t\t\treaction.deps = deps = new_deps;\n\t\t}\n\n\t\tif (effect_tracking() && (reaction.f & CONNECTED) !== 0) {\n\t\t\tfor (i = skipped_deps; i < deps.length; i++) {\n\t\t\t\t(deps[i].reactions ??= []).push(reaction);\n\t\t\t}\n\t\t}\n\t} else if (!is_fork && deps !== null && skipped_deps < deps.length) {\n\t\tremove_reactions(reaction, skipped_deps);\n\t\tdeps.length = skipped_deps;\n\t}\n\n\treturn deps;\n}\n\n/**\n * @template V\n * @param {Reaction} signal\n * @param {Value<V>} dependency\n * @returns {void}\n */\nfunction remove_reaction(signal, dependency) {\n\tlet reactions = dependency.reactions;\n\tif (reactions !== null) {\n\t\tvar index = index_of.call(reactions, signal);\n\t\tif (index !== -1) {\n\t\t\tvar new_length = reactions.length - 1;\n\t\t\tif (new_length === 0) {\n\t\t\t\treactions = dependency.reactions = null;\n\t\t\t} else {\n\t\t\t\t// Swap with last element and then remove.\n\t\t\t\treactions[index] = reactions[new_length];\n\t\t\t\treactions.pop();\n\t\t\t}\n\t\t}\n\t}\n\n\t// If the derived has no reactions, then we can disconnect it from the graph,\n\t// allowing it to either reconnect in the future, or be GC'd by the VM.\n\tif (\n\t\treactions === null &&\n\t\t(dependency.f & DERIVED) !== 0 &&\n\t\t// Destroying a child effect while updating a parent effect can cause a dependency to appear\n\t\t// to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`\n\t\t// allows us to skip the expensive work of disconnecting and immediately reconnecting it\n\t\t(new_deps === null || !includes.call(new_deps, dependency))\n\t) {\n\t\tvar derived = /** @type {Derived} */ (dependency);\n\n\t\t// If we are working with a derived that is owned by an effect, then mark it as being\n\t\t// disconnected and remove the mark flag, as it cannot be reliably removed otherwise\n\t\tif ((derived.f & CONNECTED) !== 0) {\n\t\t\tderived.f ^= CONNECTED;\n\t\t\tderived.f &= ~WAS_MARKED;\n\t\t}\n\n\t\t// In a fork it's possible that a derived is executed and gets reactions, then commits, but is\n\t\t// never re-executed. This is possible when the derived is only executed once in the context\n\t\t// of a new branch which happens before fork.commit() runs. In this case, the derived still has\n\t\t// UNINITIALIZED as its value, and then when it's loosing its reactions we need to ensure it stays\n\t\t// DIRTY so it is reexecuted once someone wants its value again.\n\t\tif (derived.v !== UNINITIALIZED) {\n\t\t\tupdate_derived_status(derived);\n\t\t}\n\n\t\t// Call abort controller, noone's listening to this derived anymore\n\t\tif (derived.ac !== null) {\n\t\t\twithout_reactive_context(() => {\n\t\t\t\t/** @type {AbortController} */ (derived.ac).abort(STALE_REACTION);\n\t\t\t\tderived.ac = null;\n\t\t\t\t// ensure it reruns right away next time instead of potentially returning a rejected promise as its value\n\t\t\t\tset_signal_status(derived, DIRTY);\n\t\t\t});\n\t\t}\n\n\t\t// freeze any effects inside this derived\n\t\tfreeze_derived_effects(derived);\n\n\t\t// Disconnect any reactions owned by this reaction\n\t\tremove_reactions(derived, 0);\n\t}\n}\n\n/**\n * @param {Reaction} signal\n * @param {number} start_index\n * @returns {void}\n */\nexport function remove_reactions(signal, start_index) {\n\tvar dependencies = signal.deps;\n\tif (dependencies === null) return;\n\n\tfor (var i = start_index; i < dependencies.length; i++) {\n\t\tremove_reaction(signal, dependencies[i]);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @returns {void}\n */\nexport function update_effect(effect) {\n\tvar flags = effect.f;\n\n\tif ((flags & DESTROYED) !== 0) {\n\t\treturn;\n\t}\n\n\tset_signal_status(effect, CLEAN);\n\n\tvar previous_effect = active_effect;\n\tvar was_updating_effect = is_updating_effect;\n\n\tactive_effect = effect;\n\tis_updating_effect = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) === 0; // Branch/root effects are not reactive contexts\n\n\tif (DEV) {\n\t\tvar previous_component_fn = dev_current_component_function;\n\t\tset_dev_current_component_function(effect.component_function);\n\t\tvar previous_stack = /** @type {any} */ (dev_stack);\n\t\t// only block effects have a dev stack, keep the current one otherwise\n\t\tset_dev_stack(effect.dev_stack ?? dev_stack);\n\t}\n\n\ttry {\n\t\tif ((flags & (BLOCK_EFFECT | MANAGED_EFFECT)) !== 0) {\n\t\t\tdestroy_block_effect_children(effect);\n\t\t} else {\n\t\t\tdestroy_effect_children(effect);\n\t\t}\n\n\t\texecute_effect_teardown(effect);\n\t\tvar teardown = update_reaction(effect);\n\t\teffect.teardown = typeof teardown === 'function' ? teardown : null;\n\t\teffect.wv = write_version;\n\n\t\t// In DEV, increment versions of any sources that were written to during the effect,\n\t\t// so that they are correctly marked as dirty when the effect re-runs\n\t\tif (DEV && tracing_mode_flag && (effect.f & DIRTY) !== 0 && effect.deps !== null) {\n\t\t\tfor (var dep of effect.deps) {\n\t\t\t\tif (dep.set_during_effect) {\n\t\t\t\t\tdep.wv = increment_write_version();\n\t\t\t\t\tdep.set_during_effect = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} finally {\n\t\tis_updating_effect = was_updating_effect;\n\t\tactive_effect = previous_effect;\n\n\t\tif (DEV) {\n\t\t\tset_dev_current_component_function(previous_component_fn);\n\t\t\tset_dev_stack(previous_stack);\n\t\t}\n\t}\n}\n\n/**\n * Returns a promise that resolves once any pending state changes have been applied.\n * @returns {Promise<void>}\n */\nexport async function tick() {\n\tif (async_mode_flag) {\n\t\treturn new Promise((f) => {\n\t\t\t// Race them against each other - in almost all cases requestAnimationFrame will fire first,\n\t\t\t// but e.g. in case the window is not focused or a view transition happens, requestAnimationFrame\n\t\t\t// will be delayed and setTimeout helps us resolve fast enough in that case\n\t\t\trequestAnimationFrame(() => f());\n\t\t\tsetTimeout(() => f());\n\t\t});\n\t}\n\n\tawait Promise.resolve();\n\n\t// By calling flushSync we guarantee that any pending state changes are applied after one tick.\n\t// TODO look into whether we can make flushing subsequent updates synchronously in the future.\n\tflushSync();\n}\n\n/**\n * Returns a promise that resolves once any state changes, and asynchronous work resulting from them,\n * have resolved and the DOM has been updated\n * @returns {Promise<void>}\n * @since 5.36\n */\nexport function settled() {\n\treturn Batch.ensure().settled();\n}\n\n/**\n * @template V\n * @param {Value<V>} signal\n * @returns {V}\n */\nexport function get(signal) {\n\tvar flags = signal.f;\n\tvar is_derived = (flags & DERIVED) !== 0;\n\n\tcaptured_signals?.add(signal);\n\n\t// Register the dependency on the current reaction signal.\n\tif (active_reaction !== null && !untracking) {\n\t\t// if we're in a derived that is being read inside an _async_ derived,\n\t\t// it's possible that the effect was already destroyed. In this case,\n\t\t// we don't add the dependency, because that would create a memory leak\n\t\tvar destroyed = active_effect !== null && (active_effect.f & DESTROYED) !== 0;\n\n\t\tif (!destroyed && (current_sources === null || !current_sources.has(signal))) {\n\t\t\tvar deps = active_reaction.deps;\n\n\t\t\tif ((active_reaction.f & REACTION_IS_UPDATING) !== 0) {\n\t\t\t\t// we're in the effect init/update cycle\n\t\t\t\tif (signal.rv < read_version) {\n\t\t\t\t\tsignal.rv = read_version;\n\n\t\t\t\t\t// If the signal is accessing the same dependencies in the same\n\t\t\t\t\t// order as it did last time, increment `skipped_deps`\n\t\t\t\t\t// rather than updating `new_deps`, which creates GC cost\n\t\t\t\t\tif (new_deps === null && deps !== null && deps[skipped_deps] === signal) {\n\t\t\t\t\t\tskipped_deps++;\n\t\t\t\t\t} else if (new_deps === null) {\n\t\t\t\t\t\tnew_deps = [signal];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnew_deps.push(signal);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// We're adding a dependency outside the init/update cycle (i.e. after an `await`).\n\t\t\t\t// We have to deduplicate deps/reactions in this case or remove_reactions could\n\t\t\t\t// disconnect deps/reactions that are actually still in use (if skip_deps says\n\t\t\t\t// \"disconnect all after this index\" and some of the signals are also present in\n\t\t\t\t// list prior to the cutoff index, i.e. that should be kept).\n\t\t\t\tactive_reaction.deps ??= [];\n\t\t\t\tif (!includes.call(active_reaction.deps, signal)) {\n\t\t\t\t\tactive_reaction.deps.push(signal);\n\t\t\t\t}\n\n\t\t\t\tvar reactions = signal.reactions;\n\n\t\t\t\tif (reactions === null) {\n\t\t\t\t\tsignal.reactions = [active_reaction];\n\t\t\t\t} else if (!includes.call(reactions, active_reaction)) {\n\t\t\t\t\treactions.push(active_reaction);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (DEV) {\n\t\tif (\n\t\t\t!untracking &&\n\t\t\treactivity_loss_tracker &&\n\t\t\t// By checking that current/previous batch are null we filter out false positives.\n\t\t\t// reactivity_loss_tracker is only reset after a microtask, so if a flush happens\n\t\t\t// before that, we get warnings for things we shouldn't warn on.\n\t\t\tcurrent_batch === null &&\n\t\t\tprevious_batch === null &&\n\t\t\t!reactivity_loss_tracker.warned &&\n\t\t\t(reactivity_loss_tracker.effect.f & REACTION_IS_UPDATING) === 0 &&\n\t\t\t!reactivity_loss_tracker.effect_deps.has(signal)\n\t\t) {\n\t\t\treactivity_loss_tracker.warned = true;\n\n\t\t\tw.await_reactivity_loss(/** @type {string} */ (signal.label));\n\n\t\t\tvar trace = get_error('traced at');\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tif (trace) console.warn(trace);\n\t\t}\n\n\t\trecent_async_deriveds.delete(signal);\n\n\t\tif (\n\t\t\ttracing_mode_flag &&\n\t\t\t!untracking &&\n\t\t\ttracing_expressions !== null &&\n\t\t\tactive_reaction !== null &&\n\t\t\ttracing_expressions.reaction === active_reaction\n\t\t) {\n\t\t\t// Used when mapping state between special blocks like `each`\n\t\t\tif (signal.trace) {\n\t\t\t\tsignal.trace();\n\t\t\t} else {\n\t\t\t\ttrace = get_error('traced at');\n\n\t\t\t\tif (trace) {\n\t\t\t\t\tvar entry = tracing_expressions.entries.get(signal);\n\n\t\t\t\t\tif (entry === undefined) {\n\t\t\t\t\t\tentry = { traces: [] };\n\t\t\t\t\t\ttracing_expressions.entries.set(signal, entry);\n\t\t\t\t\t}\n\n\t\t\t\t\tvar last = entry.traces[entry.traces.length - 1];\n\n\t\t\t\t\t// traces can be duplicated, e.g. by `snapshot` invoking both\n\t\t\t\t\t// both `getOwnPropertyDescriptor` and `get` traps at once\n\t\t\t\t\tif (trace.stack !== last?.stack) {\n\t\t\t\t\t\tentry.traces.push(trace);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (is_destroying_effect && old_values.has(signal)) {\n\t\treturn old_values.get(signal);\n\t}\n\n\tif (is_derived) {\n\t\tvar derived = /** @type {Derived} */ (signal);\n\n\t\tif (is_destroying_effect) {\n\t\t\tvar value = derived.v;\n\n\t\t\t// if the derived is dirty and has reactions, or depends on the values that just changed, re-execute\n\t\t\t// (a derived can be maybe_dirty due to the effect destroy removing its last reaction)\n\t\t\tif (\n\t\t\t\t((derived.f & CLEAN) === 0 && derived.reactions !== null) ||\n\t\t\t\tdepends_on_old_values(derived)\n\t\t\t) {\n\t\t\t\tvalue = execute_derived(derived);\n\t\t\t}\n\n\t\t\told_values.set(derived, value);\n\n\t\t\treturn value;\n\t\t}\n\n\t\t// connect disconnected deriveds if we are reading them inside an effect,\n\t\t// or inside another derived that is already connected\n\t\tvar should_connect =\n\t\t\t(derived.f & CONNECTED) === 0 &&\n\t\t\t!untracking &&\n\t\t\tactive_reaction !== null &&\n\t\t\t(is_updating_effect || (active_reaction.f & CONNECTED) !== 0);\n\n\t\tvar is_new = (derived.f & REACTION_RAN) === 0;\n\n\t\tif (is_dirty(derived)) {\n\t\t\tif (should_connect) {\n\t\t\t\t// set the flag before `update_derived`, so that the derived\n\t\t\t\t// is added as a reaction to its dependencies\n\t\t\t\tderived.f |= CONNECTED;\n\t\t\t}\n\n\t\t\tupdate_derived(derived);\n\t\t}\n\n\t\tif (should_connect && !is_new) {\n\t\t\tunfreeze_derived_effects(derived);\n\t\t\treconnect(derived);\n\t\t}\n\t}\n\n\tif (batch_values?.has(signal)) {\n\t\treturn batch_values.get(signal);\n\t}\n\n\tif ((signal.f & ERROR_VALUE) !== 0) {\n\t\tthrow signal.v;\n\t}\n\n\treturn signal.v;\n}\n\n/**\n * (Re)connect a disconnected derived, so that it is notified\n * of changes in `mark_reactions`\n * @param {Derived} derived\n */\nfunction reconnect(derived) {\n\tderived.f |= CONNECTED;\n\n\tif (derived.deps === null) return;\n\n\tfor (const dep of derived.deps) {\n\t\t(dep.reactions ??= []).push(derived);\n\n\t\tif ((dep.f & DERIVED) !== 0 && (dep.f & CONNECTED) === 0) {\n\t\t\tunfreeze_derived_effects(/** @type {Derived} */ (dep));\n\t\t\treconnect(/** @type {Derived} */ (dep));\n\t\t}\n\t}\n}\n\n/** @param {Derived} derived */\nfunction depends_on_old_values(derived) {\n\tif (derived.v === UNINITIALIZED) return true; // we don't know, so assume the worst\n\tif (derived.deps === null) return false;\n\n\tfor (const dep of derived.deps) {\n\t\tif (old_values.has(dep)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ((dep.f & DERIVED) !== 0 && depends_on_old_values(/** @type {Derived} */ (dep))) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Like `get`, but checks for `undefined`. Used for `var` declarations because they can be accessed before being declared\n * @template V\n * @param {Value<V> | undefined} signal\n * @returns {V | undefined}\n */\nexport function safe_get(signal) {\n\treturn signal && get(signal);\n}\n\n/**\n * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),\n * any state read inside `fn` will not be treated as a dependency.\n *\n * ```ts\n * $effect(() => {\n * // this will run when `data` changes, but not when `time` changes\n * save(data, {\n * timestamp: untrack(() => time)\n * });\n * });\n * ```\n * @template T\n * @param {() => T} fn\n * @returns {T}\n */\nexport function untrack(fn) {\n\tvar previous_untracking = untracking;\n\ttry {\n\t\tuntracking = true;\n\t\treturn fn();\n\t} finally {\n\t\tuntracking = previous_untracking;\n\t}\n}\n\n/**\n * Possibly traverse an object and read all its properties so that they're all reactive in case this is `$state`.\n * Does only check first level of an object for performance reasons (heuristic should be good for 99% of all cases).\n * @param {any} value\n * @returns {void}\n */\nexport function deep_read_state(value) {\n\tif (typeof value !== 'object' || !value || value instanceof EventTarget) {\n\t\treturn;\n\t}\n\n\tif (STATE_SYMBOL in value) {\n\t\tdeep_read(value);\n\t} else if (!Array.isArray(value)) {\n\t\tfor (let key in value) {\n\t\t\tconst prop = value[key];\n\t\t\tif (typeof prop === 'object' && prop && STATE_SYMBOL in prop) {\n\t\t\t\tdeep_read(prop);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Deeply traverse an object and read all its properties\n * so that they're all reactive in case this is `$state`\n * @param {any} value\n * @param {Set<any>} visited\n * @returns {void}\n */\nexport function deep_read(value, visited = new Set()) {\n\tif (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t// We don't want to traverse DOM elements\n\t\t!(value instanceof EventTarget) &&\n\t\t!visited.has(value)\n\t) {\n\t\tvisited.add(value);\n\t\t// When working with a possible SvelteDate, this\n\t\t// will ensure we capture changes to it.\n\t\tif (value instanceof Date) {\n\t\t\tvalue.getTime();\n\t\t}\n\t\tfor (let key in value) {\n\t\t\ttry {\n\t\t\t\tdeep_read(value[key], visited);\n\t\t\t} catch (e) {\n\t\t\t\t// continue\n\t\t\t}\n\t\t}\n\t\tconst proto = get_prototype_of(value);\n\t\tif (\n\t\t\tproto !== Object.prototype &&\n\t\t\tproto !== Array.prototype &&\n\t\t\tproto !== Map.prototype &&\n\t\t\tproto !== Set.prototype &&\n\t\t\tproto !== Date.prototype\n\t\t) {\n\t\t\tconst descriptors = get_descriptors(proto);\n\t\t\tfor (let key in descriptors) {\n\t\t\t\tconst get = descriptors[key].get;\n\t\t\t\tif (get) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tget.call(value);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t// continue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","const regex_return_characters = /\\r/g;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nexport function hash(str) {\n\tstr = str.replace(regex_return_characters, '');\n\tlet hash = 5381;\n\tlet i = str.length;\n\n\twhile (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i);\n\treturn (hash >>> 0).toString(36);\n}\n\nconst VOID_ELEMENT_NAMES = [\n\t'area',\n\t'base',\n\t'br',\n\t'col',\n\t'command',\n\t'embed',\n\t'hr',\n\t'img',\n\t'input',\n\t'keygen',\n\t'link',\n\t'meta',\n\t'param',\n\t'source',\n\t'track',\n\t'wbr'\n];\n\n/**\n * Returns `true` if `name` is of a void element\n * @param {string} name\n */\nexport function is_void(name) {\n\treturn VOID_ELEMENT_NAMES.includes(name) || name.toLowerCase() === '!doctype';\n}\n\nconst RESERVED_WORDS = [\n\t'arguments',\n\t'await',\n\t'break',\n\t'case',\n\t'catch',\n\t'class',\n\t'const',\n\t'continue',\n\t'debugger',\n\t'default',\n\t'delete',\n\t'do',\n\t'else',\n\t'enum',\n\t'eval',\n\t'export',\n\t'extends',\n\t'false',\n\t'finally',\n\t'for',\n\t'function',\n\t'if',\n\t'implements',\n\t'import',\n\t'in',\n\t'instanceof',\n\t'interface',\n\t'let',\n\t'new',\n\t'null',\n\t'package',\n\t'private',\n\t'protected',\n\t'public',\n\t'return',\n\t'static',\n\t'super',\n\t'switch',\n\t'this',\n\t'throw',\n\t'true',\n\t'try',\n\t'typeof',\n\t'var',\n\t'void',\n\t'while',\n\t'with',\n\t'yield'\n];\n\n/**\n * Returns `true` if `word` is a reserved JavaScript keyword\n * @param {string} word\n */\nexport function is_reserved(word) {\n\treturn RESERVED_WORDS.includes(word);\n}\n\n/**\n * @param {string} name\n */\nexport function is_capture_event(name) {\n\treturn name.endsWith('capture') && name !== 'gotpointercapture' && name !== 'lostpointercapture';\n}\n\n/** List of Element events that will be delegated */\nconst DELEGATED_EVENTS = [\n\t'beforeinput',\n\t'click',\n\t'change',\n\t'dblclick',\n\t'contextmenu',\n\t'focusin',\n\t'focusout',\n\t'input',\n\t'keydown',\n\t'keyup',\n\t'mousedown',\n\t'mousemove',\n\t'mouseout',\n\t'mouseover',\n\t'mouseup',\n\t'pointerdown',\n\t'pointermove',\n\t'pointerout',\n\t'pointerover',\n\t'pointerup',\n\t'touchend',\n\t'touchmove',\n\t'touchstart'\n];\n\n/**\n * Returns `true` if `event_name` is a delegated event\n * @param {string} event_name\n */\nexport function can_delegate_event(event_name) {\n\treturn DELEGATED_EVENTS.includes(event_name);\n}\n\n/**\n * Attributes that are boolean, i.e. they are present or not present.\n */\nconst DOM_BOOLEAN_ATTRIBUTES = [\n\t'allowfullscreen',\n\t'async',\n\t'autofocus',\n\t'autoplay',\n\t'checked',\n\t'controls',\n\t'default',\n\t'disabled',\n\t'formnovalidate',\n\t'indeterminate',\n\t'inert',\n\t'ismap',\n\t'loop',\n\t'multiple',\n\t'muted',\n\t'nomodule',\n\t'novalidate',\n\t'open',\n\t'playsinline',\n\t'readonly',\n\t'required',\n\t'reversed',\n\t'seamless',\n\t'selected',\n\t'webkitdirectory',\n\t'defer',\n\t'disablepictureinpicture',\n\t'disableremoteplayback'\n];\n\n/**\n * Returns `true` if `name` is a boolean attribute\n * @param {string} name\n */\nexport function is_boolean_attribute(name) {\n\treturn DOM_BOOLEAN_ATTRIBUTES.includes(name);\n}\n\n/**\n * @type {Record<string, string>}\n * List of attribute names that should be aliased to their property names\n * because they behave differently between setting them as an attribute and\n * setting them as a property.\n */\nconst ATTRIBUTE_ALIASES = {\n\t// no `class: 'className'` because we handle that separately\n\tformnovalidate: 'formNoValidate',\n\tismap: 'isMap',\n\tnomodule: 'noModule',\n\tplaysinline: 'playsInline',\n\treadonly: 'readOnly',\n\tdefaultvalue: 'defaultValue',\n\tdefaultchecked: 'defaultChecked',\n\tsrcobject: 'srcObject',\n\tnovalidate: 'noValidate',\n\tallowfullscreen: 'allowFullscreen',\n\tdisablepictureinpicture: 'disablePictureInPicture',\n\tdisableremoteplayback: 'disableRemotePlayback'\n};\n\n/**\n * @param {string} name\n */\nexport function normalize_attribute(name) {\n\tname = name.toLowerCase();\n\treturn ATTRIBUTE_ALIASES[name] ?? name;\n}\n\nconst DOM_PROPERTIES = [\n\t...DOM_BOOLEAN_ATTRIBUTES,\n\t'formNoValidate',\n\t'isMap',\n\t'noModule',\n\t'playsInline',\n\t'readOnly',\n\t'value',\n\t'volume',\n\t'defaultValue',\n\t'defaultChecked',\n\t'srcObject',\n\t'noValidate',\n\t'allowFullscreen',\n\t'disablePictureInPicture',\n\t'disableRemotePlayback'\n];\n\n/**\n * @param {string} name\n */\nexport function is_dom_property(name) {\n\treturn DOM_PROPERTIES.includes(name);\n}\n\nconst NON_STATIC_PROPERTIES = ['autofocus', 'muted', 'defaultValue', 'defaultChecked'];\n\n/**\n * Returns `true` if the given attribute cannot be set through the template\n * string, i.e. needs some kind of JavaScript handling to work.\n * @param {string} name\n */\nexport function cannot_be_set_statically(name) {\n\treturn NON_STATIC_PROPERTIES.includes(name);\n}\n\n/**\n * Subset of delegated events which should be passive by default.\n * These two are already passive via browser defaults on window, document and body.\n * But since\n * - we're delegating them\n * - they happen often\n * - they apply to mobile which is generally less performant\n * we're marking them as passive by default for other elements, too.\n */\nconst PASSIVE_EVENTS = ['touchstart', 'touchmove'];\n\n/**\n * Returns `true` if `name` is a passive event\n * @param {string} name\n */\nexport function is_passive_event(name) {\n\treturn PASSIVE_EVENTS.includes(name);\n}\n\nconst CONTENT_EDITABLE_BINDINGS = ['textContent', 'innerHTML', 'innerText'];\n\n/** @param {string} name */\nexport function is_content_editable_binding(name) {\n\treturn CONTENT_EDITABLE_BINDINGS.includes(name);\n}\n\nconst LOAD_ERROR_ELEMENTS = [\n\t'body',\n\t'embed',\n\t'iframe',\n\t'img',\n\t'link',\n\t'object',\n\t'script',\n\t'style',\n\t'track'\n];\n\n/**\n * Returns `true` if the element emits `load` and `error` events\n * @param {string} name\n */\nexport function is_load_error_element(name) {\n\treturn LOAD_ERROR_ELEMENTS.includes(name);\n}\n\nconst SVG_ELEMENTS = [\n\t'altGlyph',\n\t'altGlyphDef',\n\t'altGlyphItem',\n\t'animate',\n\t'animateColor',\n\t'animateMotion',\n\t'animateTransform',\n\t'circle',\n\t'clipPath',\n\t'color-profile',\n\t'cursor',\n\t'defs',\n\t'desc',\n\t'discard',\n\t'ellipse',\n\t'feBlend',\n\t'feColorMatrix',\n\t'feComponentTransfer',\n\t'feComposite',\n\t'feConvolveMatrix',\n\t'feDiffuseLighting',\n\t'feDisplacementMap',\n\t'feDistantLight',\n\t'feDropShadow',\n\t'feFlood',\n\t'feFuncA',\n\t'feFuncB',\n\t'feFuncG',\n\t'feFuncR',\n\t'feGaussianBlur',\n\t'feImage',\n\t'feMerge',\n\t'feMergeNode',\n\t'feMorphology',\n\t'feOffset',\n\t'fePointLight',\n\t'feSpecularLighting',\n\t'feSpotLight',\n\t'feTile',\n\t'feTurbulence',\n\t'filter',\n\t'font',\n\t'font-face',\n\t'font-face-format',\n\t'font-face-name',\n\t'font-face-src',\n\t'font-face-uri',\n\t'foreignObject',\n\t'g',\n\t'glyph',\n\t'glyphRef',\n\t'hatch',\n\t'hatchpath',\n\t'hkern',\n\t'image',\n\t'line',\n\t'linearGradient',\n\t'marker',\n\t'mask',\n\t'mesh',\n\t'meshgradient',\n\t'meshpatch',\n\t'meshrow',\n\t'metadata',\n\t'missing-glyph',\n\t'mpath',\n\t'path',\n\t'pattern',\n\t'polygon',\n\t'polyline',\n\t'radialGradient',\n\t'rect',\n\t'set',\n\t'solidcolor',\n\t'stop',\n\t'svg',\n\t'switch',\n\t'symbol',\n\t'text',\n\t'textPath',\n\t'tref',\n\t'tspan',\n\t'unknown',\n\t'use',\n\t'view',\n\t'vkern'\n];\n\n/** @param {string} name */\nexport function is_svg(name) {\n\treturn SVG_ELEMENTS.includes(name);\n}\n\nconst MATHML_ELEMENTS = [\n\t'annotation',\n\t'annotation-xml',\n\t'maction',\n\t'math',\n\t'merror',\n\t'mfrac',\n\t'mi',\n\t'mmultiscripts',\n\t'mn',\n\t'mo',\n\t'mover',\n\t'mpadded',\n\t'mphantom',\n\t'mprescripts',\n\t'mroot',\n\t'mrow',\n\t'ms',\n\t'mspace',\n\t'msqrt',\n\t'mstyle',\n\t'msub',\n\t'msubsup',\n\t'msup',\n\t'mtable',\n\t'mtd',\n\t'mtext',\n\t'mtr',\n\t'munder',\n\t'munderover',\n\t'semantics'\n];\n\n/** @param {string} name */\nexport function is_mathml(name) {\n\treturn MATHML_ELEMENTS.includes(name);\n}\n\nconst STATE_CREATION_RUNES = /** @type {const} */ ([\n\t'$state',\n\t'$state.raw',\n\t'$derived',\n\t'$derived.by'\n]);\n\nexport const RUNES = /** @type {const} */ ([\n\t...STATE_CREATION_RUNES,\n\t'$state.eager',\n\t'$state.snapshot',\n\t'$props',\n\t'$props.id',\n\t'$bindable',\n\t'$effect',\n\t'$effect.pre',\n\t'$effect.tracking',\n\t'$effect.root',\n\t'$effect.pending',\n\t'$inspect',\n\t'$inspect().with',\n\t'$inspect.trace',\n\t'$host'\n]);\n\n/** @typedef {typeof RUNES[number]} RuneName */\n\n/**\n * @param {string} name\n * @returns {name is RuneName}\n */\nexport function is_rune(name) {\n\treturn RUNES.includes(/** @type {RuneName} */ (name));\n}\n\n/** @typedef {typeof STATE_CREATION_RUNES[number]} StateCreationRuneName */\n\n/**\n * @param {string} name\n * @returns {name is StateCreationRuneName}\n */\nexport function is_state_creation_rune(name) {\n\treturn STATE_CREATION_RUNES.includes(/** @type {StateCreationRuneName} */ (name));\n}\n\n/** List of elements that require raw contents and should not have SSR comments put in them */\nconst RAW_TEXT_ELEMENTS = /** @type {const} */ (['textarea', 'script', 'style', 'title']);\n\n/** @param {string} name */\nexport function is_raw_text_element(name) {\n\treturn RAW_TEXT_ELEMENTS.includes(/** @type {typeof RAW_TEXT_ELEMENTS[number]} */ (name));\n}\n\n// Matches valid HTML/SVG/MathML element names and custom element names.\n// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n//\n// Standard elements: ASCII alpha start, followed by ASCII alphanumerics.\n// Custom elements: ASCII alpha start, followed by any mix of PCENChar (which\n// includes ASCII alphanumerics, `-`, `.`, `_`, and specified Unicode ranges),\n// with at least one hyphen required somewhere after the first character.\n//\n// Rejects strings containing whitespace, quotes, angle brackets, slashes, equals,\n// or other characters that could break out of a tag-name token and enable markup injection.\nexport const REGEX_VALID_TAG_NAME =\n\t/^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\\-_\\u00B7\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F-\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{EFFFF}]*)?$/u;\n\n/**\n * Prevent devtools trying to make `location` a clickable link by inserting a zero-width space\n * @template {string | undefined} T\n * @param {T} location\n * @returns {T};\n */\nexport function sanitize_location(location) {\n\treturn /** @type {T} */ (location?.replace(/\\//g, '/\\u200b'));\n}\n","import { teardown } from '../../reactivity/effects.js';\nimport { define_property } from '../../../shared/utils.js';\nimport { hydrating } from '../hydration.js';\nimport { queue_micro_task } from '../task.js';\nimport { FILENAME } from '../../../../constants.js';\nimport * as w from '../../warnings.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport { without_reactive_context } from './bindings/shared.js';\n\n/**\n * Used on elements, as a map of event type -> event handler,\n * and on events themselves to track which element handled an event\n */\nexport const event_symbol = Symbol('events');\n\n/** @type {Set<string>} */\nexport const all_registered_events = new Set();\n\n/** @type {Set<(events: Array<string>) => void>} */\nexport const root_event_handles = new Set();\n\n/**\n * SSR adds onload and onerror attributes to catch those events before the hydration.\n * This function detects those cases, removes the attributes and replays the events.\n * @param {HTMLElement} dom\n */\nexport function replay_events(dom) {\n\tif (!hydrating) return;\n\n\tdom.removeAttribute('onload');\n\tdom.removeAttribute('onerror');\n\t// @ts-expect-error\n\tconst event = dom.__e;\n\tif (event !== undefined) {\n\t\t// @ts-expect-error\n\t\tdom.__e = undefined;\n\t\tqueueMicrotask(() => {\n\t\t\tif (dom.isConnected) {\n\t\t\t\tdom.dispatchEvent(event);\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @param {string} event_name\n * @param {EventTarget} dom\n * @param {EventListener} [handler]\n * @param {AddEventListenerOptions} [options]\n */\nexport function create_event(event_name, dom, handler, options = {}) {\n\t/**\n\t * @this {EventTarget}\n\t */\n\tfunction target_handler(/** @type {Event} */ event) {\n\t\tif (!options.capture) {\n\t\t\t// Only call in the bubble phase, else delegated events would be called before the capturing events\n\t\t\thandle_event_propagation.call(dom, event);\n\t\t}\n\t\tif (!event.cancelBubble) {\n\t\t\treturn without_reactive_context(() => {\n\t\t\t\treturn handler?.call(this, event);\n\t\t\t});\n\t\t}\n\t}\n\n\t// Chrome has a bug where pointer events don't work when attached to a DOM element that has been cloned\n\t// with cloneNode() and the DOM element is disconnected from the document. To ensure the event works, we\n\t// defer the attachment till after it's been appended to the document. TODO: remove this once Chrome fixes\n\t// this bug. The same applies to wheel events and touch events.\n\tif (\n\t\tevent_name.startsWith('pointer') ||\n\t\tevent_name.startsWith('touch') ||\n\t\tevent_name === 'wheel'\n\t) {\n\t\tqueue_micro_task(() => {\n\t\t\tdom.addEventListener(event_name, target_handler, options);\n\t\t});\n\t} else {\n\t\tdom.addEventListener(event_name, target_handler, options);\n\t}\n\n\treturn target_handler;\n}\n\n/**\n * Attaches an event handler to an element and returns a function that removes the handler. Using this\n * rather than `addEventListener` will preserve the correct order relative to handlers added declaratively\n * (with attributes like `onclick`), which use event delegation for performance reasons\n *\n * @param {EventTarget} element\n * @param {string} type\n * @param {EventListener} handler\n * @param {AddEventListenerOptions} [options]\n */\nexport function on(element, type, handler, options = {}) {\n\tvar target_handler = create_event(type, element, handler, options);\n\n\treturn () => {\n\t\telement.removeEventListener(type, target_handler, options);\n\t};\n}\n\n/**\n * @param {string} event_name\n * @param {Element} dom\n * @param {EventListener} [handler]\n * @param {boolean} [capture]\n * @param {boolean} [passive]\n * @returns {void}\n */\nexport function event(event_name, dom, handler, capture, passive) {\n\tvar options = { capture, passive };\n\tvar target_handler = create_event(event_name, dom, handler, options);\n\n\tif (\n\t\tdom === document.body ||\n\t\t// @ts-ignore\n\t\tdom === window ||\n\t\t// @ts-ignore\n\t\tdom === document ||\n\t\t// Firefox has quirky behavior, it can happen that we still get \"canplay\" events when the element is already removed\n\t\tdom instanceof HTMLMediaElement\n\t) {\n\t\tteardown(() => {\n\t\t\tdom.removeEventListener(event_name, target_handler, options);\n\t\t});\n\t}\n}\n\n/**\n * @param {string} event_name\n * @param {Element} element\n * @param {EventListener} [handler]\n * @returns {void}\n */\nexport function delegated(event_name, element, handler) {\n\t// @ts-expect-error\n\t(element[event_symbol] ??= {})[event_name] = handler;\n}\n\n/**\n * @param {Array<string>} events\n * @returns {void}\n */\nexport function delegate(events) {\n\tfor (var i = 0; i < events.length; i++) {\n\t\tall_registered_events.add(events[i]);\n\t}\n\n\tfor (var fn of root_event_handles) {\n\t\tfn(events);\n\t}\n}\n\n// used to store the reference to the currently propagated event\n// to prevent garbage collection between microtasks in Firefox (<= 141)\n// If the event object is GCed too early, the expando __root property\n// set on the event object is lost, causing the event delegation\n// to process the event twice\nlet last_propagated_event = null;\n\n// whether a task is already queued to clear `last_propagated_event`\nlet last_propagated_event_clear_scheduled = false;\n\n/**\n * @this {EventTarget}\n * @param {Event} event\n * @returns {void}\n */\nexport function handle_event_propagation(event) {\n\tvar handler_element = this;\n\tvar owner_document = /** @type {Node} */ (handler_element).ownerDocument;\n\tvar event_name = event.type;\n\tvar path = event.composedPath?.() || [];\n\tvar current_target = /** @type {null | Element} */ (path[0] || event.target);\n\n\tlast_propagated_event = event;\n\n\t// The reference is only needed while the event can still reach another\n\t// delegated root, i.e. during the current (synchronous) dispatch and its\n\t// microtask checkpoints. Clearing it in a later task preserves the\n\t// Firefox workaround while making sure the slot doesn't retain the last\n\t// event forever — through `event.target` it would otherwise keep the\n\t// entire detached subtree of whatever the user last clicked in alive\n\t// until the next delegated event happens to arrive.\n\tif (!last_propagated_event_clear_scheduled) {\n\t\tlast_propagated_event_clear_scheduled = true;\n\t\tsetTimeout(() => {\n\t\t\tlast_propagated_event_clear_scheduled = false;\n\t\t\tlast_propagated_event = null;\n\t\t});\n\t}\n\n\t// composedPath contains list of nodes the event has propagated through.\n\t// We check `event_symbol` to skip all nodes below it in case this is a\n\t// parent of the `event_symbol` node, which indicates that there's nested\n\t// mounted apps. In this case we don't want to trigger events multiple times.\n\tvar path_idx = 0;\n\n\t// the `last_propagated_event === event` check is redundant, but\n\t// without it the variable will be DCE'd and things will\n\t// fail mysteriously in Firefox\n\t// @ts-expect-error is added below\n\tvar handled_at = last_propagated_event === event && event[event_symbol];\n\n\tif (handled_at) {\n\t\tvar at_idx = path.indexOf(handled_at);\n\t\tif (\n\t\t\tat_idx !== -1 &&\n\t\t\t(handler_element === document || handler_element === /** @type {any} */ (window))\n\t\t) {\n\t\t\t// This is the fallback document listener or a window listener, but the event was already handled\n\t\t\t// -> ignore, but set handle_at to document/window so that we're resetting the event\n\t\t\t// chain in case someone manually dispatches the same event object again.\n\t\t\t// @ts-expect-error\n\t\t\tevent[event_symbol] = handler_element;\n\t\t\treturn;\n\t\t}\n\n\t\t// We're deliberately not skipping if the index is higher, because\n\t\t// someone could create an event programmatically and emit it multiple times,\n\t\t// in which case we want to handle the whole propagation chain properly each time.\n\t\t// (this will only be a false negative if the event is dispatched multiple times and\n\t\t// the fallback document listener isn't reached in between, but that's super rare)\n\t\tvar handler_idx = path.indexOf(handler_element);\n\t\tif (handler_idx === -1) {\n\t\t\t// handle_idx can theoretically be -1 (happened in some JSDOM testing scenarios with an event listener on the window object)\n\t\t\t// so guard against that, too, and assume that everything was handled at this point.\n\t\t\treturn;\n\t\t}\n\n\t\tif (at_idx <= handler_idx) {\n\t\t\tpath_idx = at_idx;\n\t\t}\n\t}\n\n\tcurrent_target = /** @type {Element} */ (path[path_idx] || event.target);\n\t// there can only be one delegated event per element, and we either already handled the current target,\n\t// or this is the very first target in the chain which has a non-delegated listener, in which case it's safe\n\t// to handle a possible delegated event on it later (through the root delegation listener for example).\n\tif (current_target === handler_element) return;\n\n\t// Proxy currentTarget to correct target\n\tdefine_property(event, 'currentTarget', {\n\t\tconfigurable: true,\n\t\tget() {\n\t\t\treturn current_target || owner_document;\n\t\t}\n\t});\n\n\t// This started because of Chromium issue https://chromestatus.com/feature/5128696823545856,\n\t// where removal or moving of the DOM can cause sync `blur` events to fire, which can cause logic\n\t// to run inside the current `active_reaction`, which isn't what we want at all. However, on reflection,\n\t// it's probably best that all events handled by Svelte have this behaviour, as we don't really want\n\t// an event handler to run in the context of another reaction or effect.\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\n\ttry {\n\t\t/**\n\t\t * @type {unknown}\n\t\t */\n\t\tvar throw_error;\n\t\t/**\n\t\t * @type {unknown[]}\n\t\t */\n\t\tvar other_errors = [];\n\n\t\twhile (current_target !== null) {\n\t\t\tif (current_target === handler_element) break;\n\n\t\t\ttry {\n\t\t\t\t// @ts-expect-error\n\t\t\t\tvar delegated = current_target[event_symbol]?.[event_name];\n\n\t\t\t\tif (\n\t\t\t\t\tdelegated != null &&\n\t\t\t\t\t(!(/** @type {any} */ (current_target).disabled) ||\n\t\t\t\t\t\t// DOM could've been updated already by the time this is reached, so we check this as well\n\t\t\t\t\t\t// -> the target could not have been disabled because it emits the event in the first place\n\t\t\t\t\t\tevent.target === current_target)\n\t\t\t\t) {\n\t\t\t\t\tdelegated.call(current_target, event);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (throw_error) {\n\t\t\t\t\tother_errors.push(error);\n\t\t\t\t} else {\n\t\t\t\t\tthrow_error = error;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (event.cancelBubble) break;\n\n\t\t\tpath_idx++;\n\t\t\tcurrent_target = path_idx < path.length ? /** @type {Element} */ (path[path_idx]) : null;\n\t\t}\n\n\t\tif (throw_error) {\n\t\t\tfor (let error of other_errors) {\n\t\t\t\t// Throw the rest of the errors, one-by-one on a microtask\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t\t}\n\t\t\tthrow throw_error;\n\t\t}\n\t} finally {\n\t\t// @ts-expect-error is used above\n\t\tevent[event_symbol] = handler_element;\n\t\t// @ts-ignore remove proxy on currentTarget\n\t\tdelete event.currentTarget;\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t}\n}\n\n/**\n * In dev, warn if an event handler is not a function, as it means the\n * user probably called the handler or forgot to add a `() =>`\n * @param {() => (event: Event, ...args: any) => void} thunk\n * @param {EventTarget} element\n * @param {[Event, ...any]} args\n * @param {any} component\n * @param {[number, number]} [loc]\n * @param {boolean} [remove_parens]\n */\nexport function apply(\n\tthunk,\n\telement,\n\targs,\n\tcomponent,\n\tloc,\n\thas_side_effects = false,\n\tremove_parens = false\n) {\n\tlet handler;\n\tlet error;\n\n\ttry {\n\t\thandler = thunk();\n\t} catch (e) {\n\t\terror = e;\n\t}\n\n\tif (typeof handler !== 'function' && (has_side_effects || handler != null || error)) {\n\t\tconst filename = component?.[FILENAME];\n\t\tconst location = loc ? ` at ${filename}:${loc[0]}:${loc[1]}` : ` in ${filename}`;\n\t\tconst phase = args[0]?.eventPhase < Event.BUBBLING_PHASE ? 'capture' : '';\n\t\tconst event_name = args[0]?.type + phase;\n\t\tconst description = `\\`${event_name}\\` handler${location}`;\n\t\tconst suggestion = remove_parens ? 'remove the trailing `()`' : 'add a leading `() =>`';\n\n\t\tw.event_handler_invalid(description, suggestion);\n\n\t\tif (error) {\n\t\t\tthrow error;\n\t\t}\n\t}\n\thandler?.apply(element, args);\n}\n","import { create_element } from './operations.js';\n\nconst policy =\n\t// We gotta write it like this because after downleveling the pure comment may end up in the wrong location\n\tglobalThis?.window?.trustedTypes &&\n\t/* @__PURE__ */ globalThis.window.trustedTypes.createPolicy('svelte-trusted-html', {\n\t\t/** @param {string} html */\n\t\tcreateHTML: (html) => {\n\t\t\treturn html;\n\t\t}\n\t});\n\n/** @param {string} html */\nexport function create_trusted_html(html) {\n\treturn /** @type {string} */ (policy?.createHTML(html) ?? html);\n}\n\n/**\n * @param {string} html\n */\nexport function create_fragment_from_html(html) {\n\tvar elem = create_element('template');\n\telem.innerHTML = create_trusted_html(html.replaceAll('<!>', '<!---->')); // XHTML compliance\n\treturn elem.content;\n}\n","/** @import { Effect, EffectNodes, TemplateNode } from '#client' */\n/** @import { TemplateStructure } from './types' */\nimport { hydrate_next, hydrate_node, hydrating, set_hydrate_node } from './hydration.js';\nimport {\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tis_firefox,\n\tcreate_element,\n\tcreate_fragment,\n\tcreate_comment,\n\tset_attribute,\n\tmerge_text_nodes\n} from './operations.js';\nimport { create_fragment_from_html } from './reconciler.js';\nimport { active_effect } from '../runtime.js';\nimport {\n\tNAMESPACE_MATHML,\n\tNAMESPACE_SVG,\n\tTEMPLATE_FRAGMENT,\n\tTEMPLATE_USE_IMPORT_NODE,\n\tTEMPLATE_USE_MATHML,\n\tTEMPLATE_USE_SVG\n} from '../../../constants.js';\nimport {\n\tCOMMENT_NODE,\n\tDOCUMENT_FRAGMENT_NODE,\n\tIS_XHTML,\n\tREACTION_RAN,\n\tTEXT_NODE\n} from '#client/constants';\n\nconst TEMPLATE_TAG = IS_XHTML ? 'template' : 'TEMPLATE';\nconst SCRIPT_TAG = IS_XHTML ? 'script' : 'SCRIPT';\n\n/**\n * @param {TemplateNode} start\n * @param {TemplateNode | null} end\n */\nexport function assign_nodes(start, end) {\n\tvar effect = /** @type {Effect} */ (active_effect);\n\tif (effect.nodes === null) {\n\t\teffect.nodes = { start, end, a: null, t: null };\n\t}\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_html(content, flags) {\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;\n\n\t/** @type {Node} */\n\tvar node;\n\n\t/**\n\t * Whether or not the first item is a text/element node. If not, we need to\n\t * create an additional comment node to act as `effect.nodes.start`\n\t */\n\tvar has_start = !content.startsWith('<!>');\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (node === undefined) {\n\t\t\tnode = create_fragment_from_html(has_start ? content : '<!>' + content);\n\t\t\tif (!is_fragment) node = /** @type {TemplateNode} */ (get_first_child(node));\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (\n\t\t\tuse_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true)\n\t\t);\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (clone.lastChild);\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n * @param {'svg' | 'math'} ns\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nfunction from_namespace(content, flags, ns = 'svg') {\n\t/**\n\t * Whether or not the first item is a text/element node. If not, we need to\n\t * create an additional comment node to act as `effect.nodes.start`\n\t */\n\tvar has_start = !content.startsWith('<!>');\n\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar wrapped = `<${ns}>${has_start ? content : '<!>' + content}</${ns}>`;\n\n\t/** @type {Element | DocumentFragment} */\n\tvar node;\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (!node) {\n\t\t\tvar fragment = /** @type {DocumentFragment} */ (create_fragment_from_html(wrapped));\n\t\t\tvar root = /** @type {Element} */ (get_first_child(fragment));\n\n\t\t\tif (is_fragment) {\n\t\t\t\tnode = document.createDocumentFragment();\n\t\t\t\twhile (get_first_child(root)) {\n\t\t\t\t\tnode.appendChild(/** @type {TemplateNode} */ (get_first_child(root)));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnode = /** @type {Element} */ (get_first_child(root));\n\t\t\t}\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (node.cloneNode(true));\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (clone.lastChild);\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_svg(content, flags) {\n\treturn from_namespace(content, flags, 'svg');\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_mathml(content, flags) {\n\treturn from_namespace(content, flags, 'math');\n}\n\n/**\n * @param {TemplateStructure[]} structure\n * @param {typeof NAMESPACE_SVG | typeof NAMESPACE_MATHML | undefined} [ns]\n */\nfunction fragment_from_tree(structure, ns) {\n\tvar fragment = create_fragment();\n\n\tfor (var item of structure) {\n\t\tif (typeof item === 'string') {\n\t\t\tfragment.append(create_text(item));\n\t\t\tcontinue;\n\t\t}\n\n\t\t// if `preserveComments === true`, comments are represented as `['// <data>']`\n\t\tif (item === undefined || item[0][0] === '/') {\n\t\t\tfragment.append(create_comment(item ? item[0].slice(3) : ''));\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst [name, attributes, ...children] = item;\n\n\t\tconst namespace = name === 'svg' ? NAMESPACE_SVG : name === 'math' ? NAMESPACE_MATHML : ns;\n\n\t\tvar element = create_element(name, namespace, attributes?.is);\n\n\t\tfor (var key in attributes) {\n\t\t\tset_attribute(element, key, attributes[key]);\n\t\t}\n\n\t\tif (children.length > 0) {\n\t\t\tvar target =\n\t\t\t\telement.nodeName === TEMPLATE_TAG\n\t\t\t\t\t? /** @type {HTMLTemplateElement} */ (element).content\n\t\t\t\t\t: element;\n\n\t\t\ttarget.append(\n\t\t\t\tfragment_from_tree(children, element.nodeName === 'foreignObject' ? undefined : namespace)\n\t\t\t);\n\t\t}\n\n\t\tfragment.append(element);\n\t}\n\n\treturn fragment;\n}\n\n/**\n * @param {TemplateStructure[]} structure\n * @param {number} flags\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_tree(structure, flags) {\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;\n\n\t/** @type {Node} */\n\tvar node;\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (node === undefined) {\n\t\t\tconst ns =\n\t\t\t\t(flags & TEMPLATE_USE_SVG) !== 0\n\t\t\t\t\t? NAMESPACE_SVG\n\t\t\t\t\t: (flags & TEMPLATE_USE_MATHML) !== 0\n\t\t\t\t\t\t? NAMESPACE_MATHML\n\t\t\t\t\t\t: undefined;\n\n\t\t\tnode = fragment_from_tree(structure, ns);\n\t\t\tif (!is_fragment) node = /** @type {TemplateNode} */ (get_first_child(node));\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (\n\t\t\tuse_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true)\n\t\t);\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (clone.lastChild);\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {() => Element | DocumentFragment} fn\n */\nexport function with_script(fn) {\n\treturn () => run_scripts(fn());\n}\n\n/**\n * Creating a document fragment from HTML that contains script tags will not execute\n * the scripts. We need to replace the script tags with new ones so that they are executed.\n * @param {Element | DocumentFragment} node\n * @returns {Node | Node[]}\n */\nfunction run_scripts(node) {\n\t// scripts were SSR'd, in which case they will run\n\tif (hydrating) return node;\n\n\tconst is_fragment = node.nodeType === DOCUMENT_FRAGMENT_NODE;\n\tconst scripts =\n\t\t/** @type {HTMLElement} */ (node).nodeName === SCRIPT_TAG\n\t\t\t? [/** @type {HTMLScriptElement} */ (node)]\n\t\t\t: node.querySelectorAll('script');\n\n\tconst effect = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);\n\n\tfor (const script of scripts) {\n\t\tconst clone = create_element('script');\n\t\tfor (var attribute of script.attributes) {\n\t\t\tclone.setAttribute(attribute.name, attribute.value);\n\t\t}\n\n\t\tclone.textContent = script.textContent;\n\n\t\t// The script has changed - if it's at the edges, the effect now points at dead nodes\n\t\tif (is_fragment ? node.firstChild === script : node === script) {\n\t\t\teffect.nodes.start = clone;\n\t\t}\n\t\tif (is_fragment ? node.lastChild === script : node === script) {\n\t\t\teffect.nodes.end = clone;\n\t\t}\n\n\t\tscript.replaceWith(clone);\n\t}\n\treturn node;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {any} value\n */\nexport function text(value = '') {\n\tif (!hydrating) {\n\t\tvar t = create_text(value + '');\n\t\tassign_nodes(t, t);\n\t\treturn t;\n\t}\n\n\tvar node = hydrate_node;\n\n\tif (node.nodeType !== TEXT_NODE) {\n\t\t// if an {expression} is empty during SSR, we need to insert an empty text node\n\t\tnode.before((node = create_text()));\n\t\tset_hydrate_node(node);\n\t} else {\n\t\tmerge_text_nodes(/** @type {Text} */ (node));\n\t}\n\n\tassign_nodes(node, node);\n\treturn node;\n}\n\n/**\n * @returns {TemplateNode | DocumentFragment}\n */\nexport function comment() {\n\t// we're not delegating to `template` here for performance reasons\n\tif (hydrating) {\n\t\tassign_nodes(hydrate_node, null);\n\t\treturn hydrate_node;\n\t}\n\n\tvar frag = document.createDocumentFragment();\n\tvar start = document.createComment('');\n\tvar anchor = create_text();\n\tfrag.append(start, anchor);\n\n\tassign_nodes(start, anchor);\n\n\treturn frag;\n}\n\n/**\n * Assign the created (or in hydration mode, traversed) dom elements to the current block\n * and insert the elements into the dom (in client mode).\n * @param {Text | Comment | Element} anchor\n * @param {DocumentFragment | Element} dom\n */\nexport function append(anchor, dom) {\n\tif (hydrating) {\n\t\tvar effect = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);\n\n\t\t// When hydrating and outer component and an inner component is async, i.e. blocked on a promise,\n\t\t// then by the time the inner resolves we have already advanced to the end of the hydrated nodes\n\t\t// of the parent component. Check for defined for that reason to avoid rewinding the parent's end marker.\n\t\tif ((effect.f & REACTION_RAN) === 0 || effect.nodes.end === null) {\n\t\t\teffect.nodes.end = hydrate_node;\n\t\t}\n\n\t\thydrate_next();\n\t\treturn;\n\t}\n\n\tif (anchor === null) {\n\t\t// edge case — void `<svelte:element>` with content\n\t\treturn;\n\t}\n\n\tanchor.before(/** @type {Node} */ (dom));\n}\n\n/**\n * Create (or hydrate) an unique UID for the component instance.\n */\nexport function props_id() {\n\tif (\n\t\thydrating &&\n\t\thydrate_node &&\n\t\thydrate_node.nodeType === COMMENT_NODE &&\n\t\thydrate_node.textContent?.startsWith(`$`)\n\t) {\n\t\tconst id = hydrate_node.textContent.substring(1);\n\t\thydrate_next();\n\t\treturn id;\n\t}\n\n\t// @ts-expect-error This way we ensure the id is unique even across Svelte runtimes\n\t(window.__svelte ??= {}).uid ??= 1;\n\n\t// @ts-expect-error\n\treturn `c${window.__svelte.uid++}`;\n}\n","import { get, tick, untrack } from '../internal/client/runtime.js';\nimport { effect_tracking, render_effect } from '../internal/client/reactivity/effects.js';\nimport { source, increment } from '../internal/client/reactivity/sources.js';\nimport { tag } from '../internal/client/dev/tracing.js';\nimport { DEV } from 'esm-env';\nimport { queue_micro_task } from '../internal/client/dom/task.js';\n\n/**\n * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.\n * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.\n *\n * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),\n * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.\n *\n * If `start` returns a cleanup function, it will be called when the effect is destroyed.\n *\n * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects\n * are active, and the returned teardown function will only be called when all effects are destroyed.\n *\n * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):\n *\n * ```js\n * import { createSubscriber } from 'svelte/reactivity';\n * import { on } from 'svelte/events';\n *\n * export class MediaQuery {\n * \t#query;\n * \t#subscribe;\n *\n * \tconstructor(query) {\n * \t\tthis.#query = window.matchMedia(`(${query})`);\n *\n * \t\tthis.#subscribe = createSubscriber((update) => {\n * \t\t\t// when the `change` event occurs, re-run any effects that read `this.current`\n * \t\t\tconst off = on(this.#query, 'change', update);\n *\n * \t\t\t// stop listening when all the effects are destroyed\n * \t\t\treturn () => off();\n * \t\t});\n * \t}\n *\n * \tget current() {\n * \t\t// This makes the getter reactive, if read in an effect\n * \t\tthis.#subscribe();\n *\n * \t\t// Return the current state of the query, whether or not we're in an effect\n * \t\treturn this.#query.matches;\n * \t}\n * }\n * ```\n * @param {(update: () => void) => (() => void) | void} start\n * @since 5.7.0\n */\nexport function createSubscriber(start) {\n\tlet subscribers = 0;\n\tlet version = source(0);\n\t/** @type {(() => void) | void} */\n\tlet stop;\n\n\tif (DEV) {\n\t\ttag(version, 'createSubscriber version');\n\t}\n\n\treturn () => {\n\t\tif (effect_tracking()) {\n\t\t\tget(version);\n\n\t\t\trender_effect(() => {\n\t\t\t\tif (subscribers === 0) {\n\t\t\t\t\tstop = untrack(() => start(() => increment(version)));\n\t\t\t\t}\n\n\t\t\t\tsubscribers += 1;\n\n\t\t\t\treturn () => {\n\t\t\t\t\tqueue_micro_task(() => {\n\t\t\t\t\t\t// Only count down after a microtask, else we would reach 0 before our own render effect reruns,\n\t\t\t\t\t\t// but reach 1 again when the tick callback of the prior teardown runs. That would mean we\n\t\t\t\t\t\t// re-subcribe unnecessarily and create a memory leak because the old subscription is never cleaned up.\n\t\t\t\t\t\tsubscribers -= 1;\n\n\t\t\t\t\t\tif (subscribers === 0) {\n\t\t\t\t\t\t\tstop?.();\n\t\t\t\t\t\t\tstop = undefined;\n\t\t\t\t\t\t\t// Increment the version to ensure any dependent deriveds are marked dirty when the subscription is picked up again later.\n\t\t\t\t\t\t\t// If we didn't do this then the comparison of write versions would determine that the derived has a later version than\n\t\t\t\t\t\t\t// the subscriber, and it would not be re-run.\n\t\t\t\t\t\t\tincrement(version);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t};\n}\n","/** @import { Effect, Source, TemplateNode, } from '#client' */\nimport { BOUNDARY_EFFECT, EFFECT_PRESERVED, EFFECT_TRANSPARENT } from '#client/constants';\nimport { HYDRATION_START_ELSE, HYDRATION_START_FAILED } from '../../../../constants.js';\nimport { component_context, set_component_context } from '../../context.js';\nimport { invoke_error_boundary } from '../../error-handling.js';\nimport {\n\tblock,\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect\n} from '../../reactivity/effects.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tnext,\n\tskip_nodes,\n\tset_hydrate_node\n} from '../hydration.js';\nimport { queue_micro_task } from '../task.js';\nimport * as e from '../../errors.js';\nimport * as w from '../../warnings.js';\nimport { DEV } from 'esm-env';\nimport { Batch, current_batch } from '../../reactivity/batch.js';\nimport { internal_set, source } from '../../reactivity/sources.js';\nimport { tag } from '../../dev/tracing.js';\nimport { createSubscriber } from '../../../../reactivity/create-subscriber.js';\nimport { create_text } from '../operations.js';\nimport { defer_effect } from '../../reactivity/utils.js';\n\n/**\n * @typedef {{\n * \t onerror?: ((error: unknown, reset: () => void) => void) | null;\n * failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null;\n * pending?: ((anchor: Node) => void) | null;\n * }} BoundaryProps\n */\n\nvar flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;\n\n/**\n * @param {TemplateNode} node\n * @param {BoundaryProps} props\n * @param {((anchor: Node) => void)} children\n * @param {((error: unknown) => unknown) | undefined} [transform_error]\n * @returns {void}\n */\nexport function boundary(node, props, children, transform_error) {\n\tnew Boundary(node, props, children, transform_error);\n}\n\nexport class Boundary {\n\t/** @type {Boundary | null} */\n\tparent;\n\n\tis_pending = false;\n\n\t/**\n\t * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.\n\t * Inherited from parent boundary, or defaults to identity.\n\t * @type {(error: unknown) => unknown}\n\t */\n\ttransform_error;\n\n\t/** @type {TemplateNode} */\n\t#anchor;\n\n\t/** @type {TemplateNode | null} */\n\t#hydrate_open = hydrating ? hydrate_node : null;\n\n\t/** @type {BoundaryProps} */\n\t#props;\n\n\t/** @type {((anchor: Node) => void)} */\n\t#children;\n\n\t/** @type {Effect} */\n\t#effect;\n\n\t/** @type {Effect | null} */\n\t#main_effect = null;\n\n\t/** @type {Effect | null} */\n\t#pending_effect = null;\n\n\t/** @type {Effect | null} */\n\t#failed_effect = null;\n\n\t/** @type {DocumentFragment | null} */\n\t#offscreen_fragment = null;\n\n\t#local_pending_count = 0;\n\t#pending_count = 0;\n\t#pending_count_update_queued = false;\n\n\t/** @type {Set<Effect>} */\n\t#dirty_effects = new Set();\n\n\t/** @type {Set<Effect>} */\n\t#maybe_dirty_effects = new Set();\n\n\t/**\n\t * A source containing the number of pending async deriveds/expressions.\n\t * Only created if `$effect.pending()` is used inside the boundary,\n\t * otherwise updating the source results in needless `Batch.ensure()`\n\t * calls followed by no-op flushes\n\t * @type {Source<number> | null}\n\t */\n\t#effect_pending = null;\n\n\t#effect_pending_subscriber = createSubscriber(() => {\n\t\tthis.#effect_pending = source(this.#local_pending_count);\n\n\t\tif (DEV) {\n\t\t\ttag(this.#effect_pending, '$effect.pending()');\n\t\t}\n\n\t\treturn () => {\n\t\t\tthis.#effect_pending = null;\n\t\t};\n\t});\n\n\t/**\n\t * @param {TemplateNode} node\n\t * @param {BoundaryProps} props\n\t * @param {((anchor: Node) => void)} children\n\t * @param {((error: unknown) => unknown) | undefined} [transform_error]\n\t */\n\tconstructor(node, props, children, transform_error) {\n\t\tthis.#anchor = node;\n\t\tthis.#props = props;\n\n\t\tthis.#children = (anchor) => {\n\t\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t\teffect.b = this;\n\t\t\teffect.f |= BOUNDARY_EFFECT;\n\n\t\t\tchildren(anchor);\n\t\t};\n\n\t\tthis.parent = /** @type {Effect} */ (active_effect).b;\n\n\t\t// Inherit transform_error from parent boundary, or use the provided one, or default to identity\n\t\tthis.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);\n\n\t\tthis.#effect = block(() => {\n\t\t\tif (hydrating) {\n\t\t\t\tconst comment = /** @type {Comment} */ (this.#hydrate_open);\n\t\t\t\thydrate_next();\n\n\t\t\t\tconst server_rendered_pending = comment.data === HYDRATION_START_ELSE;\n\t\t\t\tconst server_rendered_failed = comment.data.startsWith(HYDRATION_START_FAILED);\n\n\t\t\t\tif (server_rendered_failed) {\n\t\t\t\t\t// Server rendered the failed snippet - hydrate it.\n\t\t\t\t\t// The serialized error is embedded in the comment: <!--[?<json>-->\n\t\t\t\t\tconst serialized_error = JSON.parse(comment.data.slice(HYDRATION_START_FAILED.length));\n\t\t\t\t\tthis.#hydrate_failed_content(serialized_error);\n\t\t\t\t} else if (server_rendered_pending) {\n\t\t\t\t\tthis.#hydrate_pending_content();\n\t\t\t\t} else {\n\t\t\t\t\tthis.#hydrate_resolved_content();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.#render();\n\t\t\t}\n\t\t}, flags);\n\n\t\tif (hydrating) {\n\t\t\tthis.#anchor = hydrate_node;\n\t\t}\n\t}\n\n\t#hydrate_resolved_content() {\n\t\ttry {\n\t\t\tthis.#main_effect = branch(() => this.#children(this.#anchor));\n\t\t} catch (error) {\n\t\t\tthis.error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {unknown} error The deserialized error from the server's hydration comment\n\t */\n\t#hydrate_failed_content(error) {\n\t\tconst failed = this.#props.failed;\n\t\tconst { reset, invoke_onerror } = this.#create_reset(error);\n\n\t\t// `onerror` may mutate state, which is disallowed while hydrating\n\t\tqueue_micro_task(invoke_onerror);\n\n\t\tif (!failed) return;\n\n\t\tthis.#failed_effect = branch(() => {\n\t\t\tfailed(\n\t\t\t\tthis.#anchor,\n\t\t\t\t() => error,\n\t\t\t\t() => reset\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Creates the `reset` function for a failed boundary, along with a function\n\t * that invokes `onerror` with it (if provided)\n\t * @param {unknown} error\n\t * @returns {{ reset: () => void, invoke_onerror: () => void }}\n\t */\n\t#create_reset(error) {\n\t\tvar did_reset = false;\n\t\tvar calling_on_error = false;\n\n\t\tconst reset = () => {\n\t\t\tif (did_reset) {\n\t\t\t\tw.svelte_boundary_reset_noop();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdid_reset = true;\n\n\t\t\tif (calling_on_error) {\n\t\t\t\te.svelte_boundary_reset_onerror();\n\t\t\t}\n\n\t\t\tif (this.#failed_effect !== null) {\n\t\t\t\tpause_effect(this.#failed_effect, () => {\n\t\t\t\t\tthis.#failed_effect = null;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.#run(() => {\n\t\t\t\tthis.#render();\n\t\t\t});\n\t\t};\n\n\t\tconst invoke_onerror = () => {\n\t\t\ttry {\n\t\t\t\tcalling_on_error = true;\n\t\t\t\tthis.#props.onerror?.(error, reset);\n\t\t\t\tcalling_on_error = false;\n\t\t\t} catch (err) {\n\t\t\t\tinvoke_error_boundary(err, this.#effect && this.#effect.parent);\n\t\t\t}\n\t\t};\n\n\t\treturn { reset, invoke_onerror };\n\t}\n\n\t#hydrate_pending_content() {\n\t\tconst pending = this.#props.pending;\n\t\tif (!pending) return;\n\n\t\tthis.is_pending = true;\n\t\tthis.#pending_effect = branch(() => pending(this.#anchor));\n\n\t\tqueue_micro_task(() => {\n\t\t\tvar fragment = (this.#offscreen_fragment = document.createDocumentFragment());\n\t\t\tvar anchor = create_text();\n\t\t\tvar handled = false;\n\n\t\t\tfragment.append(anchor);\n\n\t\t\tthis.#main_effect = this.#run(() => {\n\t\t\t\ttry {\n\t\t\t\t\treturn branch(() => this.#children(anchor));\n\t\t\t\t} catch (error) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.error(error);\n\t\t\t\t\t\thandled = true;\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tinvoke_error_boundary(error, this.#effect.parent);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (this.#main_effect === null) {\n\t\t\t\tthis.#offscreen_fragment = null;\n\t\t\t\tif (handled) this.#resolve(/** @type {Batch} */ (current_batch));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this.#pending_count === 0) {\n\t\t\t\tthis.#anchor.before(fragment);\n\t\t\t\tthis.#offscreen_fragment = null;\n\n\t\t\t\tpause_effect(/** @type {Effect} */ (this.#pending_effect), () => {\n\t\t\t\t\tthis.#pending_effect = null;\n\t\t\t\t});\n\n\t\t\t\tthis.#resolve(/** @type {Batch} */ (current_batch));\n\t\t\t}\n\t\t});\n\t}\n\n\t#render() {\n\t\ttry {\n\t\t\tthis.is_pending = this.has_pending_snippet();\n\t\t\tthis.#pending_count = 0;\n\t\t\tthis.#local_pending_count = 0;\n\n\t\t\tthis.#main_effect = branch(() => {\n\t\t\t\tthis.#children(this.#anchor);\n\t\t\t});\n\n\t\t\tif (this.#pending_count > 0) {\n\t\t\t\tvar fragment = (this.#offscreen_fragment = document.createDocumentFragment());\n\t\t\t\tmove_effect(this.#main_effect, fragment);\n\n\t\t\t\tconst pending = /** @type {(anchor: Node) => void} */ (this.#props.pending);\n\t\t\t\tthis.#pending_effect = branch(() => pending(this.#anchor));\n\t\t\t} else {\n\t\t\t\tthis.#resolve(/** @type {Batch} */ (current_batch));\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#resolve(batch) {\n\t\tthis.is_pending = false;\n\n\t\t// any effects that were previously deferred should be transferred\n\t\t// to the batch, which will flush in the next microtask\n\t\tbatch.transfer_effects(this.#dirty_effects, this.#maybe_dirty_effects);\n\t}\n\n\t/**\n\t * Defer an effect inside a pending boundary until the boundary resolves\n\t * @param {Effect} effect\n\t */\n\tdefer_effect(effect) {\n\t\tdefer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects);\n\t}\n\n\t/**\n\t * Returns `false` if the effect exists inside a boundary whose pending snippet is shown\n\t * @returns {boolean}\n\t */\n\tis_rendered() {\n\t\treturn !this.is_pending && (!this.parent || this.parent.is_rendered());\n\t}\n\n\thas_pending_snippet() {\n\t\treturn !!this.#props.pending;\n\t}\n\n\t/**\n\t * @template T\n\t * @param {() => T} fn\n\t */\n\t#run(fn) {\n\t\tvar previous_effect = active_effect;\n\t\tvar previous_reaction = active_reaction;\n\t\tvar previous_ctx = component_context;\n\n\t\tset_active_effect(this.#effect);\n\t\tset_active_reaction(this.#effect);\n\t\tset_component_context(this.#effect.ctx);\n\n\t\ttry {\n\t\t\tBatch.ensure();\n\t\t\treturn fn();\n\t\t} finally {\n\t\t\tset_active_effect(previous_effect);\n\t\t\tset_active_reaction(previous_reaction);\n\t\t\tset_component_context(previous_ctx);\n\t\t}\n\t}\n\n\t/**\n\t * Updates the pending count associated with the currently visible pending snippet,\n\t * if any, such that we can replace the snippet with content once work is done\n\t * @param {1 | -1} d\n\t * @param {Batch} batch\n\t */\n\t#update_pending_count(d, batch) {\n\t\tif (!this.has_pending_snippet()) {\n\t\t\tif (this.parent) {\n\t\t\t\tthis.parent.#update_pending_count(d, batch);\n\t\t\t}\n\n\t\t\t// if there's no parent, we're in a scope with no pending snippet\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#pending_count += d;\n\n\t\tif (this.#pending_count === 0) {\n\t\t\tthis.#resolve(batch);\n\n\t\t\tif (this.#pending_effect) {\n\t\t\t\tpause_effect(this.#pending_effect, () => {\n\t\t\t\t\tthis.#pending_effect = null;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (this.#offscreen_fragment) {\n\t\t\t\tthis.#anchor.before(this.#offscreen_fragment);\n\t\t\t\tthis.#offscreen_fragment = null;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Update the source that powers `$effect.pending()` inside this boundary,\n\t * and controls when the current `pending` snippet (if any) is removed.\n\t * Do not call from inside the class\n\t * @param {1 | -1} d\n\t * @param {Batch} batch\n\t */\n\tupdate_pending_count(d, batch) {\n\t\tthis.#update_pending_count(d, batch);\n\n\t\tthis.#local_pending_count += d;\n\n\t\tif (!this.#effect_pending || this.#pending_count_update_queued) return;\n\t\tthis.#pending_count_update_queued = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tthis.#pending_count_update_queued = false;\n\t\t\tif (this.#effect_pending) {\n\t\t\t\tinternal_set(this.#effect_pending, this.#local_pending_count);\n\t\t\t}\n\t\t});\n\t}\n\n\tget_effect_pending() {\n\t\tthis.#effect_pending_subscriber();\n\t\treturn get(/** @type {Source<number>} */ (this.#effect_pending));\n\t}\n\n\t/** @param {unknown} error */\n\terror(error) {\n\t\t// If we have nothing to capture the error, or if we hit an error while\n\t\t// rendering the fallback, re-throw for another boundary to handle\n\t\tif (!this.#props.onerror && !this.#props.failed) {\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (current_batch?.is_fork) {\n\t\t\tif (this.#main_effect) current_batch.skip_effect(this.#main_effect);\n\t\t\tif (this.#pending_effect) current_batch.skip_effect(this.#pending_effect);\n\t\t\tif (this.#failed_effect) current_batch.skip_effect(this.#failed_effect);\n\n\t\t\tcurrent_batch.oncommit(() => {\n\t\t\t\tthis.#handle_error(error);\n\t\t\t});\n\t\t} else {\n\t\t\tthis.#handle_error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {unknown} error\n\t */\n\t#handle_error(error) {\n\t\tif (this.#main_effect) {\n\t\t\tdestroy_effect(this.#main_effect);\n\t\t\tthis.#main_effect = null;\n\t\t}\n\n\t\tif (this.#pending_effect) {\n\t\t\tdestroy_effect(this.#pending_effect);\n\t\t\tthis.#pending_effect = null;\n\t\t}\n\n\t\tif (this.#failed_effect) {\n\t\t\tdestroy_effect(this.#failed_effect);\n\t\t\tthis.#failed_effect = null;\n\t\t}\n\n\t\tif (hydrating) {\n\t\t\tset_hydrate_node(/** @type {TemplateNode} */ (this.#hydrate_open));\n\t\t\tnext();\n\t\t\tset_hydrate_node(skip_nodes());\n\t\t}\n\n\t\tlet failed = this.#props.failed;\n\n\t\t/** @param {unknown} transformed_error */\n\t\tconst handle_error_result = (transformed_error) => {\n\t\t\tconst { reset, invoke_onerror } = this.#create_reset(transformed_error);\n\n\t\t\tinvoke_onerror();\n\n\t\t\tif (failed) {\n\t\t\t\tthis.#failed_effect = this.#run(() => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn branch(() => {\n\t\t\t\t\t\t\t// errors in `failed` snippets cause the boundary to error again\n\t\t\t\t\t\t\t// TODO Svelte 6: revisit this decision, most likely better to go to parent boundary instead\n\t\t\t\t\t\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t\t\t\t\t\teffect.b = this;\n\t\t\t\t\t\t\teffect.f |= BOUNDARY_EFFECT;\n\n\t\t\t\t\t\t\tfailed(\n\t\t\t\t\t\t\t\tthis.#anchor,\n\t\t\t\t\t\t\t\t() => transformed_error,\n\t\t\t\t\t\t\t\t() => reset\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tinvoke_error_boundary(error, /** @type {Effect} */ (this.#effect.parent));\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\tqueue_micro_task(() => {\n\t\t\t// Run the error through the API-level transformError transform (e.g. SvelteKit's handleError)\n\t\t\t/** @type {unknown} */\n\t\t\tvar result;\n\t\t\ttry {\n\t\t\t\tresult = this.transform_error(error);\n\t\t\t} catch (e) {\n\t\t\t\tinvoke_error_boundary(e, this.#effect && this.#effect.parent);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tresult !== null &&\n\t\t\t\ttypeof result === 'object' &&\n\t\t\t\ttypeof (/** @type {any} */ (result).then) === 'function'\n\t\t\t) {\n\t\t\t\t// transformError returned a Promise — wait for it\n\t\t\t\t/** @type {any} */ (result).then(\n\t\t\t\t\thandle_error_result,\n\t\t\t\t\t/** @param {unknown} e */\n\t\t\t\t\t(e) => invoke_error_boundary(e, this.#effect && this.#effect.parent)\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Synchronous result — handle immediately\n\t\t\t\thandle_error_result(result);\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function pending() {\n\tif (active_effect === null) {\n\t\te.effect_pending_outside_reaction();\n\t}\n\n\tvar boundary = active_effect.b;\n\n\tif (boundary === null) {\n\t\treturn 0; // TODO eventually we will need this to be global\n\t}\n\n\treturn boundary.get_effect_pending();\n}\n","/** @import { ComponentContext, Effect, EffectNodes, TemplateNode } from '#client' */\n/** @import { Component, ComponentType, SvelteComponent, MountOptions } from '../../index.js' */\nimport { DEV } from 'esm-env';\nimport {\n\tclear_text_content,\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tinit_operations\n} from './dom/operations.js';\nimport { HYDRATION_END, HYDRATION_ERROR, HYDRATION_START } from '../../constants.js';\nimport { active_effect } from './runtime.js';\nimport { push, pop, component_context, mark_as_component } from './context.js';\nimport { component_root } from './reactivity/effects.js';\nimport { hydrate_node, hydrating, set_hydrate_node, set_hydrating } from './dom/hydration.js';\nimport { array_from } from '../shared/utils.js';\nimport {\n\tall_registered_events,\n\thandle_event_propagation,\n\troot_event_handles\n} from './dom/elements/events.js';\nimport * as w from './warnings.js';\nimport * as e from './errors.js';\nimport { assign_nodes } from './dom/template.js';\nimport { is_passive_event } from '../../utils.js';\nimport { COMMENT_NODE, TEXT_CACHE } from './constants.js';\nimport { boundary } from './dom/blocks/boundary.js';\n\n/**\n * This is normally true — block effects should run their intro transitions —\n * but is false during hydration (unless `options.intro` is `true`) and\n * when creating the children of a `<svelte:element>` that just changed tag\n */\nexport let should_intro = true;\n\n/** @param {boolean} value */\nexport function set_should_intro(value) {\n\tshould_intro = value;\n}\n\n/**\n * @param {Element} text\n * @param {string} value\n * @returns {void}\n */\nexport function set_text(text, value) {\n\t// For objects, we apply string coercion (which might make things like $state array references in the template reactive) before diffing\n\tvar str = value == null ? '' : typeof value === 'object' ? `${value}` : value;\n\t// prettier-ignore\n\tif (str !== (/** @type {any} */ (text)[TEXT_CACHE] ??= text.nodeValue)) {\n\t\t/** @type {any} */ (text)[TEXT_CACHE] = str;\n\t\ttext.nodeValue = `${str}`;\n\t}\n}\n\n/**\n * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component.\n * Transitions will play during the initial render unless the `intro` option is set to `false`.\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component\n * @param {MountOptions<Props>} options\n * @returns {Exports}\n */\nexport function mount(component, options) {\n\treturn _mount(component, options);\n}\n\n/**\n * Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component\n * @param {{} extends Props ? {\n * \t\ttarget: Document | Element | ShadowRoot;\n * \t\tprops?: Props;\n * \t\tevents?: Record<string, (e: any) => any>;\n * \tcontext?: Map<any, any>;\n * \t\tintro?: boolean;\n * \t\trecover?: boolean;\n *\t\ttransformError?: (error: unknown) => unknown;\n * \t} : {\n * \t\ttarget: Document | Element | ShadowRoot;\n * \t\tprops: Props;\n * \t\tevents?: Record<string, (e: any) => any>;\n * \tcontext?: Map<any, any>;\n * \t\tintro?: boolean;\n * \t\trecover?: boolean;\n *\t\ttransformError?: (error: unknown) => unknown;\n * \t}} options\n * @returns {Exports}\n */\nexport function hydrate(component, options) {\n\tinit_operations();\n\toptions.intro = options.intro ?? false;\n\tconst target = options.target;\n\tconst was_hydrating = hydrating;\n\tconst previous_hydrate_node = hydrate_node;\n\n\ttry {\n\t\tvar anchor = get_first_child(target);\n\n\t\twhile (\n\t\t\tanchor &&\n\t\t\t(anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */ (anchor).data !== HYDRATION_START)\n\t\t) {\n\t\t\tanchor = get_next_sibling(anchor);\n\t\t}\n\n\t\tif (!anchor) {\n\t\t\tthrow HYDRATION_ERROR;\n\t\t}\n\n\t\tset_hydrating(true);\n\t\tset_hydrate_node(/** @type {Comment} */ (anchor));\n\n\t\tconst instance = _mount(component, { ...options, anchor });\n\n\t\tset_hydrating(false);\n\n\t\treturn /** @type {Exports} */ (instance);\n\t} catch (error) {\n\t\t// re-throw Svelte errors - they are certainly not related to hydration\n\t\tif (\n\t\t\terror instanceof Error &&\n\t\t\terror.message.split('\\n').some((line) => line.startsWith('https://svelte.dev/e/'))\n\t\t) {\n\t\t\tthrow error;\n\t\t}\n\t\tif (error !== HYDRATION_ERROR) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn('Failed to hydrate: ', error);\n\t\t}\n\n\t\tif (options.recover === false) {\n\t\t\te.hydration_failed();\n\t\t}\n\n\t\t// If an error occurred above, the operations might not yet have been initialised.\n\t\tinit_operations();\n\t\tclear_text_content(target);\n\n\t\tset_hydrating(false);\n\t\treturn mount(component, options);\n\t} finally {\n\t\tset_hydrating(was_hydrating);\n\t\tset_hydrate_node(previous_hydrate_node);\n\t}\n}\n\n/** @type {Map<EventTarget, Map<string, number>>} */\nconst listeners = new Map();\n\n/**\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<any>> | Component<any>} Component\n * @param {MountOptions} options\n * @returns {Exports}\n */\nfunction _mount(\n\tComponent,\n\t{ target, anchor, props = {}, events, context, intro = true, transformError }\n) {\n\tinit_operations();\n\n\t/** @type {Exports} */\n\t// @ts-expect-error will be defined because the render effect runs synchronously\n\tvar component = undefined;\n\n\tvar unmount = component_root(() => {\n\t\tvar anchor_node = anchor ?? target.appendChild(create_text());\n\n\t\tboundary(\n\t\t\t/** @type {TemplateNode} */ (anchor_node),\n\t\t\t{\n\t\t\t\tpending: () => {}\n\t\t\t},\n\t\t\t(anchor_node) => {\n\t\t\t\tpush({});\n\t\t\t\tvar ctx = /** @type {ComponentContext} */ (component_context);\n\t\t\t\tif (context) ctx.c = context;\n\n\t\t\t\tif (events) {\n\t\t\t\t\t// We can't spread the object or else we'd lose the state proxy stuff, if it is one\n\t\t\t\t\t/** @type {any} */ (props).$$events = events;\n\t\t\t\t}\n\n\t\t\t\tif (hydrating) {\n\t\t\t\t\tassign_nodes(/** @type {TemplateNode} */ (anchor_node), null);\n\t\t\t\t}\n\n\t\t\t\tshould_intro = intro;\n\t\t\t\t// @ts-expect-error the public typings are not what the actual function looks like\n\t\t\t\tcomponent = Component(anchor_node, props) || mark_as_component();\n\t\t\t\tshould_intro = true;\n\n\t\t\t\tif (hydrating) {\n\t\t\t\t\t/** @type {Effect & { nodes: EffectNodes }} */ (active_effect).nodes.end = hydrate_node;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\thydrate_node === null ||\n\t\t\t\t\t\thydrate_node.nodeType !== COMMENT_NODE ||\n\t\t\t\t\t\t/** @type {Comment} */ (hydrate_node).data !== HYDRATION_END\n\t\t\t\t\t) {\n\t\t\t\t\t\tw.hydration_mismatch();\n\t\t\t\t\t\tthrow HYDRATION_ERROR;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tpop();\n\t\t\t},\n\t\t\ttransformError\n\t\t);\n\n\t\t// Setup event delegation _after_ component is mounted - if an error would happen during mount, it would otherwise not be cleaned up\n\t\t/** @type {Set<string>} */\n\t\tvar registered_events = new Set();\n\n\t\t/** @param {Array<string>} events */\n\t\tvar event_handle = (events) => {\n\t\t\tfor (var i = 0; i < events.length; i++) {\n\t\t\t\tvar event_name = events[i];\n\n\t\t\t\tif (registered_events.has(event_name)) continue;\n\t\t\t\tregistered_events.add(event_name);\n\n\t\t\t\tvar passive = is_passive_event(event_name);\n\n\t\t\t\t// Add the event listener to both the container and the document.\n\t\t\t\t// The container listener ensures we catch events from within in case\n\t\t\t\t// the outer content stops propagation of the event.\n\t\t\t\t//\n\t\t\t\t// The document listener ensures we catch events that originate from elements that were\n\t\t\t\t// manually moved outside of the container (e.g. via manual portals).\n\t\t\t\tfor (const node of [target, document]) {\n\t\t\t\t\tvar counts = listeners.get(node);\n\n\t\t\t\t\tif (counts === undefined) {\n\t\t\t\t\t\tcounts = new Map();\n\t\t\t\t\t\tlisteners.set(node, counts);\n\t\t\t\t\t}\n\n\t\t\t\t\tvar count = counts.get(event_name);\n\n\t\t\t\t\tif (count === undefined) {\n\t\t\t\t\t\tnode.addEventListener(event_name, handle_event_propagation, { passive });\n\t\t\t\t\t\tcounts.set(event_name, 1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcounts.set(event_name, count + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tevent_handle(array_from(all_registered_events));\n\t\troot_event_handles.add(event_handle);\n\n\t\treturn () => {\n\t\t\tfor (var event_name of registered_events) {\n\t\t\t\tfor (const node of [target, document]) {\n\t\t\t\t\tvar counts = /** @type {Map<string, number>} */ (listeners.get(node));\n\t\t\t\t\tvar count = /** @type {number} */ (counts.get(event_name));\n\n\t\t\t\t\tif (--count == 0) {\n\t\t\t\t\t\tnode.removeEventListener(event_name, handle_event_propagation);\n\t\t\t\t\t\tcounts.delete(event_name);\n\n\t\t\t\t\t\tif (counts.size === 0) {\n\t\t\t\t\t\t\tlisteners.delete(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcounts.set(event_name, count);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\troot_event_handles.delete(event_handle);\n\n\t\t\tif (anchor_node !== anchor) {\n\t\t\t\tanchor_node.parentNode?.removeChild(anchor_node);\n\t\t\t}\n\t\t};\n\t});\n\n\tmounted_components.set(component, unmount);\n\treturn component;\n}\n\n/**\n * References of the components that were mounted or hydrated.\n * Uses a `WeakMap` to avoid memory leaks.\n */\nlet mounted_components = new WeakMap();\n\n/**\n * Unmounts a component that was previously mounted using `mount` or `hydrate`.\n *\n * Since 5.13.0, if `options.outro` is `true`, [transitions](https://svelte.dev/docs/svelte/transition) will play before the component is removed from the DOM.\n *\n * Returns a `Promise` that resolves after transitions have completed if `options.outro` is true, or immediately otherwise (prior to 5.13.0, returns `void`).\n *\n * ```js\n * import { mount, unmount } from 'svelte';\n * import App from './App.svelte';\n *\n * const app = mount(App, { target: document.body });\n *\n * // later...\n * unmount(app, { outro: true });\n * ```\n * @param {Record<string, any>} component\n * @param {{ outro?: boolean }} [options]\n * @returns {Promise<void>}\n */\nexport function unmount(component, options) {\n\tconst fn = mounted_components.get(component);\n\n\tif (fn) {\n\t\tmounted_components.delete(component);\n\t\treturn fn(options);\n\t}\n\n\tif (DEV) {\n\t\tw.lifecycle_double_unmount();\n\t}\n\n\treturn Promise.resolve();\n}\n","/** @import { Effect, TemplateNode } from '#client' */\nimport { Batch, current_batch } from '../../reactivity/batch.js';\nimport {\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect,\n\tresume_effect\n} from '../../reactivity/effects.js';\nimport { HMR_ANCHOR } from '../../constants.js';\nimport { hydrate_node, hydrating } from '../hydration.js';\nimport { create_text, should_defer_append } from '../operations.js';\nimport { DEV } from 'esm-env';\n\n/**\n * @typedef {{ effect: Effect, fragment: DocumentFragment }} Branch\n */\n\n/**\n * @template Key\n */\nexport class BranchManager {\n\t/** @type {TemplateNode} */\n\tanchor;\n\n\t/** @type {Map<Batch, Key>} */\n\t#batches = new Map();\n\n\t/**\n\t * Map of keys to effects that are currently rendered in the DOM.\n\t * These effects are visible and actively part of the document tree.\n\t * Example:\n\t * ```\n\t * {#if condition}\n\t * \tfoo\n\t * {:else}\n\t * \tbar\n\t * {/if}\n\t * ```\n\t * Can result in the entries `true->Effect` and `false->Effect`\n\t * @type {Map<Key, Effect>}\n\t */\n\t#onscreen = new Map();\n\n\t/**\n\t * Similar to #onscreen with respect to the keys, but contains branches that are not yet\n\t * in the DOM, because their insertion is deferred.\n\t * @type {Map<Key, Branch>}\n\t */\n\t#offscreen = new Map();\n\n\t/**\n\t * Keys of effects that are currently outroing\n\t * @type {Set<Key>}\n\t */\n\t#outroing = new Set();\n\n\t/**\n\t * Whether to pause (i.e. outro) on change, or destroy immediately.\n\t * This is necessary for `<svelte:element>`\n\t */\n\t#transition = true;\n\n\t/**\n\t * @param {TemplateNode} anchor\n\t * @param {boolean} transition\n\t */\n\tconstructor(anchor, transition = true) {\n\t\tthis.anchor = anchor;\n\t\tthis.#transition = transition;\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#commit = (batch) => {\n\t\t// if this batch was made obsolete, bail\n\t\tif (!this.#batches.has(batch)) return;\n\n\t\tvar key = /** @type {Key} */ (this.#batches.get(batch));\n\n\t\tvar onscreen = this.#onscreen.get(key);\n\n\t\tif (onscreen) {\n\t\t\t// effect is already in the DOM — abort any current outro\n\t\t\tresume_effect(onscreen);\n\t\t\tthis.#outroing.delete(key);\n\t\t} else {\n\t\t\t// effect is currently offscreen. put it in the DOM\n\t\t\tvar offscreen = this.#offscreen.get(key);\n\n\t\t\tif (offscreen) {\n\t\t\t\t// effect could have been outro'ed before through a prior batch — resume if necessary\n\t\t\t\tresume_effect(offscreen.effect);\n\t\t\t\tthis.#onscreen.set(key, offscreen.effect);\n\t\t\t\tthis.#offscreen.delete(key);\n\n\t\t\t\tif (DEV) {\n\t\t\t\t\t// Tell hmr.js about the anchor it should use for updates,\n\t\t\t\t\t// since the initial one will be removed\n\t\t\t\t\t/** @type {any} */ (offscreen.fragment.lastChild)[HMR_ANCHOR] = this.anchor;\n\t\t\t\t}\n\n\t\t\t\t// remove the anchor...\n\t\t\t\t/** @type {TemplateNode} */ (offscreen.fragment.lastChild).remove();\n\n\t\t\t\t// ...and append the fragment\n\t\t\t\tthis.anchor.before(offscreen.fragment);\n\t\t\t\tonscreen = offscreen.effect;\n\t\t\t}\n\t\t}\n\n\t\tfor (const [b, k] of this.#batches) {\n\t\t\tthis.#batches.delete(b);\n\n\t\t\tif (b === batch) {\n\t\t\t\t// keep values for newer batches\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst offscreen = this.#offscreen.get(k);\n\n\t\t\tif (offscreen) {\n\t\t\t\t// for older batches, destroy offscreen effects\n\t\t\t\t// as they will never be committed\n\t\t\t\tdestroy_effect(offscreen.effect);\n\t\t\t\tthis.#offscreen.delete(k);\n\t\t\t}\n\t\t}\n\n\t\t// outro/destroy all onscreen effects...\n\t\tfor (const [k, effect] of this.#onscreen) {\n\t\t\t// ...except the one that was just committed\n\t\t\t// or those that are already outroing (else the transition is aborted and the effect destroyed right away)\n\t\t\tif (k === key || this.#outroing.has(k)) continue;\n\n\t\t\tconst on_destroy = () => {\n\t\t\t\tconst keys = Array.from(this.#batches.values());\n\n\t\t\t\tif (keys.includes(k)) {\n\t\t\t\t\t// keep the effect offscreen, as another batch will need it\n\t\t\t\t\tvar fragment = document.createDocumentFragment();\n\t\t\t\t\tmove_effect(effect, fragment);\n\n\t\t\t\t\tfragment.append(create_text()); // TODO can we avoid this?\n\n\t\t\t\t\tthis.#offscreen.set(k, { effect, fragment });\n\t\t\t\t} else {\n\t\t\t\t\tdestroy_effect(effect);\n\t\t\t\t}\n\n\t\t\t\tthis.#outroing.delete(k);\n\t\t\t\tthis.#onscreen.delete(k);\n\t\t\t};\n\n\t\t\tif (this.#transition || !onscreen) {\n\t\t\t\tthis.#outroing.add(k);\n\t\t\t\tpause_effect(effect, on_destroy, false);\n\t\t\t} else {\n\t\t\t\ton_destroy();\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#discard = (batch) => {\n\t\tthis.#batches.delete(batch);\n\n\t\tconst keys = Array.from(this.#batches.values());\n\n\t\tfor (const [k, branch] of this.#offscreen) {\n\t\t\tif (!keys.includes(k)) {\n\t\t\t\tdestroy_effect(branch.effect);\n\t\t\t\tthis.#offscreen.delete(k);\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t *\n\t * @param {any} key\n\t * @param {null | ((target: TemplateNode) => void)} fn\n\t */\n\tensure(key, fn) {\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\tvar defer = should_defer_append();\n\n\t\tif (fn && !this.#onscreen.has(key) && !this.#offscreen.has(key)) {\n\t\t\tif (defer) {\n\t\t\t\tvar fragment = document.createDocumentFragment();\n\t\t\t\tvar target = create_text();\n\n\t\t\t\tfragment.append(target);\n\n\t\t\t\tthis.#offscreen.set(key, {\n\t\t\t\t\teffect: branch(() => fn(target)),\n\t\t\t\t\tfragment\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.#onscreen.set(\n\t\t\t\t\tkey,\n\t\t\t\t\tbranch(() => fn(this.anchor))\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tthis.#batches.set(batch, key);\n\n\t\tif (defer) {\n\t\t\tfor (const [k, effect] of this.#onscreen) {\n\t\t\t\tif (k === key) {\n\t\t\t\t\tbatch.unskip_effect(effect);\n\t\t\t\t} else {\n\t\t\t\t\tbatch.skip_effect(effect);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [k, branch] of this.#offscreen) {\n\t\t\t\tif (k === key) {\n\t\t\t\t\tbatch.unskip_effect(branch.effect);\n\t\t\t\t} else {\n\t\t\t\t\tbatch.skip_effect(branch.effect);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbatch.oncommit(this.#commit);\n\t\t\tbatch.ondiscard(this.#discard);\n\t\t} else {\n\t\t\tif (hydrating) {\n\t\t\t\tthis.anchor = hydrate_node;\n\t\t\t}\n\n\t\t\tthis.#commit(batch);\n\t\t}\n\t}\n}\n","/** @import { TemplateNode } from '#client' */\nimport { EFFECT_TRANSPARENT } from '#client/constants';\nimport {\n\thydrate_next,\n\thydrating,\n\tread_hydration_instruction,\n\tskip_nodes,\n\tset_hydrate_node,\n\tset_hydrating,\n\thydrate_node\n} from '../hydration.js';\nimport { block } from '../../reactivity/effects.js';\nimport { BranchManager } from './branches.js';\n\n/**\n * @param {TemplateNode} node\n * @param {(branch: (fn: (anchor: Node) => void, key?: number | false) => void) => void} fn\n * @param {boolean} [elseif] True if this is an `{:else if ...}` block rather than an `{#if ...}`, as that affects which transitions are considered 'local'\n * @returns {void}\n */\nexport function if_block(node, fn, elseif = false) {\n\t/** @type {TemplateNode | undefined} */\n\tvar marker;\n\tif (hydrating) {\n\t\tmarker = hydrate_node;\n\t\thydrate_next();\n\t}\n\n\tvar branches = new BranchManager(node);\n\tvar flags = elseif ? EFFECT_TRANSPARENT : 0;\n\n\t/**\n\t * @param {number | false} key\n\t * @param {null | ((anchor: Node) => void)} fn\n\t */\n\tfunction update_branch(key, fn) {\n\t\tif (hydrating) {\n\t\t\tvar data = read_hydration_instruction(/** @type {TemplateNode} */ (marker));\n\n\t\t\t// \"[n\" = branch n, \"[-1\" = else\n\t\t\tif (key !== parseInt(data.substring(1))) {\n\t\t\t\t// Hydration mismatch: remove everything inside the anchor and start fresh.\n\t\t\t\t// This could happen with `{#if browser}...{/if}`, for example\n\t\t\t\tvar anchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tbranches.anchor = anchor;\n\n\t\t\t\tset_hydrating(false);\n\t\t\t\tbranches.ensure(key, fn);\n\t\t\t\tset_hydrating(true);\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tbranches.ensure(key, fn);\n\t}\n\n\tblock(() => {\n\t\tvar has_branch = false;\n\n\t\tfn((fn, key = 0) => {\n\t\t\thas_branch = true;\n\t\t\tupdate_branch(key, fn);\n\t\t});\n\n\t\tif (!has_branch) {\n\t\t\tupdate_branch(-1, null);\n\t\t}\n\t}, flags);\n}\n","/** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, Source, TemplateNode, TransitionManager, Value } from '#client' */\n/** @import { Batch } from '../../reactivity/batch.js'; */\nimport {\n\tEACH_INDEX_REACTIVE,\n\tEACH_IS_ANIMATED,\n\tEACH_IS_CONTROLLED,\n\tEACH_ITEM_IMMUTABLE,\n\tEACH_ITEM_REACTIVE,\n\tHYDRATION_END,\n\tHYDRATION_START_ELSE\n} from '../../../../constants.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tread_hydration_instruction,\n\tskip_nodes,\n\tset_hydrate_node,\n\tset_hydrating\n} from '../hydration.js';\nimport {\n\tclear_text_content,\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tshould_defer_append\n} from '../operations.js';\nimport {\n\tblock,\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect,\n\tresume_effect\n} from '../../reactivity/effects.js';\nimport { source, mutable_source, internal_set } from '../../reactivity/sources.js';\nimport { array_from, is_array } from '../../../shared/utils.js';\nimport { BRANCH_EFFECT, COMMENT_NODE, DESTROYED, EFFECT_OFFSCREEN, INERT } from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { get } from '../../runtime.js';\nimport { DEV } from 'esm-env';\nimport { derived_safe_equal } from '../../reactivity/deriveds.js';\nimport { current_batch } from '../../reactivity/batch.js';\nimport * as e from '../../errors.js';\nimport { tag } from '../../dev/tracing.js';\n\n// When making substantive changes to this file, validate them with the each block stress test:\n// https://svelte.dev/playground/1972b2cf46564476ad8c8c6405b23b7b\n// This test also exists in this repo, as `packages/svelte/tests/manual/each-stress-test`\n\n/**\n * @param {any} _\n * @param {number} i\n */\nexport function index(_, i) {\n\treturn i;\n}\n\n/**\n * Pause multiple effects simultaneously, and coordinate their\n * subsequent destruction. Used in each blocks\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {null | Node} controlled_anchor\n */\nfunction pause_effects(state, to_destroy, controlled_anchor) {\n\t/** @type {TransitionManager[]} */\n\tvar transitions = [];\n\tvar length = to_destroy.length;\n\n\t/** @type {EachOutroGroup} */\n\tvar group;\n\tvar remaining = to_destroy.length;\n\n\tfor (var i = 0; i < length; i++) {\n\t\tlet effect = to_destroy[i];\n\n\t\tpause_effect(\n\t\t\teffect,\n\t\t\t() => {\n\t\t\t\tif (group) {\n\t\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\t\tgroup.done.add(effect);\n\n\t\t\t\t\tif (group.pending.size === 0) {\n\t\t\t\t\t\tvar groups = /** @type {Set<EachOutroGroup>} */ (state.outrogroups);\n\n\t\t\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\t\t\tgroups.delete(group);\n\n\t\t\t\t\t\tif (groups.size === 0) {\n\t\t\t\t\t\t\tstate.outrogroups = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tremaining -= 1;\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse\n\t\t);\n\t}\n\n\tif (remaining === 0) {\n\t\t// If we're in a controlled each block (i.e. the block is the only child of an\n\t\t// element), and we are removing all items, _and_ there are no out transitions,\n\t\t// we can use the fast path — emptying the element and replacing the anchor.\n\t\t// Skip the fast path when another batch is still pending on this each block:\n\t\t// that batch's keys still reference EachItems in `state.items`, which\n\t\t// `destroy_effects` needs to preserve offscreen (see #18610).\n\t\tvar fast_path =\n\t\t\ttransitions.length === 0 && controlled_anchor !== null && state.pending.size === 0;\n\n\t\tif (fast_path) {\n\t\t\tvar anchor = /** @type {Element} */ (controlled_anchor);\n\t\t\tvar parent_node = /** @type {Element} */ (anchor.parentNode);\n\n\t\t\tclear_text_content(parent_node);\n\t\t\tparent_node.append(anchor);\n\n\t\t\tstate.items.clear();\n\t\t}\n\n\t\tdestroy_effects(state, to_destroy, !fast_path);\n\t} else {\n\t\tgroup = {\n\t\t\tpending: new Set(to_destroy),\n\t\t\tdone: new Set()\n\t\t};\n\n\t\t(state.outrogroups ??= new Set()).add(group);\n\t}\n}\n\n/**\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {boolean} remove_dom\n */\nfunction destroy_effects(state, to_destroy, remove_dom = true) {\n\t/** @type {Set<Effect> | undefined} */\n\tvar preserved_effects;\n\n\t// The loop-in-a-loop isn't ideal, but we should only hit this in relatively rare cases\n\tif (state.pending.size > 0) {\n\t\tpreserved_effects = new Set();\n\n\t\tfor (const keys of state.pending.values()) {\n\t\t\tfor (const key of keys) {\n\t\t\t\tpreserved_effects.add(/** @type {EachItem} */ (state.items.get(key)).e);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (var i = 0; i < to_destroy.length; i++) {\n\t\tvar e = to_destroy[i];\n\n\t\tif (preserved_effects?.has(e)) {\n\t\t\te.f |= EFFECT_OFFSCREEN;\n\n\t\t\tconst fragment = document.createDocumentFragment();\n\t\t\tmove_effect(e, fragment);\n\t\t} else {\n\t\t\tdestroy_effect(to_destroy[i], remove_dom);\n\t\t}\n\t}\n}\n\n/** @type {TemplateNode} */\nvar offscreen_anchor;\n\n/**\n * @template V\n * @param {Element | Comment} node The next sibling node, or the parent node if this is a 'controlled' block\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @param {(value: V, index: number) => any} get_key\n * @param {(anchor: Node, item: MaybeSource<V>, index: MaybeSource<number>) => void} render_fn\n * @param {null | ((anchor: Node) => void)} fallback_fn\n * @returns {void}\n */\nexport function each(node, flags, get_collection, get_key, render_fn, fallback_fn = null) {\n\tvar anchor = node;\n\n\t/** @type {Map<any, EachItem>} */\n\tvar items = new Map();\n\n\tvar is_controlled = (flags & EACH_IS_CONTROLLED) !== 0;\n\n\tif (is_controlled) {\n\t\tvar parent_node = /** @type {Element} */ (node);\n\n\t\tanchor = hydrating\n\t\t\t? set_hydrate_node(get_first_child(parent_node))\n\t\t\t: parent_node.appendChild(create_text());\n\t}\n\n\tif (hydrating) {\n\t\thydrate_next();\n\t}\n\n\t/** @type {Effect | null} */\n\tvar fallback = null;\n\n\t// TODO: ideally we could use derived for runes mode but because of the ability\n\t// to use a store which can be mutated, we can't do that here as mutating a store\n\t// will still result in the collection array being the same from the store\n\tvar each_array = derived_safe_equal(() => {\n\t\tvar collection = get_collection();\n\n\t\treturn /** @type {V[]} */ (\n\t\t\tis_array(collection) ? collection : collection == null ? [] : array_from(collection)\n\t\t);\n\t});\n\n\tif (DEV) {\n\t\ttag(each_array, '{#each ...}');\n\t}\n\n\t/** @type {V[]} */\n\tvar array;\n\n\t/** @type {Map<Batch, Set<any>>} */\n\tvar pending = new Map();\n\n\tvar first_run = true;\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction commit(batch) {\n\t\tif ((state.effect.f & DESTROYED) !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tstate.pending.delete(batch);\n\n\t\tstate.fallback = fallback;\n\t\treconcile(state, array, anchor, flags, get_key);\n\n\t\tif (fallback !== null) {\n\t\t\tif (array.length === 0) {\n\t\t\t\tif ((fallback.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\t\tresume_effect(fallback);\n\t\t\t\t} else {\n\t\t\t\t\tfallback.f ^= EFFECT_OFFSCREEN;\n\t\t\t\t\tmove(fallback, null, anchor);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpause_effect(fallback, () => {\n\t\t\t\t\t// TODO only null out if no pending batch needs it,\n\t\t\t\t\t// otherwise re-add `fallback.fragment` and move the\n\t\t\t\t\t// effect into it\n\t\t\t\t\tfallback = null;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction discard(batch) {\n\t\tstate.pending.delete(batch);\n\t}\n\n\tvar effect = block(() => {\n\t\tarray = /** @type {V[]} */ (get(each_array));\n\t\tvar length = array.length;\n\n\t\t/** `true` if there was a hydration mismatch. Needs to be a `let` or else it isn't treeshaken out */\n\t\tlet mismatch = false;\n\n\t\tif (hydrating) {\n\t\t\tvar is_else = read_hydration_instruction(anchor) === HYDRATION_START_ELSE;\n\n\t\t\tif (is_else !== (length === 0)) {\n\t\t\t\t// hydration mismatch — remove the server-rendered DOM and start over\n\t\t\t\tanchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tset_hydrating(false);\n\t\t\t\tmismatch = true;\n\t\t\t}\n\t\t}\n\n\t\tvar keys = new Set();\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\tvar defer = should_defer_append();\n\n\t\tfor (var index = 0; index < length; index += 1) {\n\t\t\tif (\n\t\t\t\thydrating &&\n\t\t\t\thydrate_node.nodeType === COMMENT_NODE &&\n\t\t\t\t/** @type {Comment} */ (hydrate_node).data === HYDRATION_END\n\t\t\t) {\n\t\t\t\t// The server rendered fewer items than expected,\n\t\t\t\t// so break out and continue appending non-hydrated items\n\t\t\t\tanchor = /** @type {Comment} */ (hydrate_node);\n\t\t\t\tmismatch = true;\n\t\t\t\tset_hydrating(false);\n\t\t\t}\n\n\t\t\tvar value = array[index];\n\t\t\tvar key = get_key(value, index);\n\n\t\t\tif (DEV) {\n\t\t\t\t// Check that the key function is idempotent (returns the same value when called twice)\n\t\t\t\tvar key_again = get_key(value, index);\n\t\t\t\tif (key !== key_again) {\n\t\t\t\t\te.each_key_volatile(String(index), String(key), String(key_again));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar item = first_run ? null : items.get(key);\n\n\t\t\tif (item) {\n\t\t\t\t// update before reconciliation, to trigger any async updates\n\t\t\t\tif (item.v) internal_set(item.v, value);\n\t\t\t\tif (item.i) internal_set(item.i, index);\n\n\t\t\t\tif (defer) {\n\t\t\t\t\tbatch.unskip_effect(item.e);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\titem = create_item(\n\t\t\t\t\titems,\n\t\t\t\t\tfirst_run ? anchor : (offscreen_anchor ??= create_text()),\n\t\t\t\t\tvalue,\n\t\t\t\t\tkey,\n\t\t\t\t\tindex,\n\t\t\t\t\trender_fn,\n\t\t\t\t\tflags,\n\t\t\t\t\tget_collection\n\t\t\t\t);\n\n\t\t\t\tif (!first_run) {\n\t\t\t\t\titem.e.f |= EFFECT_OFFSCREEN;\n\t\t\t\t}\n\n\t\t\t\titems.set(key, item);\n\t\t\t}\n\n\t\t\tkeys.add(key);\n\t\t}\n\n\t\tif (length === 0 && fallback_fn && !fallback) {\n\t\t\tif (first_run) {\n\t\t\t\tfallback = branch(() => fallback_fn(anchor));\n\t\t\t} else {\n\t\t\t\tfallback = branch(() => fallback_fn((offscreen_anchor ??= create_text())));\n\t\t\t\tfallback.f |= EFFECT_OFFSCREEN;\n\t\t\t}\n\t\t}\n\n\t\tif (length > keys.size) {\n\t\t\tif (DEV) {\n\t\t\t\tvalidate_each_keys(array, get_key);\n\t\t\t} else {\n\t\t\t\t// in prod, the additional information isn't printed, so don't bother computing it\n\t\t\t\te.each_key_duplicate('', '', '');\n\t\t\t}\n\t\t}\n\n\t\t// remove excess nodes\n\t\tif (hydrating && length > 0) {\n\t\t\tset_hydrate_node(skip_nodes());\n\t\t}\n\n\t\tif (!first_run) {\n\t\t\tpending.set(batch, keys);\n\n\t\t\tif (defer) {\n\t\t\t\tfor (const [key, item] of items) {\n\t\t\t\t\tif (!keys.has(key)) {\n\t\t\t\t\t\tbatch.skip_effect(item.e);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbatch.oncommit(commit);\n\t\t\t\tbatch.ondiscard(discard);\n\t\t\t} else {\n\t\t\t\tcommit(batch);\n\t\t\t}\n\t\t}\n\n\t\tif (mismatch) {\n\t\t\t// continue in hydration mode\n\t\t\tset_hydrating(true);\n\t\t}\n\n\t\t// When we mount the each block for the first time, the collection won't be\n\t\t// connected to this effect as the effect hasn't finished running yet and its deps\n\t\t// won't be assigned. However, it's possible that when reconciling the each block\n\t\t// that a mutation occurred and it's made the collection MAYBE_DIRTY, so reading the\n\t\t// collection again can provide consistency to the reactive graph again as the deriveds\n\t\t// will now be `CLEAN`.\n\t\tget(each_array);\n\t});\n\n\t/** @type {EachState} */\n\tvar state = { effect, flags, items, pending, outrogroups: null, fallback };\n\n\tfirst_run = false;\n\n\tif (hydrating) {\n\t\tanchor = hydrate_node;\n\t}\n}\n\n/**\n * Skip past any non-branch effects (which could be created with `createSubscriber`, for example) to find the next branch effect\n * @param {Effect | null} effect\n * @returns {Effect | null}\n */\nfunction skip_to_branch(effect) {\n\twhile (effect !== null && (effect.f & BRANCH_EFFECT) === 0) {\n\t\teffect = effect.next;\n\t}\n\treturn effect;\n}\n\n/**\n * Add, remove, or reorder items output by an each block as its input changes\n * @template V\n * @param {EachState} state\n * @param {Array<V>} array\n * @param {Element | Comment | Text} anchor\n * @param {number} flags\n * @param {(value: V, index: number) => any} get_key\n * @returns {void}\n */\nfunction reconcile(state, array, anchor, flags, get_key) {\n\tvar is_animated = (flags & EACH_IS_ANIMATED) !== 0;\n\n\tvar length = array.length;\n\tvar items = state.items;\n\tvar current = skip_to_branch(state.effect.first);\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar seen;\n\n\t/** @type {Effect | null} */\n\tvar prev = null;\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar to_animate;\n\n\t/** @type {Effect[]} */\n\tvar matched = [];\n\n\t/** @type {Effect[]} */\n\tvar stashed = [];\n\n\t/** @type {V} */\n\tvar value;\n\n\t/** @type {any} */\n\tvar key;\n\n\t/** @type {Effect | undefined} */\n\tvar effect;\n\n\t/** @type {number} */\n\tvar i;\n\n\tif (is_animated) {\n\t\tfor (i = 0; i < length; i += 1) {\n\t\t\tvalue = array[i];\n\t\t\tkey = get_key(value, i);\n\t\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\t\t// offscreen == coming in now, no animation in that case,\n\t\t\t// else this would happen https://github.com/sveltejs/svelte/issues/17181\n\t\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\teffect.nodes?.a?.measure();\n\t\t\t\t(to_animate ??= new Set()).add(effect);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (i = 0; i < length; i += 1) {\n\t\tvalue = array[i];\n\t\tkey = get_key(value, i);\n\n\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\tif (state.outrogroups !== null) {\n\t\t\tfor (const group of state.outrogroups) {\n\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\tgroup.done.delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & INERT) !== 0) {\n\t\t\tresume_effect(effect);\n\t\t\tif (is_animated) {\n\t\t\t\teffect.nodes?.a?.unfix();\n\t\t\t\t(to_animate ??= new Set()).delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) !== 0) {\n\t\t\teffect.f ^= EFFECT_OFFSCREEN;\n\n\t\t\tif (effect === current) {\n\t\t\t\tmove(effect, null, anchor);\n\t\t\t} else {\n\t\t\t\tvar next = prev ? prev.next : current;\n\n\t\t\t\tif (effect === state.effect.last) {\n\t\t\t\t\tstate.effect.last = effect.prev;\n\t\t\t\t}\n\n\t\t\t\tif (effect.prev) effect.prev.next = effect.next;\n\t\t\t\tif (effect.next) effect.next.prev = effect.prev;\n\t\t\t\tlink(state, prev, effect);\n\t\t\t\tlink(state, effect, next);\n\n\t\t\t\tmove(effect, next, anchor);\n\t\t\t\tprev = effect;\n\n\t\t\t\tmatched = [];\n\t\t\t\tstashed = [];\n\n\t\t\t\tcurrent = skip_to_branch(prev.next);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (effect !== current) {\n\t\t\tif (seen !== undefined && seen.has(effect)) {\n\t\t\t\tif (matched.length < stashed.length) {\n\t\t\t\t\t// more efficient to move later items to the front\n\t\t\t\t\tvar start = stashed[0];\n\t\t\t\t\tvar j;\n\n\t\t\t\t\tprev = start.prev;\n\n\t\t\t\t\tvar a = matched[0];\n\t\t\t\t\tvar b = matched[matched.length - 1];\n\n\t\t\t\t\tfor (j = 0; j < matched.length; j += 1) {\n\t\t\t\t\t\tmove(matched[j], start, anchor);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (j = 0; j < stashed.length; j += 1) {\n\t\t\t\t\t\tseen.delete(stashed[j]);\n\t\t\t\t\t}\n\n\t\t\t\t\tlink(state, a.prev, b.next);\n\t\t\t\t\tlink(state, prev, a);\n\t\t\t\t\tlink(state, b, start);\n\n\t\t\t\t\tcurrent = start;\n\t\t\t\t\tprev = b;\n\t\t\t\t\ti -= 1;\n\n\t\t\t\t\tmatched = [];\n\t\t\t\t\tstashed = [];\n\t\t\t\t} else {\n\t\t\t\t\t// more efficient to move earlier items to the back\n\t\t\t\t\tseen.delete(effect);\n\t\t\t\t\tmove(effect, current, anchor);\n\n\t\t\t\t\tlink(state, effect.prev, effect.next);\n\t\t\t\t\tlink(state, effect, prev === null ? state.effect.first : prev.next);\n\t\t\t\t\tlink(state, prev, effect);\n\n\t\t\t\t\tprev = effect;\n\t\t\t\t}\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tmatched = [];\n\t\t\tstashed = [];\n\n\t\t\twhile (current !== null && current !== effect) {\n\t\t\t\t(seen ??= new Set()).add(current);\n\t\t\t\tstashed.push(current);\n\t\t\t\tcurrent = skip_to_branch(current.next);\n\t\t\t}\n\n\t\t\tif (current === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\tmatched.push(effect);\n\t\t}\n\n\t\tprev = effect;\n\t\tcurrent = skip_to_branch(effect.next);\n\t}\n\n\tif (state.outrogroups !== null) {\n\t\tfor (const group of state.outrogroups) {\n\t\t\tif (group.pending.size === 0) {\n\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\tstate.outrogroups?.delete(group);\n\t\t\t}\n\t\t}\n\n\t\tif (state.outrogroups.size === 0) {\n\t\t\tstate.outrogroups = null;\n\t\t}\n\t}\n\n\tif (current !== null || seen !== undefined) {\n\t\t/** @type {Effect[]} */\n\t\tvar to_destroy = [];\n\n\t\tif (seen !== undefined) {\n\t\t\tfor (effect of seen) {\n\t\t\t\tif ((effect.f & INERT) === 0) {\n\t\t\t\t\tto_destroy.push(effect);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\twhile (current !== null) {\n\t\t\t// If the each block isn't inert, then inert effects are currently outroing and will be removed once the transition is finished\n\t\t\tif ((current.f & INERT) === 0 && current !== state.fallback) {\n\t\t\t\tto_destroy.push(current);\n\t\t\t}\n\n\t\t\tcurrent = skip_to_branch(current.next);\n\t\t}\n\n\t\tvar destroy_length = to_destroy.length;\n\n\t\tif (destroy_length > 0) {\n\t\t\tvar controlled_anchor = (flags & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null;\n\n\t\t\tif (is_animated) {\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.measure();\n\t\t\t\t}\n\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.fix();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpause_effects(state, to_destroy, controlled_anchor);\n\t\t}\n\t}\n\n\tif (is_animated) {\n\t\tqueue_micro_task(() => {\n\t\t\tif (to_animate === undefined) return;\n\t\t\tfor (effect of to_animate) {\n\t\t\t\teffect.nodes?.a?.apply();\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @template V\n * @param {Map<any, EachItem>} items\n * @param {Node} anchor\n * @param {V} value\n * @param {unknown} key\n * @param {number} index\n * @param {(anchor: Node, item: V | Source<V>, index: number | Value<number>, collection: () => V[]) => void} render_fn\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @returns {EachItem}\n */\nfunction create_item(items, anchor, value, key, index, render_fn, flags, get_collection) {\n\tvar v =\n\t\t(flags & EACH_ITEM_REACTIVE) !== 0\n\t\t\t? (flags & EACH_ITEM_IMMUTABLE) === 0\n\t\t\t\t? mutable_source(value, false, false)\n\t\t\t\t: source(value)\n\t\t\t: null;\n\n\tvar i = (flags & EACH_INDEX_REACTIVE) !== 0 ? source(index) : null;\n\n\tif (DEV && v) {\n\t\t// For tracing purposes, we need to link the source signal we create with the\n\t\t// collection + index so that tracing works as intended\n\t\tv.trace = () => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n\t\t\tget_collection()[i?.v ?? index];\n\t\t};\n\t}\n\n\treturn {\n\t\tv,\n\t\ti,\n\t\te: branch(() => {\n\t\t\trender_fn(anchor, v ?? value, i ?? index, get_collection);\n\n\t\t\treturn () => {\n\t\t\t\titems.delete(key);\n\t\t\t};\n\t\t})\n\t};\n}\n\n/**\n * @param {Effect} effect\n * @param {Effect | null} next\n * @param {Text | Element | Comment} anchor\n */\nfunction move(effect, next, anchor) {\n\tif (!effect.nodes) return;\n\n\tvar node = effect.nodes.start;\n\tvar end = effect.nodes.end;\n\n\tvar dest =\n\t\tnext && (next.f & EFFECT_OFFSCREEN) === 0\n\t\t\t? /** @type {EffectNodes} */ (next.nodes).start\n\t\t\t: anchor;\n\n\twhile (node !== null) {\n\t\tvar next_node = /** @type {TemplateNode} */ (get_next_sibling(node));\n\t\tdest.before(node);\n\n\t\tif (node === end) {\n\t\t\treturn;\n\t\t}\n\n\t\tnode = next_node;\n\t}\n}\n\n/**\n * @param {EachState} state\n * @param {Effect | null} prev\n * @param {Effect | null} next\n */\nfunction link(state, prev, next) {\n\tif (prev === null) {\n\t\tstate.effect.first = next;\n\t} else {\n\t\tprev.next = next;\n\t}\n\n\tif (next === null) {\n\t\tstate.effect.last = prev;\n\t} else {\n\t\tnext.prev = prev;\n\t}\n}\n\n/**\n * @param {Array<any>} array\n * @param {(item: any, index: number) => string} key_fn\n * @returns {void}\n */\nfunction validate_each_keys(array, key_fn) {\n\tconst keys = new Map();\n\tconst length = array.length;\n\n\tfor (let i = 0; i < length; i++) {\n\t\tconst key = key_fn(array[i], i);\n\n\t\tif (keys.has(key)) {\n\t\t\tconst a = String(keys.get(key));\n\t\t\tconst b = String(i);\n\n\t\t\t/** @type {string | null} */\n\t\t\tlet k = String(key);\n\t\t\tif (k.startsWith('[object ')) k = null;\n\n\t\t\te.each_key_duplicate(a, b, k);\n\t\t}\n\n\t\tkeys.set(key, i);\n\t}\n}\n","import { escape_html } from '../../escaping.js';\nimport { clsx as _clsx } from 'clsx';\nimport { has_own_property } from './utils.js';\n\n/**\n * `<div translate={false}>` should be rendered as `<div translate=\"no\">` and _not_\n * `<div translate=\"false\">`, which is equivalent to `<div translate=\"yes\">`. There\n * may be other odd cases that need to be added to this list in future\n * @type {Record<string, Map<any, string>>}\n */\nconst replacements = {\n\ttranslate: new Map([\n\t\t[true, 'yes'],\n\t\t[false, 'no']\n\t])\n};\n\n/**\n * @template V\n * @param {string} name\n * @param {V} value\n * @param {boolean} [is_boolean]\n * @returns {string}\n */\nexport function attr(name, value, is_boolean = false) {\n\t// attribute hidden for values other than \"until-found\" behaves like a boolean attribute\n\tif (name === 'hidden' && value !== 'until-found') {\n\t\tis_boolean = true;\n\t}\n\t// `''` is a present boolean attribute, as it is in markup and on the client\n\tif (value == null || (is_boolean && !value && value !== '')) return '';\n\tconst normalized =\n\t\t(has_own_property.call(replacements, name) && replacements[name].get(value)) || value;\n\tconst assignment = is_boolean ? `=\"\"` : `=\"${escape_html(normalized, true)}\"`;\n\treturn ` ${name}${assignment}`;\n}\n\n/**\n * Small wrapper around clsx to preserve Svelte's (weird) handling of falsy values.\n * TODO Svelte 6 revisit this, and likely turn all falsy values into the empty string (what clsx also does)\n * @param {any} value\n */\nexport function clsx(value) {\n\tif (typeof value === 'object') {\n\t\treturn _clsx(value);\n\t} else {\n\t\treturn value ?? '';\n\t}\n}\n\nconst whitespace = [...' \\t\\n\\r\\f\\u00a0\\u000b\\ufeff'];\n\n/**\n * @param {any} value\n * @param {string | null} [hash]\n * @param {Record<string, boolean>} [directives]\n * @returns {string | null}\n */\nexport function to_class(value, hash, directives) {\n\tvar classname = value == null ? '' : '' + value;\n\n\tif (hash) {\n\t\tclassname = classname ? classname + ' ' + hash : hash;\n\t}\n\n\tif (directives) {\n\t\tfor (var key of Object.keys(directives)) {\n\t\t\tif (directives[key]) {\n\t\t\t\tclassname = classname ? classname + ' ' + key : key;\n\t\t\t} else if (classname.length) {\n\t\t\t\tvar len = key.length;\n\t\t\t\tvar a = 0;\n\n\t\t\t\twhile ((a = classname.indexOf(key, a)) >= 0) {\n\t\t\t\t\tvar b = a + len;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t(a === 0 || whitespace.includes(classname[a - 1])) &&\n\t\t\t\t\t\t(b === classname.length || whitespace.includes(classname[b]))\n\t\t\t\t\t) {\n\t\t\t\t\t\tclassname = (a === 0 ? '' : classname.substring(0, a)) + classname.substring(b + 1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ta = b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn classname === '' ? null : classname;\n}\n\n/**\n *\n * @param {Record<string,any>} styles\n * @param {boolean} important\n */\nfunction append_styles(styles, important = false) {\n\tvar separator = important ? ' !important;' : ';';\n\tvar css = '';\n\n\tfor (var key of Object.keys(styles)) {\n\t\tvar value = styles[key];\n\t\tif (value != null && value !== '') {\n\t\t\tcss += ' ' + key + ': ' + value + separator;\n\t\t}\n\t}\n\n\treturn css;\n}\n\n/**\n * @param {string} name\n * @returns {string}\n */\nfunction to_css_name(name) {\n\tif (name[0] !== '-' || name[1] !== '-') {\n\t\treturn name.toLowerCase();\n\t}\n\treturn name;\n}\n\n/**\n * @param {any} value\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [styles]\n * @returns {string | null}\n */\nexport function to_style(value, styles) {\n\tif (styles) {\n\t\tvar new_style = '';\n\n\t\t/** @type {Record<string,any> | undefined} */\n\t\tvar normal_styles;\n\n\t\t/** @type {Record<string,any> | undefined} */\n\t\tvar important_styles;\n\n\t\tif (Array.isArray(styles)) {\n\t\t\tnormal_styles = styles[0];\n\t\t\timportant_styles = styles[1];\n\t\t} else {\n\t\t\tnormal_styles = styles;\n\t\t}\n\n\t\tif (value) {\n\t\t\t// strip comments; surrounding whitespace is handled by the trims below (which is much faster than doing it through regex)\n\t\t\tvalue = String(value)\n\t\t\t\t.replaceAll(/\\/\\*.*?\\*\\//g, '')\n\t\t\t\t.trim();\n\n\t\t\t/** @type {boolean | '\"' | \"'\"} */\n\t\t\tvar in_str = false;\n\t\t\tvar in_apo = 0;\n\t\t\tvar in_comment = false;\n\n\t\t\tvar reserved_names = [];\n\n\t\t\tif (normal_styles) {\n\t\t\t\treserved_names.push(...Object.keys(normal_styles).map(to_css_name));\n\t\t\t}\n\t\t\tif (important_styles) {\n\t\t\t\treserved_names.push(...Object.keys(important_styles).map(to_css_name));\n\t\t\t}\n\n\t\t\tvar start_index = 0;\n\t\t\tvar name_index = -1;\n\n\t\t\tconst len = value.length;\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tvar c = value[i];\n\n\t\t\t\tif (in_comment) {\n\t\t\t\t\tif (c === '/' && value[i - 1] === '*') {\n\t\t\t\t\t\tin_comment = false;\n\t\t\t\t\t}\n\t\t\t\t} else if (in_str) {\n\t\t\t\t\tif (in_str === c) {\n\t\t\t\t\t\tin_str = false;\n\t\t\t\t\t}\n\t\t\t\t} else if (c === '/' && value[i + 1] === '*') {\n\t\t\t\t\tin_comment = true;\n\t\t\t\t} else if (c === '\"' || c === \"'\") {\n\t\t\t\t\tin_str = c;\n\t\t\t\t} else if (c === '(') {\n\t\t\t\t\tin_apo++;\n\t\t\t\t} else if (c === ')') {\n\t\t\t\t\tin_apo--;\n\t\t\t\t}\n\n\t\t\t\tif (!in_comment && in_str === false && in_apo === 0) {\n\t\t\t\t\tif (c === ':' && name_index === -1) {\n\t\t\t\t\t\tname_index = i;\n\t\t\t\t\t} else if (c === ';' || i === len - 1) {\n\t\t\t\t\t\tif (name_index !== -1) {\n\t\t\t\t\t\t\tvar name = to_css_name(value.substring(start_index, name_index).trim());\n\n\t\t\t\t\t\t\tif (!reserved_names.includes(name)) {\n\t\t\t\t\t\t\t\tif (c !== ';') {\n\t\t\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvar property = value.substring(start_index, i).trim();\n\t\t\t\t\t\t\t\tnew_style += ' ' + property + ';';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstart_index = i + 1;\n\t\t\t\t\t\tname_index = -1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (normal_styles) {\n\t\t\tnew_style += append_styles(normal_styles);\n\t\t}\n\n\t\tif (important_styles) {\n\t\t\tnew_style += append_styles(important_styles, true);\n\t\t}\n\n\t\tnew_style = new_style.trim();\n\t\treturn new_style === '' ? null : new_style;\n\t}\n\n\treturn value == null ? null : String(value);\n}\n","import { to_class } from '../../../shared/attributes.js';\nimport { CLASS_CACHE } from '../../constants.js';\nimport { hydrating } from '../hydration.js';\n\n/**\n * @param {Element} dom\n * @param {boolean | number} is_html\n * @param {string | null} value\n * @param {string} [hash]\n * @param {Record<string, any>} [prev_classes]\n * @param {Record<string, any>} [next_classes]\n * @returns {Record<string, boolean> | undefined}\n */\nexport function set_class(dom, is_html, value, hash, prev_classes, next_classes) {\n\tvar prev = /** @type {any} */ (dom)[CLASS_CACHE];\n\n\tif (\n\t\thydrating ||\n\t\tprev !== value ||\n\t\tprev === undefined // for edge case of `class={undefined}`\n\t) {\n\t\tvar next_class_name = to_class(value, hash, next_classes);\n\n\t\tif (!hydrating || next_class_name !== dom.getAttribute('class')) {\n\t\t\t// Removing the attribute when the value is only an empty string causes\n\t\t\t// performance issues vs simply making the className an empty string. So\n\t\t\t// we should only remove the class if the value is nullish\n\t\t\t// and there no hash/directives :\n\t\t\tif (next_class_name == null) {\n\t\t\t\tdom.removeAttribute('class');\n\t\t\t} else if (is_html) {\n\t\t\t\tdom.className = next_class_name;\n\t\t\t} else {\n\t\t\t\tdom.setAttribute('class', next_class_name);\n\t\t\t}\n\t\t}\n\n\t\t/** @type {any} */ (dom)[CLASS_CACHE] = value;\n\t} else if (next_classes && prev_classes !== next_classes) {\n\t\tfor (var key in next_classes) {\n\t\t\tvar is_present = !!next_classes[key];\n\n\t\t\tif (prev_classes == null || is_present !== !!prev_classes[key]) {\n\t\t\t\tdom.classList.toggle(key, is_present);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn next_classes;\n}\n","import { to_style } from '../../../shared/attributes.js';\nimport { STYLE_CACHE } from '../../constants.js';\nimport { hydrating } from '../hydration.js';\n\n/**\n * @param {Element & ElementCSSInlineStyle} dom\n * @param {Record<string, any>} prev\n * @param {Record<string, any>} next\n * @param {string} [priority]\n */\nfunction update_styles(dom, prev = {}, next, priority) {\n\tfor (var key in next) {\n\t\tvar value = next[key];\n\n\t\tif (prev[key] !== value) {\n\t\t\tif (next[key] == null) {\n\t\t\t\tdom.style.removeProperty(key);\n\t\t\t} else {\n\t\t\t\tdom.style.setProperty(key, value, priority);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} dom\n * @param {string | null} value\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [prev_styles]\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [next_styles]\n */\nexport function set_style(dom, value, prev_styles, next_styles) {\n\tvar prev = /** @type {any} */ (dom)[STYLE_CACHE];\n\n\tif (hydrating || prev !== value) {\n\t\tvar next_style_attr = to_style(value, next_styles);\n\n\t\tif (!hydrating || next_style_attr !== dom.getAttribute('style')) {\n\t\t\tif (next_style_attr == null) {\n\t\t\t\tdom.removeAttribute('style');\n\t\t\t} else {\n\t\t\t\tdom.style.cssText = next_style_attr;\n\t\t\t}\n\t\t}\n\n\t\t/** @type {any} */ (dom)[STYLE_CACHE] = value;\n\t} else if (next_styles) {\n\t\tif (Array.isArray(next_styles)) {\n\t\t\tupdate_styles(dom, prev_styles?.[0], next_styles[0]);\n\t\t\tupdate_styles(dom, prev_styles?.[1], next_styles[1], 'important');\n\t\t} else {\n\t\t\tupdate_styles(dom, prev_styles, next_styles);\n\t\t}\n\t}\n\n\treturn next_styles;\n}\n","import { effect, teardown } from '../../../reactivity/effects.js';\nimport { listen_to_event_and_reset_event } from './shared.js';\nimport { is } from '../../../proxy.js';\nimport { is_array } from '../../../../shared/utils.js';\nimport * as w from '../../../warnings.js';\nimport { Batch, current_batch, previous_batch } from '../../../reactivity/batch.js';\nimport { async_mode_flag } from '../../../../flags/index.js';\n\n/**\n * Sets the `selected` attribute on an option so form reset can restore it.\n * @param {HTMLOptionElement} option\n * @param {boolean} selected\n */\nexport function set_selected(option, selected) {\n\tif (selected) {\n\t\tif (!option.hasAttribute('selected')) option.setAttribute('selected', '');\n\t} else {\n\t\toption.removeAttribute('selected');\n\t}\n}\n\n/**\n * Sets the options a form reset should restore. The first call selects\n * them if nothing has set a value, later calls leave the current selection alone.\n * @param {HTMLSelectElement} select\n * @param {any} value\n */\nexport function set_default_select_value(select, value) {\n\tvar mounting = !('__defaultValue' in select);\n\t// @ts-expect-error\n\tif (!mounting && select.__defaultValue === value) return;\n\t// @ts-expect-error\n\tselect.__defaultValue = value;\n\tapply_default_select_value(select, !mounting || '__value' in select);\n}\n\n/**\n * Marks the options matching `__defaultValue` as selected. Without `preserve`\n * a newly matching option gets selected, as an inserted `<option selected>` would.\n * @param {HTMLSelectElement} select\n * @param {boolean} preserve\n */\nfunction apply_default_select_value(select, preserve) {\n\t// @ts-expect-error\n\tvar value = select.__defaultValue;\n\tvar multiple = select.multiple;\n\tvar values = multiple ? value ?? [] : null;\n\n\tif (multiple && !is_array(values)) return;\n\n\tvar index = select.selectedIndex;\n\tvar selected = preserve && multiple ? new Set(select.selectedOptions) : null;\n\n\tfor (var option of select.options) {\n\t\tvar option_value = get_option_value(option);\n\t\tset_selected(\n\t\t\toption,\n\t\t\tmultiple ? /** @type {any[]} */ (values).includes(option_value) : is(option_value, value)\n\t\t);\n\t}\n\n\tif (!preserve) return;\n\n\tif (selected !== null) {\n\t\tfor (option of select.options) {\n\t\t\tvar was_selected = selected.has(option);\n\t\t\tif (option.selected !== was_selected) option.selected = was_selected;\n\t\t}\n\t} else if (select.selectedIndex !== index) {\n\t\tselect.selectedIndex = index;\n\t}\n}\n\n/**\n * Selects the correct option(s) (depending on whether this is a multiple select)\n * @template V\n * @param {HTMLSelectElement} select\n * @param {V} value\n * @param {boolean} mounting\n */\nexport function select_option(select, value, mounting = false) {\n\tif (select.multiple) {\n\t\t// If value is null or undefined, keep the selection as is\n\t\tif (value == undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If not an array, warn and keep the selection as is\n\t\tif (!is_array(value)) {\n\t\t\treturn w.select_multiple_invalid_value();\n\t\t}\n\n\t\t// Otherwise, update the selection\n\t\tfor (var option of select.options) {\n\t\t\toption.selected = value.includes(get_option_value(option));\n\t\t}\n\n\t\treturn;\n\t}\n\n\tfor (option of select.options) {\n\t\tvar option_value = get_option_value(option);\n\t\tif (is(option_value, value)) {\n\t\t\toption.selected = true;\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (!mounting || value !== undefined) {\n\t\tselect.selectedIndex = -1; // no option should be selected\n\t}\n}\n\n/**\n * Sets up a mutation observer to sync the current selection\n * and default to the dom when the options change, for example\n * when they are inside an `#each` block. Called once per `<select>`,\n * by the compiled output or by `attribute_effect` for spreads.\n * @param {HTMLSelectElement} select\n */\nexport function init_select(select) {\n\tvar observer = new MutationObserver((entries) => {\n\t\t// Mutations related to `<selectedcontent>` can never affect the option list.\n\t\t// Reacting to them could revert a user-initiated selection change, because the\n\t\t// records are delivered as soon as any listener returns (e.g. a delegated `input`\n\t\t// handler), which can happen before the `change` handler has updated `__value`\n\t\tif (entries.every(is_selectedcontent_mutation)) return;\n\n\t\tif ('__defaultValue' in select) {\n\t\t\tapply_default_select_value(select, false);\n\t\t}\n\n\t\tif ('__value' in select) {\n\t\t\tselect_option(select, select.__value);\n\t\t}\n\t\t// Deliberately don't update the potential binding value,\n\t\t// the model should be preserved unless explicitly changed\n\t});\n\n\tobserver.observe(select, {\n\t\t// Listen to option element changes\n\t\tchildList: true,\n\t\tsubtree: true, // because of <optgroup>\n\t\t// Listen to option element value attribute changes\n\t\t// (doesn't get notified of select value changes,\n\t\t// because that property is not reflected as an attribute)\n\t\tattributes: true,\n\t\tattributeFilter: ['value']\n\t});\n\n\tteardown(() => {\n\t\tobserver.disconnect();\n\t});\n}\n\n/**\n * @param {HTMLSelectElement} select\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_select_value(select, get, set = get) {\n\tvar batches = new WeakSet();\n\tvar mounting = true;\n\n\tlisten_to_event_and_reset_event(select, 'change', (is_reset) => {\n\t\tvar query = is_reset ? '[selected]' : ':checked';\n\t\t/** @type {unknown} */\n\t\tvar value;\n\n\t\tif (select.multiple) {\n\t\t\tvalue = [].map.call(select.querySelectorAll(query), get_option_value);\n\t\t} else {\n\t\t\t/** @type {HTMLOptionElement | null} */\n\t\t\tvar selected_option =\n\t\t\t\tselect.querySelector(query) ??\n\t\t\t\t// will fall back to first non-disabled option if no option is selected\n\t\t\t\tselect.querySelector('option:not([disabled])');\n\t\t\tvalue = selected_option && get_option_value(selected_option);\n\t\t}\n\n\t\tset(value);\n\n\t\t// @ts-ignore\n\t\tselect.__value = value;\n\n\t\tif (current_batch !== null) {\n\t\t\tbatches.add(current_batch);\n\t\t}\n\t});\n\n\t// Needs to be an effect, not a render_effect, so that in case of each loops the logic runs after the each block has updated\n\teffect(() => {\n\t\tvar value = get();\n\n\t\tif (select === document.activeElement) {\n\t\t\t// In sync mode render effects are executed during tree traversal -> needs current_batch\n\t\t\t// In async mode render effects are flushed once batch resolved, at which point current_batch is null -> needs previous_batch\n\t\t\tvar batch = /** @type {Batch} */ (async_mode_flag ? previous_batch : current_batch);\n\n\t\t\t// Don't update the <select> if it is focused. We can get here if, for example,\n\t\t\t// an update is deferred because of async work depending on the select:\n\t\t\t//\n\t\t\t// <select bind:value={selected}>...</select>\n\t\t\t// <p>{await find(selected)}</p>\n\t\t\tif (batches.has(batch)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tselect_option(select, value, mounting);\n\n\t\t// Mounting and value undefined -> take selection from dom\n\t\tif (mounting && value === undefined) {\n\t\t\t/** @type {HTMLOptionElement | null} */\n\t\t\tvar selected_option = select.querySelector(':checked');\n\t\t\tif (selected_option !== null) {\n\t\t\t\tvalue = get_option_value(selected_option);\n\t\t\t\tset(value);\n\t\t\t}\n\t\t}\n\n\t\t// @ts-ignore\n\t\tselect.__value = value;\n\t\tmounting = false;\n\t});\n}\n\n/** @param {HTMLOptionElement} option */\nfunction get_option_value(option) {\n\t// __value only exists if the <option> has a value attribute\n\tif ('__value' in option) {\n\t\treturn option.__value;\n\t} else {\n\t\treturn option.value;\n\t}\n}\n\n/**\n * Returns `true` if the mutation stems from the browser mirroring the selected\n * option's content into `<selectedcontent>`, or from us replacing the\n * `<selectedcontent>` element with a clone of itself\n * @param {MutationRecord} entry\n */\nfunction is_selectedcontent_mutation(entry) {\n\tif (/** @type {Element} */ (entry.target).closest('selectedcontent') !== null) {\n\t\treturn true;\n\t}\n\n\tif (entry.type === 'childList') {\n\t\tvar nodes = [...entry.addedNodes, ...entry.removedNodes];\n\t\treturn nodes.length > 0 && nodes.every((node) => node.nodeName === 'SELECTEDCONTENT');\n\t}\n\n\treturn false;\n}\n","/** @import { Blocker, Effect } from '#client' */\nimport { DEV } from 'esm-env';\nimport { hydrating, set_hydrating } from '../hydration.js';\nimport { get_descriptors, get_prototype_of } from '../../../shared/utils.js';\nimport { create_event, delegate, delegated, event, event_symbol } from './events.js';\nimport { add_form_reset_listener, autofocus } from './misc.js';\nimport * as w from '../../warnings.js';\nimport {\n\tATTRIBUTES_CACHE,\n\tFORM_RESET_HANDLER,\n\tIS_XHTML,\n\tLOADING_ATTR_SYMBOL\n} from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { is_capture_event, can_delegate_event, normalize_attribute } from '../../../../utils.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport { attach } from './attachments.js';\nimport { clsx } from '../../../shared/attributes.js';\nimport { set_class } from './class.js';\nimport { set_style } from './style.js';\nimport { ATTACHMENT_KEY, NAMESPACE_HTML, UNINITIALIZED } from '../../../../constants.js';\nimport { branch, destroy_effect, effect, managed } from '../../reactivity/effects.js';\nimport {\n\tinit_select,\n\tselect_option,\n\tset_default_select_value,\n\tset_selected\n} from './bindings/select.js';\nimport { flatten } from '../../reactivity/async.js';\n\nexport const CLASS = Symbol('class');\nexport const STYLE = Symbol('style');\n\nconst IS_CUSTOM_ELEMENT = Symbol('is custom element');\nconst IS_HTML = Symbol('is html');\n\nconst LINK_TAG = IS_XHTML ? 'link' : 'LINK';\nconst INPUT_TAG = IS_XHTML ? 'input' : 'INPUT';\nconst OPTION_TAG = IS_XHTML ? 'option' : 'OPTION';\nconst SELECT_TAG = IS_XHTML ? 'select' : 'SELECT';\nconst PROGRESS_TAG = IS_XHTML ? 'progress' : 'PROGRESS';\n\n/**\n * The value/checked attribute in the template actually corresponds to the defaultValue property, so we need\n * to remove it upon hydration to avoid a bug when someone resets the form value.\n * @param {HTMLInputElement} input\n * @returns {void}\n */\nexport function remove_input_defaults(input) {\n\tif (!hydrating) return;\n\n\tvar already_removed = false;\n\n\t// We try and remove the default attributes later, rather than sync during hydration.\n\t// Doing it sync during hydration has a negative impact on performance, but deferring the\n\t// work in an idle task alleviates this greatly. If a form reset event comes in before\n\t// the idle callback, then we ensure the input defaults are cleared just before.\n\tvar remove_defaults = () => {\n\t\tif (already_removed) return;\n\t\talready_removed = true;\n\n\t\t// Remove the attributes but preserve the values\n\t\tif (input.hasAttribute('value')) {\n\t\t\tvar value = input.value;\n\t\t\tset_attribute(input, 'value', null);\n\t\t\tinput.value = value;\n\t\t}\n\n\t\tif (input.hasAttribute('checked')) {\n\t\t\tvar checked = input.checked;\n\t\t\tset_attribute(input, 'checked', null);\n\t\t\tinput.checked = checked;\n\t\t}\n\t};\n\n\t/** @type {any} */ (input)[FORM_RESET_HANDLER] = remove_defaults;\n\tqueue_micro_task(remove_defaults);\n\tadd_form_reset_listener();\n}\n\n/**\n * @param {Element} element\n * @param {any} value\n */\nexport function set_value(element, value) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.value ===\n\t\t\t(attributes.value =\n\t\t\t\t// treat null and undefined the same for the initial value\n\t\t\t\tvalue ?? undefined) ||\n\t\t// @ts-expect-error\n\t\t// `progress` elements always need their value set when it's `0`\n\t\t(element.value === value && (value !== 0 || element.nodeName !== PROGRESS_TAG))\n\t) {\n\t\treturn;\n\t}\n\n\t// @ts-expect-error\n\telement.value = value ?? '';\n}\n\n/**\n * @param {Element} element\n * @param {boolean} checked\n */\nexport function set_checked(element, checked) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.checked ===\n\t\t(attributes.checked =\n\t\t\t// treat null and undefined the same for the initial value\n\t\t\tchecked ?? undefined)\n\t) {\n\t\treturn;\n\t}\n\n\t// @ts-expect-error\n\telement.checked = checked;\n}\n\n/**\n * Applies the default checked property without influencing the current checked property.\n * @param {HTMLInputElement} element\n * @param {boolean} checked\n */\nexport function set_default_checked(element, checked) {\n\tconst existing_value = element.checked;\n\telement.defaultChecked = checked;\n\telement.checked = existing_value;\n}\n\n/**\n * Applies the default value property without influencing the current value property.\n * @param {HTMLInputElement | HTMLTextAreaElement} element\n * @param {string} value\n */\nexport function set_default_value(element, value) {\n\tconst existing_value = element.value;\n\telement.defaultValue = value;\n\telement.value = existing_value;\n}\n\n/**\n * @param {Element} element\n * @param {string} attribute\n * @param {string | null} value\n * @param {boolean} [skip_warning]\n */\nexport function set_attribute(element, attribute, value, skip_warning) {\n\tvar attributes = get_attributes(element);\n\n\tif (hydrating) {\n\t\tattributes[attribute] = element.getAttribute(attribute);\n\n\t\tif (\n\t\t\tattribute === 'src' ||\n\t\t\tattribute === 'srcset' ||\n\t\t\t(attribute === 'href' && element.nodeName === LINK_TAG)\n\t\t) {\n\t\t\tif (!skip_warning) {\n\t\t\t\tcheck_src_in_dev_hydration(element, attribute, value ?? '');\n\t\t\t}\n\n\t\t\t// If we reset these attributes, they would result in another network request, which we want to avoid.\n\t\t\t// We assume they are the same between client and server as checking if they are equal is expensive\n\t\t\t// (we can't just compare the strings as they can be different between client and server but result in the\n\t\t\t// same url, so we would need to create hidden anchor elements to compare them)\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (attributes[attribute] === (attributes[attribute] = value)) return;\n\n\tif (attribute === 'loading') {\n\t\t// @ts-expect-error\n\t\telement[LOADING_ATTR_SYMBOL] = value;\n\t}\n\n\tif (value == null) {\n\t\telement.removeAttribute(attribute);\n\t} else if (typeof value !== 'string' && get_setters(element).has(attribute)) {\n\t\t// @ts-ignore\n\t\telement[attribute] = value;\n\t} else {\n\t\telement.setAttribute(attribute, value);\n\t}\n}\n\n/**\n * @param {Element} dom\n * @param {string} attribute\n * @param {string} value\n */\nexport function set_xlink_attribute(dom, attribute, value) {\n\tdom.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\n\n/**\n * @param {HTMLElement} node\n * @param {string} prop\n * @param {any} value\n */\nexport function set_custom_element_data(node, prop, value) {\n\t// We need to ensure that setting custom element props, which can\n\t// invoke lifecycle methods on other custom elements, does not also\n\t// associate those lifecycle methods with the current active reaction\n\t// or effect\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet was_hydrating = hydrating;\n\tif (hydrating) {\n\t\tset_hydrating(false);\n\t}\n\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\n\ttry {\n\t\tif (\n\t\t\t// `style` should use `set_attribute` rather than the setter\n\t\t\tprop !== 'style' &&\n\t\t\t// Don't compute setters for custom elements while they aren't registered yet,\n\t\t\t// because during their upgrade/instantiation they might add more setters.\n\t\t\t// Instead, fall back to a simple \"an object, then set as property\" heuristic.\n\t\t\t(setters_cache.has(node.getAttribute('is') || node.nodeName) ||\n\t\t\t// customElements may not be available in browser extension contexts\n\t\t\t!customElements ||\n\t\t\tcustomElements.get(node.getAttribute('is') || node.nodeName.toLowerCase())\n\t\t\t\t? get_setters(node).has(prop)\n\t\t\t\t: value && typeof value === 'object')\n\t\t) {\n\t\t\t// @ts-expect-error\n\t\t\tnode[prop] = value;\n\t\t} else {\n\t\t\t// We did getters etc checks already, stringify before passing to set_attribute\n\t\t\t// to ensure it doesn't invoke the same logic again, and potentially populating\n\t\t\t// the setters cache too early.\n\t\t\tset_attribute(node, prop, value == null ? value : String(value));\n\t\t}\n\t} finally {\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t\tif (was_hydrating) {\n\t\t\tset_hydrating(true);\n\t\t}\n\t}\n}\n\n/**\n * Spreads attributes onto a DOM element, taking into account the currently set attributes\n * @param {Element & ElementCSSInlineStyle} element\n * @param {Record<string | symbol, any> | undefined} prev\n * @param {Record<string | symbol, any>} next New attributes - this function mutates this object\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n * @returns {Record<string, any>}\n */\nfunction set_attributes(\n\telement,\n\tprev,\n\tnext,\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tif (hydrating && should_remove_defaults && element.nodeName === INPUT_TAG) {\n\t\tif (!('defaultValue' in next || 'defaultChecked' in next)) {\n\t\t\tremove_input_defaults(/** @type {HTMLInputElement} */ (element));\n\t\t}\n\t}\n\n\tvar attributes = get_attributes(element);\n\n\tvar is_custom_element = attributes[IS_CUSTOM_ELEMENT];\n\tvar preserve_attribute_case = !attributes[IS_HTML];\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet is_hydrating_custom_element = hydrating && is_custom_element;\n\tif (is_hydrating_custom_element) {\n\t\tset_hydrating(false);\n\t}\n\n\tvar current = prev || {};\n\tvar is_option_element = element.nodeName === OPTION_TAG;\n\tvar is_select_element = element.nodeName === SELECT_TAG;\n\n\tfor (var key in prev) {\n\t\t// don't null our internal $$onX listeners\n\t\tif (!(key in next) && key[0] + key[1] !== '$$') {\n\t\t\tnext[key] = null;\n\t\t}\n\t}\n\n\tif (next.class) {\n\t\tnext.class = clsx(next.class);\n\t} else if (css_hash || next[CLASS]) {\n\t\tnext.class = null; /* force call to set_class() */\n\t}\n\n\tif (next[STYLE]) {\n\t\tnext.style ??= null; /* force call to set_style() */\n\t}\n\n\tvar setters = get_setters(element);\n\n\tif (element.nodeName === INPUT_TAG && 'type' in next && ('value' in next || '__value' in next)) {\n\t\tvar type = next.type;\n\n\t\tif (type !== current.type || (type === undefined && element.hasAttribute('type'))) {\n\t\t\tcurrent.type = type;\n\t\t\tset_attribute(element, 'type', type, skip_warning);\n\t\t}\n\t}\n\n\t// since key is captured we use const\n\tfor (const key in next) {\n\t\t// let instead of var because referenced in a closure\n\t\tlet value = next[key];\n\n\t\t// Up here because we want to do this for the initial value, too, even if it's undefined,\n\t\t// and this wouldn't be reached in case of undefined because of the equality check below\n\t\tif (is_option_element && key === 'value' && value == null) {\n\t\t\t// The <option> element is a special case because removing the value attribute means\n\t\t\t// the value is set to the text content of the option element, and setting the value\n\t\t\t// to null or undefined means the value is set to the string \"null\" or \"undefined\".\n\t\t\t// To align with how we handle this case in non-spread-scenarios, this logic is needed.\n\t\t\t// There's a super-edge-case bug here that is left in in favor of smaller code size:\n\t\t\t// Because of the \"set missing props to null\" logic above, we can't differentiate\n\t\t\t// between a missing value and an explicitly set value of null or undefined. That means\n\t\t\t// that once set, the value attribute of an <option> element can't be removed. This is\n\t\t\t// a very rare edge case, and removing the attribute altogether isn't possible either\n\t\t\t// for the <option value={undefined}> case, so we're not losing any functionality here.\n\t\t\t// @ts-ignore\n\t\t\telement.value = element.__value = '';\n\t\t\tcurrent[key] = value;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (key === 'class') {\n\t\t\tvar is_html = element.namespaceURI === 'http://www.w3.org/1999/xhtml';\n\t\t\tset_class(element, is_html, value, css_hash, prev?.[CLASS], next[CLASS]);\n\t\t\tcurrent[key] = value;\n\t\t\tcurrent[CLASS] = next[CLASS];\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (key === 'style') {\n\t\t\tset_style(element, value, prev?.[STYLE], next[STYLE]);\n\t\t\tcurrent[key] = value;\n\t\t\tcurrent[STYLE] = next[STYLE];\n\t\t\tcontinue;\n\t\t}\n\n\t\tvar prev_value = current[key];\n\n\t\t// Skip if value is unchanged, unless it's `undefined` and the element still has the attribute\n\t\tif (value === prev_value && !(value === undefined && element.hasAttribute(key))) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tcurrent[key] = value;\n\n\t\tvar prefix = key[0] + key[1]; // this is faster than key.slice(0, 2)\n\t\tif (prefix === '$$') continue;\n\n\t\tif (prefix === 'on') {\n\t\t\t/** @type {{ capture?: true }} */\n\t\t\tconst opts = {};\n\t\t\tconst event_handle_key = '$$' + key;\n\t\t\tlet event_name = key.slice(2);\n\t\t\tvar is_delegated = can_delegate_event(event_name);\n\n\t\t\tif (is_capture_event(event_name)) {\n\t\t\t\tevent_name = event_name.slice(0, -7);\n\t\t\t\topts.capture = true;\n\t\t\t}\n\n\t\t\tif (!is_delegated && prev_value) {\n\t\t\t\t// Listening to same event but different handler -> our handle function below takes care of this\n\t\t\t\t// If we were to remove and add listeners in this case, it could happen that the event is \"swallowed\"\n\t\t\t\t// (the browser seems to not know yet that a new one exists now) and doesn't reach the handler\n\t\t\t\t// https://github.com/sveltejs/svelte/issues/11903\n\t\t\t\tif (value != null) continue;\n\n\t\t\t\telement.removeEventListener(event_name, current[event_handle_key], opts);\n\t\t\t\tcurrent[event_handle_key] = null;\n\t\t\t}\n\n\t\t\tif (is_delegated) {\n\t\t\t\tdelegated(event_name, element, value);\n\t\t\t\tdelegate([event_name]);\n\t\t\t} else if (value != null) {\n\t\t\t\t/**\n\t\t\t\t * @this {any}\n\t\t\t\t * @param {Event} evt\n\t\t\t\t */\n\t\t\t\tfunction handle(evt) {\n\t\t\t\t\tcurrent[key].call(this, evt);\n\t\t\t\t}\n\n\t\t\t\tcurrent[event_handle_key] = create_event(event_name, element, handle, opts);\n\t\t\t}\n\t\t} else if (key === 'style') {\n\t\t\t// avoid using the setter\n\t\t\tset_attribute(element, key, value);\n\t\t} else if (key === 'autofocus') {\n\t\t\tautofocus(/** @type {HTMLElement} */ (element), Boolean(value));\n\t\t} else if (!is_custom_element && (key === '__value' || (key === 'value' && value != null))) {\n\t\t\t// @ts-ignore We're not running this for custom elements because __value is actually\n\t\t\t// how Lit stores the current value on the element, and messing with that would break things.\n\t\t\telement.value = element.__value = value;\n\t\t} else if (key === 'selected' && is_option_element) {\n\t\t\tset_selected(/** @type {HTMLOptionElement} */ (element), value);\n\t\t} else {\n\t\t\tvar name = key;\n\t\t\tif (!preserve_attribute_case) {\n\t\t\t\tname = normalize_attribute(name);\n\t\t\t}\n\n\t\t\tvar is_default = name === 'defaultValue' || name === 'defaultChecked';\n\n\t\t\t// A select's default value is represented by selected options, not a property.\n\t\t\tif (is_select_element && name === 'defaultValue') continue;\n\n\t\t\tif (value == null && !is_custom_element && !is_default) {\n\t\t\t\tattributes[key] = null;\n\n\t\t\t\tif (name === 'value' || name === 'checked') {\n\t\t\t\t\t// removing value/checked also removes defaultValue/defaultChecked — preserve\n\t\t\t\t\tlet input = /** @type {HTMLInputElement} */ (element);\n\t\t\t\t\tconst use_default = prev === undefined;\n\t\t\t\t\tif (name === 'value') {\n\t\t\t\t\t\tlet previous = input.defaultValue;\n\t\t\t\t\t\tinput.removeAttribute(name);\n\t\t\t\t\t\tinput.defaultValue = previous;\n\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\tinput.value = input.__value = use_default ? previous : null;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet previous = input.defaultChecked;\n\t\t\t\t\t\tinput.removeAttribute(name);\n\t\t\t\t\t\tinput.defaultChecked = previous;\n\t\t\t\t\t\tinput.checked = use_default ? previous : false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\telement.removeAttribute(key);\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tis_default ||\n\t\t\t\t((is_custom_element || typeof value !== 'string') && setters.has(name))\n\t\t\t) {\n\t\t\t\t// @ts-ignore\n\t\t\t\telement[name] = value;\n\t\t\t\t// remove it from attributes's cache\n\t\t\t\tif (name in attributes) attributes[name] = UNINITIALIZED;\n\t\t\t} else if (typeof value !== 'function') {\n\t\t\t\tset_attribute(element, name, value, skip_warning);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (is_hydrating_custom_element) {\n\t\tset_hydrating(true);\n\t}\n\n\treturn current;\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} element\n * @param {(...expressions: any) => Record<string | symbol, any>} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n */\nexport function attribute_effect(\n\telement,\n\tfn,\n\tsync = [],\n\tasync = [],\n\tblockers = [],\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tflatten(blockers, sync, async, (values) => {\n\t\t/** @type {Record<string | symbol, any> | undefined} */\n\t\tvar prev = undefined;\n\n\t\t/** @type {Record<symbol, Effect>} */\n\t\tvar effects = {};\n\n\t\tvar is_select = element.nodeName === SELECT_TAG;\n\t\tvar inited = false;\n\n\t\tmanaged(() => {\n\t\t\tvar next = fn(...values.map(get));\n\t\t\t/** @type {Record<string | symbol, any>} */\n\t\t\tvar current = set_attributes(\n\t\t\t\telement,\n\t\t\t\tprev,\n\t\t\t\tnext,\n\t\t\t\tcss_hash,\n\t\t\t\tshould_remove_defaults,\n\t\t\t\tskip_warning\n\t\t\t);\n\n\t\t\tif (inited && is_select) {\n\t\t\t\tvar select = /** @type {HTMLSelectElement} */ (element);\n\n\t\t\t\tif ('defaultValue' in next) {\n\t\t\t\t\tset_default_select_value(select, next.defaultValue);\n\t\t\t\t}\n\n\t\t\t\tif ('value' in next) {\n\t\t\t\t\tselect_option(select, next.value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(effects)) {\n\t\t\t\tif (!next[symbol]) destroy_effect(effects[symbol]);\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(next)) {\n\t\t\t\tvar n = next[symbol];\n\n\t\t\t\tif (symbol.description === ATTACHMENT_KEY && (!prev || n !== prev[symbol])) {\n\t\t\t\t\tif (effects[symbol]) destroy_effect(effects[symbol]);\n\t\t\t\t\teffects[symbol] = branch(() => attach(element, () => n));\n\t\t\t\t}\n\n\t\t\t\tcurrent[symbol] = n;\n\t\t\t}\n\n\t\t\tprev = current;\n\t\t});\n\n\t\tif (is_select) {\n\t\t\tvar select = /** @type {HTMLSelectElement} */ (element);\n\n\t\t\teffect(() => {\n\t\t\t\tvar attrs = /** @type {Record<string | symbol, any>} */ (prev);\n\n\t\t\t\tif ('defaultValue' in attrs) {\n\t\t\t\t\tset_default_select_value(select, attrs.defaultValue);\n\t\t\t\t}\n\n\t\t\t\tselect_option(select, attrs.value, true);\n\t\t\t\tinit_select(select);\n\t\t\t});\n\t\t}\n\n\t\tinited = true;\n\t});\n}\n\n/**\n *\n * @param {Element} element\n */\nfunction get_attributes(element) {\n\treturn /** @type {Record<string | symbol, unknown>} **/ (\n\t\t/** @type {any} */ (element)[ATTRIBUTES_CACHE] ??= {\n\t\t\t[IS_CUSTOM_ELEMENT]: element.nodeName.includes('-'),\n\t\t\t[IS_HTML]: element.namespaceURI === NAMESPACE_HTML\n\t\t}\n\t);\n}\n\n/** @type {Map<string, Set<string>>} */\nvar setters_cache = new Map();\n\n/** @param {Element} element */\nfunction get_setters(element) {\n\tvar cache_key = element.getAttribute('is') || element.nodeName;\n\tvar setters = setters_cache.get(cache_key);\n\tif (setters) return setters;\n\tsetters_cache.set(cache_key, (setters = new Set()));\n\n\tvar descriptors;\n\tvar proto = element; // In the case of custom elements there might be setters on the instance\n\tvar element_proto = Element.prototype;\n\n\t// Stop at Element, from there on there's only unnecessary (and dangerous, like innerHTML) setters we're not interested in\n\t// Do not use constructor.name here as that's unreliable in some browser environments\n\twhile (element_proto !== proto) {\n\t\tdescriptors = get_descriptors(proto);\n\n\t\tfor (var key in descriptors) {\n\t\t\tif (\n\t\t\t\tdescriptors[key].set &&\n\t\t\t\t// better safe than sorry, we don't want spread attributes to mess with HTML content\n\t\t\t\tkey !== 'innerHTML' &&\n\t\t\t\tkey !== 'textContent' &&\n\t\t\t\tkey !== 'innerText'\n\t\t\t) {\n\t\t\t\tsetters.add(key);\n\t\t\t}\n\t\t}\n\n\t\tproto = get_prototype_of(proto);\n\t}\n\n\treturn setters;\n}\n\n/**\n * @param {any} element\n * @param {string} attribute\n * @param {string} value\n */\nfunction check_src_in_dev_hydration(element, attribute, value) {\n\tif (!DEV) return;\n\tif (attribute === 'srcset' && srcset_url_equal(element, value)) return;\n\tif (src_url_equal(element.getAttribute(attribute) ?? '', value)) return;\n\n\tw.hydration_attribute_changed(\n\t\tattribute,\n\t\telement.outerHTML.replace(element.innerHTML, element.innerHTML && '...'),\n\t\tString(value)\n\t);\n}\n\n/**\n * @param {string} element_src\n * @param {string} url\n * @returns {boolean}\n */\nfunction src_url_equal(element_src, url) {\n\tif (element_src === url) return true;\n\treturn new URL(element_src, document.baseURI).href === new URL(url, document.baseURI).href;\n}\n\n/** @param {string} srcset */\nfunction split_srcset(srcset) {\n\treturn srcset.split(',').map((src) => src.trim().split(' ').filter(Boolean));\n}\n\n/**\n * @param {HTMLSourceElement | HTMLImageElement} element\n * @param {string} srcset\n * @returns {boolean}\n */\nfunction srcset_url_equal(element, srcset) {\n\tvar element_urls = split_srcset(element.srcset);\n\tvar urls = split_srcset(srcset);\n\n\treturn (\n\t\turls.length === element_urls.length &&\n\t\turls.every(\n\t\t\t([url, width], i) =>\n\t\t\t\twidth === element_urls[i][1] &&\n\t\t\t\t// We need to test both ways because Vite will create an a full URL with\n\t\t\t\t// `new URL(asset, import.meta.url).href` for the client when `base: './'`, and the\n\t\t\t\t// relative URLs inside srcset are not automatically resolved to absolute URLs by\n\t\t\t\t// browsers (in contrast to img.src). This means both SSR and DOM code could\n\t\t\t\t// contain relative or absolute URLs.\n\t\t\t\t(src_url_equal(element_urls[i][0], url) || src_url_equal(url, element_urls[i][0]))\n\t\t)\n\t);\n}\n","/** @import { Batch } from '../../../reactivity/batch.js' */\nimport { DEV } from 'esm-env';\nimport { render_effect, teardown } from '../../../reactivity/effects.js';\nimport { listen_to_event_and_reset_event } from './shared.js';\nimport * as e from '../../../errors.js';\nimport { is } from '../../../proxy.js';\nimport { queue_micro_task } from '../../task.js';\nimport { hydrating } from '../../hydration.js';\nimport { tick, untrack } from '../../../runtime.js';\nimport { current_batch, previous_batch } from '../../../reactivity/batch.js';\nimport { async_mode_flag } from '../../../../flags/index.js';\n\n/**\n * @param {HTMLInputElement} input\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_value(input, get, set = get) {\n\tvar batches = new WeakSet();\n\n\tlisten_to_event_and_reset_event(input, 'input', async (is_reset) => {\n\t\tif (DEV && input.type === 'checkbox') {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.bind_invalid_checkbox_value();\n\t\t}\n\n\t\t/** @type {any} */\n\t\tvar value = is_reset ? input.defaultValue : input.value;\n\t\tvalue = is_numberlike_input(input) ? to_number(value) : value;\n\t\tset(value);\n\n\t\tif (current_batch !== null) {\n\t\t\tbatches.add(current_batch);\n\t\t}\n\n\t\t// Because `{#each ...}` blocks work by updating sources inside the flush,\n\t\t// we need to wait a tick before checking to see if we should forcibly\n\t\t// update the input and reset the selection state\n\t\tawait tick();\n\n\t\t// Respect any validation in accessors\n\t\tif (value !== (value = get())) {\n\t\t\tvar start = input.selectionStart;\n\t\t\tvar end = input.selectionEnd;\n\t\t\tvar length = input.value.length;\n\n\t\t\t// the value is coerced on assignment\n\t\t\tinput.value = value ?? '';\n\n\t\t\t// Restore selection\n\t\t\tif (end !== null) {\n\t\t\t\tvar new_length = input.value.length;\n\t\t\t\t// If cursor was at end and new input is longer, move cursor to new end\n\t\t\t\tif (start === end && end === length && new_length > length) {\n\t\t\t\t\tinput.selectionStart = new_length;\n\t\t\t\t\tinput.selectionEnd = new_length;\n\t\t\t\t} else {\n\t\t\t\t\tinput.selectionStart = start;\n\t\t\t\t\tinput.selectionEnd = Math.min(end, new_length);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\tif (\n\t\t// If we are hydrating and the value has since changed,\n\t\t// then use the updated value from the input instead.\n\t\t(hydrating && input.defaultValue !== input.value) ||\n\t\t// If defaultValue is set, then value == defaultValue\n\t\t// TODO Svelte 6: remove input.value check and set to empty string?\n\t\t(untrack(get) == null && input.value)\n\t) {\n\t\tset(is_numberlike_input(input) ? to_number(input.value) : input.value);\n\n\t\tif (current_batch !== null) {\n\t\t\tbatches.add(current_batch);\n\t\t}\n\t}\n\n\trender_effect(() => {\n\t\tif (DEV && input.type === 'checkbox') {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.bind_invalid_checkbox_value();\n\t\t}\n\n\t\tvar value = get();\n\n\t\tif (input === document.activeElement) {\n\t\t\t// In sync mode render effects are executed during tree traversal -> needs current_batch\n\t\t\t// In async mode render effects are flushed once batch resolved, at which point current_batch is null -> needs previous_batch\n\t\t\tvar batch = /** @type {Batch} */ (async_mode_flag ? previous_batch : current_batch);\n\n\t\t\t// Never rewrite the contents of a focused input. We can get here if, for example,\n\t\t\t// an update is deferred because of async work depending on the input:\n\t\t\t//\n\t\t\t// <input bind:value={query}>\n\t\t\t// <p>{await find(query)}</p>\n\t\t\tif (batches.has(batch)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (is_numberlike_input(input) && value === to_number(input.value)) {\n\t\t\t// handles 0 vs 00 case (see https://github.com/sveltejs/svelte/issues/9959)\n\t\t\treturn;\n\t\t}\n\n\t\tif (input.type === 'date' && !value && !input.value) {\n\t\t\t// Handles the case where a temporarily invalid date is set (while typing, for example with a leading 0 for the day)\n\t\t\t// and prevents this state from clearing the other parts of the date input (see https://github.com/sveltejs/svelte/issues/7897)\n\t\t\treturn;\n\t\t}\n\n\t\t// don't set the value of the input if it's the same to allow\n\t\t// minlength to work properly\n\t\tif (value !== input.value) {\n\t\t\t// @ts-expect-error the value is coerced on assignment\n\t\t\tinput.value = value ?? '';\n\t\t}\n\t});\n}\n\n/** @type {Set<HTMLInputElement[]>} */\nconst pending = new Set();\n\n/**\n * @param {HTMLInputElement[]} inputs\n * @param {null | [number]} group_index\n * @param {HTMLInputElement} input\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_group(inputs, group_index, input, get, set = get) {\n\tvar is_checkbox = input.getAttribute('type') === 'checkbox';\n\tvar binding_group = inputs;\n\n\t// needs to be let or related code isn't treeshaken out if it's always false\n\tlet hydration_mismatch = false;\n\n\tif (group_index !== null) {\n\t\tfor (var index of group_index) {\n\t\t\t// @ts-expect-error\n\t\t\tbinding_group = binding_group[index] ??= [];\n\t\t}\n\t}\n\n\tbinding_group.push(input);\n\n\tlisten_to_event_and_reset_event(\n\t\tinput,\n\t\t'change',\n\t\t() => {\n\t\t\t// @ts-ignore\n\t\t\tvar value = input.__value;\n\n\t\t\tif (is_checkbox) {\n\t\t\t\tvalue = get_binding_group_value(binding_group, value, input.checked);\n\t\t\t}\n\n\t\t\tset(value);\n\t\t},\n\t\t// TODO better default value handling\n\t\t() => set(is_checkbox ? [] : null)\n\t);\n\n\trender_effect(() => {\n\t\tvar value = get();\n\n\t\t// If we are hydrating and the value has since changed, then use the update value\n\t\t// from the input instead.\n\t\tif (hydrating && input.defaultChecked !== input.checked) {\n\t\t\thydration_mismatch = true;\n\t\t\treturn;\n\t\t}\n\n\t\tif (is_checkbox) {\n\t\t\tvalue = value || [];\n\t\t\t// @ts-ignore\n\t\t\tinput.checked = value.includes(input.__value);\n\t\t} else {\n\t\t\t// @ts-ignore\n\t\t\tinput.checked = is(input.__value, value);\n\t\t}\n\t});\n\n\tteardown(() => {\n\t\tvar index = binding_group.indexOf(input);\n\n\t\tif (index !== -1) {\n\t\t\tbinding_group.splice(index, 1);\n\t\t}\n\t});\n\n\tif (!pending.has(binding_group)) {\n\t\tpending.add(binding_group);\n\n\t\tqueue_micro_task(() => {\n\t\t\t// necessary to maintain binding group order in all insertion scenarios\n\t\t\tbinding_group.sort((a, b) => (a.compareDocumentPosition(b) === 4 ? -1 : 1));\n\t\t\tpending.delete(binding_group);\n\t\t});\n\t}\n\n\tqueue_micro_task(() => {\n\t\tif (hydration_mismatch) {\n\t\t\tvar value;\n\n\t\t\tif (is_checkbox) {\n\t\t\t\tvalue = get_binding_group_value(binding_group, value, input.checked);\n\t\t\t} else {\n\t\t\t\tvar hydration_input = binding_group.find((input) => input.checked);\n\t\t\t\t// @ts-ignore\n\t\t\t\tvalue = hydration_input?.__value;\n\t\t\t}\n\n\t\t\tset(value);\n\t\t}\n\t});\n}\n\n/**\n * @param {HTMLInputElement} input\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_checked(input, get, set = get) {\n\tlisten_to_event_and_reset_event(input, 'change', (is_reset) => {\n\t\tvar value = is_reset ? input.defaultChecked : input.checked;\n\t\tset(value);\n\t});\n\n\tif (\n\t\t// If we are hydrating and the value has since changed,\n\t\t// then use the update value from the input instead.\n\t\t(hydrating && input.defaultChecked !== input.checked) ||\n\t\t// If defaultChecked is set, then checked == defaultChecked\n\t\tuntrack(get) == null\n\t) {\n\t\tset(input.checked);\n\t}\n\n\trender_effect(() => {\n\t\tvar value = get();\n\t\tinput.checked = Boolean(value);\n\t});\n}\n\n/**\n * @template V\n * @param {Array<HTMLInputElement>} group\n * @param {V} __value\n * @param {boolean} checked\n * @returns {V[]}\n */\nfunction get_binding_group_value(group, __value, checked) {\n\t/** @type {Set<V>} */\n\tvar value = new Set();\n\n\tfor (var i = 0; i < group.length; i += 1) {\n\t\tif (group[i].checked) {\n\t\t\t// @ts-ignore\n\t\t\tvalue.add(group[i].__value);\n\t\t}\n\t}\n\n\tif (!checked) {\n\t\tvalue.delete(__value);\n\t}\n\n\treturn Array.from(value);\n}\n\n/**\n * @param {HTMLInputElement} input\n */\nfunction is_numberlike_input(input) {\n\tvar type = input.type;\n\treturn type === 'number' || type === 'range';\n}\n\n/**\n * @param {string} value\n */\nfunction to_number(value) {\n\treturn value === '' ? null : +value;\n}\n\n/**\n * @param {HTMLInputElement} input\n * @param {() => FileList | null} get\n * @param {(value: FileList | null) => void} set\n */\nexport function bind_files(input, get, set = get) {\n\tlisten_to_event_and_reset_event(input, 'change', () => {\n\t\tset(input.files);\n\t});\n\n\tif (\n\t\t// If we are hydrating and the value has since changed,\n\t\t// then use the updated value from the input instead.\n\t\thydrating &&\n\t\tinput.files\n\t) {\n\t\tset(input.files);\n\t}\n\n\trender_effect(() => {\n\t\tinput.files = get();\n\t});\n}\n","/** @import { ComponentContext, Effect } from '#client' */\nimport { DESTROYING, STATE_SYMBOL } from '#client/constants';\nimport { component_context, mark_as_component } from '../../../context.js';\nimport { effect, render_effect } from '../../../reactivity/effects.js';\nimport { active_effect, untrack } from '../../../runtime.js';\n\n/**\n * @param {any} bound_value\n * @param {Element} element_or_component\n * @returns {boolean}\n */\nfunction is_bound_this(bound_value, element_or_component) {\n\treturn (\n\t\tbound_value === element_or_component || bound_value?.[STATE_SYMBOL] === element_or_component\n\t);\n}\n\n/**\n * @param {any} element_or_component\n * @param {(value: unknown, ...parts: unknown[]) => void} update\n * @param {(...parts: unknown[]) => unknown} get_value\n * @param {() => unknown[]} [get_parts] Set if the this binding is used inside an each block,\n * \t\t\t\t\t\t\t\t\t\treturns all the parts of the each block context that are used in the expression\n * @returns {void}\n */\nexport function bind_this(\n\telement_or_component = mark_as_component(),\n\tupdate,\n\tget_value,\n\tget_parts\n) {\n\tvar component_effect = /** @type {ComponentContext} */ (component_context).r;\n\tvar parent = /** @type {Effect} */ (active_effect);\n\n\teffect(() => {\n\t\t/** @type {unknown[]} */\n\t\tvar old_parts;\n\n\t\t/** @type {unknown[]} */\n\t\tvar parts;\n\n\t\trender_effect(() => {\n\t\t\told_parts = parts;\n\t\t\t// We only track changes to the parts, not the value itself to avoid unnecessary reruns.\n\t\t\tparts = get_parts?.() || [];\n\n\t\t\tuntrack(() => {\n\t\t\t\tif (!is_bound_this(get_value(...parts), element_or_component)) {\n\t\t\t\t\tupdate(element_or_component, ...parts);\n\t\t\t\t\t// If this is an effect rerun (cause: each block context changes), then nullify the binding at\n\t\t\t\t\t// the previous position if it isn't already taken over by a different effect.\n\t\t\t\t\tif (old_parts && is_bound_this(get_value(...old_parts), element_or_component)) {\n\t\t\t\t\t\tupdate(null, ...old_parts);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\treturn () => {\n\t\t\t// When the bind:this effect is destroyed, we go up the effect parent chain until we find the last parent effect that is destroyed,\n\t\t\t// or the effect containing the component bind:this is in (whichever comes first). That way we can time the nulling of the binding\n\t\t\t// as close to user/developer expectation as possible.\n\t\t\t// TODO Svelte 6: Decide if we want to keep this logic or just always null the binding in the component effect's teardown\n\t\t\t// (which would be simpler, but less intuitive in some cases, and breaks the `ondestroy-before-cleanup` test)\n\t\t\tlet p = parent;\n\t\t\twhile (p !== component_effect && p.parent !== null && p.parent.f & DESTROYING) {\n\t\t\t\tp = p.parent;\n\t\t\t}\n\t\t\tconst teardown = () => {\n\t\t\t\tif (parts && is_bound_this(get_value(...parts), element_or_component)) {\n\t\t\t\t\tupdate(null, ...parts);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst original_teardown = p.teardown;\n\t\t\tp.teardown = () => {\n\t\t\t\tteardown();\n\t\t\t\toriginal_teardown?.();\n\t\t\t};\n\t\t};\n\t});\n\n\treturn element_or_component;\n}\n","/** @import { Derived, Effect, Source } from './types.js' */\nimport { DEV } from 'esm-env';\nimport {\n\tPROPS_IS_BINDABLE,\n\tPROPS_IS_IMMUTABLE,\n\tPROPS_IS_LAZY_INITIAL,\n\tPROPS_IS_RUNES,\n\tPROPS_IS_UPDATED\n} from '../../../constants.js';\nimport { get_descriptor, is_function } from '../../shared/utils.js';\nimport { set, source, update } from './sources.js';\nimport { derived, derived_safe_equal } from './deriveds.js';\nimport {\n\tactive_effect,\n\tget,\n\tis_destroying_effect,\n\tset_active_effect,\n\tuntrack\n} from '../runtime.js';\nimport * as e from '../errors.js';\nimport { DESTROYED, LEGACY_PROPS, STATE_SYMBOL } from '#client/constants';\nimport { proxy } from '../proxy.js';\nimport { capture_store_binding } from './store.js';\nimport { legacy_mode_flag } from '../../flags/index.js';\nimport { effect, render_effect } from './effects.js';\n\n/**\n * @param {((value?: number) => number)} fn\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_prop(fn, d = 1) {\n\tconst value = fn();\n\tfn(value + d);\n\treturn value;\n}\n\n/**\n * @param {((value?: number) => number)} fn\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_pre_prop(fn, d = 1) {\n\tconst value = fn() + d;\n\tfn(value);\n\treturn value;\n}\n\n/**\n * The proxy handler for rest props (i.e. `const { x, ...rest } = $props()`).\n * Is passed the full `$$props` object and excludes the named props.\n * @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Set<string | symbol>, name?: string }>}}\n */\nconst rest_props_handler = {\n\tget(target, key) {\n\t\tif (target.exclude.has(key)) return;\n\t\treturn target.props[key];\n\t},\n\tset(target, key) {\n\t\tif (DEV) {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.props_rest_readonly(`${target.name}.${String(key)}`);\n\t\t}\n\n\t\treturn false;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tif (target.exclude.has(key)) return;\n\t\tif (key in target.props) {\n\t\t\treturn {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: target.props[key]\n\t\t\t};\n\t\t}\n\t},\n\thas(target, key) {\n\t\tif (target.exclude.has(key)) return false;\n\t\treturn key in target.props;\n\t},\n\townKeys(target) {\n\t\treturn Reflect.ownKeys(target.props).filter((key) => !target.exclude.has(key));\n\t}\n};\n\n/**\n * @param {Record<string, unknown>} props\n * @param {Set<string>} exclude\n * @param {string} [name]\n * @returns {Record<string, unknown>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function rest_props(props, exclude, name) {\n\treturn new Proxy(DEV ? { props, exclude, name } : { props, exclude }, rest_props_handler);\n}\n\n/**\n * The proxy handler for legacy $$restProps and $$props\n * @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Array<string | symbol>, special: Record<string | symbol, (v?: unknown) => unknown>, version: Source<number>, parent_effect: Effect }>}}\n */\nconst legacy_rest_props_handler = {\n\tget(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\tget(target.version);\n\t\treturn key in target.special ? target.special[key]() : target.props[key];\n\t},\n\tset(target, key, value) {\n\t\tif (!(key in target.special)) {\n\t\t\tvar previous_effect = active_effect;\n\n\t\t\ttry {\n\t\t\t\tset_active_effect(target.parent_effect);\n\n\t\t\t\t// Handle props that can temporarily get out of sync with the parent\n\t\t\t\t/** @type {Record<string, (v?: unknown) => unknown>} */\n\t\t\t\ttarget.special[key] = prop(\n\t\t\t\t\t{\n\t\t\t\t\t\tget [key]() {\n\t\t\t\t\t\t\treturn target.props[key];\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t/** @type {string} */ (key),\n\t\t\t\t\tPROPS_IS_UPDATED\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\tset_active_effect(previous_effect);\n\t\t\t}\n\t\t}\n\n\t\ttarget.special[key](value);\n\t\tupdate(target.version); // $$props is coarse-grained: when $$props.x is updated, usages of $$props.y etc are also rerun\n\t\treturn true;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\tif (key in target.props) {\n\t\t\treturn {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: target.props[key]\n\t\t\t};\n\t\t}\n\t},\n\tdeleteProperty(target, key) {\n\t\t// Svelte 4 allowed for deletions on $$restProps\n\t\tif (target.exclude.includes(key)) return true;\n\t\ttarget.exclude.push(key);\n\t\tupdate(target.version);\n\t\treturn true;\n\t},\n\thas(target, key) {\n\t\tif (target.exclude.includes(key)) return false;\n\t\treturn key in target.props;\n\t},\n\townKeys(target) {\n\t\treturn Reflect.ownKeys(target.props).filter((key) => !target.exclude.includes(key));\n\t}\n};\n\n/**\n * @param {Record<string, unknown>} props\n * @param {string[]} exclude\n * @returns {Record<string, unknown>}\n */\nexport function legacy_rest_props(props, exclude) {\n\treturn new Proxy(\n\t\t{\n\t\t\tprops,\n\t\t\texclude,\n\t\t\tspecial: {},\n\t\t\tversion: source(0),\n\t\t\t// TODO this is only necessary because we need to track component\n\t\t\t// destruction inside `prop`, because of `bind:this`, but it\n\t\t\t// seems likely that we can simplify `bind:this` instead\n\t\t\tparent_effect: /** @type {Effect} */ (active_effect)\n\t\t},\n\t\tlegacy_rest_props_handler\n\t);\n}\n\n/**\n * The proxy handler for spread props. Handles the incoming array of props\n * that looks like `() => { dynamic: props }, { static: prop }, ..` and wraps\n * them so that the whole thing is passed to the component as the `$$props` argument.\n * @type {ProxyHandler<{ props: Array<Record<string | symbol, unknown> | (() => Record<string | symbol, unknown>)> }>}}\n */\nconst spread_props_handler = {\n\tget(target, key) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (typeof p === 'object' && p !== null && key in p) return p[key];\n\t\t}\n\t},\n\tset(target, key, value) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tconst desc = get_descriptor(p, key);\n\t\t\tif (desc && desc.set) {\n\t\t\t\tdesc.set(value);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (typeof p === 'object' && p !== null && key in p) {\n\t\t\t\tconst descriptor = get_descriptor(p, key);\n\t\t\t\tif (descriptor && !descriptor.configurable) {\n\t\t\t\t\t// Prevent a \"Non-configurability Report Error\": The target is an array, it does\n\t\t\t\t\t// not actually contain this property. If it is now described as non-configurable,\n\t\t\t\t\t// the proxy throws a validation error. Setting it to true avoids that.\n\t\t\t\t\tdescriptor.configurable = true;\n\t\t\t\t}\n\t\t\t\treturn descriptor;\n\t\t\t}\n\t\t}\n\t},\n\thas(target, key) {\n\t\t// To prevent a false positive `is_entry_props` in the `prop` function\n\t\tif (key === STATE_SYMBOL || key === LEGACY_PROPS) return false;\n\n\t\tfor (let p of target.props) {\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (p != null && key in p) return true;\n\t\t}\n\n\t\treturn false;\n\t},\n\townKeys(target) {\n\t\t/** @type {Array<string | symbol>} */\n\t\tconst keys = [];\n\n\t\tfor (let p of target.props) {\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (!p) continue;\n\n\t\t\tfor (const key in p) {\n\t\t\t\tif (!keys.includes(key)) keys.push(key);\n\t\t\t}\n\n\t\t\tfor (const key of Object.getOwnPropertySymbols(p)) {\n\t\t\t\tif (!keys.includes(key)) keys.push(key);\n\t\t\t}\n\t\t}\n\n\t\treturn keys;\n\t}\n};\n\n/**\n * @param {Array<Record<string, unknown> | (() => Record<string, unknown>)>} props\n * @returns {any}\n */\nexport function spread_props(...props) {\n\treturn new Proxy({ props }, spread_props_handler);\n}\n\n/**\n * This function is responsible for synchronizing a possibly bound prop with the inner component state.\n * It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.\n * @template V\n * @param {Record<string, unknown>} props\n * @param {string} key\n * @param {number} flags\n * @param {V | (() => V)} [fallback]\n * @returns {(() => V | ((arg: V) => V) | ((arg: V, mutation: boolean) => V))}\n */\nexport function prop(props, key, flags, fallback) {\n\tvar runes = !legacy_mode_flag || (flags & PROPS_IS_RUNES) !== 0;\n\tvar bindable = (flags & PROPS_IS_BINDABLE) !== 0;\n\tvar lazy = (flags & PROPS_IS_LAZY_INITIAL) !== 0;\n\n\tvar fallback_value = /** @type {V} */ (fallback);\n\tvar fallback_dirty = true;\n\tvar fallback_signal = /** @type {Derived<V> | undefined} */ (undefined);\n\n\tvar get_fallback = () => {\n\t\tif (lazy && runes) {\n\t\t\tfallback_signal ??= derived(/** @type {() => V} */ (fallback));\n\t\t\treturn get(fallback_signal);\n\t\t}\n\n\t\tif (fallback_dirty) {\n\t\t\tfallback_dirty = false;\n\n\t\t\tfallback_value = lazy\n\t\t\t\t? untrack(/** @type {() => V} */ (fallback))\n\t\t\t\t: /** @type {V} */ (fallback);\n\t\t}\n\n\t\treturn fallback_value;\n\t};\n\n\t/** @type {((v: V) => void) | undefined} */\n\tlet setter;\n\n\tif (bindable) {\n\t\t// Can be the case when someone does `mount(Component, props)` with `let props = $state({...})`\n\t\t// or `createClassComponent(Component, props)`\n\t\tvar is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props;\n\n\t\tsetter =\n\t\t\tget_descriptor(props, key)?.set ??\n\t\t\t(is_entry_props && key in props ? (v) => (props[key] = v) : undefined);\n\t}\n\n\t/** @type {V} */\n\tvar initial_value;\n\tvar is_store_sub = false;\n\n\tif (bindable) {\n\t\t[initial_value, is_store_sub] = capture_store_binding(() => /** @type {V} */ (props[key]));\n\t} else {\n\t\tinitial_value = /** @type {V} */ (props[key]);\n\t}\n\n\tif (initial_value === undefined && fallback !== undefined) {\n\t\tinitial_value = get_fallback();\n\n\t\tif (setter) {\n\t\t\tif (runes) e.props_invalid_value(key);\n\t\t\tsetter(initial_value);\n\t\t}\n\t}\n\n\t/** @type {() => V} */\n\tvar getter;\n\n\tif (runes) {\n\t\tgetter = () => {\n\t\t\tvar value = /** @type {V} */ (props[key]);\n\t\t\tif (value === undefined) return get_fallback();\n\t\t\tfallback_dirty = true;\n\t\t\treturn value;\n\t\t};\n\t} else {\n\t\tgetter = () => {\n\t\t\tvar value = /** @type {V} */ (props[key]);\n\n\t\t\tif (value !== undefined) {\n\t\t\t\t// in legacy mode, we don't revert to the fallback value\n\t\t\t\t// if the prop goes from defined to undefined. The easiest\n\t\t\t\t// way to model this is to make the fallback undefined\n\t\t\t\t// as soon as the prop has a value\n\t\t\t\tfallback_value = /** @type {V} */ (undefined);\n\t\t\t}\n\n\t\t\treturn value === undefined ? fallback_value : value;\n\t\t};\n\t}\n\n\t// prop is never written to — we only need a getter\n\tif (runes && (flags & PROPS_IS_UPDATED) === 0) {\n\t\treturn getter;\n\t}\n\n\t// prop is written to, but the parent component had `bind:foo` which\n\t// means we can just call `$$props.foo = value` directly\n\tif (setter) {\n\t\tvar legacy_parent = props.$$legacy;\n\t\treturn /** @type {() => V} */ (\n\t\t\tfunction (/** @type {V} */ value, /** @type {boolean} */ mutation) {\n\t\t\t\tif (arguments.length > 0) {\n\t\t\t\t\t// We don't want to notify if the value was mutated and the parent is in runes mode.\n\t\t\t\t\t// In that case the state proxy (if it exists) should take care of the notification.\n\t\t\t\t\t// If the parent is not in runes mode, we need to notify on mutation, too, that the prop\n\t\t\t\t\t// has changed because the parent will not be able to detect the change otherwise.\n\t\t\t\t\tif (!runes || !mutation || legacy_parent || is_store_sub) {\n\t\t\t\t\t\t/** @type {Function} */ (setter)(mutation ? getter() : value);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\n\t\t\t\treturn getter();\n\t\t\t}\n\t\t);\n\t}\n\n\t// Either prop is written to, but there's no binding, which means we\n\t// create a derived that we can write to locally.\n\t// Or we are in legacy mode where we always create a derived to replicate that\n\t// Svelte 4 did not trigger updates when a primitive value was updated to the same value.\n\tvar overridden = false;\n\n\tvar d = ((flags & PROPS_IS_IMMUTABLE) !== 0 ? derived : derived_safe_equal)(() => {\n\t\toverridden = false;\n\t\treturn getter();\n\t});\n\n\tif (DEV) {\n\t\td.label = key;\n\t}\n\n\t// Capture the initial value if it's bindable\n\tif (bindable) get(d);\n\n\tvar parent_effect = /** @type {Effect} */ (active_effect);\n\n\treturn /** @type {() => V} */ (\n\t\tfunction (/** @type {any} */ value, /** @type {boolean} */ mutation) {\n\t\t\tif (arguments.length > 0) {\n\t\t\t\tconst new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;\n\n\t\t\t\tset(d, new_value);\n\t\t\t\toverridden = true;\n\n\t\t\t\tif (fallback_value !== undefined) {\n\t\t\t\t\tfallback_value = new_value;\n\t\t\t\t}\n\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\t// special case — avoid recalculating the derived if we're in a\n\t\t\t// teardown function and the prop was overridden locally, or the\n\t\t\t// component was already destroyed (people could access props in a timeout)\n\t\t\tif ((is_destroying_effect && overridden) || (parent_effect.f & DESTROYED) !== 0) {\n\t\t\t\treturn d.v;\n\t\t\t}\n\n\t\t\treturn get(d);\n\t\t}\n\t);\n}\n","// generated during release, do not modify\n\n/**\n * The current version, as set in package.json.\n * @type {string}\n */\nexport const VERSION = '5.57.0';\nexport const PUBLIC_VERSION = '5';\n","import { PUBLIC_VERSION } from '../version.js';\n\nif (typeof window !== 'undefined') {\n\t// @ts-expect-error\n\t((window.__svelte ??= {}).v ??= new Set()).add(PUBLIC_VERSION);\n}\n","/** Shared types. These mirror the JSON the backend produces. */\n\nexport type Category = \"personal\" | \"project\" | \"foundation\";\nexport type Visibility = \"public\" | \"private\";\nexport type ViewName = \"day\" | \"week\" | \"month\" | \"year\" | \"agenda\";\nexport type SortName = \"start\" | \"-start\" | \"title\" | \"-title\";\n\nexport const CATEGORIES: readonly Category[] = [\"personal\", \"project\", \"foundation\"];\nexport const VIEWS: readonly ViewName[] = [\"day\", \"week\", \"month\", \"year\", \"agenda\"];\n\nexport interface CalendarEvent {\n id: number;\n shortlink: string;\n shortlink_url: string;\n title: string;\n category: Category;\n visibility: Visibility;\n /** ISO 8601 UTC, e.g. 2026-01-01T10:00:00Z */\n start: string;\n end: string;\n all_day: boolean;\n description: string;\n location: string;\n url: string;\n project: string | null;\n /** The IANA zone the organiser entered the times in, e.g. \"Europe/Berlin\". */\n timezone: string;\n owner: string;\n created_at: string;\n updated_at: string;\n}\n\n/** The shape POSTed or PUT to /api/events. */\nexport interface EventDraft {\n title: string;\n category: Category;\n visibility: Visibility;\n start: string;\n end: string;\n all_day: boolean;\n description: string;\n location: string;\n url: string;\n project: string | null;\n timezone: string;\n}\n\nexport interface SessionInfo {\n authenticated: boolean;\n uid?: string | null;\n fullname?: string | null;\n email?: string | null;\n is_member?: boolean;\n is_chair?: boolean;\n projects?: string[];\n committees?: string[];\n login_url?: string;\n logout_url?: string;\n}\n\nexport interface Calendars {\n uid: string | null;\n authenticated: boolean;\n is_member: boolean;\n projects: string[];\n committees: string[];\n can_create: {\n personal: boolean;\n project: string[];\n project_private: string[];\n foundation: boolean;\n };\n title: string;\n /** \"local\", or an IANA zone name such as \"UTC\" or \"Europe/Berlin\". */\n default_display_zone: string;\n}\n\nexport interface Filters {\n categories: Set<Category>;\n /** Empty means \"every project the events happen to belong to\". */\n projects: Set<string>;\n visibility: Visibility | \"all\";\n search: string;\n sort: SortName;\n}\n","/**\n * Where the app is mounted.\n *\n * The calendar usually lives at the root of a host, but it can be mounted in a\n * sub-directory instead - `https://calendar.apache.org/calendar/` rather than\n * `https://calendar.apache.org/`. The prefix is a deployment decision, not a\n * build-time one: `frontend/dist` is committed to the repository and shared\n * between deployments, so the same build has to work either way.\n *\n * The backend therefore rewrites the `<base href>` in index.html to match\n * `server.base_path` from its config, and everything here reads the answer back\n * out of `document.baseURI`. The browser uses the same tag to resolve the\n * script, stylesheet and favicon, which is why relative URLs in the page keep\n * working on a nested route such as /calendar/e/AbCd2345.\n */\n\n/** The mount point, with no trailing slash: \"\" at the root, or \"/calendar\". */\nexport function basePath(): string {\n const path = baseUrl().pathname;\n return path === \"/\" ? \"\" : path.replace(/\\/+$/, \"\");\n}\n\n/** The absolute base URL the document resolves relative URLs against. */\nexport function baseUrl(): URL {\n const href = globalThis.document?.baseURI;\n try {\n return new URL(href ?? \"/\", globalThis.location?.href ?? \"http://localhost/\");\n } catch {\n return new URL(\"http://localhost/\");\n }\n}\n\n/** An absolute path within the app: appPath(\"/help\") -> \"/calendar/help\". */\nexport function appPath(path: string): string {\n const suffix = path.startsWith(\"/\") ? path : `/${path}`;\n return `${basePath()}${suffix}` || \"/\";\n}\n\n/** An absolute path to an API endpoint. */\nexport function apiUrl(path: string): string {\n return appPath(`/api${path.startsWith(\"/\") ? path : `/${path}`}`);\n}\n\n/** An absolute path to a file shipped in the build, such as the logo. */\nexport function assetUrl(name: string): string {\n return appPath(`/${name.replace(/^\\/+/, \"\")}`);\n}\n\n/**\n * Strips the mount point off a browser path, so route matching does not have to\n * know about it. Returns null when the path is not inside the app at all.\n */\nexport function withoutBase(pathname: string): string | null {\n const prefix = basePath();\n if (!prefix) return pathname || \"/\";\n if (pathname === prefix) return \"/\";\n if (pathname.startsWith(`${prefix}/`)) return pathname.slice(prefix.length) || \"/\";\n return null;\n}\n\n/**\n * asfquart's OAuth endpoint, as mounted by this app.\n *\n * The backend hands back the real login and logout URLs in /api/session, and\n * those always win, because a deployment can move the endpoint with the\n * `oauth.uri` config key. These are the fallbacks used before that request has\n * come back, or if it fails - which is exactly when someone is most likely to\n * be reaching for the login link.\n *\n * They are not URL-encoded, for the same reason the backend does not encode\n * them: a mount point is restricted to unreserved URL characters.\n */\nconst DEFAULT_OAUTH_PATH = \"/auth\";\n\nexport function loginUrl(returnTo: string = appPath(\"/\")): string {\n return `${appPath(DEFAULT_OAUTH_PATH)}?login=${returnTo}`;\n}\n\nexport function logoutUrl(returnTo: string = appPath(\"/\")): string {\n return `${appPath(DEFAULT_OAUTH_PATH)}?logout=${returnTo}`;\n}\n","/**\n * The API client.\n *\n * Paths here are given relative to /api; apiUrl() puts the deployment's mount\n * point in front, so the client works whether the app is served from the root\n * of a host or from a sub-directory.\n *\n * Every request carries X-No-Redirect so asfquart answers an unauthenticated\n * API call with a 401 instead of bouncing the fetch to the OAuth provider.\n */\n\nimport type { CalendarEvent, Calendars, EventDraft, SessionInfo } from \"./types\";\nimport type { ImportPreview, ImportResult, ResolvedImportSettings } from \"./importing\";\nimport { apiUrl } from \"./base\";\n\nexport class ApiError extends Error {\n readonly status: number;\n readonly field: string | null;\n\n constructor(message: string, status: number, field: string | null = null) {\n super(message);\n this.name = \"ApiError\";\n this.status = status;\n this.field = field;\n }\n\n /** True when logging in might fix it. */\n get needsLogin(): boolean {\n return this.status === 401;\n }\n}\n\nasync function request<T>(method: string, path: string, body?: unknown): Promise<T> {\n // FormData carries its own multipart boundary, so the browser has to set the\n // content type; naming it ourselves would produce a body nothing can parse.\n const isUpload = typeof FormData !== \"undefined\" && body instanceof FormData;\n let response: Response;\n try {\n response = await fetch(apiUrl(path), {\n method,\n credentials: \"same-origin\",\n headers: {\n Accept: \"application/json\",\n \"X-No-Redirect\": \"1\",\n ...(body === undefined || isUpload ? {} : { \"Content-Type\": \"application/json\" }),\n },\n ...(body === undefined ? {} : { body: isUpload ? (body as FormData) : JSON.stringify(body) }),\n });\n } catch {\n throw new ApiError(\"Could not reach the calendar service.\", 0);\n }\n\n if (response.status === 204) return undefined as T;\n\n const text = await response.text();\n let parsed: unknown = null;\n if (text) {\n try {\n parsed = JSON.parse(text);\n } catch {\n parsed = null;\n }\n }\n\n if (!response.ok) {\n const details = (parsed ?? {}) as { error?: string; field?: string };\n throw new ApiError(\n details.error ?? `Request failed with status ${response.status}`,\n response.status,\n details.field ?? null,\n );\n }\n\n return parsed as T;\n}\n\nexport interface EventQuery {\n start?: Date | string;\n end?: Date | string;\n categories?: readonly string[];\n projects?: readonly string[];\n visibility?: string;\n owner?: string;\n q?: string;\n sort?: string;\n limit?: number;\n}\n\nexport function buildQuery(query: EventQuery): string {\n const params = new URLSearchParams();\n const stamp = (value: Date | string) => (value instanceof Date ? value.toISOString() : value);\n if (query.start) params.set(\"start\", stamp(query.start));\n if (query.end) params.set(\"end\", stamp(query.end));\n for (const category of query.categories ?? []) params.append(\"category\", category);\n for (const project of query.projects ?? []) params.append(\"project\", project);\n if (query.visibility && query.visibility !== \"all\") params.set(\"visibility\", query.visibility);\n if (query.owner) params.set(\"owner\", query.owner);\n if (query.q) params.set(\"q\", query.q);\n if (query.sort) params.set(\"sort\", query.sort);\n if (query.limit) params.set(\"limit\", String(query.limit));\n const encoded = params.toString();\n return encoded ? `?${encoded}` : \"\";\n}\n\nexport const api = {\n session: () => request<SessionInfo>(\"GET\", \"/session\"),\n\n calendars: () => request<Calendars>(\"GET\", \"/calendars\"),\n\n events: async (query: EventQuery = {}): Promise<CalendarEvent[]> => {\n const body = await request<{ events: CalendarEvent[] }>(\"GET\", `/events${buildQuery(query)}`);\n return body.events;\n },\n\n event: async (id: number): Promise<CalendarEvent> => {\n const body = await request<{ event: CalendarEvent }>(\"GET\", `/events/${id}`);\n return body.event;\n },\n\n byShortlink: async (token: string): Promise<CalendarEvent> => {\n const body = await request<{ event: CalendarEvent }>(\"GET\", `/shortlink/${encodeURIComponent(token)}`);\n return body.event;\n },\n\n create: async (draft: EventDraft): Promise<CalendarEvent> => {\n const body = await request<{ event: CalendarEvent }>(\"POST\", \"/events\", draft);\n return body.event;\n },\n\n update: async (id: number, draft: EventDraft): Promise<CalendarEvent> => {\n const body = await request<{ event: CalendarEvent }>(\"PUT\", `/events/${id}`, draft);\n return body.event;\n },\n\n remove: (id: number) => request<{ deleted: number }>(\"DELETE\", `/events/${id}`),\n\n /** Reads an .ics file and says what is in it, without saving anything. */\n previewImport: (file: File) => {\n const body = new FormData();\n body.append(\"file\", file);\n return request<ImportPreview>(\"POST\", \"/import/preview\", body);\n },\n\n /** Turns an .ics file into events on the chosen calendar. */\n runImport: (file: File, settings: ResolvedImportSettings) => {\n const body = new FormData();\n body.append(\"file\", file);\n body.append(\"category\", settings.category);\n if (settings.visibility) body.append(\"visibility\", settings.visibility);\n if (settings.project) body.append(\"project\", settings.project);\n return request<ImportResult>(\"POST\", \"/import\", body);\n },\n\n icsUrl: (id: number) => apiUrl(`/events/${id}.ics`),\n\n feedUrl: (query: EventQuery = {}) => apiUrl(`/events.ics${buildQuery(query)}`),\n};\n","/**\n * Date helpers.\n *\n * Everything here works in the browser's local timezone, which is what a\n * calendar grid should do. The backend stores and returns UTC; the conversion\n * happens when a date string is parsed.\n *\n * All-day events are the exception: the backend snaps them to UTC midnight, so\n * we read their date parts in UTC to decide which days they cover. Otherwise a\n * whole-day event would appear to start the evening before for anyone west of\n * Greenwich.\n */\n\nexport const MINUTE = 60_000;\nexport const HOUR = 60 * MINUTE;\nexport const DAY = 24 * HOUR;\n\nexport const WEEKDAY_NAMES = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\nexport const MONTH_NAMES = [\n \"January\", \"February\", \"March\", \"April\", \"May\", \"June\",\n \"July\", \"August\", \"September\", \"October\", \"November\", \"December\",\n];\n\n/** Monday. ISO weeks are the ASF norm and match the WEEKDAY_NAMES above. */\nexport const WEEK_STARTS_ON = 1;\n\nexport function startOfDay(date: Date): Date {\n const copy = new Date(date);\n copy.setHours(0, 0, 0, 0);\n return copy;\n}\n\nexport function endOfDay(date: Date): Date {\n const copy = startOfDay(date);\n copy.setDate(copy.getDate() + 1);\n return copy;\n}\n\nexport function addDays(date: Date, count: number): Date {\n const copy = new Date(date);\n copy.setDate(copy.getDate() + count);\n return copy;\n}\n\nexport function addMonths(date: Date, count: number): Date {\n const copy = new Date(date);\n const targetDay = copy.getDate();\n copy.setDate(1);\n copy.setMonth(copy.getMonth() + count);\n // Clamp: 31 January plus one month is 28/29 February, not 3 March.\n const lastDay = daysInMonth(copy.getFullYear(), copy.getMonth());\n copy.setDate(Math.min(targetDay, lastDay));\n return copy;\n}\n\nexport function addYears(date: Date, count: number): Date {\n return addMonths(date, count * 12);\n}\n\nexport function daysInMonth(year: number, month: number): number {\n return new Date(year, month + 1, 0).getDate();\n}\n\nexport function startOfWeek(date: Date, weekStartsOn = WEEK_STARTS_ON): Date {\n const copy = startOfDay(date);\n const shift = (copy.getDay() - weekStartsOn + 7) % 7;\n copy.setDate(copy.getDate() - shift);\n return copy;\n}\n\nexport function startOfMonth(date: Date): Date {\n const copy = startOfDay(date);\n copy.setDate(1);\n return copy;\n}\n\nexport function startOfYear(date: Date): Date {\n const copy = startOfMonth(date);\n copy.setMonth(0);\n return copy;\n}\n\nexport function isSameDay(a: Date, b: Date): boolean {\n return (\n a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate()\n );\n}\n\nexport function isToday(date: Date, now: Date = new Date()): boolean {\n return isSameDay(date, now);\n}\n\nexport function isWeekend(date: Date): boolean {\n const day = date.getDay();\n return day === 0 || day === 6;\n}\n\n/**\n * The six-week grid a month view shows: always 42 days, starting on the first\n * WEEK_STARTS_ON on or before the 1st. A fixed size keeps the grid from\n * jumping about as the user pages through months.\n */\nexport function monthGrid(date: Date, weekStartsOn = WEEK_STARTS_ON): Date[] {\n const first = startOfWeek(startOfMonth(date), weekStartsOn);\n return Array.from({ length: 42 }, (_, index) => addDays(first, index));\n}\n\n/** The seven days of the week containing `date`. */\nexport function weekDays(date: Date, weekStartsOn = WEEK_STARTS_ON): Date[] {\n const first = startOfWeek(date, weekStartsOn);\n return Array.from({ length: 7 }, (_, index) => addDays(first, index));\n}\n\n/** The twelve first-of-the-month dates for the year containing `date`. */\nexport function yearMonths(date: Date): Date[] {\n const january = startOfYear(date);\n return Array.from({ length: 12 }, (_, index) => new Date(january.getFullYear(), index, 1));\n}\n\nexport interface DateRange {\n start: Date;\n end: Date;\n}\n\n/**\n * The window of time a view needs loaded. The month view asks for its whole\n * 42-day grid, not just the calendar month, so events from the neighbouring\n * months that are visible in the grid are there too.\n */\nexport function rangeForView(view: string, cursor: Date): DateRange {\n switch (view) {\n case \"day\":\n return { start: startOfDay(cursor), end: endOfDay(cursor) };\n case \"week\": {\n const first = startOfWeek(cursor);\n return { start: first, end: addDays(first, 7) };\n }\n case \"year\": {\n const first = startOfYear(cursor);\n return { start: first, end: new Date(first.getFullYear() + 1, 0, 1) };\n }\n case \"agenda\": {\n const first = startOfDay(cursor);\n return { start: first, end: addDays(first, 90) };\n }\n case \"month\":\n default: {\n const grid = monthGrid(cursor);\n return { start: grid[0], end: addDays(grid[41], 1) };\n }\n }\n}\n\n/** Moves the cursor one view-sized step forwards or backwards. */\nexport function step(view: string, cursor: Date, direction: number): Date {\n switch (view) {\n case \"day\":\n return addDays(cursor, direction);\n case \"week\":\n return addDays(cursor, 7 * direction);\n case \"year\":\n return addYears(cursor, direction);\n case \"agenda\":\n return addDays(cursor, 30 * direction);\n case \"month\":\n default:\n return addMonths(cursor, direction);\n }\n}\n\n/** A stable YYYY-MM-DD key for a local date, used to bucket events by day. */\nexport function dayKey(date: Date): string {\n const year = String(date.getFullYear()).padStart(4, \"0\");\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n return `${year}-${month}-${day}`;\n}\n\n/** The inverse of dayKey(), for reading dates back out of form fields. */\nexport function fromDayKey(key: string): Date {\n const [year, month, day] = key.split(\"-\").map(Number);\n return new Date(year, (month ?? 1) - 1, day ?? 1);\n}\n\n// ---- formatting -----------------------------------------------------------\n\nexport function formatTime(date: Date): string {\n return `${String(date.getHours()).padStart(2, \"0\")}:${String(date.getMinutes()).padStart(2, \"0\")}`;\n}\n\nexport function formatDate(date: Date): string {\n return `${date.getDate()} ${MONTH_NAMES[date.getMonth()]} ${date.getFullYear()}`;\n}\n\nexport function formatMonthYear(date: Date): string {\n return `${MONTH_NAMES[date.getMonth()]} ${date.getFullYear()}`;\n}\n\n/** The heading shown above each view. */\nexport function formatViewTitle(view: string, cursor: Date): string {\n switch (view) {\n case \"day\":\n return formatDate(cursor);\n case \"week\": {\n const days = weekDays(cursor);\n const first = days[0];\n const last = days[6];\n if (first.getMonth() === last.getMonth()) {\n return `${first.getDate()} - ${last.getDate()} ${formatMonthYear(first)}`;\n }\n if (first.getFullYear() === last.getFullYear()) {\n return `${first.getDate()} ${MONTH_NAMES[first.getMonth()]} - ${last.getDate()} ${formatMonthYear(last)}`;\n }\n return `${formatDate(first)} - ${formatDate(last)}`;\n }\n case \"year\":\n return String(cursor.getFullYear());\n case \"agenda\":\n return `From ${formatDate(cursor)}`;\n case \"month\":\n default:\n return formatMonthYear(cursor);\n }\n}\n\n/** Formats a value for an <input type=\"datetime-local\">. */\nexport function toLocalInput(date: Date): string {\n return `${dayKey(date)}T${formatTime(date)}`;\n}\n\n/** Formats a value for an <input type=\"date\">. */\nexport function toDateInput(date: Date): string {\n return dayKey(date);\n}\n\n/** Reads an ISO 8601 string from the API into a Date. */\nexport function parseISO(value: string): Date {\n return new Date(value);\n}\n\n/** Serialises a Date for the API. */\nexport function toISO(date: Date): string {\n return date.toISOString().replace(/\\.\\d{3}Z$/, \"Z\");\n}\n","/**\n * Timezone handling.\n *\n * There are three separate ideas here, and it helps to keep them apart:\n *\n * - The **event timezone** is what the organiser meant when they typed the\n * times in: \"15:00 in Berlin\". It is stored with the event.\n * - The **display timezone** is the clock the reader wants the calendar drawn\n * on. A grid has one time axis, so there is exactly one of these.\n * - **Comparison timezones** are extra clocks shown alongside, so you can see\n * at a glance what 15:00 in Berlin is where you are.\n *\n * The instant itself is always the same; only the wall clock changes.\n *\n * Everything below works with \"wall dates\". A wall date is an ordinary `Date`\n * whose *local* getters (getHours, getDate, ...) read as the wall clock in some\n * other zone. That means the existing calendar-grid arithmetic keeps working\n * unchanged - it just operates on wall dates rather than on instants - and only\n * the edges of the app have to convert.\n */\n\nimport { formatTime } from \"./dates\";\n\n/**\n * A zone to display in: an IANA name such as \"Europe/Berlin\", or the sentinel\n * \"local\" meaning whatever the browser's own zone happens to be. The sentinel\n * is kept rather than resolved once, so a laptop that moves keeps up.\n */\nexport type DisplayZone = string;\n\nexport const LOCAL: DisplayZone = \"local\";\nexport const UTC = \"UTC\";\n\nexport function isLocal(zone: DisplayZone): boolean {\n return zone === LOCAL;\n}\n\n/** The IANA name a display zone refers to. */\nexport function resolveZone(zone: DisplayZone): string {\n return isLocal(zone) ? browserZone() : zone;\n}\n\n/** Offset of the browser's own zone at an instant, in ms east of UTC. */\nexport function localOffsetMs(instant: Date): number {\n return -instant.getTimezoneOffset() * 60_000;\n}\n\nconst formatters = new Map<string, Intl.DateTimeFormat>();\n\nfunction partsFormatter(timeZone: string): Intl.DateTimeFormat {\n let formatter = formatters.get(timeZone);\n if (!formatter) {\n formatter = new Intl.DateTimeFormat(\"en-US\", {\n timeZone,\n hourCycle: \"h23\",\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n });\n formatters.set(timeZone, formatter);\n }\n return formatter;\n}\n\n/**\n * Offset of an IANA zone at an instant, in ms east of UTC.\n *\n * There is no direct API for this, so we ask Intl what the wall clock is in\n * that zone and compare it with the wall clock in UTC.\n */\nexport function zoneOffsetMs(instant: Date, timeZone: string): number {\n let parts: Intl.DateTimeFormatPart[];\n try {\n parts = partsFormatter(timeZone).formatToParts(instant);\n } catch {\n // An unknown zone should not take the page down with it.\n return 0;\n }\n const value = (type: string) => Number(parts.find((part) => part.type === type)?.value ?? 0);\n const asIfUtc = Date.UTC(\n value(\"year\"),\n value(\"month\") - 1,\n value(\"day\"),\n value(\"hour\"),\n value(\"minute\"),\n value(\"second\"),\n );\n // Compare whole seconds; Intl has no milliseconds to give us.\n return asIfUtc - Math.floor(instant.getTime() / 1000) * 1000;\n}\n\n/**\n * An instant, as a wall date in `timeZone`.\n *\n * The browser offset used for the conversion depends on the result, so we\n * solve for it: one correction is enough except for instants an hour either\n * side of a daylight-saving change, where a second settles it.\n */\nexport function toWallInZone(instant: Date, timeZone: string): Date {\n const target = instant.getTime() + zoneOffsetMs(instant, timeZone);\n let wall = new Date(target - localOffsetMs(instant));\n for (let attempt = 0; attempt < 2; attempt += 1) {\n const corrected = new Date(target - localOffsetMs(wall));\n if (corrected.getTime() === wall.getTime()) return wall;\n wall = corrected;\n }\n return wall;\n}\n\n/** A wall date in `timeZone`, back to the instant it names. */\nexport function fromWallInZone(wall: Date, timeZone: string): Date {\n const target = wall.getTime() + localOffsetMs(wall);\n let instant = new Date(target - zoneOffsetMs(wall, timeZone));\n for (let attempt = 0; attempt < 2; attempt += 1) {\n const corrected = new Date(target - zoneOffsetMs(instant, timeZone));\n if (corrected.getTime() === instant.getTime()) return instant;\n instant = corrected;\n }\n return instant;\n}\n\n/** An instant, as a wall date in the chosen display zone. */\nexport function toWall(instant: Date, zone: DisplayZone): Date {\n // The browser's own zone needs no conversion, and taking the short cut keeps\n // it exact even if Intl does not recognise the name the browser reports.\n return isLocal(zone) ? new Date(instant.getTime()) : toWallInZone(instant, zone);\n}\n\n/** A wall date in the chosen display zone, back to the instant it names. */\nexport function fromWall(wall: Date, zone: DisplayZone): Date {\n return isLocal(zone) ? new Date(wall.getTime()) : fromWallInZone(wall, zone);\n}\n\n/** Right now, as a wall date in the chosen display zone. */\nexport function nowInZone(zone: DisplayZone): Date {\n return toWall(new Date(), zone);\n}\n\n/** The browser's own IANA zone name, or UTC if it will not say. */\nexport function browserZone(): string {\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone || UTC;\n } catch {\n return UTC;\n }\n}\n\n/** Formats an offset in milliseconds as \"UTC+02:00\". */\nexport function offsetLabel(offsetMs: number): string {\n if (offsetMs === 0) return UTC;\n const sign = offsetMs < 0 ? \"-\" : \"+\";\n const total = Math.abs(Math.round(offsetMs / 60_000));\n const hours = String(Math.floor(total / 60)).padStart(2, \"0\");\n const minutes = String(total % 60).padStart(2, \"0\");\n return `UTC${sign}${hours}:${minutes}`;\n}\n\n/** The short name a zone goes by right now, such as \"CEST\" or \"GMT+5:30\". */\nexport function zoneAbbreviation(instant: Date, timeZone: string): string {\n try {\n const parts = new Intl.DateTimeFormat(\"en-US\", {\n timeZone,\n timeZoneName: \"short\",\n }).formatToParts(instant);\n return parts.find((part) => part.type === \"timeZoneName\")?.value ?? timeZone;\n } catch {\n return timeZone;\n }\n}\n\n// ---- naming ---------------------------------------------------------------\n\n/**\n * The place an IANA zone is named after: \"Europe/Copenhagen\" is Copenhagen,\n * \"America/Argentina/Buenos_Aires\" is Buenos Aires.\n *\n * These names are how the tz database identifies a zone, not a claim about\n * where the reader is, but they are a good deal more meaningful than \"UTC+2\"\n * on its own.\n */\nexport function zoneCity(timeZone: string): string {\n if (timeZone === UTC) return UTC;\n const segments = timeZone.split(\"/\");\n return (segments[segments.length - 1] ?? timeZone).replace(/_/g, \" \");\n}\n\n/** The part of the world a zone is filed under: \"Europe\", \"America\". */\nexport function zoneRegion(timeZone: string): string {\n if (timeZone === UTC) return UTC;\n return timeZone.split(\"/\")[0] ?? \"\";\n}\n\n/** \"Copenhagen (CEST, UTC+02:00)\" - the city, and why that clock. */\nexport function zoneLabel(timeZone: string, at: Date = new Date()): string {\n const offset = offsetLabel(zoneOffsetMs(at, timeZone));\n const abbreviation = zoneAbbreviation(at, timeZone);\n if (timeZone === UTC) return UTC;\n // Intl falls back to \"GMT+2\" when a zone has no letter abbreviation, which\n // would just repeat the offset.\n if (abbreviation.startsWith(\"GMT\") || abbreviation === offset) {\n return `${zoneCity(timeZone)} (${offset})`;\n }\n return `${zoneCity(timeZone)} (${abbreviation}, ${offset})`;\n}\n\n/** How a display zone is named in the UI, spelling out what \"local\" resolves to. */\nexport function describeDisplayZone(zone: DisplayZone, at: Date = new Date()): string {\n const resolved = resolveZone(zone);\n return isLocal(zone) ? `Local - ${zoneLabel(resolved, at)}` : zoneLabel(resolved, at);\n}\n\n/** The compact form used where there is no room, such as a column heading. */\nexport function shortZoneLabel(zone: DisplayZone, at: Date = new Date()): string {\n const resolved = resolveZone(zone);\n if (resolved === UTC) return UTC;\n const abbreviation = zoneAbbreviation(at, resolved);\n if (abbreviation.startsWith(\"GMT\")) return zoneCity(resolved);\n return abbreviation;\n}\n\n/** A longer description, for tooltips and the help page. */\nexport function explainDisplayZone(zone: DisplayZone, at: Date = new Date()): string {\n const resolved = resolveZone(zone);\n if (isLocal(zone)) {\n return `Times are shown in ${resolved}, your browser's timezone (${zoneLabel(resolved, at)}).`;\n }\n return `Times are shown in ${resolved} (${zoneLabel(resolved, at)}).`;\n}\n\n// ---- the zones on offer ---------------------------------------------------\n\n/**\n * The zones the display picker offers, grouped for an <optgroup>.\n *\n * This is a deliberately short list of well-known zones rather than all ~400\n * the tz database knows, because it is a \"show me this calendar in Tokyo time\"\n * control, not a data-entry field. The event form uses the full list, since an\n * organiser really might be anywhere.\n */\nexport const MAJOR_ZONES: { region: string; zones: string[] }[] = [\n { region: \"Coordinated\", zones: [UTC] },\n {\n region: \"Americas\",\n zones: [\n \"Pacific/Honolulu\",\n \"America/Anchorage\",\n \"America/Los_Angeles\",\n \"America/Denver\",\n \"America/Chicago\",\n \"America/New_York\",\n \"America/Halifax\",\n \"America/Bogota\",\n \"America/Sao_Paulo\",\n \"America/Argentina/Buenos_Aires\",\n ],\n },\n {\n region: \"Europe and Africa\",\n zones: [\n \"Europe/London\",\n \"Europe/Lisbon\",\n \"Europe/Paris\",\n \"Europe/Berlin\",\n \"Europe/Madrid\",\n \"Europe/Rome\",\n \"Europe/Stockholm\",\n \"Europe/Warsaw\",\n \"Europe/Athens\",\n \"Europe/Kyiv\",\n \"Europe/Moscow\",\n \"Africa/Casablanca\",\n \"Africa/Lagos\",\n \"Africa/Cairo\",\n \"Africa/Nairobi\",\n \"Africa/Johannesburg\",\n ],\n },\n {\n region: \"Asia\",\n zones: [\n \"Asia/Jerusalem\",\n \"Asia/Dubai\",\n \"Asia/Karachi\",\n \"Asia/Kolkata\",\n \"Asia/Kathmandu\",\n \"Asia/Dhaka\",\n \"Asia/Bangkok\",\n \"Asia/Jakarta\",\n \"Asia/Shanghai\",\n \"Asia/Hong_Kong\",\n \"Asia/Singapore\",\n \"Asia/Seoul\",\n \"Asia/Tokyo\",\n ],\n },\n {\n region: \"Oceania\",\n zones: [\n \"Australia/Perth\",\n \"Australia/Adelaide\",\n \"Australia/Brisbane\",\n \"Australia/Sydney\",\n \"Pacific/Auckland\",\n ],\n },\n];\n\n/** Every zone in MAJOR_ZONES, flattened. */\nexport function majorZones(): string[] {\n return MAJOR_ZONES.flatMap((group) => group.zones);\n}\n\n/** True if the string names a zone this browser can actually work with. */\nexport function isKnownZone(timeZone: string): boolean {\n if (!timeZone || timeZone === LOCAL) return false;\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * The zones to offer in the event form.\n *\n * Modern browsers can list every zone they know. Where they cannot, fall back\n * to the major list, with the browser's own zone added so it is always\n * selectable.\n */\nexport function zoneList(): string[] {\n const supported = (Intl as { supportedValuesOf?: (key: string) => string[] }).supportedValuesOf;\n let names: string[];\n try {\n names = supported ? supported(\"timeZone\") : majorZones();\n } catch {\n names = majorZones();\n }\n const all = new Set<string>([UTC, browserZone(), ...names]);\n return [...all].sort();\n}\n\n/**\n * Tidies a stored or configured display zone into one we can use.\n *\n * Accepts the \"local\"/\"utc\" spellings the two-way switch used to store, so an\n * existing preference survives the upgrade.\n */\nexport function normaliseZone(value: string | null | undefined, fallback: DisplayZone = UTC): DisplayZone {\n const text = (value ?? \"\").trim();\n if (!text) return fallback;\n if (text.toLowerCase() === LOCAL) return LOCAL;\n if (text.toLowerCase() === \"utc\") return UTC;\n return isKnownZone(text) ? text : fallback;\n}\n\n/**\n * Drops duplicates and anything already shown as the primary zone.\n *\n * \"local\" and the IANA name it resolves to are the same clock, so only one of\n * them is worth a column.\n */\nexport function uniqueZones(zones: DisplayZone[], primary?: DisplayZone): DisplayZone[] {\n const seen = new Set<string>(primary === undefined ? [] : [resolveZone(primary)]);\n const kept: DisplayZone[] = [];\n for (const zone of zones) {\n const resolved = resolveZone(zone);\n if (seen.has(resolved)) continue;\n seen.add(resolved);\n kept.push(zone);\n }\n return kept;\n}\n\n/**\n * The clock reading in `other` for each hour of `day` as measured in `primary`.\n *\n * This is what fills the extra hour gutters in the week and day views: row 9 of\n * the grid is 09:00 in the primary zone, and this says what that same instant\n * reads as somewhere else.\n *\n * A week view shares one gutter across all seven columns, so the caller passes\n * a single reference day. The offset between two zones almost never changes\n * mid-week; when it does, because one of them shifts for daylight saving, the\n * labels are right for the reference day and an hour out for the rest.\n */\nexport function hourLabels(day: Date, primary: DisplayZone, other: DisplayZone, hours = 24): string[] {\n return Array.from({ length: hours }, (_unused, hour) => {\n const wall = new Date(day);\n wall.setHours(hour, 0, 0, 0);\n return formatTime(toWall(fromWall(wall, primary), other));\n });\n}\n","/**\n * Turning a flat list of events into something a grid can draw.\n */\n\nimport type { CalendarEvent, Category } from \"./types\";\nimport { dayKey, endOfDay, parseISO, startOfDay } from \"./dates\";\nimport type { DisplayZone } from \"./timezone\";\nimport { toWall } from \"./timezone\";\n\n/**\n * The start of an event as a wall date in the display zone.\n *\n * All-day events are a date rather than an instant: the backend snaps them to\n * whole UTC days, so we rebuild them from their UTC date parts and they land on\n * the same calendar day whichever zone is being displayed.\n */\nexport function eventStart(event: CalendarEvent, zone: DisplayZone = \"local\"): Date {\n const instant = parseISO(event.start);\n if (!event.all_day) return toWall(instant, zone);\n return new Date(instant.getUTCFullYear(), instant.getUTCMonth(), instant.getUTCDate());\n}\n\n/**\n * The end of an event as a wall date in the display zone, exclusive.\n *\n * The backend stores an exclusive end for all-day events (midnight of the day\n * after), which is what a grid wants too.\n */\nexport function eventEnd(event: CalendarEvent, zone: DisplayZone = \"local\"): Date {\n const instant = parseISO(event.end);\n if (!event.all_day) return toWall(instant, zone);\n return new Date(instant.getUTCFullYear(), instant.getUTCMonth(), instant.getUTCDate());\n}\n\nexport function durationMs(event: CalendarEvent): number {\n // The length of an event is the same in every zone, so read it off the\n // instants directly.\n return Math.max(0, parseISO(event.end).getTime() - parseISO(event.start).getTime());\n}\n\n/** True if the event overlaps the half-open window [from, to) of wall dates. */\nexport function overlaps(event: CalendarEvent, from: Date, to: Date, zone: DisplayZone = \"local\"): boolean {\n return eventStart(event, zone) < to && eventEnd(event, zone) > from;\n}\n\n/** True if any part of the event falls on the given day. */\nexport function occursOnDay(event: CalendarEvent, day: Date, zone: DisplayZone = \"local\"): boolean {\n return overlaps(event, startOfDay(day), endOfDay(day), zone);\n}\n\n/** True if the event covers more than a single day in the grid. */\nexport function isMultiDay(event: CalendarEvent, zone: DisplayZone = \"local\"): boolean {\n const start = eventStart(event, zone);\n const end = eventEnd(event, zone);\n if (end.getTime() <= start.getTime()) return false;\n // The end is exclusive, so an event finishing exactly at midnight still\n // belongs to the day before.\n return dayKey(start) !== dayKey(new Date(end.getTime() - 1));\n}\n\n/** The events falling on each of `days`, keyed by dayKey(). */\nexport function groupByDay(\n events: CalendarEvent[],\n days: Date[],\n zone: DisplayZone = \"local\",\n): Map<string, CalendarEvent[]> {\n const buckets = new Map<string, CalendarEvent[]>();\n for (const day of days) buckets.set(dayKey(day), []);\n for (const event of events) {\n for (const day of days) {\n if (occursOnDay(event, day, zone)) buckets.get(dayKey(day))!.push(event);\n }\n }\n const order = displayComparator(zone);\n for (const bucket of buckets.values()) bucket.sort(order);\n return buckets;\n}\n\n/** All-day and longer events first, then by start time, then by title. */\nexport function compareForDisplay(a: CalendarEvent, b: CalendarEvent, zone: DisplayZone = \"local\"): number {\n if (a.all_day !== b.all_day) return a.all_day ? -1 : 1;\n const byStart = eventStart(a, zone).getTime() - eventStart(b, zone).getTime();\n if (byStart !== 0) return byStart;\n const byLength = durationMs(b) - durationMs(a);\n if (byLength !== 0) return byLength;\n return a.title.localeCompare(b.title);\n}\n\n/** compareForDisplay bound to a zone, ready to hand to Array.sort. */\nexport function displayComparator(zone: DisplayZone = \"local\") {\n return (a: CalendarEvent, b: CalendarEvent) => compareForDisplay(a, b, zone);\n}\n\nexport interface PositionedEvent {\n event: CalendarEvent;\n /** Fraction of the day the event starts at, 0 to 1. */\n top: number;\n /** Fraction of the day the event occupies, greater than 0. */\n height: number;\n /** Which column of an overlapping cluster this event sits in. */\n column: number;\n /** How many columns the cluster needs. */\n columns: number;\n}\n\nconst MINIMUM_HEIGHT = 20 / (24 * 60); // 20 minutes, so short events stay clickable\n\n/**\n * Lays out one day's timed events side by side.\n *\n * Events that overlap in time are grouped into a cluster and given a column\n * each, so the caller can position them as `left: column/columns` of the\n * day's width. All-day events are not included; they belong in their own row.\n */\nexport function layoutDay(events: CalendarEvent[], day: Date, zone: DisplayZone = \"local\"): PositionedEvent[] {\n const dayStart = startOfDay(day).getTime();\n const dayEnd = endOfDay(day).getTime();\n const span = dayEnd - dayStart;\n\n const timed = events\n .filter((event) => !event.all_day && occursOnDay(event, day, zone))\n .sort(displayComparator(zone));\n\n const placed: PositionedEvent[] = timed.map((event) => {\n const from = Math.max(eventStart(event, zone).getTime(), dayStart);\n const to = Math.min(eventEnd(event, zone).getTime(), dayEnd);\n return {\n event,\n top: (from - dayStart) / span,\n height: Math.max((to - from) / span, MINIMUM_HEIGHT),\n column: 0,\n columns: 1,\n };\n });\n\n // Walk the events in order, closing a cluster whenever a gap appears.\n let cluster: PositionedEvent[] = [];\n let clusterEnd = -Infinity;\n\n const closeCluster = () => {\n if (cluster.length === 0) return;\n const columns = Math.max(...cluster.map((item) => item.column)) + 1;\n for (const item of cluster) item.columns = columns;\n cluster = [];\n clusterEnd = -Infinity;\n };\n\n for (const item of placed) {\n if (item.top >= clusterEnd) closeCluster();\n // The lowest column not used by anything this event overlaps.\n const taken = new Set(\n cluster.filter((other) => other.top + other.height > item.top).map((other) => other.column),\n );\n let column = 0;\n while (taken.has(column)) column += 1;\n item.column = column;\n cluster.push(item);\n clusterEnd = Math.max(clusterEnd, item.top + item.height);\n }\n closeCluster();\n\n return placed;\n}\n\n/** The all-day (or multi-day) events on a given day. */\nexport function allDayEvents(events: CalendarEvent[], day: Date, zone: DisplayZone = \"local\"): CalendarEvent[] {\n return events\n .filter((event) => event.all_day && occursOnDay(event, day, zone))\n .sort(displayComparator(zone));\n}\n\n/** Groups a sorted list into day sections, for the agenda view. */\nexport function agendaSections(\n events: CalendarEvent[],\n zone: DisplayZone = \"local\",\n): { key: string; date: Date; events: CalendarEvent[] }[] {\n const sections: { key: string; date: Date; events: CalendarEvent[] }[] = [];\n const seen = new Map<string, CalendarEvent[]>();\n for (const event of events) {\n const date = eventStart(event, zone);\n const key = dayKey(date);\n let bucket = seen.get(key);\n if (!bucket) {\n bucket = [];\n seen.set(key, bucket);\n sections.push({ key, date: startOfDay(date), events: bucket });\n }\n bucket.push(event);\n }\n return sections;\n}\n\n// ---- presentation ---------------------------------------------------------\n\n/** A short label for the calendar an event belongs to. */\nexport function calendarLabel(event: CalendarEvent): string {\n if (event.category === \"project\") return event.project ?? \"project\";\n if (event.category === \"foundation\") return \"foundation\";\n return \"personal\";\n}\n\nconst PROJECT_HUES = [8, 28, 48, 96, 150, 176, 200, 220, 256, 286, 310, 335];\n\n/**\n * A stable hue for a project, so the same project keeps its colour between\n * sessions and machines without us having to store one.\n */\nexport function projectHue(name: string): number {\n let hash = 0;\n for (let index = 0; index < name.length; index += 1) {\n hash = (hash * 31 + name.charCodeAt(index)) >>> 0;\n }\n return PROJECT_HUES[hash % PROJECT_HUES.length];\n}\n\n/** The CSS custom-property value used to tint an event chip. */\nexport function eventHue(event: CalendarEvent): number {\n if (event.category === \"personal\") return 265;\n if (event.category === \"foundation\") return 0;\n return projectHue(event.project ?? \"\");\n}\n\nexport function categoryLabel(category: Category): string {\n switch (category) {\n case \"personal\":\n return \"Personal\";\n case \"project\":\n return \"Project\";\n case \"foundation\":\n return \"Foundation\";\n }\n}\n","/**\n * Client-side filtering and sorting.\n *\n * The backend already restricts what a session may see; these filters are\n * about what the user wants to look at right now.\n */\n\nimport type { CalendarEvent, Calendars, Category, Filters, SortName } from \"./types\";\nimport { CATEGORIES } from \"./types\";\nimport { displayComparator, eventStart } from \"./events\";\nimport type { DisplayZone } from \"./timezone\";\n\n/**\n * The filter state a freshly loaded page starts with.\n *\n * When logged in, everything the user can reach is on: their own events, every\n * project they belong to, and the foundation calendar. That matches the way\n * people use a calendar - they want to see their week, not configure it first.\n */\nexport function defaultFilters(calendars: Calendars | null): Filters {\n return {\n categories: new Set<Category>(CATEGORIES),\n projects: new Set<string>(calendars?.projects ?? []),\n visibility: \"all\",\n search: \"\",\n sort: \"start\",\n };\n}\n\n/** True if the filters are letting everything through. */\nexport function isUnfiltered(filters: Filters, calendars: Calendars | null): boolean {\n const projects = calendars?.projects ?? [];\n return (\n filters.categories.size === CATEGORIES.length &&\n filters.projects.size === projects.length &&\n filters.visibility === \"all\" &&\n filters.search.trim() === \"\"\n );\n}\n\n/**\n * Whether a single event passes the current filters.\n *\n * The project filter only applies to project events; it would be surprising if\n * unticking a project also hid the foundation calendar. An event belonging to\n * a project the user is not a member of (a public one they can still see) is\n * shown whenever the project filter has not been narrowed.\n */\nexport function matches(event: CalendarEvent, filters: Filters, knownProjects: readonly string[] = []): boolean {\n if (!filters.categories.has(event.category)) return false;\n\n if (event.category === \"project\") {\n const project = event.project ?? \"\";\n const isKnown = knownProjects.includes(project);\n if (isKnown && !filters.projects.has(project)) return false;\n }\n\n if (filters.visibility !== \"all\" && event.visibility !== filters.visibility) return false;\n\n const needle = filters.search.trim().toLowerCase();\n if (needle) {\n const haystack = [event.title, event.description, event.location, event.project ?? \"\"]\n .join(\" \")\n .toLowerCase();\n if (!haystack.includes(needle)) return false;\n }\n\n return true;\n}\n\nexport function applyFilters(\n events: CalendarEvent[],\n filters: Filters,\n knownProjects: readonly string[] = [],\n): CalendarEvent[] {\n return events.filter((event) => matches(event, filters, knownProjects));\n}\n\nexport function sortEvents(\n events: CalendarEvent[],\n sort: SortName,\n zone: DisplayZone = \"local\",\n): CalendarEvent[] {\n const sorted = [...events];\n switch (sort) {\n case \"-start\":\n sorted.sort((a, b) => eventStart(b, zone).getTime() - eventStart(a, zone).getTime());\n break;\n case \"title\":\n sorted.sort((a, b) => a.title.localeCompare(b.title));\n break;\n case \"-title\":\n sorted.sort((a, b) => b.title.localeCompare(a.title));\n break;\n case \"start\":\n default:\n sorted.sort(displayComparator(zone));\n break;\n }\n return sorted;\n}\n\n/** Every project mentioned by the loaded events, plus the user's own. */\nexport function projectsInPlay(events: CalendarEvent[], calendars: Calendars | null): string[] {\n const names = new Set<string>(calendars?.projects ?? []);\n for (const event of events) {\n if (event.category === \"project\" && event.project) names.add(event.project);\n }\n return [...names].sort();\n}\n\n/** Toggles a value in a Set, returning a new Set so Svelte notices. */\nexport function toggle<T>(values: Set<T>, value: T): Set<T> {\n const next = new Set(values);\n if (next.has(value)) next.delete(value);\n else next.add(value);\n return next;\n}\n","/**\n * Building and checking event drafts.\n *\n * `canEdit` mirrors the backend's permission rules. It only decides whether to\n * show an Edit button; the backend is still the authority and will refuse a\n * request the rules do not allow.\n */\n\nimport type { CalendarEvent, Calendars, Category, EventDraft, Visibility } from \"./types\";\nimport { HOUR, startOfDay, toISO } from \"./dates\";\nimport { browserZone } from \"./timezone\";\n\n/** The default length of a new timed event. */\nexport const DEFAULT_LENGTH_MS = HOUR;\n\n/** The first calendar the user can actually write to. */\nexport function defaultCategory(calendars: Calendars | null): Category | null {\n const can = calendars?.can_create;\n if (!can) return null;\n if (can.project.length > 0) return \"project\";\n if (can.personal) return \"personal\";\n if (can.foundation) return \"foundation\";\n return null;\n}\n\nexport function canCreateAnything(calendars: Calendars | null): boolean {\n return defaultCategory(calendars) !== null;\n}\n\n/**\n * A blank draft starting at `when`.\n *\n * If `when` is midnight (the user clicked a day rather than a time slot) the\n * event is nudged to 09:00, which is a more useful default than \"all day at\n * the stroke of midnight\".\n */\nexport function newDraft(when: Date, calendars: Calendars | null, timezone?: string): EventDraft {\n const category = defaultCategory(calendars) ?? \"personal\";\n const start = new Date(when);\n if (start.getTime() === startOfDay(when).getTime()) start.setHours(9, 0, 0, 0);\n\n return {\n title: \"\",\n category,\n visibility: category === \"personal\" ? \"private\" : \"public\",\n start: toISO(start),\n end: toISO(new Date(start.getTime() + DEFAULT_LENGTH_MS)),\n all_day: false,\n description: \"\",\n location: \"\",\n url: \"\",\n project: category === \"project\" ? (calendars?.can_create.project[0] ?? null) : null,\n // New events are entered in the organiser's own timezone by default.\n timezone: timezone ?? browserZone(),\n };\n}\n\nexport function draftFromEvent(event: CalendarEvent): EventDraft {\n return {\n title: event.title,\n category: event.category,\n visibility: event.visibility,\n start: event.start,\n end: event.end,\n all_day: event.all_day,\n description: event.description,\n location: event.location,\n url: event.url,\n project: event.project,\n timezone: event.timezone || \"UTC\",\n };\n}\n\n/** Whether the signed-in user may edit or delete this event. */\nexport function canEdit(event: CalendarEvent, calendars: Calendars | null): boolean {\n if (!calendars?.authenticated) return false;\n\n switch (event.category) {\n case \"personal\":\n return event.owner === calendars.uid;\n case \"foundation\":\n return calendars.is_member;\n case \"project\": {\n const project = event.project ?? \"\";\n if (!project) return false;\n if (event.visibility === \"private\") return calendars.committees.includes(project);\n return calendars.projects.includes(project);\n }\n }\n}\n\n/** Whether the visibility can be offered for a category the user may write. */\nexport function allowedVisibilities(category: Category, calendars: Calendars | null): Visibility[] {\n if (category === \"personal\") return [\"private\"];\n if (category === \"foundation\") return calendars?.can_create.foundation ? [\"public\", \"private\"] : [];\n return (calendars?.can_create.project_private.length ?? 0) > 0 ? [\"public\", \"private\"] : [\"public\"];\n}\n","<script lang=\"ts\">\n import type { DisplayZone } from \"../lib/timezone\";\n import {\n LOCAL,\n MAJOR_ZONES,\n browserZone,\n explainDisplayZone,\n isLocal,\n shortZoneLabel,\n zoneLabel,\n } from \"../lib/timezone\";\n\n interface Props {\n /** The zone the calendar is drawn in. */\n zone: DisplayZone;\n /** The zone the picker is set to, used when switching away from local. */\n alternate: DisplayZone;\n onzone: (zone: DisplayZone) => void;\n onalternate: (zone: DisplayZone) => void;\n }\n\n let { zone, alternate, onzone, onalternate }: Props = $props();\n\n // Recomputed on every render, which is often enough: the labels only change\n // when a zone crosses a daylight-saving boundary.\n let now = $derived(new Date());\n let local = $derived(browserZone());\n let localLabel = $derived(zoneLabel(local, now));\n\n function pick(chosen: string) {\n onalternate(chosen);\n onzone(chosen);\n }\n</script>\n\n<div class=\"zones\" role=\"group\" aria-label=\"Display timezone\">\n <button\n type=\"button\"\n class=\"zone\"\n class:active={isLocal(zone)}\n aria-pressed={isLocal(zone)}\n title={explainDisplayZone(LOCAL, now)}\n onclick={() => onzone(LOCAL)}\n >\n <span class=\"lead\">Local</span>\n <span class=\"detail\">{localLabel}</span>\n </button>\n\n <label class=\"zone select\" class:active={!isLocal(zone)} title={explainDisplayZone(alternate, now)}>\n <select\n aria-label=\"Show the calendar in another timezone\"\n value={alternate}\n onchange={(event) => pick(event.currentTarget.value)}\n onclick={() => {\n if (isLocal(zone)) onzone(alternate);\n }}\n >\n {#each MAJOR_ZONES as group (group.region)}\n <optgroup label={group.region}>\n {#each group.zones as name (name)}\n <option value={name}>{zoneLabel(name, now)}</option>\n {/each}\n </optgroup>\n {/each}\n </select>\n <span class=\"badge\" aria-hidden=\"true\">{shortZoneLabel(alternate, now)}</span>\n </label>\n</div>\n\n<style>\n .zones {\n display: flex;\n align-items: stretch;\n border: 1px solid var(--border-strong);\n border-radius: var(--radius);\n overflow: hidden;\n }\n\n .zone {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 0;\n background: var(--bg-panel);\n border: 0;\n border-right: 1px solid var(--border);\n padding: 0.15rem 0.6rem;\n font-size: 12px;\n line-height: 1.25;\n text-align: left;\n white-space: nowrap;\n }\n\n .zone:last-child {\n border-right: 0;\n }\n\n .zone:hover {\n background: var(--bg-hover);\n }\n\n .zone.active {\n background: var(--bg-subtle);\n box-shadow: inset 0 -2px 0 var(--asf-red);\n }\n\n .lead {\n font-weight: 700;\n }\n\n .zone.active .lead {\n color: var(--asf-red);\n }\n\n .detail {\n color: var(--text-muted);\n font-size: 11px;\n max-width: 14rem;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n /* The select sits on top of the label so the whole cell is the hit area,\n while the badge underneath shows the short name in our own styling. */\n .zone.select {\n position: relative;\n cursor: pointer;\n justify-content: center;\n }\n\n .zone.select select {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n border: 0;\n padding: 0;\n cursor: pointer;\n }\n\n .badge {\n font-weight: 700;\n font-variant-numeric: tabular-nums;\n }\n\n .zone.select.active .badge {\n color: var(--asf-red);\n }\n\n .badge::after {\n content: \" \\25BE\";\n font-weight: 400;\n color: var(--text-muted);\n }\n</style>\n","<script lang=\"ts\">\n import type { SessionInfo, ViewName } from \"../lib/types\";\n import { VIEWS } from \"../lib/types\";\n import { formatViewTitle } from \"../lib/dates\";\n import type { DisplayZone } from \"../lib/timezone\";\n import { assetUrl, loginUrl, logoutUrl } from \"../lib/base\";\n import TimezoneSwitch from \"./TimezoneSwitch.svelte\";\n\n interface Props {\n title: string;\n view: ViewName;\n cursor: Date;\n session: SessionInfo | null;\n loading: boolean;\n canCreate: boolean;\n zone: DisplayZone;\n /** The zone the picker is parked on, used when switching away from local. */\n alternateZone: DisplayZone;\n helpOpen: boolean;\n docsOpen: boolean;\n onview: (view: ViewName) => void;\n onstep: (direction: number) => void;\n ontoday: () => void;\n oncreate: () => void;\n onimport: () => void;\n ontogglefilters: () => void;\n onzone: (zone: DisplayZone) => void;\n onalternatezone: (zone: DisplayZone) => void;\n onhelp: () => void;\n ondocs: () => void;\n }\n\n let {\n title,\n view,\n cursor,\n session,\n loading,\n canCreate,\n zone,\n alternateZone,\n helpOpen,\n docsOpen,\n onview,\n onstep,\n ontoday,\n oncreate,\n onimport,\n ontogglefilters,\n onzone,\n onalternatezone,\n onhelp,\n ondocs,\n }: Props = $props();\n\n let heading = $derived(formatViewTitle(view, cursor));\n</script>\n\n<header>\n <div class=\"brand\">\n <button type=\"button\" class=\"filters-toggle\" onclick={ontogglefilters} aria-label=\"Toggle filters\">\n ☰\n </button>\n <img src={assetUrl(\"icon.png\")} alt=\"\" width=\"28\" height=\"28\" />\n <h1>{title}</h1>\n </div>\n\n <div class=\"nav\">\n <button type=\"button\" class=\"btn\" onclick={ontoday}>Today</button>\n <div class=\"stepper\">\n <button type=\"button\" class=\"btn\" onclick={() => onstep(-1)} aria-label=\"Previous\">‹</button>\n <button type=\"button\" class=\"btn\" onclick={() => onstep(1)} aria-label=\"Next\">›</button>\n </div>\n <h2 aria-live=\"polite\">{heading}</h2>\n {#if loading}\n <span class=\"spinner\" role=\"status\" aria-label=\"Loading\"></span>\n {/if}\n </div>\n\n <div class=\"views\" role=\"tablist\" aria-label=\"Calendar view\">\n {#each VIEWS as name (name)}\n <button\n type=\"button\"\n role=\"tab\"\n class=\"view\"\n class:active={view === name}\n aria-selected={view === name}\n onclick={() => onview(name)}\n >\n {name}\n </button>\n {/each}\n </div>\n\n <TimezoneSwitch {zone} alternate={alternateZone} {onzone} onalternate={onalternatezone} />\n\n <div class=\"account\">\n <button type=\"button\" class=\"btn\" class:active={helpOpen} onclick={onhelp}>Help</button>\n <button type=\"button\" class=\"btn\" class:active={docsOpen} onclick={ondocs} title=\"HTTP API documentation\">\n API\n </button>\n {#if canCreate}\n <button type=\"button\" class=\"btn\" onclick={onimport} title=\"Import events from an .ics file\">\n Import\n </button>\n <button type=\"button\" class=\"btn primary\" onclick={oncreate}>New event</button>\n {/if}\n {#if session?.authenticated}\n <span class=\"who\" title={session.email ?? \"\"}>{session.fullname || session.uid}</span>\n <a class=\"btn\" href={session.logout_url ?? logoutUrl()}>Log out</a>\n {:else}\n <a class=\"btn primary\" href={session?.login_url ?? loginUrl()}>Log in</a>\n {/if}\n </div>\n</header>\n\n<style>\n header {\n display: flex;\n align-items: center;\n gap: 1rem;\n flex-wrap: wrap;\n padding: 0.5rem 0.9rem;\n background: var(--bg-panel);\n border-bottom: 1px solid var(--border);\n box-shadow: var(--shadow);\n z-index: 5;\n }\n\n .brand {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n }\n\n .brand img {\n border-radius: 4px;\n }\n\n h1 {\n margin: 0;\n font-size: 15px;\n font-weight: 700;\n white-space: nowrap;\n }\n\n h2 {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n white-space: nowrap;\n }\n\n .nav {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n }\n\n .stepper {\n display: flex;\n }\n\n .stepper .btn:first-child {\n border-radius: var(--radius) 0 0 var(--radius);\n }\n\n .stepper .btn:last-child {\n border-radius: 0 var(--radius) var(--radius) 0;\n margin-left: -1px;\n }\n\n .views {\n display: flex;\n border: 1px solid var(--border-strong);\n border-radius: var(--radius);\n overflow: hidden;\n }\n\n .view {\n background: var(--bg-panel);\n border: 0;\n border-right: 1px solid var(--border);\n padding: 0.35rem 0.7rem;\n text-transform: capitalize;\n font-size: 13px;\n }\n\n .view:last-child {\n border-right: 0;\n }\n\n .view:hover {\n background: var(--bg-hover);\n }\n\n .view.active {\n background: var(--asf-red);\n color: #fff;\n font-weight: 600;\n }\n\n .btn.active {\n background: var(--bg-subtle);\n box-shadow: inset 0 -2px 0 var(--asf-red);\n }\n\n .account {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin-left: auto;\n }\n\n .who {\n font-size: 13px;\n color: var(--text-muted);\n max-width: 12rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .filters-toggle {\n display: none;\n background: none;\n border: 0;\n font-size: 18px;\n padding: 0 0.3rem;\n }\n\n .spinner {\n width: 14px;\n height: 14px;\n border: 2px solid var(--border-strong);\n border-top-color: var(--asf-red);\n border-radius: 999px;\n animation: spin 0.7s linear infinite;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n @media (max-width: 60rem) {\n .filters-toggle {\n display: block;\n }\n\n .account {\n width: 100%;\n margin-left: 0;\n }\n }\n</style>\n","<script lang=\"ts\">\n import type { Calendars, Category, Filters, SortName, ViewName } from \"../lib/types\";\n import { CATEGORIES } from \"../lib/types\";\n import { categoryLabel, projectHue } from \"../lib/events\";\n import { toggle } from \"../lib/filters\";\n import type { DisplayZone } from \"../lib/timezone\";\n import { LOCAL, MAJOR_ZONES, browserZone, describeDisplayZone, resolveZone, zoneLabel } from \"../lib/timezone\";\n\n interface Props {\n filters: Filters;\n calendars: Calendars | null;\n projects: string[];\n view: ViewName;\n feedUrl: string;\n /** The zone the calendar is drawn in, set from the header. */\n zone: DisplayZone;\n /** Extra clocks shown beside it. */\n compareZones: DisplayZone[];\n /** How many comparison clocks the layout can take. */\n maxCompareZones?: number;\n onchange: (filters: Filters) => void;\n oncomparezones: (zones: DisplayZone[]) => void;\n }\n\n let {\n filters,\n calendars,\n projects,\n view,\n feedUrl,\n zone,\n compareZones,\n maxCompareZones = 3,\n onchange,\n oncomparezones,\n }: Props = $props();\n\n function setCategory(category: Category) {\n onchange({ ...filters, categories: toggle(filters.categories, category) });\n }\n\n function setProject(project: string) {\n onchange({ ...filters, projects: toggle(filters.projects, project) });\n }\n\n function allProjects(on: boolean) {\n onchange({ ...filters, projects: new Set(on ? projects : []) });\n }\n\n let now = $derived(new Date());\n // A clock already on screen as the primary zone is not worth offering again.\n let alreadyShown = $derived(new Set([resolveZone(zone), ...compareZones.map(resolveZone)]));\n let canAddMore = $derived(compareZones.length < maxCompareZones);\n\n function addCompareZone(chosen: string) {\n if (!chosen || alreadyShown.has(resolveZone(chosen))) return;\n oncomparezones([...compareZones, chosen]);\n }\n\n function removeCompareZone(chosen: DisplayZone) {\n oncomparezones(compareZones.filter((candidate) => candidate !== chosen));\n }\n</script>\n\n<aside>\n <label class=\"search\">\n <span class=\"visually-hidden\">Search events</span>\n <input\n type=\"search\"\n placeholder=\"Search events...\"\n value={filters.search}\n oninput={(event) => onchange({ ...filters, search: event.currentTarget.value })}\n />\n </label>\n\n <section>\n <h3>Calendars</h3>\n {#each CATEGORIES as category (category)}\n <label class=\"check\">\n <input\n type=\"checkbox\"\n checked={filters.categories.has(category)}\n onchange={() => setCategory(category)}\n />\n <span class=\"swatch\" style=\"--hue: {category === 'personal' ? 265 : category === 'foundation' ? 0 : 210}\"\n ></span>\n {categoryLabel(category)}\n </label>\n {/each}\n </section>\n\n {#if projects.length > 0}\n <section>\n <h3>\n Projects\n <span class=\"bulk\">\n <button type=\"button\" onclick={() => allProjects(true)}>all</button>\n <button type=\"button\" onclick={() => allProjects(false)}>none</button>\n </span>\n </h3>\n <div class=\"projects\">\n {#each projects as project (project)}\n <label class=\"check\">\n <input\n type=\"checkbox\"\n checked={filters.projects.has(project)}\n onchange={() => setProject(project)}\n />\n <span class=\"swatch\" style=\"--hue: {projectHue(project)}\"></span>\n {project}\n {#if calendars?.committees.includes(project)}\n <span class=\"role\" title=\"You are on this committee\">PMC</span>\n {/if}\n </label>\n {/each}\n </div>\n </section>\n {/if}\n\n <section>\n <h3>Visibility</h3>\n <label class=\"field\">\n <select\n value={filters.visibility}\n onchange={(event) =>\n onchange({ ...filters, visibility: event.currentTarget.value as Filters[\"visibility\"] })}\n >\n <option value=\"all\">Everything I can see</option>\n <option value=\"public\">Public only</option>\n <option value=\"private\">Private only</option>\n </select>\n </label>\n </section>\n\n {#if view === \"agenda\"}\n <section>\n <h3>Sort</h3>\n <label class=\"field\">\n <select\n value={filters.sort}\n onchange={(event) => onchange({ ...filters, sort: event.currentTarget.value as SortName })}\n >\n <option value=\"start\">Soonest first</option>\n <option value=\"-start\">Latest first</option>\n <option value=\"title\">Title A-Z</option>\n <option value=\"-title\">Title Z-A</option>\n </select>\n </label>\n </section>\n {/if}\n\n <section class=\"timezones\">\n <h3>Timezones</h3>\n <p class=\"muted\">\n Drawn in <strong>{describeDisplayZone(zone, now)}</strong>, which you can change at the top of\n the page.\n </p>\n\n {#if compareZones.length > 0}\n <ul class=\"chips\">\n {#each compareZones as other (other)}\n <li>\n <span title={zoneLabel(resolveZone(other), now)}>{describeDisplayZone(other, now)}</span>\n <button\n type=\"button\"\n onclick={() => removeCompareZone(other)}\n aria-label={`Stop showing ${resolveZone(other)}`}\n >\n ×\n </button>\n </li>\n {/each}\n </ul>\n {/if}\n\n {#if canAddMore}\n <label class=\"field\">\n <span class=\"visually-hidden\">Also show another timezone</span>\n <select\n value=\"\"\n onchange={(event) => {\n addCompareZone(event.currentTarget.value);\n event.currentTarget.value = \"\";\n }}\n >\n <option value=\"\">Also show...</option>\n {#if !alreadyShown.has(browserZone())}\n <option value={LOCAL}>Local - {zoneLabel(browserZone(), now)}</option>\n {/if}\n {#each MAJOR_ZONES as group (group.region)}\n <optgroup label={group.region}>\n {#each group.zones.filter((name) => !alreadyShown.has(name)) as name (name)}\n <option value={name}>{zoneLabel(name, now)}</option>\n {/each}\n </optgroup>\n {/each}\n </select>\n </label>\n {/if}\n\n <p class=\"muted small\">\n Comparison clocks appear beside the week and day grids, on agenda rows, and in an event's\n details.\n </p>\n </section>\n\n <section class=\"subscribe\">\n <h3>Subscribe</h3>\n <p class=\"muted\">\n Add the events you can see to your own calendar application with this iCalendar feed.\n </p>\n <a class=\"btn\" href={feedUrl}>Download .ics</a>\n </section>\n</aside>\n\n<style>\n aside {\n width: 15rem;\n flex: none;\n padding: 0.9rem;\n overflow-y: auto;\n background: var(--bg-panel);\n border-right: 1px solid var(--border);\n }\n\n .search input {\n width: 100%;\n }\n\n section {\n margin-top: 1.1rem;\n }\n\n h3 {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n margin: 0 0 0.4rem;\n font-size: 11px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.06em;\n color: var(--text-muted);\n }\n\n .bulk button {\n background: none;\n border: 0;\n padding: 0 0.2rem;\n font-size: 11px;\n color: var(--asf-red);\n text-transform: none;\n letter-spacing: 0;\n }\n\n .bulk button:hover {\n text-decoration: underline;\n }\n\n .check {\n display: flex;\n align-items: center;\n gap: 0.45rem;\n padding: 0.12rem 0;\n cursor: pointer;\n font-size: 13px;\n overflow: hidden;\n }\n\n .check:hover {\n color: var(--asf-red);\n }\n\n .swatch {\n width: 10px;\n height: 10px;\n flex: none;\n border-radius: 3px;\n background: hsl(var(--hue) 60% 55%);\n }\n\n .projects {\n max-height: 16rem;\n overflow-y: auto;\n }\n\n .role {\n margin-left: auto;\n font-size: 9px;\n font-weight: 700;\n letter-spacing: 0.04em;\n color: var(--text-faint);\n border: 1px solid var(--border);\n border-radius: 3px;\n padding: 0 3px;\n }\n\n .field select {\n width: 100%;\n }\n\n .subscribe p {\n margin: 0 0 0.5rem;\n font-size: 12px;\n }\n\n .timezones p {\n margin: 0 0 0.5rem;\n font-size: 12px;\n }\n\n .timezones .small {\n margin: 0.5rem 0 0;\n font-size: 11px;\n }\n\n .chips {\n list-style: none;\n margin: 0 0 0.5rem;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 3px;\n }\n\n .chips li {\n display: flex;\n align-items: center;\n gap: 0.3rem;\n font-size: 12px;\n background: var(--bg-subtle);\n border: 1px solid var(--border);\n border-radius: var(--radius);\n padding: 0.1rem 0.2rem 0.1rem 0.45rem;\n }\n\n .chips li span {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .chips button {\n background: none;\n border: 0;\n padding: 0 0.3rem;\n font-size: 14px;\n line-height: 1;\n color: var(--text-muted);\n }\n\n .chips button:hover {\n color: var(--asf-red);\n }\n</style>\n","<script lang=\"ts\">\n import type { CalendarEvent } from \"../lib/types\";\n import { calendarLabel, eventHue, eventStart } from \"../lib/events\";\n import { formatTime } from \"../lib/dates\";\n import type { DisplayZone } from \"../lib/timezone\";\n\n interface Props {\n event: CalendarEvent;\n /** \"chip\" is the compact form used in month cells and the year view. */\n variant?: \"chip\" | \"block\" | \"row\";\n showTime?: boolean;\n zone?: DisplayZone;\n onselect: (event: CalendarEvent) => void;\n }\n\n let { event, variant = \"chip\", showTime = true, zone = \"local\", onselect }: Props = $props();\n\n let hue = $derived(eventHue(event));\n let time = $derived(event.all_day ? \"All day\" : formatTime(eventStart(event, zone)));\n let label = $derived(calendarLabel(event));\n</script>\n\n<button\n type=\"button\"\n class=\"chip {variant}\"\n class:private={event.visibility === \"private\"}\n style=\"--hue: {hue}\"\n title=\"{event.title} - {label}{event.location ? ` - ${event.location}` : ''}\"\n onclick={(mouseEvent) => {\n mouseEvent.stopPropagation();\n onselect(event);\n }}\n>\n {#if showTime}\n <span class=\"time\">{time}</span>\n {/if}\n <span class=\"title\">{event.title}</span>\n {#if event.visibility === \"private\"}\n <span class=\"lock\" aria-label=\"Private event\">🔒</span>\n {/if}\n</button>\n\n<style>\n .chip {\n display: flex;\n align-items: baseline;\n gap: 0.3rem;\n width: 100%;\n text-align: left;\n background: var(--chip-bg);\n color: var(--chip-text);\n border: 1px solid var(--chip-border);\n border-left-width: 3px;\n border-radius: 4px;\n padding: 1px 4px;\n font-size: 12px;\n line-height: 1.35;\n overflow: hidden;\n }\n\n .chip:hover {\n filter: brightness(0.96);\n }\n\n .chip.private {\n border-style: dashed;\n border-left-style: solid;\n }\n\n .time {\n font-variant-numeric: tabular-nums;\n opacity: 0.75;\n flex: none;\n }\n\n .title {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .lock {\n margin-left: auto;\n font-size: 10px;\n flex: none;\n }\n\n .chip.block {\n flex-direction: column;\n align-items: stretch;\n gap: 0;\n height: 100%;\n padding: 2px 4px;\n white-space: normal;\n }\n\n .chip.block .title {\n white-space: normal;\n font-weight: 600;\n }\n\n .chip.row {\n padding: 0.4rem 0.6rem;\n font-size: 13px;\n border-left-width: 4px;\n }\n</style>\n","<script lang=\"ts\">\n import type { CalendarEvent } from \"../lib/types\";\n import { MONTH_NAMES, WEEKDAY_NAMES, dayKey, isToday, isWeekend, monthGrid } from \"../lib/dates\";\n import { groupByDay } from \"../lib/events\";\n import type { DisplayZone } from \"../lib/timezone\";\n import { nowInZone } from \"../lib/timezone\";\n import EventChip from \"./EventChip.svelte\";\n\n interface Props {\n cursor: Date;\n events: CalendarEvent[];\n zone?: DisplayZone;\n onselect: (event: CalendarEvent) => void;\n onpickday: (day: Date) => void;\n }\n\n let { cursor, events, zone = \"local\", onselect, onpickday }: Props = $props();\n\n let now = $derived(nowInZone(zone));\n\n /** How many chips fit in a cell before we collapse the rest into \"+n more\". */\n const VISIBLE_PER_DAY = 3;\n\n let days = $derived(monthGrid(cursor));\n let buckets = $derived(groupByDay(events, days, zone));\n let month = $derived(cursor.getMonth());\n</script>\n\n<div class=\"month\">\n <div class=\"weekdays\" role=\"row\">\n {#each WEEKDAY_NAMES as name (name)}\n <div class=\"weekday\" role=\"columnheader\">{name}</div>\n {/each}\n </div>\n\n <div class=\"grid\">\n {#each days as day (dayKey(day))}\n {@const key = dayKey(day)}\n {@const dayEvents = buckets.get(key) ?? []}\n <div\n class=\"cell\"\n class:other-month={day.getMonth() !== month}\n class:weekend={isWeekend(day)}\n class:today={isToday(day, now)}\n >\n <button type=\"button\" class=\"daynumber\" onclick={() => onpickday(day)}>\n {#if day.getDate() === 1}\n <span class=\"monthname\">{MONTH_NAMES[day.getMonth()].slice(0, 3)}</span>\n {/if}\n {day.getDate()}\n </button>\n\n <div class=\"events\">\n {#each dayEvents.slice(0, VISIBLE_PER_DAY) as event (event.id)}\n <EventChip {event} {zone} {onselect} />\n {/each}\n {#if dayEvents.length > VISIBLE_PER_DAY}\n <button type=\"button\" class=\"more\" onclick={() => onpickday(day)}>\n +{dayEvents.length - VISIBLE_PER_DAY} more\n </button>\n {/if}\n </div>\n </div>\n {/each}\n </div>\n</div>\n\n<style>\n .month {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n }\n\n .weekdays,\n .grid {\n display: grid;\n grid-template-columns: repeat(7, minmax(0, 1fr));\n }\n\n .weekday {\n padding: 0.4rem 0.5rem;\n font-size: 12px;\n font-weight: 600;\n color: var(--text-muted);\n text-transform: uppercase;\n letter-spacing: 0.04em;\n border-bottom: 1px solid var(--border);\n }\n\n .grid {\n flex: 1;\n grid-auto-rows: minmax(5.5rem, 1fr);\n min-height: 0;\n border-left: 1px solid var(--border);\n border-top: 1px solid var(--border);\n }\n\n .cell {\n display: flex;\n flex-direction: column;\n gap: 2px;\n min-width: 0;\n padding: 2px;\n background: var(--bg-panel);\n border-right: 1px solid var(--border);\n border-bottom: 1px solid var(--border);\n overflow: hidden;\n }\n\n .cell.weekend {\n background: var(--bg-subtle);\n }\n\n .cell.other-month {\n opacity: 0.55;\n }\n\n .cell.today {\n background: var(--today);\n }\n\n .daynumber {\n align-self: flex-start;\n display: flex;\n gap: 0.25rem;\n align-items: baseline;\n background: none;\n border: 0;\n padding: 1px 5px;\n border-radius: 999px;\n font-size: 12px;\n font-variant-numeric: tabular-nums;\n color: var(--text-muted);\n }\n\n .daynumber:hover {\n background: var(--bg-hover);\n color: var(--text);\n }\n\n .today .daynumber {\n background: var(--asf-red);\n color: #fff;\n font-weight: 700;\n }\n\n .monthname {\n font-weight: 700;\n text-transform: uppercase;\n font-size: 10px;\n }\n\n .events {\n display: flex;\n flex-direction: column;\n gap: 2px;\n overflow: hidden;\n }\n\n .more {\n background: none;\n border: 0;\n padding: 0 4px;\n text-align: left;\n font-size: 11px;\n color: var(--text-muted);\n }\n\n .more:hover {\n color: var(--text);\n text-decoration: underline;\n }\n</style>\n","<script lang=\"ts\">\n import type { CalendarEvent } from \"../lib/types\";\n import { WEEKDAY_NAMES, dayKey, formatTime, isToday, isWeekend, weekDays } from \"../lib/dates\";\n import { allDayEvents, eventHue, eventStart, layoutDay } from \"../lib/events\";\n import type { DisplayZone } from \"../lib/timezone\";\n import { hourLabels, nowInZone, shortZoneLabel, zoneLabel, resolveZone } from \"../lib/timezone\";\n import EventChip from \"./EventChip.svelte\";\n\n interface Props {\n cursor: Date;\n events: CalendarEvent[];\n /** One day for the day view, seven for the week view. */\n days?: number;\n zone?: DisplayZone;\n /** Extra clocks to show beside the grid, left of the primary one. */\n compareZones?: DisplayZone[];\n onselect: (event: CalendarEvent) => void;\n onpickday: (day: Date) => void;\n }\n\n let {\n cursor,\n events,\n days = 7,\n zone = \"local\",\n compareZones = [],\n onselect,\n onpickday,\n }: Props = $props();\n\n const HOURS = Array.from({ length: 24 }, (_, hour) => hour);\n\n let now = $derived(nowInZone(zone));\n\n let columns = $derived(days === 1 ? [new Date(cursor)] : weekDays(cursor));\n let allDayRows = $derived(columns.map((day) => allDayEvents(events, day, zone)));\n let hasAllDay = $derived(allDayRows.some((row) => row.length > 0));\n let laidOut = $derived(columns.map((day) => layoutDay(events, day, zone)));\n // The primary zone sits closest to the grid, since that is the one the rows\n // actually line up with; comparison clocks go to its left.\n let gutters = $derived([...compareZones, zone]);\n let labels = $derived(\n gutters.map((other) =>\n other === zone\n ? HOURS.map((hour) => `${String(hour).padStart(2, \"0\")}:00`)\n : hourLabels(columns[0], zone, other),\n ),\n );\n</script>\n\n<div\n class=\"week\"\n class:single={columns.length === 1}\n style=\"--cols: {columns.length}; --gutters: {gutters.length}\"\n>\n <div class=\"headers\">\n {#each gutters as other, index (index)}\n <div class=\"gutter zonehead\" title={zoneLabel(resolveZone(other))}>\n {shortZoneLabel(other)}\n </div>\n {/each}\n {#each columns as day, index (dayKey(day))}\n <button\n type=\"button\"\n class=\"dayhead\"\n class:today={isToday(day, now)}\n class:weekend={isWeekend(day)}\n onclick={() => onpickday(day)}\n >\n <span class=\"dow\">{WEEKDAY_NAMES[(day.getDay() + 6) % 7]}</span>\n <span class=\"dom\">{day.getDate()}</span>\n {#if allDayRows[index].length > 0}\n <span class=\"badge\">{allDayRows[index].length}</span>\n {/if}\n </button>\n {/each}\n </div>\n\n {#if hasAllDay}\n <div class=\"allday\">\n {#each gutters as _other, index (index)}\n <div class=\"gutter\"><span>{index === gutters.length - 1 ? \"All day\" : \"\"}</span></div>\n {/each}\n {#each columns as day, index (dayKey(day))}\n <div class=\"allday-cell\" class:weekend={isWeekend(day)}>\n {#each allDayRows[index] as event (event.id)}\n <EventChip {event} {zone} {onselect} showTime={false} />\n {/each}\n </div>\n {/each}\n </div>\n {/if}\n\n <div class=\"scroll\">\n <div class=\"body\">\n {#each gutters as _other, index (index)}\n <div class=\"gutter hours\" class:secondary={index < gutters.length - 1}>\n {#each labels[index] as label, hour (hour)}\n <div class=\"hour\"><span>{label}</span></div>\n {/each}\n </div>\n {/each}\n\n {#each columns as day, index (dayKey(day))}\n <div class=\"daycol\" class:weekend={isWeekend(day)} class:today={isToday(day, now)}>\n {#each HOURS as hour (hour)}\n <div class=\"slot\"></div>\n {/each}\n\n {#each laidOut[index] as placed (placed.event.id)}\n <button\n type=\"button\"\n class=\"timed\"\n class:private={placed.event.visibility === \"private\"}\n style=\"--hue: {eventHue(placed.event)};\n top: {placed.top * 100}%;\n height: {placed.height * 100}%;\n left: calc({(placed.column / placed.columns) * 100}% + 2px);\n width: calc({(1 / placed.columns) * 100}% - 4px);\"\n onclick={() => onselect(placed.event)}\n title={placed.event.title}\n >\n <span class=\"timed-time\">{formatTime(eventStart(placed.event, zone))}</span>\n <span class=\"timed-title\">{placed.event.title}</span>\n </button>\n {/each}\n </div>\n {/each}\n </div>\n </div>\n</div>\n\n<style>\n .week {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n }\n\n .headers,\n .allday,\n .body {\n display: grid;\n grid-template-columns: repeat(var(--gutters, 1), 3.5rem) repeat(var(--cols, 7), minmax(0, 1fr));\n }\n\n .headers {\n border-bottom: 1px solid var(--border);\n }\n\n .dayhead {\n display: flex;\n align-items: baseline;\n justify-content: center;\n gap: 0.35rem;\n padding: 0.45rem 0.25rem;\n background: none;\n border: 0;\n border-left: 1px solid var(--border);\n }\n\n .dayhead:hover {\n background: var(--bg-hover);\n }\n\n .dayhead.weekend {\n background: var(--bg-subtle);\n }\n\n .dayhead.today {\n background: var(--today);\n }\n\n .dow {\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n color: var(--text-muted);\n }\n\n .dom {\n font-size: 16px;\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n }\n\n .today .dom {\n color: var(--asf-red);\n }\n\n .badge {\n font-size: 10px;\n background: var(--border-strong);\n color: var(--bg-panel);\n border-radius: 999px;\n padding: 0 5px;\n }\n\n .allday {\n border-bottom: 1px solid var(--border-strong);\n max-height: 6rem;\n overflow-y: auto;\n }\n\n .allday-cell {\n display: flex;\n flex-direction: column;\n gap: 2px;\n padding: 2px;\n min-width: 0;\n border-left: 1px solid var(--border);\n }\n\n .gutter {\n font-size: 11px;\n color: var(--text-faint);\n text-align: right;\n padding-right: 0.4rem;\n }\n\n .zonehead {\n display: flex;\n align-items: flex-end;\n justify-content: flex-end;\n padding-bottom: 0.45rem;\n font-weight: 700;\n letter-spacing: 0.02em;\n color: var(--text-muted);\n overflow: hidden;\n }\n\n /* Comparison clocks are there for reference, so they read quieter than the\n zone the grid is actually drawn in. */\n .hours.secondary {\n color: var(--text-faint);\n opacity: 0.75;\n }\n\n .hours.secondary + .hours {\n border-left: 1px solid var(--border);\n }\n\n .allday .gutter {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n }\n\n .scroll {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n background: var(--bg-panel);\n }\n\n .hours .hour {\n height: 3rem;\n position: relative;\n }\n\n .hours .hour span {\n position: absolute;\n top: -0.6em;\n right: 0.4rem;\n }\n\n .daycol {\n position: relative;\n min-width: 0;\n border-left: 1px solid var(--border);\n }\n\n .daycol.weekend {\n background: var(--bg-subtle);\n }\n\n .daycol.today {\n background: var(--today);\n }\n\n .slot {\n height: 3rem;\n border-bottom: 1px solid var(--border);\n }\n\n .timed {\n position: absolute;\n display: flex;\n flex-direction: column;\n gap: 0;\n overflow: hidden;\n padding: 1px 4px;\n text-align: left;\n font-size: 12px;\n line-height: 1.25;\n background: var(--chip-bg);\n color: var(--chip-text);\n border: 1px solid var(--chip-border);\n border-left: 3px solid var(--chip-border);\n border-radius: 4px;\n }\n\n .timed.private {\n border-style: dashed;\n border-left-style: solid;\n }\n\n .timed:hover {\n filter: brightness(0.96);\n z-index: 2;\n }\n\n .timed-time {\n font-variant-numeric: tabular-nums;\n opacity: 0.75;\n }\n\n .timed-title {\n font-weight: 600;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n</style>\n","<script lang=\"ts\">\n import type { CalendarEvent } from \"../lib/types\";\n import { MONTH_NAMES, dayKey, isToday, monthGrid, yearMonths } from \"../lib/dates\";\n import { eventHue, occursOnDay } from \"../lib/events\";\n import type { DisplayZone } from \"../lib/timezone\";\n import { nowInZone } from \"../lib/timezone\";\n\n interface Props {\n cursor: Date;\n events: CalendarEvent[];\n zone?: DisplayZone;\n onpickday: (day: Date) => void;\n onpickmonth: (month: Date) => void;\n }\n\n let { cursor, events, zone = \"local\", onpickday, onpickmonth }: Props = $props();\n\n let now = $derived(nowInZone(zone));\n\n /** Up to three dots per day, so a busy day still reads as busy. */\n const MAX_DOTS = 3;\n\n function dotsFor(day: Date): CalendarEvent[] {\n return events.filter((event) => occursOnDay(event, day, zone)).slice(0, MAX_DOTS);\n }\n\n let months = $derived(yearMonths(cursor));\n</script>\n\n<div class=\"year\">\n {#each months as month (month.getMonth())}\n <section class=\"month\">\n <button type=\"button\" class=\"title\" onclick={() => onpickmonth(month)}>\n {MONTH_NAMES[month.getMonth()]}\n </button>\n <div class=\"mini\">\n {#each [\"M\", \"T\", \"W\", \"T\", \"F\", \"S\", \"S\"] as label, index (index)}\n <div class=\"dow\">{label}</div>\n {/each}\n {#each monthGrid(month).slice(0, 42) as day (dayKey(day))}\n {@const inMonth = day.getMonth() === month.getMonth()}\n {@const dots = inMonth ? dotsFor(day) : []}\n <button\n type=\"button\"\n class=\"day\"\n class:outside={!inMonth}\n class:today={isToday(day, now)}\n onclick={() => onpickday(day)}\n aria-label={`${day.getDate()} ${MONTH_NAMES[day.getMonth()]}${dots.length ? `, ${dots.length} events` : \"\"}`}\n >\n <span class=\"num\">{day.getDate()}</span>\n <span class=\"dots\">\n {#each dots as event (event.id)}\n <i style=\"--hue: {eventHue(event)}\"></i>\n {/each}\n </span>\n </button>\n {/each}\n </div>\n </section>\n {/each}\n</div>\n\n<style>\n .year {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));\n gap: 1rem;\n padding: 1rem;\n overflow-y: auto;\n height: 100%;\n }\n\n .month {\n background: var(--bg-panel);\n border: 1px solid var(--border);\n border-radius: var(--radius);\n padding: 0.6rem;\n box-shadow: var(--shadow);\n }\n\n .title {\n display: block;\n width: 100%;\n background: none;\n border: 0;\n padding: 0 0 0.4rem;\n text-align: left;\n font-weight: 700;\n font-size: 13px;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--asf-red);\n }\n\n .title:hover {\n text-decoration: underline;\n }\n\n .mini {\n display: grid;\n grid-template-columns: repeat(7, 1fr);\n gap: 1px;\n }\n\n .dow {\n font-size: 10px;\n color: var(--text-faint);\n text-align: center;\n padding-bottom: 2px;\n }\n\n .day {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 1px;\n background: none;\n border: 0;\n border-radius: 3px;\n padding: 2px 0 3px;\n font-size: 11px;\n font-variant-numeric: tabular-nums;\n min-height: 1.9rem;\n }\n\n .day:hover {\n background: var(--bg-hover);\n }\n\n .day.outside {\n opacity: 0.3;\n }\n\n .day.today .num {\n background: var(--asf-red);\n color: #fff;\n border-radius: 999px;\n padding: 0 4px;\n font-weight: 700;\n }\n\n .dots {\n display: flex;\n gap: 1px;\n height: 4px;\n }\n\n .dots i {\n width: 4px;\n height: 4px;\n border-radius: 999px;\n background: hsl(var(--hue) 60% 50%);\n }\n</style>\n","<script lang=\"ts\">\n import type { CalendarEvent } from \"../lib/types\";\n import { WEEKDAY_NAMES, formatDate, formatTime, isToday } from \"../lib/dates\";\n import { agendaSections, calendarLabel, eventEnd, eventHue, eventStart } from \"../lib/events\";\n import type { DisplayZone } from \"../lib/timezone\";\n import { nowInZone, shortZoneLabel } from \"../lib/timezone\";\n\n interface Props {\n events: CalendarEvent[];\n zone?: DisplayZone;\n /** Extra clocks to show after the main time. */\n compareZones?: DisplayZone[];\n onselect: (event: CalendarEvent) => void;\n }\n\n let { events, zone = \"local\", compareZones = [], onselect }: Props = $props();\n\n let now = $derived(nowInZone(zone));\n let sections = $derived(agendaSections(events, zone));\n\n function when(event: CalendarEvent): string {\n if (event.all_day) return \"All day\";\n return `${formatTime(eventStart(event, zone))} - ${formatTime(eventEnd(event, zone))}`;\n }\n\n /** The start time on each comparison clock, for the muted suffix. */\n function alsoAt(event: CalendarEvent): { key: string; text: string }[] {\n if (event.all_day) return [];\n return compareZones.map((other) => ({\n key: other,\n text: `${formatTime(eventStart(event, other))} ${shortZoneLabel(other)}`,\n }));\n }\n</script>\n\n<div class=\"agenda\">\n {#if sections.length === 0}\n <p class=\"empty muted\">No events match the current filters.</p>\n {/if}\n\n {#each sections as section (section.key)}\n <section>\n <h3 class:today={isToday(section.date, now)}>\n <span class=\"dow\">{WEEKDAY_NAMES[(section.date.getDay() + 6) % 7]}</span>\n {formatDate(section.date)}\n </h3>\n <ul>\n {#each section.events as event (event.id)}\n <li>\n <button\n type=\"button\"\n class=\"row\"\n style=\"--hue: {eventHue(event)}\"\n onclick={() => onselect(event)}\n >\n <span class=\"when\">{when(event)}</span>\n {#each alsoAt(event) as also (also.key)}\n <span class=\"alsoat\">{also.text}</span>\n {/each}\n <span class=\"title\">{event.title}</span>\n <span class=\"tag\">{calendarLabel(event)}</span>\n {#if event.visibility === \"private\"}\n <span class=\"tag private\">private</span>\n {/if}\n {#if event.location}\n <span class=\"where muted\">{event.location}</span>\n {/if}\n </button>\n </li>\n {/each}\n </ul>\n </section>\n {/each}\n</div>\n\n<style>\n .agenda {\n height: 100%;\n overflow-y: auto;\n padding: 1rem 1rem 3rem;\n }\n\n .empty {\n padding: 2rem;\n text-align: center;\n }\n\n section {\n margin-bottom: 1.25rem;\n }\n\n h3 {\n display: flex;\n align-items: baseline;\n gap: 0.5rem;\n margin: 0 0 0.4rem;\n font-size: 13px;\n font-weight: 700;\n color: var(--text-muted);\n border-bottom: 1px solid var(--border);\n padding-bottom: 0.25rem;\n }\n\n h3.today {\n color: var(--asf-red);\n }\n\n .dow {\n text-transform: uppercase;\n letter-spacing: 0.06em;\n font-size: 11px;\n }\n\n ul {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 3px;\n }\n\n .row {\n display: flex;\n align-items: baseline;\n gap: 0.6rem;\n width: 100%;\n text-align: left;\n background: var(--bg-panel);\n border: 1px solid var(--border);\n border-left: 4px solid hsl(var(--hue) 55% 55%);\n border-radius: var(--radius);\n padding: 0.45rem 0.7rem;\n }\n\n .row:hover {\n background: var(--bg-hover);\n }\n\n .when {\n flex: none;\n width: 9rem;\n font-variant-numeric: tabular-nums;\n color: var(--text-muted);\n font-size: 12px;\n }\n\n .title {\n font-weight: 600;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .alsoat {\n flex: none;\n font-size: 11px;\n color: var(--text-faint);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n }\n\n .tag {\n flex: none;\n font-size: 11px;\n padding: 0 6px;\n border-radius: 999px;\n background: var(--bg-subtle);\n border: 1px solid var(--border);\n color: var(--text-muted);\n }\n\n .tag.private {\n border-style: dashed;\n }\n\n .where {\n margin-left: auto;\n font-size: 12px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n @media (max-width: 42rem) {\n .row {\n flex-wrap: wrap;\n }\n\n .when {\n width: auto;\n }\n\n .where {\n margin-left: 0;\n width: 100%;\n }\n }\n</style>\n","<script lang=\"ts\">\n import type { CalendarEvent, Calendars, Category, EventDraft, Visibility } from \"../lib/types\";\n import { formatDate, formatTime, fromDayKey, toDateInput, toISO, toLocalInput } from \"../lib/dates\";\n import { calendarLabel, categoryLabel, eventEnd, eventHue, eventStart } from \"../lib/events\";\n import type { DisplayZone } from \"../lib/timezone\";\n import {\n describeDisplayZone,\n fromWallInZone,\n isLocal,\n resolveZone,\n toWallInZone,\n zoneCity,\n zoneLabel,\n zoneList,\n } from \"../lib/timezone\";\n import { api } from \"../lib/api\";\n\n interface Props {\n event: CalendarEvent | null;\n draft: EventDraft | null;\n calendars: Calendars | null;\n saving: boolean;\n error: string | null;\n /** Whether the current user may change this event. */\n editable: boolean;\n /** The timezone the viewer is reading the calendar in. */\n zone?: DisplayZone;\n /** Extra clocks the viewer has asked to see alongside. */\n compareZones?: DisplayZone[];\n onclose: () => void;\n onedit: () => void;\n onsave: (draft: EventDraft) => void;\n ondelete: () => void;\n }\n\n let {\n event,\n draft,\n calendars,\n saving,\n error,\n editable,\n zone = \"local\",\n compareZones = [],\n onclose,\n onedit,\n onsave,\n ondelete,\n }: Props = $props();\n\n const ZONES = zoneList();\n\n /** A local, editable copy so typing does not mutate the parent's state. */\n let form = $state<EventDraft | null>(null);\n let lastDraft: EventDraft | null = null;\n\n $effect(() => {\n if (draft !== lastDraft) {\n lastDraft = draft;\n form = draft ? { ...draft } : null;\n }\n });\n\n let creatableCategories = $derived.by((): Category[] => {\n const can = calendars?.can_create;\n if (!can) return [];\n const list: Category[] = [];\n if (can.personal) list.push(\"personal\");\n if (can.project.length > 0) list.push(\"project\");\n if (can.foundation) list.push(\"foundation\");\n return list;\n });\n\n let projectOptions = $derived(\n form?.visibility === \"private\"\n ? (calendars?.can_create.project_private ?? [])\n : (calendars?.can_create.project ?? []),\n );\n\n /** A committer can only make public events for their projects. */\n let visibilityOptions = $derived.by((): Visibility[] => {\n if (!form) return [\"public\"];\n if (form.category === \"personal\") return [\"private\"];\n if (form.category === \"foundation\") return [\"public\", \"private\"];\n const privateProjects = calendars?.can_create.project_private ?? [];\n return privateProjects.length > 0 ? [\"public\", \"private\"] : [\"public\"];\n });\n\n function onCategoryChange(category: Category) {\n if (!form) return;\n form.category = category;\n if (category === \"personal\") {\n form.visibility = \"private\";\n form.project = null;\n } else if (category === \"foundation\") {\n form.project = null;\n if (form.visibility === \"private\" && !calendars?.can_create.foundation) form.visibility = \"public\";\n } else {\n form.project ??= calendars?.can_create.project[0] ?? null;\n }\n }\n\n function submit(submitEvent: SubmitEvent) {\n submitEvent.preventDefault();\n if (form) onsave({ ...form });\n }\n\n function keydown(keyEvent: KeyboardEvent) {\n if (keyEvent.key === \"Escape\") onclose();\n }\n\n function copyShortlink() {\n if (event?.shortlink_url) void navigator.clipboard?.writeText(event.shortlink_url);\n }\n\n function whenLabel(current: CalendarEvent): string {\n const start = eventStart(current, zone);\n const end = eventEnd(current, zone);\n if (current.all_day) {\n const lastDay = new Date(end.getTime() - 1);\n return lastDay.toDateString() === start.toDateString()\n ? `${formatDate(start)} (all day)`\n : `${formatDate(start)} - ${formatDate(lastDay)} (all day)`;\n }\n if (start.toDateString() === end.toDateString()) {\n return `${formatDate(start)}, ${formatTime(start)} - ${formatTime(end)}`;\n }\n return `${formatDate(start)} ${formatTime(start)} - ${formatDate(end)} ${formatTime(end)}`;\n }\n\n interface ZoneReading {\n key: string;\n label: string;\n when: string;\n }\n\n /**\n * The same event on other clocks: the organiser's own, and whichever zones\n * the viewer has asked to compare against.\n *\n * All-day events are dates rather than instants, so there is nothing to\n * convert and the list stays empty.\n */\n let otherReadings = $derived.by((): ZoneReading[] => {\n const current = event;\n if (!current || current.all_day) return [];\n\n const start = new Date(current.start);\n const end = new Date(current.end);\n const primary = eventStart(current, zone).getTime();\n const rows: ZoneReading[] = [];\n const seen = new Set<string>([resolveZone(zone)]);\n\n const add = (candidate: DisplayZone, suffix = \"\") => {\n const resolved = resolveZone(candidate);\n if (seen.has(resolved)) return;\n seen.add(resolved);\n const from = toWallInZone(start, resolved);\n // A zone that happens to read the same as the viewer's is just noise.\n if (from.getTime() === primary && !suffix) return;\n const name = isLocal(candidate) ? `Local - ${zoneCity(resolved)}` : zoneCity(resolved);\n rows.push({\n key: resolved,\n label: `${name}${suffix}`,\n when: `${formatTime(from)} - ${formatTime(toWallInZone(end, resolved))}`,\n });\n };\n\n add(current.timezone || \"UTC\", \" (organiser)\");\n for (const candidate of compareZones) add(candidate);\n return rows;\n });\n\n /**\n * The form's times are entered in the event's own timezone, so that posting\n * \"15:00 in Berlin\" means exactly that regardless of where the organiser is\n * sitting or which zone they are reading the calendar in.\n *\n * All-day events are dates, not instants, so they stay on the UTC day.\n */\n function setStart(value: string, allDay: boolean) {\n if (!form || !value) return;\n form.start = allDay\n ? toISO(new Date(Date.UTC(...dateParts(value))))\n : toISO(fromWallInZone(new Date(value), form.timezone));\n }\n\n function setEnd(value: string, allDay: boolean) {\n if (!form || !value) return;\n if (allDay) {\n // The stored end is exclusive: the day after the last day.\n const [year, month, day] = dateParts(value);\n form.end = toISO(new Date(Date.UTC(year, month, day + 1)));\n } else {\n form.end = toISO(fromWallInZone(new Date(value), form.timezone));\n }\n }\n\n function dateParts(value: string): [number, number, number] {\n const parsed = fromDayKey(value);\n return [parsed.getFullYear(), parsed.getMonth(), parsed.getDate()];\n }\n\n /** The value to show in a datetime-local input, in the event's timezone. */\n function inputValue(iso: string): string {\n if (!form) return \"\";\n return toLocalInput(toWallInZone(new Date(iso), form.timezone));\n }\n\n /** The UTC date to show in a date input for an all-day event. */\n function dateValue(iso: string, exclusiveEnd = false): string {\n const instant = new Date(iso);\n const shifted = exclusiveEnd ? new Date(instant.getTime() - 1) : instant;\n return toDateInput(\n new Date(shifted.getUTCFullYear(), shifted.getUTCMonth(), shifted.getUTCDate()),\n );\n }\n\n /**\n * Moving an event to another timezone keeps the wall clock and changes the\n * instant: \"the call is still at 15:00, but 15:00 in Tokyo\".\n */\n function onTimezoneChange(next: string) {\n if (!form) return;\n const startWall = toWallInZone(new Date(form.start), form.timezone);\n const endWall = toWallInZone(new Date(form.end), form.timezone);\n form.timezone = next;\n form.start = toISO(fromWallInZone(startWall, next));\n form.end = toISO(fromWallInZone(endWall, next));\n }\n</script>\n\n<svelte:window onkeydown={keydown} />\n\n<!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_static_element_interactions -->\n<div class=\"backdrop\" onclick={onclose}>\n <!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_static_element_interactions -->\n <div\n class=\"dialog\"\n role=\"dialog\"\n tabindex=\"-1\"\n aria-modal=\"true\"\n aria-label={form ? \"Edit event\" : (event?.title ?? \"Event\")}\n style=\"--hue: {event ? eventHue(event) : 210}\"\n onclick={(mouseEvent) => mouseEvent.stopPropagation()}\n >\n {#if error}\n <p class=\"error\" role=\"alert\">{error}</p>\n {/if}\n\n {#if form}\n <form onsubmit={submit}>\n <h2>{event ? \"Edit event\" : \"New event\"}</h2>\n\n <label class=\"row\">\n <span>Title</span>\n <input bind:value={form.title} required maxlength=\"200\" placeholder=\"What is happening?\" />\n </label>\n\n <div class=\"pair\">\n <label class=\"row\">\n <span>Calendar</span>\n <select\n value={form.category}\n onchange={(changeEvent) => onCategoryChange(changeEvent.currentTarget.value as Category)}\n disabled={creatableCategories.length <= 1 && !event}\n >\n {#each creatableCategories as category (category)}\n <option value={category}>{categoryLabel(category)}</option>\n {/each}\n </select>\n </label>\n\n {#if form.category === \"project\"}\n <label class=\"row\">\n <span>Project</span>\n <select bind:value={form.project}>\n {#each projectOptions as project (project)}\n <option value={project}>{project}</option>\n {/each}\n </select>\n </label>\n {/if}\n\n {#if form.category !== \"personal\"}\n <label class=\"row\">\n <span>Visibility</span>\n <select bind:value={form.visibility}>\n {#each visibilityOptions as option (option)}\n <option value={option}>{option}</option>\n {/each}\n </select>\n </label>\n {/if}\n </div>\n\n <label class=\"check\">\n <input type=\"checkbox\" bind:checked={form.all_day} />\n All day\n </label>\n\n {#if !form.all_day}\n <label class=\"row\">\n <span>Timezone of these times</span>\n <select\n value={form.timezone}\n onchange={(changeEvent) => onTimezoneChange(changeEvent.currentTarget.value)}\n >\n {#each ZONES as name (name)}\n <option value={name}>{name}</option>\n {/each}\n </select>\n <small class=\"hint muted\">\n Enter the times as they will be in this zone. Everybody else sees them converted to\n their own clock.\n </small>\n </label>\n {/if}\n\n <div class=\"pair\">\n <label class=\"row\">\n <span>Starts</span>\n {#if form.all_day}\n <input\n type=\"date\"\n value={dateValue(form.start)}\n onchange={(changeEvent) => setStart(changeEvent.currentTarget.value, true)}\n required\n />\n {:else}\n <input\n type=\"datetime-local\"\n value={inputValue(form.start)}\n onchange={(changeEvent) => setStart(changeEvent.currentTarget.value, false)}\n required\n />\n {/if}\n </label>\n\n <label class=\"row\">\n <span>Ends</span>\n {#if form.all_day}\n <input\n type=\"date\"\n value={dateValue(form.end, true)}\n onchange={(changeEvent) => setEnd(changeEvent.currentTarget.value, true)}\n required\n />\n {:else}\n <input\n type=\"datetime-local\"\n value={inputValue(form.end)}\n onchange={(changeEvent) => setEnd(changeEvent.currentTarget.value, false)}\n required\n />\n {/if}\n </label>\n </div>\n\n <label class=\"row\">\n <span>Location</span>\n <input bind:value={form.location} maxlength=\"300\" placeholder=\"Room, city or a meeting link\" />\n </label>\n\n <label class=\"row\">\n <span>Link</span>\n <input bind:value={form.url} type=\"url\" maxlength=\"2048\" placeholder=\"https://...\" />\n </label>\n\n <label class=\"row\">\n <span>Description</span>\n <textarea bind:value={form.description} maxlength=\"20000\"></textarea>\n </label>\n\n <footer>\n {#if event}\n <button type=\"button\" class=\"btn danger\" onclick={ondelete} disabled={saving}>Delete</button>\n {/if}\n <span class=\"spacer\"></span>\n <button type=\"button\" class=\"btn\" onclick={onclose} disabled={saving}>Cancel</button>\n <button type=\"submit\" class=\"btn primary\" disabled={saving}>\n {saving ? \"Saving...\" : \"Save\"}\n </button>\n </footer>\n </form>\n {:else if event}\n <article>\n <header>\n <span class=\"tag\">{calendarLabel(event)}</span>\n <span class=\"tag\" class:private={event.visibility === \"private\"}>{event.visibility}</span>\n </header>\n\n <h2>{event.title}</h2>\n <p class=\"when\">\n {whenLabel(event)}\n <span class=\"zonehint muted\">{event.all_day ? \"\" : describeDisplayZone(zone)}</span>\n </p>\n\n {#if otherReadings.length > 0}\n <ul class=\"clocks\">\n {#each otherReadings as reading (reading.key)}\n <li>\n <span class=\"clockzone\" title={zoneLabel(reading.key)}>{reading.label}</span>\n <span class=\"clocktime\">{reading.when}</span>\n </li>\n {/each}\n </ul>\n {/if}\n\n {#if event.location}\n <p><strong>Where</strong> {event.location}</p>\n {/if}\n\n {#if event.url}\n <p><strong>Link</strong> <a href={event.url} rel=\"noreferrer noopener\">{event.url}</a></p>\n {/if}\n\n {#if event.description}\n <p class=\"description\">{event.description}</p>\n {/if}\n\n <p class=\"shortlink\">\n <strong>Shortlink</strong>\n <a href={event.shortlink_url}>{event.shortlink_url}</a>\n <button type=\"button\" class=\"btn\" onclick={copyShortlink}>Copy</button>\n </p>\n\n <p class=\"muted owner\">Added by {event.owner}</p>\n\n <footer>\n <a class=\"btn\" href={api.icsUrl(event.id)}>Download .ics</a>\n <span class=\"spacer\"></span>\n {#if editable}\n <button type=\"button\" class=\"btn\" onclick={onedit}>Edit</button>\n {/if}\n <button type=\"button\" class=\"btn primary\" onclick={onclose}>Close</button>\n </footer>\n </article>\n {/if}\n </div>\n</div>\n\n<style>\n .backdrop {\n position: fixed;\n inset: 0;\n background: rgba(10, 14, 20, 0.45);\n display: flex;\n align-items: flex-start;\n justify-content: center;\n padding: 3rem 1rem;\n overflow-y: auto;\n z-index: 50;\n }\n\n .dialog {\n width: min(38rem, 100%);\n background: var(--bg-panel);\n border-radius: 10px;\n border-top: 4px solid hsl(var(--hue) 55% 50%);\n box-shadow: var(--shadow-lg);\n padding: 1.2rem 1.4rem 1rem;\n }\n\n h2 {\n margin: 0.2rem 0 0.6rem;\n font-size: 19px;\n }\n\n .error {\n margin: 0 0 0.8rem;\n padding: 0.5rem 0.7rem;\n border-radius: var(--radius);\n background: hsl(0 70% 95%);\n border: 1px solid hsl(0 60% 75%);\n color: hsl(0 65% 30%);\n }\n\n @media (prefers-color-scheme: dark) {\n .error {\n background: hsl(0 40% 20%);\n border-color: hsl(0 40% 40%);\n color: hsl(0 70% 85%);\n }\n }\n\n .row {\n display: flex;\n flex-direction: column;\n gap: 0.2rem;\n margin-bottom: 0.6rem;\n flex: 1 1 10rem;\n }\n\n .row > span {\n font-size: 11px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--text-muted);\n }\n\n .pair {\n display: flex;\n gap: 0.7rem;\n flex-wrap: wrap;\n }\n\n .check {\n display: flex;\n align-items: center;\n gap: 0.4rem;\n margin-bottom: 0.6rem;\n font-size: 13px;\n }\n\n footer {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin-top: 1rem;\n padding-top: 0.8rem;\n border-top: 1px solid var(--border);\n }\n\n .spacer {\n flex: 1;\n }\n\n article header {\n display: flex;\n gap: 0.35rem;\n }\n\n .tag {\n font-size: 11px;\n padding: 0 7px;\n border-radius: 999px;\n background: var(--bg-subtle);\n border: 1px solid var(--border);\n color: var(--text-muted);\n text-transform: capitalize;\n }\n\n .tag.private {\n border-style: dashed;\n color: var(--asf-red);\n }\n\n .when {\n margin: 0 0 0.3rem;\n font-weight: 600;\n }\n\n .zonehint {\n font-weight: 400;\n font-size: 12px;\n }\n\n .clocks {\n list-style: none;\n margin: 0 0 0.8rem;\n padding: 0;\n font-size: 12px;\n color: var(--text-muted);\n }\n\n .clocks li {\n display: flex;\n gap: 0.5rem;\n }\n\n .clockzone {\n min-width: 11rem;\n }\n\n .clocktime {\n font-variant-numeric: tabular-nums;\n }\n\n .hint {\n font-size: 11px;\n font-weight: 400;\n text-transform: none;\n letter-spacing: 0;\n line-height: 1.3;\n }\n\n article p {\n margin: 0 0 0.5rem;\n }\n\n .description {\n white-space: pre-wrap;\n padding: 0.6rem 0.8rem;\n background: var(--bg-subtle);\n border-radius: var(--radius);\n }\n\n .shortlink {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n flex-wrap: wrap;\n font-size: 13px;\n }\n\n .shortlink a {\n font-family: var(--mono);\n font-size: 12px;\n }\n\n .owner {\n font-size: 12px;\n }\n</style>\n","<script lang=\"ts\">\n import type { Calendars, SessionInfo } from \"../lib/types\";\n import type { DisplayZone } from \"../lib/timezone\";\n import { browserZone, describeDisplayZone, resolveZone } from \"../lib/timezone\";\n import { apiUrl, appPath } from \"../lib/base\";\n import { loginUrl, logoutUrl } from \"../lib/base\";\n\n interface Props {\n calendars: Calendars | null;\n session: SessionInfo | null;\n zone: DisplayZone;\n compareZones?: DisplayZone[];\n onclose: () => void;\n }\n\n let { calendars, session, zone, compareZones = [], onclose }: Props = $props();\n\n /** Rows of the \"who can do what\" table. A cell is either true, false, or a note. */\n type Cell = boolean | string;\n\n const COLUMNS = [\"Anyone\", \"Project member\", \"Committee member\", \"Foundation member\"];\n\n const ROWS: { what: string; cells: Cell[] }[] = [\n { what: \"See public project events\", cells: [true, true, true, true] },\n { what: \"See public foundation events\", cells: [true, true, true, true] },\n { what: \"Subscribe to the iCalendar feed\", cells: [true, true, true, true] },\n { what: \"Open an event by its shortlink\", cells: [\"public events\", true, true, true] },\n { what: \"Keep personal events\", cells: [false, true, true, true] },\n { what: \"Add and edit public events for a project\", cells: [false, \"own projects\", \"own projects\", \"own projects\"] },\n { what: \"See private events of a project\", cells: [false, false, \"own committees\", \"own committees\"] },\n { what: \"Add and edit private project events\", cells: [false, false, \"own committees\", \"own committees\"] },\n { what: \"See private foundation events\", cells: [false, false, false, true] },\n { what: \"Add and edit foundation events\", cells: [false, false, false, true] },\n ];\n\n let embedExample = $derived(\n `${globalThis.location?.origin ?? \"\"}${appPath(\"/embed/agenda\")}?project=httpd&limit=8`,\n );\n\n let youAre = $derived.by(() => {\n if (!calendars?.authenticated) return \"You are browsing anonymously, so you can see public events only.\";\n const bits: string[] = [];\n if (calendars.projects.length > 0) bits.push(`a member of ${calendars.projects.join(\", \")}`);\n if (calendars.committees.length > 0) bits.push(`on the ${calendars.committees.join(\", \")} committee${calendars.committees.length > 1 ? \"s\" : \"\"}`);\n if (calendars.is_member) bits.push(\"a foundation member\");\n if (bits.length === 0) return `You are signed in as ${calendars.uid}.`;\n return `You are signed in as ${calendars.uid}, ${bits.join(\", and \")}.`;\n });\n</script>\n\n<div class=\"help\">\n <div class=\"sheet\">\n <header>\n <h2>Using the ASF Community Calendar</h2>\n <button type=\"button\" class=\"btn\" onclick={onclose}>Back to the calendar</button>\n </header>\n\n <p class=\"status\">{youAre}</p>\n\n <section>\n <h3>The three calendars</h3>\n <p>\n Every event belongs to one of three calendars, and that is what decides who can see it and\n who can change it.\n </p>\n <dl>\n <dt><span class=\"swatch personal\"></span> Personal</dt>\n <dd>\n Your own events. Nobody else can see them, and they are never public. Use them for the\n things you want on the same grid as everything else without telling anyone about them.\n </dd>\n\n <dt><span class=\"swatch project\"></span> Project</dt>\n <dd>\n Events belonging to a project: release votes, community calls, meetups. Public ones are\n visible to everyone, including people who are not signed in. Private ones are visible only\n to the project's committee (its PMC).\n </dd>\n\n <dt><span class=\"swatch foundation\"></span> Foundation</dt>\n <dd>\n Events for the ASF as a whole: board meetings, ApacheCon, report deadlines. Public ones are\n visible to everyone; private ones only to foundation members.\n </dd>\n </dl>\n </section>\n\n <section>\n <h3>Who can do what</h3>\n <p>\n The lists of projects and committees you belong to come from your Apache account, through the\n same login the rest of the foundation's tools use. There is nothing to configure here: sign\n in and the calendar knows.\n </p>\n <div class=\"tablewrap\">\n <table>\n <thead>\n <tr>\n <th scope=\"col\"> </th>\n {#each COLUMNS as column (column)}\n <th scope=\"col\">{column}</th>\n {/each}\n </tr>\n </thead>\n <tbody>\n {#each ROWS as row (row.what)}\n <tr>\n <th scope=\"row\">{row.what}</th>\n {#each row.cells as cell, index (index)}\n <td>\n {#if cell === true}\n <span class=\"yes\" aria-label=\"yes\">✓</span>\n {:else if cell === false}\n <span class=\"no\" aria-label=\"no\">–</span>\n {:else}\n <span class=\"note\">{cell}</span>\n {/if}\n </td>\n {/each}\n </tr>\n {/each}\n </tbody>\n </table>\n </div>\n <p class=\"muted small\">\n \"Own projects\" means the projects you commit to; \"own committees\" means the PMCs you sit on.\n Being on a committee also counts as being a member of that project. Any project member can\n edit any of their project's events, not only the ones they added themselves.\n </p>\n </section>\n\n <section>\n <h3>Getting around</h3>\n <ul>\n <li><strong>Day, week, month, year and agenda</strong> are the five views. Pick one at the top.</li>\n <li>\n The <strong>‹</strong> and <strong>›</strong> buttons move one view-sized step:\n a day in the day view, a month in the month view, and so on. <strong>Today</strong> jumps\n back to now.\n </li>\n <li>\n Clicking a date number in the month or year view opens that day. Clicking a month name in\n the year view opens that month.\n </li>\n <li>\n A day with more events than fit shows <strong>+n more</strong>; click it to open the day.\n </li>\n <li>Clicking any event opens it, with its full details, shortlink and download link.</li>\n </ul>\n </section>\n\n <section>\n <h3>Filters and search</h3>\n <p>\n The panel on the left narrows what is drawn. It does not change what you have access to; it\n only hides things you would rather not look at right now.\n </p>\n <ul>\n <li>\n <strong>Calendars</strong> switches the three categories on and off. When you sign in, all\n three start switched on, along with every project you belong to.\n </li>\n <li>\n <strong>Projects</strong> lists your projects plus any others that appear in the events\n currently loaded. Projects you are not a member of stay visible unless you narrow the list\n yourself.\n </li>\n <li><strong>Visibility</strong> lets you look at only the public or only the private events.</li>\n <li>\n <strong>Search</strong> matches the title, description, location and project name of the\n events in view.\n </li>\n <li><strong>Sort</strong> appears in the agenda view, where the order is yours to choose.</li>\n </ul>\n </section>\n\n <section id=\"timezones\">\n <h3>Timezones</h3>\n <p>\n An event happens at one moment in time, but that moment has a different clock reading\n depending on where you are. The calendar keeps those two things apart.\n </p>\n <ul>\n <li>\n The switch at the top of the page chooses the clock the calendar is <em>drawn</em> in.\n <strong>Local</strong> follows your browser, which right now says\n <strong>{browserZone()}</strong> - {describeDisplayZone(\"local\")} - and the picker beside\n it holds any of the major timezones, starting on UTC. It is currently set to\n <strong>{describeDisplayZone(zone)}</strong>. Flipping it moves everything together: the\n grid, the times on each event, and which day an event falls on.\n </li>\n <li>\n <strong>You can watch more than one clock at once.</strong> Under \"Timezones\" in the panel\n on the left, add up to three comparison timezones. They appear as extra hour columns beside\n the week and day grids, after the time on each agenda row, and in an event's details - so\n you can see an event in the organiser's own time and in yours without doing the arithmetic.\n {#if compareZones.length > 0}\n You are currently comparing against\n <strong>{compareZones.map((other) => resolveZone(other)).join(\", \")}</strong>.\n {/if}\n The grid itself can only be drawn on one clock, so the extra ones are labels rather than\n extra columns of events.\n </li>\n <li>\n When you add an event you also choose the timezone the times are <em>in</em>. If you are\n organising a call at 15:00 Berlin time, pick Europe/Berlin and type 15:00, and everybody\n else will see it at their own 15:00-equivalent. Changing the timezone in the form keeps the\n clock reading and moves the moment, which is almost always what you meant.\n </li>\n <li>\n Zone names such as <code>Europe/Copenhagen</code> are how the timezone database identifies\n a clock, not a guess about where you are sitting. The calendar shows the city and the\n current offset together so it is obvious why a particular clock was chosen.\n </li>\n <li>\n <strong>All-day events are dates, not moments.</strong> An all-day event on 14 March is on\n 14 March for everyone, and does not shift when you change the switch.\n </li>\n </ul>\n </section>\n\n <section>\n <h3>Adding and changing events</h3>\n <p>\n <strong>New event</strong> appears at the top once you are signed in and have somewhere to\n put an event. The form only offers the calendars you can actually write to, so if you cannot\n see a \"Foundation\" option it is because you are not a foundation member.\n </p>\n <ul>\n <li>A title and a start time are the only things required. An event with no end lasts an hour.</li>\n <li>\n <strong>All day</strong> turns the time fields into date fields. A one-day event is a\n single date; a conference is a range.\n </li>\n <li>\n <strong>Visibility</strong> is public or private. Private means the project committee for\n project events, and foundation members for foundation events. Personal events are always\n private, so there is no choice to make.\n </li>\n <li>\n To edit or delete, open the event and use <strong>Edit</strong>. It only appears if you are\n allowed. You cannot move an event into a calendar you cannot write to, or out of one.\n </li>\n </ul>\n </section>\n\n <section>\n <h3>Bringing events in from another calendar</h3>\n <p>\n <strong>Import</strong>, next to New event, takes an <code>.ics</code> file and turns\n everything in it into events. Most calendar applications can export one.\n </p>\n <ul>\n <li>\n Choose the file first and you get a preview of what was found, including anything the\n importer had to change. Nothing is saved at this point.\n </li>\n <li>\n Then say which calendar the events belong to, and whether they are public or private. You\n have to answer: an import can add a lot of events at once, so there is no default that\n could quietly put them in the wrong place.\n </li>\n <li>\n Every event in the file goes to the same calendar. Import twice if some belong to a\n project and others do not.\n </li>\n <li>\n Repeating events come in as a single occurrence, since the calendar has no recurrence.\n Cancelled entries, and ones with no start time, are skipped and counted for you.\n </li>\n </ul>\n </section>\n\n <section>\n <h3>Shortlinks and subscribing</h3>\n <ul>\n <li>\n Every event has a short URL, shown in its details, that opens the event directly. It is\n safe to paste anywhere: someone who cannot see the event gets told so rather than shown it.\n Public events show their title in link previews; private ones deliberately do not.\n </li>\n <li>\n <strong>Download .ics</strong> in an event's details saves that one event for your own\n calendar application.\n </li>\n <li>\n <strong>Download .ics</strong> at the bottom of the filter panel gives you everything\n currently in view, filters and all.\n </li>\n </ul>\n </section>\n\n <section>\n <h3>Putting the agenda on your own site</h3>\n <p>\n A project website can carry a live list of its upcoming events with an iframe. No script and\n no account are needed, and it stays up to date on its own.\n </p>\n <pre><iframe src=\"{embedExample}\" width=\"100%\" height=\"420\"></iframe></pre>\n <p class=\"muted small\">\n An embed always shows public events only, whoever is looking at it. Your session does not\n travel to another site, which is exactly what you want. The project README lists the\n parameters it takes and the headers a deployment needs.\n </p>\n </section>\n\n <section>\n <h3>Talking to the calendar from a script</h3>\n <p>\n Everything the web interface does goes through a documented HTTP API, and so can anything\n else. The <strong>API</strong> button at the top of the page opens the reference, with a\n \"try it out\" button on each endpoint that calls this deployment for real.\n </p>\n <p class=\"muted small\">\n The description is generated from the running service, so it always matches what is actually\n deployed. Machine-readable copies live at\n <a href={apiUrl(\"/openapi.json\")}>openapi.json</a> and\n <a href={apiUrl(\"/openapi.yaml\")}>openapi.yaml</a>, ready for a client generator.\n </p>\n </section>\n\n <section>\n <h3>Signing in</h3>\n {#if session?.authenticated}\n <p>\n You are signed in. <a href={session.logout_url ?? logoutUrl()}>Log out</a> when you\n are done, particularly on a shared machine.\n </p>\n {:else}\n <p>\n <a href={session?.login_url ?? loginUrl()}>Log in</a> with your Apache account. You\n will be sent to the foundation's OAuth service and back again. Nothing is stored here\n beyond your username and the projects and committees you belong to.\n </p>\n {/if}\n <p class=\"muted small\">\n If your affiliations have changed recently and the calendar has not noticed, log out and back\n in; the lists are read when you sign in.\n </p>\n </section>\n\n <footer>\n <button type=\"button\" class=\"btn primary\" onclick={onclose}>Back to the calendar</button>\n </footer>\n </div>\n</div>\n\n<style>\n .help {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n padding: 1.5rem 1rem 4rem;\n }\n\n .sheet {\n max-width: 52rem;\n margin: 0 auto;\n background: var(--bg-panel);\n border: 1px solid var(--border);\n border-radius: var(--radius);\n box-shadow: var(--shadow);\n padding: 1.5rem 1.8rem 1.8rem;\n }\n\n header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 1rem;\n flex-wrap: wrap;\n }\n\n h2 {\n margin: 0;\n font-size: 22px;\n }\n\n h3 {\n margin: 0 0 0.4rem;\n font-size: 15px;\n color: var(--asf-red);\n }\n\n .status {\n margin: 0.6rem 0 0;\n padding: 0.5rem 0.8rem;\n background: var(--bg-subtle);\n border-radius: var(--radius);\n font-size: 13px;\n }\n\n section {\n margin-top: 1.6rem;\n }\n\n p,\n li {\n max-width: 62ch;\n }\n\n ul {\n margin: 0.3rem 0;\n padding-left: 1.2rem;\n }\n\n li {\n margin-bottom: 0.35rem;\n }\n\n dl {\n margin: 0.5rem 0 0;\n }\n\n dt {\n display: flex;\n align-items: center;\n gap: 0.45rem;\n font-weight: 700;\n margin-top: 0.7rem;\n }\n\n dd {\n margin: 0.15rem 0 0 1.4rem;\n max-width: 62ch;\n }\n\n .swatch {\n width: 11px;\n height: 11px;\n border-radius: 3px;\n display: inline-block;\n }\n\n .swatch.personal {\n background: hsl(265 60% 55%);\n }\n\n .swatch.project {\n background: hsl(210 60% 55%);\n }\n\n .swatch.foundation {\n background: hsl(0 60% 55%);\n }\n\n .tablewrap {\n overflow-x: auto;\n margin: 0.6rem 0;\n }\n\n table {\n border-collapse: collapse;\n width: 100%;\n font-size: 13px;\n }\n\n th,\n td {\n border: 1px solid var(--border);\n padding: 0.35rem 0.6rem;\n text-align: center;\n }\n\n thead th {\n background: var(--bg-subtle);\n font-size: 12px;\n }\n\n tbody th {\n text-align: left;\n font-weight: 500;\n white-space: nowrap;\n }\n\n .yes {\n color: hsl(140 60% 35%);\n font-weight: 700;\n }\n\n .no {\n color: var(--text-faint);\n }\n\n .note {\n font-size: 11px;\n color: var(--text-muted);\n }\n\n .small {\n font-size: 12px;\n }\n\n pre {\n margin: 0.4rem 0;\n padding: 0.5rem 0.7rem;\n background: var(--bg-subtle);\n border-radius: var(--radius);\n font-size: 11px;\n overflow-x: auto;\n }\n\n footer {\n margin-top: 2rem;\n padding-top: 1rem;\n border-top: 1px solid var(--border);\n }\n\n @media (prefers-color-scheme: dark) {\n .yes {\n color: hsl(140 50% 60%);\n }\n }\n</style>\n","<script lang=\"ts\">\n import { apiUrl, assetUrl } from \"../lib/base\";\n\n interface Props {\n onclose: () => void;\n }\n\n let { onclose }: Props = $props();\n\n interface SwaggerRequest {\n headers: Record<string, string>;\n credentials?: RequestCredentials;\n }\n\n type SwaggerFactory = (options: Record<string, unknown>) => unknown;\n\n let host = $state<HTMLElement | null>(null);\n let status = $state<\"loading\" | \"ready\" | \"failed\">(\"loading\");\n let failure = $state<string | null>(null);\n\n const SCRIPT = \"vendor/swagger-ui-bundle.js\";\n const STYLES = \"vendor/swagger-ui.css\";\n\n /** Loads a script once, reusing the tag if the docs are opened again. */\n function loadScript(src: string): Promise<void> {\n const existing = document.querySelector<HTMLScriptElement>(`script[data-swagger=\"${src}\"]`);\n if (existing) {\n return existing.dataset.loaded === \"yes\"\n ? Promise.resolve()\n : new Promise((resolve, reject) => {\n existing.addEventListener(\"load\", () => resolve());\n existing.addEventListener(\"error\", () => reject(new Error(src)));\n });\n }\n return new Promise((resolve, reject) => {\n const tag = document.createElement(\"script\");\n tag.src = src;\n tag.async = true;\n tag.dataset.swagger = src;\n tag.addEventListener(\"load\", () => {\n tag.dataset.loaded = \"yes\";\n resolve();\n });\n tag.addEventListener(\"error\", () => reject(new Error(src)));\n document.head.appendChild(tag);\n });\n }\n\n /**\n * Swagger UI's stylesheet has a few rules that are not scoped to its own\n * container, so it is removed again when the docs are closed rather than\n * left to affect the calendar.\n */\n function loadStyles(href: string): HTMLLinkElement {\n const tag = document.createElement(\"link\");\n tag.rel = \"stylesheet\";\n tag.href = href;\n tag.dataset.swagger = \"styles\";\n document.head.appendChild(tag);\n return tag;\n }\n\n $effect(() => {\n if (!host) return;\n const styles = loadStyles(assetUrl(STYLES));\n let cancelled = false;\n\n void (async () => {\n try {\n await loadScript(assetUrl(SCRIPT));\n const factory = (globalThis as { SwaggerUIBundle?: SwaggerFactory }).SwaggerUIBundle;\n if (!factory) throw new Error(\"SwaggerUIBundle did not register itself\");\n if (cancelled || !host) return;\n\n factory({\n url: apiUrl(\"/openapi.json\"),\n domNode: host,\n deepLinking: false,\n docExpansion: \"list\",\n defaultModelsExpandDepth: 1,\n tryItOutEnabled: true,\n persistAuthorization: false,\n supportedSubmitMethods: [\"get\", \"post\", \"put\", \"patch\", \"delete\"],\n requestInterceptor: (request: SwaggerRequest) => {\n // Without this the API answers an unauthenticated write with a\n // redirect to the OAuth provider instead of a readable 401.\n request.headers[\"X-No-Redirect\"] = \"1\";\n // Same origin as the docs page, so a logged-in reader can try the\n // endpoints that need a session.\n request.credentials = \"same-origin\";\n return request;\n },\n });\n status = \"ready\";\n } catch (error) {\n failure =\n error instanceof Error && error.message.includes(SCRIPT)\n ? \"Swagger UI could not be loaded. If this is a development server, run 'npm run build' \" +\n \"in frontend/ so the vendored files are in place.\"\n : \"Swagger UI could not be started.\";\n status = \"failed\";\n }\n })();\n\n return () => {\n cancelled = true;\n styles.remove();\n };\n });\n</script>\n\n<div class=\"docs\">\n <header>\n <div>\n <h2>HTTP API</h2>\n <p class=\"muted\">\n Generated from the running service, so it always describes this deployment. Machine-readable\n copies: <a href={apiUrl(\"/openapi.json\")}>openapi.json</a> and\n <a href={apiUrl(\"/openapi.yaml\")}>openapi.yaml</a>.\n </p>\n </div>\n <button type=\"button\" class=\"btn\" onclick={onclose}>Back to the calendar</button>\n </header>\n\n {#if status === \"loading\"}\n <p class=\"note\">Loading the API documentation...</p>\n {:else if status === \"failed\"}\n <p class=\"note error\" role=\"alert\">{failure}</p>\n {/if}\n\n <div class=\"swagger\" bind:this={host}></div>\n</div>\n\n<style>\n .docs {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n padding: 1.2rem 1rem 4rem;\n }\n\n header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: 1rem;\n flex-wrap: wrap;\n max-width: 72rem;\n margin: 0 auto 0.5rem;\n }\n\n h2 {\n margin: 0;\n font-size: 22px;\n }\n\n header p {\n margin: 0.2rem 0 0;\n font-size: 13px;\n max-width: 60ch;\n }\n\n .note {\n max-width: 72rem;\n margin: 1rem auto;\n color: var(--text-muted);\n }\n\n .note.error {\n color: var(--asf-red);\n }\n\n .swagger {\n max-width: 72rem;\n margin: 0 auto;\n }\n\n /* Swagger UI ships its own white theme. Keeping it on a light card rather\n than fighting it means it stays legible when the calendar is in dark mode. */\n .swagger:not(:empty) {\n background: #fff;\n color: #3b4151;\n border-radius: var(--radius);\n border: 1px solid var(--border);\n overflow: hidden;\n }\n</style>\n","/**\n * Importing an iCalendar file.\n *\n * The file itself is read by the backend, which knows how to cope with what\n * Google, Outlook and Thunderbird produce. What lives here is the decision the\n * backend cannot make: which calendar the events should land in.\n *\n * That decision is deliberately not defaulted. An import can create dozens of\n * events at once, and a wrong default would publish somebody's private meetings\n * or file them under the wrong project, so the form starts with nothing chosen\n * and `importReadiness` reports what is still missing.\n */\n\nimport type { Calendars, Category, Visibility } from \"./types\";\n\n/** An event the backend found in the file, before it is given a calendar. */\nexport interface ImportCandidate {\n title: string;\n start: string;\n end: string;\n all_day: boolean;\n description: string;\n location: string;\n url: string;\n timezone: string;\n uid: string | null;\n /** What the backend had to change to make this event importable. */\n warnings: string[];\n}\n\nexport interface ImportPreview {\n events: ImportCandidate[];\n count: number;\n /** Problems with the file as a whole, such as entries that were skipped. */\n warnings: string[];\n}\n\nexport interface ImportResult {\n created: import(\"./types\").CalendarEvent[];\n count: number;\n warnings: string[];\n}\n\n/** What the form collects. Null means \"not chosen yet\", not \"default\". */\nexport interface ImportSettings {\n category: Category | null;\n project: string | null;\n visibility: Visibility | null;\n}\n\n/** The same thing once every required answer is in. */\nexport interface ResolvedImportSettings {\n category: Category;\n project: string | null;\n visibility: Visibility | null;\n}\n\nexport function emptySettings(): ImportSettings {\n return { category: null, project: null, visibility: null };\n}\n\n/** The calendars this session may import into, in the order to offer them. */\nexport function importableCategories(calendars: Calendars | null): Category[] {\n const can = calendars?.can_create;\n if (!can) return [];\n const categories: Category[] = [];\n if (can.personal) categories.push(\"personal\");\n if (can.project.length > 0) categories.push(\"project\");\n if (can.foundation) categories.push(\"foundation\");\n return categories;\n}\n\n/**\n * The projects that can take an import, which depends on the visibility: a\n * committer can add public events to their projects, but a private one needs\n * the committee.\n */\nexport function importableProjects(\n calendars: Calendars | null,\n visibility: Visibility | null,\n): string[] {\n const can = calendars?.can_create;\n if (!can) return [];\n return visibility === \"private\" ? can.project_private : can.project;\n}\n\nexport function importableVisibilities(\n category: Category | null,\n calendars: Calendars | null,\n): Visibility[] {\n if (category === \"personal\") return [];\n if (category === \"foundation\") return calendars?.can_create.foundation ? [\"public\", \"private\"] : [];\n if (category === \"project\") {\n const can = calendars?.can_create;\n if (!can) return [];\n return can.project_private.length > 0 ? [\"public\", \"private\"] : [\"public\"];\n }\n return [];\n}\n\nexport interface Readiness {\n ready: boolean;\n /** What the reader still has to answer, in words fit for a hint. */\n missing: string[];\n}\n\n/**\n * Whether the form has enough to save, and what is missing if not.\n *\n * Personal events have no project and no visibility to choose - they are\n * always private to their owner - so those are not asked for.\n */\nexport function importReadiness(settings: ImportSettings, calendars: Calendars | null): Readiness {\n const missing: string[] = [];\n\n const categories = importableCategories(calendars);\n if (settings.category === null) {\n missing.push(\"which calendar these events belong to\");\n } else if (!categories.includes(settings.category)) {\n missing.push(\"a calendar you are allowed to add to\");\n }\n\n if (settings.category !== null && settings.category !== \"personal\") {\n if (settings.visibility === null) {\n missing.push(\"whether they are public or private\");\n } else if (!importableVisibilities(settings.category, calendars).includes(settings.visibility)) {\n missing.push(\"a visibility you are allowed to use\");\n }\n }\n\n if (settings.category === \"project\") {\n const projects = importableProjects(calendars, settings.visibility);\n if (settings.project === null) {\n missing.push(\"which project they belong to\");\n } else if (!projects.includes(settings.project)) {\n missing.push(\"a project you are allowed to add to\");\n }\n }\n\n return { ready: missing.length === 0, missing };\n}\n\n/** The settings, once ready, in the shape the API takes. */\nexport function resolveSettings(settings: ImportSettings): ResolvedImportSettings {\n if (settings.category === null) throw new Error(\"resolveSettings called before a category was chosen\");\n return {\n category: settings.category,\n project: settings.category === \"project\" ? settings.project : null,\n visibility: settings.category === \"personal\" ? null : settings.visibility,\n };\n}\n\n/**\n * Keeps the form consistent when the category or visibility changes: a project\n * that is no longer offered should not stay quietly selected.\n */\nexport function reconcile(settings: ImportSettings, calendars: Calendars | null): ImportSettings {\n const next: ImportSettings = { ...settings };\n if (next.category !== \"project\") next.project = null;\n if (next.category === \"personal\") next.visibility = null;\n if (next.category === \"project\" && next.project !== null) {\n if (!importableProjects(calendars, next.visibility).includes(next.project)) next.project = null;\n }\n if (next.visibility !== null && next.category !== null) {\n if (!importableVisibilities(next.category, calendars).includes(next.visibility)) {\n next.visibility = null;\n }\n }\n return next;\n}\n\n/** True if the file looks like something worth sending. */\nexport function looksLikeCalendar(file: File): boolean {\n return /\\.ics$/i.test(file.name) || file.type === \"text/calendar\";\n}\n","<script lang=\"ts\">\n import type { Calendars, Category, Visibility } from \"../lib/types\";\n import type { DisplayZone } from \"../lib/timezone\";\n import type { ImportCandidate, ImportPreview, ImportSettings } from \"../lib/importing\";\n import {\n emptySettings,\n importReadiness,\n importableCategories,\n importableProjects,\n importableVisibilities,\n looksLikeCalendar,\n reconcile,\n resolveSettings,\n } from \"../lib/importing\";\n import { api, ApiError } from \"../lib/api\";\n import { formatDate, formatTime } from \"../lib/dates\";\n import { categoryLabel } from \"../lib/events\";\n import { shortZoneLabel, toWall } from \"../lib/timezone\";\n\n interface Props {\n calendars: Calendars | null;\n /** The clock the reader is using, so the preview matches the calendar. */\n zone?: DisplayZone;\n onclose: () => void;\n /** Called with the number of events created, so the calendar can reload. */\n onimported: (count: number) => void;\n }\n\n let { calendars, zone = \"local\", onclose, onimported }: Props = $props();\n\n let file = $state<File | null>(null);\n let preview = $state<ImportPreview | null>(null);\n let settings = $state<ImportSettings>(emptySettings());\n let reading = $state(false);\n let saving = $state(false);\n let error = $state<string | null>(null);\n let dragging = $state(false);\n\n let categories = $derived(importableCategories(calendars));\n let visibilities = $derived(importableVisibilities(settings.category, calendars));\n let projects = $derived(importableProjects(calendars, settings.visibility));\n let readiness = $derived(importReadiness(settings, calendars));\n let canSave = $derived(preview !== null && preview.count > 0 && readiness.ready && !saving);\n\n function update(change: Partial<ImportSettings>) {\n settings = reconcile({ ...settings, ...change }, calendars);\n }\n\n async function choose(chosen: File | null | undefined) {\n if (!chosen) return;\n file = chosen;\n preview = null;\n error = null;\n reading = true;\n try {\n preview = await api.previewImport(chosen);\n if (!looksLikeCalendar(chosen)) {\n // It parsed, so the name was just unhelpful. Worth knowing, not worth\n // refusing.\n error = null;\n }\n } catch (failure) {\n error = failure instanceof ApiError ? failure.message : \"That file could not be read.\";\n file = null;\n } finally {\n reading = false;\n }\n }\n\n async function save() {\n if (!file || !canSave) return;\n saving = true;\n error = null;\n try {\n const result = await api.runImport(file, resolveSettings(settings));\n onimported(result.count);\n } catch (failure) {\n error = failure instanceof ApiError ? failure.message : \"Those events could not be saved.\";\n } finally {\n saving = false;\n }\n }\n\n function onDrop(event: DragEvent) {\n event.preventDefault();\n dragging = false;\n void choose(event.dataTransfer?.files?.[0]);\n }\n\n function keydown(event: KeyboardEvent) {\n if (event.key === \"Escape\") onclose();\n }\n\n function when(candidate: ImportCandidate): string {\n const start = toWall(new Date(candidate.start), zone);\n if (candidate.all_day) {\n const last = toWall(new Date(new Date(candidate.end).getTime() - 1), zone);\n return last.toDateString() === start.toDateString()\n ? `${formatDate(start)} (all day)`\n : `${formatDate(start)} - ${formatDate(last)} (all day)`;\n }\n const end = toWall(new Date(candidate.end), zone);\n return `${formatDate(start)}, ${formatTime(start)} - ${formatTime(end)} ${shortZoneLabel(zone)}`;\n }\n\n let warningCount = $derived(\n (preview?.warnings.length ?? 0) +\n (preview?.events ?? []).reduce((total, event) => total + event.warnings.length, 0),\n );\n</script>\n\n<svelte:window onkeydown={keydown} />\n\n<!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_static_element_interactions -->\n<div class=\"backdrop\" onclick={onclose}>\n <!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_static_element_interactions -->\n <div\n class=\"dialog\"\n role=\"dialog\"\n tabindex=\"-1\"\n aria-modal=\"true\"\n aria-label=\"Import an iCalendar file\"\n onclick={(event) => event.stopPropagation()}\n >\n <h2>Import events from a calendar file</h2>\n\n {#if error}\n <p class=\"error\" role=\"alert\">{error}</p>\n {/if}\n\n <!-- svelte-ignore a11y_no_static_element_interactions -->\n <div\n class=\"dropzone\"\n class:dragging\n ondragover={(event) => {\n event.preventDefault();\n dragging = true;\n }}\n ondragleave={() => (dragging = false)}\n ondrop={onDrop}\n >\n <label class=\"btn\">\n Choose a file\n <input\n type=\"file\"\n accept=\".ics,text/calendar\"\n onchange={(event) => choose(event.currentTarget.files?.[0])}\n />\n </label>\n <span class=\"muted\">\n {#if file}{file.name}{:else}or drop an .ics file here{/if}\n </span>\n </div>\n\n {#if reading}\n <p class=\"note\">Reading the file...</p>\n {/if}\n\n {#if preview}\n <section class=\"preview\">\n <h3>\n {preview.count}\n {preview.count === 1 ? \"event\" : \"events\"} found\n {#if warningCount > 0}\n <span class=\"muted\">- {warningCount} thing{warningCount === 1 ? \"\" : \"s\"} to note</span>\n {/if}\n </h3>\n\n {#each preview.warnings as warning (warning)}\n <p class=\"warning\">{warning}</p>\n {/each}\n\n <ul>\n {#each preview.events as candidate, index (candidate.uid ?? index)}\n <li>\n <span class=\"title\">{candidate.title}</span>\n <span class=\"when\">{when(candidate)}</span>\n {#if candidate.location}<span class=\"where muted\">{candidate.location}</span>{/if}\n {#each candidate.warnings as warning (warning)}\n <span class=\"warning inline\">{warning}</span>\n {/each}\n </li>\n {/each}\n </ul>\n </section>\n\n <section class=\"settings\">\n <h3>Where should they go?</h3>\n\n <div class=\"pair\">\n <label class=\"row\">\n <span>Calendar</span>\n <select\n value={settings.category ?? \"\"}\n onchange={(event) =>\n update({ category: (event.currentTarget.value || null) as Category | null })}\n >\n <option value=\"\">Choose...</option>\n {#each categories as category (category)}\n <option value={category}>{categoryLabel(category)}</option>\n {/each}\n </select>\n </label>\n\n {#if settings.category !== null && settings.category !== \"personal\"}\n <label class=\"row\">\n <span>Visibility</span>\n <select\n value={settings.visibility ?? \"\"}\n onchange={(event) =>\n update({ visibility: (event.currentTarget.value || null) as Visibility | null })}\n >\n <option value=\"\">Choose...</option>\n {#each visibilities as visibility (visibility)}\n <option value={visibility}>{visibility}</option>\n {/each}\n </select>\n </label>\n {/if}\n\n {#if settings.category === \"project\"}\n <label class=\"row\">\n <span>Project</span>\n <select\n value={settings.project ?? \"\"}\n onchange={(event) => update({ project: event.currentTarget.value || null })}\n >\n <option value=\"\">Choose...</option>\n {#each projects as project (project)}\n <option value={project}>{project}</option>\n {/each}\n </select>\n </label>\n {/if}\n </div>\n\n {#if settings.category === \"personal\"}\n <p class=\"muted small\">Personal events are always private to you.</p>\n {/if}\n\n {#if !readiness.ready}\n <p class=\"missing\" role=\"status\">\n Still to choose: {readiness.missing.join(\", \")}.\n </p>\n {/if}\n </section>\n {/if}\n\n <footer>\n <span class=\"spacer\"></span>\n <button type=\"button\" class=\"btn\" onclick={onclose} disabled={saving}>Cancel</button>\n <button type=\"button\" class=\"btn primary\" onclick={save} disabled={!canSave}>\n {#if saving}\n Importing...\n {:else if preview}\n Import {preview.count} {preview.count === 1 ? \"event\" : \"events\"}\n {:else}\n Import\n {/if}\n </button>\n </footer>\n </div>\n</div>\n\n<style>\n .backdrop {\n position: fixed;\n inset: 0;\n background: rgba(10, 14, 20, 0.45);\n display: flex;\n align-items: flex-start;\n justify-content: center;\n padding: 3rem 1rem;\n overflow-y: auto;\n z-index: 50;\n }\n\n .dialog {\n width: min(42rem, 100%);\n background: var(--bg-panel);\n border-radius: 10px;\n border-top: 4px solid var(--asf-red);\n box-shadow: var(--shadow-lg);\n padding: 1.2rem 1.4rem 1rem;\n }\n\n h2 {\n margin: 0 0 0.8rem;\n font-size: 19px;\n }\n\n h3 {\n margin: 0 0 0.4rem;\n font-size: 12px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--text-muted);\n }\n\n .error {\n margin: 0 0 0.8rem;\n padding: 0.5rem 0.7rem;\n border-radius: var(--radius);\n background: hsl(0 70% 95%);\n border: 1px solid hsl(0 60% 75%);\n color: hsl(0 65% 30%);\n }\n\n .dropzone {\n display: flex;\n align-items: center;\n gap: 0.7rem;\n padding: 1rem;\n border: 2px dashed var(--border-strong);\n border-radius: var(--radius);\n background: var(--bg-subtle);\n }\n\n .dropzone.dragging {\n border-color: var(--asf-red);\n background: var(--bg-hover);\n }\n\n .dropzone input[type=\"file\"] {\n position: absolute;\n width: 1px;\n height: 1px;\n opacity: 0;\n }\n\n .dropzone label {\n cursor: pointer;\n }\n\n .note {\n margin: 0.7rem 0 0;\n color: var(--text-muted);\n }\n\n .preview,\n .settings {\n margin-top: 1.1rem;\n }\n\n .preview ul {\n list-style: none;\n margin: 0;\n padding: 0;\n max-height: 16rem;\n overflow-y: auto;\n border: 1px solid var(--border);\n border-radius: var(--radius);\n }\n\n .preview li {\n display: flex;\n flex-direction: column;\n gap: 1px;\n padding: 0.4rem 0.6rem;\n border-bottom: 1px solid var(--border);\n }\n\n .preview li:last-child {\n border-bottom: 0;\n }\n\n .title {\n font-weight: 600;\n }\n\n .when {\n font-size: 12px;\n color: var(--text-muted);\n font-variant-numeric: tabular-nums;\n }\n\n .where {\n font-size: 12px;\n }\n\n .warning {\n margin: 0 0 0.4rem;\n font-size: 12px;\n color: hsl(28 70% 30%);\n background: hsl(38 92% 92%);\n border: 1px solid hsl(38 60% 78%);\n border-radius: var(--radius);\n padding: 0.3rem 0.5rem;\n }\n\n .warning.inline {\n margin: 0.2rem 0 0;\n display: block;\n }\n\n .pair {\n display: flex;\n gap: 0.7rem;\n flex-wrap: wrap;\n }\n\n .row {\n display: flex;\n flex-direction: column;\n gap: 0.2rem;\n flex: 1 1 10rem;\n }\n\n .row > span {\n font-size: 11px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--text-muted);\n }\n\n .missing {\n margin: 0.6rem 0 0;\n font-size: 13px;\n color: var(--asf-red);\n }\n\n .small {\n font-size: 12px;\n margin: 0.5rem 0 0;\n }\n\n footer {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin-top: 1.2rem;\n padding-top: 0.8rem;\n border-top: 1px solid var(--border);\n }\n\n .spacer {\n flex: 1;\n }\n\n @media (prefers-color-scheme: dark) {\n .error {\n background: hsl(0 40% 20%);\n border-color: hsl(0 40% 40%);\n color: hsl(0 70% 85%);\n }\n\n .warning {\n background: hsl(38 40% 20%);\n border-color: hsl(38 40% 35%);\n color: hsl(38 80% 82%);\n }\n }\n</style>\n","<script lang=\"ts\">\n import type { CalendarEvent, Calendars, EventDraft, Filters, SessionInfo, ViewName } from \"./lib/types\";\n import { VIEWS } from \"./lib/types\";\n import { api, ApiError } from \"./lib/api\";\n import { rangeForView, startOfDay, step } from \"./lib/dates\";\n import { applyFilters, defaultFilters, projectsInPlay, sortEvents } from \"./lib/filters\";\n import { canCreateAnything, canEdit, draftFromEvent, newDraft } from \"./lib/drafts\";\n import type { DisplayZone } from \"./lib/timezone\";\n import {\n LOCAL,\n UTC,\n fromWall,\n normaliseZone,\n nowInZone,\n toWall,\n uniqueZones,\n } from \"./lib/timezone\";\n import { appPath, withoutBase } from \"./lib/base\";\n\n import Header from \"./components/Header.svelte\";\n import FilterPanel from \"./components/FilterPanel.svelte\";\n import MonthView from \"./components/MonthView.svelte\";\n import WeekView from \"./components/WeekView.svelte\";\n import YearView from \"./components/YearView.svelte\";\n import AgendaView from \"./components/AgendaView.svelte\";\n import EventDialog from \"./components/EventDialog.svelte\";\n import HelpPage from \"./components/HelpPage.svelte\";\n import ApiDocs from \"./components/ApiDocs.svelte\";\n import ImportDialog from \"./components/ImportDialog.svelte\";\n\n const VIEW_STORAGE_KEY = \"asf-calendar-view\";\n const ZONE_STORAGE_KEY = \"asf-calendar-zone\";\n const ALT_ZONE_STORAGE_KEY = \"asf-calendar-alt-zone\";\n const COMPARE_ZONES_STORAGE_KEY = \"asf-calendar-compare-zones\";\n /** More than three extra clocks and the week grid has no room left for days. */\n const MAX_COMPARE_ZONES = 3;\n const SHORTLINK_PATTERN = /^\\/e\\/([A-Za-z0-9]+)\\/?$/;\n const HELP_PATH = \"/help\";\n const DOCS_PATH = \"/docs\";\n\n /** The current browser path with the deployment's mount point removed. */\n function routePath(): string | null {\n return withoutBase(globalThis.location?.pathname ?? \"/\");\n }\n\n function stored(key: string): string | null {\n try {\n return globalThis.localStorage?.getItem(key) ?? null;\n } catch {\n return null;\n }\n }\n\n function remember(key: string, value: string): void {\n try {\n globalThis.localStorage?.setItem(key, value);\n } catch {\n // Private browsing, or storage turned off. Not worth complaining about.\n }\n }\n\n function initialView(): ViewName {\n const saved = stored(VIEW_STORAGE_KEY);\n return (VIEWS as readonly string[]).includes(saved ?? \"\") ? (saved as ViewName) : \"month\";\n }\n\n function initialZone(): DisplayZone {\n return normaliseZone(stored(ZONE_STORAGE_KEY), LOCAL);\n }\n\n /** The zone the picker is parked on. UTC until the visitor picks another. */\n function initialAlternateZone(): DisplayZone {\n const saved = normaliseZone(stored(ALT_ZONE_STORAGE_KEY), UTC);\n return saved === LOCAL ? UTC : saved;\n }\n\n function initialCompareZones(): DisplayZone[] {\n const saved = stored(COMPARE_ZONES_STORAGE_KEY);\n if (!saved) return [];\n return uniqueZones(\n saved\n .split(\",\")\n .map((name) => normaliseZone(name, \"\"))\n .filter((name): name is DisplayZone => Boolean(name)),\n ).slice(0, MAX_COMPARE_ZONES);\n }\n\n /** True once the visitor has expressed a preference of their own. */\n function hasChosenZone(): boolean {\n return Boolean(stored(ZONE_STORAGE_KEY));\n }\n\n let view = $state<ViewName>(initialView());\n let zone = $state<DisplayZone>(initialZone());\n let alternateZone = $state<DisplayZone>(initialAlternateZone());\n let compareZones = $state<DisplayZone[]>(initialCompareZones());\n // The cursor is a wall date: its local getters read as the display zone.\n let cursor = $state<Date>(startOfDay(nowInZone(initialZone())));\n let helpOpen = $state<boolean>(routePath() === HELP_PATH);\n let docsOpen = $state<boolean>(routePath() === DOCS_PATH);\n let events = $state<CalendarEvent[]>([]);\n let session = $state<SessionInfo | null>(null);\n let calendars = $state<Calendars | null>(null);\n let filters = $state<Filters>(defaultFilters(null));\n\n let loading = $state(false);\n let saving = $state(false);\n let loadError = $state<string | null>(null);\n let dialogError = $state<string | null>(null);\n let showFilters = $state(true);\n\n let selected = $state<CalendarEvent | null>(null);\n let draft = $state<EventDraft | null>(null);\n let importing = $state(false);\n\n let range = $derived(rangeForView(view, cursor));\n let knownProjects = $derived(projectsInPlay(events, calendars));\n let visible = $derived(sortEvents(applyFilters(events, filters, knownProjects), filters.sort, zone));\n let title = $derived(calendars?.title ?? \"ASF Community Calendar\");\n let editable = $derived(selected ? canEdit(selected, calendars) : false);\n let feedUrl = $derived(\n api.feedUrl({\n start: fromWall(range.start, zone),\n end: fromWall(range.end, zone),\n categories: [...filters.categories],\n visibility: filters.visibility,\n q: filters.search || undefined,\n }),\n );\n\n // ---- loading ------------------------------------------------------------\n\n async function loadIdentity() {\n try {\n const [who, cals] = await Promise.all([api.session(), api.calendars()]);\n session = who;\n calendars = cals;\n // Everything the user belongs to is on by default.\n filters = defaultFilters(cals);\n // The deployment can say which clock to open on; the visitor's own\n // choice, once made, always wins.\n if (!hasChosenZone()) zone = normaliseZone(cals.default_display_zone, zone);\n } catch (error) {\n loadError = error instanceof ApiError ? error.message : String(error);\n }\n }\n\n let loadToken = 0;\n\n async function loadEvents(from: Date, to: Date) {\n const token = ++loadToken;\n loading = true;\n try {\n const found = await api.events({ start: from, end: to });\n // A slow earlier request must not overwrite a newer result.\n if (token === loadToken) {\n events = found;\n loadError = null;\n }\n } catch (error) {\n if (token === loadToken) loadError = error instanceof ApiError ? error.message : String(error);\n } finally {\n if (token === loadToken) loading = false;\n }\n }\n\n $effect(() => {\n // The grid works in wall time; the API works in instants.\n const from = fromWall(range.start, zone);\n const to = fromWall(range.end, zone);\n void loadEvents(from, to);\n });\n\n $effect(() => {\n remember(VIEW_STORAGE_KEY, view);\n });\n\n $effect(() => {\n remember(ZONE_STORAGE_KEY, zone);\n });\n\n $effect(() => {\n remember(ALT_ZONE_STORAGE_KEY, alternateZone);\n });\n\n $effect(() => {\n remember(COMPARE_ZONES_STORAGE_KEY, compareZones.join(\",\"));\n });\n\n\n // ---- shortlink routing --------------------------------------------------\n\n async function openFromLocation() {\n const path = routePath();\n if (path === null) return; // Not a URL this app is mounted on.\n helpOpen = path === HELP_PATH;\n docsOpen = path === DOCS_PATH;\n const match = SHORTLINK_PATTERN.exec(path);\n if (!match) return;\n try {\n const event = await api.byShortlink(match[1]);\n selected = event;\n cursor = startOfDay(toWall(new Date(event.start), zone));\n } catch (error) {\n loadError =\n error instanceof ApiError && error.needsLogin\n ? \"That event is not public. Log in to see whether you have access.\"\n : \"That shortlink does not point at an event you can see.\";\n }\n }\n\n /** Pushes a route, in app terms: navigate(\"/help\") -> /calendar/help. */\n function navigate(path: string) {\n if (!globalThis.history) return;\n const target = appPath(path);\n if (globalThis.location.pathname !== target) globalThis.history.pushState({}, \"\", target);\n }\n\n function pushShortlink(event: CalendarEvent | null) {\n if (!globalThis.location) return;\n if (!event) {\n navigate(\"/\");\n return;\n }\n // The backend builds shortlink_url with the mount point already in it, so\n // push its path as-is rather than prefixing it a second time.\n const path = new URL(event.shortlink_url, globalThis.location.href).pathname;\n if (globalThis.location.pathname !== path) globalThis.history.pushState({}, \"\", path);\n }\n\n $effect(() => {\n void openFromLocation();\n const onPop = () => void openFromLocation();\n globalThis.addEventListener?.(\"popstate\", onPop);\n return () => globalThis.removeEventListener?.(\"popstate\", onPop);\n });\n\n void loadIdentity();\n\n // ---- actions ------------------------------------------------------------\n\n function selectEvent(event: CalendarEvent) {\n selected = event;\n draft = null;\n dialogError = null;\n pushShortlink(event);\n }\n\n function closeDialog() {\n selected = null;\n draft = null;\n dialogError = null;\n pushShortlink(null);\n }\n\n function startCreate(when: Date = nowInZone(zone)) {\n selected = null;\n dialogError = null;\n helpOpen = false;\n docsOpen = false;\n // The form is filled in from the wall clock the user is looking at.\n draft = newDraft(fromWall(when, zone), calendars);\n }\n\n function startImport() {\n selected = null;\n draft = null;\n dialogError = null;\n helpOpen = false;\n docsOpen = false;\n importing = true;\n }\n\n async function finishImport(count: number) {\n importing = false;\n // The imported events may be anywhere in time, so reload the window rather\n // than trying to splice them in.\n await loadEvents(fromWall(range.start, zone), fromWall(range.end, zone));\n loadError = count === 0 ? \"Nothing was imported.\" : null;\n }\n\n function startEdit() {\n if (selected) draft = draftFromEvent(selected);\n }\n\n async function save(next: EventDraft) {\n saving = true;\n dialogError = null;\n try {\n const saved = selected ? await api.update(selected.id, next) : await api.create(next);\n events = [...events.filter((event) => event.id !== saved.id), saved];\n selected = saved;\n draft = null;\n pushShortlink(saved);\n } catch (error) {\n dialogError = error instanceof ApiError ? error.message : String(error);\n } finally {\n saving = false;\n }\n }\n\n async function remove() {\n if (!selected) return;\n if (!globalThis.confirm?.(`Delete \"${selected.title}\"? This cannot be undone.`)) return;\n saving = true;\n dialogError = null;\n try {\n await api.remove(selected.id);\n events = events.filter((event) => event.id !== selected!.id);\n closeDialog();\n } catch (error) {\n dialogError = error instanceof ApiError ? error.message : String(error);\n } finally {\n saving = false;\n }\n }\n\n function goToDay(day: Date) {\n cursor = startOfDay(day);\n view = \"day\";\n }\n\n function goToMonth(month: Date) {\n cursor = startOfDay(month);\n view = \"month\";\n }\n\n /**\n * Switching the display zone keeps the date you are looking at. You asked to\n * see March 10th in UTC, not \"whatever March 10th local becomes in UTC\".\n */\n function setZone(next: DisplayZone) {\n zone = next;\n // A clock cannot usefully be compared against itself.\n compareZones = uniqueZones(compareZones, next);\n }\n\n function setCompareZones(next: DisplayZone[]) {\n compareZones = uniqueZones(next, zone).slice(0, MAX_COMPARE_ZONES);\n }\n\n function toggleHelp() {\n helpOpen = !helpOpen;\n if (helpOpen) docsOpen = false;\n navigate(helpOpen ? HELP_PATH : \"/\");\n }\n\n function toggleDocs() {\n docsOpen = !docsOpen;\n if (docsOpen) helpOpen = false;\n navigate(docsOpen ? DOCS_PATH : \"/\");\n }\n</script>\n\n<div class=\"layout\">\n <Header\n {title}\n {view}\n {cursor}\n {session}\n {loading}\n canCreate={canCreateAnything(calendars)}\n {zone}\n {alternateZone}\n {helpOpen}\n {docsOpen}\n onview={(next) => {\n view = next;\n helpOpen = false;\n docsOpen = false;\n }}\n onstep={(direction) => (cursor = step(view, cursor, direction))}\n ontoday={() => (cursor = startOfDay(nowInZone(zone)))}\n oncreate={() => startCreate(cursor)}\n onimport={startImport}\n ontogglefilters={() => (showFilters = !showFilters)}\n onzone={setZone}\n onalternatezone={(next) => (alternateZone = next)}\n onhelp={toggleHelp}\n ondocs={toggleDocs}\n />\n\n {#if loadError}\n <p class=\"banner\" role=\"alert\">\n {loadError}\n <button type=\"button\" class=\"btn\" onclick={() => (loadError = null)}>Dismiss</button>\n </p>\n {/if}\n\n <div class=\"body\">\n {#if helpOpen}\n <HelpPage {calendars} {session} {zone} {compareZones} onclose={toggleHelp} />\n {:else if docsOpen}\n <ApiDocs onclose={toggleDocs} />\n {:else}\n {#if showFilters}\n <FilterPanel\n {filters}\n {calendars}\n projects={knownProjects}\n {view}\n {feedUrl}\n {zone}\n {compareZones}\n maxCompareZones={MAX_COMPARE_ZONES}\n onchange={(next) => (filters = next)}\n oncomparezones={setCompareZones}\n />\n {/if}\n\n <main>\n {#if view === \"month\"}\n <MonthView {cursor} events={visible} {zone} onselect={selectEvent} onpickday={goToDay} />\n {:else if view === \"week\"}\n <WeekView\n {cursor}\n events={visible}\n {zone}\n {compareZones}\n onselect={selectEvent}\n onpickday={goToDay}\n />\n {:else if view === \"day\"}\n <WeekView\n {cursor}\n events={visible}\n {zone}\n {compareZones}\n days={1}\n onselect={selectEvent}\n onpickday={goToDay}\n />\n {:else if view === \"year\"}\n <YearView {cursor} events={visible} {zone} onpickday={goToDay} onpickmonth={goToMonth} />\n {:else}\n <AgendaView events={visible} {zone} {compareZones} onselect={selectEvent} />\n {/if}\n </main>\n {/if}\n </div>\n</div>\n\n{#if importing}\n <ImportDialog\n {calendars}\n {zone}\n onclose={() => (importing = false)}\n onimported={finishImport}\n />\n{/if}\n\n{#if selected || draft}\n <EventDialog\n event={selected}\n {draft}\n {calendars}\n {saving}\n error={dialogError}\n {editable}\n {zone}\n {compareZones}\n onclose={closeDialog}\n onedit={startEdit}\n onsave={save}\n ondelete={remove}\n />\n{/if}\n\n<style>\n .layout {\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .body {\n display: flex;\n flex: 1;\n min-height: 0;\n }\n\n main {\n flex: 1;\n min-width: 0;\n min-height: 0;\n display: flex;\n flex-direction: column;\n }\n\n .banner {\n display: flex;\n align-items: center;\n gap: 0.7rem;\n margin: 0;\n padding: 0.5rem 0.9rem;\n background: hsl(38 92% 92%);\n border-bottom: 1px solid hsl(38 60% 70%);\n color: hsl(28 70% 25%);\n }\n\n @media (prefers-color-scheme: dark) {\n .banner {\n background: hsl(38 40% 20%);\n border-color: hsl(38 40% 35%);\n color: hsl(38 80% 82%);\n }\n }\n\n @media (max-width: 60rem) {\n .body {\n position: relative;\n }\n }\n</style>\n","/**\n * The embeddable agenda.\n *\n * A stripped-down list of upcoming events, meant to be dropped into another\n * site in an iframe: no header, no filter panel, no editing. Everything it\n * shows is driven by query parameters, so a site can ask for \"the next ten\n * httpd events\" without any JavaScript of its own.\n *\n * Session cookies are SameSite=Strict, so a cross-site iframe never carries\n * one. An embed is always an anonymous view, which means public events only.\n * That is the intended behaviour rather than a limitation to work around: a\n * page on someone else's site should not be able to show private events.\n */\n\nimport type { Category } from \"./types\";\nimport { CATEGORIES } from \"./types\";\nimport { LOCAL, isKnownZone, normaliseZone } from \"./timezone\";\nimport type { DisplayZone } from \"./timezone\";\nimport { withoutBase } from \"./base\";\n\n/** The route the embed is served from, relative to the app's mount point. */\nexport const EMBED_PATH = \"/embed/agenda\";\n\nexport const DEFAULT_DAYS = 60;\nexport const DEFAULT_LIMIT = 20;\nconst MAX_DAYS = 366;\nconst MAX_LIMIT = 100;\n\nexport type EmbedTheme = \"auto\" | \"light\" | \"dark\";\n\nexport interface EmbedOptions {\n /** Categories to include. Empty means all of them. */\n categories: Category[];\n /** Projects to include. Empty means all the viewer can see. */\n projects: string[];\n /** How far ahead to look, in days. */\n days: number;\n /** How many events to show at most. */\n limit: number;\n search: string;\n zone: DisplayZone;\n /** Heading above the list, or null for none. */\n title: string | null;\n /** Whether to say which clock the times are on. */\n showZone: boolean;\n /** Drop the panel background so the host page shows through. */\n transparent: boolean;\n theme: EmbedTheme;\n /** Whether to show the \"ASF Community Calendar\" link at the foot. */\n showCredit: boolean;\n}\n\nexport function isEmbedRoute(pathname: string): boolean {\n const route = withoutBase(pathname);\n return route === EMBED_PATH || route === `${EMBED_PATH}/`;\n}\n\nfunction clamp(value: number, low: number, high: number): number {\n return Math.min(high, Math.max(low, value));\n}\n\nfunction numberParam(params: URLSearchParams, name: string, fallback: number, low: number, high: number): number {\n const raw = params.get(name);\n if (raw === null || raw.trim() === \"\") return fallback;\n const parsed = Number(raw);\n if (!Number.isFinite(parsed)) return fallback;\n return clamp(Math.trunc(parsed), low, high);\n}\n\nfunction booleanParam(params: URLSearchParams, name: string, fallback: boolean): boolean {\n const raw = params.get(name);\n if (raw === null) return fallback;\n if (raw === \"\") return true; // ?transparent with no value means yes\n return ![\"0\", \"false\", \"no\", \"off\"].includes(raw.trim().toLowerCase());\n}\n\n/** Collects a filter that may be repeated or comma-separated. */\nfunction listParam(params: URLSearchParams, ...names: string[]): string[] {\n const collected: string[] = [];\n for (const name of names) {\n for (const raw of params.getAll(name)) {\n collected.push(...raw.split(\",\").map((piece) => piece.trim()));\n }\n }\n return collected.filter(Boolean);\n}\n\nexport function parseEmbedOptions(search: string): EmbedOptions {\n const params = new URLSearchParams(search.startsWith(\"?\") ? search.slice(1) : search);\n\n const categories = listParam(params, \"category\", \"categories\")\n .map((name) => name.toLowerCase())\n .filter((name): name is Category => (CATEGORIES as readonly string[]).includes(name));\n\n const themeRaw = (params.get(\"theme\") ?? \"auto\").toLowerCase();\n const theme: EmbedTheme = themeRaw === \"light\" || themeRaw === \"dark\" ? themeRaw : \"auto\";\n\n const zoneRaw = params.get(\"zone\");\n const zone = zoneRaw && (zoneRaw.toLowerCase() === LOCAL || isKnownZone(zoneRaw))\n ? normaliseZone(zoneRaw, LOCAL)\n : LOCAL;\n\n const title = params.get(\"title\");\n\n return {\n categories,\n projects: listParam(params, \"project\", \"projects\").map((name) => name.toLowerCase()),\n days: numberParam(params, \"days\", DEFAULT_DAYS, 1, MAX_DAYS),\n limit: numberParam(params, \"limit\", DEFAULT_LIMIT, 1, MAX_LIMIT),\n search: params.get(\"q\")?.trim() ?? \"\",\n zone,\n title: title === null ? null : title.trim() || null,\n showZone: booleanParam(params, \"showzone\", true),\n transparent: booleanParam(params, \"transparent\", false),\n theme,\n showCredit: booleanParam(params, \"credit\", true),\n };\n}\n\n/**\n * The message the embed posts to whatever page is framing it, so the host can\n * size the iframe to its content. Sent with a \"*\" target origin because we do\n * not know who is embedding us; it carries nothing but a pixel height.\n */\nexport const HEIGHT_MESSAGE = \"asf-calendar-embed:height\";\n\nexport interface HeightMessage {\n type: typeof HEIGHT_MESSAGE;\n height: number;\n}\n\nexport function heightMessage(height: number): HeightMessage {\n return { type: HEIGHT_MESSAGE, height: Math.ceil(height) };\n}\n","<script lang=\"ts\">\n import type { CalendarEvent } from \"../lib/types\";\n import { api, ApiError } from \"../lib/api\";\n import { addDays, formatTime, startOfDay, MONTH_NAMES, WEEKDAY_NAMES } from \"../lib/dates\";\n import { agendaSections, calendarLabel, eventEnd, eventHue, eventStart } from \"../lib/events\";\n import { describeDisplayZone, nowInZone, shortZoneLabel } from \"../lib/timezone\";\n import { appPath } from \"../lib/base\";\n import { heightMessage, parseEmbedOptions } from \"../lib/embed\";\n\n interface Props {\n /** The query string to configure from. Defaults to the current URL's. */\n search?: string;\n }\n\n let { search = globalThis.location?.search ?? \"\" }: Props = $props();\n\n let options = $derived(parseEmbedOptions(search));\n\n let events = $state<CalendarEvent[]>([]);\n let loading = $state(true);\n let failure = $state<string | null>(null);\n\n let sections = $derived(agendaSections(events, options.zone));\n let root = $state<HTMLElement | null>(null);\n\n async function load() {\n loading = true;\n const from = startOfDay(nowInZone(options.zone));\n try {\n events = await api.events({\n start: from,\n end: addDays(from, options.days),\n categories: options.categories,\n projects: options.projects,\n q: options.search || undefined,\n sort: \"start\",\n limit: options.limit,\n });\n failure = null;\n } catch (error) {\n failure =\n error instanceof ApiError\n ? error.message\n : \"The calendar could not be reached.\";\n } finally {\n loading = false;\n }\n }\n\n $effect(() => {\n void options;\n void load();\n });\n\n // Let the host page size its iframe to the content. An iframe cannot do this\n // for itself, so we measure and tell whoever is framing us.\n $effect(() => {\n if (!root) return;\n // Re-measure whenever the content changes, not only when the box does.\n void sections;\n void loading;\n\n const send = () => {\n const height = Math.max(\n root?.scrollHeight ?? 0,\n globalThis.document?.documentElement?.scrollHeight ?? 0,\n );\n globalThis.parent?.postMessage(heightMessage(height), \"*\");\n };\n send();\n\n // Everything current has ResizeObserver, but the first measurement above\n // should not depend on it.\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(send);\n observer.observe(root);\n return () => observer.disconnect();\n });\n\n function dayHeading(date: Date): string {\n const weekday = WEEKDAY_NAMES[(date.getDay() + 6) % 7];\n return `${weekday} ${date.getDate()} ${MONTH_NAMES[date.getMonth()]}`;\n }\n\n function when(event: CalendarEvent): string {\n if (event.all_day) return \"All day\";\n return `${formatTime(eventStart(event, options.zone))} - ${formatTime(eventEnd(event, options.zone))}`;\n }\n</script>\n\n<div\n bind:this={root}\n class=\"embed\"\n class:transparent={options.transparent}\n data-theme={options.theme === \"auto\" ? null : options.theme}\n>\n {#if options.title}\n <h1>{options.title}</h1>\n {/if}\n\n {#if loading}\n <p class=\"note\">Loading events...</p>\n {:else if failure}\n <p class=\"note error\" role=\"alert\">{failure}</p>\n {:else if sections.length === 0}\n <p class=\"note\">No events coming up.</p>\n {:else}\n {#each sections as section (section.key)}\n <section>\n <h2>{dayHeading(section.date)}</h2>\n <ul>\n {#each section.events as event (event.id)}\n <li style=\"--hue: {eventHue(event)}\">\n <a href={event.shortlink_url} target=\"_blank\" rel=\"noopener noreferrer\">\n <span class=\"when\">{when(event)}</span>\n <span class=\"title\">{event.title}</span>\n </a>\n <span class=\"meta\">\n <span class=\"tag\">{calendarLabel(event)}</span>\n {#if event.location}<span class=\"where\">{event.location}</span>{/if}\n </span>\n </li>\n {/each}\n </ul>\n </section>\n {/each}\n {/if}\n\n {#if options.showZone && !loading && !failure}\n <p class=\"zone\" title={describeDisplayZone(options.zone)}>\n Times shown in {shortZoneLabel(options.zone)}\n </p>\n {/if}\n\n {#if options.showCredit}\n <p class=\"credit\">\n <a href={appPath(\"/\")} target=\"_blank\" rel=\"noopener noreferrer\">ASF Community Calendar</a>\n </p>\n {/if}\n</div>\n\n<style>\n .embed {\n padding: 0.75rem;\n background: var(--bg-panel);\n color: var(--text);\n font-size: 13px;\n }\n\n .embed.transparent {\n background: transparent;\n }\n\n h1 {\n margin: 0 0 0.6rem;\n font-size: 15px;\n font-weight: 700;\n }\n\n h2 {\n margin: 0.9rem 0 0.25rem;\n font-size: 11px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--text-muted);\n border-bottom: 1px solid var(--border);\n padding-bottom: 0.2rem;\n }\n\n section:first-of-type h2 {\n margin-top: 0;\n }\n\n ul {\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n li {\n border-left: 3px solid hsl(var(--hue) 55% 55%);\n padding: 0.25rem 0 0.25rem 0.5rem;\n margin: 0.25rem 0;\n }\n\n a {\n display: flex;\n gap: 0.5rem;\n align-items: baseline;\n color: inherit;\n text-decoration: none;\n }\n\n a:hover .title {\n text-decoration: underline;\n }\n\n .when {\n flex: none;\n width: 6.5rem;\n color: var(--text-muted);\n font-variant-numeric: tabular-nums;\n font-size: 12px;\n }\n\n .title {\n font-weight: 600;\n }\n\n .meta {\n display: flex;\n gap: 0.4rem;\n padding-left: 7rem;\n font-size: 11px;\n color: var(--text-faint);\n }\n\n .tag {\n text-transform: lowercase;\n }\n\n .note {\n margin: 0.5rem 0;\n color: var(--text-muted);\n }\n\n .note.error {\n color: var(--asf-red);\n }\n\n .zone,\n .credit {\n margin: 0.6rem 0 0;\n font-size: 11px;\n color: var(--text-faint);\n }\n\n .credit a {\n color: var(--text-faint);\n text-decoration: underline;\n }\n\n @media (max-width: 24rem) {\n a {\n flex-wrap: wrap;\n }\n\n .when {\n width: auto;\n }\n\n .meta {\n padding-left: 0;\n }\n }\n</style>\n","import { mount } from \"svelte\";\nimport App from \"./App.svelte\";\nimport EmbedAgenda from \"./components/EmbedAgenda.svelte\";\nimport { isEmbedRoute } from \"./lib/embed\";\nimport \"./app.css\";\n\nconst target = document.getElementById(\"app\");\nif (!target) throw new Error(\"No #app element to mount into\");\n\n// The embed is a different, much smaller app: no header, no filters, no\n// session. Choosing here rather than inside App keeps it from firing off the\n// session and calendar requests it has no use for.\nfunction start() {\n if (!isEmbedRoute(globalThis.location?.pathname ?? \"/\")) {\n return mount(App, { target: target! });\n }\n document.documentElement.classList.add(\"embedded\");\n return mount(EmbedAgenda, { target: target! });\n}\n\nexport default start();\n"],"names":["DEV","is_array","index_of","includes","array_from","define_property","get_descriptor","get_descriptors","object_prototype","array_prototype","get_prototype_of","is_extensible","noop","run_all","arr","i","deferred","resolve","reject","promise","res","rej","DERIVED","EFFECT","RENDER_EFFECT","MANAGED_EFFECT","BLOCK_EFFECT","BRANCH_EFFECT","ROOT_EFFECT","BOUNDARY_EFFECT","PAUSED","CONNECTED","CLEAN","DIRTY","MAYBE_DIRTY","INERT","DESTROYED","REACTION_RAN","DESTROYING","EFFECT_TRANSPARENT","EAGER_EFFECT","HEAD_EFFECT","EFFECT_PRESERVED","USER_EFFECT","EFFECT_OFFSCREEN","WAS_MARKED","REACTION_IS_UPDATING","ASYNC","ERROR_VALUE","STATE_SYMBOL","COMPONENT_SYMBOL","LEGACY_PROPS","LOADING_ATTR_SYMBOL","ATTRIBUTES_CACHE","CLASS_CACHE","STYLE_CACHE","TEXT_CACHE","FORM_RESET_HANDLER","STALE_REACTION","IS_XHTML","EACH_ITEM_REACTIVE","EACH_INDEX_REACTIVE","EACH_IS_CONTROLLED","EACH_IS_ANIMATED","EACH_ITEM_IMMUTABLE","PROPS_IS_IMMUTABLE","PROPS_IS_UPDATED","PROPS_IS_BINDABLE","PROPS_IS_LAZY_INITIAL","TEMPLATE_FRAGMENT","TEMPLATE_USE_IMPORT_NODE","UNINITIALIZED","NAMESPACE_HTML","derived_inert","select_multiple_invalid_value","svelte_boundary_reset_noop","equals","value","safe_not_equal","a","b","safe_equals","async_derived_orphan","each_key_duplicate","effect_in_teardown","rune","effect_in_unowned_derived","effect_orphan","effect_update_depth_exceeded","props_invalid_value","key","state_descriptors_fixed","state_prototype_fixed","state_unsafe_mutation","svelte_boundary_reset_onerror","tracing_mode_flag","component_context","set_component_context","context","push","props","runes","fn","active_effect","pop","component","effects","create_user_effect","mark_as_component","is_runes","micro_tasks","run_micro_tasks","tasks","queue_micro_task","is_flushing_sync","flush_tasks","STATUS_MASK","set_signal_status","signal","status","update_derived_status","derived","clear_marked","deps","dep","defer_effect","effect","dirty_effects","maybe_dirty_effects","is_store_binding","capture_store_binding","previous_is_store_binding","listening_to_form_reset","add_form_reset_listener","evt","e","without_reactive_context","previous_reaction","active_reaction","previous_effect","set_active_reaction","set_active_effect","listen_to_event_and_reset_event","element","event","handler","on_reset","prev","flatten","blockers","sync","async","d","pending","deriveds","parent","restore","capture","blocker_promise","finish","error","invoke_error_boundary","unset_context","decrement_pending","increment_pending","run","expression","async_derived","previous_component_context","previous_batch","current_batch","activate_batch","deactivate_batch","boundary","batch","blocking","flags","OBSOLETE","label","location","e.async_derived_orphan","source","should_suspend","deferreds","async_effect","internal_set","teardown","fulfil","next","p","go","user_derived","push_reaction_value","derived_safe_equal","destroy_derived_effects","destroy_effect","execute_derived","prev_active_effect","is_destroying_effect","w.derived_inert","update_reaction","update_derived","increment_write_version","batch_values","effect_tracking","freeze_derived_effects","remove_reactions","destroy_effect_children","unfreeze_derived_effects","update_effect","first_batch","last_batch","last_scheduled_effect","is_processing","collected_effects","legacy_updates","flush_count","uid","Batch","#started","#prev","#next","#commit_callbacks","#discard_callbacks","#pending","#blocking_pending","#deferred","#roots","#new_effects","#dirty_effects","#maybe_dirty_effects","#skipped_branches","#unskipped_branches","#decrement_queued","#is_deferred","skipped","callback","tracked","#process","#unlink","infinite_loop_guard","roots","render_effects","updates","root","#traverse","reset_all","#defer_effects","t","reset_branch","earlier_batch","#find_earlier_batch","#merge","flush_queued_effects","next_batch","r","old_values","is_branch","is_skippable_branch","skip","is_dirty","child","is_derived","mark","reactions","reaction","#commit","is_earlier","sources","batch_value","current","others","unskipped","marked","checked","mark_effects","current_unequal","c","v1","v2","depends_on","blocking_pending_count","flushSync","was_flushing_sync","result","e.effect_update_depth_exceeded","eager_block_effects","length","unlink_effect","ordered_effects","ancestor","j","schedule_effect","depends","eager_effects","eager_effects_deferred","v","stack","state","s","mutable_source","initial_value","immutable","trackable","set","should_proxy","untracking","current_sources","e.state_unsafe_mutation","new_value","proxy","updated_during_traversal","mark_reactions","untracked_writes","set_untracked_writes","flush_eager_effects","dirty","increment","not_dirty","prototype","is_proxied_array","version","parent_version","update_version","with_parent","set_update_version","_","prop","descriptor","e.state_descriptors_fixed","target","receiver","exists","get","has","other_s","ls","n","own_keys","e.state_prototype_fixed","get_proxied_value","is","$window","is_firefox","first_child_getter","next_sibling_getter","init_operations","element_prototype","node_prototype","text_prototype","create_text","get_first_child","node","get_next_sibling","is_text","first_child","first","only_child","sibling","count","next_sibling","clear_text_content","should_defer_append","create_element","tag","namespace","handle_error","validate_effect","e.effect_orphan","e.effect_in_unowned_derived","e.effect_in_teardown","push_effect","parent_effect","parent_last","create_effect","type","user_effect","defer","component_root","options","pause_effect","render_effect","template_effect","values","block","branch","execute_effect_teardown","previously_destroying_effect","set_is_destroying_effect","remove_dom","controller","destroy_block_effect_children","removed","remove_effect_dom","transitions","transition","end","destroy","pause_children","remaining","check","local","transparent","resume_effect","resume_children","move_effect","fragment","is_updating_effect","new_deps","skipped_deps","write_version","read_version","dependencies","dependency","schedule_possible_effect_self_invalidation","previous_deps","previous_skipped_deps","previous_untracked_writes","previous_sources","previous_untracking","previous_update_version","update_dependencies","is_fork","remove_reaction","index","new_length","start_index","was_updating_effect","tick","destroyed","depends_on_old_values","should_connect","is_new","reconnect","untrack","PASSIVE_EVENTS","is_passive_event","name","event_symbol","all_registered_events","root_event_handles","create_event","event_name","dom","target_handler","handle_event_propagation","passive","delegated","delegate","events","last_propagated_event","last_propagated_event_clear_scheduled","handler_element","owner_document","path","current_target","path_idx","handled_at","at_idx","handler_idx","throw_error","other_errors","policy","html","create_trusted_html","create_fragment_from_html","elem","assign_nodes","start","from_html","content","is_fragment","use_import_node","has_start","clone","text","comment","frag","anchor","append","createSubscriber","subscribers","stop","children","transform_error","Boundary","#anchor","#hydrate_open","#props","#children","#effect","#main_effect","#pending_effect","#failed_effect","#offscreen_fragment","#local_pending_count","#pending_count","#pending_count_update_queued","#effect_pending","#effect_pending_subscriber","#render","#hydrate_resolved_content","#hydrate_failed_content","failed","reset","invoke_onerror","#create_reset","did_reset","calling_on_error","w.svelte_boundary_reset_noop","e.svelte_boundary_reset_onerror","#run","err","#hydrate_pending_content","handled","#resolve","previous_ctx","#update_pending_count","#handle_error","handle_error_result","transformed_error","set_text","str","mount","_mount","listeners","Component","intro","transformError","unmount","anchor_node","ctx","registered_events","event_handle","counts","mounted_components","BranchManager","#batches","#onscreen","#offscreen","#outroing","#transition","onscreen","offscreen","k","on_destroy","#discard","keys","if_block","elseif","branches","update_branch","has_branch","pause_effects","to_destroy","controlled_anchor","group","groups","destroy_effects","fast_path","parent_node","preserved_effects","offscreen_anchor","each","get_collection","get_key","render_fn","fallback_fn","items","is_controlled","fallback","each_array","collection","array","first_run","commit","reconcile","move","discard","item","create_item","e.each_key_duplicate","skip_to_branch","is_animated","seen","to_animate","matched","stashed","link","destroy_length","dest","next_node","whitespace","to_class","hash","directives","classname","len","to_style","styles","set_class","is_html","prev_classes","next_classes","next_class_name","is_present","set_style","prev_styles","next_styles","next_style_attr","set_selected","option","selected","apply_default_select_value","select","preserve","multiple","option_value","get_option_value","select_option","mounting","w.select_multiple_invalid_value","init_select","observer","entries","is_selectedcontent_mutation","bind_select_value","batches","is_reset","query","selected_option","entry","nodes","IS_CUSTOM_ELEMENT","IS_HTML","PROGRESS_TAG","set_value","attributes","get_attributes","set_checked","set_attribute","attribute","skip_warning","get_setters","setters_cache","cache_key","setters","descriptors","proto","element_proto","bind_value","input","is_numberlike_input","to_number","bind_checked","is_bound_this","bound_value","element_or_component","bind_this","update","get_value","get_parts","component_effect","old_parts","parts","original_teardown","bindable","lazy","fallback_value","fallback_dirty","fallback_signal","get_fallback","setter","is_entry_props","is_store_sub","e.props_invalid_value","getter","legacy_parent","mutation","overridden","PUBLIC_VERSION","CATEGORIES","VIEWS","basePath","baseUrl","href","appPath","suffix","apiUrl","assetUrl","withoutBase","pathname","prefix","DEFAULT_OAUTH_PATH","loginUrl","returnTo","logoutUrl","ApiError","message","field","request","method","body","isUpload","response","parsed","details","buildQuery","params","stamp","category","project","encoded","api","id","token","draft","file","settings","MINUTE","HOUR","WEEKDAY_NAMES","MONTH_NAMES","WEEK_STARTS_ON","startOfDay","date","copy","endOfDay","addDays","addMonths","targetDay","lastDay","daysInMonth","addYears","year","month","startOfWeek","weekStartsOn","shift","startOfMonth","startOfYear","isSameDay","isToday","now","isWeekend","day","monthGrid","weekDays","yearMonths","january","rangeForView","view","cursor","grid","step","direction","dayKey","fromDayKey","formatTime","formatDate","formatMonthYear","formatViewTitle","days","last","toLocalInput","toDateInput","parseISO","toISO","LOCAL","UTC","isLocal","zone","resolveZone","browserZone","localOffsetMs","instant","formatters","partsFormatter","timeZone","formatter","zoneOffsetMs","part","toWallInZone","wall","attempt","corrected","fromWallInZone","toWall","fromWall","nowInZone","offsetLabel","offsetMs","sign","total","hours","minutes","zoneAbbreviation","zoneCity","segments","zoneLabel","at","offset","abbreviation","describeDisplayZone","resolved","shortZoneLabel","explainDisplayZone","MAJOR_ZONES","majorZones","isKnownZone","zoneList","supported","names","normaliseZone","uniqueZones","zones","primary","kept","hourLabels","other","_unused","hour","eventStart","eventEnd","durationMs","overlaps","from","to","occursOnDay","groupByDay","buckets","order","displayComparator","bucket","compareForDisplay","byStart","byLength","MINIMUM_HEIGHT","layoutDay","dayStart","dayEnd","span","placed","cluster","clusterEnd","closeCluster","columns","taken","column","allDayEvents","agendaSections","sections","calendarLabel","PROJECT_HUES","projectHue","eventHue","categoryLabel","defaultFilters","calendars","matches","filters","knownProjects","needle","applyFilters","sortEvents","sort","sorted","projectsInPlay","toggle","DEFAULT_LENGTH_MS","defaultCategory","can","canCreateAnything","newDraft","when","timezone","draftFromEvent","canEdit","$.derived","localLabel","$.get","pick","chosen","div","root_2","button","$.child","$.sibling","optgroup","root_1","$$anchor","$.init_select","span_1","classes","$.set_class","$0","$.set_attribute","$1","$2","classes_1","$3","$4","select_value","$.select_option","$$props","$.delegated","heading","header","root_5","img","h1","div_1","button_1","div_2","button_2","button_3","h2","div_3","$.each","button_4","text_2","$.only_child","$.append","TimezoneSwitch","node_1","div_4","button_5","button_6","button_7","$.first_child","button_8","$$args","fragment_1","$.set_text","text_3","a_1","root_4","$$render","consequent_2","alternate","classes_2","maxCompareZones","$.prop","setCategory","setProject","allProjects","on","alreadyShown","canAddMore","addCompareZone","removeCompareZone","candidate","aside","root_10","section","label_1","input_1","$.set_checked","$.set_style","section_1","root_3","h3","label_2","input_2","span_2","span_3","consequent_1","section_2","label_3","option_1","option_2","section_3","label_4","select_1","option_3","option_4","option_5","option_6","select_1_value","section_4","node_3","strong","ul","root_6","li","span_4","consequent_3","label_5","root_9","select_2","option_7","option_8","root_7","option_8_value","node_7","root_8","option_9","option_9_value","consequent_5","section_5","$.set_value","variant","showTime","hue","time","consequent","mouseEvent","VISIBLE_PER_DAY","dayEvents","div_5","EventChip","compareZones","HOURS","allDayRows","hasAllDay","row","laidOut","gutters","labels","node_4","_other","node_5","div_6","div_7","node_6","div_8","div_9","$.template_effect","classes_3","div_10","node_8","div_11","span_5","span_6","classes_5","classes_4","MAX_DOTS","dotsFor","months","inMonth","dots","alsoAt","also","node_2","text_6","text_4","ZONES","form","$.state","lastDraft","$.user_effect","$.set","creatableCategories","list","projectOptions","visibilityOptions","onCategoryChange","submit","submitEvent","keydown","keyEvent","copyShortlink","whenLabel","otherReadings","rows","add","setStart","allDay","dateParts","setEnd","inputValue","iso","dateValue","exclusiveEnd","shifted","onTimezoneChange","startWall","endWall","root_16","form_1","option_1_value","option_2_value","$.bind_select_value","$$value","option_3_value","select_3","option_4_value","select_3_value","changeEvent","label_6","input_3","consequent_4","label_7","input_4","input_5","alternate_1","label_8","input_6","label_9","input_7","label_10","textarea","footer","text_1","$.event","$.bind_value","$.bind_checked","article","root_15","h2_1","p_1","text_10","reading","text_12","text_13","consequent_8","p_2","root_11","consequent_9","p_3","root_12","consequent_10","p_4","root_13","consequent_11","p_5","node_11","p_6","footer_1","a_2","root_14","node_12","consequent_7","consequent_13","COLUMNS","ROWS","embedExample","youAre","bits","table","thead","tr","th","tbody","tr_1","th_1","$.index","cell","td","strong_1","text_5","li_1","strong_2","pre","a_3","host","failure","SCRIPT","STYLES","loadScript","src","existing","loadStyles","cancelled","factory","emptySettings","importableCategories","categories","importableProjects","visibility","importableVisibilities","importReadiness","missing","projects","resolveSettings","looksLikeCalendar","preview","$.proxy","saving","dragging","visibilities","readiness","canSave","change","choose","save","onDrop","warningCount","warning","text_8","node_10","option_5_value","select_2_value","consequent_6","VIEW_STORAGE_KEY","ZONE_STORAGE_KEY","ALT_ZONE_STORAGE_KEY","COMPARE_ZONES_STORAGE_KEY","MAX_COMPARE_ZONES","SHORTLINK_PATTERN","HELP_PATH","DOCS_PATH","routePath","stored","remember","initialView","saved","initialZone","initialAlternateZone","initialCompareZones","hasChosenZone","alternateZone","helpOpen","docsOpen","session","loading","loadError","dialogError","showFilters","importing","range","visible","title","editable","feedUrl","loadIdentity","who","cals","loadToken","loadEvents","found","openFromLocation","match","navigate","pushShortlink","onPop","selectEvent","closeDialog","startCreate","startImport","finishImport","startEdit","remove","goToDay","goToMonth","setZone","setCompareZones","toggleHelp","toggleDocs","Header","HelpPage","ApiDocs","FilterPanel","main","MonthView","WeekView","YearView","AgendaView","ImportDialog","EventDialog","EMBED_PATH","DEFAULT_DAYS","DEFAULT_LIMIT","MAX_DAYS","MAX_LIMIT","isEmbedRoute","route","clamp","low","high","numberParam","raw","booleanParam","listParam","collected","piece","parseEmbedOptions","search","themeRaw","theme","zoneRaw","HEIGHT_MESSAGE","heightMessage","height","load","send","dayHeading","EmbedAgenda","App"],"mappings":"ssBAAA,MAAAA,GAAe,GCER,IAAIC,GAAW,MAAM,QACjBC,GAAW,MAAM,UAAU,QAC3BC,GAAW,MAAM,UAAU,SAC3BC,GAAa,MAAM,KAEnBC,GAAkB,OAAO,eACzBC,GAAiB,OAAO,yBACxBC,GAAkB,OAAO,0BACzBC,GAAmB,OAAO,UAC1BC,GAAkB,MAAM,UACxBC,GAAmB,OAAO,eAC1BC,GAAgB,OAAO,aAW3B,MAAMC,GAAO,IAAM,CAAC,EAoBpB,SAASC,GAAQC,EAAK,CAC5B,QAASC,EAAI,EAAGA,EAAID,EAAI,OAAQC,IAC/BD,EAAIC,CAAC,EAAC,CAER,CAMO,SAASC,IAAW,CAE1B,IAAIC,EAGAC,EAGAC,EAAU,IAAI,QAAQ,CAACC,EAAKC,IAAQ,CACvCJ,EAAUG,EACVF,EAASG,CACV,CAAC,EAGD,MAAO,CAAE,QAAAF,EAAS,QAAAF,EAAS,OAAAC,CAAM,CAClC,CCpEO,MAAMI,GAAU,EACVC,GAAS,EACTC,GAAgB,EAKhBC,GAAiB,GAAK,GAKtBC,GAAe,GACfC,GAAgB,GAChBC,GAAc,GACdC,GAAkB,IAOlBC,GAAS,IAOTC,GAAY,IACZC,GAAQ,KACRC,GAAQ,KACRC,GAAc,KACdC,GAAQ,KACRC,GAAY,MAEZC,GAAe,MAEfC,GAAa,GAAK,GAOlBC,GAAqB,MACrBC,GAAe,GAAK,GACpBC,GAAc,GAAK,GACnBC,GAAmB,GAAK,GACxBC,GAAc,GAAK,GACnBC,GAAmB,GAAK,GASxBC,GAAa,MAGbC,GAAuB,GAAK,GAC5BC,GAAQ,GAAK,GAEbC,GAAc,GAAK,GAEnBC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AI,QAD5CouB,CAAC,WADC/O,EAAArf,CAAO,EAAC,UAAQ,CAAAqf,EAAK+U,CAAO,MAAK3D,CAAO,GAAA3N,EAAA6D,CAAA,gCAO1C4H,EAACtI,GAAA,EACCrD,IADF2L,CAAC,UACC3L,EAAC,OAAAxC,CAAA,EAAA,CAAA,IAAOjN,GAAQ,GAAG,CAAA,CAAA,MADrBob,CAAC,WADClP,EAAArf,CAAO,EAAC,YAAU8iB,EAAAgQ,CAAA,OA5CxBtT,EAAAwM,GAAAhC,EACYvyB,WAAAA,CAAI,CAAA,cADhB+nB,EAAA,EAAA,uBAAA,KAAAU,EAAA,CAAA,YAAAb,EAGoBrf,CAAO,EAAC,WAAW,CAAA,KAHvCwf,EAAA,aAAAH,EAIarf,CAAO,EAAC,QAAU,OAAS,KAAIqf,EAAGrf,CAAO,EAAC,KAAK,IAJ5D+hB,EAAAhC,EAAAP,CAAA,MAFO,CClFR,MAAMziB,GAAS,SAAS,eAAe,KAAK,EAC5C,GAAI,CAACA,GAAQ,MAAM,IAAI,MAAM,+BAA+B,EAK5D,SAAS0I,IAAQ,CACf,OAAK6xB,GAAa,WAAW,UAAU,UAAY,GAAG,GAGtD,SAAS,gBAAgB,UAAU,IAAI,UAAU,EAC1CtuB,GAAM4vB,GAAa,CAAE,OAAA77B,GAAiB,GAHpCiM,GAAM6vB,GAAK,CAAE,OAAA97B,GAAiB,CAIzC,CAEe0I,GAAA","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43]} \ No newline at end of file +{"version":3,"file":"index-RGVtRUlj.js","sources":["../../node_modules/esm-env/false.js","../../node_modules/svelte/src/internal/shared/utils.js","../../node_modules/svelte/src/internal/client/constants.js","../../node_modules/svelte/src/constants.js","../../node_modules/svelte/src/internal/client/warnings.js","../../node_modules/svelte/src/internal/client/reactivity/equality.js","../../node_modules/svelte/src/internal/client/errors.js","../../node_modules/svelte/src/internal/flags/index.js","../../node_modules/svelte/src/internal/client/context.js","../../node_modules/svelte/src/internal/client/dom/task.js","../../node_modules/svelte/src/internal/client/reactivity/status.js","../../node_modules/svelte/src/internal/client/reactivity/utils.js","../../node_modules/svelte/src/internal/client/reactivity/store.js","../../node_modules/svelte/src/internal/client/dom/elements/misc.js","../../node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js","../../node_modules/svelte/src/internal/client/reactivity/async.js","../../node_modules/svelte/src/internal/client/reactivity/deriveds.js","../../node_modules/svelte/src/internal/client/reactivity/batch.js","../../node_modules/svelte/src/internal/client/reactivity/sources.js","../../node_modules/svelte/src/internal/client/proxy.js","../../node_modules/svelte/src/internal/client/dom/operations.js","../../node_modules/svelte/src/internal/client/error-handling.js","../../node_modules/svelte/src/internal/client/reactivity/effects.js","../../node_modules/svelte/src/internal/client/runtime.js","../../node_modules/svelte/src/utils.js","../../node_modules/svelte/src/internal/client/dom/elements/events.js","../../node_modules/svelte/src/internal/client/dom/reconciler.js","../../node_modules/svelte/src/internal/client/dom/template.js","../../node_modules/svelte/src/reactivity/create-subscriber.js","../../node_modules/svelte/src/internal/client/dom/blocks/boundary.js","../../node_modules/svelte/src/internal/client/render.js","../../node_modules/svelte/src/internal/client/dom/blocks/branches.js","../../node_modules/svelte/src/internal/client/dom/blocks/if.js","../../node_modules/svelte/src/internal/client/dom/blocks/each.js","../../node_modules/svelte/src/internal/shared/attributes.js","../../node_modules/svelte/src/internal/client/dom/elements/class.js","../../node_modules/svelte/src/internal/client/dom/elements/style.js","../../node_modules/svelte/src/internal/client/dom/elements/bindings/select.js","../../node_modules/svelte/src/internal/client/dom/elements/attributes.js","../../node_modules/svelte/src/internal/client/dom/elements/bindings/input.js","../../node_modules/svelte/src/internal/client/dom/elements/bindings/this.js","../../node_modules/svelte/src/internal/client/reactivity/props.js","../../node_modules/svelte/src/version.js","../../node_modules/svelte/src/internal/disclose-version.js","../../src/lib/types.ts","../../src/lib/base.ts","../../src/lib/api.ts","../../src/lib/dates.ts","../../src/lib/timezone.ts","../../src/lib/events.ts","../../src/lib/filters.ts","../../src/lib/drafts.ts","../../src/components/TimezoneSwitch.svelte","../../src/components/Header.svelte","../../src/components/FilterPanel.svelte","../../src/components/EventChip.svelte","../../src/components/MonthView.svelte","../../src/components/WeekView.svelte","../../src/components/YearView.svelte","../../src/components/AgendaView.svelte","../../src/components/EventDialog.svelte","../../src/components/HelpPage.svelte","../../src/components/ApiDocs.svelte","../../src/lib/importing.ts","../../src/components/ImportDialog.svelte","../../src/App.svelte","../../src/lib/embed.ts","../../src/components/EmbedAgenda.svelte","../../src/main.ts"],"sourcesContent":["export default false;\n","// Store the references to globals in case someone tries to monkey patch these, causing the below\n// to de-opt (this occurs often when using popular extensions).\nexport var is_array = Array.isArray;\nexport var index_of = Array.prototype.indexOf;\nexport var includes = Array.prototype.includes;\nexport var array_from = Array.from;\nexport var object_keys = Object.keys;\nexport var define_property = Object.defineProperty;\nexport var get_descriptor = Object.getOwnPropertyDescriptor;\nexport var get_descriptors = Object.getOwnPropertyDescriptors;\nexport var object_prototype = Object.prototype;\nexport var array_prototype = Array.prototype;\nexport var get_prototype_of = Object.getPrototypeOf;\nexport var is_extensible = Object.isExtensible;\nexport var has_own_property = Object.prototype.hasOwnProperty;\n\n/**\n * @param {any} thing\n * @returns {thing is Function}\n */\nexport function is_function(thing) {\n\treturn typeof thing === 'function';\n}\n\nexport const noop = () => {};\n\n// Adapted from https://github.com/then/is-promise/blob/master/index.js\n// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE\n\n/**\n * @template [T=any]\n * @param {any} value\n * @returns {value is PromiseLike<T>}\n */\nexport function is_promise(value) {\n\treturn typeof value?.then === 'function';\n}\n\n/** @param {Function} fn */\nexport function run(fn) {\n\treturn fn();\n}\n\n/** @param {Array<() => void>} arr */\nexport function run_all(arr) {\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tarr[i]();\n\t}\n}\n\n/**\n * TODO replace with Promise.withResolvers once supported widely enough\n * @template [T=void]\n */\nexport function deferred() {\n\t/** @type {(value: T) => void} */\n\tvar resolve;\n\n\t/** @type {(reason: any) => void} */\n\tvar reject;\n\n\t/** @type {Promise<T>} */\n\tvar promise = new Promise((res, rej) => {\n\t\tresolve = res;\n\t\treject = rej;\n\t});\n\n\t// @ts-expect-error\n\treturn { promise, resolve, reject };\n}\n\n/**\n * @template V\n * @param {V} value\n * @param {V | (() => V)} fallback\n * @param {boolean} [lazy]\n * @returns {V}\n */\nexport function fallback(value, fallback, lazy = false) {\n\treturn value === undefined\n\t\t? lazy\n\t\t\t? /** @type {() => V} */ (fallback)()\n\t\t\t: /** @type {V} */ (fallback)\n\t\t: value;\n}\n\n/**\n * When encountering a situation like `let [a, b, c] = $derived(blah())`,\n * we need to stash an intermediate value that `a`, `b`, and `c` derive\n * from, in case it's an iterable\n * @template T\n * @param {ArrayLike<T> | Iterable<T>} value\n * @param {number} [n]\n * @returns {Array<T>}\n */\nexport function to_array(value, n) {\n\t// return arrays unchanged\n\tif (Array.isArray(value)) {\n\t\treturn value;\n\t}\n\n\t// if value is not iterable, or `n` is unspecified (indicates a rest\n\t// element, which means we're not concerned about unbounded iterables)\n\t// convert to an array with `Array.from`\n\tif (n === undefined || !(Symbol.iterator in value)) {\n\t\treturn Array.from(value);\n\t}\n\n\t// otherwise, populate an array with `n` values\n\n\t/** @type {T[]} */\n\tconst array = [];\n\n\tfor (const element of value) {\n\t\tarray.push(element);\n\t\tif (array.length === n) break;\n\t}\n\n\treturn array;\n}\n\n/**\n * @param {Record<string | symbol, unknown>} obj\n * @param {Array<string | symbol>} keys\n * @returns {Record<string | symbol, unknown>}\n */\nexport function exclude_from_object(obj, keys) {\n\t/** @type {Record<string | symbol, unknown>} */\n\tvar result = {};\n\n\tfor (var key in obj) {\n\t\tif (!keys.includes(key)) {\n\t\t\tresult[key] = obj[key];\n\t\t}\n\t}\n\n\tfor (var symbol of Object.getOwnPropertySymbols(obj)) {\n\t\tif (Object.propertyIsEnumerable.call(obj, symbol) && !keys.includes(symbol)) {\n\t\t\tresult[symbol] = obj[symbol];\n\t\t}\n\t}\n\n\treturn result;\n}\n","// General flags\nexport const DERIVED = 1 << 1;\nexport const EFFECT = 1 << 2;\nexport const RENDER_EFFECT = 1 << 3;\n/**\n * An effect that does not destroy its child effects when it reruns.\n * Runs as part of render effects, i.e. not eagerly as part of tree traversal or effect flushing.\n */\nexport const MANAGED_EFFECT = 1 << 24;\n/**\n * An effect that does not destroy its child effects when it reruns (like MANAGED_EFFECT).\n * Runs eagerly as part of tree traversal or effect flushing.\n */\nexport const BLOCK_EFFECT = 1 << 4;\nexport const BRANCH_EFFECT = 1 << 5;\nexport const ROOT_EFFECT = 1 << 6;\nexport const BOUNDARY_EFFECT = 1 << 7;\n/**\n * Set on the effect that `pause_effect` was called on, i.e. the root of a paused subtree,\n * as opposed to its descendants which are merely `INERT`. This allows `resume_effect` on\n * an ancestor to skip subtrees that were paused for their own reasons (such as a block\n * whose condition is still false) rather than resurrecting them\n */\nexport const PAUSED = 1 << 8;\n/**\n * Indicates that a reaction is connected to an effect root — either it is an effect,\n * or it is a derived that is depended on by at least one effect. If a derived has\n * no dependents, we can disconnect it from the graph, allowing it to either be\n * GC'd or reconnected later if an effect comes to depend on it again\n */\nexport const CONNECTED = 1 << 9;\nexport const CLEAN = 1 << 10;\nexport const DIRTY = 1 << 11;\nexport const MAYBE_DIRTY = 1 << 12;\nexport const INERT = 1 << 13;\nexport const DESTROYED = 1 << 14;\n/** Set once a reaction has run for the first time */\nexport const REACTION_RAN = 1 << 15;\n/** Effect is in the process of getting destroyed. Can be observed in child teardown functions */\nexport const DESTROYING = 1 << 25;\n\n// Flags exclusive to effects\n/**\n * 'Transparent' effects do not create a transition boundary.\n * This is on a block effect 99% of the time but may also be on a branch effect if its parent block effect was pruned\n */\nexport const EFFECT_TRANSPARENT = 1 << 16;\nexport const EAGER_EFFECT = 1 << 17;\nexport const HEAD_EFFECT = 1 << 18;\nexport const EFFECT_PRESERVED = 1 << 19;\nexport const USER_EFFECT = 1 << 20;\nexport const EFFECT_OFFSCREEN = 1 << 25;\n\n// Flags exclusive to deriveds\n/**\n * Tells that we marked this derived and its reactions as visited during the \"mark as (maybe) dirty\"-phase.\n * Will be lifted during execution of the derived and during checking its dirty state (both are necessary\n * because a derived might be checked but not executed). This is a pure performance optimization flag and\n * should not be used for any other purpose!\n */\nexport const WAS_MARKED = 1 << 16;\n\n// Flags used for async\nexport const REACTION_IS_UPDATING = 1 << 21;\nexport const ASYNC = 1 << 22;\n\nexport const ERROR_VALUE = 1 << 23;\n\nexport const STATE_SYMBOL = Symbol('$state');\n/** Marks component export objects, so that `proxy(...)` leaves them untouched */\nexport const COMPONENT_SYMBOL = Symbol('component');\nexport const LEGACY_PROPS = Symbol('legacy props');\nexport const LOADING_ATTR_SYMBOL = Symbol('');\nexport const PROXY_PATH_SYMBOL = Symbol('proxy path');\nexport const ATTRIBUTES_CACHE = Symbol('attributes');\nexport const CLASS_CACHE = Symbol('class');\nexport const STYLE_CACHE = Symbol('style');\nexport const TEXT_CACHE = Symbol('text');\nexport const FORM_RESET_HANDLER = Symbol('form reset');\n/** An anchor might change, via this symbol on the original anchor we can tell HMR about the updated anchor */\nexport const HMR_ANCHOR = Symbol('hmr anchor');\n\n/** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */\nexport const STALE_REACTION = new (class StaleReactionError extends Error {\n\tname = 'StaleReactionError';\n\tmessage = 'The reaction that called `getAbortSignal()` was re-run or destroyed';\n})();\n\nexport const IS_XHTML =\n\t// We gotta write it like this because after downleveling the pure comment may end up in the wrong location\n\t!!globalThis.document?.contentType &&\n\t/* @__PURE__ */ globalThis.document.contentType.includes('xml');\nexport const ELEMENT_NODE = 1;\nexport const TEXT_NODE = 3;\nexport const COMMENT_NODE = 8;\nexport const DOCUMENT_FRAGMENT_NODE = 11;\n","export const EACH_ITEM_REACTIVE = 1;\nexport const EACH_INDEX_REACTIVE = 1 << 1;\n/** See EachBlock interface metadata.is_controlled for an explanation what this is */\nexport const EACH_IS_CONTROLLED = 1 << 2;\nexport const EACH_IS_ANIMATED = 1 << 3;\nexport const EACH_ITEM_IMMUTABLE = 1 << 4;\n\nexport const PROPS_IS_IMMUTABLE = 1;\nexport const PROPS_IS_RUNES = 1 << 1;\nexport const PROPS_IS_UPDATED = 1 << 2;\nexport const PROPS_IS_BINDABLE = 1 << 3;\nexport const PROPS_IS_LAZY_INITIAL = 1 << 4;\n\nexport const TRANSITION_IN = 1;\nexport const TRANSITION_OUT = 1 << 1;\nexport const TRANSITION_GLOBAL = 1 << 2;\n\nexport const TEMPLATE_FRAGMENT = 1;\nexport const TEMPLATE_USE_IMPORT_NODE = 1 << 1;\nexport const TEMPLATE_USE_SVG = 1 << 2;\nexport const TEMPLATE_USE_MATHML = 1 << 3;\n\nexport const HYDRATION_START = '[';\n/** used to indicate that an `{:else}...` block was rendered */\nexport const HYDRATION_START_ELSE = '[!';\n/** used to indicate that a boundary's `failed` snippet was rendered on the server */\nexport const HYDRATION_START_FAILED = '[?';\nexport const HYDRATION_END = ']';\nexport const HYDRATION_ERROR = {};\n\nexport const ELEMENT_IS_NAMESPACED = 1;\nexport const ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;\nexport const ELEMENT_IS_INPUT = 1 << 2;\n\nexport const UNINITIALIZED = Symbol('uninitialized');\n\n// Dev-time component properties\nexport const FILENAME = Symbol('filename');\nexport const HMR = Symbol('hmr');\n\nexport const NAMESPACE_HTML = 'http://www.w3.org/1999/xhtml';\nexport const NAMESPACE_SVG = 'http://www.w3.org/2000/svg';\nexport const NAMESPACE_MATHML = 'http://www.w3.org/1998/Math/MathML';\n\n// we use a list of ignorable runtime warnings because not every runtime warning\n// can be ignored and we want to keep the validation for svelte-ignore in place\nexport const IGNORABLE_RUNTIME_WARNINGS = /** @type {const} */ ([\n\t'await_waterfall',\n\t'await_reactivity_loss',\n\t'state_snapshot_uncloneable',\n\t'binding_property_non_reactive',\n\t'hydration_attribute_changed',\n\t'hydration_html_changed',\n\t'ownership_invalid_binding',\n\t'ownership_invalid_mutation'\n]);\n\n/**\n * Whitespace inside one of these elements will not result in\n * a whitespace node being created in any circumstances. (This\n * list is almost certainly very incomplete)\n * TODO this is currently unused\n */\nexport const ELEMENTS_WITHOUT_TEXT = ['audio', 'datalist', 'dl', 'optgroup', 'select', 'video'];\n\nexport const ATTACHMENT_KEY = '@attach';\n","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\nvar bold = 'font-weight: bold';\nvar normal = 'font-weight: normal';\n\n/**\n * Assignment to `%property%` property (%location%) will evaluate to the right-hand side, not the value of `%property%` following the assignment. This may result in unexpected behaviour.\n * @param {string} property\n * @param {string} location\n */\nexport function assignment_value_stale(property, location) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] assignment_value_stale\\n%cAssignment to \\`${property}\\` property (${location}) will evaluate to the right-hand side, not the value of \\`${property}\\` following the assignment. This may result in unexpected behaviour.\\nhttps://svelte.dev/e/assignment_value_stale`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/assignment_value_stale`);\n\t}\n}\n\n/**\n * Detected reactivity loss when reading `%name%`. This happens when state is read in an async function after an earlier `await`\n * @param {string} name\n */\nexport function await_reactivity_loss(name) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] await_reactivity_loss\\n%cDetected reactivity loss when reading \\`${name}\\`. This happens when state is read in an async function after an earlier \\`await\\`\\nhttps://svelte.dev/e/await_reactivity_loss`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/await_reactivity_loss`);\n\t}\n}\n\n/**\n * An async derived, `%name%` (%location%) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app\n * @param {string} name\n * @param {string} location\n */\nexport function await_waterfall(name, location) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] await_waterfall\\n%cAn async derived, \\`${name}\\` (${location}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app\\nhttps://svelte.dev/e/await_waterfall`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/await_waterfall`);\n\t}\n}\n\n/**\n * `%binding%` (%location%) is binding to a non-reactive property\n * @param {string} binding\n * @param {string | undefined | null} [location]\n */\nexport function binding_property_non_reactive(binding, location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] binding_property_non_reactive\\n%c${location\n\t\t\t\t? `\\`${binding}\\` (${location}) is binding to a non-reactive property`\n\t\t\t\t: `\\`${binding}\\` is binding to a non-reactive property`}\\nhttps://svelte.dev/e/binding_property_non_reactive`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/binding_property_non_reactive`);\n\t}\n}\n\n/**\n * Your `console.%method%` contained `$state` proxies. Consider using `$inspect(...)` or `$state.snapshot(...)` instead\n * @param {string} method\n */\nexport function console_log_state(method) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] console_log_state\\n%cYour \\`console.${method}\\` contained \\`$state\\` proxies. Consider using \\`$inspect(...)\\` or \\`$state.snapshot(...)\\` instead\\nhttps://svelte.dev/e/console_log_state`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/console_log_state`);\n\t}\n}\n\n/**\n * Reading a derived belonging to a now-destroyed effect may result in stale values\n */\nexport function derived_inert() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] derived_inert\\n%cReading a derived belonging to a now-destroyed effect may result in stale values\\nhttps://svelte.dev/e/derived_inert`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/derived_inert`);\n\t}\n}\n\n/**\n * %handler% should be a function. Did you mean to %suggestion%?\n * @param {string} handler\n * @param {string} suggestion\n */\nexport function event_handler_invalid(handler, suggestion) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] event_handler_invalid\\n%c${handler} should be a function. Did you mean to ${suggestion}?\\nhttps://svelte.dev/e/event_handler_invalid`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/event_handler_invalid`);\n\t}\n}\n\n/**\n * Expected to find a hydratable with key `%key%` during hydration, but did not.\n * @param {string} key\n */\nexport function hydratable_missing_but_expected(key) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] hydratable_missing_but_expected\\n%cExpected to find a hydratable with key \\`${key}\\` during hydration, but did not.\\nhttps://svelte.dev/e/hydratable_missing_but_expected`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydratable_missing_but_expected`);\n\t}\n}\n\n/**\n * The `%attribute%` attribute on `%html%` changed its value between server and client renders. The client value, `%value%`, will be ignored in favour of the server value\n * @param {string} attribute\n * @param {string} html\n * @param {string} value\n */\nexport function hydration_attribute_changed(attribute, html, value) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] hydration_attribute_changed\\n%cThe \\`${attribute}\\` attribute on \\`${html}\\` changed its value between server and client renders. The client value, \\`${value}\\`, will be ignored in favour of the server value\\nhttps://svelte.dev/e/hydration_attribute_changed`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_attribute_changed`);\n\t}\n}\n\n/**\n * The value of an `{@html ...}` block %location% changed between server and client renders. The client value will be ignored in favour of the server value\n * @param {string | undefined | null} [location]\n */\nexport function hydration_html_changed(location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] hydration_html_changed\\n%c${location\n\t\t\t\t? `The value of an \\`{@html ...}\\` block ${location} changed between server and client renders. The client value will be ignored in favour of the server value`\n\t\t\t\t: 'The value of an `{@html ...}` block changed between server and client renders. The client value will be ignored in favour of the server value'}\\nhttps://svelte.dev/e/hydration_html_changed`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_html_changed`);\n\t}\n}\n\n/**\n * Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location%\n * @param {string | undefined | null} [location]\n */\nexport function hydration_mismatch(location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] hydration_mismatch\\n%c${location\n\t\t\t\t? `Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${location}`\n\t\t\t\t: 'Hydration failed because the initial UI does not match what was rendered on the server'}\\nhttps://svelte.dev/e/hydration_mismatch`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_mismatch`);\n\t}\n}\n\n/**\n * The `render` function passed to `createRawSnippet` should return HTML for a single element\n */\nexport function invalid_raw_snippet_render() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] invalid_raw_snippet_render\\n%cThe \\`render\\` function passed to \\`createRawSnippet\\` should return HTML for a single element\\nhttps://svelte.dev/e/invalid_raw_snippet_render`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/invalid_raw_snippet_render`);\n\t}\n}\n\n/**\n * Detected a migrated `$:` reactive block in `%filename%` that both accesses and updates the same reactive value. This may cause recursive updates when converted to an `$effect`.\n * @param {string} filename\n */\nexport function legacy_recursive_reactive_block(filename) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] legacy_recursive_reactive_block\\n%cDetected a migrated \\`$:\\` reactive block in \\`${filename}\\` that both accesses and updates the same reactive value. This may cause recursive updates when converted to an \\`$effect\\`.\\nhttps://svelte.dev/e/legacy_recursive_reactive_block`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/legacy_recursive_reactive_block`);\n\t}\n}\n\n/**\n * Tried to unmount a component that was not mounted\n */\nexport function lifecycle_double_unmount() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] lifecycle_double_unmount\\n%cTried to unmount a component that was not mounted\\nhttps://svelte.dev/e/lifecycle_double_unmount`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/lifecycle_double_unmount`);\n\t}\n}\n\n/**\n * %parent% passed property `%prop%` to %child% with `bind:`, but its parent component %owner% did not declare `%prop%` as a binding. Consider creating a binding between %owner% and %parent% (e.g. `bind:%prop%={...}` instead of `%prop%={...}`)\n * @param {string} parent\n * @param {string} prop\n * @param {string} child\n * @param {string} owner\n */\nexport function ownership_invalid_binding(parent, prop, child, owner) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] ownership_invalid_binding\\n%c${parent} passed property \\`${prop}\\` to ${child} with \\`bind:\\`, but its parent component ${owner} did not declare \\`${prop}\\` as a binding. Consider creating a binding between ${owner} and ${parent} (e.g. \\`bind:${prop}={...}\\` instead of \\`${prop}={...}\\`)\\nhttps://svelte.dev/e/ownership_invalid_binding`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/ownership_invalid_binding`);\n\t}\n}\n\n/**\n * Mutating unbound props (`%name%`, at %location%) is strongly discouraged. Consider using `bind:%prop%={...}` in %parent% (or using a callback) instead\n * @param {string} name\n * @param {string} location\n * @param {string} prop\n * @param {string} parent\n */\nexport function ownership_invalid_mutation(name, location, prop, parent) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] ownership_invalid_mutation\\n%cMutating unbound props (\\`${name}\\`, at ${location}) is strongly discouraged. Consider using \\`bind:${prop}={...}\\` in ${parent} (or using a callback) instead\\nhttps://svelte.dev/e/ownership_invalid_mutation`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/ownership_invalid_mutation`);\n\t}\n}\n\n/**\n * The `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\n */\nexport function select_multiple_invalid_value() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] select_multiple_invalid_value\\n%cThe \\`value\\` property of a \\`<select multiple>\\` element should be an array, but it received a non-array value. The selection will be kept as is.\\nhttps://svelte.dev/e/select_multiple_invalid_value`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/select_multiple_invalid_value`);\n\t}\n}\n\n/**\n * Reactive `$state(...)` proxies and the values they proxy have different identities. Because of this, comparisons with `%operator%` will produce unexpected results\n * @param {string} operator\n */\nexport function state_proxy_equality_mismatch(operator) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] state_proxy_equality_mismatch\\n%cReactive \\`$state(...)\\` proxies and the values they proxy have different identities. Because of this, comparisons with \\`${operator}\\` will produce unexpected results\\nhttps://svelte.dev/e/state_proxy_equality_mismatch`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/state_proxy_equality_mismatch`);\n\t}\n}\n\n/**\n * A `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\n */\nexport function svelte_boundary_reset_noop() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] svelte_boundary_reset_noop\\n%cA \\`<svelte:boundary>\\` \\`reset\\` function only resets the boundary the first time it is called\\nhttps://svelte.dev/e/svelte_boundary_reset_noop`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);\n\t}\n}\n\n/**\n * The `slide` transition does not work correctly for elements with `display: %value%`\n * @param {string} value\n */\nexport function transition_slide_display(value) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] transition_slide_display\\n%cThe \\`slide\\` transition does not work correctly for elements with \\`display: ${value}\\`\\nhttps://svelte.dev/e/transition_slide_display`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/transition_slide_display`);\n\t}\n}","/** @import { Equals } from '#client' */\n\n/** @type {Equals} */\nexport function equals(value) {\n\treturn value === this.v;\n}\n\n/**\n * @param {unknown} a\n * @param {unknown} b\n * @returns {boolean}\n */\nexport function safe_not_equal(a, b) {\n\treturn a != a\n\t\t? b == b\n\t\t: a !== b || (a !== null && typeof a === 'object') || typeof a === 'function';\n}\n\n/**\n * @param {unknown} a\n * @param {unknown} b\n * @returns {boolean}\n */\nexport function not_equal(a, b) {\n\treturn a !== b;\n}\n\n/** @type {Equals} */\nexport function safe_equals(value) {\n\treturn !safe_not_equal(value, this.v);\n}\n","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\nexport * from '../shared/errors.js';\n\n/**\n * Cannot create a `$derived(...)` with an `await` expression outside of an effect tree\n * @returns {never}\n */\nexport function async_derived_orphan() {\n\tif (DEV) {\n\t\tconst error = new Error(`async_derived_orphan\\nCannot create a \\`$derived(...)\\` with an \\`await\\` expression outside of an effect tree\\nhttps://svelte.dev/e/async_derived_orphan`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/async_derived_orphan`);\n\t}\n}\n\n/**\n * Using `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\n * @returns {never}\n */\nexport function bind_invalid_checkbox_value() {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_invalid_checkbox_value\\nUsing \\`bind:value\\` together with a checkbox input is not allowed. Use \\`bind:checked\\` instead\\nhttps://svelte.dev/e/bind_invalid_checkbox_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_invalid_checkbox_value`);\n\t}\n}\n\n/**\n * Component %component% has an export named `%key%` that a consumer component is trying to access using `bind:%key%`, which is disallowed. Instead, use `bind:this` (e.g. `<%name% bind:this={component} />`) and then access the property on the bound component instance (e.g. `component.%key%`)\n * @param {string} component\n * @param {string} key\n * @param {string} name\n * @returns {never}\n */\nexport function bind_invalid_export(component, key, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_invalid_export\\nComponent ${component} has an export named \\`${key}\\` that a consumer component is trying to access using \\`bind:${key}\\`, which is disallowed. Instead, use \\`bind:this\\` (e.g. \\`<${name} bind:this={component} />\\`) and then access the property on the bound component instance (e.g. \\`component.${key}\\`)\\nhttps://svelte.dev/e/bind_invalid_export`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_invalid_export`);\n\t}\n}\n\n/**\n * A component is attempting to bind to a non-bindable property `%key%` belonging to %component% (i.e. `<%name% bind:%key%={...}>`). To mark a property as bindable: `let { %key% = $bindable() } = $props()`\n * @param {string} key\n * @param {string} component\n * @param {string} name\n * @returns {never}\n */\nexport function bind_not_bindable(key, component, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_not_bindable\\nA component is attempting to bind to a non-bindable property \\`${key}\\` belonging to ${component} (i.e. \\`<${name} bind:${key}={...}>\\`). To mark a property as bindable: \\`let { ${key} = $bindable() } = $props()\\`\\nhttps://svelte.dev/e/bind_not_bindable`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_not_bindable`);\n\t}\n}\n\n/**\n * Calling `%method%` on a component instance (of %component%) is no longer valid in Svelte 5\n * @param {string} method\n * @param {string} component\n * @returns {never}\n */\nexport function component_api_changed(method, component) {\n\tif (DEV) {\n\t\tconst error = new Error(`component_api_changed\\nCalling \\`${method}\\` on a component instance (of ${component}) is no longer valid in Svelte 5\\nhttps://svelte.dev/e/component_api_changed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/component_api_changed`);\n\t}\n}\n\n/**\n * Attempted to instantiate %component% with `new %name%`, which is no longer valid in Svelte 5. If this component is not under your control, set the `compatibility.componentApi` compiler option to `4` to keep it working.\n * @param {string} component\n * @param {string} name\n * @returns {never}\n */\nexport function component_api_invalid_new(component, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`component_api_invalid_new\\nAttempted to instantiate ${component} with \\`new ${name}\\`, which is no longer valid in Svelte 5. If this component is not under your control, set the \\`compatibility.componentApi\\` compiler option to \\`4\\` to keep it working.\\nhttps://svelte.dev/e/component_api_invalid_new`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/component_api_invalid_new`);\n\t}\n}\n\n/**\n * A derived value cannot reference itself recursively\n * @returns {never}\n */\nexport function derived_references_self() {\n\tif (DEV) {\n\t\tconst error = new Error(`derived_references_self\\nA derived value cannot reference itself recursively\\nhttps://svelte.dev/e/derived_references_self`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/derived_references_self`);\n\t}\n}\n\n/**\n * Keyed each block has duplicate key `%value%` at indexes %a% and %b%\n * @param {string} a\n * @param {string} b\n * @param {string | undefined | null} [value]\n * @returns {never}\n */\nexport function each_key_duplicate(a, b, value) {\n\tif (DEV) {\n\t\tconst error = new Error(`each_key_duplicate\\n${value\n\t\t\t? `Keyed each block has duplicate key \\`${value}\\` at indexes ${a} and ${b}`\n\t\t\t: `Keyed each block has duplicate key at indexes ${a} and ${b}`}\\nhttps://svelte.dev/e/each_key_duplicate`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/each_key_duplicate`);\n\t}\n}\n\n/**\n * Keyed each block has key that is not idempotent — the key for item at index %index% was `%a%` but is now `%b%`. Keys must be the same each time for a given item\n * @param {string} index\n * @param {string} a\n * @param {string} b\n * @returns {never}\n */\nexport function each_key_volatile(index, a, b) {\n\tif (DEV) {\n\t\tconst error = new Error(`each_key_volatile\\nKeyed each block has key that is not idempotent — the key for item at index ${index} was \\`${a}\\` but is now \\`${b}\\`. Keys must be the same each time for a given item\\nhttps://svelte.dev/e/each_key_volatile`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/each_key_volatile`);\n\t}\n}\n\n/**\n * `%rune%` cannot be used inside an effect cleanup function\n * @param {string} rune\n * @returns {never}\n */\nexport function effect_in_teardown(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_in_teardown\\n\\`${rune}\\` cannot be used inside an effect cleanup function\\nhttps://svelte.dev/e/effect_in_teardown`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_in_teardown`);\n\t}\n}\n\n/**\n * Effect cannot be created inside a `$derived` value that was not itself created inside an effect\n * @returns {never}\n */\nexport function effect_in_unowned_derived() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_in_unowned_derived\\nEffect cannot be created inside a \\`$derived\\` value that was not itself created inside an effect\\nhttps://svelte.dev/e/effect_in_unowned_derived`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_in_unowned_derived`);\n\t}\n}\n\n/**\n * `%rune%` can only be used inside an effect (e.g. during component initialisation)\n * @param {string} rune\n * @returns {never}\n */\nexport function effect_orphan(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_orphan\\n\\`${rune}\\` can only be used inside an effect (e.g. during component initialisation)\\nhttps://svelte.dev/e/effect_orphan`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_orphan`);\n\t}\n}\n\n/**\n * `$effect.pending()` can only be called inside an effect or derived\n * @returns {never}\n */\nexport function effect_pending_outside_reaction() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_pending_outside_reaction\\n\\`$effect.pending()\\` can only be called inside an effect or derived\\nhttps://svelte.dev/e/effect_pending_outside_reaction`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_pending_outside_reaction`);\n\t}\n}\n\n/**\n * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\n * @returns {never}\n */\nexport function effect_update_depth_exceeded() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_update_depth_exceeded\\nMaximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\\nhttps://svelte.dev/e/effect_update_depth_exceeded`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);\n\t}\n}\n\n/**\n * Cannot use `flushSync` inside an effect\n * @returns {never}\n */\nexport function flush_sync_in_effect() {\n\tif (DEV) {\n\t\tconst error = new Error(`flush_sync_in_effect\\nCannot use \\`flushSync\\` inside an effect\\nhttps://svelte.dev/e/flush_sync_in_effect`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/flush_sync_in_effect`);\n\t}\n}\n\n/**\n * Cannot commit a fork that was already discarded\n * @returns {never}\n */\nexport function fork_discarded() {\n\tif (DEV) {\n\t\tconst error = new Error(`fork_discarded\\nCannot commit a fork that was already discarded\\nhttps://svelte.dev/e/fork_discarded`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/fork_discarded`);\n\t}\n}\n\n/**\n * Cannot create a fork inside an effect or when state changes are pending\n * @returns {never}\n */\nexport function fork_timing() {\n\tif (DEV) {\n\t\tconst error = new Error(`fork_timing\\nCannot create a fork inside an effect or when state changes are pending\\nhttps://svelte.dev/e/fork_timing`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/fork_timing`);\n\t}\n}\n\n/**\n * `getAbortSignal()` can only be called inside an effect or derived\n * @returns {never}\n */\nexport function get_abort_signal_outside_reaction() {\n\tif (DEV) {\n\t\tconst error = new Error(`get_abort_signal_outside_reaction\\n\\`getAbortSignal()\\` can only be called inside an effect or derived\\nhttps://svelte.dev/e/get_abort_signal_outside_reaction`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/get_abort_signal_outside_reaction`);\n\t}\n}\n\n/**\n * Expected to find a hydratable with key `%key%` during hydration, but did not.\n * @param {string} key\n * @returns {never}\n */\nexport function hydratable_missing_but_required(key) {\n\tif (DEV) {\n\t\tconst error = new Error(`hydratable_missing_but_required\\nExpected to find a hydratable with key \\`${key}\\` during hydration, but did not.\\nhttps://svelte.dev/e/hydratable_missing_but_required`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/hydratable_missing_but_required`);\n\t}\n}\n\n/**\n * Failed to hydrate the application\n * @returns {never}\n */\nexport function hydration_failed() {\n\tif (DEV) {\n\t\tconst error = new Error(`hydration_failed\\nFailed to hydrate the application\\nhttps://svelte.dev/e/hydration_failed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/hydration_failed`);\n\t}\n}\n\n/**\n * Could not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\n * @returns {never}\n */\nexport function invalid_snippet() {\n\tif (DEV) {\n\t\tconst error = new Error(`invalid_snippet\\nCould not \\`{@render}\\` snippet due to the expression being \\`null\\` or \\`undefined\\`. Consider using optional chaining \\`{@render snippet?.()}\\`\\nhttps://svelte.dev/e/invalid_snippet`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invalid_snippet`);\n\t}\n}\n\n/**\n * `%name%(...)` cannot be used in runes mode\n * @param {string} name\n * @returns {never}\n */\nexport function lifecycle_legacy_only(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`lifecycle_legacy_only\\n\\`${name}(...)\\` cannot be used in runes mode\\nhttps://svelte.dev/e/lifecycle_legacy_only`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/lifecycle_legacy_only`);\n\t}\n}\n\n/**\n * Cannot do `bind:%key%={undefined}` when `%key%` has a fallback value\n * @param {string} key\n * @returns {never}\n */\nexport function props_invalid_value(key) {\n\tif (DEV) {\n\t\tconst error = new Error(`props_invalid_value\\nCannot do \\`bind:${key}={undefined}\\` when \\`${key}\\` has a fallback value\\nhttps://svelte.dev/e/props_invalid_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/props_invalid_value`);\n\t}\n}\n\n/**\n * Rest element properties of `$props()` such as `%property%` are readonly\n * @param {string} property\n * @returns {never}\n */\nexport function props_rest_readonly(property) {\n\tif (DEV) {\n\t\tconst error = new Error(`props_rest_readonly\\nRest element properties of \\`$props()\\` such as \\`${property}\\` are readonly\\nhttps://svelte.dev/e/props_rest_readonly`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/props_rest_readonly`);\n\t}\n}\n\n/**\n * The `%rune%` rune is only available inside `.svelte` and `.svelte.js/ts` files\n * @param {string} rune\n * @returns {never}\n */\nexport function rune_outside_svelte(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`rune_outside_svelte\\nThe \\`${rune}\\` rune is only available inside \\`.svelte\\` and \\`.svelte.js/ts\\` files\\nhttps://svelte.dev/e/rune_outside_svelte`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/rune_outside_svelte`);\n\t}\n}\n\n/**\n * `setContext` must be called when a component first initializes, not in a subsequent effect or after an `await` expression\n * @returns {never}\n */\nexport function set_context_after_init() {\n\tif (DEV) {\n\t\tconst error = new Error(`set_context_after_init\\n\\`setContext\\` must be called when a component first initializes, not in a subsequent effect or after an \\`await\\` expression\\nhttps://svelte.dev/e/set_context_after_init`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/set_context_after_init`);\n\t}\n}\n\n/**\n * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\n * @returns {never}\n */\nexport function state_descriptors_fixed() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_descriptors_fixed\\nProperty descriptors defined on \\`$state\\` objects must contain \\`value\\` and always be \\`enumerable\\`, \\`configurable\\` and \\`writable\\`.\\nhttps://svelte.dev/e/state_descriptors_fixed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_descriptors_fixed`);\n\t}\n}\n\n/**\n * Cannot set prototype of `$state` object\n * @returns {never}\n */\nexport function state_prototype_fixed() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_prototype_fixed\\nCannot set prototype of \\`$state\\` object\\nhttps://svelte.dev/e/state_prototype_fixed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_prototype_fixed`);\n\t}\n}\n\n/**\n * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\n * @returns {never}\n */\nexport function state_unsafe_mutation() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_unsafe_mutation\\nUpdating state inside \\`$derived(...)\\`, \\`$inspect(...)\\` or a template expression is forbidden. If the value should not be reactive, declare it without \\`$state\\`\\nhttps://svelte.dev/e/state_unsafe_mutation`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_unsafe_mutation`);\n\t}\n}\n\n/**\n * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\n * @returns {never}\n */\nexport function svelte_boundary_reset_onerror() {\n\tif (DEV) {\n\t\tconst error = new Error(`svelte_boundary_reset_onerror\\nA \\`<svelte:boundary>\\` \\`reset\\` function cannot be called while an error is still being handled\\nhttps://svelte.dev/e/svelte_boundary_reset_onerror`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);\n\t}\n}","/** True if experimental.async=true */\nexport let async_mode_flag = false;\n/** True if we're not certain that we only have Svelte 5 code in the compilation */\nexport let legacy_mode_flag = false;\n/** True if $inspect.trace is used */\nexport let tracing_mode_flag = false;\n\nexport function enable_async_mode_flag() {\n\tasync_mode_flag = true;\n}\n\n/** ONLY USE THIS DURING TESTING */\nexport function disable_async_mode_flag() {\n\tasync_mode_flag = false;\n}\n\nexport function enable_legacy_mode_flag() {\n\tlegacy_mode_flag = true;\n}\n\nexport function enable_tracing_mode_flag() {\n\ttracing_mode_flag = true;\n}\n","/** @import { ComponentContext, DevStackEntry, Effect } from '#client' */\nimport { DEV } from 'esm-env';\nimport * as e from './errors.js';\nimport { active_effect, active_reaction } from './runtime.js';\nimport { create_user_effect } from './reactivity/effects.js';\nimport { async_mode_flag, legacy_mode_flag } from '../flags/index.js';\nimport { FILENAME } from '../../constants.js';\nimport { BRANCH_EFFECT, COMPONENT_SYMBOL } from './constants.js';\nimport { define_property } from '../shared/utils.js';\nimport { create_context, get_or_init_context_map } from '../shared/context.js';\n\n/** @type {ComponentContext | null} */\nexport let component_context = null;\n\n/** @param {ComponentContext | null} context */\nexport function set_component_context(context) {\n\tcomponent_context = context;\n}\n\n/** @type {DevStackEntry | null} */\nexport let dev_stack = null;\n\n/** @param {DevStackEntry | null} stack */\nexport function set_dev_stack(stack) {\n\tdev_stack = stack;\n}\n\n/**\n * Execute a callback with a new dev stack entry\n * @param {() => any} callback - Function to execute\n * @param {DevStackEntry['type']} type - Type of block/component\n * @param {any} component - Component function\n * @param {number} line - Line number\n * @param {number} column - Column number\n * @param {Record<string, any>} [additional] - Any additional properties to add to the dev stack entry\n * @returns {any}\n */\nexport function add_svelte_meta(callback, type, component, line, column, additional) {\n\tconst parent = dev_stack;\n\n\tdev_stack = {\n\t\ttype,\n\t\tfile: component[FILENAME],\n\t\tline,\n\t\tcolumn,\n\t\tparent,\n\t\t...additional\n\t};\n\n\ttry {\n\t\treturn callback();\n\t} finally {\n\t\tdev_stack = parent;\n\t}\n}\n\n/**\n * The current component function. Different from current component context:\n * ```html\n * <!-- App.svelte -->\n * <Foo>\n * <Bar /> <!-- context == Foo.svelte, function == App.svelte -->\n * </Foo>\n * ```\n * @type {ComponentContext['function']}\n */\nexport let dev_current_component_function = null;\n\n/** @param {ComponentContext['function']} fn */\nexport function set_dev_current_component_function(fn) {\n\tdev_current_component_function = fn;\n}\n\n/**\n * Returns a `[get, set, has]` triplet of functions for working with context in a type-safe way.\n *\n * `get` will throw an error if `set` has not yet been called in the current component or any of\n * its ancestors.\n *\n * @template T\n * @returns {[() => T, (context: T) => T, () => boolean]}\n * @since 5.40.0\n */\nexport function createContext() {\n\treturn /** @type {[() => T, (context: T) => T, () => boolean]} */ (\n\t\tcreate_context(getContext, setContext, hasContext)\n\t);\n}\n\n/**\n * Retrieves the context set with the specified `key` in the current component or any of its\n * ancestors. If multiple components set the same key, the value from the closest one is returned.\n * A `setContext` call in the current component is only visible to `getContext` calls that run after it.\n * Must be called during component initialisation.\n *\n * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative.\n *\n * @template T\n * @param {any} key\n * @returns {T}\n */\nexport function getContext(key) {\n\tconst context_map = get_or_init_context_map(component_context, 'getContext');\n\tconst result = /** @type {T} */ (context_map.get(key));\n\treturn result;\n}\n\n/**\n * Associates an arbitrary `context` object with the current component and the specified `key`\n * and returns that object. The context is then available to the component itself and all of its\n * descendants (including slotted content) with `getContext`.\n *\n * Like lifecycle functions, this must be called during component initialisation.\n *\n * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative.\n *\n * @template T\n * @param {any} key\n * @param {T} context\n * @returns {T}\n */\nexport function setContext(key, context) {\n\tconst context_map = get_or_init_context_map(component_context, 'setContext');\n\n\tif (async_mode_flag) {\n\t\tvar flags = /** @type {Effect} */ (active_effect).f;\n\t\tvar valid =\n\t\t\t!active_reaction &&\n\t\t\t(flags & BRANCH_EFFECT) !== 0 &&\n\t\t\t// pop() runs synchronously, so this indicates we're setting context after an await\n\t\t\t!(/** @type {ComponentContext} */ (component_context).i);\n\n\t\tif (!valid) {\n\t\t\te.set_context_after_init();\n\t\t}\n\t}\n\n\tcontext_map.set(key, context);\n\treturn context;\n}\n\n/**\n * Checks whether a given `key` has been set in the context of the current component or any of\n * its ancestors. Must be called during component initialisation.\n *\n * @param {any} key\n * @returns {boolean}\n */\nexport function hasContext(key) {\n\tconst context_map = get_or_init_context_map(component_context, 'hasContext');\n\treturn context_map.has(key);\n}\n\n/**\n * Retrieves the whole context map that belongs to the current component, including entries\n * inherited from its ancestors. Must be called during component initialisation. Useful, for\n * example, if you programmatically create a component and want to pass the existing context to it.\n *\n * @template {Map<any, any>} [T=Map<any, any>]\n * @returns {T}\n */\nexport function getAllContexts() {\n\tconst context_map = get_or_init_context_map(component_context, 'getAllContexts');\n\treturn /** @type {T} */ (context_map);\n}\n\n/**\n * @param {Record<string, unknown>} props\n * @param {any} runes\n * @param {Function} [fn]\n * @returns {void}\n */\nexport function push(props, runes = false, fn) {\n\tcomponent_context = {\n\t\tp: component_context,\n\t\ti: false,\n\t\tc: null,\n\t\te: null,\n\t\ts: props,\n\t\tx: null,\n\t\tr: /** @type {Effect} */ (active_effect),\n\t\tl: legacy_mode_flag && !runes ? { s: null, u: null, $: [] } : null\n\t};\n\n\tif (DEV) {\n\t\t// component function\n\t\tcomponent_context.function = fn;\n\t\tdev_current_component_function = fn;\n\t}\n}\n\n/**\n * @template {Record<string, any>} T\n * @param {T} [component]\n * @returns {T}\n */\nexport function pop(component) {\n\tvar context = /** @type {ComponentContext} */ (component_context);\n\tvar effects = context.e;\n\n\tif (effects !== null) {\n\t\tcontext.e = null;\n\n\t\tfor (var fn of effects) {\n\t\t\tcreate_user_effect(fn);\n\t\t}\n\t}\n\n\tif (component !== undefined) {\n\t\tcontext.x = component;\n\t}\n\n\tcontext.i = true;\n\n\tcomponent_context = context.p;\n\n\tif (DEV) {\n\t\tdev_current_component_function = component_context?.function ?? null;\n\t}\n\n\treturn mark_as_component(component);\n}\n\n/**\n * Add a symbol to the object (or create one if undefined) to mark it as a component so it isn't proxified.\n * @param {any} component\n */\nexport function mark_as_component(component = {}) {\n\tdefine_property(component, COMPONENT_SYMBOL, { value: true });\n\treturn component;\n}\n\n/** @returns {boolean} */\nexport function is_runes() {\n\treturn !legacy_mode_flag || (component_context !== null && component_context.l === null);\n}\n","import { run_all } from '../../shared/utils.js';\nimport { is_flushing_sync } from '../reactivity/batch.js';\n\n/** @type {Array<() => void>} */\nlet micro_tasks = [];\n\nfunction run_micro_tasks() {\n\tvar tasks = micro_tasks;\n\tmicro_tasks = [];\n\trun_all(tasks);\n}\n\n/**\n * @param {() => void} fn\n */\nexport function queue_micro_task(fn) {\n\tif (micro_tasks.length === 0 && !is_flushing_sync) {\n\t\tvar tasks = micro_tasks;\n\t\tqueueMicrotask(() => {\n\t\t\t// If this is false, a flushSync happened in the meantime. Do _not_ run new scheduled microtasks in that case\n\t\t\t// as the ordering of microtasks would be broken at that point - consider this case:\n\t\t\t// - queue_micro_task schedules microtask A to flush task X\n\t\t\t// - synchronously after, flushSync runs, processing task X\n\t\t\t// - synchronously after, some other microtask B is scheduled, but not through queue_micro_task but for example a Promise.resolve() in user code\n\t\t\t// - synchronously after, queue_micro_task schedules microtask C to flush task Y\n\t\t\t// - one tick later, microtask A now resolves, flushing task Y before microtask B, which is incorrect\n\t\t\t// This if check prevents that race condition (that realistically will only happen in tests)\n\t\t\tif (tasks === micro_tasks) run_micro_tasks();\n\t\t});\n\t}\n\n\tmicro_tasks.push(fn);\n}\n\n/**\n * Synchronously run any queued tasks.\n */\nexport function flush_tasks() {\n\twhile (micro_tasks.length > 0) {\n\t\trun_micro_tasks();\n\t}\n}\n","/** @import { Derived, Signal } from '#client' */\nimport { CLEAN, CONNECTED, DIRTY, MAYBE_DIRTY } from '#client/constants';\n\nconst STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);\n\n/**\n * @param {Signal} signal\n * @param {number} status\n */\nexport function set_signal_status(signal, status) {\n\tsignal.f = (signal.f & STATUS_MASK) | status;\n}\n\n/**\n * Set a derived's status to CLEAN or MAYBE_DIRTY based on its connection state.\n * @param {Derived} derived\n */\nexport function update_derived_status(derived) {\n\t// Only mark as MAYBE_DIRTY if disconnected and has dependencies.\n\tif ((derived.f & CONNECTED) !== 0 || derived.deps === null) {\n\t\tset_signal_status(derived, CLEAN);\n\t} else {\n\t\tset_signal_status(derived, MAYBE_DIRTY);\n\t}\n}\n","/** @import { Derived, Effect, Value } from '#client' */\nimport { CLEAN, DERIVED, DIRTY, MAYBE_DIRTY, WAS_MARKED } from '#client/constants';\nimport { set_signal_status } from './status.js';\n\n/**\n * @param {Value[] | null} deps\n */\nfunction clear_marked(deps) {\n\tif (deps === null) return;\n\n\tfor (const dep of deps) {\n\t\tif ((dep.f & DERIVED) === 0 || (dep.f & WAS_MARKED) === 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tdep.f ^= WAS_MARKED;\n\n\t\tclear_marked(/** @type {Derived} */ (dep).deps);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {Set<Effect>} dirty_effects\n * @param {Set<Effect>} maybe_dirty_effects\n */\nexport function defer_effect(effect, dirty_effects, maybe_dirty_effects) {\n\tif ((effect.f & DIRTY) !== 0) {\n\t\tdirty_effects.add(effect);\n\t} else if ((effect.f & MAYBE_DIRTY) !== 0) {\n\t\tmaybe_dirty_effects.add(effect);\n\t}\n\n\t// Since we're not executing these effects now, we need to clear any WAS_MARKED flags\n\t// so that other batches can correctly reach these effects during their own traversal\n\tclear_marked(effect.deps);\n\n\t// mark as clean so they get scheduled if they depend on pending async state\n\tset_signal_status(effect, CLEAN);\n}\n","/** @import { StoreReferencesContainer } from '#client' */\n/** @import { Store } from '#shared' */\nimport { subscribe_to_store } from '../../../store/utils.js';\nimport { get as get_store } from '../../../store/shared/index.js';\nimport { define_property, noop } from '../../shared/utils.js';\nimport { get } from '../runtime.js';\nimport { teardown } from './effects.js';\nimport { mutable_source, set } from './sources.js';\nimport { DEV } from 'esm-env';\n\n/**\n * We set this to `true` when updating a store so that we correctly\n * schedule effects if the update takes place inside a `$:` effect\n */\nexport let legacy_is_updating_store = false;\n\n/**\n * Whether or not the prop currently being read is a store binding, as in\n * `<Child bind:x={$y} />`. If it is, we treat the prop as mutable even in\n * runes mode, and skip `binding_property_non_reactive` validation\n */\nlet is_store_binding = false;\n\nlet IS_UNMOUNTED = Symbol('unmounted');\n\n/**\n * Gets the current value of a store. If the store isn't subscribed to yet, it will create a proxy\n * signal that will be updated when the store is. The store references container is needed to\n * track reassignments to stores and to track the correct component context.\n * @template V\n * @param {Store<V> | null | undefined} store\n * @param {string} store_name\n * @param {StoreReferencesContainer} stores\n * @returns {V}\n */\nexport function store_get(store, store_name, stores) {\n\tconst entry = (stores[store_name] ??= {\n\t\tstore: null,\n\t\tsource: mutable_source(undefined),\n\t\tunsubscribe: noop\n\t});\n\n\tif (DEV) {\n\t\tentry.source.label = store_name;\n\t}\n\n\t// if the component that setup this is already unmounted we don't want to register a subscription\n\tif (entry.store !== store && !(IS_UNMOUNTED in stores)) {\n\t\tentry.unsubscribe();\n\t\tentry.store = store ?? null;\n\n\t\tif (store == null) {\n\t\t\tentry.source.v = undefined; // see synchronous callback comment below\n\t\t\tentry.unsubscribe = noop;\n\t\t} else {\n\t\t\tvar is_synchronous_callback = true;\n\n\t\t\tentry.unsubscribe = subscribe_to_store(store, (v) => {\n\t\t\t\tif (is_synchronous_callback) {\n\t\t\t\t\t// If the first updates to the store value (possibly multiple of them) are synchronously\n\t\t\t\t\t// inside a derived, we will hit the `state_unsafe_mutation` error if we `set` the value\n\t\t\t\t\tentry.source.v = v;\n\t\t\t\t} else {\n\t\t\t\t\tset(entry.source, v);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tis_synchronous_callback = false;\n\t\t}\n\t}\n\n\t// if the component that setup this stores is already unmounted the source will be out of sync\n\t// so we just use the `get` for the stores, less performant but it avoids to create a memory leak\n\t// and it will keep the value consistent\n\tif (store && IS_UNMOUNTED in stores) {\n\t\treturn get_store(store);\n\t}\n\n\treturn get(entry.source);\n}\n\n/**\n * Unsubscribe from a store if it's not the same as the one in the store references container.\n * We need this in addition to `store_get` because someone could unsubscribe from a store but\n * then never subscribe to the new one (if any), causing the subscription to stay open wrongfully.\n * @param {Store<any> | null | undefined} store\n * @param {string} store_name\n * @param {StoreReferencesContainer} stores\n */\nexport function store_unsub(store, store_name, stores) {\n\t/** @type {StoreReferencesContainer[''] | undefined} */\n\tlet entry = stores[store_name];\n\n\tif (entry && entry.store !== store) {\n\t\t// Don't reset store yet, so that store_get above can resubscribe to new store if necessary\n\t\tentry.unsubscribe();\n\t\tentry.unsubscribe = noop;\n\t}\n\n\treturn store;\n}\n\n/**\n * Sets the new value of a store and returns that value.\n * @template V\n * @param {Store<V>} store\n * @param {V} value\n * @returns {V}\n */\nexport function store_set(store, value) {\n\tupdate_with_flag(store, value);\n\treturn value;\n}\n\n/**\n * @param {StoreReferencesContainer} stores\n * @param {string} store_name\n */\nexport function invalidate_store(stores, store_name) {\n\tvar entry = stores[store_name];\n\tif (entry.store !== null) {\n\t\tstore_set(entry.store, entry.source.v);\n\t}\n}\n\n/**\n * Unsubscribes from all auto-subscribed stores on destroy\n * @returns {[StoreReferencesContainer, ()=>void]}\n */\nexport function setup_stores() {\n\t/** @type {StoreReferencesContainer} */\n\tconst stores = {};\n\n\tfunction cleanup() {\n\t\tteardown(() => {\n\t\t\tfor (var store_name in stores) {\n\t\t\t\tconst ref = stores[store_name];\n\t\t\t\tref.unsubscribe();\n\t\t\t}\n\t\t\tdefine_property(stores, IS_UNMOUNTED, {\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: true\n\t\t\t});\n\t\t});\n\t}\n\n\treturn [stores, cleanup];\n}\n\n/**\n * @param {Store<V>} store\n * @param {V} value\n * @template V\n */\nfunction update_with_flag(store, value) {\n\tlegacy_is_updating_store = true;\n\n\ttry {\n\t\tstore.set(value);\n\t} finally {\n\t\tlegacy_is_updating_store = false;\n\t}\n}\n\n/**\n * Updates a store with a new value.\n * @param {Store<V>} store the store to update\n * @param {any} expression the expression that mutates the store\n * @param {V} new_value the new store value\n * @template V\n */\nexport function store_mutate(store, expression, new_value) {\n\tupdate_with_flag(store, new_value);\n\treturn expression;\n}\n\n/**\n * @param {Store<number>} store\n * @param {number} store_value\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_store(store, store_value, d = 1) {\n\tupdate_with_flag(store, store_value + d);\n\treturn store_value;\n}\n\n/**\n * @param {Store<number>} store\n * @param {number} store_value\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_pre_store(store, store_value, d = 1) {\n\tconst value = store_value + d;\n\tupdate_with_flag(store, value);\n\treturn value;\n}\n\n/**\n * Called inside prop getters to communicate that the prop is a store binding\n */\nexport function mark_store_binding() {\n\tis_store_binding = true;\n}\n\n/**\n * Returns a tuple that indicates whether `fn()` reads a prop that is a store binding.\n * Used to prevent `binding_property_non_reactive` validation false positives and\n * ensure that these props are treated as mutable even in runes mode\n * @template T\n * @param {() => T} fn\n * @returns {[T, boolean]}\n */\nexport function capture_store_binding(fn) {\n\tvar previous_is_store_binding = is_store_binding;\n\n\ttry {\n\t\tis_store_binding = false;\n\t\treturn [fn(), is_store_binding];\n\t} finally {\n\t\tis_store_binding = previous_is_store_binding;\n\t}\n}\n","import { hydrating } from '../hydration.js';\nimport { clear_text_content, get_first_child } from '../operations.js';\nimport { queue_micro_task } from '../task.js';\nimport { FORM_RESET_HANDLER } from '../../constants.js';\n\n/**\n * @param {HTMLElement} dom\n * @param {boolean} value\n * @returns {void}\n */\nexport function autofocus(dom, value) {\n\tif (value) {\n\t\tconst body = document.body;\n\t\tdom.autofocus = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tif (document.activeElement === body) {\n\t\t\t\tdom.focus();\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * The child of a textarea actually corresponds to the defaultValue property, so we need\n * to remove it upon hydration to avoid a bug when someone resets the form value.\n * @param {HTMLTextAreaElement} dom\n * @returns {void}\n */\nexport function remove_textarea_child(dom) {\n\tif (hydrating && get_first_child(dom) !== null) {\n\t\tclear_text_content(dom);\n\t}\n}\n\nlet listening_to_form_reset = false;\n\nexport function add_form_reset_listener() {\n\tif (!listening_to_form_reset) {\n\t\tlistening_to_form_reset = true;\n\t\tdocument.addEventListener(\n\t\t\t'reset',\n\t\t\t(evt) => {\n\t\t\t\t// Needs to happen one tick later or else the dom properties of the form\n\t\t\t\t// elements have not updated to their reset values yet\n\t\t\t\tPromise.resolve().then(() => {\n\t\t\t\t\tif (!evt.defaultPrevented) {\n\t\t\t\t\t\tfor (const e of /**@type {HTMLFormElement} */ (evt.target).elements) {\n\t\t\t\t\t\t\t/** @type {any} */ (e)[FORM_RESET_HANDLER]?.();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\t// In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)\n\t\t\t{ capture: true }\n\t\t);\n\t}\n}\n","import { teardown } from '../../../reactivity/effects.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../../runtime.js';\nimport { FORM_RESET_HANDLER } from '../../../constants.js';\nimport { add_form_reset_listener } from '../misc.js';\n\n/**\n * Fires the handler once immediately (unless corresponding arg is set to `false`),\n * then listens to the given events until the render effect context is destroyed\n * @param {EventTarget} target\n * @param {Array<string>} events\n * @param {(event?: Event) => void} handler\n * @param {any} call_handler_immediately\n */\nexport function listen(target, events, handler, call_handler_immediately = true) {\n\tif (call_handler_immediately) {\n\t\thandler();\n\t}\n\n\tfor (var name of events) {\n\t\ttarget.addEventListener(name, handler);\n\t}\n\n\tteardown(() => {\n\t\tfor (var name of events) {\n\t\t\ttarget.removeEventListener(name, handler);\n\t\t}\n\t});\n}\n\n/**\n * @template T\n * @param {() => T} fn\n */\nexport function without_reactive_context(fn) {\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\ttry {\n\t\treturn fn();\n\t} finally {\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t}\n}\n\n/**\n * Listen to the given event, and then instantiate a global form reset listener if not already done,\n * to notify all bindings when the form is reset\n * @param {HTMLElement} element\n * @param {string} event\n * @param {(is_reset?: true) => void} handler\n * @param {(is_reset?: true) => void} [on_reset]\n */\nexport function listen_to_event_and_reset_event(element, event, handler, on_reset = handler) {\n\telement.addEventListener(event, () => without_reactive_context(handler));\n\tconst prev = /** @type {any} */ (element)[FORM_RESET_HANDLER];\n\tif (prev) {\n\t\t// special case for checkbox that can have multiple binds (group & checked)\n\t\t/** @type {any} */ (element)[FORM_RESET_HANDLER] = () => {\n\t\t\tprev();\n\t\t\ton_reset(true);\n\t\t};\n\t} else {\n\t\t/** @type {any} */ (element)[FORM_RESET_HANDLER] = () => on_reset(true);\n\t}\n\n\tadd_form_reset_listener();\n}\n","/** @import { Blocker, Effect, Source, Value } from '#client' */\nimport { DESTROYED, STALE_REACTION } from '#client/constants';\nimport { DEV } from 'esm-env';\nimport {\n\tcomponent_context,\n\tdev_stack,\n\tis_runes,\n\tset_component_context,\n\tset_dev_stack\n} from '../context.js';\nimport { invoke_error_boundary } from '../error-handling.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../runtime.js';\nimport { Batch, current_batch } from './batch.js';\nimport {\n\tasync_derived,\n\treactivity_loss_tracker,\n\tderived,\n\tderived_safe_equal,\n\tset_reactivity_loss_tracker\n} from './deriveds.js';\nimport { aborted } from './effects.js';\n\n/**\n * @param {Blocker[]} blockers\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {(values: Value[]) => any} fn\n */\nexport function flatten(blockers, sync, async, fn) {\n\tconst d = is_runes() ? derived : derived_safe_equal;\n\n\t// Filter out already-settled blockers - no need to wait for them\n\tvar pending = blockers.filter((b) => !b.settled);\n\n\tvar deriveds = sync.map(d);\n\n\tif (DEV) {\n\t\tderiveds.forEach((d, i) => {\n\t\t\t// TODO this is kinda useful for debugging but a lousy implementation —\n\t\t\t// maybe the compiler could pass through the template string\n\t\t\td.label = sync[i]\n\t\t\t\t.toString()\n\t\t\t\t.replace('() => ', '')\n\t\t\t\t.replaceAll('$.eager(() => ', '$state.eager(')\n\t\t\t\t.replace(/\\$\\.get\\((.+?)\\)/g, (_, id) => id);\n\t\t});\n\t}\n\n\tif (async.length === 0 && pending.length === 0) {\n\t\tfn(deriveds);\n\t\treturn;\n\t}\n\n\tvar parent = /** @type {Effect} */ (active_effect);\n\n\tvar restore = capture();\n\tvar blocker_promise =\n\t\tpending.length === 1\n\t\t\t? pending[0].promise\n\t\t\t: pending.length > 1\n\t\t\t\t? Promise.all(pending.map((b) => b.promise))\n\t\t\t\t: null;\n\n\t/**\n\t * @param {Source[]} async\n\t */\n\tfunction finish(async) {\n\t\tif ((parent.f & DESTROYED) !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\trestore();\n\n\t\ttry {\n\t\t\tfn([...deriveds, ...async]);\n\t\t} catch (error) {\n\t\t\tinvoke_error_boundary(error, parent);\n\t\t}\n\n\t\tunset_context();\n\t}\n\n\tvar decrement_pending = increment_pending();\n\n\t// Fast path: blockers but no async expressions\n\tif (async.length === 0) {\n\t\t/** @type {Promise<any>} */ (blocker_promise).then(() => finish([])).finally(decrement_pending);\n\t\treturn;\n\t}\n\n\t// Full path: has async expressions\n\tfunction run() {\n\t\tPromise.all(async.map((expression) => async_derived(expression)))\n\t\t\t.then(finish)\n\t\t\t.catch((error) => invoke_error_boundary(error, parent))\n\t\t\t.finally(decrement_pending);\n\t}\n\n\tif (blocker_promise) {\n\t\tblocker_promise.then(() => {\n\t\t\trestore();\n\t\t\trun();\n\t\t\tunset_context();\n\t\t});\n\t} else {\n\t\trun();\n\t}\n}\n\n/**\n * @param {Blocker[]} blockers\n * @param {(values: Value[]) => any} fn\n */\nexport function run_after_blockers(blockers, fn) {\n\tflatten(blockers, [], [], fn);\n}\n\n/**\n * Captures the current effect context so that we can restore it after\n * some asynchronous work has happened (so that e.g. `await a + b`\n * causes `b` to be registered as a dependency).\n */\nexport function capture() {\n\tvar previous_effect = /** @type {Effect} */ (active_effect);\n\tvar previous_reaction = active_reaction;\n\tvar previous_component_context = component_context;\n\tvar previous_batch = /** @type {Batch} */ (current_batch);\n\n\tif (DEV) {\n\t\tvar previous_dev_stack = dev_stack;\n\t}\n\n\treturn function restore(activate_batch = true) {\n\t\tset_active_effect(previous_effect);\n\t\tset_active_reaction(previous_reaction);\n\t\tset_component_context(previous_component_context);\n\n\t\tif (activate_batch && (previous_effect.f & DESTROYED) === 0) {\n\t\t\t// TODO we only need optional chaining here because `{#await ...}` blocks\n\t\t\t// are anomalous. Once we retire them we can get rid of it\n\t\t\tprevious_batch?.activate();\n\t\t\tprevious_batch?.apply();\n\t\t}\n\n\t\tif (DEV) {\n\t\t\tset_reactivity_loss_tracker(null);\n\t\t\tset_dev_stack(previous_dev_stack);\n\t\t}\n\t};\n}\n\n/** `true` between a `save` thunk restoring a context and the end of that synchronous segment */\nvar restored = false;\n\n/**\n * Wraps an `await` expression in such a way that the effect context that was\n * active before the expression evaluated can be reapplied afterwards —\n * `await a + b` becomes `(await $.save(a))() + b`\n * @template T\n * @param {Promise<T>} promise\n * @returns {Promise<() => T>}\n */\nexport async function save(promise) {\n\tvar restore = capture();\n\t// the context restored by an earlier `save` in this expression must not\n\t// outlive the synchronous segment that is about to end at this `await`\n\tunsave();\n\tvar value = await promise;\n\n\treturn () => {\n\t\trestore();\n\t\trestored = true;\n\t\treturn value;\n\t};\n}\n\n/**\n * Unset the context if a `save` thunk restored it in the current synchronous segment,\n * so that a foreign microtask can never run inside a restored reaction context.\n * Called at every suspension point, and at the end of async expression bodies —\n * `async () => (await $.save(a))().b` becomes `async () => { try { return (await $.save(a))().b; } finally { $.unsave(); } }`\n * @template T\n * @param {T} [value]\n * @returns {T}\n */\nexport function unsave(value) {\n\tif (restored) unset_context();\n\treturn /** @type {T} */ (value);\n}\n\n/**\n * Reset `current_async_effect` after the `promise` resolves, so\n * that we can emit `await_reactivity_loss` warnings\n * @template T\n * @param {Promise<T>} promise\n * @returns {Promise<() => T>}\n */\nexport async function track_reactivity_loss(promise) {\n\tunsave();\n\tvar previous_reactivity_loss_tracker = reactivity_loss_tracker;\n\t// Ensure that unrelated reads after an async operation is kicked off don't cause false positives\n\tqueueMicrotask(() => {\n\t\tif (reactivity_loss_tracker === previous_reactivity_loss_tracker) {\n\t\t\tset_reactivity_loss_tracker(null);\n\t\t}\n\t});\n\n\tvar value = await promise;\n\n\treturn () => {\n\t\tset_reactivity_loss_tracker(previous_reactivity_loss_tracker);\n\t\t// While this can result in false negatives it also guards against the more important\n\t\t// false positives that would occur if this is the last in a chain of async operations,\n\t\t// and the reactivity_loss_tracker would then stay around until the next async operation happens.\n\t\tqueueMicrotask(() => {\n\t\t\tif (reactivity_loss_tracker === previous_reactivity_loss_tracker) {\n\t\t\t\tset_reactivity_loss_tracker(null);\n\t\t\t}\n\t\t});\n\n\t\treturn value;\n\t};\n}\n\n/**\n * Used in `for await` loops in DEV, so\n * that we can emit `await_reactivity_loss` warnings\n * after each `async_iterator` result resolves and\n * after the `async_iterator` return resolves (if it runs)\n * @template T\n * @template TReturn\n * @param {Iterable<T> | AsyncIterable<T>} iterable\n * @returns {AsyncGenerator<T, TReturn | undefined>}\n */\nexport async function* for_await_track_reactivity_loss(iterable) {\n\t// This is based on the algorithms described in ECMA-262:\n\t// ForIn/OfBodyEvaluation\n\t// https://tc39.es/ecma262/multipage/ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset\n\t// AsyncIteratorClose\n\t// https://tc39.es/ecma262/multipage/abstract-operations.html#sec-asynciteratorclose\n\n\t/** @type {AsyncIterator<T, TReturn>} */\n\t// @ts-ignore\n\tconst iterator = iterable[Symbol.asyncIterator]?.() ?? iterable[Symbol.iterator]?.();\n\n\tif (iterator === undefined) {\n\t\tthrow new TypeError('value is not async iterable');\n\t}\n\n\t// eslint-disable-next-line no-useless-assignment\n\tlet invoke_return = true;\n\n\ttry {\n\t\twhile (true) {\n\t\t\tconst { done, value } = (await track_reactivity_loss(iterator.next()))();\n\t\t\tif (done) {\n\t\t\t\tinvoke_return = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvar prev = reactivity_loss_tracker;\n\t\t\ttry {\n\t\t\t\tyield value;\n\t\t\t} catch (e) {\n\t\t\t\tset_reactivity_loss_tracker(prev);\n\t\t\t\t// If the yield throws, we need to call `return` but not return its value, instead rethrow\n\t\t\t\tif (iterator.return !== undefined) {\n\t\t\t\t\t(await track_reactivity_loss(iterator.return()))();\n\t\t\t\t}\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t\tset_reactivity_loss_tracker(prev);\n\t\t}\n\t} catch (error) {\n\t\tinvoke_return = false;\n\t\tthrow error;\n\t} finally {\n\t\t// If the iterator had an abrupt completion (break) and `return` is defined on the iterator, call it and return the value\n\t\tif (invoke_return && iterator.return !== undefined) {\n\t\t\t// eslint-disable-next-line no-unsafe-finally\n\t\t\treturn /** @type {TReturn} */ ((await track_reactivity_loss(iterator.return()))().value);\n\t\t}\n\t}\n}\n\nexport function unset_context(deactivate_batch = true) {\n\trestored = false;\n\tset_active_effect(null);\n\tset_active_reaction(null);\n\tset_component_context(null);\n\tif (deactivate_batch) current_batch?.deactivate();\n\n\tif (DEV) {\n\t\tset_reactivity_loss_tracker(null);\n\t\tset_dev_stack(null);\n\t}\n}\n\n/**\n * @param {Array<() => void | Promise<void>>} thunks\n */\nexport function run(thunks) {\n\tconst restore = capture();\n\n\tconst decrement_pending = increment_pending();\n\n\tvar active = /** @type {Effect} */ (active_effect);\n\n\t/** @type {null | { error: any }} */\n\tvar errored = null;\n\n\t/** @param {any} error */\n\tconst handle_error = (error) => {\n\t\terrored = { error }; // wrap in object in case a promise rejects with a falsy value\n\n\t\tif (!aborted(active)) {\n\t\t\tinvoke_error_boundary(error, active);\n\t\t}\n\t};\n\n\tvar promise = Promise.resolve(thunks[0]()).catch(handle_error);\n\n\t/** @type {Blocker} */\n\tvar blocker = { promise, settled: false };\n\tvar blockers = [blocker];\n\n\tpromise.finally(() => {\n\t\tblocker.settled = true;\n\t\tunset_context();\n\t});\n\n\tfor (const fn of thunks.slice(1)) {\n\t\tpromise = promise\n\t\t\t.then(() => {\n\t\t\t\trestore();\n\n\t\t\t\ttry {\n\t\t\t\t\tif (errored) {\n\t\t\t\t\t\tthrow errored.error;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (aborted(active)) {\n\t\t\t\t\t\tthrow STALE_REACTION;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn fn();\n\t\t\t\t} finally {\n\t\t\t\t\t// We gotta unset context directly in case the function returns a promise, in which case\n\t\t\t\t\t// unset_context in .finally() would be too late ...\n\t\t\t\t\tunset_context();\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(handle_error);\n\n\t\tconst blocker = { promise, settled: false };\n\t\tblockers.push(blocker);\n\n\t\tpromise.finally(() => {\n\t\t\tblocker.settled = true;\n\t\t\t// ... but we also need it after such a promise has resolved in case it restores our context\n\t\t\tunset_context();\n\t\t});\n\t}\n\n\tpromise\n\t\t// wait one more tick, so that template effects are\n\t\t// guaranteed to run before `$effect(...)`\n\t\t.then(() => Promise.resolve())\n\t\t.finally(decrement_pending);\n\n\treturn blockers;\n}\n\n/**\n * @param {Blocker[]} blockers\n */\nexport function wait(blockers) {\n\treturn Promise.all(blockers.map((b) => b.promise));\n}\n\n/**\n * @returns {(skip?: boolean) => void}\n */\nexport function increment_pending() {\n\tvar effect = /** @type {Effect} */ (active_effect);\n\tvar boundary = effect.b; // undefined if called outside the render tree, e.g. a standalone $effect.root\n\tvar batch = /** @type {Batch} */ (current_batch);\n\tvar blocking = !!boundary?.is_rendered();\n\n\tboundary?.update_pending_count(1, batch);\n\tbatch.increment(blocking, effect);\n\n\treturn () => {\n\t\tboundary?.update_pending_count(-1, batch);\n\t\tbatch.decrement(blocking, effect);\n\t};\n}\n","/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */\n/** @import { Batch } from './batch.js'; */\n/** @import { Boundary } from '../dom/blocks/boundary.js'; */\nimport { DEV } from 'esm-env';\nimport {\n\tERROR_VALUE,\n\tDERIVED,\n\tDIRTY,\n\tEFFECT_PRESERVED,\n\tSTALE_REACTION,\n\tASYNC,\n\tWAS_MARKED,\n\tDESTROYED,\n\tCLEAN,\n\tREACTION_RAN,\n\tINERT\n} from '#client/constants';\nimport {\n\tactive_reaction,\n\tactive_effect,\n\tupdate_reaction,\n\tincrement_write_version,\n\tset_active_effect,\n\tpush_reaction_value,\n\tis_destroying_effect,\n\tupdate_effect,\n\tremove_reactions,\n\tskipped_deps,\n\tnew_deps\n} from '../runtime.js';\nimport { without_reactive_context } from '../dom/elements/bindings/shared.js';\nimport { equals, safe_equals } from './equality.js';\nimport * as e from '../errors.js';\nimport * as w from '../warnings.js';\nimport {\n\tasync_effect,\n\tdestroy_effect,\n\tdestroy_effect_children,\n\teffect_tracking,\n\tteardown\n} from './effects.js';\nimport { eager_effects, internal_set, set_eager_effects, source } from './sources.js';\nimport { get_error } from '../../shared/dev.js';\nimport { async_mode_flag, tracing_mode_flag } from '../../flags/index.js';\nimport { component_context } from '../context.js';\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { batch_values, current_batch, previous_batch } from './batch.js';\nimport { increment_pending, unset_context } from './async.js';\nimport { deferred, includes, noop } from '../../shared/utils.js';\nimport { set_signal_status, update_derived_status } from './status.js';\n\n/**\n * This allows us to track 'reactivity loss' that occurs when signals\n * are read after a non-context-restoring `await`. Dev-only\n * @type {{ effect: Effect, effect_deps: Set<Value>, warned: boolean } | null}\n */\nexport let reactivity_loss_tracker = null;\n\n/** @param {{ effect: Effect, effect_deps: Set<Value>, warned: boolean } | null} v */\nexport function set_reactivity_loss_tracker(v) {\n\treactivity_loss_tracker = v;\n}\n\nexport const recent_async_deriveds = new Set();\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function derived(fn) {\n\tvar flags = DERIVED | DIRTY;\n\n\tif (active_effect !== null) {\n\t\t// Since deriveds are evaluated lazily, any effects created inside them are\n\t\t// created too late to ensure that the parent effect is added to the tree\n\t\tactive_effect.f |= EFFECT_PRESERVED;\n\t}\n\n\t/** @type {Derived<V>} */\n\tconst signal = {\n\t\tctx: component_context,\n\t\tdeps: null,\n\t\teffects: null,\n\t\tequals,\n\t\tf: flags,\n\t\tfn,\n\t\treactions: null,\n\t\trv: 0,\n\t\tv: /** @type {V} */ (UNINITIALIZED),\n\t\twv: 0,\n\t\tparent: active_effect,\n\t\tac: null\n\t};\n\n\tif (DEV && tracing_mode_flag) {\n\t\tsignal.created = get_error('created at');\n\t}\n\n\treturn signal;\n}\n\nexport const OBSOLETE = Symbol('obsolete');\n\n/**\n * @template V\n * @param {() => V | Promise<V>} fn\n * @param {string} [label]\n * @param {string} [location] If provided, print a warning if the value is not read immediately after update\n * @returns {Promise<Source<V>>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function async_derived(fn, label, location) {\n\tlet parent = /** @type {Effect | null} */ (active_effect);\n\n\tif (parent === null) {\n\t\te.async_derived_orphan();\n\t}\n\n\tvar promise = /** @type {Promise<V>} */ (/** @type {unknown} */ (undefined));\n\tvar signal = source(/** @type {V} */ (UNINITIALIZED));\n\n\tif (DEV) signal.label = label ?? fn.toString();\n\n\t// only suspend in async deriveds created on initialisation\n\tvar should_suspend = !active_reaction;\n\n\t/** @type {Set<ReturnType<typeof deferred<V>>>} */\n\tvar deferreds = new Set();\n\n\tasync_effect(() => {\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\tif (DEV) {\n\t\t\treactivity_loss_tracker = { effect, effect_deps: new Set(), warned: false };\n\t\t}\n\n\t\t/** @type {ReturnType<typeof deferred<V>>} */\n\t\tvar d = deferred();\n\t\tpromise = d.promise;\n\n\t\ttry {\n\t\t\t// If this code is changed at some point, make sure to still access the then property\n\t\t\t// of fn() to read any signals it might access, so that we track them as dependencies.\n\t\t\t// We call `unset_context` to undo any `save` calls that happen inside `fn()`\n\t\t\tPromise.resolve(fn())\n\t\t\t\t.then(d.resolve, (e) => {\n\t\t\t\t\t// if the promise was rejected by the user, via `getAbortSignal`, then\n\t\t\t\t\t// wait for a subsequent resolution instead of flushing the batch\n\t\t\t\t\tif (e !== STALE_REACTION) d.reject(e);\n\t\t\t\t})\n\t\t\t\t.finally(unset_context);\n\t\t} catch (error) {\n\t\t\td.reject(error);\n\t\t\tunset_context();\n\t\t}\n\n\t\tif (DEV) {\n\t\t\tif (reactivity_loss_tracker) {\n\t\t\t\t// Reused deps from previous run (indices 0 to skipped_deps-1)\n\t\t\t\t// We deliberately only track direct dependencies of the async expression to encourage\n\t\t\t\t// dependencies being directly visible at the point of the expression\n\t\t\t\tif (effect.deps !== null) {\n\t\t\t\t\tfor (let i = 0; i < skipped_deps; i += 1) {\n\t\t\t\t\t\treactivity_loss_tracker.effect_deps.add(effect.deps[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// New deps discovered this run\n\t\t\t\tif (new_deps !== null) {\n\t\t\t\t\tfor (let i = 0; i < new_deps.length; i += 1) {\n\t\t\t\t\t\treactivity_loss_tracker.effect_deps.add(new_deps[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treactivity_loss_tracker = null;\n\t\t}\n\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\n\t\tif (should_suspend) {\n\t\t\t// we only increment the batch's pending state for updates, not creation, otherwise\n\t\t\t// we will decrement to zero before the work that depends on this promise (e.g. a\n\t\t\t// template effect) has initialized, causing the batch to resolve prematurely\n\t\t\tif ((effect.f & REACTION_RAN) !== 0) {\n\t\t\t\tvar decrement_pending = increment_pending();\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t// boundary can be null if the async derived is inside an $effect.root not connected to the component render tree\n\t\t\t\tparent.b?.is_rendered()\n\t\t\t) {\n\t\t\t\tbatch.async_deriveds.get(effect)?.reject(OBSOLETE);\n\t\t\t} else {\n\t\t\t\t// While the boundary is still showing pending, a new run supersedes all older in-flight runs\n\t\t\t\t// for this async expression. Cancel eagerly so resolution cannot commit stale values.\n\t\t\t\tfor (const d of deferreds.values()) {\n\t\t\t\t\td.reject(OBSOLETE);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdeferreds.add(d);\n\t\t\tbatch.async_deriveds.set(effect, d);\n\t\t}\n\n\t\t/**\n\t\t * @param {any} value\n\t\t * @param {unknown} error\n\t\t */\n\t\tconst handler = (value, error = undefined) => {\n\t\t\tif (DEV) {\n\t\t\t\treactivity_loss_tracker = null;\n\t\t\t}\n\n\t\t\tdecrement_pending?.();\n\t\t\tdeferreds.delete(d);\n\n\t\t\tif (error === OBSOLETE) return;\n\n\t\t\tbatch.activate();\n\n\t\t\tif (error) {\n\t\t\t\tsignal.f |= ERROR_VALUE;\n\n\t\t\t\t// @ts-expect-error the error is the wrong type, but we don't care\n\t\t\t\tinternal_set(signal, error);\n\t\t\t} else {\n\t\t\t\tif ((signal.f & ERROR_VALUE) !== 0) {\n\t\t\t\t\tsignal.f ^= ERROR_VALUE;\n\t\t\t\t}\n\n\t\t\t\tif (DEV && location !== undefined && !signal.equals(value)) {\n\t\t\t\t\trecent_async_deriveds.add(signal);\n\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (recent_async_deriveds.has(signal) && (effect.f & DESTROYED) === 0) {\n\t\t\t\t\t\t\tw.await_waterfall(/** @type {string} */ (signal.label), location);\n\t\t\t\t\t\t\trecent_async_deriveds.delete(signal);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tinternal_set(signal, value);\n\t\t\t}\n\n\t\t\tbatch.deactivate();\n\t\t};\n\n\t\td.promise.then(handler, (e) => handler(null, e || 'unknown'));\n\t});\n\n\tteardown(() => {\n\t\tfor (const d of deferreds) {\n\t\t\td.reject(OBSOLETE);\n\t\t}\n\t});\n\n\tif (DEV) {\n\t\t// add a flag that lets this be printed as a derived\n\t\t// when using `$inspect.trace()`\n\t\tsignal.f |= ASYNC;\n\t}\n\n\treturn new Promise((fulfil) => {\n\t\t/** @param {Promise<V>} p */\n\t\tfunction next(p) {\n\t\t\tfunction go() {\n\t\t\t\tif (p === promise) {\n\t\t\t\t\tfulfil(signal);\n\t\t\t\t} else {\n\t\t\t\t\t// if the effect re-runs before the initial promise\n\t\t\t\t\t// resolves, delay resolution until we have a value\n\t\t\t\t\tnext(promise);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tp.then(go, go);\n\t\t}\n\n\t\tnext(promise);\n\t});\n}\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function user_derived(fn) {\n\tconst d = derived(fn);\n\n\tif (!async_mode_flag) push_reaction_value(d);\n\n\treturn d;\n}\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function derived_safe_equal(fn) {\n\tconst signal = derived(fn);\n\tsignal.equals = safe_equals;\n\treturn signal;\n}\n\n/**\n * @param {Derived} derived\n * @returns {void}\n */\nexport function destroy_derived_effects(derived) {\n\tvar effects = derived.effects;\n\n\tif (effects !== null) {\n\t\tderived.effects = null;\n\n\t\tfor (var i = 0; i < effects.length; i += 1) {\n\t\t\tdestroy_effect(/** @type {Effect} */ (effects[i]));\n\t\t}\n\t}\n}\n\n/**\n * The currently updating deriveds, used to detect infinite recursion\n * in dev mode and provide a nicer error than 'too much recursion'\n * @type {Derived[]}\n */\nlet stack = [];\n\n/**\n * @template T\n * @param {Derived} derived\n * @returns {T}\n */\nexport function execute_derived(derived) {\n\tvar value;\n\tvar prev_active_effect = active_effect;\n\tvar parent = derived.parent;\n\n\tif (\n\t\t!is_destroying_effect &&\n\t\tparent !== null &&\n\t\tderived.v !== UNINITIALIZED && // if it was never evaluated before, it's guaranteed to fail downstream, so we try to execute instead\n\t\t(parent.f & (DESTROYED | INERT)) !== 0\n\t) {\n\t\tw.derived_inert();\n\n\t\treturn derived.v;\n\t}\n\n\tset_active_effect(parent);\n\n\tif (DEV) {\n\t\tlet prev_eager_effects = eager_effects;\n\t\tset_eager_effects(new Set());\n\t\ttry {\n\t\t\tif (includes.call(stack, derived)) {\n\t\t\t\te.derived_references_self();\n\t\t\t}\n\n\t\t\tstack.push(derived);\n\n\t\t\tderived.f &= ~WAS_MARKED;\n\t\t\tdestroy_derived_effects(derived);\n\t\t\tvalue = update_reaction(derived);\n\t\t} finally {\n\t\t\tset_active_effect(prev_active_effect);\n\t\t\tset_eager_effects(prev_eager_effects);\n\t\t\tstack.pop();\n\t\t}\n\t} else {\n\t\ttry {\n\t\t\tderived.f &= ~WAS_MARKED;\n\t\t\tdestroy_derived_effects(derived);\n\t\t\tvalue = update_reaction(derived);\n\t\t} finally {\n\t\t\tset_active_effect(prev_active_effect);\n\t\t}\n\t}\n\n\treturn value;\n}\n\n/**\n * @param {Derived} derived\n * @returns {void}\n */\nexport function update_derived(derived) {\n\tvar value = execute_derived(derived);\n\n\tif (!derived.equals(value)) {\n\t\tderived.wv = increment_write_version();\n\n\t\t// in a fork, we don't update the underlying value, just `batch_values`.\n\t\t// the underlying value will be updated when the fork is committed.\n\t\t// otherwise, the next time we get here after a 'real world' state\n\t\t// change, `derived.equals` may incorrectly return `true`\n\t\tif (!current_batch?.is_fork || derived.deps === null) {\n\t\t\tif (current_batch !== null) {\n\t\t\t\t// We also write to previous_batch because if it exists, it is a sign that we're\n\t\t\t\t// currently in the process of flushing effects. These updates to deriveds may belong\n\t\t\t\t// to the previous batch, not the new one (which can already exist if an earlier\n\t\t\t\t// effect wrote to a source). This can cause bugs when running batch.#commit() later,\n\t\t\t\t// but not adding it to current_batch can, too, so we add it to both.\n\t\t\t\t// See https://github.com/sveltejs/svelte/pull/18117 for more details.\n\t\t\t\tcurrent_batch.capture(derived, value, true);\n\t\t\t\tprevious_batch?.capture(derived, value, true);\n\t\t\t} else {\n\t\t\t\tderived.v = value;\n\t\t\t}\n\n\t\t\t// deriveds without dependencies should never be recomputed\n\t\t\tif (derived.deps === null) {\n\t\t\t\tset_signal_status(derived, CLEAN);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\t// don't mark derived clean if we're reading it inside a\n\t// cleanup function, or it will cache a stale value\n\tif (is_destroying_effect) {\n\t\treturn;\n\t}\n\n\t// During time traveling we don't want to reset the status so that\n\t// traversal of the graph in the other batches still happens\n\tif (batch_values !== null) {\n\t\t// only cache the value if we're in a tracking context, otherwise we won't\n\t\t// clear the cache in `mark_reactions` when dependencies are updated\n\t\tif (effect_tracking() || current_batch?.is_fork) {\n\t\t\tbatch_values.set(derived, value);\n\t\t}\n\t} else {\n\t\tupdate_derived_status(derived);\n\t}\n}\n\n/**\n * @param {Derived} derived\n */\nexport function freeze_derived_effects(derived) {\n\tif (derived.effects === null) return;\n\n\tfor (const e of derived.effects) {\n\t\t// if the effect has a teardown function or abort signal, call it\n\t\tif (e.teardown || e.ac) {\n\t\t\te.teardown?.();\n\t\t\tif (e.ac !== null) {\n\t\t\t\twithout_reactive_context(() => {\n\t\t\t\t\t/** @type {AbortController} */ (e.ac).abort(STALE_REACTION);\n\t\t\t\t\te.ac = null;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// make it a noop so it doesn't get called again if the derived\n\t\t\t// is unfrozen. we don't set it to `null`, because the existence\n\t\t\t// of a teardown function is what determines whether the\n\t\t\t// effect runs again during unfreezing (but not for teardown-only effects)\n\t\t\tif (e.fn !== null) e.teardown = noop;\n\n\t\t\tremove_reactions(e, 0);\n\t\t\tdestroy_effect_children(e);\n\t\t}\n\t}\n}\n\n/**\n * @param {Derived} derived\n */\nexport function unfreeze_derived_effects(derived) {\n\tif (derived.effects === null) return;\n\n\tfor (const e of derived.effects) {\n\t\t// if the effect was previously frozen — indicated by the presence\n\t\t// of a teardown function — unfreeze it\n\t\tif (e.teardown && e.fn !== null) {\n\t\t\tupdate_effect(e);\n\t\t}\n\t}\n}\n","/** @import { Fork } from 'svelte' */\n/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */\nimport {\n\tBLOCK_EFFECT,\n\tBRANCH_EFFECT,\n\tCLEAN,\n\tDESTROYED,\n\tDIRTY,\n\tEFFECT,\n\tASYNC,\n\tINERT,\n\tRENDER_EFFECT,\n\tROOT_EFFECT,\n\tMAYBE_DIRTY,\n\tDERIVED,\n\tEAGER_EFFECT,\n\tERROR_VALUE,\n\tMANAGED_EFFECT,\n\tREACTION_RAN,\n\tDESTROYING\n} from '#client/constants';\nimport { async_mode_flag } from '../../flags/index.js';\nimport { deferred, define_property, includes } from '../../shared/utils.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tincrement_write_version,\n\tis_dirty,\n\tupdate_effect\n} from '../runtime.js';\nimport * as e from '../errors.js';\nimport { flush_tasks, queue_micro_task } from '../dom/task.js';\nimport { DEV } from 'esm-env';\nimport { invoke_error_boundary } from '../error-handling.js';\nimport { flush_eager_effects, old_values, set_eager_effects, source, update } from './sources.js';\nimport { eager_effect, teardown, unlink_effect } from './effects.js';\nimport { defer_effect } from './utils.js';\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { set_signal_status } from './status.js';\nimport { legacy_is_updating_store } from './store.js';\nimport { invariant } from '../../shared/dev.js';\nimport { log_effect_tree } from '../dev/debug.js';\nimport { OBSOLETE } from './deriveds.js';\n\n/** @type {Batch | null} */\nlet first_batch = null;\n\n/** @type {Batch | null} */\nlet last_batch = null;\n\n/** @type {Batch | null} */\nexport let current_batch = null;\n\n/**\n * This is needed to avoid overwriting inputs\n * @type {Batch | null}\n */\nexport let previous_batch = null;\n\n/**\n * When time travelling (i.e. working in one batch, while other batches\n * still have ongoing work), we ignore the real values of affected\n * signals in favour of their values within the batch\n * @type {Map<Value, any> | null}\n */\nexport let batch_values = null;\n\n/** @type {Effect | null} */\nlet last_scheduled_effect = null;\n\nexport let is_flushing_sync = false;\nlet is_processing = false;\n\n/**\n * During traversal, this is an array. Newly created effects are (if not immediately\n * executed) pushed to this array, rather than going through the scheduling\n * rigamarole that would cause another turn of the flush loop.\n * @type {Effect[] | null}\n */\nexport let collected_effects = null;\n\n/**\n * An array of effects that are marked during traversal as a result of a `set`\n * (not `internal_set`) call. These will be added to the next batch and\n * trigger another `batch.process()`\n * @type {Effect[] | null}\n * @deprecated when we get rid of legacy mode and stores, we can get rid of this\n */\nexport let legacy_updates = null;\n\nvar flush_count = 0;\n\n/** @type {Set<Value>} */\nvar source_stacks = new Set();\n\nlet uid = 1;\n\nexport class Batch {\n\tid = uid++;\n\n\t/** True as soon as `#process` was called */\n\t#started = false;\n\n\tlinked = true;\n\n\t/** @type {Batch | null} */\n\t#prev = null;\n\n\t/** @type {Batch | null} */\n\t#next = null;\n\n\t/** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */\n\tasync_deriveds = new Map();\n\n\t/**\n\t * The current values of any signals that are updated in this batch.\n\t * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)\n\t * They keys of this map are identical to `this.#previous`\n\t * @type {Map<Value, [any, boolean]>}\n\t */\n\tcurrent = new Map();\n\n\t/**\n\t * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.\n\t * They keys of this map are identical to `this.#current`\n\t * @type {Map<Value, any>}\n\t */\n\tprevious = new Map();\n\n\t/**\n\t * When the batch is committed (and the DOM is updated), we need to remove old branches\n\t * and append new ones by calling the functions added inside (if/each/key/etc) blocks\n\t * @type {Set<(batch: Batch) => void>}\n\t */\n\t#commit_callbacks = new Set();\n\n\t/**\n\t * If a fork is discarded, we need to destroy any effects that are no longer needed\n\t * @type {Set<(batch: Batch) => void>}\n\t */\n\t#discard_callbacks = new Set();\n\n\t/**\n\t * The number of async effects that are currently in flight\n\t */\n\t#pending = 0;\n\n\t/**\n\t * Async effects that are currently in flight, _not_ inside a pending boundary\n\t * @type {Map<Effect, number>}\n\t */\n\t#blocking_pending = new Map();\n\n\t/**\n\t * A deferred that resolves when the batch is committed, used with `settled()`\n\t * TODO replace with Promise.withResolvers once supported widely enough\n\t * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}\n\t */\n\t#deferred = null;\n\n\t/**\n\t * The root effects that need to be flushed\n\t * @type {Effect[]}\n\t */\n\t#roots = [];\n\n\t/**\n\t * Effects created while this batch was active.\n\t * @type {Effect[]}\n\t */\n\t#new_effects = [];\n\n\t/**\n\t * Deferred effects (which run after async work has completed) that are DIRTY\n\t * @type {Set<Effect>}\n\t */\n\t#dirty_effects = new Set();\n\n\t/**\n\t * Deferred effects that are MAYBE_DIRTY\n\t * @type {Set<Effect>}\n\t */\n\t#maybe_dirty_effects = new Set();\n\n\t/**\n\t * A map of branches that still exist, but will be destroyed when this batch\n\t * is committed — we skip over these during `process`.\n\t * The value contains child effects that were dirty/maybe_dirty before being reset,\n\t * so they can be rescheduled if the branch survives.\n\t * @type {Map<Effect, { d: Effect[], m: Effect[] }>}\n\t */\n\t#skipped_branches = new Map();\n\n\t/**\n\t * Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing\n\t * @type {Set<Effect>}\n\t */\n\t#unskipped_branches = new Set();\n\n\tis_fork = false;\n\n\t#decrement_queued = false;\n\n\tconstructor() {\n\t\t// link batch\n\t\tif (last_batch === null) {\n\t\t\tfirst_batch = last_batch = this;\n\t\t} else {\n\t\t\tlast_batch.#next = this;\n\t\t\tthis.#prev = last_batch;\n\t\t}\n\n\t\tlast_batch = this;\n\t}\n\n\t#is_deferred() {\n\t\tif (this.is_fork) return true;\n\n\t\tfor (const effect of this.#blocking_pending.keys()) {\n\t\t\tvar e = effect;\n\t\t\tvar skipped = false;\n\n\t\t\twhile (e.parent !== null) {\n\t\t\t\tif (this.#skipped_branches.has(e)) {\n\t\t\t\t\tskipped = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\te = e.parent;\n\t\t\t}\n\n\t\t\tif (!skipped) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Add an effect to the #skipped_branches map and reset its children\n\t * @param {Effect} effect\n\t */\n\tskip_effect(effect) {\n\t\tif (!this.#skipped_branches.has(effect)) {\n\t\t\tthis.#skipped_branches.set(effect, { d: [], m: [] });\n\t\t}\n\t\tthis.#unskipped_branches.delete(effect);\n\t}\n\n\t/**\n\t * Remove an effect from the #skipped_branches map and reschedule\n\t * any tracked dirty/maybe_dirty child effects\n\t * @param {Effect} effect\n\t * @param {(e: Effect) => void} callback\n\t */\n\tunskip_effect(effect, callback = (e) => this.schedule(e)) {\n\t\tvar tracked = this.#skipped_branches.get(effect);\n\t\tif (tracked) {\n\t\t\tthis.#skipped_branches.delete(effect);\n\n\t\t\tfor (var e of tracked.d) {\n\t\t\t\tset_signal_status(e, DIRTY);\n\t\t\t\tcallback(e);\n\t\t\t}\n\n\t\t\tfor (e of tracked.m) {\n\t\t\t\tset_signal_status(e, MAYBE_DIRTY);\n\t\t\t\tcallback(e);\n\t\t\t}\n\t\t}\n\t\tthis.#unskipped_branches.add(effect);\n\t}\n\n\t#process() {\n\t\tthis.#started = true;\n\n\t\tif (flush_count++ > 1000) {\n\t\t\tthis.#unlink();\n\t\t\tinfinite_loop_guard();\n\t\t}\n\n\t\tif (DEV) {\n\t\t\t// track all the values that were updated during this flush,\n\t\t\t// so that they can be reset afterwards\n\t\t\tfor (const value of this.current.keys()) {\n\t\t\t\tsource_stacks.add(value);\n\t\t\t}\n\t\t}\n\n\t\t// We always reschedule previously-deferred effects, not just when\n\t\t// #is_deferred() is true, because traversing the tree could make\n\t\t// an if block that contains the last blocking pending effect falsy,\n\t\t// causing the block to no longer be deferred.\n\t\tfor (const e of this.#dirty_effects) {\n\t\t\tthis.#maybe_dirty_effects.delete(e);\n\t\t\tset_signal_status(e, DIRTY);\n\t\t\tthis.schedule(e);\n\t\t}\n\n\t\tfor (const e of this.#maybe_dirty_effects) {\n\t\t\tset_signal_status(e, MAYBE_DIRTY);\n\t\t\tthis.schedule(e);\n\t\t}\n\n\t\tconst roots = this.#roots;\n\t\tthis.#roots = [];\n\n\t\tthis.apply();\n\n\t\t/** @type {Effect[]} */\n\t\tvar effects = (collected_effects = []);\n\n\t\t/** @type {Effect[]} */\n\t\tvar render_effects = [];\n\n\t\t/**\n\t\t * @type {Effect[]}\n\t\t * @deprecated when we get rid of legacy mode and stores, we can get rid of this\n\t\t */\n\t\tvar updates = (legacy_updates = []);\n\n\t\tfor (const root of roots) {\n\t\t\ttry {\n\t\t\t\tthis.#traverse(root, effects, render_effects);\n\t\t\t} catch (e) {\n\t\t\t\treset_all(root);\n\t\t\t\t// If there's no async work left, this branch is now dead and needs\n\t\t\t\t// to be discarded to not become a zombie that is never cleaned up.\n\t\t\t\t// See https://github.com/sveltejs/svelte/issues/18221#issuecomment-4497918414\n\t\t\t\t// for a (non-minimal) reproduction that demonstrates a case where this is necessary\n\t\t\t\t// to not get follow-up false-positives via \"batch has scheduled roots\" invariant errors.\n\t\t\t\tif (!this.#is_deferred()) this.discard();\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\n\t\t// any writes should take effect in a subsequent batch\n\t\tcurrent_batch = null;\n\n\t\tif (updates.length > 0) {\n\t\t\tvar batch = Batch.ensure();\n\t\t\tfor (const e of updates) {\n\t\t\t\tbatch.schedule(e);\n\t\t\t}\n\t\t}\n\n\t\tcollected_effects = null;\n\t\tlegacy_updates = null;\n\n\t\t// if the batch has outstanding pending work, stash effects and bail\n\t\tif (this.#is_deferred()) {\n\t\t\tthis.#defer_effects(render_effects);\n\t\t\tthis.#defer_effects(effects);\n\n\t\t\tfor (const [e, t] of this.#skipped_branches) {\n\t\t\t\treset_branch(e, t);\n\t\t\t}\n\n\t\t\tif (updates.length > 0) {\n\t\t\t\t/** @type {Batch} */ (/** @type {unknown} */ (current_batch)).#process();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst earlier_batch = this.#find_earlier_batch();\n\n\t\tif (earlier_batch) {\n\t\t\t// If this batch collected deferred effects during traversal, they still need\n\t\t\t// to run after being merged into the earlier batch.\n\t\t\tthis.#defer_effects(render_effects);\n\t\t\tthis.#defer_effects(effects);\n\t\t\tearlier_batch.#merge(this);\n\t\t\treturn;\n\t\t}\n\n\t\t// clear effects. Those that are still needed will be rescheduled through unskipping the skipped branches.\n\t\tthis.#dirty_effects.clear();\n\t\tthis.#maybe_dirty_effects.clear();\n\n\t\t// append/remove branches\n\t\tfor (const fn of this.#commit_callbacks) fn(this);\n\t\tthis.#commit_callbacks.clear();\n\n\t\tprevious_batch = this;\n\t\tflush_queued_effects(render_effects);\n\t\tflush_queued_effects(effects);\n\t\tprevious_batch = null;\n\n\t\tthis.#deferred?.resolve();\n\n\t\tvar next_batch = /** @type {Batch | null} */ (/** @type {unknown} */ (current_batch));\n\n\t\tif (this.#pending === 0 && (this.#roots.length === 0 || next_batch !== null)) {\n\t\t\tthis.#unlink();\n\n\t\t\t// Order matters here - we need to commit and THEN continue flushing new batches, not the other way around,\n\t\t\t// else we could start flushing a new batch and then, if it has pending work, rebase it right afterwards, which is wrong.\n\t\t\t// In sync mode flushSync can cause #commit to wrongfully think that there needs to be a rebase, so we only do it in async mode\n\t\t\t// TODO fix the underlying cause, otherwise this will likely regress when non-async mode is removed\n\t\t\tif (async_mode_flag) {\n\t\t\t\tthis.#commit();\n\t\t\t\t// Rebases can activate other batches or null it out, therefore restore the new one here\n\t\t\t\tcurrent_batch = next_batch;\n\t\t\t}\n\t\t}\n\n\t\t// Edge case: During traversal new branches might create effects that run immediately and set state,\n\t\t// causing an effect and therefore a root to be scheduled again. We need to traverse the current batch\n\t\t// once more in that case - most of the time this will just clean up dirty branches.\n\t\tif (this.#roots.length > 0) {\n\t\t\tif (next_batch !== null) {\n\t\t\t\tconst batch = next_batch;\n\t\t\t\tbatch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r)));\n\t\t\t} else {\n\t\t\t\tnext_batch = this;\n\t\t\t}\n\t\t}\n\n\t\tif (next_batch !== null) {\n\t\t\told_values.clear();\n\t\t\tnext_batch.#process();\n\t\t}\n\t}\n\n\t/**\n\t * Traverse the effect tree, executing effects or stashing\n\t * them for later execution as appropriate\n\t * @param {Effect} root\n\t * @param {Effect[]} effects\n\t * @param {Effect[]} render_effects\n\t */\n\t#traverse(root, effects, render_effects) {\n\t\troot.f ^= CLEAN;\n\n\t\tvar effect = root.first;\n\n\t\twhile (effect !== null) {\n\t\t\tvar flags = effect.f;\n\t\t\tvar is_branch = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;\n\t\t\tvar is_skippable_branch = is_branch && (flags & CLEAN) !== 0;\n\n\t\t\tvar skip = is_skippable_branch || (flags & INERT) !== 0 || this.#skipped_branches.has(effect);\n\n\t\t\tif (!skip && effect.fn !== null) {\n\t\t\t\tif (is_branch) {\n\t\t\t\t\teffect.f ^= CLEAN;\n\t\t\t\t} else if ((flags & EFFECT) !== 0) {\n\t\t\t\t\teffects.push(effect);\n\t\t\t\t} else if (async_mode_flag && (flags & (RENDER_EFFECT | MANAGED_EFFECT)) !== 0) {\n\t\t\t\t\trender_effects.push(effect);\n\t\t\t\t} else if (is_dirty(effect)) {\n\t\t\t\t\tif ((flags & BLOCK_EFFECT) !== 0) this.#maybe_dirty_effects.add(effect);\n\t\t\t\t\tupdate_effect(effect);\n\t\t\t\t}\n\n\t\t\t\tvar child = effect.first;\n\n\t\t\t\tif (child !== null) {\n\t\t\t\t\teffect = child;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twhile (effect !== null) {\n\t\t\t\tvar next = effect.next;\n\n\t\t\t\tif (next !== null) {\n\t\t\t\t\teffect = next;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\teffect = effect.parent;\n\t\t\t}\n\t\t}\n\t}\n\n\t#find_earlier_batch() {\n\t\tvar batch = this.#prev;\n\n\t\twhile (batch !== null) {\n\t\t\tif (!batch.is_fork) {\n\t\t\t\t// if the batches are connected, break\n\t\t\t\tfor (const [value, [, is_derived]] of this.current) {\n\t\t\t\t\tif (batch.current.has(value) && !is_derived) {\n\t\t\t\t\t\treturn batch;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbatch = batch.#prev;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#merge(batch) {\n\t\tfor (const [source, value] of batch.current) {\n\t\t\tif (!this.previous.has(source) && batch.previous.has(source)) {\n\t\t\t\tthis.previous.set(source, batch.previous.get(source));\n\t\t\t}\n\n\t\t\tthis.current.set(source, value);\n\t\t}\n\n\t\tfor (const [effect, deferred] of batch.async_deriveds) {\n\t\t\tconst d = this.async_deriveds.get(effect);\n\t\t\tif (d) deferred.promise.then(d.resolve).catch(d.reject);\n\t\t}\n\n\t\t// Clear them or else those that are still pending might get rejected on discard (after merged-into batch is done).\n\t\t// This can happen when batch Y merged into X and Y has a pending boundary and therefore still-pending async deriveds inside.\n\t\tbatch.async_deriveds.clear();\n\n\t\t// Mark is not guaranteed not touch these, so we transfer them\n\t\tthis.transfer_effects(batch.#dirty_effects, batch.#maybe_dirty_effects);\n\n\t\t/**\n\t\t * mark all effects that depend on `batch.current`, except the\n\t\t * async effects that we just resolved (TODO unless they depend\n\t\t * on values in this batch that are NOT in the later batch?).\n\t\t * Through this we also will populate the correct #skipped_branches,\n\t\t * oncommit callbacks etc, so we don't need to merge them separately.\n\t\t * @param {Value} value\n\t\t */\n\t\tconst mark = (value) => {\n\t\t\tvar reactions = value.reactions;\n\t\t\tif (reactions === null) return;\n\t\t\t// skip if value is derived and is neither dirty nor maybe dirty. transitive\n\t\t\t// deriveds (a derived depending on another derived) are only MAYBE_DIRTY, so\n\t\t\t// we must continue traversing them to reach the effects that depend on them\n\t\t\tif ((value.f & DERIVED) !== 0 && (value.f & (DIRTY | MAYBE_DIRTY)) === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfor (const reaction of reactions) {\n\t\t\t\tvar flags = reaction.f;\n\n\t\t\t\tif ((flags & DERIVED) !== 0) {\n\t\t\t\t\tmark(/** @type {Derived} */ (reaction));\n\t\t\t\t} else {\n\t\t\t\t\tvar effect = /** @type {Effect} */ (reaction);\n\n\t\t\t\t\tif (flags & (ASYNC | BLOCK_EFFECT) && !this.async_deriveds.has(effect)) {\n\t\t\t\t\t\tthis.#maybe_dirty_effects.delete(effect);\n\t\t\t\t\t\tset_signal_status(effect, DIRTY);\n\t\t\t\t\t\tthis.schedule(effect);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tfor (const source of this.current.keys()) {\n\t\t\tmark(source);\n\t\t}\n\n\t\tthis.oncommit(() => batch.discard());\n\t\tbatch.#unlink();\n\n\t\tcurrent_batch = this;\n\t\tthis.#process();\n\t}\n\n\t/**\n\t * @param {Effect[]} effects\n\t */\n\t#defer_effects(effects) {\n\t\tfor (var i = 0; i < effects.length; i += 1) {\n\t\t\tdefer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);\n\t\t}\n\t}\n\n\t/**\n\t * Associate a change to a given source with the current\n\t * batch, noting its previous and current values\n\t * @param {Value} source\n\t * @param {any} value\n\t * @param {boolean} [is_derived]\n\t */\n\tcapture(source, value, is_derived = false) {\n\t\tif (source.v !== UNINITIALIZED && !this.previous.has(source)) {\n\t\t\tthis.previous.set(source, source.v);\n\t\t}\n\n\t\t// Don't save errors in `batch_values`, or they won't be thrown in `runtime.js#get`\n\t\tif ((source.f & ERROR_VALUE) === 0) {\n\t\t\tthis.current.set(source, [value, is_derived]);\n\t\t\tbatch_values?.set(source, value);\n\t\t}\n\n\t\tif (!this.is_fork) {\n\t\t\tsource.v = value;\n\t\t}\n\t}\n\n\tactivate() {\n\t\tcurrent_batch = this;\n\t}\n\n\tdeactivate() {\n\t\tcurrent_batch = null;\n\t\tbatch_values = null;\n\t}\n\n\tflush() {\n\t\ttry {\n\t\t\tif (DEV) {\n\t\t\t\tsource_stacks.clear();\n\t\t\t}\n\n\t\t\tis_processing = true;\n\t\t\tcurrent_batch = this;\n\n\t\t\tthis.#process();\n\t\t} finally {\n\t\t\tflush_count = 0;\n\t\t\tlast_scheduled_effect = null;\n\t\t\tcollected_effects = null;\n\t\t\tlegacy_updates = null;\n\t\t\tis_processing = false;\n\n\t\t\tcurrent_batch = null;\n\t\t\tbatch_values = null;\n\n\t\t\told_values.clear();\n\n\t\t\tif (DEV) {\n\t\t\t\tfor (const source of source_stacks) {\n\t\t\t\t\tsource.updated = null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tdiscard() {\n\t\tfor (const fn of this.#discard_callbacks) fn(this);\n\t\tthis.#discard_callbacks.clear();\n\n\t\tfor (const deferred of this.async_deriveds.values()) {\n\t\t\tdeferred.reject(OBSOLETE);\n\t\t}\n\n\t\tthis.#unlink();\n\t\tthis.#deferred?.resolve();\n\t}\n\n\t/**\n\t * @param {Effect} effect\n\t */\n\tregister_created_effect(effect) {\n\t\tthis.#new_effects.push(effect);\n\t}\n\n\t#commit() {\n\t\t// If there are other pending batches, they now need to be 'rebased' —\n\t\t// in other words, we re-run block/async effects with the newly\n\t\t// committed state, unless the batch in question has a more\n\t\t// recent value for a given source\n\t\tfor (let batch = first_batch; batch !== null; batch = batch.#next) {\n\t\t\tvar is_earlier = batch.id < this.id;\n\n\t\t\t/** @type {Source[]} */\n\t\t\tvar sources = [];\n\n\t\t\tfor (const [source, [value, is_derived]] of this.current) {\n\t\t\t\tif (batch.current.has(source)) {\n\t\t\t\t\tvar batch_value = /** @type {[any, boolean]} */ (batch.current.get(source))[0]; // faster than destructuring\n\n\t\t\t\t\tif (is_earlier && value !== batch_value) {\n\t\t\t\t\t\t// bring the value up to date\n\t\t\t\t\t\tbatch.current.set(source, [value, is_derived]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// same value or later batch has more recent value,\n\t\t\t\t\t\t// no need to re-run these effects\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsources.push(source);\n\t\t\t}\n\n\t\t\tif (is_earlier) {\n\t\t\t\t// TODO do we need to restart these in some cases, instead of\n\t\t\t\t// immediately resolving them? Likely not because of how this.apply() works.\n\t\t\t\tfor (const [effect, deferred] of this.async_deriveds) {\n\t\t\t\t\tconst d = batch.async_deriveds.get(effect);\n\t\t\t\t\tif (d) deferred.promise.then(d.resolve).catch(d.reject);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar current = [...batch.current.keys()].filter(\n\t\t\t\t(source) => !(/** @type {[any, boolean]} */ (batch.current.get(source))[1])\n\t\t\t);\n\n\t\t\t// If not started yet or no sources to update (which is e.g. possible for the very first batch) then bail\n\t\t\tif (!batch.#started || current.length === 0) continue;\n\n\t\t\t// Re-run async/block effects that depend on distinct values changed in both batches (ignoring deriveds)\n\t\t\tvar others = current.filter((source) => !this.current.has(source));\n\n\t\t\tif (others.length === 0) {\n\t\t\t\tif (is_earlier) {\n\t\t\t\t\t// this batch is now obsolete and can be discarded\n\t\t\t\t\tbatch.discard();\n\t\t\t\t}\n\t\t\t} else if (sources.length > 0) {\n\t\t\t\t// The microtask queue can contain the batch already scheduled to run right\n\t\t\t\t// after this one is finished, so throwing the invariant would be wrong here.\n\t\t\t\tif (DEV && !batch.#decrement_queued) {\n\t\t\t\t\tinvariant(batch.#roots.length === 0, 'Batch has scheduled roots');\n\t\t\t\t}\n\n\t\t\t\t// A batch was unskipped in a later batch -> tell prior batches to unskip it, too\n\t\t\t\tif (is_earlier) {\n\t\t\t\t\tfor (const unskipped of this.#unskipped_branches) {\n\t\t\t\t\t\tbatch.unskip_effect(unskipped, (e) => {\n\t\t\t\t\t\t\tif ((e.f & (BLOCK_EFFECT | ASYNC)) !== 0) {\n\t\t\t\t\t\t\t\tbatch.schedule(e);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tbatch.#defer_effects([e]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbatch.activate();\n\n\t\t\t\t/** @type {Set<Value>} */\n\t\t\t\tvar marked = new Set();\n\n\t\t\t\t/** @type {Map<Reaction, boolean>} */\n\t\t\t\tvar checked = new Map();\n\n\t\t\t\tfor (var source of sources) {\n\t\t\t\t\tmark_effects(source, others, marked, checked);\n\t\t\t\t}\n\n\t\t\t\tchecked = new Map();\n\t\t\t\tvar current_unequal = [...batch.current]\n\t\t\t\t\t.filter(([c, v1]) => {\n\t\t\t\t\t\tconst v2 = this.current.get(c);\n\t\t\t\t\t\tif (!v2) return true;\n\t\t\t\t\t\t// Either their values are different or one is a derived but not the other\n\t\t\t\t\t\treturn v2[0] !== v1[0] || v2[1] !== v1[1];\n\t\t\t\t\t})\n\t\t\t\t\t.map(([c]) => c);\n\n\t\t\t\tif (current_unequal.length > 0) {\n\t\t\t\t\tfor (const effect of this.#new_effects) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t(effect.f & (DESTROYED | INERT | EAGER_EFFECT)) === 0 &&\n\t\t\t\t\t\t\tdepends_on(effect, current_unequal, checked)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tif ((effect.f & (ASYNC | BLOCK_EFFECT)) !== 0) {\n\t\t\t\t\t\t\t\tset_signal_status(effect, DIRTY);\n\t\t\t\t\t\t\t\tbatch.schedule(effect);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tbatch.#dirty_effects.add(effect);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Only apply and traverse when we know we triggered async work with marking the effects\n\t\t\t\t// and know this won't run anyway right afterwards\n\t\t\t\tif (batch.#roots.length > 0 && !batch.#decrement_queued) {\n\t\t\t\t\tbatch.apply();\n\n\t\t\t\t\tfor (var root of batch.#roots) {\n\t\t\t\t\t\tbatch.#traverse(root, [], []);\n\t\t\t\t\t}\n\n\t\t\t\t\tbatch.#roots = [];\n\t\t\t\t}\n\n\t\t\t\tbatch.deactivate();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {boolean} blocking\n\t * @param {Effect} effect\n\t */\n\tincrement(blocking, effect) {\n\t\tthis.#pending += 1;\n\n\t\tif (blocking) {\n\t\t\tlet blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;\n\t\t\tthis.#blocking_pending.set(effect, blocking_pending_count + 1);\n\t\t}\n\t}\n\n\t/**\n\t * @param {boolean} blocking\n\t * @param {Effect} effect\n\t */\n\tdecrement(blocking, effect) {\n\t\tthis.#pending -= 1;\n\n\t\tif (blocking) {\n\t\t\tlet blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;\n\n\t\t\tif (blocking_pending_count === 1) {\n\t\t\t\tthis.#blocking_pending.delete(effect);\n\t\t\t} else {\n\t\t\t\tthis.#blocking_pending.set(effect, blocking_pending_count - 1);\n\t\t\t}\n\t\t}\n\n\t\tif (this.#decrement_queued) return;\n\t\tthis.#decrement_queued = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tthis.#decrement_queued = false;\n\n\t\t\tif (this.linked) {\n\t\t\t\tthis.flush();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * @param {Set<Effect>} dirty_effects\n\t * @param {Set<Effect>} maybe_dirty_effects\n\t */\n\ttransfer_effects(dirty_effects, maybe_dirty_effects) {\n\t\tfor (const e of dirty_effects) {\n\t\t\tthis.#dirty_effects.add(e);\n\t\t}\n\n\t\tfor (const e of maybe_dirty_effects) {\n\t\t\tthis.#maybe_dirty_effects.add(e);\n\t\t}\n\n\t\tdirty_effects.clear();\n\t\tmaybe_dirty_effects.clear();\n\t}\n\n\t/** @param {(batch: Batch) => void} fn */\n\toncommit(fn) {\n\t\tthis.#commit_callbacks.add(fn);\n\t}\n\n\t/** @param {(batch: Batch) => void} fn */\n\tondiscard(fn) {\n\t\tthis.#discard_callbacks.add(fn);\n\t}\n\n\tsettled() {\n\t\treturn (this.#deferred ??= deferred()).promise;\n\t}\n\n\tstatic ensure() {\n\t\tif (current_batch === null) {\n\t\t\tconst batch = (current_batch = new Batch());\n\n\t\t\tif (!is_processing && !is_flushing_sync) {\n\t\t\t\tqueue_micro_task(() => {\n\t\t\t\t\tif (!batch.#started) {\n\t\t\t\t\t\tbatch.flush();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn current_batch;\n\t}\n\n\tapply() {\n\t\tif (!async_mode_flag || (!this.is_fork && this.#prev === null && this.#next === null)) {\n\t\t\tbatch_values = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// if there are multiple batches, we are 'time travelling' —\n\t\t// we need to override values with the ones in this batch...\n\t\tbatch_values = new Map();\n\t\tfor (const [source, [value]] of this.current) {\n\t\t\tbatch_values.set(source, value);\n\t\t}\n\n\t\t// ...and undo changes belonging to other batches unless they intersect\n\t\tfor (let batch = first_batch; batch !== null; batch = batch.#next) {\n\t\t\tif (batch === this || batch.is_fork) continue;\n\n\t\t\t// If two batches intersect, the latter batch will be merged into the earlier batch,\n\t\t\t// and we should treat them as a single set of changes\n\t\t\tvar intersects = false;\n\n\t\t\tif (batch.id < this.id) {\n\t\t\t\tfor (const [source, [, is_derived]] of batch.current) {\n\t\t\t\t\t// Derived values don't partake in the intersection mechanism, because a derived could\n\t\t\t\t\t// be triggered in one batch already but not the other one yet, causing a false-positive\n\t\t\t\t\tif (is_derived) continue;\n\n\t\t\t\t\tif (this.current.has(source)) {\n\t\t\t\t\t\tintersects = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Since the latter batch merges into the earlier (if it resolves before the earlier one),\n\t\t\t// we treat the earlier values as \"already applied\". This way we don't need to rerun async\n\t\t\t// effects of the earlier batch in case they are merged.\n\t\t\t// As a result you can think of batch_values as having the latest values of all intersecting\n\t\t\t// batches up until this batch.\n\t\t\tif (!intersects) {\n\t\t\t\tfor (const [source, previous] of batch.previous) {\n\t\t\t\t\tif (!batch_values.has(source)) {\n\t\t\t\t\t\tbatch_values.set(source, previous);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {Effect} effect\n\t */\n\tschedule(effect) {\n\t\tlast_scheduled_effect = effect;\n\n\t\t// defer render effects inside a pending boundary\n\t\t// TODO the `REACTION_RAN` check is only necessary because of legacy `$:` effects AFAICT — we can remove later\n\t\tif (\n\t\t\teffect.b?.is_pending &&\n\t\t\t(effect.f & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0 &&\n\t\t\t(effect.f & REACTION_RAN) === 0\n\t\t) {\n\t\t\teffect.b.defer_effect(effect);\n\t\t\treturn;\n\t\t}\n\n\t\tvar e = effect;\n\n\t\twhile (e.parent !== null) {\n\t\t\te = e.parent;\n\t\t\tvar flags = e.f;\n\n\t\t\t// if the effect is being scheduled because a parent (each/await/etc) block\n\t\t\t// updated an internal source, or because a branch is being unskipped,\n\t\t\t// bail out or we'll cause a second flush\n\t\t\tif (collected_effects !== null && e === active_effect) {\n\t\t\t\tif (async_mode_flag) return;\n\n\t\t\t\t// in sync mode, render effects run during traversal. in an extreme edge case\n\t\t\t\t// — namely that we're setting a value inside a derived read during traversal —\n\t\t\t\t// they can be made dirty after they have already been visited, in which\n\t\t\t\t// case we shouldn't bail out. we also shouldn't bail out if we're\n\t\t\t\t// updating a store inside a `$:`, since this might invalidate\n\t\t\t\t// effects that were already visited\n\t\t\t\tif (\n\t\t\t\t\t(active_reaction === null || (active_reaction.f & DERIVED) === 0) &&\n\t\t\t\t\t!legacy_is_updating_store\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ((flags & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {\n\t\t\t\tif ((flags & CLEAN) === 0) {\n\t\t\t\t\t// branch is already dirty, bail\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\te.f ^= CLEAN;\n\t\t\t}\n\t\t}\n\n\t\tthis.#roots.push(e);\n\t}\n\n\t#unlink() {\n\t\t// #merge calls #unlink, discard later on does it again - prevent\n\t\t// running it multiple times to not corrupt the linked list\n\t\tif (!this.linked) return;\n\n\t\tvar prev = this.#prev;\n\t\tvar next = this.#next;\n\n\t\tif (prev === null) {\n\t\t\tfirst_batch = next;\n\t\t} else {\n\t\t\tprev.#next = next;\n\t\t}\n\n\t\tif (next === null) {\n\t\t\tlast_batch = prev;\n\t\t} else {\n\t\t\tnext.#prev = prev;\n\t\t}\n\n\t\tthis.linked = false;\n\t}\n}\n\n// TODO Svelte@6 think about removing the callback argument.\n/**\n * Synchronously flush any pending updates.\n * Returns void if no callback is provided, otherwise returns the result of calling the callback.\n * @template [T=void]\n * @param {(() => T) | undefined} [fn]\n * @returns {T}\n */\nexport function flushSync(fn) {\n\tvar was_flushing_sync = is_flushing_sync;\n\tis_flushing_sync = true;\n\n\ttry {\n\t\tvar result;\n\n\t\tif (fn) {\n\t\t\tif (current_batch !== null && !current_batch.is_fork) {\n\t\t\t\tcurrent_batch.flush();\n\t\t\t}\n\n\t\t\tresult = fn();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tflush_tasks();\n\n\t\t\tif (current_batch === null) {\n\t\t\t\treturn /** @type {T} */ (result);\n\t\t\t}\n\n\t\t\tcurrent_batch.flush();\n\t\t}\n\t} finally {\n\t\tis_flushing_sync = was_flushing_sync;\n\t}\n}\n\nfunction infinite_loop_guard() {\n\tif (DEV) {\n\t\tvar updates = new Map();\n\n\t\tfor (const source of /** @type {Batch} */ (current_batch).current.keys()) {\n\t\t\tfor (const [stack, update] of source.updated ?? []) {\n\t\t\t\tvar entry = updates.get(stack);\n\n\t\t\t\tif (!entry) {\n\t\t\t\t\tentry = { error: update.error, count: 0 };\n\t\t\t\t\tupdates.set(stack, entry);\n\t\t\t\t}\n\n\t\t\t\tentry.count += update.count;\n\t\t\t}\n\t\t}\n\n\t\tfor (const update of updates.values()) {\n\t\t\tif (update.error) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error(update.error);\n\t\t\t}\n\t\t}\n\t}\n\n\ttry {\n\t\te.effect_update_depth_exceeded();\n\t} catch (error) {\n\t\tif (DEV) {\n\t\t\t// stack contains no useful information, replace it\n\t\t\tdefine_property(error, 'stack', { value: '' });\n\t\t}\n\n\t\t// Best effort: invoke the boundary nearest the most recent\n\t\t// effect and hope that it's relevant to the infinite loop\n\t\tinvoke_error_boundary(error, last_scheduled_effect);\n\t}\n}\n\n/** @type {Set<Effect> | null} */\nexport let eager_block_effects = null;\n\n/**\n * @param {Array<Effect>} effects\n * @returns {void}\n */\nfunction flush_queued_effects(effects) {\n\tvar length = effects.length;\n\tif (length === 0) return;\n\n\tvar i = 0;\n\n\twhile (i < length) {\n\t\tvar effect = effects[i++];\n\n\t\tif ((effect.f & (DESTROYED | INERT)) === 0 && is_dirty(effect)) {\n\t\t\teager_block_effects = new Set();\n\n\t\t\tupdate_effect(effect);\n\n\t\t\t// Effects with no dependencies or teardown do not get added to the effect tree.\n\t\t\t// Deferred effects (e.g. `$effect(...)`) _are_ added to the tree because we\n\t\t\t// don't know if we need to keep them until they are executed. Doing the check\n\t\t\t// here (rather than in `update_effect`) allows us to skip the work for\n\t\t\t// immediate effects.\n\t\t\tif (\n\t\t\t\teffect.deps === null &&\n\t\t\t\teffect.first === null &&\n\t\t\t\teffect.nodes === null &&\n\t\t\t\teffect.teardown === null &&\n\t\t\t\teffect.ac === null\n\t\t\t) {\n\t\t\t\t// remove this effect from the graph\n\t\t\t\tunlink_effect(effect);\n\t\t\t}\n\n\t\t\t// If update_effect() has a flushSync() in it, we may have flushed another flush_queued_effects(),\n\t\t\t// which already handled this logic and did set eager_block_effects to null.\n\t\t\tif (eager_block_effects?.size > 0) {\n\t\t\t\told_values.clear();\n\n\t\t\t\tfor (const e of eager_block_effects) {\n\t\t\t\t\t// Skip eager effects that have already been unmounted\n\t\t\t\t\tif ((e.f & (DESTROYED | INERT)) !== 0) continue;\n\n\t\t\t\t\t// Run effects in order from ancestor to descendant, else we could run into nullpointers\n\t\t\t\t\t/** @type {Effect[]} */\n\t\t\t\t\tconst ordered_effects = [e];\n\t\t\t\t\tlet ancestor = e.parent;\n\t\t\t\t\twhile (ancestor !== null) {\n\t\t\t\t\t\tif (eager_block_effects.has(ancestor)) {\n\t\t\t\t\t\t\teager_block_effects.delete(ancestor);\n\t\t\t\t\t\t\tordered_effects.push(ancestor);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tancestor = ancestor.parent;\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (let j = ordered_effects.length - 1; j >= 0; j--) {\n\t\t\t\t\t\tconst e = ordered_effects[j];\n\t\t\t\t\t\t// Skip eager effects that have already been unmounted\n\t\t\t\t\t\tif ((e.f & (DESTROYED | INERT)) !== 0) continue;\n\t\t\t\t\t\tupdate_effect(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\teager_block_effects.clear();\n\t\t\t}\n\t\t}\n\t}\n\n\teager_block_effects = null;\n}\n\n/**\n * This is similar to `mark_reactions`, but it only marks async/block effects\n * depending on `value` and at least one of the other `sources`, so that\n * these effects can re-run after another batch has been committed\n * @param {Value} value\n * @param {Source[]} sources\n * @param {Set<Value>} marked\n * @param {Map<Reaction, boolean>} checked\n */\nfunction mark_effects(value, sources, marked, checked) {\n\tif (marked.has(value)) return;\n\tmarked.add(value);\n\n\tif (value.reactions !== null) {\n\t\tfor (const reaction of value.reactions) {\n\t\t\tconst flags = reaction.f;\n\n\t\t\tif ((flags & DERIVED) !== 0) {\n\t\t\t\tmark_effects(/** @type {Derived} */ (reaction), sources, marked, checked);\n\t\t\t} else if (\n\t\t\t\t(flags & (ASYNC | BLOCK_EFFECT)) !== 0 &&\n\t\t\t\t(flags & DIRTY) === 0 &&\n\t\t\t\tdepends_on(reaction, sources, checked)\n\t\t\t) {\n\t\t\t\tset_signal_status(reaction, DIRTY);\n\t\t\t\tschedule_effect(/** @type {Effect} */ (reaction));\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * When committing a fork, we need to trigger eager effects so that\n * any `$state.eager(...)` expressions update immediately. This\n * function allows us to discover them\n * @param {Value} value\n * @param {Set<Effect>} effects\n */\nfunction mark_eager_effects(value, effects) {\n\tif (value.reactions === null) return;\n\n\tfor (const reaction of value.reactions) {\n\t\tconst flags = reaction.f;\n\n\t\tif ((flags & DERIVED) !== 0) {\n\t\t\tmark_eager_effects(/** @type {Derived} */ (reaction), effects);\n\t\t} else if ((flags & EAGER_EFFECT) !== 0) {\n\t\t\tset_signal_status(reaction, DIRTY);\n\t\t\teffects.add(/** @type {Effect} */ (reaction));\n\t\t}\n\t}\n}\n\n/**\n * @param {Reaction} reaction\n * @param {Source[]} sources\n * @param {Map<Reaction, boolean>} checked\n */\nfunction depends_on(reaction, sources, checked) {\n\tconst depends = checked.get(reaction);\n\tif (depends !== undefined) return depends;\n\n\tif (reaction.deps !== null) {\n\t\tfor (const dep of reaction.deps) {\n\t\t\tif (includes.call(sources, dep)) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif ((dep.f & DERIVED) !== 0 && depends_on(/** @type {Derived} */ (dep), sources, checked)) {\n\t\t\t\tchecked.set(/** @type {Derived} */ (dep), true);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\n\tchecked.set(reaction, false);\n\n\treturn false;\n}\n\n/**\n * @param {Effect} effect\n * @returns {void}\n */\nexport function schedule_effect(effect) {\n\t/** @type {Batch} */ (current_batch).schedule(effect);\n}\n\n/** @type {Source<number>[]} */\nlet eager_versions = [];\n\nfunction eager_flush() {\n\tflushSync(() => {\n\t\tconst eager = eager_versions;\n\t\teager_versions = [];\n\t\tfor (const version of eager) {\n\t\t\tupdate(version);\n\t\t}\n\t});\n}\n\n/** @type {Map<Reaction, Source<number>>} */\nvar version_map = new Map();\n\n/**\n * Implementation of `$state.eager(fn())`\n * @template T\n * @param {() => T} fn\n * @returns {T}\n */\nexport function eager(fn) {\n\tvar initial = true;\n\tvar value = /** @type {T} */ (undefined);\n\n\tif (active_reaction === null) {\n\t\treturn fn();\n\t}\n\n\tlet parent = active_reaction;\n\n\tlet version = version_map.get(parent) ?? source(0);\n\tversion_map.set(parent, version);\n\n\tteardown(() => {\n\t\tif (parent.f & DESTROYING) version_map.delete(parent);\n\t});\n\n\tget(version);\n\n\teager_effect(() => {\n\t\tif (initial) {\n\t\t\t// the first time this runs, we create an eager effect\n\t\t\t// that will run eagerly whenever the expression changes\n\t\t\tvar previous_batch_values = batch_values;\n\n\t\t\ttry {\n\t\t\t\tbatch_values = null;\n\t\t\t\tvalue = fn();\n\t\t\t} finally {\n\t\t\t\tbatch_values = previous_batch_values;\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// the second time this effect runs, it's to schedule a\n\t\t// `version` update. since this will recreate the effect,\n\t\t// we don't need to evaluate the expression here\n\t\tif (eager_versions.length === 0) {\n\t\t\tqueue_micro_task(eager_flush);\n\t\t}\n\n\t\teager_versions.push(version);\n\t});\n\n\tinitial = false;\n\n\treturn value;\n}\n\n/**\n * Mark all the effects inside a skipped branch CLEAN, so that\n * they can be correctly rescheduled later. Tracks dirty and maybe_dirty\n * effects so they can be rescheduled if the branch survives.\n * @param {Effect} effect\n * @param {{ d: Effect[], m: Effect[] }} tracked\n */\nfunction reset_branch(effect, tracked) {\n\t// clean branch = nothing dirty inside, no need to traverse further\n\tif ((effect.f & BRANCH_EFFECT) !== 0 && (effect.f & CLEAN) !== 0) {\n\t\treturn;\n\t}\n\n\tif ((effect.f & DIRTY) !== 0) {\n\t\ttracked.d.push(effect);\n\t} else if ((effect.f & MAYBE_DIRTY) !== 0) {\n\t\ttracked.m.push(effect);\n\t}\n\n\tset_signal_status(effect, CLEAN);\n\n\tvar e = effect.first;\n\twhile (e !== null) {\n\t\treset_branch(e, tracked);\n\t\te = e.next;\n\t}\n}\n\n/**\n * Mark an entire effect tree clean following an error\n * @param {Effect} effect\n */\nfunction reset_all(effect) {\n\tset_signal_status(effect, CLEAN);\n\n\tvar e = effect.first;\n\twhile (e !== null) {\n\t\treset_all(e);\n\t\te = e.next;\n\t}\n}\n\n/**\n * Creates a 'fork', in which state changes are evaluated but not applied to the DOM.\n * This is useful for speculatively loading data (for example) when you suspect that\n * the user is about to take some action.\n *\n * Frameworks like SvelteKit can use this to preload data when the user touches or\n * hovers over a link, making any subsequent navigation feel instantaneous.\n *\n * The `fn` parameter is a synchronous function that modifies some state. The\n * state changes will be reverted after the fork is initialised, then reapplied\n * if and when the fork is eventually committed.\n *\n * When it becomes clear that a fork will _not_ be committed (e.g. because the\n * user navigated elsewhere), it must be discarded to avoid leaking memory.\n *\n * @param {() => void} fn\n * @returns {Fork}\n * @since 5.42\n */\nexport function fork(fn) {\n\tif (!async_mode_flag) {\n\t\te.experimental_async_required('fork');\n\t}\n\n\tif (current_batch !== null) {\n\t\te.fork_timing();\n\t}\n\n\tvar batch = Batch.ensure();\n\tbatch.is_fork = true;\n\tbatch_values = new Map();\n\n\tvar committed = false;\n\tvar settled = batch.settled();\n\n\tflushSync(fn);\n\n\treturn {\n\t\tcommit: async () => {\n\t\t\tif (committed) {\n\t\t\t\tawait settled;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!batch.linked) {\n\t\t\t\te.fork_discarded();\n\t\t\t}\n\n\t\t\tcommitted = true;\n\n\t\t\tbatch.is_fork = false;\n\n\t\t\t// apply changes and update write versions so deriveds see the change\n\t\t\tfor (var [source, [value]] of batch.current) {\n\t\t\t\tsource.v = value;\n\t\t\t\tsource.wv = increment_write_version();\n\t\t\t}\n\n\t\t\t// trigger any `$state.eager(...)` expressions with the new state.\n\t\t\t// eager effects don't get scheduled like other effects, so we\n\t\t\t// can't just encounter them during traversal, we need to\n\t\t\t// proactively flush them\n\t\t\t// TODO maybe there's a better implementation?\n\t\t\tflushSync(() => {\n\t\t\t\t/** @type {Set<Effect>} */\n\t\t\t\tvar eager_effects = new Set();\n\n\t\t\t\tfor (var source of batch.current.keys()) {\n\t\t\t\t\tmark_eager_effects(source, eager_effects);\n\t\t\t\t}\n\n\t\t\t\tset_eager_effects(eager_effects);\n\t\t\t\tflush_eager_effects();\n\t\t\t});\n\n\t\t\tbatch.flush();\n\t\t\tawait settled;\n\t\t},\n\t\tdiscard: () => {\n\t\t\t// cause any MAYBE_DIRTY deriveds to update\n\t\t\t// if they depend on things thath changed\n\t\t\t// inside the discarded fork\n\t\t\tfor (var source of batch.current.keys()) {\n\t\t\t\tsource.wv = increment_write_version();\n\t\t\t}\n\n\t\t\tif (!committed && batch.linked) {\n\t\t\t\tbatch.discard();\n\t\t\t}\n\t\t}\n\t};\n}\n\n/**\n * Forcibly remove all current batches, to prevent cross-talk between tests\n */\nexport function clear() {\n\tfirst_batch = last_batch = null;\n}\n","/** @import { Derived, Effect, Source, Value } from '#client' */\nimport { DEV } from 'esm-env';\nimport {\n\tactive_reaction,\n\tactive_effect,\n\tuntracked_writes,\n\tget,\n\tset_untracked_writes,\n\tuntrack,\n\tincrement_write_version,\n\tupdate_effect,\n\tcurrent_sources,\n\tis_dirty,\n\tuntracking,\n\tis_destroying_effect,\n\tpush_reaction_value\n} from '../runtime.js';\nimport { equals, safe_equals } from './equality.js';\nimport {\n\tCLEAN,\n\tDERIVED,\n\tDIRTY,\n\tBRANCH_EFFECT,\n\tEAGER_EFFECT,\n\tMAYBE_DIRTY,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tASYNC,\n\tWAS_MARKED,\n\tCONNECTED,\n\tREACTION_IS_UPDATING\n} from '#client/constants';\nimport * as e from '../errors.js';\nimport { legacy_mode_flag, tracing_mode_flag } from '../../flags/index.js';\nimport { tag_proxy } from '../dev/tracing.js';\nimport { get_error } from '../../shared/dev.js';\nimport { component_context, is_runes } from '../context.js';\nimport {\n\tBatch,\n\tbatch_values,\n\teager_block_effects,\n\tschedule_effect,\n\tlegacy_updates\n} from './batch.js';\nimport { proxy } from '../proxy.js';\nimport { execute_derived } from './deriveds.js';\nimport { set_signal_status, update_derived_status } from './status.js';\n\n/** @type {Set<Effect>} */\nexport let eager_effects = new Set();\n\n/** @type {Map<Source, any>} */\nexport const old_values = new Map();\n\n/**\n * @param {Set<any>} v\n */\nexport function set_eager_effects(v) {\n\teager_effects = v;\n}\n\nlet eager_effects_deferred = false;\n\nexport function set_eager_effects_deferred() {\n\teager_effects_deferred = true;\n}\n\n/**\n * @template V\n * @param {V} v\n * @param {Error | null} [stack]\n * @returns {Source<V>}\n */\n// TODO rename this to `state` throughout the codebase\nexport function source(v, stack) {\n\t/** @type {Value} */\n\tvar signal = {\n\t\tf: 0, // TODO ideally we could skip this altogether, but it causes type errors\n\t\tv,\n\t\treactions: null,\n\t\tequals,\n\t\trv: 0,\n\t\twv: 0\n\t};\n\n\tif (DEV && tracing_mode_flag) {\n\t\tsignal.created = stack ?? get_error('created at');\n\t\tsignal.updated = null;\n\t\tsignal.set_during_effect = false;\n\t\tsignal.trace = null;\n\t}\n\n\treturn signal;\n}\n\n/**\n * @template V\n * @param {V} v\n * @param {Error | null} [stack]\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function state(v, stack) {\n\tconst s = source(v, stack);\n\n\tpush_reaction_value(s);\n\n\treturn s;\n}\n\n/**\n * @template V\n * @param {V} initial_value\n * @param {boolean} [immutable]\n * @returns {Source<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function mutable_source(initial_value, immutable = false, trackable = true) {\n\tconst s = source(initial_value);\n\tif (!immutable) {\n\t\ts.equals = safe_equals;\n\t}\n\n\t// bind the signal to the component context, in case we need to\n\t// track updates to trigger beforeUpdate/afterUpdate callbacks\n\tif (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) {\n\t\t(component_context.l.s ??= []).push(s);\n\t}\n\n\treturn s;\n}\n\n/**\n * @template V\n * @param {Value<V>} source\n * @param {V} value\n */\nexport function mutate(source, value) {\n\tset(\n\t\tsource,\n\t\tuntrack(() => get(source))\n\t);\n\treturn value;\n}\n\n/**\n * @template V\n * @param {Source<V>} source\n * @param {V} value\n * @param {boolean} [should_proxy]\n * @returns {V}\n */\nexport function set(source, value, should_proxy = false) {\n\tif (\n\t\tactive_reaction !== null &&\n\t\t// since we are untracking the function inside `$inspect.with` we need to add this check\n\t\t// to ensure we error if state is set inside an inspect effect\n\t\t(!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) &&\n\t\tis_runes() &&\n\t\t(active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 &&\n\t\t(current_sources === null || !current_sources.has(source))\n\t) {\n\t\te.state_unsafe_mutation();\n\t}\n\n\tlet new_value = should_proxy ? proxy(value) : value;\n\n\tif (DEV) {\n\t\ttag_proxy(new_value, /** @type {string} */ (source.label));\n\t}\n\n\treturn internal_set(source, new_value, legacy_updates);\n}\n\n/**\n * @template V\n * @param {Source<V>} source\n * @param {V} value\n * @param {Effect[] | null} [updated_during_traversal]\n * @returns {V}\n */\nexport function internal_set(source, value, updated_during_traversal = null) {\n\tif (!source.equals(value)) {\n\t\tif (is_destroying_effect) {\n\t\t\told_values.set(source, value);\n\t\t} else if (!old_values.has(source)) {\n\t\t\t// only record the value from before the first write in this flush, otherwise a\n\t\t\t// teardown would see the value from before whichever write happened to be last\n\t\t\told_values.set(source, source.v);\n\t\t}\n\n\t\tvar batch = Batch.ensure();\n\t\tbatch.capture(source, value);\n\n\t\tif (DEV) {\n\t\t\tif (tracing_mode_flag || active_effect !== null) {\n\t\t\t\tsource.updated ??= new Map();\n\n\t\t\t\t// For performance reasons, when not using $inspect.trace, we only start collecting stack traces\n\t\t\t\t// after the same source has been updated more than 5 times in the same flush cycle.\n\t\t\t\tconst count = (source.updated.get('')?.count ?? 0) + 1;\n\t\t\t\tsource.updated.set('', { error: /** @type {any} */ (null), count });\n\n\t\t\t\tif (tracing_mode_flag || count > 5) {\n\t\t\t\t\tconst error = get_error('updated at');\n\n\t\t\t\t\tif (error !== null) {\n\t\t\t\t\t\tlet entry = source.updated.get(error.stack);\n\n\t\t\t\t\t\tif (!entry) {\n\t\t\t\t\t\t\tentry = { error, count: 0 };\n\t\t\t\t\t\t\tsource.updated.set(error.stack, entry);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tentry.count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (active_effect !== null) {\n\t\t\t\tsource.set_during_effect = true;\n\t\t\t}\n\t\t}\n\n\t\tif ((source.f & DERIVED) !== 0) {\n\t\t\tconst derived = /** @type {Derived} */ (source);\n\n\t\t\t// if we are assigning to a dirty derived we set it to clean/maybe dirty but we also eagerly execute it to track the dependencies\n\t\t\tif ((source.f & DIRTY) !== 0) {\n\t\t\t\texecute_derived(derived);\n\t\t\t}\n\n\t\t\t// During time traveling we don't want to reset the status so that\n\t\t\t// traversal of the graph in the other batches still happens\n\t\t\tif (batch_values === null) {\n\t\t\t\tupdate_derived_status(derived);\n\t\t\t}\n\t\t}\n\n\t\tsource.wv = increment_write_version();\n\n\t\t// For debugging, in case you want to know which reactions are being scheduled:\n\t\t// log_reactions(source);\n\t\tmark_reactions(source, DIRTY, updated_during_traversal);\n\n\t\t// It's possible that the current reaction might not have up-to-date dependencies\n\t\t// whilst it's actively running. So in the case of ensuring it registers the reaction\n\t\t// properly for itself, we need to ensure the current effect actually gets\n\t\t// scheduled. i.e: `$effect(() => x++)`\n\t\tif (\n\t\t\tis_runes() &&\n\t\t\tactive_effect !== null &&\n\t\t\t(active_effect.f & CLEAN) !== 0 &&\n\t\t\t(active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0\n\t\t) {\n\t\t\tif (untracked_writes === null) {\n\t\t\t\tset_untracked_writes([source]);\n\t\t\t} else {\n\t\t\t\tuntracked_writes.push(source);\n\t\t\t}\n\t\t}\n\n\t\tif (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) {\n\t\t\tflush_eager_effects();\n\t\t}\n\t}\n\n\treturn value;\n}\n\nexport function flush_eager_effects() {\n\teager_effects_deferred = false;\n\n\tfor (const effect of eager_effects) {\n\t\t// Mark clean inspect-effects as maybe dirty and then check their dirtiness\n\t\t// instead of just updating the effects - this way we avoid overfiring.\n\t\tif ((effect.f & CLEAN) !== 0) {\n\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t}\n\n\t\tlet dirty;\n\n\t\ttry {\n\t\t\tdirty = is_dirty(effect);\n\t\t} catch {\n\t\t\t// Dirty-checking can evaluate derived dependencies and throw in cases where\n\t\t\t// parent effects are about to destroy this eager effect. Run the effect so\n\t\t\t// its own error handling can deal with transient failures.\n\t\t\tdirty = true;\n\t\t}\n\n\t\tif (dirty) {\n\t\t\tupdate_effect(effect);\n\t\t}\n\t}\n\n\teager_effects.clear();\n}\n\n/**\n * @template {number | bigint} T\n * @param {Source<T>} source\n * @param {1 | -1} [d]\n * @returns {T}\n */\nexport function update(source, d = 1) {\n\tvar value = get(source);\n\tvar result = d === 1 ? value++ : value--;\n\n\tset(source, value);\n\n\t// @ts-expect-error\n\treturn result;\n}\n\n/**\n * @template {number | bigint} T\n * @param {Source<T>} source\n * @param {1 | -1} [d]\n * @returns {T}\n */\nexport function update_pre(source, d = 1) {\n\tvar value = get(source);\n\n\t// @ts-expect-error\n\t// eslint-disable-next-line no-useless-assignment -- `++`/`--` used for return value, not side effect on `value`\n\treturn set(source, d === 1 ? ++value : --value);\n}\n\n/**\n * Silently (without using `get`) increment a source\n * @param {Source<number>} source\n */\nexport function increment(source) {\n\tset(source, source.v + 1);\n}\n\n/**\n * @param {Value} signal\n * @param {number} status should be DIRTY or MAYBE_DIRTY\n * @param {Effect[] | null} updated_during_traversal\n * @returns {void}\n */\nfunction mark_reactions(signal, status, updated_during_traversal) {\n\tvar reactions = signal.reactions;\n\tif (reactions === null) return;\n\n\tvar runes = is_runes();\n\tvar length = reactions.length;\n\n\tfor (var i = 0; i < length; i++) {\n\t\tvar reaction = reactions[i];\n\t\tvar flags = reaction.f;\n\n\t\t// In legacy mode, skip the current effect to prevent infinite loops\n\t\tif (!runes && reaction === active_effect) continue;\n\n\t\tvar not_dirty = (flags & DIRTY) === 0;\n\n\t\t// don't set a DIRTY reaction to MAYBE_DIRTY\n\t\tif (not_dirty) {\n\t\t\tset_signal_status(reaction, status);\n\t\t}\n\n\t\tif ((flags & EAGER_EFFECT) !== 0) {\n\t\t\t// Eager effects need to run immediately:\n\t\t\t// - for $inspect so that the stack trace makes sense\n\t\t\t// - for $state.eager because they might be without an effect parent\n\t\t\teager_effects.add(/** @type {Effect} */ (reaction));\n\t\t} else if ((flags & DERIVED) !== 0) {\n\t\t\tvar derived = /** @type {Derived} */ (reaction);\n\n\t\t\tbatch_values?.delete(derived);\n\n\t\t\tif ((flags & WAS_MARKED) === 0) {\n\t\t\t\t// Only connected deriveds being executed outside the update cycle can be reliably unmarked right away\n\t\t\t\tif (\n\t\t\t\t\tflags & CONNECTED &&\n\t\t\t\t\t(active_effect === null || (active_effect.f & REACTION_IS_UPDATING) === 0)\n\t\t\t\t) {\n\t\t\t\t\treaction.f |= WAS_MARKED;\n\t\t\t\t}\n\n\t\t\t\tmark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);\n\t\t\t}\n\t\t} else if (not_dirty) {\n\t\t\tvar effect = /** @type {Effect} */ (reaction);\n\n\t\t\tif ((flags & BLOCK_EFFECT) !== 0 && eager_block_effects !== null) {\n\t\t\t\teager_block_effects.add(effect);\n\t\t\t}\n\n\t\t\tif (updated_during_traversal !== null) {\n\t\t\t\tupdated_during_traversal.push(effect);\n\t\t\t} else {\n\t\t\t\tschedule_effect(effect);\n\t\t\t}\n\t\t}\n\t}\n}\n","/** @import { Source } from '#client' */\nimport { DEV } from 'esm-env';\nimport {\n\tget,\n\tactive_effect,\n\tupdate_version,\n\tactive_reaction,\n\tset_update_version,\n\tset_active_reaction\n} from './runtime.js';\nimport {\n\tarray_prototype,\n\tget_descriptor,\n\tget_prototype_of,\n\tis_array,\n\tobject_prototype\n} from '../shared/utils.js';\nimport {\n\tstate as source,\n\tset,\n\tincrement,\n\tflush_eager_effects,\n\tset_eager_effects_deferred\n} from './reactivity/sources.js';\nimport { COMPONENT_SYMBOL, PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants';\nimport { UNINITIALIZED } from '../../constants.js';\nimport * as e from './errors.js';\nimport { tag } from './dev/tracing.js';\nimport { get_error } from '../shared/dev.js';\nimport { tracing_mode_flag } from '../flags/index.js';\n\n// TODO move all regexes into shared module?\nconst regex_is_valid_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;\n\n/**\n * @template T\n * @param {T} value\n * @returns {T}\n */\nexport function proxy(value) {\n\t// if non-proxyable, a component instance, or already a proxy, return `value`\n\tif (\n\t\ttypeof value !== 'object' ||\n\t\tvalue === null ||\n\t\tSTATE_SYMBOL in value ||\n\t\tCOMPONENT_SYMBOL in value\n\t) {\n\t\treturn value;\n\t}\n\n\tconst prototype = get_prototype_of(value);\n\n\tif (prototype !== object_prototype && prototype !== array_prototype) {\n\t\treturn value;\n\t}\n\n\t/** @type {Map<any, Source<any>>} */\n\tvar sources = new Map();\n\tvar is_proxied_array = is_array(value);\n\tvar version = source(0);\n\n\tvar stack = DEV && tracing_mode_flag ? get_error('created at') : null;\n\tvar parent_version = update_version;\n\n\t/**\n\t * Executes the proxy in the context of the reaction it was originally created in, if any\n\t * @template T\n\t * @param {() => T} fn\n\t */\n\tvar with_parent = (fn) => {\n\t\tif (update_version === parent_version) {\n\t\t\treturn fn();\n\t\t}\n\n\t\t// child source is being created after the initial proxy —\n\t\t// prevent it from being associated with the current reaction\n\t\tvar reaction = active_reaction;\n\t\tvar version = update_version;\n\n\t\tset_active_reaction(null);\n\t\tset_update_version(parent_version);\n\n\t\tvar result = fn();\n\n\t\tset_active_reaction(reaction);\n\t\tset_update_version(version);\n\n\t\treturn result;\n\t};\n\n\tif (is_proxied_array) {\n\t\t// We need to create the length source eagerly to ensure that\n\t\t// mutations to the array are properly synced with our proxy\n\t\tsources.set('length', source(/** @type {any[]} */ (value).length, stack));\n\t\tif (DEV) {\n\t\t\tvalue = /** @type {any} */ (inspectable_array(/** @type {any[]} */ (value)));\n\t\t}\n\t}\n\n\t/** Used in dev for $inspect.trace() */\n\tvar path = '';\n\tlet updating = false;\n\t/** @param {string} new_path */\n\tfunction update_path(new_path) {\n\t\tif (updating) return;\n\t\tupdating = true;\n\t\tpath = new_path;\n\n\t\ttag(version, `${path} version`);\n\n\t\t// rename all child sources and child proxies\n\t\tfor (const [prop, source] of sources) {\n\t\t\ttag(source, get_label(path, prop));\n\t\t}\n\t\tupdating = false;\n\t}\n\n\treturn new Proxy(/** @type {any} */ (value), {\n\t\tdefineProperty(_, prop, descriptor) {\n\t\t\tif (\n\t\t\t\t!('value' in descriptor) ||\n\t\t\t\tdescriptor.configurable === false ||\n\t\t\t\tdescriptor.enumerable === false ||\n\t\t\t\tdescriptor.writable === false\n\t\t\t) {\n\t\t\t\t// we disallow non-basic descriptors, because unless they are applied to the\n\t\t\t\t// target object — which we avoid, so that state can be forked — we will run\n\t\t\t\t// afoul of the various invariants\n\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/getOwnPropertyDescriptor#invariants\n\t\t\t\te.state_descriptors_fixed();\n\t\t\t}\n\t\t\tvar s = sources.get(prop);\n\t\t\tif (s === undefined) {\n\t\t\t\twith_parent(() => {\n\t\t\t\t\tvar s = source(descriptor.value, stack);\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t\tif (DEV && typeof prop === 'string') {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t\treturn s;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tset(s, descriptor.value, true);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\tdeleteProperty(target, prop) {\n\t\t\tvar s = sources.get(prop);\n\n\t\t\tif (s === undefined) {\n\t\t\t\tif (prop in target) {\n\t\t\t\t\tconst s = with_parent(() => source(UNINITIALIZED, stack));\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t\tincrement(version);\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tset(s, UNINITIALIZED);\n\t\t\t\tincrement(version);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\tget(target, prop, receiver) {\n\t\t\tif (prop === STATE_SYMBOL) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tif (DEV && prop === PROXY_PATH_SYMBOL) {\n\t\t\t\treturn update_path;\n\t\t\t}\n\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar exists = prop in target;\n\n\t\t\t// create a source, but only if it's an own property and not a prototype property\n\t\t\tif (s === undefined && (!exists || get_descriptor(target, prop)?.writable)) {\n\t\t\t\ts = with_parent(() => {\n\t\t\t\t\tvar p = proxy(exists ? target[prop] : UNINITIALIZED);\n\t\t\t\t\tvar s = source(p, stack);\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\n\t\t\t\t\treturn s;\n\t\t\t\t});\n\n\t\t\t\tsources.set(prop, s);\n\t\t\t}\n\n\t\t\tif (s !== undefined) {\n\t\t\t\tvar v = get(s);\n\t\t\t\treturn v === UNINITIALIZED ? undefined : v;\n\t\t\t}\n\n\t\t\treturn Reflect.get(target, prop, receiver);\n\t\t},\n\n\t\tgetOwnPropertyDescriptor(target, prop) {\n\t\t\tvar descriptor = Reflect.getOwnPropertyDescriptor(target, prop);\n\n\t\t\tif (descriptor && 'value' in descriptor) {\n\t\t\t\tvar s = sources.get(prop);\n\t\t\t\tif (s) descriptor.value = get(s);\n\t\t\t} else if (descriptor === undefined) {\n\t\t\t\tvar source = sources.get(prop);\n\t\t\t\tvar value = source?.v;\n\n\t\t\t\tif (source !== undefined && value !== UNINITIALIZED) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\twritable: true\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn descriptor;\n\t\t},\n\n\t\thas(target, prop) {\n\t\t\tif (prop === STATE_SYMBOL) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar has = (s !== undefined && s.v !== UNINITIALIZED) || Reflect.has(target, prop);\n\n\t\t\tif (\n\t\t\t\ts !== undefined ||\n\t\t\t\t(active_effect !== null && (!has || get_descriptor(target, prop)?.writable))\n\t\t\t) {\n\t\t\t\tif (s === undefined) {\n\t\t\t\t\ts = with_parent(() => {\n\t\t\t\t\t\tvar p = has ? proxy(target[prop]) : UNINITIALIZED;\n\t\t\t\t\t\tvar s = source(p, stack);\n\n\t\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn s;\n\t\t\t\t\t});\n\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t}\n\n\t\t\t\tvar value = get(s);\n\t\t\t\tif (value === UNINITIALIZED) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn has;\n\t\t},\n\n\t\tset(target, prop, value, receiver) {\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar has = prop in target;\n\n\t\t\t// variable.length = value -> clear all signals with index >= value\n\t\t\tif (is_proxied_array && prop === 'length') {\n\t\t\t\tfor (var i = value; i < /** @type {Source<number>} */ (s).v; i += 1) {\n\t\t\t\t\tvar other_s = sources.get(i + '');\n\t\t\t\t\tif (other_s !== undefined) {\n\t\t\t\t\t\tset(other_s, UNINITIALIZED);\n\t\t\t\t\t} else if (i in target) {\n\t\t\t\t\t\t// If the item exists in the original, we need to create an uninitialized source,\n\t\t\t\t\t\t// else a later read of the property would result in a source being created with\n\t\t\t\t\t\t// the value of the original item at that index.\n\t\t\t\t\t\tother_s = with_parent(() => source(UNINITIALIZED, stack));\n\t\t\t\t\t\tsources.set(i + '', other_s);\n\n\t\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\t\ttag(other_s, get_label(path, i));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we haven't yet created a source for this property, we need to ensure\n\t\t\t// we do so otherwise if we read it later, then the write won't be tracked and\n\t\t\t// the heuristics of effects will be different vs if we had read the proxied\n\t\t\t// object property before writing to that property.\n\t\t\tif (s === undefined) {\n\t\t\t\tif (!has || get_descriptor(target, prop)?.writable) {\n\t\t\t\t\ts = with_parent(() => source(undefined, stack));\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t\tset(s, proxy(value));\n\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thas = s.v !== UNINITIALIZED;\n\n\t\t\t\tvar p = with_parent(() => proxy(value));\n\t\t\t\tset(s, p);\n\t\t\t}\n\n\t\t\tvar descriptor = Reflect.getOwnPropertyDescriptor(target, prop);\n\n\t\t\t// Set the new value before updating any signals so that any listeners get the new value\n\t\t\tif (descriptor?.set) {\n\t\t\t\tdescriptor.set.call(receiver, value);\n\t\t\t}\n\n\t\t\tif (!has) {\n\t\t\t\t// If we have mutated an array directly, we might need to\n\t\t\t\t// signal that length has also changed. Do it before updating metadata\n\t\t\t\t// to ensure that iterating over the array as a result of a metadata update\n\t\t\t\t// will not cause the length to be out of sync.\n\t\t\t\tif (is_proxied_array && typeof prop === 'string') {\n\t\t\t\t\tvar ls = /** @type {Source<number>} */ (sources.get('length'));\n\t\t\t\t\tvar n = Number(prop);\n\n\t\t\t\t\tif (Number.isInteger(n) && n >= ls.v) {\n\t\t\t\t\t\tset(ls, n + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tincrement(version);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\townKeys(target) {\n\t\t\tget(version);\n\n\t\t\tvar own_keys = Reflect.ownKeys(target).filter((key) => {\n\t\t\t\tvar source = sources.get(key);\n\t\t\t\treturn source === undefined || source.v !== UNINITIALIZED;\n\t\t\t});\n\n\t\t\tfor (var [key, source] of sources) {\n\t\t\t\tif (source.v !== UNINITIALIZED && !(key in target)) {\n\t\t\t\t\town_keys.push(key);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn own_keys;\n\t\t},\n\n\t\tsetPrototypeOf() {\n\t\t\te.state_prototype_fixed();\n\t\t}\n\t});\n}\n\n/**\n * @param {string} path\n * @param {string | symbol} prop\n */\nfunction get_label(path, prop) {\n\tif (typeof prop === 'symbol') return `${path}[Symbol(${prop.description ?? ''})]`;\n\tif (regex_is_valid_identifier.test(prop)) return `${path}.${prop}`;\n\treturn /^\\d+$/.test(prop) ? `${path}[${prop}]` : `${path}['${prop}']`;\n}\n\n/**\n * @param {any} value\n */\nexport function get_proxied_value(value) {\n\ttry {\n\t\tif (value !== null && typeof value === 'object' && STATE_SYMBOL in value) {\n\t\t\treturn value[STATE_SYMBOL];\n\t\t}\n\t} catch {\n\t\t// the above if check can throw an error if the value in question\n\t\t// is the contentWindow of an iframe on another domain, in which\n\t\t// case we want to just return the value (because it's definitely\n\t\t// not a proxied value) so we don't break any JavaScript interacting\n\t\t// with that iframe (such as various payment companies client side\n\t\t// JavaScript libraries interacting with their iframes on the same\n\t\t// domain)\n\t}\n\n\treturn value;\n}\n\n/**\n * @param {any} a\n * @param {any} b\n */\nexport function is(a, b) {\n\treturn Object.is(get_proxied_value(a), get_proxied_value(b));\n}\n\nconst ARRAY_MUTATING_METHODS = new Set([\n\t'copyWithin',\n\t'fill',\n\t'pop',\n\t'push',\n\t'reverse',\n\t'shift',\n\t'sort',\n\t'splice',\n\t'unshift'\n]);\n\n/**\n * Wrap array mutating methods so $inspect is triggered only once and\n * to prevent logging an array in intermediate state (e.g. with an empty slot)\n * @param {any[]} array\n */\nfunction inspectable_array(array) {\n\treturn new Proxy(array, {\n\t\tget(target, prop, receiver) {\n\t\t\tvar value = Reflect.get(target, prop, receiver);\n\t\t\tif (!ARRAY_MUTATING_METHODS.has(/** @type {string} */ (prop))) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @this {any[]}\n\t\t\t * @param {any[]} args\n\t\t\t */\n\t\t\treturn function (...args) {\n\t\t\t\tset_eager_effects_deferred();\n\t\t\t\tvar result = value.apply(this, args);\n\t\t\t\tflush_eager_effects();\n\t\t\t\treturn result;\n\t\t\t};\n\t\t}\n\t});\n}\n","/** @import { Effect, TemplateNode } from '#client' */\nimport { hydrate_node, hydrating, reset, set_hydrate_node } from './hydration.js';\nimport { DEV } from 'esm-env';\nimport { init_array_prototype_warnings } from '../dev/equality.js';\nimport { get_descriptor, is_extensible } from '../../shared/utils.js';\nimport { active_effect } from '../runtime.js';\nimport { async_mode_flag } from '../../flags/index.js';\nimport {\n\tATTRIBUTES_CACHE,\n\tCLASS_CACHE,\n\tREACTION_RAN,\n\tSTYLE_CACHE,\n\tTEXT_CACHE,\n\tTEXT_NODE\n} from '#client/constants';\nimport { eager_block_effects } from '../reactivity/batch.js';\nimport { NAMESPACE_HTML } from '../../../constants.js';\n\n// export these for reference in the compiled code, making global name deduplication unnecessary\n/** @type {Window} */\nexport var $window;\n\n/** @type {Document} */\nexport var $document;\n\n/** @type {boolean} */\nexport var is_firefox;\n\n/** @type {() => Node | null} */\nvar first_child_getter;\n/** @type {() => Node | null} */\nvar next_sibling_getter;\n\n/**\n * Initialize these lazily to avoid issues when using the runtime in a server context\n * where these globals are not available while avoiding a separate server entry point\n */\nexport function init_operations() {\n\tif ($window !== undefined) {\n\t\treturn;\n\t}\n\n\t$window = window;\n\t$document = document;\n\tis_firefox = /Firefox/.test(navigator.userAgent);\n\n\tvar element_prototype = Element.prototype;\n\tvar node_prototype = Node.prototype;\n\tvar text_prototype = Text.prototype;\n\n\t// @ts-ignore\n\tfirst_child_getter = get_descriptor(node_prototype, 'firstChild').get;\n\t// @ts-ignore\n\tnext_sibling_getter = get_descriptor(node_prototype, 'nextSibling').get;\n\n\tif (is_extensible(element_prototype)) {\n\t\t// the following assignments improve perf of lookups on DOM nodes\n\t\t/** @type {any} */ (element_prototype)[CLASS_CACHE] = undefined;\n\t\t/** @type {any} */ (element_prototype)[ATTRIBUTES_CACHE] = null;\n\t\t/** @type {any} */ (element_prototype)[STYLE_CACHE] = undefined;\n\t\t// @ts-expect-error\n\t\telement_prototype.__e = undefined;\n\t}\n\n\tif (is_extensible(text_prototype)) {\n\t\t/** @type {any} */ (text_prototype)[TEXT_CACHE] = undefined;\n\t}\n\n\tif (DEV) {\n\t\t// @ts-expect-error\n\t\telement_prototype.__svelte_meta = null;\n\n\t\tinit_array_prototype_warnings();\n\t}\n}\n\n/**\n * @param {string} value\n * @returns {Text}\n */\nexport function create_text(value = '') {\n\treturn document.createTextNode(value);\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function get_first_child(node) {\n\treturn /** @type {TemplateNode | null} */ (first_child_getter.call(node));\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function get_next_sibling(node) {\n\treturn /** @type {TemplateNode | null} */ (next_sibling_getter.call(node));\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @template {Node} N\n * @param {N} node\n * @param {boolean} is_text\n * @returns {TemplateNode | null}\n */\nexport function child(node, is_text) {\n\tif (!hydrating) {\n\t\treturn get_first_child(node);\n\t}\n\n\tvar child = get_first_child(hydrate_node);\n\n\t// Child can be null if we have an element with a single child, like `<p>{text}</p>`, where `text` is empty\n\tif (child === null) {\n\t\tchild = hydrate_node.appendChild(create_text());\n\t} else if (is_text && child.nodeType !== TEXT_NODE) {\n\t\tvar text = create_text();\n\t\tchild?.before(text);\n\t\tset_hydrate_node(text);\n\t\treturn text;\n\t}\n\n\tif (is_text) {\n\t\tmerge_text_nodes(/** @type {Text} */ (child));\n\t}\n\n\tset_hydrate_node(child);\n\treturn child;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {TemplateNode} node\n * @param {boolean} [is_text]\n * @returns {TemplateNode | null}\n */\nexport function first_child(node, is_text = false) {\n\tif (!hydrating) {\n\t\tvar first = get_first_child(node);\n\n\t\t// TODO prevent user comments with the empty string when preserveComments is true\n\t\tif (first instanceof Comment && first.data === '') return get_next_sibling(first);\n\n\t\treturn first;\n\t}\n\n\tif (is_text) {\n\t\t// if an {expression} is empty during SSR, there might be no\n\t\t// text node to hydrate — we must therefore create one\n\t\tif (hydrate_node?.nodeType !== TEXT_NODE) {\n\t\t\tvar text = create_text();\n\n\t\t\thydrate_node?.before(text);\n\t\t\tset_hydrate_node(text);\n\t\t\treturn text;\n\t\t}\n\n\t\tmerge_text_nodes(/** @type {Text} */ (hydrate_node));\n\t}\n\n\treturn hydrate_node;\n}\n\n/**\n * `child`, for the very common case of an element with exactly one child. Resetting the\n * hydration cursor is part of the same step, so the compiler doesn't have to emit a\n * separate `reset` call for every `<p>{text}</p>` in an app.\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {TemplateNode} node\n * @param {boolean} [is_text]\n * @returns {TemplateNode | null}\n */\nexport function only_child(node, is_text = false) {\n\tif (!hydrating) {\n\t\treturn get_first_child(node);\n\t}\n\n\tvar first = child(node, is_text);\n\treset(node);\n\n\treturn first;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {TemplateNode} node\n * @param {number} count\n * @param {boolean} is_text\n * @returns {TemplateNode | null}\n */\nexport function sibling(node, count = 1, is_text = false) {\n\tlet next_sibling = hydrating ? hydrate_node : node;\n\tvar last_sibling;\n\n\twhile (count--) {\n\t\tlast_sibling = next_sibling;\n\t\tnext_sibling = /** @type {TemplateNode} */ (get_next_sibling(next_sibling));\n\t}\n\n\tif (!hydrating) {\n\t\treturn next_sibling;\n\t}\n\n\tif (is_text) {\n\t\t// if a sibling {expression} is empty during SSR, there might be no\n\t\t// text node to hydrate — we must therefore create one\n\t\tif (next_sibling?.nodeType !== TEXT_NODE) {\n\t\t\tvar text = create_text();\n\t\t\t// If the next sibling is `null` and we're handling text then it's because\n\t\t\t// the SSR content was empty for the text, so we need to generate a new text\n\t\t\t// node and insert it after the last sibling\n\t\t\tif (next_sibling === null) {\n\t\t\t\tlast_sibling?.after(text);\n\t\t\t} else {\n\t\t\t\tnext_sibling.before(text);\n\t\t\t}\n\t\t\tset_hydrate_node(text);\n\t\t\treturn text;\n\t\t}\n\n\t\tmerge_text_nodes(/** @type {Text} */ (next_sibling));\n\t}\n\n\tset_hydrate_node(next_sibling);\n\treturn next_sibling;\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n * @returns {void}\n */\nexport function clear_text_content(node) {\n\tnode.textContent = '';\n}\n\n/**\n * Returns `true` if we're updating the current block, for example `condition` in\n * an `{#if condition}` block just changed. In this case, the branch should be\n * appended (or removed) at the same time as other updates within the\n * current `<svelte:boundary>`\n */\nexport function should_defer_append() {\n\tif (!async_mode_flag) return false;\n\tif (eager_block_effects !== null) return false;\n\n\tvar flags = /** @type {Effect} */ (active_effect).f;\n\treturn (flags & REACTION_RAN) !== 0;\n}\n\n/**\n * Branching here is intentional and load-bearing for perf. `createElement(tag)`\n * hits a fast path in Blink that `createElementNS(NAMESPACE_HTML, tag)` doesn't,\n * and passing an explicit `undefined` as the trailing options arg measurably\n * slows both APIs. Funnelling every case through a single `createElementNS(ns,\n * tag, options)` call would be smaller but slower on the HTML path.\n *\n * @template {keyof HTMLElementTagNameMap | string} T\n * @param {T} tag\n * @param {string} [namespace]\n * @param {string} [is]\n * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element}\n */\nexport function create_element(tag, namespace, is) {\n\tif (namespace == null || namespace === NAMESPACE_HTML) {\n\t\treturn /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */ (\n\t\t\tis ? document.createElement(tag, { is }) : document.createElement(tag)\n\t\t);\n\t}\n\treturn /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */ (\n\t\tis ? document.createElementNS(namespace, tag, { is }) : document.createElementNS(namespace, tag)\n\t);\n}\n\nexport function create_fragment() {\n\treturn document.createDocumentFragment();\n}\n\n/**\n * @param {string} data\n * @returns\n */\nexport function create_comment(data = '') {\n\treturn document.createComment(data);\n}\n\n/**\n * @param {Element} element\n * @param {string} key\n * @param {string} value\n * @returns\n */\nexport function set_attribute(element, key, value = '') {\n\tif (key.startsWith('xlink:')) {\n\t\telement.setAttributeNS('http://www.w3.org/1999/xlink', key, value);\n\t\treturn;\n\t}\n\treturn element.setAttribute(key, value);\n}\n\n/**\n * Browsers split text nodes larger than 65536 bytes when parsing.\n * For hydration to succeed, we need to stitch them back together\n * @param {Text} text\n */\nexport function merge_text_nodes(text) {\n\tif (/** @type {string} */ (text.nodeValue).length < 65536) {\n\t\treturn;\n\t}\n\n\tlet next = text.nextSibling;\n\n\twhile (next !== null && next.nodeType === TEXT_NODE) {\n\t\tnext.remove();\n\n\t\t/** @type {string} */ (text.nodeValue) += /** @type {string} */ (next.nodeValue);\n\n\t\tnext = text.nextSibling;\n\t}\n}\n","/** @import { Derived, Effect } from '#client' */\n/** @import { Boundary } from './dom/blocks/boundary.js' */\nimport { DEV } from 'esm-env';\nimport { FILENAME } from '../../constants.js';\nimport { is_firefox } from './dom/operations.js';\nimport {\n\tERROR_VALUE,\n\tBOUNDARY_EFFECT,\n\tREACTION_RAN,\n\tEFFECT,\n\tDESTROYED,\n\tDESTROYING\n} from './constants.js';\nimport { define_property, get_descriptor } from '../shared/utils.js';\nimport { active_effect, active_reaction } from './runtime.js';\n\nconst adjustments = new WeakMap();\n\n/**\n * @param {unknown} error\n */\nexport function handle_error(error) {\n\tvar effect = active_effect;\n\n\t// for unowned deriveds, don't throw until we read the value\n\tif (effect === null) {\n\t\t/** @type {Derived} */ (active_reaction).f |= ERROR_VALUE;\n\t\treturn error;\n\t}\n\n\tif (DEV && error instanceof Error && !adjustments.has(error)) {\n\t\tadjustments.set(error, get_adjustments(error, effect));\n\t}\n\n\t// if the error occurred while creating this subtree, we let it\n\t// bubble up until it hits a boundary that can handle it, unless\n\t// it's an $effect in which case it doesn't run immediately\n\tif ((effect.f & REACTION_RAN) === 0 && (effect.f & EFFECT) === 0) {\n\t\tif (DEV && !effect.parent && error instanceof Error) {\n\t\t\tapply_adjustments(error);\n\t\t}\n\n\t\tthrow error;\n\t}\n\n\t// otherwise we bubble up the effect tree ourselves\n\tinvoke_error_boundary(error, effect);\n}\n\n/**\n * @param {unknown} error\n * @param {Effect | null} effect\n */\nexport function invoke_error_boundary(error, effect) {\n\tif (effect !== null && (effect.f & DESTROYED) !== 0) {\n\t\treturn;\n\t}\n\n\twhile (effect !== null) {\n\t\t// Skip boundaries that are destroyed/destroying and cannot meaningfully handle the error.\n\t\tif ((effect.f & BOUNDARY_EFFECT) !== 0 && (effect.f & (DESTROYED | DESTROYING)) === 0) {\n\t\t\tif ((effect.f & REACTION_RAN) === 0) {\n\t\t\t\t// we are still creating the boundary effect\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t/** @type {Boundary} */ (effect.b).error(error);\n\t\t\t\treturn;\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\t\t}\n\n\t\teffect = effect.parent;\n\t}\n\n\tif (DEV && error instanceof Error) {\n\t\tapply_adjustments(error);\n\t}\n\n\tthrow error;\n}\n\n/**\n * Add useful information to the error message/stack in development\n * @param {Error} error\n * @param {Effect} effect\n */\nfunction get_adjustments(error, effect) {\n\tconst message_descriptor = get_descriptor(error, 'message');\n\n\t// if the message was already changed and it's not configurable we can't change it\n\t// or it will throw a different error swallowing the original error\n\tif (message_descriptor && !message_descriptor.configurable) return;\n\n\tvar indent = is_firefox ? ' ' : '\\t';\n\tvar component_stack = `\\n${indent}in ${effect.fn?.name || '<unknown>'}`;\n\tvar context = effect.ctx;\n\n\twhile (context !== null) {\n\t\tcomponent_stack += `\\n${indent}in ${context.function?.[FILENAME].split('/').pop()}`;\n\t\tcontext = context.p;\n\t}\n\n\treturn {\n\t\tmessage: error.message + `\\n${component_stack}\\n`,\n\t\tstack: error.stack\n\t\t\t?.split('\\n')\n\t\t\t.filter((line) => !line.includes('svelte/src/internal'))\n\t\t\t.join('\\n')\n\t};\n}\n\n/**\n * @param {Error} error\n */\nfunction apply_adjustments(error) {\n\tconst adjusted = adjustments.get(error);\n\n\tif (adjusted) {\n\t\tdefine_property(error, 'message', {\n\t\t\tvalue: adjusted.message\n\t\t});\n\n\t\tdefine_property(error, 'stack', {\n\t\t\tvalue: adjusted.stack\n\t\t});\n\t}\n}\n","/** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */\nimport {\n\tis_dirty,\n\tactive_effect,\n\tactive_reaction,\n\tupdate_effect,\n\tget,\n\tis_destroying_effect,\n\tremove_reactions,\n\tset_active_reaction,\n\tset_is_destroying_effect,\n\tuntrack,\n\tuntracking,\n\tset_active_effect\n} from '../runtime.js';\nimport {\n\tDIRTY,\n\tBRANCH_EFFECT,\n\tRENDER_EFFECT,\n\tEFFECT,\n\tDESTROYED,\n\tINERT,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tEFFECT_TRANSPARENT,\n\tDERIVED,\n\tCLEAN,\n\tEAGER_EFFECT,\n\tHEAD_EFFECT,\n\tMAYBE_DIRTY,\n\tEFFECT_PRESERVED,\n\tSTALE_REACTION,\n\tUSER_EFFECT,\n\tASYNC,\n\tCONNECTED,\n\tMANAGED_EFFECT,\n\tDESTROYING,\n\tPAUSED\n} from '#client/constants';\nimport { invoke_error_boundary } from '../error-handling.js';\nimport * as e from '../errors.js';\nimport { DEV } from 'esm-env';\nimport { define_property } from '../../shared/utils.js';\nimport { get_next_sibling } from '../dom/operations.js';\nimport { component_context, dev_current_component_function, dev_stack } from '../context.js';\nimport { Batch, collected_effects, current_batch } from './batch.js';\nimport { flatten } from './async.js';\nimport { without_reactive_context } from '../dom/elements/bindings/shared.js';\nimport { set_signal_status } from './status.js';\n\n/**\n * @param {'$effect' | '$effect.pre' | '$inspect'} rune\n */\nexport function validate_effect(rune) {\n\tif (active_effect === null) {\n\t\tif (active_reaction === null) {\n\t\t\te.effect_orphan(rune);\n\t\t}\n\n\t\te.effect_in_unowned_derived();\n\t}\n\n\tif (is_destroying_effect) {\n\t\te.effect_in_teardown(rune);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {Effect} parent_effect\n */\nfunction push_effect(effect, parent_effect) {\n\tvar parent_last = parent_effect.last;\n\tif (parent_last === null) {\n\t\tparent_effect.last = parent_effect.first = effect;\n\t} else {\n\t\tparent_last.next = effect;\n\t\teffect.prev = parent_last;\n\t\tparent_effect.last = effect;\n\t}\n}\n\n/**\n * @param {number} type\n * @param {null | (() => void | (() => void))} fn\n * @returns {Effect}\n */\nfunction create_effect(type, fn) {\n\tvar parent = active_effect;\n\n\tif (DEV) {\n\t\t// Ensure the parent is never an inspect effect\n\t\twhile (parent !== null && (parent.f & EAGER_EFFECT) !== 0) {\n\t\t\tparent = parent.parent;\n\t\t}\n\t}\n\n\tif (parent !== null && (parent.f & INERT) !== 0) {\n\t\ttype |= INERT;\n\t}\n\n\t/** @type {Effect} */\n\tvar effect = {\n\t\tctx: component_context,\n\t\tdeps: null,\n\t\tnodes: null,\n\t\tf: type | DIRTY | CONNECTED,\n\t\tfirst: null,\n\t\tfn,\n\t\tlast: null,\n\t\tnext: null,\n\t\tparent,\n\t\tb: parent && parent.b,\n\t\tprev: null,\n\t\tteardown: null,\n\t\twv: 0,\n\t\tac: null\n\t};\n\n\tif (DEV) {\n\t\teffect.component_function = dev_current_component_function;\n\t}\n\n\tcurrent_batch?.register_created_effect(effect);\n\n\t/** @type {Effect | null} */\n\tvar e = effect;\n\n\tif ((type & EFFECT) !== 0) {\n\t\tif (collected_effects !== null) {\n\t\t\t// created during traversal — collect and run afterwards\n\t\t\tcollected_effects.push(effect);\n\t\t} else {\n\t\t\t// schedule for later\n\t\t\tBatch.ensure().schedule(effect);\n\t\t}\n\t} else if (fn !== null) {\n\t\ttry {\n\t\t\tupdate_effect(effect);\n\t\t} catch (e) {\n\t\t\tdestroy_effect(effect);\n\t\t\tthrow e;\n\t\t}\n\n\t\t// if an effect doesn't need to be kept in the tree (because it\n\t\t// won't re-run, has no DOM, and has no teardown etc)\n\t\t// then we skip it and go to its child (if any)\n\t\tif (\n\t\t\te.deps === null &&\n\t\t\te.teardown === null &&\n\t\t\te.nodes === null &&\n\t\t\te.first === e.last && // either `null`, or a singular child\n\t\t\t(e.f & EFFECT_PRESERVED) === 0\n\t\t) {\n\t\t\te = e.first;\n\t\t\tif ((type & BLOCK_EFFECT) !== 0 && (type & EFFECT_TRANSPARENT) !== 0 && e !== null) {\n\t\t\t\te.f |= EFFECT_TRANSPARENT;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (e !== null) {\n\t\te.parent = parent;\n\n\t\tif (parent !== null) {\n\t\t\tpush_effect(e, parent);\n\t\t}\n\n\t\t// if we're in a derived, add the effect there too\n\t\tif (\n\t\t\tactive_reaction !== null &&\n\t\t\t(active_reaction.f & DERIVED) !== 0 &&\n\t\t\t(type & ROOT_EFFECT) === 0\n\t\t) {\n\t\t\tvar derived = /** @type {Derived} */ (active_reaction);\n\t\t\t(derived.effects ??= []).push(e);\n\t\t}\n\t}\n\n\treturn effect;\n}\n\n/**\n * Internal representation of `$effect.tracking()`\n * @returns {boolean}\n */\nexport function effect_tracking() {\n\treturn active_reaction !== null && !untracking;\n}\n\n/**\n * @param {() => void} fn\n */\nexport function teardown(fn) {\n\tconst effect = create_effect(RENDER_EFFECT, null);\n\tset_signal_status(effect, CLEAN);\n\teffect.teardown = fn;\n\treturn effect;\n}\n\n/**\n * Internal representation of `$effect(...)`\n * @param {() => void | (() => void)} fn\n */\nexport function user_effect(fn) {\n\tvalidate_effect('$effect');\n\n\tif (DEV) {\n\t\tdefine_property(fn, 'name', {\n\t\t\tvalue: '$effect'\n\t\t});\n\t}\n\n\t// Non-nested `$effect(...)` in a component should be deferred\n\t// until the component is mounted\n\tvar flags = /** @type {Effect} */ (active_effect).f;\n\tvar defer =\n\t\t!active_reaction &&\n\t\t(flags & BRANCH_EFFECT) !== 0 &&\n\t\tcomponent_context !== null &&\n\t\t!component_context.i;\n\n\tif (defer) {\n\t\t// Top-level `$effect(...)` in an unmounted component — defer until mount\n\t\tvar context = /** @type {ComponentContext} */ (component_context);\n\t\t(context.e ??= []).push(fn);\n\t} else {\n\t\t// Everything else — create immediately\n\t\treturn create_user_effect(fn);\n\t}\n}\n\n/**\n * @param {() => void | (() => void)} fn\n */\nexport function create_user_effect(fn) {\n\treturn create_effect(EFFECT | USER_EFFECT, fn);\n}\n\n/**\n * Internal representation of `$effect.pre(...)`\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function user_pre_effect(fn) {\n\tvalidate_effect('$effect.pre');\n\tif (DEV) {\n\t\tdefine_property(fn, 'name', {\n\t\t\tvalue: '$effect.pre'\n\t\t});\n\t}\n\treturn create_effect(RENDER_EFFECT | USER_EFFECT, fn);\n}\n\n/** @param {() => void | (() => void)} fn */\nexport function eager_effect(fn) {\n\treturn create_effect(EAGER_EFFECT, fn);\n}\n\n/**\n * Internal representation of `$effect.root(...)`\n * @param {() => void | (() => void)} fn\n * @returns {() => void}\n */\nexport function effect_root(fn) {\n\tBatch.ensure();\n\tconst effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn);\n\n\treturn () => {\n\t\tdestroy_effect(effect);\n\t};\n}\n\n/**\n * An effect root whose children can transition out\n * @param {() => void} fn\n * @returns {(options?: { outro?: boolean }) => Promise<void>}\n */\nexport function component_root(fn) {\n\tBatch.ensure();\n\tconst effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn);\n\n\treturn (options = {}) => {\n\t\treturn new Promise((fulfil) => {\n\t\t\tif (options.outro) {\n\t\t\t\tpause_effect(effect, () => {\n\t\t\t\t\tdestroy_effect(effect);\n\t\t\t\t\tfulfil(undefined);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tdestroy_effect(effect);\n\t\t\t\tfulfil(undefined);\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function effect(fn) {\n\treturn create_effect(EFFECT, fn);\n}\n\n/**\n * Internal representation of `$: ..`\n * @param {() => any} deps\n * @param {() => void | (() => void)} fn\n */\nexport function legacy_pre_effect(deps, fn) {\n\tvar context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\t/** @type {{ effect: null | Effect, ran: boolean, deps: () => any }} */\n\tvar token = { effect: null, ran: false, deps };\n\n\tcontext.l.$.push(token);\n\n\ttoken.effect = render_effect(() => {\n\t\tdeps();\n\n\t\t// If this legacy pre effect has already run before the end of the reset, then\n\t\t// bail out to emulate the same behavior.\n\t\tif (token.ran) return;\n\n\t\ttoken.ran = true;\n\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t// here, we lie: by setting `active_effect` to be the parent branch, any writes\n\t\t// that happen inside `fn` will _not_ cause an unnecessary reschedule, because\n\t\t// the affected effects will be children of `active_effect`. this is safe\n\t\t// because these effects are known to run in the correct order\n\t\ttry {\n\t\t\tset_active_effect(effect.parent);\n\t\t\tuntrack(fn);\n\t\t} finally {\n\t\t\tset_active_effect(effect);\n\t\t}\n\t});\n}\n\nexport function legacy_pre_effect_reset() {\n\tvar context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\trender_effect(() => {\n\t\t// Run dirty `$:` statements\n\t\tfor (var token of context.l.$) {\n\t\t\ttoken.deps();\n\n\t\t\tvar effect = token.effect;\n\n\t\t\t// If the effect is CLEAN, then make it MAYBE_DIRTY. This ensures we traverse through\n\t\t\t// the effects dependencies and correctly ensure each dependency is up-to-date.\n\t\t\tif ((effect.f & CLEAN) !== 0 && effect.deps !== null) {\n\t\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t\t}\n\n\t\t\tif (is_dirty(effect)) {\n\t\t\t\tupdate_effect(effect);\n\t\t\t}\n\n\t\t\ttoken.ran = false;\n\t\t}\n\t});\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function async_effect(fn) {\n\treturn create_effect(ASYNC | EFFECT_PRESERVED, fn);\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function render_effect(fn, flags = 0) {\n\treturn create_effect(RENDER_EFFECT | flags, fn);\n}\n\n/**\n * @param {(...expressions: any) => void | (() => void)} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n */\nexport function template_effect(fn, sync = [], async = [], blockers = []) {\n\tflatten(blockers, sync, async, (values) => {\n\t\tcreate_effect(RENDER_EFFECT, () => {\n\t\t\tfn(...values.map(get));\n\t\t});\n\t});\n}\n\n/**\n * Like `template_effect`, but with an effect which is deferred until the batch commits\n * @param {(...expressions: any) => void | (() => void)} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n */\nexport function deferred_template_effect(fn, sync = [], async = [], blockers = []) {\n\tflatten(blockers, sync, async, (values) => {\n\t\tcreate_effect(EFFECT, () => fn(...values.map(get)));\n\t});\n}\n\n/**\n * @param {(() => void)} fn\n * @param {number} flags\n */\nexport function block(fn, flags = 0) {\n\tvar effect = create_effect(BLOCK_EFFECT | flags, fn);\n\tif (DEV) {\n\t\teffect.dev_stack = dev_stack;\n\t}\n\treturn effect;\n}\n\n/**\n * @param {(() => void)} fn\n * @param {number} flags\n */\nexport function managed(fn, flags = 0) {\n\tvar effect = create_effect(MANAGED_EFFECT | flags, fn);\n\tif (DEV) {\n\t\teffect.dev_stack = dev_stack;\n\t}\n\treturn effect;\n}\n\n/**\n * @param {(() => void)} fn\n */\nexport function branch(fn) {\n\treturn create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn);\n}\n\n/**\n * @param {Effect} effect\n */\nexport function execute_effect_teardown(effect) {\n\tvar teardown = effect.teardown;\n\tif (teardown !== null) {\n\t\tconst previously_destroying_effect = is_destroying_effect;\n\t\tconst previous_reaction = active_reaction;\n\t\tset_is_destroying_effect(true);\n\t\tset_active_reaction(null);\n\t\ttry {\n\t\t\tteardown.call(null);\n\t\t} catch (error) {\n\t\t\t// Route teardown errors through the boundary system so that a live\n\t\t\t// ancestor <svelte:boundary> can handle them. Boundaries that are\n\t\t\t// themselves mid-teardown are skipped by invoke_error_boundary.\n\t\t\tinvoke_error_boundary(error, effect.parent);\n\t\t} finally {\n\t\t\tset_is_destroying_effect(previously_destroying_effect);\n\t\t\tset_active_reaction(previous_reaction);\n\t\t}\n\t}\n}\n\n/**\n * @param {Effect} signal\n * @param {boolean} remove_dom\n * @returns {void}\n */\nexport function destroy_effect_children(signal, remove_dom = false) {\n\tvar effect = signal.first;\n\tsignal.first = signal.last = null;\n\n\twhile (effect !== null) {\n\t\tconst controller = effect.ac;\n\n\t\tif (controller !== null) {\n\t\t\twithout_reactive_context(() => {\n\t\t\t\tcontroller.abort(STALE_REACTION);\n\t\t\t});\n\t\t}\n\n\t\tvar next = effect.next;\n\n\t\tif ((effect.f & ROOT_EFFECT) !== 0) {\n\t\t\t// this is now an independent root\n\t\t\teffect.parent = null;\n\t\t} else {\n\t\t\tdestroy_effect(effect, remove_dom);\n\t\t}\n\n\t\teffect = next;\n\t}\n}\n\n/**\n * @param {Effect} signal\n * @returns {void}\n */\nexport function destroy_block_effect_children(signal) {\n\tvar effect = signal.first;\n\n\twhile (effect !== null) {\n\t\tvar next = effect.next;\n\t\tif ((effect.f & BRANCH_EFFECT) === 0) {\n\t\t\tdestroy_effect(effect);\n\t\t}\n\t\teffect = next;\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {boolean} [remove_dom]\n * @returns {void}\n */\nexport function destroy_effect(effect, remove_dom = true) {\n\tvar removed = false;\n\n\tif (\n\t\t(remove_dom || (effect.f & HEAD_EFFECT) !== 0) &&\n\t\teffect.nodes !== null &&\n\t\teffect.nodes.end !== null\n\t) {\n\t\tremove_effect_dom(effect.nodes.start, /** @type {TemplateNode} */ (effect.nodes.end));\n\t\tremoved = true;\n\t}\n\n\teffect.f |= DESTROYING;\n\tdestroy_effect_children(effect, remove_dom && !removed);\n\tremove_reactions(effect, 0);\n\n\tvar transitions = effect.nodes && effect.nodes.t;\n\n\tif (transitions !== null) {\n\t\tfor (const transition of transitions) {\n\t\t\ttransition.stop();\n\t\t}\n\t}\n\n\texecute_effect_teardown(effect);\n\n\teffect.f ^= DESTROYING;\n\teffect.f |= DESTROYED;\n\n\tvar parent = effect.parent;\n\n\t// If the parent doesn't have any children, then skip this work altogether\n\tif (parent !== null && parent.first !== null) {\n\t\tunlink_effect(effect);\n\t}\n\n\tif (DEV) {\n\t\teffect.component_function = null;\n\t}\n\n\t// `first` and `child` are nulled out in destroy_effect_children\n\t// we don't null out `parent` so that error propagation can work correctly\n\teffect.next =\n\t\teffect.prev =\n\t\teffect.teardown =\n\t\teffect.ctx =\n\t\teffect.deps =\n\t\teffect.fn =\n\t\teffect.nodes =\n\t\teffect.ac =\n\t\teffect.b =\n\t\t\tnull;\n}\n\n/**\n *\n * @param {TemplateNode | null} node\n * @param {TemplateNode} end\n */\nexport function remove_effect_dom(node, end) {\n\twhile (node !== null) {\n\t\t/** @type {TemplateNode | null} */\n\t\tvar next = node === end ? null : get_next_sibling(node);\n\n\t\tnode.remove();\n\t\tnode = next;\n\t}\n}\n\n/**\n * Detach an effect from the effect tree, freeing up memory and\n * reducing the amount of work that happens on subsequent traversals\n * @param {Effect} effect\n */\nexport function unlink_effect(effect) {\n\tvar parent = effect.parent;\n\tvar prev = effect.prev;\n\tvar next = effect.next;\n\n\tif (prev !== null) prev.next = next;\n\tif (next !== null) next.prev = prev;\n\n\tif (parent !== null) {\n\t\tif (parent.first === effect) parent.first = next;\n\t\tif (parent.last === effect) parent.last = prev;\n\t}\n}\n\n/**\n * When a block effect is removed, we don't immediately destroy it or yank it\n * out of the DOM, because it might have transitions. Instead, we 'pause' it.\n * It stays around (in memory, and in the DOM) until outro transitions have\n * completed, and if the state change is reversed then we _resume_ it.\n * A paused effect does not update, and the DOM subtree becomes inert.\n * @param {Effect} effect\n * @param {() => void} [callback]\n * @param {boolean} [destroy]\n */\nexport function pause_effect(effect, callback, destroy = true) {\n\t/** @type {TransitionManager[]} */\n\tvar transitions = [];\n\n\teffect.f |= PAUSED;\n\tpause_children(effect, transitions, true);\n\n\tvar fn = () => {\n\t\tif (destroy) destroy_effect(effect);\n\t\tif (callback) callback();\n\t};\n\n\tvar remaining = transitions.length;\n\tif (remaining > 0) {\n\t\tvar check = () => --remaining || fn();\n\t\tfor (var transition of transitions) {\n\t\t\ttransition.out(check);\n\t\t}\n\t} else {\n\t\tfn();\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {TransitionManager[]} transitions\n * @param {boolean} local\n */\nfunction pause_children(effect, transitions, local) {\n\tif ((effect.f & INERT) !== 0) return;\n\teffect.f ^= INERT;\n\n\tvar t = effect.nodes && effect.nodes.t;\n\n\tif (t !== null) {\n\t\tfor (const transition of t) {\n\t\t\tif (transition.is_global || local) {\n\t\t\t\ttransitions.push(transition);\n\t\t\t}\n\t\t}\n\t}\n\n\tvar child = effect.first;\n\n\twhile (child !== null) {\n\t\tvar sibling = child.next;\n\n\t\t// If this child is a root effect, then it will become an independent root when its parent\n\t\t// is destroyed, it should therefore not become inert nor partake in transitions.\n\t\tif ((child.f & ROOT_EFFECT) === 0) {\n\t\t\tvar transparent =\n\t\t\t\t(child.f & EFFECT_TRANSPARENT) !== 0 ||\n\t\t\t\t// If this is a branch effect without a block effect parent,\n\t\t\t\t// it means the parent block effect was pruned. In that case,\n\t\t\t\t// transparency information was transferred to the branch effect.\n\t\t\t\t((child.f & BRANCH_EFFECT) !== 0 && (effect.f & BLOCK_EFFECT) !== 0);\n\t\t\t// TODO we don't need to call pause_children recursively with a linked list in place\n\t\t\t// it's slightly more involved though as we have to account for `transparent` changing\n\t\t\t// through the tree.\n\t\t\tpause_children(child, transitions, transparent ? local : false);\n\t\t}\n\n\t\tchild = sibling;\n\t}\n}\n\n/**\n * The opposite of `pause_effect`. We call this if (for example)\n * `x` becomes falsy then truthy: `{#if x}...{/if}`\n * @param {Effect} effect\n */\nexport function resume_effect(effect) {\n\teffect.f &= ~PAUSED;\n\tresume_children(effect, true);\n}\n\n/**\n * @param {Effect} effect\n * @param {boolean} local\n */\nfunction resume_children(effect, local) {\n\t// this subtree was paused for its own reasons (e.g. a block whose condition\n\t// is still false) — its controller will resume or destroy it\n\tif ((effect.f & PAUSED) !== 0) return;\n\n\tif ((effect.f & INERT) === 0) return;\n\teffect.f ^= INERT;\n\n\t// If a dependency of this effect changed while it was paused,\n\t// schedule the effect to update. we don't use `is_dirty`\n\t// here because we don't want to eagerly recompute a derived like\n\t// `{#if foo}{foo.bar()}{/if}` if `foo` is now `undefined\n\tif ((effect.f & CLEAN) === 0) {\n\t\tset_signal_status(effect, DIRTY);\n\t\tBatch.ensure().schedule(effect); // Assumption: This happens during the commit phase of the batch, causing another flush, but it's safe\n\t}\n\n\tvar child = effect.first;\n\n\twhile (child !== null) {\n\t\tvar sibling = child.next;\n\t\tvar transparent = (child.f & EFFECT_TRANSPARENT) !== 0 || (child.f & BRANCH_EFFECT) !== 0;\n\t\t// TODO we don't need to call resume_children recursively with a linked list in place\n\t\t// it's slightly more involved though as we have to account for `transparent` changing\n\t\t// through the tree.\n\t\tresume_children(child, transparent ? local : false);\n\t\tchild = sibling;\n\t}\n\n\tvar t = effect.nodes && effect.nodes.t;\n\n\tif (t !== null) {\n\t\tfor (const transition of t) {\n\t\t\tif (transition.is_global || local) {\n\t\t\t\ttransition.in();\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function aborted(effect = /** @type {Effect} */ (active_effect)) {\n\treturn (effect.f & DESTROYED) !== 0;\n}\n\n/**\n * @param {Effect} effect\n * @param {DocumentFragment} fragment\n */\nexport function move_effect(effect, fragment) {\n\tif (!effect.nodes) return;\n\n\t/** @type {TemplateNode | null} */\n\tvar node = effect.nodes.start;\n\tvar end = effect.nodes.end;\n\n\twhile (node !== null) {\n\t\t/** @type {TemplateNode | null} */\n\t\tvar next = node === end ? null : get_next_sibling(node);\n\n\t\tfragment.append(node);\n\t\tnode = next;\n\t}\n}\n","/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */\nimport { DEV } from 'esm-env';\nimport { get_descriptors, get_prototype_of, includes, index_of } from '../shared/utils.js';\nimport {\n\tdestroy_block_effect_children,\n\tdestroy_effect_children,\n\teffect_tracking,\n\texecute_effect_teardown\n} from './reactivity/effects.js';\nimport {\n\tDIRTY,\n\tMAYBE_DIRTY,\n\tCLEAN,\n\tDERIVED,\n\tDESTROYED,\n\tBRANCH_EFFECT,\n\tSTATE_SYMBOL,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tCONNECTED,\n\tREACTION_IS_UPDATING,\n\tSTALE_REACTION,\n\tERROR_VALUE,\n\tWAS_MARKED,\n\tMANAGED_EFFECT,\n\tREACTION_RAN\n} from './constants.js';\nimport { old_values } from './reactivity/sources.js';\nimport {\n\treactivity_loss_tracker,\n\texecute_derived,\n\tfreeze_derived_effects,\n\trecent_async_deriveds,\n\tunfreeze_derived_effects,\n\tupdate_derived\n} from './reactivity/deriveds.js';\nimport { async_mode_flag, tracing_mode_flag } from '../flags/index.js';\nimport { tracing_expressions } from './dev/tracing.js';\nimport { get_error } from '../shared/dev.js';\nimport {\n\tcomponent_context,\n\tdev_current_component_function,\n\tdev_stack,\n\tis_runes,\n\tset_component_context,\n\tset_dev_current_component_function,\n\tset_dev_stack\n} from './context.js';\nimport {\n\tBatch,\n\tbatch_values,\n\tcurrent_batch,\n\tflushSync,\n\tprevious_batch,\n\tschedule_effect\n} from './reactivity/batch.js';\nimport { handle_error } from './error-handling.js';\nimport { UNINITIALIZED } from '../../constants.js';\nimport { captured_signals } from './legacy.js';\nimport { without_reactive_context } from './dom/elements/bindings/shared.js';\nimport { set_signal_status, update_derived_status } from './reactivity/status.js';\nimport * as w from './warnings.js';\n\n/**\n * True if updating in an effect context that is reactive (i.e. not branch/root effects)\n */\nlet is_updating_effect = false;\n\nexport let is_destroying_effect = false;\n\n/** @param {boolean} value */\nexport function set_is_destroying_effect(value) {\n\tis_destroying_effect = value;\n}\n\n/** @type {null | Reaction} */\nexport let active_reaction = null;\n\nexport let untracking = false;\n\n/** @param {null | Reaction} reaction */\nexport function set_active_reaction(reaction) {\n\tactive_reaction = reaction;\n}\n\n/** @type {null | Effect} */\nexport let active_effect = null;\n\n/** @param {null | Effect} effect */\nexport function set_active_effect(effect) {\n\tactive_effect = effect;\n}\n\n/**\n * When sources are created within a reaction, reading and writing\n * them within that reaction should not cause a re-run\n * @type {null | Set<Source>}\n */\nexport let current_sources = null;\n\n/** @param {Value} value */\nexport function push_reaction_value(value) {\n\tif (active_reaction !== null && (!async_mode_flag || (active_reaction.f & DERIVED) !== 0)) {\n\t\t(current_sources ??= new Set()).add(value);\n\t}\n}\n\n/**\n * The dependencies of the reaction that is currently being executed. In many cases,\n * the dependencies are unchanged between runs, and so this will be `null` unless\n * and until a new dependency is accessed — we track this via `skipped_deps`\n * @type {null | Value[]}\n */\nexport let new_deps = null;\n\nexport let skipped_deps = 0;\n\n/**\n * Tracks writes that the effect it's executed in doesn't listen to yet,\n * so that the dependency can be added to the effect later on if it then reads it\n * @type {null | Source[]}\n */\nexport let untracked_writes = null;\n\n/** @param {null | Source[]} value */\nexport function set_untracked_writes(value) {\n\tuntracked_writes = value;\n}\n\n/**\n * @type {number} Used by sources and deriveds for handling updates.\n * Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing\n **/\nexport let write_version = 1;\n\n/** @type {number} Used to version each read of a source of derived to avoid duplicating dependencies inside a reaction */\nlet read_version = 0;\n\nexport let update_version = read_version;\n\n/** @param {number} value */\nexport function set_update_version(value) {\n\tupdate_version = value;\n}\n\nexport function increment_write_version() {\n\treturn ++write_version;\n}\n\n/**\n * Determines whether a derived or effect is dirty.\n * If it is MAYBE_DIRTY, will set the status to CLEAN\n * @param {Reaction} reaction\n * @returns {boolean}\n */\nexport function is_dirty(reaction) {\n\tvar flags = reaction.f;\n\n\tif ((flags & DIRTY) !== 0) {\n\t\treturn true;\n\t}\n\n\tif (flags & DERIVED) {\n\t\treaction.f &= ~WAS_MARKED;\n\t}\n\n\tif ((flags & MAYBE_DIRTY) !== 0) {\n\t\tvar dependencies = /** @type {Value[]} */ (reaction.deps);\n\t\tvar length = dependencies.length;\n\n\t\tfor (var i = 0; i < length; i++) {\n\t\t\tvar dependency = dependencies[i];\n\n\t\t\tif (is_dirty(/** @type {Derived} */ (dependency))) {\n\t\t\t\tupdate_derived(/** @type {Derived} */ (dependency));\n\t\t\t}\n\n\t\t\tif (dependency.wv > reaction.wv) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t(flags & CONNECTED) !== 0 &&\n\t\t\t// During time traveling we don't want to reset the status so that\n\t\t\t// traversal of the graph in the other batches still happens\n\t\t\tbatch_values === null\n\t\t) {\n\t\t\tset_signal_status(reaction, CLEAN);\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * @param {Value} signal\n * @param {Effect} effect\n * @param {boolean} [root]\n */\nfunction schedule_possible_effect_self_invalidation(signal, effect, root = true) {\n\tvar reactions = signal.reactions;\n\tif (reactions === null) return;\n\n\tif (!async_mode_flag && current_sources !== null && current_sources.has(signal)) {\n\t\treturn;\n\t}\n\n\tfor (var i = 0; i < reactions.length; i++) {\n\t\tvar reaction = reactions[i];\n\n\t\tif ((reaction.f & DERIVED) !== 0) {\n\t\t\tschedule_possible_effect_self_invalidation(/** @type {Derived} */ (reaction), effect, false);\n\t\t} else if (effect === reaction) {\n\t\t\tif (root) {\n\t\t\t\tset_signal_status(reaction, DIRTY);\n\t\t\t} else if ((reaction.f & CLEAN) !== 0) {\n\t\t\t\tset_signal_status(reaction, MAYBE_DIRTY);\n\t\t\t}\n\t\t\tschedule_effect(/** @type {Effect} */ (reaction));\n\t\t}\n\t}\n}\n\n/** @param {Reaction} reaction */\nexport function update_reaction(reaction) {\n\tvar previous_deps = new_deps;\n\tvar previous_skipped_deps = skipped_deps;\n\tvar previous_untracked_writes = untracked_writes;\n\tvar previous_reaction = active_reaction;\n\tvar previous_sources = current_sources;\n\tvar previous_component_context = component_context;\n\tvar previous_untracking = untracking;\n\tvar previous_update_version = update_version;\n\n\tvar flags = reaction.f;\n\n\tnew_deps = /** @type {null | Value[]} */ (null);\n\tskipped_deps = 0;\n\tuntracked_writes = null;\n\tactive_reaction = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) === 0 ? reaction : null;\n\n\tcurrent_sources = null;\n\tset_component_context(reaction.ctx);\n\tuntracking = false;\n\tupdate_version = ++read_version;\n\n\tif (reaction.ac !== null) {\n\t\twithout_reactive_context(() => {\n\t\t\t/** @type {AbortController} */ (reaction.ac).abort(STALE_REACTION);\n\t\t});\n\n\t\treaction.ac = null;\n\t}\n\n\ttry {\n\t\treaction.f |= REACTION_IS_UPDATING;\n\t\tvar fn = /** @type {Function} */ (reaction.fn);\n\t\tvar result = fn();\n\t\treaction.f |= REACTION_RAN;\n\t\tvar deps = update_dependencies(reaction);\n\n\t\t// If we're inside an effect and we have untracked writes, then we need to\n\t\t// ensure that if any of those untracked writes result in re-invalidation\n\t\t// of the current effect, then that happens accordingly\n\t\tif (\n\t\t\tis_runes() &&\n\t\t\tuntracked_writes !== null &&\n\t\t\t!untracking &&\n\t\t\tdeps !== null &&\n\t\t\t(reaction.f & (DERIVED | MAYBE_DIRTY | DIRTY)) === 0\n\t\t) {\n\t\t\tfor (var i = 0; i < /** @type {Source[]} */ (untracked_writes).length; i++) {\n\t\t\t\tschedule_possible_effect_self_invalidation(\n\t\t\t\t\tuntracked_writes[i],\n\t\t\t\t\t/** @type {Effect} */ (reaction)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// If we are returning to an previous reaction then\n\t\t// we need to increment the read version to ensure that\n\t\t// any dependencies in this reaction aren't marked with\n\t\t// the same version\n\t\tif (previous_reaction !== null && previous_reaction !== reaction) {\n\t\t\tread_version++;\n\n\t\t\t// update the `rv` of the previous reaction's deps — both existing and new —\n\t\t\t// so that they are not added again\n\t\t\tif (previous_reaction.deps !== null) {\n\t\t\t\tfor (let i = 0; i < previous_skipped_deps; i += 1) {\n\t\t\t\t\tprevious_reaction.deps[i].rv = read_version;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (previous_deps !== null) {\n\t\t\t\tfor (const dep of previous_deps) {\n\t\t\t\t\tdep.rv = read_version;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (untracked_writes !== null) {\n\t\t\t\tif (previous_untracked_writes === null) {\n\t\t\t\t\tprevious_untracked_writes = untracked_writes;\n\t\t\t\t} else {\n\t\t\t\t\tprevious_untracked_writes.push(.../** @type {Source[]} */ (untracked_writes));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ((reaction.f & ERROR_VALUE) !== 0) {\n\t\t\treaction.f ^= ERROR_VALUE;\n\t\t}\n\n\t\treturn result;\n\t} catch (error) {\n\t\t// still commit the deps read before the throw, otherwise deriveds connected by this run keep no reader and the reaction never re-runs when they change\n\t\tupdate_dependencies(reaction);\n\n\t\treturn handle_error(error);\n\t} finally {\n\t\treaction.f ^= REACTION_IS_UPDATING;\n\t\tnew_deps = previous_deps;\n\t\tskipped_deps = previous_skipped_deps;\n\t\tuntracked_writes = previous_untracked_writes;\n\t\tactive_reaction = previous_reaction;\n\t\tcurrent_sources = previous_sources;\n\t\tset_component_context(previous_component_context);\n\t\tuntracking = previous_untracking;\n\t\tupdate_version = previous_update_version;\n\t}\n}\n\n/**\n * @param {Reaction} reaction\n */\nfunction update_dependencies(reaction) {\n\tvar deps = reaction.deps;\n\n\t// Don't remove reactions during fork;\n\t// they must remain for when fork is discarded\n\tvar is_fork = current_batch?.is_fork;\n\n\tif (new_deps !== null) {\n\t\tvar i;\n\n\t\tif (!is_fork) {\n\t\t\tremove_reactions(reaction, skipped_deps);\n\t\t}\n\n\t\tif (deps !== null && skipped_deps > 0) {\n\t\t\tdeps.length = skipped_deps + new_deps.length;\n\t\t\tfor (i = 0; i < new_deps.length; i++) {\n\t\t\t\tdeps[skipped_deps + i] = new_deps[i];\n\t\t\t}\n\t\t} else {\n\t\t\treaction.deps = deps = new_deps;\n\t\t}\n\n\t\tif (effect_tracking() && (reaction.f & CONNECTED) !== 0) {\n\t\t\tfor (i = skipped_deps; i < deps.length; i++) {\n\t\t\t\t(deps[i].reactions ??= []).push(reaction);\n\t\t\t}\n\t\t}\n\t} else if (!is_fork && deps !== null && skipped_deps < deps.length) {\n\t\tremove_reactions(reaction, skipped_deps);\n\t\tdeps.length = skipped_deps;\n\t}\n\n\treturn deps;\n}\n\n/**\n * @template V\n * @param {Reaction} signal\n * @param {Value<V>} dependency\n * @returns {void}\n */\nfunction remove_reaction(signal, dependency) {\n\tlet reactions = dependency.reactions;\n\tif (reactions !== null) {\n\t\tvar index = index_of.call(reactions, signal);\n\t\tif (index !== -1) {\n\t\t\tvar new_length = reactions.length - 1;\n\t\t\tif (new_length === 0) {\n\t\t\t\treactions = dependency.reactions = null;\n\t\t\t} else {\n\t\t\t\t// Swap with last element and then remove.\n\t\t\t\treactions[index] = reactions[new_length];\n\t\t\t\treactions.pop();\n\t\t\t}\n\t\t}\n\t}\n\n\t// If the derived has no reactions, then we can disconnect it from the graph,\n\t// allowing it to either reconnect in the future, or be GC'd by the VM.\n\tif (\n\t\treactions === null &&\n\t\t(dependency.f & DERIVED) !== 0 &&\n\t\t// Destroying a child effect while updating a parent effect can cause a dependency to appear\n\t\t// to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`\n\t\t// allows us to skip the expensive work of disconnecting and immediately reconnecting it\n\t\t(new_deps === null || !includes.call(new_deps, dependency))\n\t) {\n\t\tvar derived = /** @type {Derived} */ (dependency);\n\n\t\t// If we are working with a derived that is owned by an effect, then mark it as being\n\t\t// disconnected and remove the mark flag, as it cannot be reliably removed otherwise\n\t\tif ((derived.f & CONNECTED) !== 0) {\n\t\t\tderived.f ^= CONNECTED;\n\t\t\tderived.f &= ~WAS_MARKED;\n\t\t}\n\n\t\t// In a fork it's possible that a derived is executed and gets reactions, then commits, but is\n\t\t// never re-executed. This is possible when the derived is only executed once in the context\n\t\t// of a new branch which happens before fork.commit() runs. In this case, the derived still has\n\t\t// UNINITIALIZED as its value, and then when it's loosing its reactions we need to ensure it stays\n\t\t// DIRTY so it is reexecuted once someone wants its value again.\n\t\tif (derived.v !== UNINITIALIZED) {\n\t\t\tupdate_derived_status(derived);\n\t\t}\n\n\t\t// Call abort controller, noone's listening to this derived anymore\n\t\tif (derived.ac !== null) {\n\t\t\twithout_reactive_context(() => {\n\t\t\t\t/** @type {AbortController} */ (derived.ac).abort(STALE_REACTION);\n\t\t\t\tderived.ac = null;\n\t\t\t\t// ensure it reruns right away next time instead of potentially returning a rejected promise as its value\n\t\t\t\tset_signal_status(derived, DIRTY);\n\t\t\t});\n\t\t}\n\n\t\t// freeze any effects inside this derived\n\t\tfreeze_derived_effects(derived);\n\n\t\t// Disconnect any reactions owned by this reaction\n\t\tremove_reactions(derived, 0);\n\t}\n}\n\n/**\n * @param {Reaction} signal\n * @param {number} start_index\n * @returns {void}\n */\nexport function remove_reactions(signal, start_index) {\n\tvar dependencies = signal.deps;\n\tif (dependencies === null) return;\n\n\tfor (var i = start_index; i < dependencies.length; i++) {\n\t\tremove_reaction(signal, dependencies[i]);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @returns {void}\n */\nexport function update_effect(effect) {\n\tvar flags = effect.f;\n\n\tif ((flags & DESTROYED) !== 0) {\n\t\treturn;\n\t}\n\n\tset_signal_status(effect, CLEAN);\n\n\tvar previous_effect = active_effect;\n\tvar was_updating_effect = is_updating_effect;\n\n\tactive_effect = effect;\n\tis_updating_effect = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) === 0; // Branch/root effects are not reactive contexts\n\n\tif (DEV) {\n\t\tvar previous_component_fn = dev_current_component_function;\n\t\tset_dev_current_component_function(effect.component_function);\n\t\tvar previous_stack = /** @type {any} */ (dev_stack);\n\t\t// only block effects have a dev stack, keep the current one otherwise\n\t\tset_dev_stack(effect.dev_stack ?? dev_stack);\n\t}\n\n\ttry {\n\t\tif ((flags & (BLOCK_EFFECT | MANAGED_EFFECT)) !== 0) {\n\t\t\tdestroy_block_effect_children(effect);\n\t\t} else {\n\t\t\tdestroy_effect_children(effect);\n\t\t}\n\n\t\texecute_effect_teardown(effect);\n\t\tvar teardown = update_reaction(effect);\n\t\teffect.teardown = typeof teardown === 'function' ? teardown : null;\n\t\teffect.wv = write_version;\n\n\t\t// In DEV, increment versions of any sources that were written to during the effect,\n\t\t// so that they are correctly marked as dirty when the effect re-runs\n\t\tif (DEV && tracing_mode_flag && (effect.f & DIRTY) !== 0 && effect.deps !== null) {\n\t\t\tfor (var dep of effect.deps) {\n\t\t\t\tif (dep.set_during_effect) {\n\t\t\t\t\tdep.wv = increment_write_version();\n\t\t\t\t\tdep.set_during_effect = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} finally {\n\t\tis_updating_effect = was_updating_effect;\n\t\tactive_effect = previous_effect;\n\n\t\tif (DEV) {\n\t\t\tset_dev_current_component_function(previous_component_fn);\n\t\t\tset_dev_stack(previous_stack);\n\t\t}\n\t}\n}\n\n/**\n * Returns a promise that resolves once any pending state changes have been applied.\n * @returns {Promise<void>}\n */\nexport async function tick() {\n\tif (async_mode_flag) {\n\t\treturn new Promise((f) => {\n\t\t\t// Race them against each other - in almost all cases requestAnimationFrame will fire first,\n\t\t\t// but e.g. in case the window is not focused or a view transition happens, requestAnimationFrame\n\t\t\t// will be delayed and setTimeout helps us resolve fast enough in that case\n\t\t\trequestAnimationFrame(() => f());\n\t\t\tsetTimeout(() => f());\n\t\t});\n\t}\n\n\tawait Promise.resolve();\n\n\t// By calling flushSync we guarantee that any pending state changes are applied after one tick.\n\t// TODO look into whether we can make flushing subsequent updates synchronously in the future.\n\tflushSync();\n}\n\n/**\n * Returns a promise that resolves once any state changes, and asynchronous work resulting from them,\n * have resolved and the DOM has been updated\n * @returns {Promise<void>}\n * @since 5.36\n */\nexport function settled() {\n\treturn Batch.ensure().settled();\n}\n\n/**\n * @template V\n * @param {Value<V>} signal\n * @returns {V}\n */\nexport function get(signal) {\n\tvar flags = signal.f;\n\tvar is_derived = (flags & DERIVED) !== 0;\n\n\tcaptured_signals?.add(signal);\n\n\t// Register the dependency on the current reaction signal.\n\tif (active_reaction !== null && !untracking) {\n\t\t// if we're in a derived that is being read inside an _async_ derived,\n\t\t// it's possible that the effect was already destroyed. In this case,\n\t\t// we don't add the dependency, because that would create a memory leak\n\t\tvar destroyed = active_effect !== null && (active_effect.f & DESTROYED) !== 0;\n\n\t\tif (!destroyed && (current_sources === null || !current_sources.has(signal))) {\n\t\t\tvar deps = active_reaction.deps;\n\n\t\t\tif ((active_reaction.f & REACTION_IS_UPDATING) !== 0) {\n\t\t\t\t// we're in the effect init/update cycle\n\t\t\t\tif (signal.rv < read_version) {\n\t\t\t\t\tsignal.rv = read_version;\n\n\t\t\t\t\t// If the signal is accessing the same dependencies in the same\n\t\t\t\t\t// order as it did last time, increment `skipped_deps`\n\t\t\t\t\t// rather than updating `new_deps`, which creates GC cost\n\t\t\t\t\tif (new_deps === null && deps !== null && deps[skipped_deps] === signal) {\n\t\t\t\t\t\tskipped_deps++;\n\t\t\t\t\t} else if (new_deps === null) {\n\t\t\t\t\t\tnew_deps = [signal];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnew_deps.push(signal);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// We're adding a dependency outside the init/update cycle (i.e. after an `await`).\n\t\t\t\t// We have to deduplicate deps/reactions in this case or remove_reactions could\n\t\t\t\t// disconnect deps/reactions that are actually still in use (if skip_deps says\n\t\t\t\t// \"disconnect all after this index\" and some of the signals are also present in\n\t\t\t\t// list prior to the cutoff index, i.e. that should be kept).\n\t\t\t\tactive_reaction.deps ??= [];\n\t\t\t\tif (!includes.call(active_reaction.deps, signal)) {\n\t\t\t\t\tactive_reaction.deps.push(signal);\n\t\t\t\t}\n\n\t\t\t\tvar reactions = signal.reactions;\n\n\t\t\t\tif (reactions === null) {\n\t\t\t\t\tsignal.reactions = [active_reaction];\n\t\t\t\t} else if (!includes.call(reactions, active_reaction)) {\n\t\t\t\t\treactions.push(active_reaction);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (DEV) {\n\t\tif (\n\t\t\t!untracking &&\n\t\t\treactivity_loss_tracker &&\n\t\t\t// By checking that current/previous batch are null we filter out false positives.\n\t\t\t// reactivity_loss_tracker is only reset after a microtask, so if a flush happens\n\t\t\t// before that, we get warnings for things we shouldn't warn on.\n\t\t\tcurrent_batch === null &&\n\t\t\tprevious_batch === null &&\n\t\t\t!reactivity_loss_tracker.warned &&\n\t\t\t(reactivity_loss_tracker.effect.f & REACTION_IS_UPDATING) === 0 &&\n\t\t\t!reactivity_loss_tracker.effect_deps.has(signal)\n\t\t) {\n\t\t\treactivity_loss_tracker.warned = true;\n\n\t\t\tw.await_reactivity_loss(/** @type {string} */ (signal.label));\n\n\t\t\tvar trace = get_error('traced at');\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tif (trace) console.warn(trace);\n\t\t}\n\n\t\trecent_async_deriveds.delete(signal);\n\n\t\tif (\n\t\t\ttracing_mode_flag &&\n\t\t\t!untracking &&\n\t\t\ttracing_expressions !== null &&\n\t\t\tactive_reaction !== null &&\n\t\t\ttracing_expressions.reaction === active_reaction\n\t\t) {\n\t\t\t// Used when mapping state between special blocks like `each`\n\t\t\tif (signal.trace) {\n\t\t\t\tsignal.trace();\n\t\t\t} else {\n\t\t\t\ttrace = get_error('traced at');\n\n\t\t\t\tif (trace) {\n\t\t\t\t\tvar entry = tracing_expressions.entries.get(signal);\n\n\t\t\t\t\tif (entry === undefined) {\n\t\t\t\t\t\tentry = { traces: [] };\n\t\t\t\t\t\ttracing_expressions.entries.set(signal, entry);\n\t\t\t\t\t}\n\n\t\t\t\t\tvar last = entry.traces[entry.traces.length - 1];\n\n\t\t\t\t\t// traces can be duplicated, e.g. by `snapshot` invoking both\n\t\t\t\t\t// both `getOwnPropertyDescriptor` and `get` traps at once\n\t\t\t\t\tif (trace.stack !== last?.stack) {\n\t\t\t\t\t\tentry.traces.push(trace);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (is_destroying_effect && old_values.has(signal)) {\n\t\treturn old_values.get(signal);\n\t}\n\n\tif (is_derived) {\n\t\tvar derived = /** @type {Derived} */ (signal);\n\n\t\tif (is_destroying_effect) {\n\t\t\tvar value = derived.v;\n\n\t\t\t// if the derived is dirty and has reactions, or depends on the values that just changed, re-execute\n\t\t\t// (a derived can be maybe_dirty due to the effect destroy removing its last reaction)\n\t\t\tif (\n\t\t\t\t((derived.f & CLEAN) === 0 && derived.reactions !== null) ||\n\t\t\t\tdepends_on_old_values(derived)\n\t\t\t) {\n\t\t\t\tvalue = execute_derived(derived);\n\t\t\t}\n\n\t\t\told_values.set(derived, value);\n\n\t\t\treturn value;\n\t\t}\n\n\t\t// connect disconnected deriveds if we are reading them inside an effect,\n\t\t// or inside another derived that is already connected\n\t\tvar should_connect =\n\t\t\t(derived.f & CONNECTED) === 0 &&\n\t\t\t!untracking &&\n\t\t\tactive_reaction !== null &&\n\t\t\t(is_updating_effect || (active_reaction.f & CONNECTED) !== 0);\n\n\t\tvar is_new = (derived.f & REACTION_RAN) === 0;\n\n\t\tif (is_dirty(derived)) {\n\t\t\tif (should_connect) {\n\t\t\t\t// set the flag before `update_derived`, so that the derived\n\t\t\t\t// is added as a reaction to its dependencies\n\t\t\t\tderived.f |= CONNECTED;\n\t\t\t}\n\n\t\t\tupdate_derived(derived);\n\t\t}\n\n\t\tif (should_connect && !is_new) {\n\t\t\tunfreeze_derived_effects(derived);\n\t\t\treconnect(derived);\n\t\t}\n\t}\n\n\tif (batch_values?.has(signal)) {\n\t\treturn batch_values.get(signal);\n\t}\n\n\tif ((signal.f & ERROR_VALUE) !== 0) {\n\t\tthrow signal.v;\n\t}\n\n\treturn signal.v;\n}\n\n/**\n * (Re)connect a disconnected derived, so that it is notified\n * of changes in `mark_reactions`\n * @param {Derived} derived\n */\nfunction reconnect(derived) {\n\tderived.f |= CONNECTED;\n\n\tif (derived.deps === null) return;\n\n\tfor (const dep of derived.deps) {\n\t\t(dep.reactions ??= []).push(derived);\n\n\t\tif ((dep.f & DERIVED) !== 0 && (dep.f & CONNECTED) === 0) {\n\t\t\tunfreeze_derived_effects(/** @type {Derived} */ (dep));\n\t\t\treconnect(/** @type {Derived} */ (dep));\n\t\t}\n\t}\n}\n\n/** @param {Derived} derived */\nfunction depends_on_old_values(derived) {\n\tif (derived.v === UNINITIALIZED) return true; // we don't know, so assume the worst\n\tif (derived.deps === null) return false;\n\n\tfor (const dep of derived.deps) {\n\t\tif (old_values.has(dep)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ((dep.f & DERIVED) !== 0 && depends_on_old_values(/** @type {Derived} */ (dep))) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Like `get`, but checks for `undefined`. Used for `var` declarations because they can be accessed before being declared\n * @template V\n * @param {Value<V> | undefined} signal\n * @returns {V | undefined}\n */\nexport function safe_get(signal) {\n\treturn signal && get(signal);\n}\n\n/**\n * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),\n * any state read inside `fn` will not be treated as a dependency.\n *\n * ```ts\n * $effect(() => {\n * // this will run when `data` changes, but not when `time` changes\n * save(data, {\n * timestamp: untrack(() => time)\n * });\n * });\n * ```\n * @template T\n * @param {() => T} fn\n * @returns {T}\n */\nexport function untrack(fn) {\n\tvar previous_untracking = untracking;\n\ttry {\n\t\tuntracking = true;\n\t\treturn fn();\n\t} finally {\n\t\tuntracking = previous_untracking;\n\t}\n}\n\n/**\n * Possibly traverse an object and read all its properties so that they're all reactive in case this is `$state`.\n * Does only check first level of an object for performance reasons (heuristic should be good for 99% of all cases).\n * @param {any} value\n * @returns {void}\n */\nexport function deep_read_state(value) {\n\tif (typeof value !== 'object' || !value || value instanceof EventTarget) {\n\t\treturn;\n\t}\n\n\tif (STATE_SYMBOL in value) {\n\t\tdeep_read(value);\n\t} else if (!Array.isArray(value)) {\n\t\tfor (let key in value) {\n\t\t\tconst prop = value[key];\n\t\t\tif (typeof prop === 'object' && prop && STATE_SYMBOL in prop) {\n\t\t\t\tdeep_read(prop);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Deeply traverse an object and read all its properties\n * so that they're all reactive in case this is `$state`\n * @param {any} value\n * @param {Set<any>} visited\n * @returns {void}\n */\nexport function deep_read(value, visited = new Set()) {\n\tif (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t// We don't want to traverse DOM elements\n\t\t!(value instanceof EventTarget) &&\n\t\t!visited.has(value)\n\t) {\n\t\tvisited.add(value);\n\t\t// When working with a possible SvelteDate, this\n\t\t// will ensure we capture changes to it.\n\t\tif (value instanceof Date) {\n\t\t\tvalue.getTime();\n\t\t}\n\t\tfor (let key in value) {\n\t\t\ttry {\n\t\t\t\tdeep_read(value[key], visited);\n\t\t\t} catch (e) {\n\t\t\t\t// continue\n\t\t\t}\n\t\t}\n\t\tconst proto = get_prototype_of(value);\n\t\tif (\n\t\t\tproto !== Object.prototype &&\n\t\t\tproto !== Array.prototype &&\n\t\t\tproto !== Map.prototype &&\n\t\t\tproto !== Set.prototype &&\n\t\t\tproto !== Date.prototype\n\t\t) {\n\t\t\tconst descriptors = get_descriptors(proto);\n\t\t\tfor (let key in descriptors) {\n\t\t\t\tconst get = descriptors[key].get;\n\t\t\t\tif (get) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tget.call(value);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t// continue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","const regex_return_characters = /\\r/g;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nexport function hash(str) {\n\tstr = str.replace(regex_return_characters, '');\n\tlet hash = 5381;\n\tlet i = str.length;\n\n\twhile (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i);\n\treturn (hash >>> 0).toString(36);\n}\n\nconst VOID_ELEMENT_NAMES = [\n\t'area',\n\t'base',\n\t'br',\n\t'col',\n\t'command',\n\t'embed',\n\t'hr',\n\t'img',\n\t'input',\n\t'keygen',\n\t'link',\n\t'meta',\n\t'param',\n\t'source',\n\t'track',\n\t'wbr'\n];\n\n/**\n * Returns `true` if `name` is of a void element\n * @param {string} name\n */\nexport function is_void(name) {\n\treturn VOID_ELEMENT_NAMES.includes(name) || name.toLowerCase() === '!doctype';\n}\n\nconst RESERVED_WORDS = [\n\t'arguments',\n\t'await',\n\t'break',\n\t'case',\n\t'catch',\n\t'class',\n\t'const',\n\t'continue',\n\t'debugger',\n\t'default',\n\t'delete',\n\t'do',\n\t'else',\n\t'enum',\n\t'eval',\n\t'export',\n\t'extends',\n\t'false',\n\t'finally',\n\t'for',\n\t'function',\n\t'if',\n\t'implements',\n\t'import',\n\t'in',\n\t'instanceof',\n\t'interface',\n\t'let',\n\t'new',\n\t'null',\n\t'package',\n\t'private',\n\t'protected',\n\t'public',\n\t'return',\n\t'static',\n\t'super',\n\t'switch',\n\t'this',\n\t'throw',\n\t'true',\n\t'try',\n\t'typeof',\n\t'var',\n\t'void',\n\t'while',\n\t'with',\n\t'yield'\n];\n\n/**\n * Returns `true` if `word` is a reserved JavaScript keyword\n * @param {string} word\n */\nexport function is_reserved(word) {\n\treturn RESERVED_WORDS.includes(word);\n}\n\n/**\n * @param {string} name\n */\nexport function is_capture_event(name) {\n\treturn name.endsWith('capture') && name !== 'gotpointercapture' && name !== 'lostpointercapture';\n}\n\n/** List of Element events that will be delegated */\nconst DELEGATED_EVENTS = [\n\t'beforeinput',\n\t'click',\n\t'change',\n\t'dblclick',\n\t'contextmenu',\n\t'focusin',\n\t'focusout',\n\t'input',\n\t'keydown',\n\t'keyup',\n\t'mousedown',\n\t'mousemove',\n\t'mouseout',\n\t'mouseover',\n\t'mouseup',\n\t'pointerdown',\n\t'pointermove',\n\t'pointerout',\n\t'pointerover',\n\t'pointerup',\n\t'touchend',\n\t'touchmove',\n\t'touchstart'\n];\n\n/**\n * Returns `true` if `event_name` is a delegated event\n * @param {string} event_name\n */\nexport function can_delegate_event(event_name) {\n\treturn DELEGATED_EVENTS.includes(event_name);\n}\n\n/**\n * Attributes that are boolean, i.e. they are present or not present.\n */\nconst DOM_BOOLEAN_ATTRIBUTES = [\n\t'allowfullscreen',\n\t'async',\n\t'autofocus',\n\t'autoplay',\n\t'checked',\n\t'controls',\n\t'default',\n\t'disabled',\n\t'formnovalidate',\n\t'indeterminate',\n\t'inert',\n\t'ismap',\n\t'loop',\n\t'multiple',\n\t'muted',\n\t'nomodule',\n\t'novalidate',\n\t'open',\n\t'playsinline',\n\t'readonly',\n\t'required',\n\t'reversed',\n\t'seamless',\n\t'selected',\n\t'webkitdirectory',\n\t'defer',\n\t'disablepictureinpicture',\n\t'disableremoteplayback'\n];\n\n/**\n * Returns `true` if `name` is a boolean attribute\n * @param {string} name\n */\nexport function is_boolean_attribute(name) {\n\treturn DOM_BOOLEAN_ATTRIBUTES.includes(name);\n}\n\n/**\n * @type {Record<string, string>}\n * List of attribute names that should be aliased to their property names\n * because they behave differently between setting them as an attribute and\n * setting them as a property.\n */\nconst ATTRIBUTE_ALIASES = {\n\t// no `class: 'className'` because we handle that separately\n\tformnovalidate: 'formNoValidate',\n\tismap: 'isMap',\n\tnomodule: 'noModule',\n\tplaysinline: 'playsInline',\n\treadonly: 'readOnly',\n\tdefaultvalue: 'defaultValue',\n\tdefaultchecked: 'defaultChecked',\n\tsrcobject: 'srcObject',\n\tnovalidate: 'noValidate',\n\tallowfullscreen: 'allowFullscreen',\n\tdisablepictureinpicture: 'disablePictureInPicture',\n\tdisableremoteplayback: 'disableRemotePlayback'\n};\n\n/**\n * @param {string} name\n */\nexport function normalize_attribute(name) {\n\tname = name.toLowerCase();\n\treturn ATTRIBUTE_ALIASES[name] ?? name;\n}\n\nconst DOM_PROPERTIES = [\n\t...DOM_BOOLEAN_ATTRIBUTES,\n\t'formNoValidate',\n\t'isMap',\n\t'noModule',\n\t'playsInline',\n\t'readOnly',\n\t'value',\n\t'volume',\n\t'defaultValue',\n\t'defaultChecked',\n\t'srcObject',\n\t'noValidate',\n\t'allowFullscreen',\n\t'disablePictureInPicture',\n\t'disableRemotePlayback'\n];\n\n/**\n * @param {string} name\n */\nexport function is_dom_property(name) {\n\treturn DOM_PROPERTIES.includes(name);\n}\n\nconst NON_STATIC_PROPERTIES = ['autofocus', 'muted', 'defaultValue', 'defaultChecked'];\n\n/**\n * Returns `true` if the given attribute cannot be set through the template\n * string, i.e. needs some kind of JavaScript handling to work.\n * @param {string} name\n */\nexport function cannot_be_set_statically(name) {\n\treturn NON_STATIC_PROPERTIES.includes(name);\n}\n\n/**\n * Subset of delegated events which should be passive by default.\n * These two are already passive via browser defaults on window, document and body.\n * But since\n * - we're delegating them\n * - they happen often\n * - they apply to mobile which is generally less performant\n * we're marking them as passive by default for other elements, too.\n */\nconst PASSIVE_EVENTS = ['touchstart', 'touchmove'];\n\n/**\n * Returns `true` if `name` is a passive event\n * @param {string} name\n */\nexport function is_passive_event(name) {\n\treturn PASSIVE_EVENTS.includes(name);\n}\n\nconst CONTENT_EDITABLE_BINDINGS = ['textContent', 'innerHTML', 'innerText'];\n\n/** @param {string} name */\nexport function is_content_editable_binding(name) {\n\treturn CONTENT_EDITABLE_BINDINGS.includes(name);\n}\n\nconst LOAD_ERROR_ELEMENTS = [\n\t'body',\n\t'embed',\n\t'iframe',\n\t'img',\n\t'link',\n\t'object',\n\t'script',\n\t'style',\n\t'track'\n];\n\n/**\n * Returns `true` if the element emits `load` and `error` events\n * @param {string} name\n */\nexport function is_load_error_element(name) {\n\treturn LOAD_ERROR_ELEMENTS.includes(name);\n}\n\nconst SVG_ELEMENTS = [\n\t'altGlyph',\n\t'altGlyphDef',\n\t'altGlyphItem',\n\t'animate',\n\t'animateColor',\n\t'animateMotion',\n\t'animateTransform',\n\t'circle',\n\t'clipPath',\n\t'color-profile',\n\t'cursor',\n\t'defs',\n\t'desc',\n\t'discard',\n\t'ellipse',\n\t'feBlend',\n\t'feColorMatrix',\n\t'feComponentTransfer',\n\t'feComposite',\n\t'feConvolveMatrix',\n\t'feDiffuseLighting',\n\t'feDisplacementMap',\n\t'feDistantLight',\n\t'feDropShadow',\n\t'feFlood',\n\t'feFuncA',\n\t'feFuncB',\n\t'feFuncG',\n\t'feFuncR',\n\t'feGaussianBlur',\n\t'feImage',\n\t'feMerge',\n\t'feMergeNode',\n\t'feMorphology',\n\t'feOffset',\n\t'fePointLight',\n\t'feSpecularLighting',\n\t'feSpotLight',\n\t'feTile',\n\t'feTurbulence',\n\t'filter',\n\t'font',\n\t'font-face',\n\t'font-face-format',\n\t'font-face-name',\n\t'font-face-src',\n\t'font-face-uri',\n\t'foreignObject',\n\t'g',\n\t'glyph',\n\t'glyphRef',\n\t'hatch',\n\t'hatchpath',\n\t'hkern',\n\t'image',\n\t'line',\n\t'linearGradient',\n\t'marker',\n\t'mask',\n\t'mesh',\n\t'meshgradient',\n\t'meshpatch',\n\t'meshrow',\n\t'metadata',\n\t'missing-glyph',\n\t'mpath',\n\t'path',\n\t'pattern',\n\t'polygon',\n\t'polyline',\n\t'radialGradient',\n\t'rect',\n\t'set',\n\t'solidcolor',\n\t'stop',\n\t'svg',\n\t'switch',\n\t'symbol',\n\t'text',\n\t'textPath',\n\t'tref',\n\t'tspan',\n\t'unknown',\n\t'use',\n\t'view',\n\t'vkern'\n];\n\n/** @param {string} name */\nexport function is_svg(name) {\n\treturn SVG_ELEMENTS.includes(name);\n}\n\nconst MATHML_ELEMENTS = [\n\t'annotation',\n\t'annotation-xml',\n\t'maction',\n\t'math',\n\t'merror',\n\t'mfrac',\n\t'mi',\n\t'mmultiscripts',\n\t'mn',\n\t'mo',\n\t'mover',\n\t'mpadded',\n\t'mphantom',\n\t'mprescripts',\n\t'mroot',\n\t'mrow',\n\t'ms',\n\t'mspace',\n\t'msqrt',\n\t'mstyle',\n\t'msub',\n\t'msubsup',\n\t'msup',\n\t'mtable',\n\t'mtd',\n\t'mtext',\n\t'mtr',\n\t'munder',\n\t'munderover',\n\t'semantics'\n];\n\n/** @param {string} name */\nexport function is_mathml(name) {\n\treturn MATHML_ELEMENTS.includes(name);\n}\n\nconst STATE_CREATION_RUNES = /** @type {const} */ ([\n\t'$state',\n\t'$state.raw',\n\t'$derived',\n\t'$derived.by'\n]);\n\nexport const RUNES = /** @type {const} */ ([\n\t...STATE_CREATION_RUNES,\n\t'$state.eager',\n\t'$state.snapshot',\n\t'$props',\n\t'$props.id',\n\t'$bindable',\n\t'$effect',\n\t'$effect.pre',\n\t'$effect.tracking',\n\t'$effect.root',\n\t'$effect.pending',\n\t'$inspect',\n\t'$inspect().with',\n\t'$inspect.trace',\n\t'$host'\n]);\n\n/** @typedef {typeof RUNES[number]} RuneName */\n\n/**\n * @param {string} name\n * @returns {name is RuneName}\n */\nexport function is_rune(name) {\n\treturn RUNES.includes(/** @type {RuneName} */ (name));\n}\n\n/** @typedef {typeof STATE_CREATION_RUNES[number]} StateCreationRuneName */\n\n/**\n * @param {string} name\n * @returns {name is StateCreationRuneName}\n */\nexport function is_state_creation_rune(name) {\n\treturn STATE_CREATION_RUNES.includes(/** @type {StateCreationRuneName} */ (name));\n}\n\n/** List of elements that require raw contents and should not have SSR comments put in them */\nconst RAW_TEXT_ELEMENTS = /** @type {const} */ (['textarea', 'script', 'style', 'title']);\n\n/** @param {string} name */\nexport function is_raw_text_element(name) {\n\treturn RAW_TEXT_ELEMENTS.includes(/** @type {typeof RAW_TEXT_ELEMENTS[number]} */ (name));\n}\n\n// Matches valid HTML/SVG/MathML element names and custom element names.\n// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n//\n// Standard elements: ASCII alpha start, followed by ASCII alphanumerics.\n// Custom elements: ASCII alpha start, followed by any mix of PCENChar (which\n// includes ASCII alphanumerics, `-`, `.`, `_`, and specified Unicode ranges),\n// with at least one hyphen required somewhere after the first character.\n//\n// Rejects strings containing whitespace, quotes, angle brackets, slashes, equals,\n// or other characters that could break out of a tag-name token and enable markup injection.\nexport const REGEX_VALID_TAG_NAME =\n\t/^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\\-_\\u00B7\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F-\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{EFFFF}]*)?$/u;\n\n/**\n * Prevent devtools trying to make `location` a clickable link by inserting a zero-width space\n * @template {string | undefined} T\n * @param {T} location\n * @returns {T};\n */\nexport function sanitize_location(location) {\n\treturn /** @type {T} */ (location?.replace(/\\//g, '/\\u200b'));\n}\n","import { teardown } from '../../reactivity/effects.js';\nimport { define_property } from '../../../shared/utils.js';\nimport { hydrating } from '../hydration.js';\nimport { queue_micro_task } from '../task.js';\nimport { FILENAME } from '../../../../constants.js';\nimport * as w from '../../warnings.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport { without_reactive_context } from './bindings/shared.js';\n\n/**\n * Used on elements, as a map of event type -> event handler,\n * and on events themselves to track which element handled an event\n */\nexport const event_symbol = Symbol('events');\n\n/** @type {Set<string>} */\nexport const all_registered_events = new Set();\n\n/** @type {Set<(events: Array<string>) => void>} */\nexport const root_event_handles = new Set();\n\n/**\n * SSR adds onload and onerror attributes to catch those events before the hydration.\n * This function detects those cases, removes the attributes and replays the events.\n * @param {HTMLElement} dom\n */\nexport function replay_events(dom) {\n\tif (!hydrating) return;\n\n\tdom.removeAttribute('onload');\n\tdom.removeAttribute('onerror');\n\t// @ts-expect-error\n\tconst event = dom.__e;\n\tif (event !== undefined) {\n\t\t// @ts-expect-error\n\t\tdom.__e = undefined;\n\t\tqueueMicrotask(() => {\n\t\t\tif (dom.isConnected) {\n\t\t\t\tdom.dispatchEvent(event);\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @param {string} event_name\n * @param {EventTarget} dom\n * @param {EventListener} [handler]\n * @param {AddEventListenerOptions} [options]\n */\nexport function create_event(event_name, dom, handler, options = {}) {\n\t/**\n\t * @this {EventTarget}\n\t */\n\tfunction target_handler(/** @type {Event} */ event) {\n\t\tif (!options.capture) {\n\t\t\t// Only call in the bubble phase, else delegated events would be called before the capturing events\n\t\t\thandle_event_propagation.call(dom, event);\n\t\t}\n\t\tif (!event.cancelBubble) {\n\t\t\treturn without_reactive_context(() => {\n\t\t\t\treturn handler?.call(this, event);\n\t\t\t});\n\t\t}\n\t}\n\n\t// Chrome has a bug where pointer events don't work when attached to a DOM element that has been cloned\n\t// with cloneNode() and the DOM element is disconnected from the document. To ensure the event works, we\n\t// defer the attachment till after it's been appended to the document. TODO: remove this once Chrome fixes\n\t// this bug. The same applies to wheel events and touch events.\n\tif (\n\t\tevent_name.startsWith('pointer') ||\n\t\tevent_name.startsWith('touch') ||\n\t\tevent_name === 'wheel'\n\t) {\n\t\tqueue_micro_task(() => {\n\t\t\tdom.addEventListener(event_name, target_handler, options);\n\t\t});\n\t} else {\n\t\tdom.addEventListener(event_name, target_handler, options);\n\t}\n\n\treturn target_handler;\n}\n\n/**\n * Attaches an event handler to an element and returns a function that removes the handler. Using this\n * rather than `addEventListener` will preserve the correct order relative to handlers added declaratively\n * (with attributes like `onclick`), which use event delegation for performance reasons\n *\n * @param {EventTarget} element\n * @param {string} type\n * @param {EventListener} handler\n * @param {AddEventListenerOptions} [options]\n */\nexport function on(element, type, handler, options = {}) {\n\tvar target_handler = create_event(type, element, handler, options);\n\n\treturn () => {\n\t\telement.removeEventListener(type, target_handler, options);\n\t};\n}\n\n/**\n * @param {string} event_name\n * @param {Element} dom\n * @param {EventListener} [handler]\n * @param {boolean} [capture]\n * @param {boolean} [passive]\n * @returns {void}\n */\nexport function event(event_name, dom, handler, capture, passive) {\n\tvar options = { capture, passive };\n\tvar target_handler = create_event(event_name, dom, handler, options);\n\n\tif (\n\t\tdom === document.body ||\n\t\t// @ts-ignore\n\t\tdom === window ||\n\t\t// @ts-ignore\n\t\tdom === document ||\n\t\t// Firefox has quirky behavior, it can happen that we still get \"canplay\" events when the element is already removed\n\t\tdom instanceof HTMLMediaElement\n\t) {\n\t\tteardown(() => {\n\t\t\tdom.removeEventListener(event_name, target_handler, options);\n\t\t});\n\t}\n}\n\n/**\n * @param {string} event_name\n * @param {Element} element\n * @param {EventListener} [handler]\n * @returns {void}\n */\nexport function delegated(event_name, element, handler) {\n\t// @ts-expect-error\n\t(element[event_symbol] ??= {})[event_name] = handler;\n}\n\n/**\n * @param {Array<string>} events\n * @returns {void}\n */\nexport function delegate(events) {\n\tfor (var i = 0; i < events.length; i++) {\n\t\tall_registered_events.add(events[i]);\n\t}\n\n\tfor (var fn of root_event_handles) {\n\t\tfn(events);\n\t}\n}\n\n// used to store the reference to the currently propagated event\n// to prevent garbage collection between microtasks in Firefox (<= 141)\n// If the event object is GCed too early, the expando __root property\n// set on the event object is lost, causing the event delegation\n// to process the event twice\nlet last_propagated_event = null;\n\n// whether a task is already queued to clear `last_propagated_event`\nlet last_propagated_event_clear_scheduled = false;\n\n/**\n * @this {EventTarget}\n * @param {Event} event\n * @returns {void}\n */\nexport function handle_event_propagation(event) {\n\tvar handler_element = this;\n\tvar owner_document = /** @type {Node} */ (handler_element).ownerDocument;\n\tvar event_name = event.type;\n\tvar path = event.composedPath?.() || [];\n\tvar current_target = /** @type {null | Element} */ (path[0] || event.target);\n\n\tlast_propagated_event = event;\n\n\t// The reference is only needed while the event can still reach another\n\t// delegated root, i.e. during the current (synchronous) dispatch and its\n\t// microtask checkpoints. Clearing it in a later task preserves the\n\t// Firefox workaround while making sure the slot doesn't retain the last\n\t// event forever — through `event.target` it would otherwise keep the\n\t// entire detached subtree of whatever the user last clicked in alive\n\t// until the next delegated event happens to arrive.\n\tif (!last_propagated_event_clear_scheduled) {\n\t\tlast_propagated_event_clear_scheduled = true;\n\t\tsetTimeout(() => {\n\t\t\tlast_propagated_event_clear_scheduled = false;\n\t\t\tlast_propagated_event = null;\n\t\t});\n\t}\n\n\t// composedPath contains list of nodes the event has propagated through.\n\t// We check `event_symbol` to skip all nodes below it in case this is a\n\t// parent of the `event_symbol` node, which indicates that there's nested\n\t// mounted apps. In this case we don't want to trigger events multiple times.\n\tvar path_idx = 0;\n\n\t// the `last_propagated_event === event` check is redundant, but\n\t// without it the variable will be DCE'd and things will\n\t// fail mysteriously in Firefox\n\t// @ts-expect-error is added below\n\tvar handled_at = last_propagated_event === event && event[event_symbol];\n\n\tif (handled_at) {\n\t\tvar at_idx = path.indexOf(handled_at);\n\t\tif (\n\t\t\tat_idx !== -1 &&\n\t\t\t(handler_element === document || handler_element === /** @type {any} */ (window))\n\t\t) {\n\t\t\t// This is the fallback document listener or a window listener, but the event was already handled\n\t\t\t// -> ignore, but set handle_at to document/window so that we're resetting the event\n\t\t\t// chain in case someone manually dispatches the same event object again.\n\t\t\t// @ts-expect-error\n\t\t\tevent[event_symbol] = handler_element;\n\t\t\treturn;\n\t\t}\n\n\t\t// We're deliberately not skipping if the index is higher, because\n\t\t// someone could create an event programmatically and emit it multiple times,\n\t\t// in which case we want to handle the whole propagation chain properly each time.\n\t\t// (this will only be a false negative if the event is dispatched multiple times and\n\t\t// the fallback document listener isn't reached in between, but that's super rare)\n\t\tvar handler_idx = path.indexOf(handler_element);\n\t\tif (handler_idx === -1) {\n\t\t\t// handle_idx can theoretically be -1 (happened in some JSDOM testing scenarios with an event listener on the window object)\n\t\t\t// so guard against that, too, and assume that everything was handled at this point.\n\t\t\treturn;\n\t\t}\n\n\t\tif (at_idx <= handler_idx) {\n\t\t\tpath_idx = at_idx;\n\t\t}\n\t}\n\n\tcurrent_target = /** @type {Element} */ (path[path_idx] || event.target);\n\t// there can only be one delegated event per element, and we either already handled the current target,\n\t// or this is the very first target in the chain which has a non-delegated listener, in which case it's safe\n\t// to handle a possible delegated event on it later (through the root delegation listener for example).\n\tif (current_target === handler_element) return;\n\n\t// Proxy currentTarget to correct target\n\tdefine_property(event, 'currentTarget', {\n\t\tconfigurable: true,\n\t\tget() {\n\t\t\treturn current_target || owner_document;\n\t\t}\n\t});\n\n\t// This started because of Chromium issue https://chromestatus.com/feature/5128696823545856,\n\t// where removal or moving of the DOM can cause sync `blur` events to fire, which can cause logic\n\t// to run inside the current `active_reaction`, which isn't what we want at all. However, on reflection,\n\t// it's probably best that all events handled by Svelte have this behaviour, as we don't really want\n\t// an event handler to run in the context of another reaction or effect.\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\n\ttry {\n\t\t/**\n\t\t * @type {unknown}\n\t\t */\n\t\tvar throw_error;\n\t\t/**\n\t\t * @type {unknown[]}\n\t\t */\n\t\tvar other_errors = [];\n\n\t\twhile (current_target !== null) {\n\t\t\tif (current_target === handler_element) break;\n\n\t\t\ttry {\n\t\t\t\t// @ts-expect-error\n\t\t\t\tvar delegated = current_target[event_symbol]?.[event_name];\n\n\t\t\t\tif (\n\t\t\t\t\tdelegated != null &&\n\t\t\t\t\t(!(/** @type {any} */ (current_target).disabled) ||\n\t\t\t\t\t\t// DOM could've been updated already by the time this is reached, so we check this as well\n\t\t\t\t\t\t// -> the target could not have been disabled because it emits the event in the first place\n\t\t\t\t\t\tevent.target === current_target)\n\t\t\t\t) {\n\t\t\t\t\tdelegated.call(current_target, event);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (throw_error) {\n\t\t\t\t\tother_errors.push(error);\n\t\t\t\t} else {\n\t\t\t\t\tthrow_error = error;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (event.cancelBubble) break;\n\n\t\t\tpath_idx++;\n\t\t\tcurrent_target = path_idx < path.length ? /** @type {Element} */ (path[path_idx]) : null;\n\t\t}\n\n\t\tif (throw_error) {\n\t\t\tfor (let error of other_errors) {\n\t\t\t\t// Throw the rest of the errors, one-by-one on a microtask\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t\t}\n\t\t\tthrow throw_error;\n\t\t}\n\t} finally {\n\t\t// @ts-expect-error is used above\n\t\tevent[event_symbol] = handler_element;\n\t\t// @ts-ignore remove proxy on currentTarget\n\t\tdelete event.currentTarget;\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t}\n}\n\n/**\n * In dev, warn if an event handler is not a function, as it means the\n * user probably called the handler or forgot to add a `() =>`\n * @param {() => (event: Event, ...args: any) => void} thunk\n * @param {EventTarget} element\n * @param {[Event, ...any]} args\n * @param {any} component\n * @param {[number, number]} [loc]\n * @param {boolean} [remove_parens]\n */\nexport function apply(\n\tthunk,\n\telement,\n\targs,\n\tcomponent,\n\tloc,\n\thas_side_effects = false,\n\tremove_parens = false\n) {\n\tlet handler;\n\tlet error;\n\n\ttry {\n\t\thandler = thunk();\n\t} catch (e) {\n\t\terror = e;\n\t}\n\n\tif (typeof handler !== 'function' && (has_side_effects || handler != null || error)) {\n\t\tconst filename = component?.[FILENAME];\n\t\tconst location = loc ? ` at ${filename}:${loc[0]}:${loc[1]}` : ` in ${filename}`;\n\t\tconst phase = args[0]?.eventPhase < Event.BUBBLING_PHASE ? 'capture' : '';\n\t\tconst event_name = args[0]?.type + phase;\n\t\tconst description = `\\`${event_name}\\` handler${location}`;\n\t\tconst suggestion = remove_parens ? 'remove the trailing `()`' : 'add a leading `() =>`';\n\n\t\tw.event_handler_invalid(description, suggestion);\n\n\t\tif (error) {\n\t\t\tthrow error;\n\t\t}\n\t}\n\thandler?.apply(element, args);\n}\n","import { create_element } from './operations.js';\n\nconst policy =\n\t// We gotta write it like this because after downleveling the pure comment may end up in the wrong location\n\tglobalThis?.window?.trustedTypes &&\n\t/* @__PURE__ */ globalThis.window.trustedTypes.createPolicy('svelte-trusted-html', {\n\t\t/** @param {string} html */\n\t\tcreateHTML: (html) => {\n\t\t\treturn html;\n\t\t}\n\t});\n\n/** @param {string} html */\nexport function create_trusted_html(html) {\n\treturn /** @type {string} */ (policy?.createHTML(html) ?? html);\n}\n\n/**\n * @param {string} html\n */\nexport function create_fragment_from_html(html) {\n\tvar elem = create_element('template');\n\telem.innerHTML = create_trusted_html(html.replaceAll('<!>', '<!---->')); // XHTML compliance\n\treturn elem.content;\n}\n","/** @import { Effect, EffectNodes, TemplateNode } from '#client' */\n/** @import { TemplateStructure } from './types' */\nimport { hydrate_next, hydrate_node, hydrating, set_hydrate_node } from './hydration.js';\nimport {\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tis_firefox,\n\tcreate_element,\n\tcreate_fragment,\n\tcreate_comment,\n\tset_attribute,\n\tmerge_text_nodes\n} from './operations.js';\nimport { create_fragment_from_html } from './reconciler.js';\nimport { active_effect } from '../runtime.js';\nimport {\n\tNAMESPACE_MATHML,\n\tNAMESPACE_SVG,\n\tTEMPLATE_FRAGMENT,\n\tTEMPLATE_USE_IMPORT_NODE,\n\tTEMPLATE_USE_MATHML,\n\tTEMPLATE_USE_SVG\n} from '../../../constants.js';\nimport {\n\tCOMMENT_NODE,\n\tDOCUMENT_FRAGMENT_NODE,\n\tIS_XHTML,\n\tREACTION_RAN,\n\tTEXT_NODE\n} from '#client/constants';\n\nconst TEMPLATE_TAG = IS_XHTML ? 'template' : 'TEMPLATE';\nconst SCRIPT_TAG = IS_XHTML ? 'script' : 'SCRIPT';\n\n/**\n * @param {TemplateNode} start\n * @param {TemplateNode | null} end\n */\nexport function assign_nodes(start, end) {\n\tvar effect = /** @type {Effect} */ (active_effect);\n\tif (effect.nodes === null) {\n\t\teffect.nodes = { start, end, a: null, t: null };\n\t}\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_html(content, flags) {\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;\n\n\t/** @type {Node} */\n\tvar node;\n\n\t/**\n\t * Whether or not the first item is a text/element node. If not, we need to\n\t * create an additional comment node to act as `effect.nodes.start`\n\t */\n\tvar has_start = !content.startsWith('<!>');\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (node === undefined) {\n\t\t\tnode = create_fragment_from_html(has_start ? content : '<!>' + content);\n\t\t\tif (!is_fragment) node = /** @type {TemplateNode} */ (get_first_child(node));\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (\n\t\t\tuse_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true)\n\t\t);\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (clone.lastChild);\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n * @param {'svg' | 'math'} ns\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nfunction from_namespace(content, flags, ns = 'svg') {\n\t/**\n\t * Whether or not the first item is a text/element node. If not, we need to\n\t * create an additional comment node to act as `effect.nodes.start`\n\t */\n\tvar has_start = !content.startsWith('<!>');\n\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar wrapped = `<${ns}>${has_start ? content : '<!>' + content}</${ns}>`;\n\n\t/** @type {Element | DocumentFragment} */\n\tvar node;\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (!node) {\n\t\t\tvar fragment = /** @type {DocumentFragment} */ (create_fragment_from_html(wrapped));\n\t\t\tvar root = /** @type {Element} */ (get_first_child(fragment));\n\n\t\t\tif (is_fragment) {\n\t\t\t\tnode = document.createDocumentFragment();\n\t\t\t\twhile (get_first_child(root)) {\n\t\t\t\t\tnode.appendChild(/** @type {TemplateNode} */ (get_first_child(root)));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnode = /** @type {Element} */ (get_first_child(root));\n\t\t\t}\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (node.cloneNode(true));\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (clone.lastChild);\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_svg(content, flags) {\n\treturn from_namespace(content, flags, 'svg');\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_mathml(content, flags) {\n\treturn from_namespace(content, flags, 'math');\n}\n\n/**\n * @param {TemplateStructure[]} structure\n * @param {typeof NAMESPACE_SVG | typeof NAMESPACE_MATHML | undefined} [ns]\n */\nfunction fragment_from_tree(structure, ns) {\n\tvar fragment = create_fragment();\n\n\tfor (var item of structure) {\n\t\tif (typeof item === 'string') {\n\t\t\tfragment.append(create_text(item));\n\t\t\tcontinue;\n\t\t}\n\n\t\t// if `preserveComments === true`, comments are represented as `['// <data>']`\n\t\tif (item === undefined || item[0][0] === '/') {\n\t\t\tfragment.append(create_comment(item ? item[0].slice(3) : ''));\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst [name, attributes, ...children] = item;\n\n\t\tconst namespace = name === 'svg' ? NAMESPACE_SVG : name === 'math' ? NAMESPACE_MATHML : ns;\n\n\t\tvar element = create_element(name, namespace, attributes?.is);\n\n\t\tfor (var key in attributes) {\n\t\t\tset_attribute(element, key, attributes[key]);\n\t\t}\n\n\t\tif (children.length > 0) {\n\t\t\tvar target =\n\t\t\t\telement.nodeName === TEMPLATE_TAG\n\t\t\t\t\t? /** @type {HTMLTemplateElement} */ (element).content\n\t\t\t\t\t: element;\n\n\t\t\ttarget.append(\n\t\t\t\tfragment_from_tree(children, element.nodeName === 'foreignObject' ? undefined : namespace)\n\t\t\t);\n\t\t}\n\n\t\tfragment.append(element);\n\t}\n\n\treturn fragment;\n}\n\n/**\n * @param {TemplateStructure[]} structure\n * @param {number} flags\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_tree(structure, flags) {\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;\n\n\t/** @type {Node} */\n\tvar node;\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (node === undefined) {\n\t\t\tconst ns =\n\t\t\t\t(flags & TEMPLATE_USE_SVG) !== 0\n\t\t\t\t\t? NAMESPACE_SVG\n\t\t\t\t\t: (flags & TEMPLATE_USE_MATHML) !== 0\n\t\t\t\t\t\t? NAMESPACE_MATHML\n\t\t\t\t\t\t: undefined;\n\n\t\t\tnode = fragment_from_tree(structure, ns);\n\t\t\tif (!is_fragment) node = /** @type {TemplateNode} */ (get_first_child(node));\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (\n\t\t\tuse_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true)\n\t\t);\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (clone.lastChild);\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {() => Element | DocumentFragment} fn\n */\nexport function with_script(fn) {\n\treturn () => run_scripts(fn());\n}\n\n/**\n * Creating a document fragment from HTML that contains script tags will not execute\n * the scripts. We need to replace the script tags with new ones so that they are executed.\n * @param {Element | DocumentFragment} node\n * @returns {Node | Node[]}\n */\nfunction run_scripts(node) {\n\t// scripts were SSR'd, in which case they will run\n\tif (hydrating) return node;\n\n\tconst is_fragment = node.nodeType === DOCUMENT_FRAGMENT_NODE;\n\tconst scripts =\n\t\t/** @type {HTMLElement} */ (node).nodeName === SCRIPT_TAG\n\t\t\t? [/** @type {HTMLScriptElement} */ (node)]\n\t\t\t: node.querySelectorAll('script');\n\n\tconst effect = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);\n\n\tfor (const script of scripts) {\n\t\tconst clone = create_element('script');\n\t\tfor (var attribute of script.attributes) {\n\t\t\tclone.setAttribute(attribute.name, attribute.value);\n\t\t}\n\n\t\tclone.textContent = script.textContent;\n\n\t\t// The script has changed - if it's at the edges, the effect now points at dead nodes\n\t\tif (is_fragment ? node.firstChild === script : node === script) {\n\t\t\teffect.nodes.start = clone;\n\t\t}\n\t\tif (is_fragment ? node.lastChild === script : node === script) {\n\t\t\teffect.nodes.end = clone;\n\t\t}\n\n\t\tscript.replaceWith(clone);\n\t}\n\treturn node;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {any} value\n */\nexport function text(value = '') {\n\tif (!hydrating) {\n\t\tvar t = create_text(value + '');\n\t\tassign_nodes(t, t);\n\t\treturn t;\n\t}\n\n\tvar node = hydrate_node;\n\n\tif (node.nodeType !== TEXT_NODE) {\n\t\t// if an {expression} is empty during SSR, we need to insert an empty text node\n\t\tnode.before((node = create_text()));\n\t\tset_hydrate_node(node);\n\t} else {\n\t\tmerge_text_nodes(/** @type {Text} */ (node));\n\t}\n\n\tassign_nodes(node, node);\n\treturn node;\n}\n\n/**\n * @returns {TemplateNode | DocumentFragment}\n */\nexport function comment() {\n\t// we're not delegating to `template` here for performance reasons\n\tif (hydrating) {\n\t\tassign_nodes(hydrate_node, null);\n\t\treturn hydrate_node;\n\t}\n\n\tvar frag = document.createDocumentFragment();\n\tvar start = document.createComment('');\n\tvar anchor = create_text();\n\tfrag.append(start, anchor);\n\n\tassign_nodes(start, anchor);\n\n\treturn frag;\n}\n\n/**\n * Assign the created (or in hydration mode, traversed) dom elements to the current block\n * and insert the elements into the dom (in client mode).\n * @param {Text | Comment | Element} anchor\n * @param {DocumentFragment | Element} dom\n */\nexport function append(anchor, dom) {\n\tif (hydrating) {\n\t\tvar effect = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);\n\n\t\t// When hydrating and outer component and an inner component is async, i.e. blocked on a promise,\n\t\t// then by the time the inner resolves we have already advanced to the end of the hydrated nodes\n\t\t// of the parent component. Check for defined for that reason to avoid rewinding the parent's end marker.\n\t\tif ((effect.f & REACTION_RAN) === 0 || effect.nodes.end === null) {\n\t\t\teffect.nodes.end = hydrate_node;\n\t\t}\n\n\t\thydrate_next();\n\t\treturn;\n\t}\n\n\tif (anchor === null) {\n\t\t// edge case — void `<svelte:element>` with content\n\t\treturn;\n\t}\n\n\tanchor.before(/** @type {Node} */ (dom));\n}\n\n/**\n * Create (or hydrate) an unique UID for the component instance.\n */\nexport function props_id() {\n\tif (\n\t\thydrating &&\n\t\thydrate_node &&\n\t\thydrate_node.nodeType === COMMENT_NODE &&\n\t\thydrate_node.textContent?.startsWith(`$`)\n\t) {\n\t\tconst id = hydrate_node.textContent.substring(1);\n\t\thydrate_next();\n\t\treturn id;\n\t}\n\n\t// @ts-expect-error This way we ensure the id is unique even across Svelte runtimes\n\t(window.__svelte ??= {}).uid ??= 1;\n\n\t// @ts-expect-error\n\treturn `c${window.__svelte.uid++}`;\n}\n","import { get, tick, untrack } from '../internal/client/runtime.js';\nimport { effect_tracking, render_effect } from '../internal/client/reactivity/effects.js';\nimport { source, increment } from '../internal/client/reactivity/sources.js';\nimport { tag } from '../internal/client/dev/tracing.js';\nimport { DEV } from 'esm-env';\nimport { queue_micro_task } from '../internal/client/dom/task.js';\n\n/**\n * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.\n * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.\n *\n * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),\n * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.\n *\n * If `start` returns a cleanup function, it will be called when the effect is destroyed.\n *\n * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects\n * are active, and the returned teardown function will only be called when all effects are destroyed.\n *\n * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):\n *\n * ```js\n * import { createSubscriber } from 'svelte/reactivity';\n * import { on } from 'svelte/events';\n *\n * export class MediaQuery {\n * \t#query;\n * \t#subscribe;\n *\n * \tconstructor(query) {\n * \t\tthis.#query = window.matchMedia(`(${query})`);\n *\n * \t\tthis.#subscribe = createSubscriber((update) => {\n * \t\t\t// when the `change` event occurs, re-run any effects that read `this.current`\n * \t\t\tconst off = on(this.#query, 'change', update);\n *\n * \t\t\t// stop listening when all the effects are destroyed\n * \t\t\treturn () => off();\n * \t\t});\n * \t}\n *\n * \tget current() {\n * \t\t// This makes the getter reactive, if read in an effect\n * \t\tthis.#subscribe();\n *\n * \t\t// Return the current state of the query, whether or not we're in an effect\n * \t\treturn this.#query.matches;\n * \t}\n * }\n * ```\n * @param {(update: () => void) => (() => void) | void} start\n * @since 5.7.0\n */\nexport function createSubscriber(start) {\n\tlet subscribers = 0;\n\tlet version = source(0);\n\t/** @type {(() => void) | void} */\n\tlet stop;\n\n\tif (DEV) {\n\t\ttag(version, 'createSubscriber version');\n\t}\n\n\treturn () => {\n\t\tif (effect_tracking()) {\n\t\t\tget(version);\n\n\t\t\trender_effect(() => {\n\t\t\t\tif (subscribers === 0) {\n\t\t\t\t\tstop = untrack(() => start(() => increment(version)));\n\t\t\t\t}\n\n\t\t\t\tsubscribers += 1;\n\n\t\t\t\treturn () => {\n\t\t\t\t\tqueue_micro_task(() => {\n\t\t\t\t\t\t// Only count down after a microtask, else we would reach 0 before our own render effect reruns,\n\t\t\t\t\t\t// but reach 1 again when the tick callback of the prior teardown runs. That would mean we\n\t\t\t\t\t\t// re-subcribe unnecessarily and create a memory leak because the old subscription is never cleaned up.\n\t\t\t\t\t\tsubscribers -= 1;\n\n\t\t\t\t\t\tif (subscribers === 0) {\n\t\t\t\t\t\t\tstop?.();\n\t\t\t\t\t\t\tstop = undefined;\n\t\t\t\t\t\t\t// Increment the version to ensure any dependent deriveds are marked dirty when the subscription is picked up again later.\n\t\t\t\t\t\t\t// If we didn't do this then the comparison of write versions would determine that the derived has a later version than\n\t\t\t\t\t\t\t// the subscriber, and it would not be re-run.\n\t\t\t\t\t\t\tincrement(version);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t};\n}\n","/** @import { Effect, Source, TemplateNode, } from '#client' */\nimport { BOUNDARY_EFFECT, EFFECT_PRESERVED, EFFECT_TRANSPARENT } from '#client/constants';\nimport { HYDRATION_START_ELSE, HYDRATION_START_FAILED } from '../../../../constants.js';\nimport { component_context, set_component_context } from '../../context.js';\nimport { invoke_error_boundary } from '../../error-handling.js';\nimport {\n\tblock,\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect\n} from '../../reactivity/effects.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tnext,\n\tskip_nodes,\n\tset_hydrate_node\n} from '../hydration.js';\nimport { queue_micro_task } from '../task.js';\nimport * as e from '../../errors.js';\nimport * as w from '../../warnings.js';\nimport { DEV } from 'esm-env';\nimport { Batch, current_batch } from '../../reactivity/batch.js';\nimport { internal_set, source } from '../../reactivity/sources.js';\nimport { tag } from '../../dev/tracing.js';\nimport { createSubscriber } from '../../../../reactivity/create-subscriber.js';\nimport { create_text } from '../operations.js';\nimport { defer_effect } from '../../reactivity/utils.js';\n\n/**\n * @typedef {{\n * \t onerror?: ((error: unknown, reset: () => void) => void) | null;\n * failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null;\n * pending?: ((anchor: Node) => void) | null;\n * }} BoundaryProps\n */\n\nvar flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;\n\n/**\n * @param {TemplateNode} node\n * @param {BoundaryProps} props\n * @param {((anchor: Node) => void)} children\n * @param {((error: unknown) => unknown) | undefined} [transform_error]\n * @returns {void}\n */\nexport function boundary(node, props, children, transform_error) {\n\tnew Boundary(node, props, children, transform_error);\n}\n\nexport class Boundary {\n\t/** @type {Boundary | null} */\n\tparent;\n\n\tis_pending = false;\n\n\t/**\n\t * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.\n\t * Inherited from parent boundary, or defaults to identity.\n\t * @type {(error: unknown) => unknown}\n\t */\n\ttransform_error;\n\n\t/** @type {TemplateNode} */\n\t#anchor;\n\n\t/** @type {TemplateNode | null} */\n\t#hydrate_open = hydrating ? hydrate_node : null;\n\n\t/** @type {BoundaryProps} */\n\t#props;\n\n\t/** @type {((anchor: Node) => void)} */\n\t#children;\n\n\t/** @type {Effect} */\n\t#effect;\n\n\t/** @type {Effect | null} */\n\t#main_effect = null;\n\n\t/** @type {Effect | null} */\n\t#pending_effect = null;\n\n\t/** @type {Effect | null} */\n\t#failed_effect = null;\n\n\t/** @type {DocumentFragment | null} */\n\t#offscreen_fragment = null;\n\n\t#local_pending_count = 0;\n\t#pending_count = 0;\n\t#pending_count_update_queued = false;\n\n\t/** @type {Set<Effect>} */\n\t#dirty_effects = new Set();\n\n\t/** @type {Set<Effect>} */\n\t#maybe_dirty_effects = new Set();\n\n\t/**\n\t * A source containing the number of pending async deriveds/expressions.\n\t * Only created if `$effect.pending()` is used inside the boundary,\n\t * otherwise updating the source results in needless `Batch.ensure()`\n\t * calls followed by no-op flushes\n\t * @type {Source<number> | null}\n\t */\n\t#effect_pending = null;\n\n\t#effect_pending_subscriber = createSubscriber(() => {\n\t\tthis.#effect_pending = source(this.#local_pending_count);\n\n\t\tif (DEV) {\n\t\t\ttag(this.#effect_pending, '$effect.pending()');\n\t\t}\n\n\t\treturn () => {\n\t\t\tthis.#effect_pending = null;\n\t\t};\n\t});\n\n\t/**\n\t * @param {TemplateNode} node\n\t * @param {BoundaryProps} props\n\t * @param {((anchor: Node) => void)} children\n\t * @param {((error: unknown) => unknown) | undefined} [transform_error]\n\t */\n\tconstructor(node, props, children, transform_error) {\n\t\tthis.#anchor = node;\n\t\tthis.#props = props;\n\n\t\tthis.#children = (anchor) => {\n\t\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t\teffect.b = this;\n\t\t\teffect.f |= BOUNDARY_EFFECT;\n\n\t\t\tchildren(anchor);\n\t\t};\n\n\t\tthis.parent = /** @type {Effect} */ (active_effect).b;\n\n\t\t// Inherit transform_error from parent boundary, or use the provided one, or default to identity\n\t\tthis.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);\n\n\t\tthis.#effect = block(() => {\n\t\t\tif (hydrating) {\n\t\t\t\tconst comment = /** @type {Comment} */ (this.#hydrate_open);\n\t\t\t\thydrate_next();\n\n\t\t\t\tconst server_rendered_pending = comment.data === HYDRATION_START_ELSE;\n\t\t\t\tconst server_rendered_failed = comment.data.startsWith(HYDRATION_START_FAILED);\n\n\t\t\t\tif (server_rendered_failed) {\n\t\t\t\t\t// Server rendered the failed snippet - hydrate it.\n\t\t\t\t\t// The serialized error is embedded in the comment: <!--[?<json>-->\n\t\t\t\t\tconst serialized_error = JSON.parse(comment.data.slice(HYDRATION_START_FAILED.length));\n\t\t\t\t\tthis.#hydrate_failed_content(serialized_error);\n\t\t\t\t} else if (server_rendered_pending) {\n\t\t\t\t\tthis.#hydrate_pending_content();\n\t\t\t\t} else {\n\t\t\t\t\tthis.#hydrate_resolved_content();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.#render();\n\t\t\t}\n\t\t}, flags);\n\n\t\tif (hydrating) {\n\t\t\tthis.#anchor = hydrate_node;\n\t\t}\n\t}\n\n\t#hydrate_resolved_content() {\n\t\ttry {\n\t\t\tthis.#main_effect = branch(() => this.#children(this.#anchor));\n\t\t} catch (error) {\n\t\t\tthis.error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {unknown} error The deserialized error from the server's hydration comment\n\t */\n\t#hydrate_failed_content(error) {\n\t\tconst failed = this.#props.failed;\n\t\tconst { reset, invoke_onerror } = this.#create_reset(error);\n\n\t\t// `onerror` may mutate state, which is disallowed while hydrating\n\t\tqueue_micro_task(invoke_onerror);\n\n\t\tif (!failed) return;\n\n\t\tthis.#failed_effect = branch(() => {\n\t\t\tfailed(\n\t\t\t\tthis.#anchor,\n\t\t\t\t() => error,\n\t\t\t\t() => reset\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Creates the `reset` function for a failed boundary, along with a function\n\t * that invokes `onerror` with it (if provided)\n\t * @param {unknown} error\n\t * @returns {{ reset: () => void, invoke_onerror: () => void }}\n\t */\n\t#create_reset(error) {\n\t\tvar did_reset = false;\n\t\tvar calling_on_error = false;\n\n\t\tconst reset = () => {\n\t\t\tif (did_reset) {\n\t\t\t\tw.svelte_boundary_reset_noop();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdid_reset = true;\n\n\t\t\tif (calling_on_error) {\n\t\t\t\te.svelte_boundary_reset_onerror();\n\t\t\t}\n\n\t\t\tif (this.#failed_effect !== null) {\n\t\t\t\tpause_effect(this.#failed_effect, () => {\n\t\t\t\t\tthis.#failed_effect = null;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.#run(() => {\n\t\t\t\tthis.#render();\n\t\t\t});\n\t\t};\n\n\t\tconst invoke_onerror = () => {\n\t\t\ttry {\n\t\t\t\tcalling_on_error = true;\n\t\t\t\tthis.#props.onerror?.(error, reset);\n\t\t\t\tcalling_on_error = false;\n\t\t\t} catch (err) {\n\t\t\t\tinvoke_error_boundary(err, this.#effect && this.#effect.parent);\n\t\t\t}\n\t\t};\n\n\t\treturn { reset, invoke_onerror };\n\t}\n\n\t#hydrate_pending_content() {\n\t\tconst pending = this.#props.pending;\n\t\tif (!pending) return;\n\n\t\tthis.is_pending = true;\n\t\tthis.#pending_effect = branch(() => pending(this.#anchor));\n\n\t\tqueue_micro_task(() => {\n\t\t\tvar fragment = (this.#offscreen_fragment = document.createDocumentFragment());\n\t\t\tvar anchor = create_text();\n\t\t\tvar handled = false;\n\n\t\t\tfragment.append(anchor);\n\n\t\t\tthis.#main_effect = this.#run(() => {\n\t\t\t\ttry {\n\t\t\t\t\treturn branch(() => this.#children(anchor));\n\t\t\t\t} catch (error) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.error(error);\n\t\t\t\t\t\thandled = true;\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tinvoke_error_boundary(error, this.#effect.parent);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (this.#main_effect === null) {\n\t\t\t\tthis.#offscreen_fragment = null;\n\t\t\t\tif (handled) this.#resolve(/** @type {Batch} */ (current_batch));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this.#pending_count === 0) {\n\t\t\t\tthis.#anchor.before(fragment);\n\t\t\t\tthis.#offscreen_fragment = null;\n\n\t\t\t\tpause_effect(/** @type {Effect} */ (this.#pending_effect), () => {\n\t\t\t\t\tthis.#pending_effect = null;\n\t\t\t\t});\n\n\t\t\t\tthis.#resolve(/** @type {Batch} */ (current_batch));\n\t\t\t}\n\t\t});\n\t}\n\n\t#render() {\n\t\ttry {\n\t\t\tthis.is_pending = this.has_pending_snippet();\n\t\t\tthis.#pending_count = 0;\n\t\t\tthis.#local_pending_count = 0;\n\n\t\t\tthis.#main_effect = branch(() => {\n\t\t\t\tthis.#children(this.#anchor);\n\t\t\t});\n\n\t\t\tif (this.#pending_count > 0) {\n\t\t\t\tvar fragment = (this.#offscreen_fragment = document.createDocumentFragment());\n\t\t\t\tmove_effect(this.#main_effect, fragment);\n\n\t\t\t\tconst pending = /** @type {(anchor: Node) => void} */ (this.#props.pending);\n\t\t\t\tthis.#pending_effect = branch(() => pending(this.#anchor));\n\t\t\t} else {\n\t\t\t\tthis.#resolve(/** @type {Batch} */ (current_batch));\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#resolve(batch) {\n\t\tthis.is_pending = false;\n\n\t\t// any effects that were previously deferred should be transferred\n\t\t// to the batch, which will flush in the next microtask\n\t\tbatch.transfer_effects(this.#dirty_effects, this.#maybe_dirty_effects);\n\t}\n\n\t/**\n\t * Defer an effect inside a pending boundary until the boundary resolves\n\t * @param {Effect} effect\n\t */\n\tdefer_effect(effect) {\n\t\tdefer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects);\n\t}\n\n\t/**\n\t * Returns `false` if the effect exists inside a boundary whose pending snippet is shown\n\t * @returns {boolean}\n\t */\n\tis_rendered() {\n\t\treturn !this.is_pending && (!this.parent || this.parent.is_rendered());\n\t}\n\n\thas_pending_snippet() {\n\t\treturn !!this.#props.pending;\n\t}\n\n\t/**\n\t * @template T\n\t * @param {() => T} fn\n\t */\n\t#run(fn) {\n\t\tvar previous_effect = active_effect;\n\t\tvar previous_reaction = active_reaction;\n\t\tvar previous_ctx = component_context;\n\n\t\tset_active_effect(this.#effect);\n\t\tset_active_reaction(this.#effect);\n\t\tset_component_context(this.#effect.ctx);\n\n\t\ttry {\n\t\t\tBatch.ensure();\n\t\t\treturn fn();\n\t\t} finally {\n\t\t\tset_active_effect(previous_effect);\n\t\t\tset_active_reaction(previous_reaction);\n\t\t\tset_component_context(previous_ctx);\n\t\t}\n\t}\n\n\t/**\n\t * Updates the pending count associated with the currently visible pending snippet,\n\t * if any, such that we can replace the snippet with content once work is done\n\t * @param {1 | -1} d\n\t * @param {Batch} batch\n\t */\n\t#update_pending_count(d, batch) {\n\t\tif (!this.has_pending_snippet()) {\n\t\t\tif (this.parent) {\n\t\t\t\tthis.parent.#update_pending_count(d, batch);\n\t\t\t}\n\n\t\t\t// if there's no parent, we're in a scope with no pending snippet\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#pending_count += d;\n\n\t\tif (this.#pending_count === 0) {\n\t\t\tthis.#resolve(batch);\n\n\t\t\tif (this.#pending_effect) {\n\t\t\t\tpause_effect(this.#pending_effect, () => {\n\t\t\t\t\tthis.#pending_effect = null;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (this.#offscreen_fragment) {\n\t\t\t\tthis.#anchor.before(this.#offscreen_fragment);\n\t\t\t\tthis.#offscreen_fragment = null;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Update the source that powers `$effect.pending()` inside this boundary,\n\t * and controls when the current `pending` snippet (if any) is removed.\n\t * Do not call from inside the class\n\t * @param {1 | -1} d\n\t * @param {Batch} batch\n\t */\n\tupdate_pending_count(d, batch) {\n\t\tthis.#update_pending_count(d, batch);\n\n\t\tthis.#local_pending_count += d;\n\n\t\tif (!this.#effect_pending || this.#pending_count_update_queued) return;\n\t\tthis.#pending_count_update_queued = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tthis.#pending_count_update_queued = false;\n\t\t\tif (this.#effect_pending) {\n\t\t\t\tinternal_set(this.#effect_pending, this.#local_pending_count);\n\t\t\t}\n\t\t});\n\t}\n\n\tget_effect_pending() {\n\t\tthis.#effect_pending_subscriber();\n\t\treturn get(/** @type {Source<number>} */ (this.#effect_pending));\n\t}\n\n\t/** @param {unknown} error */\n\terror(error) {\n\t\t// If we have nothing to capture the error, or if we hit an error while\n\t\t// rendering the fallback, re-throw for another boundary to handle\n\t\tif (!this.#props.onerror && !this.#props.failed) {\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (current_batch?.is_fork) {\n\t\t\tif (this.#main_effect) current_batch.skip_effect(this.#main_effect);\n\t\t\tif (this.#pending_effect) current_batch.skip_effect(this.#pending_effect);\n\t\t\tif (this.#failed_effect) current_batch.skip_effect(this.#failed_effect);\n\n\t\t\tcurrent_batch.oncommit(() => {\n\t\t\t\tthis.#handle_error(error);\n\t\t\t});\n\t\t} else {\n\t\t\tthis.#handle_error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {unknown} error\n\t */\n\t#handle_error(error) {\n\t\tif (this.#main_effect) {\n\t\t\tdestroy_effect(this.#main_effect);\n\t\t\tthis.#main_effect = null;\n\t\t}\n\n\t\tif (this.#pending_effect) {\n\t\t\tdestroy_effect(this.#pending_effect);\n\t\t\tthis.#pending_effect = null;\n\t\t}\n\n\t\tif (this.#failed_effect) {\n\t\t\tdestroy_effect(this.#failed_effect);\n\t\t\tthis.#failed_effect = null;\n\t\t}\n\n\t\tif (hydrating) {\n\t\t\tset_hydrate_node(/** @type {TemplateNode} */ (this.#hydrate_open));\n\t\t\tnext();\n\t\t\tset_hydrate_node(skip_nodes());\n\t\t}\n\n\t\tlet failed = this.#props.failed;\n\n\t\t/** @param {unknown} transformed_error */\n\t\tconst handle_error_result = (transformed_error) => {\n\t\t\tconst { reset, invoke_onerror } = this.#create_reset(transformed_error);\n\n\t\t\tinvoke_onerror();\n\n\t\t\tif (failed) {\n\t\t\t\tthis.#failed_effect = this.#run(() => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn branch(() => {\n\t\t\t\t\t\t\t// errors in `failed` snippets cause the boundary to error again\n\t\t\t\t\t\t\t// TODO Svelte 6: revisit this decision, most likely better to go to parent boundary instead\n\t\t\t\t\t\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t\t\t\t\t\teffect.b = this;\n\t\t\t\t\t\t\teffect.f |= BOUNDARY_EFFECT;\n\n\t\t\t\t\t\t\tfailed(\n\t\t\t\t\t\t\t\tthis.#anchor,\n\t\t\t\t\t\t\t\t() => transformed_error,\n\t\t\t\t\t\t\t\t() => reset\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tinvoke_error_boundary(error, /** @type {Effect} */ (this.#effect.parent));\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\tqueue_micro_task(() => {\n\t\t\t// Run the error through the API-level transformError transform (e.g. SvelteKit's handleError)\n\t\t\t/** @type {unknown} */\n\t\t\tvar result;\n\t\t\ttry {\n\t\t\t\tresult = this.transform_error(error);\n\t\t\t} catch (e) {\n\t\t\t\tinvoke_error_boundary(e, this.#effect && this.#effect.parent);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tresult !== null &&\n\t\t\t\ttypeof result === 'object' &&\n\t\t\t\ttypeof (/** @type {any} */ (result).then) === 'function'\n\t\t\t) {\n\t\t\t\t// transformError returned a Promise — wait for it\n\t\t\t\t/** @type {any} */ (result).then(\n\t\t\t\t\thandle_error_result,\n\t\t\t\t\t/** @param {unknown} e */\n\t\t\t\t\t(e) => invoke_error_boundary(e, this.#effect && this.#effect.parent)\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Synchronous result — handle immediately\n\t\t\t\thandle_error_result(result);\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function pending() {\n\tif (active_effect === null) {\n\t\te.effect_pending_outside_reaction();\n\t}\n\n\tvar boundary = active_effect.b;\n\n\tif (boundary === null) {\n\t\treturn 0; // TODO eventually we will need this to be global\n\t}\n\n\treturn boundary.get_effect_pending();\n}\n","/** @import { ComponentContext, Effect, EffectNodes, TemplateNode } from '#client' */\n/** @import { Component, ComponentType, SvelteComponent, MountOptions } from '../../index.js' */\nimport { DEV } from 'esm-env';\nimport {\n\tclear_text_content,\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tinit_operations\n} from './dom/operations.js';\nimport { HYDRATION_END, HYDRATION_ERROR, HYDRATION_START } from '../../constants.js';\nimport { active_effect } from './runtime.js';\nimport { push, pop, component_context, mark_as_component } from './context.js';\nimport { component_root } from './reactivity/effects.js';\nimport { hydrate_node, hydrating, set_hydrate_node, set_hydrating } from './dom/hydration.js';\nimport { array_from } from '../shared/utils.js';\nimport {\n\tall_registered_events,\n\thandle_event_propagation,\n\troot_event_handles\n} from './dom/elements/events.js';\nimport * as w from './warnings.js';\nimport * as e from './errors.js';\nimport { assign_nodes } from './dom/template.js';\nimport { is_passive_event } from '../../utils.js';\nimport { COMMENT_NODE, TEXT_CACHE } from './constants.js';\nimport { boundary } from './dom/blocks/boundary.js';\n\n/**\n * This is normally true — block effects should run their intro transitions —\n * but is false during hydration (unless `options.intro` is `true`) and\n * when creating the children of a `<svelte:element>` that just changed tag\n */\nexport let should_intro = true;\n\n/** @param {boolean} value */\nexport function set_should_intro(value) {\n\tshould_intro = value;\n}\n\n/**\n * @param {Element} text\n * @param {string} value\n * @returns {void}\n */\nexport function set_text(text, value) {\n\t// For objects, we apply string coercion (which might make things like $state array references in the template reactive) before diffing\n\tvar str = value == null ? '' : typeof value === 'object' ? `${value}` : value;\n\t// prettier-ignore\n\tif (str !== (/** @type {any} */ (text)[TEXT_CACHE] ??= text.nodeValue)) {\n\t\t/** @type {any} */ (text)[TEXT_CACHE] = str;\n\t\ttext.nodeValue = `${str}`;\n\t}\n}\n\n/**\n * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component.\n * Transitions will play during the initial render unless the `intro` option is set to `false`.\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component\n * @param {MountOptions<Props>} options\n * @returns {Exports}\n */\nexport function mount(component, options) {\n\treturn _mount(component, options);\n}\n\n/**\n * Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component\n * @param {{} extends Props ? {\n * \t\ttarget: Document | Element | ShadowRoot;\n * \t\tprops?: Props;\n * \t\tevents?: Record<string, (e: any) => any>;\n * \tcontext?: Map<any, any>;\n * \t\tintro?: boolean;\n * \t\trecover?: boolean;\n *\t\ttransformError?: (error: unknown) => unknown;\n * \t} : {\n * \t\ttarget: Document | Element | ShadowRoot;\n * \t\tprops: Props;\n * \t\tevents?: Record<string, (e: any) => any>;\n * \tcontext?: Map<any, any>;\n * \t\tintro?: boolean;\n * \t\trecover?: boolean;\n *\t\ttransformError?: (error: unknown) => unknown;\n * \t}} options\n * @returns {Exports}\n */\nexport function hydrate(component, options) {\n\tinit_operations();\n\toptions.intro = options.intro ?? false;\n\tconst target = options.target;\n\tconst was_hydrating = hydrating;\n\tconst previous_hydrate_node = hydrate_node;\n\n\ttry {\n\t\tvar anchor = get_first_child(target);\n\n\t\twhile (\n\t\t\tanchor &&\n\t\t\t(anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */ (anchor).data !== HYDRATION_START)\n\t\t) {\n\t\t\tanchor = get_next_sibling(anchor);\n\t\t}\n\n\t\tif (!anchor) {\n\t\t\tthrow HYDRATION_ERROR;\n\t\t}\n\n\t\tset_hydrating(true);\n\t\tset_hydrate_node(/** @type {Comment} */ (anchor));\n\n\t\tconst instance = _mount(component, { ...options, anchor });\n\n\t\tset_hydrating(false);\n\n\t\treturn /** @type {Exports} */ (instance);\n\t} catch (error) {\n\t\t// re-throw Svelte errors - they are certainly not related to hydration\n\t\tif (\n\t\t\terror instanceof Error &&\n\t\t\terror.message.split('\\n').some((line) => line.startsWith('https://svelte.dev/e/'))\n\t\t) {\n\t\t\tthrow error;\n\t\t}\n\t\tif (error !== HYDRATION_ERROR) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn('Failed to hydrate: ', error);\n\t\t}\n\n\t\tif (options.recover === false) {\n\t\t\te.hydration_failed();\n\t\t}\n\n\t\t// If an error occurred above, the operations might not yet have been initialised.\n\t\tinit_operations();\n\t\tclear_text_content(target);\n\n\t\tset_hydrating(false);\n\t\treturn mount(component, options);\n\t} finally {\n\t\tset_hydrating(was_hydrating);\n\t\tset_hydrate_node(previous_hydrate_node);\n\t}\n}\n\n/** @type {Map<EventTarget, Map<string, number>>} */\nconst listeners = new Map();\n\n/**\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<any>> | Component<any>} Component\n * @param {MountOptions} options\n * @returns {Exports}\n */\nfunction _mount(\n\tComponent,\n\t{ target, anchor, props = {}, events, context, intro = true, transformError }\n) {\n\tinit_operations();\n\n\t/** @type {Exports} */\n\t// @ts-expect-error will be defined because the render effect runs synchronously\n\tvar component = undefined;\n\n\tvar unmount = component_root(() => {\n\t\tvar anchor_node = anchor ?? target.appendChild(create_text());\n\n\t\tboundary(\n\t\t\t/** @type {TemplateNode} */ (anchor_node),\n\t\t\t{\n\t\t\t\tpending: () => {}\n\t\t\t},\n\t\t\t(anchor_node) => {\n\t\t\t\tpush({});\n\t\t\t\tvar ctx = /** @type {ComponentContext} */ (component_context);\n\t\t\t\tif (context) ctx.c = context;\n\n\t\t\t\tif (events) {\n\t\t\t\t\t// We can't spread the object or else we'd lose the state proxy stuff, if it is one\n\t\t\t\t\t/** @type {any} */ (props).$$events = events;\n\t\t\t\t}\n\n\t\t\t\tif (hydrating) {\n\t\t\t\t\tassign_nodes(/** @type {TemplateNode} */ (anchor_node), null);\n\t\t\t\t}\n\n\t\t\t\tshould_intro = intro;\n\t\t\t\t// @ts-expect-error the public typings are not what the actual function looks like\n\t\t\t\tcomponent = Component(anchor_node, props) || mark_as_component();\n\t\t\t\tshould_intro = true;\n\n\t\t\t\tif (hydrating) {\n\t\t\t\t\t/** @type {Effect & { nodes: EffectNodes }} */ (active_effect).nodes.end = hydrate_node;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\thydrate_node === null ||\n\t\t\t\t\t\thydrate_node.nodeType !== COMMENT_NODE ||\n\t\t\t\t\t\t/** @type {Comment} */ (hydrate_node).data !== HYDRATION_END\n\t\t\t\t\t) {\n\t\t\t\t\t\tw.hydration_mismatch();\n\t\t\t\t\t\tthrow HYDRATION_ERROR;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tpop();\n\t\t\t},\n\t\t\ttransformError\n\t\t);\n\n\t\t// Setup event delegation _after_ component is mounted - if an error would happen during mount, it would otherwise not be cleaned up\n\t\t/** @type {Set<string>} */\n\t\tvar registered_events = new Set();\n\n\t\t/** @param {Array<string>} events */\n\t\tvar event_handle = (events) => {\n\t\t\tfor (var i = 0; i < events.length; i++) {\n\t\t\t\tvar event_name = events[i];\n\n\t\t\t\tif (registered_events.has(event_name)) continue;\n\t\t\t\tregistered_events.add(event_name);\n\n\t\t\t\tvar passive = is_passive_event(event_name);\n\n\t\t\t\t// Add the event listener to both the container and the document.\n\t\t\t\t// The container listener ensures we catch events from within in case\n\t\t\t\t// the outer content stops propagation of the event.\n\t\t\t\t//\n\t\t\t\t// The document listener ensures we catch events that originate from elements that were\n\t\t\t\t// manually moved outside of the container (e.g. via manual portals).\n\t\t\t\tfor (const node of [target, document]) {\n\t\t\t\t\tvar counts = listeners.get(node);\n\n\t\t\t\t\tif (counts === undefined) {\n\t\t\t\t\t\tcounts = new Map();\n\t\t\t\t\t\tlisteners.set(node, counts);\n\t\t\t\t\t}\n\n\t\t\t\t\tvar count = counts.get(event_name);\n\n\t\t\t\t\tif (count === undefined) {\n\t\t\t\t\t\tnode.addEventListener(event_name, handle_event_propagation, { passive });\n\t\t\t\t\t\tcounts.set(event_name, 1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcounts.set(event_name, count + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tevent_handle(array_from(all_registered_events));\n\t\troot_event_handles.add(event_handle);\n\n\t\treturn () => {\n\t\t\tfor (var event_name of registered_events) {\n\t\t\t\tfor (const node of [target, document]) {\n\t\t\t\t\tvar counts = /** @type {Map<string, number>} */ (listeners.get(node));\n\t\t\t\t\tvar count = /** @type {number} */ (counts.get(event_name));\n\n\t\t\t\t\tif (--count == 0) {\n\t\t\t\t\t\tnode.removeEventListener(event_name, handle_event_propagation);\n\t\t\t\t\t\tcounts.delete(event_name);\n\n\t\t\t\t\t\tif (counts.size === 0) {\n\t\t\t\t\t\t\tlisteners.delete(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcounts.set(event_name, count);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\troot_event_handles.delete(event_handle);\n\n\t\t\tif (anchor_node !== anchor) {\n\t\t\t\tanchor_node.parentNode?.removeChild(anchor_node);\n\t\t\t}\n\t\t};\n\t});\n\n\tmounted_components.set(component, unmount);\n\treturn component;\n}\n\n/**\n * References of the components that were mounted or hydrated.\n * Uses a `WeakMap` to avoid memory leaks.\n */\nlet mounted_components = new WeakMap();\n\n/**\n * Unmounts a component that was previously mounted using `mount` or `hydrate`.\n *\n * Since 5.13.0, if `options.outro` is `true`, [transitions](https://svelte.dev/docs/svelte/transition) will play before the component is removed from the DOM.\n *\n * Returns a `Promise` that resolves after transitions have completed if `options.outro` is true, or immediately otherwise (prior to 5.13.0, returns `void`).\n *\n * ```js\n * import { mount, unmount } from 'svelte';\n * import App from './App.svelte';\n *\n * const app = mount(App, { target: document.body });\n *\n * // later...\n * unmount(app, { outro: true });\n * ```\n * @param {Record<string, any>} component\n * @param {{ outro?: boolean }} [options]\n * @returns {Promise<void>}\n */\nexport function unmount(component, options) {\n\tconst fn = mounted_components.get(component);\n\n\tif (fn) {\n\t\tmounted_components.delete(component);\n\t\treturn fn(options);\n\t}\n\n\tif (DEV) {\n\t\tw.lifecycle_double_unmount();\n\t}\n\n\treturn Promise.resolve();\n}\n","/** @import { Effect, TemplateNode } from '#client' */\nimport { Batch, current_batch } from '../../reactivity/batch.js';\nimport {\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect,\n\tresume_effect\n} from '../../reactivity/effects.js';\nimport { HMR_ANCHOR } from '../../constants.js';\nimport { hydrate_node, hydrating } from '../hydration.js';\nimport { create_text, should_defer_append } from '../operations.js';\nimport { DEV } from 'esm-env';\n\n/**\n * @typedef {{ effect: Effect, fragment: DocumentFragment }} Branch\n */\n\n/**\n * @template Key\n */\nexport class BranchManager {\n\t/** @type {TemplateNode} */\n\tanchor;\n\n\t/** @type {Map<Batch, Key>} */\n\t#batches = new Map();\n\n\t/**\n\t * Map of keys to effects that are currently rendered in the DOM.\n\t * These effects are visible and actively part of the document tree.\n\t * Example:\n\t * ```\n\t * {#if condition}\n\t * \tfoo\n\t * {:else}\n\t * \tbar\n\t * {/if}\n\t * ```\n\t * Can result in the entries `true->Effect` and `false->Effect`\n\t * @type {Map<Key, Effect>}\n\t */\n\t#onscreen = new Map();\n\n\t/**\n\t * Similar to #onscreen with respect to the keys, but contains branches that are not yet\n\t * in the DOM, because their insertion is deferred.\n\t * @type {Map<Key, Branch>}\n\t */\n\t#offscreen = new Map();\n\n\t/**\n\t * Keys of effects that are currently outroing\n\t * @type {Set<Key>}\n\t */\n\t#outroing = new Set();\n\n\t/**\n\t * Whether to pause (i.e. outro) on change, or destroy immediately.\n\t * This is necessary for `<svelte:element>`\n\t */\n\t#transition = true;\n\n\t/**\n\t * @param {TemplateNode} anchor\n\t * @param {boolean} transition\n\t */\n\tconstructor(anchor, transition = true) {\n\t\tthis.anchor = anchor;\n\t\tthis.#transition = transition;\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#commit = (batch) => {\n\t\t// if this batch was made obsolete, bail\n\t\tif (!this.#batches.has(batch)) return;\n\n\t\tvar key = /** @type {Key} */ (this.#batches.get(batch));\n\n\t\tvar onscreen = this.#onscreen.get(key);\n\n\t\tif (onscreen) {\n\t\t\t// effect is already in the DOM — abort any current outro\n\t\t\tresume_effect(onscreen);\n\t\t\tthis.#outroing.delete(key);\n\t\t} else {\n\t\t\t// effect is currently offscreen. put it in the DOM\n\t\t\tvar offscreen = this.#offscreen.get(key);\n\n\t\t\tif (offscreen) {\n\t\t\t\t// effect could have been outro'ed before through a prior batch — resume if necessary\n\t\t\t\tresume_effect(offscreen.effect);\n\t\t\t\tthis.#onscreen.set(key, offscreen.effect);\n\t\t\t\tthis.#offscreen.delete(key);\n\n\t\t\t\tif (DEV) {\n\t\t\t\t\t// Tell hmr.js about the anchor it should use for updates,\n\t\t\t\t\t// since the initial one will be removed\n\t\t\t\t\t/** @type {any} */ (offscreen.fragment.lastChild)[HMR_ANCHOR] = this.anchor;\n\t\t\t\t}\n\n\t\t\t\t// remove the anchor...\n\t\t\t\t/** @type {TemplateNode} */ (offscreen.fragment.lastChild).remove();\n\n\t\t\t\t// ...and append the fragment\n\t\t\t\tthis.anchor.before(offscreen.fragment);\n\t\t\t\tonscreen = offscreen.effect;\n\t\t\t}\n\t\t}\n\n\t\tfor (const [b, k] of this.#batches) {\n\t\t\tthis.#batches.delete(b);\n\n\t\t\tif (b === batch) {\n\t\t\t\t// keep values for newer batches\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst offscreen = this.#offscreen.get(k);\n\n\t\t\tif (offscreen) {\n\t\t\t\t// for older batches, destroy offscreen effects\n\t\t\t\t// as they will never be committed\n\t\t\t\tdestroy_effect(offscreen.effect);\n\t\t\t\tthis.#offscreen.delete(k);\n\t\t\t}\n\t\t}\n\n\t\t// outro/destroy all onscreen effects...\n\t\tfor (const [k, effect] of this.#onscreen) {\n\t\t\t// ...except the one that was just committed\n\t\t\t// or those that are already outroing (else the transition is aborted and the effect destroyed right away)\n\t\t\tif (k === key || this.#outroing.has(k)) continue;\n\n\t\t\tconst on_destroy = () => {\n\t\t\t\tconst keys = Array.from(this.#batches.values());\n\n\t\t\t\tif (keys.includes(k)) {\n\t\t\t\t\t// keep the effect offscreen, as another batch will need it\n\t\t\t\t\tvar fragment = document.createDocumentFragment();\n\t\t\t\t\tmove_effect(effect, fragment);\n\n\t\t\t\t\tfragment.append(create_text()); // TODO can we avoid this?\n\n\t\t\t\t\tthis.#offscreen.set(k, { effect, fragment });\n\t\t\t\t} else {\n\t\t\t\t\tdestroy_effect(effect);\n\t\t\t\t}\n\n\t\t\t\tthis.#outroing.delete(k);\n\t\t\t\tthis.#onscreen.delete(k);\n\t\t\t};\n\n\t\t\tif (this.#transition || !onscreen) {\n\t\t\t\tthis.#outroing.add(k);\n\t\t\t\tpause_effect(effect, on_destroy, false);\n\t\t\t} else {\n\t\t\t\ton_destroy();\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#discard = (batch) => {\n\t\tthis.#batches.delete(batch);\n\n\t\tconst keys = Array.from(this.#batches.values());\n\n\t\tfor (const [k, branch] of this.#offscreen) {\n\t\t\tif (!keys.includes(k)) {\n\t\t\t\tdestroy_effect(branch.effect);\n\t\t\t\tthis.#offscreen.delete(k);\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t *\n\t * @param {any} key\n\t * @param {null | ((target: TemplateNode) => void)} fn\n\t */\n\tensure(key, fn) {\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\tvar defer = should_defer_append();\n\n\t\tif (fn && !this.#onscreen.has(key) && !this.#offscreen.has(key)) {\n\t\t\tif (defer) {\n\t\t\t\tvar fragment = document.createDocumentFragment();\n\t\t\t\tvar target = create_text();\n\n\t\t\t\tfragment.append(target);\n\n\t\t\t\tthis.#offscreen.set(key, {\n\t\t\t\t\teffect: branch(() => fn(target)),\n\t\t\t\t\tfragment\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.#onscreen.set(\n\t\t\t\t\tkey,\n\t\t\t\t\tbranch(() => fn(this.anchor))\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tthis.#batches.set(batch, key);\n\n\t\tif (defer) {\n\t\t\tfor (const [k, effect] of this.#onscreen) {\n\t\t\t\tif (k === key) {\n\t\t\t\t\tbatch.unskip_effect(effect);\n\t\t\t\t} else {\n\t\t\t\t\tbatch.skip_effect(effect);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [k, branch] of this.#offscreen) {\n\t\t\t\tif (k === key) {\n\t\t\t\t\tbatch.unskip_effect(branch.effect);\n\t\t\t\t} else {\n\t\t\t\t\tbatch.skip_effect(branch.effect);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbatch.oncommit(this.#commit);\n\t\t\tbatch.ondiscard(this.#discard);\n\t\t} else {\n\t\t\tif (hydrating) {\n\t\t\t\tthis.anchor = hydrate_node;\n\t\t\t}\n\n\t\t\tthis.#commit(batch);\n\t\t}\n\t}\n}\n","/** @import { TemplateNode } from '#client' */\nimport { EFFECT_TRANSPARENT } from '#client/constants';\nimport {\n\thydrate_next,\n\thydrating,\n\tread_hydration_instruction,\n\tskip_nodes,\n\tset_hydrate_node,\n\tset_hydrating,\n\thydrate_node\n} from '../hydration.js';\nimport { block } from '../../reactivity/effects.js';\nimport { BranchManager } from './branches.js';\n\n/**\n * @param {TemplateNode} node\n * @param {(branch: (fn: (anchor: Node) => void, key?: number | false) => void) => void} fn\n * @param {boolean} [elseif] True if this is an `{:else if ...}` block rather than an `{#if ...}`, as that affects which transitions are considered 'local'\n * @returns {void}\n */\nexport function if_block(node, fn, elseif = false) {\n\t/** @type {TemplateNode | undefined} */\n\tvar marker;\n\tif (hydrating) {\n\t\tmarker = hydrate_node;\n\t\thydrate_next();\n\t}\n\n\tvar branches = new BranchManager(node);\n\tvar flags = elseif ? EFFECT_TRANSPARENT : 0;\n\n\t/**\n\t * @param {number | false} key\n\t * @param {null | ((anchor: Node) => void)} fn\n\t */\n\tfunction update_branch(key, fn) {\n\t\tif (hydrating) {\n\t\t\tvar data = read_hydration_instruction(/** @type {TemplateNode} */ (marker));\n\n\t\t\t// \"[n\" = branch n, \"[-1\" = else\n\t\t\tif (key !== parseInt(data.substring(1))) {\n\t\t\t\t// Hydration mismatch: remove everything inside the anchor and start fresh.\n\t\t\t\t// This could happen with `{#if browser}...{/if}`, for example\n\t\t\t\tvar anchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tbranches.anchor = anchor;\n\n\t\t\t\tset_hydrating(false);\n\t\t\t\tbranches.ensure(key, fn);\n\t\t\t\tset_hydrating(true);\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tbranches.ensure(key, fn);\n\t}\n\n\tblock(() => {\n\t\tvar has_branch = false;\n\n\t\tfn((fn, key = 0) => {\n\t\t\thas_branch = true;\n\t\t\tupdate_branch(key, fn);\n\t\t});\n\n\t\tif (!has_branch) {\n\t\t\tupdate_branch(-1, null);\n\t\t}\n\t}, flags);\n}\n","/** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, Source, TemplateNode, TransitionManager, Value } from '#client' */\n/** @import { Batch } from '../../reactivity/batch.js'; */\nimport {\n\tEACH_INDEX_REACTIVE,\n\tEACH_IS_ANIMATED,\n\tEACH_IS_CONTROLLED,\n\tEACH_ITEM_IMMUTABLE,\n\tEACH_ITEM_REACTIVE,\n\tHYDRATION_END,\n\tHYDRATION_START_ELSE\n} from '../../../../constants.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tread_hydration_instruction,\n\tskip_nodes,\n\tset_hydrate_node,\n\tset_hydrating\n} from '../hydration.js';\nimport {\n\tclear_text_content,\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tshould_defer_append\n} from '../operations.js';\nimport {\n\tblock,\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect,\n\tresume_effect\n} from '../../reactivity/effects.js';\nimport { source, mutable_source, internal_set } from '../../reactivity/sources.js';\nimport { array_from, is_array } from '../../../shared/utils.js';\nimport { BRANCH_EFFECT, COMMENT_NODE, DESTROYED, EFFECT_OFFSCREEN, INERT } from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { get } from '../../runtime.js';\nimport { DEV } from 'esm-env';\nimport { derived_safe_equal } from '../../reactivity/deriveds.js';\nimport { current_batch } from '../../reactivity/batch.js';\nimport * as e from '../../errors.js';\nimport { tag } from '../../dev/tracing.js';\n\n// When making substantive changes to this file, validate them with the each block stress test:\n// https://svelte.dev/playground/1972b2cf46564476ad8c8c6405b23b7b\n// This test also exists in this repo, as `packages/svelte/tests/manual/each-stress-test`\n\n/**\n * @param {any} _\n * @param {number} i\n */\nexport function index(_, i) {\n\treturn i;\n}\n\n/**\n * Pause multiple effects simultaneously, and coordinate their\n * subsequent destruction. Used in each blocks\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {null | Node} controlled_anchor\n */\nfunction pause_effects(state, to_destroy, controlled_anchor) {\n\t/** @type {TransitionManager[]} */\n\tvar transitions = [];\n\tvar length = to_destroy.length;\n\n\t/** @type {EachOutroGroup} */\n\tvar group;\n\tvar remaining = to_destroy.length;\n\n\tfor (var i = 0; i < length; i++) {\n\t\tlet effect = to_destroy[i];\n\n\t\tpause_effect(\n\t\t\teffect,\n\t\t\t() => {\n\t\t\t\tif (group) {\n\t\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\t\tgroup.done.add(effect);\n\n\t\t\t\t\tif (group.pending.size === 0) {\n\t\t\t\t\t\tvar groups = /** @type {Set<EachOutroGroup>} */ (state.outrogroups);\n\n\t\t\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\t\t\tgroups.delete(group);\n\n\t\t\t\t\t\tif (groups.size === 0) {\n\t\t\t\t\t\t\tstate.outrogroups = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tremaining -= 1;\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse\n\t\t);\n\t}\n\n\tif (remaining === 0) {\n\t\t// If we're in a controlled each block (i.e. the block is the only child of an\n\t\t// element), and we are removing all items, _and_ there are no out transitions,\n\t\t// we can use the fast path — emptying the element and replacing the anchor.\n\t\t// Skip the fast path when another batch is still pending on this each block:\n\t\t// that batch's keys still reference EachItems in `state.items`, which\n\t\t// `destroy_effects` needs to preserve offscreen (see #18610).\n\t\tvar fast_path =\n\t\t\ttransitions.length === 0 && controlled_anchor !== null && state.pending.size === 0;\n\n\t\tif (fast_path) {\n\t\t\tvar anchor = /** @type {Element} */ (controlled_anchor);\n\t\t\tvar parent_node = /** @type {Element} */ (anchor.parentNode);\n\n\t\t\tclear_text_content(parent_node);\n\t\t\tparent_node.append(anchor);\n\n\t\t\tstate.items.clear();\n\t\t}\n\n\t\tdestroy_effects(state, to_destroy, !fast_path);\n\t} else {\n\t\tgroup = {\n\t\t\tpending: new Set(to_destroy),\n\t\t\tdone: new Set()\n\t\t};\n\n\t\t(state.outrogroups ??= new Set()).add(group);\n\t}\n}\n\n/**\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {boolean} remove_dom\n */\nfunction destroy_effects(state, to_destroy, remove_dom = true) {\n\t/** @type {Set<Effect> | undefined} */\n\tvar preserved_effects;\n\n\t// The loop-in-a-loop isn't ideal, but we should only hit this in relatively rare cases\n\tif (state.pending.size > 0) {\n\t\tpreserved_effects = new Set();\n\n\t\tfor (const keys of state.pending.values()) {\n\t\t\tfor (const key of keys) {\n\t\t\t\tpreserved_effects.add(/** @type {EachItem} */ (state.items.get(key)).e);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (var i = 0; i < to_destroy.length; i++) {\n\t\tvar e = to_destroy[i];\n\n\t\tif (preserved_effects?.has(e)) {\n\t\t\te.f |= EFFECT_OFFSCREEN;\n\n\t\t\tconst fragment = document.createDocumentFragment();\n\t\t\tmove_effect(e, fragment);\n\t\t} else {\n\t\t\tdestroy_effect(to_destroy[i], remove_dom);\n\t\t}\n\t}\n}\n\n/** @type {TemplateNode} */\nvar offscreen_anchor;\n\n/**\n * @template V\n * @param {Element | Comment} node The next sibling node, or the parent node if this is a 'controlled' block\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @param {(value: V, index: number) => any} get_key\n * @param {(anchor: Node, item: MaybeSource<V>, index: MaybeSource<number>) => void} render_fn\n * @param {null | ((anchor: Node) => void)} fallback_fn\n * @returns {void}\n */\nexport function each(node, flags, get_collection, get_key, render_fn, fallback_fn = null) {\n\tvar anchor = node;\n\n\t/** @type {Map<any, EachItem>} */\n\tvar items = new Map();\n\n\tvar is_controlled = (flags & EACH_IS_CONTROLLED) !== 0;\n\n\tif (is_controlled) {\n\t\tvar parent_node = /** @type {Element} */ (node);\n\n\t\tanchor = hydrating\n\t\t\t? set_hydrate_node(get_first_child(parent_node))\n\t\t\t: parent_node.appendChild(create_text());\n\t}\n\n\tif (hydrating) {\n\t\thydrate_next();\n\t}\n\n\t/** @type {Effect | null} */\n\tvar fallback = null;\n\n\t// TODO: ideally we could use derived for runes mode but because of the ability\n\t// to use a store which can be mutated, we can't do that here as mutating a store\n\t// will still result in the collection array being the same from the store\n\tvar each_array = derived_safe_equal(() => {\n\t\tvar collection = get_collection();\n\n\t\treturn /** @type {V[]} */ (\n\t\t\tis_array(collection) ? collection : collection == null ? [] : array_from(collection)\n\t\t);\n\t});\n\n\tif (DEV) {\n\t\ttag(each_array, '{#each ...}');\n\t}\n\n\t/** @type {V[]} */\n\tvar array;\n\n\t/** @type {Map<Batch, Set<any>>} */\n\tvar pending = new Map();\n\n\tvar first_run = true;\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction commit(batch) {\n\t\tif ((state.effect.f & DESTROYED) !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tstate.pending.delete(batch);\n\n\t\tstate.fallback = fallback;\n\t\treconcile(state, array, anchor, flags, get_key);\n\n\t\tif (fallback !== null) {\n\t\t\tif (array.length === 0) {\n\t\t\t\tif ((fallback.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\t\tresume_effect(fallback);\n\t\t\t\t} else {\n\t\t\t\t\tfallback.f ^= EFFECT_OFFSCREEN;\n\t\t\t\t\tmove(fallback, null, anchor);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpause_effect(fallback, () => {\n\t\t\t\t\t// TODO only null out if no pending batch needs it,\n\t\t\t\t\t// otherwise re-add `fallback.fragment` and move the\n\t\t\t\t\t// effect into it\n\t\t\t\t\tfallback = null;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction discard(batch) {\n\t\tstate.pending.delete(batch);\n\t}\n\n\tvar effect = block(() => {\n\t\tarray = /** @type {V[]} */ (get(each_array));\n\t\tvar length = array.length;\n\n\t\t/** `true` if there was a hydration mismatch. Needs to be a `let` or else it isn't treeshaken out */\n\t\tlet mismatch = false;\n\n\t\tif (hydrating) {\n\t\t\tvar is_else = read_hydration_instruction(anchor) === HYDRATION_START_ELSE;\n\n\t\t\tif (is_else !== (length === 0)) {\n\t\t\t\t// hydration mismatch — remove the server-rendered DOM and start over\n\t\t\t\tanchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tset_hydrating(false);\n\t\t\t\tmismatch = true;\n\t\t\t}\n\t\t}\n\n\t\tvar keys = new Set();\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\tvar defer = should_defer_append();\n\n\t\tfor (var index = 0; index < length; index += 1) {\n\t\t\tif (\n\t\t\t\thydrating &&\n\t\t\t\thydrate_node.nodeType === COMMENT_NODE &&\n\t\t\t\t/** @type {Comment} */ (hydrate_node).data === HYDRATION_END\n\t\t\t) {\n\t\t\t\t// The server rendered fewer items than expected,\n\t\t\t\t// so break out and continue appending non-hydrated items\n\t\t\t\tanchor = /** @type {Comment} */ (hydrate_node);\n\t\t\t\tmismatch = true;\n\t\t\t\tset_hydrating(false);\n\t\t\t}\n\n\t\t\tvar value = array[index];\n\t\t\tvar key = get_key(value, index);\n\n\t\t\tif (DEV) {\n\t\t\t\t// Check that the key function is idempotent (returns the same value when called twice)\n\t\t\t\tvar key_again = get_key(value, index);\n\t\t\t\tif (key !== key_again) {\n\t\t\t\t\te.each_key_volatile(String(index), String(key), String(key_again));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar item = first_run ? null : items.get(key);\n\n\t\t\tif (item) {\n\t\t\t\t// update before reconciliation, to trigger any async updates\n\t\t\t\tif (item.v) internal_set(item.v, value);\n\t\t\t\tif (item.i) internal_set(item.i, index);\n\n\t\t\t\tif (defer) {\n\t\t\t\t\tbatch.unskip_effect(item.e);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\titem = create_item(\n\t\t\t\t\titems,\n\t\t\t\t\tfirst_run ? anchor : (offscreen_anchor ??= create_text()),\n\t\t\t\t\tvalue,\n\t\t\t\t\tkey,\n\t\t\t\t\tindex,\n\t\t\t\t\trender_fn,\n\t\t\t\t\tflags,\n\t\t\t\t\tget_collection\n\t\t\t\t);\n\n\t\t\t\tif (!first_run) {\n\t\t\t\t\titem.e.f |= EFFECT_OFFSCREEN;\n\t\t\t\t}\n\n\t\t\t\titems.set(key, item);\n\t\t\t}\n\n\t\t\tkeys.add(key);\n\t\t}\n\n\t\tif (length === 0 && fallback_fn && !fallback) {\n\t\t\tif (first_run) {\n\t\t\t\tfallback = branch(() => fallback_fn(anchor));\n\t\t\t} else {\n\t\t\t\tfallback = branch(() => fallback_fn((offscreen_anchor ??= create_text())));\n\t\t\t\tfallback.f |= EFFECT_OFFSCREEN;\n\t\t\t}\n\t\t}\n\n\t\tif (length > keys.size) {\n\t\t\tif (DEV) {\n\t\t\t\tvalidate_each_keys(array, get_key);\n\t\t\t} else {\n\t\t\t\t// in prod, the additional information isn't printed, so don't bother computing it\n\t\t\t\te.each_key_duplicate('', '', '');\n\t\t\t}\n\t\t}\n\n\t\t// remove excess nodes\n\t\tif (hydrating && length > 0) {\n\t\t\tset_hydrate_node(skip_nodes());\n\t\t}\n\n\t\tif (!first_run) {\n\t\t\tpending.set(batch, keys);\n\n\t\t\tif (defer) {\n\t\t\t\tfor (const [key, item] of items) {\n\t\t\t\t\tif (!keys.has(key)) {\n\t\t\t\t\t\tbatch.skip_effect(item.e);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbatch.oncommit(commit);\n\t\t\t\tbatch.ondiscard(discard);\n\t\t\t} else {\n\t\t\t\tcommit(batch);\n\t\t\t}\n\t\t}\n\n\t\tif (mismatch) {\n\t\t\t// continue in hydration mode\n\t\t\tset_hydrating(true);\n\t\t}\n\n\t\t// When we mount the each block for the first time, the collection won't be\n\t\t// connected to this effect as the effect hasn't finished running yet and its deps\n\t\t// won't be assigned. However, it's possible that when reconciling the each block\n\t\t// that a mutation occurred and it's made the collection MAYBE_DIRTY, so reading the\n\t\t// collection again can provide consistency to the reactive graph again as the deriveds\n\t\t// will now be `CLEAN`.\n\t\tget(each_array);\n\t});\n\n\t/** @type {EachState} */\n\tvar state = { effect, flags, items, pending, outrogroups: null, fallback };\n\n\tfirst_run = false;\n\n\tif (hydrating) {\n\t\tanchor = hydrate_node;\n\t}\n}\n\n/**\n * Skip past any non-branch effects (which could be created with `createSubscriber`, for example) to find the next branch effect\n * @param {Effect | null} effect\n * @returns {Effect | null}\n */\nfunction skip_to_branch(effect) {\n\twhile (effect !== null && (effect.f & BRANCH_EFFECT) === 0) {\n\t\teffect = effect.next;\n\t}\n\treturn effect;\n}\n\n/**\n * Add, remove, or reorder items output by an each block as its input changes\n * @template V\n * @param {EachState} state\n * @param {Array<V>} array\n * @param {Element | Comment | Text} anchor\n * @param {number} flags\n * @param {(value: V, index: number) => any} get_key\n * @returns {void}\n */\nfunction reconcile(state, array, anchor, flags, get_key) {\n\tvar is_animated = (flags & EACH_IS_ANIMATED) !== 0;\n\n\tvar length = array.length;\n\tvar items = state.items;\n\tvar current = skip_to_branch(state.effect.first);\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar seen;\n\n\t/** @type {Effect | null} */\n\tvar prev = null;\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar to_animate;\n\n\t/** @type {Effect[]} */\n\tvar matched = [];\n\n\t/** @type {Effect[]} */\n\tvar stashed = [];\n\n\t/** @type {V} */\n\tvar value;\n\n\t/** @type {any} */\n\tvar key;\n\n\t/** @type {Effect | undefined} */\n\tvar effect;\n\n\t/** @type {number} */\n\tvar i;\n\n\tif (is_animated) {\n\t\tfor (i = 0; i < length; i += 1) {\n\t\t\tvalue = array[i];\n\t\t\tkey = get_key(value, i);\n\t\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\t\t// offscreen == coming in now, no animation in that case,\n\t\t\t// else this would happen https://github.com/sveltejs/svelte/issues/17181\n\t\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\teffect.nodes?.a?.measure();\n\t\t\t\t(to_animate ??= new Set()).add(effect);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (i = 0; i < length; i += 1) {\n\t\tvalue = array[i];\n\t\tkey = get_key(value, i);\n\n\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\tif (state.outrogroups !== null) {\n\t\t\tfor (const group of state.outrogroups) {\n\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\tgroup.done.delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & INERT) !== 0) {\n\t\t\tresume_effect(effect);\n\t\t\tif (is_animated) {\n\t\t\t\teffect.nodes?.a?.unfix();\n\t\t\t\t(to_animate ??= new Set()).delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) !== 0) {\n\t\t\teffect.f ^= EFFECT_OFFSCREEN;\n\n\t\t\tif (effect === current) {\n\t\t\t\tmove(effect, null, anchor);\n\t\t\t} else {\n\t\t\t\tvar next = prev ? prev.next : current;\n\n\t\t\t\tif (effect === state.effect.last) {\n\t\t\t\t\tstate.effect.last = effect.prev;\n\t\t\t\t}\n\n\t\t\t\tif (effect.prev) effect.prev.next = effect.next;\n\t\t\t\tif (effect.next) effect.next.prev = effect.prev;\n\t\t\t\tlink(state, prev, effect);\n\t\t\t\tlink(state, effect, next);\n\n\t\t\t\tmove(effect, next, anchor);\n\t\t\t\tprev = effect;\n\n\t\t\t\tmatched = [];\n\t\t\t\tstashed = [];\n\n\t\t\t\tcurrent = skip_to_branch(prev.next);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (effect !== current) {\n\t\t\tif (seen !== undefined && seen.has(effect)) {\n\t\t\t\tif (matched.length < stashed.length) {\n\t\t\t\t\t// more efficient to move later items to the front\n\t\t\t\t\tvar start = stashed[0];\n\t\t\t\t\tvar j;\n\n\t\t\t\t\tprev = start.prev;\n\n\t\t\t\t\tvar a = matched[0];\n\t\t\t\t\tvar b = matched[matched.length - 1];\n\n\t\t\t\t\tfor (j = 0; j < matched.length; j += 1) {\n\t\t\t\t\t\tmove(matched[j], start, anchor);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (j = 0; j < stashed.length; j += 1) {\n\t\t\t\t\t\tseen.delete(stashed[j]);\n\t\t\t\t\t}\n\n\t\t\t\t\tlink(state, a.prev, b.next);\n\t\t\t\t\tlink(state, prev, a);\n\t\t\t\t\tlink(state, b, start);\n\n\t\t\t\t\tcurrent = start;\n\t\t\t\t\tprev = b;\n\t\t\t\t\ti -= 1;\n\n\t\t\t\t\tmatched = [];\n\t\t\t\t\tstashed = [];\n\t\t\t\t} else {\n\t\t\t\t\t// more efficient to move earlier items to the back\n\t\t\t\t\tseen.delete(effect);\n\t\t\t\t\tmove(effect, current, anchor);\n\n\t\t\t\t\tlink(state, effect.prev, effect.next);\n\t\t\t\t\tlink(state, effect, prev === null ? state.effect.first : prev.next);\n\t\t\t\t\tlink(state, prev, effect);\n\n\t\t\t\t\tprev = effect;\n\t\t\t\t}\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tmatched = [];\n\t\t\tstashed = [];\n\n\t\t\twhile (current !== null && current !== effect) {\n\t\t\t\t(seen ??= new Set()).add(current);\n\t\t\t\tstashed.push(current);\n\t\t\t\tcurrent = skip_to_branch(current.next);\n\t\t\t}\n\n\t\t\tif (current === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\tmatched.push(effect);\n\t\t}\n\n\t\tprev = effect;\n\t\tcurrent = skip_to_branch(effect.next);\n\t}\n\n\tif (state.outrogroups !== null) {\n\t\tfor (const group of state.outrogroups) {\n\t\t\tif (group.pending.size === 0) {\n\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\tstate.outrogroups?.delete(group);\n\t\t\t}\n\t\t}\n\n\t\tif (state.outrogroups.size === 0) {\n\t\t\tstate.outrogroups = null;\n\t\t}\n\t}\n\n\tif (current !== null || seen !== undefined) {\n\t\t/** @type {Effect[]} */\n\t\tvar to_destroy = [];\n\n\t\tif (seen !== undefined) {\n\t\t\tfor (effect of seen) {\n\t\t\t\tif ((effect.f & INERT) === 0) {\n\t\t\t\t\tto_destroy.push(effect);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\twhile (current !== null) {\n\t\t\t// If the each block isn't inert, then inert effects are currently outroing and will be removed once the transition is finished\n\t\t\tif ((current.f & INERT) === 0 && current !== state.fallback) {\n\t\t\t\tto_destroy.push(current);\n\t\t\t}\n\n\t\t\tcurrent = skip_to_branch(current.next);\n\t\t}\n\n\t\tvar destroy_length = to_destroy.length;\n\n\t\tif (destroy_length > 0) {\n\t\t\tvar controlled_anchor = (flags & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null;\n\n\t\t\tif (is_animated) {\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.measure();\n\t\t\t\t}\n\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.fix();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpause_effects(state, to_destroy, controlled_anchor);\n\t\t}\n\t}\n\n\tif (is_animated) {\n\t\tqueue_micro_task(() => {\n\t\t\tif (to_animate === undefined) return;\n\t\t\tfor (effect of to_animate) {\n\t\t\t\teffect.nodes?.a?.apply();\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @template V\n * @param {Map<any, EachItem>} items\n * @param {Node} anchor\n * @param {V} value\n * @param {unknown} key\n * @param {number} index\n * @param {(anchor: Node, item: V | Source<V>, index: number | Value<number>, collection: () => V[]) => void} render_fn\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @returns {EachItem}\n */\nfunction create_item(items, anchor, value, key, index, render_fn, flags, get_collection) {\n\tvar v =\n\t\t(flags & EACH_ITEM_REACTIVE) !== 0\n\t\t\t? (flags & EACH_ITEM_IMMUTABLE) === 0\n\t\t\t\t? mutable_source(value, false, false)\n\t\t\t\t: source(value)\n\t\t\t: null;\n\n\tvar i = (flags & EACH_INDEX_REACTIVE) !== 0 ? source(index) : null;\n\n\tif (DEV && v) {\n\t\t// For tracing purposes, we need to link the source signal we create with the\n\t\t// collection + index so that tracing works as intended\n\t\tv.trace = () => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n\t\t\tget_collection()[i?.v ?? index];\n\t\t};\n\t}\n\n\treturn {\n\t\tv,\n\t\ti,\n\t\te: branch(() => {\n\t\t\trender_fn(anchor, v ?? value, i ?? index, get_collection);\n\n\t\t\treturn () => {\n\t\t\t\titems.delete(key);\n\t\t\t};\n\t\t})\n\t};\n}\n\n/**\n * @param {Effect} effect\n * @param {Effect | null} next\n * @param {Text | Element | Comment} anchor\n */\nfunction move(effect, next, anchor) {\n\tif (!effect.nodes) return;\n\n\tvar node = effect.nodes.start;\n\tvar end = effect.nodes.end;\n\n\tvar dest =\n\t\tnext && (next.f & EFFECT_OFFSCREEN) === 0\n\t\t\t? /** @type {EffectNodes} */ (next.nodes).start\n\t\t\t: anchor;\n\n\twhile (node !== null) {\n\t\tvar next_node = /** @type {TemplateNode} */ (get_next_sibling(node));\n\t\tdest.before(node);\n\n\t\tif (node === end) {\n\t\t\treturn;\n\t\t}\n\n\t\tnode = next_node;\n\t}\n}\n\n/**\n * @param {EachState} state\n * @param {Effect | null} prev\n * @param {Effect | null} next\n */\nfunction link(state, prev, next) {\n\tif (prev === null) {\n\t\tstate.effect.first = next;\n\t} else {\n\t\tprev.next = next;\n\t}\n\n\tif (next === null) {\n\t\tstate.effect.last = prev;\n\t} else {\n\t\tnext.prev = prev;\n\t}\n}\n\n/**\n * @param {Array<any>} array\n * @param {(item: any, index: number) => string} key_fn\n * @returns {void}\n */\nfunction validate_each_keys(array, key_fn) {\n\tconst keys = new Map();\n\tconst length = array.length;\n\n\tfor (let i = 0; i < length; i++) {\n\t\tconst key = key_fn(array[i], i);\n\n\t\tif (keys.has(key)) {\n\t\t\tconst a = String(keys.get(key));\n\t\t\tconst b = String(i);\n\n\t\t\t/** @type {string | null} */\n\t\t\tlet k = String(key);\n\t\t\tif (k.startsWith('[object ')) k = null;\n\n\t\t\te.each_key_duplicate(a, b, k);\n\t\t}\n\n\t\tkeys.set(key, i);\n\t}\n}\n","import { escape_html } from '../../escaping.js';\nimport { clsx as _clsx } from 'clsx';\nimport { has_own_property } from './utils.js';\n\n/**\n * `<div translate={false}>` should be rendered as `<div translate=\"no\">` and _not_\n * `<div translate=\"false\">`, which is equivalent to `<div translate=\"yes\">`. There\n * may be other odd cases that need to be added to this list in future\n * @type {Record<string, Map<any, string>>}\n */\nconst replacements = {\n\ttranslate: new Map([\n\t\t[true, 'yes'],\n\t\t[false, 'no']\n\t])\n};\n\n/**\n * @template V\n * @param {string} name\n * @param {V} value\n * @param {boolean} [is_boolean]\n * @returns {string}\n */\nexport function attr(name, value, is_boolean = false) {\n\t// attribute hidden for values other than \"until-found\" behaves like a boolean attribute\n\tif (name === 'hidden' && value !== 'until-found') {\n\t\tis_boolean = true;\n\t}\n\t// `''` is a present boolean attribute, as it is in markup and on the client\n\tif (value == null || (is_boolean && !value && value !== '')) return '';\n\tconst normalized =\n\t\t(has_own_property.call(replacements, name) && replacements[name].get(value)) || value;\n\tconst assignment = is_boolean ? `=\"\"` : `=\"${escape_html(normalized, true)}\"`;\n\treturn ` ${name}${assignment}`;\n}\n\n/**\n * Small wrapper around clsx to preserve Svelte's (weird) handling of falsy values.\n * TODO Svelte 6 revisit this, and likely turn all falsy values into the empty string (what clsx also does)\n * @param {any} value\n */\nexport function clsx(value) {\n\tif (typeof value === 'object') {\n\t\treturn _clsx(value);\n\t} else {\n\t\treturn value ?? '';\n\t}\n}\n\nconst whitespace = [...' \\t\\n\\r\\f\\u00a0\\u000b\\ufeff'];\n\n/**\n * @param {any} value\n * @param {string | null} [hash]\n * @param {Record<string, boolean>} [directives]\n * @returns {string | null}\n */\nexport function to_class(value, hash, directives) {\n\tvar classname = value == null ? '' : '' + value;\n\n\tif (hash) {\n\t\tclassname = classname ? classname + ' ' + hash : hash;\n\t}\n\n\tif (directives) {\n\t\tfor (var key of Object.keys(directives)) {\n\t\t\tif (directives[key]) {\n\t\t\t\tclassname = classname ? classname + ' ' + key : key;\n\t\t\t} else if (classname.length) {\n\t\t\t\tvar len = key.length;\n\t\t\t\tvar a = 0;\n\n\t\t\t\twhile ((a = classname.indexOf(key, a)) >= 0) {\n\t\t\t\t\tvar b = a + len;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t(a === 0 || whitespace.includes(classname[a - 1])) &&\n\t\t\t\t\t\t(b === classname.length || whitespace.includes(classname[b]))\n\t\t\t\t\t) {\n\t\t\t\t\t\tclassname = (a === 0 ? '' : classname.substring(0, a)) + classname.substring(b + 1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ta = b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn classname === '' ? null : classname;\n}\n\n/**\n *\n * @param {Record<string,any>} styles\n * @param {boolean} important\n */\nfunction append_styles(styles, important = false) {\n\tvar separator = important ? ' !important;' : ';';\n\tvar css = '';\n\n\tfor (var key of Object.keys(styles)) {\n\t\tvar value = styles[key];\n\t\tif (value != null && value !== '') {\n\t\t\tcss += ' ' + key + ': ' + value + separator;\n\t\t}\n\t}\n\n\treturn css;\n}\n\n/**\n * @param {string} name\n * @returns {string}\n */\nfunction to_css_name(name) {\n\tif (name[0] !== '-' || name[1] !== '-') {\n\t\treturn name.toLowerCase();\n\t}\n\treturn name;\n}\n\n/**\n * @param {any} value\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [styles]\n * @returns {string | null}\n */\nexport function to_style(value, styles) {\n\tif (styles) {\n\t\tvar new_style = '';\n\n\t\t/** @type {Record<string,any> | undefined} */\n\t\tvar normal_styles;\n\n\t\t/** @type {Record<string,any> | undefined} */\n\t\tvar important_styles;\n\n\t\tif (Array.isArray(styles)) {\n\t\t\tnormal_styles = styles[0];\n\t\t\timportant_styles = styles[1];\n\t\t} else {\n\t\t\tnormal_styles = styles;\n\t\t}\n\n\t\tif (value) {\n\t\t\t// strip comments; surrounding whitespace is handled by the trims below (which is much faster than doing it through regex)\n\t\t\tvalue = String(value)\n\t\t\t\t.replaceAll(/\\/\\*.*?\\*\\//g, '')\n\t\t\t\t.trim();\n\n\t\t\t/** @type {boolean | '\"' | \"'\"} */\n\t\t\tvar in_str = false;\n\t\t\tvar in_apo = 0;\n\t\t\tvar in_comment = false;\n\n\t\t\tvar reserved_names = [];\n\n\t\t\tif (normal_styles) {\n\t\t\t\treserved_names.push(...Object.keys(normal_styles).map(to_css_name));\n\t\t\t}\n\t\t\tif (important_styles) {\n\t\t\t\treserved_names.push(...Object.keys(important_styles).map(to_css_name));\n\t\t\t}\n\n\t\t\tvar start_index = 0;\n\t\t\tvar name_index = -1;\n\n\t\t\tconst len = value.length;\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tvar c = value[i];\n\n\t\t\t\tif (in_comment) {\n\t\t\t\t\tif (c === '/' && value[i - 1] === '*') {\n\t\t\t\t\t\tin_comment = false;\n\t\t\t\t\t}\n\t\t\t\t} else if (in_str) {\n\t\t\t\t\tif (in_str === c) {\n\t\t\t\t\t\tin_str = false;\n\t\t\t\t\t}\n\t\t\t\t} else if (c === '/' && value[i + 1] === '*') {\n\t\t\t\t\tin_comment = true;\n\t\t\t\t} else if (c === '\"' || c === \"'\") {\n\t\t\t\t\tin_str = c;\n\t\t\t\t} else if (c === '(') {\n\t\t\t\t\tin_apo++;\n\t\t\t\t} else if (c === ')') {\n\t\t\t\t\tin_apo--;\n\t\t\t\t}\n\n\t\t\t\tif (!in_comment && in_str === false && in_apo === 0) {\n\t\t\t\t\tif (c === ':' && name_index === -1) {\n\t\t\t\t\t\tname_index = i;\n\t\t\t\t\t} else if (c === ';' || i === len - 1) {\n\t\t\t\t\t\tif (name_index !== -1) {\n\t\t\t\t\t\t\tvar name = to_css_name(value.substring(start_index, name_index).trim());\n\n\t\t\t\t\t\t\tif (!reserved_names.includes(name)) {\n\t\t\t\t\t\t\t\tif (c !== ';') {\n\t\t\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvar property = value.substring(start_index, i).trim();\n\t\t\t\t\t\t\t\tnew_style += ' ' + property + ';';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstart_index = i + 1;\n\t\t\t\t\t\tname_index = -1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (normal_styles) {\n\t\t\tnew_style += append_styles(normal_styles);\n\t\t}\n\n\t\tif (important_styles) {\n\t\t\tnew_style += append_styles(important_styles, true);\n\t\t}\n\n\t\tnew_style = new_style.trim();\n\t\treturn new_style === '' ? null : new_style;\n\t}\n\n\treturn value == null ? null : String(value);\n}\n","import { to_class } from '../../../shared/attributes.js';\nimport { CLASS_CACHE } from '../../constants.js';\nimport { hydrating } from '../hydration.js';\n\n/**\n * @param {Element} dom\n * @param {boolean | number} is_html\n * @param {string | null} value\n * @param {string} [hash]\n * @param {Record<string, any>} [prev_classes]\n * @param {Record<string, any>} [next_classes]\n * @returns {Record<string, boolean> | undefined}\n */\nexport function set_class(dom, is_html, value, hash, prev_classes, next_classes) {\n\tvar prev = /** @type {any} */ (dom)[CLASS_CACHE];\n\n\tif (\n\t\thydrating ||\n\t\tprev !== value ||\n\t\tprev === undefined // for edge case of `class={undefined}`\n\t) {\n\t\tvar next_class_name = to_class(value, hash, next_classes);\n\n\t\tif (!hydrating || next_class_name !== dom.getAttribute('class')) {\n\t\t\t// Removing the attribute when the value is only an empty string causes\n\t\t\t// performance issues vs simply making the className an empty string. So\n\t\t\t// we should only remove the class if the value is nullish\n\t\t\t// and there no hash/directives :\n\t\t\tif (next_class_name == null) {\n\t\t\t\tdom.removeAttribute('class');\n\t\t\t} else if (is_html) {\n\t\t\t\tdom.className = next_class_name;\n\t\t\t} else {\n\t\t\t\tdom.setAttribute('class', next_class_name);\n\t\t\t}\n\t\t}\n\n\t\t/** @type {any} */ (dom)[CLASS_CACHE] = value;\n\t} else if (next_classes && prev_classes !== next_classes) {\n\t\tfor (var key in next_classes) {\n\t\t\tvar is_present = !!next_classes[key];\n\n\t\t\tif (prev_classes == null || is_present !== !!prev_classes[key]) {\n\t\t\t\tdom.classList.toggle(key, is_present);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn next_classes;\n}\n","import { to_style } from '../../../shared/attributes.js';\nimport { STYLE_CACHE } from '../../constants.js';\nimport { hydrating } from '../hydration.js';\n\n/**\n * @param {Element & ElementCSSInlineStyle} dom\n * @param {Record<string, any>} prev\n * @param {Record<string, any>} next\n * @param {string} [priority]\n */\nfunction update_styles(dom, prev = {}, next, priority) {\n\tfor (var key in next) {\n\t\tvar value = next[key];\n\n\t\tif (prev[key] !== value) {\n\t\t\tif (next[key] == null) {\n\t\t\t\tdom.style.removeProperty(key);\n\t\t\t} else {\n\t\t\t\tdom.style.setProperty(key, value, priority);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} dom\n * @param {string | null} value\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [prev_styles]\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [next_styles]\n */\nexport function set_style(dom, value, prev_styles, next_styles) {\n\tvar prev = /** @type {any} */ (dom)[STYLE_CACHE];\n\n\tif (hydrating || prev !== value) {\n\t\tvar next_style_attr = to_style(value, next_styles);\n\n\t\tif (!hydrating || next_style_attr !== dom.getAttribute('style')) {\n\t\t\tif (next_style_attr == null) {\n\t\t\t\tdom.removeAttribute('style');\n\t\t\t} else {\n\t\t\t\tdom.style.cssText = next_style_attr;\n\t\t\t}\n\t\t}\n\n\t\t/** @type {any} */ (dom)[STYLE_CACHE] = value;\n\t} else if (next_styles) {\n\t\tif (Array.isArray(next_styles)) {\n\t\t\tupdate_styles(dom, prev_styles?.[0], next_styles[0]);\n\t\t\tupdate_styles(dom, prev_styles?.[1], next_styles[1], 'important');\n\t\t} else {\n\t\t\tupdate_styles(dom, prev_styles, next_styles);\n\t\t}\n\t}\n\n\treturn next_styles;\n}\n","import { effect, teardown } from '../../../reactivity/effects.js';\nimport { listen_to_event_and_reset_event } from './shared.js';\nimport { is } from '../../../proxy.js';\nimport { is_array } from '../../../../shared/utils.js';\nimport * as w from '../../../warnings.js';\nimport { Batch, current_batch, previous_batch } from '../../../reactivity/batch.js';\nimport { async_mode_flag } from '../../../../flags/index.js';\n\n/**\n * Sets the `selected` attribute on an option so form reset can restore it.\n * @param {HTMLOptionElement} option\n * @param {boolean} selected\n */\nexport function set_selected(option, selected) {\n\tif (selected) {\n\t\tif (!option.hasAttribute('selected')) option.setAttribute('selected', '');\n\t} else {\n\t\toption.removeAttribute('selected');\n\t}\n}\n\n/**\n * Sets the options a form reset should restore. The first call selects\n * them if nothing has set a value, later calls leave the current selection alone.\n * @param {HTMLSelectElement} select\n * @param {any} value\n */\nexport function set_default_select_value(select, value) {\n\tvar mounting = !('__defaultValue' in select);\n\t// @ts-expect-error\n\tif (!mounting && select.__defaultValue === value) return;\n\t// @ts-expect-error\n\tselect.__defaultValue = value;\n\tapply_default_select_value(select, !mounting || '__value' in select);\n}\n\n/**\n * Marks the options matching `__defaultValue` as selected. Without `preserve`\n * a newly matching option gets selected, as an inserted `<option selected>` would.\n * @param {HTMLSelectElement} select\n * @param {boolean} preserve\n */\nfunction apply_default_select_value(select, preserve) {\n\t// @ts-expect-error\n\tvar value = select.__defaultValue;\n\tvar multiple = select.multiple;\n\tvar values = multiple ? value ?? [] : null;\n\n\tif (multiple && !is_array(values)) return;\n\n\tvar index = select.selectedIndex;\n\tvar selected = preserve && multiple ? new Set(select.selectedOptions) : null;\n\n\tfor (var option of select.options) {\n\t\tvar option_value = get_option_value(option);\n\t\tset_selected(\n\t\t\toption,\n\t\t\tmultiple ? /** @type {any[]} */ (values).includes(option_value) : is(option_value, value)\n\t\t);\n\t}\n\n\tif (!preserve) return;\n\n\tif (selected !== null) {\n\t\tfor (option of select.options) {\n\t\t\tvar was_selected = selected.has(option);\n\t\t\tif (option.selected !== was_selected) option.selected = was_selected;\n\t\t}\n\t} else if (select.selectedIndex !== index) {\n\t\tselect.selectedIndex = index;\n\t}\n}\n\n/**\n * Selects the correct option(s) (depending on whether this is a multiple select)\n * @template V\n * @param {HTMLSelectElement} select\n * @param {V} value\n * @param {boolean} mounting\n */\nexport function select_option(select, value, mounting = false) {\n\tif (select.multiple) {\n\t\t// If value is null or undefined, keep the selection as is\n\t\tif (value == undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If not an array, warn and keep the selection as is\n\t\tif (!is_array(value)) {\n\t\t\treturn w.select_multiple_invalid_value();\n\t\t}\n\n\t\t// Otherwise, update the selection\n\t\tfor (var option of select.options) {\n\t\t\toption.selected = value.includes(get_option_value(option));\n\t\t}\n\n\t\treturn;\n\t}\n\n\tfor (option of select.options) {\n\t\tvar option_value = get_option_value(option);\n\t\tif (is(option_value, value)) {\n\t\t\toption.selected = true;\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (!mounting || value !== undefined) {\n\t\tselect.selectedIndex = -1; // no option should be selected\n\t}\n}\n\n/**\n * Sets up a mutation observer to sync the current selection\n * and default to the dom when the options change, for example\n * when they are inside an `#each` block. Called once per `<select>`,\n * by the compiled output or by `attribute_effect` for spreads.\n * @param {HTMLSelectElement} select\n */\nexport function init_select(select) {\n\tvar observer = new MutationObserver((entries) => {\n\t\t// Mutations related to `<selectedcontent>` can never affect the option list.\n\t\t// Reacting to them could revert a user-initiated selection change, because the\n\t\t// records are delivered as soon as any listener returns (e.g. a delegated `input`\n\t\t// handler), which can happen before the `change` handler has updated `__value`\n\t\tif (entries.every(is_selectedcontent_mutation)) return;\n\n\t\tif ('__defaultValue' in select) {\n\t\t\tapply_default_select_value(select, false);\n\t\t}\n\n\t\tif ('__value' in select) {\n\t\t\tselect_option(select, select.__value);\n\t\t}\n\t\t// Deliberately don't update the potential binding value,\n\t\t// the model should be preserved unless explicitly changed\n\t});\n\n\tobserver.observe(select, {\n\t\t// Listen to option element changes\n\t\tchildList: true,\n\t\tsubtree: true, // because of <optgroup>\n\t\t// Listen to option element value attribute changes\n\t\t// (doesn't get notified of select value changes,\n\t\t// because that property is not reflected as an attribute)\n\t\tattributes: true,\n\t\tattributeFilter: ['value']\n\t});\n\n\tteardown(() => {\n\t\tobserver.disconnect();\n\t});\n}\n\n/**\n * @param {HTMLSelectElement} select\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_select_value(select, get, set = get) {\n\tvar batches = new WeakSet();\n\tvar mounting = true;\n\n\tlisten_to_event_and_reset_event(select, 'change', (is_reset) => {\n\t\tvar query = is_reset ? '[selected]' : ':checked';\n\t\t/** @type {unknown} */\n\t\tvar value;\n\n\t\tif (select.multiple) {\n\t\t\tvalue = [].map.call(select.querySelectorAll(query), get_option_value);\n\t\t} else {\n\t\t\t/** @type {HTMLOptionElement | null} */\n\t\t\tvar selected_option =\n\t\t\t\tselect.querySelector(query) ??\n\t\t\t\t// will fall back to first non-disabled option if no option is selected\n\t\t\t\tselect.querySelector('option:not([disabled])');\n\t\t\tvalue = selected_option && get_option_value(selected_option);\n\t\t}\n\n\t\tset(value);\n\n\t\t// @ts-ignore\n\t\tselect.__value = value;\n\n\t\tif (current_batch !== null) {\n\t\t\tbatches.add(current_batch);\n\t\t}\n\t});\n\n\t// Needs to be an effect, not a render_effect, so that in case of each loops the logic runs after the each block has updated\n\teffect(() => {\n\t\tvar value = get();\n\n\t\tif (select === document.activeElement) {\n\t\t\t// In sync mode render effects are executed during tree traversal -> needs current_batch\n\t\t\t// In async mode render effects are flushed once batch resolved, at which point current_batch is null -> needs previous_batch\n\t\t\tvar batch = /** @type {Batch} */ (async_mode_flag ? previous_batch : current_batch);\n\n\t\t\t// Don't update the <select> if it is focused. We can get here if, for example,\n\t\t\t// an update is deferred because of async work depending on the select:\n\t\t\t//\n\t\t\t// <select bind:value={selected}>...</select>\n\t\t\t// <p>{await find(selected)}</p>\n\t\t\tif (batches.has(batch)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tselect_option(select, value, mounting);\n\n\t\t// Mounting and value undefined -> take selection from dom\n\t\tif (mounting && value === undefined) {\n\t\t\t/** @type {HTMLOptionElement | null} */\n\t\t\tvar selected_option = select.querySelector(':checked');\n\t\t\tif (selected_option !== null) {\n\t\t\t\tvalue = get_option_value(selected_option);\n\t\t\t\tset(value);\n\t\t\t}\n\t\t}\n\n\t\t// @ts-ignore\n\t\tselect.__value = value;\n\t\tmounting = false;\n\t});\n}\n\n/** @param {HTMLOptionElement} option */\nfunction get_option_value(option) {\n\t// __value only exists if the <option> has a value attribute\n\tif ('__value' in option) {\n\t\treturn option.__value;\n\t} else {\n\t\treturn option.value;\n\t}\n}\n\n/**\n * Returns `true` if the mutation stems from the browser mirroring the selected\n * option's content into `<selectedcontent>`, or from us replacing the\n * `<selectedcontent>` element with a clone of itself\n * @param {MutationRecord} entry\n */\nfunction is_selectedcontent_mutation(entry) {\n\tif (/** @type {Element} */ (entry.target).closest('selectedcontent') !== null) {\n\t\treturn true;\n\t}\n\n\tif (entry.type === 'childList') {\n\t\tvar nodes = [...entry.addedNodes, ...entry.removedNodes];\n\t\treturn nodes.length > 0 && nodes.every((node) => node.nodeName === 'SELECTEDCONTENT');\n\t}\n\n\treturn false;\n}\n","/** @import { Blocker, Effect } from '#client' */\nimport { DEV } from 'esm-env';\nimport { hydrating, set_hydrating } from '../hydration.js';\nimport { get_descriptors, get_prototype_of } from '../../../shared/utils.js';\nimport { create_event, delegate, delegated, event, event_symbol } from './events.js';\nimport { add_form_reset_listener, autofocus } from './misc.js';\nimport * as w from '../../warnings.js';\nimport {\n\tATTRIBUTES_CACHE,\n\tFORM_RESET_HANDLER,\n\tIS_XHTML,\n\tLOADING_ATTR_SYMBOL\n} from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { is_capture_event, can_delegate_event, normalize_attribute } from '../../../../utils.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport { attach } from './attachments.js';\nimport { clsx } from '../../../shared/attributes.js';\nimport { set_class } from './class.js';\nimport { set_style } from './style.js';\nimport { ATTACHMENT_KEY, NAMESPACE_HTML, UNINITIALIZED } from '../../../../constants.js';\nimport { branch, destroy_effect, effect, managed } from '../../reactivity/effects.js';\nimport {\n\tinit_select,\n\tselect_option,\n\tset_default_select_value,\n\tset_selected\n} from './bindings/select.js';\nimport { flatten } from '../../reactivity/async.js';\n\nexport const CLASS = Symbol('class');\nexport const STYLE = Symbol('style');\n\nconst IS_CUSTOM_ELEMENT = Symbol('is custom element');\nconst IS_HTML = Symbol('is html');\n\nconst LINK_TAG = IS_XHTML ? 'link' : 'LINK';\nconst INPUT_TAG = IS_XHTML ? 'input' : 'INPUT';\nconst OPTION_TAG = IS_XHTML ? 'option' : 'OPTION';\nconst SELECT_TAG = IS_XHTML ? 'select' : 'SELECT';\nconst PROGRESS_TAG = IS_XHTML ? 'progress' : 'PROGRESS';\n\n/**\n * The value/checked attribute in the template actually corresponds to the defaultValue property, so we need\n * to remove it upon hydration to avoid a bug when someone resets the form value.\n * @param {HTMLInputElement} input\n * @returns {void}\n */\nexport function remove_input_defaults(input) {\n\tif (!hydrating) return;\n\n\tvar already_removed = false;\n\n\t// We try and remove the default attributes later, rather than sync during hydration.\n\t// Doing it sync during hydration has a negative impact on performance, but deferring the\n\t// work in an idle task alleviates this greatly. If a form reset event comes in before\n\t// the idle callback, then we ensure the input defaults are cleared just before.\n\tvar remove_defaults = () => {\n\t\tif (already_removed) return;\n\t\talready_removed = true;\n\n\t\t// Remove the attributes but preserve the values\n\t\tif (input.hasAttribute('value')) {\n\t\t\tvar value = input.value;\n\t\t\tset_attribute(input, 'value', null);\n\t\t\tinput.value = value;\n\t\t}\n\n\t\tif (input.hasAttribute('checked')) {\n\t\t\tvar checked = input.checked;\n\t\t\tset_attribute(input, 'checked', null);\n\t\t\tinput.checked = checked;\n\t\t}\n\t};\n\n\t/** @type {any} */ (input)[FORM_RESET_HANDLER] = remove_defaults;\n\tqueue_micro_task(remove_defaults);\n\tadd_form_reset_listener();\n}\n\n/**\n * @param {Element} element\n * @param {any} value\n */\nexport function set_value(element, value) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.value ===\n\t\t\t(attributes.value =\n\t\t\t\t// treat null and undefined the same for the initial value\n\t\t\t\tvalue ?? undefined) ||\n\t\t// @ts-expect-error\n\t\t// `progress` elements always need their value set when it's `0`\n\t\t(element.value === value && (value !== 0 || element.nodeName !== PROGRESS_TAG))\n\t) {\n\t\treturn;\n\t}\n\n\t// @ts-expect-error\n\telement.value = value ?? '';\n}\n\n/**\n * @param {Element} element\n * @param {boolean} checked\n */\nexport function set_checked(element, checked) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.checked ===\n\t\t(attributes.checked =\n\t\t\t// treat null and undefined the same for the initial value\n\t\t\tchecked ?? undefined)\n\t) {\n\t\treturn;\n\t}\n\n\t// @ts-expect-error\n\telement.checked = checked;\n}\n\n/**\n * Applies the default checked property without influencing the current checked property.\n * @param {HTMLInputElement} element\n * @param {boolean} checked\n */\nexport function set_default_checked(element, checked) {\n\tconst existing_value = element.checked;\n\telement.defaultChecked = checked;\n\telement.checked = existing_value;\n}\n\n/**\n * Applies the default value property without influencing the current value property.\n * @param {HTMLInputElement | HTMLTextAreaElement} element\n * @param {string} value\n */\nexport function set_default_value(element, value) {\n\tconst existing_value = element.value;\n\telement.defaultValue = value;\n\telement.value = existing_value;\n}\n\n/**\n * @param {Element} element\n * @param {string} attribute\n * @param {string | null} value\n * @param {boolean} [skip_warning]\n */\nexport function set_attribute(element, attribute, value, skip_warning) {\n\tvar attributes = get_attributes(element);\n\n\tif (hydrating) {\n\t\tattributes[attribute] = element.getAttribute(attribute);\n\n\t\tif (\n\t\t\tattribute === 'src' ||\n\t\t\tattribute === 'srcset' ||\n\t\t\t(attribute === 'href' && element.nodeName === LINK_TAG)\n\t\t) {\n\t\t\tif (!skip_warning) {\n\t\t\t\tcheck_src_in_dev_hydration(element, attribute, value ?? '');\n\t\t\t}\n\n\t\t\t// If we reset these attributes, they would result in another network request, which we want to avoid.\n\t\t\t// We assume they are the same between client and server as checking if they are equal is expensive\n\t\t\t// (we can't just compare the strings as they can be different between client and server but result in the\n\t\t\t// same url, so we would need to create hidden anchor elements to compare them)\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (attributes[attribute] === (attributes[attribute] = value)) return;\n\n\tif (attribute === 'loading') {\n\t\t// @ts-expect-error\n\t\telement[LOADING_ATTR_SYMBOL] = value;\n\t}\n\n\tif (value == null) {\n\t\telement.removeAttribute(attribute);\n\t} else if (typeof value !== 'string' && get_setters(element).has(attribute)) {\n\t\t// @ts-ignore\n\t\telement[attribute] = value;\n\t} else {\n\t\telement.setAttribute(attribute, value);\n\t}\n}\n\n/**\n * @param {Element} dom\n * @param {string} attribute\n * @param {string} value\n */\nexport function set_xlink_attribute(dom, attribute, value) {\n\tdom.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\n\n/**\n * @param {HTMLElement} node\n * @param {string} prop\n * @param {any} value\n */\nexport function set_custom_element_data(node, prop, value) {\n\t// We need to ensure that setting custom element props, which can\n\t// invoke lifecycle methods on other custom elements, does not also\n\t// associate those lifecycle methods with the current active reaction\n\t// or effect\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet was_hydrating = hydrating;\n\tif (hydrating) {\n\t\tset_hydrating(false);\n\t}\n\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\n\ttry {\n\t\tif (\n\t\t\t// `style` should use `set_attribute` rather than the setter\n\t\t\tprop !== 'style' &&\n\t\t\t// Don't compute setters for custom elements while they aren't registered yet,\n\t\t\t// because during their upgrade/instantiation they might add more setters.\n\t\t\t// Instead, fall back to a simple \"an object, then set as property\" heuristic.\n\t\t\t(setters_cache.has(node.getAttribute('is') || node.nodeName) ||\n\t\t\t// customElements may not be available in browser extension contexts\n\t\t\t!customElements ||\n\t\t\tcustomElements.get(node.getAttribute('is') || node.nodeName.toLowerCase())\n\t\t\t\t? get_setters(node).has(prop)\n\t\t\t\t: value && typeof value === 'object')\n\t\t) {\n\t\t\t// @ts-expect-error\n\t\t\tnode[prop] = value;\n\t\t} else {\n\t\t\t// We did getters etc checks already, stringify before passing to set_attribute\n\t\t\t// to ensure it doesn't invoke the same logic again, and potentially populating\n\t\t\t// the setters cache too early.\n\t\t\tset_attribute(node, prop, value == null ? value : String(value));\n\t\t}\n\t} finally {\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t\tif (was_hydrating) {\n\t\t\tset_hydrating(true);\n\t\t}\n\t}\n}\n\n/**\n * Spreads attributes onto a DOM element, taking into account the currently set attributes\n * @param {Element & ElementCSSInlineStyle} element\n * @param {Record<string | symbol, any> | undefined} prev\n * @param {Record<string | symbol, any>} next New attributes - this function mutates this object\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n * @returns {Record<string, any>}\n */\nfunction set_attributes(\n\telement,\n\tprev,\n\tnext,\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tif (hydrating && should_remove_defaults && element.nodeName === INPUT_TAG) {\n\t\tif (!('defaultValue' in next || 'defaultChecked' in next)) {\n\t\t\tremove_input_defaults(/** @type {HTMLInputElement} */ (element));\n\t\t}\n\t}\n\n\tvar attributes = get_attributes(element);\n\n\tvar is_custom_element = attributes[IS_CUSTOM_ELEMENT];\n\tvar preserve_attribute_case = !attributes[IS_HTML];\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet is_hydrating_custom_element = hydrating && is_custom_element;\n\tif (is_hydrating_custom_element) {\n\t\tset_hydrating(false);\n\t}\n\n\tvar current = prev || {};\n\tvar is_option_element = element.nodeName === OPTION_TAG;\n\tvar is_select_element = element.nodeName === SELECT_TAG;\n\n\tfor (var key in prev) {\n\t\t// don't null our internal $$onX listeners\n\t\tif (!(key in next) && key[0] + key[1] !== '$$') {\n\t\t\tnext[key] = null;\n\t\t}\n\t}\n\n\tif (next.class) {\n\t\tnext.class = clsx(next.class);\n\t} else if (css_hash || next[CLASS]) {\n\t\tnext.class = null; /* force call to set_class() */\n\t}\n\n\tif (next[STYLE]) {\n\t\tnext.style ??= null; /* force call to set_style() */\n\t}\n\n\tvar setters = get_setters(element);\n\n\tif (element.nodeName === INPUT_TAG && 'type' in next && ('value' in next || '__value' in next)) {\n\t\tvar type = next.type;\n\n\t\tif (type !== current.type || (type === undefined && element.hasAttribute('type'))) {\n\t\t\tcurrent.type = type;\n\t\t\tset_attribute(element, 'type', type, skip_warning);\n\t\t}\n\t}\n\n\t// since key is captured we use const\n\tfor (const key in next) {\n\t\t// let instead of var because referenced in a closure\n\t\tlet value = next[key];\n\n\t\t// Up here because we want to do this for the initial value, too, even if it's undefined,\n\t\t// and this wouldn't be reached in case of undefined because of the equality check below\n\t\tif (is_option_element && key === 'value' && value == null) {\n\t\t\t// The <option> element is a special case because removing the value attribute means\n\t\t\t// the value is set to the text content of the option element, and setting the value\n\t\t\t// to null or undefined means the value is set to the string \"null\" or \"undefined\".\n\t\t\t// To align with how we handle this case in non-spread-scenarios, this logic is needed.\n\t\t\t// There's a super-edge-case bug here that is left in in favor of smaller code size:\n\t\t\t// Because of the \"set missing props to null\" logic above, we can't differentiate\n\t\t\t// between a missing value and an explicitly set value of null or undefined. That means\n\t\t\t// that once set, the value attribute of an <option> element can't be removed. This is\n\t\t\t// a very rare edge case, and removing the attribute altogether isn't possible either\n\t\t\t// for the <option value={undefined}> case, so we're not losing any functionality here.\n\t\t\t// @ts-ignore\n\t\t\telement.value = element.__value = '';\n\t\t\tcurrent[key] = value;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (key === 'class') {\n\t\t\tvar is_html = element.namespaceURI === 'http://www.w3.org/1999/xhtml';\n\t\t\tset_class(element, is_html, value, css_hash, prev?.[CLASS], next[CLASS]);\n\t\t\tcurrent[key] = value;\n\t\t\tcurrent[CLASS] = next[CLASS];\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (key === 'style') {\n\t\t\tset_style(element, value, prev?.[STYLE], next[STYLE]);\n\t\t\tcurrent[key] = value;\n\t\t\tcurrent[STYLE] = next[STYLE];\n\t\t\tcontinue;\n\t\t}\n\n\t\tvar prev_value = current[key];\n\n\t\t// Skip if value is unchanged, unless it's `undefined` and the element still has the attribute\n\t\tif (value === prev_value && !(value === undefined && element.hasAttribute(key))) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tcurrent[key] = value;\n\n\t\tvar prefix = key[0] + key[1]; // this is faster than key.slice(0, 2)\n\t\tif (prefix === '$$') continue;\n\n\t\tif (prefix === 'on') {\n\t\t\t/** @type {{ capture?: true }} */\n\t\t\tconst opts = {};\n\t\t\tconst event_handle_key = '$$' + key;\n\t\t\tlet event_name = key.slice(2);\n\t\t\tvar is_delegated = can_delegate_event(event_name);\n\n\t\t\tif (is_capture_event(event_name)) {\n\t\t\t\tevent_name = event_name.slice(0, -7);\n\t\t\t\topts.capture = true;\n\t\t\t}\n\n\t\t\tif (!is_delegated && prev_value) {\n\t\t\t\t// Listening to same event but different handler -> our handle function below takes care of this\n\t\t\t\t// If we were to remove and add listeners in this case, it could happen that the event is \"swallowed\"\n\t\t\t\t// (the browser seems to not know yet that a new one exists now) and doesn't reach the handler\n\t\t\t\t// https://github.com/sveltejs/svelte/issues/11903\n\t\t\t\tif (value != null) continue;\n\n\t\t\t\telement.removeEventListener(event_name, current[event_handle_key], opts);\n\t\t\t\tcurrent[event_handle_key] = null;\n\t\t\t}\n\n\t\t\tif (is_delegated) {\n\t\t\t\tdelegated(event_name, element, value);\n\t\t\t\tdelegate([event_name]);\n\t\t\t} else if (value != null) {\n\t\t\t\t/**\n\t\t\t\t * @this {any}\n\t\t\t\t * @param {Event} evt\n\t\t\t\t */\n\t\t\t\tfunction handle(evt) {\n\t\t\t\t\tcurrent[key].call(this, evt);\n\t\t\t\t}\n\n\t\t\t\tcurrent[event_handle_key] = create_event(event_name, element, handle, opts);\n\t\t\t}\n\t\t} else if (key === 'style') {\n\t\t\t// avoid using the setter\n\t\t\tset_attribute(element, key, value);\n\t\t} else if (key === 'autofocus') {\n\t\t\tautofocus(/** @type {HTMLElement} */ (element), Boolean(value));\n\t\t} else if (!is_custom_element && (key === '__value' || (key === 'value' && value != null))) {\n\t\t\t// @ts-ignore We're not running this for custom elements because __value is actually\n\t\t\t// how Lit stores the current value on the element, and messing with that would break things.\n\t\t\telement.value = element.__value = value;\n\t\t} else if (key === 'selected' && is_option_element) {\n\t\t\tset_selected(/** @type {HTMLOptionElement} */ (element), value);\n\t\t} else {\n\t\t\tvar name = key;\n\t\t\tif (!preserve_attribute_case) {\n\t\t\t\tname = normalize_attribute(name);\n\t\t\t}\n\n\t\t\tvar is_default = name === 'defaultValue' || name === 'defaultChecked';\n\n\t\t\t// A select's default value is represented by selected options, not a property.\n\t\t\tif (is_select_element && name === 'defaultValue') continue;\n\n\t\t\tif (value == null && !is_custom_element && !is_default) {\n\t\t\t\tattributes[key] = null;\n\n\t\t\t\tif (name === 'value' || name === 'checked') {\n\t\t\t\t\t// removing value/checked also removes defaultValue/defaultChecked — preserve\n\t\t\t\t\tlet input = /** @type {HTMLInputElement} */ (element);\n\t\t\t\t\tconst use_default = prev === undefined;\n\t\t\t\t\tif (name === 'value') {\n\t\t\t\t\t\tlet previous = input.defaultValue;\n\t\t\t\t\t\tinput.removeAttribute(name);\n\t\t\t\t\t\tinput.defaultValue = previous;\n\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\tinput.value = input.__value = use_default ? previous : null;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet previous = input.defaultChecked;\n\t\t\t\t\t\tinput.removeAttribute(name);\n\t\t\t\t\t\tinput.defaultChecked = previous;\n\t\t\t\t\t\tinput.checked = use_default ? previous : false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\telement.removeAttribute(key);\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tis_default ||\n\t\t\t\t((is_custom_element || typeof value !== 'string') && setters.has(name))\n\t\t\t) {\n\t\t\t\t// @ts-ignore\n\t\t\t\telement[name] = value;\n\t\t\t\t// remove it from attributes's cache\n\t\t\t\tif (name in attributes) attributes[name] = UNINITIALIZED;\n\t\t\t} else if (typeof value !== 'function') {\n\t\t\t\tset_attribute(element, name, value, skip_warning);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (is_hydrating_custom_element) {\n\t\tset_hydrating(true);\n\t}\n\n\treturn current;\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} element\n * @param {(...expressions: any) => Record<string | symbol, any>} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n */\nexport function attribute_effect(\n\telement,\n\tfn,\n\tsync = [],\n\tasync = [],\n\tblockers = [],\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tflatten(blockers, sync, async, (values) => {\n\t\t/** @type {Record<string | symbol, any> | undefined} */\n\t\tvar prev = undefined;\n\n\t\t/** @type {Record<symbol, Effect>} */\n\t\tvar effects = {};\n\n\t\tvar is_select = element.nodeName === SELECT_TAG;\n\t\tvar inited = false;\n\n\t\tmanaged(() => {\n\t\t\tvar next = fn(...values.map(get));\n\t\t\t/** @type {Record<string | symbol, any>} */\n\t\t\tvar current = set_attributes(\n\t\t\t\telement,\n\t\t\t\tprev,\n\t\t\t\tnext,\n\t\t\t\tcss_hash,\n\t\t\t\tshould_remove_defaults,\n\t\t\t\tskip_warning\n\t\t\t);\n\n\t\t\tif (inited && is_select) {\n\t\t\t\tvar select = /** @type {HTMLSelectElement} */ (element);\n\n\t\t\t\tif ('defaultValue' in next) {\n\t\t\t\t\tset_default_select_value(select, next.defaultValue);\n\t\t\t\t}\n\n\t\t\t\tif ('value' in next) {\n\t\t\t\t\tselect_option(select, next.value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(effects)) {\n\t\t\t\tif (!next[symbol]) destroy_effect(effects[symbol]);\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(next)) {\n\t\t\t\tvar n = next[symbol];\n\n\t\t\t\tif (symbol.description === ATTACHMENT_KEY && (!prev || n !== prev[symbol])) {\n\t\t\t\t\tif (effects[symbol]) destroy_effect(effects[symbol]);\n\t\t\t\t\teffects[symbol] = branch(() => attach(element, () => n));\n\t\t\t\t}\n\n\t\t\t\tcurrent[symbol] = n;\n\t\t\t}\n\n\t\t\tprev = current;\n\t\t});\n\n\t\tif (is_select) {\n\t\t\tvar select = /** @type {HTMLSelectElement} */ (element);\n\n\t\t\teffect(() => {\n\t\t\t\tvar attrs = /** @type {Record<string | symbol, any>} */ (prev);\n\n\t\t\t\tif ('defaultValue' in attrs) {\n\t\t\t\t\tset_default_select_value(select, attrs.defaultValue);\n\t\t\t\t}\n\n\t\t\t\tselect_option(select, attrs.value, true);\n\t\t\t\tinit_select(select);\n\t\t\t});\n\t\t}\n\n\t\tinited = true;\n\t});\n}\n\n/**\n *\n * @param {Element} element\n */\nfunction get_attributes(element) {\n\treturn /** @type {Record<string | symbol, unknown>} **/ (\n\t\t/** @type {any} */ (element)[ATTRIBUTES_CACHE] ??= {\n\t\t\t[IS_CUSTOM_ELEMENT]: element.nodeName.includes('-'),\n\t\t\t[IS_HTML]: element.namespaceURI === NAMESPACE_HTML\n\t\t}\n\t);\n}\n\n/** @type {Map<string, Set<string>>} */\nvar setters_cache = new Map();\n\n/** @param {Element} element */\nfunction get_setters(element) {\n\tvar cache_key = element.getAttribute('is') || element.nodeName;\n\tvar setters = setters_cache.get(cache_key);\n\tif (setters) return setters;\n\tsetters_cache.set(cache_key, (setters = new Set()));\n\n\tvar descriptors;\n\tvar proto = element; // In the case of custom elements there might be setters on the instance\n\tvar element_proto = Element.prototype;\n\n\t// Stop at Element, from there on there's only unnecessary (and dangerous, like innerHTML) setters we're not interested in\n\t// Do not use constructor.name here as that's unreliable in some browser environments\n\twhile (element_proto !== proto) {\n\t\tdescriptors = get_descriptors(proto);\n\n\t\tfor (var key in descriptors) {\n\t\t\tif (\n\t\t\t\tdescriptors[key].set &&\n\t\t\t\t// better safe than sorry, we don't want spread attributes to mess with HTML content\n\t\t\t\tkey !== 'innerHTML' &&\n\t\t\t\tkey !== 'textContent' &&\n\t\t\t\tkey !== 'innerText'\n\t\t\t) {\n\t\t\t\tsetters.add(key);\n\t\t\t}\n\t\t}\n\n\t\tproto = get_prototype_of(proto);\n\t}\n\n\treturn setters;\n}\n\n/**\n * @param {any} element\n * @param {string} attribute\n * @param {string} value\n */\nfunction check_src_in_dev_hydration(element, attribute, value) {\n\tif (!DEV) return;\n\tif (attribute === 'srcset' && srcset_url_equal(element, value)) return;\n\tif (src_url_equal(element.getAttribute(attribute) ?? '', value)) return;\n\n\tw.hydration_attribute_changed(\n\t\tattribute,\n\t\telement.outerHTML.replace(element.innerHTML, element.innerHTML && '...'),\n\t\tString(value)\n\t);\n}\n\n/**\n * @param {string} element_src\n * @param {string} url\n * @returns {boolean}\n */\nfunction src_url_equal(element_src, url) {\n\tif (element_src === url) return true;\n\treturn new URL(element_src, document.baseURI).href === new URL(url, document.baseURI).href;\n}\n\n/** @param {string} srcset */\nfunction split_srcset(srcset) {\n\treturn srcset.split(',').map((src) => src.trim().split(' ').filter(Boolean));\n}\n\n/**\n * @param {HTMLSourceElement | HTMLImageElement} element\n * @param {string} srcset\n * @returns {boolean}\n */\nfunction srcset_url_equal(element, srcset) {\n\tvar element_urls = split_srcset(element.srcset);\n\tvar urls = split_srcset(srcset);\n\n\treturn (\n\t\turls.length === element_urls.length &&\n\t\turls.every(\n\t\t\t([url, width], i) =>\n\t\t\t\twidth === element_urls[i][1] &&\n\t\t\t\t// We need to test both ways because Vite will create an a full URL with\n\t\t\t\t// `new URL(asset, import.meta.url).href` for the client when `base: './'`, and the\n\t\t\t\t// relative URLs inside srcset are not automatically resolved to absolute URLs by\n\t\t\t\t// browsers (in contrast to img.src). This means both SSR and DOM code could\n\t\t\t\t// contain relative or absolute URLs.\n\t\t\t\t(src_url_equal(element_urls[i][0], url) || src_url_equal(url, element_urls[i][0]))\n\t\t)\n\t);\n}\n","/** @import { Batch } from '../../../reactivity/batch.js' */\nimport { DEV } from 'esm-env';\nimport { render_effect, teardown } from '../../../reactivity/effects.js';\nimport { listen_to_event_and_reset_event } from './shared.js';\nimport * as e from '../../../errors.js';\nimport { is } from '../../../proxy.js';\nimport { queue_micro_task } from '../../task.js';\nimport { hydrating } from '../../hydration.js';\nimport { tick, untrack } from '../../../runtime.js';\nimport { current_batch, previous_batch } from '../../../reactivity/batch.js';\nimport { async_mode_flag } from '../../../../flags/index.js';\n\n/**\n * @param {HTMLInputElement} input\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_value(input, get, set = get) {\n\tvar batches = new WeakSet();\n\n\tlisten_to_event_and_reset_event(input, 'input', async (is_reset) => {\n\t\tif (DEV && input.type === 'checkbox') {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.bind_invalid_checkbox_value();\n\t\t}\n\n\t\t/** @type {any} */\n\t\tvar value = is_reset ? input.defaultValue : input.value;\n\t\tvalue = is_numberlike_input(input) ? to_number(value) : value;\n\t\tset(value);\n\n\t\tif (current_batch !== null) {\n\t\t\tbatches.add(current_batch);\n\t\t}\n\n\t\t// Because `{#each ...}` blocks work by updating sources inside the flush,\n\t\t// we need to wait a tick before checking to see if we should forcibly\n\t\t// update the input and reset the selection state\n\t\tawait tick();\n\n\t\t// Respect any validation in accessors\n\t\tif (value !== (value = get())) {\n\t\t\tvar start = input.selectionStart;\n\t\t\tvar end = input.selectionEnd;\n\t\t\tvar length = input.value.length;\n\n\t\t\t// the value is coerced on assignment\n\t\t\tinput.value = value ?? '';\n\n\t\t\t// Restore selection\n\t\t\tif (end !== null) {\n\t\t\t\tvar new_length = input.value.length;\n\t\t\t\t// If cursor was at end and new input is longer, move cursor to new end\n\t\t\t\tif (start === end && end === length && new_length > length) {\n\t\t\t\t\tinput.selectionStart = new_length;\n\t\t\t\t\tinput.selectionEnd = new_length;\n\t\t\t\t} else {\n\t\t\t\t\tinput.selectionStart = start;\n\t\t\t\t\tinput.selectionEnd = Math.min(end, new_length);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\tif (\n\t\t// If we are hydrating and the value has since changed,\n\t\t// then use the updated value from the input instead.\n\t\t(hydrating && input.defaultValue !== input.value) ||\n\t\t// If defaultValue is set, then value == defaultValue\n\t\t// TODO Svelte 6: remove input.value check and set to empty string?\n\t\t(untrack(get) == null && input.value)\n\t) {\n\t\tset(is_numberlike_input(input) ? to_number(input.value) : input.value);\n\n\t\tif (current_batch !== null) {\n\t\t\tbatches.add(current_batch);\n\t\t}\n\t}\n\n\trender_effect(() => {\n\t\tif (DEV && input.type === 'checkbox') {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.bind_invalid_checkbox_value();\n\t\t}\n\n\t\tvar value = get();\n\n\t\tif (input === document.activeElement) {\n\t\t\t// In sync mode render effects are executed during tree traversal -> needs current_batch\n\t\t\t// In async mode render effects are flushed once batch resolved, at which point current_batch is null -> needs previous_batch\n\t\t\tvar batch = /** @type {Batch} */ (async_mode_flag ? previous_batch : current_batch);\n\n\t\t\t// Never rewrite the contents of a focused input. We can get here if, for example,\n\t\t\t// an update is deferred because of async work depending on the input:\n\t\t\t//\n\t\t\t// <input bind:value={query}>\n\t\t\t// <p>{await find(query)}</p>\n\t\t\tif (batches.has(batch)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (is_numberlike_input(input) && value === to_number(input.value)) {\n\t\t\t// handles 0 vs 00 case (see https://github.com/sveltejs/svelte/issues/9959)\n\t\t\treturn;\n\t\t}\n\n\t\tif (input.type === 'date' && !value && !input.value) {\n\t\t\t// Handles the case where a temporarily invalid date is set (while typing, for example with a leading 0 for the day)\n\t\t\t// and prevents this state from clearing the other parts of the date input (see https://github.com/sveltejs/svelte/issues/7897)\n\t\t\treturn;\n\t\t}\n\n\t\t// don't set the value of the input if it's the same to allow\n\t\t// minlength to work properly\n\t\tif (value !== input.value) {\n\t\t\t// @ts-expect-error the value is coerced on assignment\n\t\t\tinput.value = value ?? '';\n\t\t}\n\t});\n}\n\n/** @type {Set<HTMLInputElement[]>} */\nconst pending = new Set();\n\n/**\n * @param {HTMLInputElement[]} inputs\n * @param {null | [number]} group_index\n * @param {HTMLInputElement} input\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_group(inputs, group_index, input, get, set = get) {\n\tvar is_checkbox = input.getAttribute('type') === 'checkbox';\n\tvar binding_group = inputs;\n\n\t// needs to be let or related code isn't treeshaken out if it's always false\n\tlet hydration_mismatch = false;\n\n\tif (group_index !== null) {\n\t\tfor (var index of group_index) {\n\t\t\t// @ts-expect-error\n\t\t\tbinding_group = binding_group[index] ??= [];\n\t\t}\n\t}\n\n\tbinding_group.push(input);\n\n\tlisten_to_event_and_reset_event(\n\t\tinput,\n\t\t'change',\n\t\t() => {\n\t\t\t// @ts-ignore\n\t\t\tvar value = input.__value;\n\n\t\t\tif (is_checkbox) {\n\t\t\t\tvalue = get_binding_group_value(binding_group, value, input.checked);\n\t\t\t}\n\n\t\t\tset(value);\n\t\t},\n\t\t// TODO better default value handling\n\t\t() => set(is_checkbox ? [] : null)\n\t);\n\n\trender_effect(() => {\n\t\tvar value = get();\n\n\t\t// If we are hydrating and the value has since changed, then use the update value\n\t\t// from the input instead.\n\t\tif (hydrating && input.defaultChecked !== input.checked) {\n\t\t\thydration_mismatch = true;\n\t\t\treturn;\n\t\t}\n\n\t\tif (is_checkbox) {\n\t\t\tvalue = value || [];\n\t\t\t// @ts-ignore\n\t\t\tinput.checked = value.includes(input.__value);\n\t\t} else {\n\t\t\t// @ts-ignore\n\t\t\tinput.checked = is(input.__value, value);\n\t\t}\n\t});\n\n\tteardown(() => {\n\t\tvar index = binding_group.indexOf(input);\n\n\t\tif (index !== -1) {\n\t\t\tbinding_group.splice(index, 1);\n\t\t}\n\t});\n\n\tif (!pending.has(binding_group)) {\n\t\tpending.add(binding_group);\n\n\t\tqueue_micro_task(() => {\n\t\t\t// necessary to maintain binding group order in all insertion scenarios\n\t\t\tbinding_group.sort((a, b) => (a.compareDocumentPosition(b) === 4 ? -1 : 1));\n\t\t\tpending.delete(binding_group);\n\t\t});\n\t}\n\n\tqueue_micro_task(() => {\n\t\tif (hydration_mismatch) {\n\t\t\tvar value;\n\n\t\t\tif (is_checkbox) {\n\t\t\t\tvalue = get_binding_group_value(binding_group, value, input.checked);\n\t\t\t} else {\n\t\t\t\tvar hydration_input = binding_group.find((input) => input.checked);\n\t\t\t\t// @ts-ignore\n\t\t\t\tvalue = hydration_input?.__value;\n\t\t\t}\n\n\t\t\tset(value);\n\t\t}\n\t});\n}\n\n/**\n * @param {HTMLInputElement} input\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_checked(input, get, set = get) {\n\tlisten_to_event_and_reset_event(input, 'change', (is_reset) => {\n\t\tvar value = is_reset ? input.defaultChecked : input.checked;\n\t\tset(value);\n\t});\n\n\tif (\n\t\t// If we are hydrating and the value has since changed,\n\t\t// then use the update value from the input instead.\n\t\t(hydrating && input.defaultChecked !== input.checked) ||\n\t\t// If defaultChecked is set, then checked == defaultChecked\n\t\tuntrack(get) == null\n\t) {\n\t\tset(input.checked);\n\t}\n\n\trender_effect(() => {\n\t\tvar value = get();\n\t\tinput.checked = Boolean(value);\n\t});\n}\n\n/**\n * @template V\n * @param {Array<HTMLInputElement>} group\n * @param {V} __value\n * @param {boolean} checked\n * @returns {V[]}\n */\nfunction get_binding_group_value(group, __value, checked) {\n\t/** @type {Set<V>} */\n\tvar value = new Set();\n\n\tfor (var i = 0; i < group.length; i += 1) {\n\t\tif (group[i].checked) {\n\t\t\t// @ts-ignore\n\t\t\tvalue.add(group[i].__value);\n\t\t}\n\t}\n\n\tif (!checked) {\n\t\tvalue.delete(__value);\n\t}\n\n\treturn Array.from(value);\n}\n\n/**\n * @param {HTMLInputElement} input\n */\nfunction is_numberlike_input(input) {\n\tvar type = input.type;\n\treturn type === 'number' || type === 'range';\n}\n\n/**\n * @param {string} value\n */\nfunction to_number(value) {\n\treturn value === '' ? null : +value;\n}\n\n/**\n * @param {HTMLInputElement} input\n * @param {() => FileList | null} get\n * @param {(value: FileList | null) => void} set\n */\nexport function bind_files(input, get, set = get) {\n\tlisten_to_event_and_reset_event(input, 'change', () => {\n\t\tset(input.files);\n\t});\n\n\tif (\n\t\t// If we are hydrating and the value has since changed,\n\t\t// then use the updated value from the input instead.\n\t\thydrating &&\n\t\tinput.files\n\t) {\n\t\tset(input.files);\n\t}\n\n\trender_effect(() => {\n\t\tinput.files = get();\n\t});\n}\n","/** @import { ComponentContext, Effect } from '#client' */\nimport { DESTROYING, STATE_SYMBOL } from '#client/constants';\nimport { component_context, mark_as_component } from '../../../context.js';\nimport { effect, render_effect } from '../../../reactivity/effects.js';\nimport { active_effect, untrack } from '../../../runtime.js';\n\n/**\n * @param {any} bound_value\n * @param {Element} element_or_component\n * @returns {boolean}\n */\nfunction is_bound_this(bound_value, element_or_component) {\n\treturn (\n\t\tbound_value === element_or_component || bound_value?.[STATE_SYMBOL] === element_or_component\n\t);\n}\n\n/**\n * @param {any} element_or_component\n * @param {(value: unknown, ...parts: unknown[]) => void} update\n * @param {(...parts: unknown[]) => unknown} get_value\n * @param {() => unknown[]} [get_parts] Set if the this binding is used inside an each block,\n * \t\t\t\t\t\t\t\t\t\treturns all the parts of the each block context that are used in the expression\n * @returns {void}\n */\nexport function bind_this(\n\telement_or_component = mark_as_component(),\n\tupdate,\n\tget_value,\n\tget_parts\n) {\n\tvar component_effect = /** @type {ComponentContext} */ (component_context).r;\n\tvar parent = /** @type {Effect} */ (active_effect);\n\n\teffect(() => {\n\t\t/** @type {unknown[]} */\n\t\tvar old_parts;\n\n\t\t/** @type {unknown[]} */\n\t\tvar parts;\n\n\t\trender_effect(() => {\n\t\t\told_parts = parts;\n\t\t\t// We only track changes to the parts, not the value itself to avoid unnecessary reruns.\n\t\t\tparts = get_parts?.() || [];\n\n\t\t\tuntrack(() => {\n\t\t\t\tif (!is_bound_this(get_value(...parts), element_or_component)) {\n\t\t\t\t\tupdate(element_or_component, ...parts);\n\t\t\t\t\t// If this is an effect rerun (cause: each block context changes), then nullify the binding at\n\t\t\t\t\t// the previous position if it isn't already taken over by a different effect.\n\t\t\t\t\tif (old_parts && is_bound_this(get_value(...old_parts), element_or_component)) {\n\t\t\t\t\t\tupdate(null, ...old_parts);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\treturn () => {\n\t\t\t// When the bind:this effect is destroyed, we go up the effect parent chain until we find the last parent effect that is destroyed,\n\t\t\t// or the effect containing the component bind:this is in (whichever comes first). That way we can time the nulling of the binding\n\t\t\t// as close to user/developer expectation as possible.\n\t\t\t// TODO Svelte 6: Decide if we want to keep this logic or just always null the binding in the component effect's teardown\n\t\t\t// (which would be simpler, but less intuitive in some cases, and breaks the `ondestroy-before-cleanup` test)\n\t\t\tlet p = parent;\n\t\t\twhile (p !== component_effect && p.parent !== null && p.parent.f & DESTROYING) {\n\t\t\t\tp = p.parent;\n\t\t\t}\n\t\t\tconst teardown = () => {\n\t\t\t\tif (parts && is_bound_this(get_value(...parts), element_or_component)) {\n\t\t\t\t\tupdate(null, ...parts);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst original_teardown = p.teardown;\n\t\t\tp.teardown = () => {\n\t\t\t\tteardown();\n\t\t\t\toriginal_teardown?.();\n\t\t\t};\n\t\t};\n\t});\n\n\treturn element_or_component;\n}\n","/** @import { Derived, Effect, Source } from './types.js' */\nimport { DEV } from 'esm-env';\nimport {\n\tPROPS_IS_BINDABLE,\n\tPROPS_IS_IMMUTABLE,\n\tPROPS_IS_LAZY_INITIAL,\n\tPROPS_IS_RUNES,\n\tPROPS_IS_UPDATED\n} from '../../../constants.js';\nimport { get_descriptor, is_function } from '../../shared/utils.js';\nimport { set, source, update } from './sources.js';\nimport { derived, derived_safe_equal } from './deriveds.js';\nimport {\n\tactive_effect,\n\tget,\n\tis_destroying_effect,\n\tset_active_effect,\n\tuntrack\n} from '../runtime.js';\nimport * as e from '../errors.js';\nimport { DESTROYED, LEGACY_PROPS, STATE_SYMBOL } from '#client/constants';\nimport { proxy } from '../proxy.js';\nimport { capture_store_binding } from './store.js';\nimport { legacy_mode_flag } from '../../flags/index.js';\nimport { effect, render_effect } from './effects.js';\n\n/**\n * @param {((value?: number) => number)} fn\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_prop(fn, d = 1) {\n\tconst value = fn();\n\tfn(value + d);\n\treturn value;\n}\n\n/**\n * @param {((value?: number) => number)} fn\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_pre_prop(fn, d = 1) {\n\tconst value = fn() + d;\n\tfn(value);\n\treturn value;\n}\n\n/**\n * The proxy handler for rest props (i.e. `const { x, ...rest } = $props()`).\n * Is passed the full `$$props` object and excludes the named props.\n * @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Set<string | symbol>, name?: string }>}}\n */\nconst rest_props_handler = {\n\tget(target, key) {\n\t\tif (target.exclude.has(key)) return;\n\t\treturn target.props[key];\n\t},\n\tset(target, key) {\n\t\tif (DEV) {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.props_rest_readonly(`${target.name}.${String(key)}`);\n\t\t}\n\n\t\treturn false;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tif (target.exclude.has(key)) return;\n\t\tif (key in target.props) {\n\t\t\treturn {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: target.props[key]\n\t\t\t};\n\t\t}\n\t},\n\thas(target, key) {\n\t\tif (target.exclude.has(key)) return false;\n\t\treturn key in target.props;\n\t},\n\townKeys(target) {\n\t\treturn Reflect.ownKeys(target.props).filter((key) => !target.exclude.has(key));\n\t}\n};\n\n/**\n * @param {Record<string, unknown>} props\n * @param {Set<string>} exclude\n * @param {string} [name]\n * @returns {Record<string, unknown>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function rest_props(props, exclude, name) {\n\treturn new Proxy(DEV ? { props, exclude, name } : { props, exclude }, rest_props_handler);\n}\n\n/**\n * The proxy handler for legacy $$restProps and $$props\n * @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Array<string | symbol>, special: Record<string | symbol, (v?: unknown) => unknown>, version: Source<number>, parent_effect: Effect }>}}\n */\nconst legacy_rest_props_handler = {\n\tget(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\tget(target.version);\n\t\treturn key in target.special ? target.special[key]() : target.props[key];\n\t},\n\tset(target, key, value) {\n\t\tif (!(key in target.special)) {\n\t\t\tvar previous_effect = active_effect;\n\n\t\t\ttry {\n\t\t\t\tset_active_effect(target.parent_effect);\n\n\t\t\t\t// Handle props that can temporarily get out of sync with the parent\n\t\t\t\t/** @type {Record<string, (v?: unknown) => unknown>} */\n\t\t\t\ttarget.special[key] = prop(\n\t\t\t\t\t{\n\t\t\t\t\t\tget [key]() {\n\t\t\t\t\t\t\treturn target.props[key];\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t/** @type {string} */ (key),\n\t\t\t\t\tPROPS_IS_UPDATED\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\tset_active_effect(previous_effect);\n\t\t\t}\n\t\t}\n\n\t\ttarget.special[key](value);\n\t\tupdate(target.version); // $$props is coarse-grained: when $$props.x is updated, usages of $$props.y etc are also rerun\n\t\treturn true;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\tif (key in target.props) {\n\t\t\treturn {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: target.props[key]\n\t\t\t};\n\t\t}\n\t},\n\tdeleteProperty(target, key) {\n\t\t// Svelte 4 allowed for deletions on $$restProps\n\t\tif (target.exclude.includes(key)) return true;\n\t\ttarget.exclude.push(key);\n\t\tupdate(target.version);\n\t\treturn true;\n\t},\n\thas(target, key) {\n\t\tif (target.exclude.includes(key)) return false;\n\t\treturn key in target.props;\n\t},\n\townKeys(target) {\n\t\treturn Reflect.ownKeys(target.props).filter((key) => !target.exclude.includes(key));\n\t}\n};\n\n/**\n * @param {Record<string, unknown>} props\n * @param {string[]} exclude\n * @returns {Record<string, unknown>}\n */\nexport function legacy_rest_props(props, exclude) {\n\treturn new Proxy(\n\t\t{\n\t\t\tprops,\n\t\t\texclude,\n\t\t\tspecial: {},\n\t\t\tversion: source(0),\n\t\t\t// TODO this is only necessary because we need to track component\n\t\t\t// destruction inside `prop`, because of `bind:this`, but it\n\t\t\t// seems likely that we can simplify `bind:this` instead\n\t\t\tparent_effect: /** @type {Effect} */ (active_effect)\n\t\t},\n\t\tlegacy_rest_props_handler\n\t);\n}\n\n/**\n * The proxy handler for spread props. Handles the incoming array of props\n * that looks like `() => { dynamic: props }, { static: prop }, ..` and wraps\n * them so that the whole thing is passed to the component as the `$$props` argument.\n * @type {ProxyHandler<{ props: Array<Record<string | symbol, unknown> | (() => Record<string | symbol, unknown>)> }>}}\n */\nconst spread_props_handler = {\n\tget(target, key) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (typeof p === 'object' && p !== null && key in p) return p[key];\n\t\t}\n\t},\n\tset(target, key, value) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tconst desc = get_descriptor(p, key);\n\t\t\tif (desc && desc.set) {\n\t\t\t\tdesc.set(value);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (typeof p === 'object' && p !== null && key in p) {\n\t\t\t\tconst descriptor = get_descriptor(p, key);\n\t\t\t\tif (descriptor && !descriptor.configurable) {\n\t\t\t\t\t// Prevent a \"Non-configurability Report Error\": The target is an array, it does\n\t\t\t\t\t// not actually contain this property. If it is now described as non-configurable,\n\t\t\t\t\t// the proxy throws a validation error. Setting it to true avoids that.\n\t\t\t\t\tdescriptor.configurable = true;\n\t\t\t\t}\n\t\t\t\treturn descriptor;\n\t\t\t}\n\t\t}\n\t},\n\thas(target, key) {\n\t\t// To prevent a false positive `is_entry_props` in the `prop` function\n\t\tif (key === STATE_SYMBOL || key === LEGACY_PROPS) return false;\n\n\t\tfor (let p of target.props) {\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (p != null && key in p) return true;\n\t\t}\n\n\t\treturn false;\n\t},\n\townKeys(target) {\n\t\t/** @type {Array<string | symbol>} */\n\t\tconst keys = [];\n\n\t\tfor (let p of target.props) {\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (!p) continue;\n\n\t\t\tfor (const key in p) {\n\t\t\t\tif (!keys.includes(key)) keys.push(key);\n\t\t\t}\n\n\t\t\tfor (const key of Object.getOwnPropertySymbols(p)) {\n\t\t\t\tif (!keys.includes(key)) keys.push(key);\n\t\t\t}\n\t\t}\n\n\t\treturn keys;\n\t}\n};\n\n/**\n * @param {Array<Record<string, unknown> | (() => Record<string, unknown>)>} props\n * @returns {any}\n */\nexport function spread_props(...props) {\n\treturn new Proxy({ props }, spread_props_handler);\n}\n\n/**\n * This function is responsible for synchronizing a possibly bound prop with the inner component state.\n * It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.\n * @template V\n * @param {Record<string, unknown>} props\n * @param {string} key\n * @param {number} flags\n * @param {V | (() => V)} [fallback]\n * @returns {(() => V | ((arg: V) => V) | ((arg: V, mutation: boolean) => V))}\n */\nexport function prop(props, key, flags, fallback) {\n\tvar runes = !legacy_mode_flag || (flags & PROPS_IS_RUNES) !== 0;\n\tvar bindable = (flags & PROPS_IS_BINDABLE) !== 0;\n\tvar lazy = (flags & PROPS_IS_LAZY_INITIAL) !== 0;\n\n\tvar fallback_value = /** @type {V} */ (fallback);\n\tvar fallback_dirty = true;\n\tvar fallback_signal = /** @type {Derived<V> | undefined} */ (undefined);\n\n\tvar get_fallback = () => {\n\t\tif (lazy && runes) {\n\t\t\tfallback_signal ??= derived(/** @type {() => V} */ (fallback));\n\t\t\treturn get(fallback_signal);\n\t\t}\n\n\t\tif (fallback_dirty) {\n\t\t\tfallback_dirty = false;\n\n\t\t\tfallback_value = lazy\n\t\t\t\t? untrack(/** @type {() => V} */ (fallback))\n\t\t\t\t: /** @type {V} */ (fallback);\n\t\t}\n\n\t\treturn fallback_value;\n\t};\n\n\t/** @type {((v: V) => void) | undefined} */\n\tlet setter;\n\n\tif (bindable) {\n\t\t// Can be the case when someone does `mount(Component, props)` with `let props = $state({...})`\n\t\t// or `createClassComponent(Component, props)`\n\t\tvar is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props;\n\n\t\tsetter =\n\t\t\tget_descriptor(props, key)?.set ??\n\t\t\t(is_entry_props && key in props ? (v) => (props[key] = v) : undefined);\n\t}\n\n\t/** @type {V} */\n\tvar initial_value;\n\tvar is_store_sub = false;\n\n\tif (bindable) {\n\t\t[initial_value, is_store_sub] = capture_store_binding(() => /** @type {V} */ (props[key]));\n\t} else {\n\t\tinitial_value = /** @type {V} */ (props[key]);\n\t}\n\n\tif (initial_value === undefined && fallback !== undefined) {\n\t\tinitial_value = get_fallback();\n\n\t\tif (setter) {\n\t\t\tif (runes) e.props_invalid_value(key);\n\t\t\tsetter(initial_value);\n\t\t}\n\t}\n\n\t/** @type {() => V} */\n\tvar getter;\n\n\tif (runes) {\n\t\tgetter = () => {\n\t\t\tvar value = /** @type {V} */ (props[key]);\n\t\t\tif (value === undefined) return get_fallback();\n\t\t\tfallback_dirty = true;\n\t\t\treturn value;\n\t\t};\n\t} else {\n\t\tgetter = () => {\n\t\t\tvar value = /** @type {V} */ (props[key]);\n\n\t\t\tif (value !== undefined) {\n\t\t\t\t// in legacy mode, we don't revert to the fallback value\n\t\t\t\t// if the prop goes from defined to undefined. The easiest\n\t\t\t\t// way to model this is to make the fallback undefined\n\t\t\t\t// as soon as the prop has a value\n\t\t\t\tfallback_value = /** @type {V} */ (undefined);\n\t\t\t}\n\n\t\t\treturn value === undefined ? fallback_value : value;\n\t\t};\n\t}\n\n\t// prop is never written to — we only need a getter\n\tif (runes && (flags & PROPS_IS_UPDATED) === 0) {\n\t\treturn getter;\n\t}\n\n\t// prop is written to, but the parent component had `bind:foo` which\n\t// means we can just call `$$props.foo = value` directly\n\tif (setter) {\n\t\tvar legacy_parent = props.$$legacy;\n\t\treturn /** @type {() => V} */ (\n\t\t\tfunction (/** @type {V} */ value, /** @type {boolean} */ mutation) {\n\t\t\t\tif (arguments.length > 0) {\n\t\t\t\t\t// We don't want to notify if the value was mutated and the parent is in runes mode.\n\t\t\t\t\t// In that case the state proxy (if it exists) should take care of the notification.\n\t\t\t\t\t// If the parent is not in runes mode, we need to notify on mutation, too, that the prop\n\t\t\t\t\t// has changed because the parent will not be able to detect the change otherwise.\n\t\t\t\t\tif (!runes || !mutation || legacy_parent || is_store_sub) {\n\t\t\t\t\t\t/** @type {Function} */ (setter)(mutation ? getter() : value);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\n\t\t\t\treturn getter();\n\t\t\t}\n\t\t);\n\t}\n\n\t// Either prop is written to, but there's no binding, which means we\n\t// create a derived that we can write to locally.\n\t// Or we are in legacy mode where we always create a derived to replicate that\n\t// Svelte 4 did not trigger updates when a primitive value was updated to the same value.\n\tvar overridden = false;\n\n\tvar d = ((flags & PROPS_IS_IMMUTABLE) !== 0 ? derived : derived_safe_equal)(() => {\n\t\toverridden = false;\n\t\treturn getter();\n\t});\n\n\tif (DEV) {\n\t\td.label = key;\n\t}\n\n\t// Capture the initial value if it's bindable\n\tif (bindable) get(d);\n\n\tvar parent_effect = /** @type {Effect} */ (active_effect);\n\n\treturn /** @type {() => V} */ (\n\t\tfunction (/** @type {any} */ value, /** @type {boolean} */ mutation) {\n\t\t\tif (arguments.length > 0) {\n\t\t\t\tconst new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;\n\n\t\t\t\tset(d, new_value);\n\t\t\t\toverridden = true;\n\n\t\t\t\tif (fallback_value !== undefined) {\n\t\t\t\t\tfallback_value = new_value;\n\t\t\t\t}\n\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\t// special case — avoid recalculating the derived if we're in a\n\t\t\t// teardown function and the prop was overridden locally, or the\n\t\t\t// component was already destroyed (people could access props in a timeout)\n\t\t\tif ((is_destroying_effect && overridden) || (parent_effect.f & DESTROYED) !== 0) {\n\t\t\t\treturn d.v;\n\t\t\t}\n\n\t\t\treturn get(d);\n\t\t}\n\t);\n}\n","// generated during release, do not modify\n\n/**\n * The current version, as set in package.json.\n * @type {string}\n */\nexport const VERSION = '5.57.0';\nexport const PUBLIC_VERSION = '5';\n","import { PUBLIC_VERSION } from '../version.js';\n\nif (typeof window !== 'undefined') {\n\t// @ts-expect-error\n\t((window.__svelte ??= {}).v ??= new Set()).add(PUBLIC_VERSION);\n}\n","/** Shared types. These mirror the JSON the backend produces. */\n\nexport type Category = \"personal\" | \"project\" | \"foundation\";\nexport type Visibility = \"public\" | \"private\";\nexport type ViewName = \"day\" | \"week\" | \"month\" | \"year\" | \"agenda\";\nexport type SortName = \"start\" | \"-start\" | \"title\" | \"-title\";\n\nexport const CATEGORIES: readonly Category[] = [\"personal\", \"project\", \"foundation\"];\nexport const VIEWS: readonly ViewName[] = [\"day\", \"week\", \"month\", \"year\", \"agenda\"];\n\nexport interface CalendarEvent {\n id: number;\n shortlink: string;\n shortlink_url: string;\n title: string;\n category: Category;\n visibility: Visibility;\n /** ISO 8601 UTC, e.g. 2026-01-01T10:00:00Z */\n start: string;\n end: string;\n all_day: boolean;\n description: string;\n location: string;\n url: string;\n project: string | null;\n /** The IANA zone the organiser entered the times in, e.g. \"Europe/Berlin\". */\n timezone: string;\n owner: string;\n created_at: string;\n updated_at: string;\n}\n\n/** The shape POSTed or PUT to /api/events. */\nexport interface EventDraft {\n title: string;\n category: Category;\n visibility: Visibility;\n start: string;\n end: string;\n all_day: boolean;\n description: string;\n location: string;\n url: string;\n project: string | null;\n timezone: string;\n}\n\nexport interface SessionInfo {\n authenticated: boolean;\n uid?: string | null;\n fullname?: string | null;\n email?: string | null;\n is_member?: boolean;\n is_chair?: boolean;\n projects?: string[];\n committees?: string[];\n login_url?: string;\n logout_url?: string;\n}\n\nexport interface Calendars {\n uid: string | null;\n authenticated: boolean;\n is_member: boolean;\n projects: string[];\n committees: string[];\n can_create: {\n personal: boolean;\n project: string[];\n project_private: string[];\n foundation: boolean;\n };\n title: string;\n /** \"local\", or an IANA zone name such as \"UTC\" or \"Europe/Berlin\". */\n default_display_zone: string;\n}\n\nexport interface Filters {\n categories: Set<Category>;\n /** Empty means \"every project the events happen to belong to\". */\n projects: Set<string>;\n visibility: Visibility | \"all\";\n search: string;\n sort: SortName;\n}\n","/**\n * Where the app is mounted.\n *\n * The calendar usually lives at the root of a host, but it can be mounted in a\n * sub-directory instead - `https://calendar.apache.org/calendar/` rather than\n * `https://calendar.apache.org/`. The prefix is a deployment decision, not a\n * build-time one: `frontend/dist` is committed to the repository and shared\n * between deployments, so the same build has to work either way.\n *\n * The backend therefore rewrites the `<base href>` in index.html to match\n * `server.base_path` from its config, and everything here reads the answer back\n * out of `document.baseURI`. The browser uses the same tag to resolve the\n * script, stylesheet and favicon, which is why relative URLs in the page keep\n * working on a nested route such as /calendar/e/AbCd2345.\n */\n\n/** The mount point, with no trailing slash: \"\" at the root, or \"/calendar\". */\nexport function basePath(): string {\n const path = baseUrl().pathname;\n return path === \"/\" ? \"\" : path.replace(/\\/+$/, \"\");\n}\n\n/** The absolute base URL the document resolves relative URLs against. */\nexport function baseUrl(): URL {\n const href = globalThis.document?.baseURI;\n try {\n return new URL(href ?? \"/\", globalThis.location?.href ?? \"http://localhost/\");\n } catch {\n return new URL(\"http://localhost/\");\n }\n}\n\n/** An absolute path within the app: appPath(\"/help\") -> \"/calendar/help\". */\nexport function appPath(path: string): string {\n const suffix = path.startsWith(\"/\") ? path : `/${path}`;\n return `${basePath()}${suffix}` || \"/\";\n}\n\n/** An absolute path to an API endpoint. */\nexport function apiUrl(path: string): string {\n return appPath(`/api${path.startsWith(\"/\") ? path : `/${path}`}`);\n}\n\n/** An absolute path to a file shipped in the build, such as the logo. */\nexport function assetUrl(name: string): string {\n return appPath(`/${name.replace(/^\\/+/, \"\")}`);\n}\n\n/**\n * Strips the mount point off a browser path, so route matching does not have to\n * know about it. Returns null when the path is not inside the app at all.\n */\nexport function withoutBase(pathname: string): string | null {\n const prefix = basePath();\n if (!prefix) return pathname || \"/\";\n if (pathname === prefix) return \"/\";\n if (pathname.startsWith(`${prefix}/`)) return pathname.slice(prefix.length) || \"/\";\n return null;\n}\n\n/**\n * asfquart's OAuth endpoint, as mounted by this app.\n *\n * The backend hands back the real login and logout URLs in /api/session, and\n * those always win, because a deployment can move the endpoint with the\n * `oauth.uri` config key. These are the fallbacks used before that request has\n * come back, or if it fails - which is exactly when someone is most likely to\n * be reaching for the login link.\n *\n * They are not URL-encoded, for the same reason the backend does not encode\n * them: a mount point is restricted to unreserved URL characters.\n */\nconst DEFAULT_OAUTH_PATH = \"/auth\";\n\nexport function loginUrl(returnTo: string = appPath(\"/\")): string {\n return `${appPath(DEFAULT_OAUTH_PATH)}?login=${returnTo}`;\n}\n\nexport function logoutUrl(returnTo: string = appPath(\"/\")): string {\n return `${appPath(DEFAULT_OAUTH_PATH)}?logout=${returnTo}`;\n}\n","/**\n * The API client.\n *\n * Paths here are given relative to /api; apiUrl() puts the deployment's mount\n * point in front, so the client works whether the app is served from the root\n * of a host or from a sub-directory.\n *\n * Every request carries X-No-Redirect so asfquart answers an unauthenticated\n * API call with a 401 instead of bouncing the fetch to the OAuth provider.\n */\n\nimport type { CalendarEvent, Calendars, EventDraft, SessionInfo } from \"./types\";\nimport type { ImportPreview, ImportResult, ResolvedImportSettings } from \"./importing\";\nimport { apiUrl } from \"./base\";\n\nexport class ApiError extends Error {\n readonly status: number;\n readonly field: string | null;\n\n constructor(message: string, status: number, field: string | null = null) {\n super(message);\n this.name = \"ApiError\";\n this.status = status;\n this.field = field;\n }\n\n /** True when logging in might fix it. */\n get needsLogin(): boolean {\n return this.status === 401;\n }\n}\n\nasync function request<T>(method: string, path: string, body?: unknown): Promise<T> {\n // FormData carries its own multipart boundary, so the browser has to set the\n // content type; naming it ourselves would produce a body nothing can parse.\n const isUpload = typeof FormData !== \"undefined\" && body instanceof FormData;\n let response: Response;\n try {\n response = await fetch(apiUrl(path), {\n method,\n credentials: \"same-origin\",\n headers: {\n Accept: \"application/json\",\n \"X-No-Redirect\": \"1\",\n ...(body === undefined || isUpload ? {} : { \"Content-Type\": \"application/json\" }),\n },\n ...(body === undefined ? {} : { body: isUpload ? (body as FormData) : JSON.stringify(body) }),\n });\n } catch {\n throw new ApiError(\"Could not reach the calendar service.\", 0);\n }\n\n if (response.status === 204) return undefined as T;\n\n const text = await response.text();\n let parsed: unknown = null;\n if (text) {\n try {\n parsed = JSON.parse(text);\n } catch {\n parsed = null;\n }\n }\n\n if (!response.ok) {\n const details = (parsed ?? {}) as { error?: string; field?: string };\n throw new ApiError(\n details.error ?? `Request failed with status ${response.status}`,\n response.status,\n details.field ?? null,\n );\n }\n\n return parsed as T;\n}\n\nexport interface EventQuery {\n start?: Date | string;\n end?: Date | string;\n categories?: readonly string[];\n projects?: readonly string[];\n visibility?: string;\n owner?: string;\n q?: string;\n sort?: string;\n limit?: number;\n}\n\nexport function buildQuery(query: EventQuery): string {\n const params = new URLSearchParams();\n const stamp = (value: Date | string) => (value instanceof Date ? value.toISOString() : value);\n if (query.start) params.set(\"start\", stamp(query.start));\n if (query.end) params.set(\"end\", stamp(query.end));\n for (const category of query.categories ?? []) params.append(\"category\", category);\n for (const project of query.projects ?? []) params.append(\"project\", project);\n if (query.visibility && query.visibility !== \"all\") params.set(\"visibility\", query.visibility);\n if (query.owner) params.set(\"owner\", query.owner);\n if (query.q) params.set(\"q\", query.q);\n if (query.sort) params.set(\"sort\", query.sort);\n if (query.limit) params.set(\"limit\", String(query.limit));\n const encoded = params.toString();\n return encoded ? `?${encoded}` : \"\";\n}\n\nexport const api = {\n session: () => request<SessionInfo>(\"GET\", \"/session\"),\n\n calendars: () => request<Calendars>(\"GET\", \"/calendars\"),\n\n events: async (query: EventQuery = {}): Promise<CalendarEvent[]> => {\n const body = await request<{ events: CalendarEvent[] }>(\"GET\", `/events${buildQuery(query)}`);\n return body.events;\n },\n\n event: async (id: number): Promise<CalendarEvent> => {\n const body = await request<{ event: CalendarEvent }>(\"GET\", `/events/${id}`);\n return body.event;\n },\n\n byShortlink: async (token: string): Promise<CalendarEvent> => {\n const body = await request<{ event: CalendarEvent }>(\"GET\", `/shortlink/${encodeURIComponent(token)}`);\n return body.event;\n },\n\n create: async (draft: EventDraft): Promise<CalendarEvent> => {\n const body = await request<{ event: CalendarEvent }>(\"POST\", \"/events\", draft);\n return body.event;\n },\n\n update: async (id: number, draft: EventDraft): Promise<CalendarEvent> => {\n const body = await request<{ event: CalendarEvent }>(\"PUT\", `/events/${id}`, draft);\n return body.event;\n },\n\n remove: (id: number) => request<{ deleted: number }>(\"DELETE\", `/events/${id}`),\n\n /** Reads an .ics file and says what is in it, without saving anything. */\n previewImport: (file: File) => {\n const body = new FormData();\n body.append(\"file\", file);\n return request<ImportPreview>(\"POST\", \"/import/preview\", body);\n },\n\n /** Turns an .ics file into events on the chosen calendar. */\n runImport: (file: File, settings: ResolvedImportSettings) => {\n const body = new FormData();\n body.append(\"file\", file);\n body.append(\"category\", settings.category);\n if (settings.visibility) body.append(\"visibility\", settings.visibility);\n if (settings.project) body.append(\"project\", settings.project);\n return request<ImportResult>(\"POST\", \"/import\", body);\n },\n\n icsUrl: (id: number) => apiUrl(`/events/${id}.ics`),\n\n feedUrl: (query: EventQuery = {}) => apiUrl(`/events.ics${buildQuery(query)}`),\n};\n","/**\n * Date helpers.\n *\n * Everything here works in the browser's local timezone, which is what a\n * calendar grid should do. The backend stores and returns UTC; the conversion\n * happens when a date string is parsed.\n *\n * All-day events are the exception: the backend snaps them to UTC midnight, so\n * we read their date parts in UTC to decide which days they cover. Otherwise a\n * whole-day event would appear to start the evening before for anyone west of\n * Greenwich.\n */\n\nexport const MINUTE = 60_000;\nexport const HOUR = 60 * MINUTE;\nexport const DAY = 24 * HOUR;\n\nexport const WEEKDAY_NAMES = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\nexport const MONTH_NAMES = [\n \"January\", \"February\", \"March\", \"April\", \"May\", \"June\",\n \"July\", \"August\", \"September\", \"October\", \"November\", \"December\",\n];\n\n/** Monday. ISO weeks are the ASF norm and match the WEEKDAY_NAMES above. */\nexport const WEEK_STARTS_ON = 1;\n\nexport function startOfDay(date: Date): Date {\n const copy = new Date(date);\n copy.setHours(0, 0, 0, 0);\n return copy;\n}\n\nexport function endOfDay(date: Date): Date {\n const copy = startOfDay(date);\n copy.setDate(copy.getDate() + 1);\n return copy;\n}\n\nexport function addDays(date: Date, count: number): Date {\n const copy = new Date(date);\n copy.setDate(copy.getDate() + count);\n return copy;\n}\n\nexport function addMonths(date: Date, count: number): Date {\n const copy = new Date(date);\n const targetDay = copy.getDate();\n copy.setDate(1);\n copy.setMonth(copy.getMonth() + count);\n // Clamp: 31 January plus one month is 28/29 February, not 3 March.\n const lastDay = daysInMonth(copy.getFullYear(), copy.getMonth());\n copy.setDate(Math.min(targetDay, lastDay));\n return copy;\n}\n\nexport function addYears(date: Date, count: number): Date {\n return addMonths(date, count * 12);\n}\n\nexport function daysInMonth(year: number, month: number): number {\n return new Date(year, month + 1, 0).getDate();\n}\n\nexport function startOfWeek(date: Date, weekStartsOn = WEEK_STARTS_ON): Date {\n const copy = startOfDay(date);\n const shift = (copy.getDay() - weekStartsOn + 7) % 7;\n copy.setDate(copy.getDate() - shift);\n return copy;\n}\n\nexport function startOfMonth(date: Date): Date {\n const copy = startOfDay(date);\n copy.setDate(1);\n return copy;\n}\n\nexport function startOfYear(date: Date): Date {\n const copy = startOfMonth(date);\n copy.setMonth(0);\n return copy;\n}\n\nexport function isSameDay(a: Date, b: Date): boolean {\n return (\n a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate()\n );\n}\n\nexport function isToday(date: Date, now: Date = new Date()): boolean {\n return isSameDay(date, now);\n}\n\nexport function isWeekend(date: Date): boolean {\n const day = date.getDay();\n return day === 0 || day === 6;\n}\n\n/**\n * The six-week grid a month view shows: always 42 days, starting on the first\n * WEEK_STARTS_ON on or before the 1st. A fixed size keeps the grid from\n * jumping about as the user pages through months.\n */\nexport function monthGrid(date: Date, weekStartsOn = WEEK_STARTS_ON): Date[] {\n const first = startOfWeek(startOfMonth(date), weekStartsOn);\n return Array.from({ length: 42 }, (_, index) => addDays(first, index));\n}\n\n/** The seven days of the week containing `date`. */\nexport function weekDays(date: Date, weekStartsOn = WEEK_STARTS_ON): Date[] {\n const first = startOfWeek(date, weekStartsOn);\n return Array.from({ length: 7 }, (_, index) => addDays(first, index));\n}\n\n/** The twelve first-of-the-month dates for the year containing `date`. */\nexport function yearMonths(date: Date): Date[] {\n const january = startOfYear(date);\n return Array.from({ length: 12 }, (_, index) => new Date(january.getFullYear(), index, 1));\n}\n\nexport interface DateRange {\n start: Date;\n end: Date;\n}\n\n/**\n * The window of time a view needs loaded. The month view asks for its whole\n * 42-day grid, not just the calendar month, so events from the neighbouring\n * months that are visible in the grid are there too.\n */\nexport function rangeForView(view: string, cursor: Date): DateRange {\n switch (view) {\n case \"day\":\n return { start: startOfDay(cursor), end: endOfDay(cursor) };\n case \"week\": {\n const first = startOfWeek(cursor);\n return { start: first, end: addDays(first, 7) };\n }\n case \"year\": {\n const first = startOfYear(cursor);\n return { start: first, end: new Date(first.getFullYear() + 1, 0, 1) };\n }\n case \"agenda\": {\n const first = startOfDay(cursor);\n return { start: first, end: addDays(first, 90) };\n }\n case \"month\":\n default: {\n const grid = monthGrid(cursor);\n return { start: grid[0], end: addDays(grid[41], 1) };\n }\n }\n}\n\n/** Moves the cursor one view-sized step forwards or backwards. */\nexport function step(view: string, cursor: Date, direction: number): Date {\n switch (view) {\n case \"day\":\n return addDays(cursor, direction);\n case \"week\":\n return addDays(cursor, 7 * direction);\n case \"year\":\n return addYears(cursor, direction);\n case \"agenda\":\n return addDays(cursor, 30 * direction);\n case \"month\":\n default:\n return addMonths(cursor, direction);\n }\n}\n\n/** A stable YYYY-MM-DD key for a local date, used to bucket events by day. */\nexport function dayKey(date: Date): string {\n const year = String(date.getFullYear()).padStart(4, \"0\");\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n return `${year}-${month}-${day}`;\n}\n\n/** The inverse of dayKey(), for reading dates back out of form fields. */\nexport function fromDayKey(key: string): Date {\n const [year, month, day] = key.split(\"-\").map(Number);\n return new Date(year, (month ?? 1) - 1, day ?? 1);\n}\n\n// ---- formatting -----------------------------------------------------------\n\nexport function formatTime(date: Date): string {\n return `${String(date.getHours()).padStart(2, \"0\")}:${String(date.getMinutes()).padStart(2, \"0\")}`;\n}\n\nexport function formatDate(date: Date): string {\n return `${date.getDate()} ${MONTH_NAMES[date.getMonth()]} ${date.getFullYear()}`;\n}\n\nexport function formatMonthYear(date: Date): string {\n return `${MONTH_NAMES[date.getMonth()]} ${date.getFullYear()}`;\n}\n\n/** The heading shown above each view. */\nexport function formatViewTitle(view: string, cursor: Date): string {\n switch (view) {\n case \"day\":\n return formatDate(cursor);\n case \"week\": {\n const days = weekDays(cursor);\n const first = days[0];\n const last = days[6];\n if (first.getMonth() === last.getMonth()) {\n return `${first.getDate()} - ${last.getDate()} ${formatMonthYear(first)}`;\n }\n if (first.getFullYear() === last.getFullYear()) {\n return `${first.getDate()} ${MONTH_NAMES[first.getMonth()]} - ${last.getDate()} ${formatMonthYear(last)}`;\n }\n return `${formatDate(first)} - ${formatDate(last)}`;\n }\n case \"year\":\n return String(cursor.getFullYear());\n case \"agenda\":\n return `From ${formatDate(cursor)}`;\n case \"month\":\n default:\n return formatMonthYear(cursor);\n }\n}\n\n/** Formats a value for an <input type=\"datetime-local\">. */\nexport function toLocalInput(date: Date): string {\n return `${dayKey(date)}T${formatTime(date)}`;\n}\n\n/** Formats a value for an <input type=\"date\">. */\nexport function toDateInput(date: Date): string {\n return dayKey(date);\n}\n\n/** Reads an ISO 8601 string from the API into a Date. */\nexport function parseISO(value: string): Date {\n return new Date(value);\n}\n\n/** Serialises a Date for the API. */\nexport function toISO(date: Date): string {\n return date.toISOString().replace(/\\.\\d{3}Z$/, \"Z\");\n}\n","/**\n * Timezone handling.\n *\n * There are three separate ideas here, and it helps to keep them apart:\n *\n * - The **event timezone** is what the organiser meant when they typed the\n * times in: \"15:00 in Berlin\". It is stored with the event.\n * - The **display timezone** is the clock the reader wants the calendar drawn\n * on. A grid has one time axis, so there is exactly one of these.\n * - **Comparison timezones** are extra clocks shown alongside, so you can see\n * at a glance what 15:00 in Berlin is where you are.\n *\n * The instant itself is always the same; only the wall clock changes.\n *\n * Everything below works with \"wall dates\". A wall date is an ordinary `Date`\n * whose *local* getters (getHours, getDate, ...) read as the wall clock in some\n * other zone. That means the existing calendar-grid arithmetic keeps working\n * unchanged - it just operates on wall dates rather than on instants - and only\n * the edges of the app have to convert.\n */\n\nimport { formatTime } from \"./dates\";\n\n/**\n * A zone to display in: an IANA name such as \"Europe/Berlin\", or the sentinel\n * \"local\" meaning whatever the browser's own zone happens to be. The sentinel\n * is kept rather than resolved once, so a laptop that moves keeps up.\n */\nexport type DisplayZone = string;\n\nexport const LOCAL: DisplayZone = \"local\";\nexport const UTC = \"UTC\";\n\nexport function isLocal(zone: DisplayZone): boolean {\n return zone === LOCAL;\n}\n\n/** The IANA name a display zone refers to. */\nexport function resolveZone(zone: DisplayZone): string {\n return isLocal(zone) ? browserZone() : zone;\n}\n\n/** Offset of the browser's own zone at an instant, in ms east of UTC. */\nexport function localOffsetMs(instant: Date): number {\n return -instant.getTimezoneOffset() * 60_000;\n}\n\nconst formatters = new Map<string, Intl.DateTimeFormat>();\n\nfunction partsFormatter(timeZone: string): Intl.DateTimeFormat {\n let formatter = formatters.get(timeZone);\n if (!formatter) {\n formatter = new Intl.DateTimeFormat(\"en-US\", {\n timeZone,\n hourCycle: \"h23\",\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n });\n formatters.set(timeZone, formatter);\n }\n return formatter;\n}\n\n/**\n * Offset of an IANA zone at an instant, in ms east of UTC.\n *\n * There is no direct API for this, so we ask Intl what the wall clock is in\n * that zone and compare it with the wall clock in UTC.\n */\nexport function zoneOffsetMs(instant: Date, timeZone: string): number {\n let parts: Intl.DateTimeFormatPart[];\n try {\n parts = partsFormatter(timeZone).formatToParts(instant);\n } catch {\n // An unknown zone should not take the page down with it.\n return 0;\n }\n const value = (type: string) => Number(parts.find((part) => part.type === type)?.value ?? 0);\n const asIfUtc = Date.UTC(\n value(\"year\"),\n value(\"month\") - 1,\n value(\"day\"),\n value(\"hour\"),\n value(\"minute\"),\n value(\"second\"),\n );\n // Compare whole seconds; Intl has no milliseconds to give us.\n return asIfUtc - Math.floor(instant.getTime() / 1000) * 1000;\n}\n\n/**\n * An instant, as a wall date in `timeZone`.\n *\n * The browser offset used for the conversion depends on the result, so we\n * solve for it: one correction is enough except for instants an hour either\n * side of a daylight-saving change, where a second settles it.\n */\nexport function toWallInZone(instant: Date, timeZone: string): Date {\n const target = instant.getTime() + zoneOffsetMs(instant, timeZone);\n let wall = new Date(target - localOffsetMs(instant));\n for (let attempt = 0; attempt < 2; attempt += 1) {\n const corrected = new Date(target - localOffsetMs(wall));\n if (corrected.getTime() === wall.getTime()) return wall;\n wall = corrected;\n }\n return wall;\n}\n\n/** A wall date in `timeZone`, back to the instant it names. */\nexport function fromWallInZone(wall: Date, timeZone: string): Date {\n const target = wall.getTime() + localOffsetMs(wall);\n let instant = new Date(target - zoneOffsetMs(wall, timeZone));\n for (let attempt = 0; attempt < 2; attempt += 1) {\n const corrected = new Date(target - zoneOffsetMs(instant, timeZone));\n if (corrected.getTime() === instant.getTime()) return instant;\n instant = corrected;\n }\n return instant;\n}\n\n/** An instant, as a wall date in the chosen display zone. */\nexport function toWall(instant: Date, zone: DisplayZone): Date {\n // The browser's own zone needs no conversion, and taking the short cut keeps\n // it exact even if Intl does not recognise the name the browser reports.\n return isLocal(zone) ? new Date(instant.getTime()) : toWallInZone(instant, zone);\n}\n\n/** A wall date in the chosen display zone, back to the instant it names. */\nexport function fromWall(wall: Date, zone: DisplayZone): Date {\n return isLocal(zone) ? new Date(wall.getTime()) : fromWallInZone(wall, zone);\n}\n\n/** Right now, as a wall date in the chosen display zone. */\nexport function nowInZone(zone: DisplayZone): Date {\n return toWall(new Date(), zone);\n}\n\n/** The browser's own IANA zone name, or UTC if it will not say. */\nexport function browserZone(): string {\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone || UTC;\n } catch {\n return UTC;\n }\n}\n\n/** Formats an offset in milliseconds as \"UTC+02:00\". */\nexport function offsetLabel(offsetMs: number): string {\n if (offsetMs === 0) return UTC;\n const sign = offsetMs < 0 ? \"-\" : \"+\";\n const total = Math.abs(Math.round(offsetMs / 60_000));\n const hours = String(Math.floor(total / 60)).padStart(2, \"0\");\n const minutes = String(total % 60).padStart(2, \"0\");\n return `UTC${sign}${hours}:${minutes}`;\n}\n\n/** The short name a zone goes by right now, such as \"CEST\" or \"GMT+5:30\". */\nexport function zoneAbbreviation(instant: Date, timeZone: string): string {\n try {\n const parts = new Intl.DateTimeFormat(\"en-US\", {\n timeZone,\n timeZoneName: \"short\",\n }).formatToParts(instant);\n return parts.find((part) => part.type === \"timeZoneName\")?.value ?? timeZone;\n } catch {\n return timeZone;\n }\n}\n\n// ---- naming ---------------------------------------------------------------\n\n/**\n * The place an IANA zone is named after: \"Europe/Copenhagen\" is Copenhagen,\n * \"America/Argentina/Buenos_Aires\" is Buenos Aires.\n *\n * These names are how the tz database identifies a zone, not a claim about\n * where the reader is, but they are a good deal more meaningful than \"UTC+2\"\n * on its own.\n */\nexport function zoneCity(timeZone: string): string {\n if (timeZone === UTC) return UTC;\n const segments = timeZone.split(\"/\");\n return (segments[segments.length - 1] ?? timeZone).replace(/_/g, \" \");\n}\n\n/** The part of the world a zone is filed under: \"Europe\", \"America\". */\nexport function zoneRegion(timeZone: string): string {\n if (timeZone === UTC) return UTC;\n return timeZone.split(\"/\")[0] ?? \"\";\n}\n\n/** \"Copenhagen (CEST, UTC+02:00)\" - the city, and why that clock. */\nexport function zoneLabel(timeZone: string, at: Date = new Date()): string {\n const offset = offsetLabel(zoneOffsetMs(at, timeZone));\n const abbreviation = zoneAbbreviation(at, timeZone);\n if (timeZone === UTC) return UTC;\n // Intl falls back to \"GMT+2\" when a zone has no letter abbreviation, which\n // would just repeat the offset.\n if (abbreviation.startsWith(\"GMT\") || abbreviation === offset) {\n return `${zoneCity(timeZone)} (${offset})`;\n }\n return `${zoneCity(timeZone)} (${abbreviation}, ${offset})`;\n}\n\n/** How a display zone is named in the UI, spelling out what \"local\" resolves to. */\nexport function describeDisplayZone(zone: DisplayZone, at: Date = new Date()): string {\n const resolved = resolveZone(zone);\n return isLocal(zone) ? `Local - ${zoneLabel(resolved, at)}` : zoneLabel(resolved, at);\n}\n\n/** The compact form used where there is no room, such as a column heading. */\nexport function shortZoneLabel(zone: DisplayZone, at: Date = new Date()): string {\n const resolved = resolveZone(zone);\n if (resolved === UTC) return UTC;\n const abbreviation = zoneAbbreviation(at, resolved);\n if (abbreviation.startsWith(\"GMT\")) return zoneCity(resolved);\n return abbreviation;\n}\n\n/** A longer description, for tooltips and the help page. */\nexport function explainDisplayZone(zone: DisplayZone, at: Date = new Date()): string {\n const resolved = resolveZone(zone);\n if (isLocal(zone)) {\n return `Times are shown in ${resolved}, your browser's timezone (${zoneLabel(resolved, at)}).`;\n }\n return `Times are shown in ${resolved} (${zoneLabel(resolved, at)}).`;\n}\n\n// ---- the zones on offer ---------------------------------------------------\n\n/**\n * The zones the display picker offers, grouped for an <optgroup>.\n *\n * This is a deliberately short list of well-known zones rather than all ~400\n * the tz database knows, because it is a \"show me this calendar in Tokyo time\"\n * control, not a data-entry field. The event form uses the full list, since an\n * organiser really might be anywhere.\n */\nexport const MAJOR_ZONES: { region: string; zones: string[] }[] = [\n { region: \"Coordinated\", zones: [UTC] },\n {\n region: \"Americas\",\n zones: [\n \"Pacific/Honolulu\",\n \"America/Anchorage\",\n \"America/Los_Angeles\",\n \"America/Denver\",\n \"America/Chicago\",\n \"America/New_York\",\n \"America/Halifax\",\n \"America/Bogota\",\n \"America/Sao_Paulo\",\n \"America/Argentina/Buenos_Aires\",\n ],\n },\n {\n region: \"Europe and Africa\",\n zones: [\n \"Europe/London\",\n \"Europe/Lisbon\",\n \"Europe/Paris\",\n \"Europe/Berlin\",\n \"Europe/Madrid\",\n \"Europe/Rome\",\n \"Europe/Stockholm\",\n \"Europe/Warsaw\",\n \"Europe/Athens\",\n \"Europe/Kyiv\",\n \"Europe/Moscow\",\n \"Africa/Casablanca\",\n \"Africa/Lagos\",\n \"Africa/Cairo\",\n \"Africa/Nairobi\",\n \"Africa/Johannesburg\",\n ],\n },\n {\n region: \"Asia\",\n zones: [\n \"Asia/Jerusalem\",\n \"Asia/Dubai\",\n \"Asia/Karachi\",\n \"Asia/Kolkata\",\n \"Asia/Kathmandu\",\n \"Asia/Dhaka\",\n \"Asia/Bangkok\",\n \"Asia/Jakarta\",\n \"Asia/Shanghai\",\n \"Asia/Hong_Kong\",\n \"Asia/Singapore\",\n \"Asia/Seoul\",\n \"Asia/Tokyo\",\n ],\n },\n {\n region: \"Oceania\",\n zones: [\n \"Australia/Perth\",\n \"Australia/Adelaide\",\n \"Australia/Brisbane\",\n \"Australia/Sydney\",\n \"Pacific/Auckland\",\n ],\n },\n];\n\n/** Every zone in MAJOR_ZONES, flattened. */\nexport function majorZones(): string[] {\n return MAJOR_ZONES.flatMap((group) => group.zones);\n}\n\n/** True if the string names a zone this browser can actually work with. */\nexport function isKnownZone(timeZone: string): boolean {\n if (!timeZone || timeZone === LOCAL) return false;\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * The zones to offer in the event form.\n *\n * Modern browsers can list every zone they know. Where they cannot, fall back\n * to the major list, with the browser's own zone added so it is always\n * selectable.\n */\nexport function zoneList(): string[] {\n const supported = (Intl as { supportedValuesOf?: (key: string) => string[] }).supportedValuesOf;\n let names: string[];\n try {\n names = supported ? supported(\"timeZone\") : majorZones();\n } catch {\n names = majorZones();\n }\n const all = new Set<string>([UTC, browserZone(), ...names]);\n return [...all].sort();\n}\n\n/**\n * Tidies a stored or configured display zone into one we can use.\n *\n * Accepts the \"local\"/\"utc\" spellings the two-way switch used to store, so an\n * existing preference survives the upgrade.\n */\nexport function normaliseZone(value: string | null | undefined, fallback: DisplayZone = UTC): DisplayZone {\n const text = (value ?? \"\").trim();\n if (!text) return fallback;\n if (text.toLowerCase() === LOCAL) return LOCAL;\n if (text.toLowerCase() === \"utc\") return UTC;\n return isKnownZone(text) ? text : fallback;\n}\n\n/**\n * Drops duplicates and anything already shown as the primary zone.\n *\n * \"local\" and the IANA name it resolves to are the same clock, so only one of\n * them is worth a column.\n */\nexport function uniqueZones(zones: DisplayZone[], primary?: DisplayZone): DisplayZone[] {\n const seen = new Set<string>(primary === undefined ? [] : [resolveZone(primary)]);\n const kept: DisplayZone[] = [];\n for (const zone of zones) {\n const resolved = resolveZone(zone);\n if (seen.has(resolved)) continue;\n seen.add(resolved);\n kept.push(zone);\n }\n return kept;\n}\n\n/**\n * The clock reading in `other` for each hour of `day` as measured in `primary`.\n *\n * This is what fills the extra hour gutters in the week and day views: row 9 of\n * the grid is 09:00 in the primary zone, and this says what that same instant\n * reads as somewhere else.\n *\n * A week view shares one gutter across all seven columns, so the caller passes\n * a single reference day. The offset between two zones almost never changes\n * mid-week; when it does, because one of them shifts for daylight saving, the\n * labels are right for the reference day and an hour out for the rest.\n */\nexport function hourLabels(day: Date, primary: DisplayZone, other: DisplayZone, hours = 24): string[] {\n return Array.from({ length: hours }, (_unused, hour) => {\n const wall = new Date(day);\n wall.setHours(hour, 0, 0, 0);\n return formatTime(toWall(fromWall(wall, primary), other));\n });\n}\n","/**\n * Turning a flat list of events into something a grid can draw.\n */\n\nimport type { CalendarEvent, Category } from \"./types\";\nimport { dayKey, endOfDay, parseISO, startOfDay } from \"./dates\";\nimport type { DisplayZone } from \"./timezone\";\nimport { toWall } from \"./timezone\";\n\n/**\n * The start of an event as a wall date in the display zone.\n *\n * All-day events are a date rather than an instant: the backend snaps them to\n * whole UTC days, so we rebuild them from their UTC date parts and they land on\n * the same calendar day whichever zone is being displayed.\n */\nexport function eventStart(event: CalendarEvent, zone: DisplayZone = \"local\"): Date {\n const instant = parseISO(event.start);\n if (!event.all_day) return toWall(instant, zone);\n return new Date(instant.getUTCFullYear(), instant.getUTCMonth(), instant.getUTCDate());\n}\n\n/**\n * The end of an event as a wall date in the display zone, exclusive.\n *\n * The backend stores an exclusive end for all-day events (midnight of the day\n * after), which is what a grid wants too.\n */\nexport function eventEnd(event: CalendarEvent, zone: DisplayZone = \"local\"): Date {\n const instant = parseISO(event.end);\n if (!event.all_day) return toWall(instant, zone);\n return new Date(instant.getUTCFullYear(), instant.getUTCMonth(), instant.getUTCDate());\n}\n\nexport function durationMs(event: CalendarEvent): number {\n // The length of an event is the same in every zone, so read it off the\n // instants directly.\n return Math.max(0, parseISO(event.end).getTime() - parseISO(event.start).getTime());\n}\n\n/** True if the event overlaps the half-open window [from, to) of wall dates. */\nexport function overlaps(event: CalendarEvent, from: Date, to: Date, zone: DisplayZone = \"local\"): boolean {\n return eventStart(event, zone) < to && eventEnd(event, zone) > from;\n}\n\n/** True if any part of the event falls on the given day. */\nexport function occursOnDay(event: CalendarEvent, day: Date, zone: DisplayZone = \"local\"): boolean {\n return overlaps(event, startOfDay(day), endOfDay(day), zone);\n}\n\n/** True if the event covers more than a single day in the grid. */\nexport function isMultiDay(event: CalendarEvent, zone: DisplayZone = \"local\"): boolean {\n const start = eventStart(event, zone);\n const end = eventEnd(event, zone);\n if (end.getTime() <= start.getTime()) return false;\n // The end is exclusive, so an event finishing exactly at midnight still\n // belongs to the day before.\n return dayKey(start) !== dayKey(new Date(end.getTime() - 1));\n}\n\n/** The events falling on each of `days`, keyed by dayKey(). */\nexport function groupByDay(\n events: CalendarEvent[],\n days: Date[],\n zone: DisplayZone = \"local\",\n): Map<string, CalendarEvent[]> {\n const buckets = new Map<string, CalendarEvent[]>();\n for (const day of days) buckets.set(dayKey(day), []);\n for (const event of events) {\n for (const day of days) {\n if (occursOnDay(event, day, zone)) buckets.get(dayKey(day))!.push(event);\n }\n }\n const order = displayComparator(zone);\n for (const bucket of buckets.values()) bucket.sort(order);\n return buckets;\n}\n\n/** All-day and longer events first, then by start time, then by title. */\nexport function compareForDisplay(a: CalendarEvent, b: CalendarEvent, zone: DisplayZone = \"local\"): number {\n if (a.all_day !== b.all_day) return a.all_day ? -1 : 1;\n const byStart = eventStart(a, zone).getTime() - eventStart(b, zone).getTime();\n if (byStart !== 0) return byStart;\n const byLength = durationMs(b) - durationMs(a);\n if (byLength !== 0) return byLength;\n return a.title.localeCompare(b.title);\n}\n\n/** compareForDisplay bound to a zone, ready to hand to Array.sort. */\nexport function displayComparator(zone: DisplayZone = \"local\") {\n return (a: CalendarEvent, b: CalendarEvent) => compareForDisplay(a, b, zone);\n}\n\nexport interface PositionedEvent {\n event: CalendarEvent;\n /** Fraction of the day the event starts at, 0 to 1. */\n top: number;\n /** Fraction of the day the event occupies, greater than 0. */\n height: number;\n /** Which column of an overlapping cluster this event sits in. */\n column: number;\n /** How many columns the cluster needs. */\n columns: number;\n}\n\nconst MINIMUM_HEIGHT = 20 / (24 * 60); // 20 minutes, so short events stay clickable\n\n/**\n * Lays out one day's timed events side by side.\n *\n * Events that overlap in time are grouped into a cluster and given a column\n * each, so the caller can position them as `left: column/columns` of the\n * day's width. All-day events are not included; they belong in their own row.\n */\nexport function layoutDay(events: CalendarEvent[], day: Date, zone: DisplayZone = \"local\"): PositionedEvent[] {\n const dayStart = startOfDay(day).getTime();\n const dayEnd = endOfDay(day).getTime();\n const span = dayEnd - dayStart;\n\n const timed = events\n .filter((event) => !event.all_day && occursOnDay(event, day, zone))\n .sort(displayComparator(zone));\n\n const placed: PositionedEvent[] = timed.map((event) => {\n const from = Math.max(eventStart(event, zone).getTime(), dayStart);\n const to = Math.min(eventEnd(event, zone).getTime(), dayEnd);\n return {\n event,\n top: (from - dayStart) / span,\n height: Math.max((to - from) / span, MINIMUM_HEIGHT),\n column: 0,\n columns: 1,\n };\n });\n\n // Walk the events in order, closing a cluster whenever a gap appears.\n let cluster: PositionedEvent[] = [];\n let clusterEnd = -Infinity;\n\n const closeCluster = () => {\n if (cluster.length === 0) return;\n const columns = Math.max(...cluster.map((item) => item.column)) + 1;\n for (const item of cluster) item.columns = columns;\n cluster = [];\n clusterEnd = -Infinity;\n };\n\n for (const item of placed) {\n if (item.top >= clusterEnd) closeCluster();\n // The lowest column not used by anything this event overlaps.\n const taken = new Set(\n cluster.filter((other) => other.top + other.height > item.top).map((other) => other.column),\n );\n let column = 0;\n while (taken.has(column)) column += 1;\n item.column = column;\n cluster.push(item);\n clusterEnd = Math.max(clusterEnd, item.top + item.height);\n }\n closeCluster();\n\n return placed;\n}\n\n/** The all-day (or multi-day) events on a given day. */\nexport function allDayEvents(events: CalendarEvent[], day: Date, zone: DisplayZone = \"local\"): CalendarEvent[] {\n return events\n .filter((event) => event.all_day && occursOnDay(event, day, zone))\n .sort(displayComparator(zone));\n}\n\n/** Groups a sorted list into day sections, for the agenda view. */\nexport function agendaSections(\n events: CalendarEvent[],\n zone: DisplayZone = \"local\",\n): { key: string; date: Date; events: CalendarEvent[] }[] {\n const sections: { key: string; date: Date; events: CalendarEvent[] }[] = [];\n const seen = new Map<string, CalendarEvent[]>();\n for (const event of events) {\n const date = eventStart(event, zone);\n const key = dayKey(date);\n let bucket = seen.get(key);\n if (!bucket) {\n bucket = [];\n seen.set(key, bucket);\n sections.push({ key, date: startOfDay(date), events: bucket });\n }\n bucket.push(event);\n }\n return sections;\n}\n\n// ---- presentation ---------------------------------------------------------\n\n/** A short label for the calendar an event belongs to. */\nexport function calendarLabel(event: CalendarEvent): string {\n if (event.category === \"project\") return event.project ?? \"project\";\n if (event.category === \"foundation\") return \"foundation\";\n return \"personal\";\n}\n\nconst PROJECT_HUES = [8, 28, 48, 96, 150, 176, 200, 220, 256, 286, 310, 335];\n\n/**\n * A stable hue for a project, so the same project keeps its colour between\n * sessions and machines without us having to store one.\n */\nexport function projectHue(name: string): number {\n let hash = 0;\n for (let index = 0; index < name.length; index += 1) {\n hash = (hash * 31 + name.charCodeAt(index)) >>> 0;\n }\n return PROJECT_HUES[hash % PROJECT_HUES.length];\n}\n\n/** The CSS custom-property value used to tint an event chip. */\nexport function eventHue(event: CalendarEvent): number {\n if (event.category === \"personal\") return 265;\n if (event.category === \"foundation\") return 0;\n return projectHue(event.project ?? \"\");\n}\n\nexport function categoryLabel(category: Category): string {\n switch (category) {\n case \"personal\":\n return \"Personal\";\n case \"project\":\n return \"Project\";\n case \"foundation\":\n return \"Foundation\";\n }\n}\n","/**\n * Client-side filtering and sorting.\n *\n * The backend already restricts what a session may see; these filters are\n * about what the user wants to look at right now.\n */\n\nimport type { CalendarEvent, Calendars, Category, Filters, SortName } from \"./types\";\nimport { CATEGORIES } from \"./types\";\nimport { displayComparator, eventStart } from \"./events\";\nimport type { DisplayZone } from \"./timezone\";\n\n/**\n * The filter state a freshly loaded page starts with.\n *\n * When logged in, everything the user can reach is on: their own events, every\n * project they belong to, and the foundation calendar. That matches the way\n * people use a calendar - they want to see their week, not configure it first.\n */\nexport function defaultFilters(calendars: Calendars | null): Filters {\n return {\n categories: new Set<Category>(CATEGORIES),\n projects: new Set<string>(calendars?.projects ?? []),\n visibility: \"all\",\n search: \"\",\n sort: \"start\",\n };\n}\n\n/** True if the filters are letting everything through. */\nexport function isUnfiltered(filters: Filters, calendars: Calendars | null): boolean {\n const projects = calendars?.projects ?? [];\n return (\n filters.categories.size === CATEGORIES.length &&\n filters.projects.size === projects.length &&\n filters.visibility === \"all\" &&\n filters.search.trim() === \"\"\n );\n}\n\n/**\n * Whether a single event passes the current filters.\n *\n * The project filter only applies to project events; it would be surprising if\n * unticking a project also hid the foundation calendar. An event belonging to\n * a project the user is not a member of (a public one they can still see) is\n * shown whenever the project filter has not been narrowed.\n */\nexport function matches(event: CalendarEvent, filters: Filters, knownProjects: readonly string[] = []): boolean {\n if (!filters.categories.has(event.category)) return false;\n\n if (event.category === \"project\") {\n const project = event.project ?? \"\";\n const isKnown = knownProjects.includes(project);\n if (isKnown && !filters.projects.has(project)) return false;\n }\n\n if (filters.visibility !== \"all\" && event.visibility !== filters.visibility) return false;\n\n const needle = filters.search.trim().toLowerCase();\n if (needle) {\n const haystack = [event.title, event.description, event.location, event.project ?? \"\"]\n .join(\" \")\n .toLowerCase();\n if (!haystack.includes(needle)) return false;\n }\n\n return true;\n}\n\nexport function applyFilters(\n events: CalendarEvent[],\n filters: Filters,\n knownProjects: readonly string[] = [],\n): CalendarEvent[] {\n return events.filter((event) => matches(event, filters, knownProjects));\n}\n\nexport function sortEvents(\n events: CalendarEvent[],\n sort: SortName,\n zone: DisplayZone = \"local\",\n): CalendarEvent[] {\n const sorted = [...events];\n switch (sort) {\n case \"-start\":\n sorted.sort((a, b) => eventStart(b, zone).getTime() - eventStart(a, zone).getTime());\n break;\n case \"title\":\n sorted.sort((a, b) => a.title.localeCompare(b.title));\n break;\n case \"-title\":\n sorted.sort((a, b) => b.title.localeCompare(a.title));\n break;\n case \"start\":\n default:\n sorted.sort(displayComparator(zone));\n break;\n }\n return sorted;\n}\n\n/** Every project mentioned by the loaded events, plus the user's own. */\nexport function projectsInPlay(events: CalendarEvent[], calendars: Calendars | null): string[] {\n const names = new Set<string>(calendars?.projects ?? []);\n for (const event of events) {\n if (event.category === \"project\" && event.project) names.add(event.project);\n }\n return [...names].sort();\n}\n\n/** Toggles a value in a Set, returning a new Set so Svelte notices. */\nexport function toggle<T>(values: Set<T>, value: T): Set<T> {\n const next = new Set(values);\n if (next.has(value)) next.delete(value);\n else next.add(value);\n return next;\n}\n","/**\n * Building and checking event drafts.\n *\n * `canEdit` mirrors the backend's permission rules. It only decides whether to\n * show an Edit button; the backend is still the authority and will refuse a\n * request the rules do not allow.\n */\n\nimport type { CalendarEvent, Calendars, Category, EventDraft, Visibility } from \"./types\";\nimport { HOUR, startOfDay, toISO } from \"./dates\";\nimport { browserZone } from \"./timezone\";\n\n/** The default length of a new timed event. */\nexport const DEFAULT_LENGTH_MS = HOUR;\n\n/** The first calendar the user can actually write to. */\nexport function defaultCategory(calendars: Calendars | null): Category | null {\n const can = calendars?.can_create;\n if (!can) return null;\n if (can.project.length > 0) return \"project\";\n if (can.personal) return \"personal\";\n if (can.foundation) return \"foundation\";\n return null;\n}\n\nexport function canCreateAnything(calendars: Calendars | null): boolean {\n return defaultCategory(calendars) !== null;\n}\n\n/**\n * A blank draft starting at `when`.\n *\n * If `when` is midnight (the user clicked a day rather than a time slot) the\n * event is nudged to 09:00, which is a more useful default than \"all day at\n * the stroke of midnight\".\n */\nexport function newDraft(when: Date, calendars: Calendars | null, timezone?: string): EventDraft {\n const category = defaultCategory(calendars) ?? \"personal\";\n const start = new Date(when);\n if (start.getTime() === startOfDay(when).getTime()) start.setHours(9, 0, 0, 0);\n\n return {\n title: \"\",\n category,\n visibility: category === \"personal\" ? \"private\" : \"public\",\n start: toISO(start),\n end: toISO(new Date(start.getTime() + DEFAULT_LENGTH_MS)),\n all_day: false,\n description: \"\",\n location: \"\",\n url: \"\",\n project: category === \"project\" ? (calendars?.can_create.project[0] ?? null) : null,\n // New events are entered in the organiser's own timezone by default.\n timezone: timezone ?? browserZone(),\n };\n}\n\nexport function draftFromEvent(event: CalendarEvent): EventDraft {\n return {\n title: event.title,\n category: event.category,\n visibility: event.visibility,\n start: event.start,\n end: event.end,\n all_day: event.all_day,\n description: event.description,\n location: event.location,\n url: event.url,\n project: event.project,\n timezone: event.timezone || \"UTC\",\n };\n}\n\n/** Whether the signed-in user may edit or delete this event. */\nexport function canEdit(event: CalendarEvent, calendars: Calendars | null): boolean {\n if (!calendars?.authenticated) return false;\n\n switch (event.category) {\n case \"personal\":\n return event.owner === calendars.uid;\n case \"foundation\":\n return calendars.is_member;\n case \"project\": {\n const project = event.project ?? \"\";\n if (!project) return false;\n if (event.visibility === \"private\") return calendars.committees.includes(project);\n return calendars.projects.includes(project);\n }\n }\n}\n\n/** Whether the visibility can be offered for a category the user may write. */\nexport function allowedVisibilities(category: Category, calendars: Calendars | null): Visibility[] {\n if (category === \"personal\") return [\"private\"];\n if (category === \"foundation\") return calendars?.can_create.foundation ? [\"public\", \"private\"] : [];\n return (calendars?.can_create.project_private.length ?? 0) > 0 ? [\"public\", \"private\"] : [\"public\"];\n}\n","<script lang=\"ts\">\n import type { DisplayZone } from \"../lib/timezone\";\n import {\n LOCAL,\n MAJOR_ZONES,\n browserZone,\n explainDisplayZone,\n isLocal,\n shortZoneLabel,\n zoneLabel,\n } from \"../lib/timezone\";\n\n interface Props {\n /** The zone the calendar is drawn in. */\n zone: DisplayZone;\n /** The zone the picker is set to, used when switching away from local. */\n alternate: DisplayZone;\n onzone: (zone: DisplayZone) => void;\n onalternate: (zone: DisplayZone) => void;\n }\n\n let { zone, alternate, onzone, onalternate }: Props = $props();\n\n // Recomputed on every render, which is often enough: the labels only change\n // when a zone crosses a daylight-saving boundary.\n let now = $derived(new Date());\n let local = $derived(browserZone());\n let localLabel = $derived(zoneLabel(local, now));\n\n function pick(chosen: string) {\n onalternate(chosen);\n onzone(chosen);\n }\n</script>\n\n<div class=\"zones\" role=\"group\" aria-label=\"Display timezone\">\n <button\n type=\"button\"\n class=\"zone\"\n class:active={isLocal(zone)}\n aria-pressed={isLocal(zone)}\n title={explainDisplayZone(LOCAL, now)}\n onclick={() => onzone(LOCAL)}\n >\n <span class=\"lead\">Local</span>\n <span class=\"detail\">{localLabel}</span>\n </button>\n\n <label class=\"zone select\" class:active={!isLocal(zone)} title={explainDisplayZone(alternate, now)}>\n <select\n aria-label=\"Show the calendar in another timezone\"\n value={alternate}\n onchange={(event) => pick(event.currentTarget.value)}\n onclick={() => {\n if (isLocal(zone)) onzone(alternate);\n }}\n >\n {#each MAJOR_ZONES as group (group.region)}\n <optgroup label={group.region}>\n {#each group.zones as name (name)}\n <option value={name}>{zoneLabel(name, now)}</option>\n {/each}\n </optgroup>\n {/each}\n </select>\n <span class=\"badge\" aria-hidden=\"true\">{shortZoneLabel(alternate, now)}</span>\n </label>\n</div>\n\n<style>\n .zones {\n display: flex;\n align-items: stretch;\n border: 1px solid var(--border-strong);\n border-radius: var(--radius);\n overflow: hidden;\n }\n\n .zone {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 0;\n background: var(--bg-panel);\n border: 0;\n border-right: 1px solid var(--border);\n padding: 0.15rem 0.6rem;\n font-size: 12px;\n line-height: 1.25;\n text-align: left;\n white-space: nowrap;\n }\n\n .zone:last-child {\n border-right: 0;\n }\n\n .zone:hover {\n background: var(--bg-hover);\n }\n\n .zone.active {\n background: var(--bg-subtle);\n box-shadow: inset 0 -2px 0 var(--asf-red);\n }\n\n .lead {\n font-weight: 700;\n }\n\n .zone.active .lead {\n color: var(--asf-red);\n }\n\n .detail {\n color: var(--text-muted);\n font-size: 11px;\n max-width: 14rem;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n /* The select sits on top of the label so the whole cell is the hit area,\n while the badge underneath shows the short name in our own styling. */\n .zone.select {\n position: relative;\n cursor: pointer;\n justify-content: center;\n }\n\n .zone.select select {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n border: 0;\n padding: 0;\n cursor: pointer;\n }\n\n .badge {\n font-weight: 700;\n font-variant-numeric: tabular-nums;\n }\n\n .zone.select.active .badge {\n color: var(--asf-red);\n }\n\n .badge::after {\n content: \" \\25BE\";\n font-weight: 400;\n color: var(--text-muted);\n }\n</style>\n","<script lang=\"ts\">\n import type { SessionInfo, ViewName } from \"../lib/types\";\n import { VIEWS } from \"../lib/types\";\n import { formatViewTitle } from \"../lib/dates\";\n import type { DisplayZone } from \"../lib/timezone\";\n import { assetUrl, loginUrl, logoutUrl } from \"../lib/base\";\n import TimezoneSwitch from \"./TimezoneSwitch.svelte\";\n\n interface Props {\n title: string;\n view: ViewName;\n cursor: Date;\n session: SessionInfo | null;\n loading: boolean;\n canCreate: boolean;\n zone: DisplayZone;\n /** The zone the picker is parked on, used when switching away from local. */\n alternateZone: DisplayZone;\n helpOpen: boolean;\n docsOpen: boolean;\n onview: (view: ViewName) => void;\n onstep: (direction: number) => void;\n ontoday: () => void;\n oncreate: () => void;\n onimport: () => void;\n ontogglefilters: () => void;\n onzone: (zone: DisplayZone) => void;\n onalternatezone: (zone: DisplayZone) => void;\n onhelp: () => void;\n ondocs: () => void;\n }\n\n let {\n title,\n view,\n cursor,\n session,\n loading,\n canCreate,\n zone,\n alternateZone,\n helpOpen,\n docsOpen,\n onview,\n onstep,\n ontoday,\n oncreate,\n onimport,\n ontogglefilters,\n onzone,\n onalternatezone,\n onhelp,\n ondocs,\n }: Props = $props();\n\n let heading = $derived(formatViewTitle(view, cursor));\n</script>\n\n<header>\n <div class=\"brand\">\n <button type=\"button\" class=\"filters-toggle\" onclick={ontogglefilters} aria-label=\"Toggle filters\">\n ☰\n </button>\n <img src={assetUrl(\"icon.png\")} alt=\"\" width=\"28\" height=\"28\" />\n <h1>{title}</h1>\n </div>\n\n <div class=\"nav\">\n <button type=\"button\" class=\"btn\" onclick={ontoday}>Today</button>\n <div class=\"stepper\">\n <button type=\"button\" class=\"btn\" onclick={() => onstep(-1)} aria-label=\"Previous\">‹</button>\n <button type=\"button\" class=\"btn\" onclick={() => onstep(1)} aria-label=\"Next\">›</button>\n </div>\n <h2 aria-live=\"polite\">{heading}</h2>\n {#if loading}\n <span class=\"spinner\" role=\"status\" aria-label=\"Loading\"></span>\n {/if}\n </div>\n\n <div class=\"views\" role=\"tablist\" aria-label=\"Calendar view\">\n {#each VIEWS as name (name)}\n <button\n type=\"button\"\n role=\"tab\"\n class=\"view\"\n class:active={view === name}\n aria-selected={view === name}\n onclick={() => onview(name)}\n >\n {name}\n </button>\n {/each}\n </div>\n\n <TimezoneSwitch {zone} alternate={alternateZone} {onzone} onalternate={onalternatezone} />\n\n <div class=\"account\">\n <button type=\"button\" class=\"btn\" class:active={helpOpen} onclick={onhelp}>Help</button>\n <button type=\"button\" class=\"btn\" class:active={docsOpen} onclick={ondocs} title=\"HTTP API documentation\">\n API\n </button>\n {#if canCreate}\n <button type=\"button\" class=\"btn\" onclick={onimport} title=\"Import events from an .ics file\">\n Import\n </button>\n <button type=\"button\" class=\"btn primary\" onclick={oncreate}>New event</button>\n {/if}\n {#if session?.authenticated}\n <span class=\"who\" title={session.email ?? \"\"}>{session.fullname || session.uid}</span>\n <a class=\"btn\" href={session.logout_url ?? logoutUrl()}>Log out</a>\n {:else}\n <a class=\"btn primary\" href={session?.login_url ?? loginUrl()}>Log in</a>\n {/if}\n </div>\n</header>\n\n<style>\n header {\n display: flex;\n align-items: center;\n gap: 1rem;\n flex-wrap: wrap;\n padding: 0.5rem 0.9rem;\n background: var(--bg-panel);\n border-bottom: 1px solid var(--border);\n box-shadow: var(--shadow);\n z-index: 5;\n }\n\n .brand {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n }\n\n .brand img {\n border-radius: 4px;\n }\n\n h1 {\n margin: 0;\n font-size: 15px;\n font-weight: 700;\n white-space: nowrap;\n }\n\n h2 {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n white-space: nowrap;\n }\n\n .nav {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n }\n\n .stepper {\n display: flex;\n }\n\n .stepper .btn:first-child {\n border-radius: var(--radius) 0 0 var(--radius);\n }\n\n .stepper .btn:last-child {\n border-radius: 0 var(--radius) var(--radius) 0;\n margin-left: -1px;\n }\n\n .views {\n display: flex;\n border: 1px solid var(--border-strong);\n border-radius: var(--radius);\n overflow: hidden;\n }\n\n .view {\n background: var(--bg-panel);\n border: 0;\n border-right: 1px solid var(--border);\n padding: 0.35rem 0.7rem;\n text-transform: capitalize;\n font-size: 13px;\n }\n\n .view:last-child {\n border-right: 0;\n }\n\n .view:hover {\n background: var(--bg-hover);\n }\n\n .view.active {\n background: var(--asf-red);\n color: #fff;\n font-weight: 600;\n }\n\n .btn.active {\n background: var(--bg-subtle);\n box-shadow: inset 0 -2px 0 var(--asf-red);\n }\n\n .account {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin-left: auto;\n }\n\n .who {\n font-size: 13px;\n color: var(--text-muted);\n max-width: 12rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .filters-toggle {\n display: none;\n background: none;\n border: 0;\n font-size: 18px;\n padding: 0 0.3rem;\n }\n\n .spinner {\n width: 14px;\n height: 14px;\n border: 2px solid var(--border-strong);\n border-top-color: var(--asf-red);\n border-radius: 999px;\n animation: spin 0.7s linear infinite;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n @media (max-width: 60rem) {\n .filters-toggle {\n display: block;\n }\n\n .account {\n width: 100%;\n margin-left: 0;\n }\n }\n</style>\n","<script lang=\"ts\">\n import type { Calendars, Category, Filters, SortName, ViewName } from \"../lib/types\";\n import { CATEGORIES } from \"../lib/types\";\n import { categoryLabel, projectHue } from \"../lib/events\";\n import { toggle } from \"../lib/filters\";\n import type { DisplayZone } from \"../lib/timezone\";\n import { LOCAL, MAJOR_ZONES, browserZone, describeDisplayZone, resolveZone, zoneLabel } from \"../lib/timezone\";\n\n interface Props {\n filters: Filters;\n calendars: Calendars | null;\n projects: string[];\n view: ViewName;\n feedUrl: string;\n /** The zone the calendar is drawn in, set from the header. */\n zone: DisplayZone;\n /** Extra clocks shown beside it. */\n compareZones: DisplayZone[];\n /** How many comparison clocks the layout can take. */\n maxCompareZones?: number;\n onchange: (filters: Filters) => void;\n oncomparezones: (zones: DisplayZone[]) => void;\n }\n\n let {\n filters,\n calendars,\n projects,\n view,\n feedUrl,\n zone,\n compareZones,\n maxCompareZones = 3,\n onchange,\n oncomparezones,\n }: Props = $props();\n\n function setCategory(category: Category) {\n onchange({ ...filters, categories: toggle(filters.categories, category) });\n }\n\n function setProject(project: string) {\n onchange({ ...filters, projects: toggle(filters.projects, project) });\n }\n\n function allProjects(on: boolean) {\n onchange({ ...filters, projects: new Set(on ? projects : []) });\n }\n\n let now = $derived(new Date());\n // A clock already on screen as the primary zone is not worth offering again.\n let alreadyShown = $derived(new Set([resolveZone(zone), ...compareZones.map(resolveZone)]));\n let canAddMore = $derived(compareZones.length < maxCompareZones);\n\n function addCompareZone(chosen: string) {\n if (!chosen || alreadyShown.has(resolveZone(chosen))) return;\n oncomparezones([...compareZones, chosen]);\n }\n\n function removeCompareZone(chosen: DisplayZone) {\n oncomparezones(compareZones.filter((candidate) => candidate !== chosen));\n }\n</script>\n\n<aside>\n <label class=\"search\">\n <span class=\"visually-hidden\">Search events</span>\n <input\n type=\"search\"\n placeholder=\"Search events...\"\n value={filters.search}\n oninput={(event) => onchange({ ...filters, search: event.currentTarget.value })}\n />\n </label>\n\n <section>\n <h3>Calendars</h3>\n {#each CATEGORIES as category (category)}\n <label class=\"check\">\n <input\n type=\"checkbox\"\n checked={filters.categories.has(category)}\n onchange={() => setCategory(category)}\n />\n <span class=\"swatch\" style=\"--hue: {category === 'personal' ? 265 : category === 'foundation' ? 0 : 210}\"\n ></span>\n {categoryLabel(category)}\n </label>\n {/each}\n </section>\n\n {#if projects.length > 0}\n <section>\n <h3>\n Projects\n <span class=\"bulk\">\n <button type=\"button\" onclick={() => allProjects(true)}>all</button>\n <button type=\"button\" onclick={() => allProjects(false)}>none</button>\n </span>\n </h3>\n <div class=\"projects\">\n {#each projects as project (project)}\n <label class=\"check\">\n <input\n type=\"checkbox\"\n checked={filters.projects.has(project)}\n onchange={() => setProject(project)}\n />\n <span class=\"swatch\" style=\"--hue: {projectHue(project)}\"></span>\n {project}\n {#if calendars?.committees.includes(project)}\n <span class=\"role\" title=\"You are on this committee\">PMC</span>\n {/if}\n </label>\n {/each}\n </div>\n </section>\n {/if}\n\n <section>\n <h3>Visibility</h3>\n <label class=\"field\">\n <select\n value={filters.visibility}\n onchange={(event) =>\n onchange({ ...filters, visibility: event.currentTarget.value as Filters[\"visibility\"] })}\n >\n <option value=\"all\">Everything I can see</option>\n <option value=\"public\">Public only</option>\n <option value=\"private\">Private only</option>\n </select>\n </label>\n </section>\n\n {#if view === \"agenda\"}\n <section>\n <h3>Sort</h3>\n <label class=\"field\">\n <select\n value={filters.sort}\n onchange={(event) => onchange({ ...filters, sort: event.currentTarget.value as SortName })}\n >\n <option value=\"start\">Soonest first</option>\n <option value=\"-start\">Latest first</option>\n <option value=\"title\">Title A-Z</option>\n <option value=\"-title\">Title Z-A</option>\n </select>\n </label>\n </section>\n {/if}\n\n <section class=\"timezones\">\n <h3>Timezones</h3>\n <p class=\"muted\">\n Drawn in <strong>{describeDisplayZone(zone, now)}</strong>, which you can change at the top of\n the page.\n </p>\n\n {#if compareZones.length > 0}\n <ul class=\"chips\">\n {#each compareZones as other (other)}\n <li>\n <span title={zoneLabel(resolveZone(other), now)}>{describeDisplayZone(other, now)}</span>\n <button\n type=\"button\"\n onclick={() => removeCompareZone(other)}\n aria-label={`Stop showing ${resolveZone(other)}`}\n >\n ×\n </button>\n </li>\n {/each}\n </ul>\n {/if}\n\n {#if canAddMore}\n <label class=\"field\">\n <span class=\"visually-hidden\">Also show another timezone</span>\n <select\n value=\"\"\n onchange={(event) => {\n addCompareZone(event.currentTarget.value);\n event.currentTarget.value = \"\";\n }}\n >\n <option value=\"\">Also show...</option>\n {#if !alreadyShown.has(browserZone())}\n <option value={LOCAL}>Local - {zoneLabel(browserZone(), now)}</option>\n {/if}\n {#each MAJOR_ZONES as group (group.region)}\n <optgroup label={group.region}>\n {#each group.zones.filter((name) => !alreadyShown.has(name)) as name (name)}\n <option value={name}>{zoneLabel(name, now)}</option>\n {/each}\n </optgroup>\n {/each}\n </select>\n </label>\n {/if}\n\n <p class=\"muted small\">\n Comparison clocks appear beside the week and day grids, on agenda rows, and in an event's\n details.\n </p>\n </section>\n\n <section class=\"subscribe\">\n <h3>Subscribe</h3>\n <p class=\"muted\">\n Add the events you can see to your own calendar application with this iCalendar feed.\n </p>\n <a class=\"btn\" href={feedUrl}>Download .ics</a>\n </section>\n</aside>\n\n<style>\n aside {\n width: 15rem;\n flex: none;\n padding: 0.9rem;\n overflow-y: auto;\n background: var(--bg-panel);\n border-right: 1px solid var(--border);\n }\n\n .search input {\n width: 100%;\n }\n\n section {\n margin-top: 1.1rem;\n }\n\n h3 {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n margin: 0 0 0.4rem;\n font-size: 11px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.06em;\n color: var(--text-muted);\n }\n\n .bulk button {\n background: none;\n border: 0;\n padding: 0 0.2rem;\n font-size: 11px;\n color: var(--asf-red);\n text-transform: none;\n letter-spacing: 0;\n }\n\n .bulk button:hover {\n text-decoration: underline;\n }\n\n .check {\n display: flex;\n align-items: center;\n gap: 0.45rem;\n padding: 0.12rem 0;\n cursor: pointer;\n font-size: 13px;\n overflow: hidden;\n }\n\n .check:hover {\n color: var(--asf-red);\n }\n\n .swatch {\n width: 10px;\n height: 10px;\n flex: none;\n border-radius: 3px;\n background: hsl(var(--hue) 60% 55%);\n }\n\n .projects {\n max-height: 16rem;\n overflow-y: auto;\n }\n\n .role {\n margin-left: auto;\n font-size: 9px;\n font-weight: 700;\n letter-spacing: 0.04em;\n color: var(--text-faint);\n border: 1px solid var(--border);\n border-radius: 3px;\n padding: 0 3px;\n }\n\n .field select {\n width: 100%;\n }\n\n .subscribe p {\n margin: 0 0 0.5rem;\n font-size: 12px;\n }\n\n .timezones p {\n margin: 0 0 0.5rem;\n font-size: 12px;\n }\n\n .timezones .small {\n margin: 0.5rem 0 0;\n font-size: 11px;\n }\n\n .chips {\n list-style: none;\n margin: 0 0 0.5rem;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 3px;\n }\n\n .chips li {\n display: flex;\n align-items: center;\n gap: 0.3rem;\n font-size: 12px;\n background: var(--bg-subtle);\n border: 1px solid var(--border);\n border-radius: var(--radius);\n padding: 0.1rem 0.2rem 0.1rem 0.45rem;\n }\n\n .chips li span {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .chips button {\n background: none;\n border: 0;\n padding: 0 0.3rem;\n font-size: 14px;\n line-height: 1;\n color: var(--text-muted);\n }\n\n .chips button:hover {\n color: var(--asf-red);\n }\n</style>\n","<script lang=\"ts\">\n import type { CalendarEvent } from \"../lib/types\";\n import { calendarLabel, eventHue, eventStart } from \"../lib/events\";\n import { formatTime } from \"../lib/dates\";\n import type { DisplayZone } from \"../lib/timezone\";\n\n interface Props {\n event: CalendarEvent;\n /** \"chip\" is the compact form used in month cells and the year view. */\n variant?: \"chip\" | \"block\" | \"row\";\n showTime?: boolean;\n zone?: DisplayZone;\n onselect: (event: CalendarEvent) => void;\n }\n\n let { event, variant = \"chip\", showTime = true, zone = \"local\", onselect }: Props = $props();\n\n let hue = $derived(eventHue(event));\n let time = $derived(event.all_day ? \"All day\" : formatTime(eventStart(event, zone)));\n let label = $derived(calendarLabel(event));\n</script>\n\n<button\n type=\"button\"\n class=\"chip {variant}\"\n class:private={event.visibility === \"private\"}\n style=\"--hue: {hue}\"\n title=\"{event.title} - {label}{event.location ? ` - ${event.location}` : ''}\"\n onclick={(mouseEvent) => {\n mouseEvent.stopPropagation();\n onselect(event);\n }}\n>\n {#if showTime}\n <span class=\"time\">{time}</span>\n {/if}\n <span class=\"title\">{event.title}</span>\n {#if event.visibility === \"private\"}\n <span class=\"lock\" aria-label=\"Private event\">🔒</span>\n {/if}\n</button>\n\n<style>\n .chip {\n display: flex;\n align-items: baseline;\n gap: 0.3rem;\n width: 100%;\n text-align: left;\n background: var(--chip-bg);\n color: var(--chip-text);\n border: 1px solid var(--chip-border);\n border-left-width: 3px;\n border-radius: 4px;\n padding: 1px 4px;\n font-size: 12px;\n line-height: 1.35;\n overflow: hidden;\n }\n\n .chip:hover {\n filter: brightness(0.96);\n }\n\n .chip.private {\n border-style: dashed;\n border-left-style: solid;\n }\n\n .time {\n font-variant-numeric: tabular-nums;\n opacity: 0.75;\n flex: none;\n }\n\n .title {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .lock {\n margin-left: auto;\n font-size: 10px;\n flex: none;\n }\n\n .chip.block {\n flex-direction: column;\n align-items: stretch;\n gap: 0;\n height: 100%;\n padding: 2px 4px;\n white-space: normal;\n }\n\n .chip.block .title {\n white-space: normal;\n font-weight: 600;\n }\n\n .chip.row {\n padding: 0.4rem 0.6rem;\n font-size: 13px;\n border-left-width: 4px;\n }\n</style>\n","<script lang=\"ts\">\n import type { CalendarEvent } from \"../lib/types\";\n import { MONTH_NAMES, WEEKDAY_NAMES, dayKey, isToday, isWeekend, monthGrid } from \"../lib/dates\";\n import { groupByDay } from \"../lib/events\";\n import type { DisplayZone } from \"../lib/timezone\";\n import { nowInZone } from \"../lib/timezone\";\n import EventChip from \"./EventChip.svelte\";\n\n interface Props {\n cursor: Date;\n events: CalendarEvent[];\n zone?: DisplayZone;\n onselect: (event: CalendarEvent) => void;\n onpickday: (day: Date) => void;\n }\n\n let { cursor, events, zone = \"local\", onselect, onpickday }: Props = $props();\n\n let now = $derived(nowInZone(zone));\n\n /** How many chips fit in a cell before we collapse the rest into \"+n more\". */\n const VISIBLE_PER_DAY = 3;\n\n let days = $derived(monthGrid(cursor));\n let buckets = $derived(groupByDay(events, days, zone));\n let month = $derived(cursor.getMonth());\n</script>\n\n<div class=\"month\">\n <div class=\"weekdays\" role=\"row\">\n {#each WEEKDAY_NAMES as name (name)}\n <div class=\"weekday\" role=\"columnheader\">{name}</div>\n {/each}\n </div>\n\n <div class=\"grid\">\n {#each days as day (dayKey(day))}\n {@const key = dayKey(day)}\n {@const dayEvents = buckets.get(key) ?? []}\n <div\n class=\"cell\"\n class:other-month={day.getMonth() !== month}\n class:weekend={isWeekend(day)}\n class:today={isToday(day, now)}\n >\n <button type=\"button\" class=\"daynumber\" onclick={() => onpickday(day)}>\n {#if day.getDate() === 1}\n <span class=\"monthname\">{MONTH_NAMES[day.getMonth()].slice(0, 3)}</span>\n {/if}\n {day.getDate()}\n </button>\n\n <div class=\"events\">\n {#each dayEvents.slice(0, VISIBLE_PER_DAY) as event (event.id)}\n <EventChip {event} {zone} {onselect} />\n {/each}\n {#if dayEvents.length > VISIBLE_PER_DAY}\n <button type=\"button\" class=\"more\" onclick={() => onpickday(day)}>\n +{dayEvents.length - VISIBLE_PER_DAY} more\n </button>\n {/if}\n </div>\n </div>\n {/each}\n </div>\n</div>\n\n<style>\n .month {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n }\n\n .weekdays,\n .grid {\n display: grid;\n grid-template-columns: repeat(7, minmax(0, 1fr));\n }\n\n .weekday {\n padding: 0.4rem 0.5rem;\n font-size: 12px;\n font-weight: 600;\n color: var(--text-muted);\n text-transform: uppercase;\n letter-spacing: 0.04em;\n border-bottom: 1px solid var(--border);\n }\n\n .grid {\n flex: 1;\n grid-auto-rows: minmax(5.5rem, 1fr);\n min-height: 0;\n border-left: 1px solid var(--border);\n border-top: 1px solid var(--border);\n }\n\n .cell {\n display: flex;\n flex-direction: column;\n gap: 2px;\n min-width: 0;\n padding: 2px;\n background: var(--bg-panel);\n border-right: 1px solid var(--border);\n border-bottom: 1px solid var(--border);\n overflow: hidden;\n }\n\n .cell.weekend {\n background: var(--bg-subtle);\n }\n\n .cell.other-month {\n opacity: 0.55;\n }\n\n .cell.today {\n background: var(--today);\n }\n\n .daynumber {\n align-self: flex-start;\n display: flex;\n gap: 0.25rem;\n align-items: baseline;\n background: none;\n border: 0;\n padding: 1px 5px;\n border-radius: 999px;\n font-size: 12px;\n font-variant-numeric: tabular-nums;\n color: var(--text-muted);\n }\n\n .daynumber:hover {\n background: var(--bg-hover);\n color: var(--text);\n }\n\n .today .daynumber {\n background: var(--asf-red);\n color: #fff;\n font-weight: 700;\n }\n\n .monthname {\n font-weight: 700;\n text-transform: uppercase;\n font-size: 10px;\n }\n\n .events {\n display: flex;\n flex-direction: column;\n gap: 2px;\n overflow: hidden;\n }\n\n .more {\n background: none;\n border: 0;\n padding: 0 4px;\n text-align: left;\n font-size: 11px;\n color: var(--text-muted);\n }\n\n .more:hover {\n color: var(--text);\n text-decoration: underline;\n }\n</style>\n","<script lang=\"ts\">\n import type { CalendarEvent } from \"../lib/types\";\n import { WEEKDAY_NAMES, dayKey, formatTime, isToday, isWeekend, weekDays } from \"../lib/dates\";\n import { allDayEvents, eventHue, eventStart, layoutDay } from \"../lib/events\";\n import type { DisplayZone } from \"../lib/timezone\";\n import { hourLabels, nowInZone, shortZoneLabel, zoneLabel, resolveZone } from \"../lib/timezone\";\n import EventChip from \"./EventChip.svelte\";\n\n interface Props {\n cursor: Date;\n events: CalendarEvent[];\n /** One day for the day view, seven for the week view. */\n days?: number;\n zone?: DisplayZone;\n /** Extra clocks to show beside the grid, left of the primary one. */\n compareZones?: DisplayZone[];\n onselect: (event: CalendarEvent) => void;\n onpickday: (day: Date) => void;\n }\n\n let {\n cursor,\n events,\n days = 7,\n zone = \"local\",\n compareZones = [],\n onselect,\n onpickday,\n }: Props = $props();\n\n const HOURS = Array.from({ length: 24 }, (_, hour) => hour);\n\n let now = $derived(nowInZone(zone));\n\n let columns = $derived(days === 1 ? [new Date(cursor)] : weekDays(cursor));\n let allDayRows = $derived(columns.map((day) => allDayEvents(events, day, zone)));\n let hasAllDay = $derived(allDayRows.some((row) => row.length > 0));\n let laidOut = $derived(columns.map((day) => layoutDay(events, day, zone)));\n // The primary zone sits closest to the grid, since that is the one the rows\n // actually line up with; comparison clocks go to its left.\n let gutters = $derived([...compareZones, zone]);\n let labels = $derived(\n gutters.map((other) =>\n other === zone\n ? HOURS.map((hour) => `${String(hour).padStart(2, \"0\")}:00`)\n : hourLabels(columns[0], zone, other),\n ),\n );\n</script>\n\n<div\n class=\"week\"\n class:single={columns.length === 1}\n style=\"--cols: {columns.length}; --gutters: {gutters.length}\"\n>\n <div class=\"headers\">\n {#each gutters as other, index (index)}\n <div class=\"gutter zonehead\" title={zoneLabel(resolveZone(other))}>\n {shortZoneLabel(other)}\n </div>\n {/each}\n {#each columns as day, index (dayKey(day))}\n <button\n type=\"button\"\n class=\"dayhead\"\n class:today={isToday(day, now)}\n class:weekend={isWeekend(day)}\n onclick={() => onpickday(day)}\n >\n <span class=\"dow\">{WEEKDAY_NAMES[(day.getDay() + 6) % 7]}</span>\n <span class=\"dom\">{day.getDate()}</span>\n {#if allDayRows[index].length > 0}\n <span class=\"badge\">{allDayRows[index].length}</span>\n {/if}\n </button>\n {/each}\n </div>\n\n {#if hasAllDay}\n <div class=\"allday\">\n {#each gutters as _other, index (index)}\n <div class=\"gutter\"><span>{index === gutters.length - 1 ? \"All day\" : \"\"}</span></div>\n {/each}\n {#each columns as day, index (dayKey(day))}\n <div class=\"allday-cell\" class:weekend={isWeekend(day)}>\n {#each allDayRows[index] as event (event.id)}\n <EventChip {event} {zone} {onselect} showTime={false} />\n {/each}\n </div>\n {/each}\n </div>\n {/if}\n\n <div class=\"scroll\">\n <div class=\"body\">\n {#each gutters as _other, index (index)}\n <div class=\"gutter hours\" class:secondary={index < gutters.length - 1}>\n {#each labels[index] as label, hour (hour)}\n <div class=\"hour\"><span>{label}</span></div>\n {/each}\n </div>\n {/each}\n\n {#each columns as day, index (dayKey(day))}\n <div class=\"daycol\" class:weekend={isWeekend(day)} class:today={isToday(day, now)}>\n {#each HOURS as hour (hour)}\n <div class=\"slot\"></div>\n {/each}\n\n {#each laidOut[index] as placed (placed.event.id)}\n <button\n type=\"button\"\n class=\"timed\"\n class:private={placed.event.visibility === \"private\"}\n style=\"--hue: {eventHue(placed.event)};\n top: {placed.top * 100}%;\n height: {placed.height * 100}%;\n left: calc({(placed.column / placed.columns) * 100}% + 2px);\n width: calc({(1 / placed.columns) * 100}% - 4px);\"\n onclick={() => onselect(placed.event)}\n title={placed.event.title}\n >\n <span class=\"timed-time\">{formatTime(eventStart(placed.event, zone))}</span>\n <span class=\"timed-title\">{placed.event.title}</span>\n </button>\n {/each}\n </div>\n {/each}\n </div>\n </div>\n</div>\n\n<style>\n .week {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n }\n\n .headers,\n .allday,\n .body {\n display: grid;\n grid-template-columns: repeat(var(--gutters, 1), 3.5rem) repeat(var(--cols, 7), minmax(0, 1fr));\n }\n\n .headers {\n border-bottom: 1px solid var(--border);\n }\n\n .dayhead {\n display: flex;\n align-items: baseline;\n justify-content: center;\n gap: 0.35rem;\n padding: 0.45rem 0.25rem;\n background: none;\n border: 0;\n border-left: 1px solid var(--border);\n }\n\n .dayhead:hover {\n background: var(--bg-hover);\n }\n\n .dayhead.weekend {\n background: var(--bg-subtle);\n }\n\n .dayhead.today {\n background: var(--today);\n }\n\n .dow {\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n color: var(--text-muted);\n }\n\n .dom {\n font-size: 16px;\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n }\n\n .today .dom {\n color: var(--asf-red);\n }\n\n .badge {\n font-size: 10px;\n background: var(--border-strong);\n color: var(--bg-panel);\n border-radius: 999px;\n padding: 0 5px;\n }\n\n .allday {\n border-bottom: 1px solid var(--border-strong);\n max-height: 6rem;\n overflow-y: auto;\n }\n\n .allday-cell {\n display: flex;\n flex-direction: column;\n gap: 2px;\n padding: 2px;\n min-width: 0;\n border-left: 1px solid var(--border);\n }\n\n .gutter {\n font-size: 11px;\n color: var(--text-faint);\n text-align: right;\n padding-right: 0.4rem;\n }\n\n .zonehead {\n display: flex;\n align-items: flex-end;\n justify-content: flex-end;\n padding-bottom: 0.45rem;\n font-weight: 700;\n letter-spacing: 0.02em;\n color: var(--text-muted);\n overflow: hidden;\n }\n\n /* Comparison clocks are there for reference, so they read quieter than the\n zone the grid is actually drawn in. */\n .hours.secondary {\n color: var(--text-faint);\n opacity: 0.75;\n }\n\n .hours.secondary + .hours {\n border-left: 1px solid var(--border);\n }\n\n .allday .gutter {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n }\n\n .scroll {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n background: var(--bg-panel);\n }\n\n .hours .hour {\n height: 3rem;\n position: relative;\n }\n\n .hours .hour span {\n position: absolute;\n top: -0.6em;\n right: 0.4rem;\n }\n\n .daycol {\n position: relative;\n min-width: 0;\n border-left: 1px solid var(--border);\n }\n\n .daycol.weekend {\n background: var(--bg-subtle);\n }\n\n .daycol.today {\n background: var(--today);\n }\n\n .slot {\n height: 3rem;\n border-bottom: 1px solid var(--border);\n }\n\n .timed {\n position: absolute;\n display: flex;\n flex-direction: column;\n gap: 0;\n overflow: hidden;\n padding: 1px 4px;\n text-align: left;\n font-size: 12px;\n line-height: 1.25;\n background: var(--chip-bg);\n color: var(--chip-text);\n border: 1px solid var(--chip-border);\n border-left: 3px solid var(--chip-border);\n border-radius: 4px;\n }\n\n .timed.private {\n border-style: dashed;\n border-left-style: solid;\n }\n\n .timed:hover {\n filter: brightness(0.96);\n z-index: 2;\n }\n\n .timed-time {\n font-variant-numeric: tabular-nums;\n opacity: 0.75;\n }\n\n .timed-title {\n font-weight: 600;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n</style>\n","<script lang=\"ts\">\n import type { CalendarEvent } from \"../lib/types\";\n import { MONTH_NAMES, dayKey, isToday, monthGrid, yearMonths } from \"../lib/dates\";\n import { eventHue, occursOnDay } from \"../lib/events\";\n import type { DisplayZone } from \"../lib/timezone\";\n import { nowInZone } from \"../lib/timezone\";\n\n interface Props {\n cursor: Date;\n events: CalendarEvent[];\n zone?: DisplayZone;\n onpickday: (day: Date) => void;\n onpickmonth: (month: Date) => void;\n }\n\n let { cursor, events, zone = \"local\", onpickday, onpickmonth }: Props = $props();\n\n let now = $derived(nowInZone(zone));\n\n /** Up to three dots per day, so a busy day still reads as busy. */\n const MAX_DOTS = 3;\n\n function dotsFor(day: Date): CalendarEvent[] {\n return events.filter((event) => occursOnDay(event, day, zone)).slice(0, MAX_DOTS);\n }\n\n let months = $derived(yearMonths(cursor));\n</script>\n\n<div class=\"year\">\n {#each months as month (month.getMonth())}\n <section class=\"month\">\n <button type=\"button\" class=\"title\" onclick={() => onpickmonth(month)}>\n {MONTH_NAMES[month.getMonth()]}\n </button>\n <div class=\"mini\">\n {#each [\"M\", \"T\", \"W\", \"T\", \"F\", \"S\", \"S\"] as label, index (index)}\n <div class=\"dow\">{label}</div>\n {/each}\n {#each monthGrid(month).slice(0, 42) as day (dayKey(day))}\n {@const inMonth = day.getMonth() === month.getMonth()}\n {@const dots = inMonth ? dotsFor(day) : []}\n <button\n type=\"button\"\n class=\"day\"\n class:outside={!inMonth}\n class:today={isToday(day, now)}\n onclick={() => onpickday(day)}\n aria-label={`${day.getDate()} ${MONTH_NAMES[day.getMonth()]}${dots.length ? `, ${dots.length} events` : \"\"}`}\n >\n <span class=\"num\">{day.getDate()}</span>\n <span class=\"dots\">\n {#each dots as event (event.id)}\n <i style=\"--hue: {eventHue(event)}\"></i>\n {/each}\n </span>\n </button>\n {/each}\n </div>\n </section>\n {/each}\n</div>\n\n<style>\n .year {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));\n gap: 1rem;\n padding: 1rem;\n overflow-y: auto;\n height: 100%;\n }\n\n .month {\n background: var(--bg-panel);\n border: 1px solid var(--border);\n border-radius: var(--radius);\n padding: 0.6rem;\n box-shadow: var(--shadow);\n }\n\n .title {\n display: block;\n width: 100%;\n background: none;\n border: 0;\n padding: 0 0 0.4rem;\n text-align: left;\n font-weight: 700;\n font-size: 13px;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--asf-red);\n }\n\n .title:hover {\n text-decoration: underline;\n }\n\n .mini {\n display: grid;\n grid-template-columns: repeat(7, 1fr);\n gap: 1px;\n }\n\n .dow {\n font-size: 10px;\n color: var(--text-faint);\n text-align: center;\n padding-bottom: 2px;\n }\n\n .day {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 1px;\n background: none;\n border: 0;\n border-radius: 3px;\n padding: 2px 0 3px;\n font-size: 11px;\n font-variant-numeric: tabular-nums;\n min-height: 1.9rem;\n }\n\n .day:hover {\n background: var(--bg-hover);\n }\n\n .day.outside {\n opacity: 0.3;\n }\n\n .day.today .num {\n background: var(--asf-red);\n color: #fff;\n border-radius: 999px;\n padding: 0 4px;\n font-weight: 700;\n }\n\n .dots {\n display: flex;\n gap: 1px;\n height: 4px;\n }\n\n .dots i {\n width: 4px;\n height: 4px;\n border-radius: 999px;\n background: hsl(var(--hue) 60% 50%);\n }\n</style>\n","<script lang=\"ts\">\n import type { CalendarEvent } from \"../lib/types\";\n import { WEEKDAY_NAMES, formatDate, formatTime, isToday } from \"../lib/dates\";\n import { agendaSections, calendarLabel, eventEnd, eventHue, eventStart } from \"../lib/events\";\n import type { DisplayZone } from \"../lib/timezone\";\n import { nowInZone, shortZoneLabel } from \"../lib/timezone\";\n\n interface Props {\n events: CalendarEvent[];\n zone?: DisplayZone;\n /** Extra clocks to show after the main time. */\n compareZones?: DisplayZone[];\n onselect: (event: CalendarEvent) => void;\n }\n\n let { events, zone = \"local\", compareZones = [], onselect }: Props = $props();\n\n let now = $derived(nowInZone(zone));\n let sections = $derived(agendaSections(events, zone));\n\n function when(event: CalendarEvent): string {\n if (event.all_day) return \"All day\";\n return `${formatTime(eventStart(event, zone))} - ${formatTime(eventEnd(event, zone))}`;\n }\n\n /** The start time on each comparison clock, for the muted suffix. */\n function alsoAt(event: CalendarEvent): { key: string; text: string }[] {\n if (event.all_day) return [];\n return compareZones.map((other) => ({\n key: other,\n text: `${formatTime(eventStart(event, other))} ${shortZoneLabel(other)}`,\n }));\n }\n</script>\n\n<div class=\"agenda\">\n {#if sections.length === 0}\n <p class=\"empty muted\">No events match the current filters.</p>\n {/if}\n\n {#each sections as section (section.key)}\n <section>\n <h3 class:today={isToday(section.date, now)}>\n <span class=\"dow\">{WEEKDAY_NAMES[(section.date.getDay() + 6) % 7]}</span>\n {formatDate(section.date)}\n </h3>\n <ul>\n {#each section.events as event (event.id)}\n <li>\n <button\n type=\"button\"\n class=\"row\"\n style=\"--hue: {eventHue(event)}\"\n onclick={() => onselect(event)}\n >\n <span class=\"when\">{when(event)}</span>\n {#each alsoAt(event) as also (also.key)}\n <span class=\"alsoat\">{also.text}</span>\n {/each}\n <span class=\"title\">{event.title}</span>\n <span class=\"tag\">{calendarLabel(event)}</span>\n {#if event.visibility === \"private\"}\n <span class=\"tag private\">private</span>\n {/if}\n {#if event.location}\n <span class=\"where muted\">{event.location}</span>\n {/if}\n </button>\n </li>\n {/each}\n </ul>\n </section>\n {/each}\n</div>\n\n<style>\n .agenda {\n height: 100%;\n overflow-y: auto;\n padding: 1rem 1rem 3rem;\n }\n\n .empty {\n padding: 2rem;\n text-align: center;\n }\n\n section {\n margin-bottom: 1.25rem;\n }\n\n h3 {\n display: flex;\n align-items: baseline;\n gap: 0.5rem;\n margin: 0 0 0.4rem;\n font-size: 13px;\n font-weight: 700;\n color: var(--text-muted);\n border-bottom: 1px solid var(--border);\n padding-bottom: 0.25rem;\n }\n\n h3.today {\n color: var(--asf-red);\n }\n\n .dow {\n text-transform: uppercase;\n letter-spacing: 0.06em;\n font-size: 11px;\n }\n\n ul {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 3px;\n }\n\n .row {\n display: flex;\n align-items: baseline;\n gap: 0.6rem;\n width: 100%;\n text-align: left;\n background: var(--bg-panel);\n border: 1px solid var(--border);\n border-left: 4px solid hsl(var(--hue) 55% 55%);\n border-radius: var(--radius);\n padding: 0.45rem 0.7rem;\n }\n\n .row:hover {\n background: var(--bg-hover);\n }\n\n .when {\n flex: none;\n width: 9rem;\n font-variant-numeric: tabular-nums;\n color: var(--text-muted);\n font-size: 12px;\n }\n\n .title {\n font-weight: 600;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .alsoat {\n flex: none;\n font-size: 11px;\n color: var(--text-faint);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n }\n\n .tag {\n flex: none;\n font-size: 11px;\n padding: 0 6px;\n border-radius: 999px;\n background: var(--bg-subtle);\n border: 1px solid var(--border);\n color: var(--text-muted);\n }\n\n .tag.private {\n border-style: dashed;\n }\n\n .where {\n margin-left: auto;\n font-size: 12px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n @media (max-width: 42rem) {\n .row {\n flex-wrap: wrap;\n }\n\n .when {\n width: auto;\n }\n\n .where {\n margin-left: 0;\n width: 100%;\n }\n }\n</style>\n","<script lang=\"ts\">\n import type { CalendarEvent, Calendars, Category, EventDraft, Visibility } from \"../lib/types\";\n import { formatDate, formatTime, fromDayKey, toDateInput, toISO, toLocalInput } from \"../lib/dates\";\n import { calendarLabel, categoryLabel, eventEnd, eventHue, eventStart } from \"../lib/events\";\n import type { DisplayZone } from \"../lib/timezone\";\n import {\n describeDisplayZone,\n fromWallInZone,\n isLocal,\n resolveZone,\n toWallInZone,\n zoneCity,\n zoneLabel,\n zoneList,\n } from \"../lib/timezone\";\n import { api } from \"../lib/api\";\n\n interface Props {\n event: CalendarEvent | null;\n draft: EventDraft | null;\n calendars: Calendars | null;\n saving: boolean;\n error: string | null;\n /** Whether the current user may change this event. */\n editable: boolean;\n /** The timezone the viewer is reading the calendar in. */\n zone?: DisplayZone;\n /** Extra clocks the viewer has asked to see alongside. */\n compareZones?: DisplayZone[];\n onclose: () => void;\n onedit: () => void;\n onsave: (draft: EventDraft) => void;\n ondelete: () => void;\n }\n\n let {\n event,\n draft,\n calendars,\n saving,\n error,\n editable,\n zone = \"local\",\n compareZones = [],\n onclose,\n onedit,\n onsave,\n ondelete,\n }: Props = $props();\n\n const ZONES = zoneList();\n\n /** A local, editable copy so typing does not mutate the parent's state. */\n let form = $state<EventDraft | null>(null);\n let lastDraft: EventDraft | null = null;\n\n $effect(() => {\n if (draft !== lastDraft) {\n lastDraft = draft;\n form = draft ? { ...draft } : null;\n }\n });\n\n let creatableCategories = $derived.by((): Category[] => {\n const can = calendars?.can_create;\n if (!can) return [];\n const list: Category[] = [];\n if (can.personal) list.push(\"personal\");\n if (can.project.length > 0) list.push(\"project\");\n if (can.foundation) list.push(\"foundation\");\n return list;\n });\n\n let projectOptions = $derived(\n form?.visibility === \"private\"\n ? (calendars?.can_create.project_private ?? [])\n : (calendars?.can_create.project ?? []),\n );\n\n /** A committer can only make public events for their projects. */\n let visibilityOptions = $derived.by((): Visibility[] => {\n if (!form) return [\"public\"];\n if (form.category === \"personal\") return [\"private\"];\n if (form.category === \"foundation\") return [\"public\", \"private\"];\n const privateProjects = calendars?.can_create.project_private ?? [];\n return privateProjects.length > 0 ? [\"public\", \"private\"] : [\"public\"];\n });\n\n function onCategoryChange(category: Category) {\n if (!form) return;\n form.category = category;\n if (category === \"personal\") {\n form.visibility = \"private\";\n form.project = null;\n } else if (category === \"foundation\") {\n form.project = null;\n if (form.visibility === \"private\" && !calendars?.can_create.foundation) form.visibility = \"public\";\n } else {\n form.project ??= calendars?.can_create.project[0] ?? null;\n }\n }\n\n function submit(submitEvent: SubmitEvent) {\n submitEvent.preventDefault();\n if (form) onsave({ ...form });\n }\n\n function keydown(keyEvent: KeyboardEvent) {\n if (keyEvent.key === \"Escape\") onclose();\n }\n\n function copyShortlink() {\n if (event?.shortlink_url) void navigator.clipboard?.writeText(event.shortlink_url);\n }\n\n function whenLabel(current: CalendarEvent): string {\n const start = eventStart(current, zone);\n const end = eventEnd(current, zone);\n if (current.all_day) {\n const lastDay = new Date(end.getTime() - 1);\n return lastDay.toDateString() === start.toDateString()\n ? `${formatDate(start)} (all day)`\n : `${formatDate(start)} - ${formatDate(lastDay)} (all day)`;\n }\n if (start.toDateString() === end.toDateString()) {\n return `${formatDate(start)}, ${formatTime(start)} - ${formatTime(end)}`;\n }\n return `${formatDate(start)} ${formatTime(start)} - ${formatDate(end)} ${formatTime(end)}`;\n }\n\n interface ZoneReading {\n key: string;\n label: string;\n when: string;\n }\n\n /**\n * The same event on other clocks: the organiser's own, and whichever zones\n * the viewer has asked to compare against.\n *\n * All-day events are dates rather than instants, so there is nothing to\n * convert and the list stays empty.\n */\n let otherReadings = $derived.by((): ZoneReading[] => {\n const current = event;\n if (!current || current.all_day) return [];\n\n const start = new Date(current.start);\n const end = new Date(current.end);\n const primary = eventStart(current, zone).getTime();\n const rows: ZoneReading[] = [];\n const seen = new Set<string>([resolveZone(zone)]);\n\n const add = (candidate: DisplayZone, suffix = \"\") => {\n const resolved = resolveZone(candidate);\n if (seen.has(resolved)) return;\n seen.add(resolved);\n const from = toWallInZone(start, resolved);\n // A zone that happens to read the same as the viewer's is just noise.\n if (from.getTime() === primary && !suffix) return;\n const name = isLocal(candidate) ? `Local - ${zoneCity(resolved)}` : zoneCity(resolved);\n rows.push({\n key: resolved,\n label: `${name}${suffix}`,\n when: `${formatTime(from)} - ${formatTime(toWallInZone(end, resolved))}`,\n });\n };\n\n add(current.timezone || \"UTC\", \" (organiser)\");\n for (const candidate of compareZones) add(candidate);\n return rows;\n });\n\n /**\n * The form's times are entered in the event's own timezone, so that posting\n * \"15:00 in Berlin\" means exactly that regardless of where the organiser is\n * sitting or which zone they are reading the calendar in.\n *\n * All-day events are dates, not instants, so they stay on the UTC day.\n */\n function setStart(value: string, allDay: boolean) {\n if (!form || !value) return;\n form.start = allDay\n ? toISO(new Date(Date.UTC(...dateParts(value))))\n : toISO(fromWallInZone(new Date(value), form.timezone));\n }\n\n function setEnd(value: string, allDay: boolean) {\n if (!form || !value) return;\n if (allDay) {\n // The stored end is exclusive: the day after the last day.\n const [year, month, day] = dateParts(value);\n form.end = toISO(new Date(Date.UTC(year, month, day + 1)));\n } else {\n form.end = toISO(fromWallInZone(new Date(value), form.timezone));\n }\n }\n\n function dateParts(value: string): [number, number, number] {\n const parsed = fromDayKey(value);\n return [parsed.getFullYear(), parsed.getMonth(), parsed.getDate()];\n }\n\n /** The value to show in a datetime-local input, in the event's timezone. */\n function inputValue(iso: string): string {\n if (!form) return \"\";\n return toLocalInput(toWallInZone(new Date(iso), form.timezone));\n }\n\n /** The UTC date to show in a date input for an all-day event. */\n function dateValue(iso: string, exclusiveEnd = false): string {\n const instant = new Date(iso);\n const shifted = exclusiveEnd ? new Date(instant.getTime() - 1) : instant;\n return toDateInput(\n new Date(shifted.getUTCFullYear(), shifted.getUTCMonth(), shifted.getUTCDate()),\n );\n }\n\n /**\n * Moving an event to another timezone keeps the wall clock and changes the\n * instant: \"the call is still at 15:00, but 15:00 in Tokyo\".\n */\n function onTimezoneChange(next: string) {\n if (!form) return;\n const startWall = toWallInZone(new Date(form.start), form.timezone);\n const endWall = toWallInZone(new Date(form.end), form.timezone);\n form.timezone = next;\n form.start = toISO(fromWallInZone(startWall, next));\n form.end = toISO(fromWallInZone(endWall, next));\n }\n</script>\n\n<svelte:window onkeydown={keydown} />\n\n<!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_static_element_interactions -->\n<div class=\"backdrop\" onclick={onclose}>\n <!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_static_element_interactions -->\n <div\n class=\"dialog\"\n role=\"dialog\"\n tabindex=\"-1\"\n aria-modal=\"true\"\n aria-label={form ? \"Edit event\" : (event?.title ?? \"Event\")}\n style=\"--hue: {event ? eventHue(event) : 210}\"\n onclick={(mouseEvent) => mouseEvent.stopPropagation()}\n >\n {#if error}\n <p class=\"error\" role=\"alert\">{error}</p>\n {/if}\n\n {#if form}\n <form onsubmit={submit}>\n <h2>{event ? \"Edit event\" : \"New event\"}</h2>\n\n <label class=\"row\">\n <span>Title</span>\n <input bind:value={form.title} required maxlength=\"200\" placeholder=\"What is happening?\" />\n </label>\n\n <div class=\"pair\">\n <label class=\"row\">\n <span>Calendar</span>\n <select\n value={form.category}\n onchange={(changeEvent) => onCategoryChange(changeEvent.currentTarget.value as Category)}\n disabled={creatableCategories.length <= 1 && !event}\n >\n {#each creatableCategories as category (category)}\n <option value={category}>{categoryLabel(category)}</option>\n {/each}\n </select>\n </label>\n\n {#if form.category === \"project\"}\n <label class=\"row\">\n <span>Project</span>\n <select bind:value={form.project}>\n {#each projectOptions as project (project)}\n <option value={project}>{project}</option>\n {/each}\n </select>\n </label>\n {/if}\n\n {#if form.category !== \"personal\"}\n <label class=\"row\">\n <span>Visibility</span>\n <select bind:value={form.visibility}>\n {#each visibilityOptions as option (option)}\n <option value={option}>{option}</option>\n {/each}\n </select>\n </label>\n {/if}\n </div>\n\n <label class=\"check\">\n <input type=\"checkbox\" bind:checked={form.all_day} />\n All day\n </label>\n\n {#if !form.all_day}\n <label class=\"row\">\n <span>Timezone of these times</span>\n <select\n value={form.timezone}\n onchange={(changeEvent) => onTimezoneChange(changeEvent.currentTarget.value)}\n >\n {#each ZONES as name (name)}\n <option value={name}>{name}</option>\n {/each}\n </select>\n <small class=\"hint muted\">\n Enter the times as they will be in this zone. Everybody else sees them converted to\n their own clock.\n </small>\n </label>\n {/if}\n\n <div class=\"pair\">\n <label class=\"row\">\n <span>Starts</span>\n {#if form.all_day}\n <input\n type=\"date\"\n value={dateValue(form.start)}\n onchange={(changeEvent) => setStart(changeEvent.currentTarget.value, true)}\n required\n />\n {:else}\n <input\n type=\"datetime-local\"\n value={inputValue(form.start)}\n onchange={(changeEvent) => setStart(changeEvent.currentTarget.value, false)}\n required\n />\n {/if}\n </label>\n\n <label class=\"row\">\n <span>Ends</span>\n {#if form.all_day}\n <input\n type=\"date\"\n value={dateValue(form.end, true)}\n onchange={(changeEvent) => setEnd(changeEvent.currentTarget.value, true)}\n required\n />\n {:else}\n <input\n type=\"datetime-local\"\n value={inputValue(form.end)}\n onchange={(changeEvent) => setEnd(changeEvent.currentTarget.value, false)}\n required\n />\n {/if}\n </label>\n </div>\n\n <label class=\"row\">\n <span>Location</span>\n <input bind:value={form.location} maxlength=\"300\" placeholder=\"Room, city or a meeting link\" />\n </label>\n\n <label class=\"row\">\n <span>Link</span>\n <input bind:value={form.url} type=\"url\" maxlength=\"2048\" placeholder=\"https://...\" />\n </label>\n\n <label class=\"row\">\n <span>Description</span>\n <textarea bind:value={form.description} maxlength=\"20000\"></textarea>\n </label>\n\n <footer>\n {#if event}\n <button type=\"button\" class=\"btn danger\" onclick={ondelete} disabled={saving}>Delete</button>\n {/if}\n <span class=\"spacer\"></span>\n <button type=\"button\" class=\"btn\" onclick={onclose} disabled={saving}>Cancel</button>\n <button type=\"submit\" class=\"btn primary\" disabled={saving}>\n {saving ? \"Saving...\" : \"Save\"}\n </button>\n </footer>\n </form>\n {:else if event}\n <article>\n <header>\n <span class=\"tag\">{calendarLabel(event)}</span>\n <span class=\"tag\" class:private={event.visibility === \"private\"}>{event.visibility}</span>\n </header>\n\n <h2>{event.title}</h2>\n <p class=\"when\">\n {whenLabel(event)}\n <span class=\"zonehint muted\">{event.all_day ? \"\" : describeDisplayZone(zone)}</span>\n </p>\n\n {#if otherReadings.length > 0}\n <ul class=\"clocks\">\n {#each otherReadings as reading (reading.key)}\n <li>\n <span class=\"clockzone\" title={zoneLabel(reading.key)}>{reading.label}</span>\n <span class=\"clocktime\">{reading.when}</span>\n </li>\n {/each}\n </ul>\n {/if}\n\n {#if event.location}\n <p><strong>Where</strong> {event.location}</p>\n {/if}\n\n {#if event.url}\n <p><strong>Link</strong> <a href={event.url} rel=\"noreferrer noopener\">{event.url}</a></p>\n {/if}\n\n {#if event.description}\n <p class=\"description\">{event.description}</p>\n {/if}\n\n <p class=\"shortlink\">\n <strong>Shortlink</strong>\n <a href={event.shortlink_url}>{event.shortlink_url}</a>\n <button type=\"button\" class=\"btn\" onclick={copyShortlink}>Copy</button>\n </p>\n\n <p class=\"muted owner\">Added by {event.owner}</p>\n\n <footer>\n <a class=\"btn\" href={api.icsUrl(event.id)}>Download .ics</a>\n <span class=\"spacer\"></span>\n {#if editable}\n <button type=\"button\" class=\"btn\" onclick={onedit}>Edit</button>\n {/if}\n <button type=\"button\" class=\"btn primary\" onclick={onclose}>Close</button>\n </footer>\n </article>\n {/if}\n </div>\n</div>\n\n<style>\n .backdrop {\n position: fixed;\n inset: 0;\n background: rgba(10, 14, 20, 0.45);\n display: flex;\n align-items: flex-start;\n justify-content: center;\n padding: 3rem 1rem;\n overflow-y: auto;\n z-index: 50;\n }\n\n .dialog {\n width: min(38rem, 100%);\n background: var(--bg-panel);\n border-radius: 10px;\n border-top: 4px solid hsl(var(--hue) 55% 50%);\n box-shadow: var(--shadow-lg);\n padding: 1.2rem 1.4rem 1rem;\n }\n\n h2 {\n margin: 0.2rem 0 0.6rem;\n font-size: 19px;\n }\n\n .error {\n margin: 0 0 0.8rem;\n padding: 0.5rem 0.7rem;\n border-radius: var(--radius);\n background: hsl(0 70% 95%);\n border: 1px solid hsl(0 60% 75%);\n color: hsl(0 65% 30%);\n }\n\n @media (prefers-color-scheme: dark) {\n .error {\n background: hsl(0 40% 20%);\n border-color: hsl(0 40% 40%);\n color: hsl(0 70% 85%);\n }\n }\n\n .row {\n display: flex;\n flex-direction: column;\n gap: 0.2rem;\n margin-bottom: 0.6rem;\n flex: 1 1 10rem;\n }\n\n .row > span {\n font-size: 11px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--text-muted);\n }\n\n .pair {\n display: flex;\n gap: 0.7rem;\n flex-wrap: wrap;\n }\n\n .check {\n display: flex;\n align-items: center;\n gap: 0.4rem;\n margin-bottom: 0.6rem;\n font-size: 13px;\n }\n\n footer {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin-top: 1rem;\n padding-top: 0.8rem;\n border-top: 1px solid var(--border);\n }\n\n .spacer {\n flex: 1;\n }\n\n article header {\n display: flex;\n gap: 0.35rem;\n }\n\n .tag {\n font-size: 11px;\n padding: 0 7px;\n border-radius: 999px;\n background: var(--bg-subtle);\n border: 1px solid var(--border);\n color: var(--text-muted);\n text-transform: capitalize;\n }\n\n .tag.private {\n border-style: dashed;\n color: var(--asf-red);\n }\n\n .when {\n margin: 0 0 0.3rem;\n font-weight: 600;\n }\n\n .zonehint {\n font-weight: 400;\n font-size: 12px;\n }\n\n .clocks {\n list-style: none;\n margin: 0 0 0.8rem;\n padding: 0;\n font-size: 12px;\n color: var(--text-muted);\n }\n\n .clocks li {\n display: flex;\n gap: 0.5rem;\n }\n\n .clockzone {\n min-width: 11rem;\n }\n\n .clocktime {\n font-variant-numeric: tabular-nums;\n }\n\n .hint {\n font-size: 11px;\n font-weight: 400;\n text-transform: none;\n letter-spacing: 0;\n line-height: 1.3;\n }\n\n article p {\n margin: 0 0 0.5rem;\n }\n\n .description {\n white-space: pre-wrap;\n padding: 0.6rem 0.8rem;\n background: var(--bg-subtle);\n border-radius: var(--radius);\n }\n\n .shortlink {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n flex-wrap: wrap;\n font-size: 13px;\n }\n\n .shortlink a {\n font-family: var(--mono);\n font-size: 12px;\n }\n\n .owner {\n font-size: 12px;\n }\n</style>\n","<script lang=\"ts\">\n import type { Calendars, SessionInfo } from \"../lib/types\";\n import type { DisplayZone } from \"../lib/timezone\";\n import { browserZone, describeDisplayZone, resolveZone } from \"../lib/timezone\";\n import { apiUrl, appPath } from \"../lib/base\";\n import { loginUrl, logoutUrl } from \"../lib/base\";\n\n interface Props {\n calendars: Calendars | null;\n session: SessionInfo | null;\n zone: DisplayZone;\n compareZones?: DisplayZone[];\n onclose: () => void;\n }\n\n let { calendars, session, zone, compareZones = [], onclose }: Props = $props();\n\n /** Rows of the \"who can do what\" table. A cell is either true, false, or a note. */\n type Cell = boolean | string;\n\n const COLUMNS = [\"Anyone\", \"Project member\", \"Committee member\", \"Foundation member\"];\n\n const ROWS: { what: string; cells: Cell[] }[] = [\n { what: \"See public project events\", cells: [true, true, true, true] },\n { what: \"See public foundation events\", cells: [true, true, true, true] },\n { what: \"Subscribe to the iCalendar feed\", cells: [true, true, true, true] },\n { what: \"Open an event by its shortlink\", cells: [\"public events\", true, true, true] },\n { what: \"Keep personal events\", cells: [false, true, true, true] },\n { what: \"Add and edit public events for a project\", cells: [false, \"own projects\", \"own projects\", \"own projects\"] },\n { what: \"See private events of a project\", cells: [false, false, \"own committees\", \"own committees\"] },\n { what: \"Add and edit private project events\", cells: [false, false, \"own committees\", \"own committees\"] },\n { what: \"See private foundation events\", cells: [false, false, false, true] },\n { what: \"Add and edit foundation events\", cells: [false, false, false, true] },\n ];\n\n let embedExample = $derived(\n `${globalThis.location?.origin ?? \"\"}${appPath(\"/embed/agenda\")}?project=httpd&limit=8`,\n );\n\n let youAre = $derived.by(() => {\n if (!calendars?.authenticated) return \"You are browsing anonymously, so you can see public events only.\";\n const bits: string[] = [];\n if (calendars.projects.length > 0) bits.push(`a member of ${calendars.projects.join(\", \")}`);\n if (calendars.committees.length > 0) bits.push(`on the ${calendars.committees.join(\", \")} committee${calendars.committees.length > 1 ? \"s\" : \"\"}`);\n if (calendars.is_member) bits.push(\"a foundation member\");\n if (bits.length === 0) return `You are signed in as ${calendars.uid}.`;\n return `You are signed in as ${calendars.uid}, ${bits.join(\", and \")}.`;\n });\n</script>\n\n<div class=\"help\">\n <div class=\"sheet\">\n <header>\n <h2>Using the ASF Community Calendar</h2>\n <button type=\"button\" class=\"btn\" onclick={onclose}>Back to the calendar</button>\n </header>\n\n <p class=\"status\">{youAre}</p>\n\n <section>\n <h3>The three calendars</h3>\n <p>\n Every event belongs to one of three calendars, and that is what decides who can see it and\n who can change it.\n </p>\n <dl>\n <dt><span class=\"swatch personal\"></span> Personal</dt>\n <dd>\n Your own events. Nobody else can see them, and they are never public. Use them for the\n things you want on the same grid as everything else without telling anyone about them.\n </dd>\n\n <dt><span class=\"swatch project\"></span> Project</dt>\n <dd>\n Events belonging to a project: release votes, community calls, meetups. Public ones are\n visible to everyone, including people who are not signed in. Private ones are visible only\n to the project's committee (its PMC).\n </dd>\n\n <dt><span class=\"swatch foundation\"></span> Foundation</dt>\n <dd>\n Events for the ASF as a whole: board meetings, ApacheCon, report deadlines. Public ones are\n visible to everyone; private ones only to foundation members.\n </dd>\n </dl>\n </section>\n\n <section>\n <h3>Who can do what</h3>\n <p>\n The lists of projects and committees you belong to come from your Apache account, through the\n same login the rest of the foundation's tools use. There is nothing to configure here: sign\n in and the calendar knows.\n </p>\n <div class=\"tablewrap\">\n <table>\n <thead>\n <tr>\n <th scope=\"col\"> </th>\n {#each COLUMNS as column (column)}\n <th scope=\"col\">{column}</th>\n {/each}\n </tr>\n </thead>\n <tbody>\n {#each ROWS as row (row.what)}\n <tr>\n <th scope=\"row\">{row.what}</th>\n {#each row.cells as cell, index (index)}\n <td>\n {#if cell === true}\n <span class=\"yes\" aria-label=\"yes\">✓</span>\n {:else if cell === false}\n <span class=\"no\" aria-label=\"no\">–</span>\n {:else}\n <span class=\"note\">{cell}</span>\n {/if}\n </td>\n {/each}\n </tr>\n {/each}\n </tbody>\n </table>\n </div>\n <p class=\"muted small\">\n \"Own projects\" means the projects you commit to; \"own committees\" means the PMCs you sit on.\n Being on a committee also counts as being a member of that project. Any project member can\n edit any of their project's events, not only the ones they added themselves.\n </p>\n </section>\n\n <section>\n <h3>Getting around</h3>\n <ul>\n <li><strong>Day, week, month, year and agenda</strong> are the five views. Pick one at the top.</li>\n <li>\n The <strong>‹</strong> and <strong>›</strong> buttons move one view-sized step:\n a day in the day view, a month in the month view, and so on. <strong>Today</strong> jumps\n back to now.\n </li>\n <li>\n Clicking a date number in the month or year view opens that day. Clicking a month name in\n the year view opens that month.\n </li>\n <li>\n A day with more events than fit shows <strong>+n more</strong>; click it to open the day.\n </li>\n <li>Clicking any event opens it, with its full details, shortlink and download link.</li>\n </ul>\n </section>\n\n <section>\n <h3>Filters and search</h3>\n <p>\n The panel on the left narrows what is drawn. It does not change what you have access to; it\n only hides things you would rather not look at right now.\n </p>\n <ul>\n <li>\n <strong>Calendars</strong> switches the three categories on and off. When you sign in, all\n three start switched on, along with every project you belong to.\n </li>\n <li>\n <strong>Projects</strong> lists your projects plus any others that appear in the events\n currently loaded. Projects you are not a member of stay visible unless you narrow the list\n yourself.\n </li>\n <li><strong>Visibility</strong> lets you look at only the public or only the private events.</li>\n <li>\n <strong>Search</strong> matches the title, description, location and project name of the\n events in view.\n </li>\n <li><strong>Sort</strong> appears in the agenda view, where the order is yours to choose.</li>\n </ul>\n </section>\n\n <section id=\"timezones\">\n <h3>Timezones</h3>\n <p>\n An event happens at one moment in time, but that moment has a different clock reading\n depending on where you are. The calendar keeps those two things apart.\n </p>\n <ul>\n <li>\n The switch at the top of the page chooses the clock the calendar is <em>drawn</em> in.\n <strong>Local</strong> follows your browser, which right now says\n <strong>{browserZone()}</strong> - {describeDisplayZone(\"local\")} - and the picker beside\n it holds any of the major timezones, starting on UTC. It is currently set to\n <strong>{describeDisplayZone(zone)}</strong>. Flipping it moves everything together: the\n grid, the times on each event, and which day an event falls on.\n </li>\n <li>\n <strong>You can watch more than one clock at once.</strong> Under \"Timezones\" in the panel\n on the left, add up to three comparison timezones. They appear as extra hour columns beside\n the week and day grids, after the time on each agenda row, and in an event's details - so\n you can see an event in the organiser's own time and in yours without doing the arithmetic.\n {#if compareZones.length > 0}\n You are currently comparing against\n <strong>{compareZones.map((other) => resolveZone(other)).join(\", \")}</strong>.\n {/if}\n The grid itself can only be drawn on one clock, so the extra ones are labels rather than\n extra columns of events.\n </li>\n <li>\n When you add an event you also choose the timezone the times are <em>in</em>. If you are\n organising a call at 15:00 Berlin time, pick Europe/Berlin and type 15:00, and everybody\n else will see it at their own 15:00-equivalent. Changing the timezone in the form keeps the\n clock reading and moves the moment, which is almost always what you meant.\n </li>\n <li>\n Zone names such as <code>Europe/Copenhagen</code> are how the timezone database identifies\n a clock, not a guess about where you are sitting. The calendar shows the city and the\n current offset together so it is obvious why a particular clock was chosen.\n </li>\n <li>\n <strong>All-day events are dates, not moments.</strong> An all-day event on 14 March is on\n 14 March for everyone, and does not shift when you change the switch.\n </li>\n </ul>\n </section>\n\n <section>\n <h3>Adding and changing events</h3>\n <p>\n <strong>New event</strong> appears at the top once you are signed in and have somewhere to\n put an event. The form only offers the calendars you can actually write to, so if you cannot\n see a \"Foundation\" option it is because you are not a foundation member.\n </p>\n <ul>\n <li>A title and a start time are the only things required. An event with no end lasts an hour.</li>\n <li>\n <strong>All day</strong> turns the time fields into date fields. A one-day event is a\n single date; a conference is a range.\n </li>\n <li>\n <strong>Visibility</strong> is public or private. Private means the project committee for\n project events, and foundation members for foundation events. Personal events are always\n private, so there is no choice to make.\n </li>\n <li>\n To edit or delete, open the event and use <strong>Edit</strong>. It only appears if you are\n allowed. You cannot move an event into a calendar you cannot write to, or out of one.\n </li>\n </ul>\n </section>\n\n <section>\n <h3>Bringing events in from another calendar</h3>\n <p>\n <strong>Import</strong>, next to New event, takes an <code>.ics</code> file and turns\n everything in it into events. Most calendar applications can export one.\n </p>\n <ul>\n <li>\n Choose the file first and you get a preview of what was found, including anything the\n importer had to change. Nothing is saved at this point.\n </li>\n <li>\n Then say which calendar the events belong to, and whether they are public or private. You\n have to answer: an import can add a lot of events at once, so there is no default that\n could quietly put them in the wrong place.\n </li>\n <li>\n Every event in the file goes to the same calendar. Import twice if some belong to a\n project and others do not.\n </li>\n <li>\n Repeating events come in as a single occurrence, since the calendar has no recurrence.\n Cancelled entries, and ones with no start time, are skipped and counted for you.\n </li>\n </ul>\n </section>\n\n <section>\n <h3>Shortlinks and subscribing</h3>\n <ul>\n <li>\n Every event has a short URL, shown in its details, that opens the event directly. It is\n safe to paste anywhere: someone who cannot see the event gets told so rather than shown it.\n Public events show their title in link previews; private ones deliberately do not.\n </li>\n <li>\n <strong>Download .ics</strong> in an event's details saves that one event for your own\n calendar application.\n </li>\n <li>\n <strong>Download .ics</strong> at the bottom of the filter panel gives you everything\n currently in view, filters and all.\n </li>\n </ul>\n </section>\n\n <section>\n <h3>Putting the agenda on your own site</h3>\n <p>\n A project website can carry a live list of its upcoming events with an iframe. No script and\n no account are needed, and it stays up to date on its own.\n </p>\n <pre><iframe src=\"{embedExample}\" width=\"100%\" height=\"420\"></iframe></pre>\n <p class=\"muted small\">\n An embed always shows public events only, whoever is looking at it. Your session does not\n travel to another site, which is exactly what you want. The project README lists the\n parameters it takes and the headers a deployment needs.\n </p>\n </section>\n\n <section>\n <h3>Talking to the calendar from a script</h3>\n <p>\n Everything the web interface does goes through a documented HTTP API, and so can anything\n else. The <strong>API</strong> button at the top of the page opens the reference, with a\n \"try it out\" button on each endpoint that calls this deployment for real.\n </p>\n <p class=\"muted small\">\n The description is generated from the running service, so it always matches what is actually\n deployed. Machine-readable copies live at\n <a href={apiUrl(\"/openapi.json\")}>openapi.json</a> and\n <a href={apiUrl(\"/openapi.yaml\")}>openapi.yaml</a>, ready for a client generator.\n </p>\n </section>\n\n <section>\n <h3>Signing in</h3>\n {#if session?.authenticated}\n <p>\n You are signed in. <a href={session.logout_url ?? logoutUrl()}>Log out</a> when you\n are done, particularly on a shared machine.\n </p>\n {:else}\n <p>\n <a href={session?.login_url ?? loginUrl()}>Log in</a> with your Apache account. You\n will be sent to the foundation's OAuth service and back again. Nothing is stored here\n beyond your username and the projects and committees you belong to.\n </p>\n {/if}\n <p class=\"muted small\">\n If your affiliations have changed recently and the calendar has not noticed, log out and back\n in; the lists are read when you sign in.\n </p>\n </section>\n\n <footer>\n <button type=\"button\" class=\"btn primary\" onclick={onclose}>Back to the calendar</button>\n </footer>\n </div>\n</div>\n\n<style>\n .help {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n padding: 1.5rem 1rem 4rem;\n }\n\n .sheet {\n max-width: 52rem;\n margin: 0 auto;\n background: var(--bg-panel);\n border: 1px solid var(--border);\n border-radius: var(--radius);\n box-shadow: var(--shadow);\n padding: 1.5rem 1.8rem 1.8rem;\n }\n\n header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 1rem;\n flex-wrap: wrap;\n }\n\n h2 {\n margin: 0;\n font-size: 22px;\n }\n\n h3 {\n margin: 0 0 0.4rem;\n font-size: 15px;\n color: var(--asf-red);\n }\n\n .status {\n margin: 0.6rem 0 0;\n padding: 0.5rem 0.8rem;\n background: var(--bg-subtle);\n border-radius: var(--radius);\n font-size: 13px;\n }\n\n section {\n margin-top: 1.6rem;\n }\n\n p,\n li {\n max-width: 62ch;\n }\n\n ul {\n margin: 0.3rem 0;\n padding-left: 1.2rem;\n }\n\n li {\n margin-bottom: 0.35rem;\n }\n\n dl {\n margin: 0.5rem 0 0;\n }\n\n dt {\n display: flex;\n align-items: center;\n gap: 0.45rem;\n font-weight: 700;\n margin-top: 0.7rem;\n }\n\n dd {\n margin: 0.15rem 0 0 1.4rem;\n max-width: 62ch;\n }\n\n .swatch {\n width: 11px;\n height: 11px;\n border-radius: 3px;\n display: inline-block;\n }\n\n .swatch.personal {\n background: hsl(265 60% 55%);\n }\n\n .swatch.project {\n background: hsl(210 60% 55%);\n }\n\n .swatch.foundation {\n background: hsl(0 60% 55%);\n }\n\n .tablewrap {\n overflow-x: auto;\n margin: 0.6rem 0;\n }\n\n table {\n border-collapse: collapse;\n width: 100%;\n font-size: 13px;\n }\n\n th,\n td {\n border: 1px solid var(--border);\n padding: 0.35rem 0.6rem;\n text-align: center;\n }\n\n thead th {\n background: var(--bg-subtle);\n font-size: 12px;\n }\n\n tbody th {\n text-align: left;\n font-weight: 500;\n white-space: nowrap;\n }\n\n .yes {\n color: hsl(140 60% 35%);\n font-weight: 700;\n }\n\n .no {\n color: var(--text-faint);\n }\n\n .note {\n font-size: 11px;\n color: var(--text-muted);\n }\n\n .small {\n font-size: 12px;\n }\n\n pre {\n margin: 0.4rem 0;\n padding: 0.5rem 0.7rem;\n background: var(--bg-subtle);\n border-radius: var(--radius);\n font-size: 11px;\n overflow-x: auto;\n }\n\n footer {\n margin-top: 2rem;\n padding-top: 1rem;\n border-top: 1px solid var(--border);\n }\n\n @media (prefers-color-scheme: dark) {\n .yes {\n color: hsl(140 50% 60%);\n }\n }\n</style>\n","<script lang=\"ts\">\n import { apiUrl, assetUrl } from \"../lib/base\";\n\n interface Props {\n onclose: () => void;\n }\n\n let { onclose }: Props = $props();\n\n interface SwaggerRequest {\n headers: Record<string, string>;\n credentials?: RequestCredentials;\n }\n\n type SwaggerFactory = (options: Record<string, unknown>) => unknown;\n\n let host = $state<HTMLElement | null>(null);\n let status = $state<\"loading\" | \"ready\" | \"failed\">(\"loading\");\n let failure = $state<string | null>(null);\n\n const SCRIPT = \"vendor/swagger-ui-bundle.js\";\n const STYLES = \"vendor/swagger-ui.css\";\n\n /** Loads a script once, reusing the tag if the docs are opened again. */\n function loadScript(src: string): Promise<void> {\n const existing = document.querySelector<HTMLScriptElement>(`script[data-swagger=\"${src}\"]`);\n if (existing) {\n return existing.dataset.loaded === \"yes\"\n ? Promise.resolve()\n : new Promise((resolve, reject) => {\n existing.addEventListener(\"load\", () => resolve());\n existing.addEventListener(\"error\", () => reject(new Error(src)));\n });\n }\n return new Promise((resolve, reject) => {\n const tag = document.createElement(\"script\");\n tag.src = src;\n tag.async = true;\n tag.dataset.swagger = src;\n tag.addEventListener(\"load\", () => {\n tag.dataset.loaded = \"yes\";\n resolve();\n });\n tag.addEventListener(\"error\", () => reject(new Error(src)));\n document.head.appendChild(tag);\n });\n }\n\n /**\n * Swagger UI's stylesheet has a few rules that are not scoped to its own\n * container, so it is removed again when the docs are closed rather than\n * left to affect the calendar.\n */\n function loadStyles(href: string): HTMLLinkElement {\n const tag = document.createElement(\"link\");\n tag.rel = \"stylesheet\";\n tag.href = href;\n tag.dataset.swagger = \"styles\";\n document.head.appendChild(tag);\n return tag;\n }\n\n $effect(() => {\n if (!host) return;\n const styles = loadStyles(assetUrl(STYLES));\n let cancelled = false;\n\n void (async () => {\n try {\n await loadScript(assetUrl(SCRIPT));\n const factory = (globalThis as { SwaggerUIBundle?: SwaggerFactory }).SwaggerUIBundle;\n if (!factory) throw new Error(\"SwaggerUIBundle did not register itself\");\n if (cancelled || !host) return;\n\n factory({\n url: apiUrl(\"/openapi.json\"),\n domNode: host,\n deepLinking: false,\n docExpansion: \"list\",\n defaultModelsExpandDepth: 1,\n tryItOutEnabled: true,\n persistAuthorization: false,\n supportedSubmitMethods: [\"get\", \"post\", \"put\", \"patch\", \"delete\"],\n requestInterceptor: (request: SwaggerRequest) => {\n // Without this the API answers an unauthenticated write with a\n // redirect to the OAuth provider instead of a readable 401.\n request.headers[\"X-No-Redirect\"] = \"1\";\n // Same origin as the docs page, so a logged-in reader can try the\n // endpoints that need a session.\n request.credentials = \"same-origin\";\n return request;\n },\n });\n status = \"ready\";\n } catch (error) {\n failure =\n error instanceof Error && error.message.includes(SCRIPT)\n ? \"Swagger UI could not be loaded. If this is a development server, run 'npm run build' \" +\n \"in frontend/ so the vendored files are in place.\"\n : \"Swagger UI could not be started.\";\n status = \"failed\";\n }\n })();\n\n return () => {\n cancelled = true;\n styles.remove();\n };\n });\n</script>\n\n<div class=\"docs\">\n <header>\n <div>\n <h2>HTTP API</h2>\n <p class=\"muted\">\n Generated from the running service, so it always describes this deployment. Machine-readable\n copies: <a href={apiUrl(\"/openapi.json\")}>openapi.json</a> and\n <a href={apiUrl(\"/openapi.yaml\")}>openapi.yaml</a>.\n </p>\n </div>\n <button type=\"button\" class=\"btn\" onclick={onclose}>Back to the calendar</button>\n </header>\n\n {#if status === \"loading\"}\n <p class=\"note\">Loading the API documentation...</p>\n {:else if status === \"failed\"}\n <p class=\"note error\" role=\"alert\">{failure}</p>\n {/if}\n\n <div class=\"swagger\" bind:this={host}></div>\n</div>\n\n<style>\n .docs {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n padding: 1.2rem 1rem 4rem;\n }\n\n header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: 1rem;\n flex-wrap: wrap;\n max-width: 72rem;\n margin: 0 auto 0.5rem;\n }\n\n h2 {\n margin: 0;\n font-size: 22px;\n }\n\n header p {\n margin: 0.2rem 0 0;\n font-size: 13px;\n max-width: 60ch;\n }\n\n .note {\n max-width: 72rem;\n margin: 1rem auto;\n color: var(--text-muted);\n }\n\n .note.error {\n color: var(--asf-red);\n }\n\n .swagger {\n max-width: 72rem;\n margin: 0 auto;\n }\n\n /* Swagger UI ships its own white theme. Keeping it on a light card rather\n than fighting it means it stays legible when the calendar is in dark mode. */\n .swagger:not(:empty) {\n background: #fff;\n color: #3b4151;\n border-radius: var(--radius);\n border: 1px solid var(--border);\n overflow: hidden;\n }\n</style>\n","/**\n * Importing an iCalendar file.\n *\n * The file itself is read by the backend, which knows how to cope with what\n * Google, Outlook and Thunderbird produce. What lives here is the decision the\n * backend cannot make: which calendar the events should land in.\n *\n * That decision is deliberately not defaulted. An import can create dozens of\n * events at once, and a wrong default would publish somebody's private meetings\n * or file them under the wrong project, so the form starts with nothing chosen\n * and `importReadiness` reports what is still missing.\n */\n\nimport type { Calendars, Category, Visibility } from \"./types\";\n\n/** An event the backend found in the file, before it is given a calendar. */\nexport interface ImportCandidate {\n title: string;\n start: string;\n end: string;\n all_day: boolean;\n description: string;\n location: string;\n url: string;\n timezone: string;\n uid: string | null;\n /** What the backend had to change to make this event importable. */\n warnings: string[];\n}\n\nexport interface ImportPreview {\n events: ImportCandidate[];\n count: number;\n /** Problems with the file as a whole, such as entries that were skipped. */\n warnings: string[];\n}\n\nexport interface ImportResult {\n created: import(\"./types\").CalendarEvent[];\n count: number;\n warnings: string[];\n}\n\n/** What the form collects. Null means \"not chosen yet\", not \"default\". */\nexport interface ImportSettings {\n category: Category | null;\n project: string | null;\n visibility: Visibility | null;\n}\n\n/** The same thing once every required answer is in. */\nexport interface ResolvedImportSettings {\n category: Category;\n project: string | null;\n visibility: Visibility | null;\n}\n\nexport function emptySettings(): ImportSettings {\n return { category: null, project: null, visibility: null };\n}\n\n/** The calendars this session may import into, in the order to offer them. */\nexport function importableCategories(calendars: Calendars | null): Category[] {\n const can = calendars?.can_create;\n if (!can) return [];\n const categories: Category[] = [];\n if (can.personal) categories.push(\"personal\");\n if (can.project.length > 0) categories.push(\"project\");\n if (can.foundation) categories.push(\"foundation\");\n return categories;\n}\n\n/**\n * The projects that can take an import, which depends on the visibility: a\n * committer can add public events to their projects, but a private one needs\n * the committee.\n */\nexport function importableProjects(\n calendars: Calendars | null,\n visibility: Visibility | null,\n): string[] {\n const can = calendars?.can_create;\n if (!can) return [];\n return visibility === \"private\" ? can.project_private : can.project;\n}\n\nexport function importableVisibilities(\n category: Category | null,\n calendars: Calendars | null,\n): Visibility[] {\n if (category === \"personal\") return [];\n if (category === \"foundation\") return calendars?.can_create.foundation ? [\"public\", \"private\"] : [];\n if (category === \"project\") {\n const can = calendars?.can_create;\n if (!can) return [];\n return can.project_private.length > 0 ? [\"public\", \"private\"] : [\"public\"];\n }\n return [];\n}\n\nexport interface Readiness {\n ready: boolean;\n /** What the reader still has to answer, in words fit for a hint. */\n missing: string[];\n}\n\n/**\n * Whether the form has enough to save, and what is missing if not.\n *\n * Personal events have no project and no visibility to choose - they are\n * always private to their owner - so those are not asked for.\n */\nexport function importReadiness(settings: ImportSettings, calendars: Calendars | null): Readiness {\n const missing: string[] = [];\n\n const categories = importableCategories(calendars);\n if (settings.category === null) {\n missing.push(\"which calendar these events belong to\");\n } else if (!categories.includes(settings.category)) {\n missing.push(\"a calendar you are allowed to add to\");\n }\n\n if (settings.category !== null && settings.category !== \"personal\") {\n if (settings.visibility === null) {\n missing.push(\"whether they are public or private\");\n } else if (!importableVisibilities(settings.category, calendars).includes(settings.visibility)) {\n missing.push(\"a visibility you are allowed to use\");\n }\n }\n\n if (settings.category === \"project\") {\n const projects = importableProjects(calendars, settings.visibility);\n if (settings.project === null) {\n missing.push(\"which project they belong to\");\n } else if (!projects.includes(settings.project)) {\n missing.push(\"a project you are allowed to add to\");\n }\n }\n\n return { ready: missing.length === 0, missing };\n}\n\n/** The settings, once ready, in the shape the API takes. */\nexport function resolveSettings(settings: ImportSettings): ResolvedImportSettings {\n if (settings.category === null) throw new Error(\"resolveSettings called before a category was chosen\");\n return {\n category: settings.category,\n project: settings.category === \"project\" ? settings.project : null,\n visibility: settings.category === \"personal\" ? null : settings.visibility,\n };\n}\n\n/**\n * Keeps the form consistent when the category or visibility changes: a project\n * that is no longer offered should not stay quietly selected.\n */\nexport function reconcile(settings: ImportSettings, calendars: Calendars | null): ImportSettings {\n const next: ImportSettings = { ...settings };\n if (next.category !== \"project\") next.project = null;\n if (next.category === \"personal\") next.visibility = null;\n if (next.category === \"project\" && next.project !== null) {\n if (!importableProjects(calendars, next.visibility).includes(next.project)) next.project = null;\n }\n if (next.visibility !== null && next.category !== null) {\n if (!importableVisibilities(next.category, calendars).includes(next.visibility)) {\n next.visibility = null;\n }\n }\n return next;\n}\n\n/** True if the file looks like something worth sending. */\nexport function looksLikeCalendar(file: File): boolean {\n return /\\.ics$/i.test(file.name) || file.type === \"text/calendar\";\n}\n","<script lang=\"ts\">\n import type { Calendars, Category, Visibility } from \"../lib/types\";\n import type { DisplayZone } from \"../lib/timezone\";\n import type { ImportCandidate, ImportPreview, ImportSettings } from \"../lib/importing\";\n import {\n emptySettings,\n importReadiness,\n importableCategories,\n importableProjects,\n importableVisibilities,\n looksLikeCalendar,\n reconcile,\n resolveSettings,\n } from \"../lib/importing\";\n import { api, ApiError } from \"../lib/api\";\n import { formatDate, formatTime } from \"../lib/dates\";\n import { categoryLabel } from \"../lib/events\";\n import { shortZoneLabel, toWall } from \"../lib/timezone\";\n\n interface Props {\n calendars: Calendars | null;\n /** The clock the reader is using, so the preview matches the calendar. */\n zone?: DisplayZone;\n onclose: () => void;\n /** Called with the number of events created, so the calendar can reload. */\n onimported: (count: number) => void;\n }\n\n let { calendars, zone = \"local\", onclose, onimported }: Props = $props();\n\n let file = $state<File | null>(null);\n let preview = $state<ImportPreview | null>(null);\n let settings = $state<ImportSettings>(emptySettings());\n let reading = $state(false);\n let saving = $state(false);\n let error = $state<string | null>(null);\n let dragging = $state(false);\n\n let categories = $derived(importableCategories(calendars));\n let visibilities = $derived(importableVisibilities(settings.category, calendars));\n let projects = $derived(importableProjects(calendars, settings.visibility));\n let readiness = $derived(importReadiness(settings, calendars));\n let canSave = $derived(preview !== null && preview.count > 0 && readiness.ready && !saving);\n\n function update(change: Partial<ImportSettings>) {\n settings = reconcile({ ...settings, ...change }, calendars);\n }\n\n async function choose(chosen: File | null | undefined) {\n if (!chosen) return;\n file = chosen;\n preview = null;\n error = null;\n reading = true;\n try {\n preview = await api.previewImport(chosen);\n if (!looksLikeCalendar(chosen)) {\n // It parsed, so the name was just unhelpful. Worth knowing, not worth\n // refusing.\n error = null;\n }\n } catch (failure) {\n error = failure instanceof ApiError ? failure.message : \"That file could not be read.\";\n file = null;\n } finally {\n reading = false;\n }\n }\n\n async function save() {\n if (!file || !canSave) return;\n saving = true;\n error = null;\n try {\n const result = await api.runImport(file, resolveSettings(settings));\n onimported(result.count);\n } catch (failure) {\n error = failure instanceof ApiError ? failure.message : \"Those events could not be saved.\";\n } finally {\n saving = false;\n }\n }\n\n function onDrop(event: DragEvent) {\n event.preventDefault();\n dragging = false;\n void choose(event.dataTransfer?.files?.[0]);\n }\n\n function keydown(event: KeyboardEvent) {\n if (event.key === \"Escape\") onclose();\n }\n\n function when(candidate: ImportCandidate): string {\n const start = toWall(new Date(candidate.start), zone);\n if (candidate.all_day) {\n const last = toWall(new Date(new Date(candidate.end).getTime() - 1), zone);\n return last.toDateString() === start.toDateString()\n ? `${formatDate(start)} (all day)`\n : `${formatDate(start)} - ${formatDate(last)} (all day)`;\n }\n const end = toWall(new Date(candidate.end), zone);\n return `${formatDate(start)}, ${formatTime(start)} - ${formatTime(end)} ${shortZoneLabel(zone)}`;\n }\n\n let warningCount = $derived(\n (preview?.warnings.length ?? 0) +\n (preview?.events ?? []).reduce((total, event) => total + event.warnings.length, 0),\n );\n</script>\n\n<svelte:window onkeydown={keydown} />\n\n<!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_static_element_interactions -->\n<div class=\"backdrop\" onclick={onclose}>\n <!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_static_element_interactions -->\n <div\n class=\"dialog\"\n role=\"dialog\"\n tabindex=\"-1\"\n aria-modal=\"true\"\n aria-label=\"Import an iCalendar file\"\n onclick={(event) => event.stopPropagation()}\n >\n <h2>Import events from a calendar file</h2>\n\n {#if error}\n <p class=\"error\" role=\"alert\">{error}</p>\n {/if}\n\n <!-- svelte-ignore a11y_no_static_element_interactions -->\n <div\n class=\"dropzone\"\n class:dragging\n ondragover={(event) => {\n event.preventDefault();\n dragging = true;\n }}\n ondragleave={() => (dragging = false)}\n ondrop={onDrop}\n >\n <label class=\"btn\">\n Choose a file\n <input\n type=\"file\"\n accept=\".ics,text/calendar\"\n onchange={(event) => choose(event.currentTarget.files?.[0])}\n />\n </label>\n <span class=\"muted\">\n {#if file}{file.name}{:else}or drop an .ics file here{/if}\n </span>\n </div>\n\n {#if reading}\n <p class=\"note\">Reading the file...</p>\n {/if}\n\n {#if preview}\n <section class=\"preview\">\n <h3>\n {preview.count}\n {preview.count === 1 ? \"event\" : \"events\"} found\n {#if warningCount > 0}\n <span class=\"muted\">- {warningCount} thing{warningCount === 1 ? \"\" : \"s\"} to note</span>\n {/if}\n </h3>\n\n {#each preview.warnings as warning}\n <p class=\"warning\">{warning}</p>\n {/each}\n\n <!--\n These three lists are unkeyed on purpose. A preview is replaced whole\n or not at all, so there is no identity to preserve across a change,\n and nothing in a file is unique enough to key on: a repeating event\n exported from Google or Outlook repeats its UID on every modified\n occurrence, and two entries can raise word-for-word the same warning.\n -->\n <ul>\n {#each preview.events as candidate}\n <li>\n <span class=\"title\">{candidate.title}</span>\n <span class=\"when\">{when(candidate)}</span>\n {#if candidate.location}<span class=\"where muted\">{candidate.location}</span>{/if}\n {#each candidate.warnings as warning}\n <span class=\"warning inline\">{warning}</span>\n {/each}\n </li>\n {/each}\n </ul>\n </section>\n\n <section class=\"settings\">\n <h3>Where should they go?</h3>\n\n <div class=\"pair\">\n <label class=\"row\">\n <span>Calendar</span>\n <select\n value={settings.category ?? \"\"}\n onchange={(event) =>\n update({ category: (event.currentTarget.value || null) as Category | null })}\n >\n <option value=\"\">Choose...</option>\n {#each categories as category (category)}\n <option value={category}>{categoryLabel(category)}</option>\n {/each}\n </select>\n </label>\n\n {#if settings.category !== null && settings.category !== \"personal\"}\n <label class=\"row\">\n <span>Visibility</span>\n <select\n value={settings.visibility ?? \"\"}\n onchange={(event) =>\n update({ visibility: (event.currentTarget.value || null) as Visibility | null })}\n >\n <option value=\"\">Choose...</option>\n {#each visibilities as visibility (visibility)}\n <option value={visibility}>{visibility}</option>\n {/each}\n </select>\n </label>\n {/if}\n\n {#if settings.category === \"project\"}\n <label class=\"row\">\n <span>Project</span>\n <select\n value={settings.project ?? \"\"}\n onchange={(event) => update({ project: event.currentTarget.value || null })}\n >\n <option value=\"\">Choose...</option>\n {#each projects as project (project)}\n <option value={project}>{project}</option>\n {/each}\n </select>\n </label>\n {/if}\n </div>\n\n {#if settings.category === \"personal\"}\n <p class=\"muted small\">Personal events are always private to you.</p>\n {/if}\n\n {#if !readiness.ready}\n <p class=\"missing\" role=\"status\">\n Still to choose: {readiness.missing.join(\", \")}.\n </p>\n {/if}\n </section>\n {/if}\n\n <footer>\n <span class=\"spacer\"></span>\n <button type=\"button\" class=\"btn\" onclick={onclose} disabled={saving}>Cancel</button>\n <button type=\"button\" class=\"btn primary\" onclick={save} disabled={!canSave}>\n {#if saving}\n Importing...\n {:else if preview}\n Import {preview.count} {preview.count === 1 ? \"event\" : \"events\"}\n {:else}\n Import\n {/if}\n </button>\n </footer>\n </div>\n</div>\n\n<style>\n .backdrop {\n position: fixed;\n inset: 0;\n background: rgba(10, 14, 20, 0.45);\n display: flex;\n align-items: flex-start;\n justify-content: center;\n padding: 3rem 1rem;\n overflow-y: auto;\n z-index: 50;\n }\n\n .dialog {\n width: min(42rem, 100%);\n background: var(--bg-panel);\n border-radius: 10px;\n border-top: 4px solid var(--asf-red);\n box-shadow: var(--shadow-lg);\n padding: 1.2rem 1.4rem 1rem;\n }\n\n h2 {\n margin: 0 0 0.8rem;\n font-size: 19px;\n }\n\n h3 {\n margin: 0 0 0.4rem;\n font-size: 12px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--text-muted);\n }\n\n .error {\n margin: 0 0 0.8rem;\n padding: 0.5rem 0.7rem;\n border-radius: var(--radius);\n background: hsl(0 70% 95%);\n border: 1px solid hsl(0 60% 75%);\n color: hsl(0 65% 30%);\n }\n\n .dropzone {\n display: flex;\n align-items: center;\n gap: 0.7rem;\n padding: 1rem;\n border: 2px dashed var(--border-strong);\n border-radius: var(--radius);\n background: var(--bg-subtle);\n }\n\n .dropzone.dragging {\n border-color: var(--asf-red);\n background: var(--bg-hover);\n }\n\n .dropzone input[type=\"file\"] {\n position: absolute;\n width: 1px;\n height: 1px;\n opacity: 0;\n }\n\n .dropzone label {\n cursor: pointer;\n }\n\n .note {\n margin: 0.7rem 0 0;\n color: var(--text-muted);\n }\n\n .preview,\n .settings {\n margin-top: 1.1rem;\n }\n\n .preview ul {\n list-style: none;\n margin: 0;\n padding: 0;\n max-height: 16rem;\n overflow-y: auto;\n border: 1px solid var(--border);\n border-radius: var(--radius);\n }\n\n .preview li {\n display: flex;\n flex-direction: column;\n gap: 1px;\n padding: 0.4rem 0.6rem;\n border-bottom: 1px solid var(--border);\n }\n\n .preview li:last-child {\n border-bottom: 0;\n }\n\n .title {\n font-weight: 600;\n }\n\n .when {\n font-size: 12px;\n color: var(--text-muted);\n font-variant-numeric: tabular-nums;\n }\n\n .where {\n font-size: 12px;\n }\n\n .warning {\n margin: 0 0 0.4rem;\n font-size: 12px;\n color: hsl(28 70% 30%);\n background: hsl(38 92% 92%);\n border: 1px solid hsl(38 60% 78%);\n border-radius: var(--radius);\n padding: 0.3rem 0.5rem;\n }\n\n .warning.inline {\n margin: 0.2rem 0 0;\n display: block;\n }\n\n .pair {\n display: flex;\n gap: 0.7rem;\n flex-wrap: wrap;\n }\n\n .row {\n display: flex;\n flex-direction: column;\n gap: 0.2rem;\n flex: 1 1 10rem;\n }\n\n .row > span {\n font-size: 11px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--text-muted);\n }\n\n .missing {\n margin: 0.6rem 0 0;\n font-size: 13px;\n color: var(--asf-red);\n }\n\n .small {\n font-size: 12px;\n margin: 0.5rem 0 0;\n }\n\n footer {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin-top: 1.2rem;\n padding-top: 0.8rem;\n border-top: 1px solid var(--border);\n }\n\n .spacer {\n flex: 1;\n }\n\n @media (prefers-color-scheme: dark) {\n .error {\n background: hsl(0 40% 20%);\n border-color: hsl(0 40% 40%);\n color: hsl(0 70% 85%);\n }\n\n .warning {\n background: hsl(38 40% 20%);\n border-color: hsl(38 40% 35%);\n color: hsl(38 80% 82%);\n }\n }\n</style>\n","<script lang=\"ts\">\n import type { CalendarEvent, Calendars, EventDraft, Filters, SessionInfo, ViewName } from \"./lib/types\";\n import { VIEWS } from \"./lib/types\";\n import { api, ApiError } from \"./lib/api\";\n import { rangeForView, startOfDay, step } from \"./lib/dates\";\n import { applyFilters, defaultFilters, projectsInPlay, sortEvents } from \"./lib/filters\";\n import { canCreateAnything, canEdit, draftFromEvent, newDraft } from \"./lib/drafts\";\n import type { DisplayZone } from \"./lib/timezone\";\n import {\n LOCAL,\n UTC,\n fromWall,\n normaliseZone,\n nowInZone,\n toWall,\n uniqueZones,\n } from \"./lib/timezone\";\n import { appPath, withoutBase } from \"./lib/base\";\n\n import Header from \"./components/Header.svelte\";\n import FilterPanel from \"./components/FilterPanel.svelte\";\n import MonthView from \"./components/MonthView.svelte\";\n import WeekView from \"./components/WeekView.svelte\";\n import YearView from \"./components/YearView.svelte\";\n import AgendaView from \"./components/AgendaView.svelte\";\n import EventDialog from \"./components/EventDialog.svelte\";\n import HelpPage from \"./components/HelpPage.svelte\";\n import ApiDocs from \"./components/ApiDocs.svelte\";\n import ImportDialog from \"./components/ImportDialog.svelte\";\n\n const VIEW_STORAGE_KEY = \"asf-calendar-view\";\n const ZONE_STORAGE_KEY = \"asf-calendar-zone\";\n const ALT_ZONE_STORAGE_KEY = \"asf-calendar-alt-zone\";\n const COMPARE_ZONES_STORAGE_KEY = \"asf-calendar-compare-zones\";\n /** More than three extra clocks and the week grid has no room left for days. */\n const MAX_COMPARE_ZONES = 3;\n const SHORTLINK_PATTERN = /^\\/e\\/([A-Za-z0-9]+)\\/?$/;\n const HELP_PATH = \"/help\";\n const DOCS_PATH = \"/docs\";\n\n /** The current browser path with the deployment's mount point removed. */\n function routePath(): string | null {\n return withoutBase(globalThis.location?.pathname ?? \"/\");\n }\n\n function stored(key: string): string | null {\n try {\n return globalThis.localStorage?.getItem(key) ?? null;\n } catch {\n return null;\n }\n }\n\n function remember(key: string, value: string): void {\n try {\n globalThis.localStorage?.setItem(key, value);\n } catch {\n // Private browsing, or storage turned off. Not worth complaining about.\n }\n }\n\n function initialView(): ViewName {\n const saved = stored(VIEW_STORAGE_KEY);\n return (VIEWS as readonly string[]).includes(saved ?? \"\") ? (saved as ViewName) : \"month\";\n }\n\n function initialZone(): DisplayZone {\n return normaliseZone(stored(ZONE_STORAGE_KEY), LOCAL);\n }\n\n /** The zone the picker is parked on. UTC until the visitor picks another. */\n function initialAlternateZone(): DisplayZone {\n const saved = normaliseZone(stored(ALT_ZONE_STORAGE_KEY), UTC);\n return saved === LOCAL ? UTC : saved;\n }\n\n function initialCompareZones(): DisplayZone[] {\n const saved = stored(COMPARE_ZONES_STORAGE_KEY);\n if (!saved) return [];\n return uniqueZones(\n saved\n .split(\",\")\n .map((name) => normaliseZone(name, \"\"))\n .filter((name): name is DisplayZone => Boolean(name)),\n ).slice(0, MAX_COMPARE_ZONES);\n }\n\n /** True once the visitor has expressed a preference of their own. */\n function hasChosenZone(): boolean {\n return Boolean(stored(ZONE_STORAGE_KEY));\n }\n\n let view = $state<ViewName>(initialView());\n let zone = $state<DisplayZone>(initialZone());\n let alternateZone = $state<DisplayZone>(initialAlternateZone());\n let compareZones = $state<DisplayZone[]>(initialCompareZones());\n // The cursor is a wall date: its local getters read as the display zone.\n let cursor = $state<Date>(startOfDay(nowInZone(initialZone())));\n let helpOpen = $state<boolean>(routePath() === HELP_PATH);\n let docsOpen = $state<boolean>(routePath() === DOCS_PATH);\n let events = $state<CalendarEvent[]>([]);\n let session = $state<SessionInfo | null>(null);\n let calendars = $state<Calendars | null>(null);\n let filters = $state<Filters>(defaultFilters(null));\n\n let loading = $state(false);\n let saving = $state(false);\n let loadError = $state<string | null>(null);\n let dialogError = $state<string | null>(null);\n let showFilters = $state(true);\n\n let selected = $state<CalendarEvent | null>(null);\n let draft = $state<EventDraft | null>(null);\n let importing = $state(false);\n\n let range = $derived(rangeForView(view, cursor));\n let knownProjects = $derived(projectsInPlay(events, calendars));\n let visible = $derived(sortEvents(applyFilters(events, filters, knownProjects), filters.sort, zone));\n let title = $derived(calendars?.title ?? \"ASF Community Calendar\");\n let editable = $derived(selected ? canEdit(selected, calendars) : false);\n let feedUrl = $derived(\n api.feedUrl({\n start: fromWall(range.start, zone),\n end: fromWall(range.end, zone),\n categories: [...filters.categories],\n visibility: filters.visibility,\n q: filters.search || undefined,\n }),\n );\n\n // ---- loading ------------------------------------------------------------\n\n async function loadIdentity() {\n try {\n const [who, cals] = await Promise.all([api.session(), api.calendars()]);\n session = who;\n calendars = cals;\n // Everything the user belongs to is on by default.\n filters = defaultFilters(cals);\n // The deployment can say which clock to open on; the visitor's own\n // choice, once made, always wins.\n if (!hasChosenZone()) zone = normaliseZone(cals.default_display_zone, zone);\n } catch (error) {\n loadError = error instanceof ApiError ? error.message : String(error);\n }\n }\n\n let loadToken = 0;\n\n async function loadEvents(from: Date, to: Date) {\n const token = ++loadToken;\n loading = true;\n try {\n const found = await api.events({ start: from, end: to });\n // A slow earlier request must not overwrite a newer result.\n if (token === loadToken) {\n events = found;\n loadError = null;\n }\n } catch (error) {\n if (token === loadToken) loadError = error instanceof ApiError ? error.message : String(error);\n } finally {\n if (token === loadToken) loading = false;\n }\n }\n\n $effect(() => {\n // The grid works in wall time; the API works in instants.\n const from = fromWall(range.start, zone);\n const to = fromWall(range.end, zone);\n void loadEvents(from, to);\n });\n\n $effect(() => {\n remember(VIEW_STORAGE_KEY, view);\n });\n\n $effect(() => {\n remember(ZONE_STORAGE_KEY, zone);\n });\n\n $effect(() => {\n remember(ALT_ZONE_STORAGE_KEY, alternateZone);\n });\n\n $effect(() => {\n remember(COMPARE_ZONES_STORAGE_KEY, compareZones.join(\",\"));\n });\n\n\n // ---- shortlink routing --------------------------------------------------\n\n async function openFromLocation() {\n const path = routePath();\n if (path === null) return; // Not a URL this app is mounted on.\n helpOpen = path === HELP_PATH;\n docsOpen = path === DOCS_PATH;\n const match = SHORTLINK_PATTERN.exec(path);\n if (!match) return;\n try {\n const event = await api.byShortlink(match[1]);\n selected = event;\n cursor = startOfDay(toWall(new Date(event.start), zone));\n } catch (error) {\n loadError =\n error instanceof ApiError && error.needsLogin\n ? \"That event is not public. Log in to see whether you have access.\"\n : \"That shortlink does not point at an event you can see.\";\n }\n }\n\n /** Pushes a route, in app terms: navigate(\"/help\") -> /calendar/help. */\n function navigate(path: string) {\n if (!globalThis.history) return;\n const target = appPath(path);\n if (globalThis.location.pathname !== target) globalThis.history.pushState({}, \"\", target);\n }\n\n function pushShortlink(event: CalendarEvent | null) {\n if (!globalThis.location) return;\n if (!event) {\n navigate(\"/\");\n return;\n }\n // The backend builds shortlink_url with the mount point already in it, so\n // push its path as-is rather than prefixing it a second time.\n const path = new URL(event.shortlink_url, globalThis.location.href).pathname;\n if (globalThis.location.pathname !== path) globalThis.history.pushState({}, \"\", path);\n }\n\n $effect(() => {\n void openFromLocation();\n const onPop = () => void openFromLocation();\n globalThis.addEventListener?.(\"popstate\", onPop);\n return () => globalThis.removeEventListener?.(\"popstate\", onPop);\n });\n\n void loadIdentity();\n\n // ---- actions ------------------------------------------------------------\n\n function selectEvent(event: CalendarEvent) {\n selected = event;\n draft = null;\n dialogError = null;\n pushShortlink(event);\n }\n\n function closeDialog() {\n selected = null;\n draft = null;\n dialogError = null;\n pushShortlink(null);\n }\n\n function startCreate(when: Date = nowInZone(zone)) {\n selected = null;\n dialogError = null;\n helpOpen = false;\n docsOpen = false;\n // The form is filled in from the wall clock the user is looking at.\n draft = newDraft(fromWall(when, zone), calendars);\n }\n\n function startImport() {\n selected = null;\n draft = null;\n dialogError = null;\n helpOpen = false;\n docsOpen = false;\n importing = true;\n }\n\n async function finishImport(count: number) {\n importing = false;\n // The imported events may be anywhere in time, so reload the window rather\n // than trying to splice them in.\n await loadEvents(fromWall(range.start, zone), fromWall(range.end, zone));\n loadError = count === 0 ? \"Nothing was imported.\" : null;\n }\n\n function startEdit() {\n if (selected) draft = draftFromEvent(selected);\n }\n\n async function save(next: EventDraft) {\n saving = true;\n dialogError = null;\n try {\n const saved = selected ? await api.update(selected.id, next) : await api.create(next);\n events = [...events.filter((event) => event.id !== saved.id), saved];\n selected = saved;\n draft = null;\n pushShortlink(saved);\n } catch (error) {\n dialogError = error instanceof ApiError ? error.message : String(error);\n } finally {\n saving = false;\n }\n }\n\n async function remove() {\n if (!selected) return;\n if (!globalThis.confirm?.(`Delete \"${selected.title}\"? This cannot be undone.`)) return;\n saving = true;\n dialogError = null;\n try {\n await api.remove(selected.id);\n events = events.filter((event) => event.id !== selected!.id);\n closeDialog();\n } catch (error) {\n dialogError = error instanceof ApiError ? error.message : String(error);\n } finally {\n saving = false;\n }\n }\n\n function goToDay(day: Date) {\n cursor = startOfDay(day);\n view = \"day\";\n }\n\n function goToMonth(month: Date) {\n cursor = startOfDay(month);\n view = \"month\";\n }\n\n /**\n * Switching the display zone keeps the date you are looking at. You asked to\n * see March 10th in UTC, not \"whatever March 10th local becomes in UTC\".\n */\n function setZone(next: DisplayZone) {\n zone = next;\n // A clock cannot usefully be compared against itself.\n compareZones = uniqueZones(compareZones, next);\n }\n\n function setCompareZones(next: DisplayZone[]) {\n compareZones = uniqueZones(next, zone).slice(0, MAX_COMPARE_ZONES);\n }\n\n function toggleHelp() {\n helpOpen = !helpOpen;\n if (helpOpen) docsOpen = false;\n navigate(helpOpen ? HELP_PATH : \"/\");\n }\n\n function toggleDocs() {\n docsOpen = !docsOpen;\n if (docsOpen) helpOpen = false;\n navigate(docsOpen ? DOCS_PATH : \"/\");\n }\n</script>\n\n<div class=\"layout\">\n <Header\n {title}\n {view}\n {cursor}\n {session}\n {loading}\n canCreate={canCreateAnything(calendars)}\n {zone}\n {alternateZone}\n {helpOpen}\n {docsOpen}\n onview={(next) => {\n view = next;\n helpOpen = false;\n docsOpen = false;\n }}\n onstep={(direction) => (cursor = step(view, cursor, direction))}\n ontoday={() => (cursor = startOfDay(nowInZone(zone)))}\n oncreate={() => startCreate(cursor)}\n onimport={startImport}\n ontogglefilters={() => (showFilters = !showFilters)}\n onzone={setZone}\n onalternatezone={(next) => (alternateZone = next)}\n onhelp={toggleHelp}\n ondocs={toggleDocs}\n />\n\n {#if loadError}\n <p class=\"banner\" role=\"alert\">\n {loadError}\n <button type=\"button\" class=\"btn\" onclick={() => (loadError = null)}>Dismiss</button>\n </p>\n {/if}\n\n <div class=\"body\">\n {#if helpOpen}\n <HelpPage {calendars} {session} {zone} {compareZones} onclose={toggleHelp} />\n {:else if docsOpen}\n <ApiDocs onclose={toggleDocs} />\n {:else}\n {#if showFilters}\n <FilterPanel\n {filters}\n {calendars}\n projects={knownProjects}\n {view}\n {feedUrl}\n {zone}\n {compareZones}\n maxCompareZones={MAX_COMPARE_ZONES}\n onchange={(next) => (filters = next)}\n oncomparezones={setCompareZones}\n />\n {/if}\n\n <main>\n {#if view === \"month\"}\n <MonthView {cursor} events={visible} {zone} onselect={selectEvent} onpickday={goToDay} />\n {:else if view === \"week\"}\n <WeekView\n {cursor}\n events={visible}\n {zone}\n {compareZones}\n onselect={selectEvent}\n onpickday={goToDay}\n />\n {:else if view === \"day\"}\n <WeekView\n {cursor}\n events={visible}\n {zone}\n {compareZones}\n days={1}\n onselect={selectEvent}\n onpickday={goToDay}\n />\n {:else if view === \"year\"}\n <YearView {cursor} events={visible} {zone} onpickday={goToDay} onpickmonth={goToMonth} />\n {:else}\n <AgendaView events={visible} {zone} {compareZones} onselect={selectEvent} />\n {/if}\n </main>\n {/if}\n </div>\n</div>\n\n{#if importing}\n <ImportDialog\n {calendars}\n {zone}\n onclose={() => (importing = false)}\n onimported={finishImport}\n />\n{/if}\n\n{#if selected || draft}\n <EventDialog\n event={selected}\n {draft}\n {calendars}\n {saving}\n error={dialogError}\n {editable}\n {zone}\n {compareZones}\n onclose={closeDialog}\n onedit={startEdit}\n onsave={save}\n ondelete={remove}\n />\n{/if}\n\n<style>\n .layout {\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .body {\n display: flex;\n flex: 1;\n min-height: 0;\n }\n\n main {\n flex: 1;\n min-width: 0;\n min-height: 0;\n display: flex;\n flex-direction: column;\n }\n\n .banner {\n display: flex;\n align-items: center;\n gap: 0.7rem;\n margin: 0;\n padding: 0.5rem 0.9rem;\n background: hsl(38 92% 92%);\n border-bottom: 1px solid hsl(38 60% 70%);\n color: hsl(28 70% 25%);\n }\n\n @media (prefers-color-scheme: dark) {\n .banner {\n background: hsl(38 40% 20%);\n border-color: hsl(38 40% 35%);\n color: hsl(38 80% 82%);\n }\n }\n\n @media (max-width: 60rem) {\n .body {\n position: relative;\n }\n }\n</style>\n","/**\n * The embeddable agenda.\n *\n * A stripped-down list of upcoming events, meant to be dropped into another\n * site in an iframe: no header, no filter panel, no editing. Everything it\n * shows is driven by query parameters, so a site can ask for \"the next ten\n * httpd events\" without any JavaScript of its own.\n *\n * Session cookies are SameSite=Strict, so a cross-site iframe never carries\n * one. An embed is always an anonymous view, which means public events only.\n * That is the intended behaviour rather than a limitation to work around: a\n * page on someone else's site should not be able to show private events.\n */\n\nimport type { Category } from \"./types\";\nimport { CATEGORIES } from \"./types\";\nimport { LOCAL, isKnownZone, normaliseZone } from \"./timezone\";\nimport type { DisplayZone } from \"./timezone\";\nimport { withoutBase } from \"./base\";\n\n/** The route the embed is served from, relative to the app's mount point. */\nexport const EMBED_PATH = \"/embed/agenda\";\n\nexport const DEFAULT_DAYS = 60;\nexport const DEFAULT_LIMIT = 20;\nconst MAX_DAYS = 366;\nconst MAX_LIMIT = 100;\n\nexport type EmbedTheme = \"auto\" | \"light\" | \"dark\";\n\nexport interface EmbedOptions {\n /** Categories to include. Empty means all of them. */\n categories: Category[];\n /** Projects to include. Empty means all the viewer can see. */\n projects: string[];\n /** How far ahead to look, in days. */\n days: number;\n /** How many events to show at most. */\n limit: number;\n search: string;\n zone: DisplayZone;\n /** Heading above the list, or null for none. */\n title: string | null;\n /** Whether to say which clock the times are on. */\n showZone: boolean;\n /** Drop the panel background so the host page shows through. */\n transparent: boolean;\n theme: EmbedTheme;\n /** Whether to show the \"ASF Community Calendar\" link at the foot. */\n showCredit: boolean;\n}\n\nexport function isEmbedRoute(pathname: string): boolean {\n const route = withoutBase(pathname);\n return route === EMBED_PATH || route === `${EMBED_PATH}/`;\n}\n\nfunction clamp(value: number, low: number, high: number): number {\n return Math.min(high, Math.max(low, value));\n}\n\nfunction numberParam(params: URLSearchParams, name: string, fallback: number, low: number, high: number): number {\n const raw = params.get(name);\n if (raw === null || raw.trim() === \"\") return fallback;\n const parsed = Number(raw);\n if (!Number.isFinite(parsed)) return fallback;\n return clamp(Math.trunc(parsed), low, high);\n}\n\nfunction booleanParam(params: URLSearchParams, name: string, fallback: boolean): boolean {\n const raw = params.get(name);\n if (raw === null) return fallback;\n if (raw === \"\") return true; // ?transparent with no value means yes\n return ![\"0\", \"false\", \"no\", \"off\"].includes(raw.trim().toLowerCase());\n}\n\n/** Collects a filter that may be repeated or comma-separated. */\nfunction listParam(params: URLSearchParams, ...names: string[]): string[] {\n const collected: string[] = [];\n for (const name of names) {\n for (const raw of params.getAll(name)) {\n collected.push(...raw.split(\",\").map((piece) => piece.trim()));\n }\n }\n return collected.filter(Boolean);\n}\n\nexport function parseEmbedOptions(search: string): EmbedOptions {\n const params = new URLSearchParams(search.startsWith(\"?\") ? search.slice(1) : search);\n\n const categories = listParam(params, \"category\", \"categories\")\n .map((name) => name.toLowerCase())\n .filter((name): name is Category => (CATEGORIES as readonly string[]).includes(name));\n\n const themeRaw = (params.get(\"theme\") ?? \"auto\").toLowerCase();\n const theme: EmbedTheme = themeRaw === \"light\" || themeRaw === \"dark\" ? themeRaw : \"auto\";\n\n const zoneRaw = params.get(\"zone\");\n const zone = zoneRaw && (zoneRaw.toLowerCase() === LOCAL || isKnownZone(zoneRaw))\n ? normaliseZone(zoneRaw, LOCAL)\n : LOCAL;\n\n const title = params.get(\"title\");\n\n return {\n categories,\n projects: listParam(params, \"project\", \"projects\").map((name) => name.toLowerCase()),\n days: numberParam(params, \"days\", DEFAULT_DAYS, 1, MAX_DAYS),\n limit: numberParam(params, \"limit\", DEFAULT_LIMIT, 1, MAX_LIMIT),\n search: params.get(\"q\")?.trim() ?? \"\",\n zone,\n title: title === null ? null : title.trim() || null,\n showZone: booleanParam(params, \"showzone\", true),\n transparent: booleanParam(params, \"transparent\", false),\n theme,\n showCredit: booleanParam(params, \"credit\", true),\n };\n}\n\n/**\n * The message the embed posts to whatever page is framing it, so the host can\n * size the iframe to its content. Sent with a \"*\" target origin because we do\n * not know who is embedding us; it carries nothing but a pixel height.\n */\nexport const HEIGHT_MESSAGE = \"asf-calendar-embed:height\";\n\nexport interface HeightMessage {\n type: typeof HEIGHT_MESSAGE;\n height: number;\n}\n\nexport function heightMessage(height: number): HeightMessage {\n return { type: HEIGHT_MESSAGE, height: Math.ceil(height) };\n}\n","<script lang=\"ts\">\n import type { CalendarEvent } from \"../lib/types\";\n import { api, ApiError } from \"../lib/api\";\n import { addDays, formatTime, startOfDay, MONTH_NAMES, WEEKDAY_NAMES } from \"../lib/dates\";\n import { agendaSections, calendarLabel, eventEnd, eventHue, eventStart } from \"../lib/events\";\n import { describeDisplayZone, nowInZone, shortZoneLabel } from \"../lib/timezone\";\n import { appPath } from \"../lib/base\";\n import { heightMessage, parseEmbedOptions } from \"../lib/embed\";\n\n interface Props {\n /** The query string to configure from. Defaults to the current URL's. */\n search?: string;\n }\n\n let { search = globalThis.location?.search ?? \"\" }: Props = $props();\n\n let options = $derived(parseEmbedOptions(search));\n\n let events = $state<CalendarEvent[]>([]);\n let loading = $state(true);\n let failure = $state<string | null>(null);\n\n let sections = $derived(agendaSections(events, options.zone));\n let root = $state<HTMLElement | null>(null);\n\n async function load() {\n loading = true;\n const from = startOfDay(nowInZone(options.zone));\n try {\n events = await api.events({\n start: from,\n end: addDays(from, options.days),\n categories: options.categories,\n projects: options.projects,\n q: options.search || undefined,\n sort: \"start\",\n limit: options.limit,\n });\n failure = null;\n } catch (error) {\n failure =\n error instanceof ApiError\n ? error.message\n : \"The calendar could not be reached.\";\n } finally {\n loading = false;\n }\n }\n\n $effect(() => {\n void options;\n void load();\n });\n\n // Let the host page size its iframe to the content. An iframe cannot do this\n // for itself, so we measure and tell whoever is framing us.\n $effect(() => {\n if (!root) return;\n // Re-measure whenever the content changes, not only when the box does.\n void sections;\n void loading;\n\n const send = () => {\n const height = Math.max(\n root?.scrollHeight ?? 0,\n globalThis.document?.documentElement?.scrollHeight ?? 0,\n );\n globalThis.parent?.postMessage(heightMessage(height), \"*\");\n };\n send();\n\n // Everything current has ResizeObserver, but the first measurement above\n // should not depend on it.\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(send);\n observer.observe(root);\n return () => observer.disconnect();\n });\n\n function dayHeading(date: Date): string {\n const weekday = WEEKDAY_NAMES[(date.getDay() + 6) % 7];\n return `${weekday} ${date.getDate()} ${MONTH_NAMES[date.getMonth()]}`;\n }\n\n function when(event: CalendarEvent): string {\n if (event.all_day) return \"All day\";\n return `${formatTime(eventStart(event, options.zone))} - ${formatTime(eventEnd(event, options.zone))}`;\n }\n</script>\n\n<div\n bind:this={root}\n class=\"embed\"\n class:transparent={options.transparent}\n data-theme={options.theme === \"auto\" ? null : options.theme}\n>\n {#if options.title}\n <h1>{options.title}</h1>\n {/if}\n\n {#if loading}\n <p class=\"note\">Loading events...</p>\n {:else if failure}\n <p class=\"note error\" role=\"alert\">{failure}</p>\n {:else if sections.length === 0}\n <p class=\"note\">No events coming up.</p>\n {:else}\n {#each sections as section (section.key)}\n <section>\n <h2>{dayHeading(section.date)}</h2>\n <ul>\n {#each section.events as event (event.id)}\n <li style=\"--hue: {eventHue(event)}\">\n <a href={event.shortlink_url} target=\"_blank\" rel=\"noopener noreferrer\">\n <span class=\"when\">{when(event)}</span>\n <span class=\"title\">{event.title}</span>\n </a>\n <span class=\"meta\">\n <span class=\"tag\">{calendarLabel(event)}</span>\n {#if event.location}<span class=\"where\">{event.location}</span>{/if}\n </span>\n </li>\n {/each}\n </ul>\n </section>\n {/each}\n {/if}\n\n {#if options.showZone && !loading && !failure}\n <p class=\"zone\" title={describeDisplayZone(options.zone)}>\n Times shown in {shortZoneLabel(options.zone)}\n </p>\n {/if}\n\n {#if options.showCredit}\n <p class=\"credit\">\n <a href={appPath(\"/\")} target=\"_blank\" rel=\"noopener noreferrer\">ASF Community Calendar</a>\n </p>\n {/if}\n</div>\n\n<style>\n .embed {\n padding: 0.75rem;\n background: var(--bg-panel);\n color: var(--text);\n font-size: 13px;\n }\n\n .embed.transparent {\n background: transparent;\n }\n\n h1 {\n margin: 0 0 0.6rem;\n font-size: 15px;\n font-weight: 700;\n }\n\n h2 {\n margin: 0.9rem 0 0.25rem;\n font-size: 11px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--text-muted);\n border-bottom: 1px solid var(--border);\n padding-bottom: 0.2rem;\n }\n\n section:first-of-type h2 {\n margin-top: 0;\n }\n\n ul {\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n li {\n border-left: 3px solid hsl(var(--hue) 55% 55%);\n padding: 0.25rem 0 0.25rem 0.5rem;\n margin: 0.25rem 0;\n }\n\n a {\n display: flex;\n gap: 0.5rem;\n align-items: baseline;\n color: inherit;\n text-decoration: none;\n }\n\n a:hover .title {\n text-decoration: underline;\n }\n\n .when {\n flex: none;\n width: 6.5rem;\n color: var(--text-muted);\n font-variant-numeric: tabular-nums;\n font-size: 12px;\n }\n\n .title {\n font-weight: 600;\n }\n\n .meta {\n display: flex;\n gap: 0.4rem;\n padding-left: 7rem;\n font-size: 11px;\n color: var(--text-faint);\n }\n\n .tag {\n text-transform: lowercase;\n }\n\n .note {\n margin: 0.5rem 0;\n color: var(--text-muted);\n }\n\n .note.error {\n color: var(--asf-red);\n }\n\n .zone,\n .credit {\n margin: 0.6rem 0 0;\n font-size: 11px;\n color: var(--text-faint);\n }\n\n .credit a {\n color: var(--text-faint);\n text-decoration: underline;\n }\n\n @media (max-width: 24rem) {\n a {\n flex-wrap: wrap;\n }\n\n .when {\n width: auto;\n }\n\n .meta {\n padding-left: 0;\n }\n }\n</style>\n","import { mount } from \"svelte\";\nimport App from \"./App.svelte\";\nimport EmbedAgenda from \"./components/EmbedAgenda.svelte\";\nimport { isEmbedRoute } from \"./lib/embed\";\nimport \"./app.css\";\n\nconst target = document.getElementById(\"app\");\nif (!target) throw new Error(\"No #app element to mount into\");\n\n// The embed is a different, much smaller app: no header, no filters, no\n// session. Choosing here rather than inside App keeps it from firing off the\n// session and calendar requests it has no use for.\nfunction start() {\n if (!isEmbedRoute(globalThis.location?.pathname ?? \"/\")) {\n return mount(App, { target: target! });\n }\n document.documentElement.classList.add(\"embedded\");\n return mount(EmbedAgenda, { target: target! });\n}\n\nexport default start();\n"],"names":["DEV","is_array","index_of","includes","array_from","define_property","get_descriptor","get_descriptors","object_prototype","array_prototype","get_prototype_of","is_extensible","noop","run_all","arr","i","deferred","resolve","reject","promise","res","rej","DERIVED","EFFECT","RENDER_EFFECT","MANAGED_EFFECT","BLOCK_EFFECT","BRANCH_EFFECT","ROOT_EFFECT","BOUNDARY_EFFECT","PAUSED","CONNECTED","CLEAN","DIRTY","MAYBE_DIRTY","INERT","DESTROYED","REACTION_RAN","DESTROYING","EFFECT_TRANSPARENT","EAGER_EFFECT","HEAD_EFFECT","EFFECT_PRESERVED","USER_EFFECT","EFFECT_OFFSCREEN","WAS_MARKED","REACTION_IS_UPDATING","ASYNC","ERROR_VALUE","STATE_SYMBOL","COMPONENT_SYMBOL","LEGACY_PROPS","LOADING_ATTR_SYMBOL","ATTRIBUTES_CACHE","CLASS_CACHE","STYLE_CACHE","TEXT_CACHE","FORM_RESET_HANDLER","STALE_REACTION","IS_XHTML","EACH_ITEM_REACTIVE","EACH_INDEX_REACTIVE","EACH_IS_CONTROLLED","EACH_IS_ANIMATED","EACH_ITEM_IMMUTABLE","PROPS_IS_IMMUTABLE","PROPS_IS_UPDATED","PROPS_IS_BINDABLE","PROPS_IS_LAZY_INITIAL","TEMPLATE_FRAGMENT","TEMPLATE_USE_IMPORT_NODE","UNINITIALIZED","NAMESPACE_HTML","derived_inert","select_multiple_invalid_value","svelte_boundary_reset_noop","equals","value","safe_not_equal","a","b","safe_equals","async_derived_orphan","each_key_duplicate","effect_in_teardown","rune","effect_in_unowned_derived","effect_orphan","effect_update_depth_exceeded","props_invalid_value","key","state_descriptors_fixed","state_prototype_fixed","state_unsafe_mutation","svelte_boundary_reset_onerror","tracing_mode_flag","component_context","set_component_context","context","push","props","runes","fn","active_effect","pop","component","effects","create_user_effect","mark_as_component","is_runes","micro_tasks","run_micro_tasks","tasks","queue_micro_task","is_flushing_sync","flush_tasks","STATUS_MASK","set_signal_status","signal","status","update_derived_status","derived","clear_marked","deps","dep","defer_effect","effect","dirty_effects","maybe_dirty_effects","is_store_binding","capture_store_binding","previous_is_store_binding","listening_to_form_reset","add_form_reset_listener","evt","e","without_reactive_context","previous_reaction","active_reaction","previous_effect","set_active_reaction","set_active_effect","listen_to_event_and_reset_event","element","event","handler","on_reset","prev","flatten","blockers","sync","async","d","pending","deriveds","parent","restore","capture","blocker_promise","finish","error","invoke_error_boundary","unset_context","decrement_pending","increment_pending","run","expression","async_derived","previous_component_context","previous_batch","current_batch","activate_batch","deactivate_batch","boundary","batch","blocking","flags","OBSOLETE","label","location","e.async_derived_orphan","source","should_suspend","deferreds","async_effect","internal_set","teardown","fulfil","next","p","go","user_derived","push_reaction_value","derived_safe_equal","destroy_derived_effects","destroy_effect","execute_derived","prev_active_effect","is_destroying_effect","w.derived_inert","update_reaction","update_derived","increment_write_version","batch_values","effect_tracking","freeze_derived_effects","remove_reactions","destroy_effect_children","unfreeze_derived_effects","update_effect","first_batch","last_batch","last_scheduled_effect","is_processing","collected_effects","legacy_updates","flush_count","uid","Batch","#started","#prev","#next","#commit_callbacks","#discard_callbacks","#pending","#blocking_pending","#deferred","#roots","#new_effects","#dirty_effects","#maybe_dirty_effects","#skipped_branches","#unskipped_branches","#decrement_queued","#is_deferred","skipped","callback","tracked","#process","#unlink","infinite_loop_guard","roots","render_effects","updates","root","#traverse","reset_all","#defer_effects","t","reset_branch","earlier_batch","#find_earlier_batch","#merge","flush_queued_effects","next_batch","r","old_values","is_branch","is_skippable_branch","skip","is_dirty","child","is_derived","mark","reactions","reaction","#commit","is_earlier","sources","batch_value","current","others","unskipped","marked","checked","mark_effects","current_unequal","c","v1","v2","depends_on","blocking_pending_count","flushSync","was_flushing_sync","result","e.effect_update_depth_exceeded","eager_block_effects","length","unlink_effect","ordered_effects","ancestor","j","schedule_effect","depends","eager_effects","eager_effects_deferred","v","stack","state","s","mutable_source","initial_value","immutable","trackable","set","should_proxy","untracking","current_sources","e.state_unsafe_mutation","new_value","proxy","updated_during_traversal","mark_reactions","untracked_writes","set_untracked_writes","flush_eager_effects","dirty","increment","not_dirty","prototype","is_proxied_array","version","parent_version","update_version","with_parent","set_update_version","_","prop","descriptor","e.state_descriptors_fixed","target","receiver","exists","get","has","other_s","ls","n","own_keys","e.state_prototype_fixed","get_proxied_value","is","$window","is_firefox","first_child_getter","next_sibling_getter","init_operations","element_prototype","node_prototype","text_prototype","create_text","get_first_child","node","get_next_sibling","is_text","first_child","first","only_child","sibling","count","next_sibling","clear_text_content","should_defer_append","create_element","tag","namespace","handle_error","validate_effect","e.effect_orphan","e.effect_in_unowned_derived","e.effect_in_teardown","push_effect","parent_effect","parent_last","create_effect","type","user_effect","defer","component_root","options","pause_effect","render_effect","template_effect","values","block","branch","execute_effect_teardown","previously_destroying_effect","set_is_destroying_effect","remove_dom","controller","destroy_block_effect_children","removed","remove_effect_dom","transitions","transition","end","destroy","pause_children","remaining","check","local","transparent","resume_effect","resume_children","move_effect","fragment","is_updating_effect","new_deps","skipped_deps","write_version","read_version","dependencies","dependency","schedule_possible_effect_self_invalidation","previous_deps","previous_skipped_deps","previous_untracked_writes","previous_sources","previous_untracking","previous_update_version","update_dependencies","is_fork","remove_reaction","index","new_length","start_index","was_updating_effect","tick","destroyed","depends_on_old_values","should_connect","is_new","reconnect","untrack","PASSIVE_EVENTS","is_passive_event","name","event_symbol","all_registered_events","root_event_handles","create_event","event_name","dom","target_handler","handle_event_propagation","passive","delegated","delegate","events","last_propagated_event","last_propagated_event_clear_scheduled","handler_element","owner_document","path","current_target","path_idx","handled_at","at_idx","handler_idx","throw_error","other_errors","policy","html","create_trusted_html","create_fragment_from_html","elem","assign_nodes","start","from_html","content","is_fragment","use_import_node","has_start","clone","text","comment","frag","anchor","append","createSubscriber","subscribers","stop","children","transform_error","Boundary","#anchor","#hydrate_open","#props","#children","#effect","#main_effect","#pending_effect","#failed_effect","#offscreen_fragment","#local_pending_count","#pending_count","#pending_count_update_queued","#effect_pending","#effect_pending_subscriber","#render","#hydrate_resolved_content","#hydrate_failed_content","failed","reset","invoke_onerror","#create_reset","did_reset","calling_on_error","w.svelte_boundary_reset_noop","e.svelte_boundary_reset_onerror","#run","err","#hydrate_pending_content","handled","#resolve","previous_ctx","#update_pending_count","#handle_error","handle_error_result","transformed_error","set_text","str","mount","_mount","listeners","Component","intro","transformError","unmount","anchor_node","ctx","registered_events","event_handle","counts","mounted_components","BranchManager","#batches","#onscreen","#offscreen","#outroing","#transition","onscreen","offscreen","k","on_destroy","#discard","keys","if_block","elseif","branches","update_branch","has_branch","pause_effects","to_destroy","controlled_anchor","group","groups","destroy_effects","fast_path","parent_node","preserved_effects","offscreen_anchor","each","get_collection","get_key","render_fn","fallback_fn","items","is_controlled","fallback","each_array","collection","array","first_run","commit","reconcile","move","discard","item","create_item","e.each_key_duplicate","skip_to_branch","is_animated","seen","to_animate","matched","stashed","link","destroy_length","dest","next_node","whitespace","to_class","hash","directives","classname","len","to_style","styles","set_class","is_html","prev_classes","next_classes","next_class_name","is_present","set_style","prev_styles","next_styles","next_style_attr","set_selected","option","selected","apply_default_select_value","select","preserve","multiple","option_value","get_option_value","select_option","mounting","w.select_multiple_invalid_value","init_select","observer","entries","is_selectedcontent_mutation","bind_select_value","batches","is_reset","query","selected_option","entry","nodes","IS_CUSTOM_ELEMENT","IS_HTML","PROGRESS_TAG","set_value","attributes","get_attributes","set_checked","set_attribute","attribute","skip_warning","get_setters","setters_cache","cache_key","setters","descriptors","proto","element_proto","bind_value","input","is_numberlike_input","to_number","bind_checked","is_bound_this","bound_value","element_or_component","bind_this","update","get_value","get_parts","component_effect","old_parts","parts","original_teardown","bindable","lazy","fallback_value","fallback_dirty","fallback_signal","get_fallback","setter","is_entry_props","is_store_sub","e.props_invalid_value","getter","legacy_parent","mutation","overridden","PUBLIC_VERSION","CATEGORIES","VIEWS","basePath","baseUrl","href","appPath","suffix","apiUrl","assetUrl","withoutBase","pathname","prefix","DEFAULT_OAUTH_PATH","loginUrl","returnTo","logoutUrl","ApiError","message","field","request","method","body","isUpload","response","parsed","details","buildQuery","params","stamp","category","project","encoded","api","id","token","draft","file","settings","MINUTE","HOUR","WEEKDAY_NAMES","MONTH_NAMES","WEEK_STARTS_ON","startOfDay","date","copy","endOfDay","addDays","addMonths","targetDay","lastDay","daysInMonth","addYears","year","month","startOfWeek","weekStartsOn","shift","startOfMonth","startOfYear","isSameDay","isToday","now","isWeekend","day","monthGrid","weekDays","yearMonths","january","rangeForView","view","cursor","grid","step","direction","dayKey","fromDayKey","formatTime","formatDate","formatMonthYear","formatViewTitle","days","last","toLocalInput","toDateInput","parseISO","toISO","LOCAL","UTC","isLocal","zone","resolveZone","browserZone","localOffsetMs","instant","formatters","partsFormatter","timeZone","formatter","zoneOffsetMs","part","toWallInZone","wall","attempt","corrected","fromWallInZone","toWall","fromWall","nowInZone","offsetLabel","offsetMs","sign","total","hours","minutes","zoneAbbreviation","zoneCity","segments","zoneLabel","at","offset","abbreviation","describeDisplayZone","resolved","shortZoneLabel","explainDisplayZone","MAJOR_ZONES","majorZones","isKnownZone","zoneList","supported","names","normaliseZone","uniqueZones","zones","primary","kept","hourLabels","other","_unused","hour","eventStart","eventEnd","durationMs","overlaps","from","to","occursOnDay","groupByDay","buckets","order","displayComparator","bucket","compareForDisplay","byStart","byLength","MINIMUM_HEIGHT","layoutDay","dayStart","dayEnd","span","placed","cluster","clusterEnd","closeCluster","columns","taken","column","allDayEvents","agendaSections","sections","calendarLabel","PROJECT_HUES","projectHue","eventHue","categoryLabel","defaultFilters","calendars","matches","filters","knownProjects","needle","applyFilters","sortEvents","sort","sorted","projectsInPlay","toggle","DEFAULT_LENGTH_MS","defaultCategory","can","canCreateAnything","newDraft","when","timezone","draftFromEvent","canEdit","$.derived","localLabel","$.get","pick","chosen","div","root_2","button","$.child","$.sibling","optgroup","root_1","$$anchor","$.init_select","span_1","classes","$.set_class","$0","$.set_attribute","$1","$2","classes_1","$3","$4","select_value","$.select_option","$$props","$.delegated","heading","header","root_5","img","h1","div_1","button_1","div_2","button_2","button_3","h2","div_3","$.each","button_4","text_2","$.only_child","$.append","TimezoneSwitch","node_1","div_4","button_5","button_6","button_7","$.first_child","button_8","$$args","fragment_1","$.set_text","text_3","a_1","root_4","$$render","consequent_2","alternate","classes_2","maxCompareZones","$.prop","setCategory","setProject","allProjects","on","alreadyShown","canAddMore","addCompareZone","removeCompareZone","candidate","aside","root_10","section","label_1","input_1","$.set_checked","$.set_style","section_1","root_3","h3","label_2","input_2","span_2","span_3","consequent_1","section_2","label_3","option_1","option_2","section_3","label_4","select_1","option_3","option_4","option_5","option_6","select_1_value","section_4","node_3","strong","ul","root_6","li","span_4","consequent_3","label_5","root_9","select_2","option_7","option_8","root_7","option_8_value","node_7","root_8","option_9","option_9_value","consequent_5","section_5","$.set_value","variant","showTime","hue","time","consequent","mouseEvent","VISIBLE_PER_DAY","dayEvents","div_5","EventChip","compareZones","HOURS","allDayRows","hasAllDay","row","laidOut","gutters","labels","node_4","_other","node_5","div_6","div_7","node_6","div_8","div_9","$.template_effect","classes_3","div_10","node_8","div_11","span_5","span_6","classes_5","classes_4","MAX_DOTS","dotsFor","months","inMonth","dots","alsoAt","also","node_2","text_6","text_4","ZONES","form","$.state","lastDraft","$.user_effect","$.set","creatableCategories","list","projectOptions","visibilityOptions","onCategoryChange","submit","submitEvent","keydown","keyEvent","copyShortlink","whenLabel","otherReadings","rows","add","setStart","allDay","dateParts","setEnd","inputValue","iso","dateValue","exclusiveEnd","shifted","onTimezoneChange","startWall","endWall","root_16","form_1","option_1_value","option_2_value","$.bind_select_value","$$value","option_3_value","select_3","option_4_value","select_3_value","changeEvent","label_6","input_3","consequent_4","label_7","input_4","input_5","alternate_1","label_8","input_6","label_9","input_7","label_10","textarea","footer","text_1","$.event","$.bind_value","$.bind_checked","article","root_15","h2_1","p_1","text_10","reading","text_12","text_13","consequent_8","p_2","root_11","consequent_9","p_3","root_12","consequent_10","p_4","root_13","consequent_11","p_5","node_11","p_6","footer_1","a_2","root_14","node_12","consequent_7","consequent_13","COLUMNS","ROWS","embedExample","youAre","bits","table","thead","tr","th","tbody","tr_1","th_1","$.index","cell","td","strong_1","text_5","li_1","strong_2","pre","a_3","host","failure","SCRIPT","STYLES","loadScript","src","existing","loadStyles","cancelled","factory","emptySettings","importableCategories","categories","importableProjects","visibility","importableVisibilities","importReadiness","missing","projects","resolveSettings","looksLikeCalendar","preview","$.proxy","saving","dragging","visibilities","readiness","canSave","change","choose","save","onDrop","warningCount","warning","text_8","node_10","option_5_value","select_2_value","consequent_6","VIEW_STORAGE_KEY","ZONE_STORAGE_KEY","ALT_ZONE_STORAGE_KEY","COMPARE_ZONES_STORAGE_KEY","MAX_COMPARE_ZONES","SHORTLINK_PATTERN","HELP_PATH","DOCS_PATH","routePath","stored","remember","initialView","saved","initialZone","initialAlternateZone","initialCompareZones","hasChosenZone","alternateZone","helpOpen","docsOpen","session","loading","loadError","dialogError","showFilters","importing","range","visible","title","editable","feedUrl","loadIdentity","who","cals","loadToken","loadEvents","found","openFromLocation","match","navigate","pushShortlink","onPop","selectEvent","closeDialog","startCreate","startImport","finishImport","startEdit","remove","goToDay","goToMonth","setZone","setCompareZones","toggleHelp","toggleDocs","Header","HelpPage","ApiDocs","FilterPanel","main","MonthView","WeekView","YearView","AgendaView","ImportDialog","EventDialog","EMBED_PATH","DEFAULT_DAYS","DEFAULT_LIMIT","MAX_DAYS","MAX_LIMIT","isEmbedRoute","route","clamp","low","high","numberParam","raw","booleanParam","listParam","collected","piece","parseEmbedOptions","search","themeRaw","theme","zoneRaw","HEIGHT_MESSAGE","heightMessage","height","load","send","dayHeading","EmbedAgenda","App"],"mappings":"ssBAAA,MAAAA,GAAe,GCER,IAAIC,GAAW,MAAM,QACjBC,GAAW,MAAM,UAAU,QAC3BC,GAAW,MAAM,UAAU,SAC3BC,GAAa,MAAM,KAEnBC,GAAkB,OAAO,eACzBC,GAAiB,OAAO,yBACxBC,GAAkB,OAAO,0BACzBC,GAAmB,OAAO,UAC1BC,GAAkB,MAAM,UACxBC,GAAmB,OAAO,eAC1BC,GAAgB,OAAO,aAW3B,MAAMC,GAAO,IAAM,CAAC,EAoBpB,SAASC,GAAQC,EAAK,CAC5B,QAASC,EAAI,EAAGA,EAAID,EAAI,OAAQC,IAC/BD,EAAIC,CAAC,EAAC,CAER,CAMO,SAASC,IAAW,CAE1B,IAAIC,EAGAC,EAGAC,EAAU,IAAI,QAAQ,CAACC,EAAKC,IAAQ,CACvCJ,EAAUG,EACVF,EAASG,CACV,CAA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AAiB,GAHpCiM,GAAM6vB,GAAK,CAAE,OAAA97B,GAAiB,CAIzC,CAEe0I,GAAA","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43]} \ No newline at end of file
diff --git a/frontend/dist/index.html b/frontend/dist/index.html index fef2bf9..1cc4c21 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html
@@ -16,7 +16,7 @@ name="description" content="Personal, project and foundation events across the Apache Software Foundation." /> - <script type="module" crossorigin src="./assets/index-DwsHFb2B.js"></script> + <script type="module" crossorigin src="./assets/index-RGVtRUlj.js"></script> <link rel="stylesheet" crossorigin href="./assets/index-CXgtmuq1.css"> </head> <body>
diff --git a/frontend/src/components/ImportDialog.svelte b/frontend/src/components/ImportDialog.svelte index 1ace122..3486cac 100644 --- a/frontend/src/components/ImportDialog.svelte +++ b/frontend/src/components/ImportDialog.svelte
@@ -166,17 +166,24 @@ {/if} </h3> - {#each preview.warnings as warning (warning)} + {#each preview.warnings as warning} <p class="warning">{warning}</p> {/each} + <!-- + These three lists are unkeyed on purpose. A preview is replaced whole + or not at all, so there is no identity to preserve across a change, + and nothing in a file is unique enough to key on: a repeating event + exported from Google or Outlook repeats its UID on every modified + occurrence, and two entries can raise word-for-word the same warning. + --> <ul> - {#each preview.events as candidate, index (candidate.uid ?? index)} + {#each preview.events as candidate} <li> <span class="title">{candidate.title}</span> <span class="when">{when(candidate)}</span> {#if candidate.location}<span class="where muted">{candidate.location}</span>{/if} - {#each candidate.warnings as warning (warning)} + {#each candidate.warnings as warning} <span class="warning inline">{warning}</span> {/each} </li>
diff --git a/frontend/src/tests/importdialog.test.ts b/frontend/src/tests/importdialog.test.ts index 84b28bf..75979e1 100644 --- a/frontend/src/tests/importdialog.test.ts +++ b/frontend/src/tests/importdialog.test.ts
@@ -4,12 +4,13 @@ import { fireEvent, render, screen, waitFor, within } from "@testing-library/svelte"; import ImportDialog from "../components/ImportDialog.svelte"; +import type { ImportCandidate } from "../lib/importing"; import { makeCalendars, makeEvent } from "./factories"; const noop = () => {}; const fetchMock = vi.fn(); -const CANDIDATE = { +const CANDIDATE: ImportCandidate = { title: "Community call", start: "2026-07-10T13:00:00Z", end: "2026-07-10T14:00:00Z", @@ -19,7 +20,7 @@ url: "", timezone: "Europe/Berlin", uid: "1@t", - warnings: [] as string[], + warnings: [], }; function respond(body: unknown, status = 200) { @@ -29,7 +30,7 @@ }); } -function previewOf(events = [CANDIDATE], warnings: string[] = []) { +function previewOf(events: ImportCandidate[] = [CANDIDATE], warnings: string[] = []) { return { events, count: events.length, warnings }; } @@ -153,6 +154,45 @@ expect(screen.getByText(/1 thing to note/)).toBeInTheDocument(); }); + it("renders recurrence overrides, which all carry the parent event's UID", async () => { + // A repeating event exported from Google or Outlook is one VEVENT with an + // RRULE plus one per modified occurrence, and every one of them repeats the + // same UID. Keying the list on the UID made a real file crash the dialog. + const override = { ...CANDIDATE, title: "Community call (moved)" }; + fetchMock.mockResolvedValue(respond(previewOf([CANDIDATE, override]))); + const { container } = render(ImportDialog, { props: props() }); + await attach(container); + await waitFor(() => expect(screen.getByText("2 events found")).toBeInTheDocument()); + expect(screen.getByText("Community call (moved)")).toBeInTheDocument(); + }); + + it("renders events with no UID at all", async () => { + const anonymous = { ...CANDIDATE, uid: null }; + fetchMock.mockResolvedValue( + respond(previewOf([anonymous, { ...anonymous, title: "ApacheCon" }])), + ); + const { container } = render(ImportDialog, { props: props() }); + await attach(container); + await waitFor(() => expect(screen.getByText("2 events found")).toBeInTheDocument()); + expect(screen.getByText("ApacheCon")).toBeInTheDocument(); + }); + + it("repeats a warning the file raises twice", async () => { + const twice = ["Two entries were skipped.", "Two entries were skipped."]; + fetchMock.mockResolvedValue(respond(previewOf([CANDIDATE], twice))); + const { container } = render(ImportDialog, { props: props() }); + await attach(container); + await waitFor(() => expect(screen.getAllByText("Two entries were skipped.")).toHaveLength(2)); + }); + + it("repeats a warning one event raises twice", async () => { + const noisy = { ...CANDIDATE, warnings: ["Something was cut short.", "Something was cut short."] }; + fetchMock.mockResolvedValue(respond(previewOf([noisy]))); + const { container } = render(ImportDialog, { props: props() }); + await attach(container); + await waitFor(() => expect(screen.getAllByText("Something was cut short.")).toHaveLength(2)); + }); + it("reports a file it cannot read", async () => { fetchMock.mockResolvedValue( respond({ error: "That does not look like an iCalendar (.ics) file.", field: "file" }, 400),