|
|
import{o as e}from"./chunk-jRWAZmH_.js";import{n as t}from"./jsx-runtime-CEixWuwE.js";import{t as n}from"./preload-helper-DZmVH3u5.js";var r=e(t(),1),i=e=>{throw TypeError(e)},a=(e,t,n)=>t.has(e)||i(`Cannot `+n),o=(e,t,n)=>(a(e,t,`read from private field`),n?n.call(e):t.get(e)),s=(e,t,n)=>t.has(e)?i(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),c=(e,t,n,r)=>(a(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),l=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,u=/^[\\/]{2}/;function d(e,t){return t+e.replace(/\\/g,`/`)}var f=`popstate`;function p(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function m(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return y(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:b(t)}return S(t,n,null,e)}function h(e,t){if(e===!1||e==null)throw Error(t)}function g(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function _(){return Math.random().toString(36).substring(2,10)}function v(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function y(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?x(t):t,state:n,key:t&&t.key||r||_(),mask:i}}function b({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function x(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function S(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:_.location,delta:t})}function m(e,t){s=`PUSH`;let r=p(e)?e:y(_.location,e,t);n&&n(r,e),l=u()+1;let d=v(r,l),f=_.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:_.location,delta:1})}function h(e,t){s=`REPLACE`;let r=p(e)?e:y(_.location,e,t);n&&n(r,e),l=u();let i=v(r,l),d=_.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:_.location,delta:0})}function g(e){return C(i,e)}let _={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(f,d),c=e,()=>{i.removeEventListener(f,d),c=null}},createHref(e){return t(i,e)},createURL:g,encodeLocation(e){let t=g(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:m,replace:h,go(e){return o.go(e)}};return _}function C(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),h(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:b(t);return i=i.replace(/ $/,`%20`),!n&&u.test(i)&&(i=r+i),new URL(i,r)}var w,T=class{constructor(e){if(s(this,w,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(o(this,w).has(e))return o(this,w).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){o(this,w).set(e,t)}};w=new WeakMap;var E=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function D(e){return E.has(e)}var O=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function k(e){return O.has(e)}function A(e){return e.index===!0}function j(e,t,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(h(e.index!==!0||!e.children,`Cannot specify children on an index route`),h(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),A(e)){let n={...e,id:s};return r[s]=M(n,t(n)),n}else{let n={...e,id:s,children:void 0};return r[s]=M(n,t(n)),e.children&&(n.children=j(e.children,t,o,r,i)),n}})}function M(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function N(e,t,n=`/`){return P(e,t,n,!1)}function P(e,t,n,r,i){let a=H((typeof t==`string`?x(t):t).pathname||`/`,n);if(a==null)return null;let o=i??F(e),s=null,c=de(a);for(let e=0;s==null&&e<o.length;++e)s=ue(o[e],c,r);return s}function ee(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function F(e){let t=I(e);return te(t),t}function I(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;h(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=G([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(h(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),I(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:ce(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=V(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of L(e.path))a(e,t,!0,n)}),t}function L(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=L(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function te(e){e.sort((e,t)=>e.score===t.score?le(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ne=/^:[\w-]+$/,re=3,ie=2,ae=1,R=10,oe=-2,se=e=>e===`*`;function ce(e,t){let n=e.split(`/`),r=n.length;return n.some(se)&&(r+=oe),t&&(r+=ie),n.filter(e=>!se(e)).reduce((e,t)=>e+(ne.test(t)?re:t===``?ae:R),r)}function le(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function ue(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?B(u,l,s.matcher,s.compiledParams):z(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=z({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:G([a,d.pathname]),pathnameBase:be(G([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=G([a,d.pathnameBase]))}return o}function z(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=V(e.path,e.caseSensitive,e.end);return B(e,t,n,r)}function B(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function V(e,t=!1,n=!0){g(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 r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function de(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return g(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function H(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function fe({basename:e,pathname:t}){return t===`/`?e:G([e,t])}var pe=e=>l.test(e);function me(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?x(e):e,a;return n?(n=ve(n),a=n.startsWith(`/`)?he(n.substring(1),`/`):he(n,t)):a=t,{pathname:a,search:xe(r),hash:Se(i)}}function he(e,t){let n=ye(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ge(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function U(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function W(e){let t=U(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function _e(e,t,n,r=!1){let i;typeof e==`string`?i=x(e):(i={...e},h(!i.pathname||!i.pathname.includes(`?`),ge(`?`,`pathname`,`search`,i)),h(!i.pathname||!i.pathname.includes(`#`),ge(`#`,`pathname`,`hash`,i)),h(!i.search||!i.search.includes(`#`),ge(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=me(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var ve=e=>e.replace(/[\\/]{2,}/g,`/`),G=e=>ve(e.join(`/`)),ye=e=>e.replace(/\/+$/,``),be=e=>ye(e).replace(/^\/*/,`/`),xe=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Se=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ce=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],we=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Te(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Ee(e){return G(e.map(e=>e.route.path).filter(Boolean))||`/`}var De=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Oe(e,t){let n=e;if(typeof n!=`string`||!l.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(De)try{let e=new URL(window.location.href),r=u.test(n)?new URL(d(n,e.protocol)):new URL(n),a=H(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{g(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var ke=Symbol(`Uninstrumented`);function Ae(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){let t=Object.keys(n);for(let r of t)e[r]&&n[r].push(e[r])}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=Me(n.lazy,t.lazy,()=>void 0);e&&(r.lazy=e)}if(typeof t.lazy==`object`){let e=t.lazy;[`middleware`,`loader`,`action`].forEach(t=>{let i=e[t],a=n[`lazy.${t}`];if(typeof i==`function`&&a.length>0){let e=Me(a,i,()=>void 0);e&&(r.lazy=Object.assign(r.lazy||{},{[t]:e}))}})}return[`loader`,`action`].forEach(e=>{let i=t[e];if(typeof i==`function`&&n[e].length>0){let t=i[ke]??i,a=Me(n[e],t,(...e)=>q(e[0]));a&&(e===`loader`&&t.hydrate===!0&&(a.hydrate=!0),a[ke]=t,r[e]=a)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=e[ke]??e,r=Me(n.middleware,t,(...e)=>q(e[0]));return r?(r[ke]=t,r):e})),r}function je(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){let t=Object.keys(e);for(let r of t)e[r]&&n[r].push(e[r])}})),n.navigate.length>0){let t=e.navigate[ke]??e.navigate,r=Me(n.navigate,t,(...t)=>{let[n,r]=t;return{to:typeof n==`number`||typeof n==`string`?n:n?b(n):`.`,...Ne(e,r??{})}});r&&(r[ke]=t,e.navigate=r)}if(n.fetch.length>0){let t=e.fetch[ke]??e.fetch,r=Me(n.fetch,t,(...t)=>{let[n,,r,i]=t;return{href:r??`.`,fetcherKey:n,...Ne(e,i??{})}});r&&(r[ke]=t,e.fetch=r)}return e}function Me(e,t,n){return e.length===0?null:async(...r)=>{let i=await K(e,n(...r),()=>t(...r),e.length-1);if(i.type===`error`)throw i.value;return i.value}}async function K(e,t,n,r){let i=e[r],a;if(i){let o,s=async()=>(o?console.error(`You cannot call instrumented handlers more than once`):o=K(e,t,n,r-1),a=await o,h(a,`Expected a result`),a.type===`error`&&a.value instanceof Error?{status:`error`,error:a.value}:{status:`success`,error:void 0});try{await i(s,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}o||await s(),await o}else try{a={type:`success`,value:await n()}}catch(e){a={type:`error`,value:e}}return a||{type:`error`,value:Error(`No result assigned in instrumentation chain.`)}}function q(e){let{request:t,context:n,params:r,pattern:i}=e;return{request:Pe(t),params:{...r},pattern:i,context:Fe(n)}}function Ne(e,t){return{currentUrl:b(e.state.location),...`formMethod`in t?{formMethod:t.formMethod}:{},...`formEncType`in t?{formEncType:t.formEncType}:{},...`formData`in t?{formData:t.formData}:{},...`body`in t?{body:t.body}:{}}}function Pe(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function Fe(e){if(Le(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var Ie=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Le(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===Ie}var Re=[`POST`,`PUT`,`PATCH`,`DELETE`],ze=new Set(Re),Be=[`GET`,...Re],Ve=new Set(Be),He=new Set([301,302,303,307,308]),Ue=new Set([307,308]),We={state:`idle`,location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ge={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ke={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},qe=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Je=`remix-router-transitions`,Ye=Symbol(`ResetLoaderData`),Xe,Ze,Qe,$e,et=class{constructor(e){s(this,Xe),s(this,Ze),s(this,Qe),s(this,$e),c(this,Xe,e),c(this,Ze,F(e))}get stableRoutes(){return o(this,Xe)}get activeRoutes(){return o(this,Qe)??o(this,Xe)}get branches(){return o(this,$e)??o(this,Ze)}get hasHMRRoutes(){return o(this,Qe)!=null}setRoutes(e){c(this,Xe,e),c(this,Ze,F(e))}setHmrRoutes(e){c(this,Qe,e),c(this,$e,F(e))}commitHmrRoutes(){o(this,Qe)&&(c(this,Xe,o(this,Qe)),c(this,Ze,o(this,$e)),c(this,Qe,void 0),c(this,$e,void 0))}};Xe=new WeakMap,Ze=new WeakMap,Qe=new WeakMap,$e=new WeakMap;function tt(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;h(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||qe,a=i;if(e.instrumentations){let t=e.instrumentations;a=e=>({...i(e),...Ae(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=new et(j(e.routes,a,void 0,o)),c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||vt,u={...e.future},d=null,f=new Set,p=null,m=null,_=null,v=null,b=e.hydrationData!=null,S=P(s.activeRoutes,e.history.location,c,!1,s.branches),w=!1,E=null,D,O;if(S==null&&!e.patchRoutesOnNavigation){let t=J(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=Ht(s.activeRoutes);D=!0,O=!D,S=n,E={[r.id]:t}}else if(S&&!e.hydrationData&&nt(S,s.activeRoutes,e.history.location.pathname).active&&(S=null),!S){D=!1,O=!D,S=[];let t=nt(null,s.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(w=!0,S=t.matches)}else if(S.some(e=>e.route.lazy))D=!1,O=!D;else if(!S.some(e=>ot(e.route)))D=!0,O=!D;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=S;if(n){let e=S.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}O=!1,D=!0,r.forEach(e=>{let r=st(e.route,t,n);O||=r.renderFallback,D&&=!r.shouldLoad})}let k,A={historyAction:e.history.action,location:e.history.location,matches:S,initialized:D,renderFallback:O,navigation:We,restoreScrollPosition:e.hydrationData==null?null:!1,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||E,fetchers:new Map,blockers:new Map},M=`POP`,N=null,F=!1,I,L=!1,te=new Map,ne=null,re=!1,ie=!1,ae=new Set,R=new Map,oe=0,se=-1,ce=new Map,le=new Set,ue=new Map,z=new Map,B=new Set,V=new Map,de,fe=null;function me(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(de){de(),de=void 0;return}g(V.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=Ye({currentLocation:A.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{de=e});e.history.go(r*-1),Je(i,{state:`blocked`,location:n,proceed(){Je(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(A.blockers);e.set(i,Ke),U({blockers:e})}}),N?.resolve(),N=null;return}return G(t,n)}),n){dn(t,te);let e=()=>fn(t,te);t.addEventListener(`pagehide`,e),ne=()=>t.removeEventListener(`pagehide`,e)}return A.initialized||G(`POP`,A.location,{initialHydration:!0}),k}function he(){d&&d(),ne&&ne(),f.clear(),I&&I.abort(),A.fetchers.forEach((e,t)=>Fe(A.fetchers,t)),A.blockers.forEach((e,t)=>He(t))}function ge(e){if(f.add(e),p){let{newErrors:t}=p;p=null,e(A,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>f.delete(e)}function U(e,t={}){e.matches&&=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),A={...A,...e};let n=[],r=[];A.fetchers.forEach((e,t)=>{e.state===`idle`&&(B.has(t)?n.push(t):r.push(t))}),B.forEach(e=>{!A.fetchers.has(e)&&!R.has(e)&&n.push(e)}),f.size===0&&(p={newErrors:e.errors??null}),[...f].forEach(r=>r(A,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>Fe(A.fetchers,e)),r.forEach(e=>A.fetchers.delete(e))}function W(t,n,{flushSync:r}={}){let i=A.actionData!=null&&A.navigation.formMethod!=null&&X(A.navigation.formMethod)&&A.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?A.actionData:null;let o=n.loaderData?zt(A.loaderData,n.loaderData,n.matches||[],n.errors):A.loaderData,c=A.blockers;c.size>0&&(c=new Map(c),c.forEach((e,t)=>c.set(t,Ke)));let l=re?!1:tt(t,n.matches||A.matches),u=F===!0||A.navigation.formMethod!=null&&X(A.navigation.formMethod)&&t.state?._isRedirect!==!0;s.commitHmrRoutes(),re||M===`POP`||(M===`PUSH`?e.history.push(t,t.state):M===`REPLACE`&&e.history.replace(t,t.state));let d;if(M===`POP`){let e=te.get(A.location.pathname);e&&e.has(t.pathname)?d={currentLocation:A.location,nextLocation:t}:te.has(t.pathname)&&(d={currentLocation:t,nextLocation:A.location})}else if(L){let e=te.get(A.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),te.set(A.location.pathname,e)),d={currentLocation:A.location,nextLocation:t}}U({...n,actionData:a,loaderData:o,historyAction:M,location:t,initialized:!0,renderFallback:!1,navigation:We,revalidation:`idle`,restoreScrollPosition:l,preventScrollReset:u,blockers:c},{viewTransitionOpts:d,flushSync:r===!0}),M=`POP`,F=!1,L=!1,re=!1,ie=!1,N?.resolve(),N=null,fe?.resolve(),fe=null}async function _e(t,n){if(N?.resolve(),N=null,typeof t==`number`){N||=pn();let n=N.promise;return e.history.go(t),n}let{path:r,submission:i,error:a}=it(!1,rt(A.location,A.matches,c,t,n?.fromRouteId,n?.relative),n),o;n?.mask&&(o={pathname:``,search:``,hash:``,...typeof n.mask==`string`?x(n.mask):{...A.location.mask,...n.mask}});let s=A.location,l=y(s,r,n&&n.state,void 0,o);l={...l,...e.history.encodeLocation(l)};let u=n&&n.replace!=null?n.replace:void 0,d=`PUSH`;u===!0?d=`REPLACE`:u===!1||i!=null&&X(i.formMethod)&&i.formAction===A.location.pathname+A.location.search&&(d=`REPLACE`);let f=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,p=(n&&n.flushSync)===!0,m=Ye({currentLocation:s,nextLocation:l,historyAction:d});if(m){Je(m,{state:`blocked`,location:l,proceed(){Je(m,{state:`proceeding`,proceed:void 0,reset:void 0,location:l}),_e(t,n)},reset(){let e=new Map(A.blockers);e.set(m,Ke),U({blockers:e})}});return}await G(d,l,{submission:i,pendingError:a,preventScrollReset:f,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:p,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate})}function ve(){fe||=pn(),Me(),U({revalidation:`loading`});let e=fe.promise;return A.navigation.state===`submitting`?e:A.navigation.state===`idle`?(G(A.historyAction,A.location,{startUninterruptedRevalidation:!0}),e):(G(M||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:L===!0}),e)}async function G(t,n,r){I&&I.abort(),I=null,M=t,re=(r&&r.startUninterruptedRevalidation)===!0,$e(A.location,A.matches),F=(r&&r.preventScrollReset)===!0,L=(r&&r.enableViewTransition)===!0;let i=s.activeRoutes,a=r?.initialHydration&&A.matches&&A.matches.length>0&&!w?A.matches:P(i,n,c,!1,s.branches),o=(r&&r.flushSync)===!0;if(a&&A.initialized&&!ie&&Gt(A.location,n)&&!(r&&r.submission&&X(r.submission.formMethod))){W(n,{matches:a},{flushSync:o});return}let l=nt(a,i,n.pathname);if(l.active&&l.matches&&(a=l.matches),!a){let{error:e,notFoundMatches:t,route:r}=Xe(n.pathname);W(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:o});return}let u=r&&r.overrideNavigation?{...r.overrideNavigation,matches:a,historyAction:t}:void 0;I=new AbortController;let d=Nt(e.history,n,I.signal,r&&r.submission),f=e.getContext?await e.getContext():new T,p;if(r&&r.pendingError)p=[Vt(a).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&X(r.submission.formMethod)){let i=await ye(d,n,r.submission,a,t,f,l.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:o});if(i.shortCircuited)return;if(i.pendingActionResult){let[e,t]=i.pendingActionResult;if(Y(t)&&Te(t.error)&&t.error.status===404){I=null,W(n,{matches:i.matches,loaderData:{},errors:{[e]:t.error}});return}}a=i.matches||a,p=i.pendingActionResult,u=on(n,a,t,r.submission),o=!1,l.active=!1,d=Nt(e.history,d.url,d.signal)}let{shortCircuited:m,matches:h,loaderData:g,errors:_,workingFetchers:v}=await be(d,n,a,t,f,l.active,u,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,o,p,r&&r.callSiteDefaultShouldRevalidate);m||(I=null,W(n,{matches:h||a,...Bt(p),loaderData:g,errors:_,...v?{fetchers:v}:{}}))}async function ye(t,n,i,l,u,d,f,p,m={}){if(Me(),U({navigation:sn(n,l,u,i)},{flushSync:m.flushSync===!0}),f){let e=await ct(l,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=Ht(s.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=Vt(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}else if(e.matches)l=e.matches;else{let{notFoundMatches:e,error:t,route:r}=Xe(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let h,g=rn(l,n);if(!g.route.action&&!g.route.lazy)h={type:`error`,error:J(405,{method:t.method,pathname:n.pathname,routeId:g.route.id})};else{let e=await Oe(t,n,wt(a,o,t,n,l,g,p?[]:r,d),d,null);if(h=e[g.route.id],!h){for(let t of l)if(e[t.route.id]){h=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(Xt(h)){let n;return n=m&&m.replace!=null?m.replace:Mt(h.response.headers.get(`Location`),new URL(t.url),c,e.history)===A.location.pathname+A.location.search,await De(t,h,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(Y(h)){let e=Vt(l,g.route.id);return(m&&m.replace)!==!0&&(M=`PUSH`),{matches:l,pendingActionResult:[e.route.id,h,g.route.id]}}return{matches:l,pendingActionResult:[g.route.id,h]}}async function be(t,n,i,l,u,d,f,p,m,h,g,_,v,y){let b=f||on(n,i,l,p),x=p||m||an(b),S=!re&&!g;if(d){if(S){let e=xe(v);U({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await ct(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=Ht(s.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=Vt(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}else if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Xe(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s.activeRoutes,{dsMatches:w,revalidatingFetchers:T}=at(t,u,a,o,e.history,A,i,x,n,g?[]:r,g===!0,ie,ae,B,ue,le,C,c,e.patchRoutesOnNavigation!=null,s.branches,v,y);if(se=++oe,!e.dataStrategy&&!w.some(e=>e.shouldLoad)&&!w.some(e=>e.route.middleware&&e.route.middleware.length>0)&&T.length===0){let e=new Map(A.fetchers),t=ze(e);return W(n,{matches:i,loaderData:{},errors:v&&Y(v[1])?{[v[0]]:v[1].error}:null,...Bt(v),...t?{fetchers:e}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=xe(v);t!==void 0&&(e.actionData=t)}T.length>0&&(e.fetchers=Se(T)),U(e,{flushSync:_})}T.forEach(e=>{Le(e.key),e.controller&&R.set(e.key,e.controller)});let E=()=>T.forEach(e=>Le(e.key));I&&I.signal.addEventListener(`abort`,E);let{loaderResults:D,fetcherResults:O}=await ke(w,T,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};I&&I.signal.removeEventListener(`abort`,E),T.forEach(e=>R.delete(e.key));let k=Ut(D);if(k)return await De(t,k.result,!0,{replace:h}),{shortCircuited:!0};if(k=Ut(O),k)return le.add(k.key),await De(t,k.result,!0,{replace:h}),{shortCircuited:!0};let j=new Map(A.fetchers),{loaderData:M,errors:N}=Rt(A,i,D,v,T,O,j);g&&A.errors&&(N={...A.errors,...N});let P=ze(j),ee=Be(se,j),F=P||ee||T.length>0;return{matches:i,loaderData:M,errors:N,...F?{workingFetchers:j}:{}}}function xe(e){if(e&&!Y(e[1]))return{[e[0]]:e[1].data};if(A.actionData)return Object.keys(A.actionData).length===0?null:A.actionData}function Se(e){let t=new Map(A.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=cn(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function Ce(t,n,r,i){Le(t);let a=(i&&i.flushSync)===!0,o=s.activeRoutes,l=rt(A.location,A.matches,c,r,n,i?.relative),u=P(o,l,c,!1,s.branches),d=nt(u,o,l);if(d.active&&d.matches&&(u=d.matches),!u){q(t,n,J(404,{pathname:l}),{flushSync:a});return}let{path:f,submission:p,error:m}=it(!0,l,i);if(m){q(t,n,m,{flushSync:a});return}let h=e.getContext?await e.getContext():new T,g=(i&&i.preventScrollReset)===!0;if(p&&X(p.formMethod)){await we(t,n,f,u,h,d.active,a,g,p,i&&i.defaultShouldRevalidate);return}ue.set(t,{routeId:n,path:f}),await Ee(t,n,f,u,h,d.active,a,g,p)}async function we(t,n,i,l,u,d,f,p,m,g){Me(),ue.delete(t),K(t,ln(m,A.fetchers.get(t)),{flushSync:f});let _=new AbortController,v=Nt(e.history,i,_.signal,m);if(d){let e=await ct(l,new URL(v.url).pathname,v.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){q(t,n,e.error,{flushSync:f});return}else if(e.matches)l=e.matches;else{q(t,n,J(404,{pathname:i}),{flushSync:f});return}}let y=rn(l,i);if(!y.route.action&&!y.route.lazy){q(t,n,J(405,{method:m.formMethod,pathname:i,routeId:n}),{flushSync:f});return}R.set(t,_);let b=oe,x=wt(a,o,v,i,l,y,r,u),S=await Oe(v,i,x,u,t),C=S[y.route.id];if(!C){for(let e of x)if(S[e.route.id]){C=S[e.route.id];break}}if(v.signal.aborted){R.get(t)===_&&R.delete(t);return}if(B.has(t)){if(Xt(C)||Y(C)){K(t,un(void 0));return}}else{if(Xt(C))if(R.delete(t),se>b){K(t,un(void 0));return}else return le.add(t),K(t,cn(m)),De(v,C,!1,{fetcherSubmission:m,preventScrollReset:p});if(Y(C)){q(t,n,C.error);return}}let w=A.navigation.location||A.location,T=Nt(e.history,w,_.signal),E=s.activeRoutes,D=A.navigation.state===`idle`?A.matches:P(E,A.navigation.location,c,!1,s.branches);h(D,`Didn't find any matches after fetcher action`);let O=++oe;ce.set(t,O);let{dsMatches:k,revalidatingFetchers:j}=at(T,u,a,o,e.history,A,D,m,w,r,!1,ie,ae,B,ue,le,E,c,e.patchRoutesOnNavigation!=null,s.branches,[y.route.id,C],g),N=cn(m,C.data),ee=new Map(A.fetchers);ee.set(t,N),j.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=ee.get(t),r=cn(void 0,n?n.data:void 0);ee.set(t,r),Le(t),e.controller&&R.set(t,e.controller)}),U({fetchers:ee});let F=()=>j.forEach(e=>Le(e.key));_.signal.addEventListener(`abort`,F);let{loaderResults:L,fetcherResults:te}=await ke(k,j,T,w,u);if(_.signal.aborted)return;_.signal.removeEventListener(`abort`,F),ce.delete(t),R.delete(t),j.forEach(e=>R.delete(e.key));let ne=A.fetchers.has(t),re=e=>{if(!ne)return e;let n=new Map(e.fetchers);return n.set(t,un(C.data)),{...e,fetchers:n}},z=Ut(L);if(z)return A=re(A),De(T,z.result,!1,{preventScrollReset:p});if(z=Ut(te),z)return le.add(z.key),A=re(A),De(T,z.result,!1,{preventScrollReset:p});let V=new Map(A.fetchers);ne&&V.set(t,un(C.data));let{loaderData:de,errors:H}=Rt(A,D,L,void 0,j,te,V);Be(O,V),A.navigation.state===`loading`&&O>se?(h(M,`Expected pending action`),I&&I.abort(),W(A.navigation.location,{matches:D,loaderData:de,errors:H,fetchers:V})):(U({errors:H,loaderData:zt(A.loaderData,de,D,H),fetchers:V}),ie=!1)}async function Ee(t,n,i,s,c,l,u,d,f){let p=A.fetchers.get(t);K(t,cn(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=Nt(e.history,i,m.signal);if(l){let e=await ct(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){q(t,n,e.error,{flushSync:u});return}else if(e.matches)s=e.matches;else{q(t,n,J(404,{pathname:i}),{flushSync:u});return}}let g=rn(s,i);R.set(t,m);let _=oe,v=await Oe(h,i,wt(a,o,h,i,s,g,r,c),c,t),y=v[g.route.id];if(!y){for(let e of s)if(v[e.route.id]){y=v[e.route.id];break}}if(R.get(t)===m&&R.delete(t),!h.signal.aborted){if(B.has(t)){K(t,un(void 0));return}if(Xt(y))if(se>_){K(t,un(void 0));return}else{le.add(t),await De(h,y,!1,{preventScrollReset:d});return}if(Y(y)){q(t,n,y.error);return}K(t,un(y.data))}}async function De(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:l,replace:u}={}){a||(N?.resolve(),N=null),i.response.headers.has(`X-Remix-Revalidate`)&&(ie=!0);let d=i.response.headers.get(`Location`);h(d,`Expected a Location header on the redirect Response`),d=Mt(d,new URL(r.url),c,e.history);let f=y(A.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(pe(d)){let n=C(t,d,!0);e=n.origin!==t.location.origin||H(n.pathname,c)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}I=null;let p=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:m,formAction:g,formEncType:_}=A.navigation;!o&&!s&&m&&g&&_&&(o=an(A.navigation));let v=o||s;Ue.has(i.response.status)&&v&&X(v.formMethod)?await G(p,f,{submission:{...v,formAction:d},preventScrollReset:l||F,enableViewTransition:a?L:void 0}):await G(p,f,{overrideNavigation:on(f,[],p,o),fetcherSubmission:s,preventScrollReset:l||F,enableViewTransition:a?L:void 0})}async function Oe(e,t,n,r,i){let a,o={};try{a=await Tt(l,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!X(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!A.loaderData.hasOwnProperty(e.route.id)&&(!A.errors||!A.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(Yt(r)){let i=r.result;o[t]={type:`redirect`,response:kt(i,e,t,n,c)}}else o[t]=await Ot(r);return o}async function ke(e,t,n,r,i){let a=Oe(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await Oe(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}else return Promise.resolve({[e.key]:{type:`error`,error:J(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function Me(){ie=!0,ue.forEach((e,t)=>{R.has(t)&&ae.add(t),Le(t)})}function K(e,t,n={}){let r=new Map(A.fetchers);r.set(e,t),U({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function q(e,t,n,r={}){let i=Vt(A.matches,t),a=new Map(A.fetchers);Fe(a,e),U({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function Ne(e){return z.set(e,(z.get(e)||0)+1),B.has(e)&&B.delete(e),A.fetchers.get(e)||Ge}function Pe(e,t){Le(e,t?.reason),K(e,un(null))}function Fe(e,t){let n=A.fetchers.get(t);R.has(t)&&!(n&&n.state===`loading`&&ce.has(t))&&Le(t),ue.delete(t),ce.delete(t),le.delete(t),B.delete(t),ae.delete(t),e.delete(t)}function Ie(e){let t=(z.get(e)||0)-1;t<=0?(z.delete(e),B.add(e)):z.set(e,t),U({fetchers:new Map(A.fetchers)})}function Le(e,t){let n=R.get(e);n&&(n.abort(t),R.delete(e))}function Re(e,t){for(let n of e){let e=t.get(n);h(e,`Expected fetcher: ${n}`);let r=un(e.data);t.set(n,r)}}function ze(e){let t=[],n=!1;for(let r of le){let i=e.get(r);h(i,`Expected fetcher: ${r}`),i.state===`loading`&&(le.delete(r),t.push(r),n=!0)}return Re(t,e),n}function Be(e,t){let n=[];for(let[r,i]of ce)if(i<e){let e=t.get(r);h(e,`Expected fetcher: ${r}`),e.state===`loading`&&(Le(r),ce.delete(r),n.push(r))}return Re(n,t),n.length>0}function Ve(e,t){let n=A.blockers.get(e)||Ke;return V.get(e)!==t&&V.set(e,t),n}function He(e){A.blockers.delete(e),V.delete(e)}function Je(e,t){let n=A.blockers.get(e)||Ke;h(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(A.blockers);r.set(e,t),U({blockers:r})}function Ye({currentLocation:e,nextLocation:t,historyAction:n}){if(V.size===0)return;V.size>1&&g(!1,`A router only supports one blocker at a time`);let r=Array.from(V.entries()),[i,a]=r[r.length-1],o=A.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Xe(e){let t=J(404,{pathname:e}),n=s.activeRoutes,{matches:r,route:i}=Ht(n);return{notFoundMatches:r,route:i,error:t}}function Ze(e,t,n){if(m=e,v=t,_=n||null,!b&&A.navigation===We){b=!0;let e=tt(A.location,A.matches);e!=null&&U({restoreScrollPosition:e})}return()=>{m=null,v=null,_=null}}function Qe(e,t){return _&&_(e,t.map(e=>ee(e,A.loaderData)))||e.key}function $e(e,t){if(m&&v){let n=Qe(e,t);m[n]=v()}}function tt(e,t){if(m){let n=Qe(e,t),r=m[n];if(typeof r==`number`)return r}return null}function nt(t,n,r){if(e.patchRoutesOnNavigation){let e=s.branches;if(!t)return{active:!0,matches:P(n,r,c,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:P(n,r,c,!0,e)}}return{active:!1,matches:null}}async function ct(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let l=t;for(;;){let t=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:l,fetcherKey:i,patch:(e,n)=>{r.aborted||dt(e,n,s,t,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:l}}if(r.aborted)return{type:`aborted`};let u=s.branches,d=P(s.activeRoutes,n,c,!1,u),f=null;if(d&&(Object.keys(d[0].params).length===0||(f=P(s.activeRoutes,n,c,!0,u),!(f&&l.length<f.length&<(l,f.slice(0,l.length))))))return{type:`success`,matches:d};if(f||=P(s.activeRoutes,n,c,!0,u),!f||lt(l,f))return{type:`success`,matches:null};l=f}}function lt(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function ut(e){o={},s.setHmrRoutes(j(e,a,void 0,o))}function ft(e,t,n=!1){dt(e,t,s,o,a,n),s.hasHMRRoutes||U({})}return k={get basename(){return c},get future(){return u},get state(){return A},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:me,subscribe:ge,enableScrollRestoration:Ze,navigate:_e,fetch:Ce,revalidate:ve,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Ne,resetFetcher:Pe,deleteFetcher:Ie,dispose:he,getBlocker:Ve,deleteBlocker:He,patchRoutes:ft,_internalFetchControllers:R,_internalSetRoutes:ut,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){U(e)}},e.instrumentations&&(k=je(k,e.instrumentations.map(e=>e.router).filter(Boolean))),k}function nt(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function rt(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=_e(r||`.`,W(o),H(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=nn(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=fe({basename:n,pathname:c.pathname})),b(c)}function it(e,t,n){if(!n||!nt(n))return{path:t};if(n.formMethod&&!tn(n.formMethod))return{path:t,error:J(405,{method:n.formMethod})};let r=()=>({path:t,error:J(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=Wt(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!X(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}
|
|
|
`,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}else if(n.formEncType===`application/json`){if(!X(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}h(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=Ft(n.formData),s=n.formData;else if(n.body instanceof FormData)o=Ft(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=It(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=It(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(X(c.formMethod))return{path:t,submission:c};let l=x(t);return e&&l.search&&nn(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:b(l),submission:c}}function at(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){let S=b?Y(b[1])?b[1].error:b[1].data:void 0,C=i.createURL(a.location),w=i.createURL(c),T;if(u&&a.errors){let e=Object.keys(a.errors)[0];T=o.findIndex(t=>t.route.id===e)}else if(b&&Y(b[1])){let e=b[0];T=o.findIndex(t=>t.route.id===e)-1}let E=b?b[1].statusCode:void 0,D=E&&E>=400,O={currentUrl:C,currentParams:a.matches[0]?.params||{},nextUrl:w,nextParams:o[0].params,...s,actionResult:S,actionStatus:E},k=Ee(o),A=o.map((i,o)=>{let{route:s}=i,f=null;if(T!=null&&o>T)f=!1;else if(s.lazy)f=!0;else if(!ot(s))f=!1;else if(u){let{shouldLoad:e}=st(s,a.loaderData,a.errors);f=e}else ct(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return Ct(n,r,e,c,k,i,l,t,f);let p=!1;typeof x==`boolean`?p=x:D?p=!1:d||C.pathname+C.search===w.pathname+w.search?p=!0:C.search===w.search?lt(a.matches[o],i)&&(p=!0):p=!0;let m={...O,defaultShouldRevalidate:p};return Ct(n,r,e,c,k,i,l,t,ut(i,m),m,x)}),j=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,b=P(g,e.path,_??`/`,!1,y);if(!b){if(v&&m)return;j.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let S=rn(b,e.path),C=new AbortController,w=Nt(i,e.path,C.signal),T=null;if(f.has(s))f.delete(s),T=wt(n,r,w,e.path,b,S,l,t);else if(m)d&&(T=wt(n,r,w,e.path,b,S,l,t));else{let i;i=typeof x==`boolean`?x:D?!1:d;let a={...O,defaultShouldRevalidate:i};ut(S,a)&&(T=wt(n,r,w,e.path,b,S,l,t,a))}T&&j.push({key:s,routeId:e.routeId,path:e.path,matches:T,match:S,request:w,controller:C})}),{dsMatches:A,revalidatingFetchers:j}}function ot(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function st(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!ot(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function ct(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function lt(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function ut(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function dt(e,t,n,r,i,a){let o;if(e){let t=r[e];h(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n.activeRoutes;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>ft(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=j(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=j([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function ft(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>ft(e,t)))??!1:!1}var pt=new WeakMap,mt=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(h(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=pt.get(i);o||(o={},pt.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=D(e),n=i[e]!==void 0&&e!==`hasErrorBoundary`;if(t)g(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)g(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},ht=new WeakMap;function gt(e,t,n,r,i){let a=n[e.id];if(h(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=ht.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{h(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=k(e),o=a[e]!==void 0&&e!==`hasErrorBoundary`;i?g(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?g(!o,`Route "${a.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.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return ht.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=mt({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function _t(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function vt(e){return e.matches.some(e=>e.route.middleware)?yt(e,()=>_t(e)):_t(e)}function yt(e,t){return bt(e,t,e=>{if(en(e))throw e;return e},qt,n);function n(t,n,r){if(r)return Promise.resolve(Object.assign(r.value,{[n]:{type:`error`,result:t}}));{let{matches:r}=e,i=Vt(r,r[Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0))].route.id).route.id;return Promise.resolve({[i]:{type:`error`,result:t}})}}}async function bt(e,t,n,r,i){let{matches:a,...o}=e;return await xt(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function xt(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await xt(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function St(e,t,n,r,i){let a=mt({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=gt(r.route,X(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function Ct(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=St(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?ut(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?ut(a,{...l,defaultShouldRevalidate:e}):ut(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!X(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(X(n.method)||!p)?Et({request:n,path:r,pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function wt(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?Ct(e,t,n,r,Ee(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:St(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function Tt(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,url:Pt(t,n),pattern:Ee(r),params:r[0].params,context:a,matches:r},c=o?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=s;return yt(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function Et({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=X(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,url:Pt(e,t),pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a)if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw J(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}else if(t)c=await f(t);else{let t=new URL(e.url);throw J(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function Dt(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function Ot(e){let{result:t,type:n}=e;if(Qt(t)){let e;try{e=await Dt(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new we(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?Zt(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:Kt(t),statusCode:Te(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:Te(t)?t.status:void 0}:Zt(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function kt(e,t,n,r,i){let a=e.headers.get(`Location`);if(h(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!pe(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=rt(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var At=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function jt(e){try{return At.includes(new URL(e).protocol)}catch{return!1}}function Mt(e,t,n,r){if(pe(e)){let r=e,i=u.test(r)?new URL(d(r,t.protocol)):new URL(r);if(jt(i.toString()))throw Error(`Invalid redirect location`);let a=H(i.pathname,n)!=null;if(i.origin===t.origin&&a)return ve(i.pathname)+i.search+i.hash}try{if(jt(r.createURL(e).toString()))throw Error(`Invalid redirect location`)}catch{}return e}function Nt(e,t,n,r){let i=e.createURL(Wt(t)).toString(),a={signal:n};if(r&&X(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):t===`text/plain`?a.body=r.text:t===`application/x-www-form-urlencoded`&&r.formData?a.body=Ft(r.formData):a.body=r.formData}return new Request(i,a)}function Pt(e,t){let n=new URL(e.url),r=typeof t==`string`?x(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);n.search=e.size?`?${e.toString()}`:``}else n.search=``;return n.hash=r.hash||``,n}function Ft(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function It(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Lt(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&Y(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(h(!Xt(f),`Cannot handle redirect results in processLoaderData`),Y(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=Vt(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=Ye),c||(c=!0,s=Te(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function Rt(e,t,n,r,i,a,o){let{loaderData:s,errors:c}=Lt(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let s=a[n];if(h(s,`Did not find corresponding fetcher result`),Y(s)){let t=Vt(e.matches,r?.route.id);c&&c[t.route.id]||(c={...c,[t.route.id]:s.error}),o.delete(n)}else if(Xt(s))h(!1,`Unhandled fetcher revalidation redirect`);else{let e=un(s.data);o.set(n,e)}}),{loaderData:s,errors:c}}function zt(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==Ye).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function Bt(e){return e?Y(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Vt(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.hasErrorBoundary===!0)||e[0]}function Ht(e){let t=e.length===1?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 J(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new we(e||500,o,Error(s),!0)}function Ut(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(Xt(r))return{key:n,result:r}}}function Wt(e){return b({...typeof e==`string`?x(e):e,hash:``})}function Gt(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash?!0:t.hash!==``}function Kt(e){return new we(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function qt(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&Jt(t))}function Jt(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function Yt(e){return Qt(e.result)&&He.has(e.result.status)}function Y(e){return e.type===`error`}function Xt(e){return(e&&e.type)===`redirect`}function Zt(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function Qt(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function $t(e){return He.has(e)}function en(e){return Qt(e)&&$t(e.status)&&e.headers.has(`Location`)}function tn(e){return Ve.has(e.toUpperCase())}function X(e){return ze.has(e.toUpperCase())}function nn(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function rn(e,t){let n=typeof t==`string`?x(t).search:t.search;if(e[e.length-1].route.index&&nn(n||``))return e[e.length-1];let r=U(e);return r[r.length-1]}function an(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(!(!t||!n||!r)){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function on(e,t,n,r){return r?{state:`loading`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:`loading`,location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function sn(e,t,n,r){return{state:`submitting`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function cn(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function ln(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}}function un(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function dn(e,t){try{let n=e.sessionStorage.getItem(Je);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function fn(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(Je,JSON.stringify(n))}catch(e){g(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function pn(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var mn=r.createContext(null);mn.displayName=`DataRouter`;var hn=r.createContext(null);hn.displayName=`DataRouterState`;var gn=r.createContext(!1);function _n(){return r.useContext(gn)}var vn=r.createContext({isTransitioning:!1});vn.displayName=`ViewTransition`;var yn=r.createContext(new Map);yn.displayName=`Fetchers`;var bn=r.createContext(null);bn.displayName=`Await`;var Z=r.createContext(null);Z.displayName=`Navigation`;var xn=r.createContext(null);xn.displayName=`Location`;var Q=r.createContext({outlet:null,matches:[],isDataRoute:!1});Q.displayName=`Route`;var Sn=r.createContext(null);Sn.displayName=`RouteError`;var Cn=`REACT_ROUTER_ERROR`,wn=`REDIRECT`,Tn=`ROUTE_ERROR_RESPONSE`;function En(e){if(e.startsWith(`${Cn}:${wn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Dn(e){if(e.startsWith(`${Cn}:${Tn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new we(t.status,t.statusText,t.data)}catch{}}function On(e,{relative:t}={}){h(kn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:i}=r.useContext(Z),{hash:a,pathname:o,search:s}=In(e,{relative:t}),c=o;return n!==`/`&&(c=o===`/`?n:G([n,o])),i.createHref({pathname:c,search:s,hash:a})}function kn(){return r.useContext(xn)!=null}function $(){return h(kn(),`useLocation() may be used only in the context of a <Router> component.`),r.useContext(xn).location}function An(){return r.useContext(xn).navigationType}var jn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Mn(e){r.useContext(Z).static||r.useLayoutEffect(e)}function Nn(){let{isDataRoute:e}=r.useContext(Q);return e?tr():Pn()}function Pn(){h(kn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=r.useContext(mn),{basename:t,navigator:n}=r.useContext(Z),{matches:i}=r.useContext(Q),{pathname:a}=$(),o=JSON.stringify(W(i)),s=r.useRef(!1);return Mn(()=>{s.current=!0}),r.useCallback((r,i={})=>{if(g(s.current,jn),!s.current)return;if(typeof r==`number`){n.go(r);return}let c=_e(r,JSON.parse(o),a,i.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:G([t,c.pathname])),(i.replace?n.replace:n.push)(c,i.state,i)},[t,n,o,a,e])}r.createContext(null);function Fn(){let{matches:e}=r.useContext(Q);return e[e.length-1]?.params??{}}function In(e,{relative:t}={}){let{matches:n}=r.useContext(Q),{pathname:i}=$(),a=JSON.stringify(W(n));return r.useMemo(()=>_e(e,JSON.parse(a),i,t===`path`),[e,a,i,t])}function Ln(e,t){return Rn(e,t)}function Rn(e,t,n){h(kn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:i}=r.useContext(Z),{matches:a}=r.useContext(Q),o=a[a.length-1],s=o?o.params:{},c=o?o.pathname:`/`,l=o?o.pathnameBase:`/`,u=o&&o.route;{let e=u&&u.path||``;rr(c,!u||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
|
|
|
|
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let d=$(),f;if(t){let e=typeof t==`string`?x(t):t;h(l===`/`||e.pathname?.startsWith(l),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${e.pathname}" was given in the \`location\` prop.`),f=e}else f=d;let p=f.pathname||`/`,m=p;if(l!==`/`){let e=l.replace(/^\//,``).split(`/`);m=`/`+p.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let _=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):N(e,{pathname:m});g(u||_!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),g(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=Gn(_&&_.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:G([l,i.encodeLocation?i.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?l:G([l,i.encodeLocation?i.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),a,n);return t&&v?r.createElement(xn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...f},navigationType:`POP`}},v):v}function zn(){let e=er(),t=Te(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i=`rgba(200,200,200, 0.5)`,a={padding:`0.5rem`,backgroundColor:i},o={padding:`2px 4px`,backgroundColor:i},s=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),s=r.createElement(r.Fragment,null,r.createElement(`p`,null,`💿 Hey developer 👋`),r.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,r.createElement(`code`,{style:o},`ErrorBoundary`),` or`,` `,r.createElement(`code`,{style:o},`errorElement`),` prop on your route.`)),r.createElement(r.Fragment,null,r.createElement(`h2`,null,`Unexpected Application Error!`),r.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?r.createElement(`pre`,{style:a},n):null,s)}var Bn=r.createElement(zn,null),Vn=class extends r.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Dn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:r.createElement(Q.Provider,{value:this.props.routeContext},r.createElement(Sn.Provider,{value:e,children:this.props.component}));return this.context?r.createElement(Un,{error:e},t):t}};Vn.contextType=gn;var Hn=new WeakMap;function Un({children:e,error:t}){let{basename:n}=r.useContext(Z);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=En(t.digest);if(e){let i=Hn.get(t);if(i)throw i;let a=Oe(e.location,n),o=a.absoluteURL||a.to;if(jt(o))throw Error(`Invalid redirect location`);if(De&&!Hn.get(t))if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw Hn.set(t,n),n}return r.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function Wn({routeContext:e,match:t,children:n}){let i=r.useContext(mn);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),r.createElement(Q.Provider,{value:e},n)}function Gn(e,t=[],n){let i=n?.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let a=e,o=i?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);h(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n&&i){s=i.renderFallback;for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:r}=i,o=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||r[t.route.id]===void 0);if(t.route.lazy||o){n.isStatic&&(s=!0),a=c>=0?a.slice(0,c+1):[a[0]];break}}}}let l=n?.onError,u=i&&l?(e,t)=>{l(e,{location:i.location,params:i.matches?.[0]?.params??{},pattern:Ee(i.matches),errorInfo:t})}:void 0;return a.reduceRight((e,n,l)=>{let d,f=!1,p=null,m=null;i&&(d=o&&n.route.id?o[n.route.id]:void 0,p=n.route.errorElement||Bn,s&&(c<0&&l===0?(rr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):c===l&&(f=!0,m=n.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,l+1)),g=()=>{let t;return t=d?p:f?m:n.route.Component?r.createElement(n.route.Component,null):n.route.element?n.route.element:e,r.createElement(Wn,{match:n,routeContext:{outlet:e,matches:h,isDataRoute:i!=null},children:t})};return i&&(n.route.ErrorBoundary||n.route.errorElement||l===0)?r.createElement(Vn,{location:i.location,revalidation:i.revalidation,component:p,error:d,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:u}):g()},null)}function Kn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function qn(e){let t=r.useContext(mn);return h(t,Kn(e)),t}function Jn(e){let t=r.useContext(hn);return h(t,Kn(e)),t}function Yn(e){let t=r.useContext(Q);return h(t,Kn(e)),t}function Xn(e){let t=Yn(e),n=t.matches[t.matches.length-1];return h(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Zn(){return Xn(`useRouteId`)}function Qn(){let e=Jn(`useNavigation`);return r.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function $n(){let{matches:e,loaderData:t}=Jn(`useMatches`);return r.useMemo(()=>e.map(e=>ee(e,t)),[e,t])}function er(){let e=r.useContext(Sn),t=Jn(`useRouteError`),n=Xn(`useRouteError`);return e===void 0?t.errors?.[n]:e}function tr(){let{router:e}=qn(`useNavigate`),t=Xn(`useNavigate`),n=r.useRef(!1);return Mn(()=>{n.current=!0}),r.useCallback(async(r,i={})=>{g(n.current,jn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var nr={};function rr(e,t,n){!t&&!nr[e]&&(nr[e]=!0,g(!1,n))}var ir={};function ar(e,t){!e&&!ir[t]&&(ir[t]=!0,console.warn(t))}var or=r.useOptimistic,sr=()=>void 0;function cr(e){return or?or(e):[e,sr]}function lr(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&g(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:r.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&g(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:r.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&g(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:r.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var ur=[`HydrateFallback`,`hydrateFallbackElement`],dr=class{constructor(){this.status=`pending`,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function fr({router:e,flushSync:t,onError:n,useTransitions:i}){i=_n()||i;let[a,o]=r.useState(e.state),[s,c]=cr(a),[l,u]=r.useState(),[d,f]=r.useState({isTransitioning:!1}),[p,m]=r.useState(),[h,g]=r.useState(),[_,v]=r.useState(),y=r.useRef(new Map),b=r.useCallback((a,{deletedFetchers:s,newErrors:l,flushSync:d,viewTransitionOpts:_})=>{l&&n&&Object.values(l).forEach(e=>n(e,{location:a.location,params:a.matches[0]?.params??{},pattern:Ee(a.matches)})),a.fetchers.forEach((e,t)=>{e.data!==void 0&&y.current.set(t,e.data)}),s.forEach(e=>y.current.delete(e)),ar(d===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let b=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(ar(_==null||b,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!_||!b){t&&d?t(()=>o(a)):i===!1?o(a):r.startTransition(()=>{i===!0&&c(e=>pr(e,a)),o(a)});return}if(t&&d){t(()=>{h&&(p?.resolve(),h.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:_.currentLocation,nextLocation:_.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>o(a))});n.finished.finally(()=>{t(()=>{m(void 0),g(void 0),u(void 0),f({isTransitioning:!1})})}),t(()=>g(n));return}h?(p?.resolve(),h.skipTransition(),v({state:a,currentLocation:_.currentLocation,nextLocation:_.nextLocation})):(u(a),f({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}))},[e.window,t,h,p,i,c,n]);r.useLayoutEffect(()=>e.subscribe(b),[e,b]),r.useEffect(()=>{d.isTransitioning&&!d.flushSync&&m(new dr)},[d]),r.useEffect(()=>{if(p&&l&&e.window){let t=l,n=p.promise,a=e.window.document.startViewTransition(async()=>{i===!1?o(t):r.startTransition(()=>{i===!0&&c(e=>pr(e,t)),o(t)}),await n});a.finished.finally(()=>{m(void 0),g(void 0),u(void 0),f({isTransitioning:!1})}),g(a)}},[l,p,e.window,i,c]),r.useEffect(()=>{p&&l&&s.location.key===l.location.key&&p.resolve()},[p,h,s.location,l]),r.useEffect(()=>{!d.isTransitioning&&_&&(u(_.state),f({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}),v(void 0))},[d.isTransitioning,_]);let x=r.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),S=e.basename||`/`,C=r.useMemo(()=>({router:e,navigator:x,static:!1,basename:S,onError:n}),[e,x,S,n]);return r.createElement(r.Fragment,null,r.createElement(mn.Provider,{value:C},r.createElement(hn.Provider,{value:s},r.createElement(yn.Provider,{value:y.current},r.createElement(vn.Provider,{value:d},r.createElement(vr,{basename:S,location:s.location,navigationType:s.historyAction,navigator:x,useTransitions:i},r.createElement(mr,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:n})))))),null)}function pr(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var mr=r.memo(hr);function hr({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Rn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function gr({to:e,replace:t,state:n,relative:i}){h(kn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:a}=r.useContext(Z);g(!a,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=r.useContext(Q),{pathname:s}=$(),c=Nn(),l=_e(e,W(o),s,i===`path`),u=JSON.stringify(l);return r.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:i})},[c,u,i,t,n]),null}function _r(e){h(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function vr({basename:e=`/`,children:t=null,location:n,navigationType:i=`POP`,navigator:a,static:o=!1,useTransitions:s}){h(!kn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let c=e.replace(/^\/*/,`/`),l=r.useMemo(()=>({basename:c,navigator:a,static:o,useTransitions:s,future:{}}),[c,a,o,s]);typeof n==`string`&&(n=x(n));let{pathname:u=`/`,search:d=``,hash:f=``,state:p=null,key:m=`default`,mask:_}=n,v=r.useMemo(()=>{let e=H(u,c);return e==null?null:{location:{pathname:e,search:d,hash:f,state:p,key:m,mask:_},navigationType:i}},[c,u,d,f,p,m,i,_]);return g(v!=null,`<Router basename="${c}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:r.createElement(Z.Provider,{value:l},r.createElement(xn.Provider,{children:t,value:v}))}function yr({children:e,location:t}){return Ln(br(e),t)}r.Component;function br(e,t=[]){let n=[];return r.Children.forEach(e,(e,i)=>{if(!r.isValidElement(e))return;let a=[...t,i];if(e.type===r.Fragment){n.push.apply(n,br(e.props.children,a));return}h(e.type===_r,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),h(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let o={id:e.props.id||a.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(o.children=br(e.props.children,a)),n.push(o)}),n}var xr=`get`,Sr=`application/x-www-form-urlencoded`;function Cr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function wr(e){return Cr(e)&&e.tagName.toLowerCase()===`button`}function Tr(e){return Cr(e)&&e.tagName.toLowerCase()===`form`}function Er(e){return Cr(e)&&e.tagName.toLowerCase()===`input`}function Dr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Or(e,t){return e.button===0&&(!t||t===`_self`)&&!Dr(e)}var kr=null;function Ar(){if(kr===null)try{new FormData(document.createElement(`form`),0),kr=!1}catch{kr=!0}return kr}var jr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Mr(e){return e!=null&&!jr.has(e)?(g(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Sr}"`),null):e}function Nr(e,t){let n,r,i,a,o;if(Tr(e)){let o=e.getAttribute(`action`);r=o?H(o,t):null,n=e.getAttribute(`method`)||xr,i=Mr(e.getAttribute(`enctype`))||Sr,a=new FormData(e)}else if(wr(e)||Er(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?H(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||xr,i=Mr(e.getAttribute(`formenctype`))||Mr(o.getAttribute(`enctype`))||Sr,a=new FormData(o,e),!Ar()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Cr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=xr,r=null,i=Sr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Pr={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Fr=/[&><\u2028\u2029]/g;function Ir(e){return e.replace(Fr,e=>Pr[e])}function Lr(e,t){if(e===!1||e==null)throw Error(t)}function Rr(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&H(i.pathname,t)===`/`?i.pathname=`${ye(t)}/_root.${r}`:i.pathname=`${ye(i.pathname)}.${r}`,i}async function zr(e,t){if(e.id in t)return t[e.id];try{let r=await n(()=>import(e.module),[],import.meta.url);return t[e.id]=r,r}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Br(e){return e!=null&&typeof e.page==`string`}function Vr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Hr(e,t,n){return qr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await zr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Vr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Ur(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Wr(e,t,{includeHydrateFallback:n}={}){return Gr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Gr(e){return[...new Set(e)]}function Kr(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function qr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Br(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Kr(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Jr(){let e=r.useContext(mn);return Lr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Yr(){let e=r.useContext(hn);return Lr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Xr=r.createContext(void 0);Xr.displayName=`FrameworkContext`;function Zr(){let e=r.useContext(Xr);return Lr(e,`You must render this element inside a <HydratedRouter> element`),e}function Qr(e,t){let n=r.useContext(Xr),[i,a]=r.useState(!1),[o,s]=r.useState(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=r.useRef(null);r.useEffect(()=>{if(e===`render`&&s(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{s(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),r.useEffect(()=>{if(i){let e=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(e)}}},[i]);let m=()=>{a(!0)},h=()=>{a(!1),s(!1)};return n?e===`intent`?[o,p,{onFocus:$r(c,m),onBlur:$r(l,h),onMouseEnter:$r(u,m),onMouseLeave:$r(d,h),onTouchStart:$r(f,m)}]:[o,p,{}]:[!1,p,{}]}function $r(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function ei({page:e,...t}){let n=_n(),{nonce:i}=Zr(),{router:a}=Jr(),o=r.useMemo(()=>N(a.routes,e,a.basename),[a.routes,e,a.basename]);return o?(t.nonce==null&&i&&(t={...t,nonce:i}),n?r.createElement(ni,{page:e,matches:o,...t}):r.createElement(ri,{page:e,matches:o,...t})):null}function ti(e){let{manifest:t,routeModules:n}=Zr(),[i,a]=r.useState([]);return r.useEffect(()=>{let r=!1;return Hr(e,t,n).then(e=>{r||a(e)}),()=>{r=!0}},[e,t,n]),i}function ni({page:e,matches:t,...n}){let i=$(),{future:a}=Zr(),{basename:o}=Jr(),s=r.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let n=Rr(e,o,a.v8_trailingSlashAwareDataRequests,`rsc`),r=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?r=!0:s.push(e.route.id);return r&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[o,a.v8_trailingSlashAwareDataRequests,e,i,t]);return r.createElement(r.Fragment,null,s.map(e=>r.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function ri({page:e,matches:t,...n}){let i=$(),{future:a,manifest:o,routeModules:s}=Zr(),{basename:c}=Jr(),{loaderData:l,matches:u}=Yr(),d=r.useMemo(()=>Ur(e,t,u,o,i,`data`),[e,t,u,o,i]),f=r.useMemo(()=>Ur(e,t,u,o,i,`assets`),[e,t,u,o,i]),p=r.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let n=new Set,r=!1;if(t.forEach(e=>{let t=o.routes[e.route.id];!t||!t.hasLoader||(!d.some(t=>t.route.id===e.route.id)&&e.route.id in l&&s[e.route.id]?.shouldRevalidate||t.hasClientLoader?r=!0:n.add(e.route.id))}),n.size===0)return[];let u=Rr(e,c,a.v8_trailingSlashAwareDataRequests,`data`);return r&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[c,a.v8_trailingSlashAwareDataRequests,l,i,o,d,t,e,s]),m=r.useMemo(()=>Wr(f,o),[f,o]),h=ti(f);return r.createElement(r.Fragment,null,p.map(e=>r.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>r.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>r.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function ii(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}r.Component;var ai=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{ai&&(window.__reactRouterVersion=`7.18.0`)}catch{}function oi(e,t){return tt({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:m({window:t?.window}),hydrationData:t?.hydrationData||si(),routes:e,mapRouteProperties:lr,hydrationRouteProperties:ur,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function si(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:ci(e.errors)}),e}function ci(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new we(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&Ce.includes(r.__subType)){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}function li({basename:e,children:t,history:n,useTransitions:i}){let[a,o]=r.useState({action:n.action,location:n.location}),s=r.useCallback(e=>{i===!1?o(e):r.startTransition(()=>o(e))},[i]);return r.useLayoutEffect(()=>n.listen(s),[n,s]),r.createElement(vr,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:n,useTransitions:i})}li.displayName=`unstable_HistoryRouter`;var ui=r.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:i,reloadDocument:a,replace:o,mask:s,state:c,target:u,to:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g){let{basename:_,navigator:v,useTransitions:y}=r.useContext(Z),b=typeof d==`string`&&l.test(d),x=Oe(d,_);d=x.to;let S=On(d,{relative:i}),C=$(),w=null;if(s){let e=_e(s,[],C.mask?C.mask.pathname:`/`,!0);_!==`/`&&(e.pathname=e.pathname===`/`?_:G([_,e.pathname])),w=v.createHref(e)}let[T,E,D]=Qr(n,h),O=_i(d,{replace:o,mask:s,state:c,target:u,preventScrollReset:f,relative:i,viewTransition:p,defaultShouldRevalidate:m,useTransitions:y});function k(t){e&&e(t),t.defaultPrevented||O(t)}let A=!(x.isExternal||a),j=r.createElement(`a`,{...h,...D,href:(A?w:void 0)||x.absoluteURL||S,onClick:A?k:e,ref:ii(g,E),target:u,"data-discover":!b&&t===`render`?`true`:void 0});return T&&!b?r.createElement(r.Fragment,null,j,r.createElement(ei,{page:S})):j});ui.displayName=`Link`;var di=r.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:i=!1,style:a,to:o,viewTransition:s,children:c,...l},u){let d=In(o,{relative:l.relative}),f=$(),p=r.useContext(hn),{navigator:m,basename:h}=r.useContext(Z),g=p!=null&&Di(d)&&s===!0,_=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=H(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!i&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!i&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let E=typeof a==`function`?a(C):a;return r.createElement(ui,{...l,"aria-current":w,className:T,ref:u,style:E,to:o,viewTransition:s},typeof c==`function`?c(C):c)});di.displayName=`NavLink`;var fi=r.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:i,replace:a,state:o,method:s=xr,action:c,onSubmit:u,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g)=>{let{useTransitions:_}=r.useContext(Z),v=bi(),y=xi(c,{relative:d}),b=s.toLowerCase()===`get`?`get`:`post`,x=typeof c==`string`&&l.test(c);return r.createElement(`form`,{ref:g,method:b,action:y,onSubmit:i?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let i=e.nativeEvent.submitter,c=i?.getAttribute(`formmethod`)||s,l=()=>v(i||e.currentTarget,{fetcherKey:t,method:c,navigate:n,replace:a,state:o,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m});_&&n!==!1?r.startTransition(()=>l()):l()},...h,"data-discover":!x&&e===`render`?`true`:void 0})});fi.displayName=`Form`;function pi({getKey:e,storageKey:t,...n}){let i=r.useContext(Xr),{basename:a}=r.useContext(Z),o=$(),s=$n();Ti({getKey:e,storageKey:t});let c=r.useMemo(()=>{if(!i||!e)return null;let t=wi(o,s,a,e);return t===o.key?null:t},[]);if(!i||i.isSpaMode)return null;let l=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&i?.nonce&&(n.nonce=i.nonce),r.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${l})(${Ir(JSON.stringify(t||Si))}, ${Ir(JSON.stringify(c))})`}})}pi.displayName=`ScrollRestoration`;function mi(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hi(e){let t=r.useContext(mn);return h(t,mi(e)),t}function gi(e){let t=r.useContext(hn);return h(t,mi(e)),t}function _i(e,{target:t,replace:n,mask:i,state:a,preventScrollReset:o,relative:s,viewTransition:c,defaultShouldRevalidate:l,useTransitions:u}={}){let d=Nn(),f=$(),p=In(e,{relative:s});return r.useCallback(m=>{if(Or(m,t)){m.preventDefault();let t=n===void 0?b(f)===b(p):n,h=()=>d(e,{replace:t,mask:i,state:a,preventScrollReset:o,relative:s,viewTransition:c,defaultShouldRevalidate:l});u?r.startTransition(()=>h()):h()}},[f,d,p,n,i,a,t,e,o,s,c,l,u])}var vi=0,yi=()=>`__${String(++vi)}__`;function bi(){let{router:e}=hi(`useSubmit`),{basename:t}=r.useContext(Z),n=Zn(),i=e.fetch,a=e.navigate;return r.useCallback(async(e,r={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Nr(e,t);r.navigate===!1?await i(r.fetcherKey||yi(),n,r.action||o,{defaultShouldRevalidate:r.defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:l,body:u,formMethod:r.method||s,formEncType:r.encType||c,flushSync:r.flushSync}):await a(r.action||o,{defaultShouldRevalidate:r.defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:l,body:u,formMethod:r.method||s,formEncType:r.encType||c,replace:r.replace,state:r.state,fromRouteId:n,flushSync:r.flushSync,viewTransition:r.viewTransition})},[i,a,t,n])}function xi(e,{relative:t}={}){let{basename:n}=r.useContext(Z),i=r.useContext(Q);h(i,`useFormAction must be used inside a RouteContext`);let[a]=i.matches.slice(-1),o={...In(e||`.`,{relative:t})},s=$();if(e==null){o.search=s.search;let e=new URLSearchParams(o.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();o.search=n?`?${n}`:``}}return(!e||e===`.`)&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(o.pathname=o.pathname===`/`?n:G([n,o.pathname])),b(o)}var Si=`react-router-scroll-positions`,Ci={};function wi(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:H(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Ti({getKey:e,storageKey:t}={}){let{router:n}=hi(`useScrollRestoration`),{restoreScrollPosition:i,preventScrollReset:a}=gi(`useScrollRestoration`),{basename:o}=r.useContext(Z),s=$(),c=$n(),l=Qn();r.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Ei(r.useCallback(()=>{if(l.state===`idle`){let t=wi(s,c,o,e);Ci[t]=window.scrollY}try{sessionStorage.setItem(t||Si,JSON.stringify(Ci))}catch(e){g(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[l.state,e,o,s,c,t])),typeof document<`u`&&(r.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Si);e&&(Ci=JSON.parse(e))}catch{}},[t]),r.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Ci,()=>window.scrollY,e?(t,n)=>wi(t,n,o,e):void 0);return()=>t&&t()},[n,o,e]),r.useLayoutEffect(()=>{if(i!==!1){if(typeof i==`number`){window.scrollTo(0,i);return}try{if(s.hash){let e=document.getElementById(decodeURIComponent(s.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{g(!1,`"${s.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}a!==!0&&window.scrollTo(0,0)}},[s,i,a]))}function Ei(e,t){let{capture:n}=t||{};r.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Di(e,{relative:t}={}){let n=r.useContext(vn);h(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=hi(`useViewTransitionState`),a=In(e,{relative:t});if(!n.isTransitioning)return!1;let o=H(n.currentLocation.pathname,i)||n.currentLocation.pathname,s=H(n.nextLocation.pathname,i)||n.nextLocation.pathname;return z(a.pathname,s)!=null||z(a.pathname,o)!=null}export{yr as a,Nn as c,fr as i,An as l,gr as n,oi as o,_r as r,$ as s,ui as t,Fn as u};
|