options.expires) || !Number.isFinite(options.expires.valueOf())) { throw new TypeError(`option expires is invalid: ${options.expires}`); } str += "; Expires=" + options.expires.toUTCString(); } if (options.httpOnly) { str += "; HttpOnly"; } if (options.secure) { str += "; Secure"; } if (options.partitioned) { str += "; Partitioned"; } if (options.priority) { const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0; switch (priority) { case "low": str += "; Priority=Low"; break; case "medium": str += "; Priority=Medium"; break; case "high": str += "; Priority=High"; break; default: throw new TypeError(`option priority is invalid: ${options.priority}`); } } if (options.sameSite) { const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite; switch (sameSite) { case true: case "strict": str += "; SameSite=Strict"; break; case "lax": str += "; SameSite=Lax"; break; case "none": str += "; SameSite=None"; break; default: throw new TypeError(`option sameSite is invalid: ${options.sameSite}`); } } return str; } function decode2(str) { if (str.indexOf("%") === -1) return str; try { return decodeURIComponent(str); } catch (e) { return str; } } function isDate(val) { return __toString.call(val) === "[object Date]"; } } }); // node_modules/set-cookie-parser/lib/set-cookie.js var require_set_cookie = __commonJS({ "node_modules/set-cookie-parser/lib/set-cookie.js"(exports, module) { "use strict"; var defaultParseOptions = { decodeValues: true, map: false, silent: false }; function isNonEmptyString(str) { return typeof str === "string" && !!str.trim(); } function parseString(setCookieValue, options) { var parts = setCookieValue.split(";").filter(isNonEmptyString); var nameValuePairStr = parts.shift(); var parsed = parseNameValuePair(nameValuePairStr); var name = parsed.name; var value = parsed.value; options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions; try { value = options.decodeValues ? decodeURIComponent(value) : value; } catch (e) { console.error( "set-cookie-parser encountered an error while decoding a cookie with value '" + value + "'. Set options.decodeValues to false to disable this feature.", e ); } var cookie = { name, value }; parts.forEach(function(part) { var sides = part.split("="); var key = sides.shift().trimLeft().toLowerCase(); var value2 = sides.join("="); if (key === "expires") { cookie.expires = new Date(value2); } else if (key === "max-age") { cookie.maxAge = parseInt(value2, 10); } else if (key === "secure") { cookie.secure = true; } else if (key === "httponly") { cookie.httpOnly = true; } else if (key === "samesite") { cookie.sameSite = value2; } else if (key === "partitioned") { cookie.partitioned = true; } else { cookie[key] = value2; } }); return cookie; } function parseNameValuePair(nameValuePairStr) { var name = ""; var value = ""; var nameValueArr = nameValuePairStr.split("="); if (nameValueArr.length > 1) { name = nameValueArr.shift(); value = nameValueArr.join("="); } else { value = nameValuePairStr; } return { name, value }; } function parse2(input, options) { options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions; if (!input) { if (!options.map) { return []; } else { return {}; } } if (input.headers) { if (typeof input.headers.getSetCookie === "function") { input = input.headers.getSetCookie(); } else if (input.headers["set-cookie"]) { input = input.headers["set-cookie"]; } else { var sch = input.headers[Object.keys(input.headers).find(function(key) { return key.toLowerCase() === "set-cookie"; })]; if (!sch && input.headers.cookie && !options.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." ); } input = sch; } } if (!Array.isArray(input)) { input = [input]; } if (!options.map) { return input.filter(isNonEmptyString).map(function(str) { return parseString(str, options); }); } else { var cookies = {}; return input.filter(isNonEmptyString).reduce(function(cookies2, str) { var cookie = parseString(str, options); cookies2[cookie.name] = cookie; return cookies2; }, cookies); } } function splitCookiesString2(cookiesString) { if (Array.isArray(cookiesString)) { return cookiesString; } if (typeof cookiesString !== "string") { return []; } var cookiesStrings = []; var pos = 0; var start; var ch; var lastComma; var nextStart; var cookiesSeparatorFound; function skipWhitespace() { while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) { pos += 1; } return pos < cookiesString.length; } function notSpecialChar() { ch = cookiesString.charAt(pos); return ch !== "=" && ch !== ";" && ch !== ","; } while (pos < cookiesString.length) { start = pos; cookiesSeparatorFound = false; while (skipWhitespace()) { ch = cookiesString.charAt(pos); if (ch === ",") { lastComma = pos; pos += 1; skipWhitespace(); nextStart = pos; while (pos < cookiesString.length && notSpecialChar()) { pos += 1; } if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") { cookiesSeparatorFound = true; pos = nextStart; cookiesStrings.push(cookiesString.substring(start, lastComma)); start = pos; } else { pos = lastComma + 1; } } else { pos += 1; } } if (!cookiesSeparatorFound || pos >= cookiesString.length) { cookiesStrings.push(cookiesString.substring(start, cookiesString.length)); } } return cookiesStrings; } module.exports = parse2; module.exports.parse = parse2; module.exports.parseString = parseString; module.exports.splitCookiesString = splitCookiesString2; } }); // node_modules/react-router/dist/development/chunk-K6CSEXPM.mjs var React3 = __toESM(require_react(), 1); var React = __toESM(require_react(), 1); var React2 = __toESM(require_react(), 1); var React10 = __toESM(require_react(), 1); var React9 = __toESM(require_react(), 1); var React4 = __toESM(require_react(), 1); // node_modules/turbo-stream/dist/turbo-stream.mjs var HOLE = -1; var NAN = -2; var NEGATIVE_INFINITY = -3; var NEGATIVE_ZERO = -4; var NULL = -5; var POSITIVE_INFINITY = -6; var UNDEFINED = -7; var TYPE_BIGINT = "B"; var TYPE_DATE = "D"; var TYPE_ERROR = "E"; var TYPE_MAP = "M"; var TYPE_NULL_OBJECT = "N"; var TYPE_PROMISE = "P"; var TYPE_REGEXP = "R"; var TYPE_SET = "S"; var TYPE_SYMBOL = "Y"; var TYPE_URL = "U"; var TYPE_PREVIOUS_RESOLVED = "Z"; var Deferred = class { promise; resolve; reject; constructor() { this.promise = new Promise((resolve, reject) => { this.resolve = resolve; this.reject = reject; }); } }; function createLineSplittingTransform() { const decoder = new TextDecoder(); let leftover = ""; return new TransformStream({ transform(chunk, controller) { const str = decoder.decode(chunk, { stream: true }); const parts = (leftover + str).split("\n"); leftover = parts.pop() || ""; for (const part of parts) { controller.enqueue(part); } }, flush(controller) { if (leftover) { controller.enqueue(leftover); } } }); } function flatten(input) { const { indices } = this; const existing = indices.get(input); if (existing) return [existing]; if (input === void 0) return UNDEFINED; if (input === null) return NULL; if (Number.isNaN(input)) return NAN; if (input === Number.POSITIVE_INFINITY) return POSITIVE_INFINITY; if (input === Number.NEGATIVE_INFINITY) return NEGATIVE_INFINITY; if (input === 0 && 1 / input < 0) return NEGATIVE_ZERO; const index = this.index++; indices.set(input, index); stringify.call(this, input, index); return index; } function stringify(input, index) { const { deferred, plugins, postPlugins } = this; const str = this.stringified; const stack = [[input, index]]; while (stack.length > 0) { const [input2, index2] = stack.pop(); const partsForObj = (obj) => Object.keys(obj).map((k) => `"_${flatten.call(this, k)}":${flatten.call(this, obj[k])}`).join(","); let error = null; switch (typeof input2) { case "boolean": case "number": case "string": str[index2] = JSON.stringify(input2); break; case "bigint": str[index2] = `["${TYPE_BIGINT}","${input2}"]`; break; case "symbol": { const keyFor = Symbol.keyFor(input2); if (!keyFor) { error = new Error( "Cannot encode symbol unless created with Symbol.for()" ); } else { str[index2] = `["${TYPE_SYMBOL}",${JSON.stringify(keyFor)}]`; } break; } case "object": { if (!input2) { str[index2] = `${NULL}`; break; } const isArray = Array.isArray(input2); let pluginHandled = false; if (!isArray && plugins) { for (const plugin of plugins) { const pluginResult = plugin(input2); if (Array.isArray(pluginResult)) { pluginHandled = true; const [pluginIdentifier, ...rest] = pluginResult; str[index2] = `[${JSON.stringify(pluginIdentifier)}`; if (rest.length > 0) { str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`; } str[index2] += "]"; break; } } } if (!pluginHandled) { let result = isArray ? "[" : "{"; if (isArray) { for (let i = 0; i < input2.length; i++) result += (i ? "," : "") + (i in input2 ? flatten.call(this, input2[i]) : HOLE); str[index2] = `${result}]`; } else if (input2 instanceof Date) { str[index2] = `["${TYPE_DATE}",${input2.getTime()}]`; } else if (input2 instanceof URL) { str[index2] = `["${TYPE_URL}",${JSON.stringify(input2.href)}]`; } else if (input2 instanceof RegExp) { str[index2] = `["${TYPE_REGEXP}",${JSON.stringify( input2.source )},${JSON.stringify(input2.flags)}]`; } else if (input2 instanceof Set) { if (input2.size > 0) { str[index2] = `["${TYPE_SET}",${[...input2].map((val) => flatten.call(this, val)).join(",")}]`; } else { str[index2] = `["${TYPE_SET}"]`; } } else if (input2 instanceof Map) { if (input2.size > 0) { str[index2] = `["${TYPE_MAP}",${[...input2].flatMap(([k, v]) => [ flatten.call(this, k), flatten.call(this, v) ]).join(",")}]`; } else { str[index2] = `["${TYPE_MAP}"]`; } } else if (input2 instanceof Promise) { str[index2] = `["${TYPE_PROMISE}",${index2}]`; deferred[index2] = input2; } else if (input2 instanceof Error) { str[index2] = `["${TYPE_ERROR}",${JSON.stringify(input2.message)}`; if (input2.name !== "Error") { str[index2] += `,${JSON.stringify(input2.name)}`; } str[index2] += "]"; } else if (Object.getPrototypeOf(input2) === null) { str[index2] = `["${TYPE_NULL_OBJECT}",{${partsForObj(input2)}}]`; } else if (isPlainObject(input2)) { str[index2] = `{${partsForObj(input2)}}`; } else { error = new Error("Cannot encode object with prototype"); } } break; } default: { const isArray = Array.isArray(input2); let pluginHandled = false; if (!isArray && plugins) { for (const plugin of plugins) { const pluginResult = plugin(input2); if (Array.isArray(pluginResult)) { pluginHandled = true; const [pluginIdentifier, ...rest] = pluginResult; str[index2] = `[${JSON.stringify(pluginIdentifier)}`; if (rest.length > 0) { str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`; } str[index2] += "]"; break; } } } if (!pluginHandled) { error = new Error("Cannot encode function or unexpected type"); } } } if (error) { let pluginHandled = false; if (postPlugins) { for (const plugin of postPlugins) { const pluginResult = plugin(input2); if (Array.isArray(pluginResult)) { pluginHandled = true; const [pluginIdentifier, ...rest] = pluginResult; str[index2] = `[${JSON.stringify(pluginIdentifier)}`; if (rest.length > 0) { str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`; } str[index2] += "]"; break; } } } if (!pluginHandled) { throw error; } } } } var objectProtoNames = Object.getOwnPropertyNames(Object.prototype).sort().join("\0"); function isPlainObject(thing) { const proto = Object.getPrototypeOf(thing); return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames; } var globalObj = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : void 0; function unflatten(parsed) { const { hydrated, values } = this; if (typeof parsed === "number") return hydrate.call(this, parsed); if (!Array.isArray(parsed) || !parsed.length) throw new SyntaxError(); const startIndex = values.length; for (const value of parsed) { values.push(value); } hydrated.length = values.length; return hydrate.call(this, startIndex); } function hydrate(index) { const { hydrated, values, deferred, plugins } = this; let result; const stack = [ [ index, (v) => { result = v; } ] ]; let postRun = []; while (stack.length > 0) { const [index2, set] = stack.pop(); switch (index2) { case UNDEFINED: set(void 0); continue; case NULL: set(null); continue; case NAN: set(NaN); continue; case POSITIVE_INFINITY: set(Infinity); continue; case NEGATIVE_INFINITY: set(-Infinity); continue; case NEGATIVE_ZERO: set(-0); continue; } if (hydrated[index2]) { set(hydrated[index2]); continue; } const value = values[index2]; if (!value || typeof value !== "object") { hydrated[index2] = value; set(value); continue; } if (Array.isArray(value)) { if (typeof value[0] === "string") { const [type, b, c] = value; switch (type) { case TYPE_DATE: set(hydrated[index2] = new Date(b)); continue; case TYPE_URL: set(hydrated[index2] = new URL(b)); continue; case TYPE_BIGINT: set(hydrated[index2] = BigInt(b)); continue; case TYPE_REGEXP: set(hydrated[index2] = new RegExp(b, c)); continue; case TYPE_SYMBOL: set(hydrated[index2] = Symbol.for(b)); continue; case TYPE_SET: const newSet = /* @__PURE__ */ new Set(); hydrated[index2] = newSet; for (let i = 1; i < value.length; i++) stack.push([ value[i], (v) => { newSet.add(v); } ]); set(newSet); continue; case TYPE_MAP: const map = /* @__PURE__ */ new Map(); hydrated[index2] = map; for (let i = 1; i < value.length; i += 2) { const r = []; stack.push([ value[i + 1], (v) => { r[1] = v; } ]); stack.push([ value[i], (k) => { r[0] = k; } ]); postRun.push(() => { map.set(r[0], r[1]); }); } set(map); continue; case TYPE_NULL_OBJECT: const obj = /* @__PURE__ */ Object.create(null); hydrated[index2] = obj; for (const key of Object.keys(b).reverse()) { const r = []; stack.push([ b[key], (v) => { r[1] = v; } ]); stack.push([ Number(key.slice(1)), (k) => { r[0] = k; } ]); postRun.push(() => { obj[r[0]] = r[1]; }); } set(obj); continue; case TYPE_PROMISE: if (hydrated[b]) { set(hydrated[index2] = hydrated[b]); } else { const d = new Deferred(); deferred[b] = d; set(hydrated[index2] = d.promise); } continue; case TYPE_ERROR: const [, message, errorType] = value; let error = errorType && globalObj && globalObj[errorType] ? new globalObj[errorType](message) : new Error(message); hydrated[index2] = error; set(error); continue; case TYPE_PREVIOUS_RESOLVED: set(hydrated[index2] = hydrated[b]); continue; default: if (Array.isArray(plugins)) { const r = []; const vals = value.slice(1); for (let i = 0; i < vals.length; i++) { const v = vals[i]; stack.push([ v, (v2) => { r[i] = v2; } ]); } postRun.push(() => { for (const plugin of plugins) { const result2 = plugin(value[0], ...r); if (result2) { set(hydrated[index2] = result2.value); return; } } throw new SyntaxError(); }); continue; } throw new SyntaxError(); } } else { const array = []; hydrated[index2] = array; for (let i = 0; i < value.length; i++) { const n = value[i]; if (n !== HOLE) { stack.push([ n, (v) => { array[i] = v; } ]); } } set(array); continue; } } else { const object = {}; hydrated[index2] = object; for (const key of Object.keys(value).reverse()) { const r = []; stack.push([ value[key], (v) => { r[1] = v; } ]); stack.push([ Number(key.slice(1)), (k) => { r[0] = k; } ]); postRun.push(() => { object[r[0]] = r[1]; }); } set(object); continue; } } while (postRun.length > 0) { postRun.pop()(); } return result; } async function decode(readable, options) { const { plugins } = options ?? {}; const done = new Deferred(); const reader = readable.pipeThrough(createLineSplittingTransform()).getReader(); const decoder = { values: [], hydrated: [], deferred: {}, plugins }; const decoded = await decodeInitial.call(decoder, reader); let donePromise = done.promise; if (decoded.done) { done.resolve(); } else { donePromise = decodeDeferred.call(decoder, reader).then(done.resolve).catch((reason) => { for (const deferred of Object.values(decoder.deferred)) { deferred.reject(reason); } done.reject(reason); }); } return { done: donePromise.then(() => reader.closed), value: decoded.value }; } async function decodeInitial(reader) { const read = await reader.read(); if (!read.value) { throw new SyntaxError(); } let line; try { line = JSON.parse(read.value); } catch (reason) { throw new SyntaxError(); } return { done: read.done, value: unflatten.call(this, line) }; } async function decodeDeferred(reader) { let read = await reader.read(); while (!read.done) { if (!read.value) continue; const line = read.value; switch (line[0]) { case TYPE_PROMISE: { const colonIndex = line.indexOf(":"); const deferredId = Number(line.slice(1, colonIndex)); const deferred = this.deferred[deferredId]; if (!deferred) { throw new Error(`Deferred ID ${deferredId} not found in stream`); } const lineData = line.slice(colonIndex + 1); let jsonLine; try { jsonLine = JSON.parse(lineData); } catch (reason) { throw new SyntaxError(); } const value = unflatten.call(this, jsonLine); deferred.resolve(value); break; } case TYPE_ERROR: { const colonIndex = line.indexOf(":"); const deferredId = Number(line.slice(1, colonIndex)); const deferred = this.deferred[deferredId]; if (!deferred) { throw new Error(`Deferred ID ${deferredId} not found in stream`); } const lineData = line.slice(colonIndex + 1); let jsonLine; try { jsonLine = JSON.parse(lineData); } catch (reason) { throw new SyntaxError(); } const value = unflatten.call(this, jsonLine); deferred.reject(value); break; } default: throw new SyntaxError(); } read = await reader.read(); } } function encode(input, options) { const { plugins, postPlugins, signal } = options ?? {}; const encoder2 = { deferred: {}, index: 0, indices: /* @__PURE__ */ new Map(), stringified: [], plugins, postPlugins, signal }; const textEncoder = new TextEncoder(); let lastSentIndex = 0; const readable = new ReadableStream({ async start(controller) { const id = flatten.call(encoder2, input); if (Array.isArray(id)) { throw new Error("This should never happen"); } if (id < 0) { controller.enqueue(textEncoder.encode(`${id} `)); } else { controller.enqueue( textEncoder.encode(`[${encoder2.stringified.join(",")}] `) ); lastSentIndex = encoder2.stringified.length - 1; } const seenPromises = /* @__PURE__ */ new WeakSet(); while (Object.keys(encoder2.deferred).length > 0) { for (const [deferredId, deferred] of Object.entries(encoder2.deferred)) { if (seenPromises.has(deferred)) continue; seenPromises.add( encoder2.deferred[Number(deferredId)] = raceSignal( deferred, encoder2.signal ).then( (resolved) => { const id2 = flatten.call(encoder2, resolved); if (Array.isArray(id2)) { controller.enqueue( textEncoder.encode( `${TYPE_PROMISE}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]] ` ) ); encoder2.index++; lastSentIndex++; } else if (id2 < 0) { controller.enqueue( textEncoder.encode(`${TYPE_PROMISE}${deferredId}:${id2} `) ); } else { const values = encoder2.stringified.slice(lastSentIndex + 1).join(","); controller.enqueue( textEncoder.encode( `${TYPE_PROMISE}${deferredId}:[${values}] ` ) ); lastSentIndex = encoder2.stringified.length - 1; } }, (reason) => { if (!reason || typeof reason !== "object" || !(reason instanceof Error)) { reason = new Error("An unknown error occurred"); } const id2 = flatten.call(encoder2, reason); if (Array.isArray(id2)) { controller.enqueue( textEncoder.encode( `${TYPE_ERROR}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]] ` ) ); encoder2.index++; lastSentIndex++; } else if (id2 < 0) { controller.enqueue( textEncoder.encode(`${TYPE_ERROR}${deferredId}:${id2} `) ); } else { const values = encoder2.stringified.slice(lastSentIndex + 1).join(","); controller.enqueue( textEncoder.encode( `${TYPE_ERROR}${deferredId}:[${values}] ` ) ); lastSentIndex = encoder2.stringified.length - 1; } } ).finally(() => { delete encoder2.deferred[Number(deferredId)]; }) ); } await Promise.race(Object.values(encoder2.deferred)); } await Promise.all(Object.values(encoder2.deferred)); controller.close(); } }); return readable; } function raceSignal(promise, signal) { if (!signal) return promise; if (signal.aborted) return Promise.reject(signal.reason || new Error("Signal was aborted.")); const abort = new Promise((resolve, reject) => { signal.addEventListener("abort", (event) => { reject(signal.reason || new Error("Signal was aborted.")); }); promise.then(resolve).catch(reject); }); abort.catch(() => { }); return Promise.race([abort, promise]); } // node_modules/react-router/dist/development/chunk-K6CSEXPM.mjs var React8 = __toESM(require_react(), 1); var React7 = __toESM(require_react(), 1); var React5 = __toESM(require_react(), 1); var React6 = __toESM(require_react(), 1); var React11 = __toESM(require_react(), 1); var React12 = __toESM(require_react(), 1); var React13 = __toESM(require_react(), 1); var import_cookie = __toESM(require_dist(), 1); var import_set_cookie_parser = __toESM(require_set_cookie(), 1); var __typeError = (msg) => { throw TypeError(msg); }; var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); var Action = ((Action2) => { Action2["Pop"] = "POP"; Action2["Push"] = "PUSH"; Action2["Replace"] = "REPLACE"; return Action2; })(Action || {}); var PopStateEventType = "popstate"; function createMemoryHistory(options = {}) { let { initialEntries = ["/"], initialIndex, v5Compat = false } = options; let entries; entries = initialEntries.map( (entry, index2) => createMemoryLocation( entry, typeof entry === "string" ? null : entry.state, index2 === 0 ? "default" : void 0 ) ); let index = clampIndex( initialIndex == null ? entries.length - 1 : initialIndex ); let action = "POP"; let listener = null; function clampIndex(n) { return Math.min(Math.max(n, 0), entries.length - 1); } function getCurrentLocation() { return entries[index]; } function createMemoryLocation(to, state = null, key) { let location = createLocation( entries ? getCurrentLocation().pathname : "/", to, state, key ); warning( location.pathname.charAt(0) === "/", `relative pathnames are not supported in memory history: ${JSON.stringify( to )}` ); return location; } function createHref2(to) { return typeof to === "string" ? to : createPath(to); } let history = { get index() { return index; }, get action() { return action; }, get location() { return getCurrentLocation(); }, createHref: createHref2, createURL(to) { return new URL(createHref2(to), "http://localhost"); }, encodeLocation(to) { let path = typeof to === "string" ? parsePath(to) : to; return { pathname: path.pathname || "", search: path.search || "", hash: path.hash || "" }; }, push(to, state) { action = "PUSH"; let nextLocation = createMemoryLocation(to, state); index += 1; entries.splice(index, entries.length, nextLocation); if (v5Compat && listener) { listener({ action, location: nextLocation, delta: 1 }); } }, replace(to, state) { action = "REPLACE"; let nextLocation = createMemoryLocation(to, state); entries[index] = nextLocation; if (v5Compat && listener) { listener({ action, location: nextLocation, delta: 0 }); } }, go(delta) { action = "POP"; let nextIndex = clampIndex(index + delta); let nextLocation = entries[nextIndex]; index = nextIndex; if (listener) { listener({ action, location: nextLocation, delta }); } }, listen(fn) { listener = fn; return () => { listener = null; }; } }; return history; } function createBrowserHistory(options = {}) { function createBrowserLocation(window2, globalHistory) { let { pathname, search, hash } = window2.location; return createLocation( "", { pathname, search, hash }, // state defaults to `null` because `window.history.state` does globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || "default" ); } function createBrowserHref(window2, to) { return typeof to === "string" ? to : createPath(to); } return getUrlBasedHistory( createBrowserLocation, createBrowserHref, null, options ); } function createHashHistory(options = {}) { function createHashLocation(window2, globalHistory) { let { pathname = "/", search = "", hash = "" } = parsePath(window2.location.hash.substring(1)); if (!pathname.startsWith("/") && !pathname.startsWith(".")) { pathname = "/" + pathname; } return createLocation( "", { pathname, search, hash }, // state defaults to `null` because `window.history.state` does globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || "default" ); } function createHashHref(window2, to) { let base = window2.document.querySelector("base"); let href2 = ""; if (base && base.getAttribute("href")) { let url = window2.location.href; let hashIndex = url.indexOf("#"); href2 = hashIndex === -1 ? url : url.slice(0, hashIndex); } return href2 + "#" + (typeof to === "string" ? to : createPath(to)); } function validateHashLocation(location, to) { warning( location.pathname.charAt(0) === "/", `relative pathnames are not supported in hash history.push(${JSON.stringify( to )})` ); } return getUrlBasedHistory( createHashLocation, createHashHref, validateHashLocation, options ); } function invariant(value, message) { if (value === false || value === null || typeof value === "undefined") { throw new Error(message); } } function warning(cond, message) { if (!cond) { if (typeof console !== "undefined") console.warn(message); try { throw new Error(message); } catch (e) { } } } function createKey() { return Math.random().toString(36).substring(2, 10); } function getHistoryState(location, index) { return { usr: location.state, key: location.key, idx: index }; } function createLocation(current, to, state = null, key) { let location = { pathname: typeof current === "string" ? current : current.pathname, search: "", hash: "", ...typeof to === "string" ? parsePath(to) : to, state, // TODO: This could be cleaned up. push/replace should probably just take // full Locations now and avoid the need to run through this flow at all // But that's a pretty big refactor to the current test suite so going to // keep as is for the time being and just let any incoming keys take precedence key: to && to.key || key || createKey() }; return location; } function createPath({ pathname = "/", search = "", hash = "" }) { if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search; if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash; return pathname; } function parsePath(path) { let parsedPath = {}; if (path) { let hashIndex = path.indexOf("#"); if (hashIndex >= 0) { parsedPath.hash = path.substring(hashIndex); path = path.substring(0, hashIndex); } let searchIndex = path.indexOf("?"); if (searchIndex >= 0) { parsedPath.search = path.substring(searchIndex); path = path.substring(0, searchIndex); } if (path) { parsedPath.pathname = path; } } return parsedPath; } function getUrlBasedHistory(getLocation, createHref2, validateLocation, options = {}) { let { window: window2 = document.defaultView, v5Compat = false } = options; let globalHistory = window2.history; let action = "POP"; let listener = null; let index = getIndex(); if (index == null) { index = 0; globalHistory.replaceState({ ...globalHistory.state, idx: index }, ""); } function getIndex() { let state = globalHistory.state || { idx: null }; return state.idx; } function handlePop() { action = "POP"; let nextIndex = getIndex(); let delta = nextIndex == null ? null : nextIndex - index; index = nextIndex; if (listener) { listener({ action, location: history.location, delta }); } } function push(to, state) { action = "PUSH"; let location = createLocation(history.location, to, state); if (validateLocation) validateLocation(location, to); index = getIndex() + 1; let historyState = getHistoryState(location, index); let url = history.createHref(location); try { globalHistory.pushState(historyState, "", url); } catch (error) { if (error instanceof DOMException && error.name === "DataCloneError") { throw error; } window2.location.assign(url); } if (v5Compat && listener) { listener({ action, location: history.location, delta: 1 }); } } function replace2(to, state) { action = "REPLACE"; let location = createLocation(history.location, to, state); if (validateLocation) validateLocation(location, to); index = getIndex(); let historyState = getHistoryState(location, index); let url = history.createHref(location); globalHistory.replaceState(historyState, "", url); if (v5Compat && listener) { listener({ action, location: history.location, delta: 0 }); } } function createURL(to) { let base = window2.location.origin !== "null" ? window2.location.origin : window2.location.href; let href2 = typeof to === "string" ? to : createPath(to); href2 = href2.replace(/ $/, "%20"); invariant( base, `No window.location.(origin|href) available to create URL for href: ${href2}` ); return new URL(href2, base); } let history = { get action() { return action; }, get location() { return getLocation(window2, globalHistory); }, listen(fn) { if (listener) { throw new Error("A history only accepts one active listener"); } window2.addEventListener(PopStateEventType, handlePop); listener = fn; return () => { window2.removeEventListener(PopStateEventType, handlePop); listener = null; }; }, createHref(to) { return createHref2(window2, to); }, createURL, encodeLocation(to) { let url = createURL(to); return { pathname: url.pathname, search: url.search, hash: url.hash }; }, push, replace: replace2, go(n) { return globalHistory.go(n); } }; return history; } function unstable_createContext(defaultValue) { return { defaultValue }; } var _map; var unstable_RouterContextProvider = class { constructor(init) { __privateAdd(this, _map, /* @__PURE__ */ new Map()); if (init) { for (let [context, value] of init) { this.set(context, value); } } } get(context) { if (__privateGet(this, _map).has(context)) { return __privateGet(this, _map).get(context); } if (context.defaultValue !== void 0) { return context.defaultValue; } throw new Error("No value found for context"); } set(context, value) { __privateGet(this, _map).set(context, value); } }; _map = /* @__PURE__ */ new WeakMap(); var immutableRouteKeys = /* @__PURE__ */ new Set([ "lazy", "caseSensitive", "path", "id", "index", "children" ]); function isIndexRoute(route) { return route.index === true; } function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath = [], manifest = {}) { return routes.map((route, index) => { let treePath = [...parentPath, String(index)]; let id = typeof route.id === "string" ? route.id : treePath.join("-"); invariant( route.index !== true || !route.children, `Cannot specify children on an index route` ); invariant( !manifest[id], `Found a route id collision on id "${id}". Route id's must be globally unique within Data Router usages` ); if (isIndexRoute(route)) { let indexRoute = { ...route, ...mapRouteProperties2(route), id }; manifest[id] = indexRoute; return indexRoute; } else { let pathOrLayoutRoute = { ...route, ...mapRouteProperties2(route), id, children: void 0 }; manifest[id] = pathOrLayoutRoute; if (route.children) { pathOrLayoutRoute.children = convertRoutesToDataRoutes( route.children, mapRouteProperties2, treePath, manifest ); } return pathOrLayoutRoute; } }); } function matchRoutes(routes, locationArg, basename = "/") { return matchRoutesImpl(routes, locationArg, basename, false); } function matchRoutesImpl(routes, locationArg, basename, allowPartial) { let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg; let pathname = stripBasename(location.pathname || "/", basename); if (pathname == null) { return null; } let branches = flattenRoutes(routes); rankRouteBranches(branches); let matches = null; for (let i = 0; matches == null && i < branches.length; ++i) { let decoded = decodePath(pathname); matches = matchRouteBranch( branches[i], decoded, allowPartial ); } return matches; } function convertRouteMatchToUiMatch(match, loaderData) { let { route, pathname, params } = match; return { id: route.id, pathname, params, data: loaderData[route.id], handle: route.handle }; } function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "") { let flattenRoute = (route, index, relativePath) => { let meta = { relativePath: relativePath === void 0 ? route.path || "" : relativePath, caseSensitive: route.caseSensitive === true, childrenIndex: index, route }; if (meta.relativePath.startsWith("/")) { invariant( meta.relativePath.startsWith(parentPath), `Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.` ); meta.relativePath = meta.relativePath.slice(parentPath.length); } let path = joinPaths([parentPath, meta.relativePath]); let routesMeta = parentsMeta.concat(meta); if (route.children && route.children.length > 0) { invariant( // Our types know better, but runtime JS may not! // @ts-expect-error route.index !== true, `Index routes must not have child routes. Please remove all child routes from route path "${path}".` ); flattenRoutes(route.children, branches, routesMeta, path); } if (route.path == null && !route.index) { return; } branches.push({ path, score: computeScore(path, route.index), routesMeta }); }; routes.forEach((route, index) => { if (route.path === "" || !route.path?.includes("?")) { flattenRoute(route, index); } else { for (let exploded of explodeOptionalSegments(route.path)) { flattenRoute(route, index, exploded); } } }); return branches; } function explodeOptionalSegments(path) { let segments = path.split("/"); if (segments.length === 0) return []; let [first, ...rest] = segments; let isOptional = first.endsWith("?"); let required = first.replace(/\?$/, ""); if (rest.length === 0) { return isOptional ? [required, ""] : [required]; } let restExploded = explodeOptionalSegments(rest.join("/")); let result = []; result.push( ...restExploded.map( (subpath) => subpath === "" ? required : [required, subpath].join("/") ) ); if (isOptional) { result.push(...restExploded); } return result.map( (exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded ); } function rankRouteBranches(branches) { branches.sort( (a, b) => a.score !== b.score ? b.score - a.score : compareIndexes( a.routesMeta.map((meta) => meta.childrenIndex), b.routesMeta.map((meta) => meta.childrenIndex) ) ); } var paramRe = /^:[\w-]+$/; var dynamicSegmentValue = 3; var indexRouteValue = 2; var emptySegmentValue = 1; var staticSegmentValue = 10; var splatPenalty = -2; var isSplat = (s) => s === "*"; function computeScore(path, index) { let segments = path.split("/"); let initialScore = segments.length; if (segments.some(isSplat)) { initialScore += splatPenalty; } if (index) { initialScore += indexRouteValue; } return segments.filter((s) => !isSplat(s)).reduce( (score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), initialScore ); } function compareIndexes(a, b) { let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]); return siblings ? ( // If two routes are siblings, we should try to match the earlier sibling // first. This allows people to have fine-grained control over the matching // behavior by simply putting routes with identical paths in the order they // want them tried. a[a.length - 1] - b[b.length - 1] ) : ( // Otherwise, it doesn't really make sense to rank non-siblings by index, // so they sort equally. 0 ); } function matchRouteBranch(branch, pathname, allowPartial = false) { let { routesMeta } = branch; let matchedParams = {}; let matchedPathname = "/"; let matches = []; for (let i = 0; i < routesMeta.length; ++i) { let meta = routesMeta[i]; let end = i === routesMeta.length - 1; let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/"; let match = matchPath( { path: meta.relativePath, caseSensitive: meta.caseSensitive, end }, remainingPathname ); let route = meta.route; if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) { match = matchPath( { path: meta.relativePath, caseSensitive: meta.caseSensitive, end: false }, remainingPathname ); } if (!match) { return null; } Object.assign(matchedParams, match.params); matches.push({ // TODO: Can this as be avoided? params: matchedParams, pathname: joinPaths([matchedPathname, match.pathname]), pathnameBase: normalizePathname( joinPaths([matchedPathname, match.pathnameBase]) ), route }); if (match.pathnameBase !== "/") { matchedPathname = joinPaths([matchedPathname, match.pathnameBase]); } } return matches; } function generatePath(originalPath, params = {}) { let path = originalPath; if (path.endsWith("*") && path !== "*" && !path.endsWith("/*")) { warning( false, `Route path "${path}" will be treated as if it were "${path.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path.replace(/\*$/, "/*")}".` ); path = path.replace(/\*$/, "/*"); } const prefix = path.startsWith("/") ? "/" : ""; const stringify2 = (p) => p == null ? "" : typeof p === "string" ? p : String(p); const segments = path.split(/\/+/).map((segment, index, array) => { const isLastSegment = index === array.length - 1; if (isLastSegment && segment === "*") { const star = "*"; return stringify2(params[star]); } const keyMatch = segment.match(/^:([\w-]+)(\??)$/); if (keyMatch) { const [, key, optional] = keyMatch; let param = params[key]; invariant(optional === "?" || param != null, `Missing ":${key}" param`); return stringify2(param); } return segment.replace(/\?$/g, ""); }).filter((segment) => !!segment); return prefix + segments.join("/"); } function matchPath(pattern, pathname) { if (typeof pattern === "string") { pattern = { path: pattern, caseSensitive: false, end: true }; } let [matcher, compiledParams] = compilePath( pattern.path, pattern.caseSensitive, pattern.end ); let match = pathname.match(matcher); if (!match) return null; let matchedPathname = match[0]; let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1"); let captureGroups = match.slice(1); let params = compiledParams.reduce( (memo2, { paramName, isOptional }, index) => { if (paramName === "*") { let splatValue = captureGroups[index] || ""; pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1"); } const value = captureGroups[index]; if (isOptional && !value) { memo2[paramName] = void 0; } else { memo2[paramName] = (value || "").replace(/%2F/g, "/"); } return memo2; }, {} ); return { params, pathname: matchedPathname, pathnameBase, pattern }; } function compilePath(path, caseSensitive = false, end = true) { warning( path === "*" || !path.endsWith("*") || path.endsWith("/*"), `Route path "${path}" will be treated as if it were "${path.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path.replace(/\*$/, "/*")}".` ); let params = []; let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace( /\/:([\w-]+)(\?)?/g, (_, paramName, isOptional) => { params.push({ paramName, isOptional: isOptional != null }); return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)"; } ); if (path.endsWith("*")) { params.push({ paramName: "*" }); regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$"; } else if (end) { regexpSource += "\\/*$"; } else if (path !== "" && path !== "/") { regexpSource += "(?:(?=\\/|$))"; } else { } let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i"); return [matcher, params]; } function decodePath(value) { try { return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/"); } catch (error) { warning( false, `The URL path "${value}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${error}).` ); return value; } } function stripBasename(pathname, basename) { if (basename === "/") return pathname; if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) { return null; } let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length; let nextChar = pathname.charAt(startIndex); if (nextChar && nextChar !== "/") { return null; } return pathname.slice(startIndex) || "/"; } function resolvePath(to, fromPathname = "/") { let { pathname: toPathname, search = "", hash = "" } = typeof to === "string" ? parsePath(to) : to; let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname; return { pathname, search: normalizeSearch(search), hash: normalizeHash(hash) }; } function resolvePathname(relativePath, fromPathname) { let segments = fromPathname.replace(/\/+$/, "").split("/"); let relativeSegments = relativePath.split("/"); relativeSegments.forEach((segment) => { if (segment === "..") { if (segments.length > 1) segments.pop(); } else if (segment !== ".") { segments.push(segment); } }); return segments.length > 1 ? segments.join("/") : "/"; } function getInvalidPathError(char, field, dest, path) { return `Cannot include a '${char}' character in a manually specified \`to.${field}\` field [${JSON.stringify( path )}]. Please separate it out to the \`to.${dest}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`; } function getPathContributingMatches(matches) { return matches.filter( (match, index) => index === 0 || match.route.path && match.route.path.length > 0 ); } function getResolveToMatches(matches) { let pathMatches = getPathContributingMatches(matches); return pathMatches.map( (match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase ); } function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = false) { let to; if (typeof toArg === "string") { to = parsePath(toArg); } else { to = { ...toArg }; invariant( !to.pathname || !to.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to) ); invariant( !to.pathname || !to.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to) ); invariant( !to.search || !to.search.includes("#"), getInvalidPathError("#", "search", "hash", to) ); } let isEmptyPath = toArg === "" || to.pathname === ""; let toPathname = isEmptyPath ? "/" : to.pathname; let from; if (toPathname == null) { from = locationPathname; } else { let routePathnameIndex = routePathnames.length - 1; if (!isPathRelative && toPathname.startsWith("..")) { let toSegments = toPathname.split("/"); while (toSegments[0] === "..") { toSegments.shift(); routePathnameIndex -= 1; } to.pathname = toSegments.join("/"); } from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/"; } let path = resolvePath(to, from); let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/"); let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/"); if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) { path.pathname += "/"; } return path; } var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/"); var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/"); var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search; var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash; var DataWithResponseInit = class { constructor(data2, init) { this.type = "DataWithResponseInit"; this.data = data2; this.init = init || null; } }; function data(data2, init) { return new DataWithResponseInit( data2, typeof init === "number" ? { status: init } : init ); } var redirect = (url, init = 302) => { let responseInit = init; if (typeof responseInit === "number") { responseInit = { status: responseInit }; } else if (typeof responseInit.status === "undefined") { responseInit.status = 302; } let headers = new Headers(responseInit.headers); headers.set("Location", url); return new Response(null, { ...responseInit, headers }); }; var redirectDocument = (url, init) => { let response = redirect(url, init); response.headers.set("X-Remix-Reload-Document", "true"); return response; }; var replace = (url, init) => { let response = redirect(url, init); response.headers.set("X-Remix-Replace", "true"); return response; }; var ErrorResponseImpl = class { constructor(status, statusText, data2, internal = false) { this.status = status; this.statusText = statusText || ""; this.internal = internal; if (data2 instanceof Error) { this.data = data2.toString(); this.error = data2; } else { this.data = data2; } } }; function isRouteErrorResponse(error) { return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error; } var validMutationMethodsArr = [ "POST", "PUT", "PATCH", "DELETE" ]; var validMutationMethods = new Set( validMutationMethodsArr ); var validRequestMethodsArr = [ "GET", ...validMutationMethodsArr ]; var validRequestMethods = new Set(validRequestMethodsArr); var redirectStatusCodes = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]); var redirectPreserveMethodStatusCodes = /* @__PURE__ */ new Set([307, 308]); var IDLE_NAVIGATION = { state: "idle", location: void 0, formMethod: void 0, formAction: void 0, formEncType: void 0, formData: void 0, json: void 0, text: void 0 }; var IDLE_FETCHER = { state: "idle", data: void 0, formMethod: void 0, formAction: void 0, formEncType: void 0, formData: void 0, json: void 0, text: void 0 }; var IDLE_BLOCKER = { state: "unblocked", proceed: void 0, reset: void 0, location: void 0 }; var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i; var defaultMapRouteProperties = (route) => ({ hasErrorBoundary: Boolean(route.hasErrorBoundary) }); var TRANSITIONS_STORAGE_KEY = "remix-router-transitions"; var ResetLoaderDataSymbol = Symbol("ResetLoaderData"); function createRouter(init) { const routerWindow = init.window ? init.window : typeof window !== "undefined" ? window : void 0; const isBrowser2 = typeof routerWindow !== "undefined" && typeof routerWindow.document !== "undefined" && typeof routerWindow.document.createElement !== "undefined"; invariant( init.routes.length > 0, "You must provide a non-empty routes array to createRouter" ); let mapRouteProperties2 = init.mapRouteProperties || defaultMapRouteProperties; let manifest = {}; let dataRoutes = convertRoutesToDataRoutes( init.routes, mapRouteProperties2, void 0, manifest ); let inFlightDataRoutes; let basename = init.basename || "/"; let dataStrategyImpl = init.dataStrategy || defaultDataStrategyWithMiddleware; let future = { unstable_middleware: false, ...init.future }; let unlistenHistory = null; let subscribers = /* @__PURE__ */ new Set(); let savedScrollPositions2 = null; let getScrollRestorationKey2 = null; let getScrollPosition = null; let initialScrollRestored = init.hydrationData != null; let initialMatches = matchRoutes(dataRoutes, init.history.location, basename); let initialMatchesIsFOW = false; let initialErrors = null; if (initialMatches == null && !init.patchRoutesOnNavigation) { let error = getInternalRouterError(404, { pathname: init.history.location.pathname }); let { matches, route } = getShortCircuitMatches(dataRoutes); initialMatches = matches; initialErrors = { [route.id]: error }; } if (initialMatches && !init.hydrationData) { let fogOfWar = checkFogOfWar( initialMatches, dataRoutes, init.history.location.pathname ); if (fogOfWar.active) { initialMatches = null; } } let initialized; if (!initialMatches) { initialized = false; initialMatches = []; let fogOfWar = checkFogOfWar( null, dataRoutes, init.history.location.pathname ); if (fogOfWar.active && fogOfWar.matches) { initialMatchesIsFOW = true; initialMatches = fogOfWar.matches; } } else if (initialMatches.some((m) => m.route.lazy)) { initialized = false; } else if (!initialMatches.some((m) => m.route.loader)) { initialized = true; } else { let loaderData = init.hydrationData ? init.hydrationData.loaderData : null; let errors = init.hydrationData ? init.hydrationData.errors : null; if (errors) { let idx = initialMatches.findIndex( (m) => errors[m.route.id] !== void 0 ); initialized = initialMatches.slice(0, idx + 1).every((m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors)); } else { initialized = initialMatches.every( (m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors) ); } } let router2; let state = { historyAction: init.history.action, location: init.history.location, matches: initialMatches, initialized, navigation: IDLE_NAVIGATION, // Don't restore on initial updateState() if we were SSR'd restoreScrollPosition: init.hydrationData != null ? false : null, preventScrollReset: false, revalidation: "idle", loaderData: init.hydrationData && init.hydrationData.loaderData || {}, actionData: init.hydrationData && init.hydrationData.actionData || null, errors: init.hydrationData && init.hydrationData.errors || initialErrors, fetchers: /* @__PURE__ */ new Map(), blockers: /* @__PURE__ */ new Map() }; let pendingAction = "POP"; let pendingPreventScrollReset = false; let pendingNavigationController; let pendingViewTransitionEnabled = false; let appliedViewTransitions = /* @__PURE__ */ new Map(); let removePageHideEventListener = null; let isUninterruptedRevalidation = false; let isRevalidationRequired = false; let cancelledFetcherLoads = /* @__PURE__ */ new Set(); let fetchControllers = /* @__PURE__ */ new Map(); let incrementingLoadId = 0; let pendingNavigationLoadId = -1; let fetchReloadIds = /* @__PURE__ */ new Map(); let fetchRedirectIds = /* @__PURE__ */ new Set(); let fetchLoadMatches = /* @_