react-router 6.2.2 → 6.4.0-pre.10

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-router.development.js","sources":["../lib/use-sync-external-store-shim/useSyncExternalStoreShimClient.ts","../lib/use-sync-external-store-shim/useSyncExternalStoreShimServer.ts","../lib/use-sync-external-store-shim/index.ts","../lib/context.ts","../lib/hooks.tsx","../lib/components.tsx"],"sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport * as React from \"react\";\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction isPolyfill(x: any, y: any) {\n return (\n (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare\n );\n}\n\nconst is: (x: any, y: any) => boolean =\n typeof Object.is === \"function\" ? Object.is : isPolyfill;\n\n// Intentionally not using named imports because Rollup uses dynamic\n// dispatch for CommonJS interop named imports.\nconst { useState, useEffect, useLayoutEffect, useDebugValue } = React;\n\nlet didWarnOld18Alpha = false;\nlet didWarnUncachedGetSnapshot = false;\n\n// Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\nexport function useSyncExternalStore<T>(\n subscribe: (fn: () => void) => () => void,\n getSnapshot: () => T,\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n getServerSnapshot?: () => T\n): T {\n if (__DEV__) {\n if (!didWarnOld18Alpha) {\n if (\"startTransition\" in React) {\n didWarnOld18Alpha = true;\n console.error(\n \"You are using an outdated, pre-release alpha of React 18 that \" +\n \"does not support useSyncExternalStore. The \" +\n \"use-sync-external-store shim will not work correctly. Upgrade \" +\n \"to a newer pre-release.\"\n );\n }\n }\n }\n\n // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n const value = getSnapshot();\n if (__DEV__) {\n if (!didWarnUncachedGetSnapshot) {\n const cachedValue = getSnapshot();\n if (!is(value, cachedValue)) {\n console.error(\n \"The result of getSnapshot should be cached to avoid an infinite loop\"\n );\n didWarnUncachedGetSnapshot = true;\n }\n }\n }\n\n // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n const [{ inst }, forceUpdate] = useState({ inst: { value, getSnapshot } });\n\n // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n useLayoutEffect(() => {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n\n // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [subscribe, value, getSnapshot]);\n\n useEffect(() => {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst });\n }\n const handleStoreChange = () => {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst });\n }\n };\n // Subscribe to the store and return a clean-up function.\n return subscribe(handleStoreChange);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [subscribe]);\n\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst: any) {\n const latestGetSnapshot = inst.getSnapshot;\n const prevValue = inst.value;\n try {\n const nextValue = latestGetSnapshot();\n return !is(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\n\nexport function useSyncExternalStore<T>(\n subscribe: (fn: () => void) => () => void,\n getSnapshot: () => T,\n getServerSnapshot?: () => T\n): T {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n","/**\n * Inlined into the react-router repo since use-sync-external-store does not\n * provide a UMD-compatible package, so we need this to be able to distribute\n * UMD react-router bundles\n */\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\n\nimport * as React from \"react\";\n\nimport { useSyncExternalStore as client } from \"./useSyncExternalStoreShimClient\";\nimport { useSyncExternalStore as server } from \"./useSyncExternalStoreShimServer\";\n\nconst canUseDOM: boolean = !!(\n typeof window !== \"undefined\" &&\n typeof window.document !== \"undefined\" &&\n typeof window.document.createElement !== \"undefined\"\n);\nconst isServerEnvironment = !canUseDOM;\nconst shim = isServerEnvironment ? server : client;\n\nexport const useSyncExternalStore =\n \"useSyncExternalStore\" in React\n ? // @ts-expect-error\n ((module) => module.useSyncExternalStore)(React)\n : shim;\n","import * as React from \"react\";\nimport type {\n History,\n Location,\n RouteMatch,\n Router,\n StaticHandlerContext,\n To,\n} from \"@remix-run/router\";\nimport { Action as NavigationType } from \"@remix-run/router\";\n\n// Contexts for data routers\nexport const DataStaticRouterContext =\n React.createContext<StaticHandlerContext | null>(null);\nif (__DEV__) {\n DataStaticRouterContext.displayName = \"DataStaticRouterContext\";\n}\n\nexport interface DataRouterContextObject extends NavigationContextObject {\n router: Router;\n}\n\nexport const DataRouterContext =\n React.createContext<DataRouterContextObject | null>(null);\nif (__DEV__) {\n DataRouterContext.displayName = \"DataRouter\";\n}\n\nexport const DataRouterStateContext = React.createContext<\n Router[\"state\"] | null\n>(null);\nif (__DEV__) {\n DataRouterStateContext.displayName = \"DataRouterState\";\n}\n\nexport const DeferredContext = React.createContext<any | null>(null);\nif (__DEV__) {\n DeferredContext.displayName = \"Deferred\";\n}\n\nexport interface NavigateOptions {\n replace?: boolean;\n state?: any;\n resetScroll?: boolean;\n}\n\n/**\n * A Navigator is a \"location changer\"; it's how you get to different locations.\n *\n * Every history instance conforms to the Navigator interface, but the\n * distinction is useful primarily when it comes to the low-level <Router> API\n * where both the location and a navigator must be provided separately in order\n * to avoid \"tearing\" that may occur in a suspense-enabled app if the action\n * and/or location were to be read directly from the history instance.\n */\nexport interface Navigator {\n createHref: History[\"createHref\"];\n go: History[\"go\"];\n push(to: To, state?: any, opts?: NavigateOptions): void;\n replace(to: To, state?: any, opts?: NavigateOptions): void;\n}\n\ninterface NavigationContextObject {\n basename: string;\n navigator: Navigator;\n static: boolean;\n}\n\nexport const NavigationContext = React.createContext<NavigationContextObject>(\n null!\n);\n\nif (__DEV__) {\n NavigationContext.displayName = \"Navigation\";\n}\n\ninterface LocationContextObject {\n location: Location;\n navigationType: NavigationType;\n}\n\nexport const LocationContext = React.createContext<LocationContextObject>(\n null!\n);\n\nif (__DEV__) {\n LocationContext.displayName = \"Location\";\n}\n\nexport interface RouteContextObject {\n outlet: React.ReactElement | null;\n matches: RouteMatch[];\n}\n\nexport const RouteContext = React.createContext<RouteContextObject>({\n outlet: null,\n matches: [],\n});\n\nif (__DEV__) {\n RouteContext.displayName = \"Route\";\n}\n\nexport const RouteErrorContext = React.createContext<any>(null);\n\nif (__DEV__) {\n RouteErrorContext.displayName = \"RouteError\";\n}\n","import * as React from \"react\";\nimport {\n isRouteErrorResponse,\n Location,\n ParamParseKey,\n Params,\n Path,\n PathMatch,\n PathPattern,\n RouteMatch,\n RouteObject,\n Router as RemixRouter,\n To,\n} from \"@remix-run/router\";\nimport {\n Action as NavigationType,\n invariant,\n joinPaths,\n matchPath,\n matchRoutes,\n parsePath,\n resolveTo,\n warning,\n} from \"@remix-run/router\";\n\nimport {\n DataRouterContext,\n DataRouterStateContext,\n LocationContext,\n NavigationContext,\n NavigateOptions,\n RouteContext,\n RouteErrorContext,\n DeferredContext,\n RouteContextObject,\n DataStaticRouterContext,\n} from \"./context\";\n\n/**\n * Returns the full href for the given \"to\" value. This is useful for building\n * custom links that are also accessible and preserve right-click behavior.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-href\n */\nexport function useHref(to: To): string {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useHref() may be used only in the context of a <Router> component.`\n );\n\n let { basename, navigator } = React.useContext(NavigationContext);\n let { hash, pathname, search } = useResolvedPath(to);\n\n let joinedPathname = pathname;\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to creating the href. If this is a root navigation, then just use the raw\n // basename which allows the basename to have full control over the presence\n // of a trailing slash on root links\n if (basename !== \"/\") {\n joinedPathname =\n pathname === \"/\" ? basename : joinPaths([basename, pathname]);\n }\n\n return navigator.createHref({ pathname: joinedPathname, search, hash });\n}\n\n/**\n * Returns true if this component is a descendant of a <Router>.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-in-router-context\n */\nexport function useInRouterContext(): boolean {\n return React.useContext(LocationContext) != null;\n}\n\n/**\n * Returns the current location object, which represents the current URL in web\n * browsers.\n *\n * Note: If you're using this it may mean you're doing some of your own\n * \"routing\" in your app, and we'd like to know what your use case is. We may\n * be able to provide something higher-level to better suit your needs.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-location\n */\nexport function useLocation(): Location {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useLocation() may be used only in the context of a <Router> component.`\n );\n\n return React.useContext(LocationContext).location;\n}\n\n/**\n * Returns the current navigation action which describes how the router came to\n * the current location, either by a pop, push, or replace on the history stack.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-navigation-type\n */\nexport function useNavigationType(): NavigationType {\n return React.useContext(LocationContext).navigationType;\n}\n\n/**\n * Returns true if the URL for the given \"to\" value matches the current URL.\n * This is useful for components that need to know \"active\" state, e.g.\n * <NavLink>.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-match\n */\nexport function useMatch<\n ParamKey extends ParamParseKey<Path>,\n Path extends string\n>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useMatch() may be used only in the context of a <Router> component.`\n );\n\n let { pathname } = useLocation();\n return React.useMemo(\n () => matchPath<ParamKey, Path>(pattern, pathname),\n [pathname, pattern]\n );\n}\n\n/**\n * The interface for the navigate() function returned from useNavigate().\n */\nexport interface NavigateFunction {\n (to: To, options?: NavigateOptions): void;\n (delta: number): void;\n}\n\n/**\n * When processing relative navigation we want to ignore ancestor routes that\n * do not contribute to the path, such that index/pathless layout routes don't\n * interfere.\n *\n * For example, when moving a route element into an index route and/or a\n * pathless layout route, relative link behavior contained within should stay\n * the same. Both of the following examples should link back to the root:\n *\n * <Route path=\"/\">\n * <Route path=\"accounts\" element={<Link to=\"..\"}>\n * </Route>\n *\n * <Route path=\"/\">\n * <Route path=\"accounts\">\n * <Route element={<AccountsLayout />}> // <-- Does not contribute\n * <Route index element={<Link to=\"..\"} /> // <-- Does not contribute\n * </Route\n * </Route>\n * </Route>\n */\nfunction getPathContributingMatches(matches: RouteMatch[]) {\n return matches.filter(\n (match, index) =>\n index === 0 ||\n (!match.route.index &&\n match.pathnameBase !== matches[index - 1].pathnameBase)\n );\n}\n\n/**\n * Returns an imperative method for changing the location. Used by <Link>s, but\n * may also be used by other elements to change the location.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-navigate\n */\nexport function useNavigate(): NavigateFunction {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useNavigate() may be used only in the context of a <Router> component.`\n );\n\n let { basename, navigator } = React.useContext(NavigationContext);\n let { matches } = React.useContext(RouteContext);\n let { pathname: locationPathname } = useLocation();\n\n let routePathnamesJson = JSON.stringify(\n getPathContributingMatches(matches).map((match) => match.pathnameBase)\n );\n\n let activeRef = React.useRef(false);\n React.useEffect(() => {\n activeRef.current = true;\n });\n\n let navigate: NavigateFunction = React.useCallback(\n (to: To | number, options: NavigateOptions = {}) => {\n warning(\n activeRef.current,\n `You should call navigate() in a React.useEffect(), not when ` +\n `your component is first rendered.`\n );\n\n if (!activeRef.current) return;\n\n if (typeof to === \"number\") {\n navigator.go(to);\n return;\n }\n\n let path = resolveTo(\n to,\n JSON.parse(routePathnamesJson),\n locationPathname\n );\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to handing off to history. If this is a root navigation, then we\n // navigate to the raw basename which allows the basename to have full\n // control over the presence of a trailing slash on root links\n if (basename !== \"/\") {\n path.pathname =\n path.pathname === \"/\"\n ? basename\n : joinPaths([basename, path.pathname]);\n }\n\n (!!options.replace ? navigator.replace : navigator.push)(\n path,\n options.state,\n options\n );\n },\n [basename, navigator, routePathnamesJson, locationPathname]\n );\n\n return navigate;\n}\n\nconst OutletContext = React.createContext<unknown>(null);\n\n/**\n * Returns the context (if provided) for the child route at this level of the route\n * hierarchy.\n * @see https://reactrouter.com/docs/en/v6/hooks/use-outlet-context\n */\nexport function useOutletContext<Context = unknown>(): Context {\n return React.useContext(OutletContext) as Context;\n}\n\n/**\n * Returns the element for the child route at this level of the route\n * hierarchy. Used internally by <Outlet> to render child routes.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-outlet\n */\nexport function useOutlet(context?: unknown): React.ReactElement | null {\n let outlet = React.useContext(RouteContext).outlet;\n if (outlet) {\n return (\n <OutletContext.Provider value={context}>{outlet}</OutletContext.Provider>\n );\n }\n return outlet;\n}\n\n/**\n * Returns an object of key/value pairs of the dynamic params from the current\n * URL that were matched by the route path.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-params\n */\nexport function useParams<\n ParamsOrKey extends string | Record<string, string | undefined> = string\n>(): Readonly<\n [ParamsOrKey] extends [string] ? Params<ParamsOrKey> : Partial<ParamsOrKey>\n> {\n let { matches } = React.useContext(RouteContext);\n let routeMatch = matches[matches.length - 1];\n return routeMatch ? (routeMatch.params as any) : {};\n}\n\n/**\n * Resolves the pathname of the given `to` value against the current location.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-resolved-path\n */\nexport function useResolvedPath(to: To): Path {\n let { matches } = React.useContext(RouteContext);\n let { pathname: locationPathname } = useLocation();\n\n let routePathnamesJson = JSON.stringify(\n getPathContributingMatches(matches).map((match) => match.pathnameBase)\n );\n\n return React.useMemo(\n () => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname),\n [to, routePathnamesJson, locationPathname]\n );\n}\n\n/**\n * Returns the element of the route that matched the current location, prepared\n * with the correct context to render the remainder of the route tree. Route\n * elements in the tree must render an <Outlet> to render their child route's\n * element.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-routes\n */\nexport function useRoutes(\n routes: RouteObject[],\n locationArg?: Partial<Location> | string\n): React.ReactElement | null {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useRoutes() may be used only in the context of a <Router> component.`\n );\n\n let dataRouterStateContext = React.useContext(DataRouterStateContext);\n let { matches: parentMatches } = React.useContext(RouteContext);\n let routeMatch = parentMatches[parentMatches.length - 1];\n let parentParams = routeMatch ? routeMatch.params : {};\n let parentPathname = routeMatch ? routeMatch.pathname : \"/\";\n let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : \"/\";\n let parentRoute = routeMatch && routeMatch.route;\n\n if (__DEV__) {\n // You won't get a warning about 2 different <Routes> under a <Route>\n // without a trailing *, but this is a best-effort warning anyway since we\n // cannot even give the warning unless they land at the parent route.\n //\n // Example:\n //\n // <Routes>\n // {/* This route path MUST end with /* because otherwise\n // it will never match /blog/post/123 */}\n // <Route path=\"blog\" element={<Blog />} />\n // <Route path=\"blog/feed\" element={<BlogFeed />} />\n // </Routes>\n //\n // function Blog() {\n // return (\n // <Routes>\n // <Route path=\"post/:id\" element={<Post />} />\n // </Routes>\n // );\n // }\n let parentPath = (parentRoute && parentRoute.path) || \"\";\n warningOnce(\n parentPathname,\n !parentRoute || parentPath.endsWith(\"*\"),\n `You rendered descendant <Routes> (or called \\`useRoutes()\\`) at ` +\n `\"${parentPathname}\" (under <Route path=\"${parentPath}\">) but the ` +\n `parent route path has no trailing \"*\". This means if you navigate ` +\n `deeper, the parent won't match anymore and therefore the child ` +\n `routes will never render.\\n\\n` +\n `Please change the parent <Route path=\"${parentPath}\"> to <Route ` +\n `path=\"${parentPath === \"/\" ? \"*\" : `${parentPath}/*`}\">.`\n );\n }\n\n let locationFromContext = useLocation();\n\n let location;\n if (locationArg) {\n let parsedLocationArg =\n typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n\n invariant(\n parentPathnameBase === \"/\" ||\n parsedLocationArg.pathname?.startsWith(parentPathnameBase),\n `When overriding the location using \\`<Routes location>\\` or \\`useRoutes(routes, location)\\`, ` +\n `the location pathname must begin with the portion of the URL pathname that was ` +\n `matched by all parent routes. The current pathname base is \"${parentPathnameBase}\" ` +\n `but pathname \"${parsedLocationArg.pathname}\" was given in the \\`location\\` prop.`\n );\n\n location = parsedLocationArg;\n } else {\n location = locationFromContext;\n }\n\n let pathname = location.pathname || \"/\";\n let remainingPathname =\n parentPathnameBase === \"/\"\n ? pathname\n : pathname.slice(parentPathnameBase.length) || \"/\";\n\n let matches = matchRoutes(routes, { pathname: remainingPathname });\n\n if (__DEV__) {\n warning(\n parentRoute || matches != null,\n `No routes matched location \"${location.pathname}${location.search}${location.hash}\" `\n );\n\n warning(\n matches == null ||\n matches[matches.length - 1].route.element !== undefined,\n `Matched leaf route at location \"${location.pathname}${location.search}${location.hash}\" does not have an element. ` +\n `This means it will render an <Outlet /> with a null value by default resulting in an \"empty\" page.`\n );\n }\n\n return _renderMatches(\n matches &&\n matches.map((match) =>\n Object.assign({}, match, {\n params: Object.assign({}, parentParams, match.params),\n pathname: joinPaths([parentPathnameBase, match.pathname]),\n pathnameBase:\n match.pathnameBase === \"/\"\n ? parentPathnameBase\n : joinPaths([parentPathnameBase, match.pathnameBase]),\n })\n ),\n parentMatches,\n dataRouterStateContext || undefined\n );\n}\n\nfunction DefaultErrorElement() {\n let error = useRouteError();\n let message = isRouteErrorResponse(error)\n ? `${error.status} ${error.statusText}`\n : error instanceof Error\n ? error.message\n : JSON.stringify(error);\n let stack = error instanceof Error ? error.stack : null;\n let lightgrey = \"rgba(200,200,200, 0.5)\";\n let preStyles = { padding: \"0.5rem\", backgroundColor: lightgrey };\n let codeStyles = { padding: \"2px 4px\", backgroundColor: lightgrey };\n return (\n <>\n <h2>Unhandled Thrown Error!</h2>\n <h3 style={{ fontStyle: \"italic\" }}>{message}</h3>\n {stack ? <pre style={preStyles}>{stack}</pre> : null}\n <p>💿 Hey developer 👋</p>\n <p>\n You can provide a way better UX than this when your app throws errors by\n providing your own&nbsp;\n <code style={codeStyles}>errorElement</code> props on&nbsp;\n <code style={codeStyles}>&lt;Route&gt;</code>\n </p>\n </>\n );\n}\n\ntype RenderErrorBoundaryProps = React.PropsWithChildren<{\n location: Location;\n error: any;\n component: React.ReactNode;\n}>;\n\ntype RenderErrorBoundaryState = {\n location: Location;\n error: any;\n};\n\nexport class RenderErrorBoundary extends React.Component<\n RenderErrorBoundaryProps,\n RenderErrorBoundaryState\n> {\n constructor(props: RenderErrorBoundaryProps) {\n super(props);\n this.state = {\n location: props.location,\n error: props.error,\n };\n }\n\n static getDerivedStateFromError(error: any) {\n return { error: error };\n }\n\n static getDerivedStateFromProps(\n props: RenderErrorBoundaryProps,\n state: RenderErrorBoundaryState\n ) {\n // When we get into an error state, the user will likely click \"back\" to the\n // previous page that didn't have an error. Because this wraps the entire\n // application, that will have no effect--the error page continues to display.\n // This gives us a mechanism to recover from the error when the location changes.\n //\n // Whether we're in an error state or not, we update the location in state\n // so that when we are in an error state, it gets reset when a new location\n // comes in and the user recovers from the error.\n if (state.location !== props.location) {\n return {\n error: props.error,\n location: props.location,\n };\n }\n\n // If we're not changing locations, preserve the location but still surface\n // any new errors that may come through. We retain the existing error, we do\n // this because the error provided from the app state may be cleared without\n // the location changing.\n return {\n error: props.error || state.error,\n location: state.location,\n };\n }\n\n componentDidCatch(error: any, errorInfo: any) {\n console.error(\n \"React Router caught the following error during render\",\n error,\n errorInfo\n );\n }\n\n render() {\n return this.state.error ? (\n <RouteErrorContext.Provider\n value={this.state.error}\n children={this.props.component}\n />\n ) : (\n this.props.children\n );\n }\n}\n\ninterface RenderedRouteProps {\n routeContext: RouteContextObject;\n match: RouteMatch<string, RouteObject>;\n children: React.ReactNode | null;\n}\n\nfunction RenderedRoute({ routeContext, match, children }: RenderedRouteProps) {\n let dataStaticRouterContext = React.useContext(DataStaticRouterContext);\n\n // Track how deep we got in our render pass to emulate SSR componentDidCatch\n // in a DataStaticRouter\n if (dataStaticRouterContext && match.route.errorElement) {\n dataStaticRouterContext._deepestRenderedBoundaryId = match.route.id;\n }\n\n return (\n <RouteContext.Provider value={routeContext}>\n {children}\n </RouteContext.Provider>\n );\n}\n\nexport function _renderMatches(\n matches: RouteMatch[] | null,\n parentMatches: RouteMatch[] = [],\n dataRouterState?: RemixRouter[\"state\"]\n): React.ReactElement | null {\n if (matches == null) {\n if (dataRouterState?.errors) {\n // Don't bail if we have data router errors so we can render them in the\n // boundary. Use the pre-matched (or shimmed) matches\n matches = dataRouterState.matches;\n } else {\n return null;\n }\n }\n\n let renderedMatches = matches;\n\n // If we have data errors, trim matches to the highest error boundary\n let errors = dataRouterState?.errors;\n if (errors != null) {\n let errorIndex = renderedMatches.findIndex(\n (m) => m.route.id && errors?.[m.route.id]\n );\n invariant(\n errorIndex >= 0,\n `Could not find a matching route for the current errors: ${errors}`\n );\n renderedMatches = renderedMatches.slice(\n 0,\n Math.min(renderedMatches.length, errorIndex + 1)\n );\n }\n\n return renderedMatches.reduceRight((outlet, match, index) => {\n let error = match.route.id ? errors?.[match.route.id] : null;\n // Only data routers handle errors\n let errorElement = dataRouterState\n ? match.route.errorElement || <DefaultErrorElement />\n : null;\n let getChildren = () => (\n <RenderedRoute\n match={match}\n routeContext={{\n outlet,\n matches: parentMatches.concat(renderedMatches.slice(0, index + 1)),\n }}\n >\n {error\n ? errorElement\n : match.route.element !== undefined\n ? match.route.element\n : outlet}\n </RenderedRoute>\n );\n // Only wrap in an error boundary within data router usages when we have an\n // errorElement on this route. Otherwise let it bubble up to an ancestor\n // errorElement\n return dataRouterState && (match.route.errorElement || index === 0) ? (\n <RenderErrorBoundary\n location={dataRouterState.location}\n component={errorElement}\n error={error}\n children={getChildren()}\n />\n ) : (\n getChildren()\n );\n }, null as React.ReactElement | null);\n}\n\nenum DataRouterHook {\n UseLoaderData = \"useLoaderData\",\n UseActionData = \"useActionData\",\n UseRouteError = \"useRouteError\",\n UseNavigation = \"useNavigation\",\n UseRouteLoaderData = \"useRouteLoaderData\",\n UseMatches = \"useMatches\",\n UseRevalidator = \"useRevalidator\",\n}\n\nfunction useDataRouterState(hookName: DataRouterHook) {\n let state = React.useContext(DataRouterStateContext);\n invariant(state, `${hookName} must be used within a DataRouterStateContext`);\n return state;\n}\n\n/**\n * Returns the current navigation, defaulting to an \"idle\" navigation when\n * no navigation is in progress\n */\nexport function useNavigation() {\n let state = useDataRouterState(DataRouterHook.UseNavigation);\n return state.navigation;\n}\n\n/**\n * Returns a revalidate function for manually triggering revalidation, as well\n * as the current state of any manual revalidations\n */\nexport function useRevalidator() {\n let dataRouterContext = React.useContext(DataRouterContext);\n invariant(\n dataRouterContext,\n `useRevalidator must be used within a DataRouterContext`\n );\n let state = useDataRouterState(DataRouterHook.UseRevalidator);\n return {\n revalidate: dataRouterContext.router.revalidate,\n state: state.revalidation,\n };\n}\n\n/**\n * Returns the active route matches, useful for accessing loaderData for\n * parent/child routes or the route \"handle\" property\n */\nexport function useMatches() {\n let { matches, loaderData } = useDataRouterState(DataRouterHook.UseMatches);\n return React.useMemo(\n () =>\n matches.map((match) => {\n let { pathname, params } = match;\n return {\n id: match.route.id,\n pathname,\n params,\n data: loaderData[match.route.id] as unknown,\n handle: match.route.handle as unknown,\n };\n }),\n [matches, loaderData]\n );\n}\n\n/**\n * Returns the loader data for the nearest ancestor Route loader\n */\nexport function useLoaderData(): unknown {\n let state = useDataRouterState(DataRouterHook.UseLoaderData);\n\n let route = React.useContext(RouteContext);\n invariant(route, `useLoaderData must be used inside a RouteContext`);\n\n let thisRoute = route.matches[route.matches.length - 1];\n invariant(\n thisRoute.route.id,\n `useLoaderData can only be used on routes that contain a unique \"id\"`\n );\n\n return state.loaderData[thisRoute.route.id];\n}\n\n/**\n * Returns the loaderData for the given routeId\n */\nexport function useRouteLoaderData(routeId: string): unknown {\n let state = useDataRouterState(DataRouterHook.UseRouteLoaderData);\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the action data for the nearest ancestor Route action\n */\nexport function useActionData(): unknown {\n let state = useDataRouterState(DataRouterHook.UseActionData);\n\n let route = React.useContext(RouteContext);\n invariant(route, `useActionData must be used inside a RouteContext`);\n\n return Object.values(state?.actionData || {})[0];\n}\n\n/**\n * Returns the nearest ancestor Route error, which could be a loader/action\n * error or a render error. This is intended to be called from your\n * errorElement to display a proper error message.\n */\nexport function useRouteError(): unknown {\n let error = React.useContext(RouteErrorContext);\n let state = useDataRouterState(DataRouterHook.UseRouteError);\n let route = React.useContext(RouteContext);\n let thisRoute = route.matches[route.matches.length - 1];\n let deferredValue = React.useContext(DeferredContext);\n\n // Return deferred errors if we're inside a Deferred errorElement\n if (deferredValue && deferredValue instanceof Error) {\n return deferredValue;\n }\n\n // If this was a render error, we put it in a RouteError context inside\n // of RenderErrorBoundary\n if (error) {\n return error;\n }\n\n invariant(route, `useRouteError must be used inside a RouteContext`);\n invariant(\n thisRoute.route.id,\n `useRouteError can only be used on routes that contain a unique \"id\"`\n );\n\n // Otherwise look for errors from our data router state\n return state.errors?.[thisRoute.route.id];\n}\n\n/**\n * Returns the happy-path data from the nearest ancestor <Deferred /> value\n */\nexport function useDeferredData(): unknown {\n let value = React.useContext(DeferredContext);\n return value;\n}\n\nconst alreadyWarned: Record<string, boolean> = {};\n\nfunction warningOnce(key: string, cond: boolean, message: string) {\n if (!cond && !alreadyWarned[key]) {\n alreadyWarned[key] = true;\n warning(false, message);\n }\n}\n","import * as React from \"react\";\nimport type {\n HydrationState,\n InitialEntry,\n Location,\n MemoryHistory,\n RouteMatch,\n RouteObject,\n Router as RemixRouter,\n RouterState,\n To,\n} from \"@remix-run/router\";\nimport {\n Action as NavigationType,\n createMemoryHistory,\n createMemoryRouter,\n invariant,\n isDeferredError,\n parsePath,\n stripBasename,\n warning,\n} from \"@remix-run/router\";\nimport { useSyncExternalStore as useSyncExternalStoreShim } from \"./use-sync-external-store-shim\";\n\nimport type { Navigator, DataRouterContextObject } from \"./context\";\nimport {\n LocationContext,\n NavigationContext,\n DataRouterContext,\n DataRouterStateContext,\n DeferredContext,\n} from \"./context\";\nimport {\n useDeferredData,\n useInRouterContext,\n useNavigate,\n useOutlet,\n useRoutes,\n _renderMatches,\n} from \"./hooks\";\n\n// Module-scoped singleton to hold the router. Extracted from the React lifecycle\n// to avoid issues w.r.t. dual initialization fetches in concurrent rendering.\n// Data router apps are expected to have a static route tree and are not intended\n// to be unmounted/remounted at runtime.\nlet routerSingleton: RemixRouter;\n\n/**\n * Unit-testing-only function to reset the router between tests\n * @private\n */\nexport function _resetModuleScope() {\n // @ts-expect-error\n routerSingleton = null;\n}\n\n/**\n * A higher-order component that, given a Remix Router instance. setups the\n * Context's required for data routing\n */\nexport function DataRouterProvider({\n basename,\n children,\n fallbackElement,\n router,\n}: {\n basename?: string;\n children?: React.ReactNode;\n fallbackElement?: React.ReactNode;\n router: RemixRouter;\n}): React.ReactElement {\n // Sync router state to our component state to force re-renders\n let state: RouterState = useSyncExternalStoreShim(\n router.subscribe,\n () => router.state,\n // We have to provide this so React@18 doesn't complain during hydration,\n // but we pass our serialized hydration data into the router so state here\n // is already synced with what the server saw\n () => router.state\n );\n\n let navigator = React.useMemo((): Navigator => {\n return {\n createHref: router.createHref,\n go: (n) => router.navigate(n),\n push: (to, state, opts) =>\n router.navigate(to, { state, resetScroll: opts?.resetScroll }),\n replace: (to, state, opts) =>\n router.navigate(to, {\n replace: true,\n state,\n resetScroll: opts?.resetScroll,\n }),\n };\n }, [router]);\n\n let dataRouterContext: DataRouterContextObject = {\n router,\n navigator,\n static: false,\n basename: basename || \"/\",\n };\n\n if (!state.initialized) {\n return <>{fallbackElement}</>;\n }\n\n return (\n <DataRouterContext.Provider value={dataRouterContext}>\n <DataRouterStateContext.Provider value={state} children={children} />\n </DataRouterContext.Provider>\n );\n}\n\n/**\n * A data-aware wrapper for `<Router>` that leverages the Context's provided by\n * `<DataRouterProvider>`\n */\nexport function DataRouter() {\n let dataRouterContext = React.useContext(DataRouterContext);\n invariant(\n dataRouterContext,\n \"<DataRouter> may only be rendered within a DataRouterContext\"\n );\n let { router, navigator, basename } = dataRouterContext;\n\n return (\n <Router\n basename={basename}\n location={router.state.location}\n navigationType={router.state.historyAction}\n navigator={navigator}\n >\n <Routes />\n </Router>\n );\n}\n\nexport interface DataMemoryRouterProps {\n basename?: string;\n children?: React.ReactNode;\n initialEntries?: InitialEntry[];\n initialIndex?: number;\n hydrationData?: HydrationState;\n fallbackElement?: React.ReactNode;\n routes?: RouteObject[];\n}\n\nexport function DataMemoryRouter({\n basename,\n children,\n initialEntries,\n initialIndex,\n hydrationData,\n fallbackElement,\n routes,\n}: DataMemoryRouterProps): React.ReactElement {\n if (!routerSingleton) {\n routerSingleton = createMemoryRouter({\n basename,\n hydrationData,\n initialEntries,\n initialIndex,\n routes: routes || createRoutesFromChildren(children),\n }).initialize();\n }\n let router = routerSingleton;\n\n return (\n <DataRouterProvider\n router={router}\n basename={basename}\n fallbackElement={fallbackElement}\n >\n <DataRouter />\n </DataRouterProvider>\n );\n}\n\nexport interface MemoryRouterProps {\n basename?: string;\n children?: React.ReactNode;\n initialEntries?: InitialEntry[];\n initialIndex?: number;\n}\n\n/**\n * A <Router> that stores all entries in memory.\n *\n * @see https://reactrouter.com/docs/en/v6/routers/memory-router\n */\nexport function MemoryRouter({\n basename,\n children,\n initialEntries,\n initialIndex,\n}: MemoryRouterProps): React.ReactElement {\n let historyRef = React.useRef<MemoryHistory>();\n if (historyRef.current == null) {\n historyRef.current = createMemoryHistory({\n initialEntries,\n initialIndex,\n v5Compat: true,\n });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location,\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface NavigateProps {\n to: To;\n replace?: boolean;\n state?: any;\n}\n\n/**\n * Changes the current location.\n *\n * Note: This API is mostly useful in React.Component subclasses that are not\n * able to use hooks. In functional components, we recommend you use the\n * `useNavigate` hook instead.\n *\n * @see https://reactrouter.com/docs/en/v6/components/navigate\n */\nexport function Navigate({ to, replace, state }: NavigateProps): null {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of\n // the router loaded. We can help them understand how to avoid that.\n `<Navigate> may be used only in the context of a <Router> component.`\n );\n\n warning(\n !React.useContext(NavigationContext).static,\n `<Navigate> must not be used on the initial render in a <StaticRouter>. ` +\n `This is a no-op, but you should modify your code so the <Navigate> is ` +\n `only ever rendered in response to some user interaction or state change.`\n );\n\n let navigate = useNavigate();\n React.useEffect(() => {\n navigate(to, { replace, state });\n });\n\n return null;\n}\n\nexport interface OutletProps {\n context?: unknown;\n}\n\n/**\n * Renders the child route's element, if there is one.\n *\n * @see https://reactrouter.com/docs/en/v6/components/outlet\n */\nexport function Outlet(props: OutletProps): React.ReactElement | null {\n return useOutlet(props.context);\n}\n\ninterface DataRouteProps {\n id?: RouteObject[\"id\"];\n loader?: RouteObject[\"loader\"];\n action?: RouteObject[\"action\"];\n errorElement?: RouteObject[\"errorElement\"];\n shouldRevalidate?: RouteObject[\"shouldRevalidate\"];\n handle?: RouteObject[\"handle\"];\n}\n\nexport interface RouteProps extends DataRouteProps {\n caseSensitive?: boolean;\n children?: React.ReactNode;\n element?: React.ReactNode | null;\n index?: boolean;\n path?: string;\n}\n\nexport interface PathRouteProps extends DataRouteProps {\n caseSensitive?: boolean;\n children?: React.ReactNode;\n element?: React.ReactNode | null;\n index?: false;\n path: string;\n}\n\nexport interface LayoutRouteProps extends DataRouteProps {\n children?: React.ReactNode;\n element?: React.ReactNode | null;\n}\n\nexport interface IndexRouteProps extends DataRouteProps {\n element?: React.ReactNode | null;\n index: true;\n}\n\n/**\n * Declares an element that should be rendered at a certain URL path.\n *\n * @see https://reactrouter.com/docs/en/v6/components/route\n */\nexport function Route(\n _props: PathRouteProps | LayoutRouteProps | IndexRouteProps\n): React.ReactElement | null {\n invariant(\n false,\n `A <Route> is only ever to be used as the child of <Routes> element, ` +\n `never rendered directly. Please wrap your <Route> in a <Routes>.`\n );\n}\n\nexport interface RouterProps {\n basename?: string;\n children?: React.ReactNode;\n location: Partial<Location> | string;\n navigationType?: NavigationType;\n navigator: Navigator;\n static?: boolean;\n}\n\n/**\n * Provides location context for the rest of the app.\n *\n * Note: You usually won't render a <Router> directly. Instead, you'll render a\n * router that is more specific to your environment such as a <BrowserRouter>\n * in web browsers or a <StaticRouter> for server rendering.\n *\n * @see https://reactrouter.com/docs/en/v6/routers/router\n */\nexport function Router({\n basename: basenameProp = \"/\",\n children = null,\n location: locationProp,\n navigationType = NavigationType.Pop,\n navigator,\n static: staticProp = false,\n}: RouterProps): React.ReactElement | null {\n invariant(\n !useInRouterContext(),\n `You cannot render a <Router> inside another <Router>.` +\n ` You should never have more than one in your app.`\n );\n\n // Preserve trailing slashes on basename, so we can let the user control\n // the enforcement of trailing slashes throughout the app\n let basename = basenameProp.replace(/^\\/*/, \"/\");\n let navigationContext = React.useMemo(\n () => ({ basename, navigator, static: staticProp }),\n [basename, navigator, staticProp]\n );\n\n if (typeof locationProp === \"string\") {\n locationProp = parsePath(locationProp);\n }\n\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\",\n state = null,\n key = \"default\",\n } = locationProp;\n\n let location = React.useMemo(() => {\n let trailingPathname = stripBasename(pathname, basename);\n\n if (trailingPathname == null) {\n return null;\n }\n\n return {\n pathname: trailingPathname,\n search,\n hash,\n state,\n key,\n };\n }, [basename, pathname, search, hash, state, key]);\n\n warning(\n location != null,\n `<Router basename=\"${basename}\"> is not able to match the URL ` +\n `\"${pathname}${search}${hash}\" because it does not start with the ` +\n `basename, so the <Router> won't render anything.`\n );\n\n if (location == null) {\n return null;\n }\n\n return (\n <NavigationContext.Provider value={navigationContext}>\n <LocationContext.Provider\n children={children}\n value={{ location, navigationType }}\n />\n </NavigationContext.Provider>\n );\n}\n\nexport interface RoutesProps {\n children?: React.ReactNode;\n location?: Partial<Location> | string;\n}\n\n/**\n * A container for a nested tree of <Route> elements that renders the branch\n * that best matches the current location.\n *\n * @see https://reactrouter.com/docs/en/v6/components/routes\n */\nexport function Routes({\n children,\n location,\n}: RoutesProps): React.ReactElement | null {\n let dataRouterContext = React.useContext(DataRouterContext);\n // When in a DataRouterContext _without_ children, we use the router routes\n // directly. If we have children, then we're in a descendant tree and we\n // need to use child routes.\n let routes =\n dataRouterContext && !children\n ? dataRouterContext.router.routes\n : createRoutesFromChildren(children);\n return useRoutes(routes, location);\n}\n\nexport interface DeferredResolveRenderFunction {\n (data: Awaited<any>): JSX.Element;\n}\n\nexport interface DeferredProps {\n children: React.ReactNode | DeferredResolveRenderFunction;\n value: any;\n errorElement?: React.ReactNode;\n}\n\n/**\n * Component to use for rendering lazily loaded data from returning deferred()\n * in a loader function\n */\nexport function Deferred({ children, value, errorElement }: DeferredProps) {\n return (\n <DeferredErrorBoundary value={value} errorElement={errorElement}>\n <ResolveDeferred>{children}</ResolveDeferred>\n </DeferredErrorBoundary>\n );\n}\n\ntype DeferredErrorBoundaryProps = React.PropsWithChildren<{\n value: any;\n errorElement?: React.ReactNode;\n}>;\n\ntype DeferredErrorBoundaryState = {\n error: any;\n};\n\nclass DeferredErrorBoundary extends React.Component<\n DeferredErrorBoundaryProps,\n DeferredErrorBoundaryState\n> {\n constructor(props: DeferredErrorBoundaryProps) {\n super(props);\n this.state = { error: null };\n }\n\n static getDerivedStateFromError(error: any) {\n return { error };\n }\n\n componentDidCatch(error: any, errorInfo: any) {\n console.error(\n \"<Deferred> caught the following error during render\",\n error,\n errorInfo\n );\n }\n\n render() {\n let { children, errorElement, value } = this.props;\n\n // Handle render errors from this.state, or data errors from context\n let error = this.state.error || (isDeferredError(value) ? value : null);\n\n if (error) {\n if (errorElement) {\n // We have our own errorElement, provide our error and render it\n return (\n <DeferredContext.Provider value={error} children={errorElement} />\n );\n }\n // Throw to the nearest ancestor route-level error boundary\n throw error;\n }\n\n if (value instanceof Promise) {\n // Throw to the suspense boundary\n throw value;\n }\n\n // We've resolved successfully, provide the value and render the children\n return <DeferredContext.Provider value={value} children={children} />;\n }\n}\n\n/**\n * @private\n * Indirection to leverage useDeferredData for a render-prop API on <Deferred>\n */\nfunction ResolveDeferred({\n children,\n}: {\n children: React.ReactNode | DeferredResolveRenderFunction;\n}) {\n let data = useDeferredData();\n if (typeof children === \"function\") {\n return children(data);\n }\n return <>{children}</>;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// UTILS\n///////////////////////////////////////////////////////////////////////////////\n\n/**\n * Creates a route config from a React \"children\" object, which is usually\n * either a `<Route>` element or an array of them. Used internally by\n * `<Routes>` to create a route config from its children.\n *\n * @see https://reactrouter.com/docs/en/v6/utils/create-routes-from-children\n */\nexport function createRoutesFromChildren(\n children: React.ReactNode,\n parentPath: number[] = []\n): RouteObject[] {\n let routes: RouteObject[] = [];\n\n React.Children.forEach(children, (element, index) => {\n if (!React.isValidElement(element)) {\n // Ignore non-elements. This allows people to more easily inline\n // conditionals in their route config.\n return;\n }\n\n if (element.type === React.Fragment) {\n // Transparently support React.Fragment and its children.\n routes.push.apply(\n routes,\n createRoutesFromChildren(element.props.children, parentPath)\n );\n return;\n }\n\n invariant(\n element.type === Route,\n `[${\n typeof element.type === \"string\" ? element.type : element.type.name\n }] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`\n );\n\n let treePath = [...parentPath, index];\n let route: RouteObject = {\n id: element.props.id || treePath.join(\"-\"),\n caseSensitive: element.props.caseSensitive,\n element: element.props.element,\n index: element.props.index,\n path: element.props.path,\n loader: element.props.loader,\n action: element.props.action,\n errorElement: element.props.errorElement,\n shouldRevalidate: element.props.shouldRevalidate,\n handle: element.props.handle,\n };\n\n if (element.props.children) {\n route.children = createRoutesFromChildren(\n element.props.children,\n treePath\n );\n }\n\n routes.push(route);\n });\n\n return routes;\n}\n\n/**\n * Renders the result of `matchRoutes()` into a React element.\n */\nexport function renderMatches(\n matches: RouteMatch[] | null\n): React.ReactElement | null {\n return _renderMatches(matches);\n}\n"],"names":["isPolyfill","x","y","is","Object","useState","useEffect","useLayoutEffect","useDebugValue","React","didWarnOld18Alpha","didWarnUncachedGetSnapshot","useSyncExternalStore","subscribe","getSnapshot","getServerSnapshot","console","error","value","cachedValue","inst","forceUpdate","checkIfSnapshotChanged","handleStoreChange","latestGetSnapshot","prevValue","nextValue","canUseDOM","window","document","createElement","isServerEnvironment","shim","server","client","module","DataStaticRouterContext","createContext","displayName","DataRouterContext","DataRouterStateContext","DeferredContext","NavigationContext","LocationContext","RouteContext","outlet","matches","RouteErrorContext","useHref","to","useInRouterContext","invariant","basename","navigator","useContext","hash","pathname","search","useResolvedPath","joinedPathname","joinPaths","createHref","useLocation","location","useNavigationType","navigationType","useMatch","pattern","useMemo","matchPath","getPathContributingMatches","filter","match","index","route","pathnameBase","useNavigate","locationPathname","routePathnamesJson","JSON","stringify","map","activeRef","useRef","current","navigate","useCallback","options","warning","go","path","resolveTo","parse","replace","push","state","OutletContext","useOutletContext","useOutlet","context","Provider","useParams","routeMatch","length","params","useRoutes","routes","locationArg","dataRouterStateContext","parentMatches","parentParams","parentPathname","parentPathnameBase","parentRoute","parentPath","warningOnce","endsWith","locationFromContext","parsedLocationArg","parsePath","startsWith","remainingPathname","slice","matchRoutes","element","undefined","_renderMatches","assign","DefaultErrorElement","useRouteError","message","isRouteErrorResponse","status","statusText","Error","stack","lightgrey","preStyles","padding","backgroundColor","codeStyles","Fragment","style","fontStyle","RenderErrorBoundary","Component","constructor","props","getDerivedStateFromError","getDerivedStateFromProps","componentDidCatch","errorInfo","render","children","component","RenderedRoute","routeContext","dataStaticRouterContext","errorElement","_deepestRenderedBoundaryId","id","dataRouterState","errors","renderedMatches","errorIndex","findIndex","m","Math","min","reduceRight","getChildren","concat","DataRouterHook","useDataRouterState","hookName","useNavigation","UseNavigation","navigation","useRevalidator","dataRouterContext","UseRevalidator","revalidate","router","revalidation","useMatches","loaderData","UseMatches","data","handle","useLoaderData","UseLoaderData","thisRoute","useRouteLoaderData","routeId","UseRouteLoaderData","useActionData","UseActionData","values","actionData","UseRouteError","deferredValue","useDeferredData","alreadyWarned","key","cond","routerSingleton","DataRouterProvider","fallbackElement","useSyncExternalStoreShim","n","opts","resetScroll","static","initialized","DataRouter","Router","historyAction","Routes","DataMemoryRouter","initialEntries","initialIndex","hydrationData","createMemoryRouter","createRoutesFromChildren","initialize","MemoryRouter","historyRef","createMemoryHistory","v5Compat","history","setState","action","listen","Navigate","Outlet","Route","_props","basenameProp","locationProp","NavigationType","Pop","staticProp","navigationContext","trailingPathname","stripBasename","Deferred","DeferredErrorBoundary","ResolveDeferred","isDeferredError","Promise","Children","forEach","isValidElement","type","apply","name","treePath","join","caseSensitive","loader","shouldRevalidate","renderMatches"],"mappings":";;;;;;;;;;;;;;AAAA;;;;;AAKG;AAIH;;;AAGG;;AACH,SAASA,UAAT,CAAoBC,CAApB,EAA4BC,CAA5B,EAAkC;EAChC,OACGD,CAAC,KAAKC,CAAN,KAAYD,CAAC,KAAK,CAAN,IAAW,CAAA,GAAIA,CAAJ,KAAU,IAAIC,CAArC,CAAD,IAA8CD,CAAC,KAAKA,CAAN,IAAWC,CAAC,KAAKA,CADjE;AAAA,GAAA;AAGD,CAAA;;AAED,MAAMC,EAAE,GACN,OAAOC,MAAM,CAACD,EAAd,KAAqB,UAArB,GAAkCC,MAAM,CAACD,EAAzC,GAA8CH,UADhD;AAIA;;AACA,MAAM;EAAEK,QAAF;EAAYC,SAAZ;EAAuBC,eAAvB;AAAwCC,EAAAA,aAAAA;AAAxC,CAAA,GAA0DC,KAAhE,CAAA;AAEA,IAAIC,iBAAiB,GAAG,KAAxB,CAAA;AACA,IAAIC,0BAA0B,GAAG,KAAjC;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACgB,SAAAC,sBAAA,CACdC,SADc,EAEdC,WAFc;AAId;AACA;AACA;AACAC,iBAPc,EAOa;EAEd;IACX,IAAI,CAACL,iBAAL,EAAwB;MACtB,IAAI,iBAAA,IAAqBD,KAAz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,EAAElC,OAAO,CAACuB,KAAR,CAAcW,YARL;AASvBsG,MAAAA,gBAAgB,EAAExI,OAAO,CAACuB,KAAR,CAAciH,gBATT;AAUvBxE,MAAAA,MAAM,EAAEhE,OAAO,CAACuB,KAAR,CAAcyC,MAAAA;KAVxB,CAAA;;AAaA,IAAA,IAAIhE,OAAO,CAACuB,KAAR,CAAcM,QAAlB,EAA4B;AAC1B/E,MAAAA,KAAK,CAAC+E,QAAN,GAAiBsE,wBAAwB,CACvCnG,OAAO,CAACuB,KAAR,CAAcM,QADyB,EAEvCuG,QAFuC,CAAzC,CAAA;AAID,KAAA;;IAEDtJ,MAAM,CAACZ,IAAP,CAAYpB,KAAZ,CAAA,CAAA;GA5CF,CAAA,CAAA;AA+CA,EAAA,OAAOgC,MAAP,CAAA;AACD,CAAA;AAED;;AAEG;;AACG,SAAU2J,aAAV,CACJvN,OADI,EACwB;EAE5B,OAAOgF,cAAc,CAAChF,OAAD,CAArB,CAAA;AACD;;;;"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * React Router v6.4.0-pre.10
3
+ *
4
+ * Copyright (c) Remix Software Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ import{invariant as e,resolveTo as t,joinPaths as r,matchPath as n,parsePath as a,matchRoutes as o,isRouteErrorResponse as l,createMemoryRouter as i,createMemoryHistory as u,stripBasename as s,Action as c,isDeferredError as m}from"@remix-run/router";export{Action as NavigationType,createPath,deferred,generatePath,isDeferredError,isRouteErrorResponse,json,matchPath,matchRoutes,parsePath,redirect,resolvePath}from"@remix-run/router";import*as h from"react";const d="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},{useState:p,useEffect:f,useLayoutEffect:E,useDebugValue:v}=h;function g(e){const t=e.getSnapshot,r=e.value;try{const e=t();return!d(r,e)}catch(n){return!0}}const x=!!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement)?function(e,t,r){return t()}:function(e,t,r){const n=t(),[{inst:a},o]=p({inst:{value:n,getSnapshot:t}});return E((()=>{a.value=n,a.getSnapshot=t,g(a)&&o({inst:a})}),[e,n,t]),f((()=>{g(a)&&o({inst:a});return e((()=>{g(a)&&o({inst:a})}))}),[e]),v(n),n},C="useSyncExternalStore"in h?h.useSyncExternalStore:x,y=h.createContext(null),S=h.createContext(null),b=h.createContext(null),D=h.createContext(null),R=h.createContext(null),U=h.createContext(null),N=h.createContext({outlet:null,matches:[]}),P=h.createContext(null);function w(t){F()||e(!1);let{basename:n,navigator:a}=h.useContext(R),{hash:o,pathname:l,search:i}=I(t),u=l;return"/"!==n&&(u="/"===l?n:r([n,l])),a.createHref({pathname:u,search:i,hash:o})}function F(){return null!=h.useContext(U)}function A(){return F()||e(!1),h.useContext(U).location}function M(){return h.useContext(U).navigationType}function O(t){F()||e(!1);let{pathname:r}=A();return h.useMemo((()=>n(t,r)),[r,t])}function k(e){return e.filter(((t,r)=>0===r||!t.route.index&&t.pathnameBase!==e[r-1].pathnameBase))}function B(){F()||e(!1);let{basename:n,navigator:a}=h.useContext(R),{matches:o}=h.useContext(N),{pathname:l}=A(),i=JSON.stringify(k(o).map((e=>e.pathnameBase))),u=h.useRef(!1);return h.useEffect((()=>{u.current=!0})),h.useCallback(((e,o={})=>{if(!u.current)return;if("number"==typeof e)return void a.go(e);let s=t(e,JSON.parse(i),l);"/"!==n&&(s.pathname="/"===s.pathname?n:r([n,s.pathname])),(o.replace?a.replace:a.push)(s,o.state,o)}),[n,a,i,l])}const L=h.createContext(null);function _(){return h.useContext(L)}function T(e){let t=h.useContext(N).outlet;return t?h.createElement(L.Provider,{value:e},t):t}function j(){let{matches:e}=h.useContext(N),t=e[e.length-1];return t?t.params:{}}function I(e){let{matches:r}=h.useContext(N),{pathname:n}=A(),a=JSON.stringify(k(r).map((e=>e.pathnameBase)));return h.useMemo((()=>t(e,JSON.parse(a),n)),[e,a,n])}function J(t,n){F()||e(!1);let l=h.useContext(b),{matches:i}=h.useContext(N),u=i[i.length-1],s=u?u.params:{};!u||u.pathname;let c=u?u.pathnameBase:"/";u&&u.route;let m,d=A();if(n){let t="string"==typeof n?a(n):n;"/"===c||t.pathname?.startsWith(c)||e(!1),m=t}else m=d;let p=m.pathname||"/",f="/"===c?p:p.slice(c.length)||"/",E=o(t,{pathname:f});return $(E&&E.map((e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:r([c,e.pathname]),pathnameBase:"/"===e.pathnameBase?c:r([c,e.pathnameBase])}))),i,l||void 0)}function H(){let e=ee(),t=l(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:n},o={padding:"2px 4px",backgroundColor:n};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unhandled Thrown Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),r?h.createElement("pre",{style:a},r):null,h.createElement("p",null,"💿 Hey developer 👋"),h.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",h.createElement("code",{style:o},"errorElement")," props on ",h.createElement("code",{style:o},"<Route>")))}class z extends h.Component{constructor(e){super(e),this.state={location:e.location,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location?{error:e.error,location:e.location}:{error:e.error||t.error,location:t.location}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error?h.createElement(P.Provider,{value:this.state.error,children:this.props.component}):this.props.children}}function V({routeContext:e,match:t,children:r}){let n=h.useContext(y);return n&&t.route.errorElement&&(n._deepestRenderedBoundaryId=t.route.id),h.createElement(N.Provider,{value:e},r)}function $(t,r=[],n){if(null==t){if(!n?.errors)return null;t=n.matches}let a=t,o=n?.errors;if(null!=o){let t=a.findIndex((e=>e.route.id&&o?.[e.route.id]));t>=0||e(!1),a=a.slice(0,Math.min(a.length,t+1))}return a.reduceRight(((e,t,l)=>{let i=t.route.id?o?.[t.route.id]:null,u=n?t.route.errorElement||h.createElement(H,null):null,s=()=>h.createElement(V,{match:t,routeContext:{outlet:e,matches:r.concat(a.slice(0,l+1))}},i?u:void 0!==t.route.element?t.route.element:e);return n&&(t.route.errorElement||0===l)?h.createElement(z,{location:n.location,component:u,error:i,children:s()}):s()}),null)}var W;function X(t){let r=h.useContext(b);return r||e(!1),r}function Y(){return X(W.UseNavigation).navigation}function q(){let t=h.useContext(S);t||e(!1);let r=X(W.UseRevalidator);return{revalidate:t.router.revalidate,state:r.revalidation}}function G(){let{matches:e,loaderData:t}=X(W.UseMatches);return h.useMemo((()=>e.map((e=>{let{pathname:r,params:n}=e;return{id:e.route.id,pathname:r,params:n,data:t[e.route.id],handle:e.route.handle}}))),[e,t])}function K(){let t=X(W.UseLoaderData),r=h.useContext(N);r||e(!1);let n=r.matches[r.matches.length-1];return n.route.id||e(!1),t.loaderData[n.route.id]}function Q(e){return X(W.UseRouteLoaderData).loaderData[e]}function Z(){let t=X(W.UseActionData);return h.useContext(N)||e(!1),Object.values(t?.actionData||{})[0]}function ee(){let t=h.useContext(P),r=X(W.UseRouteError),n=h.useContext(N),a=n.matches[n.matches.length-1],o=h.useContext(D);return o&&o instanceof Error?o:t||(n||e(!1),a.route.id||e(!1),r.errors?.[a.route.id])}function te(){return h.useContext(D)}let re;function ne({basename:e,children:t,fallbackElement:r,router:n}){let a=C(n.subscribe,(()=>n.state),(()=>n.state)),o=h.useMemo((()=>({createHref:n.createHref,go:e=>n.navigate(e),push:(e,t,r)=>n.navigate(e,{state:t,resetScroll:r?.resetScroll}),replace:(e,t,r)=>n.navigate(e,{replace:!0,state:t,resetScroll:r?.resetScroll})})),[n]),l={router:n,navigator:o,static:!1,basename:e||"/"};return a.initialized?h.createElement(S.Provider,{value:l},h.createElement(b.Provider,{value:a,children:t})):h.createElement(h.Fragment,null,r)}function ae(){let t=h.useContext(S);t||e(!1);let{router:r,navigator:n,basename:a}=t;return h.createElement(ce,{basename:a,location:r.state.location,navigationType:r.state.historyAction,navigator:n},h.createElement(me,null))}function oe({basename:e,children:t,initialEntries:r,initialIndex:n,hydrationData:a,fallbackElement:o,routes:l}){re||(re=i({basename:e,hydrationData:a,initialEntries:r,initialIndex:n,routes:l||fe(t)}).initialize());let u=re;return h.createElement(ne,{router:u,basename:e,fallbackElement:o},h.createElement(ae,null))}function le({basename:e,children:t,initialEntries:r,initialIndex:n}){let a=h.useRef();null==a.current&&(a.current=u({initialEntries:r,initialIndex:n,v5Compat:!0}));let o=a.current,[l,i]=h.useState({action:o.action,location:o.location});return h.useLayoutEffect((()=>o.listen(i)),[o]),h.createElement(ce,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:o})}function ie({to:t,replace:r,state:n}){F()||e(!1);let a=B();return h.useEffect((()=>{a(t,{replace:r,state:n})})),null}function ue(e){return T(e.context)}function se(t){e(!1)}function ce({basename:t="/",children:r=null,location:n,navigationType:o=c.Pop,navigator:l,static:i=!1}){F()&&e(!1);let u=t.replace(/^\/*/,"/"),m=h.useMemo((()=>({basename:u,navigator:l,static:i})),[u,l,i]);"string"==typeof n&&(n=a(n));let{pathname:d="/",search:p="",hash:f="",state:E=null,key:v="default"}=n,g=h.useMemo((()=>{let e=s(d,u);return null==e?null:{pathname:e,search:p,hash:f,state:E,key:v}}),[u,d,p,f,E,v]);return null==g?null:h.createElement(R.Provider,{value:m},h.createElement(U.Provider,{children:r,value:{location:g,navigationType:o}}))}function me({children:e,location:t}){let r=h.useContext(S);return J(r&&!e?r.router.routes:fe(e),t)}function he({children:e,value:t,errorElement:r}){return h.createElement(de,{value:t,errorElement:r},h.createElement(pe,null,e))}!function(e){e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator"}(W||(W={}));class de extends h.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("<Deferred> caught the following error during render",e,t)}render(){let{children:e,errorElement:t,value:r}=this.props,n=this.state.error||(m(r)?r:null);if(n){if(t)return h.createElement(D.Provider,{value:n,children:t});throw n}if(r instanceof Promise)throw r;return h.createElement(D.Provider,{value:r,children:e})}}function pe({children:e}){let t=te();return"function"==typeof e?e(t):h.createElement(h.Fragment,null,e)}function fe(t,r=[]){let n=[];return h.Children.forEach(t,((t,a)=>{if(!h.isValidElement(t))return;if(t.type===h.Fragment)return void n.push.apply(n,fe(t.props.children,r));t.type!==se&&e(!1);let o=[...r,a],l={id:t.props.id||o.join("-"),caseSensitive:t.props.caseSensitive,element:t.props.element,index:t.props.index,path:t.props.path,loader:t.props.loader,action:t.props.action,errorElement:t.props.errorElement,shouldRevalidate:t.props.shouldRevalidate,handle:t.props.handle};t.props.children&&(l.children=fe(t.props.children,o)),n.push(l)})),n}function Ee(e){return $(e)}export{oe as DataMemoryRouter,he as Deferred,le as MemoryRouter,ie as Navigate,ue as Outlet,se as Route,ce as Router,me as Routes,ae as UNSAFE_DataRouter,S as UNSAFE_DataRouterContext,ne as UNSAFE_DataRouterProvider,b as UNSAFE_DataRouterStateContext,y as UNSAFE_DataStaticRouterContext,U as UNSAFE_LocationContext,R as UNSAFE_NavigationContext,N as UNSAFE_RouteContext,fe as createRoutesFromChildren,Ee as renderMatches,Z as useActionData,te as useDeferredData,w as useHref,F as useInRouterContext,K as useLoaderData,A as useLocation,O as useMatch,G as useMatches,B as useNavigate,Y as useNavigation,M as useNavigationType,T as useOutlet,_ as useOutletContext,j as useParams,I as useResolvedPath,q as useRevalidator,ee as useRouteError,Q as useRouteLoaderData,J as useRoutes};
12
+ //# sourceMappingURL=react-router.production.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-router.production.min.js","sources":["../lib/use-sync-external-store-shim/useSyncExternalStoreShimClient.ts","../lib/use-sync-external-store-shim/index.ts","../lib/use-sync-external-store-shim/useSyncExternalStoreShimServer.ts","../lib/context.ts","../lib/hooks.tsx","../lib/components.tsx"],"sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport * as React from \"react\";\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction isPolyfill(x: any, y: any) {\n return (\n (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare\n );\n}\n\nconst is: (x: any, y: any) => boolean =\n typeof Object.is === \"function\" ? Object.is : isPolyfill;\n\n// Intentionally not using named imports because Rollup uses dynamic\n// dispatch for CommonJS interop named imports.\nconst { useState, useEffect, useLayoutEffect, useDebugValue } = React;\n\nlet didWarnOld18Alpha = false;\nlet didWarnUncachedGetSnapshot = false;\n\n// Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\nexport function useSyncExternalStore<T>(\n subscribe: (fn: () => void) => () => void,\n getSnapshot: () => T,\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n getServerSnapshot?: () => T\n): T {\n if (__DEV__) {\n if (!didWarnOld18Alpha) {\n if (\"startTransition\" in React) {\n didWarnOld18Alpha = true;\n console.error(\n \"You are using an outdated, pre-release alpha of React 18 that \" +\n \"does not support useSyncExternalStore. The \" +\n \"use-sync-external-store shim will not work correctly. Upgrade \" +\n \"to a newer pre-release.\"\n );\n }\n }\n }\n\n // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n const value = getSnapshot();\n if (__DEV__) {\n if (!didWarnUncachedGetSnapshot) {\n const cachedValue = getSnapshot();\n if (!is(value, cachedValue)) {\n console.error(\n \"The result of getSnapshot should be cached to avoid an infinite loop\"\n );\n didWarnUncachedGetSnapshot = true;\n }\n }\n }\n\n // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n const [{ inst }, forceUpdate] = useState({ inst: { value, getSnapshot } });\n\n // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n useLayoutEffect(() => {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n\n // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [subscribe, value, getSnapshot]);\n\n useEffect(() => {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst });\n }\n const handleStoreChange = () => {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst });\n }\n };\n // Subscribe to the store and return a clean-up function.\n return subscribe(handleStoreChange);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [subscribe]);\n\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst: any) {\n const latestGetSnapshot = inst.getSnapshot;\n const prevValue = inst.value;\n try {\n const nextValue = latestGetSnapshot();\n return !is(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n","/**\n * Inlined into the react-router repo since use-sync-external-store does not\n * provide a UMD-compatible package, so we need this to be able to distribute\n * UMD react-router bundles\n */\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\n\nimport * as React from \"react\";\n\nimport { useSyncExternalStore as client } from \"./useSyncExternalStoreShimClient\";\nimport { useSyncExternalStore as server } from \"./useSyncExternalStoreShimServer\";\n\nconst canUseDOM: boolean = !!(\n typeof window !== \"undefined\" &&\n typeof window.document !== \"undefined\" &&\n typeof window.document.createElement !== \"undefined\"\n);\nconst isServerEnvironment = !canUseDOM;\nconst shim = isServerEnvironment ? server : client;\n\nexport const useSyncExternalStore =\n \"useSyncExternalStore\" in React\n ? // @ts-expect-error\n ((module) => module.useSyncExternalStore)(React)\n : shim;\n","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\n\nexport function useSyncExternalStore<T>(\n subscribe: (fn: () => void) => () => void,\n getSnapshot: () => T,\n getServerSnapshot?: () => T\n): T {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n","import * as React from \"react\";\nimport type {\n History,\n Location,\n RouteMatch,\n Router,\n StaticHandlerContext,\n To,\n} from \"@remix-run/router\";\nimport { Action as NavigationType } from \"@remix-run/router\";\n\n// Contexts for data routers\nexport const DataStaticRouterContext =\n React.createContext<StaticHandlerContext | null>(null);\nif (__DEV__) {\n DataStaticRouterContext.displayName = \"DataStaticRouterContext\";\n}\n\nexport interface DataRouterContextObject extends NavigationContextObject {\n router: Router;\n}\n\nexport const DataRouterContext =\n React.createContext<DataRouterContextObject | null>(null);\nif (__DEV__) {\n DataRouterContext.displayName = \"DataRouter\";\n}\n\nexport const DataRouterStateContext = React.createContext<\n Router[\"state\"] | null\n>(null);\nif (__DEV__) {\n DataRouterStateContext.displayName = \"DataRouterState\";\n}\n\nexport const DeferredContext = React.createContext<any | null>(null);\nif (__DEV__) {\n DeferredContext.displayName = \"Deferred\";\n}\n\nexport interface NavigateOptions {\n replace?: boolean;\n state?: any;\n resetScroll?: boolean;\n}\n\n/**\n * A Navigator is a \"location changer\"; it's how you get to different locations.\n *\n * Every history instance conforms to the Navigator interface, but the\n * distinction is useful primarily when it comes to the low-level <Router> API\n * where both the location and a navigator must be provided separately in order\n * to avoid \"tearing\" that may occur in a suspense-enabled app if the action\n * and/or location were to be read directly from the history instance.\n */\nexport interface Navigator {\n createHref: History[\"createHref\"];\n go: History[\"go\"];\n push(to: To, state?: any, opts?: NavigateOptions): void;\n replace(to: To, state?: any, opts?: NavigateOptions): void;\n}\n\ninterface NavigationContextObject {\n basename: string;\n navigator: Navigator;\n static: boolean;\n}\n\nexport const NavigationContext = React.createContext<NavigationContextObject>(\n null!\n);\n\nif (__DEV__) {\n NavigationContext.displayName = \"Navigation\";\n}\n\ninterface LocationContextObject {\n location: Location;\n navigationType: NavigationType;\n}\n\nexport const LocationContext = React.createContext<LocationContextObject>(\n null!\n);\n\nif (__DEV__) {\n LocationContext.displayName = \"Location\";\n}\n\nexport interface RouteContextObject {\n outlet: React.ReactElement | null;\n matches: RouteMatch[];\n}\n\nexport const RouteContext = React.createContext<RouteContextObject>({\n outlet: null,\n matches: [],\n});\n\nif (__DEV__) {\n RouteContext.displayName = \"Route\";\n}\n\nexport const RouteErrorContext = React.createContext<any>(null);\n\nif (__DEV__) {\n RouteErrorContext.displayName = \"RouteError\";\n}\n","import * as React from \"react\";\nimport {\n isRouteErrorResponse,\n Location,\n ParamParseKey,\n Params,\n Path,\n PathMatch,\n PathPattern,\n RouteMatch,\n RouteObject,\n Router as RemixRouter,\n To,\n} from \"@remix-run/router\";\nimport {\n Action as NavigationType,\n invariant,\n joinPaths,\n matchPath,\n matchRoutes,\n parsePath,\n resolveTo,\n warning,\n} from \"@remix-run/router\";\n\nimport {\n DataRouterContext,\n DataRouterStateContext,\n LocationContext,\n NavigationContext,\n NavigateOptions,\n RouteContext,\n RouteErrorContext,\n DeferredContext,\n RouteContextObject,\n DataStaticRouterContext,\n} from \"./context\";\n\n/**\n * Returns the full href for the given \"to\" value. This is useful for building\n * custom links that are also accessible and preserve right-click behavior.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-href\n */\nexport function useHref(to: To): string {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useHref() may be used only in the context of a <Router> component.`\n );\n\n let { basename, navigator } = React.useContext(NavigationContext);\n let { hash, pathname, search } = useResolvedPath(to);\n\n let joinedPathname = pathname;\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to creating the href. If this is a root navigation, then just use the raw\n // basename which allows the basename to have full control over the presence\n // of a trailing slash on root links\n if (basename !== \"/\") {\n joinedPathname =\n pathname === \"/\" ? basename : joinPaths([basename, pathname]);\n }\n\n return navigator.createHref({ pathname: joinedPathname, search, hash });\n}\n\n/**\n * Returns true if this component is a descendant of a <Router>.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-in-router-context\n */\nexport function useInRouterContext(): boolean {\n return React.useContext(LocationContext) != null;\n}\n\n/**\n * Returns the current location object, which represents the current URL in web\n * browsers.\n *\n * Note: If you're using this it may mean you're doing some of your own\n * \"routing\" in your app, and we'd like to know what your use case is. We may\n * be able to provide something higher-level to better suit your needs.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-location\n */\nexport function useLocation(): Location {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useLocation() may be used only in the context of a <Router> component.`\n );\n\n return React.useContext(LocationContext).location;\n}\n\n/**\n * Returns the current navigation action which describes how the router came to\n * the current location, either by a pop, push, or replace on the history stack.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-navigation-type\n */\nexport function useNavigationType(): NavigationType {\n return React.useContext(LocationContext).navigationType;\n}\n\n/**\n * Returns true if the URL for the given \"to\" value matches the current URL.\n * This is useful for components that need to know \"active\" state, e.g.\n * <NavLink>.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-match\n */\nexport function useMatch<\n ParamKey extends ParamParseKey<Path>,\n Path extends string\n>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useMatch() may be used only in the context of a <Router> component.`\n );\n\n let { pathname } = useLocation();\n return React.useMemo(\n () => matchPath<ParamKey, Path>(pattern, pathname),\n [pathname, pattern]\n );\n}\n\n/**\n * The interface for the navigate() function returned from useNavigate().\n */\nexport interface NavigateFunction {\n (to: To, options?: NavigateOptions): void;\n (delta: number): void;\n}\n\n/**\n * When processing relative navigation we want to ignore ancestor routes that\n * do not contribute to the path, such that index/pathless layout routes don't\n * interfere.\n *\n * For example, when moving a route element into an index route and/or a\n * pathless layout route, relative link behavior contained within should stay\n * the same. Both of the following examples should link back to the root:\n *\n * <Route path=\"/\">\n * <Route path=\"accounts\" element={<Link to=\"..\"}>\n * </Route>\n *\n * <Route path=\"/\">\n * <Route path=\"accounts\">\n * <Route element={<AccountsLayout />}> // <-- Does not contribute\n * <Route index element={<Link to=\"..\"} /> // <-- Does not contribute\n * </Route\n * </Route>\n * </Route>\n */\nfunction getPathContributingMatches(matches: RouteMatch[]) {\n return matches.filter(\n (match, index) =>\n index === 0 ||\n (!match.route.index &&\n match.pathnameBase !== matches[index - 1].pathnameBase)\n );\n}\n\n/**\n * Returns an imperative method for changing the location. Used by <Link>s, but\n * may also be used by other elements to change the location.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-navigate\n */\nexport function useNavigate(): NavigateFunction {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useNavigate() may be used only in the context of a <Router> component.`\n );\n\n let { basename, navigator } = React.useContext(NavigationContext);\n let { matches } = React.useContext(RouteContext);\n let { pathname: locationPathname } = useLocation();\n\n let routePathnamesJson = JSON.stringify(\n getPathContributingMatches(matches).map((match) => match.pathnameBase)\n );\n\n let activeRef = React.useRef(false);\n React.useEffect(() => {\n activeRef.current = true;\n });\n\n let navigate: NavigateFunction = React.useCallback(\n (to: To | number, options: NavigateOptions = {}) => {\n warning(\n activeRef.current,\n `You should call navigate() in a React.useEffect(), not when ` +\n `your component is first rendered.`\n );\n\n if (!activeRef.current) return;\n\n if (typeof to === \"number\") {\n navigator.go(to);\n return;\n }\n\n let path = resolveTo(\n to,\n JSON.parse(routePathnamesJson),\n locationPathname\n );\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to handing off to history. If this is a root navigation, then we\n // navigate to the raw basename which allows the basename to have full\n // control over the presence of a trailing slash on root links\n if (basename !== \"/\") {\n path.pathname =\n path.pathname === \"/\"\n ? basename\n : joinPaths([basename, path.pathname]);\n }\n\n (!!options.replace ? navigator.replace : navigator.push)(\n path,\n options.state,\n options\n );\n },\n [basename, navigator, routePathnamesJson, locationPathname]\n );\n\n return navigate;\n}\n\nconst OutletContext = React.createContext<unknown>(null);\n\n/**\n * Returns the context (if provided) for the child route at this level of the route\n * hierarchy.\n * @see https://reactrouter.com/docs/en/v6/hooks/use-outlet-context\n */\nexport function useOutletContext<Context = unknown>(): Context {\n return React.useContext(OutletContext) as Context;\n}\n\n/**\n * Returns the element for the child route at this level of the route\n * hierarchy. Used internally by <Outlet> to render child routes.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-outlet\n */\nexport function useOutlet(context?: unknown): React.ReactElement | null {\n let outlet = React.useContext(RouteContext).outlet;\n if (outlet) {\n return (\n <OutletContext.Provider value={context}>{outlet}</OutletContext.Provider>\n );\n }\n return outlet;\n}\n\n/**\n * Returns an object of key/value pairs of the dynamic params from the current\n * URL that were matched by the route path.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-params\n */\nexport function useParams<\n ParamsOrKey extends string | Record<string, string | undefined> = string\n>(): Readonly<\n [ParamsOrKey] extends [string] ? Params<ParamsOrKey> : Partial<ParamsOrKey>\n> {\n let { matches } = React.useContext(RouteContext);\n let routeMatch = matches[matches.length - 1];\n return routeMatch ? (routeMatch.params as any) : {};\n}\n\n/**\n * Resolves the pathname of the given `to` value against the current location.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-resolved-path\n */\nexport function useResolvedPath(to: To): Path {\n let { matches } = React.useContext(RouteContext);\n let { pathname: locationPathname } = useLocation();\n\n let routePathnamesJson = JSON.stringify(\n getPathContributingMatches(matches).map((match) => match.pathnameBase)\n );\n\n return React.useMemo(\n () => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname),\n [to, routePathnamesJson, locationPathname]\n );\n}\n\n/**\n * Returns the element of the route that matched the current location, prepared\n * with the correct context to render the remainder of the route tree. Route\n * elements in the tree must render an <Outlet> to render their child route's\n * element.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-routes\n */\nexport function useRoutes(\n routes: RouteObject[],\n locationArg?: Partial<Location> | string\n): React.ReactElement | null {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useRoutes() may be used only in the context of a <Router> component.`\n );\n\n let dataRouterStateContext = React.useContext(DataRouterStateContext);\n let { matches: parentMatches } = React.useContext(RouteContext);\n let routeMatch = parentMatches[parentMatches.length - 1];\n let parentParams = routeMatch ? routeMatch.params : {};\n let parentPathname = routeMatch ? routeMatch.pathname : \"/\";\n let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : \"/\";\n let parentRoute = routeMatch && routeMatch.route;\n\n if (__DEV__) {\n // You won't get a warning about 2 different <Routes> under a <Route>\n // without a trailing *, but this is a best-effort warning anyway since we\n // cannot even give the warning unless they land at the parent route.\n //\n // Example:\n //\n // <Routes>\n // {/* This route path MUST end with /* because otherwise\n // it will never match /blog/post/123 */}\n // <Route path=\"blog\" element={<Blog />} />\n // <Route path=\"blog/feed\" element={<BlogFeed />} />\n // </Routes>\n //\n // function Blog() {\n // return (\n // <Routes>\n // <Route path=\"post/:id\" element={<Post />} />\n // </Routes>\n // );\n // }\n let parentPath = (parentRoute && parentRoute.path) || \"\";\n warningOnce(\n parentPathname,\n !parentRoute || parentPath.endsWith(\"*\"),\n `You rendered descendant <Routes> (or called \\`useRoutes()\\`) at ` +\n `\"${parentPathname}\" (under <Route path=\"${parentPath}\">) but the ` +\n `parent route path has no trailing \"*\". This means if you navigate ` +\n `deeper, the parent won't match anymore and therefore the child ` +\n `routes will never render.\\n\\n` +\n `Please change the parent <Route path=\"${parentPath}\"> to <Route ` +\n `path=\"${parentPath === \"/\" ? \"*\" : `${parentPath}/*`}\">.`\n );\n }\n\n let locationFromContext = useLocation();\n\n let location;\n if (locationArg) {\n let parsedLocationArg =\n typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n\n invariant(\n parentPathnameBase === \"/\" ||\n parsedLocationArg.pathname?.startsWith(parentPathnameBase),\n `When overriding the location using \\`<Routes location>\\` or \\`useRoutes(routes, location)\\`, ` +\n `the location pathname must begin with the portion of the URL pathname that was ` +\n `matched by all parent routes. The current pathname base is \"${parentPathnameBase}\" ` +\n `but pathname \"${parsedLocationArg.pathname}\" was given in the \\`location\\` prop.`\n );\n\n location = parsedLocationArg;\n } else {\n location = locationFromContext;\n }\n\n let pathname = location.pathname || \"/\";\n let remainingPathname =\n parentPathnameBase === \"/\"\n ? pathname\n : pathname.slice(parentPathnameBase.length) || \"/\";\n\n let matches = matchRoutes(routes, { pathname: remainingPathname });\n\n if (__DEV__) {\n warning(\n parentRoute || matches != null,\n `No routes matched location \"${location.pathname}${location.search}${location.hash}\" `\n );\n\n warning(\n matches == null ||\n matches[matches.length - 1].route.element !== undefined,\n `Matched leaf route at location \"${location.pathname}${location.search}${location.hash}\" does not have an element. ` +\n `This means it will render an <Outlet /> with a null value by default resulting in an \"empty\" page.`\n );\n }\n\n return _renderMatches(\n matches &&\n matches.map((match) =>\n Object.assign({}, match, {\n params: Object.assign({}, parentParams, match.params),\n pathname: joinPaths([parentPathnameBase, match.pathname]),\n pathnameBase:\n match.pathnameBase === \"/\"\n ? parentPathnameBase\n : joinPaths([parentPathnameBase, match.pathnameBase]),\n })\n ),\n parentMatches,\n dataRouterStateContext || undefined\n );\n}\n\nfunction DefaultErrorElement() {\n let error = useRouteError();\n let message = isRouteErrorResponse(error)\n ? `${error.status} ${error.statusText}`\n : error instanceof Error\n ? error.message\n : JSON.stringify(error);\n let stack = error instanceof Error ? error.stack : null;\n let lightgrey = \"rgba(200,200,200, 0.5)\";\n let preStyles = { padding: \"0.5rem\", backgroundColor: lightgrey };\n let codeStyles = { padding: \"2px 4px\", backgroundColor: lightgrey };\n return (\n <>\n <h2>Unhandled Thrown Error!</h2>\n <h3 style={{ fontStyle: \"italic\" }}>{message}</h3>\n {stack ? <pre style={preStyles}>{stack}</pre> : null}\n <p>💿 Hey developer 👋</p>\n <p>\n You can provide a way better UX than this when your app throws errors by\n providing your own&nbsp;\n <code style={codeStyles}>errorElement</code> props on&nbsp;\n <code style={codeStyles}>&lt;Route&gt;</code>\n </p>\n </>\n );\n}\n\ntype RenderErrorBoundaryProps = React.PropsWithChildren<{\n location: Location;\n error: any;\n component: React.ReactNode;\n}>;\n\ntype RenderErrorBoundaryState = {\n location: Location;\n error: any;\n};\n\nexport class RenderErrorBoundary extends React.Component<\n RenderErrorBoundaryProps,\n RenderErrorBoundaryState\n> {\n constructor(props: RenderErrorBoundaryProps) {\n super(props);\n this.state = {\n location: props.location,\n error: props.error,\n };\n }\n\n static getDerivedStateFromError(error: any) {\n return { error: error };\n }\n\n static getDerivedStateFromProps(\n props: RenderErrorBoundaryProps,\n state: RenderErrorBoundaryState\n ) {\n // When we get into an error state, the user will likely click \"back\" to the\n // previous page that didn't have an error. Because this wraps the entire\n // application, that will have no effect--the error page continues to display.\n // This gives us a mechanism to recover from the error when the location changes.\n //\n // Whether we're in an error state or not, we update the location in state\n // so that when we are in an error state, it gets reset when a new location\n // comes in and the user recovers from the error.\n if (state.location !== props.location) {\n return {\n error: props.error,\n location: props.location,\n };\n }\n\n // If we're not changing locations, preserve the location but still surface\n // any new errors that may come through. We retain the existing error, we do\n // this because the error provided from the app state may be cleared without\n // the location changing.\n return {\n error: props.error || state.error,\n location: state.location,\n };\n }\n\n componentDidCatch(error: any, errorInfo: any) {\n console.error(\n \"React Router caught the following error during render\",\n error,\n errorInfo\n );\n }\n\n render() {\n return this.state.error ? (\n <RouteErrorContext.Provider\n value={this.state.error}\n children={this.props.component}\n />\n ) : (\n this.props.children\n );\n }\n}\n\ninterface RenderedRouteProps {\n routeContext: RouteContextObject;\n match: RouteMatch<string, RouteObject>;\n children: React.ReactNode | null;\n}\n\nfunction RenderedRoute({ routeContext, match, children }: RenderedRouteProps) {\n let dataStaticRouterContext = React.useContext(DataStaticRouterContext);\n\n // Track how deep we got in our render pass to emulate SSR componentDidCatch\n // in a DataStaticRouter\n if (dataStaticRouterContext && match.route.errorElement) {\n dataStaticRouterContext._deepestRenderedBoundaryId = match.route.id;\n }\n\n return (\n <RouteContext.Provider value={routeContext}>\n {children}\n </RouteContext.Provider>\n );\n}\n\nexport function _renderMatches(\n matches: RouteMatch[] | null,\n parentMatches: RouteMatch[] = [],\n dataRouterState?: RemixRouter[\"state\"]\n): React.ReactElement | null {\n if (matches == null) {\n if (dataRouterState?.errors) {\n // Don't bail if we have data router errors so we can render them in the\n // boundary. Use the pre-matched (or shimmed) matches\n matches = dataRouterState.matches;\n } else {\n return null;\n }\n }\n\n let renderedMatches = matches;\n\n // If we have data errors, trim matches to the highest error boundary\n let errors = dataRouterState?.errors;\n if (errors != null) {\n let errorIndex = renderedMatches.findIndex(\n (m) => m.route.id && errors?.[m.route.id]\n );\n invariant(\n errorIndex >= 0,\n `Could not find a matching route for the current errors: ${errors}`\n );\n renderedMatches = renderedMatches.slice(\n 0,\n Math.min(renderedMatches.length, errorIndex + 1)\n );\n }\n\n return renderedMatches.reduceRight((outlet, match, index) => {\n let error = match.route.id ? errors?.[match.route.id] : null;\n // Only data routers handle errors\n let errorElement = dataRouterState\n ? match.route.errorElement || <DefaultErrorElement />\n : null;\n let getChildren = () => (\n <RenderedRoute\n match={match}\n routeContext={{\n outlet,\n matches: parentMatches.concat(renderedMatches.slice(0, index + 1)),\n }}\n >\n {error\n ? errorElement\n : match.route.element !== undefined\n ? match.route.element\n : outlet}\n </RenderedRoute>\n );\n // Only wrap in an error boundary within data router usages when we have an\n // errorElement on this route. Otherwise let it bubble up to an ancestor\n // errorElement\n return dataRouterState && (match.route.errorElement || index === 0) ? (\n <RenderErrorBoundary\n location={dataRouterState.location}\n component={errorElement}\n error={error}\n children={getChildren()}\n />\n ) : (\n getChildren()\n );\n }, null as React.ReactElement | null);\n}\n\nenum DataRouterHook {\n UseLoaderData = \"useLoaderData\",\n UseActionData = \"useActionData\",\n UseRouteError = \"useRouteError\",\n UseNavigation = \"useNavigation\",\n UseRouteLoaderData = \"useRouteLoaderData\",\n UseMatches = \"useMatches\",\n UseRevalidator = \"useRevalidator\",\n}\n\nfunction useDataRouterState(hookName: DataRouterHook) {\n let state = React.useContext(DataRouterStateContext);\n invariant(state, `${hookName} must be used within a DataRouterStateContext`);\n return state;\n}\n\n/**\n * Returns the current navigation, defaulting to an \"idle\" navigation when\n * no navigation is in progress\n */\nexport function useNavigation() {\n let state = useDataRouterState(DataRouterHook.UseNavigation);\n return state.navigation;\n}\n\n/**\n * Returns a revalidate function for manually triggering revalidation, as well\n * as the current state of any manual revalidations\n */\nexport function useRevalidator() {\n let dataRouterContext = React.useContext(DataRouterContext);\n invariant(\n dataRouterContext,\n `useRevalidator must be used within a DataRouterContext`\n );\n let state = useDataRouterState(DataRouterHook.UseRevalidator);\n return {\n revalidate: dataRouterContext.router.revalidate,\n state: state.revalidation,\n };\n}\n\n/**\n * Returns the active route matches, useful for accessing loaderData for\n * parent/child routes or the route \"handle\" property\n */\nexport function useMatches() {\n let { matches, loaderData } = useDataRouterState(DataRouterHook.UseMatches);\n return React.useMemo(\n () =>\n matches.map((match) => {\n let { pathname, params } = match;\n return {\n id: match.route.id,\n pathname,\n params,\n data: loaderData[match.route.id] as unknown,\n handle: match.route.handle as unknown,\n };\n }),\n [matches, loaderData]\n );\n}\n\n/**\n * Returns the loader data for the nearest ancestor Route loader\n */\nexport function useLoaderData(): unknown {\n let state = useDataRouterState(DataRouterHook.UseLoaderData);\n\n let route = React.useContext(RouteContext);\n invariant(route, `useLoaderData must be used inside a RouteContext`);\n\n let thisRoute = route.matches[route.matches.length - 1];\n invariant(\n thisRoute.route.id,\n `useLoaderData can only be used on routes that contain a unique \"id\"`\n );\n\n return state.loaderData[thisRoute.route.id];\n}\n\n/**\n * Returns the loaderData for the given routeId\n */\nexport function useRouteLoaderData(routeId: string): unknown {\n let state = useDataRouterState(DataRouterHook.UseRouteLoaderData);\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the action data for the nearest ancestor Route action\n */\nexport function useActionData(): unknown {\n let state = useDataRouterState(DataRouterHook.UseActionData);\n\n let route = React.useContext(RouteContext);\n invariant(route, `useActionData must be used inside a RouteContext`);\n\n return Object.values(state?.actionData || {})[0];\n}\n\n/**\n * Returns the nearest ancestor Route error, which could be a loader/action\n * error or a render error. This is intended to be called from your\n * errorElement to display a proper error message.\n */\nexport function useRouteError(): unknown {\n let error = React.useContext(RouteErrorContext);\n let state = useDataRouterState(DataRouterHook.UseRouteError);\n let route = React.useContext(RouteContext);\n let thisRoute = route.matches[route.matches.length - 1];\n let deferredValue = React.useContext(DeferredContext);\n\n // Return deferred errors if we're inside a Deferred errorElement\n if (deferredValue && deferredValue instanceof Error) {\n return deferredValue;\n }\n\n // If this was a render error, we put it in a RouteError context inside\n // of RenderErrorBoundary\n if (error) {\n return error;\n }\n\n invariant(route, `useRouteError must be used inside a RouteContext`);\n invariant(\n thisRoute.route.id,\n `useRouteError can only be used on routes that contain a unique \"id\"`\n );\n\n // Otherwise look for errors from our data router state\n return state.errors?.[thisRoute.route.id];\n}\n\n/**\n * Returns the happy-path data from the nearest ancestor <Deferred /> value\n */\nexport function useDeferredData(): unknown {\n let value = React.useContext(DeferredContext);\n return value;\n}\n\nconst alreadyWarned: Record<string, boolean> = {};\n\nfunction warningOnce(key: string, cond: boolean, message: string) {\n if (!cond && !alreadyWarned[key]) {\n alreadyWarned[key] = true;\n warning(false, message);\n }\n}\n","import * as React from \"react\";\nimport type {\n HydrationState,\n InitialEntry,\n Location,\n MemoryHistory,\n RouteMatch,\n RouteObject,\n Router as RemixRouter,\n RouterState,\n To,\n} from \"@remix-run/router\";\nimport {\n Action as NavigationType,\n createMemoryHistory,\n createMemoryRouter,\n invariant,\n isDeferredError,\n parsePath,\n stripBasename,\n warning,\n} from \"@remix-run/router\";\nimport { useSyncExternalStore as useSyncExternalStoreShim } from \"./use-sync-external-store-shim\";\n\nimport type { Navigator, DataRouterContextObject } from \"./context\";\nimport {\n LocationContext,\n NavigationContext,\n DataRouterContext,\n DataRouterStateContext,\n DeferredContext,\n} from \"./context\";\nimport {\n useDeferredData,\n useInRouterContext,\n useNavigate,\n useOutlet,\n useRoutes,\n _renderMatches,\n} from \"./hooks\";\n\n// Module-scoped singleton to hold the router. Extracted from the React lifecycle\n// to avoid issues w.r.t. dual initialization fetches in concurrent rendering.\n// Data router apps are expected to have a static route tree and are not intended\n// to be unmounted/remounted at runtime.\nlet routerSingleton: RemixRouter;\n\n/**\n * Unit-testing-only function to reset the router between tests\n * @private\n */\nexport function _resetModuleScope() {\n // @ts-expect-error\n routerSingleton = null;\n}\n\n/**\n * A higher-order component that, given a Remix Router instance. setups the\n * Context's required for data routing\n */\nexport function DataRouterProvider({\n basename,\n children,\n fallbackElement,\n router,\n}: {\n basename?: string;\n children?: React.ReactNode;\n fallbackElement?: React.ReactNode;\n router: RemixRouter;\n}): React.ReactElement {\n // Sync router state to our component state to force re-renders\n let state: RouterState = useSyncExternalStoreShim(\n router.subscribe,\n () => router.state,\n // We have to provide this so React@18 doesn't complain during hydration,\n // but we pass our serialized hydration data into the router so state here\n // is already synced with what the server saw\n () => router.state\n );\n\n let navigator = React.useMemo((): Navigator => {\n return {\n createHref: router.createHref,\n go: (n) => router.navigate(n),\n push: (to, state, opts) =>\n router.navigate(to, { state, resetScroll: opts?.resetScroll }),\n replace: (to, state, opts) =>\n router.navigate(to, {\n replace: true,\n state,\n resetScroll: opts?.resetScroll,\n }),\n };\n }, [router]);\n\n let dataRouterContext: DataRouterContextObject = {\n router,\n navigator,\n static: false,\n basename: basename || \"/\",\n };\n\n if (!state.initialized) {\n return <>{fallbackElement}</>;\n }\n\n return (\n <DataRouterContext.Provider value={dataRouterContext}>\n <DataRouterStateContext.Provider value={state} children={children} />\n </DataRouterContext.Provider>\n );\n}\n\n/**\n * A data-aware wrapper for `<Router>` that leverages the Context's provided by\n * `<DataRouterProvider>`\n */\nexport function DataRouter() {\n let dataRouterContext = React.useContext(DataRouterContext);\n invariant(\n dataRouterContext,\n \"<DataRouter> may only be rendered within a DataRouterContext\"\n );\n let { router, navigator, basename } = dataRouterContext;\n\n return (\n <Router\n basename={basename}\n location={router.state.location}\n navigationType={router.state.historyAction}\n navigator={navigator}\n >\n <Routes />\n </Router>\n );\n}\n\nexport interface DataMemoryRouterProps {\n basename?: string;\n children?: React.ReactNode;\n initialEntries?: InitialEntry[];\n initialIndex?: number;\n hydrationData?: HydrationState;\n fallbackElement?: React.ReactNode;\n routes?: RouteObject[];\n}\n\nexport function DataMemoryRouter({\n basename,\n children,\n initialEntries,\n initialIndex,\n hydrationData,\n fallbackElement,\n routes,\n}: DataMemoryRouterProps): React.ReactElement {\n if (!routerSingleton) {\n routerSingleton = createMemoryRouter({\n basename,\n hydrationData,\n initialEntries,\n initialIndex,\n routes: routes || createRoutesFromChildren(children),\n }).initialize();\n }\n let router = routerSingleton;\n\n return (\n <DataRouterProvider\n router={router}\n basename={basename}\n fallbackElement={fallbackElement}\n >\n <DataRouter />\n </DataRouterProvider>\n );\n}\n\nexport interface MemoryRouterProps {\n basename?: string;\n children?: React.ReactNode;\n initialEntries?: InitialEntry[];\n initialIndex?: number;\n}\n\n/**\n * A <Router> that stores all entries in memory.\n *\n * @see https://reactrouter.com/docs/en/v6/routers/memory-router\n */\nexport function MemoryRouter({\n basename,\n children,\n initialEntries,\n initialIndex,\n}: MemoryRouterProps): React.ReactElement {\n let historyRef = React.useRef<MemoryHistory>();\n if (historyRef.current == null) {\n historyRef.current = createMemoryHistory({\n initialEntries,\n initialIndex,\n v5Compat: true,\n });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location,\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface NavigateProps {\n to: To;\n replace?: boolean;\n state?: any;\n}\n\n/**\n * Changes the current location.\n *\n * Note: This API is mostly useful in React.Component subclasses that are not\n * able to use hooks. In functional components, we recommend you use the\n * `useNavigate` hook instead.\n *\n * @see https://reactrouter.com/docs/en/v6/components/navigate\n */\nexport function Navigate({ to, replace, state }: NavigateProps): null {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of\n // the router loaded. We can help them understand how to avoid that.\n `<Navigate> may be used only in the context of a <Router> component.`\n );\n\n warning(\n !React.useContext(NavigationContext).static,\n `<Navigate> must not be used on the initial render in a <StaticRouter>. ` +\n `This is a no-op, but you should modify your code so the <Navigate> is ` +\n `only ever rendered in response to some user interaction or state change.`\n );\n\n let navigate = useNavigate();\n React.useEffect(() => {\n navigate(to, { replace, state });\n });\n\n return null;\n}\n\nexport interface OutletProps {\n context?: unknown;\n}\n\n/**\n * Renders the child route's element, if there is one.\n *\n * @see https://reactrouter.com/docs/en/v6/components/outlet\n */\nexport function Outlet(props: OutletProps): React.ReactElement | null {\n return useOutlet(props.context);\n}\n\ninterface DataRouteProps {\n id?: RouteObject[\"id\"];\n loader?: RouteObject[\"loader\"];\n action?: RouteObject[\"action\"];\n errorElement?: RouteObject[\"errorElement\"];\n shouldRevalidate?: RouteObject[\"shouldRevalidate\"];\n handle?: RouteObject[\"handle\"];\n}\n\nexport interface RouteProps extends DataRouteProps {\n caseSensitive?: boolean;\n children?: React.ReactNode;\n element?: React.ReactNode | null;\n index?: boolean;\n path?: string;\n}\n\nexport interface PathRouteProps extends DataRouteProps {\n caseSensitive?: boolean;\n children?: React.ReactNode;\n element?: React.ReactNode | null;\n index?: false;\n path: string;\n}\n\nexport interface LayoutRouteProps extends DataRouteProps {\n children?: React.ReactNode;\n element?: React.ReactNode | null;\n}\n\nexport interface IndexRouteProps extends DataRouteProps {\n element?: React.ReactNode | null;\n index: true;\n}\n\n/**\n * Declares an element that should be rendered at a certain URL path.\n *\n * @see https://reactrouter.com/docs/en/v6/components/route\n */\nexport function Route(\n _props: PathRouteProps | LayoutRouteProps | IndexRouteProps\n): React.ReactElement | null {\n invariant(\n false,\n `A <Route> is only ever to be used as the child of <Routes> element, ` +\n `never rendered directly. Please wrap your <Route> in a <Routes>.`\n );\n}\n\nexport interface RouterProps {\n basename?: string;\n children?: React.ReactNode;\n location: Partial<Location> | string;\n navigationType?: NavigationType;\n navigator: Navigator;\n static?: boolean;\n}\n\n/**\n * Provides location context for the rest of the app.\n *\n * Note: You usually won't render a <Router> directly. Instead, you'll render a\n * router that is more specific to your environment such as a <BrowserRouter>\n * in web browsers or a <StaticRouter> for server rendering.\n *\n * @see https://reactrouter.com/docs/en/v6/routers/router\n */\nexport function Router({\n basename: basenameProp = \"/\",\n children = null,\n location: locationProp,\n navigationType = NavigationType.Pop,\n navigator,\n static: staticProp = false,\n}: RouterProps): React.ReactElement | null {\n invariant(\n !useInRouterContext(),\n `You cannot render a <Router> inside another <Router>.` +\n ` You should never have more than one in your app.`\n );\n\n // Preserve trailing slashes on basename, so we can let the user control\n // the enforcement of trailing slashes throughout the app\n let basename = basenameProp.replace(/^\\/*/, \"/\");\n let navigationContext = React.useMemo(\n () => ({ basename, navigator, static: staticProp }),\n [basename, navigator, staticProp]\n );\n\n if (typeof locationProp === \"string\") {\n locationProp = parsePath(locationProp);\n }\n\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\",\n state = null,\n key = \"default\",\n } = locationProp;\n\n let location = React.useMemo(() => {\n let trailingPathname = stripBasename(pathname, basename);\n\n if (trailingPathname == null) {\n return null;\n }\n\n return {\n pathname: trailingPathname,\n search,\n hash,\n state,\n key,\n };\n }, [basename, pathname, search, hash, state, key]);\n\n warning(\n location != null,\n `<Router basename=\"${basename}\"> is not able to match the URL ` +\n `\"${pathname}${search}${hash}\" because it does not start with the ` +\n `basename, so the <Router> won't render anything.`\n );\n\n if (location == null) {\n return null;\n }\n\n return (\n <NavigationContext.Provider value={navigationContext}>\n <LocationContext.Provider\n children={children}\n value={{ location, navigationType }}\n />\n </NavigationContext.Provider>\n );\n}\n\nexport interface RoutesProps {\n children?: React.ReactNode;\n location?: Partial<Location> | string;\n}\n\n/**\n * A container for a nested tree of <Route> elements that renders the branch\n * that best matches the current location.\n *\n * @see https://reactrouter.com/docs/en/v6/components/routes\n */\nexport function Routes({\n children,\n location,\n}: RoutesProps): React.ReactElement | null {\n let dataRouterContext = React.useContext(DataRouterContext);\n // When in a DataRouterContext _without_ children, we use the router routes\n // directly. If we have children, then we're in a descendant tree and we\n // need to use child routes.\n let routes =\n dataRouterContext && !children\n ? dataRouterContext.router.routes\n : createRoutesFromChildren(children);\n return useRoutes(routes, location);\n}\n\nexport interface DeferredResolveRenderFunction {\n (data: Awaited<any>): JSX.Element;\n}\n\nexport interface DeferredProps {\n children: React.ReactNode | DeferredResolveRenderFunction;\n value: any;\n errorElement?: React.ReactNode;\n}\n\n/**\n * Component to use for rendering lazily loaded data from returning deferred()\n * in a loader function\n */\nexport function Deferred({ children, value, errorElement }: DeferredProps) {\n return (\n <DeferredErrorBoundary value={value} errorElement={errorElement}>\n <ResolveDeferred>{children}</ResolveDeferred>\n </DeferredErrorBoundary>\n );\n}\n\ntype DeferredErrorBoundaryProps = React.PropsWithChildren<{\n value: any;\n errorElement?: React.ReactNode;\n}>;\n\ntype DeferredErrorBoundaryState = {\n error: any;\n};\n\nclass DeferredErrorBoundary extends React.Component<\n DeferredErrorBoundaryProps,\n DeferredErrorBoundaryState\n> {\n constructor(props: DeferredErrorBoundaryProps) {\n super(props);\n this.state = { error: null };\n }\n\n static getDerivedStateFromError(error: any) {\n return { error };\n }\n\n componentDidCatch(error: any, errorInfo: any) {\n console.error(\n \"<Deferred> caught the following error during render\",\n error,\n errorInfo\n );\n }\n\n render() {\n let { children, errorElement, value } = this.props;\n\n // Handle render errors from this.state, or data errors from context\n let error = this.state.error || (isDeferredError(value) ? value : null);\n\n if (error) {\n if (errorElement) {\n // We have our own errorElement, provide our error and render it\n return (\n <DeferredContext.Provider value={error} children={errorElement} />\n );\n }\n // Throw to the nearest ancestor route-level error boundary\n throw error;\n }\n\n if (value instanceof Promise) {\n // Throw to the suspense boundary\n throw value;\n }\n\n // We've resolved successfully, provide the value and render the children\n return <DeferredContext.Provider value={value} children={children} />;\n }\n}\n\n/**\n * @private\n * Indirection to leverage useDeferredData for a render-prop API on <Deferred>\n */\nfunction ResolveDeferred({\n children,\n}: {\n children: React.ReactNode | DeferredResolveRenderFunction;\n}) {\n let data = useDeferredData();\n if (typeof children === \"function\") {\n return children(data);\n }\n return <>{children}</>;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// UTILS\n///////////////////////////////////////////////////////////////////////////////\n\n/**\n * Creates a route config from a React \"children\" object, which is usually\n * either a `<Route>` element or an array of them. Used internally by\n * `<Routes>` to create a route config from its children.\n *\n * @see https://reactrouter.com/docs/en/v6/utils/create-routes-from-children\n */\nexport function createRoutesFromChildren(\n children: React.ReactNode,\n parentPath: number[] = []\n): RouteObject[] {\n let routes: RouteObject[] = [];\n\n React.Children.forEach(children, (element, index) => {\n if (!React.isValidElement(element)) {\n // Ignore non-elements. This allows people to more easily inline\n // conditionals in their route config.\n return;\n }\n\n if (element.type === React.Fragment) {\n // Transparently support React.Fragment and its children.\n routes.push.apply(\n routes,\n createRoutesFromChildren(element.props.children, parentPath)\n );\n return;\n }\n\n invariant(\n element.type === Route,\n `[${\n typeof element.type === \"string\" ? element.type : element.type.name\n }] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`\n );\n\n let treePath = [...parentPath, index];\n let route: RouteObject = {\n id: element.props.id || treePath.join(\"-\"),\n caseSensitive: element.props.caseSensitive,\n element: element.props.element,\n index: element.props.index,\n path: element.props.path,\n loader: element.props.loader,\n action: element.props.action,\n errorElement: element.props.errorElement,\n shouldRevalidate: element.props.shouldRevalidate,\n handle: element.props.handle,\n };\n\n if (element.props.children) {\n route.children = createRoutesFromChildren(\n element.props.children,\n treePath\n );\n }\n\n routes.push(route);\n });\n\n return routes;\n}\n\n/**\n * Renders the result of `matchRoutes()` into a React element.\n */\nexport function renderMatches(\n matches: RouteMatch[] | null\n): React.ReactElement | null {\n return _renderMatches(matches);\n}\n"],"names":["is","Object","x","y","useState","useEffect","useLayoutEffect","useDebugValue","React","checkIfSnapshotChanged","inst","latestGetSnapshot","getSnapshot","prevValue","value","nextValue","error","shim","window","document","createElement","subscribe","getServerSnapshot","forceUpdate","useSyncExternalStore","DataStaticRouterContext","createContext","DataRouterContext","DataRouterStateContext","DeferredContext","NavigationContext","LocationContext","RouteContext","outlet","matches","RouteErrorContext","useHref","to","useInRouterContext","invariant","basename","navigator","useContext","hash","pathname","search","useResolvedPath","joinedPathname","joinPaths","createHref","useLocation","location","useNavigationType","navigationType","useMatch","pattern","useMemo","matchPath","getPathContributingMatches","filter","match","index","route","pathnameBase","useNavigate","locationPathname","routePathnamesJson","JSON","stringify","map","activeRef","useRef","current","useCallback","options","go","path","resolveTo","parse","replace","push","state","OutletContext","useOutletContext","useOutlet","context","Provider","useParams","routeMatch","length","params","useRoutes","routes","locationArg","dataRouterStateContext","parentMatches","parentParams","parentPathnameBase","locationFromContext","parsedLocationArg","parsePath","startsWith","remainingPathname","slice","matchRoutes","_renderMatches","assign","undefined","DefaultErrorElement","useRouteError","message","isRouteErrorResponse","status","statusText","Error","stack","lightgrey","preStyles","padding","backgroundColor","codeStyles","Fragment","style","fontStyle","RenderErrorBoundary","Component","constructor","props","super","this","static","componentDidCatch","errorInfo","console","render","children","component","RenderedRoute","routeContext","dataStaticRouterContext","errorElement","_deepestRenderedBoundaryId","id","dataRouterState","errors","renderedMatches","errorIndex","findIndex","m","Math","min","reduceRight","getChildren","concat","element","DataRouterHook","useDataRouterState","hookName","useNavigation","UseNavigation","navigation","useRevalidator","dataRouterContext","UseRevalidator","revalidate","router","revalidation","useMatches","loaderData","UseMatches","data","handle","useLoaderData","UseLoaderData","thisRoute","useRouteLoaderData","routeId","UseRouteLoaderData","useActionData","UseActionData","values","actionData","UseRouteError","deferredValue","useDeferredData","routerSingleton","DataRouterProvider","fallbackElement","useSyncExternalStoreShim","n","navigate","opts","resetScroll","initialized","DataRouter","Router","historyAction","Routes","DataMemoryRouter","initialEntries","initialIndex","hydrationData","createMemoryRouter","createRoutesFromChildren","initialize","MemoryRouter","historyRef","createMemoryHistory","v5Compat","history","setState","action","listen","Navigate","Outlet","Route","_props","basenameProp","locationProp","NavigationType","Pop","staticProp","navigationContext","key","trailingPathname","stripBasename","Deferred","DeferredErrorBoundary","ResolveDeferred","isDeferredError","Promise","parentPath","Children","forEach","isValidEl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