Socket
Socket
Sign inDemoInstall

react-router-dom

Package Overview
Dependencies
7
Maintainers
3
Versions
290
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.0-experimental-a077dc2d to 0.0.0-experimental-a0888892

245

CHANGELOG.md
# `react-router-dom`
## 6.22.0
### Minor Changes
- Include a `window__reactRouterVersion` tag for CWV Report detection ([#11222](https://github.com/remix-run/react-router/pull/11222))
### Patch Changes
- Updated dependencies:
- `@remix-run/router@1.15.0`
- `react-router@6.22.0`
## 6.21.3
### Patch Changes
- Fix `NavLink` `isPending` when a `basename` is used ([#11195](https://github.com/remix-run/react-router/pull/11195))
- Remove leftover `unstable_` prefix from `Blocker`/`BlockerFunction` types ([#11187](https://github.com/remix-run/react-router/pull/11187))
- Updated dependencies:
- `react-router@6.21.3`
## 6.21.2
### Patch Changes
- Leverage `useId` for internal fetcher keys when available ([#11166](https://github.com/remix-run/react-router/pull/11166))
- Updated dependencies:
- `@remix-run/router@1.14.2`
- `react-router@6.21.2`
## 6.21.1
### Patch Changes
- Updated dependencies:
- `react-router@6.21.1`
- `@remix-run/router@1.14.1`
## 6.21.0
### Minor Changes
- Add a new `future.v7_relativeSplatPath` flag to implement a breaking bug fix to relative routing when inside a splat route. ([#11087](https://github.com/remix-run/react-router/pull/11087))
This fix was originally added in [#10983](https://github.com/remix-run/react-router/issues/10983) and was later reverted in [#11078](https://github.com/remix-run/react-router/pull/11078) because it was determined that a large number of existing applications were relying on the buggy behavior (see [#11052](https://github.com/remix-run/react-router/issues/11052))
**The Bug**
The buggy behavior is that without this flag, the default behavior when resolving relative paths is to _ignore_ any splat (`*`) portion of the current route path.
**The Background**
This decision was originally made thinking that it would make the concept of nested different sections of your apps in `<Routes>` easier if relative routing would _replace_ the current splat:
```jsx
<BrowserRouter>
<Routes>
<Route path="/" element={<Home />} />
<Route path="dashboard/*" element={<Dashboard />} />
</Routes>
</BrowserRouter>
```
Any paths like `/dashboard`, `/dashboard/team`, `/dashboard/projects` will match the `Dashboard` route. The dashboard component itself can then render nested `<Routes>`:
```jsx
function Dashboard() {
return (
<div>
<h2>Dashboard</h2>
<nav>
<Link to="/">Dashboard Home</Link>
<Link to="team">Team</Link>
<Link to="projects">Projects</Link>
</nav>
<Routes>
<Route path="/" element={<DashboardHome />} />
<Route path="team" element={<DashboardTeam />} />
<Route path="projects" element={<DashboardProjects />} />
</Routes>
</div>
);
}
```
Now, all links and route paths are relative to the router above them. This makes code splitting and compartmentalizing your app really easy. You could render the `Dashboard` as its own independent app, or embed it into your large app without making any changes to it.
**The Problem**
The problem is that this concept of ignoring part of a path breaks a lot of other assumptions in React Router - namely that `"."` always means the current location pathname for that route. When we ignore the splat portion, we start getting invalid paths when using `"."`:
```jsx
// If we are on URL /dashboard/team, and we want to link to /dashboard/team:
function DashboardTeam() {
// ❌ This is broken and results in <a href="/dashboard">
return <Link to=".">A broken link to the Current URL</Link>;
// ✅ This is fixed but super unintuitive since we're already at /dashboard/team!
return <Link to="./team">A broken link to the Current URL</Link>;
}
```
We've also introduced an issue that we can no longer move our `DashboardTeam` component around our route hierarchy easily - since it behaves differently if we're underneath a non-splat route, such as `/dashboard/:widget`. Now, our `"."` links will, properly point to ourself _inclusive of the dynamic param value_ so behavior will break from it's corresponding usage in a `/dashboard/*` route.
Even worse, consider a nested splat route configuration:
```jsx
<BrowserRouter>
<Routes>
<Route path="dashboard">
<Route path="*" element={<Dashboard />} />
</Route>
</Routes>
</BrowserRouter>
```
Now, a `<Link to=".">` and a `<Link to="..">` inside the `Dashboard` component go to the same place! That is definitely not correct!
Another common issue arose in Data Routers (and Remix) where any `<Form>` should post to it's own route `action` if you the user doesn't specify a form action:
```jsx
let router = createBrowserRouter({
path: "/dashboard",
children: [
{
path: "*",
action: dashboardAction,
Component() {
// ❌ This form is broken! It throws a 405 error when it submits because
// it tries to submit to /dashboard (without the splat value) and the parent
// `/dashboard` route doesn't have an action
return <Form method="post">...</Form>;
},
},
],
});
```
This is just a compounded issue from the above because the default location for a `Form` to submit to is itself (`"."`) - and if we ignore the splat portion, that now resolves to the parent route.
**The Solution**
If you are leveraging this behavior, it's recommended to enable the future flag, move your splat to it's own route, and leverage `../` for any links to "sibling" pages:
```jsx
<BrowserRouter>
<Routes>
<Route path="dashboard">
<Route index path="*" element={<Dashboard />} />
</Route>
</Routes>
</BrowserRouter>
function Dashboard() {
return (
<div>
<h2>Dashboard</h2>
<nav>
<Link to="..">Dashboard Home</Link>
<Link to="../team">Team</Link>
<Link to="../projects">Projects</Link>
</nav>
<Routes>
<Route path="/" element={<DashboardHome />} />
<Route path="team" element={<DashboardTeam />} />
<Route path="projects" element={<DashboardProjects />} />
</Router>
</div>
);
}
```
This way, `.` means "the full current pathname for my route" in all cases (including static, dynamic, and splat routes) and `..` always means "my parents pathname".
### Patch Changes
- Updated dependencies:
- `@remix-run/router@1.14.0`
- `react-router@6.21.0`
## 6.20.1
### Patch Changes
- Revert the `useResolvedPath` fix for splat routes due to a large number of applications that were relying on the buggy behavior (see <https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329>). We plan to re-introduce this fix behind a future flag in the next minor version. ([#11078](https://github.com/remix-run/react-router/pull/11078))
- Updated dependencies:
- `react-router@6.20.1`
- `@remix-run/router@1.13.1`
## 6.20.0
### Minor Changes
- Export the `PathParam` type from the public API ([#10719](https://github.com/remix-run/react-router/pull/10719))
### Patch Changes
- Updated dependencies:
- `react-router@6.20.0`
- `@remix-run/router@1.13.0`
## 6.19.0
### Minor Changes
- Add `unstable_flushSync` option to `useNavigate`/`useSumbit`/`fetcher.load`/`fetcher.submit` to opt-out of `React.startTransition` and into `ReactDOM.flushSync` for state updates ([#11005](https://github.com/remix-run/react-router/pull/11005))
- Allow `unstable_usePrompt` to accept a `BlockerFunction` in addition to a `boolean` ([#10991](https://github.com/remix-run/react-router/pull/10991))
### Patch Changes
- Fix issue where a changing fetcher `key` in a `useFetcher` that remains mounted wasn't getting picked up ([#11009](https://github.com/remix-run/react-router/pull/11009))
- Fix `useFormAction` which was incorrectly inheriting the `?index` query param from child route `action` submissions ([#11025](https://github.com/remix-run/react-router/pull/11025))
- Fix `NavLink` `active` logic when `to` location has a trailing slash ([#10734](https://github.com/remix-run/react-router/pull/10734))
- Updated dependencies:
- `react-router@6.19.0`
- `@remix-run/router@1.12.0`
## 6.18.0
### Minor Changes
- Add support for manual fetcher key specification via `useFetcher({ key: string })` so you can access the same fetcher instance from different components in your application without prop-drilling ([RFC](https://github.com/remix-run/remix/discussions/7698)) ([#10960](https://github.com/remix-run/react-router/pull/10960))
- Fetcher keys are now also exposed on the fetchers returned from `useFetchers` so that they can be looked up by `key`
- Add `navigate`/`fetcherKey` params/props to `useSumbit`/`Form` to support kicking off a fetcher submission under the hood with an optionally user-specified `key` ([#10960](https://github.com/remix-run/react-router/pull/10960))
- Invoking a fetcher in this way is ephemeral and stateless
- If you need to access the state of one of these fetchers, you will need to leverage `useFetcher({ key })` to look it up elsewhere
### Patch Changes
- Adds a fetcher context to `RouterProvider` that holds completed fetcher data, in preparation for the upcoming future flag that will change the fetcher persistence/cleanup behavior ([#10961](https://github.com/remix-run/react-router/pull/10961))
- Fix the `future` prop on `BrowserRouter`, `HashRouter` and `MemoryRouter` so that it accepts a `Partial<FutureConfig>` instead of requiring all flags to be included. ([#10962](https://github.com/remix-run/react-router/pull/10962))
- Updated dependencies:
- `@remix-run/router@1.11.0`
- `react-router@6.18.0`
## 6.17.0

@@ -204,3 +441,3 @@

> **Warning**
> \[!WARNING]
> Please use version `6.13.0` or later instead of `6.12.1`. This version suffers from a `webpack`/`terser` minification issue resulting in invalid minified code in your resulting production bundles which can cause issues in your application. See [#10579](https://github.com/remix-run/react-router/issues/10579) for more details.

@@ -540,3 +777,3 @@

Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs over from Remix. Here's a quick high level overview, but it's recommended you go check out the [docs][rr-docs], especially the [feature overview][rr-feature-overview] and the [tutorial][rr-tutorial].
Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs over from Remix. Here's a quick high level overview, but it's recommended you go check out the [docs](https://reactrouter.com), especially the [feature overview](https://reactrouter.com/start/overview) and the [tutorial](https://reactrouter.com/start/tutorial).

@@ -567,5 +804,1 @@ **New APIs**

- `react-router@6.4.0`
[rr-docs]: https://reactrouter.com
[rr-feature-overview]: https://reactrouter.com/start/overview
[rr-tutorial]: https://reactrouter.com/start/tutorial

@@ -89,2 +89,6 @@ import type { FormEncType, HTMLFormMethod, RelativeRoutingType } from "@remix-run/router";

/**
* Enable flushSync for this navigation's state updates
*/
unstable_flushSync?: boolean;
/**
* Enable view transitions on this submission navigation

@@ -91,0 +95,0 @@ */

31

dist/index.d.ts

@@ -7,9 +7,10 @@ /**

import type { FutureConfig, Location, NavigateOptions, RelativeRoutingType, RouteObject, RouterProviderProps, To } from "react-router";
import type { Fetcher, FormEncType, FormMethod, FutureConfig as RouterFutureConfig, GetScrollRestorationKeyFunction, History, HTMLFormMethod, HydrationState, Router as RemixRouter, V7_FormMethod } from "@remix-run/router";
import type { DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, Fetcher, FormEncType, FormMethod, FutureConfig as RouterFutureConfig, GetScrollRestorationKeyFunction, History, HTMLFormMethod, HydrationState, Router as RemixRouter, V7_FormMethod, BlockerFunction } from "@remix-run/router";
import { UNSAFE_ErrorResponseImpl as ErrorResponseImpl } from "@remix-run/router";
import type { SubmitOptions, ParamKeyValuePair, URLSearchParamsInit, SubmitTarget } from "./dom";
import { createSearchParams } from "./dom";
export type { FormEncType, FormMethod, GetScrollRestorationKeyFunction, ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, V7_FormMethod, };
export { createSearchParams };
export type { ActionFunction, ActionFunctionArgs, AwaitProps, unstable_Blocker, unstable_BlockerFunction, DataRouteMatch, DataRouteObject, ErrorResponse, Fetcher, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LazyRouteFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, } from "react-router";
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, isRouteErrorResponse, generatePath, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, useActionData, useAsyncError, useAsyncValue, unstable_useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, } from "react-router";
export type { DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, FormEncType, FormMethod, GetScrollRestorationKeyFunction, ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, V7_FormMethod, };
export { createSearchParams, ErrorResponseImpl as UNSAFE_ErrorResponseImpl };
export type { ActionFunction, ActionFunctionArgs, AwaitProps, Blocker, BlockerFunction, DataRouteMatch, DataRouteObject, ErrorResponse, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LazyRouteFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathParam, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, } from "react-router";
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, isRouteErrorResponse, generatePath, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, } from "react-router";
/** @internal */

@@ -19,2 +20,3 @@ export { UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_NavigationContext, UNSAFE_LocationContext, UNSAFE_RouteContext, UNSAFE_useRouteId, } from "react-router";

var __staticRouterHydrationData: HydrationState | undefined;
var __reactRouterVersion: string;
interface Document {

@@ -28,2 +30,3 @@ startViewTransition(cb: () => Promise<void> | void): ViewTransition;

hydrationData?: HydrationState;
unstable_dataStrategy?: DataStrategyFunction;
window?: Window;

@@ -37,2 +40,3 @@ }

isTransitioning: true;
flushSync: boolean;
currentLocation: Location;

@@ -43,8 +47,4 @@ nextLocation: Location;

export { ViewTransitionContext as UNSAFE_ViewTransitionContext };
type FetchersContextObject = {
fetcherData: Map<string, any>;
register: (key: string) => void;
unregister: (key: string) => void;
};
declare const FetchersContext: React.Context<FetchersContextObject | null>;
type FetchersContextObject = Map<string, any>;
declare const FetchersContext: React.Context<FetchersContextObject>;
export { FetchersContext as UNSAFE_FetchersContext };

@@ -123,3 +123,2 @@ interface ViewTransition {

style?: React.CSSProperties | ((props: NavLinkRenderProps) => React.CSSProperties | undefined);
unstable_viewTransition?: boolean;
}

@@ -265,3 +264,5 @@ /**

submit: FetcherSubmitFunction;
load: (href: string) => void;
load: (href: string, opts?: {
unstable_flushSync?: boolean;
}) => void;
};

@@ -309,4 +310,4 @@ /**

*/
declare function usePrompt({ when, message }: {
when: boolean;
declare function usePrompt({ when, message, }: {
when: boolean | BlockerFunction;
message: string;

@@ -313,0 +314,0 @@ }): void;

/**
* React Router DOM v0.0.0-experimental-a077dc2d
* React Router DOM v0.0.0-experimental-a0888892
*

@@ -12,5 +12,7 @@ * Copyright (c) Remix Software Inc.

import * as React from 'react';
import { UNSAFE_mapRouteProperties, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, Router, UNSAFE_useRoutesImpl, UNSAFE_NavigationContext, useHref, useResolvedPath, useLocation, useNavigate, createPath, UNSAFE_useRouteId, UNSAFE_RouteContext, useMatches, useNavigation, unstable_useBlocker } from 'react-router';
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, UNSAFE_useRouteId, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, unstable_useBlocker, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes } from 'react-router';
import * as ReactDOM from 'react-dom';
import { UNSAFE_mapRouteProperties, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, Router, UNSAFE_useRoutesImpl, UNSAFE_NavigationContext, useHref, useResolvedPath, useLocation, useNavigate, createPath, UNSAFE_useRouteId, UNSAFE_RouteContext, useMatches, useNavigation, useBlocker } from 'react-router';
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, UNSAFE_useRouteId, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes } from 'react-router';
import { stripBasename, UNSAFE_warning, createRouter, createBrowserHistory, createHashHistory, UNSAFE_ErrorResponseImpl, UNSAFE_invariant, joinPaths, IDLE_FETCHER, matchPath } from '@remix-run/router';
export { UNSAFE_ErrorResponseImpl } from '@remix-run/router';

@@ -213,2 +215,17 @@ function _extends() {

_excluded3 = ["fetcherKey", "navigate", "reloadDocument", "replace", "state", "method", "action", "onSubmit", "relative", "preventScrollReset", "unstable_viewTransition"];
// HEY YOU! DON'T TOUCH THIS VARIABLE!
//
// It is replaced with the proper version at build time via a babel plugin in
// the rollup config.
//
// Export a global property onto the window for React Router detection by the
// Core Web Vitals Technology Report. This way they can configure the `wappalyzer`
// to detect and properly classify live websites as being built with React Router:
// https://github.com/HTTPArchive/wappalyzer/blob/main/src/technologies/r.json
const REACT_ROUTER_VERSION = "0";
try {
window.__reactRouterVersion = REACT_ROUTER_VERSION;
} catch (e) {
// no-op
}
function createBrowserRouter(routes, opts) {

@@ -226,2 +243,3 @@ return createRouter({

mapRouteProperties: UNSAFE_mapRouteProperties,
unstable_dataStrategy: opts == null ? void 0 : opts.unstable_dataStrategy,
window: opts == null ? void 0 : opts.window

@@ -242,2 +260,3 @@ }).initialize();

mapRouteProperties: UNSAFE_mapRouteProperties,
unstable_dataStrategy: opts == null ? void 0 : opts.unstable_dataStrategy,
window: opts == null ? void 0 : opts.window

@@ -301,3 +320,3 @@ }).initialize();

}
const FetchersContext = /*#__PURE__*/React.createContext(null);
const FetchersContext = /*#__PURE__*/React.createContext(new Map());
if (process.env.NODE_ENV !== "production") {

@@ -333,2 +352,6 @@ FetchersContext.displayName = "Fetchers";

const startTransitionImpl = React[START_TRANSITION];
const FLUSH_SYNC = "flushSync";
const flushSyncImpl = ReactDOM[FLUSH_SYNC];
const USE_ID = "useId";
const useIdImpl = React[USE_ID];
function startTransitionSafe(cb) {

@@ -341,2 +364,9 @@ if (startTransitionImpl) {

}
function flushSyncSafe(cb) {
if (flushSyncImpl) {
flushSyncImpl(cb);
} else {
cb();
}
}
class Deferred {

@@ -370,6 +400,2 @@ constructor() {

} = _ref;
let {
fetcherContext,
fetcherData
} = useFetcherDataLayer();
let [state, setStateImpl] = React.useState(router.state);

@@ -383,2 +409,3 @@ let [pendingState, setPendingState] = React.useState();

let [interruption, setInterruption] = React.useState();
let fetcherData = React.useRef(new Map());
let {

@@ -396,4 +423,7 @@ v7_startTransition

let {
deletedFetchers,
unstable_flushSync: flushSync,
unstable_viewTransitionOpts: viewTransitionOpts
} = _ref2;
deletedFetchers.forEach(key => fetcherData.current.delete(key));
newState.fetchers.forEach((fetcher, key) => {

@@ -404,9 +434,52 @@ if (fetcher.data !== undefined) {

});
if (!viewTransitionOpts || router.window == null || typeof router.window.document.startViewTransition !== "function") {
// Mid-navigation state update, or startViewTransition isn't available
optInStartTransition(() => setStateImpl(newState));
} else if (transition && renderDfd) {
let isViewTransitionUnavailable = router.window == null || typeof router.window.document.startViewTransition !== "function";
// If this isn't a view transition or it's not available in this browser,
// just update and be done with it
if (!viewTransitionOpts || isViewTransitionUnavailable) {
if (flushSync) {
flushSyncSafe(() => setStateImpl(newState));
} else {
optInStartTransition(() => setStateImpl(newState));
}
return;
}
// flushSync + startViewTransition
if (flushSync) {
// Flush through the context to mark DOM elements as transition=ing
flushSyncSafe(() => {
// Cancel any pending transitions
if (transition) {
renderDfd && renderDfd.resolve();
transition.skipTransition();
}
setVtContext({
isTransitioning: true,
flushSync: true,
currentLocation: viewTransitionOpts.currentLocation,
nextLocation: viewTransitionOpts.nextLocation
});
});
// Update the DOM
let t = router.window.document.startViewTransition(() => {
flushSyncSafe(() => setStateImpl(newState));
});
// Clean up after the animation completes
t.finished.finally(() => {
flushSyncSafe(() => {
setRenderDfd(undefined);
setTransition(undefined);
setPendingState(undefined);
setVtContext({
isTransitioning: false
});
});
});
flushSyncSafe(() => setTransition(t));
return;
}
// startTransition + startViewTransition
if (transition) {
// Interrupting an in-progress transition, cancel and let everything flush
// out, and then kick off a new transition from the interruption state
renderDfd.resolve();
renderDfd && renderDfd.resolve();
transition.skipTransition();

@@ -423,2 +496,3 @@ setInterruption({

isTransitioning: true,
flushSync: false,
currentLocation: viewTransitionOpts.currentLocation,

@@ -435,6 +509,6 @@ nextLocation: viewTransitionOpts.nextLocation

React.useEffect(() => {
if (vtContext.isTransitioning) {
if (vtContext.isTransitioning && !vtContext.flushSync) {
setRenderDfd(new Deferred());
}
}, [vtContext.isTransitioning]);
}, [vtContext]);
// Once the deferred is created, kick off startViewTransition() to update the

@@ -476,2 +550,3 @@ // DOM and then wait on the Deferred to resolve (indicating the DOM update has

isTransitioning: true,
flushSync: false,
currentLocation: interruption.currentLocation,

@@ -483,2 +558,7 @@ nextLocation: interruption.nextLocation

}, [vtContext.isTransitioning, interruption]);
React.useEffect(() => {
process.env.NODE_ENV !== "production" ? UNSAFE_warning(fallbackElement == null || !router.future.v7_partialHydration, "`<RouterProvider fallbackElement>` is deprecated when using " + "`v7_partialHydration`, use a `HydrateFallback` component instead") : void 0;
// Only log this once on initial mount
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
let navigator = React.useMemo(() => {

@@ -518,3 +598,3 @@ return {

}, /*#__PURE__*/React.createElement(FetchersContext.Provider, {
value: fetcherContext
value: fetcherData.current
}, /*#__PURE__*/React.createElement(ViewTransitionContext.Provider, {

@@ -526,5 +606,9 @@ value: vtContext

navigationType: state.historyAction,
navigator: navigator
}, state.initialized ? /*#__PURE__*/React.createElement(DataRoutes, {
navigator: navigator,
future: {
v7_relativeSplatPath: router.future.v7_relativeSplatPath
}
}, state.initialized || router.future.v7_partialHydration ? /*#__PURE__*/React.createElement(DataRoutes, {
routes: router.routes,
future: router.future,
state: state

@@ -536,5 +620,6 @@ }) : fallbackElement))))), null);

routes,
future,
state
} = _ref3;
return UNSAFE_useRoutesImpl(routes, undefined, state);
return UNSAFE_useRoutesImpl(routes, undefined, state, future);
}

@@ -575,3 +660,4 @@ /**

navigationType: state.action,
navigator: history
navigator: history,
future: future
});

@@ -614,3 +700,4 @@ }

navigationType: state.action,
navigator: history
navigator: history,
future: future
});

@@ -647,3 +734,4 @@ }

navigationType: state.action,
navigator: history
navigator: history,
future: future
});

@@ -752,3 +840,4 @@ }

let {
navigator
navigator,
basename
} = React.useContext(UNSAFE_NavigationContext);

@@ -767,3 +856,12 @@ let isTransitioning = routerState != null &&

}
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(toPathname.length) === "/";
if (nextLocationPathname && basename) {
nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
}
// If the `to` has a trailing slash, look at that exact spot. Otherwise,
// we're looking for a slash _after_ what's in `to`. For example:
//
// <NavLink to="/users"> and <NavLink to="/users/">
// both want to look for a / at index 6 to match URL `/users/matt`
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");

@@ -903,32 +1001,2 @@ let renderProps = {

}
function useFetcherDataLayer() {
let fetcherRefs = React.useRef(new Map());
let fetcherData = React.useRef(new Map());
let registerFetcher = React.useCallback(key => {
let count = fetcherRefs.current.get(key);
if (count == null) {
fetcherRefs.current.set(key, 1);
} else {
fetcherRefs.current.set(key, count + 1);
}
}, [fetcherRefs]);
let unregisterFetcher = React.useCallback(key => {
let count = fetcherRefs.current.get(key);
if (count == null || count <= 1) {
fetcherRefs.current.delete(key);
fetcherData.current.delete(key);
} else {
fetcherRefs.current.set(key, count - 1);
}
}, [fetcherData, fetcherRefs]);
let fetcherContext = React.useMemo(() => ({
fetcherData: fetcherData.current,
register: registerFetcher,
unregister: unregisterFetcher
}), [fetcherData, registerFetcher, unregisterFetcher]);
return {
fetcherContext,
fetcherData
};
}
// External hooks

@@ -1030,3 +1098,4 @@ /**

formMethod: options.method || method,
formEncType: options.encType || encType
formEncType: options.encType || encType,
unstable_flushSync: options.unstable_flushSync
});

@@ -1043,2 +1112,3 @@ } else {

fromRouteId: currentRouteId,
unstable_flushSync: options.unstable_flushSync,
unstable_viewTransition: options.unstable_viewTransition

@@ -1066,6 +1136,4 @@ });

}));
// Previously we set the default action to ".". The problem with this is that
// `useResolvedPath(".")` excludes search params of the resolved URL. This is
// the intended behavior of when "." is specifically provided as
// the form action, but inconsistent w/ browsers when the action is omitted.
// If no action was specified, browsers will persist current search params
// when determining the path, so match that behavior
// https://github.com/remix-run/remix/issues/927

@@ -1077,7 +1145,7 @@ let location = useLocation();

path.search = location.search;
// When grabbing search params from the URL, remove the automatically
// inserted ?index param so we match the useResolvedPath search behavior
// which would not include ?index
if (match.route.index) {
let params = new URLSearchParams(path.search);
// When grabbing search params from the URL, remove any included ?index param
// since it might not apply to our contextual route. We add it back based
// on match.route.index below
let params = new URLSearchParams(path.search);
if (params.has("index") && params.get("index") === "") {
params.delete("index");

@@ -1113,24 +1181,23 @@ path.search = params.toString() ? "?" + params.toString() : "";

let state = useDataRouterState(DataRouterStateHook.UseFetcher);
let fetchersContext = React.useContext(FetchersContext);
let fetcherData = React.useContext(FetchersContext);
let route = React.useContext(UNSAFE_RouteContext);
let routeId = (_route$matches = route.matches[route.matches.length - 1]) == null ? void 0 : _route$matches.route.id;
!fetchersContext ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "useFetcher must be used inside a FetchersContext") : UNSAFE_invariant(false) : void 0;
!fetcherData ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "useFetcher must be used inside a FetchersContext") : UNSAFE_invariant(false) : void 0;
!route ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "useFetcher must be used inside a RouteContext") : UNSAFE_invariant(false) : void 0;
!(routeId != null) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "useFetcher can only be used on routes that contain a unique \"id\"") : UNSAFE_invariant(false) : void 0;
// Fetcher key handling
let [fetcherKey, setFetcherKey] = React.useState(key || "");
if (!fetcherKey) {
// OK to call conditionally to feature detect `useId`
// eslint-disable-next-line react-hooks/rules-of-hooks
let defaultKey = useIdImpl ? useIdImpl() : "";
let [fetcherKey, setFetcherKey] = React.useState(key || defaultKey);
if (key && key !== fetcherKey) {
setFetcherKey(key);
} else if (!fetcherKey) {
// We will only fall through here when `useId` is not available
setFetcherKey(getUniqueFetcherId());
}
// Registration/cleanup
let {
fetcherData,
register,
unregister
} = fetchersContext;
React.useEffect(() => {
register(fetcherKey);
router.getFetcher(fetcherKey);
return () => {
// Unregister from ref counting for the data layer
unregister(fetcherKey);
// Tell the router we've unmounted - if v7_fetcherPersist is enabled this

@@ -1141,7 +1208,7 @@ // will not delete immediately but instead queue up a delete after the

};
}, [router, fetcherKey, register, unregister]);
}, [router, fetcherKey]);
// Fetcher additions
let load = React.useCallback(href => {
let load = React.useCallback((href, opts) => {
!routeId ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "No routeId available for fetcher.load()") : UNSAFE_invariant(false) : void 0;
router.fetch(fetcherKey, routeId, href);
router.fetch(fetcherKey, routeId, href, opts);
}, [fetcherKey, routeId, router]);

@@ -1345,3 +1412,3 @@ let submitImpl = useSubmit();

} = _ref12;
let blocker = unstable_useBlocker(when);
let blocker = useBlocker(when);
React.useEffect(() => {

@@ -1348,0 +1415,0 @@ if (blocker.state === "blocked") {

/**
* React Router DOM v0.0.0-experimental-a077dc2d
* React Router DOM v0.0.0-experimental-a0888892
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* React Router DOM v0.0.0-experimental-a077dc2d
* React Router DOM v0.0.0-experimental-a0888892
*

@@ -12,5 +12,7 @@ * Copyright (c) Remix Software Inc.

import * as React from 'react';
import { UNSAFE_mapRouteProperties, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, Router, UNSAFE_useRoutesImpl, UNSAFE_NavigationContext, useHref, useResolvedPath, useLocation, useNavigate, createPath, UNSAFE_useRouteId, UNSAFE_RouteContext, useMatches, useNavigation, unstable_useBlocker } from 'react-router';
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, UNSAFE_useRouteId, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, unstable_useBlocker, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes } from 'react-router';
import * as ReactDOM from 'react-dom';
import { UNSAFE_mapRouteProperties, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, Router, UNSAFE_useRoutesImpl, UNSAFE_NavigationContext, useHref, useResolvedPath, useLocation, useNavigate, createPath, UNSAFE_useRouteId, UNSAFE_RouteContext, useMatches, useNavigation, useBlocker } from 'react-router';
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, UNSAFE_useRouteId, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes } from 'react-router';
import { stripBasename, UNSAFE_warning, createRouter, createBrowserHistory, createHashHistory, UNSAFE_ErrorResponseImpl, UNSAFE_invariant, joinPaths, IDLE_FETCHER, matchPath } from '@remix-run/router';
export { UNSAFE_ErrorResponseImpl } from '@remix-run/router';

@@ -195,2 +197,18 @@ const defaultMethod = "get";

// HEY YOU! DON'T TOUCH THIS VARIABLE!
//
// It is replaced with the proper version at build time via a babel plugin in
// the rollup config.
//
// Export a global property onto the window for React Router detection by the
// Core Web Vitals Technology Report. This way they can configure the `wappalyzer`
// to detect and properly classify live websites as being built with React Router:
// https://github.com/HTTPArchive/wappalyzer/blob/main/src/technologies/r.json
const REACT_ROUTER_VERSION = "0";
try {
window.__reactRouterVersion = REACT_ROUTER_VERSION;
} catch (e) {
// no-op
}
////////////////////////////////////////////////////////////////////////////////

@@ -212,2 +230,3 @@ //#region Routers

mapRouteProperties: UNSAFE_mapRouteProperties,
unstable_dataStrategy: opts?.unstable_dataStrategy,
window: opts?.window

@@ -229,2 +248,3 @@ }).initialize();

mapRouteProperties: UNSAFE_mapRouteProperties,
unstable_dataStrategy: opts?.unstable_dataStrategy,
window: opts?.window

@@ -297,3 +317,3 @@ }).initialize();

const FetchersContext = /*#__PURE__*/React.createContext(null);
const FetchersContext = /*#__PURE__*/React.createContext(new Map());
{

@@ -332,2 +352,6 @@ FetchersContext.displayName = "Fetchers";

const startTransitionImpl = React[START_TRANSITION];
const FLUSH_SYNC = "flushSync";
const flushSyncImpl = ReactDOM[FLUSH_SYNC];
const USE_ID = "useId";
const useIdImpl = React[USE_ID];
function startTransitionSafe(cb) {

@@ -340,2 +364,9 @@ if (startTransitionImpl) {

}
function flushSyncSafe(cb) {
if (flushSyncImpl) {
flushSyncImpl(cb);
} else {
cb();
}
}
class Deferred {

@@ -374,6 +405,2 @@ status = "pending";

}) {
let {
fetcherContext,
fetcherData
} = useFetcherDataLayer();
let [state, setStateImpl] = React.useState(router.state);

@@ -387,2 +414,3 @@ let [pendingState, setPendingState] = React.useState();

let [interruption, setInterruption] = React.useState();
let fetcherData = React.useRef(new Map());
let {

@@ -399,4 +427,7 @@ v7_startTransition

let setState = React.useCallback((newState, {
deletedFetchers,
unstable_flushSync: flushSync,
unstable_viewTransitionOpts: viewTransitionOpts
}) => {
deletedFetchers.forEach(key => fetcherData.current.delete(key));
newState.fetchers.forEach((fetcher, key) => {

@@ -407,9 +438,57 @@ if (fetcher.data !== undefined) {

});
if (!viewTransitionOpts || router.window == null || typeof router.window.document.startViewTransition !== "function") {
// Mid-navigation state update, or startViewTransition isn't available
optInStartTransition(() => setStateImpl(newState));
} else if (transition && renderDfd) {
let isViewTransitionUnavailable = router.window == null || typeof router.window.document.startViewTransition !== "function";
// If this isn't a view transition or it's not available in this browser,
// just update and be done with it
if (!viewTransitionOpts || isViewTransitionUnavailable) {
if (flushSync) {
flushSyncSafe(() => setStateImpl(newState));
} else {
optInStartTransition(() => setStateImpl(newState));
}
return;
}
// flushSync + startViewTransition
if (flushSync) {
// Flush through the context to mark DOM elements as transition=ing
flushSyncSafe(() => {
// Cancel any pending transitions
if (transition) {
renderDfd && renderDfd.resolve();
transition.skipTransition();
}
setVtContext({
isTransitioning: true,
flushSync: true,
currentLocation: viewTransitionOpts.currentLocation,
nextLocation: viewTransitionOpts.nextLocation
});
});
// Update the DOM
let t = router.window.document.startViewTransition(() => {
flushSyncSafe(() => setStateImpl(newState));
});
// Clean up after the animation completes
t.finished.finally(() => {
flushSyncSafe(() => {
setRenderDfd(undefined);
setTransition(undefined);
setPendingState(undefined);
setVtContext({
isTransitioning: false
});
});
});
flushSyncSafe(() => setTransition(t));
return;
}
// startTransition + startViewTransition
if (transition) {
// Interrupting an in-progress transition, cancel and let everything flush
// out, and then kick off a new transition from the interruption state
renderDfd.resolve();
renderDfd && renderDfd.resolve();
transition.skipTransition();

@@ -426,2 +505,3 @@ setInterruption({

isTransitioning: true,
flushSync: false,
currentLocation: viewTransitionOpts.currentLocation,

@@ -440,6 +520,6 @@ nextLocation: viewTransitionOpts.nextLocation

React.useEffect(() => {
if (vtContext.isTransitioning) {
if (vtContext.isTransitioning && !vtContext.flushSync) {
setRenderDfd(new Deferred());
}
}, [vtContext.isTransitioning]);
}, [vtContext]);

@@ -484,2 +564,3 @@ // Once the deferred is created, kick off startViewTransition() to update the

isTransitioning: true,
flushSync: false,
currentLocation: interruption.currentLocation,

@@ -491,2 +572,7 @@ nextLocation: interruption.nextLocation

}, [vtContext.isTransitioning, interruption]);
React.useEffect(() => {
UNSAFE_warning(fallbackElement == null || !router.future.v7_partialHydration, "`<RouterProvider fallbackElement>` is deprecated when using " + "`v7_partialHydration`, use a `HydrateFallback` component instead") ;
// Only log this once on initial mount
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
let navigator = React.useMemo(() => {

@@ -527,3 +613,3 @@ return {

}, /*#__PURE__*/React.createElement(FetchersContext.Provider, {
value: fetcherContext
value: fetcherData.current
}, /*#__PURE__*/React.createElement(ViewTransitionContext.Provider, {

@@ -535,5 +621,9 @@ value: vtContext

navigationType: state.historyAction,
navigator: navigator
}, state.initialized ? /*#__PURE__*/React.createElement(DataRoutes, {
navigator: navigator,
future: {
v7_relativeSplatPath: router.future.v7_relativeSplatPath
}
}, state.initialized || router.future.v7_partialHydration ? /*#__PURE__*/React.createElement(DataRoutes, {
routes: router.routes,
future: router.future,
state: state

@@ -544,5 +634,6 @@ }) : fallbackElement))))), null);

routes,
future,
state
}) {
return UNSAFE_useRoutesImpl(routes, undefined, state);
return UNSAFE_useRoutesImpl(routes, undefined, state, future);
}

@@ -582,3 +673,4 @@ /**

navigationType: state.action,
navigator: history
navigator: history,
future: future
});

@@ -620,3 +712,4 @@ }

navigationType: state.action,
navigator: history
navigator: history,
future: future
});

@@ -652,3 +745,4 @@ }

navigationType: state.action,
navigator: history
navigator: history,
future: future
});

@@ -759,3 +853,4 @@ }

let {
navigator
navigator,
basename
} = React.useContext(UNSAFE_NavigationContext);

@@ -774,3 +869,13 @@ let isTransitioning = routerState != null &&

}
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(toPathname.length) === "/";
if (nextLocationPathname && basename) {
nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
}
// If the `to` has a trailing slash, look at that exact spot. Otherwise,
// we're looking for a slash _after_ what's in `to`. For example:
//
// <NavLink to="/users"> and <NavLink to="/users/">
// both want to look for a / at index 6 to match URL `/users/matt`
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");

@@ -908,32 +1013,2 @@ let renderProps = {

}
function useFetcherDataLayer() {
let fetcherRefs = React.useRef(new Map());
let fetcherData = React.useRef(new Map());
let registerFetcher = React.useCallback(key => {
let count = fetcherRefs.current.get(key);
if (count == null) {
fetcherRefs.current.set(key, 1);
} else {
fetcherRefs.current.set(key, count + 1);
}
}, [fetcherRefs]);
let unregisterFetcher = React.useCallback(key => {
let count = fetcherRefs.current.get(key);
if (count == null || count <= 1) {
fetcherRefs.current.delete(key);
fetcherData.current.delete(key);
} else {
fetcherRefs.current.set(key, count - 1);
}
}, [fetcherData, fetcherRefs]);
let fetcherContext = React.useMemo(() => ({
fetcherData: fetcherData.current,
register: registerFetcher,
unregister: unregisterFetcher
}), [fetcherData, registerFetcher, unregisterFetcher]);
return {
fetcherContext,
fetcherData
};
}

@@ -1045,3 +1120,4 @@ // External hooks

formMethod: options.method || method,
formEncType: options.encType || encType
formEncType: options.encType || encType,
unstable_flushSync: options.unstable_flushSync
});

@@ -1058,2 +1134,3 @@ } else {

fromRouteId: currentRouteId,
unstable_flushSync: options.unstable_flushSync,
unstable_viewTransition: options.unstable_viewTransition

@@ -1084,6 +1161,4 @@ });

// Previously we set the default action to ".". The problem with this is that
// `useResolvedPath(".")` excludes search params of the resolved URL. This is
// the intended behavior of when "." is specifically provided as
// the form action, but inconsistent w/ browsers when the action is omitted.
// If no action was specified, browsers will persist current search params
// when determining the path, so match that behavior
// https://github.com/remix-run/remix/issues/927

@@ -1096,7 +1171,7 @@ let location = useLocation();

// When grabbing search params from the URL, remove the automatically
// inserted ?index param so we match the useResolvedPath search behavior
// which would not include ?index
if (match.route.index) {
let params = new URLSearchParams(path.search);
// When grabbing search params from the URL, remove any included ?index param
// since it might not apply to our contextual route. We add it back based
// on match.route.index below
let params = new URLSearchParams(path.search);
if (params.has("index") && params.get("index") === "") {
params.delete("index");

@@ -1131,6 +1206,6 @@ path.search = params.toString() ? `?${params.toString()}` : "";

let state = useDataRouterState(DataRouterStateHook.UseFetcher);
let fetchersContext = React.useContext(FetchersContext);
let fetcherData = React.useContext(FetchersContext);
let route = React.useContext(UNSAFE_RouteContext);
let routeId = route.matches[route.matches.length - 1]?.route.id;
!fetchersContext ? UNSAFE_invariant(false, `useFetcher must be used inside a FetchersContext`) : void 0;
!fetcherData ? UNSAFE_invariant(false, `useFetcher must be used inside a FetchersContext`) : void 0;
!route ? UNSAFE_invariant(false, `useFetcher must be used inside a RouteContext`) : void 0;

@@ -1140,4 +1215,10 @@ !(routeId != null) ? UNSAFE_invariant(false, `useFetcher can only be used on routes that contain a unique "id"`) : void 0;

// Fetcher key handling
let [fetcherKey, setFetcherKey] = React.useState(key || "");
if (!fetcherKey) {
// OK to call conditionally to feature detect `useId`
// eslint-disable-next-line react-hooks/rules-of-hooks
let defaultKey = useIdImpl ? useIdImpl() : "";
let [fetcherKey, setFetcherKey] = React.useState(key || defaultKey);
if (key && key !== fetcherKey) {
setFetcherKey(key);
} else if (!fetcherKey) {
// We will only fall through here when `useId` is not available
setFetcherKey(getUniqueFetcherId());

@@ -1147,12 +1228,5 @@ }

// Registration/cleanup
let {
fetcherData,
register,
unregister
} = fetchersContext;
React.useEffect(() => {
register(fetcherKey);
router.getFetcher(fetcherKey);
return () => {
// Unregister from ref counting for the data layer
unregister(fetcherKey);
// Tell the router we've unmounted - if v7_fetcherPersist is enabled this

@@ -1163,8 +1237,8 @@ // will not delete immediately but instead queue up a delete after the

};
}, [router, fetcherKey, register, unregister]);
}, [router, fetcherKey]);
// Fetcher additions
let load = React.useCallback(href => {
let load = React.useCallback((href, opts) => {
!routeId ? UNSAFE_invariant(false, "No routeId available for fetcher.load()") : void 0;
router.fetch(fetcherKey, routeId, href);
router.fetch(fetcherKey, routeId, href, opts);
}, [fetcherKey, routeId, router]);

@@ -1382,3 +1456,3 @@ let submitImpl = useSubmit();

}) {
let blocker = unstable_useBlocker(when);
let blocker = useBlocker(when);
React.useEffect(() => {

@@ -1385,0 +1459,0 @@ if (blocker.state === "blocked") {

/**
* React Router DOM v0.0.0-experimental-a077dc2d
* React Router DOM v0.0.0-experimental-a0888892
*

@@ -11,3 +11,3 @@ * Copyright (c) Remix Software Inc.

*/
import*as e from"react";import{UNSAFE_mapRouteProperties as t,UNSAFE_DataRouterContext as n,UNSAFE_DataRouterStateContext as r,Router as a,UNSAFE_useRoutesImpl as o,UNSAFE_NavigationContext as i,useHref as s,useResolvedPath as u,useLocation as l,useNavigate as c,createPath as f,UNSAFE_useRouteId as m,UNSAFE_RouteContext as d,useMatches as h,useNavigation as p,unstable_useBlocker as w}from"react-router";export{AbortedDeferredError,Await,MemoryRouter,Navigate,NavigationType,Outlet,Route,Router,Routes,UNSAFE_DataRouterContext,UNSAFE_DataRouterStateContext,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,UNSAFE_useRouteId,createMemoryRouter,createPath,createRoutesFromChildren,createRoutesFromElements,defer,generatePath,isRouteErrorResponse,json,matchPath,matchRoutes,parsePath,redirect,redirectDocument,renderMatches,resolvePath,unstable_useBlocker,useActionData,useAsyncError,useAsyncValue,useHref,useInRouterContext,useLoaderData,useLocation,useMatch,useMatches,useNavigate,useNavigation,useNavigationType,useOutlet,useOutletContext,useParams,useResolvedPath,useRevalidator,useRouteError,useRouteLoaderData,useRoutes}from"react-router";import{stripBasename as v,createRouter as g,createBrowserHistory as y,createHashHistory as b,UNSAFE_ErrorResponseImpl as R,UNSAFE_invariant as S,joinPaths as E,IDLE_FETCHER as T,matchPath as C}from"@remix-run/router";const L="application/x-www-form-urlencoded";function x(e){return null!=e&&"string"==typeof e.tagName}function _(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map((e=>[n,e])):[[n,r]])}),[]))}let A=null;const k=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function F(e){return null==e||k.has(e)?e:null}function U(e,t){let n,r,a,o,i;if(x(s=e)&&"form"===s.tagName.toLowerCase()){let i=e.getAttribute("action");r=i?v(i,t):null,n=e.getAttribute("method")||"get",a=F(e.getAttribute("enctype"))||L,o=new FormData(e)}else if(function(e){return x(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return x(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let i=e.form;if(null==i)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||i.getAttribute("action");if(r=s?v(s,t):null,n=e.getAttribute("formmethod")||i.getAttribute("method")||"get",a=F(e.getAttribute("formenctype"))||F(i.getAttribute("enctype"))||L,o=new FormData(i,e),!function(){if(null===A)try{new FormData(document.createElement("form"),0),A=!1}catch(e){A=!0}return A}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?`${t}.`:"";o.append(`${e}x`,"0"),o.append(`${e}y`,"0")}else t&&o.append(t,r)}}else{if(x(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n="get",r=null,a=L,i=e}var s;return o&&"text/plain"===a&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:o,body:i}}function D(e,n){return g({basename:n?.basename,future:{...n?.future,v7_prependBasename:!0},history:y({window:n?.window}),hydrationData:n?.hydrationData||P(),routes:e,mapRouteProperties:t,window:n?.window}).initialize()}function N(e,n){return g({basename:n?.basename,future:{...n?.future,v7_prependBasename:!0},history:b({window:n?.window}),hydrationData:n?.hydrationData||P(),routes:e,mapRouteProperties:t,window:n?.window}).initialize()}function P(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:K(e.errors)}),e}function K(e){if(!e)return null;let t=Object.entries(e),n={};for(let[a,o]of t)if(o&&"RouteErrorResponse"===o.__type)n[a]=new R(o.status,o.statusText,o.data,!0===o.internal);else if(o&&"Error"===o.__type){if(o.__subType){let e=window[o.__subType];if("function"==typeof e)try{let t=new e(o.message);t.stack="",n[a]=t}catch(r){}}if(null==n[a]){let e=new Error(o.message);e.stack="",n[a]=e}}else n[a]=o;return n}const M=e.createContext({isTransitioning:!1}),O=e.createContext(null),j=e.startTransition;class V{status="pending";constructor(){this.promise=new Promise(((e,t)=>{this.resolve=t=>{"pending"===this.status&&(this.status="resolved",e(t))},this.reject=e=>{"pending"===this.status&&(this.status="rejected",t(e))}}))}}function I({fallbackElement:t,router:o,future:i}){let{fetcherContext:s,fetcherData:u}=function(){let t=e.useRef(new Map),n=e.useRef(new Map),r=e.useCallback((e=>{let n=t.current.get(e);null==n?t.current.set(e,1):t.current.set(e,n+1)}),[t]),a=e.useCallback((e=>{let r=t.current.get(e);null==r||r<=1?(t.current.delete(e),n.current.delete(e)):t.current.set(e,r-1)}),[n,t]);return{fetcherContext:e.useMemo((()=>({fetcherData:n.current,register:r,unregister:a})),[n,r,a]),fetcherData:n}}(),[l,c]=e.useState(o.state),[f,m]=e.useState(),[d,h]=e.useState({isTransitioning:!1}),[p,w]=e.useState(),[v,g]=e.useState(),[y,b]=e.useState(),{v7_startTransition:R}=i||{},S=e.useCallback((e=>{R?function(e){j?j(e):e()}(e):e()}),[R]),E=e.useCallback(((e,{unstable_viewTransitionOpts:t})=>{e.fetchers.forEach(((e,t)=>{void 0!==e.data&&u.current.set(t,e.data)})),t&&null!=o.window&&"function"==typeof o.window.document.startViewTransition?v&&p?(p.resolve(),v.skipTransition(),b({state:e,currentLocation:t.currentLocation,nextLocation:t.nextLocation})):(m(e),h({isTransitioning:!0,currentLocation:t.currentLocation,nextLocation:t.nextLocation})):S((()=>c(e)))}),[o.window,v,p,u,S]);e.useLayoutEffect((()=>o.subscribe(E)),[o,E]),e.useEffect((()=>{d.isTransitioning&&w(new V)}),[d.isTransitioning]),e.useEffect((()=>{if(p&&f&&o.window){let e=f,t=p.promise,n=o.window.document.startViewTransition((async()=>{S((()=>c(e))),await t}));n.finished.finally((()=>{w(void 0),g(void 0),m(void 0),h({isTransitioning:!1})})),g(n)}}),[S,f,p,o.window]),e.useEffect((()=>{p&&f&&l.location.key===f.location.key&&p.resolve()}),[p,v,l.location,f]),e.useEffect((()=>{!d.isTransitioning&&y&&(m(y.state),h({isTransitioning:!0,currentLocation:y.currentLocation,nextLocation:y.nextLocation}),b(void 0))}),[d.isTransitioning,y]);let T=e.useMemo((()=>({createHref:o.createHref,encodeLocation:o.encodeLocation,go:e=>o.navigate(e),push:(e,t,n)=>o.navigate(e,{state:t,preventScrollReset:n?.preventScrollReset}),replace:(e,t,n)=>o.navigate(e,{replace:!0,state:t,preventScrollReset:n?.preventScrollReset})})),[o]),C=o.basename||"/",L=e.useMemo((()=>({router:o,navigator:T,static:!1,basename:C})),[o,T,C]);return e.createElement(e.Fragment,null,e.createElement(n.Provider,{value:L},e.createElement(r.Provider,{value:l},e.createElement(O.Provider,{value:s},e.createElement(M.Provider,{value:d},e.createElement(a,{basename:C,location:l.location,navigationType:l.historyAction,navigator:T},l.initialized?e.createElement(z,{routes:o.routes,state:l}):t))))),null)}function z({routes:e,state:t}){return o(e,void 0,t)}function B({basename:t,children:n,future:r,window:o}){let i=e.useRef();null==i.current&&(i.current=y({window:o,v5Compat:!0}));let s=i.current,[u,l]=e.useState({action:s.action,location:s.location}),{v7_startTransition:c}=r||{},f=e.useCallback((e=>{c&&j?j((()=>l(e))):l(e)}),[l,c]);return e.useLayoutEffect((()=>s.listen(f)),[s,f]),e.createElement(a,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:s})}function H({basename:t,children:n,future:r,window:o}){let i=e.useRef();null==i.current&&(i.current=b({window:o,v5Compat:!0}));let s=i.current,[u,l]=e.useState({action:s.action,location:s.location}),{v7_startTransition:c}=r||{},f=e.useCallback((e=>{c&&j?j((()=>l(e))):l(e)}),[l,c]);return e.useLayoutEffect((()=>s.listen(f)),[s,f]),e.createElement(a,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:s})}function $({basename:t,children:n,future:r,history:o}){let[i,s]=e.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},l=e.useCallback((e=>{u&&j?j((()=>s(e))):s(e)}),[s,u]);return e.useLayoutEffect((()=>o.listen(l)),[o,l]),e.createElement(a,{basename:t,children:n,location:i.location,navigationType:i.action,navigator:o})}const W="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Y=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,J=e.forwardRef((function({onClick:t,relative:n,reloadDocument:r,replace:a,state:o,target:u,to:l,preventScrollReset:c,unstable_viewTransition:f,...m},d){let h,{basename:p}=e.useContext(i),w=!1;if("string"==typeof l&&Y.test(l)&&(h=l,W))try{let e=new URL(window.location.href),t=l.startsWith("//")?new URL(e.protocol+l):new URL(l),n=v(t.pathname,p);t.origin===e.origin&&null!=n?l=n+t.search+t.hash:w=!0}catch(b){}let g=s(l,{relative:n}),y=ne(l,{replace:a,state:o,target:u,preventScrollReset:c,relative:n,unstable_viewTransition:f});return e.createElement("a",Object.assign({},m,{href:h||g,onClick:w||r?t:function(e){t&&t(e),e.defaultPrevented||y(e)},ref:d,target:u}))})),q=e.forwardRef((function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:o=!1,style:s,to:c,unstable_viewTransition:f,children:m,...d},h){let p=u(c,{relative:d.relative}),w=l(),v=e.useContext(r),{navigator:g}=e.useContext(i),y=null!=v&&he(p)&&!0===f,b=g.encodeLocation?g.encodeLocation(p).pathname:p.pathname,R=w.pathname,S=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;n||(R=R.toLowerCase(),S=S?S.toLowerCase():null,b=b.toLowerCase());let E,T=R===b||!o&&R.startsWith(b)&&"/"===R.charAt(b.length),C=null!=S&&(S===b||!o&&S.startsWith(b)&&"/"===S.charAt(b.length)),L={isActive:T,isPending:C,isTransitioning:y},x=T?t:void 0;E="function"==typeof a?a(L):[a,T?"active":null,C?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let _="function"==typeof s?s(L):s;return e.createElement(J,Object.assign({},d,{"aria-current":x,className:E,ref:h,style:_,to:c,unstable_viewTransition:f}),"function"==typeof m?m(L):m)})),G=e.forwardRef((({fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:o,method:i="get",action:s,onSubmit:u,relative:l,preventScrollReset:c,unstable_viewTransition:f,...m},d)=>{let h=ie(),p=se(s,{relative:l}),w="get"===i.toLowerCase()?"get":"post";return e.createElement("form",Object.assign({ref:d,method:w,action:p,onSubmit:r?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute("formmethod")||i;h(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:a,state:o,relative:l,preventScrollReset:c,unstable_viewTransition:f})}},m))}));function Q({getKey:e,storageKey:t}){return fe({getKey:e,storageKey:t}),null}var X=function(e){return e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState",e}(X||{}),Z=function(e){return e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration",e}(Z||{});function ee(t){let r=e.useContext(n);return r||S(!1),r}function te(t){let n=e.useContext(r);return n||S(!1),n}function ne(t,{target:n,replace:r,state:a,preventScrollReset:o,relative:i,unstable_viewTransition:s}={}){let m=c(),d=l(),h=u(t,{relative:i});return e.useCallback((e=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(e,n)){e.preventDefault();let n=void 0!==r?r:f(d)===f(h);m(t,{replace:n,state:a,preventScrollReset:o,relative:i,unstable_viewTransition:s})}}),[d,m,h,r,a,n,t,o,i,s])}function re(t){let n=e.useRef(_(t)),r=e.useRef(!1),a=l(),o=e.useMemo((()=>function(e,t){let n=_(e);return t&&t.forEach(((e,r)=>{n.has(r)||t.getAll(r).forEach((e=>{n.append(r,e)}))})),n}(a.search,r.current?null:n.current)),[a.search]),i=c(),s=e.useCallback(((e,t)=>{const n=_("function"==typeof e?e(o):e);r.current=!0,i("?"+n,t)}),[i,o]);return[o,s]}let ae=0,oe=()=>`__${String(++ae)}__`;function ie(){let{router:t}=ee(X.UseSubmit),{basename:n}=e.useContext(i),r=m();return e.useCallback(((e,a={})=>{!function(){if("undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}();let{action:o,method:i,encType:s,formData:u,body:l}=U(e,n);if(!1===a.navigate){let e=a.fetcherKey||oe();t.fetch(e,r,a.action||o,{preventScrollReset:a.preventScrollReset,formData:u,body:l,formMethod:a.method||i,formEncType:a.encType||s})}else t.navigate(a.action||o,{preventScrollReset:a.preventScrollReset,formData:u,body:l,formMethod:a.method||i,formEncType:a.encType||s,replace:a.replace,state:a.state,fromRouteId:r,unstable_viewTransition:a.unstable_viewTransition})}),[t,n,r])}function se(t,{relative:n}={}){let{basename:r}=e.useContext(i),a=e.useContext(d);a||S(!1);let[o]=a.matches.slice(-1),s={...u(t||".",{relative:n})},c=l();if(null==t&&(s.search=c.search,o.route.index)){let e=new URLSearchParams(s.search);e.delete("index"),s.search=e.toString()?`?${e.toString()}`:""}return t&&"."!==t||!o.route.index||(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),"/"!==r&&(s.pathname="/"===s.pathname?r:E([r,s.pathname])),f(s)}function ue({key:t}={}){let{router:n}=ee(X.UseFetcher),r=te(Z.UseFetcher),a=e.useContext(O),o=e.useContext(d),i=o.matches[o.matches.length-1]?.route.id;a||S(!1),o||S(!1),null==i&&S(!1);let[s,u]=e.useState(t||"");s||u(oe());let{fetcherData:l,register:c,unregister:f}=a;e.useEffect((()=>(c(s),()=>{f(s),n.deleteFetcher(s)})),[n,s,c,f]);let m=e.useCallback((e=>{i||S(!1),n.fetch(s,i,e)}),[s,i,n]),h=ie(),p=e.useCallback(((e,t)=>{h(e,{...t,navigate:!1,fetcherKey:s})}),[s,h]),w=e.useMemo((()=>e.forwardRef(((t,n)=>e.createElement(G,Object.assign({},t,{navigate:!1,fetcherKey:s,ref:n}))))),[s]),v=r.fetchers.get(s)||T,g=l.get(s);return e.useMemo((()=>({Form:w,submit:p,load:m,...v,data:g})),[w,p,m,v,g])}function le(){let e=te(Z.UseFetchers);return Array.from(e.fetchers.entries()).map((([e,t])=>({...t,key:e})))}let ce={};function fe({getKey:t,storageKey:n}={}){let{router:r}=ee(X.UseScrollRestoration),{restoreScrollPosition:a,preventScrollReset:o}=te(Z.UseScrollRestoration),{basename:s}=e.useContext(i),u=l(),c=h(),f=p();e.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),function(t,n){let{capture:r}=n||{};e.useEffect((()=>{let e=null!=r?{capture:r}:void 0;return window.addEventListener("pagehide",t,e),()=>{window.removeEventListener("pagehide",t,e)}}),[t,r])}(e.useCallback((()=>{if("idle"===f.state){let e=(t?t(u,c):null)||u.key;ce[e]=window.scrollY}try{sessionStorage.setItem(n||"react-router-scroll-positions",JSON.stringify(ce))}catch(e){}window.history.scrollRestoration="auto"}),[n,t,f.state,u,c])),"undefined"!=typeof document&&(e.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(n||"react-router-scroll-positions");e&&(ce=JSON.parse(e))}catch(e){}}),[n]),e.useLayoutEffect((()=>{let e=t&&"/"!==s?(e,n)=>t({...e,pathname:v(e.pathname,s)||e.pathname},n):t,n=r?.enableScrollRestoration(ce,(()=>window.scrollY),e);return()=>n&&n()}),[r,s,t]),e.useLayoutEffect((()=>{if(!1!==a)if("number"!=typeof a){if(u.hash){let e=document.getElementById(decodeURIComponent(u.hash.slice(1)));if(e)return void e.scrollIntoView()}!0!==o&&window.scrollTo(0,0)}else window.scrollTo(0,a)}),[u,a,o]))}function me(t,n){let{capture:r}=n||{};e.useEffect((()=>{let e=null!=r?{capture:r}:void 0;return window.addEventListener("beforeunload",t,e),()=>{window.removeEventListener("beforeunload",t,e)}}),[t,r])}function de({when:t,message:n}){let r=w(t);e.useEffect((()=>{if("blocked"===r.state){window.confirm(n)?setTimeout(r.proceed,0):r.reset()}}),[r,n]),e.useEffect((()=>{"blocked"!==r.state||t||r.reset()}),[r,t])}function he(t,n={}){let r=e.useContext(M);null==r&&S(!1);let{basename:a}=ee(X.useViewTransitionState),o=u(t,{relative:n.relative});if(!r.isTransitioning)return!1;let i=v(r.currentLocation.pathname,a)||r.currentLocation.pathname,s=v(r.nextLocation.pathname,a)||r.nextLocation.pathname;return null!=C(o.pathname,s)||null!=C(o.pathname,i)}export{B as BrowserRouter,G as Form,H as HashRouter,J as Link,q as NavLink,I as RouterProvider,Q as ScrollRestoration,O as UNSAFE_FetchersContext,M as UNSAFE_ViewTransitionContext,fe as UNSAFE_useScrollRestoration,D as createBrowserRouter,N as createHashRouter,_ as createSearchParams,$ as unstable_HistoryRouter,de as unstable_usePrompt,he as unstable_useViewTransitionState,me as useBeforeUnload,ue as useFetcher,le as useFetchers,se as useFormAction,ne as useLinkClickHandler,re as useSearchParams,ie as useSubmit};
import*as e from"react";import*as t from"react-dom";import{UNSAFE_mapRouteProperties as n,UNSAFE_DataRouterContext as r,UNSAFE_DataRouterStateContext as a,Router as o,UNSAFE_useRoutesImpl as i,UNSAFE_NavigationContext as s,useHref as u,useResolvedPath as l,useLocation as c,useNavigate as f,createPath as d,UNSAFE_useRouteId as m,UNSAFE_RouteContext as h,useMatches as p,useNavigation as w,useBlocker as v}from"react-router";export{AbortedDeferredError,Await,MemoryRouter,Navigate,NavigationType,Outlet,Route,Router,Routes,UNSAFE_DataRouterContext,UNSAFE_DataRouterStateContext,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,UNSAFE_useRouteId,createMemoryRouter,createPath,createRoutesFromChildren,createRoutesFromElements,defer,generatePath,isRouteErrorResponse,json,matchPath,matchRoutes,parsePath,redirect,redirectDocument,renderMatches,resolvePath,useActionData,useAsyncError,useAsyncValue,useBlocker,useHref,useInRouterContext,useLoaderData,useLocation,useMatch,useMatches,useNavigate,useNavigation,useNavigationType,useOutlet,useOutletContext,useParams,useResolvedPath,useRevalidator,useRouteError,useRouteLoaderData,useRoutes}from"react-router";import{stripBasename as g,createRouter as y,createBrowserHistory as b,createHashHistory as S,UNSAFE_ErrorResponseImpl as R,UNSAFE_invariant as E,joinPaths as _,IDLE_FETCHER as T,matchPath as L}from"@remix-run/router";export{UNSAFE_ErrorResponseImpl}from"@remix-run/router";const x="application/x-www-form-urlencoded";function C(e){return null!=e&&"string"==typeof e.tagName}function A(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map((e=>[n,e])):[[n,r]])}),[]))}let F=null;const U=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function k(e){return null==e||U.has(e)?e:null}function N(e,t){let n,r,a,o,i;if(C(s=e)&&"form"===s.tagName.toLowerCase()){let i=e.getAttribute("action");r=i?g(i,t):null,n=e.getAttribute("method")||"get",a=k(e.getAttribute("enctype"))||x,o=new FormData(e)}else if(function(e){return C(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return C(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let i=e.form;if(null==i)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||i.getAttribute("action");if(r=s?g(s,t):null,n=e.getAttribute("formmethod")||i.getAttribute("method")||"get",a=k(e.getAttribute("formenctype"))||k(i.getAttribute("enctype"))||x,o=new FormData(i,e),!function(){if(null===F)try{new FormData(document.createElement("form"),0),F=!1}catch(e){F=!0}return F}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?`${t}.`:"";o.append(`${e}x`,"0"),o.append(`${e}y`,"0")}else t&&o.append(t,r)}}else{if(C(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n="get",r=null,a=x,i=e}var s;return o&&"text/plain"===a&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:o,body:i}}try{window.__reactRouterVersion="0"}catch(ye){}function P(e,t){return y({basename:t?.basename,future:{...t?.future,v7_prependBasename:!0},history:b({window:t?.window}),hydrationData:t?.hydrationData||K(),routes:e,mapRouteProperties:n,unstable_dataStrategy:t?.unstable_dataStrategy,window:t?.window}).initialize()}function D(e,t){return y({basename:t?.basename,future:{...t?.future,v7_prependBasename:!0},history:S({window:t?.window}),hydrationData:t?.hydrationData||K(),routes:e,mapRouteProperties:n,unstable_dataStrategy:t?.unstable_dataStrategy,window:t?.window}).initialize()}function K(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:M(e.errors)}),e}function M(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,a]of t)if(a&&"RouteErrorResponse"===a.__type)n[r]=new R(a.status,a.statusText,a.data,!0===a.internal);else if(a&&"Error"===a.__type){if(a.__subType){let e=window[a.__subType];if("function"==typeof e)try{let t=new e(a.message);t.stack="",n[r]=t}catch(ye){}}if(null==n[r]){let e=new Error(a.message);e.stack="",n[r]=e}}else n[r]=a;return n}const O=e.createContext({isTransitioning:!1}),V=e.createContext(new Map),j=e.startTransition,I=t.flushSync,H=e.useId;function z(e){I?I(e):e()}class B{status="pending";constructor(){this.promise=new Promise(((e,t)=>{this.resolve=t=>{"pending"===this.status&&(this.status="resolved",e(t))},this.reject=e=>{"pending"===this.status&&(this.status="rejected",t(e))}}))}}function $({fallbackElement:t,router:n,future:i}){let[s,u]=e.useState(n.state),[l,c]=e.useState(),[f,d]=e.useState({isTransitioning:!1}),[m,h]=e.useState(),[p,w]=e.useState(),[v,g]=e.useState(),y=e.useRef(new Map),{v7_startTransition:b}=i||{},S=e.useCallback((e=>{b?function(e){j?j(e):e()}(e):e()}),[b]),R=e.useCallback(((e,{deletedFetchers:t,unstable_flushSync:r,unstable_viewTransitionOpts:a})=>{t.forEach((e=>y.current.delete(e))),e.fetchers.forEach(((e,t)=>{void 0!==e.data&&y.current.set(t,e.data)}));let o=null==n.window||"function"!=typeof n.window.document.startViewTransition;if(a&&!o){if(r){z((()=>{p&&(m&&m.resolve(),p.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:a.currentLocation,nextLocation:a.nextLocation})}));let t=n.window.document.startViewTransition((()=>{z((()=>u(e)))}));return t.finished.finally((()=>{z((()=>{h(void 0),w(void 0),c(void 0),d({isTransitioning:!1})}))})),void z((()=>w(t)))}p?(m&&m.resolve(),p.skipTransition(),g({state:e,currentLocation:a.currentLocation,nextLocation:a.nextLocation})):(c(e),d({isTransitioning:!0,flushSync:!1,currentLocation:a.currentLocation,nextLocation:a.nextLocation}))}else r?z((()=>u(e))):S((()=>u(e)))}),[n.window,p,m,y,S]);e.useLayoutEffect((()=>n.subscribe(R)),[n,R]),e.useEffect((()=>{f.isTransitioning&&!f.flushSync&&h(new B)}),[f]),e.useEffect((()=>{if(m&&l&&n.window){let e=l,t=m.promise,r=n.window.document.startViewTransition((async()=>{S((()=>u(e))),await t}));r.finished.finally((()=>{h(void 0),w(void 0),c(void 0),d({isTransitioning:!1})})),w(r)}}),[S,l,m,n.window]),e.useEffect((()=>{m&&l&&s.location.key===l.location.key&&m.resolve()}),[m,p,s.location,l]),e.useEffect((()=>{!f.isTransitioning&&v&&(c(v.state),d({isTransitioning:!0,flushSync:!1,currentLocation:v.currentLocation,nextLocation:v.nextLocation}),g(void 0))}),[f.isTransitioning,v]),e.useEffect((()=>{}),[]);let E=e.useMemo((()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:e=>n.navigate(e),push:(e,t,r)=>n.navigate(e,{state:t,preventScrollReset:r?.preventScrollReset}),replace:(e,t,r)=>n.navigate(e,{replace:!0,state:t,preventScrollReset:r?.preventScrollReset})})),[n]),_=n.basename||"/",T=e.useMemo((()=>({router:n,navigator:E,static:!1,basename:_})),[n,E,_]);return e.createElement(e.Fragment,null,e.createElement(r.Provider,{value:T},e.createElement(a.Provider,{value:s},e.createElement(V.Provider,{value:y.current},e.createElement(O.Provider,{value:f},e.createElement(o,{basename:_,location:s.location,navigationType:s.historyAction,navigator:E,future:{v7_relativeSplatPath:n.future.v7_relativeSplatPath}},s.initialized||n.future.v7_partialHydration?e.createElement(W,{routes:n.routes,future:n.future,state:s}):t))))),null)}function W({routes:e,future:t,state:n}){return i(e,void 0,n,t)}function Y({basename:t,children:n,future:r,window:a}){let i=e.useRef();null==i.current&&(i.current=b({window:a,v5Compat:!0}));let s=i.current,[u,l]=e.useState({action:s.action,location:s.location}),{v7_startTransition:c}=r||{},f=e.useCallback((e=>{c&&j?j((()=>l(e))):l(e)}),[l,c]);return e.useLayoutEffect((()=>s.listen(f)),[s,f]),e.createElement(o,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:s,future:r})}function J({basename:t,children:n,future:r,window:a}){let i=e.useRef();null==i.current&&(i.current=S({window:a,v5Compat:!0}));let s=i.current,[u,l]=e.useState({action:s.action,location:s.location}),{v7_startTransition:c}=r||{},f=e.useCallback((e=>{c&&j?j((()=>l(e))):l(e)}),[l,c]);return e.useLayoutEffect((()=>s.listen(f)),[s,f]),e.createElement(o,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:s,future:r})}function q({basename:t,children:n,future:r,history:a}){let[i,s]=e.useState({action:a.action,location:a.location}),{v7_startTransition:u}=r||{},l=e.useCallback((e=>{u&&j?j((()=>s(e))):s(e)}),[s,u]);return e.useLayoutEffect((()=>a.listen(l)),[a,l]),e.createElement(o,{basename:t,children:n,location:i.location,navigationType:i.action,navigator:a,future:r})}const G="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Q=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,X=e.forwardRef((function({onClick:t,relative:n,reloadDocument:r,replace:a,state:o,target:i,to:l,preventScrollReset:c,unstable_viewTransition:f,...d},m){let h,{basename:p}=e.useContext(s),w=!1;if("string"==typeof l&&Q.test(l)&&(h=l,G))try{let e=new URL(window.location.href),t=l.startsWith("//")?new URL(e.protocol+l):new URL(l),n=g(t.pathname,p);t.origin===e.origin&&null!=n?l=n+t.search+t.hash:w=!0}catch(ye){}let v=u(l,{relative:n}),y=ie(l,{replace:a,state:o,target:i,preventScrollReset:c,relative:n,unstable_viewTransition:f});return e.createElement("a",Object.assign({},d,{href:h||v,onClick:w||r?t:function(e){t&&t(e),e.defaultPrevented||y(e)},ref:m,target:i}))})),Z=e.forwardRef((function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:i,to:u,unstable_viewTransition:f,children:d,...m},h){let p=l(u,{relative:m.relative}),w=c(),v=e.useContext(a),{navigator:y,basename:b}=e.useContext(s),S=null!=v&&ge(p)&&!0===f,R=y.encodeLocation?y.encodeLocation(p).pathname:p.pathname,E=w.pathname,_=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;n||(E=E.toLowerCase(),_=_?_.toLowerCase():null,R=R.toLowerCase()),_&&b&&(_=g(_,b)||_);const T="/"!==R&&R.endsWith("/")?R.length-1:R.length;let L,x=E===R||!o&&E.startsWith(R)&&"/"===E.charAt(T),C=null!=_&&(_===R||!o&&_.startsWith(R)&&"/"===_.charAt(R.length)),A={isActive:x,isPending:C,isTransitioning:S},F=x?t:void 0;L="function"==typeof r?r(A):[r,x?"active":null,C?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let U="function"==typeof i?i(A):i;return e.createElement(X,Object.assign({},m,{"aria-current":F,className:L,ref:h,style:U,to:u,unstable_viewTransition:f}),"function"==typeof d?d(A):d)})),ee=e.forwardRef((({fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:o,method:i="get",action:s,onSubmit:u,relative:l,preventScrollReset:c,unstable_viewTransition:f,...d},m)=>{let h=ce(),p=fe(s,{relative:l}),w="get"===i.toLowerCase()?"get":"post";return e.createElement("form",Object.assign({ref:m,method:w,action:p,onSubmit:r?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute("formmethod")||i;h(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:a,state:o,relative:l,preventScrollReset:c,unstable_viewTransition:f})}},d))}));function te({getKey:e,storageKey:t}){return pe({getKey:e,storageKey:t}),null}var ne=function(e){return e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState",e}(ne||{}),re=function(e){return e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration",e}(re||{});function ae(t){let n=e.useContext(r);return n||E(!1),n}function oe(t){let n=e.useContext(a);return n||E(!1),n}function ie(t,{target:n,replace:r,state:a,preventScrollReset:o,relative:i,unstable_viewTransition:s}={}){let u=f(),m=c(),h=l(t,{relative:i});return e.useCallback((e=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(e,n)){e.preventDefault();let n=void 0!==r?r:d(m)===d(h);u(t,{replace:n,state:a,preventScrollReset:o,relative:i,unstable_viewTransition:s})}}),[m,u,h,r,a,n,t,o,i,s])}function se(t){let n=e.useRef(A(t)),r=e.useRef(!1),a=c(),o=e.useMemo((()=>function(e,t){let n=A(e);return t&&t.forEach(((e,r)=>{n.has(r)||t.getAll(r).forEach((e=>{n.append(r,e)}))})),n}(a.search,r.current?null:n.current)),[a.search]),i=f(),s=e.useCallback(((e,t)=>{const n=A("function"==typeof e?e(o):e);r.current=!0,i("?"+n,t)}),[i,o]);return[o,s]}let ue=0,le=()=>`__${String(++ue)}__`;function ce(){let{router:t}=ae(ne.UseSubmit),{basename:n}=e.useContext(s),r=m();return e.useCallback(((e,a={})=>{!function(){if("undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}();let{action:o,method:i,encType:s,formData:u,body:l}=N(e,n);if(!1===a.navigate){let e=a.fetcherKey||le();t.fetch(e,r,a.action||o,{preventScrollReset:a.preventScrollReset,formData:u,body:l,formMethod:a.method||i,formEncType:a.encType||s,unstable_flushSync:a.unstable_flushSync})}else t.navigate(a.action||o,{preventScrollReset:a.preventScrollReset,formData:u,body:l,formMethod:a.method||i,formEncType:a.encType||s,replace:a.replace,state:a.state,fromRouteId:r,unstable_flushSync:a.unstable_flushSync,unstable_viewTransition:a.unstable_viewTransition})}),[t,n,r])}function fe(t,{relative:n}={}){let{basename:r}=e.useContext(s),a=e.useContext(h);a||E(!1);let[o]=a.matches.slice(-1),i={...l(t||".",{relative:n})},u=c();if(null==t){i.search=u.search;let e=new URLSearchParams(i.search);e.has("index")&&""===e.get("index")&&(e.delete("index"),i.search=e.toString()?`?${e.toString()}`:"")}return t&&"."!==t||!o.route.index||(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),"/"!==r&&(i.pathname="/"===i.pathname?r:_([r,i.pathname])),d(i)}function de({key:t}={}){let{router:n}=ae(ne.UseFetcher),r=oe(re.UseFetcher),a=e.useContext(V),o=e.useContext(h),i=o.matches[o.matches.length-1]?.route.id;a||E(!1),o||E(!1),null==i&&E(!1);let s=H?H():"",[u,l]=e.useState(t||s);t&&t!==u?l(t):u||l(le()),e.useEffect((()=>(n.getFetcher(u),()=>{n.deleteFetcher(u)})),[n,u]);let c=e.useCallback(((e,t)=>{i||E(!1),n.fetch(u,i,e,t)}),[u,i,n]),f=ce(),d=e.useCallback(((e,t)=>{f(e,{...t,navigate:!1,fetcherKey:u})}),[u,f]),m=e.useMemo((()=>e.forwardRef(((t,n)=>e.createElement(ee,Object.assign({},t,{navigate:!1,fetcherKey:u,ref:n}))))),[u]),p=r.fetchers.get(u)||T,w=a.get(u);return e.useMemo((()=>({Form:m,submit:d,load:c,...p,data:w})),[m,d,c,p,w])}function me(){let e=oe(re.UseFetchers);return Array.from(e.fetchers.entries()).map((([e,t])=>({...t,key:e})))}let he={};function pe({getKey:t,storageKey:n}={}){let{router:r}=ae(ne.UseScrollRestoration),{restoreScrollPosition:a,preventScrollReset:o}=oe(re.UseScrollRestoration),{basename:i}=e.useContext(s),u=c(),l=p(),f=w();e.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),function(t,n){let{capture:r}=n||{};e.useEffect((()=>{let e=null!=r?{capture:r}:void 0;return window.addEventListener("pagehide",t,e),()=>{window.removeEventListener("pagehide",t,e)}}),[t,r])}(e.useCallback((()=>{if("idle"===f.state){let e=(t?t(u,l):null)||u.key;he[e]=window.scrollY}try{sessionStorage.setItem(n||"react-router-scroll-positions",JSON.stringify(he))}catch(e){}window.history.scrollRestoration="auto"}),[n,t,f.state,u,l])),"undefined"!=typeof document&&(e.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(n||"react-router-scroll-positions");e&&(he=JSON.parse(e))}catch(ye){}}),[n]),e.useLayoutEffect((()=>{let e=t&&"/"!==i?(e,n)=>t({...e,pathname:g(e.pathname,i)||e.pathname},n):t,n=r?.enableScrollRestoration(he,(()=>window.scrollY),e);return()=>n&&n()}),[r,i,t]),e.useLayoutEffect((()=>{if(!1!==a)if("number"!=typeof a){if(u.hash){let e=document.getElementById(decodeURIComponent(u.hash.slice(1)));if(e)return void e.scrollIntoView()}!0!==o&&window.scrollTo(0,0)}else window.scrollTo(0,a)}),[u,a,o]))}function we(t,n){let{capture:r}=n||{};e.useEffect((()=>{let e=null!=r?{capture:r}:void 0;return window.addEventListener("beforeunload",t,e),()=>{window.removeEventListener("beforeunload",t,e)}}),[t,r])}function ve({when:t,message:n}){let r=v(t);e.useEffect((()=>{if("blocked"===r.state){window.confirm(n)?setTimeout(r.proceed,0):r.reset()}}),[r,n]),e.useEffect((()=>{"blocked"!==r.state||t||r.reset()}),[r,t])}function ge(t,n={}){let r=e.useContext(O);null==r&&E(!1);let{basename:a}=ae(ne.useViewTransitionState),o=l(t,{relative:n.relative});if(!r.isTransitioning)return!1;let i=g(r.currentLocation.pathname,a)||r.currentLocation.pathname,s=g(r.nextLocation.pathname,a)||r.nextLocation.pathname;return null!=L(o.pathname,s)||null!=L(o.pathname,i)}export{Y as BrowserRouter,ee as Form,J as HashRouter,X as Link,Z as NavLink,$ as RouterProvider,te as ScrollRestoration,V as UNSAFE_FetchersContext,O as UNSAFE_ViewTransitionContext,pe as UNSAFE_useScrollRestoration,P as createBrowserRouter,D as createHashRouter,A as createSearchParams,q as unstable_HistoryRouter,ve as unstable_usePrompt,ge as unstable_useViewTransitionState,we as useBeforeUnload,de as useFetcher,me as useFetchers,fe as useFormAction,ie as useLinkClickHandler,se as useSearchParams,ce as useSubmit};
//# sourceMappingURL=react-router-dom.production.min.js.map
import * as React from "react";
import type { Router as RemixRouter, StaticHandlerContext, CreateStaticHandlerOptions as RouterCreateStaticHandlerOptions } from "@remix-run/router";
import type { Location, RouteObject } from "react-router-dom";
import type { Router as RemixRouter, StaticHandlerContext, CreateStaticHandlerOptions as RouterCreateStaticHandlerOptions, FutureConfig as RouterFutureConfig } from "@remix-run/router";
import type { FutureConfig, Location, RouteObject } from "react-router-dom";
export interface StaticRouterProps {

@@ -8,2 +8,3 @@ basename?: string;

location: Partial<Location> | string;
future?: Partial<FutureConfig>;
}

@@ -14,3 +15,3 @@ /**

*/
export declare function StaticRouter({ basename, children, location: locationProp, }: StaticRouterProps): React.JSX.Element;
export declare function StaticRouter({ basename, children, location: locationProp, future, }: StaticRouterProps): React.JSX.Element;
export { StaticHandlerContext };

@@ -30,2 +31,4 @@ export interface StaticRouterProviderProps {

export declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): import("@remix-run/router").StaticHandler;
export declare function createStaticRouter(routes: RouteObject[], context: StaticHandlerContext): RemixRouter;
export declare function createStaticRouter(routes: RouteObject[], context: StaticHandlerContext, opts?: {
future?: Partial<Pick<RouterFutureConfig, "v7_partialHydration" | "v7_relativeSplatPath">>;
}): RemixRouter;

@@ -37,3 +37,4 @@ 'use strict';

children,
location: locationProp = "/"
location: locationProp = "/",
future
}) {

@@ -58,2 +59,3 @@ if (typeof locationProp === "string") {

navigator: staticNavigator,
future: future,
static: true

@@ -80,2 +82,3 @@ });

};
let fetchersContext = new Map();
let hydrateScript = "";

@@ -103,7 +106,3 @@ if (hydrate !== false) {

}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_FetchersContext.Provider, {
value: {
fetcherData: new Map(),
register: () => {},
unregister: () => {}
}
value: fetchersContext
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_ViewTransitionContext.Provider, {

@@ -118,5 +117,9 @@ value: {

navigator: dataRouterContext.navigator,
static: dataRouterContext.static
static: dataRouterContext.static,
future: {
v7_relativeSplatPath: router$1.future.v7_relativeSplatPath
}
}, /*#__PURE__*/React__namespace.createElement(DataRoutes, {
routes: router$1.routes,
future: router$1.future,
state: state

@@ -133,5 +136,6 @@ })))))), hydrateScript ? /*#__PURE__*/React__namespace.createElement("script", {

routes,
future,
state
}) {
return reactRouter.UNSAFE_useRoutesImpl(routes, undefined, state);
return reactRouter.UNSAFE_useRoutesImpl(routes, undefined, state, future);
}

@@ -194,3 +198,3 @@ function serializeErrors(errors) {

}
function createStaticRouter(routes, context) {
function createStaticRouter(routes, context, opts = {}) {
let manifest = {};

@@ -213,2 +217,11 @@ let dataRoutes = router.UNSAFE_convertRoutesToDataRoutes(routes, reactRouter.UNSAFE_mapRouteProperties, undefined, manifest);

},
get future() {
return {
v7_fetcherPersist: false,
v7_normalizeFormMethod: false,
v7_partialHydration: opts.future?.v7_partialHydration === true,
v7_prependBasename: false,
v7_relativeSplatPath: opts.future?.v7_relativeSplatPath === true
};
},
get state() {

@@ -284,2 +297,6 @@ return {

let href = typeof to === "string" ? to : reactRouterDom.createPath(to);
// Treating this as a full URL will strip any trailing spaces so we need to
// pre-encode them since they might be part of a matching splat param from
// an ancestor route
href = href.replace(/ $/, "%20");
let encoded = ABSOLUTE_URL_REGEX.test(href) ? new URL(href) : new URL(href, "http://localhost");

@@ -286,0 +303,0 @@ return {

/**
* React Router DOM v0.0.0-experimental-a077dc2d
* React Router DOM v0.0.0-experimental-a0888892
*

@@ -11,3 +11,3 @@ * Copyright (c) Remix Software Inc.

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-router"),require("@remix-run/router")):"function"==typeof define&&define.amd?define(["exports","react","react-router","@remix-run/router"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactRouterDOM={},e.React,e.ReactRouter,e.RemixRouter)}(this,(function(e,t,n,r){"use strict";function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var a=o(t);function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}const s="get",c="application/x-www-form-urlencoded";function l(e){return null!=e&&"string"==typeof e.tagName}function f(e){return void 0===e&&(e=""),new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map((e=>[n,e])):[[n,r]])}),[]))}let d=null;const m=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function p(e){return null==e||m.has(e)?e:null}function b(e,t){let n,o,a,i,u;if(l(f=e)&&"form"===f.tagName.toLowerCase()){let u=e.getAttribute("action");o=u?r.stripBasename(u,t):null,n=e.getAttribute("method")||s,a=p(e.getAttribute("enctype"))||c,i=new FormData(e)}else if(function(e){return l(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return l(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let u=e.form;if(null==u)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||u.getAttribute("action");if(o=l?r.stripBasename(l,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||s,a=p(e.getAttribute("formenctype"))||p(u.getAttribute("enctype"))||c,i=new FormData(u,e),!function(){if(null===d)try{new FormData(document.createElement("form"),0),d=!1}catch(e){d=!0}return d}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?t+".":"";i.append(e+"x","0"),i.append(e+"y","0")}else t&&i.append(t,r)}}else{if(l(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=s,o=null,a=c,u=e}var f;return i&&"text/plain"===a&&(u=i,i=void 0),{action:o,method:n.toLowerCase(),encType:a,formData:i,body:u}}const v=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],h=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],g=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","unstable_viewTransition"];function y(){var e;let t=null==(e=window)?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=i({},t,{errors:w(t.errors)})),t}function w(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,o]of t)if(o&&"RouteErrorResponse"===o.__type)n[e]=new r.UNSAFE_ErrorResponseImpl(o.status,o.statusText,o.data,!0===o.internal);else if(o&&"Error"===o.__type){if(o.__subType){let t=window[o.__subType];if("function"==typeof t)try{let r=new t(o.message);r.stack="",n[e]=r}catch(e){}}if(null==n[e]){let t=new Error(o.message);t.stack="",n[e]=t}}else n[e]=o;return n}const R=a.createContext({isTransitioning:!1}),S=a.createContext(null),E=a.startTransition;class P{constructor(){this.status="pending",this.promise=new Promise(((e,t)=>{this.resolve=t=>{"pending"===this.status&&(this.status="resolved",e(t))},this.reject=e=>{"pending"===this.status&&(this.status="rejected",t(e))}}))}}function _(e){let{routes:t,state:r}=e;return n.UNSAFE_useRoutesImpl(t,void 0,r)}const C="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,O=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,A=a.forwardRef((function(e,t){let o,{onClick:s,relative:c,reloadDocument:l,replace:f,state:d,target:m,to:p,preventScrollReset:b,unstable_viewTransition:h}=e,g=u(e,v),{basename:y}=a.useContext(n.UNSAFE_NavigationContext),w=!1;if("string"==typeof p&&O.test(p)&&(o=p,C))try{let e=new URL(window.location.href),t=p.startsWith("//")?new URL(e.protocol+p):new URL(p),n=r.stripBasename(t.pathname,y);t.origin===e.origin&&null!=n?p=n+t.search+t.hash:w=!0}catch(e){}let R=n.useHref(p,{relative:c}),S=U(p,{replace:f,state:d,target:m,preventScrollReset:b,relative:c,unstable_viewTransition:h});return a.createElement("a",i({},g,{href:o||R,onClick:w||l?s:function(e){s&&s(e),e.defaultPrevented||S(e)},ref:t,target:m}))})),j=a.forwardRef((function(e,t){let{"aria-current":r="page",caseSensitive:o=!1,className:s="",end:c=!1,style:l,to:f,unstable_viewTransition:d,children:m}=e,p=u(e,h),b=n.useResolvedPath(f,{relative:p.relative}),v=n.useLocation(),g=a.useContext(n.UNSAFE_DataRouterStateContext),{navigator:y}=a.useContext(n.UNSAFE_NavigationContext),w=null!=g&&V(b)&&!0===d,R=y.encodeLocation?y.encodeLocation(b).pathname:b.pathname,S=v.pathname,E=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;o||(S=S.toLowerCase(),E=E?E.toLowerCase():null,R=R.toLowerCase());let P,_=S===R||!c&&S.startsWith(R)&&"/"===S.charAt(R.length),C=null!=E&&(E===R||!c&&E.startsWith(R)&&"/"===E.charAt(R.length)),O={isActive:_,isPending:C,isTransitioning:w},j=_?r:void 0;P="function"==typeof s?s(O):[s,_?"active":null,C?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let x="function"==typeof l?l(O):l;return a.createElement(A,i({},p,{"aria-current":j,className:P,ref:t,style:x,to:f,unstable_viewTransition:d}),"function"==typeof m?m(O):m)})),x=a.forwardRef(((e,t)=>{let{fetcherKey:n,navigate:r,reloadDocument:o,replace:c,state:l,method:f=s,action:d,onSubmit:m,relative:p,preventScrollReset:b,unstable_viewTransition:v}=e,h=u(e,g),y=M(),w=B(d,{relative:p}),R="get"===f.toLowerCase()?"get":"post";return a.createElement("form",i({ref:t,method:R,action:w,onSubmit:o?m:e=>{if(m&&m(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter,o=(null==t?void 0:t.getAttribute("formmethod"))||f;y(t||e.currentTarget,{fetcherKey:n,method:o,navigate:r,replace:c,state:l,relative:p,preventScrollReset:b,unstable_viewTransition:v})}},h))}));var N=function(e){return e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState",e}(N||{}),F=function(e){return e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration",e}(F||{});function T(e){let t=a.useContext(n.UNSAFE_DataRouterContext);return t||r.UNSAFE_invariant(!1),t}function L(e){let t=a.useContext(n.UNSAFE_DataRouterStateContext);return t||r.UNSAFE_invariant(!1),t}function U(e,t){let{target:r,replace:o,state:i,preventScrollReset:u,relative:s,unstable_viewTransition:c}=void 0===t?{}:t,l=n.useNavigate(),f=n.useLocation(),d=n.useResolvedPath(e,{relative:s});return a.useCallback((t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,r)){t.preventDefault();let r=void 0!==o?o:n.createPath(f)===n.createPath(d);l(e,{replace:r,state:i,preventScrollReset:u,relative:s,unstable_viewTransition:c})}}),[f,l,d,o,i,r,e,u,s,c])}let D=0,k=()=>"__"+String(++D)+"__";function M(){let{router:e}=T(N.UseSubmit),{basename:t}=a.useContext(n.UNSAFE_NavigationContext),r=n.UNSAFE_useRouteId();return a.useCallback((function(n,o){void 0===o&&(o={}),function(){if("undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}();let{action:a,method:i,encType:u,formData:s,body:c}=b(n,t);if(!1===o.navigate){let t=o.fetcherKey||k();e.fetch(t,r,o.action||a,{preventScrollReset:o.preventScrollReset,formData:s,body:c,formMethod:o.method||i,formEncType:o.encType||u})}else e.navigate(o.action||a,{preventScrollReset:o.preventScrollReset,formData:s,body:c,formMethod:o.method||i,formEncType:o.encType||u,replace:o.replace,state:o.state,fromRouteId:r,unstable_viewTransition:o.unstable_viewTransition})}),[e,t,r])}function B(e,t){let{relative:o}=void 0===t?{}:t,{basename:u}=a.useContext(n.UNSAFE_NavigationContext),s=a.useContext(n.UNSAFE_RouteContext);s||r.UNSAFE_invariant(!1);let[c]=s.matches.slice(-1),l=i({},n.useResolvedPath(e||".",{relative:o})),f=n.useLocation();if(null==e&&(l.search=f.search,c.route.index)){let e=new URLSearchParams(l.search);e.delete("index"),l.search=e.toString()?"?"+e.toString():""}return e&&"."!==e||!c.route.index||(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),"/"!==u&&(l.pathname="/"===l.pathname?u:r.joinPaths([u,l.pathname])),n.createPath(l)}const H="react-router-scroll-positions";let K={};function I(e){let{getKey:t,storageKey:o}=void 0===e?{}:e,{router:u}=T(N.UseScrollRestoration),{restoreScrollPosition:s,preventScrollReset:c}=L(F.UseScrollRestoration),{basename:l}=a.useContext(n.UNSAFE_NavigationContext),f=n.useLocation(),d=n.useMatches(),m=n.useNavigation();a.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),function(e,t){let{capture:n}=t||{};a.useEffect((()=>{let t=null!=n?{capture:n}:void 0;return window.addEventListener("pagehide",e,t),()=>{window.removeEventListener("pagehide",e,t)}}),[e,n])}(a.useCallback((()=>{if("idle"===m.state){let e=(t?t(f,d):null)||f.key;K[e]=window.scrollY}try{sessionStorage.setItem(o||H,JSON.stringify(K))}catch(e){}window.history.scrollRestoration="auto"}),[o,t,m.state,f,d])),"undefined"!=typeof document&&(a.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(o||H);e&&(K=JSON.parse(e))}catch(e){}}),[o]),a.useLayoutEffect((()=>{let e=t&&"/"!==l?(e,n)=>t(i({},e,{pathname:r.stripBasename(e.pathname,l)||e.pathname}),n):t,n=null==u?void 0:u.enableScrollRestoration(K,(()=>window.scrollY),e);return()=>n&&n()}),[u,l,t]),a.useLayoutEffect((()=>{if(!1!==s)if("number"!=typeof s){if(f.hash){let e=document.getElementById(decodeURIComponent(f.hash.slice(1)));if(e)return void e.scrollIntoView()}!0!==c&&window.scrollTo(0,0)}else window.scrollTo(0,s)}),[f,s,c]))}function V(e,t){void 0===t&&(t={});let o=a.useContext(R);null==o&&r.UNSAFE_invariant(!1);let{basename:i}=T(N.useViewTransitionState),u=n.useResolvedPath(e,{relative:t.relative});if(!o.isTransitioning)return!1;let s=r.stripBasename(o.currentLocation.pathname,i)||o.currentLocation.pathname,c=r.stripBasename(o.nextLocation.pathname,i)||o.nextLocation.pathname;return null!=r.matchPath(u.pathname,c)||null!=r.matchPath(u.pathname,s)}Object.defineProperty(e,"AbortedDeferredError",{enumerable:!0,get:function(){return n.AbortedDeferredError}}),Object.defineProperty(e,"Await",{enumerable:!0,get:function(){return n.Await}}),Object.defineProperty(e,"MemoryRouter",{enumerable:!0,get:function(){return n.MemoryRouter}}),Object.defineProperty(e,"Navigate",{enumerable:!0,get:function(){return n.Navigate}}),Object.defineProperty(e,"NavigationType",{enumerable:!0,get:function(){return n.NavigationType}}),Object.defineProperty(e,"Outlet",{enumerable:!0,get:function(){return n.Outlet}}),Object.defineProperty(e,"Route",{enumerable:!0,get:function(){return n.Route}}),Object.defineProperty(e,"Router",{enumerable:!0,get:function(){return n.Router}}),Object.defineProperty(e,"Routes",{enumerable:!0,get:function(){return n.Routes}}),Object.defineProperty(e,"UNSAFE_DataRouterContext",{enumerable:!0,get:function(){return n.UNSAFE_DataRouterContext}}),Object.defineProperty(e,"UNSAFE_DataRouterStateContext",{enumerable:!0,get:function(){return n.UNSAFE_DataRouterStateContext}}),Object.defineProperty(e,"UNSAFE_LocationContext",{enumerable:!0,get:function(){return n.UNSAFE_LocationContext}}),Object.defineProperty(e,"UNSAFE_NavigationContext",{enumerable:!0,get:function(){return n.UNSAFE_NavigationContext}}),Object.defineProperty(e,"UNSAFE_RouteContext",{enumerable:!0,get:function(){return n.UNSAFE_RouteContext}}),Object.defineProperty(e,"UNSAFE_useRouteId",{enumerable:!0,get:function(){return n.UNSAFE_useRouteId}}),Object.defineProperty(e,"createMemoryRouter",{enumerable:!0,get:function(){return n.createMemoryRouter}}),Object.defineProperty(e,"createPath",{enumerable:!0,get:function(){return n.createPath}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return n.createRoutesFromChildren}}),Object.defineProperty(e,"createRoutesFromElements",{enumerable:!0,get:function(){return n.createRoutesFromElements}}),Object.defineProperty(e,"defer",{enumerable:!0,get:function(){return n.defer}}),Object.defineProperty(e,"generatePath",{enumerable:!0,get:function(){return n.generatePath}}),Object.defineProperty(e,"isRouteErrorResponse",{enumerable:!0,get:function(){return n.isRouteErrorResponse}}),Object.defineProperty(e,"json",{enumerable:!0,get:function(){return n.json}}),Object.defineProperty(e,"matchPath",{enumerable:!0,get:function(){return n.matchPath}}),Object.defineProperty(e,"matchRoutes",{enumerable:!0,get:function(){return n.matchRoutes}}),Object.defineProperty(e,"parsePath",{enumerable:!0,get:function(){return n.parsePath}}),Object.defineProperty(e,"redirect",{enumerable:!0,get:function(){return n.redirect}}),Object.defineProperty(e,"redirectDocument",{enumerable:!0,get:function(){return n.redirectDocument}}),Object.defineProperty(e,"renderMatches",{enumerable:!0,get:function(){return n.renderMatches}}),Object.defineProperty(e,"resolvePath",{enumerable:!0,get:function(){return n.resolvePath}}),Object.defineProperty(e,"unstable_useBlocker",{enumerable:!0,get:function(){return n.unstable_useBlocker}}),Object.defineProperty(e,"useActionData",{enumerable:!0,get:function(){return n.useActionData}}),Object.defineProperty(e,"useAsyncError",{enumerable:!0,get:function(){return n.useAsyncError}}),Object.defineProperty(e,"useAsyncValue",{enumerable:!0,get:function(){return n.useAsyncValue}}),Object.defineProperty(e,"useHref",{enumerable:!0,get:function(){return n.useHref}}),Object.defineProperty(e,"useInRouterContext",{enumerable:!0,get:function(){return n.useInRouterContext}}),Object.defineProperty(e,"useLoaderData",{enumerable:!0,get:function(){return n.useLoaderData}}),Object.defineProperty(e,"useLocation",{enumerable:!0,get:function(){return n.useLocation}}),Object.defineProperty(e,"useMatch",{enumerable:!0,get:function(){return n.useMatch}}),Object.defineProperty(e,"useMatches",{enumerable:!0,get:function(){return n.useMatches}}),Object.defineProperty(e,"useNavigate",{enumerable:!0,get:function(){return n.useNavigate}}),Object.defineProperty(e,"useNavigation",{enumerable:!0,get:function(){return n.useNavigation}}),Object.defineProperty(e,"useNavigationType",{enumerable:!0,get:function(){return n.useNavigationType}}),Object.defineProperty(e,"useOutlet",{enumerable:!0,get:function(){return n.useOutlet}}),Object.defineProperty(e,"useOutletContext",{enumerable:!0,get:function(){return n.useOutletContext}}),Object.defineProperty(e,"useParams",{enumerable:!0,get:function(){return n.useParams}}),Object.defineProperty(e,"useResolvedPath",{enumerable:!0,get:function(){return n.useResolvedPath}}),Object.defineProperty(e,"useRevalidator",{enumerable:!0,get:function(){return n.useRevalidator}}),Object.defineProperty(e,"useRouteError",{enumerable:!0,get:function(){return n.useRouteError}}),Object.defineProperty(e,"useRouteLoaderData",{enumerable:!0,get:function(){return n.useRouteLoaderData}}),Object.defineProperty(e,"useRoutes",{enumerable:!0,get:function(){return n.useRoutes}}),e.BrowserRouter=function(e){let{basename:t,children:o,future:i,window:u}=e,s=a.useRef();null==s.current&&(s.current=r.createBrowserHistory({window:u,v5Compat:!0}));let c=s.current,[l,f]=a.useState({action:c.action,location:c.location}),{v7_startTransition:d}=i||{},m=a.useCallback((e=>{d&&E?E((()=>f(e))):f(e)}),[f,d]);return a.useLayoutEffect((()=>c.listen(m)),[c,m]),a.createElement(n.Router,{basename:t,children:o,location:l.location,navigationType:l.action,navigator:c})},e.Form=x,e.HashRouter=function(e){let{basename:t,children:o,future:i,window:u}=e,s=a.useRef();null==s.current&&(s.current=r.createHashHistory({window:u,v5Compat:!0}));let c=s.current,[l,f]=a.useState({action:c.action,location:c.location}),{v7_startTransition:d}=i||{},m=a.useCallback((e=>{d&&E?E((()=>f(e))):f(e)}),[f,d]);return a.useLayoutEffect((()=>c.listen(m)),[c,m]),a.createElement(n.Router,{basename:t,children:o,location:l.location,navigationType:l.action,navigator:c})},e.Link=A,e.NavLink=j,e.RouterProvider=function(e){let{fallbackElement:t,router:r,future:o}=e,{fetcherContext:i,fetcherData:u}=function(){let e=a.useRef(new Map),t=a.useRef(new Map),n=a.useCallback((t=>{let n=e.current.get(t);null==n?e.current.set(t,1):e.current.set(t,n+1)}),[e]),r=a.useCallback((n=>{let r=e.current.get(n);null==r||r<=1?(e.current.delete(n),t.current.delete(n)):e.current.set(n,r-1)}),[t,e]);return{fetcherContext:a.useMemo((()=>({fetcherData:t.current,register:n,unregister:r})),[t,n,r]),fetcherData:t}}(),[s,c]=a.useState(r.state),[l,f]=a.useState(),[d,m]=a.useState({isTransitioning:!1}),[p,b]=a.useState(),[v,h]=a.useState(),[g,y]=a.useState(),{v7_startTransition:w}=o||{},C=a.useCallback((e=>{w?function(e){E?E(e):e()}(e):e()}),[w]),O=a.useCallback(((e,t)=>{let{unstable_viewTransitionOpts:n}=t;e.fetchers.forEach(((e,t)=>{void 0!==e.data&&u.current.set(t,e.data)})),n&&null!=r.window&&"function"==typeof r.window.document.startViewTransition?v&&p?(p.resolve(),v.skipTransition(),y({state:e,currentLocation:n.currentLocation,nextLocation:n.nextLocation})):(f(e),m({isTransitioning:!0,currentLocation:n.currentLocation,nextLocation:n.nextLocation})):C((()=>c(e)))}),[r.window,v,p,u,C]);a.useLayoutEffect((()=>r.subscribe(O)),[r,O]),a.useEffect((()=>{d.isTransitioning&&b(new P)}),[d.isTransitioning]),a.useEffect((()=>{if(p&&l&&r.window){let e=l,t=p.promise,n=r.window.document.startViewTransition((async()=>{C((()=>c(e))),await t}));n.finished.finally((()=>{b(void 0),h(void 0),f(void 0),m({isTransitioning:!1})})),h(n)}}),[C,l,p,r.window]),a.useEffect((()=>{p&&l&&s.location.key===l.location.key&&p.resolve()}),[p,v,s.location,l]),a.useEffect((()=>{!d.isTransitioning&&g&&(f(g.state),m({isTransitioning:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),y(void 0))}),[d.isTransitioning,g]);let A=a.useMemo((()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:e=>r.navigate(e),push:(e,t,n)=>r.navigate(e,{state:t,preventScrollReset:null==n?void 0:n.preventScrollReset}),replace:(e,t,n)=>r.navigate(e,{replace:!0,state:t,preventScrollReset:null==n?void 0:n.preventScrollReset})})),[r]),j=r.basename||"/",x=a.useMemo((()=>({router:r,navigator:A,static:!1,basename:j})),[r,A,j]);return a.createElement(a.Fragment,null,a.createElement(n.UNSAFE_DataRouterContext.Provider,{value:x},a.createElement(n.UNSAFE_DataRouterStateContext.Provider,{value:s},a.createElement(S.Provider,{value:i},a.createElement(R.Provider,{value:d},a.createElement(n.Router,{basename:j,location:s.location,navigationType:s.historyAction,navigator:A},s.initialized?a.createElement(_,{routes:r.routes,state:s}):t))))),null)},e.ScrollRestoration=function(e){let{getKey:t,storageKey:n}=e;return I({getKey:t,storageKey:n}),null},e.UNSAFE_FetchersContext=S,e.UNSAFE_ViewTransitionContext=R,e.UNSAFE_useScrollRestoration=I,e.createBrowserRouter=function(e,t){return r.createRouter({basename:null==t?void 0:t.basename,future:i({},null==t?void 0:t.future,{v7_prependBasename:!0}),history:r.createBrowserHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||y(),routes:e,mapRouteProperties:n.UNSAFE_mapRouteProperties,window:null==t?void 0:t.window}).initialize()},e.createHashRouter=function(e,t){return r.createRouter({basename:null==t?void 0:t.basename,future:i({},null==t?void 0:t.future,{v7_prependBasename:!0}),history:r.createHashHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||y(),routes:e,mapRouteProperties:n.UNSAFE_mapRouteProperties,window:null==t?void 0:t.window}).initialize()},e.createSearchParams=f,e.unstable_HistoryRouter=function(e){let{basename:t,children:r,future:o,history:i}=e,[u,s]=a.useState({action:i.action,location:i.location}),{v7_startTransition:c}=o||{},l=a.useCallback((e=>{c&&E?E((()=>s(e))):s(e)}),[s,c]);return a.useLayoutEffect((()=>i.listen(l)),[i,l]),a.createElement(n.Router,{basename:t,children:r,location:u.location,navigationType:u.action,navigator:i})},e.unstable_usePrompt=function(e){let{when:t,message:r}=e,o=n.unstable_useBlocker(t);a.useEffect((()=>{if("blocked"===o.state){window.confirm(r)?setTimeout(o.proceed,0):o.reset()}}),[o,r]),a.useEffect((()=>{"blocked"!==o.state||t||o.reset()}),[o,t])},e.unstable_useViewTransitionState=V,e.useBeforeUnload=function(e,t){let{capture:n}=t||{};a.useEffect((()=>{let t=null!=n?{capture:n}:void 0;return window.addEventListener("beforeunload",e,t),()=>{window.removeEventListener("beforeunload",e,t)}}),[e,n])},e.useFetcher=function(e){var t;let{key:o}=void 0===e?{}:e,{router:u}=T(N.UseFetcher),s=L(F.UseFetcher),c=a.useContext(S),l=a.useContext(n.UNSAFE_RouteContext),f=null==(t=l.matches[l.matches.length-1])?void 0:t.route.id;c||r.UNSAFE_invariant(!1),l||r.UNSAFE_invariant(!1),null==f&&r.UNSAFE_invariant(!1);let[d,m]=a.useState(o||"");d||m(k());let{fetcherData:p,register:b,unregister:v}=c;a.useEffect((()=>(b(d),()=>{v(d),u.deleteFetcher(d)})),[u,d,b,v]);let h=a.useCallback((e=>{f||r.UNSAFE_invariant(!1),u.fetch(d,f,e)}),[d,f,u]),g=M(),y=a.useCallback(((e,t)=>{g(e,i({},t,{navigate:!1,fetcherKey:d}))}),[d,g]),w=a.useMemo((()=>a.forwardRef(((e,t)=>a.createElement(x,i({},e,{navigate:!1,fetcherKey:d,ref:t}))))),[d]),R=s.fetchers.get(d)||r.IDLE_FETCHER,E=p.get(d);return a.useMemo((()=>i({Form:w,submit:y,load:h},R,{data:E})),[w,y,h,R,E])},e.useFetchers=function(){let e=L(F.UseFetchers);return Array.from(e.fetchers.entries()).map((e=>{let[t,n]=e;return i({},n,{key:t})}))},e.useFormAction=B,e.useLinkClickHandler=U,e.useSearchParams=function(e){let t=a.useRef(f(e)),r=a.useRef(!1),o=n.useLocation(),i=a.useMemo((()=>function(e,t){let n=f(e);return t&&t.forEach(((e,r)=>{n.has(r)||t.getAll(r).forEach((e=>{n.append(r,e)}))})),n}(o.search,r.current?null:t.current)),[o.search]),u=n.useNavigate(),s=a.useCallback(((e,t)=>{const n=f("function"==typeof e?e(i):e);r.current=!0,u("?"+n,t)}),[u,i]);return[i,s]},e.useSubmit=M,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("react-router"),require("@remix-run/router")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","react-router","@remix-run/router"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactRouterDOM={},e.React,e.ReactDOM,e.ReactRouter,e.RemixRouter)}(this,(function(e,t,n,r,o){"use strict";function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var i=a(t),u=a(n);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}const l="get",f="application/x-www-form-urlencoded";function d(e){return null!=e&&"string"==typeof e.tagName}function m(e){return void 0===e&&(e=""),new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map((e=>[n,e])):[[n,r]])}),[]))}let p=null;const b=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function h(e){return null==e||b.has(e)?e:null}function v(e,t){let n,r,a,i,u;if(d(s=e)&&"form"===s.tagName.toLowerCase()){let u=e.getAttribute("action");r=u?o.stripBasename(u,t):null,n=e.getAttribute("method")||l,a=h(e.getAttribute("enctype"))||f,i=new FormData(e)}else if(function(e){return d(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return d(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let u=e.form;if(null==u)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||u.getAttribute("action");if(r=s?o.stripBasename(s,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||l,a=h(e.getAttribute("formenctype"))||h(u.getAttribute("enctype"))||f,i=new FormData(u,e),!function(){if(null===p)try{new FormData(document.createElement("form"),0),p=!1}catch(e){p=!0}return p}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?t+".":"";i.append(e+"x","0"),i.append(e+"y","0")}else t&&i.append(t,r)}}else{if(d(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=l,r=null,a=f,u=e}var s;return i&&"text/plain"===a&&(u=i,i=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:i,body:u}}const y=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],g=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],w=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","unstable_viewTransition"];try{window.__reactRouterVersion="0"}catch(e){}function R(){var e;let t=null==(e=window)?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=s({},t,{errors:S(t.errors)})),t}function S(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&"RouteErrorResponse"===r.__type)n[e]=new o.UNSAFE_ErrorResponseImpl(r.status,r.statusText,r.data,!0===r.internal);else if(r&&"Error"===r.__type){if(r.__subType){let t=window[r.__subType];if("function"==typeof t)try{let o=new t(r.message);o.stack="",n[e]=o}catch(e){}}if(null==n[e]){let t=new Error(r.message);t.stack="",n[e]=t}}else n[e]=r;return n}const E=i.createContext({isTransitioning:!1}),P=i.createContext(new Map),_=i.startTransition,O=u.flushSync,A=i.useId;function C(e){O?O(e):e()}class N{constructor(){this.status="pending",this.promise=new Promise(((e,t)=>{this.resolve=t=>{"pending"===this.status&&(this.status="resolved",e(t))},this.reject=e=>{"pending"===this.status&&(this.status="rejected",t(e))}}))}}function j(e){let{routes:t,future:n,state:o}=e;return r.UNSAFE_useRoutesImpl(t,void 0,o,n)}const x="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,F=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,L=i.forwardRef((function(e,t){let n,{onClick:a,relative:u,reloadDocument:l,replace:f,state:d,target:m,to:p,preventScrollReset:b,unstable_viewTransition:h}=e,v=c(e,y),{basename:g}=i.useContext(r.UNSAFE_NavigationContext),w=!1;if("string"==typeof p&&F.test(p)&&(n=p,x))try{let e=new URL(window.location.href),t=p.startsWith("//")?new URL(e.protocol+p):new URL(p),n=o.stripBasename(t.pathname,g);t.origin===e.origin&&null!=n?p=n+t.search+t.hash:w=!0}catch(e){}let R=r.useHref(p,{relative:u}),S=H(p,{replace:f,state:d,target:m,preventScrollReset:b,relative:u,unstable_viewTransition:h});return i.createElement("a",s({},v,{href:n||R,onClick:w||l?a:function(e){a&&a(e),e.defaultPrevented||S(e)},ref:t,target:m}))})),T=i.forwardRef((function(e,t){let{"aria-current":n="page",caseSensitive:a=!1,className:u="",end:l=!1,style:f,to:d,unstable_viewTransition:m,children:p}=e,b=c(e,g),h=r.useResolvedPath(d,{relative:b.relative}),v=r.useLocation(),y=i.useContext(r.UNSAFE_DataRouterStateContext),{navigator:w,basename:R}=i.useContext(r.UNSAFE_NavigationContext),S=null!=y&&J(h)&&!0===m,E=w.encodeLocation?w.encodeLocation(h).pathname:h.pathname,P=v.pathname,_=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;a||(P=P.toLowerCase(),_=_?_.toLowerCase():null,E=E.toLowerCase()),_&&R&&(_=o.stripBasename(_,R)||_);const O="/"!==E&&E.endsWith("/")?E.length-1:E.length;let A,C=P===E||!l&&P.startsWith(E)&&"/"===P.charAt(O),N=null!=_&&(_===E||!l&&_.startsWith(E)&&"/"===_.charAt(E.length)),j={isActive:C,isPending:N,isTransitioning:S},x=C?n:void 0;A="function"==typeof u?u(j):[u,C?"active":null,N?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let F="function"==typeof f?f(j):f;return i.createElement(L,s({},b,{"aria-current":x,className:A,ref:t,style:F,to:d,unstable_viewTransition:m}),"function"==typeof p?p(j):p)})),U=i.forwardRef(((e,t)=>{let{fetcherKey:n,navigate:r,reloadDocument:o,replace:a,state:u,method:f=l,action:d,onSubmit:m,relative:p,preventScrollReset:b,unstable_viewTransition:h}=e,v=c(e,w),y=V(),g=z(d,{relative:p}),R="get"===f.toLowerCase()?"get":"post";return i.createElement("form",s({ref:t,method:R,action:g,onSubmit:o?m:e=>{if(m&&m(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter,o=(null==t?void 0:t.getAttribute("formmethod"))||f;y(t||e.currentTarget,{fetcherKey:n,method:o,navigate:r,replace:a,state:u,relative:p,preventScrollReset:b,unstable_viewTransition:h})}},v))}));var D=function(e){return e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState",e}(D||{}),k=function(e){return e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration",e}(k||{});function M(e){let t=i.useContext(r.UNSAFE_DataRouterContext);return t||o.UNSAFE_invariant(!1),t}function B(e){let t=i.useContext(r.UNSAFE_DataRouterStateContext);return t||o.UNSAFE_invariant(!1),t}function H(e,t){let{target:n,replace:o,state:a,preventScrollReset:u,relative:s,unstable_viewTransition:c}=void 0===t?{}:t,l=r.useNavigate(),f=r.useLocation(),d=r.useResolvedPath(e,{relative:s});return i.useCallback((t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,n)){t.preventDefault();let n=void 0!==o?o:r.createPath(f)===r.createPath(d);l(e,{replace:n,state:a,preventScrollReset:u,relative:s,unstable_viewTransition:c})}}),[f,l,d,o,a,n,e,u,s,c])}let I=0,K=()=>"__"+String(++I)+"__";function V(){let{router:e}=M(D.UseSubmit),{basename:t}=i.useContext(r.UNSAFE_NavigationContext),n=r.UNSAFE_useRouteId();return i.useCallback((function(r,o){void 0===o&&(o={}),function(){if("undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}();let{action:a,method:i,encType:u,formData:s,body:c}=v(r,t);if(!1===o.navigate){let t=o.fetcherKey||K();e.fetch(t,n,o.action||a,{preventScrollReset:o.preventScrollReset,formData:s,body:c,formMethod:o.method||i,formEncType:o.encType||u,unstable_flushSync:o.unstable_flushSync})}else e.navigate(o.action||a,{preventScrollReset:o.preventScrollReset,formData:s,body:c,formMethod:o.method||i,formEncType:o.encType||u,replace:o.replace,state:o.state,fromRouteId:n,unstable_flushSync:o.unstable_flushSync,unstable_viewTransition:o.unstable_viewTransition})}),[e,t,n])}function z(e,t){let{relative:n}=void 0===t?{}:t,{basename:a}=i.useContext(r.UNSAFE_NavigationContext),u=i.useContext(r.UNSAFE_RouteContext);u||o.UNSAFE_invariant(!1);let[c]=u.matches.slice(-1),l=s({},r.useResolvedPath(e||".",{relative:n})),f=r.useLocation();if(null==e){l.search=f.search;let e=new URLSearchParams(l.search);e.has("index")&&""===e.get("index")&&(e.delete("index"),l.search=e.toString()?"?"+e.toString():"")}return e&&"."!==e||!c.route.index||(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),"/"!==a&&(l.pathname="/"===l.pathname?a:o.joinPaths([a,l.pathname])),r.createPath(l)}const q="react-router-scroll-positions";let W={};function Y(e){let{getKey:t,storageKey:n}=void 0===e?{}:e,{router:a}=M(D.UseScrollRestoration),{restoreScrollPosition:u,preventScrollReset:c}=B(k.UseScrollRestoration),{basename:l}=i.useContext(r.UNSAFE_NavigationContext),f=r.useLocation(),d=r.useMatches(),m=r.useNavigation();i.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),function(e,t){let{capture:n}=t||{};i.useEffect((()=>{let t=null!=n?{capture:n}:void 0;return window.addEventListener("pagehide",e,t),()=>{window.removeEventListener("pagehide",e,t)}}),[e,n])}(i.useCallback((()=>{if("idle"===m.state){let e=(t?t(f,d):null)||f.key;W[e]=window.scrollY}try{sessionStorage.setItem(n||q,JSON.stringify(W))}catch(e){}window.history.scrollRestoration="auto"}),[n,t,m.state,f,d])),"undefined"!=typeof document&&(i.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(n||q);e&&(W=JSON.parse(e))}catch(e){}}),[n]),i.useLayoutEffect((()=>{let e=t&&"/"!==l?(e,n)=>t(s({},e,{pathname:o.stripBasename(e.pathname,l)||e.pathname}),n):t,n=null==a?void 0:a.enableScrollRestoration(W,(()=>window.scrollY),e);return()=>n&&n()}),[a,l,t]),i.useLayoutEffect((()=>{if(!1!==u)if("number"!=typeof u){if(f.hash){let e=document.getElementById(decodeURIComponent(f.hash.slice(1)));if(e)return void e.scrollIntoView()}!0!==c&&window.scrollTo(0,0)}else window.scrollTo(0,u)}),[f,u,c]))}function J(e,t){void 0===t&&(t={});let n=i.useContext(E);null==n&&o.UNSAFE_invariant(!1);let{basename:a}=M(D.useViewTransitionState),u=r.useResolvedPath(e,{relative:t.relative});if(!n.isTransitioning)return!1;let s=o.stripBasename(n.currentLocation.pathname,a)||n.currentLocation.pathname,c=o.stripBasename(n.nextLocation.pathname,a)||n.nextLocation.pathname;return null!=o.matchPath(u.pathname,c)||null!=o.matchPath(u.pathname,s)}Object.defineProperty(e,"AbortedDeferredError",{enumerable:!0,get:function(){return r.AbortedDeferredError}}),Object.defineProperty(e,"Await",{enumerable:!0,get:function(){return r.Await}}),Object.defineProperty(e,"MemoryRouter",{enumerable:!0,get:function(){return r.MemoryRouter}}),Object.defineProperty(e,"Navigate",{enumerable:!0,get:function(){return r.Navigate}}),Object.defineProperty(e,"NavigationType",{enumerable:!0,get:function(){return r.NavigationType}}),Object.defineProperty(e,"Outlet",{enumerable:!0,get:function(){return r.Outlet}}),Object.defineProperty(e,"Route",{enumerable:!0,get:function(){return r.Route}}),Object.defineProperty(e,"Router",{enumerable:!0,get:function(){return r.Router}}),Object.defineProperty(e,"Routes",{enumerable:!0,get:function(){return r.Routes}}),Object.defineProperty(e,"UNSAFE_DataRouterContext",{enumerable:!0,get:function(){return r.UNSAFE_DataRouterContext}}),Object.defineProperty(e,"UNSAFE_DataRouterStateContext",{enumerable:!0,get:function(){return r.UNSAFE_DataRouterStateContext}}),Object.defineProperty(e,"UNSAFE_LocationContext",{enumerable:!0,get:function(){return r.UNSAFE_LocationContext}}),Object.defineProperty(e,"UNSAFE_NavigationContext",{enumerable:!0,get:function(){return r.UNSAFE_NavigationContext}}),Object.defineProperty(e,"UNSAFE_RouteContext",{enumerable:!0,get:function(){return r.UNSAFE_RouteContext}}),Object.defineProperty(e,"UNSAFE_useRouteId",{enumerable:!0,get:function(){return r.UNSAFE_useRouteId}}),Object.defineProperty(e,"createMemoryRouter",{enumerable:!0,get:function(){return r.createMemoryRouter}}),Object.defineProperty(e,"createPath",{enumerable:!0,get:function(){return r.createPath}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return r.createRoutesFromChildren}}),Object.defineProperty(e,"createRoutesFromElements",{enumerable:!0,get:function(){return r.createRoutesFromElements}}),Object.defineProperty(e,"defer",{enumerable:!0,get:function(){return r.defer}}),Object.defineProperty(e,"generatePath",{enumerable:!0,get:function(){return r.generatePath}}),Object.defineProperty(e,"isRouteErrorResponse",{enumerable:!0,get:function(){return r.isRouteErrorResponse}}),Object.defineProperty(e,"json",{enumerable:!0,get:function(){return r.json}}),Object.defineProperty(e,"matchPath",{enumerable:!0,get:function(){return r.matchPath}}),Object.defineProperty(e,"matchRoutes",{enumerable:!0,get:function(){return r.matchRoutes}}),Object.defineProperty(e,"parsePath",{enumerable:!0,get:function(){return r.parsePath}}),Object.defineProperty(e,"redirect",{enumerable:!0,get:function(){return r.redirect}}),Object.defineProperty(e,"redirectDocument",{enumerable:!0,get:function(){return r.redirectDocument}}),Object.defineProperty(e,"renderMatches",{enumerable:!0,get:function(){return r.renderMatches}}),Object.defineProperty(e,"resolvePath",{enumerable:!0,get:function(){return r.resolvePath}}),Object.defineProperty(e,"useActionData",{enumerable:!0,get:function(){return r.useActionData}}),Object.defineProperty(e,"useAsyncError",{enumerable:!0,get:function(){return r.useAsyncError}}),Object.defineProperty(e,"useAsyncValue",{enumerable:!0,get:function(){return r.useAsyncValue}}),Object.defineProperty(e,"useBlocker",{enumerable:!0,get:function(){return r.useBlocker}}),Object.defineProperty(e,"useHref",{enumerable:!0,get:function(){return r.useHref}}),Object.defineProperty(e,"useInRouterContext",{enumerable:!0,get:function(){return r.useInRouterContext}}),Object.defineProperty(e,"useLoaderData",{enumerable:!0,get:function(){return r.useLoaderData}}),Object.defineProperty(e,"useLocation",{enumerable:!0,get:function(){return r.useLocation}}),Object.defineProperty(e,"useMatch",{enumerable:!0,get:function(){return r.useMatch}}),Object.defineProperty(e,"useMatches",{enumerable:!0,get:function(){return r.useMatches}}),Object.defineProperty(e,"useNavigate",{enumerable:!0,get:function(){return r.useNavigate}}),Object.defineProperty(e,"useNavigation",{enumerable:!0,get:function(){return r.useNavigation}}),Object.defineProperty(e,"useNavigationType",{enumerable:!0,get:function(){return r.useNavigationType}}),Object.defineProperty(e,"useOutlet",{enumerable:!0,get:function(){return r.useOutlet}}),Object.defineProperty(e,"useOutletContext",{enumerable:!0,get:function(){return r.useOutletContext}}),Object.defineProperty(e,"useParams",{enumerable:!0,get:function(){return r.useParams}}),Object.defineProperty(e,"useResolvedPath",{enumerable:!0,get:function(){return r.useResolvedPath}}),Object.defineProperty(e,"useRevalidator",{enumerable:!0,get:function(){return r.useRevalidator}}),Object.defineProperty(e,"useRouteError",{enumerable:!0,get:function(){return r.useRouteError}}),Object.defineProperty(e,"useRouteLoaderData",{enumerable:!0,get:function(){return r.useRouteLoaderData}}),Object.defineProperty(e,"useRoutes",{enumerable:!0,get:function(){return r.useRoutes}}),Object.defineProperty(e,"UNSAFE_ErrorResponseImpl",{enumerable:!0,get:function(){return o.UNSAFE_ErrorResponseImpl}}),e.BrowserRouter=function(e){let{basename:t,children:n,future:a,window:u}=e,s=i.useRef();null==s.current&&(s.current=o.createBrowserHistory({window:u,v5Compat:!0}));let c=s.current,[l,f]=i.useState({action:c.action,location:c.location}),{v7_startTransition:d}=a||{},m=i.useCallback((e=>{d&&_?_((()=>f(e))):f(e)}),[f,d]);return i.useLayoutEffect((()=>c.listen(m)),[c,m]),i.createElement(r.Router,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:c,future:a})},e.Form=U,e.HashRouter=function(e){let{basename:t,children:n,future:a,window:u}=e,s=i.useRef();null==s.current&&(s.current=o.createHashHistory({window:u,v5Compat:!0}));let c=s.current,[l,f]=i.useState({action:c.action,location:c.location}),{v7_startTransition:d}=a||{},m=i.useCallback((e=>{d&&_?_((()=>f(e))):f(e)}),[f,d]);return i.useLayoutEffect((()=>c.listen(m)),[c,m]),i.createElement(r.Router,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:c,future:a})},e.Link=L,e.NavLink=T,e.RouterProvider=function(e){let{fallbackElement:t,router:n,future:o}=e,[a,u]=i.useState(n.state),[s,c]=i.useState(),[l,f]=i.useState({isTransitioning:!1}),[d,m]=i.useState(),[p,b]=i.useState(),[h,v]=i.useState(),y=i.useRef(new Map),{v7_startTransition:g}=o||{},w=i.useCallback((e=>{g?function(e){_?_(e):e()}(e):e()}),[g]),R=i.useCallback(((e,t)=>{let{deletedFetchers:r,unstable_flushSync:o,unstable_viewTransitionOpts:a}=t;r.forEach((e=>y.current.delete(e))),e.fetchers.forEach(((e,t)=>{void 0!==e.data&&y.current.set(t,e.data)}));let i=null==n.window||"function"!=typeof n.window.document.startViewTransition;if(a&&!i){if(o){C((()=>{p&&(d&&d.resolve(),p.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:a.currentLocation,nextLocation:a.nextLocation})}));let t=n.window.document.startViewTransition((()=>{C((()=>u(e)))}));return t.finished.finally((()=>{C((()=>{m(void 0),b(void 0),c(void 0),f({isTransitioning:!1})}))})),void C((()=>b(t)))}p?(d&&d.resolve(),p.skipTransition(),v({state:e,currentLocation:a.currentLocation,nextLocation:a.nextLocation})):(c(e),f({isTransitioning:!0,flushSync:!1,currentLocation:a.currentLocation,nextLocation:a.nextLocation}))}else o?C((()=>u(e))):w((()=>u(e)))}),[n.window,p,d,y,w]);i.useLayoutEffect((()=>n.subscribe(R)),[n,R]),i.useEffect((()=>{l.isTransitioning&&!l.flushSync&&m(new N)}),[l]),i.useEffect((()=>{if(d&&s&&n.window){let e=s,t=d.promise,r=n.window.document.startViewTransition((async()=>{w((()=>u(e))),await t}));r.finished.finally((()=>{m(void 0),b(void 0),c(void 0),f({isTransitioning:!1})})),b(r)}}),[w,s,d,n.window]),i.useEffect((()=>{d&&s&&a.location.key===s.location.key&&d.resolve()}),[d,p,a.location,s]),i.useEffect((()=>{!l.isTransitioning&&h&&(c(h.state),f({isTransitioning:!0,flushSync:!1,currentLocation:h.currentLocation,nextLocation:h.nextLocation}),v(void 0))}),[l.isTransitioning,h]),i.useEffect((()=>{}),[]);let S=i.useMemo((()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:e=>n.navigate(e),push:(e,t,r)=>n.navigate(e,{state:t,preventScrollReset:null==r?void 0:r.preventScrollReset}),replace:(e,t,r)=>n.navigate(e,{replace:!0,state:t,preventScrollReset:null==r?void 0:r.preventScrollReset})})),[n]),O=n.basename||"/",A=i.useMemo((()=>({router:n,navigator:S,static:!1,basename:O})),[n,S,O]);return i.createElement(i.Fragment,null,i.createElement(r.UNSAFE_DataRouterContext.Provider,{value:A},i.createElement(r.UNSAFE_DataRouterStateContext.Provider,{value:a},i.createElement(P.Provider,{value:y.current},i.createElement(E.Provider,{value:l},i.createElement(r.Router,{basename:O,location:a.location,navigationType:a.historyAction,navigator:S,future:{v7_relativeSplatPath:n.future.v7_relativeSplatPath}},a.initialized||n.future.v7_partialHydration?i.createElement(j,{routes:n.routes,future:n.future,state:a}):t))))),null)},e.ScrollRestoration=function(e){let{getKey:t,storageKey:n}=e;return Y({getKey:t,storageKey:n}),null},e.UNSAFE_FetchersContext=P,e.UNSAFE_ViewTransitionContext=E,e.UNSAFE_useScrollRestoration=Y,e.createBrowserRouter=function(e,t){return o.createRouter({basename:null==t?void 0:t.basename,future:s({},null==t?void 0:t.future,{v7_prependBasename:!0}),history:o.createBrowserHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||R(),routes:e,mapRouteProperties:r.UNSAFE_mapRouteProperties,unstable_dataStrategy:null==t?void 0:t.unstable_dataStrategy,window:null==t?void 0:t.window}).initialize()},e.createHashRouter=function(e,t){return o.createRouter({basename:null==t?void 0:t.basename,future:s({},null==t?void 0:t.future,{v7_prependBasename:!0}),history:o.createHashHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||R(),routes:e,mapRouteProperties:r.UNSAFE_mapRouteProperties,unstable_dataStrategy:null==t?void 0:t.unstable_dataStrategy,window:null==t?void 0:t.window}).initialize()},e.createSearchParams=m,e.unstable_HistoryRouter=function(e){let{basename:t,children:n,future:o,history:a}=e,[u,s]=i.useState({action:a.action,location:a.location}),{v7_startTransition:c}=o||{},l=i.useCallback((e=>{c&&_?_((()=>s(e))):s(e)}),[s,c]);return i.useLayoutEffect((()=>a.listen(l)),[a,l]),i.createElement(r.Router,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:a,future:o})},e.unstable_usePrompt=function(e){let{when:t,message:n}=e,o=r.useBlocker(t);i.useEffect((()=>{if("blocked"===o.state){window.confirm(n)?setTimeout(o.proceed,0):o.reset()}}),[o,n]),i.useEffect((()=>{"blocked"!==o.state||t||o.reset()}),[o,t])},e.unstable_useViewTransitionState=J,e.useBeforeUnload=function(e,t){let{capture:n}=t||{};i.useEffect((()=>{let t=null!=n?{capture:n}:void 0;return window.addEventListener("beforeunload",e,t),()=>{window.removeEventListener("beforeunload",e,t)}}),[e,n])},e.useFetcher=function(e){var t;let{key:n}=void 0===e?{}:e,{router:a}=M(D.UseFetcher),u=B(k.UseFetcher),c=i.useContext(P),l=i.useContext(r.UNSAFE_RouteContext),f=null==(t=l.matches[l.matches.length-1])?void 0:t.route.id;c||o.UNSAFE_invariant(!1),l||o.UNSAFE_invariant(!1),null==f&&o.UNSAFE_invariant(!1);let d=A?A():"",[m,p]=i.useState(n||d);n&&n!==m?p(n):m||p(K()),i.useEffect((()=>(a.getFetcher(m),()=>{a.deleteFetcher(m)})),[a,m]);let b=i.useCallback(((e,t)=>{f||o.UNSAFE_invariant(!1),a.fetch(m,f,e,t)}),[m,f,a]),h=V(),v=i.useCallback(((e,t)=>{h(e,s({},t,{navigate:!1,fetcherKey:m}))}),[m,h]),y=i.useMemo((()=>i.forwardRef(((e,t)=>i.createElement(U,s({},e,{navigate:!1,fetcherKey:m,ref:t}))))),[m]),g=u.fetchers.get(m)||o.IDLE_FETCHER,w=c.get(m);return i.useMemo((()=>s({Form:y,submit:v,load:b},g,{data:w})),[y,v,b,g,w])},e.useFetchers=function(){let e=B(k.UseFetchers);return Array.from(e.fetchers.entries()).map((e=>{let[t,n]=e;return s({},n,{key:t})}))},e.useFormAction=z,e.useLinkClickHandler=H,e.useSearchParams=function(e){let t=i.useRef(m(e)),n=i.useRef(!1),o=r.useLocation(),a=i.useMemo((()=>function(e,t){let n=m(e);return t&&t.forEach(((e,r)=>{n.has(r)||t.getAll(r).forEach((e=>{n.append(r,e)}))})),n}(o.search,n.current?null:t.current)),[o.search]),u=r.useNavigate(),s=i.useCallback(((e,t)=>{const r=m("function"==typeof e?e(a):e);n.current=!0,u("?"+r,t)}),[u,a]);return[a,s]},e.useSubmit=V,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=react-router-dom.production.min.js.map
{
"name": "react-router-dom",
"version": "0.0.0-experimental-a077dc2d",
"version": "0.0.0-experimental-a0888892",
"description": "Declarative routing for React web applications",

@@ -26,4 +26,4 @@ "keywords": [

"dependencies": {
"@remix-run/router": "0.0.0-experimental-a077dc2d",
"react-router": "0.0.0-experimental-a077dc2d"
"@remix-run/router": "0.0.0-experimental-a0888892",
"react-router": "0.0.0-experimental-a0888892"
},

@@ -30,0 +30,0 @@ "devDependencies": {

import * as React from "react";
import type { Router as RemixRouter, StaticHandlerContext, CreateStaticHandlerOptions as RouterCreateStaticHandlerOptions } from "@remix-run/router";
import type { Location, RouteObject } from "react-router-dom";
import type { Router as RemixRouter, StaticHandlerContext, CreateStaticHandlerOptions as RouterCreateStaticHandlerOptions, FutureConfig as RouterFutureConfig } from "@remix-run/router";
import type { FutureConfig, Location, RouteObject } from "react-router-dom";
export interface StaticRouterProps {

@@ -8,2 +8,3 @@ basename?: string;

location: Partial<Location> | string;
future?: Partial<FutureConfig>;
}

@@ -14,3 +15,3 @@ /**

*/
export declare function StaticRouter({ basename, children, location: locationProp, }: StaticRouterProps): React.JSX.Element;
export declare function StaticRouter({ basename, children, location: locationProp, future, }: StaticRouterProps): React.JSX.Element;
export { StaticHandlerContext };

@@ -30,2 +31,4 @@ export interface StaticRouterProviderProps {

export declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): import("@remix-run/router").StaticHandler;
export declare function createStaticRouter(routes: RouteObject[], context: StaticHandlerContext): RemixRouter;
export declare function createStaticRouter(routes: RouteObject[], context: StaticHandlerContext, opts?: {
future?: Partial<Pick<RouterFutureConfig, "v7_partialHydration" | "v7_relativeSplatPath">>;
}): RemixRouter;

@@ -37,3 +37,4 @@ 'use strict';

children,
location: locationProp = "/"
location: locationProp = "/",
future
}) {

@@ -58,2 +59,3 @@ if (typeof locationProp === "string") {

navigator: staticNavigator,
future: future,
static: true

@@ -80,2 +82,3 @@ });

};
let fetchersContext = new Map();
let hydrateScript = "";

@@ -103,7 +106,3 @@ if (hydrate !== false) {

}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_FetchersContext.Provider, {
value: {
fetcherData: new Map(),
register: () => {},
unregister: () => {}
}
value: fetchersContext
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_ViewTransitionContext.Provider, {

@@ -118,5 +117,9 @@ value: {

navigator: dataRouterContext.navigator,
static: dataRouterContext.static
static: dataRouterContext.static,
future: {
v7_relativeSplatPath: router$1.future.v7_relativeSplatPath
}
}, /*#__PURE__*/React__namespace.createElement(DataRoutes, {
routes: router$1.routes,
future: router$1.future,
state: state

@@ -133,5 +136,6 @@ })))))), hydrateScript ? /*#__PURE__*/React__namespace.createElement("script", {

routes,
future,
state
}) {
return reactRouter.UNSAFE_useRoutesImpl(routes, undefined, state);
return reactRouter.UNSAFE_useRoutesImpl(routes, undefined, state, future);
}

@@ -194,3 +198,3 @@ function serializeErrors(errors) {

}
function createStaticRouter(routes, context) {
function createStaticRouter(routes, context, opts = {}) {
let manifest = {};

@@ -213,2 +217,11 @@ let dataRoutes = router.UNSAFE_convertRoutesToDataRoutes(routes, reactRouter.UNSAFE_mapRouteProperties, undefined, manifest);

},
get future() {
return {
v7_fetcherPersist: false,
v7_normalizeFormMethod: false,
v7_partialHydration: opts.future?.v7_partialHydration === true,
v7_prependBasename: false,
v7_relativeSplatPath: opts.future?.v7_relativeSplatPath === true
};
},
get state() {

@@ -284,2 +297,6 @@ return {

let href = typeof to === "string" ? to : reactRouterDom.createPath(to);
// Treating this as a full URL will strip any trailing spaces so we need to
// pre-encode them since they might be part of a matching splat param from
// an ancestor route
href = href.replace(/ $/, "%20");
let encoded = ABSOLUTE_URL_REGEX.test(href) ? new URL(href) : new URL(href, "http://localhost");

@@ -286,0 +303,0 @@ return {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc