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

@tanstack/router - npm Package Compare versions

Comparing version 0.0.1-beta.95 to 0.0.1-beta.97

2

build/cjs/react.js

@@ -453,4 +453,2 @@ /**

retry();
} else {
cancel();
}

@@ -457,0 +455,0 @@ });

306

build/stats-react.json

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

"name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"uid": "000d-49"
"uid": "7f57-49"
},
{
"name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"uid": "000d-51"
"uid": "7f57-51"
}

@@ -30,39 +30,39 @@ ]

{
"uid": "000d-53",
"uid": "7f57-53",
"name": "history.ts"
},
{
"uid": "000d-55",
"uid": "7f57-55",
"name": "utils.ts"
},
{
"uid": "000d-57",
"uid": "7f57-57",
"name": "path.ts"
},
{
"uid": "000d-59",
"uid": "7f57-59",
"name": "qss.ts"
},
{
"uid": "000d-67",
"uid": "7f57-67",
"name": "react.tsx"
},
{
"uid": "000d-69",
"uid": "7f57-69",
"name": "route.ts"
},
{
"uid": "000d-71",
"uid": "7f57-71",
"name": "searchParams.ts"
},
{
"uid": "000d-73",
"uid": "7f57-73",
"name": "router.ts"
},
{
"uid": "000d-75",
"uid": "7f57-75",
"name": "routeMatch.ts"
},
{
"uid": "000d-77",
"uid": "7f57-77",
"name": "index.ts"

@@ -74,7 +74,7 @@ }

"name": "store/build/esm/index.js",
"uid": "000d-63"
"uid": "7f57-63"
},
{
"name": "react-store/build/esm/index.js",
"uid": "000d-65"
"uid": "7f57-65"
}

@@ -84,3 +84,3 @@ ]

{
"uid": "000d-61",
"uid": "7f57-61",
"name": "\u0000rollupPluginBabelHelpers.js"

@@ -94,98 +94,98 @@ }

"nodeParts": {
"000d-49": {
"7f57-49": {
"renderedLength": 199,
"gzipLength": 134,
"brotliLength": 0,
"mainUid": "000d-48"
"mainUid": "7f57-48"
},
"000d-51": {
"7f57-51": {
"renderedLength": 48,
"gzipLength": 65,
"brotliLength": 0,
"mainUid": "000d-50"
"mainUid": "7f57-50"
},
"000d-53": {
"7f57-53": {
"renderedLength": 5664,
"gzipLength": 1407,
"brotliLength": 0,
"mainUid": "000d-52"
"mainUid": "7f57-52"
},
"000d-55": {
"7f57-55": {
"renderedLength": 2821,
"gzipLength": 990,
"brotliLength": 0,
"mainUid": "000d-54"
"mainUid": "7f57-54"
},
"000d-57": {
"7f57-57": {
"renderedLength": 5909,
"gzipLength": 1382,
"brotliLength": 0,
"mainUid": "000d-56"
"mainUid": "7f57-56"
},
"000d-59": {
"7f57-59": {
"renderedLength": 1395,
"gzipLength": 558,
"brotliLength": 0,
"mainUid": "000d-58"
"mainUid": "7f57-58"
},
"000d-61": {
"7f57-61": {
"renderedLength": 457,
"gzipLength": 241,
"brotliLength": 0,
"mainUid": "000d-60"
"mainUid": "7f57-60"
},
"000d-63": {
"7f57-63": {
"renderedLength": 1436,
"gzipLength": 529,
"brotliLength": 0,
"mainUid": "000d-62"
"mainUid": "7f57-62"
},
"000d-65": {
"7f57-65": {
"renderedLength": 1042,
"gzipLength": 465,
"brotliLength": 0,
"mainUid": "000d-64"
"mainUid": "7f57-64"
},
"000d-67": {
"renderedLength": 13999,
"gzipLength": 3361,
"7f57-67": {
"renderedLength": 13958,
"gzipLength": 3353,
"brotliLength": 0,
"mainUid": "000d-66"
"mainUid": "7f57-66"
},
"000d-69": {
"7f57-69": {
"renderedLength": 3528,
"gzipLength": 899,
"brotliLength": 0,
"mainUid": "000d-68"
"mainUid": "7f57-68"
},
"000d-71": {
"7f57-71": {
"renderedLength": 1387,
"gzipLength": 483,
"brotliLength": 0,
"mainUid": "000d-70"
"mainUid": "7f57-70"
},
"000d-73": {
"7f57-73": {
"renderedLength": 30643,
"gzipLength": 7394,
"brotliLength": 0,
"mainUid": "000d-72"
"mainUid": "7f57-72"
},
"000d-75": {
"7f57-75": {
"renderedLength": 7564,
"gzipLength": 1752,
"brotliLength": 0,
"mainUid": "000d-74"
"mainUid": "7f57-74"
},
"000d-77": {
"7f57-77": {
"renderedLength": 0,
"gzipLength": 0,
"brotliLength": 0,
"mainUid": "000d-76"
"mainUid": "7f57-76"
}
},
"nodeMetas": {
"000d-48": {
"7f57-48": {
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"moduleParts": {
"index.production.js": "000d-49"
"index.production.js": "7f57-49"
},

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

{
"uid": "000d-76"
"uid": "7f57-76"
},
{
"uid": "000d-68"
"uid": "7f57-68"
},
{
"uid": "000d-72"
"uid": "7f57-72"
},
{
"uid": "000d-66"
"uid": "7f57-66"
}
]
},
"000d-50": {
"7f57-50": {
"id": "/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"moduleParts": {
"index.production.js": "000d-51"
"index.production.js": "7f57-51"
},

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

{
"uid": "000d-76"
"uid": "7f57-76"
},
{
"uid": "000d-66"
"uid": "7f57-66"
}
]
},
"000d-52": {
"7f57-52": {
"id": "/packages/router/src/history.ts",
"moduleParts": {
"index.production.js": "000d-53"
"index.production.js": "7f57-53"
},

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

{
"uid": "000d-76"
"uid": "7f57-76"
},
{
"uid": "000d-72"
"uid": "7f57-72"
}
]
},
"000d-54": {
"7f57-54": {
"id": "/packages/router/src/utils.ts",
"moduleParts": {
"index.production.js": "000d-55"
"index.production.js": "7f57-55"
},

@@ -249,26 +249,26 @@ "imported": [],

{
"uid": "000d-76"
"uid": "7f57-76"
},
{
"uid": "000d-56"
"uid": "7f57-56"
},
{
"uid": "000d-74"
"uid": "7f57-74"
},
{
"uid": "000d-72"
"uid": "7f57-72"
},
{
"uid": "000d-66"
"uid": "7f57-66"
}
]
},
"000d-56": {
"7f57-56": {
"id": "/packages/router/src/path.ts",
"moduleParts": {
"index.production.js": "000d-57"
"index.production.js": "7f57-57"
},
"imported": [
{
"uid": "000d-54"
"uid": "7f57-54"
}

@@ -278,16 +278,16 @@ ],

{
"uid": "000d-76"
"uid": "7f57-76"
},
{
"uid": "000d-68"
"uid": "7f57-68"
},
{
"uid": "000d-72"
"uid": "7f57-72"
}
]
},
"000d-58": {
"7f57-58": {
"id": "/packages/router/src/qss.ts",
"moduleParts": {
"index.production.js": "000d-59"
"index.production.js": "7f57-59"
},

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

{
"uid": "000d-76"
"uid": "7f57-76"
},
{
"uid": "000d-70"
"uid": "7f57-70"
}
]
},
"000d-60": {
"7f57-60": {
"id": "\u0000rollupPluginBabelHelpers.js",
"moduleParts": {
"index.production.js": "000d-61"
"index.production.js": "7f57-61"
},

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

{
"uid": "000d-66"
"uid": "7f57-66"
}
]
},
"000d-62": {
"7f57-62": {
"id": "/packages/store/build/esm/index.js",
"moduleParts": {
"index.production.js": "000d-63"
"index.production.js": "7f57-63"
},

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

{
"uid": "000d-64"
"uid": "7f57-64"
}
]
},
"000d-64": {
"7f57-64": {
"id": "/packages/react-store/build/esm/index.js",
"moduleParts": {
"index.production.js": "000d-65"
"index.production.js": "7f57-65"
},
"imported": [
{
"uid": "000d-81"
"uid": "7f57-81"
},
{
"uid": "000d-62"
"uid": "7f57-62"
}

@@ -346,35 +346,35 @@ ],

{
"uid": "000d-74"
"uid": "7f57-74"
},
{
"uid": "000d-72"
"uid": "7f57-72"
},
{
"uid": "000d-66"
"uid": "7f57-66"
}
]
},
"000d-66": {
"7f57-66": {
"id": "/packages/router/src/react.tsx",
"moduleParts": {
"index.production.js": "000d-67"
"index.production.js": "7f57-67"
},
"imported": [
{
"uid": "000d-60"
"uid": "7f57-60"
},
{
"uid": "000d-80"
"uid": "7f57-80"
},
{
"uid": "000d-64"
"uid": "7f57-64"
},
{
"uid": "000d-48"
"uid": "7f57-48"
},
{
"uid": "000d-50"
"uid": "7f57-50"
},
{
"uid": "000d-54"
"uid": "7f57-54"
}

@@ -384,23 +384,23 @@ ],

{
"uid": "000d-76"
"uid": "7f57-76"
},
{
"uid": "000d-68"
"uid": "7f57-68"
}
]
},
"000d-68": {
"7f57-68": {
"id": "/packages/router/src/route.ts",
"moduleParts": {
"index.production.js": "000d-69"
"index.production.js": "7f57-69"
},
"imported": [
{
"uid": "000d-48"
"uid": "7f57-48"
},
{
"uid": "000d-56"
"uid": "7f57-56"
},
{
"uid": "000d-66"
"uid": "7f57-66"
}

@@ -410,14 +410,14 @@ ],

{
"uid": "000d-76"
"uid": "7f57-76"
}
]
},
"000d-70": {
"7f57-70": {
"id": "/packages/router/src/searchParams.ts",
"moduleParts": {
"index.production.js": "000d-71"
"index.production.js": "7f57-71"
},
"imported": [
{
"uid": "000d-58"
"uid": "7f57-58"
}

@@ -427,35 +427,35 @@ ],

{
"uid": "000d-76"
"uid": "7f57-76"
},
{
"uid": "000d-72"
"uid": "7f57-72"
}
]
},
"000d-72": {
"7f57-72": {
"id": "/packages/router/src/router.ts",
"moduleParts": {
"index.production.js": "000d-73"
"index.production.js": "7f57-73"
},
"imported": [
{
"uid": "000d-64"
"uid": "7f57-64"
},
{
"uid": "000d-48"
"uid": "7f57-48"
},
{
"uid": "000d-56"
"uid": "7f57-56"
},
{
"uid": "000d-74"
"uid": "7f57-74"
},
{
"uid": "000d-70"
"uid": "7f57-70"
},
{
"uid": "000d-54"
"uid": "7f57-54"
},
{
"uid": "000d-52"
"uid": "7f57-52"
}

@@ -465,23 +465,23 @@ ],

{
"uid": "000d-76"
"uid": "7f57-76"
},
{
"uid": "000d-74"
"uid": "7f57-74"
}
]
},
"000d-74": {
"7f57-74": {
"id": "/packages/router/src/routeMatch.ts",
"moduleParts": {
"index.production.js": "000d-75"
"index.production.js": "7f57-75"
},
"imported": [
{
"uid": "000d-64"
"uid": "7f57-64"
},
{
"uid": "000d-72"
"uid": "7f57-72"
},
{
"uid": "000d-54"
"uid": "7f57-54"
}

@@ -491,53 +491,53 @@ ],

{
"uid": "000d-76"
"uid": "7f57-76"
},
{
"uid": "000d-72"
"uid": "7f57-72"
}
]
},
"000d-76": {
"7f57-76": {
"id": "/packages/router/src/index.ts",
"moduleParts": {
"index.production.js": "000d-77"
"index.production.js": "7f57-77"
},
"imported": [
{
"uid": "000d-48"
"uid": "7f57-48"
},
{
"uid": "000d-50"
"uid": "7f57-50"
},
{
"uid": "000d-52"
"uid": "7f57-52"
},
{
"uid": "000d-78"
"uid": "7f57-78"
},
{
"uid": "000d-56"
"uid": "7f57-56"
},
{
"uid": "000d-58"
"uid": "7f57-58"
},
{
"uid": "000d-68"
"uid": "7f57-68"
},
{
"uid": "000d-79"
"uid": "7f57-79"
},
{
"uid": "000d-74"
"uid": "7f57-74"
},
{
"uid": "000d-72"
"uid": "7f57-72"
},
{
"uid": "000d-70"
"uid": "7f57-70"
},
{
"uid": "000d-54"
"uid": "7f57-54"
},
{
"uid": "000d-66"
"uid": "7f57-66"
}

@@ -548,3 +548,3 @@ ],

},
"000d-78": {
"7f57-78": {
"id": "/packages/router/src/link.ts",

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

{
"uid": "000d-76"
"uid": "7f57-76"
}
]
},
"000d-79": {
"7f57-79": {
"id": "/packages/router/src/routeInfo.ts",

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

{
"uid": "000d-76"
"uid": "7f57-76"
}
]
},
"000d-80": {
"7f57-80": {
"id": "react",

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

{
"uid": "000d-66"
"uid": "7f57-66"
}

@@ -583,3 +583,3 @@ ],

},
"000d-81": {
"7f57-81": {
"id": "use-sync-external-store/shim/with-selector",

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

{
"uid": "000d-64"
"uid": "7f57-64"
}

@@ -593,0 +593,0 @@ ],

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

* @license MIT
*/function $(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 H(t){const e=z(),{type:r,children:o,target:s,activeProps:n=(()=>({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:_,onClick:w,onFocus:b,onMouseEnter:S,onMouseLeave:L,onTouchStart:E,...x}=t,P=e.buildLink(t);if("external"===P.type){const{href:t}=P;return{href:t}}const{handleClick:C,handleFocus:R,handleEnter:M,handleLeave:k,handleTouchStart:O,isActive:j,next:A}=P,I=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},D=j?g(n,{})??{}:{},T=j?{}:g(i,{})??{};return{...D,...T,...x,href:h?void 0:A.href,onClick:I([w,t=>{a.startTransition?a.startTransition((()=>{C(t)})):C(t)}]),onFocus:I([b,R]),onMouseEnter:I([S,M]),onMouseLeave:I([L,k]),onTouchStart:I([E,O]),target:s,style:{...v,...D.style,...T.style},className:[_,D.className,T.className].filter(Boolean).join(" ")||void 0,...h?{role:"link","aria-disabled":!0}:void 0,"data-status":j?"active":void 0}}const B=a.forwardRef(((t,e)=>{const r=H(t);return a.createElement("a",D({ref:e},r,{children:"function"==typeof t.children?t.children({isActive:"active"===r["data-status"]}):t.children}))}));const F=a.createContext(null),U=a.createContext(null);function z(){const t=a.useContext(U);return $(t.router.__store),t.router}function W(t){const e=z();return $(e.__store,t),e}function q(){return a.useContext(F)}function K(t){const e=z(),r=q()[0],o=t?.from?e.state.currentMatches.find((e=>e.route.id===t?.from)):r;return s(o,t?.from&&t.from),(t?.strict??1)&&s(r.route.id==o?.route.id,(o?.route.id,r.route.id,o?.route.id,o?.route.id)),$(o.__store,(e=>t?.track?.(o)??o)),o}function V(t){const{track:e,...r}=t,o=K(r);return $(o.__store,(e=>t?.track?.(e.loader)??e.loader)),o.state.loader}function J(t){const{track:e,...r}=t??{},o=K(r);return $(o.__store,(e=>t?.track?.(e.search)??e.search)),o.state.search}function G(t){const e=z();return $(e.__store,(e=>{const r=y(e.currentMatches)?.params;return t?.track?.(r)??r})),y(e.state.currentMatches)?.params}function Y(){const t=z();return a.useCallback((e=>{const{pending:r,caseSensitive:o,...a}=e;return t.matchRoute(a,{pending:r,caseSensitive:o})}),[])}function Q(){const t=q().slice(1),e=t[0];return e?a.createElement(X,{matches:t,match:e}):null}function X({matches:t,match:e}){const r=z();$(e.__store,(t=>[t.status,t.error]));const o=a.useCallback((()=>null),[]),s=e.pendingComponent??r.options.defaultPendingComponent??o,n=e.errorComponent??r.options.defaultErrorComponent,i=e.route.options.wrapInSuspense??1?a.Suspense:tt,c=n?et:tt;return a.createElement(F.Provider,{value:t},a.createElement(i,{fallback:a.createElement(s,null)},a.createElement(c,{key:e.route.id,errorComponent:n,onCatch:()=>{e.id}},a.createElement(Z,{match:e}))))}function Z(t){const e=z();if("error"===t.match.state.status)throw t.match.state.error;if("pending"===t.match.state.status)throw t.match.__loadPromise;if("success"===t.match.state.status)return a.createElement(t.match.component??e.options.defaultComponent??Q,{useLoader:t.match.route.useLoader,useMatch:t.match.route.useMatch,useContext:t.match.route.useContext,useSearch:t.match.route.useSearch,useParams:t.match.route.useParams});s(!1)}function tt(t){return a.createElement(a.Fragment,null,t.children)}class et 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(rt,D({},this.props,{errorState:this.state,reset:()=>this.setState({})}))}}function rt(t){const[e,r]=a.useState(t.errorState),o=z(),s=t.errorComponent??ot,n=a.useRef("");return a.useEffect((()=>{e&&o.state.currentLocation.key!==n.current&&r({}),n.current=o.state.currentLocation.key}),[e,o.state.currentLocation.key]),a.useEffect((()=>{t.errorState.error&&r(t.errorState)}),[t.errorState.error]),t.errorState.error&&e.error?a.createElement(s,e):t.children}function ot({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 at(t,e=!0){const r=W();a.useEffect((()=>{if(!e)return;let o=r.history.block(((e,r)=>{window.confirm(t)?(o(),e()):r()}));return o}))}const st="__root__";class nt{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=st:s(this.parentRoute);let o=r?st:e.path;o&&"/"!==o&&(o=P(o));const a=e?.id||o;let n=r?st:S([this.parentRoute.id===st?"":this.parentRoute.id,a]);o===st&&(o="/"),n!==st&&(n=S(["/",n]));const i=n===st?"/":S([this.parentRoute.fullPath,o]);this.path=o,this.id=n,this.fullPath=i};addChildren=t=>(this.children=t,this);useMatch=t=>K({...t,from:this.id});useLoader=t=>V({...t,from:this.id});useContext=t=>K({...t,from:this.id}).context;useSearch=t=>J({...t,from:this.id});useParams=t=>G({...t,from:this.id})}class it extends nt{constructor(t){super(t)}static withRouterContext=()=>t=>new it(t)}const ct=ut(JSON.parse),ht=lt(JSON.stringify);function ut(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let r=I(e);for(let e in r){const o=r[e];if("string"==typeof o)try{r[e]=t(o)}catch(t){}}return r}}function lt(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=j(e).toString();return r?`?${r}`:""}}const dt=async({router:t,routeMatch:e})=>{const r=t.buildNext({to:".",search:t=>({...t??{},__data:{matchId:e.id}})}),o=await fetch(r.href,{method:"GET",signal:e.abortController.signal});if(o.ok)return o.json();throw new Error("Failed to fetch match data")};const pt="undefined"==typeof window||!window.document.createElement;function ft(){return{status:"idle",latestLocation:null,currentLocation:null,currentMatches:[],lastUpdated:Date.now()}}function mt(t){return!!t?.isRedirect}const yt=["component","errorComponent","pendingComponent"];class gt{abortController=new AbortController;constructor(t,e,r){Object.assign(this,{route:e,router:t,id:r.id,pathname:r.pathname,params:r.params,__store:new T({updatedAt:0,routeSearch:{},search:{},status:"idle",loader:void 0},{onUpdate:()=>{this.state=this.__store.state}})}),this.state=this.__store.state,yt.map((async t=>{const e=this.route.options[t];this[t]=e})),"idle"!==this.state.status||this.#t()||this.__store.setState((t=>({...t,status:"success"})))}#t=()=>!(!this.route.options.loader&&!yt.some((t=>this.route.options[t]?.preload)));__commit=()=>{const{routeSearch:t,search:e,context:r,routeContext:o}=this.#e({location:this.router.state.currentLocation});this.context=r,this.routeContext=o,this.__store.setState((r=>({...r,routeSearch:v(r.routeSearch,t),search:v(r.search,e)})))};cancel=()=>{this.abortController?.abort()};#r=t=>{const e=this.parentMatch?this.parentMatch.#r(t):{search:t.location.search,routeSearch:t.location.search};try{const t=("object"==typeof this.route.options.validateSearch?this.route.options.validateSearch.parse:this.route.options.validateSearch)?.(e.search)??{};return{routeSearch:t,search:{...e.search,...t}}}catch(t){if(mt(t))throw t;(this.route.options.onValidateSearchError??this.route.options.onError)?.(t);const e=new Error("Invalid search params found",{cause:t});throw e.code="INVALID_SEARCH_PARAMS",e}};#e=t=>{const{search:e,routeSearch:r}=this.#r(t);try{const t=this.route.options.getContext?.({parentContext:this.parentMatch?.routeContext??{},context:this.parentMatch?.context??this.router?.options.context??{},params:this.params,search:e})||{};return{routeSearch:r,search:e,context:{...this.parentMatch?.context??this.router?.options.context,...t},routeContext:t}}catch(t){throw this.route.options.onError?.(t),t}};__load=async t=>{let e;this.parentMatch=t.parentMatch;try{e=this.#e(t)}catch(e){return mt(e)?void(t?.preload||this.router.navigate(e)):void this.__store.setState((t=>({...t,status:"error",error:e})))}const{routeSearch:r,search:o,context:a,routeContext:s}=e;if("pending"!==this.state.status)return this.__loadPromise=Promise.resolve().then((async()=>{const e=""+Date.now()+Math.random();this.#o=e;const n=()=>e!==this.#o?this.__loadPromise:void 0;let i;"idle"===this.state.status&&this.__store.setState((t=>({...t,status:"pending"})));const c=(async()=>{await Promise.all(yt.map((async t=>{const e=this.route.options[t];e?.preload&&await e.preload()})))})(),h=Promise.resolve().then((()=>{if(this.route.options.loader)return this.route.options.loader({params:this.params,routeSearch:r,search:o,signal:this.abortController.signal,preload:!!t?.preload,routeContext:s,context:a})}));try{const[t,e]=await Promise.all([c,h]);if(i=n())return await i;this.__store.setState((t=>({...t,error:void 0,status:"success",updatedAt:Date.now(),loader:e})))}catch(e){if(mt(e))return void(t?.preload||this.router.navigate(e));const r=this.route.options.onLoadError??this.route.options.onError;try{r?.(e)}catch(e){return mt(e)?void(t?.preload||this.router.navigate(e)):void this.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}this.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}finally{delete this.__loadPromise}})),this.__loadPromise};#o=""}t.Block=function({message:t,condition:e,children:r}){return at(t,e),r??null},t.ErrorComponent=ot,t.Link=B,t.MatchRoute=function(t){const e=Y()(t);return e?"function"==typeof t.children?t.children(e):e?t.children:null:null},t.Navigate=function(t){const e=z();return a.useLayoutEffect((()=>{e.navigate(t)}),[]),null},t.Outlet=Q,t.RootRoute=it,t.Route=nt,t.RouteMatch=gt,t.Router=class{#a;startedLoadingAt=Date.now();resolveNavigation=()=>{};constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??ht,parseSearch:t?.parseSearch??ct,fetchServerDataFn:t?.fetchServerDataFn??dt},this.__store=new T(ft(),{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.latestLocation.href!==e.href&&this.#s({...e,replace:!0})}reset=()=>{this.__store.setState((t=>Object.assign(t,ft())))};mount=()=>(pt||this.state.currentMatches.length||this.safeLoad(),()=>{});hydrate=async t=>{let e=t;return"undefined"!=typeof document&&(e=window.__DEHYDRATED__,s(e)),this.options.hydrate?.(e),await this.load()};update=t=>{if(Object.assign(this.options,t),this.context=this.options.context,!this.history||this.options.history&&this.options.history!==this.history){this.#a&&this.#a(),this.history=this.options.history??(pt?p():d());const t=this.#n();this.__store.setState((e=>({...e,latestLocation:t,currentLocation:t}))),this.#a=this.history.listen((()=>{this.safeLoad({next:this.#n(this.state.latestLocation)})}))}const{basepath:e,routeTree:r}=this.options;return this.basepath=`/${P(e??"")??""}`,r&&(this.routesById={},this.routeTree=this.#i(r)),this};buildNext=t=>{const e=this.#c(t),r=this.matchRoutes(e.pathname);return this.#c({...t,__matches:r})};cancelMatches=()=>{[...this.state.currentMatches,...this.state.pendingMatches||[]].forEach((t=>{t.cancel()}))};safeLoad=t=>{this.load(t).catch((t=>{console.warn(t),s(!1)}))};load=async t=>{let e=Date.now();const r=e;let o;if(this.startedLoadingAt=r,this.cancelMatches(),this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,latestLocation:t.next}))),o=this.matchRoutes(this.state.latestLocation.pathname,{strictParseParams:!0}),this.__store.setState((t=>({...t,status:"pending",pendingMatches:o,pendingLocation:this.state.latestLocation})))})),await this.loadMatches(o,this.state.pendingLocation),this.startedLoadingAt!==r)return this.navigationPromise;const a=this.state.currentMatches,s=[],n=[];a.forEach((t=>{o.find((e=>e.id===t.id))?n.push(t):s.push(t)}));const i=o.filter((t=>!a.find((e=>e.id===t.id))));e=Date.now(),s.forEach((t=>{t.__onExit?.({params:t.params,search:t.state.routeSearch}),"error"===t.state.status&&this.__store.setState((t=>({...t,status:"idle",error:void 0})))})),n.forEach((t=>{t.route.options.onTransition?.({params:t.params,search:t.state.routeSearch})})),i.forEach((t=>{t.__onExit=t.route.options.onLoaded?.({params:t.params,search:t.state.search})}));const c=this.state.currentLocation;this.__store.setState((t=>({...t,status:"idle",currentLocation:this.state.latestLocation,currentMatches:o,pendingLocation:void 0,pendingMatches:void 0}))),o.forEach((t=>{t.__commit()})),c.href!==this.state.currentLocation.href&&this.options.onRouteChange?.(),this.resolveNavigation()};getRoute=t=>{const e=this.routesById[t];return s(e),e};loadRoute=async(t=this.state.latestLocation)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,{strictParseParams:!0});return await this.loadMatches(r,e),r};preloadRoute=async(t=this.state.latestLocation)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,{strictParseParams:!0});return await this.loadMatches(r,e,{preload:!0}),r};matchRoutes=(t,e)=>{if(!this.routeTree)return[];const r=[...this.state.currentMatches,...this.state.pendingMatches??[]];let o=[];const a=r=>{let s;if(r.some((r=>{const n=r.children;if(!r.path){if(n?.length){o.push({route:r});const t=a(n);return t?(s=t,!0):(o.pop(),!1)}return!1}const i="/"!==r.path||!!n?.length,c=k(this.basepath,t,{to:r.fullPath,fuzzy:i,caseSensitive:r.options.caseSensitive??this.options.caseSensitive});if(c){let t;try{t=r.options.parseParams?.(c)??c}catch(t){if(e?.strictParseParams)throw t}return o.push({route:r,params:t}),s=r,!0}return!1})),!s)return;const n=s.children;return n?.length?a(n):s};a([this.routeTree]);let s={};return o.map((({route:t,params:e})=>{Object.assign(s,e);const o=M(t.path,e),a=M(t.id,e);return r.find((t=>t.id===a))||new gt(this,t,{id:a,params:s,pathname:S([this.basepath,o])})}))};loadMatches=async(t,e,r)=>{let o;try{await Promise.all(t.map((async(t,e)=>{try{await(t.route.options.beforeLoad?.({router:this,match:t}))}catch(r){if(mt(r))throw r;o=o??e;const a=t.route.options.onBeforeLoadError??t.route.options.onError;try{a?.(r)}catch(e){if(mt(e))throw e;return void t.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}t.__store.setState((t=>({...t,error:r,status:"error",updatedAt:Date.now()})))}})))}catch(t){if(mt(t))return void(r?.preload||this.navigate(t));throw t}const a=t.slice(0,o),s=a.map((async(t,o)=>{const s=a[o-1];t.__load({preload:r?.preload,location:e,parentMatch:s}),await t.__loadPromise,s&&await s.__loadPromise}));await Promise.all(s)};reload=()=>{this.navigate({fromCurrent:!0,replace:!0,search:!0})};resolvePath=(t,e)=>C(this.basepath,t,L(e));navigate=async({from:t,to:e="",search:r,hash:o,replace:a,params:n})=>{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.#s({from:c,to:i,search:r,hash:o,replace:a,params:n})};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePath(t.from??"",t.to):void 0};const r=this.buildNext(t),o=e?.pending?this.state.pendingLocation:this.state.currentLocation;if(!o)return!1;const a=k(this.basepath,o.pathname,{...e,to:r.pathname});return!!a&&(e?.includeSearch??1?!!b(o.search,r.search)&&a:a)};buildLink=({from:t,to:e=".",search:r,params:o,hash:a,target:s,replace:n,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:n},d=this.buildNext(l);c=c??this.options.defaultPreload;const p=h??this.options.defaultPreloadDelay??0,f=this.state.currentLocation.pathname.split("/"),m=d.pathname.split("/").every(((t,e)=>t===f[e])),y=i?.exact?this.state.currentLocation.pathname===d.pathname:m,g=!i?.includeHash||this.state.currentLocation.hash===d.hash,v=!(i?.includeSearch??1)||b(this.state.currentLocation.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||s&&"_self"!==s||0!==t.button||(t.preventDefault(),this.#s(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}};#i=t=>{const e=(t,r)=>{t.forEach(((t,r)=>{t.init({originalIndex:r,router:this});s(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t;const o=t.children;o?.length&&(e(o),o.length,t.children=o.map(((t,e)=>{const r=E(L(t.path??"/")),o=R(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,cleaned:r,parsed:o,index:e,score:a}})).sort(((t,e)=>{const r=Math.min(t.score.length,e.score.length);for(let o=0;o<r;o++)if(t.score[o]!==e.score[o])return e.score[o]-t.score[o];for(let o=0;o<r;o++)if(t.parsed[o].value!==e.parsed[o].value)return t.parsed[o].value>e.parsed[o].value?1:-1;return t.score.length!==e.score.length?e.score.length-t.score.length:t.cleaned!==e.cleaned?t.cleaned>e.cleaned?1:-1:t.index-e.index})).map((t=>t.child)))}))};e([t]);const r=(t,e)=>{t.forEach((t=>{t.isRoot?s(!e):s(!e||t.parentRoute===e,(t.path,t.parentRoute?.id,e?.id)),t.children&&r(t.children,t)}))};return r([t],void 0),t};#n=t=>{let{pathname:e,search:r,hash:o,state:a}=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:a,key:a?.key||"__init__"}};#c=(t={})=>{t.fromCurrent=t.fromCurrent??""===t.to;const e=t.fromCurrent?this.state.latestLocation.pathname:t.from??this.state.latestLocation.pathname;let r=C(this.basepath??"/",e,`${t.to??""}`);const o={...y(this.matchRoutes(this.state.latestLocation.pathname,{strictParseParams:!0}))?.params};let a=!0===(t.params??!0)?o:g(t.params,o);a&&t.__matches?.map((t=>t.route.options.stringifyParams)).filter(Boolean).forEach((t=>{a={...a,...t(a)}})),r=M(r,a??{});const s=t.__matches?.map((t=>t.route.options.preSearchFilters??[])).flat().filter(Boolean)??[],n=t.__matches?.map((t=>t.route.options.postSearchFilters??[])).flat().filter(Boolean)??[],i=s?.length?s?.reduce(((t,e)=>e(t)),this.state.latestLocation.search):this.state.latestLocation.search,c=!0===t.search?i:t.search?g(t.search,i)??{}:s?.length?i:{},h=n?.length?n.reduce(((t,e)=>e(t)),c):c,u=v(this.state.latestLocation.search,h),l=this.options.stringifySearch(u),d=!0===t.hash?this.state.latestLocation.hash:g(t.hash,this.state.latestLocation.hash),p=d?`#${d}`:"";return{pathname:r,search:u,searchStr:l,state:!0===t.state?this.state.latestLocation.state:g(t.state,this.state.latestLocation.state),hash:d,href:this.history.createHref(`${r}${l}${p}`),key:t.key}};#s=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.latestLocation.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.navigationPromise=new Promise((t=>{const e=this.resolveNavigation;this.resolveNavigation=()=>{e(),t()}}))}},t.RouterProvider=function({router:t,...e}){t.update(e);const r=$(t.__store,(t=>t.currentMatches));return a.useEffect(t.mount,[t]),a.createElement(U.Provider,{value:{router:t}},a.createElement(F.Provider,{value:[void 0,...r]},a.createElement(et,{errorComponent:ot,onCatch:()=>{}},a.createElement(Q,null))))},t.cleanPath=L,t.createBrowserHistory=d,t.createHashHistory=function(){return d({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=p,t.decode=I,t.defaultFetchServerDataFn=dt,t.defaultParseSearch=ct,t.defaultStringifySearch=ht,t.encode=j,t.functionalUpdate=g,t.interpolatePath=M,t.invariant=s,t.isPlainObject=_,t.isRedirect=mt,t.joinPaths=S,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=k,t.matchesContext=F,t.parsePathname=R,t.parseSearchWith=ut,t.partialDeepEqual=b,t.pick=function(t,e){return e.reduce(((e,r)=>(e[r]=t[r],e)),{})},t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=v,t.resolvePath=C,t.rootRouteId=st,t.routerContext=U,t.stringifySearchWith=lt,t.trimPath=P,t.trimPathLeft=E,t.trimPathRight=x,t.useBlocker=at,t.useLinkProps=H,t.useLoader=V,t.useMatch=K,t.useMatchRoute=Y,t.useMatches=q,t.useNavigate=function(t){const e=z();return a.useCallback((r=>e.navigate({...t,...r})),[])},t.useParams=G,t.useRouter=W,t.useRouterContext=z,t.useSearch=J,t.useStore=$,t.warning=n,Object.defineProperty(t,"__esModule",{value:!0})}));
*/function $(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 H(t){const e=z(),{type:r,children:o,target:s,activeProps:n=(()=>({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:_,onClick:w,onFocus:b,onMouseEnter:S,onMouseLeave:L,onTouchStart:E,...x}=t,P=e.buildLink(t);if("external"===P.type){const{href:t}=P;return{href:t}}const{handleClick:C,handleFocus:R,handleEnter:M,handleLeave:k,handleTouchStart:O,isActive:j,next:A}=P,I=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},D=j?g(n,{})??{}:{},T=j?{}:g(i,{})??{};return{...D,...T,...x,href:h?void 0:A.href,onClick:I([w,t=>{a.startTransition?a.startTransition((()=>{C(t)})):C(t)}]),onFocus:I([b,R]),onMouseEnter:I([S,M]),onMouseLeave:I([L,k]),onTouchStart:I([E,O]),target:s,style:{...v,...D.style,...T.style},className:[_,D.className,T.className].filter(Boolean).join(" ")||void 0,...h?{role:"link","aria-disabled":!0}:void 0,"data-status":j?"active":void 0}}const B=a.forwardRef(((t,e)=>{const r=H(t);return a.createElement("a",D({ref:e},r,{children:"function"==typeof t.children?t.children({isActive:"active"===r["data-status"]}):t.children}))}));const F=a.createContext(null),U=a.createContext(null);function z(){const t=a.useContext(U);return $(t.router.__store),t.router}function W(t){const e=z();return $(e.__store,t),e}function q(){return a.useContext(F)}function K(t){const e=z(),r=q()[0],o=t?.from?e.state.currentMatches.find((e=>e.route.id===t?.from)):r;return s(o,t?.from&&t.from),(t?.strict??1)&&s(r.route.id==o?.route.id,(o?.route.id,r.route.id,o?.route.id,o?.route.id)),$(o.__store,(e=>t?.track?.(o)??o)),o}function V(t){const{track:e,...r}=t,o=K(r);return $(o.__store,(e=>t?.track?.(e.loader)??e.loader)),o.state.loader}function J(t){const{track:e,...r}=t??{},o=K(r);return $(o.__store,(e=>t?.track?.(e.search)??e.search)),o.state.search}function G(t){const e=z();return $(e.__store,(e=>{const r=y(e.currentMatches)?.params;return t?.track?.(r)??r})),y(e.state.currentMatches)?.params}function Y(){const t=z();return a.useCallback((e=>{const{pending:r,caseSensitive:o,...a}=e;return t.matchRoute(a,{pending:r,caseSensitive:o})}),[])}function Q(){const t=q().slice(1),e=t[0];return e?a.createElement(X,{matches:t,match:e}):null}function X({matches:t,match:e}){const r=z();$(e.__store,(t=>[t.status,t.error]));const o=a.useCallback((()=>null),[]),s=e.pendingComponent??r.options.defaultPendingComponent??o,n=e.errorComponent??r.options.defaultErrorComponent,i=e.route.options.wrapInSuspense??1?a.Suspense:tt,c=n?et:tt;return a.createElement(F.Provider,{value:t},a.createElement(i,{fallback:a.createElement(s,null)},a.createElement(c,{key:e.route.id,errorComponent:n,onCatch:()=>{e.id}},a.createElement(Z,{match:e}))))}function Z(t){const e=z();if("error"===t.match.state.status)throw t.match.state.error;if("pending"===t.match.state.status)throw t.match.__loadPromise;if("success"===t.match.state.status)return a.createElement(t.match.component??e.options.defaultComponent??Q,{useLoader:t.match.route.useLoader,useMatch:t.match.route.useMatch,useContext:t.match.route.useContext,useSearch:t.match.route.useSearch,useParams:t.match.route.useParams});s(!1)}function tt(t){return a.createElement(a.Fragment,null,t.children)}class et 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(rt,D({},this.props,{errorState:this.state,reset:()=>this.setState({})}))}}function rt(t){const[e,r]=a.useState(t.errorState),o=z(),s=t.errorComponent??ot,n=a.useRef("");return a.useEffect((()=>{e&&o.state.currentLocation.key!==n.current&&r({}),n.current=o.state.currentLocation.key}),[e,o.state.currentLocation.key]),a.useEffect((()=>{t.errorState.error&&r(t.errorState)}),[t.errorState.error]),t.errorState.error&&e.error?a.createElement(s,e):t.children}function ot({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 at(t,e=!0){const r=W();a.useEffect((()=>{if(!e)return;let o=r.history.block(((e,r)=>{window.confirm(t)&&(o(),e())}));return o}))}const st="__root__";class nt{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=st:s(this.parentRoute);let o=r?st:e.path;o&&"/"!==o&&(o=P(o));const a=e?.id||o;let n=r?st:S([this.parentRoute.id===st?"":this.parentRoute.id,a]);o===st&&(o="/"),n!==st&&(n=S(["/",n]));const i=n===st?"/":S([this.parentRoute.fullPath,o]);this.path=o,this.id=n,this.fullPath=i};addChildren=t=>(this.children=t,this);useMatch=t=>K({...t,from:this.id});useLoader=t=>V({...t,from:this.id});useContext=t=>K({...t,from:this.id}).context;useSearch=t=>J({...t,from:this.id});useParams=t=>G({...t,from:this.id})}class it extends nt{constructor(t){super(t)}static withRouterContext=()=>t=>new it(t)}const ct=ut(JSON.parse),ht=lt(JSON.stringify);function ut(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let r=I(e);for(let e in r){const o=r[e];if("string"==typeof o)try{r[e]=t(o)}catch(t){}}return r}}function lt(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=j(e).toString();return r?`?${r}`:""}}const dt=async({router:t,routeMatch:e})=>{const r=t.buildNext({to:".",search:t=>({...t??{},__data:{matchId:e.id}})}),o=await fetch(r.href,{method:"GET",signal:e.abortController.signal});if(o.ok)return o.json();throw new Error("Failed to fetch match data")};const pt="undefined"==typeof window||!window.document.createElement;function ft(){return{status:"idle",latestLocation:null,currentLocation:null,currentMatches:[],lastUpdated:Date.now()}}function mt(t){return!!t?.isRedirect}const yt=["component","errorComponent","pendingComponent"];class gt{abortController=new AbortController;constructor(t,e,r){Object.assign(this,{route:e,router:t,id:r.id,pathname:r.pathname,params:r.params,__store:new T({updatedAt:0,routeSearch:{},search:{},status:"idle",loader:void 0},{onUpdate:()=>{this.state=this.__store.state}})}),this.state=this.__store.state,yt.map((async t=>{const e=this.route.options[t];this[t]=e})),"idle"!==this.state.status||this.#t()||this.__store.setState((t=>({...t,status:"success"})))}#t=()=>!(!this.route.options.loader&&!yt.some((t=>this.route.options[t]?.preload)));__commit=()=>{const{routeSearch:t,search:e,context:r,routeContext:o}=this.#e({location:this.router.state.currentLocation});this.context=r,this.routeContext=o,this.__store.setState((r=>({...r,routeSearch:v(r.routeSearch,t),search:v(r.search,e)})))};cancel=()=>{this.abortController?.abort()};#r=t=>{const e=this.parentMatch?this.parentMatch.#r(t):{search:t.location.search,routeSearch:t.location.search};try{const t=("object"==typeof this.route.options.validateSearch?this.route.options.validateSearch.parse:this.route.options.validateSearch)?.(e.search)??{};return{routeSearch:t,search:{...e.search,...t}}}catch(t){if(mt(t))throw t;(this.route.options.onValidateSearchError??this.route.options.onError)?.(t);const e=new Error("Invalid search params found",{cause:t});throw e.code="INVALID_SEARCH_PARAMS",e}};#e=t=>{const{search:e,routeSearch:r}=this.#r(t);try{const t=this.route.options.getContext?.({parentContext:this.parentMatch?.routeContext??{},context:this.parentMatch?.context??this.router?.options.context??{},params:this.params,search:e})||{};return{routeSearch:r,search:e,context:{...this.parentMatch?.context??this.router?.options.context,...t},routeContext:t}}catch(t){throw this.route.options.onError?.(t),t}};__load=async t=>{let e;this.parentMatch=t.parentMatch;try{e=this.#e(t)}catch(e){return mt(e)?void(t?.preload||this.router.navigate(e)):void this.__store.setState((t=>({...t,status:"error",error:e})))}const{routeSearch:r,search:o,context:a,routeContext:s}=e;if("pending"!==this.state.status)return this.__loadPromise=Promise.resolve().then((async()=>{const e=""+Date.now()+Math.random();this.#o=e;const n=()=>e!==this.#o?this.__loadPromise:void 0;let i;"idle"===this.state.status&&this.__store.setState((t=>({...t,status:"pending"})));const c=(async()=>{await Promise.all(yt.map((async t=>{const e=this.route.options[t];e?.preload&&await e.preload()})))})(),h=Promise.resolve().then((()=>{if(this.route.options.loader)return this.route.options.loader({params:this.params,routeSearch:r,search:o,signal:this.abortController.signal,preload:!!t?.preload,routeContext:s,context:a})}));try{const[t,e]=await Promise.all([c,h]);if(i=n())return await i;this.__store.setState((t=>({...t,error:void 0,status:"success",updatedAt:Date.now(),loader:e})))}catch(e){if(mt(e))return void(t?.preload||this.router.navigate(e));const r=this.route.options.onLoadError??this.route.options.onError;try{r?.(e)}catch(e){return mt(e)?void(t?.preload||this.router.navigate(e)):void this.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}this.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}finally{delete this.__loadPromise}})),this.__loadPromise};#o=""}t.Block=function({message:t,condition:e,children:r}){return at(t,e),r??null},t.ErrorComponent=ot,t.Link=B,t.MatchRoute=function(t){const e=Y()(t);return e?"function"==typeof t.children?t.children(e):e?t.children:null:null},t.Navigate=function(t){const e=z();return a.useLayoutEffect((()=>{e.navigate(t)}),[]),null},t.Outlet=Q,t.RootRoute=it,t.Route=nt,t.RouteMatch=gt,t.Router=class{#a;startedLoadingAt=Date.now();resolveNavigation=()=>{};constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??ht,parseSearch:t?.parseSearch??ct,fetchServerDataFn:t?.fetchServerDataFn??dt},this.__store=new T(ft(),{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.latestLocation.href!==e.href&&this.#s({...e,replace:!0})}reset=()=>{this.__store.setState((t=>Object.assign(t,ft())))};mount=()=>(pt||this.state.currentMatches.length||this.safeLoad(),()=>{});hydrate=async t=>{let e=t;return"undefined"!=typeof document&&(e=window.__DEHYDRATED__,s(e)),this.options.hydrate?.(e),await this.load()};update=t=>{if(Object.assign(this.options,t),this.context=this.options.context,!this.history||this.options.history&&this.options.history!==this.history){this.#a&&this.#a(),this.history=this.options.history??(pt?p():d());const t=this.#n();this.__store.setState((e=>({...e,latestLocation:t,currentLocation:t}))),this.#a=this.history.listen((()=>{this.safeLoad({next:this.#n(this.state.latestLocation)})}))}const{basepath:e,routeTree:r}=this.options;return this.basepath=`/${P(e??"")??""}`,r&&(this.routesById={},this.routeTree=this.#i(r)),this};buildNext=t=>{const e=this.#c(t),r=this.matchRoutes(e.pathname);return this.#c({...t,__matches:r})};cancelMatches=()=>{[...this.state.currentMatches,...this.state.pendingMatches||[]].forEach((t=>{t.cancel()}))};safeLoad=t=>{this.load(t).catch((t=>{console.warn(t),s(!1)}))};load=async t=>{let e=Date.now();const r=e;let o;if(this.startedLoadingAt=r,this.cancelMatches(),this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,latestLocation:t.next}))),o=this.matchRoutes(this.state.latestLocation.pathname,{strictParseParams:!0}),this.__store.setState((t=>({...t,status:"pending",pendingMatches:o,pendingLocation:this.state.latestLocation})))})),await this.loadMatches(o,this.state.pendingLocation),this.startedLoadingAt!==r)return this.navigationPromise;const a=this.state.currentMatches,s=[],n=[];a.forEach((t=>{o.find((e=>e.id===t.id))?n.push(t):s.push(t)}));const i=o.filter((t=>!a.find((e=>e.id===t.id))));e=Date.now(),s.forEach((t=>{t.__onExit?.({params:t.params,search:t.state.routeSearch}),"error"===t.state.status&&this.__store.setState((t=>({...t,status:"idle",error:void 0})))})),n.forEach((t=>{t.route.options.onTransition?.({params:t.params,search:t.state.routeSearch})})),i.forEach((t=>{t.__onExit=t.route.options.onLoaded?.({params:t.params,search:t.state.search})}));const c=this.state.currentLocation;this.__store.setState((t=>({...t,status:"idle",currentLocation:this.state.latestLocation,currentMatches:o,pendingLocation:void 0,pendingMatches:void 0}))),o.forEach((t=>{t.__commit()})),c.href!==this.state.currentLocation.href&&this.options.onRouteChange?.(),this.resolveNavigation()};getRoute=t=>{const e=this.routesById[t];return s(e),e};loadRoute=async(t=this.state.latestLocation)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,{strictParseParams:!0});return await this.loadMatches(r,e),r};preloadRoute=async(t=this.state.latestLocation)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,{strictParseParams:!0});return await this.loadMatches(r,e,{preload:!0}),r};matchRoutes=(t,e)=>{if(!this.routeTree)return[];const r=[...this.state.currentMatches,...this.state.pendingMatches??[]];let o=[];const a=r=>{let s;if(r.some((r=>{const n=r.children;if(!r.path){if(n?.length){o.push({route:r});const t=a(n);return t?(s=t,!0):(o.pop(),!1)}return!1}const i="/"!==r.path||!!n?.length,c=k(this.basepath,t,{to:r.fullPath,fuzzy:i,caseSensitive:r.options.caseSensitive??this.options.caseSensitive});if(c){let t;try{t=r.options.parseParams?.(c)??c}catch(t){if(e?.strictParseParams)throw t}return o.push({route:r,params:t}),s=r,!0}return!1})),!s)return;const n=s.children;return n?.length?a(n):s};a([this.routeTree]);let s={};return o.map((({route:t,params:e})=>{Object.assign(s,e);const o=M(t.path,e),a=M(t.id,e);return r.find((t=>t.id===a))||new gt(this,t,{id:a,params:s,pathname:S([this.basepath,o])})}))};loadMatches=async(t,e,r)=>{let o;try{await Promise.all(t.map((async(t,e)=>{try{await(t.route.options.beforeLoad?.({router:this,match:t}))}catch(r){if(mt(r))throw r;o=o??e;const a=t.route.options.onBeforeLoadError??t.route.options.onError;try{a?.(r)}catch(e){if(mt(e))throw e;return void t.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}t.__store.setState((t=>({...t,error:r,status:"error",updatedAt:Date.now()})))}})))}catch(t){if(mt(t))return void(r?.preload||this.navigate(t));throw t}const a=t.slice(0,o),s=a.map((async(t,o)=>{const s=a[o-1];t.__load({preload:r?.preload,location:e,parentMatch:s}),await t.__loadPromise,s&&await s.__loadPromise}));await Promise.all(s)};reload=()=>{this.navigate({fromCurrent:!0,replace:!0,search:!0})};resolvePath=(t,e)=>C(this.basepath,t,L(e));navigate=async({from:t,to:e="",search:r,hash:o,replace:a,params:n})=>{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.#s({from:c,to:i,search:r,hash:o,replace:a,params:n})};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePath(t.from??"",t.to):void 0};const r=this.buildNext(t),o=e?.pending?this.state.pendingLocation:this.state.currentLocation;if(!o)return!1;const a=k(this.basepath,o.pathname,{...e,to:r.pathname});return!!a&&(e?.includeSearch??1?!!b(o.search,r.search)&&a:a)};buildLink=({from:t,to:e=".",search:r,params:o,hash:a,target:s,replace:n,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:n},d=this.buildNext(l);c=c??this.options.defaultPreload;const p=h??this.options.defaultPreloadDelay??0,f=this.state.currentLocation.pathname.split("/"),m=d.pathname.split("/").every(((t,e)=>t===f[e])),y=i?.exact?this.state.currentLocation.pathname===d.pathname:m,g=!i?.includeHash||this.state.currentLocation.hash===d.hash,v=!(i?.includeSearch??1)||b(this.state.currentLocation.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||s&&"_self"!==s||0!==t.button||(t.preventDefault(),this.#s(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}};#i=t=>{const e=(t,r)=>{t.forEach(((t,r)=>{t.init({originalIndex:r,router:this});s(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t;const o=t.children;o?.length&&(e(o),o.length,t.children=o.map(((t,e)=>{const r=E(L(t.path??"/")),o=R(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,cleaned:r,parsed:o,index:e,score:a}})).sort(((t,e)=>{const r=Math.min(t.score.length,e.score.length);for(let o=0;o<r;o++)if(t.score[o]!==e.score[o])return e.score[o]-t.score[o];for(let o=0;o<r;o++)if(t.parsed[o].value!==e.parsed[o].value)return t.parsed[o].value>e.parsed[o].value?1:-1;return t.score.length!==e.score.length?e.score.length-t.score.length:t.cleaned!==e.cleaned?t.cleaned>e.cleaned?1:-1:t.index-e.index})).map((t=>t.child)))}))};e([t]);const r=(t,e)=>{t.forEach((t=>{t.isRoot?s(!e):s(!e||t.parentRoute===e,(t.path,t.parentRoute?.id,e?.id)),t.children&&r(t.children,t)}))};return r([t],void 0),t};#n=t=>{let{pathname:e,search:r,hash:o,state:a}=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:a,key:a?.key||"__init__"}};#c=(t={})=>{t.fromCurrent=t.fromCurrent??""===t.to;const e=t.fromCurrent?this.state.latestLocation.pathname:t.from??this.state.latestLocation.pathname;let r=C(this.basepath??"/",e,`${t.to??""}`);const o={...y(this.matchRoutes(this.state.latestLocation.pathname,{strictParseParams:!0}))?.params};let a=!0===(t.params??!0)?o:g(t.params,o);a&&t.__matches?.map((t=>t.route.options.stringifyParams)).filter(Boolean).forEach((t=>{a={...a,...t(a)}})),r=M(r,a??{});const s=t.__matches?.map((t=>t.route.options.preSearchFilters??[])).flat().filter(Boolean)??[],n=t.__matches?.map((t=>t.route.options.postSearchFilters??[])).flat().filter(Boolean)??[],i=s?.length?s?.reduce(((t,e)=>e(t)),this.state.latestLocation.search):this.state.latestLocation.search,c=!0===t.search?i:t.search?g(t.search,i)??{}:s?.length?i:{},h=n?.length?n.reduce(((t,e)=>e(t)),c):c,u=v(this.state.latestLocation.search,h),l=this.options.stringifySearch(u),d=!0===t.hash?this.state.latestLocation.hash:g(t.hash,this.state.latestLocation.hash),p=d?`#${d}`:"";return{pathname:r,search:u,searchStr:l,state:!0===t.state?this.state.latestLocation.state:g(t.state,this.state.latestLocation.state),hash:d,href:this.history.createHref(`${r}${l}${p}`),key:t.key}};#s=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.latestLocation.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.navigationPromise=new Promise((t=>{const e=this.resolveNavigation;this.resolveNavigation=()=>{e(),t()}}))}},t.RouterProvider=function({router:t,...e}){t.update(e);const r=$(t.__store,(t=>t.currentMatches));return a.useEffect(t.mount,[t]),a.createElement(U.Provider,{value:{router:t}},a.createElement(F.Provider,{value:[void 0,...r]},a.createElement(et,{errorComponent:ot,onCatch:()=>{}},a.createElement(Q,null))))},t.cleanPath=L,t.createBrowserHistory=d,t.createHashHistory=function(){return d({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=p,t.decode=I,t.defaultFetchServerDataFn=dt,t.defaultParseSearch=ct,t.defaultStringifySearch=ht,t.encode=j,t.functionalUpdate=g,t.interpolatePath=M,t.invariant=s,t.isPlainObject=_,t.isRedirect=mt,t.joinPaths=S,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=k,t.matchesContext=F,t.parsePathname=R,t.parseSearchWith=ut,t.partialDeepEqual=b,t.pick=function(t,e){return e.reduce(((e,r)=>(e[r]=t[r],e)),{})},t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=v,t.resolvePath=C,t.rootRouteId=st,t.routerContext=U,t.stringifySearchWith=lt,t.trimPath=P,t.trimPathLeft=E,t.trimPathRight=x,t.useBlocker=at,t.useLinkProps=H,t.useLoader=V,t.useMatch=K,t.useMatchRoute=Y,t.useMatches=q,t.useNavigate=function(t){const e=z();return a.useCallback((r=>e.navigate({...t,...r})),[])},t.useParams=G,t.useRouter=W,t.useRouterContext=z,t.useSearch=J,t.useStore=$,t.warning=n,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.production.js.map
{
"name": "@tanstack/router",
"author": "Tanner Linsley",
"version": "0.0.1-beta.95",
"version": "0.0.1-beta.97",
"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