@burdenoff/microfe-devportal 2026.801.1 → 2026.802.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/devportal/AdminDevportalRoutes.js +14 -14
  2. package/dist/devportal/DevportalRoutes.js +115 -115
  3. package/dist/devportal/DevportalRoutes.js.map +1 -1
  4. package/dist/devportal/components/SectionNav.js +1 -0
  5. package/dist/devportal/components/SectionNav.js.map +1 -1
  6. package/dist/devportal/components/TelemetryErrorBoundary.js +7 -7
  7. package/dist/devportal/pages/AnalyticsDashboardPage.js +41 -41
  8. package/dist/devportal/pages/AnalyticsDashboardPage.js.map +1 -1
  9. package/dist/devportal/pages/AppLogsPage.js +27 -27
  10. package/dist/devportal/pages/ApplicationDetailPage.js +929 -929
  11. package/dist/devportal/pages/ApplicationDetailPage.js.map +1 -1
  12. package/dist/devportal/pages/ApplicationVersionsPage.js +39 -39
  13. package/dist/devportal/pages/ApplicationVersionsPage.js.map +1 -1
  14. package/dist/devportal/pages/CreateWebhookPage.js +55 -55
  15. package/dist/devportal/pages/EditApplicationPage.js +36 -36
  16. package/dist/devportal/pages/EditApplicationPage.js.map +1 -1
  17. package/dist/devportal/pages/EditPhysicalItemPage.js +40 -40
  18. package/dist/devportal/pages/InvitationDecisionPage.js +25 -25
  19. package/dist/devportal/pages/ListingPreviewPage.js +36 -36
  20. package/dist/devportal/pages/OAuthCallbackPage.js +10 -10
  21. package/dist/devportal/pages/OAuthClientDetailPage.js +27 -27
  22. package/dist/devportal/pages/OAuthClientDetailPage.js.map +1 -1
  23. package/dist/devportal/pages/OrganizationDetailPage.js +329 -329
  24. package/dist/devportal/pages/OrganizationDetailPage.js.map +1 -1
  25. package/dist/devportal/pages/OrganizationMembersPage.js +181 -181
  26. package/dist/devportal/pages/OrganizationMembersPage.js.map +1 -1
  27. package/dist/devportal/pages/PublishPage.js +43 -43
  28. package/dist/devportal/pages/PublishPage.js.map +1 -1
  29. package/dist/devportal/pages/RevenueDashboardPage.js +65 -65
  30. package/dist/devportal/pages/RevenueDashboardPage.js.map +1 -1
  31. package/dist/devportal/pages/StoreSubmissionPage.js +126 -126
  32. package/dist/devportal/pages/StoreSubmissionPage.js.map +1 -1
  33. package/dist/devportal/pages/WebhookDetailPage.js +28 -28
  34. package/dist/devportal/pages/WebhookDetailPage.js.map +1 -1
  35. package/dist/devportal/pages/WebhooksPage.js +47 -47
  36. package/dist/devportal/pages/WebhooksPage.js.map +1 -1
  37. package/dist/devportal/providers/DevportalProvider.js +12 -12
  38. package/package.json +1 -1
  39. package/dist/node_modules/react-router/dist/production/lib/components.js +0 -124
  40. package/dist/node_modules/react-router/dist/production/lib/components.js.map +0 -1
  41. package/dist/node_modules/react-router/dist/production/lib/context.js +0 -32
  42. package/dist/node_modules/react-router/dist/production/lib/context.js.map +0 -1
  43. package/dist/node_modules/react-router/dist/production/lib/dom/dom.js +0 -83
  44. package/dist/node_modules/react-router/dist/production/lib/dom/dom.js.map +0 -1
  45. package/dist/node_modules/react-router/dist/production/lib/dom/lib.js +0 -358
  46. package/dist/node_modules/react-router/dist/production/lib/dom/lib.js.map +0 -1
  47. package/dist/node_modules/react-router/dist/production/lib/dom/ssr/components.js +0 -188
  48. package/dist/node_modules/react-router/dist/production/lib/dom/ssr/components.js.map +0 -1
  49. package/dist/node_modules/react-router/dist/production/lib/dom/ssr/invariant.js +0 -8
  50. package/dist/node_modules/react-router/dist/production/lib/dom/ssr/invariant.js.map +0 -1
  51. package/dist/node_modules/react-router/dist/production/lib/dom/ssr/links.js +0 -75
  52. package/dist/node_modules/react-router/dist/production/lib/dom/ssr/links.js.map +0 -1
  53. package/dist/node_modules/react-router/dist/production/lib/dom/ssr/markup.js +0 -15
  54. package/dist/node_modules/react-router/dist/production/lib/dom/ssr/markup.js.map +0 -1
  55. package/dist/node_modules/react-router/dist/production/lib/dom/ssr/routeModules.js +0 -18
  56. package/dist/node_modules/react-router/dist/production/lib/dom/ssr/routeModules.js.map +0 -1
  57. package/dist/node_modules/react-router/dist/production/lib/dom/ssr/single-fetch.js +0 -10
  58. package/dist/node_modules/react-router/dist/production/lib/dom/ssr/single-fetch.js.map +0 -1
  59. package/dist/node_modules/react-router/dist/production/lib/errors.js +0 -19
  60. package/dist/node_modules/react-router/dist/production/lib/errors.js.map +0 -1
  61. package/dist/node_modules/react-router/dist/production/lib/hooks.js +0 -296
  62. package/dist/node_modules/react-router/dist/production/lib/hooks.js.map +0 -1
  63. package/dist/node_modules/react-router/dist/production/lib/router/history.js +0 -166
  64. package/dist/node_modules/react-router/dist/production/lib/router/history.js.map +0 -1
  65. package/dist/node_modules/react-router/dist/production/lib/router/router.js +0 -33
  66. package/dist/node_modules/react-router/dist/production/lib/router/router.js.map +0 -1
  67. package/dist/node_modules/react-router/dist/production/lib/router/url.js +0 -9
  68. package/dist/node_modules/react-router/dist/production/lib/router/url.js.map +0 -1
  69. package/dist/node_modules/react-router/dist/production/lib/router/utils.js +0 -236
  70. package/dist/node_modules/react-router/dist/production/lib/router/utils.js.map +0 -1
@@ -1,33 +0,0 @@
1
- //#region node_modules/react-router/dist/production/lib/router/router.js
2
- var e = [
3
- "POST",
4
- "PUT",
5
- "PATCH",
6
- "DELETE"
7
- ];
8
- new Set(e);
9
- var t = ["GET", ...e];
10
- new Set(t);
11
- var n = [
12
- "about:",
13
- "blob:",
14
- "chrome:",
15
- "chrome-untrusted:",
16
- "content:",
17
- "data:",
18
- "devtools:",
19
- "file:",
20
- "filesystem:",
21
- "javascript:"
22
- ];
23
- function r(e) {
24
- try {
25
- return n.includes(new URL(e).protocol);
26
- } catch {
27
- return !1;
28
- }
29
- }
30
- //#endregion
31
- export { r as hasInvalidProtocol };
32
-
33
- //# sourceMappingURL=router.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"router.js","names":[],"sources":["../../../../../../../node_modules/react-router/dist/production/lib/router/router.js"],"sourcesContent":["/**\n * react-router v8.3.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { PROTOCOL_RELATIVE_URL_REGEX, normalizeProtocolRelativeUrl } from \"./url.js\";\nimport { createBrowserURLImpl, createLocation, createPath, invariant, parsePath, warning } from \"./history.js\";\nimport { ErrorResponseImpl, RouterContextProvider, convertRouteMatchToUiMatch, convertRoutesToDataRoutes, createDataFunctionUrl, flattenAndRankRoutes, getPathContributingMatches, getResolveToMatches, getRoutePattern, isAbsoluteUrl, isRouteErrorResponse, isUnsupportedLazyRouteFunctionKey, isUnsupportedLazyRouteObjectKey, matchRoutesImpl, prependBasename, removeDoubleSlashes, resolveTo, stripBasename } from \"./utils.js\";\nimport { consumeInstrumentationClientResultMetaReceiver, getRouteInstrumentationUpdates, instrumentClientSideRouter } from \"./instrumentation.js\";\n//#region lib/router/router.ts\nconst validMutationMethodsArr = [\n\t\"POST\",\n\t\"PUT\",\n\t\"PATCH\",\n\t\"DELETE\"\n];\nconst validMutationMethods = new Set(validMutationMethodsArr);\nconst validRequestMethodsArr = [\"GET\", ...validMutationMethodsArr];\nconst validRequestMethods = new Set(validRequestMethodsArr);\nconst redirectStatusCodes = new Set([\n\t301,\n\t302,\n\t303,\n\t307,\n\t308\n]);\nconst redirectPreserveMethodStatusCodes = new Set([307, 308]);\nconst IDLE_NAVIGATION = {\n\tstate: \"idle\",\n\tlocation: void 0,\n\tmatches: void 0,\n\thistoryAction: void 0,\n\tformMethod: void 0,\n\tformAction: void 0,\n\tformEncType: void 0,\n\tformData: void 0,\n\tjson: void 0,\n\ttext: void 0\n};\nconst IDLE_FETCHER = {\n\tstate: \"idle\",\n\tdata: void 0,\n\tformMethod: void 0,\n\tformAction: void 0,\n\tformEncType: void 0,\n\tformData: void 0,\n\tjson: void 0,\n\ttext: void 0\n};\nconst IDLE_BLOCKER = {\n\tstate: \"unblocked\",\n\tproceed: void 0,\n\treset: void 0,\n\tlocation: void 0\n};\nconst TRANSITIONS_STORAGE_KEY = \"remix-router-transitions\";\nconst ResetLoaderDataSymbol = Symbol(\"ResetLoaderData\");\n/**\n* Encapsulates the stable and in-flight route trees together with their\n* pre-computed branch caches so the structures always stay in sync.\n*/\nvar DataRoutes = class {\n\t#routes;\n\t#branches;\n\t#hmrRoutes;\n\t#hmrBranches;\n\tconstructor(routes) {\n\t\tthis.#routes = routes;\n\t\tthis.#branches = flattenAndRankRoutes(routes);\n\t}\n\t/** The stable route tree */\n\tget stableRoutes() {\n\t\treturn this.#routes;\n\t}\n\t/** The in-flight route tree if one is active, otherwise the stable tree */\n\tget activeRoutes() {\n\t\treturn this.#hmrRoutes ?? this.#routes;\n\t}\n\t/** Pre-computed branches */\n\tget branches() {\n\t\treturn this.#hmrBranches ?? this.#branches;\n\t}\n\tget hasHMRRoutes() {\n\t\treturn this.#hmrRoutes != null;\n\t}\n\t/** Replace the stable route tree and recompute its branches */\n\tsetRoutes(routes) {\n\t\tthis.#routes = routes;\n\t\tthis.#branches = flattenAndRankRoutes(routes);\n\t}\n\t/** Set a new in-flight route tree and recompute its branches */\n\tsetHmrRoutes(routes) {\n\t\tthis.#hmrRoutes = routes;\n\t\tthis.#hmrBranches = flattenAndRankRoutes(routes);\n\t}\n\t/** Commit in-flight routes/branches to the stable slot and clear in-flight */\n\tcommitHmrRoutes() {\n\t\tif (this.#hmrRoutes) {\n\t\t\tthis.#routes = this.#hmrRoutes;\n\t\t\tthis.#branches = this.#hmrBranches;\n\t\t\tthis.#hmrRoutes = void 0;\n\t\t\tthis.#hmrBranches = void 0;\n\t\t}\n\t}\n};\n/**\n* Create a router and listen to history POP navigations\n*/\nfunction createRouter(init) {\n\tconst routerWindow = init.window ? init.window : typeof window !== \"undefined\" ? window : void 0;\n\tconst isBrowser = typeof routerWindow !== \"undefined\" && typeof routerWindow.document !== \"undefined\" && typeof routerWindow.document.createElement !== \"undefined\";\n\tinvariant(init.routes.length > 0, \"You must provide a non-empty routes array to createRouter\");\n\tlet hydrationRouteProperties = init.hydrationRouteProperties || [];\n\tlet _mapRouteProperties = init.mapRouteProperties;\n\tlet mapRouteProperties = _mapRouteProperties ? _mapRouteProperties : () => ({});\n\tif (init.instrumentations) {\n\t\tlet instrumentations = init.instrumentations;\n\t\tmapRouteProperties = (route) => {\n\t\t\treturn {\n\t\t\t\t..._mapRouteProperties?.(route),\n\t\t\t\t...getRouteInstrumentationUpdates(instrumentations.map((i) => i.route).filter(Boolean), route)\n\t\t\t};\n\t\t};\n\t}\n\tlet manifest = {};\n\tlet dataRoutes = new DataRoutes(convertRoutesToDataRoutes(init.routes, mapRouteProperties, void 0, manifest));\n\tlet basename = init.basename || \"/\";\n\tif (!basename.startsWith(\"/\")) basename = `/${basename}`;\n\tlet dataStrategyImpl = init.dataStrategy || defaultDataStrategyWithMiddleware;\n\tlet future = { ...init.future };\n\tlet unlistenHistory = null;\n\tlet subscribers = /* @__PURE__ */ new Set();\n\tlet bufferedInitialStateUpdate = null;\n\tlet savedScrollPositions = null;\n\tlet getScrollRestorationKey = null;\n\tlet getScrollPosition = null;\n\tlet initialScrollRestored = init.hydrationData != null;\n\tlet initialMatches = matchRoutesImpl(dataRoutes.activeRoutes, init.history.location, basename, false, dataRoutes.branches);\n\tlet initialMatchesIsFOW = false;\n\tlet initialErrors = null;\n\tlet initialized;\n\tlet renderFallback;\n\tif (initialMatches == null && !init.patchRoutesOnNavigation) {\n\t\tlet error = getInternalRouterError(404, { pathname: init.history.location.pathname });\n\t\tlet { matches, route } = getShortCircuitMatches(dataRoutes.activeRoutes);\n\t\tinitialized = true;\n\t\trenderFallback = !initialized;\n\t\tinitialMatches = matches;\n\t\tinitialErrors = { [route.id]: error };\n\t} else {\n\t\tif (initialMatches && !init.hydrationData) {\n\t\t\tif (checkFogOfWar(initialMatches, dataRoutes.activeRoutes, init.history.location.pathname).active) initialMatches = null;\n\t\t}\n\t\tif (!initialMatches) {\n\t\t\tinitialized = false;\n\t\t\trenderFallback = !initialized;\n\t\t\tinitialMatches = [];\n\t\t\tlet fogOfWar = checkFogOfWar(null, dataRoutes.activeRoutes, init.history.location.pathname);\n\t\t\tif (fogOfWar.active && fogOfWar.matches) {\n\t\t\t\tinitialMatchesIsFOW = true;\n\t\t\t\tinitialMatches = fogOfWar.matches;\n\t\t\t}\n\t\t} else if (initialMatches.some((m) => m.route.lazy)) {\n\t\t\tinitialized = false;\n\t\t\trenderFallback = !initialized;\n\t\t} else if (!initialMatches.some((m) => routeHasLoaderOrMiddleware(m.route))) {\n\t\t\tinitialized = true;\n\t\t\trenderFallback = !initialized;\n\t\t} else {\n\t\t\tlet loaderData = init.hydrationData ? init.hydrationData.loaderData : null;\n\t\t\tlet errors = init.hydrationData ? init.hydrationData.errors : null;\n\t\t\tlet relevantMatches = initialMatches;\n\t\t\tif (errors) {\n\t\t\t\tlet idx = initialMatches.findIndex((m) => errors[m.route.id] !== void 0);\n\t\t\t\trelevantMatches = relevantMatches.slice(0, idx + 1);\n\t\t\t}\n\t\t\trenderFallback = false;\n\t\t\tinitialized = true;\n\t\t\trelevantMatches.forEach((m) => {\n\t\t\t\tlet status = getRouteHydrationStatus(m.route, loaderData, errors);\n\t\t\t\trenderFallback = renderFallback || status.renderFallback;\n\t\t\t\tinitialized = initialized && !status.shouldLoad;\n\t\t\t});\n\t\t}\n\t}\n\tlet router;\n\tlet state = {\n\t\thistoryAction: init.history.action,\n\t\tlocation: init.history.location,\n\t\tmatches: initialMatches,\n\t\tinitialized,\n\t\trenderFallback,\n\t\tnavigation: IDLE_NAVIGATION,\n\t\trestoreScrollPosition: init.hydrationData != null ? false : null,\n\t\tpreventScrollReset: false,\n\t\trevalidation: \"idle\",\n\t\tloaderData: init.hydrationData && init.hydrationData.loaderData || {},\n\t\tactionData: init.hydrationData && init.hydrationData.actionData || null,\n\t\terrors: init.hydrationData && init.hydrationData.errors || initialErrors,\n\t\tfetchers: /* @__PURE__ */ new Map(),\n\t\tblockers: /* @__PURE__ */ new Map()\n\t};\n\tlet pendingAction = \"POP\";\n\tlet pendingPopstateNavigationDfd = null;\n\tlet pendingPreventScrollReset = false;\n\tlet pendingNavigationController;\n\tlet pendingViewTransitionEnabled = false;\n\tlet appliedViewTransitions = /* @__PURE__ */ new Map();\n\tlet removePageHideEventListener = null;\n\tlet isUninterruptedRevalidation = false;\n\tlet isRevalidationRequired = false;\n\tlet cancelledFetcherLoads = /* @__PURE__ */ new Set();\n\tlet fetchControllers = /* @__PURE__ */ new Map();\n\tlet incrementingLoadId = 0;\n\tlet pendingNavigationLoadId = -1;\n\tlet fetchReloadIds = /* @__PURE__ */ new Map();\n\tlet fetchRedirectIds = /* @__PURE__ */ new Set();\n\tlet fetchLoadMatches = /* @__PURE__ */ new Map();\n\tlet activeFetchers = /* @__PURE__ */ new Map();\n\tlet fetchersQueuedForDeletion = /* @__PURE__ */ new Set();\n\tlet blockerFunctions = /* @__PURE__ */ new Map();\n\tlet unblockBlockerHistoryUpdate = void 0;\n\tlet pendingRevalidationDfd = null;\n\tfunction initialize() {\n\t\tunlistenHistory = init.history.listen(({ action: historyAction, location, delta }) => {\n\t\t\tif (unblockBlockerHistoryUpdate) {\n\t\t\t\tunblockBlockerHistoryUpdate();\n\t\t\t\tunblockBlockerHistoryUpdate = void 0;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\twarning(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.\");\n\t\t\tlet blockerKey = shouldBlockNavigation({\n\t\t\t\tcurrentLocation: state.location,\n\t\t\t\tnextLocation: location,\n\t\t\t\thistoryAction\n\t\t\t});\n\t\t\tif (blockerKey && delta != null) {\n\t\t\t\tlet nextHistoryUpdatePromise = new Promise((resolve) => {\n\t\t\t\t\tunblockBlockerHistoryUpdate = resolve;\n\t\t\t\t});\n\t\t\t\tinit.history.go(delta * -1);\n\t\t\t\tupdateBlocker(blockerKey, {\n\t\t\t\t\tstate: \"blocked\",\n\t\t\t\t\tlocation,\n\t\t\t\t\tproceed() {\n\t\t\t\t\t\tupdateBlocker(blockerKey, {\n\t\t\t\t\t\t\tstate: \"proceeding\",\n\t\t\t\t\t\t\tproceed: void 0,\n\t\t\t\t\t\t\treset: void 0,\n\t\t\t\t\t\t\tlocation\n\t\t\t\t\t\t});\n\t\t\t\t\t\tnextHistoryUpdatePromise.then(() => init.history.go(delta));\n\t\t\t\t\t},\n\t\t\t\t\treset() {\n\t\t\t\t\t\tlet blockers = new Map(state.blockers);\n\t\t\t\t\t\tblockers.set(blockerKey, IDLE_BLOCKER);\n\t\t\t\t\t\tupdateState({ blockers });\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tpendingPopstateNavigationDfd?.resolve();\n\t\t\t\tpendingPopstateNavigationDfd = null;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn startNavigation(historyAction, location);\n\t\t});\n\t\tif (isBrowser) {\n\t\t\trestoreAppliedTransitions(routerWindow, appliedViewTransitions);\n\t\t\tlet _saveAppliedTransitions = () => persistAppliedTransitions(routerWindow, appliedViewTransitions);\n\t\t\trouterWindow.addEventListener(\"pagehide\", _saveAppliedTransitions);\n\t\t\tremovePageHideEventListener = () => routerWindow.removeEventListener(\"pagehide\", _saveAppliedTransitions);\n\t\t}\n\t\tif (!state.initialized) startNavigation(\"POP\", state.location, { initialHydration: true });\n\t\treturn router;\n\t}\n\tfunction dispose() {\n\t\tif (unlistenHistory) unlistenHistory();\n\t\tif (removePageHideEventListener) removePageHideEventListener();\n\t\tsubscribers.clear();\n\t\tpendingNavigationController && pendingNavigationController.abort();\n\t\tstate.fetchers.forEach((_, key) => deleteFetcher(state.fetchers, key));\n\t\tstate.blockers.forEach((_, key) => deleteBlocker(key));\n\t}\n\tfunction subscribe(fn) {\n\t\tsubscribers.add(fn);\n\t\tif (bufferedInitialStateUpdate) {\n\t\t\tlet { newErrors } = bufferedInitialStateUpdate;\n\t\t\tbufferedInitialStateUpdate = null;\n\t\t\tfn(state, {\n\t\t\t\tdeletedFetchers: [],\n\t\t\t\tnewErrors,\n\t\t\t\tviewTransitionOpts: void 0,\n\t\t\t\tflushSync: false\n\t\t\t});\n\t\t}\n\t\treturn () => subscribers.delete(fn);\n\t}\n\tfunction updateState(newState, opts = {}) {\n\t\tif (newState.matches) newState.matches = newState.matches.map((m) => {\n\t\t\tlet route = manifest[m.route.id];\n\t\t\tlet matchRoute = m.route;\n\t\t\tif (matchRoute.element !== route.element || matchRoute.errorElement !== route.errorElement || matchRoute.hydrateFallbackElement !== route.hydrateFallbackElement) return {\n\t\t\t\t...m,\n\t\t\t\troute\n\t\t\t};\n\t\t\treturn m;\n\t\t});\n\t\tstate = {\n\t\t\t...state,\n\t\t\t...newState\n\t\t};\n\t\tlet unmountedFetchers = [];\n\t\tlet mountedFetchers = [];\n\t\tstate.fetchers.forEach((fetcher, key) => {\n\t\t\tif (fetcher.state === \"idle\") if (fetchersQueuedForDeletion.has(key)) unmountedFetchers.push(key);\n\t\t\telse mountedFetchers.push(key);\n\t\t});\n\t\tfetchersQueuedForDeletion.forEach((key) => {\n\t\t\tif (!state.fetchers.has(key) && !fetchControllers.has(key)) unmountedFetchers.push(key);\n\t\t});\n\t\tif (subscribers.size === 0) bufferedInitialStateUpdate = { newErrors: newState.errors ?? null };\n\t\t[...subscribers].forEach((subscriber) => subscriber(state, {\n\t\t\tdeletedFetchers: unmountedFetchers,\n\t\t\tnewErrors: newState.errors ?? null,\n\t\t\tviewTransitionOpts: opts.viewTransitionOpts,\n\t\t\tflushSync: opts.flushSync === true\n\t\t}));\n\t\tunmountedFetchers.forEach((key) => deleteFetcher(state.fetchers, key));\n\t\tmountedFetchers.forEach((key) => state.fetchers.delete(key));\n\t}\n\tfunction completeNavigation(location, newState, { flushSync } = {}) {\n\t\tlet isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === \"loading\" && location.state?._isRedirect !== true;\n\t\tlet actionData;\n\t\tif (newState.actionData) if (Object.keys(newState.actionData).length > 0) actionData = newState.actionData;\n\t\telse actionData = null;\n\t\telse if (isActionReload) actionData = state.actionData;\n\t\telse actionData = null;\n\t\tlet loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData;\n\t\tlet blockers = state.blockers;\n\t\tif (blockers.size > 0 && !isUninterruptedRevalidation) {\n\t\t\tblockers = new Map(blockers);\n\t\t\tblockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));\n\t\t}\n\t\tlet restoreScrollPosition = isUninterruptedRevalidation ? false : getSavedScrollPosition(location, newState.matches || state.matches);\n\t\tlet preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && location.state?._isRedirect !== true;\n\t\tdataRoutes.commitHmrRoutes();\n\t\tif (isUninterruptedRevalidation) {} else if (pendingAction === \"POP\") {} else if (pendingAction === \"PUSH\") init.history.push(location, location.state);\n\t\telse if (pendingAction === \"REPLACE\") init.history.replace(location, location.state);\n\t\tlet viewTransitionOpts;\n\t\tif (pendingAction === \"POP\") {\n\t\t\tlet priorPaths = appliedViewTransitions.get(state.location.pathname);\n\t\t\tif (priorPaths && priorPaths.has(location.pathname)) viewTransitionOpts = {\n\t\t\t\tcurrentLocation: state.location,\n\t\t\t\tnextLocation: location\n\t\t\t};\n\t\t\telse if (appliedViewTransitions.has(location.pathname)) viewTransitionOpts = {\n\t\t\t\tcurrentLocation: location,\n\t\t\t\tnextLocation: state.location\n\t\t\t};\n\t\t} else if (pendingViewTransitionEnabled) {\n\t\t\tlet toPaths = appliedViewTransitions.get(state.location.pathname);\n\t\t\tif (toPaths) toPaths.add(location.pathname);\n\t\t\telse {\n\t\t\t\ttoPaths = new Set([location.pathname]);\n\t\t\t\tappliedViewTransitions.set(state.location.pathname, toPaths);\n\t\t\t}\n\t\t\tviewTransitionOpts = {\n\t\t\t\tcurrentLocation: state.location,\n\t\t\t\tnextLocation: location\n\t\t\t};\n\t\t}\n\t\tupdateState({\n\t\t\t...newState,\n\t\t\tactionData,\n\t\t\tloaderData,\n\t\t\thistoryAction: pendingAction,\n\t\t\tlocation,\n\t\t\tinitialized: true,\n\t\t\trenderFallback: false,\n\t\t\tnavigation: IDLE_NAVIGATION,\n\t\t\trevalidation: \"idle\",\n\t\t\trestoreScrollPosition,\n\t\t\tpreventScrollReset,\n\t\t\tblockers\n\t\t}, {\n\t\t\tviewTransitionOpts,\n\t\t\tflushSync: flushSync === true\n\t\t});\n\t\tpendingAction = \"POP\";\n\t\tpendingPreventScrollReset = false;\n\t\tpendingViewTransitionEnabled = false;\n\t\tisUninterruptedRevalidation = false;\n\t\tisRevalidationRequired = false;\n\t\tpendingPopstateNavigationDfd?.resolve();\n\t\tpendingPopstateNavigationDfd = null;\n\t\tpendingRevalidationDfd?.resolve();\n\t\tpendingRevalidationDfd = null;\n\t}\n\tasync function navigate(to, opts) {\n\t\tpendingPopstateNavigationDfd?.resolve();\n\t\tpendingPopstateNavigationDfd = null;\n\t\tif (typeof to === \"number\") {\n\t\t\tif (!pendingPopstateNavigationDfd) pendingPopstateNavigationDfd = createDeferred();\n\t\t\tlet promise = pendingPopstateNavigationDfd.promise;\n\t\t\tinit.history.go(to);\n\t\t\treturn promise;\n\t\t}\n\t\tlet instrumentationNavigateMetaReceiver = consumeInstrumentationClientResultMetaReceiver(router);\n\t\tlet { path, submission, error } = normalizeNavigateOptions(false, normalizeTo(state.location, state.matches, basename, to, opts?.fromRouteId, opts?.relative), opts);\n\t\tlet maskPath;\n\t\tif (opts?.mask) maskPath = {\n\t\t\tpathname: \"\",\n\t\t\tsearch: \"\",\n\t\t\thash: \"\",\n\t\t\t...typeof opts.mask === \"string\" ? parsePath(opts.mask) : {\n\t\t\t\t...state.location.mask,\n\t\t\t\t...opts.mask\n\t\t\t}\n\t\t};\n\t\tlet currentLocation = state.location;\n\t\tlet nextLocation = createLocation(currentLocation, path, opts && opts.state, void 0, maskPath);\n\t\tnextLocation = {\n\t\t\t...nextLocation,\n\t\t\t...init.history.encodeLocation(nextLocation)\n\t\t};\n\t\tlet userReplace = opts && opts.replace != null ? opts.replace : void 0;\n\t\tlet historyAction = \"PUSH\";\n\t\tif (userReplace === true) historyAction = \"REPLACE\";\n\t\telse if (userReplace === false) {} else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) historyAction = \"REPLACE\";\n\t\tlet preventScrollReset = opts && \"preventScrollReset\" in opts ? opts.preventScrollReset === true : void 0;\n\t\tlet flushSync = (opts && opts.flushSync) === true;\n\t\tlet blockerKey = shouldBlockNavigation({\n\t\t\tcurrentLocation,\n\t\t\tnextLocation,\n\t\t\thistoryAction\n\t\t});\n\t\tif (blockerKey) {\n\t\t\tupdateBlocker(blockerKey, {\n\t\t\t\tstate: \"blocked\",\n\t\t\t\tlocation: nextLocation,\n\t\t\t\tproceed() {\n\t\t\t\t\tupdateBlocker(blockerKey, {\n\t\t\t\t\t\tstate: \"proceeding\",\n\t\t\t\t\t\tproceed: void 0,\n\t\t\t\t\t\treset: void 0,\n\t\t\t\t\t\tlocation: nextLocation\n\t\t\t\t\t});\n\t\t\t\t\tnavigate(to, opts);\n\t\t\t\t},\n\t\t\t\treset() {\n\t\t\t\t\tlet blockers = new Map(state.blockers);\n\t\t\t\t\tblockers.set(blockerKey, IDLE_BLOCKER);\n\t\t\t\t\tupdateState({ blockers });\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tawait startNavigation(historyAction, nextLocation, {\n\t\t\tsubmission,\n\t\t\tpendingError: error,\n\t\t\tpreventScrollReset,\n\t\t\treplace: opts && opts.replace,\n\t\t\tenableViewTransition: opts && opts.viewTransition,\n\t\t\tflushSync,\n\t\t\tcallSiteDefaultShouldRevalidate: opts && opts.defaultShouldRevalidate,\n\t\t\tinstrumentationNavigateMetaReceiver\n\t\t});\n\t}\n\tfunction revalidate() {\n\t\tif (!pendingRevalidationDfd) pendingRevalidationDfd = createDeferred();\n\t\tinterruptActiveLoads();\n\t\tupdateState({ revalidation: \"loading\" });\n\t\tlet promise = pendingRevalidationDfd.promise;\n\t\tif (state.navigation.state === \"submitting\") return promise;\n\t\tif (state.navigation.state === \"idle\") {\n\t\t\tstartNavigation(state.historyAction, state.location, { startUninterruptedRevalidation: true });\n\t\t\treturn promise;\n\t\t}\n\t\tstartNavigation(pendingAction || state.historyAction, state.navigation.location, {\n\t\t\toverrideNavigation: state.navigation,\n\t\t\tenableViewTransition: pendingViewTransitionEnabled === true\n\t\t});\n\t\treturn promise;\n\t}\n\tasync function startNavigation(historyAction, location, opts) {\n\t\tpendingNavigationController && pendingNavigationController.abort();\n\t\tpendingNavigationController = null;\n\t\tpendingAction = historyAction;\n\t\tisUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true;\n\t\tsaveScrollPosition(state.location, state.matches);\n\t\tpendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n\t\tpendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;\n\t\tlet routesToUse = dataRoutes.activeRoutes;\n\t\tlet matches = opts?.initialHydration && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ? state.matches : matchRoutesImpl(routesToUse, location, basename, false, dataRoutes.branches);\n\t\tlet flushSync = (opts && opts.flushSync) === true;\n\t\tif (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {\n\t\t\tcompleteNavigation(location, { matches }, { flushSync });\n\t\t\treturn;\n\t\t}\n\t\tlet fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname);\n\t\tif (fogOfWar.active && fogOfWar.matches) matches = fogOfWar.matches;\n\t\tif (opts?.instrumentationNavigateMetaReceiver) {\n\t\t\tlet meta = getInstrumentationNavigateMeta(init.history, location, matches);\n\t\t\topts.instrumentationNavigateMetaReceiver(meta);\n\t\t}\n\t\tif (!matches) {\n\t\t\tlet { error, notFoundMatches, route } = handleNavigational404(location.pathname);\n\t\t\tcompleteNavigation(location, {\n\t\t\t\tmatches: notFoundMatches,\n\t\t\t\tloaderData: {},\n\t\t\t\terrors: { [route.id]: error }\n\t\t\t}, { flushSync });\n\t\t\treturn;\n\t\t}\n\t\tlet loadingNavigation = opts && opts.overrideNavigation ? {\n\t\t\t...opts.overrideNavigation,\n\t\t\tmatches,\n\t\t\thistoryAction\n\t\t} : void 0;\n\t\tpendingNavigationController = new AbortController();\n\t\tlet request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);\n\t\tlet scopedContext = init.getContext ? await init.getContext() : new RouterContextProvider();\n\t\tlet pendingActionResult;\n\t\tif (opts && opts.pendingError) pendingActionResult = [findNearestBoundary(matches).route.id, {\n\t\t\ttype: \"error\",\n\t\t\terror: opts.pendingError\n\t\t}];\n\t\telse if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) {\n\t\t\tlet actionResult = await handleAction(request, location, opts.submission, matches, historyAction, scopedContext, fogOfWar.active, opts && opts.initialHydration === true, {\n\t\t\t\treplace: opts.replace,\n\t\t\t\tflushSync\n\t\t\t});\n\t\t\tif (actionResult.shortCircuited) return;\n\t\t\tif (actionResult.pendingActionResult) {\n\t\t\t\tlet [routeId, result] = actionResult.pendingActionResult;\n\t\t\t\tif (isErrorResult(result) && isRouteErrorResponse(result.error) && result.error.status === 404) {\n\t\t\t\t\tpendingNavigationController = null;\n\t\t\t\t\tcompleteNavigation(location, {\n\t\t\t\t\t\tmatches: actionResult.matches,\n\t\t\t\t\t\tloaderData: {},\n\t\t\t\t\t\terrors: { [routeId]: result.error }\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tmatches = actionResult.matches || matches;\n\t\t\tpendingActionResult = actionResult.pendingActionResult;\n\t\t\tloadingNavigation = getLoadingNavigation(location, matches, historyAction, opts.submission);\n\t\t\tflushSync = false;\n\t\t\tfogOfWar.active = false;\n\t\t\trequest = createClientSideRequest(init.history, request.url, request.signal);\n\t\t}\n\t\tlet { shortCircuited, matches: updatedMatches, loaderData, errors, workingFetchers } = await handleLoaders(request, location, matches, historyAction, scopedContext, fogOfWar.active, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, opts && opts.initialHydration === true, flushSync, pendingActionResult, opts && opts.callSiteDefaultShouldRevalidate);\n\t\tif (shortCircuited) return;\n\t\tpendingNavigationController = null;\n\t\tcompleteNavigation(location, {\n\t\t\tmatches: updatedMatches || matches,\n\t\t\t...getActionDataForCommit(pendingActionResult),\n\t\t\tloaderData,\n\t\t\terrors,\n\t\t\t...workingFetchers ? { fetchers: workingFetchers } : {}\n\t\t});\n\t}\n\tasync function handleAction(request, location, submission, matches, historyAction, scopedContext, isFogOfWar, initialHydration, opts = {}) {\n\t\tinterruptActiveLoads();\n\t\tupdateState({ navigation: getSubmittingNavigation(location, matches, historyAction, submission) }, { flushSync: opts.flushSync === true });\n\t\tif (isFogOfWar) {\n\t\t\tlet discoverResult = await discoverRoutes(matches, location.pathname, request.signal);\n\t\t\tif (discoverResult.type === \"aborted\") return { shortCircuited: true };\n\t\t\telse if (discoverResult.type === \"error\") {\n\t\t\t\tif (discoverResult.partialMatches.length === 0) {\n\t\t\t\t\tlet { matches, route } = getShortCircuitMatches(dataRoutes.activeRoutes);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmatches,\n\t\t\t\t\t\tpendingActionResult: [route.id, {\n\t\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\t\terror: discoverResult.error\n\t\t\t\t\t\t}]\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tlet boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;\n\t\t\t\treturn {\n\t\t\t\t\tmatches: discoverResult.partialMatches,\n\t\t\t\t\tpendingActionResult: [boundaryId, {\n\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\terror: discoverResult.error\n\t\t\t\t\t}]\n\t\t\t\t};\n\t\t\t} else if (!discoverResult.matches) {\n\t\t\t\tlet { notFoundMatches, error, route } = handleNavigational404(location.pathname);\n\t\t\t\treturn {\n\t\t\t\t\tmatches: notFoundMatches,\n\t\t\t\t\tpendingActionResult: [route.id, {\n\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\terror\n\t\t\t\t\t}]\n\t\t\t\t};\n\t\t\t} else matches = discoverResult.matches;\n\t\t}\n\t\tlet result;\n\t\tlet actionMatch = getTargetMatch(matches, location);\n\t\tif (!actionMatch.route.action && !actionMatch.route.lazy) result = {\n\t\t\ttype: \"error\",\n\t\t\terror: getInternalRouterError(405, {\n\t\t\t\tmethod: request.method,\n\t\t\t\tpathname: location.pathname,\n\t\t\t\trouteId: actionMatch.route.id\n\t\t\t})\n\t\t};\n\t\telse {\n\t\t\tlet results = await callDataStrategy(request, location, getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, location, matches, actionMatch, initialHydration ? [] : hydrationRouteProperties, scopedContext), scopedContext, null);\n\t\t\tresult = results[actionMatch.route.id];\n\t\t\tif (!result) {\n\t\t\t\tfor (let match of matches) if (results[match.route.id]) {\n\t\t\t\t\tresult = results[match.route.id];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (request.signal.aborted) return { shortCircuited: true };\n\t\t}\n\t\tif (isRedirectResult(result)) {\n\t\t\tlet replace;\n\t\t\tif (opts && opts.replace != null) replace = opts.replace;\n\t\t\telse replace = normalizeRedirectLocation(result.response.headers.get(\"Location\"), new URL(request.url), basename, init.history) === state.location.pathname + state.location.search;\n\t\t\tawait startRedirectNavigation(request, result, true, {\n\t\t\t\tsubmission,\n\t\t\t\treplace\n\t\t\t});\n\t\t\treturn { shortCircuited: true };\n\t\t}\n\t\tif (isErrorResult(result)) {\n\t\t\tlet boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);\n\t\t\tif ((opts && opts.replace) !== true) pendingAction = \"PUSH\";\n\t\t\treturn {\n\t\t\t\tmatches,\n\t\t\t\tpendingActionResult: [\n\t\t\t\t\tboundaryMatch.route.id,\n\t\t\t\t\tresult,\n\t\t\t\t\tactionMatch.route.id\n\t\t\t\t]\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tmatches,\n\t\t\tpendingActionResult: [actionMatch.route.id, result]\n\t\t};\n\t}\n\tasync function handleLoaders(request, location, matches, historyAction, scopedContext, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace, initialHydration, flushSync, pendingActionResult, callSiteDefaultShouldRevalidate) {\n\t\tlet loadingNavigation = overrideNavigation || getLoadingNavigation(location, matches, historyAction, submission);\n\t\tlet activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);\n\t\tlet shouldUpdateNavigationState = !isUninterruptedRevalidation && !initialHydration;\n\t\tif (isFogOfWar) {\n\t\t\tif (shouldUpdateNavigationState) {\n\t\t\t\tlet actionData = getUpdatedActionData(pendingActionResult);\n\t\t\t\tupdateState({\n\t\t\t\t\tnavigation: loadingNavigation,\n\t\t\t\t\t...actionData !== void 0 ? { actionData } : {}\n\t\t\t\t}, { flushSync });\n\t\t\t}\n\t\t\tlet discoverResult = await discoverRoutes(matches, location.pathname, request.signal);\n\t\t\tif (discoverResult.type === \"aborted\") return { shortCircuited: true };\n\t\t\telse if (discoverResult.type === \"error\") {\n\t\t\t\tif (discoverResult.partialMatches.length === 0) {\n\t\t\t\t\tlet { matches, route } = getShortCircuitMatches(dataRoutes.activeRoutes);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmatches,\n\t\t\t\t\t\tloaderData: {},\n\t\t\t\t\t\terrors: { [route.id]: discoverResult.error }\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tlet boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;\n\t\t\t\treturn {\n\t\t\t\t\tmatches: discoverResult.partialMatches,\n\t\t\t\t\tloaderData: {},\n\t\t\t\t\terrors: { [boundaryId]: discoverResult.error }\n\t\t\t\t};\n\t\t\t} else if (!discoverResult.matches) {\n\t\t\t\tlet { error, notFoundMatches, route } = handleNavigational404(location.pathname);\n\t\t\t\treturn {\n\t\t\t\t\tmatches: notFoundMatches,\n\t\t\t\t\tloaderData: {},\n\t\t\t\t\terrors: { [route.id]: error }\n\t\t\t\t};\n\t\t\t} else matches = discoverResult.matches;\n\t\t}\n\t\tlet routesToUse = dataRoutes.activeRoutes;\n\t\tlet { dsMatches, revalidatingFetchers } = getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest, init.history, state, matches, activeSubmission, location, initialHydration ? [] : hydrationRouteProperties, initialHydration === true, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, init.patchRoutesOnNavigation != null, dataRoutes.branches, pendingActionResult, callSiteDefaultShouldRevalidate);\n\t\tpendingNavigationLoadId = ++incrementingLoadId;\n\t\tif (!init.dataStrategy && !dsMatches.some((m) => m.shouldLoad) && !dsMatches.some((m) => m.route.middleware && m.route.middleware.length > 0) && revalidatingFetchers.length === 0) {\n\t\t\tlet workingFetchers = new Map(state.fetchers);\n\t\t\tlet didUpdateFetcherRedirects = markFetchRedirectsDone(workingFetchers);\n\t\t\tcompleteNavigation(location, {\n\t\t\t\tmatches,\n\t\t\t\tloaderData: {},\n\t\t\t\terrors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? { [pendingActionResult[0]]: pendingActionResult[1].error } : null,\n\t\t\t\t...getActionDataForCommit(pendingActionResult),\n\t\t\t\t...didUpdateFetcherRedirects ? { fetchers: workingFetchers } : {}\n\t\t\t}, { flushSync });\n\t\t\treturn { shortCircuited: true };\n\t\t}\n\t\tif (shouldUpdateNavigationState) {\n\t\t\tlet updates = {};\n\t\t\tif (!isFogOfWar) {\n\t\t\t\tupdates.navigation = loadingNavigation;\n\t\t\t\tlet actionData = getUpdatedActionData(pendingActionResult);\n\t\t\t\tif (actionData !== void 0) updates.actionData = actionData;\n\t\t\t}\n\t\t\tif (revalidatingFetchers.length > 0) updates.fetchers = getUpdatedRevalidatingFetchers(revalidatingFetchers);\n\t\t\tupdateState(updates, { flushSync });\n\t\t}\n\t\trevalidatingFetchers.forEach((rf) => {\n\t\t\tabortFetcher(rf.key);\n\t\t\tif (rf.controller) fetchControllers.set(rf.key, rf.controller);\n\t\t});\n\t\tlet abortPendingFetchRevalidations = () => revalidatingFetchers.forEach((f) => abortFetcher(f.key));\n\t\tif (pendingNavigationController) pendingNavigationController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n\t\tlet { loaderResults, fetcherResults } = await callLoadersAndMaybeResolveData(dsMatches, revalidatingFetchers, request, location, scopedContext);\n\t\tif (request.signal.aborted) return { shortCircuited: true };\n\t\tif (pendingNavigationController) pendingNavigationController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n\t\trevalidatingFetchers.forEach((rf) => fetchControllers.delete(rf.key));\n\t\tlet redirect = findRedirect(loaderResults);\n\t\tif (redirect) {\n\t\t\tawait startRedirectNavigation(request, redirect.result, true, { replace });\n\t\t\treturn { shortCircuited: true };\n\t\t}\n\t\tredirect = findRedirect(fetcherResults);\n\t\tif (redirect) {\n\t\t\tfetchRedirectIds.add(redirect.key);\n\t\t\tawait startRedirectNavigation(request, redirect.result, true, { replace });\n\t\t\treturn { shortCircuited: true };\n\t\t}\n\t\tlet workingFetchers = new Map(state.fetchers);\n\t\tlet { loaderData, errors } = processLoaderData(state, matches, loaderResults, pendingActionResult, revalidatingFetchers, fetcherResults, workingFetchers);\n\t\tif (initialHydration && state.errors) errors = {\n\t\t\t...state.errors,\n\t\t\t...errors\n\t\t};\n\t\tlet didUpdateFetcherRedirects = markFetchRedirectsDone(workingFetchers);\n\t\tlet didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId, workingFetchers);\n\t\tlet shouldUpdateFetchers = didUpdateFetcherRedirects || didAbortFetchLoads || revalidatingFetchers.length > 0;\n\t\treturn {\n\t\t\tmatches,\n\t\t\tloaderData,\n\t\t\terrors,\n\t\t\t...shouldUpdateFetchers ? { workingFetchers } : {}\n\t\t};\n\t}\n\tfunction getUpdatedActionData(pendingActionResult) {\n\t\tif (pendingActionResult && !isErrorResult(pendingActionResult[1])) return { [pendingActionResult[0]]: pendingActionResult[1].data };\n\t\telse if (state.actionData) if (Object.keys(state.actionData).length === 0) return null;\n\t\telse return state.actionData;\n\t}\n\tfunction getUpdatedRevalidatingFetchers(revalidatingFetchers) {\n\t\tlet workingFetchers = new Map(state.fetchers);\n\t\trevalidatingFetchers.forEach((rf) => {\n\t\t\tlet fetcher = workingFetchers.get(rf.key);\n\t\t\tlet revalidatingFetcher = getLoadingFetcher(void 0, fetcher ? fetcher.data : void 0);\n\t\t\tworkingFetchers.set(rf.key, revalidatingFetcher);\n\t\t});\n\t\treturn workingFetchers;\n\t}\n\tasync function fetch(key, routeId, href, opts) {\n\t\tabortFetcher(key);\n\t\tlet flushSync = (opts && opts.flushSync) === true;\n\t\tlet instrumentationResultMetaReceiver = consumeInstrumentationClientResultMetaReceiver(router);\n\t\tlet routesToUse = dataRoutes.activeRoutes;\n\t\tlet normalizedPath = normalizeTo(state.location, state.matches, basename, href, routeId, opts?.relative);\n\t\tlet matches = matchRoutesImpl(routesToUse, normalizedPath, basename, false, dataRoutes.branches);\n\t\tlet fogOfWar = checkFogOfWar(matches, routesToUse, normalizedPath);\n\t\tif (fogOfWar.active && fogOfWar.matches) matches = fogOfWar.matches;\n\t\tif (instrumentationResultMetaReceiver) instrumentationResultMetaReceiver(getInstrumentationNavigateMeta(init.history, normalizedPath, matches));\n\t\tif (!matches) {\n\t\t\tsetFetcherError(key, routeId, getInternalRouterError(404, { pathname: normalizedPath }), { flushSync });\n\t\t\treturn;\n\t\t}\n\t\tlet { path, submission, error } = normalizeNavigateOptions(true, normalizedPath, opts);\n\t\tif (error) {\n\t\t\tsetFetcherError(key, routeId, error, { flushSync });\n\t\t\treturn;\n\t\t}\n\t\tlet scopedContext = init.getContext ? await init.getContext() : new RouterContextProvider();\n\t\tlet preventScrollReset = (opts && opts.preventScrollReset) === true;\n\t\tif (submission && isMutationMethod(submission.formMethod)) {\n\t\t\tawait handleFetcherAction(key, routeId, path, matches, scopedContext, fogOfWar.active, flushSync, preventScrollReset, submission, opts && opts.defaultShouldRevalidate);\n\t\t\treturn;\n\t\t}\n\t\tfetchLoadMatches.set(key, {\n\t\t\trouteId,\n\t\t\tpath\n\t\t});\n\t\tawait handleFetcherLoader(key, routeId, path, matches, scopedContext, fogOfWar.active, flushSync, preventScrollReset, submission);\n\t}\n\tasync function handleFetcherAction(key, routeId, path, requestMatches, scopedContext, isFogOfWar, flushSync, preventScrollReset, submission, callSiteDefaultShouldRevalidate) {\n\t\tinterruptActiveLoads();\n\t\tfetchLoadMatches.delete(key);\n\t\tupdateFetcherState(key, getSubmittingFetcher(submission, state.fetchers.get(key)), { flushSync });\n\t\tlet abortController = new AbortController();\n\t\tlet fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);\n\t\tif (isFogOfWar) {\n\t\t\tlet discoverResult = await discoverRoutes(requestMatches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);\n\t\t\tif (discoverResult.type === \"aborted\") return;\n\t\t\telse if (discoverResult.type === \"error\") {\n\t\t\t\tsetFetcherError(key, routeId, discoverResult.error, { flushSync });\n\t\t\t\treturn;\n\t\t\t} else if (!discoverResult.matches) {\n\t\t\t\tsetFetcherError(key, routeId, getInternalRouterError(404, { pathname: path }), { flushSync });\n\t\t\t\treturn;\n\t\t\t} else requestMatches = discoverResult.matches;\n\t\t}\n\t\tlet match = getTargetMatch(requestMatches, path);\n\t\tif (!match.route.action && !match.route.lazy) {\n\t\t\tsetFetcherError(key, routeId, getInternalRouterError(405, {\n\t\t\t\tmethod: submission.formMethod,\n\t\t\t\tpathname: path,\n\t\t\t\trouteId\n\t\t\t}), { flushSync });\n\t\t\treturn;\n\t\t}\n\t\tfetchControllers.set(key, abortController);\n\t\tlet originatingLoadId = incrementingLoadId;\n\t\tlet fetchMatches = getTargetedDataStrategyMatches(mapRouteProperties, manifest, fetchRequest, path, requestMatches, match, hydrationRouteProperties, scopedContext);\n\t\tlet actionResults = await callDataStrategy(fetchRequest, path, fetchMatches, scopedContext, key);\n\t\tlet actionResult = actionResults[match.route.id];\n\t\tif (!actionResult) {\n\t\t\tfor (let match of fetchMatches) if (actionResults[match.route.id]) {\n\t\t\t\tactionResult = actionResults[match.route.id];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (fetchRequest.signal.aborted) {\n\t\t\tif (fetchControllers.get(key) === abortController) fetchControllers.delete(key);\n\t\t\treturn;\n\t\t}\n\t\tif (fetchersQueuedForDeletion.has(key)) {\n\t\t\tif (isRedirectResult(actionResult) || isErrorResult(actionResult)) {\n\t\t\t\tupdateFetcherState(key, getDoneFetcher(void 0));\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else {\n\t\t\tif (isRedirectResult(actionResult)) {\n\t\t\t\tfetchControllers.delete(key);\n\t\t\t\tif (pendingNavigationLoadId > originatingLoadId) {\n\t\t\t\t\tupdateFetcherState(key, getDoneFetcher(void 0));\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\tfetchRedirectIds.add(key);\n\t\t\t\t\tupdateFetcherState(key, getLoadingFetcher(submission));\n\t\t\t\t\treturn startRedirectNavigation(fetchRequest, actionResult, false, {\n\t\t\t\t\t\tfetcherSubmission: submission,\n\t\t\t\t\t\tpreventScrollReset\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (isErrorResult(actionResult)) {\n\t\t\t\tsetFetcherError(key, routeId, actionResult.error);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tlet nextLocation = state.navigation.location || state.location;\n\t\tlet revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal);\n\t\tlet routesToUse = dataRoutes.activeRoutes;\n\t\tlet matches = state.navigation.state !== \"idle\" ? matchRoutesImpl(routesToUse, state.navigation.location, basename, false, dataRoutes.branches) : state.matches;\n\t\tinvariant(matches, \"Didn't find any matches after fetcher action\");\n\t\tlet loadId = ++incrementingLoadId;\n\t\tfetchReloadIds.set(key, loadId);\n\t\tlet { dsMatches, revalidatingFetchers } = getMatchesToLoad(revalidationRequest, scopedContext, mapRouteProperties, manifest, init.history, state, matches, submission, nextLocation, hydrationRouteProperties, false, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, init.patchRoutesOnNavigation != null, dataRoutes.branches, [match.route.id, actionResult], callSiteDefaultShouldRevalidate);\n\t\tlet loadFetcher = getLoadingFetcher(submission, actionResult.data);\n\t\tlet workingFetchers = new Map(state.fetchers);\n\t\tworkingFetchers.set(key, loadFetcher);\n\t\trevalidatingFetchers.filter((rf) => rf.key !== key).forEach((rf) => {\n\t\t\tlet staleKey = rf.key;\n\t\t\tlet existingFetcher = workingFetchers.get(staleKey);\n\t\t\tlet revalidatingFetcher = getLoadingFetcher(void 0, existingFetcher ? existingFetcher.data : void 0);\n\t\t\tworkingFetchers.set(staleKey, revalidatingFetcher);\n\t\t\tabortFetcher(staleKey);\n\t\t\tif (rf.controller) fetchControllers.set(staleKey, rf.controller);\n\t\t});\n\t\tupdateState({ fetchers: workingFetchers });\n\t\tlet abortPendingFetchRevalidations = () => revalidatingFetchers.forEach((rf) => abortFetcher(rf.key));\n\t\tabortController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n\t\tlet { loaderResults, fetcherResults } = await callLoadersAndMaybeResolveData(dsMatches, revalidatingFetchers, revalidationRequest, nextLocation, scopedContext);\n\t\tif (abortController.signal.aborted) return;\n\t\tabortController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n\t\tfetchReloadIds.delete(key);\n\t\tfetchControllers.delete(key);\n\t\trevalidatingFetchers.forEach((r) => fetchControllers.delete(r.key));\n\t\tlet fetcherIsMounted = state.fetchers.has(key);\n\t\tlet getRedirectStateWithDoneFetcher = (s) => {\n\t\t\tif (!fetcherIsMounted) return s;\n\t\t\tlet workingFetchers = new Map(s.fetchers);\n\t\t\tworkingFetchers.set(key, getDoneFetcher(actionResult.data));\n\t\t\treturn {\n\t\t\t\t...s,\n\t\t\t\tfetchers: workingFetchers\n\t\t\t};\n\t\t};\n\t\tlet redirect = findRedirect(loaderResults);\n\t\tif (redirect) {\n\t\t\tstate = getRedirectStateWithDoneFetcher(state);\n\t\t\treturn startRedirectNavigation(revalidationRequest, redirect.result, false, { preventScrollReset });\n\t\t}\n\t\tredirect = findRedirect(fetcherResults);\n\t\tif (redirect) {\n\t\t\tfetchRedirectIds.add(redirect.key);\n\t\t\tstate = getRedirectStateWithDoneFetcher(state);\n\t\t\treturn startRedirectNavigation(revalidationRequest, redirect.result, false, { preventScrollReset });\n\t\t}\n\t\tlet finalFetchers = new Map(state.fetchers);\n\t\tif (fetcherIsMounted) finalFetchers.set(key, getDoneFetcher(actionResult.data));\n\t\tlet { loaderData, errors } = processLoaderData(state, matches, loaderResults, void 0, revalidatingFetchers, fetcherResults, finalFetchers);\n\t\tabortStaleFetchLoads(loadId, finalFetchers);\n\t\tif (state.navigation.state === \"loading\" && loadId > pendingNavigationLoadId) {\n\t\t\tinvariant(pendingAction, \"Expected pending action\");\n\t\t\tpendingNavigationController && pendingNavigationController.abort();\n\t\t\tcompleteNavigation(state.navigation.location, {\n\t\t\t\tmatches,\n\t\t\t\tloaderData,\n\t\t\t\terrors,\n\t\t\t\tfetchers: finalFetchers\n\t\t\t});\n\t\t} else {\n\t\t\tupdateState({\n\t\t\t\terrors,\n\t\t\t\tloaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors),\n\t\t\t\tfetchers: finalFetchers\n\t\t\t});\n\t\t\tisRevalidationRequired = false;\n\t\t}\n\t}\n\tasync function handleFetcherLoader(key, routeId, path, matches, scopedContext, isFogOfWar, flushSync, preventScrollReset, submission) {\n\t\tlet existingFetcher = state.fetchers.get(key);\n\t\tupdateFetcherState(key, getLoadingFetcher(submission, existingFetcher ? existingFetcher.data : void 0), { flushSync });\n\t\tlet abortController = new AbortController();\n\t\tlet fetchRequest = createClientSideRequest(init.history, path, abortController.signal);\n\t\tif (isFogOfWar) {\n\t\t\tlet discoverResult = await discoverRoutes(matches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);\n\t\t\tif (discoverResult.type === \"aborted\") return;\n\t\t\telse if (discoverResult.type === \"error\") {\n\t\t\t\tsetFetcherError(key, routeId, discoverResult.error, { flushSync });\n\t\t\t\treturn;\n\t\t\t} else if (!discoverResult.matches) {\n\t\t\t\tsetFetcherError(key, routeId, getInternalRouterError(404, { pathname: path }), { flushSync });\n\t\t\t\treturn;\n\t\t\t} else matches = discoverResult.matches;\n\t\t}\n\t\tlet match = getTargetMatch(matches, path);\n\t\tfetchControllers.set(key, abortController);\n\t\tlet originatingLoadId = incrementingLoadId;\n\t\tlet results = await callDataStrategy(fetchRequest, path, getTargetedDataStrategyMatches(mapRouteProperties, manifest, fetchRequest, path, matches, match, hydrationRouteProperties, scopedContext), scopedContext, key);\n\t\tlet result = results[match.route.id];\n\t\tif (!result) {\n\t\t\tfor (let match of matches) if (results[match.route.id]) {\n\t\t\t\tresult = results[match.route.id];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (fetchControllers.get(key) === abortController) fetchControllers.delete(key);\n\t\tif (fetchRequest.signal.aborted) return;\n\t\tif (fetchersQueuedForDeletion.has(key)) {\n\t\t\tupdateFetcherState(key, getDoneFetcher(void 0));\n\t\t\treturn;\n\t\t}\n\t\tif (isRedirectResult(result)) if (pendingNavigationLoadId > originatingLoadId) {\n\t\t\tupdateFetcherState(key, getDoneFetcher(void 0));\n\t\t\treturn;\n\t\t} else {\n\t\t\tfetchRedirectIds.add(key);\n\t\t\tawait startRedirectNavigation(fetchRequest, result, false, { preventScrollReset });\n\t\t\treturn;\n\t\t}\n\t\tif (isErrorResult(result)) {\n\t\t\tsetFetcherError(key, routeId, result.error);\n\t\t\treturn;\n\t\t}\n\t\tupdateFetcherState(key, getDoneFetcher(result.data));\n\t}\n\t/**\n\t* Utility function to handle redirects returned from an action or loader.\n\t* Normally, a redirect \"replaces\" the navigation that triggered it. So, for\n\t* example:\n\t*\n\t* - user is on /a\n\t* - user clicks a link to /b\n\t* - loader for /b redirects to /c\n\t*\n\t* In a non-JS app the browser would track the in-flight navigation to /b and\n\t* then replace it with /c when it encountered the redirect response. In\n\t* the end it would only ever update the URL bar with /c.\n\t*\n\t* In client-side routing using pushState/replaceState, we aim to emulate\n\t* this behavior and we also do not update history until the end of the\n\t* navigation (including processed redirects). This means that we never\n\t* actually touch history until we've processed redirects, so we just use\n\t* the history action from the original navigation (PUSH or REPLACE).\n\t*/\n\tasync function startRedirectNavigation(request, redirect, isNavigation, { submission, fetcherSubmission, preventScrollReset, replace } = {}) {\n\t\tif (!isNavigation) {\n\t\t\tpendingPopstateNavigationDfd?.resolve();\n\t\t\tpendingPopstateNavigationDfd = null;\n\t\t}\n\t\tif (redirect.response.headers.has(\"X-Remix-Revalidate\")) isRevalidationRequired = true;\n\t\tlet location = redirect.response.headers.get(\"Location\");\n\t\tinvariant(location, \"Expected a Location header on the redirect Response\");\n\t\tlocation = normalizeRedirectLocation(location, new URL(request.url), basename, init.history);\n\t\tlet redirectLocation = createLocation(state.location, location, { _isRedirect: true });\n\t\tif (isBrowser) {\n\t\t\tlet isDocumentReload = false;\n\t\t\tif (redirect.response.headers.has(\"X-Remix-Reload-Document\")) isDocumentReload = true;\n\t\t\telse if (isAbsoluteUrl(location)) {\n\t\t\t\tconst url = createBrowserURLImpl(routerWindow, location, true);\n\t\t\t\tisDocumentReload = url.origin !== routerWindow.location.origin || stripBasename(url.pathname, basename) == null;\n\t\t\t}\n\t\t\tif (isDocumentReload) {\n\t\t\t\tif (replace) routerWindow.location.replace(location);\n\t\t\t\telse routerWindow.location.assign(location);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tpendingNavigationController = null;\n\t\tlet redirectNavigationType = replace === true || redirect.response.headers.has(\"X-Remix-Replace\") ? \"REPLACE\" : \"PUSH\";\n\t\tlet { formMethod, formAction, formEncType } = state.navigation;\n\t\tif (!submission && !fetcherSubmission && formMethod && formAction && formEncType) submission = getSubmissionFromNavigation(state.navigation);\n\t\tlet activeSubmission = submission || fetcherSubmission;\n\t\tif (redirectPreserveMethodStatusCodes.has(redirect.response.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) await startNavigation(redirectNavigationType, redirectLocation, {\n\t\t\tsubmission: {\n\t\t\t\t...activeSubmission,\n\t\t\t\tformAction: location\n\t\t\t},\n\t\t\tpreventScrollReset: preventScrollReset || pendingPreventScrollReset,\n\t\t\tenableViewTransition: isNavigation ? pendingViewTransitionEnabled : void 0\n\t\t});\n\t\telse await startNavigation(redirectNavigationType, redirectLocation, {\n\t\t\toverrideNavigation: getLoadingNavigation(redirectLocation, [], redirectNavigationType, submission),\n\t\t\tfetcherSubmission,\n\t\t\tpreventScrollReset: preventScrollReset || pendingPreventScrollReset,\n\t\t\tenableViewTransition: isNavigation ? pendingViewTransitionEnabled : void 0\n\t\t});\n\t}\n\tasync function callDataStrategy(request, path, matches, scopedContext, fetcherKey) {\n\t\tlet results;\n\t\tlet dataResults = {};\n\t\ttry {\n\t\t\tresults = await callDataStrategyImpl(dataStrategyImpl, request, path, matches, fetcherKey, scopedContext, false);\n\t\t} catch (e) {\n\t\t\tmatches.filter((m) => m.shouldLoad).forEach((m) => {\n\t\t\t\tdataResults[m.route.id] = {\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terror: e\n\t\t\t\t};\n\t\t\t});\n\t\t\treturn dataResults;\n\t\t}\n\t\tif (request.signal.aborted) return dataResults;\n\t\tif (!isMutationMethod(request.method)) for (let match of matches) {\n\t\t\tif (results[match.route.id]?.type === \"error\") break;\n\t\t\tif (!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] = {\n\t\t\t\ttype: \"error\",\n\t\t\t\tresult: /* @__PURE__ */ new Error(`No result returned from dataStrategy for route ${match.route.id}`)\n\t\t\t};\n\t\t}\n\t\tfor (let [routeId, result] of Object.entries(results)) if (isRedirectDataStrategyResult(result)) {\n\t\t\tlet response = result.result;\n\t\t\tdataResults[routeId] = {\n\t\t\t\ttype: \"redirect\",\n\t\t\t\tresponse: normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename)\n\t\t\t};\n\t\t} else dataResults[routeId] = await convertDataStrategyResultToDataResult(result);\n\t\treturn dataResults;\n\t}\n\tasync function callLoadersAndMaybeResolveData(matches, fetchersToLoad, request, location, scopedContext) {\n\t\tlet loaderResultsPromise = callDataStrategy(request, location, matches, scopedContext, null);\n\t\tlet fetcherResultsPromise = Promise.all(fetchersToLoad.map(async (f) => {\n\t\t\tif (f.matches && f.match && f.request && f.controller) {\n\t\t\t\tlet result = (await callDataStrategy(f.request, f.path, f.matches, scopedContext, f.key))[f.match.route.id];\n\t\t\t\treturn { [f.key]: result };\n\t\t\t} else return Promise.resolve({ [f.key]: {\n\t\t\t\ttype: \"error\",\n\t\t\t\terror: getInternalRouterError(404, { pathname: f.path })\n\t\t\t} });\n\t\t}));\n\t\treturn {\n\t\t\tloaderResults: await loaderResultsPromise,\n\t\t\tfetcherResults: (await fetcherResultsPromise).reduce((acc, r) => Object.assign(acc, r), {})\n\t\t};\n\t}\n\tfunction interruptActiveLoads() {\n\t\tisRevalidationRequired = true;\n\t\tfetchLoadMatches.forEach((_, key) => {\n\t\t\tif (fetchControllers.has(key)) cancelledFetcherLoads.add(key);\n\t\t\tabortFetcher(key);\n\t\t});\n\t}\n\tfunction updateFetcherState(key, fetcher, opts = {}) {\n\t\tlet workingFetchers = new Map(state.fetchers);\n\t\tworkingFetchers.set(key, fetcher);\n\t\tupdateState({ fetchers: workingFetchers }, { flushSync: (opts && opts.flushSync) === true });\n\t}\n\tfunction setFetcherError(key, routeId, error, opts = {}) {\n\t\tlet boundaryMatch = findNearestBoundary(state.matches, routeId);\n\t\tlet workingFetchers = new Map(state.fetchers);\n\t\tdeleteFetcher(workingFetchers, key);\n\t\tupdateState({\n\t\t\terrors: { [boundaryMatch.route.id]: error },\n\t\t\tfetchers: workingFetchers\n\t\t}, { flushSync: (opts && opts.flushSync) === true });\n\t}\n\tfunction getFetcher(key) {\n\t\tactiveFetchers.set(key, (activeFetchers.get(key) || 0) + 1);\n\t\tif (fetchersQueuedForDeletion.has(key)) fetchersQueuedForDeletion.delete(key);\n\t\treturn state.fetchers.get(key) || IDLE_FETCHER;\n\t}\n\tfunction resetFetcher(key, opts) {\n\t\tabortFetcher(key, opts?.reason);\n\t\tupdateFetcherState(key, getDoneFetcher(null));\n\t}\n\tfunction deleteFetcher(fetchers, key) {\n\t\tlet fetcher = state.fetchers.get(key);\n\t\tif (fetchControllers.has(key) && !(fetcher && fetcher.state === \"loading\" && fetchReloadIds.has(key))) abortFetcher(key);\n\t\tfetchLoadMatches.delete(key);\n\t\tfetchReloadIds.delete(key);\n\t\tfetchRedirectIds.delete(key);\n\t\tfetchersQueuedForDeletion.delete(key);\n\t\tcancelledFetcherLoads.delete(key);\n\t\tfetchers.delete(key);\n\t}\n\tfunction queueFetcherForDeletion(key) {\n\t\tlet count = (activeFetchers.get(key) || 0) - 1;\n\t\tif (count <= 0) {\n\t\t\tactiveFetchers.delete(key);\n\t\t\tfetchersQueuedForDeletion.add(key);\n\t\t} else activeFetchers.set(key, count);\n\t\tupdateState({ fetchers: new Map(state.fetchers) });\n\t}\n\tfunction abortFetcher(key, reason) {\n\t\tlet controller = fetchControllers.get(key);\n\t\tif (controller) {\n\t\t\tcontroller.abort(reason);\n\t\t\tfetchControllers.delete(key);\n\t\t}\n\t}\n\tfunction markFetchersDone(keys, fetchers) {\n\t\tfor (let key of keys) {\n\t\t\tlet fetcher = fetchers.get(key);\n\t\t\tinvariant(fetcher, `Expected fetcher: ${key}`);\n\t\t\tlet doneFetcher = getDoneFetcher(fetcher.data);\n\t\t\tfetchers.set(key, doneFetcher);\n\t\t}\n\t}\n\tfunction markFetchRedirectsDone(fetchers) {\n\t\tlet doneKeys = [];\n\t\tlet didUpdateFetchers = false;\n\t\tfor (let key of fetchRedirectIds) {\n\t\t\tlet fetcher = fetchers.get(key);\n\t\t\tinvariant(fetcher, `Expected fetcher: ${key}`);\n\t\t\tif (fetcher.state === \"loading\") {\n\t\t\t\tfetchRedirectIds.delete(key);\n\t\t\t\tdoneKeys.push(key);\n\t\t\t\tdidUpdateFetchers = true;\n\t\t\t}\n\t\t}\n\t\tmarkFetchersDone(doneKeys, fetchers);\n\t\treturn didUpdateFetchers;\n\t}\n\tfunction abortStaleFetchLoads(landedId, fetchers) {\n\t\tlet yeetedKeys = [];\n\t\tfor (let [key, id] of fetchReloadIds) if (id < landedId) {\n\t\t\tlet fetcher = fetchers.get(key);\n\t\t\tinvariant(fetcher, `Expected fetcher: ${key}`);\n\t\t\tif (fetcher.state === \"loading\") {\n\t\t\t\tabortFetcher(key);\n\t\t\t\tfetchReloadIds.delete(key);\n\t\t\t\tyeetedKeys.push(key);\n\t\t\t}\n\t\t}\n\t\tmarkFetchersDone(yeetedKeys, fetchers);\n\t\treturn yeetedKeys.length > 0;\n\t}\n\tfunction getBlocker(key, fn) {\n\t\tlet blocker = state.blockers.get(key) || IDLE_BLOCKER;\n\t\tif (blockerFunctions.get(key) !== fn) blockerFunctions.set(key, fn);\n\t\treturn blocker;\n\t}\n\tfunction deleteBlocker(key) {\n\t\tstate.blockers.delete(key);\n\t\tblockerFunctions.delete(key);\n\t}\n\tfunction updateBlocker(key, newBlocker) {\n\t\tlet blocker = state.blockers.get(key) || IDLE_BLOCKER;\n\t\tinvariant(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}`);\n\t\tlet blockers = new Map(state.blockers);\n\t\tblockers.set(key, newBlocker);\n\t\tupdateState({ blockers });\n\t}\n\tfunction shouldBlockNavigation({ currentLocation, nextLocation, historyAction }) {\n\t\tif (blockerFunctions.size === 0) return;\n\t\tif (blockerFunctions.size > 1) warning(false, \"A router only supports one blocker at a time\");\n\t\tlet entries = Array.from(blockerFunctions.entries());\n\t\tlet [blockerKey, blockerFunction] = entries[entries.length - 1];\n\t\tlet blocker = state.blockers.get(blockerKey);\n\t\tif (blocker && blocker.state === \"proceeding\") return;\n\t\tif (blockerFunction({\n\t\t\tcurrentLocation,\n\t\t\tnextLocation,\n\t\t\thistoryAction\n\t\t})) return blockerKey;\n\t}\n\tfunction handleNavigational404(pathname) {\n\t\tlet error = getInternalRouterError(404, { pathname });\n\t\tlet routesToUse = dataRoutes.activeRoutes;\n\t\tlet { matches, route } = getShortCircuitMatches(routesToUse);\n\t\treturn {\n\t\t\tnotFoundMatches: matches,\n\t\t\troute,\n\t\t\terror\n\t\t};\n\t}\n\tfunction enableScrollRestoration(positions, getPosition, getKey) {\n\t\tsavedScrollPositions = positions;\n\t\tgetScrollPosition = getPosition;\n\t\tgetScrollRestorationKey = getKey || null;\n\t\tif (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) {\n\t\t\tinitialScrollRestored = true;\n\t\t\tlet y = getSavedScrollPosition(state.location, state.matches);\n\t\t\tif (y != null) updateState({ restoreScrollPosition: y });\n\t\t}\n\t\treturn () => {\n\t\t\tsavedScrollPositions = null;\n\t\t\tgetScrollPosition = null;\n\t\t\tgetScrollRestorationKey = null;\n\t\t};\n\t}\n\tfunction getScrollKey(location, matches) {\n\t\tif (getScrollRestorationKey) return getScrollRestorationKey(location, matches.map((m) => convertRouteMatchToUiMatch(m, state.loaderData))) || location.key;\n\t\treturn location.key;\n\t}\n\tfunction saveScrollPosition(location, matches) {\n\t\tif (savedScrollPositions && getScrollPosition) {\n\t\t\tlet key = getScrollKey(location, matches);\n\t\t\tsavedScrollPositions[key] = getScrollPosition();\n\t\t}\n\t}\n\tfunction getSavedScrollPosition(location, matches) {\n\t\tif (savedScrollPositions) {\n\t\t\tlet key = getScrollKey(location, matches);\n\t\t\tlet y = savedScrollPositions[key];\n\t\t\tif (typeof y === \"number\") return y;\n\t\t}\n\t\treturn null;\n\t}\n\tfunction checkFogOfWar(matches, routesToUse, pathname) {\n\t\tif (init.patchRoutesOnNavigation) {\n\t\t\tlet activeBranches = dataRoutes.branches;\n\t\t\tif (!matches) return {\n\t\t\t\tactive: true,\n\t\t\t\tmatches: matchRoutesImpl(routesToUse, pathname, basename, true, activeBranches) || []\n\t\t\t};\n\t\t\telse if (Object.keys(matches[0].params).length > 0) return {\n\t\t\t\tactive: true,\n\t\t\t\tmatches: matchRoutesImpl(routesToUse, pathname, basename, true, activeBranches)\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tactive: false,\n\t\t\tmatches: null\n\t\t};\n\t}\n\tasync function discoverRoutes(matches, pathname, signal, fetcherKey) {\n\t\tif (!init.patchRoutesOnNavigation) return {\n\t\t\ttype: \"success\",\n\t\t\tmatches\n\t\t};\n\t\tlet partialMatches = matches;\n\t\twhile (true) {\n\t\t\tlet localManifest = manifest;\n\t\t\ttry {\n\t\t\t\tawait init.patchRoutesOnNavigation({\n\t\t\t\t\tsignal,\n\t\t\t\t\tpath: pathname,\n\t\t\t\t\tmatches: partialMatches,\n\t\t\t\t\tfetcherKey,\n\t\t\t\t\tpatch: (routeId, children) => {\n\t\t\t\t\t\tif (signal.aborted) return;\n\t\t\t\t\t\tpatchRoutesImpl(routeId, children, dataRoutes, localManifest, mapRouteProperties, false);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} catch (e) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terror: e,\n\t\t\t\t\tpartialMatches\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (signal.aborted) return { type: \"aborted\" };\n\t\t\tlet activeBranches = dataRoutes.branches;\n\t\t\tlet newMatches = matchRoutesImpl(dataRoutes.activeRoutes, pathname, basename, false, activeBranches);\n\t\t\tlet newPartialMatches = null;\n\t\t\tif (newMatches) if (Object.keys(newMatches[0].params).length === 0) return {\n\t\t\t\ttype: \"success\",\n\t\t\t\tmatches: newMatches\n\t\t\t};\n\t\t\telse {\n\t\t\t\tnewPartialMatches = matchRoutesImpl(dataRoutes.activeRoutes, pathname, basename, true, activeBranches);\n\t\t\t\tif (!(newPartialMatches && partialMatches.length < newPartialMatches.length && compareMatches(partialMatches, newPartialMatches.slice(0, partialMatches.length)))) return {\n\t\t\t\t\ttype: \"success\",\n\t\t\t\t\tmatches: newMatches\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (!newPartialMatches) newPartialMatches = matchRoutesImpl(dataRoutes.activeRoutes, pathname, basename, true, activeBranches);\n\t\t\tif (!newPartialMatches || compareMatches(partialMatches, newPartialMatches)) return {\n\t\t\t\ttype: \"success\",\n\t\t\t\tmatches: null\n\t\t\t};\n\t\t\tpartialMatches = newPartialMatches;\n\t\t}\n\t}\n\tfunction compareMatches(a, b) {\n\t\treturn a.length === b.length && a.every((m, i) => m.route.id === b[i].route.id);\n\t}\n\tfunction _internalSetRoutes(newRoutes) {\n\t\tmanifest = {};\n\t\tdataRoutes.setHmrRoutes(convertRoutesToDataRoutes(newRoutes, mapRouteProperties, void 0, manifest));\n\t}\n\tfunction patchRoutes(routeId, children, unstable_allowElementMutations = false) {\n\t\tpatchRoutesImpl(routeId, children, dataRoutes, manifest, mapRouteProperties, unstable_allowElementMutations);\n\t\tif (!dataRoutes.hasHMRRoutes) updateState({});\n\t}\n\trouter = {\n\t\tget basename() {\n\t\t\treturn basename;\n\t\t},\n\t\tget future() {\n\t\t\treturn future;\n\t\t},\n\t\tget state() {\n\t\t\treturn state;\n\t\t},\n\t\tget routes() {\n\t\t\treturn dataRoutes.stableRoutes;\n\t\t},\n\t\tget branches() {\n\t\t\treturn dataRoutes.branches;\n\t\t},\n\t\tget manifest() {\n\t\t\treturn manifest;\n\t\t},\n\t\tget window() {\n\t\t\treturn routerWindow;\n\t\t},\n\t\tinitialize,\n\t\tsubscribe,\n\t\tenableScrollRestoration,\n\t\tnavigate,\n\t\tfetch,\n\t\trevalidate,\n\t\tcreateHref: (to) => init.history.createHref(to),\n\t\tencodeLocation: (to) => init.history.encodeLocation(to),\n\t\tgetFetcher,\n\t\tresetFetcher,\n\t\tdeleteFetcher: queueFetcherForDeletion,\n\t\tdispose,\n\t\tgetBlocker,\n\t\tdeleteBlocker,\n\t\tpatchRoutes,\n\t\t_internalFetchControllers: fetchControllers,\n\t\t_internalSetRoutes,\n\t\t_internalSetStateDoNotUseOrYouWillBreakYourApp(newState) {\n\t\t\tupdateState(newState);\n\t\t}\n\t};\n\tif (init.instrumentations) router = instrumentClientSideRouter(router, init.instrumentations.map((i) => i.router).filter(Boolean));\n\treturn router;\n}\n/**\n* Create a static handler to perform server-side data loading\n*\n* @example\n* export async function handleRequest(request: Request) {\n* let { query, dataRoutes } = createStaticHandler(routes);\n* let context = await query(request);\n*\n* if (context instanceof Response) {\n* return context;\n* }\n*\n* let router = createStaticRouter(dataRoutes, context);\n* return new Response(\n* ReactDOMServer.renderToString(<StaticRouterProvider ... />),\n* { headers: { \"Content-Type\": \"text/html\" } }\n* );\n* }\n*\n* @public\n* @category Data Routers\n* @mode data\n* @param routes The {@link RouteObject | route objects} to create a static\n* handler for\n* @param opts Options\n* @param opts.basename The base URL for the static handler (default: `/`)\n* @param opts.future Future flags for the static handler\n* @returns A static handler that can be used to query data for the provided\n* routes\n*/\nfunction createStaticHandler(routes, opts) {\n\tinvariant(routes.length > 0, \"You must provide a non-empty routes array to createStaticHandler\");\n\tlet manifest = {};\n\tlet basename = (opts ? opts.basename : null) || \"/\";\n\tlet _mapRouteProperties = opts?.mapRouteProperties;\n\tlet mapRouteProperties = _mapRouteProperties ? _mapRouteProperties : () => ({});\n\t({ ...opts?.future });\n\tif (opts?.instrumentations) {\n\t\tlet instrumentations = opts.instrumentations;\n\t\tmapRouteProperties = (route) => {\n\t\t\treturn {\n\t\t\t\t..._mapRouteProperties?.(route),\n\t\t\t\t...getRouteInstrumentationUpdates(instrumentations.map((i) => i.route).filter(Boolean), route)\n\t\t\t};\n\t\t};\n\t}\n\tlet dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, void 0, manifest);\n\tlet routeBranches = flattenAndRankRoutes(dataRoutes);\n\t/**\n\t* The query() method is intended for document requests, in which we want to\n\t* call an optional action and potentially multiple loaders for all nested\n\t* routes. It returns a StaticHandlerContext object, which is very similar\n\t* to the router state (location, loaderData, actionData, errors, etc.) and\n\t* also adds SSR-specific information such as the statusCode and headers\n\t* from action/loaders Responses.\n\t*\n\t* It _should_ never throw and should report all errors through the\n\t* returned handlerContext.errors object, properly associating errors to\n\t* their error boundary. Additionally, it tracks _deepestRenderedBoundaryId\n\t* which can be used to emulate React error boundaries during SSR by performing\n\t* a second pass only down to the boundaryId.\n\t*\n\t* The one exception where we do not return a StaticHandlerContext is when a\n\t* redirect response is returned or thrown from any action/loader. We\n\t* propagate that out and return the raw Response so the HTTP server can\n\t* return it directly.\n\t*\n\t* - `opts.requestContext` is an optional server context that will be passed\n\t* to actions/loaders in the `context` parameter\n\t* - `opts.skipLoaderErrorBubbling` is an optional parameter that will prevent\n\t* the bubbling of errors which allows single-fetch-type implementations\n\t* where the client will handle the bubbling and we may need to return data\n\t* for the handling route\n\t*/\n\tasync function query(request, { requestContext, filterMatchesToLoad, skipLoaderErrorBubbling, skipRevalidation, dataStrategy, generateMiddlewareResponse, normalizePath } = {}) {\n\t\tlet normalizePathImpl = normalizePath || defaultNormalizePath;\n\t\tlet method = request.method;\n\t\tlet location = createLocation(\"\", normalizePathImpl(request), null, \"default\");\n\t\tlet matches = matchRoutesImpl(dataRoutes, location, basename, false, routeBranches);\n\t\trequestContext = requestContext != null ? requestContext : new RouterContextProvider();\n\t\tif (!isValidMethod(method) && method !== \"HEAD\") {\n\t\t\tlet error = getInternalRouterError(405, { method });\n\t\t\tlet { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes);\n\t\t\tlet staticContext = {\n\t\t\t\tbasename,\n\t\t\t\tlocation,\n\t\t\t\tmatches: methodNotAllowedMatches,\n\t\t\t\tloaderData: {},\n\t\t\t\tactionData: null,\n\t\t\t\terrors: { [route.id]: error },\n\t\t\t\tstatusCode: error.status,\n\t\t\t\tloaderHeaders: {},\n\t\t\t\tactionHeaders: {}\n\t\t\t};\n\t\t\treturn generateMiddlewareResponse ? generateMiddlewareResponse(() => Promise.resolve(staticContext)) : staticContext;\n\t\t} else if (!matches) {\n\t\t\tlet error = getInternalRouterError(404, { pathname: location.pathname });\n\t\t\tlet { matches: notFoundMatches, route } = getShortCircuitMatches(dataRoutes);\n\t\t\tlet staticContext = {\n\t\t\t\tbasename,\n\t\t\t\tlocation,\n\t\t\t\tmatches: notFoundMatches,\n\t\t\t\tloaderData: {},\n\t\t\t\tactionData: null,\n\t\t\t\terrors: { [route.id]: error },\n\t\t\t\tstatusCode: error.status,\n\t\t\t\tloaderHeaders: {},\n\t\t\t\tactionHeaders: {}\n\t\t\t};\n\t\t\treturn generateMiddlewareResponse ? generateMiddlewareResponse(() => Promise.resolve(staticContext)) : staticContext;\n\t\t}\n\t\tif (generateMiddlewareResponse) {\n\t\t\tinvariant(requestContext instanceof RouterContextProvider, \"When using middleware in `staticHandler.query()`, any provided `requestContext` must be an instance of `RouterContextProvider`\");\n\t\t\ttry {\n\t\t\t\tawait loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties);\n\t\t\t\tlet renderedStaticContext;\n\t\t\t\tlet response = await runServerMiddlewarePipeline({\n\t\t\t\t\trequest,\n\t\t\t\t\turl: createDataFunctionUrl(request, location),\n\t\t\t\t\tpattern: getRoutePattern(matches),\n\t\t\t\t\tmatches,\n\t\t\t\t\tparams: matches[0].params,\n\t\t\t\t\tcontext: requestContext\n\t\t\t\t}, async () => {\n\t\t\t\t\treturn await generateMiddlewareResponse(async (revalidationRequest, opts = {}) => {\n\t\t\t\t\t\tlet result = await queryImpl(revalidationRequest, location, matches, requestContext, dataStrategy || null, skipLoaderErrorBubbling === true, null, \"filterMatchesToLoad\" in opts ? opts.filterMatchesToLoad ?? null : filterMatchesToLoad ?? null, skipRevalidation === true);\n\t\t\t\t\t\tif (isResponse(result)) return result;\n\t\t\t\t\t\trenderedStaticContext = {\n\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\tbasename,\n\t\t\t\t\t\t\t...result\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn renderedStaticContext;\n\t\t\t\t\t});\n\t\t\t\t}, async (error, routeId) => {\n\t\t\t\t\tif (isRedirectResponse(error)) return error;\n\t\t\t\t\tif (isResponse(error)) try {\n\t\t\t\t\t\terror = new ErrorResponseImpl(error.status, error.statusText, await parseResponseBody(error));\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\terror = e;\n\t\t\t\t\t}\n\t\t\t\t\tif (isDataWithResponseInit(error)) error = dataWithResponseInitToErrorResponse(error);\n\t\t\t\t\tif (renderedStaticContext) {\n\t\t\t\t\t\tif (routeId in renderedStaticContext.loaderData) renderedStaticContext.loaderData[routeId] = void 0;\n\t\t\t\t\t\tlet staticContext = getStaticContextFromError(dataRoutes, renderedStaticContext, error, skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id);\n\t\t\t\t\t\treturn generateMiddlewareResponse(() => Promise.resolve(staticContext));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet staticContext = {\n\t\t\t\t\t\t\tmatches,\n\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\tbasename,\n\t\t\t\t\t\t\tloaderData: {},\n\t\t\t\t\t\t\tactionData: null,\n\t\t\t\t\t\t\terrors: { [skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, matches.find((m) => m.route.id === routeId || m.route.loader)?.route.id || routeId).route.id]: error },\n\t\t\t\t\t\t\tstatusCode: isRouteErrorResponse(error) ? error.status : 500,\n\t\t\t\t\t\t\tactionHeaders: {},\n\t\t\t\t\t\t\tloaderHeaders: {}\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn generateMiddlewareResponse(() => Promise.resolve(staticContext));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tinvariant(isResponse(response), \"Expected a response in query()\");\n\t\t\t\treturn response;\n\t\t\t} catch (e) {\n\t\t\t\tif (isResponse(e)) return e;\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\t\tlet result = await queryImpl(request, location, matches, requestContext, dataStrategy || null, skipLoaderErrorBubbling === true, null, filterMatchesToLoad || null, skipRevalidation === true);\n\t\tif (isResponse(result)) return result;\n\t\treturn {\n\t\t\tlocation,\n\t\t\tbasename,\n\t\t\t...result\n\t\t};\n\t}\n\t/**\n\t* The queryRoute() method is intended for targeted route requests, either\n\t* for fetch ?_data requests or resource route requests. In this case, we\n\t* are only ever calling a single action or loader, and we are returning the\n\t* returned value directly. In most cases, this will be a Response returned\n\t* from the action/loader, but it may be a primitive or other value as well -\n\t* and in such cases the calling context should handle that accordingly.\n\t*\n\t* We do respect the throw/return differentiation, so if an action/loader\n\t* throws, then this method will throw the value. This is important so we\n\t* can do proper boundary identification in Remix where a thrown Response\n\t* must go to the Catch Boundary but a returned Response is happy-path.\n\t*\n\t* One thing to note is that any Router-initiated Errors that make sense\n\t* to associate with a status code will be thrown as an ErrorResponse\n\t* instance which include the raw Error, such that the calling context can\n\t* serialize the error as they see fit while including the proper response\n\t* code. Examples here are 404 and 405 errors that occur prior to reaching\n\t* any user-defined loaders.\n\t*\n\t* - `opts.routeId` allows you to specify the specific route handler to call.\n\t* If not provided the handler will determine the proper route by matching\n\t* against `request.url`\n\t* - `opts.requestContext` is an optional server context that will be passed\n\t* to actions/loaders in the `context` parameter\n\t*/\n\tasync function queryRoute(request, { routeId, requestContext, dataStrategy, generateMiddlewareResponse, normalizePath } = {}) {\n\t\tlet normalizePathImpl = normalizePath || defaultNormalizePath;\n\t\tlet method = request.method;\n\t\tlet location = createLocation(\"\", normalizePathImpl(request), null, \"default\");\n\t\tlet matches = matchRoutesImpl(dataRoutes, location, basename, false, routeBranches);\n\t\trequestContext = requestContext != null ? requestContext : new RouterContextProvider();\n\t\tif (!isValidMethod(method) && method !== \"HEAD\" && method !== \"OPTIONS\") throw getInternalRouterError(405, { method });\n\t\telse if (!matches) throw getInternalRouterError(404, { pathname: location.pathname });\n\t\tlet match = routeId ? matches.find((m) => m.route.id === routeId) : getTargetMatch(matches, location);\n\t\tif (routeId && !match) throw getInternalRouterError(403, {\n\t\t\tpathname: location.pathname,\n\t\t\trouteId\n\t\t});\n\t\telse if (!match) throw getInternalRouterError(404, { pathname: location.pathname });\n\t\tif (generateMiddlewareResponse) {\n\t\t\tinvariant(requestContext instanceof RouterContextProvider, \"When using middleware in `staticHandler.queryRoute()`, any provided `requestContext` must be an instance of `RouterContextProvider`\");\n\t\t\tawait loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties);\n\t\t\treturn await runServerMiddlewarePipeline({\n\t\t\t\trequest,\n\t\t\t\turl: createDataFunctionUrl(request, location),\n\t\t\t\tpattern: getRoutePattern(matches),\n\t\t\t\tmatches,\n\t\t\t\tparams: matches[0].params,\n\t\t\t\tcontext: requestContext\n\t\t\t}, async () => {\n\t\t\t\treturn await generateMiddlewareResponse(async (innerRequest) => {\n\t\t\t\t\tlet processed = handleQueryResult(await queryImpl(innerRequest, location, matches, requestContext, dataStrategy || null, false, match, null, false));\n\t\t\t\t\treturn isResponse(processed) ? processed : typeof processed === \"string\" ? new Response(processed) : Response.json(processed);\n\t\t\t\t});\n\t\t\t}, (error) => {\n\t\t\t\tif (isDataWithResponseInit(error)) return Promise.resolve(dataWithResponseInitToResponse(error));\n\t\t\t\tif (isResponse(error)) return Promise.resolve(error);\n\t\t\t\tthrow error;\n\t\t\t});\n\t\t}\n\t\treturn handleQueryResult(await queryImpl(request, location, matches, requestContext, dataStrategy || null, false, match, null, false));\n\t\tfunction handleQueryResult(result) {\n\t\t\tif (isResponse(result)) return result;\n\t\t\tlet error = result.errors ? Object.values(result.errors)[0] : void 0;\n\t\t\tif (error !== void 0) throw error;\n\t\t\tif (result.actionData) return Object.values(result.actionData)[0];\n\t\t\tif (result.loaderData) return Object.values(result.loaderData)[0];\n\t\t}\n\t}\n\tasync function queryImpl(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, skipRevalidation) {\n\t\tinvariant(request.signal, \"query()/queryRoute() requests must contain an AbortController signal\");\n\t\ttry {\n\t\t\tif (isMutationMethod(request.method)) return await submit(request, location, matches, routeMatch || getTargetMatch(matches, location), requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch != null, filterMatchesToLoad, skipRevalidation);\n\t\t\tlet result = await loadRouteData(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad);\n\t\t\treturn isResponse(result) ? result : {\n\t\t\t\t...result,\n\t\t\t\tactionData: null,\n\t\t\t\tactionHeaders: {}\n\t\t\t};\n\t\t} catch (e) {\n\t\t\tif (isDataStrategyResult(e) && isResponse(e.result)) {\n\t\t\t\tif (e.type === \"error\") throw e.result;\n\t\t\t\treturn e.result;\n\t\t\t}\n\t\t\tif (isRedirectResponse(e)) return e;\n\t\t\tthrow e;\n\t\t}\n\t}\n\tasync function submit(request, location, matches, actionMatch, requestContext, dataStrategy, skipLoaderErrorBubbling, isRouteRequest, filterMatchesToLoad, skipRevalidation) {\n\t\tlet result;\n\t\tif (!actionMatch.route.action && !actionMatch.route.lazy) {\n\t\t\tlet error = getInternalRouterError(405, {\n\t\t\t\tmethod: request.method,\n\t\t\t\tpathname: new URL(request.url).pathname,\n\t\t\t\trouteId: actionMatch.route.id\n\t\t\t});\n\t\t\tif (isRouteRequest) throw error;\n\t\t\tresult = {\n\t\t\t\ttype: \"error\",\n\t\t\t\terror\n\t\t\t};\n\t\t} else {\n\t\t\tresult = (await callDataStrategy(request, location, getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, location, matches, actionMatch, [], requestContext), isRouteRequest, requestContext, dataStrategy))[actionMatch.route.id];\n\t\t\tif (request.signal.aborted) throwStaticHandlerAbortedError(request, isRouteRequest);\n\t\t}\n\t\tif (isRedirectResult(result)) throw new Response(null, {\n\t\t\tstatus: result.response.status,\n\t\t\theaders: { Location: result.response.headers.get(\"Location\") }\n\t\t});\n\t\tif (isRouteRequest) {\n\t\t\tif (isErrorResult(result)) throw result.error;\n\t\t\treturn {\n\t\t\t\tmatches: [actionMatch],\n\t\t\t\tloaderData: {},\n\t\t\t\tactionData: { [actionMatch.route.id]: result.data },\n\t\t\t\terrors: null,\n\t\t\t\tstatusCode: 200,\n\t\t\t\tloaderHeaders: {},\n\t\t\t\tactionHeaders: {}\n\t\t\t};\n\t\t}\n\t\tif (skipRevalidation) if (isErrorResult(result)) {\n\t\t\tlet boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id);\n\t\t\treturn {\n\t\t\t\tstatusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500,\n\t\t\t\tactionData: null,\n\t\t\t\tactionHeaders: { ...result.headers ? { [actionMatch.route.id]: result.headers } : {} },\n\t\t\t\tmatches,\n\t\t\t\tloaderData: {},\n\t\t\t\terrors: { [boundaryMatch.route.id]: result.error },\n\t\t\t\tloaderHeaders: {}\n\t\t\t};\n\t\t} else return {\n\t\t\tactionData: { [actionMatch.route.id]: result.data },\n\t\t\tactionHeaders: result.headers ? { [actionMatch.route.id]: result.headers } : {},\n\t\t\tmatches,\n\t\t\tloaderData: {},\n\t\t\terrors: null,\n\t\t\tstatusCode: result.statusCode || 200,\n\t\t\tloaderHeaders: {}\n\t\t};\n\t\tlet loaderRequest = new Request(request.url, {\n\t\t\theaders: request.headers,\n\t\t\tredirect: request.redirect,\n\t\t\tsignal: request.signal\n\t\t});\n\t\tif (isErrorResult(result)) return {\n\t\t\t...await loadRouteData(loaderRequest, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null, filterMatchesToLoad, [(skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id)).route.id, result]),\n\t\t\tstatusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500,\n\t\t\tactionData: null,\n\t\t\tactionHeaders: { ...result.headers ? { [actionMatch.route.id]: result.headers } : {} }\n\t\t};\n\t\treturn {\n\t\t\t...await loadRouteData(loaderRequest, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null, filterMatchesToLoad),\n\t\t\tactionData: { [actionMatch.route.id]: result.data },\n\t\t\t...result.statusCode ? { statusCode: result.statusCode } : {},\n\t\t\tactionHeaders: result.headers ? { [actionMatch.route.id]: result.headers } : {}\n\t\t};\n\t}\n\tasync function loadRouteData(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {\n\t\tlet isRouteRequest = routeMatch != null;\n\t\tif (isRouteRequest && !routeMatch?.route.loader && !routeMatch?.route.lazy) throw getInternalRouterError(400, {\n\t\t\tmethod: request.method,\n\t\t\tpathname: new URL(request.url).pathname,\n\t\t\trouteId: routeMatch?.route.id\n\t\t});\n\t\tlet dsMatches;\n\t\tif (routeMatch) dsMatches = getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, location, matches, routeMatch, [], requestContext);\n\t\telse {\n\t\t\tlet maxIdx = pendingActionResult && isErrorResult(pendingActionResult[1]) ? matches.findIndex((m) => m.route.id === pendingActionResult[0]) - 1 : void 0;\n\t\t\tlet pattern = getRoutePattern(matches);\n\t\t\tdsMatches = matches.map((match, index) => {\n\t\t\t\tif (maxIdx != null && index > maxIdx) return getDataStrategyMatch(mapRouteProperties, manifest, request, location, pattern, match, [], requestContext, false);\n\t\t\t\treturn getDataStrategyMatch(mapRouteProperties, manifest, request, location, pattern, match, [], requestContext, (match.route.loader || match.route.lazy) != null && (!filterMatchesToLoad || filterMatchesToLoad(match)));\n\t\t\t});\n\t\t}\n\t\tif (!dataStrategy && !dsMatches.some((m) => m.shouldLoad)) return {\n\t\t\tmatches,\n\t\t\tloaderData: {},\n\t\t\terrors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? { [pendingActionResult[0]]: pendingActionResult[1].error } : null,\n\t\t\tstatusCode: 200,\n\t\t\tloaderHeaders: {}\n\t\t};\n\t\tlet results = await callDataStrategy(request, location, dsMatches, isRouteRequest, requestContext, dataStrategy);\n\t\tif (request.signal.aborted) throwStaticHandlerAbortedError(request, isRouteRequest);\n\t\treturn {\n\t\t\t...processRouteLoaderData(matches, results, pendingActionResult, true, skipLoaderErrorBubbling),\n\t\t\tmatches\n\t\t};\n\t}\n\tasync function callDataStrategy(request, location, matches, isRouteRequest, requestContext, dataStrategy) {\n\t\tlet results = await callDataStrategyImpl(dataStrategy || defaultDataStrategy, request, location, matches, null, requestContext, true);\n\t\tlet dataResults = {};\n\t\tawait Promise.all(matches.map(async (match) => {\n\t\t\tif (!(match.route.id in results)) return;\n\t\t\tlet result = results[match.route.id];\n\t\t\tif (isRedirectDataStrategyResult(result)) {\n\t\t\t\tlet response = result.result;\n\t\t\t\tthrow normalizeRelativeRoutingRedirectResponse(response, request, match.route.id, matches, basename);\n\t\t\t}\n\t\t\tif (isRouteRequest) {\n\t\t\t\tif (isResponse(result.result)) throw result;\n\t\t\t\telse if (isDataWithResponseInit(result.result)) throw dataWithResponseInitToResponse(result.result);\n\t\t\t}\n\t\t\tdataResults[match.route.id] = await convertDataStrategyResultToDataResult(result);\n\t\t}));\n\t\treturn dataResults;\n\t}\n\treturn {\n\t\tdataRoutes,\n\t\t_internalRouteBranches: routeBranches,\n\t\tquery,\n\t\tqueryRoute\n\t};\n}\n/**\n* Given an existing StaticHandlerContext and an error thrown at render time,\n* provide an updated StaticHandlerContext suitable for a second SSR render\n*\n* @category Utils\n*/\nfunction getStaticContextFromError(routes, handlerContext, error, boundaryId) {\n\tlet errorBoundaryId = boundaryId || handlerContext._deepestRenderedBoundaryId || routes[0].id;\n\treturn {\n\t\t...handlerContext,\n\t\tstatusCode: isRouteErrorResponse(error) ? error.status : 500,\n\t\terrors: { [errorBoundaryId]: error }\n\t};\n}\nfunction throwStaticHandlerAbortedError(request, isRouteRequest) {\n\tif (request.signal.reason !== void 0) throw request.signal.reason;\n\tthrow new Error(`${isRouteRequest ? \"queryRoute\" : \"query\"}() call aborted without an \\`AbortSignal.reason\\`: ${request.method} ${request.url}`);\n}\nfunction isSubmissionNavigation(opts) {\n\treturn opts != null && (\"formData\" in opts && opts.formData != null || \"body\" in opts && opts.body !== void 0);\n}\nfunction defaultNormalizePath(request) {\n\tlet url = new URL(request.url);\n\treturn {\n\t\tpathname: url.pathname,\n\t\tsearch: url.search,\n\t\thash: url.hash\n\t};\n}\nfunction normalizeTo(location, matches, basename, to, fromRouteId, relative) {\n\tlet contextualMatches;\n\tlet activeRouteMatch;\n\tif (fromRouteId) {\n\t\tcontextualMatches = [];\n\t\tfor (let match of matches) {\n\t\t\tcontextualMatches.push(match);\n\t\t\tif (match.route.id === fromRouteId) {\n\t\t\t\tactiveRouteMatch = match;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tcontextualMatches = matches;\n\t\tactiveRouteMatch = matches[matches.length - 1];\n\t}\n\tlet path = resolveTo(to ? to : \".\", getResolveToMatches(contextualMatches), stripBasename(location.pathname, basename) || location.pathname, relative === \"path\");\n\tif (to == null) {\n\t\tpath.search = location.search;\n\t\tpath.hash = location.hash;\n\t}\n\tif ((to == null || to === \"\" || to === \".\") && activeRouteMatch) {\n\t\tlet nakedIndex = hasNakedIndexQuery(path.search);\n\t\tif (activeRouteMatch.route.index && !nakedIndex) path.search = path.search ? path.search.replace(/^\\?/, \"?index&\") : \"?index\";\n\t\telse if (!activeRouteMatch.route.index && nakedIndex) {\n\t\t\tlet params = new URLSearchParams(path.search);\n\t\t\tlet indexValues = params.getAll(\"index\");\n\t\t\tparams.delete(\"index\");\n\t\t\tindexValues.filter((v) => v).forEach((v) => params.append(\"index\", v));\n\t\t\tlet qs = params.toString();\n\t\t\tpath.search = qs ? `?${qs}` : \"\";\n\t\t}\n\t}\n\tif (basename !== \"/\") path.pathname = prependBasename({\n\t\tbasename,\n\t\tpathname: path.pathname\n\t});\n\treturn createPath(path);\n}\nfunction normalizeNavigateOptions(isFetcher, path, opts) {\n\tif (!opts || !isSubmissionNavigation(opts)) return { path };\n\tif (opts.formMethod && !isValidMethod(opts.formMethod)) return {\n\t\tpath,\n\t\terror: getInternalRouterError(405, { method: opts.formMethod })\n\t};\n\tlet getInvalidBodyError = () => ({\n\t\tpath,\n\t\terror: getInternalRouterError(400, { type: \"invalid-body\" })\n\t});\n\tlet formMethod = (opts.formMethod || \"get\").toUpperCase();\n\tlet formAction = stripHashFromPath(path);\n\tif (opts.body !== void 0) {\n\t\tif (opts.formEncType === \"text/plain\") {\n\t\t\tif (!isMutationMethod(formMethod)) return getInvalidBodyError();\n\t\t\tlet 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}\\n`, \"\") : String(opts.body);\n\t\t\treturn {\n\t\t\t\tpath,\n\t\t\t\tsubmission: {\n\t\t\t\t\tformMethod,\n\t\t\t\t\tformAction,\n\t\t\t\t\tformEncType: opts.formEncType,\n\t\t\t\t\tformData: void 0,\n\t\t\t\t\tjson: void 0,\n\t\t\t\t\ttext\n\t\t\t\t}\n\t\t\t};\n\t\t} else if (opts.formEncType === \"application/json\") {\n\t\t\tif (!isMutationMethod(formMethod)) return getInvalidBodyError();\n\t\t\ttry {\n\t\t\t\tlet json = typeof opts.body === \"string\" ? JSON.parse(opts.body) : opts.body;\n\t\t\t\treturn {\n\t\t\t\t\tpath,\n\t\t\t\t\tsubmission: {\n\t\t\t\t\t\tformMethod,\n\t\t\t\t\t\tformAction,\n\t\t\t\t\t\tformEncType: opts.formEncType,\n\t\t\t\t\t\tformData: void 0,\n\t\t\t\t\t\tjson,\n\t\t\t\t\t\ttext: void 0\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t} catch (e) {\n\t\t\t\treturn getInvalidBodyError();\n\t\t\t}\n\t\t}\n\t}\n\tinvariant(typeof FormData === \"function\", \"FormData is not available in this environment\");\n\tlet searchParams;\n\tlet formData;\n\tif (opts.formData) {\n\t\tsearchParams = convertFormDataToSearchParams(opts.formData);\n\t\tformData = opts.formData;\n\t} else if (opts.body instanceof FormData) {\n\t\tsearchParams = convertFormDataToSearchParams(opts.body);\n\t\tformData = opts.body;\n\t} else if (opts.body instanceof URLSearchParams) {\n\t\tsearchParams = opts.body;\n\t\tformData = convertSearchParamsToFormData(searchParams);\n\t} else if (opts.body == null) {\n\t\tsearchParams = new URLSearchParams();\n\t\tformData = new FormData();\n\t} else try {\n\t\tsearchParams = new URLSearchParams(opts.body);\n\t\tformData = convertSearchParamsToFormData(searchParams);\n\t} catch (e) {\n\t\treturn getInvalidBodyError();\n\t}\n\tlet submission = {\n\t\tformMethod,\n\t\tformAction,\n\t\tformEncType: opts && opts.formEncType || \"application/x-www-form-urlencoded\",\n\t\tformData,\n\t\tjson: void 0,\n\t\ttext: void 0\n\t};\n\tif (isMutationMethod(submission.formMethod)) return {\n\t\tpath,\n\t\tsubmission\n\t};\n\tlet parsedPath = parsePath(path);\n\tif (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) searchParams.append(\"index\", \"\");\n\tparsedPath.search = `?${searchParams}`;\n\treturn {\n\t\tpath: createPath(parsedPath),\n\t\tsubmission\n\t};\n}\nfunction getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest, history, state, matches, submission, location, lazyRoutePropertiesToSkip, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, hasPatchRoutesOnNavigation, branches, pendingActionResult, callSiteDefaultShouldRevalidate) {\n\tlet actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : void 0;\n\tlet currentUrl = history.createURL(state.location);\n\tlet nextUrl = history.createURL(location);\n\tlet maxIdx;\n\tif (initialHydration && state.errors) {\n\t\tlet boundaryId = Object.keys(state.errors)[0];\n\t\tmaxIdx = matches.findIndex((m) => m.route.id === boundaryId);\n\t} else if (pendingActionResult && isErrorResult(pendingActionResult[1])) {\n\t\tlet boundaryId = pendingActionResult[0];\n\t\tmaxIdx = matches.findIndex((m) => m.route.id === boundaryId) - 1;\n\t}\n\tlet actionStatus = pendingActionResult ? pendingActionResult[1].statusCode : void 0;\n\tlet shouldSkipRevalidation = actionStatus && actionStatus >= 400;\n\tlet baseShouldRevalidateArgs = {\n\t\tcurrentUrl,\n\t\tcurrentParams: state.matches[0]?.params || {},\n\t\tnextUrl,\n\t\tnextParams: matches[0].params,\n\t\t...submission,\n\t\tactionResult,\n\t\tactionStatus\n\t};\n\tlet pattern = getRoutePattern(matches);\n\tlet dsMatches = matches.map((match, index) => {\n\t\tlet { route } = match;\n\t\tlet forceShouldLoad = null;\n\t\tif (maxIdx != null && index > maxIdx) forceShouldLoad = false;\n\t\telse if (route.lazy) forceShouldLoad = true;\n\t\telse if (!routeHasLoaderOrMiddleware(route)) forceShouldLoad = false;\n\t\telse if (initialHydration) {\n\t\t\tlet { shouldLoad } = getRouteHydrationStatus(route, state.loaderData, state.errors);\n\t\t\tforceShouldLoad = shouldLoad;\n\t\t} else if (isNewLoader(state.loaderData, state.matches[index], match)) forceShouldLoad = true;\n\t\tif (forceShouldLoad !== null) return getDataStrategyMatch(mapRouteProperties, manifest, request, location, pattern, match, lazyRoutePropertiesToSkip, scopedContext, forceShouldLoad);\n\t\tlet defaultShouldRevalidate = false;\n\t\tif (typeof callSiteDefaultShouldRevalidate === \"boolean\") defaultShouldRevalidate = callSiteDefaultShouldRevalidate;\n\t\telse if (shouldSkipRevalidation) defaultShouldRevalidate = false;\n\t\telse if (isRevalidationRequired) defaultShouldRevalidate = true;\n\t\telse if (currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search) defaultShouldRevalidate = true;\n\t\telse if (currentUrl.search !== nextUrl.search) defaultShouldRevalidate = true;\n\t\telse if (isNewRouteInstance(state.matches[index], match)) defaultShouldRevalidate = true;\n\t\tlet shouldRevalidateArgs = {\n\t\t\t...baseShouldRevalidateArgs,\n\t\t\tdefaultShouldRevalidate\n\t\t};\n\t\treturn getDataStrategyMatch(mapRouteProperties, manifest, request, location, pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateLoader(match, shouldRevalidateArgs), shouldRevalidateArgs, callSiteDefaultShouldRevalidate);\n\t});\n\tlet revalidatingFetchers = [];\n\tfetchLoadMatches.forEach((f, key) => {\n\t\tif (initialHydration || !matches.some((m) => m.route.id === f.routeId) || fetchersQueuedForDeletion.has(key)) return;\n\t\tlet fetcher = state.fetchers.get(key);\n\t\tlet isMidInitialLoad = fetcher && fetcher.state !== \"idle\" && fetcher.data === void 0;\n\t\tlet fetcherMatches = matchRoutesImpl(routesToUse, f.path, basename ?? \"/\", false, branches);\n\t\tif (!fetcherMatches) {\n\t\t\tif (hasPatchRoutesOnNavigation && isMidInitialLoad) return;\n\t\t\trevalidatingFetchers.push({\n\t\t\t\tkey,\n\t\t\t\trouteId: f.routeId,\n\t\t\t\tpath: f.path,\n\t\t\t\tmatches: null,\n\t\t\t\tmatch: null,\n\t\t\t\trequest: null,\n\t\t\t\tcontroller: null\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (fetchRedirectIds.has(key)) return;\n\t\tlet fetcherMatch = getTargetMatch(fetcherMatches, f.path);\n\t\tlet fetchController = new AbortController();\n\t\tlet fetchRequest = createClientSideRequest(history, f.path, fetchController.signal);\n\t\tlet fetcherDsMatches = null;\n\t\tif (cancelledFetcherLoads.has(key)) {\n\t\t\tcancelledFetcherLoads.delete(key);\n\t\t\tfetcherDsMatches = getTargetedDataStrategyMatches(mapRouteProperties, manifest, fetchRequest, f.path, fetcherMatches, fetcherMatch, lazyRoutePropertiesToSkip, scopedContext);\n\t\t} else if (isMidInitialLoad) {\n\t\t\tif (isRevalidationRequired) fetcherDsMatches = getTargetedDataStrategyMatches(mapRouteProperties, manifest, fetchRequest, f.path, fetcherMatches, fetcherMatch, lazyRoutePropertiesToSkip, scopedContext);\n\t\t} else {\n\t\t\tlet defaultShouldRevalidate;\n\t\t\tif (typeof callSiteDefaultShouldRevalidate === \"boolean\") defaultShouldRevalidate = callSiteDefaultShouldRevalidate;\n\t\t\telse if (shouldSkipRevalidation) defaultShouldRevalidate = false;\n\t\t\telse defaultShouldRevalidate = isRevalidationRequired;\n\t\t\tlet shouldRevalidateArgs = {\n\t\t\t\t...baseShouldRevalidateArgs,\n\t\t\t\tdefaultShouldRevalidate\n\t\t\t};\n\t\t\tif (shouldRevalidateLoader(fetcherMatch, shouldRevalidateArgs)) fetcherDsMatches = getTargetedDataStrategyMatches(mapRouteProperties, manifest, fetchRequest, f.path, fetcherMatches, fetcherMatch, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateArgs);\n\t\t}\n\t\tif (fetcherDsMatches) revalidatingFetchers.push({\n\t\t\tkey,\n\t\t\trouteId: f.routeId,\n\t\t\tpath: f.path,\n\t\t\tmatches: fetcherDsMatches,\n\t\t\tmatch: fetcherMatch,\n\t\t\trequest: fetchRequest,\n\t\t\tcontroller: fetchController\n\t\t});\n\t});\n\treturn {\n\t\tdsMatches,\n\t\trevalidatingFetchers\n\t};\n}\nfunction routeHasLoaderOrMiddleware(route) {\n\treturn route.loader != null || route.middleware != null && route.middleware.length > 0;\n}\nfunction getRouteHydrationStatus(route, loaderData, errors) {\n\tif (route.lazy) return {\n\t\tshouldLoad: true,\n\t\trenderFallback: true\n\t};\n\tif (!routeHasLoaderOrMiddleware(route)) return {\n\t\tshouldLoad: false,\n\t\trenderFallback: false\n\t};\n\tlet hasData = loaderData != null && route.id in loaderData;\n\tlet hasError = errors != null && errors[route.id] !== void 0;\n\tif (!hasData && hasError) return {\n\t\tshouldLoad: false,\n\t\trenderFallback: false\n\t};\n\tif (typeof route.loader === \"function\" && route.loader.hydrate === true) return {\n\t\tshouldLoad: true,\n\t\trenderFallback: !hasData\n\t};\n\tlet shouldLoad = !hasData && !hasError;\n\treturn {\n\t\tshouldLoad,\n\t\trenderFallback: shouldLoad\n\t};\n}\nfunction isNewLoader(currentLoaderData, currentMatch, match) {\n\tlet isNew = !currentMatch || match.route.id !== currentMatch.route.id;\n\tlet isMissingData = !currentLoaderData.hasOwnProperty(match.route.id);\n\treturn isNew || isMissingData;\n}\nfunction isNewRouteInstance(currentMatch, match) {\n\tlet currentPath = currentMatch.route.path;\n\treturn currentMatch.pathname !== match.pathname || currentPath != null && currentPath.endsWith(\"*\") && currentMatch.params[\"*\"] !== match.params[\"*\"];\n}\nfunction shouldRevalidateLoader(loaderMatch, arg) {\n\tif (loaderMatch.route.shouldRevalidate) {\n\t\tlet routeChoice = loaderMatch.route.shouldRevalidate(arg);\n\t\tif (typeof routeChoice === \"boolean\") return routeChoice;\n\t}\n\treturn arg.defaultShouldRevalidate;\n}\nfunction patchRoutesImpl(routeId, children, dataRoutes, manifest, mapRouteProperties, allowElementMutations) {\n\tlet childrenToPatch;\n\tif (routeId) {\n\t\tlet route = manifest[routeId];\n\t\tinvariant(route, `No route found to patch children into: routeId = ${routeId}`);\n\t\tif (!route.children) route.children = [];\n\t\tchildrenToPatch = route.children;\n\t} else childrenToPatch = dataRoutes.activeRoutes;\n\tlet uniqueChildren = [];\n\tlet existingChildren = [];\n\tchildren.forEach((newRoute) => {\n\t\tlet existingRoute = childrenToPatch.find((existingRoute) => isSameRoute(newRoute, existingRoute));\n\t\tif (existingRoute) existingChildren.push({\n\t\t\texistingRoute,\n\t\t\tnewRoute\n\t\t});\n\t\telse uniqueChildren.push(newRoute);\n\t});\n\tif (uniqueChildren.length > 0) {\n\t\tlet newRoutes = convertRoutesToDataRoutes(uniqueChildren, mapRouteProperties, [\n\t\t\trouteId || \"_\",\n\t\t\t\"patch\",\n\t\t\tString(childrenToPatch?.length || \"0\")\n\t\t], manifest);\n\t\tchildrenToPatch.push(...newRoutes);\n\t}\n\tif (allowElementMutations && existingChildren.length > 0) for (let i = 0; i < existingChildren.length; i++) {\n\t\tlet { existingRoute, newRoute } = existingChildren[i];\n\t\tlet existingRouteTyped = existingRoute;\n\t\tlet [newRouteTyped] = convertRoutesToDataRoutes([newRoute], mapRouteProperties, [], {}, true);\n\t\tObject.assign(existingRouteTyped, {\n\t\t\telement: newRouteTyped.element ? newRouteTyped.element : existingRouteTyped.element,\n\t\t\terrorElement: newRouteTyped.errorElement ? newRouteTyped.errorElement : existingRouteTyped.errorElement,\n\t\t\thydrateFallbackElement: newRouteTyped.hydrateFallbackElement ? newRouteTyped.hydrateFallbackElement : existingRouteTyped.hydrateFallbackElement\n\t\t});\n\t}\n\tif (!dataRoutes.hasHMRRoutes) dataRoutes.setRoutes([...dataRoutes.activeRoutes]);\n}\nfunction isSameRoute(newRoute, existingRoute) {\n\tif (\"id\" in newRoute && \"id\" in existingRoute && newRoute.id === existingRoute.id) return true;\n\tif (!(newRoute.index === existingRoute.index && newRoute.path === existingRoute.path && newRoute.caseSensitive === existingRoute.caseSensitive)) return false;\n\tif ((!newRoute.children || newRoute.children.length === 0) && (!existingRoute.children || existingRoute.children.length === 0)) return true;\n\treturn newRoute.children?.every((aChild, i) => existingRoute.children?.some((bChild) => isSameRoute(aChild, bChild))) ?? false;\n}\nconst lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();\nconst loadLazyRouteProperty = ({ key, route, manifest, mapRouteProperties }) => {\n\tlet routeToUpdate = manifest[route.id];\n\tinvariant(routeToUpdate, \"No route found in manifest\");\n\tif (!routeToUpdate.lazy || typeof routeToUpdate.lazy !== \"object\") return;\n\tlet lazyFn = routeToUpdate.lazy[key];\n\tif (!lazyFn) return;\n\tlet cache = lazyRoutePropertyCache.get(routeToUpdate);\n\tif (!cache) {\n\t\tcache = {};\n\t\tlazyRoutePropertyCache.set(routeToUpdate, cache);\n\t}\n\tlet cachedPromise = cache[key];\n\tif (cachedPromise) return cachedPromise;\n\tlet propertyPromise = (async () => {\n\t\tlet isUnsupported = isUnsupportedLazyRouteObjectKey(key);\n\t\tlet isStaticallyDefined = routeToUpdate[key] !== void 0;\n\t\tif (isUnsupported) {\n\t\t\twarning(!isUnsupported, \"Route property \" + key + \" is not a supported lazy route property. This property will be ignored.\");\n\t\t\tcache[key] = Promise.resolve();\n\t\t} else if (isStaticallyDefined) warning(false, `Route \"${routeToUpdate.id}\" has a static property \"${key}\" defined. The lazy property will be ignored.`);\n\t\telse {\n\t\t\tlet value = await lazyFn();\n\t\t\tif (value != null) {\n\t\t\t\tObject.assign(routeToUpdate, { [key]: value });\n\t\t\t\tObject.assign(routeToUpdate, mapRouteProperties(routeToUpdate));\n\t\t\t}\n\t\t}\n\t\tif (typeof routeToUpdate.lazy === \"object\") {\n\t\t\trouteToUpdate.lazy[key] = void 0;\n\t\t\tif (Object.values(routeToUpdate.lazy).every((value) => value === void 0)) routeToUpdate.lazy = void 0;\n\t\t}\n\t})();\n\tcache[key] = propertyPromise;\n\treturn propertyPromise;\n};\nconst lazyRouteFunctionCache = /* @__PURE__ */ new WeakMap();\n/**\n* Execute route.lazy functions to lazily load route modules (loader, action,\n* shouldRevalidate) and update the routeManifest in place which shares objects\n* with dataRoutes so those get updated as well.\n*/\nfunction loadLazyRoute(route, type, manifest, mapRouteProperties, lazyRoutePropertiesToSkip) {\n\tlet routeToUpdate = manifest[route.id];\n\tinvariant(routeToUpdate, \"No route found in manifest\");\n\tif (!route.lazy) return {\n\t\tlazyRoutePromise: void 0,\n\t\tlazyHandlerPromise: void 0\n\t};\n\tif (typeof route.lazy === \"function\") {\n\t\tlet cachedPromise = lazyRouteFunctionCache.get(routeToUpdate);\n\t\tif (cachedPromise) return {\n\t\t\tlazyRoutePromise: cachedPromise,\n\t\t\tlazyHandlerPromise: cachedPromise\n\t\t};\n\t\tlet lazyRoutePromise = (async () => {\n\t\t\tinvariant(typeof route.lazy === \"function\", \"No lazy route function found\");\n\t\t\tlet lazyRoute = await route.lazy();\n\t\t\tlet routeUpdates = {};\n\t\t\tfor (let lazyRouteProperty in lazyRoute) {\n\t\t\t\tlet lazyValue = lazyRoute[lazyRouteProperty];\n\t\t\t\tif (lazyValue === void 0) continue;\n\t\t\t\tlet isUnsupported = isUnsupportedLazyRouteFunctionKey(lazyRouteProperty);\n\t\t\t\tlet isStaticallyDefined = routeToUpdate[lazyRouteProperty] !== void 0;\n\t\t\t\tif (isUnsupported) warning(!isUnsupported, \"Route property \" + lazyRouteProperty + \" is not a supported property to be returned from a lazy route function. This property will be ignored.\");\n\t\t\t\telse 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.`);\n\t\t\t\telse routeUpdates[lazyRouteProperty] = lazyValue;\n\t\t\t}\n\t\t\tObject.assign(routeToUpdate, routeUpdates);\n\t\t\tObject.assign(routeToUpdate, {\n\t\t\t\t...mapRouteProperties(routeToUpdate),\n\t\t\t\tlazy: void 0\n\t\t\t});\n\t\t})();\n\t\tlazyRouteFunctionCache.set(routeToUpdate, lazyRoutePromise);\n\t\tlazyRoutePromise.catch(() => {});\n\t\treturn {\n\t\t\tlazyRoutePromise,\n\t\t\tlazyHandlerPromise: lazyRoutePromise\n\t\t};\n\t}\n\tlet lazyKeys = Object.keys(route.lazy);\n\tlet lazyPropertyPromises = [];\n\tlet lazyHandlerPromise = void 0;\n\tfor (let key of lazyKeys) {\n\t\tif (lazyRoutePropertiesToSkip && lazyRoutePropertiesToSkip.includes(key)) continue;\n\t\tlet promise = loadLazyRouteProperty({\n\t\t\tkey,\n\t\t\troute,\n\t\t\tmanifest,\n\t\t\tmapRouteProperties\n\t\t});\n\t\tif (promise) {\n\t\t\tlazyPropertyPromises.push(promise);\n\t\t\tif (key === type) lazyHandlerPromise = promise;\n\t\t}\n\t}\n\tlet lazyRoutePromise = lazyPropertyPromises.length > 0 ? Promise.all(lazyPropertyPromises).then(() => {}) : void 0;\n\tlazyRoutePromise?.catch(() => {});\n\tlazyHandlerPromise?.catch(() => {});\n\treturn {\n\t\tlazyRoutePromise,\n\t\tlazyHandlerPromise\n\t};\n}\nfunction isNonNullable(value) {\n\treturn value !== void 0;\n}\nfunction loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties) {\n\tlet promises = matches.map(({ route }) => {\n\t\tif (typeof route.lazy !== \"object\" || !route.lazy.middleware) return;\n\t\treturn loadLazyRouteProperty({\n\t\t\tkey: \"middleware\",\n\t\t\troute,\n\t\t\tmanifest,\n\t\t\tmapRouteProperties\n\t\t});\n\t}).filter(isNonNullable);\n\treturn promises.length > 0 ? Promise.all(promises) : void 0;\n}\nasync function defaultDataStrategy(args) {\n\tlet matchesToLoad = args.matches.filter((m) => m.shouldLoad);\n\tlet keyedResults = {};\n\t(await Promise.all(matchesToLoad.map((m) => m.resolve()))).forEach((result, i) => {\n\t\tkeyedResults[matchesToLoad[i].route.id] = result;\n\t});\n\treturn keyedResults;\n}\nasync function defaultDataStrategyWithMiddleware(args) {\n\tif (!args.matches.some((m) => m.route.middleware)) return defaultDataStrategy(args);\n\treturn runClientMiddlewarePipeline(args, () => defaultDataStrategy(args));\n}\nfunction runServerMiddlewarePipeline(args, handler, errorHandler) {\n\treturn runMiddlewarePipeline(args, handler, processResult, isResponse, errorHandler);\n\tfunction processResult(result) {\n\t\treturn isDataWithResponseInit(result) ? dataWithResponseInitToResponse(result) : result;\n\t}\n}\nfunction runClientMiddlewarePipeline(args, handler) {\n\treturn runMiddlewarePipeline(args, handler, (r) => {\n\t\tif (isRedirectResponse(r)) throw r;\n\t\treturn r;\n\t}, isDataStrategyResults, errorHandler);\n\tasync function errorHandler(error, routeId, nextResult) {\n\t\tif (nextResult) return Object.assign(nextResult.value, { [routeId]: {\n\t\t\ttype: \"error\",\n\t\t\tresult: error\n\t\t} });\n\t\telse {\n\t\t\tlet { matches } = args;\n\t\t\tlet maxBoundaryIdx = Math.min(Math.max(matches.findIndex((m) => m.route.id === routeId), 0), Math.max(matches.findIndex((m) => m.shouldCallHandler()), 0));\n\t\t\tlet deepestRouteId = matches[maxBoundaryIdx].route.id;\n\t\t\tfor (let match of matches.slice(0, maxBoundaryIdx + 1)) try {\n\t\t\t\tawait match._lazyPromises?.route;\n\t\t\t} catch {\n\t\t\t\tdeepestRouteId = match.route.id;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn { [findNearestBoundary(matches, deepestRouteId).route.id]: {\n\t\t\t\ttype: \"error\",\n\t\t\t\tresult: error\n\t\t\t} };\n\t\t}\n\t}\n}\nasync function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {\n\tlet { matches, ...dataFnArgs } = args;\n\treturn await callRouteMiddleware(dataFnArgs, matches.flatMap((m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []), handler, processResult, isResult, errorHandler);\n}\nasync function callRouteMiddleware(args, middlewares, handler, processResult, isResult, errorHandler, idx = 0) {\n\tlet { request } = args;\n\tif (request.signal.aborted) throw request.signal.reason ?? /* @__PURE__ */ new Error(`Request aborted: ${request.method} ${request.url}`);\n\tlet tuple = middlewares[idx];\n\tif (!tuple) return await handler();\n\tlet [routeId, middleware] = tuple;\n\tlet nextResult;\n\tlet next = async () => {\n\t\tif (nextResult) throw new Error(\"You may only call `next()` once per middleware\");\n\t\ttry {\n\t\t\tnextResult = { value: await callRouteMiddleware(args, middlewares, handler, processResult, isResult, errorHandler, idx + 1) };\n\t\t\treturn nextResult.value;\n\t\t} catch (error) {\n\t\t\tnextResult = { value: await errorHandler(error, routeId, nextResult) };\n\t\t\treturn nextResult.value;\n\t\t}\n\t};\n\ttry {\n\t\tlet value = await middleware(args, next);\n\t\tlet result = value != null ? processResult(value) : void 0;\n\t\tif (isResult(result)) return result;\n\t\telse if (nextResult) return result ?? nextResult.value;\n\t\telse {\n\t\t\tnextResult = { value: await next() };\n\t\t\treturn nextResult.value;\n\t\t}\n\t} catch (error) {\n\t\treturn await errorHandler(error, routeId, nextResult);\n\t}\n}\nfunction getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip) {\n\tlet lazyMiddlewarePromise = loadLazyRouteProperty({\n\t\tkey: \"middleware\",\n\t\troute: match.route,\n\t\tmanifest,\n\t\tmapRouteProperties\n\t});\n\tlet lazyRoutePromises = loadLazyRoute(match.route, isMutationMethod(request.method) ? \"action\" : \"loader\", manifest, mapRouteProperties, lazyRoutePropertiesToSkip);\n\treturn {\n\t\tmiddleware: lazyMiddlewarePromise,\n\t\troute: lazyRoutePromises.lazyRoutePromise,\n\t\thandler: lazyRoutePromises.lazyHandlerPromise\n\t};\n}\nfunction getDataStrategyMatch(mapRouteProperties, manifest, request, path, pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {\n\tlet isUsingNewApi = false;\n\tlet _lazyPromises = getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip);\n\treturn {\n\t\t...match,\n\t\t_lazyPromises,\n\t\tshouldLoad,\n\t\tshouldRevalidateArgs,\n\t\tshouldCallHandler(defaultShouldRevalidate) {\n\t\t\tisUsingNewApi = true;\n\t\t\tif (!shouldRevalidateArgs) return shouldLoad;\n\t\t\tif (typeof callSiteDefaultShouldRevalidate === \"boolean\") return shouldRevalidateLoader(match, {\n\t\t\t\t...shouldRevalidateArgs,\n\t\t\t\tdefaultShouldRevalidate: callSiteDefaultShouldRevalidate\n\t\t\t});\n\t\t\tif (typeof defaultShouldRevalidate === \"boolean\") return shouldRevalidateLoader(match, {\n\t\t\t\t...shouldRevalidateArgs,\n\t\t\t\tdefaultShouldRevalidate\n\t\t\t});\n\t\t\treturn shouldRevalidateLoader(match, shouldRevalidateArgs);\n\t\t},\n\t\tresolve(handlerOverride) {\n\t\t\tlet { lazy, loader, middleware } = match.route;\n\t\t\tlet callHandler = isUsingNewApi || shouldLoad || handlerOverride && !isMutationMethod(request.method) && (lazy || loader);\n\t\t\tlet isMiddlewareOnlyRoute = middleware && middleware.length > 0 && !loader && !lazy;\n\t\t\tif (callHandler && (isMutationMethod(request.method) || !isMiddlewareOnlyRoute)) return callLoaderOrAction({\n\t\t\t\trequest,\n\t\t\t\tpath,\n\t\t\t\tpattern,\n\t\t\t\tmatch,\n\t\t\t\tlazyHandlerPromise: _lazyPromises?.handler,\n\t\t\t\tlazyRoutePromise: _lazyPromises?.route,\n\t\t\t\thandlerOverride,\n\t\t\t\tscopedContext\n\t\t\t});\n\t\t\treturn Promise.resolve({\n\t\t\t\ttype: \"data\",\n\t\t\t\tresult: void 0\n\t\t\t});\n\t\t}\n\t};\n}\nfunction getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, path, matches, targetMatch, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateArgs = null) {\n\treturn matches.map((match) => {\n\t\tif (match.route.id !== targetMatch.route.id) return {\n\t\t\t...match,\n\t\t\tshouldLoad: false,\n\t\t\tshouldRevalidateArgs,\n\t\t\tshouldCallHandler: () => false,\n\t\t\t_lazyPromises: getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip),\n\t\t\tresolve: () => Promise.resolve({\n\t\t\t\ttype: \"data\",\n\t\t\t\tresult: void 0\n\t\t\t})\n\t\t};\n\t\treturn getDataStrategyMatch(mapRouteProperties, manifest, request, path, getRoutePattern(matches), match, lazyRoutePropertiesToSkip, scopedContext, true, shouldRevalidateArgs);\n\t});\n}\nasync function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fetcherKey, scopedContext, isStaticHandler) {\n\tif (matches.some((m) => m._lazyPromises?.middleware)) await Promise.all(matches.map((m) => m._lazyPromises?.middleware));\n\tlet dataStrategyArgs = {\n\t\trequest,\n\t\turl: createDataFunctionUrl(request, path),\n\t\tpattern: getRoutePattern(matches),\n\t\tparams: matches[0].params,\n\t\tcontext: scopedContext,\n\t\tmatches\n\t};\n\tlet runClientMiddleware = isStaticHandler ? () => {\n\t\tthrow 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`\");\n\t} : (cb) => {\n\t\tlet typedDataStrategyArgs = dataStrategyArgs;\n\t\treturn runClientMiddlewarePipeline(typedDataStrategyArgs, () => {\n\t\t\treturn cb({\n\t\t\t\t...typedDataStrategyArgs,\n\t\t\t\tfetcherKey,\n\t\t\t\trunClientMiddleware: () => {\n\t\t\t\t\tthrow new Error(\"Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler\");\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t};\n\tlet results = await dataStrategyImpl({\n\t\t...dataStrategyArgs,\n\t\tfetcherKey,\n\t\trunClientMiddleware\n\t});\n\ttry {\n\t\tawait Promise.all(matches.flatMap((m) => [m._lazyPromises?.handler, m._lazyPromises?.route]));\n\t} catch (e) {}\n\treturn results;\n}\nasync function callLoaderOrAction({ request, path, pattern, match, lazyHandlerPromise, lazyRoutePromise, handlerOverride, scopedContext }) {\n\tlet result;\n\tlet onReject;\n\tlet isAction = isMutationMethod(request.method);\n\tlet type = isAction ? \"action\" : \"loader\";\n\tlet runHandler = (handler) => {\n\t\tlet reject;\n\t\tlet abortPromise = new Promise((_, r) => reject = r);\n\t\tonReject = () => reject();\n\t\trequest.signal.addEventListener(\"abort\", onReject);\n\t\tlet actualHandler = (ctx) => {\n\t\t\tif (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}]`));\n\t\t\treturn handler({\n\t\t\t\trequest,\n\t\t\t\turl: createDataFunctionUrl(request, path),\n\t\t\t\tpattern,\n\t\t\t\tparams: match.params,\n\t\t\t\tcontext: scopedContext\n\t\t\t}, ...ctx !== void 0 ? [ctx] : []);\n\t\t};\n\t\tlet handlerPromise = (async () => {\n\t\t\ttry {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tresult: await (handlerOverride ? handlerOverride((ctx) => actualHandler(ctx)) : actualHandler())\n\t\t\t\t};\n\t\t\t} catch (e) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\tresult: e\n\t\t\t\t};\n\t\t\t}\n\t\t})();\n\t\treturn Promise.race([handlerPromise, abortPromise]);\n\t};\n\ttry {\n\t\tlet handler = isAction ? match.route.action : match.route.loader;\n\t\tif (lazyHandlerPromise || lazyRoutePromise) if (handler) {\n\t\t\tlet handlerError;\n\t\t\tlet [value] = await Promise.all([\n\t\t\t\trunHandler(handler).catch((e) => {\n\t\t\t\t\thandlerError = e;\n\t\t\t\t}),\n\t\t\t\tlazyHandlerPromise,\n\t\t\t\tlazyRoutePromise\n\t\t\t]);\n\t\t\tif (handlerError !== void 0) throw handlerError;\n\t\t\tresult = value;\n\t\t} else {\n\t\t\tawait lazyHandlerPromise;\n\t\t\tlet handler = isAction ? match.route.action : match.route.loader;\n\t\t\tif (handler) [result] = await Promise.all([runHandler(handler), lazyRoutePromise]);\n\t\t\telse if (type === \"action\") {\n\t\t\t\tlet url = new URL(request.url);\n\t\t\t\tlet pathname = url.pathname + url.search;\n\t\t\t\tthrow getInternalRouterError(405, {\n\t\t\t\t\tmethod: request.method,\n\t\t\t\t\tpathname,\n\t\t\t\t\trouteId: match.route.id\n\t\t\t\t});\n\t\t\t} else return {\n\t\t\t\ttype: \"data\",\n\t\t\t\tresult: void 0\n\t\t\t};\n\t\t}\n\t\telse if (!handler) {\n\t\t\tlet url = new URL(request.url);\n\t\t\tthrow getInternalRouterError(404, { pathname: url.pathname + url.search });\n\t\t} else result = await runHandler(handler);\n\t} catch (e) {\n\t\treturn {\n\t\t\ttype: \"error\",\n\t\t\tresult: e\n\t\t};\n\t} finally {\n\t\tif (onReject) request.signal.removeEventListener(\"abort\", onReject);\n\t}\n\treturn result;\n}\nasync function parseResponseBody(response) {\n\tlet contentType = response.headers.get(\"Content-Type\");\n\tif (contentType && /\\bapplication\\/json\\b/.test(contentType)) return response.body == null ? null : response.json();\n\treturn response.text();\n}\nasync function convertDataStrategyResultToDataResult(dataStrategyResult) {\n\tlet { result, type } = dataStrategyResult;\n\tif (isResponse(result)) {\n\t\tlet data;\n\t\ttry {\n\t\t\tdata = await parseResponseBody(result);\n\t\t} catch (e) {\n\t\t\treturn {\n\t\t\t\ttype: \"error\",\n\t\t\t\terror: e\n\t\t\t};\n\t\t}\n\t\tif (type === \"error\") return {\n\t\t\ttype: \"error\",\n\t\t\terror: new ErrorResponseImpl(result.status, result.statusText, data),\n\t\t\tstatusCode: result.status,\n\t\t\theaders: result.headers\n\t\t};\n\t\treturn {\n\t\t\ttype: \"data\",\n\t\t\tdata,\n\t\t\tstatusCode: result.status,\n\t\t\theaders: result.headers\n\t\t};\n\t}\n\tif (type === \"error\") {\n\t\tif (isDataWithResponseInit(result)) {\n\t\t\tif (result.data instanceof Error) return {\n\t\t\t\ttype: \"error\",\n\t\t\t\terror: result.data,\n\t\t\t\tstatusCode: result.init?.status,\n\t\t\t\theaders: result.init?.headers ? new Headers(result.init.headers) : void 0\n\t\t\t};\n\t\t\treturn {\n\t\t\t\ttype: \"error\",\n\t\t\t\terror: dataWithResponseInitToErrorResponse(result),\n\t\t\t\tstatusCode: isRouteErrorResponse(result) ? result.status : void 0,\n\t\t\t\theaders: result.init?.headers ? new Headers(result.init.headers) : void 0\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\ttype: \"error\",\n\t\t\terror: result,\n\t\t\tstatusCode: isRouteErrorResponse(result) ? result.status : void 0\n\t\t};\n\t}\n\tif (isDataWithResponseInit(result)) return {\n\t\ttype: \"data\",\n\t\tdata: result.data,\n\t\tstatusCode: result.init?.status,\n\t\theaders: result.init?.headers ? new Headers(result.init.headers) : void 0\n\t};\n\treturn {\n\t\ttype: \"data\",\n\t\tdata: result\n\t};\n}\nfunction normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename) {\n\tlet location = response.headers.get(\"Location\");\n\tinvariant(location, \"Redirects returned/thrown from loaders/actions must have a Location header\");\n\tif (!isAbsoluteUrl(location)) {\n\t\tlet trimmedMatches = matches.slice(0, matches.findIndex((m) => m.route.id === routeId) + 1);\n\t\tlocation = normalizeTo(new URL(request.url), trimmedMatches, basename, location);\n\t\tresponse.headers.set(\"Location\", location);\n\t}\n\treturn response;\n}\nconst invalidProtocols = [\n\t\"about:\",\n\t\"blob:\",\n\t\"chrome:\",\n\t\"chrome-untrusted:\",\n\t\"content:\",\n\t\"data:\",\n\t\"devtools:\",\n\t\"file:\",\n\t\"filesystem:\",\n\t\"javascript:\"\n];\nfunction hasInvalidProtocol(location) {\n\ttry {\n\t\treturn invalidProtocols.includes(new URL(location).protocol);\n\t} catch {\n\t\treturn false;\n\t}\n}\nfunction normalizeRedirectLocation(location, currentUrl, basename, historyInstance) {\n\tif (isAbsoluteUrl(location)) {\n\t\tlet normalizedLocation = location;\n\t\tlet url = PROTOCOL_RELATIVE_URL_REGEX.test(normalizedLocation) ? new URL(normalizeProtocolRelativeUrl(normalizedLocation, currentUrl.protocol)) : new URL(normalizedLocation);\n\t\tif (hasInvalidProtocol(url.toString())) throw new Error(\"Invalid redirect location\");\n\t\tlet isSameBasename = stripBasename(url.pathname, basename) != null;\n\t\tif (url.origin === currentUrl.origin && isSameBasename) return removeDoubleSlashes(url.pathname) + url.search + url.hash;\n\t}\n\ttry {\n\t\tif (hasInvalidProtocol(historyInstance.createURL(location).toString())) throw new Error(\"Invalid redirect location\");\n\t} catch (e) {}\n\treturn location;\n}\nfunction createClientSideRequest(history, location, signal, submission) {\n\tlet url = history.createURL(stripHashFromPath(location)).toString();\n\tlet init = { signal };\n\tif (submission && isMutationMethod(submission.formMethod)) {\n\t\tlet { formMethod, formEncType } = submission;\n\t\tinit.method = formMethod.toUpperCase();\n\t\tif (formEncType === \"application/json\") {\n\t\t\tinit.headers = new Headers({ \"Content-Type\": formEncType });\n\t\t\tinit.body = JSON.stringify(submission.json);\n\t\t} else if (formEncType === \"text/plain\") init.body = submission.text;\n\t\telse if (formEncType === \"application/x-www-form-urlencoded\" && submission.formData) init.body = convertFormDataToSearchParams(submission.formData);\n\t\telse init.body = submission.formData;\n\t}\n\treturn new Request(url, init);\n}\nfunction convertFormDataToSearchParams(formData) {\n\tlet searchParams = new URLSearchParams();\n\tfor (let [key, value] of formData.entries()) searchParams.append(key, typeof value === \"string\" ? value : value.name);\n\treturn searchParams;\n}\nfunction convertSearchParamsToFormData(searchParams) {\n\tlet formData = new FormData();\n\tfor (let [key, value] of searchParams.entries()) formData.append(key, value);\n\treturn formData;\n}\nfunction processRouteLoaderData(matches, results, pendingActionResult, isStaticHandler = false, skipLoaderErrorBubbling = false) {\n\tlet loaderData = {};\n\tlet errors = null;\n\tlet statusCode;\n\tlet foundError = false;\n\tlet loaderHeaders = {};\n\tlet pendingError = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : void 0;\n\tmatches.forEach((match) => {\n\t\tif (!(match.route.id in results)) return;\n\t\tlet id = match.route.id;\n\t\tlet result = results[id];\n\t\tinvariant(!isRedirectResult(result), \"Cannot handle redirect results in processLoaderData\");\n\t\tif (isErrorResult(result)) {\n\t\t\tlet error = result.error;\n\t\t\tif (pendingError !== void 0) {\n\t\t\t\terror = pendingError;\n\t\t\t\tpendingError = void 0;\n\t\t\t}\n\t\t\terrors = errors || {};\n\t\t\tif (skipLoaderErrorBubbling) errors[id] = error;\n\t\t\telse {\n\t\t\t\tlet boundaryMatch = findNearestBoundary(matches, id);\n\t\t\t\tif (errors[boundaryMatch.route.id] == null) errors[boundaryMatch.route.id] = error;\n\t\t\t}\n\t\t\tif (!isStaticHandler) loaderData[id] = ResetLoaderDataSymbol;\n\t\t\tif (!foundError) {\n\t\t\t\tfoundError = true;\n\t\t\t\tstatusCode = isRouteErrorResponse(result.error) ? result.error.status : 500;\n\t\t\t}\n\t\t\tif (result.headers) loaderHeaders[id] = result.headers;\n\t\t} else {\n\t\t\tloaderData[id] = result.data;\n\t\t\tif (result.statusCode && result.statusCode !== 200 && !foundError) statusCode = result.statusCode;\n\t\t\tif (result.headers) loaderHeaders[id] = result.headers;\n\t\t}\n\t});\n\tif (pendingError !== void 0 && pendingActionResult) {\n\t\terrors = { [pendingActionResult[0]]: pendingError };\n\t\tif (pendingActionResult[2]) loaderData[pendingActionResult[2]] = void 0;\n\t}\n\treturn {\n\t\tloaderData,\n\t\terrors,\n\t\tstatusCode: statusCode || 200,\n\t\tloaderHeaders\n\t};\n}\nfunction processLoaderData(state, matches, results, pendingActionResult, revalidatingFetchers, fetcherResults, workingFetchers) {\n\tlet { loaderData, errors } = processRouteLoaderData(matches, results, pendingActionResult);\n\trevalidatingFetchers.filter((f) => !f.matches || f.matches.some((m) => m.shouldLoad)).forEach((rf) => {\n\t\tlet { key, match, controller } = rf;\n\t\tif (controller && controller.signal.aborted) return;\n\t\tlet result = fetcherResults[key];\n\t\tinvariant(result, \"Did not find corresponding fetcher result\");\n\t\tif (isErrorResult(result)) {\n\t\t\tlet boundaryMatch = findNearestBoundary(state.matches, match?.route.id);\n\t\t\tif (!(errors && errors[boundaryMatch.route.id])) errors = {\n\t\t\t\t...errors,\n\t\t\t\t[boundaryMatch.route.id]: result.error\n\t\t\t};\n\t\t\tworkingFetchers.delete(key);\n\t\t} else if (isRedirectResult(result)) invariant(false, \"Unhandled fetcher revalidation redirect\");\n\t\telse {\n\t\t\tlet doneFetcher = getDoneFetcher(result.data);\n\t\t\tworkingFetchers.set(key, doneFetcher);\n\t\t}\n\t});\n\treturn {\n\t\tloaderData,\n\t\terrors\n\t};\n}\nfunction mergeLoaderData(loaderData, newLoaderData, matches, errors) {\n\tlet mergedLoaderData = Object.entries(newLoaderData).filter(([, v]) => v !== ResetLoaderDataSymbol).reduce((merged, [k, v]) => {\n\t\tmerged[k] = v;\n\t\treturn merged;\n\t}, {});\n\tfor (let match of matches) {\n\t\tlet id = match.route.id;\n\t\tif (!newLoaderData.hasOwnProperty(id) && loaderData.hasOwnProperty(id) && match.route.loader) mergedLoaderData[id] = loaderData[id];\n\t\tif (errors && errors.hasOwnProperty(id)) break;\n\t}\n\treturn mergedLoaderData;\n}\nfunction getActionDataForCommit(pendingActionResult) {\n\tif (!pendingActionResult) return {};\n\treturn isErrorResult(pendingActionResult[1]) ? { actionData: {} } : { actionData: { [pendingActionResult[0]]: pendingActionResult[1].data } };\n}\nfunction findNearestBoundary(matches, routeId) {\n\treturn (routeId ? matches.slice(0, matches.findIndex((m) => m.route.id === routeId) + 1) : [...matches]).reverse().find((m) => m.route.ErrorBoundary != null || m.route.errorElement != null) || matches[0];\n}\nfunction getShortCircuitMatches(routes) {\n\tlet route = routes.length === 1 ? routes[0] : routes.find((r) => r.index || !r.path || r.path === \"/\") || { id: `__shim-error-route__` };\n\treturn {\n\t\tmatches: [{\n\t\t\tparams: {},\n\t\t\tpathname: \"\",\n\t\t\tpathnameBase: \"\",\n\t\t\troute\n\t\t}],\n\t\troute\n\t};\n}\nfunction getInternalRouterError(status, { pathname, routeId, method, type, message } = {}) {\n\tlet statusText = \"Unknown Server Error\";\n\tlet errorMessage = \"Unknown @remix-run/router error\";\n\tif (status === 400) {\n\t\tstatusText = \"Bad Request\";\n\t\tif (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.`;\n\t\telse if (type === \"invalid-body\") errorMessage = \"Unable to encode submission body\";\n\t} else if (status === 403) {\n\t\tstatusText = \"Forbidden\";\n\t\terrorMessage = `Route \"${routeId}\" does not match URL \"${pathname}\"`;\n\t} else if (status === 404) {\n\t\tstatusText = \"Not Found\";\n\t\terrorMessage = `No route matches URL \"${pathname}\"`;\n\t} else if (status === 405) {\n\t\tstatusText = \"Method Not Allowed\";\n\t\tif (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.`;\n\t\telse if (method) errorMessage = `Invalid request method \"${method.toUpperCase()}\"`;\n\t}\n\treturn new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true);\n}\nfunction findRedirect(results) {\n\tlet entries = Object.entries(results);\n\tfor (let i = entries.length - 1; i >= 0; i--) {\n\t\tlet [key, result] = entries[i];\n\t\tif (isRedirectResult(result)) return {\n\t\t\tkey,\n\t\t\tresult\n\t\t};\n\t}\n}\nfunction stripHashFromPath(path) {\n\treturn createPath({\n\t\t...typeof path === \"string\" ? parsePath(path) : path,\n\t\thash: \"\"\n\t});\n}\nfunction isHashChangeOnly(a, b) {\n\tif (a.pathname !== b.pathname || a.search !== b.search) return false;\n\tif (a.hash === \"\") return b.hash !== \"\";\n\telse if (a.hash === b.hash) return true;\n\telse if (b.hash !== \"\") return true;\n\treturn false;\n}\nfunction dataWithResponseInitToResponse(data) {\n\treturn Response.json(data.data, data.init ?? void 0);\n}\nfunction dataWithResponseInitToErrorResponse(data) {\n\treturn new ErrorResponseImpl(data.init?.status ?? 500, data.init?.statusText ?? \"Internal Server Error\", data.data);\n}\nfunction isDataStrategyResults(result) {\n\treturn result != null && typeof result === \"object\" && Object.entries(result).every(([key, value]) => typeof key === \"string\" && isDataStrategyResult(value));\n}\nfunction isDataStrategyResult(result) {\n\treturn result != null && typeof result === \"object\" && \"type\" in result && \"result\" in result && (result.type === \"data\" || result.type === \"error\");\n}\nfunction isRedirectDataStrategyResult(result) {\n\treturn isResponse(result.result) && redirectStatusCodes.has(result.result.status);\n}\nfunction isErrorResult(result) {\n\treturn result.type === \"error\";\n}\nfunction isRedirectResult(result) {\n\treturn (result && result.type) === \"redirect\";\n}\nfunction isDataWithResponseInit(value) {\n\treturn typeof value === \"object\" && value != null && \"type\" in value && \"data\" in value && \"init\" in value && value.type === \"DataWithResponseInit\";\n}\nfunction isResponse(value) {\n\treturn value != null && typeof value.status === \"number\" && typeof value.statusText === \"string\" && typeof value.headers === \"object\" && typeof value.body !== \"undefined\";\n}\nfunction isRedirectStatusCode(statusCode) {\n\treturn redirectStatusCodes.has(statusCode);\n}\nfunction isRedirectResponse(result) {\n\treturn isResponse(result) && isRedirectStatusCode(result.status) && result.headers.has(\"Location\");\n}\nfunction isValidMethod(method) {\n\treturn validRequestMethods.has(method.toUpperCase());\n}\nfunction isMutationMethod(method) {\n\treturn validMutationMethods.has(method.toUpperCase());\n}\nfunction hasNakedIndexQuery(search) {\n\treturn new URLSearchParams(search).getAll(\"index\").some((v) => v === \"\");\n}\nfunction getTargetMatch(matches, location) {\n\tlet search = typeof location === \"string\" ? parsePath(location).search : location.search;\n\tif (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || \"\")) return matches[matches.length - 1];\n\tlet pathMatches = getPathContributingMatches(matches);\n\treturn pathMatches[pathMatches.length - 1];\n}\nfunction getInstrumentationNavigateMeta(history, location, matches) {\n\treturn {\n\t\turl: createDataFunctionUrl(history.createURL(location), location),\n\t\tpattern: matches ? getRoutePattern(matches) : \"\",\n\t\tparams: matches?.[0]?.params ? { ...matches[0].params } : {}\n\t};\n}\nfunction getSubmissionFromNavigation(navigation) {\n\tlet { formMethod, formAction, formEncType, text, formData, json } = navigation;\n\tif (!formMethod || !formAction || !formEncType) return;\n\tif (text != null) return {\n\t\tformMethod,\n\t\tformAction,\n\t\tformEncType,\n\t\tformData: void 0,\n\t\tjson: void 0,\n\t\ttext\n\t};\n\telse if (formData != null) return {\n\t\tformMethod,\n\t\tformAction,\n\t\tformEncType,\n\t\tformData,\n\t\tjson: void 0,\n\t\ttext: void 0\n\t};\n\telse if (json !== void 0) return {\n\t\tformMethod,\n\t\tformAction,\n\t\tformEncType,\n\t\tformData: void 0,\n\t\tjson,\n\t\ttext: void 0\n\t};\n}\nfunction getLoadingNavigation(location, matches, historyAction, submission) {\n\tif (submission) return {\n\t\tstate: \"loading\",\n\t\tlocation,\n\t\tmatches,\n\t\thistoryAction,\n\t\tformMethod: submission.formMethod,\n\t\tformAction: submission.formAction,\n\t\tformEncType: submission.formEncType,\n\t\tformData: submission.formData,\n\t\tjson: submission.json,\n\t\ttext: submission.text\n\t};\n\telse return {\n\t\tstate: \"loading\",\n\t\tlocation,\n\t\tmatches,\n\t\thistoryAction,\n\t\tformMethod: void 0,\n\t\tformAction: void 0,\n\t\tformEncType: void 0,\n\t\tformData: void 0,\n\t\tjson: void 0,\n\t\ttext: void 0\n\t};\n}\nfunction getSubmittingNavigation(location, matches, historyAction, submission) {\n\treturn {\n\t\tstate: \"submitting\",\n\t\tlocation,\n\t\tmatches,\n\t\thistoryAction,\n\t\tformMethod: submission.formMethod,\n\t\tformAction: submission.formAction,\n\t\tformEncType: submission.formEncType,\n\t\tformData: submission.formData,\n\t\tjson: submission.json,\n\t\ttext: submission.text\n\t};\n}\nfunction getLoadingFetcher(submission, data) {\n\tif (submission) return {\n\t\tstate: \"loading\",\n\t\tformMethod: submission.formMethod,\n\t\tformAction: submission.formAction,\n\t\tformEncType: submission.formEncType,\n\t\tformData: submission.formData,\n\t\tjson: submission.json,\n\t\ttext: submission.text,\n\t\tdata\n\t};\n\telse return {\n\t\tstate: \"loading\",\n\t\tformMethod: void 0,\n\t\tformAction: void 0,\n\t\tformEncType: void 0,\n\t\tformData: void 0,\n\t\tjson: void 0,\n\t\ttext: void 0,\n\t\tdata\n\t};\n}\nfunction getSubmittingFetcher(submission, existingFetcher) {\n\treturn {\n\t\tstate: \"submitting\",\n\t\tformMethod: submission.formMethod,\n\t\tformAction: submission.formAction,\n\t\tformEncType: submission.formEncType,\n\t\tformData: submission.formData,\n\t\tjson: submission.json,\n\t\ttext: submission.text,\n\t\tdata: existingFetcher ? existingFetcher.data : void 0\n\t};\n}\nfunction getDoneFetcher(data) {\n\treturn {\n\t\tstate: \"idle\",\n\t\tformMethod: void 0,\n\t\tformAction: void 0,\n\t\tformEncType: void 0,\n\t\tformData: void 0,\n\t\tjson: void 0,\n\t\ttext: void 0,\n\t\tdata\n\t};\n}\nfunction restoreAppliedTransitions(_window, transitions) {\n\ttry {\n\t\tlet sessionPositions = _window.sessionStorage.getItem(TRANSITIONS_STORAGE_KEY);\n\t\tif (sessionPositions) {\n\t\t\tlet json = JSON.parse(sessionPositions);\n\t\t\tfor (let [k, v] of Object.entries(json || {})) if (v && Array.isArray(v)) transitions.set(k, new Set(v || []));\n\t\t}\n\t} catch (e) {}\n}\nfunction persistAppliedTransitions(_window, transitions) {\n\tif (transitions.size > 0) {\n\t\tlet json = {};\n\t\tfor (let [k, v] of transitions) json[k] = [...v];\n\t\ttry {\n\t\t\t_window.sessionStorage.setItem(TRANSITIONS_STORAGE_KEY, JSON.stringify(json));\n\t\t} catch (error) {\n\t\t\twarning(false, `Failed to save applied view transitions in sessionStorage (${error}).`);\n\t\t}\n\t}\n}\nfunction createDeferred() {\n\tlet resolve;\n\tlet reject;\n\tlet promise = new Promise((res, rej) => {\n\t\tresolve = async (val) => {\n\t\t\tres(val);\n\t\t\ttry {\n\t\t\t\tawait promise;\n\t\t\t} catch (e) {}\n\t\t};\n\t\treject = async (error) => {\n\t\t\trej(error);\n\t\t\ttry {\n\t\t\t\tawait promise;\n\t\t\t} catch (e) {}\n\t\t};\n\t});\n\treturn {\n\t\tpromise,\n\t\tresolve,\n\t\treject\n\t};\n}\n//#endregion\nexport { IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, createRouter, createStaticHandler, getStaticContextFromError, hasInvalidProtocol, isDataWithResponseInit, isMutationMethod, isRedirectResponse, isRedirectStatusCode, isResponse };\n"],"x_google_ignoreList":[0],"mappings":";AAeA,IAAM,IAA0B;CAC/B;CACA;CACA;CACA;CACA;AAC4B,IAAI,IAAI,EAAwB;AAC7D,IAAM,IAAyB,CAAC,OAAO,GAAG,EAAwB;AACtC,IAAI,IAAI,EAAuB;AAo/E3D,IAAM,IAAmB;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,SAAS,EAAmB,GAAU;AACrC,KAAI;AACH,SAAO,EAAiB,SAAS,IAAI,IAAI,EAAS,CAAC,SAAS;SACrD;AACP,SAAO"}
@@ -1,9 +0,0 @@
1
- //#region node_modules/react-router/dist/production/lib/router/url.js
2
- var e = /^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i, t = /^[\\/]{2}/;
3
- function n(e, t) {
4
- return t + e.replace(/\\/g, "/");
5
- }
6
- //#endregion
7
- export { e as ABSOLUTE_URL_REGEX, t as PROTOCOL_RELATIVE_URL_REGEX, n as normalizeProtocolRelativeUrl };
8
-
9
- //# sourceMappingURL=url.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"url.js","names":[],"sources":["../../../../../../../node_modules/react-router/dist/production/lib/router/url.js"],"sourcesContent":["/**\n * react-router v8.3.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\n//#region lib/router/url.ts\nconst ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|[\\\\/]{2})/i;\nconst PROTOCOL_RELATIVE_URL_REGEX = /^[\\\\/]{2}/;\nfunction normalizeProtocolRelativeUrl(url, protocol) {\n\treturn protocol + url.replace(/\\\\/g, \"/\");\n}\n//#endregion\nexport { ABSOLUTE_URL_REGEX, PROTOCOL_RELATIVE_URL_REGEX, normalizeProtocolRelativeUrl };\n"],"x_google_ignoreList":[0],"mappings":";AAWA,IAAM,IAAqB,qCACrB,IAA8B;AACpC,SAAS,EAA6B,GAAK,GAAU;AACpD,QAAO,IAAW,EAAI,QAAQ,OAAO,IAAI"}
@@ -1,236 +0,0 @@
1
- import { ABSOLUTE_URL_REGEX as e, PROTOCOL_RELATIVE_URL_REGEX as t, normalizeProtocolRelativeUrl as n } from "./url.js";
2
- import { invariant as r, parsePath as i, warning as a } from "./history.js";
3
- import "react";
4
- //#region node_modules/react-router/dist/production/lib/router/utils.js
5
- function o(e, t, n = "/") {
6
- return s(e, t, n, !1);
7
- }
8
- function s(e, t, n, r, a) {
9
- let o = k((typeof t == "string" ? i(t) : t).pathname || "/", n);
10
- if (o == null) return null;
11
- let s = a ?? l(e), c = null, u = O(o);
12
- for (let e = 0; c == null && e < s.length; ++e) c = w(s[e], u, r);
13
- return c;
14
- }
15
- function c(e, t) {
16
- let { route: n, pathname: r, params: i } = e;
17
- return {
18
- id: n.id,
19
- pathname: r,
20
- params: i,
21
- loaderData: t[n.id],
22
- handle: n.handle
23
- };
24
- }
25
- function l(e) {
26
- let t = u(e);
27
- return f(t), t;
28
- }
29
- function u(e, t = [], n = [], i = "", a = !1) {
30
- let o = (e, o, s = a, c) => {
31
- let l = {
32
- relativePath: c === void 0 ? e.path || "" : c,
33
- caseSensitive: e.caseSensitive === !0,
34
- childrenIndex: o,
35
- route: e
36
- };
37
- if (l.relativePath.startsWith("/")) {
38
- if (!l.relativePath.startsWith(i) && s) return;
39
- r(l.relativePath.startsWith(i), `Absolute route path "${l.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`), l.relativePath = l.relativePath.slice(i.length);
40
- }
41
- let d = L([i, l.relativePath]), f = n.concat(l);
42
- e.children && e.children.length > 0 && (r(e.index !== !0, `Index routes must not have child routes. Please remove all child routes from route path "${d}".`), u(e.children, t, f, d, s)), !(e.path == null && !e.index) && t.push({
43
- path: d,
44
- score: S(d, e.index),
45
- routesMeta: f.map((e, t) => {
46
- let [n, r] = D(e.relativePath, e.caseSensitive, t === f.length - 1);
47
- return {
48
- ...e,
49
- matcher: n,
50
- compiledParams: r
51
- };
52
- })
53
- });
54
- };
55
- return e.forEach((e, t) => {
56
- if (e.path === "" || !e.path?.includes("?")) o(e, t);
57
- else for (let n of d(e.path)) o(e, t, !0, n);
58
- }), t;
59
- }
60
- function d(e) {
61
- let t = e.split("/");
62
- if (t.length === 0) return [];
63
- let [n, ...r] = t, i = n.endsWith("?"), a = n.replace(/\?$/, "");
64
- if (r.length === 0) return i ? [a, ""] : [a];
65
- let o = d(r.join("/")), s = [];
66
- return s.push(...o.map((e) => e === "" ? a : [a, e].join("/"))), i && s.push(...o), s.map((t) => e.startsWith("/") && t === "" ? "/" : t);
67
- }
68
- function f(e) {
69
- e.sort((e, t) => e.score === t.score ? C(e.routesMeta.map((e) => e.childrenIndex), t.routesMeta.map((e) => e.childrenIndex)) : t.score - e.score);
70
- }
71
- var p = /^:[\w-]+$/, m = /^:[\w-]+/, h = 3.5, g = 3, _ = 2, v = 1, y = 10, b = -2, x = (e) => e === "*";
72
- function S(e, t) {
73
- let n = e.split("/"), r = n.length;
74
- return n.some(x) && (r += b), t && (r += _), n.filter((e) => !x(e)).reduce((e, t) => e + (p.test(t) ? g : m.test(t) ? h : t === "" ? v : y), r);
75
- }
76
- function C(e, t) {
77
- return e.length === t.length && e.slice(0, -1).every((e, n) => e === t[n]) ? e[e.length - 1] - t[t.length - 1] : 0;
78
- }
79
- function w(e, t, n = !1) {
80
- let { routesMeta: r } = e, i = {}, a = "/", o = [];
81
- for (let e = 0; e < r.length; ++e) {
82
- let s = r[e], c = e === r.length - 1, l = a === "/" ? t : t.slice(a.length) || "/", u = {
83
- path: s.relativePath,
84
- caseSensitive: s.caseSensitive,
85
- end: c
86
- }, d = s.matcher && s.compiledParams ? E(u, l, s.matcher, s.compiledParams) : T(u, l), f = s.route;
87
- if (!d && c && n && !r[r.length - 1].route.index && (d = T({
88
- path: s.relativePath,
89
- caseSensitive: s.caseSensitive,
90
- end: !1
91
- }, l)), !d) return null;
92
- Object.assign(i, d.params), o.push({
93
- params: i,
94
- pathname: L([a, d.pathname]),
95
- pathnameBase: z(L([a, d.pathnameBase])),
96
- route: f
97
- }), d.pathnameBase !== "/" && (a = L([a, d.pathnameBase]));
98
- }
99
- return o;
100
- }
101
- function T(e, t) {
102
- typeof e == "string" && (e = {
103
- path: e,
104
- caseSensitive: !1,
105
- end: !0
106
- });
107
- let [n, r] = D(e.path, e.caseSensitive, e.end);
108
- return E(e, t, n, r);
109
- }
110
- function E(e, t, n, r) {
111
- let i = t.match(n);
112
- if (!i) return null;
113
- let a = i[0], o = a.replace(/(.)\/+$/, "$1"), s = i.slice(1);
114
- return {
115
- params: r.reduce((e, { paramName: t, isOptional: n }, r) => {
116
- if (t === "*") {
117
- let e = s[r] || "";
118
- o = a.slice(0, a.length - e.length).replace(/(.)\/+$/, "$1");
119
- }
120
- let i = s[r];
121
- return n && !i ? e[t] = void 0 : e[t] = (i || "").replace(/%2F/g, "/"), e;
122
- }, {}),
123
- pathname: a,
124
- pathnameBase: o,
125
- pattern: e
126
- };
127
- }
128
- function D(e, t = !1, n = !0) {
129
- a(e === "*" || !e.endsWith("*") || e.endsWith("/*"), `Route path "${e}" will be treated as if it were "${e.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/, "/*")}".`);
130
- let r = [], i = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (e, t, n, i, a) => {
131
- if (r.push({
132
- paramName: t,
133
- isOptional: n != null
134
- }), n) {
135
- let t = a.charAt(i + e.length);
136
- return t && t !== "/" ? "/([^\\/]*)" : "(?:/([^\\/]*))?";
137
- }
138
- return "/([^\\/]+)";
139
- }).replace(/\/([\w-]+)\?(?=\/|$|\()/g, "(?:/$1)?");
140
- return e.endsWith("*") ? (r.push({ paramName: "*" }), i += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : n ? i += "\\/*$" : e !== "" && e !== "/" && (i += "(?:(?=\\/|$))"), [new RegExp(i, t ? void 0 : "i"), r];
141
- }
142
- function O(e) {
143
- try {
144
- return e.split("/").map((e) => decodeURIComponent(e).replace(/\//g, "%2F")).join("/");
145
- } catch (t) {
146
- return a(!1, `The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`), e;
147
- }
148
- }
149
- function k(e, t) {
150
- if (t === "/") return e;
151
- if (!e.toLowerCase().startsWith(t.toLowerCase())) return null;
152
- let n = t.endsWith("/") ? t.length - 1 : t.length, r = e.charAt(n);
153
- return r && r !== "/" ? null : e.slice(n) || "/";
154
- }
155
- function A(e, t = "/") {
156
- let { pathname: n, search: r = "", hash: a = "" } = typeof e == "string" ? i(e) : e, o;
157
- return n ? (n = I(n), o = n.startsWith("/") ? j(n.substring(1), "/") : j(n, t)) : o = t, {
158
- pathname: o,
159
- search: B(r),
160
- hash: V(a)
161
- };
162
- }
163
- function j(e, t) {
164
- let n = R(t).split("/");
165
- return e.split("/").forEach((e) => {
166
- e === ".." ? n.length > 1 && n.pop() : e !== "." && n.push(e);
167
- }), n.length > 1 ? n.join("/") : "/";
168
- }
169
- function M(e, t, n, r) {
170
- return `Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
171
- }
172
- function N(e) {
173
- return e.filter((e, t) => t === 0 || e.route.path && e.route.path.length > 0);
174
- }
175
- function P(e) {
176
- let t = N(e);
177
- return t.map((e, n) => n === t.length - 1 ? e.pathname : e.pathnameBase);
178
- }
179
- function F(e, t, n, a = !1) {
180
- let o;
181
- typeof e == "string" ? o = i(e) : (o = { ...e }, r(!o.pathname || !o.pathname.includes("?"), M("?", "pathname", "search", o)), r(!o.pathname || !o.pathname.includes("#"), M("#", "pathname", "hash", o)), r(!o.search || !o.search.includes("#"), M("#", "search", "hash", o)));
182
- let s = e === "" || o.pathname === "", c = s ? "/" : o.pathname, l;
183
- if (c == null) l = n;
184
- else {
185
- let e = t.length - 1;
186
- if (!a && c.startsWith("..")) {
187
- let t = c.split("/");
188
- for (; t[0] === "..";) t.shift(), --e;
189
- o.pathname = t.join("/");
190
- }
191
- l = e >= 0 ? t[e] : "/";
192
- }
193
- let u = A(o, l), d = c && c !== "/" && c.endsWith("/"), f = (s || c === ".") && n.endsWith("/");
194
- return !u.pathname.endsWith("/") && (d || f) && (u.pathname += "/"), u;
195
- }
196
- var I = (e) => e.replace(/[\\/]{2,}/g, "/"), L = (e) => I(e.join("/")), R = (e) => e.replace(/\/+$/, ""), z = (e) => R(e).replace(/^\/*/, "/"), B = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, V = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e, H = class {
197
- status;
198
- statusText;
199
- data;
200
- error;
201
- internal;
202
- constructor(e, t, n, r = !1) {
203
- this.status = e, this.statusText = t || "", this.internal = r, n instanceof Error ? (this.data = n.toString(), this.error = n) : this.data = n;
204
- }
205
- };
206
- function U(e) {
207
- return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
208
- }
209
- function W(e) {
210
- return L(e.map((e) => e.route.path).filter(Boolean)) || "/";
211
- }
212
- var G = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0;
213
- function K(r, i) {
214
- let o = r;
215
- if (typeof o != "string" || !e.test(o)) return {
216
- absoluteURL: void 0,
217
- isExternal: !1,
218
- to: o
219
- };
220
- let s = o, c = !1;
221
- if (G) try {
222
- let e = new URL(window.location.href), r = t.test(o) ? new URL(n(o, e.protocol)) : new URL(o), a = k(r.pathname, i);
223
- r.origin === e.origin && a != null ? o = a + r.search + r.hash : c = !0;
224
- } catch {
225
- a(!1, `<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`);
226
- }
227
- return {
228
- absoluteURL: s,
229
- isExternal: c,
230
- to: o
231
- };
232
- }
233
- //#endregion
234
- export { H as ErrorResponseImpl, c as convertRouteMatchToUiMatch, P as getResolveToMatches, W as getRoutePattern, G as isBrowser, U as isRouteErrorResponse, L as joinPaths, T as matchPath, o as matchRoutes, K as parseToInfo, F as resolveTo, k as stripBasename };
235
-
236
- //# sourceMappingURL=utils.js.map