@tanstack/react-router 1.6.1 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/Matches.js +22 -1
- package/build/cjs/Matches.js.map +1 -1
- package/build/cjs/awaited.js +21 -4
- package/build/cjs/awaited.js.map +1 -1
- package/build/cjs/defer.js +7 -2
- package/build/cjs/defer.js.map +1 -1
- package/build/cjs/index.js +3 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/link.js.map +1 -1
- package/build/cjs/router.js +20 -1
- package/build/cjs/router.js.map +1 -1
- package/build/esm/index.js +1900 -1846
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +585 -560
- package/build/types/Matches.d.ts +5 -0
- package/build/types/defer.d.ts +4 -1
- package/build/types/link.d.ts +3 -1
- package/build/types/router.d.ts +20 -6
- package/build/types/routerContext.d.ts +1 -1
- package/build/umd/index.development.js +1902 -1845
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/Matches.tsx +28 -1
- package/src/awaited.tsx +25 -1
- package/src/defer.ts +12 -2
- package/src/link.tsx +24 -16
- package/src/router.ts +50 -7
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("use-sync-external-store/shim")):"function"==typeof define&&define.amd?define(["exports","react","use-sync-external-store/shim"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ReactRouter={},t.React,t.require$$1)}(this,(function(t,e,o){"use strict";function
|
|
11
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("use-sync-external-store/shim")):"function"==typeof define&&define.amd?define(["exports","react","use-sync-external-store/shim"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ReactRouter={},t.React,t.require$$1)}(this,(function(t,e,o){"use strict";function r(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(o){if("default"!==o){var r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,r.get?r:{enumerable:!0,get:function(){return t[o]}})}})),e.default=t,Object.freeze(e)}var n=r(e);
|
|
12
12
|
/**
|
|
13
13
|
* @tanstack/history/src/index.ts
|
|
14
14
|
*
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
* LICENSE.md file in the root directory of this source tree.
|
|
19
19
|
*
|
|
20
20
|
* @license MIT
|
|
21
|
-
*/const s="pushstate",a="popstate",i="beforeunload",c=t=>(t.preventDefault(),t.returnValue=""),l=()=>{removeEventListener(i,c,{capture:!0})};function u(t){let e=t.getLocation(),o=new Set,n=[];const r=()=>{e=t.getLocation(),o.forEach((t=>t()))},s=async e=>{if("undefined"!=typeof document&&n.length)for(let e of n){if(!await e())return void t.onBlocked?.(r)}e()};return{get location(){return e},subscribe:t=>(o.add(t),()=>{o.delete(t)}),push:(e,o)=>{o=h(o),s((()=>{t.pushState(e,o),r()}))},replace:(e,o)=>{o=h(o),s((()=>{t.replaceState(e,o),r()}))},go:e=>{s((()=>{t.go(e)}))},back:()=>{s((()=>{t.back()}))},forward:()=>{s((()=>{t.forward()}))},createHref:e=>t.createHref(e),block:t=>(n.push(t),1===n.length&&addEventListener(i,c,{capture:!0}),()=>{n=n.filter((e=>e!==t)),n.length||l()}),flush:()=>t.flush?.(),destroy:()=>t.destroy?.(),notify:r}}function h(t){return t||(t={}),{...t,key:m()}}function d(t){const e=t?.window??("undefined"!=typeof document?window:void 0),o=t?.createHref??(t=>t),n=t?.parseLocation??(()=>p(`${e.location.pathname}${e.location.search}${e.location.hash}`,e.history.state));let r,i=n();let c,l,h=!0;const d=()=>{h=!1,(()=>{c&&(e.history[c.isPush?"pushState":"replaceState"](c.state,"",c.href),c=void 0,l=void 0,r=void 0)})(),h=!0},f=(t,e,n)=>{const s=o(e);l||(r=i),i=p(e,n),c={href:s,state:n,isPush:c?.isPush||"push"===t},l||(l=Promise.resolve().then((()=>d())))},m=()=>{i=n(),v.notify()};var y=e.history.pushState,g=e.history.replaceState;const v=u({getLocation:()=>i,pushState:(t,e)=>f("push",t,e),replaceState:(t,e)=>f("replace",t,e),back:()=>e.history.back(),forward:()=>e.history.forward(),go:t=>e.history.go(t),createHref:t=>o(t),flush:d,destroy:()=>{e.history.pushState=y,e.history.replaceState=g,e.removeEventListener(s,m),e.removeEventListener(a,m)},onBlocked:t=>{r&&i!==r&&(i=r,t())}});return e.addEventListener(s,m),e.addEventListener(a,m),e.history.pushState=function(){let t=y.apply(e.history,arguments);return h&&v.notify(),t},e.history.replaceState=function(){let t=g.apply(e.history,arguments);return h&&v.notify(),t},v}function f(t={initialEntries:["/"]}){const e=t.initialEntries;let o=t.initialIndex??e.length-1,n={key:m()};return u({getLocation:()=>p(e[o],n),pushState:(t,r)=>{n=r,e.push(t),o++},replaceState:(t,r)=>{n=r,e[o]=t},back:()=>{o--},forward:()=>{o=Math.min(o+1,e.length-1)},go:t=>{o=Math.min(Math.max(o+t,0),e.length-1)},createHref:t=>t})}function p(t,e){let o=t.indexOf("#"),n=t.indexOf("?");return{href:t,pathname:t.substring(0,o>0?n>0?Math.min(o,n):o:n>0?n:t.length),hash:o>-1?t.substring(o):"",search:n>-1?t.slice(n,-1===o?void 0:o):"",state:e||{}}}function m(){return(Math.random()+1).toString(36).substring(7)}var y="Invariant failed";function g(t,e){if(!t)throw new Error(y)}function v(t,e){}function b(e){const o="undefined"!=typeof document&&window.__TSR_ROUTER_CONTEXT__||t.routerContext,n=r.useContext(o);return n}function w(t){return"object"==typeof t&&null!==t&&!(t instanceof Promise)&&!t.then&&"__deferredState"in t}function _({promise:t}){const e=b();let o=t.__deferredState;const n=`__TSR__DEFERRED__${o.uid}`;if(w(t)&&(o=e.hydrateData(n),(t=Promise.resolve(o.data)).__deferredState=o),"pending"===o.status)throw t;if("error"===o.status)throw o.error;return e.dehydrateData(n,o),[o.data]}function S(t){const e=t.errorComponent??E;return r.createElement(R,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:o})=>o?r.createElement(e,{error:o}):t.children})}t.routerContext=r.createContext(null),"undefined"!=typeof document&&(window.__TSR_ROUTER_CONTEXT__?t.routerContext=window.__TSR_ROUTER_CONTEXT__:window.__TSR_ROUTER_CONTEXT__=t.routerContext);class R extends r.Component{state={error:null};static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}componentDidUpdate(t,e){e.error&&e.resetKey!==this.state.resetKey&&this.setState({error:null})}componentDidCatch(t){console.error(t),this.props.onCatch?.(t)}render(){return this.props.children(this.state)}}function E({error:t}){const[e,o]=r.useState(!1);return r.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},r.createElement("div",{style:{display:"flex",alignItems:"center",gap:".5rem"}},r.createElement("strong",{style:{fontSize:"1rem"}},"Something went wrong!"),r.createElement("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>o((t=>!t))},e?"Hide Error":"Show Error")),r.createElement("div",{style:{height:".25rem"}}),e?r.createElement("div",null,r.createElement("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"}},t.message?r.createElement("code",null,t.message):null)):null)}var L,P={exports:{}},x={};P.exports=function(){if(L)return x;L=1;var t=e,n=o,r="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},s=n.useSyncExternalStore,a=t.useRef,i=t.useEffect,c=t.useMemo,l=t.useDebugValue;return x.useSyncExternalStoreWithSelector=function(t,e,o,n,u){var h=a(null);if(null===h.current){var d={hasValue:!1,value:null};h.current=d}else d=h.current;h=c((function(){function t(t){if(!i){if(i=!0,s=t,t=n(t),void 0!==u&&d.hasValue){var e=d.value;if(u(e,t))return a=e}return a=t}if(e=a,r(s,t))return e;var o=n(t);return void 0!==u&&u(e,o)?e:(s=t,a=o)}var s,a,i=!1,c=void 0===o?null:o;return[function(){return t(e())},null===c?void 0:function(){return t(c())}]}),[e,o,n,u]);var f=s(t,h[0],h[1]);return i((function(){d.hasValue=!0,d.value=f}),[f]),l(f),f},x}();var C=P.exports,T=class{constructor(t,e){this.listeners=new Set,this._batching=!1,this._flushing=0,this._nextPriority=null,this.subscribe=t=>{this.listeners.add(t);const e=this.options?.onSubscribe?.(t,this);return()=>{this.listeners.delete(t),e?.()}},this.setState=(t,e)=>{const o=this.state;this.state=this.options?.updateFn?this.options.updateFn(o)(t):t(o);const n=e?.priority??this.options?.defaultPriority??"high";null===this._nextPriority||"high"===this._nextPriority?this._nextPriority=n:this._nextPriority=this.options?.defaultPriority??"high",this.options?.onUpdate?.({priority:this._nextPriority}),this._flush()},this._flush=()=>{if(this._batching)return;const t=++this._flushing;this.listeners.forEach((e=>{this._flushing===t&&e({priority:this._nextPriority??"high"})}))},this.batch=t=>{if(this._batching)return t();this._batching=!0,t(),this._batching=!1,this._flush()},this.state=t,this.options=e}};function M(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const o=Object.keys(t);if(o.length!==Object.keys(e).length)return!1;for(let n=0;n<o.length;n++)if(!Object.prototype.hasOwnProperty.call(e,o[n])||!Object.is(t[o[n]],e[o[n]]))return!1;return!0}function O(t){const e=b();return function(t,e=(t=>t)){return C.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,M)}((t?.router||e).__store,t?.select)}const k="undefined"==typeof document;function I(t){return t[t.length-1]}function D(t,e){return"function"==typeof t?t(e):t}function j(t,e){return e.reduce(((e,o)=>(e[o]=t[o],e)),{})}function $(t,e){if(t===e)return t;const o=e,n=N(t)&&N(o);if(n||B(t)&&B(o)){const e=n?t:Object.keys(t),r=e.length,s=n?o:Object.keys(o),a=s.length,i=n?[]:{};let c=0;for(let r=0;r<a;r++){const a=n?r:s[r];!n&&void 0===t[a]&&void 0===o[a]&&e.includes(a)?(i[a]=void 0,c++):(i[a]=$(t[a],o[a]),i[a]===t[a]&&void 0!==t[a]&&c++)}return r===a&&c===r?t:i}return o}function B(t){if(!A(t))return!1;const e=t.constructor;if(void 0===e)return!0;const o=e.prototype;return!!A(o)&&!!o.hasOwnProperty("isPrototypeOf")}function A(t){return"[object Object]"===Object.prototype.toString.call(t)}function N(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function H(t,e,o=!1){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(B(t)&&B(e)){const n=Object.keys(t),r=Object.keys(e);return!(!o&&n.length!==r.length)&&!r.some((n=>!(n in t)||!H(t[n],e[n],o)))}return!(!Array.isArray(t)||!Array.isArray(e))&&!t.some(((t,n)=>!H(t,e[n],o)))}const F="undefined"!=typeof window?r.useLayoutEffect:r.useEffect;function K(t){return t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}const W=r.createContext(void 0);function z(){const t=b(),e=O({select:t=>V(t)[0]?.id});return r.createElement(W.Provider,{value:e},r.createElement(S,{getResetKey:()=>t.state.resolvedLocation.state?.key,errorComponent:E,onCatch:()=>{}},e?r.createElement(Y,{matchId:e}):null))}function U(t){return r.createElement(r.Fragment,null,t.children)}function Y({matchId:t}){const e=b(),o=O({select:e=>V(e).find((e=>e.id===t))?.routeId});g(o);const n=e.routesById[o],s=n.options.pendingComponent??e.options.defaultPendingComponent,a=s?r.createElement(s,null):null,i=n.options.errorComponent??e.options.defaultErrorComponent??E,c=n.options.wrapInSuspense??s??n.options.component?.preload??n.options.pendingComponent?.preload??n.options.errorComponent?.preload?r.Suspense:U,l=i?S:U;return r.createElement(W.Provider,{value:t},r.createElement(c,{fallback:a},r.createElement(l,{getResetKey:()=>e.state.resolvedLocation.state?.key,errorComponent:i,onCatch:()=>{}},r.createElement(J,{matchId:t,pendingElement:a}))))}function J({matchId:t,pendingElement:e}){const o=b(),n=O({select:e=>V(e).find((e=>e.id===t))?.routeId}),s=o.routesById[n],a=O({select:e=>j(V(e).find((e=>e.id===t)),["status","error","showPending","loadPromise"])});if("error"===a.status)throw a.error;if("pending"===a.status){if(a.showPending)return e;throw a.loadPromise}if("success"===a.status){let t=s.options.component??o.options.defaultComponent;return t?r.createElement(t,null):r.createElement(X,null)}g(!1)}const X=r.memo((function(){const t=r.useContext(W),e=O({select:e=>{const o=V(e),n=o.findIndex((e=>e.id===t));return o[n+1]?.id}});return e?r.createElement(Y,{matchId:e}):null}));function q(){O({select:t=>[t.location,t.resolvedLocation]});const{matchRoute:t}=b();return r.useCallback((e=>{const{pending:o,caseSensitive:n,fuzzy:r,includeSearch:s,...a}=e;return t(a,{pending:o,caseSensitive:n,fuzzy:r,includeSearch:s})}),[])}function V(t){return t.pendingMatches?.some((t=>t.showPending))?t.pendingMatches:t.matches}function G(t){const e=b(),o=r.useContext(W),n=V(e.state).find((t=>t.id===o))?.routeId,s=(()=>{const n=V(e.state);return(t?.from?n.find((e=>e.routeId===t?.from)):n.find((t=>t.id===o))).routeId})();(t?.strict??1)&&g(n==s);return O({select:e=>{const n=V(e).find((t=>t.id===o));return g(n,t?.from&&t.from),t?.select?t.select(n):n}})}function Q(t){return O({select:e=>{let o=V(e);return t?.select?t.select(o):o}})}function Z(t){return G({...t,select:e=>"function"==typeof t.select?t.select(e?.loaderDeps):e?.loaderDeps})}function tt(t){return G({...t,select:e=>"function"==typeof t.select?t.select(e?.loaderData):e?.loaderData})}function et(t){return ot(t.filter(Boolean).join("/"))}function ot(t){return t.replace(/\/{2,}/g,"/")}function nt(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function rt(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function st(t){return rt(nt(t))}function at(t,e,o){e=e.replace(new RegExp(`^${t}`),"/"),o=o.replace(new RegExp(`^${t}`),"/");let n=it(e);const r=it(o);r.forEach(((t,e)=>{if("/"===t.value)e?e===r.length-1&&n.push(t):n=[t];else if(".."===t.value)n.length>1&&"/"===I(n)?.value&&n.pop(),n.pop();else{if("."===t.value)return;n.push(t)}}));return ot(et([t,...n.map((t=>t.value))]))}function it(t){if(!t)return[];const e=[];if("/"===(t=ot(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const o=t.split("/").filter(Boolean);return e.push(...o.map((t=>"$"===t||"*"===t?{type:"wildcard",value:t}:"$"===t.charAt(0)?{type:"param",value:t}:{type:"pathname",value:t}))),"/"===t.slice(-1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),e}function ct(t,e,o=!1){return et(it(t).map((t=>{if("wildcard"===t.type){const n=e[t.value];return o?`${t.value}${n??""}`:n}return"param"===t.type?e[t.value.substring(1)]??"undefined":t.value})))}function lt(t,e,o){const n=ht(t,e,o);if(!o.to||n)return n??{}}function ut(t,e){return"/"!=t?e.substring(t.length):e}function ht(t,e,o){e=ut(t,e);const n=`${o.to??"$"}`,r=it(e),s=it(n);e.startsWith("/")||r.unshift({type:"pathname",value:"/"}),n.startsWith("/")||s.unshift({type:"pathname",value:"/"});const a={};return(()=>{for(let t=0;t<Math.max(r.length,s.length);t++){const e=r[t],n=s[t],i=t>=r.length-1,c=t>=s.length-1;if(n){if("wildcard"===n.type){if(e?.value){const e=et(r.slice(t).map((t=>t.value)));return a["*"]=e,a._splat=e,!0}return!1}if("pathname"===n.type){if("/"===n.value&&!e?.value)return!0;if(e)if(o.caseSensitive){if(n.value!==e.value)return!1}else if(n.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===n.type){if("/"===e?.value)return!1;"$"!==e.value.charAt(0)&&(a[n.value.substring(1)]=e.value)}}if(!i&&c)return a["**"]=et(r.slice(t+1).map((t=>t.value))),!!o.fuzzy&&"/"!==n?.value}return!0})()?a:void 0}function dt(t){return O({select:e=>{const o=I(V(e))?.params;return t?.select?t.select(o):o}})}function ft(t){return G({...t,select:e=>t?.select?t.select(e.search):e.search})}const pt="__root__";class mt{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute,g(!(t?.id&&t?.path)),this.$$typeof=Symbol.for("react.memo")}init=t=>{this.originalIndex=t.originalIndex;const e=this.options,o=!e?.path&&!e?.id;this.parentRoute=this.options?.getParentRoute?.(),o?this.path=pt:g(this.parentRoute);let n=o?pt:e.path;n&&"/"!==n&&(n=st(n));const r=e?.id||n;let s=o?pt:et([this.parentRoute.id===pt?"":this.parentRoute.id,r]);n===pt&&(n="/"),s!==pt&&(s=et(["/",s]));const a=s===pt?"/":et([this.parentRoute.fullPath,n]);this.path=n,this.id=s,this.fullPath=a,this.to=a};addChildren=t=>(this.children=t,this);updateLoader=t=>(Object.assign(this.options,t),this);update=t=>(Object.assign(this.options,t),this);useMatch=t=>G({...t,from:this.id});useRouteContext=t=>G({...t,from:this.id,select:e=>t?.select?t.select(e.context):e.context});useSearch=t=>ft({...t,from:this.id});useParams=t=>dt({...t,from:this.id});useLoaderDeps=t=>Z({...t,from:this.id});useLoaderData=t=>tt({...t,from:this.id})}class yt extends mt{constructor(t){super(t)}}function gt(){return gt=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])}return t},gt.apply(this,arguments)}const vt="Error preloading route! ☝️";function bt(t){const e=b(),o=G({strict:!1,select:t=>t.pathname}),{children:n,target:r,activeProps:s=(()=>({className:"active"})),inactiveProps:a=(()=>({})),activeOptions:i,disabled:c,hash:l,search:u,params:h,to:d,state:f,mask:p,preload:m,preloadDelay:y,replace:g,startTransition:v,resetScroll:w,style:_,className:S,onClick:R,onFocus:E,onMouseEnter:L,onMouseLeave:P,onTouchStart:x,...C}=t,T={from:t.to?o:void 0,...t};let M="internal";try{new URL(`${d}`),M="external"}catch{}if("external"===M)return{href:d};const k=e.buildLocation(T),I=m??e.options.defaultPreload,j=y??e.options.defaultPreloadDelay??0,$=O({select:t=>{const e=t.location.pathname.split("/"),o=k.pathname.split("/").every(((t,o)=>t===e[o])),n=i?.exact?t.location.pathname===k.pathname:o,r=!i?.includeHash||t.location.hash===k.hash,s=!(i?.includeSearch??1)||H(t.location.search,k.search,!i?.exact);return n&&r&&s}}),B=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},A=$?D(s,{})??{}:{},N=$?{}:D(a,{})??{};return{...A,...N,...C,href:c?void 0:k.maskedLocation?k.maskedLocation.href:k.href,onClick:B([R,t=>{c||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||r&&"_self"!==r||0!==t.button||(t.preventDefault(),e.commitLocation({...k,replace:g,resetScroll:w,startTransition:v}))}]),onFocus:B([E,t=>{I&&e.preloadRoute(T).catch((t=>{console.warn(t),console.warn(vt)}))}]),onMouseEnter:B([L,t=>{const o=t.target||{};if(I){if(o.preloadTimeout)return;o.preloadTimeout=setTimeout((()=>{o.preloadTimeout=null,e.preloadRoute(T).catch((t=>{console.warn(t),console.warn(vt)}))}),j)}}]),onMouseLeave:B([P,t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)}]),onTouchStart:B([x,t=>{I&&e.preloadRoute(T).catch((t=>{console.warn(t),console.warn(vt)}))}]),target:r,style:{..._,...A.style,...N.style},className:[S,A.className,N.className].filter(Boolean).join(" ")||void 0,...c?{role:"link","aria-disabled":!0}:void 0,"data-status":$?"active":void 0}}const wt=r.forwardRef(((t,e)=>{const o=bt(t);return r.createElement("a",gt({ref:e},o,{children:"function"==typeof t.children?t.children({isActive:"active"===o["data-status"]}):t.children}))}));function _t(t,e){var o,n,r,s="";for(o in t)if(void 0!==(r=t[o]))if(Array.isArray(r))for(n=0;n<r.length;n++)s&&(s+="&"),s+=encodeURIComponent(o)+"="+encodeURIComponent(r[n]);else s&&(s+="&"),s+=encodeURIComponent(o)+"="+encodeURIComponent(r);return(e||"")+s}function St(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||(0*+e==0&&+e+""===e?+e:e))}function Rt(t){for(var e,o,n={},r=t.split("&");e=r.shift();)void 0!==n[o=(e=e.split("=")).shift()]?n[o]=[].concat(n[o],St(e.shift())):n[o]=St(e.shift());return n}function Et(t){return!!t?.isRedirect}const Lt=xt(JSON.parse),Pt=Ct(JSON.stringify,JSON.parse);function xt(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let o=Rt(e);for(let e in o){const n=o[e];if("string"==typeof n)try{o[e]=t(n)}catch(t){}}return o}}function Ct(t,e){return o=>{(o={...o})&&Object.keys(o).forEach((n=>{const r=o[n];void 0===r||void 0===r?delete o[n]:o[n]=function(o){if("object"==typeof o&&null!==o)try{return t(o)}catch(t){}else if("string"==typeof o&&"function"==typeof e)try{return e(o),t(o)}catch(t){}return o}(r)}));const n=_t(o).toString();return n?`?${n}`:""}}const Tt=r.useTransition||(()=>[!1,t=>{t()}]);function Mt(){const t=r.useRef(0),e=b(),o=O({select:t=>j(t,["isLoading","location","resolvedLocation","isTransitioning"])}),[n,s]=Tt();e.startReactTransition=s,r.useEffect((()=>{n&&e.__store.setState((t=>({...t,isTransitioning:n})))}),[n]);const a=()=>{var t;t=()=>{try{e.load()}catch(t){console.error(t)}},o.isTransitioning?t():s((()=>t()))};return F((()=>{const t=e.history.subscribe((()=>{e.latestLocation=e.parseLocation(e.latestLocation),o.location!==e.latestLocation&&a()})),n=e.buildLocation({search:!0,params:!0,hash:!0,state:!0});return o.location.href!==n.href&&e.commitLocation({...n,replace:!0}),()=>{t()}}),[e.history]),F((()=>{if(r.useTransition?o.isTransitioning&&!n:!o.isLoading&&o.resolvedLocation!==o.location){if(e.emit({type:"onResolved",fromLocation:o.resolvedLocation,toLocation:o.location,pathChanged:o.location.href!==o.resolvedLocation?.href}),document.querySelector&&""!==o.location.hash){const t=document.getElementById(o.location.hash);t&&t.scrollIntoView()}e.__store.setState((t=>({...t,isTransitioning:!1,resolvedLocation:t.location})))}}),[o.isTransitioning,n,o.isLoading,o.resolvedLocation,o.location]),F((()=>{window.__TSR_DEHYDRATED__||t.current||(t.current++,a())}),[]),null}function Ot(t,e){return[...t.cachedMatches,...t.pendingMatches??[],...t.matches].find((t=>t.id===e))}const kt=["component","errorComponent","pendingComponent"];class It extends Error{}class Dt extends Error{}function jt(t){return{isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:{...t},location:t,matches:[],pendingMatches:[],cachedMatches:[],lastUpdated:Date.now()}}const $t="undefined"!=typeof window?r.useLayoutEffect:r.useEffect,Bt="window",At="___";let Nt=new WeakSet;let Ht="undefined"!=typeof window&&window.sessionStorage?(()=>{const t="tsr-scroll-restoration-v2";return{state:JSON.parse(window.sessionStorage.getItem(t)||"null")||{cached:{},next:{}},set:e=>{Ht.state=D(e,Ht.state),window.sessionStorage.setItem(t,JSON.stringify(Ht.state))}}})():void 0;const Ft=t=>t.state.key;function Kt(t){const e=b();$t((()=>{const o=t?.getKey||Ft,{history:n}=window;n.scrollRestoration&&(n.scrollRestoration="manual");const r=t=>{if(Nt.has(t.target))return;Nt.add(t.target);let e="";if(t.target===document||t.target===window)e=Bt;else{const o=t.target.getAttribute("data-scroll-restoration-id");e=o?`[data-scroll-restoration-id="${o}"]`:Wt(t.target)}Ht.state.next[e]||Ht.set((t=>({...t,next:{...t.next,[e]:{scrollX:NaN,scrollY:NaN}}})))};"undefined"!=typeof document&&document.addEventListener("scroll",r,!0);const s=e.subscribe("onBeforeLoad",(t=>{if(t.pathChanged){const e=o(t.fromLocation);for(const t in Ht.state.next){const o=Ht.state.next[t];if(t===Bt)o.scrollX=window.scrollX||0,o.scrollY=window.scrollY||0;else if(t){const e=document.querySelector(t);o.scrollX=e?.scrollLeft||0,o.scrollY=e?.scrollTop||0}Ht.set((n=>{const r={...n.next};return delete r[t],{...n,next:r,cached:{...n.cached,[[e,t].join(At)]:o}}}))}}})),a=e.subscribe("onResolved",(o=>{if(o.pathChanged){if(!e.resetNextScroll)return;e.resetNextScroll=!0;const n=(t?.getKey||Ft)(o.toLocation);let r=!1;for(const t in Ht.state.cached){const e=Ht.state.cached[t],[o,s]=t.split(At);if(o===n)if(s===Bt)r=!0,window.scrollTo(e.scrollX,e.scrollY);else if(s){const t=document.querySelector(s);t&&(t.scrollLeft=e.scrollX,t.scrollTop=e.scrollY)}}r||window.scrollTo(0,0),Ht.set((t=>({...t,next:{}}))),Nt=new WeakSet}}));return()=>{document.removeEventListener("scroll",r),s(),a()}}),[])}function Wt(t){let e,o=[];for(;e=t.parentNode;)o.unshift(`${t.tagName}:nth-child(${[].indexOf.call(e.children,t)+1})`),t=e;return`${o.join(" > ")}`.toLowerCase()}function zt(t,e=!0){const{history:o}=b();r.useEffect((()=>{if(e)return o.block(t)}))}t.Await=function(t){const e=_(t);return t.children(...e)},t.Block=function({blocker:t,condition:e,children:o}){return zt(t,e),o??null},t.CatchBoundary=S,t.CatchBoundaryImpl=R,t.ErrorComponent=E,t.FileRoute=class{constructor(t){this.path=t}createRoute=t=>{const e=new mt(t);return e.isRoot=!1,e}},t.FileRouteLoader=function(t){return t=>t},t.Link=wt,t.Match=Y,t.MatchRoute=function(t){const e=q()(t);return"function"==typeof t.children?t.children(e):e?t.children:null},t.Matches=z,t.Navigate=function(t){const{navigate:e}=b(),o=G({strict:!1});return r.useEffect((()=>{e({from:t.to?o.pathname:void 0,...t})}),[]),null},t.NotFoundRoute=class extends mt{constructor(t){super({...t,id:"404"})}},t.Outlet=X,t.PathParamError=Dt,t.RootRoute=yt,t.Route=mt,t.RouteApi=class{constructor({id:t}){this.id=t}useMatch=t=>G({select:t?.select,from:this.id});useRouteContext=t=>G({from:this.id,select:e=>t?.select?t.select(e.context):e.context});useSearch=t=>ft({...t,from:this.id});useParams=t=>dt({...t,from:this.id});useLoaderDeps=t=>Z({...t,from:this.id});useLoaderData=t=>tt({...t,from:this.id})},t.Router=class{tempLocationKey=`${Math.round(1e7*Math.random())}`;resetNextScroll=!0;navigateTimeout=null;latestLoadPromise=Promise.resolve();subscribers=new Set;injectedHtml=[];constructor(t){this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,stringifySearch:t?.stringifySearch??Pt,parseSearch:t?.parseSearch??Lt})}startReactTransition=t=>t();update=t=>{const e=this.options;this.options={...this.options,...t},(!this.basepath||t.basepath&&t.basepath!==e.basepath)&&(void 0===t.basepath||""===t.basepath||"/"===t.basepath?this.basepath="/":this.basepath=`/${st(t.basepath)}`),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history??("undefined"!=typeof document?d():f({initialEntries:[this.options.basepath||"/"]})),this.latestLocation=this.parseLocation()),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),this.__store||(this.__store=new T(jt(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,status:this.state.isTransitioning||this.state.isLoading?"pending":"idle"}}}))};get state(){return this.__store.state}buildRouteTree=()=>{this.routesById={},this.routesByPath={};const t=this.options.notFoundRoute;t&&(t.init({originalIndex:99999999999}),this.routesById[t.id]=t);const e=t=>{t.forEach(((t,o)=>{t.init({originalIndex:o});if(g(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t,!t.isRoot&&t.path){const e=rt(t.fullPath);this.routesByPath[e]&&!t.fullPath.endsWith("/")||(this.routesByPath[e]=t)}const n=t.children;n?.length&&e(n)}))};e([this.routeTree]);const o=[];Object.values(this.routesById).forEach(((t,e)=>{if(t.isRoot||!t.path)return;const n=nt(t.fullPath),r=it(n);for(;r.length>1&&"/"===r[0]?.value;)r.shift();const s=r.map((t=>"/"===t.value?.75:"param"===t.type?.5:"wildcard"===t.type?.25:1));o.push({child:t,trimmed:n,parsed:r,index:e,scores:s})})),this.flatRoutes=o.sort(((t,e)=>{const o=Math.min(t.scores.length,e.scores.length);for(let n=0;n<o;n++)if(t.scores[n]!==e.scores[n])return e.scores[n]-t.scores[n];if(t.scores.length!==e.scores.length)return e.scores.length-t.scores.length;for(let n=0;n<o;n++)if(t.parsed[n].value!==e.parsed[n].value)return t.parsed[n].value>e.parsed[n].value?1:-1;return t.index-e.index})).map(((t,e)=>(t.child.rank=e,t.child)))};subscribe=(t,e)=>{const o={eventType:t,fn:e};return this.subscribers.add(o),()=>{this.subscribers.delete(o)}};emit=t=>{this.subscribers.forEach((e=>{e.eventType===t.type&&e.fn(t)}))};checkLatest=t=>this.latestLoadPromise!==t?this.latestLoadPromise:void 0;parseLocation=t=>{const e=({pathname:e,search:o,hash:n,state:r})=>{const s=this.options.parseSearch(o);return{pathname:e,searchStr:o,search:$(t?.search,s),hash:n.split("#").reverse()[0]??"",href:`${e}${o}${n}`,state:$(t?.state,r)}},o=e(this.history.location);let{__tempLocation:n,__tempKey:r}=o.state;if(n&&(!r||r===this.tempLocationKey)){const t=e(n);return t.state.key=o.state.key,delete t.state.__tempLocation,{...t,maskedLocation:o}}return o};resolvePathWithBase=(t,e)=>at(this.basepath,t,ot(e));get looseRoutesById(){return this.routesById}matchRoutes=(t,e,o)=>{let n={},r=this.flatRoutes.find((e=>{const o=lt(this.basepath,rt(t),{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive,fuzzy:!0});return!!o&&(n=o,!0)})),s=r||this.routesById.__root__,a=[s];for((r?"/"!==r.path&&n["**"]:rt(t))&&this.options.notFoundRoute&&a.push(this.options.notFoundRoute);s?.parentRoute;)s=s.parentRoute,s&&a.unshift(s);const i=a.map((t=>{let e;if(t.options.parseParams)try{const e=t.options.parseParams(n);Object.assign(n,e)}catch(t){if(e=new Dt(t.message,{cause:t}),o?.throwOnError)throw e;return e}})),c=[];return a.forEach(((t,r)=>{const s=c[r-1],[a,l]=(()=>{const n=s?.search??e;try{const e="object"==typeof t.options.validateSearch?t.options.validateSearch.parse:t.options.validateSearch;let o=e?.(n)??{};return[{...n,...o},void 0]}catch(t){const e=new It(t.message,{cause:t});if(o?.throwOnError)throw e;return[n,e]}})(),u=t.options.loaderDeps?.({search:a})??"",h=u?JSON.stringify(u):"",d=ct(t.fullPath,n),f=ct(t.id,n,!0)+h,p=Ot(this.state,f),m=this.state.matches.find((t=>t.id===f))?"stay":"enter",y=!(!t.options.loader&&!kt.some((e=>t.options[e]?.preload))),g=p?{...p,cause:m}:{id:f,routeId:t.id,params:n,pathname:et([this.basepath,d]),updatedAt:Date.now(),search:{},searchError:void 0,status:y?"pending":"success",showPending:!1,isFetching:!1,error:void 0,paramsError:i[r],loadPromise:Promise.resolve(),routeContext:void 0,context:void 0,abortController:new AbortController,fetchCount:0,cause:m,loaderDeps:u,invalid:!1,preload:!1};g.search=$(g.search,a),g.searchError=l,c.push(g)})),c};cancelMatch=t=>{Ot(this.state,t)?.abortController?.abort()};cancelMatches=()=>{this.state.pendingMatches?.forEach((t=>{this.cancelMatch(t.id)}))};buildLocation=t=>{const e=(t={},e)=>{const o=this.state.pendingMatches||this.state.matches,n=o[o.length-1]?.search||this.latestLocation.search;let r=this.resolvePathWithBase(t.from??this.latestLocation.pathname,`${t.to??""}`);const s=this.matchRoutes(this.latestLocation.pathname,n),a=e?.filter((t=>s?.find((e=>e.routeId===t.routeId)))),i={...I(s)?.params};let c=!0===(t.params??!0)?i:D(t.params,i);c&&e?.map((t=>this.looseRoutesById[t.routeId].options.stringifyParams)).filter(Boolean).forEach((t=>{c={...c,...t(c)}})),r=ct(r,c??{});const l=a?.map((t=>this.looseRoutesById[t.routeId].options.preSearchFilters??[])).flat().filter(Boolean)??[],u=a?.map((t=>this.looseRoutesById[t.routeId].options.postSearchFilters??[])).flat().filter(Boolean)??[],h=l?.length?l?.reduce(((t,e)=>e(t)),n):n,d=!0===t.search?h:t.search?D(t.search,h)??{}:l?.length?h:{},f=$(n,u?.length?u.reduce(((t,e)=>e(t)),d):d),p=this.options.stringifySearch(f),m=!0===t.hash?this.latestLocation.hash:t.hash?D(t.hash,this.latestLocation.hash):void 0,y=m?`#${m}`:"";let g=!0===t.state?this.latestLocation.state:t.state?D(t.state,this.latestLocation.state):this.latestLocation.state;return g=$(this.latestLocation.state,g),{pathname:r,search:f,searchStr:p,state:g,hash:m??"",href:`${r}${p}${y}`,unmaskOnReload:t.unmaskOnReload}},o=(o={},n)=>{let r=e(o),s=n?e(n):void 0;if(!s){let o={},a=this.options.routeMasks?.find((t=>{const e=lt(this.basepath,r.pathname,{to:t.from,caseSensitive:!1,fuzzy:!1});return!!e&&(o=e,!0)}));a&&(n={...j(t,["from"]),...a,params:o},s=e(n))}const a=this.matchRoutes(r.pathname,r.search),i=s?this.matchRoutes(s.pathname,s.search):void 0,c=s?e(n,i):void 0,l=e(o,a);return c&&(l.maskedLocation=c),l};return t.mask?o(t,{...j(t,["from"]),...t.mask}):o(t)};commitLocation=async({startTransition:t,...e})=>{this.navigateTimeout&&clearTimeout(this.navigateTimeout);if(!(this.latestLocation.href===e.href)||!e.replace){let{maskedLocation:o,...n}=e;o&&(n={...o,state:{...o.state,__tempKey:void 0,__tempLocation:{...n,search:n.searchStr,state:{...n.state,__tempKey:void 0,__tempLocation:void 0,key:void 0}}}},(n.unmaskOnReload??this.options.unmaskOnReload)&&(n.state.__tempKey=this.tempLocationKey));const r=()=>{this.history[e.replace?"replace":"push"](n.href,n.state)};t??1?this.startReactTransition(r):r()}return this.resetNextScroll=e.resetScroll??!0,this.latestLoadPromise};buildAndCommitLocation=({replace:t,resetScroll:e,startTransition:o,...n}={})=>{const r=this.buildLocation(n);return this.commitLocation({...r,startTransition:o,replace:t,resetScroll:e})};navigate=({from:t,to:e,...o})=>{const n=String(e);let r;try{new URL(`${n}`),r=!0}catch(t){}return g(!r),this.buildAndCommitLocation({...o,from:t,to:e})};loadMatches=async({checkLatest:t,matches:e,preload:o})=>{let n,r;const s=t=>{const e=this.state.pendingMatches?.find((e=>e.id===t.id)),o=this.state.matches.find((e=>e.id===t.id)),n=e?"pendingMatches":o?"matches":"cachedMatches";this.__store.setState((e=>({...e,[n]:e[n]?.map((e=>e.id===t.id?t:e))})))};try{for(let[t,n]of e.entries()){const s=e[t-1],a=this.looseRoutesById[n.routeId],i=new AbortController,c=(o,s)=>{if(o.routerCode=s,r=r??t,Et(o))throw o;try{a.options.onError?.(o)}catch(t){if(o=t,Et(t))throw t}e[t]=n={...n,error:o,status:"error",updatedAt:Date.now(),abortController:new AbortController}};try{n.paramsError&&c(n.paramsError,"PARSE_PARAMS"),n.searchError&&c(n.searchError,"VALIDATE_SEARCH");const r=s?.context??this.options.context??{},l=a.options.pendingMs??this.options.defaultPendingMs,u="number"==typeof l&&l<=0?Promise.resolve():new Promise((t=>setTimeout(t,l))),h=await(a.options.beforeLoad?.({search:n.search,abortController:i,params:n.params,preload:!!o,context:r,location:this.state.location,navigate:t=>this.navigate({...t,from:n.pathname}),buildLocation:this.buildLocation,cause:o?"preload":n.cause}))??{};if(Et(h))throw h;const d={...r,...h};e[t]=n={...n,routeContext:$(n.routeContext,h),context:$(n.context,d),abortController:i,pendingPromise:u}}catch(t){c(t,"BEFORE_LOAD");break}}}catch(t){if(Et(t))return o||this.navigate(t),e;throw t}const a=e.slice(0,r),i=[];return a.forEach(((r,a)=>{i.push(new Promise((async c=>{const l=i[a-1],u=this.looseRoutesById[r.routeId],h=t=>!!Et(t)&&(o||this.navigate(t),!0);let d;e[a]=r={...r,showPending:!1};let f=!1;const p=u.options.pendingMs??this.options.defaultPendingMs,m=u.options.pendingMinMs??this.options.defaultPendingMinMs,y=!o&&"number"==typeof p&&(u.options.pendingComponent??this.options.defaultPendingComponent),g={params:r.params,deps:r.loaderDeps,preload:!!o,parentMatchPromise:l,abortController:r.abortController,context:r.context,location:this.state.location,navigate:t=>this.navigate({...t,from:r.pathname}),cause:o?"preload":r.cause},v=async()=>{if(r.isFetching)d=Ot(this.state,r.id)?.loadPromise;else{r.fetchCount&&"success"===r.status&&c(),e[a]=r={...r,isFetching:!0,fetchCount:r.fetchCount+1};const t=Promise.all(kt.map((async t=>{const e=u.options[t];e?.preload&&await e.preload()}))),o=u.options.loader?.(g);d=Promise.all([t,o]).then((t=>t[1]))}e[a]=r={...r,loadPromise:d},s(r);try{const o=await d;if(n=t())return await n;if(Et(o)&&h(o))return;if(f&&m&&await new Promise((t=>setTimeout(t,m))),n=t())return await n;e[a]=r={...r,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:o,loadPromise:void 0}}catch(o){if(n=t())return await n;if(h(o))return;try{u.options.onError?.(o)}catch(t){if(o=t,h(t))return}e[a]=r={...r,error:o,status:"error",isFetching:!1}}s(r)},b=Date.now()-r.updatedAt;let w,_=o?u.options.preloadStaleTime??this.options.defaultPreloadStaleTime??3e4:u.options.staleTime??this.options.defaultStaleTime??0;const S=u.options.shouldReload;w="function"==typeof S?S(g):S,e[a]=r={...r,preload:!!o&&!this.state.matches.find((t=>t.id===r.id))},"success"!==r.status?(y&&r.pendingPromise?.then((async()=>{if(n=t())return n;f=!0,e[a]=r={...r,showPending:!0},s(r),c()})),await v()):(r.invalid||(w??b>_))&&v(),c()})))})),await Promise.all(i),e};invalidate=()=>{const t=t=>({...t,invalid:!0});this.__store.setState((e=>({...e,matches:e.matches.map(t),cachedMatches:e.cachedMatches.map(t),pendingMatches:e.pendingMatches?.map(t)}))),this.load()};load=async()=>{const t=new Promise((async(e,o)=>{const n=this.latestLocation,r=this.state.resolvedLocation,s=r.href!==n.href;let a,i;this.cancelMatches(),this.emit({type:"onBeforeLoad",fromLocation:r,toLocation:n,pathChanged:s});const c=this.state.matches;this.__store.batch((()=>{this.cleanCache(),i=this.matchRoutes(n.pathname,n.search,{debug:!0}),this.__store.setState((t=>({...t,isLoading:!0,location:n,pendingMatches:i,cachedMatches:t.cachedMatches.filter((t=>!i.find((e=>e.id===t.id))))})))}));try{try{await this.loadMatches({matches:i,checkLatest:()=>this.checkLatest(t)})}catch(t){}if(a=this.checkLatest(t))return a;const o=c.filter((t=>!i.find((e=>e.id===t.id)))),l=i.filter((t=>!c.find((e=>e.id===t.id)))),u=c.filter((t=>i.find((e=>e.id===t.id))));this.__store.batch((()=>{this.__store.setState((t=>({...t,isLoading:!1,matches:t.pendingMatches,pendingMatches:void 0,cachedMatches:[...t.cachedMatches,...o.filter((t=>"error"!==t.status))]}))),this.cleanCache()})),[[o,"onLeave"],[l,"onEnter"],[u,"onStay"]].forEach((([t,e])=>{t.forEach((t=>{this.looseRoutesById[t.routeId].options[e]?.(t)}))})),this.emit({type:"onLoad",fromLocation:r,toLocation:n,pathChanged:s}),e()}catch(e){if(a=this.checkLatest(t))return a;o(e)}}));return this.latestLoadPromise=t,this.latestLoadPromise};cleanCache=()=>{this.__store.setState((t=>({...t,cachedMatches:t.cachedMatches.filter((t=>{const e=this.looseRoutesById[t.routeId];if(!e.options.loader)return!1;const o=(t.preload?e.options.preloadGcTime??this.options.defaultPreloadGcTime:e.options.gcTime??this.options.defaultGcTime)??3e5;return"error"!==t.status&&Date.now()-t.updatedAt<o}))})))};preloadRoute=async(t=this.state.location)=>{let e=this.buildLocation(t),o=this.matchRoutes(e.pathname,e.search,{throwOnError:!0});const n=Object.fromEntries([...this.state.matches,...this.state.pendingMatches??[],...this.state.cachedMatches]?.map((t=>[t.id,!0])));return this.__store.batch((()=>{o.forEach((t=>{n[t.id]||this.__store.setState((e=>({...e,cachedMatches:[...e.cachedMatches,t]})))}))})),o=await this.loadMatches({matches:o,preload:!0,checkLatest:()=>{}}),o};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0};const o=this.buildLocation(t);if(e?.pending&&"pending"!==this.state.status)return!1;const n=e?.pending?this.latestLocation:this.state.resolvedLocation;if(!n)return!1;const r=lt(this.basepath,n.pathname,{...e,to:o.pathname});return!!r&&(r&&(e?.includeSearch??1)?!!H(n.search,o.search,!0)&&r:r)};injectHtml=async t=>{this.injectedHtml.push(t)};dehydrateData=(t,e)=>{if("undefined"==typeof document){const o="string"==typeof t?t:JSON.stringify(t);return this.injectHtml((async()=>{const t=`__TSR_DEHYDRATED__${o}`,n="function"==typeof e?await e():e;return`<script id='${t}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${K(o)}"] = ${JSON.stringify(n)}\n ;(() => {\n var el = document.getElementById('${t}')\n el.parentElement.removeChild(el)\n })()\n <\/script>`})),()=>this.hydrateData(t)}return()=>{}};hydrateData=t=>{if("undefined"!=typeof document){const e="string"==typeof t?t:JSON.stringify(t);return window[`__TSR_DEHYDRATED__${e}`]}};dehydrate=()=>({state:{dehydratedMatches:this.state.matches.map((t=>j(t,["id","status","updatedAt","loaderData"])))}});hydrate=async t=>{let e=t;"undefined"!=typeof document&&(e=window.__TSR_DEHYDRATED__),g(e);const o=e;this.dehydratedData=o.payload,this.options.hydrate?.(o.payload);const n=o.router.state;let r=this.matchRoutes(this.state.location.pathname,this.state.location.search).map((t=>{const e=n.dehydratedMatches.find((e=>e.id===t.id));return g(e,t.id),e?{...t,...e}:t}));this.__store.setState((t=>({...t,matches:r})))}},t.RouterProvider=function({router:e,...o}){e.update({...e.options,...o,context:{...e.options.context,...o?.context}});const n=e.options.InnerWrap?r.createElement(e.options.InnerWrap,null,r.createElement(z,null)):r.createElement(z,null),s=r.createElement(t.routerContext.Provider,{value:e},n,r.createElement(Mt,null));return e.options.Wrap?r.createElement(e.options.Wrap,null,s):s},t.ScrollRestoration=function(t){return Kt(t),null},t.SearchParamError=It,t.cleanPath=ot,t.componentTypes=kt,t.createBrowserHistory=d,t.createHashHistory=function(t){const e=t?.window??("undefined"!=typeof document?window:void 0);return d({window:e,parseLocation:()=>p(e.location.hash.split("#").slice(1).join("#")??"/",e.history.state),createHref:t=>`${e.location.pathname}${e.location.search}#${t}`})},t.createHistory=u,t.createMemoryHistory=f,t.createRouteMask=function(t){return t},t.decode=Rt,t.deepEqual=H,t.defaultParseSearch=Lt,t.defaultStringifySearch=Pt,t.defer=function(t){const e=t;if(!e.__deferredState){e.__deferredState={uid:Math.random().toString(36).slice(2),status:"pending"};const t=e.__deferredState;e.then((e=>{t.status="success",t.data=e})).catch((e=>{t.status="error",t.error=e}))}return e},t.encode=_t,t.escapeJSON=K,t.functionalUpdate=D,t.getInitialRouterState=jt,t.getRenderedMatches=V,t.getRouteMatch=Ot,t.interpolatePath=ct,t.invariant=g,t.isDehydratedDeferred=w,t.isPlainArray=N,t.isPlainObject=B,t.isRedirect=Et,t.isServer=k,t.joinPaths=et,t.last=I,t.lazyFn=function(t,e){return async(...o)=>(await t())[e||"default"](...o)},t.lazyRouteComponent=function(t,e){let o;const n=()=>(o||(o=t()),o),s=r.lazy((async()=>({default:(await n())[e??"default"]})));return s.preload=n,s},t.matchByPath=ht,t.matchContext=W,t.matchPathname=lt,t.parsePathname=it,t.parseSearchWith=xt,t.pick=j,t.redirect=function(t){if(t.isRedirect=!0,t.throw)throw t;return t},t.removeBasepath=ut,t.replaceEqualDeep=$,t.resolvePath=at,t.rootRouteId=pt,t.rootRouteWithContext=function(){return t=>new yt(t)},t.shallow=function(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const o=Object.keys(t);if(o.length!==Object.keys(e).length)return!1;for(let n=0;n<o.length;n++)if(!Object.prototype.hasOwnProperty.call(e,o[n])||!Object.is(t[o[n]],e[o[n]]))return!1;return!0},t.stringifySearchWith=Ct,t.trimPath=st,t.trimPathLeft=nt,t.trimPathRight=rt,t.useAwaited=_,t.useBlocker=zt,t.useElementScrollRestoration=function(t){const e=b(),o=t?.getKey||Ft;let n="";if(t.id)n=`[data-scroll-restoration-id="${t.id}"]`;else{const e=t.getElement?.();if(!e)return;n=Wt(e)}const r=[o(e.latestLocation),n].join(At);return Ht.state.cached[r]},t.useLayoutEffect=F,t.useLinkProps=bt,t.useLoaderData=tt,t.useLoaderDeps=Z,t.useMatch=G,t.useMatchRoute=q,t.useMatches=Q,t.useNavigate=function(t){const{navigate:e}=b(),o=G({strict:!1,select:t=>t.pathname});return r.useCallback((({from:t,...n})=>e({from:n?.to?o:void 0,...n})),[])},t.useParams=dt,t.useParentMatches=function(t){const e=r.useContext(W);return Q({select:o=>(o=o.slice(o.findIndex((t=>t.id===e))),t?.select?t.select(o):o)})},t.useRouteContext=function(t){return G({...t,select:e=>t?.select?t.select(e.context):e.context})},t.useRouter=b,t.useRouterState=O,t.useScrollRestoration=Kt,t.useSearch=ft,t.useStableCallback=function(t){const e=r.useRef(t);return e.current=t,r.useRef(((...t)=>e.current(...t))).current},t.warning=v}));
|
|
21
|
+
*/const s="pushstate",a="popstate",i="beforeunload",c=t=>(t.preventDefault(),t.returnValue=""),l=()=>{removeEventListener(i,c,{capture:!0})};function u(t){let e=t.getLocation(),o=new Set,r=[];const n=()=>{e=t.getLocation(),o.forEach((t=>t()))},s=async e=>{if("undefined"!=typeof document&&r.length)for(let e of r){if(!await e())return void t.onBlocked?.(n)}e()};return{get location(){return e},subscribe:t=>(o.add(t),()=>{o.delete(t)}),push:(e,o)=>{o=h(o),s((()=>{t.pushState(e,o),n()}))},replace:(e,o)=>{o=h(o),s((()=>{t.replaceState(e,o),n()}))},go:e=>{s((()=>{t.go(e)}))},back:()=>{s((()=>{t.back()}))},forward:()=>{s((()=>{t.forward()}))},createHref:e=>t.createHref(e),block:t=>(r.push(t),1===r.length&&addEventListener(i,c,{capture:!0}),()=>{r=r.filter((e=>e!==t)),r.length||l()}),flush:()=>t.flush?.(),destroy:()=>t.destroy?.(),notify:n}}function h(t){return t||(t={}),{...t,key:m()}}function d(t){const e=t?.window??("undefined"!=typeof document?window:void 0),o=t?.createHref??(t=>t),r=t?.parseLocation??(()=>p(`${e.location.pathname}${e.location.search}${e.location.hash}`,e.history.state));let n,i=r();let c,l,h=!0;const d=()=>{h=!1,(()=>{c&&(e.history[c.isPush?"pushState":"replaceState"](c.state,"",c.href),c=void 0,l=void 0,n=void 0)})(),h=!0},f=(t,e,r)=>{const s=o(e);l||(n=i),i=p(e,r),c={href:s,state:r,isPush:c?.isPush||"push"===t},l||(l=Promise.resolve().then((()=>d())))},m=()=>{i=r(),v.notify()};var y=e.history.pushState,g=e.history.replaceState;const v=u({getLocation:()=>i,pushState:(t,e)=>f("push",t,e),replaceState:(t,e)=>f("replace",t,e),back:()=>e.history.back(),forward:()=>e.history.forward(),go:t=>e.history.go(t),createHref:t=>o(t),flush:d,destroy:()=>{e.history.pushState=y,e.history.replaceState=g,e.removeEventListener(s,m),e.removeEventListener(a,m)},onBlocked:t=>{n&&i!==n&&(i=n,t())}});return e.addEventListener(s,m),e.addEventListener(a,m),e.history.pushState=function(){let t=y.apply(e.history,arguments);return h&&v.notify(),t},e.history.replaceState=function(){let t=g.apply(e.history,arguments);return h&&v.notify(),t},v}function f(t={initialEntries:["/"]}){const e=t.initialEntries;let o=t.initialIndex??e.length-1,r={key:m()};return u({getLocation:()=>p(e[o],r),pushState:(t,n)=>{r=n,e.push(t),o++},replaceState:(t,n)=>{r=n,e[o]=t},back:()=>{o--},forward:()=>{o=Math.min(o+1,e.length-1)},go:t=>{o=Math.min(Math.max(o+t,0),e.length-1)},createHref:t=>t})}function p(t,e){let o=t.indexOf("#"),r=t.indexOf("?");return{href:t,pathname:t.substring(0,o>0?r>0?Math.min(o,r):o:r>0?r:t.length),hash:o>-1?t.substring(o):"",search:r>-1?t.slice(r,-1===o?void 0:o):"",state:e||{}}}function m(){return(Math.random()+1).toString(36).substring(7)}var y="Invariant failed";function g(t,e){if(!t)throw new Error(y)}function v(t,e){}function _(t){const e=t.errorComponent??S;return n.createElement(b,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:o})=>o?n.createElement(e,{error:o}):t.children})}class b extends n.Component{state={error:null};static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}componentDidUpdate(t,e){e.error&&e.resetKey!==this.state.resetKey&&this.setState({error:null})}componentDidCatch(t){console.error(t),this.props.onCatch?.(t)}render(){return this.props.children(this.state)}}function S({error:t}){const[e,o]=n.useState(!1);return n.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},n.createElement("div",{style:{display:"flex",alignItems:"center",gap:".5rem"}},n.createElement("strong",{style:{fontSize:"1rem"}},"Something went wrong!"),n.createElement("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>o((t=>!t))},e?"Hide Error":"Show Error")),n.createElement("div",{style:{height:".25rem"}}),e?n.createElement("div",null,n.createElement("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"}},t.message?n.createElement("code",null,t.message):null)):null)}var w,E={exports:{}},R={};E.exports=function(){if(w)return R;w=1;var t=e,r=o,n="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},s=r.useSyncExternalStore,a=t.useRef,i=t.useEffect,c=t.useMemo,l=t.useDebugValue;return R.useSyncExternalStoreWithSelector=function(t,e,o,r,u){var h=a(null);if(null===h.current){var d={hasValue:!1,value:null};h.current=d}else d=h.current;h=c((function(){function t(t){if(!i){if(i=!0,s=t,t=r(t),void 0!==u&&d.hasValue){var e=d.value;if(u(e,t))return a=e}return a=t}if(e=a,n(s,t))return e;var o=r(t);return void 0!==u&&u(e,o)?e:(s=t,a=o)}var s,a,i=!1,c=void 0===o?null:o;return[function(){return t(e())},null===c?void 0:function(){return t(c())}]}),[e,o,r,u]);var f=s(t,h[0],h[1]);return i((function(){d.hasValue=!0,d.value=f}),[f]),l(f),f},R}();var L=E.exports,P=class{constructor(t,e){this.listeners=new Set,this._batching=!1,this._flushing=0,this._nextPriority=null,this.subscribe=t=>{this.listeners.add(t);const e=this.options?.onSubscribe?.(t,this);return()=>{this.listeners.delete(t),e?.()}},this.setState=(t,e)=>{const o=this.state;this.state=this.options?.updateFn?this.options.updateFn(o)(t):t(o);const r=e?.priority??this.options?.defaultPriority??"high";null===this._nextPriority||"high"===this._nextPriority?this._nextPriority=r:this._nextPriority=this.options?.defaultPriority??"high",this.options?.onUpdate?.({priority:this._nextPriority}),this._flush()},this._flush=()=>{if(this._batching)return;const t=++this._flushing;this.listeners.forEach((e=>{this._flushing===t&&e({priority:this._nextPriority??"high"})}))},this.batch=t=>{if(this._batching)return t();this._batching=!0,t(),this._batching=!1,this._flush()},this.state=t,this.options=e}};function x(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const o=Object.keys(t);if(o.length!==Object.keys(e).length)return!1;for(let r=0;r<o.length;r++)if(!Object.prototype.hasOwnProperty.call(e,o[r])||!Object.is(t[o[r]],e[o[r]]))return!1;return!0}function C(e){const o="undefined"!=typeof document&&window.__TSR_ROUTER_CONTEXT__||t.routerContext,r=n.useContext(o);return r}function T(t){const e=C();return function(t,e=(t=>t)){return L.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,x)}((t?.router||e).__store,t?.select)}t.routerContext=n.createContext(null),"undefined"!=typeof document&&(window.__TSR_ROUTER_CONTEXT__?t.routerContext=window.__TSR_ROUTER_CONTEXT__:window.__TSR_ROUTER_CONTEXT__=t.routerContext);const M="undefined"==typeof document;function O(t){return t[t.length-1]}function k(t,e){return"function"==typeof t?t(e):t}function I(t,e){return e.reduce(((e,o)=>(e[o]=t[o],e)),{})}function D(t,e){if(t===e)return t;const o=e,r=B(t)&&B(o);if(r||j(t)&&j(o)){const e=r?t:Object.keys(t),n=e.length,s=r?o:Object.keys(o),a=s.length,i=r?[]:{};let c=0;for(let n=0;n<a;n++){const a=r?n:s[n];!r&&void 0===t[a]&&void 0===o[a]&&e.includes(a)?(i[a]=void 0,c++):(i[a]=D(t[a],o[a]),i[a]===t[a]&&void 0!==t[a]&&c++)}return n===a&&c===n?t:i}return o}function j(t){if(!$(t))return!1;const e=t.constructor;if(void 0===e)return!0;const o=e.prototype;return!!$(o)&&!!o.hasOwnProperty("isPrototypeOf")}function $(t){return"[object Object]"===Object.prototype.toString.call(t)}function B(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function A(t,e,o=!1){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(j(t)&&j(e)){const r=Object.keys(t),n=Object.keys(e);return!(!o&&r.length!==n.length)&&!n.some((r=>!(r in t)||!A(t[r],e[r],o)))}return!(!Array.isArray(t)||!Array.isArray(e))&&!t.some(((t,r)=>!A(t,e[r],o)))}const N="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function z(t){return t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}const H=n.createContext(void 0);function F(){const t=C(),e=T({select:t=>X(t)[0]?.id});return n.createElement(H.Provider,{value:e},n.createElement(_,{getResetKey:()=>t.state.resolvedLocation.state?.key,errorComponent:S,onCatch:()=>{}},e?n.createElement(W,{matchId:e}):null))}function K(t){return n.createElement(n.Fragment,null,t.children)}function W({matchId:t}){const e=C(),o=T({select:e=>X(e).find((e=>e.id===t))?.routeId});g(o);const r=e.routesById[o],s=r.options.pendingComponent??e.options.defaultPendingComponent,a=s?n.createElement(s,null):null,i=r.options.errorComponent??e.options.defaultErrorComponent??S,c=r.options.wrapInSuspense??s??r.options.component?.preload??r.options.pendingComponent?.preload??r.options.errorComponent?.preload?n.Suspense:K,l=i?_:K;return n.createElement(H.Provider,{value:t},n.createElement(c,{fallback:a},n.createElement(l,{getResetKey:()=>e.state.resolvedLocation.state?.key,errorComponent:i,onCatch:()=>{}},n.createElement(U,{matchId:t,pendingElement:a}))))}function U({matchId:t,pendingElement:e}){const o=C(),r=T({select:e=>X(e).find((e=>e.id===t))?.routeId}),s=o.routesById[r],a=T({select:e=>I(X(e).find((e=>e.id===t)),["status","error","showPending","loadPromise"])});if("error"===a.status){if(Z(a.error)){throw(o.options.errorSerializer?.deserialize??tt)(a.error.data)}throw a.error}if("pending"===a.status){if(a.showPending)return e;throw a.loadPromise}if("success"===a.status){let t=s.options.component??o.options.defaultComponent;return t?n.createElement(t,null):n.createElement(Y,null)}g(!1)}const Y=n.memo((function(){const t=n.useContext(H),e=T({select:e=>{const o=X(e),r=o.findIndex((e=>e.id===t));return o[r+1]?.id}});return e?n.createElement(W,{matchId:e}):null}));function J(){T({select:t=>[t.location,t.resolvedLocation]});const{matchRoute:t}=C();return n.useCallback((e=>{const{pending:o,caseSensitive:r,fuzzy:n,includeSearch:s,...a}=e;return t(a,{pending:o,caseSensitive:r,fuzzy:n,includeSearch:s})}),[])}function X(t){return t.pendingMatches?.some((t=>t.showPending))?t.pendingMatches:t.matches}function q(t){const e=C(),o=n.useContext(H),r=X(e.state).find((t=>t.id===o))?.routeId,s=(()=>{const r=X(e.state);return(t?.from?r.find((e=>e.routeId===t?.from)):r.find((t=>t.id===o))).routeId})();(t?.strict??1)&&g(r==s);return T({select:e=>{const r=X(e).find((t=>t.id===o));return g(r,t?.from&&t.from),t?.select?t.select(r):r}})}function V(t){return T({select:e=>{let o=X(e);return t?.select?t.select(o):o}})}function G(t){return q({...t,select:e=>"function"==typeof t.select?t.select(e?.loaderDeps):e?.loaderDeps})}function Q(t){return q({...t,select:e=>"function"==typeof t.select?t.select(e?.loaderData):e?.loaderData})}function Z(t){return!("object"!=typeof t||!t||!("data"in t))&&(!(!("__isServerError"in t)||!t.__isServerError)&&(!("object"!=typeof t.data||!t.data)&&!0===t.__isServerError))}function tt(t){if("name"in t&&"message"in t){const e=new Error(t.message);return e.name=t.name,e}return t.data}function et(t,e){var o,r,n,s="";for(o in t)if(void 0!==(n=t[o]))if(Array.isArray(n))for(r=0;r<n.length;r++)s&&(s+="&"),s+=encodeURIComponent(o)+"="+encodeURIComponent(n[r]);else s&&(s+="&"),s+=encodeURIComponent(o)+"="+encodeURIComponent(n);return(e||"")+s}function ot(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||(0*+e==0&&+e+""===e?+e:e))}function rt(t){for(var e,o,r={},n=t.split("&");e=n.shift();)void 0!==r[o=(e=e.split("=")).shift()]?r[o]=[].concat(r[o],ot(e.shift())):r[o]=ot(e.shift());return r}const nt=at(JSON.parse),st=it(JSON.stringify,JSON.parse);function at(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let o=rt(e);for(let e in o){const r=o[e];if("string"==typeof r)try{o[e]=t(r)}catch(t){}}return o}}function it(t,e){return o=>{(o={...o})&&Object.keys(o).forEach((r=>{const n=o[r];void 0===n||void 0===n?delete o[r]:o[r]=function(o){if("object"==typeof o&&null!==o)try{return t(o)}catch(t){}else if("string"==typeof o&&"function"==typeof e)try{return e(o),t(o)}catch(t){}return o}(n)}));const r=et(o).toString();return r?`?${r}`:""}}const ct=n.useTransition||(()=>[!1,t=>{t()}]);function lt(){const t=n.useRef(0),e=C(),o=T({select:t=>I(t,["isLoading","location","resolvedLocation","isTransitioning"])}),[r,s]=ct();e.startReactTransition=s,n.useEffect((()=>{r&&e.__store.setState((t=>({...t,isTransitioning:r})))}),[r]);const a=()=>{var t;t=()=>{try{e.load()}catch(t){console.error(t)}},o.isTransitioning?t():s((()=>t()))};return N((()=>{const t=e.history.subscribe((()=>{e.latestLocation=e.parseLocation(e.latestLocation),o.location!==e.latestLocation&&a()})),r=e.buildLocation({search:!0,params:!0,hash:!0,state:!0});return o.location.href!==r.href&&e.commitLocation({...r,replace:!0}),()=>{t()}}),[e.history]),N((()=>{if(n.useTransition?o.isTransitioning&&!r:!o.isLoading&&o.resolvedLocation!==o.location){if(e.emit({type:"onResolved",fromLocation:o.resolvedLocation,toLocation:o.location,pathChanged:o.location.href!==o.resolvedLocation?.href}),document.querySelector&&""!==o.location.hash){const t=document.getElementById(o.location.hash);t&&t.scrollIntoView()}e.__store.setState((t=>({...t,isTransitioning:!1,resolvedLocation:t.location})))}}),[o.isTransitioning,r,o.isLoading,o.resolvedLocation,o.location]),N((()=>{window.__TSR_DEHYDRATED__||t.current||(t.current++,a())}),[]),null}function ut(t,e){return[...t.cachedMatches,...t.pendingMatches??[],...t.matches].find((t=>t.id===e))}function ht(t){return dt(t.filter(Boolean).join("/"))}function dt(t){return t.replace(/\/{2,}/g,"/")}function ft(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function pt(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function mt(t){return pt(ft(t))}function yt(t,e,o){e=e.replace(new RegExp(`^${t}`),"/"),o=o.replace(new RegExp(`^${t}`),"/");let r=gt(e);const n=gt(o);n.forEach(((t,e)=>{if("/"===t.value)e?e===n.length-1&&r.push(t):r=[t];else if(".."===t.value)r.length>1&&"/"===O(r)?.value&&r.pop(),r.pop();else{if("."===t.value)return;r.push(t)}}));return dt(ht([t,...r.map((t=>t.value))]))}function gt(t){if(!t)return[];const e=[];if("/"===(t=dt(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const o=t.split("/").filter(Boolean);return e.push(...o.map((t=>"$"===t||"*"===t?{type:"wildcard",value:t}:"$"===t.charAt(0)?{type:"param",value:t}:{type:"pathname",value:t}))),"/"===t.slice(-1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),e}function vt(t,e,o=!1){return ht(gt(t).map((t=>{if("wildcard"===t.type){const r=e[t.value];return o?`${t.value}${r??""}`:r}return"param"===t.type?e[t.value.substring(1)]??"undefined":t.value})))}function _t(t,e,o){const r=St(t,e,o);if(!o.to||r)return r??{}}function bt(t,e){return"/"!=t?e.substring(t.length):e}function St(t,e,o){e=bt(t,e);const r=`${o.to??"$"}`,n=gt(e),s=gt(r);e.startsWith("/")||n.unshift({type:"pathname",value:"/"}),r.startsWith("/")||s.unshift({type:"pathname",value:"/"});const a={};return(()=>{for(let t=0;t<Math.max(n.length,s.length);t++){const e=n[t],r=s[t],i=t>=n.length-1,c=t>=s.length-1;if(r){if("wildcard"===r.type){if(e?.value){const e=ht(n.slice(t).map((t=>t.value)));return a["*"]=e,a._splat=e,!0}return!1}if("pathname"===r.type){if("/"===r.value&&!e?.value)return!0;if(e)if(o.caseSensitive){if(r.value!==e.value)return!1}else if(r.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===r.type){if("/"===e?.value)return!1;"$"!==e.value.charAt(0)&&(a[r.value.substring(1)]=e.value)}}if(!i&&c)return a["**"]=ht(n.slice(t+1).map((t=>t.value))),!!o.fuzzy&&"/"!==r?.value}return!0})()?a:void 0}function wt(t){return!!t?.isRedirect}const Et=["component","errorComponent","pendingComponent"];class Rt extends Error{}class Lt extends Error{}function Pt(t){return{isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:{...t},location:t,matches:[],pendingMatches:[],cachedMatches:[],lastUpdated:Date.now()}}function xt(t){return t instanceof Error?{name:t.name,message:t.message}:{data:t}}function Ct(t){return"object"==typeof t&&null!==t&&!(t instanceof Promise)&&!t.then&&"__deferredState"in t}function Tt({promise:t}){const e=C();let o=t.__deferredState;const r=`__TSR__DEFERRED__${o.uid}`;if(Ct(t)){if(o=e.hydrateData(r),!o)throw new Error("Could not find dehydrated data");(t=Promise.resolve(o.data)).__deferredState=o}if("pending"===o.status)throw t;if("error"===o.status)throw"undefined"!=typeof document?Z(o.error)?(e.options.errorSerializer?.deserialize??tt)(o.error.data):o.error:(e.dehydrateData(r,o),{data:(e.options.errorSerializer?.serialize??xt)(o.error),__isServerError:!0});return e.dehydrateData(r,o),[o.data]}function Mt(t){return T({select:e=>{const o=O(X(e))?.params;return t?.select?t.select(o):o}})}function Ot(t){return q({...t,select:e=>t?.select?t.select(e.search):e.search})}const kt="__root__";class It{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute,g(!(t?.id&&t?.path)),this.$$typeof=Symbol.for("react.memo")}init=t=>{this.originalIndex=t.originalIndex;const e=this.options,o=!e?.path&&!e?.id;this.parentRoute=this.options?.getParentRoute?.(),o?this.path=kt:g(this.parentRoute);let r=o?kt:e.path;r&&"/"!==r&&(r=mt(r));const n=e?.id||r;let s=o?kt:ht([this.parentRoute.id===kt?"":this.parentRoute.id,n]);r===kt&&(r="/"),s!==kt&&(s=ht(["/",s]));const a=s===kt?"/":ht([this.parentRoute.fullPath,r]);this.path=r,this.id=s,this.fullPath=a,this.to=a};addChildren=t=>(this.children=t,this);updateLoader=t=>(Object.assign(this.options,t),this);update=t=>(Object.assign(this.options,t),this);useMatch=t=>q({...t,from:this.id});useRouteContext=t=>q({...t,from:this.id,select:e=>t?.select?t.select(e.context):e.context});useSearch=t=>Ot({...t,from:this.id});useParams=t=>Mt({...t,from:this.id});useLoaderDeps=t=>G({...t,from:this.id});useLoaderData=t=>Q({...t,from:this.id})}class Dt extends It{constructor(t){super(t)}}function jt(){return jt=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(t[r]=o[r])}return t},jt.apply(this,arguments)}const $t="Error preloading route! ☝️";function Bt(t){const e=C(),o=q({strict:!1,select:t=>t.pathname}),{children:r,target:n,activeProps:s=(()=>({className:"active"})),inactiveProps:a=(()=>({})),activeOptions:i,disabled:c,hash:l,search:u,params:h,to:d,state:f,mask:p,preload:m,preloadDelay:y,replace:g,startTransition:v,resetScroll:_,style:b,className:S,onClick:w,onFocus:E,onMouseEnter:R,onMouseLeave:L,onTouchStart:P,...x}=t,M={from:t.to?o:void 0,...t};let O="internal";try{new URL(`${d}`),O="external"}catch{}if("external"===O)return{href:d};const I=e.buildLocation(M),D=m??e.options.defaultPreload,j=y??e.options.defaultPreloadDelay??0,$=T({select:t=>{const e=t.location.pathname.split("/"),o=I.pathname.split("/").every(((t,o)=>t===e[o])),r=i?.exact?t.location.pathname===I.pathname:o,n=!i?.includeHash||t.location.hash===I.hash,s=!(i?.includeSearch??1)||A(t.location.search,I.search,!i?.exact);return r&&n&&s}}),B=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},N=$?k(s,{})??{}:{},z=$?{}:k(a,{})??{};return{...N,...z,...x,href:c?void 0:I.maskedLocation?I.maskedLocation.href:I.href,onClick:B([w,t=>{c||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||n&&"_self"!==n||0!==t.button||(t.preventDefault(),e.commitLocation({...I,replace:g,resetScroll:_,startTransition:v}))}]),onFocus:B([E,t=>{D&&e.preloadRoute(M).catch((t=>{console.warn(t),console.warn($t)}))}]),onMouseEnter:B([R,t=>{const o=t.target||{};if(D){if(o.preloadTimeout)return;o.preloadTimeout=setTimeout((()=>{o.preloadTimeout=null,e.preloadRoute(M).catch((t=>{console.warn(t),console.warn($t)}))}),j)}}]),onMouseLeave:B([L,t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)}]),onTouchStart:B([P,t=>{D&&e.preloadRoute(M).catch((t=>{console.warn(t),console.warn($t)}))}]),target:n,style:{...b,...N.style,...z.style},className:[S,N.className,z.className].filter(Boolean).join(" ")||void 0,...c?{role:"link","aria-disabled":!0}:void 0,"data-status":$?"active":void 0}}const At=n.forwardRef(((t,e)=>{const o=Bt(t);return n.createElement("a",jt({ref:e},o,{children:"function"==typeof t.children?t.children({isActive:"active"===o["data-status"]}):t.children}))}));const Nt="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,zt="window",Ht="___";let Ft=new WeakSet;let Kt="undefined"!=typeof window&&window.sessionStorage?(()=>{const t="tsr-scroll-restoration-v2";return{state:JSON.parse(window.sessionStorage.getItem(t)||"null")||{cached:{},next:{}},set:e=>{Kt.state=k(e,Kt.state),window.sessionStorage.setItem(t,JSON.stringify(Kt.state))}}})():void 0;const Wt=t=>t.state.key;function Ut(t){const e=C();Nt((()=>{const o=t?.getKey||Wt,{history:r}=window;r.scrollRestoration&&(r.scrollRestoration="manual");const n=t=>{if(Ft.has(t.target))return;Ft.add(t.target);let e="";if(t.target===document||t.target===window)e=zt;else{const o=t.target.getAttribute("data-scroll-restoration-id");e=o?`[data-scroll-restoration-id="${o}"]`:Yt(t.target)}Kt.state.next[e]||Kt.set((t=>({...t,next:{...t.next,[e]:{scrollX:NaN,scrollY:NaN}}})))};"undefined"!=typeof document&&document.addEventListener("scroll",n,!0);const s=e.subscribe("onBeforeLoad",(t=>{if(t.pathChanged){const e=o(t.fromLocation);for(const t in Kt.state.next){const o=Kt.state.next[t];if(t===zt)o.scrollX=window.scrollX||0,o.scrollY=window.scrollY||0;else if(t){const e=document.querySelector(t);o.scrollX=e?.scrollLeft||0,o.scrollY=e?.scrollTop||0}Kt.set((r=>{const n={...r.next};return delete n[t],{...r,next:n,cached:{...r.cached,[[e,t].join(Ht)]:o}}}))}}})),a=e.subscribe("onResolved",(o=>{if(o.pathChanged){if(!e.resetNextScroll)return;e.resetNextScroll=!0;const r=(t?.getKey||Wt)(o.toLocation);let n=!1;for(const t in Kt.state.cached){const e=Kt.state.cached[t],[o,s]=t.split(Ht);if(o===r)if(s===zt)n=!0,window.scrollTo(e.scrollX,e.scrollY);else if(s){const t=document.querySelector(s);t&&(t.scrollLeft=e.scrollX,t.scrollTop=e.scrollY)}}n||window.scrollTo(0,0),Kt.set((t=>({...t,next:{}}))),Ft=new WeakSet}}));return()=>{document.removeEventListener("scroll",n),s(),a()}}),[])}function Yt(t){let e,o=[];for(;e=t.parentNode;)o.unshift(`${t.tagName}:nth-child(${[].indexOf.call(e.children,t)+1})`),t=e;return`${o.join(" > ")}`.toLowerCase()}function Jt(t,e=!0){const{history:o}=C();n.useEffect((()=>{if(e)return o.block(t)}))}t.Await=function(t){const e=Tt(t);return t.children(...e)},t.Block=function({blocker:t,condition:e,children:o}){return Jt(t,e),o??null},t.CatchBoundary=_,t.CatchBoundaryImpl=b,t.ErrorComponent=S,t.FileRoute=class{constructor(t){this.path=t}createRoute=t=>{const e=new It(t);return e.isRoot=!1,e}},t.FileRouteLoader=function(t){return t=>t},t.Link=At,t.Match=W,t.MatchRoute=function(t){const e=J()(t);return"function"==typeof t.children?t.children(e):e?t.children:null},t.Matches=F,t.Navigate=function(t){const{navigate:e}=C(),o=q({strict:!1});return n.useEffect((()=>{e({from:t.to?o.pathname:void 0,...t})}),[]),null},t.NotFoundRoute=class extends It{constructor(t){super({...t,id:"404"})}},t.Outlet=Y,t.PathParamError=Lt,t.RootRoute=Dt,t.Route=It,t.RouteApi=class{constructor({id:t}){this.id=t}useMatch=t=>q({select:t?.select,from:this.id});useRouteContext=t=>q({from:this.id,select:e=>t?.select?t.select(e.context):e.context});useSearch=t=>Ot({...t,from:this.id});useParams=t=>Mt({...t,from:this.id});useLoaderDeps=t=>G({...t,from:this.id});useLoaderData=t=>Q({...t,from:this.id})},t.Router=class{tempLocationKey=`${Math.round(1e7*Math.random())}`;resetNextScroll=!0;navigateTimeout=null;latestLoadPromise=Promise.resolve();subscribers=new Set;injectedHtml=[];constructor(t){this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,stringifySearch:t?.stringifySearch??st,parseSearch:t?.parseSearch??nt})}startReactTransition=t=>t();update=t=>{const e=this.options;this.options={...this.options,...t},(!this.basepath||t.basepath&&t.basepath!==e.basepath)&&(void 0===t.basepath||""===t.basepath||"/"===t.basepath?this.basepath="/":this.basepath=`/${mt(t.basepath)}`),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history??("undefined"!=typeof document?d():f({initialEntries:[this.options.basepath||"/"]})),this.latestLocation=this.parseLocation()),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),this.__store||(this.__store=new P(Pt(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,status:this.state.isTransitioning||this.state.isLoading?"pending":"idle"}}}))};get state(){return this.__store.state}buildRouteTree=()=>{this.routesById={},this.routesByPath={};const t=this.options.notFoundRoute;t&&(t.init({originalIndex:99999999999}),this.routesById[t.id]=t);const e=t=>{t.forEach(((t,o)=>{t.init({originalIndex:o});if(g(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t,!t.isRoot&&t.path){const e=pt(t.fullPath);this.routesByPath[e]&&!t.fullPath.endsWith("/")||(this.routesByPath[e]=t)}const r=t.children;r?.length&&e(r)}))};e([this.routeTree]);const o=[];Object.values(this.routesById).forEach(((t,e)=>{if(t.isRoot||!t.path)return;const r=ft(t.fullPath),n=gt(r);for(;n.length>1&&"/"===n[0]?.value;)n.shift();const s=n.map((t=>"/"===t.value?.75:"param"===t.type?.5:"wildcard"===t.type?.25:1));o.push({child:t,trimmed:r,parsed:n,index:e,scores:s})})),this.flatRoutes=o.sort(((t,e)=>{const o=Math.min(t.scores.length,e.scores.length);for(let r=0;r<o;r++)if(t.scores[r]!==e.scores[r])return e.scores[r]-t.scores[r];if(t.scores.length!==e.scores.length)return e.scores.length-t.scores.length;for(let r=0;r<o;r++)if(t.parsed[r].value!==e.parsed[r].value)return t.parsed[r].value>e.parsed[r].value?1:-1;return t.index-e.index})).map(((t,e)=>(t.child.rank=e,t.child)))};subscribe=(t,e)=>{const o={eventType:t,fn:e};return this.subscribers.add(o),()=>{this.subscribers.delete(o)}};emit=t=>{this.subscribers.forEach((e=>{e.eventType===t.type&&e.fn(t)}))};checkLatest=t=>this.latestLoadPromise!==t?this.latestLoadPromise:void 0;parseLocation=t=>{const e=({pathname:e,search:o,hash:r,state:n})=>{const s=this.options.parseSearch(o);return{pathname:e,searchStr:o,search:D(t?.search,s),hash:r.split("#").reverse()[0]??"",href:`${e}${o}${r}`,state:D(t?.state,n)}},o=e(this.history.location);let{__tempLocation:r,__tempKey:n}=o.state;if(r&&(!n||n===this.tempLocationKey)){const t=e(r);return t.state.key=o.state.key,delete t.state.__tempLocation,{...t,maskedLocation:o}}return o};resolvePathWithBase=(t,e)=>yt(this.basepath,t,dt(e));get looseRoutesById(){return this.routesById}matchRoutes=(t,e,o)=>{let r={},n=this.flatRoutes.find((e=>{const o=_t(this.basepath,pt(t),{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive,fuzzy:!0});return!!o&&(r=o,!0)})),s=n||this.routesById.__root__,a=[s];for((n?"/"!==n.path&&r["**"]:pt(t))&&this.options.notFoundRoute&&a.push(this.options.notFoundRoute);s?.parentRoute;)s=s.parentRoute,s&&a.unshift(s);const i=a.map((t=>{let e;if(t.options.parseParams)try{const e=t.options.parseParams(r);Object.assign(r,e)}catch(t){if(e=new Lt(t.message,{cause:t}),o?.throwOnError)throw e;return e}})),c=[];return a.forEach(((t,n)=>{const s=c[n-1],[a,l]=(()=>{const r=s?.search??e;try{const e="object"==typeof t.options.validateSearch?t.options.validateSearch.parse:t.options.validateSearch;let o=e?.(r)??{};return[{...r,...o},void 0]}catch(t){const e=new Rt(t.message,{cause:t});if(o?.throwOnError)throw e;return[r,e]}})(),u=t.options.loaderDeps?.({search:a})??"",h=u?JSON.stringify(u):"",d=vt(t.fullPath,r),f=vt(t.id,r,!0)+h,p=ut(this.state,f),m=this.state.matches.find((t=>t.id===f))?"stay":"enter",y=!(!t.options.loader&&!Et.some((e=>t.options[e]?.preload))),g=p?{...p,cause:m}:{id:f,routeId:t.id,params:r,pathname:ht([this.basepath,d]),updatedAt:Date.now(),search:{},searchError:void 0,status:y?"pending":"success",showPending:!1,isFetching:!1,error:void 0,paramsError:i[n],loadPromise:Promise.resolve(),routeContext:void 0,context:void 0,abortController:new AbortController,fetchCount:0,cause:m,loaderDeps:u,invalid:!1,preload:!1};g.search=D(g.search,a),g.searchError=l,c.push(g)})),c};cancelMatch=t=>{ut(this.state,t)?.abortController?.abort()};cancelMatches=()=>{this.state.pendingMatches?.forEach((t=>{this.cancelMatch(t.id)}))};buildLocation=t=>{const e=(t={},e)=>{const o=this.state.pendingMatches||this.state.matches,r=o[o.length-1]?.search||this.latestLocation.search;let n=this.resolvePathWithBase(t.from??this.latestLocation.pathname,`${t.to??""}`);const s=this.matchRoutes(this.latestLocation.pathname,r),a=e?.filter((t=>s?.find((e=>e.routeId===t.routeId)))),i={...O(s)?.params};let c=!0===(t.params??!0)?i:k(t.params,i);c&&e?.map((t=>this.looseRoutesById[t.routeId].options.stringifyParams)).filter(Boolean).forEach((t=>{c={...c,...t(c)}})),n=vt(n,c??{});const l=a?.map((t=>this.looseRoutesById[t.routeId].options.preSearchFilters??[])).flat().filter(Boolean)??[],u=a?.map((t=>this.looseRoutesById[t.routeId].options.postSearchFilters??[])).flat().filter(Boolean)??[],h=l?.length?l?.reduce(((t,e)=>e(t)),r):r,d=!0===t.search?h:t.search?k(t.search,h)??{}:l?.length?h:{},f=D(r,u?.length?u.reduce(((t,e)=>e(t)),d):d),p=this.options.stringifySearch(f),m=!0===t.hash?this.latestLocation.hash:t.hash?k(t.hash,this.latestLocation.hash):void 0,y=m?`#${m}`:"";let g=!0===t.state?this.latestLocation.state:t.state?k(t.state,this.latestLocation.state):this.latestLocation.state;return g=D(this.latestLocation.state,g),{pathname:n,search:f,searchStr:p,state:g,hash:m??"",href:`${n}${p}${y}`,unmaskOnReload:t.unmaskOnReload}},o=(o={},r)=>{let n=e(o),s=r?e(r):void 0;if(!s){let o={},a=this.options.routeMasks?.find((t=>{const e=_t(this.basepath,n.pathname,{to:t.from,caseSensitive:!1,fuzzy:!1});return!!e&&(o=e,!0)}));a&&(r={...I(t,["from"]),...a,params:o},s=e(r))}const a=this.matchRoutes(n.pathname,n.search),i=s?this.matchRoutes(s.pathname,s.search):void 0,c=s?e(r,i):void 0,l=e(o,a);return c&&(l.maskedLocation=c),l};return t.mask?o(t,{...I(t,["from"]),...t.mask}):o(t)};commitLocation=async({startTransition:t,...e})=>{this.navigateTimeout&&clearTimeout(this.navigateTimeout);if(!(this.latestLocation.href===e.href)||!e.replace){let{maskedLocation:o,...r}=e;o&&(r={...o,state:{...o.state,__tempKey:void 0,__tempLocation:{...r,search:r.searchStr,state:{...r.state,__tempKey:void 0,__tempLocation:void 0,key:void 0}}}},(r.unmaskOnReload??this.options.unmaskOnReload)&&(r.state.__tempKey=this.tempLocationKey));const n=()=>{this.history[e.replace?"replace":"push"](r.href,r.state)};t??1?this.startReactTransition(n):n()}return this.resetNextScroll=e.resetScroll??!0,this.latestLoadPromise};buildAndCommitLocation=({replace:t,resetScroll:e,startTransition:o,...r}={})=>{const n=this.buildLocation(r);return this.commitLocation({...n,startTransition:o,replace:t,resetScroll:e})};navigate=({from:t,to:e,...o})=>{const r=String(e);let n;try{new URL(`${r}`),n=!0}catch(t){}return g(!n),this.buildAndCommitLocation({...o,from:t,to:e})};loadMatches=async({checkLatest:t,matches:e,preload:o})=>{let r,n;const s=t=>{const e=this.state.pendingMatches?.find((e=>e.id===t.id)),o=this.state.matches.find((e=>e.id===t.id)),r=e?"pendingMatches":o?"matches":"cachedMatches";this.__store.setState((e=>({...e,[r]:e[r]?.map((e=>e.id===t.id?t:e))})))};try{for(let[t,r]of e.entries()){const s=e[t-1],a=this.looseRoutesById[r.routeId],i=new AbortController,c=(o,s)=>{if(o.routerCode=s,n=n??t,wt(o))throw o;try{a.options.onError?.(o)}catch(t){if(o=t,wt(t))throw t}e[t]=r={...r,error:o,status:"error",updatedAt:Date.now(),abortController:new AbortController}};try{r.paramsError&&c(r.paramsError,"PARSE_PARAMS"),r.searchError&&c(r.searchError,"VALIDATE_SEARCH");const n=s?.context??this.options.context??{},l=a.options.pendingMs??this.options.defaultPendingMs,u="number"==typeof l&&l<=0?Promise.resolve():new Promise((t=>setTimeout(t,l))),h=await(a.options.beforeLoad?.({search:r.search,abortController:i,params:r.params,preload:!!o,context:n,location:this.state.location,navigate:t=>this.navigate({...t,from:r.pathname}),buildLocation:this.buildLocation,cause:o?"preload":r.cause}))??{};if(wt(h))throw h;const d={...n,...h};e[t]=r={...r,routeContext:D(r.routeContext,h),context:D(r.context,d),abortController:i,pendingPromise:u}}catch(t){c(t,"BEFORE_LOAD");break}}}catch(t){if(wt(t))return o||this.navigate(t),e;throw t}const a=e.slice(0,n),i=[];return a.forEach(((n,a)=>{i.push(new Promise((async c=>{const l=i[a-1],u=this.looseRoutesById[n.routeId],h=t=>!!wt(t)&&(o||this.navigate(t),!0);let d;e[a]=n={...n,showPending:!1};let f=!1;const p=u.options.pendingMs??this.options.defaultPendingMs,m=u.options.pendingMinMs??this.options.defaultPendingMinMs,y=!o&&"number"==typeof p&&(u.options.pendingComponent??this.options.defaultPendingComponent),g={params:n.params,deps:n.loaderDeps,preload:!!o,parentMatchPromise:l,abortController:n.abortController,context:n.context,location:this.state.location,navigate:t=>this.navigate({...t,from:n.pathname}),cause:o?"preload":n.cause},v=async()=>{if(n.isFetching)d=ut(this.state,n.id)?.loadPromise;else{n.fetchCount&&"success"===n.status&&c(),e[a]=n={...n,isFetching:!0,fetchCount:n.fetchCount+1};const t=Promise.all(Et.map((async t=>{const e=u.options[t];e?.preload&&await e.preload()}))),o=u.options.loader?.(g);d=Promise.all([t,o]).then((t=>t[1]))}e[a]=n={...n,loadPromise:d},s(n);try{const o=await d;if(r=t())return await r;if(wt(o)&&h(o))return;if(f&&m&&await new Promise((t=>setTimeout(t,m))),r=t())return await r;e[a]=n={...n,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:o,loadPromise:void 0}}catch(o){if(r=t())return await r;if(h(o))return;try{u.options.onError?.(o)}catch(t){if(o=t,h(t))return}e[a]=n={...n,error:o,status:"error",isFetching:!1}}s(n)},_=Date.now()-n.updatedAt;let b,S=o?u.options.preloadStaleTime??this.options.defaultPreloadStaleTime??3e4:u.options.staleTime??this.options.defaultStaleTime??0;const w=u.options.shouldReload;b="function"==typeof w?w(g):w,e[a]=n={...n,preload:!!o&&!this.state.matches.find((t=>t.id===n.id))},"success"!==n.status?(y&&n.pendingPromise?.then((async()=>{if(r=t())return r;f=!0,e[a]=n={...n,showPending:!0},s(n),c()})),await v()):(n.invalid||(b??_>S))&&v(),c()})))})),await Promise.all(i),e};invalidate=()=>{const t=t=>({...t,invalid:!0});this.__store.setState((e=>({...e,matches:e.matches.map(t),cachedMatches:e.cachedMatches.map(t),pendingMatches:e.pendingMatches?.map(t)}))),this.load()};load=async()=>{const t=new Promise((async(e,o)=>{const r=this.latestLocation,n=this.state.resolvedLocation,s=n.href!==r.href;let a,i;this.cancelMatches(),this.emit({type:"onBeforeLoad",fromLocation:n,toLocation:r,pathChanged:s});const c=this.state.matches;this.__store.batch((()=>{this.cleanCache(),i=this.matchRoutes(r.pathname,r.search,{debug:!0}),this.__store.setState((t=>({...t,isLoading:!0,location:r,pendingMatches:i,cachedMatches:t.cachedMatches.filter((t=>!i.find((e=>e.id===t.id))))})))}));try{try{await this.loadMatches({matches:i,checkLatest:()=>this.checkLatest(t)})}catch(t){}if(a=this.checkLatest(t))return a;const o=c.filter((t=>!i.find((e=>e.id===t.id)))),l=i.filter((t=>!c.find((e=>e.id===t.id)))),u=c.filter((t=>i.find((e=>e.id===t.id))));this.__store.batch((()=>{this.__store.setState((t=>({...t,isLoading:!1,matches:t.pendingMatches,pendingMatches:void 0,cachedMatches:[...t.cachedMatches,...o.filter((t=>"error"!==t.status))]}))),this.cleanCache()})),[[o,"onLeave"],[l,"onEnter"],[u,"onStay"]].forEach((([t,e])=>{t.forEach((t=>{this.looseRoutesById[t.routeId].options[e]?.(t)}))})),this.emit({type:"onLoad",fromLocation:n,toLocation:r,pathChanged:s}),e()}catch(e){if(a=this.checkLatest(t))return a;o(e)}}));return this.latestLoadPromise=t,this.latestLoadPromise};cleanCache=()=>{this.__store.setState((t=>({...t,cachedMatches:t.cachedMatches.filter((t=>{const e=this.looseRoutesById[t.routeId];if(!e.options.loader)return!1;const o=(t.preload?e.options.preloadGcTime??this.options.defaultPreloadGcTime:e.options.gcTime??this.options.defaultGcTime)??3e5;return"error"!==t.status&&Date.now()-t.updatedAt<o}))})))};preloadRoute=async(t=this.state.location)=>{let e=this.buildLocation(t),o=this.matchRoutes(e.pathname,e.search,{throwOnError:!0});const r=Object.fromEntries([...this.state.matches,...this.state.pendingMatches??[],...this.state.cachedMatches]?.map((t=>[t.id,!0])));return this.__store.batch((()=>{o.forEach((t=>{r[t.id]||this.__store.setState((e=>({...e,cachedMatches:[...e.cachedMatches,t]})))}))})),o=await this.loadMatches({matches:o,preload:!0,checkLatest:()=>{}}),o};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0};const o=this.buildLocation(t);if(e?.pending&&"pending"!==this.state.status)return!1;const r=e?.pending?this.latestLocation:this.state.resolvedLocation;if(!r)return!1;const n=_t(this.basepath,r.pathname,{...e,to:o.pathname});return!!n&&(n&&(e?.includeSearch??1)?!!A(r.search,o.search,!0)&&n:n)};injectHtml=async t=>{this.injectedHtml.push(t)};dehydrateData=(t,e)=>{if("undefined"==typeof document){const o="string"==typeof t?t:JSON.stringify(t);return this.injectHtml((async()=>{const t=`__TSR_DEHYDRATED__${o}`,r="function"==typeof e?await e():e;return`<script id='${t}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${z(o)}"] = ${JSON.stringify(r)}\n ;(() => {\n var el = document.getElementById('${t}')\n el.parentElement.removeChild(el)\n })()\n <\/script>`})),()=>this.hydrateData(t)}return()=>{}};hydrateData=t=>{if("undefined"!=typeof document){const e="string"==typeof t?t:JSON.stringify(t);return window[`__TSR_DEHYDRATED__${e}`]}};dehydrate=()=>{const t=this.options.errorSerializer?.serialize??xt;return{state:{dehydratedMatches:this.state.matches.map((e=>({...I(e,["id","status","updatedAt","loaderData"]),error:e.error?{data:t(e.error),__isServerError:!0}:void 0})))}}};hydrate=async t=>{let e=t;"undefined"!=typeof document&&(e=window.__TSR_DEHYDRATED__),g(e);const o=e;this.dehydratedData=o.payload,this.options.hydrate?.(o.payload);const r=o.router.state;let n=this.matchRoutes(this.state.location.pathname,this.state.location.search).map((t=>{const e=r.dehydratedMatches.find((e=>e.id===t.id));return g(e,t.id),e?{...t,...e}:t}));this.__store.setState((t=>({...t,matches:n})))}},t.RouterProvider=function({router:e,...o}){e.update({...e.options,...o,context:{...e.options.context,...o?.context}});const r=e.options.InnerWrap?n.createElement(e.options.InnerWrap,null,n.createElement(F,null)):n.createElement(F,null),s=n.createElement(t.routerContext.Provider,{value:e},r,n.createElement(lt,null));return e.options.Wrap?n.createElement(e.options.Wrap,null,s):s},t.ScrollRestoration=function(t){return Ut(t),null},t.SearchParamError=Rt,t.cleanPath=dt,t.componentTypes=Et,t.createBrowserHistory=d,t.createHashHistory=function(t){const e=t?.window??("undefined"!=typeof document?window:void 0);return d({window:e,parseLocation:()=>p(e.location.hash.split("#").slice(1).join("#")??"/",e.history.state),createHref:t=>`${e.location.pathname}${e.location.search}#${t}`})},t.createHistory=u,t.createMemoryHistory=f,t.createRouteMask=function(t){return t},t.decode=rt,t.deepEqual=A,t.defaultDeserializeError=tt,t.defaultParseSearch=nt,t.defaultSerializeError=xt,t.defaultStringifySearch=st,t.defer=function(t,e){const o=t;if(!o.__deferredState){o.__deferredState={uid:Math.random().toString(36).slice(2),status:"pending"};const t=o.__deferredState;o.then((e=>{t.status="success",t.data=e})).catch((o=>{t.status="error",t.error={data:(e?.serializeError??xt)(o),__isServerError:!0}}))}return o},t.encode=et,t.escapeJSON=z,t.functionalUpdate=k,t.getInitialRouterState=Pt,t.getRenderedMatches=X,t.getRouteMatch=ut,t.interpolatePath=vt,t.invariant=g,t.isDehydratedDeferred=Ct,t.isPlainArray=B,t.isPlainObject=j,t.isRedirect=wt,t.isServer=M,t.isServerSideError=Z,t.joinPaths=ht,t.last=O,t.lazyFn=function(t,e){return async(...o)=>(await t())[e||"default"](...o)},t.lazyRouteComponent=function(t,e){let o;const r=()=>(o||(o=t()),o),s=n.lazy((async()=>({default:(await r())[e??"default"]})));return s.preload=r,s},t.matchByPath=St,t.matchContext=H,t.matchPathname=_t,t.parsePathname=gt,t.parseSearchWith=at,t.pick=I,t.redirect=function(t){if(t.isRedirect=!0,t.throw)throw t;return t},t.removeBasepath=bt,t.replaceEqualDeep=D,t.resolvePath=yt,t.rootRouteId=kt,t.rootRouteWithContext=function(){return t=>new Dt(t)},t.shallow=function(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const o=Object.keys(t);if(o.length!==Object.keys(e).length)return!1;for(let r=0;r<o.length;r++)if(!Object.prototype.hasOwnProperty.call(e,o[r])||!Object.is(t[o[r]],e[o[r]]))return!1;return!0},t.stringifySearchWith=it,t.trimPath=mt,t.trimPathLeft=ft,t.trimPathRight=pt,t.useAwaited=Tt,t.useBlocker=Jt,t.useElementScrollRestoration=function(t){const e=C(),o=t?.getKey||Wt;let r="";if(t.id)r=`[data-scroll-restoration-id="${t.id}"]`;else{const e=t.getElement?.();if(!e)return;r=Yt(e)}const n=[o(e.latestLocation),r].join(Ht);return Kt.state.cached[n]},t.useLayoutEffect=N,t.useLinkProps=Bt,t.useLoaderData=Q,t.useLoaderDeps=G,t.useMatch=q,t.useMatchRoute=J,t.useMatches=V,t.useNavigate=function(t){const{navigate:e}=C(),o=q({strict:!1,select:t=>t.pathname});return n.useCallback((({from:t,...r})=>e({from:r?.to?o:void 0,...r})),[])},t.useParams=Mt,t.useParentMatches=function(t){const e=n.useContext(H);return V({select:o=>(o=o.slice(o.findIndex((t=>t.id===e))),t?.select?t.select(o):o)})},t.useRouteContext=function(t){return q({...t,select:e=>t?.select?t.select(e.context):e.context})},t.useRouter=C,t.useRouterState=T,t.useScrollRestoration=Ut,t.useSearch=Ot,t.useStableCallback=function(t){const e=n.useRef(t);return e.current=t,n.useRef(((...t)=>e.current(...t))).current},t.warning=v}));
|
|
22
22
|
//# sourceMappingURL=index.production.js.map
|