@tanstack/react-router 1.47.4 → 1.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -93,66 +93,25 @@ const Match = React__namespace.memo(function MatchImpl({
93
93
  const MatchInner = React__namespace.memo(function MatchInnerImpl({
94
94
  matchId
95
95
  }) {
96
- var _a, _b;
96
+ var _a, _b, _c;
97
97
  const router = useRouter.useRouter();
98
- const routeId = useRouterState.useRouterState({
98
+ const { match, matchIndex, routeId } = useRouterState.useRouterState({
99
99
  select: (s) => {
100
- var _a2;
101
- return (_a2 = s.matches.find((d) => d.id === matchId)) == null ? void 0 : _a2.routeId;
100
+ const matchIndex2 = s.matches.findIndex((d) => d.id === matchId);
101
+ const match2 = s.matches[matchIndex2];
102
+ const routeId2 = match2.routeId;
103
+ return {
104
+ routeId: routeId2,
105
+ matchIndex: matchIndex2,
106
+ match: utils.pick(match2, ["id", "status", "error", "loadPromise"])
107
+ };
102
108
  }
103
109
  });
104
110
  const route = router.routesById[routeId];
105
- const matchIndex = useRouterState.useRouterState({
106
- select: (s) => {
107
- return s.matches.findIndex((d) => d.id === matchId);
108
- }
109
- });
110
- const match = useRouterState.useRouterState({
111
- select: (s) => {
112
- const match2 = s.matches[matchIndex];
113
- return utils.pick(match2, [
114
- "id",
115
- "status",
116
- "error",
117
- "loadPromise",
118
- "minPendingPromise"
119
- ]);
120
- }
121
- });
122
111
  const out = React__namespace.useMemo(() => {
123
112
  const Comp = route.options.component ?? router.options.defaultComponent;
124
113
  return Comp ? /* @__PURE__ */ jsxRuntime.jsx(Comp, {}, routeId) : /* @__PURE__ */ jsxRuntime.jsx(Outlet, {});
125
114
  }, [routeId, route.options.component, router.options.defaultComponent]);
126
- React__namespace.useEffect(() => {
127
- if (match.status === "pending") {
128
- const pendingMinMs = route.options.pendingMinMs ?? router.options.defaultPendingMinMs;
129
- if (pendingMinMs && !match.minPendingPromise) {
130
- if (!router.isServer) {
131
- const minPendingPromise = utils.createControlledPromise();
132
- router.updateMatch(match.id, (prev) => ({
133
- ...prev,
134
- minPendingPromise
135
- }));
136
- const id = setTimeout(() => {
137
- minPendingPromise.resolve();
138
- router.updateMatch(match.id, (prev) => ({
139
- ...prev,
140
- minPendingPromise: void 0
141
- }));
142
- }, pendingMinMs);
143
- return () => clearTimeout(id);
144
- }
145
- }
146
- }
147
- return void 0;
148
- }, [
149
- match.id,
150
- match.loadPromise,
151
- match.minPendingPromise,
152
- match.status,
153
- route.options.pendingMinMs,
154
- router
155
- ]);
156
115
  const RouteErrorComponent = (route.options.errorComponent ?? router.options.defaultErrorComponent) || CatchBoundary.ErrorComponent;
157
116
  if (match.status === "notFound") {
158
117
  let error;
@@ -189,6 +148,25 @@ const MatchInner = React__namespace.memo(function MatchInnerImpl({
189
148
  }
190
149
  }
191
150
  if (match.status === "pending") {
151
+ const pendingMinMs = route.options.pendingMinMs ?? router.options.defaultPendingMinMs;
152
+ if (pendingMinMs && !((_c = router.getMatch(match.id)) == null ? void 0 : _c.minPendingPromise)) {
153
+ if (!router.isServer) {
154
+ const minPendingPromise = utils.createControlledPromise();
155
+ Promise.resolve().then(() => {
156
+ router.updateMatch(match.id, (prev) => ({
157
+ ...prev,
158
+ minPendingPromise
159
+ }));
160
+ });
161
+ setTimeout(() => {
162
+ minPendingPromise.resolve();
163
+ router.updateMatch(match.id, (prev) => ({
164
+ ...prev,
165
+ minPendingPromise: void 0
166
+ }));
167
+ }, pendingMinMs);
168
+ }
169
+ }
192
170
  throw match.loadPromise;
193
171
  }
194
172
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -1 +1 @@
1
- {"version":3,"file":"Match.cjs","sources":["../../src/Match.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport { createControlledPromise, pick } from './utils'\nimport { CatchNotFound, isNotFound } from './not-found'\nimport { isRedirect } from './redirects'\nimport { matchContext } from './matchContext'\nimport { defaultDeserializeError, isServerSideError } from './isServerSideError'\nimport { SafeFragment } from './SafeFragment'\nimport { renderRouteNotFound } from './renderRouteNotFound'\nimport { rootRouteId } from './root'\nimport type { AnyRoute } from './route'\n\nexport const Match = React.memo(function MatchImpl({\n matchId,\n}: {\n matchId: string\n}) {\n const router = useRouter()\n const routeId = useRouterState({\n select: (s) => s.matches.find((d) => d.id === matchId)?.routeId as string,\n })\n\n invariant(\n routeId,\n `Could not find routeId for matchId \"${matchId}\". Please file an issue!`,\n )\n\n const route: AnyRoute = router.routesById[routeId]\n\n const PendingComponent =\n route.options.pendingComponent ?? router.options.defaultPendingComponent\n\n const pendingElement = PendingComponent ? <PendingComponent /> : null\n\n const routeErrorComponent =\n route.options.errorComponent ?? router.options.defaultErrorComponent\n\n const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch\n\n const routeNotFoundComponent = route.isRoot\n ? // If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component\n (route.options.notFoundComponent ??\n router.options.notFoundRoute?.options.component)\n : route.options.notFoundComponent\n\n const ResolvedSuspenseBoundary =\n // If we're on the root route, allow forcefully wrapping in suspense\n (!route.isRoot || route.options.wrapInSuspense) &&\n (route.options.wrapInSuspense ??\n PendingComponent ??\n (route.options.errorComponent as any)?.preload)\n ? React.Suspense\n : SafeFragment\n\n const ResolvedCatchBoundary = routeErrorComponent\n ? CatchBoundary\n : SafeFragment\n\n const ResolvedNotFoundBoundary = routeNotFoundComponent\n ? CatchNotFound\n : SafeFragment\n\n const resetKey = useRouterState({\n select: (s) => s.loadedAt,\n })\n\n return (\n <matchContext.Provider value={matchId}>\n <ResolvedSuspenseBoundary fallback={pendingElement}>\n <ResolvedCatchBoundary\n getResetKey={() => resetKey}\n errorComponent={routeErrorComponent || ErrorComponent}\n onCatch={(error, errorInfo) => {\n // Forward not found errors (we don't want to show the error component for these)\n if (isNotFound(error)) throw error\n warning(false, `Error in route match: ${matchId}`)\n routeOnCatch?.(error, errorInfo)\n }}\n >\n <ResolvedNotFoundBoundary\n fallback={(error) => {\n // If the current not found handler doesn't exist or it has a\n // route ID which doesn't match the current route, rethrow the error\n if (\n !routeNotFoundComponent ||\n (error.routeId && error.routeId !== routeId) ||\n (!error.routeId && !route.isRoot)\n )\n throw error\n\n return React.createElement(routeNotFoundComponent, error as any)\n }}\n >\n <MatchInner matchId={matchId} />\n </ResolvedNotFoundBoundary>\n </ResolvedCatchBoundary>\n </ResolvedSuspenseBoundary>\n </matchContext.Provider>\n )\n})\n\nexport const MatchInner = React.memo(function MatchInnerImpl({\n matchId,\n}: {\n matchId: string\n}): any {\n const router = useRouter()\n const routeId = useRouterState({\n select: (s) => s.matches.find((d) => d.id === matchId)?.routeId as string,\n })\n\n const route = router.routesById[routeId]!\n\n const matchIndex = useRouterState({\n select: (s) => {\n return s.matches.findIndex((d) => d.id === matchId)\n },\n })\n\n const match = useRouterState({\n select: (s) => {\n const match = s.matches[matchIndex]!\n return pick(match, [\n 'id',\n 'status',\n 'error',\n 'loadPromise',\n 'minPendingPromise',\n ])\n },\n })\n\n const out = React.useMemo(() => {\n const Comp = route.options.component ?? router.options.defaultComponent\n return Comp ? <Comp key={routeId} /> : <Outlet />\n }, [routeId, route.options.component, router.options.defaultComponent])\n\n React.useEffect(() => {\n if (match.status === 'pending') {\n // We're pending, and if we have a minPendingMs, we need to wait for it\n const pendingMinMs =\n route.options.pendingMinMs ?? router.options.defaultPendingMinMs\n\n if (pendingMinMs && !match.minPendingPromise) {\n // Create a promise that will resolve after the minPendingMs\n if (!router.isServer) {\n const minPendingPromise = createControlledPromise<void>()\n\n router.updateMatch(match.id, (prev) => ({\n ...prev,\n minPendingPromise,\n }))\n\n const id = setTimeout(() => {\n minPendingPromise.resolve()\n\n // We've handled the minPendingPromise, so we can delete it\n router.updateMatch(match.id, (prev) => ({\n ...prev,\n minPendingPromise: undefined,\n }))\n }, pendingMinMs)\n return () => clearTimeout(id)\n }\n }\n }\n return undefined\n }, [\n match.id,\n match.loadPromise,\n match.minPendingPromise,\n match.status,\n route.options.pendingMinMs,\n router,\n ])\n\n // function useChangedDiff(value: any) {\n // const ref = React.useRef(value)\n // const changed = ref.current !== value\n // if (changed) {\n // console.log(\n // 'Changed:',\n // value,\n // Object.fromEntries(\n // Object.entries(value).filter(\n // ([key, val]) => val !== ref.current[key],\n // ),\n // ),\n // )\n // }\n // ref.current = value\n // }\n\n // useChangedDiff(match)\n\n const RouteErrorComponent =\n (route.options.errorComponent ?? router.options.defaultErrorComponent) ||\n ErrorComponent\n\n if (match.status === 'notFound') {\n let error: unknown\n if (isServerSideError(match.error)) {\n const deserializeError =\n router.options.errorSerializer?.deserialize ?? defaultDeserializeError\n\n error = deserializeError(match.error.data)\n } else {\n error = match.error\n }\n\n invariant(isNotFound(error), 'Expected a notFound error')\n\n return renderRouteNotFound(router, route, error)\n }\n\n if (match.status === 'redirected') {\n // Redirects should be handled by the router transition. If we happen to\n // encounter a redirect here, it's a bug. Let's warn, but render nothing.\n invariant(isRedirect(match.error), 'Expected a redirect error')\n\n // warning(\n // false,\n // 'Tried to render a redirected route match! This is a weird circumstance, please file an issue!',\n // )\n throw match.loadPromise\n }\n\n if (match.status === 'error') {\n // If we're on the server, we need to use React's new and super\n // wonky api for throwing errors from a server side render inside\n // of a suspense boundary. This is the only way to get\n // renderToPipeableStream to not hang indefinitely.\n // We'll serialize the error and rethrow it on the client.\n if (router.isServer) {\n return (\n <RouteErrorComponent\n error={match.error}\n info={{\n componentStack: '',\n }}\n />\n )\n }\n\n if (isServerSideError(match.error)) {\n const deserializeError =\n router.options.errorSerializer?.deserialize ?? defaultDeserializeError\n throw deserializeError(match.error.data)\n } else {\n throw match.error\n }\n }\n\n if (match.status === 'pending') {\n throw match.loadPromise\n }\n\n return (\n <>\n {out}\n {router.AfterEachMatch ? (\n <router.AfterEachMatch match={match} matchIndex={matchIndex} />\n ) : null}\n </>\n )\n})\n\nexport const Outlet = React.memo(function OutletImpl() {\n const router = useRouter()\n const matchId = React.useContext(matchContext)\n const routeId = useRouterState({\n select: (s) => s.matches.find((d) => d.id === matchId)?.routeId as string,\n })\n\n const route = router.routesById[routeId]!\n\n const { parentGlobalNotFound } = useRouterState({\n select: (s) => {\n const matches = s.matches\n const parentMatch = matches.find((d) => d.id === matchId)\n invariant(\n parentMatch,\n `Could not find parent match for matchId \"${matchId}\"`,\n )\n return {\n parentGlobalNotFound: parentMatch.globalNotFound,\n }\n },\n })\n\n const childMatchId = useRouterState({\n select: (s) => {\n const matches = s.matches\n const index = matches.findIndex((d) => d.id === matchId)\n return matches[index + 1]?.id\n },\n })\n\n if (parentGlobalNotFound) {\n return renderRouteNotFound(router, route, undefined)\n }\n\n if (!childMatchId) {\n return null\n }\n\n const nextMatch = <Match matchId={childMatchId} />\n\n const pendingElement = router.options.defaultPendingComponent ? (\n <router.options.defaultPendingComponent />\n ) : null\n\n if (matchId === rootRouteId) {\n return (\n <React.Suspense fallback={pendingElement}>{nextMatch}</React.Suspense>\n )\n }\n\n return nextMatch\n})\n"],"names":["match","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO;AAA4C;AAEnD;;AAGE;AACA;AAA+B;;AACd;AAAyC;AAAA;AAG1D;AAAA;AACE;AAC8C;AAG1C;AAEN;AAGA;AAEA;AAGA;AAEA;AAAqC;AAAA;AAGK;AAGpC;AAAA;AAAA;AAOA;AAEA;AAIA;AAIN;AAAgC;AACb;AAIjB;AAEI;AAAC;AAAA;AACoB;AACoB;AAGjC;AACI;AACR;AAAsB;AACxB;AAEA;AAAC;AAAA;AAKK;AAIM;AAED;AAAwD;AACjE;AAE8B;AAAA;AAChC;AAAA;AAKV;AAEO;AAAsD;AAE7D;;AAGE;AACA;AAA+B;;AACd;AAAyC;AAAA;AAGpD;AAEN;AAAkC;AAE9B;AAAkD;AACpD;AAGF;AAA6B;AAEnBA;AACN;AAAmB;AACjB;AACA;AACA;AACA;AACA;AACD;AACH;AAGI;AACJ;AACA;AAA+C;AAGjDC;AACM;AAEF;AAGI;AAEE;AACF;AAEA;AAAwC;AACnC;AACH;AAGI;AACJ;AAGA;AAAwC;AACnC;AACgB;AACnB;AAEG;AAAqB;AAC9B;AACF;AAEK;AAAA;AACN;AACK;AACA;AACA;AACA;AACQ;AACd;AAsBF;AAII;AACE;AACA;AACF;AAGQ;AAAiC;AAEzC;AAAc;AAGN;AAEH;AAAwC;AAG7C;AAGF;AAMA;AAAY;AAGV;AAMF;AAEI;AAAA;AAAC;AAAA;AACc;AACP;AACY;AAClB;AAAA;AAAA;AAKF;AACF;AAEM;AAAiC;AAEvC;AAAY;AACd;AAGE;AACF;AAAY;AAGd;AAEK;AAAA;AAGG;AAGV;AAEO;AACL;AACM;AACN;AAA+B;;AACd;AAAyC;AAAA;AAGpD;AAEA;AAA0C;AAE5C;AACA;AACA;AAAA;AACE;AACmD;AAE9C;AAAA;AAC6B;AAAA;AAEtC;AAGF;AAAoC;;AAEhC;AACA;AACO;AAAoB;AAC7B;AAGF;AACS;AAA4C;AAGrD;AACS;AAAA;AAGT;AAEM;AAIN;AACE;AACuD;AAIlD;AACT;;;;"}
1
+ {"version":3,"file":"Match.cjs","sources":["../../src/Match.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport { createControlledPromise, pick } from './utils'\nimport { CatchNotFound, isNotFound } from './not-found'\nimport { isRedirect } from './redirects'\nimport { matchContext } from './matchContext'\nimport { defaultDeserializeError, isServerSideError } from './isServerSideError'\nimport { SafeFragment } from './SafeFragment'\nimport { renderRouteNotFound } from './renderRouteNotFound'\nimport { rootRouteId } from './root'\nimport type { AnyRoute } from './route'\n\nexport const Match = React.memo(function MatchImpl({\n matchId,\n}: {\n matchId: string\n}) {\n const router = useRouter()\n const routeId = useRouterState({\n select: (s) => s.matches.find((d) => d.id === matchId)?.routeId as string,\n })\n\n invariant(\n routeId,\n `Could not find routeId for matchId \"${matchId}\". Please file an issue!`,\n )\n\n const route: AnyRoute = router.routesById[routeId]\n\n const PendingComponent =\n route.options.pendingComponent ?? router.options.defaultPendingComponent\n\n const pendingElement = PendingComponent ? <PendingComponent /> : null\n\n const routeErrorComponent =\n route.options.errorComponent ?? router.options.defaultErrorComponent\n\n const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch\n\n const routeNotFoundComponent = route.isRoot\n ? // If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component\n (route.options.notFoundComponent ??\n router.options.notFoundRoute?.options.component)\n : route.options.notFoundComponent\n\n const ResolvedSuspenseBoundary =\n // If we're on the root route, allow forcefully wrapping in suspense\n (!route.isRoot || route.options.wrapInSuspense) &&\n (route.options.wrapInSuspense ??\n PendingComponent ??\n (route.options.errorComponent as any)?.preload)\n ? React.Suspense\n : SafeFragment\n\n const ResolvedCatchBoundary = routeErrorComponent\n ? CatchBoundary\n : SafeFragment\n\n const ResolvedNotFoundBoundary = routeNotFoundComponent\n ? CatchNotFound\n : SafeFragment\n\n const resetKey = useRouterState({\n select: (s) => s.loadedAt,\n })\n\n return (\n <matchContext.Provider value={matchId}>\n <ResolvedSuspenseBoundary fallback={pendingElement}>\n <ResolvedCatchBoundary\n getResetKey={() => resetKey}\n errorComponent={routeErrorComponent || ErrorComponent}\n onCatch={(error, errorInfo) => {\n // Forward not found errors (we don't want to show the error component for these)\n if (isNotFound(error)) throw error\n warning(false, `Error in route match: ${matchId}`)\n routeOnCatch?.(error, errorInfo)\n }}\n >\n <ResolvedNotFoundBoundary\n fallback={(error) => {\n // If the current not found handler doesn't exist or it has a\n // route ID which doesn't match the current route, rethrow the error\n if (\n !routeNotFoundComponent ||\n (error.routeId && error.routeId !== routeId) ||\n (!error.routeId && !route.isRoot)\n )\n throw error\n\n return React.createElement(routeNotFoundComponent, error as any)\n }}\n >\n <MatchInner matchId={matchId} />\n </ResolvedNotFoundBoundary>\n </ResolvedCatchBoundary>\n </ResolvedSuspenseBoundary>\n </matchContext.Provider>\n )\n})\n\nexport const MatchInner = React.memo(function MatchInnerImpl({\n matchId,\n}: {\n matchId: string\n}): any {\n const router = useRouter()\n\n const { match, matchIndex, routeId } = useRouterState({\n select: (s) => {\n const matchIndex = s.matches.findIndex((d) => d.id === matchId)\n const match = s.matches[matchIndex]!\n const routeId = match.routeId as string\n return {\n routeId,\n matchIndex,\n match: pick(match, ['id', 'status', 'error', 'loadPromise']),\n }\n },\n })\n\n const route = router.routesById[routeId]!\n\n const out = React.useMemo(() => {\n const Comp = route.options.component ?? router.options.defaultComponent\n return Comp ? <Comp key={routeId} /> : <Outlet />\n }, [routeId, route.options.component, router.options.defaultComponent])\n\n // function useChangedDiff(value: any) {\n // const ref = React.useRef(value)\n // const changed = ref.current !== value\n // if (changed) {\n // console.log(\n // 'Changed:',\n // value,\n // Object.fromEntries(\n // Object.entries(value).filter(\n // ([key, val]) => val !== ref.current[key],\n // ),\n // ),\n // )\n // }\n // ref.current = value\n // }\n\n // useChangedDiff(match)\n\n const RouteErrorComponent =\n (route.options.errorComponent ?? router.options.defaultErrorComponent) ||\n ErrorComponent\n\n if (match.status === 'notFound') {\n let error: unknown\n if (isServerSideError(match.error)) {\n const deserializeError =\n router.options.errorSerializer?.deserialize ?? defaultDeserializeError\n\n error = deserializeError(match.error.data)\n } else {\n error = match.error\n }\n\n invariant(isNotFound(error), 'Expected a notFound error')\n\n return renderRouteNotFound(router, route, error)\n }\n\n if (match.status === 'redirected') {\n // Redirects should be handled by the router transition. If we happen to\n // encounter a redirect here, it's a bug. Let's warn, but render nothing.\n invariant(isRedirect(match.error), 'Expected a redirect error')\n\n // warning(\n // false,\n // 'Tried to render a redirected route match! This is a weird circumstance, please file an issue!',\n // )\n throw match.loadPromise\n }\n\n if (match.status === 'error') {\n // If we're on the server, we need to use React's new and super\n // wonky api for throwing errors from a server side render inside\n // of a suspense boundary. This is the only way to get\n // renderToPipeableStream to not hang indefinitely.\n // We'll serialize the error and rethrow it on the client.\n if (router.isServer) {\n return (\n <RouteErrorComponent\n error={match.error}\n info={{\n componentStack: '',\n }}\n />\n )\n }\n\n if (isServerSideError(match.error)) {\n const deserializeError =\n router.options.errorSerializer?.deserialize ?? defaultDeserializeError\n throw deserializeError(match.error.data)\n } else {\n throw match.error\n }\n }\n\n if (match.status === 'pending') {\n // We're pending, and if we have a minPendingMs, we need to wait for it\n const pendingMinMs =\n route.options.pendingMinMs ?? router.options.defaultPendingMinMs\n\n if (pendingMinMs && !router.getMatch(match.id)?.minPendingPromise) {\n // Create a promise that will resolve after the minPendingMs\n if (!router.isServer) {\n const minPendingPromise = createControlledPromise<void>()\n\n Promise.resolve().then(() => {\n router.updateMatch(match.id, (prev) => ({\n ...prev,\n minPendingPromise,\n }))\n })\n\n setTimeout(() => {\n minPendingPromise.resolve()\n\n // We've handled the minPendingPromise, so we can delete it\n router.updateMatch(match.id, (prev) => ({\n ...prev,\n minPendingPromise: undefined,\n }))\n }, pendingMinMs)\n }\n }\n throw match.loadPromise\n }\n\n return (\n <>\n {out}\n {router.AfterEachMatch ? (\n <router.AfterEachMatch match={match} matchIndex={matchIndex} />\n ) : null}\n </>\n )\n})\n\nexport const Outlet = React.memo(function OutletImpl() {\n const router = useRouter()\n const matchId = React.useContext(matchContext)\n const routeId = useRouterState({\n select: (s) => s.matches.find((d) => d.id === matchId)?.routeId as string,\n })\n\n const route = router.routesById[routeId]!\n\n const { parentGlobalNotFound } = useRouterState({\n select: (s) => {\n const matches = s.matches\n const parentMatch = matches.find((d) => d.id === matchId)\n invariant(\n parentMatch,\n `Could not find parent match for matchId \"${matchId}\"`,\n )\n return {\n parentGlobalNotFound: parentMatch.globalNotFound,\n }\n },\n })\n\n const childMatchId = useRouterState({\n select: (s) => {\n const matches = s.matches\n const index = matches.findIndex((d) => d.id === matchId)\n return matches[index + 1]?.id\n },\n })\n\n if (parentGlobalNotFound) {\n return renderRouteNotFound(router, route, undefined)\n }\n\n if (!childMatchId) {\n return null\n }\n\n const nextMatch = <Match matchId={childMatchId} />\n\n const pendingElement = router.options.defaultPendingComponent ? (\n <router.options.defaultPendingComponent />\n ) : null\n\n if (matchId === rootRouteId) {\n return (\n <React.Suspense fallback={pendingElement}>{nextMatch}</React.Suspense>\n )\n }\n\n return nextMatch\n})\n"],"names":["matchIndex","match","routeId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO;AAA4C;AAEnD;;AAGE;AACA;AAA+B;;AACd;AAAyC;AAAA;AAG1D;AAAA;AACE;AAC8C;AAG1C;AAEN;AAGA;AAEA;AAGA;AAEA;AAAqC;AAAA;AAGK;AAGpC;AAAA;AAAA;AAOA;AAEA;AAIA;AAIN;AAAgC;AACb;AAIjB;AAEI;AAAC;AAAA;AACoB;AACoB;AAGjC;AACI;AACR;AAAsB;AACxB;AAEA;AAAC;AAAA;AAKK;AAIM;AAED;AAAwD;AACjE;AAE8B;AAAA;AAChC;AAAA;AAKV;AAEO;AAAsD;AAE7D;;AAGE;AAEA;AAAsD;AAE5CA;AACAC;AACN;AACO;AAAA;AACLC;AACAF;AAC2D;AAAA;AAE/D;AAGI;AAEA;AACJ;AACA;AAA+C;AAsBjD;AAII;AACE;AACA;AACF;AAGQ;AAAiC;AAEzC;AAAc;AAGN;AAEH;AAAwC;AAG7C;AAGF;AAMA;AAAY;AAGV;AAMF;AAEI;AAAA;AAAC;AAAA;AACc;AACP;AACY;AAClB;AAAA;AAAA;AAKF;AACF;AAEM;AAAiC;AAEvC;AAAY;AACd;AAGE;AAEF;AAGA;AAEM;AACF;AAEQ;AACN;AAAwC;AACnC;AACH;AACA;AAGJ;AACE;AAGA;AAAwC;AACnC;AACgB;AACnB;AACW;AACjB;AAEF;AAAY;AAGd;AAEK;AAAA;AAGG;AAGV;AAEO;AACL;AACM;AACN;AAA+B;;AACd;AAAyC;AAAA;AAGpD;AAEA;AAA0C;AAE5C;AACA;AACA;AAAA;AACE;AACmD;AAE9C;AAAA;AAC6B;AAAA;AAEtC;AAGF;AAAoC;;AAEhC;AACA;AACO;AAAoB;AAC7B;AAGF;AACS;AAA4C;AAGrD;AACS;AAAA;AAGT;AAEM;AAIN;AACE;AACuD;AAIlD;AACT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"fileRoute.cjs","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport type { NoInfer } from '@tanstack/react-store'\nimport type { ParsePathParams } from './link'\nimport type {\n AnyContext,\n AnyPathParams,\n AnyRoute,\n AnySearchSchema,\n FileBaseRouteOptions,\n InferAllContext,\n ResolveAllContext,\n ResolveAllParamsFromParent,\n ResolveFullSearchSchema,\n ResolveFullSearchSchemaInput,\n ResolveLoaderData,\n ResolveRouteContext,\n ResolveSearchSchemaUsed,\n Route,\n RouteConstraints,\n RouteContext,\n RouteLoaderFn,\n UpdatableRouteOptions,\n} from './route'\nimport type { MakeRouteMatch } from './Matches'\nimport type { RegisteredRouter } from './router'\nimport type { RouteById, RouteIds } from './routeInfo'\n\nexport interface FileRoutesByPath {\n // '/': {\n // parentRoute: typeof rootRoute\n // }\n}\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TSearchSchemaInput = Record<string, unknown>,\n TSearchSchema = {},\n TSearchSchemaUsed = ResolveSearchSchemaUsed<\n TSearchSchemaInput,\n TSearchSchema\n >,\n TFullSearchSchemaInput = ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchSchemaUsed\n >,\n TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>,\n TParams = Record<ParsePathParams<TPath>, string>,\n TAllParams = ResolveAllParamsFromParent<TParentRoute, TParams>,\n TRouteContextReturn = RouteContext,\n TRouteContext = ResolveRouteContext<TRouteContextReturn>,\n TAllContext = ResolveAllContext<TParentRoute, TRouteContext>,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n TChildren = unknown,\n >(\n options?: FileBaseRouteOptions<\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n InferAllContext<TParentRoute>,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn\n > &\n UpdatableRouteOptions<\n TId,\n TAllParams,\n TFullSearchSchema,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps\n >,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TChildren\n > => {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderData>(\n loaderFn: RouteLoaderFn<\n TRoute['types']['allParams'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['allContext'],\n TLoaderData\n >,\n) => RouteLoaderFn<\n TRoute['types']['allParams'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['allContext'],\n NoInfer<TLoaderData>\n> {\n warning(\n false,\n `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n )\n return (loaderFn) => loaderFn\n}\n\nexport type LazyRouteOptions = Pick<\n UpdatableRouteOptions<\n string,\n AnyPathParams,\n AnySearchSchema,\n {},\n AnyContext,\n AnyContext,\n {}\n >,\n 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'\n>\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n options: {\n id: string\n } & LazyRouteOptions\n\n constructor(\n opts: {\n id: string\n } & LazyRouteOptions,\n ) {\n this.options = opts\n ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n useMatch = <\n TRouteMatch = MakeRouteMatch<\n RegisteredRouter['routeTree'],\n TRoute['types']['id']\n >,\n TSelected = TRouteMatch,\n >(opts?: {\n select?: (match: TRouteMatch) => TSelected\n }): TSelected => {\n return useMatch({ select: opts?.select, from: this.options.id })\n }\n\n useRouteContext = <TSelected = TRoute['types']['allContext']>(opts?: {\n select?: (s: TRoute['types']['allContext']) => TSelected\n }): TSelected => {\n return useMatch({\n from: this.options.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = TRoute['types']['fullSearchSchema']>(opts?: {\n select?: (s: TRoute['types']['fullSearchSchema']) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.options.id })\n }\n\n useParams = <TSelected = TRoute['types']['allParams']>(opts?: {\n select?: (s: TRoute['types']['allParams']) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.options.id })\n }\n\n useLoaderDeps = <TSelected = TRoute['types']['loaderDeps']>(opts?: {\n select?: (s: TRoute['types']['loaderDeps']) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.options.id } as any)\n }\n\n useLoaderData = <TSelected = TRoute['types']['loaderData']>(opts?: {\n select?: (s: TRoute['types']['loaderData']) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.options.id } as any)\n }\n\n useNavigate = () => {\n return useNavigate({ from: this.options.id })\n }\n}\n\nexport function createLazyRoute<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n>(id: TId) {\n return (opts: LazyRouteOptions) => {\n return new LazyRoute<TRoute>({ id: id as any, ...opts })\n }\n}\n\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath) {\n return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"],"names":["route","createRoute","opts","useMatch","useSearch","useParams","useLo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IAAW;AAAA,IAAA;AAGhE,SAAA,gBAAgB,CAA4CA,UAE3C;AACR,aAAAK,cAAA,cAAc,EAAE,GAAGL,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAAA;AAGhE,SAAA,cAAc,MAAM;AAClB,aAAOM,YAAAA,YAAY,EAAE,MAAM,KAAK,QAAQ,IAAI;AAAA,IAAA;AAlD5C,SAAK,UAAU;AACb,SAAa,WAAW,OAAO,IAAI,YAAY;AAAA,EACnD;AAkDF;AAEO,SAAS,gBAGd,IAAS;AACT,SAAO,CAAC,SAA2B;AACjC,WAAO,IAAI,UAAkB,EAAE,IAAe,GAAG,KAAM,CAAA;AAAA,EAAA;AAE3D;AAEO,SAAS,oBAGd,IAAe;AACR,SAAA,CAAC,SAA2B,IAAI,UAAkB,EAAE,IAAI,GAAG,MAAM;AAC1E;;;;;;;"}
1
+ {"version":3,"file":"fileRoute.cjs","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport type { NoInfer } from '@tanstack/react-store'\nimport type { ParsePathParams } from './link'\nimport type {\n AnyContext,\n AnyPathParams,\n AnyRoute,\n AnySearchValidator,\n DefaultSearchValidator,\n FileBaseRouteOptions,\n InferAllContext,\n ResolveAllContext,\n ResolveAllParamsFromParent,\n ResolveLoaderData,\n ResolveRouteContext,\n Route,\n RouteConstraints,\n RouteContext,\n RouteLoaderFn,\n UpdatableRouteOptions,\n} from './route'\nimport type { MakeRouteMatch } from './Matches'\nimport type { RegisteredRouter } from './router'\nimport type { RouteById, RouteIds } from './routeInfo'\n\nexport interface FileRoutesByPath {\n // '/': {\n // parentRoute: typeof rootRoute\n // }\n}\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TSearchValidator extends AnySearchValidator = DefaultSearchValidator,\n TParams = Record<ParsePathParams<TPath>, string>,\n TAllParams = ResolveAllParamsFromParent<TParentRoute, TParams>,\n TRouteContextReturn = RouteContext,\n TRouteContext = ResolveRouteContext<TRouteContextReturn>,\n TAllContext = ResolveAllContext<TParentRoute, TRouteContext>,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n TChildren = unknown,\n >(\n options?: FileBaseRouteOptions<\n TParentRoute,\n TPath,\n TSearchValidator,\n TParams,\n TAllParams,\n TRouteContextReturn,\n InferAllContext<TParentRoute>,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn\n > &\n UpdatableRouteOptions<\n TParentRoute,\n TId,\n TAllParams,\n TSearchValidator,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps\n >,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchValidator,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TChildren\n > => {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderData>(\n loaderFn: RouteLoaderFn<\n TRoute['types']['allParams'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['allContext'],\n TLoaderData\n >,\n) => RouteLoaderFn<\n TRoute['types']['allParams'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['allContext'],\n NoInfer<TLoaderData>\n> {\n warning(\n false,\n `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n )\n return (loaderFn) => loaderFn\n}\n\nexport type LazyRouteOptions = Pick<\n UpdatableRouteOptions<\n AnyRoute,\n string,\n AnyPathParams,\n AnySearchValidator,\n {},\n AnyContext,\n AnyContext,\n {}\n >,\n 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'\n>\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n options: {\n id: string\n } & LazyRouteOptions\n\n constructor(\n opts: {\n id: string\n } & LazyRouteOptions,\n ) {\n this.options = opts\n ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n useMatch = <\n TRouteMatch = MakeRouteMatch<\n RegisteredRouter['routeTree'],\n TRoute['types']['id']\n >,\n TSelected = TRouteMatch,\n >(opts?: {\n select?: (match: TRouteMatch) => TSelected\n }): TSelected => {\n return useMatch({ select: opts?.select, from: this.options.id })\n }\n\n useRouteContext = <TSelected = TRoute['types']['allContext']>(opts?: {\n select?: (s: TRoute['types']['allContext']) => TSelected\n }): TSelected => {\n return useMatch({\n from: this.options.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = TRoute['types']['fullSearchSchema']>(opts?: {\n select?: (s: TRoute['types']['fullSearchSchema']) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.options.id })\n }\n\n useParams = <TSelected = TRoute['types']['allParams']>(opts?: {\n select?: (s: TRoute['types']['allParams']) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.options.id })\n }\n\n useLoaderDeps = <TSelected = TRoute['types']['loaderDeps']>(opts?: {\n select?: (s: TRoute['types']['loaderDeps']) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.options.id } as any)\n }\n\n useLoaderData = <TSelected = TRoute['types']['loaderData']>(opts?: {\n select?: (s: TRoute['types']['loaderData']) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.options.id } as any)\n }\n\n useNavigate = () => {\n return useNavigate({ from: this.options.id })\n }\n}\n\nexport function createLazyRoute<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n>(id: TId) {\n return (opts: LazyRouteOptions) => {\n return new LazyRoute<TRoute>({ id: id as any, ...opts })\n }\n}\n\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath) {\n return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"],"names":["route","createRoute","opts","useMatch","useSearch","useParams","useLoaderDeps","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AAA,IAAA;AAGhE,SAAA,gBAAgB,CAA4CA,UAE3C;AACR,aAAAK,cAAA,cAAc,EAAE,GAAGL,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAAA;AAGhE,SAAA,cAAc,MAAM;AAClB,aAAOM,YAAAA,YAAY,EAAE,MAAM,KAAK,QAAQ,IAAI;AAAA,IAAA;AAlD5C,SAAK,UAAU;AACb,SAAa,WAAW,OAAO,IAAI,YAAY;AAAA,EACnD;AAkDF;AAEO,SAAS,gBAGd,IAAS;AACT,SAAO,CAAC,SAA2B;AACjC,WAAO,IAAI,UAAkB,EAAE,IAAe,GAAG,KAAM,CAAA;AAAA,EAAA;AAE3D;AAEO,SAAS,oBAGd,IAAe;AACR,SAAA,CAAC,SAA2B,IAAI,UAAkB,EAAE,IAAI,GAAG,MAAM;AAC1E;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { NoInfer } from '@tanstack/react-store';
2
2
  import { ParsePathParams } from './link.cjs';
3
- import { AnyContext, AnyPathParams, AnyRoute, AnySearchSchema, FileBaseRouteOptions, InferAllContext, ResolveAllContext, ResolveAllParamsFromParent, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveLoaderData, ResolveRouteContext, ResolveSearchSchemaUsed, Route, RouteConstraints, RouteContext, RouteLoaderFn, UpdatableRouteOptions } from './route.cjs';
3
+ import { AnyContext, AnyPathParams, AnyRoute, AnySearchValidator, DefaultSearchValidator, FileBaseRouteOptions, InferAllContext, ResolveAllContext, ResolveAllParamsFromParent, ResolveLoaderData, ResolveRouteContext, Route, RouteConstraints, RouteContext, RouteLoaderFn, UpdatableRouteOptions } from './route.cjs';
4
4
  import { MakeRouteMatch } from './Matches.cjs';
5
5
  import { RegisteredRouter } from './router.cjs';
6
6
  import { RouteById, RouteIds } from './routeInfo.cjs';
@@ -18,7 +18,7 @@ export declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParent
18
18
  constructor(path: TFilePath, _opts?: {
19
19
  silent: boolean;
20
20
  });
21
- createRoute: <TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TSearchSchemaUsed = ResolveSearchSchemaUsed<TSearchSchemaInput, TSearchSchema>, TFullSearchSchemaInput = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams = Record<ParsePathParams<TPath>, string>, TAllParams = ResolveAllParamsFromParent<TParentRoute, TParams>, TRouteContextReturn = RouteContext, TRouteContext = ResolveRouteContext<TRouteContextReturn>, TAllContext = ResolveAllContext<TParentRoute, TRouteContext>, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>, TChildren = unknown>(options?: FileBaseRouteOptions<TPath, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, InferAllContext<TParentRoute>, TAllContext, TLoaderDeps, TLoaderDataReturn> & UpdatableRouteOptions<TId, TAllParams, TFullSearchSchema, TLoaderData, TAllContext, TRouteContext, TLoaderDeps>) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData, TChildren>;
21
+ createRoute: <TSearchValidator extends AnySearchValidator = DefaultSearchValidator, TParams = Record<ParsePathParams<TPath>, string>, TAllParams = ResolveAllParamsFromParent<TParentRoute, TParams>, TRouteContextReturn = RouteContext, TRouteContext = ResolveRouteContext<TRouteContextReturn>, TAllContext = ResolveAllContext<TParentRoute, TRouteContext>, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>, TChildren = unknown>(options?: FileBaseRouteOptions<TParentRoute, TPath, TSearchValidator, TParams, TAllParams, TRouteContextReturn, InferAllContext<TParentRoute>, TAllContext, TLoaderDeps, TLoaderDataReturn> & UpdatableRouteOptions<TParentRoute, TId, TAllParams, TSearchValidator, TLoaderData, TAllContext, TRouteContext, TLoaderDeps>) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchValidator, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData, TChildren>;
22
22
  }
23
23
  /**
24
24
  @deprecated It's recommended not to split loaders into separate files.
@@ -26,7 +26,7 @@ export declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParent
26
26
  `createFileRoute('/path/to/file)(options)` options.
27
27
  */
28
28
  export declare function FileRouteLoader<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(_path: TFilePath): <TLoaderData>(loaderFn: RouteLoaderFn<TRoute['types']['allParams'], TRoute['types']['loaderDeps'], TRoute['types']['allContext'], TLoaderData>) => RouteLoaderFn<TRoute['types']['allParams'], TRoute['types']['loaderDeps'], TRoute['types']['allContext'], NoInfer<TLoaderData>>;
29
- export type LazyRouteOptions = Pick<UpdatableRouteOptions<string, AnyPathParams, AnySearchSchema, {}, AnyContext, AnyContext, {}>, 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'>;
29
+ export type LazyRouteOptions = Pick<UpdatableRouteOptions<AnyRoute, string, AnyPathParams, AnySearchValidator, {}, AnyContext, AnyContext, {}>, 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'>;
30
30
  export declare class LazyRoute<TRoute extends AnyRoute> {
31
31
  options: {
32
32
  id: string;
@@ -31,7 +31,7 @@ export type { AnyRedirect, Redirect, ResolvedRedirect } from './redirects.cjs';
31
31
  export { rootRouteId } from './root.cjs';
32
32
  export type { RootRouteId } from './root.cjs';
33
33
  export { RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, } from './route.cjs';
34
- export type { AnyPathParams, SearchSchemaInput, AnySearchSchema, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, UpdatableStaticRouteOption, MetaDescriptor, RouteLinkEntry, ParseParamsFn, SearchSchemaValidator, SearchSchemaValidatorObj, SearchSchemaValidatorFn, RouteLoaderFn, LoaderFnContext, SearchFilter, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, AnyRoute, RouteConstraints, AnyRootRoute, ResolveFullPath, RouteMask, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, ReactNode, SyncRouteComponent, AsyncRouteComponent, RouteComponent, ErrorRouteComponent, NotFoundRouteComponent, TrimPath, TrimPathLeft, TrimPathRight, RootRouteOptions, AnyRouteWithContext, } from './route.cjs';
34
+ export type { AnyPathParams, SearchSchemaInput, SearchValidatorAdapter, AnySearchSchema, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, UpdatableStaticRouteOption, MetaDescriptor, RouteLinkEntry, ParseParamsFn, RouteLoaderFn, LoaderFnContext, SearchFilter, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, AnyRoute, RouteConstraints, AnyRootRoute, ResolveFullPath, RouteMask, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, ReactNode, SyncRouteComponent, AsyncRouteComponent, RouteComponent, ErrorRouteComponent, NotFoundRouteComponent, TrimPath, TrimPathLeft, TrimPathRight, RootRouteOptions, AnyRouteWithContext, } from './route.cjs';
35
35
  export type { ParseRoute, RoutesById, RouteById, RouteIds, RoutesByPath, RouteByPath, RoutePaths, FullSearchSchema, AllParams, } from './routeInfo.cjs';
36
36
  export { componentTypes, createRouter, Router, lazyFn, SearchParamError, PathParamError, getInitialRouterState, defaultSerializeError, } from './router.cjs';
37
37
  export type { Register, AnyRouter, RegisteredRouter, HydrationCtx, RouterContextOptions, TrailingSlashOption, RouterOptions, RouterTransformer, RouterErrorSerializer, RouterState, ListenerFn, BuildNextOptions, DehydratedRouterState, DehydratedRouteMatch, DehydratedRouter, RouterConstructorOptions, RouterEvents, RouterEvent, RouterListener, AnyRouterWithContext, } from './router.cjs';
@@ -1 +1 @@
1
- {"version":3,"file":"route.cjs","sources":["../../src/route.ts"],"sourcesContent":["import invariant from 'tiny-invariant'\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { joinPaths, trimPathLeft } from './path'\nimport { useParams } from './useParams'\nimport { useSearch } from './useSearch'\nimport { notFound } from './not-found'\nimport { useNavigate } from './useNavigate'\nimport { rootRouteId } from './root'\nimport type * as React from 'react'\nimport type { RootRouteId } from './root'\nimport type { UseNavigateResult } from './useNavigate'\nimport type { MakeRouteMatch, RouteMatch } from './Matches'\nimport type { NavigateOptions, ParsePathParams, ToMaskOptions } from './link'\nimport type { ParsedLocation } from './location'\nimport type { RouteById, RouteIds, RoutePaths } from './routeInfo'\nimport type { AnyRouter, RegisteredRouter, Router } from './router'\nimport type { Assign, Expand, NoInfer, PickRequired } from './utils'\nimport type { BuildLocationFn, NavigateFn } from './RouterProvider'\nimport type { NotFoundError } from './not-found'\nimport type { LazyRoute } from './fileRoute'\n\nexport type AnyPathParams = {}\n\nexport type SearchSchemaInput = {\n __TSearchSchemaInput__: 'TSearchSchemaInput'\n}\n\nexport type AnySearchSchema = {}\n\nexport type AnyContext = {}\n\nexport interface RouteContext {}\n\nexport type PreloadableObj = { preload?: () => Promise<void> }\n\nexport type RoutePathOptions<TCustomId, TPath> =\n | {\n path: TPath\n }\n | {\n id: TCustomId\n }\n\nexport interface StaticDataRouteOption {}\n\nexport type RoutePathOptionsIntersection<TCustomId, TPath> = {\n path: TPath\n id: TCustomId\n}\n\nexport type RouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchemaInput = Record<string, unknown>,\n TSearchSchema = {},\n TFullSearchSchema = TSearchSchema,\n TParams = AnyPathParams,\n TAllParams = TParams,\n TRouteContextReturn = RouteContext,\n TRouteContext = RouteContext,\n TParentAllContext = AnyContext,\n TAllContext = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n> = BaseRouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TParentAllContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn\n> &\n UpdatableRouteOptions<\n NoInfer<TCustomId>,\n NoInfer<TAllParams>,\n NoInfer<TFullSearchSchema>,\n NoInfer<TLoaderData>,\n NoInfer<TAllContext>,\n NoInfer<TRouteContext>,\n NoInfer<TLoaderDeps>\n >\n\nexport type ParseParamsFn<TPath extends string, TParams> = (\n rawParams: Record<ParsePathParams<TPath>, string>,\n) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : Record<ParsePathParams<TPath>, any>\n\nexport type StringifyParamsFn<TPath extends string, TParams> = (\n params: TParams,\n) => Record<ParsePathParams<TPath>, string>\n\nexport type ParamsOptions<TPath extends string, TParams> = {\n params?: {\n parse: ParseParamsFn<TPath, TParams>\n stringify: StringifyParamsFn<TPath, TParams>\n }\n\n /** \n @deprecated Use params.parse instead\n */\n parseParams?: ParseParamsFn<TPath, TParams>\n\n /** \n @deprecated Use params.stringify instead\n */\n stringifyParams?: StringifyParamsFn<TPath, TParams>\n}\n\nexport interface FullSearchSchemaOption<TFullSearchSchema> {\n search: TFullSearchSchema\n}\n\nexport type FileBaseRouteOptions<\n TPath extends string = string,\n TSearchSchemaInput = Record<string, unknown>,\n TSearchSchema = {},\n TFullSearchSchema = TSearchSchema,\n TParams = {},\n TAllParams = {},\n TRouteContextReturn = RouteContext,\n TParentAllContext = AnyContext,\n TAllContext = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n> = {\n validateSearch?:\n | ((input: TSearchSchemaInput) => TSearchSchema)\n | { parse: (input: TSearchSchemaInput) => TSearchSchema }\n shouldReload?:\n | boolean\n | ((\n match: LoaderFnContext<TAllParams, TFullSearchSchema, TAllContext>,\n ) => any)\n // This async function is called before a route is loaded.\n // If an error is thrown here, the route's loader will not be called.\n // If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onError` function.\n // If thrown during a preload event, the error will be logged to the console.\n beforeLoad?: (\n ctx: BeforeLoadContext<TFullSearchSchema, TAllParams, TParentAllContext>,\n ) => Promise<TRouteContextReturn> | TRouteContextReturn | void\n loaderDeps?: (opts: FullSearchSchemaOption<TFullSearchSchema>) => TLoaderDeps\n loader?: (\n ctx: LoaderFnContext<TAllParams, TLoaderDeps, TAllContext>,\n ) => TLoaderDataReturn | Promise<TLoaderDataReturn>\n} & ParamsOptions<TPath, TParams>\n\nexport type BaseRouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchemaInput = Record<string, unknown>,\n TSearchSchema = {},\n TFullSearchSchema = TSearchSchema,\n TParams = {},\n TAllParams = {},\n TRouteContextReturn = RouteContext,\n TParentAllContext = AnyContext,\n TAllContext = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n> = RoutePathOptions<TCustomId, TPath> &\n FileBaseRouteOptions<\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TParentAllContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn\n > & {\n getParentRoute: () => TParentRoute\n }\n\nexport interface BeforeLoadContext<\n TFullSearchSchema,\n TAllParams,\n TParentAllContext,\n> extends FullSearchSchemaOption<TFullSearchSchema> {\n abortController: AbortController\n preload: boolean\n params: Expand<TAllParams>\n context: TParentAllContext\n location: ParsedLocation\n /**\n * @deprecated Use `throw redirect({ to: '/somewhere' })` instead\n **/\n navigate: NavigateFn\n buildLocation: BuildLocationFn\n cause: 'preload' | 'enter' | 'stay'\n}\n\nexport type UpdatableRouteOptions<\n TRouteId,\n TAllParams,\n TFullSearchSchema,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps,\n TRouteMatch = RouteMatch<\n TRouteId,\n TAllParams,\n TFullSearchSchema,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps\n >,\n> = {\n // test?: (args: TAllContext) => void\n // If true, this route will be matched as case-sensitive\n caseSensitive?: boolean\n // If true, this route will be forcefully wrapped in a suspense boundary\n wrapInSuspense?: boolean\n // The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`\n component?: RouteComponent\n errorComponent?: false | null | ErrorRouteComponent\n notFoundComponent?: NotFoundRouteComponent\n pendingComponent?: RouteComponent\n pendingMs?: number\n pendingMinMs?: number\n staleTime?: number\n gcTime?: number\n preloadStaleTime?: number\n preloadGcTime?: number\n // Filter functions that can manipulate search params *before* they are passed to links and navigate\n // calls that match this route.\n preSearchFilters?: Array<SearchFilter<TFullSearchSchema>>\n // Filter functions that can manipulate search params *after* they are passed to links and navigate\n // calls that match this route.\n postSearchFilters?: Array<SearchFilter<TFullSearchSchema>>\n onCatch?: (error: Error, errorInfo: React.ErrorInfo) => void\n onError?: (err: any) => void\n // These functions are called as route matches are loaded, stick around and leave the active\n // matches\n onEnter?: (match: TRouteMatch) => void\n onStay?: (match: TRouteMatch) => void\n onLeave?: (match: TRouteMatch) => void\n meta?: (ctx: {\n matches: Array<TRouteMatch>\n match: TRouteMatch\n params: TAllParams\n loaderData: TLoaderData\n }) => Array<React.JSX.IntrinsicElements['meta']>\n links?: () => Array<React.JSX.IntrinsicElements['link']>\n scripts?: () => Array<React.JSX.IntrinsicElements['script']>\n headers?: (ctx: { loaderData: TLoaderData }) => Record<string, string>\n} & UpdatableStaticRouteOption\n\nexport type UpdatableStaticRouteOption =\n {} extends PickRequired<StaticDataRouteOption>\n ? {\n staticData?: StaticDataRouteOption\n }\n : {\n staticData: StaticDataRouteOption\n }\n\nexport type MetaDescriptor =\n | { charSet: 'utf-8' }\n | { title: string }\n | { name: string; content: string }\n | { property: string; content: string }\n | { httpEquiv: string; content: string }\n | { 'script:ld+json': LdJsonObject }\n | { tagName: 'meta' | 'link'; [name: string]: string }\n | Record<string, unknown>\n\ntype LdJsonObject = { [Key in string]: LdJsonValue } & {\n [Key in string]?: LdJsonValue | undefined\n}\ntype LdJsonArray = Array<LdJsonValue> | ReadonlyArray<LdJsonValue>\ntype LdJsonPrimitive = string | number | boolean | null\ntype LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray\n\nexport type RouteLinkEntry = {}\n\n// The parse type here allows a zod schema to be passed directly to the validator\nexport type SearchSchemaValidator<TInput, TReturn> =\n | SearchSchemaValidatorObj<TInput, TReturn>\n | SearchSchemaValidatorFn<TInput, TReturn>\n\nexport type SearchSchemaValidatorObj<TInput, TReturn> = {\n parse?: SearchSchemaValidatorFn<TInput, TReturn>\n}\n\nexport type SearchSchemaValidatorFn<TInput, TReturn> = (\n searchObj: TInput,\n) => TReturn\n\nexport type RouteLoaderFn<\n in out TAllParams = {},\n in out TLoaderDeps extends Record<string, any> = {},\n in out TAllContext = AnyContext,\n TLoaderData = undefined,\n> = (\n match: LoaderFnContext<TAllParams, TLoaderDeps, TAllContext>,\n) => TLoaderData | Promise<TLoaderData>\n\nexport interface LoaderFnContext<\n in out TAllParams = {},\n in out TLoaderDeps = {},\n in out TAllContext = AnyContext,\n> {\n abortController: AbortController\n preload: boolean\n params: Expand<TAllParams>\n deps: TLoaderDeps\n context: TAllContext\n location: ParsedLocation // Do not supply search schema here so as to demotivate people from trying to shortcut loaderDeps\n /**\n * @deprecated Use `throw redirect({ to: '/somewhere' })` instead\n **/\n navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void>\n parentMatchPromise?: Promise<void>\n cause: 'preload' | 'enter' | 'stay'\n route: Route\n}\n\nexport type SearchFilter<TInput, TResult = TInput> = (prev: TInput) => TResult\n\nexport type ResolveId<\n TParentRoute,\n TCustomId extends string,\n TPath extends string,\n> = TParentRoute extends { id: infer TParentId extends string }\n ? RoutePrefix<TParentId, string extends TCustomId ? TPath : TCustomId>\n : RootRouteId\n\nexport type InferFullSearchSchema<TRoute> = TRoute extends {\n types: {\n fullSearchSchema: infer TFullSearchSchema\n }\n}\n ? TFullSearchSchema\n : {}\n\nexport type InferFullSearchSchemaInput<TRoute> = TRoute extends {\n types: {\n fullSearchSchemaInput: infer TFullSearchSchemaInput\n }\n}\n ? TFullSearchSchemaInput\n : {}\n\nexport type InferAllParams<TRoute> = TRoute extends {\n types: {\n allParams: infer TAllParams\n }\n}\n ? TAllParams\n : {}\n\nexport type InferAllContext<TRoute> = TRoute extends {\n types: {\n allContext: infer TAllContext\n }\n}\n ? TAllContext\n : {}\n\nexport type ResolveSearchSchemaUsed<TSearchSchemaInput, TSearchSchema> =\n TSearchSchemaInput extends SearchSchemaInput\n ? Omit<TSearchSchemaInput, keyof SearchSchemaInput>\n : TSearchSchema\n\nexport type ResolveFullSearchSchema<\n TParentRoute extends AnyRoute,\n TSearchSchema,\n> = Assign<InferFullSearchSchema<TParentRoute>, TSearchSchema>\n\nexport type ResolveFullSearchSchemaInput<\n TParentRoute extends AnyRoute,\n TSearchSchemaUsed,\n> = Assign<InferFullSearchSchemaInput<TParentRoute>, TSearchSchemaUsed>\n\nexport type ResolveRouteContext<TRouteContextReturn> = [\n TRouteContextReturn,\n] extends [never]\n ? RouteContext\n : TRouteContextReturn\n\nexport type ResolveAllContext<\n TParentRoute extends AnyRoute,\n TRouteContext,\n> = Assign<InferAllContext<TParentRoute>, TRouteContext>\n\nexport type ResolveLoaderData<TLoaderDataReturn> = [TLoaderDataReturn] extends [\n never,\n]\n ? undefined\n : TLoaderDataReturn\n\nexport interface AnyRoute\n extends Route<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n > {}\n\nexport type AnyRouteWithContext<TContext> = Route<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n TContext,\n any,\n any,\n any,\n any\n>\n\nexport type ResolveAllParamsFromParent<\n TParentRoute extends AnyRoute,\n TParams,\n> = Assign<InferAllParams<TParentRoute>, TParams>\n\nexport type RouteConstraints = {\n TParentRoute: AnyRoute\n TPath: string\n TFullPath: string\n TCustomId: string\n TId: string\n TSearchSchema: AnySearchSchema\n TFullSearchSchema: AnySearchSchema\n TParams: Record<string, any>\n TAllParams: Record<string, any>\n TParentContext: AnyContext\n TRouteContext: RouteContext\n TAllContext: AnyContext\n TRouterContext: AnyContext\n TChildren: unknown\n TRouteTree: AnyRoute\n}\n\nexport function getRouteApi<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRouter extends AnyRouter = RegisteredRouter,\n TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>,\n TFullSearchSchema = TRoute['types']['fullSearchSchema'],\n TAllParams = TRoute['types']['allParams'],\n TAllContext = TRoute['types']['allContext'],\n TLoaderDeps = TRoute['types']['loaderDeps'],\n TLoaderData = TRoute['types']['loaderData'],\n>(id: TId) {\n return new RouteApi<\n TId,\n TRouter,\n TRoute,\n TFullSearchSchema,\n TAllParams,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >({ id })\n}\n\nexport class RouteApi<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRouter extends AnyRouter = RegisteredRouter,\n TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>,\n TFullSearchSchema = TRoute['types']['fullSearchSchema'],\n TAllParams = TRoute['types']['allParams'],\n TAllContext = TRoute['types']['allContext'],\n TLoaderDeps = TRoute['types']['loaderDeps'],\n TLoaderData = TRoute['types']['loaderData'],\n> {\n id: TId\n\n /**\n * @deprecated Use the `getRouteApi` function instead.\n */\n constructor({ id }: { id: TId }) {\n this.id = id as any\n }\n\n useMatch = <\n TRouteTree extends AnyRoute = TRouter['routeTree'],\n TRouteMatch = MakeRouteMatch<TRouteTree, TId>,\n TSelected = TRouteMatch,\n >(opts?: {\n select?: (match: TRouteMatch) => TSelected\n }): TSelected => {\n return useMatch({ select: opts?.select, from: this.id })\n }\n\n useRouteContext = <TSelected = Expand<TAllContext>>(opts?: {\n select?: (s: Expand<TAllContext>) => TSelected\n }): TSelected => {\n return useMatch({\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = Expand<TFullSearchSchema>>(opts?: {\n select?: (s: Expand<TFullSearchSchema>) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id })\n }\n\n useParams = <TSelected = Expand<TAllParams>>(opts?: {\n select?: (s: Expand<TAllParams>) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id })\n }\n\n useLoaderDeps = <TSelected = TLoaderDeps>(opts?: {\n select?: (s: TLoaderDeps) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.id, strict: false } as any)\n }\n\n useLoaderData = <TSelected = TLoaderData>(opts?: {\n select?: (s: TLoaderData) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.id, strict: false } as any)\n }\n\n useNavigate = (): UseNavigateResult<TRoute['fullPath']> => {\n return useNavigate({ from: this.id })\n }\n\n notFound = (opts?: NotFoundError) => {\n return notFound({ routeId: this.id as string, ...opts })\n }\n}\n\nexport class Route<\n in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n in out TPath extends RouteConstraints['TPath'] = '/',\n in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n in out TCustomId extends RouteConstraints['TCustomId'] = string,\n in out TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n in out TSearchSchemaInput = Record<string, unknown>,\n in out TSearchSchema = {},\n in out TSearchSchemaUsed = ResolveSearchSchemaUsed<\n TSearchSchemaInput,\n TSearchSchema\n >,\n in out TFullSearchSchemaInput = ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchSchemaUsed\n >,\n in out TFullSearchSchema = ResolveFullSearchSchema<\n TParentRoute,\n TSearchSchema\n >,\n in out TParams = Record<ParsePathParams<TPath>, string>,\n in out TAllParams = ResolveAllParamsFromParent<TParentRoute, TParams>,\n TRouteContextReturn = RouteContext,\n in out TRouteContext = ResolveRouteContext<TRouteContextReturn>,\n in out TAllContext = ResolveAllContext<TParentRoute, TRouteContext>,\n in out TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n in out TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n in out TChildren = unknown,\n> {\n isRoot: TParentRoute extends Route<any> ? true : false\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n InferAllContext<TParentRoute>,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >\n\n // Set up in this.init()\n parentRoute!: TParentRoute\n id!: TId\n // customId!: TCustomId\n path!: TPath\n fullPath!: TFullPath\n to!: TrimPathRight<TFullPath>\n\n // Optional\n children?: TChildren\n originalIndex?: number\n router?: AnyRouter\n rank!: number\n lazyFn?: () => Promise<LazyRoute<any>>\n _lazyPromise?: Promise<void>\n\n /**\n * @deprecated Use the `createRoute` function instead.\n */\n constructor(\n options?: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n InferAllContext<TParentRoute>,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n ) {\n this.options = (options as any) || {}\n\n this.isRoot = !options?.getParentRoute as any\n invariant(\n !((options as any)?.id && (options as any)?.path),\n `Route cannot have both an 'id' and a 'path' option.`,\n )\n ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n types!: {\n parentRoute: TParentRoute\n path: TPath\n to: TrimPathRight<TFullPath>\n fullPath: TFullPath\n customId: TCustomId\n id: TId\n searchSchema: TSearchSchema\n searchSchemaInput: TSearchSchemaInput\n searchSchemaUsed: TSearchSchemaUsed\n fullSearchSchema: TFullSearchSchema\n fullSearchSchemaInput: TFullSearchSchemaInput\n params: TParams\n allParams: TAllParams\n routeContext: TRouteContext\n allContext: TAllContext\n children: TChildren\n loaderData: TLoaderData\n loaderDeps: TLoaderDeps\n }\n\n init = (opts: { originalIndex: number }): void => {\n this.originalIndex = opts.originalIndex\n\n const options = this.options as\n | (RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n InferAllContext<TParentRoute>,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n > &\n RoutePathOptionsIntersection<TCustomId, TPath>)\n | undefined\n\n const isRoot = !options?.path && !options?.id\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n this.parentRoute = this.options?.getParentRoute?.()\n\n if (isRoot) {\n this.path = rootRouteId as TPath\n } else {\n invariant(\n this.parentRoute,\n `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`,\n )\n }\n\n let path: undefined | string = isRoot ? rootRouteId : options.path\n\n // If the path is anything other than an index path, trim it up\n if (path && path !== '/') {\n path = trimPathLeft(path)\n }\n\n const customId = options?.id || path\n\n // Strip the parentId prefix from the first level of children\n let id = isRoot\n ? rootRouteId\n : joinPaths([\n this.parentRoute.id === rootRouteId ? '' : this.parentRoute.id,\n customId,\n ])\n\n if (path === rootRouteId) {\n path = '/'\n }\n\n if (id !== rootRouteId) {\n id = joinPaths(['/', id])\n }\n\n const fullPath =\n id === rootRouteId ? '/' : joinPaths([this.parentRoute.fullPath, path])\n\n this.path = path as TPath\n this.id = id as TId\n // this.customId = customId as TCustomId\n this.fullPath = fullPath as TFullPath\n this.to = fullPath as TrimPathRight<TFullPath>\n }\n\n addChildren<\n const TNewChildren extends\n | Record<string, AnyRoute>\n | ReadonlyArray<AnyRoute>,\n >(\n children: TNewChildren,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TNewChildren\n > {\n this.children = (\n Array.isArray(children) ? children : Object.values(children)\n ) as any\n return this as any\n }\n\n updateLoader = <TNewLoaderData = unknown>(options: {\n loader: RouteLoaderFn<TAllParams, TLoaderDeps, TAllContext, TNewLoaderData>\n }) => {\n Object.assign(this.options, options)\n return this as unknown as Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TLoaderDeps,\n TNewLoaderData,\n TChildren\n >\n }\n\n update = (\n options: UpdatableRouteOptions<\n TCustomId,\n TAllParams,\n TFullSearchSchema,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps\n >,\n ): this => {\n Object.assign(this.options, options)\n return this\n }\n\n lazy = (lazyFn: () => Promise<LazyRoute<any>>): this => {\n this.lazyFn = lazyFn\n return this\n }\n\n useMatch = <\n TRouter extends AnyRouter = RegisteredRouter,\n TRouteTree extends AnyRoute = TRouter['routeTree'],\n TRouteMatch = MakeRouteMatch<TRouteTree, TId>,\n TSelected = TRouteMatch,\n >(opts?: {\n select?: (match: TRouteMatch) => TSelected\n }): TSelected => {\n return useMatch({ ...opts, from: this.id })\n }\n\n useRouteContext = <TSelected = Expand<TAllContext>>(opts?: {\n select?: (search: Expand<TAllContext>) => TSelected\n }): TSelected => {\n return useMatch({\n ...opts,\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = Expand<TFullSearchSchema>>(opts?: {\n select?: (search: Expand<TFullSearchSchema>) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id })\n }\n\n useParams = <TSelected = Expand<TAllParams>>(opts?: {\n select?: (search: Expand<TAllParams>) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id })\n }\n\n useLoaderDeps = <TSelected = TLoaderDeps>(opts?: {\n select?: (s: TLoaderDeps) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.id } as any)\n }\n\n useLoaderData = <TSelected = TLoaderData>(opts?: {\n select?: (search: TLoaderData) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<TFullPath> => {\n return useNavigate({ from: this.id })\n }\n}\n\nexport function createRoute<\n TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n TPath extends RouteConstraints['TPath'] = '/',\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n TCustomId extends RouteConstraints['TCustomId'] = string,\n TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n TSearchSchemaInput = Record<string, unknown>,\n TSearchSchema = {},\n TSearchSchemaUsed = ResolveSearchSchemaUsed<\n TSearchSchemaInput,\n TSearchSchema\n >,\n TFullSearchSchemaInput = ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchSchemaUsed\n >,\n TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>,\n TParams = Record<ParsePathParams<TPath>, string>,\n TAllParams = ResolveAllParamsFromParent<TParentRoute, TParams>,\n TRouteContextReturn = RouteContext,\n TRouteContext = ResolveRouteContext<TRouteContextReturn>,\n TAllContext = ResolveAllContext<TParentRoute, TRouteContext>,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n TChildren = unknown,\n>(\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n InferAllContext<TParentRoute>,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n) {\n return new Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TChildren\n >(options)\n}\n\nexport type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>\n\nexport type RootRouteOptions<\n TSearchSchemaInput = {},\n TSearchSchema = {},\n TRouteContextReturn = RouteContext,\n TRouteContext = ResolveRouteContext<TRouteContextReturn>,\n TRouterContext = {},\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n> = Omit<\n RouteOptions<\n any, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext, // TParentAllContext\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderDataReturn, // TLoaderDataReturn,\n TLoaderData // TLoaderData,\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n | 'params'\n>\n\nexport function createRootRouteWithContext<TRouterContext extends {}>() {\n return <\n TSearchSchemaInput = {},\n TSearchSchema = {},\n TSearchSchemaUsed = ResolveSearchSchemaUsed<\n TSearchSchemaInput,\n TSearchSchema\n >,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends\n RouteContext = ResolveRouteContext<TRouteContextReturn>,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n >(\n options?: RootRouteOptions<\n TSearchSchemaInput,\n TSearchSchema,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n ) => {\n return createRootRoute<\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData\n >(options as any)\n }\n}\n\n/**\n * @deprecated Use the `createRootRouteWithContext` function instead.\n */\nexport const rootRouteWithContext = createRootRouteWithContext\n\nexport class RootRoute<\n in out TSearchSchemaInput = {},\n in out TSearchSchema = {},\n in out TSearchSchemaUsed = {},\n TRouteContextReturn = RouteContext,\n in out TRouteContext = ResolveRouteContext<TRouteContextReturn>,\n in out TRouterContext = {},\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n in out TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n TChildren = unknown,\n> extends Route<\n any, // TParentRoute\n '/', // TPath\n '/', // TFullPath\n string, // TCustomId\n RootRouteId, // TId\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, // TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TChildren // TChildren\n> {\n /**\n * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.\n */\n constructor(\n options?: RootRouteOptions<\n TSearchSchemaInput,\n TSearchSchema,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n ) {\n super(options as any)\n }\n\n addChildren<\n const TNewChildren extends\n | Record<string, AnyRoute>\n | ReadonlyArray<AnyRoute>,\n >(\n children: TNewChildren,\n ): RootRoute<\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TNewChildren\n > {\n return super.addChildren(children)\n }\n}\n\nexport function createRootRoute<\n TSearchSchemaInput = {},\n TSearchSchema = {},\n TSearchSchemaUsed = ResolveSearchSchemaUsed<\n TSearchSchemaInput,\n TSearchSchema\n >,\n TRouteContextReturn = RouteContext,\n TRouteContext = ResolveRouteContext<TRouteContextReturn>,\n TRouterContext = {},\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n>(\n options?: Omit<\n RouteOptions<\n any, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchema,\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext,\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n | 'params'\n >,\n) {\n return new RootRoute<\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >(options)\n}\n\nexport type ResolveFullPath<\n TParentRoute extends AnyRoute,\n TPath extends string,\n TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>,\n> = TPrefixed extends RootRouteId ? '/' : TPrefixed\n\ntype RoutePrefix<\n TPrefix extends string,\n TPath extends string,\n> = string extends TPath\n ? RootRouteId\n : TPath extends string\n ? TPrefix extends RootRouteId\n ? TPath extends '/'\n ? '/'\n : `/${TrimPath<TPath>}`\n : `${TPrefix}/${TPath}` extends '/'\n ? '/'\n : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}`\n : never\n\nexport type TrimPath<T extends string> = '' extends T\n ? ''\n : TrimPathRight<TrimPathLeft<T>>\n\nexport type TrimPathLeft<T extends string> =\n T extends `${RootRouteId}/${infer U}`\n ? TrimPathLeft<U>\n : T extends `/${infer U}`\n ? TrimPathLeft<U>\n : T\nexport type TrimPathRight<T extends string> = T extends '/'\n ? '/'\n : T extends `${infer U}/`\n ? TrimPathRight<U>\n : T\n\nexport type RouteMask<TRouteTree extends AnyRoute> = {\n routeTree: TRouteTree\n from: RoutePaths<TRouteTree>\n to?: any\n params?: any\n search?: any\n hash?: any\n state?: any\n unmaskOnReload?: boolean\n}\n\nexport function createRouteMask<\n TRouteTree extends AnyRoute,\n TFrom extends RoutePaths<TRouteTree>,\n TTo extends string,\n>(\n opts: {\n routeTree: TRouteTree\n } & ToMaskOptions<Router<TRouteTree, 'never'>, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n return opts as any\n}\n\n/**\n * @deprecated Use `ErrorComponentProps` instead.\n */\nexport type ErrorRouteProps = {\n error: unknown\n info?: { componentStack: string }\n reset: () => void\n}\n\nexport type ErrorComponentProps = {\n error: Error\n info?: { componentStack: string }\n reset: () => void\n}\nexport type NotFoundRouteProps = {\n // TODO: Make sure this is `| null | undefined` (this is for global not-founds)\n data: unknown\n}\n//\n\nexport type ReactNode = any\n\nexport type SyncRouteComponent<TProps> =\n | ((props: TProps) => ReactNode)\n | React.LazyExoticComponent<(props: TProps) => ReactNode>\n\nexport type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport type RouteComponent<TProps = any> = AsyncRouteComponent<TProps>\n\nexport type ErrorRouteComponent = RouteComponent<ErrorComponentProps>\n\nexport type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>\n\nexport class NotFoundRoute<\n TParentRoute extends AnyRootRoute,\n TSearchSchemaInput = Record<string, unknown>,\n TSearchSchema = {},\n TSearchSchemaUsed = {},\n TFullSearchSchemaInput = ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchSchemaUsed\n >,\n TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>,\n TRouteContextReturn = AnyContext,\n TRouteContext = RouteContext,\n TAllContext = ResolveAllContext<TParentRoute, TRouteContext>,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n TChildren = unknown,\n> extends Route<\n TParentRoute,\n '/404',\n '/404',\n '404',\n '404',\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n {},\n {},\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TChildren\n> {\n constructor(\n options: Omit<\n RouteOptions<\n TParentRoute,\n string,\n string,\n TSearchSchemaInput,\n TSearchSchema,\n TFullSearchSchema,\n {},\n {},\n TRouteContextReturn,\n TRouteContext,\n InferAllContext<TParentRoute>,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n | 'path'\n | 'id'\n | 'params'\n >,\n ) {\n super({\n ...(options as any),\n id: '404',\n })\n }\n}\n"],"names":["useMatch","useSearch","useParams","useLoaderDeps","useLoaderData","useNavigate","notFound","options","rootRouteId","path","trimPathLeft","joinPaths"],"mappings":";;;;;;;;;;;;AA6dO,SAAS,YASd,IAAS;AACT,SAAO,IAAI,SAST,EAAE,GAAA,CAAI;AACV;AAEO,MAAM,SASX;AAAA;AAAA;AAAA;AAAA,EAMA,YAAY,EAAE,MAAmB;AAIjC,SAAA,WAAW,CAIT,SAEe;AACR,aAAAA,SAAA,SAAS,EAAE,QAAQ,6BAAM,QAAQ,MAAM,KAAK,IAAI;AAAA,IAAA;AAGzD,SAAA,kBAAkB,CAAkC,SAEnC;AACf,aAAOA,kBAAS;AAAA,QACd,MAAM,KAAK;AAAA,QACX,QAAQ,CAAC,OAAY,6BAAM,UAAS,KAAK,OAAO,EAAE,OAAO,IAAI,EAAE;AAAA,MAAA,CAChE;AAAA,IAAA;AAGH,SAAA,YAAY,CAAwC,SAEnC;AACf,aAAOC,UAAAA,UAAU,EAAE,GAAG,MAAM,MAAM,KAAK,IAAI;AAAA,IAAA;AAG7C,SAAA,YAAY,CAAiC,SAE5B;AACf,aAAOC,UAAAA,UAAU,EAAE,GAAG,MAAM,MAAM,KAAK,IAAI;AAAA,IAAA;AAG7C,SAAA,gBAAgB,CAA0B,SAEzB;AACR,aAAAC,cAAA,cAAc,EAAE,GAAG,MAAM,MAAM,KAAK,IAAI,QAAQ,MAAA,CAAc;AAAA,IAAA;AAGvE,SAAA,gBAAgB,CAA0B,SAEzB;AACR,aAAAC,cAAA,cAAc,EAAE,GAAG,MAAM,MAAM,KAAK,IAAI,QAAQ,MAAA,CAAc;AAAA,IAAA;AAGvE,SAAA,cAAc,MAA6C;AACzD,aAAOC,YAAY,YAAA,EAAE,MAAM,KAAK,GAAI,CAAA;AAAA,IAAA;AAGtC,SAAA,WAAW,CAAC,SAAy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,QAAQ,IAAI,WAAW,OAAO,OAAO,QAAQ;AAEtD,WAAA;AAAA,EACT;AAgGF;AAEO,SAAS,YAkCd,SAiBA;AACO,SAAA,IAAI,MAoBT,OAAO;AACX;AAwCO,SAAS,6BAAwD;AACtE,SAAO,CAcL,YAUG;AACH,WAAO,gBASL,OAAc;AAAA,EAAA;AAEpB;AAKO,MAAM,uBAAuB;AAE7B,MAAM,kBAWH,MAoBR;AAAA;AAAA;AAAA;AAAA,EAIA,YACE,SAUA;AACA,UAAM,OAAc;AAAA,EACtB;AAAA,EAEA,YAKE,UAYA;AACO,WAAA,MAAM,YAAY,QAAQ;AAAA,EACnC;AACF;AAEO,SAAS,gBAcd,SA0BA;AACO,SAAA,IAAI,UAUT,OAAO;AACX;AAkDO,SAAS,gBAKd,MAGuB;AAChB,SAAA;AACT;AAsCO,MAAM,sBAiBH,MAoBR;AAAA,EACA,YACE,SAyBA;AACM,UAAA;AAAA,MACJ,GAAI;AAAA,MACJ,IAAI;AAAA,IAAA,CACL;AAAA,EACH;AACF;;;;;;;;;;;"}
1
+ {"version":3,"file":"route.cjs","sources":["../../src/route.ts"],"sourcesContent":["import invariant from 'tiny-invariant'\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { joinPaths, trimPathLeft } from './path'\nimport { useParams } from './useParams'\nimport { useSearch } from './useSearch'\nimport { notFound } from './not-found'\nimport { useNavigate } from './useNavigate'\nimport { rootRouteId } from './root'\nimport type * as React from 'react'\nimport type { RootRouteId } from './root'\nimport type { UseNavigateResult } from './useNavigate'\nimport type { MakeRouteMatch, RouteMatch } from './Matches'\nimport type { NavigateOptions, ParsePathParams, ToMaskOptions } from './link'\nimport type { ParsedLocation } from './location'\nimport type { RouteById, RouteIds, RoutePaths } from './routeInfo'\nimport type { AnyRouter, RegisteredRouter, Router } from './router'\nimport type { Assign, Expand, NoInfer, PickRequired } from './utils'\nimport type { BuildLocationFn, NavigateFn } from './RouterProvider'\nimport type { NotFoundError } from './not-found'\nimport type { LazyRoute } from './fileRoute'\n\nexport type AnyPathParams = {}\n\nexport type SearchSchemaInput = {\n __TSearchSchemaInput__: 'TSearchSchemaInput'\n}\n\nexport type AnySearchSchema = {}\n\nexport type AnyContext = {}\n\nexport interface RouteContext {}\n\nexport type PreloadableObj = { preload?: () => Promise<void> }\n\nexport type RoutePathOptions<TCustomId, TPath> =\n | {\n path: TPath\n }\n | {\n id: TCustomId\n }\n\nexport interface StaticDataRouteOption {}\n\nexport type RoutePathOptionsIntersection<TCustomId, TPath> = {\n path: TPath\n id: TCustomId\n}\n\nexport type RouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchValidator extends AnySearchValidator = DefaultSearchValidator,\n TParams = AnyPathParams,\n TAllParams = TParams,\n TRouteContextReturn = RouteContext,\n TRouteContext = RouteContext,\n TParentAllContext = AnyContext,\n TAllContext = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n> = BaseRouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchValidator,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TParentAllContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn\n> &\n UpdatableRouteOptions<\n NoInfer<TParentRoute>,\n NoInfer<TCustomId>,\n NoInfer<TAllParams>,\n NoInfer<TSearchValidator>,\n NoInfer<TLoaderData>,\n NoInfer<TAllContext>,\n NoInfer<TRouteContext>,\n NoInfer<TLoaderDeps>\n >\n\nexport type ParseParamsFn<TPath extends string, TParams> = (\n rawParams: Record<ParsePathParams<TPath>, string>,\n) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : Record<ParsePathParams<TPath>, any>\n\nexport type StringifyParamsFn<TPath extends string, TParams> = (\n params: TParams,\n) => Record<ParsePathParams<TPath>, string>\n\nexport type ParamsOptions<TPath extends string, TParams> = {\n params?: {\n parse: ParseParamsFn<TPath, TParams>\n stringify: StringifyParamsFn<TPath, TParams>\n }\n\n /** \n @deprecated Use params.parse instead\n */\n parseParams?: ParseParamsFn<TPath, TParams>\n\n /** \n @deprecated Use params.stringify instead\n */\n stringifyParams?: StringifyParamsFn<TPath, TParams>\n}\n\nexport interface FullSearchSchemaOption<TFullSearchSchema> {\n search: TFullSearchSchema\n}\n\nexport type FileBaseRouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TPath extends string = string,\n TSearchValidator extends AnySearchValidator = undefined,\n TParams = {},\n TAllParams = {},\n TRouteContextReturn = RouteContext,\n TParentAllContext = AnyContext,\n TAllContext = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n> = {\n validateSearch?: TSearchValidator\n shouldReload?:\n | boolean\n | ((\n match: LoaderFnContext<\n TAllParams,\n ResolveFullSearchSchema<TParentRoute, TSearchValidator>,\n TAllContext\n >,\n ) => any)\n // This async function is called before a route is loaded.\n // If an error is thrown here, the route's loader will not be called.\n // If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onError` function.\n // If thrown during a preload event, the error will be logged to the console.\n beforeLoad?: (\n ctx: BeforeLoadContext<\n ResolveFullSearchSchema<TParentRoute, TSearchValidator>,\n TAllParams,\n TParentAllContext\n >,\n ) => Promise<TRouteContextReturn> | TRouteContextReturn | void\n loaderDeps?: (\n opts: FullSearchSchemaOption<\n ResolveFullSearchSchema<TParentRoute, TSearchValidator>\n >,\n ) => TLoaderDeps\n loader?: (\n ctx: LoaderFnContext<TAllParams, TLoaderDeps, TAllContext>,\n ) => TLoaderDataReturn | Promise<TLoaderDataReturn>\n} & ParamsOptions<TPath, TParams>\n\nexport type BaseRouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchValidator extends AnySearchValidator = undefined,\n TParams = {},\n TAllParams = {},\n TRouteContextReturn = RouteContext,\n TParentAllContext = AnyContext,\n TAllContext = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n> = RoutePathOptions<TCustomId, TPath> &\n FileBaseRouteOptions<\n TParentRoute,\n TPath,\n TSearchValidator,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TParentAllContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn\n > & {\n getParentRoute: () => TParentRoute\n }\n\nexport interface BeforeLoadContext<\n TFullSearchSchema,\n TAllParams,\n TParentAllContext,\n> extends FullSearchSchemaOption<TFullSearchSchema> {\n abortController: AbortController\n preload: boolean\n params: Expand<TAllParams>\n context: TParentAllContext\n location: ParsedLocation\n /**\n * @deprecated Use `throw redirect({ to: '/somewhere' })` instead\n **/\n navigate: NavigateFn\n buildLocation: BuildLocationFn\n cause: 'preload' | 'enter' | 'stay'\n}\n\nexport type UpdatableRouteOptions<\n TParentRoute extends AnyRoute,\n TRouteId,\n TAllParams,\n TSearchValidator extends AnySearchValidator,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps,\n> = {\n // test?: (args: TAllContext) => void\n // If true, this route will be matched as case-sensitive\n caseSensitive?: boolean\n // If true, this route will be forcefully wrapped in a suspense boundary\n wrapInSuspense?: boolean\n // The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`\n component?: RouteComponent\n errorComponent?: false | null | ErrorRouteComponent\n notFoundComponent?: NotFoundRouteComponent\n pendingComponent?: RouteComponent\n pendingMs?: number\n pendingMinMs?: number\n staleTime?: number\n gcTime?: number\n preloadStaleTime?: number\n preloadGcTime?: number\n // Filter functions that can manipulate search params *before* they are passed to links and navigate\n // calls that match this route.\n preSearchFilters?: Array<\n SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>\n >\n // Filter functions that can manipulate search params *after* they are passed to links and navigate\n // calls that match this route.\n postSearchFilters?: Array<\n SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>\n >\n onCatch?: (error: Error, errorInfo: React.ErrorInfo) => void\n onError?: (err: any) => void\n // These functions are called as route matches are loaded, stick around and leave the active\n // matches\n onEnter?: (\n match: RouteMatch<\n TRouteId,\n TAllParams,\n ResolveFullSearchSchema<TParentRoute, TSearchValidator>,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps\n >,\n ) => void\n onStay?: (\n match: RouteMatch<\n TRouteId,\n TAllParams,\n ResolveFullSearchSchema<TParentRoute, TSearchValidator>,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps\n >,\n ) => void\n onLeave?: (\n match: RouteMatch<\n TRouteId,\n TAllParams,\n ResolveFullSearchSchema<TParentRoute, TSearchValidator>,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps\n >,\n ) => void\n meta?: (ctx: {\n matches: Array<\n RouteMatch<\n TRouteId,\n TAllParams,\n ResolveFullSearchSchema<TParentRoute, TSearchValidator>,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps\n >\n >\n match: RouteMatch<\n TRouteId,\n TAllParams,\n ResolveFullSearchSchema<TParentRoute, TSearchValidator>,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps\n >\n params: TAllParams\n loaderData: TLoaderData\n }) => Array<React.JSX.IntrinsicElements['meta']>\n links?: () => Array<React.JSX.IntrinsicElements['link']>\n scripts?: () => Array<React.JSX.IntrinsicElements['script']>\n headers?: (ctx: { loaderData: TLoaderData }) => Record<string, string>\n} & UpdatableStaticRouteOption\n\nexport type UpdatableStaticRouteOption =\n {} extends PickRequired<StaticDataRouteOption>\n ? {\n staticData?: StaticDataRouteOption\n }\n : {\n staticData: StaticDataRouteOption\n }\n\nexport type MetaDescriptor =\n | { charSet: 'utf-8' }\n | { title: string }\n | { name: string; content: string }\n | { property: string; content: string }\n | { httpEquiv: string; content: string }\n | { 'script:ld+json': LdJsonObject }\n | { tagName: 'meta' | 'link'; [name: string]: string }\n | Record<string, unknown>\n\ntype LdJsonObject = { [Key in string]: LdJsonValue } & {\n [Key in string]?: LdJsonValue | undefined\n}\ntype LdJsonArray = Array<LdJsonValue> | ReadonlyArray<LdJsonValue>\ntype LdJsonPrimitive = string | number | boolean | null\ntype LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray\n\nexport type RouteLinkEntry = {}\n\nexport interface SearchValidatorObj<TInput, TOutput> {\n parse: SearchValidatorFn<TInput, TOutput>\n}\n\nexport type AnySearchValidatorObj = SearchValidatorObj<any, any>\n\nexport interface SearchValidatorAdapter<TInput, TOutput> {\n types: {\n input: TInput\n output: TOutput\n }\n parse: (input: unknown) => TOutput\n}\n\nexport type AnySearchValidatorAdapter = SearchValidatorAdapter<any, any>\n\nexport type AnySearchValidatorFn = SearchValidatorFn<any, any>\n\nexport type SearchValidatorFn<TInput, TOutput> = (input: TInput) => TOutput\n\nexport type SearchValidator<TInput, TOutput> =\n | SearchValidatorObj<TInput, TOutput>\n | SearchValidatorFn<TInput, TOutput>\n | SearchValidatorAdapter<TInput, TOutput>\n | undefined\n\nexport type AnySearchValidator = SearchValidator<any, any>\n\nexport type DefaultSearchValidator = SearchValidator<\n Record<string, unknown>,\n AnySearchSchema\n>\n\nexport type RouteLoaderFn<\n in out TAllParams = {},\n in out TLoaderDeps extends Record<string, any> = {},\n in out TAllContext = AnyContext,\n TLoaderData = undefined,\n> = (\n match: LoaderFnContext<TAllParams, TLoaderDeps, TAllContext>,\n) => TLoaderData | Promise<TLoaderData>\n\nexport interface LoaderFnContext<\n in out TAllParams = {},\n in out TLoaderDeps = {},\n in out TAllContext = AnyContext,\n> {\n abortController: AbortController\n preload: boolean\n params: Expand<TAllParams>\n deps: TLoaderDeps\n context: TAllContext\n location: ParsedLocation // Do not supply search schema here so as to demotivate people from trying to shortcut loaderDeps\n /**\n * @deprecated Use `throw redirect({ to: '/somewhere' })` instead\n **/\n navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void>\n parentMatchPromise?: Promise<void>\n cause: 'preload' | 'enter' | 'stay'\n route: Route\n}\n\nexport type SearchFilter<TInput, TResult = TInput> = (prev: TInput) => TResult\n\nexport type ResolveId<\n TParentRoute,\n TCustomId extends string,\n TPath extends string,\n> = TParentRoute extends { id: infer TParentId extends string }\n ? RoutePrefix<TParentId, string extends TCustomId ? TPath : TCustomId>\n : RootRouteId\n\nexport type InferFullSearchSchema<TRoute> = TRoute extends {\n types: {\n fullSearchSchema: infer TFullSearchSchema\n }\n}\n ? TFullSearchSchema\n : {}\n\nexport type InferFullSearchSchemaInput<TRoute> = TRoute extends {\n types: {\n fullSearchSchemaInput: infer TFullSearchSchemaInput\n }\n}\n ? TFullSearchSchemaInput\n : {}\n\nexport type InferAllParams<TRoute> = TRoute extends {\n types: {\n allParams: infer TAllParams\n }\n}\n ? TAllParams\n : {}\n\nexport type InferAllContext<TRoute> = TRoute extends {\n types: {\n allContext: infer TAllContext\n }\n}\n ? TAllContext\n : {}\n\nexport type ResolveSearchSchemaFnInput<\n TSearchValidator extends AnySearchValidator,\n> = TSearchValidator extends (input: infer TSearchSchemaInput) => any\n ? TSearchSchemaInput extends SearchSchemaInput\n ? Omit<TSearchSchemaInput, keyof SearchSchemaInput>\n : ResolveSearchSchemaFn<TSearchValidator>\n : AnySearchSchema\n\nexport type ResolveSearchSchemaInput<\n TSearchValidator extends AnySearchValidator,\n> = TSearchValidator extends AnySearchValidatorAdapter\n ? TSearchValidator['types']['input']\n : TSearchValidator extends AnySearchValidatorObj\n ? ResolveSearchSchemaFnInput<TSearchValidator['parse']>\n : ResolveSearchSchemaFnInput<TSearchValidator>\n\nexport type ResolveSearchSchemaFn<TSearchValidator extends AnySearchValidator> =\n TSearchValidator extends (...args: any) => infer TSearchSchema\n ? TSearchSchema\n : AnySearchSchema\n\nexport type ResolveSearchSchema<TSearchValidator extends AnySearchValidator> =\n unknown extends TSearchValidator\n ? TSearchValidator\n : TSearchValidator extends AnySearchValidatorAdapter\n ? TSearchValidator['types']['output']\n : TSearchValidator extends AnySearchValidatorObj\n ? ResolveSearchSchemaFn<TSearchValidator['parse']>\n : ResolveSearchSchemaFn<TSearchValidator>\n\nexport type ResolveFullSearchSchema<\n TParentRoute extends AnyRoute,\n TSearchValidator extends AnySearchValidator,\n> = unknown extends TParentRoute\n ? ResolveSearchSchema<TSearchValidator>\n : Assign<\n InferFullSearchSchema<TParentRoute>,\n ResolveSearchSchema<TSearchValidator>\n >\n\nexport type ResolveFullSearchSchemaInput<\n TParentRoute extends AnyRoute,\n TSearchValidator extends AnySearchValidator,\n> = Assign<\n InferFullSearchSchemaInput<TParentRoute>,\n ResolveSearchSchemaInput<TSearchValidator>\n>\n\nexport type ResolveRouteContext<TRouteContextReturn> = [\n TRouteContextReturn,\n] extends [never]\n ? RouteContext\n : TRouteContextReturn\n\nexport type ResolveAllContext<\n TParentRoute extends AnyRoute,\n TRouteContext,\n> = Assign<InferAllContext<TParentRoute>, TRouteContext>\n\nexport type ResolveLoaderData<TLoaderDataReturn> = [TLoaderDataReturn] extends [\n never,\n]\n ? undefined\n : TLoaderDataReturn\n\nexport interface AnyRoute\n extends Route<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n > {}\n\nexport type AnyRouteWithContext<TContext> = Route<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n TContext,\n any,\n any\n>\n\nexport type ResolveAllParamsFromParent<\n TParentRoute extends AnyRoute,\n TParams,\n> = Assign<InferAllParams<TParentRoute>, TParams>\n\nexport type RouteConstraints = {\n TParentRoute: AnyRoute\n TPath: string\n TFullPath: string\n TCustomId: string\n TId: string\n TSearchSchema: AnySearchSchema\n TFullSearchSchema: AnySearchSchema\n TParams: Record<string, any>\n TAllParams: Record<string, any>\n TParentContext: AnyContext\n TRouteContext: RouteContext\n TAllContext: AnyContext\n TRouterContext: AnyContext\n TChildren: unknown\n TRouteTree: AnyRoute\n}\n\nexport function getRouteApi<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRouter extends AnyRouter = RegisteredRouter,\n TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>,\n TFullSearchSchema = TRoute['types']['fullSearchSchema'],\n TAllParams = TRoute['types']['allParams'],\n TAllContext = TRoute['types']['allContext'],\n TLoaderDeps = TRoute['types']['loaderDeps'],\n TLoaderData = TRoute['types']['loaderData'],\n>(id: TId) {\n return new RouteApi<\n TId,\n TRouter,\n TRoute,\n TFullSearchSchema,\n TAllParams,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >({ id })\n}\n\nexport class RouteApi<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRouter extends AnyRouter = RegisteredRouter,\n TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>,\n TFullSearchSchema = TRoute['types']['fullSearchSchema'],\n TAllParams = TRoute['types']['allParams'],\n TAllContext = TRoute['types']['allContext'],\n TLoaderDeps = TRoute['types']['loaderDeps'],\n TLoaderData = TRoute['types']['loaderData'],\n> {\n id: TId\n\n /**\n * @deprecated Use the `getRouteApi` function instead.\n */\n constructor({ id }: { id: TId }) {\n this.id = id as any\n }\n\n useMatch = <\n TRouteTree extends AnyRoute = TRouter['routeTree'],\n TRouteMatch = MakeRouteMatch<TRouteTree, TId>,\n TSelected = TRouteMatch,\n >(opts?: {\n select?: (match: TRouteMatch) => TSelected\n }): TSelected => {\n return useMatch({ select: opts?.select, from: this.id })\n }\n\n useRouteContext = <TSelected = Expand<TAllContext>>(opts?: {\n select?: (s: Expand<TAllContext>) => TSelected\n }): TSelected => {\n return useMatch({\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = Expand<TFullSearchSchema>>(opts?: {\n select?: (s: Expand<TFullSearchSchema>) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id })\n }\n\n useParams = <TSelected = Expand<TAllParams>>(opts?: {\n select?: (s: Expand<TAllParams>) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id })\n }\n\n useLoaderDeps = <TSelected = TLoaderDeps>(opts?: {\n select?: (s: TLoaderDeps) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.id, strict: false } as any)\n }\n\n useLoaderData = <TSelected = TLoaderData>(opts?: {\n select?: (s: TLoaderData) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.id, strict: false } as any)\n }\n\n useNavigate = (): UseNavigateResult<TRoute['fullPath']> => {\n return useNavigate({ from: this.id })\n }\n\n notFound = (opts?: NotFoundError) => {\n return notFound({ routeId: this.id as string, ...opts })\n }\n}\n\nexport class Route<\n in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n in out TPath extends RouteConstraints['TPath'] = '/',\n in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n in out TCustomId extends RouteConstraints['TCustomId'] = string,\n in out TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n in out TSearchValidator extends AnySearchValidator = DefaultSearchValidator,\n in out TParams = Record<ParsePathParams<TPath>, string>,\n in out TAllParams = ResolveAllParamsFromParent<TParentRoute, TParams>,\n TRouteContextReturn = RouteContext,\n in out TRouteContext = ResolveRouteContext<TRouteContextReturn>,\n in out TAllContext = ResolveAllContext<TParentRoute, TRouteContext>,\n in out TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n in out TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n in out TChildren = unknown,\n> {\n isRoot: TParentRoute extends Route<any> ? true : false\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchValidator,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n InferAllContext<TParentRoute>,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >\n\n // Set up in this.init()\n parentRoute!: TParentRoute\n id!: TId\n // customId!: TCustomId\n path!: TPath\n fullPath!: TFullPath\n to!: TrimPathRight<TFullPath>\n\n // Optional\n children?: TChildren\n originalIndex?: number\n router?: AnyRouter\n rank!: number\n lazyFn?: () => Promise<LazyRoute<any>>\n _lazyPromise?: Promise<void>\n\n /**\n * @deprecated Use the `createRoute` function instead.\n */\n constructor(\n options?: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchValidator,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n InferAllContext<TParentRoute>,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n ) {\n this.options = (options as any) || {}\n\n this.isRoot = !options?.getParentRoute as any\n invariant(\n !((options as any)?.id && (options as any)?.path),\n `Route cannot have both an 'id' and a 'path' option.`,\n )\n ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n types!: {\n parentRoute: TParentRoute\n path: TPath\n to: TrimPathRight<TFullPath>\n fullPath: TFullPath\n customId: TCustomId\n id: TId\n searchSchema: ResolveSearchSchema<TSearchValidator>\n searchSchemaInput: ResolveSearchSchemaInput<TSearchValidator>\n searchValidator: TSearchValidator\n fullSearchSchema: ResolveFullSearchSchema<TParentRoute, TSearchValidator>\n fullSearchSchemaInput: ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchValidator\n >\n params: TParams\n allParams: TAllParams\n routeContext: TRouteContext\n allContext: TAllContext\n children: TChildren\n loaderData: TLoaderData\n loaderDeps: TLoaderDeps\n }\n\n init = (opts: { originalIndex: number }): void => {\n this.originalIndex = opts.originalIndex\n\n const options = this.options as\n | (RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchValidator,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n InferAllContext<TParentRoute>,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n > &\n RoutePathOptionsIntersection<TCustomId, TPath>)\n | undefined\n\n const isRoot = !options?.path && !options?.id\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n this.parentRoute = this.options?.getParentRoute?.()\n\n if (isRoot) {\n this.path = rootRouteId as TPath\n } else {\n invariant(\n this.parentRoute,\n `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`,\n )\n }\n\n let path: undefined | string = isRoot ? rootRouteId : options.path\n\n // If the path is anything other than an index path, trim it up\n if (path && path !== '/') {\n path = trimPathLeft(path)\n }\n\n const customId = options?.id || path\n\n // Strip the parentId prefix from the first level of children\n let id = isRoot\n ? rootRouteId\n : joinPaths([\n this.parentRoute.id === rootRouteId ? '' : this.parentRoute.id,\n customId,\n ])\n\n if (path === rootRouteId) {\n path = '/'\n }\n\n if (id !== rootRouteId) {\n id = joinPaths(['/', id])\n }\n\n const fullPath =\n id === rootRouteId ? '/' : joinPaths([this.parentRoute.fullPath, path])\n\n this.path = path as TPath\n this.id = id as TId\n // this.customId = customId as TCustomId\n this.fullPath = fullPath as TFullPath\n this.to = fullPath as TrimPathRight<TFullPath>\n }\n\n addChildren<\n const TNewChildren extends\n | Record<string, AnyRoute>\n | ReadonlyArray<AnyRoute>,\n >(\n children: TNewChildren,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TNewChildren\n > {\n this.children = (\n Array.isArray(children) ? children : Object.values(children)\n ) as any\n return this as any\n }\n\n updateLoader = <TNewLoaderData = unknown>(options: {\n loader: RouteLoaderFn<TAllParams, TLoaderDeps, TAllContext, TNewLoaderData>\n }) => {\n Object.assign(this.options, options)\n return this as unknown as Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TLoaderDeps,\n TNewLoaderData,\n TChildren\n >\n }\n\n update = (\n options: UpdatableRouteOptions<\n TParentRoute,\n TCustomId,\n TAllParams,\n TSearchValidator,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps\n >,\n ): this => {\n Object.assign(this.options, options)\n return this\n }\n\n lazy = (lazyFn: () => Promise<LazyRoute<any>>): this => {\n this.lazyFn = lazyFn\n return this\n }\n\n useMatch = <\n TRouter extends AnyRouter = RegisteredRouter,\n TRouteTree extends AnyRoute = TRouter['routeTree'],\n TRouteMatch = MakeRouteMatch<TRouteTree, TId>,\n TSelected = TRouteMatch,\n >(opts?: {\n select?: (match: TRouteMatch) => TSelected\n }): TSelected => {\n return useMatch({ ...opts, from: this.id })\n }\n\n useRouteContext = <TSelected = Expand<TAllContext>>(opts?: {\n select?: (search: Expand<TAllContext>) => TSelected\n }): TSelected => {\n return useMatch({\n ...opts,\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <\n TSelected = Expand<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>,\n >(opts?: {\n select?: (\n search: Expand<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>,\n ) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id })\n }\n\n useParams = <TSelected = Expand<TAllParams>>(opts?: {\n select?: (search: Expand<TAllParams>) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id })\n }\n\n useLoaderDeps = <TSelected = TLoaderDeps>(opts?: {\n select?: (s: TLoaderDeps) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.id } as any)\n }\n\n useLoaderData = <TSelected = TLoaderData>(opts?: {\n select?: (search: TLoaderData) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<TFullPath> => {\n return useNavigate({ from: this.id })\n }\n}\n\nexport function createRoute<\n TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n TPath extends RouteConstraints['TPath'] = '/',\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n TCustomId extends RouteConstraints['TCustomId'] = string,\n TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n TSearchValidator extends AnySearchValidator = DefaultSearchValidator,\n TParams = Record<ParsePathParams<TPath>, string>,\n TAllParams = ResolveAllParamsFromParent<TParentRoute, TParams>,\n TRouteContextReturn = RouteContext,\n TRouteContext = ResolveRouteContext<TRouteContextReturn>,\n TAllContext = ResolveAllContext<TParentRoute, TRouteContext>,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n TChildren = unknown,\n>(\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchValidator,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n InferAllContext<TParentRoute>,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n) {\n return new Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TChildren\n >(options)\n}\n\nexport type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>\n\nexport type RootRouteOptions<\n TSearchValidator extends AnySearchValidator = DefaultSearchValidator,\n TRouteContextReturn = RouteContext,\n TRouteContext = ResolveRouteContext<TRouteContextReturn>,\n TRouterContext = {},\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n> = Omit<\n RouteOptions<\n any, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchValidator,\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext, // TParentAllContext\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderDataReturn, // TLoaderDataReturn,\n TLoaderData // TLoaderData,\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n | 'params'\n>\n\nexport function createRootRouteWithContext<TRouterContext extends {}>() {\n return <\n TSearchValidator extends AnySearchValidator = DefaultSearchValidator,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends\n RouteContext = ResolveRouteContext<TRouteContextReturn>,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n >(\n options?: RootRouteOptions<\n TSearchValidator,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n ) => {\n return createRootRoute<\n TSearchValidator,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData\n >(options as any)\n }\n}\n\n/**\n * @deprecated Use the `createRootRouteWithContext` function instead.\n */\nexport const rootRouteWithContext = createRootRouteWithContext\n\nexport class RootRoute<\n in out TSearchValidator extends AnySearchValidator = DefaultSearchValidator,\n TRouteContextReturn = RouteContext,\n in out TRouteContext = ResolveRouteContext<TRouteContextReturn>,\n in out TRouterContext = {},\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n in out TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n TChildren = unknown,\n> extends Route<\n any, // TParentRoute\n '/', // TPath\n '/', // TFullPath\n string, // TCustomId\n RootRouteId, // TId\n TSearchValidator, // TSearchValidator\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TChildren // TChildren\n> {\n /**\n * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.\n */\n constructor(\n options?: RootRouteOptions<\n TSearchValidator,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n ) {\n super(options as any)\n }\n\n addChildren<\n const TNewChildren extends\n | Record<string, AnyRoute>\n | ReadonlyArray<AnyRoute>,\n >(\n children: TNewChildren,\n ): RootRoute<\n TSearchValidator,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TNewChildren\n > {\n return super.addChildren(children)\n }\n}\n\nexport function createRootRoute<\n TSearchValidator extends AnySearchValidator = DefaultSearchValidator,\n TRouteContextReturn = RouteContext,\n TRouteContext = ResolveRouteContext<TRouteContextReturn>,\n TRouterContext = {},\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n>(\n options?: RootRouteOptions<\n TSearchValidator,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n) {\n return new RootRoute<\n TSearchValidator,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >(options)\n}\n\nexport type ResolveFullPath<\n TParentRoute extends AnyRoute,\n TPath extends string,\n TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>,\n> = TPrefixed extends RootRouteId ? '/' : TPrefixed\n\ntype RoutePrefix<\n TPrefix extends string,\n TPath extends string,\n> = string extends TPath\n ? RootRouteId\n : TPath extends string\n ? TPrefix extends RootRouteId\n ? TPath extends '/'\n ? '/'\n : `/${TrimPath<TPath>}`\n : `${TPrefix}/${TPath}` extends '/'\n ? '/'\n : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}`\n : never\n\nexport type TrimPath<T extends string> = '' extends T\n ? ''\n : TrimPathRight<TrimPathLeft<T>>\n\nexport type TrimPathLeft<T extends string> =\n T extends `${RootRouteId}/${infer U}`\n ? TrimPathLeft<U>\n : T extends `/${infer U}`\n ? TrimPathLeft<U>\n : T\nexport type TrimPathRight<T extends string> = T extends '/'\n ? '/'\n : T extends `${infer U}/`\n ? TrimPathRight<U>\n : T\n\nexport type RouteMask<TRouteTree extends AnyRoute> = {\n routeTree: TRouteTree\n from: RoutePaths<TRouteTree>\n to?: any\n params?: any\n search?: any\n hash?: any\n state?: any\n unmaskOnReload?: boolean\n}\n\nexport function createRouteMask<\n TRouteTree extends AnyRoute,\n TFrom extends RoutePaths<TRouteTree>,\n TTo extends string,\n>(\n opts: {\n routeTree: TRouteTree\n } & ToMaskOptions<Router<TRouteTree, 'never'>, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n return opts as any\n}\n\n/**\n * @deprecated Use `ErrorComponentProps` instead.\n */\nexport type ErrorRouteProps = {\n error: unknown\n info?: { componentStack: string }\n reset: () => void\n}\n\nexport type ErrorComponentProps = {\n error: Error\n info?: { componentStack: string }\n reset: () => void\n}\nexport type NotFoundRouteProps = {\n // TODO: Make sure this is `| null | undefined` (this is for global not-founds)\n data: unknown\n}\n//\n\nexport type ReactNode = any\n\nexport type SyncRouteComponent<TProps> =\n | ((props: TProps) => ReactNode)\n | React.LazyExoticComponent<(props: TProps) => ReactNode>\n\nexport type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport type RouteComponent<TProps = any> = AsyncRouteComponent<TProps>\n\nexport type ErrorRouteComponent = RouteComponent<ErrorComponentProps>\n\nexport type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>\n\nexport class NotFoundRoute<\n TParentRoute extends AnyRootRoute,\n TSearchValidator extends AnySearchValidator = DefaultSearchValidator,\n TRouteContextReturn = AnyContext,\n TRouteContext = RouteContext,\n TAllContext = ResolveAllContext<TParentRoute, TRouteContext>,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = {},\n TLoaderData = ResolveLoaderData<TLoaderDataReturn>,\n TChildren = unknown,\n> extends Route<\n TParentRoute,\n '/404',\n '/404',\n '404',\n '404',\n TSearchValidator,\n {},\n {},\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TChildren\n> {\n constructor(\n options: Omit<\n RouteOptions<\n TParentRoute,\n string,\n string,\n TSearchValidator,\n {},\n {},\n TRouteContextReturn,\n TRouteContext,\n InferAllContext<TParentRoute>,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n | 'path'\n | 'id'\n | 'params'\n >,\n ) {\n super({\n ...(options as any),\n id: '404',\n })\n }\n}\n"],"names":["useMatch","useSearch","useParams","useLoaderDeps","useLoaderData","useNavigate","notFound","options","rootRouteId","path","trimPathLeft","joinPaths"],"mappings":";;;;;;;;;;;;AAyjBO,SAAS,YASd,IAAS;AACT,SAAO,IAAI,SAST,EAAE,GAAA,CAAI;AACV;AAEO,MAAM,SASX;AAAA;AAAA;AAAA;AAAA,EAMA,YAAY,EAAE,MAAmB;AAIjC,SAAA,WAAW,CAIT,SAEe;AACR,aAAAA,SAAA,SAAS,EAAE,QAAQ,6BAAM,QAAQ,MAAM,KAAK,IAAI;AAAA,IAAA;AAGzD,SAAA,kBAAkB,CAAkC,SAEnC;AACf,aAAOA,kBAAS;AAAA,QACd,MAAM,KAAK;AAAA,QACX,QAAQ,CAAC,OAAY,6BAAM,UAAS,KAAK,OAAO,EAAE,OAAO,IAAI,EAAE;AAAA,MAAA,CAChE;AAAA,IAAA;AAGH,SAAA,YAAY,CAAwC,SAEnC;AACf,aAAOC,UAAAA,UAAU,EAAE,GAAG,MAAM,MAAM,KAAK,IAAI;AAAA,IAAA;AAG7C,SAAA,YAAY,CAAiC,SAE5B;AACf,aAAOC,UAAAA,UAAU,EAAE,GAAG,MAAM,MAAM,KAAK,IAAI;AAAA,IAAA;AAG7C,SAAA,gBAAgB,CAA0B,SAEzB;AACR,aAAAC,cAAA,cAAc,EAAE,GAAG,MAAM,MAA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