react-router-dom.development.js 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285
  1. /**
  2. * React Router DOM v6.8.1
  3. *
  4. * Copyright (c) Remix Software Inc.
  5. *
  6. * This source code is licensed under the MIT license found in the
  7. * LICENSE.md file in the root directory of this source tree.
  8. *
  9. * @license MIT
  10. */
  11. (function (global, factory) {
  12. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-router'), require('@remix-run/router')) :
  13. typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-router', '@remix-run/router'], factory) :
  14. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactRouterDOM = {}, global.React, global.ReactRouter, global.RemixRouter));
  15. })(this, (function (exports, React, reactRouter, router) { 'use strict';
  16. function _interopNamespace(e) {
  17. if (e && e.__esModule) return e;
  18. var n = Object.create(null);
  19. if (e) {
  20. Object.keys(e).forEach(function (k) {
  21. if (k !== 'default') {
  22. var d = Object.getOwnPropertyDescriptor(e, k);
  23. Object.defineProperty(n, k, d.get ? d : {
  24. enumerable: true,
  25. get: function () { return e[k]; }
  26. });
  27. }
  28. });
  29. }
  30. n["default"] = e;
  31. return Object.freeze(n);
  32. }
  33. var React__namespace = /*#__PURE__*/_interopNamespace(React);
  34. function _extends() {
  35. _extends = Object.assign ? Object.assign.bind() : function (target) {
  36. for (var i = 1; i < arguments.length; i++) {
  37. var source = arguments[i];
  38. for (var key in source) {
  39. if (Object.prototype.hasOwnProperty.call(source, key)) {
  40. target[key] = source[key];
  41. }
  42. }
  43. }
  44. return target;
  45. };
  46. return _extends.apply(this, arguments);
  47. }
  48. function _objectWithoutPropertiesLoose(source, excluded) {
  49. if (source == null) return {};
  50. var target = {};
  51. var sourceKeys = Object.keys(source);
  52. var key, i;
  53. for (i = 0; i < sourceKeys.length; i++) {
  54. key = sourceKeys[i];
  55. if (excluded.indexOf(key) >= 0) continue;
  56. target[key] = source[key];
  57. }
  58. return target;
  59. }
  60. const defaultMethod = "get";
  61. const defaultEncType = "application/x-www-form-urlencoded";
  62. function isHtmlElement(object) {
  63. return object != null && typeof object.tagName === "string";
  64. }
  65. function isButtonElement(object) {
  66. return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
  67. }
  68. function isFormElement(object) {
  69. return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
  70. }
  71. function isInputElement(object) {
  72. return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
  73. }
  74. function isModifiedEvent(event) {
  75. return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
  76. }
  77. function shouldProcessLinkClick(event, target) {
  78. return event.button === 0 && ( // Ignore everything but left clicks
  79. !target || target === "_self") && // Let browser handle "target=_blank" etc.
  80. !isModifiedEvent(event) // Ignore clicks with modifier keys
  81. ;
  82. }
  83. /**
  84. * Creates a URLSearchParams object using the given initializer.
  85. *
  86. * This is identical to `new URLSearchParams(init)` except it also
  87. * supports arrays as values in the object form of the initializer
  88. * instead of just strings. This is convenient when you need multiple
  89. * values for a given key, but don't want to use an array initializer.
  90. *
  91. * For example, instead of:
  92. *
  93. * let searchParams = new URLSearchParams([
  94. * ['sort', 'name'],
  95. * ['sort', 'price']
  96. * ]);
  97. *
  98. * you can do:
  99. *
  100. * let searchParams = createSearchParams({
  101. * sort: ['name', 'price']
  102. * });
  103. */
  104. function createSearchParams(init) {
  105. if (init === void 0) {
  106. init = "";
  107. }
  108. return new URLSearchParams(typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {
  109. let value = init[key];
  110. return memo.concat(Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]);
  111. }, []));
  112. }
  113. function getSearchParamsForLocation(locationSearch, defaultSearchParams) {
  114. let searchParams = createSearchParams(locationSearch);
  115. if (defaultSearchParams) {
  116. for (let key of defaultSearchParams.keys()) {
  117. if (!searchParams.has(key)) {
  118. defaultSearchParams.getAll(key).forEach(value => {
  119. searchParams.append(key, value);
  120. });
  121. }
  122. }
  123. }
  124. return searchParams;
  125. }
  126. function getFormSubmissionInfo(target, defaultAction, options) {
  127. let method;
  128. let action;
  129. let encType;
  130. let formData;
  131. if (isFormElement(target)) {
  132. let submissionTrigger = options.submissionTrigger;
  133. method = options.method || target.getAttribute("method") || defaultMethod;
  134. action = options.action || target.getAttribute("action") || defaultAction;
  135. encType = options.encType || target.getAttribute("enctype") || defaultEncType;
  136. formData = new FormData(target);
  137. if (submissionTrigger && submissionTrigger.name) {
  138. formData.append(submissionTrigger.name, submissionTrigger.value);
  139. }
  140. } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
  141. let form = target.form;
  142. if (form == null) {
  143. throw new Error("Cannot submit a <button> or <input type=\"submit\"> without a <form>");
  144. } // <button>/<input type="submit"> may override attributes of <form>
  145. method = options.method || target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
  146. action = options.action || target.getAttribute("formaction") || form.getAttribute("action") || defaultAction;
  147. encType = options.encType || target.getAttribute("formenctype") || form.getAttribute("enctype") || defaultEncType;
  148. formData = new FormData(form); // Include name + value from a <button>, appending in case the button name
  149. // matches an existing input name
  150. if (target.name) {
  151. formData.append(target.name, target.value);
  152. }
  153. } else if (isHtmlElement(target)) {
  154. throw new Error("Cannot submit element that is not <form>, <button>, or " + "<input type=\"submit|image\">");
  155. } else {
  156. method = options.method || defaultMethod;
  157. action = options.action || defaultAction;
  158. encType = options.encType || defaultEncType;
  159. if (target instanceof FormData) {
  160. formData = target;
  161. } else {
  162. formData = new FormData();
  163. if (target instanceof URLSearchParams) {
  164. for (let [name, value] of target) {
  165. formData.append(name, value);
  166. }
  167. } else if (target != null) {
  168. for (let name of Object.keys(target)) {
  169. formData.append(name, target[name]);
  170. }
  171. }
  172. }
  173. }
  174. let {
  175. protocol,
  176. host
  177. } = window.location;
  178. let url = new URL(action, protocol + "//" + host);
  179. return {
  180. url,
  181. method: method.toLowerCase(),
  182. encType,
  183. formData
  184. };
  185. }
  186. const _excluded = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset"],
  187. _excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "children"],
  188. _excluded3 = ["reloadDocument", "replace", "method", "action", "onSubmit", "fetcherKey", "routeId", "relative", "preventScrollReset"];
  189. ////////////////////////////////////////////////////////////////////////////////
  190. //#region Routers
  191. ////////////////////////////////////////////////////////////////////////////////
  192. function createBrowserRouter(routes, opts) {
  193. return router.createRouter({
  194. basename: opts == null ? void 0 : opts.basename,
  195. history: router.createBrowserHistory({
  196. window: opts == null ? void 0 : opts.window
  197. }),
  198. hydrationData: (opts == null ? void 0 : opts.hydrationData) || parseHydrationData(),
  199. routes: reactRouter.UNSAFE_enhanceManualRouteObjects(routes)
  200. }).initialize();
  201. }
  202. function createHashRouter(routes, opts) {
  203. return router.createRouter({
  204. basename: opts == null ? void 0 : opts.basename,
  205. history: router.createHashHistory({
  206. window: opts == null ? void 0 : opts.window
  207. }),
  208. hydrationData: (opts == null ? void 0 : opts.hydrationData) || parseHydrationData(),
  209. routes: reactRouter.UNSAFE_enhanceManualRouteObjects(routes)
  210. }).initialize();
  211. }
  212. function parseHydrationData() {
  213. var _window;
  214. let state = (_window = window) == null ? void 0 : _window.__staticRouterHydrationData;
  215. if (state && state.errors) {
  216. state = _extends({}, state, {
  217. errors: deserializeErrors(state.errors)
  218. });
  219. }
  220. return state;
  221. }
  222. function deserializeErrors(errors) {
  223. if (!errors) return null;
  224. let entries = Object.entries(errors);
  225. let serialized = {};
  226. for (let [key, val] of entries) {
  227. // Hey you! If you change this, please change the corresponding logic in
  228. // serializeErrors in react-router-dom/server.tsx :)
  229. if (val && val.__type === "RouteErrorResponse") {
  230. serialized[key] = new router.ErrorResponse(val.status, val.statusText, val.data, val.internal === true);
  231. } else if (val && val.__type === "Error") {
  232. let error = new Error(val.message); // Wipe away the client-side stack trace. Nothing to fill it in with
  233. // because we don't serialize SSR stack traces for security reasons
  234. error.stack = "";
  235. serialized[key] = error;
  236. } else {
  237. serialized[key] = val;
  238. }
  239. }
  240. return serialized;
  241. } //#endregion
  242. ////////////////////////////////////////////////////////////////////////////////
  243. //#region Components
  244. ////////////////////////////////////////////////////////////////////////////////
  245. /**
  246. * A `<Router>` for use in web browsers. Provides the cleanest URLs.
  247. */
  248. function BrowserRouter(_ref) {
  249. let {
  250. basename,
  251. children,
  252. window
  253. } = _ref;
  254. let historyRef = React__namespace.useRef();
  255. if (historyRef.current == null) {
  256. historyRef.current = router.createBrowserHistory({
  257. window,
  258. v5Compat: true
  259. });
  260. }
  261. let history = historyRef.current;
  262. let [state, setState] = React__namespace.useState({
  263. action: history.action,
  264. location: history.location
  265. });
  266. React__namespace.useLayoutEffect(() => history.listen(setState), [history]);
  267. return /*#__PURE__*/React__namespace.createElement(reactRouter.Router, {
  268. basename: basename,
  269. children: children,
  270. location: state.location,
  271. navigationType: state.action,
  272. navigator: history
  273. });
  274. }
  275. /**
  276. * A `<Router>` for use in web browsers. Stores the location in the hash
  277. * portion of the URL so it is not sent to the server.
  278. */
  279. function HashRouter(_ref2) {
  280. let {
  281. basename,
  282. children,
  283. window
  284. } = _ref2;
  285. let historyRef = React__namespace.useRef();
  286. if (historyRef.current == null) {
  287. historyRef.current = router.createHashHistory({
  288. window,
  289. v5Compat: true
  290. });
  291. }
  292. let history = historyRef.current;
  293. let [state, setState] = React__namespace.useState({
  294. action: history.action,
  295. location: history.location
  296. });
  297. React__namespace.useLayoutEffect(() => history.listen(setState), [history]);
  298. return /*#__PURE__*/React__namespace.createElement(reactRouter.Router, {
  299. basename: basename,
  300. children: children,
  301. location: state.location,
  302. navigationType: state.action,
  303. navigator: history
  304. });
  305. }
  306. /**
  307. * A `<Router>` that accepts a pre-instantiated history object. It's important
  308. * to note that using your own history object is highly discouraged and may add
  309. * two versions of the history library to your bundles unless you use the same
  310. * version of the history library that React Router uses internally.
  311. */
  312. function HistoryRouter(_ref3) {
  313. let {
  314. basename,
  315. children,
  316. history
  317. } = _ref3;
  318. const [state, setState] = React__namespace.useState({
  319. action: history.action,
  320. location: history.location
  321. });
  322. React__namespace.useLayoutEffect(() => history.listen(setState), [history]);
  323. return /*#__PURE__*/React__namespace.createElement(reactRouter.Router, {
  324. basename: basename,
  325. children: children,
  326. location: state.location,
  327. navigationType: state.action,
  328. navigator: history
  329. });
  330. }
  331. {
  332. HistoryRouter.displayName = "unstable_HistoryRouter";
  333. }
  334. const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
  335. /**
  336. * The public API for rendering a history-aware <a>.
  337. */
  338. const Link = /*#__PURE__*/React__namespace.forwardRef(function LinkWithRef(_ref4, ref) {
  339. let {
  340. onClick,
  341. relative,
  342. reloadDocument,
  343. replace,
  344. state,
  345. target,
  346. to,
  347. preventScrollReset
  348. } = _ref4,
  349. rest = _objectWithoutPropertiesLoose(_ref4, _excluded);
  350. // Rendered into <a href> for absolute URLs
  351. let absoluteHref;
  352. let isExternal = false;
  353. if (isBrowser && typeof to === "string" && /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(to)) {
  354. absoluteHref = to;
  355. let currentUrl = new URL(window.location.href);
  356. let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
  357. if (targetUrl.origin === currentUrl.origin) {
  358. // Strip the protocol/origin for same-origin absolute URLs
  359. to = targetUrl.pathname + targetUrl.search + targetUrl.hash;
  360. } else {
  361. isExternal = true;
  362. }
  363. } // Rendered into <a href> for relative URLs
  364. let href = reactRouter.useHref(to, {
  365. relative
  366. });
  367. let internalOnClick = useLinkClickHandler(to, {
  368. replace,
  369. state,
  370. target,
  371. preventScrollReset,
  372. relative
  373. });
  374. function handleClick(event) {
  375. if (onClick) onClick(event);
  376. if (!event.defaultPrevented) {
  377. internalOnClick(event);
  378. }
  379. }
  380. return (
  381. /*#__PURE__*/
  382. // eslint-disable-next-line jsx-a11y/anchor-has-content
  383. React__namespace.createElement("a", _extends({}, rest, {
  384. href: absoluteHref || href,
  385. onClick: isExternal || reloadDocument ? onClick : handleClick,
  386. ref: ref,
  387. target: target
  388. }))
  389. );
  390. });
  391. {
  392. Link.displayName = "Link";
  393. }
  394. /**
  395. * A <Link> wrapper that knows if it's "active" or not.
  396. */
  397. const NavLink = /*#__PURE__*/React__namespace.forwardRef(function NavLinkWithRef(_ref5, ref) {
  398. let {
  399. "aria-current": ariaCurrentProp = "page",
  400. caseSensitive = false,
  401. className: classNameProp = "",
  402. end = false,
  403. style: styleProp,
  404. to,
  405. children
  406. } = _ref5,
  407. rest = _objectWithoutPropertiesLoose(_ref5, _excluded2);
  408. let path = reactRouter.useResolvedPath(to, {
  409. relative: rest.relative
  410. });
  411. let location = reactRouter.useLocation();
  412. let routerState = React__namespace.useContext(reactRouter.UNSAFE_DataRouterStateContext);
  413. let {
  414. navigator
  415. } = React__namespace.useContext(reactRouter.UNSAFE_NavigationContext);
  416. let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
  417. let locationPathname = location.pathname;
  418. let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
  419. if (!caseSensitive) {
  420. locationPathname = locationPathname.toLowerCase();
  421. nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
  422. toPathname = toPathname.toLowerCase();
  423. }
  424. let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(toPathname.length) === "/";
  425. let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
  426. let ariaCurrent = isActive ? ariaCurrentProp : undefined;
  427. let className;
  428. if (typeof classNameProp === "function") {
  429. className = classNameProp({
  430. isActive,
  431. isPending
  432. });
  433. } else {
  434. // If the className prop is not a function, we use a default `active`
  435. // class for <NavLink />s that are active. In v5 `active` was the default
  436. // value for `activeClassName`, but we are removing that API and can still
  437. // use the old default behavior for a cleaner upgrade path and keep the
  438. // simple styling rules working as they currently do.
  439. className = [classNameProp, isActive ? "active" : null, isPending ? "pending" : null].filter(Boolean).join(" ");
  440. }
  441. let style = typeof styleProp === "function" ? styleProp({
  442. isActive,
  443. isPending
  444. }) : styleProp;
  445. return /*#__PURE__*/React__namespace.createElement(Link, _extends({}, rest, {
  446. "aria-current": ariaCurrent,
  447. className: className,
  448. ref: ref,
  449. style: style,
  450. to: to
  451. }), typeof children === "function" ? children({
  452. isActive,
  453. isPending
  454. }) : children);
  455. });
  456. {
  457. NavLink.displayName = "NavLink";
  458. }
  459. /**
  460. * A `@remix-run/router`-aware `<form>`. It behaves like a normal form except
  461. * that the interaction with the server is with `fetch` instead of new document
  462. * requests, allowing components to add nicer UX to the page as the form is
  463. * submitted and returns with data.
  464. */
  465. const Form = /*#__PURE__*/React__namespace.forwardRef((props, ref) => {
  466. return /*#__PURE__*/React__namespace.createElement(FormImpl, _extends({}, props, {
  467. ref: ref
  468. }));
  469. });
  470. {
  471. Form.displayName = "Form";
  472. }
  473. const FormImpl = /*#__PURE__*/React__namespace.forwardRef((_ref6, forwardedRef) => {
  474. let {
  475. reloadDocument,
  476. replace,
  477. method = defaultMethod,
  478. action,
  479. onSubmit,
  480. fetcherKey,
  481. routeId,
  482. relative,
  483. preventScrollReset
  484. } = _ref6,
  485. props = _objectWithoutPropertiesLoose(_ref6, _excluded3);
  486. let submit = useSubmitImpl(fetcherKey, routeId);
  487. let formMethod = method.toLowerCase() === "get" ? "get" : "post";
  488. let formAction = useFormAction(action, {
  489. relative
  490. });
  491. let submitHandler = event => {
  492. onSubmit && onSubmit(event);
  493. if (event.defaultPrevented) return;
  494. event.preventDefault();
  495. let submitter = event.nativeEvent.submitter;
  496. let submitMethod = (submitter == null ? void 0 : submitter.getAttribute("formmethod")) || method;
  497. submit(submitter || event.currentTarget, {
  498. method: submitMethod,
  499. replace,
  500. relative,
  501. preventScrollReset
  502. });
  503. };
  504. return /*#__PURE__*/React__namespace.createElement("form", _extends({
  505. ref: forwardedRef,
  506. method: formMethod,
  507. action: formAction,
  508. onSubmit: reloadDocument ? onSubmit : submitHandler
  509. }, props));
  510. });
  511. {
  512. FormImpl.displayName = "FormImpl";
  513. }
  514. /**
  515. * This component will emulate the browser's scroll restoration on location
  516. * changes.
  517. */
  518. function ScrollRestoration(_ref7) {
  519. let {
  520. getKey,
  521. storageKey
  522. } = _ref7;
  523. useScrollRestoration({
  524. getKey,
  525. storageKey
  526. });
  527. return null;
  528. }
  529. {
  530. ScrollRestoration.displayName = "ScrollRestoration";
  531. } //#endregion
  532. ////////////////////////////////////////////////////////////////////////////////
  533. //#region Hooks
  534. ////////////////////////////////////////////////////////////////////////////////
  535. var DataRouterHook;
  536. (function (DataRouterHook) {
  537. DataRouterHook["UseScrollRestoration"] = "useScrollRestoration";
  538. DataRouterHook["UseSubmitImpl"] = "useSubmitImpl";
  539. DataRouterHook["UseFetcher"] = "useFetcher";
  540. })(DataRouterHook || (DataRouterHook = {}));
  541. var DataRouterStateHook;
  542. (function (DataRouterStateHook) {
  543. DataRouterStateHook["UseFetchers"] = "useFetchers";
  544. DataRouterStateHook["UseScrollRestoration"] = "useScrollRestoration";
  545. })(DataRouterStateHook || (DataRouterStateHook = {}));
  546. function getDataRouterConsoleError(hookName) {
  547. return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router.";
  548. }
  549. function useDataRouterContext(hookName) {
  550. let ctx = React__namespace.useContext(reactRouter.UNSAFE_DataRouterContext);
  551. !ctx ? router.invariant(false, getDataRouterConsoleError(hookName)) : void 0;
  552. return ctx;
  553. }
  554. function useDataRouterState(hookName) {
  555. let state = React__namespace.useContext(reactRouter.UNSAFE_DataRouterStateContext);
  556. !state ? router.invariant(false, getDataRouterConsoleError(hookName)) : void 0;
  557. return state;
  558. }
  559. /**
  560. * Handles the click behavior for router `<Link>` components. This is useful if
  561. * you need to create custom `<Link>` components with the same click behavior we
  562. * use in our exported `<Link>`.
  563. */
  564. function useLinkClickHandler(to, _temp) {
  565. let {
  566. target,
  567. replace: replaceProp,
  568. state,
  569. preventScrollReset,
  570. relative
  571. } = _temp === void 0 ? {} : _temp;
  572. let navigate = reactRouter.useNavigate();
  573. let location = reactRouter.useLocation();
  574. let path = reactRouter.useResolvedPath(to, {
  575. relative
  576. });
  577. return React__namespace.useCallback(event => {
  578. if (shouldProcessLinkClick(event, target)) {
  579. event.preventDefault(); // If the URL hasn't changed, a regular <a> will do a replace instead of
  580. // a push, so do the same here unless the replace prop is explicitly set
  581. let replace = replaceProp !== undefined ? replaceProp : reactRouter.createPath(location) === reactRouter.createPath(path);
  582. navigate(to, {
  583. replace,
  584. state,
  585. preventScrollReset,
  586. relative
  587. });
  588. }
  589. }, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative]);
  590. }
  591. /**
  592. * A convenient wrapper for reading and writing search parameters via the
  593. * URLSearchParams interface.
  594. */
  595. function useSearchParams(defaultInit) {
  596. warning(typeof URLSearchParams !== "undefined", "You cannot use the `useSearchParams` hook in a browser that does not " + "support the URLSearchParams API. If you need to support Internet " + "Explorer 11, we recommend you load a polyfill such as " + "https://github.com/ungap/url-search-params\n\n" + "If you're unsure how to load polyfills, we recommend you check out " + "https://polyfill.io/v3/ which provides some recommendations about how " + "to load polyfills only for users that need them, instead of for every " + "user.") ;
  597. let defaultSearchParamsRef = React__namespace.useRef(createSearchParams(defaultInit));
  598. let hasSetSearchParamsRef = React__namespace.useRef(false);
  599. let location = reactRouter.useLocation();
  600. let searchParams = React__namespace.useMemo(() => // Only merge in the defaults if we haven't yet called setSearchParams.
  601. // Once we call that we want those to take precedence, otherwise you can't
  602. // remove a param with setSearchParams({}) if it has an initial value
  603. getSearchParamsForLocation(location.search, hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current), [location.search]);
  604. let navigate = reactRouter.useNavigate();
  605. let setSearchParams = React__namespace.useCallback((nextInit, navigateOptions) => {
  606. const newSearchParams = createSearchParams(typeof nextInit === "function" ? nextInit(searchParams) : nextInit);
  607. hasSetSearchParamsRef.current = true;
  608. navigate("?" + newSearchParams, navigateOptions);
  609. }, [navigate, searchParams]);
  610. return [searchParams, setSearchParams];
  611. }
  612. /**
  613. * Returns a function that may be used to programmatically submit a form (or
  614. * some arbitrary data) to the server.
  615. */
  616. function useSubmit() {
  617. return useSubmitImpl();
  618. }
  619. function useSubmitImpl(fetcherKey, routeId) {
  620. let {
  621. router: router$1
  622. } = useDataRouterContext(DataRouterHook.UseSubmitImpl);
  623. let defaultAction = useFormAction();
  624. return React__namespace.useCallback(function (target, options) {
  625. if (options === void 0) {
  626. options = {};
  627. }
  628. if (typeof document === "undefined") {
  629. throw new Error("You are calling submit during the server render. " + "Try calling submit within a `useEffect` or callback instead.");
  630. }
  631. let {
  632. method,
  633. encType,
  634. formData,
  635. url
  636. } = getFormSubmissionInfo(target, defaultAction, options);
  637. let href = url.pathname + url.search;
  638. let opts = {
  639. replace: options.replace,
  640. preventScrollReset: options.preventScrollReset,
  641. formData,
  642. formMethod: method,
  643. formEncType: encType
  644. };
  645. if (fetcherKey) {
  646. !(routeId != null) ? router.invariant(false, "No routeId available for useFetcher()") : void 0;
  647. router$1.fetch(fetcherKey, routeId, href, opts);
  648. } else {
  649. router$1.navigate(href, opts);
  650. }
  651. }, [defaultAction, router$1, fetcherKey, routeId]);
  652. }
  653. function useFormAction(action, _temp2) {
  654. let {
  655. relative
  656. } = _temp2 === void 0 ? {} : _temp2;
  657. let {
  658. basename
  659. } = React__namespace.useContext(reactRouter.UNSAFE_NavigationContext);
  660. let routeContext = React__namespace.useContext(reactRouter.UNSAFE_RouteContext);
  661. !routeContext ? router.invariant(false, "useFormAction must be used inside a RouteContext") : void 0;
  662. let [match] = routeContext.matches.slice(-1); // Shallow clone path so we can modify it below, otherwise we modify the
  663. // object referenced by useMemo inside useResolvedPath
  664. let path = _extends({}, reactRouter.useResolvedPath(action ? action : ".", {
  665. relative
  666. })); // Previously we set the default action to ".". The problem with this is that
  667. // `useResolvedPath(".")` excludes search params and the hash of the resolved
  668. // URL. This is the intended behavior of when "." is specifically provided as
  669. // the form action, but inconsistent w/ browsers when the action is omitted.
  670. // https://github.com/remix-run/remix/issues/927
  671. let location = reactRouter.useLocation();
  672. if (action == null) {
  673. // Safe to write to these directly here since if action was undefined, we
  674. // would have called useResolvedPath(".") which will never include a search
  675. // or hash
  676. path.search = location.search;
  677. path.hash = location.hash; // When grabbing search params from the URL, remove the automatically
  678. // inserted ?index param so we match the useResolvedPath search behavior
  679. // which would not include ?index
  680. if (match.route.index) {
  681. let params = new URLSearchParams(path.search);
  682. params.delete("index");
  683. path.search = params.toString() ? "?" + params.toString() : "";
  684. }
  685. }
  686. if ((!action || action === ".") && match.route.index) {
  687. path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
  688. } // If we're operating within a basename, prepend it to the pathname prior
  689. // to creating the form action. If this is a root navigation, then just use
  690. // the raw basename which allows the basename to have full control over the
  691. // presence of a trailing slash on root actions
  692. if (basename !== "/") {
  693. path.pathname = path.pathname === "/" ? basename : router.joinPaths([basename, path.pathname]);
  694. }
  695. return reactRouter.createPath(path);
  696. }
  697. function createFetcherForm(fetcherKey, routeId) {
  698. let FetcherForm = /*#__PURE__*/React__namespace.forwardRef((props, ref) => {
  699. return /*#__PURE__*/React__namespace.createElement(FormImpl, _extends({}, props, {
  700. ref: ref,
  701. fetcherKey: fetcherKey,
  702. routeId: routeId
  703. }));
  704. });
  705. {
  706. FetcherForm.displayName = "fetcher.Form";
  707. }
  708. return FetcherForm;
  709. }
  710. let fetcherId = 0;
  711. /**
  712. * Interacts with route loaders and actions without causing a navigation. Great
  713. * for any interaction that stays on the same page.
  714. */
  715. function useFetcher() {
  716. var _route$matches;
  717. let {
  718. router: router$1
  719. } = useDataRouterContext(DataRouterHook.UseFetcher);
  720. let route = React__namespace.useContext(reactRouter.UNSAFE_RouteContext);
  721. !route ? router.invariant(false, "useFetcher must be used inside a RouteContext") : void 0;
  722. let routeId = (_route$matches = route.matches[route.matches.length - 1]) == null ? void 0 : _route$matches.route.id;
  723. !(routeId != null) ? router.invariant(false, "useFetcher can only be used on routes that contain a unique \"id\"") : void 0;
  724. let [fetcherKey] = React__namespace.useState(() => String(++fetcherId));
  725. let [Form] = React__namespace.useState(() => {
  726. !routeId ? router.invariant(false, "No routeId available for fetcher.Form()") : void 0;
  727. return createFetcherForm(fetcherKey, routeId);
  728. });
  729. let [load] = React__namespace.useState(() => href => {
  730. !router$1 ? router.invariant(false, "No router available for fetcher.load()") : void 0;
  731. !routeId ? router.invariant(false, "No routeId available for fetcher.load()") : void 0;
  732. router$1.fetch(fetcherKey, routeId, href);
  733. });
  734. let submit = useSubmitImpl(fetcherKey, routeId);
  735. let fetcher = router$1.getFetcher(fetcherKey);
  736. let fetcherWithComponents = React__namespace.useMemo(() => _extends({
  737. Form,
  738. submit,
  739. load
  740. }, fetcher), [fetcher, Form, submit, load]);
  741. React__namespace.useEffect(() => {
  742. // Is this busted when the React team gets real weird and calls effects
  743. // twice on mount? We really just need to garbage collect here when this
  744. // fetcher is no longer around.
  745. return () => {
  746. if (!router$1) {
  747. console.warn("No fetcher available to clean up from useFetcher()");
  748. return;
  749. }
  750. router$1.deleteFetcher(fetcherKey);
  751. };
  752. }, [router$1, fetcherKey]);
  753. return fetcherWithComponents;
  754. }
  755. /**
  756. * Provides all fetchers currently on the page. Useful for layouts and parent
  757. * routes that need to provide pending/optimistic UI regarding the fetch.
  758. */
  759. function useFetchers() {
  760. let state = useDataRouterState(DataRouterStateHook.UseFetchers);
  761. return [...state.fetchers.values()];
  762. }
  763. const SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions";
  764. let savedScrollPositions = {};
  765. /**
  766. * When rendered inside a RouterProvider, will restore scroll positions on navigations
  767. */
  768. function useScrollRestoration(_temp3) {
  769. let {
  770. getKey,
  771. storageKey
  772. } = _temp3 === void 0 ? {} : _temp3;
  773. let {
  774. router
  775. } = useDataRouterContext(DataRouterHook.UseScrollRestoration);
  776. let {
  777. restoreScrollPosition,
  778. preventScrollReset
  779. } = useDataRouterState(DataRouterStateHook.UseScrollRestoration);
  780. let location = reactRouter.useLocation();
  781. let matches = reactRouter.useMatches();
  782. let navigation = reactRouter.useNavigation(); // Trigger manual scroll restoration while we're active
  783. React__namespace.useEffect(() => {
  784. window.history.scrollRestoration = "manual";
  785. return () => {
  786. window.history.scrollRestoration = "auto";
  787. };
  788. }, []); // Save positions on pagehide
  789. usePageHide(React__namespace.useCallback(() => {
  790. if (navigation.state === "idle") {
  791. let key = (getKey ? getKey(location, matches) : null) || location.key;
  792. savedScrollPositions[key] = window.scrollY;
  793. }
  794. sessionStorage.setItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY, JSON.stringify(savedScrollPositions));
  795. window.history.scrollRestoration = "auto";
  796. }, [storageKey, getKey, navigation.state, location, matches])); // Read in any saved scroll locations
  797. if (typeof document !== "undefined") {
  798. // eslint-disable-next-line react-hooks/rules-of-hooks
  799. React__namespace.useLayoutEffect(() => {
  800. try {
  801. let sessionPositions = sessionStorage.getItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY);
  802. if (sessionPositions) {
  803. savedScrollPositions = JSON.parse(sessionPositions);
  804. }
  805. } catch (e) {// no-op, use default empty object
  806. }
  807. }, [storageKey]); // Enable scroll restoration in the router
  808. // eslint-disable-next-line react-hooks/rules-of-hooks
  809. React__namespace.useLayoutEffect(() => {
  810. let disableScrollRestoration = router == null ? void 0 : router.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKey);
  811. return () => disableScrollRestoration && disableScrollRestoration();
  812. }, [router, getKey]); // Restore scrolling when state.restoreScrollPosition changes
  813. // eslint-disable-next-line react-hooks/rules-of-hooks
  814. React__namespace.useLayoutEffect(() => {
  815. // Explicit false means don't do anything (used for submissions)
  816. if (restoreScrollPosition === false) {
  817. return;
  818. } // been here before, scroll to it
  819. if (typeof restoreScrollPosition === "number") {
  820. window.scrollTo(0, restoreScrollPosition);
  821. return;
  822. } // try to scroll to the hash
  823. if (location.hash) {
  824. let el = document.getElementById(location.hash.slice(1));
  825. if (el) {
  826. el.scrollIntoView();
  827. return;
  828. }
  829. } // Don't reset if this navigation opted out
  830. if (preventScrollReset === true) {
  831. return;
  832. } // otherwise go to the top on new locations
  833. window.scrollTo(0, 0);
  834. }, [location, restoreScrollPosition, preventScrollReset]);
  835. }
  836. }
  837. /**
  838. * Setup a callback to be fired on the window's `beforeunload` event. This is
  839. * useful for saving some data to `window.localStorage` just before the page
  840. * refreshes.
  841. *
  842. * Note: The `callback` argument should be a function created with
  843. * `React.useCallback()`.
  844. */
  845. function useBeforeUnload(callback, options) {
  846. let {
  847. capture
  848. } = options || {};
  849. React__namespace.useEffect(() => {
  850. let opts = capture != null ? {
  851. capture
  852. } : undefined;
  853. window.addEventListener("beforeunload", callback, opts);
  854. return () => {
  855. window.removeEventListener("beforeunload", callback, opts);
  856. };
  857. }, [callback, capture]);
  858. }
  859. /**
  860. * Setup a callback to be fired on the window's `pagehide` event. This is
  861. * useful for saving some data to `window.localStorage` just before the page
  862. * refreshes. This event is better supported than beforeunload across browsers.
  863. *
  864. * Note: The `callback` argument should be a function created with
  865. * `React.useCallback()`.
  866. */
  867. function usePageHide(callback, options) {
  868. let {
  869. capture
  870. } = options || {};
  871. React__namespace.useEffect(() => {
  872. let opts = capture != null ? {
  873. capture
  874. } : undefined;
  875. window.addEventListener("pagehide", callback, opts);
  876. return () => {
  877. window.removeEventListener("pagehide", callback, opts);
  878. };
  879. }, [callback, capture]);
  880. }
  881. /**
  882. * Wrapper around useBlocker to show a window.confirm prompt to users instead
  883. * of building a custom UI with useBlocker.
  884. *
  885. * Warning: This has *a lot of rough edges* and behaves very differently (and
  886. * very incorrectly in some cases) across browsers if user click addition
  887. * back/forward navigations while the confirm is open. Use at your own risk.
  888. */
  889. function usePrompt(_ref8) {
  890. let {
  891. when,
  892. message
  893. } = _ref8;
  894. let blocker = reactRouter.unstable_useBlocker(when);
  895. React__namespace.useEffect(() => {
  896. if (blocker.state === "blocked" && !when) {
  897. blocker.reset();
  898. }
  899. }, [blocker, when]);
  900. React__namespace.useEffect(() => {
  901. if (blocker.state === "blocked") {
  902. let proceed = window.confirm(message);
  903. if (proceed) {
  904. setTimeout(blocker.proceed, 0);
  905. } else {
  906. blocker.reset();
  907. }
  908. }
  909. }, [blocker, message]);
  910. }
  911. ////////////////////////////////////////////////////////////////////////////////
  912. //#region Utils
  913. ////////////////////////////////////////////////////////////////////////////////
  914. function warning(cond, message) {
  915. if (!cond) {
  916. // eslint-disable-next-line no-console
  917. if (typeof console !== "undefined") console.warn(message);
  918. try {
  919. // Welcome to debugging React Router!
  920. //
  921. // This error is thrown as a convenience so you can more easily
  922. // find the source for a warning that appears in the console by
  923. // enabling "pause on exceptions" in your JavaScript debugger.
  924. throw new Error(message); // eslint-disable-next-line no-empty
  925. } catch (e) {}
  926. }
  927. } //#endregion
  928. Object.defineProperty(exports, 'AbortedDeferredError', {
  929. enumerable: true,
  930. get: function () { return reactRouter.AbortedDeferredError; }
  931. });
  932. Object.defineProperty(exports, 'Await', {
  933. enumerable: true,
  934. get: function () { return reactRouter.Await; }
  935. });
  936. Object.defineProperty(exports, 'MemoryRouter', {
  937. enumerable: true,
  938. get: function () { return reactRouter.MemoryRouter; }
  939. });
  940. Object.defineProperty(exports, 'Navigate', {
  941. enumerable: true,
  942. get: function () { return reactRouter.Navigate; }
  943. });
  944. Object.defineProperty(exports, 'NavigationType', {
  945. enumerable: true,
  946. get: function () { return reactRouter.NavigationType; }
  947. });
  948. Object.defineProperty(exports, 'Outlet', {
  949. enumerable: true,
  950. get: function () { return reactRouter.Outlet; }
  951. });
  952. Object.defineProperty(exports, 'Route', {
  953. enumerable: true,
  954. get: function () { return reactRouter.Route; }
  955. });
  956. Object.defineProperty(exports, 'Router', {
  957. enumerable: true,
  958. get: function () { return reactRouter.Router; }
  959. });
  960. Object.defineProperty(exports, 'RouterProvider', {
  961. enumerable: true,
  962. get: function () { return reactRouter.RouterProvider; }
  963. });
  964. Object.defineProperty(exports, 'Routes', {
  965. enumerable: true,
  966. get: function () { return reactRouter.Routes; }
  967. });
  968. Object.defineProperty(exports, 'UNSAFE_DataRouterContext', {
  969. enumerable: true,
  970. get: function () { return reactRouter.UNSAFE_DataRouterContext; }
  971. });
  972. Object.defineProperty(exports, 'UNSAFE_DataRouterStateContext', {
  973. enumerable: true,
  974. get: function () { return reactRouter.UNSAFE_DataRouterStateContext; }
  975. });
  976. Object.defineProperty(exports, 'UNSAFE_LocationContext', {
  977. enumerable: true,
  978. get: function () { return reactRouter.UNSAFE_LocationContext; }
  979. });
  980. Object.defineProperty(exports, 'UNSAFE_NavigationContext', {
  981. enumerable: true,
  982. get: function () { return reactRouter.UNSAFE_NavigationContext; }
  983. });
  984. Object.defineProperty(exports, 'UNSAFE_RouteContext', {
  985. enumerable: true,
  986. get: function () { return reactRouter.UNSAFE_RouteContext; }
  987. });
  988. Object.defineProperty(exports, 'UNSAFE_enhanceManualRouteObjects', {
  989. enumerable: true,
  990. get: function () { return reactRouter.UNSAFE_enhanceManualRouteObjects; }
  991. });
  992. Object.defineProperty(exports, 'createMemoryRouter', {
  993. enumerable: true,
  994. get: function () { return reactRouter.createMemoryRouter; }
  995. });
  996. Object.defineProperty(exports, 'createPath', {
  997. enumerable: true,
  998. get: function () { return reactRouter.createPath; }
  999. });
  1000. Object.defineProperty(exports, 'createRoutesFromChildren', {
  1001. enumerable: true,
  1002. get: function () { return reactRouter.createRoutesFromChildren; }
  1003. });
  1004. Object.defineProperty(exports, 'createRoutesFromElements', {
  1005. enumerable: true,
  1006. get: function () { return reactRouter.createRoutesFromElements; }
  1007. });
  1008. Object.defineProperty(exports, 'defer', {
  1009. enumerable: true,
  1010. get: function () { return reactRouter.defer; }
  1011. });
  1012. Object.defineProperty(exports, 'generatePath', {
  1013. enumerable: true,
  1014. get: function () { return reactRouter.generatePath; }
  1015. });
  1016. Object.defineProperty(exports, 'isRouteErrorResponse', {
  1017. enumerable: true,
  1018. get: function () { return reactRouter.isRouteErrorResponse; }
  1019. });
  1020. Object.defineProperty(exports, 'json', {
  1021. enumerable: true,
  1022. get: function () { return reactRouter.json; }
  1023. });
  1024. Object.defineProperty(exports, 'matchPath', {
  1025. enumerable: true,
  1026. get: function () { return reactRouter.matchPath; }
  1027. });
  1028. Object.defineProperty(exports, 'matchRoutes', {
  1029. enumerable: true,
  1030. get: function () { return reactRouter.matchRoutes; }
  1031. });
  1032. Object.defineProperty(exports, 'parsePath', {
  1033. enumerable: true,
  1034. get: function () { return reactRouter.parsePath; }
  1035. });
  1036. Object.defineProperty(exports, 'redirect', {
  1037. enumerable: true,
  1038. get: function () { return reactRouter.redirect; }
  1039. });
  1040. Object.defineProperty(exports, 'renderMatches', {
  1041. enumerable: true,
  1042. get: function () { return reactRouter.renderMatches; }
  1043. });
  1044. Object.defineProperty(exports, 'resolvePath', {
  1045. enumerable: true,
  1046. get: function () { return reactRouter.resolvePath; }
  1047. });
  1048. Object.defineProperty(exports, 'unstable_useBlocker', {
  1049. enumerable: true,
  1050. get: function () { return reactRouter.unstable_useBlocker; }
  1051. });
  1052. Object.defineProperty(exports, 'useActionData', {
  1053. enumerable: true,
  1054. get: function () { return reactRouter.useActionData; }
  1055. });
  1056. Object.defineProperty(exports, 'useAsyncError', {
  1057. enumerable: true,
  1058. get: function () { return reactRouter.useAsyncError; }
  1059. });
  1060. Object.defineProperty(exports, 'useAsyncValue', {
  1061. enumerable: true,
  1062. get: function () { return reactRouter.useAsyncValue; }
  1063. });
  1064. Object.defineProperty(exports, 'useHref', {
  1065. enumerable: true,
  1066. get: function () { return reactRouter.useHref; }
  1067. });
  1068. Object.defineProperty(exports, 'useInRouterContext', {
  1069. enumerable: true,
  1070. get: function () { return reactRouter.useInRouterContext; }
  1071. });
  1072. Object.defineProperty(exports, 'useLoaderData', {
  1073. enumerable: true,
  1074. get: function () { return reactRouter.useLoaderData; }
  1075. });
  1076. Object.defineProperty(exports, 'useLocation', {
  1077. enumerable: true,
  1078. get: function () { return reactRouter.useLocation; }
  1079. });
  1080. Object.defineProperty(exports, 'useMatch', {
  1081. enumerable: true,
  1082. get: function () { return reactRouter.useMatch; }
  1083. });
  1084. Object.defineProperty(exports, 'useMatches', {
  1085. enumerable: true,
  1086. get: function () { return reactRouter.useMatches; }
  1087. });
  1088. Object.defineProperty(exports, 'useNavigate', {
  1089. enumerable: true,
  1090. get: function () { return reactRouter.useNavigate; }
  1091. });
  1092. Object.defineProperty(exports, 'useNavigation', {
  1093. enumerable: true,
  1094. get: function () { return reactRouter.useNavigation; }
  1095. });
  1096. Object.defineProperty(exports, 'useNavigationType', {
  1097. enumerable: true,
  1098. get: function () { return reactRouter.useNavigationType; }
  1099. });
  1100. Object.defineProperty(exports, 'useOutlet', {
  1101. enumerable: true,
  1102. get: function () { return reactRouter.useOutlet; }
  1103. });
  1104. Object.defineProperty(exports, 'useOutletContext', {
  1105. enumerable: true,
  1106. get: function () { return reactRouter.useOutletContext; }
  1107. });
  1108. Object.defineProperty(exports, 'useParams', {
  1109. enumerable: true,
  1110. get: function () { return reactRouter.useParams; }
  1111. });
  1112. Object.defineProperty(exports, 'useResolvedPath', {
  1113. enumerable: true,
  1114. get: function () { return reactRouter.useResolvedPath; }
  1115. });
  1116. Object.defineProperty(exports, 'useRevalidator', {
  1117. enumerable: true,
  1118. get: function () { return reactRouter.useRevalidator; }
  1119. });
  1120. Object.defineProperty(exports, 'useRouteError', {
  1121. enumerable: true,
  1122. get: function () { return reactRouter.useRouteError; }
  1123. });
  1124. Object.defineProperty(exports, 'useRouteLoaderData', {
  1125. enumerable: true,
  1126. get: function () { return reactRouter.useRouteLoaderData; }
  1127. });
  1128. Object.defineProperty(exports, 'useRoutes', {
  1129. enumerable: true,
  1130. get: function () { return reactRouter.useRoutes; }
  1131. });
  1132. exports.BrowserRouter = BrowserRouter;
  1133. exports.Form = Form;
  1134. exports.HashRouter = HashRouter;
  1135. exports.Link = Link;
  1136. exports.NavLink = NavLink;
  1137. exports.ScrollRestoration = ScrollRestoration;
  1138. exports.UNSAFE_useScrollRestoration = useScrollRestoration;
  1139. exports.createBrowserRouter = createBrowserRouter;
  1140. exports.createHashRouter = createHashRouter;
  1141. exports.createSearchParams = createSearchParams;
  1142. exports.unstable_HistoryRouter = HistoryRouter;
  1143. exports.unstable_usePrompt = usePrompt;
  1144. exports.useBeforeUnload = useBeforeUnload;
  1145. exports.useFetcher = useFetcher;
  1146. exports.useFetchers = useFetchers;
  1147. exports.useFormAction = useFormAction;
  1148. exports.useLinkClickHandler = useLinkClickHandler;
  1149. exports.useSearchParams = useSearchParams;
  1150. exports.useSubmit = useSubmit;
  1151. Object.defineProperty(exports, '__esModule', { value: true });
  1152. }));
  1153. //# sourceMappingURL=react-router-dom.development.js.map