Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@remix-run/router

Package Overview
Dependencies
Maintainers
2
Versions
217
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remix-run/router - npm Package Compare versions

Comparing version 0.0.0-experimental-63b6834e to 0.0.0-experimental-7110596b

95

CHANGELOG.md
# `@remix-run/router`
## 1.5.0
### Minor Changes
- Added support for [**Future Flags**](https://reactrouter.com/en/main/guides/api-development-strategy) in React Router. The first flag being introduced is `future.v7_normalizeFormMethod` which will normalize the exposed `useNavigation()/useFetcher()` `formMethod` fields as uppercase HTTP methods to align with the `fetch()` behavior. ([#10207](https://github.com/remix-run/react-router/pull/10207))
- When `future.v7_normalizeFormMethod === false` (default v6 behavior),
- `useNavigation().formMethod` is lowercase
- `useFetcher().formMethod` is lowercase
- When `future.v7_normalizeFormMethod === true`:
- `useNavigation().formMethod` is uppercase
- `useFetcher().formMethod` is uppercase
### Patch Changes
- Provide fetcher submission to `shouldRevalidate` if the fetcher action redirects ([#10208](https://github.com/remix-run/react-router/pull/10208))
- Properly handle `lazy()` errors during router initialization ([#10201](https://github.com/remix-run/react-router/pull/10201))
- Remove `instanceof` check for `DeferredData` to be resilient to ESM/CJS boundaries in SSR bundling scenarios ([#10247](https://github.com/remix-run/react-router/pull/10247))
- Update to latest `@remix-run/web-fetch@4.3.3` ([#10216](https://github.com/remix-run/react-router/pull/10216))
## 1.4.0
### Minor Changes
- **Introducing Lazy Route Modules!** ([#10045](https://github.com/remix-run/react-router/pull/10045))
In order to keep your application bundles small and support code-splitting of your routes, we've introduced a new `lazy()` route property. This is an async function that resolves the non-route-matching portions of your route definition (`loader`, `action`, `element`/`Component`, `errorElement`/`ErrorBoundary`, `shouldRevalidate`, `handle`).
Lazy routes are resolved on initial load and during the `loading` or `submitting` phase of a navigation or fetcher call. You cannot lazily define route-matching properties (`path`, `index`, `children`) since we only execute your lazy route functions after we've matched known routes.
Your `lazy` functions will typically return the result of a dynamic import.
```jsx
// In this example, we assume most folks land on the homepage so we include that
// in our critical-path bundle, but then we lazily load modules for /a and /b so
// they don't load until the user navigates to those routes
let routes = createRoutesFromElements(
<Route path="/" element={<Layout />}>
<Route index element={<Home />} />
<Route path="a" lazy={() => import("./a")} />
<Route path="b" lazy={() => import("./b")} />
</Route>
);
```
Then in your lazy route modules, export the properties you want defined for the route:
```jsx
export async function loader({ request }) {
let data = await fetchData(request);
return json(data);
}
// Export a `Component` directly instead of needing to create a React Element from it
export function Component() {
let data = useLoaderData();
return (
<>
<h1>You made it!</h1>
<p>{data}</p>
</>
);
}
// Export an `ErrorBoundary` directly instead of needing to create a React Element from it
export function ErrorBoundary() {
let error = useRouteError();
return isRouteErrorResponse(error) ? (
<h1>
{error.status} {error.statusText}
</h1>
) : (
<h1>{error.message || error}</h1>
);
}
```
An example of this in action can be found in the [`examples/lazy-loading-router-provider`](https://github.com/remix-run/react-router/tree/main/examples/lazy-loading-router-provider) directory of the repository.
🙌 Huge thanks to @rossipedia for the [Initial Proposal](https://github.com/remix-run/react-router/discussions/9826) and [POC Implementation](https://github.com/remix-run/react-router/pull/9830).
### Patch Changes
- Fix `generatePath` incorrectly applying parameters in some cases ([#10078](https://github.com/remix-run/react-router/pull/10078))
## 1.3.3
### Patch Changes
- Correctly perform a hard redirect for same-origin absolute URLs outside of the router `basename` ([#10076](https://github.com/remix-run/react-router/pull/10076))
- Ensure status code and headers are maintained for `defer` loader responses in `createStaticHandler`'s `query()` method ([#10077](https://github.com/remix-run/react-router/pull/10077))
- Change `invariant` to an `UNSAFE_invariant` export since it's only intended for internal use ([#10066](https://github.com/remix-run/react-router/pull/10066))
- Add internal API for custom HMR implementations ([#9996](https://github.com/remix-run/react-router/pull/9996))
## 1.3.2

@@ -4,0 +99,0 @@

1

dist/history.d.ts

@@ -232,2 +232,3 @@ /**

export declare function invariant<T>(value: T | null | undefined, message?: string): asserts value is T;
export declare function warning(cond: any, message: string): void;
/**

@@ -234,0 +235,0 @@ * Creates a Location object with a unique key from the given Path

7

dist/index.d.ts

@@ -1,5 +0,5 @@

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

@@ -9,1 +9,2 @@ /** @internal */

export { DeferredData as UNSAFE_DeferredData, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, getPathContributingMatches as UNSAFE_getPathContributingMatches, } 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, FormEncType, FormMethod, HasErrorBoundaryFunction, RouteData, AgnosticRouteObject, AgnosticRouteMatch } from "./utils";
import { DeferredData } from "./utils";
import type { DeferredData, AgnosticDataRouteMatch, AgnosticDataRouteObject, FormEncType, FormMethod, DetectErrorBoundaryFunction, RouteData, AgnosticRouteObject, AgnosticRouteMatch, ActionFunction, LoaderFunction, V7_FormMethod, HTMLFormMethod, MapRoutePropertiesFunction } from "./utils";
/**

@@ -73,3 +72,3 @@ * A Router instance manages all navigation and data loading/mutations

*/
navigate(to: To, opts?: RouterNavigateOptions): Promise<void>;
navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>;
/**

@@ -86,3 +85,3 @@ * @internal

*/
fetch(key: string, routeId: string, href: string, opts?: RouterNavigateOptions): void;
fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): void;
/**

@@ -156,2 +155,10 @@ * @internal

*
* HMR needs to pass in-flight route updates to React Router
* TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute)
*/
_internalSetRoutes(routes: AgnosticRouteObject[]): void;
/**
* @internal
* PRIVATE - DO NOT USE
*
* Internal fetch AbortControllers accessed by unit tests

@@ -235,13 +242,22 @@ */

/**
* Future flags to toggle new feature behavior
*/
export interface FutureConfig {
v7_normalizeFormMethod: boolean;
v7_prependBasename: boolean;
}
/**
* Initialization options for createRouter
*/
export interface RouterInit {
basename?: string;
routes: AgnosticRouteObject[];
history: History;
basename?: string;
/**
* @deprecated Use `mapRouteProperties` instead
*/
detectErrorBoundary?: DetectErrorBoundaryFunction;
mapRouteProperties?: MapRoutePropertiesFunction;
future?: Partial<FutureConfig>;
hydrationData?: HydrationState;
hasErrorBoundary?: HasErrorBoundaryFunction;
onInitialize?: (args: {
router: Router;
}) => void;
}

@@ -303,22 +319,32 @@ /**

}
/**
* Options for a navigate() call for a Link navigation
*/
declare type LinkNavigateOptions = {
replace?: boolean;
state?: any;
export declare type RelativeRoutingType = "route" | "path";
declare type BaseNavigateOrFetchOptions = {
fromRouteId?: string;
preventScrollReset?: boolean;
relative?: RelativeRoutingType;
};
/**
* Options for a navigate() call for a Form navigation
*/
declare type SubmissionNavigateOptions = {
declare type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
replace?: boolean;
state?: any;
preventScrollReset?: boolean;
formMethod?: FormMethod;
};
declare type BaseSubmissionOptions = {
formMethod?: HTMLFormMethod;
formEncType?: FormEncType;
action?: ActionFunction;
} & ({
formData: FormData;
};
payload?: undefined;
} | {
formData?: undefined;
payload: any;
});
/**
* Options for a navigate() call for a Link navigation
*/
declare type LinkNavigateOptions = BaseNavigateOptions;
/**
* Options for a navigate() call for a Form navigation
*/
declare type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions;
/**
* Options to pass to navigate() for either a Link or Form navigation

@@ -328,5 +354,15 @@ */

/**
* Options for a navigate() call for a Link navigation
*/
declare type LoadFetchOptions = BaseNavigateOrFetchOptions & {
loader?: LoaderFunction;
};
/**
* Options for a navigate() call for a Form navigation
*/
declare type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions;
/**
* Options to pass to fetch()
*/
export declare type RouterFetchOptions = Omit<LinkNavigateOptions, "replace"> | Omit<SubmissionNavigateOptions, "replace">;
export declare type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions;
/**

@@ -343,2 +379,3 @@ * Potential states for state.navigation

formData: undefined;
payload: undefined;
};

@@ -348,6 +385,7 @@ Loading: {

location: Location;
formMethod: FormMethod | undefined;
formMethod: FormMethod | V7_FormMethod | undefined;
formAction: string | undefined;
formEncType: FormEncType | undefined;
formData: FormData | undefined;
payload: any | undefined;
};

@@ -357,7 +395,12 @@ Submitting: {

location: Location;
formMethod: FormMethod;
formMethod: FormMethod | V7_FormMethod;
formAction: string;
formEncType: FormEncType;
} & ({
formData: FormData;
};
payload?: undefined;
} | {
formData?: undefined;
payload: NonNullable<unknown> | null;
});
};

@@ -376,2 +419,3 @@ export declare type Navigation = NavigationStates[keyof NavigationStates];

formData: undefined;
payload: undefined;
data: TData | undefined;

@@ -382,6 +426,7 @@ " _hasFetcherDoneAnything "?: boolean;

state: "loading";
formMethod: FormMethod | undefined;
formMethod: FormMethod | V7_FormMethod | undefined;
formAction: string | undefined;
formEncType: FormEncType | undefined;
formData: FormData | undefined;
payload: any | undefined;
data: TData | undefined;

@@ -392,9 +437,14 @@ " _hasFetcherDoneAnything "?: boolean;

state: "submitting";
formMethod: FormMethod;
formMethod: FormMethod | V7_FormMethod;
formAction: string;
formEncType: FormEncType;
formData: FormData;
data: TData | undefined;
" _hasFetcherDoneAnything "?: boolean;
};
} & ({
formData: FormData;
payload?: undefined;
} | {
formData?: undefined;
payload: NonNullable<unknown> | null;
});
};

@@ -436,3 +486,7 @@ export declare type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>];

basename?: string;
hasErrorBoundary?: HasErrorBoundaryFunction;
/**
* @deprecated Use `mapRouteProperties` instead
*/
detectErrorBoundary?: DetectErrorBoundaryFunction;
mapRouteProperties?: MapRoutePropertiesFunction;
}

@@ -445,2 +499,3 @@ export declare function createStaticHandler(routes: AgnosticRouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;

export declare function getStaticContextFromError(routes: AgnosticDataRouteObject[], context: StaticHandlerContext, error: any): StaticHandlerContext;
export declare function isDeferredData(value: any): value is DeferredData;
export {};
/**
* @remix-run/router v0.0.0-experimental-63b6834e
* @remix-run/router v0.0.0-experimental-7110596b
*

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

@@ -53,6 +53,23 @@ import type { Location, Path, To } from "./history";

export declare type DataResult = SuccessResult | DeferredResult | RedirectResult | ErrorResult;
export declare type MutationFormMethod = "post" | "put" | "patch" | "delete";
export declare type FormMethod = "get" | MutationFormMethod;
export declare type FormEncType = "application/x-www-form-urlencoded" | "multipart/form-data";
declare type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete";
declare type UpperCaseFormMethod = Uppercase<LowerCaseFormMethod>;
/**
* Users can specify either lowercase or uppercase form methods on <Form>,
* useSubmit(), <fetcher.Form>, etc.
*/
export declare type HTMLFormMethod = LowerCaseFormMethod | UpperCaseFormMethod;
/**
* Active navigation/fetcher form methods are exposed in lowercase on the
* RouterState
*/
export declare type FormMethod = LowerCaseFormMethod;
export declare type MutationFormMethod = Exclude<FormMethod, "get">;
/**
* In v7, active navigation/fetcher form methods are exposed in uppercase on the
* RouterState. This is to align with the normalization done via fetch().
*/
export declare type V7_FormMethod = UpperCaseFormMethod;
export declare type V7_MutationFormMethod = Exclude<V7_FormMethod, "GET">;
export declare type FormEncType = "application/x-www-form-urlencoded" | "multipart/form-data" | "application/json" | "text/plain" | null;
/**
* @private

@@ -62,8 +79,13 @@ * Internal interface to pass around for action submissions, not intended for

*/
export interface Submission {
formMethod: FormMethod;
export declare type Submission = {
formMethod: FormMethod | V7_FormMethod;
formAction: string;
formEncType: FormEncType;
} & ({
formData: FormData;
}
payload?: undefined;
} | {
formData?: undefined;
payload: NonNullable<unknown> | null;
});
/**

@@ -88,8 +110,15 @@ * @private

export interface ActionFunctionArgs extends DataFunctionArgs {
payload: any;
}
/**
* Loaders and actions can return anything except `undefined` (`null` is a
* valid return value if there is no data to return). Responses are preferred
* and will ease any future migration to Remix
*/
declare type DataFunctionValue = Response | NonNullable<unknown> | null;
/**
* Route loader function signature
*/
export interface LoaderFunction {
(args: LoaderFunctionArgs): Promise<Response> | Response | Promise<any> | any;
(args: LoaderFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
}

@@ -100,3 +129,3 @@ /**

export interface ActionFunction {
(args: ActionFunctionArgs): Promise<Response> | Response | Promise<any> | any;
(args: ActionFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
}

@@ -120,2 +149,3 @@ /**

formData?: Submission["formData"];
payload?: any;
actionResult?: DataResult;

@@ -128,7 +158,18 @@ defaultShouldRevalidate: boolean;

* from the framework-aware `errorElement` prop
*
* @deprecated Use `mapRouteProperties` instead
*/
export interface HasErrorBoundaryFunction {
export interface DetectErrorBoundaryFunction {
(route: AgnosticRouteObject): boolean;
}
/**
* Function provided by the framework-aware layers to set any framework-specific
* properties from framework-agnostic properties
*/
export interface MapRoutePropertiesFunction {
(route: AgnosticRouteObject): {
hasErrorBoundary: boolean;
} & Record<string, any>;
}
/**
* Keys we cannot change from within a lazy() function. We spread all other keys

@@ -138,3 +179,3 @@ * onto the route. Either they're meaningful to the router, or they'll get

*/
export declare type ImmutableRouteKey = "caseSensitive" | "path" | "id" | "index" | "children";
export declare type ImmutableRouteKey = "lazy" | "caseSensitive" | "path" | "id" | "index" | "children";
export declare const immutableRouteKeys: Set<ImmutableRouteKey>;

@@ -203,3 +244,3 @@ /**

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

@@ -237,3 +278,3 @@ PathParam<Segment>

}
export declare function convertRoutesToDataRoutes(routes: AgnosticRouteObject[], hasErrorBoundary: HasErrorBoundaryFunction, parentPath?: number[], manifest?: RouteManifest): AgnosticDataRouteObject[];
export declare function convertRoutesToDataRoutes(routes: AgnosticRouteObject[], mapRouteProperties: MapRoutePropertiesFunction, parentPath?: number[], manifest?: RouteManifest): AgnosticDataRouteObject[];
/**

@@ -306,6 +347,2 @@ * Matches the given routes to a location and returns the match data.

/**
* @private
*/
export declare function warning(cond: any, message: string): void;
/**
* Returns a resolved path object relative to the given pathname.

@@ -312,0 +349,0 @@ *

@@ -484,3 +484,3 @@ ////////////////////////////////////////////////////////////////////////////////

function warning(cond: any, message: string) {
export function warning(cond: any, message: string) {
if (!cond) {

@@ -487,0 +487,0 @@ // eslint-disable-next-line no-console

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

FormMethod,
HTMLFormMethod,
JsonFunction,

@@ -26,3 +27,3 @@ LoaderFunction,

ShouldRevalidateFunction,
Submission,
V7_FormMethod,
} from "./utils";

@@ -46,3 +47,2 @@

stripBasename,
warning,
} from "./utils";

@@ -70,3 +70,2 @@

createMemoryHistory,
invariant,
parsePath,

@@ -91,1 +90,6 @@ } from "./history";

} from "./utils";
export {
invariant as UNSAFE_invariant,
warning as UNSAFE_warning,
} from "./history";
{
"name": "@remix-run/router",
"version": "0.0.0-experimental-63b6834e",
"version": "0.0.0-experimental-7110596b",
"description": "Nested/Data-driven/Framework-agnostic Routing",

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

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

If you're using React Router, you should never `import` anything directly from the `@remix-run/router` or `react-router` packages, but you should have everything you need in either `react-router-dom` or `react-router-native`. Both of those packages re-export everything from `@remix-run/router` and `react-router`.
If you're using React Router, you should never `import` anything directly from the `@remix-run/router` - you should have everything you need in `react-router-dom` (or `react-router`/`react-router-native` if you're not rendering in the browser). All of those packages should re-export everything you would otherwise need from `@remix-run/router`.

@@ -20,7 +20,19 @@ > **Warning**

let router = createRouter({
// Routes array
routes: ,
// History instance
history,
}).initialize()
// Required properties
routes: [{
path: '/',
loader: ({ request, params }) => { /* ... */ },
children: [{
path: 'home',
loader: ({ request, params }) => { /* ... */ },
}]
},
history: createBrowserHistory(),
// Optional properties
basename, // Base path
mapRouteProperties, // Map framework-agnostic routes to framework-aware routes
future, // Future flags
hydrationData, // Hydration data if using server-side-rendering
}).initialize();
```

@@ -83,2 +95,7 @@

});
// Relative routing from a source routeId
router.navigate("../../somewhere", {
fromRouteId: "active-route-id",
});
```

@@ -107,2 +124,11 @@

### Future Flags
We use _Future Flags_ in the router to help us introduce breaking changes in an opt-in fashion ahead of major releases. Please check out the [blog post][future-flags-post] and [React Router Docs][api-development-strategy] for more information on this process. The currently available future flags in `@remix-run/router` are:
| Flag | Description |
| ------------------------ | ------------------------------------------------------------------------- |
| `v7_normalizeFormMethod` | Normalize `useNavigation().formMethod` to be an uppercase HTTP Method |
| `v7_prependBasename` | Prepend the `basename` to incoming `router.navigate`/`router.fetch` paths |
[react-router]: https://reactrouter.com

@@ -112,1 +138,3 @@ [remix]: https://remix.run

[remix-routers-repo]: https://github.com/brophdawg11/remix-routers
[api-development-strategy]: https://reactrouter.com/en/main/guides/api-development-strategy
[future-flags-post]: https://remix.run/blog/future-flags
import type { Location, Path, To } from "./history";
import { invariant, parsePath } from "./history";
import { warning, invariant, parsePath } from "./history";

@@ -66,8 +66,31 @@ /**

export type MutationFormMethod = "post" | "put" | "patch" | "delete";
export type FormMethod = "get" | MutationFormMethod;
type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete";
type UpperCaseFormMethod = Uppercase<LowerCaseFormMethod>;
/**
* Users can specify either lowercase or uppercase form methods on <Form>,
* useSubmit(), <fetcher.Form>, etc.
*/
export type HTMLFormMethod = LowerCaseFormMethod | UpperCaseFormMethod;
/**
* Active navigation/fetcher form methods are exposed in lowercase on the
* RouterState
*/
export type FormMethod = LowerCaseFormMethod;
export type MutationFormMethod = Exclude<FormMethod, "get">;
/**
* In v7, active navigation/fetcher form methods are exposed in uppercase on the
* RouterState. This is to align with the normalization done via fetch().
*/
export type V7_FormMethod = UpperCaseFormMethod;
export type V7_MutationFormMethod = Exclude<V7_FormMethod, "GET">;
export type FormEncType =
| "application/x-www-form-urlencoded"
| "multipart/form-data";
| "multipart/form-data"
| "application/json"
| "text/plain"
| null; // Opt-out of serialization

@@ -79,8 +102,10 @@ /**

*/
export interface Submission {
formMethod: FormMethod;
export type Submission = {
formMethod: FormMethod | V7_FormMethod;
formAction: string;
formEncType: FormEncType;
formData: FormData;
}
} & (
| { formData: FormData; payload?: undefined }
| { formData?: undefined; payload: NonNullable<unknown> | null }
);

@@ -106,9 +131,18 @@ /**

*/
export interface ActionFunctionArgs extends DataFunctionArgs {}
export interface ActionFunctionArgs extends DataFunctionArgs {
payload: any;
}
/**
* Loaders and actions can return anything except `undefined` (`null` is a
* valid return value if there is no data to return). Responses are preferred
* and will ease any future migration to Remix
*/
type DataFunctionValue = Response | NonNullable<unknown> | null;
/**
* Route loader function signature
*/
export interface LoaderFunction {
(args: LoaderFunctionArgs): Promise<Response> | Response | Promise<any> | any;
(args: LoaderFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
}

@@ -120,3 +154,3 @@

export interface ActionFunction {
(args: ActionFunctionArgs): Promise<Response> | Response | Promise<any> | any;
(args: ActionFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
}

@@ -141,2 +175,3 @@

formData?: Submission["formData"];
payload?: any;
actionResult?: DataResult;

@@ -150,4 +185,6 @@ defaultShouldRevalidate: boolean;

* from the framework-aware `errorElement` prop
*
* @deprecated Use `mapRouteProperties` instead
*/
export interface HasErrorBoundaryFunction {
export interface DetectErrorBoundaryFunction {
(route: AgnosticRouteObject): boolean;

@@ -157,2 +194,12 @@ }

/**
* Function provided by the framework-aware layers to set any framework-specific
* properties from framework-agnostic properties
*/
export interface MapRoutePropertiesFunction {
(route: AgnosticRouteObject): {
hasErrorBoundary: boolean;
} & Record<string, any>;
}
/**
* Keys we cannot change from within a lazy() function. We spread all other keys

@@ -163,2 +210,3 @@ * onto the route. Either they're meaningful to the router, or they'll get

export type ImmutableRouteKey =
| "lazy"
| "caseSensitive"

@@ -171,2 +219,3 @@ | "path"

export const immutableRouteKeys = new Set<ImmutableRouteKey>([
"lazy",
"caseSensitive",

@@ -268,3 +317,3 @@ "path",

// check if path is just a wildcard
Path extends "*"
Path extends "*" | "/*"
? "*"

@@ -329,3 +378,3 @@ : // look for wildcard at the end of the path

routes: AgnosticRouteObject[],
hasErrorBoundary: HasErrorBoundaryFunction,
mapRouteProperties: MapRoutePropertiesFunction,
parentPath: number[] = [],

@@ -350,3 +399,3 @@ manifest: RouteManifest = {}

...route,
hasErrorBoundary: hasErrorBoundary(route),
...mapRouteProperties(route),
id,

@@ -359,4 +408,4 @@ };

...route,
...mapRouteProperties(route),
id,
hasErrorBoundary: hasErrorBoundary(route),
children: undefined,

@@ -369,3 +418,3 @@ };

route.children,
hasErrorBoundary,
mapRouteProperties,
treePath,

@@ -692,3 +741,3 @@ manifest

): string {
let path = originalPath;
let path: string = originalPath;
if (path.endsWith("*") && path !== "*" && !path.endsWith("/*")) {

@@ -705,45 +754,42 @@ warning(

return (
path
.replace(
/^:(\w+)(\??)/g,
(_, key: PathParam<Path>, optional: string | undefined) => {
let param = params[key];
if (optional === "?") {
return param == null ? "" : param;
}
if (param == null) {
invariant(false, `Missing ":${key}" param`);
}
return param;
// ensure `/` is added at the beginning if the path is absolute
const prefix = path.startsWith("/") ? "/" : "";
const segments = path
.split(/\/+/)
.map((segment, index, array) => {
const isLastSegment = index === array.length - 1;
// only apply the splat if it's the last segment
if (isLastSegment && segment === "*") {
const star = "*" as PathParam<Path>;
const starParam = params[star];
// Apply the splat
return starParam;
}
const keyMatch = segment.match(/^:(\w+)(\??)$/);
if (keyMatch) {
const [, key, optional] = keyMatch;
let param = params[key as PathParam<Path>];
if (optional === "?") {
return param == null ? "" : param;
}
)
.replace(
/\/:(\w+)(\??)/g,
(_, key: PathParam<Path>, optional: string | undefined) => {
let param = params[key];
if (optional === "?") {
return param == null ? "" : `/${param}`;
}
if (param == null) {
invariant(false, `Missing ":${key}" param`);
}
return `/${param}`;
if (param == null) {
invariant(false, `Missing ":${key}" param`);
}
)
return param;
}
// Remove any optional markers from optional static segments
.replace(/\?/g, "")
.replace(/(\/?)\*/, (_, prefix, __, str) => {
const star = "*" as PathParam<Path>;
return segment.replace(/\?$/g, "");
})
// Remove empty segments
.filter((segment) => !!segment);
if (params[star] == null) {
// If no splat was provided, trim the trailing slash _unless_ it's
// the entire path
return str === "/*" ? "/" : "";
}
// Apply the splat
return `${prefix}${params[star]}`;
})
);
return prefix + segments.join("/");
}

@@ -965,22 +1011,2 @@

/**
* @private
*/
export function warning(cond: any, message: string): void {
if (!cond) {
// eslint-disable-next-line no-console
if (typeof console !== "undefined") console.warn(message);
try {
// Welcome to debugging @remix-run/router!
//
// This error is thrown as a convenience so you can more easily
// find the source for a warning that appears in the console by
// enabling "pause on exceptions" in your JavaScript debugger.
throw new Error(message);
// eslint-disable-next-line no-empty
} catch (e) {}
}
}
/**
* Returns a resolved path object relative to the given pathname.

@@ -987,0 +1013,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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc