const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActionListItem-BJe01BGx.css","./DataListItemRow-0rnekGZx.css","./GroupPickerDialog-Dl_Lyzxi.css","./RoleMapping-Cz6tDcfR.css","./CodeEditor-YFvMvTG9.css","./DynamicComponents-DniN0CZn.css","./Tabs-ViNVmBYo.css","./ExpandableSection-Bbwii8N8.css","./Brand-aJQZaPjg.css","./DescriptionListTerm-DesQLGah.css","./Dashboard-BZlCREjn.css","./ViewHeader-BI0nMf5o.css","./FormAccess-BlCP4WRm.css","./Policies-FOBt4pOD.css","./AuthenticationSection-BnNz5huK.css","./Droppable-RFYrRrY9.css","./ToggleGroup-CTQqqZpK.css","./FlowDetails-Co6_ZaUN.css","./DropdownPanel-CO8imIg3.css","./DatePicker-BNaUop93.css","./AdminEvents-B_cz1hFf.css","./NewClientForm-C8TYIpRU.css","./PermissionTab-CIKqlXCr.css","./RolesList-CWiFlrTF.css","./NewPolicyDialog-DcIJAJkD.css","./Policies-54ZJmY_B.css","./ClientDetails-XXut5S9Q.css","./AttributeForm-YNWXrEWO.css","./ResourceDetails-jgm_B1Y8.css","./GroupsSection-CTVp1kn_.css","./discovery-settings-BdYoyeo1.css","./SamlGeneralSettings-Co50-Ouz.css","./ClickableCard-CFW7bC3I.css","./realm-settings-section-BuAKUDFS.css","./userProfileMetadata-CWZi8ycW.css","./RealmSettingsSection-CK9PwWh7.css","./SessionsSection-1P3dU17n.css","./SettingsCache-E5eDqPG-.css","./CustomProviderSettings-DOKoGkC0.css","./UserFederationSection-DmSRQBjS.css","./user-section-DQytkT-6.css","./EditUser-DBs3-mDj.css"])))=>i.map(i=>d[i]); import{jsx as b,jsxs as be,Fragment as $n}from"react/jsx-runtime";import*as d from"react";import oe,{createContext as Nf,useContext as Fl,useMemo as Et,useRef as kt,useCallback as Ct,useState as Pe,useEffect as _t,forwardRef as Af,useImperativeHandle as mw,useReducer as _1,Fragment as Lf,isValidElement as hw,Children as gw,useId as vw,Component as C1,lazy as re,Suspense as R1,StrictMode as P1}from"react";import*as jl from"react-dom";import T1 from"react-dom";var na=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Df(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cs={},xh;function I1(){if(xh)return Cs;xh=1;var e=T1;return Cs.createRoot=e.createRoot,Cs.hydrateRoot=e.hydrateRoot,Cs}var k1=I1();var bw=e=>{throw TypeError(e)},yw=(e,t,n)=>t.has(e)||bw("Cannot "+n),yn=(e,t,n)=>(yw(e,t,"read from private field"),n?n.call(e):t.get(e)),fo=(e,t,n)=>t.has(e)?bw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),tr=(e,t,n,r)=>(yw(e,t,"write to private field"),t.set(e,n),n),Vl=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Mf=/^[\\/]{2}/;function ww(e,t){return t+e.replace(/\\/g,"/")}var Eh="popstate";function Oh(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function N1(e={}){function t(a,i){let{pathname:o="/",search:s="",hash:l=""}=Hn(a.location.hash.substring(1));return!o.startsWith("/")&&!o.startsWith(".")&&(o="/"+o),Mo("",{pathname:o,search:s,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(a,i){let o=a.document.querySelector("base"),s="";if(o&&o.getAttribute("href")){let l=a.location.href,c=l.indexOf("#");s=c===-1?l:l.slice(0,c)}return s+"#"+(typeof i=="string"?i:pr(i))}function r(a,i){xt(a.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(i)})`)}return L1(t,n,r,e)}function ze(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function xt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function A1(){return Math.random().toString(36).substring(2,10)}function Sh(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 Mo(e,t,n=null,r,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Hn(t):t,state:n,key:t&&t.key||r||A1(),mask:a}}function pr({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 Hn(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 L1(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,s="POP",l=null,c=u();c==null&&(c=0,o.replaceState({...o.state,idx:c},""));function u(){return(o.state||{idx:null}).idx}function p(){s="POP";let v=u(),w=v==null?null:v-c;c=v,l&&l({action:s,location:g.location,delta:w})}function f(v,w){s="PUSH";let y=Oh(v)?v:Mo(g.location,v,w);n&&n(y,v),c=u()+1;let R=Sh(y,c),E=g.createHref(y.mask||y);try{o.pushState(R,"",E)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;a.location.assign(E)}i&&l&&l({action:s,location:g.location,delta:1})}function m(v,w){s="REPLACE";let y=Oh(v)?v:Mo(g.location,v,w);n&&n(y,v),c=u();let R=Sh(y,c),E=g.createHref(y.mask||y);o.replaceState(R,"",E),i&&l&&l({action:s,location:g.location,delta:0})}function h(v){return xw(a,v)}let g={get action(){return s},get location(){return e(a,o)},listen(v){if(l)throw new Error("A history only accepts one active listener");return a.addEventListener(Eh,p),l=v,()=>{a.removeEventListener(Eh,p),l=null}},createHref(v){return t(a,v)},createURL:h,encodeLocation(v){let w=h(v);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:f,replace:m,go(v){return o.go(v)}};return g}function xw(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),ze(r,"No window.location.(origin|href) available to create URL");let a=typeof t=="string"?t:pr(t);return a=a.replace(/ $/,"%20"),!n&&Mf.test(a)&&(a=r+a),new URL(a,r)}var mo,_h=class{constructor(e){if(fo(this,mo,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(yn(this,mo).has(e))return yn(this,mo).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){yn(this,mo).set(e,t)}};mo=new WeakMap;var D1=new Set(["lazy","caseSensitive","path","id","index","children"]);function M1(e){return D1.has(e)}var F1=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function j1(e){return F1.has(e)}function V1(e){return e.index===!0}function Fo(e,t,n=[],r={},a=!1){return e.map((i,o)=>{let s=[...n,String(o)],l=typeof i.id=="string"?i.id:s.join("-");if(ze(i.index!==!0||!i.children,"Cannot specify children on an index route"),ze(a||!r[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),V1(i)){let c={...i,id:l};return r[l]=Ch(c,t(c)),c}else{let c={...i,id:l,children:void 0};return r[l]=Ch(c,t(c)),i.children&&(c.children=Fo(i.children,t,s,r,a)),c}})}function Ch(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function Ew(e,t,n="/"){return Dn(e,t,n,!1)}function Dn(e,t,n,r,a){let i=typeof t=="string"?Hn(t):t,o=Pn(i.pathname||"/",n);if(o==null)return null;let s=a??zs(e),l=null,c=Pw(o);for(let u=0;l==null&&u{let u={relativePath:c===void 0?o.path||"":c,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(r)&&l)return;ze(u.relativePath.startsWith(r),`Absolute route path "${u.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(r.length)}let p=Sn([r,u.relativePath]),f=n.concat(u);o.children&&o.children.length>0&&(ze(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),Sw(o.children,t,f,p,l)),!(o.path==null&&!o.index)&&t.push({path:p,score:H1(p,o.index),routesMeta:f.map((m,h)=>{let[g,v]=Rw(m.relativePath,m.caseSensitive,h===f.length-1);return{...m,matcher:g,compiledParams:v}})})};return e.forEach((o,s)=>{if(o.path===""||!o.path?.includes("?"))i(o,s);else for(let l of _w(o.path))i(o,s,!0,l)}),t}function _w(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let o=_w(r.join("/")),s=[];return s.push(...o.map(l=>l===""?i:[i,l].join("/"))),a&&s.push(...o),s.map(l=>e.startsWith("/")&&l===""?"/":l)}function B1(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:W1(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var U1=/^:[\w-]+$/,$1=3,z1=2,q1=1,K1=10,G1=-2,Rh=e=>e==="*";function H1(e,t){let n=e.split("/"),r=n.length;return n.some(Rh)&&(r+=G1),t&&(r+=z1),n.filter(a=>!Rh(a)).reduce((a,i)=>a+(U1.test(i)?$1:i===""?q1:K1),r)}function W1(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function X1(e,t,n=!1){let{routesMeta:r}=e,a={},i="/",o=[];for(let s=0;so==null?"":typeof o=="string"?o:String(o),i=n.split(/\/+/).map((o,s,l)=>{if(s===l.length-1&&o==="*")return a(t["*"]);const u=o.match(/^:([\w-]+)(\??)(.*)/);if(u){const[,p,f,m]=u;let h=t[p];return ze(f==="?"||h!=null,`Missing ":${p}" param`),encodeURIComponent(a(h))+m}return o.replace(/\?$/g,"")}).filter(o=>!!o);return r+i.join("/")}function Ci(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Rw(e.path,e.caseSensitive,e.end);return Cw(e,t,n,r)}function Cw(e,t,n,r){let a=t.match(n);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),s=a.slice(1);return{params:r.reduce((c,{paramName:u,isOptional:p},f)=>{if(u==="*"){let h=s[f]||"";o=i.slice(0,i.length-h.length).replace(/(.)\/+$/,"$1")}const m=s[f];return p&&!m?c[u]=void 0:c[u]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:o,pattern:e}}function Rw(e,t=!1,n=!0){xt(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=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,s,l,c,u)=>{if(r.push({paramName:s,isOptional:l!=null}),l){let p=u.charAt(c+o.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function Pw(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return xt(!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 Pn(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 Y1({basename:e,pathname:t}){return t==="/"?e:Sn([e,t])}var Ff=e=>Vl.test(e);function J1(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?Hn(e):e,i;return n?(n=Vf(n),n.startsWith("/")?i=Ph(n.substring(1),"/"):i=Ph(n,t)):i=t,{pathname:i,search:Q1(r),hash:eC(a)}}function Ph(e,t){let n=ol(t).split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function jc(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 and the router will parse it for you.`}function Tw(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function jf(e){let t=Tw(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Bl(e,t,n,r=!1){let a;typeof e=="string"?a=Hn(e):(a={...e},ze(!a.pathname||!a.pathname.includes("?"),jc("?","pathname","search",a)),ze(!a.pathname||!a.pathname.includes("#"),jc("#","pathname","hash",a)),ze(!a.search||!a.search.includes("#"),jc("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.pathname,s;if(o==null)s=n;else{let p=t.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),p-=1;a.pathname=f.join("/")}s=p>=0?t[p]:"/"}let l=J1(a,s),c=o&&o!=="/"&&o.endsWith("/"),u=(i||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}var Vf=e=>e.replace(/[\\/]{2,}/g,"/"),Sn=e=>Vf(e.join("/")),ol=e=>e.replace(/\/+$/,""),Z1=e=>ol(e).replace(/^\/*/,"/"),Q1=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,eC=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,tC=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],as=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function jo(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function is(e){let t=e.map(n=>n.route.path).filter(Boolean);return Sn(t)||"/"}var Iw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function kw(e,t){let n=e;if(typeof n!="string"||!Vl.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(Iw)try{let i=new URL(window.location.href),o=Mf.test(n)?new URL(ww(n,i.protocol)):new URL(n),s=Pn(o.pathname,t);o.origin===i.origin&&s!=null?n=s+o.search+o.hash:a=!0}catch{xt(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}var ra=Symbol("Uninstrumented");function nC(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(a=>a({id:t.id,index:t.index,path:t.path,instrument(i){let o=Object.keys(n);for(let s of o)i[s]&&n[s].push(i[s])}}));let r={};if(typeof t.lazy=="function"&&n.lazy.length>0){let a=ci(n.lazy,t.lazy,()=>{});a&&(r.lazy=a)}if(typeof t.lazy=="object"){let a=t.lazy;["middleware","loader","action"].forEach(i=>{let o=a[i],s=n[`lazy.${i}`];if(typeof o=="function"&&s.length>0){let l=ci(s,o,()=>{});l&&(r.lazy=Object.assign(r.lazy||{},{[i]:l}))}})}return["loader","action"].forEach(a=>{let i=t[a];if(typeof i=="function"&&n[a].length>0){let o=i[ra]??i,s=ci(n[a],o,(...l)=>Th(l[0]));s&&(a==="loader"&&o.hydrate===!0&&(s.hydrate=!0),s[ra]=o,r[a]=s)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(a=>{let i=a[ra]??a,o=ci(n.middleware,i,(...s)=>Th(s[0]));return o?(o[ra]=i,o):a})),r}function rC(e,t){let n={navigate:[],fetch:[]};if(t.forEach(r=>r({instrument(a){let i=Object.keys(a);for(let o of i)a[o]&&n[o].push(a[o])}})),n.navigate.length>0){let r=e.navigate[ra]??e.navigate,a=ci(n.navigate,r,(...i)=>{let[o,s]=i;return{to:typeof o=="number"||typeof o=="string"?o:o?pr(o):".",...Ih(e,s??{})}});a&&(a[ra]=r,e.navigate=a)}if(n.fetch.length>0){let r=e.fetch[ra]??e.fetch,a=ci(n.fetch,r,(...i)=>{let[o,,s,l]=i;return{href:s??".",fetcherKey:o,...Ih(e,l??{})}});a&&(a[ra]=r,e.fetch=a)}return e}function ci(e,t,n){return e.length===0?null:async(...r)=>{let a=await Nw(e,n(...r),()=>t(...r),e.length-1);if(a.type==="error")throw a.value;return a.value}}async function Nw(e,t,n,r){let a=e[r],i;if(a){let o,s=async()=>(o?console.error("You cannot call instrumented handlers more than once"):o=Nw(e,t,n,r-1),i=await o,ze(i,"Expected a result"),i.type==="error"&&i.value instanceof Error?{status:"error",error:i.value}:{status:"success",error:void 0});try{await a(s,t)}catch(l){console.error("An instrumentation function threw an error:",l)}o||await s(),await o}else try{i={type:"success",value:await n()}}catch(o){i={type:"error",value:o}}return i||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Th(e){let{request:t,context:n,params:r,pattern:a}=e;return{request:aC(t),params:{...r},pattern:a,context:iC(n)}}function Ih(e,t){return{currentUrl:pr(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 aC(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function iC(e){if(sC(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var oC=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function sC(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===oC}var Aw=["POST","PUT","PATCH","DELETE"],lC=new Set(Aw),cC=["GET",...Aw],dC=new Set(cC),Lw=new Set([301,302,303,307,308]),uC=new Set([307,308]),Vc={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},pC={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Yi={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},fC=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Dw="remix-router-transitions",Mw=Symbol("ResetLoaderData"),Ea,ai,Jr,ii,mC=class{constructor(e){fo(this,Ea),fo(this,ai),fo(this,Jr),fo(this,ii),tr(this,Ea,e),tr(this,ai,zs(e))}get stableRoutes(){return yn(this,Ea)}get activeRoutes(){return yn(this,Jr)??yn(this,Ea)}get branches(){return yn(this,ii)??yn(this,ai)}get hasHMRRoutes(){return yn(this,Jr)!=null}setRoutes(e){tr(this,Ea,e),tr(this,ai,zs(e))}setHmrRoutes(e){tr(this,Jr,e),tr(this,ii,zs(e))}commitHmrRoutes(){yn(this,Jr)&&(tr(this,Ea,yn(this,Jr)),tr(this,ai,yn(this,ii)),tr(this,Jr,void 0),tr(this,ii,void 0))}};Ea=new WeakMap;ai=new WeakMap;Jr=new WeakMap;ii=new WeakMap;function hC(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";ze(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],a=e.mapRouteProperties||fC,i=a;if(e.instrumentations){let M=e.instrumentations;i=B=>({...a(B),...nC(M.map(H=>H.route).filter(Boolean),B)})}let o={},s=new mC(Fo(e.routes,i,void 0,o)),l=e.basename||"/";l.startsWith("/")||(l=`/${l}`);let c=e.dataStrategy||wC,u={...e.future},p=null,f=new Set,m=null,h=null,g=null,v=null,w=e.hydrationData!=null,y=Dn(s.activeRoutes,e.history.location,l,!1,s.branches),R=!1,E=null,O,I;if(y==null&&!e.patchRoutesOnNavigation){let M=wn(404,{pathname:e.history.location.pathname}),{matches:B,route:H}=Rs(s.activeRoutes);O=!0,I=!O,y=B,E={[H.id]:M}}else if(y&&!e.hydrationData&&Ur(y,s.activeRoutes,e.history.location.pathname).active&&(y=null),y)if(y.some(M=>M.route.lazy))O=!1,I=!O;else if(!y.some(M=>Bf(M.route)))O=!0,I=!O;else{let M=e.hydrationData?e.hydrationData.loaderData:null,B=e.hydrationData?e.hydrationData.errors:null,H=y;if(B){let ee=y.findIndex(ne=>B[ne.route.id]!==void 0);H=H.slice(0,ee+1)}I=!1,O=!0,H.forEach(ee=>{let ne=Fw(ee.route,M,B);I=I||ne.renderFallback,O=O&&!ne.shouldLoad})}else{O=!1,I=!O,y=[];let M=Ur(null,s.activeRoutes,e.history.location.pathname);M.active&&M.matches&&(R=!0,y=M.matches)}let k,x={historyAction:e.history.action,location:e.history.location,matches:y,initialized:O,renderFallback:I,navigation:Vc,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||E,fetchers:new Map,blockers:new Map},N="POP",L=null,D=!1,P,S=!1,C=new Map,A=null,$=!1,z=!1,j=new Set,F=new Map,W=0,Y=-1,Z=new Map,Q=new Set,J=new Map,fe=new Map,se=new Set,Le=new Map,_e,He=null;function he(){if(p=e.history.listen(({action:M,location:B,delta:H})=>{if(_e){_e(),_e=void 0;return}xt(Le.size===0||H!=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 ee=Ve({currentLocation:x.location,nextLocation:B,historyAction:M});if(ee&&H!=null){let ne=new Promise(we=>{_e=we});e.history.go(H*-1),Ya(ee,{state:"blocked",location:B,proceed(){Ya(ee,{state:"proceeding",proceed:void 0,reset:void 0,location:B}),ne.then(()=>e.history.go(H))},reset(){let we=new Map(x.blockers);we.set(ee,Yi),Ce({blockers:we})}}),L?.resolve(),L=null;return}return De(M,B)}),n){VC(t,C);let M=()=>BC(t,C);t.addEventListener("pagehide",M),A=()=>t.removeEventListener("pagehide",M)}return x.initialized||De("POP",x.location,{initialHydration:!0}),k}function Ee(){p&&p(),A&&A(),f.clear(),P&&P.abort(),x.fetchers.forEach((M,B)=>tt(x.fetchers,B)),x.blockers.forEach((M,B)=>Hi(B))}function Ne(M){if(f.add(M),m){let{newErrors:B}=m;m=null,M(x,{deletedFetchers:[],newErrors:B,viewTransitionOpts:void 0,flushSync:!1})}return()=>f.delete(M)}function Ce(M,B={}){M.matches&&(M.matches=M.matches.map(ne=>{let we=o[ne.route.id],xe=ne.route;return xe.element!==we.element||xe.errorElement!==we.errorElement||xe.hydrateFallbackElement!==we.hydrateFallbackElement?{...ne,route:we}:ne})),x={...x,...M};let H=[],ee=[];x.fetchers.forEach((ne,we)=>{ne.state==="idle"&&(se.has(we)?H.push(we):ee.push(we))}),se.forEach(ne=>{!x.fetchers.has(ne)&&!F.has(ne)&&H.push(ne)}),f.size===0&&(m={newErrors:M.errors??null}),[...f].forEach(ne=>ne(x,{deletedFetchers:H,newErrors:M.errors??null,viewTransitionOpts:B.viewTransitionOpts,flushSync:B.flushSync===!0})),H.forEach(ne=>tt(x.fetchers,ne)),ee.forEach(ne=>x.fetchers.delete(ne))}function qe(M,B,{flushSync:H}={}){let ee=x.actionData!=null&&x.navigation.formMethod!=null&&Ht(x.navigation.formMethod)&&x.navigation.state==="loading"&&M.state?._isRedirect!==!0,ne;B.actionData?Object.keys(B.actionData).length>0?ne=B.actionData:ne=null:ee?ne=x.actionData:ne=null;let we=B.loaderData?Bh(x.loaderData,B.loaderData,B.matches||[],B.errors):x.loaderData,xe=x.blockers;xe.size>0&&(xe=new Map(xe),xe.forEach((Re,Ke)=>xe.set(Ke,Yi)));let Oe=$?!1:Ja(M,B.matches||x.matches),ve=D===!0||x.navigation.formMethod!=null&&Ht(x.navigation.formMethod)&&M.state?._isRedirect!==!0;s.commitHmrRoutes(),$||N==="POP"||(N==="PUSH"?e.history.push(M,M.state):N==="REPLACE"&&e.history.replace(M,M.state));let Te;if(N==="POP"){let Re=C.get(x.location.pathname);Re&&Re.has(M.pathname)?Te={currentLocation:x.location,nextLocation:M}:C.has(M.pathname)&&(Te={currentLocation:M,nextLocation:x.location})}else if(S){let Re=C.get(x.location.pathname);Re?Re.add(M.pathname):(Re=new Set([M.pathname]),C.set(x.location.pathname,Re)),Te={currentLocation:x.location,nextLocation:M}}Ce({...B,actionData:ne,loaderData:we,historyAction:N,location:M,initialized:!0,renderFallback:!1,navigation:Vc,revalidation:"idle",restoreScrollPosition:Oe,preventScrollReset:ve,blockers:xe},{viewTransitionOpts:Te,flushSync:H===!0}),N="POP",D=!1,S=!1,$=!1,z=!1,L?.resolve(),L=null,He?.resolve(),He=null}async function Xe(M,B){if(L?.resolve(),L=null,typeof M=="number"){L||(L=qh());let nt=L.promise;return e.history.go(M),nt}let H=vp(x.location,x.matches,l,M,B?.fromRouteId,B?.relative),{path:ee,submission:ne,error:we}=kh(!1,H,B),xe;B?.mask&&(xe={pathname:"",search:"",hash:"",...typeof B.mask=="string"?Hn(B.mask):{...x.location.mask,...B.mask}});let Oe=x.location,ve=Mo(Oe,ee,B&&B.state,void 0,xe);ve={...ve,...e.history.encodeLocation(ve)};let Te=B&&B.replace!=null?B.replace:void 0,Re="PUSH";Te===!0?Re="REPLACE":Te===!1||ne!=null&&Ht(ne.formMethod)&&ne.formAction===x.location.pathname+x.location.search&&(Re="REPLACE");let Ke=B&&"preventScrollReset"in B?B.preventScrollReset===!0:void 0,Me=(B&&B.flushSync)===!0,Je=Ve({currentLocation:Oe,nextLocation:ve,historyAction:Re});if(Je){Ya(Je,{state:"blocked",location:ve,proceed(){Ya(Je,{state:"proceeding",proceed:void 0,reset:void 0,location:ve}),Xe(M,B)},reset(){let nt=new Map(x.blockers);nt.set(Je,Yi),Ce({blockers:nt})}});return}await De(Re,ve,{submission:ne,pendingError:we,preventScrollReset:Ke,replace:B&&B.replace,enableViewTransition:B&&B.viewTransition,flushSync:Me,callSiteDefaultShouldRevalidate:B&&B.defaultShouldRevalidate})}function Ye(){He||(He=qh()),ie(),Ce({revalidation:"loading"});let M=He.promise;return x.navigation.state==="submitting"?M:x.navigation.state==="idle"?(De(x.historyAction,x.location,{startUninterruptedRevalidation:!0}),M):(De(N||x.historyAction,x.navigation.location,{overrideNavigation:x.navigation,enableViewTransition:S===!0}),M)}async function De(M,B,H){P&&P.abort(),P=null,N=M,$=(H&&H.startUninterruptedRevalidation)===!0,Wi(x.location,x.matches),D=(H&&H.preventScrollReset)===!0,S=(H&&H.enableViewTransition)===!0;let ee=s.activeRoutes,ne=H?.initialHydration&&x.matches&&x.matches.length>0&&!R?x.matches:Dn(ee,B,l,!1,s.branches),we=(H&&H.flushSync)===!0;if(ne&&x.initialized&&!z&&TC(x.location,B)&&!(H&&H.submission&&Ht(H.submission.formMethod))){qe(B,{matches:ne},{flushSync:we});return}let xe=Ur(ne,ee,B.pathname);if(xe.active&&xe.matches&&(ne=xe.matches),!ne){let{error:bt,notFoundMatches:ot,route:Qt}=lt(B.pathname);qe(B,{matches:ot,loaderData:{},errors:{[Qt.id]:bt}},{flushSync:we});return}let Oe=H&&H.overrideNavigation?{...H.overrideNavigation,matches:ne,historyAction:M}:void 0;P=new AbortController;let ve=oi(e.history,B,P.signal,H&&H.submission),Te=e.getContext?await e.getContext():new _h,Re;if(H&&H.pendingError)Re=[Zr(ne).route.id,{type:"error",error:H.pendingError}];else if(H&&H.submission&&Ht(H.submission.formMethod)){let bt=await ge(ve,B,H.submission,ne,M,Te,xe.active,H&&H.initialHydration===!0,{replace:H.replace,flushSync:we});if(bt.shortCircuited)return;if(bt.pendingActionResult){let[ot,Qt]=bt.pendingActionResult;if(fn(Qt)&&jo(Qt.error)&&Qt.error.status===404){P=null,qe(B,{matches:bt.matches,loaderData:{},errors:{[ot]:Qt.error}});return}}ne=bt.matches||ne,Re=bt.pendingActionResult,Oe=Bc(B,ne,M,H.submission),we=!1,xe.active=!1,ve=oi(e.history,ve.url,ve.signal)}let{shortCircuited:Ke,matches:Me,loaderData:Je,errors:nt,workingFetchers:At}=await le(ve,B,ne,M,Te,xe.active,Oe,H&&H.submission,H&&H.fetcherSubmission,H&&H.replace,H&&H.initialHydration===!0,we,Re,H&&H.callSiteDefaultShouldRevalidate);Ke||(P=null,qe(B,{matches:Me||ne,...Uh(Re),loaderData:Je,errors:nt,...At?{fetchers:At}:{}}))}async function ge(M,B,H,ee,ne,we,xe,Oe,ve={}){ie();let Te=FC(B,ee,ne,H);if(Ce({navigation:Te},{flushSync:ve.flushSync===!0}),xe){let Me=await $r(ee,B.pathname,M.signal);if(Me.type==="aborted")return{shortCircuited:!0};if(Me.type==="error"){if(Me.partialMatches.length===0){let{matches:nt,route:At}=Rs(s.activeRoutes);return{matches:nt,pendingActionResult:[At.id,{type:"error",error:Me.error}]}}let Je=Zr(Me.partialMatches).route.id;return{matches:Me.partialMatches,pendingActionResult:[Je,{type:"error",error:Me.error}]}}else if(Me.matches)ee=Me.matches;else{let{notFoundMatches:Je,error:nt,route:At}=lt(B.pathname);return{matches:Je,pendingActionResult:[At.id,{type:"error",error:nt}]}}}let Re,Ke=qs(ee,B);if(!Ke.route.action&&!Ke.route.lazy)Re={type:"error",error:wn(405,{method:M.method,pathname:B.pathname,routeId:Ke.route.id})};else{let Me=vi(i,o,M,B,ee,Ke,Oe?[]:r,we),Je=await X(M,B,Me,we,null);if(Re=Je[Ke.route.id],!Re){for(let nt of ee)if(Je[nt.route.id]){Re=Je[nt.route.id];break}}if(M.signal.aborted)return{shortCircuited:!0}}if(Ra(Re)){let Me;return ve&&ve.replace!=null?Me=ve.replace:Me=Fh(Re.response.headers.get("Location"),new URL(M.url),l,e.history)===x.location.pathname+x.location.search,await V(M,Re,!0,{submission:H,replace:Me}),{shortCircuited:!0}}if(fn(Re)){let Me=Zr(ee,Ke.route.id);return(ve&&ve.replace)!==!0&&(N="PUSH"),{matches:ee,pendingActionResult:[Me.route.id,Re,Ke.route.id]}}return{matches:ee,pendingActionResult:[Ke.route.id,Re]}}async function le(M,B,H,ee,ne,we,xe,Oe,ve,Te,Re,Ke,Me,Je){let nt=xe||Bc(B,H,ee,Oe),At=Oe||ve||zh(nt),bt=!$&&!Re;if(we){if(bt){let tn=pe(Me);Ce({navigation:nt,...tn!==void 0?{actionData:tn}:{}},{flushSync:Ke})}let We=await $r(H,B.pathname,M.signal);if(We.type==="aborted")return{shortCircuited:!0};if(We.type==="error"){if(We.partialMatches.length===0){let{matches:er,route:xr}=Rs(s.activeRoutes);return{matches:er,loaderData:{},errors:{[xr.id]:We.error}}}let tn=Zr(We.partialMatches).route.id;return{matches:We.partialMatches,loaderData:{},errors:{[tn]:We.error}}}else if(We.matches)H=We.matches;else{let{error:tn,notFoundMatches:er,route:xr}=lt(B.pathname);return{matches:er,loaderData:{},errors:{[xr.id]:tn}}}}let ot=s.activeRoutes,{dsMatches:Qt,revalidatingFetchers:en}=Nh(M,ne,i,o,e.history,x,H,At,B,Re?[]:r,Re===!0,z,j,se,J,Q,ot,l,e.patchRoutesOnNavigation!=null,s.branches,Me,Je);if(Y=++W,!e.dataStrategy&&!Qt.some(We=>We.shouldLoad)&&!Qt.some(We=>We.route.middleware&&We.route.middleware.length>0)&&en.length===0){let We=new Map(x.fetchers),tn=Xt(We);return qe(B,{matches:H,loaderData:{},errors:Me&&fn(Me[1])?{[Me[0]]:Me[1].error}:null,...Uh(Me),...tn?{fetchers:We}:{}},{flushSync:Ke}),{shortCircuited:!0}}if(bt){let We={};if(!we){We.navigation=nt;let tn=pe(Me);tn!==void 0&&(We.actionData=tn)}en.length>0&&(We.fetchers=T(en)),Ce(We,{flushSync:Ke})}en.forEach(We=>{mt(We.key),We.controller&&F.set(We.key,We.controller)});let Xi=()=>en.forEach(We=>mt(We.key));P&&P.signal.addEventListener("abort",Xi);let{loaderResults:zr,fetcherResults:Za}=await te(Qt,en,M,B,ne);if(M.signal.aborted)return{shortCircuited:!0};P&&P.signal.removeEventListener("abort",Xi),en.forEach(We=>F.delete(We.key));let qr=Ps(zr);if(qr)return await V(M,qr.result,!0,{replace:Te}),{shortCircuited:!0};if(qr=Ps(Za),qr)return Q.add(qr.key),await V(M,qr.result,!0,{replace:Te}),{shortCircuited:!0};let Qn=new Map(x.fetchers),{loaderData:Mc,errors:Kr}=Vh(x,H,zr,Me,en,Za,Qn);Re&&x.errors&&(Kr={...x.errors,...Kr});let Os=Xt(Qn),Ss=Zt(Y,Qn),_s=Os||Ss||en.length>0;return{matches:H,loaderData:Mc,errors:Kr,..._s?{workingFetchers:Qn}:{}}}function pe(M){if(M&&!fn(M[1]))return{[M[0]]:M[1].data};if(x.actionData)return Object.keys(x.actionData).length===0?null:x.actionData}function T(M){let B=new Map(x.fetchers);return M.forEach(H=>{let ee=B.get(H.key),ne=Ji(void 0,ee?ee.data:void 0);B.set(H.key,ne)}),B}async function U(M,B,H,ee){mt(M);let ne=(ee&&ee.flushSync)===!0,we=s.activeRoutes,xe=vp(x.location,x.matches,l,H,B,ee?.relative),Oe=Dn(we,xe,l,!1,s.branches),ve=Ur(Oe,we,xe);if(ve.active&&ve.matches&&(Oe=ve.matches),!Oe){Ie(M,B,wn(404,{pathname:xe}),{flushSync:ne});return}let{path:Te,submission:Re,error:Ke}=kh(!0,xe,ee);if(Ke){Ie(M,B,Ke,{flushSync:ne});return}let Me=e.getContext?await e.getContext():new _h,Je=(ee&&ee.preventScrollReset)===!0;if(Re&&Ht(Re.formMethod)){await q(M,B,Te,Oe,Me,ve.active,ne,Je,Re,ee&&ee.defaultShouldRevalidate);return}J.set(M,{routeId:B,path:Te}),await K(M,B,Te,Oe,Me,ve.active,ne,Je,Re)}async function q(M,B,H,ee,ne,we,xe,Oe,ve,Te){ie(),J.delete(M);let Re=x.fetchers.get(M);de(M,jC(ve,Re),{flushSync:xe});let Ke=new AbortController,Me=oi(e.history,H,Ke.signal,ve);if(we){let ht=await $r(ee,new URL(Me.url).pathname,Me.signal,M);if(ht.type==="aborted")return;if(ht.type==="error"){Ie(M,B,ht.error,{flushSync:xe});return}else if(ht.matches)ee=ht.matches;else{Ie(M,B,wn(404,{pathname:H}),{flushSync:xe});return}}let Je=qs(ee,H);if(!Je.route.action&&!Je.route.lazy){let ht=wn(405,{method:ve.formMethod,pathname:H,routeId:B});Ie(M,B,ht,{flushSync:xe});return}F.set(M,Ke);let nt=W,At=vi(i,o,Me,H,ee,Je,r,ne),bt=await X(Me,H,At,ne,M),ot=bt[Je.route.id];if(!ot){for(let ht of At)if(bt[ht.route.id]){ot=bt[ht.route.id];break}}if(Me.signal.aborted){F.get(M)===Ke&&F.delete(M);return}if(se.has(M)){if(Ra(ot)||fn(ot)){de(M,ir(void 0));return}}else{if(Ra(ot))if(F.delete(M),Y>nt){de(M,ir(void 0));return}else return Q.add(M),de(M,Ji(ve)),V(Me,ot,!1,{fetcherSubmission:ve,preventScrollReset:Oe});if(fn(ot)){Ie(M,B,ot.error);return}}let Qt=x.navigation.location||x.location,en=oi(e.history,Qt,Ke.signal),Xi=s.activeRoutes,zr=x.navigation.state!=="idle"?Dn(Xi,x.navigation.location,l,!1,s.branches):x.matches;ze(zr,"Didn't find any matches after fetcher action");let Za=++W;Z.set(M,Za);let{dsMatches:qr,revalidatingFetchers:Qn}=Nh(en,ne,i,o,e.history,x,zr,ve,Qt,r,!1,z,j,se,J,Q,Xi,l,e.patchRoutesOnNavigation!=null,s.branches,[Je.route.id,ot],Te),Mc=Ji(ve,ot.data),Kr=new Map(x.fetchers);Kr.set(M,Mc),Qn.filter(ht=>ht.key!==M).forEach(ht=>{let ya=ht.key,wh=Kr.get(ya),S1=Ji(void 0,wh?wh.data:void 0);Kr.set(ya,S1),mt(ya),ht.controller&&F.set(ya,ht.controller)}),Ce({fetchers:Kr});let Os=()=>Qn.forEach(ht=>mt(ht.key));Ke.signal.addEventListener("abort",Os);let{loaderResults:Ss,fetcherResults:_s}=await te(qr,Qn,en,Qt,ne);if(Ke.signal.aborted)return;Ke.signal.removeEventListener("abort",Os),Z.delete(M),F.delete(M),Qn.forEach(ht=>F.delete(ht.key));let We=x.fetchers.has(M),tn=ht=>{if(!We)return ht;let ya=new Map(ht.fetchers);return ya.set(M,ir(ot.data)),{...ht,fetchers:ya}},er=Ps(Ss);if(er)return x=tn(x),V(en,er.result,!1,{preventScrollReset:Oe});if(er=Ps(_s),er)return Q.add(er.key),x=tn(x),V(en,er.result,!1,{preventScrollReset:Oe});let xr=new Map(x.fetchers);We&&xr.set(M,ir(ot.data));let{loaderData:yh,errors:Fc}=Vh(x,zr,Ss,void 0,Qn,_s,xr);Zt(Za,xr),x.navigation.state==="loading"&&Za>Y?(ze(N,"Expected pending action"),P&&P.abort(),qe(x.navigation.location,{matches:zr,loaderData:yh,errors:Fc,fetchers:xr})):(Ce({errors:Fc,loaderData:Bh(x.loaderData,yh,zr,Fc),fetchers:xr}),z=!1)}async function K(M,B,H,ee,ne,we,xe,Oe,ve){let Te=x.fetchers.get(M);de(M,Ji(ve,Te?Te.data:void 0),{flushSync:xe});let Re=new AbortController,Ke=oi(e.history,H,Re.signal);if(we){let ot=await $r(ee,new URL(Ke.url).pathname,Ke.signal,M);if(ot.type==="aborted")return;if(ot.type==="error"){Ie(M,B,ot.error,{flushSync:xe});return}else if(ot.matches)ee=ot.matches;else{Ie(M,B,wn(404,{pathname:H}),{flushSync:xe});return}}let Me=qs(ee,H);F.set(M,Re);let Je=W,nt=vi(i,o,Ke,H,ee,Me,r,ne),At=await X(Ke,H,nt,ne,M),bt=At[Me.route.id];if(!bt){for(let ot of ee)if(At[ot.route.id]){bt=At[ot.route.id];break}}if(F.get(M)===Re&&F.delete(M),!Ke.signal.aborted){if(se.has(M)){de(M,ir(void 0));return}if(Ra(bt))if(Y>Je){de(M,ir(void 0));return}else{Q.add(M),await V(Ke,bt,!1,{preventScrollReset:Oe});return}if(fn(bt)){Ie(M,B,bt.error);return}de(M,ir(bt.data))}}async function V(M,B,H,{submission:ee,fetcherSubmission:ne,preventScrollReset:we,replace:xe}={}){H||(L?.resolve(),L=null),B.response.headers.has("X-Remix-Revalidate")&&(z=!0);let Oe=B.response.headers.get("Location");ze(Oe,"Expected a Location header on the redirect Response"),Oe=Fh(Oe,new URL(M.url),l,e.history);let ve=Mo(x.location,Oe,{_isRedirect:!0});if(n){let nt=!1;if(B.response.headers.has("X-Remix-Reload-Document"))nt=!0;else if(Ff(Oe)){const At=xw(t,Oe,!0);nt=At.origin!==t.location.origin||Pn(At.pathname,l)==null}if(nt){xe?t.location.replace(Oe):t.location.assign(Oe);return}}P=null;let Te=xe===!0||B.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Re,formAction:Ke,formEncType:Me}=x.navigation;!ee&&!ne&&Re&&Ke&&Me&&(ee=zh(x.navigation));let Je=ee||ne;if(uC.has(B.response.status)&&Je&&Ht(Je.formMethod))await De(Te,ve,{submission:{...Je,formAction:Oe},preventScrollReset:we||D,enableViewTransition:H?S:void 0});else{let nt=Bc(ve,[],Te,ee);await De(Te,ve,{overrideNavigation:nt,fetcherSubmission:ne,preventScrollReset:we||D,enableViewTransition:H?S:void 0})}}async function X(M,B,H,ee,ne){let we,xe={};try{we=await EC(c,M,B,H,ne,ee,!1)}catch(Oe){return H.filter(ve=>ve.shouldLoad).forEach(ve=>{xe[ve.route.id]={type:"error",error:Oe}}),xe}if(M.signal.aborted)return xe;if(!Ht(M.method))for(let Oe of H){if(we[Oe.route.id]?.type==="error")break;!we.hasOwnProperty(Oe.route.id)&&!x.loaderData.hasOwnProperty(Oe.route.id)&&(!x.errors||!x.errors.hasOwnProperty(Oe.route.id))&&Oe.shouldCallHandler()&&(we[Oe.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Oe.route.id}`)})}for(let[Oe,ve]of Object.entries(we))if(AC(ve)){let Te=ve.result;xe[Oe]={type:"redirect",response:CC(Te,M,Oe,H,l)}}else xe[Oe]=await _C(ve);return xe}async function te(M,B,H,ee,ne){let we=X(H,ee,M,ne,null),xe=Promise.all(B.map(async Te=>{if(Te.matches&&Te.match&&Te.request&&Te.controller){let Ke=(await X(Te.request,Te.path,Te.matches,ne,Te.key))[Te.match.route.id];return{[Te.key]:Ke}}else return Promise.resolve({[Te.key]:{type:"error",error:wn(404,{pathname:Te.path})}})})),Oe=await we,ve=(await xe).reduce((Te,Re)=>Object.assign(Te,Re),{});return{loaderResults:Oe,fetcherResults:ve}}function ie(){z=!0,J.forEach((M,B)=>{F.has(B)&&j.add(B),mt(B)})}function de(M,B,H={}){let ee=new Map(x.fetchers);ee.set(M,B),Ce({fetchers:ee},{flushSync:(H&&H.flushSync)===!0})}function Ie(M,B,H,ee={}){let ne=Zr(x.matches,B),we=new Map(x.fetchers);tt(we,M),Ce({errors:{[ne.route.id]:H},fetchers:we},{flushSync:(ee&&ee.flushSync)===!0})}function me(M){return fe.set(M,(fe.get(M)||0)+1),se.has(M)&&se.delete(M),x.fetchers.get(M)||pC}function Be(M,B){mt(M,B?.reason),de(M,ir(null))}function tt(M,B){let H=x.fetchers.get(B);F.has(B)&&!(H&&H.state==="loading"&&Z.has(B))&&mt(B),J.delete(B),Z.delete(B),Q.delete(B),se.delete(B),j.delete(B),M.delete(B)}function Ot(M){let B=(fe.get(M)||0)-1;B<=0?(fe.delete(M),se.add(M)):fe.set(M,B),Ce({fetchers:new Map(x.fetchers)})}function mt(M,B){let H=F.get(M);H&&(H.abort(B),F.delete(M))}function Vt(M,B){for(let H of M){let ee=B.get(H);ze(ee,`Expected fetcher: ${H}`);let ne=ir(ee.data);B.set(H,ne)}}function Xt(M){let B=[],H=!1;for(let ee of Q){let ne=M.get(ee);ze(ne,`Expected fetcher: ${ee}`),ne.state==="loading"&&(Q.delete(ee),B.push(ee),H=!0)}return Vt(B,M),H}function Zt(M,B){let H=[];for(let[ee,ne]of Z)if(ne0}function yr(M,B){let H=x.blockers.get(M)||Yi;return Le.get(M)!==B&&Le.set(M,B),H}function Hi(M){x.blockers.delete(M),Le.delete(M)}function Ya(M,B){let H=x.blockers.get(M)||Yi;ze(H.state==="unblocked"&&B.state==="blocked"||H.state==="blocked"&&B.state==="blocked"||H.state==="blocked"&&B.state==="proceeding"||H.state==="blocked"&&B.state==="unblocked"||H.state==="proceeding"&&B.state==="unblocked",`Invalid blocker state transition: ${H.state} -> ${B.state}`);let ee=new Map(x.blockers);ee.set(M,B),Ce({blockers:ee})}function Ve({currentLocation:M,nextLocation:B,historyAction:H}){if(Le.size===0)return;Le.size>1&&xt(!1,"A router only supports one blocker at a time");let ee=Array.from(Le.entries()),[ne,we]=ee[ee.length-1],xe=x.blockers.get(ne);if(!(xe&&xe.state==="proceeding")&&we({currentLocation:M,nextLocation:B,historyAction:H}))return ne}function lt(M){let B=wn(404,{pathname:M}),H=s.activeRoutes,{matches:ee,route:ne}=Rs(H);return{notFoundMatches:ee,route:ne,error:B}}function wr(M,B,H){if(h=M,v=B,g=H||null,!w&&x.navigation===Vc){w=!0;let ee=Ja(x.location,x.matches);ee!=null&&Ce({restoreScrollPosition:ee})}return()=>{h=null,v=null,g=null}}function Zn(M,B){return g&&g(M,B.map(ee=>Ow(ee,x.loaderData)))||M.key}function Wi(M,B){if(h&&v){let H=Zn(M,B);h[H]=v()}}function Ja(M,B){if(h){let H=Zn(M,B),ee=h[H];if(typeof ee=="number")return ee}return null}function Ur(M,B,H){if(e.patchRoutesOnNavigation){let ee=s.branches;if(M){if(Object.keys(M[0].params).length>0)return{active:!0,matches:Dn(B,H,l,!0,ee)}}else return{active:!0,matches:Dn(B,H,l,!0,ee)||[]}}return{active:!1,matches:null}}async function $r(M,B,H,ee){if(!e.patchRoutesOnNavigation)return{type:"success",matches:M};let ne=M;for(;;){let we=o;try{await e.patchRoutesOnNavigation({signal:H,path:B,matches:ne,fetcherKey:ee,patch:(Te,Re)=>{H.aborted||Ah(Te,Re,s,we,i,!1)}})}catch(Te){return{type:"error",error:Te,partialMatches:ne}}if(H.aborted)return{type:"aborted"};let xe=s.branches,Oe=Dn(s.activeRoutes,B,l,!1,xe),ve=null;if(Oe){if(Object.keys(Oe[0].params).length===0)return{type:"success",matches:Oe};if(ve=Dn(s.activeRoutes,B,l,!0,xe),!(ve&&ne.lengthH.route.id===B[ee].route.id)}function E1(M){o={},s.setHmrRoutes(Fo(M,i,void 0,o))}function O1(M,B,H=!1){Ah(M,B,s,o,i,H),s.hasHMRRoutes||Ce({})}return k={get basename(){return l},get future(){return u},get state(){return x},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:he,subscribe:Ne,enableScrollRestoration:wr,navigate:Xe,fetch:U,revalidate:Ye,createHref:M=>e.history.createHref(M),encodeLocation:M=>e.history.encodeLocation(M),getFetcher:me,resetFetcher:Be,deleteFetcher:Ot,dispose:Ee,getBlocker:yr,deleteBlocker:Hi,patchRoutes:O1,_internalFetchControllers:F,_internalSetRoutes:E1,_internalSetStateDoNotUseOrYouWillBreakYourApp(M){Ce(M)}},e.instrumentations&&(k=rC(k,e.instrumentations.map(M=>M.router).filter(Boolean))),k}function gC(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function vp(e,t,n,r,a,i){let o,s;if(a){o=[];for(let c of t)if(o.push(c),c.route.id===a){s=c;break}}else o=t,s=t[t.length-1];let l=Bl(r||".",jf(o),Pn(e.pathname,n)||e.pathname,i==="path");if(r==null&&(l.search=e.search,l.hash=e.hash),(r==null||r===""||r===".")&&s){let c=$f(l.search);if(s.route.index&&!c)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!s.route.index&&c){let u=new URLSearchParams(l.search),p=u.getAll("index");u.delete("index"),p.filter(m=>m).forEach(m=>u.append("index",m));let f=u.toString();l.search=f?`?${f}`:""}}return n!=="/"&&(l.pathname=Y1({basename:n,pathname:l.pathname})),pr(l)}function kh(e,t,n){if(!n||!gC(n))return{path:t};if(n.formMethod&&!MC(n.formMethod))return{path:t,error:wn(405,{method:n.formMethod})};let r=()=>({path:t,error:wn(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),o=qw(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Ht(i))return r();let p=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((f,[m,h])=>`${f}${m}=${h} `,""):String(n.body);return{path:t,submission:{formMethod:i,formAction:o,formEncType:n.formEncType,formData:void 0,json:void 0,text:p}}}else if(n.formEncType==="application/json"){if(!Ht(i))return r();try{let p=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:o,formEncType:n.formEncType,formData:void 0,json:p,text:void 0}}}catch{return r()}}}ze(typeof FormData=="function","FormData is not available in this environment");let s,l;if(n.formData)s=wp(n.formData),l=n.formData;else if(n.body instanceof FormData)s=wp(n.body),l=n.body;else if(n.body instanceof URLSearchParams)s=n.body,l=jh(s);else if(n.body==null)s=new URLSearchParams,l=new FormData;else try{s=new URLSearchParams(n.body),l=jh(s)}catch{return r()}let c={formMethod:i,formAction:o,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:l,json:void 0,text:void 0};if(Ht(c.formMethod))return{path:t,submission:c};let u=Hn(t);return e&&u.search&&$f(u.search)&&s.append("index",""),u.search=`?${s}`,{path:pr(u),submission:c}}function Nh(e,t,n,r,a,i,o,s,l,c,u,p,f,m,h,g,v,w,y,R,E,O){let I=E?fn(E[1])?E[1].error:E[1].data:void 0,k=a.createURL(i.location),x=a.createURL(l),N;if(u&&i.errors){let $=Object.keys(i.errors)[0];N=o.findIndex(z=>z.route.id===$)}else if(E&&fn(E[1])){let $=E[0];N=o.findIndex(z=>z.route.id===$)-1}let L=E?E[1].statusCode:void 0,D=L&&L>=400,P={currentUrl:k,currentParams:i.matches[0]?.params||{},nextUrl:x,nextParams:o[0].params,...s,actionResult:I,actionStatus:L},S=is(o),C=o.map(($,z)=>{let{route:j}=$,F=null;if(N!=null&&z>N)F=!1;else if(j.lazy)F=!0;else if(!Bf(j))F=!1;else if(u){let{shouldLoad:Q}=Fw(j,i.loaderData,i.errors);F=Q}else vC(i.loaderData,i.matches[z],$)&&(F=!0);if(F!==null)return bp(n,r,e,l,S,$,c,t,F);let W=!1;typeof O=="boolean"?W=O:D?W=!1:(p||k.pathname+k.search===x.pathname+x.search||k.search!==x.search||bC(i.matches[z],$))&&(W=!0);let Y={...P,defaultShouldRevalidate:W},Z=Eo($,Y);return bp(n,r,e,l,S,$,c,t,Z,Y,O)}),A=[];return h.forEach(($,z)=>{if(u||!o.some(fe=>fe.route.id===$.routeId)||m.has(z))return;let j=i.fetchers.get(z),F=j&&j.state!=="idle"&&j.data===void 0,W=Dn(v,$.path,w??"/",!1,R);if(!W){if(y&&F)return;A.push({key:z,routeId:$.routeId,path:$.path,matches:null,match:null,request:null,controller:null});return}if(g.has(z))return;let Y=qs(W,$.path),Z=new AbortController,Q=oi(a,$.path,Z.signal),J=null;if(f.has(z))f.delete(z),J=vi(n,r,Q,$.path,W,Y,c,t);else if(F)p&&(J=vi(n,r,Q,$.path,W,Y,c,t));else{let fe;typeof O=="boolean"?fe=O:D?fe=!1:fe=p;let se={...P,defaultShouldRevalidate:fe};Eo(Y,se)&&(J=vi(n,r,Q,$.path,W,Y,c,t,se))}J&&A.push({key:z,routeId:$.routeId,path:$.path,matches:J,match:Y,request:Q,controller:Z})}),{dsMatches:C,revalidatingFetchers:A}}function Bf(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function Fw(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Bf(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,a=n!=null&&n[e.id]!==void 0;if(!r&&a)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let i=!r&&!a;return{shouldLoad:i,renderFallback:i}}function vC(e,t,n){let r=!t||n.route.id!==t.route.id,a=!e.hasOwnProperty(n.route.id);return r||a}function bC(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Eo(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function Ah(e,t,n,r,a,i){let o;if(e){let c=r[e];ze(c,`No route found to patch children into: routeId = ${e}`),c.children||(c.children=[]),o=c.children}else o=n.activeRoutes;let s=[],l=[];if(t.forEach(c=>{let u=o.find(p=>jw(c,p));u?l.push({existingRoute:u,newRoute:c}):s.push(c)}),s.length>0){let c=Fo(s,a,[e||"_","patch",String(o?.length||"0")],r);o.push(...c)}if(i&&l.length>0)for(let c=0;ct.children?.some(a=>jw(n,a)))??!1:!1}var Lh=new WeakMap,Vw=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let a=n[t.id];if(ze(a,"No route found in manifest"),!a.lazy||typeof a.lazy!="object")return;let i=a.lazy[e];if(!i)return;let o=Lh.get(a);o||(o={},Lh.set(a,o));let s=o[e];if(s)return s;let l=(async()=>{let c=M1(e),p=a[e]!==void 0&&e!=="hasErrorBoundary";if(c)xt(!c,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),o[e]=Promise.resolve();else if(p)xt(!1,`Route "${a.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let f=await i();f!=null&&(Object.assign(a,{[e]:f}),Object.assign(a,r(a)))}typeof a.lazy=="object"&&(a.lazy[e]=void 0,Object.values(a.lazy).every(f=>f===void 0)&&(a.lazy=void 0))})();return o[e]=l,l},Dh=new WeakMap;function yC(e,t,n,r,a){let i=n[e.id];if(ze(i,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let u=Dh.get(i);if(u)return{lazyRoutePromise:u,lazyHandlerPromise:u};let p=(async()=>{ze(typeof e.lazy=="function","No lazy route function found");let f=await e.lazy(),m={};for(let h in f){let g=f[h];if(g===void 0)continue;let v=j1(h),y=i[h]!==void 0&&h!=="hasErrorBoundary";v?xt(!v,"Route property "+h+" is not a supported property to be returned from a lazy route function. This property will be ignored."):y?xt(!y,`Route "${i.id}" has a static property "${h}" defined but its lazy function is also returning a value for this property. The lazy route property "${h}" will be ignored.`):m[h]=g}Object.assign(i,m),Object.assign(i,{...r(i),lazy:void 0})})();return Dh.set(i,p),p.catch(()=>{}),{lazyRoutePromise:p,lazyHandlerPromise:p}}let o=Object.keys(e.lazy),s=[],l;for(let u of o){if(a&&a.includes(u))continue;let p=Vw({key:u,route:e,manifest:n,mapRouteProperties:r});p&&(s.push(p),u===t&&(l=p))}let c=s.length>0?Promise.all(s).then(()=>{}):void 0;return c?.catch(()=>{}),l?.catch(()=>{}),{lazyRoutePromise:c,lazyHandlerPromise:l}}async function Mh(e){let t=e.matches.filter(a=>a.shouldLoad),n={};return(await Promise.all(t.map(a=>a.resolve()))).forEach((a,i)=>{n[t[i].route.id]=a}),n}async function wC(e){return e.matches.some(t=>t.route.middleware)?Bw(e,()=>Mh(e)):Mh(e)}function Bw(e,t){return xC(e,t,r=>{if(DC(r))throw r;return r},kC,n);function n(r,a,i){if(i)return Promise.resolve(Object.assign(i.value,{[a]:{type:"error",result:r}}));{let{matches:o}=e,s=Math.min(Math.max(o.findIndex(c=>c.route.id===a),0),Math.max(o.findIndex(c=>c.shouldCallHandler()),0)),l=Zr(o,o[s].route.id).route.id;return Promise.resolve({[l]:{type:"error",result:r}})}}}async function xC(e,t,n,r,a){let{matches:i,...o}=e,s=i.flatMap(c=>c.route.middleware?c.route.middleware.map(u=>[c.route.id,u]):[]);return await Uw(o,s,t,n,r,a)}async function Uw(e,t,n,r,a,i,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??new Error(`Request aborted: ${s.method} ${s.url}`);let l=t[o];if(!l)return await n();let[c,u]=l,p,f=async()=>{if(p)throw new Error("You may only call `next()` once per middleware");try{return p={value:await Uw(e,t,n,r,a,i,o+1)},p.value}catch(m){return p={value:await i(m,c,p)},p.value}};try{let m=await u(e,f),h=m!=null?r(m):void 0;return a(h)?h:p?h??p.value:(p={value:await f()},p.value)}catch(m){return await i(m,c,p)}}function $w(e,t,n,r,a){let i=Vw({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),o=yC(r.route,Ht(n.method)?"action":"loader",t,e,a);return{middleware:i,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function bp(e,t,n,r,a,i,o,s,l,c=null,u){let p=!1,f=$w(e,t,n,i,o);return{...i,_lazyPromises:f,shouldLoad:l,shouldRevalidateArgs:c,shouldCallHandler(m){return p=!0,c?typeof u=="boolean"?Eo(i,{...c,defaultShouldRevalidate:u}):typeof m=="boolean"?Eo(i,{...c,defaultShouldRevalidate:m}):Eo(i,c):l},resolve(m){let{lazy:h,loader:g,middleware:v}=i.route,w=p||l||m&&!Ht(n.method)&&(h||g),y=v&&v.length>0&&!g&&!h;return w&&(Ht(n.method)||!y)?OC({request:n,path:r,pattern:a,match:i,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:m,scopedContext:s}):Promise.resolve({type:"data",result:void 0})}}}function vi(e,t,n,r,a,i,o,s,l=null){return a.map(c=>c.route.id!==i.route.id?{...c,shouldLoad:!1,shouldRevalidateArgs:l,shouldCallHandler:()=>!1,_lazyPromises:$w(e,t,n,c,o),resolve:()=>Promise.resolve({type:"data",result:void 0})}:bp(e,t,n,r,is(a),c,o,s,!0,l))}async function EC(e,t,n,r,a,i,o){r.some(u=>u._lazyPromises?.middleware)&&await Promise.all(r.map(u=>u._lazyPromises?.middleware));let s={request:t,url:zw(t,n),pattern:is(r),params:r[0].params,context:i,matches:r},c=await e({...s,fetcherKey:a,runClientMiddleware:u=>{let p=s;return Bw(p,()=>u({...p,fetcherKey:a,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(r.flatMap(u=>[u._lazyPromises?.handler,u._lazyPromises?.route]))}catch{}return c}async function OC({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:a,lazyRoutePromise:i,handlerOverride:o,scopedContext:s}){let l,c,u=Ht(e.method),p=u?"action":"loader",f=m=>{let h,g=new Promise((y,R)=>h=R);c=()=>h(),e.signal.addEventListener("abort",c);let v=y=>typeof m!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${p}" [routeId: ${r.route.id}]`)):m({request:e,url:zw(e,t),pattern:n,params:r.params,context:s},...y!==void 0?[y]:[]),w=(async()=>{try{return{type:"data",result:await(o?o(R=>v(R)):v())}}catch(y){return{type:"error",result:y}}})();return Promise.race([w,g])};try{let m=u?r.route.action:r.route.loader;if(a||i)if(m){let h,[g]=await Promise.all([f(m).catch(v=>{h=v}),a,i]);if(h!==void 0)throw h;l=g}else{await a;let h=u?r.route.action:r.route.loader;if(h)[l]=await Promise.all([f(h),i]);else if(p==="action"){let g=new URL(e.url),v=g.pathname+g.search;throw wn(405,{method:e.method,pathname:v,routeId:r.route.id})}else return{type:"data",result:void 0}}else if(m)l=await f(m);else{let h=new URL(e.url),g=h.pathname+h.search;throw wn(404,{pathname:g})}}catch(m){return{type:"error",result:m}}finally{c&&e.signal.removeEventListener("abort",c)}return l}async function SC(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 _C(e){let{result:t,type:n}=e;if(Uf(t)){let r;try{r=await SC(t)}catch(a){return{type:"error",error:a}}return n==="error"?{type:"error",error:new as(t.status,t.statusText,r),statusCode:t.status,headers:t.headers}:{type:"data",data:r,statusCode:t.status,headers:t.headers}}return n==="error"?$h(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:IC(t),statusCode:jo(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:jo(t)?t.status:void 0}:$h(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 CC(e,t,n,r,a){let i=e.headers.get("Location");if(ze(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!Ff(i)){let o=r.slice(0,r.findIndex(s=>s.route.id===n)+1);i=vp(new URL(t.url),o,a,i),e.headers.set("Location",i)}return e}var RC=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function yp(e){try{return RC.includes(new URL(e).protocol)}catch{return!1}}function Fh(e,t,n,r){if(Ff(e)){let a=e,i=Mf.test(a)?new URL(ww(a,t.protocol)):new URL(a);if(yp(i.toString()))throw new Error("Invalid redirect location");let o=Pn(i.pathname,n)!=null;if(i.origin===t.origin&&o)return Vf(i.pathname)+i.search+i.hash}try{let a=r.createURL(e);if(yp(a.toString()))throw new Error("Invalid redirect location")}catch{}return e}function oi(e,t,n,r){let a=e.createURL(qw(t)).toString(),i={signal:n};if(r&&Ht(r.formMethod)){let{formMethod:o,formEncType:s}=r;i.method=o.toUpperCase(),s==="application/json"?(i.headers=new Headers({"Content-Type":s}),i.body=JSON.stringify(r.json)):s==="text/plain"?i.body=r.text:s==="application/x-www-form-urlencoded"&&r.formData?i.body=wp(r.formData):i.body=r.formData}return new Request(a,i)}function zw(e,t){let n=new URL(e.url),r=typeof t=="string"?Hn(t):t;if(n.pathname=r.pathname||"/",r.search){let a=new URLSearchParams(r.search),i=a.getAll("index");a.delete("index");for(let o of i.filter(Boolean))a.append("index",o);n.search=a.size?`?${a.toString()}`:""}else n.search="";return n.hash=r.hash||"",n}function wp(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function jh(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function PC(e,t,n,r=!1,a=!1){let i={},o=null,s,l=!1,c={},u=n&&fn(n[1])?n[1].error:void 0;return e.forEach(p=>{if(!(p.route.id in t))return;let f=p.route.id,m=t[f];if(ze(!Ra(m),"Cannot handle redirect results in processLoaderData"),fn(m)){let h=m.error;if(u!==void 0&&(h=u,u=void 0),o=o||{},a)o[f]=h;else{let g=Zr(e,f);o[g.route.id]==null&&(o[g.route.id]=h)}r||(i[f]=Mw),l||(l=!0,s=jo(m.error)?m.error.status:500),m.headers&&(c[f]=m.headers)}else i[f]=m.data,m.statusCode&&m.statusCode!==200&&!l&&(s=m.statusCode),m.headers&&(c[f]=m.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(i[n[2]]=void 0)),{loaderData:i,errors:o,statusCode:s||200,loaderHeaders:c}}function Vh(e,t,n,r,a,i,o){let{loaderData:s,errors:l}=PC(t,n,r);return a.filter(c=>!c.matches||c.matches.some(u=>u.shouldLoad)).forEach(c=>{let{key:u,match:p,controller:f}=c;if(f&&f.signal.aborted)return;let m=i[u];if(ze(m,"Did not find corresponding fetcher result"),fn(m)){let h=Zr(e.matches,p?.route.id);l&&l[h.route.id]||(l={...l,[h.route.id]:m.error}),o.delete(u)}else if(Ra(m))ze(!1,"Unhandled fetcher revalidation redirect");else{let h=ir(m.data);o.set(u,h)}}),{loaderData:s,errors:l}}function Bh(e,t,n,r){let a=Object.entries(t).filter(([,i])=>i!==Mw).reduce((i,[o,s])=>(i[o]=s,i),{});for(let i of n){let o=i.route.id;if(!t.hasOwnProperty(o)&&e.hasOwnProperty(o)&&i.route.loader&&(a[o]=e[o]),r&&r.hasOwnProperty(o))break}return a}function Uh(e){return e?fn(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Zr(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function Rs(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function wn(e,{pathname:t,routeId:n,method:r,type:a,message:i}={}){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.`:a==="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 as(e||500,o,new Error(s),!0)}function Ps(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,a]=t[n];if(Ra(a))return{key:r,result:a}}}function qw(e){let t=typeof e=="string"?Hn(e):e;return pr({...t,hash:""})}function TC(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function IC(e){return new as(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function kC(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,n])=>typeof t=="string"&&NC(n))}function NC(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function AC(e){return Uf(e.result)&&Lw.has(e.result.status)}function fn(e){return e.type==="error"}function Ra(e){return(e&&e.type)==="redirect"}function $h(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function Uf(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function LC(e){return Lw.has(e)}function DC(e){return Uf(e)&&LC(e.status)&&e.headers.has("Location")}function MC(e){return dC.has(e.toUpperCase())}function Ht(e){return lC.has(e.toUpperCase())}function $f(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function qs(e,t){let n=typeof t=="string"?Hn(t).search:t.search;if(e[e.length-1].route.index&&$f(n||""))return e[e.length-1];let r=Tw(e);return r[r.length-1]}function zh(e){let{formMethod:t,formAction:n,formEncType:r,text:a,formData:i,json:o}=e;if(!(!t||!n||!r)){if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:a};if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:i,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 Bc(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 FC(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 Ji(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 jC(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 ir(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 VC(e,t){try{let n=e.sessionStorage.getItem(Dw);if(n){let r=JSON.parse(n);for(let[a,i]of Object.entries(r||{}))i&&Array.isArray(i)&&t.set(a,new Set(i||[]))}}catch{}}function BC(e,t){if(t.size>0){let n={};for(let[r,a]of t)n[r]=[...a];try{e.sessionStorage.setItem(Dw,JSON.stringify(n))}catch(r){xt(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function qh(){let e,t,n=new Promise((r,a)=>{e=async i=>{r(i);try{await n}catch{}},t=async i=>{a(i);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var Ua=d.createContext(null);Ua.displayName="DataRouter";var os=d.createContext(null);os.displayName="DataRouterState";var Kw=d.createContext(!1);function Gw(){return d.useContext(Kw)}var zf=d.createContext({isTransitioning:!1});zf.displayName="ViewTransition";var Hw=d.createContext(new Map);Hw.displayName="Fetchers";var UC=d.createContext(null);UC.displayName="Await";var kn=d.createContext(null);kn.displayName="Navigation";var Ul=d.createContext(null);Ul.displayName="Location";var Wn=d.createContext({outlet:null,matches:[],isDataRoute:!1});Wn.displayName="Route";var qf=d.createContext(null);qf.displayName="RouteError";var Ww="REACT_ROUTER_ERROR",$C="REDIRECT",zC="ROUTE_ERROR_RESPONSE";function qC(e){if(e.startsWith(`${Ww}:${$C}:{`))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 KC(e){if(e.startsWith(`${Ww}:${zC}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new as(t.status,t.statusText,t.data)}catch{}}function Xw(e,{relative:t}={}){ze(Fi(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=d.useContext(kn),{hash:a,pathname:i,search:o}=ss(e,{relative:t}),s=i;return n!=="/"&&(s=i==="/"?n:Sn([n,i])),r.createHref({pathname:s,search:o,hash:a})}function Fi(){return d.useContext(Ul)!=null}function Nn(){return ze(Fi(),"useLocation() may be used only in the context of a component."),d.useContext(Ul).location}function IB(e){ze(Fi(),"useMatch() may be used only in the context of a component.");let{pathname:t}=Nn();return d.useMemo(()=>Ci(e,Pw(t)),[t,e])}var Yw="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Jw(e){d.useContext(kn).static||d.useLayoutEffect(e)}function Kf(){let{isDataRoute:e}=d.useContext(Wn);return e?oR():GC()}function GC(){ze(Fi(),"useNavigate() may be used only in the context of a component.");let e=d.useContext(Ua),{basename:t,navigator:n}=d.useContext(kn),{matches:r}=d.useContext(Wn),{pathname:a}=Nn(),i=JSON.stringify(jf(r)),o=d.useRef(!1);return Jw(()=>{o.current=!0}),d.useCallback((l,c={})=>{if(xt(o.current,Yw),!o.current)return;if(typeof l=="number"){n.go(l);return}let u=Bl(l,JSON.parse(i),a,c.relative==="path");e==null&&t!=="/"&&(u.pathname=u.pathname==="/"?t:Sn([t,u.pathname])),(c.replace?n.replace:n.push)(u,c.state,c)},[t,n,i,a,e])}var HC=d.createContext(null);function WC(e){let t=d.useContext(Wn).outlet;return d.useMemo(()=>t&&d.createElement(HC.Provider,{value:e},t),[t,e])}function kB(){let{matches:e}=d.useContext(Wn);return e[e.length-1]?.params??{}}function ss(e,{relative:t}={}){let{matches:n}=d.useContext(Wn),{pathname:r}=Nn(),a=JSON.stringify(jf(n));return d.useMemo(()=>Bl(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function XC(e,t,n){ze(Fi(),"useRoutes() may be used only in the context of a component.");let{navigator:r}=d.useContext(kn),{matches:a}=d.useContext(Wn),i=a[a.length-1],o=i?i.params:{},s=i?i.pathname:"/",l=i?i.pathnameBase:"/",c=i&&i.route;{let v=c&&c.path||"";ex(s,!c||v.endsWith("*")||v.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${s}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. Please change the parent to .`)}let u=Nn(),p;p=u;let f=p.pathname||"/",m=f;if(l!=="/"){let v=l.replace(/^\//,"").split("/");m="/"+f.replace(/^\//,"").split("/").slice(v.length).join("/")}let h=n&&n.state.matches.length?n.state.matches.map(v=>Object.assign(v,{route:n.manifest[v.route.id]||v.route})):Ew(e,{pathname:m});return xt(c||h!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),xt(h==null||h[h.length-1].route.element!==void 0||h[h.length-1].route.Component!==void 0||h[h.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`),eR(h&&h.map(v=>Object.assign({},v,{params:Object.assign({},o,v.params),pathname:Sn([l,r.encodeLocation?r.encodeLocation(v.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?l:Sn([l,r.encodeLocation?r.encodeLocation(v.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathnameBase])})),a,n)}function YC(){let e=iR(),t=jo(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",e),o=d.createElement(d.Fragment,null,d.createElement("p",null,"💿 Hey developer 👋"),d.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",d.createElement("code",{style:i},"ErrorBoundary")," or"," ",d.createElement("code",{style:i},"errorElement")," prop on your route.")),d.createElement(d.Fragment,null,d.createElement("h2",null,"Unexpected Application Error!"),d.createElement("h3",{style:{fontStyle:"italic"}},t),n?d.createElement("pre",{style:a},n):null,o)}var JC=d.createElement(YC,null),Zw=class extends d.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.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"){const n=KC(e.digest);n&&(e=n)}let t=e!==void 0?d.createElement(Wn.Provider,{value:this.props.routeContext},d.createElement(qf.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?d.createElement(ZC,{error:e},t):t}};Zw.contextType=Kw;var Uc=new WeakMap;function ZC({children:e,error:t}){let{basename:n}=d.useContext(kn);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=qC(t.digest);if(r){let a=Uc.get(t);if(a)throw a;let i=kw(r.location,n),o=i.absoluteURL||i.to;if(yp(o))throw new Error("Invalid redirect location");if(Iw&&!Uc.get(t))if(i.isExternal||r.reloadDocument)window.location.href=o;else{const s=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw Uc.set(t,s),s}return d.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o}`})}}return e}function QC({routeContext:e,match:t,children:n}){let r=d.useContext(Ua);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),d.createElement(Wn.Provider,{value:e},n)}function eR(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 a=e,i=r?.errors;if(i!=null){let u=a.findIndex(p=>p.route.id&&i?.[p.route.id]!==void 0);ze(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),a=a.slice(0,Math.min(a.length,u+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let u=0;u=0?a=a.slice(0,s+1):a=[a[0]];break}}}}let l=n?.onError,c=r&&l?(u,p)=>{l(u,{location:r.location,params:r.matches?.[0]?.params??{},pattern:is(r.matches),errorInfo:p})}:void 0;return a.reduceRight((u,p,f)=>{let m,h=!1,g=null,v=null;r&&(m=i&&p.route.id?i[p.route.id]:void 0,g=p.route.errorElement||JC,o&&(s<0&&f===0?(ex("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),h=!0,v=null):s===f&&(h=!0,v=p.route.hydrateFallbackElement||null)));let w=t.concat(a.slice(0,f+1)),y=()=>{let R;return m?R=g:h?R=v:p.route.Component?R=d.createElement(p.route.Component,null):p.route.element?R=p.route.element:R=u,d.createElement(QC,{match:p,routeContext:{outlet:u,matches:w,isDataRoute:r!=null},children:R})};return r&&(p.route.ErrorBoundary||p.route.errorElement||f===0)?d.createElement(Zw,{location:r.location,revalidation:r.revalidation,component:g,error:m,children:y(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:c}):y()},null)}function Gf(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=d.useContext(Ua);return ze(t,Gf(e)),t}function Qw(e){let t=d.useContext(os);return ze(t,Gf(e)),t}function nR(e){let t=d.useContext(Wn);return ze(t,Gf(e)),t}function Hf(e){let t=nR(e),n=t.matches[t.matches.length-1];return ze(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function rR(){return Hf("useRouteId")}function aR(){let{matches:e,loaderData:t}=Qw("useMatches");return d.useMemo(()=>e.map(n=>Ow(n,t)),[e,t])}function iR(){let e=d.useContext(qf),t=Qw("useRouteError"),n=Hf("useRouteError");return e!==void 0?e:t.errors?.[n]}function oR(){let{router:e}=tR("useNavigate"),t=Hf("useNavigate"),n=d.useRef(!1);return Jw(()=>{n.current=!0}),d.useCallback(async(a,i={})=>{xt(n.current,Yw),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...i}))},[e,t])}var Kh={};function ex(e,t,n){!t&&!Kh[e]&&(Kh[e]=!0,xt(!1,n))}var Gh={};function Hh(e,t){!e&&!Gh[t]&&(Gh[t]=!0,console.warn(t))}var sR="useOptimistic",Wh=d[sR],lR=()=>{};function cR(e){return Wh?Wh(e):[e,lR]}function dR(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&xt(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:d.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&xt(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:d.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&xt(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:d.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var uR=["HydrateFallback","hydrateFallbackElement"],pR=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",t(n))}})}};function fR({router:e,flushSync:t,onError:n,useTransitions:r}){r=Gw()||r;let[i,o]=d.useState(e.state),[s,l]=cR(i),[c,u]=d.useState(),[p,f]=d.useState({isTransitioning:!1}),[m,h]=d.useState(),[g,v]=d.useState(),[w,y]=d.useState(),R=d.useRef(new Map),E=d.useCallback((x,{deletedFetchers:N,newErrors:L,flushSync:D,viewTransitionOpts:P})=>{L&&n&&Object.values(L).forEach(C=>n(C,{location:x.location,params:x.matches[0]?.params??{},pattern:is(x.matches)})),x.fetchers.forEach((C,A)=>{C.data!==void 0&&R.current.set(A,C.data)}),N.forEach(C=>R.current.delete(C)),Hh(D===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `` 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 S=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(Hh(P==null||S,"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."),!P||!S){t&&D?t(()=>o(x)):r===!1?o(x):d.startTransition(()=>{r===!0&&l(C=>Xh(C,x)),o(x)});return}if(t&&D){t(()=>{g&&(m?.resolve(),g.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:P.currentLocation,nextLocation:P.nextLocation})});let C=e.window.document.startViewTransition(()=>{t(()=>o(x))});C.finished.finally(()=>{t(()=>{h(void 0),v(void 0),u(void 0),f({isTransitioning:!1})})}),t(()=>v(C));return}g?(m?.resolve(),g.skipTransition(),y({state:x,currentLocation:P.currentLocation,nextLocation:P.nextLocation})):(u(x),f({isTransitioning:!0,flushSync:!1,currentLocation:P.currentLocation,nextLocation:P.nextLocation}))},[e.window,t,g,m,r,l,n]);d.useLayoutEffect(()=>e.subscribe(E),[e,E]),d.useEffect(()=>{p.isTransitioning&&!p.flushSync&&h(new pR)},[p]),d.useEffect(()=>{if(m&&c&&e.window){let x=c,N=m.promise,L=e.window.document.startViewTransition(async()=>{r===!1?o(x):d.startTransition(()=>{r===!0&&l(D=>Xh(D,x)),o(x)}),await N});L.finished.finally(()=>{h(void 0),v(void 0),u(void 0),f({isTransitioning:!1})}),v(L)}},[c,m,e.window,r,l]),d.useEffect(()=>{m&&c&&s.location.key===c.location.key&&m.resolve()},[m,g,s.location,c]),d.useEffect(()=>{!p.isTransitioning&&w&&(u(w.state),f({isTransitioning:!0,flushSync:!1,currentLocation:w.currentLocation,nextLocation:w.nextLocation}),y(void 0))},[p.isTransitioning,w]);let O=d.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:x=>e.navigate(x),push:(x,N,L)=>e.navigate(x,{state:N,preventScrollReset:L?.preventScrollReset}),replace:(x,N,L)=>e.navigate(x,{replace:!0,state:N,preventScrollReset:L?.preventScrollReset})}),[e]),I=e.basename||"/",k=d.useMemo(()=>({router:e,navigator:O,static:!1,basename:I,onError:n}),[e,O,I,n]);return d.createElement(d.Fragment,null,d.createElement(Ua.Provider,{value:k},d.createElement(os.Provider,{value:s},d.createElement(Hw.Provider,{value:R.current},d.createElement(zf.Provider,{value:p},d.createElement(vR,{basename:I,location:s.location,navigationType:s.historyAction,navigator:O,useTransitions:r},d.createElement(mR,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:n})))))),null)}function Xh(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var mR=d.memo(hR);function hR({routes:e,manifest:t,future:n,state:r,isStatic:a,onError:i}){return XC(e,void 0,{manifest:t,state:r,isStatic:a,onError:i})}function gR(e){return WC(e.context)}function vR({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:i=!1,useTransitions:o}){ze(!Fi(),"You cannot render a inside another . You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=d.useMemo(()=>({basename:s,navigator:a,static:i,useTransitions:o,future:{}}),[s,a,i,o]);typeof n=="string"&&(n=Hn(n));let{pathname:c="/",search:u="",hash:p="",state:f=null,key:m="default",mask:h}=n,g=d.useMemo(()=>{let v=Pn(c,s);return v==null?null:{location:{pathname:v,search:u,hash:p,state:f,key:m,mask:h},navigationType:r}},[s,c,u,p,f,m,r,h]);return xt(g!=null,` is not able to match the URL "${c}${u}${p}" because it does not start with the basename, so the won't render anything.`),g==null?null:d.createElement(kn.Provider,{value:l},d.createElement(Ul.Provider,{children:t,value:g}))}var Ks="get",Gs="application/x-www-form-urlencoded";function $l(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function bR(e){return $l(e)&&e.tagName.toLowerCase()==="button"}function yR(e){return $l(e)&&e.tagName.toLowerCase()==="form"}function wR(e){return $l(e)&&e.tagName.toLowerCase()==="input"}function xR(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ER(e,t){return e.button===0&&(!t||t==="_self")&&!xR(e)}function xp(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(a=>[n,a]):[[n,r]])},[]))}function OR(e,t){let n=xp(e);return t&&t.forEach((r,a)=>{n.has(a)||t.getAll(a).forEach(i=>{n.append(a,i)})}),n}var Ts=null;function SR(){if(Ts===null)try{new FormData(document.createElement("form"),0),Ts=!1}catch{Ts=!0}return Ts}var _R=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function $c(e){return e!=null&&!_R.has(e)?(xt(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Gs}"`),null):e}function CR(e,t){let n,r,a,i,o;if(yR(e)){let s=e.getAttribute("action");r=s?Pn(s,t):null,n=e.getAttribute("method")||Ks,a=$c(e.getAttribute("enctype"))||Gs,i=new FormData(e)}else if(bR(e)||wR(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a