@tanstack/react-router 0.0.1-beta.9 → 1.0.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/LICENSE +21 -0
- package/build/cjs/CatchBoundary.js +128 -0
- package/build/cjs/CatchBoundary.js.map +1 -0
- package/build/cjs/Matches.js +233 -0
- package/build/cjs/Matches.js.map +1 -0
- package/build/cjs/RouterProvider.js +172 -0
- package/build/cjs/RouterProvider.js.map +1 -0
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +2 -22
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/build/cjs/awaited.js +43 -0
- package/build/cjs/awaited.js.map +1 -0
- package/build/cjs/defer.js +37 -0
- package/build/cjs/defer.js.map +1 -0
- package/build/cjs/fileRoute.js +27 -0
- package/build/cjs/fileRoute.js.map +1 -0
- package/build/cjs/index.js +130 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/lazyRouteComponent.js +54 -0
- package/build/cjs/lazyRouteComponent.js.map +1 -0
- package/build/cjs/link.js +223 -0
- package/build/cjs/link.js.map +1 -0
- package/build/cjs/path.js +214 -0
- package/build/cjs/path.js.map +1 -0
- package/build/cjs/qss.js +63 -0
- package/build/cjs/qss.js.map +1 -0
- package/build/cjs/redirects.js +28 -0
- package/build/cjs/redirects.js.map +1 -0
- package/build/cjs/route.js +191 -0
- package/build/cjs/route.js.map +1 -0
- package/build/cjs/router.js +1085 -0
- package/build/cjs/router.js.map +1 -0
- package/build/cjs/scroll-restoration.js +202 -0
- package/build/cjs/scroll-restoration.js.map +1 -0
- package/build/cjs/searchParams.js +81 -0
- package/build/cjs/searchParams.js.map +1 -0
- package/build/cjs/useBlocker.js +55 -0
- package/build/cjs/useBlocker.js.map +1 -0
- package/build/cjs/useNavigate.js +86 -0
- package/build/cjs/useNavigate.js.map +1 -0
- package/build/cjs/useParams.js +26 -0
- package/build/cjs/useParams.js.map +1 -0
- package/build/cjs/useSearch.js +25 -0
- package/build/cjs/useSearch.js.map +1 -0
- package/build/cjs/utils.js +241 -0
- package/build/cjs/utils.js.map +1 -0
- package/build/esm/index.js +2302 -2534
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +3498 -2694
- package/build/stats-react.json +1204 -44
- package/build/types/CatchBoundary.d.ts +36 -0
- package/build/types/Matches.d.ts +64 -0
- package/build/types/RouterProvider.d.ts +35 -0
- package/build/types/awaited.d.ts +9 -0
- package/build/types/defer.d.ts +19 -0
- package/build/types/fileRoute.d.ts +38 -0
- package/build/types/history.d.ts +7 -0
- package/build/types/index.d.ts +27 -74
- package/build/types/lazyRouteComponent.d.ts +2 -0
- package/build/types/link.d.ts +93 -0
- package/build/types/location.d.ts +12 -0
- package/build/types/path.d.ts +17 -0
- package/build/types/qss.d.ts +2 -0
- package/build/types/redirects.d.ts +11 -0
- package/build/types/route.d.ts +283 -0
- package/build/types/routeInfo.d.ts +31 -0
- package/build/types/router.d.ts +186 -0
- package/build/types/scroll-restoration.d.ts +18 -0
- package/build/types/searchParams.d.ts +7 -0
- package/build/types/useBlocker.d.ts +9 -0
- package/build/types/useNavigate.d.ts +19 -0
- package/build/types/useParams.d.ts +7 -0
- package/build/types/useSearch.d.ts +7 -0
- package/build/types/utils.d.ts +69 -0
- package/build/umd/index.development.js +2899 -2493
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +4 -4
- package/build/umd/index.production.js.map +1 -1
- package/package.json +12 -10
- package/src/CatchBoundary.tsx +101 -0
- package/src/Matches.tsx +423 -0
- package/src/RouterProvider.tsx +254 -0
- package/src/awaited.tsx +40 -0
- package/src/defer.ts +55 -0
- package/src/fileRoute.ts +152 -0
- package/src/history.ts +8 -0
- package/src/index.tsx +28 -619
- package/src/lazyRouteComponent.tsx +33 -0
- package/src/link.tsx +603 -0
- package/src/location.ts +13 -0
- package/src/path.ts +261 -0
- package/src/qss.ts +53 -0
- package/src/redirects.ts +39 -0
- package/src/route.ts +882 -0
- package/src/routeInfo.ts +84 -0
- package/src/router.ts +1671 -0
- package/src/scroll-restoration.tsx +230 -0
- package/src/searchParams.ts +79 -0
- package/src/useBlocker.tsx +27 -0
- package/src/useNavigate.tsx +111 -0
- package/src/useParams.tsx +25 -0
- package/src/useSearch.tsx +25 -0
- package/src/utils.ts +360 -0
- package/build/cjs/react-router/src/index.js +0 -458
- package/build/cjs/react-router/src/index.js.map +0 -1
- package/build/cjs/router-core/build/esm/index.js +0 -2524
- package/build/cjs/router-core/build/esm/index.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router
|
|
2
|
+
* @tanstack/react-router/src/index.tsx
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) TanStack
|
|
5
5
|
*
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
!function(e
|
|
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 n(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(o){if("default"!==o){var n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,n.get?n:{enumerable:!0,get:function(){return t[o]}})}})),e.default=t,Object.freeze(e)}var r=n(e);
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* @tanstack/history/src/index.ts
|
|
14
14
|
*
|
|
15
15
|
* Copyright (c) TanStack
|
|
16
16
|
*
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
* LICENSE.md file in the root directory of this source tree.
|
|
19
19
|
*
|
|
20
20
|
* @license MIT
|
|
21
|
-
*/function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},l.apply(this,arguments)}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(o||(o={}));var c="beforeunload",u="popstate";function d(e){void 0===e&&(e={});var t=e.window,n=void 0===t?document.defaultView:t,a=n.history;function r(){var e=n.location,t=e.pathname,o=e.search,r=e.hash,i=a.state||{};return[i.idx,{pathname:t,search:o,hash:r,state:i.usr||null,key:i.key||"default"}]}var i=null;n.addEventListener(u,(function(){if(i)P.call(i),i=null;else{var e=o.Pop,t=r(),n=t[0],a=t[1];if(P.length){if(null!=n){var s=h-n;s&&(i={action:e,location:a,retry:function(){A(-1*s)}},A(s))}}else x(e)}}));var s=o.Pop,d=r(),h=d[0],f=d[1],_=m(),P=m();function b(e){return"string"==typeof e?e:g(e)}function w(e,t){return void 0===t&&(t=null),l({pathname:f.pathname,hash:"",search:""},"string"==typeof e?y(e):e,{state:t,key:v()})}function E(e,t){return[{usr:e.state,key:e.key,idx:t},b(e)]}function R(e,t,n){return!P.length||(P.call({action:e,location:t,retry:n}),!1)}function x(e){s=e;var t=r();h=t[0],f=t[1],_.call({action:s,location:f})}function A(e){a.go(e)}null==h&&(h=0,a.replaceState(l({},a.state,{idx:h}),""));var M={get action(){return s},get location(){return f},createHref:b,push:function e(t,r){var i=o.Push,s=w(t,r);if(R(i,s,(function(){e(t,r)}))){var l=E(s,h+1),c=l[0],u=l[1];try{a.pushState(c,"",u)}catch(e){n.location.assign(u)}x(i)}},replace:function e(t,n){var r=o.Replace,i=w(t,n);if(R(r,i,(function(){e(t,n)}))){var s=E(i,h),l=s[0],c=s[1];a.replaceState(l,"",c),x(r)}},go:A,back:function(){A(-1)},forward:function(){A(1)},listen:function(e){return _.push(e)},block:function(e){var t=P.push(e);return 1===P.length&&n.addEventListener(c,p),function(){t(),P.length||n.removeEventListener(c,p)}}};return M}function h(e){void 0===e&&(e={});var t=e,n=t.initialEntries,a=void 0===n?["/"]:n,r=t.initialIndex,i=a.map((function(e){return l({pathname:"/",search:"",hash:"",state:null,key:v()},"string"==typeof e?y(e):e)})),s=f(null==r?i.length-1:r,0,i.length-1),c=o.Pop,u=i[s],d=m(),h=m();function p(e,t){return void 0===t&&(t=null),l({pathname:u.pathname,search:"",hash:""},"string"==typeof e?y(e):e,{state:t,key:v()})}function _(e,t,n){return!h.length||(h.call({action:e,location:t,retry:n}),!1)}function P(e,t){c=e,u=t,d.call({action:c,location:u})}function b(e){var t=f(s+e,0,i.length-1),n=o.Pop,a=i[t];_(n,a,(function(){b(e)}))&&(s=t,P(n,a))}var w={get index(){return s},get action(){return c},get location(){return u},createHref:function(e){return"string"==typeof e?e:g(e)},push:function e(t,n){var a=o.Push,r=p(t,n);_(a,r,(function(){e(t,n)}))&&(s+=1,i.splice(s,i.length,r),P(a,r))},replace:function e(t,n){var a=o.Replace,r=p(t,n);_(a,r,(function(){e(t,n)}))&&(i[s]=r,P(a,r))},go:b,back:function(){b(-1)},forward:function(){b(1)},listen:function(e){return d.push(e)},block:function(e){return h.push(e)}};return w}function f(e,t,n){return Math.min(Math.max(e,t),n)}function p(e){e.preventDefault(),e.returnValue=""}function m(){var e=[];return{get length(){return e.length},push:function(t){return e.push(t),function(){e=e.filter((function(e){return e!==t}))}},call:function(t){e.forEach((function(e){return e&&e(t)}))}}}function v(){return Math.random().toString(36).substr(2,8)}function g(e){var t=e.pathname,n=void 0===t?"/":t,a=e.search,o=void 0===a?"":a,r=e.hash,i=void 0===r?"":r;return o&&"?"!==o&&(n+="?"===o.charAt(0)?o:"?"+o),i&&"#"!==i&&(n+="#"===i.charAt(0)?i:"#"+i),n}function y(e){var t={};if(e){var n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));var a=e.indexOf("?");a>=0&&(t.search=e.substr(a),e=e.substr(0,a)),e&&(t.pathname=e)}return t}function _(e,t){if(!e)throw new Error("Invariant failed")}function P(e,t){if(e===t)return e;const n=Array.isArray(e)&&Array.isArray(t);if(n||b(e)&&b(t)){const a=n?e.length:Object.keys(e).length,o=n?t:Object.keys(t),r=o.length,i=n?[]:{};let s=0;for(let a=0;a<r;a++){const r=n?a:o[a];i[r]=P(e[r],t[r]),i[r]===e[r]&&s++}return a===r&&s===a?e:i}return t}function b(e){if(!w(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!!w(n)&&!!n.hasOwnProperty("isPrototypeOf")}function w(e){return"[object Object]"===Object.prototype.toString.call(e)}function E(e){return e[e.length-1]}function R(e,t){if(e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}return!0}function x(e,t){return"function"==typeof e?e(t):e}function A(e,t){return t.reduce(((t,n)=>(t[n]=e[n],t)),{})}function M(e){return S(e.filter(Boolean).join("/"))}function S(e){return e.replace(/\/{2,}/g,"/")}function I(e){return"/"===e?e:e.replace(/^\/{1,}/,"")}function L(e){return"/"===e?e:e.replace(/\/{1,}$/,"")}function k(e){return L(I(e))}function C(e,t,n){t=t.replace(new RegExp("^"+e),"/"),n=n.replace(new RegExp("^"+e),"/");let a=O(t);const o=O(n);o.forEach(((e,t)=>{if("/"===e.value)t?t===o.length-1&&a.push(e):a=[e];else if(".."===e.value){var n;a.length>1&&"/"===(null==(n=E(a))?void 0:n.value)&&a.pop(),a.pop()}else{if("."===e.value)return;a.push(e)}}));return S(M([e,...a.map((e=>e.value))]))}function O(e){if(!e)return[];const t=[];if("/"===(e=S(e)).slice(0,1)&&(e=e.substring(1),t.push({type:"pathname",value:"/"})),!e)return t;const n=e.split("/").filter(Boolean);return t.push(...n.map((e=>e.startsWith("*")?{type:"wildcard",value:e}:":"===e.charAt(0)?{type:"param",value:e}:{type:"pathname",value:e}))),"/"===e.slice(-1)&&(e=e.substring(1),t.push({type:"pathname",value:"/"})),t}function j(e,t,n){return M(O(e).map((e=>{return"*"!==e.value||n?"param"===e.type?null!=(a=t[e.value.substring(1)])?a:"":e.value:"";var a})))}function D(e,t){const n=T(e,t);if(!t.to||n)return null!=n?n:{}}function T(e,t){var n;const a=O(e),o=O(""+(null!=(n=t.to)?n:"*")),r={};return(()=>{for(let e=0;e<Math.max(a.length,o.length);e++){const n=a[e],i=o[e],s=e===o.length-1,l=e===a.length-1;if(i){if("wildcard"===i.type)return!(null==n||!n.value)&&(r["*"]=M(a.slice(e).map((e=>e.value))),!0);if("pathname"===i.type){if("/"===i.value&&(null==n||!n.value))return!0;if(n)if(t.caseSensitive){if(i.value!==n.value)return!1}else if(i.value.toLowerCase()!==n.value.toLowerCase())return!1}if(!n)return!1;if("param"===i.type){if("/"===(null==n?void 0:n.value))return!1;n.value.startsWith(":")||(r[i.value.substring(1)]=n.value)}}if(s&&!l)return!!t.fuzzy}return!0})()?r:void 0}function F(e,t){var n,a,o,r="";for(n in e)if(void 0!==(o=e[n]))if(Array.isArray(o))for(a=0;a<o.length;a++)r&&(r+="&"),r+=encodeURIComponent(n)+"="+encodeURIComponent(o[a]);else r&&(r+="&"),r+=encodeURIComponent(n)+"="+encodeURIComponent(o);return(t||"")+r}function N(e){if(!e)return"";var t=decodeURIComponent(e);return"false"!==t&&("true"===t||("0"===t.charAt(0)?t:0*+t==0?+t:t))}function B(e){for(var t,n,a={},o=e.split("&");t=o.shift();)void 0!==a[n=(t=t.split("=")).shift()]?a[n]=[].concat(a[n],N(t.shift())):a[n]=N(t.shift());return a}function U(){return U=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},U.apply(this,arguments)}function H(e,t,n,a){const{id:o,routeId:r,path:i,fullPath:s}=e,l=a.state.actions[o]||(a.state.actions[o]={pending:[],submit:async(e,t)=>{var n;if(!u)return;const o=null==(n=null==t?void 0:t.invalidate)||n,r={submittedAt:Date.now(),status:"pending",submission:e};l.current=r,l.latest=r,l.pending.push(r),a.state=U({},a.state,{currentAction:r,latestAction:r}),a.notify();try{const t=await(null==u.options.action?void 0:u.options.action(e));return r.data=t,o&&(a.invalidateRoute({to:".",fromCurrent:!0}),await a.reload()),r.status="success",t}catch(e){console.error(e),r.error=e,r.status="error"}finally{l.pending=l.pending.filter((e=>e!==r)),a.removeActionQueue.push({action:l,actionState:r}),a.notify()}}},a.state.actions[o]),c=a.state.loaders[o]||(a.state.loaders[o]={pending:[],fetch:async e=>{if(!u)return;const t={loadedAt:Date.now(),loaderContext:e};c.current=t,c.latest=t,c.pending.push(t),a.notify();try{return await(null==u.options.loader?void 0:u.options.loader(e))}finally{c.pending=c.pending.filter((e=>e!==t)),a.notify()}}},a.state.loaders[o]);let u={routeId:o,routeRouteId:r,routePath:i,fullPath:s,options:t,router:a,childRoutes:void 0,parentRoute:n,action:l,loader:c,buildLink:e=>a.buildLink(U({},e,{from:s})),navigate:e=>a.navigate(U({},e,{from:s})),matchRoute:(e,t)=>a.matchRoute(U({},e,{from:s}),t)};return null==a.options.createRoute||a.options.createRoute({router:a,route:u}),u}const z="__root__",G=["element","errorElement","catchElement","pendingElement"];function W(e,t,n){const a=U({},t,n,{router:e,routeSearch:{},search:{},childMatches:[],status:"idle",routeLoaderData:{},loaderData:{},isPending:!1,isFetching:!1,isInvalid:!1,invalidAt:1/0,getIsInvalid:()=>{const e=Date.now();return a.isInvalid||a.invalidAt<e},__:{abortController:new AbortController,latestId:"",resolve:()=>{},notify:()=>{a.__.resolve(),a.router.notify()},startPending:()=>{var t,n;const o=null!=(t=a.options.pendingMs)?t:e.options.defaultPendingMs,r=null!=(n=a.options.pendingMinMs)?n:e.options.defaultPendingMinMs;a.__.pendingTimeout||"loading"!==a.status||void 0===o||(a.__.pendingTimeout=setTimeout((()=>{a.isPending=!0,a.__.resolve(),void 0!==r&&(a.__.pendingMinPromise=new Promise((e=>a.__.pendingMinTimeout=setTimeout(e,r))))}),o))},cancelPending:()=>{a.isPending=!1,clearTimeout(a.__.pendingTimeout),clearTimeout(a.__.pendingMinTimeout),delete a.__.pendingMinPromise},validate:()=>{var t,n;const o=null!=(t=null==(n=a.parentMatch)?void 0:n.search)?t:e.location.search;try{const e=a.routeSearch,t="object"==typeof a.options.validateSearch?a.options.validateSearch.parse:a.options.validateSearch;let n=P(e,null==t?void 0:t(o));e!==n&&(a.isInvalid=!0),a.routeSearch=n,a.search=P(o,U({},o,n))}catch(e){console.error(e);const t=new Error("Invalid search params found",{cause:e});return t.code="INVALID_SEARCH_PARAMS",a.status="error",void(a.error=t)}}},cancel:()=>{var e;null==(e=a.__.abortController)||e.abort(),a.__.cancelPending()},invalidate:()=>{a.isInvalid=!0},hasLoaders:()=>!(!t.options.loader&&!G.some((e=>"function"==typeof t.options[e]))),load:async t=>{const n=Date.now(),o=null!=t&&t.preload?Math.max(null==t?void 0:t.maxAge,null==t?void 0:t.gcMaxAge):0;if(null!=t&&t.preload&&o>0){if(e.state.matches.find((e=>e.matchId===a.matchId)))return;e.matchCache[a.matchId]={gc:n+t.gcMaxAge,match:a}}if("success"===a.status&&a.getIsInvalid()||"error"===a.status||"idle"===a.status){const e=null!=t&&t.preload?null==t?void 0:t.maxAge:void 0;a.fetch({maxAge:e})}},fetch:async t=>{const n=""+Date.now()+Math.random();return a.__.latestId=n,"idle"===a.status&&(a.status="loading"),a.isInvalid=!1,a.__.loadPromise=new Promise((async o=>{a.isFetching=!0,a.__.resolve=o;const r=(async()=>{a.__.elementsPromise=(async()=>{await Promise.all(G.map((async t=>{const n=a.options[t];a.__[t]||(a.__[t]=await e.options.createElement(n))})))})(),a.__.dataPromise=Promise.resolve().then((async()=>{try{var o,r,i;if(a.options.loader){const e=await a.options.loader({params:a.params,search:a.routeSearch,signal:a.__.abortController.signal});if(n!==a.__.latestId)return a.__.loaderPromise;a.routeLoaderData=P(a.routeLoaderData,e)}a.error=void 0,a.status="success",a.updatedAt=Date.now(),a.invalidAt=a.updatedAt+(null!=(o=null!=(r=null!=(i=null==t?void 0:t.maxAge)?i:a.options.loaderMaxAge)?r:e.options.defaultLoaderMaxAge)?o:0)}catch(e){if(n!==a.__.latestId)return a.__.loaderPromise;a.error=e,a.status="error",a.updatedAt=Date.now()}}));try{if(await Promise.all([a.__.elementsPromise,a.__.dataPromise]),n!==a.__.latestId)return a.__.loaderPromise;a.__.pendingMinPromise&&(await a.__.pendingMinPromise,delete a.__.pendingMinPromise)}finally{if(n!==a.__.latestId)return a.__.loaderPromise;a.__.cancelPending(),a.isPending=!1,a.isFetching=!1,a.__.notify()}})();if(a.__.loaderPromise=r,await r,n!==a.__.latestId)return a.__.loaderPromise;delete a.__.loaderPromise})),await a.__.loadPromise}});return a.hasLoaders()||(a.status="success"),a}const q=Q(JSON.parse),K=V(JSON.stringify);function Q(e){return t=>{"?"===t.substring(0,1)&&(t=t.substring(1));let n=B(t);for(let t in n){const a=n[t];if("string"==typeof a)try{n[t]=e(a)}catch(e){}}return n}}function V(e){return t=>{(t=U({},t))&&Object.keys(t).forEach((n=>{const a=t[n];if(void 0===a||void 0===a)delete t[n];else if(a&&"object"==typeof a&&null!==a)try{t[n]=e(a)}catch(e){}}));const n=F(t).toString();return n?"?"+n:""}}var J;const X="undefined"==typeof window||!(null!=(J=window.document)&&J.createElement);function Y(e){var t,n;const a=(null==e?void 0:e.history)||(X?h():d()),o=U({defaultLoaderGcMaxAge:3e5,defaultLoaderMaxAge:0,defaultPreloadMaxAge:2e3,defaultPreloadDelay:50},e,{stringifySearch:null!=(t=null==e?void 0:e.stringifySearch)?t:K,parseSearch:null!=(n=null==e?void 0:e.parseSearch)?n:q});let r={history:a,options:o,listeners:[],removeActionQueue:[],basepath:"",routeTree:void 0,routesById:{},location:void 0,allRouteInfo:void 0,navigationPromise:Promise.resolve(),resolveNavigation:()=>{},matchCache:{},state:{status:"idle",location:null,matches:[],actions:{},loaders:{},lastUpdated:Date.now(),isFetching:!1,isPreloading:!1},startedLoadingAt:Date.now(),subscribe:e=>(r.listeners.push(e),()=>{r.listeners=r.listeners.filter((t=>t!==e))}),getRoute:e=>r.routesById[e],notify:()=>{r.state=U({},r.state,{isFetching:"loading"===r.state.status||r.state.matches.some((e=>e.isFetching)),isPreloading:Object.values(r.matchCache).some((e=>e.match.isFetching&&!r.state.matches.find((t=>t.matchId===e.match.matchId))))}),$(r.state.matches),r.listeners.forEach((e=>e(r)))},dehydrateState:()=>U({},A(r.state,["status","location","lastUpdated"]),{matches:r.state.matches.map((e=>A(e,["matchId","status","routeLoaderData","loaderData","isInvalid","invalidAt"])))}),hydrateState:e=>{const t=r.matchRoutes(r.location.pathname,{strictParseParams:!0});r.state=U({},r.state,e,{matches:t.map((t=>{const n=e.matches.find((e=>e.matchId===t.matchId));return _(n),Object.assign(t,n),t}))})},mount:()=>{const e=r.__.buildLocation({to:".",search:!0,hash:!0});e.href!==r.location.href&&r.__.commitLocation(e,!0),r.loadLocation();const t=r.history.listen((e=>{console.log(e.location),r.loadLocation(r.__.parseLocation(e.location,r.location))}));return!X&&window.addEventListener&&(window.addEventListener("visibilitychange",r.onFocus,!1),window.addEventListener("focus",r.onFocus,!1)),()=>{t(),window.removeEventListener("visibilitychange",r.onFocus),window.removeEventListener("focus",r.onFocus)}},onFocus:()=>{r.loadLocation()},update:e=>{const t=(null==e?void 0:e.history)!==r.history;r.location&&!t||(null!=e&&e.history&&(r.history=e.history),r.location=r.__.parseLocation(r.history.location),r.state.location=r.location),Object.assign(r.options,e);const{basepath:n,routeConfig:a}=r.options;return r.basepath=S("/"+(null!=n?n:"")),a&&(r.routesById={},r.routeTree=r.__.buildRouteTree(a)),r},cancelMatches:()=>{var e,t;[...r.state.matches,...null!=(e=null==(t=r.state.pending)?void 0:t.matches)?e:[]].forEach((e=>{e.cancel()}))},loadLocation:async e=>{const t=Math.random();r.startedLoadingAt=t,e&&(r.location=e),r.removeActionQueue.forEach((e=>{let{action:t,actionState:n}=e;r.state.currentAction===n&&(r.state.currentAction=void 0),t.current===n&&(t.current=void 0)})),r.removeActionQueue=[],r.cancelMatches();const n=r.matchRoutes(r.location.pathname,{strictParseParams:!0});if(r.state=U({},r.state,{pending:{matches:n,location:r.location},status:"loading"}),r.notify(),await r.loadMatches(n,{withPending:!0}),r.startedLoadingAt!==t)return r.navigationPromise;const a=r.state.matches,o=[],i=[];a.forEach((e=>{n.find((t=>t.matchId===e.matchId))?i.push(e):o.push(e)}));const s=Date.now();o.forEach((e=>{var t,n,a,o;null==e.__.onExit||e.__.onExit({params:e.params,search:e.routeSearch}),"error"!==e.status||e.isFetching||(e.status="idle",e.error=void 0);const i=Math.max(null!=(t=null!=(n=e.options.loaderGcMaxAge)?n:r.options.defaultLoaderGcMaxAge)?t:0,null!=(a=null!=(o=e.options.loaderMaxAge)?o:r.options.defaultLoaderMaxAge)?a:0);i>0&&(r.matchCache[e.matchId]={gc:i==1/0?Number.MAX_SAFE_INTEGER:s+i,match:e})})),i.forEach((e=>{null==e.options.onTransition||e.options.onTransition({params:e.params,search:e.routeSearch})}));n.filter((e=>!a.find((t=>t.matchId===e.matchId)))).forEach((e=>{e.__.onExit=null==e.options.onMatch?void 0:e.options.onMatch({params:e.params,search:e.search}),delete r.matchCache[e.matchId]})),n.some((e=>"loading"===e.status))&&(r.notify(),await Promise.all(n.map((e=>e.__.loaderPromise||Promise.resolve())))),r.startedLoadingAt===t&&(r.state=U({},r.state,{location:r.location,matches:n,pending:void 0,status:"idle"}),r.notify(),r.resolveNavigation())},cleanMatchCache:()=>{const e=Date.now();Object.keys(r.matchCache).forEach((t=>{const n=r.matchCache[t];"loading"!==n.match.status&&(n.gc>0&&n.gc>e||delete r.matchCache[t])}))},loadRoute:async function(e){void 0===e&&(e=r.location);const t=r.buildNext(e),n=r.matchRoutes(t.pathname,{strictParseParams:!0});return await r.loadMatches(n),n},preloadRoute:async function(e,t){var n,a,o,i,s,l;void 0===e&&(e=r.location);const c=r.buildNext(e),u=r.matchRoutes(c.pathname,{strictParseParams:!0});return await r.loadMatches(u,{preload:!0,maxAge:null!=(n=null!=(a=null!=(o=t.maxAge)?o:r.options.defaultPreloadMaxAge)?a:r.options.defaultLoaderMaxAge)?n:0,gcMaxAge:null!=(i=null!=(s=null!=(l=t.gcMaxAge)?l:r.options.defaultPreloadGcMaxAge)?s:r.options.defaultLoaderGcMaxAge)?i:0}),u},matchRoutes:(e,t)=>{var n,a;r.cleanMatchCache();const o=[];if(!r.routeTree)return o;const i=[...r.state.matches,...null!=(n=null==(a=r.state.pending)?void 0:a.matches)?n:[]],s=async n=>{var a,l,c;const u=E(o);let d=null!=(a=null==u?void 0:u.params)?a:{};const h=null!=(l=null==r.options.filterRoutes?void 0:r.options.filterRoutes(n))?l:n;let f=[];const p=(n,a)=>(a.some((a=>{var o,i,s;if(!a.routePath&&null!=(o=a.childRoutes)&&o.length)return p([...f,a],a.childRoutes);const l=!!("/"!==a.routePath||null!=(i=a.childRoutes)&&i.length),c=D(e,{to:a.fullPath,fuzzy:l,caseSensitive:null!=(s=a.options.caseSensitive)?s:r.options.caseSensitive});if(c){let e;try{var u;e=null!=(u=null==a.options.parseParams?void 0:a.options.parseParams(c))?u:c}catch(e){if(null!=t&&t.strictParseParams)throw e}d=U({},d,e)}return c&&(f=[...n,a]),!!f.length})),!!f.length);if(p([],h),!f.length)return;f.forEach((t=>{var n;const a=j(t.routePath,d),s=j(t.routeId,d,!0),l=i.find((e=>e.matchId===s))||(null==(n=r.matchCache[s])?void 0:n.match)||W(r,t,{matchId:s,params:d,pathname:M([e,a])});o.push(l)}));const m=E(f);null!=(c=m.childRoutes)&&c.length&&s(m.childRoutes)};return s([r.routeTree]),$(o),o},loadMatches:async(e,t)=>{const n=e.map((async e=>{e.__.validate(),e.load(t),"loading"===e.status&&(null!=t&&t.withPending&&e.__.startPending(),await e.__.loadPromise)}));r.notify(),await Promise.all(n)},invalidateRoute:e=>{var t,n;const a=r.buildNext(e),o=r.matchRoutes(a.pathname).map((e=>e.matchId));[...r.state.matches,...null!=(t=null==(n=r.state.pending)?void 0:n.matches)?t:[]].forEach((e=>{o.includes(e.matchId)&&e.invalidate()}))},reload:()=>r.__.navigate({fromCurrent:!0,replace:!0,search:!0}),resolvePath:(e,t)=>C(r.basepath,e,S(t)),matchRoute:(e,t)=>{var n;e=U({},e,{to:e.to?r.resolvePath(null!=(n=e.from)?n:"",e.to):void 0});const a=r.buildNext(e);var o;return null!=t&&t.pending?!(null==(o=r.state.pending)||!o.location)&&!!D(r.state.pending.location.pathname,U({},t,{to:a.pathname})):!!D(r.state.location.pathname,U({},t,{to:a.pathname}))},navigate:async e=>{let{from:t,to:n=".",search:a,hash:o,replace:i,params:s}=e;const l=String(n),c=String(t);let u;try{new URL(""+l),u=!0}catch(e){}return _(!u),r.__.navigate({from:c,to:l,search:a,hash:o,replace:i,params:s})},buildLink:e=>{var t,n;let{from:a,to:o=".",search:i,params:s,hash:l,target:c,replace:u,activeOptions:d,preload:h,preloadMaxAge:f,preloadGcMaxAge:p,preloadDelay:m,disabled:v}=e;try{return new URL(""+o),{type:"external",href:o}}catch(e){}const g={from:a,to:o,search:i,params:s,hash:l,replace:u},y=r.buildNext(g);h=null!=(t=h)?t:r.options.defaultPreload;const _=null!=(n=null!=m?m:r.options.defaultPreloadDelay)?n:0,P=r.state.location.pathname===y.pathname,b=r.state.location.pathname.split("/"),w=y.pathname.split("/").every(((e,t)=>e===b[t])),E=r.state.location.hash===y.hash,R=null!=d&&d.exact?P:w,x=null==d||!d.includeHash||E;return{type:"internal",next:y,handleFocus:e=>{h&&r.preloadRoute(g,{maxAge:f,gcMaxAge:p})},handleClick:e=>{v||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e)||e.defaultPrevented||c&&"_self"!==c||0!==e.button||(e.preventDefault(),!P||i||l||r.invalidateRoute(g),r.__.navigate(g))},handleEnter:e=>{const t=e.target||{};if(h){if(t.preloadTimeout)return;t.preloadTimeout=setTimeout((()=>{t.preloadTimeout=null,r.preloadRoute(g,{maxAge:f,gcMaxAge:p})}),_)}},handleLeave:e=>{const t=e.target||{};t.preloadTimeout&&(clearTimeout(t.preloadTimeout),t.preloadTimeout=null)},isActive:R&&x,disabled:v}},buildNext:e=>{const t=r.__.buildLocation(e),n=r.matchRoutes(t.pathname),a=n.map((e=>{var t;return null!=(t=e.options.preSearchFilters)?t:[]})).flat().filter(Boolean),o=n.map((e=>{var t;return null!=(t=e.options.postSearchFilters)?t:[]})).flat().filter(Boolean);return r.__.buildLocation(U({},e,{__preSearchFilters:a,__postSearchFilters:o}))},__:{buildRouteTree:e=>{const t=(e,n)=>e.map((e=>{const a=H(e,e.options,n,r);if(r.routesById[a.routeId])throw new Error;r.routesById[a.routeId]=a;const o=e.children;return a.childRoutes=null!=o&&o.length?t(o,a):void 0,a}));return t([e])[0]},parseLocation:(e,t)=>{var n;const a=r.options.parseSearch(e.search);return{pathname:e.pathname,searchStr:e.search,search:P(null==t?void 0:t.search,a),hash:null!=(n=e.hash.split("#").reverse()[0])?n:"",href:""+e.pathname+e.search+e.hash,state:e.state,key:e.key}},navigate:e=>{const t=r.buildNext(e);return r.__.commitLocation(t,e.replace)},buildLocation:function(e){var t,n,a,o,i,s,l,c,u;void 0===e&&(e={});const d=e.fromCurrent?r.location.pathname:null!=(t=e.from)?t:r.location.pathname;let h=C(null!=(n=r.basepath)?n:"/",d,""+(null!=(a=e.to)?a:"."));const f=r.matchRoutes(r.location.pathname,{strictParseParams:!0}),p=r.matchRoutes(h),m=U({},null==(o=E(f))?void 0:o.params);let v=!0===(null==(i=e.params)||i)?m:x(e.params,m);v&&p.map((e=>e.options.stringifyParams)).filter(Boolean).forEach((e=>{Object.assign({},v,e(v))})),h=j(h,null!=v?v:{});const g=null!=(s=e.__preSearchFilters)&&s.length?e.__preSearchFilters.reduce(((e,t)=>t(e)),r.location.search):r.location.search,y=!0===e.search?g:e.search?null!=(l=x(e.search,g))?l:{}:null!=(c=e.__preSearchFilters)&&c.length?g:{},_=null!=(u=e.__postSearchFilters)&&u.length?e.__postSearchFilters.reduce(((e,t)=>t(e)),y):y,b=P(r.location.search,_),w=r.options.stringifySearch(b);let R=!0===e.hash?r.location.hash:x(e.hash,r.location.hash);return R=R?"#"+R:"",{pathname:h,search:b,searchStr:w,state:r.location.state,hash:R,href:""+h+w+R,key:e.key}},commitLocation:(e,t)=>{const n=""+Date.now()+Math.random();r.navigateTimeout&&clearTimeout(r.navigateTimeout);let o="replace";t||(o="push");return r.__.parseLocation(a.location).href===e.href&&!e.key&&(o="replace"),"replace"===o?a.replace({pathname:e.pathname,hash:e.hash,search:e.searchStr},{id:n}):a.push({pathname:e.pathname,hash:e.hash,search:e.searchStr},{id:n}),r.navigationPromise=new Promise((e=>{const t=r.resolveNavigation;r.resolveNavigation=()=>{t(),e()}})),r.navigationPromise}}};return r.update(e),null==r.options.createRouter||r.options.createRouter(r),r}function $(e){e.forEach(((t,n)=>{const a=e[n-1];a&&(t.loaderData=P(t.loaderData,U({},a.loaderData,t.routeLoaderData)))}))}const Z=["type","children","target","activeProps","inactiveProps","activeOptions","disabled","hash","search","params","to","preload","preloadDelay","preloadMaxAge","replace","style","className","onClick","onFocus","onMouseEnter","onMouseLeave","onTouchStart","onTouchEnd"],ee=["pending","caseSensitive","children"],te=["children","router"],ne=r.createContext(null),ae=r.createContext(null),oe=Boolean("undefined"!=typeof window&&window.document&&window.document.createElement)?r.useLayoutEffect:r.useEffect;function re(e){return r.createElement(ne.Provider,e)}const ie=e=>{n.useSyncExternalStore((t=>e.subscribe((()=>t()))),(()=>e.state),(()=>e.state))};function se(){const e=r.useContext(ae);return R(!e,"useRouter must be used inside a <Router> component!"),ie(e.router),e.router}function le(){return r.useContext(ne)}function ce(){var e;const t=se(),[,...n]=le(),a=n[0];if(!a)return null;const o=(()=>{var e,n;if(!a)return null;const o=null!=(e=a.__.errorElement)?e:t.options.defaultErrorElement;if("error"===a.status){if(o)return o;if(a.options.useErrorBoundary||t.options.useErrorBoundary)throw a.error;return r.createElement(de,{error:a.error})}if("loading"===a.status||"idle"===a.status){if(a.isPending){var i;const e=null!=(i=a.__.pendingElement)?i:t.options.defaultPendingElement;var s;if(a.options.pendingMs||e)return null!=(s=e)?s:null}return null}return null!=(n=a.__.element)?n:t.options.defaultElement})(),i=null!=(e=null==a?void 0:a.options.catchElement)?e:t.options.defaultCatchElement;return r.createElement(re,{value:n,key:a.matchId},r.createElement(ue,{catchElement:i},o))}class ue extends r.Component{constructor(){super(...arguments),this.state={error:!1}}componentDidCatch(e,t){console.error(e),this.setState({error:e,info:t})}render(){var e;const t=null!=(e=this.props.catchElement)?e:de;return this.state.error?"function"==typeof t?t(this.state):t:this.props.children}}function de(e){let{error:t}=e;return r.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},r.createElement("strong",{style:{fontSize:"1.2rem"}},"Something went wrong!"),r.createElement("div",{style:{height:".5rem"}}),r.createElement("div",null,r.createElement("pre",null,t.message?r.createElement("code",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".5rem",color:"red"}},t.message):null)),r.createElement("div",{style:{height:"1rem"}}),r.createElement("div",{style:{fontSize:".8em",borderLeft:"3px solid rgba(127, 127, 127, 1)",paddingLeft:".5rem",opacity:.5}},"If you are the owner of this website, it's highly recommended that you configure your own custom Catch/Error boundaries for the router. You can optionally configure a boundary for each route."))}function he(e,t){const n=se();r.useEffect((()=>{if(!t)return;let a=n.history.block((t=>{window.confirm(e)?(a(),t.retry()):n.location.pathname=window.location.pathname}));return a}),[t,location,e])}e.DefaultErrorBoundary=de,e.MatchesProvider=re,e.Outlet=ce,e.Prompt=function(e){let{message:t,when:n,children:a}=e;return he(t,null==n||n),null!=a?a:null},e.RouterProvider=function(e){let{children:t,router:n}=e,a=s(e,te);return n.update(a),ie(n),oe((()=>n.mount()),[n]),r.createElement(ae.Provider,{value:{router:n}},r.createElement(re,{value:n.state.matches},null!=t?t:r.createElement(ce,null)))},e.cleanPath=S,e.createBrowserHistory=d,e.createHashHistory=function(e){void 0===e&&(e={});var t=e.window,n=void 0===t?document.defaultView:t,a=n.history;function r(){var e=y(n.location.hash.substr(1)),t=e.pathname,o=void 0===t?"/":t,r=e.search,i=void 0===r?"":r,s=e.hash,l=void 0===s?"":s,c=a.state||{};return[c.idx,{pathname:o,search:i,hash:l,state:c.usr||null,key:c.key||"default"}]}var i=null;function s(){if(i)b.call(i),i=null;else{var e=o.Pop,t=r(),n=t[0],a=t[1];if(b.length){if(null!=n){var s=f-n;s&&(i={action:e,location:a,retry:function(){M(-1*s)}},M(s))}}else A(e)}}n.addEventListener(u,s),n.addEventListener("hashchange",(function(){g(r()[1])!==g(_)&&s()}));var d=o.Pop,h=r(),f=h[0],_=h[1],P=m(),b=m();function w(e){return function(){var e=document.querySelector("base"),t="";if(e&&e.getAttribute("href")){var a=n.location.href,o=a.indexOf("#");t=-1===o?a:a.slice(0,o)}return t}()+"#"+("string"==typeof e?e:g(e))}function E(e,t){return void 0===t&&(t=null),l({pathname:_.pathname,hash:"",search:""},"string"==typeof e?y(e):e,{state:t,key:v()})}function R(e,t){return[{usr:e.state,key:e.key,idx:t},w(e)]}function x(e,t,n){return!b.length||(b.call({action:e,location:t,retry:n}),!1)}function A(e){d=e;var t=r();f=t[0],_=t[1],P.call({action:d,location:_})}function M(e){a.go(e)}null==f&&(f=0,a.replaceState(l({},a.state,{idx:f}),""));var S={get action(){return d},get location(){return _},createHref:w,push:function e(t,r){var i=o.Push,s=E(t,r);if(x(i,s,(function(){e(t,r)}))){var l=R(s,f+1),c=l[0],u=l[1];try{a.pushState(c,"",u)}catch(e){n.location.assign(u)}A(i)}},replace:function e(t,n){var r=o.Replace,i=E(t,n);if(x(r,i,(function(){e(t,n)}))){var s=R(i,f),l=s[0],c=s[1];a.replaceState(l,"",c),A(r)}},go:M,back:function(){M(-1)},forward:function(){M(1)},listen:function(e){return P.push(e)},block:function(e){var t=b.push(e);return 1===b.length&&n.addEventListener(c,p),function(){t(),b.length||n.removeEventListener(c,p)}}};return S},e.createMemoryHistory=h,e.createReactRouter=function(e){const t=(e,t)=>({useRoute:function(n){void 0===n&&(n=".");const a=t.resolvePath(e.routeId,n),o=t.getRoute(a);return ie(t),_(o),o},linkProps:t=>{var n,a;const{target:o,activeProps:r=(()=>({className:"active"})),inactiveProps:l=(()=>({})),disabled:c,style:u,className:d,onClick:h,onFocus:f,onMouseEnter:p,onMouseLeave:m}=t,v=s(t,Z),g=e.buildLink(t);if("external"===g.type){const{href:e}=g;return{href:e}}const{handleClick:y,handleFocus:_,handleEnter:P,handleLeave:b,isActive:w,next:E}=g,R=e=>t=>{t.persist(),e.forEach((e=>{e&&e(t)}))},A=w&&null!=(n=x(r,{}))?n:{},M=w?{}:null!=(a=x(l,{}))?a:{};return i({},A,M,v,{href:c?void 0:E.href,onClick:R([y,h]),onFocus:R([_,f]),onMouseEnter:R([P,p]),onMouseLeave:R([b,m]),target:o,style:i({},u,A.style,M.style),className:[d,A.className,M.className].filter(Boolean).join(" ")||void 0},c?{role:"link","aria-disabled":!0}:void 0,{"data-status":w?"active":void 0})},Link:r.forwardRef(((n,a)=>{const o=e.linkProps(n);return ie(t),r.createElement("a",i({ref:a},o,{children:"function"==typeof n.children?n.children({isActive:"active"===o["data-status"]}):n.children}))})),MatchRoute:t=>{const{pending:n,caseSensitive:a}=t,o=s(t,ee),r=e.matchRoute(o,{pending:n,caseSensitive:a});return r?"function"==typeof t.children?t.children(r):t.children:null}});return Y(i({},e,{createRouter:e=>{const n={useState:()=>(ie(e),e.state),useMatch:t=>{ie(e),_(t!==z);const n=null==(a=le())?void 0:a[0];var a;const o=e.state.matches.find((e=>e.routeId===t));return _(o),_(n.routeId==(null==o?void 0:o.routeId),(null==o||o.routeId,n.routeId,null==o||o.routeId)),o||_("Match not found!"),o}},a=t(e.getRoute("/"),e);Object.assign(e,n,a)},createRoute:e=>{let{router:n,route:a}=e;const o=t(a,n);Object.assign(a,o)},createElement:async e=>{if("function"==typeof e){const t=await e();return"object"==typeof t&&t.default?r.createElement(t.default):t}return e}}))},e.createRoute=H,e.createRouteConfig=function e(t,n,a,o,r){void 0===t&&(t={}),void 0===a&&(a=!0),a&&(t.path=z),o===z&&(o="");let i=a?z:t.path;i&&"/"!==i&&(i=k(i));const s=i||t.id;let l=M([o,s]);i===z&&(i="/"),l!==z&&(l=M(["/",l]));const c=l===z?"/":L(M([r,i]));return{id:l,routeId:s,path:i,fullPath:c,options:t,children:n,createChildren:n=>e(t,n((t=>e(t,void 0,!1,l,c))),!1,o,r),addChildren:n=>e(t,n,!1,o,r),createRoute:t=>e(t,void 0,!1,l,c)}},e.createRouteMatch=W,e.createRouter=Y,e.decode=B,e.defaultParseSearch=q,e.defaultStringifySearch=K,e.encode=F,e.functionalUpdate=x,e.interpolatePath=j,e.invariant=_,e.joinPaths=M,e.last=E,e.matchByPath=T,e.matchPathname=D,e.parsePathname=O,e.parseSearchWith=Q,e.pick=A,e.replaceEqualDeep=P,e.resolvePath=C,e.rootRouteId=z,e.stringifySearchWith=V,e.trimPath=k,e.trimPathLeft=I,e.trimPathRight=L,e.usePrompt=he,e.warning=R,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
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,s)=>{const a=o(e);l||(r=i),i=p(e,n),c={href:a,state:n,isPush:c?.isPush||"push"===t},s(),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,o)=>f("push",t,e,o),replaceState:(t,e,o)=>f("replace",t,e,o),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)}var v,w={exports:{}},_={};w.exports=function(){if(v)return _;v=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 b=w.exports,S=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 R(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 E(t){const e=t.errorComponent??P;return r.createElement(L,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:o})=>o?r.createElement(e,{error:o}):t.children})}class L 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 P({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 x="undefined"==typeof document;function C(t){return t[t.length-1]}function T(t,e){return"function"==typeof t?t(e):t}function M(t,e){return e.reduce(((e,o)=>(e[o]=t[o],e)),{})}function O(t,e){if(t===e)return t;const o=e,n=Array.isArray(t)&&Array.isArray(o);if(n||k(t)&&k(o)){const e=n?t.length:Object.keys(t).length,r=n?o:Object.keys(o),s=r.length,a=n?[]:{};let i=0;for(let e=0;e<s;e++){const s=n?e:r[e];a[s]=O(t[s],o[s]),a[s]===t[s]&&i++}return e===s&&i===e?t:a}return o}function k(t){if(!I(t))return!1;const e=t.constructor;if(void 0===e)return!0;const o=e.prototype;return!!I(o)&&!!o.hasOwnProperty("isPrototypeOf")}function I(t){return"[object Object]"===Object.prototype.toString.call(t)}function D(t,e,o=!1){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(k(t)&&k(e)){const n=Object.keys(t),r=Object.keys(e);return!(!o&&n.length!==r.length)&&!r.some((n=>!(n in t)||!D(t[n],e[n],o)))}return!(!Array.isArray(t)||!Array.isArray(e))&&!t.some(((t,n)=>!D(t,e[n],o)))}const j="undefined"!=typeof window?r.useLayoutEffect:r.useEffect;function $(t){return t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}const B=r.createContext(void 0);function A(){const t=Q(),e=G({select:t=>U(t)[0]?.id});return r.createElement(B.Provider,{value:e},r.createElement(E,{getResetKey:()=>t.state.resolvedLocation.state?.key,errorComponent:P,onCatch:()=>{}},e?r.createElement(H,{matchId:e}):null))}function N(t){return r.createElement(r.Fragment,null,t.children)}function H({matchId:t}){const e=Q(),o=G({select:e=>U(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??P,c=n.options.wrapInSuspense??s??n.options.component?.preload??n.options.pendingComponent?.preload??n.options.errorComponent?.preload?r.Suspense:N,l=i?E:N;return r.createElement(B.Provider,{value:t},r.createElement(c,{fallback:a},r.createElement(l,{getResetKey:()=>e.state.resolvedLocation.state?.key,errorComponent:i,onCatch:()=>{}},r.createElement(F,{matchId:t,pendingElement:a}))))}function F({matchId:t,pendingElement:e}){const o=Q(),n=G({select:e=>U(e).find((e=>e.id===t))?.routeId}),s=o.routesById[n],a=G({select:e=>M(U(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(K,null)}g(!1)}const K=r.memo((function(){const t=r.useContext(B),e=G({select:e=>{const o=U(e),n=o.findIndex((e=>e.id===t));return o[n+1]?.id}});return e?r.createElement(H,{matchId:e}):null}));function W(){G({select:t=>[t.location,t.resolvedLocation]});const{matchRoute:t}=Q();return r.useCallback((e=>{const{pending:o,caseSensitive:n,...r}=e;return t(r,{pending:o,caseSensitive:n})}),[])}function U(t){return t.pendingMatches?.some((t=>t.showPending))?t.pendingMatches:t.matches}function z(t){const e=Q(),o=r.useContext(B),n=U(e.state).find((t=>t.id===o))?.routeId,s=(()=>{const n=U(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 G({select:e=>{const n=U(e).find((t=>t.id===o));return g(n,t?.from&&t.from),t?.select?t.select(n):n}})}function Y(t){return G({select:e=>{let o=U(e);return t?.select?t.select(o):o}})}function J(t){return z({...t,select:e=>"function"==typeof t.select?t.select(e?.loaderDeps):e?.loaderDeps})}function X(t){return z({...t,select:e=>"function"==typeof t.select?t.select(e?.loaderData):e?.loaderData})}function q(){const t=r.useRef(0),e=Q(),o=G({select:t=>M(t,["isLoading","location","resolvedLocation","isTransitioning"])}),[n,s]=r.useTransition();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 j((()=>{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]),j((()=>{if(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]),j((()=>{window.__TSR_DEHYDRATED__||t.current||(t.current++,a())}),[]),null}function V(t,e){return[...t.cachedMatches,...t.pendingMatches??[],...t.matches].find((t=>t.id===e))}function G(t){return function(t,e=(t=>t)){return b.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,R)}(Q().__store,t?.select)}function Q(){const e="undefined"!=typeof document&&window.__TSR_ROUTER_CONTEXT__||t.routerContext;return r.useContext(e)}function Z(t){return"object"==typeof t&&null!==t&&!(t instanceof Promise)&&!t.then&&"__deferredState"in t}function tt({promise:t}){const e=Q();let o=t.__deferredState;const n=`__TSR__DEFERRED__${o.uid}`;if(Z(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 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&&"/"===C(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)return!!e?.value&&(a["*"]=et(r.slice(t).map((t=>t.value))),!0);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 G({select:e=>{const o=C(e.matches)?.params;return t?.select?t.select(o):o}})}function ft(t){return z({...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 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);update=t=>(Object.assign(this.options,t),this);useMatch=t=>z({...t,from:this.id});useRouteContext=t=>z({...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=>J({...t,from:this.id});useLoaderData=t=>X({...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 wt(t){const e=Q(),o=z({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:b,onClick:S,onFocus:R,onMouseEnter:E,onMouseLeave:L,onTouchStart:P,...x}=t,C={from:t.to?o:void 0,...t};let M="internal";try{new URL(`${d}`),M="external"}catch{}if("external"===M)return{href:d};const O=e.buildLocation(C),k=m??e.options.defaultPreload,I=y??e.options.defaultPreloadDelay??0,j=G({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)||D(t.location.search,O.search,!i?.exact);return n&&r&&s}}),$=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},B=j?T(s,{})??{}:{},A=j?{}:T(a,{})??{};return{...B,...A,...x,href:c?void 0:O.maskedLocation?O.maskedLocation.href:O.href,onClick:$([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:w,startTransition:v}))}]),onFocus:$([R,t=>{k&&e.preloadRoute(C).catch((t=>{console.warn(t),console.warn(vt)}))}]),onMouseEnter:$([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(vt)}))}),I)}}]),onMouseLeave:$([L,t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)}]),onTouchStart:$([P,t=>{k&&e.preloadRoute(C).catch((t=>{console.warn(t),console.warn(vt)}))}]),target:r,style:{..._,...B.style,...A.style},className:[b,B.className,A.className].filter(Boolean).join(" ")||void 0,...c?{role:"link","aria-disabled":!0}:void 0,"data-status":j?"active":void 0}}const _t=r.forwardRef(((t,e)=>{const o=wt(t);return r.createElement("a",gt({ref:e},o,{children:"function"==typeof t.children?t.children({isActive:"active"===o["data-status"]}):t.children}))}));function bt(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=bt(o).toString();return n?`?${n}`:""}}const Tt=["component","errorComponent","pendingComponent"];class Mt extends Error{}class Ot extends Error{}function kt(t){return{isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:{...t},location:t,matches:[],pendingMatches:[],cachedMatches:[],lastUpdated:Date.now()}}const It="undefined"!=typeof window?r.useLayoutEffect:r.useEffect,Dt="window",jt="___";let $t=new WeakSet;let Bt="undefined"!=typeof window&&window.sessionStorage?(()=>{const t="tsr-scroll-restoration-v2";return{state:JSON.parse(window.sessionStorage.getItem(t)||"null")||{cached:{},next:{}},set:e=>{Bt.state=T(e,Bt.state),window.sessionStorage.setItem(t,JSON.stringify(Bt.state))}}})():void 0;const At=t=>t.state.key;function Nt(t){const e=Q();It((()=>{const o=t?.getKey||At,{history:n}=window;n.scrollRestoration&&(n.scrollRestoration="manual");const r=t=>{if($t.has(t.target))return;$t.add(t.target);let e="";if(t.target===document||t.target===window)e=Dt;else{const o=t.target.getAttribute("data-scroll-restoration-id");e=o?`[data-scroll-restoration-id="${o}"]`:Ht(t.target)}Bt.state.next[e]||Bt.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 Bt.state.next){const o=Bt.state.next[t];if(t===Dt)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}Bt.set((n=>{const r={...n.next};return delete r[t],{...n,next:r,cached:{...n.cached,[[e,t].join(jt)]:o}}}))}}})),a=e.subscribe("onResolved",(o=>{if(o.pathChanged){if(!e.resetNextScroll)return;e.resetNextScroll=!0;const n=(t?.getKey||At)(o.toLocation);let r=!1;for(const t in Bt.state.cached){const e=Bt.state.cached[t],[o,s]=t.split(jt);if(o===n)if(s===Dt)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),Bt.set((t=>({...t,next:{}}))),$t=new WeakSet}}));return()=>{document.removeEventListener("scroll",r),s(),a()}}),[])}function Ht(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 Ft(t,e=!0){const{history:o}=Q();r.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 Ft(t,e),o??null},t.CatchBoundary=E,t.CatchBoundaryImpl=L,t.ErrorComponent=P,t.FileRoute=class{constructor(t){this.path=t}createRoute=t=>{const e=new mt(t);return e.isRoot=!1,e}},t.Link=_t,t.Match=H,t.MatchRoute=function(t){const e=W()(t);return"function"==typeof t.children?t.children(e):e?t.children:null},t.Matches=A,t.Navigate=function(t){const{navigate:e}=Q(),o=z({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=K,t.PathParamError=Ot,t.RootRoute=yt,t.Route=mt,t.RouteApi=class{constructor({id:t}){this.id=t}useMatch=t=>z({...t,from:this.id});useRouteContext=t=>z({...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=>J({...t,from:this.id});useLoaderData=t=>X({...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=>{this.options={...this.options,...t},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()),this.latestLocation=this.parseLocation()),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),this.__store||(this.__store=new S(kt(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:O(t?.search,s),hash:n.split("#").reverse()[0]??"",href:`${e}${o}${n}`,state:O(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 Ot(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 Mt(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=V(this.state,f),m=this.state.matches.find((t=>t.id===f))?"stay":"enter",y=!(!t.options.loader&&!Tt.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=O(g.search,a),g.searchError=l,c.push(g)})),c};cancelMatch=t=>{V(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).at(-1)?.search||o.search,r=t.from??o.pathname;let s=this.resolvePathWithBase(r,`${t.to??""}`);const a=this.matchRoutes(r,n),i=e?.filter((t=>a?.find((e=>e.routeId===t.routeId)))),c={...C(a)?.params};let l=!0===(t.params??!0)?c:T(t.params,c);l&&e?.map((t=>this.looseRoutesById[t.routeId].options.stringifyParams)).filter(Boolean).forEach((t=>{l={...l,...t(l)}})),s=ct(s,l??{});const u=i?.map((t=>this.looseRoutesById[t.routeId].options.preSearchFilters??[])).flat().filter(Boolean)??[],h=i?.map((t=>this.looseRoutesById[t.routeId].options.postSearchFilters??[])).flat().filter(Boolean)??[],d=u?.length?u?.reduce(((t,e)=>e(t)),n):n,f=!0===t.search?d:t.search?T(t.search,d)??{}:u?.length?d:{},p=O(n,h?.length?h.reduce(((t,e)=>e(t)),f):f),m=this.options.stringifySearch(p),y=!0===t.hash?o.hash:t.hash?T(t.hash,o.hash):o.hash,g=y?`#${y}`:"";let v=!0===t.state?o.state:t.state?T(t.state,o.state):o.state;return v=O(o.state,v),{pathname:s,search:p,searchStr:m,state:v,hash:y,href:`${s}${m}${g}`,unmaskOnReload:t.unmaskOnReload}},o=(t={},o)=>{let n=e(t),r=o?e(o):void 0;if(!r){let t={},s=this.options.routeMasks?.find((e=>{const o=lt(this.basepath,n.pathname,{to:e.from,caseSensitive:!1,fuzzy:!1});return!!o&&(t=o,!0)}));s&&(s={...s,from:ct(s.from,t)},r=e(o=s))}const s=this.matchRoutes(n.pathname,n.search),a=r?this.matchRoutes(r.pathname,r.search):void 0,i=r?e(o,a):void 0,c=e(t,s);return i&&(c.maskedLocation=i),c};return t.mask?o(t,{...M(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),r=void 0===t?t:String(t);let s;try{new URL(`${n}`),s=!0}catch(t){}return g(!s),this.buildAndCommitLocation({...o,from:r,to:n})};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=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(l))throw l;const u={...r,...l};e[t]=n={...n,routeContext:O(n.routeContext,l),context:O(n.context,u),abortController:i}}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&&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=V(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(Tt.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)},w=Date.now()-r.updatedAt;let _,b=o?u.options.preloadStaleTime??this.options.defaultPreloadStaleTime??3e4:u.options.staleTime??this.options.defaultStaleTime??0;const S=u.options.shouldReload;_="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&&new Promise((t=>setTimeout(t,p))).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)?!!D(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__${$(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=>M(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(A,null)):r.createElement(A,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 Nt(t),null},t.SearchParamError=Mt,t.cleanPath=ot,t.componentTypes=Tt,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=D,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=bt,t.escapeJSON=$,t.functionalUpdate=T,t.getInitialRouterState=kt,t.getRouteMatch=V,t.interpolatePath=ct,t.invariant=g,t.isDehydratedDeferred=Z,t.isPlainObject=k,t.isRedirect=Et,t.isServer=x,t.joinPaths=et,t.last=C,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=B,t.matchPathname=lt,t.parsePathname=it,t.parseSearchWith=xt,t.pick=M,t.redirect=function(t){if(t.isRedirect=!0,t.throw)throw t;return t},t.removeBasepath=ut,t.replaceEqualDeep=O,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=tt,t.useBlocker=Ft,t.useElementScrollRestoration=function(t){const e=Q(),o=t?.getKey||At;let n="";if(t.id)n=`[data-scroll-restoration-id="${t.id}"]`;else{const e=t.getElement?.();if(!e)return;n=Ht(e)}const r=[o(e.latestLocation),n].join(jt);return Bt.state.cached[r]},t.useLayoutEffect=j,t.useLinkProps=wt,t.useLoaderData=X,t.useLoaderDeps=J,t.useMatch=z,t.useMatchRoute=W,t.useMatches=Y,t.useNavigate=function(t){const{navigate:e}=Q(),o=z({strict:!1,select:t=>t.pathname});return r.useCallback((n=>e({from:n?.to?o:void 0,...t,...n})),[])},t.useParams=dt,t.useParentMatches=function(t){const e=r.useContext(B);return Y({select:o=>(o=o.slice(o.findIndex((t=>t.id===e))),t?.select?t.select(o):o)})},t.useRouteContext=function(t){return z({...t,select:e=>t?.select?t.select(e.context):e.context})},t.useRouter=Q,t.useRouterState=G,t.useScrollRestoration=Nt,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=function(t,e){}}));
|
|
22
22
|
//# sourceMappingURL=index.production.js.map
|