@tanstack/react-router 1.5.0 → 1.5.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/awaited.js +1 -1
- package/build/cjs/awaited.js.map +1 -1
- package/build/cjs/router.js.map +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +353 -353
- package/build/umd/index.development.js +1 -1
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/awaited.tsx +1 -1
- package/src/router.ts +4 -3
|
@@ -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){}var b,w={exports:{}},_={};w.exports=function(){if(b)return _;b=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 _.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},_}();var S=w.exports,R=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 E(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 L(t){const e=t.errorComponent??x;return r.createElement(P,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:o})=>o?r.createElement(e,{error:o}):t.children})}class P 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 x({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)}const C="undefined"==typeof document;function T(t){return t[t.length-1]}function M(t,e){return"function"==typeof t?t(e):t}function O(t,e){return e.reduce(((e,o)=>(e[o]=t[o],e)),{})}function k(t,e){if(t===e)return t;const o=e,n=j(t)&&j(o);if(n||I(t)&&I(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]=k(t[a],o[a]),i[a]===t[a]&&void 0!==t[a]&&c++)}return r===a&&c===r?t:i}return o}function I(t){if(!D(t))return!1;const e=t.constructor;if(void 0===e)return!0;const o=e.prototype;return!!D(o)&&!!o.hasOwnProperty("isPrototypeOf")}function D(t){return"[object Object]"===Object.prototype.toString.call(t)}function j(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function $(t,e,o=!1){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(I(t)&&I(e)){const n=Object.keys(t),r=Object.keys(e);return!(!o&&n.length!==r.length)&&!r.some((n=>!(n in t)||!$(t[n],e[n],o)))}return!(!Array.isArray(t)||!Array.isArray(e))&&!t.some(((t,n)=>!$(t,e[n],o)))}const B="undefined"!=typeof window?r.useLayoutEffect:r.useEffect;function A(t){return t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}const N=r.createContext(void 0);function H(){const t=et(),e=tt({select:t=>Y(t)[0]?.id});return r.createElement(N.Provider,{value:e},r.createElement(L,{getResetKey:()=>t.state.resolvedLocation.state?.key,errorComponent:x,onCatch:()=>{}},e?r.createElement(K,{matchId:e}):null))}function F(t){return r.createElement(r.Fragment,null,t.children)}function K({matchId:t}){const e=et(),o=tt({select:e=>Y(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??x,c=n.options.wrapInSuspense??s??n.options.component?.preload??n.options.pendingComponent?.preload??n.options.errorComponent?.preload?r.Suspense:F,l=i?L:F;return r.createElement(N.Provider,{value:t},r.createElement(c,{fallback:a},r.createElement(l,{getResetKey:()=>e.state.resolvedLocation.state?.key,errorComponent:i,onCatch:()=>{}},r.createElement(W,{matchId:t,pendingElement:a}))))}function W({matchId:t,pendingElement:e}){const o=et(),n=tt({select:e=>Y(e).find((e=>e.id===t))?.routeId}),s=o.routesById[n],a=tt({select:e=>O(Y(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(z,null)}g(!1)}const z=r.memo((function(){const t=r.useContext(N),e=tt({select:e=>{const o=Y(e),n=o.findIndex((e=>e.id===t));return o[n+1]?.id}});return e?r.createElement(K,{matchId:e}):null}));function U(){tt({select:t=>[t.location,t.resolvedLocation]});const{matchRoute:t}=et();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 Y(t){return t.pendingMatches?.some((t=>t.showPending))?t.pendingMatches:t.matches}function J(t){const e=et(),o=r.useContext(N),n=Y(e.state).find((t=>t.id===o))?.routeId,s=(()=>{const n=Y(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 tt({select:e=>{const n=Y(e).find((t=>t.id===o));return g(n,t?.from&&t.from),t?.select?t.select(n):n}})}function X(t){return tt({select:e=>{let o=Y(e);return t?.select?t.select(o):o}})}function q(t){return J({...t,select:e=>"function"==typeof t.select?t.select(e?.loaderDeps):e?.loaderDeps})}function V(t){return J({...t,select:e=>"function"==typeof t.select?t.select(e?.loaderData):e?.loaderData})}const G=r.useTransition||(()=>[!1,t=>{t()}]);function Q(){const t=r.useRef(0),e=et(),o=tt({select:t=>O(t,["isLoading","location","resolvedLocation","isTransitioning"])}),[n,s]=G();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 B((()=>{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]),B((()=>{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]),B((()=>{window.__TSR_DEHYDRATED__||t.current||(t.current++,a())}),[]),null}function Z(t,e){return[...t.cachedMatches,...t.pendingMatches??[],...t.matches].find((t=>t.id===e))}function tt(t){const e=et({warn:void 0===t?.router});return function(t,e=(t=>t)){return S.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,E)}((t?.router||e).__store,t?.select)}function et(e){const o="undefined"!=typeof document&&window.__TSR_ROUTER_CONTEXT__||t.routerContext,n=r.useContext(o);return n}function ot(t){return"object"==typeof t&&null!==t&&!(t instanceof Promise)&&!t.then&&"__deferredState"in t}function nt({promise:t}){const e=et();let o=t.__deferredState;const n=`__TSR__DEFERRED__${o.uid}`;if(ot(t)&&(o=e.hydrateData(n),(t=Promise.resolve(o.data)).__deferredState=o),"pending"===o.status)throw new Promise((t=>setTimeout(t,1))).then((()=>t));if("error"===o.status)throw o.error;return e.dehydrateData(n,o),[o.data]}function rt(t){return st(t.filter(Boolean).join("/"))}function st(t){return t.replace(/\/{2,}/g,"/")}function at(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function it(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function ct(t){return it(at(t))}function lt(t,e,o){e=e.replace(new RegExp(`^${t}`),"/"),o=o.replace(new RegExp(`^${t}`),"/");let n=ut(e);const r=ut(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&&"/"===T(n)?.value&&n.pop(),n.pop();else{if("."===t.value)return;n.push(t)}}));return st(rt([t,...n.map((t=>t.value))]))}function ut(t){if(!t)return[];const e=[];if("/"===(t=st(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 ht(t,e,o=!1){return rt(ut(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 dt(t,e,o){const n=pt(t,e,o);if(!o.to||n)return n??{}}function ft(t,e){return"/"!=t?e.substring(t.length):e}function pt(t,e,o){e=ft(t,e);const n=`${o.to??"$"}`,r=ut(e),s=ut(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=rt(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["**"]=rt(r.slice(t+1).map((t=>t.value))),!!o.fuzzy&&"/"!==n?.value}return!0})()?a:void 0}function mt(t){return tt({select:e=>{const o=T(Y(e))?.params;return t?.select?t.select(o):o}})}function yt(t){return J({...t,select:e=>t?.select?t.select(e.search):e.search})}t.routerContext=r.createContext(null),"undefined"!=typeof document&&(window.__TSR_ROUTER_CONTEXT__?t.routerContext=window.__TSR_ROUTER_CONTEXT__:window.__TSR_ROUTER_CONTEXT__=t.routerContext);const gt="__root__";class vt{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=gt:g(this.parentRoute);let n=o?gt:e.path;n&&"/"!==n&&(n=ct(n));const r=e?.id||n;let s=o?gt:rt([this.parentRoute.id===gt?"":this.parentRoute.id,r]);n===gt&&(n="/"),s!==gt&&(s=rt(["/",s]));const a=s===gt?"/":rt([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=>J({...t,from:this.id});useRouteContext=t=>J({...t,from:this.id,select:e=>t?.select?t.select(e.context):e.context});useSearch=t=>yt({...t,from:this.id});useParams=t=>mt({...t,from:this.id});useLoaderDeps=t=>q({...t,from:this.id});useLoaderData=t=>V({...t,from:this.id})}class bt extends vt{constructor(t){super(t)}}function wt(){return wt=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},wt.apply(this,arguments)}const _t="Error preloading route! ☝️";function St(t){const e=et(),o=J({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:b,style:w,className:_,onClick:S,onFocus:R,onMouseEnter:E,onMouseLeave:L,onTouchStart:P,...x}=t,C={from:t.to?o:void 0,...t};let T="internal";try{new URL(`${d}`),T="external"}catch{}if("external"===T)return{href:d};const O=e.buildLocation(C),k=m??e.options.defaultPreload,I=y??e.options.defaultPreloadDelay??0,D=tt({select:t=>{const e=t.location.pathname.split("/"),o=O.pathname.split("/").every(((t,o)=>t===e[o])),n=i?.exact?t.location.pathname===O.pathname:o,r=!i?.includeHash||t.location.hash===O.hash,s=!(i?.includeSearch??1)||$(t.location.search,O.search,!i?.exact);return n&&r&&s}}),j=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},B=D?M(s,{})??{}:{},A=D?{}:M(a,{})??{};return{...B,...A,...x,href:c?void 0:O.maskedLocation?O.maskedLocation.href:O.href,onClick:j([S,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({...O,replace:g,resetScroll:b,startTransition:v}))}]),onFocus:j([R,t=>{k&&e.preloadRoute(C).catch((t=>{console.warn(t),console.warn(_t)}))}]),onMouseEnter:j([E,t=>{const o=t.target||{};if(k){if(o.preloadTimeout)return;o.preloadTimeout=setTimeout((()=>{o.preloadTimeout=null,e.preloadRoute(C).catch((t=>{console.warn(t),console.warn(_t)}))}),I)}}]),onMouseLeave:j([L,t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)}]),onTouchStart:j([P,t=>{k&&e.preloadRoute(C).catch((t=>{console.warn(t),console.warn(_t)}))}]),target:r,style:{...w,...B.style,...A.style},className:[_,B.className,A.className].filter(Boolean).join(" ")||void 0,...c?{role:"link","aria-disabled":!0}:void 0,"data-status":D?"active":void 0}}const Rt=r.forwardRef(((t,e)=>{const o=St(t);return r.createElement("a",wt({ref:e},o,{children:"function"==typeof t.children?t.children({isActive:"active"===o["data-status"]}):t.children}))}));function Et(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 Lt(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||(0*+e==0&&+e+""===e?+e:e))}function Pt(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],Lt(e.shift())):n[o]=Lt(e.shift());return n}function xt(t){return!!t?.isRedirect}const Ct=Mt(JSON.parse),Tt=Ot(JSON.stringify,JSON.parse);function Mt(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let o=Pt(e);for(let e in o){const n=o[e];if("string"==typeof n)try{o[e]=t(n)}catch(t){}}return o}}function Ot(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=Et(o).toString();return n?`?${n}`:""}}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=M(e,Ht.state),window.sessionStorage.setItem(t,JSON.stringify(Ht.state))}}})():void 0;const Ft=t=>t.state.key;function Kt(t){const e=et();$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}=et();r.useEffect((()=>{if(e)return o.block(t)}))}t.Await=function(t){const e=nt(t);return t.children(...e)},t.Block=function({blocker:t,condition:e,children:o}){return zt(t,e),o??null},t.CatchBoundary=L,t.CatchBoundaryImpl=P,t.ErrorComponent=x,t.FileRoute=class{constructor(t){this.path=t}createRoute=t=>{const e=new vt(t);return e.isRoot=!1,e}},t.FileRouteLoader=function(t){return t=>t},t.Link=Rt,t.Match=K,t.MatchRoute=function(t){const e=U()(t);return"function"==typeof t.children?t.children(e):e?t.children:null},t.Matches=H,t.Navigate=function(t){const{navigate:e}=et(),o=J({strict:!1});return r.useEffect((()=>{e({from:t.to?o.pathname:void 0,...t})}),[]),null},t.NotFoundRoute=class extends vt{constructor(t){super({...t,id:"404"})}},t.Outlet=z,t.PathParamError=Dt,t.RootRoute=bt,t.Route=vt,t.RouteApi=class{constructor({id:t}){this.id=t}useMatch=t=>J({select:t?.select,from:this.id});useRouteContext=t=>J({from:this.id,select:e=>t?.select?t.select(e.context):e.context});useSearch=t=>yt({...t,from:this.id});useParams=t=>mt({...t,from:this.id});useLoaderDeps=t=>q({...t,from:this.id});useLoaderData=t=>V({...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??Tt,parseSearch:t?.parseSearch??Ct})}startReactTransition=t=>t();update=t=>{const e=this.options;this.options={...this.options,...t},(!this.basepath||t.basepath&&t.basepath!==e.basepath)&&(this.basepath=`/${ct(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 R(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=it(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=at(t.fullPath),r=ut(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:k(t?.search,s),hash:n.split("#").reverse()[0]??"",href:`${e}${o}${n}`,state:k(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)=>lt(this.basepath,t,st(e));get looseRoutesById(){return this.routesById}matchRoutes=(t,e,o)=>{let n={},r=this.flatRoutes.find((e=>{const o=dt(this.basepath,it(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["**"]:it(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=ht(t.fullPath,n),f=ht(t.id,n,!0)+h,p=Z(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:rt([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=k(g.search,a),g.searchError=l,c.push(g)})),c};cancelMatch=t=>{Z(this.state,t)?.abortController?.abort()};cancelMatches=()=>{this.state.pendingMatches?.forEach((t=>{this.cancelMatch(t.id)}))};buildLocation=t=>{const e=(t={},e)=>{const o=this.latestLocation,n=(this.state.pendingMatches||this.state.matches).reverse()[0]?.search||o.search;let r=this.resolvePathWithBase(o.pathname,`${t.to??""}`);const s=this.matchRoutes(o.pathname,n),a=e?.filter((t=>s?.find((e=>e.routeId===t.routeId)))),i={...T(s)?.params};let c=!0===(t.params??!0)?i:M(t.params,i);c&&e?.map((t=>this.looseRoutesById[t.routeId].options.stringifyParams)).filter(Boolean).forEach((t=>{c={...c,...t(c)}})),r=ht(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?M(t.search,h)??{}:l?.length?h:{},f=k(n,u?.length?u.reduce(((t,e)=>e(t)),d):d),p=this.options.stringifySearch(f),m=!0===t.hash?o.hash:t.hash?M(t.hash,o.hash):void 0,y=m?`#${m}`:"";let g=!0===t.state?o.state:t.state?M(t.state,o.state):o.state;return g=k(o.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=dt(this.basepath,r.pathname,{to:t.from,caseSensitive:!1,fuzzy:!1});return!!e&&(o=e,!0)}));a&&(n={...O(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,{...O(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,xt(o))throw o;try{a.options.onError?.(o)}catch(t){if(o=t,xt(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(xt(h))throw h;const d={...r,...h};e[t]=n={...n,routeContext:k(n.routeContext,h),context:k(n.context,d),abortController:i,pendingPromise:u}}catch(t){c(t,"BEFORE_LOAD");break}}}catch(t){if(xt(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=>!!xt(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=Z(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(xt(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=dt(this.basepath,n.pathname,{...e,to:o.pathname});return!!r&&(r&&(e?.includeSearch??1)?!!$(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__${A(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=>O(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(H,null)):r.createElement(H,null),s=r.createElement(t.routerContext.Provider,{value:e},n,r.createElement(Q,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=st,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=Pt,t.deepEqual=$,t.defaultParseSearch=Ct,t.defaultStringifySearch=Tt,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=Et,t.escapeJSON=A,t.functionalUpdate=M,t.getInitialRouterState=jt,t.getRenderedMatches=Y,t.getRouteMatch=Z,t.interpolatePath=ht,t.invariant=g,t.isDehydratedDeferred=ot,t.isPlainArray=j,t.isPlainObject=I,t.isRedirect=xt,t.isServer=C,t.joinPaths=rt,t.last=T,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=pt,t.matchContext=N,t.matchPathname=dt,t.parsePathname=ut,t.parseSearchWith=Mt,t.pick=O,t.redirect=function(t){if(t.isRedirect=!0,t.throw)throw t;return t},t.removeBasepath=ft,t.replaceEqualDeep=k,t.resolvePath=lt,t.rootRouteId=gt,t.rootRouteWithContext=function(){return t=>new bt(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=Ot,t.trimPath=ct,t.trimPathLeft=at,t.trimPathRight=it,t.useAwaited=nt,t.useBlocker=zt,t.useElementScrollRestoration=function(t){const e=et(),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=B,t.useLinkProps=St,t.useLoaderData=V,t.useLoaderDeps=q,t.useMatch=J,t.useMatchRoute=U,t.useMatches=X,t.useNavigate=function(t){const{navigate:e}=et(),o=J({strict:!1,select:t=>t.pathname});return r.useCallback((({from:t,...n})=>e({from:n?.to?o:void 0,...n})),[])},t.useParams=mt,t.useParentMatches=function(t){const e=r.useContext(N);return X({select:o=>(o=o.slice(o.findIndex((t=>t.id===e))),t?.select?t.select(o):o)})},t.useRouteContext=function(t){return J({...t,select:e=>t?.select?t.select(e.context):e.context})},t.useRouter=et,t.useRouterState=tt,t.useScrollRestoration=Kt,t.useSearch=yt,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,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){}var b,w={exports:{}},_={};w.exports=function(){if(b)return _;b=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 _.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},_}();var S=w.exports,R=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 E(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 L(t){const e=t.errorComponent??x;return r.createElement(P,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:o})=>o?r.createElement(e,{error:o}):t.children})}class P 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 x({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)}const C="undefined"==typeof document;function T(t){return t[t.length-1]}function M(t,e){return"function"==typeof t?t(e):t}function O(t,e){return e.reduce(((e,o)=>(e[o]=t[o],e)),{})}function k(t,e){if(t===e)return t;const o=e,n=j(t)&&j(o);if(n||I(t)&&I(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]=k(t[a],o[a]),i[a]===t[a]&&void 0!==t[a]&&c++)}return r===a&&c===r?t:i}return o}function I(t){if(!D(t))return!1;const e=t.constructor;if(void 0===e)return!0;const o=e.prototype;return!!D(o)&&!!o.hasOwnProperty("isPrototypeOf")}function D(t){return"[object Object]"===Object.prototype.toString.call(t)}function j(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function $(t,e,o=!1){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(I(t)&&I(e)){const n=Object.keys(t),r=Object.keys(e);return!(!o&&n.length!==r.length)&&!r.some((n=>!(n in t)||!$(t[n],e[n],o)))}return!(!Array.isArray(t)||!Array.isArray(e))&&!t.some(((t,n)=>!$(t,e[n],o)))}const B="undefined"!=typeof window?r.useLayoutEffect:r.useEffect;function A(t){return t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}const N=r.createContext(void 0);function H(){const t=et(),e=tt({select:t=>Y(t)[0]?.id});return r.createElement(N.Provider,{value:e},r.createElement(L,{getResetKey:()=>t.state.resolvedLocation.state?.key,errorComponent:x,onCatch:()=>{}},e?r.createElement(K,{matchId:e}):null))}function F(t){return r.createElement(r.Fragment,null,t.children)}function K({matchId:t}){const e=et(),o=tt({select:e=>Y(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??x,c=n.options.wrapInSuspense??s??n.options.component?.preload??n.options.pendingComponent?.preload??n.options.errorComponent?.preload?r.Suspense:F,l=i?L:F;return r.createElement(N.Provider,{value:t},r.createElement(c,{fallback:a},r.createElement(l,{getResetKey:()=>e.state.resolvedLocation.state?.key,errorComponent:i,onCatch:()=>{}},r.createElement(W,{matchId:t,pendingElement:a}))))}function W({matchId:t,pendingElement:e}){const o=et(),n=tt({select:e=>Y(e).find((e=>e.id===t))?.routeId}),s=o.routesById[n],a=tt({select:e=>O(Y(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(z,null)}g(!1)}const z=r.memo((function(){const t=r.useContext(N),e=tt({select:e=>{const o=Y(e),n=o.findIndex((e=>e.id===t));return o[n+1]?.id}});return e?r.createElement(K,{matchId:e}):null}));function U(){tt({select:t=>[t.location,t.resolvedLocation]});const{matchRoute:t}=et();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 Y(t){return t.pendingMatches?.some((t=>t.showPending))?t.pendingMatches:t.matches}function J(t){const e=et(),o=r.useContext(N),n=Y(e.state).find((t=>t.id===o))?.routeId,s=(()=>{const n=Y(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 tt({select:e=>{const n=Y(e).find((t=>t.id===o));return g(n,t?.from&&t.from),t?.select?t.select(n):n}})}function X(t){return tt({select:e=>{let o=Y(e);return t?.select?t.select(o):o}})}function q(t){return J({...t,select:e=>"function"==typeof t.select?t.select(e?.loaderDeps):e?.loaderDeps})}function V(t){return J({...t,select:e=>"function"==typeof t.select?t.select(e?.loaderData):e?.loaderData})}const G=r.useTransition||(()=>[!1,t=>{t()}]);function Q(){const t=r.useRef(0),e=et(),o=tt({select:t=>O(t,["isLoading","location","resolvedLocation","isTransitioning"])}),[n,s]=G();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 B((()=>{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]),B((()=>{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]),B((()=>{window.__TSR_DEHYDRATED__||t.current||(t.current++,a())}),[]),null}function Z(t,e){return[...t.cachedMatches,...t.pendingMatches??[],...t.matches].find((t=>t.id===e))}function tt(t){const e=et({warn:void 0===t?.router});return function(t,e=(t=>t)){return S.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,E)}((t?.router||e).__store,t?.select)}function et(e){const o="undefined"!=typeof document&&window.__TSR_ROUTER_CONTEXT__||t.routerContext,n=r.useContext(o);return n}function ot(t){return"object"==typeof t&&null!==t&&!(t instanceof Promise)&&!t.then&&"__deferredState"in t}function nt({promise:t}){const e=et();let o=t.__deferredState;const n=`__TSR__DEFERRED__${o.uid}`;if(ot(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 rt(t){return st(t.filter(Boolean).join("/"))}function st(t){return t.replace(/\/{2,}/g,"/")}function at(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function it(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function ct(t){return it(at(t))}function lt(t,e,o){e=e.replace(new RegExp(`^${t}`),"/"),o=o.replace(new RegExp(`^${t}`),"/");let n=ut(e);const r=ut(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&&"/"===T(n)?.value&&n.pop(),n.pop();else{if("."===t.value)return;n.push(t)}}));return st(rt([t,...n.map((t=>t.value))]))}function ut(t){if(!t)return[];const e=[];if("/"===(t=st(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 ht(t,e,o=!1){return rt(ut(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 dt(t,e,o){const n=pt(t,e,o);if(!o.to||n)return n??{}}function ft(t,e){return"/"!=t?e.substring(t.length):e}function pt(t,e,o){e=ft(t,e);const n=`${o.to??"$"}`,r=ut(e),s=ut(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=rt(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["**"]=rt(r.slice(t+1).map((t=>t.value))),!!o.fuzzy&&"/"!==n?.value}return!0})()?a:void 0}function mt(t){return tt({select:e=>{const o=T(Y(e))?.params;return t?.select?t.select(o):o}})}function yt(t){return J({...t,select:e=>t?.select?t.select(e.search):e.search})}t.routerContext=r.createContext(null),"undefined"!=typeof document&&(window.__TSR_ROUTER_CONTEXT__?t.routerContext=window.__TSR_ROUTER_CONTEXT__:window.__TSR_ROUTER_CONTEXT__=t.routerContext);const gt="__root__";class vt{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=gt:g(this.parentRoute);let n=o?gt:e.path;n&&"/"!==n&&(n=ct(n));const r=e?.id||n;let s=o?gt:rt([this.parentRoute.id===gt?"":this.parentRoute.id,r]);n===gt&&(n="/"),s!==gt&&(s=rt(["/",s]));const a=s===gt?"/":rt([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=>J({...t,from:this.id});useRouteContext=t=>J({...t,from:this.id,select:e=>t?.select?t.select(e.context):e.context});useSearch=t=>yt({...t,from:this.id});useParams=t=>mt({...t,from:this.id});useLoaderDeps=t=>q({...t,from:this.id});useLoaderData=t=>V({...t,from:this.id})}class bt extends vt{constructor(t){super(t)}}function wt(){return wt=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},wt.apply(this,arguments)}const _t="Error preloading route! ☝️";function St(t){const e=et(),o=J({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:b,style:w,className:_,onClick:S,onFocus:R,onMouseEnter:E,onMouseLeave:L,onTouchStart:P,...x}=t,C={from:t.to?o:void 0,...t};let T="internal";try{new URL(`${d}`),T="external"}catch{}if("external"===T)return{href:d};const O=e.buildLocation(C),k=m??e.options.defaultPreload,I=y??e.options.defaultPreloadDelay??0,D=tt({select:t=>{const e=t.location.pathname.split("/"),o=O.pathname.split("/").every(((t,o)=>t===e[o])),n=i?.exact?t.location.pathname===O.pathname:o,r=!i?.includeHash||t.location.hash===O.hash,s=!(i?.includeSearch??1)||$(t.location.search,O.search,!i?.exact);return n&&r&&s}}),j=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},B=D?M(s,{})??{}:{},A=D?{}:M(a,{})??{};return{...B,...A,...x,href:c?void 0:O.maskedLocation?O.maskedLocation.href:O.href,onClick:j([S,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({...O,replace:g,resetScroll:b,startTransition:v}))}]),onFocus:j([R,t=>{k&&e.preloadRoute(C).catch((t=>{console.warn(t),console.warn(_t)}))}]),onMouseEnter:j([E,t=>{const o=t.target||{};if(k){if(o.preloadTimeout)return;o.preloadTimeout=setTimeout((()=>{o.preloadTimeout=null,e.preloadRoute(C).catch((t=>{console.warn(t),console.warn(_t)}))}),I)}}]),onMouseLeave:j([L,t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)}]),onTouchStart:j([P,t=>{k&&e.preloadRoute(C).catch((t=>{console.warn(t),console.warn(_t)}))}]),target:r,style:{...w,...B.style,...A.style},className:[_,B.className,A.className].filter(Boolean).join(" ")||void 0,...c?{role:"link","aria-disabled":!0}:void 0,"data-status":D?"active":void 0}}const Rt=r.forwardRef(((t,e)=>{const o=St(t);return r.createElement("a",wt({ref:e},o,{children:"function"==typeof t.children?t.children({isActive:"active"===o["data-status"]}):t.children}))}));function Et(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 Lt(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||(0*+e==0&&+e+""===e?+e:e))}function Pt(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],Lt(e.shift())):n[o]=Lt(e.shift());return n}function xt(t){return!!t?.isRedirect}const Ct=Mt(JSON.parse),Tt=Ot(JSON.stringify,JSON.parse);function Mt(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let o=Pt(e);for(let e in o){const n=o[e];if("string"==typeof n)try{o[e]=t(n)}catch(t){}}return o}}function Ot(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=Et(o).toString();return n?`?${n}`:""}}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=M(e,Ht.state),window.sessionStorage.setItem(t,JSON.stringify(Ht.state))}}})():void 0;const Ft=t=>t.state.key;function Kt(t){const e=et();$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}=et();r.useEffect((()=>{if(e)return o.block(t)}))}t.Await=function(t){const e=nt(t);return t.children(...e)},t.Block=function({blocker:t,condition:e,children:o}){return zt(t,e),o??null},t.CatchBoundary=L,t.CatchBoundaryImpl=P,t.ErrorComponent=x,t.FileRoute=class{constructor(t){this.path=t}createRoute=t=>{const e=new vt(t);return e.isRoot=!1,e}},t.FileRouteLoader=function(t){return t=>t},t.Link=Rt,t.Match=K,t.MatchRoute=function(t){const e=U()(t);return"function"==typeof t.children?t.children(e):e?t.children:null},t.Matches=H,t.Navigate=function(t){const{navigate:e}=et(),o=J({strict:!1});return r.useEffect((()=>{e({from:t.to?o.pathname:void 0,...t})}),[]),null},t.NotFoundRoute=class extends vt{constructor(t){super({...t,id:"404"})}},t.Outlet=z,t.PathParamError=Dt,t.RootRoute=bt,t.Route=vt,t.RouteApi=class{constructor({id:t}){this.id=t}useMatch=t=>J({select:t?.select,from:this.id});useRouteContext=t=>J({from:this.id,select:e=>t?.select?t.select(e.context):e.context});useSearch=t=>yt({...t,from:this.id});useParams=t=>mt({...t,from:this.id});useLoaderDeps=t=>q({...t,from:this.id});useLoaderData=t=>V({...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??Tt,parseSearch:t?.parseSearch??Ct})}startReactTransition=t=>t();update=t=>{const e=this.options;this.options={...this.options,...t},(!this.basepath||t.basepath&&t.basepath!==e.basepath)&&(this.basepath=`/${ct(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 R(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=it(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=at(t.fullPath),r=ut(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:k(t?.search,s),hash:n.split("#").reverse()[0]??"",href:`${e}${o}${n}`,state:k(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)=>lt(this.basepath,t,st(e));get looseRoutesById(){return this.routesById}matchRoutes=(t,e,o)=>{let n={},r=this.flatRoutes.find((e=>{const o=dt(this.basepath,it(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["**"]:it(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=ht(t.fullPath,n),f=ht(t.id,n,!0)+h,p=Z(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:rt([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=k(g.search,a),g.searchError=l,c.push(g)})),c};cancelMatch=t=>{Z(this.state,t)?.abortController?.abort()};cancelMatches=()=>{this.state.pendingMatches?.forEach((t=>{this.cancelMatch(t.id)}))};buildLocation=t=>{const e=(t={},e)=>{const o=this.latestLocation,n=(this.state.pendingMatches||this.state.matches).reverse()[0]?.search||o.search;let r=this.resolvePathWithBase(o.pathname,`${t.to??""}`);const s=this.matchRoutes(o.pathname,n),a=e?.filter((t=>s?.find((e=>e.routeId===t.routeId)))),i={...T(s)?.params};let c=!0===(t.params??!0)?i:M(t.params,i);c&&e?.map((t=>this.looseRoutesById[t.routeId].options.stringifyParams)).filter(Boolean).forEach((t=>{c={...c,...t(c)}})),r=ht(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?M(t.search,h)??{}:l?.length?h:{},f=k(n,u?.length?u.reduce(((t,e)=>e(t)),d):d),p=this.options.stringifySearch(f),m=!0===t.hash?o.hash:t.hash?M(t.hash,o.hash):void 0,y=m?`#${m}`:"";let g=!0===t.state?o.state:t.state?M(t.state,o.state):o.state;return g=k(o.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=dt(this.basepath,r.pathname,{to:t.from,caseSensitive:!1,fuzzy:!1});return!!e&&(o=e,!0)}));a&&(n={...O(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,{...O(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,xt(o))throw o;try{a.options.onError?.(o)}catch(t){if(o=t,xt(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(xt(h))throw h;const d={...r,...h};e[t]=n={...n,routeContext:k(n.routeContext,h),context:k(n.context,d),abortController:i,pendingPromise:u}}catch(t){c(t,"BEFORE_LOAD");break}}}catch(t){if(xt(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=>!!xt(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=Z(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(xt(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=dt(this.basepath,n.pathname,{...e,to:o.pathname});return!!r&&(r&&(e?.includeSearch??1)?!!$(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__${A(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=>O(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(H,null)):r.createElement(H,null),s=r.createElement(t.routerContext.Provider,{value:e},n,r.createElement(Q,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=st,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=Pt,t.deepEqual=$,t.defaultParseSearch=Ct,t.defaultStringifySearch=Tt,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=Et,t.escapeJSON=A,t.functionalUpdate=M,t.getInitialRouterState=jt,t.getRenderedMatches=Y,t.getRouteMatch=Z,t.interpolatePath=ht,t.invariant=g,t.isDehydratedDeferred=ot,t.isPlainArray=j,t.isPlainObject=I,t.isRedirect=xt,t.isServer=C,t.joinPaths=rt,t.last=T,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=pt,t.matchContext=N,t.matchPathname=dt,t.parsePathname=ut,t.parseSearchWith=Mt,t.pick=O,t.redirect=function(t){if(t.isRedirect=!0,t.throw)throw t;return t},t.removeBasepath=ft,t.replaceEqualDeep=k,t.resolvePath=lt,t.rootRouteId=gt,t.rootRouteWithContext=function(){return t=>new bt(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=Ot,t.trimPath=ct,t.trimPathLeft=at,t.trimPathRight=it,t.useAwaited=nt,t.useBlocker=zt,t.useElementScrollRestoration=function(t){const e=et(),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=B,t.useLinkProps=St,t.useLoaderData=V,t.useLoaderDeps=q,t.useMatch=J,t.useMatchRoute=U,t.useMatches=X,t.useNavigate=function(t){const{navigate:e}=et(),o=J({strict:!1,select:t=>t.pathname});return r.useCallback((({from:t,...n})=>e({from:n?.to?o:void 0,...n})),[])},t.useParams=mt,t.useParentMatches=function(t){const e=r.useContext(N);return X({select:o=>(o=o.slice(o.findIndex((t=>t.id===e))),t?.select?t.select(o):o)})},t.useRouteContext=function(t){return J({...t,select:e=>t?.select?t.select(e.context):e.context})},t.useRouter=et,t.useRouterState=tt,t.useScrollRestoration=Kt,t.useSearch=yt,t.useStableCallback=function(t){const e=r.useRef(t);return e.current=t,r.useRef(((...t)=>e.current(...t))).current},t.warning=v}));
|
|
22
22
|
//# sourceMappingURL=index.production.js.map
|