1import{Kt as e,Ot as t,Vt as n,dt as r,gt as i,ht as a,it as o,mt as s,pt as c,st as l}from"./Button-C6sHgGTv.js";var u=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,d=/^[\\/]{2}/;function f(e,t){return t+e.replace(/\\/g,`/`)}var p=`popstate`;function m(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function h(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return b(``,{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:x(t)}return C(t,n,null,e)}function g(e,t){if(e===!1||e==null)throw Error(t)}function _(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function v(){return Math.random().toString(36).substring(2,10)}function y(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 b(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?S(t):t,state:n,key:t&&t.key||r||v(),mask:i}}function x({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 S(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 C(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=m(e)?e:b(_.location,e,t);n&&n(r,e),l=u()+1;let d=y(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=m(e)?e:b(_.location,e,t);n&&n(r,e),l=u();let i=y(r,l),d=_.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:_.location,delta:0})}function g(e){return w(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(p,d),c=e,()=>{i.removeEventListener(p,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:f,replace:h,go(e){return o.go(e)}};return _}function w(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),g(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:x(t);return i=i.replace(/ $/,`%20`),!n&&d.test(i)&&(i=r+i),new URL(i,r)}var T=e(n(),1),E=class{#e=new Map;constructor(e){if(e)for(let[t,n]of e)this.set(t,n)}get(e){if(this.#e.has(e))return this.#e.get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){this.#e.set(e,t)}},D=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function O(e){return D.has(e)}var k=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function A(e){return k.has(e)}function j(e){return e.index===!0}function M(e){let t={};return e.Component&&Object.assign(t,{element:T.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:T.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:T.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}function ee(e,t=M,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(g(e.index!==!0||!e.children,`Cannot specify children on an index route`),g(i||!r[s],`Found a route id collision on i
1d "${s}". Route id's must be globally unique within Data Router usages`),j(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=ee(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=H((typeof t==`string`?S(t):t).pathname||`/`,n);if(a==null)return null;let o=i??I(e),s=null,c=ve(a);for(let e=0;s==null&&e<o.length;++e)s=fe(o[e],c,r);return s}function te(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,loaderData:t[n.id],handle:n.handle}}function I(e){let t=ne(e);return ie(t),t}function ne(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;g(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&&(g(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),ne(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:z(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=_e(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 re(e.path))a(e,t,!0,n)}),t}function re(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=re(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 ie(e){e.sort((e,t)=>e.score===t.score?B(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ae=/^:[\w-]+$/,oe=/^:[\w-]+/,L=3.5,se=3,ce=2,le=1,ue=10,de=-2,R=e=>e===`*`;function z(e,t){let n=e.split(`/`),r=n.length;return n.some(R)&&(r+=de),t&&(r+=ce),n.filter(e=>!R(e)).reduce((e,t)=>e+(ae.test(t)?se:oe.test(t)?L:t===``?le:ue),r)}function B(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 fe(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?V(u,l,s.matcher,s.compiledParams):ge(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=ge({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;
1Object.assign(i,d.params),o.push({params:i,pathname:U([a,d.pathname]),pathnameBase:ke(U([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=U([a,d.pathnameBase]))}return o}var pe={"%24":`$`,"%26":`&`,"%2B":`+`,"%2C":`,`,"%3A":`:`,"%3B":`;`,"%3D":`=`,"%40":`@`};function me(e){return encodeURIComponent(e).replace(/%(?:24|26|2B|2C|3A|3B|3D|40)/g,e=>pe[e])}function he(e,t={}){let n=e;n.endsWith(`*`)&&n!==`*`&&!n.endsWith(`/*`)&&(_(!1,`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,`/*`)}".`),n=n.replace(/\*$/,`/*`));let r=n.startsWith(`/`)?`/`:``,i=e=>e==null?``:typeof e==`string`?e:String(e);return r+n.split(/\/+/).map((e,n,r)=>{if(n===r.length-1&&e===`*`)return i(t[`*`]);let a=e.match(/^:([\w-]+)(\??)(.*)/);if(a){let[,e,n,r]=a,o=t[e];return g(n===`?`||o!=null,`Missing ":${e}" param`),me(i(o))+r}return e.replace(/\?$/g,``)}).filter(e=>!!e).join(`/`)}function ge(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=_e(e.path,e.caseSensitive,e.end);return V(e,t,n,r)}function V(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 _e(e,t=!1,n=!0){_(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)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function ve(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return _(!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 ye({basename:e,pathname:t}){return t===`/`?e:U([e,t])}var be=e=>u.test(e);function xe(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?S(e):e,a;return n?(n=De(n),a=n.startsWith(`/`)?Se(n.substring(1),`/`):Se(n,t)):a=t,{pathname:a,search:Ae(r),hash:je(i)}}function Se(e,t){let n=Oe(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Ce(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 we(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Te(e){let t=we(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Ee(e,t,n,r=!1){let i;typeof e==`string`?i=S(e):(i={...e},g(!i.pathname||!i.pathname.includes(`?`),Ce(`?`,`pathname`,`search`,i)),g(!i.pathname||!i.pathname.includes(`#`),Ce(`#`,`pathname`,`hash`,i)),g(!i.search||!i.search.includes(`#`),Ce(`#`,`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=xe(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var De=e=>e.replace(/[\\/]{2,}/g,`/`),U=e=>De(e.join(`/`)),Oe=e=>e.replace(/\/+$/,``),ke=e=>Oe(e).replace(/^\/*/,`/`),Ae=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,je=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Me=(e,t=302)=>{let n=t;
1typeof n==`number`?n={status:n}:n.status===void 0&&(n.status=302);let r=new Headers(n.headers);return r.set(`Location`,e),new Response(null,{...n,headers:r})},Ne=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],Pe=class{status;statusText;data;error;internal;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 Fe(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Ie(e){return U(e.map(e=>e.route.path).filter(Boolean))||`/`}function Le(e,t){let n=new URL(typeof e==`string`||e instanceof URL?e:e.url),r=typeof t==`string`?S(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);let i=e.toString();n.search=i?`?${i}`:``}else n.search=``;return n.hash=r.hash||``,n}var Re=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function W(e,t){let n=e;if(typeof n!=`string`||!u.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Re)try{let e=new URL(window.location.href),r=d.test(n)?new URL(f(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{_(!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 ze=Symbol(`Uninstrumented`),Be=new WeakMap;function Ve(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){e.lazy!=null&&n.lazy.push(e.lazy),e[`lazy.loader`]!=null&&n[`lazy.loader`].push(e[`lazy.loader`]),e[`lazy.action`]!=null&&n[`lazy.action`].push(e[`lazy.action`]),e[`lazy.middleware`]!=null&&n[`lazy.middleware`].push(e[`lazy.middleware`]),e.middleware!=null&&n.middleware.push(e.middleware),e.loader!=null&&n.loader.push(e.loader),e.action!=null&&n.action.push(e.action)}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=t.lazy;r.lazy=async(...t)=>G(await K(n.lazy,void 0,()=>e(...t),q))}if(typeof t.lazy==`object`){let e=t.lazy;if(typeof e.middleware==`function`&&n[`lazy.middleware`].length>0){let t=e.middleware;r.lazy=Object.assign(r.lazy||{},{middleware:async(...e)=>G(await K(n[`lazy.middleware`],void 0,()=>t(...e),q))})}if(typeof e.loader==`function`&&n[`lazy.loader`].length>0){let t=e.loader;r.lazy=Object.assign(r.lazy||{},{loader:async(...e)=>G(await K(n[`lazy.loader`],void 0,()=>t(...e),q))})}if(typeof e.action==`function`&&n[`lazy.action`].length>0){let t=e.action;r.lazy=Object.assign(r.lazy||{},{action:async(...e)=>G(await K(n[`lazy.action`],void 0,()=>t(...e),q))})}}if(typeof t.loader==`function`&&n.loader.length>0){let e=Ue(t.loader),i=async(...t)=>G(await K(n.loader,qe(t[0]),()=>e(...t),q));e.hydrate===!0&&(i.hydrate=!0),We(i,e),r.loader=i}if(typeof t.action==`function`&&n.action.length>0){let e=Ue(t.action),i=async(...t)=>G(await K(n.action,qe(t[0]),()=>e(...t),q));We(i,e),r.action=i}return t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=Ue(e),r=async(...e)=>G(await K(n.middleware,qe(e[0]),()=>t(...e),q));return We(r,t),r})),r}function He(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){e.navigate!=null&&n.navigate.push(e.navigate),e.fetch!=null&&n.fetch.push(e.fetch)}})),n.navigate.length>0){let t=Ue(e.navigate),r=async(...r)=>{let[i,a]=r,o,s={to:typeof i==`number`||typeof i==`string`?i:i?x(i):`.`,...Je(e,a??{})};return G(await K(n.navigate,s,async()=>{if(typeof i==`number`)return await t(...r);let n=Ge(e,e=>{o=e});try{return await t(...r)}finally{n()}},e=>({...q(e),meta:o})))};We(r,t),e.navigate=r}if(n.fetch.length>0){let t=Ue(e.fetch),r=async(...r)=>{let[i,a,o,s]=r,c;return G(await K(n.fetch,{href:o??`.`,fetcherKey:i,...Je(e,s??{})},async()=>{let n=Ge(e,e=>{c=e});try{return await t(...r)}finally{n()}},e=>({...q(e),meta:c})))};We(r,t),e.fetch=r}return e}function Ue(e){return e[ze]??e}function We(e,t){e[ze]=t}function Ge(e,t){return Be.set(e,t),()=>{Be.get(e)===t&&Be.delete(e)}}function Ke(e){let t=Be.get(e);return Be.delete(e),t}function G(e){if(e.type===`error`)throw e.value;return e.value}async function K(e,t,n,r,i={result:null,innerResult:null},a=e.length-1){let o=e[a];if(o){let s,c=async()=>(s?console.error(`You cannot call instrumented handlers more than once`):s=K(e,t,n,r,i,a-1),await s,g(i.innerResult,`Expected an inner result`),i.innerResult);try{await o(c,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}s||await c(),await s}else{try{i.result={type:`success`,value:await n()}}catch(e){i.result={type:`error`,value:e}}i.innerResult=r(i.result,t)}return i.result?i.result:(i.result={type:`error`,value:Error(`No result assigned in instrumentation chain.`)},i.innerResult=r(i.result,t),i.result)}function q(e){return e.type===`error`&&e.value instanceof Error?{status:`error`,error:e.value}:{status:`success`,error:void 0}}function qe(e){let{request:t,context:n,params:r}=e;return{...e,request:Ye(t),params:{...r},context:Xe(n)}}function Je(e,t){return{currentUrl:x(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 Ye(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function Xe(e){return{get:t=>e.get(t)}}var Ze=[`POST`,`PUT`,`PATCH`,`DELETE`],Qe=new Set(Ze),$e=[`GET`,...Ze],et=new Set($e),tt=new Set([301,302,303,307,308]),nt=new Set([307,308]),rt={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},it={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},at={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},ot=`remix-router-transitions`,st=Symbol(`ResetLoaderData`),ct=class{#e;#t;#n;#r;constructor(e){this.#e=e,this.#t=I(e)}get stableRoutes(){return this.#e}get activeRoutes(){return this.#n??this.#e}get branches(){return this.#r??this.#t}get hasHMRRoutes(){return this.#n!=null}setRoutes(e){this.#e=e,this.#t=I(e)}setHmrRoutes(e){this.#n=e,this.#r=I(e)}commitHmrRoutes(){this.#n&&(this.#e=this.#n,this.#t=this.#r,this.#n=void 0,this.#r=void 0)}};function lt(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;g(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties,a=i||(()=>({}));if(e.instrumentations){let t=e.instrumentations;a=e=>({...i?.(e),...Ve(t.map(e=>
1e.route).filter(Boolean),e)})}let o={},s=new ct(ee(e.routes,a,void 0,o)),c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||Et,u={...e.future},d=null,f=new Set,p=null,m=null,h=null,v=null,y=e.hydrationData!=null,x=F(s.activeRoutes,e.history.location,c,!1,s.branches),C=!1,T=null,D,O;if(x==null&&!e.patchRoutesOnNavigation){let t=J(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=Yt(s.activeRoutes);D=!0,O=!D,x=n,T={[r.id]:t}}else if(x&&!e.hydrationData&&Ze(x,s.activeRoutes,e.history.location.pathname).active&&(x=null),!x){D=!1,O=!D,x=[];let t=Ze(null,s.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(C=!0,x=t.matches)}else if(x.some(e=>e.route.lazy))D=!1,O=!D;else if(!x.some(e=>mt(e.route)))D=!0,O=!D;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=x;if(n){let e=x.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}O=!1,D=!0,r.forEach(e=>{let r=ht(e.route,t,n);O||=r.renderFallback,D&&=!r.shouldLoad})}let k,A={historyAction:e.history.action,location:e.history.location,matches:x,initialized:D,renderFallback:O,navigation:rt,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||T,fetchers:new Map,blockers:new Map},j=`POP`,M=null,N=!1,P,I=!1,ne=new Map,re=null,ie=!1,ae=!1,oe=new Set,L=new Map,se=0,ce=-1,le=new Map,ue=new Set,de=new Map,R=new Map,z=new Set,B=new Map,fe,pe=null;function me(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(fe){fe(),fe=void 0;return}_(B.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=K({currentLocation:A.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{fe=e});e.history.go(r*-1),G(i,{state:`blocked`,location:n,proceed(){G(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,at),V({blockers:e})}}),M?.resolve(),M=null;return}return xe(t,n)}),n){yn(t,ne);let e=()=>bn(t,ne);t.addEventListener(`pagehide`,e),re=()=>t.removeEventListener(`pagehide`,e)}return A.initialized||xe(`POP`,A.location,{initialHydration:!0}),k}function he(){d&&d(),re&&re(),f.clear(),P&&P.abort(),A.fetchers.forEach((e,t)=>Le(A.fetchers,t)),A.blockers.forEach((e,t)=>Ge(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 V(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`&&(z.has(t)?n.push(t):r.push(t))}),z.forEach(e=>{!A.fetchers.has(e)&&!L.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=>Le(A.fetchers,e)),r.forEach(e=>A.fetchers.delete(e))}function _e(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?Kt(A.loaderData,n.loaderData,n.matches||[],n.errors):A.loaderData,c=A.blockers;c.size>0&&!ie&&(c=new Map(c),c.forEach((e,t)=>c.set(t,at)));let l=ie?!1:Xe(t,n.matches||A.matches),u=N===!0||A.navigation.formMethod!=null&&X(A.navigation.formMethod)&&t.state?._isRedirect!==!0;s.commitHmrRoutes(),ie||j===`POP`||(j===`PUSH`?e.history.push(t,t.state):j===`REPLACE`&&e.history.replace(t,t.state));let d;if(j===`POP`){let e=ne.get(A.location.pathname);e&&e.has(t.pathname)?d={currentLocation:A.location,nextLocation:t}:ne.has(t.pathname)&&(d={currentLocation:t,nextLocation:A.location})}else if(I){let e=ne.get(A.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),ne.set(A.location.pathname,e)),d={currentLocation:A.location,nextLocation:t}}V({...n,actionData:a,loaderData:o,historyAction:j,location:t,initialized:!0,renderFallback:!1,navigation:rt,revalidation:`idle`,restoreScrollPosition:l,preventScrollReset:u,blockers:c},{viewTransitionOpts:d,flushSync:r===!0}),j=`POP`,N=!1,I=!1,ie=!1,ae=!1,M?.resolve(),M=null,pe?.resolve(),pe=null}async function ve(t,n){if(M?.resolve(),M=null,typeof t==`number`){M||=xn();let n=M.promise;return e.history.go(t),n}let r=Ke(k),{path:i,submission:a,error:o}=ft(!1,dt(A.location,A.matches,c,t,n?.fromRouteId,n?.relative),n),s;n?.mask&&(s={pathname:``,search:``,hash:``,...typeof n.mask==`string`?S(n.mask):{...A.location.mask,...n.mask}});let l=A.location,u=b(l,i,n&&n.state,void 0,s);u={...u,...e.history.encodeLocation(u)};let d=n&&n.replace!=null?n.replace:void 0,f=`PUSH`;d===!0?f=`REPLACE`:d===!1||a!=null&&X(a.formMethod)&&a.formAction===A.location.pathname+A.location.search&&(f=`REPLACE`);let p=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,m=(n&&n.flushSync)===!0,h=K({currentLocation:l,nextLocation:u,historyAction:f});if(h){G(h,{state:`blocked`,location:u,proceed(){G(h,{state:`proceeding`,proceed:void 0,reset:void 0,location:u}),ve(t,n)},reset(){let e=new Map(A.blockers);e.set(h,at),V({blockers:e})}});return}await xe(f,u,{submission:a,pendingError:o,preventScrollReset:p,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:m,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate,instrumentationNavigateMetaReceiver:r})}function ye(){pe||=xn(),je(),V({revalidation:`loading`});let e=pe.promise;return A.navigation.state===`submitting`?e:A.navigation.state===`idle`?(xe(A.historyAction,A.location,{startUninterruptedRevalidation:!0}
1),e):(xe(j||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:I===!0}),e)}async function xe(t,n,r){P&&P.abort(),P=null,j=t,ie=(r&&r.startUninterruptedRevalidation)===!0,Ye(A.location,A.matches),N=(r&&r.preventScrollReset)===!0,I=(r&&r.enableViewTransition)===!0;let i=s.activeRoutes,a=r?.initialHydration&&A.matches&&A.matches.length>0&&!C?A.matches:F(i,n,c,!1,s.branches),o=(r&&r.flushSync)===!0;if(a&&A.initialized&&!ae&&Qt(A.location,n)&&!(r&&r.submission&&X(r.submission.formMethod))){_e(n,{matches:a},{flushSync:o});return}let l=Ze(a,i,n.pathname);if(l.active&&l.matches&&(a=l.matches),r?.instrumentationNavigateMetaReceiver){let t=fn(e.history,n,a);r.instrumentationNavigateMetaReceiver(t)}if(!a){let{error:e,notFoundMatches:t,route:r}=q(n.pathname);_e(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:o});return}let u=r&&r.overrideNavigation?{...r.overrideNavigation,matches:a,historyAction:t}:void 0;P=new AbortController;let d=Vt(e.history,n,P.signal,r&&r.submission),f=e.getContext?await e.getContext():new E,p;if(r&&r.pendingError)p=[Jt(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)&&Fe(t.error)&&t.error.status===404){P=null,_e(n,{matches:i.matches,loaderData:{},errors:{[e]:t.error}});return}}a=i.matches||a,p=i.pendingActionResult,u=mn(n,a,t,r.submission),o=!1,l.active=!1,d=Vt(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||(P=null,_e(n,{matches:h||a,...qt(p),loaderData:g,errors:_,...v?{fetchers:v}:{}}))}async function Se(t,n,i,l,u,d,f,p,m={}){if(je(),V({navigation:hn(n,l,u,i)},{flushSync:m.flushSync===!0}),f){let e=await Qe(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}=Yt(s.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=Jt(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}=q(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let h,g=dn(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,Mt(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(rn(h)){let n;return n=m&&m.replace!=null?m.replace:Bt(h.response.headers.get(`Location`),new URL(t.url),c,e.history)===A.location.pathname+A.location.search,await Oe(t,h,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(Y(h)){let e=Jt(l,g.route.id);return(m&&m.replace)!==!0&&(j=`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||mn(n,i,l,p),x=p||m||pn(b),S=!ie&&!g;if(d){if(S){let e=we(v);V({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await Qe(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}=Yt(s.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=Jt(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}=q(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s.activeRoutes,{dsMatches:w,revalidatingFetchers:T}=pt(t,u,a,o,e.history,A,i,x,n,g?[]:r,g===!0,ae,oe,z,de,ue,C,c,e.patchRoutesOnNavigation!=null,s.branches,v,y);if(ce=++se,!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=Be(e);return _e(n,{matches:i,loaderData:{},errors:v&&Y(v[1])?{[v[0]]:v[1].error}:null,...qt(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=Te(T)),V(e,{flushSync:_})}
1T.forEach(e=>{W(e.key),e.controller&&L.set(e.key,e.controller)});let E=()=>T.forEach(e=>W(e.key));P&&P.signal.addEventListener(`abort`,E);let{loaderResults:D,fetcherResults:O}=await Ae(w,T,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};P&&P.signal.removeEventListener(`abort`,E),T.forEach(e=>L.delete(e.key));let k=Xt(D);if(k)return await Oe(t,k.result,!0,{replace:h}),{shortCircuited:!0};if(k=Xt(O),k)return ue.add(k.key),await Oe(t,k.result,!0,{replace:h}),{shortCircuited:!0};let j=new Map(A.fetchers),{loaderData:M,errors:ee}=Gt(A,i,D,v,T,O,j);g&&A.errors&&(ee={...A.errors,...ee});let N=Be(j),F=Ue(ce,j),te=N||F||T.length>0;return{matches:i,loaderData:M,errors:ee,...te?{workingFetchers:j}:{}}}function we(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 Te(e){let t=new Map(A.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=gn(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function Ee(t,n,r,i){W(t);let a=(i&&i.flushSync)===!0,o=Ke(k),l=s.activeRoutes,u=dt(A.location,A.matches,c,r,n,i?.relative),d=F(l,u,c,!1,s.branches),f=Ze(d,l,u);if(f.active&&f.matches&&(d=f.matches),o&&o(fn(e.history,u,d)),!d){Ne(t,n,J(404,{pathname:u}),{flushSync:a});return}let{path:p,submission:m,error:h}=ft(!0,u,i);if(h){Ne(t,n,h,{flushSync:a});return}let g=e.getContext?await e.getContext():new E,_=(i&&i.preventScrollReset)===!0;if(m&&X(m.formMethod)){await De(t,n,p,d,g,f.active,a,_,m,i&&i.defaultShouldRevalidate);return}de.set(t,{routeId:n,path:p}),await U(t,n,p,d,g,f.active,a,_,m)}async function De(t,n,i,l,u,d,f,p,m,h){je(),de.delete(t),Me(t,_n(m,A.fetchers.get(t)),{flushSync:f});let _=new AbortController,v=Vt(e.history,i,_.signal,m);if(d){let e=await Qe(l,new URL(v.url).pathname,v.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ne(t,n,e.error,{flushSync:f});return}else if(e.matches)l=e.matches;else{Ne(t,n,J(404,{pathname:i}),{flushSync:f});return}}let y=dn(l,i);if(!y.route.action&&!y.route.lazy){Ne(t,n,J(405,{method:m.formMethod,pathname:i,routeId:n}),{flushSync:f});return}L.set(t,_);let b=se,x=Mt(a,o,v,i,l,y,r,u),S=await ke(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){L.get(t)===_&&L.delete(t);return}if(z.has(t)){if(rn(C)||Y(C)){Me(t,vn(void 0));return}}else{if(rn(C))if(L.delete(t),ce>b){Me(t,vn(void 0));return}else return ue.add(t),Me(t,gn(m)),Oe(v,C,!1,{fetcherSubmission:m,preventScrollReset:p});if(Y(C)){Ne(t,n,C.error);return}}let w=A.navigation.location||A.location,T=Vt(e.history,w,_.signal),E=s.activeRoutes,D=A.navigation.state===`idle`?A.matches:F(E,A.navigation.location,c,!1,s.branches);g(D,`Didn't find any matches after fetcher action`);let O=++se;le.set(t,O);let{dsMatches:k,revalidatingFetchers:M}=pt(T,u,a,o,e.history,A,D,m,w,r,!1,ae,oe,z,de,ue,E,c,e.patchRoutesOnNavigation!=null,s.branches,[y.route.id,C],h),ee=gn(m,C.data),N=new Map(A.fetchers);N.set(t,ee),M.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=N.get(t),r=gn(void 0,n?n.data:void 0);N.set(t,r),W(t),e.controller&&L.set(t,e.controller)}),V({fetchers:N});let te=()=>M.forEach(e=>W(e.key));_.signal.addEventListener(`abort`,te);let{loaderResults:I,fetcherResults:ne}=await Ae(k,M,T,w,u);if(_.signal.aborted)return;_.signal.removeEventListener(`abort`,te),le.delete(t),L.delete(t),M.forEach(e=>L.delete(e.key));let re=A.fetchers.has(t),ie=e=>{if(!re)return e;let n=new Map(e.fetchers);return n.set(t,vn(C.data)),{...e,fetchers:n}},R=Xt(I);if(R)return A=ie(A),Oe(T,R.result,!1,{preventScrollReset:p});if(R=Xt(ne),R)return ue.add(R.key),A=ie(A),Oe(T,R.result,!1,{preventScrollReset:p});let B=new Map(A.fetchers);re&&B.set(t,vn(C.data));let{loaderData:fe,errors:pe}=Gt(A,D,I,void 0,M,ne,B);Ue(O,B),A.navigation.state===`loading`&&O>ce?(g(j,`Expected pending action`),P&&P.abort(),_e(A.navigation.location,{matches:D,loaderData:fe,errors:pe,fetchers:B})):(V({errors:pe,loaderData:Kt(A.loaderData,fe,D,pe),fetchers:B}),ae=!1)}async function U(t,n,i,s,c,l,u,d,f){let p=A.fetchers.get(t);Me(t,gn(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=Vt(e.history,i,m.signal);if(l){let e=await Qe(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ne(t,n,e.error,{flushSync:u});return}else if(e.matches)s=e.matches;else{Ne(t,n,J(404,{pathname:i}),{flushSync:u});return}}let g=dn(s,i);L.set(t,m);let _=se,v=await ke(h,i,Mt(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(L.get(t)===m&&L.delete(t),!h.signal.aborted){if(z.has(t)){Me(t,vn(void 0));return}if(rn(y))if(ce>_){Me(t,vn(void 0));return}else{ue.add(t),await Oe(h,y,!1,{preventScrollReset:d});return}if(Y(y)){Ne(t,n,y.error);return}Me(t,vn(y.data))}}async function Oe(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:l,replace:u}={}){a||(M?.resolve(),M=null),i.response.headers.has(`X-Remix-Revalidate`)&&(ae=!0);let d=i.response.headers.get(`Location`);g(d,`Expected a Location header on the redirect Response`),d=Bt(d,new URL(r.url),c,e.history);let f=b(A.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(be(d)){let n=w(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}}P=null;let p=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:m,formAction:h,formEncType:_}=A.navigation;!o&&!s&&m&&h&&_&&(o=pn(A.navigation));let v=o||s;nt.has(i.response.status)&&v&&X(v.formMethod)?await xe(p,f,{submission:{...v,formAction:d},preventScrollReset:l||N,enableViewTransition:a?I:void 0}):await xe(p,f,{overrideNavigation:mn(f,[],p,o),fetcherSubmission:s,preventScrollReset:l||N,enableViewTransition:a?I:void 0})}async function ke(e,t,n,r,i){let a,o={};try{a=await Nt(l,e,t,n,i,r,!1)}catch(e){return n.filter(e=>
1e.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(nn(r)){let i=r.result;o[t]={type:`redirect`,response:Lt(i,e,t,n,c)}}else o[t]=await It(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 je(){ae=!0,de.forEach((e,t)=>{L.has(t)&&oe.add(t),W(t)})}function Me(e,t,n={}){let r=new Map(A.fetchers);r.set(e,t),V({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function Ne(e,t,n,r={}){let i=Jt(A.matches,t),a=new Map(A.fetchers);Le(a,e),V({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function Pe(e){return R.set(e,(R.get(e)||0)+1),z.has(e)&&z.delete(e),A.fetchers.get(e)||it}function Ie(e,t){W(e,t?.reason),Me(e,vn(null))}function Le(e,t){let n=A.fetchers.get(t);L.has(t)&&!(n&&n.state===`loading`&&le.has(t))&&W(t),de.delete(t),le.delete(t),ue.delete(t),z.delete(t),oe.delete(t),e.delete(t)}function Re(e){let t=(R.get(e)||0)-1;t<=0?(R.delete(e),z.add(e)):R.set(e,t),V({fetchers:new Map(A.fetchers)})}function W(e,t){let n=L.get(e);n&&(n.abort(t),L.delete(e))}function ze(e,t){for(let n of e){let e=t.get(n);g(e,`Expected fetcher: ${n}`);let r=vn(e.data);t.set(n,r)}}function Be(e){let t=[],n=!1;for(let r of ue){let i=e.get(r);g(i,`Expected fetcher: ${r}`),i.state===`loading`&&(ue.delete(r),t.push(r),n=!0)}return ze(t,e),n}function Ue(e,t){let n=[];for(let[r,i]of le)if(i<e){let e=t.get(r);g(e,`Expected fetcher: ${r}`),e.state===`loading`&&(W(r),le.delete(r),n.push(r))}return ze(n,t),n.length>0}function We(e,t){let n=A.blockers.get(e)||at;return B.get(e)!==t&&B.set(e,t),n}function Ge(e){A.blockers.delete(e),B.delete(e)}function G(e,t){let n=A.blockers.get(e)||at;g(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),V({blockers:r})}function K({currentLocation:e,nextLocation:t,historyAction:n}){if(B.size===0)return;B.size>1&&_(!1,`A router only supports one blocker at a time`);let r=Array.from(B.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 q(e){let t=J(404,{pathname:e}),n=s.activeRoutes,{matches:r,route:i}=Yt(n);return{notFoundMatches:r,route:i,error:t}}function qe(e,t,n){if(m=e,v=t,h=n||null,!y&&A.navigation===rt){y=!0;let e=Xe(A.location,A.matches);e!=null&&V({restoreScrollPosition:e})}return()=>{m=null,v=null,h=null}}function Je(e,t){return h&&h(e,t.map(e=>te(e,A.loaderData)))||e.key}function Ye(e,t){if(m&&v){let n=Je(e,t);m[n]=v()}}function Xe(e,t){if(m){let n=Je(e,t),r=m[n];if(typeof r==`number`)return r}return null}function Ze(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 Qe(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||yt(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&&$e(l,f.slice(0,l.length))))))return{type:`success`,matches:d};if(f||=F(s.activeRoutes,n,c,!0,u),!f||$e(l,f))return{type:`success`,matches:null};l=f}}function $e(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function et(e){o={},s.setHmrRoutes(ee(e,a,void 0,o))}function tt(e,t,n=!1){yt(e,t,s,o,a,n),s.hasHMRRoutes||V({})}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:qe,navigate:ve,fetch:Ee,revalidate:ye,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Pe,resetFetcher:Ie,deleteFetcher:Re,dispose:he,getBlocker:We,deleteBlocker:Ge,patchRoutes:tt,_internalFetchControllers:L,_internalSetRoutes:et,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){V(e)}},e.instrumentations&&(k=He(k,e.instrumentations.map(e=>
1e.router).filter(Boolean))),k}function ut(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function dt(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=Ee(r||`.`,Te(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=un(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=ye({basename:n,pathname:c.pathname})),x(c)}function ft(e,t,n){if(!n||!ut(n))return{path:t};if(n.formMethod&&!ln(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=Zt(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}\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()}}}g(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=Ht(n.formData),s=n.formData;else if(n.body instanceof FormData)o=Ht(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=Ut(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=Ut(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=S(t);return e&&l.search&&un(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:x(l),submission:c}}function pt(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=Ie(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(!mt(s))f=!1;else if(u){let{shouldLoad:e}=ht(s,a.loaderData,a.errors);f=e}else gt(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return jt(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?_t(a.matches[o],i)&&(p=!0):p=!0;let m={...O,defaultShouldRevalidate:p};return jt(n,r,e,c,k,i,l,t,vt(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=F(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=dn(b,e.path),C=new AbortController,w=Vt(i,e.path,C.signal),T=null;if(f.has(s))f.delete(s),T=Mt(n,r,w,e.path,b,S,l,t);else if(m)d&&(T=Mt(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};vt(S,a)&&(T=Mt(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 mt(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function ht(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!mt(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 gt(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function _t(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function vt(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function yt(e,t,n,r,i,a){let o;if(e){let t=r[e];g(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n.activeRoutes;let s=[],c=[];
1if(t.forEach(e=>{let t=o.find(t=>bt(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=ee(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]=ee([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 bt(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=>bt(e,t)))??!1:!1}var xt=new WeakMap,St=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(g(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=xt.get(i);o||(o={},xt.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=O(e),n=i[e]!==void 0;if(t)_(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)_(!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},Ct=new WeakMap;function wt(e,t,n,r,i){let a=n[e.id];if(g(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=Ct.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{g(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=A(e),o=a[e]!==void 0;i?_(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?_(!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 Ct.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=St({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 Tt(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 Et(e){return e.matches.some(e=>e.route.middleware)?Dt(e,()=>Tt(e)):Tt(e)}function Dt(e,t){return Ot(e,t,e=>{if(cn(e))throw e;return e},en,n);async function n(t,n,r){if(r)return Object.assign(r.value,{[n]:{type:`error`,result:t}});{let{matches:r}=e,i=Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0)),a=r[i].route.id;for(let e of r.slice(0,i+1))try{await e._lazyPromises?.route}catch{a=e.route.id;break}return{[Jt(r,a).route.id]:{type:`error`,result:t}}}}}async function Ot(e,t,n,r,i){let{matches:a,...o}=e;return await kt(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function kt(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 kt(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 At(e,t,n,r,i){let a=St({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=wt(r.route,X(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function jt(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=At(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?vt(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?vt(a,{...l,defaultShouldRevalidate:e}):vt(a,l):c}
1,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)?Pt({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 Mt(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?jt(e,t,n,r,Ie(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:At(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function Nt(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:Le(t,n),pattern:Ie(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 Dt(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 Pt({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:Le(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 Ft(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 It(e){let{result:t,type:n}=e;if(on(t)){let e;try{e=await Ft(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new Pe(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?an(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:$t(t),statusCode:Fe(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:Fe(t)?t.status:void 0}:an(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 Lt(e,t,n,r,i){let a=e.headers.get(`Location`);if(g(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!be(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=dt(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var Rt=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function zt(e){try{return Rt.includes(new URL(e).protocol)}catch{return!1}}function Bt(e,t,n,r){if(be(e)){let r=e,i=d.test(r)?new URL(f(r,t.protocol)):new URL(r);if(zt(i.toString()))throw Error(`Invalid redirect location`);let a=H(i.pathname,n)!=null;if(i.origin===t.origin&&a)return De(i.pathname)+i.search+i.hash}try{if(zt(r.createURL(e).toString()))throw Error(`Invalid redirect location`)}catch{}return e}function Vt(e,t,n,r){let i=e.createURL(Zt(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=Ht(r.formData):a.body=r.formData}
1return new Request(i,a)}function Ht(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function Ut(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Wt(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(g(!rn(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=Jt(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=st),c||(c=!0,s=Fe(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 Gt(e,t,n,r,i,a,o){let{loaderData:s,errors:c}=Wt(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(g(s,`Did not find corresponding fetcher result`),Y(s)){let t=Jt(e.matches,r?.route.id);c&&c[t.route.id]||(c={...c,[t.route.id]:s.error}),o.delete(n)}else if(rn(s))g(!1,`Unhandled fetcher revalidation redirect`);else{let e=vn(s.data);o.set(n,e)}}),{loaderData:s,errors:c}}function Kt(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==st).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 qt(e){return e?Y(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Jt(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.ErrorBoundary!=null||e.route.errorElement!=null)||e[0]}function Yt(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 Pe(e||500,o,Error(s),!0)}function Xt(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(rn(r))return{key:n,result:r}}}function Zt(e){return x({...typeof e==`string`?S(e):e,hash:``})}function Qt(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash?!0:t.hash!==``}function $t(e){return new Pe(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function en(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&tn(t))}function tn(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function nn(e){return on(e.result)&&tt.has(e.result.status)}function Y(e){return e.type===`error`}function rn(e){return(e&&e.type)===`redirect`}function an(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function on(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function sn(e){return tt.has(e)}function cn(e){return on(e)&&sn(e.status)&&e.headers.has(`Location`)}function ln(e){return et.has(e.toUpperCase())}function X(e){return Qe.has(e.toUpperCase())}function un(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function dn(e,t){let n=typeof t==`string`?S(t).search:t.search;if(e[e.length-1].route.index&&un(n||``))return e[e.length-1];let r=we(e);return r[r.length-1]}function fn(e,t,n){return{url:Le(e.createURL(t),t),pattern:n?Ie(n):``,params:n?.[0]?.params?{...n[0].params}:{}}}function pn(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 mn(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 hn(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 gn(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 _n(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 vn(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 yn(e,t){try{let n=e.sessionStorage.getItem(ot);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 bn(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(ot,JSON.stringify(n))}catch(e){_(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function xn(){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 Sn=T.createContext(null);Sn.displayName=`DataRouter`;var Cn=T.createContext(null);Cn.displayName=`DataRouterState`;var wn=T.createContext(!1);function Tn(){return T.useContext(wn)}var En=T.createContext({isTransitioning:!1});En.displayName=`ViewTransition`;var Dn=T.createContext(new Map);Dn.displayName=`Fetchers`;var On=T.createContext(null);On.displayName=`Await`;var Z=T.createContext(null);Z.displayName=`Navigation`;var kn=T.createContext(null);kn.displayName=`Location`;var Q=T.createContext({outlet:null,matches:[],isDataRoute:!1});Q.displayName=`Route`;var An=T.createContext(null);An.displayName=`RouteError`;var jn=`REACT_ROUTER_ERROR`,Mn=`REDIRECT`,Nn=`ROUTE_ERROR_RESPONSE`;function Pn(e){if(e.startsWith(`${jn}:${Mn}:{`))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 Fn(e){if(e.startsWith(`${jn}:${Nn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Pe(t.status,t.statusText,t.data)}catch{}}function In(e,{relative:t}={}){g(Ln(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=T.useContext(Z),{hash:i,pathname:a,search:o}=Gn(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:U([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Ln(){return T.useContext(kn)!=null}
1function $(){return g(Ln(),`useLocation() may be used only in the context of a <Router> component.`),T.useContext(kn).location}function Rn(e){g(Ln(),`useMatch() may be used only in the context of a <Router> component.`);let{pathname:t}=$();return T.useMemo(()=>ge(e,ve(t)),[t,e])}var zn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Bn(){let{isDataRoute:e}=T.useContext(Q);return e?dr():Vn()}function Vn(){g(Ln(),`useNavigate() may be used only in the context of a <Router> component.`);let e=T.useContext(Sn),{basename:t,navigator:n}=T.useContext(Z),{matches:r}=T.useContext(Q),{pathname:i}=$(),a=JSON.stringify(Te(r)),o=T.useRef(!1);return T.useLayoutEffect(()=>{o.current=!0}),T.useCallback((r,s={})=>{if(_(o.current,zn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Ee(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:U([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Hn=T.createContext(null);function Un(e){let t=T.useContext(Q).outlet;return T.useMemo(()=>t&&T.createElement(Hn.Provider,{value:e},t),[t,e])}function Wn(){let{matches:e}=T.useContext(Q);return e[e.length-1]?.params??{}}function Gn(e,{relative:t}={}){let{matches:n}=T.useContext(Q),{pathname:r}=$(),i=JSON.stringify(Te(n));return T.useMemo(()=>Ee(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Kn(e,t,n){g(Ln(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=T.useContext(Z),{matches:i}=T.useContext(Q),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let c=$(),l;if(t){let e=typeof t==`string`?S(t):t;g(s===`/`||e.pathname?.startsWith(s),`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 "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),l=e}else l=c;let u=l.pathname||`/`,d=u;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);d=`/`+u.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let f=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):P(e,{pathname:d}),p=$n(f&&f.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:U([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:U([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&p?T.createElement(kn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...l},navigationType:`POP`}},p):p}function qn(){let e=cr(),t=Fe(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return T.createElement(T.Fragment,null,T.createElement(`h2`,null,`Unexpected Application Error!`),T.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?T.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var Jn=T.createElement(qn,null),Yn=class extends T.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=wn;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=Fn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:T.createElement(Q.Provider,{value:this.props.routeContext},T.createElement(An.Provider,{value:e,children:this.props.component}));return this.context?T.createElement(Zn,{error:e},t):t}},Xn=new WeakMap;function Zn({children:e,error:t}){let{basename:n}=T.useContext(Z);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Pn(t.digest);if(e){let r=Xn.get(t);if(r)throw r;let i=W(e.location,n),a=i.absoluteURL||i.to;
1if(zt(a))throw Error(`Invalid redirect location`);if(Re&&!Xn.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw Xn.set(t,n),n}return T.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function Qn({routeContext:e,match:t,children:n}){let r=T.useContext(Sn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),T.createElement(Q.Provider,{value:e},n)}function $n(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);g(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Ie(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Jn,o&&(s<0&&c===0?(pr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?T.createElement(n.route.Component,null):n.route.element?n.route.element:e,T.createElement(Qn,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?T.createElement(Yn,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function er(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function tr(e){let t=T.useContext(Sn);return g(t,er(e)),t}function nr(e){let t=T.useContext(Cn);return g(t,er(e)),t}function rr(e){let t=T.useContext(Q);return g(t,er(e)),t}function ir(e){let t=rr(e),n=t.matches[t.matches.length-1];return g(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ar(){return ir(`useRouteId`)}function or(){let e=nr(`useNavigation`);return T.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function sr(){let{matches:e,loaderData:t}=nr(`useMatches`);return T.useMemo(()=>e.map(e=>te(e,t)),[e,t])}function cr(){let e=T.useContext(An),t=nr(`useRouteError`),n=ir(`useRouteError`);return e===void 0?t.errors?.[n]:e}var lr=0;function ur(e){let{router:t,basename:n}=tr(`useBlocker`),r=nr(`useBlocker`),[i,a]=T.useState(``),o=T.useCallback(t=>{if(typeof e!=`function`)return!!e;if(n===`/`)return e(t);let{currentLocation:r,nextLocation:i,historyAction:a}=t;return e({currentLocation:{...r,pathname:H(r.pathname,n)||r.pathname},nextLocation:{...i,pathname:H(i.pathname,n)||i.pathname},historyAction:a})},[n,e]);return T.useEffect(()=>{let e=String(++lr);return a(e),()=>t.deleteBlocker(e)},[t]),T.useEffect(()=>{i!==``&&t.getBlocker(i,o)},[t,i,o]),i&&r.blockers.has(i)?r.blockers.get(i):at}function dr(){let{router:e}=tr(`useNavigate`),t=ir(`useNavigate`),n=T.useRef(!1);return T.useLayoutEffect(()=>{n.current=!0}),T.useCallback(async(r,i={})=>{_(n.current,zn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var fr={};function pr(e,t,n){!t&&!fr[e]&&(fr[e]=!0,_(!1,n))}var mr={};function hr(e,t){!e&&!mr[t]&&(mr[t]=!0,console.warn(t))}var gr=[`HydrateFallback`,`hydrateFallbackElement`],_r=class{status=`pending`;promise;resolve;reject;
1constructor(){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 vr({router:e,flushSync:t,onError:n,useTransitions:r}){r=Tn()||r;let[i,a]=T.useState(e.state),[o,s]=(0,T.useOptimistic)(i),[c,l]=T.useState(),[u,d]=T.useState({isTransitioning:!1}),[f,p]=T.useState(),[m,h]=T.useState(),[g,_]=T.useState(),v=T.useRef(new Map),y=T.useCallback((i,{deletedFetchers:o,newErrors:c,flushSync:u,viewTransitionOpts:g})=>{c&&n&&Object.values(c).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},pattern:Ie(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&v.current.set(t,e.data)}),o.forEach(e=>v.current.delete(e)),hr(u===!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 y=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(hr(g==null||y,"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."),!g||!y){t&&u?t(()=>a(i)):r===!1?a(i):T.startTransition(()=>{r===!0&&s(e=>yr(e,i)),a(i)});return}if(t&&u){t(()=>{m&&(f?.resolve(),m.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});n.finished.finally(()=>{t(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})})}),t(()=>h(n));return}m?(f?.resolve(),m.skipTransition(),_({state:i,currentLocation:g.currentLocation,nextLocation:g.nextLocation})):(l(i),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}))},[e.window,t,m,f,r,s,n]);T.useLayoutEffect(()=>e.subscribe(y),[e,y]),T.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new _r)},[u]),T.useEffect(()=>{if(f&&c&&e.window){let t=c,n=f.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):T.startTransition(()=>{r===!0&&s(e=>yr(e,t)),a(t)}),await n});i.finished.finally(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})}),h(i)}},[c,f,e.window,r,s]),T.useEffect(()=>{f&&c&&o.location.key===c.location.key&&f.resolve()},[f,m,o.location,c]),T.useEffect(()=>{!u.isTransitioning&&g&&(l(g.state),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),_(void 0))},[u.isTransitioning,g]);let b=T.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]),x=e.basename||`/`,S=T.useMemo(()=>({router:e,navigator:b,static:!1,basename:x,onError:n}),[e,b,x,n]);return T.createElement(T.Fragment,null,T.createElement(Sn.Provider,{value:S},T.createElement(Cn.Provider,{value:o},T.createElement(Dn.Provider,{value:v.current},T.createElement(En.Provider,{value:u},T.createElement(Tr,{basename:x,location:o.location,navigationType:o.historyAction,navigator:b,useTransitions:r},T.createElement(br,{routes:e.routes,manifest:e.manifest,future:e.future,state:o,isStatic:!1,onError:n})))))),null)}function yr(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 br=T.memo(xr);function xr({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Kn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Sr({to:e,replace:t,state:n,relative:r}){g(Ln(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=T.useContext(Z);_(!i,`<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:a}=T.useContext(Q),{pathname:o}=$(),s=Bn(),c=Ee(e,Te(a),o,r===`path`),l=JSON.stringify(c);return T.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Cr(e){return Un(e.context)}function wr(e){g(!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 Tr({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){g(!Ln(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=T.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=S(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=T.useMemo(()=>{let e=H(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);
1return _(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:T.createElement(Z.Provider,{value:c},T.createElement(kn.Provider,{children:t,value:h}))}T.Component;function Er(e,t=[]){let n=[];return T.Children.forEach(e,(e,r)=>{if(!T.isValidElement(e))return;let i=[...t,r];if(e.type===T.Fragment){n.push.apply(n,Er(e.props.children,i));return}g(e.type===wr,`[${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>`);let a=e.props;g(!a.index||!a.children,`An index route cannot have child routes.`);let o={id:a.id||i.join(`-`),caseSensitive:a.caseSensitive,element:a.element,Component:a.Component,index:a.index,path:a.path,middleware:a.middleware,loader:a.loader,action:a.action,hydrateFallbackElement:a.hydrateFallbackElement,HydrateFallback:a.HydrateFallback,errorElement:a.errorElement,ErrorBoundary:a.ErrorBoundary,shouldRevalidate:a.shouldRevalidate,handle:a.handle,lazy:a.lazy};a.children&&(o.children=Er(a.children,i)),n.push(o)}),n}var Dr=Er,Or=`application/x-www-form-urlencoded`;function kr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Ar(e){return kr(e)&&e.tagName.toLowerCase()===`button`}function jr(e){return kr(e)&&e.tagName.toLowerCase()===`form`}function Mr(e){return kr(e)&&e.tagName.toLowerCase()===`input`}function Nr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Pr(e,t){return e.button===0&&(!t||t===`_self`)&&!Nr(e)}function Fr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Ir(e,t){let n=Fr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Lr=null;function Rr(){if(Lr===null)try{new FormData(document.createElement(`form`),0),Lr=!1}catch{Lr=!0}return Lr}var zr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Br(e){return e!=null&&!zr.has(e)?(_(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Or}"`),null):e}function Vr(e,t){let n,r,i,a,o;if(jr(e)){let o=e.getAttribute(`action`);r=o?H(o,t):null,n=e.getAttribute(`method`)||`get`,i=Br(e.getAttribute(`enctype`))||Or,a=new FormData(e)}else if(Ar(e)||Mr(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`)||`get`,i=Br(e.getAttribute(`formenctype`))||Br(o.getAttribute(`enctype`))||Or,a=new FormData(o,e),!Rr()){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(kr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=Or,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}function Hr(e,t){if(e===!1||e==null)throw Error(t)}var Ur={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Wr=/[&><\u2028\u2029]/g;function Gr(e){return e.replace(Wr,e=>Ur[e])}function Kr(e,t){let n=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n.pathname.endsWith(`/`)?n.pathname=`${n.pathname}_.${t}`:n.pathname=`${n.pathname}.${t}`,n}var qr=`modulepreload`,Jr=function(e){return`/`+e},Yr={},Xr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Jr(t,n),t in Yr)return;Yr[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:qr,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n
1)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};async function Zr(e,t){if(e.id in t)return t[e.id];try{let n=await Xr(()=>import(e.module),[]);return t[e.id]=n,n}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 Qr(e){return e!=null&&typeof e.page==`string`}function $r(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 ei(e,t,n){return ai((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($r).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function ti(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 ni(e,t,{includeHydrateFallback:n}={}){return ri(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 ri(e){return[...new Set(e)]}function ii(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function ai(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Qr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(ii(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function oi(){let e=T.useContext(Sn);return Hr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function si(){let e=T.useContext(Cn);return Hr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var ci=T.createContext(void 0);ci.displayName=`FrameworkContext`;function li(){let e=T.useContext(ci);return Hr(e,`You must render this element inside a <HydratedRouter> element`),e}function ui(e,t){let n=T.useContext(ci),[r,i]=T.useState(!1),[a,o]=T.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=T.useRef(null);T.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),T.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:di(s,p),onBlur:di(c,m),onMouseEnter:di(l,p),onMouseLeave:di(u,m),onTouchStart:di(d,p)}]:[a,f,{}]:[!1,f,{}]}function di(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function fi({page:e,...t}){let n=Tn(),{nonce:r}=li(),{router:i}=oi(),a=T.useMemo(()=>P(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?T.createElement(mi,{page:e,matches:a,...t}):T.createElement(hi,{page:e,matches:a,...t})):null}function pi(e){let{manifest:t,routeModules:n}=li(),[r,i]=T.useState([]);return T.useEffect(()=>{let r=!1;
1return ei(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function mi({page:e,matches:t,...n}){let r=$(),i=T.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Kr(e,`rsc`),i=!1,a=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?i=!0:a.push(e.route.id);return i&&a.length>0&&n.searchParams.set(`_routes`,a.join(`,`)),[n.pathname+n.search]},[e,r,t]);return T.createElement(T.Fragment,null,i.map(e=>T.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function hi({page:e,matches:t,...n}){let r=$(),{manifest:i,routeModules:a}=li(),{loaderData:o,matches:s}=si(),c=T.useMemo(()=>ti(e,t,s,i,r,`data`),[e,t,s,i,r]),l=T.useMemo(()=>ti(e,t,s,i,r,`assets`),[e,t,s,i,r]),u=T.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];!t||!t.hasLoader||(!c.some(t=>t.route.id===e.route.id)&&e.route.id in o&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let l=Kr(e,`data`);return s&&n.size>0&&l.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[l.pathname+l.search]},[o,r,i,c,t,e,a]),d=T.useMemo(()=>ni(l,i),[l,i]),f=pi(l);return T.createElement(T.Fragment,null,u.map(e=>T.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),d.map(e=>T.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),f.map(({key:e,link:t})=>T.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function gi(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var _i=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{_i&&(window.__reactRouterVersion=`8.3.0`)}catch{}function vi(e,t){return lt({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:h({window:t?.window}),hydrationData:t?.hydrationData||yi(),routes:e,mapRouteProperties:M,hydrationRouteProperties:gr,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function yi(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:bi(e.errors)}),e}function bi(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 Pe(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&Ne.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 xi({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=T.useState({action:n.action,location:n.location}),o=T.useCallback(e=>{r===!1?a(e):T.startTransition(()=>a(e))},[r]);return T.useLayoutEffect(()=>n.listen(o),[n,o]),T.createElement(Tr,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}xi.displayName=`unstable_HistoryRouter`;var Si=T.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h){let{basename:g,navigator:_,useTransitions:v}=T.useContext(Z),y=typeof l==`string`&&u.test(l),b=W(l,g);l=b.to;let x=In(l,{relative:r}),S=$(),C=null;if(o){let e=Ee(o,[],S.mask?S.mask.pathname:`/`,!0);g!==`/`&&(e.pathname=e.pathname===`/`?g:U([g,e.pathname])),C=_.createHref(e)}let[w,E,D]=ui(n,m),O=ki(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:d,relative:r,viewTransition:f,defaultShouldRevalidate:p,useTransitions:v});function k(t){e&&e(t),t.defaultPrevented||O(t)}let A=!(b.isExternal||i),j=T.createElement(`a`,{...m,...D,href:(A?C:void 0)||b.absoluteURL||x,onClick:A?k:e,ref:gi(h,E),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?T.createElement(T.Fragment,null,j,T.createElement(fi,{page:x})):j});Si.displayName=`Link`;var Ci=T.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Gn(a,{relative:c.relative}),d=$(),f=T.useContext(Cn),{navigator:p,basename:m}=T.useContext(Z),h=f!=null&&Bi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.n
1avigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=H(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(y)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(S):i;return T.createElement(Si,{...c,"aria-current":C,className:w,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(S):s)});Ci.displayName=`NavLink`;var wi=T.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=`get`,action:s,onSubmit:c,relative:l,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h)=>{let{useTransitions:g}=T.useContext(Z),_=Ni(),v=Pi(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&u.test(s);return T.createElement(`form`,{ref:h,method:y,action:v,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,u=()=>_(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p});g&&n!==!1?T.startTransition(()=>u()):u()},...m,"data-discover":!b&&e===`render`?`true`:void 0})});wi.displayName=`Form`;function Ti({getKey:e,storageKey:t,...n}){let r=T.useContext(ci),{basename:i}=T.useContext(Z),a=$(),o=sr();Ri({getKey:e,storageKey:t});let s=T.useMemo(()=>{if(!r||!e)return null;let t=Li(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((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];
1typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),T.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Gr(JSON.stringify(t||Fi))}, ${Gr(JSON.stringify(s))})`}})}Ti.displayName=`ScrollRestoration`;function Ei(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Di(e){let t=T.useContext(Sn);return g(t,Ei(e)),t}function Oi(e){let t=T.useContext(Cn);return g(t,Ei(e)),t}function ki(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Bn(),d=$(),f=Gn(e,{relative:o});return T.useCallback(p=>{if(Pr(p,t)){p.preventDefault();let t=n===void 0?x(d)===x(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?T.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Ai(e){_(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=T.useRef(Fr(e)),n=T.useRef(!1),r=$(),i=T.useMemo(()=>Ir(r.search,n.current?null:t.current),[r.search]),a=Bn();return[i,T.useCallback((e,t)=>{let r=Fr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var ji=0,Mi=()=>`__${String(++ji)}__`;function Ni(){let{router:e}=Di(`useSubmit`),{basename:t}=T.useContext(Z),n=ar(),r=e.fetch,i=e.navigate;return T.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Vr(e,t);a.navigate===!1?await r(a.fetcherKey||Mi(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Pi(e,{relative:t}={}){let{basename:n}=T.useContext(Z),r=T.useContext(Q);g(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Gn(e||`.`,{relative:t})},o=$();if(e==null){a.search=o.search;let e=new URLSearchParams(a.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();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:U([n,a.pathname])),x(a)}var Fi=`react-router-scroll-positions`,Ii={};function Li(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 Ri({getKey:e,storageKey:t}={}){let{router:n}=Di(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Oi(`useScrollRestoration`),{basename:a}=T.useContext(Z),o=$(),s=sr(),c=or();T.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),zi(T.useCallback(()=>{if(c.state===`idle`){let t=Li(o,s,a,e);Ii[t]=window.scrollY}try{sessionStorage.setItem(t||Fi,JSON.stringify(Ii))}catch(e){_(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(T.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Fi);e&&(Ii=JSON.parse(e))}catch{}},[t]),T.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Ii,()=>window.scrollY,e?(t,n)=>Li(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),T.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{_(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function zi(e,t){let{capture:n}=t||{};T.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Bi(e,{relative:t}={}){let n=T.useContext(En);g(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Di(`useViewTransitionState`),i=Gn(e,{relative:t});if(!n.isTransitioning)return!1;let a=H(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=H(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ge(i.pathname,o)!=null||ge(i.pathname,a)!=null}var Vi=`/site/:siteId/:group`,Hi=`${Vi}/:page?/:subpage?/:detail?`,Ui=`/companies/:companyId/:page/:subpage?/*`,W
1i=`/:tab/:page`,Gi=/^[A-Za-z0-9_+.!#$'^`~@-]+$/,Ki=/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z\d]).{8,}$/,qi=/^(?!.*\.\.)([a-z0-9][a-z0-9._%+-]{0,62}[a-z0-9])@([a-z0-9.-]+\.[a-z]{2,})$/i,Ji=`((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}`,Yi=RegExp(`^${Ji}$`),Xi=RegExp(`^${Ji}\\/(3[0-2]|[12]\\d|\\d)$`),Zi=[`downlink-alarm-level`,`uplink-alarm-level`],Qi={seconds:`seconds`,minutes:`minutes`,hours:`hours`,days:`days`},$i={required:{value:!0,message:t.t(`common:fields.email.required`)},pattern:{value:qi,message:t.t(`common:fields.email.invalid`)},maxLength:{value:254,message:t.t(`common:fields.email.max_length`)}},ea={required:{value:!0,message:t.t(`common:fields.username.required`)},maxLength:{value:32,message:t.t(`common:fields.username.max_length`)},validate:e=>{if(!Gi.test(e))return t.t(`common:fields.username.invalid`)}},ta=i(30),na=e(s()),ra=a(),ia=`/helios-api/metadata/`,aa=(0,T.createContext)(null),oa=({children:e})=>{let[{data:t,error:n}]=l(ia),r=(0,T.useMemo)(()=>{if(t)return t;if(n)return(0,na.default)(`send`,{error:n,customData:[{description:`Unable to load metadata, providing fallback`}]}),{version:`unknown`,schema_version:0,auth0_enabled:!0,env:null,deployment:void 0}},[t,n]);return r?(0,ra.jsx)(aa,{value:r,children:e}):(0,ra.jsx)(ra.Fragment,{})},sa=()=>{let e=T.useContext(aa);if(!e)throw Error(`useMetadataContext must be used within a MetadataProvider`);return e},ca=function(e){return e[e.UNKNOWN=0]=`UNKNOWN`,e[e.AUTHENTICATED=1]=`AUTHENTICATED`,e[e.UNAUTHENTICATED=2]=`UNAUTHENTICATED`,e[e.ERROR=3]=`ERROR`,e}({}),la=`${window.location.protocol}//${window.location.host}`,ua=`${la}/helios-api/auth0/login?ui_request=true`,da=`${la}/helios-api/auth0/logout?ui_request=true`,fa=()=>({goToLogin:(e=`/`)=>{let t=crypto.randomUUID();sessionStorage.setItem(t,e),window.location.href=`${ua}&state=${t}`},logout:()=>window.location.href=da}),pa=`/helios-api/auth/login`,ma=`local_auth_return_path`,ha=()=>{let e=(e=`/`)=>{sessionStorage.setItem(ma,e),window.location.href=`/login`};return{goToLogin:e,login:async(e,t)=>{await r.post(pa,{login:e,password:t});let n=sessionStorage.getItem(ma)||`/sites`;sessionStorage.removeItem(ma),window.location.href=n},logout:async(t,n)=>{await r.delete(pa),t?window.location.reload():e(n)}}},ga=e(o()),_a={get sdk(){return globalThis.zE||ga.noop}};function va(e){_a.sdk(`webWidget`,`updateSettings`,{webWidget:{position:{horizontal:e}}})}var ya=e=>{_a.sdk(`webWidget`,`prefill`,{name:{value:e.full_name},email:{value:e.email}})},ba=e=>{_a.sdk(`webWidget`,`prefill`,{version:{value:e}})},xa=()=>_a.sdk(`webWidget`,`hide`),Sa=()=>_a.sdk(`webWidget`,`show`),Ca=()=>{let e=sr().filter(e=>e.handle?.zendeskHorizPosition).at(-1)?.handle.zendeskHorizPosition||`right`;return va(e),{setZendeskHorizPosition:e=>{va(e)},resetZendeskHorizPosition:()=>{va(e)}}},wa=e=>e?.email.includes(`@bigleaf.net`)||!1,Ta=(0,T.createContext)(null),Ea=`/helios-api/auth/account`,Da=({children:e})=>{let t=sa(),[n,r]=(0,T.useState)(ca.UNKNOWN),[i,a]=(0,T.useState)(void 0),[,o]=l(Ea,!0),s=(0,T.useMemo)(()=>i&&wa(i?.proxy_user||i),[i]);(0,T.useEffect)(()=>{i&&((0,na.default)(`setUser`,{identifier:`${i.account_id}`,isAnonymous:!1,email:i.email,fullName:i.full_name}),ya(i))},[i]),(0,T.useEffect)(()=>{let e=c.subscribe(`unauthorizedError`,()=>{r(ca.UNAUTHENTICATED)});return()=>{e()}},[]);let u=(0,T.useCallback)(async()=>{try{a(await o()),r(ca.AUTHENTICATED)}catch(e){let t=e?.response?.status;r(t==401?ca.UNAUTHENTICATED:t?ca.ERROR:ca.UNKNOWN)}},[o]),d=t.auth0_enabled?fa():ha(),f=d.goToLogin,p=d.login;return(0,ra.jsx)(Ta,{value:{goToLogin:f,login:p,logout:e=>{(0,na.default)(`endSession`),d.logout(!!i?.proxy_user,e)},authState:n,account:i,loadAccount:u,isEnvOp:s},children:e})},Oa=()=>{let e=T.useContext(Ta);if(!e)throw Error(`useAuthContext must be used within an AuthProvider`);return e};export{wr as A,cr as B,Si as C,Xr as D,Ai as E,$ as F,Fe as H,Rn as I,sr as L,Dr as M,ur as N,Sr as O,In as P,Bn as R,ea as S,vi as T,ge as U,he as V,Me as W,Yi as _,Sa as a,Hi as b,oa as c,Vi as d,Xi as f,ta as g,$i as h,ba as i,vr as j,Cr as k,sa as l,qi as m,Oa as n,Ca as o,Ui as p,xa as r,ca as
1s,Da as t,Zi as u,Wi as v,Ci as w,Qi as x,Ki as y,Wn as z}; 2//# sourceMappingURL=AuthContext-BXZ0ZysB.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.