react-router-dom 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.
@@ -0,0 +1,1848 @@
1
+ /**
2
+ * React Router DOM 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
+ (function (global, factory) {
12
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom'), require('react-router'), require('@remix-run/router')) :
13
+ typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom', 'react-router', '@remix-run/router'], factory) :
14
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactRouterDOM = {}, global.React, global.ReactDOM, global.ReactRouter, global.RemixRouter));
15
+ })(this, (function (exports, React, ReactDOM, reactRouter, router) { 'use strict';
16
+
17
+ function _interopNamespace(e) {
18
+ if (e && e.__esModule) return e;
19
+ var n = Object.create(null);
20
+ if (e) {
21
+ Object.keys(e).forEach(function (k) {
22
+ if (k !== 'default') {
23
+ var d = Object.getOwnPropertyDescriptor(e, k);
24
+ Object.defineProperty(n, k, d.get ? d : {
25
+ enumerable: true,
26
+ get: function () { return e[k]; }
27
+ });
28
+ }
29
+ });
30
+ }
31
+ n["default"] = e;
32
+ return Object.freeze(n);
33
+ }
34
+
35
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
36
+ var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
37
+
38
+ function _extends() {
39
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
40
+ for (var i = 1; i < arguments.length; i++) {
41
+ var source = arguments[i];
42
+ for (var key in source) {
43
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
44
+ target[key] = source[key];
45
+ }
46
+ }
47
+ }
48
+ return target;
49
+ };
50
+ return _extends.apply(this, arguments);
51
+ }
52
+ function _objectWithoutPropertiesLoose(source, excluded) {
53
+ if (source == null) return {};
54
+ var target = {};
55
+ var sourceKeys = Object.keys(source);
56
+ var key, i;
57
+ for (i = 0; i < sourceKeys.length; i++) {
58
+ key = sourceKeys[i];
59
+ if (excluded.indexOf(key) >= 0) continue;
60
+ target[key] = source[key];
61
+ }
62
+ return target;
63
+ }
64
+
65
+ const defaultMethod = "get";
66
+ const defaultEncType = "application/x-www-form-urlencoded";
67
+ function isHtmlElement(object) {
68
+ return object != null && typeof object.tagName === "string";
69
+ }
70
+ function isButtonElement(object) {
71
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
72
+ }
73
+ function isFormElement(object) {
74
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
75
+ }
76
+ function isInputElement(object) {
77
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
78
+ }
79
+ function isModifiedEvent(event) {
80
+ return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
81
+ }
82
+ function shouldProcessLinkClick(event, target) {
83
+ return event.button === 0 && (
84
+ // Ignore everything but left clicks
85
+ !target || target === "_self") &&
86
+ // Let browser handle "target=_blank" etc.
87
+ !isModifiedEvent(event) // Ignore clicks with modifier keys
88
+ ;
89
+ }
90
+
91
+ /**
92
+ * Creates a URLSearchParams object using the given initializer.
93
+ *
94
+ * This is identical to `new URLSearchParams(init)` except it also
95
+ * supports arrays as values in the object form of the initializer
96
+ * instead of just strings. This is convenient when you need multiple
97
+ * values for a given key, but don't want to use an array initializer.
98
+ *
99
+ * For example, instead of:
100
+ *
101
+ * let searchParams = new URLSearchParams([
102
+ * ['sort', 'name'],
103
+ * ['sort', 'price']
104
+ * ]);
105
+ *
106
+ * you can do:
107
+ *
108
+ * let searchParams = createSearchParams({
109
+ * sort: ['name', 'price']
110
+ * });
111
+ */
112
+ function createSearchParams(init) {
113
+ if (init === void 0) {
114
+ init = "";
115
+ }
116
+ return new URLSearchParams(typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {
117
+ let value = init[key];
118
+ return memo.concat(Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]);
119
+ }, []));
120
+ }
121
+ function getSearchParamsForLocation(locationSearch, defaultSearchParams) {
122
+ let searchParams = createSearchParams(locationSearch);
123
+ if (defaultSearchParams) {
124
+ // Use `defaultSearchParams.forEach(...)` here instead of iterating of
125
+ // `defaultSearchParams.keys()` to work-around a bug in Firefox related to
126
+ // web extensions. Relevant Bugzilla tickets:
127
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1414602
128
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1023984
129
+ defaultSearchParams.forEach((_, key) => {
130
+ if (!searchParams.has(key)) {
131
+ defaultSearchParams.getAll(key).forEach(value => {
132
+ searchParams.append(key, value);
133
+ });
134
+ }
135
+ });
136
+ }
137
+ return searchParams;
138
+ }
139
+
140
+ // Thanks https://github.com/sindresorhus/type-fest!
141
+
142
+ // One-time check for submitter support
143
+ let _formDataSupportsSubmitter = null;
144
+ function isFormDataSubmitterSupported() {
145
+ if (_formDataSupportsSubmitter === null) {
146
+ try {
147
+ new FormData(document.createElement("form"),
148
+ // @ts-expect-error if FormData supports the submitter parameter, this will throw
149
+ 0);
150
+ _formDataSupportsSubmitter = false;
151
+ } catch (e) {
152
+ _formDataSupportsSubmitter = true;
153
+ }
154
+ }
155
+ return _formDataSupportsSubmitter;
156
+ }
157
+
158
+ /**
159
+ * Submit options shared by both navigations and fetchers
160
+ */
161
+
162
+ /**
163
+ * Submit options available to fetchers
164
+ */
165
+
166
+ /**
167
+ * Submit options available to navigations
168
+ */
169
+
170
+ const supportedFormEncTypes = new Set(["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"]);
171
+ function getFormEncType(encType) {
172
+ if (encType != null && !supportedFormEncTypes.has(encType)) {
173
+ router.UNSAFE_warning(false, "\"" + encType + "\" is not a valid `encType` for `<Form>`/`<fetcher.Form>` " + ("and will default to \"" + defaultEncType + "\"")) ;
174
+ return null;
175
+ }
176
+ return encType;
177
+ }
178
+ function getFormSubmissionInfo(target, basename) {
179
+ let method;
180
+ let action;
181
+ let encType;
182
+ let formData;
183
+ let body;
184
+ if (isFormElement(target)) {
185
+ // When grabbing the action from the element, it will have had the basename
186
+ // prefixed to ensure non-JS scenarios work, so strip it since we'll
187
+ // re-prefix in the router
188
+ let attr = target.getAttribute("action");
189
+ action = attr ? router.stripBasename(attr, basename) : null;
190
+ method = target.getAttribute("method") || defaultMethod;
191
+ encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
192
+ formData = new FormData(target);
193
+ } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
194
+ let form = target.form;
195
+ if (form == null) {
196
+ throw new Error("Cannot submit a <button> or <input type=\"submit\"> without a <form>");
197
+ }
198
+
199
+ // <button>/<input type="submit"> may override attributes of <form>
200
+
201
+ // When grabbing the action from the element, it will have had the basename
202
+ // prefixed to ensure non-JS scenarios work, so strip it since we'll
203
+ // re-prefix in the router
204
+ let attr = target.getAttribute("formaction") || form.getAttribute("action");
205
+ action = attr ? router.stripBasename(attr, basename) : null;
206
+ method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
207
+ encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
208
+
209
+ // Build a FormData object populated from a form and submitter
210
+ formData = new FormData(form, target);
211
+
212
+ // If this browser doesn't support the `FormData(el, submitter)` format,
213
+ // then tack on the submitter value at the end. This is a lightweight
214
+ // solution that is not 100% spec compliant. For complete support in older
215
+ // browsers, consider using the `formdata-submitter-polyfill` package
216
+ if (!isFormDataSubmitterSupported()) {
217
+ let {
218
+ name,
219
+ type,
220
+ value
221
+ } = target;
222
+ if (type === "image") {
223
+ let prefix = name ? name + "." : "";
224
+ formData.append(prefix + "x", "0");
225
+ formData.append(prefix + "y", "0");
226
+ } else if (name) {
227
+ formData.append(name, value);
228
+ }
229
+ }
230
+ } else if (isHtmlElement(target)) {
231
+ throw new Error("Cannot submit element that is not <form>, <button>, or " + "<input type=\"submit|image\">");
232
+ } else {
233
+ method = defaultMethod;
234
+ action = null;
235
+ encType = defaultEncType;
236
+ body = target;
237
+ }
238
+
239
+ // Send body for <Form encType="text/plain" so we encode it into text
240
+ if (formData && encType === "text/plain") {
241
+ body = formData;
242
+ formData = undefined;
243
+ }
244
+ return {
245
+ action,
246
+ method: method.toLowerCase(),
247
+ encType,
248
+ formData,
249
+ body
250
+ };
251
+ }
252
+
253
+ const _excluded = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset", "viewTransition"],
254
+ _excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "viewTransition", "children"],
255
+ _excluded3 = ["fetcherKey", "navigate", "reloadDocument", "replace", "state", "method", "action", "onSubmit", "relative", "preventScrollReset", "viewTransition"];
256
+ //#endregion
257
+
258
+ // HEY YOU! DON'T TOUCH THIS VARIABLE!
259
+ //
260
+ // It is replaced with the proper version at build time via a babel plugin in
261
+ // the rollup config.
262
+ //
263
+ // Export a global property onto the window for React Router detection by the
264
+ // Core Web Vitals Technology Report. This way they can configure the `wappalyzer`
265
+ // to detect and properly classify live websites as being built with React Router:
266
+ // https://github.com/HTTPArchive/wappalyzer/blob/main/src/technologies/r.json
267
+ const REACT_ROUTER_VERSION = "0";
268
+ try {
269
+ window.__reactRouterVersion = REACT_ROUTER_VERSION;
270
+ } catch (e) {
271
+ // no-op
272
+ }
273
+
274
+ ////////////////////////////////////////////////////////////////////////////////
275
+ //#region Routers
276
+ ////////////////////////////////////////////////////////////////////////////////
277
+ function createBrowserRouter(routes, opts) {
278
+ return router.createRouter({
279
+ basename: opts == null ? void 0 : opts.basename,
280
+ future: _extends({}, opts == null ? void 0 : opts.future, {
281
+ v7_prependBasename: true
282
+ }),
283
+ history: router.createBrowserHistory({
284
+ window: opts == null ? void 0 : opts.window
285
+ }),
286
+ hydrationData: (opts == null ? void 0 : opts.hydrationData) || parseHydrationData(),
287
+ routes,
288
+ mapRouteProperties: reactRouter.UNSAFE_mapRouteProperties,
289
+ dataStrategy: opts == null ? void 0 : opts.dataStrategy,
290
+ patchRoutesOnNavigation: opts == null ? void 0 : opts.patchRoutesOnNavigation,
291
+ window: opts == null ? void 0 : opts.window
292
+ }).initialize();
293
+ }
294
+ function createHashRouter(routes, opts) {
295
+ return router.createRouter({
296
+ basename: opts == null ? void 0 : opts.basename,
297
+ future: _extends({}, opts == null ? void 0 : opts.future, {
298
+ v7_prependBasename: true
299
+ }),
300
+ history: router.createHashHistory({
301
+ window: opts == null ? void 0 : opts.window
302
+ }),
303
+ hydrationData: (opts == null ? void 0 : opts.hydrationData) || parseHydrationData(),
304
+ routes,
305
+ mapRouteProperties: reactRouter.UNSAFE_mapRouteProperties,
306
+ dataStrategy: opts == null ? void 0 : opts.dataStrategy,
307
+ patchRoutesOnNavigation: opts == null ? void 0 : opts.patchRoutesOnNavigation,
308
+ window: opts == null ? void 0 : opts.window
309
+ }).initialize();
310
+ }
311
+ function parseHydrationData() {
312
+ var _window;
313
+ let state = (_window = window) == null ? void 0 : _window.__staticRouterHydrationData;
314
+ if (state && state.errors) {
315
+ state = _extends({}, state, {
316
+ errors: deserializeErrors(state.errors)
317
+ });
318
+ }
319
+ return state;
320
+ }
321
+ function deserializeErrors(errors) {
322
+ if (!errors) return null;
323
+ let entries = Object.entries(errors);
324
+ let serialized = {};
325
+ for (let [key, val] of entries) {
326
+ // Hey you! If you change this, please change the corresponding logic in
327
+ // serializeErrors in react-router-dom/server.tsx :)
328
+ if (val && val.__type === "RouteErrorResponse") {
329
+ serialized[key] = new router.UNSAFE_ErrorResponseImpl(val.status, val.statusText, val.data, val.internal === true);
330
+ } else if (val && val.__type === "Error") {
331
+ // Attempt to reconstruct the right type of Error (i.e., ReferenceError)
332
+ if (val.__subType) {
333
+ let ErrorConstructor = window[val.__subType];
334
+ if (typeof ErrorConstructor === "function") {
335
+ try {
336
+ // @ts-expect-error
337
+ let error = new ErrorConstructor(val.message);
338
+ // Wipe away the client-side stack trace. Nothing to fill it in with
339
+ // because we don't serialize SSR stack traces for security reasons
340
+ error.stack = "";
341
+ serialized[key] = error;
342
+ } catch (e) {
343
+ // no-op - fall through and create a normal Error
344
+ }
345
+ }
346
+ }
347
+ if (serialized[key] == null) {
348
+ let error = new Error(val.message);
349
+ // Wipe away the client-side stack trace. Nothing to fill it in with
350
+ // because we don't serialize SSR stack traces for security reasons
351
+ error.stack = "";
352
+ serialized[key] = error;
353
+ }
354
+ } else {
355
+ serialized[key] = val;
356
+ }
357
+ }
358
+ return serialized;
359
+ }
360
+
361
+ //#endregion
362
+
363
+ ////////////////////////////////////////////////////////////////////////////////
364
+ //#region Contexts
365
+ ////////////////////////////////////////////////////////////////////////////////
366
+ const ViewTransitionContext = /*#__PURE__*/React__namespace.createContext({
367
+ isTransitioning: false
368
+ });
369
+ {
370
+ ViewTransitionContext.displayName = "ViewTransition";
371
+ }
372
+
373
+ // TODO: (v7) Change the useFetcher data from `any` to `unknown`
374
+
375
+ const FetchersContext = /*#__PURE__*/React__namespace.createContext(new Map());
376
+ {
377
+ FetchersContext.displayName = "Fetchers";
378
+ }
379
+
380
+ //#endregion
381
+
382
+ ////////////////////////////////////////////////////////////////////////////////
383
+ //#region Components
384
+ ////////////////////////////////////////////////////////////////////////////////
385
+
386
+ /**
387
+ Webpack + React 17 fails to compile on any of the following because webpack
388
+ complains that `startTransition` doesn't exist in `React`:
389
+ * import { startTransition } from "react"
390
+ * import * as React from from "react";
391
+ "startTransition" in React ? React.startTransition(() => setState()) : setState()
392
+ * import * as React from from "react";
393
+ "startTransition" in React ? React["startTransition"](() => setState()) : setState()
394
+
395
+ Moving it to a constant such as the following solves the Webpack/React 17 issue:
396
+ * import * as React from from "react";
397
+ const START_TRANSITION = "startTransition";
398
+ START_TRANSITION in React ? React[START_TRANSITION](() => setState()) : setState()
399
+
400
+ However, that introduces webpack/terser minification issues in production builds
401
+ in React 18 where minification/obfuscation ends up removing the call of
402
+ React.startTransition entirely from the first half of the ternary. Grabbing
403
+ this exported reference once up front resolves that issue.
404
+
405
+ See https://github.com/remix-run/react-router/issues/10579
406
+ */
407
+ const START_TRANSITION = "startTransition";
408
+ const startTransitionImpl = React__namespace[START_TRANSITION];
409
+ const FLUSH_SYNC = "flushSync";
410
+ const flushSyncImpl = ReactDOM__namespace[FLUSH_SYNC];
411
+ const USE_ID = "useId";
412
+ const useIdImpl = React__namespace[USE_ID];
413
+ function startTransitionSafe(cb) {
414
+ if (startTransitionImpl) {
415
+ startTransitionImpl(cb);
416
+ } else {
417
+ cb();
418
+ }
419
+ }
420
+ function flushSyncSafe(cb) {
421
+ if (flushSyncImpl) {
422
+ flushSyncImpl(cb);
423
+ } else {
424
+ cb();
425
+ }
426
+ }
427
+ class Deferred {
428
+ // @ts-expect-error - no initializer
429
+
430
+ // @ts-expect-error - no initializer
431
+
432
+ constructor() {
433
+ this.status = "pending";
434
+ this.promise = new Promise((resolve, reject) => {
435
+ this.resolve = value => {
436
+ if (this.status === "pending") {
437
+ this.status = "resolved";
438
+ resolve(value);
439
+ }
440
+ };
441
+ this.reject = reason => {
442
+ if (this.status === "pending") {
443
+ this.status = "rejected";
444
+ reject(reason);
445
+ }
446
+ };
447
+ });
448
+ }
449
+ }
450
+
451
+ /**
452
+ * Given a Remix Router instance, render the appropriate UI
453
+ */
454
+ function RouterProvider(_ref) {
455
+ let {
456
+ fallbackElement,
457
+ router: router$1,
458
+ future
459
+ } = _ref;
460
+ let [state, setStateImpl] = React__namespace.useState(router$1.state);
461
+ let [pendingState, setPendingState] = React__namespace.useState();
462
+ let [vtContext, setVtContext] = React__namespace.useState({
463
+ isTransitioning: false
464
+ });
465
+ let [renderDfd, setRenderDfd] = React__namespace.useState();
466
+ let [transition, setTransition] = React__namespace.useState();
467
+ let [interruption, setInterruption] = React__namespace.useState();
468
+ let fetcherData = React__namespace.useRef(new Map());
469
+ let {
470
+ v7_startTransition
471
+ } = future || {};
472
+ let optInStartTransition = React__namespace.useCallback(cb => {
473
+ if (v7_startTransition) {
474
+ startTransitionSafe(cb);
475
+ } else {
476
+ cb();
477
+ }
478
+ }, [v7_startTransition]);
479
+ let setState = React__namespace.useCallback((newState, _ref2) => {
480
+ let {
481
+ deletedFetchers,
482
+ flushSync,
483
+ viewTransitionOpts
484
+ } = _ref2;
485
+ newState.fetchers.forEach((fetcher, key) => {
486
+ if (fetcher.data !== undefined) {
487
+ fetcherData.current.set(key, fetcher.data);
488
+ }
489
+ });
490
+ deletedFetchers.forEach(key => fetcherData.current.delete(key));
491
+ let isViewTransitionUnavailable = router$1.window == null || router$1.window.document == null || typeof router$1.window.document.startViewTransition !== "function";
492
+
493
+ // If this isn't a view transition or it's not available in this browser,
494
+ // just update and be done with it
495
+ if (!viewTransitionOpts || isViewTransitionUnavailable) {
496
+ renderDfd == null ? void 0 : renderDfd.resolve();
497
+ transition == null ? void 0 : transition.skipTransition();
498
+ if (flushSync) {
499
+ flushSyncSafe(() => {
500
+ setStateImpl(newState);
501
+ setRenderDfd(undefined);
502
+ setTransition(undefined);
503
+ setPendingState(undefined);
504
+ setVtContext({
505
+ isTransitioning: false
506
+ });
507
+ });
508
+ } else {
509
+ optInStartTransition(() => {
510
+ setStateImpl(newState);
511
+ setRenderDfd(undefined);
512
+ setTransition(undefined);
513
+ setPendingState(undefined);
514
+ setVtContext({
515
+ isTransitioning: false
516
+ });
517
+ });
518
+ }
519
+ return;
520
+ }
521
+
522
+ // flushSync + startViewTransition
523
+ if (flushSync) {
524
+ // Flush through the context to mark DOM elements as transition=ing
525
+ flushSyncSafe(() => {
526
+ // Cancel any pending transitions
527
+ if (transition) {
528
+ renderDfd && renderDfd.resolve();
529
+ transition.skipTransition();
530
+ }
531
+ setVtContext({
532
+ isTransitioning: true,
533
+ flushSync: true,
534
+ currentLocation: viewTransitionOpts.currentLocation,
535
+ nextLocation: viewTransitionOpts.nextLocation
536
+ });
537
+ });
538
+
539
+ // Update the DOM
540
+ let t = router$1.window.document.startViewTransition(() => {
541
+ flushSyncSafe(() => setStateImpl(newState));
542
+ });
543
+
544
+ // Clean up after the animation completes
545
+ t.finished.finally(() => {
546
+ flushSyncSafe(() => {
547
+ setRenderDfd(undefined);
548
+ setTransition(undefined);
549
+ setPendingState(undefined);
550
+ setVtContext({
551
+ isTransitioning: false
552
+ });
553
+ });
554
+ });
555
+ flushSyncSafe(() => setTransition(t));
556
+ return;
557
+ }
558
+
559
+ // startTransition + startViewTransition
560
+ if (transition) {
561
+ // Interrupting an in-progress transition, cancel and let everything flush
562
+ // out, and then kick off a new transition from the interruption state
563
+ renderDfd && renderDfd.resolve();
564
+ transition.skipTransition();
565
+ setInterruption({
566
+ state: newState,
567
+ currentLocation: viewTransitionOpts.currentLocation,
568
+ nextLocation: viewTransitionOpts.nextLocation
569
+ });
570
+ } else {
571
+ // Completed navigation update with opted-in view transitions, let 'er rip
572
+ setPendingState(newState);
573
+ setVtContext({
574
+ isTransitioning: true,
575
+ flushSync: false,
576
+ currentLocation: viewTransitionOpts.currentLocation,
577
+ nextLocation: viewTransitionOpts.nextLocation
578
+ });
579
+ }
580
+ }, [router$1.window, transition, renderDfd, optInStartTransition]);
581
+
582
+ // Need to use a layout effect here so we are subscribed early enough to
583
+ // pick up on any render-driven redirects/navigations (useEffect/<Navigate>)
584
+ React__namespace.useLayoutEffect(() => router$1.subscribe(setState), [router$1, setState]);
585
+
586
+ // When we start a view transition, create a Deferred we can use for the
587
+ // eventual "completed" render
588
+ React__namespace.useEffect(() => {
589
+ if (vtContext.isTransitioning && !vtContext.flushSync) {
590
+ setRenderDfd(new Deferred());
591
+ }
592
+ }, [vtContext]);
593
+
594
+ // Once the deferred is created, kick off startViewTransition() to update the
595
+ // DOM and then wait on the Deferred to resolve (indicating the DOM update has
596
+ // happened)
597
+ React__namespace.useEffect(() => {
598
+ if (renderDfd && pendingState && router$1.window) {
599
+ let newState = pendingState;
600
+ let renderPromise = renderDfd.promise;
601
+ let transition = router$1.window.document.startViewTransition(async () => {
602
+ optInStartTransition(() => setStateImpl(newState));
603
+ await renderPromise;
604
+ });
605
+ transition.finished.finally(() => {
606
+ setRenderDfd(undefined);
607
+ setTransition(undefined);
608
+ setPendingState(undefined);
609
+ setVtContext({
610
+ isTransitioning: false
611
+ });
612
+ });
613
+ setTransition(transition);
614
+ }
615
+ }, [optInStartTransition, pendingState, renderDfd, router$1.window]);
616
+
617
+ // When the new location finally renders and is committed to the DOM, this
618
+ // effect will run to resolve the transition
619
+ React__namespace.useEffect(() => {
620
+ if (renderDfd && pendingState && state.location.key === pendingState.location.key) {
621
+ renderDfd.resolve();
622
+ }
623
+ }, [renderDfd, transition, state.location, pendingState]);
624
+
625
+ // If we get interrupted with a new navigation during a transition, we skip
626
+ // the active transition, let it cleanup, then kick it off again here
627
+ React__namespace.useEffect(() => {
628
+ if (!vtContext.isTransitioning && interruption) {
629
+ setPendingState(interruption.state);
630
+ setVtContext({
631
+ isTransitioning: true,
632
+ flushSync: false,
633
+ currentLocation: interruption.currentLocation,
634
+ nextLocation: interruption.nextLocation
635
+ });
636
+ setInterruption(undefined);
637
+ }
638
+ }, [vtContext.isTransitioning, interruption]);
639
+ React__namespace.useEffect(() => {
640
+ router.UNSAFE_warning(fallbackElement == null || !router$1.future.v7_partialHydration, "`<RouterProvider fallbackElement>` is deprecated when using " + "`v7_partialHydration`, use a `HydrateFallback` component instead") ;
641
+ // Only log this once on initial mount
642
+ // eslint-disable-next-line react-hooks/exhaustive-deps
643
+ }, []);
644
+ let navigator = React__namespace.useMemo(() => {
645
+ return {
646
+ createHref: router$1.createHref,
647
+ encodeLocation: router$1.encodeLocation,
648
+ go: n => router$1.navigate(n),
649
+ push: (to, state, opts) => router$1.navigate(to, {
650
+ state,
651
+ preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
652
+ }),
653
+ replace: (to, state, opts) => router$1.navigate(to, {
654
+ replace: true,
655
+ state,
656
+ preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
657
+ })
658
+ };
659
+ }, [router$1]);
660
+ let basename = router$1.basename || "/";
661
+ let dataRouterContext = React__namespace.useMemo(() => ({
662
+ router: router$1,
663
+ navigator,
664
+ static: false,
665
+ basename
666
+ }), [router$1, navigator, basename]);
667
+ let routerFuture = React__namespace.useMemo(() => ({
668
+ v7_relativeSplatPath: router$1.future.v7_relativeSplatPath
669
+ }), [router$1.future.v7_relativeSplatPath]);
670
+ React__namespace.useEffect(() => reactRouter.UNSAFE_logV6DeprecationWarnings(future, router$1.future), [future, router$1.future]);
671
+
672
+ // The fragment and {null} here are important! We need them to keep React 18's
673
+ // useId happy when we are server-rendering since we may have a <script> here
674
+ // containing the hydrated server-side staticContext (from StaticRouterProvider).
675
+ // useId relies on the component tree structure to generate deterministic id's
676
+ // so we need to ensure it remains the same on the client even though
677
+ // we don't need the <script> tag
678
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(reactRouter.UNSAFE_DataRouterContext.Provider, {
679
+ value: dataRouterContext
680
+ }, /*#__PURE__*/React__namespace.createElement(reactRouter.UNSAFE_DataRouterStateContext.Provider, {
681
+ value: state
682
+ }, /*#__PURE__*/React__namespace.createElement(FetchersContext.Provider, {
683
+ value: fetcherData.current
684
+ }, /*#__PURE__*/React__namespace.createElement(ViewTransitionContext.Provider, {
685
+ value: vtContext
686
+ }, /*#__PURE__*/React__namespace.createElement(reactRouter.Router, {
687
+ basename: basename,
688
+ location: state.location,
689
+ navigationType: state.historyAction,
690
+ navigator: navigator,
691
+ future: routerFuture
692
+ }, state.initialized || router$1.future.v7_partialHydration ? /*#__PURE__*/React__namespace.createElement(MemoizedDataRoutes, {
693
+ routes: router$1.routes,
694
+ future: router$1.future,
695
+ state: state
696
+ }) : fallbackElement))))), null);
697
+ }
698
+
699
+ // Memoize to avoid re-renders when updating `ViewTransitionContext`
700
+ const MemoizedDataRoutes = /*#__PURE__*/React__namespace.memo(DataRoutes);
701
+ function DataRoutes(_ref3) {
702
+ let {
703
+ routes,
704
+ future,
705
+ state
706
+ } = _ref3;
707
+ return reactRouter.UNSAFE_useRoutesImpl(routes, undefined, state, future);
708
+ }
709
+ /**
710
+ * A `<Router>` for use in web browsers. Provides the cleanest URLs.
711
+ */
712
+ function BrowserRouter(_ref4) {
713
+ let {
714
+ basename,
715
+ children,
716
+ future,
717
+ window
718
+ } = _ref4;
719
+ let historyRef = React__namespace.useRef();
720
+ if (historyRef.current == null) {
721
+ historyRef.current = router.createBrowserHistory({
722
+ window,
723
+ v5Compat: true
724
+ });
725
+ }
726
+ let history = historyRef.current;
727
+ let [state, setStateImpl] = React__namespace.useState({
728
+ action: history.action,
729
+ location: history.location
730
+ });
731
+ let {
732
+ v7_startTransition
733
+ } = future || {};
734
+ let setState = React__namespace.useCallback(newState => {
735
+ v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);
736
+ }, [setStateImpl, v7_startTransition]);
737
+ React__namespace.useLayoutEffect(() => history.listen(setState), [history, setState]);
738
+ React__namespace.useEffect(() => reactRouter.UNSAFE_logV6DeprecationWarnings(future), [future]);
739
+ return /*#__PURE__*/React__namespace.createElement(reactRouter.Router, {
740
+ basename: basename,
741
+ children: children,
742
+ location: state.location,
743
+ navigationType: state.action,
744
+ navigator: history,
745
+ future: future
746
+ });
747
+ }
748
+ /**
749
+ * A `<Router>` for use in web browsers. Stores the location in the hash
750
+ * portion of the URL so it is not sent to the server.
751
+ */
752
+ function HashRouter(_ref5) {
753
+ let {
754
+ basename,
755
+ children,
756
+ future,
757
+ window
758
+ } = _ref5;
759
+ let historyRef = React__namespace.useRef();
760
+ if (historyRef.current == null) {
761
+ historyRef.current = router.createHashHistory({
762
+ window,
763
+ v5Compat: true
764
+ });
765
+ }
766
+ let history = historyRef.current;
767
+ let [state, setStateImpl] = React__namespace.useState({
768
+ action: history.action,
769
+ location: history.location
770
+ });
771
+ let {
772
+ v7_startTransition
773
+ } = future || {};
774
+ let setState = React__namespace.useCallback(newState => {
775
+ v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);
776
+ }, [setStateImpl, v7_startTransition]);
777
+ React__namespace.useLayoutEffect(() => history.listen(setState), [history, setState]);
778
+ React__namespace.useEffect(() => reactRouter.UNSAFE_logV6DeprecationWarnings(future), [future]);
779
+ return /*#__PURE__*/React__namespace.createElement(reactRouter.Router, {
780
+ basename: basename,
781
+ children: children,
782
+ location: state.location,
783
+ navigationType: state.action,
784
+ navigator: history,
785
+ future: future
786
+ });
787
+ }
788
+ /**
789
+ * A `<Router>` that accepts a pre-instantiated history object. It's important
790
+ * to note that using your own history object is highly discouraged and may add
791
+ * two versions of the history library to your bundles unless you use the same
792
+ * version of the history library that React Router uses internally.
793
+ */
794
+ function HistoryRouter(_ref6) {
795
+ let {
796
+ basename,
797
+ children,
798
+ future,
799
+ history
800
+ } = _ref6;
801
+ let [state, setStateImpl] = React__namespace.useState({
802
+ action: history.action,
803
+ location: history.location
804
+ });
805
+ let {
806
+ v7_startTransition
807
+ } = future || {};
808
+ let setState = React__namespace.useCallback(newState => {
809
+ v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);
810
+ }, [setStateImpl, v7_startTransition]);
811
+ React__namespace.useLayoutEffect(() => history.listen(setState), [history, setState]);
812
+ React__namespace.useEffect(() => reactRouter.UNSAFE_logV6DeprecationWarnings(future), [future]);
813
+ return /*#__PURE__*/React__namespace.createElement(reactRouter.Router, {
814
+ basename: basename,
815
+ children: children,
816
+ location: state.location,
817
+ navigationType: state.action,
818
+ navigator: history,
819
+ future: future
820
+ });
821
+ }
822
+ {
823
+ HistoryRouter.displayName = "unstable_HistoryRouter";
824
+ }
825
+ const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
826
+ const ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
827
+
828
+ /**
829
+ * The public API for rendering a history-aware `<a>`.
830
+ */
831
+ const Link = /*#__PURE__*/React__namespace.forwardRef(function LinkWithRef(_ref7, ref) {
832
+ let {
833
+ onClick,
834
+ relative,
835
+ reloadDocument,
836
+ replace,
837
+ state,
838
+ target,
839
+ to,
840
+ preventScrollReset,
841
+ viewTransition
842
+ } = _ref7,
843
+ rest = _objectWithoutPropertiesLoose(_ref7, _excluded);
844
+ let {
845
+ basename
846
+ } = React__namespace.useContext(reactRouter.UNSAFE_NavigationContext);
847
+
848
+ // Rendered into <a href> for absolute URLs
849
+ let absoluteHref;
850
+ let isExternal = false;
851
+ if (typeof to === "string" && ABSOLUTE_URL_REGEX.test(to)) {
852
+ // Render the absolute href server- and client-side
853
+ absoluteHref = to;
854
+
855
+ // Only check for external origins client-side
856
+ if (isBrowser) {
857
+ try {
858
+ let currentUrl = new URL(window.location.href);
859
+ let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
860
+ let path = router.stripBasename(targetUrl.pathname, basename);
861
+ if (targetUrl.origin === currentUrl.origin && path != null) {
862
+ // Strip the protocol/origin/basename for same-origin absolute URLs
863
+ to = path + targetUrl.search + targetUrl.hash;
864
+ } else {
865
+ isExternal = true;
866
+ }
867
+ } catch (e) {
868
+ // We can't do external URL detection without a valid URL
869
+ router.UNSAFE_warning(false, "<Link to=\"" + to + "\"> contains an invalid URL which will probably break " + "when clicked - please update to a valid URL path.") ;
870
+ }
871
+ }
872
+ }
873
+
874
+ // Rendered into <a href> for relative URLs
875
+ let href = reactRouter.useHref(to, {
876
+ relative
877
+ });
878
+ let internalOnClick = useLinkClickHandler(to, {
879
+ replace,
880
+ state,
881
+ target,
882
+ preventScrollReset,
883
+ relative,
884
+ viewTransition
885
+ });
886
+ function handleClick(event) {
887
+ if (onClick) onClick(event);
888
+ if (!event.defaultPrevented) {
889
+ internalOnClick(event);
890
+ }
891
+ }
892
+ return (
893
+ /*#__PURE__*/
894
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
895
+ React__namespace.createElement("a", _extends({}, rest, {
896
+ href: absoluteHref || href,
897
+ onClick: isExternal || reloadDocument ? onClick : handleClick,
898
+ ref: ref,
899
+ target: target
900
+ }))
901
+ );
902
+ });
903
+ {
904
+ Link.displayName = "Link";
905
+ }
906
+ /**
907
+ * A `<Link>` wrapper that knows if it's "active" or not.
908
+ */
909
+ const NavLink = /*#__PURE__*/React__namespace.forwardRef(function NavLinkWithRef(_ref8, ref) {
910
+ let {
911
+ "aria-current": ariaCurrentProp = "page",
912
+ caseSensitive = false,
913
+ className: classNameProp = "",
914
+ end = false,
915
+ style: styleProp,
916
+ to,
917
+ viewTransition,
918
+ children
919
+ } = _ref8,
920
+ rest = _objectWithoutPropertiesLoose(_ref8, _excluded2);
921
+ let path = reactRouter.useResolvedPath(to, {
922
+ relative: rest.relative
923
+ });
924
+ let location = reactRouter.useLocation();
925
+ let routerState = React__namespace.useContext(reactRouter.UNSAFE_DataRouterStateContext);
926
+ let {
927
+ navigator,
928
+ basename
929
+ } = React__namespace.useContext(reactRouter.UNSAFE_NavigationContext);
930
+ let isTransitioning = routerState != null &&
931
+ // Conditional usage is OK here because the usage of a data router is static
932
+ // eslint-disable-next-line react-hooks/rules-of-hooks
933
+ useViewTransitionState(path) && viewTransition === true;
934
+ let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
935
+ let locationPathname = location.pathname;
936
+ let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
937
+ if (!caseSensitive) {
938
+ locationPathname = locationPathname.toLowerCase();
939
+ nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
940
+ toPathname = toPathname.toLowerCase();
941
+ }
942
+ if (nextLocationPathname && basename) {
943
+ nextLocationPathname = router.stripBasename(nextLocationPathname, basename) || nextLocationPathname;
944
+ }
945
+
946
+ // If the `to` has a trailing slash, look at that exact spot. Otherwise,
947
+ // we're looking for a slash _after_ what's in `to`. For example:
948
+ //
949
+ // <NavLink to="/users"> and <NavLink to="/users/">
950
+ // both want to look for a / at index 6 to match URL `/users/matt`
951
+ const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
952
+ let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
953
+ let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
954
+ let renderProps = {
955
+ isActive,
956
+ isPending,
957
+ isTransitioning
958
+ };
959
+ let ariaCurrent = isActive ? ariaCurrentProp : undefined;
960
+ let className;
961
+ if (typeof classNameProp === "function") {
962
+ className = classNameProp(renderProps);
963
+ } else {
964
+ // If the className prop is not a function, we use a default `active`
965
+ // class for <NavLink />s that are active. In v5 `active` was the default
966
+ // value for `activeClassName`, but we are removing that API and can still
967
+ // use the old default behavior for a cleaner upgrade path and keep the
968
+ // simple styling rules working as they currently do.
969
+ className = [classNameProp, isActive ? "active" : null, isPending ? "pending" : null, isTransitioning ? "transitioning" : null].filter(Boolean).join(" ");
970
+ }
971
+ let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
972
+ return /*#__PURE__*/React__namespace.createElement(Link, _extends({}, rest, {
973
+ "aria-current": ariaCurrent,
974
+ className: className,
975
+ ref: ref,
976
+ style: style,
977
+ to: to,
978
+ viewTransition: viewTransition
979
+ }), typeof children === "function" ? children(renderProps) : children);
980
+ });
981
+ {
982
+ NavLink.displayName = "NavLink";
983
+ }
984
+
985
+ /**
986
+ * Form props shared by navigations and fetchers
987
+ */
988
+
989
+ /**
990
+ * Form props available to fetchers
991
+ */
992
+
993
+ /**
994
+ * Form props available to navigations
995
+ */
996
+
997
+ /**
998
+ * A `@remix-run/router`-aware `<form>`. It behaves like a normal form except
999
+ * that the interaction with the server is with `fetch` instead of new document
1000
+ * requests, allowing components to add nicer UX to the page as the form is
1001
+ * submitted and returns with data.
1002
+ */
1003
+ const Form = /*#__PURE__*/React__namespace.forwardRef((_ref9, forwardedRef) => {
1004
+ let {
1005
+ fetcherKey,
1006
+ navigate,
1007
+ reloadDocument,
1008
+ replace,
1009
+ state,
1010
+ method = defaultMethod,
1011
+ action,
1012
+ onSubmit,
1013
+ relative,
1014
+ preventScrollReset,
1015
+ viewTransition
1016
+ } = _ref9,
1017
+ props = _objectWithoutPropertiesLoose(_ref9, _excluded3);
1018
+ let submit = useSubmit();
1019
+ let formAction = useFormAction(action, {
1020
+ relative
1021
+ });
1022
+ let formMethod = method.toLowerCase() === "get" ? "get" : "post";
1023
+ let submitHandler = event => {
1024
+ onSubmit && onSubmit(event);
1025
+ if (event.defaultPrevented) return;
1026
+ event.preventDefault();
1027
+ let submitter = event.nativeEvent.submitter;
1028
+ let submitMethod = (submitter == null ? void 0 : submitter.getAttribute("formmethod")) || method;
1029
+ submit(submitter || event.currentTarget, {
1030
+ fetcherKey,
1031
+ method: submitMethod,
1032
+ navigate,
1033
+ replace,
1034
+ state,
1035
+ relative,
1036
+ preventScrollReset,
1037
+ viewTransition
1038
+ });
1039
+ };
1040
+ return /*#__PURE__*/React__namespace.createElement("form", _extends({
1041
+ ref: forwardedRef,
1042
+ method: formMethod,
1043
+ action: formAction,
1044
+ onSubmit: reloadDocument ? onSubmit : submitHandler
1045
+ }, props));
1046
+ });
1047
+ {
1048
+ Form.displayName = "Form";
1049
+ }
1050
+ /**
1051
+ * This component will emulate the browser's scroll restoration on location
1052
+ * changes.
1053
+ */
1054
+ function ScrollRestoration(_ref10) {
1055
+ let {
1056
+ getKey,
1057
+ storageKey
1058
+ } = _ref10;
1059
+ useScrollRestoration({
1060
+ getKey,
1061
+ storageKey
1062
+ });
1063
+ return null;
1064
+ }
1065
+ {
1066
+ ScrollRestoration.displayName = "ScrollRestoration";
1067
+ }
1068
+ //#endregion
1069
+
1070
+ ////////////////////////////////////////////////////////////////////////////////
1071
+ //#region Hooks
1072
+ ////////////////////////////////////////////////////////////////////////////////
1073
+ var DataRouterHook = /*#__PURE__*/function (DataRouterHook) {
1074
+ DataRouterHook["UseScrollRestoration"] = "useScrollRestoration";
1075
+ DataRouterHook["UseSubmit"] = "useSubmit";
1076
+ DataRouterHook["UseSubmitFetcher"] = "useSubmitFetcher";
1077
+ DataRouterHook["UseFetcher"] = "useFetcher";
1078
+ DataRouterHook["useViewTransitionState"] = "useViewTransitionState";
1079
+ return DataRouterHook;
1080
+ }(DataRouterHook || {});
1081
+ var DataRouterStateHook = /*#__PURE__*/function (DataRouterStateHook) {
1082
+ DataRouterStateHook["UseFetcher"] = "useFetcher";
1083
+ DataRouterStateHook["UseFetchers"] = "useFetchers";
1084
+ DataRouterStateHook["UseScrollRestoration"] = "useScrollRestoration";
1085
+ return DataRouterStateHook;
1086
+ }(DataRouterStateHook || {}); // Internal hooks
1087
+ function getDataRouterConsoleError(hookName) {
1088
+ return hookName + " must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.";
1089
+ }
1090
+ function useDataRouterContext(hookName) {
1091
+ let ctx = React__namespace.useContext(reactRouter.UNSAFE_DataRouterContext);
1092
+ !ctx ? router.UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : void 0;
1093
+ return ctx;
1094
+ }
1095
+ function useDataRouterState(hookName) {
1096
+ let state = React__namespace.useContext(reactRouter.UNSAFE_DataRouterStateContext);
1097
+ !state ? router.UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : void 0;
1098
+ return state;
1099
+ }
1100
+
1101
+ // External hooks
1102
+
1103
+ /**
1104
+ * Handles the click behavior for router `<Link>` components. This is useful if
1105
+ * you need to create custom `<Link>` components with the same click behavior we
1106
+ * use in our exported `<Link>`.
1107
+ */
1108
+ function useLinkClickHandler(to, _temp) {
1109
+ let {
1110
+ target,
1111
+ replace: replaceProp,
1112
+ state,
1113
+ preventScrollReset,
1114
+ relative,
1115
+ viewTransition
1116
+ } = _temp === void 0 ? {} : _temp;
1117
+ let navigate = reactRouter.useNavigate();
1118
+ let location = reactRouter.useLocation();
1119
+ let path = reactRouter.useResolvedPath(to, {
1120
+ relative
1121
+ });
1122
+ return React__namespace.useCallback(event => {
1123
+ if (shouldProcessLinkClick(event, target)) {
1124
+ event.preventDefault();
1125
+
1126
+ // If the URL hasn't changed, a regular <a> will do a replace instead of
1127
+ // a push, so do the same here unless the replace prop is explicitly set
1128
+ let replace = replaceProp !== undefined ? replaceProp : reactRouter.createPath(location) === reactRouter.createPath(path);
1129
+ navigate(to, {
1130
+ replace,
1131
+ state,
1132
+ preventScrollReset,
1133
+ relative,
1134
+ viewTransition
1135
+ });
1136
+ }
1137
+ }, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative, viewTransition]);
1138
+ }
1139
+
1140
+ /**
1141
+ * A convenient wrapper for reading and writing search parameters via the
1142
+ * URLSearchParams interface.
1143
+ */
1144
+ function useSearchParams(defaultInit) {
1145
+ router.UNSAFE_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.") ;
1146
+ let defaultSearchParamsRef = React__namespace.useRef(createSearchParams(defaultInit));
1147
+ let hasSetSearchParamsRef = React__namespace.useRef(false);
1148
+ let location = reactRouter.useLocation();
1149
+ let searchParams = React__namespace.useMemo(() =>
1150
+ // Only merge in the defaults if we haven't yet called setSearchParams.
1151
+ // Once we call that we want those to take precedence, otherwise you can't
1152
+ // remove a param with setSearchParams({}) if it has an initial value
1153
+ getSearchParamsForLocation(location.search, hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current), [location.search]);
1154
+ let navigate = reactRouter.useNavigate();
1155
+ let setSearchParams = React__namespace.useCallback((nextInit, navigateOptions) => {
1156
+ const newSearchParams = createSearchParams(typeof nextInit === "function" ? nextInit(searchParams) : nextInit);
1157
+ hasSetSearchParamsRef.current = true;
1158
+ navigate("?" + newSearchParams, navigateOptions);
1159
+ }, [navigate, searchParams]);
1160
+ return [searchParams, setSearchParams];
1161
+ }
1162
+
1163
+ /**
1164
+ * Submits a HTML `<form>` to the server without reloading the page.
1165
+ */
1166
+
1167
+ /**
1168
+ * Submits a fetcher `<form>` to the server without reloading the page.
1169
+ */
1170
+
1171
+ function validateClientSideSubmission() {
1172
+ if (typeof document === "undefined") {
1173
+ throw new Error("You are calling submit during the server render. " + "Try calling submit within a `useEffect` or callback instead.");
1174
+ }
1175
+ }
1176
+ let fetcherId = 0;
1177
+ let getUniqueFetcherId = () => "__" + String(++fetcherId) + "__";
1178
+
1179
+ /**
1180
+ * Returns a function that may be used to programmatically submit a form (or
1181
+ * some arbitrary data) to the server.
1182
+ */
1183
+ function useSubmit() {
1184
+ let {
1185
+ router
1186
+ } = useDataRouterContext(DataRouterHook.UseSubmit);
1187
+ let {
1188
+ basename
1189
+ } = React__namespace.useContext(reactRouter.UNSAFE_NavigationContext);
1190
+ let currentRouteId = reactRouter.UNSAFE_useRouteId();
1191
+ return React__namespace.useCallback(function (target, options) {
1192
+ if (options === void 0) {
1193
+ options = {};
1194
+ }
1195
+ validateClientSideSubmission();
1196
+ let {
1197
+ action,
1198
+ method,
1199
+ encType,
1200
+ formData,
1201
+ body
1202
+ } = getFormSubmissionInfo(target, basename);
1203
+ if (options.navigate === false) {
1204
+ let key = options.fetcherKey || getUniqueFetcherId();
1205
+ router.fetch(key, currentRouteId, options.action || action, {
1206
+ preventScrollReset: options.preventScrollReset,
1207
+ formData,
1208
+ body,
1209
+ formMethod: options.method || method,
1210
+ formEncType: options.encType || encType,
1211
+ flushSync: options.flushSync
1212
+ });
1213
+ } else {
1214
+ router.navigate(options.action || action, {
1215
+ preventScrollReset: options.preventScrollReset,
1216
+ formData,
1217
+ body,
1218
+ formMethod: options.method || method,
1219
+ formEncType: options.encType || encType,
1220
+ replace: options.replace,
1221
+ state: options.state,
1222
+ fromRouteId: currentRouteId,
1223
+ flushSync: options.flushSync,
1224
+ viewTransition: options.viewTransition
1225
+ });
1226
+ }
1227
+ }, [router, basename, currentRouteId]);
1228
+ }
1229
+
1230
+ // v7: Eventually we should deprecate this entirely in favor of using the
1231
+ // router method directly?
1232
+ function useFormAction(action, _temp2) {
1233
+ let {
1234
+ relative
1235
+ } = _temp2 === void 0 ? {} : _temp2;
1236
+ let {
1237
+ basename
1238
+ } = React__namespace.useContext(reactRouter.UNSAFE_NavigationContext);
1239
+ let routeContext = React__namespace.useContext(reactRouter.UNSAFE_RouteContext);
1240
+ !routeContext ? router.UNSAFE_invariant(false, "useFormAction must be used inside a RouteContext") : void 0;
1241
+ let [match] = routeContext.matches.slice(-1);
1242
+ // Shallow clone path so we can modify it below, otherwise we modify the
1243
+ // object referenced by useMemo inside useResolvedPath
1244
+ let path = _extends({}, reactRouter.useResolvedPath(action ? action : ".", {
1245
+ relative
1246
+ }));
1247
+
1248
+ // If no action was specified, browsers will persist current search params
1249
+ // when determining the path, so match that behavior
1250
+ // https://github.com/remix-run/remix/issues/927
1251
+ let location = reactRouter.useLocation();
1252
+ if (action == null) {
1253
+ // Safe to write to this directly here since if action was undefined, we
1254
+ // would have called useResolvedPath(".") which will never include a search
1255
+ path.search = location.search;
1256
+
1257
+ // When grabbing search params from the URL, remove any included ?index param
1258
+ // since it might not apply to our contextual route. We add it back based
1259
+ // on match.route.index below
1260
+ let params = new URLSearchParams(path.search);
1261
+ let indexValues = params.getAll("index");
1262
+ let hasNakedIndexParam = indexValues.some(v => v === "");
1263
+ if (hasNakedIndexParam) {
1264
+ params.delete("index");
1265
+ indexValues.filter(v => v).forEach(v => params.append("index", v));
1266
+ let qs = params.toString();
1267
+ path.search = qs ? "?" + qs : "";
1268
+ }
1269
+ }
1270
+ if ((!action || action === ".") && match.route.index) {
1271
+ path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
1272
+ }
1273
+
1274
+ // If we're operating within a basename, prepend it to the pathname prior
1275
+ // to creating the form action. If this is a root navigation, then just use
1276
+ // the raw basename which allows the basename to have full control over the
1277
+ // presence of a trailing slash on root actions
1278
+ if (basename !== "/") {
1279
+ path.pathname = path.pathname === "/" ? basename : router.joinPaths([basename, path.pathname]);
1280
+ }
1281
+ return reactRouter.createPath(path);
1282
+ }
1283
+ // TODO: (v7) Change the useFetcher generic default from `any` to `unknown`
1284
+ /**
1285
+ * Interacts with route loaders and actions without causing a navigation. Great
1286
+ * for any interaction that stays on the same page.
1287
+ */
1288
+ function useFetcher(_temp3) {
1289
+ var _route$matches;
1290
+ let {
1291
+ key
1292
+ } = _temp3 === void 0 ? {} : _temp3;
1293
+ let {
1294
+ router: router$1
1295
+ } = useDataRouterContext(DataRouterHook.UseFetcher);
1296
+ let state = useDataRouterState(DataRouterStateHook.UseFetcher);
1297
+ let fetcherData = React__namespace.useContext(FetchersContext);
1298
+ let route = React__namespace.useContext(reactRouter.UNSAFE_RouteContext);
1299
+ let routeId = (_route$matches = route.matches[route.matches.length - 1]) == null ? void 0 : _route$matches.route.id;
1300
+ !fetcherData ? router.UNSAFE_invariant(false, "useFetcher must be used inside a FetchersContext") : void 0;
1301
+ !route ? router.UNSAFE_invariant(false, "useFetcher must be used inside a RouteContext") : void 0;
1302
+ !(routeId != null) ? router.UNSAFE_invariant(false, "useFetcher can only be used on routes that contain a unique \"id\"") : void 0;
1303
+
1304
+ // Fetcher key handling
1305
+ // OK to call conditionally to feature detect `useId`
1306
+ // eslint-disable-next-line react-hooks/rules-of-hooks
1307
+ let defaultKey = useIdImpl ? useIdImpl() : "";
1308
+ let [fetcherKey, setFetcherKey] = React__namespace.useState(key || defaultKey);
1309
+ if (key && key !== fetcherKey) {
1310
+ setFetcherKey(key);
1311
+ } else if (!fetcherKey) {
1312
+ // We will only fall through here when `useId` is not available
1313
+ setFetcherKey(getUniqueFetcherId());
1314
+ }
1315
+
1316
+ // Registration/cleanup
1317
+ React__namespace.useEffect(() => {
1318
+ router$1.getFetcher(fetcherKey);
1319
+ return () => {
1320
+ // Tell the router we've unmounted - if v7_fetcherPersist is enabled this
1321
+ // will not delete immediately but instead queue up a delete after the
1322
+ // fetcher returns to an `idle` state
1323
+ router$1.deleteFetcher(fetcherKey);
1324
+ };
1325
+ }, [router$1, fetcherKey]);
1326
+
1327
+ // Fetcher additions
1328
+ let load = React__namespace.useCallback((href, opts) => {
1329
+ !routeId ? router.UNSAFE_invariant(false, "No routeId available for fetcher.load()") : void 0;
1330
+ router$1.fetch(fetcherKey, routeId, href, opts);
1331
+ }, [fetcherKey, routeId, router$1]);
1332
+ let submitImpl = useSubmit();
1333
+ let submit = React__namespace.useCallback((target, opts) => {
1334
+ submitImpl(target, _extends({}, opts, {
1335
+ navigate: false,
1336
+ fetcherKey
1337
+ }));
1338
+ }, [fetcherKey, submitImpl]);
1339
+ let FetcherForm = React__namespace.useMemo(() => {
1340
+ let FetcherForm = /*#__PURE__*/React__namespace.forwardRef((props, ref) => {
1341
+ return /*#__PURE__*/React__namespace.createElement(Form, _extends({}, props, {
1342
+ navigate: false,
1343
+ fetcherKey: fetcherKey,
1344
+ ref: ref
1345
+ }));
1346
+ });
1347
+ {
1348
+ FetcherForm.displayName = "fetcher.Form";
1349
+ }
1350
+ return FetcherForm;
1351
+ }, [fetcherKey]);
1352
+
1353
+ // Exposed FetcherWithComponents
1354
+ let fetcher = state.fetchers.get(fetcherKey) || router.IDLE_FETCHER;
1355
+ let data = fetcherData.get(fetcherKey);
1356
+ let fetcherWithComponents = React__namespace.useMemo(() => _extends({
1357
+ Form: FetcherForm,
1358
+ submit,
1359
+ load
1360
+ }, fetcher, {
1361
+ data
1362
+ }), [FetcherForm, submit, load, fetcher, data]);
1363
+ return fetcherWithComponents;
1364
+ }
1365
+
1366
+ /**
1367
+ * Provides all fetchers currently on the page. Useful for layouts and parent
1368
+ * routes that need to provide pending/optimistic UI regarding the fetch.
1369
+ */
1370
+ function useFetchers() {
1371
+ let state = useDataRouterState(DataRouterStateHook.UseFetchers);
1372
+ return Array.from(state.fetchers.entries()).map(_ref11 => {
1373
+ let [key, fetcher] = _ref11;
1374
+ return _extends({}, fetcher, {
1375
+ key
1376
+ });
1377
+ });
1378
+ }
1379
+ const SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions";
1380
+ let savedScrollPositions = {};
1381
+
1382
+ /**
1383
+ * When rendered inside a RouterProvider, will restore scroll positions on navigations
1384
+ */
1385
+ function useScrollRestoration(_temp4) {
1386
+ let {
1387
+ getKey,
1388
+ storageKey
1389
+ } = _temp4 === void 0 ? {} : _temp4;
1390
+ let {
1391
+ router: router$1
1392
+ } = useDataRouterContext(DataRouterHook.UseScrollRestoration);
1393
+ let {
1394
+ restoreScrollPosition,
1395
+ preventScrollReset
1396
+ } = useDataRouterState(DataRouterStateHook.UseScrollRestoration);
1397
+ let {
1398
+ basename
1399
+ } = React__namespace.useContext(reactRouter.UNSAFE_NavigationContext);
1400
+ let location = reactRouter.useLocation();
1401
+ let matches = reactRouter.useMatches();
1402
+ let navigation = reactRouter.useNavigation();
1403
+
1404
+ // Trigger manual scroll restoration while we're active
1405
+ React__namespace.useEffect(() => {
1406
+ window.history.scrollRestoration = "manual";
1407
+ return () => {
1408
+ window.history.scrollRestoration = "auto";
1409
+ };
1410
+ }, []);
1411
+
1412
+ // Save positions on pagehide
1413
+ usePageHide(React__namespace.useCallback(() => {
1414
+ if (navigation.state === "idle") {
1415
+ let key = (getKey ? getKey(location, matches) : null) || location.key;
1416
+ savedScrollPositions[key] = window.scrollY;
1417
+ }
1418
+ try {
1419
+ sessionStorage.setItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY, JSON.stringify(savedScrollPositions));
1420
+ } catch (error) {
1421
+ router.UNSAFE_warning(false, "Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (" + error + ").") ;
1422
+ }
1423
+ window.history.scrollRestoration = "auto";
1424
+ }, [storageKey, getKey, navigation.state, location, matches]));
1425
+
1426
+ // Read in any saved scroll locations
1427
+ if (typeof document !== "undefined") {
1428
+ // eslint-disable-next-line react-hooks/rules-of-hooks
1429
+ React__namespace.useLayoutEffect(() => {
1430
+ try {
1431
+ let sessionPositions = sessionStorage.getItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY);
1432
+ if (sessionPositions) {
1433
+ savedScrollPositions = JSON.parse(sessionPositions);
1434
+ }
1435
+ } catch (e) {
1436
+ // no-op, use default empty object
1437
+ }
1438
+ }, [storageKey]);
1439
+
1440
+ // Enable scroll restoration in the router
1441
+ // eslint-disable-next-line react-hooks/rules-of-hooks
1442
+ React__namespace.useLayoutEffect(() => {
1443
+ let getKeyWithoutBasename = getKey && basename !== "/" ? (location, matches) => getKey( // Strip the basename to match useLocation()
1444
+ _extends({}, location, {
1445
+ pathname: router.stripBasename(location.pathname, basename) || location.pathname
1446
+ }), matches) : getKey;
1447
+ let disableScrollRestoration = router$1 == null ? void 0 : router$1.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKeyWithoutBasename);
1448
+ return () => disableScrollRestoration && disableScrollRestoration();
1449
+ }, [router$1, basename, getKey]);
1450
+
1451
+ // Restore scrolling when state.restoreScrollPosition changes
1452
+ // eslint-disable-next-line react-hooks/rules-of-hooks
1453
+ React__namespace.useLayoutEffect(() => {
1454
+ // Explicit false means don't do anything (used for submissions)
1455
+ if (restoreScrollPosition === false) {
1456
+ return;
1457
+ }
1458
+
1459
+ // been here before, scroll to it
1460
+ if (typeof restoreScrollPosition === "number") {
1461
+ window.scrollTo(0, restoreScrollPosition);
1462
+ return;
1463
+ }
1464
+
1465
+ // try to scroll to the hash
1466
+ if (location.hash) {
1467
+ let el = document.getElementById(decodeURIComponent(location.hash.slice(1)));
1468
+ if (el) {
1469
+ el.scrollIntoView();
1470
+ return;
1471
+ }
1472
+ }
1473
+
1474
+ // Don't reset if this navigation opted out
1475
+ if (preventScrollReset === true) {
1476
+ return;
1477
+ }
1478
+
1479
+ // otherwise go to the top on new locations
1480
+ window.scrollTo(0, 0);
1481
+ }, [location, restoreScrollPosition, preventScrollReset]);
1482
+ }
1483
+ }
1484
+
1485
+ /**
1486
+ * Setup a callback to be fired on the window's `beforeunload` event. This is
1487
+ * useful for saving some data to `window.localStorage` just before the page
1488
+ * refreshes.
1489
+ *
1490
+ * Note: The `callback` argument should be a function created with
1491
+ * `React.useCallback()`.
1492
+ */
1493
+ function useBeforeUnload(callback, options) {
1494
+ let {
1495
+ capture
1496
+ } = options || {};
1497
+ React__namespace.useEffect(() => {
1498
+ let opts = capture != null ? {
1499
+ capture
1500
+ } : undefined;
1501
+ window.addEventListener("beforeunload", callback, opts);
1502
+ return () => {
1503
+ window.removeEventListener("beforeunload", callback, opts);
1504
+ };
1505
+ }, [callback, capture]);
1506
+ }
1507
+
1508
+ /**
1509
+ * Setup a callback to be fired on the window's `pagehide` event. This is
1510
+ * useful for saving some data to `window.localStorage` just before the page
1511
+ * refreshes. This event is better supported than beforeunload across browsers.
1512
+ *
1513
+ * Note: The `callback` argument should be a function created with
1514
+ * `React.useCallback()`.
1515
+ */
1516
+ function usePageHide(callback, options) {
1517
+ let {
1518
+ capture
1519
+ } = options || {};
1520
+ React__namespace.useEffect(() => {
1521
+ let opts = capture != null ? {
1522
+ capture
1523
+ } : undefined;
1524
+ window.addEventListener("pagehide", callback, opts);
1525
+ return () => {
1526
+ window.removeEventListener("pagehide", callback, opts);
1527
+ };
1528
+ }, [callback, capture]);
1529
+ }
1530
+
1531
+ /**
1532
+ * Wrapper around useBlocker to show a window.confirm prompt to users instead
1533
+ * of building a custom UI with useBlocker.
1534
+ *
1535
+ * Warning: This has *a lot of rough edges* and behaves very differently (and
1536
+ * very incorrectly in some cases) across browsers if user click addition
1537
+ * back/forward navigations while the confirm is open. Use at your own risk.
1538
+ */
1539
+ function usePrompt(_ref12) {
1540
+ let {
1541
+ when,
1542
+ message
1543
+ } = _ref12;
1544
+ let blocker = reactRouter.useBlocker(when);
1545
+ React__namespace.useEffect(() => {
1546
+ if (blocker.state === "blocked") {
1547
+ let proceed = window.confirm(message);
1548
+ if (proceed) {
1549
+ // This timeout is needed to avoid a weird "race" on POP navigations
1550
+ // between the `window.history` revert navigation and the result of
1551
+ // `window.confirm`
1552
+ setTimeout(blocker.proceed, 0);
1553
+ } else {
1554
+ blocker.reset();
1555
+ }
1556
+ }
1557
+ }, [blocker, message]);
1558
+ React__namespace.useEffect(() => {
1559
+ if (blocker.state === "blocked" && !when) {
1560
+ blocker.reset();
1561
+ }
1562
+ }, [blocker, when]);
1563
+ }
1564
+
1565
+ /**
1566
+ * Return a boolean indicating if there is an active view transition to the
1567
+ * given href. You can use this value to render CSS classes or viewTransitionName
1568
+ * styles onto your elements
1569
+ *
1570
+ * @param href The destination href
1571
+ * @param [opts.relative] Relative routing type ("route" | "path")
1572
+ */
1573
+ function useViewTransitionState(to, opts) {
1574
+ if (opts === void 0) {
1575
+ opts = {};
1576
+ }
1577
+ let vtContext = React__namespace.useContext(ViewTransitionContext);
1578
+ !(vtContext != null) ? router.UNSAFE_invariant(false, "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. " + "Did you accidentally import `RouterProvider` from `react-router`?") : void 0;
1579
+ let {
1580
+ basename
1581
+ } = useDataRouterContext(DataRouterHook.useViewTransitionState);
1582
+ let path = reactRouter.useResolvedPath(to, {
1583
+ relative: opts.relative
1584
+ });
1585
+ if (!vtContext.isTransitioning) {
1586
+ return false;
1587
+ }
1588
+ let currentPath = router.stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
1589
+ let nextPath = router.stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
1590
+
1591
+ // Transition is active if we're going to or coming from the indicated
1592
+ // destination. This ensures that other PUSH navigations that reverse
1593
+ // an indicated transition apply. I.e., on the list view you have:
1594
+ //
1595
+ // <NavLink to="/details/1" viewTransition>
1596
+ //
1597
+ // If you click the breadcrumb back to the list view:
1598
+ //
1599
+ // <NavLink to="/list" viewTransition>
1600
+ //
1601
+ // We should apply the transition because it's indicated as active going
1602
+ // from /list -> /details/1 and therefore should be active on the reverse
1603
+ // (even though this isn't strictly a POP reverse)
1604
+ return router.matchPath(path.pathname, nextPath) != null || router.matchPath(path.pathname, currentPath) != null;
1605
+ }
1606
+
1607
+ //#endregion
1608
+
1609
+ Object.defineProperty(exports, 'AbortedDeferredError', {
1610
+ enumerable: true,
1611
+ get: function () { return reactRouter.AbortedDeferredError; }
1612
+ });
1613
+ Object.defineProperty(exports, 'Await', {
1614
+ enumerable: true,
1615
+ get: function () { return reactRouter.Await; }
1616
+ });
1617
+ Object.defineProperty(exports, 'MemoryRouter', {
1618
+ enumerable: true,
1619
+ get: function () { return reactRouter.MemoryRouter; }
1620
+ });
1621
+ Object.defineProperty(exports, 'Navigate', {
1622
+ enumerable: true,
1623
+ get: function () { return reactRouter.Navigate; }
1624
+ });
1625
+ Object.defineProperty(exports, 'NavigationType', {
1626
+ enumerable: true,
1627
+ get: function () { return reactRouter.NavigationType; }
1628
+ });
1629
+ Object.defineProperty(exports, 'Outlet', {
1630
+ enumerable: true,
1631
+ get: function () { return reactRouter.Outlet; }
1632
+ });
1633
+ Object.defineProperty(exports, 'Route', {
1634
+ enumerable: true,
1635
+ get: function () { return reactRouter.Route; }
1636
+ });
1637
+ Object.defineProperty(exports, 'Router', {
1638
+ enumerable: true,
1639
+ get: function () { return reactRouter.Router; }
1640
+ });
1641
+ Object.defineProperty(exports, 'Routes', {
1642
+ enumerable: true,
1643
+ get: function () { return reactRouter.Routes; }
1644
+ });
1645
+ Object.defineProperty(exports, 'UNSAFE_DataRouterContext', {
1646
+ enumerable: true,
1647
+ get: function () { return reactRouter.UNSAFE_DataRouterContext; }
1648
+ });
1649
+ Object.defineProperty(exports, 'UNSAFE_DataRouterStateContext', {
1650
+ enumerable: true,
1651
+ get: function () { return reactRouter.UNSAFE_DataRouterStateContext; }
1652
+ });
1653
+ Object.defineProperty(exports, 'UNSAFE_LocationContext', {
1654
+ enumerable: true,
1655
+ get: function () { return reactRouter.UNSAFE_LocationContext; }
1656
+ });
1657
+ Object.defineProperty(exports, 'UNSAFE_NavigationContext', {
1658
+ enumerable: true,
1659
+ get: function () { return reactRouter.UNSAFE_NavigationContext; }
1660
+ });
1661
+ Object.defineProperty(exports, 'UNSAFE_RouteContext', {
1662
+ enumerable: true,
1663
+ get: function () { return reactRouter.UNSAFE_RouteContext; }
1664
+ });
1665
+ Object.defineProperty(exports, 'UNSAFE_useRouteId', {
1666
+ enumerable: true,
1667
+ get: function () { return reactRouter.UNSAFE_useRouteId; }
1668
+ });
1669
+ Object.defineProperty(exports, 'createMemoryRouter', {
1670
+ enumerable: true,
1671
+ get: function () { return reactRouter.createMemoryRouter; }
1672
+ });
1673
+ Object.defineProperty(exports, 'createPath', {
1674
+ enumerable: true,
1675
+ get: function () { return reactRouter.createPath; }
1676
+ });
1677
+ Object.defineProperty(exports, 'createRoutesFromChildren', {
1678
+ enumerable: true,
1679
+ get: function () { return reactRouter.createRoutesFromChildren; }
1680
+ });
1681
+ Object.defineProperty(exports, 'createRoutesFromElements', {
1682
+ enumerable: true,
1683
+ get: function () { return reactRouter.createRoutesFromElements; }
1684
+ });
1685
+ Object.defineProperty(exports, 'defer', {
1686
+ enumerable: true,
1687
+ get: function () { return reactRouter.defer; }
1688
+ });
1689
+ Object.defineProperty(exports, 'generatePath', {
1690
+ enumerable: true,
1691
+ get: function () { return reactRouter.generatePath; }
1692
+ });
1693
+ Object.defineProperty(exports, 'isRouteErrorResponse', {
1694
+ enumerable: true,
1695
+ get: function () { return reactRouter.isRouteErrorResponse; }
1696
+ });
1697
+ Object.defineProperty(exports, 'json', {
1698
+ enumerable: true,
1699
+ get: function () { return reactRouter.json; }
1700
+ });
1701
+ Object.defineProperty(exports, 'matchPath', {
1702
+ enumerable: true,
1703
+ get: function () { return reactRouter.matchPath; }
1704
+ });
1705
+ Object.defineProperty(exports, 'matchRoutes', {
1706
+ enumerable: true,
1707
+ get: function () { return reactRouter.matchRoutes; }
1708
+ });
1709
+ Object.defineProperty(exports, 'parsePath', {
1710
+ enumerable: true,
1711
+ get: function () { return reactRouter.parsePath; }
1712
+ });
1713
+ Object.defineProperty(exports, 'redirect', {
1714
+ enumerable: true,
1715
+ get: function () { return reactRouter.redirect; }
1716
+ });
1717
+ Object.defineProperty(exports, 'redirectDocument', {
1718
+ enumerable: true,
1719
+ get: function () { return reactRouter.redirectDocument; }
1720
+ });
1721
+ Object.defineProperty(exports, 'renderMatches', {
1722
+ enumerable: true,
1723
+ get: function () { return reactRouter.renderMatches; }
1724
+ });
1725
+ Object.defineProperty(exports, 'replace', {
1726
+ enumerable: true,
1727
+ get: function () { return reactRouter.replace; }
1728
+ });
1729
+ Object.defineProperty(exports, 'resolvePath', {
1730
+ enumerable: true,
1731
+ get: function () { return reactRouter.resolvePath; }
1732
+ });
1733
+ Object.defineProperty(exports, 'useActionData', {
1734
+ enumerable: true,
1735
+ get: function () { return reactRouter.useActionData; }
1736
+ });
1737
+ Object.defineProperty(exports, 'useAsyncError', {
1738
+ enumerable: true,
1739
+ get: function () { return reactRouter.useAsyncError; }
1740
+ });
1741
+ Object.defineProperty(exports, 'useAsyncValue', {
1742
+ enumerable: true,
1743
+ get: function () { return reactRouter.useAsyncValue; }
1744
+ });
1745
+ Object.defineProperty(exports, 'useBlocker', {
1746
+ enumerable: true,
1747
+ get: function () { return reactRouter.useBlocker; }
1748
+ });
1749
+ Object.defineProperty(exports, 'useHref', {
1750
+ enumerable: true,
1751
+ get: function () { return reactRouter.useHref; }
1752
+ });
1753
+ Object.defineProperty(exports, 'useInRouterContext', {
1754
+ enumerable: true,
1755
+ get: function () { return reactRouter.useInRouterContext; }
1756
+ });
1757
+ Object.defineProperty(exports, 'useLoaderData', {
1758
+ enumerable: true,
1759
+ get: function () { return reactRouter.useLoaderData; }
1760
+ });
1761
+ Object.defineProperty(exports, 'useLocation', {
1762
+ enumerable: true,
1763
+ get: function () { return reactRouter.useLocation; }
1764
+ });
1765
+ Object.defineProperty(exports, 'useMatch', {
1766
+ enumerable: true,
1767
+ get: function () { return reactRouter.useMatch; }
1768
+ });
1769
+ Object.defineProperty(exports, 'useMatches', {
1770
+ enumerable: true,
1771
+ get: function () { return reactRouter.useMatches; }
1772
+ });
1773
+ Object.defineProperty(exports, 'useNavigate', {
1774
+ enumerable: true,
1775
+ get: function () { return reactRouter.useNavigate; }
1776
+ });
1777
+ Object.defineProperty(exports, 'useNavigation', {
1778
+ enumerable: true,
1779
+ get: function () { return reactRouter.useNavigation; }
1780
+ });
1781
+ Object.defineProperty(exports, 'useNavigationType', {
1782
+ enumerable: true,
1783
+ get: function () { return reactRouter.useNavigationType; }
1784
+ });
1785
+ Object.defineProperty(exports, 'useOutlet', {
1786
+ enumerable: true,
1787
+ get: function () { return reactRouter.useOutlet; }
1788
+ });
1789
+ Object.defineProperty(exports, 'useOutletContext', {
1790
+ enumerable: true,
1791
+ get: function () { return reactRouter.useOutletContext; }
1792
+ });
1793
+ Object.defineProperty(exports, 'useParams', {
1794
+ enumerable: true,
1795
+ get: function () { return reactRouter.useParams; }
1796
+ });
1797
+ Object.defineProperty(exports, 'useResolvedPath', {
1798
+ enumerable: true,
1799
+ get: function () { return reactRouter.useResolvedPath; }
1800
+ });
1801
+ Object.defineProperty(exports, 'useRevalidator', {
1802
+ enumerable: true,
1803
+ get: function () { return reactRouter.useRevalidator; }
1804
+ });
1805
+ Object.defineProperty(exports, 'useRouteError', {
1806
+ enumerable: true,
1807
+ get: function () { return reactRouter.useRouteError; }
1808
+ });
1809
+ Object.defineProperty(exports, 'useRouteLoaderData', {
1810
+ enumerable: true,
1811
+ get: function () { return reactRouter.useRouteLoaderData; }
1812
+ });
1813
+ Object.defineProperty(exports, 'useRoutes', {
1814
+ enumerable: true,
1815
+ get: function () { return reactRouter.useRoutes; }
1816
+ });
1817
+ Object.defineProperty(exports, 'UNSAFE_ErrorResponseImpl', {
1818
+ enumerable: true,
1819
+ get: function () { return router.UNSAFE_ErrorResponseImpl; }
1820
+ });
1821
+ exports.BrowserRouter = BrowserRouter;
1822
+ exports.Form = Form;
1823
+ exports.HashRouter = HashRouter;
1824
+ exports.Link = Link;
1825
+ exports.NavLink = NavLink;
1826
+ exports.RouterProvider = RouterProvider;
1827
+ exports.ScrollRestoration = ScrollRestoration;
1828
+ exports.UNSAFE_FetchersContext = FetchersContext;
1829
+ exports.UNSAFE_ViewTransitionContext = ViewTransitionContext;
1830
+ exports.UNSAFE_useScrollRestoration = useScrollRestoration;
1831
+ exports.createBrowserRouter = createBrowserRouter;
1832
+ exports.createHashRouter = createHashRouter;
1833
+ exports.createSearchParams = createSearchParams;
1834
+ exports.unstable_HistoryRouter = HistoryRouter;
1835
+ exports.unstable_usePrompt = usePrompt;
1836
+ exports.useBeforeUnload = useBeforeUnload;
1837
+ exports.useFetcher = useFetcher;
1838
+ exports.useFetchers = useFetchers;
1839
+ exports.useFormAction = useFormAction;
1840
+ exports.useLinkClickHandler = useLinkClickHandler;
1841
+ exports.useSearchParams = useSearchParams;
1842
+ exports.useSubmit = useSubmit;
1843
+ exports.useViewTransitionState = useViewTransitionState;
1844
+
1845
+ Object.defineProperty(exports, '__esModule', { value: true });
1846
+
1847
+ }));
1848
+ //# sourceMappingURL=react-router-dom.development.js.map