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.4 to 6.4.0-pre.5

8

CHANGELOG.md
# react-router-dom
## 6.4.0-pre.5
### Patch Changes
- Fix broken require for CJS builds
- Updated dependencies
- react-router@6.4.0-pre.5
## 6.4.0-pre.4

@@ -4,0 +12,0 @@

14

dist/index.d.ts

@@ -6,4 +6,4 @@ /**

import * as React from "react";
import type { To } from "react-router";
import type { Fetcher, FormMethod, History, HydrationState, GetScrollRestorationKeyFunction, RouteObject } from "@remix-run/router";
import type { NavigateOptions, To } from "react-router";
import type { Fetcher, FormMethod, GetScrollRestorationKeyFunction, History, HydrationState, RouteObject } from "@remix-run/router";
import type { SubmitOptions, ParamKeyValuePair, URLSearchParamsInit } from "./dom";

@@ -13,6 +13,6 @@ import { createSearchParams } from "./dom";

export { createSearchParams };
export type { ActionFunction, DataMemoryRouterProps, DataRouteMatch, Fetcher, Hash, IndexRouteProps, JsonFunction, LayoutRouteProps, LoaderFunction, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, OutletProps, Params, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RouteMatch, RouteObject, RouteProps, RouterProps, RoutesProps, Search, ShouldRevalidateFunction, To, } from "react-router";
export type { ActionFunction, DataMemoryRouterProps, DataRouteMatch, Fetcher, Hash, IndexRouteProps, JsonFunction, LayoutRouteProps, LoaderFunction, 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, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, createPath, createRoutesFromChildren, isRouteErrorResponse, generatePath, json, matchPath, matchRoutes, parsePath, redirect, renderMatches, resolvePath, useActionData, 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_NavigationContext, UNSAFE_LocationContext, UNSAFE_RouteContext, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_resetModuleScope, useRenderDataRouter, } from "react-router";
export interface DataBrowserRouterProps {

@@ -156,6 +156,4 @@ children?: React.ReactNode;

*/
export declare function useSearchParams(defaultInit?: URLSearchParamsInit): readonly [URLSearchParams, (nextInit: URLSearchParamsInit, navigateOptions?: {
replace?: boolean;
state?: any;
}) => void];
export declare function useSearchParams(defaultInit?: URLSearchParamsInit): [URLSearchParams, SetURLSearchParams];
declare type SetURLSearchParams = (nextInit?: URLSearchParamsInit | ((prev: URLSearchParams) => URLSearchParamsInit), navigateOpts?: NavigateOptions) => void;
/**

@@ -162,0 +160,0 @@ * Submits a HTML `<form>` to the server without reloading the page.

/**
* React Router DOM v6.4.0-pre.4
* React Router DOM v6.4.0-pre.5
*

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

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

@@ -564,4 +564,5 @@

let setSearchParams = React.useCallback((nextInit, navigateOptions) => {
navigate("?" + createSearchParams(nextInit), navigateOptions);
}, [navigate]);
const newSearchParams = createSearchParams(typeof nextInit === "function" ? nextInit(searchParams) : nextInit);
navigate("?" + newSearchParams, navigateOptions);
}, [navigate, searchParams]);
return [searchParams, setSearchParams];

@@ -568,0 +569,0 @@ }

/**
* React Router DOM v6.4.0-pre.4
* React Router DOM v6.4.0-pre.5
*

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

if (process.env.NODE_ENV === "production") {
module.exports = require("./dist/umd/react-router-dom.production.min.js");
module.exports = require("./umd/react-router-dom.production.min.js");
} else {
module.exports = require("./dist/umd/react-router-dom.development.js");
module.exports = require("./umd/react-router-dom.development.js");
}
/**
* React Router DOM v6.4.0-pre.4
* React Router DOM v6.4.0-pre.5
*

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

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

@@ -517,9 +517,7 @@

let setSearchParams = React.useCallback((nextInit, navigateOptions) => {
navigate("?" + createSearchParams(nextInit), navigateOptions);
}, [navigate]);
const newSearchParams = createSearchParams(typeof nextInit === "function" ? nextInit(searchParams) : nextInit);
navigate("?" + newSearchParams, navigateOptions);
}, [navigate, searchParams]);
return [searchParams, setSearchParams];
}
/**
* Submits a HTML `<form>` to the server without reloading the page.
*/

@@ -526,0 +524,0 @@ /**

/**
* React Router DOM v6.4.0-pre.4
* React Router DOM v6.4.0-pre.5
*

@@ -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 l,useLocation as c,UNSAFE_DataRouterContext as s,UNSAFE_RouteContext as f}from"react-router";export{DataMemoryRouter,MemoryRouter,Navigate,NavigationType,Outlet,Route,Router,Routes,UNSAFE_DataRouterContext,UNSAFE_DataRouterStateContext,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,createPath,createRoutesFromChildren,generatePath,isRouteErrorResponse,json,matchPath,matchRoutes,parsePath,redirect,renderMatches,resolvePath,useActionData,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 R(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:l,host:c}=window.location;return{url:new URL(r,`${l}//${c}`),method:o,encType:a,formData:i}}function E({children:e,fallbackElement:n,hydrationData:o,routes:r,window:a}){return t({children:e,fallbackElement:n,routes:r,createRouter:e=>m({routes:e,hydrationData:o,window:a})})}function S({children:e,hydrationData:n,fallbackElement:o,routes:r,window:a}){return t({children:e,fallbackElement:o,routes:r,createRouter:e=>d({routes:e,hydrationData:n,window:a})})}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,l]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(l)),[i]),e.createElement(n,{basename:t,children:o,location:u.location,navigationType:u.action,navigator:i})}function A({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,l]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(l)),[i]),e.createElement(n,{basename:t,children:o,location:u.location,navigationType:u.action,navigator:i})}function x({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 D=e.forwardRef((function({onClick:t,reloadDocument:n,replace:r,state:a,target:i,to:u,resetScroll:l,...c},s){let f=o(u),m=k(u,{replace:r,state:a,target:i,resetScroll:l});return e.createElement("a",Object.assign({},c,{href:f,onClick:function(e){t&&t(e),e.defaultPrevented||n||m(e)},ref:s,target:i}))})),L=e.forwardRef((function({"aria-current":t="page",caseSensitive:n=!1,className:o="",end:r=!1,style:l,to:c,children:s,...f},m){let d,h=a(c),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,R=v?t:void 0;d="function"==typeof o?o({isActive:v,isPending:b}):[o,v?"active":null,b?"pending":null].filter(Boolean).join(" ");let E="function"==typeof l?l({isActive:v,isPending:b}):l;return e.createElement(D,Object.assign({},f,{"aria-current":R,className:d,ref:m,style:E,to:c}),"function"==typeof s?s({isActive:v,isPending:b}):s)})),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,...i},u)=>{let l=O(a),c="get"===n.toLowerCase()?"get":"post",s=j(o);return e.createElement("form",Object.assign({ref:u,method:c,action:s,onSubmit:e=>{if(r&&r(e),e.defaultPrevented)return;e.preventDefault();let o=e.nativeEvent.submitter;l(o||e.currentTarget,{method:n,replace:t})}},i))}));function T({getKey:t,storageKey:n}){return function({getKey:t,storageKey:n}={}){let o=c(),r=e.useContext(s),a=e.useContext(u);(null==r||null==a)&&y(!1);let{restoreScrollPosition:i,resetScrollPosition:l}=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;I[e]=window.scrollY}sessionStorage.setItem(n||"react-router-scroll-positions",JSON.stringify(I)),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&&(I=JSON.parse(e))}catch(e){}}),[n]),e.useLayoutEffect((()=>{let e=r?.enableScrollRestoration(I,(()=>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!==l&&window.scrollTo(0,0)}else window.scrollTo(0,i)}),[o,i,l]);var f}({getKey:t,storageKey:n}),null}function k(t,{target:n,replace:o,state:i,resetScroll:u}={}){let s=l(),f=c(),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);s(t,{replace:n,state:i,resetScroll:u})}}),[f,s,m,o,i,n,t,u])}function F(t){let n=e.useRef(v(t)),o=c(),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=l();return[r,e.useCallback(((e,t)=>{a("?"+v(e),t)}),[a])]}function K(){return O()}function O(t){let n=e.useContext(s),o=j();return e.useCallback(((e,r={})=>{if(null==n&&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:a,encType:i,formData:u,url:l}=R(e,o,r),c=l.pathname+l.search,s={replace:null!=r.replace?!0===r.replace:"get"!==a,formData:u,formMethod:a,formEncType:i};t?n.fetch(t,c,s):n.navigate(c,s)}),[o,n,t])}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(s);t||y(!1);let[n]=e.useState((()=>String(++M))),[o]=e.useState((()=>function(t){return e.forwardRef(((n,o)=>e.createElement(P,Object.assign({},n,{ref:o,fetcherKey:t}))))}(n))),[r]=e.useState((()=>e=>{t||y(!1),t.fetch(n,e)})),a=O(n),i=t.getFetcher(n),u=e.useMemo((()=>({Form:o,submit:a,load:r,...i})),[i,o,a,r]);return e.useEffect((()=>()=>{t?t.deleteFetcher(n):console.warn("No fetcher available to clean up from useFetcher()")}),[t,n]),u}function _(){let t=e.useContext(u);return t||y(!1),[...t.fetchers.values()]}let I={};export{C as BrowserRouter,E as DataBrowserRouter,S as DataHashRouter,N as Form,A as HashRouter,D as Link,L as NavLink,T as ScrollRestoration,v as createSearchParams,x as unstable_HistoryRouter,U as useFetcher,_ as useFetchers,j as useFormAction,k as useLinkClickHandler,F as useSearchParams,K as useSubmit};
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 l,useLocation as c,UNSAFE_DataRouterContext as s,UNSAFE_RouteContext as f}from"react-router";export{DataMemoryRouter,MemoryRouter,Navigate,NavigationType,Outlet,Route,Router,Routes,UNSAFE_DataRouterContext,UNSAFE_DataRouterStateContext,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,UNSAFE_resetModuleScope,createPath,createRoutesFromChildren,generatePath,isRouteErrorResponse,json,matchPath,matchRoutes,parsePath,redirect,renderMatches,resolvePath,useActionData,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:l,host:c}=window.location;return{url:new URL(r,`${l}//${c}`),method:o,encType:a,formData:i}}function R({children:e,fallbackElement:n,hydrationData:o,routes:r,window:a}){return t({children:e,fallbackElement:n,routes:r,createRouter:e=>m({routes:e,hydrationData:o,window:a})})}function S({children:e,hydrationData:n,fallbackElement:o,routes:r,window:a}){return t({children:e,fallbackElement:o,routes:r,createRouter:e=>d({routes:e,hydrationData:n,window:a})})}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,l]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(l)),[i]),e.createElement(n,{basename:t,children:o,location:u.location,navigationType:u.action,navigator:i})}function A({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,l]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(l)),[i]),e.createElement(n,{basename:t,children:o,location:u.location,navigationType:u.action,navigator:i})}function x({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 D=e.forwardRef((function({onClick:t,reloadDocument:n,replace:r,state:a,target:i,to:u,resetScroll:l,...c},s){let f=o(u),m=k(u,{replace:r,state:a,target:i,resetScroll:l});return e.createElement("a",Object.assign({},c,{href:f,onClick:function(e){t&&t(e),e.defaultPrevented||n||m(e)},ref:s,target:i}))})),N=e.forwardRef((function({"aria-current":t="page",caseSensitive:n=!1,className:o="",end:r=!1,style:l,to:c,children:s,...f},m){let d,h=a(c),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 l?l({isActive:v,isPending:b}):l;return e.createElement(D,Object.assign({},f,{"aria-current":E,className:d,ref:m,style:R,to:c}),"function"==typeof s?s({isActive:v,isPending:b}):s)})),L=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,...i},u)=>{let l=O(a),c="get"===n.toLowerCase()?"get":"post",s=M(o);return e.createElement("form",Object.assign({ref:u,method:c,action:s,onSubmit:e=>{if(r&&r(e),e.defaultPrevented)return;e.preventDefault();let o=e.nativeEvent.submitter;l(o||e.currentTarget,{method:n,replace:t})}},i))}));function T({getKey:t,storageKey:n}){return function({getKey:t,storageKey:n}={}){let o=c(),r=e.useContext(s),a=e.useContext(u);(null==r||null==a)&&y(!1);let{restoreScrollPosition:i,resetScrollPosition:l}=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;I[e]=window.scrollY}sessionStorage.setItem(n||"react-router-scroll-positions",JSON.stringify(I)),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&&(I=JSON.parse(e))}catch(e){}}),[n]),e.useLayoutEffect((()=>{let e=r?.enableScrollRestoration(I,(()=>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!==l&&window.scrollTo(0,0)}else window.scrollTo(0,i)}),[o,i,l]);var f}({getKey:t,storageKey:n}),null}function k(t,{target:n,replace:o,state:i,resetScroll:u}={}){let s=l(),f=c(),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);s(t,{replace:n,state:i,resetScroll:u})}}),[f,s,m,o,i,n,t,u])}function F(t){let n=e.useRef(v(t)),o=c(),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=l(),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){let n=e.useContext(s),o=M();return e.useCallback(((e,r={})=>{if(null==n&&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:a,encType:i,formData:u,url:l}=E(e,o,r),c=l.pathname+l.search,s={replace:null!=r.replace?!0===r.replace:"get"!==a,formData:u,formMethod:a,formEncType:i};t?n.fetch(t,c,s):n.navigate(c,s)}),[o,n,t])}function M(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 U=0;function j(){let t=e.useContext(s);t||y(!1);let[n]=e.useState((()=>String(++U))),[o]=e.useState((()=>function(t){return e.forwardRef(((n,o)=>e.createElement(P,Object.assign({},n,{ref:o,fetcherKey:t}))))}(n))),[r]=e.useState((()=>e=>{t||y(!1),t.fetch(n,e)})),a=O(n),i=t.getFetcher(n),u=e.useMemo((()=>({Form:o,submit:a,load:r,...i})),[i,o,a,r]);return e.useEffect((()=>()=>{t?t.deleteFetcher(n):console.warn("No fetcher available to clean up from useFetcher()")}),[t,n]),u}function _(){let t=e.useContext(u);return t||y(!1),[...t.fetchers.values()]}let I={};export{C as BrowserRouter,R as DataBrowserRouter,S as DataHashRouter,L as Form,A as HashRouter,D as Link,N as NavLink,T as ScrollRestoration,v as createSearchParams,x as unstable_HistoryRouter,j as useFetcher,_ as useFetchers,M as useFormAction,k as useLinkClickHandler,F as useSearchParams,K as useSubmit};
//# sourceMappingURL=react-router-dom.production.min.js.map
import * as React from "react";
import type { RouterInit } from "@remix-run/router";
import type { Location } from "react-router-dom";
import { Location } from "react-router-dom";
export interface StaticRouterProps {

@@ -5,0 +5,0 @@ basename?: string;

/**
* React Router DOM v6.4.0-pre.4
* React Router DOM v6.4.0-pre.5
*

@@ -585,9 +585,7 @@ * Copyright (c) Remix Software Inc.

let setSearchParams = React__namespace.useCallback((nextInit, navigateOptions) => {
navigate("?" + createSearchParams(nextInit), navigateOptions);
}, [navigate]);
const newSearchParams = createSearchParams(typeof nextInit === "function" ? nextInit(searchParams) : nextInit);
navigate("?" + newSearchParams, navigateOptions);
}, [navigate, searchParams]);
return [searchParams, setSearchParams];
}
/**
* Submits a HTML `<form>` to the server without reloading the page.
*/

@@ -888,2 +886,6 @@ /**

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

@@ -890,0 +892,0 @@ enumerable: true,

/**
* React Router DOM v6.4.0-pre.4
* React Router DOM v6.4.0-pre.5
*

@@ -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"];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=v(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),R=r.useMatch({path:h.pathname,end:f,caseSensitive:l}),v=a.useContext(r.UNSAFE_DataRouterStateContext),P=null==v?void 0:v.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]),j=null!=R,S=j?c:void 0;o="function"==typeof s?s({isActive:j,isPending:O}):[s,j?"active":null,O?"pending":null].filter(Boolean).join(" ");let E="function"==typeof d?d({isActive:j,isPending:O}):d;return a.createElement(y,u({},g,{"aria-current":S,className:o,ref:t,style:E,to:m}),"function"==typeof p?p({isActive:j,isPending:O}):p)})),h=a.forwardRef(((e,t)=>a.createElement(R,u({},e,{ref:t})))),R=a.forwardRef(((e,t)=>{let{replace:r,method:n=c,action:o=".",onSubmit:l,fetcherKey:s}=e,f=i(e,p),d=P(s),m="get"===n.toLowerCase()?"get":"post",b=w(o);return a.createElement("form",u({ref:t,method:m,action:b,onSubmit:e=>{if(l&&l(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter;d(t||e.currentTarget,{method:n,replace:r})}},f))}));function v(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){let t=a.useContext(r.UNSAFE_DataRouterContext),o=w();return a.useCallback((function(r,a){if(void 0===a&&(a={}),null==t&&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:u,encType:i,formData:c,url:l}=d(r,o,a),s=l.pathname+l.search,f={replace:null!=a.replace?!0===a.replace:"get"!==u,formData:c,formMethod:u,formEncType:i};e?t.fetch(e,s,f):t.navigate(s,f)}),[o,t,e])}function w(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 O=0;const j="react-router-scroll-positions";let S={};Object.defineProperty(e,"DataMemoryRouter",{enumerable:!0,get:function(){return r.DataMemoryRouter}}),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,"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,"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,"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{children:t,fallbackElement:o,hydrationData:a,routes:u,window:i}=e;return r.useRenderDataRouter({children:t,fallbackElement:o,routes:u,createRouter:e=>n.createBrowserRouter({routes:e,hydrationData:a,window:i})})},e.DataHashRouter=function(e){let{children:t,hydrationData:o,fallbackElement:a,routes:u,window:i}=e;return r.useRenderDataRouter({children:t,fallbackElement:a,routes:u,createRouter:e=>n.createHashRouter({routes:e,hydrationData:o,window:i})})},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;S[e]=window.scrollY}sessionStorage.setItem(o||j,JSON.stringify(S)),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&&(S=JSON.parse(e))}catch(e){}}),[o]),a.useLayoutEffect((()=>{let e=null==i?void 0:i.enableScrollRestoration(S,(()=>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(){let e=a.useContext(r.UNSAFE_DataRouterContext);e||n.invariant(!1);let[t]=a.useState((()=>String(++O))),[o]=a.useState((()=>function(e){return a.forwardRef(((t,r)=>a.createElement(R,u({},t,{ref:r,fetcherKey:e}))))}(t))),[i]=a.useState((()=>r=>{e||n.invariant(!1),e.fetch(t,r)})),c=P(t),l=e.getFetcher(t),s=a.useMemo((()=>u({Form:o,submit:c,load:i},l)),[l,o,c,i]);return a.useEffect((()=>()=>{e?e.deleteFetcher(t):console.warn("No fetcher available to clean up from useFetcher()")}),[e,t]),s},e.useFetchers=function(){let e=a.useContext(r.UNSAFE_DataRouterStateContext);return e||n.invariant(!1),[...e.fetchers.values()]},e.useFormAction=w,e.useLinkClickHandler=v,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();return[o,a.useCallback(((e,t)=>{u("?"+f(e),t)}),[u])]},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=["replace","method","action","onSubmit","fetcherKey"];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=v(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),R=r.useMatch({path:h.pathname,end:f,caseSensitive:l}),v=a.useContext(r.UNSAFE_DataRouterStateContext),P=null==v?void 0:v.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]),j=null!=R,S=j?c:void 0;o="function"==typeof s?s({isActive:j,isPending:O}):[s,j?"active":null,O?"pending":null].filter(Boolean).join(" ");let E="function"==typeof d?d({isActive:j,isPending:O}):d;return a.createElement(y,u({},g,{"aria-current":S,className:o,ref:t,style:E,to:m}),"function"==typeof p?p({isActive:j,isPending:O}):p)})),h=a.forwardRef(((e,t)=>a.createElement(R,u({},e,{ref:t})))),R=a.forwardRef(((e,t)=>{let{replace:r,method:n=c,action:o=".",onSubmit:l,fetcherKey:s}=e,f=i(e,p),d=P(s),m="get"===n.toLowerCase()?"get":"post",b=w(o);return a.createElement("form",u({ref:t,method:m,action:b,onSubmit:e=>{if(l&&l(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter;d(t||e.currentTarget,{method:n,replace:r})}},f))}));function v(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){let t=a.useContext(r.UNSAFE_DataRouterContext),o=w();return a.useCallback((function(r,a){if(void 0===a&&(a={}),null==t&&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:u,encType:i,formData:c,url:l}=d(r,o,a),s=l.pathname+l.search,f={replace:null!=a.replace?!0===a.replace:"get"!==u,formData:c,formMethod:u,formEncType:i};e?t.fetch(e,s,f):t.navigate(s,f)}),[o,t,e])}function w(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 O=0;const j="react-router-scroll-positions";let S={};Object.defineProperty(e,"DataMemoryRouter",{enumerable:!0,get:function(){return r.DataMemoryRouter}}),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_resetModuleScope",{enumerable:!0,get:function(){return r.UNSAFE_resetModuleScope}}),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,"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,"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,"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{children:t,fallbackElement:o,hydrationData:a,routes:u,window:i}=e;return r.useRenderDataRouter({children:t,fallbackElement:o,routes:u,createRouter:e=>n.createBrowserRouter({routes:e,hydrationData:a,window:i})})},e.DataHashRouter=function(e){let{children:t,hydrationData:o,fallbackElement:a,routes:u,window:i}=e;return r.useRenderDataRouter({children:t,fallbackElement:a,routes:u,createRouter:e=>n.createHashRouter({routes:e,hydrationData:o,window:i})})},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;S[e]=window.scrollY}sessionStorage.setItem(o||j,JSON.stringify(S)),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&&(S=JSON.parse(e))}catch(e){}}),[o]),a.useLayoutEffect((()=>{let e=null==i?void 0:i.enableScrollRestoration(S,(()=>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(){let e=a.useContext(r.UNSAFE_DataRouterContext);e||n.invariant(!1);let[t]=a.useState((()=>String(++O))),[o]=a.useState((()=>function(e){return a.forwardRef(((t,r)=>a.createElement(R,u({},t,{ref:r,fetcherKey:e}))))}(t))),[i]=a.useState((()=>r=>{e||n.invariant(!1),e.fetch(t,r)})),c=P(t),l=e.getFetcher(t),s=a.useMemo((()=>u({Form:o,submit:c,load:i},l)),[l,o,c,i]);return a.useEffect((()=>()=>{e?e.deleteFetcher(t):console.warn("No fetcher available to clean up from useFetcher()")}),[e,t]),s},e.useFetchers=function(){let e=a.useContext(r.UNSAFE_DataRouterStateContext);return e||n.invariant(!1),[...e.fetchers.values()]},e.useFormAction=w,e.useLinkClickHandler=v,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})}));
//# sourceMappingURL=react-router-dom.production.min.js.map
{
"name": "react-router-dom",
"version": "6.4.0-pre.4",
"version": "6.4.0-pre.5",
"description": "Declarative routing for React web applications",

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

"dependencies": {
"react-router": "6.4.0-pre.4"
"react-router": "6.4.0-pre.5"
},

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

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

@@ -5,0 +5,0 @@ basename?: string;

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