@accounter/client
Version:
Accounter client application
2 lines • 98.7 kB
JavaScript
import{s as e}from"./dist-C51EwTaa.js";import{o as t}from"./utils-DdVdMk8X.js";var n=e(t(),1),r=`modulepreload`,i=function(e){return`/`+e},a={},o=function(e,t,n){let o=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),s=document.querySelector(`meta[property=csp-nonce]`),c=s?.nonce||s?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}o=l(t.map(t=>{if(t=i(t,n),t in a)return;a[t]=!0;let o=t.endsWith(`.css`),s=o?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.href===t&&(!o||r.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${s}`))return;let l=document.createElement(`link`);if(l.rel=o?`stylesheet`:r,o||(l.as=`script`),l.crossOrigin=``,l.href=t,c&&l.setAttribute(`nonce`,c),document.head.appendChild(l),o)return new Promise((e,n)=>{l.addEventListener(`load`,e),l.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function s(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(t=>{for(let e of t||[])e.status===`rejected`&&s(e.reason);return e().catch(s)})},s=e=>{throw TypeError(e)},c=(e,t,n)=>t.has(e)||s(`Cannot `+n),l=(e,t,n)=>(c(e,t,`read from private field`),n?n.call(e):t.get(e)),u=(e,t,n)=>t.has(e)?s(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),d=(e,t,n,r)=>(c(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),f=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,p=/^[\\/]{2}/;function m(e,t){return t+e.replace(/\\/g,`/`)}var h=`popstate`;function g(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function _(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return S(``,{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:C(t)}return T(t,n,null,e)}function v(e,t){if(e===!1||e==null)throw Error(t)}function y(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function b(){return Math.random().toString(36).substring(2,10)}function x(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 S(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?w(t):t,state:n,key:t&&t.key||r||b(),mask:i}}function C({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 w(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 T(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 f(e,t){s=`PUSH`;let r=g(e)?e:S(_.location,e,t);n&&n(r,e),l=u()+1;let d=x(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 p(e,t){s=`REPLACE`;let r=g(e)?e:S(_.location,e,t);n&&n(r,e),l=u();let i=x(r,l),d=_.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:_.location,delta:0})}function m(e){return ee(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(h,d),c=e,()=>{i.removeEventListener(h,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return _}function ee(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),v(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:C(t);return i=i.replace(/ $/,`%20`),!n&&p.test(i)&&(i=r+i),new URL(i,r)}function E(e){return{defaultValue:e}}var D,O=class{constructor(e){if(u(this,D,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(l(this,D).has(e))return l(this,D).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){l(this,D).set(e,t)}};D=new WeakMap;var k=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function A(e){return k.has(e)}var j=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function te(e){return j.has(e)}function M(e){return e.index===!0}function ne(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(v(e.index!==!0||!e.children,`Cannot specify children on an index route`),v(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),M(e)){let n={...e,id:s};return r[s]=N(n,t(n)),n}else{let n={...e,id:s,children:void 0};return r[s]=N(n,t(n)),e.children&&(n.children=ne(e.children,t,o,r,i)),n}})}function N(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function P(e,t,n=`/`){return F(e,t,n,!1)}function F(e,t,n,r,i){let a=V((typeof t==`string`?w(t):t).pathname||`/`,n);if(a==null)return null;let o=i??ie(e),s=null,c=ge(a);for(let e=0;s==null&&e<o.length;++e)s=pe(o[e],c,r);return s}function re(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 ie(e){let t=ae(e);return se(t),t}function ae(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;v(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=U([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(v(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),ae(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:R(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=he(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 oe(e.path))a(e,t,!0,n)}),t}function oe(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=oe(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 se(e){e.sort((e,t)=>e.score===t.score?z(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var I=/^:[\w-]+$/,ce=3,le=2,ue=1,de=10,fe=-2,L=e=>e===`*`;function R(e,t){let n=e.split(`/`),r=n.length;return n.some(L)&&(r+=fe),t&&(r+=le),n.filter(e=>!L(e)).reduce((e,t)=>e+(I.test(t)?ce:t===``?ue:de),r)}function z(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 pe(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?me(u,l,s.matcher,s.compiledParams):B(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=B({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:U([a,d.pathname]),pathnameBase:Ee(U([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=U([a,d.pathnameBase]))}return o}function B(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=he(e.path,e.caseSensitive,e.end);return me(e,t,n,r)}function me(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 he(e,t=!1,n=!0){y(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 ge(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return y(!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 V(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 H({basename:e,pathname:t}){return t===`/`?e:U([e,t])}var _e=e=>f.test(e);function ve(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?w(e):e,a;return n?(n=we(n),a=n.startsWith(`/`)?ye(n.substring(1),`/`):ye(n,t)):a=t,{pathname:a,search:De(r),hash:Oe(i)}}function ye(e,t){let n=Te(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function be(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 xe(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Se(e){let t=xe(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Ce(e,t,n,r=!1){let i;typeof e==`string`?i=w(e):(i={...e},v(!i.pathname||!i.pathname.includes(`?`),be(`?`,`pathname`,`search`,i)),v(!i.pathname||!i.pathname.includes(`#`),be(`#`,`pathname`,`hash`,i)),v(!i.search||!i.search.includes(`#`),be(`#`,`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=ve(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var we=e=>e.replace(/[\\/]{2,}/g,`/`),U=e=>we(e.join(`/`)),Te=e=>e.replace(/\/+$/,``),Ee=e=>Te(e).replace(/^\/*/,`/`),De=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Oe=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,ke=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],Ae=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 je(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Me(e){return U(e.map(e=>e.route.path).filter(Boolean))||`/`}var W=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function G(e,t){let n=e;if(typeof n!=`string`||!f.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(W)try{let e=new URL(window.location.href),r=p.test(n)?new URL(m(n,e.protocol)):new URL(n),a=V(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{y(!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 Ne=Symbol(`Uninstrumented`);function Pe(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=Ie(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=Ie(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[Ne]??i,a=Ie(n[e],t,(...e)=>Re(e[0]));a&&(e===`loader`&&t.hydrate===!0&&(a.hydrate=!0),a[Ne]=t,r[e]=a)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=e[Ne]??e,r=Ie(n.middleware,t,(...e)=>Re(e[0]));return r?(r[Ne]=t,r):e})),r}function Fe(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[Ne]??e.navigate,r=Ie(n.navigate,t,(...t)=>{let[n,r]=t;return{to:typeof n==`number`||typeof n==`string`?n:n?C(n):`.`,...K(e,r??{})}});r&&(r[Ne]=t,e.navigate=r)}if(n.fetch.length>0){let t=e.fetch[Ne]??e.fetch,r=Ie(n.fetch,t,(...t)=>{let[n,,r,i]=t;return{href:r??`.`,fetcherKey:n,...K(e,i??{})}});r&&(r[Ne]=t,e.fetch=r)}return e}function Ie(e,t,n){return e.length===0?null:async(...r)=>{let i=await Le(e,n(...r),()=>t(...r),e.length-1);if(i.type===`error`)throw i.value;return i.value}}async function Le(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=Le(e,t,n,r-1),a=await o,v(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 Re(e){let{request:t,context:n,params:r,pattern:i}=e;return{request:ze(t),params:{...r},pattern:i,context:Be(n)}}function K(e,t){return{currentUrl:C(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 ze(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function Be(e){if(He(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var Ve=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function He(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`)===Ve}var Ue=[`POST`,`PUT`,`PATCH`,`DELETE`],We=new Set(Ue),Ge=[`GET`,...Ue],Ke=new Set(Ge),qe=new Set([301,302,303,307,308]),Je=new Set([307,308]),Ye={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},Xe={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ze={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},Qe=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),$e=`remix-router-transitions`,et=Symbol(`ResetLoaderData`),tt,nt,q,rt,it=class{constructor(e){u(this,tt),u(this,nt),u(this,q),u(this,rt),d(this,tt,e),d(this,nt,ie(e))}get stableRoutes(){return l(this,tt)}get activeRoutes(){return l(this,q)??l(this,tt)}get branches(){return l(this,rt)??l(this,nt)}get hasHMRRoutes(){return l(this,q)!=null}setRoutes(e){d(this,tt,e),d(this,nt,ie(e))}setHmrRoutes(e){d(this,q,e),d(this,rt,ie(e))}commitHmrRoutes(){l(this,q)&&(d(this,tt,l(this,q)),d(this,nt,l(this,rt)),d(this,q,void 0),d(this,rt,void 0))}};tt=new WeakMap,nt=new WeakMap,q=new WeakMap,rt=new WeakMap;function at(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;v(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),...Pe(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=new it(ne(e.routes,a,void 0,o)),c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||St,u={...e.future},d=null,f=new Set,p=null,m=null,h=null,g=null,_=e.hydrationData!=null,b=F(s.activeRoutes,e.history.location,c,!1,s.branches),x=!1,C=null,T,E;if(b==null&&!e.patchRoutesOnNavigation){let t=J(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=Kt(s.activeRoutes);T=!0,E=!T,b=n,C={[r.id]:t}}else if(b&&!e.hydrationData&&nt(b,s.activeRoutes,e.history.location.pathname).active&&(b=null),!b){T=!1,E=!T,b=[];let t=nt(null,s.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(x=!0,b=t.matches)}else if(b.some(e=>e.route.lazy))T=!1,E=!T;else if(!b.some(e=>ut(e.route)))T=!0,E=!T;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=b;if(n){let e=b.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}E=!1,T=!0,r.forEach(e=>{let r=dt(e.route,t,n);E||=r.renderFallback,T&&=!r.shouldLoad})}let D,k={historyAction:e.history.action,location:e.history.location,matches:b,initialized:T,renderFallback:E,navigation:Ye,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||C,fetchers:new Map,blockers:new Map},A=`POP`,j=null,te=!1,M,N=!1,P=new Map,ie=null,ae=!1,oe=!1,se=new Set,I=new Map,ce=0,le=-1,ue=new Map,de=new Set,fe=new Map,L=new Map,R=new Set,z=new Map,pe,B=null;function me(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(pe){pe(),pe=void 0;return}y(z.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=Ge({currentLocation:k.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{pe=e});e.history.go(r*-1),We(i,{state:`blocked`,location:n,proceed(){We(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(k.blockers);e.set(i,Ze),H({blockers:e})}}),j?.resolve(),j=null;return}return xe(t,n)}),n){hn(t,P);let e=()=>gn(t,P);t.addEventListener(`pagehide`,e),ie=()=>t.removeEventListener(`pagehide`,e)}return k.initialized||xe(`POP`,k.location,{initialHydration:!0}),D}function he(){d&&d(),ie&&ie(),f.clear(),M&&M.abort(),k.fetchers.forEach((e,t)=>Le(k.fetchers,t)),k.blockers.forEach((e,t)=>Ue(t))}function ge(e){if(f.add(e),p){let{newErrors:t}=p;p=null,e(k,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>f.delete(e)}function H(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}),k={...k,...e};let n=[],r=[];k.fetchers.forEach((e,t)=>{e.state===`idle`&&(R.has(t)?n.push(t):r.push(t))}),R.forEach(e=>{!k.fetchers.has(e)&&!I.has(e)&&n.push(e)}),f.size===0&&(p={newErrors:e.errors??null}),[...f].forEach(r=>r(k,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>Le(k.fetchers,e)),r.forEach(e=>k.fetchers.delete(e))}function ve(t,n,{flushSync:r}={}){let i=k.actionData!=null&&k.navigation.formMethod!=null&&X(k.navigation.formMethod)&&k.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?k.actionData:null;let o=n.loaderData?Ut(k.loaderData,n.loaderData,n.matches||[],n.errors):k.loaderData,c=k.blockers;c.size>0&&(c=new Map(c),c.forEach((e,t)=>c.set(t,Ze)));let l=ae?!1:tt(t,n.matches||k.matches),u=te===!0||k.navigation.formMethod!=null&&X(k.navigation.formMethod)&&t.state?._isRedirect!==!0;s.commitHmrRoutes(),ae||A===`POP`||(A===`PUSH`?e.history.push(t,t.state):A===`REPLACE`&&e.history.replace(t,t.state));let d;if(A===`POP`){let e=P.get(k.location.pathname);e&&e.has(t.pathname)?d={currentLocation:k.location,nextLocation:t}:P.has(t.pathname)&&(d={currentLocation:t,nextLocation:k.location})}else if(N){let e=P.get(k.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),P.set(k.location.pathname,e)),d={currentLocation:k.location,nextLocation:t}}H({...n,actionData:a,loaderData:o,historyAction:A,location:t,initialized:!0,renderFallback:!1,navigation:Ye,revalidation:`idle`,restoreScrollPosition:l,preventScrollReset:u,blockers:c},{viewTransitionOpts:d,flushSync:r===!0}),A=`POP`,te=!1,N=!1,ae=!1,oe=!1,j?.resolve(),j=null,B?.resolve(),B=null}async function ye(t,n){if(j?.resolve(),j=null,typeof t==`number`){j||=_n();let n=j.promise;return e.history.go(t),n}let{path:r,submission:i,error:a}=ct(!1,st(k.location,k.matches,c,t,n?.fromRouteId,n?.relative),n),o;n?.mask&&(o={pathname:``,search:``,hash:``,...typeof n.mask==`string`?w(n.mask):{...k.location.mask,...n.mask}});let s=k.location,l=S(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===k.location.pathname+k.location.search&&(d=`REPLACE`);let f=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,p=(n&&n.flushSync)===!0,m=Ge({currentLocation:s,nextLocation:l,historyAction:d});if(m){We(m,{state:`blocked`,location:l,proceed(){We(m,{state:`proceeding`,proceed:void 0,reset:void 0,location:l}),ye(t,n)},reset(){let e=new Map(k.blockers);e.set(m,Ze),H({blockers:e})}});return}await xe(d,l,{submission:i,pendingError:a,preventScrollReset:f,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:p,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate})}function be(){B||=_n(),Me(),H({revalidation:`loading`});let e=B.promise;return k.navigation.state===`submitting`?e:k.navigation.state===`idle`?(xe(k.historyAction,k.location,{startUninterruptedRevalidation:!0}),e):(xe(A||k.historyAction,k.navigation.location,{overrideNavigation:k.navigation,enableViewTransition:N===!0}),e)}async function xe(t,n,r){M&&M.abort(),M=null,A=t,ae=(r&&r.startUninterruptedRevalidation)===!0,et(k.location,k.matches),te=(r&&r.preventScrollReset)===!0,N=(r&&r.enableViewTransition)===!0;let i=s.activeRoutes,a=r?.initialHydration&&k.matches&&k.matches.length>0&&!x?k.matches:F(i,n,c,!1,s.branches),o=(r&&r.flushSync)===!0;if(a&&k.initialized&&!oe&&Yt(k.location,n)&&!(r&&r.submission&&X(r.submission.formMethod))){ve(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}=Ke(n.pathname);ve(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:o});return}let u=r&&r.overrideNavigation?{...r.overrideNavigation,matches:a,historyAction:t}:void 0;M=new AbortController;let d=Lt(e.history,n,M.signal,r&&r.submission),f=e.getContext?await e.getContext():new O,p;if(r&&r.pendingError)p=[Gt(a).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&X(r.submission.formMethod)){let i=await Se(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)&&je(t.error)&&t.error.status===404){M=null,ve(n,{matches:i.matches,loaderData:{},errors:{[e]:t.error}});return}}a=i.matches||a,p=i.pendingActionResult,u=un(n,a,t,r.submission),o=!1,l.active=!1,d=Lt(e.history,d.url,d.signal)}let{shortCircuited:m,matches:h,loaderData:g,errors:_,workingFetchers:v}=await Ce(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||(M=null,ve(n,{matches:h||a,...Wt(p),loaderData:g,errors:_,...v?{fetchers:v}:{}}))}async function Se(t,n,i,l,u,d,f,p,m={}){if(Me(),H({navigation:dn(n,l,u,i)},{flushSync:m.flushSync===!0}),f){let e=await q(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}=Kt(s.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=Gt(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}=Ke(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let h,g=cn(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 ke(t,n,Ot(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(en(h)){let n;return n=m&&m.replace!=null?m.replace:It(h.response.headers.get(`Location`),new URL(t.url),c,e.history)===k.location.pathname+k.location.search,await Oe(t,h,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(Y(h)){let e=Gt(l,g.route.id);return(m&&m.replace)!==!0&&(A=`PUSH`),{matches:l,pendingActionResult:[e.route.id,h,g.route.id]}}return{matches:l,pendingActionResult:[g.route.id,h]}}async function Ce(t,n,i,l,u,d,f,p,m,h,g,_,v,y){let b=f||un(n,i,l,p),x=p||m||ln(b),S=!ae&&!g;if(d){if(S){let e=we(v);H({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await q(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}=Kt(s.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=Gt(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}=Ke(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s.activeRoutes,{dsMatches:w,revalidatingFetchers:T}=lt(t,u,a,o,e.history,k,i,x,n,g?[]:r,g===!0,oe,se,R,fe,de,C,c,e.patchRoutesOnNavigation!=null,s.branches,v,y);if(le=++ce,!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(k.fetchers),t=Be(e);return ve(n,{matches:i,loaderData:{},errors:v&&Y(v[1])?{[v[0]]:v[1].error}:null,...Wt(v),...t?{fetchers:e}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=we(v);t!==void 0&&(e.actionData=t)}T.length>0&&(e.fetchers=U(T)),H(e,{flushSync:_})}T.forEach(e=>{K(e.key),e.controller&&I.set(e.key,e.controller)});let ee=()=>T.forEach(e=>K(e.key));M&&M.signal.addEventListener(`abort`,ee);let{loaderResults:E,fetcherResults:D}=await Ae(w,T,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};M&&M.signal.removeEventListener(`abort`,ee),T.forEach(e=>I.delete(e.key));let O=qt(E);if(O)return await Oe(t,O.result,!0,{replace:h}),{shortCircuited:!0};if(O=qt(D),O)return de.add(O.key),await Oe(t,O.result,!0,{replace:h}),{shortCircuited:!0};let A=new Map(k.fetchers),{loaderData:j,errors:te}=Ht(k,i,E,v,T,D,A);g&&k.errors&&(te={...k.errors,...te});let ne=Be(A),N=Ve(le,A),P=ne||N||T.length>0;return{matches:i,loaderData:j,errors:te,...P?{workingFetchers:A}:{}}}function we(e){if(e&&!Y(e[1]))return{[e[0]]:e[1].data};if(k.actionData)return Object.keys(k.actionData).length===0?null:k.actionData}function U(e){let t=new Map(k.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=fn(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function Te(t,n,r,i){K(t);let a=(i&&i.flushSync)===!0,o=s.activeRoutes,l=st(k.location,k.matches,c,r,n,i?.relative),u=F(o,l,c,!1,s.branches),d=nt(u,o,l);if(d.active&&d.matches&&(u=d.matches),!u){G(t,n,J(404,{pathname:l}),{flushSync:a});return}let{path:f,submission:p,error:m}=ct(!0,l,i);if(m){G(t,n,m,{flushSync:a});return}let h=e.getContext?await e.getContext():new O,g=(i&&i.preventScrollReset)===!0;if(p&&X(p.formMethod)){await Ee(t,n,f,u,h,d.active,a,g,p,i&&i.defaultShouldRevalidate);return}fe.set(t,{routeId:n,path:f}),await De(t,n,f,u,h,d.active,a,g,p)}async function Ee(t,n,i,l,u,d,f,p,m,h){Me(),fe.delete(t),W(t,pn(m,k.fetchers.get(t)),{flushSync:f});let g=new AbortController,_=Lt(e.history,i,g.signal,m);if(d){let e=await q(l,new URL(_.url).pathname,_.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){G(t,n,e.error,{flushSync:f});return}else if(e.matches)l=e.matches;else{G(t,n,J(404,{pathname:i}),{flushSync:f});return}}let y=cn(l,i);if(!y.route.action&&!y.route.lazy){G(t,n,J(405,{method:m.formMethod,pathname:i,routeId:n}),{flushSync:f});return}I.set(t,g);let b=ce,x=Ot(a,o,_,i,l,y,r,u),S=await ke(_,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(_.signal.aborted){I.get(t)===g&&I.delete(t);return}if(R.has(t)){if(en(C)||Y(C)){W(t,mn(void 0));return}}else{if(en(C))if(I.delete(t),le>b){W(t,mn(void 0));return}else return de.add(t),W(t,fn(m)),Oe(_,C,!1,{fetcherSubmission:m,preventScrollReset:p});if(Y(C)){G(t,n,C.error);return}}let w=k.navigation.location||k.location,T=Lt(e.history,w,g.signal),ee=s.activeRoutes,E=k.navigation.state===`idle`?k.matches:F(ee,k.navigation.location,c,!1,s.branches);v(E,`Didn't find any matches after fetcher action`);let D=++ce;ue.set(t,D);let{dsMatches:O,revalidatingFetchers:j}=lt(T,u,a,o,e.history,k,E,m,w,r,!1,oe,se,R,fe,de,ee,c,e.patchRoutesOnNavigation!=null,s.branches,[y.route.id,C],h),te=fn(m,C.data),ne=new Map(k.fetchers);ne.set(t,te),j.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=ne.get(t),r=fn(void 0,n?n.data:void 0);ne.set(t,r),K(t),e.controller&&I.set(t,e.controller)}),H({fetchers:ne});let N=()=>j.forEach(e=>K(e.key));g.signal.addEventListener(`abort`,N);let{loaderResults:P,fetcherResults:re}=await Ae(O,j,T,w,u);if(g.signal.aborted)return;g.signal.removeEventListener(`abort`,N),ue.delete(t),I.delete(t),j.forEach(e=>I.delete(e.key));let ie=k.fetchers.has(t),ae=e=>{if(!ie)return e;let n=new Map(e.fetchers);return n.set(t,mn(C.data)),{...e,fetchers:n}},L=qt(P);if(L)return k=ae(k),Oe(T,L.result,!1,{preventScrollReset:p});if(L=qt(re),L)return de.add(L.key),k=ae(k),Oe(T,L.result,!1,{preventScrollReset:p});let z=new Map(k.fetchers);ie&&z.set(t,mn(C.data));let{loaderData:pe,errors:B}=Ht(k,E,P,void 0,j,re,z);Ve(D,z),k.navigation.state===`loading`&&D>le?(v(A,`Expected pending action`),M&&M.abort(),ve(k.navigation.location,{matches:E,loaderData:pe,errors:B,fetchers:z})):(H({errors:B,loaderData:Ut(k.loaderData,pe,E,B),fetchers:z}),oe=!1)}async function De(t,n,i,s,c,l,u,d,f){let p=k.fetchers.get(t);W(t,fn(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=Lt(e.history,i,m.signal);if(l){let e=await q(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){G(t,n,e.error,{flushSync:u});return}else if(e.matches)s=e.matches;else{G(t,n,J(404,{pathname:i}),{flushSync:u});return}}let g=cn(s,i);I.set(t,m);let _=ce,v=await ke(h,i,Ot(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(I.get(t)===m&&I.delete(t),!h.signal.aborted){if(R.has(t)){W(t,mn(void 0));return}if(en(y))if(le>_){W(t,mn(void 0));return}else{de.add(t),await Oe(h,y,!1,{preventScrollReset:d});return}if(Y(y)){G(t,n,y.error);return}W(t,mn(y.data))}}async function Oe(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:l,replace:u}={}){a||(j?.resolve(),j=null),i.response.headers.has(`X-Remix-Revalidate`)&&(oe=!0);let d=i.response.headers.get(`Location`);v(d,`Expected a Location header on the redirect Response`),d=It(d,new URL(r.url),c,e.history);let f=S(k.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(_e(d)){let n=ee(t,d,!0);e=n.origin!==t.location.origin||V(n.pathname,c)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}M=null;let p=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:m,formAction:h,formEncType:g}=k.navigation;!o&&!s&&m&&h&&g&&(o=ln(k.navigation));let _=o||s;Je.has(i.response.status)&&_&&X(_.formMethod)?await xe(p,f,{submission:{..._,formAction:d},preventScrollReset:l||te,enableViewTransition:a?N:void 0}):await xe(p,f,{overrideNavigation:un(f,[],p,o),fetcherSubmission:s,preventScrollReset:l||te,enableViewTransition:a?N:void 0})}async function ke(e,t,n,r,i){let a,o={};try{a=await kt(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)&&!k.loaderData.hasOwnProperty(e.route.id)&&(!k.errors||!k.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($t(r)){let i=r.result;o[t]={type:`redirect`,response:Nt(i,e,t,n,c)}}else o[t]=await Mt(r);return o}async function Ae(e,t,n,r,i){let a=ke(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await ke(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(){oe=!0,fe.forEach((e,t)=>{I.has(t)&&se.add(t),K(t)})}function W(e,t,n={}){let r=new Map(k.fetchers);r.set(e,t),H({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function G(e,t,n,r={}){let i=Gt(k.matches,t),a=new Map(k.fetchers);Le(a,e),H({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function Ne(e){return L.set(e,(L.get(e)||0)+1),R.has(e)&&R.delete(e),k.fetchers.get(e)||Xe}function Ie(e,t){K(e,t?.reason),W(e,mn(null))}function Le(e,t){let n=k.fetchers.get(t);I.has(t)&&!(n&&n.state===`loading`&&ue.has(t))&&K(t),fe.delete(t),ue.delete(t),de.delete(t),R.delete(t),se.delete(t),e.delete(t)}function Re(e){let t=(L.get(e)||0)-1;t<=0?(L.delete(e),R.add(e)):L.set(e,t),H({fetchers:new Map(k.fetchers)})}function K(e,t){let n=I.get(e);n&&(n.abort(t),I.delete(e))}function ze(e,t){for(let n of e){let e=t.get(n);v(e,`Expected fetcher: ${n}`);let r=mn(e.data);t.set(n,r)}}function Be(e){let t=[],n=!1;for(let r of de){let i=e.get(r);v(i,`Expected fetcher: ${r}`),i.state===`loading`&&(de.delete(r),t.push(r),n=!0)}return ze(t,e),n}function Ve(e,t){let n=[];for(let[r,i]of ue)if(i<e){let e=t.get(r);v(e,`Expected fetcher: ${r}`),e.state===`loading`&&(K(r),ue.delete(r),n.push(r))}return ze(n,t),n.length>0}function He(e,t){let n=k.blockers.get(e)||Ze;return z.get(e)!==t&&z.set(e,t),n}function Ue(e){k.blockers.delete(e),z.delete(e)}function We(e,t){let n=k.blockers.get(e)||Ze;v(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(k.blockers);r.set(e,t),H({blockers:r})}function Ge({currentLocation:e,nextLocation:t,historyAction:n}){if(z.size===0)return;z.size>1&&y(!1,`A router only supports one blocker at a time`);let r=Array.from(z.entries()),[i,a]=r[r.length-1],o=k.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Ke(e){let t=J(404,{pathname:e}),n=s.activeRoutes,{matches:r,route:i}=Kt(n);return{notFoundMatches:r,route:i,error:t}}function qe(e,t,n){if(m=e,g=t,h=n||null,!_&&k.navigation===Ye){_=!0;let e=tt(k.location,k.matches);e!=null&&H({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function $e(e,t){return h&&h(e,t.map(e=>re(e,k.loaderData)))||e.key}function et(e,t){if(m&&g){let n=$e(e,t);m[n]=g()}}function tt(e,t){if(m){let n=$e(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:F(n,r,c,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:F(n,r,c,!0,e)}}return{active:!1,matches:null}}async function q(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||ht(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=F(s.activeRoutes,n,c,!1,u),f=null;if(d&&(Object.keys(d[0].params).length===0||(f=F(s.activeRoutes,n,c,!0,u),!(f&&l.length<f.length&&rt(l,f.slice(0,l.length))))))return{type:`success`,matches:d};if(f||=F(s.activeRoutes,n,c,!0,u),!f||rt(l,f))return{type:`success`,matches:null};l=f}}function rt(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function at(e){o={},s.setHmrRoutes(ne(e,a,void 0,o))}function ot(e,t,n=!1){ht(e,t,s,o,a,n),s.hasHMRRoutes||H({})}return D={get basename(){return c},get future(){return u},get state(){return k},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:me,subscribe:ge,enableScrollRestoration:qe,navigate:ye,fetch:Te,revalidate:be,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Ne,resetFetcher:Ie,deleteFetcher:Re,dispose:he,getBlocker:He,deleteBlocker:Ue,patchRoutes:ot,_internalFetchControllers:I,_internalSetRoutes:at,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){H(e)}},e.instrumentations&&(D=Fe(D,e.instrumentations.map(e=>e.router).filter(Boolean))),D}function ot(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function st(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=Ce(r||`.`,Se(o),V(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=sn(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=H({basename:n,pathname:c.pathname})),C(c)}function ct(e,t,n){if(!n||!ot(n))return{path:t};if(n.formMethod&&!on(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=Jt(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()}}}v(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=zt(n.formData),s=n.formData;else if(n.body instanceof FormData)o=zt(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=Bt(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=Bt(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=w(t);return e&&l.search&&sn(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:C(l),submission:c}}function lt(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 ee=b?b[1].statusCode:void 0,E=ee&&ee>=400,D={currentUrl:C,currentParams:a.matches[0]?.params||{},nextUrl:w,nextParams:o[0].params,...s,actionResult:S,actionStatus:ee},O=Me(o),k=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(!ut(s))f=!1;else if(u){let{shouldLoad:e}=dt(s,a.loaderData,a.errors);f=e}else ft(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return Dt(n,r,e,c,O,i,l,t,f);let p=!1;typeof x==`boolean`?p=x:E?p=!1:d||C.pathname+C.search===w.pathname+w.search?p=!0:C.search===w.search?pt(a.matches[o],i)&&(p=!0):p=!0;let m={...D,defaultShouldRevalidate:p};return Dt(n,r,e,c,O,i,l,t,mt(i,m),m,x)}),A=[];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=F(g,e.path,_??`/`,!1,y);if(!b){if(v&&m)return;A.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=cn(b,e.path),C=new AbortController,w=Lt(i,e.path,C.signal),T=null;if(f.has(s))f.delete(s),T=Ot(n,r,w,e.path,b,S,l,t);else if(m)d&&(T=Ot(n,r,w,e.path,b,S,l,t));else{let i;i=typeof x==`boolean`?x:E?!1:d;let a={...D,defaultShouldRevalidate:i};mt(S,a)&&(T=Ot(n,r,w,e.path,b,S,l,t,a))}T&&A.push({key:s,routeId:e.routeId,path:e.path,matches:T,match:S,request:w,controller:C})}),{dsMatches:k,revalidatingFetchers:A}}function ut(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function dt(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!ut(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 ft(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function pt(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function mt(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function ht(e,t,n,r,i,a){let o;if(e){let t=r[e];v(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=>gt(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=ne(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]=ne([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 gt(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=>gt(e,t)))??!1:!1}var _t=new WeakMap,vt=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(v(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=_t.get(i);o||(o={},_t.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=A(e),n=i[e]!==void 0&&e!==`hasErrorBoundary`;if(t)y(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)y(!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},yt=new WeakMap;function bt(e,t,n,r,i){let a=n[e.id];if(v(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=yt.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{v(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=te(e),o=a[e]!==void 0&&e!==`hasErrorBoundary`;i?y(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?y(!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 yt.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=vt({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 xt(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 St(e){return e.matches.some(e=>e.route.middleware)?Ct(e,()=>xt(e)):xt(e)}function Ct(e,t){return wt(e,t,e=>{if(an(e))throw e;return e},Zt,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=Gt(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 wt(e,t,n,r,i){let{matches:a,...o}=e;return await Tt(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function Tt(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 Tt(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 Et(e,t,n,r,i){let a=vt({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=bt(r.route,X(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function Dt(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=Et(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?mt(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?mt(a,{...l,defaultShouldRevalidate:e}):mt(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)?At({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 Ot(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?Dt(e,t,n,r,Me(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:Et(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function kt(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:Rt(t,n),pattern:Me(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 Ct(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 At({request:e,path:t,pattern:n,mat