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.107 to 0.0.1-beta.108

6

build/cjs/history.js

@@ -32,3 +32,3 @@ /**

function createHistory(opts) {
let currentLocation = opts.getLocation();
let location = opts.getLocation();
let unsub = () => {};

@@ -56,3 +56,3 @@ let listeners = new Set();

const onUpdate = () => {
currentLocation = opts.getLocation();
location = opts.getLocation();
listeners.forEach(listener => listener());

@@ -62,3 +62,3 @@ };

get location() {
return currentLocation;
return location;
},

@@ -65,0 +65,0 @@ listen: cb => {

@@ -124,3 +124,3 @@ /**

const pathParams = matchByPath(basepath, currentPathname, matchLocation);
// const searchMatched = matchBySearch(currentLocation.search, matchLocation)
// const searchMatched = matchBySearch(location.search, matchLocation)

@@ -127,0 +127,0 @@ if (matchLocation.to && !pathParams) {

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

const routerContext = /*#__PURE__*/React__namespace.createContext(null);
const useDeferredValue = React__namespace.useDeferredValue || (d => d);
function RouterProvider({

@@ -187,3 +188,5 @@ router,

router.update(rest);
const currentMatches = reactStore.useStore(router.__store, s => s.currentMatches);
const matches = useDeferredValue(reactStore.useStore(router.__store, s => {
return s.matches;
}));
React__namespace.useEffect(router.mount, [router]);

@@ -195,3 +198,3 @@ return /*#__PURE__*/React__namespace.createElement(routerContext.Provider, {

}, /*#__PURE__*/React__namespace.createElement(matchesContext.Provider, {
value: [undefined, ...currentMatches]
value: [undefined, ...matches]
}, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {

@@ -221,3 +224,4 @@ errorComponent: ErrorComponent,

const nearestMatch = useMatches()[0];
const match = opts?.from ? router.state.currentMatches.find(d => d.route.id === opts?.from) : nearestMatch;
const matches = useDeferredValue(router.state.matches);
const match = opts?.from ? matches.find(d => d.route.id === opts?.from) : nearestMatch;
invariant__default["default"](match, `Could not find ${opts?.from ? `an active match from "${opts.from}"` : 'a nearest match!'}`);

@@ -230,27 +234,2 @@ if (opts?.strict ?? true) {

}
// export function useRoute<
// TId extends keyof RegisteredRoutesInfo['routesById'] = '/',
// >(routeId: TId): RegisteredRoutesInfo['routesById'][TId] {
// const router = useRouterContext()
// const resolvedRoute = router.getRoute(routeId as any)
// invariant(
// resolvedRoute,
// `Could not find a route for route "${
// routeId as string
// }"! Did you forget to add it to your route?`,
// )
// return resolvedRoute as any
// }
// export function useRoute<TRouteOrId>(
// route: TRouteOrId extends string
// ? keyof RegisteredRoutesInfo['routeIds']
// : RegisteredRoutesInfo['routeUnion'],
// ): RouteFromIdOrRoute<TRouteOrId> {
// return null as any
// }
function useLoader(opts) {

@@ -277,6 +256,6 @@ const {

reactStore.useStore(router.__store, d => {
const params = utils.last(d.currentMatches)?.params;
const params = utils.last(d.matches)?.params;
return opts?.track?.(params) ?? params;
});
return utils.last(router.state.currentMatches)?.params;
return utils.last(router.state.matches)?.params;
}

@@ -339,2 +318,15 @@ function useNavigate(defaultOpts) {

const ResolvedCatchBoundary = errorComponent ? CatchBoundary : SafeFragment;
if (typeof document === 'undefined') {
if (match.state.loader) {
Object.keys(match.state.loader).forEach(key => {
let value = match.state.loader[key];
if (value instanceof Promise || value.then) {
value = {
__isPromise: true,
key: key
};
}
});
}
}
return /*#__PURE__*/React__namespace.createElement(matchesContext.Provider, {

@@ -356,2 +348,9 @@ value: matches

const router = useRouterContext();
// if (!props.match.route.isRoot && typeof document !== 'undefined') {
// router.options.hydrate?.(
// (window as any).__TSR_DEHYDRATED_MATCHES__[props.match.id],
// )
// }
if (props.match.state.status === 'error') {

@@ -409,6 +408,6 @@ throw props.match.state.error;

if (activeErrorState) {
if (router.state.currentLocation.key !== prevKeyRef.current) ;
if (router.state.location.key !== prevKeyRef.current) ;
}
prevKeyRef.current = router.state.currentLocation.key;
}, [activeErrorState, router.state.currentLocation.key]);
prevKeyRef.current = router.state.location.key;
}, [activeErrorState, router.state.location.key]);
React__namespace.useEffect(() => {

@@ -415,0 +414,0 @@ if (props.errorState.error) ;

@@ -22,2 +22,5 @@ /**

abortController = new AbortController();
__loadKey = {
__init: true
};
constructor(router, route, opts) {

@@ -34,3 +37,3 @@ Object.assign(this, {

search: {},
status: 'idle',
status: 'pending',
loader: undefined

@@ -48,3 +51,6 @@ }, {

});
if (this.state.status === 'idle' && !this.#hasLoaders()) {
this.__loadPromise = new Promise(r => {
this.__loadPromiseResolve = r;
});
if (this.state.status === 'pending' && !this.#hasLoaders()) {
this.__store.setState(s => ({

@@ -54,2 +60,3 @@ ...s,

}));
this.__loadPromiseResolve?.();
}

@@ -67,3 +74,3 @@ }

} = this.#resolveInfo({
location: this.router.state.currentLocation
location: this.router.state.location
});

@@ -165,7 +172,24 @@ this.context = context;

} = info;
const loaderOpts = {
params: this.params,
routeSearch,
search,
signal: this.abortController.signal,
preload: !!opts?.preload,
routeContext,
context
};
// If the match is invalid, errored or idle, trigger it to load
if (this.state.status === 'pending') {
return;
}
// If getKey is set, we can skip the loader if the key is the same
// if (this.route.options.getKey) {
// const prevKey = this.__loadKey
// this.__loadKey = this.route.options.getKey?.(loaderOpts)
// if (
// !opts.preload &&
// JSON.stringify(prevKey) === JSON.stringify(this.__loadKey)
// ) {
// return
// }
this.__loadPromise = Promise.resolve().then(async () => {

@@ -178,12 +202,2 @@ const loadId = '' + Date.now() + Math.random();

let latestPromise;
// If the match was in an error state, set it
// to a loading state again. Otherwise, keep it
// as loading or resolved
if (this.state.status === 'idle') {
this.__store.setState(s => ({
...s,
status: 'pending'
}));
}
const componentsPromise = (async () => {

@@ -202,11 +216,3 @@ // then run all component and data loaders in parallel

if (this.route.options.loader) {
return this.route.options.loader({
params: this.params,
routeSearch,
search,
signal: this.abortController.signal,
preload: !!opts?.preload,
routeContext: routeContext,
context: context
});
return this.route.options.loader(loaderOpts);
}

@@ -257,2 +263,3 @@ return;

} finally {
this.__loadPromiseResolve?.();
delete this.__loadPromise;

@@ -259,0 +266,0 @@ }

@@ -75,3 +75,3 @@ /**

});
if (this.state.latestLocation.href !== next.href) {
if (this.state.location.href !== next.href) {
this.#commitLocation({

@@ -90,3 +90,3 @@ ...next,

// If the router matches are empty, start loading the matches
if (!this.state.currentMatches.length) {
if (!this.state.matches.length) {
this.safeLoad();

@@ -108,8 +108,8 @@ }

...s,
latestLocation: parsedLocation,
currentLocation: parsedLocation
currentLocation: parsedLocation,
location: parsedLocation
}));
this.#unsubHistory = this.history.listen(() => {
this.safeLoad({
next: this.#parseLocation(this.state.latestLocation)
next: this.#parseLocation(this.state.location)
});

@@ -131,3 +131,3 @@ });

const next = this.#buildLocation(opts);
const __matches = this.matchRoutes(next.pathname);
const __matches = this.matchRoutes(next.pathname, next.search);
return this.#buildLocation({

@@ -139,3 +139,3 @@ ...opts,

cancelMatches = () => {
[...this.state.currentMatches, ...(this.state.pendingMatches || [])].forEach(match => {
[...this.state.matches].forEach(match => {
match.cancel();

@@ -151,2 +151,3 @@ });

load = async opts => {
this.#createNavigationPromise();
let now = Date.now();

@@ -164,3 +165,3 @@ const startedAt = now;

...s,
latestLocation: opts.next
location: opts.next
}));

@@ -170,3 +171,3 @@ }

// Match the routes
matches = this.matchRoutes(this.state.latestLocation.pathname, {
matches = this.matchRoutes(this.state.location.pathname, this.state.location.search, {
strictParseParams: true,

@@ -178,4 +179,3 @@ debug: true

status: 'pending',
pendingMatches: matches,
pendingLocation: this.state.latestLocation
matches: matches
}));

@@ -185,6 +185,3 @@ });

// Load the matches
await this.loadMatches(matches, this.state.pendingLocation
// opts
);
await this.loadMatches(matches, this.state.location);
if (this.startedLoadingAt !== startedAt) {

@@ -194,3 +191,3 @@ // Ignore side-effects of outdated side-effects

}
const previousMatches = this.state.currentMatches;
const previousMatches = this.state.matches;
const exiting = [],

@@ -236,10 +233,8 @@ staying = [];

});
const prevLocation = this.state.currentLocation;
const prevLocation = this.state.location;
this.__store.setState(s => ({
...s,
status: 'idle',
currentLocation: this.state.latestLocation,
currentMatches: matches,
pendingLocation: undefined,
pendingMatches: undefined
currentLocation: s.location,
matches: matches
}));

@@ -249,3 +244,3 @@ matches.forEach(match => {

});
if (prevLocation.href !== this.state.currentLocation.href) {
if (prevLocation.href !== this.state.location.href) {
this.options.onRouteChange?.();

@@ -260,5 +255,5 @@ }

};
loadRoute = async (navigateOpts = this.state.latestLocation) => {
loadRoute = async (navigateOpts = this.state.location) => {
const next = this.buildNext(navigateOpts);
const matches = this.matchRoutes(next.pathname, {
const matches = this.matchRoutes(next.pathname, next.search, {
strictParseParams: true

@@ -269,5 +264,5 @@ });

};
preloadRoute = async (navigateOpts = this.state.latestLocation) => {
preloadRoute = async (navigateOpts = this.state.location) => {
const next = this.buildNext(navigateOpts);
const matches = this.matchRoutes(next.pathname, {
const matches = this.matchRoutes(next.pathname, next.search, {
strictParseParams: true

@@ -280,3 +275,3 @@ });

};
matchRoutes = (pathname, opts) => {
matchRoutes = (pathname, search, opts) => {
// If there's no route tree, we can't match anything

@@ -289,3 +284,3 @@ if (!this.routeTree) {

// pending matches that are still loading
const existingMatches = [...this.state.currentMatches, ...(this.state.pendingMatches ?? [])];
const existingMatches = [...this.state.matches];

@@ -394,3 +389,6 @@ // We need to "flatten" layout routes, but only process as many

const interpolatedPath = path.interpolatePath(route.path, allParams);
const matchId = path.interpolatePath(route.id, allParams, true);
const matchId = path.interpolatePath(route.id, allParams, true) + route.options.getKey?.({
params: allParams,
search
});

@@ -524,3 +522,6 @@ // Waste not, want not. If we already have a match for this route,

const next = this.buildNext(location);
const baseLocation = opts?.pending ? this.state.pendingLocation : this.state.currentLocation;
if (opts?.pending && this.state.status !== 'pending') {
return false;
}
const baseLocation = opts?.pending ? this.state.location : this.state.currentLocation;
if (!baseLocation) {

@@ -580,9 +581,9 @@ return false;

// Compare path/hash for matches
const currentPathSplit = this.state.currentLocation.pathname.split('/');
const currentPathSplit = this.state.location.pathname.split('/');
const nextPathSplit = next.pathname.split('/');
const pathIsFuzzyEqual = nextPathSplit.every((d, i) => d === currentPathSplit[i]);
// Combine the matches based on user options
const pathTest = activeOptions?.exact ? this.state.currentLocation.pathname === next.pathname : pathIsFuzzyEqual;
const hashTest = activeOptions?.includeHash ? this.state.currentLocation.hash === next.hash : true;
const searchTest = activeOptions?.includeSearch ?? true ? utils.partialDeepEqual(this.state.currentLocation.search, next.search) : true;
const pathTest = activeOptions?.exact ? this.state.location.pathname === next.pathname : pathIsFuzzyEqual;
const hashTest = activeOptions?.includeHash ? this.state.location.hash === next.hash : true;
const searchTest = activeOptions?.includeSearch ?? true ? utils.partialDeepEqual(this.state.location.search, next.search) : true;

@@ -654,3 +655,3 @@ // The final "active" test

state: {
...utils.pick(this.state, ['latestLocation', 'currentLocation', 'status', 'lastUpdated'])
...utils.pick(this.state, ['location', 'status', 'lastUpdated'])
}

@@ -671,3 +672,4 @@ };

...s,
...ctx.router.state
...ctx.router.state,
currentLocation: ctx.router.state.location
};

@@ -783,5 +785,5 @@ });

dest.fromCurrent = dest.fromCurrent ?? dest.to === '';
const fromPathname = dest.fromCurrent ? this.state.latestLocation.pathname : dest.from ?? this.state.latestLocation.pathname;
const fromPathname = dest.fromCurrent ? this.state.location.pathname : dest.from ?? this.state.location.pathname;
let pathname = path.resolvePath(this.basepath ?? '/', fromPathname, `${dest.to ?? ''}`);
const fromMatches = this.matchRoutes(this.state.latestLocation.pathname, {
const fromMatches = this.matchRoutes(this.state.location.pathname, this.state.location.search, {
strictParseParams: true

@@ -806,3 +808,3 @@ });

// Pre filters first
const preFilteredSearch = preSearchFilters?.length ? preSearchFilters?.reduce((prev, next) => next(prev), this.state.latestLocation.search) : this.state.latestLocation.search;
const preFilteredSearch = preSearchFilters?.length ? preSearchFilters?.reduce((prev, next) => next(prev), this.state.location.search) : this.state.location.search;

@@ -817,7 +819,7 @@ // Then the link/navigate function

const postFilteredSearch = postSearchFilters?.length ? postSearchFilters.reduce((prev, next) => next(prev), destSearch) : destSearch;
const search = utils.replaceEqualDeep(this.state.latestLocation.search, postFilteredSearch);
const search = utils.replaceEqualDeep(this.state.location.search, postFilteredSearch);
const searchStr = this.options.stringifySearch(search);
const hash = dest.hash === true ? this.state.latestLocation.hash : utils.functionalUpdate(dest.hash, this.state.latestLocation.hash);
const hash = dest.hash === true ? this.state.location.hash : utils.functionalUpdate(dest.hash, this.state.location.hash);
const hashStr = hash ? `#${hash}` : '';
const nextState = dest.state === true ? this.state.latestLocation.state : utils.functionalUpdate(dest.state, this.state.latestLocation.state);
const nextState = dest.state === true ? this.state.location.state : utils.functionalUpdate(dest.state, this.state.location.state);
return {

@@ -841,3 +843,3 @@ pathname,

}
const isSameUrl = this.state.latestLocation.href === next.href;
const isSameUrl = this.state.location.href === next.href;
if (isSameUrl && !next.key) {

@@ -851,9 +853,13 @@ nextAction = 'replace';

});
return this.navigationPromise = new Promise(resolve => {
const previousNavigationResolve = this.resolveNavigation;
return this.#createNavigationPromise();
};
#createNavigationPromise = () => {
const previousNavigationResolve = this.resolveNavigation;
this.navigationPromise = new Promise(resolve => {
this.resolveNavigation = () => {
resolve();
previousNavigationResolve();
resolve();
};
});
return this.navigationPromise;
};

@@ -867,5 +873,5 @@ }

status: 'idle',
latestLocation: null,
currentLocation: null,
currentMatches: [],
location: null,
matches: [],
lastUpdated: Date.now()

@@ -872,0 +878,0 @@ };

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

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

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

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

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

"name": "store/build/esm/index.js",
"uid": "5878-63"
"uid": "adb0-63"
},
{
"name": "react-store/build/esm/index.js",
"uid": "5878-65"
"uid": "adb0-65"
}

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

{
"uid": "5878-61",
"uid": "adb0-61",
"name": "\u0000rollupPluginBabelHelpers.js"

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

"nodeParts": {
"5878-49": {
"adb0-49": {
"renderedLength": 199,
"gzipLength": 134,
"brotliLength": 0,
"mainUid": "5878-48"
"mainUid": "adb0-48"
},
"5878-51": {
"adb0-51": {
"renderedLength": 48,
"gzipLength": 65,
"brotliLength": 0,
"mainUid": "5878-50"
"mainUid": "adb0-50"
},
"5878-53": {
"renderedLength": 5664,
"gzipLength": 1407,
"adb0-53": {
"renderedLength": 5643,
"gzipLength": 1404,
"brotliLength": 0,
"mainUid": "5878-52"
"mainUid": "adb0-52"
},
"5878-55": {
"adb0-55": {
"renderedLength": 2821,
"gzipLength": 990,
"brotliLength": 0,
"mainUid": "5878-54"
"mainUid": "adb0-54"
},
"5878-57": {
"renderedLength": 6035,
"gzipLength": 1425,
"adb0-57": {
"renderedLength": 6028,
"gzipLength": 1423,
"brotliLength": 0,
"mainUid": "5878-56"
"mainUid": "adb0-56"
},
"5878-59": {
"adb0-59": {
"renderedLength": 1395,
"gzipLength": 558,
"brotliLength": 0,
"mainUid": "5878-58"
"mainUid": "adb0-58"
},
"5878-61": {
"adb0-61": {
"renderedLength": 457,
"gzipLength": 241,
"brotliLength": 0,
"mainUid": "5878-60"
"mainUid": "adb0-60"
},
"5878-63": {
"adb0-63": {
"renderedLength": 1459,
"gzipLength": 543,
"brotliLength": 0,
"mainUid": "5878-62"
"mainUid": "adb0-62"
},
"5878-65": {
"adb0-65": {
"renderedLength": 1066,
"gzipLength": 481,
"brotliLength": 0,
"mainUid": "5878-64"
"mainUid": "adb0-64"
},
"5878-67": {
"renderedLength": 13865,
"gzipLength": 3347,
"adb0-67": {
"renderedLength": 13789,
"gzipLength": 3327,
"brotliLength": 0,
"mainUid": "5878-66"
"mainUid": "adb0-66"
},
"5878-69": {
"adb0-69": {
"renderedLength": 3556,
"gzipLength": 903,
"brotliLength": 0,
"mainUid": "5878-68"
"mainUid": "adb0-68"
},
"5878-71": {
"adb0-71": {
"renderedLength": 1387,
"gzipLength": 483,
"brotliLength": 0,
"mainUid": "5878-70"
"mainUid": "adb0-70"
},
"5878-73": {
"renderedLength": 29445,
"gzipLength": 7230,
"adb0-73": {
"renderedLength": 29469,
"gzipLength": 7245,
"brotliLength": 0,
"mainUid": "5878-72"
"mainUid": "adb0-72"
},
"5878-75": {
"renderedLength": 7564,
"gzipLength": 1752,
"adb0-75": {
"renderedLength": 7696,
"gzipLength": 1789,
"brotliLength": 0,
"mainUid": "5878-74"
"mainUid": "adb0-74"
},
"5878-77": {
"adb0-77": {
"renderedLength": 0,
"gzipLength": 0,
"brotliLength": 0,
"mainUid": "5878-76"
"mainUid": "adb0-76"
}
},
"nodeMetas": {
"5878-48": {
"adb0-48": {
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"moduleParts": {
"index.production.js": "5878-49"
"index.production.js": "adb0-49"
},

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

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

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

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

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

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

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

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

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

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

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

{
"uid": "5878-76"
"uid": "adb0-76"
},
{
"uid": "5878-70"
"uid": "adb0-70"
}
]
},
"5878-60": {
"adb0-60": {
"id": "\u0000rollupPluginBabelHelpers.js",
"moduleParts": {
"index.production.js": "5878-61"
"index.production.js": "adb0-61"
},

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

},
"5878-78": {
"adb0-78": {
"id": "/packages/router/src/link.ts",

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

{
"uid": "5878-76"
"uid": "adb0-76"
}
]
},
"5878-79": {
"adb0-79": {
"id": "/packages/router/src/routeInfo.ts",

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

{
"uid": "5878-76"
"uid": "adb0-76"
}
]
},
"5878-80": {
"adb0-80": {
"id": "react",

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

{
"uid": "5878-66"
"uid": "adb0-66"
}

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

},
"5878-81": {
"adb0-81": {
"id": "use-sync-external-store/shim/with-selector",

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

{
"uid": "5878-64"
"uid": "adb0-64"
}

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

@@ -56,2 +56,3 @@ import { ParsePathParams } from './link';

getParentRoute: () => TParentRoute;
getKey?: OnLoadFnKey<TSearchSchema, TFullSearchSchema, TAllParams, NoInfer<TRouteContext>, TContext>;
caseSensitive?: boolean;

@@ -112,2 +113,6 @@ preSearchFilters?: SearchFilter<TFullSearchSchema>[];

export type OnLoadFn<TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TAllParams = {}, TContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> = (loaderContext: LoaderContext<TSearchSchema, TFullSearchSchema, TAllParams, TContext, TAllContext>) => Promise<TLoader> | TLoader;
export type OnLoadFnKey<TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TAllParams = {}, TContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> = (loaderContext: {
params: TAllParams;
search: TFullSearchSchema;
}) => any;
export interface LoaderContext<TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TAllParams = {}, TContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> {

@@ -114,0 +119,0 @@ params: TAllParams;

@@ -9,3 +9,3 @@ import { Store } from '@tanstack/react-store';

search: TRoutesInfo['fullSearchSchema'] & TRoute['__types']['fullSearchSchema'];
status: 'idle' | 'pending' | 'success' | 'error';
status: 'pending' | 'success' | 'error';
error?: unknown;

@@ -50,3 +50,5 @@ updatedAt: number;

pendingInfo?: PendingRouteMatchInfo;
__loadKey: any;
__loadPromise?: Promise<void>;
__loadPromiseResolve?: () => void;
__onExit?: void | ((matchContext: {

@@ -53,0 +55,0 @@ params: TRoute['__types']['allParams'];

@@ -90,7 +90,5 @@ /// <reference types="react" />

status: 'idle' | 'pending';
latestLocation: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>;
currentMatches: RouteMatch<TRoutesInfo, TRoutesInfo['routeIntersection']>[];
matches: RouteMatch<TRoutesInfo, TRoutesInfo['routeIntersection']>[];
location: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>;
currentLocation: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>;
pendingMatches?: RouteMatch<TRoutesInfo, TRoutesInfo['routeIntersection']>[];
pendingLocation?: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>;
lastUpdated: number;

@@ -127,3 +125,3 @@ }

}
export interface DehydratedRouterState extends Pick<RouterState, 'status' | 'latestLocation' | 'currentLocation' | 'lastUpdated'> {
export interface DehydratedRouterState extends Pick<RouterState, 'status' | 'location' | 'lastUpdated'> {
}

@@ -170,3 +168,3 @@ export interface DehydratedRouter {

preloadRoute: (navigateOpts?: BuildNextOptions) => Promise<RouteMatch<import("./routeInfo").DefaultRoutesInfo, AnyRoute>[]>;
matchRoutes: (pathname: string, opts?: {
matchRoutes: (pathname: string, search: AnySearchSchema, opts?: {
strictParseParams?: boolean;

@@ -173,0 +171,0 @@ debug?: boolean;

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

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

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

* @license MIT
*/class D{listeners=new Set;_batching=!1;_flushing=0;constructor(t,e){this.state=t,this.options=e}subscribe=t=>{this.listeners.add(t);const e=this.options?.onSubscribe?.(t,this);return()=>{this.listeners.delete(t),e?.()}};setState=t=>{const e=this.state;this.state=this.options?.updateFn?this.options.updateFn(e)(t):t(e),this.options?.onUpdate?.(),this._flush()};_flush=()=>{if(this._batching)return;const t=++this._flushing;this.listeners.forEach((e=>{this._flushing===t&&e()}))};batch=t=>{if(this._batching)return t();this._batching=!0,t(),this._batching=!1,this._flush()}}
*/class T{listeners=new Set;_batching=!1;_flushing=0;constructor(t,e){this.state=t,this.options=e}subscribe=t=>{this.listeners.add(t);const e=this.options?.onSubscribe?.(t,this);return()=>{this.listeners.delete(t),e?.()}};setState=t=>{const e=this.state;this.state=this.options?.updateFn?this.options.updateFn(e)(t):t(e),this.options?.onUpdate?.(),this._flush()};_flush=()=>{if(this._batching)return;const t=++this._flushing;this.listeners.forEach((e=>{this._flushing===t&&e()}))};batch=t=>{if(this._batching)return t();this._batching=!0,t(),this._batching=!1,this._flush()}}
/**

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

* @license MIT
*/function N(t,e=(t=>t)){return r.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,H)}function H(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(e,r[o])||!Object.is(t[r[o]],e[r[o]]))return!1;return!0}function B(t){const e=W(),{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)}))},$=j?g(n,{})??{}:{},T=j?{}:g(i,{})??{};return{...$,...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,...$.style,...T.style},className:[_,$.className,T.className].filter(Boolean).join(" ")||void 0,...h?{role:"link","aria-disabled":!0}:void 0,"data-status":j?"active":void 0}}const F=a.forwardRef(((t,e)=>{const r=B(t);return a.createElement("a",T({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);function W(){const t=a.useContext(z);return N(t.router.__store),t.router}function q(t){const e=W();return N(e.__store,t),e}function K(){return a.useContext(U)}function V(t){const e=W(),r=K()[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)),N(o.__store,(e=>t?.track?.(o)??o)),o}function J(t){const{track:e,...r}=t,o=V(r);return N(o.__store,(e=>t?.track?.(e.loader)??e.loader)),o.state.loader}function G(t){const{track:e,...r}=t??{},o=V(r);return N(o.__store,(e=>t?.track?.(e.search)??e.search)),o.state.search}function Y(t){const e=W();return N(e.__store,(e=>{const r=y(e.currentMatches)?.params;return t?.track?.(r)??r})),y(e.state.currentMatches)?.params}function Q(){const t=W();return a.useCallback((e=>{const{pending:r,caseSensitive:o,...a}=e;return t.matchRoute(a,{pending:r,caseSensitive:o})}),[])}function X(){const t=K().slice(1),e=t[0];return e?a.createElement(Z,{matches:t,match:e}):null}function Z({matches:t,match:e}){const r=W();N(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??!e.route.isRoot?a.Suspense:et,c=n?rt:et;return a.createElement(U.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(tt,{match:e}))))}function tt(t){const e=W();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??X,{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 et(t){return a.createElement(a.Fragment,null,t.children)}class rt 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(ot,T({},this.props,{errorState:this.state,reset:()=>this.setState({})}))}}function ot(t){const[e,r]=a.useState(t.errorState),o=W(),s=t.errorComponent??at,n=a.useRef("");return a.useEffect((()=>{e&&(o.state.currentLocation.key,n.current),n.current=o.state.currentLocation.key}),[e,o.state.currentLocation.key]),a.useEffect((()=>{t.errorState.error}),[t.errorState.error]),t.errorState.error&&e.error?a.createElement(s,e):t.children}function at({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=q();a.useEffect((()=>{if(!e)return;let o=r.history.block(((e,r)=>{window.confirm(t)&&(o(),e())}));return o}))}const nt="__root__";class it{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute}init=t=>{this.originalIndex=t.originalIndex,this.router=t.router;const e=this.options,r=!e?.path&&!e?.id;this.parentRoute=this.options?.getParentRoute?.(),r?this.path=nt:s(this.parentRoute);let o=r?nt:e.path;o&&"/"!==o&&(o=C(o));const a=e?.id||o;let n=r?nt:L([this.parentRoute.id===nt?"":this.parentRoute.id,a]);o===nt&&(o="/"),n!==nt&&(n=L(["/",n]));const i=n===nt?"/":L([this.parentRoute.fullPath,o]);this.path=o,this.id=n,this.fullPath=i,this.to=i};addChildren=t=>(this.children=t,this);useMatch=t=>V({...t,from:this.id});useLoader=t=>J({...t,from:this.id});useContext=t=>V({...t,from:this.id}).context;useSearch=t=>G({...t,from:this.id});useParams=t=>Y({...t,from:this.id})}class ct extends it{constructor(t){super(t)}static withRouterContext=()=>t=>new ct(t)}const ht=lt(JSON.parse),ut=dt(JSON.stringify);function lt(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 dt(t){return e=>{(e={...e})&&Object.keys(e).forEach((r=>{const o=e[r];if(void 0===o||void 0===o)delete e[r];else if(o&&"object"==typeof o&&null!==o)try{e[r]=t(o)}catch(t){}}));const r=A(e).toString();return r?`?${r}`:""}}const pt=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 ft="undefined"==typeof window||!window.document.createElement;function mt(){return{status:"idle",latestLocation:null,currentLocation:null,currentMatches:[],lastUpdated:Date.now()}}function yt(t){return!!t?.isRedirect}const gt=["component","errorComponent","pendingComponent"];class vt{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 D({updatedAt:0,routeSearch:{},search:{},status:"idle",loader:void 0},{onUpdate:()=>{this.state=this.__store.state}})}),this.state=this.__store.state,gt.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&&!gt.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:_(r.routeSearch,t),search:_(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(yt(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 yt(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(gt.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(yt(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 yt(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 st(t,e),r??null},t.ErrorComponent=at,t.Link=F,t.MatchRoute=function(t){const e=Q()(t);return e?"function"==typeof t.children?t.children(e):e?t.children:null:null},t.Navigate=function(t){const e=W();return a.useLayoutEffect((()=>{e.navigate(t)}),[]),null},t.Outlet=X,t.RootRoute=ct,t.Route=it,t.RouteMatch=vt,t.Router=class{#a;startedLoadingAt=Date.now();resolveNavigation=()=>{};constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??ut,parseSearch:t?.parseSearch??ht,fetchServerDataFn:t?.fetchServerDataFn??pt},this.__store=new D(mt(),{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,mt())))};mount=()=>(ft||this.state.currentMatches.length||this.safeLoad(),()=>{});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??(ft?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=`/${C(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,debug:!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,s=[])=>{let n,i;if(r.some((r=>{const o=r.children;if(!r.path&&o?.length){const t=a(o,[...s,r]);return!!t&&(n=t,i=void 0,!0)}const c="/"!==r.path||!!o?.length,h=O(this.basepath,t,{to:r.fullPath,fuzzy:c,caseSensitive:r.options.caseSensitive??this.options.caseSensitive});if(h){let t;try{t=r.options.parseParams?.(h)??h}catch(t){if(e?.strictParseParams)throw t}return n=r,i=t,!0}return!1})),!n)return;o.push(...s.map((t=>({route:t}))),{route:n,params:i});const c=n.children;return c?.length?a(c):n};a([this.routeTree]);let s={};return o.map((({route:t,params:e})=>{Object.assign(s,e);const o=k(t.path,s),a=k(t.id,s,!0);return r.find((t=>t.id===a))||new vt(this,t,{id:a,params:s,pathname:L([this.basepath,o])})})).filter(((t,e,r)=>r.findIndex((e=>e.id===t.id))===e))};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(yt(r))throw r;o=o??e;const a=t.route.options.onBeforeLoadError??t.route.options.onError;try{a?.(r)}catch(e){if(yt(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(yt(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)=>R(this.basepath,t,E(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=O(this.basepath,o.pathname,{...e,to:r.pathname});return!!a&&(e?.includeSearch??1?!!S(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)||S(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}};dehydrate=()=>({state:{...v(this.state,["latestLocation","currentLocation","status","lastUpdated"])}});hydrate=async t=>{let e=t;"undefined"!=typeof document&&(e=window.__TSR_DEHYDRATED__),s(e);const r=e;return this.options.hydrate?.(r.payload),this.__store.setState((t=>({...t,...r.router.state}))),await this.load()};#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=x(E(t.path??"/")),o=M(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:_(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=R(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=k(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=_(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=N(t.__store,(t=>t.currentMatches));return a.useEffect(t.mount,[t]),a.createElement(z.Provider,{value:{router:t}},a.createElement(U.Provider,{value:[void 0,...r]},a.createElement(rt,{errorComponent:at,onCatch:()=>{}},a.createElement(X,null))))},t.cleanPath=E,t.createBrowserHistory=d,t.createHashHistory=function(){return d({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=p,t.decode=$,t.defaultFetchServerDataFn=pt,t.defaultParseSearch=ht,t.defaultStringifySearch=ut,t.encode=A,t.functionalUpdate=g,t.interpolatePath=k,t.invariant=s,t.isPlainObject=w,t.isRedirect=yt,t.joinPaths=L,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=j,t.matchPathname=O,t.matchesContext=U,t.parsePathname=M,t.parseSearchWith=lt,t.partialDeepEqual=S,t.pick=v,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=_,t.resolvePath=R,t.rootRouteId=nt,t.routerContext=z,t.stringifySearchWith=dt,t.trimPath=C,t.trimPathLeft=x,t.trimPathRight=P,t.useBlocker=st,t.useLinkProps=B,t.useLoader=J,t.useMatch=V,t.useMatchRoute=Q,t.useMatches=K,t.useNavigate=function(t){const e=W();return a.useCallback((r=>e.navigate({...t,...r})),[])},t.useParams=Y,t.useRouter=q,t.useRouterContext=W,t.useSearch=G,t.useStore=N,t.warning=n,Object.defineProperty(t,"__esModule",{value:!0})}));
*/function N(t,e=(t=>t)){return r.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,H)}function H(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(e,r[o])||!Object.is(t[r[o]],e[r[o]]))return!1;return!0}function B(t){const e=W(),{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:P,onTouchStart:E,...x}=t,R=e.buildLink(t);if("external"===R.type){const{href:t}=R;return{href:t}}const{handleClick:C,handleFocus:L,handleEnter:k,handleLeave:M,handleTouchStart:O,isActive:j,next:A}=R,I=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},$=j?g(n,{})??{}:{},D=j?{}:g(i,{})??{};return{...$,...D,...x,href:h?void 0:A.href,onClick:I([w,t=>{a.startTransition?a.startTransition((()=>{C(t)})):C(t)}]),onFocus:I([b,L]),onMouseEnter:I([S,k]),onMouseLeave:I([P,M]),onTouchStart:I([E,O]),target:s,style:{...v,...$.style,...D.style},className:[_,$.className,D.className].filter(Boolean).join(" ")||void 0,...h?{role:"link","aria-disabled":!0}:void 0,"data-status":j?"active":void 0}}const F=a.forwardRef(((t,e)=>{const r=B(t);return a.createElement("a",D({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),K=a.useDeferredValue||(t=>t);function W(){const t=a.useContext(z);return N(t.router.__store),t.router}function q(t){const e=W();return N(e.__store,t),e}function V(){return a.useContext(U)}function J(t){const e=W(),r=V()[0],o=K(e.state.matches),a=t?.from?o.find((e=>e.route.id===t?.from)):r;return s(a,t?.from&&t.from),(t?.strict??1)&&s(r.route.id==a?.route.id,(a?.route.id,r.route.id,a?.route.id,a?.route.id)),N(a.__store,(e=>t?.track?.(a)??a)),a}function G(t){const{track:e,...r}=t,o=J(r);return N(o.__store,(e=>t?.track?.(e.loader)??e.loader)),o.state.loader}function Y(t){const{track:e,...r}=t??{},o=J(r);return N(o.__store,(e=>t?.track?.(e.search)??e.search)),o.state.search}function Q(t){const e=W();return N(e.__store,(e=>{const r=y(e.matches)?.params;return t?.track?.(r)??r})),y(e.state.matches)?.params}function X(){const t=W();return a.useCallback((e=>{const{pending:r,caseSensitive:o,...a}=e;return t.matchRoute(a,{pending:r,caseSensitive:o})}),[])}function Z(){const t=V().slice(1),e=t[0];return e?a.createElement(tt,{matches:t,match:e}):null}function tt({matches:t,match:e}){const r=W();N(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??!e.route.isRoot?a.Suspense:rt,c=n?ot:rt;return"undefined"==typeof document&&e.state.loader&&Object.keys(e.state.loader).forEach((t=>{let r=e.state.loader[t];(r instanceof Promise||r.then)&&(r={__isPromise:!0,key:t})})),a.createElement(U.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(et,{match:e}))))}function et(t){const e=W();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??Z,{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 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,D({},this.props,{errorState:this.state,reset:()=>this.setState({})}))}}function at(t){const[e,r]=a.useState(t.errorState),o=W(),s=t.errorComponent??st,n=a.useRef("");return a.useEffect((()=>{e&&(o.state.location.key,n.current),n.current=o.state.location.key}),[e,o.state.location.key]),a.useEffect((()=>{t.errorState.error}),[t.errorState.error]),t.errorState.error&&e.error?a.createElement(s,e):t.children}function st({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 nt(t,e=!0){const r=q();a.useEffect((()=>{if(!e)return;let o=r.history.block(((e,r)=>{window.confirm(t)&&(o(),e())}));return o}))}const it="__root__";class ct{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute}init=t=>{this.originalIndex=t.originalIndex,this.router=t.router;const e=this.options,r=!e?.path&&!e?.id;this.parentRoute=this.options?.getParentRoute?.(),r?this.path=it:s(this.parentRoute);let o=r?it:e.path;o&&"/"!==o&&(o=C(o));const a=e?.id||o;let n=r?it:P([this.parentRoute.id===it?"":this.parentRoute.id,a]);o===it&&(o="/"),n!==it&&(n=P(["/",n]));const i=n===it?"/":P([this.parentRoute.fullPath,o]);this.path=o,this.id=n,this.fullPath=i,this.to=i};addChildren=t=>(this.children=t,this);useMatch=t=>J({...t,from:this.id});useLoader=t=>G({...t,from:this.id});useContext=t=>J({...t,from:this.id}).context;useSearch=t=>Y({...t,from:this.id});useParams=t=>Q({...t,from:this.id})}class ht extends ct{constructor(t){super(t)}static withRouterContext=()=>t=>new ht(t)}const ut=dt(JSON.parse),lt=pt(JSON.stringify);function dt(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let r=$(e);for(let e in r){const o=r[e];if("string"==typeof o)try{r[e]=t(o)}catch(t){}}return r}}function pt(t){return e=>{(e={...e})&&Object.keys(e).forEach((r=>{const o=e[r];if(void 0===o||void 0===o)delete e[r];else if(o&&"object"==typeof o&&null!==o)try{e[r]=t(o)}catch(t){}}));const r=A(e).toString();return r?`?${r}`:""}}const ft=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 mt="undefined"==typeof window||!window.document.createElement;function yt(){return{status:"idle",currentLocation:null,location:null,matches:[],lastUpdated:Date.now()}}function gt(t){return!!t?.isRedirect}const vt=["component","errorComponent","pendingComponent"];class _t{abortController=new AbortController;__loadKey={__init:!0};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:"pending",loader:void 0},{onUpdate:()=>{this.state=this.__store.state}})}),this.state=this.__store.state,vt.map((async t=>{const e=this.route.options[t];this[t]=e})),this.__loadPromise=new Promise((t=>{this.__loadPromiseResolve=t})),"pending"!==this.state.status||this.#t()||(this.__store.setState((t=>({...t,status:"success"}))),this.__loadPromiseResolve?.())}#t=()=>!(!this.route.options.loader&&!vt.some((t=>this.route.options[t]?.preload)));__commit=()=>{const{routeSearch:t,search:e,context:r,routeContext:o}=this.#e({location:this.router.state.location});this.context=r,this.routeContext=o,this.__store.setState((r=>({...r,routeSearch:_(r.routeSearch,t),search:_(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(gt(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 gt(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,n={params:this.params,routeSearch:r,search:o,signal:this.abortController.signal,preload:!!t?.preload,routeContext:s,context:a};return this.__loadPromise=Promise.resolve().then((async()=>{const e=""+Date.now()+Math.random();this.#o=e;const r=()=>e!==this.#o?this.__loadPromise:void 0;let o;const a=(async()=>{await Promise.all(vt.map((async t=>{const e=this.route.options[t];e?.preload&&await e.preload()})))})(),s=Promise.resolve().then((()=>{if(this.route.options.loader)return this.route.options.loader(n)}));try{const[t,e]=await Promise.all([a,s]);if(o=r())return await o;this.__store.setState((t=>({...t,error:void 0,status:"success",updatedAt:Date.now(),loader:e})))}catch(e){if(gt(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 gt(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{this.__loadPromiseResolve?.(),delete this.__loadPromise}})),this.__loadPromise};#o=""}t.Block=function({message:t,condition:e,children:r}){return nt(t,e),r??null},t.ErrorComponent=st,t.Link=F,t.MatchRoute=function(t){const e=X()(t);return e?"function"==typeof t.children?t.children(e):e?t.children:null:null},t.Navigate=function(t){const e=W();return a.useLayoutEffect((()=>{e.navigate(t)}),[]),null},t.Outlet=Z,t.RootRoute=ht,t.Route=ct,t.RouteMatch=_t,t.Router=class{#a;startedLoadingAt=Date.now();resolveNavigation=()=>{};constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??lt,parseSearch:t?.parseSearch??ut,fetchServerDataFn:t?.fetchServerDataFn??ft},this.__store=new T(yt(),{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.#s({...e,replace:!0})}reset=()=>{this.__store.setState((t=>Object.assign(t,yt())))};mount=()=>(mt||this.state.matches.length||this.safeLoad(),()=>{});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??(mt?p():d());const t=this.#n();this.__store.setState((e=>({...e,currentLocation:t,location:t}))),this.#a=this.history.listen((()=>{this.safeLoad({next:this.#n(this.state.location)})}))}const{basepath:e,routeTree:r}=this.options;return this.basepath=`/${C(e??"")??""}`,r&&(this.routesById={},this.routeTree=this.#i(r)),this};buildNext=t=>{const e=this.#c(t),r=this.matchRoutes(e.pathname,e.search);return this.#c({...t,__matches:r})};cancelMatches=()=>{[...this.state.matches].forEach((t=>{t.cancel()}))};safeLoad=t=>{this.load(t).catch((t=>{console.warn(t),s(!1)}))};load=async t=>{this.#h();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,location:t.next}))),o=this.matchRoutes(this.state.location.pathname,this.state.location.search,{strictParseParams:!0,debug:!0}),this.__store.setState((t=>({...t,status:"pending",matches:o})))})),await this.loadMatches(o,this.state.location),this.startedLoadingAt!==r)return this.navigationPromise;const a=this.state.matches,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.location;this.__store.setState((t=>({...t,status:"idle",currentLocation:t.location,matches:o}))),o.forEach((t=>{t.__commit()})),c.href!==this.state.location.href&&this.options.onRouteChange?.(),this.resolveNavigation()};getRoute=t=>{const e=this.routesById[t];return s(e),e};loadRoute=async(t=this.state.location)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,e.search,{strictParseParams:!0});return await this.loadMatches(r,e),r};preloadRoute=async(t=this.state.location)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,e.search,{strictParseParams:!0});return await this.loadMatches(r,e,{preload:!0}),r};matchRoutes=(t,e,r)=>{if(!this.routeTree)return[];const o=[...this.state.matches];let a=[];const s=(e,o=[])=>{let n,i;if(e.some((e=>{const a=e.children;if(!e.path&&a?.length){const t=s(a,[...o,e]);return!!t&&(n=t,i=void 0,!0)}const c="/"!==e.path||!!a?.length,h=O(this.basepath,t,{to:e.fullPath,fuzzy:c,caseSensitive:e.options.caseSensitive??this.options.caseSensitive});if(h){let t;try{t=e.options.parseParams?.(h)??h}catch(t){if(r?.strictParseParams)throw t}return n=e,i=t,!0}return!1})),!n)return;a.push(...o.map((t=>({route:t}))),{route:n,params:i});const c=n.children;return c?.length?s(c):n};s([this.routeTree]);let n={};return a.map((({route:t,params:r})=>{Object.assign(n,r);const a=M(t.path,n),s=M(t.id,n,!0)+t.options.getKey?.({params:n,search:e});return o.find((t=>t.id===s))||new _t(this,t,{id:s,params:n,pathname:P([this.basepath,a])})})).filter(((t,e,r)=>r.findIndex((e=>e.id===t.id))===e))};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(gt(r))throw r;o=o??e;const a=t.route.options.onBeforeLoadError??t.route.options.onError;try{a?.(r)}catch(e){if(gt(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(gt(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)=>L(this.basepath,t,E(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);if(e?.pending&&"pending"!==this.state.status)return!1;const o=e?.pending?this.state.location:this.state.currentLocation;if(!o)return!1;const a=O(this.basepath,o.pathname,{...e,to:r.pathname});return!!a&&(e?.includeSearch??1?!!S(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.location.pathname.split("/"),m=d.pathname.split("/").every(((t,e)=>t===f[e])),y=i?.exact?this.state.location.pathname===d.pathname:m,g=!i?.includeHash||this.state.location.hash===d.hash,v=!(i?.includeSearch??1)||S(this.state.location.search,d.search);return{type:"internal",next:d,handleFocus:t=>{c&&this.preloadRoute(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}};dehydrate=()=>({state:{...v(this.state,["location","status","lastUpdated"])}});hydrate=async t=>{let e=t;"undefined"!=typeof document&&(e=window.__TSR_DEHYDRATED__),s(e);const r=e;return this.options.hydrate?.(r.payload),this.__store.setState((t=>({...t,...r.router.state,currentLocation:r.router.state.location}))),await this.load()};#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=x(E(t.path??"/")),o=k(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:_(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.location.pathname:t.from??this.state.location.pathname;let r=L(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=>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.location.search):this.state.location.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=_(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}};#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.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.#h()};#h=()=>{const t=this.resolveNavigation;return this.navigationPromise=new Promise((e=>{this.resolveNavigation=()=>{e(),t()}})),this.navigationPromise}},t.RouterProvider=function({router:t,...e}){t.update(e);const r=K(N(t.__store,(t=>t.matches)));return a.useEffect(t.mount,[t]),a.createElement(z.Provider,{value:{router:t}},a.createElement(U.Provider,{value:[void 0,...r]},a.createElement(ot,{errorComponent:st,onCatch:()=>{}},a.createElement(Z,null))))},t.cleanPath=E,t.createBrowserHistory=d,t.createHashHistory=function(){return d({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=p,t.decode=$,t.defaultFetchServerDataFn=ft,t.defaultParseSearch=ut,t.defaultStringifySearch=lt,t.encode=A,t.functionalUpdate=g,t.interpolatePath=M,t.invariant=s,t.isPlainObject=w,t.isRedirect=gt,t.joinPaths=P,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=j,t.matchPathname=O,t.matchesContext=U,t.parsePathname=k,t.parseSearchWith=dt,t.partialDeepEqual=S,t.pick=v,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=_,t.resolvePath=L,t.rootRouteId=it,t.routerContext=z,t.stringifySearchWith=pt,t.trimPath=C,t.trimPathLeft=x,t.trimPathRight=R,t.useBlocker=nt,t.useLinkProps=B,t.useLoader=G,t.useMatch=J,t.useMatchRoute=X,t.useMatches=V,t.useNavigate=function(t){const e=W();return a.useCallback((r=>e.navigate({...t,...r})),[])},t.useParams=Q,t.useRouter=q,t.useRouterContext=W,t.useSearch=Y,t.useStore=N,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.107",
"version": "0.0.1-beta.108",
"license": "MIT",

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

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

}): RouterHistory {
let currentLocation = opts.getLocation()
let location = opts.getLocation()
let unsub = () => {}

@@ -84,3 +84,3 @@ let listeners = new Set<() => void>()

const onUpdate = () => {
currentLocation = opts.getLocation()
location = opts.getLocation()
listeners.forEach((listener) => listener())

@@ -91,3 +91,3 @@ }

get location() {
return currentLocation
return location
},

@@ -94,0 +94,0 @@ listen: (cb: () => void) => {

@@ -155,3 +155,3 @@ import { AnyPathParams } from './route'

const pathParams = matchByPath(basepath, currentPathname, matchLocation)
// const searchMatched = matchBySearch(currentLocation.search, matchLocation)
// const searchMatched = matchBySearch(location.search, matchLocation)

@@ -158,0 +158,0 @@ if (matchLocation.to && !pathParams) {

@@ -194,2 +194,12 @@ import { ParsePathParams } from './link'

getParentRoute: () => TParentRoute
// Optionally call this function to get a unique key for this route.
// This is useful for routes that need to be uniquely identified
// by more than their by search params
getKey?: OnLoadFnKey<
TSearchSchema,
TFullSearchSchema,
TAllParams,
NoInfer<TRouteContext>,
TContext
>
// If true, this route will be matched as case-sensitive

@@ -366,2 +376,22 @@ caseSensitive?: boolean

export type OnLoadFnKey<
TSearchSchema extends AnySearchSchema = {},
TFullSearchSchema extends AnySearchSchema = {},
TAllParams = {},
TContext extends AnyContext = AnyContext,
TAllContext extends AnyContext = AnyContext,
> = (
loaderContext: {
params: TAllParams
search: TFullSearchSchema
},
// loaderContext: LoaderContext<
// TSearchSchema,
// TFullSearchSchema,
// TAllParams,
// TContext,
// TAllContext
// >,
) => any
export interface LoaderContext<

@@ -381,2 +411,10 @@ TSearchSchema extends AnySearchSchema = {},

context: TAllContext
// serverOnly: <
// TServer extends object | (() => object),
// TClient extends object | (() => object),
// >(
// server: TServer,
// client: TClient,
// ) => (TServer extends () => infer TReturn ? TReturn : TServer) &
// (TClient extends () => infer TReturn ? TReturn : TClient)
}

@@ -383,0 +421,0 @@

@@ -16,3 +16,3 @@ import { Store } from '@tanstack/react-store'

TRoute['__types']['fullSearchSchema']
status: 'idle' | 'pending' | 'success' | 'error'
status: 'pending' | 'success' | 'error'
error?: unknown

@@ -68,3 +68,5 @@ updatedAt: number

__loadKey: any = { __init: true }
__loadPromise?: Promise<void>
__loadPromiseResolve?: () => void
__onExit?:

@@ -97,3 +99,3 @@ | void

search: {} as any,
status: 'idle',
status: 'pending',
loader: undefined,

@@ -117,3 +119,7 @@ },

if (this.state.status === 'idle' && !this.#hasLoaders()) {
this.__loadPromise = new Promise((r) => {
this.__loadPromiseResolve = r
})
if (this.state.status === 'pending' && !this.#hasLoaders()) {
this.__store.setState((s) => ({

@@ -123,2 +129,3 @@ ...s,

}))
this.__loadPromiseResolve?.()
}

@@ -136,3 +143,3 @@ }

const { routeSearch, search, context, routeContext } = this.#resolveInfo({
location: this.router.state.currentLocation,
location: this.router.state.location,
})

@@ -255,7 +262,24 @@ this.context = context

// If the match is invalid, errored or idle, trigger it to load
if (this.state.status === 'pending') {
return
const loaderOpts = {
params: this.params,
routeSearch,
search,
signal: this.abortController.signal,
preload: !!opts?.preload,
routeContext,
context,
}
// If getKey is set, we can skip the loader if the key is the same
// if (this.route.options.getKey) {
// const prevKey = this.__loadKey
// this.__loadKey = this.route.options.getKey?.(loaderOpts)
// if (
// !opts.preload &&
// JSON.stringify(prevKey) === JSON.stringify(this.__loadKey)
// ) {
// return
// }
this.__loadPromise = Promise.resolve().then(async () => {

@@ -271,12 +295,2 @@ const loadId = '' + Date.now() + Math.random()

// If the match was in an error state, set it
// to a loading state again. Otherwise, keep it
// as loading or resolved
if (this.state.status === 'idle') {
this.__store.setState((s) => ({
...s,
status: 'pending',
}))
}
const componentsPromise = (async () => {

@@ -299,11 +313,3 @@ // then run all component and data loaders in parallel

if (this.route.options.loader) {
return this.route.options.loader({
params: this.params,
routeSearch,
search,
signal: this.abortController.signal,
preload: !!opts?.preload,
routeContext: routeContext,
context: context,
})
return this.route.options.loader(loaderOpts)
}

@@ -362,2 +368,3 @@ return

} finally {
this.__loadPromiseResolve?.()
delete this.__loadPromise

@@ -364,0 +371,0 @@ }

@@ -157,7 +157,5 @@ import { Store } from '@tanstack/react-store'

status: 'idle' | 'pending'
latestLocation: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>
currentMatches: RouteMatch<TRoutesInfo, TRoutesInfo['routeIntersection']>[]
matches: RouteMatch<TRoutesInfo, TRoutesInfo['routeIntersection']>[]
location: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>
currentLocation: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>
pendingMatches?: RouteMatch<TRoutesInfo, TRoutesInfo['routeIntersection']>[]
pendingLocation?: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>
lastUpdated: number

@@ -205,8 +203,3 @@ }

export interface DehydratedRouterState
extends Pick<
RouterState,
'status' | 'latestLocation' | 'currentLocation' | 'lastUpdated'
> {
// currentMatches: DehydratedRouteMatch[]
}
extends Pick<RouterState, 'status' | 'location' | 'lastUpdated'> {}

@@ -316,3 +309,3 @@ export interface DehydratedRouter {

if (this.state.latestLocation.href !== next.href) {
if (this.state.location.href !== next.href) {
this.#commitLocation({ ...next, replace: true })

@@ -330,3 +323,3 @@ }

// If the router matches are empty, start loading the matches
if (!this.state.currentMatches.length) {
if (!this.state.matches.length) {
this.safeLoad()

@@ -360,4 +353,4 @@ }

...s,
latestLocation: parsedLocation,
currentLocation: parsedLocation,
location: parsedLocation,
}))

@@ -367,3 +360,3 @@

this.safeLoad({
next: this.#parseLocation(this.state.latestLocation),
next: this.#parseLocation(this.state.location),
})

@@ -388,3 +381,3 @@ })

const __matches = this.matchRoutes(next.pathname)
const __matches = this.matchRoutes(next.pathname, next.search)

@@ -398,6 +391,3 @@ return this.#buildLocation({

cancelMatches = () => {
;[
...this.state.currentMatches,
...(this.state.pendingMatches || []),
].forEach((match) => {
;[...this.state.matches].forEach((match) => {
match.cancel()

@@ -415,2 +405,4 @@ })

load = async (opts?: { next?: ParsedLocation }): Promise<void> => {
this.#createNavigationPromise()
let now = Date.now()

@@ -430,3 +422,3 @@ const startedAt = now

...s,
latestLocation: opts.next!,
location: opts.next!,
}))

@@ -436,6 +428,10 @@ }

// Match the routes
matches = this.matchRoutes(this.state.latestLocation.pathname, {
strictParseParams: true,
debug: true,
})
matches = this.matchRoutes(
this.state.location.pathname,
this.state.location.search,
{
strictParseParams: true,
debug: true,
},
)

@@ -445,4 +441,3 @@ this.__store.setState((s) => ({

status: 'pending',
pendingMatches: matches,
pendingLocation: this.state.latestLocation,
matches: matches,
}))

@@ -452,7 +447,3 @@ })

// Load the matches
await this.loadMatches(
matches,
this.state.pendingLocation!,
// opts
)
await this.loadMatches(matches, this.state.location)

@@ -464,3 +455,3 @@ if (this.startedLoadingAt !== startedAt) {

const previousMatches = this.state.currentMatches
const previousMatches = this.state.matches

@@ -514,3 +505,3 @@ const exiting: AnyRouteMatch[] = [],

const prevLocation = this.state.currentLocation
const prevLocation = this.state.location

@@ -520,6 +511,4 @@ this.__store.setState((s) => ({

status: 'idle',
currentLocation: this.state.latestLocation,
currentMatches: matches,
pendingLocation: undefined,
pendingMatches: undefined,
currentLocation: s.location,
matches: matches,
}))

@@ -531,3 +520,3 @@

if (prevLocation!.href !== this.state.currentLocation.href) {
if (prevLocation!.href !== this.state.location.href) {
this.options.onRouteChange?.()

@@ -550,6 +539,6 @@ }

loadRoute = async (
navigateOpts: BuildNextOptions = this.state.latestLocation,
navigateOpts: BuildNextOptions = this.state.location,
): Promise<RouteMatch[]> => {
const next = this.buildNext(navigateOpts)
const matches = this.matchRoutes(next.pathname, {
const matches = this.matchRoutes(next.pathname, next.search, {
strictParseParams: true,

@@ -562,6 +551,6 @@ })

preloadRoute = async (
navigateOpts: BuildNextOptions = this.state.latestLocation,
navigateOpts: BuildNextOptions = this.state.location,
) => {
const next = this.buildNext(navigateOpts)
const matches = this.matchRoutes(next.pathname, {
const matches = this.matchRoutes(next.pathname, next.search, {
strictParseParams: true,

@@ -578,2 +567,3 @@ })

pathname: string,
search: AnySearchSchema,
opts?: { strictParseParams?: boolean; debug?: boolean },

@@ -588,6 +578,3 @@ ): RouteMatch[] => {

// pending matches that are still loading
const existingMatches = [
...this.state.currentMatches,
...(this.state.pendingMatches ?? []),
]
const existingMatches = [...this.state.matches]

@@ -706,3 +693,8 @@ // We need to "flatten" layout routes, but only process as many

const interpolatedPath = interpolatePath(route.path, allParams)
const matchId = interpolatePath(route.id, allParams, true)
const matchId =
interpolatePath(route.id, allParams, true) +
route.options.getKey?.({
params: allParams,
search,
})

@@ -876,4 +868,8 @@ // Waste not, want not. If we already have a match for this route,

const next = this.buildNext(location)
if (opts?.pending && this.state.status !== 'pending') {
return false
}
const baseLocation = opts?.pending
? this.state.pendingLocation
? this.state.location
: this.state.currentLocation

@@ -944,3 +940,3 @@

// Compare path/hash for matches
const currentPathSplit = this.state.currentLocation.pathname.split('/')
const currentPathSplit = this.state.location.pathname.split('/')
const nextPathSplit = next.pathname.split('/')

@@ -952,10 +948,10 @@ const pathIsFuzzyEqual = nextPathSplit.every(

const pathTest = activeOptions?.exact
? this.state.currentLocation.pathname === next.pathname
? this.state.location.pathname === next.pathname
: pathIsFuzzyEqual
const hashTest = activeOptions?.includeHash
? this.state.currentLocation.hash === next.hash
? this.state.location.hash === next.hash
: true
const searchTest =
activeOptions?.includeSearch ?? true
? partialDeepEqual(this.state.currentLocation.search, next.search)
? partialDeepEqual(this.state.location.search, next.search)
: true

@@ -1042,8 +1038,3 @@

state: {
...pick(this.state, [
'latestLocation',
'currentLocation',
'status',
'lastUpdated',
]),
...pick(this.state, ['location', 'status', 'lastUpdated']),
},

@@ -1073,2 +1064,3 @@ }

...ctx.router.state,
currentLocation: ctx.router.state.location,
}

@@ -1207,4 +1199,4 @@ })

const fromPathname = dest.fromCurrent
? this.state.latestLocation.pathname
: dest.from ?? this.state.latestLocation.pathname
? this.state.location.pathname
: dest.from ?? this.state.location.pathname

@@ -1217,5 +1209,9 @@ let pathname = resolvePath(

const fromMatches = this.matchRoutes(this.state.latestLocation.pathname, {
strictParseParams: true,
})
const fromMatches = this.matchRoutes(
this.state.location.pathname,
this.state.location.search,
{
strictParseParams: true,
},
)

@@ -1256,5 +1252,5 @@ const prevParams = { ...last(fromMatches)?.params }

(prev, next) => next(prev),
this.state.latestLocation.search,
this.state.location.search,
)
: this.state.latestLocation.search
: this.state.location.search

@@ -1277,3 +1273,3 @@ // Then the link/navigate function

const search = replaceEqualDeep(
this.state.latestLocation.search,
this.state.location.search,
postFilteredSearch,

@@ -1286,4 +1282,4 @@ )

dest.hash === true
? this.state.latestLocation.hash
: functionalUpdate(dest.hash!, this.state.latestLocation.hash)
? this.state.location.hash
: functionalUpdate(dest.hash!, this.state.location.hash)

@@ -1294,4 +1290,4 @@ const hashStr = hash ? `#${hash}` : ''

dest.state === true
? this.state.latestLocation.state
: functionalUpdate(dest.state, this.state.latestLocation.state)!
? this.state.location.state
: functionalUpdate(dest.state, this.state.location.state)!

@@ -1323,3 +1319,3 @@ return {

const isSameUrl = this.state.latestLocation.href === next.href
const isSameUrl = this.state.location.href === next.href

@@ -1339,10 +1335,16 @@ if (isSameUrl && !next.key) {

return (this.navigationPromise = new Promise((resolve) => {
const previousNavigationResolve = this.resolveNavigation
return this.#createNavigationPromise()
}
#createNavigationPromise = () => {
const previousNavigationResolve = this.resolveNavigation
this.navigationPromise = new Promise((resolve) => {
this.resolveNavigation = () => {
resolve()
previousNavigationResolve()
resolve()
}
}))
})
return this.navigationPromise
}

@@ -1357,5 +1359,5 @@ }

status: 'idle',
latestLocation: null!,
currentLocation: null!,
currentMatches: [],
location: null!,
matches: [],
lastUpdated: Date.now(),

@@ -1362,0 +1364,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc