`);function d(o,d){r(d,!1);let f=()=>n(l,`$token`,p),[p,m]=t();a(()=>{f()&&c(`/admin`)}),i(),s(o,u()),e(),m()}export{d as component};
\ No newline at end of file
diff --git a/frontend/.svelte-kit/output/client/_app/immutable/nodes/4.DmI7a2Dc.js b/frontend/.svelte-kit/output/client/_app/immutable/nodes/4.DmI7a2Dc.js
deleted file mode 100644
index c24e10d..0000000
--- a/frontend/.svelte-kit/output/client/_app/immutable/nodes/4.DmI7a2Dc.js
+++ /dev/null
@@ -1 +0,0 @@
-import{$ as e,B as t,D as n,F as r,I as i,J as a,L as o,M as s,R as c,T as l,V as u,Y as d,_ as f,b as p,d as m,f as h,g,h as _,j as v,n as y,v as b,w as x,x as S,y as C}from"../chunks/egdMPJ-g.js";import"../chunks/BMRk7WTg.js";import{t as w}from"../chunks/DNBIa2Bh.js";var T=S(``),E=S(`
Loading sessions...
`),D=S(``),O=S(``),k=S(` `,1),A=S(` `,1),j=S(`
`),M=S(`
No slots scheduled.
`),N=S(`
`),P=S(``),F=S(`
Admin Dashboard
`,1);function I(x,S){d(S,!0);let I=u(c([])),L=u(null),R=u(c([])),z=u(!1);y(async()=>{t(z,!0);try{t(I,await w.admin.courses.list(),!0),n(I).length>0&&t(L,n(I)[0].id,!0)}catch(e){console.error(e)}finally{t(z,!1)}}),s(()=>{n(L)!==null&&B(n(L))});async function B(e){t(z,!0);try{t(R,await w.admin.sessions.list(e),!0)}catch(e){console.error(e)}finally{t(z,!1)}}async function V(e,t){try{await w.admin.slots.updateStatus(e,t),n(L)&&B(n(L))}catch(e){alert(e)}}function H(e){let t=`${window.location.origin}/s/${e}`;navigator.clipboard.writeText(t),alert(`Link copied to clipboard`)}var U=F(),W=o(i(U),2),G=o(r(W),2);_(G,21,()=>n(I),g,(t,i)=>{var a=T(),o=r(a);e(a);var s={};v(()=>{b(o,`${n(i).name??``} (${n(i).semester??``})`),s!==(s=n(i).id)&&(a.value=(a.__value=n(i).id)??``)}),C(t,a)}),e(G),e(W);var K=o(W,2),q=e=>{C(e,E())},J=t=>{var a=P();_(a,21,()=>n(R),g,(t,a)=>{var s=N(),c=r(s),u=r(c);e(c);var d=o(c,2),m=r(d),y=t=>{var s=p();_(i(s),17,()=>n(a).slots,g,(t,a)=>{var s=j(),c=r(s),u=r(c),d=r(u,!0);e(u);var p=o(u,2),m=r(p);e(p);var g=o(p,2),_=t=>{var i=D(),o=r(i,!0);e(i),v(()=>b(o,n(a).code)),C(t,i)};f(g,e=>{n(a).code&&e(_)}),e(c);var y=o(c,2),x=r(y),S=e=>{var t=O();l(`click`,t,()=>V(n(a).id,`open`)),C(e,t)},w=e=>{var t=k(),r=i(t),s=o(r,2),c=o(s,2);l(`click`,r,()=>H(n(a).code)),l(`click`,s,()=>V(n(a).id,`locked`)),l(`click`,c,()=>V(n(a).id,`closed`)),C(e,t)},T=e=>{var t=A(),r=i(t),s=o(r,2);l(`click`,r,()=>V(n(a).id,`open`)),l(`click`,s,()=>V(n(a).id,`closed`)),C(e,t)};f(x,e=>{n(a).status===`closed`?e(S):n(a).status===`open`?e(w,1):n(a).status===`locked`&&e(T,2)}),e(y),e(s),v(()=>{h(u,1,`status-badge ${n(a).status??``}`,`svelte-1jef3w8`),b(d,n(a).status),b(m,`${n(a).start_time??``} - ${n(a).end_time??``}`)}),C(t,s)}),C(t,s)},x=e=>{C(e,M())};f(m,e=>{n(a).slots&&n(a).slots.length>0?e(y):e(x,-1)}),e(d),e(s),v(()=>b(u,`Week ${n(a).week_nr??``} - ${n(a).date??``}`)),C(t,s)}),e(a),C(t,a)};f(K,e=>{n(z)&&n(R).length===0?e(q):e(J,-1)}),m(G,()=>n(L),e=>t(L,e)),C(x,U),a()}x([`click`]);export{I as component};
\ No newline at end of file
diff --git a/frontend/.svelte-kit/output/client/_app/immutable/nodes/5.CFS15qnw.js b/frontend/.svelte-kit/output/client/_app/immutable/nodes/5.CFS15qnw.js
deleted file mode 100644
index c6343af..0000000
--- a/frontend/.svelte-kit/output/client/_app/immutable/nodes/5.CFS15qnw.js
+++ /dev/null
@@ -1 +0,0 @@
-import{$ as e,B as t,D as n,F as r,H as i,I as a,J as o,L as s,M as c,R as l,T as u,V as d,Y as f,_ as p,d as m,f as h,g,h as _,j as v,n as y,v as b,w as x,x as S,y as C}from"../chunks/egdMPJ-g.js";import"../chunks/BMRk7WTg.js";import{t as w}from"../chunks/DNBIa2Bh.js";var T=S(``),E=S(``),D=S(``),O=S(`
`),k=S(`
`),A=S(`
`),j=S(`
Student
`),M=S(`
Loading matrix...
`),N=S(`
Attendance Matrix
`,1);function P(x,S){f(S,!0);let P=d(l([])),F=d(null),I=d(l([])),L=d(null),R=d(null);y(async()=>{t(P,await w.admin.courses.list(),!0),n(P).length>0&&t(F,n(P)[0].id,!0)}),c(()=>{n(F)&&w.admin.sessions.list(n(F)).then(e=>{t(I,e,!0),n(I).length>0&&t(L,n(I)[0].id,!0)})}),c(()=>{n(L)&&w.admin.sessions.getAttendance(n(L)).then(e=>t(R,e,!0))});async function z(e,r){if(!n(R))return;let i=n(R).attendances.find(t=>t.slot_id===e&&t.student_id===r);try{i?await w.admin.slots.deleteAttendance(e,r):await w.admin.slots.addAttendance(e,r),t(R,await w.admin.sessions.getAttendance(n(L)),!0)}catch(e){alert(e)}}var B=N(),V=s(a(B),2),H=r(V);_(H,21,()=>n(P),g,(t,i)=>{var a=T(),o=r(a,!0);e(a);var s={};v(()=>{b(o,n(i).name),s!==(s=n(i).id)&&(a.value=(a.__value=n(i).id)??``)}),C(t,a)}),e(H);var U=s(H,2),W=i=>{var a=D();_(a,21,()=>n(I),g,(t,i)=>{var a=E(),o=r(a);e(a);var s={};v(()=>{b(o,`Week ${n(i).week_nr??``} (${n(i).date??``})`),s!==(s=n(i).id)&&(a.value=(a.__value=n(i).id)??``)}),C(t,a)}),e(a),m(a,()=>n(L),e=>t(L,e)),C(i,a)};p(U,e=>{n(I).length>0&&e(W)}),e(V);var G=s(V,2),K=t=>{var a=j(),o=r(a),c=r(o),l=r(c);_(s(r(l)),17,()=>n(R).slots,g,(t,i)=>{var a=O(),o=r(a,!0);e(a),v(()=>b(o,n(i).start_time)),C(t,a)}),e(l),e(c);var d=s(c);_(d,21,()=>n(R).students,g,(t,a)=>{var o=A(),c=r(o),l=r(c,!0);e(c),_(s(c),17,()=>n(R).slots,g,(t,o)=>{let s=i(()=>n(R).attendances.some(e=>e.slot_id===n(o).id&&e.student_id===n(a).id));var c=k();let l;var d=r(c,!0);e(c),v(()=>{l=h(c,1,`cell svelte-190s2eg`,null,l,{present:n(s)}),b(d,n(s)?`✓`:``)}),u(`click`,c,()=>z(n(o).id,n(a).id)),C(t,c)}),e(o),v(()=>b(l,n(a).name)),C(t,o)}),e(d),e(o),e(a),C(t,a)},q=e=>{C(e,M())};p(G,e=>{n(R)?e(K):e(q,-1)}),m(H,()=>n(F),e=>t(F,e)),C(x,B),o()}x([`click`]);export{P as component};
\ No newline at end of file
diff --git a/frontend/.svelte-kit/output/client/_app/immutable/nodes/6.yU_a9j7E.js b/frontend/.svelte-kit/output/client/_app/immutable/nodes/6.yU_a9j7E.js
deleted file mode 100644
index 34bfd1a..0000000
--- a/frontend/.svelte-kit/output/client/_app/immutable/nodes/6.yU_a9j7E.js
+++ /dev/null
@@ -1 +0,0 @@
-import{$ as e,B as t,D as n,E as r,F as i,H as a,I as o,J as s,L as c,M as l,Q as u,R as d,T as f,V as p,Y as m,_ as h,c as g,f as _,g as v,h as y,j as b,l as x,n as S,s as C,v as w,w as T,x as E,y as D}from"../chunks/egdMPJ-g.js";import"../chunks/BMRk7WTg.js";import{t as O}from"../chunks/DNBIa2Bh.js";var k=E(`
`),A=E(`
`),j=E(`
Import CSV (name header):
ID
Name
Actions
`,1),M=E(`
Select a course to manage students.
`),N=E(`
Courses & Students
Manage Courses
`,1);function P(T,E){m(E,!0);let P=p(d([])),F=p(null),I=p(d([])),L=p(``),R=p(``),z=p(``);S(async()=>{await B()});async function B(){t(P,await O.admin.courses.list(),!0),n(P).length>0&&n(F)===null&&t(F,n(P)[0].id,!0)}l(()=>{n(F)!==null&&V(n(F))});async function V(e){t(I,await O.admin.courses.listStudents(e),!0)}async function H(){try{let e=await O.admin.courses.create(n(L),n(R));t(L,``),t(R,``),await B(),t(F,e.id,!0)}catch(e){alert(e)}}async function U(){if(n(F))try{await O.admin.courses.addStudent(n(F),n(z)),t(z,``),await V(n(F))}catch(e){alert(e)}}async function W(e){if(confirm(`Are you sure?`))try{await O.admin.students.delete(e),n(F)&&await V(n(F))}catch(e){alert(e)}}let G;async function ee(){if(!(!n(F)||!G.files?.[0]))try{await O.admin.courses.importStudents(n(F),G.files[0]),await V(n(F)),G.value=``}catch(e){alert(e)}}var K=N(),q=c(o(K),2),J=i(q),Y=c(i(J),2),X=i(Y);x(X);var Z=c(X,2);x(Z),u(2),e(Y);var Q=c(Y,2);y(Q,21,()=>n(P),v,(r,a)=>{var o=k();let s;var l=i(o),u=i(l,!0);e(l);var d=c(l);e(o),b(()=>{s=_(o,1,`course-item svelte-nbog41`,null,s,{selected:n(F)===n(a).id}),w(u,n(a).name),w(d,` (${n(a).semester??``})`)}),f(`click`,o,()=>t(F,n(a).id,!0)),D(r,o)}),e(Q),e(J);var $=c(J,2),te=i($),ne=s=>{let l=a(()=>n(P).find(e=>e.id===n(F)));var d=j(),p=o(d),m=i(p);e(p);var h=c(p,2),_=i(h),S=i(_);x(S),u(2),e(_);var T=c(_,2),E=c(i(T),2);C(E,e=>G=e,()=>G),e(T),e(h);var O=c(h,2),k=c(i(O));y(k,21,()=>n(I),v,(t,r)=>{var a=A(),o=i(a),s=i(o,!0);e(o);var l=c(o),u=i(l,!0);e(l);var d=c(l),p=i(d);e(d),e(a),b(()=>{w(s,n(r).id),w(u,n(r).name)}),f(`click`,p,()=>W(n(r).id)),D(t,a)}),e(k),e(O),b(()=>w(m,`Students in ${n(l)?.name??``}`)),r(`submit`,_,U),g(S,()=>n(z),e=>t(z,e)),f(`change`,E,ee),D(s,d)},re=e=>{D(e,M())};h(te,e=>{n(F)?e(ne):e(re,-1)}),e($),e(q),r(`submit`,Y,H),g(X,()=>n(L),e=>t(L,e)),g(Z,()=>n(R),e=>t(R,e)),D(T,K),s()}T([`click`,`change`]);export{P as component};
\ No newline at end of file
diff --git a/frontend/.svelte-kit/output/client/_app/immutable/nodes/7.CN50pfZX.js b/frontend/.svelte-kit/output/client/_app/immutable/nodes/7.CN50pfZX.js
deleted file mode 100644
index 33a0c12..0000000
--- a/frontend/.svelte-kit/output/client/_app/immutable/nodes/7.CN50pfZX.js
+++ /dev/null
@@ -1 +0,0 @@
-import{$ as e,B as t,D as n,F as r,I as i,J as a,L as o,M as s,R as c,T as l,V as u,Y as d,_ as f,d as p,g as m,h,j as g,n as _,v,w as y,x as b,y as x}from"../chunks/egdMPJ-g.js";import"../chunks/BMRk7WTg.js";import{t as S}from"../chunks/DNBIa2Bh.js";var C=b(``),w=b(`
`),T=b(`
Full Attendance Matrix
All weeks, all students, includes bonus point calculation.
Weekly Exports
`,1),E=b(`
Export Data
Global
Full Database Backup
Download the latest SQLite database file.
Per Course
`,1);function D(y,b){d(b,!0);let D=u(c([])),O=u(null),k=u(c([]));_(async()=>{t(D,await S.admin.courses.list(),!0),n(D).length>0&&t(O,n(D)[0].id,!0)}),s(()=>{n(O)&&S.admin.sessions.list(n(O)).then(e=>t(k,e,!0))});var A=E(),j=o(i(A),2),M=r(j),N=o(r(M),2),P=o(r(N),4);e(N),e(M);var F=o(M,2),I=o(r(F),2);h(I,21,()=>n(D),m,(t,i)=>{var a=C(),o=r(a,!0);e(a);var s={};g(()=>{v(o,n(i).name),s!==(s=n(i).id)&&(a.value=(a.__value=n(i).id)??``)}),x(t,a)}),e(I);var L=o(I,2),R=t=>{var a=T(),s=i(a),c=o(r(s),4),u=r(c),d=o(u,2);e(c),e(s);var f=o(s,4);h(f,21,()=>n(k),m,(t,i)=>{var a=w(),s=r(a),c=r(s);e(s);var u=o(s,2),d=r(u),f=o(d,2);e(u),e(a),g(()=>v(c,`Week ${n(i).week_nr??``} (${n(i).date??``})`)),l(`click`,d,()=>window.open(S.admin.export.sessionCsv(n(i).id),`_blank`)),l(`click`,f,()=>window.open(S.admin.export.sessionMd(n(i).id),`_blank`)),x(t,a)}),e(f),l(`click`,u,()=>window.open(S.admin.export.courseCsv(n(O)),`_blank`)),l(`click`,d,()=>window.open(S.admin.export.courseMd(n(O)),`_blank`)),x(t,a)};f(L,e=>{n(O)&&e(R)}),e(F),e(j),l(`click`,P,()=>window.open(S.admin.export.backup(),`_blank`)),p(I,()=>n(O),e=>t(O,e)),x(y,A),a()}y([`click`]);export{D as component};
\ No newline at end of file
diff --git a/frontend/.svelte-kit/output/client/_app/immutable/nodes/8.Bs7k9fxR.js b/frontend/.svelte-kit/output/client/_app/immutable/nodes/8.Bs7k9fxR.js
deleted file mode 100644
index 933a881..0000000
--- a/frontend/.svelte-kit/output/client/_app/immutable/nodes/8.Bs7k9fxR.js
+++ /dev/null
@@ -1 +0,0 @@
-import{$ as e,B as t,D as n,F as r,H as i,I as a,J as o,L as s,M as c,P as l,R as u,T as d,V as f,Y as p,_ as m,c as ee,d as h,g,h as _,j as v,n as y,v as b,w as x,x as S,y as C}from"../chunks/egdMPJ-g.js";import"../chunks/BMRk7WTg.js";import{t as w}from"../chunks/DNBIa2Bh.js";import{t as T}from"../chunks/BYEkGdSH.js";var E=S(``),te=S(``),ne=S(``),D=S(` `,1),re=S(`
Select a seat occupied by a student to leave a note.
`),O=S(`
`,1),k=S(`
Click a seat on the map to add or view notes.
`),A=S(`
`),ie=S(`
Seat Notes
Recent Notes
`,1);function j(x,S){p(S,!0);let j=f(u([])),M=f(null),N=f(u([])),P=f(null),F=f(u([])),I=f(null),L=f(u([])),R=f(u([])),z=f(u([])),B=f(u([]));y(async()=>{t(j,await w.admin.courses.list(),!0),n(j).length>0&&t(M,n(j)[0].id,!0)}),c(()=>{n(M)&&(w.admin.sessions.list(n(M)).then(e=>{t(N,e,!0),n(N).length>0&&t(P,n(N)[0].id,!0)}),w.admin.courses.listStudents(n(M)).then(e=>t(z,e,!0)))}),c(()=>{n(P)&&(t(F,n(N).find(e=>e.id===n(P))?.slots||[],!0),n(F).length>0&&t(I,n(F)[0].id,!0))}),c(()=>{if(n(I)){let e=n(F).find(e=>e.id===n(I));e?.room_id?w.admin.rooms.get(e.room_id).then(e=>t(L,e.layout,!0)):t(L,[],!0),w.admin.slots.getNotes(n(I)).then(e=>t(R,e,!0)),w.admin.sessions.getAttendance(n(P)).then(e=>{t(B,e.attendances.filter(e=>e.slot_id===n(I)),!0)})}});let V=f(null),H=f(``);function ae(e){if(e.type!==`seat`)return;t(V,e.id,!0);let r=n(B).find(t=>t.seat_id===e.id)?.student_id;r?t(H,n(R).find(e=>e.student_id===r)?.content||``,!0):t(H,``)}async function oe(){if(!n(I)||!n(V))return;let e=n(B).find(e=>e.seat_id===n(V))?.student_id;if(!e){alert(`No student at this seat`);return}try{await w.admin.slots.upsertNote(n(I),e,n(H)),t(R,await w.admin.slots.getNotes(n(I)),!0),t(V,null)}catch(e){alert(e)}}let U=i(()=>{let e={};return n(B).forEach(t=>{if(t.seat_id){let r=n(z).find(e=>e.id===t.student_id);e[t.seat_id]=r?.name||`Unknown`}}),e}),se=i(()=>n(B).map(e=>e.seat_id).filter(e=>e!==null));var W=ie(),G=s(a(W),2),K=r(G);_(K,21,()=>n(j),g,(t,i)=>{var a=E(),o=r(a,!0);e(a);var s={};v(()=>{b(o,n(i).name),s!==(s=n(i).id)&&(a.value=(a.__value=n(i).id)??``)}),C(t,a)}),e(K);var q=s(K,2);_(q,21,()=>n(N),g,(t,i)=>{var a=te(),o=r(a);e(a);var s={};v(()=>{b(o,`Week ${n(i).week_nr??``}`),s!==(s=n(i).id)&&(a.value=(a.__value=n(i).id)??``)}),C(t,a)}),e(q);var J=s(q,2);_(J,21,()=>n(F),g,(t,i)=>{var a=ne(),o=r(a);e(a);var s={};v(()=>{b(o,`${n(i).start_time??``} - ${n(i).end_time??``}`),s!==(s=n(i).id)&&(a.value=(a.__value=n(i).id)??``)}),C(t,a)}),e(J),e(G);var Y=s(G,2),X=r(Y);T(r(X),{get elements(){return n(L)},get occupiedSeatIds(){return n(se)},get selectedId(){return n(V)},get studentNames(){return n(U)},onElementClick:ae}),e(X);var Z=s(X,2),Q=r(Z),ce=o=>{let c=i(()=>n(U)[n(V)]);var u=O(),f=a(u),p=r(f);e(f);var h=s(f,2),g=e=>{var r=D(),i=a(r);l(i);var o=s(i,2);ee(i,()=>n(H),e=>t(H,e)),d(`click`,o,oe),C(e,r)},_=e=>{C(e,re())};m(h,e=>{n(c)?e(g):e(_,-1)});var y=s(h,2);v(()=>b(p,`Note for ${(n(c)||`Empty Seat`)??``}`)),d(`click`,y,()=>t(V,null)),C(o,u)},le=e=>{C(e,k())};m(Q,e=>{n(V)?e(ce):e(le,-1)});var $=s(Q,2);_(s(r($),2),17,()=>n(R),g,(t,i)=>{var a=A(),o=r(a),c=r(o);e(o);var l=s(o,2),u=r(l,!0);e(l),e(a),v(e=>{b(c,`${e??``}:`),b(u,n(i).content)},[()=>n(z).find(e=>e.id===n(i).student_id)?.name]),C(t,a)}),e($),e(Z),e(Y),h(K,()=>n(M),e=>t(M,e)),h(q,()=>n(P),e=>t(P,e)),h(J,()=>n(I),e=>t(I,e)),C(x,W),o()}x([`click`]);export{j as component};
\ No newline at end of file
diff --git a/frontend/.svelte-kit/output/client/_app/immutable/nodes/9.wReU4Q8t.js b/frontend/.svelte-kit/output/client/_app/immutable/nodes/9.wReU4Q8t.js
deleted file mode 100644
index 31fc7bf..0000000
--- a/frontend/.svelte-kit/output/client/_app/immutable/nodes/9.wReU4Q8t.js
+++ /dev/null
@@ -1 +0,0 @@
-import{$ as e,B as t,D as n,E as r,F as i,H as a,I as o,J as s,L as c,M as l,Q as u,R as d,T as f,V as p,Y as m,_ as h,c as g,f as _,g as v,h as y,j as b,l as x,n as S,v as C,w,x as T,y as E}from"../chunks/egdMPJ-g.js";import"../chunks/BMRk7WTg.js";import{t as D}from"../chunks/DNBIa2Bh.js";import{t as O}from"../chunks/BYEkGdSH.js";var k=T(`
`),A=T(`
`,1),j=T(`
Select an element to edit properties.
`),M=T(`
Properties
`,1),N=T(`
Select a room to edit its layout.
`),P=T(`
Room Layouts
Rooms
`,1);function F(w,T){m(T,!0);let F=p(d([])),I=p(null),L=p(null),R=p(``);S(async()=>{await z()});async function z(){t(F,await D.admin.rooms.list(),!0)}l(()=>{n(I)&&D.admin.rooms.get(n(I)).then(e=>t(L,e,!0))});async function B(){let e=[{id:`s1`,label:`1`,x:2,y:2,width:1,height:1,type:`seat`}];try{let r=await D.admin.rooms.create(n(R),e);t(R,``),await z(),t(I,r.id,!0)}catch(e){alert(e)}}async function V(){if(n(L))try{await D.admin.rooms.updateLayout(n(L).id,n(L).layout),alert(`Layout saved`)}catch(e){alert(e)}}function H(e){if(!n(L))return;let t={id:Math.random().toString(36).substr(2,9),label:e===`seat`?(n(L).layout.filter(e=>e.type===`seat`).length+1).toString():``,x:0,y:0,width:e===`table`?2:1,height:1,type:e};n(L).layout=[...n(L).layout,t]}let U=p(null),W=a(()=>n(L)?.layout.find(e=>e.id===n(U)));function G(){!n(L)||!n(U)||(n(L).layout=n(L).layout.filter(e=>e.id!==n(U)),t(U,null))}var K=P(),q=c(o(K),2),J=i(q),Y=c(i(J),2),X=i(Y);x(X),u(2),e(Y);var Z=c(Y,2);y(Z,21,()=>n(F),v,(r,a)=>{var o=k();let s;var c=i(o,!0);e(o),b(()=>{s=_(o,1,`room-item svelte-2e9svb`,null,s,{selected:n(I)===n(a).id}),C(c,n(a).name)}),f(`click`,o,()=>t(I,n(a).id,!0)),E(r,o)}),e(Z),e(J);var Q=c(J,2),$=i(Q),ee=r=>{var a=M(),s=o(a),l=i(s),u=i(l);e(l);var d=c(l,2),p=i(d),m=c(p,2),_=c(m,2),v=c(_,2);e(d),e(s);var y=c(s,2),S=i(y);O(S,{editable:!0,get selectedId(){return n(U)},onElementClick:e=>t(U,e.id,!0),get elements(){return n(L).layout},set elements(e){n(L).layout=e}});var w=c(S,2),T=c(i(w),2),D=t=>{var r=A(),a=o(r),s=c(i(a),2);x(s),e(a);var l=c(a,2),u=c(i(l),2);x(u),e(l);var d=c(l,2),p=c(i(d),2);x(p),e(d);var m=c(d,2);g(s,()=>n(W).label,e=>n(W).label=e),g(u,()=>n(W).width,e=>n(W).width=e),g(p,()=>n(W).height,e=>n(W).height=e),f(`click`,m,G),E(t,r)},k=e=>{E(e,j())};h(T,e=>{n(W)?e(D):e(k,-1)}),e(w),e(y),b(()=>C(u,`Editing: ${n(L).name??``}`)),f(`click`,p,()=>H(`seat`)),f(`click`,m,()=>H(`table`)),f(`click`,_,()=>H(`door`)),f(`click`,v,V),E(r,a)},te=e=>{E(e,N())};h($,e=>{n(L)?e(ee):e(te,-1)}),e(Q),e(q),r(`submit`,Y,B),g(X,()=>n(R),e=>t(R,e)),E(w,K),s()}w([`click`]);export{F as component};
\ No newline at end of file
diff --git a/frontend/.svelte-kit/output/client/_app/version.json b/frontend/.svelte-kit/output/client/_app/version.json
deleted file mode 100644
index ad3e10a..0000000
--- a/frontend/.svelte-kit/output/client/_app/version.json
+++ /dev/null
@@ -1 +0,0 @@
-{"version":"1777346369869"}
\ No newline at end of file
diff --git a/frontend/.svelte-kit/output/prerendered/dependencies/_app/env.js b/frontend/.svelte-kit/output/prerendered/dependencies/_app/env.js
deleted file mode 100644
index f5427da..0000000
--- a/frontend/.svelte-kit/output/prerendered/dependencies/_app/env.js
+++ /dev/null
@@ -1 +0,0 @@
-export const env={}
\ No newline at end of file
diff --git a/frontend/.svelte-kit/output/server/.vite/manifest.json b/frontend/.svelte-kit/output/server/.vite/manifest.json
deleted file mode 100644
index 26a459a..0000000
--- a/frontend/.svelte-kit/output/server/.vite/manifest.json
+++ /dev/null
@@ -1,322 +0,0 @@
-{
- ".svelte-kit/generated/server/internal.js": {
- "file": "internal.js",
- "name": "internal",
- "src": ".svelte-kit/generated/server/internal.js",
- "isEntry": true,
- "imports": [
- "_environment.js",
- "_internal.js"
- ]
- },
- "_RoomCanvas.BEv49FWI.css": {
- "file": "_app/immutable/assets/RoomCanvas.BEv49FWI.css",
- "src": "_RoomCanvas.BEv49FWI.css"
- },
- "_RoomCanvas.js": {
- "file": "chunks/RoomCanvas.js",
- "name": "RoomCanvas",
- "imports": [
- "_dev.js"
- ],
- "css": [
- "_app/immutable/assets/RoomCanvas.BEv49FWI.css"
- ]
- },
- "_api.js": {
- "file": "chunks/api.js",
- "name": "api",
- "imports": [
- "_dev.js",
- "_index-server2.js",
- "_auth.js"
- ]
- },
- "_auth.js": {
- "file": "chunks/auth.js",
- "name": "auth",
- "imports": [
- "_dev.js",
- "_index-server2.js"
- ]
- },
- "_client.js": {
- "file": "chunks/client.js",
- "name": "client",
- "imports": [
- "_index-server.js",
- "_environment.js",
- "_internal.js",
- "_exports.js",
- "_shared.js",
- "_dev.js",
- "_index-server2.js"
- ]
- },
- "_dev.js": {
- "file": "chunks/dev.js",
- "name": "dev"
- },
- "_environment.js": {
- "file": "chunks/environment.js",
- "name": "environment"
- },
- "_exports.js": {
- "file": "chunks/exports.js",
- "name": "exports"
- },
- "_index-server.js": {
- "file": "chunks/index-server.js",
- "name": "index-server",
- "imports": [
- "_dev.js"
- ]
- },
- "_index-server2.js": {
- "file": "chunks/index-server2.js",
- "name": "index-server",
- "imports": [
- "_dev.js"
- ]
- },
- "_internal.js": {
- "file": "chunks/internal.js",
- "name": "internal",
- "imports": [
- "_index-server.js",
- "_environment.js",
- "_dev.js"
- ]
- },
- "_navigation.js": {
- "file": "chunks/navigation.js",
- "name": "navigation",
- "imports": [
- "_client.js"
- ]
- },
- "_shared.js": {
- "file": "chunks/shared.js",
- "name": "shared",
- "imports": [
- "_index-server.js"
- ]
- },
- "_utils.js": {
- "file": "chunks/utils.js",
- "name": "utils",
- "imports": [
- "_environment.js",
- "_shared.js"
- ]
- },
- "node_modules/@sveltejs/kit/src/runtime/app/server/remote/index.js": {
- "file": "remote-entry.js",
- "name": "remote-entry",
- "src": "node_modules/@sveltejs/kit/src/runtime/app/server/remote/index.js",
- "isEntry": true,
- "imports": [
- "_environment.js",
- "_utils.js",
- "_shared.js"
- ]
- },
- "node_modules/@sveltejs/kit/src/runtime/components/svelte-5/error.svelte": {
- "file": "entries/fallbacks/error.svelte.js",
- "name": "entries/fallbacks/error.svelte",
- "src": "node_modules/@sveltejs/kit/src/runtime/components/svelte-5/error.svelte",
- "isEntry": true,
- "imports": [
- "_index-server.js",
- "_client.js",
- "_dev.js"
- ]
- },
- "node_modules/@sveltejs/kit/src/runtime/server/index.js": {
- "file": "index.js",
- "name": "index",
- "src": "node_modules/@sveltejs/kit/src/runtime/server/index.js",
- "isEntry": true,
- "imports": [
- "_environment.js",
- "_internal.js",
- "_utils.js",
- "_exports.js",
- "_shared.js",
- "_dev.js",
- "_index-server2.js"
- ]
- },
- "src/routes/+layout.svelte": {
- "file": "entries/pages/_layout.svelte.js",
- "name": "entries/pages/_layout.svelte",
- "src": "src/routes/+layout.svelte",
- "isEntry": true,
- "imports": [
- "_dev.js"
- ]
- },
- "src/routes/+page.svelte": {
- "file": "entries/pages/_page.svelte.js",
- "name": "entries/pages/_page.svelte",
- "src": "src/routes/+page.svelte",
- "isEntry": true,
- "imports": [
- "_index-server.js",
- "_navigation.js",
- "_client.js",
- "_dev.js",
- "_auth.js"
- ],
- "css": [
- "_app/immutable/assets/_page.Dzrf4zX4.css"
- ]
- },
- "src/routes/admin/+layout.svelte": {
- "file": "entries/pages/admin/_layout.svelte.js",
- "name": "entries/pages/admin/_layout.svelte",
- "src": "src/routes/admin/+layout.svelte",
- "isEntry": true,
- "imports": [
- "_index-server.js",
- "_navigation.js",
- "_client.js",
- "_dev.js",
- "_auth.js"
- ],
- "css": [
- "_app/immutable/assets/_layout.BQQYIMLK.css"
- ]
- },
- "src/routes/admin/+page.svelte": {
- "file": "entries/pages/admin/_page.svelte.js",
- "name": "entries/pages/admin/_page.svelte",
- "src": "src/routes/admin/+page.svelte",
- "isEntry": true,
- "imports": [
- "_index-server.js",
- "_dev.js",
- "_api.js"
- ],
- "css": [
- "_app/immutable/assets/_page.b2bZrlfC.css"
- ]
- },
- "src/routes/admin/attendance/+page.svelte": {
- "file": "entries/pages/admin/attendance/_page.svelte.js",
- "name": "entries/pages/admin/attendance/_page.svelte",
- "src": "src/routes/admin/attendance/+page.svelte",
- "isEntry": true,
- "imports": [
- "_index-server.js",
- "_dev.js",
- "_api.js"
- ],
- "css": [
- "_app/immutable/assets/_page.DDTZ5v3E.css"
- ]
- },
- "src/routes/admin/courses/+page.svelte": {
- "file": "entries/pages/admin/courses/_page.svelte.js",
- "name": "entries/pages/admin/courses/_page.svelte",
- "src": "src/routes/admin/courses/+page.svelte",
- "isEntry": true,
- "imports": [
- "_index-server.js",
- "_dev.js",
- "_api.js"
- ],
- "css": [
- "_app/immutable/assets/_page.Bfx4fGBa.css"
- ]
- },
- "src/routes/admin/export/+page.svelte": {
- "file": "entries/pages/admin/export/_page.svelte.js",
- "name": "entries/pages/admin/export/_page.svelte",
- "src": "src/routes/admin/export/+page.svelte",
- "isEntry": true,
- "imports": [
- "_index-server.js",
- "_dev.js",
- "_api.js"
- ],
- "css": [
- "_app/immutable/assets/_page.DkoPrtit.css"
- ]
- },
- "src/routes/admin/notes/+page.svelte": {
- "file": "entries/pages/admin/notes/_page.svelte.js",
- "name": "entries/pages/admin/notes/_page.svelte",
- "src": "src/routes/admin/notes/+page.svelte",
- "isEntry": true,
- "imports": [
- "_index-server.js",
- "_dev.js",
- "_RoomCanvas.js",
- "_api.js"
- ],
- "css": [
- "_app/immutable/assets/_page.DigLoqRm.css"
- ]
- },
- "src/routes/admin/rooms/+page.svelte": {
- "file": "entries/pages/admin/rooms/_page.svelte.js",
- "name": "entries/pages/admin/rooms/_page.svelte",
- "src": "src/routes/admin/rooms/+page.svelte",
- "isEntry": true,
- "imports": [
- "_index-server.js",
- "_dev.js",
- "_RoomCanvas.js",
- "_api.js"
- ],
- "css": [
- "_app/immutable/assets/_page.C7KB5jd4.css"
- ]
- },
- "src/routes/admin/sessions/+page.svelte": {
- "file": "entries/pages/admin/sessions/_page.svelte.js",
- "name": "entries/pages/admin/sessions/_page.svelte",
- "src": "src/routes/admin/sessions/+page.svelte",
- "isEntry": true,
- "imports": [
- "_index-server.js",
- "_dev.js",
- "_api.js"
- ],
- "css": [
- "_app/immutable/assets/_page.BhkUjvVr.css"
- ]
- },
- "src/routes/login/+page.svelte": {
- "file": "entries/pages/login/_page.svelte.js",
- "name": "entries/pages/login/_page.svelte",
- "src": "src/routes/login/+page.svelte",
- "isEntry": true,
- "imports": [
- "_navigation.js",
- "_dev.js",
- "_api.js",
- "_auth.js"
- ],
- "css": [
- "_app/immutable/assets/_page.LkBq3xGq.css"
- ]
- },
- "src/routes/s/[code]/+page.svelte": {
- "file": "entries/pages/s/_code_/_page.svelte.js",
- "name": "entries/pages/s/_code_/_page.svelte",
- "src": "src/routes/s/[code]/+page.svelte",
- "isEntry": true,
- "imports": [
- "_index-server.js",
- "_client.js",
- "_dev.js",
- "_RoomCanvas.js",
- "_api.js"
- ],
- "css": [
- "_app/immutable/assets/_page.BboNMIwd.css"
- ]
- }
-}
\ No newline at end of file
diff --git a/frontend/.svelte-kit/output/server/_app/immutable/assets/RoomCanvas.BEv49FWI.css b/frontend/.svelte-kit/output/server/_app/immutable/assets/RoomCanvas.BEv49FWI.css
deleted file mode 100644
index dd32997..0000000
--- a/frontend/.svelte-kit/output/server/_app/immutable/assets/RoomCanvas.BEv49FWI.css
+++ /dev/null
@@ -1 +0,0 @@
-.room-canvas.svelte-1i40qao{user-select:none;background:#fff;border:1px solid #ccc}.room-canvas.editable.svelte-1i40qao{cursor:crosshair}.element.svelte-1i40qao{cursor:pointer}.element.seat.svelte-1i40qao rect:where(.svelte-1i40qao){fill:#fff;stroke:#007bff;stroke-width:2px}.element.seat.svelte-1i40qao text:where(.svelte-1i40qao){fill:#007bff;font-size:14px;font-weight:700}.element.seat.occupied.svelte-1i40qao rect:where(.svelte-1i40qao){fill:#e7f1ff;stroke:#6c757d}.element.seat.occupied.svelte-1i40qao text:where(.svelte-1i40qao){fill:#6c757d}.element.seat.is-mine.svelte-1i40qao rect:where(.svelte-1i40qao){fill:#28a745;stroke:#1e7e34}.element.seat.is-mine.svelte-1i40qao text:where(.svelte-1i40qao){fill:#fff}.element.selected.svelte-1i40qao rect:where(.svelte-1i40qao){stroke:#ffc107;stroke-width:3px}.student-name.svelte-1i40qao{fill:#333;font-size:10px}
diff --git a/frontend/.svelte-kit/output/server/_app/immutable/assets/_layout.BQQYIMLK.css b/frontend/.svelte-kit/output/server/_app/immutable/assets/_layout.BQQYIMLK.css
deleted file mode 100644
index b62d8f8..0000000
--- a/frontend/.svelte-kit/output/server/_app/immutable/assets/_layout.BQQYIMLK.css
+++ /dev/null
@@ -1 +0,0 @@
-nav.svelte-1qg5d05{background:#f8f9fa;border-bottom:1px solid #dee2e6;padding:10px 20px}.nav-content.svelte-1qg5d05{justify-content:space-between;align-items:center;max-width:1200px;margin:0 auto;display:flex}.links.svelte-1qg5d05 a:where(.svelte-1qg5d05){color:#333;margin-right:20px;text-decoration:none}.links.svelte-1qg5d05 a:where(.svelte-1qg5d05):hover{color:#007bff}main.svelte-1qg5d05{max-width:1200px;margin:20px auto;padding:0 20px}
diff --git a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.BboNMIwd.css b/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.BboNMIwd.css
deleted file mode 100644
index 2a08ae7..0000000
--- a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.BboNMIwd.css
+++ /dev/null
@@ -1 +0,0 @@
-.checkin-page.svelte-1gdz5lm{text-align:center;max-width:800px;margin:40px auto}.identity-selector.svelte-1gdz5lm{background:#f8f9fa;border-radius:8px;margin-bottom:20px;padding:20px}select.svelte-1gdz5lm{padding:8px;font-size:1.1em}.error.svelte-1gdz5lm{color:red}.success.svelte-1gdz5lm{color:#28a745;font-size:1.2em}.warning.svelte-1gdz5lm{color:#856404;background:#fff3cd;border-radius:4px;padding:10px}.map-container.svelte-1gdz5lm{margin-top:30px}
diff --git a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.Bfx4fGBa.css b/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.Bfx4fGBa.css
deleted file mode 100644
index e4d7384..0000000
--- a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.Bfx4fGBa.css
+++ /dev/null
@@ -1 +0,0 @@
-.management-grid.svelte-nbog41{grid-template-columns:300px 1fr;gap:30px;display:grid}.course-item.svelte-nbog41{cursor:pointer;border:1px solid #eee;border-radius:4px;margin-bottom:5px;padding:10px}.course-item.selected.svelte-nbog41{background:#e7f1ff;border-color:#007bff}.student-actions.svelte-nbog41{background:#f8f9fa;border-radius:8px;margin-bottom:20px;padding:15px}.import-box.svelte-nbog41{margin-top:10px;font-size:.9em}table.svelte-nbog41{border-collapse:collapse;width:100%}th.svelte-nbog41,td.svelte-nbog41{text-align:left;border-bottom:1px solid #eee;padding:10px}input.svelte-nbog41{margin-right:5px;padding:6px}
diff --git a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.BhkUjvVr.css b/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.BhkUjvVr.css
deleted file mode 100644
index 92a8b96..0000000
--- a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.BhkUjvVr.css
+++ /dev/null
@@ -1 +0,0 @@
-.course-selector.svelte-1x3d7ra{border-bottom:1px solid #eee;margin-bottom:20px;padding-bottom:20px}.add-session.svelte-1x3d7ra{background:#f8f9fa;border-radius:8px;margin-bottom:20px;padding:15px}.form-row.svelte-1x3d7ra{gap:10px;display:flex}.sessions-grid.svelte-1x3d7ra{grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:20px;display:grid}.session-block.svelte-1x3d7ra{border:1px solid #ddd;border-radius:8px;overflow:hidden}.session-header.svelte-1x3d7ra{background:#eee;justify-content:space-between;align-items:center;padding:10px;display:flex}.slots-list.svelte-1x3d7ra{padding:10px}.slot-item.svelte-1x3d7ra{border-bottom:1px solid #f0f0f0;justify-content:space-between;padding:5px 0;display:flex}.delete-btn.svelte-1x3d7ra{color:#dc3545;cursor:pointer;background:0 0;border:none;font-weight:700}.modal-overlay.svelte-1x3d7ra{background:#00000080;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.modal.svelte-1x3d7ra{background:#fff;border-radius:8px;width:400px;padding:30px}.field.svelte-1x3d7ra{margin-bottom:15px}.field.svelte-1x3d7ra label:where(.svelte-1x3d7ra){margin-bottom:5px;display:block}.field.svelte-1x3d7ra input:where(.svelte-1x3d7ra),.field.svelte-1x3d7ra select:where(.svelte-1x3d7ra){width:100%;padding:8px}.modal-actions.svelte-1x3d7ra{justify-content:flex-end;gap:10px;margin-top:20px;display:flex}.primary.svelte-1x3d7ra{color:#fff;background:#007bff;border:none;border-radius:4px;padding:8px 16px}
diff --git a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.C7KB5jd4.css b/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.C7KB5jd4.css
deleted file mode 100644
index a7ad813..0000000
--- a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.C7KB5jd4.css
+++ /dev/null
@@ -1 +0,0 @@
-.management-grid.svelte-2e9svb{grid-template-columns:200px 1fr;gap:20px;display:grid}.room-item.svelte-2e9svb{cursor:pointer;border:1px solid #eee;border-radius:4px;margin-bottom:5px;padding:10px}.room-item.selected.svelte-2e9svb{background:#e7f1ff;border-color:#007bff}.editor-header.svelte-2e9svb{justify-content:space-between;align-items:center;margin-bottom:10px;display:flex}.toolbar.svelte-2e9svb button:where(.svelte-2e9svb){margin-right:5px}.save-btn.svelte-2e9svb{color:#fff;background:#28a745;border:none;border-radius:4px;padding:5px 15px}.canvas-container.svelte-2e9svb{gap:20px;display:flex}.properties-panel.svelte-2e9svb{background:#f8f9fa;border-radius:8px;width:200px;padding:15px}.field.svelte-2e9svb{margin-bottom:10px}.field.svelte-2e9svb label:where(.svelte-2e9svb){color:#666;font-size:.8em;display:block}.field.svelte-2e9svb input:where(.svelte-2e9svb){width:100%;padding:4px}.delete-btn.svelte-2e9svb{color:red;width:100%;margin-top:10px}
diff --git a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.DDTZ5v3E.css b/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.DDTZ5v3E.css
deleted file mode 100644
index 7af6807..0000000
--- a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.DDTZ5v3E.css
+++ /dev/null
@@ -1 +0,0 @@
-.selectors.svelte-190s2eg{margin-bottom:20px}select.svelte-190s2eg{margin-right:10px;padding:5px}.matrix-container.svelte-190s2eg{overflow-x:auto}table.svelte-190s2eg{border-collapse:collapse;background:#fff;width:100%}th.svelte-190s2eg,td.svelte-190s2eg{text-align:center;border:1px solid #ddd;padding:10px}th.svelte-190s2eg{background:#f8f9fa}.cell.svelte-190s2eg{cursor:pointer;width:60px;height:40px}.cell.svelte-190s2eg:hover{background:#f0f0f0}.cell.present.svelte-190s2eg{color:#155724;background:#d4edda;font-weight:700}
diff --git a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.DigLoqRm.css b/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.DigLoqRm.css
deleted file mode 100644
index 95f6607..0000000
--- a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.DigLoqRm.css
+++ /dev/null
@@ -1 +0,0 @@
-.selectors.svelte-1do7mxm{margin-bottom:20px}select.svelte-1do7mxm{margin-right:10px;padding:5px}.notes-container.svelte-1do7mxm{grid-template-columns:1fr 300px;gap:20px;display:grid}.note-editor.svelte-1do7mxm{background:#f8f9fa;border-radius:8px;padding:20px}textarea.svelte-1do7mxm{width:100%;height:100px;margin:10px 0}.primary.svelte-1do7mxm{color:#fff;background:#007bff;border:none;border-radius:4px;padding:8px 16px}.note-item.svelte-1do7mxm{border-bottom:1px solid #ddd;padding:5px 0;font-size:.9em}.note-item.svelte-1do7mxm p:where(.svelte-1do7mxm){margin:5px 0}
diff --git a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.DkoPrtit.css b/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.DkoPrtit.css
deleted file mode 100644
index 69bd3d9..0000000
--- a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.DkoPrtit.css
+++ /dev/null
@@ -1 +0,0 @@
-.export-grid.svelte-128ylb7{grid-template-columns:1fr 1fr;gap:40px;margin-top:20px;display:grid}.export-card.svelte-128ylb7{background:#f8f9fa;border:1px solid #dee2e6;border-radius:8px;margin:15px 0;padding:20px}.btn-group.svelte-128ylb7{gap:10px;display:flex}button.svelte-128ylb7{cursor:pointer;padding:8px 16px}button.small.svelte-128ylb7{padding:4px 8px;font-size:.9em}.session-export-row.svelte-128ylb7{border-bottom:1px solid #eee;justify-content:space-between;align-items:center;padding:8px 0;display:flex}select.svelte-128ylb7{width:100%;margin-bottom:10px;padding:8px}
diff --git a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.Dzrf4zX4.css b/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.Dzrf4zX4.css
deleted file mode 100644
index 705821a..0000000
--- a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.Dzrf4zX4.css
+++ /dev/null
@@ -1 +0,0 @@
-.welcome.svelte-1uha8ag{text-align:center;background:#f8f9fa;border-radius:12px;max-width:600px;margin:100px auto;padding:40px}h1.svelte-1uha8ag{color:#333;margin-bottom:10px;font-size:2.5em}p.svelte-1uha8ag{color:#666;font-size:1.2em}.actions.svelte-1uha8ag{margin-top:40px}.btn.svelte-1uha8ag{color:#fff;background:#007bff;border-radius:6px;padding:12px 30px;font-weight:700;text-decoration:none}.footer.svelte-1uha8ag{color:#888;margin-top:60px;font-size:.9em}
diff --git a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.LkBq3xGq.css b/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.LkBq3xGq.css
deleted file mode 100644
index 8309da6..0000000
--- a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.LkBq3xGq.css
+++ /dev/null
@@ -1 +0,0 @@
-.login-container.svelte-1x05zx6{border:1px solid #ccc;border-radius:8px;max-width:400px;margin:100px auto;padding:20px}.field.svelte-1x05zx6{margin-bottom:15px}label.svelte-1x05zx6{margin-bottom:5px;display:block}input.svelte-1x05zx6{box-sizing:border-box;width:100%;padding:8px}.error.svelte-1x05zx6{color:red;margin-bottom:15px}button.svelte-1x05zx6{color:#fff;cursor:pointer;background:#007bff;border:none;border-radius:4px;width:100%;padding:10px}button.svelte-1x05zx6:disabled{background:#ccc}
diff --git a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.b2bZrlfC.css b/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.b2bZrlfC.css
deleted file mode 100644
index 8ba6d9b..0000000
--- a/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.b2bZrlfC.css
+++ /dev/null
@@ -1 +0,0 @@
-.course-selector.svelte-1jef3w8{margin-bottom:20px}.session-card.svelte-1jef3w8{border:1px solid #ddd;border-radius:8px;margin-bottom:15px;padding:15px}.slot-row.svelte-1jef3w8{border-top:1px solid #eee;justify-content:space-between;align-items:center;padding:10px 0;display:flex}.status-badge.svelte-1jef3w8{text-transform:uppercase;border-radius:12px;margin-right:10px;padding:2px 8px;font-size:.8em}.status-badge.closed.svelte-1jef3w8{color:#fff;background:#6c757d}.status-badge.open.svelte-1jef3w8{color:#fff;background:#28a745}.status-badge.locked.svelte-1jef3w8{color:#000;background:#ffc107}.checkin-code.svelte-1jef3w8{background:#f0f0f0;border-radius:4px;margin-left:10px;padding:2px 5px}.actions.svelte-1jef3w8 button:where(.svelte-1jef3w8){margin-left:5px}
diff --git a/frontend/.svelte-kit/output/server/chunks/RoomCanvas.js b/frontend/.svelte-kit/output/server/chunks/RoomCanvas.js
deleted file mode 100644
index f09ab75..0000000
--- a/frontend/.svelte-kit/output/server/chunks/RoomCanvas.js
+++ /dev/null
@@ -1,43 +0,0 @@
-import { H as escape_html, V as attr, a as ensure_array_like, l as stringify, n as attr_class, r as bind_props } from "./dev.js";
-//#region src/lib/RoomCanvas.svelte
-function RoomCanvas($$renderer, $$props) {
- $$renderer.component(($$renderer) => {
- let { elements = [], editable = false, onElementClick, onLayoutChange, selectedId = null, occupiedSeatIds = [], mySeatId = null, studentNames = {} } = $$props;
- const GRID_SIZE = 40;
- $$renderer.push(``);
- bind_props($$props, { elements });
- });
-}
-//#endregion
-export { RoomCanvas as t };
diff --git a/frontend/.svelte-kit/output/server/chunks/api.js b/frontend/.svelte-kit/output/server/chunks/api.js
deleted file mode 100644
index 3759352..0000000
--- a/frontend/.svelte-kit/output/server/chunks/api.js
+++ /dev/null
@@ -1,138 +0,0 @@
-import { D as get } from "./dev.js";
-import "./index-server2.js";
-import { t as token } from "./auth.js";
-//#region src/lib/api.ts
-var BASE = "/api";
-async function request(path, init) {
- const $token = get(token);
- const res = await fetch(BASE + path, {
- ...init,
- headers: {
- "Content-Type": "application/json",
- ...$token ? { Authorization: `Bearer ${$token}` } : {},
- ...init?.headers
- }
- });
- if (res.status === 401 && false);
- if (!res.ok) {
- const error = await res.json().catch(() => ({ error: res.statusText }));
- throw new Error(error.error || res.statusText);
- }
- if (res.status === 204) return {};
- return res.json();
-}
-var api = {
- auth: { login: (email, password) => request("/auth/login", {
- method: "POST",
- body: JSON.stringify({
- email,
- password
- })
- }) },
- admin: {
- courses: {
- list: () => request("/admin/courses"),
- create: (name, semester) => request("/admin/courses", {
- method: "POST",
- body: JSON.stringify({
- name,
- semester
- })
- }),
- listStudents: (course_id) => request(`/admin/courses/${course_id}/students`),
- addStudent: (course_id, name) => request(`/admin/courses/${course_id}/students`, {
- method: "POST",
- body: JSON.stringify({ name })
- }),
- importStudents: (course_id, file) => {
- const formData = new FormData();
- formData.append("file", file);
- return fetch(`${BASE}/admin/courses/${course_id}/students/import`, {
- method: "POST",
- headers: { "Authorization": `Bearer ${get(token)}` },
- body: formData
- }).then((res) => res.json());
- }
- },
- students: {
- delete: (id) => request(`/admin/students/${id}`, { method: "DELETE" }),
- getAttendance: (id) => request(`/admin/students/${id}/attendance`),
- getNotes: (id) => request(`/admin/students/${id}/notes`)
- },
- rooms: {
- list: () => request("/admin/rooms"),
- create: (name, layout) => request("/admin/rooms", {
- method: "POST",
- body: JSON.stringify({
- name,
- layout
- })
- }),
- get: (id) => request(`/admin/rooms/${id}`),
- updateLayout: (id, layout) => request(`/admin/rooms/${id}/layout`, {
- method: "PUT",
- body: JSON.stringify(layout)
- })
- },
- sessions: {
- list: (course_id) => request(`/admin/sessions?course_id=${course_id}`),
- create: (course_id, week_nr, date) => request("/admin/sessions", {
- method: "POST",
- body: JSON.stringify({
- course_id,
- week_nr,
- date
- })
- }),
- getAttendance: (id) => request(`/admin/sessions/${id}/attendance`)
- },
- slots: {
- create: (session_id, tutor_id, start_time, end_time, room_id) => request("/admin/slots", {
- method: "POST",
- body: JSON.stringify({
- session_id,
- tutor_id,
- start_time,
- end_time,
- room_id
- })
- }),
- updateStatus: (id, status) => request(`/admin/slots/${id}/status`, {
- method: "PATCH",
- body: JSON.stringify({ status })
- }),
- delete: (id) => request(`/admin/slots/${id}`, { method: "DELETE" }),
- addAttendance: (id, student_id) => request(`/admin/slots/${id}/attendance`, {
- method: "POST",
- body: JSON.stringify({ student_id })
- }),
- deleteAttendance: (slot_id, student_id) => request(`/admin/slots/${slot_id}/attendance/${student_id}`, { method: "DELETE" }),
- getNotes: (id) => request(`/admin/slots/${id}/notes`),
- upsertNote: (slot_id, student_id, content) => request(`/admin/slots/${slot_id}/notes/${student_id}`, {
- method: "PUT",
- body: JSON.stringify({ content })
- })
- },
- export: {
- sessionCsv: (id) => `${BASE}/admin/export/session/${id}/csv`,
- sessionMd: (id) => `${BASE}/admin/export/session/${id}/md`,
- courseCsv: (id) => `${BASE}/admin/export/course/${id}/csv`,
- courseMd: (id) => `${BASE}/admin/export/course/${id}/md`,
- backup: () => `${BASE}/admin/backup`
- }
- },
- checkin: {
- getInfo: (code) => request(`/api/checkin/${code}`),
- getStudents: (code) => request(`/api/checkin/${code}/students`),
- post: (code, student_id, seat_id) => request("/api/checkin", {
- method: "POST",
- body: JSON.stringify({
- code,
- student_id,
- seat_id
- })
- })
- }
-};
-//#endregion
-export { api as t };
diff --git a/frontend/.svelte-kit/output/server/chunks/auth.js b/frontend/.svelte-kit/output/server/chunks/auth.js
deleted file mode 100644
index 154f8eb..0000000
--- a/frontend/.svelte-kit/output/server/chunks/auth.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import { k as writable } from "./dev.js";
-import "./index-server2.js";
-//#region src/lib/auth.ts
-var token = writable(null);
-//#endregion
-export { token as t };
diff --git a/frontend/.svelte-kit/output/server/chunks/client.js b/frontend/.svelte-kit/output/server/chunks/client.js
deleted file mode 100644
index 46f5218..0000000
--- a/frontend/.svelte-kit/output/server/chunks/client.js
+++ /dev/null
@@ -1,1448 +0,0 @@
-import { n as settled, r as tick$1, t as index_server_exports } from "./index-server.js";
-import { b as noop, f as get_message, h as base64_decode, n as TRAILING_SLASH_PARAM, p as get_status, t as INVALIDATED_PARAM, v as text_decoder } from "./shared.js";
-import { d as base } from "./environment.js";
-import { S as compact, f as make_trackable, g as add_data_suffix, h as noop_span, l as decode_params, p as normalize_path, s as hash, u as decode_pathname } from "./exports.js";
-import { Z as noop$1, k as writable } from "./dev.js";
-import "./index-server2.js";
-import "./internal.js";
-import { HttpError, Redirect, SvelteKitError } from "@sveltejs/kit/internal";
-import "@sveltejs/kit/internal/server";
-import * as devalue from "devalue";
-var STATES_KEY = "sveltekit:states";
-var HISTORY_INDEX = "sveltekit:history";
-var NAVIGATION_INDEX = "sveltekit:navigation";
-var PRELOAD_PRIORITIES = {
- tap: 1,
- hover: 2,
- viewport: 3,
- eager: 4,
- off: -1,
- false: -1
-};
-//#endregion
-//#region node_modules/@sveltejs/kit/src/runtime/client/utils.js
-var origin = "";
-/** @param {string | URL} url */
-function resolve_url(url) {
- if (url instanceof URL) return url;
- let baseURI = document.baseURI;
- if (!baseURI) {
- const baseTags = document.getElementsByTagName("base");
- baseURI = baseTags.length ? baseTags[0].href : document.URL;
- }
- return new URL(url, baseURI);
-}
-function scroll_state() {
- return {
- x: pageXOffset,
- y: pageYOffset
- };
-}
-({ ...PRELOAD_PRIORITIES }), PRELOAD_PRIORITIES.hover;
-/** @param {any} value */
-function notifiable_store(value) {
- const store = writable(value);
- let ready = true;
- function notify() {
- ready = true;
- store.update((val) => val);
- }
- /** @param {any} new_value */
- function set(new_value) {
- ready = false;
- store.set(new_value);
- }
- /** @param {(value: any) => void} run */
- function subscribe(run) {
- /** @type {any} */
- let old_value;
- return store.subscribe((new_value) => {
- if (old_value === void 0 || ready && new_value !== old_value) run(old_value = new_value);
- });
- }
- return {
- notify,
- set,
- subscribe
- };
-}
-var updated_listener = { v: noop };
-function create_updated_store() {
- const { set, subscribe } = writable(false);
- return {
- subscribe,
- check: async () => false
- };
-}
-/**
-* Is external if
-* - origin different
-* - path doesn't start with base
-* - uses hash router and pathname is more than base
-* @param {URL} url
-* @param {string} base
-* @param {boolean} hash_routing
-*/
-function is_external_url(url, base, hash_routing) {
- if (url.origin !== origin || !url.pathname.startsWith(base)) return true;
- if (hash_routing) return url.pathname !== location.pathname;
- return false;
-}
-//#endregion
-//#region node_modules/@sveltejs/kit/src/runtime/client/state.svelte.js
-var page;
-var navigating;
-var updated;
-var is_legacy = noop$1.toString().includes("$$") || /function \w+\(\) \{\}/.test(noop$1.toString());
-var placeholder_url = "a:";
-if (is_legacy) {
- page = {
- data: {},
- form: null,
- error: null,
- params: {},
- route: { id: null },
- state: {},
- status: -1,
- url: new URL(placeholder_url)
- };
- navigating = { current: null };
- updated = { current: false };
-} else {
- page = new class Page {
- data = {};
- form = null;
- error = null;
- params = {};
- route = { id: null };
- state = {};
- status = -1;
- url = new URL(placeholder_url);
- }();
- navigating = new class Navigating {
- current = null;
- }();
- updated = new class Updated {
- current = false;
- }();
- updated_listener.v = () => updated.current = true;
-}
-/**
-* @param {import('@sveltejs/kit').Page} new_page
-*/
-function update(new_page) {
- Object.assign(page, new_page);
-}
-var cache = /* @__PURE__ */ new Map();
-/**
-* Should be called on the initial run of load functions that hydrate the page.
-* Saves any requests with cache-control max-age to the cache.
-* @param {URL | string} resource
-* @param {RequestInit} [opts]
-*/
-function initial_fetch(resource, opts) {
- const selector = build_selector(resource, opts);
- const script = document.querySelector(selector);
- if (script?.textContent) {
- script.remove();
- let { body, ...init } = JSON.parse(script.textContent);
- const ttl = script.getAttribute("data-ttl");
- if (ttl) cache.set(selector, {
- body,
- init,
- ttl: 1e3 * Number(ttl)
- });
- if (script.getAttribute("data-b64") !== null) body = base64_decode(body);
- return Promise.resolve(new Response(body, init));
- }
- return window.fetch(resource, opts);
-}
-/**
-* Tries to get the response from the cache, if max-age allows it, else does a fetch.
-* @param {URL | string} resource
-* @param {string} resolved
-* @param {RequestInit} [opts]
-*/
-function subsequent_fetch(resource, resolved, opts) {
- if (cache.size > 0) {
- const selector = build_selector(resource, opts);
- const cached = cache.get(selector);
- if (cached) {
- if (performance.now() < cached.ttl && [
- "default",
- "force-cache",
- "only-if-cached",
- void 0
- ].includes(opts?.cache)) return new Response(cached.body, cached.init);
- cache.delete(selector);
- }
- }
- return window.fetch(resolved, opts);
-}
-/**
-* Build the cache key for a given request
-* @param {URL | RequestInfo} resource
-* @param {RequestInit} [opts]
-*/
-function build_selector(resource, opts) {
- let selector = `script[data-sveltekit-fetched][data-url=${JSON.stringify(resource instanceof Request ? resource.url : resource)}]`;
- if (opts?.headers || opts?.body) {
- /** @type {import('types').StrictBody[]} */
- const values = [];
- if (opts.headers) values.push([...new Headers(opts.headers)].join(","));
- if (opts.body && (typeof opts.body === "string" || ArrayBuffer.isView(opts.body))) values.push(opts.body);
- selector += `[data-hash="${hash(...values)}"]`;
- }
- return selector;
-}
-//#endregion
-//#region node_modules/@sveltejs/kit/src/runtime/client/session-storage.js
-/**
-* Read a value from `sessionStorage`
-* @param {string} key
-* @param {(value: string) => any} parse
-*/
-/* @__NO_SIDE_EFFECTS__ */
-function get(key, parse = JSON.parse) {
- try {
- return parse(sessionStorage[key]);
- } catch {}
-}
-//#endregion
-//#region node_modules/@sveltejs/kit/src/runtime/client/client.js
-/** @import { RemoteQueryCacheEntry } from './remote-functions/query.svelte.js' */
-var { onMount, tick } = index_server_exports;
-/**
-* Set via transformError, reset and read at the end of navigate.
-* Necessary because a navigation might succeed loading but during rendering
-* an error occurs, at which point the navigation result needs to be overridden with the error result.
-* TODO this is all very hacky, rethink for SvelteKit 3 where we can assume Svelte 5 and do an overhaul of client.js
-* @type {{ error: App.Error, status: number } | null}
-*/
-var rendering_error = null;
-/**
-* history index -> { x, y }
-* @type {Record}
-*/
-var scroll_positions = /* @__PURE__ */ get("sveltekit:scroll") ?? {};
-/**
-* navigation index -> any
-* @type {Record}
-*/
-var snapshots = /* @__PURE__ */ get("sveltekit:snapshot") ?? {};
-var stores = {
- url: /* @__PURE__ */ notifiable_store({}),
- page: /* @__PURE__ */ notifiable_store({}),
- navigating: /* @__PURE__ */ writable(null),
- updated: /* @__PURE__ */ create_updated_store()
-};
-/** @param {number} index */
-function update_scroll_positions(index) {
- scroll_positions[index] = scroll_state();
-}
-/**
-* @param {number} current_history_index
-* @param {number} current_navigation_index
-*/
-function clear_onward_history(current_history_index, current_navigation_index) {
- let i = current_history_index + 1;
- while (scroll_positions[i]) {
- delete scroll_positions[i];
- i += 1;
- }
- i = current_navigation_index + 1;
- while (snapshots[i]) {
- delete snapshots[i];
- i += 1;
- }
-}
-/**
-* Loads `href` the old-fashioned way, with a full page reload.
-* Returns a `Promise` that never resolves (to prevent any
-* subsequent work, e.g. history manipulation, from happening)
-* @param {URL} url
-* @param {boolean} [replace] If `true`, will replace the current `history` entry rather than creating a new one with `pushState`
-*/
-function native_navigation(url, replace = false) {
- if (replace) location.replace(url.href);
- else location.href = url.href;
- return new Promise(noop);
-}
-/**
-* Checks whether a service worker is registered, and if it is,
-* tries to update it.
-*/
-async function update_service_worker() {
- if ("serviceWorker" in navigator) {
- const registration = await navigator.serviceWorker.getRegistration(base || "/");
- if (registration) await registration.update();
- }
-}
-/** @type {import('types').CSRRoute[]} All routes of the app. Only available when kit.router.resolution=client */
-var routes;
-/** @type {import('types').CSRPageNodeLoader} */
-var default_layout_loader;
-/** @type {import('types').CSRPageNodeLoader} */
-var default_error_loader;
-/** @type {HTMLElement} */
-var target;
-/** @type {import('./types.js').SvelteKitApp} */
-var app;
-/** @type {Array<((url: URL) => boolean)>} */
-var invalidated = [];
-/**
-* An array of the `+layout.svelte` and `+page.svelte` component instances
-* that currently live on the page — used for capturing and restoring snapshots.
-* It's updated/manipulated through `bind:this` in `Root.svelte`.
-* @type {import('svelte').SvelteComponent[]}
-*/
-var components = [];
-/** @type {{id: string, token: {}, promise: Promise, fork: Promise | null} | null} */
-var load_cache = null;
-function discard_load_cache() {
- load_cache?.fork?.then((f) => f?.discard());
- load_cache = null;
-}
-/**
-* @type {Map>}
-* Cache for client-side rerouting, since it could contain async calls which we want to
-* avoid running multiple times which would slow down navigations (e.g. else preloading
-* wouldn't help because on navigation it would be called again). Since `reroute` should be
-* a pure function (i.e. always return the same) value it's safe to cache across navigations.
-* The server reroute calls don't need to be cached because they are called using `import(...)`
-* which is cached per the JS spec.
-*/
-var reroute_cache = /* @__PURE__ */ new Map();
-/**
-* Note on before_navigate_callbacks, on_navigate_callbacks and after_navigate_callbacks:
-* do not re-assign as some closures keep references to these Sets
-*/
-/** @type {Set<(navigation: import('@sveltejs/kit').BeforeNavigate) => void>} */
-var before_navigate_callbacks = /* @__PURE__ */ new Set();
-/** @type {Set<(navigation: import('@sveltejs/kit').OnNavigate) => import('types').MaybePromise<(() => void) | void>>} */
-var on_navigate_callbacks = /* @__PURE__ */ new Set();
-/** @type {Set<(navigation: import('@sveltejs/kit').AfterNavigate) => void>} */
-var after_navigate_callbacks = /* @__PURE__ */ new Set();
-/** @type {import('./types.js').NavigationState & { nav: import('@sveltejs/kit').NavigationEvent }} */
-var current = {
- branch: [],
- error: null,
- url: null,
- nav: null
-};
-/** this being true means we SSR'd */
-var hydrated = false;
-var started = false;
-var autoscroll = true;
-var is_navigating = false;
-var force_invalidation = false;
-/** @type {import('svelte').SvelteComponent} */
-var root;
-/** @type {number} keeping track of the history index in order to prevent popstate navigation events if needed */
-var current_history_index;
-/** @type {number} */
-var current_navigation_index;
-/** @type {{}} */
-var token;
-/**
-* A set of tokens which are associated to current preloads.
-* If a preload becomes a real navigation, it's removed from the set.
-* If a preload token is in the set and the preload errors, the error
-* handling logic (for example reloading) is skipped.
-*/
-var preload_tokens = /* @__PURE__ */ new Set();
-/**
-* @type {Map>>}
-* A map of query id -> payload -> query internals for all active queries.
-*/
-var query_map = /* @__PURE__ */ new Map();
-function reset_invalidation() {
- invalidated.length = 0;
- force_invalidation = false;
-}
-/** @param {number} index */
-function capture_snapshot(index) {
- if (components.some((c) => c?.snapshot)) snapshots[index] = components.map((c) => c?.snapshot?.capture());
-}
-/** @param {number} index */
-function restore_snapshot(index) {
- snapshots[index]?.forEach((value, i) => {
- components[i]?.snapshot?.restore(value);
- });
-}
-/**
-* @param {string | URL} url
-* @param {{ replaceState?: boolean; noScroll?: boolean; keepFocus?: boolean; invalidateAll?: boolean; invalidate?: Array boolean)>; state?: Record }} options
-* @param {number} redirect_count
-* @param {{}} [nav_token]
-*/
-async function _goto(url, options, redirect_count, nav_token) {
- /** @type {string[]} */
- let query_keys;
- if (options.invalidateAll) discard_load_cache();
- await navigate({
- type: "goto",
- url: resolve_url(url),
- keepfocus: options.keepFocus,
- noscroll: options.noScroll,
- replace_state: options.replaceState,
- state: options.state,
- redirect_count,
- nav_token,
- accept: () => {
- if (options.invalidateAll) {
- force_invalidation = true;
- query_keys = [];
- query_map.forEach((entries, id) => {
- for (const payload of entries.keys()) query_keys.push(id + "/" + payload);
- });
- }
- if (options.invalidate) options.invalidate.forEach(push_invalidated);
- }
- });
- if (options.invalidateAll) tick$1().then(tick$1).then(() => {
- query_map.forEach((entries, id) => {
- entries.forEach(({ resource }, payload) => {
- if (query_keys?.includes(id + "/" + payload)) resource.refresh?.();
- });
- });
- });
-}
-/**
-* @param {import('./types.js').NavigationFinished} result
-* @param {HTMLElement} target
-* @param {boolean} hydrate
-*/
-async function initialize(result, target, hydrate) {
- /** @type {import('@sveltejs/kit').NavigationEvent} */
- const nav = {
- params: current.params,
- route: { id: current.route?.id ?? null },
- url: new URL(location.href)
- };
- current = {
- ...result.state,
- nav
- };
- const style = document.querySelector("style[data-sveltekit]");
- if (style) style.remove();
- Object.assign(page, result.props.page);
- root = new app.root({
- target,
- props: {
- ...result.props,
- stores,
- components
- },
- hydrate,
- sync: false,
- transformError: void 0
- });
- await Promise.resolve();
- restore_snapshot(current_navigation_index);
- if (hydrate) {
- /** @type {import('@sveltejs/kit').AfterNavigate} */
- const navigation = {
- from: null,
- to: {
- ...nav,
- scroll: scroll_positions[current_history_index] ?? scroll_state()
- },
- willUnload: false,
- type: "enter",
- complete: Promise.resolve()
- };
- after_navigate_callbacks.forEach((fn) => fn(navigation));
- }
- started = true;
-}
-/**
-*
-* @param {{
-* url: URL;
-* params: Record;
-* branch: Array;
-* errors?: Array;
-* status: number;
-* error: App.Error | null;
-* route: import('types').CSRRoute | null;
-* form?: Record | null;
-* }} opts
-*/
-async function get_navigation_result_from_branch({ url, params, branch, errors, status, error, route, form }) {
- /** @type {import('types').TrailingSlash} */
- let slash = "never";
- if (base && (url.pathname === base || url.pathname === base + "/")) slash = "always";
- else for (const node of branch) if (node?.slash !== void 0) slash = node.slash;
- url.pathname = normalize_path(url.pathname, slash);
- url.search = url.search;
- /** @type {import('./types.js').NavigationFinished} */
- const result = {
- type: "loaded",
- state: {
- url,
- params,
- branch,
- error,
- route
- },
- props: {
- constructors: compact(branch).map((branch_node) => branch_node.node.component),
- page: clone_page(page)
- }
- };
- if (form !== void 0) result.props.form = form;
- let data = {};
- let data_changed = !page;
- let p = 0;
- for (let i = 0; i < Math.max(branch.length, current.branch.length); i += 1) {
- const node = branch[i];
- const prev = current.branch[i];
- if (node?.data !== prev?.data) data_changed = true;
- if (!node) continue;
- data = {
- ...data,
- ...node.data
- };
- if (data_changed) result.props[`data_${p}`] = data;
- p += 1;
- }
- if (!current.url || url.href !== current.url.href || current.error !== error || form !== void 0 && form !== page.form || data_changed) result.props.page = {
- error,
- params,
- route: { id: route?.id ?? null },
- state: {},
- status,
- url: new URL(url),
- form: form ?? null,
- data: data_changed ? data : page.data
- };
- return result;
-}
-/**
-* Call the universal load function of the given node, if it exists.
-*
-* @param {{
-* loader: import('types').CSRPageNodeLoader;
-* parent: () => Promise>;
-* url: URL;
-* params: Record;
-* route: { id: string | null };
-* server_data_node: import('./types.js').DataNode | null;
-* }} options
-* @returns {Promise}
-*/
-async function load_node({ loader, parent, url, params, route, server_data_node }) {
- /** @type {Record | null} */
- let data = null;
- let is_tracking = true;
- /** @type {import('types').Uses} */
- const uses = {
- dependencies: /* @__PURE__ */ new Set(),
- params: /* @__PURE__ */ new Set(),
- parent: false,
- route: false,
- url: false,
- search_params: /* @__PURE__ */ new Set()
- };
- const node = await loader();
- if (node.universal?.load) {
- /** @param {string[]} deps */
- function depends(...deps) {
- for (const dep of deps) {
- const { href } = new URL(dep, url);
- uses.dependencies.add(href);
- }
- }
- /** @type {import('@sveltejs/kit').LoadEvent} */
- const load_input = {
- tracing: {
- enabled: false,
- root: noop_span,
- current: noop_span
- },
- route: new Proxy(route, { get: (target, key) => {
- if (is_tracking) uses.route = true;
- return target[key];
- } }),
- params: new Proxy(params, { get: (target, key) => {
- if (is_tracking) uses.params.add(key);
- return target[key];
- } }),
- data: server_data_node?.data ?? null,
- url: make_trackable(url, () => {
- if (is_tracking) uses.url = true;
- }, (param) => {
- if (is_tracking) uses.search_params.add(param);
- }, app.hash),
- async fetch(resource, init) {
- if (resource instanceof Request) init = {
- body: resource.method === "GET" || resource.method === "HEAD" ? void 0 : await resource.blob(),
- cache: resource.cache,
- credentials: resource.credentials,
- headers: [...resource.headers].length > 0 ? resource?.headers : void 0,
- integrity: resource.integrity,
- keepalive: resource.keepalive,
- method: resource.method,
- mode: resource.mode,
- redirect: resource.redirect,
- referrer: resource.referrer,
- referrerPolicy: resource.referrerPolicy,
- signal: resource.signal,
- ...init
- };
- const { resolved, promise } = resolve_fetch_url(resource, init, url);
- if (is_tracking) depends(resolved.href);
- return promise;
- },
- setHeaders: noop,
- depends,
- parent() {
- if (is_tracking) uses.parent = true;
- return parent();
- },
- untrack(fn) {
- is_tracking = false;
- try {
- return fn();
- } finally {
- is_tracking = true;
- }
- }
- };
- data = await node.universal.load.call(null, load_input) ?? null;
- }
- return {
- node,
- loader,
- server: server_data_node,
- universal: node.universal?.load ? {
- type: "data",
- data,
- uses
- } : null,
- data: data ?? server_data_node?.data ?? null,
- slash: node.universal?.trailingSlash ?? server_data_node?.slash
- };
-}
-/**
-* @param {Request | string | URL} input
-* @param {RequestInit | undefined} init
-* @param {URL} url
-*/
-function resolve_fetch_url(input, init, url) {
- let requested = input instanceof Request ? input.url : input;
- const resolved = new URL(requested, url);
- if (resolved.origin === url.origin) requested = resolved.href.slice(url.origin.length);
- return {
- resolved,
- promise: started ? subsequent_fetch(requested, resolved.href, init) : initial_fetch(requested, init)
- };
-}
-/**
-* @param {boolean} parent_changed
-* @param {boolean} route_changed
-* @param {boolean} url_changed
-* @param {Set} search_params_changed
-* @param {import('types').Uses | undefined} uses
-* @param {Record} params
-*/
-function has_changed(parent_changed, route_changed, url_changed, search_params_changed, uses, params) {
- if (force_invalidation) return true;
- if (!uses) return false;
- if (uses.parent && parent_changed) return true;
- if (uses.route && route_changed) return true;
- if (uses.url && url_changed) return true;
- for (const tracked_params of uses.search_params) if (search_params_changed.has(tracked_params)) return true;
- for (const param of uses.params) if (params[param] !== current.params[param]) return true;
- for (const href of uses.dependencies) if (invalidated.some((fn) => fn(new URL(href)))) return true;
- return false;
-}
-/**
-* @param {import('types').ServerDataNode | import('types').ServerDataSkippedNode | null} node
-* @param {import('./types.js').DataNode | null} [previous]
-* @returns {import('./types.js').DataNode | null}
-*/
-function create_data_node(node, previous) {
- if (node?.type === "data") return node;
- if (node?.type === "skip") return previous ?? null;
- return null;
-}
-/**
-* @param {URL | null} old_url
-* @param {URL} new_url
-*/
-function diff_search_params(old_url, new_url) {
- if (!old_url) return new Set(new_url.searchParams.keys());
- const changed = new Set([...old_url.searchParams.keys(), ...new_url.searchParams.keys()]);
- for (const key of changed) {
- const old_values = old_url.searchParams.getAll(key);
- const new_values = new_url.searchParams.getAll(key);
- if (old_values.every((value) => new_values.includes(value)) && new_values.every((value) => old_values.includes(value))) changed.delete(key);
- }
- return changed;
-}
-/**
-* @param {Omit & { error: App.Error }} opts
-* @returns {import('./types.js').NavigationFinished}
-*/
-function preload_error({ error, url, route, params }) {
- return {
- type: "loaded",
- state: {
- error,
- url,
- route,
- params,
- branch: []
- },
- props: {
- page: clone_page(page),
- constructors: []
- }
- };
-}
-/**
-* @param {import('./types.js').NavigationIntent & { preload?: {} }} intent
-* @returns {Promise}
-*/
-async function load_route({ id, invalidating, url, params, route, preload }) {
- if (load_cache?.id === id) {
- preload_tokens.delete(load_cache.token);
- return load_cache.promise;
- }
- const { errors, layouts, leaf } = route;
- const loaders = [...layouts, leaf];
- errors.forEach((loader) => loader?.().catch(noop));
- loaders.forEach((loader) => loader?.[1]().catch(noop));
- /** @type {import('types').ServerNodesResponse | import('types').ServerRedirectNode | null} */
- let server_data = null;
- const url_changed = current.url ? id !== get_page_key(current.url) : false;
- const route_changed = current.route ? route.id !== current.route.id : false;
- const search_params_changed = diff_search_params(current.url, url);
- let parent_invalid = false;
- {
- const invalid_server_nodes = loaders.map((loader, i) => {
- const previous = current.branch[i];
- const invalid = !!loader?.[0] && (previous?.loader !== loader[1] || has_changed(parent_invalid, route_changed, url_changed, search_params_changed, previous.server?.uses, params));
- if (invalid) parent_invalid = true;
- return invalid;
- });
- if (invalid_server_nodes.some(Boolean)) {
- try {
- server_data = await load_data(url, invalid_server_nodes);
- } catch (error) {
- const handled_error = await handle_error(error, {
- url,
- params,
- route: { id }
- });
- if (preload_tokens.has(preload)) return preload_error({
- error: handled_error,
- url,
- params,
- route
- });
- return load_root_error_page({
- status: get_status(error),
- error: handled_error,
- url,
- route
- });
- }
- if (server_data.type === "redirect") return server_data;
- }
- }
- const server_data_nodes = server_data?.nodes;
- let parent_changed = false;
- const branch_promises = loaders.map(async (loader, i) => {
- if (!loader) return;
- /** @type {import('./types.js').BranchNode | undefined} */
- const previous = current.branch[i];
- const server_data_node = server_data_nodes?.[i];
- if ((!server_data_node || server_data_node.type === "skip") && loader[1] === previous?.loader && !has_changed(parent_changed, route_changed, url_changed, search_params_changed, previous.universal?.uses, params)) return previous;
- parent_changed = true;
- if (server_data_node?.type === "error") throw server_data_node;
- return load_node({
- loader: loader[1],
- url,
- params,
- route,
- parent: async () => {
- const data = {};
- for (let j = 0; j < i; j += 1) Object.assign(data, (await branch_promises[j])?.data);
- return data;
- },
- server_data_node: create_data_node(server_data_node === void 0 && loader[0] ? { type: "skip" } : server_data_node ?? null, loader[0] ? previous?.server : void 0)
- });
- });
- for (const p of branch_promises) p.catch(noop);
- /** @type {Array} */
- const branch = [];
- for (let i = 0; i < loaders.length; i += 1) if (loaders[i]) try {
- branch.push(await branch_promises[i]);
- } catch (err) {
- if (err instanceof Redirect) return {
- type: "redirect",
- location: err.location
- };
- if (preload_tokens.has(preload)) return preload_error({
- error: await handle_error(err, {
- params,
- url,
- route: { id: route.id }
- }),
- url,
- params,
- route
- });
- let status = get_status(err);
- /** @type {App.Error} */
- let error;
- if (server_data_nodes?.includes(err)) {
- status = err.status ?? status;
- error = err.error;
- } else if (err instanceof HttpError) error = err.body;
- else {
- if (await stores.updated.check()) {
- await update_service_worker();
- return await native_navigation(url);
- }
- error = await handle_error(err, {
- params,
- url,
- route: { id: route.id }
- });
- }
- const error_load = await load_nearest_error_page(i, branch, errors);
- if (error_load) return get_navigation_result_from_branch({
- url,
- params,
- branch: branch.slice(0, error_load.idx).concat(error_load.node),
- errors,
- status,
- error,
- route
- });
- else return await server_fallback(url, { id: route.id }, error, status);
- }
- else branch.push(void 0);
- return get_navigation_result_from_branch({
- url,
- params,
- branch,
- errors,
- status: 200,
- error: null,
- route,
- form: invalidating ? void 0 : null
- });
-}
-/**
-* @param {number} i Start index to backtrack from
-* @param {Array} branch Branch to backtrack
-* @param {Array} errors All error pages for this branch
-* @returns {Promise<{idx: number; node: import('./types.js').BranchNode} | undefined>}
-*/
-async function load_nearest_error_page(i, branch, errors) {
- while (i--) if (errors[i]) {
- let j = i;
- while (!branch[j]) j -= 1;
- try {
- return {
- idx: j + 1,
- node: {
- node: await errors[i](),
- loader: errors[i],
- data: {},
- server: null,
- universal: null
- }
- };
- } catch {
- continue;
- }
- }
-}
-/**
-* @param {{
-* status: number;
-* error: App.Error;
-* url: URL;
-* route: { id: string | null }
-* }} opts
-* @returns {Promise}
-*/
-async function load_root_error_page({ status, error, url, route }) {
- /** @type {Record} */
- const params = {};
- /** @type {import('types').ServerDataNode | null} */
- let server_data_node = null;
- if (app.server_loads[0] === 0) try {
- const server_data = await load_data(url, [true]);
- if (server_data.type !== "data" || server_data.nodes[0] && server_data.nodes[0].type !== "data") throw 0;
- server_data_node = server_data.nodes[0] ?? null;
- } catch {
- if (url.origin !== origin || url.pathname !== location.pathname || hydrated) await native_navigation(url);
- }
- try {
- return get_navigation_result_from_branch({
- url,
- params,
- branch: [await load_node({
- loader: default_layout_loader,
- url,
- params,
- route,
- parent: () => Promise.resolve({}),
- server_data_node: create_data_node(server_data_node)
- }), {
- node: await default_error_loader(),
- loader: default_error_loader,
- universal: null,
- server: null,
- data: null
- }],
- status,
- error,
- errors: [],
- route: null
- });
- } catch (error) {
- if (error instanceof Redirect) return _goto(new URL(error.location, location.href), {}, 0);
- throw error;
- }
-}
-/**
-* Resolve the relative rerouted URL for a client-side navigation
-* @param {URL} url
-* @returns {Promise}
-*/
-async function get_rerouted_url(url) {
- const href = url.href;
- if (reroute_cache.has(href)) return reroute_cache.get(href);
- let rerouted;
- try {
- const promise = (async () => {
- let rerouted = await app.hooks.reroute({
- url: new URL(url),
- fetch: async (input, init) => {
- return resolve_fetch_url(input, init, url).promise;
- }
- }) ?? url;
- if (typeof rerouted === "string") {
- const tmp = new URL(url);
- if (app.hash) tmp.hash = rerouted;
- else tmp.pathname = rerouted;
- rerouted = tmp;
- }
- return rerouted;
- })();
- reroute_cache.set(href, promise);
- rerouted = await promise;
- } catch (e) {
- reroute_cache.delete(href);
- return;
- }
- return rerouted;
-}
-/**
-* Resolve the full info (which route, params, etc.) for a client-side navigation from the URL,
-* taking the reroute hook into account. If this isn't a client-side-navigation (or the URL is undefined),
-* returns undefined.
-* @param {URL | undefined} url
-* @param {boolean} invalidating
-* @returns {Promise}
-*/
-async function get_navigation_intent(url, invalidating) {
- if (!url) return;
- if (is_external_url(url, base, app.hash)) return;
- {
- const rerouted = await get_rerouted_url(url);
- if (!rerouted) return;
- const path = get_url_path(rerouted);
- for (const route of routes) {
- const params = route.exec(path);
- if (params) return {
- id: get_page_key(url),
- invalidating,
- route,
- params: decode_params(params),
- url
- };
- }
- }
-}
-/** @param {URL} url */
-function get_url_path(url) {
- return decode_pathname(app.hash ? url.hash.replace(/^#/, "").replace(/[?#].+/, "") : url.pathname.slice(base.length)) || "/";
-}
-/** @param {URL} url */
-function get_page_key(url) {
- return (app.hash ? url.hash.replace(/^#/, "") : url.pathname) + url.search;
-}
-/**
-* @param {{
-* url: URL;
-* type: import('@sveltejs/kit').Navigation["type"];
-* intent?: import('./types.js').NavigationIntent;
-* delta?: number;
-* event?: PopStateEvent | MouseEvent;
-* scroll?: { x: number, y: number };
-* }} opts
-*/
-function _before_navigate({ url, type, intent, delta, event, scroll }) {
- let should_block = false;
- const nav = create_navigation(current, intent, url, type, scroll ?? null);
- if (delta !== void 0) nav.navigation.delta = delta;
- if (event !== void 0) nav.navigation.event = event;
- const cancellable = {
- ...nav.navigation,
- cancel: () => {
- should_block = true;
- nav.reject(/* @__PURE__ */ new Error("navigation cancelled"));
- }
- };
- if (!is_navigating) before_navigate_callbacks.forEach((fn) => fn(cancellable));
- return should_block ? null : nav;
-}
-/**
-* @param {{
-* type: import('@sveltejs/kit').NavigationType;
-* url: URL;
-* popped?: {
-* state: Record;
-* scroll: { x: number, y: number };
-* delta: number;
-* };
-* keepfocus?: boolean;
-* noscroll?: boolean;
-* replace_state?: boolean;
-* state?: Record;
-* redirect_count?: number;
-* nav_token?: {};
-* accept?: () => void;
-* block?: () => void;
-* event?: Event
-* }} opts
-*/
-async function navigate({ type, url, popped, keepfocus, noscroll, replace_state, state = {}, redirect_count = 0, nav_token = {}, accept = noop, block = noop, event }) {
- const prev_token = token;
- token = nav_token;
- const intent = await get_navigation_intent(url, false);
- const nav = type === "enter" ? create_navigation(current, intent, url, type) : _before_navigate({
- url,
- type,
- delta: popped?.delta,
- intent,
- scroll: popped?.scroll,
- event
- });
- if (!nav) {
- block();
- if (token === nav_token) token = prev_token;
- return;
- }
- const previous_history_index = current_history_index;
- const previous_navigation_index = current_navigation_index;
- accept();
- is_navigating = true;
- if (started && nav.navigation.type !== "enter") stores.navigating.set(navigating.current = nav.navigation);
- let navigation_result = intent && await load_route(intent);
- if (!navigation_result) if (is_external_url(url, base, app.hash)) return await native_navigation(url, replace_state);
- else navigation_result = await server_fallback(url, { id: null }, await handle_error(new SvelteKitError(404, "Not Found", `Not found: ${url.pathname}`), {
- url,
- params: {},
- route: { id: null }
- }), 404, replace_state);
- url = intent?.url || url;
- if (token !== nav_token) {
- nav.reject(/* @__PURE__ */ new Error("navigation aborted"));
- return false;
- }
- if (navigation_result.type === "redirect") {
- if (redirect_count < 20) {
- await navigate({
- type,
- url: new URL(navigation_result.location, url),
- popped,
- keepfocus,
- noscroll,
- replace_state,
- state,
- redirect_count: redirect_count + 1,
- nav_token
- });
- nav.fulfil(void 0);
- return;
- }
- navigation_result = await load_root_error_page({
- status: 500,
- error: await handle_error(/* @__PURE__ */ new Error("Redirect loop"), {
- url,
- params: {},
- route: { id: null }
- }),
- url,
- route: { id: null }
- });
- } else if (navigation_result.props.page.status >= 400) {
- if (await stores.updated.check()) {
- await update_service_worker();
- await native_navigation(url, replace_state);
- }
- }
- reset_invalidation();
- update_scroll_positions(previous_history_index);
- capture_snapshot(previous_navigation_index);
- if (navigation_result.props.page.url.pathname !== url.pathname) url.pathname = navigation_result.props.page.url.pathname;
- state = popped ? popped.state : state;
- if (!popped) {
- const change = replace_state ? 0 : 1;
- const entry = {
- [HISTORY_INDEX]: current_history_index += change,
- [NAVIGATION_INDEX]: current_navigation_index += change,
- [STATES_KEY]: state
- };
- (replace_state ? history.replaceState : history.pushState).call(history, entry, "", url);
- if (!replace_state) clear_onward_history(current_history_index, current_navigation_index);
- }
- const load_cache_fork = intent && load_cache?.id === intent.id ? load_cache.fork : null;
- if (load_cache?.fork && !load_cache_fork) discard_load_cache();
- load_cache = null;
- navigation_result.props.page.state = state;
- /**
- * @type {Promise | undefined}
- */
- let commit_promise;
- if (started) {
- const after_navigate = (await Promise.all(Array.from(on_navigate_callbacks, (fn) => fn(nav.navigation)))).filter(
- /** @returns {value is () => void} */
- (value) => typeof value === "function"
- );
- if (after_navigate.length > 0) {
- function cleanup() {
- after_navigate.forEach((fn) => {
- after_navigate_callbacks.delete(fn);
- });
- }
- after_navigate.push(cleanup);
- after_navigate.forEach((fn) => {
- after_navigate_callbacks.add(fn);
- });
- }
- const target = nav.navigation.to;
- current = {
- ...navigation_result.state,
- nav: {
- params: target.params,
- route: target.route,
- url: target.url
- }
- };
- if (navigation_result.props.page) navigation_result.props.page.url = url;
- const fork = load_cache_fork && await load_cache_fork;
- if (fork) commit_promise = fork.commit();
- else {
- rendering_error = null;
- root.$set(navigation_result.props);
- if (rendering_error) Object.assign(navigation_result.props.page, rendering_error);
- update(navigation_result.props.page);
- commit_promise = settled?.();
- }
- } else await initialize(navigation_result, target, false);
- const { activeElement } = document;
- await commit_promise;
- await tick$1();
- await tick$1();
- /** @type {Element | null | ''} */
- let deep_linked = null;
- if (autoscroll) {
- const scroll = popped ? popped.scroll : noscroll ? scroll_state() : null;
- if (scroll) scrollTo(scroll.x, scroll.y);
- else if (deep_linked = url.hash && document.getElementById(get_id(url))) deep_linked.scrollIntoView();
- else scrollTo(0, 0);
- }
- const changed_focus = document.activeElement !== activeElement && document.activeElement !== document.body;
- if (!keepfocus && !changed_focus) reset_focus(url, !deep_linked);
- autoscroll = true;
- if (navigation_result.props.page) {
- if (rendering_error) Object.assign(navigation_result.props.page, rendering_error);
- Object.assign(page, navigation_result.props.page);
- }
- is_navigating = false;
- if (type === "popstate") restore_snapshot(current_navigation_index);
- nav.fulfil(void 0);
- if (nav.navigation.to) nav.navigation.to.scroll = scroll_state();
- after_navigate_callbacks.forEach((fn) => fn(nav.navigation));
- stores.navigating.set(navigating.current = null);
-}
-/**
-* Does a full page reload if it wouldn't result in an endless loop in the SPA case
-* @param {URL} url
-* @param {{ id: string | null }} route
-* @param {App.Error} error
-* @param {number} status
-* @param {boolean} [replace_state]
-* @returns {Promise}
-*/
-async function server_fallback(url, route, error, status, replace_state) {
- if (url.origin === origin && url.pathname === location.pathname && !hydrated) return await load_root_error_page({
- status,
- error,
- url,
- route
- });
- return await native_navigation(url, replace_state);
-}
-/**
-* @param {unknown} error
-* @param {import('@sveltejs/kit').NavigationEvent} event
-* @returns {import('types').MaybePromise}
-*/
-function handle_error(error, event) {
- if (error instanceof HttpError) return error.body;
- const status = get_status(error);
- const message = get_message(error);
- return app.hooks.handleError({
- error,
- event,
- status,
- message
- }) ?? { message };
-}
-/**
-* Allows you to navigate programmatically to a given route, with options such as keeping the current element focused.
-* Returns a Promise that resolves when SvelteKit navigates (or fails to navigate, in which case the promise rejects) to the specified `url`.
-*
-* For external URLs, use `window.location = url` instead of calling `goto(url)`.
-*
-* @param {string | URL} url Where to navigate to. Note that if you've set [`config.kit.paths.base`](https://svelte.dev/docs/kit/configuration#paths) and the URL is root-relative, you need to prepend the base path if you want to navigate within the app.
-* @param {Object} [opts] Options related to the navigation
-* @param {boolean} [opts.replaceState] If `true`, will replace the current `history` entry rather than creating a new one with `pushState`
-* @param {boolean} [opts.noScroll] If `true`, the browser will maintain its scroll position rather than scrolling to the top of the page after navigation
-* @param {boolean} [opts.keepFocus] If `true`, the currently focused element will retain focus after navigation. Otherwise, focus will be reset to the body
-* @param {boolean} [opts.invalidateAll] If `true`, all `load` functions of the page will be rerun. See https://svelte.dev/docs/kit/load#rerunning-load-functions for more info on invalidation.
-* @param {Array boolean)>} [opts.invalidate] Causes any load functions to re-run if they depend on one of the urls
-* @param {App.PageState} [opts.state] An optional object that will be available as `page.state`
-* @returns {Promise}
-*/
-function goto(url, opts = {}) {
- throw new Error("Cannot call goto(...) on the server");
-}
-/**
-* @param {string | URL | ((url: URL) => boolean)} resource The invalidated URL
-*/
-function push_invalidated(resource) {
- if (typeof resource === "function") invalidated.push(resource);
- else {
- const { href } = new URL(resource, location.href);
- invalidated.push((url) => url.href === href);
- }
-}
-/**
-* @param {URL} url
-* @param {boolean[]} invalid
-* @returns {Promise}
-*/
-async function load_data(url, invalid) {
- const data_url = new URL(url);
- data_url.pathname = add_data_suffix(url.pathname);
- if (url.pathname.endsWith("/")) data_url.searchParams.append(TRAILING_SLASH_PARAM, "1");
- data_url.searchParams.append(INVALIDATED_PARAM, invalid.map((i) => i ? "1" : "0").join(""));
- const res = await (0, window.fetch)(data_url.href, {});
- if (!res.ok) {
- /** @type {string | undefined} */
- let message;
- if (res.headers.get("content-type")?.includes("application/json")) message = await res.json();
- else if (res.status === 404) message = "Not Found";
- else if (res.status === 500) message = "Internal Error";
- throw new HttpError(res.status, message);
- }
- return new Promise(async (resolve) => {
- /**
- * Map of deferred promises that will be resolved by a subsequent chunk of data
- * @type {Map}
- */
- const deferreds = /* @__PURE__ */ new Map();
- const reader = res.body.getReader();
- /**
- * @param {any} data
- */
- function deserialize(data) {
- return devalue.unflatten(data, {
- ...app.decoders,
- Promise: (id) => {
- return new Promise((fulfil, reject) => {
- deferreds.set(id, {
- fulfil,
- reject
- });
- });
- }
- });
- }
- let text = "";
- while (true) {
- const { done, value } = await reader.read();
- if (done && !text) break;
- text += !value && text ? "\n" : text_decoder.decode(value, { stream: true });
- while (true) {
- const split = text.indexOf("\n");
- if (split === -1) break;
- const node = JSON.parse(text.slice(0, split));
- text = text.slice(split + 1);
- if (node.type === "redirect") return resolve(node);
- if (node.type === "data") {
- node.nodes?.forEach((node) => {
- if (node?.type === "data") {
- node.uses = deserialize_uses(node.uses);
- node.data = deserialize(node.data);
- }
- });
- resolve(node);
- } else if (node.type === "chunk") {
- const { id, data, error } = node;
- const deferred = deferreds.get(id);
- deferreds.delete(id);
- if (error) deferred.reject(deserialize(error));
- else deferred.fulfil(deserialize(data));
- }
- }
- }
- });
-}
-/**
-* @param {any} uses
-* @return {import('types').Uses}
-*/
-function deserialize_uses(uses) {
- return {
- dependencies: new Set(uses?.dependencies ?? []),
- params: new Set(uses?.params ?? []),
- parent: !!uses?.parent,
- route: !!uses?.route,
- url: !!uses?.url,
- search_params: new Set(uses?.search_params ?? [])
- };
-}
-/**
-* @param {URL} url
-* @param {boolean} [scroll]
-*/
-function reset_focus(url, scroll = true) {
- const autofocus = document.querySelector("[autofocus]");
- if (autofocus) autofocus.focus();
- else {
- const id = get_id(url);
- if (id && document.getElementById(id)) {
- const { x, y } = scroll_state();
- setTimeout(() => {
- const history_state = history.state;
- location.replace(new URL(`#${id}`, location.href));
- history.replaceState(history_state, "", url);
- if (scroll) scrollTo(x, y);
- });
- } else {
- const root = document.body;
- const tabindex = root.getAttribute("tabindex");
- root.tabIndex = -1;
- root.focus({
- preventScroll: true,
- focusVisible: false
- });
- if (tabindex !== null) root.setAttribute("tabindex", tabindex);
- else root.removeAttribute("tabindex");
- }
- const selection = getSelection();
- if (selection && selection.type !== "None") {
- /** @type {Range[]} */
- const ranges = [];
- for (let i = 0; i < selection.rangeCount; i += 1) ranges.push(selection.getRangeAt(i));
- setTimeout(() => {
- if (selection.rangeCount !== ranges.length) return;
- for (let i = 0; i < selection.rangeCount; i += 1) {
- const a = ranges[i];
- const b = selection.getRangeAt(i);
- if (a.commonAncestorContainer !== b.commonAncestorContainer || a.startContainer !== b.startContainer || a.endContainer !== b.endContainer || a.startOffset !== b.startOffset || a.endOffset !== b.endOffset) return;
- }
- selection.removeAllRanges();
- });
- }
- }
-}
-/**
-* @template {import('@sveltejs/kit').NavigationType} T
-* @param {import('./types.js').NavigationState} current
-* @param {import('./types.js').NavigationIntent | undefined} intent
-* @param {URL | null} url
-* @param {T} type
-* @param {{ x: number, y: number } | null} [target_scroll] The scroll position for the target (for popstate navigations)
-*/
-function create_navigation(current, intent, url, type, target_scroll = null) {
- /** @type {(value: any) => void} */
- let fulfil;
- /** @type {(error: any) => void} */
- let reject;
- const complete = new Promise((f, r) => {
- fulfil = f;
- reject = r;
- });
- complete.catch(noop);
- return {
- navigation: {
- from: {
- params: current.params,
- route: { id: current.route?.id ?? null },
- url: current.url,
- scroll: scroll_state()
- },
- to: url && {
- params: intent?.params ?? null,
- route: { id: intent?.route?.id ?? null },
- url,
- scroll: target_scroll
- },
- willUnload: !intent,
- type,
- complete
- },
- fulfil,
- reject
- };
-}
-/**
-* TODO: remove this in 3.0 when the page store is also removed
-*
-* We need to assign a new page object so that subscribers are correctly notified.
-* However, spreading `{ ...page }` returns an empty object so we manually
-* assign to each property instead.
-*
-* @param {import('@sveltejs/kit').Page} page
-*/
-function clone_page(page) {
- return {
- data: page.data,
- error: page.error,
- form: page.form,
- params: page.params,
- route: page.route,
- state: page.state,
- status: page.status,
- url: page.url
- };
-}
-/**
-* @param {URL} url
-* @returns {string}
-*/
-function get_id(url) {
- let id;
- if (app.hash) {
- const [, , second] = url.hash.split("#", 3);
- id = second ?? "";
- } else id = url.hash.slice(1);
- return decodeURIComponent(id);
-}
-//#endregion
-export { updated as a, page as i, stores as n, navigating as r, goto as t };
diff --git a/frontend/.svelte-kit/output/server/chunks/dev.js b/frontend/.svelte-kit/output/server/chunks/dev.js
deleted file mode 100644
index 97606f7..0000000
--- a/frontend/.svelte-kit/output/server/chunks/dev.js
+++ /dev/null
@@ -1,4055 +0,0 @@
-import * as devalue from "devalue";
-import { clsx } from "clsx";
-//#region node_modules/svelte/src/internal/shared/errors.js
-/**
-* Cannot use `%name%(...)` unless the `experimental.async` compiler option is `true`
-* @param {string} name
-* @returns {never}
-*/
-function experimental_async_required(name) {
- throw new Error(`https://svelte.dev/e/experimental_async_required`);
-}
-/**
-* `%name%(...)` can only be used during component initialisation
-* @param {string} name
-* @returns {never}
-*/
-function lifecycle_outside_component(name) {
- throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
-}
-/**
-* Context was not set in a parent component
-* @returns {never}
-*/
-function missing_context() {
- throw new Error(`https://svelte.dev/e/missing_context`);
-}
-//#endregion
-//#region node_modules/svelte/src/internal/server/errors.js
-/**
-* The node API `AsyncLocalStorage` is not available, but is required to use async server rendering.
-* @returns {never}
-*/
-function async_local_storage_unavailable() {
- const error = /* @__PURE__ */ new Error(`async_local_storage_unavailable\nThe node API \`AsyncLocalStorage\` is not available, but is required to use async server rendering.\nhttps://svelte.dev/e/async_local_storage_unavailable`);
- error.name = "Svelte error";
- throw error;
-}
-/**
-* Encountered asynchronous work while rendering synchronously.
-* @returns {never}
-*/
-function await_invalid() {
- const error = /* @__PURE__ */ new Error(`await_invalid\nEncountered asynchronous work while rendering synchronously.\nhttps://svelte.dev/e/await_invalid`);
- error.name = "Svelte error";
- throw error;
-}
-/**
-* The `html` property of server render results has been deprecated. Use `body` instead.
-* @returns {never}
-*/
-function html_deprecated() {
- const error = /* @__PURE__ */ new Error(`html_deprecated\nThe \`html\` property of server render results has been deprecated. Use \`body\` instead.\nhttps://svelte.dev/e/html_deprecated`);
- error.name = "Svelte error";
- throw error;
-}
-/**
-* Attempted to set `hydratable` with key `%key%` twice with different values.
-*
-* %stack%
-* @param {string} key
-* @param {string} stack
-* @returns {never}
-*/
-function hydratable_clobbering(key, stack) {
- const error = /* @__PURE__ */ new Error(`hydratable_clobbering\nAttempted to set \`hydratable\` with key \`${key}\` twice with different values.
-
-${stack}\nhttps://svelte.dev/e/hydratable_clobbering`);
- error.name = "Svelte error";
- throw error;
-}
-/**
-* Failed to serialize `hydratable` data for key `%key%`.
-*
-* `hydratable` can serialize anything [`uneval` from `devalue`](https://npmjs.com/package/uneval) can, plus Promises.
-*
-* Cause:
-* %stack%
-* @param {string} key
-* @param {string} stack
-* @returns {never}
-*/
-function hydratable_serialization_failed(key, stack) {
- const error = /* @__PURE__ */ new Error(`hydratable_serialization_failed\nFailed to serialize \`hydratable\` data for key \`${key}\`.
-
-\`hydratable\` can serialize anything [\`uneval\` from \`devalue\`](https://npmjs.com/package/uneval) can, plus Promises.
-
-Cause:
-${stack}\nhttps://svelte.dev/e/hydratable_serialization_failed`);
- error.name = "Svelte error";
- throw error;
-}
-/**
-* `csp.nonce` was set while `csp.hash` was `true`. These options cannot be used simultaneously.
-* @returns {never}
-*/
-function invalid_csp() {
- const error = /* @__PURE__ */ new Error(`invalid_csp\n\`csp.nonce\` was set while \`csp.hash\` was \`true\`. These options cannot be used simultaneously.\nhttps://svelte.dev/e/invalid_csp`);
- error.name = "Svelte error";
- throw error;
-}
-/**
-* The `idPrefix` option cannot include `--`.
-* @returns {never}
-*/
-function invalid_id_prefix() {
- const error = /* @__PURE__ */ new Error(`invalid_id_prefix\nThe \`idPrefix\` option cannot include \`--\`.\nhttps://svelte.dev/e/invalid_id_prefix`);
- error.name = "Svelte error";
- throw error;
-}
-/**
-* `%name%(...)` is not available on the server
-* @param {string} name
-* @returns {never}
-*/
-function lifecycle_function_unavailable(name) {
- const error = /* @__PURE__ */ new Error(`lifecycle_function_unavailable\n\`${name}(...)\` is not available on the server\nhttps://svelte.dev/e/lifecycle_function_unavailable`);
- error.name = "Svelte error";
- throw error;
-}
-/**
-* Could not resolve `render` context.
-* @returns {never}
-*/
-function server_context_required() {
- const error = /* @__PURE__ */ new Error(`server_context_required\nCould not resolve \`render\` context.\nhttps://svelte.dev/e/server_context_required`);
- error.name = "Svelte error";
- throw error;
-}
-//#endregion
-//#region node_modules/svelte/src/internal/server/context.js
-/** @import { SSRContext } from '#server' */
-/** @type {SSRContext | null} */
-var ssr_context = null;
-/** @param {SSRContext | null} v */
-function set_ssr_context(v) {
- ssr_context = v;
-}
-/**
-* @template T
-* @returns {[() => T, (context: T) => T]}
-* @since 5.40.0
-*/
-function createContext() {
- const key = {};
- return [() => {
- if (!hasContext(key)) missing_context();
- return getContext(key);
- }, (context) => setContext(key, context)];
-}
-/**
-* @template T
-* @param {any} key
-* @returns {T}
-*/
-function getContext(key) {
- return get_or_init_context_map("getContext").get(key);
-}
-/**
-* @template T
-* @param {any} key
-* @param {T} context
-* @returns {T}
-*/
-function setContext(key, context) {
- get_or_init_context_map("setContext").set(key, context);
- return context;
-}
-/**
-* @param {any} key
-* @returns {boolean}
-*/
-function hasContext(key) {
- return get_or_init_context_map("hasContext").has(key);
-}
-/** @returns {Map} */
-function getAllContexts() {
- return get_or_init_context_map("getAllContexts");
-}
-/**
-* @param {string} name
-* @returns {Map}
-*/
-function get_or_init_context_map(name) {
- if (ssr_context === null) lifecycle_outside_component(name);
- return ssr_context.c ??= new Map(get_parent_context(ssr_context) || void 0);
-}
-/**
-* @param {Function} [fn]
-*/
-function push$1(fn) {
- ssr_context = {
- p: ssr_context,
- c: null,
- r: null
- };
-}
-function pop$1() {
- ssr_context = ssr_context.p;
-}
-/**
-* @param {SSRContext} ssr_context
-* @returns {Map | null}
-*/
-function get_parent_context(ssr_context) {
- let parent = ssr_context.p;
- while (parent !== null) {
- const context_map = parent.c;
- if (context_map !== null) return context_map;
- parent = parent.p;
- }
- return null;
-}
-//#endregion
-//#region node_modules/svelte/src/internal/shared/utils.js
-var is_array = Array.isArray;
-var index_of = Array.prototype.indexOf;
-var includes = Array.prototype.includes;
-var array_from = Array.from;
-var define_property = Object.defineProperty;
-var get_descriptor = Object.getOwnPropertyDescriptor;
-var object_prototype = Object.prototype;
-var array_prototype = Array.prototype;
-var get_prototype_of = Object.getPrototypeOf;
-var is_extensible = Object.isExtensible;
-var has_own_property = Object.prototype.hasOwnProperty;
-var noop = () => {};
-/** @param {Function} fn */
-function run(fn) {
- return fn();
-}
-/** @param {Array<() => void>} arr */
-function run_all(arr) {
- for (var i = 0; i < arr.length; i++) arr[i]();
-}
-/**
-* TODO replace with Promise.withResolvers once supported widely enough
-* @template [T=void]
-*/
-function deferred() {
- /** @type {(value: T) => void} */
- var resolve;
- /** @type {(reason: any) => void} */
- var reject;
- return {
- promise: new Promise((res, rej) => {
- resolve = res;
- reject = rej;
- }),
- resolve,
- reject
- };
-}
-var CLEAN = 1024;
-var DIRTY = 2048;
-var MAYBE_DIRTY = 4096;
-var INERT = 8192;
-var DESTROYED = 16384;
-/** Set once a reaction has run for the first time */
-var REACTION_RAN = 32768;
-/** Effect is in the process of getting destroyed. Can be observed in child teardown functions */
-var DESTROYING = 1 << 25;
-/**
-* 'Transparent' effects do not create a transition boundary.
-* 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
-*/
-var EFFECT_TRANSPARENT = 65536;
-var EFFECT_PRESERVED = 1 << 19;
-var USER_EFFECT = 1 << 20;
-/**
-* Tells that we marked this derived and its reactions as visited during the "mark as (maybe) dirty"-phase.
-* Will be lifted during execution of the derived and during checking its dirty state (both are necessary
-* because a derived might be checked but not executed). This is a pure performance optimization flag and
-* should not be used for any other purpose!
-*/
-var WAS_MARKED = 65536;
-var REACTION_IS_UPDATING = 1 << 21;
-var ERROR_VALUE = 1 << 23;
-var STATE_SYMBOL = Symbol("$state");
-var LEGACY_PROPS = Symbol("legacy props");
-/** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */
-var STALE_REACTION = new class StaleReactionError extends Error {
- name = "StaleReactionError";
- message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
-}();
-globalThis.document?.contentType;
-//#endregion
-//#region node_modules/svelte/src/internal/server/abort-signal.js
-/** @type {AbortController | null} */
-var controller = null;
-function abort() {
- controller?.abort(STALE_REACTION);
- controller = null;
-}
-function getAbortSignal() {
- return (controller ??= new AbortController()).signal;
-}
-//#endregion
-//#region node_modules/svelte/src/internal/flags/index.js
-/** True if experimental.async=true */
-var async_mode_flag = false;
-/** True if we're not certain that we only have Svelte 5 code in the compilation */
-var legacy_mode_flag = false;
-//#endregion
-//#region node_modules/svelte/src/internal/server/render-context.js
-/** @import { AsyncLocalStorage } from 'node:async_hooks' */
-/** @import { RenderContext } from '#server' */
-/** @type {Promise | null} */
-var current_render = null;
-/** @type {RenderContext | null} */
-var context = null;
-/** @returns {RenderContext} */
-function get_render_context() {
- const store = context ?? als?.getStore();
- if (!store) server_context_required();
- return store;
-}
-/**
-* @template T
-* @param {() => Promise} fn
-* @returns {Promise}
-*/
-async function with_render_context(fn) {
- context = { hydratable: {
- lookup: /* @__PURE__ */ new Map(),
- comparisons: [],
- unresolved_promises: /* @__PURE__ */ new Map()
- } };
- if (in_webcontainer()) {
- const { promise, resolve } = deferred();
- const previous_render = current_render;
- current_render = promise;
- await previous_render;
- return fn().finally(resolve);
- }
- try {
- if (als === null) async_local_storage_unavailable();
- return als.run(context, fn);
- } finally {
- context = null;
- }
-}
-/** @type {AsyncLocalStorage | null} */
-var als = null;
-/** @type {Promise | null} */
-var als_import = null;
-/**
-*
-* @returns {Promise}
-*/
-function init_render_context() {
- als_import ??= import("node:async_hooks").then((hooks) => {
- als = new hooks.AsyncLocalStorage();
- }).then(noop, noop);
- return als_import;
-}
-function in_webcontainer() {
- return !!globalThis.process?.versions?.webcontainer;
-}
-/**
-* @returns {string[]}
-*/
-function get_stack() {
- const limit = Error.stackTraceLimit;
- Error.stackTraceLimit = Infinity;
- const stack = (/* @__PURE__ */ new Error()).stack;
- Error.stackTraceLimit = limit;
- if (!stack) return [];
- const lines = stack.split("\n");
- const new_lines = [];
- for (let i = 0; i < lines.length; i++) {
- const line = lines[i];
- const posixified = line.replaceAll("\\", "/");
- if (line.trim() === "Error") continue;
- if (line.includes("validate_each_keys")) return [];
- if (posixified.includes("svelte/src/internal") || posixified.includes("node_modules/.vite")) continue;
- new_lines.push(line);
- }
- return new_lines;
-}
-//#endregion
-//#region node_modules/svelte/src/constants.js
-var HYDRATION_ERROR = {};
-var UNINITIALIZED = Symbol();
-/**
-* A `hydratable` value with key `%key%` was created, but at least part of it was not used during the render.
-*
-* The `hydratable` was initialized in:
-* %stack%
-* @param {string} key
-* @param {string} stack
-*/
-function unresolved_hydratable(key, stack) {
- console.warn(`https://svelte.dev/e/unresolved_hydratable`);
-}
-//#endregion
-//#region node_modules/svelte/src/internal/server/hydration.js
-var BLOCK_OPEN = ``;
-var BLOCK_CLOSE = ``;
-//#endregion
-//#region node_modules/svelte/src/escaping.js
-var ATTR_REGEX = /[&"<]/g;
-var CONTENT_REGEX = /[&<]/g;
-/**
-* @template V
-* @param {V} value
-* @param {boolean} [is_attr]
-*/
-function escape_html(value, is_attr) {
- const str = String(value ?? "");
- const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;
- pattern.lastIndex = 0;
- let escaped = "";
- let last = 0;
- while (pattern.test(str)) {
- const i = pattern.lastIndex - 1;
- const ch = str[i];
- escaped += str.substring(last, i) + (ch === "&" ? "&" : ch === "\"" ? """ : "<");
- last = i + 1;
- }
- return escaped + str.substring(last);
-}
-//#endregion
-//#region node_modules/svelte/src/internal/shared/attributes.js
-/**
-* `
` should be rendered as `
` and _not_
-* `
`, which is equivalent to `
`. There
-* may be other odd cases that need to be added to this list in future
-* @type {Record>}
-*/
-var replacements = { translate: new Map([[true, "yes"], [false, "no"]]) };
-/**
-* @template V
-* @param {string} name
-* @param {V} value
-* @param {boolean} [is_boolean]
-* @returns {string}
-*/
-function attr(name, value, is_boolean = false) {
- if (name === "hidden" && value !== "until-found") is_boolean = true;
- if (value == null || !value && is_boolean) return "";
- const normalized = has_own_property.call(replacements, name) && replacements[name].get(value) || value;
- return ` ${name}${is_boolean ? `=""` : `="${escape_html(normalized, true)}"`}`;
-}
-/**
-* Small wrapper around clsx to preserve Svelte's (weird) handling of falsy values.
-* TODO Svelte 6 revisit this, and likely turn all falsy values into the empty string (what clsx also does)
-* @param {any} value
-*/
-function clsx$1(value) {
- if (typeof value === "object") return clsx(value);
- else return value ?? "";
-}
-var whitespace = [..." \n\r\f\xA0\v"];
-/**
-* @param {any} value
-* @param {string | null} [hash]
-* @param {Record} [directives]
-* @returns {string | null}
-*/
-function to_class(value, hash, directives) {
- var classname = value == null ? "" : "" + value;
- if (hash) classname = classname ? classname + " " + hash : hash;
- if (directives) {
- for (var key of Object.keys(directives)) if (directives[key]) classname = classname ? classname + " " + key : key;
- else if (classname.length) {
- var len = key.length;
- var a = 0;
- while ((a = classname.indexOf(key, a)) >= 0) {
- var b = a + len;
- if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
- else a = b;
- }
- }
- }
- return classname === "" ? null : classname;
-}
-/**
-*
-* @param {Record} styles
-* @param {boolean} important
-*/
-function append_styles(styles, important = false) {
- var separator = important ? " !important;" : ";";
- var css = "";
- for (var key of Object.keys(styles)) {
- var value = styles[key];
- if (value != null && value !== "") css += " " + key + ": " + value + separator;
- }
- return css;
-}
-/**
-* @param {string} name
-* @returns {string}
-*/
-function to_css_name(name) {
- if (name[0] !== "-" || name[1] !== "-") return name.toLowerCase();
- return name;
-}
-/**
-* @param {any} value
-* @param {Record | [Record, Record]} [styles]
-* @returns {string | null}
-*/
-function to_style(value, styles) {
- if (styles) {
- var new_style = "";
- /** @type {Record | undefined} */
- var normal_styles;
- /** @type {Record | undefined} */
- var important_styles;
- if (Array.isArray(styles)) {
- normal_styles = styles[0];
- important_styles = styles[1];
- } else normal_styles = styles;
- if (value) {
- value = String(value).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
- /** @type {boolean | '"' | "'"} */
- var in_str = false;
- var in_apo = 0;
- var in_comment = false;
- var reserved_names = [];
- if (normal_styles) reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
- if (important_styles) reserved_names.push(...Object.keys(important_styles).map(to_css_name));
- var start_index = 0;
- var name_index = -1;
- const len = value.length;
- for (var i = 0; i < len; i++) {
- var c = value[i];
- if (in_comment) {
- if (c === "/" && value[i - 1] === "*") in_comment = false;
- } else if (in_str) {
- if (in_str === c) in_str = false;
- } else if (c === "/" && value[i + 1] === "*") in_comment = true;
- else if (c === "\"" || c === "'") in_str = c;
- else if (c === "(") in_apo++;
- else if (c === ")") in_apo--;
- if (!in_comment && in_str === false && in_apo === 0) {
- if (c === ":" && name_index === -1) name_index = i;
- else if (c === ";" || i === len - 1) {
- if (name_index !== -1) {
- var name = to_css_name(value.substring(start_index, name_index).trim());
- if (!reserved_names.includes(name)) {
- if (c !== ";") i++;
- var property = value.substring(start_index, i).trim();
- new_style += " " + property + ";";
- }
- }
- start_index = i + 1;
- name_index = -1;
- }
- }
- }
- }
- if (normal_styles) new_style += append_styles(normal_styles);
- if (important_styles) new_style += append_styles(important_styles, true);
- new_style = new_style.trim();
- return new_style === "" ? null : new_style;
- }
- return value == null ? null : String(value);
-}
-/**
-* Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
-* @returns {never}
-*/
-function effect_update_depth_exceeded() {
- throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
-}
-/**
-* Failed to hydrate the application
-* @returns {never}
-*/
-function hydration_failed() {
- throw new Error(`https://svelte.dev/e/hydration_failed`);
-}
-/**
-* Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
-* @returns {never}
-*/
-function state_descriptors_fixed() {
- throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
-}
-/**
-* Cannot set prototype of `$state` object
-* @returns {never}
-*/
-function state_prototype_fixed() {
- throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
-}
-/**
-* Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
-* @returns {never}
-*/
-function state_unsafe_mutation() {
- throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
-}
-/**
-* A `` `reset` function cannot be called while an error is still being handled
-* @returns {never}
-*/
-function svelte_boundary_reset_onerror() {
- throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
-}
-/**
-* Reading a derived belonging to a now-destroyed effect may result in stale values
-*/
-function derived_inert() {
- console.warn(`https://svelte.dev/e/derived_inert`);
-}
-/**
-* Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location%
-* @param {string | undefined | null} [location]
-*/
-function hydration_mismatch(location) {
- console.warn(`https://svelte.dev/e/hydration_mismatch`);
-}
-/**
-* Tried to unmount a component that was not mounted
-*/
-function lifecycle_double_unmount() {
- console.warn(`https://svelte.dev/e/lifecycle_double_unmount`);
-}
-/**
-* Tried to unmount a state proxy, rather than a component
-*/
-function state_proxy_unmount() {
- console.warn(`https://svelte.dev/e/state_proxy_unmount`);
-}
-/**
-* A `` `reset` function only resets the boundary the first time it is called
-*/
-function svelte_boundary_reset_noop() {
- console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
-}
-//#endregion
-//#region node_modules/svelte/src/internal/client/dom/hydration.js
-/** @import { TemplateNode } from '#client' */
-/**
-* Use this variable to guard everything related to hydration code so it can be treeshaken out
-* if the user doesn't use the `hydrate` method and these code paths are therefore not needed.
-*/
-var hydrating = false;
-/** @param {boolean} value */
-function set_hydrating(value) {
- hydrating = value;
-}
-/**
-* The node that is currently being hydrated. This starts out as the first node inside the opening
-* comment, and updates each time a component calls `$.child(...)` or `$.sibling(...)`.
-* When entering a block (e.g. `{#if ...}`), `hydrate_node` is the block opening comment; by the
-* time we leave the block it is the closing comment, which serves as the block's anchor.
-* @type {TemplateNode}
-*/
-var hydrate_node;
-/** @param {TemplateNode | null} node */
-function set_hydrate_node(node) {
- if (node === null) {
- hydration_mismatch();
- throw HYDRATION_ERROR;
- }
- return hydrate_node = node;
-}
-function hydrate_next() {
- return set_hydrate_node(/* @__PURE__ */ get_next_sibling(hydrate_node));
-}
-function next(count = 1) {
- if (hydrating) {
- var i = count;
- var node = hydrate_node;
- while (i--) node = /* @__PURE__ */ get_next_sibling(node);
- hydrate_node = node;
- }
-}
-/**
-* Skips or removes (depending on {@link remove}) all nodes starting at `hydrate_node` up until the next hydration end comment
-* @param {boolean} remove
-*/
-function skip_nodes(remove = true) {
- var depth = 0;
- var node = hydrate_node;
- while (true) {
- if (node.nodeType === 8) {
- var data = node.data;
- if (data === "]") {
- if (depth === 0) return node;
- depth -= 1;
- } else if (data === "[" || data === "[!" || data[0] === "[" && !isNaN(Number(data.slice(1)))) depth += 1;
- }
- var next = /* @__PURE__ */ get_next_sibling(node);
- if (remove) node.remove();
- node = next;
- }
-}
-//#endregion
-//#region node_modules/svelte/src/internal/client/reactivity/equality.js
-/** @import { Equals } from '#client' */
-/** @type {Equals} */
-function equals(value) {
- return value === this.v;
-}
-/**
-* @param {unknown} a
-* @param {unknown} b
-* @returns {boolean}
-*/
-function safe_not_equal(a, b) {
- return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
-}
-/** @type {Equals} */
-function safe_equals(value) {
- return !safe_not_equal(value, this.v);
-}
-//#endregion
-//#region node_modules/svelte/src/internal/client/context.js
-/** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
-/** @type {ComponentContext | null} */
-var component_context = null;
-/** @param {ComponentContext | null} context */
-function set_component_context(context) {
- component_context = context;
-}
-/**
-* @param {Record} props
-* @param {any} runes
-* @param {Function} [fn]
-* @returns {void}
-*/
-function push(props, runes = false, fn) {
- component_context = {
- p: component_context,
- i: false,
- c: null,
- e: null,
- s: props,
- x: null,
- r: active_effect,
- l: legacy_mode_flag && !runes ? {
- s: null,
- u: null,
- $: []
- } : null
- };
-}
-/**
-* @template {Record} T
-* @param {T} [component]
-* @returns {T}
-*/
-function pop(component) {
- var context = component_context;
- var effects = context.e;
- if (effects !== null) {
- context.e = null;
- for (var fn of effects) create_user_effect(fn);
- }
- if (component !== void 0) context.x = component;
- context.i = true;
- component_context = context.p;
- return component ?? {};
-}
-/** @returns {boolean} */
-function is_runes() {
- return !legacy_mode_flag || component_context !== null && component_context.l === null;
-}
-//#endregion
-//#region node_modules/svelte/src/internal/client/dom/task.js
-/** @type {Array<() => void>} */
-var micro_tasks = [];
-function run_micro_tasks() {
- var tasks = micro_tasks;
- micro_tasks = [];
- run_all(tasks);
-}
-/**
-* @param {() => void} fn
-*/
-function queue_micro_task(fn) {
- if (micro_tasks.length === 0 && !is_flushing_sync) {
- var tasks = micro_tasks;
- queueMicrotask(() => {
- if (tasks === micro_tasks) run_micro_tasks();
- });
- }
- micro_tasks.push(fn);
-}
-/**
-* Synchronously run any queued tasks.
-*/
-function flush_tasks() {
- while (micro_tasks.length > 0) run_micro_tasks();
-}
-/**
-* @param {unknown} error
-*/
-function handle_error(error) {
- var effect = active_effect;
- if (effect === null) {
- /** @type {Derived} */ active_reaction.f |= ERROR_VALUE;
- return error;
- }
- if ((effect.f & 32768) === 0 && (effect.f & 4) === 0) throw error;
- invoke_error_boundary(error, effect);
-}
-/**
-* @param {unknown} error
-* @param {Effect | null} effect
-*/
-function invoke_error_boundary(error, effect) {
- while (effect !== null) {
- if ((effect.f & 128) !== 0) {
- if ((effect.f & 32768) === 0) throw error;
- try {
- /** @type {Boundary} */ effect.b.error(error);
- return;
- } catch (e) {
- error = e;
- }
- }
- effect = effect.parent;
- }
- throw error;
-}
-//#endregion
-//#region node_modules/svelte/src/internal/client/reactivity/status.js
-/** @import { Derived, Signal } from '#client' */
-var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
-/**
-* @param {Signal} signal
-* @param {number} status
-*/
-function set_signal_status(signal, status) {
- signal.f = signal.f & STATUS_MASK | status;
-}
-/**
-* Set a derived's status to CLEAN or MAYBE_DIRTY based on its connection state.
-* @param {Derived} derived
-*/
-function update_derived_status(derived) {
- if ((derived.f & 512) !== 0 || derived.deps === null) set_signal_status(derived, CLEAN);
- else set_signal_status(derived, MAYBE_DIRTY);
-}
-//#endregion
-//#region node_modules/svelte/src/internal/client/reactivity/utils.js
-/** @import { Derived, Effect, Value } from '#client' */
-/**
-* @param {Value[] | null} deps
-*/
-function clear_marked(deps) {
- if (deps === null) return;
- for (const dep of deps) {
- if ((dep.f & 2) === 0 || (dep.f & 65536) === 0) continue;
- dep.f ^= WAS_MARKED;
- clear_marked(
- /** @type {Derived} */
- dep.deps
- );
- }
-}
-/**
-* @param {Effect} effect
-* @param {Set} dirty_effects
-* @param {Set} maybe_dirty_effects
-*/
-function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
- if ((effect.f & 2048) !== 0) dirty_effects.add(effect);
- else if ((effect.f & 4096) !== 0) maybe_dirty_effects.add(effect);
- clear_marked(effect.deps);
- set_signal_status(effect, CLEAN);
-}
-//#endregion
-//#region node_modules/svelte/src/store/shared/index.js
-/** @import { Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable } from '../public.js' */
-/** @import { Stores, StoresValues, SubscribeInvalidateTuple } from '../private.js' */
-/**
-* @type {Array | any>}
-*/
-var subscriber_queue = [];
-/**
-* Creates a `Readable` store that allows reading by subscription.
-*
-* @template T
-* @param {T} [value] initial value
-* @param {StartStopNotifier} [start]
-* @returns {Readable}
-*/
-function readable(value, start) {
- return { subscribe: writable(value, start).subscribe };
-}
-/**
-* Create a `Writable` store that allows both updating and reading by subscription.
-*
-* @template T
-* @param {T} [value] initial value
-* @param {StartStopNotifier} [start]
-* @returns {Writable}
-*/
-function writable(value, start = noop) {
- /** @type {Unsubscriber | null} */
- let stop = null;
- /** @type {Set>} */
- const subscribers = /* @__PURE__ */ new Set();
- /**
- * @param {T} new_value
- * @returns {void}
- */
- function set(new_value) {
- if (safe_not_equal(value, new_value)) {
- value = new_value;
- if (stop) {
- const run_queue = !subscriber_queue.length;
- for (const subscriber of subscribers) {
- subscriber[1]();
- subscriber_queue.push(subscriber, value);
- }
- if (run_queue) {
- for (let i = 0; i < subscriber_queue.length; i += 2) subscriber_queue[i][0](subscriber_queue[i + 1]);
- subscriber_queue.length = 0;
- }
- }
- }
- }
- /**
- * @param {Updater} fn
- * @returns {void}
- */
- function update(fn) {
- set(fn(value));
- }
- /**
- * @param {Subscriber} run
- * @param {() => void} [invalidate]
- * @returns {Unsubscriber}
- */
- function subscribe(run, invalidate = noop) {
- /** @type {SubscribeInvalidateTuple} */
- const subscriber = [run, invalidate];
- subscribers.add(subscriber);
- if (subscribers.size === 1) stop = start(set, update) || noop;
- run(value);
- return () => {
- subscribers.delete(subscriber);
- if (subscribers.size === 0 && stop) {
- stop();
- stop = null;
- }
- };
- }
- return {
- set,
- update,
- subscribe
- };
-}
-/**
-* Get the current value from a store by subscribing and immediately unsubscribing.
-*
-* @template T
-* @param {Readable} store
-* @returns {T}
-*/
-function get$1(store) {
- let value;
- subscribe_to_store(store, (_) => value = _)();
- return value;
-}
-//#endregion
-//#region node_modules/svelte/src/internal/client/reactivity/store.js
-/**
-* We set this to `true` when updating a store so that we correctly
-* schedule effects if the update takes place inside a `$:` effect
-*/
-var legacy_is_updating_store = false;
-//#endregion
-//#region node_modules/svelte/src/internal/client/reactivity/batch.js
-/** @import { Fork } from 'svelte' */
-/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
-/** @type {Set} */
-var batches = /* @__PURE__ */ new Set();
-/** @type {Batch | null} */
-var current_batch = null;
-/**
-* When time travelling (i.e. working in one batch, while other batches
-* still have ongoing work), we ignore the real values of affected
-* signals in favour of their values within the batch
-* @type {Map | null}
-*/
-var batch_values = null;
-/** @type {Effect | null} */
-var last_scheduled_effect = null;
-var is_flushing_sync = false;
-var is_processing = false;
-/**
-* During traversal, this is an array. Newly created effects are (if not immediately
-* executed) pushed to this array, rather than going through the scheduling
-* rigamarole that would cause another turn of the flush loop.
-* @type {Effect[] | null}
-*/
-var collected_effects = null;
-/**
-* An array of effects that are marked during traversal as a result of a `set`
-* (not `internal_set`) call. These will be added to the next batch and
-* trigger another `batch.process()`
-* @type {Effect[] | null}
-* @deprecated when we get rid of legacy mode and stores, we can get rid of this
-*/
-var legacy_updates = null;
-var flush_count = 0;
-var uid = 1;
-var Batch = class Batch {
- id = uid++;
- /**
- * The current values of any signals that are updated in this batch.
- * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
- * They keys of this map are identical to `this.#previous`
- * @type {Map}
- */
- current = /* @__PURE__ */ new Map();
- /**
- * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
- * They keys of this map are identical to `this.#current`
- * @type {Map}
- */
- previous = /* @__PURE__ */ new Map();
- /**
- * When the batch is committed (and the DOM is updated), we need to remove old branches
- * and append new ones by calling the functions added inside (if/each/key/etc) blocks
- * @type {Set<(batch: Batch) => void>}
- */
- #commit_callbacks = /* @__PURE__ */ new Set();
- /**
- * If a fork is discarded, we need to destroy any effects that are no longer needed
- * @type {Set<(batch: Batch) => void>}
- */
- #discard_callbacks = /* @__PURE__ */ new Set();
- /**
- * Callbacks that should run only when a fork is committed.
- * @type {Set<(batch: Batch) => void>}
- */
- #fork_commit_callbacks = /* @__PURE__ */ new Set();
- /**
- * Async effects that are currently in flight
- * @type {Map}
- */
- #pending = /* @__PURE__ */ new Map();
- /**
- * Async effects that are currently in flight, _not_ inside a pending boundary
- * @type {Map}
- */
- #blocking_pending = /* @__PURE__ */ new Map();
- /**
- * A deferred that resolves when the batch is committed, used with `settled()`
- * TODO replace with Promise.withResolvers once supported widely enough
- * @type {{ promise: Promise, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
- */
- #deferred = null;
- /**
- * The root effects that need to be flushed
- * @type {Effect[]}
- */
- #roots = [];
- /**
- * Effects created while this batch was active.
- * @type {Effect[]}
- */
- #new_effects = [];
- /**
- * Deferred effects (which run after async work has completed) that are DIRTY
- * @type {Set}
- */
- #dirty_effects = /* @__PURE__ */ new Set();
- /**
- * Deferred effects that are MAYBE_DIRTY
- * @type {Set}
- */
- #maybe_dirty_effects = /* @__PURE__ */ new Set();
- /**
- * A map of branches that still exist, but will be destroyed when this batch
- * is committed — we skip over these during `process`.
- * The value contains child effects that were dirty/maybe_dirty before being reset,
- * so they can be rescheduled if the branch survives.
- * @type {Map}
- */
- #skipped_branches = /* @__PURE__ */ new Map();
- /**
- * Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing
- * @type {Set}
- */
- #unskipped_branches = /* @__PURE__ */ new Set();
- is_fork = false;
- #decrement_queued = false;
- /** @type {Set} */
- #blockers = /* @__PURE__ */ new Set();
- #is_deferred() {
- return this.is_fork || this.#blocking_pending.size > 0;
- }
- #is_blocked() {
- for (const batch of this.#blockers) for (const effect of batch.#blocking_pending.keys()) {
- var skipped = false;
- var e = effect;
- while (e.parent !== null) {
- if (this.#skipped_branches.has(e)) {
- skipped = true;
- break;
- }
- e = e.parent;
- }
- if (!skipped) return true;
- }
- return false;
- }
- /**
- * Add an effect to the #skipped_branches map and reset its children
- * @param {Effect} effect
- */
- skip_effect(effect) {
- if (!this.#skipped_branches.has(effect)) this.#skipped_branches.set(effect, {
- d: [],
- m: []
- });
- this.#unskipped_branches.delete(effect);
- }
- /**
- * Remove an effect from the #skipped_branches map and reschedule
- * any tracked dirty/maybe_dirty child effects
- * @param {Effect} effect
- * @param {(e: Effect) => void} callback
- */
- unskip_effect(effect, callback = (e) => this.schedule(e)) {
- var tracked = this.#skipped_branches.get(effect);
- if (tracked) {
- this.#skipped_branches.delete(effect);
- for (var e of tracked.d) {
- set_signal_status(e, DIRTY);
- callback(e);
- }
- for (e of tracked.m) {
- set_signal_status(e, MAYBE_DIRTY);
- callback(e);
- }
- }
- this.#unskipped_branches.add(effect);
- }
- #process() {
- if (flush_count++ > 1e3) {
- batches.delete(this);
- infinite_loop_guard();
- }
- if (!this.#is_deferred()) {
- for (const e of this.#dirty_effects) {
- this.#maybe_dirty_effects.delete(e);
- set_signal_status(e, DIRTY);
- this.schedule(e);
- }
- for (const e of this.#maybe_dirty_effects) {
- set_signal_status(e, MAYBE_DIRTY);
- this.schedule(e);
- }
- }
- const roots = this.#roots;
- this.#roots = [];
- this.apply();
- /** @type {Effect[]} */
- var effects = collected_effects = [];
- /** @type {Effect[]} */
- var render_effects = [];
- /**
- * @type {Effect[]}
- * @deprecated when we get rid of legacy mode and stores, we can get rid of this
- */
- var updates = legacy_updates = [];
- for (const root of roots) try {
- this.#traverse(root, effects, render_effects);
- } catch (e) {
- reset_all(root);
- throw e;
- }
- current_batch = null;
- if (updates.length > 0) {
- var batch = Batch.ensure();
- for (const e of updates) batch.schedule(e);
- }
- collected_effects = null;
- legacy_updates = null;
- if (this.#is_deferred() || this.#is_blocked()) {
- this.#defer_effects(render_effects);
- this.#defer_effects(effects);
- for (const [e, t] of this.#skipped_branches) reset_branch(e, t);
- } else {
- if (this.#pending.size === 0) batches.delete(this);
- this.#dirty_effects.clear();
- this.#maybe_dirty_effects.clear();
- for (const fn of this.#commit_callbacks) fn(this);
- this.#commit_callbacks.clear();
- flush_queued_effects(render_effects);
- flush_queued_effects(effects);
- this.#deferred?.resolve();
- }
- var next_batch = current_batch;
- if (this.#roots.length > 0) {
- const batch = next_batch ??= this;
- batch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r)));
- }
- if (next_batch !== null) {
- batches.add(next_batch);
- next_batch.#process();
- }
- if (async_mode_flag && !batches.has(this)) this.#commit();
- }
- /**
- * Traverse the effect tree, executing effects or stashing
- * them for later execution as appropriate
- * @param {Effect} root
- * @param {Effect[]} effects
- * @param {Effect[]} render_effects
- */
- #traverse(root, effects, render_effects) {
- root.f ^= CLEAN;
- var effect = root.first;
- while (effect !== null) {
- var flags = effect.f;
- var is_branch = (flags & 96) !== 0;
- if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || this.#skipped_branches.has(effect)) && effect.fn !== null) {
- if (is_branch) effect.f ^= CLEAN;
- else if ((flags & 4) !== 0) effects.push(effect);
- else if (async_mode_flag && (flags & 16777224) !== 0) render_effects.push(effect);
- else if (is_dirty(effect)) {
- if ((flags & 16) !== 0) this.#maybe_dirty_effects.add(effect);
- update_effect(effect);
- }
- var child = effect.first;
- if (child !== null) {
- effect = child;
- continue;
- }
- }
- while (effect !== null) {
- var next = effect.next;
- if (next !== null) {
- effect = next;
- break;
- }
- effect = effect.parent;
- }
- }
- }
- /**
- * @param {Effect[]} effects
- */
- #defer_effects(effects) {
- for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);
- }
- /**
- * Associate a change to a given source with the current
- * batch, noting its previous and current values
- * @param {Value} source
- * @param {any} value
- * @param {boolean} [is_derived]
- */
- capture(source, value, is_derived = false) {
- if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
- if ((source.f & 8388608) === 0) {
- this.current.set(source, [value, is_derived]);
- batch_values?.set(source, value);
- }
- if (!this.is_fork) source.v = value;
- }
- activate() {
- current_batch = this;
- }
- deactivate() {
- current_batch = null;
- batch_values = null;
- }
- flush() {
- try {
- is_processing = true;
- current_batch = this;
- this.#process();
- } finally {
- flush_count = 0;
- last_scheduled_effect = null;
- collected_effects = null;
- legacy_updates = null;
- is_processing = false;
- current_batch = null;
- batch_values = null;
- old_values.clear();
- }
- }
- discard() {
- for (const fn of this.#discard_callbacks) fn(this);
- this.#discard_callbacks.clear();
- this.#fork_commit_callbacks.clear();
- batches.delete(this);
- }
- /**
- * @param {Effect} effect
- */
- register_created_effect(effect) {
- this.#new_effects.push(effect);
- }
- #commit() {
- for (const batch of batches) {
- var is_earlier = batch.id < this.id;
- /** @type {Source[]} */
- var sources = [];
- for (const [source, [value, is_derived]] of this.current) {
- if (batch.current.has(source)) {
- var batch_value = batch.current.get(source)[0];
- if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
- else continue;
- }
- sources.push(source);
- }
- var others = [...batch.current.keys()].filter((s) => !this.current.has(s));
- if (others.length === 0) {
- if (is_earlier) batch.discard();
- } else if (sources.length > 0) {
- if (is_earlier) for (const unskipped of this.#unskipped_branches) batch.unskip_effect(unskipped, (e) => {
- if ((e.f & 4194320) !== 0) batch.schedule(e);
- else batch.#defer_effects([e]);
- });
- batch.activate();
- /** @type {Set} */
- var marked = /* @__PURE__ */ new Set();
- /** @type {Map} */
- var checked = /* @__PURE__ */ new Map();
- for (var source of sources) mark_effects(source, others, marked, checked);
- checked = /* @__PURE__ */ new Map();
- var current_unequal = [...batch.current.keys()].filter((c) => this.current.has(c) ? this.current.get(c)[0] !== c : true);
- for (const effect of this.#new_effects) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
- set_signal_status(effect, DIRTY);
- batch.schedule(effect);
- } else batch.#dirty_effects.add(effect);
- if (batch.#roots.length > 0) {
- batch.apply();
- for (var root of batch.#roots) batch.#traverse(root, [], []);
- batch.#roots = [];
- }
- batch.deactivate();
- }
- }
- for (const batch of batches) if (batch.#blockers.has(this)) {
- batch.#blockers.delete(this);
- if (batch.#blockers.size === 0 && !batch.#is_deferred()) {
- batch.activate();
- batch.#process();
- }
- }
- }
- /**
- * @param {boolean} blocking
- * @param {Effect} effect
- */
- increment(blocking, effect) {
- let pending_count = this.#pending.get(effect) ?? 0;
- this.#pending.set(effect, pending_count + 1);
- if (blocking) {
- let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
- this.#blocking_pending.set(effect, blocking_pending_count + 1);
- }
- }
- /**
- * @param {boolean} blocking
- * @param {Effect} effect
- * @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)
- */
- decrement(blocking, effect, skip) {
- let pending_count = this.#pending.get(effect) ?? 0;
- if (pending_count === 1) this.#pending.delete(effect);
- else this.#pending.set(effect, pending_count - 1);
- if (blocking) {
- let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
- if (blocking_pending_count === 1) this.#blocking_pending.delete(effect);
- else this.#blocking_pending.set(effect, blocking_pending_count - 1);
- }
- if (this.#decrement_queued || skip) return;
- this.#decrement_queued = true;
- queue_micro_task(() => {
- this.#decrement_queued = false;
- this.flush();
- });
- }
- /**
- * @param {Set} dirty_effects
- * @param {Set} maybe_dirty_effects
- */
- transfer_effects(dirty_effects, maybe_dirty_effects) {
- for (const e of dirty_effects) this.#dirty_effects.add(e);
- for (const e of maybe_dirty_effects) this.#maybe_dirty_effects.add(e);
- dirty_effects.clear();
- maybe_dirty_effects.clear();
- }
- /** @param {(batch: Batch) => void} fn */
- oncommit(fn) {
- this.#commit_callbacks.add(fn);
- }
- /** @param {(batch: Batch) => void} fn */
- ondiscard(fn) {
- this.#discard_callbacks.add(fn);
- }
- /** @param {(batch: Batch) => void} fn */
- on_fork_commit(fn) {
- this.#fork_commit_callbacks.add(fn);
- }
- run_fork_commit_callbacks() {
- for (const fn of this.#fork_commit_callbacks) fn(this);
- this.#fork_commit_callbacks.clear();
- }
- settled() {
- return (this.#deferred ??= deferred()).promise;
- }
- static ensure() {
- if (current_batch === null) {
- const batch = current_batch = new Batch();
- if (!is_processing) {
- batches.add(current_batch);
- if (!is_flushing_sync) queue_micro_task(() => {
- if (current_batch !== batch) return;
- batch.flush();
- });
- }
- }
- return current_batch;
- }
- apply() {
- if (!async_mode_flag || !this.is_fork && batches.size === 1) {
- batch_values = null;
- return;
- }
- batch_values = /* @__PURE__ */ new Map();
- for (const [source, [value]] of this.current) batch_values.set(source, value);
- for (const batch of batches) {
- if (batch === this || batch.is_fork) continue;
- var intersects = false;
- var differs = false;
- if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) {
- if (is_derived) continue;
- intersects ||= this.current.has(source);
- differs ||= !this.current.has(source);
- }
- if (intersects && differs) this.#blockers.add(batch);
- else for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
- }
- }
- /**
- *
- * @param {Effect} effect
- */
- schedule(effect) {
- last_scheduled_effect = effect;
- if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
- effect.b.defer_effect(effect);
- return;
- }
- var e = effect;
- while (e.parent !== null) {
- e = e.parent;
- var flags = e.f;
- if (collected_effects !== null && e === active_effect) {
- if (async_mode_flag) return;
- if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
- }
- if ((flags & 96) !== 0) {
- if ((flags & 1024) === 0) return;
- e.f ^= CLEAN;
- }
- }
- this.#roots.push(e);
- }
-};
-/**
-* Synchronously flush any pending updates.
-* Returns void if no callback is provided, otherwise returns the result of calling the callback.
-* @template [T=void]
-* @param {(() => T) | undefined} [fn]
-* @returns {T}
-*/
-function flushSync(fn) {
- var was_flushing_sync = is_flushing_sync;
- is_flushing_sync = true;
- try {
- var result;
- if (fn) {
- if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
- result = fn();
- }
- while (true) {
- flush_tasks();
- if (current_batch === null) return result;
- current_batch.flush();
- }
- } finally {
- is_flushing_sync = was_flushing_sync;
- }
-}
-function infinite_loop_guard() {
- try {
- effect_update_depth_exceeded();
- } catch (error) {
- invoke_error_boundary(error, last_scheduled_effect);
- }
-}
-/** @type {Set | null} */
-var eager_block_effects = null;
-/**
-* @param {Array} effects
-* @returns {void}
-*/
-function flush_queued_effects(effects) {
- var length = effects.length;
- if (length === 0) return;
- var i = 0;
- while (i < length) {
- var effect = effects[i++];
- if ((effect.f & 24576) === 0 && is_dirty(effect)) {
- eager_block_effects = /* @__PURE__ */ new Set();
- update_effect(effect);
- if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
- if (eager_block_effects?.size > 0) {
- old_values.clear();
- for (const e of eager_block_effects) {
- if ((e.f & 24576) !== 0) continue;
- /** @type {Effect[]} */
- const ordered_effects = [e];
- let ancestor = e.parent;
- while (ancestor !== null) {
- if (eager_block_effects.has(ancestor)) {
- eager_block_effects.delete(ancestor);
- ordered_effects.push(ancestor);
- }
- ancestor = ancestor.parent;
- }
- for (let j = ordered_effects.length - 1; j >= 0; j--) {
- const e = ordered_effects[j];
- if ((e.f & 24576) !== 0) continue;
- update_effect(e);
- }
- }
- eager_block_effects.clear();
- }
- }
- }
- eager_block_effects = null;
-}
-/**
-* This is similar to `mark_reactions`, but it only marks async/block effects
-* depending on `value` and at least one of the other `sources`, so that
-* these effects can re-run after another batch has been committed
-* @param {Value} value
-* @param {Source[]} sources
-* @param {Set} marked
-* @param {Map} checked
-*/
-function mark_effects(value, sources, marked, checked) {
- if (marked.has(value)) return;
- marked.add(value);
- if (value.reactions !== null) for (const reaction of value.reactions) {
- const flags = reaction.f;
- if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
- else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
- set_signal_status(reaction, DIRTY);
- schedule_effect(reaction);
- }
- }
-}
-/**
-* @param {Reaction} reaction
-* @param {Source[]} sources
-* @param {Map} checked
-*/
-function depends_on(reaction, sources, checked) {
- const depends = checked.get(reaction);
- if (depends !== void 0) return depends;
- if (reaction.deps !== null) for (const dep of reaction.deps) {
- if (includes.call(sources, dep)) return true;
- if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
- checked.set(dep, true);
- return true;
- }
- }
- checked.set(reaction, false);
- return false;
-}
-/**
-* @param {Effect} effect
-* @returns {void}
-*/
-function schedule_effect(effect) {
- /** @type {Batch} */ current_batch.schedule(effect);
-}
-/**
-* Mark all the effects inside a skipped branch CLEAN, so that
-* they can be correctly rescheduled later. Tracks dirty and maybe_dirty
-* effects so they can be rescheduled if the branch survives.
-* @param {Effect} effect
-* @param {{ d: Effect[], m: Effect[] }} tracked
-*/
-function reset_branch(effect, tracked) {
- if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
- if ((effect.f & 2048) !== 0) tracked.d.push(effect);
- else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
- set_signal_status(effect, CLEAN);
- var e = effect.first;
- while (e !== null) {
- reset_branch(e, tracked);
- e = e.next;
- }
-}
-/**
-* Mark an entire effect tree clean following an error
-* @param {Effect} effect
-*/
-function reset_all(effect) {
- set_signal_status(effect, CLEAN);
- var e = effect.first;
- while (e !== null) {
- reset_all(e);
- e = e.next;
- }
-}
-//#endregion
-//#region node_modules/svelte/src/reactivity/create-subscriber.js
-/**
-* Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
-* It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
-*
-* If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
-* the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
-*
-* If `start` returns a cleanup function, it will be called when the effect is destroyed.
-*
-* If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
-* are active, and the returned teardown function will only be called when all effects are destroyed.
-*
-* It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
-*
-* ```js
-* import { createSubscriber } from 'svelte/reactivity';
-* import { on } from 'svelte/events';
-*
-* export class MediaQuery {
-* #query;
-* #subscribe;
-*
-* constructor(query) {
-* this.#query = window.matchMedia(`(${query})`);
-*
-* this.#subscribe = createSubscriber((update) => {
-* // when the `change` event occurs, re-run any effects that read `this.current`
-* const off = on(this.#query, 'change', update);
-*
-* // stop listening when all the effects are destroyed
-* return () => off();
-* });
-* }
-*
-* get current() {
-* // This makes the getter reactive, if read in an effect
-* this.#subscribe();
-*
-* // Return the current state of the query, whether or not we're in an effect
-* return this.#query.matches;
-* }
-* }
-* ```
-* @param {(update: () => void) => (() => void) | void} start
-* @since 5.7.0
-*/
-function createSubscriber(start) {
- let subscribers = 0;
- let version = source(0);
- /** @type {(() => void) | void} */
- let stop;
- return () => {
- if (effect_tracking()) {
- get(version);
- render_effect(() => {
- if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
- subscribers += 1;
- return () => {
- queue_micro_task(() => {
- subscribers -= 1;
- if (subscribers === 0) {
- stop?.();
- stop = void 0;
- increment(version);
- }
- });
- };
- });
- }
- };
-}
-//#endregion
-//#region node_modules/svelte/src/internal/client/dom/blocks/boundary.js
-/** @import { Effect, Source, TemplateNode, } from '#client' */
-/**
-* @typedef {{
-* onerror?: (error: unknown, reset: () => void) => void;
-* failed?: (anchor: Node, error: () => unknown, reset: () => () => void) => void;
-* pending?: (anchor: Node) => void;
-* }} BoundaryProps
-*/
-var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
-/**
-* @param {TemplateNode} node
-* @param {BoundaryProps} props
-* @param {((anchor: Node) => void)} children
-* @param {((error: unknown) => unknown) | undefined} [transform_error]
-* @returns {void}
-*/
-function boundary(node, props, children, transform_error) {
- new Boundary(node, props, children, transform_error);
-}
-var Boundary = class {
- /** @type {Boundary | null} */
- parent;
- is_pending = false;
- /**
- * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
- * Inherited from parent boundary, or defaults to identity.
- * @type {(error: unknown) => unknown}
- */
- transform_error;
- /** @type {TemplateNode} */
- #anchor;
- /** @type {TemplateNode | null} */
- #hydrate_open = hydrating ? hydrate_node : null;
- /** @type {BoundaryProps} */
- #props;
- /** @type {((anchor: Node) => void)} */
- #children;
- /** @type {Effect} */
- #effect;
- /** @type {Effect | null} */
- #main_effect = null;
- /** @type {Effect | null} */
- #pending_effect = null;
- /** @type {Effect | null} */
- #failed_effect = null;
- /** @type {DocumentFragment | null} */
- #offscreen_fragment = null;
- #local_pending_count = 0;
- #pending_count = 0;
- #pending_count_update_queued = false;
- /** @type {Set} */
- #dirty_effects = /* @__PURE__ */ new Set();
- /** @type {Set} */
- #maybe_dirty_effects = /* @__PURE__ */ new Set();
- /**
- * A source containing the number of pending async deriveds/expressions.
- * Only created if `$effect.pending()` is used inside the boundary,
- * otherwise updating the source results in needless `Batch.ensure()`
- * calls followed by no-op flushes
- * @type {Source | null}
- */
- #effect_pending = null;
- #effect_pending_subscriber = createSubscriber(() => {
- this.#effect_pending = source(this.#local_pending_count);
- return () => {
- this.#effect_pending = null;
- };
- });
- /**
- * @param {TemplateNode} node
- * @param {BoundaryProps} props
- * @param {((anchor: Node) => void)} children
- * @param {((error: unknown) => unknown) | undefined} [transform_error]
- */
- constructor(node, props, children, transform_error) {
- this.#anchor = node;
- this.#props = props;
- this.#children = (anchor) => {
- var effect = active_effect;
- effect.b = this;
- effect.f |= 128;
- children(anchor);
- };
- this.parent = active_effect.b;
- this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
- this.#effect = block(() => {
- if (hydrating) {
- const comment = this.#hydrate_open;
- hydrate_next();
- const server_rendered_pending = comment.data === "[!";
- if (comment.data.startsWith("[?")) {
- const serialized_error = JSON.parse(comment.data.slice(2));
- this.#hydrate_failed_content(serialized_error);
- } else if (server_rendered_pending) this.#hydrate_pending_content();
- else this.#hydrate_resolved_content();
- } else this.#render();
- }, flags);
- if (hydrating) this.#anchor = hydrate_node;
- }
- #hydrate_resolved_content() {
- try {
- this.#main_effect = branch(() => this.#children(this.#anchor));
- } catch (error) {
- this.error(error);
- }
- }
- /**
- * @param {unknown} error The deserialized error from the server's hydration comment
- */
- #hydrate_failed_content(error) {
- const failed = this.#props.failed;
- if (!failed) return;
- this.#failed_effect = branch(() => {
- failed(this.#anchor, () => error, () => () => {});
- });
- }
- #hydrate_pending_content() {
- const pending = this.#props.pending;
- if (!pending) return;
- this.is_pending = true;
- this.#pending_effect = branch(() => pending(this.#anchor));
- queue_micro_task(() => {
- var fragment = this.#offscreen_fragment = document.createDocumentFragment();
- var anchor = create_text();
- fragment.append(anchor);
- this.#main_effect = this.#run(() => {
- return branch(() => this.#children(anchor));
- });
- if (this.#pending_count === 0) {
- this.#anchor.before(fragment);
- this.#offscreen_fragment = null;
- pause_effect(this.#pending_effect, () => {
- this.#pending_effect = null;
- });
- this.#resolve(current_batch);
- }
- });
- }
- #render() {
- try {
- this.is_pending = this.has_pending_snippet();
- this.#pending_count = 0;
- this.#local_pending_count = 0;
- this.#main_effect = branch(() => {
- this.#children(this.#anchor);
- });
- if (this.#pending_count > 0) {
- var fragment = this.#offscreen_fragment = document.createDocumentFragment();
- move_effect(this.#main_effect, fragment);
- const pending = this.#props.pending;
- this.#pending_effect = branch(() => pending(this.#anchor));
- } else this.#resolve(current_batch);
- } catch (error) {
- this.error(error);
- }
- }
- /**
- * @param {Batch} batch
- */
- #resolve(batch) {
- this.is_pending = false;
- batch.transfer_effects(this.#dirty_effects, this.#maybe_dirty_effects);
- }
- /**
- * Defer an effect inside a pending boundary until the boundary resolves
- * @param {Effect} effect
- */
- defer_effect(effect) {
- defer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects);
- }
- /**
- * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
- * @returns {boolean}
- */
- is_rendered() {
- return !this.is_pending && (!this.parent || this.parent.is_rendered());
- }
- has_pending_snippet() {
- return !!this.#props.pending;
- }
- /**
- * @template T
- * @param {() => T} fn
- */
- #run(fn) {
- var previous_effect = active_effect;
- var previous_reaction = active_reaction;
- var previous_ctx = component_context;
- set_active_effect(this.#effect);
- set_active_reaction(this.#effect);
- set_component_context(this.#effect.ctx);
- try {
- Batch.ensure();
- return fn();
- } catch (e) {
- handle_error(e);
- return null;
- } finally {
- set_active_effect(previous_effect);
- set_active_reaction(previous_reaction);
- set_component_context(previous_ctx);
- }
- }
- /**
- * Updates the pending count associated with the currently visible pending snippet,
- * if any, such that we can replace the snippet with content once work is done
- * @param {1 | -1} d
- * @param {Batch} batch
- */
- #update_pending_count(d, batch) {
- if (!this.has_pending_snippet()) {
- if (this.parent) this.parent.#update_pending_count(d, batch);
- return;
- }
- this.#pending_count += d;
- if (this.#pending_count === 0) {
- this.#resolve(batch);
- if (this.#pending_effect) pause_effect(this.#pending_effect, () => {
- this.#pending_effect = null;
- });
- if (this.#offscreen_fragment) {
- this.#anchor.before(this.#offscreen_fragment);
- this.#offscreen_fragment = null;
- }
- }
- }
- /**
- * Update the source that powers `$effect.pending()` inside this boundary,
- * and controls when the current `pending` snippet (if any) is removed.
- * Do not call from inside the class
- * @param {1 | -1} d
- * @param {Batch} batch
- */
- update_pending_count(d, batch) {
- this.#update_pending_count(d, batch);
- this.#local_pending_count += d;
- if (!this.#effect_pending || this.#pending_count_update_queued) return;
- this.#pending_count_update_queued = true;
- queue_micro_task(() => {
- this.#pending_count_update_queued = false;
- if (this.#effect_pending) internal_set(this.#effect_pending, this.#local_pending_count);
- });
- }
- get_effect_pending() {
- this.#effect_pending_subscriber();
- return get(this.#effect_pending);
- }
- /** @param {unknown} error */
- error(error) {
- if (!this.#props.onerror && !this.#props.failed) throw error;
- if (current_batch?.is_fork) {
- if (this.#main_effect) current_batch.skip_effect(this.#main_effect);
- if (this.#pending_effect) current_batch.skip_effect(this.#pending_effect);
- if (this.#failed_effect) current_batch.skip_effect(this.#failed_effect);
- current_batch.on_fork_commit(() => {
- this.#handle_error(error);
- });
- } else this.#handle_error(error);
- }
- /**
- * @param {unknown} error
- */
- #handle_error(error) {
- if (this.#main_effect) {
- destroy_effect(this.#main_effect);
- this.#main_effect = null;
- }
- if (this.#pending_effect) {
- destroy_effect(this.#pending_effect);
- this.#pending_effect = null;
- }
- if (this.#failed_effect) {
- destroy_effect(this.#failed_effect);
- this.#failed_effect = null;
- }
- if (hydrating) {
- set_hydrate_node(this.#hydrate_open);
- next();
- set_hydrate_node(skip_nodes());
- }
- var onerror = this.#props.onerror;
- let failed = this.#props.failed;
- var did_reset = false;
- var calling_on_error = false;
- const reset = () => {
- if (did_reset) {
- svelte_boundary_reset_noop();
- return;
- }
- did_reset = true;
- if (calling_on_error) svelte_boundary_reset_onerror();
- if (this.#failed_effect !== null) pause_effect(this.#failed_effect, () => {
- this.#failed_effect = null;
- });
- this.#run(() => {
- this.#render();
- });
- };
- /** @param {unknown} transformed_error */
- const handle_error_result = (transformed_error) => {
- try {
- calling_on_error = true;
- onerror?.(transformed_error, reset);
- calling_on_error = false;
- } catch (error) {
- invoke_error_boundary(error, this.#effect && this.#effect.parent);
- }
- if (failed) this.#failed_effect = this.#run(() => {
- try {
- return branch(() => {
- var effect = active_effect;
- effect.b = this;
- effect.f |= 128;
- failed(this.#anchor, () => transformed_error, () => reset);
- });
- } catch (error) {
- invoke_error_boundary(error, this.#effect.parent);
- return null;
- }
- });
- };
- queue_micro_task(() => {
- /** @type {unknown} */
- var result;
- try {
- result = this.transform_error(error);
- } catch (e) {
- invoke_error_boundary(e, this.#effect && this.#effect.parent);
- return;
- }
- if (result !== null && typeof result === "object" && typeof result.then === "function")
- /** @type {any} */ result.then(
- handle_error_result,
- /** @param {unknown} e */
- (e) => invoke_error_boundary(e, this.#effect && this.#effect.parent)
- );
- else handle_error_result(result);
- });
- }
-};
-/**
-* @param {Derived} derived
-* @returns {void}
-*/
-function destroy_derived_effects(derived) {
- var effects = derived.effects;
- if (effects !== null) {
- derived.effects = null;
- for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
- }
-}
-/**
-* @template T
-* @param {Derived} derived
-* @returns {T}
-*/
-function execute_derived(derived) {
- var value;
- var prev_active_effect = active_effect;
- var parent = derived.parent;
- if (!is_destroying_effect && parent !== null && (parent.f & 24576) !== 0) {
- derived_inert();
- return derived.v;
- }
- set_active_effect(parent);
- try {
- derived.f &= ~WAS_MARKED;
- destroy_derived_effects(derived);
- value = update_reaction(derived);
- } finally {
- set_active_effect(prev_active_effect);
- }
- return value;
-}
-/**
-* @param {Derived} derived
-* @returns {void}
-*/
-function update_derived(derived) {
- var value = execute_derived(derived);
- if (!derived.equals(value)) {
- derived.wv = increment_write_version();
- if (!current_batch?.is_fork || derived.deps === null) {
- if (current_batch !== null) current_batch.capture(derived, value, true);
- else derived.v = value;
- if (derived.deps === null) {
- set_signal_status(derived, CLEAN);
- return;
- }
- }
- }
- if (is_destroying_effect) return;
- if (batch_values !== null) {
- if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
- } else update_derived_status(derived);
-}
-/**
-* @param {Derived} derived
-*/
-function freeze_derived_effects(derived) {
- if (derived.effects === null) return;
- for (const e of derived.effects) if (e.teardown || e.ac) {
- e.teardown?.();
- e.ac?.abort(STALE_REACTION);
- e.teardown = noop;
- e.ac = null;
- remove_reactions(e, 0);
- destroy_effect_children(e);
- }
-}
-/**
-* @param {Derived} derived
-*/
-function unfreeze_derived_effects(derived) {
- if (derived.effects === null) return;
- for (const e of derived.effects) if (e.teardown) update_effect(e);
-}
-//#endregion
-//#region node_modules/svelte/src/internal/client/reactivity/sources.js
-/** @import { Derived, Effect, Source, Value } from '#client' */
-/** @type {Set} */
-var eager_effects = /* @__PURE__ */ new Set();
-/** @type {Map} */
-var old_values = /* @__PURE__ */ new Map();
-var eager_effects_deferred = false;
-/**
-* @template V
-* @param {V} v
-* @param {Error | null} [stack]
-* @returns {Source}
-*/
-function source(v, stack) {
- return {
- f: 0,
- v,
- reactions: null,
- equals,
- rv: 0,
- wv: 0
- };
-}
-/**
-* @template V
-* @param {V} v
-* @param {Error | null} [stack]
-*/
-/* @__NO_SIDE_EFFECTS__ */
-function state(v, stack) {
- const s = source(v, stack);
- push_reaction_value(s);
- return s;
-}
-/**
-* @template V
-* @param {V} initial_value
-* @param {boolean} [immutable]
-* @returns {Source}
-*/
-/* @__NO_SIDE_EFFECTS__ */
-function mutable_source(initial_value, immutable = false, trackable = true) {
- const s = source(initial_value);
- if (!immutable) s.equals = safe_equals;
- if (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) (component_context.l.s ??= []).push(s);
- return s;
-}
-/**
-* @template V
-* @param {Source} source
-* @param {V} value
-* @param {boolean} [should_proxy]
-* @returns {V}
-*/
-function set(source, value, should_proxy = false) {
- if (active_reaction !== null && (!untracking || (active_reaction.f & 131072) !== 0) && is_runes() && (active_reaction.f & 4325394) !== 0 && (current_sources === null || !includes.call(current_sources, source))) state_unsafe_mutation();
- return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates);
-}
-/**
-* @template V
-* @param {Source} source
-* @param {V} value
-* @param {Effect[] | null} [updated_during_traversal]
-* @returns {V}
-*/
-function internal_set(source, value, updated_during_traversal = null) {
- if (!source.equals(value)) {
- old_values.set(source, is_destroying_effect ? value : source.v);
- var batch = Batch.ensure();
- batch.capture(source, value);
- if ((source.f & 2) !== 0) {
- const derived = source;
- if ((source.f & 2048) !== 0) execute_derived(derived);
- if (batch_values === null) update_derived_status(derived);
- }
- source.wv = increment_write_version();
- mark_reactions(source, DIRTY, updated_during_traversal);
- if (is_runes() && active_effect !== null && (active_effect.f & 1024) !== 0 && (active_effect.f & 96) === 0) if (untracked_writes === null) set_untracked_writes([source]);
- else untracked_writes.push(source);
- if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) flush_eager_effects();
- }
- return value;
-}
-function flush_eager_effects() {
- eager_effects_deferred = false;
- for (const effect of eager_effects) {
- if ((effect.f & 1024) !== 0) set_signal_status(effect, MAYBE_DIRTY);
- if (is_dirty(effect)) update_effect(effect);
- }
- eager_effects.clear();
-}
-/**
-* Silently (without using `get`) increment a source
-* @param {Source} source
-*/
-function increment(source) {
- set(source, source.v + 1);
-}
-/**
-* @param {Value} signal
-* @param {number} status should be DIRTY or MAYBE_DIRTY
-* @param {Effect[] | null} updated_during_traversal
-* @returns {void}
-*/
-function mark_reactions(signal, status, updated_during_traversal) {
- var reactions = signal.reactions;
- if (reactions === null) return;
- var runes = is_runes();
- var length = reactions.length;
- for (var i = 0; i < length; i++) {
- var reaction = reactions[i];
- var flags = reaction.f;
- if (!runes && reaction === active_effect) continue;
- var not_dirty = (flags & DIRTY) === 0;
- if (not_dirty) set_signal_status(reaction, status);
- if ((flags & 2) !== 0) {
- var derived = reaction;
- batch_values?.delete(derived);
- if ((flags & 65536) === 0) {
- if (flags & 512 && (active_effect === null || (active_effect.f & 2097152) === 0)) reaction.f |= WAS_MARKED;
- mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);
- }
- } else if (not_dirty) {
- var effect = reaction;
- if ((flags & 16) !== 0 && eager_block_effects !== null) eager_block_effects.add(effect);
- if (updated_during_traversal !== null) updated_during_traversal.push(effect);
- else schedule_effect(effect);
- }
- }
-}
-/**
-* @template T
-* @param {T} value
-* @returns {T}
-*/
-function proxy(value) {
- if (typeof value !== "object" || value === null || STATE_SYMBOL in value) return value;
- const prototype = get_prototype_of(value);
- if (prototype !== object_prototype && prototype !== array_prototype) return value;
- /** @type {Map>} */
- var sources = /* @__PURE__ */ new Map();
- var is_proxied_array = is_array(value);
- var version = /* @__PURE__ */ state(0);
- var stack = null;
- var parent_version = update_version;
- /**
- * Executes the proxy in the context of the reaction it was originally created in, if any
- * @template T
- * @param {() => T} fn
- */
- var with_parent = (fn) => {
- if (update_version === parent_version) return fn();
- var reaction = active_reaction;
- var version = update_version;
- set_active_reaction(null);
- set_update_version(parent_version);
- var result = fn();
- set_active_reaction(reaction);
- set_update_version(version);
- return result;
- };
- if (is_proxied_array) sources.set("length", /* @__PURE__ */ state(
- /** @type {any[]} */
- value.length,
- stack
- ));
- return new Proxy(value, {
- defineProperty(_, prop, descriptor) {
- if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) state_descriptors_fixed();
- var s = sources.get(prop);
- if (s === void 0) with_parent(() => {
- var s = /* @__PURE__ */ state(descriptor.value, stack);
- sources.set(prop, s);
- return s;
- });
- else set(s, descriptor.value, true);
- return true;
- },
- deleteProperty(target, prop) {
- var s = sources.get(prop);
- if (s === void 0) {
- if (prop in target) {
- const s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack));
- sources.set(prop, s);
- increment(version);
- }
- } else {
- set(s, UNINITIALIZED);
- increment(version);
- }
- return true;
- },
- get(target, prop, receiver) {
- if (prop === STATE_SYMBOL) return value;
- var s = sources.get(prop);
- var exists = prop in target;
- if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) {
- s = with_parent(() => {
- return /* @__PURE__ */ state(proxy(exists ? target[prop] : UNINITIALIZED), stack);
- });
- sources.set(prop, s);
- }
- if (s !== void 0) {
- var v = get(s);
- return v === UNINITIALIZED ? void 0 : v;
- }
- return Reflect.get(target, prop, receiver);
- },
- getOwnPropertyDescriptor(target, prop) {
- var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
- if (descriptor && "value" in descriptor) {
- var s = sources.get(prop);
- if (s) descriptor.value = get(s);
- } else if (descriptor === void 0) {
- var source = sources.get(prop);
- var value = source?.v;
- if (source !== void 0 && value !== UNINITIALIZED) return {
- enumerable: true,
- configurable: true,
- value,
- writable: true
- };
- }
- return descriptor;
- },
- has(target, prop) {
- if (prop === STATE_SYMBOL) return true;
- var s = sources.get(prop);
- var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop);
- if (s !== void 0 || active_effect !== null && (!has || get_descriptor(target, prop)?.writable)) {
- if (s === void 0) {
- s = with_parent(() => {
- return /* @__PURE__ */ state(has ? proxy(target[prop]) : UNINITIALIZED, stack);
- });
- sources.set(prop, s);
- }
- if (get(s) === UNINITIALIZED) return false;
- }
- return has;
- },
- set(target, prop, value, receiver) {
- var s = sources.get(prop);
- var has = prop in target;
- if (is_proxied_array && prop === "length") for (var i = value; i < s.v; i += 1) {
- var other_s = sources.get(i + "");
- if (other_s !== void 0) set(other_s, UNINITIALIZED);
- else if (i in target) {
- other_s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack));
- sources.set(i + "", other_s);
- }
- }
- if (s === void 0) {
- if (!has || get_descriptor(target, prop)?.writable) {
- s = with_parent(() => /* @__PURE__ */ state(void 0, stack));
- set(s, proxy(value));
- sources.set(prop, s);
- }
- } else {
- has = s.v !== UNINITIALIZED;
- var p = with_parent(() => proxy(value));
- set(s, p);
- }
- var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
- if (descriptor?.set) descriptor.set.call(receiver, value);
- if (!has) {
- if (is_proxied_array && typeof prop === "string") {
- var ls = sources.get("length");
- var n = Number(prop);
- if (Number.isInteger(n) && n >= ls.v) set(ls, n + 1);
- }
- increment(version);
- }
- return true;
- },
- ownKeys(target) {
- get(version);
- var own_keys = Reflect.ownKeys(target).filter((key) => {
- var source = sources.get(key);
- return source === void 0 || source.v !== UNINITIALIZED;
- });
- for (var [key, source] of sources) if (source.v !== UNINITIALIZED && !(key in target)) own_keys.push(key);
- return own_keys;
- },
- setPrototypeOf() {
- state_prototype_fixed();
- }
- });
-}
-//#endregion
-//#region node_modules/svelte/src/internal/client/dom/operations.js
-/** @type {Window} */
-var $window;
-/** @type {() => Node | null} */
-var first_child_getter;
-/** @type {() => Node | null} */
-var next_sibling_getter;
-/**
-* Initialize these lazily to avoid issues when using the runtime in a server context
-* where these globals are not available while avoiding a separate server entry point
-*/
-function init_operations() {
- if ($window !== void 0) return;
- $window = window;
- /Firefox/.test(navigator.userAgent);
- var element_prototype = Element.prototype;
- var node_prototype = Node.prototype;
- var text_prototype = Text.prototype;
- first_child_getter = get_descriptor(node_prototype, "firstChild").get;
- next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
- if (is_extensible(element_prototype)) {
- element_prototype.__click = void 0;
- element_prototype.__className = void 0;
- element_prototype.__attributes = null;
- element_prototype.__style = void 0;
- element_prototype.__e = void 0;
- }
- if (is_extensible(text_prototype)) text_prototype.__t = void 0;
-}
-/**
-* @param {string} value
-* @returns {Text}
-*/
-function create_text(value = "") {
- return document.createTextNode(value);
-}
-/**
-* @template {Node} N
-* @param {N} node
-*/
-/* @__NO_SIDE_EFFECTS__ */
-function get_first_child(node) {
- return first_child_getter.call(node);
-}
-/**
-* @template {Node} N
-* @param {N} node
-*/
-/* @__NO_SIDE_EFFECTS__ */
-function get_next_sibling(node) {
- return next_sibling_getter.call(node);
-}
-/**
-* @template {Node} N
-* @param {N} node
-* @returns {void}
-*/
-function clear_text_content(node) {
- node.textContent = "";
-}
-//#endregion
-//#region node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
-/**
-* @template T
-* @param {() => T} fn
-*/
-function without_reactive_context(fn) {
- var previous_reaction = active_reaction;
- var previous_effect = active_effect;
- set_active_reaction(null);
- set_active_effect(null);
- try {
- return fn();
- } finally {
- set_active_reaction(previous_reaction);
- set_active_effect(previous_effect);
- }
-}
-//#endregion
-//#region node_modules/svelte/src/internal/client/reactivity/effects.js
-/** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
-/**
-* @param {Effect} effect
-* @param {Effect} parent_effect
-*/
-function push_effect(effect, parent_effect) {
- var parent_last = parent_effect.last;
- if (parent_last === null) parent_effect.last = parent_effect.first = effect;
- else {
- parent_last.next = effect;
- effect.prev = parent_last;
- parent_effect.last = effect;
- }
-}
-/**
-* @param {number} type
-* @param {null | (() => void | (() => void))} fn
-* @returns {Effect}
-*/
-function create_effect(type, fn) {
- var parent = active_effect;
- if (parent !== null && (parent.f & 8192) !== 0) type |= INERT;
- /** @type {Effect} */
- var effect = {
- ctx: component_context,
- deps: null,
- nodes: null,
- f: type | DIRTY | 512,
- first: null,
- fn,
- last: null,
- next: null,
- parent,
- b: parent && parent.b,
- prev: null,
- teardown: null,
- wv: 0,
- ac: null
- };
- current_batch?.register_created_effect(effect);
- /** @type {Effect | null} */
- var e = effect;
- if ((type & 4) !== 0) if (collected_effects !== null) collected_effects.push(effect);
- else Batch.ensure().schedule(effect);
- else if (fn !== null) {
- try {
- update_effect(effect);
- } catch (e) {
- destroy_effect(effect);
- throw e;
- }
- if (e.deps === null && e.teardown === null && e.nodes === null && e.first === e.last && (e.f & 524288) === 0) {
- e = e.first;
- if ((type & 16) !== 0 && (type & 65536) !== 0 && e !== null) e.f |= EFFECT_TRANSPARENT;
- }
- }
- if (e !== null) {
- e.parent = parent;
- if (parent !== null) push_effect(e, parent);
- if (active_reaction !== null && (active_reaction.f & 2) !== 0 && (type & 64) === 0) {
- var derived = active_reaction;
- (derived.effects ??= []).push(e);
- }
- }
- return effect;
-}
-/**
-* Internal representation of `$effect.tracking()`
-* @returns {boolean}
-*/
-function effect_tracking() {
- return active_reaction !== null && !untracking;
-}
-/**
-* @param {() => void | (() => void)} fn
-*/
-function create_user_effect(fn) {
- return create_effect(4 | USER_EFFECT, fn);
-}
-/**
-* An effect root whose children can transition out
-* @param {() => void} fn
-* @returns {(options?: { outro?: boolean }) => Promise}
-*/
-function component_root(fn) {
- Batch.ensure();
- const effect = create_effect(64 | EFFECT_PRESERVED, fn);
- return (options = {}) => {
- return new Promise((fulfil) => {
- if (options.outro) pause_effect(effect, () => {
- destroy_effect(effect);
- fulfil(void 0);
- });
- else {
- destroy_effect(effect);
- fulfil(void 0);
- }
- });
- };
-}
-/**
-* @param {() => void | (() => void)} fn
-* @returns {Effect}
-*/
-function render_effect(fn, flags = 0) {
- return create_effect(8 | flags, fn);
-}
-/**
-* @param {(() => void)} fn
-* @param {number} flags
-*/
-function block(fn, flags = 0) {
- return create_effect(16 | flags, fn);
-}
-/**
-* @param {(() => void)} fn
-*/
-function branch(fn) {
- return create_effect(32 | EFFECT_PRESERVED, fn);
-}
-/**
-* @param {Effect} effect
-*/
-function execute_effect_teardown(effect) {
- var teardown = effect.teardown;
- if (teardown !== null) {
- const previously_destroying_effect = is_destroying_effect;
- const previous_reaction = active_reaction;
- set_is_destroying_effect(true);
- set_active_reaction(null);
- try {
- teardown.call(null);
- } finally {
- set_is_destroying_effect(previously_destroying_effect);
- set_active_reaction(previous_reaction);
- }
- }
-}
-/**
-* @param {Effect} signal
-* @param {boolean} remove_dom
-* @returns {void}
-*/
-function destroy_effect_children(signal, remove_dom = false) {
- var effect = signal.first;
- signal.first = signal.last = null;
- while (effect !== null) {
- const controller = effect.ac;
- if (controller !== null) without_reactive_context(() => {
- controller.abort(STALE_REACTION);
- });
- var next = effect.next;
- if ((effect.f & 64) !== 0) effect.parent = null;
- else destroy_effect(effect, remove_dom);
- effect = next;
- }
-}
-/**
-* @param {Effect} signal
-* @returns {void}
-*/
-function destroy_block_effect_children(signal) {
- var effect = signal.first;
- while (effect !== null) {
- var next = effect.next;
- if ((effect.f & 32) === 0) destroy_effect(effect);
- effect = next;
- }
-}
-/**
-* @param {Effect} effect
-* @param {boolean} [remove_dom]
-* @returns {void}
-*/
-function destroy_effect(effect, remove_dom = true) {
- var removed = false;
- if ((remove_dom || (effect.f & 262144) !== 0) && effect.nodes !== null && effect.nodes.end !== null) {
- remove_effect_dom(effect.nodes.start, effect.nodes.end);
- removed = true;
- }
- set_signal_status(effect, DESTROYING);
- destroy_effect_children(effect, remove_dom && !removed);
- remove_reactions(effect, 0);
- var transitions = effect.nodes && effect.nodes.t;
- if (transitions !== null) for (const transition of transitions) transition.stop();
- execute_effect_teardown(effect);
- effect.f ^= DESTROYING;
- effect.f |= DESTROYED;
- var parent = effect.parent;
- if (parent !== null && parent.first !== null) unlink_effect(effect);
- effect.next = effect.prev = effect.teardown = effect.ctx = effect.deps = effect.fn = effect.nodes = effect.ac = effect.b = null;
-}
-/**
-*
-* @param {TemplateNode | null} node
-* @param {TemplateNode} end
-*/
-function remove_effect_dom(node, end) {
- while (node !== null) {
- /** @type {TemplateNode | null} */
- var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
- node.remove();
- node = next;
- }
-}
-/**
-* Detach an effect from the effect tree, freeing up memory and
-* reducing the amount of work that happens on subsequent traversals
-* @param {Effect} effect
-*/
-function unlink_effect(effect) {
- var parent = effect.parent;
- var prev = effect.prev;
- var next = effect.next;
- if (prev !== null) prev.next = next;
- if (next !== null) next.prev = prev;
- if (parent !== null) {
- if (parent.first === effect) parent.first = next;
- if (parent.last === effect) parent.last = prev;
- }
-}
-/**
-* When a block effect is removed, we don't immediately destroy it or yank it
-* out of the DOM, because it might have transitions. Instead, we 'pause' it.
-* It stays around (in memory, and in the DOM) until outro transitions have
-* completed, and if the state change is reversed then we _resume_ it.
-* A paused effect does not update, and the DOM subtree becomes inert.
-* @param {Effect} effect
-* @param {() => void} [callback]
-* @param {boolean} [destroy]
-*/
-function pause_effect(effect, callback, destroy = true) {
- /** @type {TransitionManager[]} */
- var transitions = [];
- pause_children(effect, transitions, true);
- var fn = () => {
- if (destroy) destroy_effect(effect);
- if (callback) callback();
- };
- var remaining = transitions.length;
- if (remaining > 0) {
- var check = () => --remaining || fn();
- for (var transition of transitions) transition.out(check);
- } else fn();
-}
-/**
-* @param {Effect} effect
-* @param {TransitionManager[]} transitions
-* @param {boolean} local
-*/
-function pause_children(effect, transitions, local) {
- if ((effect.f & 8192) !== 0) return;
- effect.f ^= INERT;
- var t = effect.nodes && effect.nodes.t;
- if (t !== null) {
- for (const transition of t) if (transition.is_global || local) transitions.push(transition);
- }
- var child = effect.first;
- while (child !== null) {
- var sibling = child.next;
- if ((child.f & 64) === 0) {
- var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0 && (effect.f & 16) !== 0;
- pause_children(child, transitions, transparent ? local : false);
- }
- child = sibling;
- }
-}
-/**
-* @param {Effect} effect
-* @param {DocumentFragment} fragment
-*/
-function move_effect(effect, fragment) {
- if (!effect.nodes) return;
- /** @type {TemplateNode | null} */
- var node = effect.nodes.start;
- var end = effect.nodes.end;
- while (node !== null) {
- /** @type {TemplateNode | null} */
- var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
- fragment.append(node);
- node = next;
- }
-}
-//#endregion
-//#region node_modules/svelte/src/internal/client/legacy.js
-/**
-* @type {Set | null}
-* @deprecated
-*/
-var captured_signals = null;
-//#endregion
-//#region node_modules/svelte/src/internal/client/runtime.js
-/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
-var is_updating_effect = false;
-var is_destroying_effect = false;
-/** @param {boolean} value */
-function set_is_destroying_effect(value) {
- is_destroying_effect = value;
-}
-/** @type {null | Reaction} */
-var active_reaction = null;
-var untracking = false;
-/** @param {null | Reaction} reaction */
-function set_active_reaction(reaction) {
- active_reaction = reaction;
-}
-/** @type {null | Effect} */
-var active_effect = null;
-/** @param {null | Effect} effect */
-function set_active_effect(effect) {
- active_effect = effect;
-}
-/**
-* When sources are created within a reaction, reading and writing
-* them within that reaction should not cause a re-run
-* @type {null | Source[]}
-*/
-var current_sources = null;
-/** @param {Value} value */
-function push_reaction_value(value) {
- if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) if (current_sources === null) current_sources = [value];
- else current_sources.push(value);
-}
-/**
-* The dependencies of the reaction that is currently being executed. In many cases,
-* the dependencies are unchanged between runs, and so this will be `null` unless
-* and until a new dependency is accessed — we track this via `skipped_deps`
-* @type {null | Value[]}
-*/
-var new_deps = null;
-var skipped_deps = 0;
-/**
-* Tracks writes that the effect it's executed in doesn't listen to yet,
-* so that the dependency can be added to the effect later on if it then reads it
-* @type {null | Source[]}
-*/
-var untracked_writes = null;
-/** @param {null | Source[]} value */
-function set_untracked_writes(value) {
- untracked_writes = value;
-}
-/**
-* @type {number} Used by sources and deriveds for handling updates.
-* Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing
-**/
-var write_version = 1;
-/** @type {number} Used to version each read of a source of derived to avoid duplicating depedencies inside a reaction */
-var read_version = 0;
-var update_version = read_version;
-/** @param {number} value */
-function set_update_version(value) {
- update_version = value;
-}
-function increment_write_version() {
- return ++write_version;
-}
-/**
-* Determines whether a derived or effect is dirty.
-* If it is MAYBE_DIRTY, will set the status to CLEAN
-* @param {Reaction} reaction
-* @returns {boolean}
-*/
-function is_dirty(reaction) {
- var flags = reaction.f;
- if ((flags & 2048) !== 0) return true;
- if (flags & 2) reaction.f &= ~WAS_MARKED;
- if ((flags & 4096) !== 0) {
- var dependencies = reaction.deps;
- var length = dependencies.length;
- for (var i = 0; i < length; i++) {
- var dependency = dependencies[i];
- if (is_dirty(dependency)) update_derived(dependency);
- if (dependency.wv > reaction.wv) return true;
- }
- if ((flags & 512) !== 0 && batch_values === null) set_signal_status(reaction, CLEAN);
- }
- return false;
-}
-/**
-* @param {Value} signal
-* @param {Effect} effect
-* @param {boolean} [root]
-*/
-function schedule_possible_effect_self_invalidation(signal, effect, root = true) {
- var reactions = signal.reactions;
- if (reactions === null) return;
- if (!async_mode_flag && current_sources !== null && includes.call(current_sources, signal)) return;
- for (var i = 0; i < reactions.length; i++) {
- var reaction = reactions[i];
- if ((reaction.f & 2) !== 0) schedule_possible_effect_self_invalidation(reaction, effect, false);
- else if (effect === reaction) {
- if (root) set_signal_status(reaction, DIRTY);
- else if ((reaction.f & 1024) !== 0) set_signal_status(reaction, MAYBE_DIRTY);
- schedule_effect(reaction);
- }
- }
-}
-/** @param {Reaction} reaction */
-function update_reaction(reaction) {
- var previous_deps = new_deps;
- var previous_skipped_deps = skipped_deps;
- var previous_untracked_writes = untracked_writes;
- var previous_reaction = active_reaction;
- var previous_sources = current_sources;
- var previous_component_context = component_context;
- var previous_untracking = untracking;
- var previous_update_version = update_version;
- var flags = reaction.f;
- new_deps = null;
- skipped_deps = 0;
- untracked_writes = null;
- active_reaction = (flags & 96) === 0 ? reaction : null;
- current_sources = null;
- set_component_context(reaction.ctx);
- untracking = false;
- update_version = ++read_version;
- if (reaction.ac !== null) {
- without_reactive_context(() => {
- /** @type {AbortController} */ reaction.ac.abort(STALE_REACTION);
- });
- reaction.ac = null;
- }
- try {
- reaction.f |= REACTION_IS_UPDATING;
- var fn = reaction.fn;
- var result = fn();
- reaction.f |= REACTION_RAN;
- var deps = reaction.deps;
- var is_fork = current_batch?.is_fork;
- if (new_deps !== null) {
- var i;
- if (!is_fork) remove_reactions(reaction, skipped_deps);
- if (deps !== null && skipped_deps > 0) {
- deps.length = skipped_deps + new_deps.length;
- for (i = 0; i < new_deps.length; i++) deps[skipped_deps + i] = new_deps[i];
- } else reaction.deps = deps = new_deps;
- if (effect_tracking() && (reaction.f & 512) !== 0) for (i = skipped_deps; i < deps.length; i++) (deps[i].reactions ??= []).push(reaction);
- } else if (!is_fork && deps !== null && skipped_deps < deps.length) {
- remove_reactions(reaction, skipped_deps);
- deps.length = skipped_deps;
- }
- if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & 6146) === 0) for (i = 0; i < untracked_writes.length; i++) schedule_possible_effect_self_invalidation(untracked_writes[i], reaction);
- if (previous_reaction !== null && previous_reaction !== reaction) {
- read_version++;
- if (previous_reaction.deps !== null) for (let i = 0; i < previous_skipped_deps; i += 1) previous_reaction.deps[i].rv = read_version;
- if (previous_deps !== null) for (const dep of previous_deps) dep.rv = read_version;
- if (untracked_writes !== null) if (previous_untracked_writes === null) previous_untracked_writes = untracked_writes;
- else previous_untracked_writes.push(...untracked_writes);
- }
- if ((reaction.f & 8388608) !== 0) reaction.f ^= ERROR_VALUE;
- return result;
- } catch (error) {
- return handle_error(error);
- } finally {
- reaction.f ^= REACTION_IS_UPDATING;
- new_deps = previous_deps;
- skipped_deps = previous_skipped_deps;
- untracked_writes = previous_untracked_writes;
- active_reaction = previous_reaction;
- current_sources = previous_sources;
- set_component_context(previous_component_context);
- untracking = previous_untracking;
- update_version = previous_update_version;
- }
-}
-/**
-* @template V
-* @param {Reaction} signal
-* @param {Value} dependency
-* @returns {void}
-*/
-function remove_reaction(signal, dependency) {
- let reactions = dependency.reactions;
- if (reactions !== null) {
- var index = index_of.call(reactions, signal);
- if (index !== -1) {
- var new_length = reactions.length - 1;
- if (new_length === 0) reactions = dependency.reactions = null;
- else {
- reactions[index] = reactions[new_length];
- reactions.pop();
- }
- }
- }
- if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) {
- var derived = dependency;
- if ((derived.f & 512) !== 0) {
- derived.f ^= 512;
- derived.f &= ~WAS_MARKED;
- }
- if (derived.v !== UNINITIALIZED) update_derived_status(derived);
- freeze_derived_effects(derived);
- remove_reactions(derived, 0);
- }
-}
-/**
-* @param {Reaction} signal
-* @param {number} start_index
-* @returns {void}
-*/
-function remove_reactions(signal, start_index) {
- var dependencies = signal.deps;
- if (dependencies === null) return;
- for (var i = start_index; i < dependencies.length; i++) remove_reaction(signal, dependencies[i]);
-}
-/**
-* @param {Effect} effect
-* @returns {void}
-*/
-function update_effect(effect) {
- var flags = effect.f;
- if ((flags & 16384) !== 0) return;
- set_signal_status(effect, CLEAN);
- var previous_effect = active_effect;
- var was_updating_effect = is_updating_effect;
- active_effect = effect;
- is_updating_effect = true;
- try {
- if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
- else destroy_effect_children(effect);
- execute_effect_teardown(effect);
- var teardown = update_reaction(effect);
- effect.teardown = typeof teardown === "function" ? teardown : null;
- effect.wv = write_version;
- } finally {
- is_updating_effect = was_updating_effect;
- active_effect = previous_effect;
- }
-}
-/**
-* @template V
-* @param {Value} signal
-* @returns {V}
-*/
-function get(signal) {
- var is_derived = (signal.f & 2) !== 0;
- captured_signals?.add(signal);
- if (active_reaction !== null && !untracking) {
- if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !includes.call(current_sources, signal))) {
- var deps = active_reaction.deps;
- if ((active_reaction.f & 2097152) !== 0) {
- if (signal.rv < read_version) {
- signal.rv = read_version;
- if (new_deps === null && deps !== null && deps[skipped_deps] === signal) skipped_deps++;
- else if (new_deps === null) new_deps = [signal];
- else new_deps.push(signal);
- }
- } else {
- (active_reaction.deps ??= []).push(signal);
- var reactions = signal.reactions;
- if (reactions === null) signal.reactions = [active_reaction];
- else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction);
- }
- }
- }
- if (is_destroying_effect && old_values.has(signal)) return old_values.get(signal);
- if (is_derived) {
- var derived = signal;
- if (is_destroying_effect) {
- var value = derived.v;
- if ((derived.f & 1024) === 0 && derived.reactions !== null || depends_on_old_values(derived)) value = execute_derived(derived);
- old_values.set(derived, value);
- return value;
- }
- var should_connect = (derived.f & 512) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & 512) !== 0);
- var is_new = (derived.f & REACTION_RAN) === 0;
- if (is_dirty(derived)) {
- if (should_connect) derived.f |= 512;
- update_derived(derived);
- }
- if (should_connect && !is_new) {
- unfreeze_derived_effects(derived);
- reconnect(derived);
- }
- }
- if (batch_values?.has(signal)) return batch_values.get(signal);
- if ((signal.f & 8388608) !== 0) throw signal.v;
- return signal.v;
-}
-/**
-* (Re)connect a disconnected derived, so that it is notified
-* of changes in `mark_reactions`
-* @param {Derived} derived
-*/
-function reconnect(derived) {
- derived.f |= 512;
- if (derived.deps === null) return;
- for (const dep of derived.deps) {
- (dep.reactions ??= []).push(derived);
- if ((dep.f & 2) !== 0 && (dep.f & 512) === 0) {
- unfreeze_derived_effects(dep);
- reconnect(dep);
- }
- }
-}
-/** @param {Derived} derived */
-function depends_on_old_values(derived) {
- if (derived.v === UNINITIALIZED) return true;
- if (derived.deps === null) return false;
- for (const dep of derived.deps) {
- if (old_values.has(dep)) return true;
- if ((dep.f & 2) !== 0 && depends_on_old_values(dep)) return true;
- }
- return false;
-}
-/**
-* When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),
-* any state read inside `fn` will not be treated as a dependency.
-*
-* ```ts
-* $effect(() => {
-* // this will run when `data` changes, but not when `time` changes
-* save(data, {
-* timestamp: untrack(() => time)
-* });
-* });
-* ```
-* @template T
-* @param {() => T} fn
-* @returns {T}
-*/
-function untrack(fn) {
- var previous_untracking = untracking;
- try {
- untracking = true;
- return fn();
- } finally {
- untracking = previous_untracking;
- }
-}
-//#endregion
-//#region node_modules/svelte/src/store/utils.js
-/** @import { Readable } from './public' */
-/**
-* @template T
-* @param {Readable | null | undefined} store
-* @param {(value: T) => void} run
-* @param {(value: T) => void} [invalidate]
-* @returns {() => void}
-*/
-function subscribe_to_store(store, run, invalidate) {
- if (store == null) {
- run(void 0);
- if (invalidate) invalidate(void 0);
- return noop;
- }
- const unsub = untrack(() => store.subscribe(run, invalidate));
- return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
-}
-//#endregion
-//#region node_modules/svelte/src/utils.js
-/**
-* Attributes that are boolean, i.e. they are present or not present.
-*/
-var DOM_BOOLEAN_ATTRIBUTES = [
- "allowfullscreen",
- "async",
- "autofocus",
- "autoplay",
- "checked",
- "controls",
- "default",
- "disabled",
- "formnovalidate",
- "indeterminate",
- "inert",
- "ismap",
- "loop",
- "multiple",
- "muted",
- "nomodule",
- "novalidate",
- "open",
- "playsinline",
- "readonly",
- "required",
- "reversed",
- "seamless",
- "selected",
- "webkitdirectory",
- "defer",
- "disablepictureinpicture",
- "disableremoteplayback"
-];
-/**
-* Returns `true` if `name` is a boolean attribute
-* @param {string} name
-*/
-function is_boolean_attribute(name) {
- return DOM_BOOLEAN_ATTRIBUTES.includes(name);
-}
-[...DOM_BOOLEAN_ATTRIBUTES];
-/**
-* Subset of delegated events which should be passive by default.
-* These two are already passive via browser defaults on window, document and body.
-* But since
-* - we're delegating them
-* - they happen often
-* - they apply to mobile which is generally less performant
-* we're marking them as passive by default for other elements, too.
-*/
-var PASSIVE_EVENTS = ["touchstart", "touchmove"];
-/**
-* Returns `true` if `name` is a passive event
-* @param {string} name
-*/
-function is_passive_event(name) {
- return PASSIVE_EVENTS.includes(name);
-}
-//#endregion
-//#region node_modules/svelte/src/internal/server/index.js
-var INVALID_ATTR_NAME_CHAR_REGEX = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
-/**
-* Only available on the server and when compiling with the `server` option.
-* Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app.
-* @template {Record} Props
-* @param {Component | ComponentType>} component
-* @param {{ props?: Omit; context?: Map; idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} [options]
-* @returns {RenderOutput}
-*/
-function render(component, options = {}) {
- if (options.csp?.hash && options.csp.nonce) invalid_csp();
- return Renderer.render(component, options);
-}
-/**
-* @param {Record} attrs
-* @param {string} [css_hash]
-* @param {Record} [classes]
-* @param {Record} [styles]
-* @param {number} [flags]
-* @returns {string}
-*/
-function attributes(attrs, css_hash, classes, styles, flags = 0) {
- if (styles) attrs.style = to_style(attrs.style, styles);
- if (attrs.class) attrs.class = clsx$1(attrs.class);
- if (css_hash || classes) attrs.class = to_class(attrs.class, css_hash, classes);
- let attr_str = "";
- let name;
- const is_html = (flags & 1) === 0;
- const lowercase = (flags & 2) === 0;
- const is_input = (flags & 4) !== 0;
- for (name of Object.keys(attrs)) {
- if (typeof attrs[name] === "function") continue;
- if (name[0] === "$" && name[1] === "$") continue;
- if (INVALID_ATTR_NAME_CHAR_REGEX.test(name)) continue;
- var value = attrs[name];
- var lower = name.toLowerCase();
- if (lowercase) name = lower;
- if (lower.length > 2 && lower.startsWith("on")) continue;
- if (is_input) {
- if (name === "defaultvalue" || name === "defaultchecked") {
- name = name === "defaultvalue" ? "value" : "checked";
- if (attrs[name]) continue;
- }
- }
- attr_str += attr(name, value, is_html && is_boolean_attribute(name));
- }
- return attr_str;
-}
-/**
-* @param {unknown} value
-* @returns {string}
-*/
-function stringify(value) {
- return typeof value === "string" ? value : value == null ? "" : value + "";
-}
-/**
-* @param {any} value
-* @param {string | undefined} [hash]
-* @param {Record} [directives]
-*/
-function attr_class(value, hash, directives) {
- var result = to_class(value, hash, directives);
- return result ? ` class="${escape_html(result, true)}"` : "";
-}
-/**
-* @template V
-* @param {Record} store_values
-* @param {string} store_name
-* @param {Store | null | undefined} store
-* @returns {V}
-*/
-function store_get(store_values, store_name, store) {
- if (store_name in store_values && store_values[store_name][0] === store) return store_values[store_name][2];
- store_values[store_name]?.[1]();
- store_values[store_name] = [
- store,
- null,
- void 0
- ];
- const unsub = subscribe_to_store(
- store,
- /** @param {any} v */
- (v) => store_values[store_name][2] = v
- );
- store_values[store_name][1] = unsub;
- return store_values[store_name][2];
-}
-/** @param {Record} store_values */
-function unsubscribe_stores(store_values) {
- for (const store_name of Object.keys(store_values)) store_values[store_name][1]();
-}
-/**
-* @param {Renderer} renderer
-* @param {Record} $$props
-* @param {string} name
-* @param {Record} slot_props
-* @param {null | (() => void)} fallback_fn
-* @returns {void}
-*/
-function slot(renderer, $$props, name, slot_props, fallback_fn) {
- var slot_fn = $$props.$$slots?.[name];
- if (slot_fn === true) slot_fn = $$props[name === "default" ? "children" : name];
- if (slot_fn !== void 0) slot_fn(renderer, slot_props);
- else fallback_fn?.();
-}
-/**
-* Legacy mode: If the prop has a fallback and is bound in the
-* parent component, propagate the fallback value upwards.
-* @param {Record} props_parent
-* @param {Record} props_now
-*/
-function bind_props(props_parent, props_now) {
- for (const key of Object.keys(props_now)) {
- const initial_value = props_parent[key];
- const value = props_now[key];
- if (initial_value === void 0 && value !== void 0 && Object.getOwnPropertyDescriptor(props_parent, key)?.set) props_parent[key] = value;
- }
-}
-/** @param {any} array_like_or_iterator */
-function ensure_array_like(array_like_or_iterator) {
- if (array_like_or_iterator) return array_like_or_iterator.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
- return [];
-}
-/**
-* @template V
-* @param {() => V} get_value
-*/
-function once(get_value) {
- let value = UNINITIALIZED;
- return () => {
- if (value === UNINITIALIZED) value = get_value();
- return value;
- };
-}
-/**
-* @template T
-* @param {()=>T} fn
-* @returns {(new_value?: T) => (T | void)}
-*/
-function derived(fn) {
- const get_value = ssr_context === null ? fn : once(fn);
- /** @type {T | undefined} */
- let updated_value;
- return function(new_value) {
- if (arguments.length === 0) return updated_value ?? get_value();
- updated_value = new_value;
- return updated_value;
- };
-}
-//#endregion
-//#region node_modules/svelte/src/internal/server/crypto.js
-var text_encoder;
-var crypto;
-/** @param {string} module_name */
-var obfuscated_import = (module_name) => import(
- /* @vite-ignore */
- module_name
-);
-/** @param {string} data */
-async function sha256(data) {
- text_encoder ??= new TextEncoder();
- crypto ??= globalThis.crypto?.subtle?.digest ? globalThis.crypto : (await obfuscated_import("node:crypto")).webcrypto;
- return base64_encode(await crypto.subtle.digest("SHA-256", text_encoder.encode(data)));
-}
-/**
-* @param {Uint8Array} bytes
-* @returns {string}
-*/
-function base64_encode(bytes) {
- if (globalThis.Buffer) return globalThis.Buffer.from(bytes).toString("base64");
- let binary = "";
- for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
- return btoa(binary);
-}
-//#endregion
-//#region node_modules/svelte/src/internal/server/renderer.js
-/** @import { Component } from 'svelte' */
-/** @import { Csp, HydratableContext, RenderOutput, SSRContext, SyncRenderOutput, Sha256Source } from './types.js' */
-/** @import { MaybePromise } from '#shared' */
-/** @typedef {'head' | 'body'} RendererType */
-/** @typedef {{ [key in RendererType]: string }} AccumulatedContent */
-/**
-* @typedef {string | Renderer} RendererItem
-*/
-/**
-* Renderers are basically a tree of `string | Renderer`s, where each `Renderer` in the tree represents
-* work that may or may not have completed. A renderer can be {@link collect}ed to aggregate the
-* content from itself and all of its children, but this will throw if any of the children are
-* performing asynchronous work. To asynchronously collect a renderer, just `await` it.
-*
-* The `string` values within a renderer are always associated with the {@link type} of that renderer. To switch types,
-* call {@link child} with a different `type` argument.
-*/
-var Renderer = class Renderer {
- /**
- * The contents of the renderer.
- * @type {RendererItem[]}
- */
- #out = [];
- /**
- * Any `onDestroy` callbacks registered during execution of this renderer.
- * @type {(() => void)[] | undefined}
- */
- #on_destroy = void 0;
- /**
- * Whether this renderer is a component body.
- * @type {boolean}
- */
- #is_component_body = false;
- /**
- * If set, this renderer is an error boundary. When async collection
- * of the children fails, the failed snippet is rendered instead.
- * @type {{
- * failed: (renderer: Renderer, error: unknown, reset: () => void) => void;
- * transformError: (error: unknown) => unknown;
- * context: SSRContext | null;
- * } | null}
- */
- #boundary = null;
- /**
- * The type of string content that this renderer is accumulating.
- * @type {RendererType}
- */
- type;
- /** @type {Renderer | undefined} */
- #parent;
- /**
- * Asynchronous work associated with this renderer
- * @type {Promise | undefined}
- */
- promise = void 0;
- /**
- * State which is associated with the content tree as a whole.
- * It will be re-exposed, uncopied, on all children.
- * @type {SSRState}
- * @readonly
- */
- global;
- /**
- * State that is local to the branch it is declared in.
- * It will be shallow-copied to all children.
- *
- * @type {{ select_value: string | undefined }}
- */
- local;
- /**
- * @param {SSRState} global
- * @param {Renderer | undefined} [parent]
- */
- constructor(global, parent) {
- this.#parent = parent;
- this.global = global;
- this.local = parent ? { ...parent.local } : { select_value: void 0 };
- this.type = parent ? parent.type : "body";
- }
- /**
- * @param {(renderer: Renderer) => void} fn
- */
- head(fn) {
- const head = new Renderer(this.global, this);
- head.type = "head";
- this.#out.push(head);
- head.child(fn);
- }
- /**
- * @param {Array>} blockers
- * @param {(renderer: Renderer) => void} fn
- */
- async_block(blockers, fn) {
- this.#out.push(BLOCK_OPEN);
- this.async(blockers, fn);
- this.#out.push(BLOCK_CLOSE);
- }
- /**
- * @param {Array>} blockers
- * @param {(renderer: Renderer) => void} fn
- */
- async(blockers, fn) {
- let callback = fn;
- if (blockers.length > 0) {
- const context = ssr_context;
- callback = (renderer) => {
- return Promise.all(blockers).then(() => {
- const previous_context = ssr_context;
- try {
- set_ssr_context(context);
- return fn(renderer);
- } finally {
- set_ssr_context(previous_context);
- }
- });
- };
- }
- this.child(callback);
- }
- /**
- * @param {Array<() => void>} thunks
- */
- run(thunks) {
- const context = ssr_context;
- let promise = Promise.resolve(thunks[0]());
- const promises = [promise];
- for (const fn of thunks.slice(1)) {
- promise = promise.then(() => {
- const previous_context = ssr_context;
- set_ssr_context(context);
- try {
- return fn();
- } finally {
- set_ssr_context(previous_context);
- }
- });
- promises.push(promise);
- }
- promise.catch(noop);
- this.promise = promise;
- return promises;
- }
- /**
- * @param {(renderer: Renderer) => MaybePromise} fn
- */
- child_block(fn) {
- this.#out.push(BLOCK_OPEN);
- this.child(fn);
- this.#out.push(BLOCK_CLOSE);
- }
- /**
- * Create a child renderer. The child renderer inherits the state from the parent,
- * but has its own content.
- * @param {(renderer: Renderer) => MaybePromise} fn
- */
- child(fn) {
- const child = new Renderer(this.global, this);
- this.#out.push(child);
- const parent = ssr_context;
- set_ssr_context({
- ...ssr_context,
- p: parent,
- c: null,
- r: child
- });
- const result = fn(child);
- set_ssr_context(parent);
- if (result instanceof Promise) {
- result.catch(noop);
- result.finally(() => set_ssr_context(null)).catch(noop);
- if (child.global.mode === "sync") await_invalid();
- child.promise = result;
- }
- return child;
- }
- /**
- * Render children inside an error boundary. If the children throw and the API-level
- * `transformError` transform handles the error (doesn't re-throw), the `failed` snippet is
- * rendered instead. Otherwise the error propagates.
- *
- * @param {{ failed?: (renderer: Renderer, error: unknown, reset: () => void) => void }} props
- * @param {(renderer: Renderer) => MaybePromise} children_fn
- */
- boundary(props, children_fn) {
- const child = new Renderer(this.global, this);
- this.#out.push(child);
- const parent_context = ssr_context;
- if (props.failed) child.#boundary = {
- failed: props.failed,
- transformError: this.global.transformError,
- context: parent_context
- };
- set_ssr_context({
- ...ssr_context,
- p: parent_context,
- c: null,
- r: child
- });
- try {
- const result = children_fn(child);
- set_ssr_context(parent_context);
- if (result instanceof Promise) {
- if (child.global.mode === "sync") await_invalid();
- result.catch(noop);
- child.promise = result;
- }
- } catch (error) {
- set_ssr_context(parent_context);
- const failed_snippet = props.failed;
- if (!failed_snippet) throw error;
- const result = this.global.transformError(error);
- child.#out.length = 0;
- child.#boundary = null;
- if (result instanceof Promise) {
- if (this.global.mode === "sync") await_invalid();
- child.promise = result.then((transformed) => {
- set_ssr_context(parent_context);
- child.#out.push(Renderer.#serialize_failed_boundary(transformed));
- failed_snippet(child, transformed, noop);
- child.#out.push(BLOCK_CLOSE);
- });
- child.promise.catch(noop);
- } else {
- child.#out.push(Renderer.#serialize_failed_boundary(result));
- failed_snippet(child, result, noop);
- child.#out.push(BLOCK_CLOSE);
- }
- }
- }
- /**
- * Create a component renderer. The component renderer inherits the state from the parent,
- * but has its own content. It is treated as an ordering boundary for ondestroy callbacks.
- * @param {(renderer: Renderer) => MaybePromise} fn
- * @param {Function} [component_fn]
- * @returns {void}
- */
- component(fn, component_fn) {
- push$1(component_fn);
- const child = this.child(fn);
- child.#is_component_body = true;
- pop$1();
- }
- /**
- * @param {Record} attrs
- * @param {(renderer: Renderer) => void} fn
- * @param {string | undefined} [css_hash]
- * @param {Record | undefined} [classes]
- * @param {Record | undefined} [styles]
- * @param {number | undefined} [flags]
- * @param {boolean | undefined} [is_rich]
- * @returns {void}
- */
- select(attrs, fn, css_hash, classes, styles, flags, is_rich) {
- const { value, ...select_attrs } = attrs;
- this.push(``);
- }
- /**
- * @param {Record} attrs
- * @param {string | number | boolean | ((renderer: Renderer) => void)} body
- * @param {string | undefined} [css_hash]
- * @param {Record | undefined} [classes]
- * @param {Record | undefined} [styles]
- * @param {number | undefined} [flags]
- * @param {boolean | undefined} [is_rich]
- */
- option(attrs, body, css_hash, classes, styles, flags, is_rich) {
- this.#out.push(``);
- if (head) renderer.head((child) => child.push(head));
- };
- if (typeof body === "function") this.child((renderer) => {
- const r = new Renderer(this.global, this);
- body(r);
- if (this.global.mode === "async") return r.#collect_content_async().then((content) => {
- close(renderer, content.body.replaceAll("", ""), content);
- });
- else {
- const content = r.#collect_content();
- close(renderer, content.body.replaceAll("", ""), content);
- }
- });
- else close(this, body, { body: escape_html(body) });
- }
- /**
- * @param {(renderer: Renderer) => void} fn
- */
- title(fn) {
- const path = this.get_path();
- /** @param {string} head */
- const close = (head) => {
- this.global.set_title(head, path);
- };
- this.child((renderer) => {
- const r = new Renderer(renderer.global, renderer);
- fn(r);
- if (renderer.global.mode === "async") return r.#collect_content_async().then((content) => {
- close(content.head);
- });
- else close(r.#collect_content().head);
- });
- }
- /**
- * @param {string | (() => Promise)} content
- */
- push(content) {
- if (typeof content === "function") this.child(async (renderer) => renderer.push(await content()));
- else this.#out.push(content);
- }
- /**
- * @param {() => void} fn
- */
- on_destroy(fn) {
- (this.#on_destroy ??= []).push(fn);
- }
- /**
- * @returns {number[]}
- */
- get_path() {
- return this.#parent ? [...this.#parent.get_path(), this.#parent.#out.indexOf(this)] : [];
- }
- /**
- * @deprecated this is needed for legacy component bindings
- */
- copy() {
- const copy = new Renderer(this.global, this.#parent);
- copy.#out = this.#out.map((item) => item instanceof Renderer ? item.copy() : item);
- copy.promise = this.promise;
- return copy;
- }
- /**
- * @param {Renderer} other
- * @deprecated this is needed for legacy component bindings
- */
- subsume(other) {
- if (this.global.mode !== other.global.mode) throw new Error("invariant: A renderer cannot switch modes. If you're seeing this, there's a compiler bug. File an issue!");
- this.local = other.local;
- this.#out = other.#out.map((item, i) => {
- const current = this.#out[i];
- if (current instanceof Renderer && item instanceof Renderer) {
- current.subsume(item);
- return current;
- }
- return item;
- });
- this.promise = other.promise;
- this.type = other.type;
- }
- get length() {
- return this.#out.length;
- }
- /**
- * Creates the hydration comment that marks the start of a failed boundary.
- * The error is JSON-serialized and embedded inside an HTML comment for the client
- * to parse during hydration. The JSON is escaped to prevent `-->` or ``;
- }
- /**
- * Only available on the server and when compiling with the `server` option.
- * Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app.
- * @template {Record} Props
- * @param {Component} component
- * @param {{ props?: Omit; context?: Map; idPrefix?: string; csp?: Csp }} [options]
- * @returns {RenderOutput}
- */
- static render(component, options = {}) {
- /** @type {AccumulatedContent | undefined} */
- let sync;
- /** @type {Promise | undefined} */
- let async;
- const result = {};
- Object.defineProperties(result, {
- html: { get: () => {
- return (sync ??= Renderer.#render(component, options)).body;
- } },
- head: { get: () => {
- return (sync ??= Renderer.#render(component, options)).head;
- } },
- body: { get: () => {
- return (sync ??= Renderer.#render(component, options)).body;
- } },
- hashes: { value: { script: "" } },
- then: { value: (onfulfilled, onrejected) => {
- if (!async_mode_flag) {
- const result = sync ??= Renderer.#render(component, options);
- const user_result = onfulfilled({
- head: result.head,
- body: result.body,
- html: result.body,
- hashes: { script: [] }
- });
- return Promise.resolve(user_result);
- }
- async ??= init_render_context().then(() => with_render_context(() => Renderer.#render_async(component, options)));
- return async.then((result) => {
- Object.defineProperty(result, "html", { get: () => {
- html_deprecated();
- } });
- return onfulfilled(result);
- }, onrejected);
- } }
- });
- return result;
- }
- /**
- * Collect all of the `onDestroy` callbacks registered during rendering. In an async context, this is only safe to call
- * after awaiting `collect_async`.
- *
- * Child renderers are "porous" and don't affect execution order, but component body renderers
- * create ordering boundaries. Within a renderer, callbacks run in order until hitting a component boundary.
- * @returns {Iterable<() => void>}
- */
- *#collect_on_destroy() {
- for (const component of this.#traverse_components()) yield* component.#collect_ondestroy();
- }
- /**
- * Performs a depth-first search of renderers, yielding the deepest components first, then additional components as we backtrack up the tree.
- * @returns {Iterable}
- */
- *#traverse_components() {
- for (const child of this.#out) if (typeof child !== "string") yield* child.#traverse_components();
- if (this.#is_component_body) yield this;
- }
- /**
- * @returns {Iterable<() => void>}
- */
- *#collect_ondestroy() {
- if (this.#on_destroy) for (const fn of this.#on_destroy) yield fn;
- for (const child of this.#out) if (child instanceof Renderer && !child.#is_component_body) yield* child.#collect_ondestroy();
- }
- /**
- * Render a component. Throws if any of the children are performing asynchronous work.
- *
- * @template {Record} Props
- * @param {Component} component
- * @param {{ props?: Omit; context?: Map; idPrefix?: string }} options
- * @returns {AccumulatedContent}
- */
- static #render(component, options) {
- var previous_context = ssr_context;
- try {
- const renderer = Renderer.#open_render("sync", component, options);
- const content = renderer.#collect_content();
- return Renderer.#close_render(content, renderer);
- } finally {
- abort();
- set_ssr_context(previous_context);
- }
- }
- /**
- * Render a component.
- *
- * @template {Record} Props
- * @param {Component} component
- * @param {{ props?: Omit; context?: Map; idPrefix?: string; csp?: Csp }} options
- * @returns {Promise}
- */
- static async #render_async(component, options) {
- const previous_context = ssr_context;
- try {
- const renderer = Renderer.#open_render("async", component, options);
- const content = await renderer.#collect_content_async();
- const hydratables = await renderer.#collect_hydratables();
- if (hydratables !== null) content.head = hydratables + content.head;
- return Renderer.#close_render(content, renderer);
- } finally {
- set_ssr_context(previous_context);
- abort();
- }
- }
- /**
- * Collect all of the code from the `out` array and return it as a string, or a promise resolving to a string.
- * @param {AccumulatedContent} content
- * @returns {AccumulatedContent}
- */
- #collect_content(content = {
- head: "",
- body: ""
- }) {
- for (const item of this.#out) if (typeof item === "string") content[this.type] += item;
- else if (item instanceof Renderer) item.#collect_content(content);
- return content;
- }
- /**
- * Collect all of the code from the `out` array and return it as a string.
- * @param {AccumulatedContent} content
- * @returns {Promise}
- */
- async #collect_content_async(content = {
- head: "",
- body: ""
- }) {
- await this.promise;
- for (const item of this.#out) if (typeof item === "string") content[this.type] += item;
- else if (item instanceof Renderer) if (item.#boundary) {
- /** @type {AccumulatedContent} */
- const boundary_content = {
- head: "",
- body: ""
- };
- try {
- await item.#collect_content_async(boundary_content);
- content.head += boundary_content.head;
- content.body += boundary_content.body;
- } catch (error) {
- const { context, failed, transformError } = item.#boundary;
- set_ssr_context(context);
- let transformed = await transformError(error);
- const failed_renderer = new Renderer(item.global, item);
- failed_renderer.type = item.type;
- failed_renderer.#out.push(Renderer.#serialize_failed_boundary(transformed));
- failed(failed_renderer, transformed, noop);
- failed_renderer.#out.push(BLOCK_CLOSE);
- await failed_renderer.#collect_content_async(content);
- }
- } else await item.#collect_content_async(content);
- return content;
- }
- async #collect_hydratables() {
- const ctx = get_render_context().hydratable;
- for (const [_, key] of ctx.unresolved_promises) unresolved_hydratable(key, ctx.lookup.get(key)?.stack ?? "");
- for (const comparison of ctx.comparisons) await comparison;
- return await this.#hydratable_block(ctx);
- }
- /**
- * @template {Record} Props
- * @param {'sync' | 'async'} mode
- * @param {import('svelte').Component} component
- * @param {{ props?: Omit; context?: Map; idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} options
- * @returns {Renderer}
- */
- static #open_render(mode, component, options) {
- if (options.idPrefix?.includes("--")) invalid_id_prefix();
- var previous_context = ssr_context;
- try {
- const renderer = new Renderer(new SSRState(mode, options.idPrefix ? options.idPrefix + "-" : "", options.csp, options.transformError));
- set_ssr_context({
- p: null,
- c: options.context ?? null,
- r: renderer
- });
- renderer.push(BLOCK_OPEN);
- component(renderer, options.props ?? {});
- renderer.push(BLOCK_CLOSE);
- return renderer;
- } finally {
- set_ssr_context(previous_context);
- }
- }
- /**
- * @param {AccumulatedContent} content
- * @param {Renderer} renderer
- * @returns {AccumulatedContent & { hashes: { script: Sha256Source[] } }}
- */
- static #close_render(content, renderer) {
- for (const cleanup of renderer.#collect_on_destroy()) cleanup();
- let head = content.head + renderer.global.get_title();
- let body = content.body;
- for (const { hash, code } of renderer.global.css) head += ``;
- return {
- head,
- body,
- hashes: { script: renderer.global.csp.script_hashes }
- };
- }
- /**
- * @param {HydratableContext} ctx
- */
- async #hydratable_block(ctx) {
- if (ctx.lookup.size === 0) return null;
- let entries = [];
- let has_promises = false;
- for (const [k, v] of ctx.lookup) {
- if (v.promises) {
- has_promises = true;
- for (const p of v.promises) await p;
- }
- entries.push(`[${devalue.uneval(k)},${v.serialized}]`);
- }
- let prelude = `const h = (window.__svelte ??= {}).h ??= new Map();`;
- if (has_promises) prelude = `const r = (v) => Promise.resolve(v);
- ${prelude}`;
- const body = `
- {
- ${prelude}
-
- for (const [k, v] of [
- ${entries.join(",\n ")}
- ]) {
- h.set(k, v);
- }
- }
- `;
- let csp_attr = "";
- if (this.global.csp.nonce) csp_attr = ` nonce="${this.global.csp.nonce}"`;
- else if (this.global.csp.hash) {
- const hash = await sha256(body);
- this.global.csp.script_hashes.push(`sha256-${hash}`);
- }
- return `\n\t\t
-