Socket
Socket
Sign inDemoInstall

@tanstack/router

Package Overview
Dependencies
7
Maintainers
2
Versions
104
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1-beta.135 to 0.0.1-beta.136

22

build/cjs/history.js

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

const pushStateEvent = 'pushstate';
const popStateEvent = 'popstate';

@@ -49,4 +50,6 @@ const beforeUnloadEvent = 'beforeunload';

}
onUpdate();
// onUpdate()
};
const queueTask = task => {

@@ -58,2 +61,3 @@ queue.push(task);

location = opts.getLocation();
console.log('onUpdate', location);
listeners.forEach(listener => listener());

@@ -126,4 +130,20 @@ };

listener: onUpdate => {
window.addEventListener(pushStateEvent, onUpdate);
window.addEventListener(popStateEvent, onUpdate);
var pushState = window.history.pushState;
window.history.pushState = function () {
let res = pushState.apply(history, arguments);
onUpdate();
return res;
};
var replaceState = window.history.replaceState;
window.history.replaceState = function () {
let res = replaceState.apply(history, arguments);
onUpdate();
return res;
};
return () => {
window.history.pushState = pushState;
window.history.replaceState = replaceState;
window.removeEventListener(pushStateEvent, onUpdate);
window.removeEventListener(popStateEvent, onUpdate);

@@ -130,0 +150,0 @@ };

276

build/stats-react.json

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

"name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"uid": "8c88-47"
"uid": "2f48-47"
},
{
"name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"uid": "8c88-49"
"uid": "2f48-49"
}

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

{
"uid": "8c88-51",
"uid": "2f48-51",
"name": "history.ts"
},
{
"uid": "8c88-53",
"uid": "2f48-53",
"name": "utils.ts"
},
{
"uid": "8c88-55",
"uid": "2f48-55",
"name": "path.ts"
},
{
"uid": "8c88-57",
"uid": "2f48-57",
"name": "qss.ts"
},
{
"uid": "8c88-65",
"uid": "2f48-65",
"name": "react.tsx"
},
{
"uid": "8c88-67",
"uid": "2f48-67",
"name": "route.ts"
},
{
"uid": "8c88-69",
"uid": "2f48-69",
"name": "searchParams.ts"
},
{
"uid": "8c88-71",
"uid": "2f48-71",
"name": "router.ts"
},
{
"uid": "8c88-73",
"uid": "2f48-73",
"name": "index.ts"

@@ -70,7 +70,7 @@ }

"name": "store/build/esm/index.js",
"uid": "8c88-61"
"uid": "2f48-61"
},
{
"name": "react-store/build/esm/index.js",
"uid": "8c88-63"
"uid": "2f48-63"
}

@@ -80,3 +80,3 @@ ]

{
"uid": "8c88-59",
"uid": "2f48-59",
"name": "\u0000rollupPluginBabelHelpers.js"

@@ -90,92 +90,92 @@ }

"nodeParts": {
"8c88-47": {
"2f48-47": {
"renderedLength": 199,
"gzipLength": 134,
"brotliLength": 0,
"mainUid": "8c88-46"
"mainUid": "2f48-46"
},
"8c88-49": {
"2f48-49": {
"renderedLength": 48,
"gzipLength": 65,
"brotliLength": 0,
"mainUid": "8c88-48"
"mainUid": "2f48-48"
},
"8c88-51": {
"renderedLength": 5643,
"gzipLength": 1404,
"2f48-51": {
"renderedLength": 6421,
"gzipLength": 1538,
"brotliLength": 0,
"mainUid": "8c88-50"
"mainUid": "2f48-50"
},
"8c88-53": {
"2f48-53": {
"renderedLength": 2821,
"gzipLength": 990,
"brotliLength": 0,
"mainUid": "8c88-52"
"mainUid": "2f48-52"
},
"8c88-55": {
"2f48-55": {
"renderedLength": 6028,
"gzipLength": 1423,
"brotliLength": 0,
"mainUid": "8c88-54"
"mainUid": "2f48-54"
},
"8c88-57": {
"2f48-57": {
"renderedLength": 1395,
"gzipLength": 558,
"brotliLength": 0,
"mainUid": "8c88-56"
"mainUid": "2f48-56"
},
"8c88-59": {
"2f48-59": {
"renderedLength": 457,
"gzipLength": 241,
"brotliLength": 0,
"mainUid": "8c88-58"
"mainUid": "2f48-58"
},
"8c88-61": {
"2f48-61": {
"renderedLength": 1969,
"gzipLength": 653,
"brotliLength": 0,
"mainUid": "8c88-60"
"mainUid": "2f48-60"
},
"8c88-63": {
"2f48-63": {
"renderedLength": 1070,
"gzipLength": 485,
"brotliLength": 0,
"mainUid": "8c88-62"
"mainUid": "2f48-62"
},
"8c88-65": {
"2f48-65": {
"renderedLength": 15046,
"gzipLength": 3421,
"brotliLength": 0,
"mainUid": "8c88-64"
"mainUid": "2f48-64"
},
"8c88-67": {
"2f48-67": {
"renderedLength": 4568,
"gzipLength": 1127,
"brotliLength": 0,
"mainUid": "8c88-66"
"mainUid": "2f48-66"
},
"8c88-69": {
"2f48-69": {
"renderedLength": 1387,
"gzipLength": 483,
"brotliLength": 0,
"mainUid": "8c88-68"
"mainUid": "2f48-68"
},
"8c88-71": {
"2f48-71": {
"renderedLength": 34156,
"gzipLength": 7760,
"brotliLength": 0,
"mainUid": "8c88-70"
"mainUid": "2f48-70"
},
"8c88-73": {
"2f48-73": {
"renderedLength": 0,
"gzipLength": 0,
"brotliLength": 0,
"mainUid": "8c88-72"
"mainUid": "2f48-72"
}
},
"nodeMetas": {
"8c88-46": {
"2f48-46": {
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"moduleParts": {
"index.production.js": "8c88-47"
"index.production.js": "2f48-47"
},

@@ -185,19 +185,19 @@ "imported": [],

{
"uid": "8c88-72"
"uid": "2f48-72"
},
{
"uid": "8c88-66"
"uid": "2f48-66"
},
{
"uid": "8c88-70"
"uid": "2f48-70"
},
{
"uid": "8c88-64"
"uid": "2f48-64"
}
]
},
"8c88-48": {
"2f48-48": {
"id": "/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"moduleParts": {
"index.production.js": "8c88-49"
"index.production.js": "2f48-49"
},

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

{
"uid": "8c88-72"
"uid": "2f48-72"
},
{
"uid": "8c88-64"
"uid": "2f48-64"
}
]
},
"8c88-50": {
"2f48-50": {
"id": "/packages/router/src/history.ts",
"moduleParts": {
"index.production.js": "8c88-51"
"index.production.js": "2f48-51"
},

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

{
"uid": "8c88-72"
"uid": "2f48-72"
},
{
"uid": "8c88-70"
"uid": "2f48-70"
}
]
},
"8c88-52": {
"2f48-52": {
"id": "/packages/router/src/utils.ts",
"moduleParts": {
"index.production.js": "8c88-53"
"index.production.js": "2f48-53"
},

@@ -239,23 +239,23 @@ "imported": [],

{
"uid": "8c88-72"
"uid": "2f48-72"
},
{
"uid": "8c88-54"
"uid": "2f48-54"
},
{
"uid": "8c88-70"
"uid": "2f48-70"
},
{
"uid": "8c88-64"
"uid": "2f48-64"
}
]
},
"8c88-54": {
"2f48-54": {
"id": "/packages/router/src/path.ts",
"moduleParts": {
"index.production.js": "8c88-55"
"index.production.js": "2f48-55"
},
"imported": [
{
"uid": "8c88-52"
"uid": "2f48-52"
}

@@ -265,16 +265,16 @@ ],

{
"uid": "8c88-72"
"uid": "2f48-72"
},
{
"uid": "8c88-66"
"uid": "2f48-66"
},
{
"uid": "8c88-70"
"uid": "2f48-70"
}
]
},
"8c88-56": {
"2f48-56": {
"id": "/packages/router/src/qss.ts",
"moduleParts": {
"index.production.js": "8c88-57"
"index.production.js": "2f48-57"
},

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

{
"uid": "8c88-72"
"uid": "2f48-72"
},
{
"uid": "8c88-68"
"uid": "2f48-68"
}
]
},
"8c88-58": {
"2f48-58": {
"id": "\u0000rollupPluginBabelHelpers.js",
"moduleParts": {
"index.production.js": "8c88-59"
"index.production.js": "2f48-59"
},

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

{
"uid": "8c88-64"
"uid": "2f48-64"
}
]
},
"8c88-60": {
"2f48-60": {
"id": "/packages/store/build/esm/index.js",
"moduleParts": {
"index.production.js": "8c88-61"
"index.production.js": "2f48-61"
},

@@ -313,17 +313,17 @@ "imported": [],

{
"uid": "8c88-62"
"uid": "2f48-62"
}
]
},
"8c88-62": {
"2f48-62": {
"id": "/packages/react-store/build/esm/index.js",
"moduleParts": {
"index.production.js": "8c88-63"
"index.production.js": "2f48-63"
},
"imported": [
{
"uid": "8c88-77"
"uid": "2f48-77"
},
{
"uid": "8c88-60"
"uid": "2f48-60"
}

@@ -333,32 +333,32 @@ ],

{
"uid": "8c88-70"
"uid": "2f48-70"
},
{
"uid": "8c88-64"
"uid": "2f48-64"
}
]
},
"8c88-64": {
"2f48-64": {
"id": "/packages/router/src/react.tsx",
"moduleParts": {
"index.production.js": "8c88-65"
"index.production.js": "2f48-65"
},
"imported": [
{
"uid": "8c88-58"
"uid": "2f48-58"
},
{
"uid": "8c88-76"
"uid": "2f48-76"
},
{
"uid": "8c88-62"
"uid": "2f48-62"
},
{
"uid": "8c88-46"
"uid": "2f48-46"
},
{
"uid": "8c88-48"
"uid": "2f48-48"
},
{
"uid": "8c88-52"
"uid": "2f48-52"
}

@@ -368,23 +368,23 @@ ],

{
"uid": "8c88-72"
"uid": "2f48-72"
},
{
"uid": "8c88-66"
"uid": "2f48-66"
}
]
},
"8c88-66": {
"2f48-66": {
"id": "/packages/router/src/route.ts",
"moduleParts": {
"index.production.js": "8c88-67"
"index.production.js": "2f48-67"
},
"imported": [
{
"uid": "8c88-46"
"uid": "2f48-46"
},
{
"uid": "8c88-54"
"uid": "2f48-54"
},
{
"uid": "8c88-64"
"uid": "2f48-64"
}

@@ -394,14 +394,14 @@ ],

{
"uid": "8c88-72"
"uid": "2f48-72"
}
]
},
"8c88-68": {
"2f48-68": {
"id": "/packages/router/src/searchParams.ts",
"moduleParts": {
"index.production.js": "8c88-69"
"index.production.js": "2f48-69"
},
"imported": [
{
"uid": "8c88-56"
"uid": "2f48-56"
}

@@ -411,32 +411,32 @@ ],

{
"uid": "8c88-72"
"uid": "2f48-72"
},
{
"uid": "8c88-70"
"uid": "2f48-70"
}
]
},
"8c88-70": {
"2f48-70": {
"id": "/packages/router/src/router.ts",
"moduleParts": {
"index.production.js": "8c88-71"
"index.production.js": "2f48-71"
},
"imported": [
{
"uid": "8c88-62"
"uid": "2f48-62"
},
{
"uid": "8c88-46"
"uid": "2f48-46"
},
{
"uid": "8c88-54"
"uid": "2f48-54"
},
{
"uid": "8c88-68"
"uid": "2f48-68"
},
{
"uid": "8c88-52"
"uid": "2f48-52"
},
{
"uid": "8c88-50"
"uid": "2f48-50"
}

@@ -446,47 +446,47 @@ ],

{
"uid": "8c88-72"
"uid": "2f48-72"
}
]
},
"8c88-72": {
"2f48-72": {
"id": "/packages/router/src/index.ts",
"moduleParts": {
"index.production.js": "8c88-73"
"index.production.js": "2f48-73"
},
"imported": [
{
"uid": "8c88-46"
"uid": "2f48-46"
},
{
"uid": "8c88-48"
"uid": "2f48-48"
},
{
"uid": "8c88-50"
"uid": "2f48-50"
},
{
"uid": "8c88-74"
"uid": "2f48-74"
},
{
"uid": "8c88-54"
"uid": "2f48-54"
},
{
"uid": "8c88-56"
"uid": "2f48-56"
},
{
"uid": "8c88-66"
"uid": "2f48-66"
},
{
"uid": "8c88-75"
"uid": "2f48-75"
},
{
"uid": "8c88-70"
"uid": "2f48-70"
},
{
"uid": "8c88-68"
"uid": "2f48-68"
},
{
"uid": "8c88-52"
"uid": "2f48-52"
},
{
"uid": "8c88-64"
"uid": "2f48-64"
}

@@ -497,3 +497,3 @@ ],

},
"8c88-74": {
"2f48-74": {
"id": "/packages/router/src/link.ts",

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

{
"uid": "8c88-72"
"uid": "2f48-72"
}
]
},
"8c88-75": {
"2f48-75": {
"id": "/packages/router/src/routeInfo.ts",

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

{
"uid": "8c88-72"
"uid": "2f48-72"
}
]
},
"8c88-76": {
"2f48-76": {
"id": "react",

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

{
"uid": "8c88-64"
"uid": "2f48-64"
}

@@ -532,3 +532,3 @@ ],

},
"8c88-77": {
"2f48-77": {
"id": "use-sync-external-store/shim/with-selector",

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

{
"uid": "8c88-62"
"uid": "2f48-62"
}

@@ -542,0 +542,0 @@ ],

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

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

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

* @license MIT
*/class T{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 o=e?.priority??this.options?.defaultPriority??"high";null===this._nextPriority||"high"===this._nextPriority?this._nextPriority=o: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()}}
*/class A{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 o=e?.priority??this.options?.defaultPriority??"high";null===this._nextPriority||"high"===this._nextPriority?this._nextPriority=o: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()}}
/**

@@ -33,3 +33,3 @@ * @tanstack/react-store/src/index.tsx

* @license MIT
*/function A(t,e=(t=>t)){return r.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,H)}function H(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(e,r[o])||!Object.is(t[r[o]],e[r[o]]))return!1;return!0}function N(t){const e=J(),{type:r,children:o,target:s,activeProps:a=(()=>({className:"active"})),inactiveProps:i=(()=>({})),activeOptions:c,disabled:h,hash:l,search:u,params:d,to:p=".",preload:f,preloadDelay:m,replace:g,style:v,className:w,onClick:b,onFocus:S,onMouseEnter:E,onMouseLeave:R,onTouchStart:_,...P}=t,x=e.buildLink(t);if("external"===x.type){const{href:t}=x;return{href:t}}const{handleClick:M,handleFocus:C,handleEnter:L,handleLeave:O,handleTouchStart:j,isActive:k,next:I}=x,D=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},$=k?y(a,{})??{}:{},T=k?{}:y(i,{})??{};return{...$,...T,...P,href:h?void 0:I.href,onClick:D([b,e=>{(t.startTransition??1)&&(n.startTransition||(t=>t))((()=>{M(e)}))}]),onFocus:D([S,C]),onMouseEnter:D([E,L]),onMouseLeave:D([R,O]),onTouchStart:D([_,j]),target:s,style:{...v,...$.style,...T.style},className:[w,$.className,T.className].filter(Boolean).join(" ")||void 0,...h?{role:"link","aria-disabled":!0}:void 0,"data-status":k?"active":void 0}}const B=n.forwardRef(((t,e)=>{const r=N(t);return n.createElement("a",$({ref:e},r,{children:"function"==typeof t.children?t.children({isActive:"active"===r["data-status"]}):t.children}))}));const U=n.createContext(null),F=n.createContext(null);function z(t){return A(J().__store,t?.select)}function W(){const t=z({select:t=>t.matches.map((t=>t.id))});return n.createElement(U.Provider,{value:[void 0,...t]},n.createElement(rt,{errorComponent:nt,onCatch:()=>{}},n.createElement(Q,null)))}function J(){return n.useContext(F)}function K(t){const e=J(),r=n.useContext(U)[0],o=e.getRouteMatch(r)?.routeId,a=z({select:e=>{const o=e.matches;return(t?.from?o.find((e=>e.routeId===t?.from)):o.find((t=>t.id===r))).routeId}});(t?.strict??1)&&s(o==a);return z({select:e=>{const o=e.matches,n=t?.from?o.find((e=>e.routeId===t?.from)):o.find((t=>t.id===r));return s(n,t?.from&&t.from),t?.select?.(n)??n}})}function q(t){return K({...t,select:e=>t?.select?.(e.loader)??e.loader})}function Y(t){return K({...t,select:e=>t?.select?.(e.search)??e.search})}function V(t){return z({select:e=>{const r=m(e.matches)?.params;return t?.select?.(r)??r}})}function G(){const t=J();return n.useCallback((e=>{const{pending:r,caseSensitive:o,...n}=e;return t.matchRoute(n,{pending:r,caseSensitive:o})}),[])}function Q(){const t=n.useContext(U).slice(1);return t[0]?n.createElement(Z,{matchIds:t}):null}const X=()=>null;function Z({matchIds:t}){const e=J(),r=t[0],o=e.getRouteMatch(r).routeId,s=e.getRoute(o),a=s.options.pendingComponent??e.options.defaultPendingComponent??X,i=s.options.errorComponent??e.options.defaultErrorComponent,c=s.options.wrapInSuspense??!s.isRoot?n.Suspense:et,h=i?rt:et;return n.createElement(U.Provider,{value:t},n.createElement(c,{fallback:n.createElement(a,null)},n.createElement(h,{key:s.id,errorComponent:i,onCatch:()=>{}},n.createElement(tt,{matchId:r}))))}function tt({matchId:t}){const e=J(),r=z({select:e=>g(e.matches.find((e=>e.id===t)),["status","loadPromise","routeId","error"])}),o=e.getRoute(r.routeId);if("error"===r.status)throw r.error;if("pending"===r.status&&s(!1),"success"===r.status){let t=o.options.component??e.options.defaultComponent;return t?n.createElement(t,{useLoader:o.useLoader,useMatch:o.useMatch,useContext:o.useContext,useSearch:o.useSearch,useParams:o.useParams}):n.createElement(Q,null)}s(!1)}function et(t){return n.createElement(n.Fragment,null,t.children)}class rt extends n.Component{state={error:!1,info:void 0};componentDidCatch(t,e){this.props.onCatch(t,e),this.setState({error:t,info:e})}render(){return n.createElement(ot,$({},this.props,{errorState:this.state,reset:()=>this.setState({})}))}}function ot(t){const e=z({select:t=>t.resolvedLocation.key}),[r,o]=n.useState(t.errorState),s=t.errorComponent??nt,a=n.useRef("");return n.useEffect((()=>{r&&e!==a.current&&o({}),a.current=e}),[r,e]),n.useEffect((()=>{t.errorState.error&&o(t.errorState)}),[t.errorState.error]),t.errorState.error&&r.error?n.createElement(s,r):t.children}function nt({error:t}){return n.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},n.createElement("strong",{style:{fontSize:"1.2rem"}},"Something went wrong!"),n.createElement("div",{style:{height:".5rem"}}),n.createElement("div",null,n.createElement("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".5rem",color:"red",overflow:"auto"}},t.message?n.createElement("code",null,t.message):null)))}function st(t,e=!0){const r=J();n.useEffect((()=>{if(!e)return;let o=r.history.block(((e,r)=>{window.confirm(t)&&(o(),e())}));return o}))}const at="__root__";class it{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute}init=t=>{this.originalIndex=t.originalIndex,this.router=t.router;const e=this.options,r=!e?.path&&!e?.id;this.parentRoute=this.options?.getParentRoute?.(),r?this.path=at:s(this.parentRoute);let o=r?at:e.path;o&&"/"!==o&&(o=x(o));const n=e?.id||o;let a=r?at:E([this.parentRoute.id===at?"":this.parentRoute.id,n]);o===at&&(o="/"),a!==at&&(a=E(["/",a]));const i=a===at?"/":E([this.parentRoute.fullPath,o]);this.path=o,this.id=a,this.fullPath=i,this.to=i};addChildren=t=>(this.children=t,this);update=t=>(Object.assign(this.options,t),this);useMatch=t=>K({...t,from:this.id});useLoader=t=>q({...t,from:this.id});useContext=t=>K({...t,from:this.id,select:e=>t?.select?.(e.context)??e.context});useSearch=t=>Y({...t,from:this.id});useParams=t=>V({...t,from:this.id})}class ct extends it{constructor(t){super(t)}}const ht=ut(JSON.parse),lt=dt(JSON.stringify);function ut(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let r=D(e);for(let e in r){const o=r[e];if("string"==typeof o)try{r[e]=t(o)}catch(t){}}return r}}function dt(t){return e=>{(e={...e})&&Object.keys(e).forEach((r=>{const o=e[r];if(void 0===o||void 0===o)delete e[r];else if(o&&"object"==typeof o&&null!==o)try{e[r]=t(o)}catch(t){}}));const r=k(e).toString();return r?`?${r}`:""}}const pt=["component","errorComponent","pendingComponent"];const ft="undefined"==typeof window||!window.document.createElement;function mt(){return{status:"idle",resolvedLocation:null,location:null,matches:[],pendingMatches:[],preloadMatches:{},lastUpdated:Date.now()}}function yt(t){return!!t?.isRedirect}class gt extends Error{}class vt extends Error{}t.Block=function({message:t,condition:e,children:r}){return st(t,e),r??null},t.ErrorComponent=nt,t.Link=B,t.MatchRoute=function(t){const e=G()(t);return"function"==typeof t.children?t.children(e):e?t.children:null},t.Navigate=function(t){const e=J();return n.useLayoutEffect((()=>{e.navigate(t)}),[]),null},t.Outlet=Q,t.PathParamError=vt,t.RootRoute=ct,t.Route=it,t.Router=class{#t;startedLoadingAt=Date.now();resolveNavigation=()=>{};constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??lt,parseSearch:t?.parseSearch??ht},this.__store=new T(mt(),{onUpdate:()=>{this.state=this.__store.state},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,mt())))};mount=()=>{this.state.matches.length||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??(ft?d():u());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=`/${x(e??"")??""}`,r&&r!==this.routeTree&&this.#o(r),this};buildNext=t=>{const e=this.#n(t),r=this.matchRoutes(e.pathname,e.search);return this.#n({...t,__matches:r})};cancelMatches=()=>{this.state.matches.forEach((t=>{this.cancelMatch(t.id)}))};cancelMatch=t=>{this.getRouteMatch(t)?.abortController?.abort()};safeLoad=t=>{this.load(t).catch((t=>{}))};load=async t=>{this.#s();const e=Date.now();let r;if(this.startedLoadingAt=e,this.cancelMatches(),this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,location:t.next}))),r=this.matchRoutes(this.state.location.pathname,this.state.location.search,{throwOnError:!0}),this.__store.setState((t=>({...t,status:"pending",pendingMatches:r})))})),await this.loadMatches(r),this.startedLoadingAt!==e)return this.navigationPromise;const o=this.state.resolvedLocation;this.__store.setState((t=>({...t,status:"idle",resolvedLocation:t.location,matches:t.pendingMatches,pendingMatches:[]}))),o.href!==this.state.location.href&&this.options.onRouteChange?.(),this.resolveNavigation()};getRoute=t=>{const e=this.routesById[t];return s(e),e};preloadRoute=async(t=this.state.location)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,e.search,{throwOnError:!0}),o={};return r.forEach((t=>{this.state.matches.find((e=>e.id===t.id))||(o[t.id]=t)})),this.__store.setState((t=>({...t,preloadMatches:{...t.preloadMatches,...o}}))),await this.loadMatches(r,{preload:!0}),r};matchRoutes=(t,e,r)=>{let o={},n=this.flatRoutes.find((e=>{const r=O(this.basepath,t,{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive});return!!r&&(o=r,!0)}))||this.routesById.__root__,s=[n];for(;n?.parentRoute;)n=n.parentRoute,n&&s.unshift(n);let a={};const i=s.map((t=>{let n,s;try{n=t.options.parseParams?.(o)??o}catch(t){if(s=new vt(t.message,{cause:t}),r?.throwOnError)throw s}Object.assign(a,n);const i=L(t.path,a),c=L(t.id,a,!0)+(t.options.getKey?.({params:a,search:e})??""),h=this.getRouteMatch(c);if(h)return{...h};const l=!(!t.options.loader&&!pt.some((e=>t.options[e]?.preload)));return{id:c,routeId:t.id,params:a,pathname:E([this.basepath,i]),updatedAt:0,routeSearch:{},search:{},status:l?"pending":"success",error:void 0,paramsError:s,searchError:void 0,loader:void 0,loadPromise:Promise.resolve(),routeContext:void 0,context:void 0,abortController:new AbortController,fetchedAt:0}}));return i.forEach(((t,o)=>{const n=i[o-1],s=this.getRoute(t.routeId),a=(()=>{const o={search:n?.search??e,routeSearch:n?.routeSearch??e};try{const e=("object"==typeof s.options.validateSearch?s.options.validateSearch.parse:s.options.validateSearch)?.(o.search)??{},r={...o.search,...e};return{routeSearch:v(t.routeSearch,e),search:v(t.search,r)}}catch(e){if(t.searchError=new gt(e.message,{cause:e}),r?.throwOnError)throw t.searchError;return o}})(),c=(()=>{try{const e=s.options.getContext?.({parentContext:n?.routeContext??{},context:n?.context??this?.options.context??{},params:t.params,search:t.search})||{};return{context:{...n?.context??this?.options.context,...e},routeContext:e}}catch(t){throw s.options.onError?.(t),t}})();Object.assign(t,{...a,...c})})),i};loadMatches=async(t,e)=>{let r;try{await Promise.all(t.map((async(t,o)=>{const n=this.getRoute(t.routeId),s=(e,s)=>{if(r=r??o,s=s||n.options.onError,yt(e))throw e;try{s?.(e)}catch(t){if(e=t,yt(t))throw t}this.setRouteMatch(t.id,(t=>({...t,error:e,status:"error",updatedAt:Date.now()})))};t.paramsError&&s(t.paramsError,n.options.onParseParamsError),t.searchError&&s(t.searchError,n.options.onValidateSearchError);try{await(n.options.beforeLoad?.({...t,preload:!!e?.preload}))}catch(t){s(t,n.options.onBeforeLoadError)}})))}catch(t){throw e?.preload||this.navigate(t),t}const o=t.slice(0,r),n=[];o.forEach(((t,r)=>{n.push(Promise.resolve().then((async()=>{const o=n[r-1],s=this.getRoute(t.routeId),a=Date.now(),i=Promise.resolve().then((async()=>{const r=()=>{const e=this.getRouteMatch(t.id);return e&&e.fetchedAt!==a?e.loadPromise:void 0};let n;const i=Promise.all(pt.map((async t=>{const e=s.options[t];e?.preload&&await e.preload()}))),c=Promise.resolve().then((()=>{if(s.options.loader)return s.options.loader({...t,preload:!!e?.preload,parentMatchPromise:o})}));try{const[o,s]=await Promise.all([i,c]);if(n=r())return await n;e?.preload&&this.state.matches.find((e=>e.id===t.id))||this.setRouteMatch(t.id,(t=>({...t,error:void 0,status:"success",updatedAt:Date.now(),loader:s})))}catch(o){if(n=r())return await n;if(yt(o))return void(e?.preload||this.navigate(o));const a=s.options.onLoadError??s.options.onError;let i=o;try{a?.(o)}catch(t){if(i=t,yt(t))return void(e?.preload||this.navigate(t))}this.setRouteMatch(t.id,(t=>({...t,error:i,status:"error",updatedAt:Date.now()})))}finally{if(n=r())return await n;e?.preload&&this.__store.setState((e=>{const r={...e.preloadMatches};return delete r[t.id],{...e,preloadMatches:r}}))}}));this.setRouteMatch(t.id,(t=>({...t,loadPromise:i,fetchedAt:a}))),await i})))})),await Promise.all(n)};reload=()=>{this.navigate({fromCurrent:!0,replace:!0,search:!0})};resolvePath=(t,e)=>M(this.basepath,t,R(e));navigate=async({from:t,to:e="",search:r,hash:o,replace:n,params:a})=>{const i=String(e),c=void 0===t?t:String(t);let h;try{new URL(`${i}`),h=!0}catch(t){}return s(!h),this.#e({from:c,to:i,search:r,hash:o,replace:n,params:a})};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 o=e?.pending?this.state.location:this.state.resolvedLocation;if(!o)return!1;const n=O(this.basepath,o.pathname,{...e,to:r.pathname});return!!n&&(e?.includeSearch??1?!!S(o.search,r.search)&&n:n)};buildLink=({from:t,to:e=".",search:r,params:o,hash:n,target:s,replace:a,activeOptions:i,preload:c,preloadDelay:h,disabled:l})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const u={from:t,to:e,search:r,params:o,hash:n,replace:a},d=this.buildNext(u);c=c??this.options.defaultPreload;const p=h??this.options.defaultPreloadDelay??0,f=this.state.location.pathname.split("/"),m=d.pathname.split("/").every(((t,e)=>t===f[e])),y=i?.exact?this.state.location.pathname===d.pathname:m,g=!i?.includeHash||this.state.location.hash===d.hash,v=!(i?.includeSearch??1)||S(this.state.location.search,d.search);return{type:"internal",next:d,handleFocus:t=>{c&&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||s&&"_self"!==s||0!==t.button||(t.preventDefault(),this.#e(u))},handleEnter:t=>{const e=t.target||{};if(c){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&&v,disabled:l}};dehydrate=()=>({state:g(this.state,["location","status","lastUpdated"])});hydrate=async t=>{let e=t;"undefined"!=typeof document&&(e=window.__TSR_DEHYDRATED__),s(e);const r=e;this.dehydratedData=r.payload,this.options.hydrate?.(r.payload),this.__store.setState((t=>({...t,...r.router.state,matches:t.matches,resolvedLocation:r.router.state.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}`,o="function"==typeof e?await e():e;return`<script id='${t}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${n=r,n.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}"] = ${JSON.stringify(o)}\n ;(() => {\n var el = document.getElementById('${t}')\n el.parentElement.removeChild(el)\n })()\n <\/script>`;var n})),()=>this.hydrateData(t)}return()=>{}};hydrateData=t=>{if("undefined"!=typeof document){const e="string"==typeof t?t:JSON.stringify(t);return window[`__TSR_DEHYDRATED__${e}`]}};#o=t=>{this.routeTree=t,this.routesById={},this.routesByPath={},this.flatRoutes=[];const e=t=>{t.forEach(((t,r)=>{t.init({originalIndex:r,router:this});if(s(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t,!t.isRoot&&t.path){const e=P(t.fullPath);this.routesByPath[e]&&!t.fullPath.endsWith("/")||(this.routesByPath[e]=t)}const o=t.children;o?.length&&e(o)}))};e([t]),this.flatRoutes=Object.values(this.routesByPath).map(((t,e)=>{const r=x(t.fullPath),o=C(r);for(;o.length>1&&"/"===o[0]?.value;)o.shift();const n=o.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,trimmed:r,parsed:o,index:e,score:n}})).sort(((t,e)=>{let r="/"===t.trimmed?1:"/"===e.trimmed?-1:0;if(0!==r)return r;const o=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<o;r++)if(t.score[r]!==e.score[r])return e.score[r]-t.score[r];for(let r=0;r<o;r++)if(t.parsed[r].value!==e.parsed[r].value)return t.parsed[r].value>e.parsed[r].value?1:-1;return t.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:o,state:n}=this.history.location;const s=this.options.parseSearch(r);return{pathname:e,searchStr:r,search:v(t?.search,s),hash:o.split("#").reverse()[0]??"",href:`${e}${r}${o}`,state:n,key:n?.key||"__init__"}};#n=(t={})=>{t.fromCurrent=t.fromCurrent??""===t.to;const e=t.fromCurrent?this.state.location.pathname:t.from??this.state.location.pathname;let r=M(this.basepath??"/",e,`${t.to??""}`);const o={...m(this.matchRoutes(this.state.location.pathname,this.state.location.search))?.params};let n=!0===(t.params??!0)?o:y(t.params,o);n&&t.__matches?.map((t=>this.getRoute(t.routeId).options.stringifyParams)).filter(Boolean).forEach((t=>{n={...n,...t(n)}})),r=L(r,n??{});const s=t.__matches?.map((t=>this.getRoute(t.routeId).options.preSearchFilters??[])).flat().filter(Boolean)??[],a=t.__matches?.map((t=>this.getRoute(t.routeId).options.postSearchFilters??[])).flat().filter(Boolean)??[],i=s?.length?s?.reduce(((t,e)=>e(t)),this.state.location.search):this.state.location.search,c=!0===t.search?i:t.search?y(t.search,i)??{}:s?.length?i:{},h=a?.length?a.reduce(((t,e)=>e(t)),c):c,l=v(this.state.location.search,h),u=this.options.stringifySearch(l),d=!0===t.hash?this.state.location.hash:y(t.hash,this.state.location.hash),p=d?`#${d}`:"";return{pathname:r,search:l,searchStr:u,state:!0===t.state?this.state.location.state:y(t.state,this.state.location.state),hash:d,href:this.history.createHref(`${r}${u}${p}`),key:t.key}};#e=async t=>{const e=this.buildNext(t),r=""+Date.now()+Math.random();this.navigateTimeout&&clearTimeout(this.navigateTimeout);let o="replace";t.replace||(o="push");this.state.location.href===e.href&&!e.key&&(o="replace");const n=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===o?"push":"replace"](n,{id:r,...e.state}),this.#s()};#s=()=>{const t=this.resolveNavigation;return this.navigationPromise=new Promise((e=>{this.resolveNavigation=()=>{e(),t()}})),this.navigationPromise};getRouteMatch=t=>this.state.matches.find((e=>e.id===t))||this.state.preloadMatches[t];#a=(t,e)=>{this.__store.setState((r=>({...r,matches:r.matches.map((r=>r.id===t?e(r):r))})))};#i=(t,e)=>{this.__store.setState((r=>({...r,pendingMatches:r.pendingMatches.map((r=>r.id===t?e(r):r))})))};#c=(t,e)=>{s(this.state.preloadMatches[t]),this.__store.setState((r=>({...r,preloadMatches:{...r.preloadMatches,[t]:e(r.preloadMatches[t])}})))};setRouteMatch=(t,e)=>this.state.matches.find((e=>e.id===t))?this.#a(t,e):this.state.pendingMatches.find((e=>e.id===t))?this.#i(t,e):this.state.preloadMatches[t]?this.#c(t,e):void 0},t.RouterContext=class{constructor(){}createRootRoute=t=>new ct(t)},t.RouterProvider=function({router:t,...e}){t.update(e),n.useEffect((()=>{let e;return n.startTransition((()=>{e=t.mount()})),e}),[t]);const r=t.options.Wrap||n.Fragment;return n.createElement(n.Suspense,{fallback:null},n.createElement(r,null,n.createElement(F.Provider,{value:t},n.createElement(W,null))))},t.SearchParamError=gt,t.cleanPath=R,t.componentTypes=pt,t.createBrowserHistory=u,t.createHashHistory=function(){return u({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=d,t.decode=D,t.defaultParseSearch=ht,t.defaultStringifySearch=lt,t.encode=k,t.functionalUpdate=y,t.interpolatePath=L,t.invariant=s,t.isPlainObject=w,t.isRedirect=yt,t.joinPaths=E,t.last=m,t.lazyFn=function(t,e){return async(...r)=>(await t())[e||"default"](...r)},t.lazyRouteComponent=function(t,e){let r;const o=()=>(r||(r=t()),r),s=n.lazy((async()=>({default:(await o())[e??"default"]})));return s.preload=o,s},t.matchByPath=j,t.matchIdsContext=U,t.matchPathname=O,t.parsePathname=C,t.parseSearchWith=ut,t.partialDeepEqual=S,t.pick=g,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=v,t.resolvePath=M,t.rootRouteId=at,t.routerContext=F,t.shallow=function(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(e,r[o])||!Object.is(t[r[o]],e[r[o]]))return!1;return!0},t.stringifySearchWith=dt,t.trimPath=x,t.trimPathLeft=_,t.trimPathRight=P,t.useBlocker=st,t.useDehydrate=function(){const t=J();return n.useCallback((function(e,r){return t.dehydrateData(e,r)}),[])},t.useHydrate=function(){const t=J();return function(e){return t.hydrateData(e)}},t.useInjectHtml=function(){const t=J();return n.useCallback((e=>{t.injectHtml(e)}),[])},t.useLinkProps=N,t.useLoader=q,t.useMatch=K,t.useMatchRoute=G,t.useMatches=function(t){const e=n.useContext(U);return z({select:r=>{const o=r.matches.slice(r.matches.findIndex((t=>t.id===e[0])));return t?.select?.(o)??o}})},t.useNavigate=function(t){const e=J();return n.useCallback((r=>e.navigate({...t,...r})),[])},t.useParams=V,t.useRouter=J,t.useRouterState=z,t.useSearch=Y,t.useStore=A,t.warning=function(t,e){},Object.defineProperty(t,"__esModule",{value:!0})}));
*/function H(t,e=(t=>t)){return r.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,N)}function N(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(e,r[o])||!Object.is(t[r[o]],e[r[o]]))return!1;return!0}function B(t){const e=K(),{type:r,children:o,target:s,activeProps:a=(()=>({className:"active"})),inactiveProps:i=(()=>({})),activeOptions:c,disabled:h,hash:l,search:u,params:d,to:p=".",preload:f,preloadDelay:m,replace:y,style:v,className:w,onClick:b,onFocus:S,onMouseEnter:E,onMouseLeave:R,onTouchStart:_,...P}=t,x=e.buildLink(t);if("external"===x.type){const{href:t}=x;return{href:t}}const{handleClick:M,handleFocus:C,handleEnter:L,handleLeave:O,handleTouchStart:j,isActive:k,next:I}=x,D=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},$=k?g(a,{})??{}:{},T=k?{}:g(i,{})??{};return{...$,...T,...P,href:h?void 0:I.href,onClick:D([b,e=>{(t.startTransition??1)&&(n.startTransition||(t=>t))((()=>{M(e)}))}]),onFocus:D([S,C]),onMouseEnter:D([E,L]),onMouseLeave:D([R,O]),onTouchStart:D([_,j]),target:s,style:{...v,...$.style,...T.style},className:[w,$.className,T.className].filter(Boolean).join(" ")||void 0,...h?{role:"link","aria-disabled":!0}:void 0,"data-status":k?"active":void 0}}const U=n.forwardRef(((t,e)=>{const r=B(t);return n.createElement("a",T({ref:e},r,{children:"function"==typeof t.children?t.children({isActive:"active"===r["data-status"]}):t.children}))}));const F=n.createContext(null),z=n.createContext(null);function W(t){return H(K().__store,t?.select)}function J(){const t=W({select:t=>t.matches.map((t=>t.id))});return n.createElement(F.Provider,{value:[void 0,...t]},n.createElement(ot,{errorComponent:st,onCatch:()=>{}},n.createElement(X,null)))}function K(){return n.useContext(z)}function q(t){const e=K(),r=n.useContext(F)[0],o=e.getRouteMatch(r)?.routeId,a=W({select:e=>{const o=e.matches;return(t?.from?o.find((e=>e.routeId===t?.from)):o.find((t=>t.id===r))).routeId}});(t?.strict??1)&&s(o==a);return W({select:e=>{const o=e.matches,n=t?.from?o.find((e=>e.routeId===t?.from)):o.find((t=>t.id===r));return s(n,t?.from&&t.from),t?.select?.(n)??n}})}function Y(t){return q({...t,select:e=>t?.select?.(e.loader)??e.loader})}function V(t){return q({...t,select:e=>t?.select?.(e.search)??e.search})}function G(t){return W({select:e=>{const r=y(e.matches)?.params;return t?.select?.(r)??r}})}function Q(){const t=K();return n.useCallback((e=>{const{pending:r,caseSensitive:o,...n}=e;return t.matchRoute(n,{pending:r,caseSensitive:o})}),[])}function X(){const t=n.useContext(F).slice(1);return t[0]?n.createElement(tt,{matchIds:t}):null}const Z=()=>null;function tt({matchIds:t}){const e=K(),r=t[0],o=e.getRouteMatch(r).routeId,s=e.getRoute(o),a=s.options.pendingComponent??e.options.defaultPendingComponent??Z,i=s.options.errorComponent??e.options.defaultErrorComponent,c=s.options.wrapInSuspense??!s.isRoot?n.Suspense:rt,h=i?ot:rt;return n.createElement(F.Provider,{value:t},n.createElement(c,{fallback:n.createElement(a,null)},n.createElement(h,{key:s.id,errorComponent:i,onCatch:()=>{}},n.createElement(et,{matchId:r}))))}function et({matchId:t}){const e=K(),r=W({select:e=>v(e.matches.find((e=>e.id===t)),["status","loadPromise","routeId","error"])}),o=e.getRoute(r.routeId);if("error"===r.status)throw r.error;if("pending"===r.status&&s(!1),"success"===r.status){let t=o.options.component??e.options.defaultComponent;return t?n.createElement(t,{useLoader:o.useLoader,useMatch:o.useMatch,useContext:o.useContext,useSearch:o.useSearch,useParams:o.useParams}):n.createElement(X,null)}s(!1)}function rt(t){return n.createElement(n.Fragment,null,t.children)}class ot extends n.Component{state={error:!1,info:void 0};componentDidCatch(t,e){this.props.onCatch(t,e),this.setState({error:t,info:e})}render(){return n.createElement(nt,T({},this.props,{errorState:this.state,reset:()=>this.setState({})}))}}function nt(t){const e=W({select:t=>t.resolvedLocation.key}),[r,o]=n.useState(t.errorState),s=t.errorComponent??st,a=n.useRef("");return n.useEffect((()=>{r&&e!==a.current&&o({}),a.current=e}),[r,e]),n.useEffect((()=>{t.errorState.error&&o(t.errorState)}),[t.errorState.error]),t.errorState.error&&r.error?n.createElement(s,r):t.children}function st({error:t}){return n.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},n.createElement("strong",{style:{fontSize:"1.2rem"}},"Something went wrong!"),n.createElement("div",{style:{height:".5rem"}}),n.createElement("div",null,n.createElement("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".5rem",color:"red",overflow:"auto"}},t.message?n.createElement("code",null,t.message):null)))}function at(t,e=!0){const r=K();n.useEffect((()=>{if(!e)return;let o=r.history.block(((e,r)=>{window.confirm(t)&&(o(),e())}));return o}))}const it="__root__";class ct{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute}init=t=>{this.originalIndex=t.originalIndex,this.router=t.router;const e=this.options,r=!e?.path&&!e?.id;this.parentRoute=this.options?.getParentRoute?.(),r?this.path=it:s(this.parentRoute);let o=r?it:e.path;o&&"/"!==o&&(o=M(o));const n=e?.id||o;let a=r?it:R([this.parentRoute.id===it?"":this.parentRoute.id,n]);o===it&&(o="/"),a!==it&&(a=R(["/",a]));const i=a===it?"/":R([this.parentRoute.fullPath,o]);this.path=o,this.id=a,this.fullPath=i,this.to=i};addChildren=t=>(this.children=t,this);update=t=>(Object.assign(this.options,t),this);useMatch=t=>q({...t,from:this.id});useLoader=t=>Y({...t,from:this.id});useContext=t=>q({...t,from:this.id,select:e=>t?.select?.(e.context)??e.context});useSearch=t=>V({...t,from:this.id});useParams=t=>G({...t,from:this.id})}class ht extends ct{constructor(t){super(t)}}const lt=dt(JSON.parse),ut=pt(JSON.stringify);function dt(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let r=$(e);for(let e in r){const o=r[e];if("string"==typeof o)try{r[e]=t(o)}catch(t){}}return r}}function pt(t){return e=>{(e={...e})&&Object.keys(e).forEach((r=>{const o=e[r];if(void 0===o||void 0===o)delete e[r];else if(o&&"object"==typeof o&&null!==o)try{e[r]=t(o)}catch(t){}}));const r=I(e).toString();return r?`?${r}`:""}}const ft=["component","errorComponent","pendingComponent"];const mt="undefined"==typeof window||!window.document.createElement;function yt(){return{status:"idle",resolvedLocation:null,location:null,matches:[],pendingMatches:[],preloadMatches:{},lastUpdated:Date.now()}}function gt(t){return!!t?.isRedirect}class vt extends Error{}class wt extends Error{}t.Block=function({message:t,condition:e,children:r}){return at(t,e),r??null},t.ErrorComponent=st,t.Link=U,t.MatchRoute=function(t){const e=Q()(t);return"function"==typeof t.children?t.children(e):e?t.children:null},t.Navigate=function(t){const e=K();return n.useLayoutEffect((()=>{e.navigate(t)}),[]),null},t.Outlet=X,t.PathParamError=wt,t.RootRoute=ht,t.Route=ct,t.Router=class{#t;startedLoadingAt=Date.now();resolveNavigation=()=>{};constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??ut,parseSearch:t?.parseSearch??lt},this.__store=new A(yt(),{onUpdate:()=>{this.state=this.__store.state},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,yt())))};mount=()=>{this.state.matches.length||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??(mt?p():d());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=`/${M(e??"")??""}`,r&&r!==this.routeTree&&this.#o(r),this};buildNext=t=>{const e=this.#n(t),r=this.matchRoutes(e.pathname,e.search);return this.#n({...t,__matches:r})};cancelMatches=()=>{this.state.matches.forEach((t=>{this.cancelMatch(t.id)}))};cancelMatch=t=>{this.getRouteMatch(t)?.abortController?.abort()};safeLoad=t=>{this.load(t).catch((t=>{}))};load=async t=>{this.#s();const e=Date.now();let r;if(this.startedLoadingAt=e,this.cancelMatches(),this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,location:t.next}))),r=this.matchRoutes(this.state.location.pathname,this.state.location.search,{throwOnError:!0}),this.__store.setState((t=>({...t,status:"pending",pendingMatches:r})))})),await this.loadMatches(r),this.startedLoadingAt!==e)return this.navigationPromise;const o=this.state.resolvedLocation;this.__store.setState((t=>({...t,status:"idle",resolvedLocation:t.location,matches:t.pendingMatches,pendingMatches:[]}))),o.href!==this.state.location.href&&this.options.onRouteChange?.(),this.resolveNavigation()};getRoute=t=>{const e=this.routesById[t];return s(e),e};preloadRoute=async(t=this.state.location)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,e.search,{throwOnError:!0}),o={};return r.forEach((t=>{this.state.matches.find((e=>e.id===t.id))||(o[t.id]=t)})),this.__store.setState((t=>({...t,preloadMatches:{...t.preloadMatches,...o}}))),await this.loadMatches(r,{preload:!0}),r};matchRoutes=(t,e,r)=>{let o={},n=this.flatRoutes.find((e=>{const r=j(this.basepath,t,{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive});return!!r&&(o=r,!0)}))||this.routesById.__root__,s=[n];for(;n?.parentRoute;)n=n.parentRoute,n&&s.unshift(n);let a={};const i=s.map((t=>{let n,s;try{n=t.options.parseParams?.(o)??o}catch(t){if(s=new wt(t.message,{cause:t}),r?.throwOnError)throw s}Object.assign(a,n);const i=O(t.path,a),c=O(t.id,a,!0)+(t.options.getKey?.({params:a,search:e})??""),h=this.getRouteMatch(c);if(h)return{...h};const l=!(!t.options.loader&&!ft.some((e=>t.options[e]?.preload)));return{id:c,routeId:t.id,params:a,pathname:R([this.basepath,i]),updatedAt:0,routeSearch:{},search:{},status:l?"pending":"success",error:void 0,paramsError:s,searchError:void 0,loader:void 0,loadPromise:Promise.resolve(),routeContext:void 0,context:void 0,abortController:new AbortController,fetchedAt:0}}));return i.forEach(((t,o)=>{const n=i[o-1],s=this.getRoute(t.routeId),a=(()=>{const o={search:n?.search??e,routeSearch:n?.routeSearch??e};try{const e=("object"==typeof s.options.validateSearch?s.options.validateSearch.parse:s.options.validateSearch)?.(o.search)??{},r={...o.search,...e};return{routeSearch:w(t.routeSearch,e),search:w(t.search,r)}}catch(e){if(t.searchError=new vt(e.message,{cause:e}),r?.throwOnError)throw t.searchError;return o}})(),c=(()=>{try{const e=s.options.getContext?.({parentContext:n?.routeContext??{},context:n?.context??this?.options.context??{},params:t.params,search:t.search})||{};return{context:{...n?.context??this?.options.context,...e},routeContext:e}}catch(t){throw s.options.onError?.(t),t}})();Object.assign(t,{...a,...c})})),i};loadMatches=async(t,e)=>{let r;try{await Promise.all(t.map((async(t,o)=>{const n=this.getRoute(t.routeId),s=(e,s)=>{if(r=r??o,s=s||n.options.onError,gt(e))throw e;try{s?.(e)}catch(t){if(e=t,gt(t))throw t}this.setRouteMatch(t.id,(t=>({...t,error:e,status:"error",updatedAt:Date.now()})))};t.paramsError&&s(t.paramsError,n.options.onParseParamsError),t.searchError&&s(t.searchError,n.options.onValidateSearchError);try{await(n.options.beforeLoad?.({...t,preload:!!e?.preload}))}catch(t){s(t,n.options.onBeforeLoadError)}})))}catch(t){throw e?.preload||this.navigate(t),t}const o=t.slice(0,r),n=[];o.forEach(((t,r)=>{n.push(Promise.resolve().then((async()=>{const o=n[r-1],s=this.getRoute(t.routeId),a=Date.now(),i=Promise.resolve().then((async()=>{const r=()=>{const e=this.getRouteMatch(t.id);return e&&e.fetchedAt!==a?e.loadPromise:void 0};let n;const i=Promise.all(ft.map((async t=>{const e=s.options[t];e?.preload&&await e.preload()}))),c=Promise.resolve().then((()=>{if(s.options.loader)return s.options.loader({...t,preload:!!e?.preload,parentMatchPromise:o})}));try{const[o,s]=await Promise.all([i,c]);if(n=r())return await n;e?.preload&&this.state.matches.find((e=>e.id===t.id))||this.setRouteMatch(t.id,(t=>({...t,error:void 0,status:"success",updatedAt:Date.now(),loader:s})))}catch(o){if(n=r())return await n;if(gt(o))return void(e?.preload||this.navigate(o));const a=s.options.onLoadError??s.options.onError;let i=o;try{a?.(o)}catch(t){if(i=t,gt(t))return void(e?.preload||this.navigate(t))}this.setRouteMatch(t.id,(t=>({...t,error:i,status:"error",updatedAt:Date.now()})))}finally{if(n=r())return await n;e?.preload&&this.__store.setState((e=>{const r={...e.preloadMatches};return delete r[t.id],{...e,preloadMatches:r}}))}}));this.setRouteMatch(t.id,(t=>({...t,loadPromise:i,fetchedAt:a}))),await i})))})),await Promise.all(n)};reload=()=>{this.navigate({fromCurrent:!0,replace:!0,search:!0})};resolvePath=(t,e)=>C(this.basepath,t,_(e));navigate=async({from:t,to:e="",search:r,hash:o,replace:n,params:a})=>{const i=String(e),c=void 0===t?t:String(t);let h;try{new URL(`${i}`),h=!0}catch(t){}return s(!h),this.#e({from:c,to:i,search:r,hash:o,replace:n,params:a})};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 o=e?.pending?this.state.location:this.state.resolvedLocation;if(!o)return!1;const n=j(this.basepath,o.pathname,{...e,to:r.pathname});return!!n&&(e?.includeSearch??1?!!E(o.search,r.search)&&n:n)};buildLink=({from:t,to:e=".",search:r,params:o,hash:n,target:s,replace:a,activeOptions:i,preload:c,preloadDelay:h,disabled:l})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const u={from:t,to:e,search:r,params:o,hash:n,replace:a},d=this.buildNext(u);c=c??this.options.defaultPreload;const p=h??this.options.defaultPreloadDelay??0,f=this.state.location.pathname.split("/"),m=d.pathname.split("/").every(((t,e)=>t===f[e])),y=i?.exact?this.state.location.pathname===d.pathname:m,g=!i?.includeHash||this.state.location.hash===d.hash,v=!(i?.includeSearch??1)||E(this.state.location.search,d.search);return{type:"internal",next:d,handleFocus:t=>{c&&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||s&&"_self"!==s||0!==t.button||(t.preventDefault(),this.#e(u))},handleEnter:t=>{const e=t.target||{};if(c){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&&v,disabled:l}};dehydrate=()=>({state:v(this.state,["location","status","lastUpdated"])});hydrate=async t=>{let e=t;"undefined"!=typeof document&&(e=window.__TSR_DEHYDRATED__),s(e);const r=e;this.dehydratedData=r.payload,this.options.hydrate?.(r.payload),this.__store.setState((t=>({...t,...r.router.state,matches:t.matches,resolvedLocation:r.router.state.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}`,o="function"==typeof e?await e():e;return`<script id='${t}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${n=r,n.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}"] = ${JSON.stringify(o)}\n ;(() => {\n var el = document.getElementById('${t}')\n el.parentElement.removeChild(el)\n })()\n <\/script>`;var n})),()=>this.hydrateData(t)}return()=>{}};hydrateData=t=>{if("undefined"!=typeof document){const e="string"==typeof t?t:JSON.stringify(t);return window[`__TSR_DEHYDRATED__${e}`]}};#o=t=>{this.routeTree=t,this.routesById={},this.routesByPath={},this.flatRoutes=[];const e=t=>{t.forEach(((t,r)=>{t.init({originalIndex:r,router:this});if(s(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t,!t.isRoot&&t.path){const e=x(t.fullPath);this.routesByPath[e]&&!t.fullPath.endsWith("/")||(this.routesByPath[e]=t)}const o=t.children;o?.length&&e(o)}))};e([t]),this.flatRoutes=Object.values(this.routesByPath).map(((t,e)=>{const r=M(t.fullPath),o=L(r);for(;o.length>1&&"/"===o[0]?.value;)o.shift();const n=o.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,trimmed:r,parsed:o,index:e,score:n}})).sort(((t,e)=>{let r="/"===t.trimmed?1:"/"===e.trimmed?-1:0;if(0!==r)return r;const o=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<o;r++)if(t.score[r]!==e.score[r])return e.score[r]-t.score[r];for(let r=0;r<o;r++)if(t.parsed[r].value!==e.parsed[r].value)return t.parsed[r].value>e.parsed[r].value?1:-1;return t.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:o,state:n}=this.history.location;const s=this.options.parseSearch(r);return{pathname:e,searchStr:r,search:w(t?.search,s),hash:o.split("#").reverse()[0]??"",href:`${e}${r}${o}`,state:n,key:n?.key||"__init__"}};#n=(t={})=>{t.fromCurrent=t.fromCurrent??""===t.to;const e=t.fromCurrent?this.state.location.pathname:t.from??this.state.location.pathname;let r=C(this.basepath??"/",e,`${t.to??""}`);const o={...y(this.matchRoutes(this.state.location.pathname,this.state.location.search))?.params};let n=!0===(t.params??!0)?o:g(t.params,o);n&&t.__matches?.map((t=>this.getRoute(t.routeId).options.stringifyParams)).filter(Boolean).forEach((t=>{n={...n,...t(n)}})),r=O(r,n??{});const s=t.__matches?.map((t=>this.getRoute(t.routeId).options.preSearchFilters??[])).flat().filter(Boolean)??[],a=t.__matches?.map((t=>this.getRoute(t.routeId).options.postSearchFilters??[])).flat().filter(Boolean)??[],i=s?.length?s?.reduce(((t,e)=>e(t)),this.state.location.search):this.state.location.search,c=!0===t.search?i:t.search?g(t.search,i)??{}:s?.length?i:{},h=a?.length?a.reduce(((t,e)=>e(t)),c):c,l=w(this.state.location.search,h),u=this.options.stringifySearch(l),d=!0===t.hash?this.state.location.hash:g(t.hash,this.state.location.hash),p=d?`#${d}`:"";return{pathname:r,search:l,searchStr:u,state:!0===t.state?this.state.location.state:g(t.state,this.state.location.state),hash:d,href:this.history.createHref(`${r}${u}${p}`),key:t.key}};#e=async t=>{const e=this.buildNext(t),r=""+Date.now()+Math.random();this.navigateTimeout&&clearTimeout(this.navigateTimeout);let o="replace";t.replace||(o="push");this.state.location.href===e.href&&!e.key&&(o="replace");const n=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===o?"push":"replace"](n,{id:r,...e.state}),this.#s()};#s=()=>{const t=this.resolveNavigation;return this.navigationPromise=new Promise((e=>{this.resolveNavigation=()=>{e(),t()}})),this.navigationPromise};getRouteMatch=t=>this.state.matches.find((e=>e.id===t))||this.state.preloadMatches[t];#a=(t,e)=>{this.__store.setState((r=>({...r,matches:r.matches.map((r=>r.id===t?e(r):r))})))};#i=(t,e)=>{this.__store.setState((r=>({...r,pendingMatches:r.pendingMatches.map((r=>r.id===t?e(r):r))})))};#c=(t,e)=>{s(this.state.preloadMatches[t]),this.__store.setState((r=>({...r,preloadMatches:{...r.preloadMatches,[t]:e(r.preloadMatches[t])}})))};setRouteMatch=(t,e)=>this.state.matches.find((e=>e.id===t))?this.#a(t,e):this.state.pendingMatches.find((e=>e.id===t))?this.#i(t,e):this.state.preloadMatches[t]?this.#c(t,e):void 0},t.RouterContext=class{constructor(){}createRootRoute=t=>new ht(t)},t.RouterProvider=function({router:t,...e}){t.update(e),n.useEffect((()=>{let e;return n.startTransition((()=>{e=t.mount()})),e}),[t]);const r=t.options.Wrap||n.Fragment;return n.createElement(n.Suspense,{fallback:null},n.createElement(r,null,n.createElement(z.Provider,{value:t},n.createElement(J,null))))},t.SearchParamError=vt,t.cleanPath=_,t.componentTypes=ft,t.createBrowserHistory=d,t.createHashHistory=function(){return d({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=p,t.decode=$,t.defaultParseSearch=lt,t.defaultStringifySearch=ut,t.encode=I,t.functionalUpdate=g,t.interpolatePath=O,t.invariant=s,t.isPlainObject=b,t.isRedirect=gt,t.joinPaths=R,t.last=y,t.lazyFn=function(t,e){return async(...r)=>(await t())[e||"default"](...r)},t.lazyRouteComponent=function(t,e){let r;const o=()=>(r||(r=t()),r),s=n.lazy((async()=>({default:(await o())[e??"default"]})));return s.preload=o,s},t.matchByPath=k,t.matchIdsContext=F,t.matchPathname=j,t.parsePathname=L,t.parseSearchWith=dt,t.partialDeepEqual=E,t.pick=v,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=w,t.resolvePath=C,t.rootRouteId=it,t.routerContext=z,t.shallow=function(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(e,r[o])||!Object.is(t[r[o]],e[r[o]]))return!1;return!0},t.stringifySearchWith=pt,t.trimPath=M,t.trimPathLeft=P,t.trimPathRight=x,t.useBlocker=at,t.useDehydrate=function(){const t=K();return n.useCallback((function(e,r){return t.dehydrateData(e,r)}),[])},t.useHydrate=function(){const t=K();return function(e){return t.hydrateData(e)}},t.useInjectHtml=function(){const t=K();return n.useCallback((e=>{t.injectHtml(e)}),[])},t.useLinkProps=B,t.useLoader=Y,t.useMatch=q,t.useMatchRoute=Q,t.useMatches=function(t){const e=n.useContext(F);return W({select:r=>{const o=r.matches.slice(r.matches.findIndex((t=>t.id===e[0])));return t?.select?.(o)??o}})},t.useNavigate=function(t){const e=K();return n.useCallback((r=>e.navigate({...t,...r})),[])},t.useParams=G,t.useRouter=K,t.useRouterState=W,t.useSearch=V,t.useStore=H,t.warning=function(t,e){},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.production.js.map
{
"name": "@tanstack/router",
"author": "Tanner Linsley",
"version": "0.0.1-beta.135",
"version": "0.0.1-beta.136",
"license": "MIT",

@@ -6,0 +6,0 @@ "repository": "tanstack/router",

@@ -30,2 +30,3 @@ // While the public API was clearly inspired by the "history" npm package,

const pushStateEvent = 'pushstate'
const popStateEvent = 'popstate'

@@ -75,3 +76,3 @@ const beforeUnloadEvent = 'beforeunload'

onUpdate()
// onUpdate()
}

@@ -86,2 +87,3 @@

location = opts.getLocation()
console.log('onUpdate', location)
listeners.forEach((listener) => listener())

@@ -167,4 +169,22 @@ }

listener: (onUpdate) => {
window.addEventListener(pushStateEvent, onUpdate)
window.addEventListener(popStateEvent, onUpdate)
var pushState = window.history.pushState
window.history.pushState = function () {
let res = pushState.apply(history, arguments as any)
onUpdate()
return res
}
var replaceState = window.history.replaceState
window.history.replaceState = function () {
let res = replaceState.apply(history, arguments as any)
onUpdate()
return res
}
return () => {
window.history.pushState = pushState
window.history.replaceState = replaceState
window.removeEventListener(pushStateEvent, onUpdate)
window.removeEventListener(popStateEvent, onUpdate)

@@ -171,0 +191,0 @@ }

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

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc