@remix-run/router
Advanced tools
Comparing version 0.0.0-experimental-a0888892 to 0.0.0-experimental-abead7ae1
# `@remix-run/router` | ||
## 1.16.1 | ||
### Patch Changes | ||
- Support `unstable_dataStrategy` on `staticHandler.queryRoute` ([#11515](https://github.com/remix-run/react-router/pull/11515)) | ||
## 1.16.0 | ||
### Minor Changes | ||
- Add a new `unstable_dataStrategy` configuration option ([#11098](https://github.com/remix-run/react-router/pull/11098)) | ||
- This option allows Data Router applications to take control over the approach for executing route loaders and actions | ||
- The default implementation is today's behavior, to fetch all loaders in parallel, but this option allows users to implement more advanced data flows including Remix single-fetch, middleware/context APIs, automatic loader caching, and more | ||
- Move `unstable_dataStrategy` from `createStaticHandler` to `staticHandler.query` so it can be request-specific for use with the `ResponseStub` approach in Remix. It's not really applicable to `queryRoute` for now since that's a singular handler call anyway so any pre-processing/post/processing could be done there manually. ([#11377](https://github.com/remix-run/react-router/pull/11377)) | ||
- Add a new `future.unstable_skipActionRevalidation` future flag ([#11098](https://github.com/remix-run/react-router/pull/11098)) | ||
- Currently, active loaders revalidate after any action, regardless of the result | ||
- With this flag enabled, actions that return/throw a 4xx/5xx response status will no longer automatically revalidate | ||
- This should reduce load on your server since it's rare that a 4xx/5xx should actually mutate any data | ||
- If you need to revalidate after a 4xx/5xx result with this flag enabled, you can still do that via returning `true` from `shouldRevalidate` | ||
- `shouldRevalidate` now also receives a new `unstable_actionStatus` argument alongside `actionResult` so you can make decision based on the status of the `action` response without having to encode it into the action data | ||
- Added a `skipLoaderErrorBubbling` flag to `staticHandler.query` to disable error bubbling on loader executions for single-fetch scenarios where the client-side router will handle the bubbling ([#11098](https://github.com/remix-run/react-router/pull/11098)) | ||
## 1.15.3 | ||
### Patch Changes | ||
- Fix a `future.v7_partialHydration` bug that would re-run loaders below the boundary on hydration if SSR loader errors bubbled to a parent boundary ([#11324](https://github.com/remix-run/react-router/pull/11324)) | ||
- Fix a `future.v7_partialHydration` bug that would consider the router uninitialized if a route did not have a loader ([#11325](https://github.com/remix-run/react-router/pull/11325)) | ||
## 1.15.2 | ||
### Patch Changes | ||
- Preserve hydrated errors during partial hydration runs ([#11305](https://github.com/remix-run/react-router/pull/11305)) | ||
## 1.15.1 | ||
### Patch Changes | ||
- Fix encoding/decoding issues with pre-encoded dynamic parameter values ([#11199](https://github.com/remix-run/react-router/pull/11199)) | ||
## 1.15.0 | ||
@@ -4,0 +45,0 @@ |
@@ -1,2 +0,2 @@ | ||
export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, ErrorResponse, FormEncType, FormMethod, HTMLFormMethod, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathParam, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, TrackedPromise, UIMatch, V7_FormMethod, } from "./utils"; | ||
export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, DataStrategyFunction as unstable_DataStrategyFunction, DataStrategyFunctionArgs as unstable_DataStrategyFunctionArgs, DataStrategyMatch as unstable_DataStrategyMatch, ErrorResponse, FormEncType, FormMethod, HandlerResult as unstable_HandlerResult, HTMLFormMethod, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathParam, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, TrackedPromise, UIMatch, V7_FormMethod, } from "./utils"; | ||
export { AbortedDeferredError, defer, generatePath, getToPathname, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, redirect, redirectDocument, resolvePath, resolveTo, stripBasename, } from "./utils"; | ||
@@ -3,0 +3,0 @@ export type { BrowserHistory, BrowserHistoryOptions, HashHistory, HashHistoryOptions, History, InitialEntry, Location, MemoryHistory, MemoryHistoryOptions, Path, To, } from "./history"; |
import type { History, Location, Path, To } from "./history"; | ||
import { Action as HistoryAction } from "./history"; | ||
import type { AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticRouteObject, DataStrategyFunction, DeferredData, DetectErrorBoundaryFunction, FormEncType, HTMLFormMethod, MapRoutePropertiesFunction, RouteData, Submission, UIMatch } from "./utils"; | ||
import type { AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticRouteObject, DataStrategyFunction, DeferredData, DetectErrorBoundaryFunction, FormEncType, HTMLFormMethod, MapRoutePropertiesFunction, RouteData, Submission, UIMatch, PatchRoutesOnMissFunction } from "./utils"; | ||
/** | ||
@@ -165,2 +165,11 @@ * A Router instance manages all navigation and data loading/mutations | ||
* @internal | ||
* PRIVATE DO NOT USE | ||
* | ||
* Patch additional children routes into an existing parent route | ||
* @param routeId The parent route id | ||
* @param children The additional children routes | ||
*/ | ||
patchRoutes(routeId: string, children: AgnosticRouteObject[]): void; | ||
/** | ||
* @internal | ||
* PRIVATE - DO NOT USE | ||
@@ -262,2 +271,3 @@ * | ||
v7_relativeSplatPath: boolean; | ||
unstable_skipActionErrorRevalidation: boolean; | ||
} | ||
@@ -279,2 +289,3 @@ /** | ||
window?: Window; | ||
unstable_patchRoutesOnMiss?: PatchRoutesOnMissFunction; | ||
unstable_dataStrategy?: DataStrategyFunction; | ||
@@ -305,2 +316,4 @@ } | ||
requestContext?: unknown; | ||
skipLoaderErrorBubbling?: boolean; | ||
unstable_dataStrategy?: DataStrategyFunction; | ||
}): Promise<StaticHandlerContext | Response>; | ||
@@ -310,2 +323,3 @@ queryRoute(request: Request, opts?: { | ||
requestContext?: unknown; | ||
unstable_dataStrategy?: DataStrategyFunction; | ||
}): Promise<any>; | ||
@@ -504,3 +518,2 @@ } | ||
detectErrorBoundary?: DetectErrorBoundaryFunction; | ||
unstable_dataStrategy?: DataStrategyFunction; | ||
mapRouteProperties?: MapRoutePropertiesFunction; | ||
@@ -507,0 +520,0 @@ future?: Partial<StaticHandlerFutureConfig>; |
/** | ||
* @remix-run/router v0.0.0-experimental-a0888892 | ||
* @remix-run/router v0.0.0-experimental-abead7ae1 | ||
* | ||
@@ -11,3 +11,3 @@ * Copyright (c) Remix Software Inc. | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RemixRouter={})}(this,(function(e){"use strict";function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},t.apply(this,arguments)}let r=function(e){return e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE",e}({});const a="popstate";function o(e,t){if(!1===e||null==e)throw new Error(t)}function n(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function i(e,t){return{usr:e.state,key:e.key,idx:t}}function s(e,r,a,o){return void 0===a&&(a=null),t({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof r?u(r):r,{state:a,key:r&&r.key||o||Math.random().toString(36).substr(2,8)})}function l(e){let{pathname:t="/",search:r="",hash:a=""}=e;return r&&"?"!==r&&(t+="?"===r.charAt(0)?r:"?"+r),a&&"#"!==a&&(t+="#"===a.charAt(0)?a:"#"+a),t}function u(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substr(a),e=e.substr(0,a)),e&&(t.pathname=e)}return t}function d(e,n,u,d){void 0===d&&(d={});let{window:c=document.defaultView,v5Compat:h=!1}=d,f=c.history,p=r.Pop,m=null,y=v();function v(){return(f.state||{idx:null}).idx}function g(){p=r.Pop;let e=v(),t=null==e?null:e-y;y=e,m&&m({action:p,location:w.location,delta:t})}function b(e){let t="null"!==c.location.origin?c.location.origin:c.location.href,r="string"==typeof e?e:l(e);return r=r.replace(/ $/,"%20"),o(t,"No window.location.(origin|href) available to create URL for href: "+r),new URL(r,t)}null==y&&(y=0,f.replaceState(t({},f.state,{idx:y}),""));let w={get action(){return p},get location(){return e(c,f)},listen(e){if(m)throw new Error("A history only accepts one active listener");return c.addEventListener(a,g),m=e,()=>{c.removeEventListener(a,g),m=null}},createHref:e=>n(c,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){p=r.Push;let a=s(w.location,e,t);u&&u(a,e),y=v()+1;let o=i(a,y),n=w.createHref(a);try{f.pushState(o,"",n)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;c.location.assign(n)}h&&m&&m({action:p,location:w.location,delta:1})},replace:function(e,t){p=r.Replace;let a=s(w.location,e,t);u&&u(a,e),y=v();let o=i(a,y),n=w.createHref(a);f.replaceState(o,"",n),h&&m&&m({action:p,location:w.location,delta:0})},go:e=>f.go(e)};return w}let c=function(e){return e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error",e}({});const h=new Set(["lazy","caseSensitive","path","id","index","children"]);function f(e,r,a,n){return void 0===a&&(a=[]),void 0===n&&(n={}),e.map(((e,i)=>{let s=[...a,i],l="string"==typeof e.id?e.id:s.join("-");if(o(!0!==e.index||!e.children,"Cannot specify children on an index route"),o(!n[l],'Found a route id collision on id "'+l+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let a=t({},e,r(e),{id:l});return n[l]=a,a}{let a=t({},e,r(e),{id:l,children:void 0});return n[l]=a,e.children&&(a.children=f(e.children,r,s,n)),a}}))}function p(e,t,r){void 0===r&&(r="/");let a=R(("string"==typeof t?u(t):t).pathname||"/",r);if(null==a)return null;let o=y(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){return e.length===t.length&&e.slice(0,-1).every(((e,r)=>e===t[r]))?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let n=null;for(let e=0;null==n&&e<o.length;++e){let t=E(a);n=D(o[e],t)}return n}function m(e,t){let{route:r,pathname:a,params:o}=e;return{id:r.id,pathname:a,params:o,data:t[r.id],handle:r.handle}}function y(e,t,r,a){void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a="");let n=(e,n,i)=>{let s={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:n,route:e};s.relativePath.startsWith("/")&&(o(s.relativePath.startsWith(a),'Absolute route path "'+s.relativePath+'" nested under path "'+a+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),s.relativePath=s.relativePath.slice(a.length));let l=j([a,s.relativePath]),u=r.concat(s);e.children&&e.children.length>0&&(o(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),y(e.children,t,u,l)),(null!=e.path||e.index)&&t.push({path:l,score:w(l,e.index),routesMeta:u})};return e.forEach(((e,t)=>{var r;if(""!==e.path&&null!=(r=e.path)&&r.includes("?"))for(let r of v(e.path))n(e,t,r);else n(e,t)})),t}function v(e){let t=e.split("/");if(0===t.length)return[];let[r,...a]=t,o=r.endsWith("?"),n=r.replace(/\?$/,"");if(0===a.length)return o?[n,""]:[n];let i=v(a.join("/")),s=[];return s.push(...i.map((e=>""===e?n:[n,e].join("/")))),o&&s.push(...i),s.map((t=>e.startsWith("/")&&""===t?"/":t))}const g=/^:[\w-]+$/,b=e=>"*"===e;function w(e,t){let r=e.split("/"),a=r.length;return r.some(b)&&(a+=-2),t&&(a+=2),r.filter((e=>!b(e))).reduce(((e,t)=>e+(g.test(t)?3:""===t?1:10)),a)}function D(e,t){let{routesMeta:r}=e,a={},o="/",n=[];for(let e=0;e<r.length;++e){let i=r[e],s=e===r.length-1,l="/"===o?t:t.slice(o.length)||"/",u=S({path:i.relativePath,caseSensitive:i.caseSensitive,end:s},l);if(!u)return null;Object.assign(a,u.params);let d=i.route;n.push({params:a,pathname:j([o,u.pathname]),pathnameBase:k(j([o,u.pathnameBase])),route:d}),"/"!==u.pathnameBase&&(o=j([o,u.pathnameBase]))}return n}function S(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=function(e,t,r){void 0===t&&(t=!1);void 0===r&&(r=!0);n("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were "'+e.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+e.replace(/\*$/,"/*")+'".');let a=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,r)=>(a.push({paramName:t,isOptional:null!=r}),r?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(a.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))");return[new RegExp(o,t?void 0:"i"),a]}(e.path,e.caseSensitive,e.end),o=t.match(r);if(!o)return null;let i=o[0],s=i.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:a.reduce(((e,t,r)=>{let{paramName:a,isOptional:o}=t;if("*"===a){let e=l[r]||"";s=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1")}const n=l[r];return e[a]=o&&!n?void 0:(n||"").replace(/%2F/g,"/"),e}),{}),pathname:i,pathnameBase:s,pattern:e}}function E(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return n(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function R(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&"/"!==a?null:e.slice(r)||"/"}function P(e,t){void 0===t&&(t="/");let{pathname:r,search:a="",hash:o=""}="string"==typeof e?u(e):e,n=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:n,search:_(a),hash:T(o)}}function x(e,t,r,a){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(a)+"]. Please separate it out to the `to."+r+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function L(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function A(e,t){let r=L(e);return t?r.map(((t,r)=>r===e.length-1?t.pathname:t.pathnameBase)):r.map((e=>e.pathnameBase))}function M(e,r,a,n){let i;void 0===n&&(n=!1),"string"==typeof e?i=u(e):(i=t({},e),o(!i.pathname||!i.pathname.includes("?"),x("?","pathname","search",i)),o(!i.pathname||!i.pathname.includes("#"),x("#","pathname","hash",i)),o(!i.search||!i.search.includes("#"),x("#","search","hash",i)));let s,l=""===e||""===i.pathname,d=l?"/":i.pathname;if(null==d)s=a;else{let e=r.length-1;if(!n&&d.startsWith("..")){let t=d.split("/");for(;".."===t[0];)t.shift(),e-=1;i.pathname=t.join("/")}s=e>=0?r[e]:"/"}let c=P(i,s),h=d&&"/"!==d&&d.endsWith("/"),f=(l||"."===d)&&a.endsWith("/");return c.pathname.endsWith("/")||!h&&!f||(c.pathname+="/"),c}const j=e=>e.join("/").replace(/\/\/+/g,"/"),k=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),_=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",T=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class O extends Error{}class U{constructor(e,t){let r;this.pendingKeysSet=new Set,this.subscribers=new Set,this.deferredKeys=[],o(e&&"object"==typeof e&&!Array.isArray(e),"defer() only accepts plain objects"),this.abortPromise=new Promise(((e,t)=>r=t)),this.controller=new AbortController;let a=()=>r(new O("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",a),this.controller.signal.addEventListener("abort",a),this.data=Object.entries(e).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:this.trackPromise(r,a)})}),{}),this.done&&this.unlistenAbortSignal(),this.init=t}trackPromise(e,t){if(!(t instanceof Promise))return t;this.deferredKeys.push(e),this.pendingKeysSet.add(e);let r=Promise.race([t,this.abortPromise]).then((t=>this.onSettle(r,e,void 0,t)),(t=>this.onSettle(r,e,t)));return r.catch((()=>{})),Object.defineProperty(r,"_tracked",{get:()=>!0}),r}onSettle(e,t,r,a){if(this.controller.signal.aborted&&r instanceof O)return this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>r}),Promise.reject(r);if(this.pendingKeysSet.delete(t),this.done&&this.unlistenAbortSignal(),void 0===r&&void 0===a){let r=new Error('Deferred data for key "'+t+'" resolved/rejected with `undefined`, you must resolve/reject with a value or `null`.');return Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)}return void 0===a?(Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)):(Object.defineProperty(e,"_data",{get:()=>a}),this.emit(!1,t),a)}emit(e,t){this.subscribers.forEach((r=>r(e,t)))}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}cancel(){this.controller.abort(),this.pendingKeysSet.forEach(((e,t)=>this.pendingKeysSet.delete(t))),this.emit(!0)}async resolveData(e){let t=!1;if(!this.done){let r=()=>this.cancel();e.addEventListener("abort",r),t=await new Promise((t=>{this.subscribe((a=>{e.removeEventListener("abort",r),(a||this.done)&&t(a)}))}))}return t}get done(){return 0===this.pendingKeysSet.size}get unwrappedData(){return o(null!==this.data&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:C(a)})}),{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function C(e){if(!function(e){return e instanceof Promise&&!0===e._tracked}(e))return e;if(e._error)throw e._error;return e._data}const H=function(e,r){void 0===r&&(r=302);let a=r;"number"==typeof a?a={status:a}:void 0===a.status&&(a.status=302);let o=new Headers(a.headers);return o.set("Location",e),new Response(null,t({},a,{headers:o}))};class I{constructor(e,t,r,a){void 0===a&&(a=!1),this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function z(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}const F=["post","put","patch","delete"],B=new Set(F),N=["get",...F],W=new Set(N),$=new Set([301,302,303,307,308]),q=new Set([307,308]),K={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Y={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},J={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},V=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,X=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),G="remix-router-transitions";const Q=Symbol("deferred");function Z(e,t,r){if(r.v7_throwAbortReason&&void 0!==e.signal.reason)throw e.signal.reason;throw new Error((t?"queryRoute":"query")+"() call aborted: "+e.method+" "+e.url)}function ee(e,t,r,a,o,n,i,s){let u,d;if(i){u=[];for(let e of t)if(u.push(e),e.route.id===i){d=e;break}}else u=t,d=t[t.length-1];let c=M(o||".",A(u,n),R(e.pathname,r)||e.pathname,"path"===s);return null==o&&(c.search=e.search,c.hash=e.hash),null!=o&&""!==o&&"."!==o||!d||!d.route.index||_e(c.search)||(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),a&&"/"!==r&&(c.pathname="/"===c.pathname?r:j([r,c.pathname])),l(c)}function te(e,t,r,a){if(!a||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(a))return{path:r};if(a.formMethod&&!Ae(a.formMethod))return{path:r,error:be(405,{method:a.formMethod})};let n,i,s=()=>({path:r,error:be(400,{type:"invalid-body"})}),d=a.formMethod||"get",c=e?d.toUpperCase():d.toLowerCase(),h=De(r);if(void 0!==a.body){if("text/plain"===a.formEncType){if(!Me(c))return s();let e="string"==typeof a.body?a.body:a.body instanceof FormData||a.body instanceof URLSearchParams?Array.from(a.body.entries()).reduce(((e,t)=>{let[r,a]=t;return""+e+r+"="+a+"\n"}),""):String(a.body);return{path:r,submission:{formMethod:c,formAction:h,formEncType:a.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===a.formEncType){if(!Me(c))return s();try{let e="string"==typeof a.body?JSON.parse(a.body):a.body;return{path:r,submission:{formMethod:c,formAction:h,formEncType:a.formEncType,formData:void 0,json:e,text:void 0}}}catch(e){return s()}}}if(o("function"==typeof FormData,"FormData is not available in this environment"),a.formData)n=he(a.formData),i=a.formData;else if(a.body instanceof FormData)n=he(a.body),i=a.body;else if(a.body instanceof URLSearchParams)n=a.body,i=fe(n);else if(null==a.body)n=new URLSearchParams,i=new FormData;else try{n=new URLSearchParams(a.body),i=fe(n)}catch(e){return s()}let f={formMethod:c,formAction:h,formEncType:a&&a.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(Me(f.formMethod))return{path:r,submission:f};let p=u(r);return t&&p.search&&_e(p.search)&&n.append("index",""),p.search="?"+n,{path:l(p),submission:f}}function re(e,t){let r=e;if(t){let a=e.findIndex((e=>e.route.id===t));a>=0&&(r=e.slice(0,a))}return r}function ae(e,r,a,o,n,i,s,l,u,d,c,h,f,m,y,v){let g=v?Object.values(v)[0]:y?Object.values(y)[0]:void 0,b=e.createURL(r.location),w=e.createURL(n),D=v?Object.keys(v)[0]:void 0,S=re(a,D).filter(((e,a)=>{let{route:n}=e;if(n.lazy)return!0;if(null==n.loader)return!1;if(i)return!("function"==typeof n.loader&&!n.loader.hydrate)||void 0===r.loaderData[n.id]&&(!r.errors||void 0===r.errors[n.id]);if(function(e,t,r){let a=!t||r.route.id!==t.route.id,o=void 0===e[r.route.id];return a||o}(r.loaderData,r.matches[a],e)||l.some((t=>t===e.route.id)))return!0;let u=r.matches[a],d=e;return ne(e,t({currentUrl:b,currentParams:u.params,nextUrl:w,nextParams:d.params},o,{actionResult:g,defaultShouldRevalidate:s||b.pathname+b.search===w.pathname+w.search||b.search!==w.search||oe(u,d)}))})),E=[];return c.forEach(((e,n)=>{if(i||!a.some((t=>t.route.id===e.routeId))||d.has(n))return;let l=p(f,e.path,m);if(!l)return void E.push({key:n,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let c=r.fetchers.get(n),y=Te(l,e.path),v=!1;v=!h.has(n)&&(!!u.includes(n)||(c&&"idle"!==c.state&&void 0===c.data?s:ne(y,t({currentUrl:b,currentParams:r.matches[r.matches.length-1].params,nextUrl:w,nextParams:a[a.length-1].params},o,{actionResult:g,defaultShouldRevalidate:s})))),v&&E.push({key:n,routeId:e.routeId,path:e.path,matches:l,match:y,controller:new AbortController})})),[S,E]}function oe(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function ne(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}async function ie(e,r,a){if(!e.lazy)return e;let i=await e.lazy();if(!e.lazy)return e;let s=a[e.id];o(s,"No route found in manifest");let l={};for(let e in i){let t=void 0!==s[e]&&"hasErrorBoundary"!==e;n(!t,'Route "'+s.id+'" has a static property "'+e+'" defined but its lazy function is also returning a value for this property. The lazy route property "'+e+'" will be ignored.'),t||h.has(e)||(l[e]=i[e])}return Object.assign(s,l),Object.assign(s,t({},r(s),{lazy:void 0})),s}function se(e){return Promise.all(e.matches.map((e=>e.bikeshed_loadRoute())))}async function le(e,r,a,n,i,s,l,u){let d=n.reduce(((e,t)=>e.add(t.route.id)),new Set),h=new Set,f=await e({matches:i.map((e=>t({},e,{bikeshed_loadRoute:t=>(h.add(e.route.id),d.has(e.route.id)?async function(e,t,r,a,n,i,s){let l,u,d=a=>{let o,n=new Promise(((e,t)=>o=t));u=()=>o(),t.signal.addEventListener("abort",u);let l=o=>"function"!=typeof a?Promise.reject(new Error('You cannot call the handler for a route which defines a boolean "'+e+'" [routeId: '+r.route.id+"]")):a({request:t,params:r.params,context:s},...void 0!==o?[o]:[]),d=i?i((async e=>l(e))):l();return Promise.race([d,n])};try{let i=r.route[e];if(r.route.lazy)if(i){let e,t=await Promise.all([d(i).catch((t=>{e=t})),ie(r.route,n,a)]);if(e)throw e;l=t[0]}else{if(await ie(r.route,n,a),i=r.route[e],!i){if("action"===e){let e=new URL(t.url),a=e.pathname+e.search;throw be(405,{method:t.method,pathname:a,routeId:r.route.id})}return{type:c.data,result:void 0}}l=await d(i)}else{if(!i){let e=new URL(t.url);throw be(404,{pathname:e.pathname+e.search})}l=await d(i)}o(void 0!==l,"You defined "+("action"===e?"an action":"a loader")+' for route "'+r.route.id+"\" but didn't return anything from your `"+e+"` function. Please return a value or `null`.")}catch(e){return{type:c.error,result:e}}finally{u&&t.signal.removeEventListener("abort",u)}return{type:c.data,result:l}}(r,a,e,s,l,t,u):Promise.resolve({type:c.data,result:void 0}))}))),request:a,params:i[0].params});return i.forEach((e=>o(h.has(e.route.id),'`match.bikeshed_loadRoute()` was not called for route id "'+e.route.id+'". You must call `match.bikeshed_loadRoute()` on every match passed to `dataStrategy` to ensure all routes are properly loaded.'))),f.filter(((e,t)=>d.has(i[t].route.id)))}async function ue(e){let{result:t,type:r}=e;if(Le(t)){let e;try{let r=t.headers.get("Content-Type");e=r&&/\bapplication\/json\b/.test(r)?null==t.body?null:await t.json():await t.text()}catch(e){return{type:c.error,error:e}}return r===c.error?{type:r,error:new I(t.status,t.statusText,e),response:t}:{type:c.data,data:e,response:t}}return r===c.error?{type:r,error:t}:xe(t)?{type:c.deferred,deferredData:t,statusCode:null==(a=t.init)?void 0:a.status,headers:(null==(o=t.init)?void 0:o.headers)&&new Headers(t.init.headers)}:{type:c.data,data:t};var a,o}function de(e,t,r,a,n,i){let s=e.headers.get("Location");if(o(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!V.test(s)){let o=a.slice(0,a.findIndex((e=>e.route.id===r))+1);s=ee(new URL(t.url),o,n,!0,s,i),e.headers.set("Location",s)}return e}function ce(e,t,r,a){let o=e.createURL(De(t)).toString(),n={signal:r};if(a&&Me(a.formMethod)){let{formMethod:e,formEncType:t}=a;n.method=e.toUpperCase(),"application/json"===t?(n.headers=new Headers({"Content-Type":t}),n.body=JSON.stringify(a.json)):"text/plain"===t?n.body=a.text:"application/x-www-form-urlencoded"===t&&a.formData?n.body=he(a.formData):n.body=a.formData}return new Request(o,n)}function he(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,"string"==typeof a?a:a.name);return t}function fe(e){let t=new FormData;for(let[r,a]of e.entries())t.append(r,a);return t}function pe(e,t,r,a,n){let i,s={},l=null,u=!1,d={};return r.forEach(((r,c)=>{let h=t[c].route.id;if(o(!Pe(r),"Cannot handle redirect results in processLoaderData"),Re(r)){let t=ve(e,h),o=r.error;a&&(o=Object.values(a)[0],a=void 0),l=l||{},null==l[t.route.id]&&(l[t.route.id]=o),s[h]=void 0,u||(u=!0,i=z(r.error)?r.error.status:500),r.response&&(d[h]=r.response.headers)}else Ee(r)?(n.set(h,r.deferredData),s[h]=r.deferredData.data,null==r.statusCode||200===r.statusCode||u||(i=r.statusCode),r.headers&&(d[h]=r.headers)):(s[h]=r.data,r.response&&(200===r.response.status||u||(i=r.response.status),d[h]=r.response.headers))})),a&&(l=a,s[Object.keys(a)[0]]=void 0),{loaderData:s,errors:l,statusCode:i||200,loaderHeaders:d}}function me(e,r,a,n,i,s,l,u){let{loaderData:d,errors:c}=pe(r,a,n,i,u);for(let r=0;r<s.length;r++){let{key:a,match:n,controller:i}=s[r];o(void 0!==l&&void 0!==l[r],"Did not find corresponding fetcher result");let u=l[r];if(!i||!i.signal.aborted)if(Re(u)){let r=ve(e.matches,null==n?void 0:n.route.id);c&&c[r.route.id]||(c=t({},c,{[r.route.id]:u.error})),e.fetchers.delete(a)}else if(Pe(u))o(!1,"Unhandled fetcher revalidation redirect");else if(Ee(u))o(!1,"Unhandled fetcher deferred data");else{let t=Ie(u.data);e.fetchers.set(a,t)}}return{loaderData:d,errors:c}}function ye(e,r,a,o){let n=t({},r);for(let t of a){let a=t.route.id;if(r.hasOwnProperty(a)?void 0!==r[a]&&(n[a]=r[a]):void 0!==e[a]&&t.route.loader&&(n[a]=e[a]),o&&o.hasOwnProperty(a))break}return n}function ve(e,t){return(t?e.slice(0,e.findIndex((e=>e.route.id===t))+1):[...e]).reverse().find((e=>!0===e.route.hasErrorBoundary))||e[0]}function ge(e){let t=1===e.length?e[0]:e.find((e=>e.index||!e.path||"/"===e.path))||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function be(e,t){let{pathname:r,routeId:a,method:o,type:n}=void 0===t?{}:t,i="Unknown Server Error",s="Unknown @remix-run/router error";return 400===e?(i="Bad Request",o&&r&&a?s="You made a "+o+' request to "'+r+'" but did not provide a `loader` for route "'+a+'", so there is no way to handle the request.':"defer-action"===n?s="defer() is not supported in actions":"invalid-body"===n&&(s="Unable to encode submission body")):403===e?(i="Forbidden",s='Route "'+a+'" does not match URL "'+r+'"'):404===e?(i="Not Found",s='No route matches URL "'+r+'"'):405===e&&(i="Method Not Allowed",o&&r&&a?s="You made a "+o.toUpperCase()+' request to "'+r+'" but did not provide an `action` for route "'+a+'", so there is no way to handle the request.':o&&(s='Invalid request method "'+o.toUpperCase()+'"')),new I(e||500,i,new Error(s),!0)}function we(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(Pe(r))return{result:r,idx:t}}}function De(e){return l(t({},"string"==typeof e?u(e):e,{hash:""}))}function Se(e){return Le(e.result)&&$.has(e.result.status)}function Ee(e){return e.type===c.deferred}function Re(e){return e.type===c.error}function Pe(e){return(e&&e.type)===c.redirect}function xe(e){let t=e;return t&&"object"==typeof t&&"object"==typeof t.data&&"function"==typeof t.subscribe&&"function"==typeof t.cancel&&"function"==typeof t.resolveData}function Le(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function Ae(e){return W.has(e.toLowerCase())}function Me(e){return B.has(e.toLowerCase())}async function je(e,t,r,a,n,i){for(let s=0;s<r.length;s++){let l=r[s],u=t[s];if(!u)continue;let d=e.find((e=>e.route.id===u.route.id)),c=null!=d&&!oe(d,u)&&void 0!==(i&&i[u.route.id]);if(Ee(l)&&(n||c)){let e=a[s];o(e,"Expected an AbortSignal for revalidating fetcher deferred result"),await ke(l,e,n).then((e=>{e&&(r[s]=e||r[s])}))}}}async function ke(e,t,r){if(void 0===r&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:c.data,data:e.deferredData.unwrappedData}}catch(e){return{type:c.error,error:e}}return{type:c.data,data:e.deferredData.data}}}function _e(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function Te(e,t){let r="string"==typeof t?u(t).search:t.search;if(e[e.length-1].route.index&&_e(r||""))return e[e.length-1];let a=L(e);return a[a.length-1]}function Oe(e){let{formMethod:t,formAction:r,formEncType:a,text:o,formData:n,json:i}=e;if(t&&r&&a)return null!=o?{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:void 0,text:o}:null!=n?{formMethod:t,formAction:r,formEncType:a,formData:n,json:void 0,text:void 0}:void 0!==i?{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:i,text:void 0}:void 0}function Ue(e,t){if(t){return{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}return{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Ce(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function He(e,t){if(e){return{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}}return{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Ie(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}e.AbortedDeferredError=O,e.Action=r,e.IDLE_BLOCKER=J,e.IDLE_FETCHER=Y,e.IDLE_NAVIGATION=K,e.UNSAFE_DEFERRED_SYMBOL=Q,e.UNSAFE_DeferredData=U,e.UNSAFE_ErrorResponseImpl=I,e.UNSAFE_convertRouteMatchToUiMatch=m,e.UNSAFE_convertRoutesToDataRoutes=f,e.UNSAFE_getResolveToMatches=A,e.UNSAFE_invariant=o,e.UNSAFE_warning=n,e.createBrowserHistory=function(e){return void 0===e&&(e={}),d((function(e,t){let{pathname:r,search:a,hash:o}=e.location;return s("",{pathname:r,search:a,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:l(t)}),null,e)},e.createHashHistory=function(e){return void 0===e&&(e={}),d((function(e,t){let{pathname:r="/",search:a="",hash:o=""}=u(e.location.hash.substr(1));return r.startsWith("/")||r.startsWith(".")||(r="/"+r),s("",{pathname:r,search:a,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let r=e.document.querySelector("base"),a="";if(r&&r.getAttribute("href")){let t=e.location.href,r=t.indexOf("#");a=-1===r?t:t.slice(0,r)}return a+"#"+("string"==typeof t?t:l(t))}),(function(e,t){n("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")}),e)},e.createMemoryHistory=function(e){void 0===e&&(e={});let t,{initialEntries:a=["/"],initialIndex:o,v5Compat:i=!1}=e;t=a.map(((e,t)=>m(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let d=f(null==o?t.length-1:o),c=r.Pop,h=null;function f(e){return Math.min(Math.max(e,0),t.length-1)}function p(){return t[d]}function m(e,r,a){void 0===r&&(r=null);let o=s(t?p().pathname:"/",e,r,a);return n("/"===o.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),o}function y(e){return"string"==typeof e?e:l(e)}return{get index(){return d},get action(){return c},get location(){return p()},createHref:y,createURL:e=>new URL(y(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?u(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,a){c=r.Push;let o=m(e,a);d+=1,t.splice(d,t.length,o),i&&h&&h({action:c,location:o,delta:1})},replace(e,a){c=r.Replace;let o=m(e,a);t[d]=o,i&&h&&h({action:c,location:o,delta:0})},go(e){c=r.Pop;let a=f(d+e),o=t[a];d=a,h&&h({action:c,location:o,delta:e})},listen:e=>(h=e,()=>{h=null})}},e.createPath=l,e.createRouter=function(e){const a=e.window?e.window:"undefined"!=typeof window?window:void 0,i=void 0!==a&&void 0!==a.document&&void 0!==a.document.createElement,l=!i;let u;if(o(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)u=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;u=e=>({hasErrorBoundary:t(e)})}else u=X;let d,h,y={},v=f(e.routes,u,void 0,y),g=e.basename||"/",b=e.unstable_dataStrategy||se,w=t({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1},e.future),D=null,S=new Set,E=null,P=null,x=null,L=null!=e.hydrationData,A=p(v,e.history.location,g),M=null;if(null==A){let t=be(404,{pathname:e.history.location.pathname}),{matches:r,route:a}=ge(v);A=r,M={[a.id]:t}}let j,k=A.some((e=>e.route.lazy)),_=A.some((e=>e.route.loader));if(k)h=!1;else if(_)if(w.v7_partialHydration){let t=e.hydrationData?e.hydrationData.loaderData:null,r=e.hydrationData?e.hydrationData.errors:null;h=A.every((e=>e.route.loader&&("function"!=typeof e.route.loader||!0!==e.route.loader.hydrate)&&(t&&void 0!==t[e.route.id]||r&&void 0!==r[e.route.id])))}else h=null!=e.hydrationData;else h=!0;let T,O={historyAction:e.history.action,location:e.history.location,matches:A,initialized:h,navigation:K,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||M,fetchers:new Map,blockers:new Map},U=r.Pop,C=!1,H=!1,I=new Map,z=null,F=!1,B=!1,N=[],W=[],$=new Map,Q=0,Z=-1,re=new Map,oe=new Set,ne=new Map,ie=new Map,he=new Set,fe=new Map,pe=new Map,De=!1;function xe(e,r){void 0===r&&(r={}),O=t({},O,e);let a=[],o=[];w.v7_fetcherPersist&&O.fetchers.forEach(((e,t)=>{"idle"===e.state&&(he.has(t)?o.push(t):a.push(t))})),[...S].forEach((e=>e(O,{deletedFetchers:o,unstable_viewTransitionOpts:r.viewTransitionOpts,unstable_flushSync:!0===r.flushSync}))),w.v7_fetcherPersist&&(a.forEach((e=>O.fetchers.delete(e))),o.forEach((e=>qe(e))))}function Le(a,o,n){var i,s;let l,{flushSync:u}=void 0===n?{}:n,c=null!=O.actionData&&null!=O.navigation.formMethod&&Me(O.navigation.formMethod)&&"loading"===O.navigation.state&&!0!==(null==(i=a.state)?void 0:i._isRedirect);l=o.actionData?Object.keys(o.actionData).length>0?o.actionData:null:c?O.actionData:null;let h=o.loaderData?ye(O.loaderData,o.loaderData,o.matches||[],o.errors):O.loaderData,f=O.blockers;f.size>0&&(f=new Map(f),f.forEach(((e,t)=>f.set(t,J))));let p,m=!0===C||null!=O.navigation.formMethod&&Me(O.navigation.formMethod)&&!0!==(null==(s=a.state)?void 0:s._isRedirect);if(d&&(v=d,d=void 0),F||U===r.Pop||(U===r.Push?e.history.push(a,a.state):U===r.Replace&&e.history.replace(a,a.state)),U===r.Pop){let e=I.get(O.location.pathname);e&&e.has(a.pathname)?p={currentLocation:O.location,nextLocation:a}:I.has(a.pathname)&&(p={currentLocation:a,nextLocation:O.location})}else if(H){let e=I.get(O.location.pathname);e?e.add(a.pathname):(e=new Set([a.pathname]),I.set(O.location.pathname,e)),p={currentLocation:O.location,nextLocation:a}}xe(t({},o,{actionData:l,loaderData:h,historyAction:U,location:a,initialized:!0,navigation:K,revalidation:"idle",restoreScrollPosition:tt(a,o.matches||O.matches),preventScrollReset:m,blockers:f}),{viewTransitionOpts:p,flushSync:!0===u}),U=r.Pop,C=!1,H=!1,F=!1,B=!1,N=[],W=[]}async function Ae(a,o,n){T&&T.abort(),T=null,U=a,F=!0===(n&&n.startUninterruptedRevalidation),function(e,t){if(E&&x){let r=et(e,t);E[r]=x()}}(O.location,O.matches),C=!0===(n&&n.preventScrollReset),H=!0===(n&&n.enableViewTransition);let i=d||v,s=n&&n.overrideNavigation,l=p(i,o,g),u=!0===(n&&n.flushSync);if(!l){let e=be(404,{pathname:o.pathname}),{matches:t,route:r}=ge(i);return Ze(),void Le(o,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u})}if(O.initialized&&!B&&function(e,t){if(e.pathname!==t.pathname||e.search!==t.search)return!1;if(""===e.hash)return""!==t.hash;if(e.hash===t.hash)return!0;if(""!==t.hash)return!0;return!1}(O.location,o)&&!(n&&n.submission&&Me(n.submission.formMethod)))return void Le(o,{matches:l},{flushSync:u});T=new AbortController;let h,f,m=ce(e.history,o,T.signal,n&&n.submission);if(n&&n.pendingError)f={[ve(l).route.id]:n.pendingError};else if(n&&n.submission&&Me(n.submission.formMethod)){let e=await async function(e,t,a,o,n){void 0===n&&(n={});let i;Be(),xe({navigation:Ce(t,a)},{flushSync:!0===n.flushSync});let s=Te(o,t);if(s.route.action||s.route.lazy){if(i=(await ze("action",e,[s],o))[0],e.signal.aborted)return{shortCircuited:!0}}else i={type:c.error,error:be(405,{method:e.method,pathname:t.pathname,routeId:s.route.id})};if(Pe(i)){let t;return t=n&&null!=n.replace?n.replace:i.response.headers.get("Location")===O.location.pathname+O.location.search,await _e(e,i,{submission:a,replace:t}),{shortCircuited:!0}}if(Re(i)){let e=ve(o,s.route.id);return!0!==(n&&n.replace)&&(U=r.Push),{pendingActionData:{},pendingActionError:{[e.route.id]:i.error}}}if(Ee(i))throw be(400,{type:"defer-action"});return{pendingActionData:{[s.route.id]:i.data}}}(m,o,n.submission,l,{replace:n.replace,flushSync:u});if(e.shortCircuited)return;h=e.pendingActionData,f=e.pendingActionError,s=Ue(o,n.submission),u=!1,m=new Request(m.url,{signal:m.signal})}let{shortCircuited:y,loaderData:b,errors:D}=await async function(r,a,o,n,i,s,l,u,c,h,f){let p=n||Ue(a,i),m=i||s||Oe(p),y=d||v,[b,D]=ae(e.history,O,o,m,a,w.v7_partialHydration&&!0===u,B,N,W,he,ne,oe,y,g,h,f);if(Ze((e=>!(o&&o.some((t=>t.route.id===e)))||b&&b.some((t=>t.route.id===e)))),Z=++Q,0===b.length&&0===D.length){let e=Je();return Le(a,t({matches:o,loaderData:{},errors:f||null},h?{actionData:h}:{},e?{fetchers:new Map(O.fetchers)}:{}),{flushSync:c}),{shortCircuited:!0}}if(!(F||w.v7_partialHydration&&u)){D.forEach((e=>{let t=O.fetchers.get(e.key),r=He(void 0,t?t.data:void 0);O.fetchers.set(e.key,r)}));let e=h||O.actionData;xe(t({navigation:p},e?0===Object.keys(e).length?{actionData:null}:{actionData:e}:{},D.length>0?{fetchers:new Map(O.fetchers)}:{}),{flushSync:c})}D.forEach((e=>{$.has(e.key)&&Ke(e.key),e.controller&&$.set(e.key,e.controller)}));let S=()=>D.forEach((e=>Ke(e.key)));T&&T.signal.addEventListener("abort",S);let{loaderResults:E,fetcherResults:R}=await Fe(O.matches,o,b,D,r);if(r.signal.aborted)return{shortCircuited:!0};T&&T.signal.removeEventListener("abort",S);D.forEach((e=>$.delete(e.key)));let P=we([...E,...R]);if(P){if(P.idx>=b.length){let e=D[P.idx-b.length].key;oe.add(e)}return await _e(r,P.result,{replace:l}),{shortCircuited:!0}}let{loaderData:x,errors:L}=me(O,o,b,E,f,D,R,fe);fe.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&fe.delete(t)}))}));let A=Je(),M=Ve(Z),j=A||M||D.length>0;return t({loaderData:x,errors:L},j?{fetchers:new Map(O.fetchers)}:{})}(m,o,l,s,n&&n.submission,n&&n.fetcherSubmission,n&&n.replace,n&&!0===n.initialHydration,u,h,f);y||(T=null,Le(o,t({matches:l},h?{actionData:h}:{},{loaderData:b,errors:D})))}async function _e(n,l,u){let{submission:d,fetcherSubmission:c,replace:h}=void 0===u?{}:u;l.response.headers.has("X-Remix-Revalidate")&&(B=!0);let f=l.response.headers.get("Location");o(f,"Expected a Location header on the redirect Response");let p=s(O.location,f,{_isRedirect:!0});if(V.test(f)){let e=f,t=new URL(n.url),r=e.startsWith("//")?new URL(t.protocol+e):new URL(e),a=null!=R(r.pathname,g);r.origin===t.origin&&a&&(e=r.pathname+r.search+r.hash,p=s(O.location,e,{_isRedirect:!0}))}if(i){let t=!1;if(l.response.headers.has("X-Remix-Reload-Document"))t=!0;else if(V.test(f)){const r=e.history.createURL(f);t=r.origin!==a.location.origin||null==R(r.pathname,g)}if(t)return void(h?a.location.replace(f):a.location.assign(f))}T=null;let m=!0===h?r.Replace:r.Push,{formMethod:y,formAction:v,formEncType:b}=O.navigation;!d&&!c&&y&&v&&b&&(d=Oe(O.navigation));let w=d||c;if(q.has(l.response.status)&&w&&Me(w.formMethod))await Ae(m,p,{submission:t({},w,{formAction:f}),preventScrollReset:C});else{let e=Ue(p,d);await Ae(m,p,{overrideNavigation:e,fetcherSubmission:c,preventScrollReset:C})}}async function ze(e,t,r,a){try{let o=await le(b,e,t,r,a,y,u);return await Promise.all(o.map(((e,o)=>Se(e)?{type:c.redirect,response:de(e.result,t,r[o].route.id,a,g,w.v7_relativeSplatPath)}:ue(e))))}catch(e){return r.map((()=>({type:c.error,error:e})))}}async function Fe(t,r,a,o,n){let[i,...s]=await Promise.all([a.length?ze("loader",n,a,r):[],...o.map((t=>{if(t.matches&&t.match&&t.controller){return ze("loader",ce(e.history,t.path,t.controller.signal),[t.match],t.matches).then((e=>e[0]))}return Promise.resolve({type:c.error,error:be(404,{pathname:t.path})})}))]);return await Promise.all([je(t,a,i,i.map((()=>n.signal)),!1,O.loaderData),je(t,o.map((e=>e.match)),s,o.map((e=>e.controller?e.controller.signal:null)),!0)]),{loaderResults:i,fetcherResults:s}}function Be(){B=!0,N.push(...Ze()),ne.forEach(((e,t)=>{$.has(t)&&(W.push(t),Ke(t))}))}function Ne(e,t,r){void 0===r&&(r={}),O.fetchers.set(e,t),xe({fetchers:new Map(O.fetchers)},{flushSync:!0===(r&&r.flushSync)})}function We(e,t,r,a){void 0===a&&(a={});let o=ve(O.matches,t);qe(e),xe({errors:{[o.route.id]:r},fetchers:new Map(O.fetchers)},{flushSync:!0===(a&&a.flushSync)})}function $e(e){return w.v7_fetcherPersist&&(ie.set(e,(ie.get(e)||0)+1),he.has(e)&&he.delete(e)),O.fetchers.get(e)||Y}function qe(e){let t=O.fetchers.get(e);!$.has(e)||t&&"loading"===t.state&&re.has(e)||Ke(e),ne.delete(e),re.delete(e),oe.delete(e),he.delete(e),O.fetchers.delete(e)}function Ke(e){let t=$.get(e);o(t,"Expected fetch controller: "+e),t.abort(),$.delete(e)}function Ye(e){for(let t of e){let e=Ie($e(t).data);O.fetchers.set(t,e)}}function Je(){let e=[],t=!1;for(let r of oe){let a=O.fetchers.get(r);o(a,"Expected fetcher: "+r),"loading"===a.state&&(oe.delete(r),e.push(r),t=!0)}return Ye(e),t}function Ve(e){let t=[];for(let[r,a]of re)if(a<e){let e=O.fetchers.get(r);o(e,"Expected fetcher: "+r),"loading"===e.state&&(Ke(r),re.delete(r),t.push(r))}return Ye(t),t.length>0}function Xe(e){O.blockers.delete(e),pe.delete(e)}function Ge(e,t){let r=O.blockers.get(e)||J;o("unblocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"proceeding"===t.state||"blocked"===r.state&&"unblocked"===t.state||"proceeding"===r.state&&"unblocked"===t.state,"Invalid blocker state transition: "+r.state+" -> "+t.state);let a=new Map(O.blockers);a.set(e,t),xe({blockers:a})}function Qe(e){let{currentLocation:t,nextLocation:r,historyAction:a}=e;if(0===pe.size)return;pe.size>1&&n(!1,"A router only supports one blocker at a time");let o=Array.from(pe.entries()),[i,s]=o[o.length-1],l=O.blockers.get(i);return l&&"proceeding"===l.state?void 0:s({currentLocation:t,nextLocation:r,historyAction:a})?i:void 0}function Ze(e){let t=[];return fe.forEach(((r,a)=>{e&&!e(a)||(r.cancel(),t.push(a),fe.delete(a))})),t}function et(e,t){if(P){return P(e,t.map((e=>m(e,O.loaderData))))||e.key}return e.key}function tt(e,t){if(E){let r=et(e,t),a=E[r];if("number"==typeof a)return a}return null}return j={get basename(){return g},get future(){return w},get state(){return O},get routes(){return v},get window(){return a},initialize:function(){if(D=e.history.listen((t=>{let{action:r,location:a,delta:o}=t;if(De)return void(De=!1);n(0===pe.size||null!=o,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=Qe({currentLocation:O.location,nextLocation:a,historyAction:r});return i&&null!=o?(De=!0,e.history.go(-1*o),void Ge(i,{state:"blocked",location:a,proceed(){Ge(i,{state:"proceeding",proceed:void 0,reset:void 0,location:a}),e.history.go(o)},reset(){let e=new Map(O.blockers);e.set(i,J),xe({blockers:e})}})):Ae(r,a)})),i){!function(e,t){try{let r=e.sessionStorage.getItem(G);if(r){let e=JSON.parse(r);for(let[r,a]of Object.entries(e||{}))a&&Array.isArray(a)&&t.set(r,new Set(a||[]))}}catch(e){}}(a,I);let e=()=>function(e,t){if(t.size>0){let r={};for(let[e,a]of t)r[e]=[...a];try{e.sessionStorage.setItem(G,JSON.stringify(r))}catch(e){n(!1,"Failed to save applied view transitions in sessionStorage ("+e+").")}}}(a,I);a.addEventListener("pagehide",e),z=()=>a.removeEventListener("pagehide",e)}return O.initialized||Ae(r.Pop,O.location,{initialHydration:!0}),j},subscribe:function(e){return S.add(e),()=>S.delete(e)},enableScrollRestoration:function(e,t,r){if(E=e,x=t,P=r||null,!L&&O.navigation===K){L=!0;let e=tt(O.location,O.matches);null!=e&&xe({restoreScrollPosition:e})}return()=>{E=null,x=null,P=null}},navigate:async function a(o,n){if("number"==typeof o)return void e.history.go(o);let i=ee(O.location,O.matches,g,w.v7_prependBasename,o,w.v7_relativeSplatPath,null==n?void 0:n.fromRouteId,null==n?void 0:n.relative),{path:l,submission:u,error:d}=te(w.v7_normalizeFormMethod,!1,i,n),c=O.location,h=s(O.location,l,n&&n.state);h=t({},h,e.history.encodeLocation(h));let f=n&&null!=n.replace?n.replace:void 0,p=r.Push;!0===f?p=r.Replace:!1===f||null!=u&&Me(u.formMethod)&&u.formAction===O.location.pathname+O.location.search&&(p=r.Replace);let m=n&&"preventScrollReset"in n?!0===n.preventScrollReset:void 0,y=!0===(n&&n.unstable_flushSync),v=Qe({currentLocation:c,nextLocation:h,historyAction:p});if(!v)return await Ae(p,h,{submission:u,pendingError:d,preventScrollReset:m,replace:n&&n.replace,enableViewTransition:n&&n.unstable_viewTransition,flushSync:y});Ge(v,{state:"blocked",location:h,proceed(){Ge(v,{state:"proceeding",proceed:void 0,reset:void 0,location:h}),a(o,n)},reset(){let e=new Map(O.blockers);e.set(v,J),xe({blockers:e})}})},fetch:function(t,r,a,n){if(l)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");$.has(t)&&Ke(t);let i=!0===(n&&n.unstable_flushSync),s=d||v,u=ee(O.location,O.matches,g,w.v7_prependBasename,a,w.v7_relativeSplatPath,r,null==n?void 0:n.relative),c=p(s,u,g);if(!c)return void We(t,r,be(404,{pathname:u}),{flushSync:i});let{path:h,submission:f,error:m}=te(w.v7_normalizeFormMethod,!0,u,n);if(m)return void We(t,r,m,{flushSync:i});let y=Te(c,h);C=!0===(n&&n.preventScrollReset),f&&Me(f.formMethod)?async function(t,r,a,n,i,s,l){if(Be(),ne.delete(t),!n.route.action&&!n.route.lazy){let e=be(405,{method:l.formMethod,pathname:a,routeId:r});return void We(t,r,e,{flushSync:s})}let u=O.fetchers.get(t);Ne(t,function(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}(l,u),{flushSync:s});let c=new AbortController,h=ce(e.history,a,c.signal,l);$.set(t,c);let f=Q,m=(await ze("action",h,[n],i))[0];if(h.signal.aborted)return void($.get(t)===c&&$.delete(t));if(w.v7_fetcherPersist&&he.has(t)){if(Pe(m)||Re(m))return void Ne(t,Ie(void 0))}else{if(Pe(m))return $.delete(t),Z>f?void Ne(t,Ie(void 0)):(oe.add(t),Ne(t,He(l)),_e(h,m,{fetcherSubmission:l}));if(Re(m))return void We(t,r,m.error)}if(Ee(m))throw be(400,{type:"defer-action"});let y=O.navigation.location||O.location,b=ce(e.history,y,c.signal),D=d||v,S="idle"!==O.navigation.state?p(D,O.navigation.location,g):O.matches;o(S,"Didn't find any matches after fetcher action");let E=++Q;re.set(t,E);let R=He(l,m.data);O.fetchers.set(t,R);let[P,x]=ae(e.history,O,S,l,y,!1,B,N,W,he,ne,oe,D,g,{[n.route.id]:m.data},void 0);x.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,r=O.fetchers.get(t),a=He(void 0,r?r.data:void 0);O.fetchers.set(t,a),$.has(t)&&Ke(t),e.controller&&$.set(t,e.controller)})),xe({fetchers:new Map(O.fetchers)});let L=()=>x.forEach((e=>Ke(e.key)));c.signal.addEventListener("abort",L);let{loaderResults:A,fetcherResults:M}=await Fe(O.matches,S,P,x,b);if(c.signal.aborted)return;c.signal.removeEventListener("abort",L),re.delete(t),$.delete(t),x.forEach((e=>$.delete(e.key)));let j=we([...A,...M]);if(j){if(j.idx>=P.length){let e=x[j.idx-P.length].key;oe.add(e)}return _e(b,j.result)}let{loaderData:k,errors:_}=me(O,O.matches,P,A,void 0,x,M,fe);if(O.fetchers.has(t)){let e=Ie(m.data);O.fetchers.set(t,e)}Ve(E),"loading"===O.navigation.state&&E>Z?(o(U,"Expected pending action"),T&&T.abort(),Le(O.navigation.location,{matches:S,loaderData:k,errors:_,fetchers:new Map(O.fetchers)})):(xe({errors:_,loaderData:ye(O.loaderData,k,S,_),fetchers:new Map(O.fetchers)}),B=!1)}(t,r,h,y,c,i,f):(ne.set(t,{routeId:r,path:h}),async function(t,r,a,n,i,s,l){let u=O.fetchers.get(t);Ne(t,He(l,u?u.data:void 0),{flushSync:s});let d=new AbortController,c=ce(e.history,a,d.signal);$.set(t,d);let h=Q,f=(await ze("loader",c,[n],i))[0];Ee(f)&&(f=await ke(f,c.signal,!0)||f);$.get(t)===d&&$.delete(t);if(c.signal.aborted)return;if(he.has(t))return void Ne(t,Ie(void 0));if(Pe(f))return Z>h?void Ne(t,Ie(void 0)):(oe.add(t),void await _e(c,f));if(Re(f))return void We(t,r,f.error);o(!Ee(f),"Unhandled fetcher deferred data"),Ne(t,Ie(f.data))}(t,r,h,y,c,i,f))},revalidate:function(){Be(),xe({revalidation:"loading"}),"submitting"!==O.navigation.state&&("idle"!==O.navigation.state?Ae(U||O.historyAction,O.navigation.location,{overrideNavigation:O.navigation}):Ae(O.historyAction,O.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:$e,deleteFetcher:function(e){if(w.v7_fetcherPersist){let t=(ie.get(e)||0)-1;t<=0?(ie.delete(e),he.add(e)):ie.set(e,t)}else qe(e);xe({fetchers:new Map(O.fetchers)})},dispose:function(){D&&D(),z&&z(),S.clear(),T&&T.abort(),O.fetchers.forEach(((e,t)=>qe(t))),O.blockers.forEach(((e,t)=>Xe(t)))},getBlocker:function(e,t){let r=O.blockers.get(e)||J;return pe.get(e)!==t&&pe.set(e,t),r},deleteBlocker:Xe,_internalFetchControllers:$,_internalActiveDeferreds:fe,_internalSetRoutes:function(e){y={},d=f(e,u,void 0,y)}},j},e.createStaticHandler=function(e,r){o(e.length>0,"You must provide a non-empty routes array to createStaticHandler");let a,n={},i=(r?r.basename:null)||"/",u=(null==r?void 0:r.unstable_dataStrategy)||se;if(null!=r&&r.mapRouteProperties)a=r.mapRouteProperties;else if(null!=r&&r.detectErrorBoundary){let e=r.detectErrorBoundary;a=t=>({hasErrorBoundary:e(t)})}else a=X;let d=t({v7_relativeSplatPath:!1,v7_throwAbortReason:!1},r?r.future:null),h=f(e,a,void 0,n);async function m(e,r,a,n,i){o(e.signal,"query()/queryRoute() requests must contain an AbortController signal");try{if(Me(e.method.toLowerCase())){let o=await async function(e,r,a,o,n){let i;if(a.route.action||a.route.lazy){i=(await v("action",e,[a],r,n,o))[0],e.signal.aborted&&Z(e,n,d)}else{let t=be(405,{method:e.method,pathname:new URL(e.url).pathname,routeId:a.route.id});if(n)throw t;i={type:c.error,error:t}}if(Pe(i))throw new Response(null,{status:i.response.status,headers:{Location:i.response.headers.get("Location")}});if(Ee(i)){let e=be(400,{type:"defer-action"});if(n)throw e;i={type:c.error,error:e}}if(n){if(Re(i))throw i.error;return{matches:[a],loaderData:{},actionData:{[a.route.id]:i.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(Re(i)){let n=ve(r,a.route.id);return t({},await y(e,r,o,void 0,{[n.route.id]:i.error}),{statusCode:z(i.error)?i.error.status:500,actionData:null,actionHeaders:t({},i.response?{[a.route.id]:i.response.headers}:{})})}let s=new Request(e.url,{headers:e.headers,redirect:e.redirect,signal:e.signal});return t({},await y(s,r,o),{actionData:{[a.route.id]:i.data}},i.response?{statusCode:i.response.status,actionHeaders:{[a.route.id]:i.response.headers}}:{actionHeaders:{}})}(e,a,i||Te(a,r),n,null!=i);return o}let o=await y(e,a,n,i);return Le(o)?o:t({},o,{actionData:null,actionHeaders:{}})}catch(e){if(function(e){return null!=e&&"object"==typeof e&&"type"in e&&"result"in e&&(e.type===c.data||e.type===c.error)}(e)&&Le(e.result)){if(e.type===c.error)throw e.result;return e.result}if(function(e){if(!Le(e))return!1;let t=e.status,r=e.headers.get("Location");return t>=300&&t<=399&&null!=r}(e))return e;throw e}}async function y(e,r,a,o,n){let i=null!=o;if(i&&(null==o||!o.route.loader)&&(null==o||!o.route.lazy))throw be(400,{method:e.method,pathname:new URL(e.url).pathname,routeId:null==o?void 0:o.route.id});let s=(o?[o]:re(r,Object.keys(n||{})[0])).filter((e=>e.route.loader||e.route.lazy));if(0===s.length)return{matches:r,loaderData:r.reduce(((e,t)=>Object.assign(e,{[t.route.id]:null})),{}),errors:n||null,statusCode:200,loaderHeaders:{},activeDeferreds:null};let l=await v("loader",e,s,r,i,a);e.signal.aborted&&Z(e,i,d);let u=new Map,c=pe(r,s,l,n,u),h=new Set(s.map((e=>e.route.id)));return r.forEach((e=>{h.has(e.route.id)||(c.loaderData[e.route.id]=null)})),t({},c,{matches:r,activeDeferreds:u.size>0?Object.fromEntries(u.entries()):null})}async function v(e,t,r,o,s,l){let c=await le(u,e,t,r,o,n,a,l);return await Promise.all(c.map(((e,a)=>{if(Se(e))throw de(e.result,t,r[a].route.id,o,i,d.v7_relativeSplatPath);if(Le(e.result)&&s)throw e;return ue(e)})))}return{dataRoutes:h,query:async function(e,r){let{requestContext:a}=void 0===r?{}:r,o=new URL(e.url),n=e.method,u=s("",l(o),null,"default"),d=p(h,u,i);if(!Ae(n)&&"HEAD"!==n){let e=be(405,{method:n}),{matches:t,route:r}=ge(h);return{basename:i,location:u,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(!d){let e=be(404,{pathname:u.pathname}),{matches:t,route:r}=ge(h);return{basename:i,location:u,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}let c=await m(e,u,d,a);return Le(c)?c:t({location:u,basename:i},c)},queryRoute:async function(e,t){let{routeId:r,requestContext:a}=void 0===t?{}:t,o=new URL(e.url),n=e.method,u=s("",l(o),null,"default"),d=p(h,u,i);if(!Ae(n)&&"HEAD"!==n&&"OPTIONS"!==n)throw be(405,{method:n});if(!d)throw be(404,{pathname:u.pathname});let c=r?d.find((e=>e.route.id===r)):Te(d,u);if(r&&!c)throw be(403,{pathname:u.pathname,routeId:r});if(!c)throw be(404,{pathname:u.pathname});let f=await m(e,u,d,a,c);if(Le(f))return f;let y=f.errors?Object.values(f.errors)[0]:void 0;if(void 0!==y)throw y;if(f.actionData)return Object.values(f.actionData)[0];if(f.loaderData){var v;let e=Object.values(f.loaderData)[0];return null!=(v=f.activeDeferreds)&&v[c.route.id]&&(e[Q]=f.activeDeferreds[c.route.id]),e}}}},e.defer=function(e,t){return void 0===t&&(t={}),new U(e,"number"==typeof t?{status:t}:t)},e.generatePath=function(e,t){void 0===t&&(t={});let r=e;r.endsWith("*")&&"*"!==r&&!r.endsWith("/*")&&(n(!1,'Route path "'+r+'" will be treated as if it were "'+r.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+r.replace(/\*$/,"/*")+'".'),r=r.replace(/\*$/,"/*"));const a=r.startsWith("/")?"/":"",i=e=>null==e?"":"string"==typeof e?e:String(e);return a+r.split(/\/+/).map(((e,r,a)=>{if(r===a.length-1&&"*"===e){return i(t["*"])}const n=e.match(/^:([\w-]+)(\??)$/);if(n){const[,e,r]=n;let a=t[e];return o("?"===r||null!=a,'Missing ":'+e+'" param'),i(a)}return e.replace(/\?$/g,"")})).filter((e=>!!e)).join("/")},e.getStaticContextFromError=function(e,r,a){return t({},r,{statusCode:z(a)?a.status:500,errors:{[r._deepestRenderedBoundaryId||e[0].id]:a}})},e.getToPathname=function(e){return""===e||""===e.pathname?"/":"string"==typeof e?u(e).pathname:e.pathname},e.isDeferredData=xe,e.isRouteErrorResponse=z,e.joinPaths=j,e.json=function(e,r){void 0===r&&(r={});let a="number"==typeof r?{status:r}:r,o=new Headers(a.headers);return o.has("Content-Type")||o.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify(e),t({},a,{headers:o}))},e.matchPath=S,e.matchRoutes=p,e.normalizePathname=k,e.parsePath=u,e.redirect=H,e.redirectDocument=(e,t)=>{let r=H(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r},e.resolvePath=P,e.resolveTo=M,e.stripBasename=R,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RemixRouter={})}(this,(function(e){"use strict";function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},t.apply(this,arguments)}let r=function(e){return e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE",e}({});const a="popstate";function o(e,t){if(!1===e||null==e)throw new Error(t)}function n(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function i(e,t){return{usr:e.state,key:e.key,idx:t}}function s(e,r,a,o){return void 0===a&&(a=null),t({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof r?u(r):r,{state:a,key:r&&r.key||o||Math.random().toString(36).substr(2,8)})}function l(e){let{pathname:t="/",search:r="",hash:a=""}=e;return r&&"?"!==r&&(t+="?"===r.charAt(0)?r:"?"+r),a&&"#"!==a&&(t+="#"===a.charAt(0)?a:"#"+a),t}function u(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substr(a),e=e.substr(0,a)),e&&(t.pathname=e)}return t}function c(e,n,u,c){void 0===c&&(c={});let{window:d=document.defaultView,v5Compat:h=!1}=c,f=d.history,p=r.Pop,m=null,y=v();function v(){return(f.state||{idx:null}).idx}function g(){p=r.Pop;let e=v(),t=null==e?null:e-y;y=e,m&&m({action:p,location:w.location,delta:t})}function b(e){let t="null"!==d.location.origin?d.location.origin:d.location.href,r="string"==typeof e?e:l(e);return r=r.replace(/ $/,"%20"),o(t,"No window.location.(origin|href) available to create URL for href: "+r),new URL(r,t)}null==y&&(y=0,f.replaceState(t({},f.state,{idx:y}),""));let w={get action(){return p},get location(){return e(d,f)},listen(e){if(m)throw new Error("A history only accepts one active listener");return d.addEventListener(a,g),m=e,()=>{d.removeEventListener(a,g),m=null}},createHref:e=>n(d,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){p=r.Push;let a=s(w.location,e,t);u&&u(a,e),y=v()+1;let o=i(a,y),n=w.createHref(a);try{f.pushState(o,"",n)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;d.location.assign(n)}h&&m&&m({action:p,location:w.location,delta:1})},replace:function(e,t){p=r.Replace;let a=s(w.location,e,t);u&&u(a,e),y=v();let o=i(a,y),n=w.createHref(a);f.replaceState(o,"",n),h&&m&&m({action:p,location:w.location,delta:0})},go:e=>f.go(e)};return w}let d=function(e){return e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error",e}({});const h=new Set(["lazy","caseSensitive","path","id","index","children"]);function f(e,r,a,n){return void 0===a&&(a=[]),void 0===n&&(n={}),e.map(((e,i)=>{let s=[...a,String(i)],l="string"==typeof e.id?e.id:s.join("-");if(o(!0!==e.index||!e.children,"Cannot specify children on an index route"),o(!n[l],'Found a route id collision on id "'+l+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let a=t({},e,r(e),{id:l});return n[l]=a,a}{let a=t({},e,r(e),{id:l,children:void 0});return n[l]=a,e.children&&(a.children=f(e.children,r,s,n)),a}}))}function p(e,t,r){return void 0===r&&(r="/"),m(e,t,!1,r)}function m(e,t,r,a){void 0===r&&(r=!1),void 0===a&&(a="/");let o=P(("string"==typeof t?u(t):t).pathname||"/",a);if(null==o)return null;let n=v(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 i=null;for(let e=0;null==i&&e<n.length;++e){let t=R(o);i=S(n[e],t,r)}return i}function y(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 v(e,t,r,a){void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a="");let n=(e,n,i)=>{let s={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:n,route:e};s.relativePath.startsWith("/")&&(o(s.relativePath.startsWith(a),'Absolute route path "'+s.relativePath+'" nested under path "'+a+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),s.relativePath=s.relativePath.slice(a.length));let l=_([a,s.relativePath]),u=r.concat(s);e.children&&e.children.length>0&&(o(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),v(e.children,t,u,l)),(null!=e.path||e.index)&&t.push({path:l,score:D(l,e.index),routesMeta:u})};return e.forEach(((e,t)=>{var r;if(""!==e.path&&null!=(r=e.path)&&r.includes("?"))for(let r of 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 b=/^:[\w-]+$/,w=e=>"*"===e;function D(e,t){let r=e.split("/"),a=r.length;return r.some(w)&&(a+=-2),t&&(a+=2),r.filter((e=>!w(e))).reduce(((e,t)=>e+(b.test(t)?3:""===t?1:10)),a)}function S(e,t,r){void 0===r&&(r=!1);let{routesMeta:a}=e,o={},n="/",i=[];for(let e=0;e<a.length;++e){let s=a[e],l=e===a.length-1,u="/"===n?t:t.slice(n.length)||"/",c=E({path:s.relativePath,caseSensitive:s.caseSensitive,end:l},u),d=s.route;if(!c&&l&&r&&!a[a.length-1].route.index&&(c=E({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},u)),!c)return null;Object.assign(o,c.params),i.push({params:o,pathname:_([n,c.pathname]),pathnameBase:k(_([n,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(n=_([n,c.pathnameBase]))}return i}function E(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=function(e,t,r){void 0===t&&(t=!1);void 0===r&&(r=!0);n("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were "'+e.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+e.replace(/\*$/,"/*")+'".');let a=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,r)=>(a.push({paramName:t,isOptional:null!=r}),r?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(a.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))");return[new RegExp(o,t?void 0:"i"),a]}(e.path,e.caseSensitive,e.end),o=t.match(r);if(!o)return null;let i=o[0],s=i.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:a.reduce(((e,t,r)=>{let{paramName:a,isOptional:o}=t;if("*"===a){let e=l[r]||"";s=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1")}const n=l[r];return e[a]=o&&!n?void 0:(n||"").replace(/%2F/g,"/"),e}),{}),pathname:i,pathnameBase:s,pattern:e}}function R(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return n(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function P(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&"/"!==a?null:e.slice(r)||"/"}function x(e,t){void 0===t&&(t="/");let{pathname:r,search:a="",hash:o=""}="string"==typeof e?u(e):e,n=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:n,search:C(a),hash:T(o)}}function A(e,t,r,a){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(a)+"]. Please separate it out to the `to."+r+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function L(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function M(e,t){let r=L(e);return t?r.map(((t,r)=>r===e.length-1?t.pathname:t.pathnameBase)):r.map((e=>e.pathnameBase))}function j(e,r,a,n){let i;void 0===n&&(n=!1),"string"==typeof e?i=u(e):(i=t({},e),o(!i.pathname||!i.pathname.includes("?"),A("?","pathname","search",i)),o(!i.pathname||!i.pathname.includes("#"),A("#","pathname","hash",i)),o(!i.search||!i.search.includes("#"),A("#","search","hash",i)));let s,l=""===e||""===i.pathname,c=l?"/":i.pathname;if(null==c)s=a;else{let e=r.length-1;if(!n&&c.startsWith("..")){let t=c.split("/");for(;".."===t[0];)t.shift(),e-=1;i.pathname=t.join("/")}s=e>=0?r[e]:"/"}let d=x(i,s),h=c&&"/"!==c&&c.endsWith("/"),f=(l||"."===c)&&a.endsWith("/");return d.pathname.endsWith("/")||!h&&!f||(d.pathname+="/"),d}const _=e=>e.join("/").replace(/\/\/+/g,"/"),k=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),C=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",T=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class U 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 U("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",a),this.controller.signal.addEventListener("abort",a),this.data=Object.entries(e).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:this.trackPromise(r,a)})}),{}),this.done&&this.unlistenAbortSignal(),this.init=t}trackPromise(e,t){if(!(t instanceof Promise))return t;this.deferredKeys.push(e),this.pendingKeysSet.add(e);let r=Promise.race([t,this.abortPromise]).then((t=>this.onSettle(r,e,void 0,t)),(t=>this.onSettle(r,e,t)));return r.catch((()=>{})),Object.defineProperty(r,"_tracked",{get:()=>!0}),r}onSettle(e,t,r,a){if(this.controller.signal.aborted&&r instanceof U)return this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>r}),Promise.reject(r);if(this.pendingKeysSet.delete(t),this.done&&this.unlistenAbortSignal(),void 0===r&&void 0===a){let r=new Error('Deferred data for key "'+t+'" resolved/rejected with `undefined`, you must resolve/reject with a value or `null`.');return Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)}return void 0===a?(Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)):(Object.defineProperty(e,"_data",{get:()=>a}),this.emit(!1,t),a)}emit(e,t){this.subscribers.forEach((r=>r(e,t)))}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}cancel(){this.controller.abort(),this.pendingKeysSet.forEach(((e,t)=>this.pendingKeysSet.delete(t))),this.emit(!0)}async resolveData(e){let t=!1;if(!this.done){let r=()=>this.cancel();e.addEventListener("abort",r),t=await new Promise((t=>{this.subscribe((a=>{e.removeEventListener("abort",r),(a||this.done)&&t(a)}))}))}return t}get done(){return 0===this.pendingKeysSet.size}get unwrappedData(){return o(null!==this.data&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:I(a)})}),{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function I(e){if(!function(e){return e instanceof Promise&&!0===e._tracked}(e))return e;if(e._error)throw e._error;return e._data}const H=function(e,r){void 0===r&&(r=302);let a=r;"number"==typeof a?a={status:a}:void 0===a.status&&(a.status=302);let o=new Headers(a.headers);return o.set("Location",e),new Response(null,t({},a,{headers:o}))};class F{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 B=["post","put","patch","delete"],N=new Set(B),W=["get",...B],$=new Set(W),q=new Set([301,302,303,307,308]),K=new Set([307,308]),Y={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},J={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},V={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},X=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,G=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),Q="remix-router-transitions";const Z=Symbol("deferred");function ee(e,t,r){if(r.v7_throwAbortReason&&void 0!==e.signal.reason)throw e.signal.reason;throw new Error((t?"queryRoute":"query")+"() call aborted: "+e.method+" "+e.url)}function te(e,t,r,a,o,n,i,s){let u,c;if(i){u=[];for(let e of t)if(u.push(e),e.route.id===i){c=e;break}}else u=t,c=t[t.length-1];let d=j(o||".",M(u,n),P(e.pathname,r)||e.pathname,"path"===s);return null==o&&(d.search=e.search,d.hash=e.hash),null!=o&&""!==o&&"."!==o||!c||!c.route.index||Ie(d.search)||(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),a&&"/"!==r&&(d.pathname="/"===d.pathname?r:_([r,d.pathname])),l(d)}function re(e,t,r,a){if(!a||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(a))return{path:r};if(a.formMethod&&!Ce(a.formMethod))return{path:r,error:Re(405,{method:a.formMethod})};let n,i,s=()=>({path:r,error:Re(400,{type:"invalid-body"})}),c=a.formMethod||"get",d=e?c.toUpperCase():c.toLowerCase(),h=xe(r);if(void 0!==a.body){if("text/plain"===a.formEncType){if(!Te(d))return s();let e="string"==typeof a.body?a.body:a.body instanceof FormData||a.body instanceof URLSearchParams?Array.from(a.body.entries()).reduce(((e,t)=>{let[r,a]=t;return""+e+r+"="+a+"\n"}),""):String(a.body);return{path:r,submission:{formMethod:d,formAction:h,formEncType:a.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===a.formEncType){if(!Te(d))return s();try{let e="string"==typeof a.body?JSON.parse(a.body):a.body;return{path:r,submission:{formMethod:d,formAction:h,formEncType:a.formEncType,formData:void 0,json:e,text:void 0}}}catch(e){return s()}}}if(o("function"==typeof FormData,"FormData is not available in this environment"),a.formData)n=ye(a.formData),i=a.formData;else if(a.body instanceof FormData)n=ye(a.body),i=a.body;else if(a.body instanceof URLSearchParams)n=a.body,i=ve(n);else if(null==a.body)n=new URLSearchParams,i=new FormData;else try{n=new URLSearchParams(a.body),i=ve(n)}catch(e){return s()}let f={formMethod:d,formAction:h,formEncType:a&&a.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(Te(f.formMethod))return{path:r,submission:f};let p=u(r);return t&&p.search&&Ie(p.search)&&n.append("index",""),p.search="?"+n,{path:l(p),submission:f}}function ae(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 oe(e,r,a,o,n,i,s,l,u,c,d,h,f,m,y,v){let g=v?Me(v[1])?v[1].error:v[1].data:void 0,b=e.createURL(r.location),w=e.createURL(n),D=v&&Me(v[1])?v[0]:void 0,S=D?ae(a,D):a,E=v?v[1].statusCode:void 0,R=s&&E&&E>=400,P=S.filter(((e,a)=>{let{route:n}=e;if(n.lazy)return!0;if(null==n.loader)return!1;if(i)return!("function"==typeof n.loader&&!n.loader.hydrate)||void 0===r.loaderData[n.id]&&(!r.errors||void 0===r.errors[n.id]);if(function(e,t,r){let a=!t||r.route.id!==t.route.id,o=void 0===e[r.route.id];return a||o}(r.loaderData,r.matches[a],e)||u.some((t=>t===e.route.id)))return!0;let s=r.matches[a],c=e;return ie(e,t({currentUrl:b,currentParams:s.params,nextUrl:w,nextParams:c.params},o,{actionResult:g,unstable_actionStatus:E,defaultShouldRevalidate:!R&&(l||b.pathname+b.search===w.pathname+w.search||b.search!==w.search||ne(s,c))}))})),x=[];return h.forEach(((e,n)=>{if(i||!a.some((t=>t.route.id===e.routeId))||d.has(n))return;let s=p(m,e.path,y);if(!s)return void x.push({key:n,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let u=r.fetchers.get(n),h=He(s,e.path),v=!1;v=!f.has(n)&&(!!c.includes(n)||(u&&"idle"!==u.state&&void 0===u.data?l:ie(h,t({currentUrl:b,currentParams:r.matches[r.matches.length-1].params,nextUrl:w,nextParams:a[a.length-1].params},o,{actionResult:g,unstable_actionStatus:E,defaultShouldRevalidate:!R&&l})))),v&&x.push({key:n,routeId:e.routeId,path:e.path,matches:s,match:h,controller:new AbortController})})),[P,x]}function ne(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function ie(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}async function se(e,t,r,a,o,n,i,s){let l=[r,...a.map((e=>e.route.id))].join("-"),u=i.get(l),c=null;if(!u){let e=t(r,a);"object"==typeof(d=e)&&null!=d&&"then"in d?(u=e,i.set(l,u)):c=e}var d;try{u&&(c=await u),c&&!s.aborted&&le(e.id,c,o,n)}finally{i.delete(l)}}function le(e,t,r,a){let n=r[e];o(n,"No route found to patch children into: routeId = "+e);let i=f(t,a,[e,"patch"],r);n.children?n.children.push(...i):n.children=i}async function ue(e,r,a){if(!e.lazy)return;let i=await e.lazy();if(!e.lazy)return;let s=a[e.id];o(s,"No route found in manifest");let l={};for(let e in i){let t=void 0!==s[e]&&"hasErrorBoundary"!==e;n(!t,'Route "'+s.id+'" has a static property "'+e+'" defined but its lazy function is also returning a value for this property. The lazy route property "'+e+'" will be ignored.'),t||h.has(e)||(l[e]=i[e])}Object.assign(s,l),Object.assign(s,t({},r(s),{lazy:void 0}))}function ce(e){return Promise.all(e.matches.map((e=>e.resolve())))}async function de(e,r,a,n,i,s,l,u){let c=n.reduce(((e,t)=>e.add(t.route.id)),new Set),h=new Set,f=await e({matches:i.map((e=>{let n=c.has(e.route.id);return t({},e,{shouldLoad:n,resolve:t=>(h.add(e.route.id),n?async function(e,t,r,a,n,i,s){let l,u,c=a=>{let o,n=new Promise(((e,t)=>o=t));u=()=>o(),t.signal.addEventListener("abort",u);let l,c=o=>"function"!=typeof a?Promise.reject(new Error('You cannot call the handler for a route which defines a boolean "'+e+'" [routeId: '+r.route.id+"]")):a({request:t,params:r.params,context:s},...void 0!==o?[o]:[]);return l=i?i((e=>c(e))):(async()=>{try{return{type:"data",result:await c()}}catch(e){return{type:"error",result:e}}})(),Promise.race([l,n])};try{let i=r.route[e];if(r.route.lazy)if(i){let e,[t]=await Promise.all([c(i).catch((t=>{e=t})),ue(r.route,n,a)]);if(void 0!==e)throw e;l=t}else{if(await ue(r.route,n,a),i=r.route[e],!i){if("action"===e){let e=new URL(t.url),a=e.pathname+e.search;throw Re(405,{method:t.method,pathname:a,routeId:r.route.id})}return{type:d.data,result:void 0}}l=await c(i)}else{if(!i){let e=new URL(t.url);throw Re(404,{pathname:e.pathname+e.search})}l=await c(i)}o(void 0!==l.result,"You defined "+("action"===e?"an action":"a loader")+' for route "'+r.route.id+"\" but didn't return anything from your `"+e+"` function. Please return a value or `null`.")}catch(e){return{type:d.error,result:e}}finally{u&&t.signal.removeEventListener("abort",u)}return l}(r,a,e,s,l,t,u):Promise.resolve({type:d.data,result:void 0}))})})),request:a,params:i[0].params,context:u});return i.forEach((e=>o(h.has(e.route.id),'`match.resolve()` was not called for route id "'+e.route.id+'". You must call `match.resolve()` on every match passed to `dataStrategy` to ensure all routes are properly loaded.'))),f.filter(((e,t)=>c.has(i[t].route.id)))}async function he(e){let{result:t,type:r,status:a}=e;if(ke(t)){let e;try{let r=t.headers.get("Content-Type");e=r&&/\bapplication\/json\b/.test(r)?null==t.body?null:await t.json():await t.text()}catch(e){return{type:d.error,error:e}}return r===d.error?{type:d.error,error:new F(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:d.data,data:e,statusCode:t.status,headers:t.headers}}return r===d.error?{type:d.error,error:t,statusCode:z(t)?t.status:a}:_e(t)?{type:d.deferred,deferredData:t,statusCode:null==(o=t.init)?void 0:o.status,headers:(null==(n=t.init)?void 0:n.headers)&&new Headers(t.init.headers)}:{type:d.data,data:t,statusCode:a};var o,n}function fe(e,t,r,a,n,i){let s=e.headers.get("Location");if(o(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!X.test(s)){let o=a.slice(0,a.findIndex((e=>e.route.id===r))+1);s=te(new URL(t.url),o,n,!0,s,i),e.headers.set("Location",s)}return e}function pe(e,t,r){if(X.test(e)){let a=e,o=a.startsWith("//")?new URL(t.protocol+a):new URL(a),n=null!=P(o.pathname,r);if(o.origin===t.origin&&n)return o.pathname+o.search+o.hash}return e}function me(e,t,r,a){let o=e.createURL(xe(t)).toString(),n={signal:r};if(a&&Te(a.formMethod)){let{formMethod:e,formEncType:t}=a;n.method=e.toUpperCase(),"application/json"===t?(n.headers=new Headers({"Content-Type":t}),n.body=JSON.stringify(a.json)):"text/plain"===t?n.body=a.text:"application/x-www-form-urlencoded"===t&&a.formData?n.body=ye(a.formData):n.body=a.formData}return new Request(o,n)}function ye(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,"string"==typeof a?a:a.name);return t}function ve(e){let t=new FormData;for(let[r,a]of e.entries())t.append(r,a);return t}function ge(e,t,r,a,n,i){let s,l={},u=null,c=!1,d={},h=a&&Me(a[1])?a[1].error:void 0;return r.forEach(((r,a)=>{let f=t[a].route.id;if(o(!je(r),"Cannot handle redirect results in processLoaderData"),Me(r)){let t=r.error;if(void 0!==h&&(t=h,h=void 0),u=u||{},i)u[f]=t;else{let r=Se(e,f);null==u[r.route.id]&&(u[r.route.id]=t)}l[f]=void 0,c||(c=!0,s=z(r.error)?r.error.status:500),r.headers&&(d[f]=r.headers)}else Le(r)?(n.set(f,r.deferredData),l[f]=r.deferredData.data,null==r.statusCode||200===r.statusCode||c||(s=r.statusCode),r.headers&&(d[f]=r.headers)):(l[f]=r.data,r.statusCode&&200!==r.statusCode&&!c&&(s=r.statusCode),r.headers&&(d[f]=r.headers))})),void 0!==h&&a&&(u={[a[0]]:h},l[a[0]]=void 0),{loaderData:l,errors:u,statusCode:s||200,loaderHeaders:d}}function be(e,r,a,n,i,s,l,u){let{loaderData:c,errors:d}=ge(r,a,n,i,u,!1);for(let r=0;r<s.length;r++){let{key:a,match:n,controller:i}=s[r];o(void 0!==l&&void 0!==l[r],"Did not find corresponding fetcher result");let u=l[r];if(!i||!i.signal.aborted)if(Me(u)){let r=Se(e.matches,null==n?void 0:n.route.id);d&&d[r.route.id]||(d=t({},d,{[r.route.id]:u.error})),e.fetchers.delete(a)}else if(je(u))o(!1,"Unhandled fetcher revalidation redirect");else if(Le(u))o(!1,"Unhandled fetcher deferred data");else{let t=We(u.data);e.fetchers.set(a,t)}}return{loaderData:c,errors:d}}function we(e,r,a,o){let n=t({},r);for(let t of a){let a=t.route.id;if(r.hasOwnProperty(a)?void 0!==r[a]&&(n[a]=r[a]):void 0!==e[a]&&t.route.loader&&(n[a]=e[a]),o&&o.hasOwnProperty(a))break}return n}function De(e){return e?Me(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Se(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 Ee(e){let t=1===e.length?e[0]:e.find((e=>e.index||!e.path||"/"===e.path))||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Re(e,t){let{pathname:r,routeId:a,method:o,type:n,message:i}=void 0===t?{}:t,s="Unknown Server Error",l="Unknown @remix-run/router error";return 400===e?(s="Bad Request","route-discovery"===n?l='Unable to match URL "'+r+'" - the `children()` function for route `'+a+"` threw the following error:\n"+i:o&&r&&a?l="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?l="defer() is not supported in actions":"invalid-body"===n&&(l="Unable to encode submission body")):403===e?(s="Forbidden",l='Route "'+a+'" does not match URL "'+r+'"'):404===e?(s="Not Found",l='No route matches URL "'+r+'"'):405===e&&(s="Method Not Allowed",o&&r&&a?l="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&&(l='Invalid request method "'+o.toUpperCase()+'"')),new F(e||500,s,new Error(l),!0)}function Pe(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(je(r))return{result:r,idx:t}}}function xe(e){return l(t({},"string"==typeof e?u(e):e,{hash:""}))}function Ae(e){return ke(e.result)&&q.has(e.result.status)}function Le(e){return e.type===d.deferred}function Me(e){return e.type===d.error}function je(e){return(e&&e.type)===d.redirect}function _e(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 ke(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function Ce(e){return $.has(e.toLowerCase())}function Te(e){return N.has(e.toLowerCase())}async function Ue(e,t,r,a,n,i){for(let s=0;s<r.length;s++){let l=r[s],u=t[s];if(!u)continue;let c=e.find((e=>e.route.id===u.route.id)),d=null!=c&&!ne(c,u)&&void 0!==(i&&i[u.route.id]);if(Le(l)&&(n||d)){let e=a[s];o(e,"Expected an AbortSignal for revalidating fetcher deferred result"),await Oe(l,e,n).then((e=>{e&&(r[s]=e||r[s])}))}}}async function Oe(e,t,r){if(void 0===r&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:d.data,data:e.deferredData.unwrappedData}}catch(e){return{type:d.error,error:e}}return{type:d.data,data:e.deferredData.data}}}function Ie(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function He(e,t){let r="string"==typeof t?u(t).search:t.search;if(e[e.length-1].route.index&&Ie(r||""))return e[e.length-1];let a=L(e);return a[a.length-1]}function Fe(e){let{formMethod:t,formAction:r,formEncType:a,text:o,formData:n,json:i}=e;if(t&&r&&a)return null!=o?{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:void 0,text:o}:null!=n?{formMethod:t,formAction:r,formEncType:a,formData:n,json:void 0,text:void 0}:void 0!==i?{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:i,text:void 0}:void 0}function ze(e,t){if(t){return{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}return{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Be(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function Ne(e,t){if(e){return{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}}return{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function We(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}e.AbortedDeferredError=U,e.Action=r,e.IDLE_BLOCKER=V,e.IDLE_FETCHER=J,e.IDLE_NAVIGATION=Y,e.UNSAFE_DEFERRED_SYMBOL=Z,e.UNSAFE_DeferredData=O,e.UNSAFE_ErrorResponseImpl=F,e.UNSAFE_convertRouteMatchToUiMatch=y,e.UNSAFE_convertRoutesToDataRoutes=f,e.UNSAFE_getResolveToMatches=M,e.UNSAFE_invariant=o,e.UNSAFE_warning=n,e.createBrowserHistory=function(e){return void 0===e&&(e={}),c((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={}),c((function(e,t){let{pathname:r="/",search:a="",hash:o=""}=u(e.location.hash.substr(1));return r.startsWith("/")||r.startsWith(".")||(r="/"+r),s("",{pathname:r,search:a,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let r=e.document.querySelector("base"),a="";if(r&&r.getAttribute("href")){let t=e.location.href,r=t.indexOf("#");a=-1===r?t:t.slice(0,r)}return a+"#"+("string"==typeof t?t:l(t))}),(function(e,t){n("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")}),e)},e.createMemoryHistory=function(e){void 0===e&&(e={});let t,{initialEntries:a=["/"],initialIndex:o,v5Compat:i=!1}=e;t=a.map(((e,t)=>m(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let c=f(null==o?t.length-1:o),d=r.Pop,h=null;function f(e){return Math.min(Math.max(e,0),t.length-1)}function p(){return t[c]}function m(e,r,a){void 0===r&&(r=null);let o=s(t?p().pathname:"/",e,r,a);return n("/"===o.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),o}function y(e){return"string"==typeof e?e:l(e)}return{get index(){return c},get action(){return d},get location(){return p()},createHref:y,createURL:e=>new URL(y(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?u(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,a){d=r.Push;let o=m(e,a);c+=1,t.splice(c,t.length,o),i&&h&&h({action:d,location:o,delta:1})},replace(e,a){d=r.Replace;let o=m(e,a);t[c]=o,i&&h&&h({action:d,location:o,delta:0})},go(e){d=r.Pop;let a=f(c+e),o=t[a];c=a,h&&h({action:d,location:o,delta:e})},listen:e=>(h=e,()=>{h=null})}},e.createPath=l,e.createRouter=function(e){const a=e.window?e.window:"undefined"!=typeof window?window:void 0,i=void 0!==a&&void 0!==a.document&&void 0!==a.document.createElement,l=!i;let u;if(o(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)u=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;u=e=>({hasErrorBoundary:t(e)})}else u=G;let c,h,v={},g=f(e.routes,u,void 0,v),b=e.basename||"/",w=e.unstable_dataStrategy||ce,D=e.unstable_patchRoutesOnMiss||(()=>Promise.resolve(null)),S=t({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,unstable_skipActionErrorRevalidation:!1},e.future),E=null,R=new Set,x=null,A=null,L=null,M=null!=e.hydrationData,j=p(g,e.history.location,b),_=null;if(null==j){let t=Re(404,{pathname:e.history.location.pathname}),{matches:r,route:a}=Ee(g);j=r,_={[a.id]:t}}let k,C=j.some((e=>e.route.lazy)),T=j.some((e=>e.route.loader));if(C)h=!1;else if(T)if(S.v7_partialHydration){let t=e.hydrationData?e.hydrationData.loaderData:null,r=e.hydrationData?e.hydrationData.errors:null,a=e=>!e.route.loader||("function"!=typeof e.route.loader||!0!==e.route.loader.hydrate)&&(t&&void 0!==t[e.route.id]||r&&void 0!==r[e.route.id]);if(r){let e=j.findIndex((e=>void 0!==r[e.route.id]));h=j.slice(0,e+1).every(a)}else h=j.every(a)}else h=null!=e.hydrationData;else h=!0;let U,O={historyAction:e.history.action,location:e.history.location,matches:j,initialized:h,navigation:Y,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||_,fetchers:new Map,blockers:new Map},I=r.Pop,H=!1,F=!1,B=new Map,N=null,W=!1,$=!1,q=[],Z=[],ee=new Map,ae=0,ne=-1,ie=new Map,ue=new Set,ye=new Map,ve=new Map,ge=new Set,xe=new Map,_e=new Map,ke=new Map,Ce=!1;function Ie(e,r){void 0===r&&(r={}),O=t({},O,e);let a=[],o=[];S.v7_fetcherPersist&&O.fetchers.forEach(((e,t)=>{"idle"===e.state&&(ge.has(t)?o.push(t):a.push(t))})),[...R].forEach((e=>e(O,{deletedFetchers:o,unstable_viewTransitionOpts:r.viewTransitionOpts,unstable_flushSync:!0===r.flushSync}))),S.v7_fetcherPersist&&(a.forEach((e=>O.fetchers.delete(e))),o.forEach((e=>et(e))))}function $e(a,o,n){var i,s;let l,{flushSync:u}=void 0===n?{}:n,d=null!=O.actionData&&null!=O.navigation.formMethod&&Te(O.navigation.formMethod)&&"loading"===O.navigation.state&&!0!==(null==(i=a.state)?void 0:i._isRedirect);l=o.actionData?Object.keys(o.actionData).length>0?o.actionData:null:d?O.actionData:null;let h=o.loaderData?we(O.loaderData,o.loaderData,o.matches||[],o.errors):O.loaderData,f=O.blockers;f.size>0&&(f=new Map(f),f.forEach(((e,t)=>f.set(t,V))));let p,m=!0===H||null!=O.navigation.formMethod&&Te(O.navigation.formMethod)&&!0!==(null==(s=a.state)?void 0:s._isRedirect);if(c&&(g=c,c=void 0),W||I===r.Pop||(I===r.Push?e.history.push(a,a.state):I===r.Replace&&e.history.replace(a,a.state)),I===r.Pop){let e=B.get(O.location.pathname);e&&e.has(a.pathname)?p={currentLocation:O.location,nextLocation:a}:B.has(a.pathname)&&(p={currentLocation:a,nextLocation:O.location})}else if(F){let e=B.get(O.location.pathname);e?e.add(a.pathname):(e=new Set([a.pathname]),B.set(O.location.pathname,e)),p={currentLocation:O.location,nextLocation:a}}Ie(t({},o,{actionData:l,loaderData:h,historyAction:I,location:a,initialized:!0,navigation:Y,revalidation:"idle",restoreScrollPosition:ht(a,o.matches||O.matches),preventScrollReset:m,blockers:f}),{viewTransitionOpts:p,flushSync:!0===u}),I=r.Pop,H=!1,F=!1,W=!1,$=!1,q=[],Z=[]}async function qe(a,o,n){U&&U.abort(),U=null,I=a,W=!0===(n&&n.startUninterruptedRevalidation),function(e,t){if(x&&L){let r=dt(e,t);x[r]=L()}}(O.location,O.matches),H=!0===(n&&n.preventScrollReset),F=!0===(n&&n.enableViewTransition);let i=c||g,s=n&&n.overrideNavigation,l=p(i,o,b),u=!0===(n&&n.flushSync),h=ft(l,i,o.pathname);if(h.active&&h.matches&&(l=h.matches),!l){let{error:e,notFoundMatches:t,route:r}=lt(o.pathname);return void $e(o,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u})}if(O.initialized&&!$&&function(e,t){if(e.pathname!==t.pathname||e.search!==t.search)return!1;if(""===e.hash)return""!==t.hash;if(e.hash===t.hash)return!0;if(""!==t.hash)return!0;return!1}(O.location,o)&&!(n&&n.submission&&Te(n.submission.formMethod)))return void $e(o,{matches:l},{flushSync:u});U=new AbortController;let f,m=me(e.history,o,U.signal,n&&n.submission);if(n&&n.pendingError)f=[Se(l).route.id,{type:d.error,error:n.pendingError}];else if(n&&n.submission&&Te(n.submission.formMethod)){let t=await async function(e,t,a,o,n,i){void 0===i&&(i={});let s;if(Xe(),Ie({navigation:Be(t,a)},{flushSync:!0===i.flushSync}),n){let r=await pt(o,t.pathname,e.signal);if("aborted"===r.type)return{shortCircuited:!0};if("error"===r.type){let{error:e,notFoundMatches:a,route:o}=ut(t.pathname,r);return{matches:a,pendingActionResult:[o.id,{type:d.error,error:e}]}}if(!r.matches){let{notFoundMatches:e,error:r,route:a}=lt(t.pathname);return{matches:e,pendingActionResult:[a.id,{type:d.error,error:r}]}}o=r.matches}let l=He(o,t);if(l.route.action||l.route.lazy){if(s=(await Je("action",e,[l],o))[0],e.signal.aborted)return{shortCircuited:!0}}else s={type:d.error,error:Re(405,{method:e.method,pathname:t.pathname,routeId:l.route.id})};if(je(s)){let t;if(i&&null!=i.replace)t=i.replace;else{t=pe(s.response.headers.get("Location"),new URL(e.url),b)===O.location.pathname+O.location.search}return await Ye(e,s,{submission:a,replace:t}),{shortCircuited:!0}}if(Le(s))throw Re(400,{type:"defer-action"});if(Me(s)){let e=Se(o,l.route.id);return!0!==(i&&i.replace)&&(I=r.Push),{matches:o,pendingActionResult:[e.route.id,s]}}return{matches:o,pendingActionResult:[l.route.id,s]}}(m,o,n.submission,l,h.active,{replace:n.replace,flushSync:u});if(t.shortCircuited)return;if(t.pendingActionResult){let[e,r]=t.pendingActionResult;if(Me(r)&&z(r.error)&&404===r.error.status)return U=null,void $e(o,{matches:t.matches,loaderData:{},errors:{[e]:r.error}})}l=t.matches||l,f=t.pendingActionResult,s=ze(o,n.submission),u=!1,h.active=!1,m=me(e.history,m.url,m.signal)}let{shortCircuited:y,matches:v,loaderData:w,errors:D}=await async function(r,a,o,n,i,s,l,u,d,h,f){let p=i||ze(a,s),m=s||l||Fe(p),y=!(W||S.v7_partialHydration&&d);if(n){if(y){let e=Ke(f);Ie(t({navigation:p},void 0!==e?{actionData:e}:{}),{flushSync:h})}let e=await pt(o,a.pathname,r.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){let{error:t,notFoundMatches:r,route:o}=ut(a.pathname,e);return{matches:r,loaderData:{},errors:{[o.id]:t}}}if(!e.matches){let{error:e,notFoundMatches:t,route:r}=lt(a.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}o=e.matches}let v=c||g,[w,D]=oe(e.history,O,o,m,a,S.v7_partialHydration&&!0===d,S.unstable_skipActionErrorRevalidation,$,q,Z,ge,ye,ue,v,b,f);if(ct((e=>!(o&&o.some((t=>t.route.id===e)))||w&&w.some((t=>t.route.id===e)))),ne=++ae,0===w.length&&0===D.length){let e=at();return $e(a,t({matches:o,loaderData:{},errors:f&&Me(f[1])?{[f[0]]:f[1].error}:null},De(f),e?{fetchers:new Map(O.fetchers)}:{}),{flushSync:h}),{shortCircuited:!0}}if(y){let e={};if(!n){e.navigation=p;let t=Ke(f);void 0!==t&&(e.actionData=t)}D.length>0&&(e.fetchers=function(e){return e.forEach((e=>{let t=O.fetchers.get(e.key),r=Ne(void 0,t?t.data:void 0);O.fetchers.set(e.key,r)})),new Map(O.fetchers)}(D)),Ie(e,{flushSync:h})}D.forEach((e=>{ee.has(e.key)&&tt(e.key),e.controller&&ee.set(e.key,e.controller)}));let E=()=>D.forEach((e=>tt(e.key)));U&&U.signal.addEventListener("abort",E);let{loaderResults:R,fetcherResults:P}=await Ve(O.matches,o,w,D,r);if(r.signal.aborted)return{shortCircuited:!0};U&&U.signal.removeEventListener("abort",E);D.forEach((e=>ee.delete(e.key)));let x=Pe([...R,...P]);if(x){if(x.idx>=w.length){let e=D[x.idx-w.length].key;ue.add(e)}return await Ye(r,x.result,{replace:u}),{shortCircuited:!0}}let{loaderData:A,errors:L}=be(O,o,w,R,f,D,P,xe);xe.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&xe.delete(t)}))})),S.v7_partialHydration&&d&&O.errors&&Object.entries(O.errors).filter((e=>{let[t]=e;return!w.some((e=>e.route.id===t))})).forEach((e=>{let[t,r]=e;L=Object.assign(L||{},{[t]:r})}));let M=at(),j=ot(ne),_=M||j||D.length>0;return t({matches:o,loaderData:A,errors:L},_?{fetchers:new Map(O.fetchers)}:{})}(m,o,l,h.active,s,n&&n.submission,n&&n.fetcherSubmission,n&&n.replace,n&&!0===n.initialHydration,u,f);y||(U=null,$e(o,t({matches:v||l},De(f),{loaderData:w,errors:D})))}function Ke(e){return e&&!Me(e[1])?{[e[0]]:e[1].data}:O.actionData?0===Object.keys(O.actionData).length?null:O.actionData:void 0}async function Ye(n,l,u){let{submission:c,fetcherSubmission:d,replace:h}=void 0===u?{}:u;l.response.headers.has("X-Remix-Revalidate")&&($=!0);let f=l.response.headers.get("Location");o(f,"Expected a Location header on the redirect Response"),f=pe(f,new URL(n.url),b);let p=s(O.location,f,{_isRedirect:!0});if(i){let t=!1;if(l.response.headers.has("X-Remix-Reload-Document"))t=!0;else if(X.test(f)){const r=e.history.createURL(f);t=r.origin!==a.location.origin||null==P(r.pathname,b)}if(t)return void(h?a.location.replace(f):a.location.assign(f))}U=null;let m=!0===h?r.Replace:r.Push,{formMethod:y,formAction:v,formEncType:g}=O.navigation;!c&&!d&&y&&v&&g&&(c=Fe(O.navigation));let w=c||d;if(K.has(l.response.status)&&w&&Te(w.formMethod))await qe(m,p,{submission:t({},w,{formAction:f}),preventScrollReset:H});else{let e=ze(p,c);await qe(m,p,{overrideNavigation:e,fetcherSubmission:d,preventScrollReset:H})}}async function Je(e,t,r,a){try{let o=await de(w,e,t,r,a,v,u);return await Promise.all(o.map(((e,o)=>{if(Ae(e)){let n=e.result;return{type:d.redirect,response:fe(n,t,r[o].route.id,a,b,S.v7_relativeSplatPath)}}return he(e)})))}catch(e){return r.map((()=>({type:d.error,error:e})))}}async function Ve(t,r,a,o,n){let[i,...s]=await Promise.all([a.length?Je("loader",n,a,r):[],...o.map((t=>{if(t.matches&&t.match&&t.controller){return Je("loader",me(e.history,t.path,t.controller.signal),[t.match],t.matches).then((e=>e[0]))}return Promise.resolve({type:d.error,error:Re(404,{pathname:t.path})})}))]);return await Promise.all([Ue(t,a,i,i.map((()=>n.signal)),!1,O.loaderData),Ue(t,o.map((e=>e.match)),s,o.map((e=>e.controller?e.controller.signal:null)),!0)]),{loaderResults:i,fetcherResults:s}}function Xe(){$=!0,q.push(...ct()),ye.forEach(((e,t)=>{ee.has(t)&&(Z.push(t),tt(t))}))}function Ge(e,t,r){void 0===r&&(r={}),O.fetchers.set(e,t),Ie({fetchers:new Map(O.fetchers)},{flushSync:!0===(r&&r.flushSync)})}function Qe(e,t,r,a){void 0===a&&(a={});let o=Se(O.matches,t);et(e),Ie({errors:{[o.route.id]:r},fetchers:new Map(O.fetchers)},{flushSync:!0===(a&&a.flushSync)})}function Ze(e){return S.v7_fetcherPersist&&(ve.set(e,(ve.get(e)||0)+1),ge.has(e)&&ge.delete(e)),O.fetchers.get(e)||J}function et(e){let t=O.fetchers.get(e);!ee.has(e)||t&&"loading"===t.state&&ie.has(e)||tt(e),ye.delete(e),ie.delete(e),ue.delete(e),ge.delete(e),O.fetchers.delete(e)}function tt(e){let t=ee.get(e);o(t,"Expected fetch controller: "+e),t.abort(),ee.delete(e)}function rt(e){for(let t of e){let e=We(Ze(t).data);O.fetchers.set(t,e)}}function at(){let e=[],t=!1;for(let r of ue){let a=O.fetchers.get(r);o(a,"Expected fetcher: "+r),"loading"===a.state&&(ue.delete(r),e.push(r),t=!0)}return rt(e),t}function ot(e){let t=[];for(let[r,a]of ie)if(a<e){let e=O.fetchers.get(r);o(e,"Expected fetcher: "+r),"loading"===e.state&&(tt(r),ie.delete(r),t.push(r))}return rt(t),t.length>0}function nt(e){O.blockers.delete(e),_e.delete(e)}function it(e,t){let r=O.blockers.get(e)||V;o("unblocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"proceeding"===t.state||"blocked"===r.state&&"unblocked"===t.state||"proceeding"===r.state&&"unblocked"===t.state,"Invalid blocker state transition: "+r.state+" -> "+t.state);let a=new Map(O.blockers);a.set(e,t),Ie({blockers:a})}function st(e){let{currentLocation:t,nextLocation:r,historyAction:a}=e;if(0===_e.size)return;_e.size>1&&n(!1,"A router only supports one blocker at a time");let o=Array.from(_e.entries()),[i,s]=o[o.length-1],l=O.blockers.get(i);return l&&"proceeding"===l.state?void 0:s({currentLocation:t,nextLocation:r,historyAction:a})?i:void 0}function lt(e){let t=Re(404,{pathname:e}),r=c||g,{matches:a,route:o}=Ee(r);return ct(),{notFoundMatches:a,route:o,error:t}}function ut(e,t){let r=t.partialMatches,a=r[r.length-1].route;return{notFoundMatches:r,route:a,error:Re(400,{type:"route-discovery",routeId:a.id,pathname:e,message:null!=t.error&&"message"in t.error?t.error:String(t.error)})}}function ct(e){let t=[];return xe.forEach(((r,a)=>{e&&!e(a)||(r.cancel(),t.push(a),xe.delete(a))})),t}function dt(e,t){if(A){return A(e,t.map((e=>y(e,O.loaderData))))||e.key}return e.key}function ht(e,t){if(x){let r=dt(e,t),a=x[r];if("number"==typeof a)return a}return null}function ft(e,t,r){if(e){if("*"===e[e.length-1].route.path){return{active:!0,matches:m(t,r,!0,b)}}}else{let e=m(t,r,!0,b);if(e)return{active:!0,matches:e}}return{active:!1,matches:null}}async function pt(e,t,r){let a=e,o=a[a.length-1].route;for(;;){try{if(await se(o,D,t,a,v,u,ke,r),r.aborted)return{type:"aborted"}}catch(e){return{type:"error",error:e,partialMatches:a}}let e=c||g,n=p(e,t,b),i=!1;if(n){let e=n[n.length-1].route;if(e.index)return{type:"success",matches:n};if(e.path&&e.path.length>0){if("*"!==e.path)return{type:"success",matches:n};i=!0}}let s=m(e,t,!0,b);if(!s||a.map((e=>e.route.id)).join("-")===s.map((e=>e.route.id)).join("-"))return i?{type:"success",matches:n}:{type:"success",matches:null};if(a=s,o=a[a.length-1].route,"*"===o.path)return{type:"success",matches:a}}}return k={get basename(){return b},get future(){return S},get state(){return O},get routes(){return g},get window(){return a},initialize:function(){if(E=e.history.listen((t=>{let{action:r,location:a,delta:o}=t;if(Ce)return void(Ce=!1);n(0===_e.size||null!=o,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=st({currentLocation:O.location,nextLocation:a,historyAction:r});return i&&null!=o?(Ce=!0,e.history.go(-1*o),void it(i,{state:"blocked",location:a,proceed(){it(i,{state:"proceeding",proceed:void 0,reset:void 0,location:a}),e.history.go(o)},reset(){let e=new Map(O.blockers);e.set(i,V),Ie({blockers:e})}})):qe(r,a)})),i){!function(e,t){try{let r=e.sessionStorage.getItem(Q);if(r){let e=JSON.parse(r);for(let[r,a]of Object.entries(e||{}))a&&Array.isArray(a)&&t.set(r,new Set(a||[]))}}catch(e){}}(a,B);let e=()=>function(e,t){if(t.size>0){let r={};for(let[e,a]of t)r[e]=[...a];try{e.sessionStorage.setItem(Q,JSON.stringify(r))}catch(e){n(!1,"Failed to save applied view transitions in sessionStorage ("+e+").")}}}(a,B);a.addEventListener("pagehide",e),N=()=>a.removeEventListener("pagehide",e)}return O.initialized||qe(r.Pop,O.location,{initialHydration:!0}),k},subscribe:function(e){return R.add(e),()=>R.delete(e)},enableScrollRestoration:function(e,t,r){if(x=e,L=t,A=r||null,!M&&O.navigation===Y){M=!0;let e=ht(O.location,O.matches);null!=e&&Ie({restoreScrollPosition:e})}return()=>{x=null,L=null,A=null}},navigate:async function a(o,n){if("number"==typeof o)return void e.history.go(o);let i=te(O.location,O.matches,b,S.v7_prependBasename,o,S.v7_relativeSplatPath,null==n?void 0:n.fromRouteId,null==n?void 0:n.relative),{path:l,submission:u,error:c}=re(S.v7_normalizeFormMethod,!1,i,n),d=O.location,h=s(O.location,l,n&&n.state);h=t({},h,e.history.encodeLocation(h));let f=n&&null!=n.replace?n.replace:void 0,p=r.Push;!0===f?p=r.Replace:!1===f||null!=u&&Te(u.formMethod)&&u.formAction===O.location.pathname+O.location.search&&(p=r.Replace);let m=n&&"preventScrollReset"in n?!0===n.preventScrollReset:void 0,y=!0===(n&&n.unstable_flushSync),v=st({currentLocation:d,nextLocation:h,historyAction:p});if(!v)return await qe(p,h,{submission:u,pendingError:c,preventScrollReset:m,replace:n&&n.replace,enableViewTransition:n&&n.unstable_viewTransition,flushSync:y});it(v,{state:"blocked",location:h,proceed(){it(v,{state:"proceeding",proceed:void 0,reset:void 0,location:h}),a(o,n)},reset(){let e=new Map(O.blockers);e.set(v,V),Ie({blockers:e})}})},fetch:function(t,r,a,n){if(l)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");ee.has(t)&&tt(t);let i=!0===(n&&n.unstable_flushSync),s=c||g,u=te(O.location,O.matches,b,S.v7_prependBasename,a,S.v7_relativeSplatPath,r,null==n?void 0:n.relative),d=p(s,u,b),h=ft(d,s,u);if(h.active&&h.matches&&(d=h.matches),!d)return void Qe(t,r,Re(404,{pathname:u}),{flushSync:i});let{path:f,submission:m,error:y}=re(S.v7_normalizeFormMethod,!0,u,n);if(y)return void Qe(t,r,y,{flushSync:i});let v=He(d,f);H=!0===(n&&n.preventScrollReset),m&&Te(m.formMethod)?async function(t,r,a,n,i,s,l,u){function d(e){if(!e.route.action&&!e.route.lazy){let e=Re(405,{method:u.formMethod,pathname:a,routeId:r});return Qe(t,r,e,{flushSync:l}),!0}return!1}if(Xe(),ye.delete(t),!s&&d(n))return;let h=O.fetchers.get(t);Ge(t,function(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}(u,h),{flushSync:l});let f=new AbortController,m=me(e.history,a,f.signal,u);if(s){let e=await pt(i,a,m.signal);if("aborted"===e.type)return;if("error"===e.type){let{error:o}=ut(a,e);return void Qe(t,r,o,{flushSync:l})}if(!e.matches)return void Qe(t,r,Re(404,{pathname:a}),{flushSync:l});if(d(n=He(i=e.matches,a)))return}ee.set(t,f);let y=ae,v=(await Je("action",m,[n],i))[0];if(m.signal.aborted)return void(ee.get(t)===f&&ee.delete(t));if(S.v7_fetcherPersist&&ge.has(t)){if(je(v)||Me(v))return void Ge(t,We(void 0))}else{if(je(v))return ee.delete(t),ne>y?void Ge(t,We(void 0)):(ue.add(t),Ge(t,Ne(u)),Ye(m,v,{fetcherSubmission:u}));if(Me(v))return void Qe(t,r,v.error)}if(Le(v))throw Re(400,{type:"defer-action"});let w=O.navigation.location||O.location,D=me(e.history,w,f.signal),E=c||g,R="idle"!==O.navigation.state?p(E,O.navigation.location,b):O.matches;o(R,"Didn't find any matches after fetcher action");let P=++ae;ie.set(t,P);let x=Ne(u,v.data);O.fetchers.set(t,x);let[A,L]=oe(e.history,O,R,u,w,!1,S.unstable_skipActionErrorRevalidation,$,q,Z,ge,ye,ue,E,b,[n.route.id,v]);L.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,r=O.fetchers.get(t),a=Ne(void 0,r?r.data:void 0);O.fetchers.set(t,a),ee.has(t)&&tt(t),e.controller&&ee.set(t,e.controller)})),Ie({fetchers:new Map(O.fetchers)});let M=()=>L.forEach((e=>tt(e.key)));f.signal.addEventListener("abort",M);let{loaderResults:j,fetcherResults:_}=await Ve(O.matches,R,A,L,D);if(f.signal.aborted)return;f.signal.removeEventListener("abort",M),ie.delete(t),ee.delete(t),L.forEach((e=>ee.delete(e.key)));let k=Pe([...j,..._]);if(k){if(k.idx>=A.length){let e=L[k.idx-A.length].key;ue.add(e)}return Ye(D,k.result)}let{loaderData:C,errors:T}=be(O,O.matches,A,j,void 0,L,_,xe);if(O.fetchers.has(t)){let e=We(v.data);O.fetchers.set(t,e)}ot(P),"loading"===O.navigation.state&&P>ne?(o(I,"Expected pending action"),U&&U.abort(),$e(O.navigation.location,{matches:R,loaderData:C,errors:T,fetchers:new Map(O.fetchers)})):(Ie({errors:T,loaderData:we(O.loaderData,C,R,T),fetchers:new Map(O.fetchers)}),$=!1)}(t,r,f,v,d,h.active,i,m):(ye.set(t,{routeId:r,path:f}),async function(t,r,a,n,i,s,l,u){let c=O.fetchers.get(t);Ge(t,Ne(u,c?c.data:void 0),{flushSync:l});let d=new AbortController,h=me(e.history,a,d.signal);if(s){let e=await pt(i,a,h.signal);if("aborted"===e.type)return;if("error"===e.type){let{error:o}=ut(a,e);return void Qe(t,r,o,{flushSync:l})}if(!e.matches)return void Qe(t,r,Re(404,{pathname:a}),{flushSync:l});n=He(i=e.matches,a)}ee.set(t,d);let f=ae,p=(await Je("loader",h,[n],i))[0];Le(p)&&(p=await Oe(p,h.signal,!0)||p);ee.get(t)===d&&ee.delete(t);if(h.signal.aborted)return;if(ge.has(t))return void Ge(t,We(void 0));if(je(p))return ne>f?void Ge(t,We(void 0)):(ue.add(t),void await Ye(h,p));if(Me(p))return void Qe(t,r,p.error);o(!Le(p),"Unhandled fetcher deferred data"),Ge(t,We(p.data))}(t,r,f,v,d,h.active,i,m))},revalidate:function(){Xe(),Ie({revalidation:"loading"}),"submitting"!==O.navigation.state&&("idle"!==O.navigation.state?qe(I||O.historyAction,O.navigation.location,{overrideNavigation:O.navigation}):qe(O.historyAction,O.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Ze,deleteFetcher:function(e){if(S.v7_fetcherPersist){let t=(ve.get(e)||0)-1;t<=0?(ve.delete(e),ge.add(e)):ve.set(e,t)}else et(e);Ie({fetchers:new Map(O.fetchers)})},dispose:function(){E&&E(),N&&N(),R.clear(),U&&U.abort(),O.fetchers.forEach(((e,t)=>et(t))),O.blockers.forEach(((e,t)=>nt(t)))},getBlocker:function(e,t){let r=O.blockers.get(e)||V;return _e.get(e)!==t&&_e.set(e,t),r},deleteBlocker:nt,patchRoutes:(e,t)=>le(e,t,v,u),_internalFetchControllers:ee,_internalActiveDeferreds:xe,_internalSetRoutes:function(e){v={},c=f(e,u,void 0,v)}},k},e.createStaticHandler=function(e,r){o(e.length>0,"You must provide a non-empty routes array to createStaticHandler");let a,n={},i=(r?r.basename:null)||"/";if(null!=r&&r.mapRouteProperties)a=r.mapRouteProperties;else if(null!=r&&r.detectErrorBoundary){let e=r.detectErrorBoundary;a=t=>({hasErrorBoundary:e(t)})}else a=G;let u=t({v7_relativeSplatPath:!1,v7_throwAbortReason:!1},r?r.future:null),c=f(e,a,void 0,n);async function h(e,r,a,n,i,s,l){o(e.signal,"query()/queryRoute() requests must contain an AbortController signal");try{if(Te(e.method.toLowerCase())){let o=await async function(e,r,a,o,n,i,s){let l;if(a.route.action||a.route.lazy){l=(await y("action",e,[a],r,s,o,n))[0],e.signal.aborted&&ee(e,s,u)}else{let t=Re(405,{method:e.method,pathname:new URL(e.url).pathname,routeId:a.route.id});if(s)throw t;l={type:d.error,error:t}}if(je(l))throw new Response(null,{status:l.response.status,headers:{Location:l.response.headers.get("Location")}});if(Le(l)){let e=Re(400,{type:"defer-action"});if(s)throw e;l={type:d.error,error:e}}if(s){if(Me(l))throw l.error;return{matches:[a],loaderData:{},actionData:{[a.route.id]:l.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}let c=new Request(e.url,{headers:e.headers,redirect:e.redirect,signal:e.signal});if(Me(l)){let e=i?a:Se(r,a.route.id);return t({},await m(c,r,o,n,i,null,[e.route.id,l]),{statusCode:z(l.error)?l.error.status:null!=l.statusCode?l.statusCode:500,actionData:null,actionHeaders:t({},l.headers?{[a.route.id]:l.headers}:{})})}return t({},await m(c,r,o,n,i,null),{actionData:{[a.route.id]:l.data}},l.statusCode?{statusCode:l.statusCode}:{},{actionHeaders:l.headers?{[a.route.id]:l.headers}:{}})}(e,a,l||He(a,r),n,i,s,null!=l);return o}let o=await m(e,a,n,i,s,l);return ke(o)?o:t({},o,{actionData:null,actionHeaders:{}})}catch(e){if(function(e){return null!=e&&"object"==typeof e&&"type"in e&&"result"in e&&(e.type===d.data||e.type===d.error)}(e)&&ke(e.result)){if(e.type===d.error)throw e.result;return e.result}if(function(e){if(!ke(e))return!1;let t=e.status,r=e.headers.get("Location");return t>=300&&t<=399&&null!=r}(e))return e;throw e}}async function m(e,r,a,o,n,i,s){let l=null!=i;if(l&&(null==i||!i.route.loader)&&(null==i||!i.route.lazy))throw Re(400,{method:e.method,pathname:new URL(e.url).pathname,routeId:null==i?void 0:i.route.id});let c=(i?[i]:s&&Me(s[1])?ae(r,s[0]):r).filter((e=>e.route.loader||e.route.lazy));if(0===c.length)return{matches:r,loaderData:r.reduce(((e,t)=>Object.assign(e,{[t.route.id]:null})),{}),errors:s&&Me(s[1])?{[s[0]]:s[1].error}:null,statusCode:200,loaderHeaders:{},activeDeferreds:null};let d=await y("loader",e,c,r,l,a,o);e.signal.aborted&&ee(e,l,u);let h=new Map,f=ge(r,c,d,s,h,n),p=new Set(c.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})}async function y(e,t,r,o,s,l,c){let d=await de(c||ce,e,t,r,o,n,a,l);return await Promise.all(d.map(((e,a)=>{if(Ae(e)){throw fe(e.result,t,r[a].route.id,o,i,u.v7_relativeSplatPath)}if(ke(e.result)&&s)throw e;return he(e)})))}return{dataRoutes:c,query:async function(e,r){let{requestContext:a,skipLoaderErrorBubbling:o,unstable_dataStrategy:n}=void 0===r?{}:r,u=new URL(e.url),d=e.method,f=s("",l(u),null,"default"),m=p(c,f,i);if(!Ce(d)&&"HEAD"!==d){let e=Re(405,{method:d}),{matches:t,route:r}=Ee(c);return{basename:i,location:f,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(!m){let e=Re(404,{pathname:f.pathname}),{matches:t,route:r}=Ee(c);return{basename:i,location:f,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}let y=await h(e,f,m,a,n||null,!0===o,null);return ke(y)?y:t({location:f,basename:i},y)},queryRoute:async function(e,t){let{routeId:r,requestContext:a,unstable_dataStrategy:o}=void 0===t?{}:t,n=new URL(e.url),u=e.method,d=s("",l(n),null,"default"),f=p(c,d,i);if(!Ce(u)&&"HEAD"!==u&&"OPTIONS"!==u)throw Re(405,{method:u});if(!f)throw Re(404,{pathname:d.pathname});let m=r?f.find((e=>e.route.id===r)):He(f,d);if(r&&!m)throw Re(403,{pathname:d.pathname,routeId:r});if(!m)throw Re(404,{pathname:d.pathname});let y=await h(e,d,f,a,o||null,!1,m);if(ke(y))return y;let v=y.errors?Object.values(y.errors)[0]:void 0;if(void 0!==v)throw v;if(y.actionData)return Object.values(y.actionData)[0];if(y.loaderData){var g;let e=Object.values(y.loaderData)[0];return null!=(g=y.activeDeferreds)&&g[m.route.id]&&(e[Z]=y.activeDeferreds[m.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;r.endsWith("*")&&"*"!==r&&!r.endsWith("/*")&&(n(!1,'Route path "'+r+'" will be treated as if it were "'+r.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+r.replace(/\*$/,"/*")+'".'),r=r.replace(/\*$/,"/*"));const a=r.startsWith("/")?"/":"",i=e=>null==e?"":"string"==typeof e?e:String(e);return a+r.split(/\/+/).map(((e,r,a)=>{if(r===a.length-1&&"*"===e){return i(t["*"])}const n=e.match(/^:([\w-]+)(\??)$/);if(n){const[,e,r]=n;let a=t[e];return o("?"===r||null!=a,'Missing ":'+e+'" param'),i(a)}return e.replace(/\?$/g,"")})).filter((e=>!!e)).join("/")},e.getStaticContextFromError=function(e,r,a){return t({},r,{statusCode:z(a)?a.status:500,errors:{[r._deepestRenderedBoundaryId||e[0].id]:a}})},e.getToPathname=function(e){return""===e||""===e.pathname?"/":"string"==typeof e?u(e).pathname:e.pathname},e.isDeferredData=_e,e.isRouteErrorResponse=z,e.joinPaths=_,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=E,e.matchRoutes=p,e.normalizePathname=k,e.parsePath=u,e.redirect=H,e.redirectDocument=(e,t)=>{let r=H(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r},e.resolvePath=x,e.resolveTo=j,e.stripBasename=P,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=router.umd.min.js.map |
@@ -19,4 +19,5 @@ import type { Location, Path, To } from "./history"; | ||
type: ResultType.data; | ||
data: any; | ||
response?: Response; | ||
data: unknown; | ||
statusCode?: number; | ||
headers?: Headers; | ||
} | ||
@@ -44,4 +45,5 @@ /** | ||
type: ResultType.error; | ||
error: any; | ||
response?: Response; | ||
error: unknown; | ||
statusCode?: number; | ||
headers?: Headers; | ||
} | ||
@@ -56,4 +58,5 @@ /** | ||
export interface HandlerResult { | ||
type: ResultType.data | ResultType.error; | ||
result: any; | ||
type: "data" | "error"; | ||
result: unknown; | ||
status?: number; | ||
} | ||
@@ -170,2 +173,3 @@ type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete"; | ||
json?: Submission["json"]; | ||
unstable_actionStatus?: number; | ||
actionResult?: any; | ||
@@ -194,3 +198,4 @@ defaultShouldRevalidate: boolean; | ||
export interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRouteObject> { | ||
bikeshed_loadRoute: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<HandlerResult>; | ||
shouldLoad: boolean; | ||
resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => Promise<HandlerResult>) => Promise<HandlerResult>; | ||
} | ||
@@ -203,2 +208,5 @@ export interface DataStrategyFunctionArgs<Context = any> extends DataFunctionArgs<Context> { | ||
} | ||
export interface PatchRoutesOnMissFunction<M extends AgnosticDataRouteMatch = AgnosticDataRouteMatch> { | ||
(path: string, matches: M[]): M["route"][] | null | Promise<M["route"][] | null>; | ||
} | ||
/** | ||
@@ -318,3 +326,3 @@ * Function provided by the framework-aware layers to set any framework-specific | ||
} | ||
export declare function convertRoutesToDataRoutes(routes: AgnosticRouteObject[], mapRouteProperties: MapRoutePropertiesFunction, parentPath?: number[], manifest?: RouteManifest): AgnosticDataRouteObject[]; | ||
export declare function convertRoutesToDataRoutes(routes: AgnosticRouteObject[], mapRouteProperties: MapRoutePropertiesFunction, parentPath?: string[], manifest?: RouteManifest): AgnosticDataRouteObject[]; | ||
/** | ||
@@ -326,2 +334,3 @@ * Matches the given routes to a location and returns the match data. | ||
export declare function matchRoutes<RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject>(routes: RouteObjectType[], locationArg: Partial<Location> | string, basename?: string): AgnosticRouteMatch<string, RouteObjectType>[] | null; | ||
export declare function matchRoutesImpl<RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject>(routes: RouteObjectType[], locationArg: Partial<Location> | string, allowPartial?: boolean, basename?: string): AgnosticRouteMatch<string, RouteObjectType>[] | null; | ||
export interface UIMatch<Data = unknown, Handle = unknown> { | ||
@@ -328,0 +337,0 @@ id: string; |
@@ -12,8 +12,9 @@ export type { | ||
AgnosticRouteObject, | ||
DataStrategyFunction, | ||
DataStrategyFunctionArgs, | ||
DataStrategyMatch, | ||
DataStrategyFunction as unstable_DataStrategyFunction, | ||
DataStrategyFunctionArgs as unstable_DataStrategyFunctionArgs, | ||
DataStrategyMatch as unstable_DataStrategyMatch, | ||
ErrorResponse, | ||
FormEncType, | ||
FormMethod, | ||
HandlerResult as unstable_HandlerResult, | ||
HTMLFormMethod, | ||
@@ -20,0 +21,0 @@ JsonFunction, |
{ | ||
"name": "@remix-run/router", | ||
"version": "0.0.0-experimental-a0888892", | ||
"version": "0.0.0-experimental-abead7ae1", | ||
"description": "Nested/Data-driven/Framework-agnostic Routing", | ||
@@ -33,2 +33,2 @@ "keywords": [ | ||
} | ||
} | ||
} |
81
utils.ts
@@ -23,4 +23,5 @@ import type { Location, Path, To } from "./history"; | ||
type: ResultType.data; | ||
data: any; | ||
response?: Response; | ||
data: unknown; | ||
statusCode?: number; | ||
headers?: Headers; | ||
} | ||
@@ -43,2 +44,3 @@ | ||
type: ResultType.redirect; | ||
// We keep the raw Response for redirects so we can return it verbatim | ||
response: Response; | ||
@@ -52,4 +54,5 @@ } | ||
type: ResultType.error; | ||
error: any; | ||
response?: Response; | ||
error: unknown; | ||
statusCode?: number; | ||
headers?: Headers; | ||
} | ||
@@ -70,4 +73,5 @@ | ||
export interface HandlerResult { | ||
type: ResultType.data | ResultType.error; | ||
result: any; // data, Error, Response, DeferredData | ||
type: "data" | "error"; | ||
result: unknown; // data, Error, Response, DeferredData | ||
status?: number; | ||
} | ||
@@ -213,2 +217,3 @@ | ||
json?: Submission["json"]; | ||
unstable_actionStatus?: number; | ||
actionResult?: any; | ||
@@ -241,7 +246,7 @@ defaultShouldRevalidate: boolean; | ||
extends AgnosticRouteMatch<string, AgnosticDataRouteObject> { | ||
// TODO: What to call these? | ||
bikeshed_loadRoute: ( | ||
shouldLoad: boolean; | ||
resolve: ( | ||
handlerOverride?: ( | ||
handler: (ctx?: unknown) => DataFunctionReturnValue | ||
) => DataFunctionReturnValue | ||
) => Promise<HandlerResult> | ||
) => Promise<HandlerResult>; | ||
@@ -259,2 +264,11 @@ } | ||
export interface PatchRoutesOnMissFunction< | ||
M extends AgnosticDataRouteMatch = AgnosticDataRouteMatch | ||
> { | ||
(path: string, matches: M[]): | ||
| M["route"][] | ||
| null | ||
| Promise<M["route"][] | null>; | ||
} | ||
/** | ||
@@ -449,7 +463,7 @@ * Function provided by the framework-aware layers to set any framework-specific | ||
mapRouteProperties: MapRoutePropertiesFunction, | ||
parentPath: number[] = [], | ||
parentPath: string[] = [], | ||
manifest: RouteManifest = {} | ||
): AgnosticDataRouteObject[] { | ||
return routes.map((route, index) => { | ||
let treePath = [...parentPath, index]; | ||
let treePath = [...parentPath, String(index)]; | ||
let id = typeof route.id === "string" ? route.id : treePath.join("-"); | ||
@@ -509,2 +523,13 @@ invariant( | ||
): AgnosticRouteMatch<string, RouteObjectType>[] | null { | ||
return matchRoutesImpl(routes, locationArg, false, basename); | ||
} | ||
export function matchRoutesImpl< | ||
RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject | ||
>( | ||
routes: RouteObjectType[], | ||
locationArg: Partial<Location> | string, | ||
allowPartial = false, | ||
basename = "/" | ||
): AgnosticRouteMatch<string, RouteObjectType>[] | null { | ||
let location = | ||
@@ -531,3 +556,7 @@ typeof locationArg === "string" ? parsePath(locationArg) : locationArg; | ||
let decoded = decodePath(pathname); | ||
matches = matchRouteBranch<string, RouteObjectType>(branches[i], decoded); | ||
matches = matchRouteBranch<string, RouteObjectType>( | ||
branches[i], | ||
decoded, | ||
allowPartial | ||
); | ||
} | ||
@@ -623,3 +652,2 @@ | ||
); | ||
flattenRoutes(route.children, branches, routesMeta, path); | ||
@@ -777,3 +805,4 @@ } | ||
branch: RouteBranch<RouteObjectType>, | ||
pathname: string | ||
pathname: string, | ||
allowPartial = false | ||
): AgnosticRouteMatch<ParamKey, RouteObjectType>[] | null { | ||
@@ -797,8 +826,26 @@ let { routesMeta } = branch; | ||
if (!match) return null; | ||
let route = meta.route; | ||
if ( | ||
!match && | ||
end && | ||
allowPartial && | ||
!routesMeta[routesMeta.length - 1].route.index | ||
) { | ||
match = matchPath( | ||
{ | ||
path: meta.relativePath, | ||
caseSensitive: meta.caseSensitive, | ||
end: false, | ||
}, | ||
remainingPathname | ||
); | ||
} | ||
if (!match) { | ||
return null; | ||
} | ||
Object.assign(matchedParams, match.params); | ||
let route = meta.route; | ||
matches.push({ | ||
@@ -805,0 +852,0 @@ // TODO: Can this as be avoided? |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2635407
24178