@tanstack/react-router 0.0.1-alpha.5 → 0.0.1-alpha.7

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.
@@ -106,9 +106,9 @@ function createReactRouter(opts) {
106
106
  }; // Get the active props
107
107
 
108
108
 
109
- const resolvedActiveProps = isActive ? (_functionalUpdate = index.functionalUpdate(activeProps)) != null ? _functionalUpdate : {} : {}; // Get the inactive props
109
+ const resolvedActiveProps = isActive ? (_functionalUpdate = index.functionalUpdate(activeProps, {})) != null ? _functionalUpdate : {} : {}; // Get the inactive props
110
110
 
111
- const resolvedInactiveProps = isActive ? {} : (_functionalUpdate2 = index.functionalUpdate(inactiveProps)) != null ? _functionalUpdate2 : {};
111
+ const resolvedInactiveProps = isActive ? {} : (_functionalUpdate2 = index.functionalUpdate(inactiveProps, {})) != null ? _functionalUpdate2 : {};
112
112
  return _rollupPluginBabelHelpers["extends"]({}, resolvedActiveProps, resolvedInactiveProps, rest, {
113
113
  href: disabled ? undefined : next.href,
114
114
  onClick: composeHandlers([handleClick, onClick]),
@@ -146,7 +146,7 @@ function createReactRouter(opts) {
146
146
  const params = route.matchRoute(rest, {
147
147
  pending,
148
148
  caseSensitive
149
- }); // useRouterSubscription(router)
149
+ });
150
150
 
151
151
  if (!params) {
152
152
  return null;
@@ -160,6 +160,10 @@ function createReactRouter(opts) {
160
160
  const coreRouter = index.createRouter(_rollupPluginBabelHelpers["extends"]({}, opts, {
161
161
  createRouter: router => {
162
162
  const routerExt = {
163
+ useState: () => {
164
+ useRouterSubscription(router);
165
+ return router.state;
166
+ },
163
167
  useRoute: routeId => {
164
168
  const route = router.getRoute(routeId);
165
169
  useRouterSubscription(router);
@@ -167,6 +171,7 @@ function createReactRouter(opts) {
167
171
  return route;
168
172
  },
169
173
  useMatch: routeId => {
174
+ useRouterSubscription(router);
170
175
  index.invariant(routeId !== index.rootRouteId, "\"" + index.rootRouteId + "\" cannot be used with useMatch! Did you mean to useRoute(\"" + index.rootRouteId + "\")?");
171
176
 
172
177
  const runtimeMatch = _useMatch();
@@ -174,7 +179,6 @@ function createReactRouter(opts) {
174
179
  const match = router.state.matches.find(d => d.routeId === routeId);
175
180
  index.invariant(match, "Could not find a match for route \"" + routeId + "\" being rendered in this component!");
176
181
  index.invariant(runtimeMatch.routeId == (match == null ? void 0 : match.routeId), "useMatch('" + (match == null ? void 0 : match.routeId) + "') is being called in a component that is meant to render the '" + runtimeMatch.routeId + "' route. Did you mean to 'useRoute(" + (match == null ? void 0 : match.routeId) + ")' instead?");
177
- useRouterSubscription(router);
178
182
 
179
183
  if (!match) {
180
184
  index.invariant('Match not found!');
@@ -205,10 +209,10 @@ function RouterProvider(_ref2) {
205
209
  rest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(_ref2, _excluded3);
206
210
 
207
211
  router.update(rest);
208
- shim.useSyncExternalStore(cb => router.subscribe(() => cb()), () => router.state);
212
+ useRouterSubscription(router);
209
213
  useLayoutEffect(() => {
210
- router.mount();
211
- }, []);
214
+ return router.mount();
215
+ }, [router]);
212
216
  return /*#__PURE__*/React__namespace.createElement(routerContext.Provider, {
213
217
  value: {
214
218
  router
@@ -217,38 +221,43 @@ function RouterProvider(_ref2) {
217
221
  value: router.state.matches
218
222
  }, children != null ? children : /*#__PURE__*/React__namespace.createElement(Outlet, null)));
219
223
  }
224
+
220
225
  function useRouter() {
221
226
  const value = React__namespace.useContext(routerContext);
222
227
  index.warning(!value, 'useRouter must be used inside a <Router> component!');
223
228
  useRouterSubscription(value.router);
224
229
  return value.router;
225
230
  }
231
+
226
232
  function useMatches() {
227
233
  return React__namespace.useContext(matchesContext);
228
- }
229
- function useParentMatches() {
230
- const router = useRouter();
234
+ } // function useParentMatches(): RouteMatch[] {
235
+ // const router = useRouter()
236
+ // const match = useMatch()
237
+ // const matches = router.state.matches
238
+ // return matches.slice(
239
+ // 0,
240
+ // matches.findIndex((d) => d.matchId === match.matchId) - 1,
241
+ // )
242
+ // }
231
243
 
232
- const match = _useMatch();
233
-
234
- const matches = router.state.matches;
235
- return matches.slice(0, matches.findIndex(d => d.matchId === match.matchId) - 1);
236
- }
237
244
 
238
245
  function _useMatch() {
239
246
  var _useMatches;
240
247
 
241
248
  return (_useMatches = useMatches()) == null ? void 0 : _useMatches[0];
242
249
  }
250
+
243
251
  function Outlet() {
244
- var _ref3, _childMatch$options$c;
252
+ var _childMatch$options$c;
245
253
 
246
254
  const router = useRouter();
247
255
  const [, ...matches] = useMatches();
248
256
  const childMatch = matches[0];
249
257
  if (!childMatch) return null;
250
- const element = (_ref3 = (() => {
251
- var _childMatch$__$errorE, _ref5;
258
+
259
+ const element = (() => {
260
+ var _childMatch$__$errorE, _ref4;
252
261
 
253
262
  if (!childMatch) {
254
263
  return null;
@@ -265,7 +274,7 @@ function Outlet() {
265
274
  throw childMatch.error;
266
275
  }
267
276
 
268
- return /*#__PURE__*/React__namespace.createElement(DefaultCatchBoundary, {
277
+ return /*#__PURE__*/React__namespace.createElement(DefaultErrorBoundary, {
269
278
  error: childMatch.error
270
279
  });
271
280
  }
@@ -277,17 +286,18 @@ function Outlet() {
277
286
  const pendingElement = (_childMatch$__$pendin = childMatch.__.pendingElement) != null ? _childMatch$__$pendin : router.options.defaultPendingElement;
278
287
 
279
288
  if (childMatch.options.pendingMs || pendingElement) {
280
- var _ref4;
289
+ var _ref3;
281
290
 
282
- return (_ref4 = pendingElement) != null ? _ref4 : null;
291
+ return (_ref3 = pendingElement) != null ? _ref3 : null;
283
292
  }
284
293
  }
285
294
 
286
295
  return null;
287
296
  }
288
297
 
289
- return (_ref5 = childMatch.__.element) != null ? _ref5 : router.options.defaultElement;
290
- })()) != null ? _ref3 : /*#__PURE__*/React__namespace.createElement(Outlet, null);
298
+ return (_ref4 = childMatch.__.element) != null ? _ref4 : router.options.defaultElement;
299
+ })();
300
+
291
301
  const catchElement = (_childMatch$options$c = childMatch == null ? void 0 : childMatch.options.catchElement) != null ? _childMatch$options$c : router.options.defaultCatchElement;
292
302
  return /*#__PURE__*/React__namespace.createElement(MatchesProvider, {
293
303
  value: matches,
@@ -323,7 +333,7 @@ class CatchBoundary extends React__namespace.Component {
323
333
  render() {
324
334
  var _this$props$catchElem;
325
335
 
326
- const catchElement = (_this$props$catchElem = this.props.catchElement) != null ? _this$props$catchElem : DefaultCatchBoundary;
336
+ const catchElement = (_this$props$catchElem = this.props.catchElement) != null ? _this$props$catchElem : DefaultErrorBoundary;
327
337
 
328
338
  if (this.state.error) {
329
339
  return typeof catchElement === 'function' ? catchElement(this.state) : catchElement;
@@ -334,10 +344,10 @@ class CatchBoundary extends React__namespace.Component {
334
344
 
335
345
  }
336
346
 
337
- function DefaultCatchBoundary(_ref6) {
347
+ function DefaultErrorBoundary(_ref5) {
338
348
  let {
339
349
  error
340
- } = _ref6;
350
+ } = _ref5;
341
351
  return /*#__PURE__*/React__namespace.createElement("div", {
342
352
  style: {
343
353
  padding: '.5rem',
@@ -371,8 +381,10 @@ function DefaultCatchBoundary(_ref6) {
371
381
  opacity: 0.5
372
382
  }
373
383
  }, "If you are the owner of this website, it's highly recommended that you configure your own custom Catch/Error boundaries for the router. You can optionally configure a boundary for each route."));
374
- }
384
+ } // TODO: Add prompt
375
385
 
386
+ exports.cascadeLoaderData = index.cascadeLoaderData;
387
+ exports.cleanPath = index.cleanPath;
376
388
  exports.createBrowserHistory = index.createBrowserHistory;
377
389
  exports.createHashHistory = index.createHashHistory;
378
390
  exports.createMemoryHistory = index.createMemoryHistory;
@@ -380,10 +392,14 @@ exports.createRoute = index.createRoute;
380
392
  exports.createRouteConfig = index.createRouteConfig;
381
393
  exports.createRouteMatch = index.createRouteMatch;
382
394
  exports.createRouter = index.createRouter;
395
+ exports.decode = index.decode;
383
396
  exports.defaultParseSearch = index.defaultParseSearch;
384
397
  exports.defaultStringifySearch = index.defaultStringifySearch;
398
+ exports.encode = index.encode;
385
399
  exports.functionalUpdate = index.functionalUpdate;
400
+ exports.interpolatePath = index.interpolatePath;
386
401
  exports.invariant = index.invariant;
402
+ exports.joinPaths = index.joinPaths;
387
403
  exports.last = index.last;
388
404
  exports.matchByPath = index.matchByPath;
389
405
  exports.matchPathname = index.matchPathname;
@@ -393,14 +409,13 @@ exports.replaceEqualDeep = index.replaceEqualDeep;
393
409
  exports.resolvePath = index.resolvePath;
394
410
  exports.rootRouteId = index.rootRouteId;
395
411
  exports.stringifySearchWith = index.stringifySearchWith;
412
+ exports.trimPath = index.trimPath;
413
+ exports.trimPathLeft = index.trimPathLeft;
414
+ exports.trimPathRight = index.trimPathRight;
396
415
  exports.warning = index.warning;
397
- exports.DefaultCatchBoundary = DefaultCatchBoundary;
416
+ exports.DefaultErrorBoundary = DefaultErrorBoundary;
398
417
  exports.MatchesProvider = MatchesProvider;
399
418
  exports.Outlet = Outlet;
400
419
  exports.RouterProvider = RouterProvider;
401
420
  exports.createReactRouter = createReactRouter;
402
- exports.useMatch = _useMatch;
403
- exports.useMatches = useMatches;
404
- exports.useParentMatches = useParentMatches;
405
- exports.useRouter = useRouter;
406
421
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { useSyncExternalStore } from 'use-sync-external-store/shim'\n\nimport {\n AnyRoute,\n RootRouteId,\n rootRouteId,\n Router,\n} from '@tanstack/router-core'\nimport {\n warning,\n RouterOptions,\n RouteMatch,\n MatchRouteOptions,\n RouteConfig,\n AnyRouteConfig,\n AnyAllRouteInfo,\n DefaultAllRouteInfo,\n functionalUpdate,\n createRouter,\n AnyRouteInfo,\n AllRouteInfo,\n RouteInfo,\n ValidFromPath,\n LinkOptions,\n RouteInfoByPath,\n ResolveRelativePath,\n NoInfer,\n ToOptions,\n invariant,\n} from '@tanstack/router-core'\n\nexport * from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Element: React.ReactNode\n AsyncElement: (opts: {\n params: Record<string, string>\n }) => Promise<React.ReactNode>\n SyncOrAsyncElement: React.ReactNode | FrameworkGenerics['AsyncElement']\n }\n\n interface Router<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>,\n > extends Pick<\n Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][RootRouteId]>,\n 'linkProps' | 'Link' | 'MatchRoute'\n > {\n useRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n useMatch: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n },\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, '/', TTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((\n params: RouteInfoByPath<\n TAllRouteInfo,\n ResolveRelativePath<'/', NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n\n interface Route<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouteInfo extends AnyRouteInfo = RouteInfo,\n > {\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n },\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((\n params: RouteInfoByPath<\n TAllRouteInfo,\n ResolveRelativePath<TRouteInfo['fullPath'], NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n}\n\ntype LinkPropsOptions<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TFrom extends ValidFromPath<TAllRouteInfo> = '/',\n TTo extends string = '.',\n> = LinkOptions<TAllRouteInfo, TFrom, TTo> & {\n // A function that returns additional props for the `active` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n activeProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n // A function that returns additional props for the `inactive` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n inactiveProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n}\n\nexport type PromptProps = {\n message: string\n when?: boolean | any\n children?: React.ReactNode\n}\n\n//\n\nconst matchesContext = React.createContext<RouteMatch[]>(null!)\nconst routerContext = React.createContext<{ router: Router<any, any> }>(null!)\n\n// Detect if we're in the DOM\nconst isDOM = Boolean(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement,\n)\n\nconst useLayoutEffect = isDOM ? React.useLayoutEffect : React.useEffect\n\nexport type MatchesProviderProps = {\n value: RouteMatch[]\n children: React.ReactNode\n}\n\nexport function MatchesProvider(props: MatchesProviderProps) {\n return <matchesContext.Provider {...props} />\n}\n\nconst useRouterSubscription = (router: Router<any, any>) => {\n useSyncExternalStore(\n (cb) => router.subscribe(() => cb()),\n () => router.state,\n )\n}\n\nexport function createReactRouter<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n>(opts: RouterOptions<TRouteConfig>): Router<TRouteConfig> {\n const makeRouteExt = (\n route: AnyRoute,\n router: Router<any, any>,\n ): Pick<AnyRoute, 'linkProps' | 'Link' | 'MatchRoute'> => {\n return {\n linkProps: (options) => {\n const {\n // custom props\n type,\n children,\n target,\n activeProps = () => ({ className: 'active' }),\n inactiveProps = () => ({}),\n activeOptions,\n disabled,\n // fromCurrent,\n hash,\n search,\n params,\n to,\n preload,\n preloadDelay,\n preloadMaxAge,\n replace,\n // element props\n style,\n className,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n onTouchEnd,\n ...rest\n } = options\n\n const linkInfo = route.buildLink(options)\n\n if (linkInfo.type === 'external') {\n const { href } = linkInfo\n return { href }\n }\n\n const {\n handleClick,\n handleFocus,\n handleEnter,\n handleLeave,\n isActive,\n next,\n } = linkInfo\n\n const composeHandlers =\n (handlers: (undefined | ((e: any) => void))[]) =>\n (e: React.SyntheticEvent) => {\n e.persist()\n handlers.forEach((handler) => {\n if (handler) handler(e)\n })\n }\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? functionalUpdate(activeProps) ?? {} : {}\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? {} : functionalUpdate(inactiveProps) ?? {}\n\n return {\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n ...rest,\n href: disabled ? undefined : next.href,\n onClick: composeHandlers([handleClick, onClick]),\n onFocus: composeHandlers([handleFocus, onFocus]),\n onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),\n onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),\n target,\n style: {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n },\n className:\n [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ') || undefined,\n ...(disabled\n ? {\n role: 'link',\n 'aria-disabled': true,\n }\n : undefined),\n ['data-status']: isActive ? 'active' : undefined,\n }\n },\n Link: React.forwardRef((props: any, ref) => {\n const linkProps = route.linkProps(props)\n\n useRouterSubscription(router)\n\n return (\n <a\n {...{\n ref: ref as any,\n ...linkProps,\n children:\n typeof props.children === 'function'\n ? props.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : props.children,\n }}\n />\n )\n }) as any,\n MatchRoute: (opts) => {\n const { pending, caseSensitive, children, ...rest } = opts\n\n const params = route.matchRoute(rest as any, {\n pending,\n caseSensitive,\n })\n\n // useRouterSubscription(router)\n\n if (!params) {\n return null\n }\n\n return typeof opts.children === 'function'\n ? opts.children(params as any)\n : (opts.children as any)\n },\n }\n }\n\n const coreRouter = createRouter<TRouteConfig>({\n ...opts,\n createRouter: (router) => {\n const routerExt: Pick<Router<any, any>, 'useRoute' | 'useMatch'> = {\n useRoute: (routeId) => {\n const route = router.getRoute(routeId)\n useRouterSubscription(router)\n invariant(\n route,\n `Could not find a route for route \"${\n routeId as string\n }\"! Did you forget to add it to your route config?`,\n )\n return route\n },\n useMatch: (routeId) => {\n invariant(\n routeId !== rootRouteId,\n `\"${rootRouteId}\" cannot be used with useMatch! Did you mean to useRoute(\"${rootRouteId}\")?`,\n )\n\n const runtimeMatch = useMatch()\n const match = router.state.matches.find((d) => d.routeId === routeId)\n\n invariant(\n match,\n `Could not find a match for route \"${\n routeId as string\n }\" being rendered in this component!`,\n )\n\n invariant(\n runtimeMatch.routeId == match?.routeId,\n `useMatch('${\n match?.routeId as string\n }') is being called in a component that is meant to render the '${\n runtimeMatch.routeId\n }' route. Did you mean to 'useRoute(${\n match?.routeId as string\n })' instead?`,\n )\n\n useRouterSubscription(router)\n\n if (!match) {\n invariant('Match not found!')\n }\n\n return match\n },\n }\n\n const routeExt = makeRouteExt(router.getRoute('/'), router)\n\n Object.assign(router, routerExt, routeExt)\n },\n createRoute: ({ router, route }) => {\n const routeExt = makeRouteExt(route, router)\n\n Object.assign(route, routeExt)\n },\n })\n\n return coreRouter as any\n}\n\nexport type RouterProps<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n> = RouterOptions<TRouteConfig> & {\n router: Router<TRouteConfig, TAllRouteInfo>\n // Children will default to `<Outlet />` if not provided\n children?: React.ReactNode\n}\n\nexport function RouterProvider<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n>({ children, router, ...rest }: RouterProps<TRouteConfig, TAllRouteInfo>) {\n router.update(rest)\n\n useSyncExternalStore(\n (cb) => router.subscribe(() => cb()),\n () => router.state,\n )\n\n useLayoutEffect(() => {\n router.mount()\n }, [])\n\n return (\n <routerContext.Provider value={{ router }}>\n <MatchesProvider value={router.state.matches}>\n {children ?? <Outlet />}\n </MatchesProvider>\n </routerContext.Provider>\n )\n}\n\nexport function useRouter(): Router {\n const value = React.useContext(routerContext)\n warning(!value, 'useRouter must be used inside a <Router> component!')\n\n useRouterSubscription(value.router)\n\n return value.router as Router\n}\n\nexport function useMatches(): RouteMatch[] {\n return React.useContext(matchesContext)\n}\n\nexport function useParentMatches(): RouteMatch[] {\n const router = useRouter()\n const match = useMatch()\n const matches = router.state.matches\n return matches.slice(\n 0,\n matches.findIndex((d) => d.matchId === match.matchId) - 1,\n )\n}\n\nexport function useMatch<T>(): RouteMatch {\n return useMatches()?.[0] as RouteMatch\n}\n\nexport function Outlet() {\n const router = useRouter()\n const [, ...matches] = useMatches()\n\n const childMatch = matches[0]\n\n if (!childMatch) return null\n\n const element = (((): React.ReactNode => {\n if (!childMatch) {\n return null\n }\n\n const errorElement =\n childMatch.__.errorElement ?? router.options.defaultErrorElement\n\n if (childMatch.status === 'error') {\n if (errorElement) {\n return errorElement as any\n }\n\n if (\n childMatch.options.useErrorBoundary ||\n router.options.useErrorBoundary\n ) {\n throw childMatch.error\n }\n\n return <DefaultCatchBoundary error={childMatch.error} />\n }\n\n if (childMatch.status === 'loading' || childMatch.status === 'idle') {\n if (childMatch.isPending) {\n const pendingElement =\n childMatch.__.pendingElement ?? router.options.defaultPendingElement\n\n if (childMatch.options.pendingMs || pendingElement) {\n return (pendingElement as any) ?? null\n }\n }\n\n return null\n }\n\n return (childMatch.__.element as any) ?? router.options.defaultElement\n })() as JSX.Element) ?? <Outlet />\n\n const catchElement =\n childMatch?.options.catchElement ?? router.options.defaultCatchElement\n\n return (\n <MatchesProvider value={matches} key={childMatch.matchId}>\n <CatchBoundary catchElement={catchElement}>{element}</CatchBoundary>\n </MatchesProvider>\n )\n}\n\nclass CatchBoundary extends React.Component<{\n children: any\n catchElement: any\n}> {\n state = {\n error: false,\n }\n componentDidCatch(error: any, info: any) {\n console.error(error)\n\n this.setState({\n error,\n info,\n })\n }\n reset = () => {\n this.setState({\n error: false,\n info: false,\n })\n }\n render() {\n const catchElement = this.props.catchElement ?? DefaultCatchBoundary\n\n if (this.state.error) {\n return typeof catchElement === 'function'\n ? catchElement(this.state)\n : catchElement\n }\n\n return this.props.children\n }\n}\n\nexport function DefaultCatchBoundary({ error }: { error: any }) {\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <strong style={{ fontSize: '1.2rem' }}>Something went wrong!</strong>\n <div style={{ height: '.5rem' }} />\n <div>\n <pre>\n {error.message ? (\n <code\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.5rem',\n color: 'red',\n }}\n >\n {error.message}\n </code>\n ) : null}\n </pre>\n </div>\n <div style={{ height: '1rem' }} />\n <div\n style={{\n fontSize: '.8em',\n borderLeft: '3px solid rgba(127, 127, 127, 1)',\n paddingLeft: '.5rem',\n opacity: 0.5,\n }}\n >\n If you are the owner of this website, it's highly recommended that you\n configure your own custom Catch/Error boundaries for the router. You can\n optionally configure a boundary for each route.\n </div>\n </div>\n )\n}\n"],"names":["matchesContext","React","createContext","routerContext","isDOM","Boolean","window","document","createElement","useLayoutEffect","useEffect","MatchesProvider","props","useRouterSubscription","router","useSyncExternalStore","cb","subscribe","state","createReactRouter","opts","makeRouteExt","route","linkProps","options","target","activeProps","className","inactiveProps","disabled","style","onClick","onFocus","onMouseEnter","onMouseLeave","rest","linkInfo","buildLink","type","href","handleClick","handleFocus","handleEnter","handleLeave","isActive","next","composeHandlers","handlers","e","persist","forEach","handler","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","_extends","undefined","filter","join","role","Link","forwardRef","ref","children","MatchRoute","pending","caseSensitive","params","matchRoute","coreRouter","createRouter","routerExt","useRoute","routeId","getRoute","invariant","useMatch","rootRouteId","runtimeMatch","match","matches","find","d","routeExt","Object","assign","createRoute","RouterProvider","_objectWithoutPropertiesLoose","update","mount","useRouter","value","useContext","warning","useMatches","useParentMatches","slice","findIndex","matchId","Outlet","childMatch","element","errorElement","__","defaultErrorElement","status","useErrorBoundary","error","isPending","pendingElement","defaultPendingElement","pendingMs","defaultElement","catchElement","defaultCatchElement","CatchBoundary","Component","reset","setState","info","componentDidCatch","console","render","DefaultCatchBoundary","padding","maxWidth","fontSize","height","message","border","borderRadius","color","borderLeft","paddingLeft","opacity"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+IA;AAEA,MAAMA,cAAc,gBAAGC,gBAAK,CAACC,aAAN,CAAkC,IAAlC,CAAvB,CAAA;AACA,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gBAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,KAAK,EAAE;AAAE+H,MAAAA,MAAM,EAAE,MAAA;AAAV,KAAA;AAAZ,GAAA,CApBF,eAqBE/H,gBAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AACE,IAAA,KAAK,EAAE;AACL8H,MAAAA,QAAQ,EAAE,MADL;AAELM,MAAAA,UAAU,EAAE,kCAFP;AAGLC,MAAAA,WAAW,EAAE,OAHR;AAILC,MAAAA,OAAO,EAAE,GAAA;AAJJ,KAAA;AADT,GAAA,EAAA,iMAAA,CArBF,CADF,CAAA;AAoCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { useSyncExternalStore } from 'use-sync-external-store/shim'\n\nimport {\n AnyRoute,\n RootRouteId,\n rootRouteId,\n Router,\n RouterState,\n} from '@tanstack/router-core'\nimport {\n warning,\n RouterOptions,\n RouteMatch,\n MatchRouteOptions,\n RouteConfig,\n AnyRouteConfig,\n AnyAllRouteInfo,\n DefaultAllRouteInfo,\n functionalUpdate,\n createRouter,\n AnyRouteInfo,\n AllRouteInfo,\n RouteInfo,\n ValidFromPath,\n LinkOptions,\n RouteInfoByPath,\n ResolveRelativePath,\n NoInfer,\n ToOptions,\n invariant,\n} from '@tanstack/router-core'\n\nexport * from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Element: React.ReactNode\n AsyncElement: (opts: {\n params: Record<string, string>\n }) => Promise<React.ReactNode>\n SyncOrAsyncElement: React.ReactNode | FrameworkGenerics['AsyncElement']\n }\n\n interface Router<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>,\n > extends Pick<\n Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][RootRouteId]>,\n 'linkProps' | 'Link' | 'MatchRoute'\n > {\n useState: () => RouterState\n useRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n useMatch: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n },\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, '/', TTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((\n params: RouteInfoByPath<\n TAllRouteInfo,\n ResolveRelativePath<'/', NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n\n interface Route<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouteInfo extends AnyRouteInfo = RouteInfo,\n > {\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n },\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((\n params: RouteInfoByPath<\n TAllRouteInfo,\n ResolveRelativePath<TRouteInfo['fullPath'], NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n}\n\ntype LinkPropsOptions<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TFrom extends ValidFromPath<TAllRouteInfo> = '/',\n TTo extends string = '.',\n> = LinkOptions<TAllRouteInfo, TFrom, TTo> & {\n // A function that returns additional props for the `active` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n activeProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n // A function that returns additional props for the `inactive` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n inactiveProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n}\n\nexport type PromptProps = {\n message: string\n when?: boolean | any\n children?: React.ReactNode\n}\n\n//\n\nconst matchesContext = React.createContext<RouteMatch[]>(null!)\nconst routerContext = React.createContext<{ router: Router<any, any> }>(null!)\n\n// Detect if we're in the DOM\nconst isDOM = Boolean(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement,\n)\n\nconst useLayoutEffect = isDOM ? React.useLayoutEffect : React.useEffect\n\nexport type MatchesProviderProps = {\n value: RouteMatch[]\n children: React.ReactNode\n}\n\nexport function MatchesProvider(props: MatchesProviderProps) {\n return <matchesContext.Provider {...props} />\n}\n\nconst useRouterSubscription = (router: Router<any, any>) => {\n useSyncExternalStore(\n (cb) => router.subscribe(() => cb()),\n () => router.state,\n )\n}\n\nexport function createReactRouter<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n>(opts: RouterOptions<TRouteConfig>): Router<TRouteConfig> {\n const makeRouteExt = (\n route: AnyRoute,\n router: Router<any, any>,\n ): Pick<AnyRoute, 'linkProps' | 'Link' | 'MatchRoute'> => {\n return {\n linkProps: (options) => {\n const {\n // custom props\n type,\n children,\n target,\n activeProps = () => ({ className: 'active' }),\n inactiveProps = () => ({}),\n activeOptions,\n disabled,\n // fromCurrent,\n hash,\n search,\n params,\n to,\n preload,\n preloadDelay,\n preloadMaxAge,\n replace,\n // element props\n style,\n className,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n onTouchEnd,\n ...rest\n } = options\n\n const linkInfo = route.buildLink(options)\n\n if (linkInfo.type === 'external') {\n const { href } = linkInfo\n return { href }\n }\n\n const {\n handleClick,\n handleFocus,\n handleEnter,\n handleLeave,\n isActive,\n next,\n } = linkInfo\n\n const composeHandlers =\n (handlers: (undefined | ((e: any) => void))[]) =>\n (e: React.SyntheticEvent) => {\n e.persist()\n handlers.forEach((handler) => {\n if (handler) handler(e)\n })\n }\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? functionalUpdate(activeProps, {}) ?? {} : {}\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? {} : functionalUpdate(inactiveProps, {}) ?? {}\n\n return {\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n ...rest,\n href: disabled ? undefined : next.href,\n onClick: composeHandlers([handleClick, onClick]),\n onFocus: composeHandlers([handleFocus, onFocus]),\n onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),\n onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),\n target,\n style: {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n },\n className:\n [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ') || undefined,\n ...(disabled\n ? {\n role: 'link',\n 'aria-disabled': true,\n }\n : undefined),\n ['data-status']: isActive ? 'active' : undefined,\n }\n },\n Link: React.forwardRef((props: any, ref) => {\n const linkProps = route.linkProps(props)\n\n useRouterSubscription(router)\n\n return (\n <a\n {...{\n ref: ref as any,\n ...linkProps,\n children:\n typeof props.children === 'function'\n ? props.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : props.children,\n }}\n />\n )\n }) as any,\n MatchRoute: (opts) => {\n const { pending, caseSensitive, children, ...rest } = opts\n\n const params = route.matchRoute(rest as any, {\n pending,\n caseSensitive,\n })\n\n if (!params) {\n return null\n }\n\n return typeof opts.children === 'function'\n ? opts.children(params as any)\n : (opts.children as any)\n },\n }\n }\n\n const coreRouter = createRouter<TRouteConfig>({\n ...opts,\n createRouter: (router) => {\n const routerExt: Pick<\n Router<any, any>,\n 'useRoute' | 'useMatch' | 'useState'\n > = {\n useState: () => {\n useRouterSubscription(router)\n return router.state\n },\n useRoute: (routeId) => {\n const route = router.getRoute(routeId)\n useRouterSubscription(router)\n invariant(\n route,\n `Could not find a route for route \"${\n routeId as string\n }\"! Did you forget to add it to your route config?`,\n )\n return route\n },\n useMatch: (routeId) => {\n useRouterSubscription(router)\n\n invariant(\n routeId !== rootRouteId,\n `\"${rootRouteId}\" cannot be used with useMatch! Did you mean to useRoute(\"${rootRouteId}\")?`,\n )\n\n const runtimeMatch = useMatch()\n const match = router.state.matches.find((d) => d.routeId === routeId)\n\n invariant(\n match,\n `Could not find a match for route \"${\n routeId as string\n }\" being rendered in this component!`,\n )\n\n invariant(\n runtimeMatch.routeId == match?.routeId,\n `useMatch('${\n match?.routeId as string\n }') is being called in a component that is meant to render the '${\n runtimeMatch.routeId\n }' route. Did you mean to 'useRoute(${\n match?.routeId as string\n })' instead?`,\n )\n\n if (!match) {\n invariant('Match not found!')\n }\n\n return match\n },\n }\n\n const routeExt = makeRouteExt(router.getRoute('/'), router)\n\n Object.assign(router, routerExt, routeExt)\n },\n createRoute: ({ router, route }) => {\n const routeExt = makeRouteExt(route, router)\n\n Object.assign(route, routeExt)\n },\n })\n\n return coreRouter as any\n}\n\nexport type RouterProps<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n> = RouterOptions<TRouteConfig> & {\n router: Router<TRouteConfig, TAllRouteInfo>\n // Children will default to `<Outlet />` if not provided\n children?: React.ReactNode\n}\n\nexport function RouterProvider<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n>({ children, router, ...rest }: RouterProps<TRouteConfig, TAllRouteInfo>) {\n router.update(rest)\n\n useRouterSubscription(router)\n\n useLayoutEffect(() => {\n return router.mount()\n }, [router])\n\n return (\n <routerContext.Provider value={{ router }}>\n <MatchesProvider value={router.state.matches}>\n {children ?? <Outlet />}\n </MatchesProvider>\n </routerContext.Provider>\n )\n}\n\nfunction useRouter(): Router {\n const value = React.useContext(routerContext)\n warning(!value, 'useRouter must be used inside a <Router> component!')\n\n useRouterSubscription(value.router)\n\n return value.router as Router\n}\n\nfunction useMatches(): RouteMatch[] {\n return React.useContext(matchesContext)\n}\n\n// function useParentMatches(): RouteMatch[] {\n// const router = useRouter()\n// const match = useMatch()\n// const matches = router.state.matches\n// return matches.slice(\n// 0,\n// matches.findIndex((d) => d.matchId === match.matchId) - 1,\n// )\n// }\n\nfunction useMatch<T>(): RouteMatch {\n return useMatches()?.[0] as RouteMatch\n}\n\nexport function Outlet() {\n const router = useRouter()\n const [, ...matches] = useMatches()\n\n const childMatch = matches[0]\n\n if (!childMatch) return null\n\n const element = ((): React.ReactNode => {\n if (!childMatch) {\n return null\n }\n\n const errorElement =\n childMatch.__.errorElement ?? router.options.defaultErrorElement\n\n if (childMatch.status === 'error') {\n if (errorElement) {\n return errorElement as any\n }\n\n if (\n childMatch.options.useErrorBoundary ||\n router.options.useErrorBoundary\n ) {\n throw childMatch.error\n }\n\n return <DefaultErrorBoundary error={childMatch.error} />\n }\n\n if (childMatch.status === 'loading' || childMatch.status === 'idle') {\n if (childMatch.isPending) {\n const pendingElement =\n childMatch.__.pendingElement ?? router.options.defaultPendingElement\n\n if (childMatch.options.pendingMs || pendingElement) {\n return (pendingElement as any) ?? null\n }\n }\n\n return null\n }\n\n return (childMatch.__.element as any) ?? router.options.defaultElement\n })() as JSX.Element\n\n const catchElement =\n childMatch?.options.catchElement ?? router.options.defaultCatchElement\n\n return (\n <MatchesProvider value={matches} key={childMatch.matchId}>\n <CatchBoundary catchElement={catchElement}>{element}</CatchBoundary>\n </MatchesProvider>\n )\n}\n\nclass CatchBoundary extends React.Component<{\n children: any\n catchElement: any\n}> {\n state = {\n error: false,\n }\n componentDidCatch(error: any, info: any) {\n console.error(error)\n\n this.setState({\n error,\n info,\n })\n }\n reset = () => {\n this.setState({\n error: false,\n info: false,\n })\n }\n render() {\n const catchElement = this.props.catchElement ?? DefaultErrorBoundary\n\n if (this.state.error) {\n return typeof catchElement === 'function'\n ? catchElement(this.state)\n : catchElement\n }\n\n return this.props.children\n }\n}\n\nexport function DefaultErrorBoundary({ error }: { error: any }) {\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <strong style={{ fontSize: '1.2rem' }}>Something went wrong!</strong>\n <div style={{ height: '.5rem' }} />\n <div>\n <pre>\n {error.message ? (\n <code\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.5rem',\n color: 'red',\n }}\n >\n {error.message}\n </code>\n ) : null}\n </pre>\n </div>\n <div style={{ height: '1rem' }} />\n <div\n style={{\n fontSize: '.8em',\n borderLeft: '3px solid rgba(127, 127, 127, 1)',\n paddingLeft: '.5rem',\n opacity: 0.5,\n }}\n >\n If you are the owner of this website, it's highly recommended that you\n configure your own custom Catch/Error boundaries for the router. You can\n optionally configure a boundary for each route.\n </div>\n </div>\n )\n}\n\n// TODO: Add prompt\n"],"names":["matchesContext","React","createContext","routerContext","isDOM","Boolean","window","document","createElement","useLayoutEffect","useEffect","MatchesProvider","props","useRouterSubscription","router","useSyncExternalStore","cb","subscribe","state","createReactRouter","opts","makeRouteExt","route","linkProps","options","target","activeProps","className","inactiveProps","disabled","style","onClick","onFocus","onMouseEnter","onMouseLeave","rest","linkInfo","buildLink","type","href","handleClick","handleFocus","handleEnter","handleLeave","isActive","next","composeHandlers","handlers","e","persist","forEach","handler","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","_extends","undefined","filter","join","role","Link","forwardRef","ref","children","MatchRoute","pending","caseSensitive","params","matchRoute","coreRouter","createRouter","routerExt","useState","useRoute","routeId","getRoute","invariant","useMatch","rootRouteId","runtimeMatch","match","matches","find","d","routeExt","Object","assign","createRoute","RouterProvider","_objectWithoutPropertiesLoose","update","mount","useRouter","value","useContext","warning","useMatches","Outlet","childMatch","element","errorElement","__","defaultErrorElement","status","useErrorBoundary","error","isPending","pendingElement","defaultPendingElement","pendingMs","defaultElement","catchElement","defaultCatchElement","matchId","CatchBoundary","Component","reset","setState","info","componentDidCatch","console","render","DefaultErrorBoundary","padding","maxWidth","fontSize","height","message","border","borderRadius","color","borderLeft","paddingLeft","opacity"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiJA;AAEA,MAAMA,cAAc,gBAAGC,gBAAK,CAACC,aAAN,CAAkC,IAAlC,CAAvB,CAAA;AACA,MAAMC,aAAa,gBAAGF,gBAAK,CAACC,aAAN,CAAkD,IAAlD,CAAtB;;AAGA,MAAME,KAAK,GAAGC,OAAO,CACnB,OAAOC,MAAP,KAAkB,WAAlB,IACEA,MAAM,CAACC,QADT,IAEED,MAAM,CAACC,QAAP,CAAgBC,aAHC,CAArB,CAAA;AAMA,MA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