Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-router-dom

Package Overview
Dependencies
Maintainers
3
Versions
459
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-router-dom - npm Package Compare versions

Comparing version 6.4.0-pre.9 to 6.4.0-pre.10

20

CHANGELOG.md
# react-router-dom
## 6.4.0-pre.10
### Patch Changes
- SSR Updates for React Router (#9058)
_Note: The Data-Router SSR aspects of `@remix-run/router` and `react-router-dom` are being released as **unstable** in this release (`unstable_createStaticHandler` and `unstable_DataStaticRouter`), and we plan to finalize them in a subsequent minor release once the kinks can be worked out with the Remix integration. To that end, they are available for use, but are subject to breaking changes in the next minor release._
- Remove `useRenderDataRouter()` in favor of `<DataRouterProvider>`/`<DataRouter>`
- Support automatic hydration in `<DataStaticRouter>`/`<DataBrowserRouter>`/`<DataHashRouter>`
- Uses `window.__staticRouterHydrationData`
- Can be disabled on the server via `<DataStaticRouter hydrate={false}>`
- Can be disabled (or overridden) in the browser by passing `hydrationData` to `<DataBrowserRouter>`/`<DataHashRouter>`
- `<DataStaticRouter>` now tracks it's own SSR error boundaries on `StaticHandlerContext`
- `StaticHandlerContext` now exposes `statusCode`/`loaderHeaders`/`actionHeaders`
- `foundMissingHydrationData` check removed since Remix routes may have loaders (for modules) that don't return data for `loaderData`
- Updated dependencies
- react-router@6.4.0-pre.10
## 6.4.0-pre.9

@@ -4,0 +24,0 @@

28

dist/index.d.ts

@@ -6,12 +6,20 @@ /**

import * as React from "react";
import type { NavigateOptions, To } from "react-router";
import type { Fetcher, FormMethod, GetScrollRestorationKeyFunction, History, HydrationState, RouteObject } from "@remix-run/router";
import { NavigateOptions, To } from "react-router";
import type { Fetcher, FormEncType, FormMethod, GetScrollRestorationKeyFunction, History, HydrationState, RouteObject } from "@remix-run/router";
import type { SubmitOptions, ParamKeyValuePair, URLSearchParamsInit } from "./dom";
import { createSearchParams } from "./dom";
export type { ParamKeyValuePair, URLSearchParamsInit };
export type { FormEncType, FormMethod, ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, };
export { createSearchParams };
export type { ActionFunction, ActionFunctionArgs, DataMemoryRouterProps, DataRouteMatch, Deferrable, DeferredProps, Fetcher, Hash, IndexRouteProps, JsonFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RouteMatch, RouteObject, RouteProps, RouterProps, RoutesProps, Search, ShouldRevalidateFunction, To, } from "react-router";
export type { ActionFunction, ActionFunctionArgs, DataMemoryRouterProps, DataRouteMatch, DeferredProps, Fetcher, Hash, IndexRouteProps, JsonFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RouteMatch, RouteObject, RouteProps, RouterProps, RoutesProps, Search, ShouldRevalidateFunction, To, } from "react-router";
export { DataMemoryRouter, Deferred, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, createPath, createRoutesFromChildren, deferred, isDeferredError, isRouteErrorResponse, generatePath, json, matchPath, matchRoutes, parsePath, redirect, renderMatches, resolvePath, useActionData, useDeferredData, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, } from "react-router";
/** @internal */
export { UNSAFE_NavigationContext, UNSAFE_LocationContext, UNSAFE_RouteContext, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, useRenderDataRouter, } from "react-router";
export { UNSAFE_DataRouter, UNSAFE_DataRouterProvider, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_DataStaticRouterContext, UNSAFE_NavigationContext, UNSAFE_LocationContext, UNSAFE_RouteContext, } from "react-router";
declare global {
var __staticRouterHydrationData: HydrationState | undefined;
}
/**
* Unit-testing-only function to reset the router between tests
* @private
*/
export declare function _resetModuleScope(): void;
export interface DataBrowserRouterProps {

@@ -25,3 +33,3 @@ basename?: string;

}
export declare function DataBrowserRouter({ basename, children, fallbackElement, hydrationData, routes, window, }: DataBrowserRouterProps): React.ReactElement;
export declare function DataBrowserRouter({ basename, children, fallbackElement, hydrationData, routes, window: windowProp, }: DataBrowserRouterProps): React.ReactElement;
export interface DataHashRouterProps {

@@ -35,3 +43,3 @@ basename?: string;

}
export declare function DataHashRouter({ basename, children, hydrationData, fallbackElement, routes, window, }: DataBrowserRouterProps): React.ReactElement;
export declare function DataHashRouter({ basename, children, hydrationData, fallbackElement, routes, window: windowProp, }: DataBrowserRouterProps): React.ReactElement;
export interface BrowserRouterProps {

@@ -114,2 +122,6 @@ basename?: string;

/**
* Forces a full document navigation instead of a fetch.
*/
reloadDocument?: boolean;
/**
* Replaces the current entry in the browser history stack when the form

@@ -192,3 +204,3 @@ * navigates. Use this if you don't want the user to be able to click "back"

declare function createFetcherForm(fetcherKey: string, routeId: string): React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
declare type FetcherWithComponents<TData> = Fetcher<TData> & {
export declare type FetcherWithComponents<TData> = Fetcher<TData> & {
Form: ReturnType<typeof createFetcherForm>;

@@ -195,0 +207,0 @@ submit: ReturnType<typeof useSubmitImpl>;

/**
* React Router DOM v6.4.0-pre.9
* React Router DOM v6.4.0-pre.10
*

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

import * as React from 'react';
import { useRenderDataRouter, Router, useHref, createPath, useResolvedPath, useMatch, UNSAFE_DataRouterStateContext, useNavigate, useLocation, UNSAFE_DataRouterContext, UNSAFE_RouteContext } from 'react-router';
export { DataMemoryRouter, Deferred, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createPath, createRoutesFromChildren, deferred, generatePath, isDeferredError, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, renderMatches, resolvePath, useActionData, useDeferredData, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useRenderDataRouter, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes } from 'react-router';
import { createRoutesFromChildren, UNSAFE_DataRouterProvider, UNSAFE_DataRouter, Router, useHref, createPath, useResolvedPath, useMatch, UNSAFE_DataRouterStateContext, useNavigate, useLocation, UNSAFE_DataRouterContext, UNSAFE_RouteContext } from 'react-router';
export { DataMemoryRouter, Deferred, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_DataRouter, UNSAFE_DataRouterContext, UNSAFE_DataRouterProvider, UNSAFE_DataRouterStateContext, UNSAFE_DataStaticRouterContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createPath, createRoutesFromChildren, deferred, generatePath, isDeferredError, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, renderMatches, resolvePath, useActionData, useDeferredData, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes } from 'react-router';
import { createBrowserRouter, createHashRouter, createBrowserHistory, createHashHistory, matchPath, invariant } from '@remix-run/router';

@@ -190,3 +190,17 @@

_excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "children"],
_excluded3 = ["replace", "method", "action", "onSubmit", "fetcherKey", "routeId"];
_excluded3 = ["reloadDocument", "replace", "method", "action", "onSubmit", "fetcherKey", "routeId"];
// to avoid issues w.r.t. dual initialization fetches in concurrent rendering.
// Data router apps are expected to have a static route tree and are not intended
// to be unmounted/remounted at runtime.
let routerSingleton;
/**
* Unit-testing-only function to reset the router between tests
* @private
*/
function _resetModuleScope() {
// @ts-expect-error
routerSingleton = null;
}
function DataBrowserRouter(_ref) {

@@ -199,16 +213,20 @@ let {

routes,
window
window: windowProp
} = _ref;
return useRenderDataRouter({
basename,
children,
fallbackElement,
routes,
createRouter: routes => createBrowserRouter({
if (!routerSingleton) {
routerSingleton = createBrowserRouter({
basename,
routes,
hydrationData,
window
})
});
hydrationData: hydrationData || window.__staticRouterHydrationData,
window: windowProp,
routes: routes || createRoutesFromChildren(children)
}).initialize();
}
let router = routerSingleton;
return /*#__PURE__*/React.createElement(UNSAFE_DataRouterProvider, {
router: router,
basename: basename,
fallbackElement: fallbackElement
}, /*#__PURE__*/React.createElement(UNSAFE_DataRouter, null));
}

@@ -222,16 +240,20 @@ function DataHashRouter(_ref2) {

routes,
window
window: windowProp
} = _ref2;
return useRenderDataRouter({
basename,
children,
fallbackElement,
routes,
createRouter: routes => createHashRouter({
if (!routerSingleton) {
routerSingleton = createHashRouter({
basename,
routes,
hydrationData,
window
})
});
hydrationData: hydrationData || window.__staticRouterHydrationData,
window: windowProp,
routes: routes || createRoutesFromChildren(children)
}).initialize();
}
let router = routerSingleton;
return /*#__PURE__*/React.createElement(UNSAFE_DataRouterProvider, {
router: router,
basename: basename,
fallbackElement: fallbackElement
}, /*#__PURE__*/React.createElement(UNSAFE_DataRouter, null));
}

@@ -362,3 +384,3 @@ /**

if (!event.defaultPrevented && !reloadDocument) {
if (!event.defaultPrevented) {
internalOnClick(event);

@@ -373,3 +395,3 @@ }

href: href,
onClick: handleClick,
onClick: reloadDocument ? onClick : handleClick,
ref: ref,

@@ -473,2 +495,3 @@ target: target

let {
reloadDocument,
replace,

@@ -502,3 +525,3 @@ method = defaultMethod,

action: formAction,
onSubmit: submitHandler
onSubmit: reloadDocument ? onSubmit : submitHandler
}, props));

@@ -593,3 +616,7 @@ });

function useSubmitImpl(fetcherKey, routeId) {
let router = React.useContext(UNSAFE_DataRouterContext);
let dataRouterContext = React.useContext(UNSAFE_DataRouterContext);
!dataRouterContext ? process.env.NODE_ENV !== "production" ? invariant(false, "useSubmitImpl must be used within a Data Router") : invariant(false) : void 0;
let {
router
} = dataRouterContext;
let defaultAction = useFormAction();

@@ -601,4 +628,2 @@ return React.useCallback(function (target, options) {

!(router != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "useSubmit() must be used within a <DataRouter>") : invariant(false) : void 0;
if (typeof document === "undefined") {

@@ -676,4 +701,7 @@ throw new Error("You are calling submit during the server render. " + "Try calling submit within a `useEffect` or callback instead.");

let router = React.useContext(UNSAFE_DataRouterContext);
!router ? process.env.NODE_ENV !== "production" ? invariant(false, "useFetcher must be used within a DataRouter") : invariant(false) : void 0;
let dataRouterContext = React.useContext(UNSAFE_DataRouterContext);
!dataRouterContext ? process.env.NODE_ENV !== "production" ? invariant(false, "useFetcher must be used within a Data Router") : invariant(false) : void 0;
let {
router
} = dataRouterContext;
let route = React.useContext(UNSAFE_RouteContext);

@@ -722,3 +750,3 @@ !route ? process.env.NODE_ENV !== "production" ? invariant(false, "useFetcher must be used inside a RouteContext") : invariant(false) : void 0;

let state = React.useContext(UNSAFE_DataRouterStateContext);
!state ? process.env.NODE_ENV !== "production" ? invariant(false, "useFetchers must be used within a DataRouter") : invariant(false) : void 0;
!state ? process.env.NODE_ENV !== "production" ? invariant(false, "useFetchers must be used within a DataRouterStateContext") : invariant(false) : void 0;
return [...state.fetchers.values()];

@@ -738,5 +766,9 @@ }

let location = useLocation();
let router = React.useContext(UNSAFE_DataRouterContext);
let dataRouterContext = React.useContext(UNSAFE_DataRouterContext);
!dataRouterContext ? process.env.NODE_ENV !== "production" ? invariant(false, "useScrollRestoration must be used within a DataRouterContext") : invariant(false) : void 0;
let {
router
} = dataRouterContext;
let state = React.useContext(UNSAFE_DataRouterStateContext);
!(router != null && state != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "useScrollRestoration must be used within a DataRouter") : invariant(false) : void 0;
!(router != null && state != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "useScrollRestoration must be used within a DataRouterStateContext") : invariant(false) : void 0;
let {

@@ -841,3 +873,3 @@ restoreScrollPosition,

export { BrowserRouter, DataBrowserRouter, DataHashRouter, Form, HashRouter, Link, NavLink, ScrollRestoration, createSearchParams, HistoryRouter as unstable_HistoryRouter, useFetcher, useFetchers, useFormAction, useLinkClickHandler, useSearchParams, useSubmit };
export { BrowserRouter, DataBrowserRouter, DataHashRouter, Form, HashRouter, Link, NavLink, ScrollRestoration, _resetModuleScope, createSearchParams, HistoryRouter as unstable_HistoryRouter, useFetcher, useFetchers, useFormAction, useLinkClickHandler, useSearchParams, useSubmit };
//# sourceMappingURL=index.js.map
/**
* React Router DOM v6.4.0-pre.9
* React Router DOM v6.4.0-pre.10
*

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

/**
* React Router DOM v6.4.0-pre.9
* React Router DOM v6.4.0-pre.10
*

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

import * as React from 'react';
import { useRenderDataRouter, Router, useHref, createPath, useResolvedPath, useMatch, UNSAFE_DataRouterStateContext, useNavigate, useLocation, UNSAFE_DataRouterContext, UNSAFE_RouteContext } from 'react-router';
export { DataMemoryRouter, Deferred, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createPath, createRoutesFromChildren, deferred, generatePath, isDeferredError, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, renderMatches, resolvePath, useActionData, useDeferredData, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useRenderDataRouter, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes } from 'react-router';
import { createRoutesFromChildren, UNSAFE_DataRouterProvider, UNSAFE_DataRouter, Router, useHref, createPath, useResolvedPath, useMatch, UNSAFE_DataRouterStateContext, useNavigate, useLocation, UNSAFE_DataRouterContext, UNSAFE_RouteContext } from 'react-router';
export { DataMemoryRouter, Deferred, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_DataRouter, UNSAFE_DataRouterContext, UNSAFE_DataRouterProvider, UNSAFE_DataRouterStateContext, UNSAFE_DataStaticRouterContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createPath, createRoutesFromChildren, deferred, generatePath, isDeferredError, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, renderMatches, resolvePath, useActionData, useDeferredData, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes } from 'react-router';
import { createBrowserRouter, createHashRouter, createBrowserHistory, createHashHistory, matchPath, invariant } from '@remix-run/router';

@@ -156,3 +156,17 @@

*/
////////////////////////////////////////////////////////////////////////////////
// Module-scoped singleton to hold the router. Extracted from the React lifecycle
// to avoid issues w.r.t. dual initialization fetches in concurrent rendering.
// Data router apps are expected to have a static route tree and are not intended
// to be unmounted/remounted at runtime.
let routerSingleton;
/**
* Unit-testing-only function to reset the router between tests
* @private
*/
function _resetModuleScope() {
// @ts-expect-error
routerSingleton = null;
} ////////////////////////////////////////////////////////////////////////////////
//#region Components

@@ -167,16 +181,19 @@ ////////////////////////////////////////////////////////////////////////////////

routes,
window
window: windowProp
}) {
return useRenderDataRouter({
basename,
children,
fallbackElement,
routes,
createRouter: routes => createBrowserRouter({
if (!routerSingleton) {
routerSingleton = createBrowserRouter({
basename,
routes,
hydrationData,
window
})
});
hydrationData: hydrationData || window.__staticRouterHydrationData,
window: windowProp,
routes: routes || createRoutesFromChildren(children)
}).initialize();
}
let router = routerSingleton;
return /*#__PURE__*/React.createElement(UNSAFE_DataRouterProvider, {
router: router,
basename: basename,
fallbackElement: fallbackElement
}, /*#__PURE__*/React.createElement(UNSAFE_DataRouter, null));
}

@@ -189,16 +206,19 @@ function DataHashRouter({

routes,
window
window: windowProp
}) {
return useRenderDataRouter({
basename,
children,
fallbackElement,
routes,
createRouter: routes => createHashRouter({
if (!routerSingleton) {
routerSingleton = createHashRouter({
basename,
routes,
hydrationData,
window
})
});
hydrationData: hydrationData || window.__staticRouterHydrationData,
window: windowProp,
routes: routes || createRoutesFromChildren(children)
}).initialize();
}
let router = routerSingleton;
return /*#__PURE__*/React.createElement(UNSAFE_DataRouterProvider, {
router: router,
basename: basename,
fallbackElement: fallbackElement
}, /*#__PURE__*/React.createElement(UNSAFE_DataRouter, null));
}

@@ -324,3 +344,3 @@

if (!event.defaultPrevented && !reloadDocument) {
if (!event.defaultPrevented) {
internalOnClick(event);

@@ -335,3 +355,3 @@ }

href: href,
onClick: handleClick,
onClick: reloadDocument ? onClick : handleClick,
ref: ref,

@@ -430,2 +450,3 @@ target: target

const FormImpl = /*#__PURE__*/React.forwardRef(({
reloadDocument,
replace,

@@ -458,3 +479,3 @@ method: _method = defaultMethod,

action: formAction,
onSubmit: submitHandler
onSubmit: reloadDocument ? onSubmit : submitHandler
}, props));

@@ -546,7 +567,9 @@ });

function useSubmitImpl(fetcherKey, routeId) {
let router = React.useContext(UNSAFE_DataRouterContext);
let dataRouterContext = React.useContext(UNSAFE_DataRouterContext);
!dataRouterContext ? invariant(false, "useSubmitImpl must be used within a Data Router") : void 0;
let {
router
} = dataRouterContext;
let defaultAction = useFormAction();
return React.useCallback((target, options = {}) => {
!(router != null) ? invariant(false, "useSubmit() must be used within a <DataRouter>") : void 0;
if (typeof document === "undefined") {

@@ -618,4 +641,7 @@ throw new Error("You are calling submit during the server render. " + "Try calling submit within a `useEffect` or callback instead.");

function useFetcher() {
let router = React.useContext(UNSAFE_DataRouterContext);
!router ? invariant(false, `useFetcher must be used within a DataRouter`) : void 0;
let dataRouterContext = React.useContext(UNSAFE_DataRouterContext);
!dataRouterContext ? invariant(false, `useFetcher must be used within a Data Router`) : void 0;
let {
router
} = dataRouterContext;
let route = React.useContext(UNSAFE_RouteContext);

@@ -665,3 +691,3 @@ !route ? invariant(false, `useFetcher must be used inside a RouteContext`) : void 0;

let state = React.useContext(UNSAFE_DataRouterStateContext);
!state ? invariant(false, `useFetchers must be used within a DataRouter`) : void 0;
!state ? invariant(false, `useFetchers must be used within a DataRouterStateContext`) : void 0;
return [...state.fetchers.values()];

@@ -680,5 +706,9 @@ }

let location = useLocation();
let router = React.useContext(UNSAFE_DataRouterContext);
let dataRouterContext = React.useContext(UNSAFE_DataRouterContext);
!dataRouterContext ? invariant(false, "useScrollRestoration must be used within a DataRouterContext") : void 0;
let {
router
} = dataRouterContext;
let state = React.useContext(UNSAFE_DataRouterStateContext);
!(router != null && state != null) ? invariant(false, "useScrollRestoration must be used within a DataRouter") : void 0;
!(router != null && state != null) ? invariant(false, "useScrollRestoration must be used within a DataRouterStateContext") : void 0;
let {

@@ -783,3 +813,3 @@ restoreScrollPosition,

export { BrowserRouter, DataBrowserRouter, DataHashRouter, Form, HashRouter, Link, NavLink, ScrollRestoration, createSearchParams, HistoryRouter as unstable_HistoryRouter, useFetcher, useFetchers, useFormAction, useLinkClickHandler, useSearchParams, useSubmit };
export { BrowserRouter, DataBrowserRouter, DataHashRouter, Form, HashRouter, Link, NavLink, ScrollRestoration, _resetModuleScope, createSearchParams, HistoryRouter as unstable_HistoryRouter, useFetcher, useFetchers, useFormAction, useLinkClickHandler, useSearchParams, useSubmit };
//# sourceMappingURL=react-router-dom.development.js.map
/**
* React Router DOM v6.4.0-pre.9
* React Router DOM v6.4.0-pre.10
*

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

*/
import*as e from"react";import{useRenderDataRouter as t,Router as n,useHref as o,createPath as r,useResolvedPath as a,useMatch as i,UNSAFE_DataRouterStateContext as u,useNavigate as s,useLocation as l,UNSAFE_DataRouterContext as c,UNSAFE_RouteContext as f}from"react-router";export{DataMemoryRouter,Deferred,MemoryRouter,Navigate,NavigationType,Outlet,Route,Router,Routes,UNSAFE_DataRouterContext,UNSAFE_DataRouterStateContext,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,createPath,createRoutesFromChildren,deferred,generatePath,isDeferredError,isRouteErrorResponse,json,matchPath,matchRoutes,parsePath,redirect,renderMatches,resolvePath,useActionData,useDeferredData,useHref,useInRouterContext,useLoaderData,useLocation,useMatch,useMatches,useNavigate,useNavigation,useNavigationType,useOutlet,useOutletContext,useParams,useRenderDataRouter,useResolvedPath,useRevalidator,useRouteError,useRouteLoaderData,useRoutes}from"react-router";import{createBrowserRouter as m,createHashRouter as d,createBrowserHistory as h,createHashHistory as p,matchPath as g,invariant as y}from"@remix-run/router";const w="application/x-www-form-urlencoded";function b(e){return null!=e&&"string"==typeof e.tagName}function v(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let o=e[n];return t.concat(Array.isArray(o)?o.map((e=>[n,e])):[[n,o]])}),[]))}function E(e,t,n){let o,r,a,i;if(b(u=e)&&"form"===u.tagName.toLowerCase()){let u=n.submissionTrigger;o=n.method||e.getAttribute("method")||"get",r=n.action||e.getAttribute("action")||t,a=n.encType||e.getAttribute("enctype")||w,i=new FormData(e),u&&u.name&&i.append(u.name,u.value)}else if(function(e){return b(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return b(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>');o=n.method||e.getAttribute("formmethod")||u.getAttribute("method")||"get",r=n.action||e.getAttribute("formaction")||u.getAttribute("action")||t,a=n.encType||e.getAttribute("formenctype")||u.getAttribute("enctype")||w,i=new FormData(u),e.name&&i.set(e.name,e.value)}else{if(b(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');if(o=n.method||"get",r=n.action||t,a=n.encType||w,e instanceof FormData)i=e;else if(i=new FormData,e instanceof URLSearchParams)for(let[t,n]of e)i.append(t,n);else if(null!=e)for(let t of Object.keys(e))i.append(t,e[t])}var u;let{protocol:s,host:l}=window.location;return{url:new URL(r,`${s}//${l}`),method:o,encType:a,formData:i}}function R({basename:e,children:n,fallbackElement:o,hydrationData:r,routes:a,window:i}){return t({basename:e,children:n,fallbackElement:o,routes:a,createRouter:t=>m({basename:e,routes:t,hydrationData:r,window:i})})}function S({basename:e,children:n,hydrationData:o,fallbackElement:r,routes:a,window:i}){return t({basename:e,children:n,fallbackElement:r,routes:a,createRouter:t=>d({basename:e,routes:t,hydrationData:o,window:i})})}function C({basename:t,children:o,window:r}){let a=e.useRef();null==a.current&&(a.current=h({window:r,v5Compat:!0}));let i=a.current,[u,s]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(s)),[i]),e.createElement(n,{basename:t,children:o,location:u.location,navigationType:u.action,navigator:i})}function D({basename:t,children:o,window:r}){let a=e.useRef();null==a.current&&(a.current=p({window:r,v5Compat:!0}));let i=a.current,[u,s]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(s)),[i]),e.createElement(n,{basename:t,children:o,location:u.location,navigationType:u.action,navigator:i})}function A({basename:t,children:o,history:r}){const[a,i]=e.useState({action:r.action,location:r.location});return e.useLayoutEffect((()=>r.listen(i)),[r]),e.createElement(n,{basename:t,children:o,location:a.location,navigationType:a.action,navigator:r})}const x=e.forwardRef((function({onClick:t,reloadDocument:n,replace:r,state:a,target:i,to:u,resetScroll:s,...l},c){let f=o(u),m=k(u,{replace:r,state:a,target:i,resetScroll:s});return e.createElement("a",Object.assign({},l,{href:f,onClick:function(e){t&&t(e),e.defaultPrevented||n||m(e)},ref:c,target:i}))})),L=e.forwardRef((function({"aria-current":t="page",caseSensitive:n=!1,className:o="",end:r=!1,style:s,to:l,children:c,...f},m){let d,h=a(l),p=i({path:h.pathname,end:r,caseSensitive:n}),y=e.useContext(u)?.navigation.location,w=a(y||""),b=null!=e.useMemo((()=>y?g({path:h.pathname,end:r,caseSensitive:n},w.pathname):null),[y,h.pathname,n,r,w.pathname]),v=null!=p,E=v?t:void 0;d="function"==typeof o?o({isActive:v,isPending:b}):[o,v?"active":null,b?"pending":null].filter(Boolean).join(" ");let R="function"==typeof s?s({isActive:v,isPending:b}):s;return e.createElement(x,Object.assign({},f,{"aria-current":E,className:d,ref:m,style:R,to:l}),"function"==typeof c?c({isActive:v,isPending:b}):c)})),N=e.forwardRef(((t,n)=>e.createElement(P,Object.assign({},t,{ref:n})))),P=e.forwardRef((({replace:t,method:n="get",action:o=".",onSubmit:r,fetcherKey:a,routeId:i,...u},s)=>{let l=O(a,i),c="get"===n.toLowerCase()?"get":"post",f=j(o);return e.createElement("form",Object.assign({ref:s,method:c,action:f,onSubmit:e=>{if(r&&r(e),e.defaultPrevented)return;e.preventDefault();let o=e.nativeEvent.submitter;l(o||e.currentTarget,{method:n,replace:t})}},u))}));function T({getKey:t,storageKey:n}){return function({getKey:t,storageKey:n}={}){let o=l(),r=e.useContext(c),a=e.useContext(u);(null==r||null==a)&&y(!1);let{restoreScrollPosition:i,resetScrollPosition:s}=a;e.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),f=e.useCallback((()=>{if("idle"===a?.navigation.state){let e=(t?t(a.location,a.matches):null)||a.location.key;_[e]=window.scrollY}sessionStorage.setItem(n||"react-router-scroll-positions",JSON.stringify(_)),window.history.scrollRestoration="auto"}),[n,t,a.navigation.state,a.location,a.matches]),e.useEffect((()=>(window.addEventListener("beforeunload",f),()=>{window.removeEventListener("beforeunload",f)})),[f]),e.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(n||"react-router-scroll-positions");e&&(_=JSON.parse(e))}catch(e){}}),[n]),e.useLayoutEffect((()=>{let e=r?.enableScrollRestoration(_,(()=>window.scrollY),t);return()=>e&&e()}),[r,t]),e.useLayoutEffect((()=>{if(!1!==i)if("number"!=typeof i){if(o.hash){let e=document.getElementById(o.hash.slice(1));if(e)return void e.scrollIntoView()}!1!==s&&window.scrollTo(0,0)}else window.scrollTo(0,i)}),[o,i,s]);var f}({getKey:t,storageKey:n}),null}function k(t,{target:n,replace:o,state:i,resetScroll:u}={}){let c=s(),f=l(),m=a(t);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!==o?o:r(f)===r(m);c(t,{replace:n,state:i,resetScroll:u})}}),[f,c,m,o,i,n,t,u])}function F(t){let n=e.useRef(v(t)),o=l(),r=e.useMemo((()=>function(e,t){let n=v(e);for(let o of t.keys())n.has(o)||t.getAll(o).forEach((e=>{n.append(o,e)}));return n}(o.search,n.current)),[o.search]),a=s(),i=e.useCallback(((e,t)=>{const n=v("function"==typeof e?e(r):e);a("?"+n,t)}),[a,r]);return[r,i]}function K(){return O()}function O(t,n){let o=e.useContext(c),r=j();return e.useCallback(((e,a={})=>{if(null==o&&y(!1),"undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");let{method:i,encType:u,formData:s,url:l}=E(e,r,a),c=l.pathname+l.search,f={replace:a.replace,formData:s,formMethod:i,formEncType:u};t?(null==n&&y(!1),o.fetch(t,n,c,f)):o.navigate(c,f)}),[r,o,t,n])}function j(t="."){let n=e.useContext(f);n||y(!1);let[o]=n.matches.slice(-1),{pathname:r,search:i}=a(t);return"."===t&&o.route.index&&(i=i?i.replace(/^\?/,"?index&"):"?index"),r+i}let M=0;function U(){let t=e.useContext(c);t||y(!1);let n=e.useContext(f);n||y(!1);let o=n.matches[n.matches.length-1]?.route.id;null==o&&y(!1);let[r]=e.useState((()=>String(++M))),[a]=e.useState((()=>(o||y(!1),function(t,n){return e.forwardRef(((o,r)=>e.createElement(P,Object.assign({},o,{ref:r,fetcherKey:t,routeId:n}))))}(r,o)))),[i]=e.useState((()=>e=>{t||y(!1),o||y(!1),t.fetch(r,o,e)})),u=O(r,o),s=t.getFetcher(r),l=e.useMemo((()=>({Form:a,submit:u,load:i,...s})),[s,a,u,i]);return e.useEffect((()=>()=>{t?t.deleteFetcher(r):console.warn("No fetcher available to clean up from useFetcher()")}),[t,r]),l}function I(){let t=e.useContext(u);return t||y(!1),[...t.fetchers.values()]}let _={};export{C as BrowserRouter,R as DataBrowserRouter,S as DataHashRouter,N as Form,D as HashRouter,x as Link,L as NavLink,T as ScrollRestoration,v as createSearchParams,A as unstable_HistoryRouter,U as useFetcher,I as useFetchers,j as useFormAction,k as useLinkClickHandler,F as useSearchParams,K as useSubmit};
import*as e from"react";import{createRoutesFromChildren as t,UNSAFE_DataRouterProvider as n,UNSAFE_DataRouter as o,Router as a,useHref as r,createPath as i,useResolvedPath as l,useMatch as u,UNSAFE_DataRouterStateContext as c,useNavigate as s,useLocation as f,UNSAFE_DataRouterContext as m,UNSAFE_RouteContext as d}from"react-router";export{DataMemoryRouter,Deferred,MemoryRouter,Navigate,NavigationType,Outlet,Route,Router,Routes,UNSAFE_DataRouter,UNSAFE_DataRouterContext,UNSAFE_DataRouterProvider,UNSAFE_DataRouterStateContext,UNSAFE_DataStaticRouterContext,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,createPath,createRoutesFromChildren,deferred,generatePath,isDeferredError,isRouteErrorResponse,json,matchPath,matchRoutes,parsePath,redirect,renderMatches,resolvePath,useActionData,useDeferredData,useHref,useInRouterContext,useLoaderData,useLocation,useMatch,useMatches,useNavigate,useNavigation,useNavigationType,useOutlet,useOutletContext,useParams,useResolvedPath,useRevalidator,useRouteError,useRouteLoaderData,useRoutes}from"react-router";import{createBrowserRouter as h,createHashRouter as p,createBrowserHistory as g,createHashHistory as y,matchPath as w,invariant as b}from"@remix-run/router";const v="application/x-www-form-urlencoded";function E(e){return null!=e&&"string"==typeof e.tagName}function R(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let o=e[n];return t.concat(Array.isArray(o)?o.map((e=>[n,e])):[[n,o]])}),[]))}function S(e,t,n){let o,a,r,i;if(E(l=e)&&"form"===l.tagName.toLowerCase()){let l=n.submissionTrigger;o=n.method||e.getAttribute("method")||"get",a=n.action||e.getAttribute("action")||t,r=n.encType||e.getAttribute("enctype")||v,i=new FormData(e),l&&l.name&&i.append(l.name,l.value)}else if(function(e){return E(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return E(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let l=e.form;if(null==l)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');o=n.method||e.getAttribute("formmethod")||l.getAttribute("method")||"get",a=n.action||e.getAttribute("formaction")||l.getAttribute("action")||t,r=n.encType||e.getAttribute("formenctype")||l.getAttribute("enctype")||v,i=new FormData(l),e.name&&i.set(e.name,e.value)}else{if(E(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');if(o=n.method||"get",a=n.action||t,r=n.encType||v,e instanceof FormData)i=e;else if(i=new FormData,e instanceof URLSearchParams)for(let[t,n]of e)i.append(t,n);else if(null!=e)for(let t of Object.keys(e))i.append(t,e[t])}var l;let{protocol:u,host:c}=window.location;return{url:new URL(a,`${u}//${c}`),method:o,encType:r,formData:i}}let C;function D(){C=null}function A({basename:a,children:r,fallbackElement:i,hydrationData:l,routes:u,window:c}){C||(C=h({basename:a,hydrationData:l||window.__staticRouterHydrationData,window:c,routes:u||t(r)}).initialize());let s=C;return e.createElement(n,{router:s,basename:a,fallbackElement:i},e.createElement(o,null))}function x({basename:a,children:r,hydrationData:i,fallbackElement:l,routes:u,window:c}){C||(C=p({basename:a,hydrationData:i||window.__staticRouterHydrationData,window:c,routes:u||t(r)}).initialize());let s=C;return e.createElement(n,{router:s,basename:a,fallbackElement:l},e.createElement(o,null))}function N({basename:t,children:n,window:o}){let r=e.useRef();null==r.current&&(r.current=g({window:o,v5Compat:!0}));let i=r.current,[l,u]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(u)),[i]),e.createElement(a,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:i})}function L({basename:t,children:n,window:o}){let r=e.useRef();null==r.current&&(r.current=y({window:o,v5Compat:!0}));let i=r.current,[l,u]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(u)),[i]),e.createElement(a,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:i})}function P({basename:t,children:n,history:o}){const[r,i]=e.useState({action:o.action,location:o.location});return e.useLayoutEffect((()=>o.listen(i)),[o]),e.createElement(a,{basename:t,children:n,location:r.location,navigationType:r.action,navigator:o})}const F=e.forwardRef((function({onClick:t,reloadDocument:n,replace:o,state:a,target:i,to:l,resetScroll:u,...c},s){let f=r(l),m=O(l,{replace:o,state:a,target:i,resetScroll:u});return e.createElement("a",Object.assign({},c,{href:f,onClick:n?t:function(e){t&&t(e),e.defaultPrevented||m(e)},ref:s,target:i}))})),T=e.forwardRef((function({"aria-current":t="page",caseSensitive:n=!1,className:o="",end:a=!1,style:r,to:i,children:s,...f},m){let d,h=l(i),p=u({path:h.pathname,end:a,caseSensitive:n}),g=e.useContext(c)?.navigation.location,y=l(g||""),b=null!=e.useMemo((()=>g?w({path:h.pathname,end:a,caseSensitive:n},y.pathname):null),[g,h.pathname,n,a,y.pathname]),v=null!=p,E=v?t:void 0;d="function"==typeof o?o({isActive:v,isPending:b}):[o,v?"active":null,b?"pending":null].filter(Boolean).join(" ");let R="function"==typeof r?r({isActive:v,isPending:b}):r;return e.createElement(F,Object.assign({},f,{"aria-current":E,className:d,ref:m,style:R,to:i}),"function"==typeof s?s({isActive:v,isPending:b}):s)})),k=e.forwardRef(((t,n)=>e.createElement(_,Object.assign({},t,{ref:n})))),_=e.forwardRef((({reloadDocument:t,replace:n,method:o="get",action:a=".",onSubmit:r,fetcherKey:i,routeId:l,...u},c)=>{let s=M(i,l),f="get"===o.toLowerCase()?"get":"post",m=I(a);return e.createElement("form",Object.assign({ref:c,method:f,action:m,onSubmit:t?r:e=>{if(r&&r(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter;s(t||e.currentTarget,{method:o,replace:n})}},u))}));function K({getKey:t,storageKey:n}){return function({getKey:t,storageKey:n}={}){let o=f(),a=e.useContext(m);a||b(!1);let{router:r}=a,i=e.useContext(c);(null==r||null==i)&&b(!1);let{restoreScrollPosition:l,resetScrollPosition:u}=i;e.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),s=e.useCallback((()=>{if("idle"===i?.navigation.state){let e=(t?t(i.location,i.matches):null)||i.location.key;B[e]=window.scrollY}sessionStorage.setItem(n||"react-router-scroll-positions",JSON.stringify(B)),window.history.scrollRestoration="auto"}),[n,t,i.navigation.state,i.location,i.matches]),e.useEffect((()=>(window.addEventListener("beforeunload",s),()=>{window.removeEventListener("beforeunload",s)})),[s]),e.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(n||"react-router-scroll-positions");e&&(B=JSON.parse(e))}catch(e){}}),[n]),e.useLayoutEffect((()=>{let e=r?.enableScrollRestoration(B,(()=>window.scrollY),t);return()=>e&&e()}),[r,t]),e.useLayoutEffect((()=>{if(!1!==l)if("number"!=typeof l){if(o.hash){let e=document.getElementById(o.hash.slice(1));if(e)return void e.scrollIntoView()}!1!==u&&window.scrollTo(0,0)}else window.scrollTo(0,l)}),[o,l,u]);var s}({getKey:t,storageKey:n}),null}function O(t,{target:n,replace:o,state:a,resetScroll:r}={}){let u=s(),c=f(),m=l(t);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!==o?o:i(c)===i(m);u(t,{replace:n,state:a,resetScroll:r})}}),[c,u,m,o,a,n,t,r])}function U(t){let n=e.useRef(R(t)),o=f(),a=e.useMemo((()=>function(e,t){let n=R(e);for(let o of t.keys())n.has(o)||t.getAll(o).forEach((e=>{n.append(o,e)}));return n}(o.search,n.current)),[o.search]),r=s(),i=e.useCallback(((e,t)=>{const n=R("function"==typeof e?e(a):e);r("?"+n,t)}),[r,a]);return[a,i]}function j(){return M()}function M(t,n){let o=e.useContext(m);o||b(!1);let{router:a}=o,r=I();return e.useCallback(((e,o={})=>{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{method:i,encType:l,formData:u,url:c}=S(e,r,o),s=c.pathname+c.search,f={replace:o.replace,formData:u,formMethod:i,formEncType:l};t?(null==n&&b(!1),a.fetch(t,n,s,f)):a.navigate(s,f)}),[r,a,t,n])}function I(t="."){let n=e.useContext(d);n||b(!1);let[o]=n.matches.slice(-1),{pathname:a,search:r}=l(t);return"."===t&&o.route.index&&(r=r?r.replace(/^\?/,"?index&"):"?index"),a+r}let H=0;function Y(){let t=e.useContext(m);t||b(!1);let{router:n}=t,o=e.useContext(d);o||b(!1);let a=o.matches[o.matches.length-1]?.route.id;null==a&&b(!1);let[r]=e.useState((()=>String(++H))),[i]=e.useState((()=>(a||b(!1),function(t,n){return e.forwardRef(((o,a)=>e.createElement(_,Object.assign({},o,{ref:a,fetcherKey:t,routeId:n}))))}(r,a)))),[l]=e.useState((()=>e=>{n||b(!1),a||b(!1),n.fetch(r,a,e)})),u=M(r,a),c=n.getFetcher(r),s=e.useMemo((()=>({Form:i,submit:u,load:l,...c})),[c,i,u,l]);return e.useEffect((()=>()=>{n?n.deleteFetcher(r):console.warn("No fetcher available to clean up from useFetcher()")}),[n,r]),s}function z(){let t=e.useContext(c);return t||b(!1),[...t.fetchers.values()]}let B={};export{N as BrowserRouter,A as DataBrowserRouter,x as DataHashRouter,k as Form,L as HashRouter,F as Link,T as NavLink,K as ScrollRestoration,D as _resetModuleScope,R as createSearchParams,P as unstable_HistoryRouter,Y as useFetcher,z as useFetchers,I as useFormAction,O as useLinkClickHandler,U as useSearchParams,j as useSubmit};
//# sourceMappingURL=react-router-dom.production.min.js.map
import * as React from "react";
import type { RouterInit } from "@remix-run/router";
import { Location } from "react-router-dom";
import type { RouteObject, StaticHandlerContext } from "@remix-run/router";
import type { Location } from "react-router-dom";
export interface StaticRouterProps {

@@ -15,5 +15,6 @@ basename?: string;

export interface DataStaticRouterProps {
data: RouterInit["hydrationData"];
location: Partial<Location> | string;
children?: React.ReactNode;
context: StaticHandlerContext;
routes: RouteObject[];
hydrate?: boolean;
nonce?: string;
}

@@ -24,2 +25,2 @@ /**

*/
export declare function DataStaticRouter({ data, location, children, }: DataStaticRouterProps): JSX.Element;
export declare function unstable_DataStaticRouter({ context, routes, hydrate, nonce, }: DataStaticRouterProps): JSX.Element;

@@ -66,30 +66,44 @@ 'use strict';

function DataStaticRouter({
data,
location = "/",
children
function unstable_DataStaticRouter({
context,
routes,
hydrate = true,
nonce
}) {
// Create a router but do not call initialize() so it has no side effects
// and performs no data fetching
let staticRouter = router.createRouter({
history: router.createMemoryHistory({
initialEntries: [location]
}),
routes: reactRouterDom.createRoutesFromChildren(children),
hydrationData: data
});
!staticRouter.state.initialized ? process.env.NODE_ENV !== "production" ? router.invariant(false, "You must provide a complete `data` prop for <DataStaticRouter>") : router.invariant(false) : void 0;
let staticNavigator = getStatelessNavigator();
return /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_DataRouterContext.Provider, {
value: staticRouter
!(routes && context) ? process.env.NODE_ENV !== "production" ? router.invariant(false, "You must provide `routes` and `context` to <DataStaticRouter>") : router.invariant(false) : void 0;
let dataRouterContext = {
router: getStatelessRemixRouter(routes, context),
navigator: getStatelessNavigator(),
static: true,
basename: "/"
};
let hydrateScript = "";
if (hydrate !== false) {
let data = {
loaderData: context.loaderData,
actionData: context.actionData,
errors: context.errors
}; // Use JSON.parse here instead of embedding a raw JS object here to speed
// up parsing on the client. Dual-stringify is needed to ensure all quotes
// are properly escaped in the resulting string. See:
// https://v8.dev/blog/cost-of-javascript-2019#json
let json = JSON.stringify(JSON.stringify(data));
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
}
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_DataStaticRouterContext.Provider, {
value: context
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_DataRouterContext.Provider, {
value: dataRouterContext
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_DataRouterStateContext.Provider, {
value: staticRouter.state
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.Router, {
location: staticRouter.state.location,
navigationType: staticRouter.state.historyAction,
navigator: staticNavigator,
static: true
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.Routes, {
children: children
}))));
value: dataRouterContext.router.state
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_DataRouter, null)))), hydrateScript ? /*#__PURE__*/React__namespace.createElement("script", {
suppressHydrationWarning: true,
nonce: nonce,
dangerouslySetInnerHTML: {
__html: hydrateScript
}
}) : null);
}

@@ -126,3 +140,75 @@

exports.DataStaticRouter = DataStaticRouter;
function getStatelessRemixRouter(routes, context) {
let dataRoutes = router.UNSAFE_convertRoutesToDataRoutes(routes);
let msg = method => `You cannot use router.${method}() on the server because it is a stateless environment`;
return {
get state() {
return {
historyAction: router.Action.Pop,
location: context.location,
matches: context.matches,
loaderData: context.loaderData,
actionData: context.actionData,
errors: context.errors,
initialized: true,
navigation: router.IDLE_NAVIGATION,
restoreScrollPosition: null,
resetScrollPosition: true,
revalidation: "idle",
fetchers: new Map()
};
},
get routes() {
return dataRoutes;
},
initialize() {
throw msg("initialize");
},
subscribe() {
throw msg("subscribe");
},
enableScrollRestoration() {
throw msg("enableScrollRestoration");
},
navigate() {
throw msg("navigate");
},
fetch() {
throw msg("fetch");
},
revalidate() {
throw msg("revalidate");
},
createHref() {
throw msg("createHref");
},
getFetcher() {
return router.IDLE_FETCHER;
},
deleteFetcher() {
throw msg("deleteFetcher");
},
dispose() {
throw msg("dispose");
},
_internalFetchControllers: new Map(),
_internalActiveDeferreds: new Map()
};
}
exports.StaticRouter = StaticRouter;
exports.unstable_DataStaticRouter = unstable_DataStaticRouter;
/**
* React Router DOM v6.4.0-pre.9
* React Router DOM v6.4.0-pre.10
*

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

_excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "children"],
_excluded3 = ["replace", "method", "action", "onSubmit", "fetcherKey", "routeId"];
////////////////////////////////////////////////////////////////////////////////
_excluded3 = ["reloadDocument", "replace", "method", "action", "onSubmit", "fetcherKey", "routeId"];
// Module-scoped singleton to hold the router. Extracted from the React lifecycle
// to avoid issues w.r.t. dual initialization fetches in concurrent rendering.
// Data router apps are expected to have a static route tree and are not intended
// to be unmounted/remounted at runtime.
let routerSingleton;
/**
* Unit-testing-only function to reset the router between tests
* @private
*/
function _resetModuleScope() {
// @ts-expect-error
routerSingleton = null;
} ////////////////////////////////////////////////////////////////////////////////
//#region Components

@@ -223,16 +237,20 @@ ////////////////////////////////////////////////////////////////////////////////

routes,
window
window: windowProp
} = _ref;
return reactRouter.useRenderDataRouter({
basename,
children,
fallbackElement,
routes,
createRouter: routes => router.createBrowserRouter({
if (!routerSingleton) {
routerSingleton = router.createBrowserRouter({
basename,
routes,
hydrationData,
window
})
});
hydrationData: hydrationData || window.__staticRouterHydrationData,
window: windowProp,
routes: routes || reactRouter.createRoutesFromChildren(children)
}).initialize();
}
let router$1 = routerSingleton;
return /*#__PURE__*/React__namespace.createElement(reactRouter.UNSAFE_DataRouterProvider, {
router: router$1,
basename: basename,
fallbackElement: fallbackElement
}, /*#__PURE__*/React__namespace.createElement(reactRouter.UNSAFE_DataRouter, null));
}

@@ -246,16 +264,20 @@ function DataHashRouter(_ref2) {

routes,
window
window: windowProp
} = _ref2;
return reactRouter.useRenderDataRouter({
basename,
children,
fallbackElement,
routes,
createRouter: routes => router.createHashRouter({
if (!routerSingleton) {
routerSingleton = router.createHashRouter({
basename,
routes,
hydrationData,
window
})
});
hydrationData: hydrationData || window.__staticRouterHydrationData,
window: windowProp,
routes: routes || reactRouter.createRoutesFromChildren(children)
}).initialize();
}
let router$1 = routerSingleton;
return /*#__PURE__*/React__namespace.createElement(reactRouter.UNSAFE_DataRouterProvider, {
router: router$1,
basename: basename,
fallbackElement: fallbackElement
}, /*#__PURE__*/React__namespace.createElement(reactRouter.UNSAFE_DataRouter, null));
}

@@ -386,3 +408,3 @@

if (!event.defaultPrevented && !reloadDocument) {
if (!event.defaultPrevented) {
internalOnClick(event);

@@ -397,3 +419,3 @@ }

href: href,
onClick: handleClick,
onClick: reloadDocument ? onClick : handleClick,
ref: ref,

@@ -495,2 +517,3 @@ target: target

let {
reloadDocument,
replace,

@@ -524,3 +547,3 @@ method = defaultMethod,

action: formAction,
onSubmit: submitHandler
onSubmit: reloadDocument ? onSubmit : submitHandler
}, props));

@@ -614,3 +637,7 @@ });

function useSubmitImpl(fetcherKey, routeId) {
let router$1 = React__namespace.useContext(reactRouter.UNSAFE_DataRouterContext);
let dataRouterContext = React__namespace.useContext(reactRouter.UNSAFE_DataRouterContext);
!dataRouterContext ? router.invariant(false, "useSubmitImpl must be used within a Data Router") : void 0;
let {
router: router$1
} = dataRouterContext;
let defaultAction = useFormAction();

@@ -622,4 +649,2 @@ return React__namespace.useCallback(function (target, options) {

!(router$1 != null) ? router.invariant(false, "useSubmit() must be used within a <DataRouter>") : void 0;
if (typeof document === "undefined") {

@@ -697,4 +722,7 @@ throw new Error("You are calling submit during the server render. " + "Try calling submit within a `useEffect` or callback instead.");

let router$1 = React__namespace.useContext(reactRouter.UNSAFE_DataRouterContext);
!router$1 ? router.invariant(false, "useFetcher must be used within a DataRouter") : void 0;
let dataRouterContext = React__namespace.useContext(reactRouter.UNSAFE_DataRouterContext);
!dataRouterContext ? router.invariant(false, "useFetcher must be used within a Data Router") : void 0;
let {
router: router$1
} = dataRouterContext;
let route = React__namespace.useContext(reactRouter.UNSAFE_RouteContext);

@@ -743,3 +771,3 @@ !route ? router.invariant(false, "useFetcher must be used inside a RouteContext") : void 0;

let state = React__namespace.useContext(reactRouter.UNSAFE_DataRouterStateContext);
!state ? router.invariant(false, "useFetchers must be used within a DataRouter") : void 0;
!state ? router.invariant(false, "useFetchers must be used within a DataRouterStateContext") : void 0;
return [...state.fetchers.values()];

@@ -759,5 +787,9 @@ }

let location = reactRouter.useLocation();
let router$1 = React__namespace.useContext(reactRouter.UNSAFE_DataRouterContext);
let dataRouterContext = React__namespace.useContext(reactRouter.UNSAFE_DataRouterContext);
!dataRouterContext ? router.invariant(false, "useScrollRestoration must be used within a DataRouterContext") : void 0;
let {
router: router$1
} = dataRouterContext;
let state = React__namespace.useContext(reactRouter.UNSAFE_DataRouterStateContext);
!(router$1 != null && state != null) ? router.invariant(false, "useScrollRestoration must be used within a DataRouter") : void 0;
!(router$1 != null && state != null) ? router.invariant(false, "useScrollRestoration must be used within a DataRouterStateContext") : void 0;
let {

@@ -898,2 +930,6 @@ restoreScrollPosition,

});
Object.defineProperty(exports, 'UNSAFE_DataRouter', {
enumerable: true,
get: function () { return reactRouter.UNSAFE_DataRouter; }
});
Object.defineProperty(exports, 'UNSAFE_DataRouterContext', {

@@ -903,2 +939,6 @@ enumerable: true,

});
Object.defineProperty(exports, 'UNSAFE_DataRouterProvider', {
enumerable: true,
get: function () { return reactRouter.UNSAFE_DataRouterProvider; }
});
Object.defineProperty(exports, 'UNSAFE_DataRouterStateContext', {

@@ -908,2 +948,6 @@ enumerable: true,

});
Object.defineProperty(exports, 'UNSAFE_DataStaticRouterContext', {
enumerable: true,
get: function () { return reactRouter.UNSAFE_DataStaticRouterContext; }
});
Object.defineProperty(exports, 'UNSAFE_LocationContext', {

@@ -1029,6 +1073,2 @@ enumerable: true,

});
Object.defineProperty(exports, 'useRenderDataRouter', {
enumerable: true,
get: function () { return reactRouter.useRenderDataRouter; }
});
Object.defineProperty(exports, 'useResolvedPath', {

@@ -1062,2 +1102,3 @@ enumerable: true,

exports.ScrollRestoration = ScrollRestoration;
exports._resetModuleScope = _resetModuleScope;
exports.createSearchParams = createSearchParams;

@@ -1064,0 +1105,0 @@ exports.unstable_HistoryRouter = HistoryRouter;

/**
* React Router DOM v6.4.0-pre.9
* React Router DOM v6.4.0-pre.10
*

@@ -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.Router)}(this,(function(e,t,r,n){"use strict";function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=o(t);function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u.apply(this,arguments)}function i(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}const c="get",l="application/x-www-form-urlencoded";function s(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,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map((e=>[r,e])):[[r,n]])}),[]))}function d(e,t,r){let n,o,a,u;if(s(i=e)&&"form"===i.tagName.toLowerCase()){let i=r.submissionTrigger;n=r.method||e.getAttribute("method")||c,o=r.action||e.getAttribute("action")||t,a=r.encType||e.getAttribute("enctype")||l,u=new FormData(e),i&&i.name&&u.append(i.name,i.value)}else if(function(e){return s(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return s(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>');n=r.method||e.getAttribute("formmethod")||i.getAttribute("method")||c,o=r.action||e.getAttribute("formaction")||i.getAttribute("action")||t,a=r.encType||e.getAttribute("formenctype")||i.getAttribute("enctype")||l,u=new FormData(i),e.name&&u.set(e.name,e.value)}else{if(s(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');if(n=r.method||c,o=r.action||t,a=r.encType||l,e instanceof FormData)u=e;else if(u=new FormData,e instanceof URLSearchParams)for(let[t,r]of e)u.append(t,r);else if(null!=e)for(let t of Object.keys(e))u.append(t,e[t])}var i;let{protocol:f,host:d}=window.location;return{url:new URL(o,f+"//"+d),method:n,encType:a,formData:u}}const m=["onClick","reloadDocument","replace","state","target","to","resetScroll"],b=["aria-current","caseSensitive","className","end","style","to","children"],p=["replace","method","action","onSubmit","fetcherKey","routeId"];const y=a.forwardRef((function(e,t){let{onClick:n,reloadDocument:o,replace:c,state:l,target:s,to:f,resetScroll:d}=e,b=i(e,m),p=r.useHref(f),y=R(f,{replace:c,state:l,target:s,resetScroll:d});return a.createElement("a",u({},b,{href:p,onClick:function(e){n&&n(e),e.defaultPrevented||o||y(e)},ref:t,target:s}))})),g=a.forwardRef((function(e,t){let o,{"aria-current":c="page",caseSensitive:l=!1,className:s="",end:f=!1,style:d,to:m,children:p}=e,g=i(e,b),h=r.useResolvedPath(m),v=r.useMatch({path:h.pathname,end:f,caseSensitive:l}),R=a.useContext(r.UNSAFE_DataRouterStateContext),P=null==R?void 0:R.navigation.location,O=r.useResolvedPath(P||""),w=null!=a.useMemo((()=>P?n.matchPath({path:h.pathname,end:f,caseSensitive:l},O.pathname):null),[P,h.pathname,l,f,O.pathname]),j=null!=v,E=j?c:void 0;o="function"==typeof s?s({isActive:j,isPending:w}):[s,j?"active":null,w?"pending":null].filter(Boolean).join(" ");let S="function"==typeof d?d({isActive:j,isPending:w}):d;return a.createElement(y,u({},g,{"aria-current":E,className:o,ref:t,style:S,to:m}),"function"==typeof p?p({isActive:j,isPending:w}):p)})),h=a.forwardRef(((e,t)=>a.createElement(v,u({},e,{ref:t})))),v=a.forwardRef(((e,t)=>{let{replace:r,method:n=c,action:o=".",onSubmit:l,fetcherKey:s,routeId:f}=e,d=i(e,p),m=P(s,f),b="get"===n.toLowerCase()?"get":"post",y=O(o);return a.createElement("form",u({ref:t,method:b,action:y,onSubmit:e=>{if(l&&l(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter;m(t||e.currentTarget,{method:n,replace:r})}},d))}));function R(e,t){let{target:n,replace:o,state:u,resetScroll:i}=void 0===t?{}:t,c=r.useNavigate(),l=r.useLocation(),s=r.useResolvedPath(e);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,n)){t.preventDefault();let n=void 0!==o?o:r.createPath(l)===r.createPath(s);c(e,{replace:n,state:u,resetScroll:i})}}),[l,c,s,o,u,n,e,i])}function P(e,t){let o=a.useContext(r.UNSAFE_DataRouterContext),u=O();return a.useCallback((function(r,a){if(void 0===a&&(a={}),null==o&&n.invariant(!1),"undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");let{method:i,encType:c,formData:l,url:s}=d(r,u,a),f=s.pathname+s.search,m={replace:a.replace,formData:l,formMethod:i,formEncType:c};e?(null==t&&n.invariant(!1),o.fetch(e,t,f,m)):o.navigate(f,m)}),[u,o,e,t])}function O(e){void 0===e&&(e=".");let t=a.useContext(r.UNSAFE_RouteContext);t||n.invariant(!1);let[o]=t.matches.slice(-1),{pathname:u,search:i}=r.useResolvedPath(e);return"."===e&&o.route.index&&(i=i?i.replace(/^\?/,"?index&"):"?index"),u+i}let w=0;const j="react-router-scroll-positions";let E={};Object.defineProperty(e,"DataMemoryRouter",{enumerable:!0,get:function(){return r.DataMemoryRouter}}),Object.defineProperty(e,"Deferred",{enumerable:!0,get:function(){return r.Deferred}}),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,"createPath",{enumerable:!0,get:function(){return r.createPath}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return r.createRoutesFromChildren}}),Object.defineProperty(e,"deferred",{enumerable:!0,get:function(){return r.deferred}}),Object.defineProperty(e,"generatePath",{enumerable:!0,get:function(){return r.generatePath}}),Object.defineProperty(e,"isDeferredError",{enumerable:!0,get:function(){return r.isDeferredError}}),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,"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,"useDeferredData",{enumerable:!0,get:function(){return r.useDeferredData}}),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,"useRenderDataRouter",{enumerable:!0,get:function(){return r.useRenderDataRouter}}),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}}),e.BrowserRouter=function(e){let{basename:t,children:o,window:u}=e,i=a.useRef();null==i.current&&(i.current=n.createBrowserHistory({window:u,v5Compat:!0}));let c=i.current,[l,s]=a.useState({action:c.action,location:c.location});return a.useLayoutEffect((()=>c.listen(s)),[c]),a.createElement(r.Router,{basename:t,children:o,location:l.location,navigationType:l.action,navigator:c})},e.DataBrowserRouter=function(e){let{basename:t,children:o,fallbackElement:a,hydrationData:u,routes:i,window:c}=e;return r.useRenderDataRouter({basename:t,children:o,fallbackElement:a,routes:i,createRouter:e=>n.createBrowserRouter({basename:t,routes:e,hydrationData:u,window:c})})},e.DataHashRouter=function(e){let{basename:t,children:o,hydrationData:a,fallbackElement:u,routes:i,window:c}=e;return r.useRenderDataRouter({basename:t,children:o,fallbackElement:u,routes:i,createRouter:e=>n.createHashRouter({basename:t,routes:e,hydrationData:a,window:c})})},e.Form=h,e.HashRouter=function(e){let{basename:t,children:o,window:u}=e,i=a.useRef();null==i.current&&(i.current=n.createHashHistory({window:u,v5Compat:!0}));let c=i.current,[l,s]=a.useState({action:c.action,location:c.location});return a.useLayoutEffect((()=>c.listen(s)),[c]),a.createElement(r.Router,{basename:t,children:o,location:l.location,navigationType:l.action,navigator:c})},e.Link=y,e.NavLink=g,e.ScrollRestoration=function(e){let{getKey:t,storageKey:o}=e;return function(e){let{getKey:t,storageKey:o}=void 0===e?{}:e,u=r.useLocation(),i=a.useContext(r.UNSAFE_DataRouterContext),c=a.useContext(r.UNSAFE_DataRouterStateContext);(null==i||null==c)&&n.invariant(!1);let{restoreScrollPosition:l,resetScrollPosition:s}=c;a.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),f=a.useCallback((()=>{if("idle"===(null==c?void 0:c.navigation.state)){let e=(t?t(c.location,c.matches):null)||c.location.key;E[e]=window.scrollY}sessionStorage.setItem(o||j,JSON.stringify(E)),window.history.scrollRestoration="auto"}),[o,t,c.navigation.state,c.location,c.matches]),a.useEffect((()=>(window.addEventListener("beforeunload",f),()=>{window.removeEventListener("beforeunload",f)})),[f]),a.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(o||j);e&&(E=JSON.parse(e))}catch(e){}}),[o]),a.useLayoutEffect((()=>{let e=null==i?void 0:i.enableScrollRestoration(E,(()=>window.scrollY),t);return()=>e&&e()}),[i,t]),a.useLayoutEffect((()=>{if(!1!==l)if("number"!=typeof l){if(u.hash){let e=document.getElementById(u.hash.slice(1));if(e)return void e.scrollIntoView()}!1!==s&&window.scrollTo(0,0)}else window.scrollTo(0,l)}),[u,l,s]);var f}({getKey:t,storageKey:o}),null},e.createSearchParams=f,e.unstable_HistoryRouter=function(e){let{basename:t,children:n,history:o}=e;const[u,i]=a.useState({action:o.action,location:o.location});return a.useLayoutEffect((()=>o.listen(i)),[o]),a.createElement(r.Router,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:o})},e.useFetcher=function(){var e;let t=a.useContext(r.UNSAFE_DataRouterContext);t||n.invariant(!1);let o=a.useContext(r.UNSAFE_RouteContext);o||n.invariant(!1);let i=null==(e=o.matches[o.matches.length-1])?void 0:e.route.id;null==i&&n.invariant(!1);let[c]=a.useState((()=>String(++w))),[l]=a.useState((()=>(i||n.invariant(!1),function(e,t){return a.forwardRef(((r,n)=>a.createElement(v,u({},r,{ref:n,fetcherKey:e,routeId:t}))))}(c,i)))),[s]=a.useState((()=>e=>{t||n.invariant(!1),i||n.invariant(!1),t.fetch(c,i,e)})),f=P(c,i),d=t.getFetcher(c),m=a.useMemo((()=>u({Form:l,submit:f,load:s},d)),[d,l,f,s]);return a.useEffect((()=>()=>{t?t.deleteFetcher(c):console.warn("No fetcher available to clean up from useFetcher()")}),[t,c]),m},e.useFetchers=function(){let e=a.useContext(r.UNSAFE_DataRouterStateContext);return e||n.invariant(!1),[...e.fetchers.values()]},e.useFormAction=O,e.useLinkClickHandler=R,e.useSearchParams=function(e){let t=a.useRef(f(e)),n=r.useLocation(),o=a.useMemo((()=>function(e,t){let r=f(e);for(let e of t.keys())r.has(e)||t.getAll(e).forEach((t=>{r.append(e,t)}));return r}(n.search,t.current)),[n.search]),u=r.useNavigate(),i=a.useCallback(((e,t)=>{const r=f("function"==typeof e?e(o):e);u("?"+r,t)}),[u,o]);return[o,i]},e.useSubmit=function(){return P()},Object.defineProperty(e,"__esModule",{value:!0})}));
!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.Router)}(this,(function(e,t,r,n){"use strict";function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=o(t);function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u.apply(this,arguments)}function i(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}const c="get",l="application/x-www-form-urlencoded";function s(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,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map((e=>[r,e])):[[r,n]])}),[]))}function d(e,t,r){let n,o,a,u;if(s(i=e)&&"form"===i.tagName.toLowerCase()){let i=r.submissionTrigger;n=r.method||e.getAttribute("method")||c,o=r.action||e.getAttribute("action")||t,a=r.encType||e.getAttribute("enctype")||l,u=new FormData(e),i&&i.name&&u.append(i.name,i.value)}else if(function(e){return s(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return s(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>');n=r.method||e.getAttribute("formmethod")||i.getAttribute("method")||c,o=r.action||e.getAttribute("formaction")||i.getAttribute("action")||t,a=r.encType||e.getAttribute("formenctype")||i.getAttribute("enctype")||l,u=new FormData(i),e.name&&u.set(e.name,e.value)}else{if(s(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');if(n=r.method||c,o=r.action||t,a=r.encType||l,e instanceof FormData)u=e;else if(u=new FormData,e instanceof URLSearchParams)for(let[t,r]of e)u.append(t,r);else if(null!=e)for(let t of Object.keys(e))u.append(t,e[t])}var i;let{protocol:f,host:d}=window.location;return{url:new URL(o,f+"//"+d),method:n,encType:a,formData:u}}const m=["onClick","reloadDocument","replace","state","target","to","resetScroll"],b=["aria-current","caseSensitive","className","end","style","to","children"],p=["reloadDocument","replace","method","action","onSubmit","fetcherKey","routeId"];let y;const g=a.forwardRef((function(e,t){let{onClick:n,reloadDocument:o,replace:c,state:l,target:s,to:f,resetScroll:d}=e,b=i(e,m),p=r.useHref(f),y=P(f,{replace:c,state:l,target:s,resetScroll:d});return a.createElement("a",u({},b,{href:p,onClick:o?n:function(e){n&&n(e),e.defaultPrevented||y(e)},ref:t,target:s}))})),h=a.forwardRef((function(e,t){let o,{"aria-current":c="page",caseSensitive:l=!1,className:s="",end:f=!1,style:d,to:m,children:p}=e,y=i(e,b),h=r.useResolvedPath(m),v=r.useMatch({path:h.pathname,end:f,caseSensitive:l}),R=a.useContext(r.UNSAFE_DataRouterStateContext),P=null==R?void 0:R.navigation.location,w=r.useResolvedPath(P||""),O=null!=a.useMemo((()=>P?n.matchPath({path:h.pathname,end:f,caseSensitive:l},w.pathname):null),[P,h.pathname,l,f,w.pathname]),E=null!=v,S=E?c:void 0;o="function"==typeof s?s({isActive:E,isPending:O}):[s,E?"active":null,O?"pending":null].filter(Boolean).join(" ");let j="function"==typeof d?d({isActive:E,isPending:O}):d;return a.createElement(g,u({},y,{"aria-current":S,className:o,ref:t,style:j,to:m}),"function"==typeof p?p({isActive:E,isPending:O}):p)})),v=a.forwardRef(((e,t)=>a.createElement(R,u({},e,{ref:t})))),R=a.forwardRef(((e,t)=>{let{reloadDocument:r,replace:n,method:o=c,action:l=".",onSubmit:s,fetcherKey:f,routeId:d}=e,m=i(e,p),b=w(f,d),y="get"===o.toLowerCase()?"get":"post",g=O(l);return a.createElement("form",u({ref:t,method:y,action:g,onSubmit:r?s:e=>{if(s&&s(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter;b(t||e.currentTarget,{method:o,replace:n})}},m))}));function P(e,t){let{target:n,replace:o,state:u,resetScroll:i}=void 0===t?{}:t,c=r.useNavigate(),l=r.useLocation(),s=r.useResolvedPath(e);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,n)){t.preventDefault();let n=void 0!==o?o:r.createPath(l)===r.createPath(s);c(e,{replace:n,state:u,resetScroll:i})}}),[l,c,s,o,u,n,e,i])}function w(e,t){let o=a.useContext(r.UNSAFE_DataRouterContext);o||n.invariant(!1);let{router:u}=o,i=O();return a.useCallback((function(r,o){if(void 0===o&&(o={}),"undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");let{method:a,encType:c,formData:l,url:s}=d(r,i,o),f=s.pathname+s.search,m={replace:o.replace,formData:l,formMethod:a,formEncType:c};e?(null==t&&n.invariant(!1),u.fetch(e,t,f,m)):u.navigate(f,m)}),[i,u,e,t])}function O(e){void 0===e&&(e=".");let t=a.useContext(r.UNSAFE_RouteContext);t||n.invariant(!1);let[o]=t.matches.slice(-1),{pathname:u,search:i}=r.useResolvedPath(e);return"."===e&&o.route.index&&(i=i?i.replace(/^\?/,"?index&"):"?index"),u+i}let E=0;const S="react-router-scroll-positions";let j={};Object.defineProperty(e,"DataMemoryRouter",{enumerable:!0,get:function(){return r.DataMemoryRouter}}),Object.defineProperty(e,"Deferred",{enumerable:!0,get:function(){return r.Deferred}}),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_DataRouter",{enumerable:!0,get:function(){return r.UNSAFE_DataRouter}}),Object.defineProperty(e,"UNSAFE_DataRouterContext",{enumerable:!0,get:function(){return r.UNSAFE_DataRouterContext}}),Object.defineProperty(e,"UNSAFE_DataRouterProvider",{enumerable:!0,get:function(){return r.UNSAFE_DataRouterProvider}}),Object.defineProperty(e,"UNSAFE_DataRouterStateContext",{enumerable:!0,get:function(){return r.UNSAFE_DataRouterStateContext}}),Object.defineProperty(e,"UNSAFE_DataStaticRouterContext",{enumerable:!0,get:function(){return r.UNSAFE_DataStaticRouterContext}}),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,"createPath",{enumerable:!0,get:function(){return r.createPath}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return r.createRoutesFromChildren}}),Object.defineProperty(e,"deferred",{enumerable:!0,get:function(){return r.deferred}}),Object.defineProperty(e,"generatePath",{enumerable:!0,get:function(){return r.generatePath}}),Object.defineProperty(e,"isDeferredError",{enumerable:!0,get:function(){return r.isDeferredError}}),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,"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,"useDeferredData",{enumerable:!0,get:function(){return r.useDeferredData}}),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}}),e.BrowserRouter=function(e){let{basename:t,children:o,window:u}=e,i=a.useRef();null==i.current&&(i.current=n.createBrowserHistory({window:u,v5Compat:!0}));let c=i.current,[l,s]=a.useState({action:c.action,location:c.location});return a.useLayoutEffect((()=>c.listen(s)),[c]),a.createElement(r.Router,{basename:t,children:o,location:l.location,navigationType:l.action,navigator:c})},e.DataBrowserRouter=function(e){let{basename:t,children:o,fallbackElement:u,hydrationData:i,routes:c,window:l}=e;y||(y=n.createBrowserRouter({basename:t,hydrationData:i||window.__staticRouterHydrationData,window:l,routes:c||r.createRoutesFromChildren(o)}).initialize());let s=y;return a.createElement(r.UNSAFE_DataRouterProvider,{router:s,basename:t,fallbackElement:u},a.createElement(r.UNSAFE_DataRouter,null))},e.DataHashRouter=function(e){let{basename:t,children:o,hydrationData:u,fallbackElement:i,routes:c,window:l}=e;y||(y=n.createHashRouter({basename:t,hydrationData:u||window.__staticRouterHydrationData,window:l,routes:c||r.createRoutesFromChildren(o)}).initialize());let s=y;return a.createElement(r.UNSAFE_DataRouterProvider,{router:s,basename:t,fallbackElement:i},a.createElement(r.UNSAFE_DataRouter,null))},e.Form=v,e.HashRouter=function(e){let{basename:t,children:o,window:u}=e,i=a.useRef();null==i.current&&(i.current=n.createHashHistory({window:u,v5Compat:!0}));let c=i.current,[l,s]=a.useState({action:c.action,location:c.location});return a.useLayoutEffect((()=>c.listen(s)),[c]),a.createElement(r.Router,{basename:t,children:o,location:l.location,navigationType:l.action,navigator:c})},e.Link=g,e.NavLink=h,e.ScrollRestoration=function(e){let{getKey:t,storageKey:o}=e;return function(e){let{getKey:t,storageKey:o}=void 0===e?{}:e,u=r.useLocation(),i=a.useContext(r.UNSAFE_DataRouterContext);i||n.invariant(!1);let{router:c}=i,l=a.useContext(r.UNSAFE_DataRouterStateContext);(null==c||null==l)&&n.invariant(!1);let{restoreScrollPosition:s,resetScrollPosition:f}=l;a.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),d=a.useCallback((()=>{if("idle"===(null==l?void 0:l.navigation.state)){let e=(t?t(l.location,l.matches):null)||l.location.key;j[e]=window.scrollY}sessionStorage.setItem(o||S,JSON.stringify(j)),window.history.scrollRestoration="auto"}),[o,t,l.navigation.state,l.location,l.matches]),a.useEffect((()=>(window.addEventListener("beforeunload",d),()=>{window.removeEventListener("beforeunload",d)})),[d]),a.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(o||S);e&&(j=JSON.parse(e))}catch(e){}}),[o]),a.useLayoutEffect((()=>{let e=null==c?void 0:c.enableScrollRestoration(j,(()=>window.scrollY),t);return()=>e&&e()}),[c,t]),a.useLayoutEffect((()=>{if(!1!==s)if("number"!=typeof s){if(u.hash){let e=document.getElementById(u.hash.slice(1));if(e)return void e.scrollIntoView()}!1!==f&&window.scrollTo(0,0)}else window.scrollTo(0,s)}),[u,s,f]);var d}({getKey:t,storageKey:o}),null},e._resetModuleScope=function(){y=null},e.createSearchParams=f,e.unstable_HistoryRouter=function(e){let{basename:t,children:n,history:o}=e;const[u,i]=a.useState({action:o.action,location:o.location});return a.useLayoutEffect((()=>o.listen(i)),[o]),a.createElement(r.Router,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:o})},e.useFetcher=function(){var e;let t=a.useContext(r.UNSAFE_DataRouterContext);t||n.invariant(!1);let{router:o}=t,i=a.useContext(r.UNSAFE_RouteContext);i||n.invariant(!1);let c=null==(e=i.matches[i.matches.length-1])?void 0:e.route.id;null==c&&n.invariant(!1);let[l]=a.useState((()=>String(++E))),[s]=a.useState((()=>(c||n.invariant(!1),function(e,t){return a.forwardRef(((r,n)=>a.createElement(R,u({},r,{ref:n,fetcherKey:e,routeId:t}))))}(l,c)))),[f]=a.useState((()=>e=>{o||n.invariant(!1),c||n.invariant(!1),o.fetch(l,c,e)})),d=w(l,c),m=o.getFetcher(l),b=a.useMemo((()=>u({Form:s,submit:d,load:f},m)),[m,s,d,f]);return a.useEffect((()=>()=>{o?o.deleteFetcher(l):console.warn("No fetcher available to clean up from useFetcher()")}),[o,l]),b},e.useFetchers=function(){let e=a.useContext(r.UNSAFE_DataRouterStateContext);return e||n.invariant(!1),[...e.fetchers.values()]},e.useFormAction=O,e.useLinkClickHandler=P,e.useSearchParams=function(e){let t=a.useRef(f(e)),n=r.useLocation(),o=a.useMemo((()=>function(e,t){let r=f(e);for(let e of t.keys())r.has(e)||t.getAll(e).forEach((t=>{r.append(e,t)}));return r}(n.search,t.current)),[n.search]),u=r.useNavigate(),i=a.useCallback(((e,t)=>{const r=f("function"==typeof e?e(o):e);u("?"+r,t)}),[u,o]);return[o,i]},e.useSubmit=function(){return w()},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=react-router-dom.production.min.js.map
{
"name": "react-router-dom",
"version": "6.4.0-pre.9",
"version": "6.4.0-pre.10",
"description": "Declarative routing for React web applications",

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

"dependencies": {
"react-router": "6.4.0-pre.9"
"react-router": "6.4.0-pre.10"
},

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

import * as React from "react";
import type { RouterInit } from "@remix-run/router";
import { Location } from "react-router-dom";
import type { RouteObject, StaticHandlerContext } from "@remix-run/router";
import type { Location } from "react-router-dom";
export interface StaticRouterProps {

@@ -15,5 +15,6 @@ basename?: string;

export interface DataStaticRouterProps {
data: RouterInit["hydrationData"];
location: Partial<Location> | string;
children?: React.ReactNode;
context: StaticHandlerContext;
routes: RouteObject[];
hydrate?: boolean;
nonce?: string;
}

@@ -24,2 +25,2 @@ /**

*/
export declare function DataStaticRouter({ data, location, children, }: DataStaticRouterProps): JSX.Element;
export declare function unstable_DataStaticRouter({ context, routes, hydrate, nonce, }: DataStaticRouterProps): JSX.Element;

@@ -66,30 +66,44 @@ 'use strict';

function DataStaticRouter({
data,
location = "/",
children
function unstable_DataStaticRouter({
context,
routes,
hydrate = true,
nonce
}) {
// Create a router but do not call initialize() so it has no side effects
// and performs no data fetching
let staticRouter = router.createRouter({
history: router.createMemoryHistory({
initialEntries: [location]
}),
routes: reactRouterDom.createRoutesFromChildren(children),
hydrationData: data
});
!staticRouter.state.initialized ? process.env.NODE_ENV !== "production" ? router.invariant(false, "You must provide a complete `data` prop for <DataStaticRouter>") : router.invariant(false) : void 0;
let staticNavigator = getStatelessNavigator();
return /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_DataRouterContext.Provider, {
value: staticRouter
!(routes && context) ? process.env.NODE_ENV !== "production" ? router.invariant(false, "You must provide `routes` and `context` to <DataStaticRouter>") : router.invariant(false) : void 0;
let dataRouterContext = {
router: getStatelessRemixRouter(routes, context),
navigator: getStatelessNavigator(),
static: true,
basename: "/"
};
let hydrateScript = "";
if (hydrate !== false) {
let data = {
loaderData: context.loaderData,
actionData: context.actionData,
errors: context.errors
}; // Use JSON.parse here instead of embedding a raw JS object here to speed
// up parsing on the client. Dual-stringify is needed to ensure all quotes
// are properly escaped in the resulting string. See:
// https://v8.dev/blog/cost-of-javascript-2019#json
let json = JSON.stringify(JSON.stringify(data));
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
}
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_DataStaticRouterContext.Provider, {
value: context
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_DataRouterContext.Provider, {
value: dataRouterContext
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_DataRouterStateContext.Provider, {
value: staticRouter.state
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.Router, {
location: staticRouter.state.location,
navigationType: staticRouter.state.historyAction,
navigator: staticNavigator,
static: true
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.Routes, {
children: children
}))));
value: dataRouterContext.router.state
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_DataRouter, null)))), hydrateScript ? /*#__PURE__*/React__namespace.createElement("script", {
suppressHydrationWarning: true,
nonce: nonce,
dangerouslySetInnerHTML: {
__html: hydrateScript
}
}) : null);
}

@@ -126,3 +140,75 @@

exports.DataStaticRouter = DataStaticRouter;
function getStatelessRemixRouter(routes, context) {
let dataRoutes = router.UNSAFE_convertRoutesToDataRoutes(routes);
let msg = method => `You cannot use router.${method}() on the server because it is a stateless environment`;
return {
get state() {
return {
historyAction: router.Action.Pop,
location: context.location,
matches: context.matches,
loaderData: context.loaderData,
actionData: context.actionData,
errors: context.errors,
initialized: true,
navigation: router.IDLE_NAVIGATION,
restoreScrollPosition: null,
resetScrollPosition: true,
revalidation: "idle",
fetchers: new Map()
};
},
get routes() {
return dataRoutes;
},
initialize() {
throw msg("initialize");
},
subscribe() {
throw msg("subscribe");
},
enableScrollRestoration() {
throw msg("enableScrollRestoration");
},
navigate() {
throw msg("navigate");
},
fetch() {
throw msg("fetch");
},
revalidate() {
throw msg("revalidate");
},
createHref() {
throw msg("createHref");
},
getFetcher() {
return router.IDLE_FETCHER;
},
deleteFetcher() {
throw msg("deleteFetcher");
},
dispose() {
throw msg("dispose");
},
_internalFetchControllers: new Map(),
_internalActiveDeferreds: new Map()
};
}
exports.StaticRouter = StaticRouter;
exports.unstable_DataStaticRouter = unstable_DataStaticRouter;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc