var wd=Object.defineProperty;var Ed=(e,t,n)=>t in e?wd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var cu=(e,t,n)=>Ed(e,typeof t!="symbol"?t+"":t,n);import{n as xd,Q as kd,c as Cd,a as _d,S as Pd,F as Rd,f as Fa,b as Ld}from"./vendor_tanstack-C4tHEw0C.js";import{w as Zo,a as Td,i as xe,s as Nd,_ as Ia,b as ja,c as Md,d as zd}from"./vendor_X-NJT_EpIc.js";import{c as Od,s as $a,u as fu,i as Fd}from"./vendor_mui-zY3q7frF.js";function Id(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var Wv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Da(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Hv(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var Aa={exports:{}},Jo={},Ua={exports:{}},z={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Ir=Symbol.for("react.element"),jd=Symbol.for("react.portal"),$d=Symbol.for("react.fragment"),Dd=Symbol.for("react.strict_mode"),Ad=Symbol.for("react.profiler"),Ud=Symbol.for("react.provider"),Bd=Symbol.for("react.context"),Vd=Symbol.for("react.forward_ref"),Wd=Symbol.for("react.suspense"),Hd=Symbol.for("react.memo"),Qd=Symbol.for("react.lazy"),du=Symbol.iterator;function Kd(e){return e===null||typeof e!="object"?null:(e=du&&e[du]||e["@@iterator"],typeof e=="function"?e:null)}var Ba={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Va=Object.assign,Wa={};function Kn(e,t,n){this.props=e,this.context=t,this.refs=Wa,this.updater=n||Ba}Kn.prototype.isReactComponent={};Kn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Kn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ha(){}Ha.prototype=Kn.prototype;function ss(e,t,n){this.props=e,this.context=t,this.refs=Wa,this.updater=n||Ba}var us=ss.prototype=new Ha;us.constructor=ss;Va(us,Kn.prototype);us.isPureReactComponent=!0;var pu=Array.isArray,Qa=Object.prototype.hasOwnProperty,as={current:null},Ka={key:!0,ref:!0,__self:!0,__source:!0};function Ga(e,t,n){var r,o={},i=null,l=null;if(t!=null)for(r in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(i=""+t.key),t)Qa.call(t,r)&&!Ka.hasOwnProperty(r)&&(o[r]=t[r]);var s=arguments.length-2;if(s===1)o.children=n;else if(1{const t=_.useContext(Za);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Kv=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),T.jsx(Za.Provider,{value:e,children:t})),Ja=_.createContext(!1),op=()=>_.useContext(Ja);Ja.Provider;function ip(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var lp=_.createContext(ip()),sp=()=>_.useContext(lp);function up(e,t){return typeof e=="function"?e(...t):!!e}var ap=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},cp=e=>{_.useEffect(()=>{e.clearReset()},[e])},fp=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&up(n,[e.error,r]),dp=(e,t)=>t.state.data===void 0,pp=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},hp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,mp=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function vp(e,t,n){var a,f,h,m;const r=rp(),o=op(),i=sp(),l=r.defaultQueryOptions(e);(f=(a=r.getDefaultOptions().queries)==null?void 0:a._experimental_beforeQuery)==null||f.call(a,l),l._optimisticResults=o?"isRestoring":"optimistic",pp(l),ap(l,i),cp(i);const[s]=_.useState(()=>new t(r,l)),u=s.getOptimisticResult(l);if(_.useSyncExternalStore(_.useCallback(v=>{const g=o?()=>{}:s.subscribe(xd.batchCalls(v));return s.updateResult(),g},[s,o]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),_.useEffect(()=>{s.setOptions(l,{listeners:!1})},[l,s]),hp(l,u))throw mp(l,s,i);if(fp({result:u,errorResetBoundary:i,throwOnError:l.throwOnError,query:r.getQueryCache().get(l.queryHash)}))throw u.error;return(m=(h=r.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||m.call(h,l,u),l.notifyOnChangeProps?u:s.trackResult(u)}function Gv(e,t){return vp({...e,enabled:!0,suspense:!0,throwOnError:dp,placeholderData:void 0},kd)}function Xv(e){return e}const Di=_.createContext(null);function qa(){return typeof document>"u"?Di:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=Di,Di)}function Ut(e){const t=_.useContext(qa());return Zo(!(((e==null?void 0:e.warn)??!0)&&!t)),t}function wo(e,t=n=>n){return Td.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,yp)}function yp(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r{t.substring(0,1)==="?"&&(t=t.substring(1));const n=Sp(t);for(const r in n){const o=n[r];if(typeof o=="string")try{n[r]=e(o)}catch{}}return n}}function kp(e,t){function n(r){if(typeof r=="object"&&r!==null)try{return e(r)}catch{}else if(typeof r=="string"&&typeof t=="function")try{return t(r),e(r)}catch{}return r}return r=>{r={...r},Object.keys(r).forEach(i=>{const l=r[i];typeof l>"u"||l===void 0?delete r[i]:r[i]=n(l)});const o=gp(r).toString();return o?`?${o}`:""}}function Eo(e){return e[e.length-1]}function Cp(e){return typeof e=="function"}function yn(e,t){return Cp(e)?e(t):e}function ur(e,t){return t.reduce((n,r)=>(n[r]=e[r],n),{})}function nt(e,t){if(e===t)return e;const n=t,r=yu(e)&&yu(n);if(r||xo(e)&&xo(n)){const o=r?e:Object.keys(e),i=o.length,l=r?n:Object.keys(n),s=l.length,u=r?[]:{};let a=0;for(let f=0;f"u")return!0;const n=t.prototype;return!(!vu(n)||!n.hasOwnProperty("isPrototypeOf"))}function vu(e){return Object.prototype.toString.call(e)==="[object Object]"}function yu(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Nn(e,t,n=!1){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(xo(e)&&xo(t)){const r=Object.keys(e).filter(i=>e[i]!==void 0),o=Object.keys(t).filter(i=>t[i]!==void 0);return!n&&r.length!==o.length?!1:!o.some(i=>!(i in e)||!Nn(e[i],t[i],n))}return Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:!e.some((r,o)=>!Nn(r,t[o],n)):!1}const Ai=typeof window<"u"?_.useLayoutEffect:_.useEffect;function mn(e){let t,n;const r=new Promise((o,i)=>{t=o,n=i});return r.status="pending",r.resolve=o=>{r.status="resolved",r.value=o,t(o),e==null||e(o)},r.reject=o=>{r.status="rejected",n(o)},r}function gu(e){const t=_.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function Tt(e){return qo(e.filter(Boolean).join("/"))}function qo(e){return e.replace(/\/{2,}/g,"/")}function fs(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Jt(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function _p(e){return Jt(fs(e))}function ko(e,t){return e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Pp(e,t,n){return ko(e,n)===ko(t,n)}function Rp({basepath:e,base:t,to:n,trailingSlash:r="never"}){var o,i;t=t.replace(new RegExp(`^${e}`),"/"),n=n.replace(new RegExp(`^${e}`),"/");let l=$n(t);const s=$n(n);l.length>1&&((o=Eo(l))==null?void 0:o.value)==="/"&&l.pop(),s.forEach((a,f)=>{a.value==="/"?f?f===s.length-1&&l.push(a):l=[a]:a.value===".."?l.pop():a.value==="."||l.push(a)}),l.length>1&&(((i=Eo(l))==null?void 0:i.value)==="/"?r==="never"&&l.pop():r==="always"&&l.push({type:"pathname",value:"/"}));const u=Tt([e,...l.map(a=>a.value)]);return qo(u)}function $n(e){if(!e)return[];e=qo(e);const t=[];if(e.slice(0,1)==="/"&&(e=e.substring(1),t.push({type:"pathname",value:"/"})),!e)return t;const n=e.split("/").filter(Boolean);return t.push(...n.map(r=>r==="$"||r==="*"?{type:"wildcard",value:r}:r.charAt(0)==="$"?{type:"param",value:r}:{type:"pathname",value:decodeURIComponent(r)})),e.slice(-1)==="/"&&(e=e.substring(1),t.push({type:"pathname",value:"/"})),t}function Ui({path:e,params:t,leaveWildcards:n,leaveParams:r}){const o=$n(e),i={};for(const[l,s]of Object.entries(t)){const u=typeof s=="string";["*","_splat"].includes(l)?i[l]=u?encodeURI(s):s:i[l]=u?encodeURIComponent(s):s}return Tt(o.map(l=>{if(l.type==="wildcard"){const s=i._splat;return n?`${l.value}${s??""}`:s}if(l.type==="param"){if(r){const s=i[l.value];return`${l.value}${s??""}`}return i[l.value.substring(1)]??"undefined"}return l.value}))}function Vr(e,t,n){const r=Lp(e,t,n);if(!(n.to&&!r))return r??{}}function Su(e,t){switch(!0){case e==="/":return t;case t===e:return"";case t.length{for(let u=0;u=o.length-1,m=u>=i.length-1;if(f){if(f.type==="wildcard"){if(a!=null&&a.value){const v=decodeURI(Tt(o.slice(u).map(g=>g.value)));return l["*"]=v,l._splat=v,!0}return!1}if(f.type==="pathname"){if(f.value==="/"&&!(a!=null&&a.value))return!0;if(a){if(n.caseSensitive){if(f.value!==a.value)return!1}else if(f.value.toLowerCase()!==a.value.toLowerCase())return!1}}if(!a)return!1;if(f.type==="param"){if(a.value==="/")return!1;a.value.charAt(0)!=="$"&&(l[f.value.substring(1)]=decodeURIComponent(a.value))}}if(!h&&m)return l["**"]=Tt(o.slice(u+1).map(v=>v.value)),!!n.fuzzy&&(f==null?void 0:f.value)!=="/"}return!0})()?l:void 0}function Yv(e){if(e.isRedirect=!0,e.statusCode=e.statusCode||e.code||301,e.headers=e.headers||{},e.throw)throw e;return e}function Kt(e){return!!(e!=null&&e.isRedirect)}function wu(e){return!!(e!=null&&e.isRedirect)&&e.href}function ds(e){const t=e.errorComponent??bo;return T.jsx(Tp,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?_.createElement(t,{error:n,reset:r}):e.children})}class Tp extends _.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}reset(){this.setState({error:null})}componentDidUpdate(t,n){n.error&&n.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(t,n){this.props.onCatch&&this.props.onCatch(t,n)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function bo({error:e}){const[t,n]=_.useState(!1);return T.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[T.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),T.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(r=>!r),children:t?"Hide Error":"Show Error"})]}),T.jsx("div",{style:{height:".25rem"}}),t?T.jsx("div",{children:T.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?T.jsx("code",{children:e.message}):null})}):null]})}function ye(e){const t=Ut({warn:(e==null?void 0:e.router)===void 0});return wo(((e==null?void 0:e.router)||t).__store,e==null?void 0:e.select)}function ot(e){return!!(e!=null&&e.isNotFound)}function Np(e){const t=ye({select:n=>`not-found-${n.location.pathname}-${n.status}`});return T.jsx(ds,{getResetKey:()=>t,onCatch:(n,r)=>{var o;if(ot(n))(o=e.onCatch)==null||o.call(e,n,r);else throw n},errorComponent:({error:n})=>{var r;return(r=e.fallback)==null?void 0:r.call(e,n)},children:e.children})}function Mp(){return T.jsx("p",{children:"Not Found"})}const zp=["component","errorComponent","pendingComponent","notFoundComponent"];function Zv(e){return new Op(e)}class Op{constructor(t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.subscribers=new Set,this.startReactTransition=n=>n(),this.update=n=>{n.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/guide/not-found-errors#migrating-from-notfoundroute for more info.");const r=this.options;this.options={...this.options,...n},this.isServer=this.options.isServer??typeof document>"u",(!this.basepath||n.basepath&&n.basepath!==r.basepath)&&(n.basepath===void 0||n.basepath===""||n.basepath==="/"?this.basepath="/":this.basepath=`/${_p(n.basepath)}`),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history??(this.isServer?Cd({initialEntries:[this.basepath||"/"]}):_d()),this.latestLocation=this.parseLocation()),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),this.__store||(this.__store=new Pd(jp(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(o=>!["redirected"].includes(o.status))}}}))},this.buildRouteTree=()=>{this.routesById={},this.routesByPath={};const n=this.options.notFoundRoute;n&&(n.init({originalIndex:99999999999}),this.routesById[n.id]=n);const r=l=>{l.forEach((s,u)=>{s.init({originalIndex:u});const a=this.routesById[s.id];if(xe(!a,`Duplicate routes found with id: ${String(s.id)}`),this.routesById[s.id]=s,!s.isRoot&&s.path){const h=Jt(s.fullPath);(!this.routesByPath[h]||s.fullPath.endsWith("/"))&&(this.routesByPath[h]=s)}const f=s.children;f!=null&&f.length&&r(f)})};r([this.routeTree]);const o=[];Object.values(this.routesById).forEach((l,s)=>{var u;if(l.isRoot||!l.path)return;const a=fs(l.fullPath),f=$n(a);for(;f.length>1&&((u=f[0])==null?void 0:u.value)==="/";)f.shift();const h=f.map(m=>m.value==="/"?.75:m.type==="param"?.5:m.type==="wildcard"?.25:1);o.push({child:l,trimmed:a,parsed:f,index:s,scores:h})}),this.flatRoutes=o.sort((l,s)=>{const u=Math.min(l.scores.length,s.scores.length);for(let a=0;as.parsed[a].value?1:-1;return l.index-s.index}).map((l,s)=>(l.child.rank=s,l.child))},this.subscribe=(n,r)=>{const o={eventType:n,fn:r};return this.subscribers.add(o),()=>{this.subscribers.delete(o)}},this.emit=n=>{this.subscribers.forEach(r=>{r.eventType===n.type&&r.fn(n)})},this.parseLocation=n=>{const r=({pathname:s,search:u,hash:a,state:f})=>{const h=this.options.parseSearch(u),m=this.options.stringifySearch(h);return{pathname:s,searchStr:m,search:nt(n==null?void 0:n.search,h),hash:a.split("#").reverse()[0]??"",href:`${s}${m}${a}`,state:nt(n==null?void 0:n.state,f)}},o=r(this.history.location),{__tempLocation:i,__tempKey:l}=o.state;if(i&&(!l||l===this.tempLocationKey)){const s=r(i);return s.state.key=o.state.key,delete s.state.__tempLocation,{...s,maskedLocation:o}}return o},this.resolvePathWithBase=(n,r)=>Rp({basepath:this.basepath,base:n,to:qo(r),trailingSlash:this.options.trailingSlash}),this.matchRoutes=(n,r,o)=>{let i={};const l=this.flatRoutes.find(v=>{const g=Vr(this.basepath,Jt(n),{to:v.fullPath,caseSensitive:v.options.caseSensitive??this.options.caseSensitive,fuzzy:!0});return g?(i=g,!0):!1});let s=l||this.routesById[Te];const u=[s];let a=!1;for((l?l.path!=="/"&&i["**"]:Jt(n))&&(this.options.notFoundRoute?u.push(this.options.notFoundRoute):a=!0);s.parentRoute;)s=s.parentRoute,u.unshift(s);const f=(()=>{if(a){if(this.options.notFoundMode!=="root")for(let v=u.length-1;v>=0;v--){const g=u[v];if(g.children)return g.id}return Te}})(),h=u.map(v=>{var g;let S;const R=((g=v.options.params)==null?void 0:g.parse)??v.options.parseParams;if(R)try{const p=R(i);Object.assign(i,p)}catch(p){if(S=new Ip(p.message,{cause:p}),o!=null&&o.throwOnError)throw S;return S}}),m=[];return u.forEach((v,g)=>{var S,R,p,c,d,y,x,C,k,w;const N=m[g-1],[L,M]=(()=>{const Y=(N==null?void 0:N.search)??r;try{const fe=typeof v.options.validateSearch=="object"?v.options.validateSearch.parse:v.options.validateSearch,Ee=(fe==null?void 0:fe(Y))??{};return[{...Y,...Ee},void 0]}catch(fe){const Ee=new Fp(fe.message,{cause:fe});if(o!=null&&o.throwOnError)throw Ee;return[Y,Ee]}})(),K=((R=(S=v.options).loaderDeps)==null?void 0:R.call(S,{search:L}))??"",$=K?JSON.stringify(K):"",ee=Ui({path:v.fullPath,params:i}),le=Ui({path:v.id,params:i,leaveWildcards:!0})+$,ce=this.getMatch(le),et=this.state.matches.find(Y=>Y.id===le)?"stay":"enter";let X;if(ce)X={...ce,cause:et,params:i};else{const Y=v.options.loader||v.options.beforeLoad||v.lazyFn?"pending":"success";X={id:le,index:g,routeId:v.id,params:i,pathname:Tt([this.basepath,ee]),updatedAt:Date.now(),search:{},searchError:void 0,status:Y,isFetching:!1,error:void 0,paramsError:h[g],routeContext:void 0,context:void 0,abortController:new AbortController,fetchCount:0,cause:et,loaderDeps:K,invalid:!1,preload:!1,links:(c=(p=v.options).links)==null?void 0:c.call(p),scripts:(y=(d=v.options).scripts)==null?void 0:y.call(d),staticData:v.options.staticData||{},loadPromise:mn()}}X.status==="success"&&(X.meta=(C=(x=v.options).meta)==null?void 0:C.call(x,{matches:m,match:X,params:X.params,loaderData:X.loaderData}),X.headers=(w=(k=v.options).headers)==null?void 0:w.call(k,{loaderData:X.loaderData})),o!=null&&o.preload||(X.globalNotFound=f===v.id),X.search=nt(X.search,L),X.searchError=M,m.push(X)}),m},this.cancelMatch=n=>{const r=this.getMatch(n);r&&(r.abortController.abort(),clearTimeout(r.pendingTimeout))},this.cancelMatches=()=>{var n;(n=this.state.pendingMatches)==null||n.forEach(r=>{this.cancelMatch(r.id)})},this.buildLocation=n=>{const r=(i={},l)=>{var s,u,a;const f=i._fromLocation!=null?this.matchRoutes(i._fromLocation.pathname,i.fromSearch||i._fromLocation.search):this.state.matches,h=i.from!=null?f.find($=>Vr(this.basepath,Jt($.pathname),{to:i.from,caseSensitive:!1,fuzzy:!1})):void 0,m=(h==null?void 0:h.pathname)||this.latestLocation.pathname;xe(i.from==null||h!=null,"Could not find match for from: "+i.from);const v=((s=Eo(f))==null?void 0:s.search)||this.latestLocation.search,g=l==null?void 0:l.filter($=>f.find(ee=>ee.routeId===$.routeId)),S=this.routesById[(u=g==null?void 0:g.find($=>$.pathname===m))==null?void 0:u.routeId];let R=i.to?this.resolvePathWithBase(m,`${i.to}`):this.resolvePathWithBase(m,(S==null?void 0:S.to)??m);const p={...(a=Eo(f))==null?void 0:a.params};let c=(i.params??!0)===!0?p:{...p,...yn(i.params,p)};Object.keys(c).length>0&&(l==null||l.map($=>{var ee;const le=this.looseRoutesById[$.routeId];return((ee=le==null?void 0:le.options.params)==null?void 0:ee.stringify)??le.options.stringifyParams}).filter(Boolean).forEach($=>{c={...c,...$(c)}})),R=Ui({path:R,params:c??{},leaveWildcards:!1,leaveParams:n.leaveParams});const d=(g==null?void 0:g.map($=>this.looseRoutesById[$.routeId].options.preSearchFilters??[]).flat().filter(Boolean))??[],y=(g==null?void 0:g.map($=>this.looseRoutesById[$.routeId].options.postSearchFilters??[]).flat().filter(Boolean))??[],x=d.length?d.reduce(($,ee)=>ee($),v):v,C=i.search===!0?x:i.search?yn(i.search,x):d.length?x:{},k=y.length?y.reduce(($,ee)=>ee($),C):C,w=nt(v,k),N=this.options.stringifySearch(w),L=i.hash===!0?this.latestLocation.hash:i.hash?yn(i.hash,this.latestLocation.hash):void 0,M=L?`#${L}`:"";let K=i.state===!0?this.latestLocation.state:i.state?yn(i.state,this.latestLocation.state):{};return K=nt(this.latestLocation.state,K),{pathname:R,search:w,searchStr:N,state:K,hash:L??"",href:`${R}${N}${M}`,unmaskOnReload:i.unmaskOnReload}},o=(i={},l)=>{var s;const u=r(i);let a=l?r(l):void 0;if(!a){let g={};const S=(s=this.options.routeMasks)==null?void 0:s.find(R=>{const p=Vr(this.basepath,u.pathname,{to:R.from,caseSensitive:!1,fuzzy:!1});return p?(g=p,!0):!1});if(S){const{from:R,...p}=S;l={...ur(n,["from"]),...p,params:g},a=r(l)}}const f=this.matchRoutes(u.pathname,u.search),h=a?this.matchRoutes(a.pathname,a.search):void 0,m=a?r(l,h):void 0,v=r(i,f);return m&&(v.maskedLocation=m),v};return n.mask?o(n,{...ur(n,["from"]),...n.mask}):o(n)},this.commitLocation=({viewTransition:n,ignoreBlocker:r,...o})=>{const i=()=>{o.state.key=this.latestLocation.state.key;const u=Nn(o.state,this.latestLocation.state);return delete o.state.key,u},l=this.latestLocation.href===o.href,s=this.commitLocationPromise;if(this.commitLocationPromise=mn(()=>{s==null||s.resolve()}),l&&i())this.load();else{let{maskedLocation:u,...a}=o;u&&(a={...u,state:{...u.state,__tempKey:void 0,__tempLocation:{...a,search:a.searchStr,state:{...a.state,__tempKey:void 0,__tempLocation:void 0,key:void 0}}}},(a.unmaskOnReload??this.options.unmaskOnReload??!1)&&(a.state.__tempKey=this.tempLocationKey)),this.shouldViewTransition=n,this.history[o.replace?"replace":"push"](a.href,a.state,{ignoreBlocker:r})}return this.resetNextScroll=o.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,viewTransition:o,ignoreBlocker:i,...l}={})=>{const s=this.buildLocation(l);return this.commitLocation({...s,viewTransition:o,replace:n,resetScroll:r,ignoreBlocker:i})},this.navigate=({from:n,to:r,__isRedirect:o,...i})=>{const l=String(r);let s;try{new URL(`${l}`),s=!0}catch{}return xe(!s),this.buildAndCommitLocation({...i,from:n,to:r})},this.load=async()=>{this.latestLocation=this.parseLocation(this.latestLocation),this.__store.setState(i=>({...i,loadedAt:Date.now()}));let n,r;const o=new Promise(i=>{this.startReactTransition(async()=>{var l;try{const s=this.latestLocation,u=this.state.resolvedLocation,a=u.href!==s.href;this.cancelMatches();let f;this.__store.batch(()=>{f=this.matchRoutes(s.pathname,s.search),this.__store.setState(h=>({...h,status:"pending",isLoading:!0,location:s,pendingMatches:f,cachedMatches:h.cachedMatches.filter(m=>!f.find(v=>v.id===m.id))}))}),this.state.redirect||this.emit({type:"onBeforeNavigate",fromLocation:u,toLocation:s,pathChanged:a}),this.emit({type:"onBeforeLoad",fromLocation:u,toLocation:s,pathChanged:a}),await this.loadMatches({matches:f,location:s,onReady:async()=>{this.startViewTransition(async()=>{let h,m,v;this.__store.batch(()=>{this.__store.setState(g=>{const S=g.matches,R=g.pendingMatches||g.matches;return h=S.filter(p=>!R.find(c=>c.id===p.id)),m=R.filter(p=>!S.find(c=>c.id===p.id)),v=S.filter(p=>R.find(c=>c.id===p.id)),{...g,isLoading:!1,matches:R,pendingMatches:void 0,cachedMatches:[...g.cachedMatches,...h.filter(p=>p.status!=="error")]}}),this.cleanCache()}),[[h,"onLeave"],[m,"onEnter"],[v,"onStay"]].forEach(([g,S])=>{g.forEach(R=>{var p,c;(c=(p=this.looseRoutesById[R.routeId].options)[S])==null||c.call(p,R)})})})}})}catch(s){wu(s)?(n=s,this.isServer||this.navigate({...s,replace:!0,__isRedirect:!0})):ot(s)&&(r=s),this.__store.setState(u=>({...u,statusCode:n?n.statusCode:r?404:u.matches.some(a=>a.status==="error")?500:200,redirect:n}))}this.latestLoadPromise===o&&((l=this.commitLocationPromise)==null||l.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),i()})});for(this.latestLoadPromise=o,await o;this.latestLoadPromise&&o!==this.latestLoadPromise;)await this.latestLoadPromise},this.startViewTransition=n=>{var r,o;const i=this.shouldViewTransition??this.options.defaultViewTransition;delete this.shouldViewTransition,(o=(r=i&&typeof document<"u"?document:void 0)==null?void 0:r.startViewTransition)!=null&&o.call(r,n)||n()},this.updateMatch=(n,r)=>{var o;let i;const l=(o=this.state.pendingMatches)==null?void 0:o.find(a=>a.id===n),s=this.state.matches.find(a=>a.id===n),u=l?"pendingMatches":s?"matches":"cachedMatches";return this.__store.setState(a=>{var f;return{...a,[u]:(f=a[u])==null?void 0:f.map(h=>h.id===n?i=r(h):h)}}),i},this.getMatch=n=>[...this.state.cachedMatches,...this.state.pendingMatches??[],...this.state.matches].find(r=>r.id===n),this.loadMatches=async({location:n,matches:r,preload:o,onReady:i,updateMatch:l=this.updateMatch})=>{let s,u=!1;const a=async()=>{u||(u=!0,await(i==null?void 0:i()))};!this.isServer&&!this.state.matches.length&&a();const f=(h,m)=>{var v,g,S;if(wu(m))throw m;if(Kt(m)||ot(m)){if(l(h.id,R=>({...R,status:Kt(m)?"redirected":ot(m)?"notFound":"error",isFetching:!1,error:m,beforeLoadPromise:void 0,loaderPromise:void 0})),m.routeId||(m.routeId=h.routeId),(v=h.beforeLoadPromise)==null||v.resolve(),(g=h.loaderPromise)==null||g.resolve(),(S=h.loadPromise)==null||S.resolve(),Kt(m))throw u=!0,m=this.resolveRedirect({...m,_fromLocation:n}),m;if(ot(m))throw this._handleNotFound(r,m,{updateMatch:l}),m}};try{await new Promise((h,m)=>{(async()=>{var v,g,S;try{const R=(d,y,x)=>{var C,k;const{id:w,routeId:N}=r[d],L=this.looseRoutesById[N];if(y instanceof Promise)throw y;y.routerCode=x,s=s??d,f(this.getMatch(w),y);try{(k=(C=L.options).onError)==null||k.call(C,y)}catch(M){y=M,f(this.getMatch(w),y)}l(w,M=>{var K;return(K=M.beforeLoadPromise)==null||K.resolve(),{...M,error:y,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController,beforeLoadPromise:void 0}})};for(const[d,{id:y,routeId:x}]of r.entries()){const C=this.getMatch(y);if(C.beforeLoadPromise||C.loaderPromise)await C.beforeLoadPromise;else{try{l(y,Z=>({...Z,loadPromise:mn(()=>{var $e;($e=Z.loadPromise)==null||$e.resolve()}),beforeLoadPromise:mn()}));const k=this.looseRoutesById[x],w=new AbortController,N=(v=r[d-1])==null?void 0:v.id,L=()=>N?this.getMatch(N).context??this.options.context??{}:this.options.context??{},M=k.options.pendingMs??this.options.defaultPendingMs,K=!!(i&&!this.isServer&&!o&&(k.options.loader||k.options.beforeLoad)&&typeof M=="number"&&M!==1/0&&(k.options.pendingComponent??this.options.defaultPendingComponent));let $;K&&($=setTimeout(()=>{try{a()}catch{}},M));const{paramsError:ee,searchError:le}=this.getMatch(y);ee&&R(d,ee,"PARSE_PARAMS"),le&&R(d,le,"VALIDATE_SEARCH");const ce=L();l(y,Z=>({...Z,isFetching:"beforeLoad",fetchCount:Z.fetchCount+1,routeContext:nt(Z.routeContext,ce),context:nt(Z.context,ce),abortController:w,pendingTimeout:$}));const{search:et,params:X,routeContext:Y,cause:fe}=this.getMatch(y),Ee={search:et,abortController:w,params:X,preload:!!o,context:Y,location:n,navigate:Z=>this.navigate({...Z,_fromLocation:n}),buildLocation:this.buildLocation,cause:o?"preload":fe},je=await((S=(g=k.options).beforeLoad)==null?void 0:S.call(g,Ee))??{};(Kt(je)||ot(je))&&R(d,je,"BEFORE_LOAD"),l(y,Z=>{const $e={...Z.routeContext,...je};return{...Z,routeContext:nt(Z.routeContext,$e),context:nt(Z.context,$e),abortController:w}})}catch(k){R(d,k,"BEFORE_LOAD")}l(y,k=>{var w;return(w=k.beforeLoadPromise)==null||w.resolve(),{...k,beforeLoadPromise:void 0,isFetching:!1}})}}const p=r.slice(0,s),c=[];p.forEach(({id:d,routeId:y},x)=>{c.push((async()=>{const{loaderPromise:C}=this.getMatch(d);if(C)await C;else{const k=c[x-1],w=this.looseRoutesById[y],N=()=>{const{params:Y,loaderDeps:fe,abortController:Ee,context:je,cause:Z}=this.getMatch(d);return{params:Y,deps:fe,preload:!!o,parentMatchPromise:k,abortController:Ee,context:je,location:n,navigate:$e=>this.navigate({...$e,_fromLocation:n}),cause:o?"preload":Z,route:w}},L=Date.now()-this.getMatch(d).updatedAt,M=o?w.options.preloadStaleTime??this.options.defaultPreloadStaleTime??3e4:w.options.staleTime??this.options.defaultStaleTime??0,K=w.options.shouldReload,$=typeof K=="function"?K(N()):K;l(d,Y=>({...Y,loaderPromise:mn(),preload:!!o&&!this.state.matches.find(fe=>fe.id===d)}));const ee=async()=>{var Y,fe,Ee,je,Z,$e,Ur,wt;try{const Et=async()=>{const De=this.getMatch(d);De.minPendingPromise&&await De.minPendingPromise};try{w._lazyPromise=w._lazyPromise||(w.lazyFn?w.lazyFn().then(B=>{Object.assign(w.options,B.options)}):Promise.resolve());const De=this.getMatch(d).componentsPromise||w._lazyPromise.then(()=>Promise.all(zp.map(async B=>{const Qt=w.options[B];Qt!=null&&Qt.preload&&await Qt.preload()})));l(d,B=>({...B,isFetching:"loader",componentsPromise:De})),await w._lazyPromise;let Ae=await((fe=(Y=w.options).loader)==null?void 0:fe.call(Y,N()));this.serializeLoaderData&&(Ae=this.serializeLoaderData(Ae,{router:this,match:this.getMatch(d)})),f(this.getMatch(d),Ae),await Et();const at=(je=(Ee=w.options).meta)==null?void 0:je.call(Ee,{matches:r,match:this.getMatch(d),params:this.getMatch(d).params,loaderData:Ae}),q=($e=(Z=w.options).headers)==null?void 0:$e.call(Z,{loaderData:Ae});l(d,B=>({...B,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:Ae,meta:at,headers:q}))}catch(De){let Ae=De;await Et(),f(this.getMatch(d),De);try{(wt=(Ur=w.options).onError)==null||wt.call(Ur,De)}catch(at){Ae=at,f(this.getMatch(d),at)}l(d,at=>({...at,error:Ae,status:"error",isFetching:!1}))}await this.getMatch(d).componentsPromise}catch(Et){f(this.getMatch(d),Et)}},{status:le,invalid:ce}=this.getMatch(d);le==="success"&&(ce||($??L>M))?(async()=>{try{await ee()}catch{}})():le!=="success"&&await ee();const{loaderPromise:et,loadPromise:X}=this.getMatch(d);et==null||et.resolve(),X==null||X.resolve()}l(d,k=>({...k,isFetching:!1,loaderPromise:void 0}))})())}),await Promise.all(c),h()}catch(R){m(R)}})()}),await a()}catch(h){if(Kt(h)||ot(h))throw ot(h)&&!o&&await a(),h}return r},this.invalidate=()=>{const n=r=>({...r,invalid:!0,...r.status==="error"?{status:"pending",error:void 0}:{}});return this.__store.setState(r=>{var o;return{...r,matches:r.matches.map(n),cachedMatches:r.cachedMatches.map(n),pendingMatches:(o=r.pendingMatches)==null?void 0:o.map(n)}}),this.load()},this.resolveRedirect=n=>{const r=n;return r.href||(r.href=this.buildLocation(r).href),r},this.cleanCache=()=>{this.__store.setState(n=>({...n,cachedMatches:n.cachedMatches.filter(r=>{const o=this.looseRoutesById[r.routeId];if(!o.options.loader)return!1;const i=(r.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??5*60*1e3;return r.status!=="error"&&Date.now()-r.updatedAt{const r=this.buildLocation(n);let o=this.matchRoutes(r.pathname,r.search,{throwOnError:!0,preload:!0});const i=Object.fromEntries([...this.state.matches,...this.state.pendingMatches??[],...this.state.cachedMatches].map(s=>[s.id,!0]));this.__store.batch(()=>{o.forEach(s=>{i[s.id]||this.__store.setState(u=>({...u,cachedMatches:[...u.cachedMatches,s]}))})});const l=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(s=>s.id));try{return o=await this.loadMatches({matches:o,location:r,preload:!0,updateMatch:(s,u)=>{l.has(s)?o=o.map(a=>a.id===s?u(a):a):this.updateMatch(s,u)}}),o}catch(s){if(Kt(s))return await this.preloadRoute({...s,_fromLocation:r});console.error(s);return}},this.matchRoute=(n,r)=>{const o={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},i=this.buildLocation(o);if(r!=null&&r.pending&&this.state.status!=="pending")return!1;const s=((r==null?void 0:r.pending)===void 0?!this.state.isLoading:r.pending)?this.latestLocation:this.state.resolvedLocation,u=Vr(this.basepath,s.pathname,{...r,to:i.pathname});return!u||n.params&&!Nn(u,n.params,!0)?!1:u&&((r==null?void 0:r.includeSearch)??!0)?Nn(s.search,i.search,!0)?u:!1:u},this.dehydrate=()=>{var n;const r=((n=this.options.errorSerializer)==null?void 0:n.serialize)??$p;return{state:{dehydratedMatches:this.state.matches.map(o=>({...ur(o,["id","status","updatedAt"]),error:o.error?{data:r(o.error),__isServerError:!0}:void 0}))},manifest:this.manifest}},this.hydrate=()=>{var n,r,o;let i;typeof document<"u"&&(i=this.options.transformer.parse((n=window.__TSR__)==null?void 0:n.dehydrated)),xe(i),this.dehydratedData=i.payload,(o=(r=this.options).hydrate)==null||o.call(r,i.payload);const l=i.router.state,s=this.matchRoutes(this.state.location.pathname,this.state.location.search).map(u=>{const a=l.dehydratedMatches.find(f=>f.id===u.id);return xe(a,`Could not find a client-side match for dehydrated match with id: ${u.id}!`),{...u,...a}});this.__store.setState(u=>({...u,matches:s})),this.manifest=i.router.manifest},this.injectedHtml=[],this.injectHtml=n=>{const r=()=>(this.injectedHtml=this.injectedHtml.filter(o=>o!==r),n);this.injectedHtml.push(r)},this.streamedKeys=new Set,this.getStreamedValue=n=>{var r;if(this.isServer)return;const o=(r=window.__TSR__)==null?void 0:r.streamedValues[n];if(o)return o.parsed||(o.parsed=this.options.transformer.parse(o.value)),o.parsed},this.streamValue=(n,r)=>{var o;Zo(!this.streamedKeys.has(n)),this.streamedKeys.add(n);const i=`__TSR__.streamedValues['${n}'] = { value: ${(o=this.serializer)==null?void 0:o.call(this,this.options.transformer.stringify(r))}}`;this.injectHtml(`