react-router-dom
Advanced tools
Comparing version 6.28.1 to 6.28.2-pre.0
# `react-router-dom` | ||
## 6.28.2-pre.0 | ||
### Patch Changes | ||
- Updated dependencies: | ||
- `@remix-run/router@1.21.1-pre.0` | ||
- `react-router@6.28.2-pre.0` | ||
## 6.28.1 | ||
@@ -4,0 +12,0 @@ |
/** | ||
* React Router DOM v6.28.1 | ||
* React Router DOM v6.28.2-pre.0 | ||
* | ||
@@ -420,3 +420,2 @@ * Copyright (c) Remix Software Inc. | ||
} = _ref2; | ||
deletedFetchers.forEach(key => fetcherData.current.delete(key)); | ||
newState.fetchers.forEach((fetcher, key) => { | ||
@@ -427,2 +426,3 @@ if (fetcher.data !== undefined) { | ||
}); | ||
deletedFetchers.forEach(key => fetcherData.current.delete(key)); | ||
let isViewTransitionUnavailable = router.window == null || router.window.document == null || typeof router.window.document.startViewTransition !== "function"; | ||
@@ -429,0 +429,0 @@ // If this isn't a view transition or it's not available in this browser, |
/** | ||
* React Router DOM v6.28.1 | ||
* React Router DOM v6.28.2-pre.0 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* React Router DOM v6.28.1 | ||
* React Router DOM v6.28.2-pre.0 | ||
* | ||
@@ -436,3 +436,2 @@ * Copyright (c) Remix Software Inc. | ||
}) => { | ||
deletedFetchers.forEach(key => fetcherData.current.delete(key)); | ||
newState.fetchers.forEach((fetcher, key) => { | ||
@@ -443,2 +442,3 @@ if (fetcher.data !== undefined) { | ||
}); | ||
deletedFetchers.forEach(key => fetcherData.current.delete(key)); | ||
let isViewTransitionUnavailable = router.window == null || router.window.document == null || typeof router.window.document.startViewTransition !== "function"; | ||
@@ -445,0 +445,0 @@ |
/** | ||
* React Router DOM v6.28.1 | ||
* React Router DOM v6.28.2-pre.0 | ||
* | ||
@@ -11,3 +11,3 @@ * Copyright (c) Remix Software Inc. | ||
*/ | ||
import*as e from"react";import*as t from"react-dom";import{UNSAFE_mapRouteProperties as n,UNSAFE_logV6DeprecationWarnings as r,UNSAFE_DataRouterContext as a,UNSAFE_DataRouterStateContext as o,Router as i,UNSAFE_useRoutesImpl as s,UNSAFE_NavigationContext as u,useHref as c,useResolvedPath as l,useLocation as f,useNavigate as d,createPath as m,UNSAFE_useRouteId as h,UNSAFE_RouteContext as p,useMatches as w,useNavigation as v,useBlocker as g}from"react-router";export{AbortedDeferredError,Await,MemoryRouter,Navigate,NavigationType,Outlet,Route,Router,Routes,UNSAFE_DataRouterContext,UNSAFE_DataRouterStateContext,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,UNSAFE_useRouteId,createMemoryRouter,createPath,createRoutesFromChildren,createRoutesFromElements,defer,generatePath,isRouteErrorResponse,json,matchPath,matchRoutes,parsePath,redirect,redirectDocument,renderMatches,replace,resolvePath,useActionData,useAsyncError,useAsyncValue,useBlocker,useHref,useInRouterContext,useLoaderData,useLocation,useMatch,useMatches,useNavigate,useNavigation,useNavigationType,useOutlet,useOutletContext,useParams,useResolvedPath,useRevalidator,useRouteError,useRouteLoaderData,useRoutes}from"react-router";import{stripBasename as y,createRouter as b,createBrowserHistory as S,createHashHistory as E,UNSAFE_ErrorResponseImpl as R,UNSAFE_invariant as T,joinPaths as L,IDLE_FETCHER as x,matchPath as C}from"@remix-run/router";export{UNSAFE_ErrorResponseImpl}from"@remix-run/router";const _="application/x-www-form-urlencoded";function A(e){return null!=e&&"string"==typeof e.tagName}function F(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map((e=>[n,e])):[[n,r]])}),[]))}let U=null;const k=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function N(e){return null==e||k.has(e)?e:null}function P(e,t){let n,r,a,o,i;if(A(s=e)&&"form"===s.tagName.toLowerCase()){let i=e.getAttribute("action");r=i?y(i,t):null,n=e.getAttribute("method")||"get",a=N(e.getAttribute("enctype"))||_,o=new FormData(e)}else if(function(e){return A(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return A(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let i=e.form;if(null==i)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||i.getAttribute("action");if(r=s?y(s,t):null,n=e.getAttribute("formmethod")||i.getAttribute("method")||"get",a=N(e.getAttribute("formenctype"))||N(i.getAttribute("enctype"))||_,o=new FormData(i,e),!function(){if(null===U)try{new FormData(document.createElement("form"),0),U=!1}catch(e){U=!0}return U}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?`${t}.`:"";o.append(`${e}x`,"0"),o.append(`${e}y`,"0")}else t&&o.append(t,r)}}else{if(A(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n="get",r=null,a=_,i=e}var s;return o&&"text/plain"===a&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:o,body:i}}try{window.__reactRouterVersion="6"}catch(Se){}function D(e,t){return b({basename:t?.basename,future:{...t?.future,v7_prependBasename:!0},history:S({window:t?.window}),hydrationData:t?.hydrationData||K(),routes:e,mapRouteProperties:n,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window}).initialize()}function O(e,t){return b({basename:t?.basename,future:{...t?.future,v7_prependBasename:!0},history:E({window:t?.window}),hydrationData:t?.hydrationData||K(),routes:e,mapRouteProperties:n,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window}).initialize()}function K(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:M(e.errors)}),e}function M(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,a]of t)if(a&&"RouteErrorResponse"===a.__type)n[r]=new R(a.status,a.statusText,a.data,!0===a.internal);else if(a&&"Error"===a.__type){if(a.__subType){let e=window[a.__subType];if("function"==typeof e)try{let t=new e(a.message);t.stack="",n[r]=t}catch(Se){}}if(null==n[r]){let e=new Error(a.message);e.stack="",n[r]=e}}else n[r]=a;return n}const j=e.createContext({isTransitioning:!1}),I=e.createContext(new Map),V=e.startTransition,H=t.flushSync,z=e.useId;function B(e){H?H(e):e()}class ${status="pending";constructor(){this.promise=new Promise(((e,t)=>{this.resolve=t=>{"pending"===this.status&&(this.status="resolved",e(t))},this.reject=e=>{"pending"===this.status&&(this.status="rejected",t(e))}}))}}function W({fallbackElement:t,router:n,future:s}){let[u,c]=e.useState(n.state),[l,f]=e.useState(),[d,m]=e.useState({isTransitioning:!1}),[h,p]=e.useState(),[w,v]=e.useState(),[g,y]=e.useState(),b=e.useRef(new Map),{v7_startTransition:S}=s||{},E=e.useCallback((e=>{S?function(e){V?V(e):e()}(e):e()}),[S]),R=e.useCallback(((e,{deletedFetchers:t,flushSync:r,viewTransitionOpts:a})=>{t.forEach((e=>b.current.delete(e))),e.fetchers.forEach(((e,t)=>{void 0!==e.data&&b.current.set(t,e.data)}));let o=null==n.window||null==n.window.document||"function"!=typeof n.window.document.startViewTransition;if(a&&!o){if(r){B((()=>{w&&(h&&h.resolve(),w.skipTransition()),m({isTransitioning:!0,flushSync:!0,currentLocation:a.currentLocation,nextLocation:a.nextLocation})}));let t=n.window.document.startViewTransition((()=>{B((()=>c(e)))}));return t.finished.finally((()=>{B((()=>{p(void 0),v(void 0),f(void 0),m({isTransitioning:!1})}))})),void B((()=>v(t)))}w?(h&&h.resolve(),w.skipTransition(),y({state:e,currentLocation:a.currentLocation,nextLocation:a.nextLocation})):(f(e),m({isTransitioning:!0,flushSync:!1,currentLocation:a.currentLocation,nextLocation:a.nextLocation}))}else r?B((()=>c(e))):E((()=>c(e)))}),[n.window,w,h,b,E]);e.useLayoutEffect((()=>n.subscribe(R)),[n,R]),e.useEffect((()=>{d.isTransitioning&&!d.flushSync&&p(new $)}),[d]),e.useEffect((()=>{if(h&&l&&n.window){let e=l,t=h.promise,r=n.window.document.startViewTransition((async()=>{E((()=>c(e))),await t}));r.finished.finally((()=>{p(void 0),v(void 0),f(void 0),m({isTransitioning:!1})})),v(r)}}),[E,l,h,n.window]),e.useEffect((()=>{h&&l&&u.location.key===l.location.key&&h.resolve()}),[h,w,u.location,l]),e.useEffect((()=>{!d.isTransitioning&&g&&(f(g.state),m({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),y(void 0))}),[d.isTransitioning,g]),e.useEffect((()=>{}),[]);let T=e.useMemo((()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:e=>n.navigate(e),push:(e,t,r)=>n.navigate(e,{state:t,preventScrollReset:r?.preventScrollReset}),replace:(e,t,r)=>n.navigate(e,{replace:!0,state:t,preventScrollReset:r?.preventScrollReset})})),[n]),L=n.basename||"/",x=e.useMemo((()=>({router:n,navigator:T,static:!1,basename:L})),[n,T,L]),C=e.useMemo((()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath})),[n.future.v7_relativeSplatPath]);return e.useEffect((()=>r(s,n.future)),[s,n.future]),e.createElement(e.Fragment,null,e.createElement(a.Provider,{value:x},e.createElement(o.Provider,{value:u},e.createElement(I.Provider,{value:b.current},e.createElement(j.Provider,{value:d},e.createElement(i,{basename:L,location:u.location,navigationType:u.historyAction,navigator:T,future:C},u.initialized||n.future.v7_partialHydration?e.createElement(Y,{routes:n.routes,future:n.future,state:u}):t))))),null)}const Y=e.memo(J);function J({routes:e,future:t,state:n}){return s(e,void 0,n,t)}function q({basename:t,children:n,future:a,window:o}){let s=e.useRef();null==s.current&&(s.current=S({window:o,v5Compat:!0}));let u=s.current,[c,l]=e.useState({action:u.action,location:u.location}),{v7_startTransition:f}=a||{},d=e.useCallback((e=>{f&&V?V((()=>l(e))):l(e)}),[l,f]);return e.useLayoutEffect((()=>u.listen(d)),[u,d]),e.useEffect((()=>r(a)),[a]),e.createElement(i,{basename:t,children:n,location:c.location,navigationType:c.action,navigator:u,future:a})}function G({basename:t,children:n,future:a,window:o}){let s=e.useRef();null==s.current&&(s.current=E({window:o,v5Compat:!0}));let u=s.current,[c,l]=e.useState({action:u.action,location:u.location}),{v7_startTransition:f}=a||{},d=e.useCallback((e=>{f&&V?V((()=>l(e))):l(e)}),[l,f]);return e.useLayoutEffect((()=>u.listen(d)),[u,d]),e.useEffect((()=>r(a)),[a]),e.createElement(i,{basename:t,children:n,location:c.location,navigationType:c.action,navigator:u,future:a})}function Q({basename:t,children:n,future:a,history:o}){let[s,u]=e.useState({action:o.action,location:o.location}),{v7_startTransition:c}=a||{},l=e.useCallback((e=>{c&&V?V((()=>u(e))):u(e)}),[u,c]);return e.useLayoutEffect((()=>o.listen(l)),[o,l]),e.useEffect((()=>r(a)),[a]),e.createElement(i,{basename:t,children:n,location:s.location,navigationType:s.action,navigator:o,future:a})}const X="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Z=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ee=e.forwardRef((function({onClick:t,relative:n,reloadDocument:r,replace:a,state:o,target:i,to:s,preventScrollReset:l,viewTransition:f,...d},m){let h,{basename:p}=e.useContext(u),w=!1;if("string"==typeof s&&Z.test(s)&&(h=s,X))try{let e=new URL(window.location.href),t=s.startsWith("//")?new URL(e.protocol+s):new URL(s),n=y(t.pathname,p);t.origin===e.origin&&null!=n?s=n+t.search+t.hash:w=!0}catch(Se){}let v=c(s,{relative:n}),g=ue(s,{replace:a,state:o,target:i,preventScrollReset:l,relative:n,viewTransition:f});return e.createElement("a",Object.assign({},d,{href:h||v,onClick:w||r?t:function(e){t&&t(e),e.defaultPrevented||g(e)},ref:m,target:i}))})),te=e.forwardRef((function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:i,to:s,viewTransition:c,children:d,...m},h){let p=l(s,{relative:m.relative}),w=f(),v=e.useContext(o),{navigator:g,basename:b}=e.useContext(u),S=null!=v&&be(p)&&!0===c,E=g.encodeLocation?g.encodeLocation(p).pathname:p.pathname,R=w.pathname,T=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;n||(R=R.toLowerCase(),T=T?T.toLowerCase():null,E=E.toLowerCase()),T&&b&&(T=y(T,b)||T);const L="/"!==E&&E.endsWith("/")?E.length-1:E.length;let x,C=R===E||!a&&R.startsWith(E)&&"/"===R.charAt(L),_=null!=T&&(T===E||!a&&T.startsWith(E)&&"/"===T.charAt(E.length)),A={isActive:C,isPending:_,isTransitioning:S},F=C?t:void 0;x="function"==typeof r?r(A):[r,C?"active":null,_?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let U="function"==typeof i?i(A):i;return e.createElement(ee,Object.assign({},m,{"aria-current":F,className:x,ref:h,style:U,to:s,viewTransition:c}),"function"==typeof d?d(A):d)})),ne=e.forwardRef((({fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:o,method:i="get",action:s,onSubmit:u,relative:c,preventScrollReset:l,viewTransition:f,...d},m)=>{let h=de(),p=me(s,{relative:c}),w="get"===i.toLowerCase()?"get":"post";return e.createElement("form",Object.assign({ref:m,method:w,action:p,onSubmit:r?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute("formmethod")||i;h(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:a,state:o,relative:c,preventScrollReset:l,viewTransition:f})}},d))}));function re({getKey:e,storageKey:t}){return ve({getKey:e,storageKey:t}),null}var ae=function(e){return e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState",e}(ae||{}),oe=function(e){return e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration",e}(oe||{});function ie(t){let n=e.useContext(a);return n||T(!1),n}function se(t){let n=e.useContext(o);return n||T(!1),n}function ue(t,{target:n,replace:r,state:a,preventScrollReset:o,relative:i,viewTransition:s}={}){let u=d(),c=f(),h=l(t,{relative:i});return e.useCallback((e=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(e,n)){e.preventDefault();let n=void 0!==r?r:m(c)===m(h);u(t,{replace:n,state:a,preventScrollReset:o,relative:i,viewTransition:s})}}),[c,u,h,r,a,n,t,o,i,s])}function ce(t){let n=e.useRef(F(t)),r=e.useRef(!1),a=f(),o=e.useMemo((()=>function(e,t){let n=F(e);return t&&t.forEach(((e,r)=>{n.has(r)||t.getAll(r).forEach((e=>{n.append(r,e)}))})),n}(a.search,r.current?null:n.current)),[a.search]),i=d(),s=e.useCallback(((e,t)=>{const n=F("function"==typeof e?e(o):e);r.current=!0,i("?"+n,t)}),[i,o]);return[o,s]}let le=0,fe=()=>`__${String(++le)}__`;function de(){let{router:t}=ie(ae.UseSubmit),{basename:n}=e.useContext(u),r=h();return e.useCallback(((e,a={})=>{!function(){if("undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}();let{action:o,method:i,encType:s,formData:u,body:c}=P(e,n);if(!1===a.navigate){let e=a.fetcherKey||fe();t.fetch(e,r,a.action||o,{preventScrollReset:a.preventScrollReset,formData:u,body:c,formMethod:a.method||i,formEncType:a.encType||s,flushSync:a.flushSync})}else t.navigate(a.action||o,{preventScrollReset:a.preventScrollReset,formData:u,body:c,formMethod:a.method||i,formEncType:a.encType||s,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})}),[t,n,r])}function me(t,{relative:n}={}){let{basename:r}=e.useContext(u),a=e.useContext(p);a||T(!1);let[o]=a.matches.slice(-1),i={...l(t||".",{relative:n})},s=f();if(null==t){i.search=s.search;let e=new URLSearchParams(i.search),t=e.getAll("index");if(t.some((e=>""===e))){e.delete("index"),t.filter((e=>e)).forEach((t=>e.append("index",t)));let n=e.toString();i.search=n?`?${n}`:""}}return t&&"."!==t||!o.route.index||(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),"/"!==r&&(i.pathname="/"===i.pathname?r:L([r,i.pathname])),m(i)}function he({key:t}={}){let{router:n}=ie(ae.UseFetcher),r=se(oe.UseFetcher),a=e.useContext(I),o=e.useContext(p),i=o.matches[o.matches.length-1]?.route.id;a||T(!1),o||T(!1),null==i&&T(!1);let s=z?z():"",[u,c]=e.useState(t||s);t&&t!==u?c(t):u||c(fe()),e.useEffect((()=>(n.getFetcher(u),()=>{n.deleteFetcher(u)})),[n,u]);let l=e.useCallback(((e,t)=>{i||T(!1),n.fetch(u,i,e,t)}),[u,i,n]),f=de(),d=e.useCallback(((e,t)=>{f(e,{...t,navigate:!1,fetcherKey:u})}),[u,f]),m=e.useMemo((()=>e.forwardRef(((t,n)=>e.createElement(ne,Object.assign({},t,{navigate:!1,fetcherKey:u,ref:n}))))),[u]),h=r.fetchers.get(u)||x,w=a.get(u);return e.useMemo((()=>({Form:m,submit:d,load:l,...h,data:w})),[m,d,l,h,w])}function pe(){let e=se(oe.UseFetchers);return Array.from(e.fetchers.entries()).map((([e,t])=>({...t,key:e})))}let we={};function ve({getKey:t,storageKey:n}={}){let{router:r}=ie(ae.UseScrollRestoration),{restoreScrollPosition:a,preventScrollReset:o}=se(oe.UseScrollRestoration),{basename:i}=e.useContext(u),s=f(),c=w(),l=v();e.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),function(t,n){let{capture:r}=n||{};e.useEffect((()=>{let e=null!=r?{capture:r}:void 0;return window.addEventListener("pagehide",t,e),()=>{window.removeEventListener("pagehide",t,e)}}),[t,r])}(e.useCallback((()=>{if("idle"===l.state){let e=(t?t(s,c):null)||s.key;we[e]=window.scrollY}try{sessionStorage.setItem(n||"react-router-scroll-positions",JSON.stringify(we))}catch(e){}window.history.scrollRestoration="auto"}),[n,t,l.state,s,c])),"undefined"!=typeof document&&(e.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(n||"react-router-scroll-positions");e&&(we=JSON.parse(e))}catch(Se){}}),[n]),e.useLayoutEffect((()=>{let e=t&&"/"!==i?(e,n)=>t({...e,pathname:y(e.pathname,i)||e.pathname},n):t,n=r?.enableScrollRestoration(we,(()=>window.scrollY),e);return()=>n&&n()}),[r,i,t]),e.useLayoutEffect((()=>{if(!1!==a)if("number"!=typeof a){if(s.hash){let e=document.getElementById(decodeURIComponent(s.hash.slice(1)));if(e)return void e.scrollIntoView()}!0!==o&&window.scrollTo(0,0)}else window.scrollTo(0,a)}),[s,a,o]))}function ge(t,n){let{capture:r}=n||{};e.useEffect((()=>{let e=null!=r?{capture:r}:void 0;return window.addEventListener("beforeunload",t,e),()=>{window.removeEventListener("beforeunload",t,e)}}),[t,r])}function ye({when:t,message:n}){let r=g(t);e.useEffect((()=>{if("blocked"===r.state){window.confirm(n)?setTimeout(r.proceed,0):r.reset()}}),[r,n]),e.useEffect((()=>{"blocked"!==r.state||t||r.reset()}),[r,t])}function be(t,n={}){let r=e.useContext(j);null==r&&T(!1);let{basename:a}=ie(ae.useViewTransitionState),o=l(t,{relative:n.relative});if(!r.isTransitioning)return!1;let i=y(r.currentLocation.pathname,a)||r.currentLocation.pathname,s=y(r.nextLocation.pathname,a)||r.nextLocation.pathname;return null!=C(o.pathname,s)||null!=C(o.pathname,i)}export{q as BrowserRouter,ne as Form,G as HashRouter,ee as Link,te as NavLink,W as RouterProvider,re as ScrollRestoration,I as UNSAFE_FetchersContext,j as UNSAFE_ViewTransitionContext,ve as UNSAFE_useScrollRestoration,D as createBrowserRouter,O as createHashRouter,F as createSearchParams,Q as unstable_HistoryRouter,ye as unstable_usePrompt,ge as useBeforeUnload,he as useFetcher,pe as useFetchers,me as useFormAction,ue as useLinkClickHandler,ce as useSearchParams,de as useSubmit,be as useViewTransitionState}; | ||
import*as e from"react";import*as t from"react-dom";import{UNSAFE_mapRouteProperties as n,UNSAFE_logV6DeprecationWarnings as r,UNSAFE_DataRouterContext as a,UNSAFE_DataRouterStateContext as o,Router as i,UNSAFE_useRoutesImpl as s,UNSAFE_NavigationContext as u,useHref as c,useResolvedPath as l,useLocation as f,useNavigate as d,createPath as m,UNSAFE_useRouteId as h,UNSAFE_RouteContext as p,useMatches as w,useNavigation as v,useBlocker as g}from"react-router";export{AbortedDeferredError,Await,MemoryRouter,Navigate,NavigationType,Outlet,Route,Router,Routes,UNSAFE_DataRouterContext,UNSAFE_DataRouterStateContext,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,UNSAFE_useRouteId,createMemoryRouter,createPath,createRoutesFromChildren,createRoutesFromElements,defer,generatePath,isRouteErrorResponse,json,matchPath,matchRoutes,parsePath,redirect,redirectDocument,renderMatches,replace,resolvePath,useActionData,useAsyncError,useAsyncValue,useBlocker,useHref,useInRouterContext,useLoaderData,useLocation,useMatch,useMatches,useNavigate,useNavigation,useNavigationType,useOutlet,useOutletContext,useParams,useResolvedPath,useRevalidator,useRouteError,useRouteLoaderData,useRoutes}from"react-router";import{stripBasename as y,createRouter as b,createBrowserHistory as S,createHashHistory as E,UNSAFE_ErrorResponseImpl as R,UNSAFE_invariant as T,joinPaths as L,IDLE_FETCHER as x,matchPath as C}from"@remix-run/router";export{UNSAFE_ErrorResponseImpl}from"@remix-run/router";const _="application/x-www-form-urlencoded";function A(e){return null!=e&&"string"==typeof e.tagName}function F(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map((e=>[n,e])):[[n,r]])}),[]))}let U=null;const k=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function N(e){return null==e||k.has(e)?e:null}function P(e,t){let n,r,a,o,i;if(A(s=e)&&"form"===s.tagName.toLowerCase()){let i=e.getAttribute("action");r=i?y(i,t):null,n=e.getAttribute("method")||"get",a=N(e.getAttribute("enctype"))||_,o=new FormData(e)}else if(function(e){return A(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return A(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let i=e.form;if(null==i)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||i.getAttribute("action");if(r=s?y(s,t):null,n=e.getAttribute("formmethod")||i.getAttribute("method")||"get",a=N(e.getAttribute("formenctype"))||N(i.getAttribute("enctype"))||_,o=new FormData(i,e),!function(){if(null===U)try{new FormData(document.createElement("form"),0),U=!1}catch(e){U=!0}return U}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?`${t}.`:"";o.append(`${e}x`,"0"),o.append(`${e}y`,"0")}else t&&o.append(t,r)}}else{if(A(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n="get",r=null,a=_,i=e}var s;return o&&"text/plain"===a&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:o,body:i}}try{window.__reactRouterVersion="6"}catch(Se){}function D(e,t){return b({basename:t?.basename,future:{...t?.future,v7_prependBasename:!0},history:S({window:t?.window}),hydrationData:t?.hydrationData||K(),routes:e,mapRouteProperties:n,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window}).initialize()}function O(e,t){return b({basename:t?.basename,future:{...t?.future,v7_prependBasename:!0},history:E({window:t?.window}),hydrationData:t?.hydrationData||K(),routes:e,mapRouteProperties:n,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window}).initialize()}function K(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:M(e.errors)}),e}function M(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,a]of t)if(a&&"RouteErrorResponse"===a.__type)n[r]=new R(a.status,a.statusText,a.data,!0===a.internal);else if(a&&"Error"===a.__type){if(a.__subType){let e=window[a.__subType];if("function"==typeof e)try{let t=new e(a.message);t.stack="",n[r]=t}catch(Se){}}if(null==n[r]){let e=new Error(a.message);e.stack="",n[r]=e}}else n[r]=a;return n}const j=e.createContext({isTransitioning:!1}),I=e.createContext(new Map),V=e.startTransition,H=t.flushSync,z=e.useId;function B(e){H?H(e):e()}class ${status="pending";constructor(){this.promise=new Promise(((e,t)=>{this.resolve=t=>{"pending"===this.status&&(this.status="resolved",e(t))},this.reject=e=>{"pending"===this.status&&(this.status="rejected",t(e))}}))}}function W({fallbackElement:t,router:n,future:s}){let[u,c]=e.useState(n.state),[l,f]=e.useState(),[d,m]=e.useState({isTransitioning:!1}),[h,p]=e.useState(),[w,v]=e.useState(),[g,y]=e.useState(),b=e.useRef(new Map),{v7_startTransition:S}=s||{},E=e.useCallback((e=>{S?function(e){V?V(e):e()}(e):e()}),[S]),R=e.useCallback(((e,{deletedFetchers:t,flushSync:r,viewTransitionOpts:a})=>{e.fetchers.forEach(((e,t)=>{void 0!==e.data&&b.current.set(t,e.data)})),t.forEach((e=>b.current.delete(e)));let o=null==n.window||null==n.window.document||"function"!=typeof n.window.document.startViewTransition;if(a&&!o){if(r){B((()=>{w&&(h&&h.resolve(),w.skipTransition()),m({isTransitioning:!0,flushSync:!0,currentLocation:a.currentLocation,nextLocation:a.nextLocation})}));let t=n.window.document.startViewTransition((()=>{B((()=>c(e)))}));return t.finished.finally((()=>{B((()=>{p(void 0),v(void 0),f(void 0),m({isTransitioning:!1})}))})),void B((()=>v(t)))}w?(h&&h.resolve(),w.skipTransition(),y({state:e,currentLocation:a.currentLocation,nextLocation:a.nextLocation})):(f(e),m({isTransitioning:!0,flushSync:!1,currentLocation:a.currentLocation,nextLocation:a.nextLocation}))}else r?B((()=>c(e))):E((()=>c(e)))}),[n.window,w,h,b,E]);e.useLayoutEffect((()=>n.subscribe(R)),[n,R]),e.useEffect((()=>{d.isTransitioning&&!d.flushSync&&p(new $)}),[d]),e.useEffect((()=>{if(h&&l&&n.window){let e=l,t=h.promise,r=n.window.document.startViewTransition((async()=>{E((()=>c(e))),await t}));r.finished.finally((()=>{p(void 0),v(void 0),f(void 0),m({isTransitioning:!1})})),v(r)}}),[E,l,h,n.window]),e.useEffect((()=>{h&&l&&u.location.key===l.location.key&&h.resolve()}),[h,w,u.location,l]),e.useEffect((()=>{!d.isTransitioning&&g&&(f(g.state),m({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),y(void 0))}),[d.isTransitioning,g]),e.useEffect((()=>{}),[]);let T=e.useMemo((()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:e=>n.navigate(e),push:(e,t,r)=>n.navigate(e,{state:t,preventScrollReset:r?.preventScrollReset}),replace:(e,t,r)=>n.navigate(e,{replace:!0,state:t,preventScrollReset:r?.preventScrollReset})})),[n]),L=n.basename||"/",x=e.useMemo((()=>({router:n,navigator:T,static:!1,basename:L})),[n,T,L]),C=e.useMemo((()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath})),[n.future.v7_relativeSplatPath]);return e.useEffect((()=>r(s,n.future)),[s,n.future]),e.createElement(e.Fragment,null,e.createElement(a.Provider,{value:x},e.createElement(o.Provider,{value:u},e.createElement(I.Provider,{value:b.current},e.createElement(j.Provider,{value:d},e.createElement(i,{basename:L,location:u.location,navigationType:u.historyAction,navigator:T,future:C},u.initialized||n.future.v7_partialHydration?e.createElement(Y,{routes:n.routes,future:n.future,state:u}):t))))),null)}const Y=e.memo(J);function J({routes:e,future:t,state:n}){return s(e,void 0,n,t)}function q({basename:t,children:n,future:a,window:o}){let s=e.useRef();null==s.current&&(s.current=S({window:o,v5Compat:!0}));let u=s.current,[c,l]=e.useState({action:u.action,location:u.location}),{v7_startTransition:f}=a||{},d=e.useCallback((e=>{f&&V?V((()=>l(e))):l(e)}),[l,f]);return e.useLayoutEffect((()=>u.listen(d)),[u,d]),e.useEffect((()=>r(a)),[a]),e.createElement(i,{basename:t,children:n,location:c.location,navigationType:c.action,navigator:u,future:a})}function G({basename:t,children:n,future:a,window:o}){let s=e.useRef();null==s.current&&(s.current=E({window:o,v5Compat:!0}));let u=s.current,[c,l]=e.useState({action:u.action,location:u.location}),{v7_startTransition:f}=a||{},d=e.useCallback((e=>{f&&V?V((()=>l(e))):l(e)}),[l,f]);return e.useLayoutEffect((()=>u.listen(d)),[u,d]),e.useEffect((()=>r(a)),[a]),e.createElement(i,{basename:t,children:n,location:c.location,navigationType:c.action,navigator:u,future:a})}function Q({basename:t,children:n,future:a,history:o}){let[s,u]=e.useState({action:o.action,location:o.location}),{v7_startTransition:c}=a||{},l=e.useCallback((e=>{c&&V?V((()=>u(e))):u(e)}),[u,c]);return e.useLayoutEffect((()=>o.listen(l)),[o,l]),e.useEffect((()=>r(a)),[a]),e.createElement(i,{basename:t,children:n,location:s.location,navigationType:s.action,navigator:o,future:a})}const X="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Z=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ee=e.forwardRef((function({onClick:t,relative:n,reloadDocument:r,replace:a,state:o,target:i,to:s,preventScrollReset:l,viewTransition:f,...d},m){let h,{basename:p}=e.useContext(u),w=!1;if("string"==typeof s&&Z.test(s)&&(h=s,X))try{let e=new URL(window.location.href),t=s.startsWith("//")?new URL(e.protocol+s):new URL(s),n=y(t.pathname,p);t.origin===e.origin&&null!=n?s=n+t.search+t.hash:w=!0}catch(Se){}let v=c(s,{relative:n}),g=ue(s,{replace:a,state:o,target:i,preventScrollReset:l,relative:n,viewTransition:f});return e.createElement("a",Object.assign({},d,{href:h||v,onClick:w||r?t:function(e){t&&t(e),e.defaultPrevented||g(e)},ref:m,target:i}))})),te=e.forwardRef((function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:i,to:s,viewTransition:c,children:d,...m},h){let p=l(s,{relative:m.relative}),w=f(),v=e.useContext(o),{navigator:g,basename:b}=e.useContext(u),S=null!=v&&be(p)&&!0===c,E=g.encodeLocation?g.encodeLocation(p).pathname:p.pathname,R=w.pathname,T=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;n||(R=R.toLowerCase(),T=T?T.toLowerCase():null,E=E.toLowerCase()),T&&b&&(T=y(T,b)||T);const L="/"!==E&&E.endsWith("/")?E.length-1:E.length;let x,C=R===E||!a&&R.startsWith(E)&&"/"===R.charAt(L),_=null!=T&&(T===E||!a&&T.startsWith(E)&&"/"===T.charAt(E.length)),A={isActive:C,isPending:_,isTransitioning:S},F=C?t:void 0;x="function"==typeof r?r(A):[r,C?"active":null,_?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let U="function"==typeof i?i(A):i;return e.createElement(ee,Object.assign({},m,{"aria-current":F,className:x,ref:h,style:U,to:s,viewTransition:c}),"function"==typeof d?d(A):d)})),ne=e.forwardRef((({fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:o,method:i="get",action:s,onSubmit:u,relative:c,preventScrollReset:l,viewTransition:f,...d},m)=>{let h=de(),p=me(s,{relative:c}),w="get"===i.toLowerCase()?"get":"post";return e.createElement("form",Object.assign({ref:m,method:w,action:p,onSubmit:r?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute("formmethod")||i;h(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:a,state:o,relative:c,preventScrollReset:l,viewTransition:f})}},d))}));function re({getKey:e,storageKey:t}){return ve({getKey:e,storageKey:t}),null}var ae=function(e){return e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState",e}(ae||{}),oe=function(e){return e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration",e}(oe||{});function ie(t){let n=e.useContext(a);return n||T(!1),n}function se(t){let n=e.useContext(o);return n||T(!1),n}function ue(t,{target:n,replace:r,state:a,preventScrollReset:o,relative:i,viewTransition:s}={}){let u=d(),c=f(),h=l(t,{relative:i});return e.useCallback((e=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(e,n)){e.preventDefault();let n=void 0!==r?r:m(c)===m(h);u(t,{replace:n,state:a,preventScrollReset:o,relative:i,viewTransition:s})}}),[c,u,h,r,a,n,t,o,i,s])}function ce(t){let n=e.useRef(F(t)),r=e.useRef(!1),a=f(),o=e.useMemo((()=>function(e,t){let n=F(e);return t&&t.forEach(((e,r)=>{n.has(r)||t.getAll(r).forEach((e=>{n.append(r,e)}))})),n}(a.search,r.current?null:n.current)),[a.search]),i=d(),s=e.useCallback(((e,t)=>{const n=F("function"==typeof e?e(o):e);r.current=!0,i("?"+n,t)}),[i,o]);return[o,s]}let le=0,fe=()=>`__${String(++le)}__`;function de(){let{router:t}=ie(ae.UseSubmit),{basename:n}=e.useContext(u),r=h();return e.useCallback(((e,a={})=>{!function(){if("undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}();let{action:o,method:i,encType:s,formData:u,body:c}=P(e,n);if(!1===a.navigate){let e=a.fetcherKey||fe();t.fetch(e,r,a.action||o,{preventScrollReset:a.preventScrollReset,formData:u,body:c,formMethod:a.method||i,formEncType:a.encType||s,flushSync:a.flushSync})}else t.navigate(a.action||o,{preventScrollReset:a.preventScrollReset,formData:u,body:c,formMethod:a.method||i,formEncType:a.encType||s,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})}),[t,n,r])}function me(t,{relative:n}={}){let{basename:r}=e.useContext(u),a=e.useContext(p);a||T(!1);let[o]=a.matches.slice(-1),i={...l(t||".",{relative:n})},s=f();if(null==t){i.search=s.search;let e=new URLSearchParams(i.search),t=e.getAll("index");if(t.some((e=>""===e))){e.delete("index"),t.filter((e=>e)).forEach((t=>e.append("index",t)));let n=e.toString();i.search=n?`?${n}`:""}}return t&&"."!==t||!o.route.index||(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),"/"!==r&&(i.pathname="/"===i.pathname?r:L([r,i.pathname])),m(i)}function he({key:t}={}){let{router:n}=ie(ae.UseFetcher),r=se(oe.UseFetcher),a=e.useContext(I),o=e.useContext(p),i=o.matches[o.matches.length-1]?.route.id;a||T(!1),o||T(!1),null==i&&T(!1);let s=z?z():"",[u,c]=e.useState(t||s);t&&t!==u?c(t):u||c(fe()),e.useEffect((()=>(n.getFetcher(u),()=>{n.deleteFetcher(u)})),[n,u]);let l=e.useCallback(((e,t)=>{i||T(!1),n.fetch(u,i,e,t)}),[u,i,n]),f=de(),d=e.useCallback(((e,t)=>{f(e,{...t,navigate:!1,fetcherKey:u})}),[u,f]),m=e.useMemo((()=>e.forwardRef(((t,n)=>e.createElement(ne,Object.assign({},t,{navigate:!1,fetcherKey:u,ref:n}))))),[u]),h=r.fetchers.get(u)||x,w=a.get(u);return e.useMemo((()=>({Form:m,submit:d,load:l,...h,data:w})),[m,d,l,h,w])}function pe(){let e=se(oe.UseFetchers);return Array.from(e.fetchers.entries()).map((([e,t])=>({...t,key:e})))}let we={};function ve({getKey:t,storageKey:n}={}){let{router:r}=ie(ae.UseScrollRestoration),{restoreScrollPosition:a,preventScrollReset:o}=se(oe.UseScrollRestoration),{basename:i}=e.useContext(u),s=f(),c=w(),l=v();e.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),function(t,n){let{capture:r}=n||{};e.useEffect((()=>{let e=null!=r?{capture:r}:void 0;return window.addEventListener("pagehide",t,e),()=>{window.removeEventListener("pagehide",t,e)}}),[t,r])}(e.useCallback((()=>{if("idle"===l.state){let e=(t?t(s,c):null)||s.key;we[e]=window.scrollY}try{sessionStorage.setItem(n||"react-router-scroll-positions",JSON.stringify(we))}catch(e){}window.history.scrollRestoration="auto"}),[n,t,l.state,s,c])),"undefined"!=typeof document&&(e.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(n||"react-router-scroll-positions");e&&(we=JSON.parse(e))}catch(Se){}}),[n]),e.useLayoutEffect((()=>{let e=t&&"/"!==i?(e,n)=>t({...e,pathname:y(e.pathname,i)||e.pathname},n):t,n=r?.enableScrollRestoration(we,(()=>window.scrollY),e);return()=>n&&n()}),[r,i,t]),e.useLayoutEffect((()=>{if(!1!==a)if("number"!=typeof a){if(s.hash){let e=document.getElementById(decodeURIComponent(s.hash.slice(1)));if(e)return void e.scrollIntoView()}!0!==o&&window.scrollTo(0,0)}else window.scrollTo(0,a)}),[s,a,o]))}function ge(t,n){let{capture:r}=n||{};e.useEffect((()=>{let e=null!=r?{capture:r}:void 0;return window.addEventListener("beforeunload",t,e),()=>{window.removeEventListener("beforeunload",t,e)}}),[t,r])}function ye({when:t,message:n}){let r=g(t);e.useEffect((()=>{if("blocked"===r.state){window.confirm(n)?setTimeout(r.proceed,0):r.reset()}}),[r,n]),e.useEffect((()=>{"blocked"!==r.state||t||r.reset()}),[r,t])}function be(t,n={}){let r=e.useContext(j);null==r&&T(!1);let{basename:a}=ie(ae.useViewTransitionState),o=l(t,{relative:n.relative});if(!r.isTransitioning)return!1;let i=y(r.currentLocation.pathname,a)||r.currentLocation.pathname,s=y(r.nextLocation.pathname,a)||r.nextLocation.pathname;return null!=C(o.pathname,s)||null!=C(o.pathname,i)}export{q as BrowserRouter,ne as Form,G as HashRouter,ee as Link,te as NavLink,W as RouterProvider,re as ScrollRestoration,I as UNSAFE_FetchersContext,j as UNSAFE_ViewTransitionContext,ve as UNSAFE_useScrollRestoration,D as createBrowserRouter,O as createHashRouter,F as createSearchParams,Q as unstable_HistoryRouter,ye as unstable_usePrompt,ge as useBeforeUnload,he as useFetcher,pe as useFetchers,me as useFormAction,ue as useLinkClickHandler,ce as useSearchParams,de as useSubmit,be as useViewTransitionState}; | ||
//# sourceMappingURL=react-router-dom.production.min.js.map |
/** | ||
* React Router DOM v6.28.1 | ||
* React Router DOM v6.28.2-pre.0 | ||
* | ||
@@ -11,3 +11,3 @@ * Copyright (c) Remix Software Inc. | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("react-router"),require("@remix-run/router")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","react-router","@remix-run/router"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactRouterDOM={},e.React,e.ReactDOM,e.ReactRouter,e.RemixRouter)}(this,(function(e,t,n,r,o){"use strict";function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var i=a(t),u=a(n);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}const l="get",f="application/x-www-form-urlencoded";function d(e){return null!=e&&"string"==typeof e.tagName}function m(e){return void 0===e&&(e=""),new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map((e=>[n,e])):[[n,r]])}),[]))}let p=null;const v=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function h(e){return null==e||v.has(e)?e:null}function b(e,t){let n,r,a,i,u;if(d(s=e)&&"form"===s.tagName.toLowerCase()){let u=e.getAttribute("action");r=u?o.stripBasename(u,t):null,n=e.getAttribute("method")||l,a=h(e.getAttribute("enctype"))||f,i=new FormData(e)}else if(function(e){return d(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return d(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let u=e.form;if(null==u)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||u.getAttribute("action");if(r=s?o.stripBasename(s,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||l,a=h(e.getAttribute("formenctype"))||h(u.getAttribute("enctype"))||f,i=new FormData(u,e),!function(){if(null===p)try{new FormData(document.createElement("form"),0),p=!1}catch(e){p=!0}return p}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?t+".":"";i.append(e+"x","0"),i.append(e+"y","0")}else t&&i.append(t,r)}}else{if(d(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=l,r=null,a=f,u=e}var s;return i&&"text/plain"===a&&(u=i,i=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:i,body:u}}const g=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],y=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],w=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","viewTransition"];try{window.__reactRouterVersion="6"}catch(e){}function R(){var e;let t=null==(e=window)?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=s({},t,{errors:S(t.errors)})),t}function S(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&"RouteErrorResponse"===r.__type)n[e]=new o.UNSAFE_ErrorResponseImpl(r.status,r.statusText,r.data,!0===r.internal);else if(r&&"Error"===r.__type){if(r.__subType){let t=window[r.__subType];if("function"==typeof t)try{let o=new t(r.message);o.stack="",n[e]=o}catch(e){}}if(null==n[e]){let t=new Error(r.message);t.stack="",n[e]=t}}else n[e]=r;return n}const E=i.createContext({isTransitioning:!1}),P=i.createContext(new Map),O=i.startTransition,N=u.flushSync,_=i.useId;function A(e){N?N(e):e()}class F{constructor(){this.status="pending",this.promise=new Promise(((e,t)=>{this.resolve=t=>{"pending"===this.status&&(this.status="resolved",e(t))},this.reject=e=>{"pending"===this.status&&(this.status="rejected",t(e))}}))}}const C=i.memo(j);function j(e){let{routes:t,future:n,state:o}=e;return r.UNSAFE_useRoutesImpl(t,void 0,o,n)}const x="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,U=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,L=i.forwardRef((function(e,t){let n,{onClick:a,relative:u,reloadDocument:l,replace:f,state:d,target:m,to:p,preventScrollReset:v,viewTransition:h}=e,b=c(e,g),{basename:y}=i.useContext(r.UNSAFE_NavigationContext),w=!1;if("string"==typeof p&&U.test(p)&&(n=p,x))try{let e=new URL(window.location.href),t=p.startsWith("//")?new URL(e.protocol+p):new URL(p),n=o.stripBasename(t.pathname,y);t.origin===e.origin&&null!=n?p=n+t.search+t.hash:w=!0}catch(e){}let R=r.useHref(p,{relative:u}),S=I(p,{replace:f,state:d,target:m,preventScrollReset:v,relative:u,viewTransition:h});return i.createElement("a",s({},b,{href:n||R,onClick:w||l?a:function(e){a&&a(e),e.defaultPrevented||S(e)},ref:t,target:m}))})),T=i.forwardRef((function(e,t){let{"aria-current":n="page",caseSensitive:a=!1,className:u="",end:l=!1,style:f,to:d,viewTransition:m,children:p}=e,v=c(e,y),h=r.useResolvedPath(d,{relative:v.relative}),b=r.useLocation(),g=i.useContext(r.UNSAFE_DataRouterStateContext),{navigator:w,basename:R}=i.useContext(r.UNSAFE_NavigationContext),S=null!=g&&G(h)&&!0===m,E=w.encodeLocation?w.encodeLocation(h).pathname:h.pathname,P=b.pathname,O=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;a||(P=P.toLowerCase(),O=O?O.toLowerCase():null,E=E.toLowerCase()),O&&R&&(O=o.stripBasename(O,R)||O);const N="/"!==E&&E.endsWith("/")?E.length-1:E.length;let _,A=P===E||!l&&P.startsWith(E)&&"/"===P.charAt(N),F=null!=O&&(O===E||!l&&O.startsWith(E)&&"/"===O.charAt(E.length)),C={isActive:A,isPending:F,isTransitioning:S},j=A?n:void 0;_="function"==typeof u?u(C):[u,A?"active":null,F?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let x="function"==typeof f?f(C):f;return i.createElement(L,s({},v,{"aria-current":j,className:_,ref:t,style:x,to:d,viewTransition:m}),"function"==typeof p?p(C):p)})),D=i.forwardRef(((e,t)=>{let{fetcherKey:n,navigate:r,reloadDocument:o,replace:a,state:u,method:f=l,action:d,onSubmit:m,relative:p,preventScrollReset:v,viewTransition:h}=e,b=c(e,w),g=W(),y=z(d,{relative:p}),R="get"===f.toLowerCase()?"get":"post";return i.createElement("form",s({ref:t,method:R,action:y,onSubmit:o?m:e=>{if(m&&m(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter,o=(null==t?void 0:t.getAttribute("formmethod"))||f;g(t||e.currentTarget,{fetcherKey:n,method:o,navigate:r,replace:a,state:u,relative:p,preventScrollReset:v,viewTransition:h})}},b))}));var k=function(e){return e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState",e}(k||{}),M=function(e){return e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration",e}(M||{});function B(e){let t=i.useContext(r.UNSAFE_DataRouterContext);return t||o.UNSAFE_invariant(!1),t}function H(e){let t=i.useContext(r.UNSAFE_DataRouterStateContext);return t||o.UNSAFE_invariant(!1),t}function I(e,t){let{target:n,replace:o,state:a,preventScrollReset:u,relative:s,viewTransition:c}=void 0===t?{}:t,l=r.useNavigate(),f=r.useLocation(),d=r.useResolvedPath(e,{relative:s});return i.useCallback((t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,n)){t.preventDefault();let n=void 0!==o?o:r.createPath(f)===r.createPath(d);l(e,{replace:n,state:a,preventScrollReset:u,relative:s,viewTransition:c})}}),[f,l,d,o,a,n,e,u,s,c])}let K=0,V=()=>"__"+String(++K)+"__";function W(){let{router:e}=B(k.UseSubmit),{basename:t}=i.useContext(r.UNSAFE_NavigationContext),n=r.UNSAFE_useRouteId();return i.useCallback((function(r,o){void 0===o&&(o={}),function(){if("undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}();let{action:a,method:i,encType:u,formData:s,body:c}=b(r,t);if(!1===o.navigate){let t=o.fetcherKey||V();e.fetch(t,n,o.action||a,{preventScrollReset:o.preventScrollReset,formData:s,body:c,formMethod:o.method||i,formEncType:o.encType||u,flushSync:o.flushSync})}else e.navigate(o.action||a,{preventScrollReset:o.preventScrollReset,formData:s,body:c,formMethod:o.method||i,formEncType:o.encType||u,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})}),[e,t,n])}function z(e,t){let{relative:n}=void 0===t?{}:t,{basename:a}=i.useContext(r.UNSAFE_NavigationContext),u=i.useContext(r.UNSAFE_RouteContext);u||o.UNSAFE_invariant(!1);let[c]=u.matches.slice(-1),l=s({},r.useResolvedPath(e||".",{relative:n})),f=r.useLocation();if(null==e){l.search=f.search;let e=new URLSearchParams(l.search),t=e.getAll("index");if(t.some((e=>""===e))){e.delete("index"),t.filter((e=>e)).forEach((t=>e.append("index",t)));let n=e.toString();l.search=n?"?"+n:""}}return e&&"."!==e||!c.route.index||(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),"/"!==a&&(l.pathname="/"===l.pathname?a:o.joinPaths([a,l.pathname])),r.createPath(l)}const q="react-router-scroll-positions";let Y={};function J(e){let{getKey:t,storageKey:n}=void 0===e?{}:e,{router:a}=B(k.UseScrollRestoration),{restoreScrollPosition:u,preventScrollReset:c}=H(M.UseScrollRestoration),{basename:l}=i.useContext(r.UNSAFE_NavigationContext),f=r.useLocation(),d=r.useMatches(),m=r.useNavigation();i.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),function(e,t){let{capture:n}=t||{};i.useEffect((()=>{let t=null!=n?{capture:n}:void 0;return window.addEventListener("pagehide",e,t),()=>{window.removeEventListener("pagehide",e,t)}}),[e,n])}(i.useCallback((()=>{if("idle"===m.state){let e=(t?t(f,d):null)||f.key;Y[e]=window.scrollY}try{sessionStorage.setItem(n||q,JSON.stringify(Y))}catch(e){}window.history.scrollRestoration="auto"}),[n,t,m.state,f,d])),"undefined"!=typeof document&&(i.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(n||q);e&&(Y=JSON.parse(e))}catch(e){}}),[n]),i.useLayoutEffect((()=>{let e=t&&"/"!==l?(e,n)=>t(s({},e,{pathname:o.stripBasename(e.pathname,l)||e.pathname}),n):t,n=null==a?void 0:a.enableScrollRestoration(Y,(()=>window.scrollY),e);return()=>n&&n()}),[a,l,t]),i.useLayoutEffect((()=>{if(!1!==u)if("number"!=typeof u){if(f.hash){let e=document.getElementById(decodeURIComponent(f.hash.slice(1)));if(e)return void e.scrollIntoView()}!0!==c&&window.scrollTo(0,0)}else window.scrollTo(0,u)}),[f,u,c]))}function G(e,t){void 0===t&&(t={});let n=i.useContext(E);null==n&&o.UNSAFE_invariant(!1);let{basename:a}=B(k.useViewTransitionState),u=r.useResolvedPath(e,{relative:t.relative});if(!n.isTransitioning)return!1;let s=o.stripBasename(n.currentLocation.pathname,a)||n.currentLocation.pathname,c=o.stripBasename(n.nextLocation.pathname,a)||n.nextLocation.pathname;return null!=o.matchPath(u.pathname,c)||null!=o.matchPath(u.pathname,s)}Object.defineProperty(e,"AbortedDeferredError",{enumerable:!0,get:function(){return r.AbortedDeferredError}}),Object.defineProperty(e,"Await",{enumerable:!0,get:function(){return r.Await}}),Object.defineProperty(e,"MemoryRouter",{enumerable:!0,get:function(){return r.MemoryRouter}}),Object.defineProperty(e,"Navigate",{enumerable:!0,get:function(){return r.Navigate}}),Object.defineProperty(e,"NavigationType",{enumerable:!0,get:function(){return r.NavigationType}}),Object.defineProperty(e,"Outlet",{enumerable:!0,get:function(){return r.Outlet}}),Object.defineProperty(e,"Route",{enumerable:!0,get:function(){return r.Route}}),Object.defineProperty(e,"Router",{enumerable:!0,get:function(){return r.Router}}),Object.defineProperty(e,"Routes",{enumerable:!0,get:function(){return r.Routes}}),Object.defineProperty(e,"UNSAFE_DataRouterContext",{enumerable:!0,get:function(){return r.UNSAFE_DataRouterContext}}),Object.defineProperty(e,"UNSAFE_DataRouterStateContext",{enumerable:!0,get:function(){return r.UNSAFE_DataRouterStateContext}}),Object.defineProperty(e,"UNSAFE_LocationContext",{enumerable:!0,get:function(){return r.UNSAFE_LocationContext}}),Object.defineProperty(e,"UNSAFE_NavigationContext",{enumerable:!0,get:function(){return r.UNSAFE_NavigationContext}}),Object.defineProperty(e,"UNSAFE_RouteContext",{enumerable:!0,get:function(){return r.UNSAFE_RouteContext}}),Object.defineProperty(e,"UNSAFE_useRouteId",{enumerable:!0,get:function(){return r.UNSAFE_useRouteId}}),Object.defineProperty(e,"createMemoryRouter",{enumerable:!0,get:function(){return r.createMemoryRouter}}),Object.defineProperty(e,"createPath",{enumerable:!0,get:function(){return r.createPath}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return r.createRoutesFromChildren}}),Object.defineProperty(e,"createRoutesFromElements",{enumerable:!0,get:function(){return r.createRoutesFromElements}}),Object.defineProperty(e,"defer",{enumerable:!0,get:function(){return r.defer}}),Object.defineProperty(e,"generatePath",{enumerable:!0,get:function(){return r.generatePath}}),Object.defineProperty(e,"isRouteErrorResponse",{enumerable:!0,get:function(){return r.isRouteErrorResponse}}),Object.defineProperty(e,"json",{enumerable:!0,get:function(){return r.json}}),Object.defineProperty(e,"matchPath",{enumerable:!0,get:function(){return r.matchPath}}),Object.defineProperty(e,"matchRoutes",{enumerable:!0,get:function(){return r.matchRoutes}}),Object.defineProperty(e,"parsePath",{enumerable:!0,get:function(){return r.parsePath}}),Object.defineProperty(e,"redirect",{enumerable:!0,get:function(){return r.redirect}}),Object.defineProperty(e,"redirectDocument",{enumerable:!0,get:function(){return r.redirectDocument}}),Object.defineProperty(e,"renderMatches",{enumerable:!0,get:function(){return r.renderMatches}}),Object.defineProperty(e,"replace",{enumerable:!0,get:function(){return r.replace}}),Object.defineProperty(e,"resolvePath",{enumerable:!0,get:function(){return r.resolvePath}}),Object.defineProperty(e,"useActionData",{enumerable:!0,get:function(){return r.useActionData}}),Object.defineProperty(e,"useAsyncError",{enumerable:!0,get:function(){return r.useAsyncError}}),Object.defineProperty(e,"useAsyncValue",{enumerable:!0,get:function(){return r.useAsyncValue}}),Object.defineProperty(e,"useBlocker",{enumerable:!0,get:function(){return r.useBlocker}}),Object.defineProperty(e,"useHref",{enumerable:!0,get:function(){return r.useHref}}),Object.defineProperty(e,"useInRouterContext",{enumerable:!0,get:function(){return r.useInRouterContext}}),Object.defineProperty(e,"useLoaderData",{enumerable:!0,get:function(){return r.useLoaderData}}),Object.defineProperty(e,"useLocation",{enumerable:!0,get:function(){return r.useLocation}}),Object.defineProperty(e,"useMatch",{enumerable:!0,get:function(){return r.useMatch}}),Object.defineProperty(e,"useMatches",{enumerable:!0,get:function(){return r.useMatches}}),Object.defineProperty(e,"useNavigate",{enumerable:!0,get:function(){return r.useNavigate}}),Object.defineProperty(e,"useNavigation",{enumerable:!0,get:function(){return r.useNavigation}}),Object.defineProperty(e,"useNavigationType",{enumerable:!0,get:function(){return r.useNavigationType}}),Object.defineProperty(e,"useOutlet",{enumerable:!0,get:function(){return r.useOutlet}}),Object.defineProperty(e,"useOutletContext",{enumerable:!0,get:function(){return r.useOutletContext}}),Object.defineProperty(e,"useParams",{enumerable:!0,get:function(){return r.useParams}}),Object.defineProperty(e,"useResolvedPath",{enumerable:!0,get:function(){return r.useResolvedPath}}),Object.defineProperty(e,"useRevalidator",{enumerable:!0,get:function(){return r.useRevalidator}}),Object.defineProperty(e,"useRouteError",{enumerable:!0,get:function(){return r.useRouteError}}),Object.defineProperty(e,"useRouteLoaderData",{enumerable:!0,get:function(){return r.useRouteLoaderData}}),Object.defineProperty(e,"useRoutes",{enumerable:!0,get:function(){return r.useRoutes}}),Object.defineProperty(e,"UNSAFE_ErrorResponseImpl",{enumerable:!0,get:function(){return o.UNSAFE_ErrorResponseImpl}}),e.BrowserRouter=function(e){let{basename:t,children:n,future:a,window:u}=e,s=i.useRef();null==s.current&&(s.current=o.createBrowserHistory({window:u,v5Compat:!0}));let c=s.current,[l,f]=i.useState({action:c.action,location:c.location}),{v7_startTransition:d}=a||{},m=i.useCallback((e=>{d&&O?O((()=>f(e))):f(e)}),[f,d]);return i.useLayoutEffect((()=>c.listen(m)),[c,m]),i.useEffect((()=>r.UNSAFE_logV6DeprecationWarnings(a)),[a]),i.createElement(r.Router,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:c,future:a})},e.Form=D,e.HashRouter=function(e){let{basename:t,children:n,future:a,window:u}=e,s=i.useRef();null==s.current&&(s.current=o.createHashHistory({window:u,v5Compat:!0}));let c=s.current,[l,f]=i.useState({action:c.action,location:c.location}),{v7_startTransition:d}=a||{},m=i.useCallback((e=>{d&&O?O((()=>f(e))):f(e)}),[f,d]);return i.useLayoutEffect((()=>c.listen(m)),[c,m]),i.useEffect((()=>r.UNSAFE_logV6DeprecationWarnings(a)),[a]),i.createElement(r.Router,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:c,future:a})},e.Link=L,e.NavLink=T,e.RouterProvider=function(e){let{fallbackElement:t,router:n,future:o}=e,[a,u]=i.useState(n.state),[s,c]=i.useState(),[l,f]=i.useState({isTransitioning:!1}),[d,m]=i.useState(),[p,v]=i.useState(),[h,b]=i.useState(),g=i.useRef(new Map),{v7_startTransition:y}=o||{},w=i.useCallback((e=>{y?function(e){O?O(e):e()}(e):e()}),[y]),R=i.useCallback(((e,t)=>{let{deletedFetchers:r,flushSync:o,viewTransitionOpts:a}=t;r.forEach((e=>g.current.delete(e))),e.fetchers.forEach(((e,t)=>{void 0!==e.data&&g.current.set(t,e.data)}));let i=null==n.window||null==n.window.document||"function"!=typeof n.window.document.startViewTransition;if(a&&!i){if(o){A((()=>{p&&(d&&d.resolve(),p.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:a.currentLocation,nextLocation:a.nextLocation})}));let t=n.window.document.startViewTransition((()=>{A((()=>u(e)))}));return t.finished.finally((()=>{A((()=>{m(void 0),v(void 0),c(void 0),f({isTransitioning:!1})}))})),void A((()=>v(t)))}p?(d&&d.resolve(),p.skipTransition(),b({state:e,currentLocation:a.currentLocation,nextLocation:a.nextLocation})):(c(e),f({isTransitioning:!0,flushSync:!1,currentLocation:a.currentLocation,nextLocation:a.nextLocation}))}else o?A((()=>u(e))):w((()=>u(e)))}),[n.window,p,d,g,w]);i.useLayoutEffect((()=>n.subscribe(R)),[n,R]),i.useEffect((()=>{l.isTransitioning&&!l.flushSync&&m(new F)}),[l]),i.useEffect((()=>{if(d&&s&&n.window){let e=s,t=d.promise,r=n.window.document.startViewTransition((async()=>{w((()=>u(e))),await t}));r.finished.finally((()=>{m(void 0),v(void 0),c(void 0),f({isTransitioning:!1})})),v(r)}}),[w,s,d,n.window]),i.useEffect((()=>{d&&s&&a.location.key===s.location.key&&d.resolve()}),[d,p,a.location,s]),i.useEffect((()=>{!l.isTransitioning&&h&&(c(h.state),f({isTransitioning:!0,flushSync:!1,currentLocation:h.currentLocation,nextLocation:h.nextLocation}),b(void 0))}),[l.isTransitioning,h]),i.useEffect((()=>{}),[]);let S=i.useMemo((()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:e=>n.navigate(e),push:(e,t,r)=>n.navigate(e,{state:t,preventScrollReset:null==r?void 0:r.preventScrollReset}),replace:(e,t,r)=>n.navigate(e,{replace:!0,state:t,preventScrollReset:null==r?void 0:r.preventScrollReset})})),[n]),N=n.basename||"/",_=i.useMemo((()=>({router:n,navigator:S,static:!1,basename:N})),[n,S,N]),j=i.useMemo((()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath})),[n.future.v7_relativeSplatPath]);return i.useEffect((()=>r.UNSAFE_logV6DeprecationWarnings(o,n.future)),[o,n.future]),i.createElement(i.Fragment,null,i.createElement(r.UNSAFE_DataRouterContext.Provider,{value:_},i.createElement(r.UNSAFE_DataRouterStateContext.Provider,{value:a},i.createElement(P.Provider,{value:g.current},i.createElement(E.Provider,{value:l},i.createElement(r.Router,{basename:N,location:a.location,navigationType:a.historyAction,navigator:S,future:j},a.initialized||n.future.v7_partialHydration?i.createElement(C,{routes:n.routes,future:n.future,state:a}):t))))),null)},e.ScrollRestoration=function(e){let{getKey:t,storageKey:n}=e;return J({getKey:t,storageKey:n}),null},e.UNSAFE_FetchersContext=P,e.UNSAFE_ViewTransitionContext=E,e.UNSAFE_useScrollRestoration=J,e.createBrowserRouter=function(e,t){return o.createRouter({basename:null==t?void 0:t.basename,future:s({},null==t?void 0:t.future,{v7_prependBasename:!0}),history:o.createBrowserHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||R(),routes:e,mapRouteProperties:r.UNSAFE_mapRouteProperties,dataStrategy:null==t?void 0:t.dataStrategy,patchRoutesOnNavigation:null==t?void 0:t.patchRoutesOnNavigation,window:null==t?void 0:t.window}).initialize()},e.createHashRouter=function(e,t){return o.createRouter({basename:null==t?void 0:t.basename,future:s({},null==t?void 0:t.future,{v7_prependBasename:!0}),history:o.createHashHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||R(),routes:e,mapRouteProperties:r.UNSAFE_mapRouteProperties,dataStrategy:null==t?void 0:t.dataStrategy,patchRoutesOnNavigation:null==t?void 0:t.patchRoutesOnNavigation,window:null==t?void 0:t.window}).initialize()},e.createSearchParams=m,e.unstable_HistoryRouter=function(e){let{basename:t,children:n,future:o,history:a}=e,[u,s]=i.useState({action:a.action,location:a.location}),{v7_startTransition:c}=o||{},l=i.useCallback((e=>{c&&O?O((()=>s(e))):s(e)}),[s,c]);return i.useLayoutEffect((()=>a.listen(l)),[a,l]),i.useEffect((()=>r.UNSAFE_logV6DeprecationWarnings(o)),[o]),i.createElement(r.Router,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:a,future:o})},e.unstable_usePrompt=function(e){let{when:t,message:n}=e,o=r.useBlocker(t);i.useEffect((()=>{if("blocked"===o.state){window.confirm(n)?setTimeout(o.proceed,0):o.reset()}}),[o,n]),i.useEffect((()=>{"blocked"!==o.state||t||o.reset()}),[o,t])},e.useBeforeUnload=function(e,t){let{capture:n}=t||{};i.useEffect((()=>{let t=null!=n?{capture:n}:void 0;return window.addEventListener("beforeunload",e,t),()=>{window.removeEventListener("beforeunload",e,t)}}),[e,n])},e.useFetcher=function(e){var t;let{key:n}=void 0===e?{}:e,{router:a}=B(k.UseFetcher),u=H(M.UseFetcher),c=i.useContext(P),l=i.useContext(r.UNSAFE_RouteContext),f=null==(t=l.matches[l.matches.length-1])?void 0:t.route.id;c||o.UNSAFE_invariant(!1),l||o.UNSAFE_invariant(!1),null==f&&o.UNSAFE_invariant(!1);let d=_?_():"",[m,p]=i.useState(n||d);n&&n!==m?p(n):m||p(V()),i.useEffect((()=>(a.getFetcher(m),()=>{a.deleteFetcher(m)})),[a,m]);let v=i.useCallback(((e,t)=>{f||o.UNSAFE_invariant(!1),a.fetch(m,f,e,t)}),[m,f,a]),h=W(),b=i.useCallback(((e,t)=>{h(e,s({},t,{navigate:!1,fetcherKey:m}))}),[m,h]),g=i.useMemo((()=>i.forwardRef(((e,t)=>i.createElement(D,s({},e,{navigate:!1,fetcherKey:m,ref:t}))))),[m]),y=u.fetchers.get(m)||o.IDLE_FETCHER,w=c.get(m);return i.useMemo((()=>s({Form:g,submit:b,load:v},y,{data:w})),[g,b,v,y,w])},e.useFetchers=function(){let e=H(M.UseFetchers);return Array.from(e.fetchers.entries()).map((e=>{let[t,n]=e;return s({},n,{key:t})}))},e.useFormAction=z,e.useLinkClickHandler=I,e.useSearchParams=function(e){let t=i.useRef(m(e)),n=i.useRef(!1),o=r.useLocation(),a=i.useMemo((()=>function(e,t){let n=m(e);return t&&t.forEach(((e,r)=>{n.has(r)||t.getAll(r).forEach((e=>{n.append(r,e)}))})),n}(o.search,n.current?null:t.current)),[o.search]),u=r.useNavigate(),s=i.useCallback(((e,t)=>{const r=m("function"==typeof e?e(a):e);n.current=!0,u("?"+r,t)}),[u,a]);return[a,s]},e.useSubmit=W,e.useViewTransitionState=G,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("react-router"),require("@remix-run/router")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","react-router","@remix-run/router"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactRouterDOM={},e.React,e.ReactDOM,e.ReactRouter,e.RemixRouter)}(this,(function(e,t,n,r,o){"use strict";function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var i=a(t),u=a(n);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}const l="get",f="application/x-www-form-urlencoded";function d(e){return null!=e&&"string"==typeof e.tagName}function m(e){return void 0===e&&(e=""),new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map((e=>[n,e])):[[n,r]])}),[]))}let p=null;const v=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function h(e){return null==e||v.has(e)?e:null}function b(e,t){let n,r,a,i,u;if(d(s=e)&&"form"===s.tagName.toLowerCase()){let u=e.getAttribute("action");r=u?o.stripBasename(u,t):null,n=e.getAttribute("method")||l,a=h(e.getAttribute("enctype"))||f,i=new FormData(e)}else if(function(e){return d(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return d(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let u=e.form;if(null==u)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||u.getAttribute("action");if(r=s?o.stripBasename(s,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||l,a=h(e.getAttribute("formenctype"))||h(u.getAttribute("enctype"))||f,i=new FormData(u,e),!function(){if(null===p)try{new FormData(document.createElement("form"),0),p=!1}catch(e){p=!0}return p}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?t+".":"";i.append(e+"x","0"),i.append(e+"y","0")}else t&&i.append(t,r)}}else{if(d(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=l,r=null,a=f,u=e}var s;return i&&"text/plain"===a&&(u=i,i=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:i,body:u}}const g=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],y=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],w=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","viewTransition"];try{window.__reactRouterVersion="6"}catch(e){}function R(){var e;let t=null==(e=window)?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=s({},t,{errors:S(t.errors)})),t}function S(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&"RouteErrorResponse"===r.__type)n[e]=new o.UNSAFE_ErrorResponseImpl(r.status,r.statusText,r.data,!0===r.internal);else if(r&&"Error"===r.__type){if(r.__subType){let t=window[r.__subType];if("function"==typeof t)try{let o=new t(r.message);o.stack="",n[e]=o}catch(e){}}if(null==n[e]){let t=new Error(r.message);t.stack="",n[e]=t}}else n[e]=r;return n}const E=i.createContext({isTransitioning:!1}),P=i.createContext(new Map),O=i.startTransition,N=u.flushSync,_=i.useId;function A(e){N?N(e):e()}class F{constructor(){this.status="pending",this.promise=new Promise(((e,t)=>{this.resolve=t=>{"pending"===this.status&&(this.status="resolved",e(t))},this.reject=e=>{"pending"===this.status&&(this.status="rejected",t(e))}}))}}const C=i.memo(j);function j(e){let{routes:t,future:n,state:o}=e;return r.UNSAFE_useRoutesImpl(t,void 0,o,n)}const x="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,U=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,L=i.forwardRef((function(e,t){let n,{onClick:a,relative:u,reloadDocument:l,replace:f,state:d,target:m,to:p,preventScrollReset:v,viewTransition:h}=e,b=c(e,g),{basename:y}=i.useContext(r.UNSAFE_NavigationContext),w=!1;if("string"==typeof p&&U.test(p)&&(n=p,x))try{let e=new URL(window.location.href),t=p.startsWith("//")?new URL(e.protocol+p):new URL(p),n=o.stripBasename(t.pathname,y);t.origin===e.origin&&null!=n?p=n+t.search+t.hash:w=!0}catch(e){}let R=r.useHref(p,{relative:u}),S=I(p,{replace:f,state:d,target:m,preventScrollReset:v,relative:u,viewTransition:h});return i.createElement("a",s({},b,{href:n||R,onClick:w||l?a:function(e){a&&a(e),e.defaultPrevented||S(e)},ref:t,target:m}))})),T=i.forwardRef((function(e,t){let{"aria-current":n="page",caseSensitive:a=!1,className:u="",end:l=!1,style:f,to:d,viewTransition:m,children:p}=e,v=c(e,y),h=r.useResolvedPath(d,{relative:v.relative}),b=r.useLocation(),g=i.useContext(r.UNSAFE_DataRouterStateContext),{navigator:w,basename:R}=i.useContext(r.UNSAFE_NavigationContext),S=null!=g&&G(h)&&!0===m,E=w.encodeLocation?w.encodeLocation(h).pathname:h.pathname,P=b.pathname,O=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;a||(P=P.toLowerCase(),O=O?O.toLowerCase():null,E=E.toLowerCase()),O&&R&&(O=o.stripBasename(O,R)||O);const N="/"!==E&&E.endsWith("/")?E.length-1:E.length;let _,A=P===E||!l&&P.startsWith(E)&&"/"===P.charAt(N),F=null!=O&&(O===E||!l&&O.startsWith(E)&&"/"===O.charAt(E.length)),C={isActive:A,isPending:F,isTransitioning:S},j=A?n:void 0;_="function"==typeof u?u(C):[u,A?"active":null,F?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let x="function"==typeof f?f(C):f;return i.createElement(L,s({},v,{"aria-current":j,className:_,ref:t,style:x,to:d,viewTransition:m}),"function"==typeof p?p(C):p)})),D=i.forwardRef(((e,t)=>{let{fetcherKey:n,navigate:r,reloadDocument:o,replace:a,state:u,method:f=l,action:d,onSubmit:m,relative:p,preventScrollReset:v,viewTransition:h}=e,b=c(e,w),g=W(),y=z(d,{relative:p}),R="get"===f.toLowerCase()?"get":"post";return i.createElement("form",s({ref:t,method:R,action:y,onSubmit:o?m:e=>{if(m&&m(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter,o=(null==t?void 0:t.getAttribute("formmethod"))||f;g(t||e.currentTarget,{fetcherKey:n,method:o,navigate:r,replace:a,state:u,relative:p,preventScrollReset:v,viewTransition:h})}},b))}));var k=function(e){return e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState",e}(k||{}),M=function(e){return e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration",e}(M||{});function B(e){let t=i.useContext(r.UNSAFE_DataRouterContext);return t||o.UNSAFE_invariant(!1),t}function H(e){let t=i.useContext(r.UNSAFE_DataRouterStateContext);return t||o.UNSAFE_invariant(!1),t}function I(e,t){let{target:n,replace:o,state:a,preventScrollReset:u,relative:s,viewTransition:c}=void 0===t?{}:t,l=r.useNavigate(),f=r.useLocation(),d=r.useResolvedPath(e,{relative:s});return i.useCallback((t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,n)){t.preventDefault();let n=void 0!==o?o:r.createPath(f)===r.createPath(d);l(e,{replace:n,state:a,preventScrollReset:u,relative:s,viewTransition:c})}}),[f,l,d,o,a,n,e,u,s,c])}let K=0,V=()=>"__"+String(++K)+"__";function W(){let{router:e}=B(k.UseSubmit),{basename:t}=i.useContext(r.UNSAFE_NavigationContext),n=r.UNSAFE_useRouteId();return i.useCallback((function(r,o){void 0===o&&(o={}),function(){if("undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}();let{action:a,method:i,encType:u,formData:s,body:c}=b(r,t);if(!1===o.navigate){let t=o.fetcherKey||V();e.fetch(t,n,o.action||a,{preventScrollReset:o.preventScrollReset,formData:s,body:c,formMethod:o.method||i,formEncType:o.encType||u,flushSync:o.flushSync})}else e.navigate(o.action||a,{preventScrollReset:o.preventScrollReset,formData:s,body:c,formMethod:o.method||i,formEncType:o.encType||u,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})}),[e,t,n])}function z(e,t){let{relative:n}=void 0===t?{}:t,{basename:a}=i.useContext(r.UNSAFE_NavigationContext),u=i.useContext(r.UNSAFE_RouteContext);u||o.UNSAFE_invariant(!1);let[c]=u.matches.slice(-1),l=s({},r.useResolvedPath(e||".",{relative:n})),f=r.useLocation();if(null==e){l.search=f.search;let e=new URLSearchParams(l.search),t=e.getAll("index");if(t.some((e=>""===e))){e.delete("index"),t.filter((e=>e)).forEach((t=>e.append("index",t)));let n=e.toString();l.search=n?"?"+n:""}}return e&&"."!==e||!c.route.index||(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),"/"!==a&&(l.pathname="/"===l.pathname?a:o.joinPaths([a,l.pathname])),r.createPath(l)}const q="react-router-scroll-positions";let Y={};function J(e){let{getKey:t,storageKey:n}=void 0===e?{}:e,{router:a}=B(k.UseScrollRestoration),{restoreScrollPosition:u,preventScrollReset:c}=H(M.UseScrollRestoration),{basename:l}=i.useContext(r.UNSAFE_NavigationContext),f=r.useLocation(),d=r.useMatches(),m=r.useNavigation();i.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),function(e,t){let{capture:n}=t||{};i.useEffect((()=>{let t=null!=n?{capture:n}:void 0;return window.addEventListener("pagehide",e,t),()=>{window.removeEventListener("pagehide",e,t)}}),[e,n])}(i.useCallback((()=>{if("idle"===m.state){let e=(t?t(f,d):null)||f.key;Y[e]=window.scrollY}try{sessionStorage.setItem(n||q,JSON.stringify(Y))}catch(e){}window.history.scrollRestoration="auto"}),[n,t,m.state,f,d])),"undefined"!=typeof document&&(i.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(n||q);e&&(Y=JSON.parse(e))}catch(e){}}),[n]),i.useLayoutEffect((()=>{let e=t&&"/"!==l?(e,n)=>t(s({},e,{pathname:o.stripBasename(e.pathname,l)||e.pathname}),n):t,n=null==a?void 0:a.enableScrollRestoration(Y,(()=>window.scrollY),e);return()=>n&&n()}),[a,l,t]),i.useLayoutEffect((()=>{if(!1!==u)if("number"!=typeof u){if(f.hash){let e=document.getElementById(decodeURIComponent(f.hash.slice(1)));if(e)return void e.scrollIntoView()}!0!==c&&window.scrollTo(0,0)}else window.scrollTo(0,u)}),[f,u,c]))}function G(e,t){void 0===t&&(t={});let n=i.useContext(E);null==n&&o.UNSAFE_invariant(!1);let{basename:a}=B(k.useViewTransitionState),u=r.useResolvedPath(e,{relative:t.relative});if(!n.isTransitioning)return!1;let s=o.stripBasename(n.currentLocation.pathname,a)||n.currentLocation.pathname,c=o.stripBasename(n.nextLocation.pathname,a)||n.nextLocation.pathname;return null!=o.matchPath(u.pathname,c)||null!=o.matchPath(u.pathname,s)}Object.defineProperty(e,"AbortedDeferredError",{enumerable:!0,get:function(){return r.AbortedDeferredError}}),Object.defineProperty(e,"Await",{enumerable:!0,get:function(){return r.Await}}),Object.defineProperty(e,"MemoryRouter",{enumerable:!0,get:function(){return r.MemoryRouter}}),Object.defineProperty(e,"Navigate",{enumerable:!0,get:function(){return r.Navigate}}),Object.defineProperty(e,"NavigationType",{enumerable:!0,get:function(){return r.NavigationType}}),Object.defineProperty(e,"Outlet",{enumerable:!0,get:function(){return r.Outlet}}),Object.defineProperty(e,"Route",{enumerable:!0,get:function(){return r.Route}}),Object.defineProperty(e,"Router",{enumerable:!0,get:function(){return r.Router}}),Object.defineProperty(e,"Routes",{enumerable:!0,get:function(){return r.Routes}}),Object.defineProperty(e,"UNSAFE_DataRouterContext",{enumerable:!0,get:function(){return r.UNSAFE_DataRouterContext}}),Object.defineProperty(e,"UNSAFE_DataRouterStateContext",{enumerable:!0,get:function(){return r.UNSAFE_DataRouterStateContext}}),Object.defineProperty(e,"UNSAFE_LocationContext",{enumerable:!0,get:function(){return r.UNSAFE_LocationContext}}),Object.defineProperty(e,"UNSAFE_NavigationContext",{enumerable:!0,get:function(){return r.UNSAFE_NavigationContext}}),Object.defineProperty(e,"UNSAFE_RouteContext",{enumerable:!0,get:function(){return r.UNSAFE_RouteContext}}),Object.defineProperty(e,"UNSAFE_useRouteId",{enumerable:!0,get:function(){return r.UNSAFE_useRouteId}}),Object.defineProperty(e,"createMemoryRouter",{enumerable:!0,get:function(){return r.createMemoryRouter}}),Object.defineProperty(e,"createPath",{enumerable:!0,get:function(){return r.createPath}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return r.createRoutesFromChildren}}),Object.defineProperty(e,"createRoutesFromElements",{enumerable:!0,get:function(){return r.createRoutesFromElements}}),Object.defineProperty(e,"defer",{enumerable:!0,get:function(){return r.defer}}),Object.defineProperty(e,"generatePath",{enumerable:!0,get:function(){return r.generatePath}}),Object.defineProperty(e,"isRouteErrorResponse",{enumerable:!0,get:function(){return r.isRouteErrorResponse}}),Object.defineProperty(e,"json",{enumerable:!0,get:function(){return r.json}}),Object.defineProperty(e,"matchPath",{enumerable:!0,get:function(){return r.matchPath}}),Object.defineProperty(e,"matchRoutes",{enumerable:!0,get:function(){return r.matchRoutes}}),Object.defineProperty(e,"parsePath",{enumerable:!0,get:function(){return r.parsePath}}),Object.defineProperty(e,"redirect",{enumerable:!0,get:function(){return r.redirect}}),Object.defineProperty(e,"redirectDocument",{enumerable:!0,get:function(){return r.redirectDocument}}),Object.defineProperty(e,"renderMatches",{enumerable:!0,get:function(){return r.renderMatches}}),Object.defineProperty(e,"replace",{enumerable:!0,get:function(){return r.replace}}),Object.defineProperty(e,"resolvePath",{enumerable:!0,get:function(){return r.resolvePath}}),Object.defineProperty(e,"useActionData",{enumerable:!0,get:function(){return r.useActionData}}),Object.defineProperty(e,"useAsyncError",{enumerable:!0,get:function(){return r.useAsyncError}}),Object.defineProperty(e,"useAsyncValue",{enumerable:!0,get:function(){return r.useAsyncValue}}),Object.defineProperty(e,"useBlocker",{enumerable:!0,get:function(){return r.useBlocker}}),Object.defineProperty(e,"useHref",{enumerable:!0,get:function(){return r.useHref}}),Object.defineProperty(e,"useInRouterContext",{enumerable:!0,get:function(){return r.useInRouterContext}}),Object.defineProperty(e,"useLoaderData",{enumerable:!0,get:function(){return r.useLoaderData}}),Object.defineProperty(e,"useLocation",{enumerable:!0,get:function(){return r.useLocation}}),Object.defineProperty(e,"useMatch",{enumerable:!0,get:function(){return r.useMatch}}),Object.defineProperty(e,"useMatches",{enumerable:!0,get:function(){return r.useMatches}}),Object.defineProperty(e,"useNavigate",{enumerable:!0,get:function(){return r.useNavigate}}),Object.defineProperty(e,"useNavigation",{enumerable:!0,get:function(){return r.useNavigation}}),Object.defineProperty(e,"useNavigationType",{enumerable:!0,get:function(){return r.useNavigationType}}),Object.defineProperty(e,"useOutlet",{enumerable:!0,get:function(){return r.useOutlet}}),Object.defineProperty(e,"useOutletContext",{enumerable:!0,get:function(){return r.useOutletContext}}),Object.defineProperty(e,"useParams",{enumerable:!0,get:function(){return r.useParams}}),Object.defineProperty(e,"useResolvedPath",{enumerable:!0,get:function(){return r.useResolvedPath}}),Object.defineProperty(e,"useRevalidator",{enumerable:!0,get:function(){return r.useRevalidator}}),Object.defineProperty(e,"useRouteError",{enumerable:!0,get:function(){return r.useRouteError}}),Object.defineProperty(e,"useRouteLoaderData",{enumerable:!0,get:function(){return r.useRouteLoaderData}}),Object.defineProperty(e,"useRoutes",{enumerable:!0,get:function(){return r.useRoutes}}),Object.defineProperty(e,"UNSAFE_ErrorResponseImpl",{enumerable:!0,get:function(){return o.UNSAFE_ErrorResponseImpl}}),e.BrowserRouter=function(e){let{basename:t,children:n,future:a,window:u}=e,s=i.useRef();null==s.current&&(s.current=o.createBrowserHistory({window:u,v5Compat:!0}));let c=s.current,[l,f]=i.useState({action:c.action,location:c.location}),{v7_startTransition:d}=a||{},m=i.useCallback((e=>{d&&O?O((()=>f(e))):f(e)}),[f,d]);return i.useLayoutEffect((()=>c.listen(m)),[c,m]),i.useEffect((()=>r.UNSAFE_logV6DeprecationWarnings(a)),[a]),i.createElement(r.Router,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:c,future:a})},e.Form=D,e.HashRouter=function(e){let{basename:t,children:n,future:a,window:u}=e,s=i.useRef();null==s.current&&(s.current=o.createHashHistory({window:u,v5Compat:!0}));let c=s.current,[l,f]=i.useState({action:c.action,location:c.location}),{v7_startTransition:d}=a||{},m=i.useCallback((e=>{d&&O?O((()=>f(e))):f(e)}),[f,d]);return i.useLayoutEffect((()=>c.listen(m)),[c,m]),i.useEffect((()=>r.UNSAFE_logV6DeprecationWarnings(a)),[a]),i.createElement(r.Router,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:c,future:a})},e.Link=L,e.NavLink=T,e.RouterProvider=function(e){let{fallbackElement:t,router:n,future:o}=e,[a,u]=i.useState(n.state),[s,c]=i.useState(),[l,f]=i.useState({isTransitioning:!1}),[d,m]=i.useState(),[p,v]=i.useState(),[h,b]=i.useState(),g=i.useRef(new Map),{v7_startTransition:y}=o||{},w=i.useCallback((e=>{y?function(e){O?O(e):e()}(e):e()}),[y]),R=i.useCallback(((e,t)=>{let{deletedFetchers:r,flushSync:o,viewTransitionOpts:a}=t;e.fetchers.forEach(((e,t)=>{void 0!==e.data&&g.current.set(t,e.data)})),r.forEach((e=>g.current.delete(e)));let i=null==n.window||null==n.window.document||"function"!=typeof n.window.document.startViewTransition;if(a&&!i){if(o){A((()=>{p&&(d&&d.resolve(),p.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:a.currentLocation,nextLocation:a.nextLocation})}));let t=n.window.document.startViewTransition((()=>{A((()=>u(e)))}));return t.finished.finally((()=>{A((()=>{m(void 0),v(void 0),c(void 0),f({isTransitioning:!1})}))})),void A((()=>v(t)))}p?(d&&d.resolve(),p.skipTransition(),b({state:e,currentLocation:a.currentLocation,nextLocation:a.nextLocation})):(c(e),f({isTransitioning:!0,flushSync:!1,currentLocation:a.currentLocation,nextLocation:a.nextLocation}))}else o?A((()=>u(e))):w((()=>u(e)))}),[n.window,p,d,g,w]);i.useLayoutEffect((()=>n.subscribe(R)),[n,R]),i.useEffect((()=>{l.isTransitioning&&!l.flushSync&&m(new F)}),[l]),i.useEffect((()=>{if(d&&s&&n.window){let e=s,t=d.promise,r=n.window.document.startViewTransition((async()=>{w((()=>u(e))),await t}));r.finished.finally((()=>{m(void 0),v(void 0),c(void 0),f({isTransitioning:!1})})),v(r)}}),[w,s,d,n.window]),i.useEffect((()=>{d&&s&&a.location.key===s.location.key&&d.resolve()}),[d,p,a.location,s]),i.useEffect((()=>{!l.isTransitioning&&h&&(c(h.state),f({isTransitioning:!0,flushSync:!1,currentLocation:h.currentLocation,nextLocation:h.nextLocation}),b(void 0))}),[l.isTransitioning,h]),i.useEffect((()=>{}),[]);let S=i.useMemo((()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:e=>n.navigate(e),push:(e,t,r)=>n.navigate(e,{state:t,preventScrollReset:null==r?void 0:r.preventScrollReset}),replace:(e,t,r)=>n.navigate(e,{replace:!0,state:t,preventScrollReset:null==r?void 0:r.preventScrollReset})})),[n]),N=n.basename||"/",_=i.useMemo((()=>({router:n,navigator:S,static:!1,basename:N})),[n,S,N]),j=i.useMemo((()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath})),[n.future.v7_relativeSplatPath]);return i.useEffect((()=>r.UNSAFE_logV6DeprecationWarnings(o,n.future)),[o,n.future]),i.createElement(i.Fragment,null,i.createElement(r.UNSAFE_DataRouterContext.Provider,{value:_},i.createElement(r.UNSAFE_DataRouterStateContext.Provider,{value:a},i.createElement(P.Provider,{value:g.current},i.createElement(E.Provider,{value:l},i.createElement(r.Router,{basename:N,location:a.location,navigationType:a.historyAction,navigator:S,future:j},a.initialized||n.future.v7_partialHydration?i.createElement(C,{routes:n.routes,future:n.future,state:a}):t))))),null)},e.ScrollRestoration=function(e){let{getKey:t,storageKey:n}=e;return J({getKey:t,storageKey:n}),null},e.UNSAFE_FetchersContext=P,e.UNSAFE_ViewTransitionContext=E,e.UNSAFE_useScrollRestoration=J,e.createBrowserRouter=function(e,t){return o.createRouter({basename:null==t?void 0:t.basename,future:s({},null==t?void 0:t.future,{v7_prependBasename:!0}),history:o.createBrowserHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||R(),routes:e,mapRouteProperties:r.UNSAFE_mapRouteProperties,dataStrategy:null==t?void 0:t.dataStrategy,patchRoutesOnNavigation:null==t?void 0:t.patchRoutesOnNavigation,window:null==t?void 0:t.window}).initialize()},e.createHashRouter=function(e,t){return o.createRouter({basename:null==t?void 0:t.basename,future:s({},null==t?void 0:t.future,{v7_prependBasename:!0}),history:o.createHashHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||R(),routes:e,mapRouteProperties:r.UNSAFE_mapRouteProperties,dataStrategy:null==t?void 0:t.dataStrategy,patchRoutesOnNavigation:null==t?void 0:t.patchRoutesOnNavigation,window:null==t?void 0:t.window}).initialize()},e.createSearchParams=m,e.unstable_HistoryRouter=function(e){let{basename:t,children:n,future:o,history:a}=e,[u,s]=i.useState({action:a.action,location:a.location}),{v7_startTransition:c}=o||{},l=i.useCallback((e=>{c&&O?O((()=>s(e))):s(e)}),[s,c]);return i.useLayoutEffect((()=>a.listen(l)),[a,l]),i.useEffect((()=>r.UNSAFE_logV6DeprecationWarnings(o)),[o]),i.createElement(r.Router,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:a,future:o})},e.unstable_usePrompt=function(e){let{when:t,message:n}=e,o=r.useBlocker(t);i.useEffect((()=>{if("blocked"===o.state){window.confirm(n)?setTimeout(o.proceed,0):o.reset()}}),[o,n]),i.useEffect((()=>{"blocked"!==o.state||t||o.reset()}),[o,t])},e.useBeforeUnload=function(e,t){let{capture:n}=t||{};i.useEffect((()=>{let t=null!=n?{capture:n}:void 0;return window.addEventListener("beforeunload",e,t),()=>{window.removeEventListener("beforeunload",e,t)}}),[e,n])},e.useFetcher=function(e){var t;let{key:n}=void 0===e?{}:e,{router:a}=B(k.UseFetcher),u=H(M.UseFetcher),c=i.useContext(P),l=i.useContext(r.UNSAFE_RouteContext),f=null==(t=l.matches[l.matches.length-1])?void 0:t.route.id;c||o.UNSAFE_invariant(!1),l||o.UNSAFE_invariant(!1),null==f&&o.UNSAFE_invariant(!1);let d=_?_():"",[m,p]=i.useState(n||d);n&&n!==m?p(n):m||p(V()),i.useEffect((()=>(a.getFetcher(m),()=>{a.deleteFetcher(m)})),[a,m]);let v=i.useCallback(((e,t)=>{f||o.UNSAFE_invariant(!1),a.fetch(m,f,e,t)}),[m,f,a]),h=W(),b=i.useCallback(((e,t)=>{h(e,s({},t,{navigate:!1,fetcherKey:m}))}),[m,h]),g=i.useMemo((()=>i.forwardRef(((e,t)=>i.createElement(D,s({},e,{navigate:!1,fetcherKey:m,ref:t}))))),[m]),y=u.fetchers.get(m)||o.IDLE_FETCHER,w=c.get(m);return i.useMemo((()=>s({Form:g,submit:b,load:v},y,{data:w})),[g,b,v,y,w])},e.useFetchers=function(){let e=H(M.UseFetchers);return Array.from(e.fetchers.entries()).map((e=>{let[t,n]=e;return s({},n,{key:t})}))},e.useFormAction=z,e.useLinkClickHandler=I,e.useSearchParams=function(e){let t=i.useRef(m(e)),n=i.useRef(!1),o=r.useLocation(),a=i.useMemo((()=>function(e,t){let n=m(e);return t&&t.forEach(((e,r)=>{n.has(r)||t.getAll(r).forEach((e=>{n.append(r,e)}))})),n}(o.search,n.current?null:t.current)),[o.search]),u=r.useNavigate(),s=i.useCallback(((e,t)=>{const r=m("function"==typeof e?e(a):e);n.current=!0,u("?"+r,t)}),[u,a]);return[a,s]},e.useSubmit=W,e.useViewTransitionState=G,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=react-router-dom.production.min.js.map |
{ | ||
"name": "react-router-dom", | ||
"version": "6.28.1", | ||
"version": "6.28.2-pre.0", | ||
"description": "Declarative routing for React web applications", | ||
@@ -26,4 +26,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@remix-run/router": "1.21.0", | ||
"react-router": "6.28.1" | ||
"@remix-run/router": "1.21.1-pre.0", | ||
"react-router": "6.28.2-pre.0" | ||
}, | ||
@@ -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 too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
901544
3
+ Added@remix-run/router@1.21.1-pre.0(transitive)
+ Addedreact-router@6.28.2-pre.0(transitive)
- Removed@remix-run/router@1.21.0(transitive)
- Removedreact-router@6.28.1(transitive)
Updatedreact-router@6.28.2-pre.0