You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@tanstack/router

Package Overview
Dependencies
Maintainers
2
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1-beta.128 to 0.0.1-beta.129

5

build/cjs/react.js

@@ -213,3 +213,4 @@ /**

React__namespace.useEffect(router.mount, [router]);
return /*#__PURE__*/React__namespace.createElement(routerContext.Provider, {
const Wrap = router.options.Wrap || React__namespace.Fragment;
return /*#__PURE__*/React__namespace.createElement(Wrap, null, /*#__PURE__*/React__namespace.createElement(routerContext.Provider, {
value: router

@@ -225,3 +226,3 @@ }, /*#__PURE__*/React__namespace.createElement(routerStateContext.Provider, {

}
}, /*#__PURE__*/React__namespace.createElement(Outlet, null)))));
}, /*#__PURE__*/React__namespace.createElement(Outlet, null))))));
}

@@ -228,0 +229,0 @@ function useRouter() {

280

build/stats-react.json

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

"name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"uid": "11cf-49"
"uid": "fabd-49"
},
{
"name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"uid": "11cf-51"
"uid": "fabd-51"
}

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

{
"uid": "11cf-53",
"uid": "fabd-53",
"name": "history.ts"
},
{
"uid": "11cf-55",
"uid": "fabd-55",
"name": "utils.ts"
},
{
"uid": "11cf-57",
"uid": "fabd-57",
"name": "path.ts"
},
{
"uid": "11cf-59",
"uid": "fabd-59",
"name": "qss.ts"
},
{
"uid": "11cf-67",
"uid": "fabd-67",
"name": "react.tsx"
},
{
"uid": "11cf-69",
"uid": "fabd-69",
"name": "route.ts"
},
{
"uid": "11cf-71",
"uid": "fabd-71",
"name": "searchParams.ts"
},
{
"uid": "11cf-73",
"uid": "fabd-73",
"name": "router.ts"
},
{
"uid": "11cf-75",
"uid": "fabd-75",
"name": "index.ts"

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

"name": "store/build/esm/index.js",
"uid": "11cf-63"
"uid": "fabd-63"
},
{
"name": "react-store/build/esm/index.js",
"uid": "11cf-65"
"uid": "fabd-65"
}

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

{
"uid": "11cf-61",
"uid": "fabd-61",
"name": "\u0000rollupPluginBabelHelpers.js"

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

"nodeParts": {
"11cf-49": {
"fabd-49": {
"renderedLength": 199,
"gzipLength": 134,
"brotliLength": 0,
"mainUid": "11cf-48"
"mainUid": "fabd-48"
},
"11cf-51": {
"fabd-51": {
"renderedLength": 48,
"gzipLength": 65,
"brotliLength": 0,
"mainUid": "11cf-50"
"mainUid": "fabd-50"
},
"11cf-53": {
"fabd-53": {
"renderedLength": 5643,
"gzipLength": 1404,
"brotliLength": 0,
"mainUid": "11cf-52"
"mainUid": "fabd-52"
},
"11cf-55": {
"fabd-55": {
"renderedLength": 2821,
"gzipLength": 990,
"brotliLength": 0,
"mainUid": "11cf-54"
"mainUid": "fabd-54"
},
"11cf-57": {
"fabd-57": {
"renderedLength": 6028,
"gzipLength": 1423,
"brotliLength": 0,
"mainUid": "11cf-56"
"mainUid": "fabd-56"
},
"11cf-59": {
"fabd-59": {
"renderedLength": 1395,
"gzipLength": 558,
"brotliLength": 0,
"mainUid": "11cf-58"
"mainUid": "fabd-58"
},
"11cf-61": {
"fabd-61": {
"renderedLength": 457,
"gzipLength": 241,
"brotliLength": 0,
"mainUid": "11cf-60"
"mainUid": "fabd-60"
},
"11cf-63": {
"fabd-63": {
"renderedLength": 1459,
"gzipLength": 543,
"brotliLength": 0,
"mainUid": "11cf-62"
"mainUid": "fabd-62"
},
"11cf-65": {
"fabd-65": {
"renderedLength": 2158,
"gzipLength": 750,
"brotliLength": 0,
"mainUid": "11cf-64"
"mainUid": "fabd-64"
},
"11cf-67": {
"renderedLength": 15342,
"gzipLength": 3645,
"fabd-67": {
"renderedLength": 15468,
"gzipLength": 3672,
"brotliLength": 0,
"mainUid": "11cf-66"
"mainUid": "fabd-66"
},
"11cf-69": {
"fabd-69": {
"renderedLength": 4424,
"gzipLength": 1083,
"brotliLength": 0,
"mainUid": "11cf-68"
"mainUid": "fabd-68"
},
"11cf-71": {
"fabd-71": {
"renderedLength": 1387,
"gzipLength": 483,
"brotliLength": 0,
"mainUid": "11cf-70"
"mainUid": "fabd-70"
},
"11cf-73": {
"fabd-73": {
"renderedLength": 33528,
"gzipLength": 7647,
"brotliLength": 0,
"mainUid": "11cf-72"
"mainUid": "fabd-72"
},
"11cf-75": {
"fabd-75": {
"renderedLength": 0,
"gzipLength": 0,
"brotliLength": 0,
"mainUid": "11cf-74"
"mainUid": "fabd-74"
}
},
"nodeMetas": {
"11cf-48": {
"fabd-48": {
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"moduleParts": {
"index.production.js": "11cf-49"
"index.production.js": "fabd-49"
},

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

{
"uid": "11cf-74"
"uid": "fabd-74"
},
{
"uid": "11cf-68"
"uid": "fabd-68"
},
{
"uid": "11cf-72"
"uid": "fabd-72"
},
{
"uid": "11cf-66"
"uid": "fabd-66"
}
]
},
"11cf-50": {
"fabd-50": {
"id": "/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"moduleParts": {
"index.production.js": "11cf-51"
"index.production.js": "fabd-51"
},

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

{
"uid": "11cf-74"
"uid": "fabd-74"
},
{
"uid": "11cf-66"
"uid": "fabd-66"
}
]
},
"11cf-52": {
"fabd-52": {
"id": "/packages/router/src/history.ts",
"moduleParts": {
"index.production.js": "11cf-53"
"index.production.js": "fabd-53"
},

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

{
"uid": "11cf-74"
"uid": "fabd-74"
},
{
"uid": "11cf-72"
"uid": "fabd-72"
}
]
},
"11cf-54": {
"fabd-54": {
"id": "/packages/router/src/utils.ts",
"moduleParts": {
"index.production.js": "11cf-55"
"index.production.js": "fabd-55"
},

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

{
"uid": "11cf-74"
"uid": "fabd-74"
},
{
"uid": "11cf-56"
"uid": "fabd-56"
},
{
"uid": "11cf-72"
"uid": "fabd-72"
},
{
"uid": "11cf-66"
"uid": "fabd-66"
}
]
},
"11cf-56": {
"fabd-56": {
"id": "/packages/router/src/path.ts",
"moduleParts": {
"index.production.js": "11cf-57"
"index.production.js": "fabd-57"
},
"imported": [
{
"uid": "11cf-54"
"uid": "fabd-54"
}

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

{
"uid": "11cf-74"
"uid": "fabd-74"
},
{
"uid": "11cf-68"
"uid": "fabd-68"
},
{
"uid": "11cf-72"
"uid": "fabd-72"
}
]
},
"11cf-58": {
"fabd-58": {
"id": "/packages/router/src/qss.ts",
"moduleParts": {
"index.production.js": "11cf-59"
"index.production.js": "fabd-59"
},

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

{
"uid": "11cf-74"
"uid": "fabd-74"
},
{
"uid": "11cf-70"
"uid": "fabd-70"
}
]
},
"11cf-60": {
"fabd-60": {
"id": "\u0000rollupPluginBabelHelpers.js",
"moduleParts": {
"index.production.js": "11cf-61"
"index.production.js": "fabd-61"
},

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

{
"uid": "11cf-66"
"uid": "fabd-66"
}
]
},
"11cf-62": {
"fabd-62": {
"id": "/packages/store/build/esm/index.js",
"moduleParts": {
"index.production.js": "11cf-63"
"index.production.js": "fabd-63"
},

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

{
"uid": "11cf-64"
"uid": "fabd-64"
}
]
},
"11cf-64": {
"fabd-64": {
"id": "/packages/react-store/build/esm/index.js",
"moduleParts": {
"index.production.js": "11cf-65"
"index.production.js": "fabd-65"
},
"imported": [
{
"uid": "11cf-78"
"uid": "fabd-78"
},
{
"uid": "11cf-79"
"uid": "fabd-79"
},
{
"uid": "11cf-62"
"uid": "fabd-62"
}

@@ -336,32 +336,32 @@ ],

{
"uid": "11cf-72"
"uid": "fabd-72"
},
{
"uid": "11cf-66"
"uid": "fabd-66"
}
]
},
"11cf-66": {
"fabd-66": {
"id": "/packages/router/src/react.tsx",
"moduleParts": {
"index.production.js": "11cf-67"
"index.production.js": "fabd-67"
},
"imported": [
{
"uid": "11cf-60"
"uid": "fabd-60"
},
{
"uid": "11cf-78"
"uid": "fabd-78"
},
{
"uid": "11cf-64"
"uid": "fabd-64"
},
{
"uid": "11cf-48"
"uid": "fabd-48"
},
{
"uid": "11cf-50"
"uid": "fabd-50"
},
{
"uid": "11cf-54"
"uid": "fabd-54"
}

@@ -371,23 +371,23 @@ ],

{
"uid": "11cf-74"
"uid": "fabd-74"
},
{
"uid": "11cf-68"
"uid": "fabd-68"
}
]
},
"11cf-68": {
"fabd-68": {
"id": "/packages/router/src/route.ts",
"moduleParts": {
"index.production.js": "11cf-69"
"index.production.js": "fabd-69"
},
"imported": [
{
"uid": "11cf-48"
"uid": "fabd-48"
},
{
"uid": "11cf-56"
"uid": "fabd-56"
},
{
"uid": "11cf-66"
"uid": "fabd-66"
}

@@ -397,14 +397,14 @@ ],

{
"uid": "11cf-74"
"uid": "fabd-74"
}
]
},
"11cf-70": {
"fabd-70": {
"id": "/packages/router/src/searchParams.ts",
"moduleParts": {
"index.production.js": "11cf-71"
"index.production.js": "fabd-71"
},
"imported": [
{
"uid": "11cf-58"
"uid": "fabd-58"
}

@@ -414,32 +414,32 @@ ],

{
"uid": "11cf-74"
"uid": "fabd-74"
},
{
"uid": "11cf-72"
"uid": "fabd-72"
}
]
},
"11cf-72": {
"fabd-72": {
"id": "/packages/router/src/router.ts",
"moduleParts": {
"index.production.js": "11cf-73"
"index.production.js": "fabd-73"
},
"imported": [
{
"uid": "11cf-64"
"uid": "fabd-64"
},
{
"uid": "11cf-48"
"uid": "fabd-48"
},
{
"uid": "11cf-56"
"uid": "fabd-56"
},
{
"uid": "11cf-70"
"uid": "fabd-70"
},
{
"uid": "11cf-54"
"uid": "fabd-54"
},
{
"uid": "11cf-52"
"uid": "fabd-52"
}

@@ -449,47 +449,47 @@ ],

{
"uid": "11cf-74"
"uid": "fabd-74"
}
]
},
"11cf-74": {
"fabd-74": {
"id": "/packages/router/src/index.ts",
"moduleParts": {
"index.production.js": "11cf-75"
"index.production.js": "fabd-75"
},
"imported": [
{
"uid": "11cf-48"
"uid": "fabd-48"
},
{
"uid": "11cf-50"
"uid": "fabd-50"
},
{
"uid": "11cf-52"
"uid": "fabd-52"
},
{
"uid": "11cf-76"
"uid": "fabd-76"
},
{
"uid": "11cf-56"
"uid": "fabd-56"
},
{
"uid": "11cf-58"
"uid": "fabd-58"
},
{
"uid": "11cf-68"
"uid": "fabd-68"
},
{
"uid": "11cf-77"
"uid": "fabd-77"
},
{
"uid": "11cf-72"
"uid": "fabd-72"
},
{
"uid": "11cf-70"
"uid": "fabd-70"
},
{
"uid": "11cf-54"
"uid": "fabd-54"
},
{
"uid": "11cf-66"
"uid": "fabd-66"
}

@@ -500,3 +500,3 @@ ],

},
"11cf-76": {
"fabd-76": {
"id": "/packages/router/src/link.ts",

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

{
"uid": "11cf-74"
"uid": "fabd-74"
}
]
},
"11cf-77": {
"fabd-77": {
"id": "/packages/router/src/routeInfo.ts",

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

{
"uid": "11cf-74"
"uid": "fabd-74"
}
]
},
"11cf-78": {
"fabd-78": {
"id": "react",

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

{
"uid": "11cf-66"
"uid": "fabd-66"
},
{
"uid": "11cf-64"
"uid": "fabd-64"
}

@@ -538,3 +538,3 @@ ],

},
"11cf-79": {
"fabd-79": {
"id": "use-sync-external-store/shim/with-selector",

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

{
"uid": "11cf-64"
"uid": "fabd-64"
}

@@ -548,0 +548,0 @@ ],

@@ -6,3 +6,3 @@ import * as React from 'react';

import { RouteByPath, AnyRoutesInfo, DefaultRoutesInfo } from './routeInfo';
import { RegisteredRoutesInfo, MatchRouteOptions, RegisteredRouter, RouterOptions, Router, RouteMatch, RouterState } from './router';
import { RegisteredRoutesInfo, MatchRouteOptions, RegisteredRouter, RouterOptions, Router, RouteMatch } from './router';
export { useStore };

@@ -42,3 +42,3 @@ type ReactNode = any;

export declare const matchesContext: React.Context<MatchesContextValue>;
export declare const routerStateContext: React.Context<RouterState<import("./routeInfo").RoutesInfo<AnyRoute>, import("./router").LocationState>>;
export declare const routerStateContext: React.Context<import("./router").RouterState<import("./routeInfo").RoutesInfo<AnyRoute>, import("./router").LocationState>>;
export declare const routerContext: React.Context<Router<AnyRoute, import("./routeInfo").RoutesInfo<AnyRoute>, Record<string, any>>>;

@@ -45,0 +45,0 @@ export type MatchesProviderProps = {

@@ -31,3 +31,3 @@ /**

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

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

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc