@tanstack/router-core 0.0.1-beta.8 → 1.20.3-alpha.1

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