{"version":3,"file":"index.js","sources":["../../.svelte-kit/adapter-node/chunks/internal.js","../../node_modules/devalue/src/utils.js","../../node_modules/devalue/src/uneval.js","../../node_modules/devalue/src/constants.js","../../node_modules/devalue/src/stringify.js","../../node_modules/cookie/index.js","../../node_modules/set-cookie-parser/lib/set-cookie.js","../../.svelte-kit/adapter-node/index.js"],"sourcesContent":["import { c as create_ssr_component, a as setContext, v as validate_component, m as missing_component } from \"./ssr.js\";\nlet base = \"\";\nlet assets = base;\nconst initial = { base, assets };\nfunction reset() {\n base = initial.base;\n assets = initial.assets;\n}\nfunction set_assets(path) {\n assets = initial.assets = path;\n}\nlet public_env = {};\nfunction set_private_env(environment) {\n}\nfunction set_public_env(environment) {\n public_env = environment;\n}\nfunction afterUpdate() {\n}\nfunction set_building() {\n}\nconst Root = create_ssr_component(($$result, $$props, $$bindings, slots) => {\n let { stores } = $$props;\n let { page } = $$props;\n let { constructors } = $$props;\n let { components = [] } = $$props;\n let { form } = $$props;\n let { data_0 = null } = $$props;\n let { data_1 = null } = $$props;\n {\n setContext(\"__svelte__\", stores);\n }\n afterUpdate(stores.page.notify);\n if ($$props.stores === void 0 && $$bindings.stores && stores !== void 0)\n $$bindings.stores(stores);\n if ($$props.page === void 0 && $$bindings.page && page !== void 0)\n $$bindings.page(page);\n if ($$props.constructors === void 0 && $$bindings.constructors && constructors !== void 0)\n $$bindings.constructors(constructors);\n if ($$props.components === void 0 && $$bindings.components && components !== void 0)\n $$bindings.components(components);\n if ($$props.form === void 0 && $$bindings.form && form !== void 0)\n $$bindings.form(form);\n if ($$props.data_0 === void 0 && $$bindings.data_0 && data_0 !== void 0)\n $$bindings.data_0(data_0);\n if ($$props.data_1 === void 0 && $$bindings.data_1 && data_1 !== void 0)\n $$bindings.data_1(data_1);\n let $$settled;\n let $$rendered;\n do {\n $$settled = true;\n {\n stores.page.set(page);\n }\n $$rendered = ` ${constructors[1] ? `${validate_component(constructors[0] || missing_component, \"svelte:component\").$$render(\n $$result,\n { data: data_0, this: components[0] },\n {\n this: ($$value) => {\n components[0] = $$value;\n $$settled = false;\n }\n },\n {\n default: () => {\n return `${validate_component(constructors[1] || missing_component, \"svelte:component\").$$render(\n $$result,\n { data: data_1, form, this: components[1] },\n {\n this: ($$value) => {\n components[1] = $$value;\n $$settled = false;\n }\n },\n {}\n )}`;\n }\n }\n )}` : `${validate_component(constructors[0] || missing_component, \"svelte:component\").$$render(\n $$result,\n { data: data_0, form, this: components[0] },\n {\n this: ($$value) => {\n components[0] = $$value;\n $$settled = false;\n }\n },\n {}\n )}`} ${``}`;\n } while (!$$settled);\n return $$rendered;\n});\nconst options = {\n app_template_contains_nonce: false,\n csp: { \"mode\": \"auto\", \"directives\": { \"upgrade-insecure-requests\": false, \"block-all-mixed-content\": false }, \"reportOnly\": { \"upgrade-insecure-requests\": false, \"block-all-mixed-content\": false } },\n csrf_check_origin: true,\n track_server_fetches: false,\n embedded: false,\n env_public_prefix: \"PUBLIC_\",\n env_private_prefix: \"\",\n hooks: null,\n // added lazily, via `get_hooks`\n preload_strategy: \"modulepreload\",\n root: Root,\n service_worker: false,\n templates: {\n app: ({ head, body, assets: assets2, nonce, env }) => '\\n\\n\t\\n\t\t\\n\t\t\\n\t\t\\n\t\t' + head + '\\n\t\\n\t\\n\t\t
' + body + \"
\\n\t\\n\\n\",\n error: ({ status, message }) => '\\n\\n\t\\n\t\t\\n\t\t' + message + `\n\n\t\t\n\t\n\t\n\t\t
\n\t\t\t` + status + '\\n\t\t\t
\\n\t\t\t\t

' + message + \"

\\n\t\t\t
\\n\t\t
\\n\t\\n\\n\"\n },\n version_hash: \"rrbcpm\"\n};\nfunction get_hooks() {\n return {};\n}\nexport {\n assets as a,\n base as b,\n set_public_env as c,\n set_assets as d,\n set_building as e,\n get_hooks as g,\n options as o,\n public_env as p,\n reset as r,\n set_private_env as s\n};\n","/** @type {Record} */\nexport const escaped = {\n\t'<': '\\\\u003C',\n\t'\\\\': '\\\\\\\\',\n\t'\\b': '\\\\b',\n\t'\\f': '\\\\f',\n\t'\\n': '\\\\n',\n\t'\\r': '\\\\r',\n\t'\\t': '\\\\t',\n\t'\\u2028': '\\\\u2028',\n\t'\\u2029': '\\\\u2029'\n};\n\nexport class DevalueError extends Error {\n\t/**\n\t * @param {string} message\n\t * @param {string[]} keys\n\t */\n\tconstructor(message, keys) {\n\t\tsuper(message);\n\t\tthis.name = 'DevalueError';\n\t\tthis.path = keys.join('');\n\t}\n}\n\n/** @param {any} thing */\nexport function is_primitive(thing) {\n\treturn Object(thing) !== thing;\n}\n\nconst object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(\n\tObject.prototype\n)\n\t.sort()\n\t.join('\\0');\n\n/** @param {any} thing */\nexport function is_plain_object(thing) {\n\tconst proto = Object.getPrototypeOf(thing);\n\n\treturn (\n\t\tproto === Object.prototype ||\n\t\tproto === null ||\n\t\tObject.getOwnPropertyNames(proto).sort().join('\\0') === object_proto_names\n\t);\n}\n\n/** @param {any} thing */\nexport function get_type(thing) {\n\treturn Object.prototype.toString.call(thing).slice(8, -1);\n}\n\n/** @param {string} char */\nfunction get_escaped_char(char) {\n\tswitch (char) {\n\t\tcase '\"':\n\t\t\treturn '\\\\\"';\n\t\tcase '<':\n\t\t\treturn '\\\\u003C';\n\t\tcase '\\\\':\n\t\t\treturn '\\\\\\\\';\n\t\tcase '\\n':\n\t\t\treturn '\\\\n';\n\t\tcase '\\r':\n\t\t\treturn '\\\\r';\n\t\tcase '\\t':\n\t\t\treturn '\\\\t';\n\t\tcase '\\b':\n\t\t\treturn '\\\\b';\n\t\tcase '\\f':\n\t\t\treturn '\\\\f';\n\t\tcase '\\u2028':\n\t\t\treturn '\\\\u2028';\n\t\tcase '\\u2029':\n\t\t\treturn '\\\\u2029';\n\t\tdefault:\n\t\t\treturn char < ' '\n\t\t\t\t? `\\\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}`\n\t\t\t\t: '';\n\t}\n}\n\n/** @param {string} str */\nexport function stringify_string(str) {\n\tlet result = '';\n\tlet last_pos = 0;\n\tconst len = str.length;\n\n\tfor (let i = 0; i < len; i += 1) {\n\t\tconst char = str[i];\n\t\tconst replacement = get_escaped_char(char);\n\t\tif (replacement) {\n\t\t\tresult += str.slice(last_pos, i) + replacement;\n\t\t\tlast_pos = i + 1;\n\t\t}\n\t}\n\n\treturn `\"${last_pos === 0 ? str : result + str.slice(last_pos)}\"`;\n}\n","import {\n\tDevalueError,\n\tescaped,\n\tget_type,\n\tis_plain_object,\n\tis_primitive,\n\tstringify_string\n} from './utils.js';\n\nconst chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';\nconst unsafe_chars = /[<\\b\\f\\n\\r\\t\\0\\u2028\\u2029]/g;\nconst reserved =\n\t/^(?: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)$/;\n\n/**\n * Turn a value into the JavaScript that creates an equivalent value\n * @param {any} value\n * @param {(value: any) => string | void} [replacer]\n */\nexport function uneval(value, replacer) {\n\tconst counts = new Map();\n\n\t/** @type {string[]} */\n\tconst keys = [];\n\n\tconst custom = new Map();\n\n\t/** @param {any} thing */\n\tfunction walk(thing) {\n\t\tif (typeof thing === 'function') {\n\t\t\tthrow new DevalueError(`Cannot stringify a function`, keys);\n\t\t}\n\n\t\tif (!is_primitive(thing)) {\n\t\t\tif (counts.has(thing)) {\n\t\t\t\tcounts.set(thing, counts.get(thing) + 1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tcounts.set(thing, 1);\n\n\t\t\tif (replacer) {\n\t\t\t\tconst str = replacer(thing);\n\n\t\t\t\tif (typeof str === 'string') {\n\t\t\t\t\tcustom.set(thing, str);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst type = get_type(thing);\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'Number':\n\t\t\t\tcase 'BigInt':\n\t\t\t\tcase 'String':\n\t\t\t\tcase 'Boolean':\n\t\t\t\tcase 'Date':\n\t\t\t\tcase 'RegExp':\n\t\t\t\t\treturn;\n\n\t\t\t\tcase 'Array':\n\t\t\t\t\t/** @type {any[]} */ (thing).forEach((value, i) => {\n\t\t\t\t\t\tkeys.push(`[${i}]`);\n\t\t\t\t\t\twalk(value);\n\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Set':\n\t\t\t\t\tArray.from(thing).forEach(walk);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Map':\n\t\t\t\t\tfor (const [key, value] of thing) {\n\t\t\t\t\t\tkeys.push(\n\t\t\t\t\t\t\t`.get(${is_primitive(key) ? stringify_primitive(key) : '...'})`\n\t\t\t\t\t\t);\n\t\t\t\t\t\twalk(value);\n\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tif (!is_plain_object(thing)) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify arbitrary non-POJOs`,\n\t\t\t\t\t\t\tkeys\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Object.getOwnPropertySymbols(thing).length > 0) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify POJOs with symbolic keys`,\n\t\t\t\t\t\t\tkeys\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const key in thing) {\n\t\t\t\t\t\tkeys.push(`.${key}`);\n\t\t\t\t\t\twalk(thing[key]);\n\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\twalk(value);\n\n\tconst names = new Map();\n\n\tArray.from(counts)\n\t\t.filter((entry) => entry[1] > 1)\n\t\t.sort((a, b) => b[1] - a[1])\n\t\t.forEach((entry, i) => {\n\t\t\tnames.set(entry[0], get_name(i));\n\t\t});\n\n\t/**\n\t * @param {any} thing\n\t * @returns {string}\n\t */\n\tfunction stringify(thing) {\n\t\tif (names.has(thing)) {\n\t\t\treturn names.get(thing);\n\t\t}\n\n\t\tif (is_primitive(thing)) {\n\t\t\treturn stringify_primitive(thing);\n\t\t}\n\n\t\tif (custom.has(thing)) {\n\t\t\treturn custom.get(thing);\n\t\t}\n\n\t\tconst type = get_type(thing);\n\n\t\tswitch (type) {\n\t\t\tcase 'Number':\n\t\t\tcase 'String':\n\t\t\tcase 'Boolean':\n\t\t\t\treturn `Object(${stringify(thing.valueOf())})`;\n\n\t\t\tcase 'RegExp':\n\t\t\t\treturn `new RegExp(${stringify_string(thing.source)}, \"${\n\t\t\t\t\tthing.flags\n\t\t\t\t}\")`;\n\n\t\t\tcase 'Date':\n\t\t\t\treturn `new Date(${thing.getTime()})`;\n\n\t\t\tcase 'Array':\n\t\t\t\tconst members = /** @type {any[]} */ (thing).map((v, i) =>\n\t\t\t\t\ti in thing ? stringify(v) : ''\n\t\t\t\t);\n\t\t\t\tconst tail = thing.length === 0 || thing.length - 1 in thing ? '' : ',';\n\t\t\t\treturn `[${members.join(',')}${tail}]`;\n\n\t\t\tcase 'Set':\n\t\t\tcase 'Map':\n\t\t\t\treturn `new ${type}([${Array.from(thing).map(stringify).join(',')}])`;\n\n\t\t\tdefault:\n\t\t\t\tconst obj = `{${Object.keys(thing)\n\t\t\t\t\t.map((key) => `${safe_key(key)}:${stringify(thing[key])}`)\n\t\t\t\t\t.join(',')}}`;\n\t\t\t\tconst proto = Object.getPrototypeOf(thing);\n\t\t\t\tif (proto === null) {\n\t\t\t\t\treturn Object.keys(thing).length > 0\n\t\t\t\t\t\t? `Object.assign(Object.create(null),${obj})`\n\t\t\t\t\t\t: `Object.create(null)`;\n\t\t\t\t}\n\n\t\t\t\treturn obj;\n\t\t}\n\t}\n\n\tconst str = stringify(value);\n\n\tif (names.size) {\n\t\t/** @type {string[]} */\n\t\tconst params = [];\n\n\t\t/** @type {string[]} */\n\t\tconst statements = [];\n\n\t\t/** @type {string[]} */\n\t\tconst values = [];\n\n\t\tnames.forEach((name, thing) => {\n\t\t\tparams.push(name);\n\n\t\t\tif (custom.has(thing)) {\n\t\t\t\tvalues.push(/** @type {string} */ (custom.get(thing)));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (is_primitive(thing)) {\n\t\t\t\tvalues.push(stringify_primitive(thing));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst type = get_type(thing);\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'Number':\n\t\t\t\tcase 'String':\n\t\t\t\tcase 'Boolean':\n\t\t\t\t\tvalues.push(`Object(${stringify(thing.valueOf())})`);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RegExp':\n\t\t\t\t\tvalues.push(thing.toString());\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Date':\n\t\t\t\t\tvalues.push(`new Date(${thing.getTime()})`);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Array':\n\t\t\t\t\tvalues.push(`Array(${thing.length})`);\n\t\t\t\t\t/** @type {any[]} */ (thing).forEach((v, i) => {\n\t\t\t\t\t\tstatements.push(`${name}[${i}]=${stringify(v)}`);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Set':\n\t\t\t\t\tvalues.push(`new Set`);\n\t\t\t\t\tstatements.push(\n\t\t\t\t\t\t`${name}.${Array.from(thing)\n\t\t\t\t\t\t\t.map((v) => `add(${stringify(v)})`)\n\t\t\t\t\t\t\t.join('.')}`\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Map':\n\t\t\t\t\tvalues.push(`new Map`);\n\t\t\t\t\tstatements.push(\n\t\t\t\t\t\t`${name}.${Array.from(thing)\n\t\t\t\t\t\t\t.map(([k, v]) => `set(${stringify(k)}, ${stringify(v)})`)\n\t\t\t\t\t\t\t.join('.')}`\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tvalues.push(\n\t\t\t\t\t\tObject.getPrototypeOf(thing) === null ? 'Object.create(null)' : '{}'\n\t\t\t\t\t);\n\t\t\t\t\tObject.keys(thing).forEach((key) => {\n\t\t\t\t\t\tstatements.push(\n\t\t\t\t\t\t\t`${name}${safe_prop(key)}=${stringify(thing[key])}`\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tstatements.push(`return ${str}`);\n\n\t\treturn `(function(${params.join(',')}){${statements.join(\n\t\t\t';'\n\t\t)}}(${values.join(',')}))`;\n\t} else {\n\t\treturn str;\n\t}\n}\n\n/** @param {number} num */\nfunction get_name(num) {\n\tlet name = '';\n\n\tdo {\n\t\tname = chars[num % chars.length] + name;\n\t\tnum = ~~(num / chars.length) - 1;\n\t} while (num >= 0);\n\n\treturn reserved.test(name) ? `${name}0` : name;\n}\n\n/** @param {string} c */\nfunction escape_unsafe_char(c) {\n\treturn escaped[c] || c;\n}\n\n/** @param {string} str */\nfunction escape_unsafe_chars(str) {\n\treturn str.replace(unsafe_chars, escape_unsafe_char);\n}\n\n/** @param {string} key */\nfunction safe_key(key) {\n\treturn /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key)\n\t\t? key\n\t\t: escape_unsafe_chars(JSON.stringify(key));\n}\n\n/** @param {string} key */\nfunction safe_prop(key) {\n\treturn /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key)\n\t\t? `.${key}`\n\t\t: `[${escape_unsafe_chars(JSON.stringify(key))}]`;\n}\n\n/** @param {any} thing */\nfunction stringify_primitive(thing) {\n\tif (typeof thing === 'string') return stringify_string(thing);\n\tif (thing === void 0) return 'void 0';\n\tif (thing === 0 && 1 / thing < 0) return '-0';\n\tconst str = String(thing);\n\tif (typeof thing === 'number') return str.replace(/^(-)?0\\./, '$1.');\n\tif (typeof thing === 'bigint') return thing + 'n';\n\treturn str;\n}\n","export const UNDEFINED = -1;\nexport const HOLE = -2;\nexport const NAN = -3;\nexport const POSITIVE_INFINITY = -4;\nexport const NEGATIVE_INFINITY = -5;\nexport const NEGATIVE_ZERO = -6;\n","import {\n\tDevalueError,\n\tget_type,\n\tis_plain_object,\n\tis_primitive,\n\tstringify_string\n} from './utils.js';\nimport {\n\tHOLE,\n\tNAN,\n\tNEGATIVE_INFINITY,\n\tNEGATIVE_ZERO,\n\tPOSITIVE_INFINITY,\n\tUNDEFINED\n} from './constants.js';\n\n/**\n * Turn a value into a JSON string that can be parsed with `devalue.parse`\n * @param {any} value\n * @param {Record any>} [reducers]\n */\nexport function stringify(value, reducers) {\n\t/** @type {any[]} */\n\tconst stringified = [];\n\n\t/** @type {Map} */\n\tconst indexes = new Map();\n\n\t/** @type {Array<{ key: string, fn: (value: any) => any }>} */\n\tconst custom = [];\n\tfor (const key in reducers) {\n\t\tcustom.push({ key, fn: reducers[key] });\n\t}\n\n\t/** @type {string[]} */\n\tconst keys = [];\n\n\tlet p = 0;\n\n\t/** @param {any} thing */\n\tfunction flatten(thing) {\n\t\tif (typeof thing === 'function') {\n\t\t\tthrow new DevalueError(`Cannot stringify a function`, keys);\n\t\t}\n\n\t\tif (indexes.has(thing)) return indexes.get(thing);\n\n\t\tif (thing === undefined) return UNDEFINED;\n\t\tif (Number.isNaN(thing)) return NAN;\n\t\tif (thing === Infinity) return POSITIVE_INFINITY;\n\t\tif (thing === -Infinity) return NEGATIVE_INFINITY;\n\t\tif (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO;\n\n\t\tconst index = p++;\n\t\tindexes.set(thing, index);\n\n\t\tfor (const { key, fn } of custom) {\n\t\t\tconst value = fn(thing);\n\t\t\tif (value) {\n\t\t\t\tstringified[index] = `[\"${key}\",${flatten(value)}]`;\n\t\t\t\treturn index;\n\t\t\t}\n\t\t}\n\n\t\tlet str = '';\n\n\t\tif (is_primitive(thing)) {\n\t\t\tstr = stringify_primitive(thing);\n\t\t} else {\n\t\t\tconst type = get_type(thing);\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'Number':\n\t\t\t\tcase 'String':\n\t\t\t\tcase 'Boolean':\n\t\t\t\t\tstr = `[\"Object\",${stringify_primitive(thing)}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'BigInt':\n\t\t\t\t\tstr = `[\"BigInt\",${thing}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Date':\n\t\t\t\t\tstr = `[\"Date\",\"${thing.toISOString()}\"]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RegExp':\n\t\t\t\t\tconst { source, flags } = thing;\n\t\t\t\t\tstr = flags\n\t\t\t\t\t\t? `[\"RegExp\",${stringify_string(source)},\"${flags}\"]`\n\t\t\t\t\t\t: `[\"RegExp\",${stringify_string(source)}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Array':\n\t\t\t\t\tstr = '[';\n\n\t\t\t\t\tfor (let i = 0; i < thing.length; i += 1) {\n\t\t\t\t\t\tif (i > 0) str += ',';\n\n\t\t\t\t\t\tif (i in thing) {\n\t\t\t\t\t\t\tkeys.push(`[${i}]`);\n\t\t\t\t\t\t\tstr += flatten(thing[i]);\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tstr += HOLE;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Set':\n\t\t\t\t\tstr = '[\"Set\"';\n\n\t\t\t\t\tfor (const value of thing) {\n\t\t\t\t\t\tstr += `,${flatten(value)}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Map':\n\t\t\t\t\tstr = '[\"Map\"';\n\n\t\t\t\t\tfor (const [key, value] of thing) {\n\t\t\t\t\t\tkeys.push(\n\t\t\t\t\t\t\t`.get(${is_primitive(key) ? stringify_primitive(key) : '...'})`\n\t\t\t\t\t\t);\n\t\t\t\t\t\tstr += `,${flatten(key)},${flatten(value)}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tif (!is_plain_object(thing)) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify arbitrary non-POJOs`,\n\t\t\t\t\t\t\tkeys\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Object.getOwnPropertySymbols(thing).length > 0) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify POJOs with symbolic keys`,\n\t\t\t\t\t\t\tkeys\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Object.getPrototypeOf(thing) === null) {\n\t\t\t\t\t\tstr = '[\"null\"';\n\t\t\t\t\t\tfor (const key in thing) {\n\t\t\t\t\t\t\tkeys.push(`.${key}`);\n\t\t\t\t\t\t\tstr += `,${stringify_string(key)},${flatten(thing[key])}`;\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr += ']';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstr = '{';\n\t\t\t\t\t\tlet started = false;\n\t\t\t\t\t\tfor (const key in thing) {\n\t\t\t\t\t\t\tif (started) str += ',';\n\t\t\t\t\t\t\tstarted = true;\n\t\t\t\t\t\t\tkeys.push(`.${key}`);\n\t\t\t\t\t\t\tstr += `${stringify_string(key)}:${flatten(thing[key])}`;\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr += '}';\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstringified[index] = str;\n\t\treturn index;\n\t}\n\n\tconst index = flatten(value);\n\n\t// special case — value is represented as a negative index\n\tif (index < 0) return `${index}`;\n\n\treturn `[${stringified.join(',')}]`;\n}\n\n/**\n * @param {any} thing\n * @returns {string}\n */\nfunction stringify_primitive(thing) {\n\tconst type = typeof thing;\n\tif (type === 'string') return stringify_string(thing);\n\tif (thing instanceof String) return stringify_string(thing.toString());\n\tif (thing === void 0) return UNDEFINED.toString();\n\tif (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO.toString();\n\tif (type === 'bigint') return `[\"BigInt\",\"${thing}\"]`;\n\treturn String(thing);\n}\n","/*!\n * cookie\n * Copyright(c) 2012-2014 Roman Shtylman\n * Copyright(c) 2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module exports.\n * @public\n */\n\nexports.parse = parse;\nexports.serialize = serialize;\n\n/**\n * Module variables.\n * @private\n */\n\nvar __toString = Object.prototype.toString\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\n\nvar fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\n/**\n * Parse a cookie header.\n *\n * Parse the given cookie header string into an object\n * The object has the various cookies as keys(names) => values\n *\n * @param {string} str\n * @param {object} [options]\n * @return {object}\n * @public\n */\n\nfunction parse(str, options) {\n if (typeof str !== 'string') {\n throw new TypeError('argument str must be a string');\n }\n\n var obj = {}\n var opt = options || {};\n var dec = opt.decode || decode;\n\n var index = 0\n while (index < str.length) {\n var eqIdx = str.indexOf('=', index)\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break\n }\n\n var endIdx = str.indexOf(';', index)\n\n if (endIdx === -1) {\n endIdx = str.length\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1\n continue\n }\n\n var key = str.slice(index, eqIdx).trim()\n\n // only assign once\n if (undefined === obj[key]) {\n var val = str.slice(eqIdx + 1, endIdx).trim()\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1)\n }\n\n obj[key] = tryDecode(val, dec);\n }\n\n index = endIdx + 1\n }\n\n return obj;\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * serialize('foo', 'bar', { httpOnly: true })\n * => \"foo=bar; httpOnly\"\n *\n * @param {string} name\n * @param {string} val\n * @param {object} [options]\n * @return {string}\n * @public\n */\n\nfunction serialize(name, val, options) {\n var opt = options || {};\n var enc = opt.encode || encode;\n\n if (typeof enc !== 'function') {\n throw new TypeError('option encode is invalid');\n }\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n var value = enc(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n var str = name + '=' + value;\n\n if (null != opt.maxAge) {\n var maxAge = opt.maxAge - 0;\n\n if (isNaN(maxAge) || !isFinite(maxAge)) {\n throw new TypeError('option maxAge is invalid')\n }\n\n str += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n str += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n str += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n var expires = opt.expires\n\n if (!isDate(expires) || isNaN(expires.valueOf())) {\n throw new TypeError('option expires is invalid');\n }\n\n str += '; Expires=' + expires.toUTCString()\n }\n\n if (opt.httpOnly) {\n str += '; HttpOnly';\n }\n\n if (opt.secure) {\n str += '; Secure';\n }\n\n if (opt.priority) {\n var priority = typeof opt.priority === 'string'\n ? opt.priority.toLowerCase()\n : opt.priority\n\n switch (priority) {\n case 'low':\n str += '; Priority=Low'\n break\n case 'medium':\n str += '; Priority=Medium'\n break\n case 'high':\n str += '; Priority=High'\n break\n default:\n throw new TypeError('option priority is invalid')\n }\n }\n\n if (opt.sameSite) {\n var sameSite = typeof opt.sameSite === 'string'\n ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n str += '; SameSite=Strict';\n break;\n case 'lax':\n str += '; SameSite=Lax';\n break;\n case 'strict':\n str += '; SameSite=Strict';\n break;\n case 'none':\n str += '; SameSite=None';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return str;\n}\n\n/**\n * URL-decode string value. Optimized to skip native call when no %.\n *\n * @param {string} str\n * @returns {string}\n */\n\nfunction decode (str) {\n return str.indexOf('%') !== -1\n ? decodeURIComponent(str)\n : str\n}\n\n/**\n * URL-encode value.\n *\n * @param {string} str\n * @returns {string}\n */\n\nfunction encode (val) {\n return encodeURIComponent(val)\n}\n\n/**\n * Determine if value is a Date.\n *\n * @param {*} val\n * @private\n */\n\nfunction isDate (val) {\n return __toString.call(val) === '[object Date]' ||\n val instanceof Date\n}\n\n/**\n * Try decoding a string using a decoding function.\n *\n * @param {string} str\n * @param {function} decode\n * @private\n */\n\nfunction tryDecode(str, decode) {\n try {\n return decode(str);\n } catch (e) {\n return str;\n }\n}\n","\"use strict\";\n\nvar defaultParseOptions = {\n decodeValues: true,\n map: false,\n silent: false,\n};\n\nfunction isNonEmptyString(str) {\n return typeof str === \"string\" && !!str.trim();\n}\n\nfunction parseString(setCookieValue, options) {\n var parts = setCookieValue.split(\";\").filter(isNonEmptyString);\n\n var nameValuePairStr = parts.shift();\n var parsed = parseNameValuePair(nameValuePairStr);\n var name = parsed.name;\n var value = parsed.value;\n\n options = options\n ? Object.assign({}, defaultParseOptions, options)\n : defaultParseOptions;\n\n try {\n value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value\n } catch (e) {\n console.error(\n \"set-cookie-parser encountered an error while decoding a cookie with value '\" +\n value +\n \"'. Set options.decodeValues to false to disable this feature.\",\n e\n );\n }\n\n var cookie = {\n name: name,\n value: value,\n };\n\n parts.forEach(function (part) {\n var sides = part.split(\"=\");\n var key = sides.shift().trimLeft().toLowerCase();\n var value = sides.join(\"=\");\n if (key === \"expires\") {\n cookie.expires = new Date(value);\n } else if (key === \"max-age\") {\n cookie.maxAge = parseInt(value, 10);\n } else if (key === \"secure\") {\n cookie.secure = true;\n } else if (key === \"httponly\") {\n cookie.httpOnly = true;\n } else if (key === \"samesite\") {\n cookie.sameSite = value;\n } else {\n cookie[key] = value;\n }\n });\n\n return cookie;\n}\n\nfunction parseNameValuePair(nameValuePairStr) {\n // Parses name-value-pair according to rfc6265bis draft\n\n var name = \"\";\n var value = \"\";\n var nameValueArr = nameValuePairStr.split(\"=\");\n if (nameValueArr.length > 1) {\n name = nameValueArr.shift();\n value = nameValueArr.join(\"=\"); // everything after the first =, joined by a \"=\" if there was more than one part\n } else {\n value = nameValuePairStr;\n }\n\n return { name: name, value: value };\n}\n\nfunction parse(input, options) {\n options = options\n ? Object.assign({}, defaultParseOptions, options)\n : defaultParseOptions;\n\n if (!input) {\n if (!options.map) {\n return [];\n } else {\n return {};\n }\n }\n\n if (input.headers) {\n if (typeof input.headers.getSetCookie === \"function\") {\n // for fetch responses - they combine headers of the same type in the headers array,\n // but getSetCookie returns an uncombined array\n input = input.headers.getSetCookie();\n } else if (input.headers[\"set-cookie\"]) {\n // fast-path for node.js (which automatically normalizes header names to lower-case\n input = input.headers[\"set-cookie\"];\n } else {\n // slow-path for other environments - see #25\n var sch =\n input.headers[\n Object.keys(input.headers).find(function (key) {\n return key.toLowerCase() === \"set-cookie\";\n })\n ];\n // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36\n if (!sch && input.headers.cookie && !options.silent) {\n console.warn(\n \"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.\"\n );\n }\n input = sch;\n }\n }\n if (!Array.isArray(input)) {\n input = [input];\n }\n\n options = options\n ? Object.assign({}, defaultParseOptions, options)\n : defaultParseOptions;\n\n if (!options.map) {\n return input.filter(isNonEmptyString).map(function (str) {\n return parseString(str, options);\n });\n } else {\n var cookies = {};\n return input.filter(isNonEmptyString).reduce(function (cookies, str) {\n var cookie = parseString(str, options);\n cookies[cookie.name] = cookie;\n return cookies;\n }, cookies);\n }\n}\n\n/*\n Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas\n that are within a single set-cookie field-value, such as in the Expires portion.\n\n This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2\n Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128\n React Native's fetch does this for *every* header, including set-cookie.\n\n Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25\n Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation\n*/\nfunction splitCookiesString(cookiesString) {\n if (Array.isArray(cookiesString)) {\n return cookiesString;\n }\n if (typeof cookiesString !== \"string\") {\n return [];\n }\n\n var cookiesStrings = [];\n var pos = 0;\n var start;\n var ch;\n var lastComma;\n var nextStart;\n var cookiesSeparatorFound;\n\n function skipWhitespace() {\n while (pos < cookiesString.length && /\\s/.test(cookiesString.charAt(pos))) {\n pos += 1;\n }\n return pos < cookiesString.length;\n }\n\n function notSpecialChar() {\n ch = cookiesString.charAt(pos);\n\n return ch !== \"=\" && ch !== \";\" && ch !== \",\";\n }\n\n while (pos < cookiesString.length) {\n start = pos;\n cookiesSeparatorFound = false;\n\n while (skipWhitespace()) {\n ch = cookiesString.charAt(pos);\n if (ch === \",\") {\n // ',' is a cookie separator if we have later first '=', not ';' or ','\n lastComma = pos;\n pos += 1;\n\n skipWhitespace();\n nextStart = pos;\n\n while (pos < cookiesString.length && notSpecialChar()) {\n pos += 1;\n }\n\n // currently special character\n if (pos < cookiesString.length && cookiesString.charAt(pos) === \"=\") {\n // we found cookies separator\n cookiesSeparatorFound = true;\n // pos is inside the next cookie, so back up and return it.\n pos = nextStart;\n cookiesStrings.push(cookiesString.substring(start, lastComma));\n start = pos;\n } else {\n // in param ',' or param separator ';',\n // we continue from that comma\n pos = lastComma + 1;\n }\n } else {\n pos += 1;\n }\n }\n\n if (!cookiesSeparatorFound || pos >= cookiesString.length) {\n cookiesStrings.push(cookiesString.substring(start, cookiesString.length));\n }\n }\n\n return cookiesStrings;\n}\n\nmodule.exports = parse;\nmodule.exports.parse = parse;\nmodule.exports.parseString = parseString;\nmodule.exports.splitCookiesString = splitCookiesString;\n","import { b as base, a as assets, r as reset, p as public_env, o as options, s as set_private_env, c as set_public_env, g as get_hooks } from \"./chunks/internal.js\";\nimport * as devalue from \"devalue\";\nimport { n as noop, s as safe_not_equal } from \"./chunks/ssr.js\";\nimport { parse, serialize } from \"cookie\";\nimport * as set_cookie_parser from \"set-cookie-parser\";\nconst DEV = false;\nconst SVELTE_KIT_ASSETS = \"/_svelte_kit_assets\";\nconst ENDPOINT_METHODS = /* @__PURE__ */ new Set([\n \"GET\",\n \"POST\",\n \"PUT\",\n \"PATCH\",\n \"DELETE\",\n \"OPTIONS\",\n \"HEAD\"\n]);\nconst PAGE_METHODS = /* @__PURE__ */ new Set([\"GET\", \"POST\", \"HEAD\"]);\nfunction negotiate(accept, types) {\n const parts = [];\n accept.split(\",\").forEach((str, i) => {\n const match = /([^/]+)\\/([^;]+)(?:;q=([0-9.]+))?/.exec(str);\n if (match) {\n const [, type, subtype, q = \"1\"] = match;\n parts.push({ type, subtype, q: +q, i });\n }\n });\n parts.sort((a, b) => {\n if (a.q !== b.q) {\n return b.q - a.q;\n }\n if (a.subtype === \"*\" !== (b.subtype === \"*\")) {\n return a.subtype === \"*\" ? 1 : -1;\n }\n if (a.type === \"*\" !== (b.type === \"*\")) {\n return a.type === \"*\" ? 1 : -1;\n }\n return a.i - b.i;\n });\n let accepted;\n let min_priority = Infinity;\n for (const mimetype of types) {\n const [type, subtype] = mimetype.split(\"/\");\n const priority = parts.findIndex(\n (part) => (part.type === type || part.type === \"*\") && (part.subtype === subtype || part.subtype === \"*\")\n );\n if (priority !== -1 && priority < min_priority) {\n accepted = mimetype;\n min_priority = priority;\n }\n }\n return accepted;\n}\nfunction is_content_type(request, ...types) {\n const type = request.headers.get(\"content-type\")?.split(\";\", 1)[0].trim() ?? \"\";\n return types.includes(type.toLowerCase());\n}\nfunction is_form_content_type(request) {\n return is_content_type(\n request,\n \"application/x-www-form-urlencoded\",\n \"multipart/form-data\",\n \"text/plain\"\n );\n}\nclass HttpError {\n /**\n * @param {number} status\n * @param {{message: string} extends App.Error ? (App.Error | string | undefined) : App.Error} body\n */\n constructor(status, body) {\n this.status = status;\n if (typeof body === \"string\") {\n this.body = { message: body };\n } else if (body) {\n this.body = body;\n } else {\n this.body = { message: `Error: ${status}` };\n }\n }\n toString() {\n return JSON.stringify(this.body);\n }\n}\nclass Redirect {\n /**\n * @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308} status\n * @param {string} location\n */\n constructor(status, location) {\n this.status = status;\n this.location = location;\n }\n}\nclass ActionFailure {\n /**\n * @param {number} status\n * @param {T} [data]\n */\n constructor(status, data) {\n this.status = status;\n this.data = data;\n }\n}\nfunction exec(match, params, matchers) {\n const result = {};\n const values = match.slice(1);\n let buffered = 0;\n for (let i = 0; i < params.length; i += 1) {\n const param = params[i];\n let value = values[i - buffered];\n if (param.chained && param.rest && buffered) {\n value = values.slice(i - buffered, i + 1).filter((s2) => s2).join(\"/\");\n buffered = 0;\n }\n if (value === void 0) {\n if (param.rest)\n result[param.name] = \"\";\n continue;\n }\n if (!param.matcher || matchers[param.matcher](value)) {\n result[param.name] = value;\n const next_param = params[i + 1];\n const next_value = values[i + 1];\n if (next_param && !next_param.rest && next_param.optional && next_value && param.chained) {\n buffered = 0;\n }\n continue;\n }\n if (param.optional && param.chained) {\n buffered++;\n continue;\n }\n return;\n }\n if (buffered)\n return;\n return result;\n}\nfunction error(status, body) {\n if (isNaN(status) || status < 400 || status > 599) {\n throw new Error(`HTTP error status codes must be between 400 and 599 — ${status} is invalid`);\n }\n return new HttpError(status, body);\n}\nfunction json(data, init2) {\n const body = JSON.stringify(data);\n const headers = new Headers(init2?.headers);\n if (!headers.has(\"content-length\")) {\n headers.set(\"content-length\", encoder$3.encode(body).byteLength.toString());\n }\n if (!headers.has(\"content-type\")) {\n headers.set(\"content-type\", \"application/json\");\n }\n return new Response(body, {\n ...init2,\n headers\n });\n}\nconst encoder$3 = new TextEncoder();\nfunction text(body, init2) {\n const headers = new Headers(init2?.headers);\n if (!headers.has(\"content-length\")) {\n const encoded = encoder$3.encode(body);\n headers.set(\"content-length\", encoded.byteLength.toString());\n return new Response(encoded, {\n ...init2,\n headers\n });\n }\n return new Response(body, {\n ...init2,\n headers\n });\n}\nfunction coalesce_to_error(err) {\n return err instanceof Error || err && /** @type {any} */\n err.name && /** @type {any} */\n err.message ? (\n /** @type {Error} */\n err\n ) : new Error(JSON.stringify(err));\n}\nfunction normalize_error(error2) {\n return (\n /** @type {import('../runtime/control.js').Redirect | import('../runtime/control.js').HttpError | Error} */\n error2\n );\n}\nfunction method_not_allowed(mod, method) {\n return text(`${method} method not allowed`, {\n status: 405,\n headers: {\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405\n // \"The server must generate an Allow header field in a 405 status code response\"\n allow: allowed_methods(mod).join(\", \")\n }\n });\n}\nfunction allowed_methods(mod) {\n const allowed = Array.from(ENDPOINT_METHODS).filter((method) => method in mod);\n if (\"GET\" in mod || \"HEAD\" in mod)\n allowed.push(\"HEAD\");\n return allowed;\n}\nfunction static_error_page(options2, status, message) {\n let page = options2.templates.error({ status, message });\n return text(page, {\n headers: { \"content-type\": \"text/html; charset=utf-8\" },\n status\n });\n}\nasync function handle_fatal_error(event, options2, error2) {\n error2 = error2 instanceof HttpError ? error2 : coalesce_to_error(error2);\n const status = error2 instanceof HttpError ? error2.status : 500;\n const body = await handle_error_and_jsonify(event, options2, error2);\n const type = negotiate(event.request.headers.get(\"accept\") || \"text/html\", [\n \"application/json\",\n \"text/html\"\n ]);\n if (event.isDataRequest || type === \"application/json\") {\n return json(body, {\n status\n });\n }\n return static_error_page(options2, status, body.message);\n}\nasync function handle_error_and_jsonify(event, options2, error2) {\n if (error2 instanceof HttpError) {\n return error2.body;\n } else {\n return await options2.hooks.handleError({ error: error2, event }) ?? {\n message: event.route.id != null ? \"Internal Error\" : \"Not Found\"\n };\n }\n}\nfunction redirect_response(status, location) {\n const response = new Response(void 0, {\n status,\n headers: { location }\n });\n return response;\n}\nfunction clarify_devalue_error(event, error2) {\n if (error2.path) {\n return `Data returned from \\`load\\` while rendering ${event.route.id} is not serializable: ${error2.message} (data${error2.path})`;\n }\n if (error2.path === \"\") {\n return `Data returned from \\`load\\` while rendering ${event.route.id} is not a plain object`;\n }\n return error2.message;\n}\nfunction stringify_uses(node) {\n const uses = [];\n if (node.uses && node.uses.dependencies.size > 0) {\n uses.push(`\"dependencies\":${JSON.stringify(Array.from(node.uses.dependencies))}`);\n }\n if (node.uses && node.uses.params.size > 0) {\n uses.push(`\"params\":${JSON.stringify(Array.from(node.uses.params))}`);\n }\n if (node.uses?.parent)\n uses.push('\"parent\":1');\n if (node.uses?.route)\n uses.push('\"route\":1');\n if (node.uses?.url)\n uses.push('\"url\":1');\n return `\"uses\":{${uses.join(\",\")}}`;\n}\nasync function render_endpoint(event, mod, state) {\n const method = (\n /** @type {import('types').HttpMethod} */\n event.request.method\n );\n let handler = mod[method] || mod.fallback;\n if (method === \"HEAD\" && mod.GET && !mod.HEAD) {\n handler = mod.GET;\n }\n if (!handler) {\n return method_not_allowed(mod, method);\n }\n const prerender = mod.prerender ?? state.prerender_default;\n if (prerender && (mod.POST || mod.PATCH || mod.PUT || mod.DELETE)) {\n throw new Error(\"Cannot prerender endpoints that have mutative methods\");\n }\n if (state.prerendering && !prerender) {\n if (state.depth > 0) {\n throw new Error(`${event.route.id} is not prerenderable`);\n } else {\n return new Response(void 0, { status: 204 });\n }\n }\n try {\n let response = await handler(\n /** @type {import('@sveltejs/kit').RequestEvent>} */\n event\n );\n if (!(response instanceof Response)) {\n throw new Error(\n `Invalid response from route ${event.url.pathname}: handler should return a Response object`\n );\n }\n if (state.prerendering) {\n response = new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers: new Headers(response.headers)\n });\n response.headers.set(\"x-sveltekit-prerender\", String(prerender));\n }\n return response;\n } catch (e) {\n if (e instanceof Redirect) {\n return new Response(void 0, {\n status: e.status,\n headers: { location: e.location }\n });\n }\n throw e;\n }\n}\nfunction is_endpoint_request(event) {\n const { method, headers } = event.request;\n if (ENDPOINT_METHODS.has(method) && !PAGE_METHODS.has(method)) {\n return true;\n }\n if (method === \"POST\" && headers.get(\"x-sveltekit-action\") === \"true\")\n return false;\n const accept = event.request.headers.get(\"accept\") ?? \"*/*\";\n return negotiate(accept, [\"*\", \"text/html\"]) !== \"text/html\";\n}\nfunction compact(arr) {\n return arr.filter(\n /** @returns {val is NonNullable} */\n (val) => val != null\n );\n}\nfunction normalize_path(path, trailing_slash) {\n if (path === \"/\" || trailing_slash === \"ignore\")\n return path;\n if (trailing_slash === \"never\") {\n return path.endsWith(\"/\") ? path.slice(0, -1) : path;\n } else if (trailing_slash === \"always\" && !path.endsWith(\"/\")) {\n return path + \"/\";\n }\n return path;\n}\nfunction decode_pathname(pathname) {\n return pathname.split(\"%25\").map(decodeURI).join(\"%25\");\n}\nfunction decode_params(params) {\n for (const key2 in params) {\n params[key2] = decodeURIComponent(params[key2]);\n }\n return params;\n}\nconst tracked_url_properties = (\n /** @type {const} */\n [\n \"href\",\n \"pathname\",\n \"search\",\n \"searchParams\",\n \"toString\",\n \"toJSON\"\n ]\n);\nfunction make_trackable(url, callback) {\n const tracked = new URL(url);\n for (const property of tracked_url_properties) {\n Object.defineProperty(tracked, property, {\n get() {\n callback();\n return url[property];\n },\n enumerable: true,\n configurable: true\n });\n }\n {\n tracked[Symbol.for(\"nodejs.util.inspect.custom\")] = (depth, opts, inspect) => {\n return inspect(url, opts);\n };\n }\n disable_hash(tracked);\n return tracked;\n}\nfunction disable_hash(url) {\n allow_nodejs_console_log(url);\n Object.defineProperty(url, \"hash\", {\n get() {\n throw new Error(\n \"Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead\"\n );\n }\n });\n}\nfunction disable_search(url) {\n allow_nodejs_console_log(url);\n for (const property of [\"search\", \"searchParams\"]) {\n Object.defineProperty(url, property, {\n get() {\n throw new Error(`Cannot access url.${property} on a page with prerendering enabled`);\n }\n });\n }\n}\nfunction allow_nodejs_console_log(url) {\n {\n url[Symbol.for(\"nodejs.util.inspect.custom\")] = (depth, opts, inspect) => {\n return inspect(new URL(url), opts);\n };\n }\n}\nconst DATA_SUFFIX = \"/__data.json\";\nfunction has_data_suffix(pathname) {\n return pathname.endsWith(DATA_SUFFIX);\n}\nfunction add_data_suffix(pathname) {\n return pathname.replace(/\\/$/, \"\") + DATA_SUFFIX;\n}\nfunction strip_data_suffix(pathname) {\n return pathname.slice(0, -DATA_SUFFIX.length);\n}\nfunction is_action_json_request(event) {\n const accept = negotiate(event.request.headers.get(\"accept\") ?? \"*/*\", [\n \"application/json\",\n \"text/html\"\n ]);\n return accept === \"application/json\" && event.request.method === \"POST\";\n}\nasync function handle_action_json_request(event, options2, server) {\n const actions = server?.actions;\n if (!actions) {\n const no_actions_error = error(405, \"POST method not allowed. No actions exist for this page\");\n return action_json(\n {\n type: \"error\",\n error: await handle_error_and_jsonify(event, options2, no_actions_error)\n },\n {\n status: no_actions_error.status,\n headers: {\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405\n // \"The server must generate an Allow header field in a 405 status code response\"\n allow: \"GET\"\n }\n }\n );\n }\n check_named_default_separate(actions);\n try {\n const data = await call_action(event, actions);\n if (false)\n ;\n if (data instanceof ActionFailure) {\n return action_json({\n type: \"failure\",\n status: data.status,\n // @ts-expect-error we assign a string to what is supposed to be an object. That's ok\n // because we don't use the object outside, and this way we have better code navigation\n // through knowing where the related interface is used.\n data: stringify_action_response(\n data.data,\n /** @type {string} */\n event.route.id\n )\n });\n } else {\n return action_json({\n type: \"success\",\n status: data ? 200 : 204,\n // @ts-expect-error see comment above\n data: stringify_action_response(\n data,\n /** @type {string} */\n event.route.id\n )\n });\n }\n } catch (e) {\n const err = normalize_error(e);\n if (err instanceof Redirect) {\n return action_json_redirect(err);\n }\n return action_json(\n {\n type: \"error\",\n error: await handle_error_and_jsonify(event, options2, check_incorrect_fail_use(err))\n },\n {\n status: err instanceof HttpError ? err.status : 500\n }\n );\n }\n}\nfunction check_incorrect_fail_use(error2) {\n return error2 instanceof ActionFailure ? new Error('Cannot \"throw fail()\". Use \"return fail()\"') : error2;\n}\nfunction action_json_redirect(redirect) {\n return action_json({\n type: \"redirect\",\n status: redirect.status,\n location: redirect.location\n });\n}\nfunction action_json(data, init2) {\n return json(data, init2);\n}\nfunction is_action_request(event) {\n return event.request.method === \"POST\";\n}\nasync function handle_action_request(event, server) {\n const actions = server?.actions;\n if (!actions) {\n event.setHeaders({\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405\n // \"The server must generate an Allow header field in a 405 status code response\"\n allow: \"GET\"\n });\n return {\n type: \"error\",\n error: error(405, \"POST method not allowed. No actions exist for this page\")\n };\n }\n check_named_default_separate(actions);\n try {\n const data = await call_action(event, actions);\n if (false)\n ;\n if (data instanceof ActionFailure) {\n return {\n type: \"failure\",\n status: data.status,\n data: data.data\n };\n } else {\n return {\n type: \"success\",\n status: 200,\n // @ts-expect-error this will be removed upon serialization, so `undefined` is the same as omission\n data\n };\n }\n } catch (e) {\n const err = normalize_error(e);\n if (err instanceof Redirect) {\n return {\n type: \"redirect\",\n status: err.status,\n location: err.location\n };\n }\n return {\n type: \"error\",\n error: check_incorrect_fail_use(err)\n };\n }\n}\nfunction check_named_default_separate(actions) {\n if (actions.default && Object.keys(actions).length > 1) {\n throw new Error(\n \"When using named actions, the default action cannot be used. See the docs for more info: https://kit.svelte.dev/docs/form-actions#named-actions\"\n );\n }\n}\nasync function call_action(event, actions) {\n const url = new URL(event.request.url);\n let name = \"default\";\n for (const param of url.searchParams) {\n if (param[0].startsWith(\"/\")) {\n name = param[0].slice(1);\n if (name === \"default\") {\n throw new Error('Cannot use reserved action name \"default\"');\n }\n break;\n }\n }\n const action = actions[name];\n if (!action) {\n throw new Error(`No action with name '${name}' found`);\n }\n if (!is_form_content_type(event.request)) {\n throw new Error(\n `Actions expect form-encoded data (received ${event.request.headers.get(\"content-type\")})`\n );\n }\n return action(event);\n}\nfunction validate_action_return(data) {\n if (data instanceof Redirect) {\n throw new Error(\"Cannot `return redirect(...)` — use `throw redirect(...)` instead\");\n }\n if (data instanceof HttpError) {\n throw new Error(\n \"Cannot `return error(...)` — use `throw error(...)` or `return fail(...)` instead\"\n );\n }\n}\nfunction uneval_action_response(data, route_id) {\n return try_deserialize(data, devalue.uneval, route_id);\n}\nfunction stringify_action_response(data, route_id) {\n return try_deserialize(data, devalue.stringify, route_id);\n}\nfunction try_deserialize(data, fn, route_id) {\n try {\n return fn(data);\n } catch (e) {\n const error2 = (\n /** @type {any} */\n e\n );\n if (\"path\" in error2) {\n let message = `Data returned from action inside ${route_id} is not serializable: ${error2.message}`;\n if (error2.path !== \"\")\n message += ` (data.${error2.path})`;\n throw new Error(message);\n }\n throw error2;\n }\n}\nasync function unwrap_promises(object) {\n for (const key2 in object) {\n if (typeof object[key2]?.then === \"function\") {\n return Object.fromEntries(\n await Promise.all(Object.entries(object).map(async ([key3, value]) => [key3, await value]))\n );\n }\n }\n return object;\n}\nconst INVALIDATED_PARAM = \"x-sveltekit-invalidated\";\nconst TRAILING_SLASH_PARAM = \"x-sveltekit-trailing-slash\";\nasync function load_server_data({\n event,\n state,\n node,\n parent,\n // TODO 2.0: Remove this\n track_server_fetches\n}) {\n if (!node?.server)\n return null;\n const uses = {\n dependencies: /* @__PURE__ */ new Set(),\n params: /* @__PURE__ */ new Set(),\n parent: false,\n route: false,\n url: false\n };\n const url = make_trackable(event.url, () => {\n uses.url = true;\n });\n if (state.prerendering) {\n disable_search(url);\n }\n const result = await node.server.load?.call(null, {\n ...event,\n fetch: (info, init2) => {\n const url2 = new URL(info instanceof Request ? info.url : info, event.url);\n if (track_server_fetches) {\n uses.dependencies.add(url2.href);\n }\n return event.fetch(info, init2);\n },\n /** @param {string[]} deps */\n depends: (...deps) => {\n for (const dep of deps) {\n const { href } = new URL(dep, event.url);\n uses.dependencies.add(href);\n }\n },\n params: new Proxy(event.params, {\n get: (target, key2) => {\n uses.params.add(key2);\n return target[\n /** @type {string} */\n key2\n ];\n }\n }),\n parent: async () => {\n uses.parent = true;\n return parent();\n },\n route: new Proxy(event.route, {\n get: (target, key2) => {\n uses.route = true;\n return target[\n /** @type {'id'} */\n key2\n ];\n }\n }),\n url\n });\n const data = result ? await unwrap_promises(result) : null;\n return {\n type: \"data\",\n data,\n uses,\n slash: node.server.trailingSlash\n };\n}\nasync function load_data({\n event,\n fetched,\n node,\n parent,\n server_data_promise,\n state,\n resolve_opts,\n csr\n}) {\n const server_data_node = await server_data_promise;\n if (!node?.universal?.load) {\n return server_data_node?.data ?? null;\n }\n const result = await node.universal.load.call(null, {\n url: event.url,\n params: event.params,\n data: server_data_node?.data ?? null,\n route: event.route,\n fetch: create_universal_fetch(event, state, fetched, csr, resolve_opts),\n setHeaders: event.setHeaders,\n depends: () => {\n },\n parent\n });\n const data = result ? await unwrap_promises(result) : null;\n return data;\n}\nfunction create_universal_fetch(event, state, fetched, csr, resolve_opts) {\n return async (input, init2) => {\n const cloned_body = input instanceof Request && input.body ? input.clone().body : null;\n const cloned_headers = input instanceof Request && [...input.headers].length ? new Headers(input.headers) : init2?.headers;\n let response = await event.fetch(input, init2);\n const url = new URL(input instanceof Request ? input.url : input, event.url);\n const same_origin = url.origin === event.url.origin;\n let dependency;\n if (same_origin) {\n if (state.prerendering) {\n dependency = { response, body: null };\n state.prerendering.dependencies.set(url.pathname, dependency);\n }\n } else {\n const mode = input instanceof Request ? input.mode : init2?.mode ?? \"cors\";\n if (mode === \"no-cors\") {\n response = new Response(\"\", {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers\n });\n } else {\n const acao = response.headers.get(\"access-control-allow-origin\");\n if (!acao || acao !== event.url.origin && acao !== \"*\") {\n throw new Error(\n `CORS error: ${acao ? \"Incorrect\" : \"No\"} 'Access-Control-Allow-Origin' header is present on the requested resource`\n );\n }\n }\n }\n const proxy = new Proxy(response, {\n get(response2, key2, _receiver) {\n async function text2() {\n const body = await response2.text();\n if (!body || typeof body === \"string\") {\n const status_number = Number(response2.status);\n if (isNaN(status_number)) {\n throw new Error(\n `response.status is not a number. value: \"${response2.status}\" type: ${typeof response2.status}`\n );\n }\n fetched.push({\n url: same_origin ? url.href.slice(event.url.origin.length) : url.href,\n method: event.request.method,\n request_body: (\n /** @type {string | ArrayBufferView | undefined} */\n input instanceof Request && cloned_body ? await stream_to_string(cloned_body) : init2?.body\n ),\n request_headers: cloned_headers,\n response_body: body,\n response: response2\n });\n }\n if (dependency) {\n dependency.body = body;\n }\n return body;\n }\n if (key2 === \"arrayBuffer\") {\n return async () => {\n const buffer = await response2.arrayBuffer();\n if (dependency) {\n dependency.body = new Uint8Array(buffer);\n }\n return buffer;\n };\n }\n if (key2 === \"text\") {\n return text2;\n }\n if (key2 === \"json\") {\n return async () => {\n return JSON.parse(await text2());\n };\n }\n return Reflect.get(response2, key2, response2);\n }\n });\n if (csr) {\n const get = response.headers.get;\n response.headers.get = (key2) => {\n const lower = key2.toLowerCase();\n const value = get.call(response.headers, lower);\n if (value && !lower.startsWith(\"x-sveltekit-\")) {\n const included = resolve_opts.filterSerializedResponseHeaders(lower, value);\n if (!included) {\n throw new Error(\n `Failed to get response header \"${lower}\" — it must be included by the \\`filterSerializedResponseHeaders\\` option: https://kit.svelte.dev/docs/hooks#server-hooks-handle (at ${event.route.id})`\n );\n }\n }\n return value;\n };\n }\n return proxy;\n };\n}\nasync function stream_to_string(stream) {\n let result = \"\";\n const reader = stream.getReader();\n const decoder = new TextDecoder();\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n result += decoder.decode(value);\n }\n return result;\n}\nconst subscriber_queue = [];\nfunction readable(value, start) {\n return {\n subscribe: writable(value, start).subscribe\n };\n}\nfunction writable(value, start = noop) {\n let stop;\n const subscribers = /* @__PURE__ */ new Set();\n function set(new_value) {\n if (safe_not_equal(value, new_value)) {\n value = new_value;\n if (stop) {\n const run_queue = !subscriber_queue.length;\n for (const subscriber of subscribers) {\n subscriber[1]();\n subscriber_queue.push(subscriber, value);\n }\n if (run_queue) {\n for (let i = 0; i < subscriber_queue.length; i += 2) {\n subscriber_queue[i][0](subscriber_queue[i + 1]);\n }\n subscriber_queue.length = 0;\n }\n }\n }\n }\n function update(fn) {\n set(fn(value));\n }\n function subscribe(run, invalidate = noop) {\n const subscriber = [run, invalidate];\n subscribers.add(subscriber);\n if (subscribers.size === 1) {\n stop = start(set, update) || noop;\n }\n run(value);\n return () => {\n subscribers.delete(subscriber);\n if (subscribers.size === 0 && stop) {\n stop();\n stop = null;\n }\n };\n }\n return { set, update, subscribe };\n}\nfunction hash(...values) {\n let hash2 = 5381;\n for (const value of values) {\n if (typeof value === \"string\") {\n let i = value.length;\n while (i)\n hash2 = hash2 * 33 ^ value.charCodeAt(--i);\n } else if (ArrayBuffer.isView(value)) {\n const buffer = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);\n let i = buffer.length;\n while (i)\n hash2 = hash2 * 33 ^ buffer[--i];\n } else {\n throw new TypeError(\"value must be a string or TypedArray\");\n }\n }\n return (hash2 >>> 0).toString(36);\n}\nconst escape_html_attr_dict = {\n \"&\": \"&\",\n '\"': \""\"\n};\nconst escape_html_attr_regex = new RegExp(\n // special characters\n `[${Object.keys(escape_html_attr_dict).join(\"\")}]|[\\\\ud800-\\\\udbff](?![\\\\udc00-\\\\udfff])|[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]|[\\\\udc00-\\\\udfff]`,\n \"g\"\n);\nfunction escape_html_attr(str) {\n const escaped_str = str.replace(escape_html_attr_regex, (match) => {\n if (match.length === 2) {\n return match;\n }\n return escape_html_attr_dict[match] ?? `&#${match.charCodeAt(0)};`;\n });\n return `\"${escaped_str}\"`;\n}\nconst replacements = {\n \"<\": \"\\\\u003C\",\n \"\\u2028\": \"\\\\u2028\",\n \"\\u2029\": \"\\\\u2029\"\n};\nconst pattern = new RegExp(`[${Object.keys(replacements).join(\"\")}]`, \"g\");\nfunction serialize_data(fetched, filter, prerendering = false) {\n const headers = {};\n let cache_control = null;\n let age = null;\n let varyAny = false;\n for (const [key2, value] of fetched.response.headers) {\n if (filter(key2, value)) {\n headers[key2] = value;\n }\n if (key2 === \"cache-control\")\n cache_control = value;\n else if (key2 === \"age\")\n age = value;\n else if (key2 === \"vary\" && value.trim() === \"*\")\n varyAny = true;\n }\n const payload = {\n status: fetched.response.status,\n statusText: fetched.response.statusText,\n headers,\n body: fetched.response_body\n };\n const safe_payload = JSON.stringify(payload).replace(pattern, (match) => replacements[match]);\n const attrs = [\n 'type=\"application/json\"',\n \"data-sveltekit-fetched\",\n `data-url=${escape_html_attr(fetched.url)}`\n ];\n if (fetched.request_headers || fetched.request_body) {\n const values = [];\n if (fetched.request_headers) {\n values.push([...new Headers(fetched.request_headers)].join(\",\"));\n }\n if (fetched.request_body) {\n values.push(fetched.request_body);\n }\n attrs.push(`data-hash=\"${hash(...values)}\"`);\n }\n if (!prerendering && fetched.method === \"GET\" && cache_control && !varyAny) {\n const match = /s-maxage=(\\d+)/g.exec(cache_control) ?? /max-age=(\\d+)/g.exec(cache_control);\n if (match) {\n const ttl = +match[1] - +(age ?? \"0\");\n attrs.push(`data-ttl=\"${ttl}\"`);\n }\n }\n return `