import { e } from './chunks/dev-fallback-Bc5Ork7Y.js';
import { S as SvelteKitError, j as json, t as text, R as Redirect, H as HttpError, e as error, A as ActionFailure } from './chunks/index-wpIsICWW.js';
import { a as f, h, e as e$1, j as j$2, i, O as O$2, D, E as E$1, U as U$2, w as with_request_store, T as T$1, C as C$2, I as I$2, L, t, s, y, R as R$1, l, c, x as x$2, b as try_get_request_store, r, o, d as c$1 } from './chunks/exports-DjtMXPv8.js';
import { a as asClassComponent } from './chunks/legacy-server-DGCTSQ6f.js';
import { k as readable, w as writable } from './chunks/async-Djx13DAD.js';
import { s as setContext } from './chunks/context-BZS6UlnY.js';
import { a } from './chunks/index5-BoOEKc6P.js';
import './chunks/index-B7gr0Dsc.js';
import './chunks/escaping-CBnpiEl5.js';
import './chunks/uneval-DjLoL4oF.js';
import './chunks/clone-BLo8hHdj.js';

/**
 * @template {{ tracing: { enabled: boolean, root: import('@opentelemetry/api').Span, current: import('@opentelemetry/api').Span } }} T
 * @param {T} event_like
 * @param {import('@opentelemetry/api').Span} current
 * @returns {T}
 */
function merge_tracing(event_like, current) {
	return {
		...event_like,
		tracing: {
			...event_like.tracing,
			current
		}
	};
}

const ge={"<":"\\u003C","\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","	":"\\t","\u2028":"\\u2028","\u2029":"\\u2029"};let j$1 = class j extends Error{constructor(r,t,n,a){super(r),this.name="DevalueError",this.path=t.join(""),this.value=n,this.root=a;}};function R(e){return Object(e)!==e}const H=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function K(e){const r=Object.getPrototypeOf(e);return r===Object.prototype||r===null||Object.getPrototypeOf(r)===null||Object.getOwnPropertyNames(r).sort().join("\0")===H}function q(e){return Object.prototype.toString.call(e).slice(8,-1)}function Q(e){switch(e){case '"':return '\\"';case "<":return "\\u003C";case "\\":return "\\\\";case `
`:return "\\n";case "\r":return "\\r";case "	":return "\\t";case "\b":return "\\b";case "\f":return "\\f";case "\u2028":return "\\u2028";case "\u2029":return "\\u2029";default:return e<" "?`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`:""}}function A(e){let r="",t=0;const n=e.length;for(let a=0;a<n;a+=1){const s=e[a],c=Q(s);c&&(r+=e.slice(t,a)+c,t=a+1);}return `"${t===0?e:r+e.slice(t)}"`}function X(e){return Object.getOwnPropertySymbols(e).filter(r=>Object.getOwnPropertyDescriptor(e,r).enumerable)}const ee=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function B(e){return ee.test(e)?"."+e:"["+JSON.stringify(e)+"]"}function te(e){const r=new DataView(e);let t="";for(let n=0;n<e.byteLength;n++)t+=String.fromCharCode(r.getUint8(n));return ae$1(t)}function re$1(e){const r=ne$1(e),t=new ArrayBuffer(r.length),n=new DataView(t);for(let a=0;a<t.byteLength;a++)n.setUint8(a,r.charCodeAt(a));return t}const x$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function ne$1(e){e.length%4===0&&(e=e.replace(/==?$/,""));let r="",t=0,n=0;for(let a=0;a<e.length;a++)t<<=6,t|=x$1.indexOf(e[a]),n+=6,n===24&&(r+=String.fromCharCode((t&16711680)>>16),r+=String.fromCharCode((t&65280)>>8),r+=String.fromCharCode(t&255),t=n=0);return n===12?(t>>=4,r+=String.fromCharCode(t)):n===18&&(t>>=2,r+=String.fromCharCode((t&65280)>>8),r+=String.fromCharCode(t&255)),r}function ae$1(e){let r="";for(let t=0;t<e.length;t+=3){const n=[void 0,void 0,void 0,void 0];n[0]=e.charCodeAt(t)>>2,n[1]=(e.charCodeAt(t)&3)<<4,e.length>t+1&&(n[1]|=e.charCodeAt(t+1)>>4,n[2]=(e.charCodeAt(t+1)&15)<<2),e.length>t+2&&(n[2]|=e.charCodeAt(t+2)>>6,n[3]=e.charCodeAt(t+2)&63);for(let a=0;a<n.length;a++)typeof n[a]>"u"?r+="=":r+=x$1[n[a]];}return r}const T=-1,M$2=-2,F=-3,Y=-4,V=-5,P$1=-6;function Z(e,r){return se(JSON.parse(e),r)}function se(e,r){if(typeof e=="number")return s(e,true);if(!Array.isArray(e)||e.length===0)throw new Error("Invalid input");const t=e,n=Array(t.length);let a=null;function s(c,b=false){if(c===T)return;if(c===F)return NaN;if(c===Y)return 1/0;if(c===V)return  -1/0;if(c===P$1)return  -0;if(b||typeof c!="number")throw new Error("Invalid input");if(c in n)return n[c];const f=t[c];if(!f||typeof f!="object")n[c]=f;else if(Array.isArray(f))if(typeof f[0]=="string"){const o=f[0],l=r&&Object.hasOwn(r,o)?r[o]:void 0;if(l){let i=f[1];if(typeof i!="number"&&(i=t.push(f[1])-1),a??=new Set,a.has(i))throw new Error("Invalid circular reference");return a.add(i),n[c]=l(s(i)),a.delete(i),n[c]}switch(o){case "Date":n[c]=new Date(f[1]);break;case "Set":const i=new Set;n[c]=i;for(let y=1;y<f.length;y+=1)i.add(s(f[y]));break;case "Map":const m=new Map;n[c]=m;for(let y=1;y<f.length;y+=2)m.set(s(f[y]),s(f[y+1]));break;case "RegExp":n[c]=new RegExp(f[1],f[2]);break;case "Object":n[c]=Object(f[1]);break;case "BigInt":n[c]=BigInt(f[1]);break;case "null":const k=Object.create(null);n[c]=k;for(let y=1;y<f.length;y+=2)k[f[y]]=s(f[y+1]);break;case "Int8Array":case "Uint8Array":case "Uint8ClampedArray":case "Int16Array":case "Uint16Array":case "Int32Array":case "Uint32Array":case "Float32Array":case "Float64Array":case "BigInt64Array":case "BigUint64Array":{if(t[f[1]][0]!=="ArrayBuffer")throw new Error("Invalid data");const y=globalThis[o],u=s(f[1]),h=new y(u);n[c]=f[2]!==void 0?h.subarray(f[2],f[3]):h;break}case "ArrayBuffer":{const y=f[1];if(typeof y!="string")throw new Error("Invalid ArrayBuffer encoding");const u=re$1(y);n[c]=u;break}case "Temporal.Duration":case "Temporal.Instant":case "Temporal.PlainDate":case "Temporal.PlainTime":case "Temporal.PlainDateTime":case "Temporal.PlainMonthDay":case "Temporal.PlainYearMonth":case "Temporal.ZonedDateTime":{const y=o.slice(9);n[c]=Temporal[y].from(f[1]);break}case "URL":{const y=new URL(f[1]);n[c]=y;break}case "URLSearchParams":{const y=new URLSearchParams(f[1]);n[c]=y;break}default:throw new Error(`Unknown type ${o}`)}}else {const o=new Array(f.length);n[c]=o;for(let l=0;l<f.length;l+=1){const i=f[l];i!==M$2&&(o[l]=s(i));}}else {const o={};n[c]=o;for(const l in f){if(l==="__proto__")throw new Error("Cannot parse an object with a `__proto__` property");const i=f[l];o[l]=s(i);}}return n[c]}return s(0)}function oe(e,r){const t=[],n=new Map,a=[];if(r)for(const o of Object.getOwnPropertyNames(r))a.push({key:o,fn:r[o]});const s=[];let c=0;function b(o){if(o===void 0)return T;if(Number.isNaN(o))return F;if(o===1/0)return Y;if(o===-1/0)return V;if(o===0&&1/o<0)return P$1;if(n.has(o))return n.get(o);const l=c++;n.set(o,l);for(const{key:m,fn:k}of a){const y=k(o);if(y)return t[l]=`["${m}",${b(y)}]`,l}if(typeof o=="function")throw new j$1("Cannot stringify a function",s,o,e);let i="";if(R(o))i=E(o);else {const m=q(o);switch(m){case "Number":case "String":case "Boolean":i=`["Object",${E(o)}]`;break;case "BigInt":i=`["BigInt",${o}]`;break;case "Date":i=`["Date","${!isNaN(o.getDate())?o.toISOString():""}"]`;break;case "URL":i=`["URL",${A(o.toString())}]`;break;case "URLSearchParams":i=`["URLSearchParams",${A(o.toString())}]`;break;case "RegExp":const{source:y,flags:u}=o;i=u?`["RegExp",${A(y)},"${u}"]`:`["RegExp",${A(y)}]`;break;case "Array":i="[";for(let h=0;h<o.length;h+=1)h>0&&(i+=","),h in o?(s.push(`[${h}]`),i+=b(o[h]),s.pop()):i+=M$2;i+="]";break;case "Set":i='["Set"';for(const h of o)i+=`,${b(h)}`;i+="]";break;case "Map":i='["Map"';for(const[h,d]of o)s.push(`.get(${R(h)?E(h):"..."})`),i+=`,${b(h)},${b(d)}`,s.pop();i+="]";break;case "Int8Array":case "Uint8Array":case "Uint8ClampedArray":case "Int16Array":case "Uint16Array":case "Int32Array":case "Uint32Array":case "Float32Array":case "Float64Array":case "BigInt64Array":case "BigUint64Array":{const h=o;i='["'+m+'",'+b(h.buffer);const d=o.byteOffset,p=d+o.byteLength;if(d>0||p!==h.buffer.byteLength){const g=+/(\d+)/.exec(m)[1]/8;i+=`,${d/g},${p/g}`;}i+="]";break}case "ArrayBuffer":{i=`["ArrayBuffer","${te(o)}"]`;break}case "Temporal.Duration":case "Temporal.Instant":case "Temporal.PlainDate":case "Temporal.PlainTime":case "Temporal.PlainDateTime":case "Temporal.PlainMonthDay":case "Temporal.PlainYearMonth":case "Temporal.ZonedDateTime":i=`["${m}",${A(o.toString())}]`;break;default:if(!K(o))throw new j$1("Cannot stringify arbitrary non-POJOs",s,o,e);if(X(o).length>0)throw new j$1("Cannot stringify POJOs with symbolic keys",s,o,e);if(Object.getPrototypeOf(o)===null){i='["null"';for(const h in o)s.push(B(h)),i+=`,${A(h)},${b(o[h])}`,s.pop();i+="]";}else {i="{";let h=false;for(const d in o)h&&(i+=","),h=true,s.push(B(d)),i+=`${A(d)}:${b(o[d])}`,s.pop();i+="}";}}}return t[l]=i,l}const f=b(e);return f<0?`${f}`:`[${t.join(",")}]`}function E(e){const r=typeof e;return r==="string"?A(e):e instanceof String?A(e.toString()):e===void 0?T.toString():e===0&&1/e<0?P$1.toString():r==="bigint"?`["BigInt","${e}"]`:String(e)}function ie(e,r,t){r.startsWith("n:")?(r=r.slice(2),t=t===""?void 0:parseFloat(t)):r.startsWith("b:")&&(r=r.slice(2),t=t==="on"),he$1(e,ue(r),t);}function ce$1(e){const r={};for(let t of e.keys()){const n=t.endsWith("[]");let a=e.getAll(t);if(n&&(t=t.slice(0,-2)),a.length>1&&!n)throw new Error(`Form cannot contain duplicated keys — "${t}" has ${a.length} values`);a=a.filter(s=>typeof s=="string"||s.name!==""||s.size>0),t.startsWith("n:")?(t=t.slice(2),a=a.map(s=>s===""?void 0:parseFloat(s))):t.startsWith("b:")&&(t=t.slice(2),a=a.map(s=>s==="on")),ie(r,t,n?a:a[0]);}return r}const fe="application/x-sveltekit-formdata",U$1=0,O$1=7;async function _e(e){if(e.headers.get("content-type")!==fe){const u=await e.formData();return {data:ce$1(u),meta:{},form_data:u}}if(!e.body)throw _("no body");const r=parseInt(e.headers.get("content-length")??"");if(Number.isNaN(r))throw _("invalid Content-Length header");const t=e.body.getReader(),n=[];function a(u){if(u in n)return n[u];let h=n.length;for(;h<=u;)n[h]=t.read().then(d=>d.value),h++;return n[u]}async function s(u,h){let d,p=0,g;for(g=0;;g++){const w=await a(g);if(!w)return null;const L=p+w.byteLength;if(u>=p&&u<L){d=w;break}p=L;}if(u+h<=p+d.byteLength)return d.subarray(u-p,u+h-p);const N=[d.subarray(u-p)];let $=d.byteLength-u+p;for(;$<h;){g++;let w=await a(g);if(!w)return null;w.byteLength>h-$&&(w=w.subarray(0,h-$)),N.push(w),$+=w.byteLength;}const D=new Uint8Array(h);$=0;for(const w of N)D.set(w,$),$+=w.byteLength;return D}const c=await s(0,O$1);if(!c)throw _("too short");if(c[0]!==U$1)throw _(`got version ${c[0]}, expected version ${U$1}`);const b=new DataView(c.buffer,c.byteOffset,c.byteLength),f$1=b.getUint32(1,true);if(O$1+f$1>r)throw _("data overflow");const o=b.getUint16(5,true);if(O$1+f$1+o>r)throw _("file offset table overflow");const l=await s(O$1,f$1);if(!l)throw _("data too short");let i,m;if(o>0){const u=await s(O$1+f$1,o);if(!u)throw _("file offset table too short");i=JSON.parse(f.decode(u)),m=O$1+f$1+o;}const[k,y]=Z(f.decode(l),{File:([u,h,d,p,g])=>{if(m+i[g]+d>r)throw _("file data overflow");return new Proxy(new C$1(u,h,d,p,a,m+i[g]),{getPrototypeOf(){return File.prototype}})}});return (async()=>{let u=true;for(;u;)u=!!await a(n.length);})(),{data:k,meta:y,form_data:null}}function _(e){return new SvelteKitError(400,"Bad Request",`Could not deserialize binary form: ${e}`)}let C$1 = class C{#t;#e;constructor(r,t,n,a,s,c){this.name=r,this.type=t,this.size=n,this.lastModified=a,this.webkitRelativePath="",this.#t=s,this.#e=c,this.arrayBuffer=this.arrayBuffer.bind(this),this.bytes=this.bytes.bind(this),this.slice=this.slice.bind(this),this.stream=this.stream.bind(this),this.text=this.text.bind(this);}#r;async arrayBuffer(){return this.#r??=await new Response(this.stream()).arrayBuffer(),this.#r}async bytes(){return new Uint8Array(await this.arrayBuffer())}slice(r=0,t=this.size,n=this.type){r<0?r=Math.max(this.size+r,0):r=Math.min(r,this.size),t<0?t=Math.max(this.size+t,0):t=Math.min(t,this.size);const a=Math.max(t-r,0);return new C(this.name,n,a,this.lastModified,this.#t,this.#e+r)}stream(){let r=0,t=0;return new ReadableStream({start:async n=>{let a=0,s=null;for(t=0;;t++){const c=await this.#t(t);if(!c)return null;const b=a+c.byteLength;if(this.#e>=a&&this.#e<b){s=c;break}a=b;}this.#e+this.size<=a+s.byteLength?(n.enqueue(s.subarray(this.#e-a,this.#e+this.size-a)),n.close()):(n.enqueue(s.subarray(this.#e-a)),r=s.byteLength-this.#e+a);},pull:async n=>{t++;let a=await this.#t(t);if(!a){n.error("incomplete file data"),n.close();return}a.byteLength>this.size-r&&(a=a.subarray(0,this.size-r)),n.enqueue(a),r+=a.byteLength,r>=this.size&&n.close();}})}async text(){return f.decode(await this.arrayBuffer())}};const le=/^[a-zA-Z_$]\w*(\.[a-zA-Z_$]\w*|\[\d+\])*$/;function ue(e){if(!le.test(e))throw new Error(`Invalid path ${e}`);return e.split(/\.|\[|\]/).filter(Boolean)}function z(e$1){if(e$1==="__proto__"||e$1==="constructor"||e$1==="prototype")throw new Error(`Invalid key "${e$1}"`+(e?": This key is not allowed to prevent prototype pollution.":""))}function he$1(e,r,t){let n=e;for(let s=0;s<r.length-1;s+=1){const c=r[s];z(c);const b=/^\d+$/.test(r[s+1]),f=Object.hasOwn(n,c),o=n[c];if(f&&b!==Array.isArray(o))throw new Error(`Invalid array key ${r[s+1]}`);f||(n[c]=b?[]:{}),n=n[c];}const a=r[r.length-1];z(a),n[a]=t;}function Oe(e,r){const t=/^(moz-icon|view-source|jar):/.exec(r);t&&console.warn(`${e}: Calling \`depends('${r}')\` will throw an error in Firefox because \`${t[1]}\` is a special URI scheme`);}const Ie="x-sveltekit-invalidated",ve$1="x-sveltekit-trailing-slash";function je$1(e,r){if(e!=null&&Object.getPrototypeOf(e)!==Object.prototype)throw new Error(`a load function ${r} returned ${typeof e!="object"?`a ${typeof e}`:e instanceof Response?"a Response object":Array.isArray(e)?"an array":"a non-plain object"}, but must return a plain object at the top level (i.e. \`return {...}\`)`)}function de(e,r){const t=Object.fromEntries(Object.entries(r).map(([n,a])=>[n,a.encode]));return oe(e,t)}function Se$1(e,r){if(!e)return;const t=f.decode(h(e.replaceAll("-","+").replaceAll("_","/"))),n=Object.fromEntries(Object.entries(r).map(([a,s])=>[a,s.decode]));return Z(t,n)}function Te(e,r){return e+"/"+r}

let x={},G=n=>n?.stack;function O(n){}function P(n){x=n;}let k=null;function I$1(n){k=n;}function j(n,e){n.component(t=>{let{stores:i,page:a$1,constructors:s$1,components:u=[],form:r,data_0:c=null,data_1:g=null}=e;a||setContext("__svelte__",i),a||i.page.set(a$1);const f=s$1[1];if(s$1[1]){t.push("<!--[-->");const o=s$1[0];t.push("<!---->"),o(t,{data:c,form:r,params:a$1.params,children:p=>{p.push("<!---->"),f(p,{data:g,form:r,params:a$1.params}),p.push("<!---->");},$$slots:{default:true}}),t.push("<!---->");}else {t.push("<!--[!-->");const o=s$1[0];t.push("<!---->"),o(t,{data:c,form:r,params:a$1.params}),t.push("<!---->");}t.push("<!--]--> "),t.push("<!--[!-->"),t.push("<!--]-->");});}const C=asClassComponent(j),M$1={app_template_contains_nonce:false,async:true,csp:{mode:"auto",directives:{"upgrade-insecure-requests":false,"block-all-mixed-content":false},reportOnly:{"upgrade-insecure-requests":false,"block-all-mixed-content":false}},csrf_check_origin:true,csrf_trusted_origins:[],embedded:false,env_public_prefix:"PUBLIC_",env_private_prefix:"",hash_routing:false,hooks:null,preload_strategy:"modulepreload",root:C,service_worker:false,service_worker_options:void 0,templates:{app:({head:n,body:e,assets:t,nonce:i,env:a})=>`<!doctype html>
<html
	lang="en"
	style="
		margin: 0;
		padding: 0;
		min-height: 100%;
		display: flex;
		flex-direction: column;
	"
>
	<head>
		<meta charset="utf-8" />
		<link rel="icon" href="/favicon.ico" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<meta property="og:title" content="Gradio" />
		<meta property="og:type" content="website" />
		<meta property="og:url" content="{url}" />
		<meta property="og:description" content="Click to try out the app!" />
		<meta
			property="og:image"
			content="https://raw.githubusercontent.com/gradio-app/gradio/main/js/_website/src/lib/assets/img/header-image.jpg"
		/>
		<meta name="twitter:card" content="summary_large_image" />
		<meta name="twitter:creator" content="@Gradio" />
		<meta name="twitter:title" content="Gradio" />
		<meta name="twitter:description" content="Click to try out the app!" />
		<meta
			name="twitter:image"
			content="https://raw.githubusercontent.com/gradio-app/gradio/main/js/_website/src/lib/assets/img/header-image.jpg"
		/>
		<script data-gradio-mode>
			window.__gradio_mode__ = "app";
			window.iFrameResizer = {
				autoResize: false,
				sizeWidth: false
			};
			window.parent?.postMessage(
				{ type: "SET_SCROLLING", enabled: false },
				"*"
			);
		<\/script>
		<script
			src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"
			async
		><\/script>

		`+n+`
	</head>
	<body
		data-sveltekit-preload-data="hover"
		style="
			width: 100%;
			margin: 0;
			padding: 0;
			display: flex;
			flex-direction: column;
			flex-grow: 1;
		"
	>
		<div style="display: contents">`+e+`</div>
	</body>
</html>
`,error:({status:n,message:e})=>`<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>`+e+`</title>

		<style>
			body {
				--bg: white;
				--fg: #222;
				--divider: #ccc;
				background: var(--bg);
				color: var(--fg);
				font-family:
					system-ui,
					-apple-system,
					BlinkMacSystemFont,
					'Segoe UI',
					Roboto,
					Oxygen,
					Ubuntu,
					Cantarell,
					'Open Sans',
					'Helvetica Neue',
					sans-serif;
				display: flex;
				align-items: center;
				justify-content: center;
				height: 100vh;
				margin: 0;
			}

			.error {
				display: flex;
				align-items: center;
				max-width: 32rem;
				margin: 0 1rem;
			}

			.status {
				font-weight: 200;
				font-size: 3rem;
				line-height: 1;
				position: relative;
				top: -0.05rem;
			}

			.message {
				border-left: 1px solid var(--divider);
				padding: 0 0 0 1rem;
				margin: 0 0 0 1rem;
				min-height: 2.5rem;
				display: flex;
				align-items: center;
			}

			.message h1 {
				font-weight: 400;
				font-size: 1em;
				margin: 0;
			}

			@media (prefers-color-scheme: dark) {
				body {
					--bg: #222;
					--fg: #ddd;
					--divider: #666;
				}
			}
		</style>
	</head>
	<body>
		<div class="error">
			<span class="status">`+n+`</span>
			<div class="message">
				<h1>`+e+`</h1>
			</div>
		</div>
	</body>
</html>
`},version_hash:"ohxl8c"};async function U(){return {handle:void 0,handleFetch:void 0,handleError:void 0,handleValidationError:void 0,init:void 0,reroute:void 0,transport:void 0}}

function Tt(){let e,t;return {promise:new Promise((n,s)=>{e=n,t=s;}),resolve:e,reject:t}}const qr=[101,103,204,205,304],Nr=!!globalThis.process?.versions?.webcontainer,zr="/_svelte_kit_assets",Ot=["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"],Lr=["GET","POST","HEAD"],Pe="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",Dr=/[<\b\f\n\r\t\0\u2028\u2029]/g,Ir=/^(?:do|if|in|for|int|let|new|try|var|byte|case|char|else|enum|goto|long|this|void|with|await|break|catch|class|const|final|float|short|super|throw|while|yield|delete|double|export|import|native|return|switch|throws|typeof|boolean|default|extends|finally|package|private|abstract|continue|debugger|function|volatile|interface|protected|transient|implements|instanceof|synchronized)$/;function W(e,t){const r=new Map,n=[],s=new Map;function a(i){if(!R(i)){if(r.has(i)){r.set(i,r.get(i)+1);return}if(r.set(i,1),t){const u=t(i,m=>W(m,t));if(typeof u=="string"){s.set(i,u);return}}if(typeof i=="function")throw new j$1("Cannot stringify a function",n,i,e);switch(q(i)){case "Number":case "BigInt":case "String":case "Boolean":case "Date":case "RegExp":case "URL":case "URLSearchParams":return;case "Array":i.forEach((u,m)=>{n.push(`[${m}]`),a(u),n.pop();});break;case "Set":Array.from(i).forEach(a);break;case "Map":for(const[u,m]of i)n.push(`.get(${R(u)?Ue(u):"..."})`),a(m),n.pop();break;case "Int8Array":case "Uint8Array":case "Uint8ClampedArray":case "Int16Array":case "Uint16Array":case "Int32Array":case "Uint32Array":case "Float32Array":case "Float64Array":case "BigInt64Array":case "BigUint64Array":a(i.buffer);return;case "ArrayBuffer":return;case "Temporal.Duration":case "Temporal.Instant":case "Temporal.PlainDate":case "Temporal.PlainTime":case "Temporal.PlainDateTime":case "Temporal.PlainMonthDay":case "Temporal.PlainYearMonth":case "Temporal.ZonedDateTime":return;default:if(!K(i))throw new j$1("Cannot stringify arbitrary non-POJOs",n,i,e);if(X(i).length>0)throw new j$1("Cannot stringify POJOs with symbolic keys",n,i,e);for(const u in i)n.push(B(u)),a(i[u]),n.pop();}}}a(e);const c=new Map;Array.from(r).filter(i=>i[1]>1).sort((i,l)=>l[1]-i[1]).forEach((i,l)=>{c.set(i[0],Hr(l));});function d(i){if(c.has(i))return c.get(i);if(R(i))return Ue(i);if(s.has(i))return s.get(i);const l=q(i);switch(l){case "Number":case "String":case "Boolean":return `Object(${d(i.valueOf())})`;case "RegExp":return `new RegExp(${A(i.source)}, "${i.flags}")`;case "Date":return `new Date(${i.getTime()})`;case "URL":return `new URL(${A(i.toString())})`;case "URLSearchParams":return `new URLSearchParams(${A(i.toString())})`;case "Array":const u=i.map((h,y)=>y in i?d(h):""),m=i.length===0||i.length-1 in i?"":",";return `[${u.join(",")}${m}]`;case "Set":case "Map":return `new ${l}([${Array.from(i).map(d).join(",")}])`;case "Int8Array":case "Uint8Array":case "Uint8ClampedArray":case "Int16Array":case "Uint16Array":case "Int32Array":case "Uint32Array":case "Float32Array":case "Float64Array":case "BigInt64Array":case "BigUint64Array":{let h=`new ${l}`;if(r.get(i.buffer)===1){const E=new i.constructor(i.buffer);h+=`([${E}])`;}else h+=`([${d(i.buffer)}])`;const y=i.byteOffset,b=y+i.byteLength;if(y>0||b!==i.buffer.byteLength){const E=+/(\d+)/.exec(l)[1]/8;h+=`.subarray(${y/E},${b/E})`;}return h}case "ArrayBuffer":return `new Uint8Array([${new Uint8Array(i).toString()}]).buffer`;case "Temporal.Duration":case "Temporal.Instant":case "Temporal.PlainDate":case "Temporal.PlainTime":case "Temporal.PlainDateTime":case "Temporal.PlainMonthDay":case "Temporal.PlainYearMonth":case "Temporal.ZonedDateTime":return `${l}.from(${A(i.toString())})`;default:const p=Object.keys(i),_=p.map(h=>`${Wr(h)}:${d(i[h])}`).join(",");return Object.getPrototypeOf(i)===null?p.length>0?`{${_},__proto__:null}`:"{__proto__:null}":`{${_}}`}}const o=d(e);if(c.size){const i=[],l=[],u=[];return c.forEach((m,p)=>{if(i.push(m),s.has(p)){u.push(s.get(p));return}if(R(p)){u.push(Ue(p));return}switch(q(p)){case "Number":case "String":case "Boolean":u.push(`Object(${d(p.valueOf())})`);break;case "RegExp":u.push(p.toString());break;case "Date":u.push(`new Date(${p.getTime()})`);break;case "Array":u.push(`Array(${p.length})`),p.forEach((f,h)=>{l.push(`${m}[${h}]=${d(f)}`);});break;case "Set":u.push("new Set"),l.push(`${m}.${Array.from(p).map(f=>`add(${d(f)})`).join(".")}`);break;case "Map":u.push("new Map"),l.push(`${m}.${Array.from(p).map(([f,h])=>`set(${d(f)}, ${d(h)})`).join(".")}`);break;case "ArrayBuffer":u.push(`new Uint8Array([${new Uint8Array(p).join(",")}]).buffer`);break;default:u.push(Object.getPrototypeOf(p)===null?"Object.create(null)":"{}"),Object.keys(p).forEach(f=>{l.push(`${m}${Br(f)}=${d(p[f])}`);});}}),l.push(`return ${o}`),`(function(${i.join(",")}){${l.join(";")}}(${u.join(",")}))`}else return o}function Hr(e){let t="";do t=Pe[e%Pe.length]+t,e=~~(e/Pe.length)-1;while(e>=0);return Ir.test(t)?`${t}0`:t}function Mr(e){return ge[e]||e}function Ct(e){return e.replace(Dr,Mr)}function Wr(e){return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(e)?e:Ct(JSON.stringify(e))}function Br(e){return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(e)?`.${e}`:`[${Ct(JSON.stringify(e))}]`}function Ue(e){if(typeof e=="string")return A(e);if(e===void 0)return "void 0";if(e===0&&1/e<0)return "-0";const t=String(e);return typeof e=="number"?t.replace(/^(-)?0\./,"$1."):typeof e=="bigint"?e+"n":t}function Ge(e,t){const r=[];e.split(",").forEach((a,c)=>{const d=/([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(a);if(d){const[,o,i,l="1"]=d;r.push({type:o,subtype:i,q:+l,i:c});}}),r.sort((a,c)=>a.q!==c.q?c.q-a.q:a.subtype==="*"!=(c.subtype==="*")?a.subtype==="*"?1:-1:a.type==="*"!=(c.type==="*")?a.type==="*"?1:-1:a.i-c.i);let n,s=1/0;for(const a of t){const[c,d]=a.split("/"),o=r.findIndex(i=>(i.type===c||i.type==="*")&&(i.subtype===d||i.subtype==="*"));o!==-1&&o<s&&(n=a,s=o);}return n}function Fr(e,...t){const r=e.headers.get("content-type")?.split(";",1)[0].trim()??"";return t.includes(r.toLowerCase())}function Je(e){return Fr(e,"application/x-www-form-urlencoded","multipart/form-data","text/plain",fe)}function Vr(e){return e instanceof Error||e&&e.name&&e.message?e:new Error(JSON.stringify(e))}function ce(e){return e instanceof HttpError||e instanceof SvelteKitError?e.status:500}function Gr(e){return e instanceof SvelteKitError?e.text:"Internal Error"}const Pt={"&":"&amp;",'"':"&quot;"},Ut={"&":"&amp;","<":"&lt;"},qt="[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]",Jr=new RegExp(`[${Object.keys(Pt).join("")}]|`+qt,"g"),Zr=new RegExp(`[${Object.keys(Ut).join("")}]|`+qt,"g");function Ze(e,t){const r=t?Pt:Ut;return e.replace(t?Jr:Zr,s=>s.length===2?s:r[s]??`&#${s.charCodeAt(0)};`)}function Nt(e,t){return text(`${t} method not allowed`,{status:405,headers:{allow:Kr(e).join(", ")}})}function Kr(e){const t=Ot.filter(r=>r in e);return "GET"in e&&!("HEAD"in e)&&t.push("HEAD"),t}function zt(e$1){return e?"__sveltekit_dev":`__sveltekit_${e$1.version_hash}`}function Ae(e$1,t,r){let n=e$1.templates.error({status:t,message:Ze(r)});return e&&(n=n.replace("</head>",'<script type="module" src="/@vite/client"><\/script></head>')),text(n,{headers:{"content-type":"text/html; charset=utf-8"},status:t})}async function qe(e,t,r,n){n=n instanceof HttpError?n:Vr(n);const s=ce(n),a=await M(e,t,r,n),c=Ge(e.request.headers.get("accept")||"text/html",["application/json","text/html"]);return e.isDataRequest||c==="application/json"?json(a,{status:s}):Ae(r,s,a.message)}async function M(e$1,t,r,n){if(n instanceof HttpError)return {message:"Unknown Error",...n.body};e&&typeof n=="object"&&G(n);const s=ce(n),a=Gr(n);return await with_request_store({event:e$1,state:t},()=>r.hooks.handleError({error:n,event:e$1,status:s,message:a}))??{message:a}}function Se(e,t){return new Response(void 0,{status:e,headers:{location:t}})}function Lt(e,t){return t.path?`Data returned from \`load\` while rendering ${e.route.id} is not serializable: ${t.message} (${t.path}). If you need to serialize/deserialize custom types, use transport hooks: https://svelte.dev/docs/kit/hooks#Universal-hooks-transport.`:t.path===""?`Data returned from \`load\` while rendering ${e.route.id} is not a plain object`:t.message}function Dt(e){const t={};return e.uses&&e.uses.dependencies.size>0&&(t.dependencies=Array.from(e.uses.dependencies)),e.uses&&e.uses.search_params.size>0&&(t.search_params=Array.from(e.uses.search_params)),e.uses&&e.uses.params.size>0&&(t.params=Array.from(e.uses.params)),e.uses?.parent&&(t.parent=1),e.uses?.route&&(t.route=1),e.uses?.url&&(t.url=1),t}function It(e,t){return e._.prerendered_routes.has(t)||t.at(-1)==="/"&&e._.prerendered_routes.has(t.slice(0,-1))}function Xr(e$1,t,r){const n=`
\x1B[1;31m[${e$1}] ${r.request.method} ${r.url.pathname}\x1B[0m`;return e$1===404?n:`${n}
${e?Yr(t):t.stack}`}let Ht=e=>e;if(e)try{const e=await import('node:path'),t=await import('node:process');Ht=r=>e.relative(t.cwd(),r);}catch{}function Yr(e){const t=(e.stack?.split(`
`)??[]).map(n=>n.replace(/\((.+)(:\d+:\d+)\)$/,(s,a,c)=>`(${Ht(a)}${c})`)),r=t.findLastIndex(n=>/\(src[\\/]/.test(n));return r===-1?e.stack:t.slice(0,r+1).join(`
`)}function Mt(e){const r=e?.split("/")?.at(-1);return r?r.split(".").slice(0,-1).join("."):"unknown"}async function Qr(e,t,r,n){const s=e.request.method;let a=r[s]||r.fallback;if(s==="HEAD"&&!r.HEAD&&r.GET&&(a=r.GET),!a)return Nt(r,s);const c=r.prerender??n.prerender_default;if(c&&(r.POST||r.PATCH||r.PUT||r.DELETE))throw new Error("Cannot prerender endpoints that have mutative methods");if(n.prerendering&&!n.prerendering.inside_reroute&&!c){if(n.depth>0)throw new Error(`${e.route.id} is not prerenderable`);return new Response(void 0,{status:204})}t.is_endpoint_request=true;try{const d=await with_request_store({event:e,state:t},()=>a(e));if(!(d instanceof Response))throw new Error(`Invalid response from route ${e.url.pathname}: handler should return a Response object`);if(n.prerendering&&(!n.prerendering.inside_reroute||c)){const o=new Response(d.clone().body,{status:d.status,statusText:d.statusText,headers:new Headers(d.headers)});if(o.headers.set("x-sveltekit-prerender",String(c)),n.prerendering.inside_reroute&&c)o.headers.set("x-sveltekit-routeid",encodeURI(e.route.id)),n.prerendering.dependencies.set(e.url.pathname,{response:o,body:null});else return o}return d}catch(d){if(d instanceof Redirect)return new Response(void 0,{status:d.status,headers:{location:d.location}});throw d}}function en(e){const{method:t,headers:r}=e.request;if(Ot.includes(t)&&!Lr.includes(t))return  true;if(t==="POST"&&r.get("x-sveltekit-action")==="true")return  false;const n=e.request.headers.get("accept")??"*/*";return Ge(n,["*","text/html"])!=="text/html"}function He(e){return e.filter(t=>t!=null)}const Ke="/__data.json",je=".html__data.json";function tn(e){return e.endsWith(Ke)||e.endsWith(je)}function Xe(e){return e.endsWith(".html")?e.replace(/\.html$/,je):e.replace(/\/$/,"")+Ke}function rn(e){return e.endsWith(je)?e.slice(0,-je.length)+".html":e.slice(0,-Ke.length)}const Ye="/__route.js";function nn(e){return e.endsWith(Ye)}function Wt(e){return e.replace(/\/$/,"")+Ye}function sn(e){return e.slice(0,-Ye.length)}const an={spanContext(){return on},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return  false},recordException(){return this},addLink(){return this},addLinks(){return this}},on={traceId:"",spanId:"",traceFlags:0};async function ne({name:e,attributes:t,fn:r}){return r(an)}function Bt(e){return Ge(e.request.headers.get("accept")??"*/*",["application/json","text/html"])==="application/json"&&e.request.method==="POST"}async function cn(e$1,t,r,n){const s=n?.actions;if(!s){const a=new SvelteKitError(405,"Method Not Allowed",`POST method not allowed. No form actions exist for ${e?`the page at ${e$1.route.id}`:"this page"}`);return pe({type:"error",error:await M(e$1,t,r,a)},{status:a.status,headers:{allow:"GET"}})}Vt(s);try{const a=await Gt(e$1,t,s);return e&&Jt(a),a instanceof ActionFailure?pe({type:"failure",status:a.status,data:ut(a.data,e$1.route.id,r.hooks.transport)}):pe({type:"success",status:a?200:204,data:ut(a,e$1.route.id,r.hooks.transport)})}catch(a){const c=a;return c instanceof Redirect?Ft(c):pe({type:"error",error:await M(e$1,t,r,Qe(c))},{status:ce(c)})}}function Qe(e){return e instanceof ActionFailure?new Error('Cannot "throw fail()". Use "return fail()"'):e}function Ft(e){return pe({type:"redirect",status:e.status,location:e.location})}function pe(e,t){return json(e,t)}function ln(e){return e.request.method==="POST"}async function un(e$1,t,r){const n=r?.actions;if(!n)return e$1.setHeaders({allow:"GET"}),{type:"error",error:new SvelteKitError(405,"Method Not Allowed",`POST method not allowed. No form actions exist for ${e?`the page at ${e$1.route.id}`:"this page"}`)};Vt(n);try{const s=await Gt(e$1,t,n);return e&&Jt(s),s instanceof ActionFailure?{type:"failure",status:s.status,data:s.data}:{type:"success",status:200,data:s}}catch(s){const a=s;return a instanceof Redirect?{type:"redirect",status:a.status,location:a.location}:{type:"error",error:Qe(a)}}}function Vt(e){if(e.default&&Object.keys(e).length>1)throw new Error("When using named actions, the default action cannot be used. See the docs for more info: https://svelte.dev/docs/kit/form-actions#named-actions")}async function Gt(e,t,r){const n=new URL(e.request.url);let s="default";for(const c of n.searchParams)if(c[0].startsWith("/")){if(s=c[0].slice(1),s==="default")throw new Error('Cannot use reserved action name "default"');break}const a=r[s];if(!a)throw new SvelteKitError(404,"Not Found",`No action with name '${s}' found`);if(!Je(e.request))throw new SvelteKitError(415,"Unsupported Media Type",`Form actions expect form-encoded data — received ${e.request.headers.get("content-type")}`);return ne({name:"sveltekit.form_action",attributes:{"http.route":e.route.id||"unknown"},fn:async c=>{const d=merge_tracing(e,c),o=await with_request_store({event:d,state:t},()=>a(d));return o instanceof ActionFailure&&c.setAttributes({"sveltekit.form_action.result.type":"failure","sveltekit.form_action.result.status":o.status}),o}})}function Jt(e){if(e instanceof Redirect)throw new Error("Cannot `return redirect(...)` — use `redirect(...)` instead");if(e instanceof HttpError)throw new Error("Cannot `return error(...)` — use `error(...)` or `return fail(...)` instead")}function dn(e,t,r){const n=s=>{for(const a in r){const c=r[a].encode(s);if(c)return `app.decode('${a}', ${W(c,n)})`}};return Zt(e,s=>W(s,n),t)}function ut(e,t,r){const n=Object.fromEntries(Object.entries(r).map(([s,a])=>[s,a.encode]));return Zt(e,s=>oe(s,n),t)}function Zt(e,t,r){try{return t(e)}catch(n){const s=n;if(e instanceof Response)throw new Error(`Data returned from action inside ${r} is not serializable. Form actions need to return plain objects or fail(). E.g. return { success: true } or return fail(400, { message: "invalid" });`);if("path"in s){let a=`Data returned from action inside ${r} is not serializable: ${s.message}`;throw s.path!==""&&(a+=` (data.${s.path})`),new Error(a)}throw s}}function Kt(){let e=-1,t=-1;const r=[];return {iterate:(n=s=>s)=>({[Symbol.asyncIterator](){return {next:async()=>{const s=r[++t];if(!s)return {value:null,done:true};const a=await s.promise;return {value:n(a),done:false}}}}}),add:n=>{r.push(Tt()),n.then(s=>{r[++e].resolve(s);});}}}function he(e,t,r){let n=1,s=-1;const a=Kt(),c=zt(r);function d(i){return function l(u){if(typeof u?.then=="function"){const m=n++,p=u.then(_=>({data:_})).catch(async _=>({error:await M(e,t,r,_)})).then(async({data:_,error:f})=>{let h;try{h=W(f?[,f]:[_],l);}catch{f=await M(e,t,r,new Error(`Failed to serialize promise while rendering ${e.route.id}`)),_=void 0,h=W([,f],l);}return {index:i,str:`${c}.resolve(${m}, ${h.includes("app.decode")?`(app) => ${h}`:`() => ${h}`})`}});return a.add(p),`${c}.defer(${m})`}else for(const m in r.hooks.transport){const p=r.hooks.transport[m].encode(u);if(p)return `app.decode('${m}', ${W(p,l)})`}}}const o=[];return {set_max_nodes(i){s=i;},add_node(i,l){try{if(!l){o[i]="null";return}const u={type:"data",data:l.data,uses:Dt(l)};l.slash&&(u.slash=l.slash),o[i]=W(u,d(i));}catch(u){throw u.path=u.path.slice(1),new Error(Lt(e,u))}},get_data(i){const l=`<script${i.script_needs_nonce?` nonce="${i.nonce}"`:""}>`,u=`<\/script>
`;return {data:`[${He(s>-1?o.slice(0,s):o).join(",")}]`,chunks:n>1?a.iterate(({index:m,str:p})=>s>-1&&m>=s?"":l+p+u):null}}}}function Xt(e,t,r){let n=1;const s=Kt(),a={...Object.fromEntries(Object.entries(r.hooks.transport).map(([d,o])=>[d,o.encode])),Promise:d=>{if(typeof d?.then!="function")return;const o=n++;let i="data";const l=d.catch(async u=>(i="error",M(e,t,r,u))).then(async u=>{let m;try{m=oe(u,a);}catch{const p=await M(e,t,r,new Error(`Failed to serialize promise while rendering ${e.route.id}`));i="error",m=oe(p,a);}return `{"type":"chunk","id":${o},"${i}":${m}}
`});return s.add(l),o}},c=[];return {add_node(d,o){try{if(!o){c[d]="null";return}if(o.type==="error"||o.type==="skip"){c[d]=JSON.stringify(o);return}c[d]=`{"type":"data","data":${oe(o.data,a)},"uses":${JSON.stringify(Dt(o))}${o.slash?`,"slash":${JSON.stringify(o.slash)}`:""}}`;}catch(i){throw i.path="data"+i.path,new Error(Lt(e,i))}},get_data(){return {data:`{"type":"data","nodes":[${c.join(",")}]}
`,chunks:n>1?s.iterate():null}}}}async function et({event:e$1,event_state:t,state:r,node:n,parent:s}){if(!n?.server)return null;let a=true;const c={dependencies:new Set,params:new Set,parent:false,route:false,url:false,search_params:new Set},d=n.server.load,o=n.server.trailingSlash;if(!d)return {type:"data",data:null,uses:c,slash:o};const i=R$1(e$1.url,()=>{e&&l&&!c.url&&console.warn(`${n.server_id}: Accessing URL properties in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the URL changes`),a&&(c.url=true);},m=>{e&&l&&!c.search_params.has(m)&&console.warn(`${n.server_id}: Accessing URL properties in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the URL changes`),a&&c.search_params.add(m);});r.prerendering&&U$2(i);let l=false;const u=await ne({name:"sveltekit.load",attributes:{"sveltekit.load.node_id":n.server_id||"unknown","sveltekit.load.node_type":Mt(n.server_id),"http.route":e$1.route.id||"unknown"},fn:async m=>{const p=merge_tracing(e$1,m);return await with_request_store({event:p,state:t},()=>d.call(null,{...p,fetch:(f,h)=>{const y=new URL(f instanceof Request?f.url:f,e$1.url);return e&&l&&!c.dependencies.has(y.href)&&console.warn(`${n.server_id}: Calling \`event.fetch(...)\` in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the dependency is invalidated`),e$1.fetch(f,h)},depends:(...f)=>{for(const h of f){const{href:y}=new URL(h,e$1.url);e&&(Oe(n.server_id||"missing route ID",h),l&&!c.dependencies.has(y)&&console.warn(`${n.server_id}: Calling \`depends(...)\` in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the dependency is invalidated`)),c.dependencies.add(y);}},params:new Proxy(e$1.params,{get:(f,h)=>(e&&l&&typeof h=="string"&&!c.params.has(h)&&console.warn(`${n.server_id}: Accessing \`params.${String(h)}\` in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the param changes`),a&&c.params.add(h),f[h])}),parent:async()=>(e&&l&&!c.parent&&console.warn(`${n.server_id}: Calling \`parent(...)\` in a promise handler after \`load(...)\` has returned will not cause the function to re-run when parent data changes`),a&&(c.parent=!0),s()),route:new Proxy(e$1.route,{get:(f,h)=>(e&&l&&typeof h=="string"&&!c.route&&console.warn(`${n.server_id}: Accessing \`route.${String(h)}\` in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the route changes`),a&&(c.route=!0),f[h])}),url:i,untrack(f){a=!1;try{return f()}finally{a=!0;}}}))}});return e&&je$1(u,`in ${n.server_id}`),l=true,{type:"data",data:u??null,uses:c,slash:o}}async function Yt({event:e$1,event_state:t,fetched:r,node:n,parent:s,server_data_promise:a,state:c,resolve_opts:d,csr:o}){const i=await a,l=n?.universal?.load;if(!l)return i?.data??null;const u=await ne({name:"sveltekit.load",attributes:{"sveltekit.load.node_id":n.universal_id||"unknown","sveltekit.load.node_type":Mt(n.universal_id),"http.route":e$1.route.id||"unknown"},fn:async m=>{const p=merge_tracing(e$1,m);return await with_request_store({event:p,state:t},()=>l.call(null,{url:e$1.url,params:e$1.params,data:i?.data??null,route:e$1.route,fetch:fn(e$1,c,r,o,d),setHeaders:e$1.setHeaders,depends:()=>{},parent:s,untrack:_=>_(),tracing:p.tracing}))}});return e&&je$1(u,`in ${n.universal_id}`),u??null}function fn(e,t,r,n,s){const a=async(c$1,d)=>{const o=c$1 instanceof Request&&c$1.body?c$1.clone().body:null,i=c$1 instanceof Request&&[...c$1.headers].length?new Headers(c$1.headers):d?.headers;let l=await e.fetch(c$1,d);const u=new URL(c$1 instanceof Request?c$1.url:c$1,e.url),m=u.origin===e.url.origin;let p;if(m)t.prerendering&&(p={response:l,body:null},t.prerendering.dependencies.set(u.pathname,p));else if(u.protocol==="https:"||u.protocol==="http:")if((c$1 instanceof Request?c$1.mode:d?.mode??"cors")==="no-cors")l=new Response("",{status:l.status,statusText:l.statusText,headers:l.headers});else {const y=l.headers.get("access-control-allow-origin");if(!y||y!==e.url.origin&&y!=="*")throw new Error(`CORS error: ${y?"Incorrect":"No"} 'Access-Control-Allow-Origin' header is present on the requested resource`)}let _;const f=new Proxy(l,{get(h,y,b){async function E(w,$){const g=Number(h.status);if(isNaN(g))throw new Error(`response.status is not a number. value: "${h.status}" type: ${typeof h.status}`);r.push({url:m?u.href.slice(e.url.origin.length):u.href,method:e.request.method,request_body:c$1 instanceof Request&&o?await pn(o):d?.body,request_headers:i,response_body:w,response:h,is_b64:$});}if(y==="body"){if(h.body===null)return null;if(_)return _;const[w,$]=h.body.tee();return (async()=>{let g=new Uint8Array;for await(const v of w){const x=new Uint8Array(g.length+v.length);x.set(g,0),x.set(v,g.length),g=x;}p&&(p.body=new Uint8Array(g)),E(c(g),true);})(),_=$}if(y==="arrayBuffer")return async()=>{const w=await h.arrayBuffer(),$=new Uint8Array(w);return p&&(p.body=$),w instanceof ArrayBuffer&&await E(c($),true),w};async function k(){const w=await h.text();if(w===""&&qr.includes(h.status)){await E(void 0,false);return}return (!w||typeof w=="string")&&await E(w,false),p&&(p.body=w),w}if(y==="text")return k;if(y==="json")return async()=>{const w=await k();return w?JSON.parse(w):void 0};const R=Reflect.get(h,y,h);return R instanceof Function?Object.defineProperties(function(){return Reflect.apply(R,this===b?h:this,arguments)},{name:{value:R.name},length:{value:R.length}}):R}});if(n){const h=l.headers.get;l.headers.get=y=>{const b=y.toLowerCase(),E=h.call(l.headers,b);if(E&&!b.startsWith("x-sveltekit-")&&!s.filterSerializedResponseHeaders(b,E))throw new Error(`Failed to get response header "${b}" — it must be included by the \`filterSerializedResponseHeaders\` option: https://svelte.dev/docs/kit/hooks#Server-hooks-handle (at ${e.route.id})`);return E};}return f};return (c,d)=>{const o=a(c,d);return o.catch(()=>{}),o}}async function pn(e){let t="";const r=e.getReader();for(;;){const{done:n,value:s}=await r.read();if(n)break;t+=f.decode(s);}return t}function Qt(...e){let t=5381;for(const r of e)if(typeof r=="string"){let n=r.length;for(;n;)t=t*33^r.charCodeAt(--n);}else if(ArrayBuffer.isView(r)){const n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);let s=n.length;for(;s;)t=t*33^n[--s];}else throw new TypeError("value must be a string or TypedArray");return (t>>>0).toString(36)}const er={"<":"\\u003C","\u2028":"\\u2028","\u2029":"\\u2029"},hn=new RegExp(`[${Object.keys(er).join("")}]`,"g");function mn(e,t,r=false){const n={};let s=null,a=null,c=false;for(const[l,u]of e.response.headers)t(l,u)&&(n[l]=u),l==="cache-control"?s=u:l==="age"?a=u:l==="vary"&&u.trim()==="*"&&(c=true);const d={status:e.response.status,statusText:e.response.statusText,headers:n,body:e.response_body},o=JSON.stringify(d).replace(hn,l=>er[l]),i=['type="application/json"',"data-sveltekit-fetched",`data-url="${Ze(e.url,true)}"`];if(e.is_b64&&i.push("data-b64"),e.request_headers||e.request_body){const l=[];e.request_headers&&l.push([...new Headers(e.request_headers)].join(",")),e.request_body&&l.push(e.request_body),i.push(`data-hash="${Qt(...l)}"`);}if(!r&&e.method==="GET"&&s&&!c){const l=/s-maxage=(\d+)/g.exec(s)??/max-age=(\d+)/g.exec(s);if(l){const u=+l[1]-+(a??"0");i.push(`data-ttl="${u}"`);}}return `<script ${i.join(" ")}>${o}<\/script>`}const I=JSON.stringify;function dt(e){Me[0]||_n();const t=tr.slice(0),r=yn(e);for(let s=0;s<r.length;s+=16){const a=r.subarray(s,s+16);let c,d,o,i=t[0],l=t[1],u=t[2],m=t[3],p=t[4],_=t[5],f=t[6],h=t[7];for(let y=0;y<64;y++)y<16?c=a[y]:(d=a[y+1&15],o=a[y+14&15],c=a[y&15]=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(o>>>17^o>>>19^o>>>10^o<<15^o<<13)+a[y&15]+a[y+9&15]|0),c=c+h+(p>>>6^p>>>11^p>>>25^p<<26^p<<21^p<<7)+(f^p&(_^f))+Me[y],h=f,f=_,_=p,p=m+c|0,m=u,u=l,l=i,i=c+(l&u^m&(l^u))+(l>>>2^l>>>13^l>>>22^l<<30^l<<19^l<<10)|0;t[0]=t[0]+i|0,t[1]=t[1]+l|0,t[2]=t[2]+u|0,t[3]=t[3]+m|0,t[4]=t[4]+p|0,t[5]=t[5]+_|0,t[6]=t[6]+f|0,t[7]=t[7]+h|0;}const n=new Uint8Array(t.buffer);return rr(n),btoa(String.fromCharCode(...n))}const tr=new Uint32Array(8),Me=new Uint32Array(64);function _n(){function e(r){return (r-Math.floor(r))*4294967296}let t=2;for(let r=0;r<64;t++){let n=true;for(let s=2;s*s<=t;s++)if(t%s===0){n=false;break}n&&(r<8&&(tr[r]=e(t**(1/2))),Me[r]=e(t**(1/3)),r++);}}function rr(e){for(let t=0;t<e.length;t+=4){const r=e[t+0],n=e[t+1],s=e[t+2],a=e[t+3];e[t+0]=a,e[t+1]=s,e[t+2]=n,e[t+3]=r;}}function yn(e){const t=s.encode(e),r=t.length*8,n=512*Math.ceil((r+65)/512),s$1=new Uint8Array(n/8);s$1.set(t),s$1[t.length]=128,rr(s$1);const a=new Uint32Array(s$1.buffer);return a[a.length-2]=Math.floor(r/4294967296),a[a.length-1]=r,a}const ft=new Uint8Array(16);function wn(){return crypto.getRandomValues(ft),btoa(String.fromCharCode(...ft))}const gn=new Set(["self","unsafe-eval","unsafe-hashes","unsafe-inline","none","strict-dynamic","report-sample","wasm-unsafe-eval","script"]),bn=/^(nonce|sha\d\d\d)-/;class nr{#e;#t;#c;#l;#u;#d;#f;#p;#n;#s;#a;#o;#i;#r;#h;constructor(t,r,n){this.#e=t,this.#n=e?{...r}:r;const s=this.#n;this.#s=[],this.#a=[],this.#o=[],this.#i=[],this.#r=[];const a=s["script-src"]||s["default-src"],c=s["script-src-elem"],d=s["style-src"]||s["default-src"],o=s["style-src-attr"],i=s["style-src-elem"];e&&(d&&!d.includes("unsafe-inline")&&(s["style-src"]=[...d.filter(u=>!(u.startsWith("sha256-")||u.startsWith("nonce-"))),"unsafe-inline"]),o&&!o.includes("unsafe-inline")&&(s["style-src-attr"]=[...o.filter(u=>!(u.startsWith("sha256-")||u.startsWith("nonce-"))),"unsafe-inline"]),i&&!i.includes("unsafe-inline")&&(s["style-src-elem"]=[...i.filter(u=>!(u.startsWith("sha256-")||u.startsWith("nonce-"))),"unsafe-inline"]));const l=u=>!!u&&!u.some(m=>m==="unsafe-inline");this.#c=l(a),this.#l=l(c),this.#d=l(d),this.#f=l(o),this.#p=l(i),this.#t=this.#c||this.#l,this.#u=!e&&(this.#d||this.#f||this.#p),this.script_needs_nonce=this.#t&&!this.#e,this.style_needs_nonce=this.#u&&!this.#e,this.#h=n;}add_script(t){if(!this.#t)return;const r=this.#e?`sha256-${dt(t)}`:`nonce-${this.#h}`;this.#c&&this.#s.push(r),this.#l&&this.#a.push(r);}add_style(t){if(!this.#u)return;const r=this.#e?`sha256-${dt(t)}`:`nonce-${this.#h}`;if(this.#d&&this.#o.push(r),this.#f&&this.#i.push(r),this.#p){const n="sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=",s=this.#n;s["style-src-elem"]&&!s["style-src-elem"].includes(n)&&!this.#r.includes(n)&&this.#r.push(n),r!==n&&this.#r.push(r);}}get_header(t=false){const r=[],n={...this.#n};this.#o.length>0&&(n["style-src"]=[...n["style-src"]||n["default-src"]||[],...this.#o]),this.#i.length>0&&(n["style-src-attr"]=[...n["style-src-attr"]||[],...this.#i]),this.#r.length>0&&(n["style-src-elem"]=[...n["style-src-elem"]||[],...this.#r]),this.#s.length>0&&(n["script-src"]=[...n["script-src"]||n["default-src"]||[],...this.#s]),this.#a.length>0&&(n["script-src-elem"]=[...n["script-src-elem"]||[],...this.#a]);for(const s in n){if(t&&(s==="frame-ancestors"||s==="report-uri"||s==="sandbox"))continue;const a=n[s];if(!a)continue;const c=[s];Array.isArray(a)&&a.forEach(d=>{gn.has(d)||bn.test(d)?c.push(`'${d}'`):c.push(d);}),r.push(c.join(" "));}return r.join("; ")}}class $n extends nr{get_meta(){const t=this.get_header(true);if(t)return `<meta http-equiv="content-security-policy" content="${Ze(t,true)}">`}}class vn extends nr{constructor(t,r,n){if(super(t,r,n),Object.values(r).filter(s=>!!s).length>0){const s=r["report-to"]?.length??false,a=r["report-uri"]?.length??false;if(!s&&!a)throw Error("`content-security-policy-report-only` must be specified with either the `report-to` or `report-uri` directives, or both")}}}class kn{nonce=wn();csp_provider;report_only_provider;constructor({mode:t,directives:r,reportOnly:n},{prerender:s}){const a=t==="hash"||t==="auto"&&s;this.csp_provider=new $n(a,r,this.nonce),this.report_only_provider=new vn(a,n,this.nonce);}get script_needs_nonce(){return this.csp_provider.script_needs_nonce||this.report_only_provider.script_needs_nonce}get style_needs_nonce(){return this.csp_provider.style_needs_nonce||this.report_only_provider.style_needs_nonce}add_script(t){this.csp_provider.add_script(t),this.report_only_provider.add_script(t);}add_style(t){this.csp_provider.add_style(t),this.report_only_provider.add_style(t);}}function sr(e,t,r){const n={},s=e.slice(1),a=s.filter(d=>d!==void 0);let c=0;for(let d=0;d<t.length;d+=1){const o=t[d];let i=s[d-c];if(o.chained&&o.rest&&c&&(i=s.slice(d-c,d+1).filter(l=>l).join("/"),c=0),i===void 0){o.rest&&(n[o.name]="");continue}if(!o.matcher||r[o.matcher](i)){n[o.name]=i;const l=t[d+1],u=s[d+1];l&&!l.rest&&l.optional&&u&&o.chained&&(c=0),!l&&!u&&Object.keys(n).length===a.length&&(c=0);continue}if(o.optional&&o.chained){c++;continue}return}if(!c)return n}function ar(e,t,r){const{errors:n,layouts:s,leaf:a}=e,c=[...n,...s.map(d=>d?.[1]),a[1]].filter(d=>typeof d=="number").map(d=>`'${d}': () => ${or(r._.client.nodes?.[d],t)}`).join(`,
		`);return [`{
	id: ${I(e.id)}`,`errors: ${I(e.errors)}`,`layouts: ${I(e.layouts)}`,`leaf: ${I(e.leaf)}`,`nodes: {
		${c}
	}
}`].join(`,
	`)}function or(e,t$1){if(!e)return "Promise.resolve({})";if(e[0]==="/")return `import('${e}')`;if(t!=="")return `import('${t}/${e}')`;let r=l(t$1.pathname,`${e$1}/${e}`);return r[0]!=="."&&(r=`./${r}`),`import('${r}')`}async function En(e,t,r){if(!r._.client.routes)return text("Server-side route resolution disabled",{status:400});let n=null,s={};const a=await r._.matchers();for(const c of r._.client.routes){const d=c.pattern.exec(e);if(!d)continue;const o=sr(d,c.params,a);if(o){n=c,s=O$2(o);break}}return ir(n,s,t,r).response}function ir(e,t,r,n){const s=new Headers({"content-type":"application/javascript; charset=utf-8"});if(e){const a=ar(e,r,n),c=`${xn(e,r,n)}
export const route = ${a}; export const params = ${JSON.stringify(t)};`;return {response:text(c,{headers:s}),body:c}}else return {response:text("",{headers:s}),body:""}}function xn(e,t$1,r){const{errors:n,layouts:s,leaf:a}=e;let c="";for(const d of [...n,...s.map(o=>o?.[1]),a[1]]){if(typeof d!="number")continue;const o=r._.client.css?.[d];for(const i of o??[])c+=`'${t||e$1}/${i}',`;}return c?`${or(r._.client.start,t$1)}.then(x => x.load_css([${c}]));`:""}const An={...readable(false),check:()=>false};async function me({branch:e$2,fetched:t$1,options:r$1,manifest:n,state:s$1,page_config:a,status:c,error:d=null,event:o$1,event_state:i$1,resolve_opts:l,action_result:u,data_serializer:m}){if(s$1.prerendering){if(r$1.csp.mode==="nonce")throw new Error('Cannot use prerendering if config.kit.csp.mode === "nonce"');if(r$1.app_template_contains_nonce)throw new Error("Cannot use prerendering if page template contains %sveltekit.nonce%")}const{client:p}=n._,_=new Set(p.imports),f=new Set(p.stylesheets),h=new Set(p.fonts),y=new Set,b=new Set,E=new Map;let k;const R=u?.type==="success"||u?.type==="failure"?u.data??null:null;let w=e$1,$=t,g=I(e$1);if(s$1.prerendering?.fallback?r$1.hash_routing&&(g="new URL('.', location).pathname.slice(0, -1)"):(w=o$1.url.pathname.slice(e$1.length).split("/").slice(2).map(()=>"..").join("/")||".",g=`new URL(${I(w)}, location).pathname.slice(0, -1)`,(!t||t[0]==="/"&&t!==zr)&&($=w)),a.ssr){const S={stores:{page:writable(null),navigating:writable(null),updated:An},constructors:await Promise.all(e$2.map(({node:P})=>{if(!P.component)throw new Error(`Missing +page.svelte component for route ${o$1.route.id}`);return P.component()})),form:R};let O={};for(let P=0;P<e$2.length;P+=1)O={...O,...e$2[P].data},S[`data_${P}`]=O;S.page={error:d,params:o$1.params,route:o$1.route,status:c,url:o$1.url,data:O,form:R,state:{}};const G={context:new Map([["__request__",{page:S.page}]])},ee=globalThis.fetch;try{if(e){let P=!1;globalThis.fetch=(N,Z)=>{if(typeof N=="string"&&!x$2.test(N))throw new Error(`Cannot call \`fetch\` eagerly during server-side rendering with relative URL (${N}) — put your \`fetch\` calls inside \`onMount\` or a \`load\` function instead`);return !P&&!try_get_request_store()?.state.is_in_remote_function&&(console.warn("Avoid calling `fetch` eagerly during server-side rendering — put your `fetch` calls inside `onMount` or a `load` function instead"),P=!0),ee(N,Z)};}k=await with_request_store({event:o$1,state:i$1},async()=>{r&&o({base:w,assets:$});const P=r$1.root.render(S,G),N=r$1.async&&"then"in P?P.then(C=>C):P;r$1.async&&c$1();const{head:Z,html:we,css:ge}=r$1.async?await N:N;return {head:Z,html:we,css:ge}});}finally{e&&(globalThis.fetch=ee),c$1();}for(const{node:P}of e$2){for(const N of P.imports)_.add(N);for(const N of P.stylesheets)f.add(N);for(const N of P.fonts)h.add(N);P.inline_styles&&!p.inline&&Object.entries(await P.inline_styles()).forEach(([N,Z])=>E.set(N,Z));}}else k={head:"",html:"",css:{code:"",map:null}};let v="",x$1=k.html;const A=new kn(r$1.csp,{prerender:!!s$1.prerendering}),T=S=>S.startsWith("/")?e$1+S:`${$}/${S}`,U=p.inline?p.inline?.style:Array.from(E.values()).join(`
`);if(U){const S=e?[" data-sveltekit"]:[];A.style_needs_nonce&&S.push(` nonce="${A.nonce}"`),A.add_style(U),v+=`
	<style${S.join("")}>${U}</style>`;}for(const S of f){const O=T(S),G=['rel="stylesheet"'];E.has(S)?G.push("disabled",'media="(max-width: 0)"'):l.preload({type:"css",path:O})&&y.add(`<${encodeURI(O)}>; rel="preload"; as="style"; nopush`),v+=`
		<link href="${O}" ${G.join(" ")}>`;}for(const S of h){const O=T(S);if(l.preload({type:"font",path:O})){const G=S.slice(S.lastIndexOf(".")+1);b.add(`<link rel="preload" as="font" type="font/${G}" href="${O}" crossorigin>`),y.add(`<${encodeURI(O)}>; rel="preload"; as="font"; type="font/${G}"; crossorigin; nopush`);}}const F=zt(r$1),{data:V,chunks:J}=m.get_data(A);if(a.ssr&&a.csr&&(x$1+=`
			${t$1.map(S=>mn(S,l.filterSerializedResponseHeaders,!!s$1.prerendering)).join(`
			`)}`),a.csr){const S=n._.client.routes?.find(C=>C.id===o$1.route.id)??null;if(p.uses_env_dynamic_public&&s$1.prerendering&&_.add(`${i}/env.js`),!p.inline){const C=Array.from(_,q=>T(q)).filter(q=>l.preload({type:"js",path:q}));for(const q of C)y.add(`<${encodeURI(q)}>; rel="modulepreload"; nopush`),r$1.preload_strategy!=="modulepreload"?v+=`
		<link rel="preload" as="script" crossorigin="anonymous" href="${q}">`:b.add(`<link rel="modulepreload" href="${q}">`);}if(s$1.prerendering&&b.size>0&&(v+=Array.from(b).map(C=>`
		${C}`).join("")),n._.client.routes&&s$1.prerendering&&!s$1.prerendering.fallback){const C=Wt(o$1.url.pathname);s$1.prerendering.dependencies.set(C,ir(S,o$1.params,new URL(C,o$1.url),n));}const O=[],G=p.uses_env_dynamic_public&&s$1.prerendering,ee=[`base: ${g}`];if(t&&ee.push(`assets: ${I(t)}`),p.uses_env_dynamic_public&&ee.push(`env: ${G?"null":I(x)}`),J){O.push("const deferred = new Map();"),ee.push(`defer: (id) => new Promise((fulfil, reject) => {
							deferred.set(id, { fulfil, reject });
						})`);let C="";Object.keys(r$1.hooks.transport).length>0&&(p.inline?C=`const app = __sveltekit_${r$1.version_hash}.app.app;`:p.app?C=`const app = await import(${I(T(p.app))});`:C=`const { app } = await import(${I(T(p.start))});`);const q=C?`${C}
							const [data, error] = fn(app);`:"const [data, error] = fn();";ee.push(`resolve: async (id, fn) => {
							${q}

							const try_to_resolve = () => {
								if (!deferred.has(id)) {
									setTimeout(try_to_resolve, 0);
									return;
								}
								const { fulfil, reject } = deferred.get(id);
								deferred.delete(id);
								if (error) reject(error);
								else fulfil(data);
							}
							try_to_resolve();
						}`);}O.push(`${F} = {
						${ee.join(`,
						`)}
					};`);const P=["element"];if(O.push("const element = document.currentScript.parentElement;"),a.ssr){const C={form:"null",error:"null"};R&&(C.form=dn(R,o$1.route.id,r$1.hooks.transport)),d&&(C.error=W(d));const q=[`node_ids: [${e$2.map(({node:Q})=>Q.index).join(", ")}]`,`data: ${V}`,`form: ${C.form}`,`error: ${C.error}`];if(c!==200&&q.push(`status: ${c}`),n._.client.routes){if(S){const Q=ar(S,o$1.url,n).replaceAll(`
`,`
							`);q.push(`params: ${W(o$1.params)}`,`server_route: ${Q}`);}}else r$1.embedded&&q.push(`params: ${W(o$1.params)}`,`route: ${I(o$1.route)}`);const te="	".repeat(G?7:6);P.push(`{
${te}	${q.join(`,
${te}	`)}
${te}}`);}const{remote_data:N}=i$1;let Z="";if(N){const C={};for(const[te,Q]of N)if(te.id)for(const ue in Q)C[Te(te.id,ue)]=await Q[ue];const q=te=>{for(const Q in r$1.hooks.transport){const ue=r$1.hooks.transport[Q].encode(te);if(ue)return `app.decode('${Q}', ${W(ue,q)})`}};Z=`${F}.data = ${W(C,q)};

						`;}const we=p.inline?`${p.inline.script}

					${Z}${F}.app.start(${P.join(", ")});`:p.app?`Promise.all([
						import(${I(T(p.start))}),
						import(${I(T(p.app))})
					]).then(([kit, app]) => {
						${Z}kit.start(app, ${P.join(", ")});
					});`:`import(${I(T(p.start))}).then((app) => {
						${Z}app.start(${P.join(", ")})
					});`;if(G?O.push(`import(${I(`${w}/${i}/env.js`)}).then(({ env }) => {
						${F}.env = env;

						${we.replace(/\n/g,`
	`)}
					});`):O.push(we),r$1.service_worker){let C=e?", { type: 'module' }":"";if(r$1.service_worker_options!=null){const q={...r$1.service_worker_options};e&&(q.type="module"),C=`, ${I(q)}`;}O.push(`if ('serviceWorker' in navigator) {
						addEventListener('load', function () {
							navigator.serviceWorker.register('${T("service-worker.js")}'${C});
						});
					}`);}const ge=`
				{
					${O.join(`

					`)}
				}
			`;A.add_script(ge),x$1+=`
			<script${A.script_needs_nonce?` nonce="${A.nonce}"`:""}>${ge}<\/script>
		`;}const Y=new Headers({"x-sveltekit-page":"true","content-type":"text/html"});if(s$1.prerendering){const S=[],O=A.csp_provider.get_meta();O&&S.push(O),s$1.prerendering.cache&&S.push(`<meta http-equiv="cache-control" content="${s$1.prerendering.cache}">`),S.length>0&&(v=S.join(`
`)+v);}else {const S=A.csp_provider.get_header();S&&Y.set("content-security-policy",S);const O=A.report_only_provider.get_header();O&&Y.set("content-security-policy-report-only",O),y.size&&Y.set("link",Array.from(y).join(", "));}v+=k.head;const _e=r$1.templates.app({head:v,body:x$1,assets:$,nonce:A.nonce,env:x}),ye=await l.transformPageChunk({html:_e,done:true})||"";return J||Y.set("etag",`"${Qt(ye)}"`),e&&(a.csr?ye.split("<!--").length<_e.split("<!--").length&&console.warn("\x1B[1m\x1B[31mRemoving comments in transformPageChunk can break Svelte's hydration\x1B[39m\x1B[22m"):J&&console.warn("\x1B[1m\x1B[31mReturning promises from server `load` functions will only work if `csr === true`\x1B[39m\x1B[22m")),J?new Response(new ReadableStream({async start(S){S.enqueue(s.encode(ye+`
`));for await(const O of J)O.length&&S.enqueue(s.encode(O));S.close();},type:"bytes"}),{headers:Y}):text(ye,{status:c,headers:Y})}class tt{data;constructor(t){this.data=t;}layouts(){return this.data.slice(0,-1)}page(){return this.data.at(-1)}validate(){for(const r of this.layouts())r&&(T$1(r.server,r.server_id),C$2(r.universal,r.universal_id));const t=this.page();t&&(I$2(t.server,t.server_id),L(t.universal,t.universal_id));}#e(t){return this.data.reduce((r,n)=>n?.universal?.[t]??n?.server?.[t]??r,void 0)}csr(){return this.#e("csr")??true}ssr(){return this.#e("ssr")??true}prerender(){return this.#e("prerender")??false}trailing_slash(){return this.#e("trailingSlash")??"never"}get_config(){let t={};for(const r of this.data)!r?.universal?.config&&!r?.server?.config||(t={...t,...r?.universal?.config,...r?.server?.config});return Object.keys(t).length?t:void 0}should_prerender_data(){return this.data.some(t=>t?.server?.load||t?.server?.trailingSlash!==void 0)}}async function cr({event:e,event_state:t,options:r,manifest:n,state:s,status:a,error:c,resolve_opts:d}){if(e.request.headers.get("x-sveltekit-error"))return Ae(r,a,c.message);const o=[];try{const i=[],l=await n._.nodes[0](),u=new tt([l]),m=u.ssr(),p=u.csr(),_=he(e,t,r);if(m){s.error=!0;const f=et({event:e,event_state:t,state:s,node:l,parent:async()=>({})}),h=await f;_.add_node(0,h);const y=await Yt({event:e,event_state:t,fetched:o,node:l,parent:async()=>({}),resolve_opts:d,server_data_promise:f,state:s,csr:p});i.push({node:l,server_data:h,data:y},{node:await n._.nodes[1](),data:null,server_data:null});}return await me({options:r,manifest:n,state:s,page_config:{ssr:m,csr:p},status:a,error:await M(e,t,r,c),branch:i,fetched:o,event:e,event_state:t,resolve_opts:d,data_serializer:_})}catch(i){return i instanceof Redirect?Se(i.status,i.location):Ae(r,ce(i),(await M(e,t,r,i)).message)}}async function Sn(e,t,r,n,s){return ne({name:"sveltekit.remote.call",attributes:{},fn:a=>{const c=merge_tracing(e,a);return with_request_store({event:c,state:t},()=>jn(c,t,r,n,s))}})}async function jn(e,t,r,n,s){const[a,c,d]=s.split("/"),o=n._.remotes;o[a]||error(404);const l=(await o[a]()).default[c];l||error(404);const u=l.__,m=r.hooks.transport;e.tracing.current.setAttributes({"sveltekit.remote.call.type":u.type,"sveltekit.remote.call.name":u.name});let p;try{if(u.type==="query_batch"){if(e.request.method!=="POST")throw new SvelteKitError(405,"Method Not Allowed",`\`query.batch\` functions must be invoked via POST request, not ${e.request.method}`);const{payloads:y}=await e.request.json(),b=y.map(R=>Se$1(R,m)),E=await with_request_store({event:e,state:t},()=>u.run(b)),k=await Promise.all(b.map(async(R,w)=>{try{return {type:"result",data:E(R,w)}}catch($){return {type:"error",error:await M(e,t,r,$),status:$ instanceof HttpError||$ instanceof SvelteKitError?$.status:500}}}));return json({type:"result",result:de(k,m)})}if(u.type==="form"){if(e.request.method!=="POST")throw new SvelteKitError(405,"Method Not Allowed",`\`form\` functions must be invoked via POST request, not ${e.request.method}`);if(!Je(e.request))throw new SvelteKitError(415,"Unsupported Media Type",`\`form\` functions expect form-encoded data — received ${e.request.headers.get("content-type")}`);const{data:y,meta:b,form_data:E}=await _e(e.request);d&&!("id"in y)&&(y.id=JSON.parse(decodeURIComponent(d)));const k=u.fn,R=await with_request_store({event:e,state:t},()=>k(y,b,E));return json({type:"result",result:de(R,m),refreshes:R.issues?void 0:await _(b.remote_refreshes)})}if(u.type==="command"){const{payload:y,refreshes:b}=await e.request.json(),E=Se$1(y,m),k=await with_request_store({event:e,state:t},()=>l(E));return json({type:"result",result:de(k,m),refreshes:await _(b)})}const f=u.type==="prerender"?d:new URL(e.request.url).searchParams.get("payload"),h=await with_request_store({event:e,state:t},()=>l(Se$1(f,m)));return json({type:"result",result:de(h,m)})}catch(f){if(f instanceof Redirect)return json({type:"redirect",location:f.location,refreshes:await _(p)});const h=f instanceof HttpError||f instanceof SvelteKitError?f.status:500;return json({type:"error",error:await M(e,t,r,f),status:h},{status:t.prerendering?h:void 0,headers:{"cache-control":"private, no-store"}})}async function _(f){const h=t.refreshes??{};if(f)for(const y of f){if(h[y]!==void 0)continue;const[b,E,k]=y.split("/"),R=n._.remotes[b],w=(await R?.())?.default?.[E];w||error(400,"Bad Request"),h[y]=with_request_store({event:e,state:t},()=>w(Se$1(k,m)));}if(Object.keys(h).length!==0)return de(Object.fromEntries(await Promise.all(Object.entries(h).map(async([y,b])=>[y,await b]))),m)}}async function Rn(e,t,r,n){return ne({name:"sveltekit.remote.form.post",attributes:{},fn:s=>{const a=merge_tracing(e,s);return with_request_store({event:a,state:t},()=>Tn(a,t,r,n))}})}async function Tn(e$1,t,r,n){const[s,a,c]=n.split("/");let i=(await r._.remotes[s]?.())?.default[a];if(!i)return e$1.setHeaders({allow:"GET"}),{type:"error",error:new SvelteKitError(405,"Method Not Allowed",`POST method not allowed. No form actions exist for ${e?`the page at ${e$1.route.id}`:"this page"}`)};c&&(i=with_request_store({event:e$1,state:t},()=>i.for(JSON.parse(c))));try{const l=i.__.fn,{data:u,meta:m,form_data:p}=await _e(e$1.request);return c&&!("id"in u)&&(u.id=JSON.parse(decodeURIComponent(c))),await with_request_store({event:e$1,state:t},()=>l(u,m,p)),{type:"success",status:200}}catch(l){const u=l;return u instanceof Redirect?{type:"redirect",status:u.status,location:u.location}:{type:"error",error:Qe(u)}}}function On(e){return e.pathname.startsWith(`${e$1}/${i}/remote/`)&&e.pathname.replace(`${e$1}/${i}/remote/`,"")}function Cn(e){return e.searchParams.get("/remote")}const Pn=10;async function Un(e$1,t,r,n,s,a,c,d){if(a.depth>Pn)return text(`Not found: ${e$1.url.pathname}`,{status:404});if(Bt(e$1)){const o=await s._.nodes[r.leaf]();return cn(e$1,t,n,o?.server)}try{const o=c.page();let i=200,l;if(ln(e$1)){const $=Cn(e$1.url);if($?l=await Rn(e$1,t,s,$):l=await un(e$1,t,o.server),l?.type==="redirect")return Se(l.status,l.location);l?.type==="error"&&(i=ce(l.error)),l?.type==="failure"&&(i=l.status);}const u=c.prerender();if(u){if(o.server?.actions)throw new Error("Cannot prerender pages with actions")}else if(a.prerendering)return new Response(void 0,{status:204});a.prerender_default=u;const m=c.should_prerender_data(),p=Xe(e$1.url.pathname),_=[],f=c.ssr(),h=c.csr();if(f===!1&&!(a.prerendering&&m))return e&&l&&!e$1.request.headers.has("x-sveltekit-action")&&(l.type==="error"?console.warn("The form action returned an error, but +error.svelte wasn't rendered because SSR is off. To get the error page with CSR, enhance your form with `use:enhance`. See https://svelte.dev/docs/kit/form-actions#progressive-enhancement-use-enhance"):l.data&&console.warn("The form action returned a value, but it isn't available in `page.form`, because SSR is off. To handle the returned value in CSR, enhance your form with `use:enhance`. See https://svelte.dev/docs/kit/form-actions#progressive-enhancement-use-enhance")),await me({branch:[],fetched:_,page_config:{ssr:!1,csr:h},status:i,error:null,event:e$1,event_state:t,options:n,manifest:s,state:a,resolve_opts:d,data_serializer:he(e$1,t,n)});const y=[];let b=null;const E=he(e$1,t,n),k=a.prerendering&&m?Xt(e$1,t,n):null,R=c.data.map(($,g)=>{if(b)throw b;return Promise.resolve().then(async()=>{try{if($===o&&l?.type==="error")throw l.error;const v=await et({event:e$1,event_state:t,state:a,node:$,parent:async()=>{const x={};for(let A=0;A<g;A+=1){const T=await R[A];T&&Object.assign(x,T.data);}return x}});return $&&E.add_node(g,v),k?.add_node(g,v),v}catch(v){throw b=v,b}})}),w=c.data.map(($,g)=>{if(b)throw b;return Promise.resolve().then(async()=>{try{return await Yt({event:e$1,event_state:t,fetched:_,node:$,parent:async()=>{const v={};for(let x=0;x<g;x+=1)Object.assign(v,await w[x]);return v},resolve_opts:d,server_data_promise:R[g],state:a,csr:h})}catch(v){throw b=v,b}})});for(const $ of R)$.catch(()=>{});for(const $ of w)$.catch(()=>{});for(let $=0;$<c.data.length;$+=1){const g=c.data[$];if(g)try{const v=await R[$],x=await w[$];y.push({node:g,server_data:v,data:x});}catch(v){const x=v;if(x instanceof Redirect){if(a.prerendering&&m){const U=JSON.stringify({type:"redirect",location:x.location});a.prerendering.dependencies.set(p,{response:text(U),body:U});}return Se(x.status,x.location)}const A=ce(x),T=await M(e$1,t,n,x);for(;$--;)if(r.errors[$]){const U=r.errors[$],F=await s._.nodes[U]();let V=$;for(;!y[V];)V-=1;E.set_max_nodes(V+1);const J=He(y.slice(0,V+1)),Y=new tt(J.map(_e=>_e.node));return await me({event:e$1,event_state:t,options:n,manifest:s,state:a,resolve_opts:d,page_config:{ssr:Y.ssr(),csr:Y.csr()},status:A,error:T,branch:J.concat({node:F,data:null,server_data:null}),fetched:_,data_serializer:E})}return Ae(n,A,T.message)}else y.push(null);}if(a.prerendering&&k){let{data:$,chunks:g}=k.get_data();if(g)for await(const v of g)$+=v;a.prerendering.dependencies.set(p,{response:text($),body:$});}return await me({event:e$1,event_state:t,options:n,manifest:s,state:a,resolve_opts:d,page_config:{csr:h,ssr:f},status:i,error:null,branch:f===!1?[]:He(y),action_result:l,fetched:_,data_serializer:f===!1?he(e$1,t,n):E})}catch(o){return await cr({event:e$1,event_state:t,options:n,manifest:s,state:a,status:500,error:o,resolve_opts:d})}}function qn(e){let t=false,r;return ()=>t?r:(t=true,r=e())}async function Nn(e,t,r,n,s$1,a,c,d){if(!r.page)return new Response(void 0,{status:404});try{const o=[...r.page.layouts,r.page.leaf],i=c??o.map(()=>!0);let l=!1;const u=new URL(e.url);u.pathname=E$1(u.pathname,d);const m={...e,url:u},p=o.map((k,R)=>qn(async()=>{try{if(l)return {type:"skip"};const w=k==null?k:await s$1._.nodes[k]();return et({event:m,event_state:t,state:a,node:w,parent:async()=>{const $={};for(let g=0;g<R;g+=1){const v=await p[g]();v&&Object.assign($,v.data);}return $}})}catch(w){throw l=!0,w}})),_=p.map(async(k,R)=>i[R]?k():{type:"skip"});let f=_.length;const h=await Promise.all(_.map((k,R)=>k.catch(async w=>{if(w instanceof Redirect)throw w;return f=Math.min(f,R+1),{type:"error",error:await M(e,t,n,w),status:w instanceof HttpError||w instanceof SvelteKitError?w.status:void 0}}))),y=Xt(e,t,n);for(let k=0;k<h.length;k++)y.add_node(k,h[k]);const{data:b,chunks:E}=y.get_data();return E?new Response(new ReadableStream({async start(k){k.enqueue(s.encode(b));for await(const R of E)k.enqueue(s.encode(R));k.close();},type:"bytes"}),{headers:{"content-type":"text/sveltekit-data","cache-control":"private, no-store"}}):We(b)}catch(o){const i=o;return i instanceof Redirect?Be(i):We(await M(e,t,n,i),500)}}function We(e,t=200){return text(typeof e=="string"?e:JSON.stringify(e),{status:t,headers:{"content-type":"application/json","cache-control":"private, no-store"}})}function Be(e){return We({type:"redirect",location:e.location})}var ve={};var pt;function zn(){if(pt)return ve;pt=1,ve.parse=r,ve.serialize=n;var e=Object.prototype.toString,t=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function r(o,i){if(typeof o!="string")throw new TypeError("argument str must be a string");for(var l={},u=i||{},m=u.decode||s,p=0;p<o.length;){var _=o.indexOf("=",p);if(_===-1)break;var f=o.indexOf(";",p);if(f===-1)f=o.length;else if(f<_){p=o.lastIndexOf(";",_-1)+1;continue}var h=o.slice(p,_).trim();if(l[h]===void 0){var y=o.slice(_+1,f).trim();y.charCodeAt(0)===34&&(y=y.slice(1,-1)),l[h]=d(y,m);}p=f+1;}return l}function n(o,i,l){var u=l||{},m=u.encode||a;if(typeof m!="function")throw new TypeError("option encode is invalid");if(!t.test(o))throw new TypeError("argument name is invalid");var p=m(i);if(p&&!t.test(p))throw new TypeError("argument val is invalid");var _=o+"="+p;if(u.maxAge!=null){var f=u.maxAge-0;if(isNaN(f)||!isFinite(f))throw new TypeError("option maxAge is invalid");_+="; Max-Age="+Math.floor(f);}if(u.domain){if(!t.test(u.domain))throw new TypeError("option domain is invalid");_+="; Domain="+u.domain;}if(u.path){if(!t.test(u.path))throw new TypeError("option path is invalid");_+="; Path="+u.path;}if(u.expires){var h=u.expires;if(!c(h)||isNaN(h.valueOf()))throw new TypeError("option expires is invalid");_+="; Expires="+h.toUTCString();}if(u.httpOnly&&(_+="; HttpOnly"),u.secure&&(_+="; Secure"),u.partitioned&&(_+="; Partitioned"),u.priority){var y=typeof u.priority=="string"?u.priority.toLowerCase():u.priority;switch(y){case "low":_+="; Priority=Low";break;case "medium":_+="; Priority=Medium";break;case "high":_+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(u.sameSite){var b=typeof u.sameSite=="string"?u.sameSite.toLowerCase():u.sameSite;switch(b){case  true:_+="; SameSite=Strict";break;case "lax":_+="; SameSite=Lax";break;case "strict":_+="; SameSite=Strict";break;case "none":_+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return _}function s(o){return o.indexOf("%")!==-1?decodeURIComponent(o):o}function a(o){return encodeURIComponent(o)}function c(o){return e.call(o)==="[object Date]"||o instanceof Date}function d(o,i){try{return i(o)}catch{return o}}return ve}var re=zn();const Ln=/[\x00-\x1F\x7F()<>@,;:"/[\]?={} \t]/,ke={},Dn=4129;function Ne(e){if(e?.path===void 0)throw new Error("You must specify a `path` when setting, deleting or serializing cookies")}function In(e,t,r){return `${e||""}${t}?${encodeURIComponent(r)}`}function Hn(e$1,t){const r=e$1.headers.get("cookie")??"",n=re.parse(r,{decode:m=>m});let s$1;const a=new Map,c={httpOnly:true,sameSite:"lax",secure:!(t.hostname==="localhost"&&t.protocol==="http:")},d={get(m,p){const _=Array.from(a.values()).filter(y=>y.name===m&&ze(t.hostname,y.options.domain)&&Ee(t.pathname,y.options.path)).sort((y,b)=>b.options.path.length-y.options.path.length)[0];if(_)return _.options.maxAge===0?void 0:_.value;const h=re.parse(r,{decode:p?.decode})[m];if(e&&!h){const y=Array.from(ke[m]??[]).filter(b=>Ee(b,t.pathname)&&b!==t.pathname);y.length>0&&console.warn(`'${m}' cookie does not exist for ${t.pathname}, but was previously set at ${Mn([...y])}. Did you mean to set its 'path' to '/' instead?`);}return h},getAll(m){const p=re.parse(r,{decode:m?.decode}),_=new Map;for(const f of a.values())if(ze(t.hostname,f.options.domain)&&Ee(t.pathname,f.options.path)){const h=_.get(f.name);(!h||f.options.path.length>h.options.path.length)&&_.set(f.name,f);}for(const f of _.values())p[f.name]=f.value;return Object.entries(p).map(([f,h])=>({name:f,value:h}))},set(m,p,_){const f=m.match(Ln);f&&console.warn(`The cookie name "${m}" will be invalid in SvelteKit 3.0 as it contains ${f.join(" and ")}. See RFC 2616 for more details https://datatracker.ietf.org/doc/html/rfc2616#section-2.2`),Ne(_),l(m,p,{...c,..._});},delete(m,p){Ne(p),d.set(m,"",{...p,maxAge:0});},serialize(m,p,_){Ne(_);let f=_.path;if(!_.domain||_.domain===t.hostname){if(!s$1)throw new Error("Cannot serialize cookies until after the route is determined");f=y(s$1,f);}return re.serialize(m,p,{...c,..._,path:f})}};function o(m,p){const _={...n};for(const f of a.values()){if(!ze(m.hostname,f.options.domain)||!Ee(m.pathname,f.options.path))continue;const h=f.options.encode||encodeURIComponent;_[f.name]=h(f.value);}if(p){const f=re.parse(p,{decode:h=>h});for(const h in f)_[h]=f[h];}return Object.entries(_).map(([f,h])=>`${f}=${h}`).join("; ")}const i=[];function l(m,p,_){if(!s$1){i.push(()=>l(m,p,_));return}let f=_.path;(!_.domain||_.domain===t.hostname)&&(f=y(s$1,f));const h=In(_.domain,f,m),y$1={name:m,value:p,options:{..._,path:f}};if(a.set(h,y$1),e){const b=re.serialize(m,p,y$1.options);if(s.encode(b).byteLength>Dn)throw new Error(`Cookie "${m}" is too large, and will be discarded by the browser`);ke[m]??=new Set,p?ke[m].add(f):ke[m].delete(f);}}function u(m){s$1=E$1(t.pathname,m),i.forEach(p=>p());}return {cookies:d,new_cookies:a,get_cookie_header:o,set_internal:l,set_trailing_slash:u}}function ze(e,t){if(!t)return  true;const r=t[0]==="."?t.slice(1):t;return e===r?true:e.endsWith("."+r)}function Ee(e,t){if(!t)return  true;const r=t.endsWith("/")?t.slice(0,-1):t;return e===r?true:e.startsWith(r+"/")}function ht(e,t){for(const r of t){const{name:n,value:s,options:a}=r;if(e.append("set-cookie",re.serialize(n,s,a)),a.path.endsWith(".html")){const c=Xe(a.path);e.append("set-cookie",re.serialize(n,s,{...a,path:c}));}}}function Mn(e){return e.length<=2?e.join(" and "):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`}var ae={exports:{}},mt;function Wn(){if(mt)return ae.exports;mt=1;var e={decodeValues:true,map:false,silent:false};function t(o){return typeof o!="string"||o in{}}function r(){return Object.create(null)}function n(o){return typeof o=="string"&&!!o.trim()}function s(o,i){var l=o.split(";").filter(n),u=l.shift(),m=a(u),p=m.name,_=m.value;if(i=i?Object.assign({},e,i):e,t(p))return null;try{_=i.decodeValues?decodeURIComponent(_):_;}catch(h){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",h);}var f=r();return f.name=p,f.value=_,l.forEach(function(h){var y=h.split("="),b=y.shift().trimLeft().toLowerCase();if(!t(b)){var E=y.join("=");if(b==="expires")f.expires=new Date(E);else if(b==="max-age"){var k=parseInt(E,10);Number.isNaN(k)||(f.maxAge=k);}else b==="secure"?f.secure=true:b==="httponly"?f.httpOnly=true:b==="samesite"?f.sameSite=E:b==="partitioned"?f.partitioned=true:b&&(f[b]=E);}}),f}function a(o){var i="",l="",u=o.split("=");return u.length>1?(i=u.shift(),l=u.join("=")):l=o,{name:i,value:l}}function c(o,i){if(i=i?Object.assign({},e,i):e,!o)return i.map?r():[];if(o.headers)if(typeof o.headers.getSetCookie=="function")o=o.headers.getSetCookie();else if(o.headers["set-cookie"])o=o.headers["set-cookie"];else {var l=o.headers[Object.keys(o.headers).find(function(m){return m.toLowerCase()==="set-cookie"})];!l&&o.headers.cookie&&!i.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),o=l;}if(Array.isArray(o)||(o=[o]),i.map){var u=r();return o.filter(n).reduce(function(m,p){var _=s(p,i);return _&&!t(_.name)&&(m[_.name]=_),m},u)}else return o.filter(n).map(function(m){return s(m,i)}).filter(Boolean)}function d(o){if(Array.isArray(o))return o;if(typeof o!="string")return [];var i=[],l=0,u,m,p,_,f;function h(){for(;l<o.length&&/\s/.test(o.charAt(l));)l+=1;return l<o.length}function y(){return m=o.charAt(l),m!=="="&&m!==";"&&m!==","}for(;l<o.length;){for(u=l,f=false;h();)if(m=o.charAt(l),m===","){for(p=l,l+=1,h(),_=l;l<o.length&&y();)l+=1;l<o.length&&o.charAt(l)==="="?(f=true,l=_,i.push(o.substring(u,p)),u=l):l=p+1;}else l+=1;(!f||l>=o.length)&&i.push(o.substring(u,o.length));}return i}return ae.exports=c,ae.exports.parse=c,ae.exports.parseString=s,ae.exports.splitCookiesString=d,ae.exports}var _t=Wn();function Bn({event:e,options:t$1,manifest:r,state:n,get_cookie_header:s,set_internal:a}){const c=async(d,o)=>{const i=yt(d,o,e.url);let l=(d instanceof Request?d.mode:o?.mode)??"cors",u=(d instanceof Request?d.credentials:o?.credentials)??"same-origin";return t$1.hooks.handleFetch({event:e,request:i,fetch:async(m,p)=>{const _=yt(m,p,e.url),f=new URL(_.url);if(_.headers.has("origin")||_.headers.set("origin",e.url.origin),m!==i&&(l=(m instanceof Request?m.mode:p?.mode)??"cors",u=(m instanceof Request?m.credentials:p?.credentials)??"same-origin"),(_.method==="GET"||_.method==="HEAD")&&(l==="no-cors"&&f.origin!==e.url.origin||f.origin===e.url.origin)&&_.headers.delete("origin"),f.origin!==e.url.origin){if(`.${f.hostname}`.endsWith(`.${e.url.hostname}`)&&u!=="omit"){const g=s(f,_.headers.get("cookie"));g&&_.headers.set("cookie",g);}return fetch(_)}const h=t||e$1,y=decodeURIComponent(f.pathname),b=(y.startsWith(h)?y.slice(h.length):y).slice(1),E=`${b}/index.html`,k$1=r.assets.has(b)||b in r._.server_assets,R=r.assets.has(E)||E in r._.server_assets;if(k$1||R){const g=k$1?b:E;if(n.read){const v=k$1?r.mimeTypes[b.slice(b.lastIndexOf("."))]:"text/html";return new Response(n.read(g),{headers:v?{"content-type":v}:{}})}else if(k&&g in r._.server_assets){const v=r._.server_assets[g],x=r.mimeTypes[g.slice(g.lastIndexOf("."))];return new Response(k(g),{headers:{"Content-Length":""+v,"Content-Type":x}})}return await fetch(_)}if(It(r,e$1+y))return await fetch(_);if(u!=="omit"){const g=s(f,_.headers.get("cookie"));g&&_.headers.set("cookie",g);const v=e.request.headers.get("authorization");v&&!_.headers.has("authorization")&&_.headers.set("authorization",v);}_.headers.has("accept")||_.headers.set("accept","*/*"),_.headers.has("accept-language")||_.headers.set("accept-language",e.request.headers.get("accept-language"));const w=await Fn(_,t$1,r,n),$=w.headers.get("set-cookie");if($)for(const g of _t.splitCookiesString($)){const{name:v,value:x,...A}=_t.parseString(g,{decodeValues:false}),T=A.path??(f.pathname.split("/").slice(0,-1).join("/")||"/");a(v,x,{path:T,encode:U=>U,...A});}return w}})};return (d,o)=>{const i=c(d,o);return i.catch(()=>{}),i}}function yt(e,t,r){return e instanceof Request?e:new Request(typeof e=="string"?new URL(e,r):e,t)}async function Fn(e,t,r,n){if(e.signal){if(e.signal.aborted)throw new DOMException("The operation was aborted.","AbortError");let s=()=>{};const a=new Promise((d,o)=>{const i=()=>{o(new DOMException("The operation was aborted.","AbortError"));};e.signal.addEventListener("abort",i,{once:true}),s=()=>e.signal.removeEventListener("abort",i);}),c=await Promise.race([Fe(e,t,r,{...n,depth:n.depth+1}),a]);return s(),c}else return await Fe(e,t,r,{...n,depth:n.depth+1})}let wt,Le,De;function Vn(e){return wt??=`export const env=${JSON.stringify(x)}`,Le??=`W/${Date.now()}`,De??=new Headers({"content-type":"application/javascript; charset=utf-8",etag:Le}),e.headers.get("if-none-match")===Le?new Response(void 0,{status:304,headers:De}):new Response(wt,{headers:De})}const gt=new Set(["max-age","public","private","no-cache","no-store","must-revalidate","proxy-revalidate","s-maxage","immutable","stale-while-revalidate","stale-if-error","no-transform","only-if-cached","max-stale","min-fresh"]),Gn=/^(application|audio|example|font|haptics|image|message|model|multipart|text|video|x-[a-z]+)\/[-+.\w]+$/i,Jn={"cache-control":e=>{const t=`(While parsing "${e}".)`,r=e.split(",").map(a=>a.trim());if(r.some(a=>!a))throw new Error(`\`cache-control\` header contains empty directives. ${t}`);const s=r.map(a=>a.split("=")[0].toLowerCase()).find(a=>!gt.has(a));if(s)throw new Error(`Invalid cache-control directive "${s}". Did you mean one of: ${[...gt].join(", ")}? ${t}`)},"content-type":e=>{const t=e.split(";")[0].trim(),r=`(While parsing "${e}".)`;if(!Gn.test(t))throw new Error(`Invalid content-type value "${t}". ${r}`)}};function Zn(e){for(const[t,r]of Object.entries(e)){const n=Jn[t.toLowerCase()];try{n?.(r);}catch(s){s instanceof Error&&console.warn(`[SvelteKit] ${s.message}`);}}}const bt=({html:e})=>e,$t=()=>false,vt=({type:e})=>e==="js"||e==="css",Kn=new Set(["GET","HEAD","POST"]),Xn=new Set(["GET","HEAD","OPTIONS"]);let kt=false;const Fe=es(Yn);async function Yn(e$2,t,r,n){const s=new URL(e$2.url),a=nn(s.pathname),c=tn(s.pathname),d=On(s);if(!e){const w=e$2.headers.get("origin");if(d){if(e$2.method!=="GET"&&w!==s.origin)return json({message:"Cross-site remote requests are forbidden"},{status:403})}else if(t.csrf_check_origin&&Je(e$2)&&(e$2.method==="POST"||e$2.method==="PUT"||e$2.method==="PATCH"||e$2.method==="DELETE")&&w!==s.origin&&(!w||!t.csrf_trusted_origins.includes(w))){const g=`Cross-site ${e$2.method} form submissions are forbidden`,v={status:403};return e$2.headers.get("accept")==="application/json"?json({message:g},v):text(g,v)}}if(t.hash_routing&&s.pathname!==e$1+"/"&&s.pathname!=="/[fallback]")return text("Not found",{status:404});let o;a?s.pathname=sn(s.pathname):c?(s.pathname=rn(s.pathname)+(s.searchParams.get(ve$1)==="1"?"/":"")||"/",s.searchParams.delete(ve$1),o=s.searchParams.get(Ie)?.split("").map(w=>w==="1"),s.searchParams.delete(Ie)):d&&(s.pathname=e$2.headers.get("x-sveltekit-pathname")??e$1,s.search=e$2.headers.get("x-sveltekit-search")??"");const i$1={},{cookies:l,new_cookies:u,get_cookie_header:m,set_internal:p,set_trailing_slash:_}=Hn(e$2,s),f={prerendering:n.prerendering,transport:t.hooks.transport,handleValidationError:t.hooks.handleValidationError,tracing:{record_span:ne},is_in_remote_function:false},h={cookies:l,fetch:null,getClientAddress:n.getClientAddress||(()=>{throw new Error("@sveltejs/adapter-node does not specify getClientAddress. Please raise an issue")}),locals:{},params:{},platform:n.platform,request:e$2,route:{id:null},setHeaders:w=>{e&&Zn(w);for(const $ in w){const g=$.toLowerCase(),v=w[$];if(g==="set-cookie")throw new Error("Use `event.cookies.set(name, value, options)` instead of `event.setHeaders` to set cookies");if(g in i$1)if(g==="server-timing")i$1[g]+=", "+v;else throw new Error(`"${$}" header is already set`);else i$1[g]=v,n.prerendering&&g==="cache-control"&&(n.prerendering.cache=v);}},url:s,isDataRequest:c,isSubRequest:n.depth>0,isRemoteRequest:!!d};h.fetch=Bn({event:h,options:t,manifest:r,state:n,get_cookie_header:m,set_internal:p}),n.emulator?.platform&&(h.platform=await n.emulator.platform({config:{},prerender:!!n.prerendering?.fallback}));let y=s.pathname;if(!d){const w=n.prerendering?.inside_reroute;try{n.prerendering&&(n.prerendering.inside_reroute=!0),y=await t.hooks.reroute({url:new URL(s),fetch:h.fetch})??s.pathname;}catch{return text("Internal Server Error",{status:500})}finally{n.prerendering&&(n.prerendering.inside_reroute=w);}}try{y=j$2(y);}catch{return text("Malformed URI",{status:400})}if(y!==j$2(s.pathname)&&!n.prerendering?.fallback&&It(r,y)){const w=new URL(e$2.url);w.pathname=c?Xe(y):a?Wt(y):y;try{const $=await fetch(w,e$2),g=new Headers($.headers);return g.has("content-encoding")&&(g.delete("content-encoding"),g.delete("content-length")),new Response($.body,{headers:g,status:$.status,statusText:$.statusText})}catch($){return await qe(h,f,t,$)}}let b=null;if(e$1&&!n.prerendering?.fallback){if(!y.startsWith(e$1))return text("Not found",{status:404});y=y.slice(e$1.length)||"/";}if(a)return En(y,new URL(e$2.url),r);if(y===`/${i}/env.js`)return Vn(e$2);if(!d&&y.startsWith(`/${i}`)){const w=new Headers;return w.set("cache-control","public, max-age=0, must-revalidate"),text("Not found",{status:404,headers:w})}if(!n.prerendering?.fallback){const w=await r._.matchers();for(const $ of r._.routes){const g=$.pattern.exec(y);if(!g)continue;const v=sr(g,$.params,w);if(v){b=$,h.route={id:b.id},h.params=O$2(v);break}}}let E={transformPageChunk:bt,filterSerializedResponseHeaders:$t,preload:vt},k="never";try{const w=b?.page?new tt(await Qn(b.page,r)):void 0;if(b&&!d){if(s.pathname===e$1||s.pathname===e$1+"/")k="always";else if(w)e&&w.validate(),k=w.trailing_slash();else if(b.endpoint){const g=await b.endpoint();k=g.trailingSlash??"never",e&&D(g,b.endpoint_id);}if(!c){const g=E$1(s.pathname,k);if(g!==s.pathname&&!n.prerendering?.fallback)return new Response(void 0,{status:308,headers:{"x-sveltekit-normalize":"1",location:(g.startsWith("//")?s.origin+g:g)+(s.search==="?"?"":s.search)}})}if(n.before_handle||n.emulator?.platform){let g={},v=!1;if(b.endpoint){const x=await b.endpoint();g=x.config??g,v=x.prerender??v;}else w&&(g=w.get_config()??g,v=w.prerender());n.before_handle&&n.before_handle(h,g,v),n.emulator?.platform&&(h.platform=await n.emulator.platform({config:g,prerender:v}));}}_(k),n.prerendering&&!n.prerendering.fallback&&!n.prerendering.inside_reroute&&U$2(s);const $=await ne({name:"sveltekit.handle.root",attributes:{"http.route":h.route.id||"unknown","http.method":h.request.method,"http.url":h.url.href,"sveltekit.is_data_request":c,"sveltekit.is_sub_request":h.isSubRequest},fn:async g=>{const v={...h,tracing:{enabled:!1,root:g,current:g}};return await with_request_store({event:v,state:f},()=>t.hooks.handle({event:v,resolve:(x,A)=>ne({name:"sveltekit.resolve",attributes:{"http.route":x.route.id||"unknown"},fn:T=>with_request_store(null,()=>R(merge_tracing(x,T),w,A).then(U=>{for(const F in i$1){const V=i$1[F];U.headers.set(F,V);}return ht(U.headers,u.values()),n.prerendering&&x.route.id!==null&&U.headers.set("x-sveltekit-routeid",encodeURI(x.route.id)),T.setAttributes({"http.response.status_code":U.status,"http.response.body.size":U.headers.get("content-length")||"unknown"}),U}))})}))}});if($.status===200&&$.headers.has("etag")){let g=e$2.headers.get("if-none-match");g?.startsWith('W/"')&&(g=g.substring(2));const v=$.headers.get("etag");if(g===v){const x=new Headers({etag:v});for(const A of ["cache-control","content-location","date","expires","vary","set-cookie"]){const T=$.headers.get(A);T&&x.set(A,T);}return new Response(void 0,{status:304,headers:x})}}if(c&&$.status>=300&&$.status<=308){const g=$.headers.get("location");if(g)return Be(new Redirect($.status,g))}return $}catch(w){if(w instanceof Redirect){const $=c||d?Be(w):b?.page&&Bt(h)?Ft(w):Se(w.status,w.location);return ht($.headers,u.values()),$}return await qe(h,f,t,w)}async function R(w,$,g){try{if(g&&(E={transformPageChunk:g.transformPageChunk||bt,filterSerializedResponseHeaders:g.filterSerializedResponseHeaders||$t,preload:g.preload||vt}),t.hash_routing||n.prerendering?.fallback)return await me({event:w,event_state:f,options:t,manifest:r,state:n,page_config:{ssr:!1,csr:!0},status:200,error:null,branch:[],fetched:[],resolve_opts:E,data_serializer:he(w,f,t)});if(d)return await Sn(w,f,t,r,d);if(b){const x=w.request.method;let A;if(c)A=await Nn(w,f,b,t,r,n,o,k);else if(b.endpoint&&(!b.page||en(w)))A=await Qr(w,f,await b.endpoint(),n);else if(b.page)if($)if(Kn.has(x))A=await Un(w,f,b.page,t,r,n,$,E);else {const T=new Set(Xn);if((await r._.nodes[b.page.leaf]())?.server?.actions&&T.add("POST"),x==="OPTIONS")A=new Response(null,{status:204,headers:{allow:Array.from(T.values()).join(", ")}});else {const F=[...T].reduce((V,J)=>(V[J]=!0,V),{});A=Nt(F,x);}}else throw new Error("page_nodes not found. This should never happen");else throw new Error("Route is neither page nor endpoint. This should never happen");if(e$2.method==="GET"&&b.page&&b.endpoint){const T=A.headers.get("vary")?.split(",")?.map(U=>U.trim().toLowerCase());T?.includes("accept")||T?.includes("*")||(A=new Response(A.body,{status:A.status,statusText:A.statusText,headers:new Headers(A.headers)}),A.headers.append("Vary","Accept"));}return A}if(n.error&&w.isSubRequest){const x=new Headers(e$2.headers);return x.set("x-sveltekit-error","true"),await fetch(e$2,{headers:x})}if(n.error)return text("Internal Server Error",{status:500});if(n.depth===0)return e&&w.url.pathname==="/.well-known/appspecific/com.chrome.devtools.json"?(kt||(console.log(`
Google Chrome is requesting ${w.url.pathname} to automatically configure devtools project settings. To learn why, and how to prevent this message, see https://svelte.dev/docs/cli/devtools-json
`),kt=!0),new Response(void 0,{status:404})):await cr({event:w,event_state:f,options:t,manifest:r,state:n,status:404,error:new SvelteKitError(404,"Not Found",`Not found: ${w.url.pathname}`),resolve_opts:E});if(n.prerendering)return text("not found",{status:404});const v=await fetch(e$2);return new Response(v.body,v)}catch(v){return await qe(w,f,t,v)}finally{w.cookies.set=()=>{throw new Error("Cannot use `cookies.set(...)` after the response has been generated")},w.setHeaders=()=>{throw new Error("Cannot use `setHeaders(...)` after the response has been generated")};}}}function Qn(e,t){return Promise.all([...e.layouts.map(r=>r==null?r:t._.nodes[r]()),t._.nodes[e.leaf]()])}function es(e){return async(t,...r)=>e(t,...r)}function Et(e,t,r){return Object.fromEntries(Object.entries(e).filter(([n])=>n.startsWith(t)&&(r===""||!n.startsWith(r))))}let ts,xt=null;class fs{#e;#t;constructor(t){if(this.#e=M$1,this.#t=t,Nr){const r=this.respond.bind(this);this.respond=async(...n)=>{const{promise:s,resolve:a}=Tt(),c=xt;return xt=s,await c,r(...n).finally(a)};}}async init({env:t,read:r}){const{env_public_prefix:n,env_private_prefix:s}=this.#e;O(Et(t,s,n)),P(Et(t,n,s)),r&&I$1(c=>{const d=r(c);return d instanceof ReadableStream?d:new ReadableStream({async start(o){try{const i=await Promise.resolve(d);if(!i){o.close();return}const l=i.getReader();for(;;){const{done:u,value:m}=await l.read();if(u)break;o.enqueue(m);}o.close();}catch(i){o.error(i);}}})}),await(ts??=(async()=>{try{const a=await U();this.#e.hooks={handle:a.handle||(({event:c,resolve:d})=>d(c)),handleError:a.handleError||(({status:c,error:d,event:o})=>{const i=Xr(c,d,o);console.error(i);}),handleFetch:a.handleFetch||(({request:c,fetch:d})=>d(c)),handleValidationError:a.handleValidationError||(({issues:c})=>(console.error("Remote function schema validation failed:",c),{message:"Bad Request"})),reroute:a.reroute||(()=>{}),transport:a.transport||{}},a.transport&&Object.fromEntries(Object.entries(a.transport).map(([c,d])=>[c,d.decode])),a.init&&await a.init();}catch(a){if(e)this.#e.hooks={handle:()=>{throw a},handleError:({error:c})=>console.error(c),handleFetch:({request:c,fetch:d})=>d(c),handleValidationError:()=>({message:"Bad Request"}),reroute:()=>{},transport:{}};else throw a}})());}async respond(t,r){return Fe(t,this.#e,this.#t,{...r,error:false,depth:0})}}

export { fs as Server };
//# sourceMappingURL=index.js.map
