react-router-dom 6.4.0-pre.4 → 6.4.0-pre.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router DOM v6.4.0-pre.4
2
+ * React Router DOM v6.4.0-pre.7
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -420,9 +420,10 @@ const FormImpl = /*#__PURE__*/React.forwardRef(({
420
420
  action: _action = ".",
421
421
  onSubmit,
422
422
  fetcherKey,
423
+ routeId,
423
424
  ...props
424
425
  }, forwardedRef) => {
425
- let submit = useSubmitImpl(fetcherKey);
426
+ let submit = useSubmitImpl(fetcherKey, routeId);
426
427
  let formMethod = _method.toLowerCase() === "get" ? "get" : "post";
427
428
  let formAction = useFormAction(_action);
428
429
 
@@ -513,13 +514,11 @@ function useSearchParams(defaultInit) {
513
514
  let searchParams = React.useMemo(() => getSearchParamsForLocation(location.search, defaultSearchParamsRef.current), [location.search]);
514
515
  let navigate = useNavigate();
515
516
  let setSearchParams = React.useCallback((nextInit, navigateOptions) => {
516
- navigate("?" + createSearchParams(nextInit), navigateOptions);
517
- }, [navigate]);
517
+ const newSearchParams = createSearchParams(typeof nextInit === "function" ? nextInit(searchParams) : nextInit);
518
+ navigate("?" + newSearchParams, navigateOptions);
519
+ }, [navigate, searchParams]);
518
520
  return [searchParams, setSearchParams];
519
521
  }
520
- /**
521
- * Submits a HTML `<form>` to the server without reloading the page.
522
- */
523
522
 
524
523
  /**
525
524
  * Returns a function that may be used to programmatically submit a form (or
@@ -529,7 +528,7 @@ function useSubmit() {
529
528
  return useSubmitImpl();
530
529
  }
531
530
 
532
- function useSubmitImpl(fetcherKey) {
531
+ function useSubmitImpl(fetcherKey, routeId) {
533
532
  let router = React.useContext(UNSAFE_DataRouterContext);
534
533
  let defaultAction = useFormAction();
535
534
  return React.useCallback((target, options = {}) => {
@@ -556,11 +555,12 @@ function useSubmitImpl(fetcherKey) {
556
555
  };
557
556
 
558
557
  if (fetcherKey) {
559
- router.fetch(fetcherKey, href, opts);
558
+ !(routeId != null) ? invariant(false, "No routeId available for useFetcher()") : void 0;
559
+ router.fetch(fetcherKey, routeId, href, opts);
560
560
  } else {
561
561
  router.navigate(href, opts);
562
562
  }
563
- }, [defaultAction, router, fetcherKey]);
563
+ }, [defaultAction, router, fetcherKey, routeId]);
564
564
  }
565
565
 
566
566
  function useFormAction(action = ".") {
@@ -579,11 +579,12 @@ function useFormAction(action = ".") {
579
579
  return pathname + search;
580
580
  }
581
581
 
582
- function createFetcherForm(fetcherKey) {
582
+ function createFetcherForm(fetcherKey, routeId) {
583
583
  let FetcherForm = /*#__PURE__*/React.forwardRef((props, ref) => {
584
584
  return /*#__PURE__*/React.createElement(FormImpl, Object.assign({}, props, {
585
585
  ref: ref,
586
- fetcherKey: fetcherKey
586
+ fetcherKey: fetcherKey,
587
+ routeId: routeId
587
588
  }));
588
589
  });
589
590
 
@@ -603,13 +604,21 @@ let fetcherId = 0;
603
604
  function useFetcher() {
604
605
  let router = React.useContext(UNSAFE_DataRouterContext);
605
606
  !router ? invariant(false, `useFetcher must be used within a DataRouter`) : void 0;
607
+ let route = React.useContext(UNSAFE_RouteContext);
608
+ !route ? invariant(false, `useFetcher must be used inside a RouteContext`) : void 0;
609
+ let routeId = route.matches[route.matches.length - 1]?.route.id;
610
+ !(routeId != null) ? invariant(false, `useFetcher can only be used on routes that contain a unique "id"`) : void 0;
606
611
  let [fetcherKey] = React.useState(() => String(++fetcherId));
607
- let [Form] = React.useState(() => createFetcherForm(fetcherKey));
612
+ let [Form] = React.useState(() => {
613
+ !routeId ? invariant(false, `No routeId available for fetcher.Form()`) : void 0;
614
+ return createFetcherForm(fetcherKey, routeId);
615
+ });
608
616
  let [load] = React.useState(() => href => {
609
- !router ? invariant(false, `No router available for fetcher.load()`) : void 0;
610
- router.fetch(fetcherKey, href);
617
+ !router ? invariant(false, "No router available for fetcher.load()") : void 0;
618
+ !routeId ? invariant(false, "No routeId available for fetcher.load()") : void 0;
619
+ router.fetch(fetcherKey, routeId, href);
611
620
  });
612
- let submit = useSubmitImpl(fetcherKey);
621
+ let submit = useSubmitImpl(fetcherKey, routeId);
613
622
  let fetcher = router.getFetcher(fetcherKey);
614
623
  let fetcherWithComponents = React.useMemo(() => ({
615
624
  Form,
@@ -623,7 +632,7 @@ function useFetcher() {
623
632
  // fetcher is no longer around.
624
633
  return () => {
625
634
  if (!router) {
626
- console.warn("No fetcher available to clean up from useFetcher()");
635
+ console.warn(`No fetcher available to clean up from useFetcher()`);
627
636
  return;
628
637
  }
629
638
 
@@ -1 +1 @@
1
- {"version":3,"file":"react-router-dom.development.js","sources":["../dom.ts","../index.tsx"],"sourcesContent":["import type { FormEncType, FormMethod } from \"@remix-run/router\";\n\nexport const defaultMethod = \"get\";\nconst defaultEncType = \"application/x-www-form-urlencoded\";\n\nexport function isHtmlElement(object: any): object is HTMLElement {\n return object != null && typeof object.tagName === \"string\";\n}\n\nexport function isButtonElement(object: any): object is HTMLButtonElement {\n return isHtmlElement(object) && object.tagName.toLowerCase() === \"button\";\n}\n\nexport function isFormElement(object: any): object is HTMLFormElement {\n return isHtmlElement(object) && object.tagName.toLowerCase() === \"form\";\n}\n\nexport function isInputElement(object: any): object is HTMLInputElement {\n return isHtmlElement(object) && object.tagName.toLowerCase() === \"input\";\n}\n\ntype LimitedMouseEvent = Pick<\n MouseEvent,\n \"button\" | \"metaKey\" | \"altKey\" | \"ctrlKey\" | \"shiftKey\"\n>;\n\nfunction isModifiedEvent(event: LimitedMouseEvent) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nexport function shouldProcessLinkClick(\n event: LimitedMouseEvent,\n target?: string\n) {\n return (\n event.button === 0 && // Ignore everything but left clicks\n (!target || target === \"_self\") && // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n );\n}\n\nexport type ParamKeyValuePair = [string, string];\n\nexport type URLSearchParamsInit =\n | string\n | ParamKeyValuePair[]\n | Record<string, string | string[]>\n | URLSearchParams;\n\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nexport function createSearchParams(\n init: URLSearchParamsInit = \"\"\n): URLSearchParams {\n return new URLSearchParams(\n typeof init === \"string\" ||\n Array.isArray(init) ||\n init instanceof URLSearchParams\n ? init\n : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(\n Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]]\n );\n }, [] as ParamKeyValuePair[])\n );\n}\n\nexport function getSearchParamsForLocation(\n locationSearch: string,\n defaultSearchParams: URLSearchParams\n) {\n let searchParams = createSearchParams(locationSearch);\n\n for (let key of defaultSearchParams.keys()) {\n if (!searchParams.has(key)) {\n defaultSearchParams.getAll(key).forEach((value) => {\n searchParams.append(key, value);\n });\n }\n }\n\n return searchParams;\n}\n\nexport interface SubmitOptions {\n /**\n * The HTTP method used to submit the form. Overrides `<form method>`.\n * Defaults to \"GET\".\n */\n method?: FormMethod;\n\n /**\n * The action URL path used to submit the form. Overrides `<form action>`.\n * Defaults to the path of the current route.\n *\n * Note: It is assumed the path is already resolved. If you need to resolve a\n * relative path, use `useFormAction`.\n */\n action?: string;\n\n /**\n * The action URL used to submit the form. Overrides `<form encType>`.\n * Defaults to \"application/x-www-form-urlencoded\".\n */\n encType?: FormEncType;\n\n /**\n * Set `true` to replace the current entry in the browser's history stack\n * instead of creating a new one (i.e. stay on \"the same page\"). Defaults\n * to `false`.\n */\n replace?: boolean;\n}\n\nexport function getFormSubmissionInfo(\n target:\n | HTMLFormElement\n | HTMLButtonElement\n | HTMLInputElement\n | FormData\n | URLSearchParams\n | { [name: string]: string }\n | null,\n defaultAction: string,\n options: SubmitOptions\n): {\n url: URL;\n method: string;\n encType: string;\n formData: FormData;\n} {\n let method: string;\n let action: string;\n let encType: string;\n let formData: FormData;\n\n if (isFormElement(target)) {\n let submissionTrigger: HTMLButtonElement | HTMLInputElement = (\n options as any\n ).submissionTrigger;\n\n method = options.method || target.getAttribute(\"method\") || defaultMethod;\n action = options.action || target.getAttribute(\"action\") || defaultAction;\n encType =\n options.encType || target.getAttribute(\"enctype\") || defaultEncType;\n\n formData = new FormData(target);\n\n if (submissionTrigger && submissionTrigger.name) {\n formData.append(submissionTrigger.name, submissionTrigger.value);\n }\n } else if (\n isButtonElement(target) ||\n (isInputElement(target) &&\n (target.type === \"submit\" || target.type === \"image\"))\n ) {\n let form = target.form;\n\n if (form == null) {\n throw new Error(\n `Cannot submit a <button> or <input type=\"submit\"> without a <form>`\n );\n }\n\n // <button>/<input type=\"submit\"> may override attributes of <form>\n\n method =\n options.method ||\n target.getAttribute(\"formmethod\") ||\n form.getAttribute(\"method\") ||\n defaultMethod;\n action =\n options.action ||\n target.getAttribute(\"formaction\") ||\n form.getAttribute(\"action\") ||\n defaultAction;\n encType =\n options.encType ||\n target.getAttribute(\"formenctype\") ||\n form.getAttribute(\"enctype\") ||\n defaultEncType;\n\n formData = new FormData(form);\n\n // Include name + value from a <button>\n if (target.name) {\n formData.set(target.name, target.value);\n }\n } else if (isHtmlElement(target)) {\n throw new Error(\n `Cannot submit element that is not <form>, <button>, or ` +\n `<input type=\"submit|image\">`\n );\n } else {\n method = options.method || defaultMethod;\n action = options.action || defaultAction;\n encType = options.encType || defaultEncType;\n\n if (target instanceof FormData) {\n formData = target;\n } else {\n formData = new FormData();\n\n if (target instanceof URLSearchParams) {\n for (let [name, value] of target) {\n formData.append(name, value);\n }\n } else if (target != null) {\n for (let name of Object.keys(target)) {\n formData.append(name, target[name]);\n }\n }\n }\n }\n\n let { protocol, host } = window.location;\n let url = new URL(action, `${protocol}//${host}`);\n\n return { url, method, encType, formData };\n}\n","/**\n * NOTE: If you refactor this to split up the modules into separate files,\n * you'll need to update the rollup config for react-router-dom-v5-compat.\n */\nimport * as React from \"react\";\nimport {\n Router,\n createPath,\n useHref,\n useLocation,\n useMatch,\n useNavigate,\n useRenderDataRouter,\n useResolvedPath,\n UNSAFE_RouteContext,\n UNSAFE_DataRouterContext,\n UNSAFE_DataRouterStateContext,\n} from \"react-router\";\nimport type { To } from \"react-router\";\nimport type {\n BrowserHistory,\n Fetcher,\n FormEncType,\n FormMethod,\n HashHistory,\n History,\n HydrationState,\n GetScrollRestorationKeyFunction,\n RouteObject,\n} from \"@remix-run/router\";\nimport {\n createBrowserHistory,\n createHashHistory,\n createBrowserRouter,\n createHashRouter,\n invariant,\n matchPath,\n} from \"@remix-run/router\";\n\nimport type {\n SubmitOptions,\n ParamKeyValuePair,\n URLSearchParamsInit,\n} from \"./dom\";\nimport {\n createSearchParams,\n defaultMethod,\n getFormSubmissionInfo,\n getSearchParamsForLocation,\n shouldProcessLinkClick,\n} from \"./dom\";\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Re-exports\n////////////////////////////////////////////////////////////////////////////////\n\nexport type { ParamKeyValuePair, URLSearchParamsInit };\nexport { createSearchParams };\n\n// Note: Keep in sync with react-router exports!\nexport type {\n ActionFunction,\n DataMemoryRouterProps,\n DataRouteMatch,\n Fetcher,\n Hash,\n IndexRouteProps,\n JsonFunction,\n LayoutRouteProps,\n LoaderFunction,\n Location,\n MemoryRouterProps,\n NavigateFunction,\n NavigateOptions,\n NavigateProps,\n Navigation,\n Navigator,\n OutletProps,\n Params,\n Path,\n PathMatch,\n Pathname,\n PathPattern,\n PathRouteProps,\n RedirectFunction,\n RouteMatch,\n RouteObject,\n RouteProps,\n RouterProps,\n RoutesProps,\n Search,\n ShouldRevalidateFunction,\n To,\n} from \"react-router\";\nexport {\n DataMemoryRouter,\n MemoryRouter,\n Navigate,\n NavigationType,\n Outlet,\n Route,\n Router,\n Routes,\n createPath,\n createRoutesFromChildren,\n isRouteErrorResponse,\n generatePath,\n json,\n matchPath,\n matchRoutes,\n parsePath,\n redirect,\n renderMatches,\n resolvePath,\n useActionData,\n useHref,\n useInRouterContext,\n useLoaderData,\n useLocation,\n useMatch,\n useMatches,\n useNavigate,\n useNavigation,\n useNavigationType,\n useOutlet,\n useOutletContext,\n useParams,\n useResolvedPath,\n useRevalidator,\n useRouteError,\n useRouteLoaderData,\n useRoutes,\n} from \"react-router\";\n\n///////////////////////////////////////////////////////////////////////////////\n// DANGER! PLEASE READ ME!\n// We provide these exports as an escape hatch in the event that you need any\n// routing data that we don't provide an explicit API for. With that said, we\n// want to cover your use case if we can, so if you feel the need to use these\n// we want to hear from you. Let us know what you're building and we'll do our\n// best to make sure we can support you!\n//\n// We consider these exports an implementation detail and do not guarantee\n// against any breaking changes, regardless of the semver release. Use with\n// extreme caution and only if you understand the consequences. Godspeed.\n///////////////////////////////////////////////////////////////////////////////\n\n/** @internal */\nexport {\n UNSAFE_NavigationContext,\n UNSAFE_LocationContext,\n UNSAFE_RouteContext,\n UNSAFE_DataRouterContext,\n UNSAFE_DataRouterStateContext,\n useRenderDataRouter,\n} from \"react-router\";\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Components\n////////////////////////////////////////////////////////////////////////////////\n\nexport interface DataBrowserRouterProps {\n children?: React.ReactNode;\n hydrationData?: HydrationState;\n fallbackElement?: React.ReactNode;\n routes?: RouteObject[];\n window?: Window;\n}\n\nexport function DataBrowserRouter({\n children,\n fallbackElement,\n hydrationData,\n routes,\n window,\n}: DataBrowserRouterProps): React.ReactElement {\n return useRenderDataRouter({\n children,\n fallbackElement,\n routes,\n createRouter: (routes) =>\n createBrowserRouter({\n routes,\n hydrationData,\n window,\n }),\n });\n}\n\nexport interface DataHashRouterProps {\n children?: React.ReactNode;\n hydrationData?: HydrationState;\n fallbackElement?: React.ReactNode;\n routes?: RouteObject[];\n window?: Window;\n}\n\nexport function DataHashRouter({\n children,\n hydrationData,\n fallbackElement,\n routes,\n window,\n}: DataBrowserRouterProps): React.ReactElement {\n return useRenderDataRouter({\n children,\n fallbackElement,\n routes,\n createRouter: (routes) =>\n createHashRouter({\n routes,\n hydrationData,\n window,\n }),\n });\n}\n\nexport interface BrowserRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A `<Router>` for use in web browsers. Provides the cleanest URLs.\n */\nexport function BrowserRouter({\n basename,\n children,\n window,\n}: BrowserRouterProps) {\n let historyRef = React.useRef<BrowserHistory>();\n if (historyRef.current == null) {\n historyRef.current = createBrowserHistory({ window, v5Compat: true });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location,\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface HashRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A `<Router>` for use in web browsers. Stores the location in the hash\n * portion of the URL so it is not sent to the server.\n */\nexport function HashRouter({ basename, children, window }: HashRouterProps) {\n let historyRef = React.useRef<HashHistory>();\n if (historyRef.current == null) {\n historyRef.current = createHashHistory({ window, v5Compat: true });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location,\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface HistoryRouterProps {\n basename?: string;\n children?: React.ReactNode;\n history: History;\n}\n\n/**\n * A `<Router>` that accepts a pre-instantiated history object. It's important\n * to note that using your own history object is highly discouraged and may add\n * two versions of the history library to your bundles unless you use the same\n * version of the history library that React Router uses internally.\n */\nfunction HistoryRouter({ basename, children, history }: HistoryRouterProps) {\n const [state, setState] = React.useState({\n action: history.action,\n location: history.location,\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nif (__DEV__) {\n HistoryRouter.displayName = \"unstable_HistoryRouter\";\n}\n\nexport { HistoryRouter as unstable_HistoryRouter };\n\nexport interface LinkProps\n extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n reloadDocument?: boolean;\n replace?: boolean;\n state?: any;\n resetScroll?: boolean;\n to: To;\n}\n\n/**\n * The public API for rendering a history-aware <a>.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function LinkWithRef(\n {\n onClick,\n reloadDocument,\n replace,\n state,\n target,\n to,\n resetScroll,\n ...rest\n },\n ref\n ) {\n let href = useHref(to);\n let internalOnClick = useLinkClickHandler(to, {\n replace,\n state,\n target,\n resetScroll,\n });\n function handleClick(\n event: React.MouseEvent<HTMLAnchorElement, MouseEvent>\n ) {\n if (onClick) onClick(event);\n if (!event.defaultPrevented && !reloadDocument) {\n internalOnClick(event);\n }\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n <a\n {...rest}\n href={href}\n onClick={handleClick}\n ref={ref}\n target={target}\n />\n );\n }\n);\n\nif (__DEV__) {\n Link.displayName = \"Link\";\n}\n\nexport interface NavLinkProps\n extends Omit<LinkProps, \"className\" | \"style\" | \"children\"> {\n children?:\n | React.ReactNode\n | ((props: { isActive: boolean; isPending: boolean }) => React.ReactNode);\n caseSensitive?: boolean;\n className?:\n | string\n | ((props: {\n isActive: boolean;\n isPending: boolean;\n }) => string | undefined);\n end?: boolean;\n style?:\n | React.CSSProperties\n | ((props: {\n isActive: boolean;\n isPending: boolean;\n }) => React.CSSProperties | undefined);\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nexport const NavLink = React.forwardRef<HTMLAnchorElement, NavLinkProps>(\n function NavLinkWithRef(\n {\n \"aria-current\": ariaCurrentProp = \"page\",\n caseSensitive = false,\n className: classNameProp = \"\",\n end = false,\n style: styleProp,\n to,\n children,\n ...rest\n },\n ref\n ) {\n let path = useResolvedPath(to);\n let match = useMatch({ path: path.pathname, end, caseSensitive });\n\n let routerState = React.useContext(UNSAFE_DataRouterStateContext);\n let nextLocation = routerState?.navigation.location;\n let nextPath = useResolvedPath(nextLocation || \"\");\n let nextMatch = React.useMemo(\n () =>\n nextLocation\n ? matchPath(\n { path: path.pathname, end, caseSensitive },\n nextPath.pathname\n )\n : null,\n [nextLocation, path.pathname, caseSensitive, end, nextPath.pathname]\n );\n\n let isPending = nextMatch != null;\n let isActive = match != null;\n\n let ariaCurrent = isActive ? ariaCurrentProp : undefined;\n\n let className: string | undefined;\n if (typeof classNameProp === \"function\") {\n className = classNameProp({ isActive, isPending });\n } else {\n // If the className prop is not a function, we use a default `active`\n // class for <NavLink />s that are active. In v5 `active` was the default\n // value for `activeClassName`, but we are removing that API and can still\n // use the old default behavior for a cleaner upgrade path and keep the\n // simple styling rules working as they currently do.\n className = [\n classNameProp,\n isActive ? \"active\" : null,\n isPending ? \"pending\" : null,\n ]\n .filter(Boolean)\n .join(\" \");\n }\n\n let style =\n typeof styleProp === \"function\"\n ? styleProp({ isActive, isPending })\n : styleProp;\n\n return (\n <Link\n {...rest}\n aria-current={ariaCurrent}\n className={className}\n ref={ref}\n style={style}\n to={to}\n >\n {typeof children === \"function\"\n ? children({ isActive, isPending })\n : children}\n </Link>\n );\n }\n);\n\nif (__DEV__) {\n NavLink.displayName = \"NavLink\";\n}\n\nexport interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {\n /**\n * The HTTP verb to use when the form is submit. Supports \"get\", \"post\",\n * \"put\", \"delete\", \"patch\".\n */\n method?: FormMethod;\n\n /**\n * Normal `<form action>` but supports React Router's relative paths.\n */\n action?: string;\n\n /**\n * Replaces the current entry in the browser history stack when the form\n * navigates. Use this if you don't want the user to be able to click \"back\"\n * to the page with the form on it.\n */\n replace?: boolean;\n\n /**\n * A function to call when the form is submitted. If you call\n * `event.preventDefault()` then this form will not do anything.\n */\n onSubmit?: React.FormEventHandler<HTMLFormElement>;\n}\n\n/**\n * A `@remix-run/router`-aware `<form>`. It behaves like a normal form except\n * that the interaction with the server is with `fetch` instead of new document\n * requests, allowing components to add nicer UX to the page as the form is\n * submitted and returns with data.\n */\nexport const Form = React.forwardRef<HTMLFormElement, FormProps>(\n (props, ref) => {\n return <FormImpl {...props} ref={ref} />;\n }\n);\n\nif (__DEV__) {\n Form.displayName = \"Form\";\n}\n\ntype HTMLSubmitEvent = React.BaseSyntheticEvent<\n SubmitEvent,\n Event,\n HTMLFormElement\n>;\n\ntype HTMLFormSubmitter = HTMLButtonElement | HTMLInputElement;\n\ninterface FormImplProps extends FormProps {\n fetcherKey?: string;\n}\n\nconst FormImpl = React.forwardRef<HTMLFormElement, FormImplProps>(\n (\n {\n replace,\n method = defaultMethod,\n action = \".\",\n onSubmit,\n fetcherKey,\n ...props\n },\n forwardedRef\n ) => {\n let submit = useSubmitImpl(fetcherKey);\n let formMethod: FormMethod =\n method.toLowerCase() === \"get\" ? \"get\" : \"post\";\n let formAction = useFormAction(action);\n let submitHandler: React.FormEventHandler<HTMLFormElement> = (event) => {\n onSubmit && onSubmit(event);\n if (event.defaultPrevented) return;\n event.preventDefault();\n\n let submitter = (event as unknown as HTMLSubmitEvent).nativeEvent\n .submitter as HTMLFormSubmitter | null;\n\n submit(submitter || event.currentTarget, { method, replace });\n };\n\n return (\n <form\n ref={forwardedRef}\n method={formMethod}\n action={formAction}\n onSubmit={submitHandler}\n {...props}\n />\n );\n }\n);\n\nif (__DEV__) {\n Form.displayName = \"Form\";\n}\n\ninterface ScrollRestorationProps {\n getKey?: GetScrollRestorationKeyFunction;\n storageKey?: string;\n}\n\n/**\n * This component will emulate the browser's scroll restoration on location\n * changes.\n */\nexport function ScrollRestoration({\n getKey,\n storageKey,\n}: ScrollRestorationProps) {\n useScrollRestoration({ getKey, storageKey });\n return null;\n}\n\nif (__DEV__) {\n ScrollRestoration.displayName = \"ScrollRestoration\";\n}\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Hooks\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Handles the click behavior for router `<Link>` components. This is useful if\n * you need to create custom `<Link>` components with the same click behavior we\n * use in our exported `<Link>`.\n */\nexport function useLinkClickHandler<E extends Element = HTMLAnchorElement>(\n to: To,\n {\n target,\n replace: replaceProp,\n state,\n resetScroll,\n }: {\n target?: React.HTMLAttributeAnchorTarget;\n replace?: boolean;\n state?: any;\n resetScroll?: boolean;\n } = {}\n): (event: React.MouseEvent<E, MouseEvent>) => void {\n let navigate = useNavigate();\n let location = useLocation();\n let path = useResolvedPath(to);\n\n return React.useCallback(\n (event: React.MouseEvent<E, MouseEvent>) => {\n if (shouldProcessLinkClick(event, target)) {\n event.preventDefault();\n\n // If the URL hasn't changed, a regular <a> will do a replace instead of\n // a push, so do the same here unless the replace prop is explcitly set\n let replace =\n replaceProp !== undefined\n ? replaceProp\n : createPath(location) === createPath(path);\n\n navigate(to, { replace, state, resetScroll });\n }\n },\n [location, navigate, path, replaceProp, state, target, to, resetScroll]\n );\n}\n\n/**\n * A convenient wrapper for reading and writing search parameters via the\n * URLSearchParams interface.\n */\nexport function useSearchParams(defaultInit?: URLSearchParamsInit) {\n warning(\n typeof URLSearchParams !== \"undefined\",\n `You cannot use the \\`useSearchParams\\` hook in a browser that does not ` +\n `support the URLSearchParams API. If you need to support Internet ` +\n `Explorer 11, we recommend you load a polyfill such as ` +\n `https://github.com/ungap/url-search-params\\n\\n` +\n `If you're unsure how to load polyfills, we recommend you check out ` +\n `https://polyfill.io/v3/ which provides some recommendations about how ` +\n `to load polyfills only for users that need them, instead of for every ` +\n `user.`\n );\n\n let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));\n\n let location = useLocation();\n let searchParams = React.useMemo(\n () =>\n getSearchParamsForLocation(\n location.search,\n defaultSearchParamsRef.current\n ),\n [location.search]\n );\n\n let navigate = useNavigate();\n let setSearchParams = React.useCallback(\n (\n nextInit: URLSearchParamsInit,\n navigateOptions?: { replace?: boolean; state?: any }\n ) => {\n navigate(\"?\" + createSearchParams(nextInit), navigateOptions);\n },\n [navigate]\n );\n\n return [searchParams, setSearchParams] as const;\n}\n\n/**\n * Submits a HTML `<form>` to the server without reloading the page.\n */\nexport interface SubmitFunction {\n (\n /**\n * Specifies the `<form>` to be submitted to the server, a specific\n * `<button>` or `<input type=\"submit\">` to use to submit the form, or some\n * arbitrary data to submit.\n *\n * Note: When using a `<button>` its `name` and `value` will also be\n * included in the form data that is submitted.\n */\n target:\n | HTMLFormElement\n | HTMLButtonElement\n | HTMLInputElement\n | FormData\n | URLSearchParams\n | { [name: string]: string }\n | null,\n\n /**\n * Options that override the `<form>`'s own attributes. Required when\n * submitting arbitrary data without a backing `<form>`.\n */\n options?: SubmitOptions\n ): void;\n}\n\n/**\n * Returns a function that may be used to programmatically submit a form (or\n * some arbitrary data) to the server.\n */\nexport function useSubmit(): SubmitFunction {\n return useSubmitImpl();\n}\n\nfunction useSubmitImpl(fetcherKey?: string): SubmitFunction {\n let router = React.useContext(UNSAFE_DataRouterContext);\n let defaultAction = useFormAction();\n\n return React.useCallback(\n (target, options = {}) => {\n invariant(\n router != null,\n \"useSubmit() must be used within a <DataRouter>\"\n );\n\n if (typeof document === \"undefined\") {\n throw new Error(\n \"You are calling submit during the server render. \" +\n \"Try calling submit within a `useEffect` or callback instead.\"\n );\n }\n\n let { method, encType, formData, url } = getFormSubmissionInfo(\n target,\n defaultAction,\n options\n );\n\n let href = url.pathname + url.search;\n let opts = {\n // If replace is not specified, we'll default to false for GET and\n // true otherwise\n replace:\n options.replace != null ? options.replace === true : method !== \"get\",\n formData,\n formMethod: method as FormMethod,\n formEncType: encType as FormEncType,\n };\n if (fetcherKey) {\n router.fetch(fetcherKey, href, opts);\n } else {\n router.navigate(href, opts);\n }\n },\n [defaultAction, router, fetcherKey]\n );\n}\n\nexport function useFormAction(action = \".\"): string {\n let routeContext = React.useContext(UNSAFE_RouteContext);\n invariant(routeContext, \"useFormAction must be used inside a RouteContext\");\n\n let [match] = routeContext.matches.slice(-1);\n let { pathname, search } = useResolvedPath(action);\n\n if (action === \".\" && match.route.index) {\n search = search ? search.replace(/^\\?/, \"?index&\") : \"?index\";\n }\n\n return pathname + search;\n}\n\nfunction createFetcherForm(fetcherKey: string) {\n let FetcherForm = React.forwardRef<HTMLFormElement, FormProps>(\n (props, ref) => {\n return <FormImpl {...props} ref={ref} fetcherKey={fetcherKey} />;\n }\n );\n if (__DEV__) {\n FetcherForm.displayName = \"fetcher.Form\";\n }\n return FetcherForm;\n}\n\nlet fetcherId = 0;\n\ntype FetcherWithComponents<TData> = Fetcher<TData> & {\n Form: ReturnType<typeof createFetcherForm>;\n submit: ReturnType<typeof useSubmitImpl>;\n load: (href: string) => void;\n};\n\n/**\n * Interacts with route loaders and actions without causing a navigation. Great\n * for any interaction that stays on the same page.\n */\nexport function useFetcher<TData = any>(): FetcherWithComponents<TData> {\n let router = React.useContext(UNSAFE_DataRouterContext);\n invariant(router, `useFetcher must be used within a DataRouter`);\n\n let [fetcherKey] = React.useState(() => String(++fetcherId));\n let [Form] = React.useState(() => createFetcherForm(fetcherKey));\n let [load] = React.useState(() => (href: string) => {\n invariant(router, `No router available for fetcher.load()`);\n router.fetch(fetcherKey, href);\n });\n let submit = useSubmitImpl(fetcherKey);\n\n let fetcher = router.getFetcher<TData>(fetcherKey);\n\n let fetcherWithComponents = React.useMemo(\n () => ({\n Form,\n submit,\n load,\n ...fetcher,\n }),\n [fetcher, Form, submit, load]\n );\n\n React.useEffect(() => {\n // Is this busted when the React team gets real weird and calls effects\n // twice on mount? We really just need to garbage collect here when this\n // fetcher is no longer around.\n return () => {\n if (!router) {\n console.warn(\"No fetcher available to clean up from useFetcher()\");\n return;\n }\n router.deleteFetcher(fetcherKey);\n };\n }, [router, fetcherKey]);\n\n return fetcherWithComponents;\n}\n\n/**\n * Provides all fetchers currently on the page. Useful for layouts and parent\n * routes that need to provide pending/optimistic UI regarding the fetch.\n */\nexport function useFetchers(): Fetcher[] {\n let state = React.useContext(UNSAFE_DataRouterStateContext);\n invariant(state, `useFetchers must be used within a DataRouter`);\n return [...state.fetchers.values()];\n}\n\nconst SCROLL_RESTORATION_STORAGE_KEY = \"react-router-scroll-positions\";\nlet savedScrollPositions: Record<string, number> = {};\n\n/**\n * When rendered inside a DataRouter, will restore scroll positions on navigations\n */\nfunction useScrollRestoration({\n getKey,\n storageKey,\n}: {\n getKey?: GetScrollRestorationKeyFunction;\n storageKey?: string;\n} = {}) {\n let location = useLocation();\n let router = React.useContext(UNSAFE_DataRouterContext);\n let state = React.useContext(UNSAFE_DataRouterStateContext);\n\n invariant(\n router != null && state != null,\n \"useScrollRestoration must be used within a DataRouter\"\n );\n let { restoreScrollPosition, resetScrollPosition } = state;\n\n // Trigger manual scroll restoration while we're active\n React.useEffect(() => {\n window.history.scrollRestoration = \"manual\";\n return () => {\n window.history.scrollRestoration = \"auto\";\n };\n }, []);\n\n // Save positions on unload\n useBeforeUnload(\n React.useCallback(() => {\n if (state?.navigation.state === \"idle\") {\n let key =\n (getKey ? getKey(state.location, state.matches) : null) ||\n state.location.key;\n savedScrollPositions[key] = window.scrollY;\n }\n sessionStorage.setItem(\n storageKey || SCROLL_RESTORATION_STORAGE_KEY,\n JSON.stringify(savedScrollPositions)\n );\n window.history.scrollRestoration = \"auto\";\n }, [\n storageKey,\n getKey,\n state.navigation.state,\n state.location,\n state.matches,\n ])\n );\n\n // Read in any saved scroll locations\n React.useLayoutEffect(() => {\n try {\n let sessionPositions = sessionStorage.getItem(\n storageKey || SCROLL_RESTORATION_STORAGE_KEY\n );\n if (sessionPositions) {\n savedScrollPositions = JSON.parse(sessionPositions);\n }\n } catch (e) {\n // no-op, use default empty object\n }\n }, [storageKey]);\n\n // Enable scroll restoration in the router\n React.useLayoutEffect(() => {\n let disableScrollRestoration = router?.enableScrollRestoration(\n savedScrollPositions,\n () => window.scrollY,\n getKey\n );\n return () => disableScrollRestoration && disableScrollRestoration();\n }, [router, getKey]);\n\n // Restore scrolling when state.restoreScrollPosition changes\n React.useLayoutEffect(() => {\n // Explicit false means don't do anything (used for submissions)\n if (restoreScrollPosition === false) {\n return;\n }\n\n // been here before, scroll to it\n if (typeof restoreScrollPosition === \"number\") {\n window.scrollTo(0, restoreScrollPosition);\n return;\n }\n\n // try to scroll to the hash\n if (location.hash) {\n let el = document.getElementById(location.hash.slice(1));\n if (el) {\n el.scrollIntoView();\n return;\n }\n }\n\n // Opt out of scroll reset if this link requested it\n if (resetScrollPosition === false) {\n return;\n }\n\n // otherwise go to the top on new locations\n window.scrollTo(0, 0);\n }, [location, restoreScrollPosition, resetScrollPosition]);\n}\n\nfunction useBeforeUnload(callback: () => any): void {\n React.useEffect(() => {\n window.addEventListener(\"beforeunload\", callback);\n return () => {\n window.removeEventListener(\"beforeunload\", callback);\n };\n }, [callback]);\n}\n\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Utils\n////////////////////////////////////////////////////////////////////////////////\n\nfunction warning(cond: boolean, message: string): void {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\n try {\n // Welcome to debugging React Router!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n//#endregion\n"],"names":["defaultMethod","defaultEncType","isHtmlElement","object","tagName","isButtonElement","toLowerCase","isFormElement","isInputElement","isModifiedEvent","event","metaKey","altKey","ctrlKey","shiftKey","shouldProcessLinkClick","target","button","createSearchParams","init","URLSearchParams","Array","isArray","Object","keys","reduce","memo","key","value","concat","map","v","getSearchParamsForLocation","locationSearch","defaultSearchParams","searchParams","has","getAll","forEach","append","getFormSubmissionInfo","defaultAction","options","method","action","encType","formData","submissionTrigger","getAttribute","FormData","name","type","form","Error","set","protocol","host","window","location","url","URL","DataBrowserRouter","children","fallbackElement","hydrationData","routes","useRenderDataRouter","createRouter","createBrowserRouter","DataHashRouter","createHashRouter","BrowserRouter","basename","historyRef","React","useRef","current","createBrowserHistory","v5Compat","history","state","setState","useState","useLayoutEffect","listen","HashRouter","createHashHistory","HistoryRouter","displayName","Link","forwardRef","LinkWithRef","onClick","reloadDocument","replace","to","resetScroll","rest","ref","href","useHref","internalOnClick","useLinkClickHandler","handleClick","defaultPrevented","NavLink","NavLinkWithRef","ariaCurrentProp","caseSensitive","className","classNameProp","end","style","styleProp","path","useResolvedPath","match","useMatch","pathname","routerState","useContext","UNSAFE_DataRouterStateContext","nextLocation","navigation","nextPath","nextMatch","useMemo","matchPath","isPending","isActive","ariaCurrent","undefined","filter","Boolean","join","Form","props","FormImpl","onSubmit","fetcherKey","forwardedRef","submit","useSubmitImpl","formMethod","formAction","useFormAction","submitHandler","preventDefault","submitter","nativeEvent","currentTarget","ScrollRestoration","getKey","storageKey","useScrollRestoration","replaceProp","navigate","useNavigate","useLocation","useCallback","createPath","useSearchParams","defaultInit","warning","defaultSearchParamsRef","search","setSearchParams","nextInit","navigateOptions","useSubmit","router","UNSAFE_DataRouterContext","invariant","document","opts","formEncType","fetch","routeContext","UNSAFE_RouteContext","matches","slice","route","index","createFetcherForm","FetcherForm","fetcherId","useFetcher","String","load","fetcher","getFetcher","fetcherWithComponents","useEffect","console","warn","deleteFetcher","useFetchers","fetchers","values","SCROLL_RESTORATION_STORAGE_KEY","savedScrollPositions","restoreScrollPosition","resetScrollPosition","scrollRestoration","useBeforeUnload","scrollY","sessionStorage","setItem","JSON","stringify","sessionPositions","getItem","parse","e","disableScrollRestoration","enableScrollRestoration","scrollTo","hash","el","getElementById","scrollIntoView","callback","addEventListener","removeEventListener","cond","message"],"mappings":";;;;;;;;;;;;;;;AAEO,MAAMA,aAAa,GAAG,KAAtB,CAAA;AACP,MAAMC,cAAc,GAAG,mCAAvB,CAAA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IAAT,CAAcrC,KAAd,CAAoB,CAApB,CAAxB,CAAT,CAAA;;AACA,MAAA,IAAIsC,EAAJ,EAAQ;AACNA,QAAAA,EAAE,CAACE,cAAH,EAAA,CAAA;AACA,QAAA,OAAA;AACD,OAAA;AACF,KAnByB;;;IAsB1B,IAAIlB,mBAAmB,KAAK,KAA5B,EAAmC;AACjC,MAAA,OAAA;AACD,KAxByB;;;AA2B1BjJ,IAAAA,MAAM,CAAC+J,QAAP,CAAgB,CAAhB,EAAmB,CAAnB,CAAA,CAAA;AACD,GA5BD,EA4BG,CAAC9J,QAAD,EAAW+I,qBAAX,EAAkCC,mBAAlC,CA5BH,CAAA,CAAA;AA6BD,CAAA;;AAED,SAASE,eAAT,CAAyBiB,QAAzB,EAAoD;EAClDnJ,KAAK,CAACsH,SAAN,CAAgB,MAAM;AACpBvI,IAAAA,MAAM,CAACqK,gBAAP,CAAwB,cAAxB,EAAwCD,QAAxC,CAAA,CAAA;AACA,IAAA,OAAO,MAAM;AACXpK,MAAAA,MAAM,CAACsK,mBAAP,CAA2B,cAA3B,EAA2CF,QAA3C,CAAA,CAAA;KADF,CAAA;GAFF,EAKG,CAACA,QAAD,CALH,CAAA,CAAA;AAMD;AAID;AACA;AACA;;;AAEA,SAAS1D,OAAT,CAAiB6D,IAAjB,EAAgCC,OAAhC,EAAuD;EACrD,IAAI,CAACD,IAAL,EAAW;AACT;IACA,IAAI,OAAO/B,OAAP,KAAmB,WAAvB,EAAoCA,OAAO,CAACC,IAAR,CAAa+B,OAAb,CAAA,CAAA;;IAEpC,IAAI;AACF;AACA;AACA;AACA;AACA;AACA,MAAA,MAAM,IAAI5K,KAAJ,CAAU4K,OAAV,CAAN,CANE;AAQH,KARD,CAQE,OAAOZ,CAAP,EAAU,EAAE;AACf,GAAA;AACF;;;;"}
1
+ {"version":3,"file":"react-router-dom.development.js","sources":["../dom.ts","../index.tsx"],"sourcesContent":["import type { FormEncType, FormMethod } from \"@remix-run/router\";\n\nexport const defaultMethod = \"get\";\nconst defaultEncType = \"application/x-www-form-urlencoded\";\n\nexport function isHtmlElement(object: any): object is HTMLElement {\n return object != null && typeof object.tagName === \"string\";\n}\n\nexport function isButtonElement(object: any): object is HTMLButtonElement {\n return isHtmlElement(object) && object.tagName.toLowerCase() === \"button\";\n}\n\nexport function isFormElement(object: any): object is HTMLFormElement {\n return isHtmlElement(object) && object.tagName.toLowerCase() === \"form\";\n}\n\nexport function isInputElement(object: any): object is HTMLInputElement {\n return isHtmlElement(object) && object.tagName.toLowerCase() === \"input\";\n}\n\ntype LimitedMouseEvent = Pick<\n MouseEvent,\n \"button\" | \"metaKey\" | \"altKey\" | \"ctrlKey\" | \"shiftKey\"\n>;\n\nfunction isModifiedEvent(event: LimitedMouseEvent) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nexport function shouldProcessLinkClick(\n event: LimitedMouseEvent,\n target?: string\n) {\n return (\n event.button === 0 && // Ignore everything but left clicks\n (!target || target === \"_self\") && // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n );\n}\n\nexport type ParamKeyValuePair = [string, string];\n\nexport type URLSearchParamsInit =\n | string\n | ParamKeyValuePair[]\n | Record<string, string | string[]>\n | URLSearchParams;\n\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nexport function createSearchParams(\n init: URLSearchParamsInit = \"\"\n): URLSearchParams {\n return new URLSearchParams(\n typeof init === \"string\" ||\n Array.isArray(init) ||\n init instanceof URLSearchParams\n ? init\n : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(\n Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]]\n );\n }, [] as ParamKeyValuePair[])\n );\n}\n\nexport function getSearchParamsForLocation(\n locationSearch: string,\n defaultSearchParams: URLSearchParams\n) {\n let searchParams = createSearchParams(locationSearch);\n\n for (let key of defaultSearchParams.keys()) {\n if (!searchParams.has(key)) {\n defaultSearchParams.getAll(key).forEach((value) => {\n searchParams.append(key, value);\n });\n }\n }\n\n return searchParams;\n}\n\nexport interface SubmitOptions {\n /**\n * The HTTP method used to submit the form. Overrides `<form method>`.\n * Defaults to \"GET\".\n */\n method?: FormMethod;\n\n /**\n * The action URL path used to submit the form. Overrides `<form action>`.\n * Defaults to the path of the current route.\n *\n * Note: It is assumed the path is already resolved. If you need to resolve a\n * relative path, use `useFormAction`.\n */\n action?: string;\n\n /**\n * The action URL used to submit the form. Overrides `<form encType>`.\n * Defaults to \"application/x-www-form-urlencoded\".\n */\n encType?: FormEncType;\n\n /**\n * Set `true` to replace the current entry in the browser's history stack\n * instead of creating a new one (i.e. stay on \"the same page\"). Defaults\n * to `false`.\n */\n replace?: boolean;\n}\n\nexport function getFormSubmissionInfo(\n target:\n | HTMLFormElement\n | HTMLButtonElement\n | HTMLInputElement\n | FormData\n | URLSearchParams\n | { [name: string]: string }\n | null,\n defaultAction: string,\n options: SubmitOptions\n): {\n url: URL;\n method: string;\n encType: string;\n formData: FormData;\n} {\n let method: string;\n let action: string;\n let encType: string;\n let formData: FormData;\n\n if (isFormElement(target)) {\n let submissionTrigger: HTMLButtonElement | HTMLInputElement = (\n options as any\n ).submissionTrigger;\n\n method = options.method || target.getAttribute(\"method\") || defaultMethod;\n action = options.action || target.getAttribute(\"action\") || defaultAction;\n encType =\n options.encType || target.getAttribute(\"enctype\") || defaultEncType;\n\n formData = new FormData(target);\n\n if (submissionTrigger && submissionTrigger.name) {\n formData.append(submissionTrigger.name, submissionTrigger.value);\n }\n } else if (\n isButtonElement(target) ||\n (isInputElement(target) &&\n (target.type === \"submit\" || target.type === \"image\"))\n ) {\n let form = target.form;\n\n if (form == null) {\n throw new Error(\n `Cannot submit a <button> or <input type=\"submit\"> without a <form>`\n );\n }\n\n // <button>/<input type=\"submit\"> may override attributes of <form>\n\n method =\n options.method ||\n target.getAttribute(\"formmethod\") ||\n form.getAttribute(\"method\") ||\n defaultMethod;\n action =\n options.action ||\n target.getAttribute(\"formaction\") ||\n form.getAttribute(\"action\") ||\n defaultAction;\n encType =\n options.encType ||\n target.getAttribute(\"formenctype\") ||\n form.getAttribute(\"enctype\") ||\n defaultEncType;\n\n formData = new FormData(form);\n\n // Include name + value from a <button>\n if (target.name) {\n formData.set(target.name, target.value);\n }\n } else if (isHtmlElement(target)) {\n throw new Error(\n `Cannot submit element that is not <form>, <button>, or ` +\n `<input type=\"submit|image\">`\n );\n } else {\n method = options.method || defaultMethod;\n action = options.action || defaultAction;\n encType = options.encType || defaultEncType;\n\n if (target instanceof FormData) {\n formData = target;\n } else {\n formData = new FormData();\n\n if (target instanceof URLSearchParams) {\n for (let [name, value] of target) {\n formData.append(name, value);\n }\n } else if (target != null) {\n for (let name of Object.keys(target)) {\n formData.append(name, target[name]);\n }\n }\n }\n }\n\n let { protocol, host } = window.location;\n let url = new URL(action, `${protocol}//${host}`);\n\n return { url, method, encType, formData };\n}\n","/**\n * NOTE: If you refactor this to split up the modules into separate files,\n * you'll need to update the rollup config for react-router-dom-v5-compat.\n */\nimport * as React from \"react\";\nimport type { NavigateOptions, To } from \"react-router\";\nimport {\n Router,\n createPath,\n useHref,\n useLocation,\n useMatch,\n useNavigate,\n useRenderDataRouter,\n useResolvedPath,\n UNSAFE_RouteContext,\n UNSAFE_DataRouterContext,\n UNSAFE_DataRouterStateContext,\n} from \"react-router\";\nimport type {\n BrowserHistory,\n Fetcher,\n FormEncType,\n FormMethod,\n GetScrollRestorationKeyFunction,\n HashHistory,\n History,\n HydrationState,\n RouteObject,\n} from \"@remix-run/router\";\nimport {\n createBrowserHistory,\n createHashHistory,\n createBrowserRouter,\n createHashRouter,\n invariant,\n matchPath,\n} from \"@remix-run/router\";\n\nimport type {\n SubmitOptions,\n ParamKeyValuePair,\n URLSearchParamsInit,\n} from \"./dom\";\nimport {\n createSearchParams,\n defaultMethod,\n getFormSubmissionInfo,\n getSearchParamsForLocation,\n shouldProcessLinkClick,\n} from \"./dom\";\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Re-exports\n////////////////////////////////////////////////////////////////////////////////\n\nexport type { ParamKeyValuePair, URLSearchParamsInit };\nexport { createSearchParams };\n\n// Note: Keep in sync with react-router exports!\nexport type {\n ActionFunction,\n DataMemoryRouterProps,\n DataRouteMatch,\n Fetcher,\n Hash,\n IndexRouteProps,\n JsonFunction,\n LayoutRouteProps,\n LoaderFunction,\n Location,\n MemoryRouterProps,\n NavigateFunction,\n NavigateOptions,\n NavigateProps,\n Navigation,\n Navigator,\n OutletProps,\n Params,\n ParamParseKey,\n Path,\n PathMatch,\n Pathname,\n PathPattern,\n PathRouteProps,\n RedirectFunction,\n RouteMatch,\n RouteObject,\n RouteProps,\n RouterProps,\n RoutesProps,\n Search,\n ShouldRevalidateFunction,\n To,\n} from \"react-router\";\nexport {\n DataMemoryRouter,\n MemoryRouter,\n Navigate,\n NavigationType,\n Outlet,\n Route,\n Router,\n Routes,\n createPath,\n createRoutesFromChildren,\n isRouteErrorResponse,\n generatePath,\n json,\n matchPath,\n matchRoutes,\n parsePath,\n redirect,\n renderMatches,\n resolvePath,\n useActionData,\n useHref,\n useInRouterContext,\n useLoaderData,\n useLocation,\n useMatch,\n useMatches,\n useNavigate,\n useNavigation,\n useNavigationType,\n useOutlet,\n useOutletContext,\n useParams,\n useResolvedPath,\n useRevalidator,\n useRouteError,\n useRouteLoaderData,\n useRoutes,\n} from \"react-router\";\n\n///////////////////////////////////////////////////////////////////////////////\n// DANGER! PLEASE READ ME!\n// We provide these exports as an escape hatch in the event that you need any\n// routing data that we don't provide an explicit API for. With that said, we\n// want to cover your use case if we can, so if you feel the need to use these\n// we want to hear from you. Let us know what you're building and we'll do our\n// best to make sure we can support you!\n//\n// We consider these exports an implementation detail and do not guarantee\n// against any breaking changes, regardless of the semver release. Use with\n// extreme caution and only if you understand the consequences. Godspeed.\n///////////////////////////////////////////////////////////////////////////////\n\n/** @internal */\nexport {\n UNSAFE_NavigationContext,\n UNSAFE_LocationContext,\n UNSAFE_RouteContext,\n UNSAFE_DataRouterContext,\n UNSAFE_DataRouterStateContext,\n useRenderDataRouter,\n} from \"react-router\";\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Components\n////////////////////////////////////////////////////////////////////////////////\n\nexport interface DataBrowserRouterProps {\n children?: React.ReactNode;\n hydrationData?: HydrationState;\n fallbackElement?: React.ReactNode;\n routes?: RouteObject[];\n window?: Window;\n}\n\nexport function DataBrowserRouter({\n children,\n fallbackElement,\n hydrationData,\n routes,\n window,\n}: DataBrowserRouterProps): React.ReactElement {\n return useRenderDataRouter({\n children,\n fallbackElement,\n routes,\n createRouter: (routes) =>\n createBrowserRouter({\n routes,\n hydrationData,\n window,\n }),\n });\n}\n\nexport interface DataHashRouterProps {\n children?: React.ReactNode;\n hydrationData?: HydrationState;\n fallbackElement?: React.ReactNode;\n routes?: RouteObject[];\n window?: Window;\n}\n\nexport function DataHashRouter({\n children,\n hydrationData,\n fallbackElement,\n routes,\n window,\n}: DataBrowserRouterProps): React.ReactElement {\n return useRenderDataRouter({\n children,\n fallbackElement,\n routes,\n createRouter: (routes) =>\n createHashRouter({\n routes,\n hydrationData,\n window,\n }),\n });\n}\n\nexport interface BrowserRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A `<Router>` for use in web browsers. Provides the cleanest URLs.\n */\nexport function BrowserRouter({\n basename,\n children,\n window,\n}: BrowserRouterProps) {\n let historyRef = React.useRef<BrowserHistory>();\n if (historyRef.current == null) {\n historyRef.current = createBrowserHistory({ window, v5Compat: true });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location,\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface HashRouterProps {\n basename?: string;\n children?: React.ReactNode;\n window?: Window;\n}\n\n/**\n * A `<Router>` for use in web browsers. Stores the location in the hash\n * portion of the URL so it is not sent to the server.\n */\nexport function HashRouter({ basename, children, window }: HashRouterProps) {\n let historyRef = React.useRef<HashHistory>();\n if (historyRef.current == null) {\n historyRef.current = createHashHistory({ window, v5Compat: true });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location,\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface HistoryRouterProps {\n basename?: string;\n children?: React.ReactNode;\n history: History;\n}\n\n/**\n * A `<Router>` that accepts a pre-instantiated history object. It's important\n * to note that using your own history object is highly discouraged and may add\n * two versions of the history library to your bundles unless you use the same\n * version of the history library that React Router uses internally.\n */\nfunction HistoryRouter({ basename, children, history }: HistoryRouterProps) {\n const [state, setState] = React.useState({\n action: history.action,\n location: history.location,\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nif (__DEV__) {\n HistoryRouter.displayName = \"unstable_HistoryRouter\";\n}\n\nexport { HistoryRouter as unstable_HistoryRouter };\n\nexport interface LinkProps\n extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n reloadDocument?: boolean;\n replace?: boolean;\n state?: any;\n resetScroll?: boolean;\n to: To;\n}\n\n/**\n * The public API for rendering a history-aware <a>.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function LinkWithRef(\n {\n onClick,\n reloadDocument,\n replace,\n state,\n target,\n to,\n resetScroll,\n ...rest\n },\n ref\n ) {\n let href = useHref(to);\n let internalOnClick = useLinkClickHandler(to, {\n replace,\n state,\n target,\n resetScroll,\n });\n function handleClick(\n event: React.MouseEvent<HTMLAnchorElement, MouseEvent>\n ) {\n if (onClick) onClick(event);\n if (!event.defaultPrevented && !reloadDocument) {\n internalOnClick(event);\n }\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n <a\n {...rest}\n href={href}\n onClick={handleClick}\n ref={ref}\n target={target}\n />\n );\n }\n);\n\nif (__DEV__) {\n Link.displayName = \"Link\";\n}\n\nexport interface NavLinkProps\n extends Omit<LinkProps, \"className\" | \"style\" | \"children\"> {\n children?:\n | React.ReactNode\n | ((props: { isActive: boolean; isPending: boolean }) => React.ReactNode);\n caseSensitive?: boolean;\n className?:\n | string\n | ((props: {\n isActive: boolean;\n isPending: boolean;\n }) => string | undefined);\n end?: boolean;\n style?:\n | React.CSSProperties\n | ((props: {\n isActive: boolean;\n isPending: boolean;\n }) => React.CSSProperties | undefined);\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nexport const NavLink = React.forwardRef<HTMLAnchorElement, NavLinkProps>(\n function NavLinkWithRef(\n {\n \"aria-current\": ariaCurrentProp = \"page\",\n caseSensitive = false,\n className: classNameProp = \"\",\n end = false,\n style: styleProp,\n to,\n children,\n ...rest\n },\n ref\n ) {\n let path = useResolvedPath(to);\n let match = useMatch({ path: path.pathname, end, caseSensitive });\n\n let routerState = React.useContext(UNSAFE_DataRouterStateContext);\n let nextLocation = routerState?.navigation.location;\n let nextPath = useResolvedPath(nextLocation || \"\");\n let nextMatch = React.useMemo(\n () =>\n nextLocation\n ? matchPath(\n { path: path.pathname, end, caseSensitive },\n nextPath.pathname\n )\n : null,\n [nextLocation, path.pathname, caseSensitive, end, nextPath.pathname]\n );\n\n let isPending = nextMatch != null;\n let isActive = match != null;\n\n let ariaCurrent = isActive ? ariaCurrentProp : undefined;\n\n let className: string | undefined;\n if (typeof classNameProp === \"function\") {\n className = classNameProp({ isActive, isPending });\n } else {\n // If the className prop is not a function, we use a default `active`\n // class for <NavLink />s that are active. In v5 `active` was the default\n // value for `activeClassName`, but we are removing that API and can still\n // use the old default behavior for a cleaner upgrade path and keep the\n // simple styling rules working as they currently do.\n className = [\n classNameProp,\n isActive ? \"active\" : null,\n isPending ? \"pending\" : null,\n ]\n .filter(Boolean)\n .join(\" \");\n }\n\n let style =\n typeof styleProp === \"function\"\n ? styleProp({ isActive, isPending })\n : styleProp;\n\n return (\n <Link\n {...rest}\n aria-current={ariaCurrent}\n className={className}\n ref={ref}\n style={style}\n to={to}\n >\n {typeof children === \"function\"\n ? children({ isActive, isPending })\n : children}\n </Link>\n );\n }\n);\n\nif (__DEV__) {\n NavLink.displayName = \"NavLink\";\n}\n\nexport interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {\n /**\n * The HTTP verb to use when the form is submit. Supports \"get\", \"post\",\n * \"put\", \"delete\", \"patch\".\n */\n method?: FormMethod;\n\n /**\n * Normal `<form action>` but supports React Router's relative paths.\n */\n action?: string;\n\n /**\n * Replaces the current entry in the browser history stack when the form\n * navigates. Use this if you don't want the user to be able to click \"back\"\n * to the page with the form on it.\n */\n replace?: boolean;\n\n /**\n * A function to call when the form is submitted. If you call\n * `event.preventDefault()` then this form will not do anything.\n */\n onSubmit?: React.FormEventHandler<HTMLFormElement>;\n}\n\n/**\n * A `@remix-run/router`-aware `<form>`. It behaves like a normal form except\n * that the interaction with the server is with `fetch` instead of new document\n * requests, allowing components to add nicer UX to the page as the form is\n * submitted and returns with data.\n */\nexport const Form = React.forwardRef<HTMLFormElement, FormProps>(\n (props, ref) => {\n return <FormImpl {...props} ref={ref} />;\n }\n);\n\nif (__DEV__) {\n Form.displayName = \"Form\";\n}\n\ntype HTMLSubmitEvent = React.BaseSyntheticEvent<\n SubmitEvent,\n Event,\n HTMLFormElement\n>;\n\ntype HTMLFormSubmitter = HTMLButtonElement | HTMLInputElement;\n\ninterface FormImplProps extends FormProps {\n fetcherKey?: string;\n routeId?: string;\n}\n\nconst FormImpl = React.forwardRef<HTMLFormElement, FormImplProps>(\n (\n {\n replace,\n method = defaultMethod,\n action = \".\",\n onSubmit,\n fetcherKey,\n routeId,\n ...props\n },\n forwardedRef\n ) => {\n let submit = useSubmitImpl(fetcherKey, routeId);\n let formMethod: FormMethod =\n method.toLowerCase() === \"get\" ? \"get\" : \"post\";\n let formAction = useFormAction(action);\n let submitHandler: React.FormEventHandler<HTMLFormElement> = (event) => {\n onSubmit && onSubmit(event);\n if (event.defaultPrevented) return;\n event.preventDefault();\n\n let submitter = (event as unknown as HTMLSubmitEvent).nativeEvent\n .submitter as HTMLFormSubmitter | null;\n\n submit(submitter || event.currentTarget, { method, replace });\n };\n\n return (\n <form\n ref={forwardedRef}\n method={formMethod}\n action={formAction}\n onSubmit={submitHandler}\n {...props}\n />\n );\n }\n);\n\nif (__DEV__) {\n Form.displayName = \"Form\";\n}\n\ninterface ScrollRestorationProps {\n getKey?: GetScrollRestorationKeyFunction;\n storageKey?: string;\n}\n\n/**\n * This component will emulate the browser's scroll restoration on location\n * changes.\n */\nexport function ScrollRestoration({\n getKey,\n storageKey,\n}: ScrollRestorationProps) {\n useScrollRestoration({ getKey, storageKey });\n return null;\n}\n\nif (__DEV__) {\n ScrollRestoration.displayName = \"ScrollRestoration\";\n}\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Hooks\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Handles the click behavior for router `<Link>` components. This is useful if\n * you need to create custom `<Link>` components with the same click behavior we\n * use in our exported `<Link>`.\n */\nexport function useLinkClickHandler<E extends Element = HTMLAnchorElement>(\n to: To,\n {\n target,\n replace: replaceProp,\n state,\n resetScroll,\n }: {\n target?: React.HTMLAttributeAnchorTarget;\n replace?: boolean;\n state?: any;\n resetScroll?: boolean;\n } = {}\n): (event: React.MouseEvent<E, MouseEvent>) => void {\n let navigate = useNavigate();\n let location = useLocation();\n let path = useResolvedPath(to);\n\n return React.useCallback(\n (event: React.MouseEvent<E, MouseEvent>) => {\n if (shouldProcessLinkClick(event, target)) {\n event.preventDefault();\n\n // If the URL hasn't changed, a regular <a> will do a replace instead of\n // a push, so do the same here unless the replace prop is explcitly set\n let replace =\n replaceProp !== undefined\n ? replaceProp\n : createPath(location) === createPath(path);\n\n navigate(to, { replace, state, resetScroll });\n }\n },\n [location, navigate, path, replaceProp, state, target, to, resetScroll]\n );\n}\n\n/**\n * A convenient wrapper for reading and writing search parameters via the\n * URLSearchParams interface.\n */\nexport function useSearchParams(\n defaultInit?: URLSearchParamsInit\n): [URLSearchParams, SetURLSearchParams] {\n warning(\n typeof URLSearchParams !== \"undefined\",\n `You cannot use the \\`useSearchParams\\` hook in a browser that does not ` +\n `support the URLSearchParams API. If you need to support Internet ` +\n `Explorer 11, we recommend you load a polyfill such as ` +\n `https://github.com/ungap/url-search-params\\n\\n` +\n `If you're unsure how to load polyfills, we recommend you check out ` +\n `https://polyfill.io/v3/ which provides some recommendations about how ` +\n `to load polyfills only for users that need them, instead of for every ` +\n `user.`\n );\n\n let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));\n\n let location = useLocation();\n let searchParams = React.useMemo(\n () =>\n getSearchParamsForLocation(\n location.search,\n defaultSearchParamsRef.current\n ),\n [location.search]\n );\n\n let navigate = useNavigate();\n let setSearchParams = React.useCallback<SetURLSearchParams>(\n (nextInit, navigateOptions) => {\n const newSearchParams = createSearchParams(\n typeof nextInit === \"function\" ? nextInit(searchParams) : nextInit\n );\n navigate(\"?\" + newSearchParams, navigateOptions);\n },\n [navigate, searchParams]\n );\n\n return [searchParams, setSearchParams];\n}\n\ntype SetURLSearchParams = (\n nextInit?:\n | URLSearchParamsInit\n | ((prev: URLSearchParams) => URLSearchParamsInit),\n navigateOpts?: NavigateOptions\n) => void;\n\n/**\n * Submits a HTML `<form>` to the server without reloading the page.\n */\nexport interface SubmitFunction {\n (\n /**\n * Specifies the `<form>` to be submitted to the server, a specific\n * `<button>` or `<input type=\"submit\">` to use to submit the form, or some\n * arbitrary data to submit.\n *\n * Note: When using a `<button>` its `name` and `value` will also be\n * included in the form data that is submitted.\n */\n target:\n | HTMLFormElement\n | HTMLButtonElement\n | HTMLInputElement\n | FormData\n | URLSearchParams\n | { [name: string]: string }\n | null,\n\n /**\n * Options that override the `<form>`'s own attributes. Required when\n * submitting arbitrary data without a backing `<form>`.\n */\n options?: SubmitOptions\n ): void;\n}\n\n/**\n * Returns a function that may be used to programmatically submit a form (or\n * some arbitrary data) to the server.\n */\nexport function useSubmit(): SubmitFunction {\n return useSubmitImpl();\n}\n\nfunction useSubmitImpl(fetcherKey?: string, routeId?: string): SubmitFunction {\n let router = React.useContext(UNSAFE_DataRouterContext);\n let defaultAction = useFormAction();\n\n return React.useCallback(\n (target, options = {}) => {\n invariant(\n router != null,\n \"useSubmit() must be used within a <DataRouter>\"\n );\n\n if (typeof document === \"undefined\") {\n throw new Error(\n \"You are calling submit during the server render. \" +\n \"Try calling submit within a `useEffect` or callback instead.\"\n );\n }\n\n let { method, encType, formData, url } = getFormSubmissionInfo(\n target,\n defaultAction,\n options\n );\n\n let href = url.pathname + url.search;\n let opts = {\n // If replace is not specified, we'll default to false for GET and\n // true otherwise\n replace:\n options.replace != null ? options.replace === true : method !== \"get\",\n formData,\n formMethod: method as FormMethod,\n formEncType: encType as FormEncType,\n };\n if (fetcherKey) {\n invariant(routeId != null, \"No routeId available for useFetcher()\");\n router.fetch(fetcherKey, routeId, href, opts);\n } else {\n router.navigate(href, opts);\n }\n },\n [defaultAction, router, fetcherKey, routeId]\n );\n}\n\nexport function useFormAction(action = \".\"): string {\n let routeContext = React.useContext(UNSAFE_RouteContext);\n invariant(routeContext, \"useFormAction must be used inside a RouteContext\");\n\n let [match] = routeContext.matches.slice(-1);\n let { pathname, search } = useResolvedPath(action);\n\n if (action === \".\" && match.route.index) {\n search = search ? search.replace(/^\\?/, \"?index&\") : \"?index\";\n }\n\n return pathname + search;\n}\n\nfunction createFetcherForm(fetcherKey: string, routeId: string) {\n let FetcherForm = React.forwardRef<HTMLFormElement, FormProps>(\n (props, ref) => {\n return (\n <FormImpl\n {...props}\n ref={ref}\n fetcherKey={fetcherKey}\n routeId={routeId}\n />\n );\n }\n );\n if (__DEV__) {\n FetcherForm.displayName = \"fetcher.Form\";\n }\n return FetcherForm;\n}\n\nlet fetcherId = 0;\n\ntype FetcherWithComponents<TData> = Fetcher<TData> & {\n Form: ReturnType<typeof createFetcherForm>;\n submit: ReturnType<typeof useSubmitImpl>;\n load: (href: string) => void;\n};\n\n/**\n * Interacts with route loaders and actions without causing a navigation. Great\n * for any interaction that stays on the same page.\n */\nexport function useFetcher<TData = any>(): FetcherWithComponents<TData> {\n let router = React.useContext(UNSAFE_DataRouterContext);\n invariant(router, `useFetcher must be used within a DataRouter`);\n\n let route = React.useContext(UNSAFE_RouteContext);\n invariant(route, `useFetcher must be used inside a RouteContext`);\n\n let routeId = route.matches[route.matches.length - 1]?.route.id;\n invariant(\n routeId != null,\n `useFetcher can only be used on routes that contain a unique \"id\"`\n );\n\n let [fetcherKey] = React.useState(() => String(++fetcherId));\n let [Form] = React.useState(() => {\n invariant(routeId, `No routeId available for fetcher.Form()`);\n return createFetcherForm(fetcherKey, routeId);\n });\n let [load] = React.useState(() => (href: string) => {\n invariant(router, \"No router available for fetcher.load()\");\n invariant(routeId, \"No routeId available for fetcher.load()\");\n router.fetch(fetcherKey, routeId, href);\n });\n let submit = useSubmitImpl(fetcherKey, routeId);\n\n let fetcher = router.getFetcher<TData>(fetcherKey);\n\n let fetcherWithComponents = React.useMemo(\n () => ({\n Form,\n submit,\n load,\n ...fetcher,\n }),\n [fetcher, Form, submit, load]\n );\n\n React.useEffect(() => {\n // Is this busted when the React team gets real weird and calls effects\n // twice on mount? We really just need to garbage collect here when this\n // fetcher is no longer around.\n return () => {\n if (!router) {\n console.warn(`No fetcher available to clean up from useFetcher()`);\n return;\n }\n router.deleteFetcher(fetcherKey);\n };\n }, [router, fetcherKey]);\n\n return fetcherWithComponents;\n}\n\n/**\n * Provides all fetchers currently on the page. Useful for layouts and parent\n * routes that need to provide pending/optimistic UI regarding the fetch.\n */\nexport function useFetchers(): Fetcher[] {\n let state = React.useContext(UNSAFE_DataRouterStateContext);\n invariant(state, `useFetchers must be used within a DataRouter`);\n return [...state.fetchers.values()];\n}\n\nconst SCROLL_RESTORATION_STORAGE_KEY = \"react-router-scroll-positions\";\nlet savedScrollPositions: Record<string, number> = {};\n\n/**\n * When rendered inside a DataRouter, will restore scroll positions on navigations\n */\nfunction useScrollRestoration({\n getKey,\n storageKey,\n}: {\n getKey?: GetScrollRestorationKeyFunction;\n storageKey?: string;\n} = {}) {\n let location = useLocation();\n let router = React.useContext(UNSAFE_DataRouterContext);\n let state = React.useContext(UNSAFE_DataRouterStateContext);\n\n invariant(\n router != null && state != null,\n \"useScrollRestoration must be used within a DataRouter\"\n );\n let { restoreScrollPosition, resetScrollPosition } = state;\n\n // Trigger manual scroll restoration while we're active\n React.useEffect(() => {\n window.history.scrollRestoration = \"manual\";\n return () => {\n window.history.scrollRestoration = \"auto\";\n };\n }, []);\n\n // Save positions on unload\n useBeforeUnload(\n React.useCallback(() => {\n if (state?.navigation.state === \"idle\") {\n let key =\n (getKey ? getKey(state.location, state.matches) : null) ||\n state.location.key;\n savedScrollPositions[key] = window.scrollY;\n }\n sessionStorage.setItem(\n storageKey || SCROLL_RESTORATION_STORAGE_KEY,\n JSON.stringify(savedScrollPositions)\n );\n window.history.scrollRestoration = \"auto\";\n }, [\n storageKey,\n getKey,\n state.navigation.state,\n state.location,\n state.matches,\n ])\n );\n\n // Read in any saved scroll locations\n React.useLayoutEffect(() => {\n try {\n let sessionPositions = sessionStorage.getItem(\n storageKey || SCROLL_RESTORATION_STORAGE_KEY\n );\n if (sessionPositions) {\n savedScrollPositions = JSON.parse(sessionPositions);\n }\n } catch (e) {\n // no-op, use default empty object\n }\n }, [storageKey]);\n\n // Enable scroll restoration in the router\n React.useLayoutEffect(() => {\n let disableScrollRestoration = router?.enableScrollRestoration(\n savedScrollPositions,\n () => window.scrollY,\n getKey\n );\n return () => disableScrollRestoration && disableScrollRestoration();\n }, [router, getKey]);\n\n // Restore scrolling when state.restoreScrollPosition changes\n React.useLayoutEffect(() => {\n // Explicit false means don't do anything (used for submissions)\n if (restoreScrollPosition === false) {\n return;\n }\n\n // been here before, scroll to it\n if (typeof restoreScrollPosition === \"number\") {\n window.scrollTo(0, restoreScrollPosition);\n return;\n }\n\n // try to scroll to the hash\n if (location.hash) {\n let el = document.getElementById(location.hash.slice(1));\n if (el) {\n el.scrollIntoView();\n return;\n }\n }\n\n // Opt out of scroll reset if this link requested it\n if (resetScrollPosition === false) {\n return;\n }\n\n // otherwise go to the top on new locations\n window.scrollTo(0, 0);\n }, [location, restoreScrollPosition, resetScrollPosition]);\n}\n\nfunction useBeforeUnload(callback: () => any): void {\n React.useEffect(() => {\n window.addEventListener(\"beforeunload\", callback);\n return () => {\n window.removeEventListener(\"beforeunload\", callback);\n };\n }, [callback]);\n}\n\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Utils\n////////////////////////////////////////////////////////////////////////////////\n\nfunction warning(cond: boolean, message: string): void {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\n try {\n // Welcome to debugging React Router!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n//#endregion\n"],"names":["defaultMethod","defaultEncType","isHtmlElement","object","tagName","isButtonElement","toLowerCase","isFormElement","isInputElement","isModifiedEvent","event","metaKey","altKey","ctrlKey","shiftKey","shouldProcessLinkClick","target","button","createSearchParams","init","URLSearchParams","Array","isArray","Object","keys","reduce","memo","key","value","concat","map","v","getSearchParamsForLocation","locationSearch","defaultSearchParams","searchParams","has","getAll","forEach","append","getFormSubmissionInfo","defaultAction","options","method","action","encType","formData","submissionTrigger","getAttribute","FormData","name","type","form","Error","set","protocol","host","window","location","url","URL","DataBrowserRouter","children","fallbackElement","hydrationData","routes","useRenderDataRouter","createRouter","createBrowserRouter","DataHashRouter","createHashRouter","BrowserRouter","basename","historyRef","React","useRef","current","createBrowserHistory","v5Compat","history","state","setState","useState","useLayoutEffect","listen","HashRouter","createHashHistory","HistoryRouter","displayName","Link","forwardRef","LinkWithRef","onClick","reloadDocument","replace","to","resetScroll","rest","ref","href","useHref","internalOnClick","useLinkClickHandler","handleClick","defaultPrevented","NavLink","NavLinkWithRef","ariaCurrentProp","caseSensitive","className","classNameProp","end","style","styleProp","path","useResolvedPath","match","useMatch","pathname","routerState","useContext","UNSAFE_DataRouterStateContext","nextLocation","navigation","nextPath","nextMatch","useMemo","matchPath","isPending","isActive","ariaCurrent","undefined","filter","Boolean","join","Form","props","FormImpl","onSubmit","fetcherKey","routeId","forwardedRef","submit","useSubmitImpl","formMethod","formAction","useFormAction","submitHandler","preventDefault","submitter","nativeEvent","currentTarget","ScrollRestoration","getKey","storageKey","useScrollRestoration","replaceProp","navigate","useNavigate","useLocation","useCallback","createPath","useSearchParams","defaultInit","warning","defaultSearchParamsRef","search","setSearchParams","nextInit","navigateOptions","newSearchParams","useSubmit","router","UNSAFE_DataRouterContext","invariant","document","opts","formEncType","fetch","routeContext","UNSAFE_RouteContext","matches","slice","route","index","createFetcherForm","FetcherForm","fetcherId","useFetcher","length","id","String","load","fetcher","getFetcher","fetcherWithComponents","useEffect","console","warn","deleteFetcher","useFetchers","fetchers","values","SCROLL_RESTORATION_STORAGE_KEY","savedScrollPositions","restoreScrollPosition","resetScrollPosition","scrollRestoration","useBeforeUnload","scrollY","sessionStorage","setItem","JSON","stringify","sessionPositions","getItem","parse","e","disableScrollRestoration","enableScrollRestoration","scrollTo","hash","el","getElementById","scrollIntoView","callback","addEventListener","removeEventListener","cond","message"],"mappings":";;;;;;;;;;;;;;;AAEO,MAAMA,aAAa,GAAG,KAAtB,C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AACA,QAAA,OAAA;AACD,OAAA;AACF,KAnByB;;;IAsB1B,IAAIlB,mBAAmB,KAAK,KAA5B,EAAmC;AACjC,MAAA,OAAA;AACD,KAxByB;;;AA2B1BrJ,IAAAA,MAAM,CAACmK,QAAP,CAAgB,CAAhB,EAAmB,CAAnB,CAAA,CAAA;AACD,GA5BD,EA4BG,CAAClK,QAAD,EAAWmJ,qBAAX,EAAkCC,mBAAlC,CA5BH,CAAA,CAAA;AA6BD,CAAA;;AAED,SAASE,eAAT,CAAyBiB,QAAzB,EAAoD;EAClDvJ,KAAK,CAAC0H,SAAN,CAAgB,MAAM;AACpB3I,IAAAA,MAAM,CAACyK,gBAAP,CAAwB,cAAxB,EAAwCD,QAAxC,CAAA,CAAA;AACA,IAAA,OAAO,MAAM;AACXxK,MAAAA,MAAM,CAAC0K,mBAAP,CAA2B,cAA3B,EAA2CF,QAA3C,CAAA,CAAA;KADF,CAAA;GAFF,EAKG,CAACA,QAAD,CALH,CAAA,CAAA;AAMD;AAID;AACA;AACA;;;AAEA,SAAS7D,OAAT,CAAiBgE,IAAjB,EAAgCC,OAAhC,EAAuD;EACrD,IAAI,CAACD,IAAL,EAAW;AACT;IACA,IAAI,OAAO/B,OAAP,KAAmB,WAAvB,EAAoCA,OAAO,CAACC,IAAR,CAAa+B,OAAb,CAAA,CAAA;;IAEpC,IAAI;AACF;AACA;AACA;AACA;AACA;AACA,MAAA,MAAM,IAAIhL,KAAJ,CAAUgL,OAAV,CAAN,CANE;AAQH,KARD,CAQE,OAAOZ,CAAP,EAAU,EAAE;AACf,GAAA;AACF;;;;"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router DOM v6.4.0-pre.4
2
+ * React Router DOM v6.4.0-pre.7
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -8,5 +8,5 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import*as e from"react";import{useRenderDataRouter as t,Router as n,useHref as o,createPath as r,useResolvedPath as a,useMatch as i,UNSAFE_DataRouterStateContext as u,useNavigate as l,useLocation as c,UNSAFE_DataRouterContext as s,UNSAFE_RouteContext as f}from"react-router";export{DataMemoryRouter,MemoryRouter,Navigate,NavigationType,Outlet,Route,Router,Routes,UNSAFE_DataRouterContext,UNSAFE_DataRouterStateContext,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,createPath,createRoutesFromChildren,generatePath,isRouteErrorResponse,json,matchPath,matchRoutes,parsePath,redirect,renderMatches,resolvePath,useActionData,useHref,useInRouterContext,useLoaderData,useLocation,useMatch,useMatches,useNavigate,useNavigation,useNavigationType,useOutlet,useOutletContext,useParams,useRenderDataRouter,useResolvedPath,useRevalidator,useRouteError,useRouteLoaderData,useRoutes}from"react-router";import{createBrowserRouter as m,createHashRouter as d,createBrowserHistory as h,createHashHistory as p,matchPath as g,invariant as y}from"@remix-run/router";const w="application/x-www-form-urlencoded";function b(e){return null!=e&&"string"==typeof e.tagName}function v(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let o=e[n];return t.concat(Array.isArray(o)?o.map((e=>[n,e])):[[n,o]])}),[]))}function R(e,t,n){let o,r,a,i;if(b(u=e)&&"form"===u.tagName.toLowerCase()){let u=n.submissionTrigger;o=n.method||e.getAttribute("method")||"get",r=n.action||e.getAttribute("action")||t,a=n.encType||e.getAttribute("enctype")||w,i=new FormData(e),u&&u.name&&i.append(u.name,u.value)}else if(function(e){return b(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return b(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let u=e.form;if(null==u)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');o=n.method||e.getAttribute("formmethod")||u.getAttribute("method")||"get",r=n.action||e.getAttribute("formaction")||u.getAttribute("action")||t,a=n.encType||e.getAttribute("formenctype")||u.getAttribute("enctype")||w,i=new FormData(u),e.name&&i.set(e.name,e.value)}else{if(b(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');if(o=n.method||"get",r=n.action||t,a=n.encType||w,e instanceof FormData)i=e;else if(i=new FormData,e instanceof URLSearchParams)for(let[t,n]of e)i.append(t,n);else if(null!=e)for(let t of Object.keys(e))i.append(t,e[t])}var u;let{protocol:l,host:c}=window.location;return{url:new URL(r,`${l}//${c}`),method:o,encType:a,formData:i}}function E({children:e,fallbackElement:n,hydrationData:o,routes:r,window:a}){return t({children:e,fallbackElement:n,routes:r,createRouter:e=>m({routes:e,hydrationData:o,window:a})})}function S({children:e,hydrationData:n,fallbackElement:o,routes:r,window:a}){return t({children:e,fallbackElement:o,routes:r,createRouter:e=>d({routes:e,hydrationData:n,window:a})})}function C({basename:t,children:o,window:r}){let a=e.useRef();null==a.current&&(a.current=h({window:r,v5Compat:!0}));let i=a.current,[u,l]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(l)),[i]),e.createElement(n,{basename:t,children:o,location:u.location,navigationType:u.action,navigator:i})}function A({basename:t,children:o,window:r}){let a=e.useRef();null==a.current&&(a.current=p({window:r,v5Compat:!0}));let i=a.current,[u,l]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(l)),[i]),e.createElement(n,{basename:t,children:o,location:u.location,navigationType:u.action,navigator:i})}function x({basename:t,children:o,history:r}){const[a,i]=e.useState({action:r.action,location:r.location});return e.useLayoutEffect((()=>r.listen(i)),[r]),e.createElement(n,{basename:t,children:o,location:a.location,navigationType:a.action,navigator:r})}const D=e.forwardRef((function({onClick:t,reloadDocument:n,replace:r,state:a,target:i,to:u,resetScroll:l,...c},s){let f=o(u),m=k(u,{replace:r,state:a,target:i,resetScroll:l});return e.createElement("a",Object.assign({},c,{href:f,onClick:function(e){t&&t(e),e.defaultPrevented||n||m(e)},ref:s,target:i}))})),L=e.forwardRef((function({"aria-current":t="page",caseSensitive:n=!1,className:o="",end:r=!1,style:l,to:c,children:s,...f},m){let d,h=a(c),p=i({path:h.pathname,end:r,caseSensitive:n}),y=e.useContext(u)?.navigation.location,w=a(y||""),b=null!=e.useMemo((()=>y?g({path:h.pathname,end:r,caseSensitive:n},w.pathname):null),[y,h.pathname,n,r,w.pathname]),v=null!=p,R=v?t:void 0;d="function"==typeof o?o({isActive:v,isPending:b}):[o,v?"active":null,b?"pending":null].filter(Boolean).join(" ");let E="function"==typeof l?l({isActive:v,isPending:b}):l;return e.createElement(D,Object.assign({},f,{"aria-current":R,className:d,ref:m,style:E,to:c}),"function"==typeof s?s({isActive:v,isPending:b}):s)})),N=e.forwardRef(((t,n)=>e.createElement(P,Object.assign({},t,{ref:n})))),P=e.forwardRef((({replace:t,method:n="get",action:o=".",onSubmit:r,fetcherKey:a,...i},u)=>{let l=O(a),c="get"===n.toLowerCase()?"get":"post",s=j(o);return e.createElement("form",Object.assign({ref:u,method:c,action:s,onSubmit:e=>{if(r&&r(e),e.defaultPrevented)return;e.preventDefault();let o=e.nativeEvent.submitter;l(o||e.currentTarget,{method:n,replace:t})}},i))}));function T({getKey:t,storageKey:n}){return function({getKey:t,storageKey:n}={}){let o=c(),r=e.useContext(s),a=e.useContext(u);(null==r||null==a)&&y(!1);let{restoreScrollPosition:i,resetScrollPosition:l}=a;e.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),f=e.useCallback((()=>{if("idle"===a?.navigation.state){let e=(t?t(a.location,a.matches):null)||a.location.key;I[e]=window.scrollY}sessionStorage.setItem(n||"react-router-scroll-positions",JSON.stringify(I)),window.history.scrollRestoration="auto"}),[n,t,a.navigation.state,a.location,a.matches]),e.useEffect((()=>(window.addEventListener("beforeunload",f),()=>{window.removeEventListener("beforeunload",f)})),[f]),e.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(n||"react-router-scroll-positions");e&&(I=JSON.parse(e))}catch(e){}}),[n]),e.useLayoutEffect((()=>{let e=r?.enableScrollRestoration(I,(()=>window.scrollY),t);return()=>e&&e()}),[r,t]),e.useLayoutEffect((()=>{if(!1!==i)if("number"!=typeof i){if(o.hash){let e=document.getElementById(o.hash.slice(1));if(e)return void e.scrollIntoView()}!1!==l&&window.scrollTo(0,0)}else window.scrollTo(0,i)}),[o,i,l]);var f}({getKey:t,storageKey:n}),null}function k(t,{target:n,replace:o,state:i,resetScroll:u}={}){let s=l(),f=c(),m=a(t);return e.useCallback((e=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(e,n)){e.preventDefault();let n=void 0!==o?o:r(f)===r(m);s(t,{replace:n,state:i,resetScroll:u})}}),[f,s,m,o,i,n,t,u])}function F(t){let n=e.useRef(v(t)),o=c(),r=e.useMemo((()=>function(e,t){let n=v(e);for(let o of t.keys())n.has(o)||t.getAll(o).forEach((e=>{n.append(o,e)}));return n}(o.search,n.current)),[o.search]),a=l();return[r,e.useCallback(((e,t)=>{a("?"+v(e),t)}),[a])]}function K(){return O()}function O(t){let n=e.useContext(s),o=j();return e.useCallback(((e,r={})=>{if(null==n&&y(!1),"undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");let{method:a,encType:i,formData:u,url:l}=R(e,o,r),c=l.pathname+l.search,s={replace:null!=r.replace?!0===r.replace:"get"!==a,formData:u,formMethod:a,formEncType:i};t?n.fetch(t,c,s):n.navigate(c,s)}),[o,n,t])}function j(t="."){let n=e.useContext(f);n||y(!1);let[o]=n.matches.slice(-1),{pathname:r,search:i}=a(t);return"."===t&&o.route.index&&(i=i?i.replace(/^\?/,"?index&"):"?index"),r+i}let M=0;function U(){let t=e.useContext(s);t||y(!1);let[n]=e.useState((()=>String(++M))),[o]=e.useState((()=>function(t){return e.forwardRef(((n,o)=>e.createElement(P,Object.assign({},n,{ref:o,fetcherKey:t}))))}(n))),[r]=e.useState((()=>e=>{t||y(!1),t.fetch(n,e)})),a=O(n),i=t.getFetcher(n),u=e.useMemo((()=>({Form:o,submit:a,load:r,...i})),[i,o,a,r]);return e.useEffect((()=>()=>{t?t.deleteFetcher(n):console.warn("No fetcher available to clean up from useFetcher()")}),[t,n]),u}function _(){let t=e.useContext(u);return t||y(!1),[...t.fetchers.values()]}let I={};export{C as BrowserRouter,E as DataBrowserRouter,S as DataHashRouter,N as Form,A as HashRouter,D as Link,L as NavLink,T as ScrollRestoration,v as createSearchParams,x as unstable_HistoryRouter,U as useFetcher,_ as useFetchers,j as useFormAction,k as useLinkClickHandler,F as useSearchParams,K as useSubmit};
11
+ import*as e from"react";import{useRenderDataRouter as t,Router as n,useHref as o,createPath as r,useResolvedPath as a,useMatch as i,UNSAFE_DataRouterStateContext as u,useNavigate as l,useLocation as c,UNSAFE_DataRouterContext as s,UNSAFE_RouteContext as f}from"react-router";export{DataMemoryRouter,MemoryRouter,Navigate,NavigationType,Outlet,Route,Router,Routes,UNSAFE_DataRouterContext,UNSAFE_DataRouterStateContext,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,createPath,createRoutesFromChildren,generatePath,isRouteErrorResponse,json,matchPath,matchRoutes,parsePath,redirect,renderMatches,resolvePath,useActionData,useHref,useInRouterContext,useLoaderData,useLocation,useMatch,useMatches,useNavigate,useNavigation,useNavigationType,useOutlet,useOutletContext,useParams,useRenderDataRouter,useResolvedPath,useRevalidator,useRouteError,useRouteLoaderData,useRoutes}from"react-router";import{createBrowserRouter as m,createHashRouter as d,createBrowserHistory as h,createHashHistory as p,matchPath as g,invariant as y}from"@remix-run/router";const w="application/x-www-form-urlencoded";function b(e){return null!=e&&"string"==typeof e.tagName}function v(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let o=e[n];return t.concat(Array.isArray(o)?o.map((e=>[n,e])):[[n,o]])}),[]))}function R(e,t,n){let o,r,a,i;if(b(u=e)&&"form"===u.tagName.toLowerCase()){let u=n.submissionTrigger;o=n.method||e.getAttribute("method")||"get",r=n.action||e.getAttribute("action")||t,a=n.encType||e.getAttribute("enctype")||w,i=new FormData(e),u&&u.name&&i.append(u.name,u.value)}else if(function(e){return b(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return b(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let u=e.form;if(null==u)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');o=n.method||e.getAttribute("formmethod")||u.getAttribute("method")||"get",r=n.action||e.getAttribute("formaction")||u.getAttribute("action")||t,a=n.encType||e.getAttribute("formenctype")||u.getAttribute("enctype")||w,i=new FormData(u),e.name&&i.set(e.name,e.value)}else{if(b(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');if(o=n.method||"get",r=n.action||t,a=n.encType||w,e instanceof FormData)i=e;else if(i=new FormData,e instanceof URLSearchParams)for(let[t,n]of e)i.append(t,n);else if(null!=e)for(let t of Object.keys(e))i.append(t,e[t])}var u;let{protocol:l,host:c}=window.location;return{url:new URL(r,`${l}//${c}`),method:o,encType:a,formData:i}}function E({children:e,fallbackElement:n,hydrationData:o,routes:r,window:a}){return t({children:e,fallbackElement:n,routes:r,createRouter:e=>m({routes:e,hydrationData:o,window:a})})}function S({children:e,hydrationData:n,fallbackElement:o,routes:r,window:a}){return t({children:e,fallbackElement:o,routes:r,createRouter:e=>d({routes:e,hydrationData:n,window:a})})}function C({basename:t,children:o,window:r}){let a=e.useRef();null==a.current&&(a.current=h({window:r,v5Compat:!0}));let i=a.current,[u,l]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(l)),[i]),e.createElement(n,{basename:t,children:o,location:u.location,navigationType:u.action,navigator:i})}function A({basename:t,children:o,window:r}){let a=e.useRef();null==a.current&&(a.current=p({window:r,v5Compat:!0}));let i=a.current,[u,l]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(l)),[i]),e.createElement(n,{basename:t,children:o,location:u.location,navigationType:u.action,navigator:i})}function x({basename:t,children:o,history:r}){const[a,i]=e.useState({action:r.action,location:r.location});return e.useLayoutEffect((()=>r.listen(i)),[r]),e.createElement(n,{basename:t,children:o,location:a.location,navigationType:a.action,navigator:r})}const D=e.forwardRef((function({onClick:t,reloadDocument:n,replace:r,state:a,target:i,to:u,resetScroll:l,...c},s){let f=o(u),m=k(u,{replace:r,state:a,target:i,resetScroll:l});return e.createElement("a",Object.assign({},c,{href:f,onClick:function(e){t&&t(e),e.defaultPrevented||n||m(e)},ref:s,target:i}))})),L=e.forwardRef((function({"aria-current":t="page",caseSensitive:n=!1,className:o="",end:r=!1,style:l,to:c,children:s,...f},m){let d,h=a(c),p=i({path:h.pathname,end:r,caseSensitive:n}),y=e.useContext(u)?.navigation.location,w=a(y||""),b=null!=e.useMemo((()=>y?g({path:h.pathname,end:r,caseSensitive:n},w.pathname):null),[y,h.pathname,n,r,w.pathname]),v=null!=p,R=v?t:void 0;d="function"==typeof o?o({isActive:v,isPending:b}):[o,v?"active":null,b?"pending":null].filter(Boolean).join(" ");let E="function"==typeof l?l({isActive:v,isPending:b}):l;return e.createElement(D,Object.assign({},f,{"aria-current":R,className:d,ref:m,style:E,to:c}),"function"==typeof s?s({isActive:v,isPending:b}):s)})),N=e.forwardRef(((t,n)=>e.createElement(P,Object.assign({},t,{ref:n})))),P=e.forwardRef((({replace:t,method:n="get",action:o=".",onSubmit:r,fetcherKey:a,routeId:i,...u},l)=>{let c=O(a,i),s="get"===n.toLowerCase()?"get":"post",f=j(o);return e.createElement("form",Object.assign({ref:l,method:s,action:f,onSubmit:e=>{if(r&&r(e),e.defaultPrevented)return;e.preventDefault();let o=e.nativeEvent.submitter;c(o||e.currentTarget,{method:n,replace:t})}},u))}));function T({getKey:t,storageKey:n}){return function({getKey:t,storageKey:n}={}){let o=c(),r=e.useContext(s),a=e.useContext(u);(null==r||null==a)&&y(!1);let{restoreScrollPosition:i,resetScrollPosition:l}=a;e.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),f=e.useCallback((()=>{if("idle"===a?.navigation.state){let e=(t?t(a.location,a.matches):null)||a.location.key;_[e]=window.scrollY}sessionStorage.setItem(n||"react-router-scroll-positions",JSON.stringify(_)),window.history.scrollRestoration="auto"}),[n,t,a.navigation.state,a.location,a.matches]),e.useEffect((()=>(window.addEventListener("beforeunload",f),()=>{window.removeEventListener("beforeunload",f)})),[f]),e.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(n||"react-router-scroll-positions");e&&(_=JSON.parse(e))}catch(e){}}),[n]),e.useLayoutEffect((()=>{let e=r?.enableScrollRestoration(_,(()=>window.scrollY),t);return()=>e&&e()}),[r,t]),e.useLayoutEffect((()=>{if(!1!==i)if("number"!=typeof i){if(o.hash){let e=document.getElementById(o.hash.slice(1));if(e)return void e.scrollIntoView()}!1!==l&&window.scrollTo(0,0)}else window.scrollTo(0,i)}),[o,i,l]);var f}({getKey:t,storageKey:n}),null}function k(t,{target:n,replace:o,state:i,resetScroll:u}={}){let s=l(),f=c(),m=a(t);return e.useCallback((e=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(e,n)){e.preventDefault();let n=void 0!==o?o:r(f)===r(m);s(t,{replace:n,state:i,resetScroll:u})}}),[f,s,m,o,i,n,t,u])}function F(t){let n=e.useRef(v(t)),o=c(),r=e.useMemo((()=>function(e,t){let n=v(e);for(let o of t.keys())n.has(o)||t.getAll(o).forEach((e=>{n.append(o,e)}));return n}(o.search,n.current)),[o.search]),a=l(),i=e.useCallback(((e,t)=>{const n=v("function"==typeof e?e(r):e);a("?"+n,t)}),[a,r]);return[r,i]}function K(){return O()}function O(t,n){let o=e.useContext(s),r=j();return e.useCallback(((e,a={})=>{if(null==o&&y(!1),"undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");let{method:i,encType:u,formData:l,url:c}=R(e,r,a),s=c.pathname+c.search,f={replace:null!=a.replace?!0===a.replace:"get"!==i,formData:l,formMethod:i,formEncType:u};t?(null==n&&y(!1),o.fetch(t,n,s,f)):o.navigate(s,f)}),[r,o,t,n])}function j(t="."){let n=e.useContext(f);n||y(!1);let[o]=n.matches.slice(-1),{pathname:r,search:i}=a(t);return"."===t&&o.route.index&&(i=i?i.replace(/^\?/,"?index&"):"?index"),r+i}let M=0;function U(){let t=e.useContext(s);t||y(!1);let n=e.useContext(f);n||y(!1);let o=n.matches[n.matches.length-1]?.route.id;null==o&&y(!1);let[r]=e.useState((()=>String(++M))),[a]=e.useState((()=>(o||y(!1),function(t,n){return e.forwardRef(((o,r)=>e.createElement(P,Object.assign({},o,{ref:r,fetcherKey:t,routeId:n}))))}(r,o)))),[i]=e.useState((()=>e=>{t||y(!1),o||y(!1),t.fetch(r,o,e)})),u=O(r,o),l=t.getFetcher(r),c=e.useMemo((()=>({Form:a,submit:u,load:i,...l})),[l,a,u,i]);return e.useEffect((()=>()=>{t?t.deleteFetcher(r):console.warn("No fetcher available to clean up from useFetcher()")}),[t,r]),c}function I(){let t=e.useContext(u);return t||y(!1),[...t.fetchers.values()]}let _={};export{C as BrowserRouter,E as DataBrowserRouter,S as DataHashRouter,N as Form,A as HashRouter,D as Link,L as NavLink,T as ScrollRestoration,v as createSearchParams,x as unstable_HistoryRouter,U as useFetcher,I as useFetchers,j as useFormAction,k as useLinkClickHandler,F as useSearchParams,K as useSubmit};
12
12
  //# sourceMappingURL=react-router-dom.production.min.js.map