@tanstack/react-router 0.0.1-alpha.0

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,2686 @@
1
+ /**
2
+ * react-router
3
+ *
4
+ * Copyright (c) TanStack
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 { useSyncExternalStore } from 'use-sync-external-store/shim';
13
+
14
+ function _extends$2() {
15
+ _extends$2 = Object.assign ? Object.assign.bind() : function (target) {
16
+ for (var i = 1; i < arguments.length; i++) {
17
+ var source = arguments[i];
18
+
19
+ for (var key in source) {
20
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
21
+ target[key] = source[key];
22
+ }
23
+ }
24
+ }
25
+
26
+ return target;
27
+ };
28
+ return _extends$2.apply(this, arguments);
29
+ }
30
+
31
+ function _objectWithoutPropertiesLoose(source, excluded) {
32
+ if (source == null) return {};
33
+ var target = {};
34
+ var sourceKeys = Object.keys(source);
35
+ var key, i;
36
+
37
+ for (i = 0; i < sourceKeys.length; i++) {
38
+ key = sourceKeys[i];
39
+ if (excluded.indexOf(key) >= 0) continue;
40
+ target[key] = source[key];
41
+ }
42
+
43
+ return target;
44
+ }
45
+
46
+ /**
47
+ * router-core
48
+ *
49
+ * Copyright (c) TanStack
50
+ *
51
+ * This source code is licensed under the MIT license found in the
52
+ * LICENSE.md file in the root directory of this source tree.
53
+ *
54
+ * @license MIT
55
+ */
56
+ function _extends$1() {
57
+ _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
58
+ for (var i = 1; i < arguments.length; i++) {
59
+ var source = arguments[i];
60
+
61
+ for (var key in source) {
62
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
63
+ target[key] = source[key];
64
+ }
65
+ }
66
+ }
67
+
68
+ return target;
69
+ };
70
+ return _extends$1.apply(this, arguments);
71
+ }
72
+
73
+ function _extends() {
74
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
75
+ for (var i = 1; i < arguments.length; i++) {
76
+ var source = arguments[i];
77
+
78
+ for (var key in source) {
79
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
80
+ target[key] = source[key];
81
+ }
82
+ }
83
+ }
84
+
85
+ return target;
86
+ };
87
+ return _extends.apply(this, arguments);
88
+ }
89
+
90
+ /**
91
+ * Actions represent the type of change to a location value.
92
+ *
93
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action
94
+ */
95
+ var Action;
96
+
97
+ (function (Action) {
98
+ /**
99
+ * A POP indicates a change to an arbitrary index in the history stack, such
100
+ * as a back or forward navigation. It does not describe the direction of the
101
+ * navigation, only that the current index changed.
102
+ *
103
+ * Note: This is the default action for newly created history objects.
104
+ */
105
+ Action["Pop"] = "POP";
106
+ /**
107
+ * A PUSH indicates a new entry being added to the history stack, such as when
108
+ * a link is clicked and a new page loads. When this happens, all subsequent
109
+ * entries in the stack are lost.
110
+ */
111
+
112
+ Action["Push"] = "PUSH";
113
+ /**
114
+ * A REPLACE indicates the entry at the current index in the history stack
115
+ * being replaced by a new one.
116
+ */
117
+
118
+ Action["Replace"] = "REPLACE";
119
+ })(Action || (Action = {}));
120
+
121
+ var readOnly = process.env.NODE_ENV !== "production" ? function (obj) {
122
+ return Object.freeze(obj);
123
+ } : function (obj) {
124
+ return obj;
125
+ };
126
+
127
+ function warning$1(cond, message) {
128
+ if (!cond) {
129
+ // eslint-disable-next-line no-console
130
+ if (typeof console !== 'undefined') console.warn(message);
131
+
132
+ try {
133
+ // Welcome to debugging history!
134
+ //
135
+ // This error is thrown as a convenience so you can more easily
136
+ // find the source for a warning that appears in the console by
137
+ // enabling "pause on exceptions" in your JavaScript debugger.
138
+ throw new Error(message); // eslint-disable-next-line no-empty
139
+ } catch (e) {}
140
+ }
141
+ }
142
+
143
+ var BeforeUnloadEventType = 'beforeunload';
144
+ var HashChangeEventType = 'hashchange';
145
+ var PopStateEventType = 'popstate';
146
+ /**
147
+ * Browser history stores the location in regular URLs. This is the standard for
148
+ * most web apps, but it requires some configuration on the server to ensure you
149
+ * serve the same app at multiple URLs.
150
+ *
151
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory
152
+ */
153
+
154
+ function createBrowserHistory(options) {
155
+ if (options === void 0) {
156
+ options = {};
157
+ }
158
+
159
+ var _options = options,
160
+ _options$window = _options.window,
161
+ window = _options$window === void 0 ? document.defaultView : _options$window;
162
+ var globalHistory = window.history;
163
+
164
+ function getIndexAndLocation() {
165
+ var _window$location = window.location,
166
+ pathname = _window$location.pathname,
167
+ search = _window$location.search,
168
+ hash = _window$location.hash;
169
+ var state = globalHistory.state || {};
170
+ return [state.idx, readOnly({
171
+ pathname: pathname,
172
+ search: search,
173
+ hash: hash,
174
+ state: state.usr || null,
175
+ key: state.key || 'default'
176
+ })];
177
+ }
178
+
179
+ var blockedPopTx = null;
180
+
181
+ function handlePop() {
182
+ if (blockedPopTx) {
183
+ blockers.call(blockedPopTx);
184
+ blockedPopTx = null;
185
+ } else {
186
+ var nextAction = Action.Pop;
187
+
188
+ var _getIndexAndLocation = getIndexAndLocation(),
189
+ nextIndex = _getIndexAndLocation[0],
190
+ nextLocation = _getIndexAndLocation[1];
191
+
192
+ if (blockers.length) {
193
+ if (nextIndex != null) {
194
+ var delta = index - nextIndex;
195
+
196
+ if (delta) {
197
+ // Revert the POP
198
+ blockedPopTx = {
199
+ action: nextAction,
200
+ location: nextLocation,
201
+ retry: function retry() {
202
+ go(delta * -1);
203
+ }
204
+ };
205
+ go(delta);
206
+ }
207
+ } else {
208
+ // Trying to POP to a location with no index. We did not create
209
+ // this location, so we can't effectively block the navigation.
210
+ process.env.NODE_ENV !== "production" ? warning$1(false, // TODO: Write up a doc that explains our blocking strategy in
211
+ // detail and link to it here so people can understand better what
212
+ // is going on and how to avoid it.
213
+ "You are trying to block a POP navigation to a location that was not " + "created by the history library. The block will fail silently in " + "production, but in general you should do all navigation with the " + "history library (instead of using window.history.pushState directly) " + "to avoid this situation.") : void 0;
214
+ }
215
+ } else {
216
+ applyTx(nextAction);
217
+ }
218
+ }
219
+ }
220
+
221
+ window.addEventListener(PopStateEventType, handlePop);
222
+ var action = Action.Pop;
223
+
224
+ var _getIndexAndLocation2 = getIndexAndLocation(),
225
+ index = _getIndexAndLocation2[0],
226
+ location = _getIndexAndLocation2[1];
227
+
228
+ var listeners = createEvents();
229
+ var blockers = createEvents();
230
+
231
+ if (index == null) {
232
+ index = 0;
233
+ globalHistory.replaceState(_extends({}, globalHistory.state, {
234
+ idx: index
235
+ }), '');
236
+ }
237
+
238
+ function createHref(to) {
239
+ return typeof to === 'string' ? to : createPath(to);
240
+ } // state defaults to `null` because `window.history.state` does
241
+
242
+
243
+ function getNextLocation(to, state) {
244
+ if (state === void 0) {
245
+ state = null;
246
+ }
247
+
248
+ return readOnly(_extends({
249
+ pathname: location.pathname,
250
+ hash: '',
251
+ search: ''
252
+ }, typeof to === 'string' ? parsePath(to) : to, {
253
+ state: state,
254
+ key: createKey()
255
+ }));
256
+ }
257
+
258
+ function getHistoryStateAndUrl(nextLocation, index) {
259
+ return [{
260
+ usr: nextLocation.state,
261
+ key: nextLocation.key,
262
+ idx: index
263
+ }, createHref(nextLocation)];
264
+ }
265
+
266
+ function allowTx(action, location, retry) {
267
+ return !blockers.length || (blockers.call({
268
+ action: action,
269
+ location: location,
270
+ retry: retry
271
+ }), false);
272
+ }
273
+
274
+ function applyTx(nextAction) {
275
+ action = nextAction;
276
+
277
+ var _getIndexAndLocation3 = getIndexAndLocation();
278
+
279
+ index = _getIndexAndLocation3[0];
280
+ location = _getIndexAndLocation3[1];
281
+ listeners.call({
282
+ action: action,
283
+ location: location
284
+ });
285
+ }
286
+
287
+ function push(to, state) {
288
+ var nextAction = Action.Push;
289
+ var nextLocation = getNextLocation(to, state);
290
+
291
+ function retry() {
292
+ push(to, state);
293
+ }
294
+
295
+ if (allowTx(nextAction, nextLocation, retry)) {
296
+ var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1),
297
+ historyState = _getHistoryStateAndUr[0],
298
+ url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading
299
+ // try...catch because iOS limits us to 100 pushState calls :/
300
+
301
+
302
+ try {
303
+ globalHistory.pushState(historyState, '', url);
304
+ } catch (error) {
305
+ // They are going to lose state here, but there is no real
306
+ // way to warn them about it since the page will refresh...
307
+ window.location.assign(url);
308
+ }
309
+
310
+ applyTx(nextAction);
311
+ }
312
+ }
313
+
314
+ function replace(to, state) {
315
+ var nextAction = Action.Replace;
316
+ var nextLocation = getNextLocation(to, state);
317
+
318
+ function retry() {
319
+ replace(to, state);
320
+ }
321
+
322
+ if (allowTx(nextAction, nextLocation, retry)) {
323
+ var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index),
324
+ historyState = _getHistoryStateAndUr2[0],
325
+ url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading
326
+
327
+
328
+ globalHistory.replaceState(historyState, '', url);
329
+ applyTx(nextAction);
330
+ }
331
+ }
332
+
333
+ function go(delta) {
334
+ globalHistory.go(delta);
335
+ }
336
+
337
+ var history = {
338
+ get action() {
339
+ return action;
340
+ },
341
+
342
+ get location() {
343
+ return location;
344
+ },
345
+
346
+ createHref: createHref,
347
+ push: push,
348
+ replace: replace,
349
+ go: go,
350
+ back: function back() {
351
+ go(-1);
352
+ },
353
+ forward: function forward() {
354
+ go(1);
355
+ },
356
+ listen: function listen(listener) {
357
+ return listeners.push(listener);
358
+ },
359
+ block: function block(blocker) {
360
+ var unblock = blockers.push(blocker);
361
+
362
+ if (blockers.length === 1) {
363
+ window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);
364
+ }
365
+
366
+ return function () {
367
+ unblock(); // Remove the beforeunload listener so the document may
368
+ // still be salvageable in the pagehide event.
369
+ // See https://html.spec.whatwg.org/#unloading-documents
370
+
371
+ if (!blockers.length) {
372
+ window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);
373
+ }
374
+ };
375
+ }
376
+ };
377
+ return history;
378
+ }
379
+ /**
380
+ * Hash history stores the location in window.location.hash. This makes it ideal
381
+ * for situations where you don't want to send the location to the server for
382
+ * some reason, either because you do cannot configure it or the URL space is
383
+ * reserved for something else.
384
+ *
385
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory
386
+ */
387
+
388
+ function createHashHistory(options) {
389
+ if (options === void 0) {
390
+ options = {};
391
+ }
392
+
393
+ var _options2 = options,
394
+ _options2$window = _options2.window,
395
+ window = _options2$window === void 0 ? document.defaultView : _options2$window;
396
+ var globalHistory = window.history;
397
+
398
+ function getIndexAndLocation() {
399
+ var _parsePath = parsePath(window.location.hash.substr(1)),
400
+ _parsePath$pathname = _parsePath.pathname,
401
+ pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname,
402
+ _parsePath$search = _parsePath.search,
403
+ search = _parsePath$search === void 0 ? '' : _parsePath$search,
404
+ _parsePath$hash = _parsePath.hash,
405
+ hash = _parsePath$hash === void 0 ? '' : _parsePath$hash;
406
+
407
+ var state = globalHistory.state || {};
408
+ return [state.idx, readOnly({
409
+ pathname: pathname,
410
+ search: search,
411
+ hash: hash,
412
+ state: state.usr || null,
413
+ key: state.key || 'default'
414
+ })];
415
+ }
416
+
417
+ var blockedPopTx = null;
418
+
419
+ function handlePop() {
420
+ if (blockedPopTx) {
421
+ blockers.call(blockedPopTx);
422
+ blockedPopTx = null;
423
+ } else {
424
+ var nextAction = Action.Pop;
425
+
426
+ var _getIndexAndLocation4 = getIndexAndLocation(),
427
+ nextIndex = _getIndexAndLocation4[0],
428
+ nextLocation = _getIndexAndLocation4[1];
429
+
430
+ if (blockers.length) {
431
+ if (nextIndex != null) {
432
+ var delta = index - nextIndex;
433
+
434
+ if (delta) {
435
+ // Revert the POP
436
+ blockedPopTx = {
437
+ action: nextAction,
438
+ location: nextLocation,
439
+ retry: function retry() {
440
+ go(delta * -1);
441
+ }
442
+ };
443
+ go(delta);
444
+ }
445
+ } else {
446
+ // Trying to POP to a location with no index. We did not create
447
+ // this location, so we can't effectively block the navigation.
448
+ process.env.NODE_ENV !== "production" ? warning$1(false, // TODO: Write up a doc that explains our blocking strategy in
449
+ // detail and link to it here so people can understand better
450
+ // what is going on and how to avoid it.
451
+ "You are trying to block a POP navigation to a location that was not " + "created by the history library. The block will fail silently in " + "production, but in general you should do all navigation with the " + "history library (instead of using window.history.pushState directly) " + "to avoid this situation.") : void 0;
452
+ }
453
+ } else {
454
+ applyTx(nextAction);
455
+ }
456
+ }
457
+ }
458
+
459
+ window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge
460
+ // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event
461
+
462
+ window.addEventListener(HashChangeEventType, function () {
463
+ var _getIndexAndLocation5 = getIndexAndLocation(),
464
+ nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events.
465
+
466
+
467
+ if (createPath(nextLocation) !== createPath(location)) {
468
+ handlePop();
469
+ }
470
+ });
471
+ var action = Action.Pop;
472
+
473
+ var _getIndexAndLocation6 = getIndexAndLocation(),
474
+ index = _getIndexAndLocation6[0],
475
+ location = _getIndexAndLocation6[1];
476
+
477
+ var listeners = createEvents();
478
+ var blockers = createEvents();
479
+
480
+ if (index == null) {
481
+ index = 0;
482
+ globalHistory.replaceState(_extends({}, globalHistory.state, {
483
+ idx: index
484
+ }), '');
485
+ }
486
+
487
+ function getBaseHref() {
488
+ var base = document.querySelector('base');
489
+ var href = '';
490
+
491
+ if (base && base.getAttribute('href')) {
492
+ var url = window.location.href;
493
+ var hashIndex = url.indexOf('#');
494
+ href = hashIndex === -1 ? url : url.slice(0, hashIndex);
495
+ }
496
+
497
+ return href;
498
+ }
499
+
500
+ function createHref(to) {
501
+ return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to));
502
+ }
503
+
504
+ function getNextLocation(to, state) {
505
+ if (state === void 0) {
506
+ state = null;
507
+ }
508
+
509
+ return readOnly(_extends({
510
+ pathname: location.pathname,
511
+ hash: '',
512
+ search: ''
513
+ }, typeof to === 'string' ? parsePath(to) : to, {
514
+ state: state,
515
+ key: createKey()
516
+ }));
517
+ }
518
+
519
+ function getHistoryStateAndUrl(nextLocation, index) {
520
+ return [{
521
+ usr: nextLocation.state,
522
+ key: nextLocation.key,
523
+ idx: index
524
+ }, createHref(nextLocation)];
525
+ }
526
+
527
+ function allowTx(action, location, retry) {
528
+ return !blockers.length || (blockers.call({
529
+ action: action,
530
+ location: location,
531
+ retry: retry
532
+ }), false);
533
+ }
534
+
535
+ function applyTx(nextAction) {
536
+ action = nextAction;
537
+
538
+ var _getIndexAndLocation7 = getIndexAndLocation();
539
+
540
+ index = _getIndexAndLocation7[0];
541
+ location = _getIndexAndLocation7[1];
542
+ listeners.call({
543
+ action: action,
544
+ location: location
545
+ });
546
+ }
547
+
548
+ function push(to, state) {
549
+ var nextAction = Action.Push;
550
+ var nextLocation = getNextLocation(to, state);
551
+
552
+ function retry() {
553
+ push(to, state);
554
+ }
555
+
556
+ process.env.NODE_ENV !== "production" ? warning$1(nextLocation.pathname.charAt(0) === '/', "Relative pathnames are not supported in hash history.push(" + JSON.stringify(to) + ")") : void 0;
557
+
558
+ if (allowTx(nextAction, nextLocation, retry)) {
559
+ var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1),
560
+ historyState = _getHistoryStateAndUr3[0],
561
+ url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading
562
+ // try...catch because iOS limits us to 100 pushState calls :/
563
+
564
+
565
+ try {
566
+ globalHistory.pushState(historyState, '', url);
567
+ } catch (error) {
568
+ // They are going to lose state here, but there is no real
569
+ // way to warn them about it since the page will refresh...
570
+ window.location.assign(url);
571
+ }
572
+
573
+ applyTx(nextAction);
574
+ }
575
+ }
576
+
577
+ function replace(to, state) {
578
+ var nextAction = Action.Replace;
579
+ var nextLocation = getNextLocation(to, state);
580
+
581
+ function retry() {
582
+ replace(to, state);
583
+ }
584
+
585
+ process.env.NODE_ENV !== "production" ? warning$1(nextLocation.pathname.charAt(0) === '/', "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(to) + ")") : void 0;
586
+
587
+ if (allowTx(nextAction, nextLocation, retry)) {
588
+ var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index),
589
+ historyState = _getHistoryStateAndUr4[0],
590
+ url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading
591
+
592
+
593
+ globalHistory.replaceState(historyState, '', url);
594
+ applyTx(nextAction);
595
+ }
596
+ }
597
+
598
+ function go(delta) {
599
+ globalHistory.go(delta);
600
+ }
601
+
602
+ var history = {
603
+ get action() {
604
+ return action;
605
+ },
606
+
607
+ get location() {
608
+ return location;
609
+ },
610
+
611
+ createHref: createHref,
612
+ push: push,
613
+ replace: replace,
614
+ go: go,
615
+ back: function back() {
616
+ go(-1);
617
+ },
618
+ forward: function forward() {
619
+ go(1);
620
+ },
621
+ listen: function listen(listener) {
622
+ return listeners.push(listener);
623
+ },
624
+ block: function block(blocker) {
625
+ var unblock = blockers.push(blocker);
626
+
627
+ if (blockers.length === 1) {
628
+ window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);
629
+ }
630
+
631
+ return function () {
632
+ unblock(); // Remove the beforeunload listener so the document may
633
+ // still be salvageable in the pagehide event.
634
+ // See https://html.spec.whatwg.org/#unloading-documents
635
+
636
+ if (!blockers.length) {
637
+ window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);
638
+ }
639
+ };
640
+ }
641
+ };
642
+ return history;
643
+ }
644
+ /**
645
+ * Memory history stores the current location in memory. It is designed for use
646
+ * in stateful non-browser environments like tests and React Native.
647
+ *
648
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory
649
+ */
650
+
651
+ function createMemoryHistory(options) {
652
+ if (options === void 0) {
653
+ options = {};
654
+ }
655
+
656
+ var _options3 = options,
657
+ _options3$initialEntr = _options3.initialEntries,
658
+ initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr,
659
+ initialIndex = _options3.initialIndex;
660
+ var entries = initialEntries.map(function (entry) {
661
+ var location = readOnly(_extends({
662
+ pathname: '/',
663
+ search: '',
664
+ hash: '',
665
+ state: null,
666
+ key: createKey()
667
+ }, typeof entry === 'string' ? parsePath(entry) : entry));
668
+ process.env.NODE_ENV !== "production" ? warning$1(location.pathname.charAt(0) === '/', "Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: " + JSON.stringify(entry) + ")") : void 0;
669
+ return location;
670
+ });
671
+ var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);
672
+ var action = Action.Pop;
673
+ var location = entries[index];
674
+ var listeners = createEvents();
675
+ var blockers = createEvents();
676
+
677
+ function createHref(to) {
678
+ return typeof to === 'string' ? to : createPath(to);
679
+ }
680
+
681
+ function getNextLocation(to, state) {
682
+ if (state === void 0) {
683
+ state = null;
684
+ }
685
+
686
+ return readOnly(_extends({
687
+ pathname: location.pathname,
688
+ search: '',
689
+ hash: ''
690
+ }, typeof to === 'string' ? parsePath(to) : to, {
691
+ state: state,
692
+ key: createKey()
693
+ }));
694
+ }
695
+
696
+ function allowTx(action, location, retry) {
697
+ return !blockers.length || (blockers.call({
698
+ action: action,
699
+ location: location,
700
+ retry: retry
701
+ }), false);
702
+ }
703
+
704
+ function applyTx(nextAction, nextLocation) {
705
+ action = nextAction;
706
+ location = nextLocation;
707
+ listeners.call({
708
+ action: action,
709
+ location: location
710
+ });
711
+ }
712
+
713
+ function push(to, state) {
714
+ var nextAction = Action.Push;
715
+ var nextLocation = getNextLocation(to, state);
716
+
717
+ function retry() {
718
+ push(to, state);
719
+ }
720
+
721
+ process.env.NODE_ENV !== "production" ? warning$1(location.pathname.charAt(0) === '/', "Relative pathnames are not supported in memory history.push(" + JSON.stringify(to) + ")") : void 0;
722
+
723
+ if (allowTx(nextAction, nextLocation, retry)) {
724
+ index += 1;
725
+ entries.splice(index, entries.length, nextLocation);
726
+ applyTx(nextAction, nextLocation);
727
+ }
728
+ }
729
+
730
+ function replace(to, state) {
731
+ var nextAction = Action.Replace;
732
+ var nextLocation = getNextLocation(to, state);
733
+
734
+ function retry() {
735
+ replace(to, state);
736
+ }
737
+
738
+ process.env.NODE_ENV !== "production" ? warning$1(location.pathname.charAt(0) === '/', "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(to) + ")") : void 0;
739
+
740
+ if (allowTx(nextAction, nextLocation, retry)) {
741
+ entries[index] = nextLocation;
742
+ applyTx(nextAction, nextLocation);
743
+ }
744
+ }
745
+
746
+ function go(delta) {
747
+ var nextIndex = clamp(index + delta, 0, entries.length - 1);
748
+ var nextAction = Action.Pop;
749
+ var nextLocation = entries[nextIndex];
750
+
751
+ function retry() {
752
+ go(delta);
753
+ }
754
+
755
+ if (allowTx(nextAction, nextLocation, retry)) {
756
+ index = nextIndex;
757
+ applyTx(nextAction, nextLocation);
758
+ }
759
+ }
760
+
761
+ var history = {
762
+ get index() {
763
+ return index;
764
+ },
765
+
766
+ get action() {
767
+ return action;
768
+ },
769
+
770
+ get location() {
771
+ return location;
772
+ },
773
+
774
+ createHref: createHref,
775
+ push: push,
776
+ replace: replace,
777
+ go: go,
778
+ back: function back() {
779
+ go(-1);
780
+ },
781
+ forward: function forward() {
782
+ go(1);
783
+ },
784
+ listen: function listen(listener) {
785
+ return listeners.push(listener);
786
+ },
787
+ block: function block(blocker) {
788
+ return blockers.push(blocker);
789
+ }
790
+ };
791
+ return history;
792
+ } ////////////////////////////////////////////////////////////////////////////////
793
+ // UTILS
794
+ ////////////////////////////////////////////////////////////////////////////////
795
+
796
+ function clamp(n, lowerBound, upperBound) {
797
+ return Math.min(Math.max(n, lowerBound), upperBound);
798
+ }
799
+
800
+ function promptBeforeUnload(event) {
801
+ // Cancel the event.
802
+ event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set.
803
+
804
+ event.returnValue = '';
805
+ }
806
+
807
+ function createEvents() {
808
+ var handlers = [];
809
+ return {
810
+ get length() {
811
+ return handlers.length;
812
+ },
813
+
814
+ push: function push(fn) {
815
+ handlers.push(fn);
816
+ return function () {
817
+ handlers = handlers.filter(function (handler) {
818
+ return handler !== fn;
819
+ });
820
+ };
821
+ },
822
+ call: function call(arg) {
823
+ handlers.forEach(function (fn) {
824
+ return fn && fn(arg);
825
+ });
826
+ }
827
+ };
828
+ }
829
+
830
+ function createKey() {
831
+ return Math.random().toString(36).substr(2, 8);
832
+ }
833
+ /**
834
+ * Creates a string URL path from the given pathname, search, and hash components.
835
+ *
836
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath
837
+ */
838
+
839
+
840
+ function createPath(_ref) {
841
+ var _ref$pathname = _ref.pathname,
842
+ pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,
843
+ _ref$search = _ref.search,
844
+ search = _ref$search === void 0 ? '' : _ref$search,
845
+ _ref$hash = _ref.hash,
846
+ hash = _ref$hash === void 0 ? '' : _ref$hash;
847
+ if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search;
848
+ if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash;
849
+ return pathname;
850
+ }
851
+ /**
852
+ * Parses a string URL path into its separate pathname, search, and hash components.
853
+ *
854
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath
855
+ */
856
+
857
+ function parsePath(path) {
858
+ var parsedPath = {};
859
+
860
+ if (path) {
861
+ var hashIndex = path.indexOf('#');
862
+
863
+ if (hashIndex >= 0) {
864
+ parsedPath.hash = path.substr(hashIndex);
865
+ path = path.substr(0, hashIndex);
866
+ }
867
+
868
+ var searchIndex = path.indexOf('?');
869
+
870
+ if (searchIndex >= 0) {
871
+ parsedPath.search = path.substr(searchIndex);
872
+ path = path.substr(0, searchIndex);
873
+ }
874
+
875
+ if (path) {
876
+ parsedPath.pathname = path;
877
+ }
878
+ }
879
+
880
+ return parsedPath;
881
+ }
882
+
883
+ // @ts-nocheck
884
+ // We're inlining qss here for compression's sake, but we've included it as a hard dependency for the MIT license it requires.
885
+ function encode(obj, pfx) {
886
+ var k,
887
+ i,
888
+ tmp,
889
+ str = '';
890
+
891
+ for (k in obj) {
892
+ if ((tmp = obj[k]) !== void 0) {
893
+ if (Array.isArray(tmp)) {
894
+ for (i = 0; i < tmp.length; i++) {
895
+ str && (str += '&');
896
+ str += encodeURIComponent(k) + '=' + encodeURIComponent(tmp[i]);
897
+ }
898
+ } else {
899
+ str && (str += '&');
900
+ str += encodeURIComponent(k) + '=' + encodeURIComponent(tmp);
901
+ }
902
+ }
903
+ }
904
+
905
+ return (pfx || '') + str;
906
+ }
907
+
908
+ function toValue(mix) {
909
+ if (!mix) return '';
910
+ var str = decodeURIComponent(mix);
911
+ if (str === 'false') return false;
912
+ if (str === 'true') return true;
913
+ return +str * 0 === 0 ? +str : str;
914
+ }
915
+
916
+ function decode(str) {
917
+ var tmp,
918
+ k,
919
+ out = {},
920
+ arr = str.split('&');
921
+
922
+ while (tmp = arr.shift()) {
923
+ tmp = tmp.split('=');
924
+ k = tmp.shift();
925
+
926
+ if (out[k] !== void 0) {
927
+ out[k] = [].concat(out[k], toValue(tmp.shift()));
928
+ } else {
929
+ out[k] = toValue(tmp.shift());
930
+ }
931
+ }
932
+
933
+ return out;
934
+ }
935
+
936
+ const createRouteConfig = function createRouteConfig(options, children, isRoot, parentId) {
937
+ if (options === void 0) {
938
+ options = {};
939
+ }
940
+
941
+ if (isRoot === void 0) {
942
+ isRoot = true;
943
+ }
944
+
945
+ if (isRoot) {
946
+ options.path = rootRouteId;
947
+ } else {
948
+ warning(!options.path, 'Routes must have a path property.');
949
+ } // Strip the root from parentIds
950
+
951
+
952
+ if (parentId === rootRouteId) {
953
+ parentId = '';
954
+ }
955
+
956
+ let path = String(isRoot ? rootRouteId : options.path); // If the path is anything other than an index path, trim it up
957
+
958
+ if (path !== '/') {
959
+ path = trimPath(path);
960
+ }
961
+
962
+ let id = joinPaths([parentId, path]);
963
+
964
+ if (path === rootRouteId) {
965
+ path = '/';
966
+ }
967
+
968
+ if (id !== rootRouteId) {
969
+ id = joinPaths(['/', id]);
970
+ }
971
+
972
+ const fullPath = id === rootRouteId ? '/' : trimPathRight(id);
973
+ return {
974
+ id: id,
975
+ path: path,
976
+ fullPath: fullPath,
977
+ options: options,
978
+ children,
979
+ addChildren: cb => createRouteConfig(options, cb(childOptions => createRouteConfig(childOptions, undefined, false, id)), false, parentId)
980
+ };
981
+ };
982
+ const rootRouteId = '__root__';
983
+ // Source
984
+ // Detect if we're in the DOM
985
+ const isDOM$1 = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement); // This is the default history object if none is defined
986
+
987
+ const createDefaultHistory = () => isDOM$1 ? createBrowserHistory() : createMemoryHistory();
988
+
989
+ function createRouter(userOptions) {
990
+ var _userOptions$stringif, _userOptions$parseSea;
991
+
992
+ const history = (userOptions == null ? void 0 : userOptions.history) || createDefaultHistory();
993
+
994
+ const originalOptions = _extends$1({}, userOptions, {
995
+ stringifySearch: (_userOptions$stringif = userOptions == null ? void 0 : userOptions.stringifySearch) != null ? _userOptions$stringif : defaultStringifySearch,
996
+ parseSearch: (_userOptions$parseSea = userOptions == null ? void 0 : userOptions.parseSearch) != null ? _userOptions$parseSea : defaultParseSearch
997
+ });
998
+
999
+ let router = {
1000
+ options: originalOptions,
1001
+ listeners: [],
1002
+ // Resolved after construction
1003
+ basepath: '',
1004
+ routeTree: undefined,
1005
+ routesById: {},
1006
+ location: undefined,
1007
+ allRouteInfo: undefined,
1008
+ //
1009
+ navigationPromise: Promise.resolve(),
1010
+ resolveNavigation: () => {},
1011
+ preloadCache: {},
1012
+ state: {
1013
+ status: 'idle',
1014
+ location: null,
1015
+ matches: [],
1016
+ actions: {},
1017
+ loaderData: {},
1018
+ lastUpdated: Date.now()
1019
+ },
1020
+ startedLoadingAt: Date.now(),
1021
+ subscribe: listener => {
1022
+ router.listeners.push(listener);
1023
+ return () => {
1024
+ router.listeners = router.listeners.filter(x => x !== listener);
1025
+ };
1026
+ },
1027
+ getRoute: id => {
1028
+ return router.routesById[id];
1029
+ },
1030
+ notify: () => {
1031
+ router.state = _extends$1({}, router.state);
1032
+ router.listeners.forEach(listener => listener());
1033
+ },
1034
+ mount: () => {
1035
+ const next = router.buildLocation({
1036
+ to: '.',
1037
+ search: true,
1038
+ hash: true
1039
+ }); // If the current location isn't updated, trigger a navigation
1040
+ // to the current location. Otherwise, load the current location.
1041
+
1042
+ if (next.href !== router.location.href) {
1043
+ return router.commitLocation(next, true);
1044
+ } else {
1045
+ return router.loadLocation();
1046
+ }
1047
+ },
1048
+ update: opts => {
1049
+ Object.assign(router.options, opts);
1050
+ const {
1051
+ basepath,
1052
+ routeConfig
1053
+ } = router.options;
1054
+ router.basepath = cleanPath("/" + (basepath != null ? basepath : ''));
1055
+
1056
+ if (routeConfig) {
1057
+ router.routesById = {};
1058
+ router.routeTree = router.buildRouteTree(routeConfig);
1059
+ }
1060
+
1061
+ return router;
1062
+ },
1063
+ destroy: history.listen(event => {
1064
+ router.loadLocation(router.parseLocation(event.location, router.location));
1065
+ }),
1066
+ buildRouteTree: rootRouteConfig => {
1067
+ const recurseRoutes = (routeConfigs, parent) => {
1068
+ return routeConfigs.map(routeConfig => {
1069
+ const routeOptions = routeConfig.options;
1070
+ const route = createRoute(routeConfig, routeOptions, parent, router); // {
1071
+ // pendingMs: routeOptions.pendingMs ?? router.defaultPendingMs,
1072
+ // pendingMinMs: routeOptions.pendingMinMs ?? router.defaultPendingMinMs,
1073
+ // }
1074
+
1075
+ const existingRoute = router.routesById[route.routeId];
1076
+
1077
+ if (existingRoute) {
1078
+ if (process.env.NODE_ENV !== 'production') {
1079
+ console.warn("Duplicate routes found with id: " + String(route.routeId), router.routesById, route);
1080
+ }
1081
+
1082
+ throw new Error();
1083
+ }
1084
+ router.routesById[route.routeId] = route;
1085
+ const children = routeConfig.children;
1086
+ route.childRoutes = children != null && children.length ? recurseRoutes(children, route) : undefined;
1087
+ return route;
1088
+ });
1089
+ };
1090
+
1091
+ const routes = recurseRoutes([rootRouteConfig]);
1092
+ return routes[0];
1093
+ },
1094
+ parseLocation: (location, previousLocation) => {
1095
+ var _location$hash$split$;
1096
+
1097
+ const parsedSearch = router.options.parseSearch(location.search);
1098
+ return {
1099
+ pathname: location.pathname,
1100
+ searchStr: location.search,
1101
+ search: replaceEqualDeep(previousLocation == null ? void 0 : previousLocation.search, parsedSearch),
1102
+ hash: (_location$hash$split$ = location.hash.split('#').reverse()[0]) != null ? _location$hash$split$ : '',
1103
+ href: "" + location.pathname + location.search + location.hash,
1104
+ state: location.state,
1105
+ key: location.key
1106
+ };
1107
+ },
1108
+ buildLocation: function buildLocation(dest) {
1109
+ var _dest$from, _router$basepath, _dest$to, _last, _dest$params, _dest$__preSearchFilt, _functionalUpdate, _dest$__preSearchFilt2, _dest$__postSearchFil;
1110
+
1111
+ if (dest === void 0) {
1112
+ dest = {};
1113
+ }
1114
+
1115
+ // const resolvedFrom: Location = {
1116
+ // ...router.location,
1117
+ const fromPathname = dest.fromCurrent ? router.location.pathname : (_dest$from = dest.from) != null ? _dest$from : router.location.pathname;
1118
+
1119
+ let pathname = _resolvePath((_router$basepath = router.basepath) != null ? _router$basepath : '/', fromPathname, "" + ((_dest$to = dest.to) != null ? _dest$to : '.'));
1120
+
1121
+ const fromMatches = router.matchRoutes(router.location.pathname, {
1122
+ strictParseParams: true
1123
+ });
1124
+ const toMatches = router.matchRoutes(pathname);
1125
+ const prevParams = (_last = last(fromMatches)) == null ? void 0 : _last.params;
1126
+ let nextParams = ((_dest$params = dest.params) != null ? _dest$params : true) === true ? prevParams : functionalUpdate(dest.params, prevParams);
1127
+
1128
+ if (nextParams) {
1129
+ toMatches.map(d => d.options.stringifyParams).filter(Boolean).forEach(fn => {
1130
+ Object.assign(nextParams, fn(nextParams));
1131
+ });
1132
+ }
1133
+
1134
+ pathname = interpolatePath(pathname, nextParams != null ? nextParams : {}); // Pre filters first
1135
+
1136
+ const preFilteredSearch = (_dest$__preSearchFilt = dest.__preSearchFilters) != null && _dest$__preSearchFilt.length ? dest.__preSearchFilters.reduce((prev, next) => next(prev), router.location.search) : router.location.search; // Then the link/navigate function
1137
+
1138
+ const destSearch = dest.search === true ? preFilteredSearch // Preserve resolvedFrom true
1139
+ : dest.search ? (_functionalUpdate = functionalUpdate(dest.search, preFilteredSearch)) != null ? _functionalUpdate : {} // Updater
1140
+ : (_dest$__preSearchFilt2 = dest.__preSearchFilters) != null && _dest$__preSearchFilt2.length ? preFilteredSearch // Preserve resolvedFrom filters
1141
+ : {}; // Then post filters
1142
+
1143
+ const postFilteredSearch = (_dest$__postSearchFil = dest.__postSearchFilters) != null && _dest$__postSearchFil.length ? dest.__postSearchFilters.reduce((prev, next) => next(prev), destSearch) : destSearch;
1144
+ const search = replaceEqualDeep(router.location.search, postFilteredSearch);
1145
+ const searchStr = router.options.stringifySearch(search);
1146
+ let hash = dest.hash === true ? router.location.hash : functionalUpdate(dest.hash, router.location.hash);
1147
+ hash = hash ? "#" + hash : '';
1148
+ return {
1149
+ pathname,
1150
+ search,
1151
+ searchStr,
1152
+ state: router.location.state,
1153
+ hash,
1154
+ href: "" + pathname + searchStr + hash,
1155
+ key: dest.key
1156
+ };
1157
+ },
1158
+ commitLocation: (next, replace) => {
1159
+ const id = '' + Date.now() + Math.random();
1160
+ if (router.navigateTimeout) clearTimeout(router.navigateTimeout);
1161
+ let nextAction = 'replace';
1162
+
1163
+ if (!replace) {
1164
+ nextAction = 'push';
1165
+ }
1166
+
1167
+ const isSameUrl = router.parseLocation(history.location).href === next.href;
1168
+
1169
+ if (isSameUrl && !next.key) {
1170
+ nextAction = 'replace';
1171
+ }
1172
+
1173
+ if (nextAction === 'replace') {
1174
+ history.replace({
1175
+ pathname: next.pathname,
1176
+ hash: next.hash,
1177
+ search: next.searchStr
1178
+ }, {
1179
+ id
1180
+ });
1181
+ } else {
1182
+ history.push({
1183
+ pathname: next.pathname,
1184
+ hash: next.hash,
1185
+ search: next.searchStr
1186
+ }, {
1187
+ id
1188
+ });
1189
+ }
1190
+
1191
+ router.navigationPromise = new Promise(resolve => {
1192
+ const previousNavigationResolve = router.resolveNavigation;
1193
+
1194
+ router.resolveNavigation = () => {
1195
+ previousNavigationResolve();
1196
+ resolve();
1197
+ };
1198
+ });
1199
+ return router.navigationPromise;
1200
+ },
1201
+ buildNext: opts => {
1202
+ const next = router.buildLocation(opts);
1203
+ const matches = router.matchRoutes(next.pathname);
1204
+
1205
+ const __preSearchFilters = matches.map(match => {
1206
+ var _match$options$preSea;
1207
+
1208
+ return (_match$options$preSea = match.options.preSearchFilters) != null ? _match$options$preSea : [];
1209
+ }).flat().filter(Boolean);
1210
+
1211
+ const __postSearchFilters = matches.map(match => {
1212
+ var _match$options$postSe;
1213
+
1214
+ return (_match$options$postSe = match.options.postSearchFilters) != null ? _match$options$postSe : [];
1215
+ }).flat().filter(Boolean);
1216
+
1217
+ return router.buildLocation(_extends$1({}, opts, {
1218
+ __preSearchFilters,
1219
+ __postSearchFilters
1220
+ }));
1221
+ },
1222
+ cancelMatches: () => {
1223
+ var _router$state$pending, _router$state$pending2;
1224
+ [...router.state.matches, ...((_router$state$pending = (_router$state$pending2 = router.state.pending) == null ? void 0 : _router$state$pending2.matches) != null ? _router$state$pending : [])].forEach(match => {
1225
+ match.cancel();
1226
+ });
1227
+ },
1228
+ loadLocation: async next => {
1229
+ const id = Math.random();
1230
+ router.startedLoadingAt = id;
1231
+
1232
+ if (next) {
1233
+ // Ingest the new location
1234
+ router.location = next;
1235
+ } // Cancel any pending matches
1236
+
1237
+
1238
+ router.cancelMatches(); // Match the routes
1239
+
1240
+ const unloadedMatches = router.matchRoutes(location.pathname, {
1241
+ strictParseParams: true
1242
+ });
1243
+ unloadedMatches.forEach((match, index) => {
1244
+ const parent = unloadedMatches[index - 1];
1245
+ const child = unloadedMatches[index + 1];
1246
+ if (parent) match.__.setParentMatch(parent);
1247
+ if (child) match.__.addChildMatch(child);
1248
+ });
1249
+ router.state = _extends$1({}, router.state, {
1250
+ pending: {
1251
+ matches: unloadedMatches,
1252
+ location: router.location
1253
+ }
1254
+ });
1255
+ router.notify(); // Load the matches
1256
+
1257
+ const matches = await router.loadMatches(unloadedMatches, {
1258
+ withPending: true
1259
+ });
1260
+
1261
+ if (router.startedLoadingAt !== id) {
1262
+ // Ignore side-effects of match loading
1263
+ return router.navigationPromise;
1264
+ }
1265
+
1266
+ const previousMatches = router.state.matches;
1267
+ previousMatches.filter(d => {
1268
+ return !matches.find(dd => dd.matchId === d.matchId);
1269
+ }).forEach(d => {
1270
+ d.__.onExit == null ? void 0 : d.__.onExit({
1271
+ params: d.params,
1272
+ search: d.routeSearch
1273
+ });
1274
+ });
1275
+ previousMatches.filter(d => {
1276
+ return matches.find(dd => dd.matchId === d.matchId);
1277
+ }).forEach(d => {
1278
+ d.options.onTransition == null ? void 0 : d.options.onTransition({
1279
+ params: d.params,
1280
+ search: d.routeSearch
1281
+ });
1282
+ });
1283
+ matches.filter(d => {
1284
+ return !previousMatches.find(dd => dd.matchId === d.matchId);
1285
+ }).forEach(d => {
1286
+ d.__.onExit = d.options.onMatch == null ? void 0 : d.options.onMatch({
1287
+ params: d.params,
1288
+ search: d.search
1289
+ });
1290
+ });
1291
+ router.state = _extends$1({}, router.state, {
1292
+ location: router.location,
1293
+ matches,
1294
+ pending: undefined
1295
+ });
1296
+
1297
+ if (matches.some(d => d.status === 'loading')) {
1298
+ router.notify();
1299
+ await Promise.all(matches.map(d => d.__.loaderPromise || Promise.resolve()));
1300
+ }
1301
+
1302
+ if (router.startedLoadingAt !== id) {
1303
+ // Ignore side-effects of match loading
1304
+ return;
1305
+ }
1306
+
1307
+ router.notify();
1308
+ router.resolveNavigation();
1309
+ },
1310
+ cleanPreloadCache: () => {
1311
+ const now = Date.now();
1312
+ Object.keys(router.preloadCache).forEach(matchId => {
1313
+ const entry = router.preloadCache[matchId]; // Don't remove loading matches
1314
+
1315
+ if (entry.match.status === 'loading') {
1316
+ return;
1317
+ } // Do not remove successful matches that are still valid
1318
+
1319
+
1320
+ if (entry.match.updatedAt && entry.match.updatedAt + entry.maxAge > now) {
1321
+ return;
1322
+ } // Everything else gets removed
1323
+
1324
+
1325
+ delete router.preloadCache[matchId];
1326
+ });
1327
+ },
1328
+ loadRoute: async function loadRoute(navigateOpts, loaderOpts) {
1329
+ if (navigateOpts === void 0) {
1330
+ navigateOpts = router.location;
1331
+ }
1332
+
1333
+ const next = router.buildNext(navigateOpts);
1334
+ const matches = router.matchRoutes(next.pathname, {
1335
+ strictParseParams: true
1336
+ });
1337
+ await router.loadMatches(matches, {
1338
+ preload: true,
1339
+ maxAge: loaderOpts.maxAge
1340
+ });
1341
+ return matches;
1342
+ },
1343
+ matchRoutes: (pathname, opts) => {
1344
+ var _router$state$pending3, _router$state$pending4;
1345
+
1346
+ router.cleanPreloadCache();
1347
+ const matches = [];
1348
+
1349
+ if (!router.routeTree) {
1350
+ return matches;
1351
+ }
1352
+
1353
+ const existingMatches = [...router.state.matches, ...((_router$state$pending3 = (_router$state$pending4 = router.state.pending) == null ? void 0 : _router$state$pending4.matches) != null ? _router$state$pending3 : [])];
1354
+
1355
+ const recurse = async (routes, parentMatch) => {
1356
+ var _parentMatch$params, _router$options$filte, _router$preloadCache$, _route$childRoutes2;
1357
+
1358
+ let params = (_parentMatch$params = parentMatch == null ? void 0 : parentMatch.params) != null ? _parentMatch$params : {};
1359
+ const filteredRoutes = (_router$options$filte = router.options.filterRoutes == null ? void 0 : router.options.filterRoutes(routes)) != null ? _router$options$filte : routes;
1360
+ const route = filteredRoutes == null ? void 0 : filteredRoutes.find(route => {
1361
+ var _route$childRoutes, _route$options$caseSe;
1362
+
1363
+ const fuzzy = !!(route.routePath !== '/' || (_route$childRoutes = route.childRoutes) != null && _route$childRoutes.length);
1364
+ const matchParams = matchPathname(pathname, {
1365
+ to: route.fullPath,
1366
+ fuzzy,
1367
+ caseSensitive: (_route$options$caseSe = route.options.caseSensitive) != null ? _route$options$caseSe : router.options.caseSensitive
1368
+ });
1369
+
1370
+ if (matchParams) {
1371
+ let parsedParams;
1372
+
1373
+ try {
1374
+ var _route$options$parseP;
1375
+
1376
+ parsedParams = (_route$options$parseP = route.options.parseParams == null ? void 0 : route.options.parseParams(matchParams)) != null ? _route$options$parseP : matchParams;
1377
+ } catch (err) {
1378
+ if (opts != null && opts.strictParseParams) {
1379
+ throw err;
1380
+ }
1381
+ }
1382
+
1383
+ params = _extends$1({}, params, parsedParams);
1384
+ }
1385
+
1386
+ return !!matchParams;
1387
+ });
1388
+
1389
+ if (!route) {
1390
+ return;
1391
+ }
1392
+
1393
+ const interpolatedPath = interpolatePath(route.routePath, params);
1394
+ const matchId = interpolatePath(route.routeId, params, true);
1395
+ const match = existingMatches.find(d => d.matchId === matchId) || ((_router$preloadCache$ = router.preloadCache[matchId]) == null ? void 0 : _router$preloadCache$.match) || createRouteMatch(router, route, {
1396
+ matchId,
1397
+ params,
1398
+ pathname: joinPaths([pathname, interpolatedPath])
1399
+ });
1400
+ matches.push(match);
1401
+
1402
+ if ((_route$childRoutes2 = route.childRoutes) != null && _route$childRoutes2.length) {
1403
+ recurse(route.childRoutes, match);
1404
+ }
1405
+ };
1406
+
1407
+ recurse([router.routeTree]);
1408
+ return matches;
1409
+ },
1410
+ loadMatches: async (resolvedMatches, loaderOpts) => {
1411
+ const matchPromises = resolvedMatches.map(async match => {
1412
+ // Validate the match (loads search params etc)
1413
+ match.__.validate(); // If this is a preload, add it to the preload cache
1414
+
1415
+
1416
+ if (loaderOpts != null && loaderOpts.preload) {
1417
+ router.preloadCache[match.matchId] = {
1418
+ maxAge: loaderOpts == null ? void 0 : loaderOpts.maxAge,
1419
+ match
1420
+ };
1421
+ } // If the match is invalid, errored or idle, trigger it to load
1422
+
1423
+
1424
+ if (match.status === 'success' && match.isInvalid || match.status === 'error' || match.status === 'idle') {
1425
+ match.load();
1426
+ } // If requested, start the pending timers
1427
+
1428
+
1429
+ if (loaderOpts != null && loaderOpts.withPending) match.__.startPending(); // Wait for the first sign of activity from the match
1430
+ // This might be completion, error, or a pending state
1431
+
1432
+ await match.__.loadPromise;
1433
+ });
1434
+ router.notify();
1435
+ await Promise.all(matchPromises);
1436
+ return resolvedMatches;
1437
+ },
1438
+ invalidateRoute: opts => {
1439
+ var _router$state$pending5, _router$state$pending6;
1440
+
1441
+ const next = router.buildNext(opts);
1442
+ const unloadedMatchIds = router.matchRoutes(next.pathname).map(d => d.matchId);
1443
+ [...router.state.matches, ...((_router$state$pending5 = (_router$state$pending6 = router.state.pending) == null ? void 0 : _router$state$pending6.matches) != null ? _router$state$pending5 : [])].forEach(match => {
1444
+ if (unloadedMatchIds.includes(match.matchId)) {
1445
+ match.isInvalid = true;
1446
+ }
1447
+ });
1448
+ },
1449
+ reload: () => router._navigate({
1450
+ fromCurrent: true,
1451
+ replace: true,
1452
+ search: true
1453
+ }),
1454
+ resolvePath: (from, path) => {
1455
+ return _resolvePath(router.basepath, from, cleanPath(path));
1456
+ },
1457
+ matchRoute: (location, opts) => {
1458
+ var _location$from;
1459
+
1460
+ // const location = router.buildNext(opts)
1461
+ location = _extends$1({}, location, {
1462
+ to: location.to ? router.resolvePath((_location$from = location.from) != null ? _location$from : '', location.to) : undefined
1463
+ });
1464
+ const next = router.buildNext(location);
1465
+
1466
+ if (opts != null && opts.pending) {
1467
+ var _router$state$pending7;
1468
+
1469
+ if (!((_router$state$pending7 = router.state.pending) != null && _router$state$pending7.location)) {
1470
+ return false;
1471
+ }
1472
+
1473
+ return !!matchPathname(router.state.pending.location.pathname, _extends$1({}, opts, {
1474
+ to: next.pathname
1475
+ }));
1476
+ }
1477
+
1478
+ return !!matchPathname(router.state.location.pathname, _extends$1({}, opts, {
1479
+ to: next.pathname
1480
+ }));
1481
+ },
1482
+ _navigate: location => {
1483
+ const next = router.buildNext(location);
1484
+ return router.commitLocation(next, location.replace);
1485
+ },
1486
+ navigate: async _ref => {
1487
+ let {
1488
+ from,
1489
+ to = '.',
1490
+ search,
1491
+ hash,
1492
+ replace
1493
+ } = _ref;
1494
+ // If this link simply reloads the current route,
1495
+ // make sure it has a new key so it will trigger a data refresh
1496
+ // If this `to` is a valid external URL, return
1497
+ // null for LinkUtils
1498
+ const toString = String(to);
1499
+ const fromString = String(from);
1500
+ let isExternal;
1501
+
1502
+ try {
1503
+ new URL("" + toString);
1504
+ isExternal = true;
1505
+ } catch (e) {}
1506
+
1507
+ if (isExternal) {
1508
+ if (process.env.NODE_ENV !== 'production') {
1509
+ throw new Error('Attempting to navigate to external url with router.navigate!');
1510
+ }
1511
+
1512
+ return;
1513
+ }
1514
+
1515
+ return router._navigate({
1516
+ from: fromString,
1517
+ to: toString,
1518
+ search,
1519
+ hash
1520
+ });
1521
+ },
1522
+ buildLink: _ref2 => {
1523
+ var _preload, _ref3, _ref4;
1524
+
1525
+ let {
1526
+ from,
1527
+ to = '.',
1528
+ search,
1529
+ params,
1530
+ hash,
1531
+ target,
1532
+ replace,
1533
+ activeOptions,
1534
+ preload,
1535
+ preloadMaxAge: userPreloadMaxAge,
1536
+ preloadDelay: userPreloadDelay,
1537
+ disabled
1538
+ } = _ref2;
1539
+
1540
+ // If this link simply reloads the current route,
1541
+ // make sure it has a new key so it will trigger a data refresh
1542
+ // If this `to` is a valid external URL, return
1543
+ // null for LinkUtils
1544
+ try {
1545
+ new URL("" + to);
1546
+ return {
1547
+ type: 'external',
1548
+ href: to
1549
+ };
1550
+ } catch (e) {}
1551
+
1552
+ const nextOpts = {
1553
+ from,
1554
+ to,
1555
+ search,
1556
+ params,
1557
+ hash,
1558
+ replace
1559
+ };
1560
+ const next = router.buildNext(nextOpts);
1561
+ preload = (_preload = preload) != null ? _preload : router.options.defaultLinkPreload;
1562
+ const preloadMaxAge = (_ref3 = userPreloadMaxAge != null ? userPreloadMaxAge : router.options.defaultLinkPreloadMaxAge) != null ? _ref3 : 2000;
1563
+ const preloadDelay = (_ref4 = userPreloadDelay != null ? userPreloadDelay : router.options.defaultLinkPreloadDelay) != null ? _ref4 : 50; // Compare path/hash for matches
1564
+
1565
+ const pathIsEqual = router.state.location.pathname === next.pathname;
1566
+ const currentPathSplit = router.state.location.pathname.split('/');
1567
+ const nextPathSplit = next.pathname.split('/');
1568
+ const pathIsFuzzyEqual = nextPathSplit.every((d, i) => d === currentPathSplit[i]);
1569
+ const hashIsEqual = router.state.location.hash === next.hash; // Combine the matches based on user options
1570
+
1571
+ const pathTest = activeOptions != null && activeOptions.exact ? pathIsEqual : pathIsFuzzyEqual;
1572
+ const hashTest = activeOptions != null && activeOptions.includeHash ? hashIsEqual : true; // The final "active" test
1573
+
1574
+ const isActive = pathTest && hashTest; // The click handler
1575
+
1576
+ const handleClick = e => {
1577
+ if (!disabled && !isCtrlEvent(e) && !e.defaultPrevented && (!target || target === '_self') && e.button === 0) {
1578
+ e.preventDefault();
1579
+
1580
+ if (pathIsEqual && !search && !hash) {
1581
+ router.invalidateRoute(nextOpts);
1582
+ } // All is well? Navigate!)
1583
+
1584
+
1585
+ router._navigate(nextOpts);
1586
+ }
1587
+ }; // The click handler
1588
+
1589
+
1590
+ const handleFocus = e => {
1591
+ if (preload && preloadMaxAge > 0) {
1592
+ router.loadRoute(nextOpts, {
1593
+ maxAge: preloadMaxAge
1594
+ });
1595
+ }
1596
+ };
1597
+
1598
+ const handleEnter = e => {
1599
+ const target = e.target || {};
1600
+
1601
+ if (preload && preloadMaxAge > 0) {
1602
+ if (target.preloadTimeout) {
1603
+ return;
1604
+ }
1605
+
1606
+ target.preloadTimeout = setTimeout(() => {
1607
+ target.preloadTimeout = null;
1608
+ router.loadRoute(nextOpts, {
1609
+ maxAge: preloadMaxAge
1610
+ });
1611
+ }, preloadDelay);
1612
+ }
1613
+ };
1614
+
1615
+ const handleLeave = e => {
1616
+ const target = e.target || {};
1617
+
1618
+ if (target.preloadTimeout) {
1619
+ clearTimeout(target.preloadTimeout);
1620
+ target.preloadTimeout = null;
1621
+ }
1622
+ };
1623
+
1624
+ return {
1625
+ type: 'internal',
1626
+ next,
1627
+ handleFocus,
1628
+ handleClick,
1629
+ handleEnter,
1630
+ handleLeave,
1631
+ isActive,
1632
+ disabled
1633
+ };
1634
+ },
1635
+ __experimental__createSnapshot: () => {
1636
+ return _extends$1({}, router.state, {
1637
+ matches: router.state.matches.map(_ref5 => {
1638
+ let {
1639
+ routeLoaderData: loaderData,
1640
+ matchId
1641
+ } = _ref5;
1642
+ return {
1643
+ matchId,
1644
+ loaderData
1645
+ };
1646
+ })
1647
+ });
1648
+ }
1649
+ };
1650
+ router.location = router.parseLocation(history.location); // router.state.location = __experimental__snapshot?.location ?? router.location
1651
+
1652
+ router.state.location = router.location;
1653
+ router.update(userOptions); // Allow frameworks to hook into the router creation
1654
+
1655
+ router.options.createRouter == null ? void 0 : router.options.createRouter(router); // router.mount()
1656
+
1657
+ return router;
1658
+ }
1659
+ function createRoute(routeConfig, options, parent, router) {
1660
+ // const id = (
1661
+ // options.path === rootRouteId
1662
+ // ? rootRouteId
1663
+ // : joinPaths([
1664
+ // parent!.id,
1665
+ // `${options.path?.replace(/(.)\/$/, '$1')}`,
1666
+ // ]).replace(new RegExp(`^${rootRouteId}`), '')
1667
+ // ) as TRouteInfo['id']
1668
+ const {
1669
+ id: routeId,
1670
+ path: routePath,
1671
+ fullPath
1672
+ } = routeConfig;
1673
+
1674
+ const action = router.state.actions[routeId] || (() => {
1675
+ router.state.actions[routeId] = {
1676
+ pending: [],
1677
+ submit: async (submission, actionOpts) => {
1678
+ var _actionOpts$invalidat;
1679
+
1680
+ if (!route) {
1681
+ return;
1682
+ }
1683
+
1684
+ const invalidate = (_actionOpts$invalidat = actionOpts == null ? void 0 : actionOpts.invalidate) != null ? _actionOpts$invalidat : true;
1685
+ const actionState = {
1686
+ submittedAt: Date.now(),
1687
+ status: 'pending',
1688
+ submission
1689
+ };
1690
+ action.latest = actionState;
1691
+ action.pending.push(actionState);
1692
+ router.state = _extends$1({}, router.state, {
1693
+ action: actionState
1694
+ });
1695
+ router.notify();
1696
+
1697
+ try {
1698
+ const res = await (route.options.action == null ? void 0 : route.options.action(submission));
1699
+ actionState.data = res;
1700
+
1701
+ if (invalidate) {
1702
+ router.invalidateRoute({
1703
+ to: '.',
1704
+ fromCurrent: true
1705
+ });
1706
+ await router.reload();
1707
+ }
1708
+
1709
+ actionState.status = 'success';
1710
+ return res;
1711
+ } catch (err) {
1712
+ console.error(err);
1713
+ actionState.error = err;
1714
+ actionState.status = 'error';
1715
+ } finally {
1716
+ action.pending = action.pending.filter(d => d !== actionState);
1717
+
1718
+ if (actionState === router.state.action) {
1719
+ router.state.action = undefined;
1720
+ }
1721
+
1722
+ router.notify();
1723
+ }
1724
+ }
1725
+ };
1726
+ return router.state.actions[routeId];
1727
+ })();
1728
+
1729
+ let route = {
1730
+ routeId,
1731
+ routePath,
1732
+ fullPath,
1733
+ options,
1734
+ router,
1735
+ childRoutes: undefined,
1736
+ parentRoute: parent,
1737
+ action,
1738
+ buildLink: options => {
1739
+ return router.buildLink(_extends$1({}, options, {
1740
+ from: fullPath
1741
+ }));
1742
+ },
1743
+ navigate: options => {
1744
+ return router.navigate(_extends$1({}, options, {
1745
+ from: fullPath
1746
+ }));
1747
+ },
1748
+ matchRoute: (matchLocation, opts) => {
1749
+ return router.matchRoute(_extends$1({}, matchLocation, {
1750
+ from: fullPath
1751
+ }), opts);
1752
+ }
1753
+ };
1754
+ router.options.createRoute == null ? void 0 : router.options.createRoute({
1755
+ router,
1756
+ route
1757
+ });
1758
+ return route;
1759
+ }
1760
+ function createRouteMatch(router, route, opts) {
1761
+ const routeMatch = _extends$1({}, route, opts, {
1762
+ router,
1763
+ routeSearch: {},
1764
+ search: {},
1765
+ childMatches: [],
1766
+ status: 'idle',
1767
+ routeLoaderData: {},
1768
+ loaderData: {},
1769
+ isPending: false,
1770
+ isFetching: false,
1771
+ isInvalid: false,
1772
+ __: {
1773
+ abortController: new AbortController(),
1774
+ latestId: '',
1775
+ resolve: () => {},
1776
+ notify: () => {
1777
+ routeMatch.__.resolve();
1778
+
1779
+ routeMatch.router.notify();
1780
+ },
1781
+ startPending: () => {
1782
+ var _routeMatch$options$p, _routeMatch$options$p2;
1783
+
1784
+ const pendingMs = (_routeMatch$options$p = routeMatch.options.pendingMs) != null ? _routeMatch$options$p : router.options.defaultPendingMs;
1785
+ const pendingMinMs = (_routeMatch$options$p2 = routeMatch.options.pendingMinMs) != null ? _routeMatch$options$p2 : router.options.defaultPendingMinMs;
1786
+
1787
+ if (routeMatch.__.pendingTimeout || routeMatch.status !== 'loading' || typeof pendingMs === 'undefined') {
1788
+ return;
1789
+ }
1790
+
1791
+ routeMatch.__.pendingTimeout = setTimeout(() => {
1792
+ routeMatch.isPending = true;
1793
+
1794
+ routeMatch.__.resolve();
1795
+
1796
+ if (typeof pendingMinMs !== 'undefined') {
1797
+ routeMatch.__.pendingMinPromise = new Promise(r => routeMatch.__.pendingMinTimeout = setTimeout(r, pendingMinMs));
1798
+ }
1799
+ }, pendingMs);
1800
+ },
1801
+ cancelPending: () => {
1802
+ routeMatch.isPending = false;
1803
+ clearTimeout(routeMatch.__.pendingTimeout);
1804
+ clearTimeout(routeMatch.__.pendingMinTimeout);
1805
+ delete routeMatch.__.pendingMinPromise;
1806
+ },
1807
+ setParentMatch: parentMatch => {
1808
+ routeMatch.parentMatch = parentMatch;
1809
+ },
1810
+ addChildMatch: childMatch => {
1811
+ if (routeMatch.childMatches.find(d => d.matchId === childMatch.matchId)) {
1812
+ return;
1813
+ }
1814
+
1815
+ routeMatch.childMatches.push(childMatch);
1816
+ },
1817
+ validate: () => {
1818
+ var _routeMatch$parentMat, _routeMatch$parentMat2;
1819
+
1820
+ // Validate the search params and stabilize them
1821
+ const parentSearch = (_routeMatch$parentMat = (_routeMatch$parentMat2 = routeMatch.parentMatch) == null ? void 0 : _routeMatch$parentMat2.search) != null ? _routeMatch$parentMat : router.location.search;
1822
+
1823
+ try {
1824
+ const prevSearch = routeMatch.routeSearch;
1825
+ let nextSearch = replaceEqualDeep(prevSearch, routeMatch.options.validateSearch == null ? void 0 : routeMatch.options.validateSearch(parentSearch)); // Invalidate route matches when search param stability changes
1826
+
1827
+ if (prevSearch !== nextSearch) {
1828
+ routeMatch.isInvalid = true;
1829
+ }
1830
+
1831
+ routeMatch.routeSearch = nextSearch;
1832
+ routeMatch.search = replaceEqualDeep(parentSearch, _extends$1({}, parentSearch, nextSearch));
1833
+ } catch (err) {
1834
+ console.error(err);
1835
+ const error = new Error('Invalid search params found', {
1836
+ cause: err
1837
+ });
1838
+ error.code = 'INVALID_SEARCH_PARAMS';
1839
+ routeMatch.status = 'error';
1840
+ routeMatch.error = error; // Do not proceed with loading the route
1841
+
1842
+ return;
1843
+ }
1844
+ }
1845
+ },
1846
+ cancel: () => {
1847
+ var _routeMatch$__$abortC;
1848
+
1849
+ (_routeMatch$__$abortC = routeMatch.__.abortController) == null ? void 0 : _routeMatch$__$abortC.abort();
1850
+
1851
+ routeMatch.__.cancelPending();
1852
+ },
1853
+ load: async () => {
1854
+ const id = '' + Date.now() + Math.random();
1855
+ routeMatch.__.latestId = id; // If the match was in an error state, set it
1856
+ // to a loading state again. Otherwise, keep it
1857
+ // as loading or resolved
1858
+
1859
+ if (routeMatch.status === 'error' || routeMatch.status === 'idle') {
1860
+ routeMatch.status = 'loading';
1861
+ } // We started loading the route, so it's no longer invalid
1862
+
1863
+
1864
+ routeMatch.isInvalid = false;
1865
+ routeMatch.__.loadPromise = new Promise(async resolve => {
1866
+ // We are now fetching, even if it's in the background of a
1867
+ // resolved state
1868
+ routeMatch.isFetching = true;
1869
+ routeMatch.__.resolve = resolve;
1870
+
1871
+ const loaderPromise = (async () => {
1872
+ const importer = routeMatch.options.import; // First, run any importers
1873
+
1874
+ if (importer) {
1875
+ routeMatch.__.importPromise = importer({
1876
+ params: routeMatch.params // search: routeMatch.search,
1877
+
1878
+ }).then(imported => {
1879
+ routeMatch.__ = _extends$1({}, routeMatch.__, imported);
1880
+ });
1881
+ } // Wait for the importer to finish before
1882
+ // attempting to load elements and data
1883
+
1884
+
1885
+ await routeMatch.__.importPromise; // Next, load the elements and data in parallel
1886
+
1887
+ routeMatch.__.elementsPromise = (async () => {
1888
+ // then run all element and data loaders in parallel
1889
+ // For each element type, potentially load it asynchronously
1890
+ const elementTypes = ['element', 'errorElement', 'catchElement', 'pendingElement'];
1891
+ await Promise.all(elementTypes.map(async type => {
1892
+ const routeElement = routeMatch.options[type];
1893
+
1894
+ if (routeMatch.__[type]) {
1895
+ return;
1896
+ }
1897
+
1898
+ if (typeof routeElement === 'function') {
1899
+ const res = await routeElement(routeMatch);
1900
+ routeMatch.__[type] = res;
1901
+ } else {
1902
+ routeMatch.__[type] = routeMatch.options[type];
1903
+ }
1904
+ }));
1905
+ })();
1906
+
1907
+ routeMatch.__.dataPromise = Promise.resolve().then(async () => {
1908
+ try {
1909
+ const data = await (routeMatch.options.loader == null ? void 0 : routeMatch.options.loader({
1910
+ params: routeMatch.params,
1911
+ search: routeMatch.routeSearch,
1912
+ signal: routeMatch.__.abortController.signal
1913
+ }));
1914
+
1915
+ if (id !== routeMatch.__.latestId) {
1916
+ return routeMatch.__.loaderPromise;
1917
+ }
1918
+
1919
+ routeMatch.routeLoaderData = replaceEqualDeep(routeMatch.routeLoaderData, data);
1920
+ cascadeLoaderData(routeMatch);
1921
+ routeMatch.error = undefined;
1922
+ routeMatch.status = 'success';
1923
+ routeMatch.updatedAt = Date.now();
1924
+ } catch (err) {
1925
+ if (id !== routeMatch.__.latestId) {
1926
+ return routeMatch.__.loaderPromise;
1927
+ }
1928
+
1929
+ if (process.env.NODE_ENV !== 'production') {
1930
+ console.error(err);
1931
+ }
1932
+
1933
+ routeMatch.error = err;
1934
+ routeMatch.status = 'error';
1935
+ routeMatch.updatedAt = Date.now();
1936
+ }
1937
+ });
1938
+
1939
+ try {
1940
+ await Promise.all([routeMatch.__.elementsPromise, routeMatch.__.dataPromise]);
1941
+
1942
+ if (id !== routeMatch.__.latestId) {
1943
+ return routeMatch.__.loaderPromise;
1944
+ }
1945
+
1946
+ if (routeMatch.__.pendingMinPromise) {
1947
+ await routeMatch.__.pendingMinPromise;
1948
+ delete routeMatch.__.pendingMinPromise;
1949
+ }
1950
+ } finally {
1951
+ if (id !== routeMatch.__.latestId) {
1952
+ return routeMatch.__.loaderPromise;
1953
+ }
1954
+
1955
+ routeMatch.__.cancelPending();
1956
+
1957
+ routeMatch.isPending = false;
1958
+ routeMatch.isFetching = false;
1959
+
1960
+ routeMatch.__.notify();
1961
+ }
1962
+ })();
1963
+
1964
+ routeMatch.__.loaderPromise = loaderPromise;
1965
+ await loaderPromise;
1966
+
1967
+ if (id !== routeMatch.__.latestId) {
1968
+ return routeMatch.__.loaderPromise;
1969
+ }
1970
+
1971
+ delete routeMatch.__.loaderPromise;
1972
+ });
1973
+ return await routeMatch.__.loadPromise;
1974
+ }
1975
+ });
1976
+
1977
+ return routeMatch;
1978
+ }
1979
+
1980
+ function cascadeLoaderData(routeMatch) {
1981
+ if (routeMatch.parentMatch) {
1982
+ routeMatch.loaderData = replaceEqualDeep(routeMatch.loaderData, _extends$1({}, routeMatch.parentMatch.loaderData, routeMatch.routeLoaderData));
1983
+ }
1984
+
1985
+ if (routeMatch.childMatches.length) {
1986
+ routeMatch.childMatches.forEach(childMatch => {
1987
+ cascadeLoaderData(childMatch);
1988
+ });
1989
+ }
1990
+ }
1991
+
1992
+ function matchPathname(currentPathname, matchLocation) {
1993
+ const pathParams = matchByPath(currentPathname, matchLocation); // const searchMatched = matchBySearch(currentLocation.search, matchLocation)
1994
+
1995
+ if (matchLocation.to && !pathParams) {
1996
+ return;
1997
+ } // if (matchLocation.search && !searchMatched) {
1998
+ // return
1999
+ // }
2000
+
2001
+
2002
+ return pathParams != null ? pathParams : {};
2003
+ }
2004
+
2005
+ function interpolatePath(path, params, leaveWildcard) {
2006
+ const interpolatedPathSegments = parsePathname(path);
2007
+ return joinPaths(interpolatedPathSegments.map(segment => {
2008
+ if (segment.value === '*' && !leaveWildcard) {
2009
+ return '';
2010
+ }
2011
+
2012
+ if (segment.type === 'param') {
2013
+ var _segment$value$substr;
2014
+
2015
+ return (_segment$value$substr = params[segment.value.substring(1)]) != null ? _segment$value$substr : '';
2016
+ }
2017
+
2018
+ return segment.value;
2019
+ }));
2020
+ }
2021
+
2022
+ function warning(cond, message) {
2023
+ if (cond) {
2024
+ if (typeof console !== 'undefined') console.warn(message);
2025
+
2026
+ try {
2027
+ throw new Error(message);
2028
+ } catch (_unused) {}
2029
+ }
2030
+
2031
+ return true;
2032
+ }
2033
+
2034
+ function isFunction(d) {
2035
+ return typeof d === 'function';
2036
+ }
2037
+
2038
+ function functionalUpdate(updater, previous) {
2039
+ if (isFunction(updater)) {
2040
+ return updater(previous);
2041
+ }
2042
+
2043
+ return updater;
2044
+ }
2045
+
2046
+ function joinPaths(paths) {
2047
+ return cleanPath(paths.filter(Boolean).join('/'));
2048
+ }
2049
+
2050
+ function cleanPath(path) {
2051
+ // remove double slashes
2052
+ return path.replace(/\/{2,}/g, '/');
2053
+ }
2054
+
2055
+ function trimPathLeft(path) {
2056
+ return path === '/' ? path : path.replace(/^\/{1,}/, '');
2057
+ }
2058
+
2059
+ function trimPathRight(path) {
2060
+ return path === '/' ? path : path.replace(/\/{1,}$/, '');
2061
+ }
2062
+
2063
+ function trimPath(path) {
2064
+ return trimPathRight(trimPathLeft(path));
2065
+ }
2066
+
2067
+ function matchByPath(from, matchLocation) {
2068
+ var _matchLocation$to;
2069
+
2070
+ const baseSegments = parsePathname(from);
2071
+ const routeSegments = parsePathname("" + ((_matchLocation$to = matchLocation.to) != null ? _matchLocation$to : '*'));
2072
+ const params = {};
2073
+
2074
+ let isMatch = (() => {
2075
+ for (let i = 0; i < Math.max(baseSegments.length, routeSegments.length); i++) {
2076
+ const baseSegment = baseSegments[i];
2077
+ const routeSegment = routeSegments[i];
2078
+ const isLastRouteSegment = i === routeSegments.length - 1;
2079
+ const isLastBaseSegment = i === baseSegments.length - 1;
2080
+
2081
+ if (routeSegment) {
2082
+ if (routeSegment.type === 'wildcard') {
2083
+ if (baseSegment != null && baseSegment.value) {
2084
+ params['*'] = joinPaths(baseSegments.slice(i).map(d => d.value));
2085
+ return true;
2086
+ }
2087
+
2088
+ return false;
2089
+ }
2090
+
2091
+ if (routeSegment.type === 'pathname') {
2092
+ if (routeSegment.value === '/' && !(baseSegment != null && baseSegment.value)) {
2093
+ return true;
2094
+ }
2095
+
2096
+ if (baseSegment) {
2097
+ if (matchLocation.caseSensitive) {
2098
+ if (routeSegment.value !== baseSegment.value) {
2099
+ return false;
2100
+ }
2101
+ } else if (routeSegment.value.toLowerCase() !== baseSegment.value.toLowerCase()) {
2102
+ return false;
2103
+ }
2104
+ }
2105
+ }
2106
+
2107
+ if (!baseSegment) {
2108
+ return false;
2109
+ }
2110
+
2111
+ if (routeSegment.type === 'param') {
2112
+ if ((baseSegment == null ? void 0 : baseSegment.value) === '/') {
2113
+ return false;
2114
+ }
2115
+
2116
+ if (!baseSegment.value.startsWith(':')) {
2117
+ params[routeSegment.value.substring(1)] = baseSegment.value;
2118
+ }
2119
+ }
2120
+ }
2121
+
2122
+ if (isLastRouteSegment && !isLastBaseSegment) {
2123
+ return !!matchLocation.fuzzy;
2124
+ }
2125
+ }
2126
+
2127
+ return true;
2128
+ })();
2129
+
2130
+ return isMatch ? params : undefined;
2131
+ } // function matchBySearch(
2132
+ // search: SearchSchema,
2133
+ // matchLocation: MatchLocation,
2134
+ // ) {
2135
+ // return !!(matchLocation.search && matchLocation.search(search))
2136
+ // }
2137
+
2138
+ function parsePathname(pathname) {
2139
+ if (!pathname) {
2140
+ return [];
2141
+ }
2142
+
2143
+ pathname = cleanPath(pathname);
2144
+ const segments = [];
2145
+
2146
+ if (pathname.slice(0, 1) === '/') {
2147
+ pathname = pathname.substring(1);
2148
+ segments.push({
2149
+ type: 'pathname',
2150
+ value: '/'
2151
+ });
2152
+ }
2153
+
2154
+ if (!pathname) {
2155
+ return segments;
2156
+ } // Remove empty segments and '.' segments
2157
+
2158
+
2159
+ const split = pathname.split('/').filter(Boolean);
2160
+ segments.push(...split.map(part => {
2161
+ if (part.startsWith('*')) {
2162
+ return {
2163
+ type: 'wildcard',
2164
+ value: part
2165
+ };
2166
+ }
2167
+
2168
+ if (part.charAt(0) === ':') {
2169
+ return {
2170
+ type: 'param',
2171
+ value: part
2172
+ };
2173
+ }
2174
+
2175
+ return {
2176
+ type: 'pathname',
2177
+ value: part
2178
+ };
2179
+ }));
2180
+
2181
+ if (pathname.slice(-1) === '/') {
2182
+ pathname = pathname.substring(1);
2183
+ segments.push({
2184
+ type: 'pathname',
2185
+ value: '/'
2186
+ });
2187
+ }
2188
+
2189
+ return segments;
2190
+ }
2191
+
2192
+ function _resolvePath(basepath, base, to) {
2193
+ base = base.replace(new RegExp("^" + basepath), '/');
2194
+ to = to.replace(new RegExp("^" + basepath), '/');
2195
+ let baseSegments = parsePathname(base);
2196
+ const toSegments = parsePathname(to);
2197
+ toSegments.forEach((toSegment, index) => {
2198
+ if (toSegment.value === '/') {
2199
+ if (!index) {
2200
+ // Leading slash
2201
+ baseSegments = [toSegment];
2202
+ } else if (index === toSegments.length - 1) {
2203
+ // Trailing Slash
2204
+ baseSegments.push(toSegment);
2205
+ } else ;
2206
+ } else if (toSegment.value === '..') {
2207
+ var _last2;
2208
+
2209
+ // Extra trailing slash? pop it off
2210
+ if (baseSegments.length > 1 && ((_last2 = last(baseSegments)) == null ? void 0 : _last2.value) === '/') {
2211
+ baseSegments.pop();
2212
+ }
2213
+
2214
+ baseSegments.pop();
2215
+ } else if (toSegment.value === '.') {
2216
+ return;
2217
+ } else {
2218
+ baseSegments.push(toSegment);
2219
+ }
2220
+ });
2221
+ const joined = joinPaths([basepath, ...baseSegments.map(d => d.value)]);
2222
+ return cleanPath(joined);
2223
+ }
2224
+ function replaceEqualDeep(prev, next) {
2225
+ if (prev === next) {
2226
+ return prev;
2227
+ }
2228
+
2229
+ const array = Array.isArray(prev) && Array.isArray(next);
2230
+
2231
+ if (array || isPlainObject(prev) && isPlainObject(next)) {
2232
+ const aSize = array ? prev.length : Object.keys(prev).length;
2233
+ const bItems = array ? next : Object.keys(next);
2234
+ const bSize = bItems.length;
2235
+ const copy = array ? [] : {};
2236
+ let equalItems = 0;
2237
+
2238
+ for (let i = 0; i < bSize; i++) {
2239
+ const key = array ? i : bItems[i];
2240
+ copy[key] = replaceEqualDeep(prev[key], next[key]);
2241
+
2242
+ if (copy[key] === prev[key]) {
2243
+ equalItems++;
2244
+ }
2245
+ }
2246
+
2247
+ return aSize === bSize && equalItems === aSize ? prev : copy;
2248
+ }
2249
+
2250
+ return next;
2251
+ } // Copied from: https://github.com/jonschlinkert/is-plain-object
2252
+
2253
+ function isPlainObject(o) {
2254
+ if (!hasObjectPrototype(o)) {
2255
+ return false;
2256
+ } // If has modified constructor
2257
+
2258
+
2259
+ const ctor = o.constructor;
2260
+
2261
+ if (typeof ctor === 'undefined') {
2262
+ return true;
2263
+ } // If has modified prototype
2264
+
2265
+
2266
+ const prot = ctor.prototype;
2267
+
2268
+ if (!hasObjectPrototype(prot)) {
2269
+ return false;
2270
+ } // If constructor does not have an Object-specific method
2271
+
2272
+
2273
+ if (!prot.hasOwnProperty('isPrototypeOf')) {
2274
+ return false;
2275
+ } // Most likely a plain Object
2276
+
2277
+
2278
+ return true;
2279
+ }
2280
+
2281
+ function hasObjectPrototype(o) {
2282
+ return Object.prototype.toString.call(o) === '[object Object]';
2283
+ }
2284
+
2285
+ const defaultParseSearch = parseSearchWith(JSON.parse);
2286
+ const defaultStringifySearch = stringifySearchWith(JSON.stringify);
2287
+ function parseSearchWith(parser) {
2288
+ return searchStr => {
2289
+ if (searchStr.substring(0, 1) === '?') {
2290
+ searchStr = searchStr.substring(1);
2291
+ }
2292
+
2293
+ let query = decode(searchStr); // Try to parse any query params that might be json
2294
+
2295
+ for (let key in query) {
2296
+ const value = query[key];
2297
+
2298
+ if (typeof value === 'string') {
2299
+ try {
2300
+ query[key] = parser(value);
2301
+ } catch (err) {//
2302
+ }
2303
+ }
2304
+ }
2305
+
2306
+ return query;
2307
+ };
2308
+ }
2309
+ function stringifySearchWith(stringify) {
2310
+ return search => {
2311
+ search = _extends$1({}, search);
2312
+
2313
+ if (search) {
2314
+ Object.keys(search).forEach(key => {
2315
+ const val = search[key];
2316
+
2317
+ if (typeof val === 'undefined' || val === undefined) {
2318
+ delete search[key];
2319
+ } else if (val && typeof val === 'object' && val !== null) {
2320
+ try {
2321
+ search[key] = stringify(val);
2322
+ } catch (err) {// silent
2323
+ }
2324
+ }
2325
+ });
2326
+ }
2327
+
2328
+ const searchStr = encode(search).toString();
2329
+ return searchStr ? "?" + searchStr : '';
2330
+ };
2331
+ }
2332
+
2333
+ function isCtrlEvent(e) {
2334
+ return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
2335
+ }
2336
+
2337
+ function last(arr) {
2338
+ return arr[arr.length - 1];
2339
+ }
2340
+
2341
+ const _excluded = ["type", "children", "target", "activeProps", "inactiveProps", "activeOptions", "disabled", "hash", "search", "params", "to", "preload", "preloadDelay", "preloadMaxAge", "replace", "style", "className", "onClick", "onFocus", "onMouseEnter", "onMouseLeave", "onTouchStart", "onTouchEnd"],
2342
+ _excluded2 = ["pending", "caseSensitive", "children"],
2343
+ _excluded3 = ["children", "router"];
2344
+ //
2345
+ const matchesContext = /*#__PURE__*/React.createContext(null);
2346
+ const routerContext = /*#__PURE__*/React.createContext(null); // Detect if we're in the DOM
2347
+
2348
+ const isDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
2349
+ const useLayoutEffect = isDOM ? React.useLayoutEffect : React.useEffect;
2350
+ function MatchesProvider(props) {
2351
+ return /*#__PURE__*/React.createElement(matchesContext.Provider, props);
2352
+ }
2353
+
2354
+ const useRouterSubscription = router => {
2355
+ useSyncExternalStore(cb => router.subscribe(() => cb()), () => router.state);
2356
+ };
2357
+
2358
+ function createReactRouter(opts) {
2359
+ const coreRouter = createRouter(_extends$2({}, opts, {
2360
+ createRouter: router => {
2361
+ const routerExt = {
2362
+ useRoute: routeId => {
2363
+ const route = router.getRoute(routeId);
2364
+ useRouterSubscription(router);
2365
+
2366
+ if (!route) {
2367
+ throw new Error("Could not find a route for route \"" + routeId + "\"! Did you forget to add it to your route config?");
2368
+ }
2369
+
2370
+ return route;
2371
+ },
2372
+ useMatch: routeId => {
2373
+ if (routeId === rootRouteId) {
2374
+ throw new Error("\"" + rootRouteId + "\" cannot be used with useMatch! Did you mean to useRoute(\"" + rootRouteId + "\")?");
2375
+ }
2376
+
2377
+ const runtimeMatch = _useMatch();
2378
+
2379
+ const match = router.state.matches.find(d => d.routeId === routeId);
2380
+
2381
+ if (!match) {
2382
+ throw new Error("Could not find a match for route \"" + routeId + "\" being rendered in this component!");
2383
+ }
2384
+
2385
+ if (runtimeMatch.routeId !== (match == null ? void 0 : match.routeId)) {
2386
+ throw new Error("useMatch('" + (match == null ? void 0 : match.routeId) + "') is being called in a component that is meant to render the '" + runtimeMatch.routeId + "' route. Did you mean to 'useRoute(" + (match == null ? void 0 : match.routeId) + ")' instead?");
2387
+ }
2388
+
2389
+ useRouterSubscription(router);
2390
+
2391
+ if (!match) {
2392
+ throw new Error('Match not found!');
2393
+ }
2394
+
2395
+ return match;
2396
+ }
2397
+ };
2398
+ Object.assign(router, routerExt);
2399
+ },
2400
+ createRoute: _ref => {
2401
+ let {
2402
+ router,
2403
+ route
2404
+ } = _ref;
2405
+ const routeExt = {
2406
+ linkProps: options => {
2407
+ var _functionalUpdate, _functionalUpdate2;
2408
+
2409
+ const {
2410
+ // custom props
2411
+ target,
2412
+ activeProps = () => ({
2413
+ className: 'active'
2414
+ }),
2415
+ inactiveProps = () => ({}),
2416
+ disabled,
2417
+ // element props
2418
+ style,
2419
+ className,
2420
+ onClick,
2421
+ onFocus,
2422
+ onMouseEnter,
2423
+ onMouseLeave
2424
+ } = options,
2425
+ rest = _objectWithoutPropertiesLoose(options, _excluded);
2426
+
2427
+ const linkInfo = route.buildLink(options);
2428
+
2429
+ if (linkInfo.type === 'external') {
2430
+ const {
2431
+ href
2432
+ } = linkInfo;
2433
+ return {
2434
+ href
2435
+ };
2436
+ }
2437
+
2438
+ const {
2439
+ handleClick,
2440
+ handleFocus,
2441
+ handleEnter,
2442
+ handleLeave,
2443
+ isActive,
2444
+ next
2445
+ } = linkInfo;
2446
+
2447
+ const composeHandlers = handlers => e => {
2448
+ e.persist();
2449
+ handlers.forEach(handler => {
2450
+ if (handler) handler(e);
2451
+ });
2452
+ }; // Get the active props
2453
+
2454
+
2455
+ const resolvedActiveProps = isActive ? (_functionalUpdate = functionalUpdate(activeProps)) != null ? _functionalUpdate : {} : {}; // Get the inactive props
2456
+
2457
+ const resolvedInactiveProps = isActive ? {} : (_functionalUpdate2 = functionalUpdate(inactiveProps)) != null ? _functionalUpdate2 : {};
2458
+ return _extends$2({}, resolvedActiveProps, resolvedInactiveProps, rest, {
2459
+ href: disabled ? undefined : next.href,
2460
+ onClick: composeHandlers([handleClick, onClick]),
2461
+ onFocus: composeHandlers([handleFocus, onFocus]),
2462
+ onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),
2463
+ onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),
2464
+ target,
2465
+ style: _extends$2({}, style, resolvedActiveProps.style, resolvedInactiveProps.style),
2466
+ className: [className, resolvedActiveProps.className, resolvedInactiveProps.className].filter(Boolean).join(' ') || undefined
2467
+ }, disabled ? {
2468
+ role: 'link',
2469
+ 'aria-disabled': true
2470
+ } : undefined, {
2471
+ ['data-status']: isActive ? 'active' : undefined
2472
+ });
2473
+ },
2474
+ Link: /*#__PURE__*/React.forwardRef((props, ref) => {
2475
+ const linkProps = route.linkProps(props);
2476
+ useRouterSubscription(router);
2477
+ return /*#__PURE__*/React.createElement("a", _extends$2({
2478
+ ref: ref
2479
+ }, linkProps, {
2480
+ children: typeof props.children === 'function' ? props.children({
2481
+ isActive: linkProps['data-status'] === 'active'
2482
+ }) : props.children
2483
+ }));
2484
+ }),
2485
+ MatchRoute: opts => {
2486
+ const {
2487
+ pending,
2488
+ caseSensitive
2489
+ } = opts,
2490
+ rest = _objectWithoutPropertiesLoose(opts, _excluded2);
2491
+
2492
+ const params = route.matchRoute(rest, {
2493
+ pending,
2494
+ caseSensitive
2495
+ }); // useRouterSubscription(router)
2496
+
2497
+ if (!params) {
2498
+ return null;
2499
+ }
2500
+
2501
+ return typeof opts.children === 'function' ? opts.children(params) : opts.children;
2502
+ }
2503
+ };
2504
+ Object.assign(route, routeExt);
2505
+ }
2506
+ }));
2507
+ return coreRouter;
2508
+ }
2509
+ function RouterProvider(_ref2) {
2510
+ let {
2511
+ children,
2512
+ router
2513
+ } = _ref2,
2514
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded3);
2515
+
2516
+ router.update(rest);
2517
+ useSyncExternalStore(cb => router.subscribe(() => cb()), () => router.state);
2518
+ useLayoutEffect(() => {
2519
+ router.mount();
2520
+ }, []);
2521
+ return /*#__PURE__*/React.createElement(routerContext.Provider, {
2522
+ value: {
2523
+ router
2524
+ }
2525
+ }, /*#__PURE__*/React.createElement(MatchesProvider, {
2526
+ value: router.state.matches
2527
+ }, children != null ? children : /*#__PURE__*/React.createElement(Outlet, null)));
2528
+ }
2529
+ function useRouter() {
2530
+ const value = React.useContext(routerContext);
2531
+ warning(!value, 'useRouter must be used inside a <Router> component!');
2532
+ useRouterSubscription(value.router);
2533
+ return value.router;
2534
+ }
2535
+ function useMatches() {
2536
+ return React.useContext(matchesContext);
2537
+ }
2538
+ function useParentMatches() {
2539
+ const router = useRouter();
2540
+
2541
+ const match = _useMatch();
2542
+
2543
+ const matches = router.state.matches;
2544
+ return matches.slice(0, matches.findIndex(d => d.matchId === match.matchId) - 1);
2545
+ }
2546
+
2547
+ function _useMatch() {
2548
+ var _useMatches;
2549
+
2550
+ return (_useMatches = useMatches()) == null ? void 0 : _useMatches[0];
2551
+ }
2552
+ function Outlet() {
2553
+ var _ref3, _childMatch$options$c;
2554
+
2555
+ const router = useRouter();
2556
+ const [, ...matches] = useMatches();
2557
+ const childMatch = matches[0];
2558
+ if (!childMatch) return null;
2559
+ const element = (_ref3 = (() => {
2560
+ var _childMatch$__$errorE, _ref5;
2561
+
2562
+ if (!childMatch) {
2563
+ return null;
2564
+ }
2565
+
2566
+ const errorElement = (_childMatch$__$errorE = childMatch.__.errorElement) != null ? _childMatch$__$errorE : router.options.defaultErrorElement;
2567
+
2568
+ if (childMatch.status === 'error') {
2569
+ if (errorElement) {
2570
+ return errorElement;
2571
+ }
2572
+
2573
+ if (childMatch.options.useErrorBoundary || router.options.useErrorBoundary) {
2574
+ throw childMatch.error;
2575
+ }
2576
+
2577
+ return /*#__PURE__*/React.createElement(DefaultCatchBoundary, {
2578
+ error: childMatch.error
2579
+ });
2580
+ }
2581
+
2582
+ if (childMatch.status === 'loading' || childMatch.status === 'idle') {
2583
+ if (childMatch.isPending) {
2584
+ var _childMatch$__$pendin;
2585
+
2586
+ const pendingElement = (_childMatch$__$pendin = childMatch.__.pendingElement) != null ? _childMatch$__$pendin : router.options.defaultPendingElement;
2587
+
2588
+ if (childMatch.options.pendingMs || pendingElement) {
2589
+ var _ref4;
2590
+
2591
+ return (_ref4 = pendingElement) != null ? _ref4 : null;
2592
+ }
2593
+ }
2594
+
2595
+ return null;
2596
+ }
2597
+
2598
+ return (_ref5 = childMatch.__.element) != null ? _ref5 : router.options.defaultElement;
2599
+ })()) != null ? _ref3 : /*#__PURE__*/React.createElement(Outlet, null);
2600
+ const catchElement = (_childMatch$options$c = childMatch == null ? void 0 : childMatch.options.catchElement) != null ? _childMatch$options$c : router.options.defaultCatchElement;
2601
+ return /*#__PURE__*/React.createElement(MatchesProvider, {
2602
+ value: matches,
2603
+ key: childMatch.matchId
2604
+ }, /*#__PURE__*/React.createElement(CatchBoundary, {
2605
+ catchElement: catchElement
2606
+ }, element));
2607
+ }
2608
+
2609
+ class CatchBoundary extends React.Component {
2610
+ constructor() {
2611
+ super(...arguments);
2612
+ this.state = {
2613
+ error: false
2614
+ };
2615
+
2616
+ this.reset = () => {
2617
+ this.setState({
2618
+ error: false,
2619
+ info: false
2620
+ });
2621
+ };
2622
+ }
2623
+
2624
+ componentDidCatch(error, info) {
2625
+ console.error(error);
2626
+ this.setState({
2627
+ error,
2628
+ info
2629
+ });
2630
+ }
2631
+
2632
+ render() {
2633
+ var _this$props$catchElem;
2634
+
2635
+ const catchElement = (_this$props$catchElem = this.props.catchElement) != null ? _this$props$catchElem : DefaultCatchBoundary;
2636
+
2637
+ if (this.state.error) {
2638
+ return typeof catchElement === 'function' ? catchElement(this.state) : catchElement;
2639
+ }
2640
+
2641
+ return this.props.children;
2642
+ }
2643
+
2644
+ }
2645
+
2646
+ function DefaultCatchBoundary(_ref6) {
2647
+ let {
2648
+ error
2649
+ } = _ref6;
2650
+ return /*#__PURE__*/React.createElement("div", {
2651
+ style: {
2652
+ padding: '.5rem',
2653
+ maxWidth: '100%'
2654
+ }
2655
+ }, /*#__PURE__*/React.createElement("strong", {
2656
+ style: {
2657
+ fontSize: '1.2rem'
2658
+ }
2659
+ }, "Something went wrong!"), /*#__PURE__*/React.createElement("div", {
2660
+ style: {
2661
+ height: '.5rem'
2662
+ }
2663
+ }), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("pre", null, error.message ? /*#__PURE__*/React.createElement("code", {
2664
+ style: {
2665
+ fontSize: '.7em',
2666
+ border: '1px solid red',
2667
+ borderRadius: '.25rem',
2668
+ padding: '.5rem',
2669
+ color: 'red'
2670
+ }
2671
+ }, error.message) : null)), /*#__PURE__*/React.createElement("div", {
2672
+ style: {
2673
+ height: '1rem'
2674
+ }
2675
+ }), /*#__PURE__*/React.createElement("div", {
2676
+ style: {
2677
+ fontSize: '.8em',
2678
+ borderLeft: '3px solid rgba(127, 127, 127, 1)',
2679
+ paddingLeft: '.5rem',
2680
+ opacity: 0.5
2681
+ }
2682
+ }, "If you are the owner of this website, it's highly recommended that you configure your own custom Catch/Error boundaries for the router. You can optionally configure a boundary for each route."));
2683
+ }
2684
+
2685
+ export { DefaultCatchBoundary, MatchesProvider, Outlet, RouterProvider, createBrowserHistory, createHashHistory, createMemoryHistory, createReactRouter, createRoute, createRouteConfig, createRouteMatch, createRouter, defaultParseSearch, defaultStringifySearch, functionalUpdate, last, matchByPath, matchPathname, parsePathname, parseSearchWith, replaceEqualDeep, _resolvePath as resolvePath, rootRouteId, stringifySearchWith, _useMatch as useMatch, useMatches, useParentMatches, useRouter, warning };
2686
+ //# sourceMappingURL=index.js.map