react-router 0.0.0-experimental-e56aa53bc → 0.0.0-experimental-e6fb6e074

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +18 -734
  2. package/README.md +14 -5
  3. package/dist/index.d.ts +30 -0
  4. package/dist/index.js +1501 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/components.d.ts +157 -0
  7. package/dist/lib/context.d.ts +102 -0
  8. package/dist/lib/deprecations.d.ts +4 -0
  9. package/dist/lib/hooks.d.ts +181 -0
  10. package/dist/main.js +19 -0
  11. package/dist/react-router.development.js +1397 -0
  12. package/dist/react-router.development.js.map +1 -0
  13. package/dist/react-router.production.min.js +12 -0
  14. package/dist/react-router.production.min.js.map +1 -0
  15. package/dist/umd/react-router.development.js +1624 -0
  16. package/dist/umd/react-router.development.js.map +1 -0
  17. package/dist/umd/react-router.production.min.js +12 -0
  18. package/dist/umd/react-router.production.min.js.map +1 -0
  19. package/package.json +9 -111
  20. package/dist/development/chunk-RMWJZNG5.mjs +0 -11505
  21. package/dist/development/data-CQbyyGzl.d.mts +0 -11
  22. package/dist/development/data-CQbyyGzl.d.ts +0 -11
  23. package/dist/development/dom-export.d.mts +0 -23
  24. package/dist/development/dom-export.d.ts +0 -23
  25. package/dist/development/dom-export.js +0 -6341
  26. package/dist/development/dom-export.mjs +0 -222
  27. package/dist/development/fog-of-war-C5L_Yd5M.d.mts +0 -1778
  28. package/dist/development/fog-of-war-DrUCUQQ-.d.ts +0 -1778
  29. package/dist/development/index.d.mts +0 -855
  30. package/dist/development/index.d.ts +0 -855
  31. package/dist/development/index.js +0 -11664
  32. package/dist/development/index.mjs +0 -263
  33. package/dist/development/lib/types/route-module.d.mts +0 -209
  34. package/dist/development/lib/types/route-module.d.ts +0 -209
  35. package/dist/development/lib/types/route-module.js +0 -28
  36. package/dist/development/lib/types/route-module.mjs +0 -10
  37. package/dist/development/route-data-BIYebJr3.d.mts +0 -1749
  38. package/dist/development/route-data-BIYebJr3.d.ts +0 -1749
  39. package/dist/development/rsc-export.d.mts +0 -1788
  40. package/dist/development/rsc-export.d.ts +0 -1788
  41. package/dist/development/rsc-export.js +0 -2778
  42. package/dist/development/rsc-export.mjs +0 -2743
  43. package/dist/production/chunk-BXBFRMFA.mjs +0 -11505
  44. package/dist/production/data-CQbyyGzl.d.mts +0 -11
  45. package/dist/production/data-CQbyyGzl.d.ts +0 -11
  46. package/dist/production/dom-export.d.mts +0 -23
  47. package/dist/production/dom-export.d.ts +0 -23
  48. package/dist/production/dom-export.js +0 -6341
  49. package/dist/production/dom-export.mjs +0 -222
  50. package/dist/production/fog-of-war-C5L_Yd5M.d.mts +0 -1778
  51. package/dist/production/fog-of-war-DrUCUQQ-.d.ts +0 -1778
  52. package/dist/production/index.d.mts +0 -855
  53. package/dist/production/index.d.ts +0 -855
  54. package/dist/production/index.js +0 -11664
  55. package/dist/production/index.mjs +0 -263
  56. package/dist/production/lib/types/route-module.d.mts +0 -209
  57. package/dist/production/lib/types/route-module.d.ts +0 -209
  58. package/dist/production/lib/types/route-module.js +0 -28
  59. package/dist/production/lib/types/route-module.mjs +0 -10
  60. package/dist/production/route-data-BIYebJr3.d.mts +0 -1749
  61. package/dist/production/route-data-BIYebJr3.d.ts +0 -1749
  62. package/dist/production/rsc-export.d.mts +0 -1788
  63. package/dist/production/rsc-export.d.ts +0 -1788
  64. package/dist/production/rsc-export.js +0 -2778
  65. package/dist/production/rsc-export.mjs +0 -2743
package/dist/index.js ADDED
@@ -0,0 +1,1501 @@
1
+ /**
2
+ * React Router v0.0.0-experimental-e6fb6e074
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
+ import * as React from 'react';
12
+ import { UNSAFE_invariant, joinPaths, matchPath, UNSAFE_decodePath, UNSAFE_getResolveToMatches, UNSAFE_warning, resolveTo, parsePath, matchRoutes, Action, UNSAFE_convertRouteMatchToUiMatch, stripBasename, IDLE_BLOCKER, isRouteErrorResponse, createMemoryHistory, AbortedDeferredError, createRouter } from '@remix-run/router';
13
+ export { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, replace, resolvePath } from '@remix-run/router';
14
+
15
+ function _extends() {
16
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
17
+ for (var i = 1; i < arguments.length; i++) {
18
+ var source = arguments[i];
19
+ for (var key in source) {
20
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
21
+ target[key] = source[key];
22
+ }
23
+ }
24
+ }
25
+ return target;
26
+ };
27
+ return _extends.apply(this, arguments);
28
+ }
29
+
30
+ // Create react-specific types from the agnostic types in @remix-run/router to
31
+ // export from react-router
32
+ const DataRouterContext = /*#__PURE__*/React.createContext(null);
33
+ if (process.env.NODE_ENV !== "production") {
34
+ DataRouterContext.displayName = "DataRouter";
35
+ }
36
+ const DataRouterStateContext = /*#__PURE__*/React.createContext(null);
37
+ if (process.env.NODE_ENV !== "production") {
38
+ DataRouterStateContext.displayName = "DataRouterState";
39
+ }
40
+ const AwaitContext = /*#__PURE__*/React.createContext(null);
41
+ if (process.env.NODE_ENV !== "production") {
42
+ AwaitContext.displayName = "Await";
43
+ }
44
+
45
+ /**
46
+ * A Navigator is a "location changer"; it's how you get to different locations.
47
+ *
48
+ * Every history instance conforms to the Navigator interface, but the
49
+ * distinction is useful primarily when it comes to the low-level `<Router>` API
50
+ * where both the location and a navigator must be provided separately in order
51
+ * to avoid "tearing" that may occur in a suspense-enabled app if the action
52
+ * and/or location were to be read directly from the history instance.
53
+ */
54
+
55
+ const NavigationContext = /*#__PURE__*/React.createContext(null);
56
+ if (process.env.NODE_ENV !== "production") {
57
+ NavigationContext.displayName = "Navigation";
58
+ }
59
+ const LocationContext = /*#__PURE__*/React.createContext(null);
60
+ if (process.env.NODE_ENV !== "production") {
61
+ LocationContext.displayName = "Location";
62
+ }
63
+ const RouteContext = /*#__PURE__*/React.createContext({
64
+ outlet: null,
65
+ matches: [],
66
+ isDataRoute: false
67
+ });
68
+ if (process.env.NODE_ENV !== "production") {
69
+ RouteContext.displayName = "Route";
70
+ }
71
+ const RouteErrorContext = /*#__PURE__*/React.createContext(null);
72
+ if (process.env.NODE_ENV !== "production") {
73
+ RouteErrorContext.displayName = "RouteError";
74
+ }
75
+
76
+ /**
77
+ * Returns the full href for the given "to" value. This is useful for building
78
+ * custom links that are also accessible and preserve right-click behavior.
79
+ *
80
+ * @see https://reactrouter.com/v6/hooks/use-href
81
+ */
82
+ function useHref(to, _temp) {
83
+ let {
84
+ relative
85
+ } = _temp === void 0 ? {} : _temp;
86
+ !useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
87
+ // router loaded. We can help them understand how to avoid that.
88
+ "useHref() may be used only in the context of a <Router> component.") : UNSAFE_invariant(false) : void 0;
89
+ let {
90
+ basename,
91
+ navigator
92
+ } = React.useContext(NavigationContext);
93
+ let {
94
+ hash,
95
+ pathname,
96
+ search
97
+ } = useResolvedPath(to, {
98
+ relative
99
+ });
100
+ let joinedPathname = pathname;
101
+
102
+ // If we're operating within a basename, prepend it to the pathname prior
103
+ // to creating the href. If this is a root navigation, then just use the raw
104
+ // basename which allows the basename to have full control over the presence
105
+ // of a trailing slash on root links
106
+ if (basename !== "/") {
107
+ joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
108
+ }
109
+ return navigator.createHref({
110
+ pathname: joinedPathname,
111
+ search,
112
+ hash
113
+ });
114
+ }
115
+
116
+ /**
117
+ * Returns true if this component is a descendant of a `<Router>`.
118
+ *
119
+ * @see https://reactrouter.com/v6/hooks/use-in-router-context
120
+ */
121
+ function useInRouterContext() {
122
+ return React.useContext(LocationContext) != null;
123
+ }
124
+
125
+ /**
126
+ * Returns the current location object, which represents the current URL in web
127
+ * browsers.
128
+ *
129
+ * Note: If you're using this it may mean you're doing some of your own
130
+ * "routing" in your app, and we'd like to know what your use case is. We may
131
+ * be able to provide something higher-level to better suit your needs.
132
+ *
133
+ * @see https://reactrouter.com/v6/hooks/use-location
134
+ */
135
+ function useLocation() {
136
+ !useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
137
+ // router loaded. We can help them understand how to avoid that.
138
+ "useLocation() may be used only in the context of a <Router> component.") : UNSAFE_invariant(false) : void 0;
139
+ return React.useContext(LocationContext).location;
140
+ }
141
+
142
+ /**
143
+ * Returns the current navigation action which describes how the router came to
144
+ * the current location, either by a pop, push, or replace on the history stack.
145
+ *
146
+ * @see https://reactrouter.com/v6/hooks/use-navigation-type
147
+ */
148
+ function useNavigationType() {
149
+ return React.useContext(LocationContext).navigationType;
150
+ }
151
+
152
+ /**
153
+ * Returns a PathMatch object if the given pattern matches the current URL.
154
+ * This is useful for components that need to know "active" state, e.g.
155
+ * `<NavLink>`.
156
+ *
157
+ * @see https://reactrouter.com/v6/hooks/use-match
158
+ */
159
+ function useMatch(pattern) {
160
+ !useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
161
+ // router loaded. We can help them understand how to avoid that.
162
+ "useMatch() may be used only in the context of a <Router> component.") : UNSAFE_invariant(false) : void 0;
163
+ let {
164
+ pathname
165
+ } = useLocation();
166
+ return React.useMemo(() => matchPath(pattern, UNSAFE_decodePath(pathname)), [pathname, pattern]);
167
+ }
168
+
169
+ /**
170
+ * The interface for the navigate() function returned from useNavigate().
171
+ */
172
+
173
+ const navigateEffectWarning = "You should call navigate() in a React.useEffect(), not when " + "your component is first rendered.";
174
+
175
+ // Mute warnings for calls to useNavigate in SSR environments
176
+ function useIsomorphicLayoutEffect(cb) {
177
+ let isStatic = React.useContext(NavigationContext).static;
178
+ if (!isStatic) {
179
+ // We should be able to get rid of this once react 18.3 is released
180
+ // See: https://github.com/facebook/react/pull/26395
181
+ // eslint-disable-next-line react-hooks/rules-of-hooks
182
+ React.useLayoutEffect(cb);
183
+ }
184
+ }
185
+
186
+ /**
187
+ * Returns an imperative method for changing the location. Used by `<Link>`s, but
188
+ * may also be used by other elements to change the location.
189
+ *
190
+ * @see https://reactrouter.com/v6/hooks/use-navigate
191
+ */
192
+ function useNavigate() {
193
+ let {
194
+ isDataRoute
195
+ } = React.useContext(RouteContext);
196
+ // Conditional usage is OK here because the usage of a data router is static
197
+ // eslint-disable-next-line react-hooks/rules-of-hooks
198
+ return isDataRoute ? useNavigateStable() : useNavigateUnstable();
199
+ }
200
+ function useNavigateUnstable() {
201
+ !useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
202
+ // router loaded. We can help them understand how to avoid that.
203
+ "useNavigate() may be used only in the context of a <Router> component.") : UNSAFE_invariant(false) : void 0;
204
+ let dataRouterContext = React.useContext(DataRouterContext);
205
+ let {
206
+ basename,
207
+ future,
208
+ navigator
209
+ } = React.useContext(NavigationContext);
210
+ let {
211
+ matches
212
+ } = React.useContext(RouteContext);
213
+ let {
214
+ pathname: locationPathname
215
+ } = useLocation();
216
+ let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));
217
+ let activeRef = React.useRef(false);
218
+ useIsomorphicLayoutEffect(() => {
219
+ activeRef.current = true;
220
+ });
221
+ let navigate = React.useCallback(function (to, options) {
222
+ if (options === void 0) {
223
+ options = {};
224
+ }
225
+ process.env.NODE_ENV !== "production" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;
226
+
227
+ // Short circuit here since if this happens on first render the navigate
228
+ // is useless because we haven't wired up our history listener yet
229
+ if (!activeRef.current) return;
230
+ if (typeof to === "number") {
231
+ navigator.go(to);
232
+ return;
233
+ }
234
+ let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path");
235
+
236
+ // If we're operating within a basename, prepend it to the pathname prior
237
+ // to handing off to history (but only if we're not in a data router,
238
+ // otherwise it'll prepend the basename inside of the router).
239
+ // If this is a root navigation, then we navigate to the raw basename
240
+ // which allows the basename to have full control over the presence of a
241
+ // trailing slash on root links
242
+ if (dataRouterContext == null && basename !== "/") {
243
+ path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
244
+ }
245
+ (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);
246
+ }, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]);
247
+ return navigate;
248
+ }
249
+ const OutletContext = /*#__PURE__*/React.createContext(null);
250
+
251
+ /**
252
+ * Returns the context (if provided) for the child route at this level of the route
253
+ * hierarchy.
254
+ * @see https://reactrouter.com/v6/hooks/use-outlet-context
255
+ */
256
+ function useOutletContext() {
257
+ return React.useContext(OutletContext);
258
+ }
259
+
260
+ /**
261
+ * Returns the element for the child route at this level of the route
262
+ * hierarchy. Used internally by `<Outlet>` to render child routes.
263
+ *
264
+ * @see https://reactrouter.com/v6/hooks/use-outlet
265
+ */
266
+ function useOutlet(context) {
267
+ let outlet = React.useContext(RouteContext).outlet;
268
+ if (outlet) {
269
+ return /*#__PURE__*/React.createElement(OutletContext.Provider, {
270
+ value: context
271
+ }, outlet);
272
+ }
273
+ return outlet;
274
+ }
275
+
276
+ /**
277
+ * Returns an object of key/value pairs of the dynamic params from the current
278
+ * URL that were matched by the route path.
279
+ *
280
+ * @see https://reactrouter.com/v6/hooks/use-params
281
+ */
282
+ function useParams() {
283
+ let {
284
+ matches
285
+ } = React.useContext(RouteContext);
286
+ let routeMatch = matches[matches.length - 1];
287
+ return routeMatch ? routeMatch.params : {};
288
+ }
289
+
290
+ /**
291
+ * Resolves the pathname of the given `to` value against the current location.
292
+ *
293
+ * @see https://reactrouter.com/v6/hooks/use-resolved-path
294
+ */
295
+ function useResolvedPath(to, _temp2) {
296
+ let {
297
+ relative
298
+ } = _temp2 === void 0 ? {} : _temp2;
299
+ let {
300
+ future
301
+ } = React.useContext(NavigationContext);
302
+ let {
303
+ matches
304
+ } = React.useContext(RouteContext);
305
+ let {
306
+ pathname: locationPathname
307
+ } = useLocation();
308
+ let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));
309
+ return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]);
310
+ }
311
+
312
+ /**
313
+ * Returns the element of the route that matched the current location, prepared
314
+ * with the correct context to render the remainder of the route tree. Route
315
+ * elements in the tree must render an `<Outlet>` to render their child route's
316
+ * element.
317
+ *
318
+ * @see https://reactrouter.com/v6/hooks/use-routes
319
+ */
320
+ function useRoutes(routes, locationArg) {
321
+ return useRoutesImpl(routes, locationArg);
322
+ }
323
+
324
+ // Internal implementation with accept optional param for RouterProvider usage
325
+ function useRoutesImpl(routes, locationArg, dataRouterState, future) {
326
+ !useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
327
+ // router loaded. We can help them understand how to avoid that.
328
+ "useRoutes() may be used only in the context of a <Router> component.") : UNSAFE_invariant(false) : void 0;
329
+ let {
330
+ navigator,
331
+ static: isStatic
332
+ } = React.useContext(NavigationContext);
333
+ let {
334
+ matches: parentMatches
335
+ } = React.useContext(RouteContext);
336
+ let routeMatch = parentMatches[parentMatches.length - 1];
337
+ let parentParams = routeMatch ? routeMatch.params : {};
338
+ let parentPathname = routeMatch ? routeMatch.pathname : "/";
339
+ let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
340
+ let parentRoute = routeMatch && routeMatch.route;
341
+ if (process.env.NODE_ENV !== "production") {
342
+ // You won't get a warning about 2 different <Routes> under a <Route>
343
+ // without a trailing *, but this is a best-effort warning anyway since we
344
+ // cannot even give the warning unless they land at the parent route.
345
+ //
346
+ // Example:
347
+ //
348
+ // <Routes>
349
+ // {/* This route path MUST end with /* because otherwise
350
+ // it will never match /blog/post/123 */}
351
+ // <Route path="blog" element={<Blog />} />
352
+ // <Route path="blog/feed" element={<BlogFeed />} />
353
+ // </Routes>
354
+ //
355
+ // function Blog() {
356
+ // return (
357
+ // <Routes>
358
+ // <Route path="post/:id" element={<Post />} />
359
+ // </Routes>
360
+ // );
361
+ // }
362
+ let parentPath = parentRoute && parentRoute.path || "";
363
+ warningOnce(parentPathname, !parentRoute || parentPath.endsWith("*"), "You rendered descendant <Routes> (or called `useRoutes()`) at " + ("\"" + parentPathname + "\" (under <Route path=\"" + parentPath + "\">) but the ") + "parent route path has no trailing \"*\". This means if you navigate " + "deeper, the parent won't match anymore and therefore the child " + "routes will never render.\n\n" + ("Please change the parent <Route path=\"" + parentPath + "\"> to <Route ") + ("path=\"" + (parentPath === "/" ? "*" : parentPath + "/*") + "\">."));
364
+ }
365
+ let locationFromContext = useLocation();
366
+ let location;
367
+ if (locationArg) {
368
+ var _parsedLocationArg$pa;
369
+ let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
370
+ !(parentPathnameBase === "/" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "When overriding the location using `<Routes location>` or `useRoutes(routes, location)`, " + "the location pathname must begin with the portion of the URL pathname that was " + ("matched by all parent routes. The current pathname base is \"" + parentPathnameBase + "\" ") + ("but pathname \"" + parsedLocationArg.pathname + "\" was given in the `location` prop.")) : UNSAFE_invariant(false) : void 0;
371
+ location = parsedLocationArg;
372
+ } else {
373
+ location = locationFromContext;
374
+ }
375
+ let pathname = location.pathname || "/";
376
+ let remainingPathname = pathname;
377
+ if (parentPathnameBase !== "/") {
378
+ // Determine the remaining pathname by removing the # of URL segments the
379
+ // parentPathnameBase has, instead of removing based on character count.
380
+ // This is because we can't guarantee that incoming/outgoing encodings/
381
+ // decodings will match exactly.
382
+ // We decode paths before matching on a per-segment basis with
383
+ // decodeURIComponent(), but we re-encode pathnames via `new URL()` so they
384
+ // match what `window.location.pathname` would reflect. Those don't 100%
385
+ // align when it comes to encoded URI characters such as % and &.
386
+ //
387
+ // So we may end up with:
388
+ // pathname: "/descendant/a%25b/match"
389
+ // parentPathnameBase: "/descendant/a%b"
390
+ //
391
+ // And the direct substring removal approach won't work :/
392
+ let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
393
+ let segments = pathname.replace(/^\//, "").split("/");
394
+ remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
395
+ }
396
+ let matches = !isStatic && dataRouterState && dataRouterState.matches && dataRouterState.matches.length > 0 ? dataRouterState.matches : matchRoutes(routes, {
397
+ pathname: remainingPathname
398
+ });
399
+ if (process.env.NODE_ENV !== "production") {
400
+ process.env.NODE_ENV !== "production" ? UNSAFE_warning(parentRoute || matches != null, "No routes matched location \"" + location.pathname + location.search + location.hash + "\" ") : void 0;
401
+ process.env.NODE_ENV !== "production" ? UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined || matches[matches.length - 1].route.lazy !== undefined, "Matched leaf route at location \"" + location.pathname + location.search + location.hash + "\" " + "does not have an element or Component. This means it will render an <Outlet /> with a " + "null value by default resulting in an \"empty\" page.") : void 0;
402
+ }
403
+ let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {
404
+ params: Object.assign({}, parentParams, match.params),
405
+ pathname: joinPaths([parentPathnameBase,
406
+ // Re-encode pathnames that were decoded inside matchRoutes
407
+ navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname]),
408
+ pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([parentPathnameBase,
409
+ // Re-encode pathnames that were decoded inside matchRoutes
410
+ navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase])
411
+ })), parentMatches, dataRouterState, future);
412
+
413
+ // When a user passes in a `locationArg`, the associated routes need to
414
+ // be wrapped in a new `LocationContext.Provider` in order for `useLocation`
415
+ // to use the scoped location instead of the global location.
416
+ if (locationArg && renderedMatches) {
417
+ return /*#__PURE__*/React.createElement(LocationContext.Provider, {
418
+ value: {
419
+ location: _extends({
420
+ pathname: "/",
421
+ search: "",
422
+ hash: "",
423
+ state: null,
424
+ key: "default"
425
+ }, location),
426
+ navigationType: Action.Pop
427
+ }
428
+ }, renderedMatches);
429
+ }
430
+ return renderedMatches;
431
+ }
432
+ function DefaultErrorComponent() {
433
+ let error = useRouteError();
434
+ let message = isRouteErrorResponse(error) ? error.status + " " + error.statusText : error instanceof Error ? error.message : JSON.stringify(error);
435
+ let stack = error instanceof Error ? error.stack : null;
436
+ let lightgrey = "rgba(200,200,200, 0.5)";
437
+ let preStyles = {
438
+ padding: "0.5rem",
439
+ backgroundColor: lightgrey
440
+ };
441
+ let codeStyles = {
442
+ padding: "2px 4px",
443
+ backgroundColor: lightgrey
444
+ };
445
+ let devInfo = null;
446
+ if (process.env.NODE_ENV !== "production") {
447
+ console.error("Error handled by React Router default ErrorBoundary:", error);
448
+ devInfo = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", null, "\uD83D\uDCBF Hey developer \uD83D\uDC4B"), /*#__PURE__*/React.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /*#__PURE__*/React.createElement("code", {
449
+ style: codeStyles
450
+ }, "ErrorBoundary"), " or", " ", /*#__PURE__*/React.createElement("code", {
451
+ style: codeStyles
452
+ }, "errorElement"), " prop on your route."));
453
+ }
454
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h2", null, "Unexpected Application Error!"), /*#__PURE__*/React.createElement("h3", {
455
+ style: {
456
+ fontStyle: "italic"
457
+ }
458
+ }, message), stack ? /*#__PURE__*/React.createElement("pre", {
459
+ style: preStyles
460
+ }, stack) : null, devInfo);
461
+ }
462
+ const defaultErrorElement = /*#__PURE__*/React.createElement(DefaultErrorComponent, null);
463
+ class RenderErrorBoundary extends React.Component {
464
+ constructor(props) {
465
+ super(props);
466
+ this.state = {
467
+ location: props.location,
468
+ revalidation: props.revalidation,
469
+ error: props.error
470
+ };
471
+ }
472
+ static getDerivedStateFromError(error) {
473
+ return {
474
+ error: error
475
+ };
476
+ }
477
+ static getDerivedStateFromProps(props, state) {
478
+ // When we get into an error state, the user will likely click "back" to the
479
+ // previous page that didn't have an error. Because this wraps the entire
480
+ // application, that will have no effect--the error page continues to display.
481
+ // This gives us a mechanism to recover from the error when the location changes.
482
+ //
483
+ // Whether we're in an error state or not, we update the location in state
484
+ // so that when we are in an error state, it gets reset when a new location
485
+ // comes in and the user recovers from the error.
486
+ if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") {
487
+ return {
488
+ error: props.error,
489
+ location: props.location,
490
+ revalidation: props.revalidation
491
+ };
492
+ }
493
+
494
+ // If we're not changing locations, preserve the location but still surface
495
+ // any new errors that may come through. We retain the existing error, we do
496
+ // this because the error provided from the app state may be cleared without
497
+ // the location changing.
498
+ return {
499
+ error: props.error !== undefined ? props.error : state.error,
500
+ location: state.location,
501
+ revalidation: props.revalidation || state.revalidation
502
+ };
503
+ }
504
+ componentDidCatch(error, errorInfo) {
505
+ console.error("React Router caught the following error during render", error, errorInfo);
506
+ }
507
+ render() {
508
+ return this.state.error !== undefined ? /*#__PURE__*/React.createElement(RouteContext.Provider, {
509
+ value: this.props.routeContext
510
+ }, /*#__PURE__*/React.createElement(RouteErrorContext.Provider, {
511
+ value: this.state.error,
512
+ children: this.props.component
513
+ })) : this.props.children;
514
+ }
515
+ }
516
+ function RenderedRoute(_ref) {
517
+ let {
518
+ routeContext,
519
+ match,
520
+ children
521
+ } = _ref;
522
+ let dataRouterContext = React.useContext(DataRouterContext);
523
+
524
+ // Track how deep we got in our render pass to emulate SSR componentDidCatch
525
+ // in a DataStaticRouter
526
+ if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {
527
+ dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
528
+ }
529
+ return /*#__PURE__*/React.createElement(RouteContext.Provider, {
530
+ value: routeContext
531
+ }, children);
532
+ }
533
+ function _renderMatches(matches, parentMatches, dataRouterState, future) {
534
+ var _dataRouterState;
535
+ if (parentMatches === void 0) {
536
+ parentMatches = [];
537
+ }
538
+ if (dataRouterState === void 0) {
539
+ dataRouterState = null;
540
+ }
541
+ if (future === void 0) {
542
+ future = null;
543
+ }
544
+ if (matches == null) {
545
+ var _future;
546
+ if (!dataRouterState) {
547
+ return null;
548
+ }
549
+ if (dataRouterState.errors) {
550
+ // Don't bail if we have data router errors so we can render them in the
551
+ // boundary. Use the pre-matched (or shimmed) matches
552
+ matches = dataRouterState.matches;
553
+ } else if ((_future = future) != null && _future.v7_partialHydration && parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {
554
+ // Don't bail if we're initializing with partial hydration and we have
555
+ // router matches. That means we're actively running `patchRoutesOnNavigation`
556
+ // so we should render down the partial matches to the appropriate
557
+ // `HydrateFallback`. We only do this if `parentMatches` is empty so it
558
+ // only impacts the root matches for `RouterProvider` and no descendant
559
+ // `<Routes>`
560
+ matches = dataRouterState.matches;
561
+ } else {
562
+ return null;
563
+ }
564
+ }
565
+ let renderedMatches = matches;
566
+
567
+ // If we have data errors, trim matches to the highest error boundary
568
+ let errors = (_dataRouterState = dataRouterState) == null ? void 0 : _dataRouterState.errors;
569
+ if (errors != null) {
570
+ let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id]) !== undefined);
571
+ !(errorIndex >= 0) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "Could not find a matching route for errors on route IDs: " + Object.keys(errors).join(",")) : UNSAFE_invariant(false) : void 0;
572
+ renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));
573
+ }
574
+
575
+ // If we're in a partial hydration mode, detect if we need to render down to
576
+ // a given HydrateFallback while we load the rest of the hydration data
577
+ let renderFallback = false;
578
+ let fallbackIndex = -1;
579
+ if (dataRouterState && future && future.v7_partialHydration) {
580
+ for (let i = 0; i < renderedMatches.length; i++) {
581
+ let match = renderedMatches[i];
582
+ // Track the deepest fallback up until the first route without data
583
+ if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
584
+ fallbackIndex = i;
585
+ }
586
+ if (match.route.id) {
587
+ let {
588
+ loaderData,
589
+ errors
590
+ } = dataRouterState;
591
+ let needsToRunLoader = match.route.loader && loaderData[match.route.id] === undefined && (!errors || errors[match.route.id] === undefined);
592
+ if (match.route.lazy || needsToRunLoader) {
593
+ // We found the first route that's not ready to render (waiting on
594
+ // lazy, or has a loader that hasn't run yet). Flag that we need to
595
+ // render a fallback and render up until the appropriate fallback
596
+ renderFallback = true;
597
+ if (fallbackIndex >= 0) {
598
+ renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
599
+ } else {
600
+ renderedMatches = [renderedMatches[0]];
601
+ }
602
+ break;
603
+ }
604
+ }
605
+ }
606
+ }
607
+ return renderedMatches.reduceRight((outlet, match, index) => {
608
+ // Only data routers handle errors/fallbacks
609
+ let error;
610
+ let shouldRenderHydrateFallback = false;
611
+ let errorElement = null;
612
+ let hydrateFallbackElement = null;
613
+ if (dataRouterState) {
614
+ error = errors && match.route.id ? errors[match.route.id] : undefined;
615
+ errorElement = match.route.errorElement || defaultErrorElement;
616
+ if (renderFallback) {
617
+ if (fallbackIndex < 0 && index === 0) {
618
+ warningOnce("route-fallback", false, "No `HydrateFallback` element provided to render during initial hydration");
619
+ shouldRenderHydrateFallback = true;
620
+ hydrateFallbackElement = null;
621
+ } else if (fallbackIndex === index) {
622
+ shouldRenderHydrateFallback = true;
623
+ hydrateFallbackElement = match.route.hydrateFallbackElement || null;
624
+ }
625
+ }
626
+ }
627
+ let matches = parentMatches.concat(renderedMatches.slice(0, index + 1));
628
+ let getChildren = () => {
629
+ let children;
630
+ if (error) {
631
+ children = errorElement;
632
+ } else if (shouldRenderHydrateFallback) {
633
+ children = hydrateFallbackElement;
634
+ } else if (match.route.Component) {
635
+ // Note: This is a de-optimized path since React won't re-use the
636
+ // ReactElement since it's identity changes with each new
637
+ // React.createElement call. We keep this so folks can use
638
+ // `<Route Component={...}>` in `<Routes>` but generally `Component`
639
+ // usage is only advised in `RouterProvider` when we can convert it to
640
+ // `element` ahead of time.
641
+ children = /*#__PURE__*/React.createElement(match.route.Component, null);
642
+ } else if (match.route.element) {
643
+ children = match.route.element;
644
+ } else {
645
+ children = outlet;
646
+ }
647
+ return /*#__PURE__*/React.createElement(RenderedRoute, {
648
+ match: match,
649
+ routeContext: {
650
+ outlet,
651
+ matches,
652
+ isDataRoute: dataRouterState != null
653
+ },
654
+ children: children
655
+ });
656
+ };
657
+ // Only wrap in an error boundary within data router usages when we have an
658
+ // ErrorBoundary/errorElement on this route. Otherwise let it bubble up to
659
+ // an ancestor ErrorBoundary/errorElement
660
+ return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /*#__PURE__*/React.createElement(RenderErrorBoundary, {
661
+ location: dataRouterState.location,
662
+ revalidation: dataRouterState.revalidation,
663
+ component: errorElement,
664
+ error: error,
665
+ children: getChildren(),
666
+ routeContext: {
667
+ outlet: null,
668
+ matches,
669
+ isDataRoute: true
670
+ }
671
+ }) : getChildren();
672
+ }, null);
673
+ }
674
+ var DataRouterHook = /*#__PURE__*/function (DataRouterHook) {
675
+ DataRouterHook["UseBlocker"] = "useBlocker";
676
+ DataRouterHook["UseRevalidator"] = "useRevalidator";
677
+ DataRouterHook["UseNavigateStable"] = "useNavigate";
678
+ return DataRouterHook;
679
+ }(DataRouterHook || {});
680
+ var DataRouterStateHook = /*#__PURE__*/function (DataRouterStateHook) {
681
+ DataRouterStateHook["UseBlocker"] = "useBlocker";
682
+ DataRouterStateHook["UseLoaderData"] = "useLoaderData";
683
+ DataRouterStateHook["UseActionData"] = "useActionData";
684
+ DataRouterStateHook["UseRouteError"] = "useRouteError";
685
+ DataRouterStateHook["UseNavigation"] = "useNavigation";
686
+ DataRouterStateHook["UseRouteLoaderData"] = "useRouteLoaderData";
687
+ DataRouterStateHook["UseMatches"] = "useMatches";
688
+ DataRouterStateHook["UseRevalidator"] = "useRevalidator";
689
+ DataRouterStateHook["UseNavigateStable"] = "useNavigate";
690
+ DataRouterStateHook["UseRouteId"] = "useRouteId";
691
+ return DataRouterStateHook;
692
+ }(DataRouterStateHook || {});
693
+ function getDataRouterConsoleError(hookName) {
694
+ return hookName + " must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.";
695
+ }
696
+ function useDataRouterContext(hookName) {
697
+ let ctx = React.useContext(DataRouterContext);
698
+ !ctx ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;
699
+ return ctx;
700
+ }
701
+ function useDataRouterState(hookName) {
702
+ let state = React.useContext(DataRouterStateContext);
703
+ !state ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;
704
+ return state;
705
+ }
706
+ function useRouteContext(hookName) {
707
+ let route = React.useContext(RouteContext);
708
+ !route ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;
709
+ return route;
710
+ }
711
+
712
+ // Internal version with hookName-aware debugging
713
+ function useCurrentRouteId(hookName) {
714
+ let route = useRouteContext(hookName);
715
+ let thisRoute = route.matches[route.matches.length - 1];
716
+ !thisRoute.route.id ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, hookName + " can only be used on routes that contain a unique \"id\"") : UNSAFE_invariant(false) : void 0;
717
+ return thisRoute.route.id;
718
+ }
719
+
720
+ /**
721
+ * Returns the ID for the nearest contextual route
722
+ */
723
+ function useRouteId() {
724
+ return useCurrentRouteId(DataRouterStateHook.UseRouteId);
725
+ }
726
+
727
+ /**
728
+ * Returns the current navigation, defaulting to an "idle" navigation when
729
+ * no navigation is in progress
730
+ */
731
+ function useNavigation() {
732
+ let state = useDataRouterState(DataRouterStateHook.UseNavigation);
733
+ return state.navigation;
734
+ }
735
+
736
+ /**
737
+ * Returns a revalidate function for manually triggering revalidation, as well
738
+ * as the current state of any manual revalidations
739
+ */
740
+ function useRevalidator() {
741
+ let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);
742
+ let state = useDataRouterState(DataRouterStateHook.UseRevalidator);
743
+ return React.useMemo(() => ({
744
+ revalidate: dataRouterContext.router.revalidate,
745
+ state: state.revalidation
746
+ }), [dataRouterContext.router.revalidate, state.revalidation]);
747
+ }
748
+
749
+ /**
750
+ * Returns the active route matches, useful for accessing loaderData for
751
+ * parent/child routes or the route "handle" property
752
+ */
753
+ function useMatches() {
754
+ let {
755
+ matches,
756
+ loaderData
757
+ } = useDataRouterState(DataRouterStateHook.UseMatches);
758
+ return React.useMemo(() => matches.map(m => UNSAFE_convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData]);
759
+ }
760
+
761
+ /**
762
+ * Returns the loader data for the nearest ancestor Route loader
763
+ */
764
+ function useLoaderData() {
765
+ let state = useDataRouterState(DataRouterStateHook.UseLoaderData);
766
+ let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);
767
+ if (state.errors && state.errors[routeId] != null) {
768
+ console.error("You cannot `useLoaderData` in an errorElement (routeId: " + routeId + ")");
769
+ return undefined;
770
+ }
771
+ return state.loaderData[routeId];
772
+ }
773
+
774
+ /**
775
+ * Returns the loaderData for the given routeId
776
+ */
777
+ function useRouteLoaderData(routeId) {
778
+ let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData);
779
+ return state.loaderData[routeId];
780
+ }
781
+
782
+ /**
783
+ * Returns the action data for the nearest ancestor Route action
784
+ */
785
+ function useActionData() {
786
+ let state = useDataRouterState(DataRouterStateHook.UseActionData);
787
+ let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);
788
+ return state.actionData ? state.actionData[routeId] : undefined;
789
+ }
790
+
791
+ /**
792
+ * Returns the nearest ancestor Route error, which could be a loader/action
793
+ * error or a render error. This is intended to be called from your
794
+ * ErrorBoundary/errorElement to display a proper error message.
795
+ */
796
+ function useRouteError() {
797
+ var _state$errors;
798
+ let error = React.useContext(RouteErrorContext);
799
+ let state = useDataRouterState(DataRouterStateHook.UseRouteError);
800
+ let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError);
801
+
802
+ // If this was a render error, we put it in a RouteError context inside
803
+ // of RenderErrorBoundary
804
+ if (error !== undefined) {
805
+ return error;
806
+ }
807
+
808
+ // Otherwise look for errors from our data router state
809
+ return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId];
810
+ }
811
+
812
+ /**
813
+ * Returns the happy-path data from the nearest ancestor `<Await />` value
814
+ */
815
+ function useAsyncValue() {
816
+ let value = React.useContext(AwaitContext);
817
+ return value == null ? void 0 : value._data;
818
+ }
819
+
820
+ /**
821
+ * Returns the error from the nearest ancestor `<Await />` value
822
+ */
823
+ function useAsyncError() {
824
+ let value = React.useContext(AwaitContext);
825
+ return value == null ? void 0 : value._error;
826
+ }
827
+ let blockerId = 0;
828
+
829
+ /**
830
+ * Allow the application to block navigations within the SPA and present the
831
+ * user a confirmation dialog to confirm the navigation. Mostly used to avoid
832
+ * using half-filled form data. This does not handle hard-reloads or
833
+ * cross-origin navigations.
834
+ */
835
+ function useBlocker(shouldBlock) {
836
+ let {
837
+ router,
838
+ basename
839
+ } = useDataRouterContext(DataRouterHook.UseBlocker);
840
+ let state = useDataRouterState(DataRouterStateHook.UseBlocker);
841
+ let [blockerKey, setBlockerKey] = React.useState("");
842
+ let blockerFunction = React.useCallback(arg => {
843
+ if (typeof shouldBlock !== "function") {
844
+ return !!shouldBlock;
845
+ }
846
+ if (basename === "/") {
847
+ return shouldBlock(arg);
848
+ }
849
+
850
+ // If they provided us a function and we've got an active basename, strip
851
+ // it from the locations we expose to the user to match the behavior of
852
+ // useLocation
853
+ let {
854
+ currentLocation,
855
+ nextLocation,
856
+ historyAction
857
+ } = arg;
858
+ return shouldBlock({
859
+ currentLocation: _extends({}, currentLocation, {
860
+ pathname: stripBasename(currentLocation.pathname, basename) || currentLocation.pathname
861
+ }),
862
+ nextLocation: _extends({}, nextLocation, {
863
+ pathname: stripBasename(nextLocation.pathname, basename) || nextLocation.pathname
864
+ }),
865
+ historyAction
866
+ });
867
+ }, [basename, shouldBlock]);
868
+
869
+ // This effect is in charge of blocker key assignment and deletion (which is
870
+ // tightly coupled to the key)
871
+ React.useEffect(() => {
872
+ let key = String(++blockerId);
873
+ setBlockerKey(key);
874
+ return () => router.deleteBlocker(key);
875
+ }, [router]);
876
+
877
+ // This effect handles assigning the blockerFunction. This is to handle
878
+ // unstable blocker function identities, and happens only after the prior
879
+ // effect so we don't get an orphaned blockerFunction in the router with a
880
+ // key of "". Until then we just have the IDLE_BLOCKER.
881
+ React.useEffect(() => {
882
+ if (blockerKey !== "") {
883
+ router.getBlocker(blockerKey, blockerFunction);
884
+ }
885
+ }, [router, blockerKey, blockerFunction]);
886
+
887
+ // Prefer the blocker from `state` not `router.state` since DataRouterContext
888
+ // is memoized so this ensures we update on blocker state updates
889
+ return blockerKey && state.blockers.has(blockerKey) ? state.blockers.get(blockerKey) : IDLE_BLOCKER;
890
+ }
891
+
892
+ /**
893
+ * Stable version of useNavigate that is used when we are in the context of
894
+ * a RouterProvider.
895
+ */
896
+ function useNavigateStable() {
897
+ let {
898
+ router
899
+ } = useDataRouterContext(DataRouterHook.UseNavigateStable);
900
+ let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);
901
+ let activeRef = React.useRef(false);
902
+ useIsomorphicLayoutEffect(() => {
903
+ activeRef.current = true;
904
+ });
905
+ let navigate = React.useCallback(function (to, options) {
906
+ if (options === void 0) {
907
+ options = {};
908
+ }
909
+ process.env.NODE_ENV !== "production" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;
910
+
911
+ // Short circuit here since if this happens on first render the navigate
912
+ // is useless because we haven't wired up our router subscriber yet
913
+ if (!activeRef.current) return;
914
+ if (typeof to === "number") {
915
+ router.navigate(to);
916
+ } else {
917
+ router.navigate(to, _extends({
918
+ fromRouteId: id
919
+ }, options));
920
+ }
921
+ }, [router, id]);
922
+ return navigate;
923
+ }
924
+ const alreadyWarned$1 = {};
925
+ function warningOnce(key, cond, message) {
926
+ if (!cond && !alreadyWarned$1[key]) {
927
+ alreadyWarned$1[key] = true;
928
+ process.env.NODE_ENV !== "production" ? UNSAFE_warning(false, message) : void 0;
929
+ }
930
+ }
931
+
932
+ const alreadyWarned = {};
933
+ function warnOnce(key, message) {
934
+ if (process.env.NODE_ENV !== "production" && !alreadyWarned[message]) {
935
+ alreadyWarned[message] = true;
936
+ console.warn(message);
937
+ }
938
+ }
939
+ const logDeprecation = (flag, msg, link) => warnOnce(flag, "\u26A0\uFE0F React Router Future Flag Warning: " + msg + ". " + ("You can use the `" + flag + "` future flag to opt-in early. ") + ("For more information, see " + link + "."));
940
+ function logV6DeprecationWarnings(renderFuture, routerFuture) {
941
+ if ((renderFuture == null ? void 0 : renderFuture.v7_startTransition) === undefined) {
942
+ logDeprecation("v7_startTransition", "React Router will begin wrapping state updates in `React.startTransition` in v7", "https://reactrouter.com/v6/upgrading/future#v7_starttransition");
943
+ }
944
+ if ((renderFuture == null ? void 0 : renderFuture.v7_relativeSplatPath) === undefined && (!routerFuture || routerFuture.v7_relativeSplatPath === undefined)) {
945
+ logDeprecation("v7_relativeSplatPath", "Relative route resolution within Splat routes is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath");
946
+ }
947
+ if (routerFuture) {
948
+ if (routerFuture.v7_fetcherPersist === undefined) {
949
+ logDeprecation("v7_fetcherPersist", "The persistence behavior of fetchers is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist");
950
+ }
951
+ if (routerFuture.v7_normalizeFormMethod === undefined) {
952
+ logDeprecation("v7_normalizeFormMethod", "Casing of `formMethod` fields is being normalized to uppercase in v7", "https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod");
953
+ }
954
+ if (routerFuture.v7_partialHydration === undefined) {
955
+ logDeprecation("v7_partialHydration", "`RouterProvider` hydration behavior is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_partialhydration");
956
+ }
957
+ if (routerFuture.v7_skipActionErrorRevalidation === undefined) {
958
+ logDeprecation("v7_skipActionErrorRevalidation", "The revalidation behavior after 4xx/5xx `action` responses is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation");
959
+ }
960
+ }
961
+ }
962
+
963
+ /**
964
+ Webpack + React 17 fails to compile on any of the following because webpack
965
+ complains that `startTransition` doesn't exist in `React`:
966
+ * import { startTransition } from "react"
967
+ * import * as React from from "react";
968
+ "startTransition" in React ? React.startTransition(() => setState()) : setState()
969
+ * import * as React from from "react";
970
+ "startTransition" in React ? React["startTransition"](() => setState()) : setState()
971
+
972
+ Moving it to a constant such as the following solves the Webpack/React 17 issue:
973
+ * import * as React from from "react";
974
+ const START_TRANSITION = "startTransition";
975
+ START_TRANSITION in React ? React[START_TRANSITION](() => setState()) : setState()
976
+
977
+ However, that introduces webpack/terser minification issues in production builds
978
+ in React 18 where minification/obfuscation ends up removing the call of
979
+ React.startTransition entirely from the first half of the ternary. Grabbing
980
+ this exported reference once up front resolves that issue.
981
+
982
+ See https://github.com/remix-run/react-router/issues/10579
983
+ */
984
+ const START_TRANSITION = "startTransition";
985
+ const startTransitionImpl = React[START_TRANSITION];
986
+
987
+ /**
988
+ * Given a Remix Router instance, render the appropriate UI
989
+ */
990
+ function RouterProvider(_ref) {
991
+ let {
992
+ fallbackElement,
993
+ router,
994
+ future
995
+ } = _ref;
996
+ let [state, setStateImpl] = React.useState(router.state);
997
+ let {
998
+ v7_startTransition
999
+ } = future || {};
1000
+ let setState = React.useCallback(newState => {
1001
+ if (v7_startTransition && startTransitionImpl) {
1002
+ startTransitionImpl(() => setStateImpl(newState));
1003
+ } else {
1004
+ setStateImpl(newState);
1005
+ }
1006
+ }, [setStateImpl, v7_startTransition]);
1007
+
1008
+ // Need to use a layout effect here so we are subscribed early enough to
1009
+ // pick up on any render-driven redirects/navigations (useEffect/<Navigate>)
1010
+ React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);
1011
+ React.useEffect(() => {
1012
+ process.env.NODE_ENV !== "production" ? UNSAFE_warning(fallbackElement == null || !router.future.v7_partialHydration, "`<RouterProvider fallbackElement>` is deprecated when using " + "`v7_partialHydration`, use a `HydrateFallback` component instead") : void 0;
1013
+ // Only log this once on initial mount
1014
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1015
+ }, []);
1016
+ let navigator = React.useMemo(() => {
1017
+ return {
1018
+ createHref: router.createHref,
1019
+ encodeLocation: router.encodeLocation,
1020
+ go: n => router.navigate(n),
1021
+ push: (to, state, opts) => router.navigate(to, {
1022
+ state,
1023
+ preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
1024
+ }),
1025
+ replace: (to, state, opts) => router.navigate(to, {
1026
+ replace: true,
1027
+ state,
1028
+ preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
1029
+ })
1030
+ };
1031
+ }, [router]);
1032
+ let basename = router.basename || "/";
1033
+ let dataRouterContext = React.useMemo(() => ({
1034
+ router,
1035
+ navigator,
1036
+ static: false,
1037
+ basename
1038
+ }), [router, navigator, basename]);
1039
+ React.useEffect(() => logV6DeprecationWarnings(future, router.future), [router, future]);
1040
+
1041
+ // The fragment and {null} here are important! We need them to keep React 18's
1042
+ // useId happy when we are server-rendering since we may have a <script> here
1043
+ // containing the hydrated server-side staticContext (from StaticRouterProvider).
1044
+ // useId relies on the component tree structure to generate deterministic id's
1045
+ // so we need to ensure it remains the same on the client even though
1046
+ // we don't need the <script> tag
1047
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DataRouterContext.Provider, {
1048
+ value: dataRouterContext
1049
+ }, /*#__PURE__*/React.createElement(DataRouterStateContext.Provider, {
1050
+ value: state
1051
+ }, /*#__PURE__*/React.createElement(Router, {
1052
+ basename: basename,
1053
+ location: state.location,
1054
+ navigationType: state.historyAction,
1055
+ navigator: navigator,
1056
+ future: {
1057
+ v7_relativeSplatPath: router.future.v7_relativeSplatPath
1058
+ }
1059
+ }, state.initialized || router.future.v7_partialHydration ? /*#__PURE__*/React.createElement(DataRoutes, {
1060
+ routes: router.routes,
1061
+ future: router.future,
1062
+ state: state
1063
+ }) : fallbackElement))), null);
1064
+ }
1065
+ function DataRoutes(_ref2) {
1066
+ let {
1067
+ routes,
1068
+ future,
1069
+ state
1070
+ } = _ref2;
1071
+ return useRoutesImpl(routes, undefined, state, future);
1072
+ }
1073
+ /**
1074
+ * A `<Router>` that stores all entries in memory.
1075
+ *
1076
+ * @see https://reactrouter.com/v6/router-components/memory-router
1077
+ */
1078
+ function MemoryRouter(_ref3) {
1079
+ let {
1080
+ basename,
1081
+ children,
1082
+ initialEntries,
1083
+ initialIndex,
1084
+ future
1085
+ } = _ref3;
1086
+ let historyRef = React.useRef();
1087
+ if (historyRef.current == null) {
1088
+ historyRef.current = createMemoryHistory({
1089
+ initialEntries,
1090
+ initialIndex,
1091
+ v5Compat: true
1092
+ });
1093
+ }
1094
+ let history = historyRef.current;
1095
+ let [state, setStateImpl] = React.useState({
1096
+ action: history.action,
1097
+ location: history.location
1098
+ });
1099
+ let {
1100
+ v7_startTransition
1101
+ } = future || {};
1102
+ let setState = React.useCallback(newState => {
1103
+ v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);
1104
+ }, [setStateImpl, v7_startTransition]);
1105
+ React.useLayoutEffect(() => history.listen(setState), [history, setState]);
1106
+ React.useEffect(() => logV6DeprecationWarnings(future), [future]);
1107
+ return /*#__PURE__*/React.createElement(Router, {
1108
+ basename: basename,
1109
+ children: children,
1110
+ location: state.location,
1111
+ navigationType: state.action,
1112
+ navigator: history,
1113
+ future: future
1114
+ });
1115
+ }
1116
+ /**
1117
+ * Changes the current location.
1118
+ *
1119
+ * Note: This API is mostly useful in React.Component subclasses that are not
1120
+ * able to use hooks. In functional components, we recommend you use the
1121
+ * `useNavigate` hook instead.
1122
+ *
1123
+ * @see https://reactrouter.com/v6/components/navigate
1124
+ */
1125
+ function Navigate(_ref4) {
1126
+ let {
1127
+ to,
1128
+ replace,
1129
+ state,
1130
+ relative
1131
+ } = _ref4;
1132
+ !useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of
1133
+ // the router loaded. We can help them understand how to avoid that.
1134
+ "<Navigate> may be used only in the context of a <Router> component.") : UNSAFE_invariant(false) : void 0;
1135
+ let {
1136
+ future,
1137
+ static: isStatic
1138
+ } = React.useContext(NavigationContext);
1139
+ process.env.NODE_ENV !== "production" ? UNSAFE_warning(!isStatic, "<Navigate> must not be used on the initial render in a <StaticRouter>. " + "This is a no-op, but you should modify your code so the <Navigate> is " + "only ever rendered in response to some user interaction or state change.") : void 0;
1140
+ let {
1141
+ matches
1142
+ } = React.useContext(RouteContext);
1143
+ let {
1144
+ pathname: locationPathname
1145
+ } = useLocation();
1146
+ let navigate = useNavigate();
1147
+
1148
+ // Resolve the path outside of the effect so that when effects run twice in
1149
+ // StrictMode they navigate to the same place
1150
+ let path = resolveTo(to, UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath), locationPathname, relative === "path");
1151
+ let jsonPath = JSON.stringify(path);
1152
+ React.useEffect(() => navigate(JSON.parse(jsonPath), {
1153
+ replace,
1154
+ state,
1155
+ relative
1156
+ }), [navigate, jsonPath, relative, replace, state]);
1157
+ return null;
1158
+ }
1159
+ /**
1160
+ * Renders the child route's element, if there is one.
1161
+ *
1162
+ * @see https://reactrouter.com/v6/components/outlet
1163
+ */
1164
+ function Outlet(props) {
1165
+ return useOutlet(props.context);
1166
+ }
1167
+ /**
1168
+ * Declares an element that should be rendered at a certain URL path.
1169
+ *
1170
+ * @see https://reactrouter.com/v6/components/route
1171
+ */
1172
+ function Route(_props) {
1173
+ process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "A <Route> is only ever to be used as the child of <Routes> element, " + "never rendered directly. Please wrap your <Route> in a <Routes>.") : UNSAFE_invariant(false) ;
1174
+ }
1175
+ /**
1176
+ * Provides location context for the rest of the app.
1177
+ *
1178
+ * Note: You usually won't render a `<Router>` directly. Instead, you'll render a
1179
+ * router that is more specific to your environment such as a `<BrowserRouter>`
1180
+ * in web browsers or a `<StaticRouter>` for server rendering.
1181
+ *
1182
+ * @see https://reactrouter.com/v6/router-components/router
1183
+ */
1184
+ function Router(_ref5) {
1185
+ let {
1186
+ basename: basenameProp = "/",
1187
+ children = null,
1188
+ location: locationProp,
1189
+ navigationType = Action.Pop,
1190
+ navigator,
1191
+ static: staticProp = false,
1192
+ future
1193
+ } = _ref5;
1194
+ !!useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "You cannot render a <Router> inside another <Router>." + " You should never have more than one in your app.") : UNSAFE_invariant(false) : void 0;
1195
+
1196
+ // Preserve trailing slashes on basename, so we can let the user control
1197
+ // the enforcement of trailing slashes throughout the app
1198
+ let basename = basenameProp.replace(/^\/*/, "/");
1199
+ let navigationContext = React.useMemo(() => ({
1200
+ basename,
1201
+ navigator,
1202
+ static: staticProp,
1203
+ future: _extends({
1204
+ v7_relativeSplatPath: false
1205
+ }, future)
1206
+ }), [basename, future, navigator, staticProp]);
1207
+ if (typeof locationProp === "string") {
1208
+ locationProp = parsePath(locationProp);
1209
+ }
1210
+ let {
1211
+ pathname = "/",
1212
+ search = "",
1213
+ hash = "",
1214
+ state = null,
1215
+ key = "default"
1216
+ } = locationProp;
1217
+ let locationContext = React.useMemo(() => {
1218
+ let trailingPathname = stripBasename(pathname, basename);
1219
+ if (trailingPathname == null) {
1220
+ return null;
1221
+ }
1222
+ return {
1223
+ location: {
1224
+ pathname: trailingPathname,
1225
+ search,
1226
+ hash,
1227
+ state,
1228
+ key
1229
+ },
1230
+ navigationType
1231
+ };
1232
+ }, [basename, pathname, search, hash, state, key, navigationType]);
1233
+ process.env.NODE_ENV !== "production" ? UNSAFE_warning(locationContext != null, "<Router basename=\"" + basename + "\"> is not able to match the URL " + ("\"" + pathname + search + hash + "\" because it does not start with the ") + "basename, so the <Router> won't render anything.") : void 0;
1234
+ if (locationContext == null) {
1235
+ return null;
1236
+ }
1237
+ return /*#__PURE__*/React.createElement(NavigationContext.Provider, {
1238
+ value: navigationContext
1239
+ }, /*#__PURE__*/React.createElement(LocationContext.Provider, {
1240
+ children: children,
1241
+ value: locationContext
1242
+ }));
1243
+ }
1244
+ /**
1245
+ * A container for a nested tree of `<Route>` elements that renders the branch
1246
+ * that best matches the current location.
1247
+ *
1248
+ * @see https://reactrouter.com/v6/components/routes
1249
+ */
1250
+ function Routes(_ref6) {
1251
+ let {
1252
+ children,
1253
+ location
1254
+ } = _ref6;
1255
+ return useRoutes(createRoutesFromChildren(children), location);
1256
+ }
1257
+ /**
1258
+ * Component to use for rendering lazily loaded data from returning defer()
1259
+ * in a loader function
1260
+ */
1261
+ function Await(_ref7) {
1262
+ let {
1263
+ children,
1264
+ errorElement,
1265
+ resolve
1266
+ } = _ref7;
1267
+ return /*#__PURE__*/React.createElement(AwaitErrorBoundary, {
1268
+ resolve: resolve,
1269
+ errorElement: errorElement
1270
+ }, /*#__PURE__*/React.createElement(ResolveAwait, null, children));
1271
+ }
1272
+ var AwaitRenderStatus = /*#__PURE__*/function (AwaitRenderStatus) {
1273
+ AwaitRenderStatus[AwaitRenderStatus["pending"] = 0] = "pending";
1274
+ AwaitRenderStatus[AwaitRenderStatus["success"] = 1] = "success";
1275
+ AwaitRenderStatus[AwaitRenderStatus["error"] = 2] = "error";
1276
+ return AwaitRenderStatus;
1277
+ }(AwaitRenderStatus || {});
1278
+ const neverSettledPromise = new Promise(() => {});
1279
+ class AwaitErrorBoundary extends React.Component {
1280
+ constructor(props) {
1281
+ super(props);
1282
+ this.state = {
1283
+ error: null
1284
+ };
1285
+ }
1286
+ static getDerivedStateFromError(error) {
1287
+ return {
1288
+ error
1289
+ };
1290
+ }
1291
+ componentDidCatch(error, errorInfo) {
1292
+ console.error("<Await> caught the following error during render", error, errorInfo);
1293
+ }
1294
+ render() {
1295
+ let {
1296
+ children,
1297
+ errorElement,
1298
+ resolve
1299
+ } = this.props;
1300
+ let promise = null;
1301
+ let status = AwaitRenderStatus.pending;
1302
+ if (!(resolve instanceof Promise)) {
1303
+ // Didn't get a promise - provide as a resolved promise
1304
+ status = AwaitRenderStatus.success;
1305
+ promise = Promise.resolve();
1306
+ Object.defineProperty(promise, "_tracked", {
1307
+ get: () => true
1308
+ });
1309
+ Object.defineProperty(promise, "_data", {
1310
+ get: () => resolve
1311
+ });
1312
+ } else if (this.state.error) {
1313
+ // Caught a render error, provide it as a rejected promise
1314
+ status = AwaitRenderStatus.error;
1315
+ let renderError = this.state.error;
1316
+ promise = Promise.reject().catch(() => {}); // Avoid unhandled rejection warnings
1317
+ Object.defineProperty(promise, "_tracked", {
1318
+ get: () => true
1319
+ });
1320
+ Object.defineProperty(promise, "_error", {
1321
+ get: () => renderError
1322
+ });
1323
+ } else if (resolve._tracked) {
1324
+ // Already tracked promise - check contents
1325
+ promise = resolve;
1326
+ status = "_error" in promise ? AwaitRenderStatus.error : "_data" in promise ? AwaitRenderStatus.success : AwaitRenderStatus.pending;
1327
+ } else {
1328
+ // Raw (untracked) promise - track it
1329
+ status = AwaitRenderStatus.pending;
1330
+ Object.defineProperty(resolve, "_tracked", {
1331
+ get: () => true
1332
+ });
1333
+ promise = resolve.then(data => Object.defineProperty(resolve, "_data", {
1334
+ get: () => data
1335
+ }), error => Object.defineProperty(resolve, "_error", {
1336
+ get: () => error
1337
+ }));
1338
+ }
1339
+ if (status === AwaitRenderStatus.error && promise._error instanceof AbortedDeferredError) {
1340
+ // Freeze the UI by throwing a never resolved promise
1341
+ throw neverSettledPromise;
1342
+ }
1343
+ if (status === AwaitRenderStatus.error && !errorElement) {
1344
+ // No errorElement, throw to the nearest route-level error boundary
1345
+ throw promise._error;
1346
+ }
1347
+ if (status === AwaitRenderStatus.error) {
1348
+ // Render via our errorElement
1349
+ return /*#__PURE__*/React.createElement(AwaitContext.Provider, {
1350
+ value: promise,
1351
+ children: errorElement
1352
+ });
1353
+ }
1354
+ if (status === AwaitRenderStatus.success) {
1355
+ // Render children with resolved value
1356
+ return /*#__PURE__*/React.createElement(AwaitContext.Provider, {
1357
+ value: promise,
1358
+ children: children
1359
+ });
1360
+ }
1361
+
1362
+ // Throw to the suspense boundary
1363
+ throw promise;
1364
+ }
1365
+ }
1366
+
1367
+ /**
1368
+ * @private
1369
+ * Indirection to leverage useAsyncValue for a render-prop API on `<Await>`
1370
+ */
1371
+ function ResolveAwait(_ref8) {
1372
+ let {
1373
+ children
1374
+ } = _ref8;
1375
+ let data = useAsyncValue();
1376
+ let toRender = typeof children === "function" ? children(data) : children;
1377
+ return /*#__PURE__*/React.createElement(React.Fragment, null, toRender);
1378
+ }
1379
+
1380
+ ///////////////////////////////////////////////////////////////////////////////
1381
+ // UTILS
1382
+ ///////////////////////////////////////////////////////////////////////////////
1383
+
1384
+ /**
1385
+ * Creates a route config from a React "children" object, which is usually
1386
+ * either a `<Route>` element or an array of them. Used internally by
1387
+ * `<Routes>` to create a route config from its children.
1388
+ *
1389
+ * @see https://reactrouter.com/v6/utils/create-routes-from-children
1390
+ */
1391
+ function createRoutesFromChildren(children, parentPath) {
1392
+ if (parentPath === void 0) {
1393
+ parentPath = [];
1394
+ }
1395
+ let routes = [];
1396
+ React.Children.forEach(children, (element, index) => {
1397
+ if (! /*#__PURE__*/React.isValidElement(element)) {
1398
+ // Ignore non-elements. This allows people to more easily inline
1399
+ // conditionals in their route config.
1400
+ return;
1401
+ }
1402
+ let treePath = [...parentPath, index];
1403
+ if (element.type === React.Fragment) {
1404
+ // Transparently support React.Fragment and its children.
1405
+ routes.push.apply(routes, createRoutesFromChildren(element.props.children, treePath));
1406
+ return;
1407
+ }
1408
+ !(element.type === Route) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "[" + (typeof element.type === "string" ? element.type : element.type.name) + "] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>") : UNSAFE_invariant(false) : void 0;
1409
+ !(!element.props.index || !element.props.children) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "An index route cannot have child routes.") : UNSAFE_invariant(false) : void 0;
1410
+ let route = {
1411
+ id: element.props.id || treePath.join("-"),
1412
+ caseSensitive: element.props.caseSensitive,
1413
+ element: element.props.element,
1414
+ Component: element.props.Component,
1415
+ index: element.props.index,
1416
+ path: element.props.path,
1417
+ loader: element.props.loader,
1418
+ action: element.props.action,
1419
+ errorElement: element.props.errorElement,
1420
+ ErrorBoundary: element.props.ErrorBoundary,
1421
+ hasErrorBoundary: element.props.ErrorBoundary != null || element.props.errorElement != null,
1422
+ shouldRevalidate: element.props.shouldRevalidate,
1423
+ handle: element.props.handle,
1424
+ lazy: element.props.lazy
1425
+ };
1426
+ if (element.props.children) {
1427
+ route.children = createRoutesFromChildren(element.props.children, treePath);
1428
+ }
1429
+ routes.push(route);
1430
+ });
1431
+ return routes;
1432
+ }
1433
+
1434
+ /**
1435
+ * Renders the result of `matchRoutes()` into a React element.
1436
+ */
1437
+ function renderMatches(matches) {
1438
+ return _renderMatches(matches);
1439
+ }
1440
+
1441
+ function mapRouteProperties(route) {
1442
+ let updates = {
1443
+ // Note: this check also occurs in createRoutesFromChildren so update
1444
+ // there if you change this -- please and thank you!
1445
+ hasErrorBoundary: route.ErrorBoundary != null || route.errorElement != null
1446
+ };
1447
+ if (route.Component) {
1448
+ if (process.env.NODE_ENV !== "production") {
1449
+ if (route.element) {
1450
+ process.env.NODE_ENV !== "production" ? UNSAFE_warning(false, "You should not include both `Component` and `element` on your route - " + "`Component` will be used.") : void 0;
1451
+ }
1452
+ }
1453
+ Object.assign(updates, {
1454
+ element: /*#__PURE__*/React.createElement(route.Component),
1455
+ Component: undefined
1456
+ });
1457
+ }
1458
+ if (route.HydrateFallback) {
1459
+ if (process.env.NODE_ENV !== "production") {
1460
+ if (route.hydrateFallbackElement) {
1461
+ process.env.NODE_ENV !== "production" ? UNSAFE_warning(false, "You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - " + "`HydrateFallback` will be used.") : void 0;
1462
+ }
1463
+ }
1464
+ Object.assign(updates, {
1465
+ hydrateFallbackElement: /*#__PURE__*/React.createElement(route.HydrateFallback),
1466
+ HydrateFallback: undefined
1467
+ });
1468
+ }
1469
+ if (route.ErrorBoundary) {
1470
+ if (process.env.NODE_ENV !== "production") {
1471
+ if (route.errorElement) {
1472
+ process.env.NODE_ENV !== "production" ? UNSAFE_warning(false, "You should not include both `ErrorBoundary` and `errorElement` on your route - " + "`ErrorBoundary` will be used.") : void 0;
1473
+ }
1474
+ }
1475
+ Object.assign(updates, {
1476
+ errorElement: /*#__PURE__*/React.createElement(route.ErrorBoundary),
1477
+ ErrorBoundary: undefined
1478
+ });
1479
+ }
1480
+ return updates;
1481
+ }
1482
+ function createMemoryRouter(routes, opts) {
1483
+ return createRouter({
1484
+ basename: opts == null ? void 0 : opts.basename,
1485
+ future: _extends({}, opts == null ? void 0 : opts.future, {
1486
+ v7_prependBasename: true
1487
+ }),
1488
+ history: createMemoryHistory({
1489
+ initialEntries: opts == null ? void 0 : opts.initialEntries,
1490
+ initialIndex: opts == null ? void 0 : opts.initialIndex
1491
+ }),
1492
+ hydrationData: opts == null ? void 0 : opts.hydrationData,
1493
+ routes,
1494
+ mapRouteProperties,
1495
+ dataStrategy: opts == null ? void 0 : opts.dataStrategy,
1496
+ patchRoutesOnNavigation: opts == null ? void 0 : opts.patchRoutesOnNavigation
1497
+ }).initialize();
1498
+ }
1499
+
1500
+ export { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, logV6DeprecationWarnings as UNSAFE_logV6DeprecationWarnings, mapRouteProperties as UNSAFE_mapRouteProperties, useRouteId as UNSAFE_useRouteId, useRoutesImpl as UNSAFE_useRoutesImpl, createMemoryRouter, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, renderMatches, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
1501
+ //# sourceMappingURL=index.js.map