Socket
Socket
Sign inDemoInstall

@remix-run/router

Package Overview
Dependencies
Maintainers
2
Versions
212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remix-run/router - npm Package Compare versions

Comparing version 0.0.0-experimental-ad6954b7 to 0.0.0-experimental-add6f8aa

303

CHANGELOG.md
# `@remix-run/router`
## 1.14.2
### Patch Changes
- Fix bug where dashes were not picked up in dynamic parameter names ([#11160](https://github.com/remix-run/react-router/pull/11160))
- Do not attempt to deserialize empty JSON responses ([#11164](https://github.com/remix-run/react-router/pull/11164))
## 1.14.1
### Patch Changes
- Fix bug with `route.lazy` not working correctly on initial SPA load when `v7_partialHydration` is specified ([#11121](https://github.com/remix-run/react-router/pull/11121))
- Fix bug preventing revalidation from occurring for persisted fetchers unmounted during the `submitting` phase ([#11102](https://github.com/remix-run/react-router/pull/11102))
- De-dup relative path logic in `resolveTo` ([#11097](https://github.com/remix-run/react-router/pull/11097))
## 1.14.0
### Minor Changes
- Added a new `future.v7_partialHydration` future flag that enables partial hydration of a data router when Server-Side Rendering. This allows you to provide `hydrationData.loaderData` that has values for _some_ initially matched route loaders, but not all. When this flag is enabled, the router will call `loader` functions for routes that do not have hydration loader data during `router.initialize()`, and it will render down to the deepest provided `HydrateFallback` (up to the first route without hydration data) while it executes the unhydrated routes. ([#11033](https://github.com/remix-run/react-router/pull/11033))
For example, the following router has a `root` and `index` route, but only provided `hydrationData.loaderData` for the `root` route. Because the `index` route has a `loader`, we need to run that during initialization. With `future.v7_partialHydration` specified, `<RouterProvider>` will render the `RootComponent` (because it has data) and then the `IndexFallback` (since it does not have data). Once `indexLoader` finishes, application will update and display `IndexComponent`.
```jsx
let router = createBrowserRouter(
[
{
id: "root",
path: "/",
loader: rootLoader,
Component: RootComponent,
Fallback: RootFallback,
children: [
{
id: "index",
index: true,
loader: indexLoader,
Component: IndexComponent,
HydrateFallback: IndexFallback,
},
],
},
],
{
future: {
v7_partialHydration: true,
},
hydrationData: {
loaderData: {
root: { message: "Hydrated from Root!" },
},
},
}
);
```
If the above example did not have an `IndexFallback`, then `RouterProvider` would instead render the `RootFallback` while it executed the `indexLoader`.
**Note:** When `future.v7_partialHydration` is provided, the `<RouterProvider fallbackElement>` prop is ignored since you can move it to a `Fallback` on your top-most route. The `fallbackElement` prop will be removed in React Router v7 when `v7_partialHydration` behavior becomes the standard behavior.
- Add a new `future.v7_relativeSplatPath` flag to implement a breaking bug fix to relative routing when inside a splat route. ([#11087](https://github.com/remix-run/react-router/pull/11087))
This fix was originally added in [#10983](https://github.com/remix-run/react-router/issues/10983) and was later reverted in [#11078](https://github.com/remix-run/react-router/pull/11078) because it was determined that a large number of existing applications were relying on the buggy behavior (see [#11052](https://github.com/remix-run/react-router/issues/11052))
**The Bug**
The buggy behavior is that without this flag, the default behavior when resolving relative paths is to _ignore_ any splat (`*`) portion of the current route path.
**The Background**
This decision was originally made thinking that it would make the concept of nested different sections of your apps in `<Routes>` easier if relative routing would _replace_ the current splat:
```jsx
<BrowserRouter>
<Routes>
<Route path="/" element={<Home />} />
<Route path="dashboard/*" element={<Dashboard />} />
</Routes>
</BrowserRouter>
```
Any paths like `/dashboard`, `/dashboard/team`, `/dashboard/projects` will match the `Dashboard` route. The dashboard component itself can then render nested `<Routes>`:
```jsx
function Dashboard() {
return (
<div>
<h2>Dashboard</h2>
<nav>
<Link to="/">Dashboard Home</Link>
<Link to="team">Team</Link>
<Link to="projects">Projects</Link>
</nav>
<Routes>
<Route path="/" element={<DashboardHome />} />
<Route path="team" element={<DashboardTeam />} />
<Route path="projects" element={<DashboardProjects />} />
</Routes>
</div>
);
}
```
Now, all links and route paths are relative to the router above them. This makes code splitting and compartmentalizing your app really easy. You could render the `Dashboard` as its own independent app, or embed it into your large app without making any changes to it.
**The Problem**
The problem is that this concept of ignoring part of a path breaks a lot of other assumptions in React Router - namely that `"."` always means the current location pathname for that route. When we ignore the splat portion, we start getting invalid paths when using `"."`:
```jsx
// If we are on URL /dashboard/team, and we want to link to /dashboard/team:
function DashboardTeam() {
// ❌ This is broken and results in <a href="/dashboard">
return <Link to=".">A broken link to the Current URL</Link>;
// ✅ This is fixed but super unintuitive since we're already at /dashboard/team!
return <Link to="./team">A broken link to the Current URL</Link>;
}
```
We've also introduced an issue that we can no longer move our `DashboardTeam` component around our route hierarchy easily - since it behaves differently if we're underneath a non-splat route, such as `/dashboard/:widget`. Now, our `"."` links will, properly point to ourself _inclusive of the dynamic param value_ so behavior will break from it's corresponding usage in a `/dashboard/*` route.
Even worse, consider a nested splat route configuration:
```jsx
<BrowserRouter>
<Routes>
<Route path="dashboard">
<Route path="*" element={<Dashboard />} />
</Route>
</Routes>
</BrowserRouter>
```
Now, a `<Link to=".">` and a `<Link to="..">` inside the `Dashboard` component go to the same place! That is definitely not correct!
Another common issue arose in Data Routers (and Remix) where any `<Form>` should post to it's own route `action` if you the user doesn't specify a form action:
```jsx
let router = createBrowserRouter({
path: "/dashboard",
children: [
{
path: "*",
action: dashboardAction,
Component() {
// ❌ This form is broken! It throws a 405 error when it submits because
// it tries to submit to /dashboard (without the splat value) and the parent
// `/dashboard` route doesn't have an action
return <Form method="post">...</Form>;
},
},
],
});
```
This is just a compounded issue from the above because the default location for a `Form` to submit to is itself (`"."`) - and if we ignore the splat portion, that now resolves to the parent route.
**The Solution**
If you are leveraging this behavior, it's recommended to enable the future flag, move your splat to it's own route, and leverage `../` for any links to "sibling" pages:
```jsx
<BrowserRouter>
<Routes>
<Route path="dashboard">
<Route index path="*" element={<Dashboard />} />
</Route>
</Routes>
</BrowserRouter>
function Dashboard() {
return (
<div>
<h2>Dashboard</h2>
<nav>
<Link to="..">Dashboard Home</Link>
<Link to="../team">Team</Link>
<Link to="../projects">Projects</Link>
</nav>
<Routes>
<Route path="/" element={<DashboardHome />} />
<Route path="team" element={<DashboardTeam />} />
<Route path="projects" element={<DashboardProjects />} />
</Router>
</div>
);
}
```
This way, `.` means "the full current pathname for my route" in all cases (including static, dynamic, and splat routes) and `..` always means "my parents pathname".
### Patch Changes
- Catch and bubble errors thrown when trying to unwrap responses from `loader`/`action` functions ([#11061](https://github.com/remix-run/react-router/pull/11061))
- Fix `relative="path"` issue when rendering `Link`/`NavLink` outside of matched routes ([#11062](https://github.com/remix-run/react-router/pull/11062))
## 1.13.1
### Patch Changes
- Revert the `useResolvedPath` fix for splat routes due to a large number of applications that were relying on the buggy behavior (see <https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329>). We plan to re-introduce this fix behind a future flag in the next minor version. ([#11078](https://github.com/remix-run/react-router/pull/11078))
## 1.13.0
### Minor Changes
- Export the `PathParam` type from the public API ([#10719](https://github.com/remix-run/react-router/pull/10719))
### Patch Changes
- Fix bug with `resolveTo` in splat routes ([#11045](https://github.com/remix-run/react-router/pull/11045))
- This is a follow up to [#10983](https://github.com/remix-run/react-router/pull/10983) to handle the few other code paths using `getPathContributingMatches`
- This removes the `UNSAFE_getPathContributingMatches` export from `@remix-run/router` since we no longer need this in the `react-router`/`react-router-dom` layers
- Do not revalidate unmounted fetchers when `v7_fetcherPersist` is enabled ([#11044](https://github.com/remix-run/react-router/pull/11044))
## 1.12.0
### Minor Changes
- Add `unstable_flushSync` option to `router.navigate` and `router.fetch` to tell the React Router layer to opt-out of `React.startTransition` and into `ReactDOM.flushSync` for state updates ([#11005](https://github.com/remix-run/react-router/pull/11005))
### Patch Changes
- Fix `relative="path"` bug where relative path calculations started from the full location pathname, instead of from the current contextual route pathname. ([#11006](https://github.com/remix-run/react-router/pull/11006))
```jsx
<Route path="/a">
<Route path="/b" element={<Component />}>
<Route path="/c" />
</Route>
</Route>;
function Component() {
return (
<>
{/* This is now correctly relative to /a/b, not /a/b/c */}
<Link to=".." relative="path" />
<Outlet />
</>
);
}
```
## 1.11.0
### Minor Changes
- Add a new `future.v7_fetcherPersist` flag to the `@remix-run/router` to change the persistence behavior of fetchers when `router.deleteFetcher` is called. Instead of being immediately cleaned up, fetchers will persist until they return to an `idle` state ([RFC](https://github.com/remix-run/remix/discussions/7698)) ([#10962](https://github.com/remix-run/react-router/pull/10962))
- This is sort of a long-standing bug fix as the `useFetchers()` API was always supposed to only reflect **in-flight** fetcher information for pending/optimistic UI -- it was not intended to reflect fetcher data or hang onto fetchers after they returned to an `idle` state
- Keep an eye out for the following specific behavioral changes when opting into this flag and check your app for compatibility:
- Fetchers that complete _while still mounted_ will no longer appear in `useFetchers()`. They served effectively no purpose in there since you can access the data via `useFetcher().data`).
- Fetchers that previously unmounted _while in-flight_ will not be immediately aborted and will instead be cleaned up once they return to an `idle` state. They will remain exposed via `useFetchers` while in-flight so you can still access pending/optimistic data after unmount.
- When `v7_fetcherPersist` is enabled, the router now performs ref-counting on fetcher keys via `getFetcher`/`deleteFetcher` so it knows when a given fetcher is totally unmounted from the UI ([#10977](https://github.com/remix-run/react-router/pull/10977))
- Once a fetcher has been totally unmounted, we can ignore post-processing of a persisted fetcher result such as a redirect or an error
- The router will also pass a new `deletedFetchers` array to the subscriber callbacks so that the UI layer can remove associated fetcher data
- Add support for optional path segments in `matchPath` ([#10768](https://github.com/remix-run/react-router/pull/10768))
### Patch Changes
- Fix `router.getFetcher`/`router.deleteFetcher` type definitions which incorrectly specified `key` as an optional parameter ([#10960](https://github.com/remix-run/react-router/pull/10960))
## 1.10.0
### Minor Changes
- Add experimental support for the [View Transitions API](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition) by allowing users to opt-into view transitions on navigations via the new `unstable_viewTransition` option to `router.navigate` ([#10916](https://github.com/remix-run/react-router/pull/10916))
### Patch Changes
- Allow 404 detection to leverage root route error boundary if path contains a URL segment ([#10852](https://github.com/remix-run/react-router/pull/10852))
- Fix `ErrorResponse` type to avoid leaking internal field ([#10876](https://github.com/remix-run/react-router/pull/10876))
## 1.9.0
### Minor Changes
- In order to move towards stricter TypeScript support in the future, we're aiming to replace current usages of `any` with `unknown` on exposed typings for user-provided data. To do this in Remix v2 without introducing breaking changes in React Router v6, we have added generics to a number of shared types. These continue to default to `any` in React Router and are overridden with `unknown` in Remix. In React Router v7 we plan to move these to `unknown` as a breaking change. ([#10843](https://github.com/remix-run/react-router/pull/10843))
- `Location` now accepts a generic for the `location.state` value
- `ActionFunctionArgs`/`ActionFunction`/`LoaderFunctionArgs`/`LoaderFunction` now accept a generic for the `context` parameter (only used in SSR usages via `createStaticHandler`)
- The return type of `useMatches` (now exported as `UIMatch`) accepts generics for `match.data` and `match.handle` - both of which were already set to `unknown`
- Move the `@private` class export `ErrorResponse` to an `UNSAFE_ErrorResponseImpl` export since it is an implementation detail and there should be no construction of `ErrorResponse` instances in userland. This frees us up to export a `type ErrorResponse` which correlates to an instance of the class via `InstanceType`. Userland code should only ever be using `ErrorResponse` as a type and should be type-narrowing via `isRouteErrorResponse`. ([#10811](https://github.com/remix-run/react-router/pull/10811))
- Export `ShouldRevalidateFunctionArgs` interface ([#10797](https://github.com/remix-run/react-router/pull/10797))
- Removed private/internal APIs only required for the Remix v1 backwards compatibility layer and no longer needed in Remix v2 (`_isFetchActionRedirect`, `_hasFetcherDoneAnything`) ([#10715](https://github.com/remix-run/react-router/pull/10715))
### Patch Changes
- Add method/url to error message on aborted `query`/`queryRoute` calls ([#10793](https://github.com/remix-run/react-router/pull/10793))
- Fix a race-condition with loader/action-thrown errors on `route.lazy` routes ([#10778](https://github.com/remix-run/react-router/pull/10778))
- Fix type for `actionResult` on the arguments object passed to `shouldRevalidate` ([#10779](https://github.com/remix-run/react-router/pull/10779))
## 1.8.0

@@ -389,9 +683,4 @@

For an overview of the features provided by `react-router`, we recommend you go check out the [docs][rr-docs], especially the [feature overview][rr-feature-overview] and the [tutorial][rr-tutorial].
For an overview of the features provided by `react-router`, we recommend you go check out the [docs](https://reactrouter.com), especially the [feature overview](https://reactrouter.com/start/overview) and the [tutorial](https://reactrouter.com/start/tutorial).
For an overview of the features provided by `@remix-run/router`, please check out the [`README`][remix-router-readme].
[rr-docs]: https://reactrouter.com
[rr-feature-overview]: https://reactrouter.com/start/overview
[rr-tutorial]: https://reactrouter.com/start/tutorial
[remix-router-readme]: https://github.com/remix-run/react-router/blob/main/packages/router/README.md
For an overview of the features provided by `@remix-run/router`, please check out the [`README`](./README.md).

8

dist/history.d.ts

@@ -46,7 +46,7 @@ /**

*/
export interface Location extends Path {
export interface Location<State = any> extends Path {
/**
* A value of arbitrary data associated with this location.
*/
state: any;
state: State;
/**

@@ -85,4 +85,4 @@ * A unique string associated with this location. May be used to safely store

* Describes a location that is the destination of some navigation, either via
* `history.push` or `history.replace`. May be either a URL or the pieces of a
* URL path.
* `history.push` or `history.replace`. This may be either a URL or the pieces
* of a URL path.
*/

@@ -89,0 +89,0 @@ export type To = string | Partial<Path>;

@@ -1,3 +0,3 @@

export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, FormEncType, FormMethod, HTMLFormMethod, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathPattern, RedirectFunction, ShouldRevalidateFunction, TrackedPromise, V7_FormMethod, } from "./utils";
export { AbortedDeferredError, ErrorResponse, defer, generatePath, getToPathname, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, redirect, redirectDocument, resolvePath, resolveTo, stripBasename, } from "./utils";
export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, ErrorResponse, FormEncType, FormMethod, HTMLFormMethod, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathParam, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, TrackedPromise, UIMatch, V7_FormMethod, } from "./utils";
export { AbortedDeferredError, defer, generatePath, getToPathname, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, redirect, redirectDocument, resolvePath, resolveTo, stripBasename, } from "./utils";
export type { BrowserHistory, BrowserHistoryOptions, HashHistory, HashHistoryOptions, History, InitialEntry, Location, MemoryHistory, MemoryHistoryOptions, Path, To, } from "./history";

@@ -8,3 +8,3 @@ export { Action, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, parsePath, } from "./history";

export type { RouteManifest as UNSAFE_RouteManifest } from "./utils";
export { DeferredData as UNSAFE_DeferredData, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, getPathContributingMatches as UNSAFE_getPathContributingMatches, } from "./utils";
export { DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, getResolveToMatches as UNSAFE_getResolveToMatches, } from "./utils";
export { invariant as UNSAFE_invariant, warning as UNSAFE_warning, } from "./history";
import type { History, Location, Path, To } from "./history";
import { Action as HistoryAction } from "./history";
import type { AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticRouteMatch, AgnosticRouteObject, DeferredData, DetectErrorBoundaryFunction, FormEncType, HTMLFormMethod, MapRoutePropertiesFunction, RouteData, Submission } from "./utils";
import type { AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticRouteObject, DeferredData, DetectErrorBoundaryFunction, FormEncType, HTMLFormMethod, MapRoutePropertiesFunction, RouteData, Submission, UIMatch } from "./utils";
/**

@@ -19,2 +19,9 @@ * A Router instance manages all navigation and data loading/mutations

*
* Return the future config for the router
*/
get future(): FutureConfig;
/**
* @internal
* PRIVATE - DO NOT USE
*
* Return the current state of the router

@@ -34,2 +41,9 @@ */

*
* Return the window associated with the router
*/
get window(): RouterInit["window"];
/**
* @internal
* PRIVATE - DO NOT USE
*
* Initialize the router, including adding history listeners and kicking off

@@ -118,3 +132,3 @@ * initial data fetches. Returns a function to cleanup listeners and abort

*/
getFetcher<TData = any>(key?: string): Fetcher<TData>;
getFetcher<TData = any>(key: string): Fetcher<TData>;
/**

@@ -127,3 +141,3 @@ * @internal

*/
deleteFetcher(key?: string): void;
deleteFetcher(key: string): void;
/**

@@ -246,4 +260,7 @@ * @internal

export interface FutureConfig {
v7_fetcherPersist: boolean;
v7_normalizeFormMethod: boolean;
v7_partialHydration: boolean;
v7_prependBasename: boolean;
v7_relativeSplatPath: boolean;
}

@@ -295,2 +312,6 @@ /**

}
type ViewTransitionOpts = {
currentLocation: Location;
nextLocation: Location;
};
/**

@@ -300,11 +321,8 @@ * Subscriber function signature for changes to router state

export interface RouterSubscriber {
(state: RouterState): void;
(state: RouterState, opts: {
deletedFetchers: string[];
unstable_viewTransitionOpts?: ViewTransitionOpts;
unstable_flushSync: boolean;
}): void;
}
interface UseMatchesMatch {
id: string;
pathname: string;
params: AgnosticRouteMatch["params"];
data: unknown;
handle: unknown;
}
/**

@@ -315,3 +333,3 @@ * Function signature for determining the key to be used in scroll restoration

export interface GetScrollRestorationKeyFunction {
(location: Location, matches: UseMatchesMatch[]): string | null;
(location: Location, matches: UIMatch[]): string | null;
}

@@ -328,2 +346,3 @@ /**

relative?: RelativeRoutingType;
unstable_flushSync?: boolean;
};

@@ -334,2 +353,3 @@ type BaseNavigateOptions = BaseNavigateOrFetchOptions & {

fromRouteId?: string;
unstable_viewTransition?: boolean;
};

@@ -475,2 +495,9 @@ type BaseSubmissionOptions = {

export declare const UNSAFE_DEFERRED_SYMBOL: unique symbol;
/**
* Future flags to toggle new feature behavior
*/
export interface StaticHandlerFutureConfig {
v7_relativeSplatPath: boolean;
v7_throwAbortReason: boolean;
}
export interface CreateStaticHandlerOptions {

@@ -483,2 +510,3 @@ basename?: string;

mapRouteProperties?: MapRoutePropertiesFunction;
future?: Partial<StaticHandlerFutureConfig>;
}

@@ -485,0 +513,0 @@ export declare function createStaticHandler(routes: AgnosticRouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;

/**
* @remix-run/router v0.0.0-experimental-ad6954b7
* @remix-run/router v0.0.0-experimental-add6f8aa
*

@@ -11,3 +11,3 @@ * Copyright (c) Remix Software Inc.

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RemixRouter={})}(this,(function(e){"use strict";function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},t.apply(this,arguments)}let r=function(e){return e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE",e}({});const a="popstate";function o(e,t){if(!1===e||null==e)throw new Error(t)}function n(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function i(e,t){return{usr:e.state,key:e.key,idx:t}}function s(e,r,a,o){return void 0===a&&(a=null),t({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof r?c(r):r,{state:a,key:r&&r.key||o||Math.random().toString(36).substr(2,8)})}function l(e){let{pathname:t="/",search:r="",hash:a=""}=e;return r&&"?"!==r&&(t+="?"===r.charAt(0)?r:"?"+r),a&&"#"!==a&&(t+="#"===a.charAt(0)?a:"#"+a),t}function c(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substr(a),e=e.substr(0,a)),e&&(t.pathname=e)}return t}function d(e,n,c,d){void 0===d&&(d={});let{window:u=document.defaultView,v5Compat:h=!1}=d,f=u.history,p=r.Pop,m=null,y=v();function v(){return(f.state||{idx:null}).idx}function g(){p=r.Pop;let e=v(),t=null==e?null:e-y;y=e,m&&m({action:p,location:w.location,delta:t})}function b(e){let t="null"!==u.location.origin?u.location.origin:u.location.href,r="string"==typeof e?e:l(e);return o(t,"No window.location.(origin|href) available to create URL for href: "+r),new URL(r,t)}null==y&&(y=0,f.replaceState(t({},f.state,{idx:y}),""));let w={get action(){return p},get location(){return e(u,f)},listen(e){if(m)throw new Error("A history only accepts one active listener");return u.addEventListener(a,g),m=e,()=>{u.removeEventListener(a,g),m=null}},createHref:e=>n(u,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){p=r.Push;let a=s(w.location,e,t);c&&c(a,e),y=v()+1;let o=i(a,y),n=w.createHref(a);try{f.pushState(o,"",n)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;u.location.assign(n)}h&&m&&m({action:p,location:w.location,delta:1})},replace:function(e,t){p=r.Replace;let a=s(w.location,e,t);c&&c(a,e),y=v();let o=i(a,y),n=w.createHref(a);f.replaceState(o,"",n),h&&m&&m({action:p,location:w.location,delta:0})},go:e=>f.go(e)};return w}let u=function(e){return e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error",e}({});const h=new Set(["lazy","caseSensitive","path","id","index","children"]);function f(e,r,a,n){return void 0===a&&(a=[]),void 0===n&&(n={}),e.map(((e,i)=>{let s=[...a,i],l="string"==typeof e.id?e.id:s.join("-");if(o(!0!==e.index||!e.children,"Cannot specify children on an index route"),o(!n[l],'Found a route id collision on id "'+l+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let a=t({},e,r(e),{id:l});return n[l]=a,a}{let a=t({},e,r(e),{id:l,children:void 0});return n[l]=a,e.children&&(a.children=f(e.children,r,s,n)),a}}))}function p(e,t,r){void 0===r&&(r="/");let a=E(("string"==typeof t?c(t):t).pathname||"/",r);if(null==a)return null;let o=m(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){return e.length===t.length&&e.slice(0,-1).every(((e,r)=>e===t[r]))?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let n=null;for(let e=0;null==n&&e<o.length;++e)n=w(o[e],R(a));return n}function m(e,t,r,a){void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a="");let n=(e,n,i)=>{let s={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:n,route:e};s.relativePath.startsWith("/")&&(o(s.relativePath.startsWith(a),'Absolute route path "'+s.relativePath+'" nested under path "'+a+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),s.relativePath=s.relativePath.slice(a.length));let l=A([a,s.relativePath]),c=r.concat(s);e.children&&e.children.length>0&&(o(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),m(e.children,t,c,l)),(null!=e.path||e.index)&&t.push({path:l,score:b(l,e.index),routesMeta:c})};return e.forEach(((e,t)=>{var r;if(""!==e.path&&null!=(r=e.path)&&r.includes("?"))for(let r of y(e.path))n(e,t,r);else n(e,t)})),t}function y(e){let t=e.split("/");if(0===t.length)return[];let[r,...a]=t,o=r.endsWith("?"),n=r.replace(/\?$/,"");if(0===a.length)return o?[n,""]:[n];let i=y(a.join("/")),s=[];return s.push(...i.map((e=>""===e?n:[n,e].join("/")))),o&&s.push(...i),s.map((t=>e.startsWith("/")&&""===t?"/":t))}const v=/^:\w+$/,g=e=>"*"===e;function b(e,t){let r=e.split("/"),a=r.length;return r.some(g)&&(a+=-2),t&&(a+=2),r.filter((e=>!g(e))).reduce(((e,t)=>e+(v.test(t)?3:""===t?1:10)),a)}function w(e,t){let{routesMeta:r}=e,a={},o="/",n=[];for(let e=0;e<r.length;++e){let i=r[e],s=e===r.length-1,l="/"===o?t:t.slice(o.length)||"/",c=D({path:i.relativePath,caseSensitive:i.caseSensitive,end:s},l);if(!c)return null;Object.assign(a,c.params);let d=i.route;n.push({params:a,pathname:A([o,c.pathname]),pathnameBase:L(A([o,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(o=A([o,c.pathnameBase]))}return n}function D(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=function(e,t,r){void 0===t&&(t=!1);void 0===r&&(r=!0);n("*"===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(/\*$/,"/*")+'".');let a=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/\/:(\w+)/g,((e,t)=>(a.push(t),"/([^\\/]+)")));e.endsWith("*")?(a.push("*"),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))");return[new RegExp(o,t?void 0:"i"),a]}(e.path,e.caseSensitive,e.end),o=t.match(r);if(!o)return null;let i=o[0],s=i.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:a.reduce(((e,t,r)=>{if("*"===t){let e=l[r]||"";s=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1")}return e[t]=function(e,t){try{return decodeURIComponent(e)}catch(r){return n(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+r+")."),e}}(l[r]||"",t),e}),{}),pathname:i,pathnameBase:s,pattern:e}}function R(e){try{return decodeURI(e)}catch(t){return n(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function E(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&"/"!==a?null:e.slice(r)||"/"}function x(e,t){void 0===t&&(t="/");let{pathname:r,search:a="",hash:o=""}="string"==typeof e?c(e):e,n=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:n,search:j(a),hash:k(o)}}function S(e,t,r,a){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(a)+"]. Please separate it out to the `to."+r+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function P(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function M(e,r,a,n){let i;void 0===n&&(n=!1),"string"==typeof e?i=c(e):(i=t({},e),o(!i.pathname||!i.pathname.includes("?"),S("?","pathname","search",i)),o(!i.pathname||!i.pathname.includes("#"),S("#","pathname","hash",i)),o(!i.search||!i.search.includes("#"),S("#","search","hash",i)));let s,l=""===e||""===i.pathname,d=l?"/":i.pathname;if(n||null==d)s=a;else{let e=r.length-1;if(d.startsWith("..")){let t=d.split("/");for(;".."===t[0];)t.shift(),e-=1;i.pathname=t.join("/")}s=e>=0?r[e]:"/"}let u=x(i,s),h=d&&"/"!==d&&d.endsWith("/"),f=(l||"."===d)&&a.endsWith("/");return u.pathname.endsWith("/")||!h&&!f||(u.pathname+="/"),u}const A=e=>e.join("/").replace(/\/\/+/g,"/"),L=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),j=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",k=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class C extends Error{}class U{constructor(e,t){let r;this.pendingKeysSet=new Set,this.subscribers=new Set,this.deferredKeys=[],o(e&&"object"==typeof e&&!Array.isArray(e),"defer() only accepts plain objects"),this.abortPromise=new Promise(((e,t)=>r=t)),this.controller=new AbortController;let a=()=>r(new C("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",a),this.controller.signal.addEventListener("abort",a),this.data=Object.entries(e).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:this.trackPromise(r,a)})}),{}),this.done&&this.unlistenAbortSignal(),this.init=t}trackPromise(e,t){if(!(t instanceof Promise))return t;this.deferredKeys.push(e),this.pendingKeysSet.add(e);let r=Promise.race([t,this.abortPromise]).then((t=>this.onSettle(r,e,void 0,t)),(t=>this.onSettle(r,e,t)));return r.catch((()=>{})),Object.defineProperty(r,"_tracked",{get:()=>!0}),r}onSettle(e,t,r,a){if(this.controller.signal.aborted&&r instanceof C)return this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>r}),Promise.reject(r);if(this.pendingKeysSet.delete(t),this.done&&this.unlistenAbortSignal(),void 0===r&&void 0===a){let r=new Error('Deferred data for key "'+t+'" resolved/rejected with `undefined`, you must resolve/reject with a value or `null`.');return Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)}return void 0===a?(Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)):(Object.defineProperty(e,"_data",{get:()=>a}),this.emit(!1,t),a)}emit(e,t){this.subscribers.forEach((r=>r(e,t)))}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}cancel(){this.controller.abort(),this.pendingKeysSet.forEach(((e,t)=>this.pendingKeysSet.delete(t))),this.emit(!0)}async resolveData(e){let t=!1;if(!this.done){let r=()=>this.cancel();e.addEventListener("abort",r),t=await new Promise((t=>{this.subscribe((a=>{e.removeEventListener("abort",r),(a||this.done)&&t(a)}))}))}return t}get done(){return 0===this.pendingKeysSet.size}get unwrappedData(){return o(null!==this.data&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:T(a)})}),{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function T(e){if(!function(e){return e instanceof Promise&&!0===e._tracked}(e))return e;if(e._error)throw e._error;return e._data}const O=function(e,r){void 0===r&&(r=302);let a=r;"number"==typeof a?a={status:a}:void 0===a.status&&(a.status=302);let o=new Headers(a.headers);return o.set("Location",e),new Response(null,t({},a,{headers:o}))};class _{constructor(e,t,r,a){void 0===a&&(a=!1),this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function I(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}const q=["post","put","patch","delete"],z=new Set(q),H=["get",...q],B=new Set(H),F=new Set([301,302,303,307,308]),N=new Set([307,308]),W={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},$={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},K={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Y=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,J=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)});const X=Symbol("deferred");function V(e,t,r,a,o,n,i){let s,c;if(null!=n&&"path"!==i){s=[];for(let e of t)if(s.push(e),e.route.id===n){c=e;break}}else s=t,c=t[t.length-1];let d=M(o||".",P(s).map((e=>e.pathnameBase)),E(e.pathname,r)||e.pathname,"path"===i);return null==o&&(d.search=e.search,d.hash=e.hash),null!=o&&""!==o&&"."!==o||!c||!c.route.index||xe(d.search)||(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),a&&"/"!==r&&(d.pathname="/"===d.pathname?r:A([r,d.pathname])),l(d)}function G(e,t,r,a){if(!a||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(a))return{path:r};if(a.formMethod&&!we(a.formMethod))return{path:r,error:he(405,{method:a.formMethod})};let n,i,s=()=>({path:r,error:he(400,{type:"invalid-body"})}),d=a.formMethod||"get",u=e?d.toUpperCase():d.toLowerCase(),h=pe(r);if(void 0!==a.body){if("text/plain"===a.formEncType){if(!De(u))return s();let e="string"==typeof a.body?a.body:a.body instanceof FormData||a.body instanceof URLSearchParams?Array.from(a.body.entries()).reduce(((e,t)=>{let[r,a]=t;return""+e+r+"="+a+"\n"}),""):String(a.body);return{path:r,submission:{formMethod:u,formAction:h,formEncType:a.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===a.formEncType){if(!De(u))return s();try{let e="string"==typeof a.body?JSON.parse(a.body):a.body;return{path:r,submission:{formMethod:u,formAction:h,formEncType:a.formEncType,formData:void 0,json:e,text:void 0}}}catch(e){return s()}}}if(o("function"==typeof FormData,"FormData is not available in this environment"),a.formData)n=ne(a.formData),i=a.formData;else if(a.body instanceof FormData)n=ne(a.body),i=a.body;else if(a.body instanceof URLSearchParams)n=a.body,i=ie(n);else if(null==a.body)n=new URLSearchParams,i=new FormData;else try{n=new URLSearchParams(a.body),i=ie(n)}catch(e){return s()}let f={formMethod:u,formAction:h,formEncType:a&&a.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(De(f.formMethod))return{path:r,submission:f};let p=c(r);return t&&p.search&&xe(p.search)&&n.append("index",""),p.search="?"+n,{path:l(p),submission:f}}function Q(e,t){let r=e;if(t){let a=e.findIndex((e=>e.route.id===t));a>=0&&(r=e.slice(0,a))}return r}function Z(e,r,a,o,n,i,s,l,c,d,u,h,f,m){let y=m?Object.values(m)[0]:f?Object.values(f)[0]:void 0,v=e.createURL(r.location),g=e.createURL(n),b=m?Object.keys(m)[0]:void 0,w=Q(a,b).filter(((e,a)=>{if(e.route.lazy)return!0;if(null==e.route.loader)return!1;if(function(e,t,r){let a=!t||r.route.id!==t.route.id,o=void 0===e[r.route.id];return a||o}(r.loaderData,r.matches[a],e)||s.some((t=>t===e.route.id)))return!0;let n=r.matches[a],l=e;return te(e,t({currentUrl:v,currentParams:n.params,nextUrl:g,nextParams:l.params},o,{actionResult:y,defaultShouldRevalidate:i||v.pathname+v.search===g.pathname+g.search||v.search!==g.search||ee(n,l)}))})),D=[];return c.forEach(((e,n)=>{if(!a.some((t=>t.route.id===e.routeId)))return;let s=p(u,e.path,h);if(!s)return void D.push({key:n,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let c=r.fetchers.get(n),f=Se(s,e.path),m=!1;m=!d.has(n)&&(!!l.includes(n)||(c&&"idle"!==c.state&&void 0===c.data?i:te(f,t({currentUrl:v,currentParams:r.matches[r.matches.length-1].params,nextUrl:g,nextParams:a[a.length-1].params},o,{actionResult:y,defaultShouldRevalidate:i})))),m&&D.push({key:n,routeId:e.routeId,path:e.path,matches:s,match:f,controller:new AbortController})})),[w,D]}function ee(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function te(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}async function re(e,r,a){if(!e.lazy)return;let i=await e.lazy();if(!e.lazy)return;let s=a[e.id];o(s,"No route found in manifest");let l={};for(let e in i){let t=void 0!==s[e]&&"hasErrorBoundary"!==e;n(!t,'Route "'+s.id+'" has a static property "'+e+'" defined but its lazy function is also returning a value for this property. The lazy route property "'+e+'" will be ignored.'),t||h.has(e)||(l[e]=i[e])}Object.assign(s,l),Object.assign(s,t({},r(s),{lazy:void 0}))}async function ae(e,t,r,a,n,i,s,l){let c,d,h;void 0===l&&(l={});let f=e=>{let a,o=new Promise(((e,t)=>a=t));return h=()=>a(),t.signal.addEventListener("abort",h),Promise.race([e({request:t,params:r.params,context:l.requestContext}),o])};try{let a=r.route[e];if(r.route.lazy)if(a){d=(await Promise.all([f(a),re(r.route,i,n)]))[0]}else{if(await re(r.route,i,n),a=r.route[e],!a){if("action"===e){let e=new URL(t.url),a=e.pathname+e.search;throw he(405,{method:t.method,pathname:a,routeId:r.route.id})}return{type:u.data,data:void 0}}d=await f(a)}else{if(!a){let e=new URL(t.url);throw he(404,{pathname:e.pathname+e.search})}d=await f(a)}o(void 0!==d,"You defined "+("action"===e?"an action":"a loader")+' for route "'+r.route.id+"\" but didn't return anything from your `"+e+"` function. Please return a value or `null`.")}catch(e){c=u.error,d=e}finally{h&&t.signal.removeEventListener("abort",h)}if(be(d)){let e,n=d.status;if(F.has(n)){let e=d.headers.get("Location");if(o(e,"Redirects returned/thrown from loaders/actions must have a Location header"),Y.test(e)){if(!l.isStaticRequest){let r=new URL(t.url),a=e.startsWith("//")?new URL(r.protocol+e):new URL(e),o=null!=E(a.pathname,s);a.origin===r.origin&&o&&(e=a.pathname+a.search+a.hash)}}else e=V(new URL(t.url),a.slice(0,a.indexOf(r)+1),s,!0,e);if(l.isStaticRequest)throw d.headers.set("Location",e),d;return{type:u.redirect,status:n,location:e,revalidate:null!==d.headers.get("X-Remix-Revalidate"),reloadDocument:null!==d.headers.get("X-Remix-Reload-Document")}}if(l.isRouteRequest){throw{type:c===u.error?u.error:u.data,response:d}}let i=d.headers.get("Content-Type");return e=i&&/\bapplication\/json\b/.test(i)?await d.json():await d.text(),c===u.error?{type:c,error:new _(n,d.statusText,e),headers:d.headers}:{type:u.data,data:e,statusCode:d.status,headers:d.headers}}return c===u.error?{type:c,error:d}:ge(d)?{type:u.deferred,deferredData:d,statusCode:null==(p=d.init)?void 0:p.status,headers:(null==(m=d.init)?void 0:m.headers)&&new Headers(d.init.headers)}:{type:u.data,data:d};var p,m}function oe(e,t,r,a){let o=e.createURL(pe(t)).toString(),n={signal:r};if(a&&De(a.formMethod)){let{formMethod:e,formEncType:t}=a;n.method=e.toUpperCase(),"application/json"===t?(n.headers=new Headers({"Content-Type":t}),n.body=JSON.stringify(a.json)):"text/plain"===t?n.body=a.text:"application/x-www-form-urlencoded"===t&&a.formData?n.body=ne(a.formData):n.body=a.formData}return new Request(o,n)}function ne(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,"string"==typeof a?a:a.name);return t}function ie(e){let t=new FormData;for(let[r,a]of e.entries())t.append(r,a);return t}function se(e,t,r,a,n){let i,s={},l=null,c=!1,d={};return r.forEach(((r,u)=>{let h=t[u].route.id;if(o(!ve(r),"Cannot handle redirect results in processLoaderData"),ye(r)){let t=de(e,h),o=r.error;a&&(o=Object.values(a)[0],a=void 0),l=l||{},null==l[t.route.id]&&(l[t.route.id]=o),s[h]=void 0,c||(c=!0,i=I(r.error)?r.error.status:500),r.headers&&(d[h]=r.headers)}else me(r)?(n.set(h,r.deferredData),s[h]=r.deferredData.data):s[h]=r.data,null==r.statusCode||200===r.statusCode||c||(i=r.statusCode),r.headers&&(d[h]=r.headers)})),a&&(l=a,s[Object.keys(a)[0]]=void 0),{loaderData:s,errors:l,statusCode:i||200,loaderHeaders:d}}function le(e,r,a,n,i,s,l,c){let{loaderData:d,errors:u}=se(r,a,n,i,c);for(let r=0;r<s.length;r++){let{key:a,match:n,controller:i}=s[r];o(void 0!==l&&void 0!==l[r],"Did not find corresponding fetcher result");let c=l[r];if(!i||!i.signal.aborted)if(ye(c)){let r=de(e.matches,null==n?void 0:n.route.id);u&&u[r.route.id]||(u=t({},u,{[r.route.id]:c.error})),e.fetchers.delete(a)}else if(ve(c))o(!1,"Unhandled fetcher revalidation redirect");else if(me(c))o(!1,"Unhandled fetcher deferred data");else{let t=je(c.data);e.fetchers.set(a,t)}}return{loaderData:d,errors:u}}function ce(e,r,a,o){let n=t({},r);for(let t of a){let a=t.route.id;if(r.hasOwnProperty(a)?void 0!==r[a]&&(n[a]=r[a]):void 0!==e[a]&&t.route.loader&&(n[a]=e[a]),o&&o.hasOwnProperty(a))break}return n}function de(e,t){return(t?e.slice(0,e.findIndex((e=>e.route.id===t))+1):[...e]).reverse().find((e=>!0===e.route.hasErrorBoundary))||e[0]}function ue(e){let t=e.find((e=>e.index||!e.path||"/"===e.path))||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function he(e,t){let{pathname:r,routeId:a,method:o,type:n}=void 0===t?{}:t,i="Unknown Server Error",s="Unknown @remix-run/router error";return 400===e?(i="Bad Request",o&&r&&a?s="You made a "+o+' request to "'+r+'" but did not provide a `loader` for route "'+a+'", so there is no way to handle the request.':"defer-action"===n?s="defer() is not supported in actions":"invalid-body"===n&&(s="Unable to encode submission body")):403===e?(i="Forbidden",s='Route "'+a+'" does not match URL "'+r+'"'):404===e?(i="Not Found",s='No route matches URL "'+r+'"'):405===e&&(i="Method Not Allowed",o&&r&&a?s="You made a "+o.toUpperCase()+' request to "'+r+'" but did not provide an `action` for route "'+a+'", so there is no way to handle the request.':o&&(s='Invalid request method "'+o.toUpperCase()+'"')),new _(e||500,i,new Error(s),!0)}function fe(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(ve(r))return{result:r,idx:t}}}function pe(e){return l(t({},"string"==typeof e?c(e):e,{hash:""}))}function me(e){return e.type===u.deferred}function ye(e){return e.type===u.error}function ve(e){return(e&&e.type)===u.redirect}function ge(e){let t=e;return t&&"object"==typeof t&&"object"==typeof t.data&&"function"==typeof t.subscribe&&"function"==typeof t.cancel&&"function"==typeof t.resolveData}function be(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function we(e){return B.has(e.toLowerCase())}function De(e){return z.has(e.toLowerCase())}async function Re(e,t,r,a,n,i){for(let s=0;s<r.length;s++){let l=r[s],c=t[s];if(!c)continue;let d=e.find((e=>e.route.id===c.route.id)),u=null!=d&&!ee(d,c)&&void 0!==(i&&i[c.route.id]);if(me(l)&&(n||u)){let e=a[s];o(e,"Expected an AbortSignal for revalidating fetcher deferred result"),await Ee(l,e,n).then((e=>{e&&(r[s]=e||r[s])}))}}}async function Ee(e,t,r){if(void 0===r&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:u.data,data:e.deferredData.unwrappedData}}catch(e){return{type:u.error,error:e}}return{type:u.data,data:e.deferredData.data}}}function xe(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function Se(e,t){let r="string"==typeof t?c(t).search:t.search;if(e[e.length-1].route.index&&xe(r||""))return e[e.length-1];let a=P(e);return a[a.length-1]}function Pe(e){let{formMethod:t,formAction:r,formEncType:a,text:o,formData:n,json:i}=e;if(t&&r&&a)return null!=o?{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:void 0,text:o}:null!=n?{formMethod:t,formAction:r,formEncType:a,formData:n,json:void 0,text:void 0}:void 0!==i?{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:i,text:void 0}:void 0}function Me(e,t){if(t){return{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}return{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Ae(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function Le(e,t){if(e){return{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}}return{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function je(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}e.AbortedDeferredError=C,e.Action=r,e.ErrorResponse=_,e.IDLE_BLOCKER=K,e.IDLE_FETCHER=$,e.IDLE_NAVIGATION=W,e.UNSAFE_DEFERRED_SYMBOL=X,e.UNSAFE_DeferredData=U,e.UNSAFE_convertRoutesToDataRoutes=f,e.UNSAFE_getPathContributingMatches=P,e.UNSAFE_invariant=o,e.UNSAFE_warning=n,e.createBrowserHistory=function(e){return void 0===e&&(e={}),d((function(e,t){let{pathname:r,search:a,hash:o}=e.location;return s("",{pathname:r,search:a,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:l(t)}),null,e)},e.createHashHistory=function(e){return void 0===e&&(e={}),d((function(e,t){let{pathname:r="/",search:a="",hash:o=""}=c(e.location.hash.substr(1));return r.startsWith("/")||r.startsWith(".")||(r="/"+r),s("",{pathname:r,search:a,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let r=e.document.querySelector("base"),a="";if(r&&r.getAttribute("href")){let t=e.location.href,r=t.indexOf("#");a=-1===r?t:t.slice(0,r)}return a+"#"+("string"==typeof t?t:l(t))}),(function(e,t){n("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")}),e)},e.createMemoryHistory=function(e){void 0===e&&(e={});let t,{initialEntries:a=["/"],initialIndex:o,v5Compat:i=!1}=e;t=a.map(((e,t)=>m(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let d=f(null==o?t.length-1:o),u=r.Pop,h=null;function f(e){return Math.min(Math.max(e,0),t.length-1)}function p(){return t[d]}function m(e,r,a){void 0===r&&(r=null);let o=s(t?p().pathname:"/",e,r,a);return n("/"===o.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),o}function y(e){return"string"==typeof e?e:l(e)}return{get index(){return d},get action(){return u},get location(){return p()},createHref:y,createURL:e=>new URL(y(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?c(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,a){u=r.Push;let o=m(e,a);d+=1,t.splice(d,t.length,o),i&&h&&h({action:u,location:o,delta:1})},replace(e,a){u=r.Replace;let o=m(e,a);t[d]=o,i&&h&&h({action:u,location:o,delta:0})},go(e){u=r.Pop;let a=f(d+e),o=t[a];d=a,h&&h({action:u,location:o,delta:e})},listen:e=>(h=e,()=>{h=null})}},e.createPath=l,e.createRouter=function(e){const a=e.window?e.window:"undefined"!=typeof window?window:void 0,i=void 0!==a&&void 0!==a.document&&void 0!==a.document.createElement,l=!i;let c;if(o(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)c=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;c=e=>({hasErrorBoundary:t(e)})}else c=J;let d,h={},m=f(e.routes,c,void 0,h),y=e.basename||"/",v=t({v7_normalizeFormMethod:!1,v7_prependBasename:!1},e.future),g=null,b=new Set,w=null,D=null,R=null,x=null!=e.hydrationData,S=p(m,e.history.location,y),P=null;if(null==S){let t=he(404,{pathname:e.history.location.pathname}),{matches:r,route:a}=ue(m);S=r,P={[a.id]:t}}let M,A,L=!(S.some((e=>e.route.lazy))||S.some((e=>e.route.loader))&&null==e.hydrationData),j={historyAction:e.history.action,location:e.history.location,matches:S,initialized:L,navigation:W,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||P,fetchers:new Map,blockers:new Map},k=r.Pop,C=!1,U=!1,T=!1,O=[],_=[],I=new Map,q=0,z=-1,H=new Map,B=new Set,F=new Map,X=new Map,Q=new Map,ee=!1;function te(e){j=t({},j,e),b.forEach((e=>e(j)))}function re(a,o){var n,i;let s,l=null!=j.actionData&&null!=j.navigation.formMethod&&De(j.navigation.formMethod)&&"loading"===j.navigation.state&&!0!==(null==(n=a.state)?void 0:n._isRedirect);s=o.actionData?Object.keys(o.actionData).length>0?o.actionData:null:l?j.actionData:null;let c=o.loaderData?ce(j.loaderData,o.loaderData,o.matches||[],o.errors):j.loaderData,u=j.blockers;u.size>0&&(u=new Map(u),u.forEach(((e,t)=>u.set(t,K))));let h=!0===C||null!=j.navigation.formMethod&&De(j.navigation.formMethod)&&!0!==(null==(i=a.state)?void 0:i._isRedirect);d&&(m=d,d=void 0),U||k===r.Pop||(k===r.Push?e.history.push(a,a.state):k===r.Replace&&e.history.replace(a,a.state)),te(t({},o,{actionData:s,loaderData:c,historyAction:k,location:a,initialized:!0,navigation:W,revalidation:"idle",restoreScrollPosition:ze(a,o.matches||j.matches),preventScrollReset:h,blockers:u})),k=r.Pop,C=!1,U=!1,T=!1,O=[],_=[]}async function ne(a,o,n){A&&A.abort(),A=null,k=a,U=!0===(n&&n.startUninterruptedRevalidation),function(e,t){if(w&&R){let r=qe(e,t);w[r]=R()}}(j.location,j.matches),C=!0===(n&&n.preventScrollReset);let i=d||m,s=n&&n.overrideNavigation,l=p(i,o,y);if(!l){let e=he(404,{pathname:o.pathname}),{matches:t,route:r}=ue(i);return Ie(),void re(o,{matches:t,loaderData:{},errors:{[r.id]:e}})}if(j.initialized&&!T&&function(e,t){if(e.pathname!==t.pathname||e.search!==t.search)return!1;if(""===e.hash)return""!==t.hash;if(e.hash===t.hash)return!0;if(""!==t.hash)return!0;return!1}(j.location,o)&&!(n&&n.submission&&De(n.submission.formMethod)))return void re(o,{matches:l});A=new AbortController;let f,v,g=oe(e.history,o,A.signal,n&&n.submission);if(n&&n.pendingError)v={[de(l).route.id]:n.pendingError};else if(n&&n.submission&&De(n.submission.formMethod)){let e=await async function(e,t,a,o,n){void 0===n&&(n={});let i;ge(),te({navigation:Ae(t,a)});let s=Se(o,t);if(s.route.action||s.route.lazy){if(i=await ae("action",e,s,o,h,c,y),e.signal.aborted)return{shortCircuited:!0}}else i={type:u.error,error:he(405,{method:e.method,pathname:t.pathname,routeId:s.route.id})};if(ve(i)){let e;return e=n&&null!=n.replace?n.replace:i.location===j.location.pathname+j.location.search,await se(j,i,{submission:a,replace:e}),{shortCircuited:!0}}if(ye(i)){let e=de(o,s.route.id);return!0!==(n&&n.replace)&&(k=r.Push),{pendingActionData:{},pendingActionError:{[e.route.id]:i.error}}}if(me(i))throw he(400,{type:"defer-action"});return{pendingActionData:{[s.route.id]:i.data}}}(g,o,n.submission,l,{replace:n.replace});if(e.shortCircuited)return;f=e.pendingActionData,v=e.pendingActionError,s=Me(o,n.submission),g=new Request(g.url,{signal:g.signal})}let{shortCircuited:b,loaderData:D,errors:E}=await async function(r,a,o,n,i,s,l,c,u){let h=n||Me(a,i),f=i||s||Pe(h),p=d||m,[v,g]=Z(e.history,j,o,f,a,T,O,_,F,B,p,y,c,u);if(Ie((e=>!(o&&o.some((t=>t.route.id===e)))||v&&v.some((t=>t.route.id===e)))),z=++q,0===v.length&&0===g.length){let e=Ce();return re(a,t({matches:o,loaderData:{},errors:u||null},c?{actionData:c}:{},e?{fetchers:new Map(j.fetchers)}:{})),{shortCircuited:!0}}if(!U){g.forEach((e=>{let t=j.fetchers.get(e.key),r=Le(void 0,t?t.data:void 0);j.fetchers.set(e.key,r)}));let e=c||j.actionData;te(t({navigation:h},e?0===Object.keys(e).length?{actionData:null}:{actionData:e}:{},g.length>0?{fetchers:new Map(j.fetchers)}:{}))}g.forEach((e=>{I.has(e.key)&&xe(e.key),e.controller&&I.set(e.key,e.controller)}));let b=()=>g.forEach((e=>xe(e.key)));A&&A.signal.addEventListener("abort",b);let{results:w,loaderResults:D,fetcherResults:R}=await pe(j.matches,o,v,g,r);if(r.signal.aborted)return{shortCircuited:!0};A&&A.signal.removeEventListener("abort",b);g.forEach((e=>I.delete(e.key)));let E=fe(w);if(E){if(E.idx>=v.length){let e=g[E.idx-v.length].key;B.add(e)}return await se(j,E.result,{replace:l}),{shortCircuited:!0}}let{loaderData:x,errors:S}=le(j,o,v,D,u,g,R,X);X.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&X.delete(t)}))}));let P=Ce(),M=Ue(z),L=P||M||g.length>0;return t({loaderData:x,errors:S},L?{fetchers:new Map(j.fetchers)}:{})}(g,o,l,s,n&&n.submission,n&&n.fetcherSubmission,n&&n.replace,f,v);b||(A=null,re(o,t({matches:l},f?{actionData:f}:{},{loaderData:D,errors:E})))}function ie(e){return j.fetchers.get(e)||$}async function se(n,l,c){let{submission:d,fetcherSubmission:u,replace:h}=void 0===c?{}:c;l.revalidate&&(T=!0);let f=s(n.location,l.location,{_isRedirect:!0});if(o(f,"Expected a location on the redirect navigation"),i){let t=!1;if(l.reloadDocument)t=!0;else if(Y.test(l.location)){const r=e.history.createURL(l.location);t=r.origin!==a.location.origin||null==E(r.pathname,y)}if(t)return void(h?a.location.replace(l.location):a.location.assign(l.location))}A=null;let p=!0===h?r.Replace:r.Push,{formMethod:m,formAction:v,formEncType:g}=n.navigation;!d&&!u&&m&&v&&g&&(d=Pe(n.navigation));let b=d||u;if(N.has(l.status)&&b&&De(b.formMethod))await ne(p,f,{submission:t({},b,{formAction:l.location}),preventScrollReset:C});else{let e=Me(f,d);await ne(p,f,{overrideNavigation:e,fetcherSubmission:u,preventScrollReset:C})}}async function pe(t,r,a,o,n){let i=await Promise.all([...a.map((e=>ae("loader",n,e,r,h,c,y))),...o.map((t=>{if(t.matches&&t.match&&t.controller)return ae("loader",oe(e.history,t.path,t.controller.signal),t.match,t.matches,h,c,y);return{type:u.error,error:he(404,{pathname:t.path})}}))]),s=i.slice(0,a.length),l=i.slice(a.length);return await Promise.all([Re(t,a,s,s.map((()=>n.signal)),!1,j.loaderData),Re(t,o.map((e=>e.match)),l,o.map((e=>e.controller?e.controller.signal:null)),!0)]),{results:i,loaderResults:s,fetcherResults:l}}function ge(){T=!0,O.push(...Ie()),F.forEach(((e,t)=>{I.has(t)&&(_.push(t),xe(t))}))}function be(e,t,r){let a=de(j.matches,t);we(e),te({errors:{[a.route.id]:r},fetchers:new Map(j.fetchers)})}function we(e){let t=j.fetchers.get(e);!I.has(e)||t&&"loading"===t.state&&H.has(e)||xe(e),F.delete(e),H.delete(e),B.delete(e),j.fetchers.delete(e)}function xe(e){let t=I.get(e);o(t,"Expected fetch controller: "+e),t.abort(),I.delete(e)}function ke(e){for(let t of e){let e=je(ie(t).data);j.fetchers.set(t,e)}}function Ce(){let e=[],t=!1;for(let r of B){let a=j.fetchers.get(r);o(a,"Expected fetcher: "+r),"loading"===a.state&&(B.delete(r),e.push(r),t=!0)}return ke(e),t}function Ue(e){let t=[];for(let[r,a]of H)if(a<e){let e=j.fetchers.get(r);o(e,"Expected fetcher: "+r),"loading"===e.state&&(xe(r),H.delete(r),t.push(r))}return ke(t),t.length>0}function Te(e){j.blockers.delete(e),Q.delete(e)}function Oe(e,t){let r=j.blockers.get(e)||K;o("unblocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"proceeding"===t.state||"blocked"===r.state&&"unblocked"===t.state||"proceeding"===r.state&&"unblocked"===t.state,"Invalid blocker state transition: "+r.state+" -> "+t.state);let a=new Map(j.blockers);a.set(e,t),te({blockers:a})}function _e(e){let{currentLocation:t,nextLocation:r,historyAction:a}=e;if(0===Q.size)return;Q.size>1&&n(!1,"A router only supports one blocker at a time");let o=Array.from(Q.entries()),[i,s]=o[o.length-1],l=j.blockers.get(i);return l&&"proceeding"===l.state?void 0:s({currentLocation:t,nextLocation:r,historyAction:a})?i:void 0}function Ie(e){let t=[];return X.forEach(((r,a)=>{e&&!e(a)||(r.cancel(),t.push(a),X.delete(a))})),t}function qe(e,t){if(D){return D(e,t.map((e=>function(e,t){let{route:r,pathname:a,params:o}=e;return{id:r.id,pathname:a,params:o,data:t[r.id],handle:r.handle}}(e,j.loaderData))))||e.key}return e.key}function ze(e,t){if(w){let r=qe(e,t),a=w[r];if("number"==typeof a)return a}return null}return M={get basename(){return y},get state(){return j},get routes(){return m},initialize:function(){return g=e.history.listen((t=>{let{action:r,location:a,delta:o}=t;if(ee)return void(ee=!1);n(0===Q.size||null!=o,"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.");let i=_e({currentLocation:j.location,nextLocation:a,historyAction:r});return i&&null!=o?(ee=!0,e.history.go(-1*o),void Oe(i,{state:"blocked",location:a,proceed(){Oe(i,{state:"proceeding",proceed:void 0,reset:void 0,location:a}),e.history.go(o)},reset(){let e=new Map(j.blockers);e.set(i,K),te({blockers:e})}})):ne(r,a)})),j.initialized||ne(r.Pop,j.location),M},subscribe:function(e){return b.add(e),()=>b.delete(e)},enableScrollRestoration:function(e,t,r){if(w=e,R=t,D=r||null,!x&&j.navigation===W){x=!0;let e=ze(j.location,j.matches);null!=e&&te({restoreScrollPosition:e})}return()=>{w=null,R=null,D=null}},navigate:async function a(o,n){if("number"==typeof o)return void e.history.go(o);let i=V(j.location,j.matches,y,v.v7_prependBasename,o,null==n?void 0:n.fromRouteId,null==n?void 0:n.relative),{path:l,submission:c,error:d}=G(v.v7_normalizeFormMethod,!1,i,n),u=j.location,h=s(j.location,l,n&&n.state);h=t({},h,e.history.encodeLocation(h));let f=n&&null!=n.replace?n.replace:void 0,p=r.Push;!0===f?p=r.Replace:!1===f||null!=c&&De(c.formMethod)&&c.formAction===j.location.pathname+j.location.search&&(p=r.Replace);let m=n&&"preventScrollReset"in n?!0===n.preventScrollReset:void 0,g=_e({currentLocation:u,nextLocation:h,historyAction:p});if(!g)return await ne(p,h,{submission:c,pendingError:d,preventScrollReset:m,replace:n&&n.replace});Oe(g,{state:"blocked",location:h,proceed(){Oe(g,{state:"proceeding",proceed:void 0,reset:void 0,location:h}),a(o,n)},reset(){let e=new Map(j.blockers);e.set(g,K),te({blockers:e})}})},fetch:function(r,a,n,i){if(l)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");I.has(r)&&xe(r);let s=d||m,u=V(j.location,j.matches,y,v.v7_prependBasename,n,a,null==i?void 0:i.relative),f=p(s,u,y);if(!f)return void be(r,a,he(404,{pathname:u}));let{path:g,submission:b,error:w}=G(v.v7_normalizeFormMethod,!0,u,i);if(w)return void be(r,a,w);let D=Se(f,g);C=!0===(i&&i.preventScrollReset),b&&De(b.formMethod)?async function(r,a,n,i,s,l){if(ge(),F.delete(r),!i.route.action&&!i.route.lazy){let e=he(405,{method:l.formMethod,pathname:n,routeId:a});return void be(r,a,e)}let u=j.fetchers.get(r),f=function(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}(l,u);j.fetchers.set(r,f),te({fetchers:new Map(j.fetchers)});let v=new AbortController,g=oe(e.history,n,v.signal,l);I.set(r,v);let b=q,w=await ae("action",g,i,s,h,c,y);if(g.signal.aborted)return void(I.get(r)===v&&I.delete(r));if(ve(w)){if(I.delete(r),z>b){let e=je(void 0);return j.fetchers.set(r,e),void te({fetchers:new Map(j.fetchers)})}{B.add(r);let e=Le(l);return j.fetchers.set(r,e),te({fetchers:new Map(j.fetchers)}),se(j,w,{fetcherSubmission:l})}}if(ye(w))return void be(r,a,w.error);if(me(w))throw he(400,{type:"defer-action"});let D=j.navigation.location||j.location,R=oe(e.history,D,v.signal),E=d||m,x="idle"!==j.navigation.state?p(E,j.navigation.location,y):j.matches;o(x,"Didn't find any matches after fetcher action");let S=++q;H.set(r,S);let P=Le(l,w.data);j.fetchers.set(r,P);let[M,L]=Z(e.history,j,x,l,D,T,O,_,F,B,E,y,{[i.route.id]:w.data},void 0);L.filter((e=>e.key!==r)).forEach((e=>{let t=e.key,r=j.fetchers.get(t),a=Le(void 0,r?r.data:void 0);j.fetchers.set(t,a),I.has(t)&&xe(t),e.controller&&I.set(t,e.controller)})),te({fetchers:new Map(j.fetchers)});let C=()=>L.forEach((e=>xe(e.key)));v.signal.addEventListener("abort",C);let{results:U,loaderResults:N,fetcherResults:W}=await pe(j.matches,x,M,L,R);if(v.signal.aborted)return;v.signal.removeEventListener("abort",C),H.delete(r),I.delete(r),L.forEach((e=>I.delete(e.key)));let $=fe(U);if($){if($.idx>=M.length){let e=L[$.idx-M.length].key;B.add(e)}return se(j,$.result)}let{loaderData:K,errors:Y}=le(j,j.matches,M,N,void 0,L,W,X);if(j.fetchers.has(r)){let e=je(w.data);j.fetchers.set(r,e)}let J=Ue(S);"loading"===j.navigation.state&&S>z?(o(k,"Expected pending action"),A&&A.abort(),re(j.navigation.location,{matches:x,loaderData:K,errors:Y,fetchers:new Map(j.fetchers)})):(te(t({errors:Y,loaderData:ce(j.loaderData,K,x,Y)},J||L.length>0?{fetchers:new Map(j.fetchers)}:{})),T=!1)}(r,a,g,D,f,b):(F.set(r,{routeId:a,path:g}),async function(t,r,a,n,i,s){let l=j.fetchers.get(t),d=Le(s,l?l.data:void 0);j.fetchers.set(t,d),te({fetchers:new Map(j.fetchers)});let u=new AbortController,f=oe(e.history,a,u.signal);I.set(t,u);let p=q,m=await ae("loader",f,n,i,h,c,y);me(m)&&(m=await Ee(m,f.signal,!0)||m);I.get(t)===u&&I.delete(t);if(f.signal.aborted)return;if(ve(m)){if(z>p){let e=je(void 0);return j.fetchers.set(t,e),void te({fetchers:new Map(j.fetchers)})}return B.add(t),void await se(j,m)}if(ye(m)){let e=de(j.matches,r);return j.fetchers.delete(t),void te({fetchers:new Map(j.fetchers),errors:{[e.route.id]:m.error}})}o(!me(m),"Unhandled fetcher deferred data");let v=je(m.data);j.fetchers.set(t,v),te({fetchers:new Map(j.fetchers)})}(r,a,g,D,f,b))},revalidate:function(){ge(),te({revalidation:"loading"}),"submitting"!==j.navigation.state&&("idle"!==j.navigation.state?ne(k||j.historyAction,j.navigation.location,{overrideNavigation:j.navigation}):ne(j.historyAction,j.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:ie,deleteFetcher:we,dispose:function(){g&&g(),b.clear(),A&&A.abort(),j.fetchers.forEach(((e,t)=>we(t))),j.blockers.forEach(((e,t)=>Te(t)))},getBlocker:function(e,t){let r=j.blockers.get(e)||K;return Q.get(e)!==t&&Q.set(e,t),r},deleteBlocker:Te,_internalFetchControllers:I,_internalActiveDeferreds:X,_internalSetRoutes:function(e){h={},d=f(e,c,void 0,h)}},M},e.createStaticHandler=function(e,r){o(e.length>0,"You must provide a non-empty routes array to createStaticHandler");let a,n={},i=(r?r.basename:null)||"/";if(null!=r&&r.mapRouteProperties)a=r.mapRouteProperties;else if(null!=r&&r.detectErrorBoundary){let e=r.detectErrorBoundary;a=t=>({hasErrorBoundary:e(t)})}else a=J;let c=f(e,a,void 0,n);async function d(e,r,s,l,c){o(e.signal,"query()/queryRoute() requests must contain an AbortController signal");try{if(De(e.method.toLowerCase())){let o=await async function(e,r,o,s,l){let c;if(o.route.action||o.route.lazy){if(c=await ae("action",e,o,r,n,a,i,{isStaticRequest:!0,isRouteRequest:l,requestContext:s}),e.signal.aborted){throw new Error((l?"queryRoute":"query")+"() call aborted")}}else{let t=he(405,{method:e.method,pathname:new URL(e.url).pathname,routeId:o.route.id});if(l)throw t;c={type:u.error,error:t}}if(ve(c))throw new Response(null,{status:c.status,headers:{Location:c.location}});if(me(c)){let e=he(400,{type:"defer-action"});if(l)throw e;c={type:u.error,error:e}}if(l){if(ye(c))throw c.error;return{matches:[o],loaderData:{},actionData:{[o.route.id]:c.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(ye(c)){let a=de(r,o.route.id);return t({},await h(e,r,s,void 0,{[a.route.id]:c.error}),{statusCode:I(c.error)?c.error.status:500,actionData:null,actionHeaders:t({},c.headers?{[o.route.id]:c.headers}:{})})}let d=new Request(e.url,{headers:e.headers,redirect:e.redirect,signal:e.signal});return t({},await h(d,r,s),c.statusCode?{statusCode:c.statusCode}:{},{actionData:{[o.route.id]:c.data},actionHeaders:t({},c.headers?{[o.route.id]:c.headers}:{})})}(e,s,c||Se(s,r),l,null!=c);return o}let o=await h(e,s,l,c);return be(o)?o:t({},o,{actionData:null,actionHeaders:{}})}catch(e){if((d=e)&&be(d.response)&&(d.type===u.data||d.type===u.error)){if(e.type===u.error)throw e.response;return e.response}if(function(e){if(!be(e))return!1;let t=e.status,r=e.headers.get("Location");return t>=300&&t<=399&&null!=r}(e))return e;throw e}var d}async function h(e,r,o,s,l){let c=null!=s;if(c&&(null==s||!s.route.loader)&&(null==s||!s.route.lazy))throw he(400,{method:e.method,pathname:new URL(e.url).pathname,routeId:null==s?void 0:s.route.id});let d=(s?[s]:Q(r,Object.keys(l||{})[0])).filter((e=>e.route.loader||e.route.lazy));if(0===d.length)return{matches:r,loaderData:r.reduce(((e,t)=>Object.assign(e,{[t.route.id]:null})),{}),errors:l||null,statusCode:200,loaderHeaders:{},activeDeferreds:null};let u=await Promise.all([...d.map((t=>ae("loader",e,t,r,n,a,i,{isStaticRequest:!0,isRouteRequest:c,requestContext:o})))]);if(e.signal.aborted){throw new Error((c?"queryRoute":"query")+"() call aborted")}let h=new Map,f=se(r,d,u,l,h),p=new Set(d.map((e=>e.route.id)));return r.forEach((e=>{p.has(e.route.id)||(f.loaderData[e.route.id]=null)})),t({},f,{matches:r,activeDeferreds:h.size>0?Object.fromEntries(h.entries()):null})}return{dataRoutes:c,query:async function(e,r){let{requestContext:a}=void 0===r?{}:r,o=new URL(e.url),n=e.method,u=s("",l(o),null,"default"),h=p(c,u,i);if(!we(n)&&"HEAD"!==n){let e=he(405,{method:n}),{matches:t,route:r}=ue(c);return{basename:i,location:u,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(!h){let e=he(404,{pathname:u.pathname}),{matches:t,route:r}=ue(c);return{basename:i,location:u,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}let f=await d(e,u,h,a);return be(f)?f:t({location:u,basename:i},f)},queryRoute:async function(e,t){let{routeId:r,requestContext:a}=void 0===t?{}:t,o=new URL(e.url),n=e.method,u=s("",l(o),null,"default"),h=p(c,u,i);if(!we(n)&&"HEAD"!==n&&"OPTIONS"!==n)throw he(405,{method:n});if(!h)throw he(404,{pathname:u.pathname});let f=r?h.find((e=>e.route.id===r)):Se(h,u);if(r&&!f)throw he(403,{pathname:u.pathname,routeId:r});if(!f)throw he(404,{pathname:u.pathname});let m=await d(e,u,h,a,f);if(be(m))return m;let y=m.errors?Object.values(m.errors)[0]:void 0;if(void 0!==y)throw y;if(m.actionData)return Object.values(m.actionData)[0];if(m.loaderData){var v;let e=Object.values(m.loaderData)[0];return null!=(v=m.activeDeferreds)&&v[f.route.id]&&(e[X]=m.activeDeferreds[f.route.id]),e}}}},e.defer=function(e,t){return void 0===t&&(t={}),new U(e,"number"==typeof t?{status:t}:t)},e.generatePath=function(e,t){void 0===t&&(t={});let r=e;r.endsWith("*")&&"*"!==r&&!r.endsWith("/*")&&(n(!1,'Route path "'+r+'" will be treated as if it were "'+r.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+r.replace(/\*$/,"/*")+'".'),r=r.replace(/\*$/,"/*"));const a=r.startsWith("/")?"/":"",i=e=>null==e?"":"string"==typeof e?e:String(e);return a+r.split(/\/+/).map(((e,r,a)=>{if(r===a.length-1&&"*"===e){return i(t["*"])}const n=e.match(/^:(\w+)(\??)$/);if(n){const[,e,r]=n;let a=t[e];return o("?"===r||null!=a,'Missing ":'+e+'" param'),i(a)}return e.replace(/\?$/g,"")})).filter((e=>!!e)).join("/")},e.getStaticContextFromError=function(e,r,a){return t({},r,{statusCode:500,errors:{[r._deepestRenderedBoundaryId||e[0].id]:a}})},e.getToPathname=function(e){return""===e||""===e.pathname?"/":"string"==typeof e?c(e).pathname:e.pathname},e.isDeferredData=ge,e.isRouteErrorResponse=I,e.joinPaths=A,e.json=function(e,r){void 0===r&&(r={});let a="number"==typeof r?{status:r}:r,o=new Headers(a.headers);return o.has("Content-Type")||o.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify(e),t({},a,{headers:o}))},e.matchPath=D,e.matchRoutes=p,e.normalizePathname=L,e.parsePath=c,e.redirect=O,e.redirectDocument=(e,t)=>{let r=O(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r},e.resolvePath=x,e.resolveTo=M,e.stripBasename=E,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RemixRouter={})}(this,(function(e){"use strict";function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},t.apply(this,arguments)}let r=function(e){return e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE",e}({});const a="popstate";function o(e,t){if(!1===e||null==e)throw new Error(t)}function n(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function i(e,t){return{usr:e.state,key:e.key,idx:t}}function s(e,r,a,o){return void 0===a&&(a=null),t({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof r?c(r):r,{state:a,key:r&&r.key||o||Math.random().toString(36).substr(2,8)})}function l(e){let{pathname:t="/",search:r="",hash:a=""}=e;return r&&"?"!==r&&(t+="?"===r.charAt(0)?r:"?"+r),a&&"#"!==a&&(t+="#"===a.charAt(0)?a:"#"+a),t}function c(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substr(a),e=e.substr(0,a)),e&&(t.pathname=e)}return t}function d(e,n,c,d){void 0===d&&(d={});let{window:u=document.defaultView,v5Compat:h=!1}=d,f=u.history,p=r.Pop,m=null,y=v();function v(){return(f.state||{idx:null}).idx}function g(){p=r.Pop;let e=v(),t=null==e?null:e-y;y=e,m&&m({action:p,location:w.location,delta:t})}function b(e){let t="null"!==u.location.origin?u.location.origin:u.location.href,r="string"==typeof e?e:l(e);return o(t,"No window.location.(origin|href) available to create URL for href: "+r),new URL(r,t)}null==y&&(y=0,f.replaceState(t({},f.state,{idx:y}),""));let w={get action(){return p},get location(){return e(u,f)},listen(e){if(m)throw new Error("A history only accepts one active listener");return u.addEventListener(a,g),m=e,()=>{u.removeEventListener(a,g),m=null}},createHref:e=>n(u,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){p=r.Push;let a=s(w.location,e,t);c&&c(a,e),y=v()+1;let o=i(a,y),n=w.createHref(a);try{f.pushState(o,"",n)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;u.location.assign(n)}h&&m&&m({action:p,location:w.location,delta:1})},replace:function(e,t){p=r.Replace;let a=s(w.location,e,t);c&&c(a,e),y=v();let o=i(a,y),n=w.createHref(a);f.replaceState(o,"",n),h&&m&&m({action:p,location:w.location,delta:0})},go:e=>f.go(e)};return w}let u=function(e){return e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error",e}({});const h=new Set(["lazy","caseSensitive","path","id","index","children"]);function f(e,r,a,n){return void 0===a&&(a=[]),void 0===n&&(n={}),e.map(((e,i)=>{let s=[...a,i],l="string"==typeof e.id?e.id:s.join("-");if(o(!0!==e.index||!e.children,"Cannot specify children on an index route"),o(!n[l],'Found a route id collision on id "'+l+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let a=t({},e,r(e),{id:l});return n[l]=a,a}{let a=t({},e,r(e),{id:l,children:void 0});return n[l]=a,e.children&&(a.children=f(e.children,r,s,n)),a}}))}function p(e,t,r){void 0===r&&(r="/");let a=E(("string"==typeof t?c(t):t).pathname||"/",r);if(null==a)return null;let o=y(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){return e.length===t.length&&e.slice(0,-1).every(((e,r)=>e===t[r]))?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let n=null;for(let e=0;null==n&&e<o.length;++e)n=D(o[e],R(a));return n}function m(e,t){let{route:r,pathname:a,params:o}=e;return{id:r.id,pathname:a,params:o,data:t[r.id],handle:r.handle}}function y(e,t,r,a){void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a="");let n=(e,n,i)=>{let s={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:n,route:e};s.relativePath.startsWith("/")&&(o(s.relativePath.startsWith(a),'Absolute route path "'+s.relativePath+'" nested under path "'+a+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),s.relativePath=s.relativePath.slice(a.length));let l=j([a,s.relativePath]),c=r.concat(s);e.children&&e.children.length>0&&(o(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),y(e.children,t,c,l)),(null!=e.path||e.index)&&t.push({path:l,score:w(l,e.index),routesMeta:c})};return e.forEach(((e,t)=>{var r;if(""!==e.path&&null!=(r=e.path)&&r.includes("?"))for(let r of v(e.path))n(e,t,r);else n(e,t)})),t}function v(e){let t=e.split("/");if(0===t.length)return[];let[r,...a]=t,o=r.endsWith("?"),n=r.replace(/\?$/,"");if(0===a.length)return o?[n,""]:[n];let i=v(a.join("/")),s=[];return s.push(...i.map((e=>""===e?n:[n,e].join("/")))),o&&s.push(...i),s.map((t=>e.startsWith("/")&&""===t?"/":t))}const g=/^:[\w-]+$/,b=e=>"*"===e;function w(e,t){let r=e.split("/"),a=r.length;return r.some(b)&&(a+=-2),t&&(a+=2),r.filter((e=>!b(e))).reduce(((e,t)=>e+(g.test(t)?3:""===t?1:10)),a)}function D(e,t){let{routesMeta:r}=e,a={},o="/",n=[];for(let e=0;e<r.length;++e){let i=r[e],s=e===r.length-1,l="/"===o?t:t.slice(o.length)||"/",c=S({path:i.relativePath,caseSensitive:i.caseSensitive,end:s},l);if(!c)return null;Object.assign(a,c.params);let d=i.route;n.push({params:a,pathname:j([o,c.pathname]),pathnameBase:k(j([o,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(o=j([o,c.pathnameBase]))}return n}function S(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=function(e,t,r){void 0===t&&(t=!1);void 0===r&&(r=!0);n("*"===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(/\*$/,"/*")+'".');let a=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,r)=>(a.push({paramName:t,isOptional:null!=r}),r?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(a.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))");return[new RegExp(o,t?void 0:"i"),a]}(e.path,e.caseSensitive,e.end),o=t.match(r);if(!o)return null;let i=o[0],s=i.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:a.reduce(((e,t,r)=>{let{paramName:a,isOptional:o}=t;if("*"===a){let e=l[r]||"";s=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1")}const c=l[r];return e[a]=o&&!c?void 0:function(e,t){try{return decodeURIComponent(e)}catch(r){return n(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+r+")."),e}}(c||"",a),e}),{}),pathname:i,pathnameBase:s,pattern:e}}function R(e){try{return decodeURI(e)}catch(t){return n(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function E(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&"/"!==a?null:e.slice(r)||"/"}function P(e,t){void 0===t&&(t="/");let{pathname:r,search:a="",hash:o=""}="string"==typeof e?c(e):e,n=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:n,search:_(a),hash:T(o)}}function x(e,t,r,a){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(a)+"]. Please separate it out to the `to."+r+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function A(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function L(e,t){let r=A(e);return t?r.map(((t,r)=>r===e.length-1?t.pathname:t.pathnameBase)):r.map((e=>e.pathnameBase))}function M(e,r,a,n){let i;void 0===n&&(n=!1),"string"==typeof e?i=c(e):(i=t({},e),o(!i.pathname||!i.pathname.includes("?"),x("?","pathname","search",i)),o(!i.pathname||!i.pathname.includes("#"),x("#","pathname","hash",i)),o(!i.search||!i.search.includes("#"),x("#","search","hash",i)));let s,l=""===e||""===i.pathname,d=l?"/":i.pathname;if(null==d)s=a;else{let e=r.length-1;if(!n&&d.startsWith("..")){let t=d.split("/");for(;".."===t[0];)t.shift(),e-=1;i.pathname=t.join("/")}s=e>=0?r[e]:"/"}let u=P(i,s),h=d&&"/"!==d&&d.endsWith("/"),f=(l||"."===d)&&a.endsWith("/");return u.pathname.endsWith("/")||!h&&!f||(u.pathname+="/"),u}const j=e=>e.join("/").replace(/\/\/+/g,"/"),k=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),_=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",T=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class C extends Error{}class U{constructor(e,t){let r;this.pendingKeysSet=new Set,this.subscribers=new Set,this.deferredKeys=[],o(e&&"object"==typeof e&&!Array.isArray(e),"defer() only accepts plain objects"),this.abortPromise=new Promise(((e,t)=>r=t)),this.controller=new AbortController;let a=()=>r(new C("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",a),this.controller.signal.addEventListener("abort",a),this.data=Object.entries(e).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:this.trackPromise(r,a)})}),{}),this.done&&this.unlistenAbortSignal(),this.init=t}trackPromise(e,t){if(!(t instanceof Promise))return t;this.deferredKeys.push(e),this.pendingKeysSet.add(e);let r=Promise.race([t,this.abortPromise]).then((t=>this.onSettle(r,e,void 0,t)),(t=>this.onSettle(r,e,t)));return r.catch((()=>{})),Object.defineProperty(r,"_tracked",{get:()=>!0}),r}onSettle(e,t,r,a){if(this.controller.signal.aborted&&r instanceof C)return this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>r}),Promise.reject(r);if(this.pendingKeysSet.delete(t),this.done&&this.unlistenAbortSignal(),void 0===r&&void 0===a){let r=new Error('Deferred data for key "'+t+'" resolved/rejected with `undefined`, you must resolve/reject with a value or `null`.');return Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)}return void 0===a?(Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)):(Object.defineProperty(e,"_data",{get:()=>a}),this.emit(!1,t),a)}emit(e,t){this.subscribers.forEach((r=>r(e,t)))}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}cancel(){this.controller.abort(),this.pendingKeysSet.forEach(((e,t)=>this.pendingKeysSet.delete(t))),this.emit(!0)}async resolveData(e){let t=!1;if(!this.done){let r=()=>this.cancel();e.addEventListener("abort",r),t=await new Promise((t=>{this.subscribe((a=>{e.removeEventListener("abort",r),(a||this.done)&&t(a)}))}))}return t}get done(){return 0===this.pendingKeysSet.size}get unwrappedData(){return o(null!==this.data&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:O(a)})}),{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function O(e){if(!function(e){return e instanceof Promise&&!0===e._tracked}(e))return e;if(e._error)throw e._error;return e._data}const H=function(e,r){void 0===r&&(r=302);let a=r;"number"==typeof a?a={status:a}:void 0===a.status&&(a.status=302);let o=new Headers(a.headers);return o.set("Location",e),new Response(null,t({},a,{headers:o}))};class I{constructor(e,t,r,a){void 0===a&&(a=!1),this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function z(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}const q=["post","put","patch","delete"],B=new Set(q),N=["get",...q],F=new Set(N),W=new Set([301,302,303,307,308]),$=new Set([307,308]),K={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},J={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Y={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},V=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,X=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),G="remix-router-transitions";const Q=Symbol("deferred");function Z(e,t,r){if(r.v7_throwAbortReason&&void 0!==e.signal.reason)throw e.signal.reason;throw new Error((t?"queryRoute":"query")+"() call aborted: "+e.method+" "+e.url)}function ee(e,t,r,a,o,n,i,s){let c,d;if(i){c=[];for(let e of t)if(c.push(e),e.route.id===i){d=e;break}}else c=t,d=t[t.length-1];let u=M(o||".",L(c,n),E(e.pathname,r)||e.pathname,"path"===s);return null==o&&(u.search=e.search,u.hash=e.hash),null!=o&&""!==o&&"."!==o||!d||!d.route.index||Le(u.search)||(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),a&&"/"!==r&&(u.pathname="/"===u.pathname?r:j([r,u.pathname])),l(u)}function te(e,t,r,a){if(!a||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(a))return{path:r};if(a.formMethod&&!Ee(a.formMethod))return{path:r,error:ye(405,{method:a.formMethod})};let n,i,s=()=>({path:r,error:ye(400,{type:"invalid-body"})}),d=a.formMethod||"get",u=e?d.toUpperCase():d.toLowerCase(),h=ge(r);if(void 0!==a.body){if("text/plain"===a.formEncType){if(!Pe(u))return s();let e="string"==typeof a.body?a.body:a.body instanceof FormData||a.body instanceof URLSearchParams?Array.from(a.body.entries()).reduce(((e,t)=>{let[r,a]=t;return""+e+r+"="+a+"\n"}),""):String(a.body);return{path:r,submission:{formMethod:u,formAction:h,formEncType:a.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===a.formEncType){if(!Pe(u))return s();try{let e="string"==typeof a.body?JSON.parse(a.body):a.body;return{path:r,submission:{formMethod:u,formAction:h,formEncType:a.formEncType,formData:void 0,json:e,text:void 0}}}catch(e){return s()}}}if(o("function"==typeof FormData,"FormData is not available in this environment"),a.formData)n=ce(a.formData),i=a.formData;else if(a.body instanceof FormData)n=ce(a.body),i=a.body;else if(a.body instanceof URLSearchParams)n=a.body,i=de(n);else if(null==a.body)n=new URLSearchParams,i=new FormData;else try{n=new URLSearchParams(a.body),i=de(n)}catch(e){return s()}let f={formMethod:u,formAction:h,formEncType:a&&a.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(Pe(f.formMethod))return{path:r,submission:f};let p=c(r);return t&&p.search&&Le(p.search)&&n.append("index",""),p.search="?"+n,{path:l(p),submission:f}}function re(e,t){let r=e;if(t){let a=e.findIndex((e=>e.route.id===t));a>=0&&(r=e.slice(0,a))}return r}function ae(e,r,a,o,n,i,s,l,c,d,u,h,f,m,y,v){let g=v?Object.values(v)[0]:y?Object.values(y)[0]:void 0,b=e.createURL(r.location),w=e.createURL(n),D=v?Object.keys(v)[0]:void 0,S=re(a,D).filter(((e,a)=>{let{route:n}=e;if(n.lazy)return!0;if(null==n.loader)return!1;if(i)return!!n.loader.hydrate||void 0===r.loaderData[n.id]&&(!r.errors||void 0===r.errors[n.id]);if(function(e,t,r){let a=!t||r.route.id!==t.route.id,o=void 0===e[r.route.id];return a||o}(r.loaderData,r.matches[a],e)||l.some((t=>t===e.route.id)))return!0;let c=r.matches[a],d=e;return ne(e,t({currentUrl:b,currentParams:c.params,nextUrl:w,nextParams:d.params},o,{actionResult:g,defaultShouldRevalidate:s||b.pathname+b.search===w.pathname+w.search||b.search!==w.search||oe(c,d)}))})),R=[];return u.forEach(((e,n)=>{if(i||!a.some((t=>t.route.id===e.routeId))||d.has(n))return;let l=p(f,e.path,m);if(!l)return void R.push({key:n,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let u=r.fetchers.get(n),y=Me(l,e.path),v=!1;v=!h.has(n)&&(!!c.includes(n)||(u&&"idle"!==u.state&&void 0===u.data?s:ne(y,t({currentUrl:b,currentParams:r.matches[r.matches.length-1].params,nextUrl:w,nextParams:a[a.length-1].params},o,{actionResult:g,defaultShouldRevalidate:s})))),v&&R.push({key:n,routeId:e.routeId,path:e.path,matches:l,match:y,controller:new AbortController})})),[S,R]}function oe(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function ne(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}async function ie(e,r,a){if(!e.lazy)return;let i=await e.lazy();if(!e.lazy)return;let s=a[e.id];o(s,"No route found in manifest");let l={};for(let e in i){let t=void 0!==s[e]&&"hasErrorBoundary"!==e;n(!t,'Route "'+s.id+'" has a static property "'+e+'" defined but its lazy function is also returning a value for this property. The lazy route property "'+e+'" will be ignored.'),t||h.has(e)||(l[e]=i[e])}Object.assign(s,l),Object.assign(s,t({},r(s),{lazy:void 0}))}async function se(e,t,r,a,n,i,s,l,c){let d,h,f;void 0===c&&(c={});let p=e=>{let a,o=new Promise(((e,t)=>a=t));return f=()=>a(),t.signal.addEventListener("abort",f),Promise.race([e({request:t,params:r.params,context:c.requestContext}),o])};try{let a=r.route[e];if(r.route.lazy)if(a){let e,t=await Promise.all([p(a).catch((t=>{e=t})),ie(r.route,i,n)]);if(e)throw e;h=t[0]}else{if(await ie(r.route,i,n),a=r.route[e],!a){if("action"===e){let e=new URL(t.url),a=e.pathname+e.search;throw ye(405,{method:t.method,pathname:a,routeId:r.route.id})}return{type:u.data,data:void 0}}h=await p(a)}else{if(!a){let e=new URL(t.url);throw ye(404,{pathname:e.pathname+e.search})}h=await p(a)}o(void 0!==h,"You defined "+("action"===e?"an action":"a loader")+' for route "'+r.route.id+"\" but didn't return anything from your `"+e+"` function. Please return a value or `null`.")}catch(e){d=u.error,h=e}finally{f&&t.signal.removeEventListener("abort",f)}if(Re(h)){let e,n=h.status;if(W.has(n)){let e=h.headers.get("Location");if(o(e,"Redirects returned/thrown from loaders/actions must have a Location header"),V.test(e)){if(!c.isStaticRequest){let r=new URL(t.url),a=e.startsWith("//")?new URL(r.protocol+e):new URL(e),o=null!=E(a.pathname,s);a.origin===r.origin&&o&&(e=a.pathname+a.search+a.hash)}}else e=ee(new URL(t.url),a.slice(0,a.indexOf(r)+1),s,!0,e,l);if(c.isStaticRequest)throw h.headers.set("Location",e),h;return{type:u.redirect,status:n,location:e,revalidate:null!==h.headers.get("X-Remix-Revalidate"),reloadDocument:null!==h.headers.get("X-Remix-Reload-Document")}}if(c.isRouteRequest){throw{type:d===u.error?u.error:u.data,response:h}}try{let t=h.headers.get("Content-Type");e=t&&/\bapplication\/json\b/.test(t)?null==h.body?null:await h.json():await h.text()}catch(e){return{type:u.error,error:e}}return d===u.error?{type:d,error:new I(n,h.statusText,e),headers:h.headers}:{type:u.data,data:e,statusCode:h.status,headers:h.headers}}return d===u.error?{type:d,error:h}:Se(h)?{type:u.deferred,deferredData:h,statusCode:null==(m=h.init)?void 0:m.status,headers:(null==(y=h.init)?void 0:y.headers)&&new Headers(h.init.headers)}:{type:u.data,data:h};var m,y}function le(e,t,r,a){let o=e.createURL(ge(t)).toString(),n={signal:r};if(a&&Pe(a.formMethod)){let{formMethod:e,formEncType:t}=a;n.method=e.toUpperCase(),"application/json"===t?(n.headers=new Headers({"Content-Type":t}),n.body=JSON.stringify(a.json)):"text/plain"===t?n.body=a.text:"application/x-www-form-urlencoded"===t&&a.formData?n.body=ce(a.formData):n.body=a.formData}return new Request(o,n)}function ce(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,"string"==typeof a?a:a.name);return t}function de(e){let t=new FormData;for(let[r,a]of e.entries())t.append(r,a);return t}function ue(e,t,r,a,n){let i,s={},l=null,c=!1,d={};return r.forEach(((r,u)=>{let h=t[u].route.id;if(o(!De(r),"Cannot handle redirect results in processLoaderData"),we(r)){let t=pe(e,h),o=r.error;a&&(o=Object.values(a)[0],a=void 0),l=l||{},null==l[t.route.id]&&(l[t.route.id]=o),s[h]=void 0,c||(c=!0,i=z(r.error)?r.error.status:500),r.headers&&(d[h]=r.headers)}else be(r)?(n.set(h,r.deferredData),s[h]=r.deferredData.data):s[h]=r.data,null==r.statusCode||200===r.statusCode||c||(i=r.statusCode),r.headers&&(d[h]=r.headers)})),a&&(l=a,s[Object.keys(a)[0]]=void 0),{loaderData:s,errors:l,statusCode:i||200,loaderHeaders:d}}function he(e,r,a,n,i,s,l,c){let{loaderData:d,errors:u}=ue(r,a,n,i,c);for(let r=0;r<s.length;r++){let{key:a,match:n,controller:i}=s[r];o(void 0!==l&&void 0!==l[r],"Did not find corresponding fetcher result");let c=l[r];if(!i||!i.signal.aborted)if(we(c)){let r=pe(e.matches,null==n?void 0:n.route.id);u&&u[r.route.id]||(u=t({},u,{[r.route.id]:c.error})),e.fetchers.delete(a)}else if(De(c))o(!1,"Unhandled fetcher revalidation redirect");else if(be(c))o(!1,"Unhandled fetcher deferred data");else{let t=Ce(c.data);e.fetchers.set(a,t)}}return{loaderData:d,errors:u}}function fe(e,r,a,o){let n=t({},r);for(let t of a){let a=t.route.id;if(r.hasOwnProperty(a)?void 0!==r[a]&&(n[a]=r[a]):void 0!==e[a]&&t.route.loader&&(n[a]=e[a]),o&&o.hasOwnProperty(a))break}return n}function pe(e,t){return(t?e.slice(0,e.findIndex((e=>e.route.id===t))+1):[...e]).reverse().find((e=>!0===e.route.hasErrorBoundary))||e[0]}function me(e){let t=1===e.length?e[0]:e.find((e=>e.index||!e.path||"/"===e.path))||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function ye(e,t){let{pathname:r,routeId:a,method:o,type:n}=void 0===t?{}:t,i="Unknown Server Error",s="Unknown @remix-run/router error";return 400===e?(i="Bad Request",o&&r&&a?s="You made a "+o+' request to "'+r+'" but did not provide a `loader` for route "'+a+'", so there is no way to handle the request.':"defer-action"===n?s="defer() is not supported in actions":"invalid-body"===n&&(s="Unable to encode submission body")):403===e?(i="Forbidden",s='Route "'+a+'" does not match URL "'+r+'"'):404===e?(i="Not Found",s='No route matches URL "'+r+'"'):405===e&&(i="Method Not Allowed",o&&r&&a?s="You made a "+o.toUpperCase()+' request to "'+r+'" but did not provide an `action` for route "'+a+'", so there is no way to handle the request.':o&&(s='Invalid request method "'+o.toUpperCase()+'"')),new I(e||500,i,new Error(s),!0)}function ve(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(De(r))return{result:r,idx:t}}}function ge(e){return l(t({},"string"==typeof e?c(e):e,{hash:""}))}function be(e){return e.type===u.deferred}function we(e){return e.type===u.error}function De(e){return(e&&e.type)===u.redirect}function Se(e){let t=e;return t&&"object"==typeof t&&"object"==typeof t.data&&"function"==typeof t.subscribe&&"function"==typeof t.cancel&&"function"==typeof t.resolveData}function Re(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function Ee(e){return F.has(e.toLowerCase())}function Pe(e){return B.has(e.toLowerCase())}async function xe(e,t,r,a,n,i){for(let s=0;s<r.length;s++){let l=r[s],c=t[s];if(!c)continue;let d=e.find((e=>e.route.id===c.route.id)),u=null!=d&&!oe(d,c)&&void 0!==(i&&i[c.route.id]);if(be(l)&&(n||u)){let e=a[s];o(e,"Expected an AbortSignal for revalidating fetcher deferred result"),await Ae(l,e,n).then((e=>{e&&(r[s]=e||r[s])}))}}}async function Ae(e,t,r){if(void 0===r&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:u.data,data:e.deferredData.unwrappedData}}catch(e){return{type:u.error,error:e}}return{type:u.data,data:e.deferredData.data}}}function Le(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function Me(e,t){let r="string"==typeof t?c(t).search:t.search;if(e[e.length-1].route.index&&Le(r||""))return e[e.length-1];let a=A(e);return a[a.length-1]}function je(e){let{formMethod:t,formAction:r,formEncType:a,text:o,formData:n,json:i}=e;if(t&&r&&a)return null!=o?{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:void 0,text:o}:null!=n?{formMethod:t,formAction:r,formEncType:a,formData:n,json:void 0,text:void 0}:void 0!==i?{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:i,text:void 0}:void 0}function ke(e,t){if(t){return{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}return{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function _e(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function Te(e,t){if(e){return{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}}return{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Ce(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}e.AbortedDeferredError=C,e.Action=r,e.IDLE_BLOCKER=Y,e.IDLE_FETCHER=J,e.IDLE_NAVIGATION=K,e.UNSAFE_DEFERRED_SYMBOL=Q,e.UNSAFE_DeferredData=U,e.UNSAFE_ErrorResponseImpl=I,e.UNSAFE_convertRouteMatchToUiMatch=m,e.UNSAFE_convertRoutesToDataRoutes=f,e.UNSAFE_getResolveToMatches=L,e.UNSAFE_invariant=o,e.UNSAFE_warning=n,e.createBrowserHistory=function(e){return void 0===e&&(e={}),d((function(e,t){let{pathname:r,search:a,hash:o}=e.location;return s("",{pathname:r,search:a,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:l(t)}),null,e)},e.createHashHistory=function(e){return void 0===e&&(e={}),d((function(e,t){let{pathname:r="/",search:a="",hash:o=""}=c(e.location.hash.substr(1));return r.startsWith("/")||r.startsWith(".")||(r="/"+r),s("",{pathname:r,search:a,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let r=e.document.querySelector("base"),a="";if(r&&r.getAttribute("href")){let t=e.location.href,r=t.indexOf("#");a=-1===r?t:t.slice(0,r)}return a+"#"+("string"==typeof t?t:l(t))}),(function(e,t){n("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")}),e)},e.createMemoryHistory=function(e){void 0===e&&(e={});let t,{initialEntries:a=["/"],initialIndex:o,v5Compat:i=!1}=e;t=a.map(((e,t)=>m(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let d=f(null==o?t.length-1:o),u=r.Pop,h=null;function f(e){return Math.min(Math.max(e,0),t.length-1)}function p(){return t[d]}function m(e,r,a){void 0===r&&(r=null);let o=s(t?p().pathname:"/",e,r,a);return n("/"===o.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),o}function y(e){return"string"==typeof e?e:l(e)}return{get index(){return d},get action(){return u},get location(){return p()},createHref:y,createURL:e=>new URL(y(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?c(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,a){u=r.Push;let o=m(e,a);d+=1,t.splice(d,t.length,o),i&&h&&h({action:u,location:o,delta:1})},replace(e,a){u=r.Replace;let o=m(e,a);t[d]=o,i&&h&&h({action:u,location:o,delta:0})},go(e){u=r.Pop;let a=f(d+e),o=t[a];d=a,h&&h({action:u,location:o,delta:e})},listen:e=>(h=e,()=>{h=null})}},e.createPath=l,e.createRouter=function(e){const a=e.window?e.window:"undefined"!=typeof window?window:void 0,i=void 0!==a&&void 0!==a.document&&void 0!==a.document.createElement,l=!i;let c;if(o(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)c=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;c=e=>({hasErrorBoundary:t(e)})}else c=X;let d,h,y={},v=f(e.routes,c,void 0,y),g=e.basename||"/",b=t({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1},e.future),w=null,D=new Set,S=null,R=null,P=null,x=null!=e.hydrationData,A=p(v,e.history.location,g),L=null;if(null==A){let t=ye(404,{pathname:e.history.location.pathname}),{matches:r,route:a}=me(v);A=r,L={[a.id]:t}}let M,j=A.some((e=>e.route.lazy)),k=A.some((e=>e.route.loader));if(j)h=!1;else if(k)if(b.v7_partialHydration){let t=e.hydrationData?e.hydrationData.loaderData:null,r=e.hydrationData?e.hydrationData.errors:null;h=A.every((e=>e.route.loader&&!0!==e.route.loader.hydrate&&(t&&void 0!==t[e.route.id]||r&&void 0!==r[e.route.id])))}else h=null!=e.hydrationData;else h=!0;let _,T={historyAction:e.history.action,location:e.history.location,matches:A,initialized:h,navigation:K,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||L,fetchers:new Map,blockers:new Map},C=r.Pop,U=!1,O=!1,H=new Map,I=null,z=!1,q=!1,B=[],N=[],F=new Map,W=0,Q=-1,Z=new Map,re=new Set,oe=new Map,ne=new Map,ie=new Set,ce=new Map,de=new Map,ue=!1;function ge(e,r){void 0===r&&(r={}),T=t({},T,e);let a=[],o=[];b.v7_fetcherPersist&&T.fetchers.forEach(((e,t)=>{"idle"===e.state&&(ie.has(t)?o.push(t):a.push(t))})),[...D].forEach((e=>e(T,{deletedFetchers:o,unstable_viewTransitionOpts:r.viewTransitionOpts,unstable_flushSync:!0===r.flushSync}))),b.v7_fetcherPersist&&(a.forEach((e=>T.fetchers.delete(e))),o.forEach((e=>ze(e))))}function Se(a,o,n){var i,s;let l,{flushSync:c}=void 0===n?{}:n,u=null!=T.actionData&&null!=T.navigation.formMethod&&Pe(T.navigation.formMethod)&&"loading"===T.navigation.state&&!0!==(null==(i=a.state)?void 0:i._isRedirect);l=o.actionData?Object.keys(o.actionData).length>0?o.actionData:null:u?T.actionData:null;let h=o.loaderData?fe(T.loaderData,o.loaderData,o.matches||[],o.errors):T.loaderData,f=T.blockers;f.size>0&&(f=new Map(f),f.forEach(((e,t)=>f.set(t,Y))));let p,m=!0===U||null!=T.navigation.formMethod&&Pe(T.navigation.formMethod)&&!0!==(null==(s=a.state)?void 0:s._isRedirect);if(d&&(v=d,d=void 0),z||C===r.Pop||(C===r.Push?e.history.push(a,a.state):C===r.Replace&&e.history.replace(a,a.state)),C===r.Pop){let e=H.get(T.location.pathname);e&&e.has(a.pathname)?p={currentLocation:T.location,nextLocation:a}:H.has(a.pathname)&&(p={currentLocation:a,nextLocation:T.location})}else if(O){let e=H.get(T.location.pathname);e?e.add(a.pathname):(e=new Set([a.pathname]),H.set(T.location.pathname,e)),p={currentLocation:T.location,nextLocation:a}}ge(t({},o,{actionData:l,loaderData:h,historyAction:C,location:a,initialized:!0,navigation:K,revalidation:"idle",restoreScrollPosition:Ve(a,o.matches||T.matches),preventScrollReset:m,blockers:f}),{viewTransitionOpts:p,flushSync:!0===c}),C=r.Pop,U=!1,O=!1,z=!1,q=!1,B=[],N=[]}async function Re(a,o,n){_&&_.abort(),_=null,C=a,z=!0===(n&&n.startUninterruptedRevalidation),function(e,t){if(S&&P){let r=Ye(e,t);S[r]=P()}}(T.location,T.matches),U=!0===(n&&n.preventScrollReset),O=!0===(n&&n.enableViewTransition);let i=d||v,s=n&&n.overrideNavigation,l=p(i,o,g),h=!0===(n&&n.flushSync);if(!l){let e=ye(404,{pathname:o.pathname}),{matches:t,route:r}=me(i);return Je(),void Se(o,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:h})}if(T.initialized&&!q&&function(e,t){if(e.pathname!==t.pathname||e.search!==t.search)return!1;if(""===e.hash)return""!==t.hash;if(e.hash===t.hash)return!0;if(""!==t.hash)return!0;return!1}(T.location,o)&&!(n&&n.submission&&Pe(n.submission.formMethod)))return void Se(o,{matches:l},{flushSync:h});_=new AbortController;let f,m,w=le(e.history,o,_.signal,n&&n.submission);if(n&&n.pendingError)m={[pe(l).route.id]:n.pendingError};else if(n&&n.submission&&Pe(n.submission.formMethod)){let e=await async function(e,t,a,o,n){void 0===n&&(n={});let i;Ue(),ge({navigation:_e(t,a)},{flushSync:!0===n.flushSync});let s=Me(o,t);if(s.route.action||s.route.lazy){if(i=await se("action",e,s,o,y,c,g,b.v7_relativeSplatPath),e.signal.aborted)return{shortCircuited:!0}}else i={type:u.error,error:ye(405,{method:e.method,pathname:t.pathname,routeId:s.route.id})};if(De(i)){let e;return e=n&&null!=n.replace?n.replace:i.location===T.location.pathname+T.location.search,await Ee(T,i,{submission:a,replace:e}),{shortCircuited:!0}}if(we(i)){let e=pe(o,s.route.id);return!0!==(n&&n.replace)&&(C=r.Push),{pendingActionData:{},pendingActionError:{[e.route.id]:i.error}}}if(be(i))throw ye(400,{type:"defer-action"});return{pendingActionData:{[s.route.id]:i.data}}}(w,o,n.submission,l,{replace:n.replace,flushSync:h});if(e.shortCircuited)return;f=e.pendingActionData,m=e.pendingActionError,s=ke(o,n.submission),h=!1,w=new Request(w.url,{signal:w.signal})}let{shortCircuited:D,loaderData:R,errors:E}=await async function(r,a,o,n,i,s,l,c,u,h,f){let p=n||ke(a,i),m=i||s||je(p),y=d||v,[w,D]=ae(e.history,T,o,m,a,b.v7_partialHydration&&!0===c,q,B,N,ie,oe,re,y,g,h,f);if(Je((e=>!(o&&o.some((t=>t.route.id===e)))||w&&w.some((t=>t.route.id===e)))),Q=++W,0===w.length&&0===D.length){let e=Ne();return Se(a,t({matches:o,loaderData:{},errors:f||null},h?{actionData:h}:{},e?{fetchers:new Map(T.fetchers)}:{}),{flushSync:u}),{shortCircuited:!0}}if(!(z||b.v7_partialHydration&&c)){D.forEach((e=>{let t=T.fetchers.get(e.key),r=Te(void 0,t?t.data:void 0);T.fetchers.set(e.key,r)}));let e=h||T.actionData;ge(t({navigation:p},e?0===Object.keys(e).length?{actionData:null}:{actionData:e}:{},D.length>0?{fetchers:new Map(T.fetchers)}:{}),{flushSync:u})}D.forEach((e=>{F.has(e.key)&&qe(e.key),e.controller&&F.set(e.key,e.controller)}));let S=()=>D.forEach((e=>qe(e.key)));_&&_.signal.addEventListener("abort",S);let{results:R,loaderResults:E,fetcherResults:P}=await Le(T.matches,o,w,D,r);if(r.signal.aborted)return{shortCircuited:!0};_&&_.signal.removeEventListener("abort",S);D.forEach((e=>F.delete(e.key)));let x=ve(R);if(x){if(x.idx>=w.length){let e=D[x.idx-w.length].key;re.add(e)}return await Ee(T,x.result,{replace:l}),{shortCircuited:!0}}let{loaderData:A,errors:L}=he(T,o,w,E,f,D,P,ce);ce.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&ce.delete(t)}))}));let M=Ne(),j=Fe(Q),k=M||j||D.length>0;return t({loaderData:A,errors:L},k?{fetchers:new Map(T.fetchers)}:{})}(w,o,l,s,n&&n.submission,n&&n.fetcherSubmission,n&&n.replace,n&&!0===n.initialHydration,h,f,m);D||(_=null,Se(o,t({matches:l},f?{actionData:f}:{},{loaderData:R,errors:E})))}async function Ee(n,l,c){let{submission:d,fetcherSubmission:u,replace:h}=void 0===c?{}:c;l.revalidate&&(q=!0);let f=s(n.location,l.location,{_isRedirect:!0});if(o(f,"Expected a location on the redirect navigation"),i){let t=!1;if(l.reloadDocument)t=!0;else if(V.test(l.location)){const r=e.history.createURL(l.location);t=r.origin!==a.location.origin||null==E(r.pathname,g)}if(t)return void(h?a.location.replace(l.location):a.location.assign(l.location))}_=null;let p=!0===h?r.Replace:r.Push,{formMethod:m,formAction:y,formEncType:v}=n.navigation;!d&&!u&&m&&y&&v&&(d=je(n.navigation));let b=d||u;if($.has(l.status)&&b&&Pe(b.formMethod))await Re(p,f,{submission:t({},b,{formAction:l.location}),preventScrollReset:U});else{let e=ke(f,d);await Re(p,f,{overrideNavigation:e,fetcherSubmission:u,preventScrollReset:U})}}async function Le(t,r,a,o,n){let i=await Promise.all([...a.map((e=>se("loader",n,e,r,y,c,g,b.v7_relativeSplatPath))),...o.map((t=>{if(t.matches&&t.match&&t.controller)return se("loader",le(e.history,t.path,t.controller.signal),t.match,t.matches,y,c,g,b.v7_relativeSplatPath);return{type:u.error,error:ye(404,{pathname:t.path})}}))]),s=i.slice(0,a.length),l=i.slice(a.length);return await Promise.all([xe(t,a,s,s.map((()=>n.signal)),!1,T.loaderData),xe(t,o.map((e=>e.match)),l,o.map((e=>e.controller?e.controller.signal:null)),!0)]),{results:i,loaderResults:s,fetcherResults:l}}function Ue(){q=!0,B.push(...Je()),oe.forEach(((e,t)=>{F.has(t)&&(N.push(t),qe(t))}))}function Oe(e,t,r){void 0===r&&(r={}),T.fetchers.set(e,t),ge({fetchers:new Map(T.fetchers)},{flushSync:!0===(r&&r.flushSync)})}function He(e,t,r,a){void 0===a&&(a={});let o=pe(T.matches,t);ze(e),ge({errors:{[o.route.id]:r},fetchers:new Map(T.fetchers)},{flushSync:!0===(a&&a.flushSync)})}function Ie(e){return b.v7_fetcherPersist&&(ne.set(e,(ne.get(e)||0)+1),ie.has(e)&&ie.delete(e)),T.fetchers.get(e)||J}function ze(e){let t=T.fetchers.get(e);!F.has(e)||t&&"loading"===t.state&&Z.has(e)||qe(e),oe.delete(e),Z.delete(e),re.delete(e),ie.delete(e),T.fetchers.delete(e)}function qe(e){let t=F.get(e);o(t,"Expected fetch controller: "+e),t.abort(),F.delete(e)}function Be(e){for(let t of e){let e=Ce(Ie(t).data);T.fetchers.set(t,e)}}function Ne(){let e=[],t=!1;for(let r of re){let a=T.fetchers.get(r);o(a,"Expected fetcher: "+r),"loading"===a.state&&(re.delete(r),e.push(r),t=!0)}return Be(e),t}function Fe(e){let t=[];for(let[r,a]of Z)if(a<e){let e=T.fetchers.get(r);o(e,"Expected fetcher: "+r),"loading"===e.state&&(qe(r),Z.delete(r),t.push(r))}return Be(t),t.length>0}function We(e){T.blockers.delete(e),de.delete(e)}function $e(e,t){let r=T.blockers.get(e)||Y;o("unblocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"proceeding"===t.state||"blocked"===r.state&&"unblocked"===t.state||"proceeding"===r.state&&"unblocked"===t.state,"Invalid blocker state transition: "+r.state+" -> "+t.state);let a=new Map(T.blockers);a.set(e,t),ge({blockers:a})}function Ke(e){let{currentLocation:t,nextLocation:r,historyAction:a}=e;if(0===de.size)return;de.size>1&&n(!1,"A router only supports one blocker at a time");let o=Array.from(de.entries()),[i,s]=o[o.length-1],l=T.blockers.get(i);return l&&"proceeding"===l.state?void 0:s({currentLocation:t,nextLocation:r,historyAction:a})?i:void 0}function Je(e){let t=[];return ce.forEach(((r,a)=>{e&&!e(a)||(r.cancel(),t.push(a),ce.delete(a))})),t}function Ye(e,t){if(R){return R(e,t.map((e=>m(e,T.loaderData))))||e.key}return e.key}function Ve(e,t){if(S){let r=Ye(e,t),a=S[r];if("number"==typeof a)return a}return null}return M={get basename(){return g},get future(){return b},get state(){return T},get routes(){return v},get window(){return a},initialize:function(){if(w=e.history.listen((t=>{let{action:r,location:a,delta:o}=t;if(ue)return void(ue=!1);n(0===de.size||null!=o,"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.");let i=Ke({currentLocation:T.location,nextLocation:a,historyAction:r});return i&&null!=o?(ue=!0,e.history.go(-1*o),void $e(i,{state:"blocked",location:a,proceed(){$e(i,{state:"proceeding",proceed:void 0,reset:void 0,location:a}),e.history.go(o)},reset(){let e=new Map(T.blockers);e.set(i,Y),ge({blockers:e})}})):Re(r,a)})),i){!function(e,t){try{let r=e.sessionStorage.getItem(G);if(r){let e=JSON.parse(r);for(let[r,a]of Object.entries(e||{}))a&&Array.isArray(a)&&t.set(r,new Set(a||[]))}}catch(e){}}(a,H);let e=()=>function(e,t){if(t.size>0){let r={};for(let[e,a]of t)r[e]=[...a];try{e.sessionStorage.setItem(G,JSON.stringify(r))}catch(e){n(!1,"Failed to save applied view transitions in sessionStorage ("+e+").")}}}(a,H);a.addEventListener("pagehide",e),I=()=>a.removeEventListener("pagehide",e)}return T.initialized||Re(r.Pop,T.location,{initialHydration:!0}),M},subscribe:function(e){return D.add(e),()=>D.delete(e)},enableScrollRestoration:function(e,t,r){if(S=e,P=t,R=r||null,!x&&T.navigation===K){x=!0;let e=Ve(T.location,T.matches);null!=e&&ge({restoreScrollPosition:e})}return()=>{S=null,P=null,R=null}},navigate:async function a(o,n){if("number"==typeof o)return void e.history.go(o);let i=ee(T.location,T.matches,g,b.v7_prependBasename,o,b.v7_relativeSplatPath,null==n?void 0:n.fromRouteId,null==n?void 0:n.relative),{path:l,submission:c,error:d}=te(b.v7_normalizeFormMethod,!1,i,n),u=T.location,h=s(T.location,l,n&&n.state);h=t({},h,e.history.encodeLocation(h));let f=n&&null!=n.replace?n.replace:void 0,p=r.Push;!0===f?p=r.Replace:!1===f||null!=c&&Pe(c.formMethod)&&c.formAction===T.location.pathname+T.location.search&&(p=r.Replace);let m=n&&"preventScrollReset"in n?!0===n.preventScrollReset:void 0,y=!0===(n&&n.unstable_flushSync),v=Ke({currentLocation:u,nextLocation:h,historyAction:p});if(!v)return await Re(p,h,{submission:c,pendingError:d,preventScrollReset:m,replace:n&&n.replace,enableViewTransition:n&&n.unstable_viewTransition,flushSync:y});$e(v,{state:"blocked",location:h,proceed(){$e(v,{state:"proceeding",proceed:void 0,reset:void 0,location:h}),a(o,n)},reset(){let e=new Map(T.blockers);e.set(v,Y),ge({blockers:e})}})},fetch:function(t,r,a,n){if(l)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");F.has(t)&&qe(t);let i=!0===(n&&n.unstable_flushSync),s=d||v,u=ee(T.location,T.matches,g,b.v7_prependBasename,a,b.v7_relativeSplatPath,r,null==n?void 0:n.relative),h=p(s,u,g);if(!h)return void He(t,r,ye(404,{pathname:u}),{flushSync:i});let{path:f,submission:m,error:w}=te(b.v7_normalizeFormMethod,!0,u,n);if(w)return void He(t,r,w,{flushSync:i});let D=Me(h,f);U=!0===(n&&n.preventScrollReset),m&&Pe(m.formMethod)?async function(t,r,a,n,i,s,l){if(Ue(),oe.delete(t),!n.route.action&&!n.route.lazy){let e=ye(405,{method:l.formMethod,pathname:a,routeId:r});return void He(t,r,e,{flushSync:s})}let u=T.fetchers.get(t);Oe(t,function(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}(l,u),{flushSync:s});let h=new AbortController,f=le(e.history,a,h.signal,l);F.set(t,h);let m=W,w=await se("action",f,n,i,y,c,g,b.v7_relativeSplatPath);if(f.signal.aborted)return void(F.get(t)===h&&F.delete(t));if(b.v7_fetcherPersist&&ie.has(t)){if(De(w)||we(w))return void Oe(t,Ce(void 0))}else{if(De(w))return F.delete(t),Q>m?void Oe(t,Ce(void 0)):(re.add(t),Oe(t,Te(l)),Ee(T,w,{fetcherSubmission:l}));if(we(w))return void He(t,r,w.error)}if(be(w))throw ye(400,{type:"defer-action"});let D=T.navigation.location||T.location,S=le(e.history,D,h.signal),R=d||v,E="idle"!==T.navigation.state?p(R,T.navigation.location,g):T.matches;o(E,"Didn't find any matches after fetcher action");let P=++W;Z.set(t,P);let x=Te(l,w.data);T.fetchers.set(t,x);let[A,L]=ae(e.history,T,E,l,D,!1,q,B,N,ie,oe,re,R,g,{[n.route.id]:w.data},void 0);L.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,r=T.fetchers.get(t),a=Te(void 0,r?r.data:void 0);T.fetchers.set(t,a),F.has(t)&&qe(t),e.controller&&F.set(t,e.controller)})),ge({fetchers:new Map(T.fetchers)});let M=()=>L.forEach((e=>qe(e.key)));h.signal.addEventListener("abort",M);let{results:j,loaderResults:k,fetcherResults:U}=await Le(T.matches,E,A,L,S);if(h.signal.aborted)return;h.signal.removeEventListener("abort",M),Z.delete(t),F.delete(t),L.forEach((e=>F.delete(e.key)));let O=ve(j);if(O){if(O.idx>=A.length){let e=L[O.idx-A.length].key;re.add(e)}return Ee(T,O.result)}let{loaderData:H,errors:I}=he(T,T.matches,A,k,void 0,L,U,ce);if(T.fetchers.has(t)){let e=Ce(w.data);T.fetchers.set(t,e)}Fe(P),"loading"===T.navigation.state&&P>Q?(o(C,"Expected pending action"),_&&_.abort(),Se(T.navigation.location,{matches:E,loaderData:H,errors:I,fetchers:new Map(T.fetchers)})):(ge({errors:I,loaderData:fe(T.loaderData,H,E,I),fetchers:new Map(T.fetchers)}),q=!1)}(t,r,f,D,h,i,m):(oe.set(t,{routeId:r,path:f}),async function(t,r,a,n,i,s,l){let d=T.fetchers.get(t);Oe(t,Te(l,d?d.data:void 0),{flushSync:s});let u=new AbortController,h=le(e.history,a,u.signal);F.set(t,u);let f=W,p=await se("loader",h,n,i,y,c,g,b.v7_relativeSplatPath);be(p)&&(p=await Ae(p,h.signal,!0)||p);F.get(t)===u&&F.delete(t);if(h.signal.aborted)return;if(ie.has(t))return void Oe(t,Ce(void 0));if(De(p))return Q>f?void Oe(t,Ce(void 0)):(re.add(t),void await Ee(T,p));if(we(p))return void He(t,r,p.error);o(!be(p),"Unhandled fetcher deferred data"),Oe(t,Ce(p.data))}(t,r,f,D,h,i,m))},revalidate:function(){Ue(),ge({revalidation:"loading"}),"submitting"!==T.navigation.state&&("idle"!==T.navigation.state?Re(C||T.historyAction,T.navigation.location,{overrideNavigation:T.navigation}):Re(T.historyAction,T.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Ie,deleteFetcher:function(e){if(b.v7_fetcherPersist){let t=(ne.get(e)||0)-1;t<=0?(ne.delete(e),ie.add(e)):ne.set(e,t)}else ze(e);ge({fetchers:new Map(T.fetchers)})},dispose:function(){w&&w(),I&&I(),D.clear(),_&&_.abort(),T.fetchers.forEach(((e,t)=>ze(t))),T.blockers.forEach(((e,t)=>We(t)))},getBlocker:function(e,t){let r=T.blockers.get(e)||Y;return de.get(e)!==t&&de.set(e,t),r},deleteBlocker:We,_internalFetchControllers:F,_internalActiveDeferreds:ce,_internalSetRoutes:function(e){y={},d=f(e,c,void 0,y)}},M},e.createStaticHandler=function(e,r){o(e.length>0,"You must provide a non-empty routes array to createStaticHandler");let a,n={},i=(r?r.basename:null)||"/";if(null!=r&&r.mapRouteProperties)a=r.mapRouteProperties;else if(null!=r&&r.detectErrorBoundary){let e=r.detectErrorBoundary;a=t=>({hasErrorBoundary:e(t)})}else a=X;let c=t({v7_relativeSplatPath:!1,v7_throwAbortReason:!1},r?r.future:null),d=f(e,a,void 0,n);async function h(e,r,s,l,d){o(e.signal,"query()/queryRoute() requests must contain an AbortController signal");try{if(Pe(e.method.toLowerCase())){let o=await async function(e,r,o,s,l){let d;if(o.route.action||o.route.lazy)d=await se("action",e,o,r,n,a,i,c.v7_relativeSplatPath,{isStaticRequest:!0,isRouteRequest:l,requestContext:s}),e.signal.aborted&&Z(e,l,c);else{let t=ye(405,{method:e.method,pathname:new URL(e.url).pathname,routeId:o.route.id});if(l)throw t;d={type:u.error,error:t}}if(De(d))throw new Response(null,{status:d.status,headers:{Location:d.location}});if(be(d)){let e=ye(400,{type:"defer-action"});if(l)throw e;d={type:u.error,error:e}}if(l){if(we(d))throw d.error;return{matches:[o],loaderData:{},actionData:{[o.route.id]:d.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(we(d)){let a=pe(r,o.route.id);return t({},await m(e,r,s,void 0,{[a.route.id]:d.error}),{statusCode:z(d.error)?d.error.status:500,actionData:null,actionHeaders:t({},d.headers?{[o.route.id]:d.headers}:{})})}let h=new Request(e.url,{headers:e.headers,redirect:e.redirect,signal:e.signal});return t({},await m(h,r,s),d.statusCode?{statusCode:d.statusCode}:{},{actionData:{[o.route.id]:d.data},actionHeaders:t({},d.headers?{[o.route.id]:d.headers}:{})})}(e,s,d||Me(s,r),l,null!=d);return o}let o=await m(e,s,l,d);return Re(o)?o:t({},o,{actionData:null,actionHeaders:{}})}catch(e){if((h=e)&&Re(h.response)&&(h.type===u.data||h.type===u.error)){if(e.type===u.error)throw e.response;return e.response}if(function(e){if(!Re(e))return!1;let t=e.status,r=e.headers.get("Location");return t>=300&&t<=399&&null!=r}(e))return e;throw e}var h}async function m(e,r,o,s,l){let d=null!=s;if(d&&(null==s||!s.route.loader)&&(null==s||!s.route.lazy))throw ye(400,{method:e.method,pathname:new URL(e.url).pathname,routeId:null==s?void 0:s.route.id});let u=(s?[s]:re(r,Object.keys(l||{})[0])).filter((e=>e.route.loader||e.route.lazy));if(0===u.length)return{matches:r,loaderData:r.reduce(((e,t)=>Object.assign(e,{[t.route.id]:null})),{}),errors:l||null,statusCode:200,loaderHeaders:{},activeDeferreds:null};let h=await Promise.all([...u.map((t=>se("loader",e,t,r,n,a,i,c.v7_relativeSplatPath,{isStaticRequest:!0,isRouteRequest:d,requestContext:o})))]);e.signal.aborted&&Z(e,d,c);let f=new Map,p=ue(r,u,h,l,f),m=new Set(u.map((e=>e.route.id)));return r.forEach((e=>{m.has(e.route.id)||(p.loaderData[e.route.id]=null)})),t({},p,{matches:r,activeDeferreds:f.size>0?Object.fromEntries(f.entries()):null})}return{dataRoutes:d,query:async function(e,r){let{requestContext:a}=void 0===r?{}:r,o=new URL(e.url),n=e.method,c=s("",l(o),null,"default"),u=p(d,c,i);if(!Ee(n)&&"HEAD"!==n){let e=ye(405,{method:n}),{matches:t,route:r}=me(d);return{basename:i,location:c,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(!u){let e=ye(404,{pathname:c.pathname}),{matches:t,route:r}=me(d);return{basename:i,location:c,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}let f=await h(e,c,u,a);return Re(f)?f:t({location:c,basename:i},f)},queryRoute:async function(e,t){let{routeId:r,requestContext:a}=void 0===t?{}:t,o=new URL(e.url),n=e.method,c=s("",l(o),null,"default"),u=p(d,c,i);if(!Ee(n)&&"HEAD"!==n&&"OPTIONS"!==n)throw ye(405,{method:n});if(!u)throw ye(404,{pathname:c.pathname});let f=r?u.find((e=>e.route.id===r)):Me(u,c);if(r&&!f)throw ye(403,{pathname:c.pathname,routeId:r});if(!f)throw ye(404,{pathname:c.pathname});let m=await h(e,c,u,a,f);if(Re(m))return m;let y=m.errors?Object.values(m.errors)[0]:void 0;if(void 0!==y)throw y;if(m.actionData)return Object.values(m.actionData)[0];if(m.loaderData){var v;let e=Object.values(m.loaderData)[0];return null!=(v=m.activeDeferreds)&&v[f.route.id]&&(e[Q]=m.activeDeferreds[f.route.id]),e}}}},e.defer=function(e,t){return void 0===t&&(t={}),new U(e,"number"==typeof t?{status:t}:t)},e.generatePath=function(e,t){void 0===t&&(t={});let r=e;r.endsWith("*")&&"*"!==r&&!r.endsWith("/*")&&(n(!1,'Route path "'+r+'" will be treated as if it were "'+r.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+r.replace(/\*$/,"/*")+'".'),r=r.replace(/\*$/,"/*"));const a=r.startsWith("/")?"/":"",i=e=>null==e?"":"string"==typeof e?e:String(e);return a+r.split(/\/+/).map(((e,r,a)=>{if(r===a.length-1&&"*"===e){return i(t["*"])}const n=e.match(/^:([\w-]+)(\??)$/);if(n){const[,e,r]=n;let a=t[e];return o("?"===r||null!=a,'Missing ":'+e+'" param'),i(a)}return e.replace(/\?$/g,"")})).filter((e=>!!e)).join("/")},e.getStaticContextFromError=function(e,r,a){return t({},r,{statusCode:z(a)?a.status:500,errors:{[r._deepestRenderedBoundaryId||e[0].id]:a}})},e.getToPathname=function(e){return""===e||""===e.pathname?"/":"string"==typeof e?c(e).pathname:e.pathname},e.isDeferredData=Se,e.isRouteErrorResponse=z,e.joinPaths=j,e.json=function(e,r){void 0===r&&(r={});let a="number"==typeof r?{status:r}:r,o=new Headers(a.headers);return o.has("Content-Type")||o.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify(e),t({},a,{headers:o}))},e.matchPath=S,e.matchRoutes=p,e.normalizePathname=k,e.parsePath=c,e.redirect=H,e.redirectDocument=(e,t)=>{let r=H(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r},e.resolvePath=P,e.resolveTo=M,e.stripBasename=E,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=router.umd.min.js.map

@@ -57,4 +57,4 @@ import type { Location, Path, To } from "./history";

/**
* Users can specify either lowercase or uppercase form methods on <Form>,
* useSubmit(), <fetcher.Form>, etc.
* Users can specify either lowercase or uppercase form methods on `<Form>`,
* useSubmit(), `<fetcher.Form>`, etc.
*/

@@ -115,6 +115,6 @@ export type HTMLFormMethod = LowerCaseFormMethod | UpperCaseFormMethod;

*/
interface DataFunctionArgs {
interface DataFunctionArgs<Context> {
request: Request;
params: Params;
context?: any;
context?: Context;
}

@@ -124,3 +124,3 @@ /**

*/
export interface LoaderFunctionArgs extends DataFunctionArgs {
export interface LoaderFunctionArgs<Context = any> extends DataFunctionArgs<Context> {
}

@@ -130,3 +130,3 @@ /**

*/
export interface ActionFunctionArgs extends DataFunctionArgs {
export interface ActionFunctionArgs<Context = any> extends DataFunctionArgs<Context> {
}

@@ -142,12 +142,31 @@ /**

*/
export interface LoaderFunction {
(args: LoaderFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
}
export type LoaderFunction<Context = any> = {
(args: LoaderFunctionArgs<Context>): Promise<DataFunctionValue> | DataFunctionValue;
} & {
hydrate?: boolean;
};
/**
* Route action function signature
*/
export interface ActionFunction {
(args: ActionFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
export interface ActionFunction<Context = any> {
(args: ActionFunctionArgs<Context>): Promise<DataFunctionValue> | DataFunctionValue;
}
/**
* Arguments passed to shouldRevalidate function
*/
export interface ShouldRevalidateFunctionArgs {
currentUrl: URL;
currentParams: AgnosticDataRouteMatch["params"];
nextUrl: URL;
nextParams: AgnosticDataRouteMatch["params"];
formMethod?: Submission["formMethod"];
formAction?: Submission["formAction"];
formEncType?: Submission["formEncType"];
text?: Submission["text"];
formData?: Submission["formData"];
json?: Submission["json"];
actionResult?: any;
defaultShouldRevalidate: boolean;
}
/**
* Route shouldRevalidate function signature. This runs after any submission

@@ -160,16 +179,3 @@ * (navigation or fetcher), so we flatten the navigation/fetcher submission

export interface ShouldRevalidateFunction {
(args: {
currentUrl: URL;
currentParams: AgnosticDataRouteMatch["params"];
nextUrl: URL;
nextParams: AgnosticDataRouteMatch["params"];
formMethod?: Submission["formMethod"];
formAction?: Submission["formAction"];
formEncType?: Submission["formEncType"];
text?: Submission["text"];
formData?: Submission["formData"];
json?: Submission["json"];
actionResult?: DataResult;
defaultShouldRevalidate: boolean;
}): boolean;
(args: ShouldRevalidateFunctionArgs): boolean;
}

@@ -266,3 +272,3 @@ /**

*/
type PathParam<Path extends string> = Path extends "*" | "/*" ? "*" : Path extends `${infer Rest}/*` ? "*" | _PathParam<Rest> : _PathParam<Path>;
export type PathParam<Path extends string> = Path extends "*" | "/*" ? "*" : Path extends `${infer Rest}/*` ? "*" | _PathParam<Rest> : _PathParam<Path>;
export type ParamParseKey<Segment extends string> = [

@@ -307,2 +313,10 @@ PathParam<Segment>

export declare function matchRoutes<RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject>(routes: RouteObjectType[], locationArg: Partial<Location> | string, basename?: string): AgnosticRouteMatch<string, RouteObjectType>[] | null;
export interface UIMatch<Data = unknown, Handle = unknown> {
id: string;
pathname: string;
params: AgnosticRouteMatch["params"];
data: Data;
handle: Handle;
}
export declare function convertRouteMatchToUiMatch(match: AgnosticDataRouteMatch, loaderData: RouteData): UIMatch;
/**

@@ -398,2 +412,3 @@ * Returns a path with params interpolated.

export declare function getPathContributingMatches<T extends AgnosticRouteMatch = AgnosticRouteMatch>(matches: T[]): T[];
export declare function getResolveToMatches<T extends AgnosticRouteMatch = AgnosticRouteMatch>(matches: T[], v7_relativeSplatPath: boolean): string[];
/**

@@ -470,12 +485,21 @@ * @private

export declare const redirectDocument: RedirectFunction;
export type ErrorResponse = {
status: number;
statusText: string;
data: any;
};
/**
* @private
* Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies
*
* We don't export the class for public use since it's an implementation
* detail, but we export the interface above so folks can build their own
* abstractions around instances via isRouteErrorResponse()
*/
export declare class ErrorResponse {
export declare class ErrorResponseImpl implements ErrorResponse {
status: number;
statusText: string;
data: any;
error?: Error;
internal: boolean;
private error?;
private internal;
constructor(status: number, statusText: string | undefined, data: any, internal?: boolean);

@@ -482,0 +506,0 @@ }

@@ -52,2 +52,5 @@ ////////////////////////////////////////////////////////////////////////////////

// TODO: (v7) Change the Location generic default from `any` to `unknown` and
// remove Remix `useLocation` wrapper.
/**

@@ -57,7 +60,7 @@ * An entry in a history stack. A location contains information about the

*/
export interface Location extends Path {
export interface Location<State = any> extends Path {
/**
* A value of arbitrary data associated with this location.
*/
state: any;
state: State;

@@ -102,4 +105,4 @@ /**

* Describes a location that is the destination of some navigation, either via
* `history.push` or `history.replace`. May be either a URL or the pieces of a
* URL path.
* `history.push` or `history.replace`. This may be either a URL or the pieces
* of a URL path.
*/

@@ -506,3 +509,3 @@ export type To = string | Partial<Path>;

//
// This error is thrown as a convenience so you can more easily
// This error is thrown as a convenience, so you can more easily
// find the source for a warning that appears in the console by

@@ -509,0 +512,0 @@ // enabling "pause on exceptions" in your JavaScript debugger.

@@ -12,2 +12,3 @@ export type {

AgnosticRouteObject,
ErrorResponse,
FormEncType,

@@ -23,6 +24,9 @@ FormMethod,

PathMatch,
PathParam,
PathPattern,
RedirectFunction,
ShouldRevalidateFunction,
ShouldRevalidateFunctionArgs,
TrackedPromise,
UIMatch,
V7_FormMethod,

@@ -33,3 +37,2 @@ } from "./utils";

AbortedDeferredError,
ErrorResponse,
defer,

@@ -87,4 +90,6 @@ generatePath,

DeferredData as UNSAFE_DeferredData,
ErrorResponseImpl as UNSAFE_ErrorResponseImpl,
convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes,
getPathContributingMatches as UNSAFE_getPathContributingMatches,
convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch,
getResolveToMatches as UNSAFE_getResolveToMatches,
} from "./utils";

@@ -91,0 +96,0 @@

{
"name": "@remix-run/router",
"version": "0.0.0-experimental-ad6954b7",
"version": "0.0.0-experimental-add6f8aa",
"description": "Nested/Data-driven/Framework-agnostic Routing",

@@ -5,0 +5,0 @@ "keywords": [

@@ -7,3 +7,3 @@ # Remix Router

> **Warning**
> [!WARNING]
>

@@ -10,0 +10,0 @@ > This router is a low-level package intended to be consumed by UI layer routing libraries. You should very likely not be using this package directly unless you are authoring a routing library such as [`react-router-dom`][react-router-repo] or one of it's other [UI ports][remix-routers-repo].

@@ -71,4 +71,4 @@ import type { Location, Path, To } from "./history";

/**
* Users can specify either lowercase or uppercase form methods on <Form>,
* useSubmit(), <fetcher.Form>, etc.
* Users can specify either lowercase or uppercase form methods on `<Form>`,
* useSubmit(), `<fetcher.Form>`, etc.
*/

@@ -141,12 +141,17 @@ export type HTMLFormMethod = LowerCaseFormMethod | UpperCaseFormMethod;

*/
interface DataFunctionArgs {
interface DataFunctionArgs<Context> {
request: Request;
params: Params;
context?: any;
context?: Context;
}
// TODO: (v7) Change the defaults from any to unknown in and remove Remix wrappers:
// ActionFunction, ActionFunctionArgs, LoaderFunction, LoaderFunctionArgs
// Also, make them a type alias instead of an interface
/**
* Arguments passed to loader functions
*/
export interface LoaderFunctionArgs extends DataFunctionArgs {}
export interface LoaderFunctionArgs<Context = any>
extends DataFunctionArgs<Context> {}

@@ -156,3 +161,4 @@ /**

*/
export interface ActionFunctionArgs extends DataFunctionArgs {}
export interface ActionFunctionArgs<Context = any>
extends DataFunctionArgs<Context> {}

@@ -169,5 +175,7 @@ /**

*/
export interface LoaderFunction {
(args: LoaderFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
}
export type LoaderFunction<Context = any> = {
(args: LoaderFunctionArgs<Context>):
| Promise<DataFunctionValue>
| DataFunctionValue;
} & { hydrate?: boolean };

@@ -177,7 +185,27 @@ /**

*/
export interface ActionFunction {
(args: ActionFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
export interface ActionFunction<Context = any> {
(args: ActionFunctionArgs<Context>):
| Promise<DataFunctionValue>
| DataFunctionValue;
}
/**
* Arguments passed to shouldRevalidate function
*/
export interface ShouldRevalidateFunctionArgs {
currentUrl: URL;
currentParams: AgnosticDataRouteMatch["params"];
nextUrl: URL;
nextParams: AgnosticDataRouteMatch["params"];
formMethod?: Submission["formMethod"];
formAction?: Submission["formAction"];
formEncType?: Submission["formEncType"];
text?: Submission["text"];
formData?: Submission["formData"];
json?: Submission["json"];
actionResult?: any;
defaultShouldRevalidate: boolean;
}
/**
* Route shouldRevalidate function signature. This runs after any submission

@@ -190,16 +218,3 @@ * (navigation or fetcher), so we flatten the navigation/fetcher submission

export interface ShouldRevalidateFunction {
(args: {
currentUrl: URL;
currentParams: AgnosticDataRouteMatch["params"];
nextUrl: URL;
nextParams: AgnosticDataRouteMatch["params"];
formMethod?: Submission["formMethod"];
formAction?: Submission["formAction"];
formEncType?: Submission["formEncType"];
text?: Submission["text"];
formData?: Submission["formData"];
json?: Submission["json"];
actionResult?: DataResult;
defaultShouldRevalidate: boolean;
}): boolean;
(args: ShouldRevalidateFunctionArgs): boolean;
}

@@ -343,3 +358,3 @@

*/
type PathParam<Path extends string> =
export type PathParam<Path extends string> =
// check if path is just a wildcard

@@ -355,6 +370,6 @@ Path extends "*" | "/*"

// Attempt to parse the given string segment. If it fails, then just return the
// plain string type as a default fallback. Otherwise return the union of the
// plain string type as a default fallback. Otherwise, return the union of the
// parsed string literals that were referenced as dynamic segments in the route.
export type ParamParseKey<Segment extends string> =
// if could not find path params, fallback to `string`
// if you could not find path params, fallback to `string`
[PathParam<Segment>] extends [never] ? string : PathParam<Segment>;

@@ -403,3 +418,3 @@

// Walk the route tree generating unique IDs where necessary so we are working
// Walk the route tree generating unique IDs where necessary, so we are working
// solely with AgnosticDataRouteObject's within the Router

@@ -497,2 +512,24 @@ export function convertRoutesToDataRoutes(

export interface UIMatch<Data = unknown, Handle = unknown> {
id: string;
pathname: string;
params: AgnosticRouteMatch["params"];
data: Data;
handle: Handle;
}
export function convertRouteMatchToUiMatch(
match: AgnosticDataRouteMatch,
loaderData: RouteData
): UIMatch {
let { route, pathname, params } = match;
return {
id: route.id,
pathname,
params,
data: loaderData[route.id],
handle: route.handle,
};
}
interface RouteMeta<

@@ -550,3 +587,3 @@ RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject

// Add the children before adding this route to the array so we traverse the
// Add the children before adding this route to the array, so we traverse the
// route tree depth-first and child routes appear before their parents in

@@ -628,6 +665,6 @@ // the "flattened" version.

// All child paths with the prefix. Do this for all children before the
// optional version for all children so we get consistent ordering where the
// optional version for all children, so we get consistent ordering where the
// parent optional aspect is preferred as required. Otherwise, we can get
// child sections interspersed where deeper optional segments are higher than
// parent optional segments, where for example, /:two would explodes _earlier_
// parent optional segments, where for example, /:two would explode _earlier_
// then /:one. By always including the parent as required _for all children_

@@ -641,3 +678,3 @@ // first, we avoid this issue

// Then if this is an optional value, add all child versions without
// Then, if this is an optional value, add all child versions without
if (isOptional) {

@@ -664,3 +701,3 @@ result.push(...restExploded);

const paramRe = /^:\w+$/;
const paramRe = /^:[\w-]+$/;
const dynamicSegmentValue = 3;

@@ -802,3 +839,3 @@ const indexRouteValue = 2;

const keyMatch = segment.match(/^:(\w+)(\??)$/);
const keyMatch = segment.match(/^:([\w-]+)(\??)$/);
if (keyMatch) {

@@ -884,3 +921,3 @@ const [, key, optional] = keyMatch;

let [matcher, paramNames] = compilePath(
let [matcher, compiledParams] = compilePath(
pattern.path,

@@ -897,4 +934,4 @@ pattern.caseSensitive,

let captureGroups = match.slice(1);
let params: Params = paramNames.reduce<Mutable<Params>>(
(memo, paramName, index) => {
let params: Params = compiledParams.reduce<Mutable<Params>>(
(memo, { paramName, isOptional }, index) => {
// We need to compute the pathnameBase here using the raw splat value

@@ -909,6 +946,8 @@ // instead of using params["*"] later because it will be decoded then

memo[paramName] = safelyDecodeURIComponent(
captureGroups[index] || "",
paramName
);
const value = captureGroups[index];
if (isOptional && !value) {
memo[paramName] = undefined;
} else {
memo[paramName] = safelyDecodeURIComponent(value || "", paramName);
}
return memo;

@@ -927,2 +966,4 @@ },

type CompiledPathParam = { paramName: string; isOptional?: boolean };
function compilePath(

@@ -932,3 +973,3 @@ path: string,

end = true
): [RegExp, string[]] {
): [RegExp, CompiledPathParam[]] {
warning(

@@ -942,3 +983,3 @@ path === "*" || !path.endsWith("*") || path.endsWith("/*"),

let paramNames: string[] = [];
let params: CompiledPathParam[] = [];
let regexpSource =

@@ -949,10 +990,13 @@ "^" +

.replace(/^\/*/, "/") // Make sure it has a leading /
.replace(/[\\.*+^$?{}|()[\]]/g, "\\$&") // Escape special regex chars
.replace(/\/:(\w+)/g, (_: string, paramName: string) => {
paramNames.push(paramName);
return "/([^\\/]+)";
});
.replace(/[\\.*+^${}|()[\]]/g, "\\$&") // Escape special regex chars
.replace(
/\/:([\w-]+)(\?)?/g,
(_: string, paramName: string, isOptional) => {
params.push({ paramName, isOptional: isOptional != null });
return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
}
);
if (path.endsWith("*")) {
paramNames.push("*");
params.push({ paramName: "*" });
regexpSource +=

@@ -967,3 +1011,3 @@ path === "*" || path === "/*"

// If our path is non-empty and contains anything beyond an initial slash,
// then we have _some_ form of path in our regex so we should expect to
// then we have _some_ form of path in our regex, so we should expect to
// match only if we find the end of this path segment. Look for an optional

@@ -981,3 +1025,3 @@ // non-captured trailing slash (to match a portion of the URL) or the end

return [matcher, paramNames];
return [matcher, params];
}

@@ -1131,2 +1175,21 @@

// Return the array of pathnames for the current route matches - used to
// generate the routePathnames input for resolveTo()
export function getResolveToMatches<
T extends AgnosticRouteMatch = AgnosticRouteMatch
>(matches: T[], v7_relativeSplatPath: boolean) {
let pathMatches = getPathContributingMatches(matches);
// When v7_relativeSplatPath is enabled, use the full pathname for the leaf
// match so we include splat values for "." links. See:
// https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329
if (v7_relativeSplatPath) {
return pathMatches.map((match, idx) =>
idx === matches.length - 1 ? match.pathname : match.pathnameBase
);
}
return pathMatches.map((match) => match.pathnameBase);
}
/**

@@ -1175,3 +1238,3 @@ * @private

// to the current location's pathname and *not* the route pathname.
if (isPathRelative || toPathname == null) {
if (toPathname == null) {
from = locationPathname;

@@ -1181,8 +1244,9 @@ } else {

if (toPathname.startsWith("..")) {
// With relative="route" (the default), each leading .. segment means
// "go up one route" instead of "go up one URL segment". This is a key
// difference from how <a href> works and a major reason we call this a
// "to" value instead of a "href".
if (!isPathRelative && toPathname.startsWith("..")) {
let toSegments = toPathname.split("/");
// Each leading .. segment means "go up one route" instead of "go up one
// URL segment". This is a key difference from how <a href> works and a
// major reason we call this a "to" value instead of a "href".
while (toSegments[0] === "..") {

@@ -1196,4 +1260,2 @@ toSegments.shift();

// If there are more ".." segments than parent routes, resolve relative to
// the root / URL.
from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";

@@ -1527,12 +1589,22 @@ }

export type ErrorResponse = {
status: number;
statusText: string;
data: any;
};
/**
* @private
* Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies
*
* We don't export the class for public use since it's an implementation
* detail, but we export the interface above so folks can build their own
* abstractions around instances via isRouteErrorResponse()
*/
export class ErrorResponse {
export class ErrorResponseImpl implements ErrorResponse {
status: number;
statusText: string;
data: any;
error?: Error;
internal: boolean;
private error?: Error;
private internal: boolean;

@@ -1539,0 +1611,0 @@ constructor(

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc