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.147 to 0.0.1-beta.148

41

build/cjs/router.js

@@ -431,2 +431,18 @@ /**

this.cleanMatches();
if (!opts?.preload) {
resolvedMatches.forEach(match => {
// Update each match with its latest url data
this.setRouteMatch(match.id, s => ({
...s,
routeSearch: match.routeSearch,
search: match.search,
routeContext: match.routeContext,
context: match.context,
error: match.error,
paramsError: match.paramsError,
searchError: match.searchError,
params: match.params
}));
});
}
let firstBadMatchIndex;

@@ -436,18 +452,4 @@

try {
await Promise.all(resolvedMatches.map(async (match, index) => {
for (const [index, match] of resolvedMatches.entries()) {
const route = this.getRoute(match.routeId);
if (!opts?.preload) {
// Update each match with its latest url data
this.setRouteMatch(match.id, s => ({
...s,
routeSearch: match.routeSearch,
search: match.search,
routeContext: match.routeContext,
context: match.context,
error: match.error,
paramsError: match.paramsError,
searchError: match.searchError,
params: match.params
}));
}
const handleError = (err, handler) => {

@@ -480,2 +482,3 @@ firstBadMatchIndex = firstBadMatchIndex ?? index;

}
let didError = false;
try {

@@ -488,4 +491,10 @@ await route.options.beforeLoad?.({

handleError(err, route.options.onBeforeLoadError);
didError = true;
}
}));
// If we errored, do not run the next matches' middleware
if (didError) {
break;
}
}
} catch (err) {

@@ -492,0 +501,0 @@ if (!opts?.preload) {

@@ -1090,2 +1090,18 @@ /**

this.cleanMatches();
if (!opts?.preload) {
resolvedMatches.forEach(match => {
// Update each match with its latest url data
this.setRouteMatch(match.id, s => ({
...s,
routeSearch: match.routeSearch,
search: match.search,
routeContext: match.routeContext,
context: match.context,
error: match.error,
paramsError: match.paramsError,
searchError: match.searchError,
params: match.params
}));
});
}
let firstBadMatchIndex;

@@ -1095,18 +1111,4 @@

try {
await Promise.all(resolvedMatches.map(async (match, index) => {
for (const [index, match] of resolvedMatches.entries()) {
const route = this.getRoute(match.routeId);
if (!opts?.preload) {
// Update each match with its latest url data
this.setRouteMatch(match.id, s => ({
...s,
routeSearch: match.routeSearch,
search: match.search,
routeContext: match.routeContext,
context: match.context,
error: match.error,
paramsError: match.paramsError,
searchError: match.searchError,
params: match.params
}));
}
const handleError = (err, handler) => {

@@ -1139,2 +1141,3 @@ firstBadMatchIndex = firstBadMatchIndex ?? index;

}
let didError = false;
try {

@@ -1147,4 +1150,10 @@ await route.options.beforeLoad?.({

handleError(err, route.options.onBeforeLoadError);
didError = true;
}
}));
// If we errored, do not run the next matches' middleware
if (didError) {
break;
}
}
} catch (err) {

@@ -1151,0 +1160,0 @@ if (!opts?.preload) {

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

"name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"uid": "c288-43"
"uid": "c566-43"
},
{
"name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"uid": "c288-45"
"uid": "c566-45"
}

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

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

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

"name": "store/build/esm/index.js",
"uid": "c288-59"
"uid": "c566-59"
}

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

"nodeParts": {
"c288-43": {
"c566-43": {
"renderedLength": 199,
"gzipLength": 134,
"brotliLength": 0,
"mainUid": "c288-42"
"mainUid": "c566-42"
},
"c288-45": {
"c566-45": {
"renderedLength": 48,
"gzipLength": 65,
"brotliLength": 0,
"mainUid": "c288-44"
"mainUid": "c566-44"
},
"c288-47": {
"c566-47": {
"renderedLength": 6426,
"gzipLength": 1539,
"brotliLength": 0,
"mainUid": "c288-46"
"mainUid": "c566-46"
},
"c288-49": {
"c566-49": {
"renderedLength": 2821,
"gzipLength": 990,
"brotliLength": 0,
"mainUid": "c288-48"
"mainUid": "c566-48"
},
"c288-51": {
"c566-51": {
"renderedLength": 6028,
"gzipLength": 1423,
"brotliLength": 0,
"mainUid": "c288-50"
"mainUid": "c566-50"
},
"c288-53": {
"c566-53": {
"renderedLength": 1371,
"gzipLength": 552,
"brotliLength": 0,
"mainUid": "c288-52"
"mainUid": "c566-52"
},
"c288-55": {
"c566-55": {
"renderedLength": 2292,
"gzipLength": 807,
"brotliLength": 0,
"mainUid": "c288-54"
"mainUid": "c566-54"
},
"c288-57": {
"c566-57": {
"renderedLength": 223,
"gzipLength": 143,
"brotliLength": 0,
"mainUid": "c288-56"
"mainUid": "c566-56"
},
"c288-59": {
"c566-59": {
"renderedLength": 1969,
"gzipLength": 653,
"brotliLength": 0,
"mainUid": "c288-58"
"mainUid": "c566-58"
},
"c288-61": {
"c566-61": {
"renderedLength": 1387,
"gzipLength": 483,
"brotliLength": 0,
"mainUid": "c288-60"
"mainUid": "c566-60"
},
"c288-63": {
"renderedLength": 38282,
"gzipLength": 8519,
"c566-63": {
"renderedLength": 38499,
"gzipLength": 8590,
"brotliLength": 0,
"mainUid": "c288-62"
"mainUid": "c566-62"
},
"c288-65": {
"c566-65": {
"renderedLength": 0,
"gzipLength": 0,
"brotliLength": 0,
"mainUid": "c288-64"
"mainUid": "c566-64"
}
},
"nodeMetas": {
"c288-42": {
"c566-42": {
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"moduleParts": {
"index.production.js": "c288-43"
"index.production.js": "c566-43"
},

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

{
"uid": "c288-64"
"uid": "c566-64"
}
]
},
"c288-58": {
"c566-58": {
"id": "/packages/store/build/esm/index.js",
"moduleParts": {
"index.production.js": "c288-59"
"index.production.js": "c566-59"
},

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

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

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

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

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

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

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

},
"c288-66": {
"c566-66": {
"id": "/packages/router-core/src/link.ts",

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

{
"uid": "c288-64"
"uid": "c566-64"
}
]
},
"c288-67": {
"c566-67": {
"id": "/packages/router-core/src/routeInfo.ts",

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

{
"uid": "c288-64"
"uid": "c566-64"
}
]
},
"c288-68": {
"c566-68": {
"id": "/packages/react-store/build/esm/index.js",

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

{
"uid": "c288-69"
"uid": "c566-69"
},
{
"uid": "c288-58"
"uid": "c566-58"
}

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

{
"uid": "c288-62"
"uid": "c566-62"
}
]
},
"c288-69": {
"c566-69": {
"id": "use-sync-external-store/shim/with-selector",

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

{
"uid": "c288-68"
"uid": "c566-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",a="popstate",r="beforeunload",o=t=>(t.preventDefault(),t.returnValue=""),i=()=>{removeEventListener(r,o,{capture:!0})};function n(t){let e=t.getLocation(),s=()=>{},a=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(),a.forEach((t=>t()))};return{get location(){return e},listen:e=>(0===a.size&&(s="function"==typeof t.listener?t.listener(u):()=>{}),a.add(e),()=>{a.delete(e),0===a.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(r,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}`),r=t?.createHref??(t=>t);return n({getLocation:()=>l(e(),history.state),listener:t=>{window.addEventListener(s,t),window.addEventListener(a,t);var e=window.history.pushState;window.history.pushState=function(){let s=e.apply(history,arguments);return t(),s};var r=window.history.replaceState;return window.history.replaceState=function(){let e=r.apply(history,arguments);return t(),e},()=>{window.history.pushState=e,window.history.replaceState=r,window.removeEventListener(s,t),window.removeEventListener(a,t)}},pushState:(t,e)=>{window.history.pushState({...e,key:u()},"",r(t))},replaceState:(t,e)=>{window.history.replaceState({...e,key:u()},"",r(t))},back:()=>window.history.back(),forward:()=>window.history.forward(),go:t=>window.history.go(t),createHref:t=>r(t)})}function c(t={initialEntries:["/"]}){const e=t.initialEntries;let s=t.initialIndex??e.length-1,a={};return n({getLocation:()=>l(e[s],a),listener:!1,pushState:(t,r)=>{a={...r,key:u()},e.push(t),s++},replaceState:(t,r)=>{a={...r,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("#"),a=t.indexOf("?");return{href:t,pathname:t.substring(0,s>0?a>0?Math.min(s,a):s:a>0?a:t.length),hash:s>-1?t.substring(s):"",search:a>-1?t.slice(a,-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,a=Array.isArray(t)&&Array.isArray(s);if(a||y(t)&&y(s)){const e=a?t.length:Object.keys(t).length,r=a?s:Object.keys(s),o=r.length,i=a?[]:{};let n=0;for(let e=0;e<o;e++){const o=a?e:r[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 a=x(e);const r=x(s);r.forEach(((t,e)=>{if("/"===t.value)e?e===r.length-1&&a.push(t):a=[t];else if(".."===t.value)a.length>1&&"/"===d(a)?.value&&a.pop(),a.pop();else{if("."===t.value)return;a.push(t)}}));return _(w([t,...a.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 P(t,e,s=!1){return w(x(t).map((t=>{if("wildcard"===t.type){const a=e[t.value];return s?`${t.value}${a??""}`:a}return"param"===t.type?e[t.value.substring(1)]??"":t.value})))}function E(t,e,s){const a=M(t,e,s);if(!s.to||a)return a??{}}function M(t,e,s){e="/"!=t?e.substring(t.length):e;const a=`${s.to??"$"}`,r=x(e),o=x(a);e.startsWith("/")||r.unshift({type:"pathname",value:"/"}),a.startsWith("/")||o.unshift({type:"pathname",value:"/"});const i={};return(()=>{for(let t=0;t<Math.max(r.length,o.length);t++){const e=r[t],a=o[t],n=t>=r.length-1,h=t>=o.length-1;if(a){if("wildcard"===a.type)return!!e?.value&&(i["*"]=w(r.slice(t).map((t=>t.value))),!0);if("pathname"===a.type){if("/"===a.value&&!e?.value)return!0;if(e)if(s.caseSensitive){if(a.value!==e.value)return!1}else if(a.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===a.type){if("/"===e?.value)return!1;"$"!==e.value.charAt(0)&&(i[a.value.substring(1)]=e.value)}}if(!n&&h)return!!s.fuzzy}return!0})()?i:void 0}function L(t,e){var s,a,r,o="";for(s in t)if(void 0!==(r=t[s]))if(Array.isArray(r))for(a=0;a<r.length;a++)o&&(o+="&"),o+=encodeURIComponent(s)+"="+encodeURIComponent(r[a]);else o&&(o+="&"),o+=encodeURIComponent(s)+"="+encodeURIComponent(r);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,s,a={},r=t.split("&");e=r.shift();)void 0!==a[s=(e=e.split("=")).shift()]?a[s]=[].concat(a[s],A(e.shift())):a[s]=A(e.shift());return a}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 s=this.options,a=!s?.path&&!s?.id;this.parentRoute=this.options?.getParentRoute?.(),a?this.path=$:e(this.parentRoute);let r=a?$:s.path;r&&"/"!==r&&(r=I(r));const o=s?.id||r;let i=a?$:w([this.parentRoute.id===$?"":this.parentRoute.id,o]);r===$&&(r="/"),i!==$&&(i=w(["/",i]));const n=i===$?"/":w([this.parentRoute.fullPath,r]);this.path=r,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)}}
!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",a="popstate",r="beforeunload",o=t=>(t.preventDefault(),t.returnValue=""),i=()=>{removeEventListener(r,o,{capture:!0})};function n(t){let e=t.getLocation(),s=()=>{},a=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(),a.forEach((t=>t()))};return{get location(){return e},listen:e=>(0===a.size&&(s="function"==typeof t.listener?t.listener(u):()=>{}),a.add(e),()=>{a.delete(e),0===a.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(r,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}`),r=t?.createHref??(t=>t);return n({getLocation:()=>l(e(),history.state),listener:t=>{window.addEventListener(s,t),window.addEventListener(a,t);var e=window.history.pushState;window.history.pushState=function(){let s=e.apply(history,arguments);return t(),s};var r=window.history.replaceState;return window.history.replaceState=function(){let e=r.apply(history,arguments);return t(),e},()=>{window.history.pushState=e,window.history.replaceState=r,window.removeEventListener(s,t),window.removeEventListener(a,t)}},pushState:(t,e)=>{window.history.pushState({...e,key:u()},"",r(t))},replaceState:(t,e)=>{window.history.replaceState({...e,key:u()},"",r(t))},back:()=>window.history.back(),forward:()=>window.history.forward(),go:t=>window.history.go(t),createHref:t=>r(t)})}function c(t={initialEntries:["/"]}){const e=t.initialEntries;let s=t.initialIndex??e.length-1,a={};return n({getLocation:()=>l(e[s],a),listener:!1,pushState:(t,r)=>{a={...r,key:u()},e.push(t),s++},replaceState:(t,r)=>{a={...r,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("#"),a=t.indexOf("?");return{href:t,pathname:t.substring(0,s>0?a>0?Math.min(s,a):s:a>0?a:t.length),hash:s>-1?t.substring(s):"",search:a>-1?t.slice(a,-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,a=Array.isArray(t)&&Array.isArray(s);if(a||y(t)&&y(s)){const e=a?t.length:Object.keys(t).length,r=a?s:Object.keys(s),o=r.length,i=a?[]:{};let n=0;for(let e=0;e<o;e++){const o=a?e:r[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 a=x(e);const r=x(s);r.forEach(((t,e)=>{if("/"===t.value)e?e===r.length-1&&a.push(t):a=[t];else if(".."===t.value)a.length>1&&"/"===d(a)?.value&&a.pop(),a.pop();else{if("."===t.value)return;a.push(t)}}));return _(w([t,...a.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 a=e[t.value];return s?`${t.value}${a??""}`:a}return"param"===t.type?e[t.value.substring(1)]??"":t.value})))}function P(t,e,s){const a=M(t,e,s);if(!s.to||a)return a??{}}function M(t,e,s){e="/"!=t?e.substring(t.length):e;const a=`${s.to??"$"}`,r=x(e),o=x(a);e.startsWith("/")||r.unshift({type:"pathname",value:"/"}),a.startsWith("/")||o.unshift({type:"pathname",value:"/"});const i={};return(()=>{for(let t=0;t<Math.max(r.length,o.length);t++){const e=r[t],a=o[t],n=t>=r.length-1,h=t>=o.length-1;if(a){if("wildcard"===a.type)return!!e?.value&&(i["*"]=w(r.slice(t).map((t=>t.value))),!0);if("pathname"===a.type){if("/"===a.value&&!e?.value)return!0;if(e)if(s.caseSensitive){if(a.value!==e.value)return!1}else if(a.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===a.type){if("/"===e?.value)return!1;"$"!==e.value.charAt(0)&&(i[a.value.substring(1)]=e.value)}}if(!n&&h)return!!s.fuzzy}return!0})()?i:void 0}function L(t,e){var s,a,r,o="";for(s in t)if(void 0!==(r=t[s]))if(Array.isArray(r))for(a=0;a<r.length;a++)o&&(o+="&"),o+=encodeURIComponent(s)+"="+encodeURIComponent(r[a]);else o&&(o+="&"),o+=encodeURIComponent(s)+"="+encodeURIComponent(r);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,s,a={},r=t.split("&");e=r.shift();)void 0!==a[s=(e=e.split("=")).shift()]?a[s]=[].concat(a[s],A(e.shift())):a[s]=A(e.shift());return a}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 s=this.options,a=!s?.path&&!s?.id;this.parentRoute=this.options?.getParentRoute?.(),a?this.path=$:e(this.parentRoute);let r=a?$:s.path;r&&"/"!==r&&(r=I(r));const o=s?.id||r;let i=a?$:w([this.parentRoute.id===$?"":this.parentRoute.id,o]);r===$&&(r="/"),i!==$&&(i=w(["/",i]));const n=i===$?"/":w([this.parentRoute.fullPath,r]);this.path=r,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 a=e?.priority??this.options?.defaultPriority??"high";null===this._nextPriority||"high"===this._nextPriority?this._nextPriority=a: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),H=j(JSON.stringify);function k(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let s=D(e);for(let e in s){const a=s[e];if("string"==typeof a)try{s[e]=t(a)}catch(t){}}return s}}function j(t){return e=>{(e={...e})&&Object.keys(e).forEach((s=>{const a=e[s];if(void 0===a||void 0===a)delete e[s];else if(a&&"object"==typeof a&&null!==a)try{e[s]=t(a)}catch(t){}}));const s=L(e).toString();return s?`?${s}`:""}}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??H,parseSearch:t?.parseSearch??T},this.__store=new C(U(),{onUpdate:()=>{const t=this.state;this.state=this.__store.state;const e=t.matchesById!==this.state.matchesById;let s,a;e||(s=t.matchIds.length!==this.state.matchIds.length||t.matchIds.some(((t,e)=>t!==this.state.matchIds[e])),a=t.pendingMatchIds.length!==this.state.pendingMatchIds.length||t.pendingMatchIds.some(((t,e)=>t!==this.state.pendingMatchIds[e]))),(e||s)&&(this.state.matches=this.state.matchIds.map((t=>this.state.matchesById[t]))),(e||a)&&(this.state.pendingMatches=this.state.pendingMatchIds.map((t=>this.state.matchesById[t]))),this.state.isFetching=[...this.state.matches,...this.state.pendingMatches].some((t=>t.isFetching))},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.#a(s),this};buildNext=t=>{const e=this.#r(t),s=this.matchRoutes(e.pathname,e.search);return this.#r({...t,__matches:s})};cancelMatches=()=>{this.state.matches.forEach((t=>{this.cancelMatch(t.id)}))};cancelMatch=t=>{this.getRouteMatch(t)?.abortController?.abort()};safeLoad=t=>this.load(t).catch((t=>{}));latestLoadPromise=Promise.resolve();load=async t=>{const e=new Promise((async(s,a)=>{let r;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{if(await this.loadMatches(i),r=o())return await r;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(r=o())return await r;a(t)}}));return this.latestLoadPromise=e,this.latestLoadPromise};#o=(t,e)=>{const s={...t};let a=!1;return e.forEach((t=>{s[t.id]||(a=!0,s[t.id]=t)})),a?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 a={},r=this.flatRoutes.find((e=>{const s=E(this.basepath,t,{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive});return!!s&&(a=s,!0)}))||this.routesById.__root__,o=[r];for(;r?.parentRoute;)r=r.parentRoute,r&&o.unshift(r);let i={};const n=o.map((t=>{let r,o;try{r=t.options.parseParams?.(a)??a}catch(t){if(o=new z(t.message,{cause:t}),s?.throwOnError)throw o}Object.assign(i,r);const n=P(t.path,i),h=t.options.key?t.options.key({params:i,search:e})??"":"",c=h?JSON.stringify(h):"",l=P(t.id,i,!0)+c,u=this.getRouteMatch(l);if(u)return{...u};const d=!(!t.options.loader&&!F.some((e=>t.options[e]?.preload)));return{id:l,key:c,routeId:t.id,params:i,pathname:w([this.basepath,n]),updatedAt:Date.now(),invalidAt:1/0,preloadInvalidAt:1/0,routeSearch:{},search:{},status:d?"idle":"success",isFetching:!1,invalid:!1,error:void 0,paramsError:o,searchError:void 0,loaderData:void 0,loadPromise:Promise.resolve(),routeContext:void 0,context:void 0,abortController:new AbortController,fetchedAt:0}}));return n.forEach(((t,a)=>{const r=n[a-1],o=this.getRoute(t.routeId),i=(()=>{const a={search:r?.search??e,routeSearch:r?.routeSearch??e};try{const e=("object"==typeof o.options.validateSearch?o.options.validateSearch.parse:o.options.validateSearch)?.(a.search)??{},s={...a.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 a}})(),h=(()=>{try{const e=o.options.getContext?.({parentContext:r?.routeContext??{},context:r?.context??this?.options.context??{},params:t.params,search:t.search})||{};return{context:{...r?.context??this?.options.context,...e},routeContext:e}}catch(t){throw o.options.onError?.(t),t}})();Object.assign(t,{...i,...h})})),n};loadMatches=async(t,e)=>{let s;this.cleanMatches();try{await Promise.all(t.map((async(t,a)=>{const r=this.getRoute(t.routeId);e?.preload||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})));const o=(e,o)=>{if(s=s??a,o=o||r.options.onError,J(e))throw e;try{o?.(e)}catch(t){if(e=t,J(t))throw t}this.setRouteMatch(t.id,(t=>({...t,error:e,status:"error",updatedAt:Date.now()})))};t.paramsError&&o(t.paramsError,r.options.onParseParamsError),t.searchError&&o(t.searchError,r.options.onValidateSearchError);try{await(r.options.beforeLoad?.({...t,preload:!!e?.preload}))}catch(t){o(t,r.options.onBeforeLoadError)}})))}catch(t){throw e?.preload||this.navigate(t),t}const a=t.slice(0,s),r=[];a.forEach(((t,s)=>{r.push((async()=>{const a=r[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 r=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:a}),h=t=>!!J(t)&&(e?.preload||this.navigate(t),!0);try{const[a,o]=await Promise.all([r,i]);if(s=n())return await s;this.setRouteMatchData(t.id,(()=>o),e)}catch(e){if(s=n())return await s;if(h(e))return;const a=o.options.onLoadError??o.options.onError;let r=e;try{a?.(e)}catch(t){if(r=t,h(t))return}this.setRouteMatch(t.id,(t=>({...t,error:r,status:"error",isFetching:!1,updatedAt:Date.now()})))}})();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(r)};reload=()=>this.navigate({fromCurrent:!0,replace:!0,search:!0});resolvePath=(t,e)=>S(this.basepath,t,_(e));navigate=async({from:t,to:s="",search:a,hash:r,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:a,hash:r,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 a=e?.pending?this.state.location:this.state.resolvedLocation;if(!a)return!1;const r=E(this.basepath,a.pathname,{...e,to:s.pathname});return!!r&&(e?.includeSearch??1?!!v(a.search,s.search)&&r:r)};buildLink=({from:t,to:e=".",search:s,params:a,hash:r,target:o,replace:i,activeOptions:n,preload:h,preloadDelay:c,disabled:l})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const u={from:t,to:e,search:s,params:a,hash:r,replace:i},d=this.buildNext(u);h=h??this.options.defaultPreload;const p=c??this.options.defaultPreloadDelay??0,f=this.state.location.pathname.split("/"),m=d.pathname.split("/").every(((t,e)=>t===f[e])),y=n?.exact?this.state.location.pathname===d.pathname:m,g=!n?.includeHash||this.state.location.hash===d.hash,w=!(n?.includeSearch??1)||v(this.state.location.search,d.search);return{type:"internal",next:d,handleFocus:t=>{h&&this.preloadRoute(u).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(u))},handleEnter:t=>{const e=t.target||{};if(h){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(u).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))}),p)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},handleTouchStart:t=>{this.preloadRoute(u).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},isActive:y&&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 a=s;this.dehydratedData=a.payload,this.options.hydrate?.(a.payload),this.__store.setState((t=>({...t,...a.router.state,resolvedLocation:a.router.state.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}`,a="function"==typeof e?await e():e;return`<script id='${t}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${r=s,r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}"] = ${JSON.stringify(a)}\n ;(() => {\n var el = document.getElementById('${t}')\n el.parentElement.removeChild(el)\n })()\n <\/script>`;var r})),()=>this.hydrateData(t)}return()=>{}};hydrateData=t=>{if("undefined"!=typeof document){const e="string"==typeof t?t:JSON.stringify(t);return window[`__TSR_DEHYDRATED__${e}`]}};#a=t=>{this.routeTree=t,this.routesById={},this.routesByPath={},this.flatRoutes=[];const s=t=>{t.forEach(((t,a)=>{t.init({originalIndex:a,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 r=t.children;r?.length&&s(r)}))};s([t]),this.flatRoutes=Object.values(this.routesByPath).map(((t,e)=>{const s=I(t.fullPath),a=x(s);for(;a.length>1&&"/"===a[0]?.value;)a.shift();const r=a.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,trimmed:s,parsed:a,index:e,score:r}})).sort(((t,e)=>{let s="/"===t.trimmed?1:"/"===e.trimmed?-1:0;if(0!==s)return s;const a=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<a;s++)if(t.score[s]!==e.score[s])return e.score[s]-t.score[s];for(let s=0;s<a;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:a,state:r}=this.history.location;const o=this.options.parseSearch(s);return{pathname:e,searchStr:s,search:m(t?.search,o),hash:a.split("#").reverse()[0]??"",href:`${e}${s}${a}`,state:r,key:r?.key||"__init__"}};#r=(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 a={...d(this.matchRoutes(this.state.location.pathname,this.state.location.search))?.params};let r=!0===(t.params??!0)?a:p(t.params,a);r&&t.__matches?.map((t=>this.getRoute(t.routeId).options.stringifyParams)).filter(Boolean).forEach((t=>{r={...r,...t(r)}})),s=P(s,r??{});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 a="replace";t.replace||(a="push");this.state.location.href===e.href&&!e.key&&(a="replace");const r=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===a?"push":"replace"](r,{id:s,...e.state}),this.latestLoadPromise};getRouteMatch=t=>this.state.matchesById[t];setRouteMatch=(t,e)=>{this.__store.setState((s=>({...s,matchesById:{...s.matchesById,[t]:e(s.matchesById[t])}})))};setRouteMatchData=(t,e,s)=>{const a=this.getRouteMatch(t);if(!a)return;const r=this.getRoute(a.routeId),o=s?.updatedAt??Date.now(),i=o+(s?.maxAge??r.options.preloadMaxAge??this.options.defaultPreloadMaxAge??5e3),n=o+(s?.maxAge??r.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)),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=H,t.encode=L,t.functionalUpdate=p,t.interpolatePath=P,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=E,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=$,t.stringifySearchWith=j,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 s=this.state;this.state=this.options?.updateFn?this.options.updateFn(s)(t):t(s);const a=e?.priority??this.options?.defaultPriority??"high";null===this._nextPriority||"high"===this._nextPriority?this._nextPriority=a: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);function H(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let s=D(e);for(let e in s){const a=s[e];if("string"==typeof a)try{s[e]=t(a)}catch(t){}}return s}}function j(t){return e=>{(e={...e})&&Object.keys(e).forEach((s=>{const a=e[s];if(void 0===a||void 0===a)delete e[s];else if(a&&"object"==typeof a&&null!==a)try{e[s]=t(a)}catch(t){}}));const s=L(e).toString();return s?`?${s}`:""}}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;this.state=this.__store.state;const e=t.matchesById!==this.state.matchesById;let s,a;e||(s=t.matchIds.length!==this.state.matchIds.length||t.matchIds.some(((t,e)=>t!==this.state.matchIds[e])),a=t.pendingMatchIds.length!==this.state.pendingMatchIds.length||t.pendingMatchIds.some(((t,e)=>t!==this.state.pendingMatchIds[e]))),(e||s)&&(this.state.matches=this.state.matchIds.map((t=>this.state.matchesById[t]))),(e||a)&&(this.state.pendingMatches=this.state.pendingMatchIds.map((t=>this.state.matchesById[t]))),this.state.isFetching=[...this.state.matches,...this.state.pendingMatches].some((t=>t.isFetching))},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.#a(s),this};buildNext=t=>{const e=this.#r(t),s=this.matchRoutes(e.pathname,e.search);return this.#r({...t,__matches:s})};cancelMatches=()=>{this.state.matches.forEach((t=>{this.cancelMatch(t.id)}))};cancelMatch=t=>{this.getRouteMatch(t)?.abortController?.abort()};safeLoad=t=>this.load(t).catch((t=>{}));latestLoadPromise=Promise.resolve();load=async t=>{const e=new Promise((async(s,a)=>{let r;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{if(await this.loadMatches(i),r=o())return await r;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(r=o())return await r;a(t)}}));return this.latestLoadPromise=e,this.latestLoadPromise};#o=(t,e)=>{const s={...t};let a=!1;return e.forEach((t=>{s[t.id]||(a=!0,s[t.id]=t)})),a?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 a={},r=this.flatRoutes.find((e=>{const s=P(this.basepath,t,{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive});return!!s&&(a=s,!0)}))||this.routesById.__root__,o=[r];for(;r?.parentRoute;)r=r.parentRoute,r&&o.unshift(r);let i={};const n=o.map((t=>{let r,o;try{r=t.options.parseParams?.(a)??a}catch(t){if(o=new z(t.message,{cause:t}),s?.throwOnError)throw o}Object.assign(i,r);const n=E(t.path,i),h=t.options.key?t.options.key({params:i,search:e})??"":"",c=h?JSON.stringify(h):"",l=E(t.id,i,!0)+c,u=this.getRouteMatch(l);if(u)return{...u};const d=!(!t.options.loader&&!F.some((e=>t.options[e]?.preload)));return{id:l,key:c,routeId:t.id,params:i,pathname:w([this.basepath,n]),updatedAt:Date.now(),invalidAt:1/0,preloadInvalidAt:1/0,routeSearch:{},search:{},status:d?"idle":"success",isFetching:!1,invalid:!1,error:void 0,paramsError:o,searchError:void 0,loaderData:void 0,loadPromise:Promise.resolve(),routeContext:void 0,context:void 0,abortController:new AbortController,fetchedAt:0}}));return n.forEach(((t,a)=>{const r=n[a-1],o=this.getRoute(t.routeId),i=(()=>{const a={search:r?.search??e,routeSearch:r?.routeSearch??e};try{const e=("object"==typeof o.options.validateSearch?o.options.validateSearch.parse:o.options.validateSearch)?.(a.search)??{},s={...a.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 a}})(),h=(()=>{try{const e=o.options.getContext?.({parentContext:r?.routeContext??{},context:r?.context??this?.options.context??{},params:t.params,search:t.search})||{};return{context:{...r?.context??this?.options.context,...e},routeContext:e}}catch(t){throw o.options.onError?.(t),t}})();Object.assign(t,{...i,...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[a,r]of t.entries()){const t=this.getRoute(r.routeId),o=(e,o)=>{if(s=s??a,o=o||t.options.onError,J(e))throw e;try{o?.(e)}catch(t){if(e=t,J(t))throw t}this.setRouteMatch(r.id,(t=>({...t,error:e,status:"error",updatedAt:Date.now()})))};r.paramsError&&o(r.paramsError,t.options.onParseParamsError),r.searchError&&o(r.searchError,t.options.onValidateSearchError);let i=!1;try{await(t.options.beforeLoad?.({...r,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 a=t.slice(0,s),r=[];a.forEach(((t,s)=>{r.push((async()=>{const a=r[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 r=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:a}),h=t=>!!J(t)&&(e?.preload||this.navigate(t),!0);try{const[a,o]=await Promise.all([r,i]);if(s=n())return await s;this.setRouteMatchData(t.id,(()=>o),e)}catch(e){if(s=n())return await s;if(h(e))return;const a=o.options.onLoadError??o.options.onError;let r=e;try{a?.(e)}catch(t){if(r=t,h(t))return}this.setRouteMatch(t.id,(t=>({...t,error:r,status:"error",isFetching:!1,updatedAt:Date.now()})))}})();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(r)};reload=()=>this.navigate({fromCurrent:!0,replace:!0,search:!0});resolvePath=(t,e)=>S(this.basepath,t,_(e));navigate=async({from:t,to:s="",search:a,hash:r,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:a,hash:r,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 a=e?.pending?this.state.location:this.state.resolvedLocation;if(!a)return!1;const r=P(this.basepath,a.pathname,{...e,to:s.pathname});return!!r&&(e?.includeSearch??1?!!v(a.search,s.search)&&r:r)};buildLink=({from:t,to:e=".",search:s,params:a,hash:r,target:o,replace:i,activeOptions:n,preload:h,preloadDelay:c,disabled:l})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const u={from:t,to:e,search:s,params:a,hash:r,replace:i},d=this.buildNext(u);h=h??this.options.defaultPreload;const p=c??this.options.defaultPreloadDelay??0,f=this.state.location.pathname.split("/"),m=d.pathname.split("/").every(((t,e)=>t===f[e])),y=n?.exact?this.state.location.pathname===d.pathname:m,g=!n?.includeHash||this.state.location.hash===d.hash,w=!(n?.includeSearch??1)||v(this.state.location.search,d.search);return{type:"internal",next:d,handleFocus:t=>{h&&this.preloadRoute(u).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(u))},handleEnter:t=>{const e=t.target||{};if(h){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(u).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))}),p)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},handleTouchStart:t=>{this.preloadRoute(u).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},isActive:y&&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 a=s;this.dehydratedData=a.payload,this.options.hydrate?.(a.payload),this.__store.setState((t=>({...t,...a.router.state,resolvedLocation:a.router.state.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}`,a="function"==typeof e?await e():e;return`<script id='${t}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${r=s,r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}"] = ${JSON.stringify(a)}\n ;(() => {\n var el = document.getElementById('${t}')\n el.parentElement.removeChild(el)\n })()\n <\/script>`;var r})),()=>this.hydrateData(t)}return()=>{}};hydrateData=t=>{if("undefined"!=typeof document){const e="string"==typeof t?t:JSON.stringify(t);return window[`__TSR_DEHYDRATED__${e}`]}};#a=t=>{this.routeTree=t,this.routesById={},this.routesByPath={},this.flatRoutes=[];const s=t=>{t.forEach(((t,a)=>{t.init({originalIndex:a,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 r=t.children;r?.length&&s(r)}))};s([t]),this.flatRoutes=Object.values(this.routesByPath).map(((t,e)=>{const s=I(t.fullPath),a=x(s);for(;a.length>1&&"/"===a[0]?.value;)a.shift();const r=a.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,trimmed:s,parsed:a,index:e,score:r}})).sort(((t,e)=>{let s="/"===t.trimmed?1:"/"===e.trimmed?-1:0;if(0!==s)return s;const a=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<a;s++)if(t.score[s]!==e.score[s])return e.score[s]-t.score[s];for(let s=0;s<a;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:a,state:r}=this.history.location;const o=this.options.parseSearch(s);return{pathname:e,searchStr:s,search:m(t?.search,o),hash:a.split("#").reverse()[0]??"",href:`${e}${s}${a}`,state:r,key:r?.key||"__init__"}};#r=(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 a={...d(this.matchRoutes(this.state.location.pathname,this.state.location.search))?.params};let r=!0===(t.params??!0)?a:p(t.params,a);r&&t.__matches?.map((t=>this.getRoute(t.routeId).options.stringifyParams)).filter(Boolean).forEach((t=>{r={...r,...t(r)}})),s=E(s,r??{});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 a="replace";t.replace||(a="push");this.state.location.href===e.href&&!e.key&&(a="replace");const r=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===a?"push":"replace"](r,{id:s,...e.state}),this.latestLoadPromise};getRouteMatch=t=>this.state.matchesById[t];setRouteMatch=(t,e)=>{this.__store.setState((s=>({...s,matchesById:{...s.matchesById,[t]:e(s.matchesById[t])}})))};setRouteMatchData=(t,e,s)=>{const a=this.getRouteMatch(t);if(!a)return;const r=this.getRoute(a.routeId),o=s?.updatedAt??Date.now(),i=o+(s?.maxAge??r.options.preloadMaxAge??this.options.defaultPreloadMaxAge??5e3),n=o+(s?.maxAge??r.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)),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=k,t.encode=L,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=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.147",
"version": "0.0.1-beta.148",
"license": "MIT",

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

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

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

@@ -833,2 +833,19 @@ import { Store } from '@tanstack/react-store'

if (!opts?.preload) {
resolvedMatches.forEach((match) => {
// Update each match with its latest url data
this.setRouteMatch(match.id, (s) => ({
...s,
routeSearch: match.routeSearch,
search: match.search,
routeContext: match.routeContext,
context: match.context,
error: match.error,
paramsError: match.paramsError,
searchError: match.searchError,
params: match.params,
}))
})
}
let firstBadMatchIndex: number | undefined

@@ -838,68 +855,59 @@

try {
await Promise.all(
resolvedMatches.map(async (match, index) => {
const route = this.getRoute(match.routeId)
for (const [index, match] of resolvedMatches.entries()) {
const route = this.getRoute(match.routeId)
if (!opts?.preload) {
// Update each match with its latest url data
this.setRouteMatch(match.id, (s) => ({
...s,
routeSearch: match.routeSearch,
search: match.search,
routeContext: match.routeContext,
context: match.context,
error: match.error,
paramsError: match.paramsError,
searchError: match.searchError,
params: match.params,
}))
const handleError = (
err: any,
handler: undefined | ((err: any) => void),
) => {
firstBadMatchIndex = firstBadMatchIndex ?? index
handler = handler || route.options.onError
if (isRedirect(err)) {
throw err
}
const handleError = (
err: any,
handler: undefined | ((err: any) => void),
) => {
firstBadMatchIndex = firstBadMatchIndex ?? index
handler = handler || route.options.onError
try {
handler?.(err)
} catch (errorHandlerErr) {
err = errorHandlerErr
if (isRedirect(err)) {
throw err
if (isRedirect(errorHandlerErr)) {
throw errorHandlerErr
}
}
try {
handler?.(err)
} catch (errorHandlerErr) {
err = errorHandlerErr
this.setRouteMatch(match.id, (s) => ({
...s,
error: err,
status: 'error',
updatedAt: Date.now(),
}))
}
if (isRedirect(errorHandlerErr)) {
throw errorHandlerErr
}
}
if (match.paramsError) {
handleError(match.paramsError, route.options.onParseParamsError)
}
this.setRouteMatch(match.id, (s) => ({
...s,
error: err,
status: 'error',
updatedAt: Date.now(),
}))
}
if (match.searchError) {
handleError(match.searchError, route.options.onValidateSearchError)
}
if (match.paramsError) {
handleError(match.paramsError, route.options.onParseParamsError)
}
let didError = false
if (match.searchError) {
handleError(match.searchError, route.options.onValidateSearchError)
}
try {
await route.options.beforeLoad?.({
...match,
preload: !!opts?.preload,
})
} catch (err) {
handleError(err, route.options.onBeforeLoadError)
didError = true
}
try {
await route.options.beforeLoad?.({
...match,
preload: !!opts?.preload,
})
} catch (err) {
handleError(err, route.options.onBeforeLoadError)
}
}),
)
// If we errored, do not run the next matches' middleware
if (didError) {
break
}
}
} catch (err) {

@@ -906,0 +914,0 @@ if (!opts?.preload) {

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