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.6.3-pre.0 to 6.7.0-pre.1

12

CHANGELOG.md
# `react-router-dom`
## 6.7.0-pre.1
### Minor Changes
- Add `preventScrollReset` prop to `<Form>` ([#9886](https://github.com/remix-run/react-router/pull/9886))
### Patch Changes
- Updated dependencies:
- `@remix-run/router@1.3.0-pre.1`
- `react-router@6.7.0-pre.1`
## 6.6.3-pre.0

@@ -4,0 +16,0 @@

@@ -66,2 +66,7 @@ import type { FormEncType, FormMethod } from "@remix-run/router";

relative?: RelativeRoutingType;
/**
* In browser-based environments, prevent resetting scroll after this
* navigation when using the <ScrollRestoration> component
*/
preventScrollReset?: boolean;
}

@@ -68,0 +73,0 @@ export declare function getFormSubmissionInfo(target: HTMLFormElement | HTMLButtonElement | HTMLInputElement | FormData | URLSearchParams | {

7

dist/index.d.ts

@@ -123,2 +123,7 @@ /**

/**
* Prevent the scroll position from resetting to the top of the viewport on
* completion of the navigation when using the <ScrollRestoration> component
*/
preventScrollReset?: boolean;
/**
* A function to call when the form is submitted. If you call

@@ -200,3 +205,3 @@ * `event.preventDefault()` then this form will not do anything.

Form: ReturnType<typeof createFetcherForm>;
submit: (target: SubmitTarget, options?: Omit<SubmitOptions, "replace">) => void;
submit: (target: SubmitTarget, options?: Omit<SubmitOptions, "replace" | "preventScrollReset">) => void;
load: (href: string) => void;

@@ -203,0 +208,0 @@ };

13

dist/index.js
/**
* React Router DOM v6.6.3-pre.0
* React Router DOM v6.7.0-pre.1
*

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

_excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "children"],
_excluded3 = ["reloadDocument", "replace", "method", "action", "onSubmit", "fetcherKey", "routeId", "relative"];
_excluded3 = ["reloadDocument", "replace", "method", "action", "onSubmit", "fetcherKey", "routeId", "relative", "preventScrollReset"];
//#region Routers

@@ -502,3 +502,4 @@ ////////////////////////////////////////////////////////////////////////////////

routeId,
relative
relative,
preventScrollReset
} = _ref6,

@@ -522,3 +523,4 @@ props = _objectWithoutPropertiesLoose(_ref6, _excluded3);

replace,
relative
relative,
preventScrollReset
});

@@ -678,2 +680,3 @@ };

replace: options.replace,
preventScrollReset: options.preventScrollReset,
formData,

@@ -899,3 +902,3 @@ formMethod: method,

}
} // Opt out of scroll reset if this link requested it
} // Don't reset if this navigation opted out

@@ -902,0 +905,0 @@

/**
* React Router DOM v6.6.3-pre.0
* React Router DOM v6.7.0-pre.1
*

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

/**
* React Router DOM v6.6.3-pre.0
* React Router DOM v6.7.0-pre.1
*

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

relative,
preventScrollReset,
...props

@@ -479,3 +480,4 @@ }, forwardedRef) => {

replace,
relative
relative,
preventScrollReset
});

@@ -628,2 +630,3 @@ };

replace: options.replace,
preventScrollReset: options.preventScrollReset,
formData,

@@ -846,3 +849,3 @@ formMethod: method,

}
} // Opt out of scroll reset if this link requested it
} // Don't reset if this navigation opted out

@@ -849,0 +852,0 @@

/**
* React Router DOM v6.6.3-pre.0
* React Router DOM v6.7.0-pre.1
*

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

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

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

_excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "children"],
_excluded3 = ["reloadDocument", "replace", "method", "action", "onSubmit", "fetcherKey", "routeId", "relative"];
_excluded3 = ["reloadDocument", "replace", "method", "action", "onSubmit", "fetcherKey", "routeId", "relative", "preventScrollReset"];

@@ -525,3 +525,4 @@ ////////////////////////////////////////////////////////////////////////////////

routeId,
relative
relative,
preventScrollReset
} = _ref6,

@@ -545,3 +546,4 @@ props = _objectWithoutPropertiesLoose(_ref6, _excluded3);

replace,
relative
relative,
preventScrollReset
});

@@ -700,2 +702,3 @@ };

replace: options.replace,
preventScrollReset: options.preventScrollReset,
formData,

@@ -921,3 +924,3 @@ formMethod: method,

}
} // Opt out of scroll reset if this link requested it
} // Don't reset if this navigation opted out

@@ -924,0 +927,0 @@

/**
* React Router DOM v6.6.3-pre.0
* React Router DOM v6.7.0-pre.1
*

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

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-router"),require("@remix-run/router")):"function"==typeof define&&define.amd?define(["exports","react","react-router","@remix-run/router"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactRouterDOM={},e.React,e.ReactRouter,e.RemixRouter)}(this,(function(e,t,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.append(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.toLowerCase(),encType:a,formData:u}}const m=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],b=["aria-current","caseSensitive","className","end","style","to","children"],p=["reloadDocument","replace","method","action","onSubmit","fetcherKey","routeId","relative"];function h(){var e;let t=null==(e=window)?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=u({},t,{errors:y(t.errors)})),t}function y(e){if(!e)return null;let t=Object.entries(e),r={};for(let[e,o]of t)if(o&&"RouteErrorResponse"===o.__type)r[e]=new n.ErrorResponse(o.status,o.statusText,o.data,!0===o.internal);else if(o&&"Error"===o.__type){let t=new Error(o.message);t.stack="",r[e]=t}else r[e]=o;return r}const g=a.forwardRef((function(e,t){let{onClick:n,relative:o,reloadDocument:c,replace:l,state:s,target:f,to:d,preventScrollReset:b}=e,p=i(e,m),h=r.useHref(d,{relative:o}),y=E(d,{replace:l,state:s,target:f,preventScrollReset:b,relative:o});return a.createElement("a",u({},p,{href:h,onClick:c?n:function(e){n&&n(e),e.defaultPrevented||y(e)},ref:t,target:f}))})),v=a.forwardRef((function(e,t){let{"aria-current":n="page",caseSensitive:o=!1,className:c="",end:l=!1,style:s,to:f,children:d}=e,m=i(e,b),p=r.useResolvedPath(f,{relative:m.relative}),h=r.useLocation(),y=a.useContext(r.UNSAFE_DataRouterStateContext),{navigator:v}=a.useContext(r.UNSAFE_NavigationContext),R=v.encodeLocation?v.encodeLocation(p).pathname:p.pathname,P=h.pathname,w=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;o||(P=P.toLowerCase(),w=w?w.toLowerCase():null,R=R.toLowerCase());let O,j=P===R||!l&&P.startsWith(R)&&"/"===P.charAt(R.length),S=null!=w&&(w===R||!l&&w.startsWith(R)&&"/"===w.charAt(R.length)),E=j?n:void 0;O="function"==typeof c?c({isActive:j,isPending:S}):[c,j?"active":null,S?"pending":null].filter(Boolean).join(" ");let A="function"==typeof s?s({isActive:j,isPending:S}):s;return a.createElement(g,u({},m,{"aria-current":E,className:O,ref:t,style:A,to:f}),"function"==typeof d?d({isActive:j,isPending:S}):d)})),R=a.forwardRef(((e,t)=>a.createElement(P,u({},e,{ref:t})))),P=a.forwardRef(((e,t)=>{let{reloadDocument:r,replace:n,method:o=c,action:l,onSubmit:s,fetcherKey:f,routeId:d,relative:m}=e,b=i(e,p),h=A(f,d),y="get"===o.toLowerCase()?"get":"post",g=C(l,{relative:m});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,r=(null==t?void 0:t.getAttribute("formmethod"))||o;h(t||e.currentTarget,{method:r,replace:n,relative:m})}},b))}));var w,O;function j(e){let t=a.useContext(r.UNSAFE_DataRouterContext);return t||n.invariant(!1),t}function S(e){let t=a.useContext(r.UNSAFE_DataRouterStateContext);return t||n.invariant(!1),t}function E(e,t){let{target:n,replace:o,state:u,preventScrollReset:i,relative:c}=void 0===t?{}:t,l=r.useNavigate(),s=r.useLocation(),f=r.useResolvedPath(e,{relative:c});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(s)===r.createPath(f);l(e,{replace:n,state:u,preventScrollReset:i,relative:c})}}),[s,l,f,o,u,n,e,i,c])}function A(e,t){let{router:r}=j(w.UseSubmitImpl),o=C();return a.useCallback((function(a,u){if(void 0===u&&(u={}),"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(a,o,u),f=s.pathname+s.search,m={replace:u.replace,formData:l,formMethod:i,formEncType:c};e?(null==t&&n.invariant(!1),r.fetch(e,t,f,m)):r.navigate(f,m)}),[o,r,e,t])}function C(e,t){let{relative:o}=void 0===t?{}:t,{basename:i}=a.useContext(r.UNSAFE_NavigationContext),c=a.useContext(r.UNSAFE_RouteContext);c||n.invariant(!1);let[l]=c.matches.slice(-1),s=u({},r.useResolvedPath(e||".",{relative:o})),f=r.useLocation();if(null==e&&(s.search=f.search,s.hash=f.hash,l.route.index)){let e=new URLSearchParams(s.search);e.delete("index"),s.search=e.toString()?"?"+e.toString():""}return e&&"."!==e||!l.route.index||(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),"/"!==i&&(s.pathname="/"===s.pathname?i:n.joinPaths([i,s.pathname])),r.createPath(s)}!function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmitImpl="useSubmitImpl",e.UseFetcher="useFetcher"}(w||(w={})),function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(O||(O={}));let N=0;const F="react-router-scroll-positions";let x={};function L(e){let{getKey:t,storageKey:n}=void 0===e?{}:e,{router:o}=j(w.UseScrollRestoration),{restoreScrollPosition:u,preventScrollReset:i}=S(O.UseScrollRestoration),c=r.useLocation(),l=r.useMatches(),s=r.useNavigation();a.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),U(a.useCallback((()=>{if("idle"===s.state){let e=(t?t(c,l):null)||c.key;x[e]=window.scrollY}sessionStorage.setItem(n||F,JSON.stringify(x)),window.history.scrollRestoration="auto"}),[n,t,s.state,c,l])),"undefined"!=typeof document&&(a.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(n||F);e&&(x=JSON.parse(e))}catch(e){}}),[n]),a.useLayoutEffect((()=>{let e=null==o?void 0:o.enableScrollRestoration(x,(()=>window.scrollY),t);return()=>e&&e()}),[o,t]),a.useLayoutEffect((()=>{if(!1!==u)if("number"!=typeof u){if(c.hash){let e=document.getElementById(c.hash.slice(1));if(e)return void e.scrollIntoView()}!0!==i&&window.scrollTo(0,0)}else window.scrollTo(0,u)}),[c,u,i]))}function U(e){a.useEffect((()=>(window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)})),[e])}Object.defineProperty(e,"AbortedDeferredError",{enumerable:!0,get:function(){return r.AbortedDeferredError}}),Object.defineProperty(e,"Await",{enumerable:!0,get:function(){return r.Await}}),Object.defineProperty(e,"MemoryRouter",{enumerable:!0,get:function(){return r.MemoryRouter}}),Object.defineProperty(e,"Navigate",{enumerable:!0,get:function(){return r.Navigate}}),Object.defineProperty(e,"NavigationType",{enumerable:!0,get:function(){return r.NavigationType}}),Object.defineProperty(e,"Outlet",{enumerable:!0,get:function(){return r.Outlet}}),Object.defineProperty(e,"Route",{enumerable:!0,get:function(){return r.Route}}),Object.defineProperty(e,"Router",{enumerable:!0,get:function(){return r.Router}}),Object.defineProperty(e,"RouterProvider",{enumerable:!0,get:function(){return r.RouterProvider}}),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_enhanceManualRouteObjects",{enumerable:!0,get:function(){return r.UNSAFE_enhanceManualRouteObjects}}),Object.defineProperty(e,"createMemoryRouter",{enumerable:!0,get:function(){return r.createMemoryRouter}}),Object.defineProperty(e,"createPath",{enumerable:!0,get:function(){return r.createPath}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return r.createRoutesFromChildren}}),Object.defineProperty(e,"createRoutesFromElements",{enumerable:!0,get:function(){return r.createRoutesFromElements}}),Object.defineProperty(e,"defer",{enumerable:!0,get:function(){return r.defer}}),Object.defineProperty(e,"generatePath",{enumerable:!0,get:function(){return r.generatePath}}),Object.defineProperty(e,"isRouteErrorResponse",{enumerable:!0,get:function(){return r.isRouteErrorResponse}}),Object.defineProperty(e,"json",{enumerable:!0,get:function(){return r.json}}),Object.defineProperty(e,"matchPath",{enumerable:!0,get:function(){return r.matchPath}}),Object.defineProperty(e,"matchRoutes",{enumerable:!0,get:function(){return r.matchRoutes}}),Object.defineProperty(e,"parsePath",{enumerable:!0,get:function(){return r.parsePath}}),Object.defineProperty(e,"redirect",{enumerable:!0,get:function(){return r.redirect}}),Object.defineProperty(e,"renderMatches",{enumerable:!0,get:function(){return r.renderMatches}}),Object.defineProperty(e,"resolvePath",{enumerable:!0,get:function(){return r.resolvePath}}),Object.defineProperty(e,"useActionData",{enumerable:!0,get:function(){return r.useActionData}}),Object.defineProperty(e,"useAsyncError",{enumerable:!0,get:function(){return r.useAsyncError}}),Object.defineProperty(e,"useAsyncValue",{enumerable:!0,get:function(){return r.useAsyncValue}}),Object.defineProperty(e,"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.Form=R,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=v,e.ScrollRestoration=function(e){let{getKey:t,storageKey:r}=e;return L({getKey:t,storageKey:r}),null},e.UNSAFE_useScrollRestoration=L,e.createBrowserRouter=function(e,t){return n.createRouter({basename:null==t?void 0:t.basename,history:n.createBrowserHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||h(),routes:r.UNSAFE_enhanceManualRouteObjects(e)}).initialize()},e.createHashRouter=function(e,t){return n.createRouter({basename:null==t?void 0:t.basename,history:n.createHashHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||h(),routes:r.UNSAFE_enhanceManualRouteObjects(e)}).initialize()},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.useBeforeUnload=U,e.useFetcher=function(){var e;let{router:t}=j(w.UseFetcher),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(++N))),[l]=a.useState((()=>(i||n.invariant(!1),function(e,t){return a.forwardRef(((r,n)=>a.createElement(P,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=A(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(){return[...S(O.UseFetchers).fetchers.values()]},e.useFormAction=C,e.useLinkClickHandler=E,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 A()},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.RemixRouter)}(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.append(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.toLowerCase(),encType:a,formData:u}}const m=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],b=["aria-current","caseSensitive","className","end","style","to","children"],p=["reloadDocument","replace","method","action","onSubmit","fetcherKey","routeId","relative","preventScrollReset"];function h(){var e;let t=null==(e=window)?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=u({},t,{errors:y(t.errors)})),t}function y(e){if(!e)return null;let t=Object.entries(e),r={};for(let[e,o]of t)if(o&&"RouteErrorResponse"===o.__type)r[e]=new n.ErrorResponse(o.status,o.statusText,o.data,!0===o.internal);else if(o&&"Error"===o.__type){let t=new Error(o.message);t.stack="",r[e]=t}else r[e]=o;return r}const g=a.forwardRef((function(e,t){let{onClick:n,relative:o,reloadDocument:c,replace:l,state:s,target:f,to:d,preventScrollReset:b}=e,p=i(e,m),h=r.useHref(d,{relative:o}),y=E(d,{replace:l,state:s,target:f,preventScrollReset:b,relative:o});return a.createElement("a",u({},p,{href:h,onClick:c?n:function(e){n&&n(e),e.defaultPrevented||y(e)},ref:t,target:f}))})),v=a.forwardRef((function(e,t){let{"aria-current":n="page",caseSensitive:o=!1,className:c="",end:l=!1,style:s,to:f,children:d}=e,m=i(e,b),p=r.useResolvedPath(f,{relative:m.relative}),h=r.useLocation(),y=a.useContext(r.UNSAFE_DataRouterStateContext),{navigator:v}=a.useContext(r.UNSAFE_NavigationContext),R=v.encodeLocation?v.encodeLocation(p).pathname:p.pathname,P=h.pathname,w=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;o||(P=P.toLowerCase(),w=w?w.toLowerCase():null,R=R.toLowerCase());let O,S=P===R||!l&&P.startsWith(R)&&"/"===P.charAt(R.length),j=null!=w&&(w===R||!l&&w.startsWith(R)&&"/"===w.charAt(R.length)),E=S?n:void 0;O="function"==typeof c?c({isActive:S,isPending:j}):[c,S?"active":null,j?"pending":null].filter(Boolean).join(" ");let A="function"==typeof s?s({isActive:S,isPending:j}):s;return a.createElement(g,u({},m,{"aria-current":E,className:O,ref:t,style:A,to:f}),"function"==typeof d?d({isActive:S,isPending:j}):d)})),R=a.forwardRef(((e,t)=>a.createElement(P,u({},e,{ref:t})))),P=a.forwardRef(((e,t)=>{let{reloadDocument:r,replace:n,method:o=c,action:l,onSubmit:s,fetcherKey:f,routeId:d,relative:m,preventScrollReset:b}=e,h=i(e,p),y=A(f,d),g="get"===o.toLowerCase()?"get":"post",v=C(l,{relative:m});return a.createElement("form",u({ref:t,method:g,action:v,onSubmit:r?s:e=>{if(s&&s(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter,r=(null==t?void 0:t.getAttribute("formmethod"))||o;y(t||e.currentTarget,{method:r,replace:n,relative:m,preventScrollReset:b})}},h))}));var w,O;function S(e){let t=a.useContext(r.UNSAFE_DataRouterContext);return t||n.invariant(!1),t}function j(e){let t=a.useContext(r.UNSAFE_DataRouterStateContext);return t||n.invariant(!1),t}function E(e,t){let{target:n,replace:o,state:u,preventScrollReset:i,relative:c}=void 0===t?{}:t,l=r.useNavigate(),s=r.useLocation(),f=r.useResolvedPath(e,{relative:c});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(s)===r.createPath(f);l(e,{replace:n,state:u,preventScrollReset:i,relative:c})}}),[s,l,f,o,u,n,e,i,c])}function A(e,t){let{router:r}=S(w.UseSubmitImpl),o=C();return a.useCallback((function(a,u){if(void 0===u&&(u={}),"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(a,o,u),f=s.pathname+s.search,m={replace:u.replace,preventScrollReset:u.preventScrollReset,formData:l,formMethod:i,formEncType:c};e?(null==t&&n.invariant(!1),r.fetch(e,t,f,m)):r.navigate(f,m)}),[o,r,e,t])}function C(e,t){let{relative:o}=void 0===t?{}:t,{basename:i}=a.useContext(r.UNSAFE_NavigationContext),c=a.useContext(r.UNSAFE_RouteContext);c||n.invariant(!1);let[l]=c.matches.slice(-1),s=u({},r.useResolvedPath(e||".",{relative:o})),f=r.useLocation();if(null==e&&(s.search=f.search,s.hash=f.hash,l.route.index)){let e=new URLSearchParams(s.search);e.delete("index"),s.search=e.toString()?"?"+e.toString():""}return e&&"."!==e||!l.route.index||(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),"/"!==i&&(s.pathname="/"===s.pathname?i:n.joinPaths([i,s.pathname])),r.createPath(s)}!function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmitImpl="useSubmitImpl",e.UseFetcher="useFetcher"}(w||(w={})),function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(O||(O={}));let N=0;const F="react-router-scroll-positions";let x={};function L(e){let{getKey:t,storageKey:n}=void 0===e?{}:e,{router:o}=S(w.UseScrollRestoration),{restoreScrollPosition:u,preventScrollReset:i}=j(O.UseScrollRestoration),c=r.useLocation(),l=r.useMatches(),s=r.useNavigation();a.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),U(a.useCallback((()=>{if("idle"===s.state){let e=(t?t(c,l):null)||c.key;x[e]=window.scrollY}sessionStorage.setItem(n||F,JSON.stringify(x)),window.history.scrollRestoration="auto"}),[n,t,s.state,c,l])),"undefined"!=typeof document&&(a.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(n||F);e&&(x=JSON.parse(e))}catch(e){}}),[n]),a.useLayoutEffect((()=>{let e=null==o?void 0:o.enableScrollRestoration(x,(()=>window.scrollY),t);return()=>e&&e()}),[o,t]),a.useLayoutEffect((()=>{if(!1!==u)if("number"!=typeof u){if(c.hash){let e=document.getElementById(c.hash.slice(1));if(e)return void e.scrollIntoView()}!0!==i&&window.scrollTo(0,0)}else window.scrollTo(0,u)}),[c,u,i]))}function U(e){a.useEffect((()=>(window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)})),[e])}Object.defineProperty(e,"AbortedDeferredError",{enumerable:!0,get:function(){return r.AbortedDeferredError}}),Object.defineProperty(e,"Await",{enumerable:!0,get:function(){return r.Await}}),Object.defineProperty(e,"MemoryRouter",{enumerable:!0,get:function(){return r.MemoryRouter}}),Object.defineProperty(e,"Navigate",{enumerable:!0,get:function(){return r.Navigate}}),Object.defineProperty(e,"NavigationType",{enumerable:!0,get:function(){return r.NavigationType}}),Object.defineProperty(e,"Outlet",{enumerable:!0,get:function(){return r.Outlet}}),Object.defineProperty(e,"Route",{enumerable:!0,get:function(){return r.Route}}),Object.defineProperty(e,"Router",{enumerable:!0,get:function(){return r.Router}}),Object.defineProperty(e,"RouterProvider",{enumerable:!0,get:function(){return r.RouterProvider}}),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_enhanceManualRouteObjects",{enumerable:!0,get:function(){return r.UNSAFE_enhanceManualRouteObjects}}),Object.defineProperty(e,"createMemoryRouter",{enumerable:!0,get:function(){return r.createMemoryRouter}}),Object.defineProperty(e,"createPath",{enumerable:!0,get:function(){return r.createPath}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return r.createRoutesFromChildren}}),Object.defineProperty(e,"createRoutesFromElements",{enumerable:!0,get:function(){return r.createRoutesFromElements}}),Object.defineProperty(e,"defer",{enumerable:!0,get:function(){return r.defer}}),Object.defineProperty(e,"generatePath",{enumerable:!0,get:function(){return r.generatePath}}),Object.defineProperty(e,"isRouteErrorResponse",{enumerable:!0,get:function(){return r.isRouteErrorResponse}}),Object.defineProperty(e,"json",{enumerable:!0,get:function(){return r.json}}),Object.defineProperty(e,"matchPath",{enumerable:!0,get:function(){return r.matchPath}}),Object.defineProperty(e,"matchRoutes",{enumerable:!0,get:function(){return r.matchRoutes}}),Object.defineProperty(e,"parsePath",{enumerable:!0,get:function(){return r.parsePath}}),Object.defineProperty(e,"redirect",{enumerable:!0,get:function(){return r.redirect}}),Object.defineProperty(e,"renderMatches",{enumerable:!0,get:function(){return r.renderMatches}}),Object.defineProperty(e,"resolvePath",{enumerable:!0,get:function(){return r.resolvePath}}),Object.defineProperty(e,"useActionData",{enumerable:!0,get:function(){return r.useActionData}}),Object.defineProperty(e,"useAsyncError",{enumerable:!0,get:function(){return r.useAsyncError}}),Object.defineProperty(e,"useAsyncValue",{enumerable:!0,get:function(){return r.useAsyncValue}}),Object.defineProperty(e,"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.Form=R,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=v,e.ScrollRestoration=function(e){let{getKey:t,storageKey:r}=e;return L({getKey:t,storageKey:r}),null},e.UNSAFE_useScrollRestoration=L,e.createBrowserRouter=function(e,t){return n.createRouter({basename:null==t?void 0:t.basename,history:n.createBrowserHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||h(),routes:r.UNSAFE_enhanceManualRouteObjects(e)}).initialize()},e.createHashRouter=function(e,t){return n.createRouter({basename:null==t?void 0:t.basename,history:n.createHashHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||h(),routes:r.UNSAFE_enhanceManualRouteObjects(e)}).initialize()},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.useBeforeUnload=U,e.useFetcher=function(){var e;let{router:t}=S(w.UseFetcher),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(++N))),[l]=a.useState((()=>(i||n.invariant(!1),function(e,t){return a.forwardRef(((r,n)=>a.createElement(P,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=A(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(){return[...j(O.UseFetchers).fetchers.values()]},e.useFormAction=C,e.useLinkClickHandler=E,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 A()},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=react-router-dom.production.min.js.map
{
"name": "react-router-dom",
"version": "6.6.3-pre.0",
"version": "6.7.0-pre.1",
"description": "Declarative routing for React web applications",

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

"dependencies": {
"@remix-run/router": "1.3.0-pre.0",
"react-router": "6.6.3-pre.0"
"@remix-run/router": "1.3.0-pre.1",
"react-router": "6.7.0-pre.1"
},

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

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