PageSourceSearch

https://spicejunction.de/node_modules/.vite/deps/react-router-dom.js?v=46d206a1

js spicejunction.de collected 2026-09-24 14:21:19 UTC 390,500 bytes, 9,931 lines download raw bytes

vendor: 8,731 bytes, lines 1-254
1import { injectQuery as __vite__injectQuery } from "/@vite/client";import { createHotContext as __vite__createHotContext } from "/@vite/client";import.meta.hot = __vite__createHotContext("/node_modules/.vite/deps/react-router-dom.js?v=46d206a1");import { o as __toESM, t as __commonJSMin } from "/node_modules/.vite/deps/chunk-olfrzTEO.js?v=46d206a1";
2import { t as require_react } from "/node_modules/.vite/deps/react.js?v=46d206a1";
3import { t as require_react_dom } from "/node_modules/.vite/deps/react-dom.js?v=46d206a1";
4//#region node_modules/react-router/dist/development/chunk-UVKPFVEO.mjs
5var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
6/**
7* react-router v7.13.2
8*
9* Copyright (c) Remix Software Inc.
10*
11* This source code is licensed under the MIT license found in the
12* LICENSE.md file in the root directory of this source tree.
13*
14* @license MIT
15*/
16var __typeError = (msg) => {
17	throw TypeError(msg);
18};
19var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
20var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
21var __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);
22var Action = /* @__PURE__ */ ((Action2) => {
23	Action2["Pop"] = "POP";
24	Action2["Push"] = "PUSH";
25	Action2["Replace"] = "REPLACE";
26	return Action2;
27})(Action || {});
28var PopStateEventType = "popstate";
29function isLocation(obj) {
30	return typeof obj === "object" && obj != null && "pathname" in obj && "search" in obj && "hash" in obj && "state" in obj && "key" in obj;
31}
32function createMemoryHistory(options = {}) {
33	let { initialEntries = ["/"], initialIndex, v5Compat = false } = options;
34	let entries;
35	entries = initialEntries.map((entry, index2) => createMemoryLocation(entry, typeof entry === "string" ? null : entry.state, index2 === 0 ? "default" : void 0, typeof entry === "string" ? void 0 : entry.unstable_mask));
36	let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);
37	let action = "POP";
38	let listener = null;
39	function clampIndex(n) {
40		return Math.min(Math.max(n, 0), entries.length - 1);
41	}
42	function getCurrentLocation() {
43		return entries[index];
44	}
45	function createMemoryLocation(to, state = null, key, unstable_mask) {
46		let location = createLocation(entries ? getCurrentLocation().pathname : "/", to, state, key, unstable_mask);
47		warning(location.pathname.charAt(0) === "/", `relative pathnames are not supported in memory history: ${JSON.stringify(to)}`);
48		return location;
49	}
50	function createHref2(to) {
51		return typeof to === "string" ? to : createPath(to);
52	}
53	return {
54		get index() {
55			return index;
56		},
57		get action() {
58			return action;
59		},
60		get location() {
61			return getCurrentLocation();
62		},
63		createHref: createHref2,
64		createURL(to) {
65			return new URL(createHref2(to), "http://localhost");
66		},
67		encodeLocation(to) {
68			let path = typeof to === "string" ? parsePath(to) : to;
69			return {
70				pathname: path.pathname || "",
71				search: path.search || "",
72				hash: path.hash || ""
73			};
74		},
75		push(to, state) {
76			action = "PUSH";
77			let nextLocation = isLocation(to) ? to : createMemoryLocation(to, state);
78			index += 1;
79			entries.splice(index, entries.length, nextLocation);
80			if (v5Compat && listener) listener({
81				action,
82				location: nextLocation,
83				delta: 1
84			});
85		},
86		replace(to, state) {
87			action = "REPLACE";
88			let nextLocation = isLocation(to) ? to : createMemoryLocation(to, state);
89			entries[index] = nextLocation;
90			if (v5Compat && listener) listener({
91				action,
92				location: nextLocation,
93				delta: 0
94			});
95		},
96		go(delta) {
97			action = "POP";
98			let nextIndex = clampIndex(index + delta);
99			let nextLocation = entries[nextIndex];
100			index = nextIndex;
101			if (listener) listener({
102				action,
103				location: nextLocation,
104				delta
105			});
106		},
107		listen(fn) {
108			listener = fn;
109			return () => {
110				listener = null;
111			};
112		}
113	};
114}
115function createBrowserHistory(options = {}) {
116	function createBrowserLocation(window2, globalHistory) {
117		let maskedLocation = globalHistory.state?.masked;
118		let { pathname, search, hash } = maskedLocation || window2.location;
119		return createLocation("", {
120			pathname,
121			search,
122			hash
123		}, globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || "default", maskedLocation ? {
124			pathname: window2.location.pathname,
125			search: window2.location.search,
126			hash: window2.location.hash
127		} : void 0);
128	}
129	function createBrowserHref(window2, to) {
130		return typeof to === "string" ? to : createPath(to);
131	}
132	return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);
133}
134function createHashHistory(options = {}) {
135	function createHashLocation(window2, globalHistory) {
136		let { pathname = "/", search = "", hash = "" } = parsePath(window2.location.hash.substring(1));
137		if (!pathname.startsWith("/") && !pathname.startsWith(".")) pathname = "/" + pathname;
138		return createLocation("", {
139			pathname,
140			search,
141			hash
142		}, globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || "default");
143	}
144	function createHashHref(window2, to) {
145		let base = window2.document.querySelector("base");
146		let href = "";
147		if (base && base.getAttribute("href")) {
148			let url = window2.location.href;
149			let hashIndex = url.indexOf("#");
150			href = hashIndex === -1 ? url : url.slice(0, hashIndex);
151		}
152		return href + "#" + (typeof to === "string" ? to : createPath(to));
153	}
154	function validateHashLocation(location, to) {
155		warning(location.pathname.charAt(0) === "/", `relative pathnames are not supported in hash history.push(${JSON.stringify(to)})`);
156	}
157	return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options);
158}
159function invariant(value, message) {
160	if (value === false || value === null || typeof value === "undefined") throw new Error(message);
161}
162function warning(cond, message) {
163	if (!cond) {
164		if (typeof console !== "undefined") console.warn(message);
165		try {
166			throw new Error(message);
167		} catch (e) {}
168	}
169}
170function createKey$1() {
171	return Math.random().toString(36).substring(2, 10);
172}
173function getHistoryState(location, index) {
174	return {
175		usr: location.state,
176		key: location.key,
177		idx: index,
178		masked: location.unstable_mask ? {
179			pathname: location.pathname,
180			search: location.search,
181			hash: location.hash
182		} : void 0
183	};
184}
185function createLocation(current, to, state = null, key, unstable_mask) {
186	return {
187		pathname: typeof current === "string" ? current : current.pathname,
188		search: "",
189		hash: "",
190		...typeof to === "string" ? parsePath(to) : to,
191		state,
192		key: to && to.key || key || createKey$1(),
193		unstable_mask
194	};
195}
196function createPath({ pathname = "/", search = "", hash = "" }) {
197	if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search;
198	if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
199	return pathname;
200}
201function parsePath(path) {
202	let parsedPath = {};
203	if (path) {
204		let hashIndex = path.indexOf("#");
205		if (hashIndex >= 0) {
206			parsedPath.hash = path.substring(hashIndex);
207			path = path.substring(0, hashIndex);
208		}
209		let searchIndex = path.indexOf("?");
210		if (searchIndex >= 0) {
211			parsedPath.search = path.substring(searchIndex);
212			path = path.substring(0, searchIndex);
213		}
214		if (path) parsedPath.pathname = path;
215	}
216	return parsedPath;
217}
218function getUrlBasedHistory(getLocation, createHref2, validateLocation, options = {}) {
219	let { window: window2 = document.defaultView, v5Compat = false } = options;
220	let globalHistory = window2.history;
221	let action = "POP";
222	let listener = null;
223	let index = getIndex();
224	if (index == null) {
225		index = 0;
226		globalHistory.replaceState({
227			...globalHistory.state,
228			idx: index
229		}, "");
230	}
231	function getIndex() {
232		return (globalHistory.state || { idx: null }).idx;
233	}
234	function handlePop() {
235		action = "POP";
236		let nextIndex = getIndex();
237		let delta = nextIndex == null ? null : nextIndex - index;
238		index = nextIndex;
239		if (listener) listener({
240			action,
241			location: history.location,
242			delta
243		});
244	}
245	function push(to, state) {
246		action = "PUSH";
247		let location = isLocation(to) ? to : createLocation(history.location, to, state);
248		if (validateLocation) validateLocation(location, to);
249		index = getIndex() + 1;
250		let historyState = getHistoryState(location, index);
251		let url = history.createHref(location.unstable_mask || location);
252		try {
253			globalHistory.pushState(historyState, "", url);
254		} catch (error) {
255			if (error instanceof DOMException && error.name === "DataCloneError") throw error;
256			window2.location.assign(url);
257		}
258		if (v5Compat && listener) listener({
259			action,
260			location: history.location,
261			delta: 1
262		});
263	}
264	function replace2(to, state) {
265		action = "REPLACE";
266		let location = isLocation(to) ? to : createLocation(history.location, to, state);
267		if (validateLocation) validateLocation(location, to);
268		index = getIndex();
269		let historyState = getHistoryState(location, index);
270		let url = history.createHref(location.unstable_mask || location);
271		globalHistory.replaceState(historyState, "", url);
272		if (v5Compat && listener) listener({
273			action,
274			location: history.location,
275			delta: 0
276		});
277	}
278	function createURL(to) {
279		return createBrowserURLImpl(to);
280	}
281	let history = {
282		get action() {
283			return action;
284		},
285		get location() {
286			return getLocation(window2, globalHistory);
287		},
288		listen(fn) {
289			if (listener) throw new Error("A history only accepts one active listener");
290			window2.addEventListener(PopStateEventType, handlePop);
291			listener = fn;
292			return () => {
293				window2.removeEventListener(PopStateEventType, handlePop);
294				listener = null;
295			};
296		},
297		createHref(to) {
298			return createHref2(window2, to);
299		},
300		createURL,
301		encodeLocation(to) {
302			let url = createURL(to);
303			return {
304				pathname: url.pathname,
305				search: url.search,
306				hash: url.hash
307			};
308		},
309		push,
310		replace: replace2,
311		go(n) {
312			return globalHistory.go(n);
313		}
314	};
315	return history;
316}
317function createBrowserURLImpl(to, isAbsolute = false) {
318	let base = "http://localhost";
319	if (typeof window !== "undefined") base = window.location.origin !== "null" ? window.location.origin : window.location.href;
320	invariant(base, "No window.location.(origin|href) available to create URL");
321	let href = typeof to === "string" ? to : createPath(to);
322	href = href.replace(/ $/, "%20");
323	if (!isAbsolute && href.startsWith("//")) href = base + href;
324	return new URL(href, base);
325}
326function createContext(defaultValue) {
327	return { defaultValue };
328}
329var _map;
330var RouterContextProvider = class {
331	/**
332	* Create a new `RouterContextProvider` instance
333	* @param init An optional initial context map to populate the provider with
334	*/
335	constructor(init) {
336		__privateAdd(this, _map, /* @__PURE__ */ new Map());
337		if (init) for (let [context, value] of init) this.set(context, value);
338	}
339	/**
340	* Access a value from the context. If no value has been set for the context,
341	* it will return the context's `defaultValue` if provided, or throw an error
342	* if no `defaultValue` was set.
343	* @param context The context to get the value for
344	* @returns The value for the context, or the context's `defaultValue` if no
345	* value was set
346	*/
347	get(context) {
348		if (__privateGet(this, _map).has(context)) return __privateGet(this, _map).get(context);
349		if (context.defaultValue !== void 0) return context.defaultValue;
350		throw new Error("No value found for context");
351	}
352	/**
353	* Set a value for the context. If the context already has a value set, this
354	* will overwrite it.
355	*
356	* @param context The context to set the value for
357	* @param value The value to set for the context
358	* @returns {void}
359	*/
360	set(context, value) {
361		__privateGet(this, _map).set(context, value);
362	}
363};
364_map = /* @__PURE__ */ new WeakMap();
365var unsupportedLazyRouteObjectKeys = /* @__PURE__ */ new Set([
366	"lazy",
367	"caseSensitive",
368	"path",
369	"id",
370	"index",
371	"children"
372]);
373function isUnsupportedLazyRouteObjectKey(key) {
374	return unsupportedLazyRouteObjectKeys.has(key);
375}
376var unsupportedLazyRouteFunctionKeys = /* @__PURE__ */ new Set([
377	"lazy",
378	"caseSensitive",
379	"path",
380	"id",
381	"index",
382	"middleware",
383	"children"
384]);
385function isUnsupportedLazyRouteFunctionKey(key) {
386	return unsupportedLazyRouteFunctionKeys.has(key);
387}
388function isIndexRoute(route) {
389	return route.index === true;
390}
391function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath = [], manifest = {}, allowInPlaceMutations = false) {
392	return routes.map((route, index) => {
393		let treePath = [...parentPath, String(index)];
394		let id = typeof route.id === "string" ? route.id : treePath.join("-");
395		invariant(route.index !== true || !route.children, `Cannot specify children on an index route`);
396		invariant(allowInPlaceMutations || !manifest[id], `Found a route id collision on i
vendor: 4,699 bytes, lines 396-511
396d "${id}".  Route id's must be globally unique within Data Router usages`);
397		if (isIndexRoute(route)) {
398			let indexRoute = {
399				...route,
400				id
401			};
402			manifest[id] = mergeRouteUpdates(indexRoute, mapRouteProperties2(indexRoute));
403			return indexRoute;
404		} else {
405			let pathOrLayoutRoute = {
406				...route,
407				id,
408				children: void 0
409			};
410			manifest[id] = mergeRouteUpdates(pathOrLayoutRoute, mapRouteProperties2(pathOrLayoutRoute));
411			if (route.children) pathOrLayoutRoute.children = convertRoutesToDataRoutes(route.children, mapRouteProperties2, treePath, manifest, allowInPlaceMutations);
412			return pathOrLayoutRoute;
413		}
414	});
415}
416function mergeRouteUpdates(route, updates) {
417	return Object.assign(route, {
418		...updates,
419		...typeof updates.lazy === "object" && updates.lazy != null ? { lazy: {
420			...route.lazy,
421			...updates.lazy
422		} } : {}
423	});
424}
425function matchRoutes(routes, locationArg, basename = "/") {
426	return matchRoutesImpl(routes, locationArg, basename, false);
427}
428function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
429	let pathname = stripBasename((typeof locationArg === "string" ? parsePath(locationArg) : locationArg).pathname || "/", basename);
430	if (pathname == null) return null;
431	let branches = flattenRoutes(routes);
432	rankRouteBranches(branches);
433	let matches = null;
434	for (let i = 0; matches == null && i < branches.length; ++i) {
435		let decoded = decodePath(pathname);
436		matches = matchRouteBranch(branches[i], decoded, allowPartial);
437	}
438	return matches;
439}
440function convertRouteMatchToUiMatch(match, loaderData) {
441	let { route, pathname, params } = match;
442	return {
443		id: route.id,
444		pathname,
445		params,
446		data: loaderData[route.id],
447		loaderData: loaderData[route.id],
448		handle: route.handle
449	};
450}
451function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
452	let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
453		let meta = {
454			relativePath: relativePath === void 0 ? route.path || "" : relativePath,
455			caseSensitive: route.caseSensitive === true,
456			childrenIndex: index,
457			route
458		};
459		if (meta.relativePath.startsWith("/")) {
460			if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) return;
461			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.`);
462			meta.relativePath = meta.relativePath.slice(parentPath.length);
463		}
464		let path = joinPaths([parentPath, meta.relativePath]);
465		let routesMeta = parentsMeta.concat(meta);
466		if (route.children && route.children.length > 0) {
467			invariant(route.index !== true, `Index routes must not have child routes. Please remove all child routes from route path "${path}".`);
468			flattenRoutes(route.children, branches, routesMeta, path, hasParentOptionalSegments);
469		}
470		if (route.path == null && !route.index) return;
471		branches.push({
472			path,
473			score: computeScore(path, route.index),
474			routesMeta
475		});
476	};
477	routes.forEach((route, index) => {
478		if (route.path === "" || !route.path?.includes("?")) flattenRoute(route, index);
479		else for (let exploded of explodeOptionalSegments(route.path)) flattenRoute(route, index, true, exploded);
480	});
481	return branches;
482}
483function explodeOptionalSegments(path) {
484	let segments = path.split("/");
485	if (segments.length === 0) return [];
486	let [first, ...rest] = segments;
487	let isOptional = first.endsWith("?");
488	let required = first.replace(/\?$/, "");
489	if (rest.length === 0) return isOptional ? [required, ""] : [required];
490	let restExploded = explodeOptionalSegments(rest.join("/"));
491	let result = [];
492	result.push(...restExploded.map((subpath) => subpath === "" ? required : [required, subpath].join("/")));
493	if (isOptional) result.push(...restExploded);
494	return result.map((exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded);
495}
496function rankRouteBranches(branches) {
497	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)));
498}
499var paramRe = /^:[\w-]+$/;
500var dynamicSegmentValue = 3;
501var indexRouteValue = 2;
502var emptySegmentValue = 1;
503var staticSegmentValue = 10;
504var splatPenalty = -2;
505var isSplat = (s) => s === "*";
506function computeScore(path, index) {
507	let segments = path.split("/");
508	let initialScore = segments.length;
509	if (segments.some(isSplat)) initialScore += splatPenalty;
510	if (index) initialScore += indexRouteValue;
511	return segments.filter((s) => !isSplat(s)).reduce((score, segment) =>
vendor: 5,074 bytes, lines 511-625
511 score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), initialScore);
512}
513function compareIndexes(a, b) {
514	return a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]) ? a[a.length - 1] - b[b.length - 1] : 0;
515}
516function matchRouteBranch(branch, pathname, allowPartial = false) {
517	let { routesMeta } = branch;
518	let matchedParams = {};
519	let matchedPathname = "/";
520	let matches = [];
521	for (let i = 0; i < routesMeta.length; ++i) {
522		let meta = routesMeta[i];
523		let end = i === routesMeta.length - 1;
524		let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
525		let match = matchPath({
526			path: meta.relativePath,
527			caseSensitive: meta.caseSensitive,
528			end
529		}, remainingPathname);
530		let route = meta.route;
531		if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) match = matchPath({
532			path: meta.relativePath,
533			caseSensitive: meta.caseSensitive,
534			end: false
535		}, remainingPathname);
536		if (!match) return null;
537		Object.assign(matchedParams, match.params);
538		matches.push({
539			params: matchedParams,
540			pathname: joinPaths([matchedPathname, match.pathname]),
541			pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),
542			route
543		});
544		if (match.pathnameBase !== "/") matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
545	}
546	return matches;
547}
548function generatePath(originalPath, params = {}) {
549	let path = originalPath;
550	if (path.endsWith("*") && path !== "*" && !path.endsWith("/*")) {
551		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(/\*$/, "/*")}".`);
552		path = path.replace(/\*$/, "/*");
553	}
554	const prefix = path.startsWith("/") ? "/" : "";
555	const stringify2 = (p) => p == null ? "" : typeof p === "string" ? p : String(p);
556	return prefix + path.split(/\/+/).map((segment, index, array) => {
557		if (index === array.length - 1 && segment === "*") return stringify2(params["*"]);
558		const keyMatch = segment.match(/^:([\w-]+)(\??)(.*)/);
559		if (keyMatch) {
560			const [, key, optional, suffix] = keyMatch;
561			let param = params[key];
562			invariant(optional === "?" || param != null, `Missing ":${key}" param`);
563			return encodeURIComponent(stringify2(param)) + suffix;
564		}
565		return segment.replace(/\?$/g, "");
566	}).filter((segment) => !!segment).join("/");
567}
568function matchPath(pattern, pathname) {
569	if (typeof pattern === "string") pattern = {
570		path: pattern,
571		caseSensitive: false,
572		end: true
573	};
574	let [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);
575	let match = pathname.match(matcher);
576	if (!match) return null;
577	let matchedPathname = match[0];
578	let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
579	let captureGroups = match.slice(1);
580	return {
581		params: compiledParams.reduce((memo2, { paramName, isOptional }, index) => {
582			if (paramName === "*") {
583				let splatValue = captureGroups[index] || "";
584				pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
585			}
586			const value = captureGroups[index];
587			if (isOptional && !value) memo2[paramName] = void 0;
588			else memo2[paramName] = (value || "").replace(/%2F/g, "/");
589			return memo2;
590		}, {}),
591		pathname: matchedPathname,
592		pathnameBase,
593		pattern
594	};
595}
596function compilePath(path, caseSensitive = false, end = true) {
597	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(/\*$/, "/*")}".`);
598	let params = [];
599	let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (match, paramName, isOptional, index, str) => {
600		params.push({
601			paramName,
602			isOptional: isOptional != null
603		});
604		if (isOptional) {
605			let nextChar = str.charAt(index + match.length);
606			if (nextChar && nextChar !== "/") return "/([^\\/]*)";
607			return "(?:/([^\\/]*))?";
608		}
609		return "/([^\\/]+)";
610	}).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
611	if (path.endsWith("*")) {
612		params.push({ paramName: "*" });
613		regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
614	} else if (end) regexpSource += "\\/*$";
615	else if (path !== "" && path !== "/") regexpSource += "(?:(?=\\/|$))";
616	return [new RegExp(regexpSource, caseSensitive ? void 0 : "i"), params];
617}
618function decodePath(value) {
619	try {
620		return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/");
621	} catch (error) {
622		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}).`);
623		return value;
624	}
625}
vendor: 5,260 bytes, lines 626-749
626function stripBasename(pathname, basename) {
627	if (basename === "/") return pathname;
628	if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) return null;
629	let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
630	let nextChar = pathname.charAt(startIndex);
631	if (nextChar && nextChar !== "/") return null;
632	return pathname.slice(startIndex) || "/";
633}
634function prependBasename({ basename, pathname }) {
635	return pathname === "/" ? basename : joinPaths([basename, pathname]);
636}
637var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
638var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
639function resolvePath(to, fromPathname = "/") {
640	let { pathname: toPathname, search = "", hash = "" } = typeof to === "string" ? parsePath(to) : to;
641	let pathname;
642	if (toPathname) {
643		toPathname = toPathname.replace(/\/\/+/g, "/");
644		if (toPathname.startsWith("/")) pathname = resolvePathname(toPathname.substring(1), "/");
645		else pathname = resolvePathname(toPathname, fromPathname);
646	} else pathname = fromPathname;
647	return {
648		pathname,
649		search: normalizeSearch(search),
650		hash: normalizeHash(hash)
651	};
652}
653function resolvePathname(relativePath, fromPathname) {
654	let segments = fromPathname.replace(/\/+$/, "").split("/");
655	relativePath.split("/").forEach((segment) => {
656		if (segment === "..") {
657			if (segments.length > 1) segments.pop();
658		} else if (segment !== ".") segments.push(segment);
659	});
660	return segments.length > 1 ? segments.join("/") : "/";
661}
662function getInvalidPathError(char, field, dest, path) {
663	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 <Link to="..."> and the router will parse it for you.`;
664}
665function getPathContributingMatches(matches) {
666	return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);
667}
668function getResolveToMatches(matches) {
669	let pathMatches = getPathContributingMatches(matches);
670	return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase);
671}
672function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = false) {
673	let to;
674	if (typeof toArg === "string") to = parsePath(toArg);
675	else {
676		to = { ...toArg };
677		invariant(!to.pathname || !to.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to));
678		invariant(!to.pathname || !to.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to));
679		invariant(!to.search || !to.search.includes("#"), getInvalidPathError("#", "search", "hash", to));
680	}
681	let isEmptyPath = toArg === "" || to.pathname === "";
682	let toPathname = isEmptyPath ? "/" : to.pathname;
683	let from;
684	if (toPathname == null) from = locationPathname;
685	else {
686		let routePathnameIndex = routePathnames.length - 1;
687		if (!isPathRelative && toPathname.startsWith("..")) {
688			let toSegments = toPathname.split("/");
689			while (toSegments[0] === "..") {
690				toSegments.shift();
691				routePathnameIndex -= 1;
692			}
693			to.pathname = toSegments.join("/");
694		}
695		from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
696	}
697	let path = resolvePath(to, from);
698	let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
699	let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
700	if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) path.pathname += "/";
701	return path;
702}
703var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
704var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
705var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
706var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
707var DataWithResponseInit = class {
708	constructor(data2, init) {
709		this.type = "DataWithResponseInit";
710		this.data = data2;
711		this.init = init || null;
712	}
713};
714function data(data2, init) {
715	return new DataWithResponseInit(data2, typeof init === "number" ? { status: init } : init);
716}
717var redirect = (url, init = 302) => {
718	let responseInit = init;
719	if (typeof responseInit === "number") responseInit = { status: responseInit };
720	else if (typeof responseInit.status === "undefined") responseInit.status = 302;
721	let headers = new Headers(responseInit.headers);
722	headers.set("Location", url);
723	return new Response(null, {
724		...responseInit,
725		headers
726	});
727};
728var redirectDocument = (url, init) => {
729	let response = redirect(url, init);
730	response.headers.set("X-Remix-Reload-Document", "true");
731	return response;
732};
733var replace = (url, init) => {
734	let response = redirect(url, init);
735	response.headers.set("X-Remix-Replace", "true");
736	return response;
737};
738var ErrorResponseImpl = class {
739	constructor(status, statusText, data2, internal = false) {
740		this.status = status;
741		this.statusText = statusText || "";
742		this.internal = internal;
743		if (data2 instanceof Error) {
744			this.data = data2.toString();
745			this.error = data2;
746		} else this.data = data2;
747	}
748};
749function isRouteErrorResponse(error) {
750	return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
751}
752function getRoutePattern(matches) {
753	return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
754}
755var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
756function parseToInfo(_to, basename) {
757	let to = _to;
758	if (typeof to !== "string" || !ABSOLUTE_URL_REGEX.test(to)) return {
759		absoluteURL: void 0,
760		isExternal: false,
761		to
762	};
763	let absoluteURL = to;
764	let isExternal = false;
765	if (isBrowser) try {
766		let currentUrl = new URL(window.location.href);
767		let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
768		let path = stripBasename(targetUrl.pathname, basename);
769		if (targetUrl.origin === currentUrl.origin && path != null) to = path + targetUrl.search + targetUrl.hash;
770		else isExternal = true;
771	} catch (e) {
772		warning(false, `<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`);
773	}
774	return {
775		absoluteURL,
776		isExternal,
777		to
778	};
779}
780var UninstrumentedSymbol = Symbol("Uninstrumented");
781function getRouteInstrumentationUpdates(fns, route) {
782	let aggregated = {
783		lazy: [],
784		"lazy.loader": [],
785		"lazy.action": [],
786		"lazy.middleware": [],
787		middleware: [],
788		loader: [],
789		action: []
790	};
791	fns.forEach((fn) => fn({
792		id: route.id,
793		index: route.index,
794		path: route.path,
795		instrument(i) {
796			let keys = Object.keys(aggregated);
797			for (let key of keys) if (i[key]) aggregated[key].push(i[key]);
798		}
799	}));
800	let updates = {};
801	if (typeof route.lazy === "function" && aggregated.lazy.length > 0) {
802		let instrumented = wrapImpl(aggregated.lazy, route.lazy, () => void 0);
803		if (instrumented) updates.lazy = instrumented;
804	}
805	if (typeof route.lazy === "object") {
806		let lazyObject = route.lazy;
807		[
808			"middleware",
809			"loader",
810			"action"
811		].forEach((key) => {
812			let lazyFn = lazyObject[key];
813			let instrumentations = aggregated[`lazy.${key}`];
814			if (typeof lazyFn === "function" && instrumentations.length > 0) {
815				let instrumented = wrapImpl(instrumentations, lazyFn, () => void 0);
816				if (instrumented) updates.lazy = Object.assign(updates.lazy || {}, { [key]: instrumented });
817			}
818		});
819	}
820	["loader", "action"].forEach((key) => {
821		let handler = route[key];
822		if (typeof handler === "function" && aggregated[key].length > 0) {
823			let original = handler[UninstrumentedSymbol] ?? handler;
824			let instrumented = wrapImpl(aggregated[key], original, (...args) => getHandlerInfo(args[0]));
825			if (instrumented) {
826				if (key === "loader" && original.hydrate === true) instrumented.hydrate = true;
827				instrumented[UninstrumentedSymbol] = original;
828				updates[key] = instrumented;
829			}
830		}
831	});
832	if (route.middleware && route.middleware.length > 0 && aggregated.middleware.length > 0) updates.middleware = route.middleware.map((middleware) => {
833		let original = middleware[UninstrumentedSymbol] ?? middleware;
834		let instrumented = wrapImpl(aggregated.middleware, original, (...args) => getHandlerInfo(args[0]));
835		if (instrumented) {
836			instrumented[UninstrumentedSymbol] = original;
837			return instrumented;
838		}
839		return middleware;
840	});
841	return updates;
842}
843function instrumentClientSideRouter(router, fns) {
844	let aggregated = {
845		navigate: [],
846		fetch: []
847	};
848	fns.forEach((fn) => fn({ instrument(i) {
849		let keys = Object.keys(i);
850		for (let key of keys) if (i[key]) aggregated[key].push(i[key]);
851	} }));
852	if (aggregated.navigate.length > 0) {
853		let navigate = router.navigate[UninstrumentedSymbol] ?? router.navigate;
854		let instrumentedNavigate = wrapImpl(aggregated.navigate, navigate, (...args) => {
855			let [to, opts] = args;
856			return {
857				to: typeof to === "number" || typeof to === "string" ? to : to ? createPath(to) : ".",
858				...getRouterInfo(router, opts ?? {})
859			};
860		});
861		if (instrumentedNavigate) {
862			instrumentedNavigate[UninstrumentedSymbol] = navigate;
863			router.navigate = instrumentedNavigate;
864		}
865	}
866	if (aggregated.fetch.length > 0) {
867		let fetch2 = router.fetch[UninstrumentedSymbol] ?? router.fetch;
868		let instrumentedFetch = wrapImpl(aggregated.fetch, fetch2, (...args) => {
869			let [key, , href, opts] = args;
870			return {
871				href: href ?? ".",
872				fetcherKey: key,
873				...getRouterInfo(router, opts ?? {})
874			};
875		});
876		if (instrumentedFetch) {
877			instrumentedFetch[UninstrumentedSymbol] = fetch2;
878			router.fetch = instrumentedFetch;
879		}
880	}
881	return router;
882}
883function instrumentHandler(handler, fns) {
884	let aggregated = { request: [] };
885	fns.forEach((fn) => fn({ instrument(i) {
886		let keys = Object.keys(i);
887		for (let key of keys) if (i[key]) aggregated[key].push(i[key]);
888	} }));
889	let instrumentedHandler = handler;
890	if (aggregated.request.length > 0) instrumentedHandler = wrapImpl(aggregated.request, handler, (...args) => {
891		let [request, context] = args;
892		return {
893			request: getReadonlyRequest(request),
894			context: context != null ? getReadonlyContext(context) : context
895		};
896	});
897	return instrumentedHandler;
898}
899function wrapImpl(impls, handler, getInfo) {
900	if (impls.length === 0) return null;
901	return async (...args) => {
902		let result = await recurseRight(impls, getInfo(...args), () => handler(...args), impls.length - 1);
903		if (result.type === "error") throw result.value;
904		return result.value;
905	};
906}
907async function recurseRight(impls, info, handler, index) {
908	let impl = impls[index];
909	let result;
910	if (!impl) try {
911		result = {
912			type: "success",
913			value: await handler()
914		};
915	} catch (e) {
916		result = {
917			type: "error",
918			value: e
919		};
920	}
921	else {
922		let handlerPromise = void 0;
923		let callHandler = async () => {
924			if (handlerPromise) console.error("You cannot call instrumented handlers more than once");
925			else handlerPromise = recurseRight(impls, info, handler, index - 1);
926			result = await handlerPromise;
927			invariant(result, "Expected a result");
928			if (result.type === "error" && result.value instanceof Error) return {
929				status: "error",
930				error: result.value
931			};
932			return {
933				status: "success",
934				error: void 0
935			};
936		};
937		try {
938			await impl(callHandler, info);
939		} catch (e) {
940			console.error("An instrumentation function threw an error:", e);
941		}
942		if (!handlerPromise) await callHandler();
943		await handlerPromise;
944	}
945	if (result) return result;
946	return {
947		type: "error",
948		value: /* @__PURE__ */ new Error("No result assigned in instrumentation chain.")
949	};
950}
951function getHandlerInfo(args) {
952	let { request, context, params, unstable_pattern } = args;
953	return {
954		request: getReadonlyRequest(request),
955		params: { ...params },
956		unstable_pattern,
957		context: getReadonlyContext(context)
958	};
959}
960function getRouterInfo(router, opts) {
961	return {
962		currentUrl: createPath(router.state.location),
963		..."formMethod" in opts ? { formMethod: opts.formMethod } : {},
964		..."formEncType" in opts ? { formEncType: opts.formEncType } : {},
965		..."formData" in opts ? { formData: opts.formData } : {},
966		..."body" in opts ? { body: opts.body } : {}
967	};
968}
969function getReadonlyRequest(request) {
970	return {
971		method: request.method,
972		url: request.url,
973		headers: { get: (...args) => request.headers.get(...args) }
974	};
975}
976function getReadonlyContext(context) {
977	if (isPlainObject(context)) {
978		let frozen = { ...context };
979		Object.freeze(frozen);
980		return frozen;
981	} else return { get: (ctx) => context.get(ctx) };
982}
983var objectProtoNames = Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
984function isPlainObject(thing) {
985	if (thing === null || typeof thing !== "object") return false;
986	const proto = Object.getPrototypeOf(thing);
987	return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames;
988}
989var validMutationMethodsArr = [
990	"POST",
991	"PUT",
992	"PATCH",
993	"DELETE"
994];
995var validMutationMethods = new Set(validMutationMethodsArr);
996var validRequestMethodsArr = ["GET", ...validMutationMethodsArr];
997var validRequestMethods = new Set(validRequestMethodsArr);
998var redirectStatusCodes = /* @__PURE__ */ new Set([
999	301,
1000	302,
1001	303,
1002	307,
1003	308
1004]);
1005var redirectPreserveMethodStatusCodes = /* @__PURE__ */ new Set([307, 308]);
1006var IDLE_NAVIGATION = {
1007	state: "idle",
1008	location: void 0,
1009	formMethod: void 0,
1010	formAction: void 0,
1011	formEncType: void 0,
1012	formData: void 0,
1013	json: void 0,
1014	text: void 0
1015};
1016var IDLE_FETCHER = {
1017	state: "idle",
1018	data: void 0,
1019	formMethod: void 0,
1020	formAction: void 0,
1021	formEncType: void 0,
1022	formData: void 0,
1023	json: void 0,
1024	text: void 0
1025};
1026var IDLE_BLOCKER = {
1027	state: "unblocked",
1028	proceed: void 0,
1029	reset: void 0,
1030	location: void 0
1031};
1032var defaultMapRouteProperties = (route) => ({ hasErrorBoundary: Boolean(route.hasErrorBoundary) });
1033var TRANSITIONS_STORAGE_KEY = "remix-router-transitions";
1034var ResetLoaderDataSymbol = Symbol("ResetLoaderData");
1035function createRouter(init) {
1036	const routerWindow = init.window ? init.window : typeof window !== "undefined" ? window : void 0;
1037	const isBrowser3 = typeof routerWindow !== "undefined" && typeof routerWindow.document !== "undefined" && typeof routerWindow.document.createElement !== "undefined";
1038	invariant(init.routes.length > 0, "You must provide a non-empty routes array to createRouter");
1039	let hydrationRouteProperties2 = init.hydrationRouteProperties || [];
1040	let _mapRouteProperties = init.mapRouteProperties || defaultMapRouteProperties;
1041	let mapRouteProperties2 = _mapRouteProperties;
1042	if (init.unstable_instrumentations) {
1043		let instrumentations = init.unstable_instrumentations;
1044		mapRouteProperties2 = (route) => {
1045			return {
1046				..._mapRouteProperties(route),
1047				...getRouteInstrumentationUpdates(instrumentations.map((i) => i.route).filter(Boolean), route)
1048			};
1049		};
1050	}
1051	let manifest = {};
1052	let dataRoutes = convertRoutesToDataRoutes(init.routes, mapRouteProperties2, void 0, manifest);
1053	let inFlightDataRoutes;
1054	let basename = init.basename || "/";
1055	if (!basename.startsWith("/")) basename = `/${basename}`;
1056	let dataStrategyImpl = init.dataStrategy || defaultDataStrategyWithMiddleware;
1057	let future = {
1058		unstable_passThroughRequests: false,
1059		...init.future
1060	};
1061	let unlistenHistory = null;
1062	let subscribers = /* @__PURE__ */ new Set();
1063	let savedScrollPositions2 = null;
1064	let getScrollRestorationKey2 = null;
1065	let getScrollPosition = null;
1066	let initialScrollRestored = init.hydrationData != null;
1067	let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);
1068	let initialMatchesIsFOW = false;
vendor: 29,871 bytes, lines 1069-1763
1069	let initialErrors = null;
1070	let initialized;
1071	let renderFallback;
1072	if (initialMatches == null && !init.patchRoutesOnNavigation) {
1073		let error = getInternalRouterError(404, { pathname: init.history.location.pathname });
1074		let { matches, route } = getShortCircuitMatches(dataRoutes);
1075		initialized = true;
1076		renderFallback = !initialized;
1077		initialMatches = matches;
1078		initialErrors = { [route.id]: error };
1079	} else {
1080		if (initialMatches && !init.hydrationData) {
1081			if (checkFogOfWar(initialMatches, dataRoutes, init.history.location.pathname).active) initialMatches = null;
1082		}
1083		if (!initialMatches) {
1084			initialized = false;
1085			renderFallback = !initialized;
1086			initialMatches = [];
1087			let fogOfWar = checkFogOfWar(null, dataRoutes, init.history.location.pathname);
1088			if (fogOfWar.active && fogOfWar.matches) {
1089				initialMatchesIsFOW = true;
1090				initialMatches = fogOfWar.matches;
1091			}
1092		} else if (initialMatches.some((m) => m.route.lazy)) {
1093			initialized = false;
1094			renderFallback = !initialized;
1095		} else if (!initialMatches.some((m) => routeHasLoaderOrMiddleware(m.route))) {
1096			initialized = true;
1097			renderFallback = !initialized;
1098		} else {
1099			let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;
1100			let errors = init.hydrationData ? init.hydrationData.errors : null;
1101			let relevantMatches = initialMatches;
1102			if (errors) {
1103				let idx = initialMatches.findIndex((m) => errors[m.route.id] !== void 0);
1104				relevantMatches = relevantMatches.slice(0, idx + 1);
1105			}
1106			renderFallback = false;
1107			initialized = true;
1108			relevantMatches.forEach((m) => {
1109				let status = getRouteHydrationStatus(m.route, loaderData, errors);
1110				renderFallback = renderFallback || status.renderFallback;
1111				initialized = initialized && !status.shouldLoad;
1112			});
1113		}
1114	}
1115	let router;
1116	let state = {
1117		historyAction: init.history.action,
1118		location: init.history.location,
1119		matches: initialMatches,
1120		initialized,
1121		renderFallback,
1122		navigation: IDLE_NAVIGATION,
1123		restoreScrollPosition: init.hydrationData != null ? false : null,
1124		preventScrollReset: false,
1125		revalidation: "idle",
1126		loaderData: init.hydrationData && init.hydrationData.loaderData || {},
1127		actionData: init.hydrationData && init.hydrationData.actionData || null,
1128		errors: init.hydrationData && init.hydrationData.errors || initialErrors,
1129		fetchers: /* @__PURE__ */ new Map(),
1130		blockers: /* @__PURE__ */ new Map()
1131	};
1132	let pendingAction = "POP";
1133	let pendingPopstateNavigationDfd = null;
1134	let pendingPreventScrollReset = false;
1135	let pendingNavigationController;
1136	let pendingViewTransitionEnabled = false;
1137	let appliedViewTransitions = /* @__PURE__ */ new Map();
1138	let removePageHideEventListener = null;
1139	let isUninterruptedRevalidation = false;
1140	let isRevalidationRequired = false;
1141	let cancelledFetcherLoads = /* @__PURE__ */ new Set();
1142	let fetchControllers = /* @__PURE__ */ new Map();
1143	let incrementingLoadId = 0;
1144	let pendingNavigationLoadId = -1;
1145	let fetchReloadIds = /* @__PURE__ */ new Map();
1146	let fetchRedirectIds = /* @__PURE__ */ new Set();
1147	let fetchLoadMatches = /* @__PURE__ */ new Map();
1148	let activeFetchers = /* @__PURE__ */ new Map();
1149	let fetchersQueuedForDeletion = /* @__PURE__ */ new Set();
1150	let blockerFunctions = /* @__PURE__ */ new Map();
1151	let unblockBlockerHistoryUpdate = void 0;
1152	let pendingRevalidationDfd = null;
1153	function initialize() {
1154		unlistenHistory = init.history.listen(({ action: historyAction, location, delta }) => {
1155			if (unblockBlockerHistoryUpdate) {
1156				unblockBlockerHistoryUpdate();
1157				unblockBlockerHistoryUpdate = void 0;
1158				return;
1159			}
1160			warning(blockerFunctions.size === 0 || delta != null, "You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs.  This can also happen if you are using createHashRouter and the user manually changes the URL.");
1161			let blockerKey = shouldBlockNavigation({
1162				currentLocation: state.location,
1163				nextLocation: location,
1164				historyAction
1165			});
1166			if (blockerKey && delta != null) {
1167				let nextHistoryUpdatePromise = new Promise((resolve) => {
1168					unblockBlockerHistoryUpdate = resolve;
1169				});
1170				init.history.go(delta * -1);
1171				updateBlocker(blockerKey, {
1172					state: "blocked",
1173					location,
1174					proceed() {
1175						updateBlocker(blockerKey, {
1176							state: "proceeding",
1177							proceed: void 0,
1178							reset: void 0,
1179							location
1180						});
1181						nextHistoryUpdatePromise.then(() => init.history.go(delta));
1182					},
1183					reset() {
1184						let blockers = new Map(state.blockers);
1185						blockers.set(blockerKey, IDLE_BLOCKER);
1186						updateState({ blockers });
1187					}
1188				});
1189				pendingPopstateNavigationDfd?.resolve();
1190				pendingPopstateNavigationDfd = null;
1191				return;
1192			}
1193			return startNavigation(historyAction, location);
1194		});
1195		if (isBrowser3) {
1196			restoreAppliedTransitions(routerWindow, appliedViewTransitions);
1197			let _saveAppliedTransitions = () => persistAppliedTransitions(routerWindow, appliedViewTransitions);
1198			routerWindow.addEventListener("pagehide", _saveAppliedTransitions);
1199			removePageHideEventListener = () => routerWindow.removeEventListener("pagehide", _saveAppliedTransitions);
1200		}
1201		if (!state.initialized) startNavigation("POP", state.location, { initialHydration: true });
1202		return router;
1203	}
1204	function dispose() {
1205		if (unlistenHistory) unlistenHistory();
1206		if (removePageHideEventListener) removePageHideEventListener();
1207		subscribers.clear();
1208		pendingNavigationController && pendingNavigationController.abort();
1209		state.fetchers.forEach((_, key) => deleteFetcher(key));
1210		state.blockers.forEach((_, key) => deleteBlocker(key));
1211	}
1212	function subscribe(fn) {
1213		subscribers.add(fn);
1214		return () => subscribers.delete(fn);
1215	}
1216	function updateState(newState, opts = {}) {
1217		if (newState.matches) newState.matches = newState.matches.map((m) => {
1218			let route = manifest[m.route.id];
1219			let matchRoute = m.route;
1220			if (matchRoute.element !== route.element || matchRoute.errorElement !== route.errorElement || matchRoute.hydrateFallbackElement !== route.hydrateFallbackElement) return {
1221				...m,
1222				route
1223			};
1224			return m;
1225		});
1226		state = {
1227			...state,
1228			...newState
1229		};
1230		let unmountedFetchers = [];
1231		let mountedFetchers = [];
1232		state.fetchers.forEach((fetcher, key) => {
1233			if (fetcher.state === "idle") if (fetchersQueuedForDeletion.has(key)) unmountedFetchers.push(key);
1234			else mountedFetchers.push(key);
1235		});
1236		fetchersQueuedForDeletion.forEach((key) => {
1237			if (!state.fetchers.has(key) && !fetchControllers.has(key)) unmountedFetchers.push(key);
1238		});
1239		[...subscribers].forEach((subscriber) => subscriber(state, {
1240			deletedFetchers: unmountedFetchers,
1241			newErrors: newState.errors ?? null,
1242			viewTransitionOpts: opts.viewTransitionOpts,
1243			flushSync: opts.flushSync === true
1244		}));
1245		unmountedFetchers.forEach((key) => deleteFetcher(key));
1246		mountedFetchers.forEach((key) => state.fetchers.delete(key));
1247	}
1248	function completeNavigation(location, newState, { flushSync } = {}) {
1249		let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === "loading" && location.state?._isRedirect !== true;
1250		let actionData;
1251		if (newState.actionData) if (Object.keys(newState.actionData).length > 0) actionData = newState.actionData;
1252		else actionData = null;
1253		else if (isActionReload) actionData = state.actionData;
1254		else actionData = null;
1255		let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData;
1256		let blockers = state.blockers;
1257		if (blockers.size > 0) {
1258			blockers = new Map(blockers);
1259			blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));
1260		}
1261		let restoreScrollPosition = isUninterruptedRevalidation ? false : getSavedScrollPosition(location, newState.matches || state.matches);
1262		let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && location.state?._isRedirect !== true;
1263		if (inFlightDataRoutes) {
1264			dataRoutes = inFlightDataRoutes;
1265			inFlightDataRoutes = void 0;
1266		}
1267		if (isUninterruptedRevalidation) {} else if (pendingAction === "POP") {} else if (pendingAction === "PUSH") init.history.push(location, location.state);
1268		else if (pendingAction === "REPLACE") init.history.replace(location, location.state);
1269		let viewTransitionOpts;
1270		if (pendingAction === "POP") {
1271			let priorPaths = appliedViewTransitions.get(state.location.pathname);
1272			if (priorPaths && priorPaths.has(location.pathname)) viewTransitionOpts = {
1273				currentLocation: state.location,
1274				nextLocation: location
1275			};
1276			else if (appliedViewTransitions.has(location.pathname)) viewTransitionOpts = {
1277				currentLocation: location,
1278				nextLocation: state.location
1279			};
1280		} else if (pendingViewTransitionEnabled) {
1281			let toPaths = appliedViewTransitions.get(state.location.pathname);
1282			if (toPaths) toPaths.add(location.pathname);
1283			else {
1284				toPaths = /* @__PURE__ */ new Set([location.pathname]);
1285				appliedViewTransitions.set(state.location.pathname, toPaths);
1286			}
1287			viewTransitionOpts = {
1288				currentLocation: state.location,
1289				nextLocation: location
1290			};
1291		}
1292		updateState({
1293			...newState,
1294			actionData,
1295			loaderData,
1296			historyAction: pendingAction,
1297			location,
1298			initialized: true,
1299			renderFallback: false,
1300			navigation: IDLE_NAVIGATION,
1301			revalidation: "idle",
1302			restoreScrollPosition,
1303			preventScrollReset,
1304			blockers
1305		}, {
1306			viewTransitionOpts,
1307			flushSync: flushSync === true
1308		});
1309		pendingAction = "POP";
1310		pendingPreventScrollReset = false;
1311		pendingViewTransitionEnabled = false;
1312		isUninterruptedRevalidation = false;
1313		isRevalidationRequired = false;
1314		pendingPopstateNavigationDfd?.resolve();
1315		pendingPopstateNavigationDfd = null;
1316		pendingRevalidationDfd?.resolve();
1317		pendingRevalidationDfd = null;
1318	}
1319	async function navigate(to, opts) {
1320		pendingPopstateNavigationDfd?.resolve();
1321		pendingPopstateNavigationDfd = null;
1322		if (typeof to === "number") {
1323			if (!pendingPopstateNavigationDfd) pendingPopstateNavigationDfd = createDeferred();
1324			let promise = pendingPopstateNavigationDfd.promise;
1325			init.history.go(to);
1326			return promise;
1327		}
1328		let { path, submission, error } = normalizeNavigateOptions(false, normalizeTo(state.location, state.matches, basename, to, opts?.fromRouteId, opts?.relative), opts);
1329		let maskPath;
1330		if (opts?.unstable_mask) maskPath = {
1331			pathname: "",
1332			search: "",
1333			hash: "",
1334			...typeof opts.unstable_mask === "string" ? parsePath(opts.unstable_mask) : {
1335				...state.location.unstable_mask,
1336				...opts.unstable_mask
1337			}
1338		};
1339		let currentLocation = state.location;
1340		let nextLocation = createLocation(currentLocation, path, opts && opts.state, void 0, maskPath);
1341		nextLocation = {
1342			...nextLocation,
1343			...init.history.encodeLocation(nextLocation)
1344		};
1345		let userReplace = opts && opts.replace != null ? opts.replace : void 0;
1346		let historyAction = "PUSH";
1347		if (userReplace === true) historyAction = "REPLACE";
1348		else if (userReplace === false) {} else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) historyAction = "REPLACE";
1349		let preventScrollReset = opts && "preventScrollReset" in opts ? opts.preventScrollReset === true : void 0;
1350		let flushSync = (opts && opts.flushSync) === true;
1351		let blockerKey = shouldBlockNavigation({
1352			currentLocation,
1353			nextLocation,
1354			historyAction
1355		});
1356		if (blockerKey) {
1357			updateBlocker(blockerKey, {
1358				state: "blocked",
1359				location: nextLocation,
1360				proceed() {
1361					updateBlocker(blockerKey, {
1362						state: "proceeding",
1363						proceed: void 0,
1364						reset: void 0,
1365						location: nextLocation
1366					});
1367					navigate(to, opts);
1368				},
1369				reset() {
1370					let blockers = new Map(state.blockers);
1371					blockers.set(blockerKey, IDLE_BLOCKER);
1372					updateState({ blockers });
1373				}
1374			});
1375			return;
1376		}
1377		await startNavigation(historyAction, nextLocation, {
1378			submission,
1379			pendingError: error,
1380			preventScrollReset,
1381			replace: opts && opts.replace,
1382			enableViewTransition: opts && opts.viewTransition,
1383			flushSync,
1384			callSiteDefaultShouldRevalidate: opts && opts.unstable_defaultShouldRevalidate
1385		});
1386	}
1387	function revalidate() {
1388		if (!pendingRevalidationDfd) pendingRevalidationDfd = createDeferred();
1389		interruptActiveLoads();
1390		updateState({ revalidation: "loading" });
1391		let promise = pendingRevalidationDfd.promise;
1392		if (state.navigation.state === "submitting") return promise;
1393		if (state.navigation.state === "idle") {
1394			startNavigation(state.historyAction, state.location, { startUninterruptedRevalidation: true });
1395			return promise;
1396		}
1397		startNavigation(pendingAction || state.historyAction, state.navigation.location, {
1398			overrideNavigation: state.navigation,
1399			enableViewTransition: pendingViewTransitionEnabled === true
1400		});
1401		return promise;
1402	}
1403	async function startNavigation(historyAction, location, opts) {
1404		pendingNavigationController && pendingNavigationController.abort();
1405		pendingNavigationController = null;
1406		pendingAction = historyAction;
1407		isUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true;
1408		saveScrollPosition(state.location, state.matches);
1409		pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;
1410		pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;
1411		let routesToUse = inFlightDataRoutes || dataRoutes;
1412		let loadingNavigation = opts && opts.overrideNavigation;
1413		let matches = opts?.initialHydration && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ? state.matches : matchRoutes(routesToUse, location, basename);
1414		let flushSync = (opts && opts.flushSync) === true;
1415		if (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {
1416			completeNavigation(location, { matches }, { flushSync });
1417			return;
1418		}
1419		let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname);
1420		if (fogOfWar.active && fogOfWar.matches) matches = fogOfWar.matches;
1421		if (!matches) {
1422			let { error, notFoundMatches, route } = handleNavigational404(location.pathname);
1423			completeNavigation(location, {
1424				matches: notFoundMatches,
1425				loaderData: {},
1426				errors: { [route.id]: error }
1427			}, { flushSync });
1428			return;
1429		}
1430		pendingNavigationController = new AbortController();
1431		let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);
1432		let scopedContext = init.getContext ? await init.getContext() : new RouterContextProvider();
1433		let pendingActionResult;
1434		if (opts && opts.pendingError) pendingActionResult = [findNearestBoundary(matches).route.id, {
1435			type: "error",
1436			error: opts.pendingError
1437		}];
1438		else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) {
1439			let actionResult = await handleAction(request, location, opts.submission, matches, scopedContext, fogOfWar.active, opts && opts.initialHydration === true, {
1440				replace: opts.replace,
1441				flushSync
1442			});
1443			if (actionResult.shortCircuited) return;
1444			if (actionResult.pendingActionResult) {
1445				let [routeId, result] = actionResult.pendingActionResult;
1446				if (isErrorResult(result) && isRouteErrorResponse(result.error) && result.error.status === 404) {
1447					pendingNavigationController = null;
1448					completeNavigation(location, {
1449						matches: actionResult.matches,
1450						loaderData: {},
1451						errors: { [routeId]: result.error }
1452					});
1453					return;
1454				}
1455			}
1456			matches = actionResult.matches || matches;
1457			pendingActionResult = actionResult.pendingActionResult;
1458			loadingNavigation = getLoadingNavigation(location, opts.submission);
1459			flushSync = false;
1460			fogOfWar.active = false;
1461			request = createClientSideRequest(init.history, request.url, request.signal);
1462		}
1463		let { shortCircuited, matches: updatedMatches, loaderData, errors } = await handleLoaders(request, location, matches, scopedContext, fogOfWar.active, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, opts && opts.initialHydration === true, flushSync, pendingActionResult, opts && opts.callSiteDefaultShouldRevalidate);
1464		if (shortCircuited) return;
1465		pendingNavigationController = null;
1466		completeNavigation(location, {
1467			matches: updatedMatches || matches,
1468			...getActionDataForCommit(pendingActionResult),
1469			loaderData,
1470			errors
1471		});
1472	}
1473	async function handleAction(request, location, submission, matches, scopedContext, isFogOfWar, initialHydration, opts = {}) {
1474		interruptActiveLoads();
1475		updateState({ navigation: getSubmittingNavigation(location, submission) }, { flushSync: opts.flushSync === true });
1476		if (isFogOfWar) {
1477			let discoverResult = await discoverRoutes(matches, location.pathname, request.signal);
1478			if (discoverResult.type === "aborted") return { shortCircuited: true };
1479			else if (discoverResult.type === "error") {
1480				if (discoverResult.partialMatches.length === 0) {
1481					let { matches: matches2, route } = getShortCircuitMatches(dataRoutes);
1482					return {
1483						matches: matches2,
1484						pendingActionResult: [route.id, {
1485							type: "error",
1486							error: discoverResult.error
1487						}]
1488					};
1489				}
1490				let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;
1491				return {
1492					matches: discoverResult.partialMatches,
1493					pendingActionResult: [boundaryId, {
1494						type: "error",
1495						error: discoverResult.error
1496					}]
1497				};
1498			} else if (!discoverResult.matches) {
1499				let { notFoundMatches, error, route } = handleNavigational404(location.pathname);
1500				return {
1501					matches: notFoundMatches,
1502					pendingActionResult: [route.id, {
1503						type: "error",
1504						error
1505					}]
1506				};
1507			} else matches = discoverResult.matches;
1508		}
1509		let result;
1510		let actionMatch = getTargetMatch(matches, location);
1511		if (!actionMatch.route.action && !actionMatch.route.lazy) result = {
1512			type: "error",
1513			error: getInternalRouterError(405, {
1514				method: request.method,
1515				pathname: location.pathname,
1516				routeId: actionMatch.route.id
1517			})
1518		};
1519		else {
1520			let results = await callDataStrategy(request, location, getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request, location, matches, actionMatch, initialHydration ? [] : hydrationRouteProperties2, scopedContext), scopedContext, null);
1521			result = results[actionMatch.route.id];
1522			if (!result) {
1523				for (let match of matches) if (results[match.route.id]) {
1524					result = results[match.route.id];
1525					break;
1526				}
1527			}
1528			if (request.signal.aborted) return { shortCircuited: true };
1529		}
1530		if (isRedirectResult(result)) {
1531			let replace2;
1532			if (opts && opts.replace != null) replace2 = opts.replace;
1533			else replace2 = normalizeRedirectLocation(result.response.headers.get("Location"), new URL(request.url), basename, init.history) === state.location.pathname + state.location.search;
1534			await startRedirectNavigation(request, result, true, {
1535				submission,
1536				replace: replace2
1537			});
1538			return { shortCircuited: true };
1539		}
1540		if (isErrorResult(result)) {
1541			let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);
1542			if ((opts && opts.replace) !== true) pendingAction = "PUSH";
1543			return {
1544				matches,
1545				pendingActionResult: [
1546					boundaryMatch.route.id,
1547					result,
1548					actionMatch.route.id
1549				]
1550			};
1551		}
1552		return {
1553			matches,
1554			pendingActionResult: [actionMatch.route.id, result]
1555		};
1556	}
1557	async function handleLoaders(request, location, matches, scopedContext, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace2, initialHydration, flushSync, pendingActionResult, callSiteDefaultShouldRevalidate) {
1558		let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission);
1559		let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);
1560		let shouldUpdateNavigationState = !isUninterruptedRevalidation && !initialHydration;
1561		if (isFogOfWar) {
1562			if (shouldUpdateNavigationState) {
1563				let actionData = getUpdatedActionData(pendingActionResult);
1564				updateState({
1565					navigation: loadingNavigation,
1566					...actionData !== void 0 ? { actionData } : {}
1567				}, { flushSync });
1568			}
1569			let discoverResult = await discoverRoutes(matches, location.pathname, request.signal);
1570			if (discoverResult.type === "aborted") return { shortCircuited: true };
1571			else if (discoverResult.type === "error") {
1572				if (discoverResult.partialMatches.length === 0) {
1573					let { matches: matches2, route } = getShortCircuitMatches(dataRoutes);
1574					return {
1575						matches: matches2,
1576						loaderData: {},
1577						errors: { [route.id]: discoverResult.error }
1578					};
1579				}
1580				let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;
1581				return {
1582					matches: discoverResult.partialMatches,
1583					loaderData: {},
1584					errors: { [boundaryId]: discoverResult.error }
1585				};
1586			} else if (!discoverResult.matches) {
1587				let { error, notFoundMatches, route } = handleNavigational404(location.pathname);
1588				return {
1589					matches: notFoundMatches,
1590					loaderData: {},
1591					errors: { [route.id]: error }
1592				};
1593			} else matches = discoverResult.matches;
1594		}
1595		let routesToUse = inFlightDataRoutes || dataRoutes;
1596		let { dsMatches, revalidatingFetchers } = getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest, init.history, state, matches, activeSubmission, location, initialHydration ? [] : hydrationRouteProperties2, initialHydration === true, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, init.patchRoutesOnNavigation != null, pendingActionResult, callSiteDefaultShouldRevalidate);
1597		pendingNavigationLoadId = ++incrementingLoadId;
1598		if (!init.dataStrategy && !dsMatches.some((m) => m.shouldLoad) && !dsMatches.some((m) => m.route.middleware && m.route.middleware.length > 0) && revalidatingFetchers.length === 0) {
1599			let updatedFetchers2 = markFetchRedirectsDone();
1600			completeNavigation(location, {
1601				matches,
1602				loaderData: {},
1603				errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? { [pendingActionResult[0]]: pendingActionResult[1].error } : null,
1604				...getActionDataForCommit(pendingActionResult),
1605				...updatedFetchers2 ? { fetchers: new Map(state.fetchers) } : {}
1606			}, { flushSync });
1607			return { shortCircuited: true };
1608		}
1609		if (shouldUpdateNavigationState) {
1610			let updates = {};
1611			if (!isFogOfWar) {
1612				updates.navigation = loadingNavigation;
1613				let actionData = getUpdatedActionData(pendingActionResult);
1614				if (actionData !== void 0) updates.actionData = actionData;
1615			}
1616			if (revalidatingFetchers.length > 0) updates.fetchers = getUpdatedRevalidatingFetchers(revalidatingFetchers);
1617			updateState(updates, { flushSync });
1618		}
1619		revalidatingFetchers.forEach((rf) => {
1620			abortFetcher(rf.key);
1621			if (rf.controller) fetchControllers.set(rf.key, rf.controller);
1622		});
1623		let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach((f) => abortFetcher(f.key));
1624		if (pendingNavigationController) pendingNavigationController.signal.addEventListener("abort", abortPendingFetchRevalidations);
1625		let { loaderResults, fetcherResults } = await callLoadersAndMaybeResolveData(dsMatches, revalidatingFetchers, request, location, scopedContext);
1626		if (request.signal.aborted) return { shortCircuited: true };
1627		if (pendingNavigationController) pendingNavigationController.signal.removeEventListener("abort", abortPendingFetchRevalidations);
1628		revalidatingFetchers.forEach((rf) => fetchControllers.delete(rf.key));
1629		let redirect2 = findRedirect(loaderResults);
1630		if (redirect2) {
1631			await startRedirectNavigation(request, redirect2.result, true, { replace: replace2 });
1632			return { shortCircuited: true };
1633		}
1634		redirect2 = findRedirect(fetcherResults);
1635		if (redirect2) {
1636			fetchRedirectIds.add(redirect2.key);
1637			await startRedirectNavigation(request, redirect2.result, true, { replace: replace2 });
1638			return { shortCircuited: true };
1639		}
1640		let { loaderData, errors } = processLoaderData(state, matches, loaderResults, pendingActionResult, revalidatingFetchers, fetcherResults);
1641		if (initialHydration && state.errors) errors = {
1642			...state.errors,
1643			...errors
1644		};
1645		let updatedFetchers = markFetchRedirectsDone();
1646		let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);
1647		let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;
1648		return {
1649			matches,
1650			loaderData,
1651			errors,
1652			...shouldUpdateFetchers ? { fetchers: new Map(state.fetchers) } : {}
1653		};
1654	}
1655	function getUpdatedActionData(pendingActionResult) {
1656		if (pendingActionResult && !isErrorResult(pendingActionResult[1])) return { [pendingActionResult[0]]: pendingActionResult[1].data };
1657		else if (state.actionData) if (Object.keys(state.actionData).length === 0) return null;
1658		else return state.actionData;
1659	}
1660	function getUpdatedRevalidatingFetchers(revalidatingFetchers) {
1661		revalidatingFetchers.forEach((rf) => {
1662			let fetcher = state.fetchers.get(rf.key);
1663			let revalidatingFetcher = getLoadingFetcher(void 0, fetcher ? fetcher.data : void 0);
1664			state.fetchers.set(rf.key, revalidatingFetcher);
1665		});
1666		return new Map(state.fetchers);
1667	}
1668	async function fetch2(key, routeId, href, opts) {
1669		abortFetcher(key);
1670		let flushSync = (opts && opts.flushSync) === true;
1671		let routesToUse = inFlightDataRoutes || dataRoutes;
1672		let normalizedPath = normalizeTo(state.location, state.matches, basename, href, routeId, opts?.relative);
1673		let matches = matchRoutes(routesToUse, normalizedPath, basename);
1674		let fogOfWar = checkFogOfWar(matches, routesToUse, normalizedPath);
1675		if (fogOfWar.active && fogOfWar.matches) matches = fogOfWar.matches;
1676		if (!matches) {
1677			setFetcherError(key, routeId, getInternalRouterError(404, { pathname: normalizedPath }), { flushSync });
1678			return;
1679		}
1680		let { path, submission, error } = normalizeNavigateOptions(true, normalizedPath, opts);
1681		if (error) {
1682			setFetcherError(key, routeId, error, { flushSync });
1683			return;
1684		}
1685		let scopedContext = init.getContext ? await init.getContext() : new RouterContextProvider();
1686		let preventScrollReset = (opts && opts.preventScrollReset) === true;
1687		if (submission && isMutationMethod(submission.formMethod)) {
1688			await handleFetcherAction(key, routeId, path, matches, scopedContext, fogOfWar.active, flushSync, preventScrollReset, submission, opts && opts.unstable_defaultShouldRevalidate);
1689			return;
1690		}
1691		fetchLoadMatches.set(key, {
1692			routeId,
1693			path
1694		});
1695		await handleFetcherLoader(key, routeId, path, matches, scopedContext, fogOfWar.active, flushSync, preventScrollReset, submission);
1696	}
1697	async function handleFetcherAction(key, routeId, path, requestMatches, scopedContext, isFogOfWar, flushSync, preventScrollReset, submission, callSiteDefaultShouldRevalidate) {
1698		interruptActiveLoads();
1699		fetchLoadMatches.delete(key);
1700		updateFetcherState(key, getSubmittingFetcher(submission, state.fetchers.get(key)), { flushSync });
1701		let abortController = new AbortController();
1702		let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);
1703		if (isFogOfWar) {
1704			let discoverResult = await discoverRoutes(requestMatches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);
1705			if (discoverResult.type === "aborted") return;
1706			else if (discoverResult.type === "error") {
1707				setFetcherError(key, routeId, discoverResult.error, { flushSync });
1708				return;
1709			} else if (!discoverResult.matches) {
1710				setFetcherError(key, routeId, getInternalRouterError(404, { pathname: path }), { flushSync });
1711				return;
1712			} else requestMatches = discoverResult.matches;
1713		}
1714		let match = getTargetMatch(requestMatches, path);
1715		if (!match.route.action && !match.route.lazy) {
1716			setFetcherError(key, routeId, getInternalRouterError(405, {
1717				method: submission.formMethod,
1718				pathname: path,
1719				routeId
1720			}), { flushSync });
1721			return;
1722		}
1723		fetchControllers.set(key, abortController);
1724		let originatingLoadId = incrementingLoadId;
1725		let fetchMatches = getTargetedDataStrategyMatches(mapRouteProperties2, manifest, fetchRequest, path, requestMatches, match, hydrationRouteProperties2, scopedContext);
1726		let actionResults = await callDataStrategy(fetchRequest, path, fetchMatches, scopedContext, key);
1727		let actionResult = actionResults[match.route.id];
1728		if (!actionResult) {
1729			for (let match2 of fetchMatches) if (actionResults[match2.route.id]) {
1730				actionResult = actionResults[match2.route.id];
1731				break;
1732			}
1733		}
1734		if (fetchRequest.signal.aborted) {
1735			if (fetchControllers.get(key) === abortController) fetchControllers.delete(key);
1736			return;
1737		}
1738		if (fetchersQueuedForDeletion.has(key)) {
1739			if (isRedirectResult(actionResult) || isErrorResult(actionResult)) {
1740				updateFetcherState(key, getDoneFetcher(void 0));
1741				return;
1742			}
1743		} else {
1744			if (isRedirectResult(actionResult)) {
1745				fetchControllers.delete(key);
1746				if (pendingNavigationLoadId > originatingLoadId) {
1747					updateFetcherState(key, getDoneFetcher(void 0));
1748					return;
1749				} else {
1750					fetchRedirectIds.add(key);
1751					updateFetcherState(key, getLoadingFetcher(submission));
1752					return startRedirectNavigation(fetchRequest, actionResult, false, {
1753						fetcherSubmission: submission,
1754						preventScrollReset
1755					});
1756				}
1757			}
1758			if (isErrorResult(actionResult)) {
1759				setFetcherError(key, routeId, actionResult.error);
1760				return;
1761			}
1762		}
1763		let nextLocation = state.navigation.location || state.location;
1764		let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal);
1765		let routesToUse = inFlightDataRoutes || dataRoutes;
1766		let matches = state.navigation.state !== "idle" ? matchRoutes(routesToUse, state.navigation.location, basename) : state.matches;
1767		invariant(matches, "Didn't find any matches after fetcher action");
1768		let loadId = ++incrementingLoadId;
1769		fetchReloadIds.set(key, loadId);
1770		let loadFetcher = getLoadingFetcher(submission, actionResult.data);
1771		state.fetchers.set(key, loadFetcher);
1772		let { dsMatches, revalidatingFetchers } = getMatchesToLoad(revalidationRequest, scopedContext, mapRouteProperties2, manifest, init.history, state, matches, submission, nextLocation, hydrationRouteProperties2, false, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, init.patchRoutesOnNavigation != null, [match.route.id, actionResult], callSiteDefaultShouldRevalidate);
1773		revalidatingFetchers.filter((rf) => rf.key !== key).forEach((rf) => {
1774			let staleKey = rf.key;
1775			let existingFetcher2 = state.fetchers.get(staleKey);
1776			let revalidatingFetcher = getLoadingFetcher(void 0, existingFetcher2 ? existingFetcher2.data : void 0);
1777			state.fetchers.set(staleKey, revalidatingFetcher);
1778			abortFetcher(staleKey);
1779			if (rf.controller) fetchControllers.set(staleKey, rf.controller);
1780		});
1781		updateState({ fetchers: new Map(state.fetchers) });
1782		let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach((rf) => abortFetcher(rf.key));
1783		abortController.signal.addEventListener("abort", abortPendingFetchRevalidations);
1784		let { loaderResults, fetcherResults } = await callLoadersAndMaybeResolveData(dsMatches, revalidatingFetchers, revalidationRequest, nextLocation, scopedContext);
1785		if (abortController.signal.aborted) return;
1786		abortController.signal.removeEventListener("abort", abortPendingFetchRevalidations);
1787		fetchReloadIds.delete(key);
1788		fetchControllers.delete(key);
1789		revalidatingFetchers.forEach((r) => fetchControllers.delete(r.key));
1790		if (state.fetchers.has(key)) {
1791			let doneFetcher = getDoneFetcher(actionResult.data);
1792			state.fetchers.set(key, doneFetcher);
1793		}
1794		let redirect2 = findRedirect(loaderResults);
1795		if (redirect2) return startRedirectNavigation(revalidationRequest, redirect2.result, false, { preventScrollReset });
1796		redirect2 = findRedirect(fetcherResults);
1797		if (redirect2) {
1798			fetchRedirectIds.add(redirect2.key);
1799			return startRedirectNavigation(revalidationRequest, redirect2.result, false, { preventScrollReset });
1800		}
1801		let { loaderData, errors } = processLoaderData(state, matches, loaderResults, void 0, revalidatingFetchers, fetcherResults);
vendor: 12,891 bytes, lines 1802-2104
1802		abortStaleFetchLoads(loadId);
1803		if (state.navigation.state === "loading" && loadId > pendingNavigationLoadId) {
1804			invariant(pendingAction, "Expected pending action");
1805			pendingNavigationController && pendingNavigationController.abort();
1806			completeNavigation(state.navigation.location, {
1807				matches,
1808				loaderData,
1809				errors,
1810				fetchers: new Map(state.fetchers)
1811			});
1812		} else {
1813			updateState({
1814				errors,
1815				loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors),
1816				fetchers: new Map(state.fetchers)
1817			});
1818			isRevalidationRequired = false;
1819		}
1820	}
1821	async function handleFetcherLoader(key, routeId, path, matches, scopedContext, isFogOfWar, flushSync, preventScrollReset, submission) {
1822		let existingFetcher = state.fetchers.get(key);
1823		updateFetcherState(key, getLoadingFetcher(submission, existingFetcher ? existingFetcher.data : void 0), { flushSync });
1824		let abortController = new AbortController();
1825		let fetchRequest = createClientSideRequest(init.history, path, abortController.signal);
1826		if (isFogOfWar) {
1827			let discoverResult = await discoverRoutes(matches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);
1828			if (discoverResult.type === "aborted") return;
1829			else if (discoverResult.type === "error") {
1830				setFetcherError(key, routeId, discoverResult.error, { flushSync });
1831				return;
1832			} else if (!discoverResult.matches) {
1833				setFetcherError(key, routeId, getInternalRouterError(404, { pathname: path }), { flushSync });
1834				return;
1835			} else matches = discoverResult.matches;
1836		}
1837		let match = getTargetMatch(matches, path);
1838		fetchControllers.set(key, abortController);
1839		let originatingLoadId = incrementingLoadId;
1840		let result = (await callDataStrategy(fetchRequest, path, getTargetedDataStrategyMatches(mapRouteProperties2, manifest, fetchRequest, path, matches, match, hydrationRouteProperties2, scopedContext), scopedContext, key))[match.route.id];
1841		if (fetchControllers.get(key) === abortController) fetchControllers.delete(key);
1842		if (fetchRequest.signal.aborted) return;
1843		if (fetchersQueuedForDeletion.has(key)) {
1844			updateFetcherState(key, getDoneFetcher(void 0));
1845			return;
1846		}
1847		if (isRedirectResult(result)) if (pendingNavigationLoadId > originatingLoadId) {
1848			updateFetcherState(key, getDoneFetcher(void 0));
1849			return;
1850		} else {
1851			fetchRedirectIds.add(key);
1852			await startRedirectNavigation(fetchRequest, result, false, { preventScrollReset });
1853			return;
1854		}
1855		if (isErrorResult(result)) {
1856			setFetcherError(key, routeId, result.error);
1857			return;
1858		}
1859		updateFetcherState(key, getDoneFetcher(result.data));
1860	}
1861	async function startRedirectNavigation(request, redirect2, isNavigation, { submission, fetcherSubmission, preventScrollReset, replace: replace2 } = {}) {
1862		if (!isNavigation) {
1863			pendingPopstateNavigationDfd?.resolve();
1864			pendingPopstateNavigationDfd = null;
1865		}
1866		if (redirect2.response.headers.has("X-Remix-Revalidate")) isRevalidationRequired = true;
1867		let location = redirect2.response.headers.get("Location");
1868		invariant(location, "Expected a Location header on the redirect Response");
1869		location = normalizeRedirectLocation(location, new URL(request.url), basename, init.history);
1870		let redirectLocation = createLocation(state.location, location, { _isRedirect: true });
1871		if (isBrowser3) {
1872			let isDocumentReload = false;
1873			if (redirect2.response.headers.has("X-Remix-Reload-Document")) isDocumentReload = true;
1874			else if (isAbsoluteUrl(location)) {
1875				const url = createBrowserURLImpl(location, true);
1876				isDocumentReload = url.origin !== routerWindow.location.origin || stripBasename(url.pathname, basename) == null;
1877			}
1878			if (isDocumentReload) {
1879				if (replace2) routerWindow.location.replace(location);
1880				else routerWindow.location.assign(location);
1881				return;
1882			}
1883		}
1884		pendingNavigationController = null;
1885		let redirectNavigationType = replace2 === true || redirect2.response.headers.has("X-Remix-Replace") ? "REPLACE" : "PUSH";
1886		let { formMethod, formAction, formEncType } = state.navigation;
1887		if (!submission && !fetcherSubmission && formMethod && formAction && formEncType) submission = getSubmissionFromNavigation(state.navigation);
1888		let activeSubmission = submission || fetcherSubmission;
1889		if (redirectPreserveMethodStatusCodes.has(redirect2.response.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) await startNavigation(redirectNavigationType, redirectLocation, {
1890			submission: {
1891				...activeSubmission,
1892				formAction: location
1893			},
1894			preventScrollReset: preventScrollReset || pendingPreventScrollReset,
1895			enableViewTransition: isNavigation ? pendingViewTransitionEnabled : void 0
1896		});
1897		else await startNavigation(redirectNavigationType, redirectLocation, {
1898			overrideNavigation: getLoadingNavigation(redirectLocation, submission),
1899			fetcherSubmission,
1900			preventScrollReset: preventScrollReset || pendingPreventScrollReset,
1901			enableViewTransition: isNavigation ? pendingViewTransitionEnabled : void 0
1902		});
1903	}
1904	async function callDataStrategy(request, path, matches, scopedContext, fetcherKey) {
1905		let results;
1906		let dataResults = {};
1907		try {
1908			results = await callDataStrategyImpl(dataStrategyImpl, request, path, matches, fetcherKey, scopedContext, false);
1909		} catch (e) {
1910			matches.filter((m) => m.shouldLoad).forEach((m) => {
1911				dataResults[m.route.id] = {
1912					type: "error",
1913					error: e
1914				};
1915			});
1916			return dataResults;
1917		}
1918		if (request.signal.aborted) return dataResults;
1919		if (!isMutationMethod(request.method)) for (let match of matches) {
1920			if (results[match.route.id]?.type === "error") break;
1921			if (!results.hasOwnProperty(match.route.id) && !state.loaderData.hasOwnProperty(match.route.id) && (!state.errors || !state.errors.hasOwnProperty(match.route.id)) && match.shouldCallHandler()) results[match.route.id] = {
1922				type: "error",
1923				result: /* @__PURE__ */ new Error(`No result returned from dataStrategy for route ${match.route.id}`)
1924			};
1925		}
1926		for (let [routeId, result] of Object.entries(results)) if (isRedirectDataStrategyResult(result)) {
1927			let response = result.result;
1928			dataResults[routeId] = {
1929				type: "redirect",
1930				response: normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename)
1931			};
1932		} else dataResults[routeId] = await convertDataStrategyResultToDataResult(result);
1933		return dataResults;
1934	}
1935	async function callLoadersAndMaybeResolveData(matches, fetchersToLoad, request, location, scopedContext) {
1936		let loaderResultsPromise = callDataStrategy(request, location, matches, scopedContext, null);
1937		let fetcherResultsPromise = Promise.all(fetchersToLoad.map(async (f) => {
1938			if (f.matches && f.match && f.request && f.controller) {
1939				let result = (await callDataStrategy(f.request, f.path, f.matches, scopedContext, f.key))[f.match.route.id];
1940				return { [f.key]: result };
1941			} else return Promise.resolve({ [f.key]: {
1942				type: "error",
1943				error: getInternalRouterError(404, { pathname: f.path })
1944			} });
1945		}));
1946		return {
1947			loaderResults: await loaderResultsPromise,
1948			fetcherResults: (await fetcherResultsPromise).reduce((acc, r) => Object.assign(acc, r), {})
1949		};
1950	}
1951	function interruptActiveLoads() {
1952		isRevalidationRequired = true;
1953		fetchLoadMatches.forEach((_, key) => {
1954			if (fetchControllers.has(key)) cancelledFetcherLoads.add(key);
1955			abortFetcher(key);
1956		});
1957	}
1958	function updateFetcherState(key, fetcher, opts = {}) {
1959		state.fetchers.set(key, fetcher);
1960		updateState({ fetchers: new Map(state.fetchers) }, { flushSync: (opts && opts.flushSync) === true });
1961	}
1962	function setFetcherError(key, routeId, error, opts = {}) {
1963		let boundaryMatch = findNearestBoundary(state.matches, routeId);
1964		deleteFetcher(key);
1965		updateState({
1966			errors: { [boundaryMatch.route.id]: error },
1967			fetchers: new Map(state.fetchers)
1968		}, { flushSync: (opts && opts.flushSync) === true });
1969	}
1970	function getFetcher(key) {
1971		activeFetchers.set(key, (activeFetchers.get(key) || 0) + 1);
1972		if (fetchersQueuedForDeletion.has(key)) fetchersQueuedForDeletion.delete(key);
1973		return state.fetchers.get(key) || IDLE_FETCHER;
1974	}
1975	function resetFetcher(key, opts) {
1976		abortFetcher(key, opts?.reason);
1977		updateFetcherState(key, getDoneFetcher(null));
1978	}
1979	function deleteFetcher(key) {
1980		let fetcher = state.fetchers.get(key);
1981		if (fetchControllers.has(key) && !(fetcher && fetcher.state === "loading" && fetchReloadIds.has(key))) abortFetcher(key);
1982		fetchLoadMatches.delete(key);
1983		fetchReloadIds.delete(key);
1984		fetchRedirectIds.delete(key);
1985		fetchersQueuedForDeletion.delete(key);
1986		cancelledFetcherLoads.delete(key);
1987		state.fetchers.delete(key);
1988	}
1989	function queueFetcherForDeletion(key) {
1990		let count = (activeFetchers.get(key) || 0) - 1;
1991		if (count <= 0) {
1992			activeFetchers.delete(key);
1993			fetchersQueuedForDeletion.add(key);
1994		} else activeFetchers.set(key, count);
1995		updateState({ fetchers: new Map(state.fetchers) });
1996	}
1997	function abortFetcher(key, reason) {
1998		let controller = fetchControllers.get(key);
1999		if (controller) {
2000			controller.abort(reason);
2001			fetchControllers.delete(key);
2002		}
2003	}
2004	function markFetchersDone(keys) {
2005		for (let key of keys) {
2006			let doneFetcher = getDoneFetcher(getFetcher(key).data);
2007			state.fetchers.set(key, doneFetcher);
2008		}
2009	}
2010	function markFetchRedirectsDone() {
2011		let doneKeys = [];
2012		let updatedFetchers = false;
2013		for (let key of fetchRedirectIds) {
2014			let fetcher = state.fetchers.get(key);
2015			invariant(fetcher, `Expected fetcher: ${key}`);
2016			if (fetcher.state === "loading") {
2017				fetchRedirectIds.delete(key);
2018				doneKeys.push(key);
2019				updatedFetchers = true;
2020			}
2021		}
2022		markFetchersDone(doneKeys);
2023		return updatedFetchers;
2024	}
2025	function abortStaleFetchLoads(landedId) {
2026		let yeetedKeys = [];
2027		for (let [key, id] of fetchReloadIds) if (id < landedId) {
2028			let fetcher = state.fetchers.get(key);
2029			invariant(fetcher, `Expected fetcher: ${key}`);
2030			if (fetcher.state === "loading") {
2031				abortFetcher(key);
2032				fetchReloadIds.delete(key);
2033				yeetedKeys.push(key);
2034			}
2035		}
2036		markFetchersDone(yeetedKeys);
2037		return yeetedKeys.length > 0;
2038	}
2039	function getBlocker(key, fn) {
2040		let blocker = state.blockers.get(key) || IDLE_BLOCKER;
2041		if (blockerFunctions.get(key) !== fn) blockerFunctions.set(key, fn);
2042		return blocker;
2043	}
2044	function deleteBlocker(key) {
2045		state.blockers.delete(key);
2046		blockerFunctions.delete(key);
2047	}
2048	function updateBlocker(key, newBlocker) {
2049		let blocker = state.blockers.get(key) || IDLE_BLOCKER;
2050		invariant(blocker.state === "unblocked" && newBlocker.state === "blocked" || blocker.state === "blocked" && newBlocker.state === "blocked" || blocker.state === "blocked" && newBlocker.state === "proceeding" || blocker.state === "blocked" && newBlocker.state === "unblocked" || blocker.state === "proceeding" && newBlocker.state === "unblocked", `Invalid blocker state transition: ${blocker.state} -> ${newBlocker.state}`);
2051		let blockers = new Map(state.blockers);
2052		blockers.set(key, newBlocker);
2053		updateState({ blockers });
2054	}
2055	function shouldBlockNavigation({ currentLocation, nextLocation, historyAction }) {
2056		if (blockerFunctions.size === 0) return;
2057		if (blockerFunctions.size > 1) warning(false, "A router only supports one blocker at a time");
2058		let entries = Array.from(blockerFunctions.entries());
2059		let [blockerKey, blockerFunction] = entries[entries.length - 1];
2060		let blocker = state.blockers.get(blockerKey);
2061		if (blocker && blocker.state === "proceeding") return;
2062		if (blockerFunction({
2063			currentLocation,
2064			nextLocation,
2065			historyAction
2066		})) return blockerKey;
2067	}
2068	function handleNavigational404(pathname) {
2069		let error = getInternalRouterError(404, { pathname });
2070		let { matches, route } = getShortCircuitMatches(inFlightDataRoutes || dataRoutes);
2071		return {
2072			notFoundMatches: matches,
2073			route,
2074			error
2075		};
2076	}
2077	function enableScrollRestoration(positions, getPosition, getKey) {
2078		savedScrollPositions2 = positions;
2079		getScrollPosition = getPosition;
2080		getScrollRestorationKey2 = getKey || null;
2081		if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) {
2082			initialScrollRestored = true;
2083			let y = getSavedScrollPosition(state.location, state.matches);
2084			if (y != null) updateState({ restoreScrollPosition: y });
2085		}
2086		return () => {
2087			savedScrollPositions2 = null;
2088			getScrollPosition = null;
2089			getScrollRestorationKey2 = null;
2090		};
2091	}
2092	function getScrollKey(location, matches) {
2093		if (getScrollRestorationKey2) return getScrollRestorationKey2(location, matches.map((m) => convertRouteMatchToUiMatch(m, state.loaderData))) || location.key;
2094		return location.key;
2095	}
2096	function saveScrollPosition(location, matches) {
2097		if (savedScrollPositions2 && getScrollPosition) {
2098			let key = getScrollKey(location, matches);
2099			savedScrollPositions2[key] = getScrollPosition();
2100		}
2101	}
2102	function getSavedScrollPosition(location, matches) {
2103		if (savedScrollPositions2) {
2104			let key = getScrollKey(location, matches);
2105			let y = savedScrollPositions2[key];
2106			if (typeof y === "number") return y;
2107		}
2108		return null;
2109	}
2110	function checkFogOfWar(matches, routesToUse, pathname) {
2111		if (init.patchRoutesOnNavigation) {
2112			if (!matches) return {
2113				active: true,
2114				matches: matchRoutesImpl(routesToUse, pathname, basename, true) || []
2115			};
2116			else if (Object.keys(matches[0].params).length > 0) return {
2117				active: true,
2118				matches: matchRoutesImpl(routesToUse, pathname, basename, true)
2119			};
2120		}
2121		return {
2122			active: false,
2123			matches: null
2124		};
2125	}
2126	async function discoverRoutes(matches, pathname, signal, fetcherKey) {
2127		if (!init.patchRoutesOnNavigation) return {
2128			type: "success",
2129			matches
2130		};
2131		let partialMatches = matches;
2132		while (true) {
2133			let isNonHMR = inFlightDataRoutes == null;
2134			let routesToUse = inFlightDataRoutes || dataRoutes;
2135			let localManifest = manifest;
2136			try {
2137				await init.patchRoutesOnNavigation({
2138					signal,
2139					path: pathname,
2140					matches: partialMatches,
2141					fetcherKey,
2142					patch: (routeId, children) => {
2143						if (signal.aborted) return;
2144						patchRoutesImpl(routeId, children, routesToUse, localManifest, mapRouteProperties2, false);
2145					}
2146				});
2147			} catch (e) {
2148				return {
2149					type: "error",
2150					error: e,
2151					partialMatches
2152				};
2153			} finally {
2154				if (isNonHMR && !signal.aborted) dataRoutes = [...dataRoutes];
2155			}
2156			if (signal.aborted) return { type: "aborted" };
2157			let newMatches = matchRoutes(routesToUse, pathname, basename);
2158			let newPartialMatches = null;
2159			if (newMatches) if (Object.keys(newMatches[0].params).length === 0) return {
2160				type: "success",
2161				matches: newMatches
2162			};
2163			else {
2164				newPartialMatches = matchRoutesImpl(routesToUse, pathname, basename, true);
2165				if (!(newPartialMatches && partialMatches.length < newPartialMatches.length && compareMatches(partialMatches, newPartialMatches.slice(0, partialMatches.length)))) return {
2166					type: "success",
2167					matches: newMatches
2168				};
2169			}
2170			if (!newPartialMatches) newPartialMatches = matchRoutesImpl(routesToUse, pathname, basename, true);
2171			if (!newPartialMatches || compareMatches(partialMatches, newPartialMatches)) return {
2172				type: "success",
2173				matches: null
2174			};
2175			partialMatches = newPartialMatches;
2176		}
2177	}
2178	function compareMatches(a, b) {
2179		return a.length === b.length && a.every((m, i) => m.route.id === b[i].route.id);
2180	}
2181	function _internalSetRoutes(newRoutes) {
2182		manifest = {};
2183		inFlightDataRoutes = convertRoutesToDataRoutes(newRoutes, mapRouteProperties2, void 0, manifest);
2184	}
2185	function patchRoutes(routeId, children, unstable_allowElementMutations = false) {
2186		let isNonHMR = inFlightDataRoutes == null;
2187		patchRoutesImpl(routeId, children, inFlightDataRoutes || dataRoutes, manifest, mapRouteProperties2, unstable_allowElementMutations);
2188		if (isNonHMR) {
2189			dataRoutes = [...dataRoutes];
2190			updateState({});
2191		}
2192	}
2193	router = {
2194		get basename() {
2195			return basename;
2196		},
2197		get future() {
2198			return future;
2199		},
2200		get state() {
2201			return state;
2202		},
2203		get routes() {
2204			return dataRoutes;
2205		},
2206		get window() {
2207			return routerWindow;
2208		},
2209		initialize,
2210		subscribe,
2211		enableScrollRestoration,
2212		navigate,
2213		fetch: fetch2,
2214		revalidate,
2215		createHref: (to) => init.history.createHref(to),
2216		encodeLocation: (to) => init.history.encodeLocation(to),
2217		getFetcher,
2218		resetFetcher,
2219		deleteFetcher: queueFetcherForDeletion,
2220		dispose,
2221		getBlocker,
2222		deleteBlocker,
2223		patchRoutes,
2224		_internalFetchControllers: fetchControllers,
2225		_internalSetRoutes,
2226		_internalSetStateDoNotUseOrYouWillBreakYourApp(newState) {
2227			updateState(newState);
2228		}
2229	};
2230	if (init.unstable_instrumentations) router = instrumentClientSideRouter(router, init.unstable_instrumentations.map((i) => i.router).filter(Boolean));
2231	return router;
2232}
2233function createStaticHandler(routes, opts) {
2234	invariant(routes.length > 0, "You must provide a non-empty routes array to createStaticHandler");
2235	let manifest = {};
2236	let basename = (opts ? opts.basename : null) || "/";
2237	let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
2238	let mapRouteProperties2 = _mapRouteProperties;
2239	({ ...opts?.future });
2240	if (opts?.unstable_instrumentations) {
2241		let instrumentations = opts.unstable_instrumentations;
2242		mapRouteProperties2 = (route) => {
2243			return {
2244				..._mapRouteProperties(route),
2245				...getRouteInstrumentationUpdates(instrumentations.map((i) =>
vendor: 9,665 bytes, lines 2245-2448
2245 i.route).filter(Boolean), route)
2246			};
2247		};
2248	}
2249	let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties2, void 0, manifest);
2250	async function query(request, { requestContext, filterMatchesToLoad, skipLoaderErrorBubbling, skipRevalidation, dataStrategy, generateMiddlewareResponse, unstable_normalizePath } = {}) {
2251		let normalizePath = unstable_normalizePath || defaultNormalizePath;
2252		let method = request.method;
2253		let location = createLocation("", normalizePath(request), null, "default");
2254		let matches = matchRoutes(dataRoutes, location, basename);
2255		requestContext = requestContext != null ? requestContext : new RouterContextProvider();
2256		if (!isValidMethod(method) && method !== "HEAD") {
2257			let error = getInternalRouterError(405, { method });
2258			let { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes);
2259			let staticContext = {
2260				basename,
2261				location,
2262				matches: methodNotAllowedMatches,
2263				loaderData: {},
2264				actionData: null,
2265				errors: { [route.id]: error },
2266				statusCode: error.status,
2267				loaderHeaders: {},
2268				actionHeaders: {}
2269			};
2270			return generateMiddlewareResponse ? generateMiddlewareResponse(() => Promise.resolve(staticContext)) : staticContext;
2271		} else if (!matches) {
2272			let error = getInternalRouterError(404, { pathname: location.pathname });
2273			let { matches: notFoundMatches, route } = getShortCircuitMatches(dataRoutes);
2274			let staticContext = {
2275				basename,
2276				location,
2277				matches: notFoundMatches,
2278				loaderData: {},
2279				actionData: null,
2280				errors: { [route.id]: error },
2281				statusCode: error.status,
2282				loaderHeaders: {},
2283				actionHeaders: {}
2284			};
2285			return generateMiddlewareResponse ? generateMiddlewareResponse(() => Promise.resolve(staticContext)) : staticContext;
2286		}
2287		if (generateMiddlewareResponse) {
2288			invariant(requestContext instanceof RouterContextProvider, "When using middleware in `staticHandler.query()`, any provided `requestContext` must be an instance of `RouterContextProvider`");
2289			try {
2290				await loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties2);
2291				let renderedStaticContext;
2292				let response = await runServerMiddlewarePipeline({
2293					request,
2294					unstable_url: createDataFunctionUrl(request, location),
2295					unstable_pattern: getRoutePattern(matches),
2296					matches,
2297					params: matches[0].params,
2298					context: requestContext
2299				}, async () => {
2300					return await generateMiddlewareResponse(async (revalidationRequest, opts2 = {}) => {
2301						let result2 = await queryImpl(revalidationRequest, location, matches, requestContext, dataStrategy || null, skipLoaderErrorBubbling === true, null, "filterMatchesToLoad" in opts2 ? opts2.filterMatchesToLoad ?? null : filterMatchesToLoad ?? null, skipRevalidation === true);
2302						if (isResponse(result2)) return result2;
2303						renderedStaticContext = {
2304							location,
2305							basename,
2306							...result2
2307						};
2308						return renderedStaticContext;
2309					});
2310				}, async (error, routeId) => {
2311					if (isRedirectResponse(error)) return error;
2312					if (isResponse(error)) try {
2313						error = new ErrorResponseImpl(error.status, error.statusText, await parseResponseBody(error));
2314					} catch (e) {
2315						error = e;
2316					}
2317					if (isDataWithResponseInit(error)) error = dataWithResponseInitToErrorResponse(error);
2318					if (renderedStaticContext) {
2319						if (routeId in renderedStaticContext.loaderData) renderedStaticContext.loaderData[routeId] = void 0;
2320						let staticContext = getStaticContextFromError(dataRoutes, renderedStaticContext, error, skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id);
2321						return generateMiddlewareResponse(() => Promise.resolve(staticContext));
2322					} else {
2323						let staticContext = {
2324							matches,
2325							location,
2326							basename,
2327							loaderData: {},
2328							actionData: null,
2329							errors: { [skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, matches.find((m) => m.route.id === routeId || m.route.loader)?.route.id || routeId).route.id]: error },
2330							statusCode: isRouteErrorResponse(error) ? error.status : 500,
2331							actionHeaders: {},
2332							loaderHeaders: {}
2333						};
2334						return generateMiddlewareResponse(() => Promise.resolve(staticContext));
2335					}
2336				});
2337				invariant(isResponse(response), "Expected a response in query()");
2338				return response;
2339			} catch (e) {
2340				if (isResponse(e)) return e;
2341				throw e;
2342			}
2343		}
2344		let result = await queryImpl(request, location, matches, requestContext, dataStrategy || null, skipLoaderErrorBubbling === true, null, filterMatchesToLoad || null, skipRevalidation === true);
2345		if (isResponse(result)) return result;
2346		return {
2347			location,
2348			basename,
2349			...result
2350		};
2351	}
2352	async function queryRoute(request, { routeId, requestContext, dataStrategy, generateMiddlewareResponse, unstable_normalizePath } = {}) {
2353		let normalizePath = unstable_normalizePath || defaultNormalizePath;
2354		let method = request.method;
2355		let location = createLocation("", normalizePath(request), null, "default");
2356		let matches = matchRoutes(dataRoutes, location, basename);
2357		requestContext = requestContext != null ? requestContext : new RouterContextProvider();
2358		if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") throw getInternalRouterError(405, { method });
2359		else if (!matches) throw getInternalRouterError(404, { pathname: location.pathname });
2360		let match = routeId ? matches.find((m) => m.route.id === routeId) : getTargetMatch(matches, location);
2361		if (routeId && !match) throw getInternalRouterError(403, {
2362			pathname: location.pathname,
2363			routeId
2364		});
2365		else if (!match) throw getInternalRouterError(404, { pathname: location.pathname });
2366		if (generateMiddlewareResponse) {
2367			invariant(requestContext instanceof RouterContextProvider, "When using middleware in `staticHandler.queryRoute()`, any provided `requestContext` must be an instance of `RouterContextProvider`");
2368			await loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties2);
2369			return await runServerMiddlewarePipeline({
2370				request,
2371				unstable_url: createDataFunctionUrl(request, location),
2372				unstable_pattern: getRoutePattern(matches),
2373				matches,
2374				params: matches[0].params,
2375				context: requestContext
2376			}, async () => {
2377				return await generateMiddlewareResponse(async (innerRequest) => {
2378					let processed = handleQueryResult(await queryImpl(innerRequest, location, matches, requestContext, dataStrategy || null, false, match, null, false));
2379					return isResponse(processed) ? processed : typeof processed === "string" ? new Response(processed) : Response.json(processed);
2380				});
2381			}, (error) => {
2382				if (isDataWithResponseInit(error)) return Promise.resolve(dataWithResponseInitToResponse(error));
2383				if (isResponse(error)) return Promise.resolve(error);
2384				throw error;
2385			});
2386		}
2387		return handleQueryResult(await queryImpl(request, location, matches, requestContext, dataStrategy || null, false, match, null, false));
2388		function handleQueryResult(result2) {
2389			if (isResponse(result2)) return result2;
2390			let error = result2.errors ? Object.values(result2.errors)[0] : void 0;
2391			if (error !== void 0) throw error;
2392			if (result2.actionData) return Object.values(result2.actionData)[0];
2393			if (result2.loaderData) return Object.values(result2.loaderData)[0];
2394		}
2395	}
2396	async function queryImpl(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, skipRevalidation) {
2397		invariant(request.signal, "query()/queryRoute() requests must contain an AbortController signal");
2398		try {
2399			if (isMutationMethod(request.method)) return await submit(request, location, matches, routeMatch || getTargetMatch(matches, location), requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch != null, filterMatchesToLoad, skipRevalidation);
2400			let result = await loadRouteData(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad);
2401			return isResponse(result) ? result : {
2402				...result,
2403				actionData: null,
2404				actionHeaders: {}
2405			};
2406		} catch (e) {
2407			if (isDataStrategyResult(e) && isResponse(e.result)) {
2408				if (e.type === "error") throw e.result;
2409				return e.result;
2410			}
2411			if (isRedirectResponse(e)) return e;
2412			throw e;
2413		}
2414	}
2415	async function submit(request, location, matches, actionMatch, requestContext, dataStrategy, skipLoaderErrorBubbling, isRouteRequest, filterMatchesToLoad, skipRevalidation) {
2416		let result;
2417		if (!actionMatch.route.action && !actionMatch.route.lazy) {
2418			let error = getInternalRouterError(405, {
2419				method: request.method,
2420				pathname: new URL(request.url).pathname,
2421				routeId: actionMatch.route.id
2422			});
2423			if (isRouteRequest) throw error;
2424			result = {
2425				type: "error",
2426				error
2427			};
2428		} else {
2429			result = (await callDataStrategy(request, location, getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request, location, matches, actionMatch, [], requestContext), isRouteRequest, requestContext, dataStrategy))[actionMatch.route.id];
2430			if (request.signal.aborted) throwStaticHandlerAbortedError(request, isRouteRequest);
2431		}
2432		if (isRedirectResult(result)) throw new Response(null, {
2433			status: result.response.status,
2434			headers: { Location: result.response.headers.get("Location") }
2435		});
2436		if (isRouteRequest) {
2437			if (isErrorResult(result)) throw result.error;
2438			return {
2439				matches: [actionMatch],
2440				loaderData: {},
2441				actionData: { [actionMatch.route.id]: result.data },
2442				errors: null,
2443				statusCode: 200,
2444				loaderHeaders: {},
2445				actionHeaders: {}
2446			};
2447		}
2448		if (skipRevalidation) if (isErrorResult(result)) {
vendor: 51,320 bytes, lines 2449-3763
2449			let boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id);
2450			return {
2451				statusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500,
2452				actionData: null,
2453				actionHeaders: { ...result.headers ? { [actionMatch.route.id]: result.headers } : {} },
2454				matches,
2455				loaderData: {},
2456				errors: { [boundaryMatch.route.id]: result.error },
2457				loaderHeaders: {}
2458			};
2459		} else return {
2460			actionData: { [actionMatch.route.id]: result.data },
2461			actionHeaders: result.headers ? { [actionMatch.route.id]: result.headers } : {},
2462			matches,
2463			loaderData: {},
2464			errors: null,
2465			statusCode: result.statusCode || 200,
2466			loaderHeaders: {}
2467		};
2468		let loaderRequest = new Request(request.url, {
2469			headers: request.headers,
2470			redirect: request.redirect,
2471			signal: request.signal
2472		});
2473		if (isErrorResult(result)) return {
2474			...await loadRouteData(loaderRequest, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null, filterMatchesToLoad, [(skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id)).route.id, result]),
2475			statusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500,
2476			actionData: null,
2477			actionHeaders: { ...result.headers ? { [actionMatch.route.id]: result.headers } : {} }
2478		};
2479		return {
2480			...await loadRouteData(loaderRequest, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null, filterMatchesToLoad),
2481			actionData: { [actionMatch.route.id]: result.data },
2482			...result.statusCode ? { statusCode: result.statusCode } : {},
2483			actionHeaders: result.headers ? { [actionMatch.route.id]: result.headers } : {}
2484		};
2485	}
2486	async function loadRouteData(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {
2487		let isRouteRequest = routeMatch != null;
2488		if (isRouteRequest && !routeMatch?.route.loader && !routeMatch?.route.lazy) throw getInternalRouterError(400, {
2489			method: request.method,
2490			pathname: new URL(request.url).pathname,
2491			routeId: routeMatch?.route.id
2492		});
2493		let dsMatches;
2494		if (routeMatch) dsMatches = getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request, location, matches, routeMatch, [], requestContext);
2495		else {
2496			let maxIdx = pendingActionResult && isErrorResult(pendingActionResult[1]) ? matches.findIndex((m) => m.route.id === pendingActionResult[0]) - 1 : void 0;
2497			let pattern = getRoutePattern(matches);
2498			dsMatches = matches.map((match, index) => {
2499				if (maxIdx != null && index > maxIdx) return getDataStrategyMatch(mapRouteProperties2, manifest, request, location, pattern, match, [], requestContext, false);
2500				return getDataStrategyMatch(mapRouteProperties2, manifest, request, location, pattern, match, [], requestContext, (match.route.loader || match.route.lazy) != null && (!filterMatchesToLoad || filterMatchesToLoad(match)));
2501			});
2502		}
2503		if (!dataStrategy && !dsMatches.some((m) => m.shouldLoad)) return {
2504			matches,
2505			loaderData: {},
2506			errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? { [pendingActionResult[0]]: pendingActionResult[1].error } : null,
2507			statusCode: 200,
2508			loaderHeaders: {}
2509		};
2510		let results = await callDataStrategy(request, location, dsMatches, isRouteRequest, requestContext, dataStrategy);
2511		if (request.signal.aborted) throwStaticHandlerAbortedError(request, isRouteRequest);
2512		return {
2513			...processRouteLoaderData(matches, results, pendingActionResult, true, skipLoaderErrorBubbling),
2514			matches
2515		};
2516	}
2517	async function callDataStrategy(request, location, matches, isRouteRequest, requestContext, dataStrategy) {
2518		let results = await callDataStrategyImpl(dataStrategy || defaultDataStrategy, request, location, matches, null, requestContext, true);
2519		let dataResults = {};
2520		await Promise.all(matches.map(async (match) => {
2521			if (!(match.route.id in results)) return;
2522			let result = results[match.route.id];
2523			if (isRedirectDataStrategyResult(result)) {
2524				let response = result.result;
2525				throw normalizeRelativeRoutingRedirectResponse(response, request, match.route.id, matches, basename);
2526			}
2527			if (isRouteRequest) {
2528				if (isResponse(result.result)) throw result;
2529				else if (isDataWithResponseInit(result.result)) throw dataWithResponseInitToResponse(result.result);
2530			}
2531			dataResults[match.route.id] = await convertDataStrategyResultToDataResult(result);
2532		}));
2533		return dataResults;
2534	}
2535	return {
2536		dataRoutes,
2537		query,
2538		queryRoute
2539	};
2540}
2541function getStaticContextFromError(routes, handlerContext, error, boundaryId) {
2542	let errorBoundaryId = boundaryId || handlerContext._deepestRenderedBoundaryId || routes[0].id;
2543	return {
2544		...handlerContext,
2545		statusCode: isRouteErrorResponse(error) ? error.status : 500,
2546		errors: { [errorBoundaryId]: error }
2547	};
2548}
2549function throwStaticHandlerAbortedError(request, isRouteRequest) {
2550	if (request.signal.reason !== void 0) throw request.signal.reason;
2551	throw new Error(`${isRouteRequest ? "queryRoute" : "query"}() call aborted without an \`AbortSignal.reason\`: ${request.method} ${request.url}`);
2552}
2553function isSubmissionNavigation(opts) {
2554	return opts != null && ("formData" in opts && opts.formData != null || "body" in opts && opts.body !== void 0);
2555}
2556function defaultNormalizePath(request) {
2557	let url = new URL(request.url);
2558	return {
2559		pathname: url.pathname,
2560		search: url.search,
2561		hash: url.hash
2562	};
2563}
2564function normalizeTo(location, matches, basename, to, fromRouteId, relative) {
2565	let contextualMatches;
2566	let activeRouteMatch;
2567	if (fromRouteId) {
2568		contextualMatches = [];
2569		for (let match of matches) {
2570			contextualMatches.push(match);
2571			if (match.route.id === fromRouteId) {
2572				activeRouteMatch = match;
2573				break;
2574			}
2575		}
2576	} else {
2577		contextualMatches = matches;
2578		activeRouteMatch = matches[matches.length - 1];
2579	}
2580	let path = resolveTo(to ? to : ".", getResolveToMatches(contextualMatches), stripBasename(location.pathname, basename) || location.pathname, relative === "path");
2581	if (to == null) {
2582		path.search = location.search;
2583		path.hash = location.hash;
2584	}
2585	if ((to == null || to === "" || to === ".") && activeRouteMatch) {
2586		let nakedIndex = hasNakedIndexQuery(path.search);
2587		if (activeRouteMatch.route.index && !nakedIndex) path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
2588		else if (!activeRouteMatch.route.index && nakedIndex) {
2589			let params = new URLSearchParams(path.search);
2590			let indexValues = params.getAll("index");
2591			params.delete("index");
2592			indexValues.filter((v) => v).forEach((v) => params.append("index", v));
2593			let qs = params.toString();
2594			path.search = qs ? `?${qs}` : "";
2595		}
2596	}
2597	if (basename !== "/") path.pathname = prependBasename({
2598		basename,
2599		pathname: path.pathname
2600	});
2601	return createPath(path);
2602}
2603function normalizeNavigateOptions(isFetcher, path, opts) {
2604	if (!opts || !isSubmissionNavigation(opts)) return { path };
2605	if (opts.formMethod && !isValidMethod(opts.formMethod)) return {
2606		path,
2607		error: getInternalRouterError(405, { method: opts.formMethod })
2608	};
2609	let getInvalidBodyError = () => ({
2610		path,
2611		error: getInternalRouterError(400, { type: "invalid-body" })
2612	});
2613	let formMethod = (opts.formMethod || "get").toUpperCase();
2614	let formAction = stripHashFromPath(path);
2615	if (opts.body !== void 0) {
2616		if (opts.formEncType === "text/plain") {
2617			if (!isMutationMethod(formMethod)) return getInvalidBodyError();
2618			let text = typeof opts.body === "string" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ? Array.from(opts.body.entries()).reduce((acc, [name, value]) => `${acc}${name}=${value}
2619`, "") : String(opts.body);
2620			return {
2621				path,
2622				submission: {
2623					formMethod,
2624					formAction,
2625					formEncType: opts.formEncType,
2626					formData: void 0,
2627					json: void 0,
2628					text
2629				}
2630			};
2631		} else if (opts.formEncType === "application/json") {
2632			if (!isMutationMethod(formMethod)) return getInvalidBodyError();
2633			try {
2634				let json = typeof opts.body === "string" ? JSON.parse(opts.body) : opts.body;
2635				return {
2636					path,
2637					submission: {
2638						formMethod,
2639						formAction,
2640						formEncType: opts.formEncType,
2641						formData: void 0,
2642						json,
2643						text: void 0
2644					}
2645				};
2646			} catch (e) {
2647				return getInvalidBodyError();
2648			}
2649		}
2650	}
2651	invariant(typeof FormData === "function", "FormData is not available in this environment");
2652	let searchParams;
2653	let formData;
2654	if (opts.formData) {
2655		searchParams = convertFormDataToSearchParams(opts.formData);
2656		formData = opts.formData;
2657	} else if (opts.body instanceof FormData) {
2658		searchParams = convertFormDataToSearchParams(opts.body);
2659		formData = opts.body;
2660	} else if (opts.body instanceof URLSearchParams) {
2661		searchParams = opts.body;
2662		formData = convertSearchParamsToFormData(searchParams);
2663	} else if (opts.body == null) {
2664		searchParams = new URLSearchParams();
2665		formData = new FormData();
2666	} else try {
2667		searchParams = new URLSearchParams(opts.body);
2668		formData = convertSearchParamsToFormData(searchParams);
2669	} catch (e) {
2670		return getInvalidBodyError();
2671	}
2672	let submission = {
2673		formMethod,
2674		formAction,
2675		formEncType: opts && opts.formEncType || "application/x-www-form-urlencoded",
2676		formData,
2677		json: void 0,
2678		text: void 0
2679	};
2680	if (isMutationMethod(submission.formMethod)) return {
2681		path,
2682		submission
2683	};
2684	let parsedPath = parsePath(path);
2685	if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) searchParams.append("index", "");
2686	parsedPath.search = `?${searchParams}`;
2687	return {
2688		path: createPath(parsedPath),
2689		submission
2690	};
2691}
2692function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest, history, state, matches, submission, location, lazyRoutePropertiesToSkip, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, hasPatchRoutesOnNavigation, pendingActionResult, callSiteDefaultShouldRevalidate) {
2693	let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : void 0;
2694	let currentUrl = history.createURL(state.location);
2695	let nextUrl = history.createURL(location);
2696	let maxIdx;
2697	if (initialHydration && state.errors) {
2698		let boundaryId = Object.keys(state.errors)[0];
2699		maxIdx = matches.findIndex((m) => m.route.id === boundaryId);
2700	} else if (pendingActionResult && isErrorResult(pendingActionResult[1])) {
2701		let boundaryId = pendingActionResult[0];
2702		maxIdx = matches.findIndex((m) => m.route.id === boundaryId) - 1;
2703	}
2704	let actionStatus = pendingActionResult ? pendingActionResult[1].statusCode : void 0;
2705	let shouldSkipRevalidation = actionStatus && actionStatus >= 400;
2706	let baseShouldRevalidateArgs = {
2707		currentUrl,
2708		currentParams: state.matches[0]?.params || {},
2709		nextUrl,
2710		nextParams: matches[0].params,
2711		...submission,
2712		actionResult,
2713		actionStatus
2714	};
2715	let pattern = getRoutePattern(matches);
2716	let dsMatches = matches.map((match, index) => {
2717		let { route } = match;
2718		let forceShouldLoad = null;
2719		if (maxIdx != null && index > maxIdx) forceShouldLoad = false;
2720		else if (route.lazy) forceShouldLoad = true;
2721		else if (!routeHasLoaderOrMiddleware(route)) forceShouldLoad = false;
2722		else if (initialHydration) {
2723			let { shouldLoad: shouldLoad2 } = getRouteHydrationStatus(route, state.loaderData, state.errors);
2724			forceShouldLoad = shouldLoad2;
2725		} else if (isNewLoader(state.loaderData, state.matches[index], match)) forceShouldLoad = true;
2726		if (forceShouldLoad !== null) return getDataStrategyMatch(mapRouteProperties2, manifest, request, location, pattern, match, lazyRoutePropertiesToSkip, scopedContext, forceShouldLoad);
2727		let defaultShouldRevalidate = false;
2728		if (typeof callSiteDefaultShouldRevalidate === "boolean") defaultShouldRevalidate = callSiteDefaultShouldRevalidate;
2729		else if (shouldSkipRevalidation) defaultShouldRevalidate = false;
2730		else if (isRevalidationRequired) defaultShouldRevalidate = true;
2731		else if (currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search) defaultShouldRevalidate = true;
2732		else if (currentUrl.search !== nextUrl.search) defaultShouldRevalidate = true;
2733		else if (isNewRouteInstance(state.matches[index], match)) defaultShouldRevalidate = true;
2734		let shouldRevalidateArgs = {
2735			...baseShouldRevalidateArgs,
2736			defaultShouldRevalidate
2737		};
2738		return getDataStrategyMatch(mapRouteProperties2, manifest, request, location, pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateLoader(match, shouldRevalidateArgs), shouldRevalidateArgs, callSiteDefaultShouldRevalidate);
2739	});
2740	let revalidatingFetchers = [];
2741	fetchLoadMatches.forEach((f, key) => {
2742		if (initialHydration || !matches.some((m) => m.route.id === f.routeId) || fetchersQueuedForDeletion.has(key)) return;
2743		let fetcher = state.fetchers.get(key);
2744		let isMidInitialLoad = fetcher && fetcher.state !== "idle" && fetcher.data === void 0;
2745		let fetcherMatches = matchRoutes(routesToUse, f.path, basename);
2746		if (!fetcherMatches) {
2747			if (hasPatchRoutesOnNavigation && isMidInitialLoad) return;
2748			revalidatingFetchers.push({
2749				key,
2750				routeId: f.routeId,
2751				path: f.path,
2752				matches: null,
2753				match: null,
2754				request: null,
2755				controller: null
2756			});
2757			return;
2758		}
2759		if (fetchRedirectIds.has(key)) return;
2760		let fetcherMatch = getTargetMatch(fetcherMatches, f.path);
2761		let fetchController = new AbortController();
2762		let fetchRequest = createClientSideRequest(history, f.path, fetchController.signal);
2763		let fetcherDsMatches = null;
2764		if (cancelledFetcherLoads.has(key)) {
2765			cancelledFetcherLoads.delete(key);
2766			fetcherDsMatches = getTargetedDataStrategyMatches(mapRouteProperties2, manifest, fetchRequest, f.path, fetcherMatches, fetcherMatch, lazyRoutePropertiesToSkip, scopedContext);
2767		} else if (isMidInitialLoad) {
2768			if (isRevalidationRequired) fetcherDsMatches = getTargetedDataStrategyMatches(mapRouteProperties2, manifest, fetchRequest, f.path, fetcherMatches, fetcherMatch, lazyRoutePropertiesToSkip, scopedContext);
2769		} else {
2770			let defaultShouldRevalidate;
2771			if (typeof callSiteDefaultShouldRevalidate === "boolean") defaultShouldRevalidate = callSiteDefaultShouldRevalidate;
2772			else if (shouldSkipRevalidation) defaultShouldRevalidate = false;
2773			else defaultShouldRevalidate = isRevalidationRequired;
2774			let shouldRevalidateArgs = {
2775				...baseShouldRevalidateArgs,
2776				defaultShouldRevalidate
2777			};
2778			if (shouldRevalidateLoader(fetcherMatch, shouldRevalidateArgs)) fetcherDsMatches = getTargetedDataStrategyMatches(mapRouteProperties2, manifest, fetchRequest, f.path, fetcherMatches, fetcherMatch, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateArgs);
2779		}
2780		if (fetcherDsMatches) revalidatingFetchers.push({
2781			key,
2782			routeId: f.routeId,
2783			path: f.path,
2784			matches: fetcherDsMatches,
2785			match: fetcherMatch,
2786			request: fetchRequest,
2787			controller: fetchController
2788		});
2789	});
2790	return {
2791		dsMatches,
2792		revalidatingFetchers
2793	};
2794}
2795function routeHasLoaderOrMiddleware(route) {
2796	return route.loader != null || route.middleware != null && route.middleware.length > 0;
2797}
2798function getRouteHydrationStatus(route, loaderData, errors) {
2799	if (route.lazy) return {
2800		shouldLoad: true,
2801		renderFallback: true
2802	};
2803	if (!routeHasLoaderOrMiddleware(route)) return {
2804		shouldLoad: false,
2805		renderFallback: false
2806	};
2807	let hasData = loaderData != null && route.id in loaderData;
2808	let hasError = errors != null && errors[route.id] !== void 0;
2809	if (!hasData && hasError) return {
2810		shouldLoad: false,
2811		renderFallback: false
2812	};
2813	if (typeof route.loader === "function" && route.loader.hydrate === true) return {
2814		shouldLoad: true,
2815		renderFallback: !hasData
2816	};
2817	let shouldLoad = !hasData && !hasError;
2818	return {
2819		shouldLoad,
2820		renderFallback: shouldLoad
2821	};
2822}
2823function isNewLoader(currentLoaderData, currentMatch, match) {
2824	let isNew = !currentMatch || match.route.id !== currentMatch.route.id;
2825	let isMissingData = !currentLoaderData.hasOwnProperty(match.route.id);
2826	return isNew || isMissingData;
2827}
2828function isNewRouteInstance(currentMatch, match) {
2829	let currentPath = currentMatch.route.path;
2830	return currentMatch.pathname !== match.pathname || currentPath != null && currentPath.endsWith("*") && currentMatch.params["*"] !== match.params["*"];
2831}
2832function shouldRevalidateLoader(loaderMatch, arg) {
2833	if (loaderMatch.route.shouldRevalidate) {
2834		let routeChoice = loaderMatch.route.shouldRevalidate(arg);
2835		if (typeof routeChoice === "boolean") return routeChoice;
2836	}
2837	return arg.defaultShouldRevalidate;
2838}
2839function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties2, allowElementMutations) {
2840	let childrenToPatch;
2841	if (routeId) {
2842		let route = manifest[routeId];
2843		invariant(route, `No route found to patch children into: routeId = ${routeId}`);
2844		if (!route.children) route.children = [];
2845		childrenToPatch = route.children;
2846	} else childrenToPatch = routesToUse;
2847	let uniqueChildren = [];
2848	let existingChildren = [];
2849	children.forEach((newRoute) => {
2850		let existingRoute = childrenToPatch.find((existingRoute2) => isSameRoute(newRoute, existingRoute2));
2851		if (existingRoute) existingChildren.push({
2852			existingRoute,
2853			newRoute
2854		});
2855		else uniqueChildren.push(newRoute);
2856	});
2857	if (uniqueChildren.length > 0) {
2858		let newRoutes = convertRoutesToDataRoutes(uniqueChildren, mapRouteProperties2, [
2859			routeId || "_",
2860			"patch",
2861			String(childrenToPatch?.length || "0")
2862		], manifest);
2863		childrenToPatch.push(...newRoutes);
2864	}
2865	if (allowElementMutations && existingChildren.length > 0) for (let i = 0; i < existingChildren.length; i++) {
2866		let { existingRoute, newRoute } = existingChildren[i];
2867		let existingRouteTyped = existingRoute;
2868		let [newRouteTyped] = convertRoutesToDataRoutes([newRoute], mapRouteProperties2, [], {}, true);
2869		Object.assign(existingRouteTyped, {
2870			element: newRouteTyped.element ? newRouteTyped.element : existingRouteTyped.element,
2871			errorElement: newRouteTyped.errorElement ? newRouteTyped.errorElement : existingRouteTyped.errorElement,
2872			hydrateFallbackElement: newRouteTyped.hydrateFallbackElement ? newRouteTyped.hydrateFallbackElement : existingRouteTyped.hydrateFallbackElement
2873		});
2874	}
2875}
2876function isSameRoute(newRoute, existingRoute) {
2877	if ("id" in newRoute && "id" in existingRoute && newRoute.id === existingRoute.id) return true;
2878	if (!(newRoute.index === existingRoute.index && newRoute.path === existingRoute.path && newRoute.caseSensitive === existingRoute.caseSensitive)) return false;
2879	if ((!newRoute.children || newRoute.children.length === 0) && (!existingRoute.children || existingRoute.children.length === 0)) return true;
2880	return newRoute.children?.every((aChild, i) => existingRoute.children?.some((bChild) => isSameRoute(aChild, bChild))) ?? false;
2881}
2882var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
2883var loadLazyRouteProperty = ({ key, route, manifest, mapRouteProperties: mapRouteProperties2 }) => {
2884	let routeToUpdate = manifest[route.id];
2885	invariant(routeToUpdate, "No route found in manifest");
2886	if (!routeToUpdate.lazy || typeof routeToUpdate.lazy !== "object") return;
2887	let lazyFn = routeToUpdate.lazy[key];
2888	if (!lazyFn) return;
2889	let cache = lazyRoutePropertyCache.get(routeToUpdate);
2890	if (!cache) {
2891		cache = {};
2892		lazyRoutePropertyCache.set(routeToUpdate, cache);
2893	}
2894	let cachedPromise = cache[key];
2895	if (cachedPromise) return cachedPromise;
2896	let propertyPromise = (async () => {
2897		let isUnsupported = isUnsupportedLazyRouteObjectKey(key);
2898		let isStaticallyDefined = routeToUpdate[key] !== void 0 && key !== "hasErrorBoundary";
2899		if (isUnsupported) {
2900			warning(!isUnsupported, "Route property " + key + " is not a supported lazy route property. This property will be ignored.");
2901			cache[key] = Promise.resolve();
2902		} else if (isStaticallyDefined) warning(false, `Route "${routeToUpdate.id}" has a static property "${key}" defined. The lazy property will be ignored.`);
2903		else {
2904			let value = await lazyFn();
2905			if (value != null) {
2906				Object.assign(routeToUpdate, { [key]: value });
2907				Object.assign(routeToUpdate, mapRouteProperties2(routeToUpdate));
2908			}
2909		}
2910		if (typeof routeToUpdate.lazy === "object") {
2911			routeToUpdate.lazy[key] = void 0;
2912			if (Object.values(routeToUpdate.lazy).every((value) => value === void 0)) routeToUpdate.lazy = void 0;
2913		}
2914	})();
2915	cache[key] = propertyPromise;
2916	return propertyPromise;
2917};
2918var lazyRouteFunctionCache = /* @__PURE__ */ new WeakMap();
2919function loadLazyRoute(route, type, manifest, mapRouteProperties2, lazyRoutePropertiesToSkip) {
2920	let routeToUpdate = manifest[route.id];
2921	invariant(routeToUpdate, "No route found in manifest");
2922	if (!route.lazy) return {
2923		lazyRoutePromise: void 0,
2924		lazyHandlerPromise: void 0
2925	};
2926	if (typeof route.lazy === "function") {
2927		let cachedPromise = lazyRouteFunctionCache.get(routeToUpdate);
2928		if (cachedPromise) return {
2929			lazyRoutePromise: cachedPromise,
2930			lazyHandlerPromise: cachedPromise
2931		};
2932		let lazyRoutePromise2 = (async () => {
2933			invariant(typeof route.lazy === "function", "No lazy route function found");
2934			let lazyRoute = await route.lazy();
2935			let routeUpdates = {};
2936			for (let lazyRouteProperty in lazyRoute) {
2937				let lazyValue = lazyRoute[lazyRouteProperty];
2938				if (lazyValue === void 0) continue;
2939				let isUnsupported = isUnsupportedLazyRouteFunctionKey(lazyRouteProperty);
2940				let isStaticallyDefined = routeToUpdate[lazyRouteProperty] !== void 0 && lazyRouteProperty !== "hasErrorBoundary";
2941				if (isUnsupported) warning(!isUnsupported, "Route property " + lazyRouteProperty + " is not a supported property to be returned from a lazy route function. This property will be ignored.");
2942				else if (isStaticallyDefined) warning(!isStaticallyDefined, `Route "${routeToUpdate.id}" has a static property "${lazyRouteProperty}" defined but its lazy function is also returning a value for this property. The lazy route property "${lazyRouteProperty}" will be ignored.`);
2943				else routeUpdates[lazyRouteProperty] = lazyValue;
2944			}
2945			Object.assign(routeToUpdate, routeUpdates);
2946			Object.assign(routeToUpdate, {
2947				...mapRouteProperties2(routeToUpdate),
2948				lazy: void 0
2949			});
2950		})();
2951		lazyRouteFunctionCache.set(routeToUpdate, lazyRoutePromise2);
2952		lazyRoutePromise2.catch(() => {});
2953		return {
2954			lazyRoutePromise: lazyRoutePromise2,
2955			lazyHandlerPromise: lazyRoutePromise2
2956		};
2957	}
2958	let lazyKeys = Object.keys(route.lazy);
2959	let lazyPropertyPromises = [];
2960	let lazyHandlerPromise = void 0;
2961	for (let key of lazyKeys) {
2962		if (lazyRoutePropertiesToSkip && lazyRoutePropertiesToSkip.includes(key)) continue;
2963		let promise = loadLazyRouteProperty({
2964			key,
2965			route,
2966			manifest,
2967			mapRouteProperties: mapRouteProperties2
2968		});
2969		if (promise) {
2970			lazyPropertyPromises.push(promise);
2971			if (key === type) lazyHandlerPromise = promise;
2972		}
2973	}
2974	let lazyRoutePromise = lazyPropertyPromises.length > 0 ? Promise.all(lazyPropertyPromises).then(() => {}) : void 0;
2975	lazyRoutePromise?.catch(() => {});
2976	lazyHandlerPromise?.catch(() => {});
2977	return {
2978		lazyRoutePromise,
2979		lazyHandlerPromise
2980	};
2981}
2982function isNonNullable(value) {
2983	return value !== void 0;
2984}
2985function loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties2) {
2986	let promises = matches.map(({ route }) => {
2987		if (typeof route.lazy !== "object" || !route.lazy.middleware) return;
2988		return loadLazyRouteProperty({
2989			key: "middleware",
2990			route,
2991			manifest,
2992			mapRouteProperties: mapRouteProperties2
2993		});
2994	}).filter(isNonNullable);
2995	return promises.length > 0 ? Promise.all(promises) : void 0;
2996}
2997async function defaultDataStrategy(args) {
2998	let matchesToLoad = args.matches.filter((m) => m.shouldLoad);
2999	let keyedResults = {};
3000	(await Promise.all(matchesToLoad.map((m) => m.resolve()))).forEach((result, i) => {
3001		keyedResults[matchesToLoad[i].route.id] = result;
3002	});
3003	return keyedResults;
3004}
3005async function defaultDataStrategyWithMiddleware(args) {
3006	if (!args.matches.some((m) => m.route.middleware)) return defaultDataStrategy(args);
3007	return runClientMiddlewarePipeline(args, () => defaultDataStrategy(args));
3008}
3009function runServerMiddlewarePipeline(args, handler, errorHandler) {
3010	return runMiddlewarePipeline(args, handler, processResult, isResponse, errorHandler);
3011	function processResult(result) {
3012		return isDataWithResponseInit(result) ? dataWithResponseInitToResponse(result) : result;
3013	}
3014}
3015function runClientMiddlewarePipeline(args, handler) {
3016	return runMiddlewarePipeline(args, handler, (r) => {
3017		if (isRedirectResponse(r)) throw r;
3018		return r;
3019	}, isDataStrategyResults, errorHandler);
3020	function errorHandler(error, routeId, nextResult) {
3021		if (nextResult) return Promise.resolve(Object.assign(nextResult.value, { [routeId]: {
3022			type: "error",
3023			result: error
3024		} }));
3025		else {
3026			let { matches } = args;
3027			let boundaryRouteId = findNearestBoundary(matches, matches[Math.min(Math.max(matches.findIndex((m) => m.route.id === routeId), 0), Math.max(matches.findIndex((m) => m.shouldCallHandler()), 0))].route.id).route.id;
3028			return Promise.resolve({ [boundaryRouteId]: {
3029				type: "error",
3030				result: error
3031			} });
3032		}
3033	}
3034}
3035async function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {
3036	let { matches, ...dataFnArgs } = args;
3037	return await callRouteMiddleware(dataFnArgs, matches.flatMap((m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []), handler, processResult, isResult, errorHandler);
3038}
3039async function callRouteMiddleware(args, middlewares, handler, processResult, isResult, errorHandler, idx = 0) {
3040	let { request } = args;
3041	if (request.signal.aborted) throw request.signal.reason ?? /* @__PURE__ */ new Error(`Request aborted: ${request.method} ${request.url}`);
3042	let tuple = middlewares[idx];
3043	if (!tuple) return await handler();
3044	let [routeId, middleware] = tuple;
3045	let nextResult;
3046	let next = async () => {
3047		if (nextResult) throw new Error("You may only call `next()` once per middleware");
3048		try {
3049			nextResult = { value: await callRouteMiddleware(args, middlewares, handler, processResult, isResult, errorHandler, idx + 1) };
3050			return nextResult.value;
3051		} catch (error) {
3052			nextResult = { value: await errorHandler(error, routeId, nextResult) };
3053			return nextResult.value;
3054		}
3055	};
3056	try {
3057		let value = await middleware(args, next);
3058		let result = value != null ? processResult(value) : void 0;
3059		if (isResult(result)) return result;
3060		else if (nextResult) return result ?? nextResult.value;
3061		else {
3062			nextResult = { value: await next() };
3063			return nextResult.value;
3064		}
3065	} catch (error) {
3066		return await errorHandler(error, routeId, nextResult);
3067	}
3068}
3069function getDataStrategyMatchLazyPromises(mapRouteProperties2, manifest, request, match, lazyRoutePropertiesToSkip) {
3070	let lazyMiddlewarePromise = loadLazyRouteProperty({
3071		key: "middleware",
3072		route: match.route,
3073		manifest,
3074		mapRouteProperties: mapRouteProperties2
3075	});
3076	let lazyRoutePromises = loadLazyRoute(match.route, isMutationMethod(request.method) ? "action" : "loader", manifest, mapRouteProperties2, lazyRoutePropertiesToSkip);
3077	return {
3078		middleware: lazyMiddlewarePromise,
3079		route: lazyRoutePromises.lazyRoutePromise,
3080		handler: lazyRoutePromises.lazyHandlerPromise
3081	};
3082}
3083function getDataStrategyMatch(mapRouteProperties2, manifest, request, path, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
3084	let isUsingNewApi = false;
3085	let _lazyPromises = getDataStrategyMatchLazyPromises(mapRouteProperties2, manifest, request, match, lazyRoutePropertiesToSkip);
3086	return {
3087		...match,
3088		_lazyPromises,
3089		shouldLoad,
3090		shouldRevalidateArgs,
3091		shouldCallHandler(defaultShouldRevalidate) {
3092			isUsingNewApi = true;
3093			if (!shouldRevalidateArgs) return shouldLoad;
3094			if (typeof callSiteDefaultShouldRevalidate === "boolean") return shouldRevalidateLoader(match, {
3095				...shouldRevalidateArgs,
3096				defaultShouldRevalidate: callSiteDefaultShouldRevalidate
3097			});
3098			if (typeof defaultShouldRevalidate === "boolean") return shouldRevalidateLoader(match, {
3099				...shouldRevalidateArgs,
3100				defaultShouldRevalidate
3101			});
3102			return shouldRevalidateLoader(match, shouldRevalidateArgs);
3103		},
3104		resolve(handlerOverride) {
3105			let { lazy, loader, middleware } = match.route;
3106			let callHandler = isUsingNewApi || shouldLoad || handlerOverride && !isMutationMethod(request.method) && (lazy || loader);
3107			let isMiddlewareOnlyRoute = middleware && middleware.length > 0 && !loader && !lazy;
3108			if (callHandler && (isMutationMethod(request.method) || !isMiddlewareOnlyRoute)) return callLoaderOrAction({
3109				request,
3110				path,
3111				unstable_pattern,
3112				match,
3113				lazyHandlerPromise: _lazyPromises?.handler,
3114				lazyRoutePromise: _lazyPromises?.route,
3115				handlerOverride,
3116				scopedContext
3117			});
3118			return Promise.resolve({
3119				type: "data",
3120				result: void 0
3121			});
3122		}
3123	};
3124}
3125function getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request, path, matches, targetMatch, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateArgs = null) {
3126	return matches.map((match) => {
3127		if (match.route.id !== targetMatch.route.id) return {
3128			...match,
3129			shouldLoad: false,
3130			shouldRevalidateArgs,
3131			shouldCallHandler: () => false,
3132			_lazyPromises: getDataStrategyMatchLazyPromises(mapRouteProperties2, manifest, request, match, lazyRoutePropertiesToSkip),
3133			resolve: () => Promise.resolve({
3134				type: "data",
3135				result: void 0
3136			})
3137		};
3138		return getDataStrategyMatch(mapRouteProperties2, manifest, request, path, getRoutePattern(matches), match, lazyRoutePropertiesToSkip, scopedContext, true, shouldRevalidateArgs);
3139	});
3140}
3141async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fetcherKey, scopedContext, isStaticHandler) {
3142	if (matches.some((m) => m._lazyPromises?.middleware)) await Promise.all(matches.map((m) => m._lazyPromises?.middleware));
3143	let dataStrategyArgs = {
3144		request,
3145		unstable_url: createDataFunctionUrl(request, path),
3146		unstable_pattern: getRoutePattern(matches),
3147		params: matches[0].params,
3148		context: scopedContext,
3149		matches
3150	};
3151	let runClientMiddleware = isStaticHandler ? () => {
3152		throw new Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response.  You can enable middleware via the `respond` API in `query`/`queryRoute`");
3153	} : (cb) => {
3154		let typedDataStrategyArgs = dataStrategyArgs;
3155		return runClientMiddlewarePipeline(typedDataStrategyArgs, () => {
3156			return cb({
3157				...typedDataStrategyArgs,
3158				fetcherKey,
3159				runClientMiddleware: () => {
3160					throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler");
3161				}
3162			});
3163		});
3164	};
3165	let results = await dataStrategyImpl({
3166		...dataStrategyArgs,
3167		fetcherKey,
3168		runClientMiddleware
3169	});
3170	try {
3171		await Promise.all(matches.flatMap((m) => [m._lazyPromises?.handler, m._lazyPromises?.route]));
3172	} catch (e) {}
3173	return results;
3174}
3175async function callLoaderOrAction({ request, path, unstable_pattern, match, lazyHandlerPromise, lazyRoutePromise, handlerOverride, scopedContext }) {
3176	let result;
3177	let onReject;
3178	let isAction = isMutationMethod(request.method);
3179	let type = isAction ? "action" : "loader";
3180	let runHandler = (handler) => {
3181		let reject;
3182		let abortPromise = new Promise((_, r) => reject = r);
3183		onReject = () => reject();
3184		request.signal.addEventListener("abort", onReject);
3185		let actualHandler = (ctx) => {
3186			if (typeof handler !== "function") return Promise.reject(/* @__PURE__ */ new Error(`You cannot call the handler for a route which defines a boolean "${type}" [routeId: ${match.route.id}]`));
3187			return handler({
3188				request,
3189				unstable_url: createDataFunctionUrl(request, path),
3190				unstable_pattern,
3191				params: match.params,
3192				context: scopedContext
3193			}, ...ctx !== void 0 ? [ctx] : []);
3194		};
3195		let handlerPromise = (async () => {
3196			try {
3197				return {
3198					type: "data",
3199					result: await (handlerOverride ? handlerOverride((ctx) => actualHandler(ctx)) : actualHandler())
3200				};
3201			} catch (e) {
3202				return {
3203					type: "error",
3204					result: e
3205				};
3206			}
3207		})();
3208		return Promise.race([handlerPromise, abortPromise]);
3209	};
3210	try {
3211		let handler = isAction ? match.route.action : match.route.loader;
3212		if (lazyHandlerPromise || lazyRoutePromise) if (handler) {
3213			let handlerError;
3214			let [value] = await Promise.all([
3215				runHandler(handler).catch((e) => {
3216					handlerError = e;
3217				}),
3218				lazyHandlerPromise,
3219				lazyRoutePromise
3220			]);
3221			if (handlerError !== void 0) throw handlerError;
3222			result = value;
3223		} else {
3224			await lazyHandlerPromise;
3225			let handler2 = isAction ? match.route.action : match.route.loader;
3226			if (handler2) [result] = await Promise.all([runHandler(handler2), lazyRoutePromise]);
3227			else if (type === "action") {
3228				let url = new URL(request.url);
3229				let pathname = url.pathname + url.search;
3230				throw getInternalRouterError(405, {
3231					method: request.method,
3232					pathname,
3233					routeId: match.route.id
3234				});
3235			} else return {
3236				type: "data",
3237				result: void 0
3238			};
3239		}
3240		else if (!handler) {
3241			let url = new URL(request.url);
3242			throw getInternalRouterError(404, { pathname: url.pathname + url.search });
3243		} else result = await runHandler(handler);
3244	} catch (e) {
3245		return {
3246			type: "error",
3247			result: e
3248		};
3249	} finally {
3250		if (onReject) request.signal.removeEventListener("abort", onReject);
3251	}
3252	return result;
3253}
3254async function parseResponseBody(response) {
3255	let contentType = response.headers.get("Content-Type");
3256	if (contentType && /\bapplication\/json\b/.test(contentType)) return response.body == null ? null : response.json();
3257	return response.text();
3258}
3259async function convertDataStrategyResultToDataResult(dataStrategyResult) {
3260	let { result, type } = dataStrategyResult;
3261	if (isResponse(result)) {
3262		let data2;
3263		try {
3264			data2 = await parseResponseBody(result);
3265		} catch (e) {
3266			return {
3267				type: "error",
3268				error: e
3269			};
3270		}
3271		if (type === "error") return {
3272			type: "error",
3273			error: new ErrorResponseImpl(result.status, result.statusText, data2),
3274			statusCode: result.status,
3275			headers: result.headers
3276		};
3277		return {
3278			type: "data",
3279			data: data2,
3280			statusCode: result.status,
3281			headers: result.headers
3282		};
3283	}
3284	if (type === "error") {
3285		if (isDataWithResponseInit(result)) {
3286			if (result.data instanceof Error) return {
3287				type: "error",
3288				error: result.data,
3289				statusCode: result.init?.status,
3290				headers: result.init?.headers ? new Headers(result.init.headers) : void 0
3291			};
3292			return {
3293				type: "error",
3294				error: dataWithResponseInitToErrorResponse(result),
3295				statusCode: isRouteErrorResponse(result) ? result.status : void 0,
3296				headers: result.init?.headers ? new Headers(result.init.headers) : void 0
3297			};
3298		}
3299		return {
3300			type: "error",
3301			error: result,
3302			statusCode: isRouteErrorResponse(result) ? result.status : void 0
3303		};
3304	}
3305	if (isDataWithResponseInit(result)) return {
3306		type: "data",
3307		data: result.data,
3308		statusCode: result.init?.status,
3309		headers: result.init?.headers ? new Headers(result.init.headers) : void 0
3310	};
3311	return {
3312		type: "data",
3313		data: result
3314	};
3315}
3316function normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename) {
3317	let location = response.headers.get("Location");
3318	invariant(location, "Redirects returned/thrown from loaders/actions must have a Location header");
3319	if (!isAbsoluteUrl(location)) {
3320		let trimmedMatches = matches.slice(0, matches.findIndex((m) => m.route.id === routeId) + 1);
3321		location = normalizeTo(new URL(request.url), trimmedMatches, basename, location);
3322		response.headers.set("Location", location);
3323	}
3324	return response;
3325}
3326var invalidProtocols = [
3327	"about:",
3328	"blob:",
3329	"chrome:",
3330	"chrome-untrusted:",
3331	"content:",
3332	"data:",
3333	"devtools:",
3334	"file:",
3335	"filesystem:",
3336	"javascript:"
3337];
3338function normalizeRedirectLocation(location, currentUrl, basename, historyInstance) {
3339	if (isAbsoluteUrl(location)) {
3340		let normalizedLocation = location;
3341		let url = normalizedLocation.startsWith("//") ? new URL(currentUrl.protocol + normalizedLocation) : new URL(normalizedLocation);
3342		if (invalidProtocols.includes(url.protocol)) throw new Error("Invalid redirect location");
3343		let isSameBasename = stripBasename(url.pathname, basename) != null;
3344		if (url.origin === currentUrl.origin && isSameBasename) return url.pathname + url.search + url.hash;
3345	}
3346	try {
3347		let url = historyInstance.createURL(location);
3348		if (invalidProtocols.includes(url.protocol)) throw new Error("Invalid redirect location");
3349	} catch (e) {}
3350	return location;
3351}
3352function createClientSideRequest(history, location, signal, submission) {
3353	let url = history.createURL(stripHashFromPath(location)).toString();
3354	let init = { signal };
3355	if (submission && isMutationMethod(submission.formMethod)) {
3356		let { formMethod, formEncType } = submission;
3357		init.method = formMethod.toUpperCase();
3358		if (formEncType === "application/json") {
3359			init.headers = new Headers({ "Content-Type": formEncType });
3360			init.body = JSON.stringify(submission.json);
3361		} else if (formEncType === "text/plain") init.body = submission.text;
3362		else if (formEncType === "application/x-www-form-urlencoded" && submission.formData) init.body = convertFormDataToSearchParams(submission.formData);
3363		else init.body = submission.formData;
3364	}
3365	return new Request(url, init);
3366}
3367function createDataFunctionUrl(request, path) {
3368	let url = new URL(request.url);
3369	let parsed = typeof path === "string" ? parsePath(path) : path;
3370	url.pathname = parsed.pathname || "/";
3371	if (parsed.search) {
3372		let searchParams = new URLSearchParams(parsed.search);
3373		let indexValues = searchParams.getAll("index");
3374		searchParams.delete("index");
3375		for (let value of indexValues.filter(Boolean)) searchParams.append("index", value);
3376		url.search = searchParams.size ? `?${searchParams.toString()}` : "";
3377	} else url.search = "";
3378	url.hash = parsed.hash || "";
3379	return url;
3380}
3381function convertFormDataToSearchParams(formData) {
3382	let searchParams = new URLSearchParams();
3383	for (let [key, value] of formData.entries()) searchParams.append(key, typeof value === "string" ? value : value.name);
3384	return searchParams;
3385}
3386function convertSearchParamsToFormData(searchParams) {
3387	let formData = new FormData();
3388	for (let [key, value] of searchParams.entries()) formData.append(key, value);
3389	return formData;
3390}
3391function processRouteLoaderData(matches, results, pendingActionResult, isStaticHandler = false, skipLoaderErrorBubbling = false) {
3392	let loaderData = {};
3393	let errors = null;
3394	let statusCode;
3395	let foundError = false;
3396	let loaderHeaders = {};
3397	let pendingError = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : void 0;
3398	matches.forEach((match) => {
3399		if (!(match.route.id in results)) return;
3400		let id = match.route.id;
3401		let result = results[id];
3402		invariant(!isRedirectResult(result), "Cannot handle redirect results in processLoaderData");
3403		if (isErrorResult(result)) {
3404			let error = result.error;
3405			if (pendingError !== void 0) {
3406				error = pendingError;
3407				pendingError = void 0;
3408			}
3409			errors = errors || {};
3410			if (skipLoaderErrorBubbling) errors[id] = error;
3411			else {
3412				let boundaryMatch = findNearestBoundary(matches, id);
3413				if (errors[boundaryMatch.route.id] == null) errors[boundaryMatch.route.id] = error;
3414			}
3415			if (!isStaticHandler) loaderData[id] = ResetLoaderDataSymbol;
3416			if (!foundError) {
3417				foundError = true;
3418				statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500;
3419			}
3420			if (result.headers) loaderHeaders[id] = result.headers;
3421		} else {
3422			loaderData[id] = result.data;
3423			if (result.statusCode && result.statusCode !== 200 && !foundError) statusCode = result.statusCode;
3424			if (result.headers) loaderHeaders[id] = result.headers;
3425		}
3426	});
3427	if (pendingError !== void 0 && pendingActionResult) {
3428		errors = { [pendingActionResult[0]]: pendingError };
3429		if (pendingActionResult[2]) loaderData[pendingActionResult[2]] = void 0;
3430	}
3431	return {
3432		loaderData,
3433		errors,
3434		statusCode: statusCode || 200,
3435		loaderHeaders
3436	};
3437}
3438function processLoaderData(state, matches, results, pendingActionResult, revalidatingFetchers, fetcherResults) {
3439	let { loaderData, errors } = processRouteLoaderData(matches, results, pendingActionResult);
3440	revalidatingFetchers.filter((f) => !f.matches || f.matches.some((m) => m.shouldLoad)).forEach((rf) => {
3441		let { key, match, controller } = rf;
3442		if (controller && controller.signal.aborted) return;
3443		let result = fetcherResults[key];
3444		invariant(result, "Did not find corresponding fetcher result");
3445		if (isErrorResult(result)) {
3446			let boundaryMatch = findNearestBoundary(state.matches, match?.route.id);
3447			if (!(errors && errors[boundaryMatch.route.id])) errors = {
3448				...errors,
3449				[boundaryMatch.route.id]: result.error
3450			};
3451			state.fetchers.delete(key);
3452		} else if (isRedirectResult(result)) invariant(false, "Unhandled fetcher revalidation redirect");
3453		else {
3454			let doneFetcher = getDoneFetcher(result.data);
3455			state.fetchers.set(key, doneFetcher);
3456		}
3457	});
3458	return {
3459		loaderData,
3460		errors
3461	};
3462}
3463function mergeLoaderData(loaderData, newLoaderData, matches, errors) {
3464	let mergedLoaderData = Object.entries(newLoaderData).filter(([, v]) => v !== ResetLoaderDataSymbol).reduce((merged, [k, v]) => {
3465		merged[k] = v;
3466		return merged;
3467	}, {});
3468	for (let match of matches) {
3469		let id = match.route.id;
3470		if (!newLoaderData.hasOwnProperty(id) && loaderData.hasOwnProperty(id) && match.route.loader) mergedLoaderData[id] = loaderData[id];
3471		if (errors && errors.hasOwnProperty(id)) break;
3472	}
3473	return mergedLoaderData;
3474}
3475function getActionDataForCommit(pendingActionResult) {
3476	if (!pendingActionResult) return {};
3477	return isErrorResult(pendingActionResult[1]) ? { actionData: {} } : { actionData: { [pendingActionResult[0]]: pendingActionResult[1].data } };
3478}
3479function findNearestBoundary(matches, routeId) {
3480	return (routeId ? matches.slice(0, matches.findIndex((m) => m.route.id === routeId) + 1) : [...matches]).reverse().find((m) => m.route.hasErrorBoundary === true) || matches[0];
3481}
3482function getShortCircuitMatches(routes) {
3483	let route = routes.length === 1 ? routes[0] : routes.find((r) => r.index || !r.path || r.path === "/") || { id: `__shim-error-route__` };
3484	return {
3485		matches: [{
3486			params: {},
3487			pathname: "",
3488			pathnameBase: "",
3489			route
3490		}],
3491		route
3492	};
3493}
3494function getInternalRouterError(status, { pathname, routeId, method, type, message } = {}) {
3495	let statusText = "Unknown Server Error";
3496	let errorMessage = "Unknown @remix-run/router error";
3497	if (status === 400) {
3498		statusText = "Bad Request";
3499		if (method && pathname && routeId) errorMessage = `You made a ${method} request to "${pathname}" but did not provide a \`loader\` for route "${routeId}", so there is no way to handle the request.`;
3500		else if (type === "invalid-body") errorMessage = "Unable to encode submission body";
3501	} else if (status === 403) {
3502		statusText = "Forbidden";
3503		errorMessage = `Route "${routeId}" does not match URL "${pathname}"`;
3504	} else if (status === 404) {
3505		statusText = "Not Found";
3506		errorMessage = `No route matches URL "${pathname}"`;
3507	} else if (status === 405) {
3508		statusText = "Method Not Allowed";
3509		if (method && pathname && routeId) errorMessage = `You made a ${method.toUpperCase()} request to "${pathname}" but did not provide an \`action\` for route "${routeId}", so there is no way to handle the request.`;
3510		else if (method) errorMessage = `Invalid request method "${method.toUpperCase()}"`;
3511	}
3512	return new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true);
3513}
3514function findRedirect(results) {
3515	let entries = Object.entries(results);
3516	for (let i = entries.length - 1; i >= 0; i--) {
3517		let [key, result] = entries[i];
3518		if (isRedirectResult(result)) return {
3519			key,
3520			result
3521		};
3522	}
3523}
3524function stripHashFromPath(path) {
3525	return createPath({
3526		...typeof path === "string" ? parsePath(path) : path,
3527		hash: ""
3528	});
3529}
3530function isHashChangeOnly(a, b) {
3531	if (a.pathname !== b.pathname || a.search !== b.search) return false;
3532	if (a.hash === "") return b.hash !== "";
3533	else if (a.hash === b.hash) return true;
3534	else if (b.hash !== "") return true;
3535	return false;
3536}
3537function dataWithResponseInitToResponse(data2) {
3538	return Response.json(data2.data, data2.init ?? void 0);
3539}
3540function dataWithResponseInitToErrorResponse(data2) {
3541	return new ErrorResponseImpl(data2.init?.status ?? 500, data2.init?.statusText ?? "Internal Server Error", data2.data);
3542}
3543function isDataStrategyResults(result) {
3544	return result != null && typeof result === "object" && Object.entries(result).every(([key, value]) => typeof key === "string" && isDataStrategyResult(value));
3545}
3546function isDataStrategyResult(result) {
3547	return result != null && typeof result === "object" && "type" in result && "result" in result && (result.type === "data" || result.type === "error");
3548}
3549function isRedirectDataStrategyResult(result) {
3550	return isResponse(result.result) && redirectStatusCodes.has(result.result.status);
3551}
3552function isErrorResult(result) {
3553	return result.type === "error";
3554}
3555function isRedirectResult(result) {
3556	return (result && result.type) === "redirect";
3557}
3558function isDataWithResponseInit(value) {
3559	return typeof value === "object" && value != null && "type" in value && "data" in value && "init" in value && value.type === "DataWithResponseInit";
3560}
3561function isResponse(value) {
3562	return value != null && typeof value.status === "number" && typeof value.statusText === "string" && typeof value.headers === "object" && typeof value.body !== "undefined";
3563}
3564function isRedirectStatusCode(statusCode) {
3565	return redirectStatusCodes.has(statusCode);
3566}
3567function isRedirectResponse(result) {
3568	return isResponse(result) && isRedirectStatusCode(result.status) && result.headers.has("Location");
3569}
3570function isValidMethod(method) {
3571	return validRequestMethods.has(method.toUpperCase());
3572}
3573function isMutationMethod(method) {
3574	return validMutationMethods.has(method.toUpperCase());
3575}
3576function hasNakedIndexQuery(search) {
3577	return new URLSearchParams(search).getAll("index").some((v) => v === "");
3578}
3579function getTargetMatch(matches, location) {
3580	let search = typeof location === "string" ? parsePath(location).search : location.search;
3581	if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || "")) return matches[matches.length - 1];
3582	let pathMatches = getPathContributingMatches(matches);
3583	return pathMatches[pathMatches.length - 1];
3584}
3585function getSubmissionFromNavigation(navigation) {
3586	let { formMethod, formAction, formEncType, text, formData, json } = navigation;
3587	if (!formMethod || !formAction || !formEncType) return;
3588	if (text != null) return {
3589		formMethod,
3590		formAction,
3591		formEncType,
3592		formData: void 0,
3593		json: void 0,
3594		text
3595	};
3596	else if (formData != null) return {
3597		formMethod,
3598		formAction,
3599		formEncType,
3600		formData,
3601		json: void 0,
3602		text: void 0
3603	};
3604	else if (json !== void 0) return {
3605		formMethod,
3606		formAction,
3607		formEncType,
3608		formData: void 0,
3609		json,
3610		text: void 0
3611	};
3612}
3613function getLoadingNavigation(location, submission) {
3614	if (submission) return {
3615		state: "loading",
3616		location,
3617		formMethod: submission.formMethod,
3618		formAction: submission.formAction,
3619		formEncType: submission.formEncType,
3620		formData: submission.formData,
3621		json: submission.json,
3622		text: submission.text
3623	};
3624	else return {
3625		state: "loading",
3626		location,
3627		formMethod: void 0,
3628		formAction: void 0,
3629		formEncType: void 0,
3630		formData: void 0,
3631		json: void 0,
3632		text: void 0
3633	};
3634}
3635function getSubmittingNavigation(location, submission) {
3636	return {
3637		state: "submitting",
3638		location,
3639		formMethod: submission.formMethod,
3640		formAction: submission.formAction,
3641		formEncType: submission.formEncType,
3642		formData: submission.formData,
3643		json: submission.json,
3644		text: submission.text
3645	};
3646}
3647function getLoadingFetcher(submission, data2) {
3648	if (submission) return {
3649		state: "loading",
3650		formMethod: submission.formMethod,
3651		formAction: submission.formAction,
3652		formEncType: submission.formEncType,
3653		formData: submission.formData,
3654		json: submission.json,
3655		text: submission.text,
3656		data: data2
3657	};
3658	else return {
3659		state: "loading",
3660		formMethod: void 0,
3661		formAction: void 0,
3662		formEncType: void 0,
3663		formData: void 0,
3664		json: void 0,
3665		text: void 0,
3666		data: data2
3667	};
3668}
3669function getSubmittingFetcher(submission, existingFetcher) {
3670	return {
3671		state: "submitting",
3672		formMethod: submission.formMethod,
3673		formAction: submission.formAction,
3674		formEncType: submission.formEncType,
3675		formData: submission.formData,
3676		json: submission.json,
3677		text: submission.text,
3678		data: existingFetcher ? existingFetcher.data : void 0
3679	};
3680}
3681function getDoneFetcher(data2) {
3682	return {
3683		state: "idle",
3684		formMethod: void 0,
3685		formAction: void 0,
3686		formEncType: void 0,
3687		formData: void 0,
3688		json: void 0,
3689		text: void 0,
3690		data: data2
3691	};
3692}
3693function restoreAppliedTransitions(_window, transitions) {
3694	try {
3695		let sessionPositions = _window.sessionStorage.getItem(TRANSITIONS_STORAGE_KEY);
3696		if (sessionPositions) {
3697			let json = JSON.parse(sessionPositions);
3698			for (let [k, v] of Object.entries(json || {})) if (v && Array.isArray(v)) transitions.set(k, new Set(v || []));
3699		}
3700	} catch (e) {}
3701}
3702function persistAppliedTransitions(_window, transitions) {
3703	if (transitions.size > 0) {
3704		let json = {};
3705		for (let [k, v] of transitions) json[k] = [...v];
3706		try {
3707			_window.sessionStorage.setItem(TRANSITIONS_STORAGE_KEY, JSON.stringify(json));
3708		} catch (error) {
3709			warning(false, `Failed to save applied view transitions in sessionStorage (${error}).`);
3710		}
3711	}
3712}
3713function createDeferred() {
3714	let resolve;
3715	let reject;
3716	let promise = new Promise((res, rej) => {
3717		resolve = async (val) => {
3718			res(val);
3719			try {
3720				await promise;
3721			} catch (e) {}
3722		};
3723		reject = async (error) => {
3724			rej(error);
3725			try {
3726				await promise;
3727			} catch (e) {}
3728		};
3729	});
3730	return {
3731		promise,
3732		resolve,
3733		reject
3734	};
3735}
3736var DataRouterContext = import_react.createContext(null);
3737DataRouterContext.displayName = "DataRouter";
3738var DataRouterStateContext = import_react.createContext(null);
3739DataRouterStateContext.displayName = "DataRouterState";
3740var RSCRouterContext = import_react.createContext(false);
3741function useIsRSCRouterContext() {
3742	return import_react.useContext(RSCRouterContext);
3743}
3744var ViewTransitionContext = import_react.createContext({ isTransitioning: false });
3745ViewTransitionContext.displayName = "ViewTransition";
3746var FetchersContext = import_react.createContext(/* @__PURE__ */ new Map());
3747FetchersContext.displayName = "Fetchers";
3748var AwaitContext = import_react.createContext(null);
3749AwaitContext.displayName = "Await";
3750var AwaitContextProvider = (props) => import_react.createElement(AwaitContext.Provider, props);
3751var NavigationContext = import_react.createContext(null);
3752NavigationContext.displayName = "Navigation";
3753var LocationContext = import_react.createContext(null);
3754LocationContext.displayName = "Location";
3755var RouteContext = import_react.createContext({
3756	outlet: null,
3757	matches: [],
3758	isDataRoute: false
3759});
3760RouteContext.displayName = "Route";
3761var RouteErrorContext = import_react.createContext(null);
3762RouteErrorContext.displayName = "RouteError";
3763var ERROR_DIGEST_BASE = "REACT_ROUTER_ERROR";
vendor: 19,071 bytes, lines 3764-4150
3764var ERROR_DIGEST_REDIRECT = "REDIRECT";
3765var ERROR_DIGEST_ROUTE_ERROR_RESPONSE = "ROUTE_ERROR_RESPONSE";
3766function decodeRedirectErrorDigest(digest) {
3767	if (digest.startsWith(`${ERROR_DIGEST_BASE}:${ERROR_DIGEST_REDIRECT}:{`)) try {
3768		let parsed = JSON.parse(digest.slice(28));
3769		if (typeof parsed === "object" && parsed && typeof parsed.status === "number" && typeof parsed.statusText === "string" && typeof parsed.location === "string" && typeof parsed.reloadDocument === "boolean" && typeof parsed.replace === "boolean") return parsed;
3770	} catch {}
3771}
3772function decodeRouteErrorResponseDigest(digest) {
3773	if (digest.startsWith(`${ERROR_DIGEST_BASE}:${ERROR_DIGEST_ROUTE_ERROR_RESPONSE}:{`)) try {
3774		let parsed = JSON.parse(digest.slice(40));
3775		if (typeof parsed === "object" && parsed && typeof parsed.status === "number" && typeof parsed.statusText === "string") return new ErrorResponseImpl(parsed.status, parsed.statusText, parsed.data);
3776	} catch {}
3777}
3778function useHref(to, { relative } = {}) {
3779	invariant(useInRouterContext(), `useHref() may be used only in the context of a <Router> component.`);
3780	let { basename, navigator } = import_react.useContext(NavigationContext);
3781	let { hash, pathname, search } = useResolvedPath(to, { relative });
3782	let joinedPathname = pathname;
3783	if (basename !== "/") joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
3784	return navigator.createHref({
3785		pathname: joinedPathname,
3786		search,
3787		hash
3788	});
3789}
3790function useInRouterContext() {
3791	return import_react.useContext(LocationContext) != null;
3792}
3793function useLocation() {
3794	invariant(useInRouterContext(), `useLocation() may be used only in the context of a <Router> component.`);
3795	return import_react.useContext(LocationContext).location;
3796}
3797function useNavigationType() {
3798	return import_react.useContext(LocationContext).navigationType;
3799}
3800function useMatch(pattern) {
3801	invariant(useInRouterContext(), `useMatch() may be used only in the context of a <Router> component.`);
3802	let { pathname } = useLocation();
3803	return import_react.useMemo(() => matchPath(pattern, decodePath(pathname)), [pathname, pattern]);
3804}
3805var navigateEffectWarning = `You should call navigate() in a React.useEffect(), not when your component is first rendered.`;
3806function useIsomorphicLayoutEffect(cb) {
3807	if (!import_react.useContext(NavigationContext).static) import_react.useLayoutEffect(cb);
3808}
3809function useNavigate() {
3810	let { isDataRoute } = import_react.useContext(RouteContext);
3811	return isDataRoute ? useNavigateStable() : useNavigateUnstable();
3812}
3813function useNavigateUnstable() {
3814	invariant(useInRouterContext(), `useNavigate() may be used only in the context of a <Router> component.`);
3815	let dataRouterContext = import_react.useContext(DataRouterContext);
3816	let { basename, navigator } = import_react.useContext(NavigationContext);
3817	let { matches } = import_react.useContext(RouteContext);
3818	let { pathname: locationPathname } = useLocation();
3819	let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
3820	let activeRef = import_react.useRef(false);
3821	useIsomorphicLayoutEffect(() => {
3822		activeRef.current = true;
3823	});
3824	return import_react.useCallback((to, options = {}) => {
3825		warning(activeRef.current, navigateEffectWarning);
3826		if (!activeRef.current) return;
3827		if (typeof to === "number") {
3828			navigator.go(to);
3829			return;
3830		}
3831		let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path");
3832		if (dataRouterContext == null && basename !== "/") path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
3833		(!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);
3834	}, [
3835		basename,
3836		navigator,
3837		routePathnamesJson,
3838		locationPathname,
3839		dataRouterContext
3840	]);
3841}
3842var OutletContext = import_react.createContext(null);
3843function useOutletContext() {
3844	return import_react.useContext(OutletContext);
3845}
3846function useOutlet(context) {
3847	let outlet = import_react.useContext(RouteContext).outlet;
3848	return import_react.useMemo(() => outlet && /* @__PURE__ */ import_react.createElement(OutletContext.Provider, { value: context }, outlet), [outlet, context]);
3849}
3850function useParams() {
3851	let { matches } = import_react.useContext(RouteContext);
3852	let routeMatch = matches[matches.length - 1];
3853	return routeMatch ? routeMatch.params : {};
3854}
3855function useResolvedPath(to, { relative } = {}) {
3856	let { matches } = import_react.useContext(RouteContext);
3857	let { pathname: locationPathname } = useLocation();
3858	let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
3859	return import_react.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [
3860		to,
3861		routePathnamesJson,
3862		locationPathname,
3863		relative
3864	]);
3865}
3866function useRoutes(routes, locationArg) {
3867	return useRoutesImpl(routes, locationArg);
3868}
3869function useRoutesImpl(routes, locationArg, dataRouterOpts) {
3870	invariant(useInRouterContext(), `useRoutes() may be used only in the context of a <Router> component.`);
3871	let { navigator } = import_react.useContext(NavigationContext);
3872	let { matches: parentMatches } = import_react.useContext(RouteContext);
3873	let routeMatch = parentMatches[parentMatches.length - 1];
3874	let parentParams = routeMatch ? routeMatch.params : {};
3875	let parentPathname = routeMatch ? routeMatch.pathname : "/";
3876	let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
3877	let parentRoute = routeMatch && routeMatch.route;
3878	{
3879		let parentPath = parentRoute && parentRoute.path || "";
3880		warningOnce(parentPathname, !parentRoute || parentPath.endsWith("*") || parentPath.endsWith("*?"), `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${parentPathname}" (under <Route path="${parentPath}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
3881
3882Please change the parent <Route path="${parentPath}"> to <Route path="${parentPath === "/" ? "*" : `${parentPath}/*`}">.`);
3883	}
3884	let locationFromContext = useLocation();
3885	let location;
3886	if (locationArg) {
3887		let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
3888		invariant(parentPathnameBase === "/" || parsedLocationArg.pathname?.startsWith(parentPathnameBase), `When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${parentPathnameBase}" but pathname "${parsedLocationArg.pathname}" was given in the \`location\` prop.`);
3889		location = parsedLocationArg;
3890	} else location = locationFromContext;
3891	let pathname = location.pathname || "/";
3892	let remainingPathname = pathname;
3893	if (parentPathnameBase !== "/") {
3894		let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
3895		remainingPathname = "/" + pathname.replace(/^\//, "").split("/").slice(parentSegments.length).join("/");
3896	}
3897	let matches = matchRoutes(routes, { pathname: remainingPathname });
3898	warning(parentRoute || matches != null, `No routes matched location "${location.pathname}${location.search}${location.hash}" `);
3899	warning(matches == null || matches[matches.length - 1].route.element !== void 0 || matches[matches.length - 1].route.Component !== void 0 || matches[matches.length - 1].route.lazy !== void 0, `Matched leaf route at location "${location.pathname}${location.search}${location.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);
3900	let renderedMatches = _renderMatches(matches && matches.map((match) => Object.assign({}, match, {
3901		params: Object.assign({}, parentParams, match.params),
3902		pathname: joinPaths([parentPathnameBase, navigator.encodeLocation ? navigator.encodeLocation(match.pathname.replace(/%/g, "%25").replace(/\?/g, "%3F").replace(/#/g, "%23")).pathname : match.pathname]),
3903		pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([parentPathnameBase, navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase.replace(/%/g, "%25").replace(/\?/g, "%3F").replace(/#/g, "%23")).pathname : match.pathnameBase])
3904	})), parentMatches, dataRouterOpts);
3905	if (locationArg && renderedMatches) return /* @__PURE__ */ import_react.createElement(LocationContext.Provider, { value: {
3906		location: {
3907			pathname: "/",
3908			search: "",
3909			hash: "",
3910			state: null,
3911			key: "default",
3912			unstable_mask: void 0,
3913			...location
3914		},
3915		navigationType: "POP"
3916	} }, renderedMatches);
3917	return renderedMatches;
3918}
3919function DefaultErrorComponent() {
3920	let error = useRouteError();
3921	let message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);
3922	let stack = error instanceof Error ? error.stack : null;
3923	let lightgrey = "rgba(200,200,200, 0.5)";
3924	let preStyles = {
3925		padding: "0.5rem",
3926		backgroundColor: lightgrey
3927	};
3928	let codeStyles = {
3929		padding: "2px 4px",
3930		backgroundColor: lightgrey
3931	};
3932	let devInfo = null;
3933	console.error("Error handled by React Router default ErrorBoundary:", error);
3934	devInfo = /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, /* @__PURE__ */ import_react.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ import_react.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ import_react.createElement("code", { style: codeStyles }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ import_react.createElement("code", { style: codeStyles }, "errorElement"), " prop on your route."));
3935	return /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, /* @__PURE__ */ import_react.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ import_react.createElement("h3", { style: { fontStyle: "italic" } }, message), stack ? /* @__PURE__ */ import_react.createElement("pre", { style: preStyles }, stack) : null, devInfo);
3936}
3937var defaultErrorElement = /* @__PURE__ */ import_react.createElement(DefaultErrorComponent, null);
3938var RenderErrorBoundary = class extends import_react.Component {
3939	constructor(props) {
3940		super(props);
3941		this.state = {
3942			location: props.location,
3943			revalidation: props.revalidation,
3944			error: props.error
3945		};
3946	}
3947	static getDerivedStateFromError(error) {
3948		return { error };
3949	}
3950	static getDerivedStateFromProps(props, state) {
3951		if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") return {
3952			error: props.error,
3953			location: props.location,
3954			revalidation: props.revalidation
3955		};
3956		return {
3957			error: props.error !== void 0 ? props.error : state.error,
3958			location: state.location,
3959			revalidation: props.revalidation || state.revalidation
3960		};
3961	}
3962	componentDidCatch(error, errorInfo) {
3963		if (this.props.onError) this.props.onError(error, errorInfo);
3964		else console.error("React Router caught the following error during render", error);
3965	}
3966	render() {
3967		let error = this.state.error;
3968		if (this.context && typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
3969			const decoded = decodeRouteErrorResponseDigest(error.digest);
3970			if (decoded) error = decoded;
3971		}
3972		let result = error !== void 0 ? /* @__PURE__ */ import_react.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ import_react.createElement(RouteErrorContext.Provider, {
3973			value: error,
3974			children: this.props.component
3975		})) : this.props.children;
3976		if (this.context) return /* @__PURE__ */ import_react.createElement(RSCErrorHandler, { error }, result);
3977		return result;
3978	}
3979};
3980RenderErrorBoundary.contextType = RSCRouterContext;
3981var errorRedirectHandledMap = /* @__PURE__ */ new WeakMap();
3982function RSCErrorHandler({ children, error }) {
3983	let { basename } = import_react.useContext(NavigationContext);
3984	if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
3985		let redirect2 = decodeRedirectErrorDigest(error.digest);
3986		if (redirect2) {
3987			let existingRedirect = errorRedirectHandledMap.get(error);
3988			if (existingRedirect) throw existingRedirect;
3989			let parsed = parseToInfo(redirect2.location, basename);
3990			if (isBrowser && !errorRedirectHandledMap.get(error)) if (parsed.isExternal || redirect2.reloadDocument) window.location.href = parsed.absoluteURL || parsed.to;
3991			else {
3992				const redirectPromise = Promise.resolve().then(() => window.__reactRouterDataRouter.navigate(parsed.to, { replace: redirect2.replace }));
3993				errorRedirectHandledMap.set(error, redirectPromise);
3994				throw redirectPromise;
3995			}
3996			return /* @__PURE__ */ import_react.createElement("meta", {
3997				httpEquiv: "refresh",
3998				content: `0;url=${parsed.absoluteURL || parsed.to}`
3999			});
4000		}
4001	}
4002	return children;
4003}
4004function RenderedRoute({ routeContext, match, children }) {
4005	let dataRouterContext = import_react.useContext(DataRouterContext);
4006	if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
4007	return /* @__PURE__ */ import_react.createElement(RouteContext.Provider, { value: routeContext }, children);
4008}
4009function _renderMatches(matches, parentMatches = [], dataRouterOpts) {
4010	let dataRouterState = dataRouterOpts?.state;
4011	if (matches == null) {
4012		if (!dataRouterState) return null;
4013		if (dataRouterState.errors) matches = dataRouterState.matches;
4014		else if (parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) matches = dataRouterState.matches;
4015		else return null;
4016	}
4017	let renderedMatches = matches;
4018	let errors = dataRouterState?.errors;
4019	if (errors != null) {
4020		let errorIndex = renderedMatches.findIndex((m) => m.route.id && errors?.[m.route.id] !== void 0);
4021		invariant(errorIndex >= 0, `Could not find a matching route for errors on route IDs: ${Object.keys(errors).join(",")}`);
4022		renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));
4023	}
4024	let renderFallback = false;
4025	let fallbackIndex = -1;
4026	if (dataRouterOpts && dataRouterState) {
4027		renderFallback = dataRouterState.renderFallback;
4028		for (let i = 0; i < renderedMatches.length; i++) {
4029			let match = renderedMatches[i];
4030			if (match.route.HydrateFallback || match.route.hydrateFallbackElement) fallbackIndex = i;
4031			if (match.route.id) {
4032				let { loaderData, errors: errors2 } = dataRouterState;
4033				let needsToRunLoader = match.route.loader && !loaderData.hasOwnProperty(match.route.id) && (!errors2 || errors2[match.route.id] === void 0);
4034				if (match.route.lazy || needsToRunLoader) {
4035					if (dataRouterOpts.isStatic) renderFallback = true;
4036					if (fallbackIndex >= 0) renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
4037					else renderedMatches = [renderedMatches[0]];
4038					break;
4039				}
4040			}
4041		}
4042	}
4043	let onErrorHandler = dataRouterOpts?.onError;
4044	let onError = dataRouterState && onErrorHandler ? (error, errorInfo) => {
4045		onErrorHandler(error, {
4046			location: dataRouterState.location,
4047			params: dataRouterState.matches?.[0]?.params ?? {},
4048			unstable_pattern: getRoutePattern(dataRouterState.matches),
4049			errorInfo
4050		});
4051	} : void 0;
4052	return renderedMatches.reduceRight((outlet, match, index) => {
4053		let error;
4054		let shouldRenderHydrateFallback = false;
4055		let errorElement = null;
4056		let hydrateFallbackElement = null;
4057		if (dataRouterState) {
4058			error = errors && match.route.id ? errors[match.route.id] : void 0;
4059			errorElement = match.route.errorElement || defaultErrorElement;
4060			if (renderFallback) {
4061				if (fallbackIndex < 0 && index === 0) {
4062					warningOnce("route-fallback", false, "No `HydrateFallback` element provided to render during initial hydration");
4063					shouldRenderHydrateFallback = true;
4064					hydrateFallbackElement = null;
4065				} else if (fallbackIndex === index) {
4066					shouldRenderHydrateFallback = true;
4067					hydrateFallbackElement = match.route.hydrateFallbackElement || null;
4068				}
4069			}
4070		}
4071		let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
4072		let getChildren = () => {
4073			let children;
4074			if (error) children = errorElement;
4075			else if (shouldRenderHydrateFallback) children = hydrateFallbackElement;
4076			else if (match.route.Component) children = /* @__PURE__ */ import_react.createElement(match.route.Component, null);
4077			else if (match.route.element) children = match.route.element;
4078			else children = outlet;
4079			return /* @__PURE__ */ import_react.createElement(RenderedRoute, {
4080				match,
4081				routeContext: {
4082					outlet,
4083					matches: matches2,
4084					isDataRoute: dataRouterState != null
4085				},
4086				children
4087			});
4088		};
4089		return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ import_react.createElement(RenderErrorBoundary, {
4090			location: dataRouterState.location,
4091			revalidation: dataRouterState.revalidation,
4092			component: errorElement,
4093			error,
4094			children: getChildren(),
4095			routeContext: {
4096				outlet: null,
4097				matches: matches2,
4098				isDataRoute: true
4099			},
4100			onError
4101		}) : getChildren();
4102	}, null);
4103}
4104function getDataRouterConsoleError(hookName) {
4105	return `${hookName} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`;
4106}
4107function useDataRouterContext(hookName) {
4108	let ctx = import_react.useContext(DataRouterContext);
4109	invariant(ctx, getDataRouterConsoleError(hookName));
4110	return ctx;
4111}
4112function useDataRouterState(hookName) {
4113	let state = import_react.useContext(DataRouterStateContext);
4114	invariant(state, getDataRouterConsoleError(hookName));
4115	return state;
4116}
4117function useRouteContext(hookName) {
4118	let route = import_react.useContext(RouteContext);
4119	invariant(route, getDataRouterConsoleError(hookName));
4120	return route;
4121}
4122function useCurrentRouteId(hookName) {
4123	let route = useRouteContext(hookName);
4124	let thisRoute = route.matches[route.matches.length - 1];
4125	invariant(thisRoute.route.id, `${hookName} can only be used on routes that contain a unique "id"`);
4126	return thisRoute.route.id;
4127}
4128function useRouteId() {
4129	return useCurrentRouteId("useRouteId");
4130}
4131function useNavigation() {
4132	return useDataRouterState("useNavigation").navigation;
4133}
4134function useRevalidator() {
4135	let dataRouterContext = useDataRouterContext("useRevalidator");
4136	let state = useDataRouterState("useRevalidator");
4137	let revalidate = import_react.useCallback(async () => {
4138		await dataRouterContext.router.revalidate();
4139	}, [dataRouterContext.router]);
4140	return import_react.useMemo(() => ({
4141		revalidate,
4142		state: state.revalidation
4143	}), [revalidate, state.revalidation]);
4144}
4145function useMatches() {
4146	let { matches, loaderData } = useDataRouterState("useMatches");
4147	return import_react.useMemo(() => matches.map((m) => convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData]);
4148}
4149function useLoaderData() {
4150	let state = useDataRouterState("useLoaderData");
4151	let routeId = useCurrentRouteId("useLoaderData");
4152	return state.loaderData[routeId];
4153}
4154function useRouteLoaderData(routeId) {
4155	return useDataRouterState("useRouteLoaderData").loaderData[routeId];
4156}
4157function useActionData() {
4158	let state = useDataRouterState("useActionData");
4159	let routeId = useCurrentRouteId("useLoaderData");
4160	return state.actionData ? state.actionData[routeId] : void 0;
4161}
4162function useRouteError() {
4163	let error = import_react.useContext(RouteErrorContext);
4164	let state = useDataRouterState("useRouteError");
4165	let routeId = useCurrentRouteId("useRouteError");
4166	if (error !== void 0) return error;
4167	return state.errors?.[routeId];
4168}
4169function useAsyncValue() {
4170	return import_react.useContext(AwaitContext)?._data;
4171}
4172function useAsyncError() {
4173	return import_react.useContext(AwaitContext)?._error;
4174}
4175var blockerId = 0;
4176function useBlocker(shouldBlock) {
4177	let { router, basename } = useDataRouterContext("useBlocker");
4178	let state = useDataRouterState("useBlocker");
4179	let [blockerKey, setBlockerKey] = import_react.useState("");
4180	let blockerFunction = import_react.useCallback((arg) => {
4181		if (typeof shouldBlock !== "function") return !!shouldBlock;
4182		if (basename === "/") return shouldBlock(arg);
4183		let { currentLocation, nextLocation, historyAction } = arg;
4184		return shouldBlock({
4185			currentLocation: {
4186				...currentLocation,
4187				pathname: stripBasename(currentLocation.pathname, basename) || currentLocation.pathname
4188			},
4189			nextLocation: {
4190				...nextLocation,
4191				pathname: stripBasename(nextLocation.pathname, basename) || nextLocation.pathname
4192			},
4193			historyAction
4194		});
4195	}, [basename, shouldBlock]);
4196	import_react.useEffect(() => {
4197		let key = String(++blockerId);
4198		setBlockerKey(key);
4199		return () => router.deleteBlocker(key);
4200	}, [router]);
4201	import_react.useEffect(() => {
4202		if (blockerKey !== "") router.getBlocker(blockerKey, blockerFunction);
4203	}, [
4204		router,
4205		blockerKey,
4206		blockerFunction
4207	]);
4208	return blockerKey && state.blockers.has(blockerKey) ? state.blockers.get(blockerKey) : IDLE_BLOCKER;
4209}
4210function useNavigateStable() {
4211	let { router } = useDataRouterContext("useNavigate");
4212	let id = useCurrentRouteId("useNavigate");
4213	let activeRef = import_react.useRef(false);
4214	useIsomorphicLayoutEffect(() => {
4215		activeRef.current = true;
4216	});
4217	return import_react.useCallback(async (to, options = {}) => {
4218		warning(activeRef.current, navigateEffectWarning);
4219		if (!activeRef.current) return;
4220		if (typeof to === "number") await router.navigate(to);
4221		else await router.navigate(to, {
4222			fromRouteId: id,
4223			...options
4224		});
4225	}, [router, id]);
4226}
4227var alreadyWarned = {};
4228function warningOnce(key, cond, message) {
4229	if (!cond && !alreadyWarned[key]) {
4230		alreadyWarned[key] = true;
4231		warning(false, message);
4232	}
4233}
4234function useRoute(...args) {
4235	const currentRouteId = useCurrentRouteId("useRoute");
4236	const id = args[0] ?? currentRouteId;
4237	const state = useDataRouterState("useRoute");
4238	const route = state.matches.find(({ route: route2 }) => route2.id === id);
4239	if (route === void 0) return void 0;
4240	return {
4241		handle: route.route.handle,
4242		loaderData: state.loaderData[id],
4243		actionData: state.actionData?.[id]
4244	};
4245}
4246var alreadyWarned2 = {};
4247function warnOnce(condition, message) {
4248	if (!condition && !alreadyWarned2[message]) {
4249		alreadyWarned2[message] = true;
4250		console.warn(message);
4251	}
4252}
4253var useOptimisticImpl = import_react.useOptimistic;
4254var stableUseOptimisticSetter = () => void 0;
4255function useOptimisticSafe(val) {
4256	if (useOptimisticImpl) return useOptimisticImpl(val);
4257	else return [val, stableUseOptimisticSetter];
4258}
4259function mapRouteProperties(route) {
4260	let updates = { hasErrorBoundary: route.hasErrorBoundary || route.ErrorBoundary != null || route.errorElement != null };
4261	if (route.Component) {
4262		if (route.element) warning(false, "You should not include both `Component` and `element` on your route - `Component` will be used.");
4263		Object.assign(updates, {
4264			element: import_react.createElement(route.Component),
4265			Component: void 0
4266		});
4267	}
4268	if (route.HydrateFallback) {
4269		if (route.hydrateFallbackElement) warning(false, "You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used.");
4270		Object.assign(updates, {
4271			hydrateFallbackElement: import_react.createElement(route.HydrateFallback),
4272			HydrateFallback: void 0
4273		});
4274	}
4275	if (route.ErrorBoundary) {
4276		if (route.errorElement) warning(false, "You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used.");
4277		Object.assign(updates, {
4278			errorElement: import_react.createElement(route.ErrorBoundary),
4279			ErrorBoundary: void 0
4280		});
4281	}
4282	return updates;
4283}
4284var hydrationRouteProperties = ["HydrateFallback", "hydrateFallbackElement"];
4285function createMemoryRouter(routes, opts) {
4286	return createRouter({
4287		basename: opts?.basename,
4288		getContext: opts?.getContext,
4289		future: opts?.future,
4290		history: createMemoryHistory({
4291			initialEntries: opts?.initialEntries,
4292			initialIndex: opts?.initialIndex
4293		}),
4294		hydrationData: opts?.hydrationData,
4295		routes,
4296		hydrationRouteProperties,
4297		mapRouteProperties,
4298		dataStrategy: opts?.dataStrategy,
4299		patchRoutesOnNavigation: opts?.patchRoutesOnNavigation,
4300		unstable_instrumentations: opts?.unstable_instrumentations
4301	}).initialize();
4302}
4303var Deferred = class {
4304	constructor() {
4305		this.status = "pending";
4306		this.promise = new Promise((resolve, reject) => {
4307			this.resolve = (value) => {
4308				if (this.status === "pending") {
4309					this.status = "resolved";
4310					resolve(value);
4311				}
4312			};
4313			this.reject = (reason) => {
4314				if (this.status === "pending") {
4315					this.status = "rejected";
4316					reject(reason);
4317				}
4318			};
4319		});
4320	}
4321};
4322function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, onError, unstable_useTransitions }) {
4323	unstable_useTransitions = useIsRSCRouterContext() || unstable_useTransitions;
4324	let [_state, setStateImpl] = import_react.useState(router.state);
4325	let [state, setOptimisticState] = useOptimisticSafe(_state);
4326	let [pendingState, setPendingState] = import_react.useState();
4327	let [vtContext, setVtContext] = import_react.useState({ isTransitioning: false });
4328	let [renderDfd, setRenderDfd] = import_react.useState();
4329	let [transition, setTransition] = import_react.useState();
4330	let [interruption, setInterruption] = import_react.useState();
4331	let fetcherData = import_react.useRef(/* @__PURE__ */ new Map());
4332	let setState = import_react.useCallback((newState, { deletedFetchers, newErrors, flushSync, viewTransitionOpts }) => {
vendor: 13,655 bytes, lines 4333-4699
4333		if (newErrors && onError) Object.values(newErrors).forEach((error) => onError(error, {
4334			location: newState.location,
4335			params: newState.matches[0]?.params ?? {},
4336			unstable_pattern: getRoutePattern(newState.matches)
4337		}));
4338		newState.fetchers.forEach((fetcher, key) => {
4339			if (fetcher.data !== void 0) fetcherData.current.set(key, fetcher.data);
4340		});
4341		deletedFetchers.forEach((key) => fetcherData.current.delete(key));
4342		warnOnce(flushSync === false || reactDomFlushSyncImpl != null, "You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable.  Please update your app to `import { RouterProvider } from \"react-router/dom\"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.");
4343		let isViewTransitionAvailable = router.window != null && router.window.document != null && typeof router.window.document.startViewTransition === "function";
4344		warnOnce(viewTransitionOpts == null || isViewTransitionAvailable, "You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available.");
4345		if (!viewTransitionOpts || !isViewTransitionAvailable) {
4346			if (reactDomFlushSyncImpl && flushSync) reactDomFlushSyncImpl(() => setStateImpl(newState));
4347			else if (unstable_useTransitions === false) setStateImpl(newState);
4348			else import_react.startTransition(() => {
4349				if (unstable_useTransitions === true) setOptimisticState((s) => getOptimisticRouterState(s, newState));
4350				setStateImpl(newState);
4351			});
4352			return;
4353		}
4354		if (reactDomFlushSyncImpl && flushSync) {
4355			reactDomFlushSyncImpl(() => {
4356				if (transition) {
4357					renderDfd?.resolve();
4358					transition.skipTransition();
4359				}
4360				setVtContext({
4361					isTransitioning: true,
4362					flushSync: true,
4363					currentLocation: viewTransitionOpts.currentLocation,
4364					nextLocation: viewTransitionOpts.nextLocation
4365				});
4366			});
4367			let t = router.window.document.startViewTransition(() => {
4368				reactDomFlushSyncImpl(() => setStateImpl(newState));
4369			});
4370			t.finished.finally(() => {
4371				reactDomFlushSyncImpl(() => {
4372					setRenderDfd(void 0);
4373					setTransition(void 0);
4374					setPendingState(void 0);
4375					setVtContext({ isTransitioning: false });
4376				});
4377			});
4378			reactDomFlushSyncImpl(() => setTransition(t));
4379			return;
4380		}
4381		if (transition) {
4382			renderDfd?.resolve();
4383			transition.skipTransition();
4384			setInterruption({
4385				state: newState,
4386				currentLocation: viewTransitionOpts.currentLocation,
4387				nextLocation: viewTransitionOpts.nextLocation
4388			});
4389		} else {
4390			setPendingState(newState);
4391			setVtContext({
4392				isTransitioning: true,
4393				flushSync: false,
4394				currentLocation: viewTransitionOpts.currentLocation,
4395				nextLocation: viewTransitionOpts.nextLocation
4396			});
4397		}
4398	}, [
4399		router.window,
4400		reactDomFlushSyncImpl,
4401		transition,
4402		renderDfd,
4403		unstable_useTransitions,
4404		setOptimisticState,
4405		onError
4406	]);
4407	import_react.useLayoutEffect(() => router.subscribe(setState), [router, setState]);
4408	import_react.useEffect(() => {
4409		if (vtContext.isTransitioning && !vtContext.flushSync) setRenderDfd(new Deferred());
4410	}, [vtContext]);
4411	import_react.useEffect(() => {
4412		if (renderDfd && pendingState && router.window) {
4413			let newState = pendingState;
4414			let renderPromise = renderDfd.promise;
4415			let transition2 = router.window.document.startViewTransition(async () => {
4416				if (unstable_useTransitions === false) setStateImpl(newState);
4417				else import_react.startTransition(() => {
4418					if (unstable_useTransitions === true) setOptimisticState((s) => getOptimisticRouterState(s, newState));
4419					setStateImpl(newState);
4420				});
4421				await renderPromise;
4422			});
4423			transition2.finished.finally(() => {
4424				setRenderDfd(void 0);
4425				setTransition(void 0);
4426				setPendingState(void 0);
4427				setVtContext({ isTransitioning: false });
4428			});
4429			setTransition(transition2);
4430		}
4431	}, [
4432		pendingState,
4433		renderDfd,
4434		router.window,
4435		unstable_useTransitions,
4436		setOptimisticState
4437	]);
4438	import_react.useEffect(() => {
4439		if (renderDfd && pendingState && state.location.key === pendingState.location.key) renderDfd.resolve();
4440	}, [
4441		renderDfd,
4442		transition,
4443		state.location,
4444		pendingState
4445	]);
4446	import_react.useEffect(() => {
4447		if (!vtContext.isTransitioning && interruption) {
4448			setPendingState(interruption.state);
4449			setVtContext({
4450				isTransitioning: true,
4451				flushSync: false,
4452				currentLocation: interruption.currentLocation,
4453				nextLocation: interruption.nextLocation
4454			});
4455			setInterruption(void 0);
4456		}
4457	}, [vtContext.isTransitioning, interruption]);
4458	let navigator = import_react.useMemo(() => {
4459		return {
4460			createHref: router.createHref,
4461			encodeLocation: router.encodeLocation,
4462			go: (n) => router.navigate(n),
4463			push: (to, state2, opts) => router.navigate(to, {
4464				state: state2,
4465				preventScrollReset: opts?.preventScrollReset
4466			}),
4467			replace: (to, state2, opts) => router.navigate(to, {
4468				replace: true,
4469				state: state2,
4470				preventScrollReset: opts?.preventScrollReset
4471			})
4472		};
4473	}, [router]);
4474	let basename = router.basename || "/";
4475	let dataRouterContext = import_react.useMemo(() => ({
4476		router,
4477		navigator,
4478		static: false,
4479		basename,
4480		onError
4481	}), [
4482		router,
4483		navigator,
4484		basename,
4485		onError
4486	]);
4487	return /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, /* @__PURE__ */ import_react.createElement(DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ import_react.createElement(DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ import_react.createElement(FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ import_react.createElement(ViewTransitionContext.Provider, { value: vtContext }, /* @__PURE__ */ import_react.createElement(Router, {
4488		basename,
4489		location: state.location,
4490		navigationType: state.historyAction,
4491		navigator,
4492		unstable_useTransitions
4493	}, /* @__PURE__ */ import_react.createElement(MemoizedDataRoutes, {
4494		routes: router.routes,
4495		future: router.future,
4496		state,
4497		isStatic: false,
4498		onError
4499	})))))), null);
4500}
4501function getOptimisticRouterState(currentState, newState) {
4502	return {
4503		...currentState,
4504		navigation: newState.navigation.state !== "idle" ? newState.navigation : currentState.navigation,
4505		revalidation: newState.revalidation !== "idle" ? newState.revalidation : currentState.revalidation,
4506		actionData: newState.navigation.state !== "submitting" ? newState.actionData : currentState.actionData,
4507		fetchers: newState.fetchers
4508	};
4509}
4510var MemoizedDataRoutes = import_react.memo(DataRoutes);
4511function DataRoutes({ routes, future, state, isStatic, onError }) {
4512	return useRoutesImpl(routes, void 0, {
4513		state,
4514		isStatic,
4515		onError,
4516		future
4517	});
4518}
4519function MemoryRouter({ basename, children, initialEntries, initialIndex, unstable_useTransitions }) {
4520	let historyRef = import_react.useRef();
4521	if (historyRef.current == null) historyRef.current = createMemoryHistory({
4522		initialEntries,
4523		initialIndex,
4524		v5Compat: true
4525	});
4526	let history = historyRef.current;
4527	let [state, setStateImpl] = import_react.useState({
4528		action: history.action,
4529		location: history.location
4530	});
4531	let setState = import_react.useCallback((newState) => {
4532		if (unstable_useTransitions === false) setStateImpl(newState);
4533		else import_react.startTransition(() => setStateImpl(newState));
4534	}, [unstable_useTransitions]);
4535	import_react.useLayoutEffect(() => history.listen(setState), [history, setState]);
4536	return /* @__PURE__ */ import_react.createElement(Router, {
4537		basename,
4538		children,
4539		location: state.location,
4540		navigationType: state.action,
4541		navigator: history,
4542		unstable_useTransitions
4543	});
4544}
4545function Navigate({ to, replace: replace2, state, relative }) {
4546	invariant(useInRouterContext(), `<Navigate> may be used only in the context of a <Router> component.`);
4547	let { static: isStatic } = import_react.useContext(NavigationContext);
4548	warning(!isStatic, `<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);
4549	let { matches } = import_react.useContext(RouteContext);
4550	let { pathname: locationPathname } = useLocation();
4551	let navigate = useNavigate();
4552	let path = resolveTo(to, getResolveToMatches(matches), locationPathname, relative === "path");
4553	let jsonPath = JSON.stringify(path);
4554	import_react.useEffect(() => {
4555		navigate(JSON.parse(jsonPath), {
4556			replace: replace2,
4557			state,
4558			relative
4559		});
4560	}, [
4561		navigate,
4562		jsonPath,
4563		relative,
4564		replace2,
4565		state
4566	]);
4567	return null;
4568}
4569function Outlet(props) {
4570	return useOutlet(props.context);
4571}
4572function Route(props) {
4573	invariant(false, `A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`);
4574}
4575function Router({ basename: basenameProp = "/", children = null, location: locationProp, navigationType = "POP", navigator, static: staticProp = false, unstable_useTransitions }) {
4576	invariant(!useInRouterContext(), `You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);
4577	let basename = basenameProp.replace(/^\/*/, "/");
4578	let navigationContext = import_react.useMemo(() => ({
4579		basename,
4580		navigator,
4581		static: staticProp,
4582		unstable_useTransitions,
4583		future: {}
4584	}), [
4585		basename,
4586		navigator,
4587		staticProp,
4588		unstable_useTransitions
4589	]);
4590	if (typeof locationProp === "string") locationProp = parsePath(locationProp);
4591	let { pathname = "/", search = "", hash = "", state = null, key = "default", unstable_mask } = locationProp;
4592	let locationContext = import_react.useMemo(() => {
4593		let trailingPathname = stripBasename(pathname, basename);
4594		if (trailingPathname == null) return null;
4595		return {
4596			location: {
4597				pathname: trailingPathname,
4598				search,
4599				hash,
4600				state,
4601				key,
4602				unstable_mask
4603			},
4604			navigationType
4605		};
4606	}, [
4607		basename,
4608		pathname,
4609		search,
4610		hash,
4611		state,
4612		key,
4613		navigationType,
4614		unstable_mask
4615	]);
4616	warning(locationContext != null, `<Router basename="${basename}"> is not able to match the URL "${pathname}${search}${hash}" because it does not start with the basename, so the <Router> won't render anything.`);
4617	if (locationContext == null) return null;
4618	return /* @__PURE__ */ import_react.createElement(NavigationContext.Provider, { value: navigationContext }, /* @__PURE__ */ import_react.createElement(LocationContext.Provider, {
4619		children,
4620		value: locationContext
4621	}));
4622}
4623function Routes({ children, location }) {
4624	return useRoutes(createRoutesFromChildren(children), location);
4625}
4626function Await({ children, errorElement, resolve }) {
4627	let dataRouterContext = import_react.useContext(DataRouterContext);
4628	let dataRouterStateContext = import_react.useContext(DataRouterStateContext);
4629	let onError = import_react.useCallback((error, errorInfo) => {
4630		if (dataRouterContext && dataRouterContext.onError && dataRouterStateContext) dataRouterContext.onError(error, {
4631			location: dataRouterStateContext.location,
4632			params: dataRouterStateContext.matches[0]?.params || {},
4633			unstable_pattern: getRoutePattern(dataRouterStateContext.matches),
4634			errorInfo
4635		});
4636	}, [dataRouterContext, dataRouterStateContext]);
4637	return /* @__PURE__ */ import_react.createElement(AwaitErrorBoundary, {
4638		resolve,
4639		errorElement,
4640		onError
4641	}, /* @__PURE__ */ import_react.createElement(ResolveAwait, null, children));
4642}
4643var AwaitErrorBoundary = class extends import_react.Component {
4644	constructor(props) {
4645		super(props);
4646		this.state = { error: null };
4647	}
4648	static getDerivedStateFromError(error) {
4649		return { error };
4650	}
4651	componentDidCatch(error, errorInfo) {
4652		if (this.props.onError) this.props.onError(error, errorInfo);
4653		else console.error("<Await> caught the following error during render", error, errorInfo);
4654	}
4655	render() {
4656		let { children, errorElement, resolve } = this.props;
4657		let promise = null;
4658		let status = 0;
4659		if (!(resolve instanceof Promise)) {
4660			status = 1;
4661			promise = Promise.resolve();
4662			Object.defineProperty(promise, "_tracked", { get: () => true });
4663			Object.defineProperty(promise, "_data", { get: () => resolve });
4664		} else if (this.state.error) {
4665			status = 2;
4666			let renderError = this.state.error;
4667			promise = Promise.reject().catch(() => {});
4668			Object.defineProperty(promise, "_tracked", { get: () => true });
4669			Object.defineProperty(promise, "_error", { get: () => renderError });
4670		} else if (resolve._tracked) {
4671			promise = resolve;
4672			status = "_error" in promise ? 2 : "_data" in promise ? 1 : 0;
4673		} else {
4674			status = 0;
4675			Object.defineProperty(resolve, "_tracked", { get: () => true });
4676			promise = resolve.then((data2) => Object.defineProperty(resolve, "_data", { get: () => data2 }), (error) => {
4677				this.props.onError?.(error);
4678				Object.defineProperty(resolve, "_error", { get: () => error });
4679			});
4680		}
4681		if (status === 2 && !errorElement) throw promise._error;
4682		if (status === 2) return /* @__PURE__ */ import_react.createElement(AwaitContext.Provider, {
4683			value: promise,
4684			children: errorElement
4685		});
4686		if (status === 1) return /* @__PURE__ */ import_react.createElement(AwaitContext.Provider, {
4687			value: promise,
4688			children
4689		});
4690		throw promise;
4691	}
4692};
4693function ResolveAwait({ children }) {
4694	let data2 = useAsyncValue();
4695	let toRender = typeof children === "function" ? children(data2) : children;
4696	return /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, toRender);
4697}
4698function createRoutesFromChildren(children, parentPath = []) {
4699	let routes = [];
4700	import_react.Children.forEach(children, (element, index) => {
4701		if (!import_react.isValidElement(element)) return;
4702		let treePath = [...parentPath, index];
4703		if (element.type === import_react.Fragment) {
4704			routes.push.apply(routes, createRoutesFromChildren(element.props.children, treePath));
4705			return;
4706		}
4707		invariant(element.type === Route, `[${typeof element.type === "string" ? element.type : element.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);
4708		invariant(!element.props.index || !element.props.children, "An index route cannot have child routes.");
4709		let route = {
4710			id: element.props.id || treePath.join("-"),
4711			caseSensitive: element.props.caseSensitive,
4712			element: element.props.element,
4713			Component: element.props.Component,
4714			index: element.props.index,
4715			path: element.props.path,
4716			middleware: element.props.middleware,
4717			loader: element.props.loader,
4718			action: element.props.action,
4719			hydrateFallbackElement: element.props.hydrateFallbackElement,
4720			HydrateFallback: element.props.HydrateFallback,
4721			errorElement: element.props.errorElement,
4722			ErrorBoundary: element.props.ErrorBoundary,
4723			hasErrorBoundary: element.props.hasErrorBoundary === true || element.props.ErrorBoundary != null || element.props.errorElement != null,
4724			shouldRevalidate: element.props.shouldRevalidate,
4725			handle: element.props.handle,
4726			lazy: element.props.lazy
4727		};
4728		if (element.props.children) route.children = createRoutesFromChildren(element.props.children, treePath);
4729		routes.push(route);
4730	});
4731	return routes;
4732}
4733var createRoutesFromElements = createRoutesFromChildren;
4734function renderMatches(matches) {
4735	return _renderMatches(matches);
4736}
4737function useRouteComponentProps() {
4738	return {
4739		params: useParams(),
4740		loaderData: useLoaderData(),
4741		actionData: useActionData(),
4742		matches: useMatches()
4743	};
4744}
4745function WithComponentProps({ children }) {
4746	const props = useRouteComponentProps();
4747	return import_react.cloneElement(children, props);
4748}
4749function withComponentProps(Component4) {
4750	return function WithComponentProps2() {
4751		const props = useRouteComponentProps();
4752		return import_react.createElement(Component4, props);
4753	};
4754}
4755function useHydrateFallbackProps() {
4756	return {
4757		params: useParams(),
4758		loaderData: useLoaderData(),
4759		actionData: useActionData()
4760	};
4761}
4762function WithHydrateFallbackProps({ children }) {
4763	const props = useHydrateFallbackProps();
4764	return import_react.cloneElement(children, props);
4765}
4766function withHydrateFallbackProps(HydrateFallback) {
4767	return function WithHydrateFallbackProps2() {
4768		const props = useHydrateFallbackProps();
4769		return import_react.createElement(HydrateFallback, props);
4770	};
4771}
4772function useErrorBoundaryProps() {
4773	return {
4774		params: useParams(),
4775		loaderData: useLoaderData(),
4776		actionData: useActionData(),
4777		error: useRouteError()
4778	};
4779}
4780function WithErrorBoundaryProps({ children }) {
4781	const props = useErrorBoundaryProps();
4782	return import_react.cloneElement(children, props);
4783}
4784function withErrorBoundaryProps(ErrorBoundary) {
4785	return function WithErrorBoundaryProps2() {
4786		const props = useErrorBoundaryProps();
4787		return import_react.createElement(ErrorBoundary, props);
4788	};
4789}
4790var defaultMethod = "get";
4791var defaultEncType = "application/x-www-form-urlencoded";
4792function isHtmlElement(object) {
4793	return typeof HTMLElement !== "undefined" && object instanceof HTMLElement;
4794}
4795function isButtonElement(object) {
4796	return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
4797}
4798function isFormElement(object) {
4799	return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
4800}
4801function isInputElement(object) {
4802	return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
4803}
4804function isModifiedEvent(event) {
4805	return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
4806}
4807function shouldProcessLinkClick(event, target) {
4808	return event.button === 0 && (!target || target === "_self") && !isModifiedEvent(event);
4809}
4810function createSearchParams(init = "") {
4811	return new URLSearchParams(typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo2, key) => {
4812		let value = init[key];
4813		return memo2.concat(Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]]);
4814	}, []));
4815}
4816function getSearchParamsForLocation(locationSearch, defaultSearchParams) {
4817	let searchParams = createSearchParams(locationSearch);
4818	if (defaultSearchParams) defaultSearchParams.forEach((_, key) => {
4819		if (!searchParams.has(key)) defaultSearchParams.getAll(key).forEach((value) => {
4820			searchParams.append(key, value);
4821		});
4822	});
4823	return searchParams;
4824}
4825var _formDataSupportsSubmitter = null;
4826function isFormDataSubmitterSupported() {
4827	if (_formDataSupportsSubmitter === null) try {
4828		new FormData(document.createElement("form"), 0);
4829		_formDataSupportsSubmitter = false;
4830	} catch (e) {
4831		_formDataSupportsSubmitter = true;
4832	}
4833	return _formDataSupportsSubmitter;
4834}
4835var supportedFormEncTypes = /* @__PURE__ */ new Set([
4836	"application/x-www-form-urlencoded",
4837	"multipart/form-data",
4838	"text/plain"
4839]);
4840function getFormEncType(encType) {
4841	if (encType != null && !supportedFormEncTypes.has(encType)) {
4842		warning(false, `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`);
4843		return null;
4844	}
4845	return encType;
4846}
4847function getFormSubmissionInfo(target, basename) {
4848	let method;
4849	let action;
4850	let encType;
4851	let formData;
4852	let body;
4853	if (isFormElement(target)) {
4854		let attr = target.getAttribute("action");
4855		action = attr ? stripBasename(attr, basename) : null;
4856		method = target.getAttribute("method") || defaultMethod;
4857		encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
4858		formData = new FormData(target);
4859	} else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
4860		let form = target.form;
4861		if (form == null) throw new Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);
4862		let attr = target.getAttribute("formaction") || form.getAttribute("action");
4863		action = attr ? stripBasename(attr, basename) : null;
4864		method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
4865		encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
4866		formData = new FormData(form, target);
4867		if (!isFormDataSubmitterSupported()) {
4868			let { name, type, value } = target;
4869			if (type === "image") {
4870				let prefix = name ? `${name}.` : "";
4871				formData.append(`${prefix}x`, "0");
4872				formData.append(`${prefix}y`, "0");
4873			} else if (name) formData.append(name, value);
4874		}
4875	} else if (isHtmlElement(target)) throw new Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);
4876	else {
4877		method = defaultMethod;
4878		action = null;
4879		encType = defaultEncType;
4880		body = target;
4881	}
4882	if (formData && encType === "text/plain") {
4883		body = formData;
4884		formData = void 0;
4885	}
4886	return {
4887		action,
4888		method: method.toLowerCase(),
4889		encType,
4890		formData,
4891		body
4892	};
4893}
4894var HOLE = -1;
4895var NAN = -2;
4896var NEGATIVE_INFINITY = -3;
4897var NEGATIVE_ZERO = -4;
4898var NULL = -5;
4899var POSITIVE_INFINITY = -6;
4900var UNDEFINED = -7;
4901var TYPE_BIGINT = "B";
4902var TYPE_DATE = "D";
4903var TYPE_ERROR = "E";
4904var TYPE_MAP = "M";
4905var TYPE_NULL_OBJECT = "N";
4906var TYPE_PROMISE = "P";
4907var TYPE_REGEXP = "R";
4908var TYPE_SET = "S";
4909var TYPE_SYMBOL = "Y";
4910var TYPE_URL = "U";
4911var TYPE_PREVIOUS_RESOLVED = "Z";
4912var Deferred2 = class {
4913	constructor() {
4914		this.promise = new Promise((resolve, reject) => {
4915			this.resolve = resolve;
4916			this.reject = reject;
4917		});
4918	}
4919};
4920function createLineSplittingTransform() {
4921	const decoder = new TextDecoder();
4922	let leftover = "";
4923	return new TransformStream({
4924		transform(chunk, controller) {
4925			const str = decoder.decode(chunk, { stream: true });
4926			const parts = (leftover + str).split("\n");
4927			leftover = parts.pop() || "";
4928			for (const part of parts) controller.enqueue(part);
4929		},
4930		flush(controller) {
4931			if (leftover) controller.enqueue(leftover);
4932		}
4933	});
4934}
4935function flatten(input) {
4936	const { indices } = this;
4937	const existing = indices.get(input);
4938	if (existing) return [existing];
4939	if (input === void 0) return UNDEFINED;
4940	if (input === null) return NULL;
4941	if (Number.isNaN(input)) return NAN;
4942	if (input === Number.POSITIVE_INFINITY) return POSITIVE_INFINITY;
4943	if (input === Number.NEGATIVE_INFINITY) return NEGATIVE_INFINITY;
4944	if (input === 0 && 1 / input < 0) return NEGATIVE_ZERO;
4945	const index = this.index++;
4946	indices.set(input, index);
4947	stringify.call(this, input, index);
4948	return index;
4949}
4950function stringify(input, index) {
4951	const { deferred, plugins, postPlugins } = this;
4952	const str = this.stringified;
4953	const stack = [[input, index]];
4954	while (stack.length > 0) {
4955		const [input2, index2] = stack.pop();
4956		const partsForObj = (obj) => Object.keys(obj).map((k) => `"_${flatten.call(this, k)}":${flatten.call(this, obj[k])}`).join(",");
4957		let error = null;
4958		switch (typeof input2) {
4959			case "boolean":
4960			case "number":
4961			case "string":
4962				str[index2] = JSON.stringify(input2);
4963				break;
4964			case "bigint":
4965				str[index2] = `["${TYPE_BIGINT}","${input2}"]`;
4966				break;
4967			case "symbol": {
4968				const keyFor = Symbol.keyFor(input2);
4969				if (!keyFor) error = /* @__PURE__ */ new Error("Cannot encode symbol unless created with Symbol.for()");
4970				else str[index2] = `["${TYPE_SYMBOL}",${JSON.stringify(keyFor)}]`;
4971				break;
4972			}
4973			case "object": {
4974				if (!input2) {
4975					str[index2] = `${NULL}`;
4976					break;
4977				}
4978				const isArray = Array.isArray(input2);
4979				let pluginHandled = false;
4980				if (!isArray && plugins) for (const plugin of plugins) {
4981					const pluginResult = plugin(input2);
4982					if (Array.isArray(pluginResult)) {
4983						pluginHandled = true;
4984						const [pluginIdentifier, ...rest] = pluginResult;
4985						str[index2] = `[${JSON.stringify(pluginIdentifier)}`;
4986						if (rest.length > 0) str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`;
4987						str[index2] += "]";
4988						break;
4989					}
4990				}
4991				if (!pluginHandled) {
4992					let result = isArray ? "[" : "{";
4993					if (isArray) {
4994						for (let i = 0; i < input2.length; i++) result += (i ? "," : "") + (i in input2 ? flatten.call(this, input2[i]) : HOLE);
4995						str[index2] = `${result}]`;
4996					} else if (input2 instanceof Date) {
4997						const dateTime = input2.getTime();
4998						str[index2] = `["${TYPE_DATE}",${Number.isNaN(dateTime) ? JSON.stringify("invalid") : dateTime}]`;
4999					} else if (input2 instanceof URL) str[index2] = `["${TYPE_URL}",${JSON.stringify(input2.href)}]`;
5000					else if (input2 instanceof RegExp) str[index2] = `["${TYPE_REGEXP}",${JSON.stringify(input2.source)},${JSON.stringify(input2.flags)}]`;
5001					else if (input2 instanceof Set) if (input2.size > 0) str[index2] = `["${TYPE_SET}",${[...input2].map((val) => flatten.call(this, val)).join(",")}]`;
5002					else str[index2] = `["${TYPE_SET}"]`;
5003					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(",")}]`;
5004					else str[index2] = `["${TYPE_MAP}"]`;
5005					else if (input2 instanceof Promise) {
5006						str[index2] = `["${TYPE_PROMISE}",${index2}]`;
5007						deferred[index2] = input2;
5008					} else if (input2 instanceof Error) {
5009						str[index2] = `["${TYPE_ERROR}",${JSON.stringify(input2.message)}`;
5010						if (input2.name !== "Error") str[index2] += `,${JSON.stringify(input2.name)}`;
5011						str[index2] += "]";
5012					} else if (Object.getPrototypeOf(input2) === null) str[index2] = `["${TYPE_NULL_OBJECT}",{${partsForObj(input2)}}]`;
5013					else if (isPlainObject2(input2)) str[index2] = `{${partsForObj(input2)}}`;
5014					else error = /* @__PURE__ */ new Error("Cannot encode object with prototype");
5015				}
5016				break;
5017			}
5018			default: {
5019				const isArray = Array.isArray(input2);
5020				let pluginHandled = false;
5021				if (!isArray && plugins) for (const plugin of plugins) {
5022					const pluginResult = plugin(input2);
5023					if (Array.isArray(pluginResult)) {
5024						pluginHandled = true;
5025						const [pluginIdentifier, ...rest] = pluginResult;
5026						str[index2] = `[${JSON.stringify(pluginIdentifier)}`;
5027						if (rest.length > 0) str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`;
5028						str[index2] += "]";
5029						break;
5030					}
5031				}
5032				if (!pluginHandled) error = /* @__PURE__ */ new Error("Cannot encode function or unexpected type");
5033			}
5034		}
5035		if (error) {
5036			let pluginHandled = false;
5037			if (postPlugins) for (const plugin of postPlugins) {
5038				const pluginResult = plugin(input2);
5039				if (Array.isArray(pluginResult)) {
5040					pluginHandled = true;
5041					const [pluginIdentifier, ...rest] = pluginResult;
5042					str[index2] = `[${JSON.stringify(pluginIdentifier)}`;
5043					if (rest.length > 0) str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`;
5044					str[index2] += "]";
5045					break;
5046				}
5047			}
5048			if (!pluginHandled) throw error;
5049		}
5050	}
5051}
5052var objectProtoNames2 = Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
5053function isPlainObject2(thing) {
5054	const proto = Object.getPrototypeOf(thing);
5055	return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames2;
5056}
5057var globalObj = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : void 0;
5058function unflatten(parsed) {
5059	const { hydrated, values } = this;
5060	if (typeof parsed === "number") return hydrate.call(this, parsed);
5061	if (!Array.isArray(parsed) || !parsed.length) throw new SyntaxError();
5062	const startIndex = values.length;
5063	for (const value of parsed) values.push(value);
5064	hydrated.length = values.length;
5065	return hydrate.call(this, startIndex);
5066}
5067function hydrate(index) {
5068	const { hydrated, values, deferred, plugins } = this;
5069	let result;
5070	const stack = [[index, (v) => {
5071		result = v;
5072	}]];
5073	let postRun = [];
5074	while (stack.length > 0) {
5075		const [index2, set] = stack.pop();
5076		switch (index2) {
5077			case UNDEFINED:
5078				set(void 0);
5079				continue;
5080			case NULL:
5081				set(null);
5082				continue;
5083			case NAN:
5084				set(NaN);
5085				continue;
5086			case POSITIVE_INFINITY:
5087				set(Infinity);
5088				continue;
5089			case NEGATIVE_INFINITY:
5090				set(-Infinity);
5091				continue;
5092			case NEGATIVE_ZERO:
5093				set(-0);
5094				continue;
5095		}
5096		if (hydrated[index2]) {
5097			set(hydrated[index2]);
5098			continue;
5099		}
5100		const value = values[index2];
5101		if (!value || typeof value !== "object") {
5102			hydrated[index2] = value;
5103			set(value);
5104			continue;
5105		}
5106		if (Array.isArray(value)) if (typeof value[0] === "string") {
5107			const [type, b, c] = value;
5108			switch (type) {
5109				case TYPE_DATE:
5110					set(hydrated[index2] = new Date(b));
5111					continue;
5112				case TYPE_URL:
5113					set(hydrated[index2] = new URL(b));
5114					continue;
5115				case TYPE_BIGINT:
5116					set(hydrated[index2] = BigInt(b));
5117					continue;
5118				case TYPE_REGEXP:
5119					set(hydrated[index2] = new RegExp(b, c));
5120					continue;
5121				case TYPE_SYMBOL:
5122					set(hydrated[index2] = Symbol.for(b));
5123					continue;
5124				case TYPE_SET:
5125					const newSet = /* @__PURE__ */ new Set();
5126					hydrated[index2] = newSet;
5127					for (let i = value.length - 1; i > 0; i--) stack.push([value[i], (v) => {
5128						newSet.add(v);
5129					}]);
5130					set(newSet);
5131					continue;
5132				case TYPE_MAP:
5133					const map = /* @__PURE__ */ new Map();
5134					hydrated[index2] = map;
5135					for (let i = value.length - 2; i > 0; i -= 2) {
5136						const r = [];
5137						stack.push([value[i + 1], (v) => {
5138							r[1] = v;
5139						}]);
5140						stack.push([value[i], (k) => {
5141							r[0] = k;
5142						}]);
5143						postRun.push(() => {
5144							map.set(r[0], r[1]);
5145						});
5146					}
5147					set(map);
5148					continue;
5149				case TYPE_NULL_OBJECT:
5150					const obj = /* @__PURE__ */ Object.create(null);
5151					hydrated[index2] = obj;
5152					for (const key of Object.keys(b).reverse()) {
5153						const r = [];
5154						stack.push([b[key], (v) => {
5155							r[1] = v;
5156						}]);
5157						stack.push([Number(key.slice(1)), (k) => {
5158							r[0] = k;
5159						}]);
5160						postRun.push(() => {
5161							obj[r[0]] = r[1];
5162						});
5163					}
5164					set(obj);
5165					continue;
5166				case TYPE_PROMISE:
5167					if (hydrated[b]) set(hydrated[index2] = hydrated[b]);
5168					else {
5169						const d = new Deferred2();
5170						deferred[b] = d;
5171						set(hydrated[index2] = d.promise);
5172					}
5173					continue;
5174				case TYPE_ERROR:
5175					const [, message, errorType] = value;
5176					let error = errorType && globalObj && globalObj[errorType] ? new globalObj[errorType](message) : new Error(message);
5177					hydrated[index2] = error;
5178					set(error);
5179					continue;
5180				case TYPE_PREVIOUS_RESOLVED:
5181					set(hydrated[index2] = hydrated[b]);
5182					continue;
5183				default:
5184					if (Array.isArray(plugins)) {
5185						const r = [];
5186						const vals = value.slice(1);
5187						for (let i = 0; i < vals.length; i++) {
5188							const v = vals[i];
5189							stack.push([v, (v2) => {
5190								r[i] = v2;
5191							}]);
5192						}
5193						postRun.push(() => {
5194							for (const plugin of plugins) {
5195								const result2 = plugin(value[0], ...r);
5196								if (result2) {
5197									set(hydrated[index2] = result2.value);
5198									return;
5199								}
5200							}
5201							throw new SyntaxError();
5202						});
5203						continue;
5204					}
5205					throw new SyntaxError();
5206			}
5207		} else {
5208			const array = [];
5209			hydrated[index2] = array;
5210			for (let i = 0; i < value.length; i++) {
5211				const n = value[i];
5212				if (n !== HOLE) stack.push([n, (v) => {
5213					array[i] = v;
5214				}]);
5215			}
5216			set(array);
5217			continue;
5218		}
5219		else {
5220			const object = {};
5221			hydrated[index2] = object;
5222			for (const key of Object.keys(value).reverse()) {
5223				const r = [];
5224				stack.push([value[key], (v) => {
5225					r[1] = v;
5226				}]);
5227				stack.push([Number(key.slice(1)), (k) => {
5228					r[0] = k;
5229				}]);
5230				postRun.push(() => {
5231					object[r[0]] = r[1];
5232				});
5233			}
5234			set(object);
5235			continue;
5236		}
5237	}
5238	while (postRun.length > 0) postRun.pop()();
5239	return result;
5240}
5241async function decode(readable, options) {
5242	const { plugins } = options ?? {};
5243	const done = new Deferred2();
5244	const reader = readable.pipeThrough(createLineSplittingTransform()).getReader();
5245	const decoder = {
5246		values: [],
5247		hydrated: [],
5248		deferred: {},
5249		plugins
5250	};
5251	const decoded = await decodeInitial.call(decoder, reader);
5252	let donePromise = done.promise;
5253	if (decoded.done) done.resolve();
5254	else donePromise = decodeDeferred.call(decoder, reader).then(done.resolve).catch((reason) => {
5255		for (const deferred of Object.values(decoder.deferred)) deferred.reject(reason);
5256		done.reject(reason);
5257	});
5258	return {
5259		done: donePromise.then(() => reader.closed),
5260		value: decoded.value
5261	};
5262}
5263async function decodeInitial(reader) {
5264	const read = await reader.read();
5265	if (!read.value) throw new SyntaxError();
5266	let line;
5267	try {
5268		line = JSON.parse(read.value);
5269	} catch (reason) {
5270		throw new SyntaxError();
5271	}
5272	return {
5273		done: read.done,
5274		value: unflatten.call(this, line)
5275	};
5276}
5277async function decodeDeferred(reader) {
5278	let read = await reader.read();
5279	while (!read.done) {
5280		if (!read.value) continue;
5281		const line = read.value;
5282		switch (line[0]) {
5283			case TYPE_PROMISE: {
5284				const colonIndex = line.indexOf(":");
5285				const deferredId = Number(line.slice(1, colonIndex));
5286				const deferred = this.deferred[deferredId];
5287				if (!deferred) throw new Error(`Deferred ID ${deferredId} not found in stream`);
5288				const lineData = line.slice(colonIndex + 1);
5289				let jsonLine;
5290				try {
5291					jsonLine = JSON.parse(lineData);
5292				} catch (reason) {
5293					throw new SyntaxError();
5294				}
5295				const value = unflatten.call(this, jsonLine);
5296				deferred.resolve(value);
5297				break;
5298			}
5299			case TYPE_ERROR: {
5300				const colonIndex = line.indexOf(":");
5301				const deferredId = Number(line.slice(1, colonIndex));
5302				const deferred = this.deferred[deferredId];
5303				if (!deferred) throw new Error(`Deferred ID ${deferredId} not found in stream`);
5304				const lineData = line.slice(colonIndex + 1);
5305				let jsonLine;
5306				try {
5307					jsonLine = JSON.parse(lineData);
5308				} catch (reason) {
5309					throw new SyntaxError();
5310				}
5311				const value = unflatten.call(this, jsonLine);
5312				deferred.reject(value);
5313				break;
5314			}
5315			default: throw new SyntaxError();
5316		}
5317		read = await reader.read();
5318	}
5319}
5320function encode(input, options) {
5321	const { plugins, postPlugins, signal, onComplete } = options ?? {};
5322	const encoder = {
5323		deferred: {},
5324		index: 0,
5325		indices: /* @__PURE__ */ new Map(),
5326		stringified: [],
5327		plugins,
5328		postPlugins,
5329		signal
5330	};
5331	const textEncoder = new TextEncoder();
5332	let lastSentIndex = 0;
5333	return new ReadableStream({ async start(controller) {
5334		const id = flatten.call(encoder, input);
5335		if (Array.isArray(id)) throw new Error("This should never happen");
5336		if (id < 0) controller.enqueue(textEncoder.encode(`${id}
5337`));
5338		else {
5339			controller.enqueue(textEncoder.encode(`[${encoder.stringified.join(",")}]
5340`));
5341			lastSentIndex = encoder.stringified.length - 1;
5342		}
5343		const seenPromises = /* @__PURE__ */ new WeakSet();
5344		if (Object.keys(encoder.deferred).length) {
5345			let raceDone;
5346			const racePromise = new Promise((resolve, reject) => {
5347				raceDone = resolve;
5348				if (signal) {
5349					const rejectPromise = () => reject(signal.reason || /* @__PURE__ */ new Error("Signal was aborted."));
5350					if (signal.aborted) rejectPromise();
5351					else signal.addEventListener("abort", (event) => {
5352						rejectPromise();
5353					});
5354				}
5355			});
5356			while (Object.keys(encoder.deferred).length > 0) {
5357				for (const [deferredId, deferred] of Object.entries(encoder.deferred)) {
5358					if (seenPromises.has(deferred)) continue;
5359					seenPromises.add(encoder.deferred[Number(deferredId)] = Promise.race([racePromise, deferred]).then((resolved) => {
5360						const id2 = flatten.call(encoder, resolved);
5361						if (Array.isArray(id2)) {
5362							controller.enqueue(textEncoder.encode(`${TYPE_PROMISE}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]]
5363`));
5364							encoder.index++;
5365							lastSentIndex++;
5366						} else if (id2 < 0) controller.enqueue(textEncoder.encode(`${TYPE_PROMISE}${deferredId}:${id2}
5367`));
5368						else {
5369							const values = encoder.stringified.slice(lastSentIndex + 1).join(",");
5370							controller.enqueue(textEncoder.encode(`${TYPE_PROMISE}${deferredId}:[${values}]
5371`));
5372							lastSentIndex = encoder.stringified.length - 1;
5373						}
5374					}, (reason) => {
5375						if (!reason || typeof reason !== "object" || !(reason instanceof Error)) reason = /* @__PURE__ */ new Error("An unknown error occurred");
5376						const id2 = flatten.call(encoder, reason);
5377						if (Array.isArray(id2)) {
5378							controller.enqueue(textEncoder.encode(`${TYPE_ERROR}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]]
5379`));
5380							encoder.index++;
5381							lastSentIndex++;
5382						} else if (id2 < 0) controller.enqueue(textEncoder.encode(`${TYPE_ERROR}${deferredId}:${id2}
5383`));
5384						else {
5385							const values = encoder.stringified.slice(lastSentIndex + 1).join(",");
5386							controller.enqueue(textEncoder.encode(`${TYPE_ERROR}${deferredId}:[${values}]
5387`));
5388							lastSentIndex = encoder.stringified.length - 1;
5389						}
5390					}).finally(() => {
5391						delete encoder.deferred[Number(deferredId)];
5392					}));
5393				}
5394				await Promise.race(Object.values(encoder.deferred));
5395			}
5396			raceDone();
5397		}
5398		await Promise.all(Object.values(encoder.deferred));
5399		onComplete?.();
5400		controller.close();
5401	} });
5402}
5403async function createRequestInit(request) {
5404	let init = { signal: request.signal };
5405	if (request.method !== "GET") {
5406		init.method = request.method;
5407		let contentType = request.headers.get("Content-Type");
5408		if (contentType && /\bapplication\/json\b/.test(contentType)) {
5409			init.headers = { "Content-Type": contentType };
5410			init.body = JSON.stringify(await request.json());
5411		} else if (contentType && /\btext\/plain\b/.test(contentType)) {
5412			init.headers = { "Content-Type": contentType };
5413			init.body = await request.text();
5414		} else if (contentType && /\bapplication\/x-www-form-urlencoded\b/.test(contentType)) init.body = new URLSearchParams(await request.text());
5415		else init.body = await request.formData();
5416	}
5417	return init;
5418}
5419var ESCAPE_LOOKUP = {
5420	"&": "\\u0026",
5421	">": "\\u003e",
5422	"<": "\\u003c",
5423	"\u2028": "\\u2028",
5424	"\u2029": "\\u2029"
5425};
5426var ESCAPE_REGEX = /[&><\u2028\u2029]/g;
5427function escapeHtml(html) {
5428	return html.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
5429}
5430function invariant2(value, message) {
5431	if (value === false || value === null || typeof value === "undefined") throw new Error(message);
5432}
5433var SingleFetchRedirectSymbol = Symbol("SingleFetchRedirect");
5434var SingleFetchNoResultError = class extends Error {};
5435var NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([
5436	100,
5437	101,
5438	204,
5439	205
5440]);
5441function StreamTransfer({ context, identifier, reader, textDecoder, nonce }) {
5442	if (!context.renderMeta || !context.renderMeta.didRenderScripts) return null;
5443	if (!context.renderMeta.streamCache) context.renderMeta.streamCache = {};
5444	let { streamCache } = context.renderMeta;
5445	let promise = streamCache[identifier];
5446	if (!promise) promise = streamCache[identifier] = reader.read().then((result) => {
5447		streamCache[identifier].result = {
5448			done: result.done,
5449			value: textDecoder.decode(result.value, { stream: true })
5450		};
5451	}).catch((e) => {
5452		streamCache[identifier].error = e;
5453	});
5454	if (promise.error) throw promise.error;
5455	if (promise.result === void 0) throw promise;
5456	let { done, value } = promise.result;
5457	let scriptTag = value ? /* @__PURE__ */ import_react.createElement("script", {
5458		nonce,
5459		dangerouslySetInnerHTML: { __html: `window.__reactRouterContext.streamController.enqueue(${escapeHtml(JSON.stringify(value))});` }
5460	}) : null;
5461	if (done) return /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, scriptTag, /* @__PURE__ */ import_react.createElement("script", {
5462		nonce,
5463		dangerouslySetInnerHTML: { __html: `window.__reactRouterContext.streamController.close();` }
5464	}));
5465	else return /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, scriptTag, /* @__PURE__ */ import_react.createElement(import_react.Suspense, null, /* @__PURE__ */ import_react.createElement(StreamTransfer, {
5466		context,
5467		identifier: identifier + 1,
5468		reader,
5469		textDecoder,
5470		nonce
5471	})));
5472}
5473function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules, ssr, basename, trailingSlashAware) {
5474	let dataStrategy = getSingleFetchDataStrategyImpl(getRouter, (match) => {
5475		let manifestRoute = manifest.routes[match.route.id];
5476		invariant2(manifestRoute, "Route not found in manifest");
5477		let routeModule = routeModules[match.route.id];
5478		return {
5479			hasLoader: manifestRoute.hasLoader,
5480			hasClientLoader: manifestRoute.hasClientLoader,
5481			hasShouldRevalidate: Boolean(routeModule?.shouldRevalidate)
5482		};
5483	}, fetchAndDecodeViaTurboStream, ssr, basename, trailingSlashAware);
5484	return async (args) => args.runClientMiddleware(dataStrategy);
5485}
5486function getSingleFetchDataStrategyImpl(getRouter, getRouteInfo, fetchAndDecode, ssr, basename, trailingSlashAware, shouldAllowOptOut = () => true) {
5487	return async (args) => {
5488		let { request, matches, fetcherKey } = args;
5489		let router = getRouter();
5490		if (request.method !== "GET") return singleFetchActionStrategy(args, fetchAndDecode, basename, trailingSlashAware);
5491		let foundRevalidatingServerLoader = matches.some((m) => {
5492			let { hasLoader, hasClientLoader } = getRouteInfo(m);
5493			return m.shouldCallHandler() && hasLoader && !hasClientLoader;
5494		});
5495		if (!ssr && !foundRevalidatingServerLoader) return nonSsrStrategy(args, getRouteInfo, fetchAndDecode, basename, trailingSlashAware);
5496		if (fetcherKey) return singleFetchLoaderFetcherStrategy(args, fetchAndDecode, basename, trailingSlashAware);
5497		return singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, fetchAndDecode, ssr, basename, trailingSlashAware, shouldAllowOptOut);
5498	};
5499}
5500async function singleFetchActionStrategy(args, fetchAndDecode, basename, trailingSlashAware) {
5501	let actionMatch = args.matches.find((m) => m.shouldCallHandler());
5502	invariant2(actionMatch, "No action match found");
5503	let actionStatus = void 0;
5504	let result = await actionMatch.resolve(async (handler) => {
5505		return await handler(async () => {
5506			let { data: data2, status } = await fetchAndDecode(args, basename, trailingSlashAware, [actionMatch.route.id]);
5507			actionStatus = status;
5508			return unwrapSingleFetchResult(data2, actionMatch.route.id);
5509		});
5510	});
5511	if (isResponse(result.result) || isRouteErrorResponse(result.result) || isDataWithResponseInit(result.result)) return { [actionMatch.route.id]: result };
5512	return { [actionMatch.route.id]: {
5513		type: result.type,
5514		result: data(result.result, actionStatus)
5515	} };
5516}
5517async function nonSsrStrategy(args, getRouteInfo, fetchAndDecode, basename, trailingSlashAware) {
5518	let matchesToLoad = args.matches.filter((m) => m.shouldCallHandler());
5519	let results = {};
5520	await Promise.all(matchesToLoad.map((m) => m.resolve(async (handler) => {
5521		try {
5522			let { hasClientLoader } = getRouteInfo(m);
5523			let routeId = m.route.id;
5524			let result = hasClientLoader ? await handler(async () => {
5525				let { data: data2 } = await fetchAndDecode(args, basename, trailingSlashAware, [routeId]);
5526				return unwrapSingleFetchResult(data2, routeId);
5527			}) : await handler();
5528			results[m.route.id] = {
5529				type: "data",
5530				result
5531			};
5532		} catch (e) {
5533			results[m.route.id] = {
5534				type: "error",
5535				result: e
5536			};
5537		}
5538	})));
5539	return results;
5540}
5541async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, fetchAndDecode, ssr, base
vendor: 8,953 bytes, lines 5541-5776
5541name, trailingSlashAware, shouldAllowOptOut = () => true) {
5542	let routesParams = /* @__PURE__ */ new Set();
5543	let foundOptOutRoute = false;
5544	let routeDfds = args.matches.map(() => createDeferred2());
5545	let singleFetchDfd = createDeferred2();
5546	let results = {};
5547	let resolvePromise = Promise.all(args.matches.map(async (m, i) => m.resolve(async (handler) => {
5548		routeDfds[i].resolve();
5549		let routeId = m.route.id;
5550		let { hasLoader, hasClientLoader, hasShouldRevalidate } = getRouteInfo(m);
5551		let defaultShouldRevalidate = !m.shouldRevalidateArgs || m.shouldRevalidateArgs.actionStatus == null || m.shouldRevalidateArgs.actionStatus < 400;
5552		if (!m.shouldCallHandler(defaultShouldRevalidate)) {
5553			foundOptOutRoute || (foundOptOutRoute = m.shouldRevalidateArgs != null && hasLoader && hasShouldRevalidate === true);
5554			return;
5555		}
5556		if (shouldAllowOptOut(m) && hasClientLoader) {
5557			if (hasLoader) foundOptOutRoute = true;
5558			try {
5559				results[routeId] = {
5560					type: "data",
5561					result: await handler(async () => {
5562						let { data: data2 } = await fetchAndDecode(args, basename, trailingSlashAware, [routeId]);
5563						return unwrapSingleFetchResult(data2, routeId);
5564					})
5565				};
5566			} catch (e) {
5567				results[routeId] = {
5568					type: "error",
5569					result: e
5570				};
5571			}
5572			return;
5573		}
5574		if (hasLoader) routesParams.add(routeId);
5575		try {
5576			results[routeId] = {
5577				type: "data",
5578				result: await handler(async () => {
5579					return unwrapSingleFetchResult(await singleFetchDfd.promise, routeId);
5580				})
5581			};
5582		} catch (e) {
5583			results[routeId] = {
5584				type: "error",
5585				result: e
5586			};
5587		}
5588	})));
5589	await Promise.all(routeDfds.map((d) => d.promise));
5590	if ((!router.state.initialized && router.state.navigation.state === "idle" || routesParams.size === 0) && !window.__reactRouterHdrActive) singleFetchDfd.resolve({ routes: {} });
5591	else {
5592		let targetRoutes = ssr && foundOptOutRoute && routesParams.size > 0 ? [...routesParams.keys()] : void 0;
5593		try {
5594			let data2 = await fetchAndDecode(args, basename, trailingSlashAware, targetRoutes);
5595			singleFetchDfd.resolve(data2.data);
5596		} catch (e) {
5597			singleFetchDfd.reject(e);
5598		}
5599	}
5600	await resolvePromise;
5601	await bubbleMiddlewareErrors(singleFetchDfd.promise, args.matches, routesParams, results);
5602	return results;
5603}
5604async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams, results) {
5605	try {
5606		let middlewareError;
5607		let fetchedData = await singleFetchPromise;
5608		if ("routes" in fetchedData) {
5609			for (let match of matches) if (match.route.id in fetchedData.routes) {
5610				let routeResult = fetchedData.routes[match.route.id];
5611				if ("error" in routeResult) {
5612					middlewareError = routeResult.error;
5613					if (results[match.route.id]?.result == null) results[match.route.id] = {
5614						type: "error",
5615						result: middlewareError
5616					};
5617					break;
5618				}
5619			}
5620		}
5621		if (middlewareError !== void 0) Array.from(routesParams.values()).forEach((routeId) => {
5622			if (results[routeId].result instanceof SingleFetchNoResultError) results[routeId].result = middlewareError;
5623		});
5624	} catch (e) {}
5625}
5626async function singleFetchLoaderFetcherStrategy(args, fetchAndDecode, basename, trailingSlashAware) {
5627	let fetcherMatch = args.matches.find((m) => m.shouldCallHandler());
5628	invariant2(fetcherMatch, "No fetcher match found");
5629	let routeId = fetcherMatch.route.id;
5630	let result = await fetcherMatch.resolve(async (handler) => handler(async () => {
5631		let { data: data2 } = await fetchAndDecode(args, basename, trailingSlashAware, [routeId]);
5632		return unwrapSingleFetchResult(data2, routeId);
5633	}));
5634	return { [fetcherMatch.route.id]: result };
5635}
5636function stripIndexParam$1(url) {
5637	let indexValues = url.searchParams.getAll("index");
5638	url.searchParams.delete("index");
5639	let indexValuesToKeep = [];
5640	for (let indexValue of indexValues) if (indexValue) indexValuesToKeep.push(indexValue);
5641	for (let toKeep of indexValuesToKeep) url.searchParams.append("index", toKeep);
5642	return url;
5643}
5644function singleFetchUrl(reqUrl, basename, trailingSlashAware, extension) {
5645	let url = typeof reqUrl === "string" ? new URL(reqUrl, typeof window === "undefined" ? "server://singlefetch/" : window.location.origin) : reqUrl;
5646	if (trailingSlashAware) if (url.pathname.endsWith("/")) url.pathname = `${url.pathname}_.${extension}`;
5647	else url.pathname = `${url.pathname}.${extension}`;
5648	else if (url.pathname === "/") url.pathname = `_root.${extension}`;
5649	else if (basename && stripBasename(url.pathname, basename) === "/") url.pathname = `${basename.replace(/\/$/, "")}/_root.${extension}`;
5650	else url.pathname = `${url.pathname.replace(/\/$/, "")}.${extension}`;
5651	return url;
5652}
5653async function fetchAndDecodeViaTurboStream(args, basename, trailingSlashAware, targetRoutes) {
5654	let { request } = args;
5655	let url = singleFetchUrl(request.url, basename, trailingSlashAware, "data");
5656	if (request.method === "GET") {
5657		url = stripIndexParam$1(url);
5658		if (targetRoutes) url.searchParams.set("_routes", targetRoutes.join(","));
5659	}
5660	let res = await fetch(url, await createRequestInit(request));
5661	if (res.status >= 400 && !res.headers.has("X-Remix-Response")) throw new ErrorResponseImpl(res.status, res.statusText, await res.text());
5662	if (res.status === 204 && res.headers.has("X-Remix-Redirect")) return {
5663		status: 202,
5664		data: { redirect: {
5665			redirect: res.headers.get("X-Remix-Redirect"),
5666			status: Number(res.headers.get("X-Remix-Status") || "302"),
5667			revalidate: res.headers.get("X-Remix-Revalidate") === "true",
5668			reload: res.headers.get("X-Remix-Reload-Document") === "true",
5669			replace: res.headers.get("X-Remix-Replace") === "true"
5670		} }
5671	};
5672	if (NO_BODY_STATUS_CODES.has(res.status)) {
5673		let routes = {};
5674		if (targetRoutes && request.method !== "GET") routes[targetRoutes[0]] = { data: void 0 };
5675		return {
5676			status: res.status,
5677			data: { routes }
5678		};
5679	}
5680	invariant2(res.body, "No response body to decode");
5681	try {
5682		let decoded = await decodeViaTurboStream(res.body, window);
5683		let data2;
5684		if (request.method === "GET") {
5685			let typed = decoded.value;
5686			if (SingleFetchRedirectSymbol in typed) data2 = { redirect: typed[SingleFetchRedirectSymbol] };
5687			else data2 = { routes: typed };
5688		} else {
5689			let typed = decoded.value;
5690			let routeId = targetRoutes?.[0];
5691			invariant2(routeId, "No routeId found for single fetch call decoding");
5692			if ("redirect" in typed) data2 = { redirect: typed };
5693			else data2 = { routes: { [routeId]: typed } };
5694		}
5695		return {
5696			status: res.status,
5697			data: data2
5698		};
5699	} catch (e) {
5700		throw new Error("Unable to decode turbo-stream response");
5701	}
5702}
5703function decodeViaTurboStream(body, global) {
5704	return decode(body, { plugins: [(type, ...rest) => {
5705		if (type === "SanitizedError") {
5706			let [name, message, stack] = rest;
5707			let Constructor = Error;
5708			if (name && name in global && typeof global[name] === "function") Constructor = global[name];
5709			let error = new Constructor(message);
5710			error.stack = stack;
5711			return { value: error };
5712		}
5713		if (type === "ErrorResponse") {
5714			let [data2, status, statusText] = rest;
5715			return { value: new ErrorResponseImpl(status, statusText, data2) };
5716		}
5717		if (type === "SingleFetchRedirect") return { value: { [SingleFetchRedirectSymbol]: rest[0] } };
5718		if (type === "SingleFetchClassInstance") return { value: rest[0] };
5719		if (type === "SingleFetchFallback") return { value: void 0 };
5720	}] });
5721}
5722function unwrapSingleFetchResult(result, routeId) {
5723	if ("redirect" in result) {
5724		let { redirect: location, revalidate, reload, replace: replace2, status } = result.redirect;
5725		throw redirect(location, {
5726			status,
5727			headers: {
5728				...revalidate ? { "X-Remix-Revalidate": "yes" } : null,
5729				...reload ? { "X-Remix-Reload-Document": "yes" } : null,
5730				...replace2 ? { "X-Remix-Replace": "yes" } : null
5731			}
5732		});
5733	}
5734	let routeResult = result.routes[routeId];
5735	if (routeResult == null) throw new SingleFetchNoResultError(`No result found for routeId "${routeId}"`);
5736	else if ("error" in routeResult) throw routeResult.error;
5737	else if ("data" in routeResult) return routeResult.data;
5738	else throw new Error(`Invalid response found for routeId "${routeId}"`);
5739}
5740function createDeferred2() {
5741	let resolve;
5742	let reject;
5743	let promise = new Promise((res, rej) => {
5744		resolve = async (val) => {
5745			res(val);
5746			try {
5747				await promise;
5748			} catch (e) {}
5749		};
5750		reject = async (error) => {
5751			rej(error);
5752			try {
5753				await promise;
5754			} catch (e) {}
5755		};
5756	});
5757	return {
5758		promise,
5759		resolve,
5760		reject
5761	};
5762}
5763async function loadRouteModule(route, routeModulesCache) {
5764	if (route.id in routeModulesCache) return routeModulesCache[route.id];
5765	try {
5766		let routeModule = await import(
5767			/* @vite-ignore */
5768			/* webpackIgnore: true */
5769			__vite__injectQuery(route.module, 'import')
5770);
5771		routeModulesCache[route.id] = routeModule;
5772		return routeModule;
5773	} catch (error) {
5774		console.error(`Error loading route module \`${route.module}\`, reloading page...`);
5775		console.error(error);
5776		if (window.__reactRouterContext && window.__reactRouterContext.
vendor: 5,988 bytes, lines 5776-5937
5776isSpaMode && import.meta.hot) throw error;
5777		window.location.reload();
5778		return new Promise(() => {});
5779	}
5780}
5781function getKeyedLinksForMatches(matches, routeModules, manifest) {
5782	return dedupeLinkDescriptors(matches.map((match) => {
5783		let module = routeModules[match.route.id];
5784		let route = manifest.routes[match.route.id];
5785		return [route && route.css ? route.css.map((href) => ({
5786			rel: "stylesheet",
5787			href
5788		})) : [], module?.links?.() || []];
5789	}).flat(2), getModuleLinkHrefs(matches, manifest));
5790}
5791function getRouteCssDescriptors(route) {
5792	if (!route.css) return [];
5793	return route.css.map((href) => ({
5794		rel: "stylesheet",
5795		href
5796	}));
5797}
5798async function prefetchRouteCss(route) {
5799	if (!route.css) return;
5800	let descriptors = getRouteCssDescriptors(route);
5801	await Promise.all(descriptors.map(prefetchStyleLink));
5802}
5803async function prefetchStyleLinks(route, routeModule) {
5804	if (!route.css && !routeModule.links || !isPreloadSupported()) return;
5805	let descriptors = [];
5806	if (route.css) descriptors.push(...getRouteCssDescriptors(route));
5807	if (routeModule.links) descriptors.push(...routeModule.links());
5808	if (descriptors.length === 0) return;
5809	let styleLinks = [];
5810	for (let descriptor of descriptors) if (!isPageLinkDescriptor(descriptor) && descriptor.rel === "stylesheet") styleLinks.push({
5811		...descriptor,
5812		rel: "preload",
5813		as: "style"
5814	});
5815	await Promise.all(styleLinks.map(prefetchStyleLink));
5816}
5817async function prefetchStyleLink(descriptor) {
5818	return new Promise((resolve) => {
5819		if (descriptor.media && !window.matchMedia(descriptor.media).matches || document.querySelector(`link[rel="stylesheet"][href="${descriptor.href}"]`)) return resolve();
5820		let link = document.createElement("link");
5821		Object.assign(link, descriptor);
5822		function removeLink() {
5823			if (document.head.contains(link)) document.head.removeChild(link);
5824		}
5825		link.onload = () => {
5826			removeLink();
5827			resolve();
5828		};
5829		link.onerror = () => {
5830			removeLink();
5831			resolve();
5832		};
5833		document.head.appendChild(link);
5834	});
5835}
5836function isPageLinkDescriptor(object) {
5837	return object != null && typeof object.page === "string";
5838}
5839function isHtmlLinkDescriptor(object) {
5840	if (object == null) return false;
5841	if (object.href == null) return object.rel === "preload" && typeof object.imageSrcSet === "string" && typeof object.imageSizes === "string";
5842	return typeof object.rel === "string" && typeof object.href === "string";
5843}
5844async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
5845	return dedupeLinkDescriptors((await Promise.all(matches.map(async (match) => {
5846		let route = manifest.routes[match.route.id];
5847		if (route) {
5848			let mod = await loadRouteModule(route, routeModules);
5849			return mod.links ? mod.links() : [];
5850		}
5851		return [];
5852	}))).flat(1).filter(isHtmlLinkDescriptor).filter((link) => link.rel === "stylesheet" || link.rel === "preload").map((link) => link.rel === "stylesheet" ? {
5853		...link,
5854		rel: "prefetch",
5855		as: "style"
5856	} : {
5857		...link,
5858		rel: "prefetch"
5859	}));
5860}
5861function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, location, mode) {
5862	let isNew = (match, index) => {
5863		if (!currentMatches[index]) return true;
5864		return match.route.id !== currentMatches[index].route.id;
5865	};
5866	let matchPathChanged = (match, index) => {
5867		return currentMatches[index].pathname !== match.pathname || currentMatches[index].route.path?.endsWith("*") && currentMatches[index].params["*"] !== match.params["*"];
5868	};
5869	if (mode === "assets") return nextMatches.filter((match, index) => isNew(match, index) || matchPathChanged(match, index));
5870	if (mode === "data") return nextMatches.filter((match, index) => {
5871		let manifestRoute = manifest.routes[match.route.id];
5872		if (!manifestRoute || !manifestRoute.hasLoader) return false;
5873		if (isNew(match, index) || matchPathChanged(match, index)) return true;
5874		if (match.route.shouldRevalidate) {
5875			let routeChoice = match.route.shouldRevalidate({
5876				currentUrl: new URL(location.pathname + location.search + location.hash, window.origin),
5877				currentParams: currentMatches[0]?.params || {},
5878				nextUrl: new URL(page, window.origin),
5879				nextParams: match.params,
5880				defaultShouldRevalidate: true
5881			});
5882			if (typeof routeChoice === "boolean") return routeChoice;
5883		}
5884		return true;
5885	});
5886	return [];
5887}
5888function getModuleLinkHrefs(matches, manifest, { includeHydrateFallback } = {}) {
5889	return dedupeHrefs(matches.map((match) => {
5890		let route = manifest.routes[match.route.id];
5891		if (!route) return [];
5892		let hrefs = [route.module];
5893		if (route.clientActionModule) hrefs = hrefs.concat(route.clientActionModule);
5894		if (route.clientLoaderModule) hrefs = hrefs.concat(route.clientLoaderModule);
5895		if (includeHydrateFallback && route.hydrateFallbackModule) hrefs = hrefs.concat(route.hydrateFallbackModule);
5896		if (route.imports) hrefs = hrefs.concat(route.imports);
5897		return hrefs;
5898	}).flat(1));
5899}
5900function dedupeHrefs(hrefs) {
5901	return [...new Set(hrefs)];
5902}
5903function sortKeys(obj) {
5904	let sorted = {};
5905	let keys = Object.keys(obj).sort();
5906	for (let key of keys) sorted[key] = obj[key];
5907	return sorted;
5908}
5909function dedupeLinkDescriptors(descriptors, preloads) {
5910	let set = /* @__PURE__ */ new Set();
5911	let preloadsSet = new Set(preloads);
5912	return descriptors.reduce((deduped, descriptor) => {
5913		if (preloads && !isPageLinkDescriptor(descriptor) && descriptor.as === "script" && descriptor.href && preloadsSet.has(descriptor.href)) return deduped;
5914		let key = JSON.stringify(sortKeys(descriptor));
5915		if (!set.has(key)) {
5916			set.add(key);
5917			deduped.push({
5918				key,
5919				link: descriptor
5920			});
5921		}
5922		return deduped;
5923	}, []);
5924}
5925var _isPreloadSupported;
5926function isPreloadSupported() {
5927	if (_isPreloadSupported !== void 0) return _isPreloadSupported;
5928	let el = document.createElement("link");
5929	_isPreloadSupported = el.relList.supports("preload");
5930	el = null;
5931	return _isPreloadSupported;
5932}
5933function RemixRootDefaultHydrateFallback() {
5934	return /* @__PURE__ */ import_react.createElement(BoundaryShell, {
5935		title: "Loading...",
5936		renderScripts: true
5937	}
vendor: 11,608 bytes, lines 5937-6185
5937, /* @__PURE__ */ import_react.createElement("script", { dangerouslySetInnerHTML: { __html: `
5938              console.log(
5939                "\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this " +
5940                "when your app is loading JS modules and/or running \`clientLoader\` " +
5941                "functions. Check out https://reactrouter.com/start/framework/route-module#hydratefallback " +
5942                "for more information."
5943              );
5944            ` } }));
5945}
5946function groupRoutesByParentId$1(manifest) {
5947	let routes = {};
5948	Object.values(manifest).forEach((route) => {
5949		if (route) {
5950			let parentId = route.parentId || "";
5951			if (!routes[parentId]) routes[parentId] = [];
5952			routes[parentId].push(route);
5953		}
5954	});
5955	return routes;
5956}
5957function getRouteComponents(route, routeModule, isSpaMode) {
5958	let Component4 = getRouteModuleComponent(routeModule);
5959	let HydrateFallback = routeModule.HydrateFallback && (!isSpaMode || route.id === "root") ? routeModule.HydrateFallback : route.id === "root" ? RemixRootDefaultHydrateFallback : void 0;
5960	let ErrorBoundary = routeModule.ErrorBoundary ? routeModule.ErrorBoundary : route.id === "root" ? () => /* @__PURE__ */ import_react.createElement(RemixRootDefaultErrorBoundary, { error: useRouteError() }) : void 0;
5961	if (route.id === "root" && routeModule.Layout) return {
5962		...Component4 ? { element: /* @__PURE__ */ import_react.createElement(routeModule.Layout, null, /* @__PURE__ */ import_react.createElement(Component4, null)) } : { Component: Component4 },
5963		...ErrorBoundary ? { errorElement: /* @__PURE__ */ import_react.createElement(routeModule.Layout, null, /* @__PURE__ */ import_react.createElement(ErrorBoundary, null)) } : { ErrorBoundary },
5964		...HydrateFallback ? { hydrateFallbackElement: /* @__PURE__ */ import_react.createElement(routeModule.Layout, null, /* @__PURE__ */ import_react.createElement(HydrateFallback, null)) } : { HydrateFallback }
5965	};
5966	return {
5967		Component: Component4,
5968		ErrorBoundary,
5969		HydrateFallback
5970	};
5971}
5972function createServerRoutes(manifest, routeModules, future, isSpaMode, parentId = "", routesByParentId = groupRoutesByParentId$1(manifest), spaModeLazyPromise = Promise.resolve({ Component: () => null })) {
5973	return (routesByParentId[parentId] || []).map((route) => {
5974		let routeModule = routeModules[route.id];
5975		invariant2(routeModule, "No `routeModule` available to create server routes");
5976		let dataRoute = {
5977			...getRouteComponents(route, routeModule, isSpaMode),
5978			caseSensitive: route.caseSensitive,
5979			id: route.id,
5980			index: route.index,
5981			path: route.path,
5982			handle: routeModule.handle,
5983			lazy: isSpaMode ? () => spaModeLazyPromise : void 0,
5984			loader: route.hasLoader || route.hasClientLoader ? () => null : void 0
5985		};
5986		let children = createServerRoutes(manifest, routeModules, future, isSpaMode, route.id, routesByParentId, spaModeLazyPromise);
5987		if (children.length > 0) dataRoute.children = children;
5988		return dataRoute;
5989	});
5990}
5991function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState, ssr, isSpaMode) {
5992	return createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSpaMode, "", groupRoutesByParentId$1(manifest), needsRevalidation);
5993}
5994function preventInvalidServerHandlerCall(type, route) {
5995	if (type === "loader" && !route.hasLoader || type === "action" && !route.hasAction) {
5996		let msg = `You are trying to call ${type === "action" ? "serverAction()" : "serverLoader()"} on a route that does not have a server ${type} (routeId: "${route.id}")`;
5997		console.error(msg);
5998		throw new ErrorResponseImpl(400, "Bad Request", new Error(msg), true);
5999	}
6000}
6001function noActionDefinedError(type, routeId) {
6002	let article = type === "clientAction" ? "a" : "an";
6003	let msg = `Route "${routeId}" does not have ${article} ${type}, but you are trying to submit to it. To fix this, please add ${article} \`${type}\` function to the route`;
6004	console.error(msg);
6005	throw new ErrorResponseImpl(405, "Method Not Allowed", new Error(msg), true);
6006}
6007function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSpaMode, parentId = "", routesByParentId = groupRoutesByParentId$1(manifest), needsRevalidation) {
6008	return (routesByParentId[parentId] || []).map((route) => {
6009		let routeModule = routeModulesCache[route.id];
6010		function fetchServerHandler(singleFetch) {
6011			invariant2(typeof singleFetch === "function", "No single fetch function available for route handler");
6012			return singleFetch();
6013		}
6014		function fetchServerLoader(singleFetch) {
6015			if (!route.hasLoader) return Promise.resolve(null);
6016			return fetchServerHandler(singleFetch);
6017		}
6018		function fetchServerAction(singleFetch) {
6019			if (!route.hasAction) throw noActionDefinedError("action", route.id);
6020			return fetchServerHandler(singleFetch);
6021		}
6022		function prefetchModule(modulePath) {
6023			import(
6024				/* @vite-ignore */
6025				/* webpackIgnore: true */
6026				__vite__injectQuery(modulePath, 'import')
6027);
6028		}
6029		function prefetchRouteModuleChunks(route2) {
6030			if (route2.clientActionModule) prefetchModule(route2.clientActionModule);
6031			if (route2.clientLoaderModule) prefetchModule(route2.clientLoaderModule);
6032		}
6033		async function prefetchStylesAndCallHandler(handler) {
6034			let cachedModule = routeModulesCache[route.id];
6035			let linkPrefetchPromise = cachedModule ? prefetchStyleLinks(route, cachedModule) : Promise.resolve();
6036			try {
6037				return handler();
6038			} finally {
6039				await linkPrefetchPromise;
6040			}
6041		}
6042		let dataRoute = {
6043			id: route.id,
6044			index: route.index,
6045			path: route.path
6046		};
6047		if (routeModule) {
6048			Object.assign(dataRoute, {
6049				...dataRoute,
6050				...getRouteComponents(route, routeModule, isSpaMode),
6051				middleware: routeModule.clientMiddleware,
6052				handle: routeModule.handle,
6053				shouldRevalidate: getShouldRevalidateFunction(dataRoute.path, routeModule, route, ssr, needsRevalidation)
6054			});
6055			let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
6056			let initialData = hasInitialData ? initialState?.loaderData?.[route.id] : void 0;
6057			let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
6058			let initialError = hasInitialError ? initialState?.errors?.[route.id] : void 0;
6059			let isHydrationRequest = needsRevalidation == null && (routeModule.clientLoader?.hydrate === true || !route.hasLoader);
6060			dataRoute.loader = async ({ request, params, context, unstable_pattern, unstable_url }, singleFetch) => {
6061				try {
6062					return await prefetchStylesAndCallHandler(async () => {
6063						invariant2(routeModule, "No `routeModule` available for critical-route loader");
6064						if (!routeModule.clientLoader) return fetchServerLoader(singleFetch);
6065						return routeModule.clientLoader({
6066							request,
6067							params,
6068							context,
6069							unstable_pattern,
6070							unstable_url,
6071							async serverLoader() {
6072								preventInvalidServerHandlerCall("loader", route);
6073								if (isHydrationRequest) {
6074									if (hasInitialData) return initialData;
6075									if (hasInitialError) throw initialError;
6076								}
6077								return fetchServerLoader(singleFetch);
6078							}
6079						});
6080					});
6081				} finally {
6082					isHydrationRequest = false;
6083				}
6084			};
6085			dataRoute.loader.hydrate = shouldHydrateRouteLoader(route.id, routeModule.clientLoader, route.hasLoader, isSpaMode);
6086			dataRoute.action = ({ request, params, context, unstable_pattern, unstable_url }, singleFetch) => {
6087				return prefetchStylesAndCallHandler(async () => {
6088					invariant2(routeModule, "No `routeModule` available for critical-route action");
6089					if (!routeModule.clientAction) {
6090						if (isSpaMode) throw noActionDefinedError("clientAction", route.id);
6091						return fetchServerAction(singleFetch);
6092					}
6093					return routeModule.clientAction({
6094						request,
6095						params,
6096						context,
6097						unstable_pattern,
6098						unstable_url,
6099						async serverAction() {
6100							preventInvalidServerHandlerCall("action", route);
6101							return fetchServerAction(singleFetch);
6102						}
6103					});
6104				});
6105			};
6106		} else {
6107			if (!route.hasClientLoader) dataRoute.loader = (_, singleFetch) => prefetchStylesAndCallHandler(() => {
6108				return fetchServerLoader(singleFetch);
6109			});
6110			if (!route.hasClientAction) dataRoute.action = (_, singleFetch) => prefetchStylesAndCallHandler(() => {
6111				if (isSpaMode) throw noActionDefinedError("clientAction", route.id);
6112				return fetchServerAction(singleFetch);
6113			});
6114			let lazyRoutePromise;
6115			async function getLazyRoute() {
6116				if (lazyRoutePromise) return await lazyRoutePromise;
6117				lazyRoutePromise = (async () => {
6118					if (route.clientLoaderModule || route.clientActionModule) await new Promise((resolve) => setTimeout(resolve, 0));
6119					let routeModulePromise = loadRouteModuleWithBlockingLinks(route, routeModulesCache);
6120					prefetchRouteModuleChunks(route);
6121					return await routeModulePromise;
6122				})();
6123				return await lazyRoutePromise;
6124			}
6125			dataRoute.lazy = {
6126				loader: route.hasClientLoader ? async () => {
6127					let { clientLoader } = route.clientLoaderModule ? await import(
6128						/* @vite-ignore */
6129						/* webpackIgnore: true */
6130						__vite__injectQuery(route.clientLoaderModule, 'import')
6131) : await getLazyRoute();
6132					invariant2(clientLoader, "No `clientLoader` export found");
6133					return (args, singleFetch) => clientLoader({
6134						...args,
6135						async serverLoader() {
6136							preventInvalidServerHandlerCall("loader", route);
6137							return fetchServerLoader(singleFetch);
6138						}
6139					});
6140				} : void 0,
6141				action: route.hasClientAction ? async () => {
6142					let clientActionPromise = route.clientActionModule ? import(
6143						/* @vite-ignore */
6144						/* webpackIgnore: true */
6145						__vite__injectQuery(route.clientActionModule, 'import')
6146) : getLazyRoute();
6147					prefetchRouteModuleChunks(route);
6148					let { clientAction } = await clientActionPromise;
6149					invariant2(clientAction, "No `clientAction` export found");
6150					return (args, singleFetch) => clientAction({
6151						...args,
6152						async serverAction() {
6153							preventInvalidServerHandlerCall("action", route);
6154							return fetchServerAction(singleFetch);
6155						}
6156					});
6157				} : void 0,
6158				middleware: route.hasClientMiddleware ? async () => {
6159					let { clientMiddleware } = route.clientMiddlewareModule ? await import(
6160						/* @vite-ignore */
6161						/* webpackIgnore: true */
6162						__vite__injectQuery(route.clientMiddlewareModule, 'import')
6163) : await getLazyRoute();
6164					invariant2(clientMiddleware, "No `clientMiddleware` export found");
6165					return clientMiddleware;
6166				} : void 0,
6167				shouldRevalidate: async () => {
6168					let lazyRoute = await getLazyRoute();
6169					return getShouldRevalidateFunction(dataRoute.path, lazyRoute, route, ssr, needsRevalidation);
6170				},
6171				handle: async () => (await getLazyRoute()).handle,
6172				Component: async () => (await getLazyRoute()).Component,
6173				ErrorBoundary: route.hasErrorBoundary ? async () => (await getLazyRoute()).ErrorBoundary : void 0
6174			};
6175		}
6176		let children = createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSpaMode, route.id, routesByParentId, needsRevalidation);
6177		if (children.length > 0) dataRoute.children = children;
6178		return dataRoute;
6179	});
6180}
6181function getShouldRevalidateFunction(path, route, manifestRoute, ssr, needsRevalidation) {
6182	if (needsRevalidation) return wrapShouldRevalidateForHdr(manifestRoute.id, route.shouldRevalidate, needsRevalidation);
6183	if (!ssr && manifestRoute.hasLoader && !manifestRoute.hasClientLoader) {
6184		let myParams = path ? compilePath(path)[1].map((p) => p.paramName) : [];
6185		const didParamsChange = (opts) => myParams.some((p) =>
6185 opts.currentParams[p] !== opts.nextParams[p]);
6186		if (route.shouldRevalidate) {
6187			let fn = route.shouldRevalidate;
6188			return (opts) => fn({
6189				...opts,
6190				defaultShouldRevalidate: didParamsChange(opts)
6191			});
6192		} else return (opts) => didParamsChange(opts);
6193	}
6194	return route.shouldRevalidate;
6195}
6196function wrapShouldRevalidateForHdr(routeId, routeShouldRevalidate, needsRevalidation) {
6197	let handledRevalidation = false;
6198	return (arg) => {
6199		if (!handledRevalidation) {
6200			handledRevalidation = true;
6201			return needsRevalidation.has(routeId);
6202		}
6203		return routeShouldRevalidate ? routeShouldRevalidate(arg) : arg.defaultShouldRevalidate;
6204	};
6205}
6206async function loadRouteModuleWithBlockingLinks(route, routeModules) {
6207	let routeModulePromise = loadRouteModule(route, routeModules);
6208	let prefetchRouteCssPromise = prefetchRouteCss(route);
6209	let routeModule = await routeModulePromise;
6210	await Promise.all([prefetchRouteCssPromise, prefetchStyleLinks(route, routeModule)]);
6211	return {
6212		Component: getRouteModuleComponent(routeModule),
6213		ErrorBoundary: routeModule.ErrorBoundary,
6214		clientMiddleware: routeModule.clientMiddleware,
6215		clientAction: routeModule.clientAction,
6216		clientLoader: routeModule.clientLoader,
6217		handle: routeModule.handle,
6218		links: routeModule.links,
6219		meta: routeModule.meta,
6220		shouldRevalidate: routeModule.shouldRevalidate
6221	};
6222}
6223function getRouteModuleComponent(routeModule) {
6224	if (routeModule.default == null) return void 0;
6225	if (!(typeof routeModule.default === "object" && Object.keys(routeModule.default).length === 0)) return routeModule.default;
6226}
6227function shouldHydrateRouteLoader(routeId, clientLoader, hasLoader, isSpaMode) {
6228	return isSpaMode && routeId !== "root" || clientLoader != null && (clientLoader.hydrate === true || hasLoader !== true);
6229}
6230var nextPaths = /* @__PURE__ */ new Set();
6231var discoveredPathsMaxSize = 1e3;
6232var discoveredPaths = /* @__PURE__ */ new Set();
6233var URL_LIMIT = 7680;
6234function isFogOfWarEnabled(routeDiscovery, ssr) {
6235	return routeDiscovery.mode === "lazy" && ssr === true;
6236}
6237function getPartialManifest({ sri, ...manifest }, router) {
6238	let routeIds = new Set(router.state.matches.map((m) => m.route.id));
6239	let segments = router.state.location.pathname.split("/").filter(Boolean);
6240	let paths = ["/"];
6241	segments.pop();
6242	while (segments.length > 0) {
6243		paths.push(`/${segments.join("/")}`);
6244		segments.pop();
6245	}
6246	paths.forEach((path) => {
6247		let matches = matchRoutes(router.routes, path, router.basename);
6248		if (matches) matches.forEach((m) => routeIds.add(m.route.id));
6249	});
6250	let initialRoutes = [...routeIds].reduce((acc, id) => Object.assign(acc, { [id]: manifest.routes[id] }), {});
6251	return {
6252		...manifest,
6253		routes: initialRoutes,
6254		sri: sri ? true : void 0
6255	};
6256}
6257function getPatchRoutesOnNavigationFunction(getRouter, manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename) {
6258	if (!isFogOfWarEnabled(routeDiscovery, ssr)) return;
6259	return async ({ path, patch, signal, fetcherKey }) => {
6260		if (discoveredPaths.has(path)) return;
6261		let { state } = getRouter();
6262		await fetchAndApplyManifestPatches([path], fetcherKey ? window.location.href : createPath(state.navigation.location || state.location), manifest, routeModules, ssr, isSpaMode, basename, routeDiscovery.manifestPath, patch, signal);
6263	};
6264}
6265function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
6266	import_react.useEffect(() => {
6267		if (!isFogOfWarEnabled(routeDiscovery, ssr) || window.navigator?.connection?.saveData === true) return;
6268		function registerElement(el) {
6269			let path = el.tagName === "FORM" ? el.getAttribute("action") : el.getAttribute("href");
6270			if (!path) return;
6271			let pathname = el.tagName === "A" ? el.pathname : new URL(path, window.location.origin).pathname;
6272			if (!discoveredPaths.has(pathname)) nextPaths.add(pathname);
6273		}
6274		async function fetchPatches() {
6275			document.querySelectorAll("a[data-discover], form[data-discover]").forEach(registerElement);
6276			let lazyPaths = Array.from(nextPaths.keys()).filter((path) => {
6277				if (discoveredPaths.has(path)) {
6278					nextPaths.delete(path);
6279					return false;
6280				}
6281				return true;
6282			});
6283			if (lazyPaths.length === 0) return;
6284			try {
6285				await fetchAndApplyManifestPatches(lazyPaths, null, manifest, routeModules, ssr, isSpaMode, router.basename, routeDiscovery.manifestPath, router.patchRoutes);
6286			} catch (e) {
6287				console.error("Failed to fetch manifest patches", e);
6288			}
6289		}
6290		let debouncedFetchPatches = debounce(fetchPatches, 100);
6291		fetchPatches();
6292		let observer = new MutationObserver(() => debouncedFetchPatches());
6293		observer.observe(document.documentElement, {
6294			subtree: true,
6295			childList: true,
6296			attributes: true,
6297			attributeFilter: [
6298				"data-discover",
6299				"href",
6300				"action"
6301			]
6302		});
6303		return () => observer.disconnect();
6304	}, [
6305		ssr,
6306		isSpaMode,
6307		manifest,
6308		routeModules,
6309		router,
6310		routeDiscovery
6311	]);
6312}
6313function getManifestPath(_manifestPath, basename) {
6314	let manifestPath = _manifestPath || "/__manifest";
6315	if (basename == null) return manifestPath;
6316	return `${basename}${manifestPath}`.replace(/\/+/g, "/");
6317}
6318var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
6319async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, manifestPath, patchRoutes, signal) {
6320	const searchParams = new URLSearchParams();
6321	searchParams.set("paths", paths.sort().join(","));
6322	searchParams.set("version", manifest.version);
6323	let url = new URL(getManifestPath(manifestPath, basename), window.location.origin);
6324	url.search = searchParams.toString();
6325	if (url.toString().length > URL_LIMIT) {
6326		nextPaths.clear();
6327		return;
6328	}
6329	let serverPatches;
6330	try {
6331		let res = await fetch(url, { signal });
6332		if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
6333		else if (res.status === 204 && res.headers.has("X-Remix-Reload-Document")) {
6334			if (!errorReloadPath) {
6335				console.warn("Detected a manifest version mismatch during eager route discovery. The next navigation/fetch to an undiscovered route will result in a new document navigation to sync up with the latest manifest.");
6336				return;
6337			}
6338			try {
6339				if (sessionStorage.getItem(MANIFEST_VERSION_STORAGE_KEY) === manifest.version) {
6340					console.error("Unable to discover routes due to manifest version mismatch.");
6341					return;
6342				}
6343				sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
6344			} catch {}
6345			window.location.href = errorReloadPath;
6346			console.warn("Detected manifest version mismatch, reloading...");
6347			await new Promise(() => {});
6348		} else if (res.status >= 400) throw new Error(await res.text());
6349		try {
6350			sessionStorage.removeItem(MANIFEST_VERSION_STORAGE_KEY);
6351		} catch {}
6352		serverPatches = await res.json();
6353	} catch (e) {
6354		if (signal?.aborted) return;
6355		throw e;
6356	}
6357	let knownRoutes = new Set(Object.keys(manifest.routes));
6358	let patches = Object.values(serverPatches).reduce((acc, route) => {
6359		if (route && !knownRoutes.has(route.id)) acc[route.id] = route;
6360		return acc;
6361	}, {});
6362	Object.assign(manifest.routes, patches);
6363	paths.forEach((p) => addToFifoQueue(p, discoveredPaths));
6364	let parentIds = /* @__PURE__ */ new Set();
6365	Object.values(patches).forEach((patch) => {
6366		if (patch && (!patch.parentId || !patches[patch.parentId])) parentIds.add(patch.parentId);
6367	});
6368	parentIds.forEach((parentId) => patchRoutes(parentId || null, createClientRoutes(patches, routeModules, null, ssr, isSpaMode, parentId)));
6369}
6370function addToFifoQueue(path, queue) {
6371	if (queue.size >= discoveredPathsMaxSize) {
6372		let first = queue.values().next().value;
6373		queue.delete(first);
6374	}
6375	queue.add(path);
6376}
6377function debounce(callback, wait) {
6378	let timeoutId;
6379	return (...args) => {
6380		window.clearTimeout(timeoutId);
6381		timeoutId = window.setTimeout(() => callback(...args), wait);
6382	};
6383}
6384function useDataRouterContext2() {
6385	let context = import_react.useContext(DataRouterContext);
6386	invariant2(context, "You must render this element inside a <DataRouterContext.Provider> element");
6387	return context;
6388}
6389function useDataRouterStateContext() {
6390	let context = import_react.useContext(DataRouterStateContext);
6391	invariant2(context, "You must render this element inside a <DataRouterStateContext.Provider> element");
6392	return context;
6393}
6394var FrameworkContext = import_react.createContext(void 0);
6395FrameworkContext.displayName = "FrameworkContext";
6396function useFrameworkContext() {
6397	let context = import_react.useContext(FrameworkContext);
6398	invariant2(context, "You must render this element inside a <HydratedRouter> element");
6399	return context;
6400}
6401function usePrefetchBehavior(prefetch, theirElementProps) {
6402	let frameworkContext = import_react.useContext(FrameworkContext);
6403	let [maybePrefetch, setMaybePrefetch] = import_react.useState(false);
6404	let [shouldPrefetch, setShouldPrefetch] = import_react.useState(false);
6405	let { onFocus, onBlur, onMouseEnter, onMouseLeave, onTouchStart } = theirElementProps;
6406	let ref = import_react.useRef(null);
6407	import_react.useEffect(() => {
6408		if (prefetch === "render") setShouldPrefetch(true);
6409		if (prefetch === "viewport") {
6410			let callback = (entries) => {
vendor: 13,227 bytes, lines 6411-6759
6411				entries.forEach((entry) => {
6412					setShouldPrefetch(entry.isIntersecting);
6413				});
6414			};
6415			let observer = new IntersectionObserver(callback, { threshold: .5 });
6416			if (ref.current) observer.observe(ref.current);
6417			return () => {
6418				observer.disconnect();
6419			};
6420		}
6421	}, [prefetch]);
6422	import_react.useEffect(() => {
6423		if (maybePrefetch) {
6424			let id = setTimeout(() => {
6425				setShouldPrefetch(true);
6426			}, 100);
6427			return () => {
6428				clearTimeout(id);
6429			};
6430		}
6431	}, [maybePrefetch]);
6432	let setIntent = () => {
6433		setMaybePrefetch(true);
6434	};
6435	let cancelIntent = () => {
6436		setMaybePrefetch(false);
6437		setShouldPrefetch(false);
6438	};
6439	if (!frameworkContext) return [
6440		false,
6441		ref,
6442		{}
6443	];
6444	if (prefetch !== "intent") return [
6445		shouldPrefetch,
6446		ref,
6447		{}
6448	];
6449	return [
6450		shouldPrefetch,
6451		ref,
6452		{
6453			onFocus: composeEventHandlers(onFocus, setIntent),
6454			onBlur: composeEventHandlers(onBlur, cancelIntent),
6455			onMouseEnter: composeEventHandlers(onMouseEnter, setIntent),
6456			onMouseLeave: composeEventHandlers(onMouseLeave, cancelIntent),
6457			onTouchStart: composeEventHandlers(onTouchStart, setIntent)
6458		}
6459	];
6460}
6461function composeEventHandlers(theirHandler, ourHandler) {
6462	return (event) => {
6463		theirHandler && theirHandler(event);
6464		if (!event.defaultPrevented) ourHandler(event);
6465	};
6466}
6467function getActiveMatches(matches, errors, isSpaMode) {
6468	if (isSpaMode && !isHydrated) return [matches[0]];
6469	if (errors) {
6470		let errorIdx = matches.findIndex((m) => errors[m.route.id] !== void 0);
6471		return matches.slice(0, errorIdx + 1);
6472	}
6473	return matches;
6474}
6475var CRITICAL_CSS_DATA_ATTRIBUTE = "data-react-router-critical-css";
6476function Links({ nonce, crossOrigin }) {
6477	let { isSpaMode, manifest, routeModules, criticalCss } = useFrameworkContext();
6478	let { errors, matches: routerMatches } = useDataRouterStateContext();
6479	let matches = getActiveMatches(routerMatches, errors, isSpaMode);
6480	let keyedLinks = import_react.useMemo(() => getKeyedLinksForMatches(matches, routeModules, manifest), [
6481		matches,
6482		routeModules,
6483		manifest
6484	]);
6485	return /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, typeof criticalCss === "string" ? /* @__PURE__ */ import_react.createElement("style", {
6486		[CRITICAL_CSS_DATA_ATTRIBUTE]: "",
6487		nonce,
6488		dangerouslySetInnerHTML: { __html: criticalCss }
6489	}) : null, typeof criticalCss === "object" ? /* @__PURE__ */ import_react.createElement("link", {
6490		[CRITICAL_CSS_DATA_ATTRIBUTE]: "",
6491		rel: "stylesheet",
6492		href: criticalCss.href,
6493		nonce,
6494		crossOrigin
6495	}) : null, keyedLinks.map(({ key, link }) => isPageLinkDescriptor(link) ? /* @__PURE__ */ import_react.createElement(PrefetchPageLinks, {
6496		key,
6497		nonce,
6498		...link,
6499		crossOrigin: link.crossOrigin ?? crossOrigin
6500	}) : /* @__PURE__ */ import_react.createElement("link", {
6501		key,
6502		nonce,
6503		...link,
6504		crossOrigin: link.crossOrigin ?? crossOrigin
6505	})));
6506}
6507function PrefetchPageLinks({ page, ...linkProps }) {
6508	let { router } = useDataRouterContext2();
6509	let matches = import_react.useMemo(() => matchRoutes(router.routes, page, router.basename), [
6510		router.routes,
6511		page,
6512		router.basename
6513	]);
6514	if (!matches) return null;
6515	return /* @__PURE__ */ import_react.createElement(PrefetchPageLinksImpl, {
6516		page,
6517		matches,
6518		...linkProps
6519	});
6520}
6521function useKeyedPrefetchLinks(matches) {
6522	let { manifest, routeModules } = useFrameworkContext();
6523	let [keyedPrefetchLinks, setKeyedPrefetchLinks] = import_react.useState([]);
6524	import_react.useEffect(() => {
6525		let interrupted = false;
6526		getKeyedPrefetchLinks(matches, manifest, routeModules).then((links) => {
6527			if (!interrupted) setKeyedPrefetchLinks(links);
6528		});
6529		return () => {
6530			interrupted = true;
6531		};
6532	}, [
6533		matches,
6534		manifest,
6535		routeModules
6536	]);
6537	return keyedPrefetchLinks;
6538}
6539function PrefetchPageLinksImpl({ page, matches: nextMatches, ...linkProps }) {
6540	let location = useLocation();
6541	let { future, manifest, routeModules } = useFrameworkContext();
6542	let { basename } = useDataRouterContext2();
6543	let { loaderData, matches } = useDataRouterStateContext();
6544	let newMatchesForData = import_react.useMemo(() => getNewMatchesForLinks(page, nextMatches, matches, manifest, location, "data"), [
6545		page,
6546		nextMatches,
6547		matches,
6548		manifest,
6549		location
6550	]);
6551	let newMatchesForAssets = import_react.useMemo(() => getNewMatchesForLinks(page, nextMatches, matches, manifest, location, "assets"), [
6552		page,
6553		nextMatches,
6554		matches,
6555		manifest,
6556		location
6557	]);
6558	let dataHrefs = import_react.useMemo(() => {
6559		if (page === location.pathname + location.search + location.hash) return [];
6560		let routesParams = /* @__PURE__ */ new Set();
6561		let foundOptOutRoute = false;
6562		nextMatches.forEach((m) => {
6563			let manifestRoute = manifest.routes[m.route.id];
6564			if (!manifestRoute || !manifestRoute.hasLoader) return;
6565			if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && routeModules[m.route.id]?.shouldRevalidate) foundOptOutRoute = true;
6566			else if (manifestRoute.hasClientLoader) foundOptOutRoute = true;
6567			else routesParams.add(m.route.id);
6568		});
6569		if (routesParams.size === 0) return [];
6570		let url = singleFetchUrl(page, basename, future.unstable_trailingSlashAwareDataRequests, "data");
6571		if (foundOptOutRoute && routesParams.size > 0) url.searchParams.set("_routes", nextMatches.filter((m) => routesParams.has(m.route.id)).map((m) => m.route.id).join(","));
6572		return [url.pathname + url.search];
6573	}, [
6574		basename,
6575		future.unstable_trailingSlashAwareDataRequests,
6576		loaderData,
6577		location,
6578		manifest,
6579		newMatchesForData,
6580		nextMatches,
6581		page,
6582		routeModules
6583	]);
6584	let moduleHrefs = import_react.useMemo(() => getModuleLinkHrefs(newMatchesForAssets, manifest), [newMatchesForAssets, manifest]);
6585	let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
6586	return /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ import_react.createElement("link", {
6587		key: href,
6588		rel: "prefetch",
6589		as: "fetch",
6590		href,
6591		...linkProps
6592	})), moduleHrefs.map((href) => /* @__PURE__ */ import_react.createElement("link", {
6593		key: href,
6594		rel: "modulepreload",
6595		href,
6596		...linkProps
6597	})), keyedPrefetchLinks.map(({ key, link }) => /* @__PURE__ */ import_react.createElement("link", {
6598		key,
6599		nonce: linkProps.nonce,
6600		...link,
6601		crossOrigin: link.crossOrigin ?? linkProps.crossOrigin
6602	})));
6603}
6604function Meta() {
6605	let { isSpaMode, routeModules } = useFrameworkContext();
6606	let { errors, matches: routerMatches, loaderData } = useDataRouterStateContext();
6607	let location = useLocation();
6608	let _matches = getActiveMatches(routerMatches, errors, isSpaMode);
6609	let error = null;
6610	if (errors) error = errors[_matches[_matches.length - 1].route.id];
6611	let meta = [];
6612	let leafMeta = null;
6613	let matches = [];
6614	for (let i = 0; i < _matches.length; i++) {
6615		let _match = _matches[i];
6616		let routeId = _match.route.id;
6617		let data2 = loaderData[routeId];
6618		let params = _match.params;
6619		let routeModule = routeModules[routeId];
6620		let routeMeta = [];
6621		let match = {
6622			id: routeId,
6623			data: data2,
6624			loaderData: data2,
6625			meta: [],
6626			params: _match.params,
6627			pathname: _match.pathname,
6628			handle: _match.route.handle,
6629			error
6630		};
6631		matches[i] = match;
6632		if (routeModule?.meta) routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
6633			data: data2,
6634			loaderData: data2,
6635			params,
6636			location,
6637			matches,
6638			error
6639		}) : Array.isArray(routeModule.meta) ? [...routeModule.meta] : routeModule.meta;
6640		else if (leafMeta) routeMeta = [...leafMeta];
6641		routeMeta = routeMeta || [];
6642		if (!Array.isArray(routeMeta)) throw new Error("The route at " + _match.route.path + " returns an invalid value. All route meta functions must return an array of meta objects.\n\nTo reference the meta function API, see https://reactrouter.com/start/framework/route-module#meta");
6643		match.meta = routeMeta;
6644		matches[i] = match;
6645		meta = [...routeMeta];
6646		leafMeta = meta;
6647	}
6648	return /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, meta.flat().map((metaProps) => {
6649		if (!metaProps) return null;
6650		if ("tagName" in metaProps) {
6651			let { tagName, ...rest } = metaProps;
6652			if (!isValidMetaTag(tagName)) {
6653				console.warn(`A meta object uses an invalid tagName: ${tagName}. Expected either 'link' or 'meta'`);
6654				return null;
6655			}
6656			let Comp = tagName;
6657			return /* @__PURE__ */ import_react.createElement(Comp, {
6658				key: JSON.stringify(rest),
6659				...rest
6660			});
6661		}
6662		if ("title" in metaProps) return /* @__PURE__ */ import_react.createElement("title", { key: "title" }, String(metaProps.title));
6663		if ("charset" in metaProps) {
6664			metaProps.charSet ?? (metaProps.charSet = metaProps.charset);
6665			delete metaProps.charset;
6666		}
6667		if ("charSet" in metaProps && metaProps.charSet != null) return typeof metaProps.charSet === "string" ? /* @__PURE__ */ import_react.createElement("meta", {
6668			key: "charSet",
6669			charSet: metaProps.charSet
6670		}) : null;
6671		if ("script:ld+json" in metaProps) try {
6672			let json = JSON.stringify(metaProps["script:ld+json"]);
6673			return /* @__PURE__ */ import_react.createElement("script", {
6674				key: `script:ld+json:${json}`,
6675				type: "application/ld+json",
6676				dangerouslySetInnerHTML: { __html: escapeHtml(json) }
6677			});
6678		} catch (err) {
6679			return null;
6680		}
6681		return /* @__PURE__ */ import_react.createElement("meta", {
6682			key: JSON.stringify(metaProps),
6683			...metaProps
6684		});
6685	}));
6686}
6687function isValidMetaTag(tagName) {
6688	return typeof tagName === "string" && /^(meta|link)$/.test(tagName);
6689}
6690var isHydrated = false;
6691function setIsHydrated() {
6692	isHydrated = true;
6693}
6694function Scripts(scriptProps) {
6695	let { manifest, serverHandoffString, isSpaMode, renderMeta, routeDiscovery, ssr } = useFrameworkContext();
6696	let { router, static: isStatic, staticContext } = useDataRouterContext2();
6697	let { matches: routerMatches } = useDataRouterStateContext();
6698	let isRSCRouterContext = useIsRSCRouterContext();
6699	let enableFogOfWar = isFogOfWarEnabled(routeDiscovery, ssr);
6700	if (renderMeta) renderMeta.didRenderScripts = true;
6701	let matches = getActiveMatches(routerMatches, null, isSpaMode);
6702	import_react.useEffect(() => {
6703		setIsHydrated();
6704	}, []);
6705	let initialScripts = import_react.useMemo(() => {
6706		if (isRSCRouterContext) return null;
6707		let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());` : " ";
6708		let routeModulesScript = !isStatic ? " " : `${manifest.hmr?.runtime ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
6709${matches.map((match, routeIndex) => {
6710			let routeVarName = `route${routeIndex}`;
6711			let manifestEntry = manifest.routes[match.route.id];
6712			invariant2(manifestEntry, `Route ${match.route.id} not found in manifest`);
6713			let { clientActionModule, clientLoaderModule, clientMiddlewareModule, hydrateFallbackModule, module } = manifestEntry;
6714			let chunks = [
6715				...clientActionModule ? [{
6716					module: clientActionModule,
6717					varName: `${routeVarName}_clientAction`
6718				}] : [],
6719				...clientLoaderModule ? [{
6720					module: clientLoaderModule,
6721					varName: `${routeVarName}_clientLoader`
6722				}] : [],
6723				...clientMiddlewareModule ? [{
6724					module: clientMiddlewareModule,
6725					varName: `${routeVarName}_clientMiddleware`
6726				}] : [],
6727				...hydrateFallbackModule ? [{
6728					module: hydrateFallbackModule,
6729					varName: `${routeVarName}_HydrateFallback`
6730				}] : [],
6731				{
6732					module,
6733					varName: `${routeVarName}_main`
6734				}
6735			];
6736			if (chunks.length === 1) return `import * as ${routeVarName} from ${JSON.stringify(module)};`;
6737			return [chunks.map((chunk) => `import * as ${chunk.varName} from "${chunk.module}";`).join("\n"), `const ${routeVarName} = {${chunks.map((chunk) => `...${chunk.varName}`).join(",")}};`].join("\n");
6738		}).join("\n")}
6739  ${enableFogOfWar ? `window.__reactRouterManifest = ${JSON.stringify(getPartialManifest(manifest, router), null, 2)};` : ""}
6740  window.__reactRouterRouteModules = {${matches.map((match, index) => `${JSON.stringify(match.route.id)}:route${index}`).join(",")}};
6741
6742import(${JSON.stringify(manifest.entry.module)});`;
6743		return /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, /* @__PURE__ */ import_react.createElement("script", {
6744			...scriptProps,
6745			suppressHydrationWarning: true,
6746			dangerouslySetInnerHTML: { __html: contextScript },
6747			type: void 0
6748		}), /* @__PURE__ */ import_react.createElement("script", {
6749			...scriptProps,
6750			suppressHydrationWarning: true,
6751			dangerouslySetInnerHTML: { __html: routeModulesScript },
6752			type: "module",
6753			async: true
6754		}));
6755	}, []);
6756	let preloads = isHydrated || isRSCRouterContext ? [] : dedupe(manifest.entry.imports.concat(getModuleLinkHrefs(matches, manifest, { includeHydrateFallback: true })));
6757	let sri = typeof manifest.sri === "object" ? manifest.sri : {};
6758	warnOnce(!isRSCRouterContext, "The <Scripts /> element is a no-op when using RSC and can be safely removed.");
6759	return isHydrated || isRSCRouterContext ? null : /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, typeof manifest.sri === "object" ? /* @__P
6759URE__ */ import_react.createElement("script", {
6760		...scriptProps,
6761		"rr-importmap": "",
6762		type: "importmap",
6763		suppressHydrationWarning: true,
6764		dangerouslySetInnerHTML: { __html: JSON.stringify({ integrity: sri }) }
6765	}) : null, !enableFogOfWar ? /* @__PURE__ */ import_react.createElement("link", {
6766		rel: "modulepreload",
6767		href: manifest.url,
6768		crossOrigin: scriptProps.crossOrigin,
6769		integrity: sri[manifest.url],
6770		suppressHydrationWarning: true
6771	}) : null, /* @__PURE__ */ import_react.createElement("link", {
6772		rel: "modulepreload",
6773		href: manifest.entry.module,
6774		crossOrigin: scriptProps.crossOrigin,
6775		integrity: sri[manifest.entry.module],
6776		suppressHydrationWarning: true
6777	}), preloads.map((path) => /* @__PURE__ */ import_react.createElement("link", {
6778		key: path,
6779		rel: "modulepreload",
6780		href: path,
6781		crossOrigin: scriptProps.crossOrigin,
6782		integrity: sri[path],
6783		suppressHydrationWarning: true
6784	})), initialScripts);
6785}
6786function dedupe(array) {
6787	return [...new Set(array)];
6788}
6789function mergeRefs(...refs) {
6790	return (value) => {
6791		refs.forEach((ref) => {
6792			if (typeof ref === "function") ref(value);
6793			else if (ref != null) ref.current = value;
6794		});
6795	};
6796}
6797var RemixErrorBoundary = class extends import_react.Component {
6798	constructor(props) {
6799		super(props);
6800		this.state = {
6801			error: props.error || null,
6802			location: props.location
6803		};
6804	}
6805	static getDerivedStateFromError(error) {
6806		return { error };
6807	}
6808	static getDerivedStateFromProps(props, state) {
6809		if (state.location !== props.location) return {
6810			error: props.error || null,
6811			location: props.location
6812		};
6813		return {
6814			error: props.error || state.error,
6815			location: state.location
6816		};
6817	}
6818	render() {
6819		if (this.state.error) return /* @__PURE__ */ import_react.createElement(RemixRootDefaultErrorBoundary, {
6820			error: this.state.error,
6821			isOutsideRemixApp: true
6822		});
6823		else return this.props.children;
6824	}
6825};
6826function RemixRootDefaultErrorBoundary({ error, isOutsideRemixApp }) {
6827	console.error(error);
6828	let heyDeveloper = /* @__PURE__ */ import_react.createElement("script", { dangerouslySetInnerHTML: { __html: `
6829        console.log(
6830          "\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."
6831        );
6832      ` } });
6833	if (isRouteErrorResponse(error)) return /* @__PURE__ */ import_react.createElement(BoundaryShell, { title: "Unhandled Thrown Response!" }, /* @__PURE__ */ import_react.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText), heyDeveloper);
6834	let errorInstance;
6835	if (error instanceof Error) errorInstance = error;
6836	else {
6837		let errorString = error == null ? "Unknown Error" : typeof error === "object" && "toString" in error ? error.toString() : JSON.stringify(error);
6838		errorInstance = new Error(errorString);
6839	}
6840	return /* @__PURE__ */ import_react.createElement(BoundaryShell, {
6841		title: "Application Error!",
6842		isOutsideRemixApp
6843	}, /* @__PURE__ */ import_react.createElement("h1", { style: { fontSize: "24px" } }, "Application Error"), /* @__PURE__ */ import_react.createElement("pre", { style: {
6844		padding: "2rem",
6845		background: "hsla(10, 50%, 50%, 0.1)",
6846		color: "red",
6847		overflow: "auto"
6848	} }, errorInstance.stack), heyDeveloper);
6849}
6850function BoundaryShell({ title, renderScripts, isOutsideRemixApp, children }) {
6851	let { routeModules } = useFrameworkContext();
6852	if (routeModules.root?.Layout && !isOutsideRemixApp) return children;
6853	return /* @__PURE__ */ import_react.createElement("html", { lang: "en" }, /* @__PURE__ */ import_react.createElement("head", null, /* @__PURE__ */ import_react.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ import_react.createElement("meta", {
6854		name: "viewport",
6855		content: "width=device-width,initial-scale=1,viewport-fit=cover"
6856	}
vendor: 24,409 bytes, lines 6856-7472
6856), /* @__PURE__ */ import_react.createElement("title", null, title)), /* @__PURE__ */ import_react.createElement("body", null, /* @__PURE__ */ import_react.createElement("main", { style: {
6857		fontFamily: "system-ui, sans-serif",
6858		padding: "2rem"
6859	} }, children, renderScripts ? /* @__PURE__ */ import_react.createElement(Scripts, null) : null)));
6860}
6861var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
6862try {
6863	if (isBrowser2) window.__reactRouterVersion = "7.13.2";
6864} catch (e) {}
6865function createBrowserRouter(routes, opts) {
6866	return createRouter({
6867		basename: opts?.basename,
6868		getContext: opts?.getContext,
6869		future: opts?.future,
6870		history: createBrowserHistory({ window: opts?.window }),
6871		hydrationData: opts?.hydrationData || parseHydrationData(),
6872		routes,
6873		mapRouteProperties,
6874		hydrationRouteProperties,
6875		dataStrategy: opts?.dataStrategy,
6876		patchRoutesOnNavigation: opts?.patchRoutesOnNavigation,
6877		window: opts?.window,
6878		unstable_instrumentations: opts?.unstable_instrumentations
6879	}).initialize();
6880}
6881function createHashRouter(routes, opts) {
6882	return createRouter({
6883		basename: opts?.basename,
6884		getContext: opts?.getContext,
6885		future: opts?.future,
6886		history: createHashHistory({ window: opts?.window }),
6887		hydrationData: opts?.hydrationData || parseHydrationData(),
6888		routes,
6889		mapRouteProperties,
6890		hydrationRouteProperties,
6891		dataStrategy: opts?.dataStrategy,
6892		patchRoutesOnNavigation: opts?.patchRoutesOnNavigation,
6893		window: opts?.window,
6894		unstable_instrumentations: opts?.unstable_instrumentations
6895	}).initialize();
6896}
6897function parseHydrationData() {
6898	let state = window?.__staticRouterHydrationData;
6899	if (state && state.errors) state = {
6900		...state,
6901		errors: deserializeErrors$1(state.errors)
6902	};
6903	return state;
6904}
6905function deserializeErrors$1(errors) {
6906	if (!errors) return null;
6907	let entries = Object.entries(errors);
6908	let serialized = {};
6909	for (let [key, val] of entries) if (val && val.__type === "RouteErrorResponse") serialized[key] = new ErrorResponseImpl(val.status, val.statusText, val.data, val.internal === true);
6910	else if (val && val.__type === "Error") {
6911		if (val.__subType) {
6912			let ErrorConstructor = window[val.__subType];
6913			if (typeof ErrorConstructor === "function") try {
6914				let error = new ErrorConstructor(val.message);
6915				error.stack = "";
6916				serialized[key] = error;
6917			} catch (e) {}
6918		}
6919		if (serialized[key] == null) {
6920			let error = new Error(val.message);
6921			error.stack = "";
6922			serialized[key] = error;
6923		}
6924	} else serialized[key] = val;
6925	return serialized;
6926}
6927function BrowserRouter({ basename, children, unstable_useTransitions, window: window2 }) {
6928	let historyRef = import_react.useRef();
6929	if (historyRef.current == null) historyRef.current = createBrowserHistory({
6930		window: window2,
6931		v5Compat: true
6932	});
6933	let history = historyRef.current;
6934	let [state, setStateImpl] = import_react.useState({
6935		action: history.action,
6936		location: history.location
6937	});
6938	let setState = import_react.useCallback((newState) => {
6939		if (unstable_useTransitions === false) setStateImpl(newState);
6940		else import_react.startTransition(() => setStateImpl(newState));
6941	}, [unstable_useTransitions]);
6942	import_react.useLayoutEffect(() => history.listen(setState), [history, setState]);
6943	return /* @__PURE__ */ import_react.createElement(Router, {
6944		basename,
6945		children,
6946		location: state.location,
6947		navigationType: state.action,
6948		navigator: history,
6949		unstable_useTransitions
6950	});
6951}
6952function HashRouter({ basename, children, unstable_useTransitions, window: window2 }) {
6953	let historyRef = import_react.useRef();
6954	if (historyRef.current == null) historyRef.current = createHashHistory({
6955		window: window2,
6956		v5Compat: true
6957	});
6958	let history = historyRef.current;
6959	let [state, setStateImpl] = import_react.useState({
6960		action: history.action,
6961		location: history.location
6962	});
6963	let setState = import_react.useCallback((newState) => {
6964		if (unstable_useTransitions === false) setStateImpl(newState);
6965		else import_react.startTransition(() => setStateImpl(newState));
6966	}, [unstable_useTransitions]);
6967	import_react.useLayoutEffect(() => history.listen(setState), [history, setState]);
6968	return /* @__PURE__ */ import_react.createElement(Router, {
6969		basename,
6970		children,
6971		location: state.location,
6972		navigationType: state.action,
6973		navigator: history,
6974		unstable_useTransitions
6975	});
6976}
6977function HistoryRouter({ basename, children, history, unstable_useTransitions }) {
6978	let [state, setStateImpl] = import_react.useState({
6979		action: history.action,
6980		location: history.location
6981	});
6982	let setState = import_react.useCallback((newState) => {
6983		if (unstable_useTransitions === false) setStateImpl(newState);
6984		else import_react.startTransition(() => setStateImpl(newState));
6985	}, [unstable_useTransitions]);
6986	import_react.useLayoutEffect(() => history.listen(setState), [history, setState]);
6987	return /* @__PURE__ */ import_react.createElement(Router, {
6988		basename,
6989		children,
6990		location: state.location,
6991		navigationType: state.action,
6992		navigator: history,
6993		unstable_useTransitions
6994	});
6995}
6996HistoryRouter.displayName = "unstable_HistoryRouter";
6997var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
6998var Link = import_react.forwardRef(function LinkWithRef({ onClick, discover = "render", prefetch = "none", relative, reloadDocument, replace: replace2, unstable_mask, state, target, to, preventScrollReset, viewTransition, unstable_defaultShouldRevalidate, ...rest }, forwardedRef) {
6999	let { basename, navigator, unstable_useTransitions } = import_react.useContext(NavigationContext);
7000	let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
7001	let parsed = parseToInfo(to, basename);
7002	to = parsed.to;
7003	let href = useHref(to, { relative });
7004	let location = useLocation();
7005	let maskedHref = null;
7006	if (unstable_mask) {
7007		let resolved = resolveTo(unstable_mask, [], location.unstable_mask ? location.unstable_mask.pathname : "/", true);
7008		if (basename !== "/") resolved.pathname = resolved.pathname === "/" ? basename : joinPaths([basename, resolved.pathname]);
7009		maskedHref = navigator.createHref(resolved);
7010	}
7011	let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(prefetch, rest);
7012	let internalOnClick = useLinkClickHandler(to, {
7013		replace: replace2,
7014		unstable_mask,
7015		state,
7016		target,
7017		preventScrollReset,
7018		relative,
7019		viewTransition,
7020		unstable_defaultShouldRevalidate,
7021		unstable_useTransitions
7022	});
7023	function handleClick(event) {
7024		if (onClick) onClick(event);
7025		if (!event.defaultPrevented) internalOnClick(event);
7026	}
7027	let isSpaLink = !(parsed.isExternal || reloadDocument);
7028	let link = /* @__PURE__ */ import_react.createElement("a", {
7029		...rest,
7030		...prefetchHandlers,
7031		href: (isSpaLink ? maskedHref : void 0) || parsed.absoluteURL || href,
7032		onClick: isSpaLink ? handleClick : onClick,
7033		ref: mergeRefs(forwardedRef, prefetchRef),
7034		target,
7035		"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
7036	});
7037	return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, link, /* @__PURE__ */ import_react.createElement(PrefetchPageLinks, { page: href })) : link;
7038});
7039Link.displayName = "Link";
7040var NavLink = import_react.forwardRef(function NavLinkWithRef({ "aria-current": ariaCurrentProp = "page", caseSensitive = false, className: classNameProp = "", end = false, style: styleProp, to, viewTransition, children, ...rest }, ref) {
7041	let path = useResolvedPath(to, { relative: rest.relative });
7042	let location = useLocation();
7043	let routerState = import_react.useContext(DataRouterStateContext);
7044	let { navigator, basename } = import_react.useContext(NavigationContext);
7045	let isTransitioning = routerState != null && useViewTransitionState(path) && viewTransition === true;
7046	let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
7047	let locationPathname = location.pathname;
7048	let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
7049	if (!caseSensitive) {
7050		locationPathname = locationPathname.toLowerCase();
7051		nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
7052		toPathname = toPathname.toLowerCase();
7053	}
7054	if (nextLocationPathname && basename) nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
7055	const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
7056	let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
7057	let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
7058	let renderProps = {
7059		isActive,
7060		isPending,
7061		isTransitioning
7062	};
7063	let ariaCurrent = isActive ? ariaCurrentProp : void 0;
7064	let className;
7065	if (typeof classNameProp === "function") className = classNameProp(renderProps);
7066	else className = [
7067		classNameProp,
7068		isActive ? "active" : null,
7069		isPending ? "pending" : null,
7070		isTransitioning ? "transitioning" : null
7071	].filter(Boolean).join(" ");
7072	let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
7073	return /* @__PURE__ */ import_react.createElement(Link, {
7074		...rest,
7075		"aria-current": ariaCurrent,
7076		className,
7077		ref,
7078		style,
7079		to,
7080		viewTransition
7081	}, typeof children === "function" ? children(renderProps) : children);
7082});
7083NavLink.displayName = "NavLink";
7084var Form = import_react.forwardRef(({ discover = "render", fetcherKey, navigate, reloadDocument, replace: replace2, state, method = defaultMethod, action, onSubmit, relative, preventScrollReset, viewTransition, unstable_defaultShouldRevalidate, ...props }, forwardedRef) => {
7085	let { unstable_useTransitions } = import_react.useContext(NavigationContext);
7086	let submit = useSubmit();
7087	let formAction = useFormAction(action, { relative });
7088	let formMethod = method.toLowerCase() === "get" ? "get" : "post";
7089	let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX2.test(action);
7090	let submitHandler = (event) => {
7091		onSubmit && onSubmit(event);
7092		if (event.defaultPrevented) return;
7093		event.preventDefault();
7094		let submitter = event.nativeEvent.submitter;
7095		let submitMethod = submitter?.getAttribute("formmethod") || method;
7096		let doSubmit = () => submit(submitter || event.currentTarget, {
7097			fetcherKey,
7098			method: submitMethod,
7099			navigate,
7100			replace: replace2,
7101			state,
7102			relative,
7103			preventScrollReset,
7104			viewTransition,
7105			unstable_defaultShouldRevalidate
7106		});
7107		if (unstable_useTransitions && navigate !== false) import_react.startTransition(() => doSubmit());
7108		else doSubmit();
7109	};
7110	return /* @__PURE__ */ import_react.createElement("form", {
7111		ref: forwardedRef,
7112		method: formMethod,
7113		action: formAction,
7114		onSubmit: reloadDocument ? onSubmit : submitHandler,
7115		...props,
7116		"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
7117	});
7118});
7119Form.displayName = "Form";
7120function ScrollRestoration({ getKey, storageKey, ...props }) {
7121	let remixContext = import_react.useContext(FrameworkContext);
7122	let { basename } = import_react.useContext(NavigationContext);
7123	let location = useLocation();
7124	let matches = useMatches();
7125	useScrollRestoration({
7126		getKey,
7127		storageKey
7128	});
7129	let ssrKey = import_react.useMemo(() => {
7130		if (!remixContext || !getKey) return null;
7131		let userKey = getScrollRestorationKey(location, matches, basename, getKey);
7132		return userKey !== location.key ? userKey : null;
7133	}, []);
7134	if (!remixContext || remixContext.isSpaMode) return null;
7135	let restoreScroll = ((storageKey2, restoreKey) => {
7136		if (!window.history.state || !window.history.state.key) {
7137			let key = Math.random().toString(32).slice(2);
7138			window.history.replaceState({ key }, "");
7139		}
7140		try {
7141			let storedY = JSON.parse(sessionStorage.getItem(storageKey2) || "{}")[restoreKey || window.history.state.key];
7142			if (typeof storedY === "number") window.scrollTo(0, storedY);
7143		} catch (error) {
7144			console.error(error);
7145			sessionStorage.removeItem(storageKey2);
7146		}
7147	}).toString();
7148	return /* @__PURE__ */ import_react.createElement("script", {
7149		...props,
7150		suppressHydrationWarning: true,
7151		dangerouslySetInnerHTML: { __html: `(${restoreScroll})(${escapeHtml(JSON.stringify(storageKey || SCROLL_RESTORATION_STORAGE_KEY))}, ${escapeHtml(JSON.stringify(ssrKey))})` }
7152	});
7153}
7154ScrollRestoration.displayName = "ScrollRestoration";
7155function getDataRouterConsoleError2(hookName) {
7156	return `${hookName} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`;
7157}
7158function useDataRouterContext3(hookName) {
7159	let ctx = import_react.useContext(DataRouterContext);
7160	invariant(ctx, getDataRouterConsoleError2(hookName));
7161	return ctx;
7162}
7163function useDataRouterState2(hookName) {
7164	let state = import_react.useContext(DataRouterStateContext);
7165	invariant(state, getDataRouterConsoleError2(hookName));
7166	return state;
7167}
7168function useLinkClickHandler(to, { target, replace: replaceProp, unstable_mask, state, preventScrollReset, relative, viewTransition, unstable_defaultShouldRevalidate, unstable_useTransitions } = {}) {
7169	let navigate = useNavigate();
7170	let location = useLocation();
7171	let path = useResolvedPath(to, { relative });
7172	return import_react.useCallback((event) => {
7173		if (shouldProcessLinkClick(event, target)) {
7174			event.preventDefault();
7175			let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
7176			let doNavigate = () => navigate(to, {
7177				replace: replace2,
7178				unstable_mask,
7179				state,
7180				preventScrollReset,
7181				relative,
7182				viewTransition,
7183				unstable_defaultShouldRevalidate
7184			});
7185			if (unstable_useTransitions) import_react.startTransition(() => doNavigate());
7186			else doNavigate();
7187		}
7188	}, [
7189		location,
7190		navigate,
7191		path,
7192		replaceProp,
7193		unstable_mask,
7194		state,
7195		target,
7196		to,
7197		preventScrollReset,
7198		relative,
7199		viewTransition,
7200		unstable_defaultShouldRevalidate,
7201		unstable_useTransitions
7202	]);
7203}
7204function useSearchParams(defaultInit) {
7205	warning(typeof URLSearchParams !== "undefined", `You cannot use the \`useSearchParams\` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.`);
7206	let defaultSearchParamsRef = import_react.useRef(createSearchParams(defaultInit));
7207	let hasSetSearchParamsRef = import_react.useRef(false);
7208	let location = useLocation();
7209	let searchParams = import_react.useMemo(() => getSearchParamsForLocation(location.search, hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current), [location.search]);
7210	let navigate = useNavigate();
7211	return [searchParams, import_react.useCallback((nextInit, navigateOptions) => {
7212		const newSearchParams = createSearchParams(typeof nextInit === "function" ? nextInit(new URLSearchParams(searchParams)) : nextInit);
7213		hasSetSearchParamsRef.current = true;
7214		navigate("?" + newSearchParams, navigateOptions);
7215	}, [navigate, searchParams])];
7216}
7217var fetcherId = 0;
7218var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
7219function useSubmit() {
7220	let { router } = useDataRouterContext3("useSubmit");
7221	let { basename } = import_react.useContext(NavigationContext);
7222	let currentRouteId = useRouteId();
7223	let routerFetch = router.fetch;
7224	let routerNavigate = router.navigate;
7225	return import_react.useCallback(async (target, options = {}) => {
7226		let { action, method, encType, formData, body } = getFormSubmissionInfo(target, basename);
7227		if (options.navigate === false) await routerFetch(options.fetcherKey || getUniqueFetcherId(), currentRouteId, options.action || action, {
7228			unstable_defaultShouldRevalidate: options.unstable_defaultShouldRevalidate,
7229			preventScrollReset: options.preventScrollReset,
7230			formData,
7231			body,
7232			formMethod: options.method || method,
7233			formEncType: options.encType || encType,
7234			flushSync: options.flushSync
7235		});
7236		else await routerNavigate(options.action || action, {
7237			unstable_defaultShouldRevalidate: options.unstable_defaultShouldRevalidate,
7238			preventScrollReset: options.preventScrollReset,
7239			formData,
7240			body,
7241			formMethod: options.method || method,
7242			formEncType: options.encType || encType,
7243			replace: options.replace,
7244			state: options.state,
7245			fromRouteId: currentRouteId,
7246			flushSync: options.flushSync,
7247			viewTransition: options.viewTransition
7248		});
7249	}, [
7250		routerFetch,
7251		routerNavigate,
7252		basename,
7253		currentRouteId
7254	]);
7255}
7256function useFormAction(action, { relative } = {}) {
7257	let { basename } = import_react.useContext(NavigationContext);
7258	let routeContext = import_react.useContext(RouteContext);
7259	invariant(routeContext, "useFormAction must be used inside a RouteContext");
7260	let [match] = routeContext.matches.slice(-1);
7261	let path = { ...useResolvedPath(action ? action : ".", { relative }) };
7262	let location = useLocation();
7263	if (action == null) {
7264		path.search = location.search;
7265		let params = new URLSearchParams(path.search);
7266		let indexValues = params.getAll("index");
7267		if (indexValues.some((v) => v === "")) {
7268			params.delete("index");
7269			indexValues.filter((v) => v).forEach((v) => params.append("index", v));
7270			let qs = params.toString();
7271			path.search = qs ? `?${qs}` : "";
7272		}
7273	}
7274	if ((!action || action === ".") && match.route.index) path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
7275	if (basename !== "/") path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
7276	return createPath(path);
7277}
7278function useFetcher({ key } = {}) {
7279	let { router } = useDataRouterContext3("useFetcher");
7280	let state = useDataRouterState2("useFetcher");
7281	let fetcherData = import_react.useContext(FetchersContext);
7282	let route = import_react.useContext(RouteContext);
7283	let routeId = route.matches[route.matches.length - 1]?.route.id;
7284	invariant(fetcherData, `useFetcher must be used inside a FetchersContext`);
7285	invariant(route, `useFetcher must be used inside a RouteContext`);
7286	invariant(routeId != null, `useFetcher can only be used on routes that contain a unique "id"`);
7287	let defaultKey = import_react.useId();
7288	let [fetcherKey, setFetcherKey] = import_react.useState(key || defaultKey);
7289	if (key && key !== fetcherKey) setFetcherKey(key);
7290	let { deleteFetcher, getFetcher, resetFetcher, fetch: routerFetch } = router;
7291	import_react.useEffect(() => {
7292		getFetcher(fetcherKey);
7293		return () => deleteFetcher(fetcherKey);
7294	}, [
7295		deleteFetcher,
7296		getFetcher,
7297		fetcherKey
7298	]);
7299	let load = import_react.useCallback(async (href, opts) => {
7300		invariant(routeId, "No routeId available for fetcher.load()");
7301		await routerFetch(fetcherKey, routeId, href, opts);
7302	}, [
7303		fetcherKey,
7304		routeId,
7305		routerFetch
7306	]);
7307	let submitImpl = useSubmit();
7308	let submit = import_react.useCallback(async (target, opts) => {
7309		await submitImpl(target, {
7310			...opts,
7311			navigate: false,
7312			fetcherKey
7313		});
7314	}, [fetcherKey, submitImpl]);
7315	let reset = import_react.useCallback((opts) => resetFetcher(fetcherKey, opts), [resetFetcher, fetcherKey]);
7316	let FetcherForm = import_react.useMemo(() => {
7317		let FetcherForm2 = import_react.forwardRef((props, ref) => {
7318			return /* @__PURE__ */ import_react.createElement(Form, {
7319				...props,
7320				navigate: false,
7321				fetcherKey,
7322				ref
7323			});
7324		});
7325		FetcherForm2.displayName = "fetcher.Form";
7326		return FetcherForm2;
7327	}, [fetcherKey]);
7328	let fetcher = state.fetchers.get(fetcherKey) || IDLE_FETCHER;
7329	let data2 = fetcherData.get(fetcherKey);
7330	return import_react.useMemo(() => ({
7331		Form: FetcherForm,
7332		submit,
7333		load,
7334		reset,
7335		...fetcher,
7336		data: data2
7337	}), [
7338		FetcherForm,
7339		submit,
7340		load,
7341		reset,
7342		fetcher,
7343		data2
7344	]);
7345}
7346function useFetchers() {
7347	let state = useDataRouterState2("useFetchers");
7348	return Array.from(state.fetchers.entries()).map(([key, fetcher]) => ({
7349		...fetcher,
7350		key
7351	}));
7352}
7353var SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions";
7354var savedScrollPositions = {};
7355function getScrollRestorationKey(location, matches, basename, getKey) {
7356	let key = null;
7357	if (getKey) if (basename !== "/") key = getKey({
7358		...location,
7359		pathname: stripBasename(location.pathname, basename) || location.pathname
7360	}, matches);
7361	else key = getKey(location, matches);
7362	if (key == null) key = location.key;
7363	return key;
7364}
7365function useScrollRestoration({ getKey, storageKey } = {}) {
7366	let { router } = useDataRouterContext3("useScrollRestoration");
7367	let { restoreScrollPosition, preventScrollReset } = useDataRouterState2("useScrollRestoration");
7368	let { basename } = import_react.useContext(NavigationContext);
7369	let location = useLocation();
7370	let matches = useMatches();
7371	let navigation = useNavigation();
7372	import_react.useEffect(() => {
7373		window.history.scrollRestoration = "manual";
7374		return () => {
7375			window.history.scrollRestoration = "auto";
7376		};
7377	}, []);
7378	usePageHide(import_react.useCallback(() => {
7379		if (navigation.state === "idle") {
7380			let key = getScrollRestorationKey(location, matches, basename, getKey);
7381			savedScrollPositions[key] = window.scrollY;
7382		}
7383		try {
7384			sessionStorage.setItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY, JSON.stringify(savedScrollPositions));
7385		} catch (error) {
7386			warning(false, `Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`);
7387		}
7388		window.history.scrollRestoration = "auto";
7389	}, [
7390		navigation.state,
7391		getKey,
7392		basename,
7393		location,
7394		matches,
7395		storageKey
7396	]));
7397	if (typeof document !== "undefined") {
7398		import_react.useLayoutEffect(() => {
7399			try {
7400				let sessionPositions = sessionStorage.getItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY);
7401				if (sessionPositions) savedScrollPositions = JSON.parse(sessionPositions);
7402			} catch (e) {}
7403		}, [storageKey]);
7404		import_react.useLayoutEffect(() => {
7405			let disableScrollRestoration = router?.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKey ? (location2, matches2) => getScrollRestorationKey(location2, matches2, basename, getKey) : void 0);
7406			return () => disableScrollRestoration && disableScrollRestoration();
7407		}, [
7408			router,
7409			basename,
7410			getKey
7411		]);
7412		import_react.useLayoutEffect(() => {
7413			if (restoreScrollPosition === false) return;
7414			if (typeof restoreScrollPosition === "number") {
7415				window.scrollTo(0, restoreScrollPosition);
7416				return;
7417			}
7418			try {
7419				if (location.hash) {
7420					let el = document.getElementById(decodeURIComponent(location.hash.slice(1)));
7421					if (el) {
7422						el.scrollIntoView();
7423						return;
7424					}
7425				}
7426			} catch {
7427				warning(false, `"${location.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`);
7428			}
7429			if (preventScrollReset === true) return;
7430			window.scrollTo(0, 0);
7431		}, [
7432			location,
7433			restoreScrollPosition,
7434			preventScrollReset
7435		]);
7436	}
7437}
7438function useBeforeUnload(callback, options) {
7439	let { capture } = options || {};
7440	import_react.useEffect(() => {
7441		let opts = capture != null ? { capture } : void 0;
7442		window.addEventListener("beforeunload", callback, opts);
7443		return () => {
7444			window.removeEventListener("beforeunload", callback, opts);
7445		};
7446	}, [callback, capture]);
7447}
7448function usePageHide(callback, options) {
7449	let { capture } = options || {};
7450	import_react.useEffect(() => {
7451		let opts = capture != null ? { capture } : void 0;
7452		window.addEventListener("pagehide", callback, opts);
7453		return () => {
7454			window.removeEventListener("pagehide", callback, opts);
7455		};
7456	}, [callback, capture]);
7457}
7458function usePrompt({ when, message }) {
7459	let blocker = useBlocker(when);
7460	import_react.useEffect(() => {
7461		if (blocker.state === "blocked") if (window.confirm(message)) setTimeout(blocker.proceed, 0);
7462		else blocker.reset();
7463	}, [blocker, message]);
7464	import_react.useEffect(() => {
7465		if (blocker.state === "blocked" && !when) blocker.reset();
7466	}, [blocker, when]);
7467}
7468function useViewTransitionState(to, { relative } = {}) {
7469	let vtContext = import_react.useContext(ViewTransitionContext);
7470	invariant(vtContext != null, "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");
7471	let { basename } = useDataRouterContext3("useViewTransitionState");
7472	let path = useResolvedPath(to, { relative });
vendor: 9,056 bytes, lines 7473-7733
7473	if (!vtContext.isTransitioning) return false;
7474	let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
7475	let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
7476	return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
7477}
7478function StaticRouter({ basename, children, location: locationProp = "/" }) {
7479	if (typeof locationProp === "string") locationProp = parsePath(locationProp);
7480	let action = "POP";
7481	let location = {
7482		pathname: locationProp.pathname || "/",
7483		search: locationProp.search || "",
7484		hash: locationProp.hash || "",
7485		state: locationProp.state != null ? locationProp.state : null,
7486		key: locationProp.key || "default",
7487		unstable_mask: void 0
7488	};
7489	let staticNavigator = getStatelessNavigator();
7490	return /* @__PURE__ */ import_react.createElement(Router, {
7491		basename,
7492		children,
7493		location,
7494		navigationType: action,
7495		navigator: staticNavigator,
7496		static: true,
7497		unstable_useTransitions: false
7498	});
7499}
7500function StaticRouterProvider({ context, router, hydrate: hydrate2 = true, nonce }) {
7501	invariant(router && context, "You must provide `router` and `context` to <StaticRouterProvider>");
7502	let dataRouterContext = {
7503		router,
7504		navigator: getStatelessNavigator(),
7505		static: true,
7506		staticContext: context,
7507		basename: context.basename || "/"
7508	};
7509	let fetchersContext = /* @__PURE__ */ new Map();
7510	let hydrateScript = "";
7511	if (hydrate2 !== false) {
7512		let data2 = {
7513			loaderData: context.loaderData,
7514			actionData: context.actionData,
7515			errors: serializeErrors$1(context.errors)
7516		};
7517		hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${escapeHtml(JSON.stringify(JSON.stringify(data2)))});`;
7518	}
7519	let { state } = dataRouterContext.router;
7520	return /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, /* @__PURE__ */ import_react.createElement(DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ import_react.createElement(DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ import_react.createElement(FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ import_react.createElement(ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ import_react.createElement(Router, {
7521		basename: dataRouterContext.basename,
7522		location: state.location,
7523		navigationType: state.historyAction,
7524		navigator: dataRouterContext.navigator,
7525		static: dataRouterContext.static,
7526		unstable_useTransitions: false
7527	}, /* @__PURE__ */ import_react.createElement(DataRoutes, {
7528		routes: router.routes,
7529		future: router.future,
7530		state,
7531		isStatic: true
7532	})))))), hydrateScript ? /* @__PURE__ */ import_react.createElement("script", {
7533		suppressHydrationWarning: true,
7534		nonce,
7535		dangerouslySetInnerHTML: { __html: hydrateScript }
7536	}) : null);
7537}
7538function serializeErrors$1(errors) {
7539	if (!errors) return null;
7540	let entries = Object.entries(errors);
7541	let serialized = {};
7542	for (let [key, val] of entries) if (isRouteErrorResponse(val)) serialized[key] = {
7543		...val,
7544		__type: "RouteErrorResponse"
7545	};
7546	else if (val instanceof Error) serialized[key] = {
7547		message: val.message,
7548		__type: "Error",
7549		...val.name !== "Error" ? { __subType: val.name } : {}
7550	};
7551	else serialized[key] = val;
7552	return serialized;
7553}
7554function getStatelessNavigator() {
7555	return {
7556		createHref,
7557		encodeLocation,
7558		push(to) {
7559			throw new Error(`You cannot use navigator.push() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)})\` somewhere in your app.`);
7560		},
7561		replace(to) {
7562			throw new Error(`You cannot use navigator.replace() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)}, { replace: true })\` somewhere in your app.`);
7563		},
7564		go(delta) {
7565			throw new Error(`You cannot use navigator.go() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${delta})\` somewhere in your app.`);
7566		},
7567		back() {
7568			throw new Error(`You cannot use navigator.back() on the server because it is a stateless environment.`);
7569		},
7570		forward() {
7571			throw new Error(`You cannot use navigator.forward() on the server because it is a stateless environment.`);
7572		}
7573	};
7574}
7575function createStaticHandler2(routes, opts) {
7576	return createStaticHandler(routes, {
7577		...opts,
7578		mapRouteProperties
7579	});
7580}
7581function createStaticRouter(routes, context, opts = {}) {
7582	let manifest = {};
7583	let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, void 0, manifest);
7584	let matches = context.matches.map((match) => {
7585		let route = manifest[match.route.id] || match.route;
7586		return {
7587			...match,
7588			route
7589		};
7590	});
7591	let msg = (method) => `You cannot use router.${method}() on the server because it is a stateless environment`;
7592	return {
7593		get basename() {
7594			return context.basename;
7595		},
7596		get future() {
7597			return {
7598				v8_middleware: false,
7599				unstable_passThroughRequests: false,
7600				...opts?.future
7601			};
7602		},
7603		get state() {
7604			return {
7605				historyAction: "POP",
7606				location: context.location,
7607				matches,
7608				loaderData: context.loaderData,
7609				actionData: context.actionData,
7610				errors: context.errors,
7611				initialized: true,
7612				renderFallback: false,
7613				navigation: IDLE_NAVIGATION,
7614				restoreScrollPosition: null,
7615				preventScrollReset: false,
7616				revalidation: "idle",
7617				fetchers: /* @__PURE__ */ new Map(),
7618				blockers: /* @__PURE__ */ new Map()
7619			};
7620		},
7621		get routes() {
7622			return dataRoutes;
7623		},
7624		get window() {},
7625		initialize() {
7626			throw msg("initialize");
7627		},
7628		subscribe() {
7629			throw msg("subscribe");
7630		},
7631		enableScrollRestoration() {
7632			throw msg("enableScrollRestoration");
7633		},
7634		navigate() {
7635			throw msg("navigate");
7636		},
7637		fetch() {
7638			throw msg("fetch");
7639		},
7640		revalidate() {
7641			throw msg("revalidate");
7642		},
7643		createHref,
7644		encodeLocation,
7645		getFetcher() {
7646			return IDLE_FETCHER;
7647		},
7648		deleteFetcher() {
7649			throw msg("deleteFetcher");
7650		},
7651		resetFetcher() {
7652			throw msg("resetFetcher");
7653		},
7654		dispose() {
7655			throw msg("dispose");
7656		},
7657		getBlocker() {
7658			return IDLE_BLOCKER;
7659		},
7660		deleteBlocker() {
7661			throw msg("deleteBlocker");
7662		},
7663		patchRoutes() {
7664			throw msg("patchRoutes");
7665		},
7666		_internalFetchControllers: /* @__PURE__ */ new Map(),
7667		_internalSetRoutes() {
7668			throw msg("_internalSetRoutes");
7669		},
7670		_internalSetStateDoNotUseOrYouWillBreakYourApp() {
7671			throw msg("_internalSetStateDoNotUseOrYouWillBreakYourApp");
7672		}
7673	};
7674}
7675function createHref(to) {
7676	return typeof to === "string" ? to : createPath(to);
7677}
7678function encodeLocation(to) {
7679	let href = typeof to === "string" ? to : createPath(to);
7680	href = href.replace(/ $/, "%20");
7681	let encoded = ABSOLUTE_URL_REGEX3.test(href) ? new URL(href) : new URL(href, "http://localhost");
7682	return {
7683		pathname: encoded.pathname,
7684		search: encoded.search,
7685		hash: encoded.hash
7686	};
7687}
7688var ABSOLUTE_URL_REGEX3 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
7689//#endregion
7690//#region node_modules/cookie/dist/index.js
7691var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
7692	Object.defineProperty(exports, "__esModule", { value: true });
7693	exports.parse = parseCookie;
7694	exports.stringifySetCookie = stringifySetCookie;
7695	exports.serialize = stringifySetCookie;
7696	exports.stringifySetCookie = stringifySetCookie;
7697	exports.serialize = stringifySetCookie;
7698	/**
7699	* RegExp to match cookie-name in RFC 6265 sec 4.1.1
7700	* This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
7701	* which has been replaced by the token definition in RFC 7230 appendix B.
7702	*
7703	* cookie-name       = token
7704	* token             = 1*tchar
7705	* tchar             = "!" / "#" / "$" / "%" / "&" / "'" /
7706	*                     "*" / "+" / "-" / "." / "^" / "_" /
7707	*                     "`" / "|" / "~" / DIGIT / ALPHA
7708	*
7709	* Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
7710	* Allow same range as cookie value, except `=`, which delimits end of name.
7711	*/
7712	var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
7713	/**
7714	* RegExp to match cookie-value in RFC 6265 sec 4.1.1
7715	*
7716	* cookie-value      = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
7717	* cookie-octet      = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
7718	*                     ; US-ASCII characters excluding CTLs,
7719	*                     ; whitespace DQUOTE, comma, semicolon,
7720	*                     ; and backslash
7721	*
7722	* Allowing more characters: https://github.com/jshttp/cookie/issues/191
7723	* Comma, backslash, and DQUOTE are not part of the parsing algorithm.
7724	*/
7725	var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
7726	/**
7727	* RegExp to match domain-value in RFC 6265 sec 4.1.1
7728	*
7729	* domain-value      = <subdomain>
7730	*                     ; defined in [RFC1034], Section 3.5, as
7731	*                     ; enhanced by [RFC1123], Section 2.1
7732	* <subdomain>       = <label> | <subdomain> "." <label>
7733	* <label>           = <let-dig> [ [ <ldh-str>
7733 ] <let-dig> ]
7734	*                     Labels must be 63 characters or less.
7735	*                     'let-dig' not 'letter' in the first char, per RFC1123
7736	* <ldh-str>         = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
7737	* <let-dig-hyp>     = <let-dig> | "-"
7738	* <let-dig>         = <letter> | <digit>
7739	* <letter>          = any one of the 52 alphabetic characters A through Z in
7740	*                     upper case and a through z in lower case
7741	* <digit>           = any one of the ten digits 0 through 9
7742	*
7743	* Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
7744	*
7745	* > (Note that a leading %x2E ("."), if present, is ignored even though that
7746	* character is not permitted, but a trailing %x2E ("."), if present, will
7747	* cause the user agent to ignore the attribute.)
7748	*/
7749	var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
7750	/**
7751	* RegExp to match path-value in RFC 6265 sec 4.1.1
7752	*
7753	* path-value        = <any CHAR except CTLs or ";">
7754	* CHAR              = %x01-7F
7755	*                     ; defined in RFC 5234 appendix B.1
7756	*/
7757	var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
7758	var __toString = Object.prototype.toString;
7759	var NullObject = /* @__PURE__ */ (() => {
7760		const C = function() {};
7761		C.prototype = Object.create(null);
7762		return C;
7763	})();
7764	/**
7765	* Parse a `Cookie` header.
7766	*
7767	* Parse the given cookie header string into an object
7768	* The object has the various cookies as keys(names) => values
7769	*/
7770	function parseCookie(str, options) {
7771		const obj = new NullObject();
7772		const len = str.length;
7773		if (len < 2) return obj;
7774		const dec = options?.decode || decode;
7775		let index = 0;
7776		do {
7777			const eqIdx = eqIndex(str, index, len);
7778			if (eqIdx === -1) break;
7779			const endIdx = endIndex(str, index, len);
7780			if (eqIdx > endIdx) {
7781				index = str.lastIndexOf(";", eqIdx - 1) + 1;
7782				continue;
7783			}
7784			const key = valueSlice(str, index, eqIdx);
7785			if (obj[key] === void 0) obj[key] = dec(valueSlice(str, eqIdx + 1, endIdx));
7786			index = endIdx + 1;
7787		} while (index < len);
7788		return obj;
7789	}
7790	function stringifySetCookie(_name, _val, _opts) {
7791		const cookie = typeof _name === "object" ? _name : {
7792			..._opts,
7793			name: _name,
7794			value: String(_val)
7795		};
7796		const enc = (typeof _val === "object" ? _val : _opts)?.encode || encodeURIComponent;
7797		if (!cookieNameRegExp.test(cookie.name)) throw new TypeError(`argument name is invalid: ${cookie.name}`);
7798		const value = cookie.value ? enc(cookie.value) : "";
7799		if (!cookieValueRegExp.test(value)) throw new TypeError(`argument val is invalid: ${cookie.value}`);
7800		let str = cookie.name + "=" + value;
7801		if (cookie.maxAge !== void 0) {
7802			if (!Number.isInteger(cookie.maxAge)) throw new TypeError(`option maxAge is invalid: ${cookie.maxAge}`);
7803			str += "; Max-Age=" + cookie.maxAge;
7804		}
7805		if (cookie.domain) {
7806			if (!domainValueRegExp.test(cookie.domain)) throw new TypeError(`option domain is invalid: ${cookie.domain}`);
7807			str += "; Domain=" + cookie.domain;
7808		}
7809		if (cookie.path) {
7810			if (!pathValueRegExp.test(cookie.path)) throw new TypeError(`option path is invalid: ${cookie.path}`);
7811			str += "; Path=" + cookie.path;
7812		}
7813		if (cookie.expires) {
7814			if (!isDate(cookie.expires) || !Number.isFinite(cookie.expires.valueOf())) throw new TypeError(`option expires is invali
7814d: ${cookie.expires}`);
7815			str += "; Expires=" + cookie.expires.toUTCString();
7816		}
7817		if (cookie.httpOnly) str += "; HttpOnly";
7818		if (cookie.secure) str += "; Secure";
7819		if (cookie.partitioned) str += "; Partitioned";
7820		if (cookie.priority) switch (typeof cookie.priority === "string" ? cookie.priority.toLowerCase() : void 0) {
7821			case "low":
7822				str += "; Priority=Low";
7823				break;
7824			case "medium":
7825				str += "; Priority=Medium";
7826				break;
7827			case "high":
7828				str += "; Priority=High";
7829				break;
7830			default: throw new TypeError(`option priority is invalid: ${cookie.priority}`);
7831		}
7832		if (cookie.sameSite) switch (typeof cookie.sameSite === "string" ? cookie.sameSite.toLowerCase() : cookie.sameSite) {
7833			case true:
7834			case "strict":
7835				str += "; SameSite=Strict";
7836				break;
7837			case "lax":
7838				str += "; SameSite=Lax";
7839				break;
7840			case "none":
7841				str += "; SameSite=None";
7842				break;
7843			default: throw new TypeError(`option sameSite is invalid: ${cookie.sameSite}`);
7844		}
7845		return str;
7846	}
7847	/**
7848	* Find the `;` character between `min` and `len` in str.
7849	*/
7850	function endIndex(str, min, len) {
7851		const index = str.indexOf(";", min);
7852		return index === -1 ? len : index;
7853	}
7854	/**
7855	* Find the `=` character between `min` and `max` in str.
7856	*/
7857	function eqIndex(str, min, max) {
7858		const index = str.indexOf("=", min);
7859		return index < max ? index : -1;
7860	}
7861	/**
7862	* Slice out a value between startPod to max.
7863	*/
7864	function valueSlice(str, min, max) {
7865		let start = min;
7866		let end = max;
7867		do {
7868			const code = str.charCodeAt(start);
7869			if (code !== 32 && code !== 9) break;
7870		} while (++start < end);
7871		while (end > start) {
7872			const code = str.charCodeAt(end - 1);
7873			if (code !== 32 && code !== 9) break;
7874			end--;
7875		}
7876		return str.slice(start, end);
7877	}
7878	/**
7879	* URL-decode string value. Optimized to skip native call when no %.
7880	*/
7881	function decode(str) {
7882		if (str.indexOf("%") === -1) return str;
7883		try {
7884			return decodeURIComponent(str);
7885		} catch (e) {
7886			return str;
7887		}
7888	}
7889	/**
7890	* Determine if value is a Date.
7891	*/
7892	function isDate(val) {
7893		return __toString.call(val) === "[object Date]";
7894	}
7895}));
7896//#endregion
7897//#region node_modules/set-cookie-parser/lib/set-cookie.js
7898var require_set_cookie = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7899	var defaultParseOptions = {
7900		decodeValues: true,
7901		map: false,
7902		silent: false
7903	};
7904	function isForbiddenKey(key) {
7905		return typeof key !== "string" || key in {};
7906	}
7907	function createNullObj() {
7908		return Object.create(null);
7909	}
7910	function isNonEmptyString(str) {
7911		return typeof str === "string" && !!str.trim();
7912	}
7913	function parseString(setCookieValue, options) {
7914		var parts = setCookieValue.split(";").filter(isNonEmptyString);
7915		var parsed = parseNameValuePair(parts.shift());
7916		var name = parsed.name;
7917		var value = parsed.value;
7918		options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
7919		if (isForbiddenKey(name)) return null;
7920		try {
7921			value = options.decodeValues ? decodeURIComponent(value) : value;
7922		} catch (e) {
7923			console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.", e);
7924		}
7925		var cookie = createNullObj();
7926		cookie.name = name;
7927		cookie.value = value;
7928		parts.forEach(function(part) {
7929			var sides = part.split("=");
7930			var key = sides.shift().trimLeft().toLowerCase();
7931			if (isForbiddenKey(key)) return;
7932			var value = sides.join("=");
7933			if (key === "expires") cookie.expires = new Date(value);
7934			else if (key === "max-age") {
7935				var n = parseInt(value, 10);
7936				if (!Number.isNaN(n)) cookie.maxAge = n;
7937			} else if (key === "secure") cookie.secure = true;
7938			else if (key === "httponly") cookie.httpOnly = true;
7939			else if (key === "samesite") cookie.sameSite = value;
7940			else if (key === "partitioned") cookie.partitioned = true;
7941			else if (key) cookie[key] = value;
7942		});
7943		return cookie;
7944	}
7945	function parseNameValuePair(nameValuePairStr) {
7946		var name = "";
7947		var value = "";
7948		var nameValueArr = nameValuePairStr.split("=");
7949		if (nameValueArr.length > 1) {
7950			name = nameValueArr.shift();
7951			value = nameValueArr.join("=");
7952		} else value = nameValuePairStr;
7953		return {
7954			name,
7955			value
7956		};
7957	}
7958	function parse(input, options) {
7959		options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
7960		if (!input) if (!options.map) return [];
7961		else return createNullObj();
7962		if (input.headers) if (typeof input.headers.getSetCookie === "function") input = input.headers.getSetCookie();
7963		else if (input.headers["set-cookie"]) input = input.headers["set-cookie"];
7964		else {
7965			var sch = input.headers[Object.keys(input.headers).find(function(key) {
7966				return key.toLowerCase() === "set-cookie";
7967			})];
7968			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.");
7969			input = sch;
7970		}
7971		if (!Array.isArray(input)) input = [input];
7972		if (!options.map) return input.filter(isNonEmptyString).map(function(str) {
7973			return parseString(str, options);
7974		}
7974).filter(Boolean);
7975		else {
7976			var cookies = createNullObj();
7977			return input.filter(isNonEmptyString).reduce(function(cookies, str) {
7978				var cookie = parseString(str, options);
7979				if (cookie && !isForbiddenKey(cookie.name)) cookies[cookie.name] = cookie;
7980				return cookies;
7981			}, cookies);
7982		}
7983	}
7984	function splitCookiesString(cookiesString) {
7985		if (Array.isArray(cookiesString)) return cookiesString;
7986		if (typeof cookiesString !== "string") return [];
7987		var cookiesStrings = [];
7988		var pos = 0;
7989		var start;
7990		var ch;
7991		var lastComma;
7992		var nextStart;
7993		var cookiesSeparatorFound;
7994		function skipWhitespace() {
7995			while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) pos += 1;
7996			return pos < cookiesString.length;
7997		}
7998		function notSpecialChar() {
7999			ch = cookiesString.charAt(pos);
8000			return ch !== "=" && ch !== ";" && ch !== ",";
8001		}
8002		while (pos < cookiesString.length) {
8003			start = pos;
8004			cookiesSeparatorFound = false;
8005			while (skipWhitespace()) {
8006				ch = cookiesString.charAt(pos);
8007				if (ch === ",") {
8008					lastComma = pos;
8009					pos += 1;
8010					skipWhitespace();
8011					nextStart = pos;
8012					while (pos < cookiesString.length && notSpecialChar()) pos += 1;
8013					if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
8014						cookiesSeparatorFound = true;
8015						pos = nextStart;
8016						cookiesStrings.push(cookiesString.substring(start, lastComma));
8017						start = pos;
8018					} else pos = lastComma + 1;
8019				} else pos += 1;
8020			}
8021			if (!cookiesSeparatorFound || pos >= cookiesString.length) cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
8022		}
8023		return cookiesStrings;
8024	}
8025	module.exports = parse;
8026	module.exports.parse = parse;
8027	module.exports.parseString = parseString;
8028	module.exports.splitCookiesString = splitCookiesString;
8029}));
8030//#endregion
8031//#region node_modules/react-router/dist/development/chunk-UALY5CBT.mjs
8032/**
8033* react-router v7.13.2
8034*
8035* Copyright (c) Remix Software Inc.
8036*
8037* This source code is licensed under the MIT license found in the
8038* LICENSE.md file in the root directory of this source tree.
8039*
8040* @license MIT
8041*/
8042var import_dist = require_dist();
8043var import_set_cookie = require_set_cookie();
8044function ServerRouter({ context, url, nonce }) {
8045	if (typeof url === "string") url = new URL(url);
8046	let { manifest, routeModules, criticalCss, serverHandoffString } = context;
8047	let routes = createServerRoutes(manifest.routes, routeModules, context.future, context.isSpaMode);
8048	context.staticHandlerContext.loaderData = { ...context.staticHandlerContext.loaderData };
8049	for (let match of context.staticHandlerContext.matches) {
8050		let routeId = match.route.id;
8051		let route = routeModules[routeId];
8052		let manifestRoute = context.manifest.routes[routeId];
8053		if (route && manifestRoute && shouldHydrateRouteLoader(routeId, route.clientLoader, manifestRoute.hasLoader, context.isSpaMode) && (route.HydrateFallback || !manifestRoute.hasLoader)) delete context.staticHandlerContext.loaderData[routeId];
8054	}
8055	let router = createStaticRouter(routes, context.staticHandlerContext);
8056	return /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, /* @__PURE__ */ import_react.createElement(FrameworkContext.Provider, { value: {
8057		manifest,
8058		routeModules,
8059		criticalCss,
8060		serverHandoffString,
8061		future: context.future,
8062		ssr: context.ssr,
8063		isSpaMode: context.isSpaMode,
8064		routeDiscovery: context.routeDiscovery,
8065		serializeError: context.serializeError,
8066		renderMeta: context.renderMeta
8067	} }, /* @__PURE__ */ import_react.createElement(RemixErrorBoundary, { location: router.state.location }, /* @__PURE__ */ import_react.createElement(StaticRouterProvider, {
8068		router,
8069		context: context.staticHandlerContext,
8070		hydrate: false
8071	}))), context.serverHandoffStream ? /* @__PURE__ */ import_react.createElement(import_react.Suspense, null, /* @__PURE__ */ import_react.createElement(StreamTransfer, {
8072		context,
8073		identifier: 0,
8074		reader: context.serverHandoffStream.getReader(),
8075		textDecoder: new TextDecoder(),
8076		nonce
8077	})) : null);
8078}
8079function createRoutesStub(routes, _context) {
8080	return function RoutesTestStub({ initialEntries, initialIndex, hydrationData, future }) {
8081		let routerRef = import_react.useRef();
8082		let frameworkContextRef = import_react.useRef();
8083		if (routerRef.current == null) {
8084			frameworkContextRef.current = {
8085				future: {
8086					unstable_passThroughRequests: future?.unstable_passThroughRequests === true,
8087					unstable_subResourceIntegrity: future?.unstable_subResourceIntegrity === true,
8088					v8_middleware: future?.v8_middleware === true,
8089					unstable_trailingSlashAwareDataRequests: future?.unstable_trailingSlashAwareDataRequests === true
8090				},
8091				manifest: {
8092					routes: {},
8093					entry: {
8094						imports: [],
8095						module: ""
8096					},
8097					url: "",
8098					version: ""
8099				},
8100				routeModules: {},
8101				ssr: false,
8102				isSpaMode: false,
8103				routeDiscovery: {
8104					mode: "lazy",
8105					manifestPath: "/__manifest"
8106				}
8107			};
8108			routerRef.current = createMemoryRouter(processRoutes(convertRoutesToDataRoutes(routes, (r) => r), _context !== void 0 ? _context : future?.v8_middleware ? new RouterContextProvider() : {}, frameworkContextRef.current.manifest, frameworkContextRef.current.routeModules), {
8109				initialEntries,
8110				initialIndex,
8111				hydrationData
8112			});
8113		}
8114		return /* @__PURE__ */ import_react.createElement(FrameworkContext.Provider, { value: frameworkContextRef.current }, /* @__PURE__ */ import_react.createElement(RouterProvider, { router: routerRef.current }));
8115	};
8116}
8117function processRoutes(routes, context, manifest, routeModules, parentId) {
8118	return routes.map((route) => {
8119		if (!route.id) throw new Error("Expected a route.id in react-router processRoutes() function");
8120		let newRoute = {
8121			id: route.id,
8122			path: route.path,
8123			index: route.index,
8124			Component: route.Component ? withComponentProps(route.Component) : void 0,
8125			HydrateFallback: route.HydrateFallback ? withHydrateFallbackProps(route.HydrateFallback) : void 0,
8126			ErrorBoundary: route.ErrorBoundary ? withErrorBoundaryProps(route.ErrorBoundary) : void 0,
8127			action: route.action ? (args) => route.action({
8128				...args,
8129				context
8130			}) : void 0,
8131			loader: route.loader ? (args) => route.loader({
8132				...args,
8133				context
8134			}) : void 0,
8135			middleware: route.middleware ? route.middleware.map((mw) => (...args) => mw({
8136				...args[0],
8137				context
8138			}, args[1])) : void 0,
8139			handle: route.handle,
8140			shouldRevalidate: route.shouldRevalidate
8141		};
8142		let entryRoute = {
8143			id: route.id,
8144			path: route.path,
8145			index: route.index,
8146			parentId,
8147			hasAction: route.action != null,
8148			hasLoader: route.loader != null,
8149			hasClientAction: false,
8150			hasClientLoader: false,
8151			hasClientMiddleware: false,
8152			hasErrorBoundary: route.ErrorBoundary != null,
8153			module: "build/stub-path-to-module.js",
8154			clientActionModule: void 0,
8155			clientLoaderModule: void 0,
8156			clientMiddlewareModule: void 0,
8157			hydrateFallbackModule: void 0
8158		};
vendor: 6,327 bytes, lines 8159-8356
8159		manifest.routes[newRoute.id] = entryRoute;
8160		routeModules[route.id] = {
8161			default: newRoute.Component || Outlet,
8162			ErrorBoundary: newRoute.ErrorBoundary || void 0,
8163			handle: route.handle,
8164			links: route.links,
8165			meta: route.meta,
8166			shouldRevalidate: route.shouldRevalidate
8167		};
8168		if (route.children) newRoute.children = processRoutes(route.children, context, manifest, routeModules, newRoute.id);
8169		return newRoute;
8170	});
8171}
8172var encoder = /* @__PURE__ */ new TextEncoder();
8173var sign = async (value, secret) => {
8174	let data2 = encoder.encode(value);
8175	let key = await createKey(secret, ["sign"]);
8176	let signature = await crypto.subtle.sign("HMAC", key, data2);
8177	let hash = btoa(String.fromCharCode(...new Uint8Array(signature))).replace(/=+$/, "");
8178	return value + "." + hash;
8179};
8180var unsign = async (cookie, secret) => {
8181	let index = cookie.lastIndexOf(".");
8182	let value = cookie.slice(0, index);
8183	let hash = cookie.slice(index + 1);
8184	let data2 = encoder.encode(value);
8185	let key = await createKey(secret, ["verify"]);
8186	try {
8187		let signature = byteStringToUint8Array(atob(hash));
8188		return await crypto.subtle.verify("HMAC", key, signature, data2) ? value : false;
8189	} catch (error) {
8190		return false;
8191	}
8192};
8193var createKey = async (secret, usages) => crypto.subtle.importKey("raw", encoder.encode(secret), {
8194	name: "HMAC",
8195	hash: "SHA-256"
8196}, false, usages);
8197function byteStringToUint8Array(byteString) {
8198	let array = new Uint8Array(byteString.length);
8199	for (let i = 0; i < byteString.length; i++) array[i] = byteString.charCodeAt(i);
8200	return array;
8201}
8202var createCookie = (name, cookieOptions = {}) => {
8203	let { secrets = [], ...options } = {
8204		path: "/",
8205		sameSite: "lax",
8206		...cookieOptions
8207	};
8208	warnOnceAboutExpiresCookie(name, options.expires);
8209	return {
8210		get name() {
8211			return name;
8212		},
8213		get isSigned() {
8214			return secrets.length > 0;
8215		},
8216		get expires() {
8217			return typeof options.maxAge !== "undefined" ? new Date(Date.now() + options.maxAge * 1e3) : options.expires;
8218		},
8219		async parse(cookieHeader, parseOptions) {
8220			if (!cookieHeader) return null;
8221			let cookies = (0, import_dist.parse)(cookieHeader, {
8222				...options,
8223				...parseOptions
8224			});
8225			if (name in cookies) {
8226				let value = cookies[name];
8227				if (typeof value === "string" && value !== "") return await decodeCookieValue(value, secrets);
8228				else return "";
8229			} else return null;
8230		},
8231		async serialize(value, serializeOptions) {
8232			return (0, import_dist.serialize)(name, value === "" ? "" : await encodeCookieValue(value, secrets), {
8233				...options,
8234				...serializeOptions
8235			});
8236		}
8237	};
8238};
8239var isCookie = (object) => {
8240	return object != null && typeof object.name === "string" && typeof object.isSigned === "boolean" && typeof object.parse === "function" && typeof object.serialize === "function";
8241};
8242async function encodeCookieValue(value, secrets) {
8243	let encoded = encodeData(value);
8244	if (secrets.length > 0) encoded = await sign(encoded, secrets[0]);
8245	return encoded;
8246}
8247async function decodeCookieValue(value, secrets) {
8248	if (secrets.length > 0) {
8249		for (let secret of secrets) {
8250			let unsignedValue = await unsign(value, secret);
8251			if (unsignedValue !== false) return decodeData(unsignedValue);
8252		}
8253		return null;
8254	}
8255	return decodeData(value);
8256}
8257function encodeData(value) {
8258	return btoa(myUnescape(encodeURIComponent(JSON.stringify(value))));
8259}
8260function decodeData(value) {
8261	try {
8262		return JSON.parse(decodeURIComponent(myEscape(atob(value))));
8263	} catch (error) {
8264		return {};
8265	}
8266}
8267function myEscape(value) {
8268	let str = value.toString();
8269	let result = "";
8270	let index = 0;
8271	let chr, code;
8272	while (index < str.length) {
8273		chr = str.charAt(index++);
8274		if (/[\w*+\-./@]/.exec(chr)) result += chr;
8275		else {
8276			code = chr.charCodeAt(0);
8277			if (code < 256) result += "%" + hex(code, 2);
8278			else result += "%u" + hex(code, 4).toUpperCase();
8279		}
8280	}
8281	return result;
8282}
8283function hex(code, length) {
8284	let result = code.toString(16);
8285	while (result.length < length) result = "0" + result;
8286	return result;
8287}
8288function myUnescape(value) {
8289	let str = value.toString();
8290	let result = "";
8291	let index = 0;
8292	let chr, part;
8293	while (index < str.length) {
8294		chr = str.charAt(index++);
8295		if (chr === "%") if (str.charAt(index) === "u") {
8296			part = str.slice(index + 1, index + 5);
8297			if (/^[\da-f]{4}$/i.exec(part)) {
8298				result += String.fromCharCode(parseInt(part, 16));
8299				index += 5;
8300				continue;
8301			}
8302		} else {
8303			part = str.slice(index, index + 2);
8304			if (/^[\da-f]{2}$/i.exec(part)) {
8305				result += String.fromCharCode(parseInt(part, 16));
8306				index += 2;
8307				continue;
8308			}
8309		}
8310		result += chr;
8311	}
8312	return result;
8313}
8314function warnOnceAboutExpiresCookie(name, expires) {
8315	warnOnce(!expires, `The "${name}" cookie has an "expires" property set. This will cause the expires value to not be updated when the session is committed. Instead, you should set the expires value when serializing the cookie. You can use \`commitSession(session, { expires })\` if using a session storage object, or \`cookie.serialize("value", { expires })\` if you're using the cookie directly.`);
8316}
8317function createEntryRouteModules(manifest) {
8318	return Object.keys(manifest).reduce((memo, routeId) => {
8319		let route = manifest[routeId];
8320		if (route) memo[routeId] = route.module;
8321		return memo;
8322	}, {});
8323}
8324var ServerMode = /* @__PURE__ */ ((ServerMode2) => {
8325	ServerMode2["Development"] = "development";
8326	ServerMode2["Production"] = "production";
8327	ServerMode2["Test"] = "test";
8328	return ServerMode2;
8329})(ServerMode || {});
8330function isServerMode(value) {
8331	return value === "development" || value === "production" || value === "test";
8332}
8333function sanitizeError(error, serverMode) {
8334	if (error instanceof Error && serverMode !== "development") {
8335		let sanitized = /* @__PURE__ */ new Error("Unexpected Server Error");
8336		sanitized.stack = void 0;
8337		return sanitized;
8338	}
8339	return error;
8340}
8341function sanitizeErrors(errors, serverMode) {
8342	return Object.entries(errors).reduce((acc, [routeId, error]) => {
8343		return Object.assign(acc, { [routeId]: sanitizeError(error, serverMode) });
8344	}, {});
8345}
8346function serializeError(error, serverMode) {
8347	let sanitized = sanitizeError(error, serverMode);
8348	return {
8349		message: sanitized.message,
8350		stack: sanitized.stack
8351	};
8352}
8353function serializeErrors(errors, serverMode) {
8354	if (!errors) return null;
8355	let entries = Object.entries(errors);
8356	let serialized = {};
8357	for (let [key, val] of entries) if (isRouteErrorResponse(val)) serialized[key] = {
8358		...val,
8359		__type: "RouteErrorResponse"
8360	};
8361	else if (val instanceof Error) {
8362		let sanitized = sanitizeError(val, serverMode);
8363		serialized[key] = {
8364			message: sanitized.message,
8365			stack: sanitized.stack,
8366			__type: "Error",
8367			...sanitized.name !== "Error" ? { __subType: sanitized.name } : {}
8368		};
8369	} else serialized[key] = val;
8370	return serialized;
8371}
8372function matchServerRoutes(routes, pathname, basename) {
8373	let matches = matchRoutes(routes, pathname, basename);
8374	if (!matches) return null;
8375	return matches.map((match) => ({
8376		params: match.params,
8377		pathname: match.pathname,
8378		route: match.route
8379	}));
8380}
8381async function callRouteHandler(handler, args, future) {
8382	let result = await handler({
8383		request: future.unstable_passThroughRequests ? args.request : stripRoutesParam(stripIndexParam(args.request)),
8384		unstable_url: args.unstable_url,
8385		params: args.params,
8386		context: args.context,
8387		unstable_pattern: args.unstable_pattern
8388	});
8389	if (isDataWithResponseInit(result) && result.init && result.init.status && isRedirectStatusCode(result.init.status)) throw new Response(null, result.init);
8390	return result;
8391}
8392function stripIndexParam(request) {
8393	let url = new URL(request.url);
8394	let indexValues = url.searchParams.getAll("index");
8395	url.searchParams.delete("index");
8396	let indexValuesToKeep = [];
8397	for (let indexValue of indexValues) if (indexValue) indexValuesToKeep.push(indexValue);
8398	for (let toKeep of indexValuesToKeep) url.searchParams.append("index", toKeep);
8399	let init = {
8400		method: request.method,
8401		body: request.body,
8402		headers: request.headers,
8403		signal: request.signal
8404	};
8405	if (init.body) init.duplex = "half";
8406	return new Request(url.href, init);
8407}
8408function stripRoutesParam(request) {
8409	let url = new URL(request.url);
8410	url.searchParams.delete("_routes");
8411	let init = {
8412		method: request.method,
8413		body: request.body,
8414		headers: request.headers,
8415		signal: request.signal
8416	};
8417	if (init.body) init.duplex = "half";
8418	return new Request(url.href, init);
8419}
8420function invariant$1(value, message) {
8421	if (value === false || value === null || typeof value === "undefined") {
8422		console.error("The following error is a bug in React Router; please open an issue! https://github.com/remix-run/react-router/issues/new/choose");
8423		throw new Error(message);
8424	}
8425}
8426var globalDevServerHooksKey = "__reactRouterDevServerHooks";
8427function setDevServerHooks(devServerHooks) {
8428	globalThis[globalDevServerHooksKey] = devServerHooks;
8429}
8430function getDevServerHooks() {
8431	return globalThis[globalDevServerHooksKey];
8432}
8433function getBuildTimeHeader(request, headerName) {
8434	if (typeof process !== "undefined") try {
8435		if (process.env?.IS_RR_BUILD_REQUEST === "yes") return request.headers.get(headerName);
8436	} catch (e) {}
8437	return null;
8438}
8439function groupRoutesByParentId(manifest) {
8440	let routes = {};
8441	Object.values(manifest).forEach((route) => {
8442		if (route) {
8443			let parentId = route.parentId || "";
8444			if (!routes[parentId]) routes[parentId] = [];
8445			routes[parentId].push(route);
8446		}
8447	});
8448	return routes;
8449}
8450function createRoutes(manifest, parentId = "", routesByParentId = groupRoutesByParentId(manifest)) {
8451	return (routesByParentId[parentId] || []).map((route) => ({
8452		...route,
8453		children: createRoutes(manifest, route.id, routesByParentId)
8454	}));
8455}
8456function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesByParentId = groupRoutesByParentId(manifest)) {
8457	return (routesByParentId[parentId] || []).map((route) => {
8458		let commonRoute = {
8459			hasErrorBoundary: route.id === "root" || route.module.ErrorBoundary != null,
8460			id: route.id,
8461			path: route.path,
8462			middleware: route.module.middleware,
8463			loader: route.module.loader ? async (args) => {
8464				let preRenderedData = getBuildTimeHeader(args.request, "X-React-Router-Prerender-Data");
8465				if (preRenderedData != null) {
8466					let encoded = preRenderedData ? decodeURI(preRenderedData) : preRenderedData;
8467					invariant$1(encoded, "Missing prerendered data for route");
8468					let uint8array = new TextEncoder().encode(encoded);
8469					let data2 = (await decodeViaTurboStream(new ReadableStream({ start(controller) {
8470						controller.enqueue(uint8array);
8471						controller.close();
8472					} }), global)).value;
8473					if (data2 && SingleFetchRedirectSymbol in data2) {
8474						let result = data2[SingleFetchRedirectSymbol];
8475						let init = { status: result.status };
8476						if (result.reload) throw redirectDocument(result.redirect, init);
8477						else if (result.replace) throw replace(result.redirect, init);
8478						else throw redirect(result.redirect, init);
8479					} else {
8480						invariant$1(data2 && route.id in data2, "Unable to decode prerendered data");
8481						let result = data2[route.id];
8482						invariant$1("data" in result, "Unable to process prerendered data");
8483						return result.data;
8484					}
8485				}
8486				return await callRouteHandler(route.module.loader, args, future);
8487			} : void 0,
8488			action: route.module.action ? (args) => callRouteHandler(route.module.action, args, future) : void 0,
8489			handle: route.module.handle
8490		};
8491		return route.index ? {
8492			index: true,
8493			...commonRoute
8494		} : {
8495			caseSensitive: route.caseSensitive,
8496			children: createStaticHandlerDataRoutes(manifest, future, route.id, routesByParentId),
8497			...commonRoute
8498		};
8499	});
8500}
8501function createServerHandoffString(serverHandoff) {
8502	return escapeHtml(JSON.stringify(serverHandoff));
8503}
8504function getDocumentHeaders(context, build) {
8505	return getDocumentHeadersImpl(context, (m) => {
8506		let route = build.routes[m.route.id];
8507		invariant$1(route, `Route with id "${m.route.id}" not found in build`);
8508		return route.module.headers;
8509	});
8510}
8511function getDocumentHeadersImpl(context, getRouteHeadersFn, _defaultHeaders) {
8512	let boundaryIdx = context.errors ? context.matches.findIndex((m) 
vendor: 2,090 bytes, lines 8512-8556
8512=> context.errors[m.route.id]) : -1;
8513	let matches = boundaryIdx >= 0 ? context.matches.slice(0, boundaryIdx + 1) : context.matches;
8514	let errorHeaders;
8515	if (boundaryIdx >= 0) {
8516		let { actionHeaders, actionData, loaderHeaders, loaderData } = context;
8517		context.matches.slice(boundaryIdx).some((match) => {
8518			let id = match.route.id;
8519			if (actionHeaders[id] && (!actionData || !actionData.hasOwnProperty(id))) errorHeaders = actionHeaders[id];
8520			else if (loaderHeaders[id] && !loaderData.hasOwnProperty(id)) errorHeaders = loaderHeaders[id];
8521			return errorHeaders != null;
8522		});
8523	}
8524	const defaultHeaders = new Headers(_defaultHeaders);
8525	return matches.reduce((parentHeaders, match, idx) => {
8526		let { id } = match.route;
8527		let loaderHeaders = context.loaderHeaders[id] || new Headers();
8528		let actionHeaders = context.actionHeaders[id] || new Headers();
8529		let includeErrorHeaders = errorHeaders != null && idx === matches.length - 1;
8530		let includeErrorCookies = includeErrorHeaders && errorHeaders !== loaderHeaders && errorHeaders !== actionHeaders;
8531		let headersFn = getRouteHeadersFn(match);
8532		if (headersFn == null) {
8533			let headers2 = new Headers(parentHeaders);
8534			if (includeErrorCookies) prependCookies(errorHeaders, headers2);
8535			prependCookies(actionHeaders, headers2);
8536			prependCookies(loaderHeaders, headers2);
8537			return headers2;
8538		}
8539		let headers = new Headers(typeof headersFn === "function" ? headersFn({
8540			loaderHeaders,
8541			parentHeaders,
8542			actionHeaders,
8543			errorHeaders: includeErrorHeaders ? errorHeaders : void 0
8544		}) : headersFn);
8545		if (includeErrorCookies) prependCookies(errorHeaders, headers);
8546		prependCookies(actionHeaders, headers);
8547		prependCookies(loaderHeaders, headers);
8548		prependCookies(parentHeaders, headers);
8549		return headers;
8550	}, new Headers(defaultHeaders));
8551}
8552function prependCookies(parentHeaders, childHeaders) {
8553	let parentSetCookieString = parentHeaders.get("Set-Cookie");
8554	if (parentSetCookieString) {
8555		let cookies = (0, import_set_cookie.splitCookiesString)(parentSetCookieString);
8556		let childCookies = new Set(childHeaders.getSetCookie());
8557		cookies.forEach((cookie) => {
8558			if (!childCookies.has(cookie)) childHeaders.append("Set-Cookie", cookie);
8559		});
8560	}
8561}
8562function throwIfPotentialCSRFAttack(headers, allowedActionOrigins) {
8563	let originHeader = headers.get("origin");
8564	let originDomain = null;
8565	try {
8566		originDomain = typeof originHeader === "string" && originHeader !== "null" ? new URL(originHeader).host : originHeader;
8567	} catch {
8568		throw new Error(`\`origin\` header is not a valid URL. Aborting the action.`);
8569	}
8570	let host = parseHostHeader(headers);
8571	if (originDomain && (!host || originDomain !== host.value)) {
8572		if (!isAllowedOrigin(originDomain, allowedActionOrigins)) if (host) throw new Error(`${host.type} header does not match \`origin\` header from a forwarded action request. Aborting the action.`);
8573		else throw new Error("`x-forwarded-host` or `host` headers are not provided. One of these is needed to compare the `origin` header from a forwarded action request. Aborting the action.");
8574	}
8575}
8576function matchWildcardDomain(domain, pattern) {
8577	const domainParts = domain.split(".");
8578	const patternParts = pattern.split(".");
8579	if (patternParts.length < 1) return false;
8580	if (domainParts.length < patternParts.length) return false;
8581	while (patternParts.length) {
8582		const patternPart = patternParts.pop();
8583		const domainPart = domainParts.pop();
8584		switch (patternPart) {
8585			case "": return false;
8586			case "*": if (domainPart) continue;
8587			else return false;
8588			case "**":
8589				if (patternParts.length > 0) return false;
8590				return domainPart !== void 0;
8591			case void 0:
8592			default: if (domainPart !== patternPart) return false;
8593		}
8594	}
8595	return domainParts.length === 0;
8596}
8597function isAllowedOrigin(originDomain, allowedActionOrigins = []) {
8598	return allowedActionOrigins.some((allowedOrigin) => allowedOrigin && (allowedOrigin === originDomain || matchWildcardDomain(originDomain, allowedOrigin)));
8599}
8600function parseHostHeader(headers) {
8601	let forwardedHostValue = headers.get("x-forwarded-host")?.split(",")[0]?.trim();
8602	let hostHeader = headers.get("host");
8603	return forwardedHostValue ? {
8604		type: "x-forwarded-host",
8605		value: forwardedHostValue
8606	} : hostHeader ? {
8607		type: "host",
8608		value: hostHeader
8609	} : void 0;
8610}
8611function getNormalizedPath(request, basename, future) {
8612	basename = basename || "/";
8613	let url = new URL(request.url);
8614	let pathname = url.pathname;
8615	if (future?.unstable_trailingSlashAwareDataRequests) if (pathname.endsWith("/_.data")) pathname = pathname.replace(/_\.data$/, "");
8616	else pathname = pathname.replace(/\.data$/, "");
8617	else {
8618		if (stripBasename(pathname, basename) === "/_root.data") pathname = basename;
8619		else if (pathname.endsWith(".data")) pathname = pathname.replace(/\.data$/, "");
8620		if (stripBasename(pathname, basename) !== "/" && pathname.endsWith("/")) pathname = pathname.slice(0, -1);
8621	}
8622	let searchParams = new URLSearchParams(url.search);
8623	searchParams.delete("_routes");
8624	let search = searchParams.toString();
8625	if (search) search = `?${search}`;
8626	return {
8627		pathname,
8628		search,
8629		hash: ""
8630	};
8631}
8632var SERVER_NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([...NO_BODY_STATUS_CODES, 304]);
8633async function singleFetchAction(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) {
8634	try {
8635		try {
8636			throwIfPotentialCSRFAttack(request.headers, Array.isArray(build.allowedActionOrigins) ? build.allowedActionOrigins : []);
8637		} catch (e) {
8638			return handleQueryError(/* @__PURE__ */ new Error("Bad Request"), 400);
8639		}
8640		let handlerRequest = build.future.unstable_passThroughRequests ? request : new Request(handlerUrl, {
8641			method: request.method,
8642			body: request.body,
8643			headers: request.headers,
8644			signal: request.signal,
8645			...request.body ? { duplex: "half" } : void 0
8646		});
8647		return handleQueryResult(await staticHandler.query(handlerRequest, {
8648			requestContext: loadContext,
8649			skipLoaderErrorBubbling: true,
8650			skipRevalidation: true,
8651			generateMiddlewareResponse: build.future.v8_middleware ? async (query) => {
8652				try {
8653					return handleQueryResult(await query(handlerRequest));
8654				} catch (error) {
8655					return handleQueryError(error);
8656				}
8657			} : void 0,
8658			unstable_normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
8659		}));
8660	} catch (error) {
8661		return handleQueryError(error);
8662	}
8663	function handleQueryResult(result) {
8664		return isResponse(result) ? result : staticContextToResponse(result);
8665	}
8666	function handleQueryError(error, status = 500) {
8667		handleError(error);
8668		return generateSingleFetchResponse(request, build, serverMode, {
8669			result: { error },
8670			headers: new Headers(),
8671			status
8672		});
8673	}
8674	function staticContextToResponse(context) {
8675		let headers = getDocumentHeaders(context, build);
8676		if (isRedirectStatusCode(context.statusCode) && headers.has("Location")) return new Response(null, {
8677			status: context.statusCode,
8678			headers
8679		});
8680		if (context.errors) {
8681			Object.values(context.errors).forEach((err) => {
8682				if (!isRouteErrorResponse(err) || err.error) handleError(err);
8683			});
8684			context.errors = sanitizeErrors(context.errors, serverMode);
8685		}
8686		let singleFetchResult;
8687		if (context.errors) singleFetchResult = { error: Object.values(context.errors)[0] };
8688		else singleFetchResult = { data: Object.values(context.actionData || {})[0] };
8689		return generateSingleFetchResponse(request, build, serverMode, {
8690			result: singleFetchResult,
8691			headers,
8692			status: context.statusCode
8693		});
8694	}
8695}
8696async function singleFetchLoaders(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) {
8697	let routesParam = new URL(request.url).searchParams.get("_routes");
8698	let loadRouteIds = routesParam ? new Set(routesParam.split(",")) : null;
8699	try {
8700		let handlerRequest = build.future.unstable_passThroughRequests ? request : new Request(handlerUrl, {
8701			headers: request.headers,
8702			signal: request.signal
8703		});
8704		return handleQueryResult(await staticHandler.query(handlerRequest, {
8705			requestContext: loadContext,
8706			filterMatchesToLoad: (m) => !loadRouteIds || loadRouteIds.has(m.route.id),
8707			skipLoaderErrorBubbling: true,
8708			generateMiddlewareResponse: build.future.v8_middleware ? async (query) => {
8709				try {
8710					return handleQueryResult(await query(handlerRequest));
8711				} catch (error) {
8712					return handleQueryError(error);
8713				}
8714			} : void 0,
8715			unstable_normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
8716		}));
8717	} catch (error) {
8718		return handleQueryError(error);
8719	}
8720	function handleQueryResult(result) {
8721		return isResponse(result) ? result : staticContextToResponse(result);
8722	}
8723	function handleQueryError(error) {
8724		handleError(error);
8725		return generateSingleFetchResponse(request, build, serverMode, {
8726			result: { error },
8727			headers: new Headers(),
8728			status: 500
8729		});
8730	}
8731	function staticContextToResponse(context) {
8732		let headers = getDocumentHeaders(context, build);
8733		if (isRedirectStatusCode(context.statusCode) && headers.has("Location")) return new Response(null, {
8734			status: context.statusCode,
8735			headers
8736		});
8737		if (context.errors) {
8738			Object.values(context.errors).forEach((err) => {
8739				if (!isRouteErrorResponse(err) || err.error) handleError(err);
8740			});
8741			context.errors = sanitizeErrors(context.errors, serverMode);
8742		}
8743		let results = {};
8744		let loadedMatches = new Set(context.matches.filter((m) => loadRouteIds ? loadRouteIds.has(m.route.id) : m.route.loader != null).map((m) => m.route.id));
8745		if (context.errors) for (let [id, error] of Object.entries(context.errors)) results[id] = { error };
8746		for (let [id, data2] of Object.entries(context.loaderData)) if (!(id in results) && loadedMatches.has(id)) results[id] = { data: data2 };
8747		return generateSingleFetchResponse(request, build, serverMode, {
8748			result: results,
8749			headers,
8750			status: context.statusCode
8751		});
8752	}
8753}
8754function generateSingleFetchResponse(request, build, serverMode, { result, headers, status }) {
8755	let resultHeaders = new Headers(headers);
8756	resultHeaders.set("X-Remix-Response", "yes");
8757	if (SERVER_NO_BODY_STATUS_CODES.has(status)) return new Response(null, {
8758		status,
8759		headers: resultHeaders
8760	});
8761	resultHeaders.set("Content-Type", "text/x-script");
8762	resultHeaders.delete("Content-Length");
8763	return new Response(encodeViaTurboStream(result, request.signal, build.entry.module.streamTimeout, serverMode), {
8764		status: status || 200,
8765		headers: resultHeaders
8766	});
8767}
8768function generateSingleFetchRedirectResponse(redirectResponse, request, build, serverMode) {
8769	let redirect2 = getSingleFetchRedirect(redirectResponse.status, redirectResponse.headers, build.basename);
8770	let headers = new Headers(redirectResponse.headers);
8771	headers.delete("Location");
8772	headers.set("Content-Type", "text/x-script");
8773	return generateSingleFetchResponse(request, build, serverMode, {
8774		result: request.method === "GET" ? { [SingleFetchRedirectSymbol]: redirect2 } : redirect2,
8775		headers,
8776		status: 202
8777	});
8778}
8779function getSingleFetchRedirect(status, headers, basename) {
8780	let redirect2 = headers.get("Location");
8781	if (basename) redirect2 = stripBasename(redirect2, basename) || redirect2;
8782	return {
8783		redirect: redirect2,
8784		status,
8785		revalidate: headers.has("X-Remix-Revalidate") || headers.has("Set-Cookie"),
8786		reload: headers.has("X-Remix-Reload-Document"),
8787		replace: headers.has("X-Remix-Replace")
8788	};
8789}
8790function encodeViaTurboStream(data2, requestSignal, streamTimeout, serverMode) {
8791	let controller = new AbortController();
8792	let timeoutId = setTimeout(() => controller.abort(/* @__PURE__ */ new Error("Server Timeout")), typeof streamTimeout === "number" ? streamTimeout : 4950);
8793	let clearStreamTimeout = () => clearTimeout(timeoutId);
8794	requestSignal.addEventListener("abort", clearStreamTimeout);
8795	return encode(data2, {
8796		signal: controller.signal,
8797		onComplete: clearStreamTimeout,
8798		plugins: [(value) => {
8799			if (value instanceof Error) {
8800				let { name, message, stack } = serverMode === "production" ? sanitizeError(value, serverMode) : value;
8801				return [
8802					"SanitizedError",
8803					name,
8804					message,
8805					stack
8806				];
8807			}
8808			if (value instanceof ErrorResponseImpl) {
8809				let { data: data3, status, statusText } = value;
8810				return [
8811					"ErrorResponse",
8812					data3,
8813					status,
8814					statusText
8815				];
8816			}
8817			if (value && typeof value === "object" && SingleFetchRedirectSymbol in value) return ["SingleFetchRedirect", value[SingleFetchRedirectSymbol]];
8818		}],
8819		postPlugins: [(value) => {
8820			if (!value) return;
8821			if (typeof value !== "object") return;
8822			return ["SingleFetchClassInstance", Object.fromEntries(Object.entries(value))];
8823		}, () => ["SingleFetchFallback"]]
8824	});
8825}
8826function derive(build, mode) {
8827	let routes = createRoutes(build.routes);
8828	let dataRoutes = createStaticHandlerDataRoutes(build.routes, build.future);
8829	let serverMode = isServerMode(mode) ? mode : "production";
8830	let staticHandler = createStaticHandler(dataRoutes, {
8831		basename: build.basename,
8832		unstable_instrumentations: build.entry.module.unstable_instrumentations
8833	});
8834	let errorHandler = build.entry.module.handleError || ((error, { request }) => {
8835		if (serverMode !== "test" && !request.signal.aborted) console.error(isRouteErrorResponse(error) && error.error ? error.error : error);
8836	});
8837	let requestHandler = async (request, initialContext) => {
8838		let params = {};
8839		let loadContext;
8840		let handleError = (error) => {
8841			if (mode === "development") getDevServerHooks()?.processRequestError?.(error);
8842			errorHandler(error, {
8843				context: loadContext,
8844				params,
8845				request
8846			});
8847		};
8848		if (build.future.v8_middleware) {
8849			if (initialContext && !(initialContext instanceof RouterContextProvider)) {
8850				let error = /* @__PURE__ */ new Error("Invalid `context` value provided to `handleRequest`. When middleware is enabled you must return an instance of `RouterContextProvider` from your `getLoadContext` function.");
8851				handleError(error);
8852				return returnLastResortErrorResponse(error, serverMode);
8853			}
8854			loadContext = initialContext || new RouterContextProvider();
8855		} else loadContext = initialContext || {};
8856		let requestUrl = new URL(request.url);
8857		let normalizedPathname = getNormalizedPath(request, build.basename, build.future).pathname;
8858		let isSpaMode = getBuildTimeHeader(request, "X-React-Router-SPA-Mode") === "yes";
8859		if (!build.ssr) {
8860			let decodedPath = decodeURI(normalizedPathname);
8861			if (build.basename && build.basename !== "/") {
8862				let strippedPath = stripBasename(decodedPath, build.basename);
8863				if (strippedPath == null) {
8864					errorHandler(new ErrorResponseImpl(404, "Not Found", `Refusing to prerender the \`${decodedPath}
vendor: 4,373 bytes, lines 8864-8963
8864\` path because it does not start with the basename \`${build.basename}\``), {
8865						context: loadContext,
8866						params,
8867						request
8868					});
8869					return new Response("Not Found", {
8870						status: 404,
8871						statusText: "Not Found"
8872					});
8873				}
8874				decodedPath = strippedPath;
8875			}
8876			if (build.prerender.length === 0) isSpaMode = true;
8877			else if (!build.prerender.includes(decodedPath) && !build.prerender.includes(decodedPath + "/")) if (requestUrl.pathname.endsWith(".data")) {
8878				errorHandler(new ErrorResponseImpl(404, "Not Found", `Refusing to SSR the path \`${decodedPath}\` because \`ssr:false\` is set and the path is not included in the \`prerender\` config, so in production the path will be a 404.`), {
8879					context: loadContext,
8880					params,
8881					request
8882				});
8883				return new Response("Not Found", {
8884					status: 404,
8885					statusText: "Not Found"
8886				});
8887			} else isSpaMode = true;
8888		}
8889		let manifestUrl = getManifestPath(build.routeDiscovery.manifestPath, build.basename);
8890		if (requestUrl.pathname === manifestUrl) try {
8891			return await handleManifestRequest(build, routes, requestUrl);
8892		} catch (e) {
8893			handleError(e);
8894			return new Response("Unknown Server Error", { status: 500 });
8895		}
8896		let matches = matchServerRoutes(routes, normalizedPathname, build.basename);
8897		if (matches && matches.length > 0) Object.assign(params, matches[0].params);
8898		let response;
8899		if (requestUrl.pathname.endsWith(".data")) {
8900			let singleFetchMatches = matchServerRoutes(routes, normalizedPathname, build.basename);
8901			response = await handleSingleFetchRequest(serverMode, build, staticHandler, request, normalizedPathname, loadContext, handleError);
8902			if (isRedirectResponse(response)) response = generateSingleFetchRedirectResponse(response, request, build, serverMode);
8903			if (build.entry.module.handleDataRequest) {
8904				response = await build.entry.module.handleDataRequest(response, {
8905					context: loadContext,
8906					params: singleFetchMatches ? singleFetchMatches[0].params : {},
8907					request
8908				});
8909				if (isRedirectResponse(response)) response = generateSingleFetchRedirectResponse(response, request, build, serverMode);
8910			}
8911		} else if (!isSpaMode && matches && matches[matches.length - 1].route.module.default == null && matches[matches.length - 1].route.module.ErrorBoundary == null) response = await handleResourceRequest(serverMode, build, staticHandler, matches.slice(-1)[0].route.id, request, loadContext, handleError);
8912		else {
8913			let { pathname } = requestUrl;
8914			let criticalCss = void 0;
8915			if (build.unstable_getCriticalCss) criticalCss = await build.unstable_getCriticalCss({ pathname });
8916			else if (mode === "development" && getDevServerHooks()?.getCriticalCss) criticalCss = await getDevServerHooks()?.getCriticalCss?.(pathname);
8917			response = await handleDocumentRequest(serverMode, build, staticHandler, request, loadContext, handleError, isSpaMode, criticalCss);
8918		}
8919		if (request.method === "HEAD") return new Response(null, {
8920			headers: response.headers,
8921			status: response.status,
8922			statusText: response.statusText
8923		});
8924		return response;
8925	};
8926	if (build.entry.module.unstable_instrumentations) requestHandler = instrumentHandler(requestHandler, build.entry.module.unstable_instrumentations.map((i) => i.handler).filter(Boolean));
8927	return {
8928		routes,
8929		dataRoutes,
8930		serverMode,
8931		staticHandler,
8932		errorHandler,
8933		requestHandler
8934	};
8935}
8936var createRequestHandler = (build, mode) => {
8937	let _build;
8938	let routes;
8939	let serverMode;
8940	let staticHandler;
8941	let errorHandler;
8942	let _requestHandler;
8943	return async function requestHandler(request, initialContext) {
8944		_build = typeof build === "function" ? await build() : build;
8945		if (typeof build === "function") {
8946			let derived = derive(_build, mode);
8947			routes = derived.routes;
8948			serverMode = derived.serverMode;
8949			staticHandler = derived.staticHandler;
8950			errorHandler = derived.errorHandler;
8951			_requestHandler = derived.requestHandler;
8952		} else if (!routes || !serverMode || !staticHandler || !errorHandler || !_requestHandler) {
8953			let derived = derive(_build, mode);
8954			routes = derived.routes;
8955			serverMode = derived.serverMode;
8956			staticHandler = derived.staticHandler;
8957			errorHandler = derived.errorHandler;
8958			_requestHandler = derived.requestHandler;
8959		}
8960		return _requestHandler(request, initialContext);
8961	};
8962};
8963async function handleManifestRequest(build, routes, url) {
8964	if (build.assets.version !== url.searchParams.get("version")) return new Response(null, {
8965		status: 204,
8966		headers: { "X-Remix-Reload-Document": "true" }
8967	});
8968	let patches = {};
8969	if (url.searchParams.has("paths")) {
8970		let paths = /* @__PURE__ */ new Set();
8971		(url.searchParams.get("paths") || "").split(",").filter(Boolean).forEach((path) => {
8972			if (!path.startsWith("/")) path = `/${path}`;
8973			let segments = path.split("/").slice(1);
8974			segments.forEach((_, i) => {
8975				let partialPath = segments.slice(0, i + 1).join("/");
8976				paths.add(`/${partialPath}`);
8977			});
8978		});
8979		for (let path of paths) {
8980			let matches = matchServerRoutes(routes, path, build.basename);
8981			if (matches) for (let match of matches) {
8982				let routeId = match.route.id;
8983				let route = build.assets.routes[routeId];
8984				if (route) patches[routeId] = route;
8985			}
8986		}
8987		return Response.json(patches, { headers: { "Cache-Control": "public, max-age=31536000, immutable" } });
8988	}
8989	return new Response("Invalid Request", { status: 400 });
8990}
8991async function handleSingleFetchRequest(serverMode, build, staticHandler, request, normalizedPath, loadContext, handleError) {
8992	let handlerUrl = new URL(request.url);
8993	handlerUrl.pathname = normalizedPath;
8994	return request.method !== "GET" ? await singleFetchAction(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) : await singleFetchLoaders(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError);
8995}
8996async function handleDocumentRequest(serverMode, build, staticHandler, request, loadContext, handleError, isSpaMode, criticalCss) {
8997	try {
8998		if (request.method === "POST") try {
8999			throwIfPotentialCSRFAttack(request.headers, Array.isArray(build.allowedActionOrigins) ? build.allowedActionOrigins : []);
9000		} catch (e) {
9001			handleError(e);
9002			return new Response("Bad Request", { status: 400 });
9003		}
9004		let result = await staticHandler.query(request, {
9005			requestContext: loadContext,
9006			generateMiddlewareResponse: build.future.v8_middleware ? async (query) => {
9007				try {
9008					let innerResult = await query(request);
9009					if (!isResponse(innerResult)) innerResult = await renderHtml(innerResult, isSpaMode);
9010					return innerResult;
9011				} catch (error) {
9012					handleError(error);
9013					return new Response(null, { status: 500 });
9014				}
9015			} : void 0,
9016			unstable_normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
9017		});
9018		if (!isResponse(result)) result = await renderHtml(result, isSpaMode);
9019		return result;
9020	} catch (error) {
9021		handleError(error);
9022		return new Response(null, { status: 500 });
9023	}
9024	async function renderHtml(context, isSpaMode2) {
9025		let headers = getDocumentHeaders(context, build);
9026		if (SERVER_NO_BODY_STATUS_CODES.has(context.statusCode)) return new Response(null, {
9027			status: context.statusCode,
9028			headers
9029		});
9030		if (context.errors) {
9031			Object.values(context.errors).forEach((err) => {
9032				if (!isRouteErrorResponse(err) || err.error) handleError(err);
9033			});
9034			context.errors = sanitizeErrors(context.errors, serverMode);
9035		}
9036		let state = {
9037			loaderData: context.loaderData,
9038			actionData: context.actionData,
9039			errors: serializeErrors(context.errors, serverMode)
9040		};
9041		let baseServerHandoff = {
9042			basename: build.basename,
9043			future: build.future,
9044			routeDiscovery: build.routeDiscovery,
9045			ssr: build.ssr,
9046			isSpaMode: isSpaMode2
9047		};
9048		let entryContext = {
9049			manifest: build.assets,
9050			routeModules: createEntryRouteModules(build.routes),
9051			staticHandlerContext: context,
9052			criticalCss,
9053			serverHandoffString: createServerHandoffString({
9054				...baseServerHandoff,
9055				criticalCss
9056			}),
9057			serverHandoffStream: encodeViaTurboStream(state, request.signal, build.entry.module.streamTimeout, serverMode),
9058			renderMeta: {},
9059			future: build.future,
9060			ssr: build.ssr,
9061			routeDiscovery: build.routeDiscovery,
9062			isSpaMode: isSpaMode2,
9063			serializeError: (err) => serializeError(err, serverMode)
9064		};
9065		let handleDocumentRequestFunction = build.entry.module.default;
9066		try {
9067			return await handleDocumentRequestFunction(request, context.statusCode, headers, entryContext, loadContext);
9068		} catch (error) {
9069			handleError(error);
9070			let errorForSecondRender = error;
9071			if (isResponse(error)) try {
9072				let data2 = await unwrapResponse(error);
9073				errorForSecondRender = new ErrorResponseImpl(error.status, error.statusText, data2);
9074			} catch (e) {}
9075			context = getStaticContextFromError(staticHandler.dataRoutes, context, errorForSecondRender);
9076			if (context.errors) context.errors = sanitizeErrors(context.errors, serverMode);
9077			let state2 = {
9078				loaderData: context.loaderData,
9079				actionData: context.actionData,
9080				errors: serializeErrors(context.errors, serverMode)
9081			};
9082			entryContext = {
9083				...entryContext,
9084				staticHandlerContext: context,
9085				serverHandoffString: createServerHandoffString(baseServerHandoff),
9086				serverHandoffStream: encodeViaTurboStream(state2, request.signal, build.entry.module.streamTimeout, serverMode),
9087				renderMeta: {}
9088			};
9089			try {
9090				return await handleDocumentRequestFunction(request, context.statusCode, headers, entryContext, loadContext);
9091			} catch (error2) {
9092				handleError(error2);
9093				return returnLastResortErrorResponse(error2, serverMode);
9094			}
9095		}
9096	}
9097}
9098async function handleResourceRequest(serverMode, build, staticHandler, routeId, request, loadContext, handleError) {
9099	try {
9100		return handleQueryRouteResult(await staticHandler.queryRoute(request, {
9101			routeId,
9102			requestContext: loadContext,
9103			generateMiddlewareResponse: build.future.v8_middleware ? async (queryRoute) => {
9104				try {
9105					return handleQueryRouteResult(await queryRoute(request));
9106				} catch (error) {
9107					return handleQueryRouteError(error);
9108				}
9109			} : void 0,
9110			unstable_normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
9111		}));
9112	} catch (error) {
9113		return handleQueryRouteError(error);
9114	}
9115	function handleQueryRouteResult(result) {
9116		if (isResponse(result)) return result;
9117		if (typeof result === "string") return new Response(result);
9118		return Response.json(result);
9119	}
9120	function handleQueryRouteError(error) {
9121		if (isResponse(error)) return error;
9122		if (isRouteErrorResponse(error)) {
9123			handleError(error);
9124			return errorResponseToJson(error, serverMode);
9125		}
9126		if (error instanceof Error && error.message === "Expected a response from queryRoute") {
9127			let newError = /* @__PURE__ */ new Error("Expected a Response to be returned from resource route handler");
9128			handleError(newError);
9129			return returnLastResortErrorResponse(newError, serverMode);
9130		}
9131		handleError(error);
9132		return returnLastResortErrorResponse(error, serverMode);
9133	}
9134}
9135function errorResponseToJson(errorResponse, serverMode) {
9136	return Response.json(serializeError(errorResponse.error || /* @__PURE__ */ new Error("Unexpected Server Error"), serverMode), {
9137		status: errorResponse.status,
9138		statusText: errorResponse.statusText
9139	});
9140}
9141function returnLastResortErrorResponse(error, serverMode) {
9142	let message = "Unexpected Server Error";
9143	if (serverMode !== "production") message += `
9144
9145${String(error)}`;
9146	return new Response(message, {
9147		status: 500,
9148		headers: { "Content-Type": "text/plain" }
9149	});
9150}
9151function unwrapResponse(response) {
9152	let contentType = response.headers.get("Content-Type");
9153	return contentType && /\bapplication\/json\b/.test(contentType) ? response.body == null ? null : response.json() : response.text();
9154}
9155function flash(name) {
9156	return `__flash_${name}__`;
9157}
9158var createSession = (initialData = {}, id = "") => {
9159	let map = new Map(Object.entries(initialData));
9160	return {
9161		get id() {
9162			return id;
9163		},
9164		get data() {
9165			return Object.fromEntries(map);
9166		},
9167		has(name) {
9168			return map.has(name) || map.has(flash(name));
9169		},
9170		get(name) {
9171			if (map.has(name)) return map.get(name);
9172			let flashName = flash(name);
9173			if (map.has(flashName)) {
9174				let value = map.get(flashName);
9175				map.delete(flashName);
9176				return value;
9177			}
9178		},
9179		set(name, value) {
9180			map.set(name, value);
9181		},
9182		flash(name, value) {
9183			map.set(flash(name), value);
9184		},
9185		unset(name) {
9186			map.delete(name);
9187		}
9188	};
9189};
9190var isSession = (object) => {
9191	return object != null && typeof object.id === "string" && typeof object.data !== "undefined" && typeof object.has === "function" && typeof object.get === "function" && typeof object.set === "function" && typeof object.flash === "function" && typeof object.unset === "function";
9192};
9193function createSessionStorage({ cookie: cookieArg, createData, readData, updateData, deleteData }) {
9194	let cookie = isCookie(cookieArg) ? cookieArg : createCookie(cookieArg?.name || "__session", cookieArg);
9195	warnOnceAboutSigningSessionCookie(cookie);
9196	return {
9197		async getSession(cookieHeader, options) {
9198			let id = cookieHeader && await cookie.parse(cookieHeader, options);
9199			return createSession(id && await readData(id) || {}, id || "");
9200		},
9201		async commitSession(session, options) {
9202			let { id, data: data2 } = session;
9203			let expires = options?.maxAge != null ? new Date(Date.now() + options.maxAge * 1e3) : options?.expires != null ? options.expires : co
9203okie.expires;
9204			if (id) await updateData(id, data2, expires);
9205			else id = await createData(data2, expires);
9206			return cookie.serialize(id, options);
9207		},
9208		async destroySession(session, options) {
9209			await deleteData(session.id);
9210			return cookie.serialize("", {
9211				...options,
9212				maxAge: void 0,
9213				expires: /* @__PURE__ */ new Date(0)
9214			});
9215		}
9216	};
9217}
9218function warnOnceAboutSigningSessionCookie(cookie) {
9219	warnOnce(cookie.isSigned, `The "${cookie.name}" cookie is not signed, but session cookies should be signed to prevent tampering on the client before they are sent back to the server. See https://reactrouter.com/explanation/sessions-and-cookies#signing-cookies for more information.`);
9220}
9221function createCookieSessionStorage({ cookie: cookieArg } = {}) {
9222	let cookie = isCookie(cookieArg) ? cookieArg : createCookie(cookieArg?.name || "__session", cookieArg);
9223	warnOnceAboutSigningSessionCookie(cookie);
9224	return {
9225		async getSession(cookieHeader, options) {
9226			return createSession(cookieHeader && await cookie.parse(cookieHeader, options) || {});
9227		},
9228		async commitSession(session, options) {
9229			let serializedCookie = await cookie.serialize(session.data, options);
9230			if (serializedCookie.length > 4096) throw new Error("Cookie length will exceed browser maximum. Length: " + serializedCookie.length);
9231			return serializedCookie;
9232		},
9233		async destroySession(_session, options) {
9234			return cookie.serialize("", {
9235				...options,
9236				maxAge: void 0,
9237				expires: /* @__PURE__ */ new Date(0)
9238			});
9239		}
9240	};
9241}
9242function createMemorySessionStorage({ cookie } = {}) {
9243	let map = /* @__PURE__ */ new Map();
9244	return createSessionStorage({
9245		cookie,
9246		async createData(data2, expires) {
9247			let id = Math.random().toString(36).substring(2, 10);
9248			map.set(id, {
9249				data: data2,
9250				expires
9251			});
9252			return id;
9253		},
9254		async readData(id) {
9255			if (map.has(id)) {
9256				let { data: data2, expires } = map.get(id);
9257				if (!expires || expires > /* @__PURE__ */ new Date()) return data2;
9258				if (expires) map.delete(id);
9259			}
9260			return null;
9261		},
9262		async updateData(id, data2, expires) {
9263			map.set(id, {
9264				data: data2,
9265				expires
9266			});
9267		},
9268		async deleteData(id) {
9269			map.delete(id);
9270		}
9271	});
9272}
9273function href(path, ...args) {
9274	let params = args[0];
9275	let result = trimTrailingSplat(path).replace(/\/:([\w-]+)(\?)?/g, (_, param, questionMark) => {
9276		const isRequired = questionMark === void 0;
9277		const value = params?.[param];
9278		if (isRequired && value === void 0) throw new Error(`Path '${path}' requires param '${param}' but it was not provided`);
9279		return value === void 0 ? "" : "/" + value;
9280	});
9281	if (path.endsWith("*")) {
9282		const value = params?.["*"];
9283		if (value !== void 0) result += "/" + value;
9284	}
9285	return result || "/";
9286}
9287function trimTrailingSplat(path) {
9288	let i = path.length - 1;
9289	let char = path[i];
9290	if (char !== "*" && char !== "/") return path;
9291	i--;
9292	for (; i >= 0; i--) if (path[i] !== "/") break;
9293	return path.slice(0, i + 1);
9294}
9295var encoder2 = new TextEncoder();
9296var trailer = "</body></html>";
9297function injectRSCPayload(rscStream) {
9298	let decoder = new TextDecoder();
9299	let resolveFlightDataPromise;
9300	let flightDataPromise = new Promise((resolve) => resolveFlightDataPromise = resolve);
9301	let startedRSC = false;
9302	let buffered = [];
9303	let timeout = null;
9304	function flushBufferedChunks(controller) {
9305		for (let chunk of buffered) {
9306			let buf = decoder.decode(chunk, { stream: true });
9307			if (buf.endsWith(trailer)) buf = buf.slice(0, -trailer.length);
9308			controller.enqueue(encoder2.encode(buf));
9309		}
9310		buffered.length = 0;
9311		timeout = null;
9312	}
9313	return new TransformStream({
9314		transform(chunk, controller) {
9315			buffered.push(chunk);
9316			if (timeout) return;
9317			timeout = setTimeout(async () => {
9318				flushBufferedChunks(controller);
9319				if (!startedRSC) {
9320					startedRSC = true;
9321					writeRSCStream(rscStream, controller).catch((err) => controller.error(err)).then(resolveFlightDataPromise);
9322				}
9323			}, 0);
9324		},
9325		async flush(controller) {
9326			await flightDataPromise;
9327			if (timeout) {
9328				clearTimeout(timeout);
9329				flushBufferedChunks(controller);
9330			}
9331			controller.enqueue(encoder2.encode("</body></html>"));
9332		}
9333	});
9334}
9335async function writeRSCStream(rscStream, controller) {
9336	let decoder = new TextDecoder("utf-8", { fatal: true });
9337	const reader = rscStream.getReader();
9338	try {
9339		let read;
9340		while ((read = await reader.read()) && !read.done) {
9341			const chunk = read.value;
9342			try {
9343				writeChunk(JSON.stringify(decoder.decode(chunk, { stream: true })), controller);
9344			} catch (err) {
9345				writeChunk(`Uint8Array.from(atob(${JSON.stringify(btoa(String.fromCodePoint(...chunk)))}), m => m.codePointAt(0))`, controller);
9346			}
9347		}
9348	} finally {
9349		reader.releaseLock();
9350	}
9351	let remaining = decoder.decode();
9352	if (remaining.length) writeChunk(JSON.stringify(remaining), controller);
9353}
9354function writeChunk(chunk, controller) {
9355	controller.enqueue(encoder2.encode(`<script>${escapeScript(`(self.__FLIGHT_DATA||=[]).push(${chunk})`)}<\/script>`));
9356}
9357function escapeScript(script) {
9358	return script.replace(/<!--/g, "<\\!--").replace(/<\/(script)/gi, "</\\$1");
9359}
9360var RSCRouterGlobalErrorBoundary = class extends import_react.Component {
9361	constructor(props) {
9362		super(props);
9363		this.state = {
9364			error: null,
9365			location: props.location
9366		};
9367	}
9368	static getDerivedStateFromError(error) {
9369		return { error };
9370	}
9371	static getDerivedStateFromProps(props, state) {
9372		if (state.location !== props.location) return {
9373			error: null,
9374			location: props.location
9375		};
9376		return {
9377			error: state.error,
9378			location: state.location
9379		};
9380	}
9381	render() {
9382		if (this.state.error) return /* @__PURE__ */ import_react.createElement(RSCDefaultRootErrorBoundaryImpl, {
9383			error: this.state.error,
9384			renderAppShell: true
9385		});
9386		else return this.props.children;
9387	}
9388};
9389function ErrorWrapper({ renderAppShell, title, children }) {
9390	if (!renderAppShell) return children;
9391	return /* @__PURE__ */ import_react.createElement("html", { lang: "en" }, /* @__PURE__ */ import_react.createElement("head", null, /* @__PURE__ */ import_react.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ import_react.createElement("meta", {
9392		name: "viewport",
9393		content: "width=device-width,initial-scale=1,viewport-fit=cover"
9394	}
9394), /* @__PURE__ */ import_react.createElement("title", null, title)), /* @__PURE__ */ import_react.createElement("body", null, /* @__PURE__ */ import_react.createElement("main", { style: {
9395		fontFamily: "system-ui, sans-serif",
9396		padding: "2rem"
9397	} }, children)));
9398}
9399function RSCDefaultRootErrorBoundaryImpl({ error, renderAppShell }) {
9400	console.error(error);
9401	let heyDeveloper = /* @__PURE__ */ import_react.createElement("script", { dangerouslySetInnerHTML: { __html: `
9402        console.log(
9403          "\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."
9404        );
9405      ` } });
9406	if (isRouteErrorResponse(error)) return /* @__PURE__ */ import_react.createElement(ErrorWrapper, {
9407		renderAppShell,
9408		title: "Unhandled Thrown Response!"
9409	}, /* @__PURE__ */ import_react.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText), heyDeveloper);
9410	let errorInstance;
9411	if (error instanceof Error) errorInstance = error;
9412	else {
9413		let errorString = error == null ? "Unknown Error" : typeof error === "object" && "toString" in error ? error.toString() : JSON.stringify(error);
9414		errorInstance = new Error(errorString);
9415	}
9416	return /* @__PURE__ */ import_react.createElement(ErrorWrapper, {
9417		renderAppShell,
9418		title: "Application Error!"
9419	}, /* @__PURE__ */ import_react.createElement("h1", { style: { fontSize: "24px" } }, "Application Error"), /* @__PURE__ */ import_react.createElement("pre", { style: {
9420		padding: "2rem",
9421		background: "hsla(10, 50%, 50%, 0.1)",
9422		color: "red",
9423		overflow: "auto"
9424	} }, errorInstance.stack), heyDeveloper);
9425}
9426function RSCDefaultRootErrorBoundary({ hasRootLayout }) {
9427	let error = useRouteError();
9428	if (hasRootLayout === void 0) throw new Error("Missing 'hasRootLayout' prop");
9429	return /* @__PURE__ */ import_react.createElement(RSCDefaultRootErrorBoundaryImpl, {
9430		renderAppShell: !hasRootLayout,
9431		error
9432	});
9433}
9434function createRSCRouteModules(payload) {
9435	const routeModules = {};
9436	for (const match of payload.matches) populateRSCRouteModules(routeModules, match);
9437	return routeModules;
9438}
9439function populateRSCRouteModules(routeModules, matches) {
9440	matches = Array.isArray(matches) ? matches : [matches];
9441	for (const match of matches) routeModules[match.id] = {
9442		links: match.links,
9443		meta: match.meta,
9444		default: noopComponent
9445	};
9446}
9447var noopComponent = () => null;
9448var useImpl = import_react.use;
9449function useSafe(promise) {
9450	if (useImpl) return useImpl(promise);
9451	throw new Error("React Router v7 requires React 19+ for RSC features.");
9452}
9453async function routeRSCServerRequest({ request, serverResponse, createFromReadableStream, renderHTML, hydrate = true }) {
9454	const url = new URL(request.url);
9455	if (isReactServerRequest(url) || isManifestRequest(url) || request.headers.has("rsc-action-id") || serverResponse.headers.get("React-Router-Resource") === "true") return serverResponse;
9456	if (!serverResponse.body) throw new Error("Missing body in server response");
9457	const detectRedirectResponse = serverResponse.clone();
9458	let serverResponseB = null;
9459	if (hydrate) serverResponseB = serverResponse.clone();
9460	const body = serverResponse.body;
9461	let buffer;
9462	let streamControllers = [];
9463	const createStream = () => {
9464		if (!buffer) {
9465			buffer = [];
9466			return body.pipeThrough(new TransformStream({
9467				transform(chunk, controller) {
9468					buffer.push(chunk);
9469					controller.enqueue(chunk);
9470					streamControllers.forEach((c) => c.enqueue(chunk));
9471				},
9472				flush() {
9473					streamControllers.forEach((c) => c.close());
9474					streamControllers = [];
9475				}
9476			}));
9477		}
9478		return new ReadableStream({ start(controller) {
9479			buffer.forEach((chunk) => controller.enqueue(chunk));
9480			streamControllers.push(controller);
9481		} });
9482	};
9483	let deepestRenderedBoundaryId = null;
9484	const getPayload = () => {
9485		const payloadPromise = Promise.resolve(createFromReadableStream(createStream()));
9486		return Object.defineProperties(payloadPromise, {
9487			_deepestRenderedBoundaryId: {
9488				get() {
9489					return deepestRenderedBoundaryId;
9490				},
9491				set(boundaryId) {
9492					deepestRenderedBoundaryId = boundaryId;
9493				}
9494			},
9495			formState: { get() {
9496				return payloadPromise.then((payload) => payload.type === "render" ? payload.formState : void 0);
9497			} }
9498		});
9499	};
9500	let renderRedirect;
9501	let renderError;
9502	try {
9503		if (!detectRedirectResponse.body) throw new Error("Failed to clone server response");
9504		const payload = await createFromReadableStream(detectRedirectResponse.body);
9505		if (serverResponse.status === 202 && payload.type === "redirect") {
9506			const headers2 = new Headers(serverResponse.headers);
9507			headers2.delete("Content-Encoding");
9508			headers2.delete("Content-Length");
9509			headers2.delete("Content-Type");
9510			headers2.delete("X-Remix-Response");
9511			headers2.set("Location", payload.location);
9512			return new Response(serverResponseB?.body || "", {
9513				headers: headers2,
9514				status: payload.status,
9515				statusText: serverResponse.statusText
9516			});
9517		}
9518		let reactHeaders = new Headers();
9519		let status = serverResponse.status;
9520		let statusText = serverResponse.statusText;
9521		let html = await renderHTML(getPayload, {
9522			onError(error) {
9523				if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
9524					renderRedirect = decodeRedirectErrorDigest(error.digest);
9525					if (renderRedirect) return error.digest;
9526					let routeErrorResponse = decodeRouteErrorResponseDigest(error.digest);
9527					if (routeErrorResponse) {
9528						renderError = routeErrorResponse;
9529						status = routeErrorResponse.status;
9530						statusText = routeErrorResponse.statusText;
9531						return error.digest;
9532					}
9533				}
9534			},
9535			onHeaders(headers2) {
9536				for (const [key, value] of headers2) reactHeaders.append(key, value);
9537			}
9538		});
9539		const headers = new Headers(reactHeaders);
9540		for (const [key, value] of serverResponse.headers) headers.append(key, value);
9541		headers.set("Content-Type", "text/html; charset=utf-8");
9542		if (renderRedirect) {
9543			headers.set("Location", renderRedirect.location);
9544			return new Response(html, {
9545				status: renderRedirect.status,
9546				headers
9547			});
9548		}
9549		const redirectTransform = new TransformStream({ flush(controller) {
9550			if (renderRedirect) controller.enqueue(new TextEncoder().encode(`<meta http-equiv="refresh" content="0;url=${escapeHtml(renderRedirect.location)}"/>`));
9551		} });
9552		if (!hydrate) return new Response(html.pipeThrough(redirectTransform), {
9553			status,
9554			statusText,
9555			headers
9556		});
9557		if (!serverResponseB?.body) throw new Error("Failed to clone server response");
9558		const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body)).pipeThrough(redirectTransform);
9559		return new Response(body2, {
9560			status,
9561			statusText,
9562			headers
9563		});
9564	} catch (reason) {
9565		if (reason instanceof Response) return reason;
9566		if (renderRedirect) return new Response(`Redirect: ${renderRedirect.location}`, {
9567			status: renderRedirect.status,
9568			headers: { Location: renderRedirect.location }
9569		});
9570		try {
9571			reason = renderError ?? reason;
9572			let [status, statusText] = isRouteErrorResponse(reason) ? [reason.status, reason.statusText] : [500, ""];
9573			let retryRedirect;
9574			let reactHeaders = new Headers();
9575			const html = await renderHTML(() => {
9576				const payloadPromise = Promise.resolve(createFromReadableStream(createStream())).then((payload) => Object.assign(payload, {
9577					status,
9578					errors: deepestRenderedBoundaryId ? { [deepestRenderedBoundaryId]: reason } : {}
9579				}));
9580				return Object.defineProperties(payloadPromise, {
9581					_deepestRenderedBoundaryId: {
9582						get() {
9583							return deepestRenderedBoundaryId;
9584						},
9585						set(boundaryId) {
9586							deepestRenderedBoundaryId = boundaryId;
9587						}
9588					},
9589					formState: { get() {
9590						return payloadPromise.then((payload) => payload.type === "render" ? payload.formState : void 0);
9591					} }
9592				});
9593			}, {
9594				onError(error) {
9595					if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
9596						retryRedirect = decodeRedirectErrorDigest(error.digest);
9597						if (retryRedirect) return error.digest;
9598						let routeErrorResponse = decodeRouteErrorResponseDigest(error.digest);
9599						if (routeErrorResponse) {
9600							status = routeErrorResponse.status;
9601							statusText = routeErrorResponse.statusText;
9602							return error.digest;
9603						}
9604					}
9605				},
9606				onHeaders(headers2) {
9607					for (const [key, value] of headers2) reactHeaders.append(key, value);
9608				}
9609			});
9610			const headers = new Headers(reactHeaders);
9611			for (const [key, value] of serverResponse.headers) headers.append(key, value);
9612			headers.set("Content-Type", "text/html; charset=utf-8");
9613			if (retryRedirect) {
9614				headers.set("Location", retryRedirect.location);
9615				return new Response(html, {
9616					status: retryRedirect.status,
9617					headers
9618				});
9619			}
9620			const retryRedirectTransform = new TransformStream({ flush(controller) {
9621				if (retryRedirect) controller.enqueue(new TextEncoder().encode(`<meta http-equiv="refresh" content="0;url=${escapeHtml(retryRedirect.location)}"/>`));
9622			} });
9623			if (!hydrate) return new Response(html.pipeThrough(retryRedirectTransform), {
9624				status,
9625				statusText,
9626				headers
9627			});
9628			if (!serverResponseB?.body) throw new Error("Failed to clone server response");
9629			const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body)).pipeThrough(retryRedirectTransform);
9630			return new Response(body2, {
9631				status,
9632				statusText,
9633				headers
9634			});
9635		} catch {}
9636		throw reason;
9637	}
9638}
9639function RSCStaticRouter({ getPayload }) {
9640	const decoded = getPayload();
9641	const payload = useSafe(decoded);
9642	if (payload.type === "redirect") throw new Response(null, {
9643		status: payload.status,
9644		headers: { Location: payload.location }
9645	});
9646	if (payload.type !== "render") return null;
9647	let patchedLoaderData = { ...payload.loaderData };
9648	for (const match of payload.matches) if (shouldHydrateRouteLoader(match.id, match.clientLoader, match.hasLoader, false) && (match.hydrateFallbackElement || !match.hasLoader)) delete patchedLoaderData[match.id];
9649	const context = {
9650		get _deepestRenderedBoundaryId() {
9651			return decoded._deepestRenderedBoundaryId ?? null;
9652		},
9653		set _deepestRenderedBoundaryId(boundaryId) {
9654			decoded._deepestRenderedBoundaryId = boundaryId;
9655		},
9656		actionData: payload.actionData,
9657		actionHeaders: {},
9658		basename: payload.basename,
9659		errors: payload.errors,
9660		loaderData: patchedLoaderData,
9661		loaderHeaders: {},
9662		location: payload.location,
9663		statusCode: 200,
9664		matches: payload.matches.map((match) => ({
9665			params: match.params,
9666			pathname: match.pathname,
9667			pathnameBase: match.pathnameBase,
9668			route: {
9669				id: match.id,
9670				action: match.hasAction || !!match.clientAction,
9671				handle: match.handle,
9672				hasErrorBoundary: match.hasErrorBoundary,
9673				loader: match.hasLoader || !!match.clientLoader,
9674				index: match.index,
9675				path: match.path,
9676				shouldRevalidate: match.shouldRevalidate
9677			}
9678		}))
9679	};
9680	const router = createStaticRouter(payload.matches.reduceRight((previous, match) => {
9681		const route = {
9682			id: match.id,
9683			action: match.hasAction || !!match.clientAction,
9684			element: match.element,
9685			errorElement: match.errorElement,
9686			handle: match.handle,
9687			hasErrorBoundary: !!match.errorElement,
9688			hydrateFallbackElement: match.hydrateFallbackElement,
9689			index: match.index,
9690			loader: match.hasLoader || !!match.clientLoader,
9691			path: match.path,
9692			shouldRevalidate: match.shouldRevalidate
9693		};
9694		if (previous.length > 0) route.children = previous;
9695		return [route];
9696	}, []), context);
9697	const frameworkContext = {
9698		future: {
9699			v8_middleware: false,
9700			unstable_subResourceIntegrity: false,
9701			unstable_trailingSlashAwareDataRequests: true,
9702			unstable_passThroughRequests: true
9703		},
9704		isSpaMode: false,
9705		ssr: true,
9706		criticalCss: "",
9707		manifest: {
9708			routes: {},
9709			version: "1",
9710			url: "",
9711			entry: {
9712				module: "",
9713				imports: []
9714			}
9715		},
9716		routeDiscovery: {
9717			mode: "lazy",
9718			manifestPath: "/__manifest"
9719		},
9720		routeModules: createRSCRouteModules(payload)
9721	};
9722	return /* @__PURE__ */ import_react.createElement(RSCRouterContext.Provider, { value: true }
9722, /* @__PURE__ */ import_react.createElement(RSCRouterGlobalErrorBoundary, { location: payload.location }, /* @__PURE__ */ import_react.createElement(FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ import_react.createElement(StaticRouterProvider, {
9723		context,
9724		router,
9725		hydrate: false,
9726		nonce: payload.nonce
9727	}))));
9728}
9729function isReactServerRequest(url) {
9730	return url.pathname.endsWith(".rsc");
9731}
9732function isManifestRequest(url) {
9733	return url.pathname.endsWith(".manifest");
9734}
9735function deserializeErrors(errors) {
9736	if (!errors) return null;
9737	let entries = Object.entries(errors);
9738	let serialized = {};
9739	for (let [key, val] of entries) if (val && val.__type === "RouteErrorResponse") serialized[key] = new ErrorResponseImpl(val.status, val.statusText, val.data, val.internal === true);
9740	else if (val && val.__type === "Error") {
9741		if (val.__subType) {
9742			let ErrorConstructor = window[val.__subType];
9743			if (typeof ErrorConstructor === "function") try {
9744				let error = new ErrorConstructor(val.message);
9745				error.stack = val.stack;
9746				serialized[key] = error;
9747			} catch (e) {}
9748		}
9749		if (serialized[key] == null) {
9750			let error = new Error(val.message);
9751			error.stack = val.stack;
9752			serialized[key] = error;
9753		}
9754	} else serialized[key] = val;
9755	return serialized;
9756}
9757function getHydrationData({ state, routes, getRouteInfo, location, basename, isSpaMode }) {
9758	let hydrationData = {
9759		...state,
9760		loaderData: { ...state.loaderData }
9761	};
9762	let initialMatches = matchRoutes(routes, location, basename);
9763	if (initialMatches) for (let match of initialMatches) {
9764		let routeId = match.route.id;
9765		let routeInfo = getRouteInfo(routeId);
9766		if (shouldHydrateRouteLoader(routeId, routeInfo.clientLoader, routeInfo.hasLoader, isSpaMode) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) delete hydrationData.loaderData[routeId];
9767		else if (!routeInfo.hasLoader) hydrationData.loaderData[routeId] = null;
9768	}
9769	return hydrationData;
9770}
9771//#endregion
9772//#region node_modules/react-router/dist/development/dom-export.mjs
9773/**
9774* react-router v7.13.2
9775*
9776* Copyright (c) Remix Software Inc.
9777*
9778* This source code is licensed under the MIT license found in the
9779* LICENSE.md file in the root directory of this source tree.
9780*
9781* @license MIT
vendor: 5,199 bytes, lines 9782-9900
9782*/
9783var import_react_dom = /* @__PURE__ */ __toESM(require_react_dom(), 1);
9784function RouterProvider2(props) {
9785	return /* @__PURE__ */ import_react.createElement(RouterProvider, {
9786		flushSync: import_react_dom.flushSync,
9787		...props
9788	});
9789}
9790var ssrInfo = null;
9791var router = null;
9792function initSsrInfo() {
9793	if (!ssrInfo && window.__reactRouterContext && window.__reactRouterManifest && window.__reactRouterRouteModules) {
9794		if (window.__reactRouterManifest.sri === true) {
9795			const importMap = document.querySelector("script[rr-importmap]");
9796			if (importMap?.textContent) try {
9797				window.__reactRouterManifest.sri = JSON.parse(importMap.textContent).integrity;
9798			} catch (err) {
9799				console.error("Failed to parse import map", err);
9800			}
9801		}
9802		ssrInfo = {
9803			context: window.__reactRouterContext,
9804			manifest: window.__reactRouterManifest,
9805			routeModules: window.__reactRouterRouteModules,
9806			stateDecodingPromise: void 0,
9807			router: void 0,
9808			routerInitialized: false
9809		};
9810	}
9811}
9812function createHydratedRouter({ getContext, unstable_instrumentations }) {
9813	initSsrInfo();
9814	if (!ssrInfo) throw new Error("You must be using the SSR features of React Router in order to skip passing a `router` prop to `<RouterProvider>`");
9815	let localSsrInfo = ssrInfo;
9816	if (!ssrInfo.stateDecodingPromise) {
9817		let stream = ssrInfo.context.stream;
9818		invariant(stream, "No stream found for single fetch decoding");
9819		ssrInfo.context.stream = void 0;
9820		ssrInfo.stateDecodingPromise = decodeViaTurboStream(stream, window).then((value) => {
9821			ssrInfo.context.state = value.value;
9822			localSsrInfo.stateDecodingPromise.value = true;
9823		}).catch((e) => {
9824			localSsrInfo.stateDecodingPromise.error = e;
9825		});
9826	}
9827	if (ssrInfo.stateDecodingPromise.error) throw ssrInfo.stateDecodingPromise.error;
9828	if (!ssrInfo.stateDecodingPromise.value) throw ssrInfo.stateDecodingPromise;
9829	let routes = createClientRoutes(ssrInfo.manifest.routes, ssrInfo.routeModules, ssrInfo.context.state, ssrInfo.context.ssr, ssrInfo.context.isSpaMode);
9830	let hydrationData = void 0;
9831	if (ssrInfo.context.isSpaMode) {
9832		let { loaderData } = ssrInfo.context.state;
9833		if (ssrInfo.manifest.routes.root?.hasLoader && loaderData && "root" in loaderData) hydrationData = { loaderData: { root: loaderData.root } };
9834	} else {
9835		hydrationData = getHydrationData({
9836			state: ssrInfo.context.state,
9837			routes,
9838			getRouteInfo: (routeId) => ({
9839				clientLoader: ssrInfo.routeModules[routeId]?.clientLoader,
9840				hasLoader: ssrInfo.manifest.routes[routeId]?.hasLoader === true,
9841				hasHydrateFallback: ssrInfo.routeModules[routeId]?.HydrateFallback != null
9842			}),
9843			location: window.location,
9844			basename: window.__reactRouterContext?.basename,
9845			isSpaMode: ssrInfo.context.isSpaMode
9846		});
9847		if (hydrationData && hydrationData.errors) hydrationData.errors = deserializeErrors(hydrationData.errors);
9848	}
9849	if (window.history.state && window.history.state.masked) window.history.replaceState({
9850		...window.history.state,
9851		masked: void 0
9852	}, "");
9853	let router2 = createRouter({
9854		routes,
9855		history: createBrowserHistory(),
9856		basename: ssrInfo.context.basename,
9857		getContext,
9858		hydrationData,
9859		hydrationRouteProperties,
9860		unstable_instrumentations,
9861		mapRouteProperties,
9862		future: { unstable_passThroughRequests: ssrInfo.context.future.unstable_passThroughRequests },
9863		dataStrategy: getTurboStreamSingleFetchDataStrategy(() => router2, ssrInfo.manifest, ssrInfo.routeModules, ssrInfo.context.ssr, ssrInfo.context.basename, ssrInfo.context.future.unstable_trailingSlashAwareDataRequests),
9864		patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(() => router2, ssrInfo.manifest, ssrInfo.routeModules, ssrInfo.context.ssr, ssrInfo.context.routeDiscovery, ssrInfo.context.isSpaMode, ssrInfo.context.basename)
9865	});
9866	ssrInfo.router = router2;
9867	if (router2.state.initialized) {
9868		ssrInfo.routerInitialized = true;
9869		router2.initialize();
9870	}
9871	router2.createRoutesForHMR = createClientRoutesWithHMRRevalidationOptOut;
9872	window.__reactRouterDataRouter = router2;
9873	return router2;
9874}
9875function HydratedRouter(props) {
9876	if (!router) router = createHydratedRouter({
9877		getContext: props.getContext,
9878		unstable_instrumentations: props.unstable_instrumentations
9879	});
9880	let [criticalCss, setCriticalCss] = import_react.useState(ssrInfo?.context.criticalCss);
9881	import_react.useEffect(() => {
9882		setCriticalCss(void 0);
9883	}, []);
9884	import_react.useEffect(() => {
9885		if (criticalCss === void 0) document.querySelectorAll(`[${CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
9886	}, [criticalCss]);
9887	let [location2, setLocation] = import_react.useState(router.state.location);
9888	import_react.useLayoutEffect(() => {
9889		if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {
9890			ssrInfo.routerInitialized = true;
9891			ssrInfo.router.initialize();
9892		}
9893	}, []);
9894	import_react.useLayoutEffect(() => {
9895		if (ssrInfo && ssrInfo.router) return ssrInfo.router.subscribe((newState) => {
9896			if (newState.location !== location2) setLocation(newState.location);
9897		});
9898	}, [location2]);
9899	invariant(ssrInfo, "ssrInfo unavailable for HydratedRouter");
9900	useFogOFWarDiscovery(router, ssrInfo.manifest, ssrInfo.routeModules, ssrInfo.context.ssr, ssrInfo.context.routeDiscovery, ssrInfo.context.
9900isSpaMode);
9901	return /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, /* @__PURE__ */ import_react.createElement(FrameworkContext.Provider, { value: {
9902		manifest: ssrInfo.manifest,
9903		routeModules: ssrInfo.routeModules,
9904		future: ssrInfo.context.future,
9905		criticalCss,
9906		ssr: ssrInfo.context.ssr,
9907		isSpaMode: ssrInfo.context.isSpaMode,
9908		routeDiscovery: ssrInfo.context.routeDiscovery
9909	} }, /* @__PURE__ */ import_react.createElement(RemixErrorBoundary, { location: location2 }, /* @__PURE__ */ import_react.createElement(RouterProvider2, {
9910		router,
9911		unstable_useTransitions: props.unstable_useTransitions,
9912		onError: props.onError
9913	}))), /* @__PURE__ */ import_react.createElement(import_react.Fragment, null));
9914}
9915createContext();
9916//#endregion
9917//#region node_modules/react-router-dom/dist/index.mjs
9918/**
9919* react-router-dom v7.13.2
9920*
9921* Copyright (c) Remix Software Inc.
9922*
9923* This source code is licensed under the MIT license found in the
9924* LICENSE.md file in the root directory of this source tree.
9925*
9926* @license MIT
9927*/
9928//#endregion
9929export { Await, BrowserRouter, Form, HashRouter, HydratedRouter, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, Link, Links, MemoryRouter, Meta, NavLink, Navigate, Action as NavigationType, Outlet, PrefetchPageLinks, Route, Router, RouterContextProvider, RouterProvider2 as RouterProvider, Routes, Scripts, ScrollRestoration, ServerRouter, StaticRouter, StaticRouterProvider, AwaitContextProvider as UNSAFE_AwaitContextProvider, DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, FetchersContext as UNSAFE_FetchersContext, FrameworkContext as UNSAFE_FrameworkContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteContext as UNSAFE_RouteContext, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, ViewTransitionContext as UNSAFE_ViewTransitionContext, WithComponentProps as UNSAFE_WithComponentProps, WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps, WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps, createBrowserHistory as UNSAFE_createBrowserHistory, createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, createHashHistory as UNSAFE_createHashHistory, createMemoryHistory as UNSAFE_createMemoryHistory, createRouter as UNSAFE_createRouter, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, hydrationRouteProperties as UNSAFE_hydrationRouteProperties, invariant as UNSAFE_invariant, mapRouteProperties as UNSAFE_mapRouteProperties, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, useScrollRestoration as UNSAFE_useScrollRestoration, withComponentProps as UNSAFE_withComponentProps, withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps, withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps, createBrowserRouter, createContext, createCookie, createCookieSessionStorage, createHashRouter, createMemoryRouter, createMemorySessionStorage, createPath, createRequestHandler, createRoutesFromChildren, createRoutesFromElements, createRoutesStub, createSearchParams, createSession, createSessionStorage, createStaticHandler2 as createStaticHandler, createStaticRouter, data, generatePath, href, isCookie, isRouteErrorResponse, isSession, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, replace, resolvePath, HistoryRouter as unstable_HistoryRouter, RSCStaticRouter as unstable_RSCStaticRouter, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, usePrompt as unstable_usePrompt, useRoute as unstable_useRoute, useActionData, useAsyncError, useAsyncValue, useBeforeUnload, useBlocker, useFetcher, useFetchers, useFormAction, useHref, useInRouterContext, useLinkClickHandler, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, useSearchParams, useSubmit, useViewTransitionState };
9930
9931//# sourceMappingURL=react-router-dom.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.