Socket
Socket
Sign inDemoInstall

@tanstack/router-core

Package Overview
Dependencies
Maintainers
2
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/router-core - npm Package Compare versions

Comparing version 0.0.1-beta.160 to 0.0.1-beta.161

74

build/cjs/router.js

@@ -45,3 +45,2 @@ /**

const next = this.__store.state;
console.log(Object.values(next.matchesById).find(d => d.status === 'error'));
const matchesByIdChanged = prev.matchesById !== next.matchesById;

@@ -473,3 +472,2 @@ let matchesChanged;

}
console.log('set error');
this.setRouteMatch(match.id, s => ({

@@ -527,13 +525,13 @@ ...s,

};
const handleIfRedirect = err => {
if (isRedirect(err)) {
if (!opts?.preload) {
this.navigate(err);
}
return true;
}
return false;
};
const load = async () => {
let latestPromise;
const handleError = err => {
if (isRedirect(err)) {
if (!opts?.preload) {
this.navigate(err);
}
return true;
}
return false;
};
try {

@@ -555,19 +553,23 @@ const componentsPromise = Promise.all(componentTypes.map(async type => {

} catch (loaderError) {
let latestError = loaderError;
if (latestPromise = checkLatest()) return await latestPromise;
handleError(loaderError);
let error = loaderError;
try {
if (route.options.onLoadError) {
route.options.onLoadError?.(loaderError);
} else {
route.options.onError?.(loaderError);
if (handleIfRedirect(loaderError)) return;
if (route.options.onLoadError) {
try {
route.options.onLoadError(loaderError);
} catch (onLoadError) {
latestError = onLoadError;
if (handleIfRedirect(onLoadError)) return;
}
} catch (errorHandlerErr) {
error = errorHandlerErr;
handleError(error);
}
console.log('set error');
if ((!route.options.onLoadError || latestError !== loaderError) && route.options.onError) {
try {
route.options.onError(latestError);
} catch (onErrorError) {
if (handleIfRedirect(onErrorError)) return;
}
}
this.setRouteMatch(match.id, s => ({
...s,
error: error,
error: loaderError,
status: 'error',

@@ -577,14 +579,19 @@ isFetching: false,

}));
console.log(this.getRouteMatch(match.id)?.status);
}
};
const loadPromise = load();
this.setRouteMatch(match.id, s => ({
...s,
status: s.status !== 'success' ? 'pending' : s.status,
isFetching: true,
loadPromise,
fetchedAt,
invalid: false
}));
let loadPromise;
this.__store.batch(() => {
this.setRouteMatch(match.id, s => ({
...s,
// status: s.status !== 'success' ? 'pending' : s.status,
isFetching: true,
fetchedAt,
invalid: false
}));
loadPromise = load();
this.setRouteMatch(match.id, s => ({
...s,
loadPromise
}));
});
await loadPromise;

@@ -1025,3 +1032,2 @@ })());

const invalidAt = updatedAt + (opts?.maxAge ?? route.options.maxAge ?? this.options.defaultMaxAge ?? Infinity);
console.log('set success');
this.setRouteMatch(id, s => ({

@@ -1028,0 +1034,0 @@ ...s,

@@ -719,3 +719,2 @@ /**

const next = this.__store.state;
console.log(Object.values(next.matchesById).find(d => d.status === 'error'));
const matchesByIdChanged = prev.matchesById !== next.matchesById;

@@ -1147,3 +1146,2 @@ let matchesChanged;

}
console.log('set error');
this.setRouteMatch(match.id, s => ({

@@ -1201,13 +1199,13 @@ ...s,

};
const handleIfRedirect = err => {
if (isRedirect(err)) {
if (!opts?.preload) {
this.navigate(err);
}
return true;
}
return false;
};
const load = async () => {
let latestPromise;
const handleError = err => {
if (isRedirect(err)) {
if (!opts?.preload) {
this.navigate(err);
}
return true;
}
return false;
};
try {

@@ -1229,19 +1227,23 @@ const componentsPromise = Promise.all(componentTypes.map(async type => {

} catch (loaderError) {
let latestError = loaderError;
if (latestPromise = checkLatest()) return await latestPromise;
handleError(loaderError);
let error = loaderError;
try {
if (route.options.onLoadError) {
route.options.onLoadError?.(loaderError);
} else {
route.options.onError?.(loaderError);
if (handleIfRedirect(loaderError)) return;
if (route.options.onLoadError) {
try {
route.options.onLoadError(loaderError);
} catch (onLoadError) {
latestError = onLoadError;
if (handleIfRedirect(onLoadError)) return;
}
} catch (errorHandlerErr) {
error = errorHandlerErr;
handleError(error);
}
console.log('set error');
if ((!route.options.onLoadError || latestError !== loaderError) && route.options.onError) {
try {
route.options.onError(latestError);
} catch (onErrorError) {
if (handleIfRedirect(onErrorError)) return;
}
}
this.setRouteMatch(match.id, s => ({
...s,
error: error,
error: loaderError,
status: 'error',

@@ -1251,14 +1253,19 @@ isFetching: false,

}));
console.log(this.getRouteMatch(match.id)?.status);
}
};
const loadPromise = load();
this.setRouteMatch(match.id, s => ({
...s,
status: s.status !== 'success' ? 'pending' : s.status,
isFetching: true,
loadPromise,
fetchedAt,
invalid: false
}));
let loadPromise;
this.__store.batch(() => {
this.setRouteMatch(match.id, s => ({
...s,
// status: s.status !== 'success' ? 'pending' : s.status,
isFetching: true,
fetchedAt,
invalid: false
}));
loadPromise = load();
this.setRouteMatch(match.id, s => ({
...s,
loadPromise
}));
});
await loadPromise;

@@ -1699,3 +1706,2 @@ })());

const invalidAt = updatedAt + (opts?.maxAge ?? route.options.maxAge ?? this.options.defaultMaxAge ?? Infinity);
console.log('set success');
this.setRouteMatch(id, s => ({

@@ -1702,0 +1708,0 @@ ...s,

@@ -14,7 +14,7 @@ {

"name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"uid": "284f-43"
"uid": "4c32-43"
},
{
"name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"uid": "284f-45"
"uid": "4c32-45"
}

@@ -30,35 +30,35 @@ ]

{
"uid": "284f-47",
"uid": "4c32-47",
"name": "history.ts"
},
{
"uid": "284f-49",
"uid": "4c32-49",
"name": "utils.ts"
},
{
"uid": "284f-51",
"uid": "4c32-51",
"name": "path.ts"
},
{
"uid": "284f-53",
"uid": "4c32-53",
"name": "qss.ts"
},
{
"uid": "284f-55",
"uid": "4c32-55",
"name": "route.ts"
},
{
"uid": "284f-57",
"uid": "4c32-57",
"name": "fileRoute.ts"
},
{
"uid": "284f-61",
"uid": "4c32-61",
"name": "searchParams.ts"
},
{
"uid": "284f-63",
"uid": "4c32-63",
"name": "router.ts"
},
{
"uid": "284f-65",
"uid": "4c32-65",
"name": "index.ts"

@@ -70,3 +70,3 @@ }

"name": "store/build/esm/index.js",
"uid": "284f-59"
"uid": "4c32-59"
}

@@ -81,80 +81,80 @@ ]

"nodeParts": {
"284f-43": {
"4c32-43": {
"renderedLength": 199,
"gzipLength": 134,
"brotliLength": 0,
"mainUid": "284f-42"
"mainUid": "4c32-42"
},
"284f-45": {
"4c32-45": {
"renderedLength": 48,
"gzipLength": 65,
"brotliLength": 0,
"mainUid": "284f-44"
"mainUid": "4c32-44"
},
"284f-47": {
"4c32-47": {
"renderedLength": 6426,
"gzipLength": 1539,
"brotliLength": 0,
"mainUid": "284f-46"
"mainUid": "4c32-46"
},
"284f-49": {
"4c32-49": {
"renderedLength": 2821,
"gzipLength": 990,
"brotliLength": 0,
"mainUid": "284f-48"
"mainUid": "4c32-48"
},
"284f-51": {
"4c32-51": {
"renderedLength": 6028,
"gzipLength": 1423,
"brotliLength": 0,
"mainUid": "284f-50"
"mainUid": "4c32-50"
},
"284f-53": {
"4c32-53": {
"renderedLength": 1371,
"gzipLength": 552,
"brotliLength": 0,
"mainUid": "284f-52"
"mainUid": "4c32-52"
},
"284f-55": {
"4c32-55": {
"renderedLength": 2251,
"gzipLength": 784,
"brotliLength": 0,
"mainUid": "284f-54"
"mainUid": "4c32-54"
},
"284f-57": {
"4c32-57": {
"renderedLength": 223,
"gzipLength": 143,
"brotliLength": 0,
"mainUid": "284f-56"
"mainUid": "4c32-56"
},
"284f-59": {
"4c32-59": {
"renderedLength": 1969,
"gzipLength": 653,
"brotliLength": 0,
"mainUid": "284f-58"
"mainUid": "4c32-58"
},
"284f-61": {
"4c32-61": {
"renderedLength": 1924,
"gzipLength": 603,
"brotliLength": 0,
"mainUid": "284f-60"
"mainUid": "4c32-60"
},
"284f-63": {
"renderedLength": 38861,
"gzipLength": 8573,
"4c32-63": {
"renderedLength": 39065,
"gzipLength": 8585,
"brotliLength": 0,
"mainUid": "284f-62"
"mainUid": "4c32-62"
},
"284f-65": {
"4c32-65": {
"renderedLength": 0,
"gzipLength": 0,
"brotliLength": 0,
"mainUid": "284f-64"
"mainUid": "4c32-64"
}
},
"nodeMetas": {
"284f-42": {
"4c32-42": {
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"moduleParts": {
"index.production.js": "284f-43"
"index.production.js": "4c32-43"
},

@@ -164,16 +164,16 @@ "imported": [],

{
"uid": "284f-64"
"uid": "4c32-64"
},
{
"uid": "284f-54"
"uid": "4c32-54"
},
{
"uid": "284f-62"
"uid": "4c32-62"
}
]
},
"284f-44": {
"4c32-44": {
"id": "/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"moduleParts": {
"index.production.js": "284f-45"
"index.production.js": "4c32-45"
},

@@ -183,10 +183,10 @@ "imported": [],

{
"uid": "284f-64"
"uid": "4c32-64"
}
]
},
"284f-46": {
"4c32-46": {
"id": "/packages/router-core/src/history.ts",
"moduleParts": {
"index.production.js": "284f-47"
"index.production.js": "4c32-47"
},

@@ -196,13 +196,13 @@ "imported": [],

{
"uid": "284f-64"
"uid": "4c32-64"
},
{
"uid": "284f-62"
"uid": "4c32-62"
}
]
},
"284f-48": {
"4c32-48": {
"id": "/packages/router-core/src/utils.ts",
"moduleParts": {
"index.production.js": "284f-49"
"index.production.js": "4c32-49"
},

@@ -212,20 +212,20 @@ "imported": [],

{
"uid": "284f-64"
"uid": "4c32-64"
},
{
"uid": "284f-50"
"uid": "4c32-50"
},
{
"uid": "284f-62"
"uid": "4c32-62"
}
]
},
"284f-50": {
"4c32-50": {
"id": "/packages/router-core/src/path.ts",
"moduleParts": {
"index.production.js": "284f-51"
"index.production.js": "4c32-51"
},
"imported": [
{
"uid": "284f-48"
"uid": "4c32-48"
}

@@ -235,16 +235,16 @@ ],

{
"uid": "284f-64"
"uid": "4c32-64"
},
{
"uid": "284f-54"
"uid": "4c32-54"
},
{
"uid": "284f-62"
"uid": "4c32-62"
}
]
},
"284f-52": {
"4c32-52": {
"id": "/packages/router-core/src/qss.ts",
"moduleParts": {
"index.production.js": "284f-53"
"index.production.js": "4c32-53"
},

@@ -254,20 +254,20 @@ "imported": [],

{
"uid": "284f-64"
"uid": "4c32-64"
},
{
"uid": "284f-60"
"uid": "4c32-60"
}
]
},
"284f-54": {
"4c32-54": {
"id": "/packages/router-core/src/route.ts",
"moduleParts": {
"index.production.js": "284f-55"
"index.production.js": "4c32-55"
},
"imported": [
{
"uid": "284f-42"
"uid": "4c32-42"
},
{
"uid": "284f-50"
"uid": "4c32-50"
}

@@ -277,17 +277,17 @@ ],

{
"uid": "284f-64"
"uid": "4c32-64"
},
{
"uid": "284f-56"
"uid": "4c32-56"
}
]
},
"284f-56": {
"4c32-56": {
"id": "/packages/router-core/src/fileRoute.ts",
"moduleParts": {
"index.production.js": "284f-57"
"index.production.js": "4c32-57"
},
"imported": [
{
"uid": "284f-54"
"uid": "4c32-54"
}

@@ -297,10 +297,10 @@ ],

{
"uid": "284f-64"
"uid": "4c32-64"
}
]
},
"284f-58": {
"4c32-58": {
"id": "/packages/store/build/esm/index.js",
"moduleParts": {
"index.production.js": "284f-59"
"index.production.js": "4c32-59"
},

@@ -310,14 +310,14 @@ "imported": [],

{
"uid": "284f-68"
"uid": "4c32-68"
}
]
},
"284f-60": {
"4c32-60": {
"id": "/packages/router-core/src/searchParams.ts",
"moduleParts": {
"index.production.js": "284f-61"
"index.production.js": "4c32-61"
},
"imported": [
{
"uid": "284f-52"
"uid": "4c32-52"
}

@@ -327,32 +327,32 @@ ],

{
"uid": "284f-64"
"uid": "4c32-64"
},
{
"uid": "284f-62"
"uid": "4c32-62"
}
]
},
"284f-62": {
"4c32-62": {
"id": "/packages/router-core/src/router.ts",
"moduleParts": {
"index.production.js": "284f-63"
"index.production.js": "4c32-63"
},
"imported": [
{
"uid": "284f-68"
"uid": "4c32-68"
},
{
"uid": "284f-42"
"uid": "4c32-42"
},
{
"uid": "284f-50"
"uid": "4c32-50"
},
{
"uid": "284f-60"
"uid": "4c32-60"
},
{
"uid": "284f-48"
"uid": "4c32-48"
},
{
"uid": "284f-46"
"uid": "4c32-46"
}

@@ -362,47 +362,47 @@ ],

{
"uid": "284f-64"
"uid": "4c32-64"
}
]
},
"284f-64": {
"4c32-64": {
"id": "/packages/router-core/src/index.ts",
"moduleParts": {
"index.production.js": "284f-65"
"index.production.js": "4c32-65"
},
"imported": [
{
"uid": "284f-42"
"uid": "4c32-42"
},
{
"uid": "284f-44"
"uid": "4c32-44"
},
{
"uid": "284f-46"
"uid": "4c32-46"
},
{
"uid": "284f-66"
"uid": "4c32-66"
},
{
"uid": "284f-50"
"uid": "4c32-50"
},
{
"uid": "284f-52"
"uid": "4c32-52"
},
{
"uid": "284f-54"
"uid": "4c32-54"
},
{
"uid": "284f-56"
"uid": "4c32-56"
},
{
"uid": "284f-67"
"uid": "4c32-67"
},
{
"uid": "284f-62"
"uid": "4c32-62"
},
{
"uid": "284f-60"
"uid": "4c32-60"
},
{
"uid": "284f-48"
"uid": "4c32-48"
}

@@ -413,3 +413,3 @@ ],

},
"284f-66": {
"4c32-66": {
"id": "/packages/router-core/src/link.ts",

@@ -420,7 +420,7 @@ "moduleParts": {},

{
"uid": "284f-64"
"uid": "4c32-64"
}
]
},
"284f-67": {
"4c32-67": {
"id": "/packages/router-core/src/routeInfo.ts",

@@ -431,7 +431,7 @@ "moduleParts": {},

{
"uid": "284f-64"
"uid": "4c32-64"
}
]
},
"284f-68": {
"4c32-68": {
"id": "/packages/react-store/build/esm/index.js",

@@ -441,6 +441,6 @@ "moduleParts": {},

{
"uid": "284f-69"
"uid": "4c32-69"
},
{
"uid": "284f-58"
"uid": "4c32-58"
}

@@ -450,7 +450,7 @@ ],

{
"uid": "284f-62"
"uid": "4c32-62"
}
]
},
"284f-69": {
"4c32-69": {
"id": "use-sync-external-store/shim/with-selector",

@@ -461,3 +461,3 @@ "moduleParts": {},

{
"uid": "284f-68"
"uid": "4c32-68"
}

@@ -464,0 +464,0 @@ ],

@@ -11,3 +11,3 @@ /**

*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("use-sync-external-store/shim/with-selector")):"function"==typeof define&&define.amd?define(["exports","use-sync-external-store/shim/with-selector"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RouterCore={})}(this,(function(t){"use strict";function e(t,e){if(!t)throw new Error("Invariant failed")}const s="pushstate",r="popstate",a="beforeunload",o=t=>(t.preventDefault(),t.returnValue=""),i=()=>{removeEventListener(a,o,{capture:!0})};function n(t){let e=t.getLocation(),s=()=>{},r=new Set,n=[],h=[];const c=()=>{if(n.length)n[0]?.(c,(()=>{n=[],i()}));else{for(;h.length;)h.shift()?.();t.listener||u()}},l=t=>{h.push(t),c()},u=()=>{e=t.getLocation(),r.forEach((t=>t()))};return{get location(){return e},listen:e=>(0===r.size&&(s="function"==typeof t.listener?t.listener(u):()=>{}),r.add(e),()=>{r.delete(e),0===r.size&&s()}),push:(e,s)=>{l((()=>{t.pushState(e,s)}))},replace:(e,s)=>{l((()=>{t.replaceState(e,s)}))},go:e=>{l((()=>{t.go(e)}))},back:()=>{l((()=>{t.back()}))},forward:()=>{l((()=>{t.forward()}))},createHref:e=>t.createHref(e),block:t=>(n.push(t),1===n.length&&addEventListener(a,o,{capture:!0}),()=>{n=n.filter((e=>e!==t)),n.length||i()})}}function h(t){const e=t?.getHref??(()=>`${window.location.pathname}${window.location.search}${window.location.hash}`),a=t?.createHref??(t=>t);return n({getLocation:()=>l(e(),history.state),listener:t=>{window.addEventListener(s,t),window.addEventListener(r,t);var e=window.history.pushState;window.history.pushState=function(){let s=e.apply(history,arguments);return t(),s};var a=window.history.replaceState;return window.history.replaceState=function(){let e=a.apply(history,arguments);return t(),e},()=>{window.history.pushState=e,window.history.replaceState=a,window.removeEventListener(s,t),window.removeEventListener(r,t)}},pushState:(t,e)=>{window.history.pushState({...e,key:u()},"",a(t))},replaceState:(t,e)=>{window.history.replaceState({...e,key:u()},"",a(t))},back:()=>window.history.back(),forward:()=>window.history.forward(),go:t=>window.history.go(t),createHref:t=>a(t)})}function c(t={initialEntries:["/"]}){const e=t.initialEntries;let s=t.initialIndex??e.length-1,r={};return n({getLocation:()=>l(e[s],r),listener:!1,pushState:(t,a)=>{r={...a,key:u()},e.push(t),s++},replaceState:(t,a)=>{r={...a,key:u()},e[s]=t},back:()=>{s--},forward:()=>{s=Math.min(s+1,e.length-1)},go:t=>window.history.go(t),createHref:t=>t})}function l(t,e){let s=t.indexOf("#"),r=t.indexOf("?");return{href:t,pathname:t.substring(0,s>0?r>0?Math.min(s,r):s:r>0?r:t.length),hash:s>-1?t.substring(s):"",search:r>-1?t.slice(r,-1===s?void 0:s):"",state:e}}function u(){return(Math.random()+1).toString(36).substring(7)}function d(t){return t[t.length-1]}function p(t,e){return"function"==typeof t?t(e):t}function f(t,e){return e.reduce(((e,s)=>(e[s]=t[s],e)),{})}function m(t,e){if(t===e)return t;const s=e,r=Array.isArray(t)&&Array.isArray(s);if(r||y(t)&&y(s)){const e=r?t.length:Object.keys(t).length,a=r?s:Object.keys(s),o=a.length,i=r?[]:{};let n=0;for(let e=0;e<o;e++){const o=r?e:a[e];i[o]=m(t[o],s[o]),i[o]===t[o]&&n++}return e===o&&n===e?t:i}return s}function y(t){if(!g(t))return!1;const e=t.constructor;if(void 0===e)return!0;const s=e.prototype;return!!g(s)&&!!s.hasOwnProperty("isPrototypeOf")}function g(t){return"[object Object]"===Object.prototype.toString.call(t)}function v(t,e){return t===e||typeof t==typeof e&&(y(t)&&y(e)?!Object.keys(e).some((s=>!v(t[s],e[s]))):!(!Array.isArray(t)||!Array.isArray(e))&&(t.length===e.length&&t.every(((t,s)=>v(t,e[s])))))}function w(t){return _(t.filter(Boolean).join("/"))}function _(t){return t.replace(/\/{2,}/g,"/")}function R(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function b(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function I(t){return b(R(t))}function S(t,e,s){e=e.replace(new RegExp(`^${t}`),"/"),s=s.replace(new RegExp(`^${t}`),"/");let r=x(e);const a=x(s);a.forEach(((t,e)=>{if("/"===t.value)e?e===a.length-1&&r.push(t):r=[t];else if(".."===t.value)r.length>1&&"/"===d(r)?.value&&r.pop(),r.pop();else{if("."===t.value)return;r.push(t)}}));return _(w([t,...r.map((t=>t.value))]))}function x(t){if(!t)return[];const e=[];if("/"===(t=_(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const s=t.split("/").filter(Boolean);return e.push(...s.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 E(t,e,s=!1){return w(x(t).map((t=>{if("wildcard"===t.type){const r=e[t.value];return s?`${t.value}${r??""}`:r}return"param"===t.type?e[t.value.substring(1)]??"":t.value})))}function P(t,e,s){const r=M(t,e,s);if(!s.to||r)return r??{}}function M(t,e,s){e="/"!=t?e.substring(t.length):e;const r=`${s.to??"$"}`,a=x(e),o=x(r);e.startsWith("/")||a.unshift({type:"pathname",value:"/"}),r.startsWith("/")||o.unshift({type:"pathname",value:"/"});const i={};return(()=>{for(let t=0;t<Math.max(a.length,o.length);t++){const e=a[t],r=o[t],n=t>=a.length-1,h=t>=o.length-1;if(r){if("wildcard"===r.type)return!!e?.value&&(i["*"]=w(a.slice(t).map((t=>t.value))),!0);if("pathname"===r.type){if("/"===r.value&&!e?.value)return!0;if(e)if(s.caseSensitive){if(r.value!==e.value)return!1}else if(r.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===r.type){if("/"===e?.value)return!1;"$"!==e.value.charAt(0)&&(i[r.value.substring(1)]=e.value)}}if(!n&&h)return!!s.fuzzy}return!0})()?i:void 0}function A(t,e){var s,r,a,o="";for(s in t)if(void 0!==(a=t[s]))if(Array.isArray(a))for(r=0;r<a.length;r++)o&&(o+="&"),o+=encodeURIComponent(s)+"="+encodeURIComponent(a[r]);else o&&(o+="&"),o+=encodeURIComponent(s)+"="+encodeURIComponent(a);return(e||"")+o}function L(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||(0*+e==0&&+e+""===e?+e:e))}function D(t){for(var e,s,r={},a=t.split("&");e=a.shift();)void 0!==r[s=(e=e.split("=")).shift()]?r[s]=[].concat(r[s],L(e.shift())):r[s]=L(e.shift());return r}const B="__root__";class ${constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute,$.__onInit(this)}init=t=>{this.originalIndex=t.originalIndex,this.router=t.router;const s=this.options,r=!s?.path&&!s?.id;this.parentRoute=this.options?.getParentRoute?.(),r?this.path=B:e(this.parentRoute);let a=r?B:s.path;a&&"/"!==a&&(a=I(a));const o=s?.id||a;let i=r?B:w([this.parentRoute.id===B?"":this.parentRoute.id,o]);a===B&&(a="/"),i!==B&&(i=w(["/",i]));const n=i===B?"/":w([this.parentRoute.fullPath,a]);this.path=a,this.id=i,this.fullPath=n,this.to=n};addChildren=t=>(this.children=t,this);update=t=>(Object.assign(this.options,t),this);static __onInit=t=>{}}class O extends ${constructor(t){super(t)}}
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("use-sync-external-store/shim/with-selector")):"function"==typeof define&&define.amd?define(["exports","use-sync-external-store/shim/with-selector"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RouterCore={})}(this,(function(t){"use strict";function e(t,e){if(!t)throw new Error("Invariant failed")}const r="pushstate",s="popstate",a="beforeunload",o=t=>(t.preventDefault(),t.returnValue=""),i=()=>{removeEventListener(a,o,{capture:!0})};function n(t){let e=t.getLocation(),r=()=>{},s=new Set,n=[],h=[];const c=()=>{if(n.length)n[0]?.(c,(()=>{n=[],i()}));else{for(;h.length;)h.shift()?.();t.listener||u()}},l=t=>{h.push(t),c()},u=()=>{e=t.getLocation(),s.forEach((t=>t()))};return{get location(){return e},listen:e=>(0===s.size&&(r="function"==typeof t.listener?t.listener(u):()=>{}),s.add(e),()=>{s.delete(e),0===s.size&&r()}),push:(e,r)=>{l((()=>{t.pushState(e,r)}))},replace:(e,r)=>{l((()=>{t.replaceState(e,r)}))},go:e=>{l((()=>{t.go(e)}))},back:()=>{l((()=>{t.back()}))},forward:()=>{l((()=>{t.forward()}))},createHref:e=>t.createHref(e),block:t=>(n.push(t),1===n.length&&addEventListener(a,o,{capture:!0}),()=>{n=n.filter((e=>e!==t)),n.length||i()})}}function h(t){const e=t?.getHref??(()=>`${window.location.pathname}${window.location.search}${window.location.hash}`),a=t?.createHref??(t=>t);return n({getLocation:()=>l(e(),history.state),listener:t=>{window.addEventListener(r,t),window.addEventListener(s,t);var e=window.history.pushState;window.history.pushState=function(){let r=e.apply(history,arguments);return t(),r};var a=window.history.replaceState;return window.history.replaceState=function(){let e=a.apply(history,arguments);return t(),e},()=>{window.history.pushState=e,window.history.replaceState=a,window.removeEventListener(r,t),window.removeEventListener(s,t)}},pushState:(t,e)=>{window.history.pushState({...e,key:u()},"",a(t))},replaceState:(t,e)=>{window.history.replaceState({...e,key:u()},"",a(t))},back:()=>window.history.back(),forward:()=>window.history.forward(),go:t=>window.history.go(t),createHref:t=>a(t)})}function c(t={initialEntries:["/"]}){const e=t.initialEntries;let r=t.initialIndex??e.length-1,s={};return n({getLocation:()=>l(e[r],s),listener:!1,pushState:(t,a)=>{s={...a,key:u()},e.push(t),r++},replaceState:(t,a)=>{s={...a,key:u()},e[r]=t},back:()=>{r--},forward:()=>{r=Math.min(r+1,e.length-1)},go:t=>window.history.go(t),createHref:t=>t})}function l(t,e){let r=t.indexOf("#"),s=t.indexOf("?");return{href:t,pathname:t.substring(0,r>0?s>0?Math.min(r,s):r:s>0?s:t.length),hash:r>-1?t.substring(r):"",search:s>-1?t.slice(s,-1===r?void 0:r):"",state:e}}function u(){return(Math.random()+1).toString(36).substring(7)}function d(t){return t[t.length-1]}function p(t,e){return"function"==typeof t?t(e):t}function f(t,e){return e.reduce(((e,r)=>(e[r]=t[r],e)),{})}function m(t,e){if(t===e)return t;const r=e,s=Array.isArray(t)&&Array.isArray(r);if(s||y(t)&&y(r)){const e=s?t.length:Object.keys(t).length,a=s?r:Object.keys(r),o=a.length,i=s?[]:{};let n=0;for(let e=0;e<o;e++){const o=s?e:a[e];i[o]=m(t[o],r[o]),i[o]===t[o]&&n++}return e===o&&n===e?t:i}return r}function y(t){if(!g(t))return!1;const e=t.constructor;if(void 0===e)return!0;const r=e.prototype;return!!g(r)&&!!r.hasOwnProperty("isPrototypeOf")}function g(t){return"[object Object]"===Object.prototype.toString.call(t)}function v(t,e){return t===e||typeof t==typeof e&&(y(t)&&y(e)?!Object.keys(e).some((r=>!v(t[r],e[r]))):!(!Array.isArray(t)||!Array.isArray(e))&&(t.length===e.length&&t.every(((t,r)=>v(t,e[r])))))}function w(t){return _(t.filter(Boolean).join("/"))}function _(t){return t.replace(/\/{2,}/g,"/")}function R(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function b(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function I(t){return b(R(t))}function S(t,e,r){e=e.replace(new RegExp(`^${t}`),"/"),r=r.replace(new RegExp(`^${t}`),"/");let s=E(e);const a=E(r);a.forEach(((t,e)=>{if("/"===t.value)e?e===a.length-1&&s.push(t):s=[t];else if(".."===t.value)s.length>1&&"/"===d(s)?.value&&s.pop(),s.pop();else{if("."===t.value)return;s.push(t)}}));return _(w([t,...s.map((t=>t.value))]))}function E(t){if(!t)return[];const e=[];if("/"===(t=_(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const r=t.split("/").filter(Boolean);return e.push(...r.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 x(t,e,r=!1){return w(E(t).map((t=>{if("wildcard"===t.type){const s=e[t.value];return r?`${t.value}${s??""}`:s}return"param"===t.type?e[t.value.substring(1)]??"":t.value})))}function P(t,e,r){const s=M(t,e,r);if(!r.to||s)return s??{}}function M(t,e,r){e="/"!=t?e.substring(t.length):e;const s=`${r.to??"$"}`,a=E(e),o=E(s);e.startsWith("/")||a.unshift({type:"pathname",value:"/"}),s.startsWith("/")||o.unshift({type:"pathname",value:"/"});const i={};return(()=>{for(let t=0;t<Math.max(a.length,o.length);t++){const e=a[t],s=o[t],n=t>=a.length-1,h=t>=o.length-1;if(s){if("wildcard"===s.type)return!!e?.value&&(i["*"]=w(a.slice(t).map((t=>t.value))),!0);if("pathname"===s.type){if("/"===s.value&&!e?.value)return!0;if(e)if(r.caseSensitive){if(s.value!==e.value)return!1}else if(s.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===s.type){if("/"===e?.value)return!1;"$"!==e.value.charAt(0)&&(i[s.value.substring(1)]=e.value)}}if(!n&&h)return!!r.fuzzy}return!0})()?i:void 0}function L(t,e){var r,s,a,o="";for(r in t)if(void 0!==(a=t[r]))if(Array.isArray(a))for(s=0;s<a.length;s++)o&&(o+="&"),o+=encodeURIComponent(r)+"="+encodeURIComponent(a[s]);else o&&(o+="&"),o+=encodeURIComponent(r)+"="+encodeURIComponent(a);return(e||"")+o}function A(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||(0*+e==0&&+e+""===e?+e:e))}function D(t){for(var e,r,s={},a=t.split("&");e=a.shift();)void 0!==s[r=(e=e.split("=")).shift()]?s[r]=[].concat(s[r],A(e.shift())):s[r]=A(e.shift());return s}const $="__root__";class B{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute,B.__onInit(this)}init=t=>{this.originalIndex=t.originalIndex,this.router=t.router;const r=this.options,s=!r?.path&&!r?.id;this.parentRoute=this.options?.getParentRoute?.(),s?this.path=$:e(this.parentRoute);let a=s?$:r.path;a&&"/"!==a&&(a=I(a));const o=r?.id||a;let i=s?$:w([this.parentRoute.id===$?"":this.parentRoute.id,o]);a===$&&(a="/"),i!==$&&(i=w(["/",i]));const n=i===$?"/":w([this.parentRoute.fullPath,a]);this.path=a,this.id=i,this.fullPath=n,this.to=n};addChildren=t=>(this.children=t,this);update=t=>(Object.assign(this.options,t),this);static __onInit=t=>{}}class O extends B{constructor(t){super(t)}}
/**

@@ -23,3 +23,3 @@ * @tanstack/store/src/index.ts

*/
class C{listeners=new Set;_batching=!1;_flushing=0;_nextPriority=null;constructor(t,e){this.state=t,this.options=e}subscribe=t=>{this.listeners.add(t);const e=this.options?.onSubscribe?.(t,this);return()=>{this.listeners.delete(t),e?.()}};setState=(t,e)=>{const s=this.state;this.state=this.options?.updateFn?this.options.updateFn(s)(t):t(s);const r=e?.priority??this.options?.defaultPriority??"high";null===this._nextPriority||"high"===this._nextPriority?this._nextPriority=r:this._nextPriority=this.options?.defaultPriority??"high",this.options?.onUpdate?.({priority:this._nextPriority}),this._flush()};_flush=()=>{if(this._batching)return;const t=++this._flushing;this.listeners.forEach((e=>{this._flushing===t&&e({priority:this._nextPriority??"high"})}))};batch=t=>{if(this._batching)return t();this._batching=!0,t(),this._batching=!1,this._flush()}}const T=k(JSON.parse),j=H(JSON.stringify,JSON.parse);function k(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let s=D(e);for(let e in s){const r=s[e];if("string"==typeof r)try{s[e]=t(r)}catch(t){}}return s}}function H(t,e){function s(s){if("object"==typeof s&&null!==s)try{return t(s)}catch(t){}else if("string"==typeof s&&"function"==typeof e)try{return e(s),t(s)}catch(t){}return s}return t=>{(t={...t})&&Object.keys(t).forEach((e=>{const r=t[e];void 0===r||void 0===r?delete t[e]:Array.isArray(r)?t[e]=r.map(s):t[e]=s(r)}));const e=A(t).toString();return e?`?${e}`:""}}const F=["component","errorComponent","pendingComponent"];const N="undefined"==typeof window||!window.document.createElement;function U(){return{status:"idle",isFetching:!1,resolvedLocation:null,location:null,matchesById:{},matchIds:[],pendingMatchIds:[],matches:[],pendingMatches:[],lastUpdated:Date.now()}}function J(t){return!!t?.isRedirect}class W extends Error{}class z extends Error{}t.FileRoute=class{constructor(t){this.path=t}createRoute=t=>{const e=new $(t);return e.isRoot=!1,e}},t.PathParamError=z,t.RootRoute=O,t.Route=$,t.Router=class{#t;constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??j,parseSearch:t?.parseSearch??T},this.__store=new C(U(),{onUpdate:()=>{const t=this.state,e=this.__store.state;console.log(Object.values(e.matchesById).find((t=>"error"===t.status)));const s=t.matchesById!==e.matchesById;let r,a;s||(r=t.matchIds.length!==e.matchIds.length||t.matchIds.some(((t,s)=>t!==e.matchIds[s])),a=t.pendingMatchIds.length!==e.pendingMatchIds.length||t.pendingMatchIds.some(((t,s)=>t!==e.pendingMatchIds[s]))),(s||r)&&(e.matches=e.matchIds.map((t=>e.matchesById[t]))),(s||a)&&(e.pendingMatches=e.pendingMatchIds.map((t=>e.matchesById[t]))),e.isFetching=[...e.matches,...e.pendingMatches].some((t=>t.isFetching)),this.state=e},defaultPriority:"low"}),this.state=this.__store.state,this.update(t);const e=this.buildNext({hash:!0,fromCurrent:!0,search:!0,state:!0});this.state.location.href!==e.href&&this.#e({...e,replace:!0})}reset=()=>{this.__store.setState((t=>Object.assign(t,U())))};mount=()=>{this.safeLoad()};update=t=>{if(this.options={...this.options,...t,context:{...this.options.context,...t?.context}},!this.history||this.options.history&&this.options.history!==this.history){this.#t&&this.#t(),this.history=this.options.history??(N?c():h());const t=this.#s();this.__store.setState((e=>({...e,resolvedLocation:t,location:t}))),this.#t=this.history.listen((()=>{this.safeLoad({next:this.#s(this.state.location)})}))}const{basepath:e,routeTree:s}=this.options;return this.basepath=`/${I(e??"")??""}`,s&&s!==this.routeTree&&this.#r(s),this};buildNext=t=>{const e=this.#a(t),s=this.matchRoutes(e.pathname,e.search);return this.#a({...t,__matches:s})};cancelMatches=()=>{this.state.matches.forEach((t=>{this.cancelMatch(t.id)}))};cancelMatch=t=>{this.getRouteMatch(t)?.abortController?.abort()};safeLoad=async t=>{try{return this.load(t)}catch(t){}};latestLoadPromise=Promise.resolve();load=async t=>{const e=new Promise((async(s,r)=>{let a;const o=()=>this.latestLoadPromise!==e?this.latestLoadPromise:void 0;let i;this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,location:t.next}))),i=this.matchRoutes(this.state.location.pathname,this.state.location.search,{throwOnError:t?.throwOnError,debug:!0}),this.__store.setState((t=>({...t,status:"pending",pendingMatchIds:i.map((t=>t.id)),matchesById:this.#o(t.matchesById,i)})))}));try{try{await this.loadMatches(i)}catch(t){}if(a=o())return a;const t=this.state.resolvedLocation;this.__store.setState((t=>({...t,status:"idle",resolvedLocation:t.location,matchIds:t.pendingMatchIds,pendingMatchIds:[]}))),t.href!==this.state.location.href&&this.options.onRouteChange?.(),s()}catch(t){if(a=o())return a;r(t)}}));return this.latestLoadPromise=e,this.latestLoadPromise};#o=(t,e)=>{const s={...t};let r=!1;return e.forEach((t=>{s[t.id]||(r=!0,s[t.id]=t)})),r?s:t};getRoute=t=>{const s=this.routesById[t];return e(s),s};preloadRoute=async(t=this.state.location)=>{const e=this.buildNext(t),s=this.matchRoutes(e.pathname,e.search,{throwOnError:!0});return this.__store.setState((t=>({...t,matchesById:this.#o(t.matchesById,s)}))),await this.loadMatches(s,{preload:!0,maxAge:t.maxAge}),s};cleanMatches=()=>{const t=Date.now(),e=Object.values(this.state.matchesById).filter((e=>{const s=this.getRoute(e.routeId);return!this.state.matchIds.includes(e.id)&&!this.state.pendingMatchIds.includes(e.id)&&e.preloadInvalidAt<t&&(!s.options.gcMaxAge||e.updatedAt+s.options.gcMaxAge<t)})).map((t=>t.id));e.length&&this.__store.setState((t=>{const s={...t.matchesById};return e.forEach((t=>{delete s[t]})),{...t,matchesById:s}}))};matchRoutes=(t,e,s)=>{let r={},a=this.flatRoutes.find((e=>{const s=P(this.basepath,b(t),{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive});return!!s&&(r=s,!0)}))||this.routesById.__root__,o=[a];for(;a?.parentRoute;)a=a.parentRoute,a&&o.unshift(a);const i=o.map((t=>{let e;if(t.options.parseParams)try{const e=t.options.parseParams(r);Object.assign(r,e)}catch(t){if(e=new z(t.message,{cause:t}),s?.throwOnError)throw e;return e}})),n=o.map(((t,s)=>{const a=E(t.path,r),o=t.options.key?t.options.key({params:r,search:e})??"":"",n=o?JSON.stringify(o):"",h=E(t.id,r,!0)+n,c=this.getRouteMatch(h);if(c)return{...c};const l=!(!t.options.loader&&!F.some((e=>t.options[e]?.preload)));return{id:h,key:n,routeId:t.id,params:r,pathname:w([this.basepath,a]),updatedAt:Date.now(),invalidAt:1/0,preloadInvalidAt:1/0,routeSearch:{},search:{},status:l?"pending":"success",isFetching:!1,invalid:!1,error:void 0,paramsError:i[s],searchError:void 0,loaderData:void 0,loadPromise:Promise.resolve(),routeContext:void 0,context:void 0,abortController:new AbortController,fetchedAt:0}}));return n.forEach(((t,r)=>{const a=n[r-1],o=this.getRoute(t.routeId),i=(()=>{const r={search:a?.search??e,routeSearch:a?.routeSearch??e};try{const e=("object"==typeof o.options.validateSearch?o.options.validateSearch.parse:o.options.validateSearch)?.(r.search)??{},s={...r.search,...e};return{routeSearch:m(t.routeSearch,e),search:m(t.search,s)}}catch(e){if(t.searchError=new W(e.message,{cause:e}),s?.throwOnError)throw t.searchError;return r}})();Object.assign(t,{...i});const h=(()=>{try{const e=o.options.getContext?.({parentContext:a?.routeContext??{},context:a?.context??this?.options.context??{},params:t.params,search:t.search})||{};return{context:{...a?.context??this?.options.context,...e},routeContext:e}}catch(t){throw o.options.onError?.(t),t}})();Object.assign(t,{...h})})),n};loadMatches=async(t,e)=>{let s;this.cleanMatches(),e?.preload||t.forEach((t=>{this.setRouteMatch(t.id,(e=>({...e,routeSearch:t.routeSearch,search:t.search,routeContext:t.routeContext,context:t.context,error:t.error,paramsError:t.paramsError,searchError:t.searchError,params:t.params})))}));try{for(const[r,a]of t.entries()){const t=this.getRoute(a.routeId),o=(e,o)=>{if(s=s??r,o=o||t.options.onError,J(e))throw e;try{o?.(e)}catch(t){if(e=t,J(t))throw t}console.log("set error"),this.setRouteMatch(a.id,(t=>({...t,error:e,status:"error",updatedAt:Date.now()})))};a.paramsError&&o(a.paramsError,t.options.onParseParamsError),a.searchError&&o(a.searchError,t.options.onValidateSearchError);let i=!1;try{await(t.options.beforeLoad?.({...a,preload:!!e?.preload}))}catch(e){o(e,t.options.onBeforeLoadError),i=!0}if(i)break}}catch(t){throw e?.preload||this.navigate(t),t}const r=t.slice(0,s),a=[];r.forEach(((t,s)=>{a.push((async()=>{const r=a[s-1],o=this.getRoute(t.routeId);if(t.isFetching||"success"===t.status&&!this.getIsInvalid({matchId:t.id,preload:e?.preload}))return this.getRouteMatch(t.id)?.loadPromise;const i=Date.now(),n=()=>{const e=this.getRouteMatch(t.id);return e&&e.fetchedAt!==i?e.loadPromise:void 0},h=(async()=>{let s;const a=t=>!!J(t)&&(e?.preload||this.navigate(t),!0);try{const a=Promise.all(F.map((async t=>{const e=o.options[t];e?.preload&&await e.preload()}))),i=o.options.loader?.({...t,preload:!!e?.preload,parentMatchPromise:r}),[h,c]=await Promise.all([a,i]);if(s=n())return await s;this.setRouteMatchData(t.id,(()=>c),e)}catch(e){if(s=n())return await s;a(e);let r=e;try{o.options.onLoadError?o.options.onLoadError?.(e):o.options.onError?.(e)}catch(t){r=t,a(r)}console.log("set error"),this.setRouteMatch(t.id,(t=>({...t,error:r,status:"error",isFetching:!1,updatedAt:Date.now()}))),console.log(this.getRouteMatch(t.id)?.status)}})();this.setRouteMatch(t.id,(t=>({...t,status:"success"!==t.status?"pending":t.status,isFetching:!0,loadPromise:h,fetchedAt:i,invalid:!1}))),await h})())})),await Promise.all(a)};reload=()=>this.navigate({fromCurrent:!0,replace:!0,search:!0});resolvePath=(t,e)=>S(this.basepath,t,_(e));navigate=async({from:t,to:s="",search:r,hash:a,replace:o,params:i})=>{const n=String(s),h=void 0===t?t:String(t);let c;try{new URL(`${n}`),c=!0}catch(t){}return e(!c),this.#e({from:h,to:n,search:r,hash:a,replace:o,params:i})};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePath(t.from??"",t.to):void 0};const s=this.buildNext(t);if(e?.pending&&"pending"!==this.state.status)return!1;const r=e?.pending?this.state.location:this.state.resolvedLocation;if(!r)return!1;const a=P(this.basepath,r.pathname,{...e,to:s.pathname});return!!a&&(e?.includeSearch??1?!!v(r.search,s.search)&&a:a)};buildLink=({from:t,to:e=".",search:s,params:r,hash:a,target:o,replace:i,activeOptions:n,preload:h,preloadDelay:c,disabled:l,state:u})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const d={from:t,to:e,search:s,params:r,hash:a,replace:i,state:u},p=this.buildNext(d);h=h??this.options.defaultPreload;const f=c??this.options.defaultPreloadDelay??0,m=this.state.location.pathname.split("/"),y=p.pathname.split("/").every(((t,e)=>t===m[e])),g=n?.exact?this.state.location.pathname===p.pathname:y,w=!n?.includeHash||this.state.location.hash===p.hash,_=!(n?.includeSearch??1)||v(this.state.location.search,p.search);return{type:"internal",next:p,handleFocus:t=>{h&&this.preloadRoute(d).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},handleClick:t=>{l||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||o&&"_self"!==o||0!==t.button||(t.preventDefault(),this.#e(d))},handleEnter:t=>{const e=t.target||{};if(h){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(d).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))}),f)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},handleTouchStart:t=>{this.preloadRoute(d).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},isActive:g&&w&&_,disabled:l}};dehydrate=()=>({state:f(this.state,["location","status","lastUpdated"])});hydrate=async t=>{let s=t;"undefined"!=typeof document&&(s=window.__TSR_DEHYDRATED__),e(s);const r=s;this.dehydratedData=r.payload,this.options.hydrate?.(r.payload);const a=r.router.state;this.__store.setState((t=>({...t,...a,resolvedLocation:a.location}))),await this.load()};injectedHtml=[];injectHtml=async t=>{this.injectedHtml.push(t)};dehydrateData=(t,e)=>{if("undefined"==typeof document){const s="string"==typeof t?t:JSON.stringify(t);return this.injectHtml((async()=>{const t=`__TSR_DEHYDRATED__${s}`,r="function"==typeof e?await e():e;return`<script id='${t}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${a=s,a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}"] = ${JSON.stringify(r)}\n ;(() => {\n var el = document.getElementById('${t}')\n el.parentElement.removeChild(el)\n })()\n <\/script>`;var a})),()=>this.hydrateData(t)}return()=>{}};hydrateData=t=>{if("undefined"!=typeof document){const e="string"==typeof t?t:JSON.stringify(t);return window[`__TSR_DEHYDRATED__${e}`]}};#r=t=>{this.routeTree=t,this.routesById={},this.routesByPath={},this.flatRoutes=[];const s=t=>{t.forEach(((t,r)=>{t.init({originalIndex:r,router:this});if(e(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t,!t.isRoot&&t.path){const e=b(t.fullPath);this.routesByPath[e]&&!t.fullPath.endsWith("/")||(this.routesByPath[e]=t)}const a=t.children;a?.length&&s(a)}))};s([t]),this.flatRoutes=Object.values(this.routesByPath).map(((t,e)=>{const s=I(t.fullPath),r=x(s);for(;r.length>1&&"/"===r[0]?.value;)r.shift();const a=r.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,trimmed:s,parsed:r,index:e,score:a}})).sort(((t,e)=>{let s="/"===t.trimmed?1:"/"===e.trimmed?-1:0;if(0!==s)return s;const r=Math.min(t.score.length,e.score.length);if(t.score.length!==e.score.length)return e.score.length-t.score.length;for(let s=0;s<r;s++)if(t.score[s]!==e.score[s])return e.score[s]-t.score[s];for(let s=0;s<r;s++)if(t.parsed[s].value!==e.parsed[s].value)return t.parsed[s].value>e.parsed[s].value?1:-1;return t.trimmed!==e.trimmed?t.trimmed>e.trimmed?1:-1:t.index-e.index})).map(((t,e)=>(t.child.rank=e,t.child)))};#s=t=>{let{pathname:e,search:s,hash:r,state:a}=this.history.location;const o=this.options.parseSearch(s);return{pathname:e,searchStr:s,search:m(t?.search,o),hash:r.split("#").reverse()[0]??"",href:`${e}${s}${r}`,state:a,key:a?.key||"__init__"}};#a=(t={})=>{t.fromCurrent=t.fromCurrent??""===t.to;const e=t.fromCurrent?this.state.location.pathname:t.from??this.state.location.pathname;let s=S(this.basepath??"/",e,`${t.to??""}`);const r={...d(this.matchRoutes(this.state.location.pathname,this.state.location.search))?.params};let a=!0===(t.params??!0)?r:p(t.params,r);a&&t.__matches?.map((t=>this.getRoute(t.routeId).options.stringifyParams)).filter(Boolean).forEach((t=>{a={...a,...t(a)}})),s=E(s,a??{});const o=t.__matches?.map((t=>this.getRoute(t.routeId).options.preSearchFilters??[])).flat().filter(Boolean)??[],i=t.__matches?.map((t=>this.getRoute(t.routeId).options.postSearchFilters??[])).flat().filter(Boolean)??[],n=o?.length?o?.reduce(((t,e)=>e(t)),this.state.location.search):this.state.location.search,h=!0===t.search?n:t.search?p(t.search,n)??{}:o?.length?n:{},c=i?.length?i.reduce(((t,e)=>e(t)),h):h,l=m(this.state.location.search,c),u=this.options.stringifySearch(l),f=!0===t.hash?this.state.location.hash:p(t.hash,this.state.location.hash),y=f?`#${f}`:"";return{pathname:s,search:l,searchStr:u,state:!0===t.state?this.state.location.state:p(t.state,this.state.location.state),hash:f,href:this.history.createHref(`${s}${u}${y}`),key:t.key}};#e=async t=>{const e=this.buildNext(t),s=""+Date.now()+Math.random();this.navigateTimeout&&clearTimeout(this.navigateTimeout);let r="replace";t.replace||(r="push");this.state.location.href===e.href&&!e.key&&(r="replace");const a=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===r?"push":"replace"](a,{id:s,...e.state}),this.latestLoadPromise};getRouteMatch=t=>this.state.matchesById[t];setRouteMatch=(t,e)=>{this.__store.setState((s=>(s.matchesById[t]||console.warn(`No match found with id: ${t}`),{...s,matchesById:{...s.matchesById,[t]:e(s.matchesById[t])}})))};setRouteMatchData=(t,e,s)=>{const r=this.getRouteMatch(t);if(!r)return;const a=this.getRoute(r.routeId),o=s?.updatedAt??Date.now(),i=o+(s?.maxAge??a.options.preloadMaxAge??this.options.defaultPreloadMaxAge??5e3),n=o+(s?.maxAge??a.options.maxAge??this.options.defaultMaxAge??1/0);console.log("set success"),this.setRouteMatch(t,(t=>({...t,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:p(e,t.loaderData),preloadInvalidAt:i,invalidAt:n}))),this.state.matches.find((e=>e.id===t))};invalidate=async t=>{if(t?.matchId){this.setRouteMatch(t.matchId,(t=>({...t,invalid:!0})));const e=this.state.matches.findIndex((e=>e.id===t.matchId)),s=this.state.matches[e+1];if(s)return this.invalidate({matchId:s.id,reload:!1})}else this.__store.batch((()=>{Object.values(this.state.matchesById).forEach((t=>{this.setRouteMatch(t.id,(t=>({...t,invalid:!0})))}))}));if(t?.reload??1)return this.reload()};getIsInvalid=t=>{if(!t?.matchId)return!!this.state.matches.find((e=>this.getIsInvalid({matchId:e.id,preload:t?.preload})));const e=this.getRouteMatch(t?.matchId);if(!e)return!1;const s=Date.now();return e.invalid||(t?.preload?e.preloadInvalidAt:e.invalidAt)<s}},t.RouterContext=class{constructor(){}createRootRoute=t=>new O(t)},t.SearchParamError=W,t.cleanPath=_,t.componentTypes=F,t.createBrowserHistory=h,t.createHashHistory=function(){return h({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=c,t.decode=D,t.defaultParseSearch=T,t.defaultStringifySearch=j,t.encode=A,t.functionalUpdate=p,t.interpolatePath=E,t.invariant=e,t.isPlainObject=y,t.isRedirect=J,t.joinPaths=w,t.last=d,t.lazyFn=function(t,e){return async(...s)=>(await t())[e||"default"](...s)},t.matchByPath=M,t.matchPathname=P,t.parsePathname=x,t.parseSearchWith=k,t.partialDeepEqual=v,t.pick=f,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=m,t.resolvePath=S,t.rootRouteId=B,t.stringifySearchWith=H,t.trimPath=I,t.trimPathLeft=R,t.trimPathRight=b,t.warning=function(t,e){},Object.defineProperty(t,"__esModule",{value:!0})}));
class C{listeners=new Set;_batching=!1;_flushing=0;_nextPriority=null;constructor(t,e){this.state=t,this.options=e}subscribe=t=>{this.listeners.add(t);const e=this.options?.onSubscribe?.(t,this);return()=>{this.listeners.delete(t),e?.()}};setState=(t,e)=>{const r=this.state;this.state=this.options?.updateFn?this.options.updateFn(r)(t):t(r);const s=e?.priority??this.options?.defaultPriority??"high";null===this._nextPriority||"high"===this._nextPriority?this._nextPriority=s:this._nextPriority=this.options?.defaultPriority??"high",this.options?.onUpdate?.({priority:this._nextPriority}),this._flush()};_flush=()=>{if(this._batching)return;const t=++this._flushing;this.listeners.forEach((e=>{this._flushing===t&&e({priority:this._nextPriority??"high"})}))};batch=t=>{if(this._batching)return t();this._batching=!0,t(),this._batching=!1,this._flush()}}const T=H(JSON.parse),k=j(JSON.stringify,JSON.parse);function H(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let r=D(e);for(let e in r){const s=r[e];if("string"==typeof s)try{r[e]=t(s)}catch(t){}}return r}}function j(t,e){function r(r){if("object"==typeof r&&null!==r)try{return t(r)}catch(t){}else if("string"==typeof r&&"function"==typeof e)try{return e(r),t(r)}catch(t){}return r}return t=>{(t={...t})&&Object.keys(t).forEach((e=>{const s=t[e];void 0===s||void 0===s?delete t[e]:Array.isArray(s)?t[e]=s.map(r):t[e]=r(s)}));const e=L(t).toString();return e?`?${e}`:""}}const F=["component","errorComponent","pendingComponent"];const N="undefined"==typeof window||!window.document.createElement;function U(){return{status:"idle",isFetching:!1,resolvedLocation:null,location:null,matchesById:{},matchIds:[],pendingMatchIds:[],matches:[],pendingMatches:[],lastUpdated:Date.now()}}function J(t){return!!t?.isRedirect}class W extends Error{}class z extends Error{}t.FileRoute=class{constructor(t){this.path=t}createRoute=t=>{const e=new B(t);return e.isRoot=!1,e}},t.PathParamError=z,t.RootRoute=O,t.Route=B,t.Router=class{#t;constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??k,parseSearch:t?.parseSearch??T},this.__store=new C(U(),{onUpdate:()=>{const t=this.state,e=this.__store.state,r=t.matchesById!==e.matchesById;let s,a;r||(s=t.matchIds.length!==e.matchIds.length||t.matchIds.some(((t,r)=>t!==e.matchIds[r])),a=t.pendingMatchIds.length!==e.pendingMatchIds.length||t.pendingMatchIds.some(((t,r)=>t!==e.pendingMatchIds[r]))),(r||s)&&(e.matches=e.matchIds.map((t=>e.matchesById[t]))),(r||a)&&(e.pendingMatches=e.pendingMatchIds.map((t=>e.matchesById[t]))),e.isFetching=[...e.matches,...e.pendingMatches].some((t=>t.isFetching)),this.state=e},defaultPriority:"low"}),this.state=this.__store.state,this.update(t);const e=this.buildNext({hash:!0,fromCurrent:!0,search:!0,state:!0});this.state.location.href!==e.href&&this.#e({...e,replace:!0})}reset=()=>{this.__store.setState((t=>Object.assign(t,U())))};mount=()=>{this.safeLoad()};update=t=>{if(this.options={...this.options,...t,context:{...this.options.context,...t?.context}},!this.history||this.options.history&&this.options.history!==this.history){this.#t&&this.#t(),this.history=this.options.history??(N?c():h());const t=this.#r();this.__store.setState((e=>({...e,resolvedLocation:t,location:t}))),this.#t=this.history.listen((()=>{this.safeLoad({next:this.#r(this.state.location)})}))}const{basepath:e,routeTree:r}=this.options;return this.basepath=`/${I(e??"")??""}`,r&&r!==this.routeTree&&this.#s(r),this};buildNext=t=>{const e=this.#a(t),r=this.matchRoutes(e.pathname,e.search);return this.#a({...t,__matches:r})};cancelMatches=()=>{this.state.matches.forEach((t=>{this.cancelMatch(t.id)}))};cancelMatch=t=>{this.getRouteMatch(t)?.abortController?.abort()};safeLoad=async t=>{try{return this.load(t)}catch(t){}};latestLoadPromise=Promise.resolve();load=async t=>{const e=new Promise((async(r,s)=>{let a;const o=()=>this.latestLoadPromise!==e?this.latestLoadPromise:void 0;let i;this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,location:t.next}))),i=this.matchRoutes(this.state.location.pathname,this.state.location.search,{throwOnError:t?.throwOnError,debug:!0}),this.__store.setState((t=>({...t,status:"pending",pendingMatchIds:i.map((t=>t.id)),matchesById:this.#o(t.matchesById,i)})))}));try{try{await this.loadMatches(i)}catch(t){}if(a=o())return a;const t=this.state.resolvedLocation;this.__store.setState((t=>({...t,status:"idle",resolvedLocation:t.location,matchIds:t.pendingMatchIds,pendingMatchIds:[]}))),t.href!==this.state.location.href&&this.options.onRouteChange?.(),r()}catch(t){if(a=o())return a;s(t)}}));return this.latestLoadPromise=e,this.latestLoadPromise};#o=(t,e)=>{const r={...t};let s=!1;return e.forEach((t=>{r[t.id]||(s=!0,r[t.id]=t)})),s?r:t};getRoute=t=>{const r=this.routesById[t];return e(r),r};preloadRoute=async(t=this.state.location)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,e.search,{throwOnError:!0});return this.__store.setState((t=>({...t,matchesById:this.#o(t.matchesById,r)}))),await this.loadMatches(r,{preload:!0,maxAge:t.maxAge}),r};cleanMatches=()=>{const t=Date.now(),e=Object.values(this.state.matchesById).filter((e=>{const r=this.getRoute(e.routeId);return!this.state.matchIds.includes(e.id)&&!this.state.pendingMatchIds.includes(e.id)&&e.preloadInvalidAt<t&&(!r.options.gcMaxAge||e.updatedAt+r.options.gcMaxAge<t)})).map((t=>t.id));e.length&&this.__store.setState((t=>{const r={...t.matchesById};return e.forEach((t=>{delete r[t]})),{...t,matchesById:r}}))};matchRoutes=(t,e,r)=>{let s={},a=this.flatRoutes.find((e=>{const r=P(this.basepath,b(t),{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive});return!!r&&(s=r,!0)}))||this.routesById.__root__,o=[a];for(;a?.parentRoute;)a=a.parentRoute,a&&o.unshift(a);const i=o.map((t=>{let e;if(t.options.parseParams)try{const e=t.options.parseParams(s);Object.assign(s,e)}catch(t){if(e=new z(t.message,{cause:t}),r?.throwOnError)throw e;return e}})),n=o.map(((t,r)=>{const a=x(t.path,s),o=t.options.key?t.options.key({params:s,search:e})??"":"",n=o?JSON.stringify(o):"",h=x(t.id,s,!0)+n,c=this.getRouteMatch(h);if(c)return{...c};const l=!(!t.options.loader&&!F.some((e=>t.options[e]?.preload)));return{id:h,key:n,routeId:t.id,params:s,pathname:w([this.basepath,a]),updatedAt:Date.now(),invalidAt:1/0,preloadInvalidAt:1/0,routeSearch:{},search:{},status:l?"pending":"success",isFetching:!1,invalid:!1,error:void 0,paramsError:i[r],searchError:void 0,loaderData:void 0,loadPromise:Promise.resolve(),routeContext:void 0,context:void 0,abortController:new AbortController,fetchedAt:0}}));return n.forEach(((t,s)=>{const a=n[s-1],o=this.getRoute(t.routeId),i=(()=>{const s={search:a?.search??e,routeSearch:a?.routeSearch??e};try{const e=("object"==typeof o.options.validateSearch?o.options.validateSearch.parse:o.options.validateSearch)?.(s.search)??{},r={...s.search,...e};return{routeSearch:m(t.routeSearch,e),search:m(t.search,r)}}catch(e){if(t.searchError=new W(e.message,{cause:e}),r?.throwOnError)throw t.searchError;return s}})();Object.assign(t,{...i});const h=(()=>{try{const e=o.options.getContext?.({parentContext:a?.routeContext??{},context:a?.context??this?.options.context??{},params:t.params,search:t.search})||{};return{context:{...a?.context??this?.options.context,...e},routeContext:e}}catch(t){throw o.options.onError?.(t),t}})();Object.assign(t,{...h})})),n};loadMatches=async(t,e)=>{let r;this.cleanMatches(),e?.preload||t.forEach((t=>{this.setRouteMatch(t.id,(e=>({...e,routeSearch:t.routeSearch,search:t.search,routeContext:t.routeContext,context:t.context,error:t.error,paramsError:t.paramsError,searchError:t.searchError,params:t.params})))}));try{for(const[s,a]of t.entries()){const t=this.getRoute(a.routeId),o=(e,o)=>{if(r=r??s,o=o||t.options.onError,J(e))throw e;try{o?.(e)}catch(t){if(e=t,J(t))throw t}this.setRouteMatch(a.id,(t=>({...t,error:e,status:"error",updatedAt:Date.now()})))};a.paramsError&&o(a.paramsError,t.options.onParseParamsError),a.searchError&&o(a.searchError,t.options.onValidateSearchError);let i=!1;try{await(t.options.beforeLoad?.({...a,preload:!!e?.preload}))}catch(e){o(e,t.options.onBeforeLoadError),i=!0}if(i)break}}catch(t){throw e?.preload||this.navigate(t),t}const s=t.slice(0,r),a=[];s.forEach(((t,r)=>{a.push((async()=>{const s=a[r-1],o=this.getRoute(t.routeId);if(t.isFetching||"success"===t.status&&!this.getIsInvalid({matchId:t.id,preload:e?.preload}))return this.getRouteMatch(t.id)?.loadPromise;const i=Date.now(),n=()=>{const e=this.getRouteMatch(t.id);return e&&e.fetchedAt!==i?e.loadPromise:void 0},h=t=>!!J(t)&&(e?.preload||this.navigate(t),!0),c=async()=>{let r;try{const a=Promise.all(F.map((async t=>{const e=o.options[t];e?.preload&&await e.preload()}))),i=o.options.loader?.({...t,preload:!!e?.preload,parentMatchPromise:s}),[h,c]=await Promise.all([a,i]);if(r=n())return await r;this.setRouteMatchData(t.id,(()=>c),e)}catch(e){let s=e;if(r=n())return await r;if(h(e))return;if(o.options.onLoadError)try{o.options.onLoadError(e)}catch(t){if(s=t,h(t))return}if((!o.options.onLoadError||s!==e)&&o.options.onError)try{o.options.onError(s)}catch(t){if(h(t))return}this.setRouteMatch(t.id,(t=>({...t,error:e,status:"error",isFetching:!1,updatedAt:Date.now()})))}};let l;this.__store.batch((()=>{this.setRouteMatch(t.id,(t=>({...t,isFetching:!0,fetchedAt:i,invalid:!1}))),l=c(),this.setRouteMatch(t.id,(t=>({...t,loadPromise:l})))})),await l})())})),await Promise.all(a)};reload=()=>this.navigate({fromCurrent:!0,replace:!0,search:!0});resolvePath=(t,e)=>S(this.basepath,t,_(e));navigate=async({from:t,to:r="",search:s,hash:a,replace:o,params:i})=>{const n=String(r),h=void 0===t?t:String(t);let c;try{new URL(`${n}`),c=!0}catch(t){}return e(!c),this.#e({from:h,to:n,search:s,hash:a,replace:o,params:i})};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePath(t.from??"",t.to):void 0};const r=this.buildNext(t);if(e?.pending&&"pending"!==this.state.status)return!1;const s=e?.pending?this.state.location:this.state.resolvedLocation;if(!s)return!1;const a=P(this.basepath,s.pathname,{...e,to:r.pathname});return!!a&&(e?.includeSearch??1?!!v(s.search,r.search)&&a:a)};buildLink=({from:t,to:e=".",search:r,params:s,hash:a,target:o,replace:i,activeOptions:n,preload:h,preloadDelay:c,disabled:l,state:u})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const d={from:t,to:e,search:r,params:s,hash:a,replace:i,state:u},p=this.buildNext(d);h=h??this.options.defaultPreload;const f=c??this.options.defaultPreloadDelay??0,m=this.state.location.pathname.split("/"),y=p.pathname.split("/").every(((t,e)=>t===m[e])),g=n?.exact?this.state.location.pathname===p.pathname:y,w=!n?.includeHash||this.state.location.hash===p.hash,_=!(n?.includeSearch??1)||v(this.state.location.search,p.search);return{type:"internal",next:p,handleFocus:t=>{h&&this.preloadRoute(d).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},handleClick:t=>{l||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||o&&"_self"!==o||0!==t.button||(t.preventDefault(),this.#e(d))},handleEnter:t=>{const e=t.target||{};if(h){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(d).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))}),f)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},handleTouchStart:t=>{this.preloadRoute(d).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},isActive:g&&w&&_,disabled:l}};dehydrate=()=>({state:f(this.state,["location","status","lastUpdated"])});hydrate=async t=>{let r=t;"undefined"!=typeof document&&(r=window.__TSR_DEHYDRATED__),e(r);const s=r;this.dehydratedData=s.payload,this.options.hydrate?.(s.payload);const a=s.router.state;this.__store.setState((t=>({...t,...a,resolvedLocation:a.location}))),await this.load()};injectedHtml=[];injectHtml=async t=>{this.injectedHtml.push(t)};dehydrateData=(t,e)=>{if("undefined"==typeof document){const r="string"==typeof t?t:JSON.stringify(t);return this.injectHtml((async()=>{const t=`__TSR_DEHYDRATED__${r}`,s="function"==typeof e?await e():e;return`<script id='${t}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${a=r,a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}"] = ${JSON.stringify(s)}\n ;(() => {\n var el = document.getElementById('${t}')\n el.parentElement.removeChild(el)\n })()\n <\/script>`;var a})),()=>this.hydrateData(t)}return()=>{}};hydrateData=t=>{if("undefined"!=typeof document){const e="string"==typeof t?t:JSON.stringify(t);return window[`__TSR_DEHYDRATED__${e}`]}};#s=t=>{this.routeTree=t,this.routesById={},this.routesByPath={},this.flatRoutes=[];const r=t=>{t.forEach(((t,s)=>{t.init({originalIndex:s,router:this});if(e(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t,!t.isRoot&&t.path){const e=b(t.fullPath);this.routesByPath[e]&&!t.fullPath.endsWith("/")||(this.routesByPath[e]=t)}const a=t.children;a?.length&&r(a)}))};r([t]),this.flatRoutes=Object.values(this.routesByPath).map(((t,e)=>{const r=I(t.fullPath),s=E(r);for(;s.length>1&&"/"===s[0]?.value;)s.shift();const a=s.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,trimmed:r,parsed:s,index:e,score:a}})).sort(((t,e)=>{let r="/"===t.trimmed?1:"/"===e.trimmed?-1:0;if(0!==r)return r;const s=Math.min(t.score.length,e.score.length);if(t.score.length!==e.score.length)return e.score.length-t.score.length;for(let r=0;r<s;r++)if(t.score[r]!==e.score[r])return e.score[r]-t.score[r];for(let r=0;r<s;r++)if(t.parsed[r].value!==e.parsed[r].value)return t.parsed[r].value>e.parsed[r].value?1:-1;return t.trimmed!==e.trimmed?t.trimmed>e.trimmed?1:-1:t.index-e.index})).map(((t,e)=>(t.child.rank=e,t.child)))};#r=t=>{let{pathname:e,search:r,hash:s,state:a}=this.history.location;const o=this.options.parseSearch(r);return{pathname:e,searchStr:r,search:m(t?.search,o),hash:s.split("#").reverse()[0]??"",href:`${e}${r}${s}`,state:a,key:a?.key||"__init__"}};#a=(t={})=>{t.fromCurrent=t.fromCurrent??""===t.to;const e=t.fromCurrent?this.state.location.pathname:t.from??this.state.location.pathname;let r=S(this.basepath??"/",e,`${t.to??""}`);const s={...d(this.matchRoutes(this.state.location.pathname,this.state.location.search))?.params};let a=!0===(t.params??!0)?s:p(t.params,s);a&&t.__matches?.map((t=>this.getRoute(t.routeId).options.stringifyParams)).filter(Boolean).forEach((t=>{a={...a,...t(a)}})),r=x(r,a??{});const o=t.__matches?.map((t=>this.getRoute(t.routeId).options.preSearchFilters??[])).flat().filter(Boolean)??[],i=t.__matches?.map((t=>this.getRoute(t.routeId).options.postSearchFilters??[])).flat().filter(Boolean)??[],n=o?.length?o?.reduce(((t,e)=>e(t)),this.state.location.search):this.state.location.search,h=!0===t.search?n:t.search?p(t.search,n)??{}:o?.length?n:{},c=i?.length?i.reduce(((t,e)=>e(t)),h):h,l=m(this.state.location.search,c),u=this.options.stringifySearch(l),f=!0===t.hash?this.state.location.hash:p(t.hash,this.state.location.hash),y=f?`#${f}`:"";return{pathname:r,search:l,searchStr:u,state:!0===t.state?this.state.location.state:p(t.state,this.state.location.state),hash:f,href:this.history.createHref(`${r}${u}${y}`),key:t.key}};#e=async t=>{const e=this.buildNext(t),r=""+Date.now()+Math.random();this.navigateTimeout&&clearTimeout(this.navigateTimeout);let s="replace";t.replace||(s="push");this.state.location.href===e.href&&!e.key&&(s="replace");const a=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===s?"push":"replace"](a,{id:r,...e.state}),this.latestLoadPromise};getRouteMatch=t=>this.state.matchesById[t];setRouteMatch=(t,e)=>{this.__store.setState((r=>(r.matchesById[t]||console.warn(`No match found with id: ${t}`),{...r,matchesById:{...r.matchesById,[t]:e(r.matchesById[t])}})))};setRouteMatchData=(t,e,r)=>{const s=this.getRouteMatch(t);if(!s)return;const a=this.getRoute(s.routeId),o=r?.updatedAt??Date.now(),i=o+(r?.maxAge??a.options.preloadMaxAge??this.options.defaultPreloadMaxAge??5e3),n=o+(r?.maxAge??a.options.maxAge??this.options.defaultMaxAge??1/0);this.setRouteMatch(t,(t=>({...t,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:p(e,t.loaderData),preloadInvalidAt:i,invalidAt:n}))),this.state.matches.find((e=>e.id===t))};invalidate=async t=>{if(t?.matchId){this.setRouteMatch(t.matchId,(t=>({...t,invalid:!0})));const e=this.state.matches.findIndex((e=>e.id===t.matchId)),r=this.state.matches[e+1];if(r)return this.invalidate({matchId:r.id,reload:!1})}else this.__store.batch((()=>{Object.values(this.state.matchesById).forEach((t=>{this.setRouteMatch(t.id,(t=>({...t,invalid:!0})))}))}));if(t?.reload??1)return this.reload()};getIsInvalid=t=>{if(!t?.matchId)return!!this.state.matches.find((e=>this.getIsInvalid({matchId:e.id,preload:t?.preload})));const e=this.getRouteMatch(t?.matchId);if(!e)return!1;const r=Date.now();return e.invalid||(t?.preload?e.preloadInvalidAt:e.invalidAt)<r}},t.RouterContext=class{constructor(){}createRootRoute=t=>new O(t)},t.SearchParamError=W,t.cleanPath=_,t.componentTypes=F,t.createBrowserHistory=h,t.createHashHistory=function(){return h({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=c,t.decode=D,t.defaultParseSearch=T,t.defaultStringifySearch=k,t.encode=L,t.functionalUpdate=p,t.interpolatePath=x,t.invariant=e,t.isPlainObject=y,t.isRedirect=J,t.joinPaths=w,t.last=d,t.lazyFn=function(t,e){return async(...r)=>(await t())[e||"default"](...r)},t.matchByPath=M,t.matchPathname=P,t.parsePathname=E,t.parseSearchWith=H,t.partialDeepEqual=v,t.pick=f,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=m,t.resolvePath=S,t.rootRouteId=$,t.stringifySearchWith=j,t.trimPath=I,t.trimPathLeft=R,t.trimPathRight=b,t.warning=function(t,e){},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.production.js.map
{
"name": "@tanstack/router-core",
"author": "Tanner Linsley",
"version": "0.0.1-beta.160",
"version": "0.0.1-beta.161",
"license": "MIT",

@@ -46,3 +46,3 @@ "repository": "tanstack/router",

"@gisatcz/cross-package-react-context": "^0.2.0",
"@tanstack/react-store": "0.0.1-beta.160"
"@tanstack/react-store": "0.0.1-beta.161"
},

@@ -49,0 +49,0 @@ "scripts": {

@@ -295,6 +295,2 @@ import { Store } from '@tanstack/react-store'

console.log(
Object.values(next.matchesById).find((d) => d.status === 'error'),
)
const matchesByIdChanged = prev.matchesById !== next.matchesById

@@ -873,3 +869,2 @@ let matchesChanged

console.log('set error')
this.setRouteMatch(match.id, (s) => ({

@@ -941,16 +936,15 @@ ...s,

const handleIfRedirect = (err: any) => {
if (isRedirect(err)) {
if (!opts?.preload) {
this.navigate(err as any)
}
return true
}
return false
}
const load = async () => {
let latestPromise
const handleError = (err: any) => {
if (isRedirect(err)) {
if (!opts?.preload) {
this.navigate(err as any)
}
return true
}
return false
}
try {

@@ -981,22 +975,29 @@ const componentsPromise = Promise.all(

} catch (loaderError) {
let latestError = loaderError
if ((latestPromise = checkLatest())) return await latestPromise
handleError(loaderError)
if (handleIfRedirect(loaderError)) return
let error = loaderError
if (route.options.onLoadError) {
try {
route.options.onLoadError(loaderError)
} catch (onLoadError) {
latestError = onLoadError
if (handleIfRedirect(onLoadError)) return
}
}
try {
if (route.options.onLoadError) {
route.options.onLoadError?.(loaderError)
} else {
route.options.onError?.(loaderError)
if (
(!route.options.onLoadError || latestError !== loaderError) &&
route.options.onError
) {
try {
route.options.onError(latestError)
} catch (onErrorError) {
if (handleIfRedirect(onErrorError)) return
}
} catch (errorHandlerErr) {
error = errorHandlerErr
handleError(error)
}
console.log('set error')
this.setRouteMatch(match.id, (s) => ({
...s,
error: error,
error: loaderError,
status: 'error',

@@ -1006,17 +1007,24 @@ isFetching: false,

}))
console.log(this.getRouteMatch(match.id)?.status)
}
}
const loadPromise = load()
let loadPromise: Promise<void> | undefined
this.setRouteMatch(match.id, (s) => ({
...s,
status: s.status !== 'success' ? 'pending' : s.status,
isFetching: true,
loadPromise,
fetchedAt,
invalid: false,
}))
this.__store.batch(() => {
this.setRouteMatch(match.id, (s) => ({
...s,
// status: s.status !== 'success' ? 'pending' : s.status,
isFetching: true,
fetchedAt,
invalid: false,
}))
loadPromise = load()
this.setRouteMatch(match.id, (s) => ({
...s,
loadPromise,
}))
})
await loadPromise

@@ -1663,3 +1671,2 @@ })(),

console.log('set success')
this.setRouteMatch(id, (s) => ({

@@ -1666,0 +1673,0 @@ ...s,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc