2 lines
25 KiB
JavaScript
2 lines
25 KiB
JavaScript
import{S as Ye,i as We,s as Xe,a as Ze,e as C,c as Qe,b as M,g as pe,t as F,d as de,f as J,h as G,j as xe,o as ke,k as et,l as tt,m as nt,n as ve,p as q,q as rt,r as at,u as ot,v as Y,w as W,x as $e,y as X,z as Z,A as Ce}from"./chunks/index-e85f5ed2.js";import{g as Fe,f as Je,s as K,a as Re,i as st}from"./chunks/singletons-a517135f.js";import{_ as te}from"./chunks/preload-helper-b21cceae.js";import{s as it}from"./chunks/paths-6cd3a76e.js";function lt(r,e){return r==="/"||e==="ignore"?r:e==="never"?r.endsWith("/")?r.slice(0,-1):r:e==="always"&&!r.endsWith("/")?r+"/":r}function ct(r){for(const e in r)r[e]=r[e].replace(/%23/g,"#").replace(/%3[Bb]/g,";").replace(/%2[Cc]/g,",").replace(/%2[Ff]/g,"/").replace(/%3[Ff]/g,"?").replace(/%3[Aa]/g,":").replace(/%40/g,"@").replace(/%26/g,"&").replace(/%3[Dd]/g,"=").replace(/%2[Bb]/g,"+").replace(/%24/g,"$");return r}const ft=["href","pathname","search","searchParams","toString","toJSON"];function ut(r,e){const t=new URL(r);for(const i of ft){let o=t[i];Object.defineProperty(t,i,{get(){return e(),o},enumerable:!0,configurable:!0})}return pt(t),t}function pt(r){Object.defineProperty(r,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}function dt(r){let e=5381;if(typeof r=="string"){let t=r.length;for(;t;)e=e*33^r.charCodeAt(--t)}else if(ArrayBuffer.isView(r)){const t=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);let i=t.length;for(;i;)e=e*33^t[--i]}else throw new TypeError("value must be a string or TypedArray");return(e>>>0).toString(36)}const he=window.fetch;window.fetch=(r,e)=>{if((r instanceof Request?r.method:(e==null?void 0:e.method)||"GET")!=="GET"){const i=new URL(r instanceof Request?r.url:r.toString(),document.baseURI).href;ue.delete(i)}return he(r,e)};const ue=new Map;function ht(r,e,t){let o=`script[data-sveltekit-fetched][data-url=${JSON.stringify(r instanceof Request?r.url:r)}]`;(t==null?void 0:t.body)&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&(o+=`[data-hash="${dt(t.body)}"]`);const p=document.querySelector(o);if(p!=null&&p.textContent){const{body:n,...f}=JSON.parse(p.textContent),h=p.getAttribute("data-ttl");return h&&ue.set(e,{body:n,init:f,ttl:1e3*Number(h)}),Promise.resolve(new Response(n,f))}return he(r,t)}function mt(r,e){const t=ue.get(r);if(t){if(performance.now()<t.ttl)return new Response(t.body,t.init);ue.delete(r)}return he(r,e)}const _t=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function gt(r){const e=[],t=[];let i=!0;return{pattern:r==="/"?/^\/$/:new RegExp(`^${r.split(/(?:\/|$)/).slice(1).filter(yt).map((p,n,f)=>{const h=decodeURIComponent(p),m=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(h);if(m)return e.push(m[1]),t.push(m[2]),"(?:/(.*))?";const g=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(h);if(g)return e.push(g[1]),t.push(g[2]),"(?:/([^/]+))?";const v=n===f.length-1;if(!h)return;const U=h.split(/\[(.+?)\](?!\])/).map((T,V)=>{if(V%2){const D=_t.exec(T);if(!D)throw new Error(`Invalid param: ${T}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,ae,z,oe,Q]=D;return e.push(oe),t.push(Q),z?"(.*?)":ae?"([^/]*)?":"([^/]+?)"}return v&&T.includes(".")&&(i=!1),T.normalize().replace(/%5[Bb]/g,"[").replace(/%5[Dd]/g,"]").replace(/#/g,"%23").replace(/\?/g,"%3F").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).join("");return"/"+U}).join("")}${i?"/?":""}$`),names:e,types:t}}function yt(r){return!/^\([^)]+\)$/.test(r)}function wt(r,e,t,i){const o={};for(let p=0;p<e.length;p+=1){const n=e[p],f=t[p];let h=r[p+1]||"";if(f){const m=i[f];if(!m)throw new Error(`Missing "${f}" param matcher`);if(!m(h))return}o[n]=h}return o}function bt(r,e,t,i){const o=new Set(e);return Object.entries(t).map(([f,[h,m,g]])=>{const{pattern:v,names:O,types:U}=gt(f),T={id:f,exec:V=>{const D=v.exec(V);if(D)return wt(D,O,U,i)},errors:[1,...g||[]].map(V=>r[V]),layouts:[0,...m||[]].map(n),leaf:p(h)};return T.errors.length=T.layouts.length=Math.max(T.errors.length,T.layouts.length),T});function p(f){const h=f<0;return h&&(f=~f),[h,r[f]]}function n(f){return f===void 0?f:[o.has(f),r[f]]}}function vt(r){let e,t,i;var o=r[0][0];function p(n){return{props:{data:n[2],form:n[1]}}}return o&&(e=Y(o,p(r))),{c(){e&&W(e.$$.fragment),t=C()},l(n){e&&$e(e.$$.fragment,n),t=C()},m(n,f){e&&X(e,n,f),M(n,t,f),i=!0},p(n,f){const h={};if(f&4&&(h.data=n[2]),f&2&&(h.form=n[1]),o!==(o=n[0][0])){if(e){pe();const m=e;F(m.$$.fragment,1,0,()=>{Z(m,1)}),de()}o?(e=Y(o,p(n)),W(e.$$.fragment),J(e.$$.fragment,1),X(e,t.parentNode,t)):e=null}else o&&e.$set(h)},i(n){i||(e&&J(e.$$.fragment,n),i=!0)},o(n){e&&F(e.$$.fragment,n),i=!1},d(n){n&&G(t),e&&Z(e,n)}}}function Et(r){let e,t,i;var o=r[0][0];function p(n){return{props:{data:n[2],$$slots:{default:[kt]},$$scope:{ctx:n}}}}return o&&(e=Y(o,p(r))),{c(){e&&W(e.$$.fragment),t=C()},l(n){e&&$e(e.$$.fragment,n),t=C()},m(n,f){e&&X(e,n,f),M(n,t,f),i=!0},p(n,f){const h={};if(f&4&&(h.data=n[2]),f&523&&(h.$$scope={dirty:f,ctx:n}),o!==(o=n[0][0])){if(e){pe();const m=e;F(m.$$.fragment,1,0,()=>{Z(m,1)}),de()}o?(e=Y(o,p(n)),W(e.$$.fragment),J(e.$$.fragment,1),X(e,t.parentNode,t)):e=null}else o&&e.$set(h)},i(n){i||(e&&J(e.$$.fragment,n),i=!0)},o(n){e&&F(e.$$.fragment,n),i=!1},d(n){n&&G(t),e&&Z(e,n)}}}function kt(r){let e,t,i;var o=r[0][1];function p(n){return{props:{data:n[3],form:n[1]}}}return o&&(e=Y(o,p(r))),{c(){e&&W(e.$$.fragment),t=C()},l(n){e&&$e(e.$$.fragment,n),t=C()},m(n,f){e&&X(e,n,f),M(n,t,f),i=!0},p(n,f){const h={};if(f&8&&(h.data=n[3]),f&2&&(h.form=n[1]),o!==(o=n[0][1])){if(e){pe();const m=e;F(m.$$.fragment,1,0,()=>{Z(m,1)}),de()}o?(e=Y(o,p(n)),W(e.$$.fragment),J(e.$$.fragment,1),X(e,t.parentNode,t)):e=null}else o&&e.$set(h)},i(n){i||(e&&J(e.$$.fragment,n),i=!0)},o(n){e&&F(e.$$.fragment,n),i=!1},d(n){n&&G(t),e&&Z(e,n)}}}function Ge(r){let e,t=r[5]&&Ke(r);return{c(){e=et("div"),t&&t.c(),this.h()},l(i){e=tt(i,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var o=nt(e);t&&t.l(o),o.forEach(G),this.h()},h(){ve(e,"id","svelte-announcer"),ve(e,"aria-live","assertive"),ve(e,"aria-atomic","true"),q(e,"position","absolute"),q(e,"left","0"),q(e,"top","0"),q(e,"clip","rect(0 0 0 0)"),q(e,"clip-path","inset(50%)"),q(e,"overflow","hidden"),q(e,"white-space","nowrap"),q(e,"width","1px"),q(e,"height","1px")},m(i,o){M(i,e,o),t&&t.m(e,null)},p(i,o){i[5]?t?t.p(i,o):(t=Ke(i),t.c(),t.m(e,null)):t&&(t.d(1),t=null)},d(i){i&&G(e),t&&t.d()}}}function Ke(r){let e;return{c(){e=rt(r[6])},l(t){e=at(t,r[6])},m(t,i){M(t,e,i)},p(t,i){i&64&&ot(e,t[6])},d(t){t&&G(e)}}}function Rt(r){let e,t,i,o,p;const n=[Et,vt],f=[];function h(g,v){return g[0][1]?0:1}e=h(r),t=f[e]=n[e](r);let m=r[4]&&Ge(r);return{c(){t.c(),i=Ze(),m&&m.c(),o=C()},l(g){t.l(g),i=Qe(g),m&&m.l(g),o=C()},m(g,v){f[e].m(g,v),M(g,i,v),m&&m.m(g,v),M(g,o,v),p=!0},p(g,[v]){let O=e;e=h(g),e===O?f[e].p(g,v):(pe(),F(f[O],1,1,()=>{f[O]=null}),de(),t=f[e],t?t.p(g,v):(t=f[e]=n[e](g),t.c()),J(t,1),t.m(i.parentNode,i)),g[4]?m?m.p(g,v):(m=Ge(g),m.c(),m.m(o.parentNode,o)):m&&(m.d(1),m=null)},i(g){p||(J(t),p=!0)},o(g){F(t),p=!1},d(g){f[e].d(g),g&&G(i),m&&m.d(g),g&&G(o)}}}function St(r,e,t){let{stores:i}=e,{page:o}=e,{components:p}=e,{form:n}=e,{data_0:f=null}=e,{data_1:h=null}=e;xe(i.page.notify);let m=!1,g=!1,v=null;return ke(()=>{const O=i.page.subscribe(()=>{m&&(t(5,g=!0),t(6,v=document.title||"untitled page"))});return t(4,m=!0),O}),r.$$set=O=>{"stores"in O&&t(7,i=O.stores),"page"in O&&t(8,o=O.page),"components"in O&&t(0,p=O.components),"form"in O&&t(1,n=O.form),"data_0"in O&&t(2,f=O.data_0),"data_1"in O&&t(3,h=O.data_1)},r.$$.update=()=>{r.$$.dirty&384&&i.page.set(o)},[p,n,f,h,m,g,v,i,o]}class It extends Ye{constructor(e){super(),We(this,e,St,Rt,Xe,{stores:7,page:8,components:0,form:1,data_0:2,data_1:3})}}const Ot={},me=[()=>te(()=>import("./chunks/0-03afadb0.js"),["./chunks/0-03afadb0.js","./chunks/_layout-fd68092a.js","./components/pages/_layout.svelte-f0615f3a.js","./chunks/index-e85f5ed2.js","./chunks/paths-6cd3a76e.js","./chunks/state-c7ef3111.js","./chunks/preload-helper-b21cceae.js","./chunks/theme-70460c34.js","./assets/_layout-dae11787.css"],import.meta.url),()=>te(()=>import("./chunks/1-adbd9144.js"),["./chunks/1-adbd9144.js","./components/error.svelte-5f5d8129.js","./chunks/index-e85f5ed2.js","./chunks/singletons-a517135f.js","./chunks/paths-6cd3a76e.js"],import.meta.url),()=>te(()=>import("./chunks/2-fc53a7ac.js"),["./chunks/2-fc53a7ac.js","./components/pages/_page.svelte-d05ebdcb.js","./chunks/index-e85f5ed2.js","./chunks/singletons-a517135f.js","./chunks/paths-6cd3a76e.js"],import.meta.url),()=>te(()=>import("./chunks/3-f278a813.js"),["./chunks/3-f278a813.js","./components/pages/edit/_page.svelte-5db7b620.js","./chunks/index-e85f5ed2.js","./chunks/state-c7ef3111.js","./chunks/preload-helper-b21cceae.js","./chunks/theme-70460c34.js","./chunks/View-36599a63.js","./assets/View-0c536ccf.css","./chunks/paths-6cd3a76e.js","./assets/_page-826332b8.css"],import.meta.url),()=>te(()=>import("./chunks/4-c8ddba59.js"),["./chunks/4-c8ddba59.js","./components/pages/view/_page.svelte-5ade1380.js","./chunks/index-e85f5ed2.js","./chunks/View-36599a63.js","./chunks/state-c7ef3111.js","./chunks/preload-helper-b21cceae.js","./assets/View-0c536ccf.css"],import.meta.url)],$t=[],At={"/":[2],"/edit":[3],"/view":[4]},Lt={handleError:({error:r})=>{console.error(r)}};class Se{constructor(e,t){this.status=e,typeof t=="string"?this.body={message:t}:t?this.body=t:this.body={message:`Error: ${e}`}}toString(){return JSON.stringify(this.body)}}class Me{constructor(e,t){this.status=e,this.location=t}}const jt="/__data.json";async function Nt(r){var e;for(const t in r)if(typeof((e=r[t])==null?void 0:e.then)=="function")return Object.fromEntries(await Promise.all(Object.entries(r).map(async([i,o])=>[i,await o])));return r}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");Object.getOwnPropertyNames(Object.prototype).sort().join("\0");const Pt=-1,Ut=-2,Tt=-3,Dt=-4,Vt=-5,qt=-6;function Bt(r){return Ct(JSON.parse(r))}function Ct(r){if(typeof r=="number")return i(r,!0);if(!Array.isArray(r)||r.length===0)throw new Error("Invalid input");const e=r,t=Array(e.length);function i(o,p=!1){if(o===Pt)return;if(o===Tt)return NaN;if(o===Dt)return 1/0;if(o===Vt)return-1/0;if(o===qt)return-0;if(p)throw new Error("Invalid input");if(o in t)return t[o];const n=e[o];if(!n||typeof n!="object")t[o]=n;else if(Array.isArray(n))if(typeof n[0]=="string")switch(n[0]){case"Date":t[o]=new Date(n[1]);break;case"Set":const h=new Set;t[o]=h;for(let v=1;v<n.length;v+=1)h.add(i(n[v]));break;case"Map":const m=new Map;t[o]=m;for(let v=1;v<n.length;v+=2)m.set(i(n[v]),i(n[v+1]));break;case"RegExp":t[o]=new RegExp(n[1],n[2]);break;case"Object":t[o]=Object(n[1]);break;case"BigInt":t[o]=BigInt(n[1]);break;case"null":const g=Object.create(null);t[o]=g;for(let v=1;v<n.length;v+=2)g[n[v]]=i(n[v+1]);break}else{const f=new Array(n.length);t[o]=f;for(let h=0;h<n.length;h+=1){const m=n[h];m!==Ut&&(f[h]=i(m))}}else{const f={};t[o]=f;for(const h in n){const m=n[h];f[h]=i(m)}}return t[o]}return i(0)}const He="sveltekit:scroll",B="sveltekit:index",le=bt(me,$t,At,Ot),Ie=me[0],Oe=me[1];Ie();Oe();let re={};try{re=JSON.parse(sessionStorage[He])}catch{}function Ee(r){re[r]=Re()}function Ft({target:r,base:e,trailing_slash:t}){var Ve;const i=[];let o=null;const p={before_navigate:[],after_navigate:[]};let n={branch:[],error:null,url:null},f=!1,h=!1,m=!0,g=!1,v=!1,O,U=(Ve=history.state)==null?void 0:Ve[B];U||(U=Date.now(),history.replaceState({...history.state,[B]:U},"",location.href));const T=re[U];T&&(history.scrollRestoration="manual",scrollTo(T.x,T.y));let V=!1,D,ae,z;async function oe(){z=z||Promise.resolve(),await z,z=null;const a=new URL(location.href),c=ye(a,!0);o=null,await Le(c,a,[])}async function Q(a,{noscroll:c=!1,replaceState:u=!1,keepfocus:s=!1,state:l={}},d,_){return typeof a=="string"&&(a=new URL(a,Fe(document))),we({url:a,scroll:c?Re():null,keepfocus:s,redirect_chain:d,details:{state:l,replaceState:u},nav_token:_,accepted:()=>{},blocked:()=>{},type:"goto"})}async function Ae(a){const c=ye(a,!1);if(!c)throw new Error(`Attempted to prefetch a URL that does not belong to this app: ${a}`);return o={id:c.id,promise:Pe(c)},o.promise}async function Le(a,c,u,s,l={},d){var k,E;ae=l;let _=a&&await Pe(a);if(_||(_=await De(c,null,ne(new Error(`Not found: ${c.pathname}`),{url:c,params:{},routeId:null}),404)),c=(a==null?void 0:a.url)||c,ae!==l)return!1;if(_.type==="redirect")if(u.length>10||u.includes(c.pathname))_=await se({status:500,error:ne(new Error("Redirect loop"),{url:c,params:{},routeId:null}),url:c,routeId:null});else return Q(new URL(_.location,c).href,{},[...u,c.pathname],l),!1;else((E=(k=_.props)==null?void 0:k.page)==null?void 0:E.status)>=400&&await K.updated.check()&&await ie(c);if(i.length=0,v=!1,g=!0,s&&s.details){const{details:w}=s,b=w.replaceState?0:1;w.state[B]=U+=b,history[w.replaceState?"replaceState":"pushState"](w.state,"",c)}if(o=null,h){n=_.state,_.props.page&&(_.props.page.url=c);const w=fe();O.$set(_.props),w()}else je(_);if(s){const{scroll:w,keepfocus:b}=s;if(!b){const S=document.body,$=S.getAttribute("tabindex");S.tabIndex=-1,S.focus({preventScroll:!0}),setTimeout(()=>{var A;(A=getSelection())==null||A.removeAllRanges()}),$!==null?S.setAttribute("tabindex",$):S.removeAttribute("tabindex")}if(await Ce(),m){const S=c.hash&&document.getElementById(c.hash.slice(1));w?scrollTo(w.x,w.y):S?S.scrollIntoView():scrollTo(0,0)}}else await Ce();m=!0,_.props.page&&(D=_.props.page),d&&d(),g=!1}function je(a){var l,d;n=a.state;const c=document.querySelector("style[data-sveltekit]");c&&c.remove(),D=a.props.page;const u=fe();O=new It({target:r,props:{...a.props,stores:K},hydrate:!0}),u();const s={from:null,to:ce("to",{params:n.params,routeId:(d=(l=n.route)==null?void 0:l.id)!=null?d:null,url:new URL(location.href)}),type:"load"};p.after_navigate.forEach(_=>_(s)),h=!0}async function x({url:a,params:c,branch:u,status:s,error:l,route:d,form:_}){var $;const k=u.filter(Boolean),E={type:"loaded",state:{url:a,params:c,branch:u,error:l,route:d},props:{components:k.map(A=>A.node.component)}};_!==void 0&&(E.props.form=_);let w={},b=!D;for(let A=0;A<k.length;A+=1){const N=k[A];w={...w,...N.data},(b||!n.branch.some(P=>P===N))&&(E.props[`data_${A}`]=w,b=b||Object.keys(($=N.data)!=null?$:{}).length>0)}if(b||(b=Object.keys(D.data).length!==Object.keys(w).length),!n.url||a.href!==n.url.href||n.error!==l||_!==void 0||b){E.props.page={error:l,params:c,routeId:d&&d.id,status:s,url:a,form:_,data:b?w:D.data};const A=(N,P)=>{Object.defineProperty(E.props.page,N,{get:()=>{throw new Error(`$page.${N} has been replaced by $page.url.${P}`)}})};A("origin","origin"),A("path","pathname"),A("query","searchParams")}return E}async function _e({loader:a,parent:c,url:u,params:s,routeId:l,server_data_node:d}){var w,b,S,$,A;let _=null;const k={dependencies:new Set,params:new Set,parent:!1,url:!1},E=await a();if((w=E.shared)!=null&&w.load){let N=function(...I){for(const y of I){const{href:R}=new URL(y,u);k.dependencies.add(R)}};const P={routeId:l,params:new Proxy(s,{get:(I,y)=>(k.params.add(y),I[y])}),data:(b=d==null?void 0:d.data)!=null?b:null,url:ut(u,()=>{k.url=!0}),async fetch(I,y){let R;I instanceof Request?(R=I.url,y={body:I.method==="GET"||I.method==="HEAD"?void 0:await I.blob(),cache:I.cache,credentials:I.credentials,headers:I.headers,integrity:I.integrity,keepalive:I.keepalive,method:I.method,mode:I.mode,redirect:I.redirect,referrer:I.referrer,referrerPolicy:I.referrerPolicy,signal:I.signal,...y}):R=I;const j=new URL(R,u).href;return N(j),h?mt(j,y):ht(R,j,y)},setHeaders:()=>{},depends:N,parent(){return k.parent=!0,c()}};Object.defineProperties(P,{props:{get(){throw new Error("@migration task: Replace `props` with `data` stuff https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292693")},enumerable:!1},session:{get(){throw new Error("session is no longer available. See https://github.com/sveltejs/kit/discussions/5883")},enumerable:!1},stuff:{get(){throw new Error("@migration task: Remove stuff https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292693")},enumerable:!1}}),_=(S=await E.shared.load.call(null,P))!=null?S:null,_=_?await Nt(_):null}return{node:E,loader:a,server:d,shared:($=E.shared)!=null&&$.load?{type:"data",data:_,uses:k}:null,data:(A=_!=null?_:d==null?void 0:d.data)!=null?A:null}}function Ne(a,c,u,s){if(v)return!0;if(!u)return!1;if(u.parent&&c||u.url&&a)return!0;for(const l of u.params)if(s[l]!==n.params[l])return!0;for(const l of u.dependencies)if(i.some(d=>d(new URL(l))))return!0;return!1}function ge(a,c){var u,s;return(a==null?void 0:a.type)==="data"?{type:"data",data:a.data,uses:{dependencies:new Set((u=a.uses.dependencies)!=null?u:[]),params:new Set((s=a.uses.params)!=null?s:[]),parent:!!a.uses.parent,url:!!a.uses.url}}:(a==null?void 0:a.type)==="skip"&&c!=null?c:null}async function Pe({id:a,invalidating:c,url:u,params:s,route:l}){var I;if((o==null?void 0:o.id)===a)return o.promise;const{errors:d,layouts:_,leaf:k}=l,E=[..._,k];d.forEach(y=>y==null?void 0:y().catch(()=>{})),E.forEach(y=>y==null?void 0:y[1]().catch(()=>{}));let w=null;const b=n.url?a!==n.url.pathname+n.url.search:!1,S=E.reduce((y,R,j)=>{var ee;const L=n.branch[j],H=!!(R!=null&&R[0])&&((L==null?void 0:L.loader)!==R[1]||Ne(b,y.some(Boolean),(ee=L.server)==null?void 0:ee.uses,s));return y.push(H),y},[]);if(S.some(Boolean)){try{w=await ze(u,S)}catch(y){return se({status:500,error:ne(y,{url:u,params:s,routeId:l.id}),url:u,routeId:l.id})}if(w.type==="redirect")return w}const $=w==null?void 0:w.nodes;let A=!1;const N=E.map(async(y,R)=>{var ee;if(!y)return;const j=n.branch[R],L=$==null?void 0:$[R];if((!L||L.type==="skip")&&y[1]===(j==null?void 0:j.loader)&&!Ne(b,A,(ee=j.shared)==null?void 0:ee.uses,s))return j;if(A=!0,(L==null?void 0:L.type)==="error")throw L;return _e({loader:y[1],url:u,params:s,routeId:l.id,parent:async()=>{var Be;const qe={};for(let be=0;be<R;be+=1)Object.assign(qe,(Be=await N[be])==null?void 0:Be.data);return qe},server_data_node:ge(L===void 0&&y[0]?{type:"skip"}:L!=null?L:null,j==null?void 0:j.server)})});for(const y of N)y.catch(()=>{});const P=[];for(let y=0;y<E.length;y+=1)if(E[y])try{P.push(await N[y])}catch(R){if(R instanceof Me)return{type:"redirect",location:R.location};let j=500,L;$!=null&&$.includes(R)?(j=(I=R.status)!=null?I:j,L=R.error):R instanceof Se?(j=R.status,L=R.body):L=ne(R,{params:s,url:u,routeId:l.id});const H=await Ue(y,P,d);return H?await x({url:u,params:s,branch:P.slice(0,H.idx).concat(H.node),status:j,error:L,route:l}):await De(u,l.id,L,j)}else P.push(void 0);return await x({url:u,params:s,branch:P,status:200,error:null,route:l,form:c?void 0:null})}async function Ue(a,c,u){for(;a--;)if(u[a]){let s=a;for(;!c[s];)s-=1;try{return{idx:s+1,node:{node:await u[a](),loader:u[a],data:{},server:null,shared:null}}}catch{continue}}}async function se({status:a,error:c,url:u,routeId:s}){var w;const l={},d=await Ie();let _=null;if(d.server)try{const b=await ze(u,[!0]);if(b.type!=="data"||b.nodes[0]&&b.nodes[0].type!=="data")throw 0;_=(w=b.nodes[0])!=null?w:null}catch{(u.origin!==location.origin||u.pathname!==location.pathname||f)&&await ie(u)}const k=await _e({loader:Ie,url:u,params:l,routeId:s,parent:()=>Promise.resolve({}),server_data_node:ge(_)}),E={node:await Oe(),loader:Oe,shared:null,server:null,data:null};return await x({url:u,params:l,branch:[k,E],status:a,error:c,route:null})}function ye(a,c){if(Te(a))return;const u=decodeURI(a.pathname.slice(e.length)||"/");for(const s of le){const l=s.exec(u);if(l){const d=new URL(a.origin+lt(a.pathname,t)+a.search+a.hash);return{id:d.pathname+d.search,invalidating:c,route:s,params:ct(l),url:d}}}}function Te(a){return a.origin!==location.origin||!a.pathname.startsWith(e)}async function we({url:a,scroll:c,keepfocus:u,redirect_chain:s,details:l,type:d,delta:_,nav_token:k,accepted:E,blocked:w}){var N,P,I,y;let b=!1;const S=ye(a,!1),$={from:ce("from",{params:n.params,routeId:(P=(N=n.route)==null?void 0:N.id)!=null?P:null,url:n.url}),to:ce("to",{params:(I=S==null?void 0:S.params)!=null?I:null,routeId:(y=S==null?void 0:S.route.id)!=null?y:null,url:a}),type:d};_!==void 0&&($.delta=_);const A={...$,cancel:()=>{b=!0}};if(p.before_navigate.forEach(R=>R(A)),b){w();return}Ee(U),E(),h&&K.navigating.set($),await Le(S,a,s,{scroll:c,keepfocus:u,details:l},k,()=>{p.after_navigate.forEach(R=>R($)),K.navigating.set(null)})}async function De(a,c,u,s){return a.origin===location.origin&&a.pathname===location.pathname&&!f?await se({status:s,error:u,url:a,routeId:c}):await ie(a)}function ie(a){return location.href=a.href,new Promise(()=>{})}return{after_navigate:a=>{ke(()=>(p.after_navigate.push(a),()=>{const c=p.after_navigate.indexOf(a);p.after_navigate.splice(c,1)}))},before_navigate:a=>{ke(()=>(p.before_navigate.push(a),()=>{const c=p.before_navigate.indexOf(a);p.before_navigate.splice(c,1)}))},disable_scroll_handling:()=>{(g||!h)&&(m=!1)},goto:(a,c={})=>Q(a,c,[]),invalidate:a=>{if(a===void 0)throw new Error("`invalidate()` (with no arguments) has been replaced by `invalidateAll()`");if(typeof a=="function")i.push(a);else{const{href:c}=new URL(a,location.href);i.push(u=>u.href===c)}return oe()},invalidateAll:()=>(v=!0,oe()),prefetch:async a=>{const c=new URL(a,Fe(document));await Ae(c)},prefetch_routes:async a=>{const u=(a?le.filter(s=>a.some(l=>s.exec(l))):le).map(s=>Promise.all([...s.layouts,s.leaf].map(l=>l==null?void 0:l[1]())));await Promise.all(u)},apply_action:async a=>{if(a.type==="error"){const c=new URL(location.href),{branch:u,route:s}=n;if(!s)return;const l=await Ue(n.branch.length,u,s.errors);if(l){const d=await x({url:c,params:n.params,branch:u.slice(0,l.idx).concat(l.node),status:500,error:a.error,route:s});n=d.state;const _=fe();O.$set(d.props),_()}}else if(a.type==="redirect")Q(a.location,{},[]);else{const c={form:a.data,page:{...D,form:a.data,status:a.status}},u=fe();O.$set(c),u()}},_start_router:()=>{history.scrollRestoration="manual",addEventListener("beforeunload",s=>{var _,k;let l=!1;const d={from:ce("from",{params:n.params,routeId:(k=(_=n.route)==null?void 0:_.id)!=null?k:null,url:n.url}),to:null,type:"unload",cancel:()=>l=!0};p.before_navigate.forEach(E=>E(d)),l?(s.preventDefault(),s.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){Ee(U);try{sessionStorage[He]=JSON.stringify(re)}catch{}}});const a=s=>{const{url:l,options:d}=Je(s);if(l&&d.prefetch){if(Te(l))return;Ae(l)}};let c;const u=s=>{clearTimeout(c),c=setTimeout(()=>{var l;(l=s.target)==null||l.dispatchEvent(new CustomEvent("sveltekit:trigger_prefetch",{bubbles:!0}))},20)};addEventListener("touchstart",a),addEventListener("mousemove",u),addEventListener("sveltekit:trigger_prefetch",a),addEventListener("click",s=>{if(s.button||s.which!==1||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||s.defaultPrevented)return;const{a:l,url:d,options:_}=Je(s);if(!l||!d)return;const k=l instanceof SVGAElement;if(!k&&d.protocol!==location.protocol&&!(d.protocol==="https:"||d.protocol==="http:"))return;const E=(l.getAttribute("rel")||"").split(/\s+/);if(l.hasAttribute("download")||E.includes("external")||_.reload||(k?l.target.baseVal:l.target))return;const[w,b]=d.href.split("#");if(b!==void 0&&w===location.href.split("#")[0]){V=!0,Ee(U),n.url=d,K.page.set({...D,url:d}),K.page.notify();return}we({url:d,scroll:_.noscroll?Re():null,keepfocus:!1,redirect_chain:[],details:{state:{},replaceState:d.href===location.href},accepted:()=>s.preventDefault(),blocked:()=>s.preventDefault(),type:"link"})}),addEventListener("popstate",s=>{if(s.state){if(s.state[B]===U)return;const l=s.state[B]-U;we({url:new URL(location.href),scroll:re[s.state[B]],keepfocus:!1,redirect_chain:[],details:null,accepted:()=>{U=s.state[B]},blocked:()=>{history.go(-l)},type:"popstate",delta:l})}}),addEventListener("hashchange",()=>{V&&(V=!1,history.replaceState({...history.state,[B]:++U},"",location.href))});for(const s of document.querySelectorAll("link"))s.rel==="icon"&&(s.href=s.href);addEventListener("pageshow",s=>{s.persisted&&K.navigating.set(null)})},_hydrate:async({status:a,error:c,node_ids:u,params:s,routeId:l,data:d,form:_})=>{var w;f=!0;const k=new URL(location.href);let E;try{const b=u.map(async(S,$)=>{const A=d[$];return _e({loader:me[S],url:k,params:s,routeId:l,parent:async()=>{const N={};for(let P=0;P<$;P+=1)Object.assign(N,(await b[P]).data);return N},server_data_node:ge(A)})});E=await x({url:k,params:s,branch:await Promise.all(b),status:a,error:c,form:_,route:(w=le.find(S=>S.id===l))!=null?w:null})}catch(b){if(b instanceof Me){await ie(new URL(b.location,location.href));return}E=await se({status:b instanceof Se?b.status:500,error:ne(b,{url:k,params:s,routeId:l}),url:k,routeId:l})}je(E)}}}async function ze(r,e){const t=new URL(r);t.pathname=r.pathname.replace(/\/$/,"")+jt;const i=await he(t.href,{headers:{"x-sveltekit-invalidated":e.map(p=>p?"1":"").join(",")}}),o=await i.text();if(!i.ok)throw new Error(JSON.parse(o));return Bt(o)}function ne(r,e){var t;return r instanceof Se?r.body:(t=Lt.handleError({error:r,event:e}))!=null?t:{message:e.routeId!=null?"Internal Error":"Not Found"}}const Jt=["hash","href","host","hostname","origin","pathname","port","protocol","search","searchParams","toString","toJSON"];function ce(r,e){for(const t of Jt)Object.defineProperty(e,t,{get(){throw new Error(`The navigation shape changed - ${r}.${t} should now be ${r}.url.${t}`)},enumerable:!1});return e}function fe(){return()=>{}}async function Ht({env:r,hydrate:e,paths:t,target:i,trailing_slash:o}){it(t);const p=Ft({target:i,base:t.base,trailing_slash:o});st({client:p}),e?await p._hydrate(e):p.goto(location.href,{replaceState:!0}),p._start_router()}export{Ht as start};
|