Socket
Socket
Sign inDemoInstall

@remix-run/router

Package Overview
Dependencies
0
Maintainers
2
Versions
182
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.0-experimental-a077dc2d to 0.0.0-experimental-a0888892

286

CHANGELOG.md
# `@remix-run/router`
## 1.15.0
### Minor Changes
- Add a `createStaticHandler` `future.v7_throwAbortReason` flag to throw `request.signal.reason` (defaults to a `DOMException`) when a request is aborted instead of an `Error` such as `new Error("query() call aborted: GET /path")` ([#11104](https://github.com/remix-run/react-router/pull/11104))
- Please note that `DOMException` was added in Node v17 so you will not get a `DOMException` on Node 16 and below.
### Patch Changes
- Respect the `ErrorResponse` status code if passed to `getStaticContextFormError` ([#11213](https://github.com/remix-run/react-router/pull/11213))
## 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

@@ -418,9 +695,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).

4

dist/index.d.ts

@@ -1,2 +0,2 @@

export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, ErrorResponse, FormEncType, FormMethod, HTMLFormMethod, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, TrackedPromise, UIMatch, V7_FormMethod, } from "./utils";
export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, 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";

@@ -8,3 +8,3 @@ export type { BrowserHistory, BrowserHistoryOptions, HashHistory, HashHistoryOptions, History, InitialEntry, Location, MemoryHistory, MemoryHistoryOptions, Path, To, } from "./history";

export type { RouteManifest as UNSAFE_RouteManifest } from "./utils";
export { DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, 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, AgnosticRouteObject, DeferredData, DetectErrorBoundaryFunction, FormEncType, HTMLFormMethod, MapRoutePropertiesFunction, RouteData, Submission, UIMatch } from "./utils";
import type { AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticRouteObject, DataStrategyFunction, 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

@@ -252,3 +259,5 @@ */

v7_normalizeFormMethod: boolean;
v7_partialHydration: boolean;
v7_prependBasename: boolean;
v7_relativeSplatPath: boolean;
}

@@ -270,2 +279,3 @@ /**

window?: Window;
unstable_dataStrategy?: DataStrategyFunction;
}

@@ -310,3 +320,5 @@ /**

(state: RouterState, opts: {
deletedFetchers: string[];
unstable_viewTransitionOpts?: ViewTransitionOpts;
unstable_flushSync: boolean;
}): void;

@@ -331,2 +343,3 @@ }

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

@@ -478,2 +491,9 @@ type BaseNavigateOptions = BaseNavigateOrFetchOptions & {

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 {

@@ -485,3 +505,5 @@ basename?: string;

detectErrorBoundary?: DetectErrorBoundaryFunction;
unstable_dataStrategy?: DataStrategyFunction;
mapRouteProperties?: MapRoutePropertiesFunction;
future?: Partial<StaticHandlerFutureConfig>;
}

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

/**
* @remix-run/router v0.0.0-experimental-a077dc2d
* @remix-run/router v0.0.0-experimental-a0888892
*

@@ -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=x(("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],E(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=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+'".'),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=R({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:j(A([o,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(o=A([o,c.pathnameBase]))}return n}function R(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 E(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 x(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 S(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:k(a),hash:C(o)}}function P(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 L(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("?"),P("?","pathname","search",i)),o(!i.pathname||!i.pathname.includes("#"),P("#","pathname","hash",i)),o(!i.search||!i.search.includes("#"),P("#","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=S(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,"/"),j=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),k=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",C=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class U extends Error{}class T{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 U("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 U)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 _=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"],H=new Set(q),N=["get",...q],B=new Set(N),F=new Set([301,302,303,307,308]),W=new Set([307,308]),$={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},K={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},J={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Y=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,V=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),X="remix-router-transitions";const G=Symbol("deferred");function Q(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||".",L(s).map((e=>e.pathnameBase)),x(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||Pe(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 Z(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&&!Re(a.formMethod))return{path:r,error:pe(405,{method:a.formMethod})};let n,i,s=()=>({path:r,error:pe(400,{type:"invalid-body"})}),d=a.formMethod||"get",u=e?d.toUpperCase():d.toLowerCase(),h=ye(r);if(void 0!==a.body){if("text/plain"===a.formEncType){if(!Ee(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(!Ee(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=se(a.formData),i=a.formData;else if(a.body instanceof FormData)n=se(a.body),i=a.body;else if(a.body instanceof URLSearchParams)n=a.body,i=le(n);else if(null==a.body)n=new URLSearchParams,i=new FormData;else try{n=new URLSearchParams(a.body),i=le(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(Ee(f.formMethod))return{path:r,submission:f};let p=c(r);return t&&p.search&&Pe(p.search)&&n.append("index",""),p.search="?"+n,{path:l(p),submission:f}}function ee(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 te(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=ee(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 ae(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||re(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=Le(s,e.path),m=!1;m=!d.has(n)&&(!!l.includes(n)||(c&&"idle"!==c.state&&void 0===c.data?i:ae(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 re(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function ae(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}async function oe(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 ne(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){let e,t=await Promise.all([f(a).catch((t=>{e=t})),oe(r.route,i,n)]);if(e)throw e;d=t[0]}else{if(await oe(r.route,i,n),a=r.route[e],!a){if("action"===e){let e=new URL(t.url),a=e.pathname+e.search;throw pe(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 pe(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(De(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!=x(a.pathname,s);a.origin===r.origin&&o&&(e=a.pathname+a.search+a.hash)}}else e=Q(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 I(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}:we(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 ie(e,t,r,a){let o=e.createURL(ye(t)).toString(),n={signal:r};if(a&&Ee(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=se(a.formData):n.body=a.formData}return new Request(o,n)}function se(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,"string"==typeof a?a:a.name);return t}function le(e){let t=new FormData;for(let[r,a]of e.entries())t.append(r,a);return t}function ce(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(!be(r),"Cannot handle redirect results in processLoaderData"),ge(r)){let t=he(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 ve(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 de(e,r,a,n,i,s,l,c){let{loaderData:d,errors:u}=ce(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(ge(c)){let r=he(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(be(c))o(!1,"Unhandled fetcher revalidation redirect");else if(ve(c))o(!1,"Unhandled fetcher deferred data");else{let t=Ce(c.data);e.fetchers.set(a,t)}}return{loaderData:d,errors:u}}function ue(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 he(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 fe(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 pe(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 me(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(be(r))return{result:r,idx:t}}}function ye(e){return l(t({},"string"==typeof e?c(e):e,{hash:""}))}function ve(e){return e.type===u.deferred}function ge(e){return e.type===u.error}function be(e){return(e&&e.type)===u.redirect}function we(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 De(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function Re(e){return B.has(e.toLowerCase())}function Ee(e){return H.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&&!re(d,c)&&void 0!==(i&&i[c.route.id]);if(ve(l)&&(n||u)){let e=a[s];o(e,"Expected an AbortSignal for revalidating fetcher deferred result"),await Se(l,e,n).then((e=>{e&&(r[s]=e||r[s])}))}}}async function Se(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 Pe(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function Le(e,t){let r="string"==typeof t?c(t).search:t.search;if(e[e.length-1].route.index&&Pe(r||""))return e[e.length-1];let a=L(e);return a[a.length-1]}function Me(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 Ae(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 je(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 ke(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=U,e.Action=r,e.IDLE_BLOCKER=J,e.IDLE_FETCHER=K,e.IDLE_NAVIGATION=$,e.UNSAFE_DEFERRED_SYMBOL=G,e.UNSAFE_DeferredData=T,e.UNSAFE_ErrorResponseImpl=I,e.UNSAFE_convertRouteMatchToUiMatch=m,e.UNSAFE_convertRoutesToDataRoutes=f,e.UNSAFE_getPathContributingMatches=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=V;let d,h={},y=f(e.routes,c,void 0,h),v=e.basename||"/",g=t({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_prependBasename:!1},e.future),b=null,w=new Set,D=null,R=null,E=null,S=null!=e.hydrationData,P=p(y,e.history.location,v),L=null;if(null==P){let t=pe(404,{pathname:e.history.location.pathname}),{matches:r,route:a}=fe(y);P=r,L={[a.id]:t}}let M,A,j=!(P.some((e=>e.route.lazy))||P.some((e=>e.route.loader))&&null==e.hydrationData),k={historyAction:e.history.action,location:e.history.location,matches:P,initialized:j,navigation:$,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,T=!1,O=new Map,_=null,I=!1,z=!1,q=[],H=[],N=new Map,B=0,F=-1,G=new Map,ee=new Set,re=new Map,ae=new Set,oe=new Map,se=new Map,le=!1;function ce(e,r){k=t({},k,e),w.forEach((e=>e(k,{unstable_viewTransitionOpts:r}))),g.v7_fetcherPersist&&k.fetchers.forEach(((e,t)=>{"idle"===e.state&&(ae.has(t)?Oe(t):k.fetchers.delete(t))}))}function ye(a,o){var n,i;let s,l=null!=k.actionData&&null!=k.navigation.formMethod&&Ee(k.navigation.formMethod)&&"loading"===k.navigation.state&&!0!==(null==(n=a.state)?void 0:n._isRedirect);s=o.actionData?Object.keys(o.actionData).length>0?o.actionData:null:l?k.actionData:null;let c=o.loaderData?ue(k.loaderData,o.loaderData,o.matches||[],o.errors):k.loaderData,u=k.blockers;u.size>0&&(u=new Map(u),u.forEach(((e,t)=>u.set(t,J))));let h,f=!0===U||null!=k.navigation.formMethod&&Ee(k.navigation.formMethod)&&!0!==(null==(i=a.state)?void 0:i._isRedirect);if(d&&(y=d,d=void 0),I||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=O.get(k.location.pathname);e&&e.has(a.pathname)?h={currentLocation:k.location,nextLocation:a}:O.has(a.pathname)&&(h={currentLocation:a,nextLocation:k.location})}else if(T){let e=O.get(k.location.pathname);e?e.add(a.pathname):(e=new Set([a.pathname]),O.set(k.location.pathname,e)),h={currentLocation:k.location,nextLocation:a}}ce(t({},o,{actionData:s,loaderData:c,historyAction:C,location:a,initialized:!0,navigation:$,revalidation:"idle",restoreScrollPosition:$e(a,o.matches||k.matches),preventScrollReset:f,blockers:u}),h),C=r.Pop,U=!1,T=!1,I=!1,z=!1,q=[],H=[]}async function we(a,o,n){A&&A.abort(),A=null,C=a,I=!0===(n&&n.startUninterruptedRevalidation),function(e,t){if(D&&E){let r=We(e,t);D[r]=E()}}(k.location,k.matches),U=!0===(n&&n.preventScrollReset),T=!0===(n&&n.enableViewTransition);let i=d||y,s=n&&n.overrideNavigation,l=p(i,o,v);if(!l){let e=pe(404,{pathname:o.pathname}),{matches:t,route:r}=fe(i);return Fe(),void ye(o,{matches:t,loaderData:{},errors:{[r.id]:e}})}if(k.initialized&&!z&&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}(k.location,o)&&!(n&&n.submission&&Ee(n.submission.formMethod)))return void ye(o,{matches:l});A=new AbortController;let f,m,g=ie(e.history,o,A.signal,n&&n.submission);if(n&&n.pendingError)m={[he(l).route.id]:n.pendingError};else if(n&&n.submission&&Ee(n.submission.formMethod)){let e=await async function(e,t,a,o,n){void 0===n&&(n={});let i;Ue(),ce({navigation:je(t,a)});let s=Le(o,t);if(s.route.action||s.route.lazy){if(i=await ne("action",e,s,o,h,c,v),e.signal.aborted)return{shortCircuited:!0}}else i={type:u.error,error:pe(405,{method:e.method,pathname:t.pathname,routeId:s.route.id})};if(be(i)){let e;return e=n&&null!=n.replace?n.replace:i.location===k.location.pathname+k.location.search,await Re(k,i,{submission:a,replace:e}),{shortCircuited:!0}}if(ge(i)){let e=he(o,s.route.id);return!0!==(n&&n.replace)&&(C=r.Push),{pendingActionData:{},pendingActionError:{[e.route.id]:i.error}}}if(ve(i))throw pe(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,m=e.pendingActionError,s=Ae(o,n.submission),g=new Request(g.url,{signal:g.signal})}let{shortCircuited:b,loaderData:w,errors:R}=await async function(r,a,o,n,i,s,l,c,u){let h=n||Ae(a,i),f=i||s||Me(h),p=d||y,[m,g]=te(e.history,k,o,f,a,z,q,H,re,ee,p,v,c,u);if(Fe((e=>!(o&&o.some((t=>t.route.id===e)))||m&&m.some((t=>t.route.id===e)))),F=++B,0===m.length&&0===g.length){let e=ze();return ye(a,t({matches:o,loaderData:{},errors:u||null},c?{actionData:c}:{},e?{fetchers:new Map(k.fetchers)}:{})),{shortCircuited:!0}}if(!I){g.forEach((e=>{let t=k.fetchers.get(e.key),r=ke(void 0,t?t.data:void 0);k.fetchers.set(e.key,r)}));let e=c||k.actionData;ce(t({navigation:h},e?0===Object.keys(e).length?{actionData:null}:{actionData:e}:{},g.length>0?{fetchers:new Map(k.fetchers)}:{}))}g.forEach((e=>{N.has(e.key)&&_e(e.key),e.controller&&N.set(e.key,e.controller)}));let b=()=>g.forEach((e=>_e(e.key)));A&&A.signal.addEventListener("abort",b);let{results:w,loaderResults:D,fetcherResults:R}=await Pe(k.matches,o,m,g,r);if(r.signal.aborted)return{shortCircuited:!0};A&&A.signal.removeEventListener("abort",b);g.forEach((e=>N.delete(e.key)));let E=me(w);if(E){if(E.idx>=m.length){let e=g[E.idx-m.length].key;ee.add(e)}return await Re(k,E.result,{replace:l}),{shortCircuited:!0}}let{loaderData:x,errors:S}=de(k,o,m,D,u,g,R,oe);oe.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&oe.delete(t)}))}));let P=ze(),L=qe(F),M=P||L||g.length>0;return t({loaderData:x,errors:S},M?{fetchers:new Map(k.fetchers)}:{})}(g,o,l,s,n&&n.submission,n&&n.fetcherSubmission,n&&n.replace,f,m);b||(A=null,ye(o,t({matches:l},f?{actionData:f}:{},{loaderData:w,errors:R})))}function De(e){return k.fetchers.get(e)||K}async function Re(n,l,c){let{submission:d,fetcherSubmission:u,replace:h}=void 0===c?{}:c;l.revalidate&&(z=!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==x(r.pathname,v)}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:y,formEncType:g}=n.navigation;!d&&!u&&m&&y&&g&&(d=Me(n.navigation));let b=d||u;if(W.has(l.status)&&b&&Ee(b.formMethod))await we(p,f,{submission:t({},b,{formAction:l.location}),preventScrollReset:U});else{let e=Ae(f,d);await we(p,f,{overrideNavigation:e,fetcherSubmission:u,preventScrollReset:U})}}async function Pe(t,r,a,o,n){let i=await Promise.all([...a.map((e=>ne("loader",n,e,r,h,c,v))),...o.map((t=>{if(t.matches&&t.match&&t.controller)return ne("loader",ie(e.history,t.path,t.controller.signal),t.match,t.matches,h,c,v);return{type:u.error,error:pe(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,k.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(){z=!0,q.push(...Fe()),re.forEach(((e,t)=>{N.has(t)&&(H.push(t),_e(t))}))}function Te(e,t,r){let a=he(k.matches,t);Oe(e),ce({errors:{[a.route.id]:r},fetchers:new Map(k.fetchers)})}function Oe(e){let t=k.fetchers.get(e);!N.has(e)||t&&"loading"===t.state&&G.has(e)||_e(e),re.delete(e),G.delete(e),ee.delete(e),ae.delete(e),k.fetchers.delete(e)}function _e(e){let t=N.get(e);o(t,"Expected fetch controller: "+e),t.abort(),N.delete(e)}function Ie(e){for(let t of e){let e=Ce(De(t).data);k.fetchers.set(t,e)}}function ze(){let e=[],t=!1;for(let r of ee){let a=k.fetchers.get(r);o(a,"Expected fetcher: "+r),"loading"===a.state&&(ee.delete(r),e.push(r),t=!0)}return Ie(e),t}function qe(e){let t=[];for(let[r,a]of G)if(a<e){let e=k.fetchers.get(r);o(e,"Expected fetcher: "+r),"loading"===e.state&&(_e(r),G.delete(r),t.push(r))}return Ie(t),t.length>0}function He(e){k.blockers.delete(e),se.delete(e)}function Ne(e,t){let r=k.blockers.get(e)||J;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(k.blockers);a.set(e,t),ce({blockers:a})}function Be(e){let{currentLocation:t,nextLocation:r,historyAction:a}=e;if(0===se.size)return;se.size>1&&n(!1,"A router only supports one blocker at a time");let o=Array.from(se.entries()),[i,s]=o[o.length-1],l=k.blockers.get(i);return l&&"proceeding"===l.state?void 0:s({currentLocation:t,nextLocation:r,historyAction:a})?i:void 0}function Fe(e){let t=[];return oe.forEach(((r,a)=>{e&&!e(a)||(r.cancel(),t.push(a),oe.delete(a))})),t}function We(e,t){if(R){return R(e,t.map((e=>m(e,k.loaderData))))||e.key}return e.key}function $e(e,t){if(D){let r=We(e,t),a=D[r];if("number"==typeof a)return a}return null}return M={get basename(){return v},get state(){return k},get routes(){return y},get window(){return a},initialize:function(){if(b=e.history.listen((t=>{let{action:r,location:a,delta:o}=t;if(le)return void(le=!1);n(0===se.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=Be({currentLocation:k.location,nextLocation:a,historyAction:r});return i&&null!=o?(le=!0,e.history.go(-1*o),void Ne(i,{state:"blocked",location:a,proceed(){Ne(i,{state:"proceeding",proceed:void 0,reset:void 0,location:a}),e.history.go(o)},reset(){let e=new Map(k.blockers);e.set(i,J),ce({blockers:e})}})):we(r,a)})),i){!function(e,t){try{let r=e.sessionStorage.getItem(X);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,O);let e=()=>function(e,t){if(t.size>0){let r={};for(let[e,a]of t)r[e]=[...a];try{e.sessionStorage.setItem(X,JSON.stringify(r))}catch(e){n(!1,"Failed to save applied view transitions in sessionStorage ("+e+").")}}}(a,O);a.addEventListener("pagehide",e),_=()=>a.removeEventListener("pagehide",e)}return k.initialized||we(r.Pop,k.location),M},subscribe:function(e){return w.add(e),()=>w.delete(e)},enableScrollRestoration:function(e,t,r){if(D=e,E=t,R=r||null,!S&&k.navigation===$){S=!0;let e=$e(k.location,k.matches);null!=e&&ce({restoreScrollPosition:e})}return()=>{D=null,E=null,R=null}},navigate:async function a(o,n){if("number"==typeof o)return void e.history.go(o);let i=Q(k.location,k.matches,v,g.v7_prependBasename,o,null==n?void 0:n.fromRouteId,null==n?void 0:n.relative),{path:l,submission:c,error:d}=Z(g.v7_normalizeFormMethod,!1,i,n),u=k.location,h=s(k.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&&Ee(c.formMethod)&&c.formAction===k.location.pathname+k.location.search&&(p=r.Replace);let m=n&&"preventScrollReset"in n?!0===n.preventScrollReset:void 0,y=Be({currentLocation:u,nextLocation:h,historyAction:p});if(!y)return await we(p,h,{submission:c,pendingError:d,preventScrollReset:m,replace:n&&n.replace,enableViewTransition:n&&n.unstable_viewTransition});Ne(y,{state:"blocked",location:h,proceed(){Ne(y,{state:"proceeding",proceed:void 0,reset:void 0,location:h}),a(o,n)},reset(){let e=new Map(k.blockers);e.set(y,J),ce({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.");N.has(t)&&_e(t);let i=d||y,s=Q(k.location,k.matches,v,g.v7_prependBasename,a,r,null==n?void 0:n.relative),u=p(i,s,v);if(!u)return void Te(t,r,pe(404,{pathname:s}));let{path:f,submission:m,error:b}=Z(g.v7_normalizeFormMethod,!0,s,n);if(b)return void Te(t,r,b);let w=Le(u,f);U=!0===(n&&n.preventScrollReset),m&&Ee(m.formMethod)?async function(t,r,a,n,i,s){if(Ue(),re.delete(t),!n.route.action&&!n.route.lazy){let e=pe(405,{method:s.formMethod,pathname:a,routeId:r});return void Te(t,r,e)}let l=k.fetchers.get(t),u=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}}(s,l);k.fetchers.set(t,u),ce({fetchers:new Map(k.fetchers)});let f=new AbortController,m=ie(e.history,a,f.signal,s);N.set(t,f);let g=B,b=await ne("action",m,n,i,h,c,v);if(m.signal.aborted)return void(N.get(t)===f&&N.delete(t));if(be(b)){if(N.delete(t),F>g){let e=Ce(void 0);return k.fetchers.set(t,e),void ce({fetchers:new Map(k.fetchers)})}{ee.add(t);let e=ke(s);return k.fetchers.set(t,e),ce({fetchers:new Map(k.fetchers)}),Re(k,b,{fetcherSubmission:s})}}if(ge(b))return void Te(t,r,b.error);if(ve(b))throw pe(400,{type:"defer-action"});let w=k.navigation.location||k.location,D=ie(e.history,w,f.signal),R=d||y,E="idle"!==k.navigation.state?p(R,k.navigation.location,v):k.matches;o(E,"Didn't find any matches after fetcher action");let x=++B;G.set(t,x);let S=ke(s,b.data);k.fetchers.set(t,S);let[P,L]=te(e.history,k,E,s,w,z,q,H,re,ee,R,v,{[n.route.id]:b.data},void 0);L.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,r=k.fetchers.get(t),a=ke(void 0,r?r.data:void 0);k.fetchers.set(t,a),N.has(t)&&_e(t),e.controller&&N.set(t,e.controller)})),ce({fetchers:new Map(k.fetchers)});let M=()=>L.forEach((e=>_e(e.key)));f.signal.addEventListener("abort",M);let{results:j,loaderResults:U,fetcherResults:T}=await Pe(k.matches,E,P,L,D);if(f.signal.aborted)return;f.signal.removeEventListener("abort",M),G.delete(t),N.delete(t),L.forEach((e=>N.delete(e.key)));let O=me(j);if(O){if(O.idx>=P.length){let e=L[O.idx-P.length].key;ee.add(e)}return Re(k,O.result)}let{loaderData:_,errors:I}=de(k,k.matches,P,U,void 0,L,T,oe);if(k.fetchers.has(t)){let e=Ce(b.data);k.fetchers.set(t,e)}qe(x),"loading"===k.navigation.state&&x>F?(o(C,"Expected pending action"),A&&A.abort(),ye(k.navigation.location,{matches:E,loaderData:_,errors:I,fetchers:new Map(k.fetchers)})):(ce({errors:I,loaderData:ue(k.loaderData,_,E,I),fetchers:new Map(k.fetchers)}),z=!1)}(t,r,f,w,u,m):(re.set(t,{routeId:r,path:f}),async function(t,r,a,n,i,s){let l=k.fetchers.get(t),d=ke(s,l?l.data:void 0);k.fetchers.set(t,d),ce({fetchers:new Map(k.fetchers)});let u=new AbortController,f=ie(e.history,a,u.signal);N.set(t,u);let p=B,m=await ne("loader",f,n,i,h,c,v);ve(m)&&(m=await Se(m,f.signal,!0)||m);N.get(t)===u&&N.delete(t);if(f.signal.aborted)return;if(be(m)){if(F>p){let e=Ce(void 0);return k.fetchers.set(t,e),void ce({fetchers:new Map(k.fetchers)})}return ee.add(t),void await Re(k,m)}if(ge(m)){let e=he(k.matches,r);return k.fetchers.delete(t),void ce({fetchers:new Map(k.fetchers),errors:{[e.route.id]:m.error}})}o(!ve(m),"Unhandled fetcher deferred data");let y=Ce(m.data);k.fetchers.set(t,y),ce({fetchers:new Map(k.fetchers)})}(t,r,f,w,u,m))},revalidate:function(){Ue(),ce({revalidation:"loading"}),"submitting"!==k.navigation.state&&("idle"!==k.navigation.state?we(C||k.historyAction,k.navigation.location,{overrideNavigation:k.navigation}):we(k.historyAction,k.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:De,deleteFetcher:function(e){g.v7_fetcherPersist?ae.add(e):Oe(e),ce({fetchers:new Map(k.fetchers)})},dispose:function(){b&&b(),_&&_(),w.clear(),A&&A.abort(),k.fetchers.forEach(((e,t)=>Oe(t))),k.blockers.forEach(((e,t)=>He(t)))},getBlocker:function(e,t){let r=k.blockers.get(e)||J;return se.get(e)!==t&&se.set(e,t),r},deleteBlocker:He,_internalFetchControllers:N,_internalActiveDeferreds:oe,_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=V;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(Ee(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 ne("action",e,o,r,n,a,i,{isStaticRequest:!0,isRouteRequest:l,requestContext:s}),e.signal.aborted){throw new Error((l?"queryRoute":"query")+"() call aborted: "+e.method+" "+e.url)}}else{let t=pe(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(be(c))throw new Response(null,{status:c.status,headers:{Location:c.location}});if(ve(c)){let e=pe(400,{type:"defer-action"});if(l)throw e;c={type:u.error,error:e}}if(l){if(ge(c))throw c.error;return{matches:[o],loaderData:{},actionData:{[o.route.id]:c.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(ge(c)){let a=he(r,o.route.id);return t({},await h(e,r,s,void 0,{[a.route.id]:c.error}),{statusCode:z(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||Le(s,r),l,null!=c);return o}let o=await h(e,s,l,c);return De(o)?o:t({},o,{actionData:null,actionHeaders:{}})}catch(e){if((d=e)&&De(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(!De(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 pe(400,{method:e.method,pathname:new URL(e.url).pathname,routeId:null==s?void 0:s.route.id});let d=(s?[s]:ee(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=>ne("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: "+e.method+" "+e.url)}let h=new Map,f=ce(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(!Re(n)&&"HEAD"!==n){let e=pe(405,{method:n}),{matches:t,route:r}=fe(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=pe(404,{pathname:u.pathname}),{matches:t,route:r}=fe(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 De(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(!Re(n)&&"HEAD"!==n&&"OPTIONS"!==n)throw pe(405,{method:n});if(!h)throw pe(404,{pathname:u.pathname});let f=r?h.find((e=>e.route.id===r)):Le(h,u);if(r&&!f)throw pe(403,{pathname:u.pathname,routeId:r});if(!f)throw pe(404,{pathname:u.pathname});let m=await d(e,u,h,a,f);if(De(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[G]=m.activeDeferreds[f.route.id]),e}}}},e.defer=function(e,t){return void 0===t&&(t={}),new T(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=we,e.isRouteErrorResponse=z,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=R,e.matchRoutes=p,e.normalizePathname=j,e.parsePath=c,e.redirect=_,e.redirectDocument=(e,t)=>{let r=_(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r},e.resolvePath=S,e.resolveTo=M,e.stripBasename=x,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?u(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 u(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,u,d){void 0===d&&(d={});let{window:c=document.defaultView,v5Compat:h=!1}=d,f=c.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"!==c.location.origin?c.location.origin:c.location.href,r="string"==typeof e?e:l(e);return r=r.replace(/ $/,"%20"),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(c,f)},listen(e){if(m)throw new Error("A history only accepts one active listener");return c.addEventListener(a,g),m=e,()=>{c.removeEventListener(a,g),m=null}},createHref:e=>n(c,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);u&&u(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;c.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);u&&u(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 c=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=R(("string"==typeof t?u(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){let t=E(a);n=D(o[e],t)}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]),u=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,u,l)),(null!=e.path||e.index)&&t.push({path:l,score:w(l,e.index),routesMeta:u})};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)||"/",u=S({path:i.relativePath,caseSensitive:i.caseSensitive,end:s},l);if(!u)return null;Object.assign(a,u.params);let d=i.route;n.push({params:a,pathname:j([o,u.pathname]),pathnameBase:k(j([o,u.pathnameBase])),route:d}),"/"!==u.pathnameBase&&(o=j([o,u.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 n=l[r];return e[a]=o&&!n?void 0:(n||"").replace(/%2F/g,"/"),e}),{}),pathname:i,pathnameBase:s,pattern:e}}function E(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}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 R(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?u(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 L(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function A(e,t){let r=L(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=u(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 c=P(i,s),h=d&&"/"!==d&&d.endsWith("/"),f=(l||"."===d)&&a.endsWith("/");return c.pathname.endsWith("/")||!h&&!f||(c.pathname+="/"),c}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 O 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 O("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 O)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]:C(a)})}),{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function C(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 F=["post","put","patch","delete"],B=new Set(F),N=["get",...F],W=new Set(N),$=new Set([301,302,303,307,308]),q=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},Y={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},J={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 u,d;if(i){u=[];for(let e of t)if(u.push(e),e.route.id===i){d=e;break}}else u=t,d=t[t.length-1];let c=M(o||".",A(u,n),R(e.pathname,r)||e.pathname,"path"===s);return null==o&&(c.search=e.search,c.hash=e.hash),null!=o&&""!==o&&"."!==o||!d||!d.route.index||_e(c.search)||(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),a&&"/"!==r&&(c.pathname="/"===c.pathname?r:j([r,c.pathname])),l(c)}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&&!Ae(a.formMethod))return{path:r,error:be(405,{method:a.formMethod})};let n,i,s=()=>({path:r,error:be(400,{type:"invalid-body"})}),d=a.formMethod||"get",c=e?d.toUpperCase():d.toLowerCase(),h=De(r);if(void 0!==a.body){if("text/plain"===a.formEncType){if(!Me(c))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:c,formAction:h,formEncType:a.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===a.formEncType){if(!Me(c))return s();try{let e="string"==typeof a.body?JSON.parse(a.body):a.body;return{path:r,submission:{formMethod:c,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=he(a.formData),i=a.formData;else if(a.body instanceof FormData)n=he(a.body),i=a.body;else if(a.body instanceof URLSearchParams)n=a.body,i=fe(n);else if(null==a.body)n=new URLSearchParams,i=new FormData;else try{n=new URLSearchParams(a.body),i=fe(n)}catch(e){return s()}let f={formMethod:c,formAction:h,formEncType:a&&a.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(Me(f.formMethod))return{path:r,submission:f};let p=u(r);return t&&p.search&&_e(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,u,d,c,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!("function"==typeof n.loader&&!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 u=r.matches[a],d=e;return ne(e,t({currentUrl:b,currentParams:u.params,nextUrl:w,nextParams:d.params},o,{actionResult:g,defaultShouldRevalidate:s||b.pathname+b.search===w.pathname+w.search||b.search!==w.search||oe(u,d)}))})),E=[];return c.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 E.push({key:n,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let c=r.fetchers.get(n),y=Te(l,e.path),v=!1;v=!h.has(n)&&(!!u.includes(n)||(c&&"idle"!==c.state&&void 0===c.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&&E.push({key:n,routeId:e.routeId,path:e.path,matches:l,match:y,controller:new AbortController})})),[S,E]}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 e;let i=await e.lazy();if(!e.lazy)return e;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])}return Object.assign(s,l),Object.assign(s,t({},r(s),{lazy:void 0})),s}function se(e){return Promise.all(e.matches.map((e=>e.bikeshed_loadRoute())))}async function le(e,r,a,n,i,s,l,u){let d=n.reduce(((e,t)=>e.add(t.route.id)),new Set),h=new Set,f=await e({matches:i.map((e=>t({},e,{bikeshed_loadRoute:t=>(h.add(e.route.id),d.has(e.route.id)?async function(e,t,r,a,n,i,s){let l,u,d=a=>{let o,n=new Promise(((e,t)=>o=t));u=()=>o(),t.signal.addEventListener("abort",u);let l=o=>"function"!=typeof a?Promise.reject(new Error('You cannot call the handler for a route which defines a boolean "'+e+'" [routeId: '+r.route.id+"]")):a({request:t,params:r.params,context:s},...void 0!==o?[o]:[]),d=i?i((async e=>l(e))):l();return Promise.race([d,n])};try{let i=r.route[e];if(r.route.lazy)if(i){let e,t=await Promise.all([d(i).catch((t=>{e=t})),ie(r.route,n,a)]);if(e)throw e;l=t[0]}else{if(await ie(r.route,n,a),i=r.route[e],!i){if("action"===e){let e=new URL(t.url),a=e.pathname+e.search;throw be(405,{method:t.method,pathname:a,routeId:r.route.id})}return{type:c.data,result:void 0}}l=await d(i)}else{if(!i){let e=new URL(t.url);throw be(404,{pathname:e.pathname+e.search})}l=await d(i)}o(void 0!==l,"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){return{type:c.error,result:e}}finally{u&&t.signal.removeEventListener("abort",u)}return{type:c.data,result:l}}(r,a,e,s,l,t,u):Promise.resolve({type:c.data,result:void 0}))}))),request:a,params:i[0].params});return i.forEach((e=>o(h.has(e.route.id),'`match.bikeshed_loadRoute()` was not called for route id "'+e.route.id+'". You must call `match.bikeshed_loadRoute()` on every match passed to `dataStrategy` to ensure all routes are properly loaded.'))),f.filter(((e,t)=>d.has(i[t].route.id)))}async function ue(e){let{result:t,type:r}=e;if(Le(t)){let e;try{let r=t.headers.get("Content-Type");e=r&&/\bapplication\/json\b/.test(r)?null==t.body?null:await t.json():await t.text()}catch(e){return{type:c.error,error:e}}return r===c.error?{type:r,error:new I(t.status,t.statusText,e),response:t}:{type:c.data,data:e,response:t}}return r===c.error?{type:r,error:t}:xe(t)?{type:c.deferred,deferredData:t,statusCode:null==(a=t.init)?void 0:a.status,headers:(null==(o=t.init)?void 0:o.headers)&&new Headers(t.init.headers)}:{type:c.data,data:t};var a,o}function de(e,t,r,a,n,i){let s=e.headers.get("Location");if(o(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!V.test(s)){let o=a.slice(0,a.findIndex((e=>e.route.id===r))+1);s=ee(new URL(t.url),o,n,!0,s,i),e.headers.set("Location",s)}return e}function ce(e,t,r,a){let o=e.createURL(De(t)).toString(),n={signal:r};if(a&&Me(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=he(a.formData):n.body=a.formData}return new Request(o,n)}function he(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,"string"==typeof a?a:a.name);return t}function fe(e){let t=new FormData;for(let[r,a]of e.entries())t.append(r,a);return t}function pe(e,t,r,a,n){let i,s={},l=null,u=!1,d={};return r.forEach(((r,c)=>{let h=t[c].route.id;if(o(!Pe(r),"Cannot handle redirect results in processLoaderData"),Re(r)){let t=ve(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,u||(u=!0,i=z(r.error)?r.error.status:500),r.response&&(d[h]=r.response.headers)}else Ee(r)?(n.set(h,r.deferredData),s[h]=r.deferredData.data,null==r.statusCode||200===r.statusCode||u||(i=r.statusCode),r.headers&&(d[h]=r.headers)):(s[h]=r.data,r.response&&(200===r.response.status||u||(i=r.response.status),d[h]=r.response.headers))})),a&&(l=a,s[Object.keys(a)[0]]=void 0),{loaderData:s,errors:l,statusCode:i||200,loaderHeaders:d}}function me(e,r,a,n,i,s,l,u){let{loaderData:d,errors:c}=pe(r,a,n,i,u);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 u=l[r];if(!i||!i.signal.aborted)if(Re(u)){let r=ve(e.matches,null==n?void 0:n.route.id);c&&c[r.route.id]||(c=t({},c,{[r.route.id]:u.error})),e.fetchers.delete(a)}else if(Pe(u))o(!1,"Unhandled fetcher revalidation redirect");else if(Ee(u))o(!1,"Unhandled fetcher deferred data");else{let t=Ie(u.data);e.fetchers.set(a,t)}}return{loaderData:d,errors:c}}function ye(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 ve(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 ge(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 be(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 we(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(Pe(r))return{result:r,idx:t}}}function De(e){return l(t({},"string"==typeof e?u(e):e,{hash:""}))}function Se(e){return Le(e.result)&&$.has(e.result.status)}function Ee(e){return e.type===c.deferred}function Re(e){return e.type===c.error}function Pe(e){return(e&&e.type)===c.redirect}function xe(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 Le(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function Ae(e){return W.has(e.toLowerCase())}function Me(e){return B.has(e.toLowerCase())}async function je(e,t,r,a,n,i){for(let s=0;s<r.length;s++){let l=r[s],u=t[s];if(!u)continue;let d=e.find((e=>e.route.id===u.route.id)),c=null!=d&&!oe(d,u)&&void 0!==(i&&i[u.route.id]);if(Ee(l)&&(n||c)){let e=a[s];o(e,"Expected an AbortSignal for revalidating fetcher deferred result"),await ke(l,e,n).then((e=>{e&&(r[s]=e||r[s])}))}}}async function ke(e,t,r){if(void 0===r&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:c.data,data:e.deferredData.unwrappedData}}catch(e){return{type:c.error,error:e}}return{type:c.data,data:e.deferredData.data}}}function _e(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function Te(e,t){let r="string"==typeof t?u(t).search:t.search;if(e[e.length-1].route.index&&_e(r||""))return e[e.length-1];let a=L(e);return a[a.length-1]}function Oe(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 Ue(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 Ce(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 He(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 Ie(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=O,e.Action=r,e.IDLE_BLOCKER=J,e.IDLE_FETCHER=Y,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=A,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=""}=u(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),c=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 c},get location(){return p()},createHref:y,createURL:e=>new URL(y(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?u(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,a){c=r.Push;let o=m(e,a);d+=1,t.splice(d,t.length,o),i&&h&&h({action:c,location:o,delta:1})},replace(e,a){c=r.Replace;let o=m(e,a);t[d]=o,i&&h&&h({action:c,location:o,delta:0})},go(e){c=r.Pop;let a=f(d+e),o=t[a];d=a,h&&h({action:c,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 u;if(o(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)u=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;u=e=>({hasErrorBoundary:t(e)})}else u=X;let d,h,y={},v=f(e.routes,u,void 0,y),g=e.basename||"/",b=e.unstable_dataStrategy||se,w=t({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1},e.future),D=null,S=new Set,E=null,P=null,x=null,L=null!=e.hydrationData,A=p(v,e.history.location,g),M=null;if(null==A){let t=be(404,{pathname:e.history.location.pathname}),{matches:r,route:a}=ge(v);A=r,M={[a.id]:t}}let j,k=A.some((e=>e.route.lazy)),_=A.some((e=>e.route.loader));if(k)h=!1;else if(_)if(w.v7_partialHydration){let t=e.hydrationData?e.hydrationData.loaderData:null,r=e.hydrationData?e.hydrationData.errors:null;h=A.every((e=>e.route.loader&&("function"!=typeof 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,O={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||M,fetchers:new Map,blockers:new Map},U=r.Pop,C=!1,H=!1,I=new Map,z=null,F=!1,B=!1,N=[],W=[],$=new Map,Q=0,Z=-1,re=new Map,oe=new Set,ne=new Map,ie=new Map,he=new Set,fe=new Map,pe=new Map,De=!1;function xe(e,r){void 0===r&&(r={}),O=t({},O,e);let a=[],o=[];w.v7_fetcherPersist&&O.fetchers.forEach(((e,t)=>{"idle"===e.state&&(he.has(t)?o.push(t):a.push(t))})),[...S].forEach((e=>e(O,{deletedFetchers:o,unstable_viewTransitionOpts:r.viewTransitionOpts,unstable_flushSync:!0===r.flushSync}))),w.v7_fetcherPersist&&(a.forEach((e=>O.fetchers.delete(e))),o.forEach((e=>qe(e))))}function Le(a,o,n){var i,s;let l,{flushSync:u}=void 0===n?{}:n,c=null!=O.actionData&&null!=O.navigation.formMethod&&Me(O.navigation.formMethod)&&"loading"===O.navigation.state&&!0!==(null==(i=a.state)?void 0:i._isRedirect);l=o.actionData?Object.keys(o.actionData).length>0?o.actionData:null:c?O.actionData:null;let h=o.loaderData?ye(O.loaderData,o.loaderData,o.matches||[],o.errors):O.loaderData,f=O.blockers;f.size>0&&(f=new Map(f),f.forEach(((e,t)=>f.set(t,J))));let p,m=!0===C||null!=O.navigation.formMethod&&Me(O.navigation.formMethod)&&!0!==(null==(s=a.state)?void 0:s._isRedirect);if(d&&(v=d,d=void 0),F||U===r.Pop||(U===r.Push?e.history.push(a,a.state):U===r.Replace&&e.history.replace(a,a.state)),U===r.Pop){let e=I.get(O.location.pathname);e&&e.has(a.pathname)?p={currentLocation:O.location,nextLocation:a}:I.has(a.pathname)&&(p={currentLocation:a,nextLocation:O.location})}else if(H){let e=I.get(O.location.pathname);e?e.add(a.pathname):(e=new Set([a.pathname]),I.set(O.location.pathname,e)),p={currentLocation:O.location,nextLocation:a}}xe(t({},o,{actionData:l,loaderData:h,historyAction:U,location:a,initialized:!0,navigation:K,revalidation:"idle",restoreScrollPosition:tt(a,o.matches||O.matches),preventScrollReset:m,blockers:f}),{viewTransitionOpts:p,flushSync:!0===u}),U=r.Pop,C=!1,H=!1,F=!1,B=!1,N=[],W=[]}async function Ae(a,o,n){T&&T.abort(),T=null,U=a,F=!0===(n&&n.startUninterruptedRevalidation),function(e,t){if(E&&x){let r=et(e,t);E[r]=x()}}(O.location,O.matches),C=!0===(n&&n.preventScrollReset),H=!0===(n&&n.enableViewTransition);let i=d||v,s=n&&n.overrideNavigation,l=p(i,o,g),u=!0===(n&&n.flushSync);if(!l){let e=be(404,{pathname:o.pathname}),{matches:t,route:r}=ge(i);return Ze(),void Le(o,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u})}if(O.initialized&&!B&&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}(O.location,o)&&!(n&&n.submission&&Me(n.submission.formMethod)))return void Le(o,{matches:l},{flushSync:u});T=new AbortController;let h,f,m=ce(e.history,o,T.signal,n&&n.submission);if(n&&n.pendingError)f={[ve(l).route.id]:n.pendingError};else if(n&&n.submission&&Me(n.submission.formMethod)){let e=await async function(e,t,a,o,n){void 0===n&&(n={});let i;Be(),xe({navigation:Ce(t,a)},{flushSync:!0===n.flushSync});let s=Te(o,t);if(s.route.action||s.route.lazy){if(i=(await ze("action",e,[s],o))[0],e.signal.aborted)return{shortCircuited:!0}}else i={type:c.error,error:be(405,{method:e.method,pathname:t.pathname,routeId:s.route.id})};if(Pe(i)){let t;return t=n&&null!=n.replace?n.replace:i.response.headers.get("Location")===O.location.pathname+O.location.search,await _e(e,i,{submission:a,replace:t}),{shortCircuited:!0}}if(Re(i)){let e=ve(o,s.route.id);return!0!==(n&&n.replace)&&(U=r.Push),{pendingActionData:{},pendingActionError:{[e.route.id]:i.error}}}if(Ee(i))throw be(400,{type:"defer-action"});return{pendingActionData:{[s.route.id]:i.data}}}(m,o,n.submission,l,{replace:n.replace,flushSync:u});if(e.shortCircuited)return;h=e.pendingActionData,f=e.pendingActionError,s=Ue(o,n.submission),u=!1,m=new Request(m.url,{signal:m.signal})}let{shortCircuited:y,loaderData:b,errors:D}=await async function(r,a,o,n,i,s,l,u,c,h,f){let p=n||Ue(a,i),m=i||s||Oe(p),y=d||v,[b,D]=ae(e.history,O,o,m,a,w.v7_partialHydration&&!0===u,B,N,W,he,ne,oe,y,g,h,f);if(Ze((e=>!(o&&o.some((t=>t.route.id===e)))||b&&b.some((t=>t.route.id===e)))),Z=++Q,0===b.length&&0===D.length){let e=Je();return Le(a,t({matches:o,loaderData:{},errors:f||null},h?{actionData:h}:{},e?{fetchers:new Map(O.fetchers)}:{}),{flushSync:c}),{shortCircuited:!0}}if(!(F||w.v7_partialHydration&&u)){D.forEach((e=>{let t=O.fetchers.get(e.key),r=He(void 0,t?t.data:void 0);O.fetchers.set(e.key,r)}));let e=h||O.actionData;xe(t({navigation:p},e?0===Object.keys(e).length?{actionData:null}:{actionData:e}:{},D.length>0?{fetchers:new Map(O.fetchers)}:{}),{flushSync:c})}D.forEach((e=>{$.has(e.key)&&Ke(e.key),e.controller&&$.set(e.key,e.controller)}));let S=()=>D.forEach((e=>Ke(e.key)));T&&T.signal.addEventListener("abort",S);let{loaderResults:E,fetcherResults:R}=await Fe(O.matches,o,b,D,r);if(r.signal.aborted)return{shortCircuited:!0};T&&T.signal.removeEventListener("abort",S);D.forEach((e=>$.delete(e.key)));let P=we([...E,...R]);if(P){if(P.idx>=b.length){let e=D[P.idx-b.length].key;oe.add(e)}return await _e(r,P.result,{replace:l}),{shortCircuited:!0}}let{loaderData:x,errors:L}=me(O,o,b,E,f,D,R,fe);fe.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&fe.delete(t)}))}));let A=Je(),M=Ve(Z),j=A||M||D.length>0;return t({loaderData:x,errors:L},j?{fetchers:new Map(O.fetchers)}:{})}(m,o,l,s,n&&n.submission,n&&n.fetcherSubmission,n&&n.replace,n&&!0===n.initialHydration,u,h,f);y||(T=null,Le(o,t({matches:l},h?{actionData:h}:{},{loaderData:b,errors:D})))}async function _e(n,l,u){let{submission:d,fetcherSubmission:c,replace:h}=void 0===u?{}:u;l.response.headers.has("X-Remix-Revalidate")&&(B=!0);let f=l.response.headers.get("Location");o(f,"Expected a Location header on the redirect Response");let p=s(O.location,f,{_isRedirect:!0});if(V.test(f)){let e=f,t=new URL(n.url),r=e.startsWith("//")?new URL(t.protocol+e):new URL(e),a=null!=R(r.pathname,g);r.origin===t.origin&&a&&(e=r.pathname+r.search+r.hash,p=s(O.location,e,{_isRedirect:!0}))}if(i){let t=!1;if(l.response.headers.has("X-Remix-Reload-Document"))t=!0;else if(V.test(f)){const r=e.history.createURL(f);t=r.origin!==a.location.origin||null==R(r.pathname,g)}if(t)return void(h?a.location.replace(f):a.location.assign(f))}T=null;let m=!0===h?r.Replace:r.Push,{formMethod:y,formAction:v,formEncType:b}=O.navigation;!d&&!c&&y&&v&&b&&(d=Oe(O.navigation));let w=d||c;if(q.has(l.response.status)&&w&&Me(w.formMethod))await Ae(m,p,{submission:t({},w,{formAction:f}),preventScrollReset:C});else{let e=Ue(p,d);await Ae(m,p,{overrideNavigation:e,fetcherSubmission:c,preventScrollReset:C})}}async function ze(e,t,r,a){try{let o=await le(b,e,t,r,a,y,u);return await Promise.all(o.map(((e,o)=>Se(e)?{type:c.redirect,response:de(e.result,t,r[o].route.id,a,g,w.v7_relativeSplatPath)}:ue(e))))}catch(e){return r.map((()=>({type:c.error,error:e})))}}async function Fe(t,r,a,o,n){let[i,...s]=await Promise.all([a.length?ze("loader",n,a,r):[],...o.map((t=>{if(t.matches&&t.match&&t.controller){return ze("loader",ce(e.history,t.path,t.controller.signal),[t.match],t.matches).then((e=>e[0]))}return Promise.resolve({type:c.error,error:be(404,{pathname:t.path})})}))]);return await Promise.all([je(t,a,i,i.map((()=>n.signal)),!1,O.loaderData),je(t,o.map((e=>e.match)),s,o.map((e=>e.controller?e.controller.signal:null)),!0)]),{loaderResults:i,fetcherResults:s}}function Be(){B=!0,N.push(...Ze()),ne.forEach(((e,t)=>{$.has(t)&&(W.push(t),Ke(t))}))}function Ne(e,t,r){void 0===r&&(r={}),O.fetchers.set(e,t),xe({fetchers:new Map(O.fetchers)},{flushSync:!0===(r&&r.flushSync)})}function We(e,t,r,a){void 0===a&&(a={});let o=ve(O.matches,t);qe(e),xe({errors:{[o.route.id]:r},fetchers:new Map(O.fetchers)},{flushSync:!0===(a&&a.flushSync)})}function $e(e){return w.v7_fetcherPersist&&(ie.set(e,(ie.get(e)||0)+1),he.has(e)&&he.delete(e)),O.fetchers.get(e)||Y}function qe(e){let t=O.fetchers.get(e);!$.has(e)||t&&"loading"===t.state&&re.has(e)||Ke(e),ne.delete(e),re.delete(e),oe.delete(e),he.delete(e),O.fetchers.delete(e)}function Ke(e){let t=$.get(e);o(t,"Expected fetch controller: "+e),t.abort(),$.delete(e)}function Ye(e){for(let t of e){let e=Ie($e(t).data);O.fetchers.set(t,e)}}function Je(){let e=[],t=!1;for(let r of oe){let a=O.fetchers.get(r);o(a,"Expected fetcher: "+r),"loading"===a.state&&(oe.delete(r),e.push(r),t=!0)}return Ye(e),t}function Ve(e){let t=[];for(let[r,a]of re)if(a<e){let e=O.fetchers.get(r);o(e,"Expected fetcher: "+r),"loading"===e.state&&(Ke(r),re.delete(r),t.push(r))}return Ye(t),t.length>0}function Xe(e){O.blockers.delete(e),pe.delete(e)}function Ge(e,t){let r=O.blockers.get(e)||J;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(O.blockers);a.set(e,t),xe({blockers:a})}function Qe(e){let{currentLocation:t,nextLocation:r,historyAction:a}=e;if(0===pe.size)return;pe.size>1&&n(!1,"A router only supports one blocker at a time");let o=Array.from(pe.entries()),[i,s]=o[o.length-1],l=O.blockers.get(i);return l&&"proceeding"===l.state?void 0:s({currentLocation:t,nextLocation:r,historyAction:a})?i:void 0}function Ze(e){let t=[];return fe.forEach(((r,a)=>{e&&!e(a)||(r.cancel(),t.push(a),fe.delete(a))})),t}function et(e,t){if(P){return P(e,t.map((e=>m(e,O.loaderData))))||e.key}return e.key}function tt(e,t){if(E){let r=et(e,t),a=E[r];if("number"==typeof a)return a}return null}return j={get basename(){return g},get future(){return w},get state(){return O},get routes(){return v},get window(){return a},initialize:function(){if(D=e.history.listen((t=>{let{action:r,location:a,delta:o}=t;if(De)return void(De=!1);n(0===pe.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=Qe({currentLocation:O.location,nextLocation:a,historyAction:r});return i&&null!=o?(De=!0,e.history.go(-1*o),void Ge(i,{state:"blocked",location:a,proceed(){Ge(i,{state:"proceeding",proceed:void 0,reset:void 0,location:a}),e.history.go(o)},reset(){let e=new Map(O.blockers);e.set(i,J),xe({blockers:e})}})):Ae(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,I);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,I);a.addEventListener("pagehide",e),z=()=>a.removeEventListener("pagehide",e)}return O.initialized||Ae(r.Pop,O.location,{initialHydration:!0}),j},subscribe:function(e){return S.add(e),()=>S.delete(e)},enableScrollRestoration:function(e,t,r){if(E=e,x=t,P=r||null,!L&&O.navigation===K){L=!0;let e=tt(O.location,O.matches);null!=e&&xe({restoreScrollPosition:e})}return()=>{E=null,x=null,P=null}},navigate:async function a(o,n){if("number"==typeof o)return void e.history.go(o);let i=ee(O.location,O.matches,g,w.v7_prependBasename,o,w.v7_relativeSplatPath,null==n?void 0:n.fromRouteId,null==n?void 0:n.relative),{path:l,submission:u,error:d}=te(w.v7_normalizeFormMethod,!1,i,n),c=O.location,h=s(O.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!=u&&Me(u.formMethod)&&u.formAction===O.location.pathname+O.location.search&&(p=r.Replace);let m=n&&"preventScrollReset"in n?!0===n.preventScrollReset:void 0,y=!0===(n&&n.unstable_flushSync),v=Qe({currentLocation:c,nextLocation:h,historyAction:p});if(!v)return await Ae(p,h,{submission:u,pendingError:d,preventScrollReset:m,replace:n&&n.replace,enableViewTransition:n&&n.unstable_viewTransition,flushSync:y});Ge(v,{state:"blocked",location:h,proceed(){Ge(v,{state:"proceeding",proceed:void 0,reset:void 0,location:h}),a(o,n)},reset(){let e=new Map(O.blockers);e.set(v,J),xe({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.");$.has(t)&&Ke(t);let i=!0===(n&&n.unstable_flushSync),s=d||v,u=ee(O.location,O.matches,g,w.v7_prependBasename,a,w.v7_relativeSplatPath,r,null==n?void 0:n.relative),c=p(s,u,g);if(!c)return void We(t,r,be(404,{pathname:u}),{flushSync:i});let{path:h,submission:f,error:m}=te(w.v7_normalizeFormMethod,!0,u,n);if(m)return void We(t,r,m,{flushSync:i});let y=Te(c,h);C=!0===(n&&n.preventScrollReset),f&&Me(f.formMethod)?async function(t,r,a,n,i,s,l){if(Be(),ne.delete(t),!n.route.action&&!n.route.lazy){let e=be(405,{method:l.formMethod,pathname:a,routeId:r});return void We(t,r,e,{flushSync:s})}let u=O.fetchers.get(t);Ne(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 c=new AbortController,h=ce(e.history,a,c.signal,l);$.set(t,c);let f=Q,m=(await ze("action",h,[n],i))[0];if(h.signal.aborted)return void($.get(t)===c&&$.delete(t));if(w.v7_fetcherPersist&&he.has(t)){if(Pe(m)||Re(m))return void Ne(t,Ie(void 0))}else{if(Pe(m))return $.delete(t),Z>f?void Ne(t,Ie(void 0)):(oe.add(t),Ne(t,He(l)),_e(h,m,{fetcherSubmission:l}));if(Re(m))return void We(t,r,m.error)}if(Ee(m))throw be(400,{type:"defer-action"});let y=O.navigation.location||O.location,b=ce(e.history,y,c.signal),D=d||v,S="idle"!==O.navigation.state?p(D,O.navigation.location,g):O.matches;o(S,"Didn't find any matches after fetcher action");let E=++Q;re.set(t,E);let R=He(l,m.data);O.fetchers.set(t,R);let[P,x]=ae(e.history,O,S,l,y,!1,B,N,W,he,ne,oe,D,g,{[n.route.id]:m.data},void 0);x.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,r=O.fetchers.get(t),a=He(void 0,r?r.data:void 0);O.fetchers.set(t,a),$.has(t)&&Ke(t),e.controller&&$.set(t,e.controller)})),xe({fetchers:new Map(O.fetchers)});let L=()=>x.forEach((e=>Ke(e.key)));c.signal.addEventListener("abort",L);let{loaderResults:A,fetcherResults:M}=await Fe(O.matches,S,P,x,b);if(c.signal.aborted)return;c.signal.removeEventListener("abort",L),re.delete(t),$.delete(t),x.forEach((e=>$.delete(e.key)));let j=we([...A,...M]);if(j){if(j.idx>=P.length){let e=x[j.idx-P.length].key;oe.add(e)}return _e(b,j.result)}let{loaderData:k,errors:_}=me(O,O.matches,P,A,void 0,x,M,fe);if(O.fetchers.has(t)){let e=Ie(m.data);O.fetchers.set(t,e)}Ve(E),"loading"===O.navigation.state&&E>Z?(o(U,"Expected pending action"),T&&T.abort(),Le(O.navigation.location,{matches:S,loaderData:k,errors:_,fetchers:new Map(O.fetchers)})):(xe({errors:_,loaderData:ye(O.loaderData,k,S,_),fetchers:new Map(O.fetchers)}),B=!1)}(t,r,h,y,c,i,f):(ne.set(t,{routeId:r,path:h}),async function(t,r,a,n,i,s,l){let u=O.fetchers.get(t);Ne(t,He(l,u?u.data:void 0),{flushSync:s});let d=new AbortController,c=ce(e.history,a,d.signal);$.set(t,d);let h=Q,f=(await ze("loader",c,[n],i))[0];Ee(f)&&(f=await ke(f,c.signal,!0)||f);$.get(t)===d&&$.delete(t);if(c.signal.aborted)return;if(he.has(t))return void Ne(t,Ie(void 0));if(Pe(f))return Z>h?void Ne(t,Ie(void 0)):(oe.add(t),void await _e(c,f));if(Re(f))return void We(t,r,f.error);o(!Ee(f),"Unhandled fetcher deferred data"),Ne(t,Ie(f.data))}(t,r,h,y,c,i,f))},revalidate:function(){Be(),xe({revalidation:"loading"}),"submitting"!==O.navigation.state&&("idle"!==O.navigation.state?Ae(U||O.historyAction,O.navigation.location,{overrideNavigation:O.navigation}):Ae(O.historyAction,O.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:$e,deleteFetcher:function(e){if(w.v7_fetcherPersist){let t=(ie.get(e)||0)-1;t<=0?(ie.delete(e),he.add(e)):ie.set(e,t)}else qe(e);xe({fetchers:new Map(O.fetchers)})},dispose:function(){D&&D(),z&&z(),S.clear(),T&&T.abort(),O.fetchers.forEach(((e,t)=>qe(t))),O.blockers.forEach(((e,t)=>Xe(t)))},getBlocker:function(e,t){let r=O.blockers.get(e)||J;return pe.get(e)!==t&&pe.set(e,t),r},deleteBlocker:Xe,_internalFetchControllers:$,_internalActiveDeferreds:fe,_internalSetRoutes:function(e){y={},d=f(e,u,void 0,y)}},j},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)||"/",u=(null==r?void 0:r.unstable_dataStrategy)||se;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 d=t({v7_relativeSplatPath:!1,v7_throwAbortReason:!1},r?r.future:null),h=f(e,a,void 0,n);async function m(e,r,a,n,i){o(e.signal,"query()/queryRoute() requests must contain an AbortController signal");try{if(Me(e.method.toLowerCase())){let o=await async function(e,r,a,o,n){let i;if(a.route.action||a.route.lazy){i=(await v("action",e,[a],r,n,o))[0],e.signal.aborted&&Z(e,n,d)}else{let t=be(405,{method:e.method,pathname:new URL(e.url).pathname,routeId:a.route.id});if(n)throw t;i={type:c.error,error:t}}if(Pe(i))throw new Response(null,{status:i.response.status,headers:{Location:i.response.headers.get("Location")}});if(Ee(i)){let e=be(400,{type:"defer-action"});if(n)throw e;i={type:c.error,error:e}}if(n){if(Re(i))throw i.error;return{matches:[a],loaderData:{},actionData:{[a.route.id]:i.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(Re(i)){let n=ve(r,a.route.id);return t({},await y(e,r,o,void 0,{[n.route.id]:i.error}),{statusCode:z(i.error)?i.error.status:500,actionData:null,actionHeaders:t({},i.response?{[a.route.id]:i.response.headers}:{})})}let s=new Request(e.url,{headers:e.headers,redirect:e.redirect,signal:e.signal});return t({},await y(s,r,o),{actionData:{[a.route.id]:i.data}},i.response?{statusCode:i.response.status,actionHeaders:{[a.route.id]:i.response.headers}}:{actionHeaders:{}})}(e,a,i||Te(a,r),n,null!=i);return o}let o=await y(e,a,n,i);return Le(o)?o:t({},o,{actionData:null,actionHeaders:{}})}catch(e){if(function(e){return null!=e&&"object"==typeof e&&"type"in e&&"result"in e&&(e.type===c.data||e.type===c.error)}(e)&&Le(e.result)){if(e.type===c.error)throw e.result;return e.result}if(function(e){if(!Le(e))return!1;let t=e.status,r=e.headers.get("Location");return t>=300&&t<=399&&null!=r}(e))return e;throw e}}async function y(e,r,a,o,n){let i=null!=o;if(i&&(null==o||!o.route.loader)&&(null==o||!o.route.lazy))throw be(400,{method:e.method,pathname:new URL(e.url).pathname,routeId:null==o?void 0:o.route.id});let s=(o?[o]:re(r,Object.keys(n||{})[0])).filter((e=>e.route.loader||e.route.lazy));if(0===s.length)return{matches:r,loaderData:r.reduce(((e,t)=>Object.assign(e,{[t.route.id]:null})),{}),errors:n||null,statusCode:200,loaderHeaders:{},activeDeferreds:null};let l=await v("loader",e,s,r,i,a);e.signal.aborted&&Z(e,i,d);let u=new Map,c=pe(r,s,l,n,u),h=new Set(s.map((e=>e.route.id)));return r.forEach((e=>{h.has(e.route.id)||(c.loaderData[e.route.id]=null)})),t({},c,{matches:r,activeDeferreds:u.size>0?Object.fromEntries(u.entries()):null})}async function v(e,t,r,o,s,l){let c=await le(u,e,t,r,o,n,a,l);return await Promise.all(c.map(((e,a)=>{if(Se(e))throw de(e.result,t,r[a].route.id,o,i,d.v7_relativeSplatPath);if(Le(e.result)&&s)throw e;return ue(e)})))}return{dataRoutes:h,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"),d=p(h,u,i);if(!Ae(n)&&"HEAD"!==n){let e=be(405,{method:n}),{matches:t,route:r}=ge(h);return{basename:i,location:u,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(!d){let e=be(404,{pathname:u.pathname}),{matches:t,route:r}=ge(h);return{basename:i,location:u,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}let c=await m(e,u,d,a);return Le(c)?c:t({location:u,basename:i},c)},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"),d=p(h,u,i);if(!Ae(n)&&"HEAD"!==n&&"OPTIONS"!==n)throw be(405,{method:n});if(!d)throw be(404,{pathname:u.pathname});let c=r?d.find((e=>e.route.id===r)):Te(d,u);if(r&&!c)throw be(403,{pathname:u.pathname,routeId:r});if(!c)throw be(404,{pathname:u.pathname});let f=await m(e,u,d,a,c);if(Le(f))return f;let y=f.errors?Object.values(f.errors)[0]:void 0;if(void 0!==y)throw y;if(f.actionData)return Object.values(f.actionData)[0];if(f.loaderData){var v;let e=Object.values(f.loaderData)[0];return null!=(v=f.activeDeferreds)&&v[c.route.id]&&(e[Q]=f.activeDeferreds[c.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?u(e).pathname:e.pathname},e.isDeferredData=xe,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=u,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=R,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=router.umd.min.js.map

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

data: any;
statusCode?: number;
headers?: Headers;
response?: Response;
}

@@ -38,6 +37,3 @@ /**

type: ResultType.redirect;
status: number;
location: string;
revalidate: boolean;
reloadDocument?: boolean;
response: Response;
}

@@ -50,3 +46,3 @@ /**

error: any;
headers?: Headers;
response?: Response;
}

@@ -57,2 +53,9 @@ /**

export type DataResult = SuccessResult | DeferredResult | RedirectResult | ErrorResult;
/**
* Result from a loader or action called via dataStrategy
*/
export interface HandlerResult {
type: ResultType.data | ResultType.error;
result: any;
}
type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete";

@@ -139,8 +142,11 @@ type UpperCaseFormMethod = Uppercase<LowerCaseFormMethod>;

type DataFunctionValue = Response | NonNullable<unknown> | null;
type DataFunctionReturnValue = Promise<DataFunctionValue> | DataFunctionValue;
/**
* Route loader function signature
*/
export interface LoaderFunction<Context = any> {
(args: LoaderFunctionArgs<Context>): Promise<DataFunctionValue> | DataFunctionValue;
}
export type LoaderFunction<Context = any> = {
(args: LoaderFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
} & {
hydrate?: boolean;
};
/**

@@ -150,3 +156,3 @@ * Route action function signature

export interface ActionFunction<Context = any> {
(args: ActionFunctionArgs<Context>): Promise<DataFunctionValue> | DataFunctionValue;
(args: ActionFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
}

@@ -189,2 +195,11 @@ /**

}
export interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRouteObject> {
bikeshed_loadRoute: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<HandlerResult>;
}
export interface DataStrategyFunctionArgs<Context = any> extends DataFunctionArgs<Context> {
matches: DataStrategyMatch[];
}
export interface DataStrategyFunction {
(args: DataStrategyFunctionArgs): Promise<HandlerResult[]>;
}
/**

@@ -223,4 +238,4 @@ * Function provided by the framework-aware layers to set any framework-specific

id?: string;
loader?: LoaderFunction;
action?: ActionFunction;
loader?: LoaderFunction | boolean;
action?: ActionFunction | boolean;
hasErrorBoundary?: boolean;

@@ -272,3 +287,3 @@ shouldRevalidate?: ShouldRevalidateFunction;

*/
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> = [

@@ -411,2 +426,3 @@ PathParam<Segment>

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[];
/**

@@ -413,0 +429,0 @@ * @private

@@ -693,2 +693,6 @@ ////////////////////////////////////////////////////////////////////////////////

let href = typeof to === "string" ? to : createPath(to);
// Treating this as a full URL will strip any trailing spaces so we need to
// pre-encode them since they might be part of a matching splat param from
// an ancestor route
href = href.replace(/ $/, "%20");
invariant(

@@ -695,0 +699,0 @@ base,

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

AgnosticRouteObject,
DataStrategyFunction,
DataStrategyFunctionArgs,
DataStrategyMatch,
ErrorResponse,

@@ -24,2 +27,3 @@ FormEncType,

PathMatch,
PathParam,
PathPattern,

@@ -91,3 +95,3 @@ RedirectFunction,

convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch,
getPathContributingMatches as UNSAFE_getPathContributingMatches,
getResolveToMatches as UNSAFE_getResolveToMatches,
} from "./utils";

@@ -94,0 +98,0 @@

{
"name": "@remix-run/router",
"version": "0.0.0-experimental-a077dc2d",
"version": "0.0.0-experimental-a0888892",
"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].

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

data: any;
statusCode?: number;
headers?: Headers;
response?: Response;
}

@@ -44,6 +43,3 @@

type: ResultType.redirect;
status: number;
location: string;
revalidate: boolean;
reloadDocument?: boolean;
response: Response;
}

@@ -57,3 +53,3 @@

error: any;
headers?: Headers;
response?: Response;
}

@@ -70,2 +66,10 @@

/**
* Result from a loader or action called via dataStrategy
*/
export interface HandlerResult {
type: ResultType.data | ResultType.error;
result: any; // data, Error, Response, DeferredData
}
type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete";

@@ -173,10 +177,13 @@ type UpperCaseFormMethod = Uppercase<LowerCaseFormMethod>;

type DataFunctionReturnValue = Promise<DataFunctionValue> | DataFunctionValue;
/**
* Route loader function signature
*/
export interface LoaderFunction<Context = any> {
(args: LoaderFunctionArgs<Context>):
| Promise<DataFunctionValue>
| DataFunctionValue;
}
export type LoaderFunction<Context = any> = {
(
args: LoaderFunctionArgs<Context>,
handlerCtx?: unknown
): DataFunctionReturnValue;
} & { hydrate?: boolean };

@@ -187,5 +194,6 @@ /**

export interface ActionFunction<Context = any> {
(args: ActionFunctionArgs<Context>):
| Promise<DataFunctionValue>
| DataFunctionValue;
(
args: ActionFunctionArgs<Context>,
handlerCtx?: unknown
): DataFunctionReturnValue;
}

@@ -232,2 +240,21 @@

export interface DataStrategyMatch
extends AgnosticRouteMatch<string, AgnosticDataRouteObject> {
// TODO: What to call these?
bikeshed_loadRoute: (
handlerOverride?: (
handler: (ctx?: unknown) => DataFunctionReturnValue
) => DataFunctionReturnValue
) => Promise<HandlerResult>;
}
export interface DataStrategyFunctionArgs<Context = any>
extends DataFunctionArgs<Context> {
matches: DataStrategyMatch[];
}
export interface DataStrategyFunction {
(args: DataStrategyFunctionArgs): Promise<HandlerResult[]>;
}
/**

@@ -287,4 +314,4 @@ * Function provided by the framework-aware layers to set any framework-specific

id?: string;
loader?: LoaderFunction;
action?: ActionFunction;
loader?: LoaderFunction | boolean;
action?: ActionFunction | boolean;
hasErrorBoundary?: boolean;

@@ -360,3 +387,3 @@ shouldRevalidate?: ShouldRevalidateFunction;

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

@@ -497,12 +524,10 @@ Path extends "*" | "/*"

for (let i = 0; matches == null && i < branches.length; ++i) {
matches = matchRouteBranch<string, RouteObjectType>(
branches[i],
// Incoming pathnames are generally encoded from either window.location
// or from router.navigate, but we want to match against the unencoded
// paths in the route definitions. Memory router locations won't be
// encoded here but there also shouldn't be anything to decode so this
// should be a safe operation. This avoids needing matchRoutes to be
// history-aware.
safelyDecodeURI(pathname)
);
// Incoming pathnames are generally encoded from either window.location
// or from router.navigate, but we want to match against the unencoded
// paths in the route definitions. Memory router locations won't be
// encoded here but there also shouldn't be anything to decode so this
// should be a safe operation. This avoids needing matchRoutes to be
// history-aware.
let decoded = decodePath(pathname);
matches = matchRouteBranch<string, RouteObjectType>(branches[i], decoded);
}

@@ -698,3 +723,3 @@

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

@@ -836,3 +861,3 @@ const indexRouteValue = 2;

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

@@ -945,3 +970,3 @@ const [, key, optional] = keyMatch;

} else {
memo[paramName] = safelyDecodeURIComponent(value || "", paramName);
memo[paramName] = (value || "").replace(/%2F/g, "/");
}

@@ -983,6 +1008,9 @@ return memo;

.replace(/[\\.*+^${}|()[\]]/g, "\\$&") // Escape special regex chars
.replace(/\/:(\w+)(\?)?/g, (_: string, paramName: string, isOptional) => {
params.push({ paramName, isOptional: isOptional != null });
return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
});
.replace(
/\/:([\w-]+)(\?)?/g,
(_: string, paramName: string, isOptional) => {
params.push({ paramName, isOptional: isOptional != null });
return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
}
);

@@ -1016,5 +1044,8 @@ if (path.endsWith("*")) {

function safelyDecodeURI(value: string) {
function decodePath(value: string) {
try {
return decodeURI(value);
return value
.split("/")
.map((v) => decodeURIComponent(v).replace(/\//g, "%2F"))
.join("/");
} catch (error) {

@@ -1032,17 +1063,2 @@ warning(

function safelyDecodeURIComponent(value: string, paramName: string) {
try {
return decodeURIComponent(value);
} catch (error) {
warning(
false,
`The value for the URL param "${paramName}" will not be decoded because` +
` the string "${value}" is a malformed URL segment. This is probably` +
` due to a bad percent encoding (${error}).`
);
return value;
}
}
/**

@@ -1164,2 +1180,21 @@ * @private

// 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);
}
/**

@@ -1208,3 +1243,3 @@ * @private

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

@@ -1214,8 +1249,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] === "..") {

@@ -1229,4 +1265,2 @@ toSegments.shift();

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

@@ -1233,0 +1267,0 @@ }

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc