@kitbag/router 0.10.0 → 0.10.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.
- package/dist/kitbag-router.d.ts +5 -1
- package/dist/kitbag-router.js +388 -381
- package/dist/kitbag-router.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/kitbag-router.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var Fe = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var V = (t, e, n) => (
|
|
4
|
-
import { inject as Et, defineComponent as ct, h as ft, toRefs as
|
|
5
|
-
class
|
|
2
|
+
var Je = (t, e, n) => e in t ? Fe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var V = (t, e, n) => (Je(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
|
+
import { inject as Et, defineComponent as ct, h as ft, toRefs as Qe, reactive as ae, ref as Ge, markRaw as lt, defineAsyncComponent as Ke, toRef as ze, computed as j, toValue as kt, watch as se, onUnmounted as ce, openBlock as ue, createElementBlock as Ye, normalizeClass as Xe, renderSlot as ie, normalizeProps as fe, guardReactiveProps as Ze, unref as ht, resolveComponent as tn, provide as en, mergeProps as nn, createBlock as rn, resolveDynamicComponent as on, createCommentVNode as an } from "vue";
|
|
5
|
+
class sn extends Error {
|
|
6
6
|
/**
|
|
7
7
|
* Constructs a new DuplicateParamsError instance with a message indicating the problematic parameter.
|
|
8
8
|
* @param paramName - The name of the parameter that was duplicated.
|
|
@@ -16,7 +16,7 @@ class Ht extends Error {
|
|
|
16
16
|
super("Router not installed");
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
class
|
|
19
|
+
class cn extends Error {
|
|
20
20
|
/**
|
|
21
21
|
* Constructs a new UseRouteInvalidError instance with a message that specifies both the given and expected route names.
|
|
22
22
|
* This detailed error message aids in quickly identifying and resolving mismatches in route usage.
|
|
@@ -39,7 +39,7 @@ class X extends Error {
|
|
|
39
39
|
function ut(t) {
|
|
40
40
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function un(t) {
|
|
43
43
|
return t.every((e) => Array.isArray(e));
|
|
44
44
|
}
|
|
45
45
|
function it(t) {
|
|
@@ -59,21 +59,21 @@ function pt(t) {
|
|
|
59
59
|
toString: r
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function fn(t, e) {
|
|
63
63
|
return pt(`${t.value ?? ""}${e.value ?? ""}`);
|
|
64
64
|
}
|
|
65
|
-
class
|
|
65
|
+
class ln extends Error {
|
|
66
66
|
constructor(e) {
|
|
67
67
|
super(`Child property on meta for ${e} conflicts with the parent meta.`);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
function ln(t, e) {
|
|
71
|
-
return hn(t, e), { ...t, ...e };
|
|
72
|
-
}
|
|
73
70
|
function hn(t, e) {
|
|
71
|
+
return pn(t, e), { ...t, ...e };
|
|
72
|
+
}
|
|
73
|
+
function pn(t, e) {
|
|
74
74
|
const n = Object.keys(t).find((r) => r in e && typeof e[r] != typeof t[r]);
|
|
75
75
|
if (n)
|
|
76
|
-
throw new
|
|
76
|
+
throw new ln(n);
|
|
77
77
|
}
|
|
78
78
|
function Y(t) {
|
|
79
79
|
return Array.isArray(t) ? t : [t];
|
|
@@ -82,15 +82,15 @@ function he(t, e) {
|
|
|
82
82
|
return t.filter((n) => e === n).length;
|
|
83
83
|
}
|
|
84
84
|
function et(...t) {
|
|
85
|
-
const e = t.flatMap((n) => Array.isArray(n) ? n : Object.keys(n).map(
|
|
85
|
+
const e = t.flatMap((n) => Array.isArray(n) ? n : Object.keys(n).map(mn));
|
|
86
86
|
for (const n of e)
|
|
87
87
|
if (he(e, n) > 1)
|
|
88
|
-
throw new
|
|
88
|
+
throw new sn(n);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function mn(t) {
|
|
91
91
|
return t.startsWith("?") ? t.slice(1) : t;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function dn(t, e) {
|
|
94
94
|
et(t.params, e.params);
|
|
95
95
|
const n = `${t.value}${e.value}`;
|
|
96
96
|
return {
|
|
@@ -99,7 +99,7 @@ function mn(t, e) {
|
|
|
99
99
|
toString: () => n
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function gn(t, e) {
|
|
103
103
|
et(t.params, e.params);
|
|
104
104
|
const n = [t.value, e.value].filter(it).join("&");
|
|
105
105
|
return {
|
|
@@ -108,10 +108,10 @@ function dn(t, e) {
|
|
|
108
108
|
toString: () => n
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function Rn(t, e) {
|
|
112
112
|
return et(t, e), { ...t, ...e };
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function yn(t) {
|
|
115
115
|
return "host" in t && !!t.host;
|
|
116
116
|
}
|
|
117
117
|
function pe(t) {
|
|
@@ -123,17 +123,17 @@ function Ut(t) {
|
|
|
123
123
|
function Ct(t) {
|
|
124
124
|
return "components" in t && !!t.components;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function vn(t) {
|
|
127
127
|
return "state" in t && !!t.state;
|
|
128
128
|
}
|
|
129
129
|
function me(t, e) {
|
|
130
130
|
return {
|
|
131
131
|
...e,
|
|
132
|
-
path:
|
|
133
|
-
query:
|
|
134
|
-
meta:
|
|
135
|
-
state:
|
|
136
|
-
hash:
|
|
132
|
+
path: dn(t.path, e.path),
|
|
133
|
+
query: gn(t.query, e.query),
|
|
134
|
+
meta: hn(t.meta, e.meta),
|
|
135
|
+
state: Rn(t.state, e.state),
|
|
136
|
+
hash: fn(t.hash, e.hash),
|
|
137
137
|
matches: [...t.matches, e.matched],
|
|
138
138
|
host: t.host,
|
|
139
139
|
depth: t.depth + 1
|
|
@@ -142,17 +142,17 @@ function me(t, e) {
|
|
|
142
142
|
function de() {
|
|
143
143
|
return typeof window < "u" && typeof window.document < "u";
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function wn(t, e) {
|
|
146
146
|
return ct({
|
|
147
147
|
name: "PropsWrapper",
|
|
148
148
|
expose: [],
|
|
149
149
|
setup() {
|
|
150
150
|
const n = e();
|
|
151
|
-
return "then" in n ? () => ft(
|
|
151
|
+
return "then" in n ? () => ft(En(t, n)) : () => ft(t, n);
|
|
152
152
|
}
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function En(t, e) {
|
|
156
156
|
return ct({
|
|
157
157
|
name: "AsyncPropsWrapper",
|
|
158
158
|
expose: [],
|
|
@@ -163,29 +163,29 @@ function wn(t, e) {
|
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
const T = "[", Q = "]";
|
|
166
|
-
function
|
|
166
|
+
function Pn(t) {
|
|
167
167
|
return t !== String && t !== Boolean && t !== Number && t !== Date;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
170
|
-
return typeof t == "function" &&
|
|
169
|
+
function Sn(t) {
|
|
170
|
+
return typeof t == "function" && Pn(t);
|
|
171
171
|
}
|
|
172
172
|
function Pt(t) {
|
|
173
173
|
return typeof t == "object" && "get" in t && typeof t.get == "function" && "set" in t && typeof t.set == "function";
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function bn(t) {
|
|
176
176
|
return Pt(t) && t.defaultValue !== void 0;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
return
|
|
178
|
+
function Mr(t, e) {
|
|
179
|
+
return kn(t, e);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function An(t, e) {
|
|
182
182
|
return t[e] ?? String;
|
|
183
183
|
}
|
|
184
184
|
const $ = {
|
|
185
185
|
invalid: (t) => {
|
|
186
186
|
throw new X(t);
|
|
187
187
|
}
|
|
188
|
-
},
|
|
188
|
+
}, xn = {
|
|
189
189
|
get: (t) => t,
|
|
190
190
|
set: (t, { invalid: e }) => {
|
|
191
191
|
if (typeof t != "string")
|
|
@@ -247,14 +247,14 @@ const $ = {
|
|
|
247
247
|
};
|
|
248
248
|
function ot(t, e, n = !1) {
|
|
249
249
|
if (t === void 0 || !it(t)) {
|
|
250
|
-
if (
|
|
250
|
+
if (bn(e))
|
|
251
251
|
return e.defaultValue;
|
|
252
252
|
if (n)
|
|
253
253
|
return;
|
|
254
254
|
throw new X();
|
|
255
255
|
}
|
|
256
256
|
if (e === String)
|
|
257
|
-
return
|
|
257
|
+
return xn.get(t, $);
|
|
258
258
|
if (e === Boolean)
|
|
259
259
|
return ge.get(t, $);
|
|
260
260
|
if (e === Number)
|
|
@@ -263,7 +263,7 @@ function ot(t, e, n = !1) {
|
|
|
263
263
|
return ye.get(t, $);
|
|
264
264
|
if (e === JSON)
|
|
265
265
|
return ve.get(t, $);
|
|
266
|
-
if (
|
|
266
|
+
if (Sn(e))
|
|
267
267
|
return e(t, $);
|
|
268
268
|
if (Pt(e))
|
|
269
269
|
return e.get(t, $);
|
|
@@ -296,22 +296,22 @@ function at(t, e, n = !1) {
|
|
|
296
296
|
throw new X();
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function kn(t, e) {
|
|
300
300
|
return Pt(t) ? { ...t, defaultValue: e ?? t.defaultValue } : {
|
|
301
301
|
get: (n) => ot(n, t),
|
|
302
302
|
set: (n) => at(n, t),
|
|
303
303
|
defaultValue: e
|
|
304
304
|
};
|
|
305
305
|
}
|
|
306
|
-
function
|
|
307
|
-
return
|
|
306
|
+
function F() {
|
|
307
|
+
return F = Object.assign ? Object.assign.bind() : function(t) {
|
|
308
308
|
for (var e = 1; e < arguments.length; e++) {
|
|
309
309
|
var n = arguments[e];
|
|
310
310
|
for (var r in n)
|
|
311
311
|
Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
|
|
312
312
|
}
|
|
313
313
|
return t;
|
|
314
|
-
},
|
|
314
|
+
}, F.apply(this, arguments);
|
|
315
315
|
}
|
|
316
316
|
var U;
|
|
317
317
|
(function(t) {
|
|
@@ -331,15 +331,15 @@ function G(t, e) {
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
-
var mt = "beforeunload",
|
|
334
|
+
var mt = "beforeunload", Bn = "hashchange", we = "popstate";
|
|
335
335
|
function Qt(t) {
|
|
336
336
|
t === void 0 && (t = {});
|
|
337
337
|
var e = t, n = e.window, r = n === void 0 ? document.defaultView : n, o = r.history;
|
|
338
338
|
function a() {
|
|
339
|
-
var
|
|
339
|
+
var d = r.location, f = d.pathname, p = d.search, w = d.hash, E = o.state || {};
|
|
340
340
|
return [E.idx, Z({
|
|
341
341
|
pathname: f,
|
|
342
|
-
search:
|
|
342
|
+
search: p,
|
|
343
343
|
hash: w,
|
|
344
344
|
state: E.usr || null,
|
|
345
345
|
key: E.key || "default"
|
|
@@ -348,14 +348,14 @@ function Qt(t) {
|
|
|
348
348
|
var s = null;
|
|
349
349
|
function c() {
|
|
350
350
|
if (s)
|
|
351
|
-
|
|
351
|
+
m.call(s), s = null;
|
|
352
352
|
else {
|
|
353
|
-
var
|
|
354
|
-
if (
|
|
355
|
-
if (
|
|
356
|
-
var E =
|
|
353
|
+
var d = U.Pop, f = a(), p = f[0], w = f[1];
|
|
354
|
+
if (m.length)
|
|
355
|
+
if (p != null) {
|
|
356
|
+
var E = h - p;
|
|
357
357
|
E && (s = {
|
|
358
|
-
action:
|
|
358
|
+
action: d,
|
|
359
359
|
location: w,
|
|
360
360
|
retry: function() {
|
|
361
361
|
S(E * -1);
|
|
@@ -370,76 +370,76 @@ function Qt(t) {
|
|
|
370
370
|
"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."
|
|
371
371
|
);
|
|
372
372
|
else
|
|
373
|
-
O(
|
|
373
|
+
O(d);
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
376
|
r.addEventListener(we, c);
|
|
377
|
-
var u = U.Pop, l = a(),
|
|
378
|
-
|
|
379
|
-
idx:
|
|
377
|
+
var u = U.Pop, l = a(), h = l[0], i = l[1], v = tt(), m = tt();
|
|
378
|
+
h == null && (h = 0, o.replaceState(F({}, o.state, {
|
|
379
|
+
idx: h
|
|
380
380
|
}), ""));
|
|
381
|
-
function A(
|
|
382
|
-
return typeof
|
|
381
|
+
function A(d) {
|
|
382
|
+
return typeof d == "string" ? d : K(d);
|
|
383
383
|
}
|
|
384
|
-
function P(
|
|
385
|
-
return f === void 0 && (f = null), Z(
|
|
384
|
+
function P(d, f) {
|
|
385
|
+
return f === void 0 && (f = null), Z(F({
|
|
386
386
|
pathname: i.pathname,
|
|
387
387
|
hash: "",
|
|
388
388
|
search: ""
|
|
389
|
-
}, typeof
|
|
389
|
+
}, typeof d == "string" ? st(d) : d, {
|
|
390
390
|
state: f,
|
|
391
391
|
key: gt()
|
|
392
392
|
}));
|
|
393
393
|
}
|
|
394
|
-
function k(
|
|
394
|
+
function k(d, f) {
|
|
395
395
|
return [{
|
|
396
|
-
usr:
|
|
397
|
-
key:
|
|
396
|
+
usr: d.state,
|
|
397
|
+
key: d.key,
|
|
398
398
|
idx: f
|
|
399
|
-
}, A(
|
|
399
|
+
}, A(d)];
|
|
400
400
|
}
|
|
401
|
-
function C(
|
|
402
|
-
return !
|
|
403
|
-
action:
|
|
401
|
+
function C(d, f, p) {
|
|
402
|
+
return !m.length || (m.call({
|
|
403
|
+
action: d,
|
|
404
404
|
location: f,
|
|
405
|
-
retry:
|
|
405
|
+
retry: p
|
|
406
406
|
}), !1);
|
|
407
407
|
}
|
|
408
|
-
function O(
|
|
409
|
-
u =
|
|
408
|
+
function O(d) {
|
|
409
|
+
u = d;
|
|
410
410
|
var f = a();
|
|
411
|
-
|
|
411
|
+
h = f[0], i = f[1], v.call({
|
|
412
412
|
action: u,
|
|
413
413
|
location: i
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
|
-
function g(
|
|
417
|
-
var
|
|
416
|
+
function g(d, f) {
|
|
417
|
+
var p = U.Push, w = P(d, f);
|
|
418
418
|
function E() {
|
|
419
|
-
g(
|
|
419
|
+
g(d, f);
|
|
420
420
|
}
|
|
421
|
-
if (C(
|
|
422
|
-
var x = k(w,
|
|
421
|
+
if (C(p, w, E)) {
|
|
422
|
+
var x = k(w, h + 1), L = x[0], N = x[1];
|
|
423
423
|
try {
|
|
424
424
|
o.pushState(L, "", N);
|
|
425
425
|
} catch {
|
|
426
426
|
r.location.assign(N);
|
|
427
427
|
}
|
|
428
|
-
O(
|
|
428
|
+
O(p);
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
function R(
|
|
432
|
-
var
|
|
431
|
+
function R(d, f) {
|
|
432
|
+
var p = U.Replace, w = P(d, f);
|
|
433
433
|
function E() {
|
|
434
|
-
R(
|
|
434
|
+
R(d, f);
|
|
435
435
|
}
|
|
436
|
-
if (C(
|
|
437
|
-
var x = k(w,
|
|
438
|
-
o.replaceState(L, "", N), O(
|
|
436
|
+
if (C(p, w, E)) {
|
|
437
|
+
var x = k(w, h), L = x[0], N = x[1];
|
|
438
|
+
o.replaceState(L, "", N), O(p);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
function S(
|
|
442
|
-
o.go(
|
|
441
|
+
function S(d) {
|
|
442
|
+
o.go(d);
|
|
443
443
|
}
|
|
444
444
|
var b = {
|
|
445
445
|
get action() {
|
|
@@ -462,19 +462,19 @@ function Qt(t) {
|
|
|
462
462
|
return v.push(f);
|
|
463
463
|
},
|
|
464
464
|
block: function(f) {
|
|
465
|
-
var
|
|
466
|
-
return
|
|
467
|
-
|
|
465
|
+
var p = m.push(f);
|
|
466
|
+
return m.length === 1 && r.addEventListener(mt, dt), function() {
|
|
467
|
+
p(), m.length || r.removeEventListener(mt, dt);
|
|
468
468
|
};
|
|
469
469
|
}
|
|
470
470
|
};
|
|
471
471
|
return b;
|
|
472
472
|
}
|
|
473
|
-
function
|
|
473
|
+
function Ln(t) {
|
|
474
474
|
t === void 0 && (t = {});
|
|
475
475
|
var e = t, n = e.window, r = n === void 0 ? document.defaultView : n, o = r.history;
|
|
476
476
|
function a() {
|
|
477
|
-
var f = st(r.location.hash.substr(1)),
|
|
477
|
+
var f = st(r.location.hash.substr(1)), p = f.pathname, w = p === void 0 ? "/" : p, E = f.search, x = E === void 0 ? "" : E, L = f.hash, N = L === void 0 ? "" : L, H = o.state || {};
|
|
478
478
|
return [H.idx, Z({
|
|
479
479
|
pathname: w,
|
|
480
480
|
search: x,
|
|
@@ -486,12 +486,12 @@ function Bn(t) {
|
|
|
486
486
|
var s = null;
|
|
487
487
|
function c() {
|
|
488
488
|
if (s)
|
|
489
|
-
|
|
489
|
+
m.call(s), s = null;
|
|
490
490
|
else {
|
|
491
|
-
var f = U.Pop,
|
|
492
|
-
if (
|
|
491
|
+
var f = U.Pop, p = a(), w = p[0], E = p[1];
|
|
492
|
+
if (m.length)
|
|
493
493
|
if (w != null) {
|
|
494
|
-
var x =
|
|
494
|
+
var x = h - w;
|
|
495
495
|
x && (s = {
|
|
496
496
|
action: f,
|
|
497
497
|
location: E,
|
|
@@ -511,64 +511,64 @@ function Bn(t) {
|
|
|
511
511
|
g(f);
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
|
-
r.addEventListener(we, c), r.addEventListener(
|
|
515
|
-
var f = a(),
|
|
516
|
-
K(
|
|
514
|
+
r.addEventListener(we, c), r.addEventListener(Bn, function() {
|
|
515
|
+
var f = a(), p = f[1];
|
|
516
|
+
K(p) !== K(i) && c();
|
|
517
517
|
});
|
|
518
|
-
var u = U.Pop, l = a(),
|
|
519
|
-
|
|
520
|
-
idx:
|
|
518
|
+
var u = U.Pop, l = a(), h = l[0], i = l[1], v = tt(), m = tt();
|
|
519
|
+
h == null && (h = 0, o.replaceState(F({}, o.state, {
|
|
520
|
+
idx: h
|
|
521
521
|
}), ""));
|
|
522
522
|
function A() {
|
|
523
|
-
var f = document.querySelector("base"),
|
|
523
|
+
var f = document.querySelector("base"), p = "";
|
|
524
524
|
if (f && f.getAttribute("href")) {
|
|
525
525
|
var w = r.location.href, E = w.indexOf("#");
|
|
526
|
-
|
|
526
|
+
p = E === -1 ? w : w.slice(0, E);
|
|
527
527
|
}
|
|
528
|
-
return
|
|
528
|
+
return p;
|
|
529
529
|
}
|
|
530
530
|
function P(f) {
|
|
531
531
|
return A() + "#" + (typeof f == "string" ? f : K(f));
|
|
532
532
|
}
|
|
533
|
-
function k(f,
|
|
534
|
-
return
|
|
533
|
+
function k(f, p) {
|
|
534
|
+
return p === void 0 && (p = null), Z(F({
|
|
535
535
|
pathname: i.pathname,
|
|
536
536
|
hash: "",
|
|
537
537
|
search: ""
|
|
538
538
|
}, typeof f == "string" ? st(f) : f, {
|
|
539
|
-
state:
|
|
539
|
+
state: p,
|
|
540
540
|
key: gt()
|
|
541
541
|
}));
|
|
542
542
|
}
|
|
543
|
-
function C(f,
|
|
543
|
+
function C(f, p) {
|
|
544
544
|
return [{
|
|
545
545
|
usr: f.state,
|
|
546
546
|
key: f.key,
|
|
547
|
-
idx:
|
|
547
|
+
idx: p
|
|
548
548
|
}, P(f)];
|
|
549
549
|
}
|
|
550
|
-
function O(f,
|
|
551
|
-
return !
|
|
550
|
+
function O(f, p, w) {
|
|
551
|
+
return !m.length || (m.call({
|
|
552
552
|
action: f,
|
|
553
|
-
location:
|
|
553
|
+
location: p,
|
|
554
554
|
retry: w
|
|
555
555
|
}), !1);
|
|
556
556
|
}
|
|
557
557
|
function g(f) {
|
|
558
558
|
u = f;
|
|
559
|
-
var
|
|
560
|
-
|
|
559
|
+
var p = a();
|
|
560
|
+
h = p[0], i = p[1], v.call({
|
|
561
561
|
action: u,
|
|
562
562
|
location: i
|
|
563
563
|
});
|
|
564
564
|
}
|
|
565
|
-
function R(f,
|
|
566
|
-
var w = U.Push, E = k(f,
|
|
565
|
+
function R(f, p) {
|
|
566
|
+
var w = U.Push, E = k(f, p);
|
|
567
567
|
function x() {
|
|
568
|
-
R(f,
|
|
568
|
+
R(f, p);
|
|
569
569
|
}
|
|
570
570
|
if (process.env.NODE_ENV !== "production" && G(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(f) + ")"), O(w, E, x)) {
|
|
571
|
-
var L = C(E,
|
|
571
|
+
var L = C(E, h + 1), N = L[0], H = L[1];
|
|
572
572
|
try {
|
|
573
573
|
o.pushState(N, "", H);
|
|
574
574
|
} catch {
|
|
@@ -577,20 +577,20 @@ function Bn(t) {
|
|
|
577
577
|
g(w);
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
|
-
function S(f,
|
|
581
|
-
var w = U.Replace, E = k(f,
|
|
580
|
+
function S(f, p) {
|
|
581
|
+
var w = U.Replace, E = k(f, p);
|
|
582
582
|
function x() {
|
|
583
|
-
S(f,
|
|
583
|
+
S(f, p);
|
|
584
584
|
}
|
|
585
585
|
if (process.env.NODE_ENV !== "production" && G(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(f) + ")"), O(w, E, x)) {
|
|
586
|
-
var L = C(E,
|
|
586
|
+
var L = C(E, h), N = L[0], H = L[1];
|
|
587
587
|
o.replaceState(N, "", H), g(w);
|
|
588
588
|
}
|
|
589
589
|
}
|
|
590
590
|
function b(f) {
|
|
591
591
|
o.go(f);
|
|
592
592
|
}
|
|
593
|
-
var
|
|
593
|
+
var d = {
|
|
594
594
|
get action() {
|
|
595
595
|
return u;
|
|
596
596
|
},
|
|
@@ -607,22 +607,22 @@ function Bn(t) {
|
|
|
607
607
|
forward: function() {
|
|
608
608
|
b(1);
|
|
609
609
|
},
|
|
610
|
-
listen: function(
|
|
611
|
-
return v.push(
|
|
610
|
+
listen: function(p) {
|
|
611
|
+
return v.push(p);
|
|
612
612
|
},
|
|
613
|
-
block: function(
|
|
614
|
-
var w =
|
|
615
|
-
return
|
|
616
|
-
w(),
|
|
613
|
+
block: function(p) {
|
|
614
|
+
var w = m.push(p);
|
|
615
|
+
return m.length === 1 && r.addEventListener(mt, dt), function() {
|
|
616
|
+
w(), m.length || r.removeEventListener(mt, dt);
|
|
617
617
|
};
|
|
618
618
|
}
|
|
619
619
|
};
|
|
620
|
-
return
|
|
620
|
+
return d;
|
|
621
621
|
}
|
|
622
622
|
function Gt(t) {
|
|
623
623
|
t === void 0 && (t = {});
|
|
624
624
|
var e = t, n = e.initialEntries, r = n === void 0 ? ["/"] : n, o = e.initialIndex, a = r.map(function(g) {
|
|
625
|
-
var R = Z(
|
|
625
|
+
var R = Z(F({
|
|
626
626
|
pathname: "/",
|
|
627
627
|
search: "",
|
|
628
628
|
hash: "",
|
|
@@ -630,12 +630,12 @@ function Gt(t) {
|
|
|
630
630
|
key: gt()
|
|
631
631
|
}, typeof g == "string" ? st(g) : g));
|
|
632
632
|
return process.env.NODE_ENV !== "production" && G(R.pathname.charAt(0) === "/", "Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: " + JSON.stringify(g) + ")"), R;
|
|
633
|
-
}), s = Kt(o ?? a.length - 1, 0, a.length - 1), c = U.Pop, u = a[s], l = tt(),
|
|
633
|
+
}), s = Kt(o ?? a.length - 1, 0, a.length - 1), c = U.Pop, u = a[s], l = tt(), h = tt();
|
|
634
634
|
function i(g) {
|
|
635
635
|
return typeof g == "string" ? g : K(g);
|
|
636
636
|
}
|
|
637
637
|
function v(g, R) {
|
|
638
|
-
return R === void 0 && (R = null), Z(
|
|
638
|
+
return R === void 0 && (R = null), Z(F({
|
|
639
639
|
pathname: u.pathname,
|
|
640
640
|
search: "",
|
|
641
641
|
hash: ""
|
|
@@ -644,8 +644,8 @@ function Gt(t) {
|
|
|
644
644
|
key: gt()
|
|
645
645
|
}));
|
|
646
646
|
}
|
|
647
|
-
function
|
|
648
|
-
return !
|
|
647
|
+
function m(g, R, S) {
|
|
648
|
+
return !h.length || (h.call({
|
|
649
649
|
action: g,
|
|
650
650
|
location: R,
|
|
651
651
|
retry: S
|
|
@@ -659,24 +659,24 @@ function Gt(t) {
|
|
|
659
659
|
}
|
|
660
660
|
function P(g, R) {
|
|
661
661
|
var S = U.Push, b = v(g, R);
|
|
662
|
-
function
|
|
662
|
+
function d() {
|
|
663
663
|
P(g, R);
|
|
664
664
|
}
|
|
665
|
-
process.env.NODE_ENV !== "production" && G(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.push(" + JSON.stringify(g) + ")"),
|
|
665
|
+
process.env.NODE_ENV !== "production" && G(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.push(" + JSON.stringify(g) + ")"), m(S, b, d) && (s += 1, a.splice(s, a.length, b), A(S, b));
|
|
666
666
|
}
|
|
667
667
|
function k(g, R) {
|
|
668
668
|
var S = U.Replace, b = v(g, R);
|
|
669
|
-
function
|
|
669
|
+
function d() {
|
|
670
670
|
k(g, R);
|
|
671
671
|
}
|
|
672
|
-
process.env.NODE_ENV !== "production" && G(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(g) + ")"),
|
|
672
|
+
process.env.NODE_ENV !== "production" && G(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(g) + ")"), m(S, b, d) && (a[s] = b, A(S, b));
|
|
673
673
|
}
|
|
674
674
|
function C(g) {
|
|
675
675
|
var R = Kt(s + g, 0, a.length - 1), S = U.Pop, b = a[R];
|
|
676
|
-
function
|
|
676
|
+
function d() {
|
|
677
677
|
C(g);
|
|
678
678
|
}
|
|
679
|
-
|
|
679
|
+
m(S, b, d) && (s = R, A(S, b));
|
|
680
680
|
}
|
|
681
681
|
var O = {
|
|
682
682
|
get index() {
|
|
@@ -702,7 +702,7 @@ function Gt(t) {
|
|
|
702
702
|
return l.push(R);
|
|
703
703
|
},
|
|
704
704
|
block: function(R) {
|
|
705
|
-
return
|
|
705
|
+
return h.push(R);
|
|
706
706
|
}
|
|
707
707
|
};
|
|
708
708
|
return O;
|
|
@@ -751,18 +751,18 @@ function st(t) {
|
|
|
751
751
|
return e;
|
|
752
752
|
}
|
|
753
753
|
const Ee = Symbol();
|
|
754
|
-
function
|
|
754
|
+
function Nn() {
|
|
755
755
|
const t = Et(Ee);
|
|
756
756
|
if (!t)
|
|
757
757
|
throw new Ht();
|
|
758
758
|
return t;
|
|
759
759
|
}
|
|
760
760
|
const Pe = Symbol("isRouterRouteSymbol");
|
|
761
|
-
function
|
|
761
|
+
function Un(t) {
|
|
762
762
|
return typeof t == "object" && t !== null && Pe in t;
|
|
763
763
|
}
|
|
764
|
-
function
|
|
765
|
-
function n(i, v,
|
|
764
|
+
function Cn(t, e) {
|
|
765
|
+
function n(i, v, m) {
|
|
766
766
|
if (typeof i == "object") {
|
|
767
767
|
const P = {
|
|
768
768
|
...t.params,
|
|
@@ -774,9 +774,9 @@ function Un(t, e) {
|
|
|
774
774
|
...t.params,
|
|
775
775
|
[i]: v
|
|
776
776
|
};
|
|
777
|
-
return e(t.name, A,
|
|
777
|
+
return e(t.name, A, m);
|
|
778
778
|
}
|
|
779
|
-
const { matched: r, matches: o, name: a, query: s, params: c, state: u, hash: l } =
|
|
779
|
+
const { matched: r, matches: o, name: a, query: s, params: c, state: u, hash: l } = Qe(t), h = ae({
|
|
780
780
|
matched: r,
|
|
781
781
|
matches: o,
|
|
782
782
|
state: u,
|
|
@@ -787,8 +787,8 @@ function Un(t, e) {
|
|
|
787
787
|
update: n,
|
|
788
788
|
[Pe]: !0
|
|
789
789
|
});
|
|
790
|
-
return new Proxy(
|
|
791
|
-
get: (i, v,
|
|
790
|
+
return new Proxy(h, {
|
|
791
|
+
get: (i, v, m) => v === "params" ? new Proxy(t.params, {
|
|
792
792
|
set(A, P, k) {
|
|
793
793
|
return n(P, k), !0;
|
|
794
794
|
}
|
|
@@ -796,17 +796,17 @@ function Un(t, e) {
|
|
|
796
796
|
set(A, P, k) {
|
|
797
797
|
return n({}, { state: { ...t.state, [P]: k } }), !0;
|
|
798
798
|
}
|
|
799
|
-
}) : Reflect.get(i, v,
|
|
799
|
+
}) : Reflect.get(i, v, m)
|
|
800
800
|
});
|
|
801
801
|
}
|
|
802
802
|
const Se = Symbol();
|
|
803
|
-
function
|
|
803
|
+
function $n(t, e) {
|
|
804
804
|
const n = ae({ ...t }), r = (s) => {
|
|
805
805
|
Object.assign(n, {
|
|
806
806
|
[Se]: !1,
|
|
807
807
|
...s
|
|
808
808
|
});
|
|
809
|
-
}, o = n, a =
|
|
809
|
+
}, o = n, a = Cn(o, e);
|
|
810
810
|
return {
|
|
811
811
|
currentRoute: o,
|
|
812
812
|
routerRoute: a,
|
|
@@ -814,9 +814,9 @@ function Cn(t, e) {
|
|
|
814
814
|
};
|
|
815
815
|
}
|
|
816
816
|
function M(t) {
|
|
817
|
-
return !t.startsWith("http") ?
|
|
817
|
+
return !t.startsWith("http") ? Vn(t) : Hn(t);
|
|
818
818
|
}
|
|
819
|
-
function
|
|
819
|
+
function Hn(t) {
|
|
820
820
|
const { protocol: e, host: n, pathname: r, search: o, searchParams: a, hash: s } = new URL(t, t);
|
|
821
821
|
return {
|
|
822
822
|
protocol: e,
|
|
@@ -827,7 +827,7 @@ function $n(t) {
|
|
|
827
827
|
hash: s
|
|
828
828
|
};
|
|
829
829
|
}
|
|
830
|
-
function
|
|
830
|
+
function Vn(t) {
|
|
831
831
|
const { pathname: e, search: n, searchParams: r, hash: o } = new URL(t, "https://localhost");
|
|
832
832
|
return {
|
|
833
833
|
pathname: e,
|
|
@@ -836,14 +836,14 @@ function Hn(t) {
|
|
|
836
836
|
hash: o
|
|
837
837
|
};
|
|
838
838
|
}
|
|
839
|
-
function
|
|
839
|
+
function jn(t) {
|
|
840
840
|
return (e) => {
|
|
841
841
|
const { host: n } = M(e);
|
|
842
842
|
return !(n === void 0 || n === t);
|
|
843
843
|
};
|
|
844
844
|
}
|
|
845
|
-
function
|
|
846
|
-
const n =
|
|
845
|
+
function On({ mode: t, listener: e }) {
|
|
846
|
+
const n = _n(t), r = (u, l) => {
|
|
847
847
|
if (l != null && l.replace)
|
|
848
848
|
return n.replace(u, l.state);
|
|
849
849
|
n.push(u, l == null ? void 0 : l.state);
|
|
@@ -864,7 +864,7 @@ function jn({ mode: t, listener: e }) {
|
|
|
864
864
|
}
|
|
865
865
|
};
|
|
866
866
|
}
|
|
867
|
-
function
|
|
867
|
+
function _n(t = "auto") {
|
|
868
868
|
switch (t) {
|
|
869
869
|
case "auto":
|
|
870
870
|
return de() ? Qt() : Gt();
|
|
@@ -873,7 +873,7 @@ function On(t = "auto") {
|
|
|
873
873
|
case "memory":
|
|
874
874
|
return Gt();
|
|
875
875
|
case "hash":
|
|
876
|
-
return
|
|
876
|
+
return Ln();
|
|
877
877
|
default:
|
|
878
878
|
const e = t;
|
|
879
879
|
throw new Error(`Switch is not exhaustive for mode: ${e}`);
|
|
@@ -905,7 +905,7 @@ class Bt extends Error {
|
|
|
905
905
|
this.type = n;
|
|
906
906
|
}
|
|
907
907
|
}
|
|
908
|
-
function
|
|
908
|
+
function qn(t, e) {
|
|
909
909
|
const n = new Rt();
|
|
910
910
|
return t.matches.forEach((r, o) => {
|
|
911
911
|
r.onBeforeRouteEnter && jt(t, e, o) && Y(r.onBeforeRouteEnter).forEach((a) => n.onBeforeRouteEnter.add(a)), r.onBeforeRouteUpdate && _t(t, e, o) && Y(r.onBeforeRouteUpdate).forEach((a) => n.onBeforeRouteUpdate.add(a));
|
|
@@ -913,7 +913,7 @@ function _n(t, e) {
|
|
|
913
913
|
r.onBeforeRouteLeave && Ot(t, e, o) && Y(r.onBeforeRouteLeave).forEach((a) => n.onBeforeRouteLeave.add(a));
|
|
914
914
|
}), n;
|
|
915
915
|
}
|
|
916
|
-
function
|
|
916
|
+
function Wn(t, e) {
|
|
917
917
|
const n = new Rt();
|
|
918
918
|
return t.matches.forEach((r, o) => {
|
|
919
919
|
r.onAfterRouteEnter && jt(t, e, o) && Y(r.onAfterRouteEnter).forEach((a) => n.onAfterRouteEnter.add(a)), r.onAfterRouteUpdate && _t(t, e, o) && Y(r.onAfterRouteUpdate).forEach((a) => n.onAfterRouteUpdate.add(a));
|
|
@@ -924,7 +924,7 @@ function qn(t, e) {
|
|
|
924
924
|
function D(t) {
|
|
925
925
|
return typeof t != "string" ? !1 : /^(https?:\/\/|\/).*/g.test(t);
|
|
926
926
|
}
|
|
927
|
-
function
|
|
927
|
+
function Dn() {
|
|
928
928
|
const t = (s) => {
|
|
929
929
|
throw new Bt(s);
|
|
930
930
|
}, e = (...s) => {
|
|
@@ -934,84 +934,84 @@ function Wn() {
|
|
|
934
934
|
const i = c ?? {};
|
|
935
935
|
throw new rt([s, { ...i, replace: !0 }]);
|
|
936
936
|
}
|
|
937
|
-
const l = c,
|
|
938
|
-
throw new rt([s, l, { ...
|
|
937
|
+
const l = c, h = u ?? {};
|
|
938
|
+
throw new rt([s, l, { ...h, replace: !0 }]);
|
|
939
939
|
}, r = () => {
|
|
940
940
|
throw new zt();
|
|
941
941
|
};
|
|
942
942
|
async function o({ to: s, from: c, hooks: u }) {
|
|
943
|
-
const { global: l, component:
|
|
943
|
+
const { global: l, component: h } = u, i = qn(s, c), v = [
|
|
944
944
|
...l.onBeforeRouteEnter,
|
|
945
945
|
...i.onBeforeRouteEnter,
|
|
946
946
|
...l.onBeforeRouteUpdate,
|
|
947
947
|
...i.onBeforeRouteUpdate,
|
|
948
|
-
...
|
|
948
|
+
...h.onBeforeRouteUpdate,
|
|
949
949
|
...l.onBeforeRouteLeave,
|
|
950
950
|
...i.onBeforeRouteLeave,
|
|
951
|
-
...
|
|
951
|
+
...h.onBeforeRouteLeave
|
|
952
952
|
];
|
|
953
953
|
try {
|
|
954
|
-
const
|
|
954
|
+
const m = v.map((A) => A(s, {
|
|
955
955
|
from: c,
|
|
956
956
|
reject: t,
|
|
957
957
|
push: e,
|
|
958
958
|
replace: n,
|
|
959
959
|
abort: r
|
|
960
960
|
}));
|
|
961
|
-
await Promise.all(
|
|
962
|
-
} catch (
|
|
963
|
-
if (
|
|
961
|
+
await Promise.all(m);
|
|
962
|
+
} catch (m) {
|
|
963
|
+
if (m instanceof rt)
|
|
964
964
|
return {
|
|
965
965
|
status: "PUSH",
|
|
966
|
-
to:
|
|
966
|
+
to: m.to
|
|
967
967
|
};
|
|
968
|
-
if (
|
|
968
|
+
if (m instanceof Bt)
|
|
969
969
|
return {
|
|
970
970
|
status: "REJECT",
|
|
971
|
-
type:
|
|
971
|
+
type: m.type
|
|
972
972
|
};
|
|
973
|
-
if (
|
|
973
|
+
if (m instanceof zt)
|
|
974
974
|
return {
|
|
975
975
|
status: "ABORT"
|
|
976
976
|
};
|
|
977
|
-
throw
|
|
977
|
+
throw m;
|
|
978
978
|
}
|
|
979
979
|
return {
|
|
980
980
|
status: "SUCCESS"
|
|
981
981
|
};
|
|
982
982
|
}
|
|
983
983
|
async function a({ to: s, from: c, hooks: u }) {
|
|
984
|
-
const { global: l, component:
|
|
985
|
-
...
|
|
984
|
+
const { global: l, component: h } = u, i = Wn(s, c), v = [
|
|
985
|
+
...h.onAfterRouteLeave,
|
|
986
986
|
...i.onAfterRouteLeave,
|
|
987
987
|
...l.onAfterRouteLeave,
|
|
988
|
-
...
|
|
988
|
+
...h.onAfterRouteUpdate,
|
|
989
989
|
...i.onAfterRouteUpdate,
|
|
990
990
|
...l.onAfterRouteUpdate,
|
|
991
|
-
...
|
|
991
|
+
...h.onAfterRouteEnter,
|
|
992
992
|
...i.onAfterRouteEnter,
|
|
993
993
|
...l.onAfterRouteEnter
|
|
994
994
|
];
|
|
995
995
|
try {
|
|
996
|
-
const
|
|
996
|
+
const m = v.map((A) => A(s, {
|
|
997
997
|
from: c,
|
|
998
998
|
reject: t,
|
|
999
999
|
push: e,
|
|
1000
1000
|
replace: n
|
|
1001
1001
|
}));
|
|
1002
|
-
await Promise.all(
|
|
1003
|
-
} catch (
|
|
1004
|
-
if (
|
|
1002
|
+
await Promise.all(m);
|
|
1003
|
+
} catch (m) {
|
|
1004
|
+
if (m instanceof rt)
|
|
1005
1005
|
return {
|
|
1006
1006
|
status: "PUSH",
|
|
1007
|
-
to:
|
|
1007
|
+
to: m.to
|
|
1008
1008
|
};
|
|
1009
|
-
if (
|
|
1009
|
+
if (m instanceof Bt)
|
|
1010
1010
|
return {
|
|
1011
1011
|
status: "REJECT",
|
|
1012
|
-
type:
|
|
1012
|
+
type: m.type
|
|
1013
1013
|
};
|
|
1014
|
-
throw
|
|
1014
|
+
throw m;
|
|
1015
1015
|
}
|
|
1016
1016
|
return {
|
|
1017
1017
|
status: "SUCCESS"
|
|
@@ -1044,7 +1044,7 @@ function Yt(t) {
|
|
|
1044
1044
|
throw new Error(`Switch is not exhaustive for lifecycle: ${t}`);
|
|
1045
1045
|
}
|
|
1046
1046
|
}
|
|
1047
|
-
class
|
|
1047
|
+
class Mn {
|
|
1048
1048
|
constructor() {
|
|
1049
1049
|
V(this, "global", new Rt());
|
|
1050
1050
|
V(this, "component", new Rt());
|
|
@@ -1065,8 +1065,8 @@ class Dn {
|
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
1067
|
const be = Symbol();
|
|
1068
|
-
function
|
|
1069
|
-
const t = new
|
|
1068
|
+
function Tn() {
|
|
1069
|
+
const t = new Mn();
|
|
1070
1070
|
return {
|
|
1071
1071
|
onBeforeRouteEnter: (c) => t.addBeforeRouteHook({ lifecycle: "onBeforeRouteEnter", hook: c, timing: "global", depth: 0 }),
|
|
1072
1072
|
onBeforeRouteUpdate: (c) => t.addBeforeRouteHook({ lifecycle: "onBeforeRouteUpdate", hook: c, timing: "global", depth: 0 }),
|
|
@@ -1077,7 +1077,7 @@ function Mn() {
|
|
|
1077
1077
|
hooks: t
|
|
1078
1078
|
};
|
|
1079
1079
|
}
|
|
1080
|
-
function
|
|
1080
|
+
function In(t) {
|
|
1081
1081
|
return ct(() => () => ft("h1", t), {
|
|
1082
1082
|
name: t,
|
|
1083
1083
|
props: []
|
|
@@ -1097,7 +1097,7 @@ function Fn({
|
|
|
1097
1097
|
const s = {
|
|
1098
1098
|
...t
|
|
1099
1099
|
};
|
|
1100
|
-
return lt(s[a] ??
|
|
1100
|
+
return lt(s[a] ?? In(a));
|
|
1101
1101
|
}, n = (a) => {
|
|
1102
1102
|
const s = lt(e(a)), c = {
|
|
1103
1103
|
name: a,
|
|
@@ -1121,14 +1121,14 @@ function Fn({
|
|
|
1121
1121
|
}
|
|
1122
1122
|
const s = e(a);
|
|
1123
1123
|
o.value = { type: a, component: s };
|
|
1124
|
-
}, o =
|
|
1124
|
+
}, o = Ge(null);
|
|
1125
1125
|
return {
|
|
1126
1126
|
setRejection: r,
|
|
1127
1127
|
rejection: o,
|
|
1128
1128
|
getRejectionRoute: n
|
|
1129
1129
|
};
|
|
1130
1130
|
}
|
|
1131
|
-
class
|
|
1131
|
+
class Jn extends Error {
|
|
1132
1132
|
constructor(e) {
|
|
1133
1133
|
super(`Route not found: "${e}"`);
|
|
1134
1134
|
}
|
|
@@ -1136,7 +1136,7 @@ class In extends Error {
|
|
|
1136
1136
|
function qt(t) {
|
|
1137
1137
|
return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1138
1138
|
}
|
|
1139
|
-
function
|
|
1139
|
+
function Qn(t, e) {
|
|
1140
1140
|
const n = Array.from(t.matchAll(e));
|
|
1141
1141
|
if (n.length === 0)
|
|
1142
1142
|
return [t];
|
|
@@ -1149,11 +1149,11 @@ function Jn(t, e) {
|
|
|
1149
1149
|
}, []), a = t.slice(r);
|
|
1150
1150
|
return a && o.push(a), o;
|
|
1151
1151
|
}
|
|
1152
|
-
function
|
|
1152
|
+
function Gn(t) {
|
|
1153
1153
|
const e = xe(t.path.toString());
|
|
1154
1154
|
return new RegExp(`^${e}$`, "i");
|
|
1155
1155
|
}
|
|
1156
|
-
function
|
|
1156
|
+
function Kn(t) {
|
|
1157
1157
|
const e = new URLSearchParams(t.query.toString());
|
|
1158
1158
|
return Array.from(e.entries()).filter(([, n]) => !$t(n)).map(([n, r]) => {
|
|
1159
1159
|
const o = xe(r);
|
|
@@ -1161,22 +1161,22 @@ function Gn(t) {
|
|
|
1161
1161
|
});
|
|
1162
1162
|
}
|
|
1163
1163
|
function xe(t) {
|
|
1164
|
-
return
|
|
1164
|
+
return Qn(t, new RegExp(zn, "g")).map((e) => e.startsWith(T) ? ke(e) : qt(e)).join("");
|
|
1165
1165
|
}
|
|
1166
1166
|
function ke(t) {
|
|
1167
1167
|
return [
|
|
1168
|
-
|
|
1169
|
-
|
|
1168
|
+
Yn,
|
|
1169
|
+
Xn
|
|
1170
1170
|
].reduce((e, n) => n(e), t);
|
|
1171
1171
|
}
|
|
1172
|
-
const
|
|
1173
|
-
function
|
|
1172
|
+
const zn = `\\${T}\\??([\\w-_]+)\\${Q}`, Wt = `\\${T}\\?([\\w-_]+)\\${Q}`, Be = `\\${T}([\\w-_]+)\\${Q}`;
|
|
1173
|
+
function Yn(t) {
|
|
1174
1174
|
return t.replace(new RegExp(Wt, "g"), ".*");
|
|
1175
1175
|
}
|
|
1176
1176
|
function $t(t) {
|
|
1177
1177
|
return new RegExp(Wt, "g").test(t);
|
|
1178
1178
|
}
|
|
1179
|
-
function
|
|
1179
|
+
function Xn(t) {
|
|
1180
1180
|
return t.replace(new RegExp(Be, "g"), ".+");
|
|
1181
1181
|
}
|
|
1182
1182
|
function St(t) {
|
|
@@ -1198,19 +1198,19 @@ function Ne(t, e) {
|
|
|
1198
1198
|
}
|
|
1199
1199
|
function Ue(t, e) {
|
|
1200
1200
|
const n = [
|
|
1201
|
-
Xn,
|
|
1202
1201
|
Zn,
|
|
1202
|
+
tr,
|
|
1203
1203
|
ke
|
|
1204
1204
|
].reduce((r, o) => o(r, e), t);
|
|
1205
1205
|
return new RegExp(n, "g");
|
|
1206
1206
|
}
|
|
1207
|
-
function
|
|
1207
|
+
function Zn(t, e) {
|
|
1208
1208
|
if (!e.startsWith("?"))
|
|
1209
1209
|
return t;
|
|
1210
1210
|
const n = new RegExp(`\\${T}\\${e}\\${Q}`, "g");
|
|
1211
1211
|
return t.replace(n, "(.*)");
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1213
|
+
function tr(t, e) {
|
|
1214
1214
|
if (e.startsWith("?"))
|
|
1215
1215
|
return t;
|
|
1216
1216
|
const n = new RegExp(`\\${T}${e}\\${Q}`, "g");
|
|
@@ -1224,25 +1224,25 @@ function Ce(t, ...e) {
|
|
|
1224
1224
|
return Object.keys(o).length === 0 ? n : n.includes("?") ? `${n}&${o}` : `${n}?${o}`;
|
|
1225
1225
|
}, t);
|
|
1226
1226
|
}
|
|
1227
|
-
function
|
|
1228
|
-
const { params: n = {}, query: r } = e, o =
|
|
1227
|
+
function er(t, e = {}) {
|
|
1228
|
+
const { params: n = {}, query: r } = e, o = nr(t.host, n), a = rr(t.path, n), s = or(t.query, n), c = Ce(`${o}${a}`, s, r), u = pt(t.hash.value ?? e.hash).toString();
|
|
1229
1229
|
return `${c}${u}`;
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1231
|
+
function nr(t, e) {
|
|
1232
1232
|
const n = t.toString();
|
|
1233
1233
|
return Object.entries(t.params).reduce((r, [o, a]) => {
|
|
1234
1234
|
const s = St(`${T}${o}${Q}`);
|
|
1235
1235
|
return s ? Ne(r, { name: o, param: a, value: e[s] }) : r;
|
|
1236
1236
|
}, n);
|
|
1237
1237
|
}
|
|
1238
|
-
function
|
|
1238
|
+
function rr(t, e) {
|
|
1239
1239
|
const n = t.toString();
|
|
1240
1240
|
return Object.entries(t.params).reduce((r, [o, a]) => {
|
|
1241
1241
|
const s = St(`${T}${o}${Q}`);
|
|
1242
1242
|
return s ? Ne(r, { name: o, param: a, value: e[s] }) : r;
|
|
1243
1243
|
}, n);
|
|
1244
1244
|
}
|
|
1245
|
-
function
|
|
1245
|
+
function or(t, e) {
|
|
1246
1246
|
const n = t.toString();
|
|
1247
1247
|
if (!n)
|
|
1248
1248
|
return {};
|
|
@@ -1251,37 +1251,37 @@ function rr(t, e) {
|
|
|
1251
1251
|
const c = St(s);
|
|
1252
1252
|
if (!c)
|
|
1253
1253
|
return { ...o, [a]: s };
|
|
1254
|
-
const l = at(e[c], t.params[c], $t(s)),
|
|
1255
|
-
return $t(s) &&
|
|
1254
|
+
const l = at(e[c], t.params[c], $t(s)), h = e[c] === void 0 && l === "";
|
|
1255
|
+
return $t(s) && h ? o : { ...o, [a]: l };
|
|
1256
1256
|
}, {});
|
|
1257
1257
|
}
|
|
1258
|
-
function
|
|
1258
|
+
function ar(t) {
|
|
1259
1259
|
return (e, n, r) => {
|
|
1260
1260
|
if (D(e))
|
|
1261
1261
|
return Ce(e, (n ?? {}).query);
|
|
1262
1262
|
const o = n ?? {}, a = r ?? {}, s = t.find((u) => u.name === e);
|
|
1263
1263
|
if (!s)
|
|
1264
|
-
throw new
|
|
1265
|
-
return
|
|
1264
|
+
throw new Jn(String(e));
|
|
1265
|
+
return er(s, {
|
|
1266
1266
|
params: o,
|
|
1267
1267
|
query: a.query,
|
|
1268
1268
|
hash: a.hash
|
|
1269
1269
|
});
|
|
1270
1270
|
};
|
|
1271
1271
|
}
|
|
1272
|
-
class
|
|
1272
|
+
class sr extends Error {
|
|
1273
1273
|
constructor() {
|
|
1274
1274
|
super("initialUrl must be set if window.location is unavailable");
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
|
-
function
|
|
1277
|
+
function cr(t) {
|
|
1278
1278
|
if (t)
|
|
1279
1279
|
return t;
|
|
1280
1280
|
if (de())
|
|
1281
1281
|
return window.location.toString();
|
|
1282
|
-
throw new
|
|
1282
|
+
throw new sr();
|
|
1283
1283
|
}
|
|
1284
|
-
const
|
|
1284
|
+
const ur = (t, e) => {
|
|
1285
1285
|
try {
|
|
1286
1286
|
$e(t, e);
|
|
1287
1287
|
} catch {
|
|
@@ -1291,11 +1291,11 @@ const cr = (t, e) => {
|
|
|
1291
1291
|
}, $e = (t, e) => {
|
|
1292
1292
|
const { pathname: n, search: r } = M(e);
|
|
1293
1293
|
return {
|
|
1294
|
-
...
|
|
1295
|
-
...
|
|
1294
|
+
...ir(t.path, n),
|
|
1295
|
+
...fr(t.query, r)
|
|
1296
1296
|
};
|
|
1297
1297
|
};
|
|
1298
|
-
function
|
|
1298
|
+
function ir(t, e) {
|
|
1299
1299
|
const n = {}, r = decodeURIComponent(e);
|
|
1300
1300
|
for (const [o, a] of Object.entries(t.params)) {
|
|
1301
1301
|
const s = o.startsWith("?"), c = s ? o.slice(1) : o, u = Le(r, t.toString(), o), l = ot(u, a, s);
|
|
@@ -1303,7 +1303,7 @@ function ur(t, e) {
|
|
|
1303
1303
|
}
|
|
1304
1304
|
return n;
|
|
1305
1305
|
}
|
|
1306
|
-
function
|
|
1306
|
+
function fr(t, e) {
|
|
1307
1307
|
const n = {}, r = new URLSearchParams(e);
|
|
1308
1308
|
for (const [o, a] of Object.entries(t.params)) {
|
|
1309
1309
|
const s = o.startsWith("?"), c = s ? o.slice(1) : o, u = r.get(c) ?? void 0, l = ot(u, a, s);
|
|
@@ -1311,27 +1311,27 @@ function ir(t, e) {
|
|
|
1311
1311
|
}
|
|
1312
1312
|
return n;
|
|
1313
1313
|
}
|
|
1314
|
-
const
|
|
1314
|
+
const lr = (t) => "name" in t.matched && !!t.matched.name, hr = (t, e) => {
|
|
1315
1315
|
const { pathname: n } = M(e);
|
|
1316
|
-
return
|
|
1317
|
-
}, hr = (t, e) => {
|
|
1318
|
-
const { search: n } = M(e);
|
|
1319
|
-
return Gn(t).every((o) => o.test(n));
|
|
1316
|
+
return Gn(t).test(n);
|
|
1320
1317
|
}, pr = (t, e) => {
|
|
1318
|
+
const { search: n } = M(e);
|
|
1319
|
+
return Kn(t).every((o) => o.test(n));
|
|
1320
|
+
}, mr = (t, e) => {
|
|
1321
1321
|
const { hash: n } = M(e), r = t.hash.toString();
|
|
1322
1322
|
return !t.hash.hasValue() || r.toLowerCase() === n.toLowerCase();
|
|
1323
1323
|
};
|
|
1324
|
-
function
|
|
1324
|
+
function dr(t) {
|
|
1325
1325
|
const { searchParams: e, pathname: n } = M(t), r = -1, o = 1;
|
|
1326
1326
|
return (a, s) => {
|
|
1327
|
-
const c = Zt(a, e), u = Xt(a, n), l = Zt(s, e),
|
|
1327
|
+
const c = Zt(a, e), u = Xt(a, n), l = Zt(s, e), h = Xt(s, n);
|
|
1328
1328
|
if (a.depth > s.depth)
|
|
1329
1329
|
return r;
|
|
1330
1330
|
if (a.depth < s.depth)
|
|
1331
1331
|
return o;
|
|
1332
|
-
if (c + u > l +
|
|
1332
|
+
if (c + u > l + h)
|
|
1333
1333
|
return r;
|
|
1334
|
-
if (c + u < l +
|
|
1334
|
+
if (c + u < l + h)
|
|
1335
1335
|
return o;
|
|
1336
1336
|
const { hash: i } = M(t);
|
|
1337
1337
|
return a.hash.toString() === i ? r : s.hash.toString() === i ? o : 0;
|
|
@@ -1349,7 +1349,7 @@ function He(t) {
|
|
|
1349
1349
|
return !!t && typeof t == "object";
|
|
1350
1350
|
}
|
|
1351
1351
|
const vt = !0;
|
|
1352
|
-
function
|
|
1352
|
+
function gr(t, e, n) {
|
|
1353
1353
|
if (He(t) && e in t) {
|
|
1354
1354
|
const r = t[e];
|
|
1355
1355
|
if (typeof r == "string")
|
|
@@ -1357,15 +1357,15 @@ function dr(t, e, n) {
|
|
|
1357
1357
|
}
|
|
1358
1358
|
return ot(void 0, n, vt);
|
|
1359
1359
|
}
|
|
1360
|
-
function
|
|
1360
|
+
function Rr(t, e) {
|
|
1361
1361
|
const n = {};
|
|
1362
1362
|
for (const [r, o] of Object.entries(t)) {
|
|
1363
|
-
const a =
|
|
1363
|
+
const a = gr(e, r, o);
|
|
1364
1364
|
n[r] = a;
|
|
1365
1365
|
}
|
|
1366
1366
|
return n;
|
|
1367
1367
|
}
|
|
1368
|
-
function
|
|
1368
|
+
function yr(t, e, n) {
|
|
1369
1369
|
if (He(t) && e in t) {
|
|
1370
1370
|
const r = t[e];
|
|
1371
1371
|
return at(r, n, vt);
|
|
@@ -1375,19 +1375,19 @@ function Rr(t, e, n) {
|
|
|
1375
1375
|
const te = (t, e) => {
|
|
1376
1376
|
const n = {};
|
|
1377
1377
|
for (const [r, o] of Object.entries(t)) {
|
|
1378
|
-
const a =
|
|
1378
|
+
const a = yr(e, r, o);
|
|
1379
1379
|
n[r] = a;
|
|
1380
1380
|
}
|
|
1381
1381
|
return n;
|
|
1382
|
-
},
|
|
1383
|
-
fr,
|
|
1382
|
+
}, vr = [
|
|
1384
1383
|
lr,
|
|
1385
1384
|
hr,
|
|
1386
1385
|
pr,
|
|
1387
|
-
|
|
1386
|
+
mr,
|
|
1387
|
+
ur
|
|
1388
1388
|
];
|
|
1389
1389
|
function Lt(t, e, n) {
|
|
1390
|
-
const r =
|
|
1390
|
+
const r = dr(e), o = t.filter((u) => vr.every((l) => l(u, e))).sort(r);
|
|
1391
1391
|
if (o.length === 0)
|
|
1392
1392
|
return;
|
|
1393
1393
|
const [a] = o, { search: s, hash: c } = M(e);
|
|
@@ -1397,32 +1397,37 @@ function Lt(t, e, n) {
|
|
|
1397
1397
|
name: a.name,
|
|
1398
1398
|
query: Ae(s),
|
|
1399
1399
|
params: $e(a, e),
|
|
1400
|
-
state:
|
|
1400
|
+
state: Rr(a.state, n),
|
|
1401
1401
|
hash: c
|
|
1402
1402
|
};
|
|
1403
1403
|
}
|
|
1404
|
+
function wr() {
|
|
1405
|
+
let t = 0;
|
|
1406
|
+
return () => (++t).toString();
|
|
1407
|
+
}
|
|
1408
|
+
const Ve = wr();
|
|
1404
1409
|
function Dt(t, e) {
|
|
1405
1410
|
const n = new RegExp(`\\${T}(\\??[\\w-_]+)\\${Q}`, "g");
|
|
1406
1411
|
return Array.from(t.matchAll(n)).reduce((o, [a, s]) => {
|
|
1407
1412
|
const c = St(a);
|
|
1408
1413
|
if (!c)
|
|
1409
1414
|
return o;
|
|
1410
|
-
const u =
|
|
1415
|
+
const u = An(e, c);
|
|
1411
1416
|
return et([c], o), o[s] = u, o;
|
|
1412
1417
|
}, {});
|
|
1413
1418
|
}
|
|
1414
|
-
function
|
|
1419
|
+
function je(t, e) {
|
|
1415
1420
|
return {
|
|
1416
1421
|
value: t,
|
|
1417
1422
|
params: Dt(t, e),
|
|
1418
1423
|
toString: () => t
|
|
1419
1424
|
};
|
|
1420
1425
|
}
|
|
1421
|
-
function
|
|
1426
|
+
function Er(t) {
|
|
1422
1427
|
return ut(t) && typeof t.hash == "string";
|
|
1423
1428
|
}
|
|
1424
|
-
function
|
|
1425
|
-
return t === void 0 ? pt() :
|
|
1429
|
+
function Oe(t) {
|
|
1430
|
+
return t === void 0 ? pt() : Er(t) ? t : pt(t);
|
|
1426
1431
|
}
|
|
1427
1432
|
function Mt(t) {
|
|
1428
1433
|
return t === void 0 ? "" : t;
|
|
@@ -1434,11 +1439,11 @@ function ee(t, e) {
|
|
|
1434
1439
|
toString: () => t
|
|
1435
1440
|
};
|
|
1436
1441
|
}
|
|
1437
|
-
function
|
|
1442
|
+
function Pr(t) {
|
|
1438
1443
|
return ut(t) && typeof t.value == "string";
|
|
1439
1444
|
}
|
|
1440
|
-
function
|
|
1441
|
-
return t === void 0 ? ee("", {}) :
|
|
1445
|
+
function _e(t) {
|
|
1446
|
+
return t === void 0 ? ee("", {}) : Pr(t) ? t : ee(t, {});
|
|
1442
1447
|
}
|
|
1443
1448
|
function ne(t, e) {
|
|
1444
1449
|
return {
|
|
@@ -1447,29 +1452,30 @@ function ne(t, e) {
|
|
|
1447
1452
|
toString: () => t
|
|
1448
1453
|
};
|
|
1449
1454
|
}
|
|
1450
|
-
function
|
|
1455
|
+
function Sr(t) {
|
|
1451
1456
|
return ut(t) && typeof t.value == "string";
|
|
1452
1457
|
}
|
|
1453
|
-
function
|
|
1454
|
-
return t === void 0 ? ne("", {}) :
|
|
1458
|
+
function qe(t) {
|
|
1459
|
+
return t === void 0 ? ne("", {}) : Sr(t) ? t : ne(t, {});
|
|
1455
1460
|
}
|
|
1456
1461
|
function J(t) {
|
|
1457
|
-
const e = Mt(t.name),
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1462
|
+
const e = Ve(), n = Mt(t.name), r = _e(t.path), o = qe(t.query), a = Oe(t.hash), s = t.meta ?? {}, c = vn(t) ? t.state : {}, u = lt({ meta: {}, state: {}, ...t }), l = {
|
|
1463
|
+
id: e,
|
|
1464
|
+
matched: u,
|
|
1465
|
+
matches: [u],
|
|
1466
|
+
name: n,
|
|
1467
|
+
path: r,
|
|
1468
|
+
query: o,
|
|
1469
|
+
hash: a,
|
|
1470
|
+
meta: s,
|
|
1471
|
+
state: c,
|
|
1466
1472
|
depth: 1,
|
|
1467
|
-
host:
|
|
1473
|
+
host: je("", {}),
|
|
1468
1474
|
prefetch: t.prefetch
|
|
1469
|
-
},
|
|
1470
|
-
return et(
|
|
1475
|
+
}, h = pe(t) ? me(t.parent, l) : l;
|
|
1476
|
+
return et(h.path.params, h.query.params), h;
|
|
1471
1477
|
}
|
|
1472
|
-
function
|
|
1478
|
+
function br(t, e) {
|
|
1473
1479
|
if (!it(e))
|
|
1474
1480
|
return t;
|
|
1475
1481
|
const n = J({ path: e });
|
|
@@ -1478,7 +1484,7 @@ function Pr(t, e) {
|
|
|
1478
1484
|
...r
|
|
1479
1485
|
}));
|
|
1480
1486
|
}
|
|
1481
|
-
class
|
|
1487
|
+
class Ar extends Error {
|
|
1482
1488
|
/**
|
|
1483
1489
|
* Constructs a new DuplicateNamesError instance with a message indicating the problematic name.
|
|
1484
1490
|
* @param name - The name of the name that was duplicated.
|
|
@@ -1487,30 +1493,30 @@ class Sr extends Error {
|
|
|
1487
1493
|
super(`Invalid Name "${e}": Router does not support multiple routes with the same name. All name names must be unique.`);
|
|
1488
1494
|
}
|
|
1489
1495
|
}
|
|
1490
|
-
function
|
|
1496
|
+
function xr(t) {
|
|
1491
1497
|
const e = t.map(({ name: n }) => n);
|
|
1492
1498
|
for (const n of e)
|
|
1493
1499
|
if (he(e, n) > 1)
|
|
1494
|
-
throw new
|
|
1500
|
+
throw new Ar(n);
|
|
1495
1501
|
}
|
|
1496
|
-
function
|
|
1497
|
-
const n =
|
|
1498
|
-
|
|
1499
|
-
const o =
|
|
1502
|
+
function Tr(t, e) {
|
|
1503
|
+
const n = un(t) ? t.flat() : t, r = br(n, e == null ? void 0 : e.base);
|
|
1504
|
+
xr(r);
|
|
1505
|
+
const o = ar(r), a = On({
|
|
1500
1506
|
mode: e == null ? void 0 : e.historyMode,
|
|
1501
1507
|
listener: ({ location: y }) => {
|
|
1502
1508
|
const B = K(y);
|
|
1503
1509
|
P(B, { state: y.state });
|
|
1504
1510
|
}
|
|
1505
|
-
}), { runBeforeRouteHooks: s, runAfterRouteHooks: c } =
|
|
1511
|
+
}), { runBeforeRouteHooks: s, runAfterRouteHooks: c } = Dn(), {
|
|
1506
1512
|
hooks: u,
|
|
1507
1513
|
onBeforeRouteEnter: l,
|
|
1508
|
-
onAfterRouteUpdate:
|
|
1514
|
+
onAfterRouteUpdate: h,
|
|
1509
1515
|
onBeforeRouteLeave: i,
|
|
1510
1516
|
onAfterRouteEnter: v,
|
|
1511
|
-
onBeforeRouteUpdate:
|
|
1517
|
+
onBeforeRouteUpdate: m,
|
|
1512
1518
|
onAfterRouteLeave: A
|
|
1513
|
-
} =
|
|
1519
|
+
} = Tn();
|
|
1514
1520
|
async function P(y, B = {}) {
|
|
1515
1521
|
if (a.stopListening(), N(y))
|
|
1516
1522
|
return a.update(y, B);
|
|
@@ -1530,18 +1536,18 @@ function Dr(t, e) {
|
|
|
1530
1536
|
default:
|
|
1531
1537
|
throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(z)}`);
|
|
1532
1538
|
}
|
|
1533
|
-
const
|
|
1534
|
-
switch (
|
|
1539
|
+
const I = await c({ to: _, from: q, hooks: u });
|
|
1540
|
+
switch (I.status) {
|
|
1535
1541
|
case "PUSH":
|
|
1536
|
-
await k(...
|
|
1542
|
+
await k(...I.to);
|
|
1537
1543
|
break;
|
|
1538
1544
|
case "REJECT":
|
|
1539
|
-
R(
|
|
1545
|
+
R(I.type);
|
|
1540
1546
|
break;
|
|
1541
1547
|
case "SUCCESS":
|
|
1542
1548
|
break;
|
|
1543
1549
|
default:
|
|
1544
|
-
const W =
|
|
1550
|
+
const W = I;
|
|
1545
1551
|
throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(W)}`);
|
|
1546
1552
|
}
|
|
1547
1553
|
a.startListening();
|
|
@@ -1551,15 +1557,15 @@ function Dr(t, e) {
|
|
|
1551
1557
|
const nt = { ...B }, xt = o(y, nt);
|
|
1552
1558
|
return P(xt, nt);
|
|
1553
1559
|
}
|
|
1554
|
-
const q = { ..._ },
|
|
1555
|
-
return P(
|
|
1560
|
+
const q = { ..._ }, I = o(y, B ?? {}, q), W = bt(y), At = te((W == null ? void 0 : W.state) ?? {}, q.state);
|
|
1561
|
+
return P(I, { ...q, state: At });
|
|
1556
1562
|
}, C = (y, B, _) => {
|
|
1557
1563
|
if (D(y)) {
|
|
1558
1564
|
const nt = { ...B, replace: !0 }, xt = o(y, nt);
|
|
1559
1565
|
return P(xt, nt);
|
|
1560
1566
|
}
|
|
1561
|
-
const q = { ..._, replace: !0 },
|
|
1562
|
-
return P(
|
|
1567
|
+
const q = { ..._, replace: !0 }, I = o(y, B ?? {}, q), W = bt(y), At = te((W == null ? void 0 : W.state) ?? {}, q.state);
|
|
1568
|
+
return P(I, { ...q, state: At });
|
|
1563
1569
|
}, O = (y) => R(y), g = (y, B = {}) => {
|
|
1564
1570
|
if (!D(y)) {
|
|
1565
1571
|
const _ = o(y, B);
|
|
@@ -1567,17 +1573,17 @@ function Dr(t, e) {
|
|
|
1567
1573
|
}
|
|
1568
1574
|
if (!N(y))
|
|
1569
1575
|
return Lt(r, y);
|
|
1570
|
-
}, { setRejection: R, rejection: S, getRejectionRoute: b } = Fn(e ?? {}),
|
|
1576
|
+
}, { setRejection: R, rejection: S, getRejectionRoute: b } = Fn(e ?? {}), d = b("NotFound"), { currentRoute: f, routerRoute: p, updateRoute: w } = $n(d, k);
|
|
1571
1577
|
a.startListening();
|
|
1572
|
-
const E =
|
|
1578
|
+
const E = cr(e == null ? void 0 : e.initialUrl), x = a.location.state, { host: L } = M(E), N = jn(L), H = P(E, { replace: !0, state: x });
|
|
1573
1579
|
function bt(y) {
|
|
1574
1580
|
return r.find((B) => B.name === y);
|
|
1575
1581
|
}
|
|
1576
|
-
function
|
|
1577
|
-
y.component("RouterView",
|
|
1582
|
+
function Ie(y) {
|
|
1583
|
+
y.component("RouterView", _r), y.component("RouterLink", Or), y.provide(Ee, S), y.provide(be, u), y.provide(le, Jt);
|
|
1578
1584
|
}
|
|
1579
1585
|
const Jt = {
|
|
1580
|
-
route:
|
|
1586
|
+
route: p,
|
|
1581
1587
|
resolve: o,
|
|
1582
1588
|
push: k,
|
|
1583
1589
|
replace: C,
|
|
@@ -1587,14 +1593,14 @@ function Dr(t, e) {
|
|
|
1587
1593
|
forward: a.forward,
|
|
1588
1594
|
back: a.back,
|
|
1589
1595
|
go: a.go,
|
|
1590
|
-
install:
|
|
1596
|
+
install: Ie,
|
|
1591
1597
|
initialized: H,
|
|
1592
1598
|
isExternal: N,
|
|
1593
1599
|
onBeforeRouteEnter: l,
|
|
1594
|
-
onAfterRouteUpdate:
|
|
1600
|
+
onAfterRouteUpdate: h,
|
|
1595
1601
|
onBeforeRouteLeave: i,
|
|
1596
1602
|
onAfterRouteEnter: v,
|
|
1597
|
-
onBeforeRouteUpdate:
|
|
1603
|
+
onBeforeRouteUpdate: m,
|
|
1598
1604
|
onAfterRouteLeave: A,
|
|
1599
1605
|
prefetch: e == null ? void 0 : e.prefetch
|
|
1600
1606
|
};
|
|
@@ -1603,17 +1609,17 @@ function Dr(t, e) {
|
|
|
1603
1609
|
const wt = { template: "<div>This is component</div>" }, Tt = J({
|
|
1604
1610
|
name: "parentA",
|
|
1605
1611
|
path: "/parentA/[paramA]"
|
|
1606
|
-
}),
|
|
1612
|
+
}), We = J({
|
|
1607
1613
|
parent: Tt,
|
|
1608
1614
|
name: "parentA.childA",
|
|
1609
1615
|
path: "/[?paramB]"
|
|
1610
|
-
}),
|
|
1616
|
+
}), kr = J({
|
|
1611
1617
|
parent: Tt,
|
|
1612
1618
|
name: "parentA.childB",
|
|
1613
1619
|
path: "/[paramD]",
|
|
1614
1620
|
component: wt
|
|
1615
|
-
}),
|
|
1616
|
-
parent:
|
|
1621
|
+
}), Br = J({
|
|
1622
|
+
parent: We,
|
|
1617
1623
|
name: "parentA.childA.grandChildA",
|
|
1618
1624
|
path: "/[paramC]",
|
|
1619
1625
|
component: wt
|
|
@@ -1627,23 +1633,23 @@ J({
|
|
|
1627
1633
|
path: "/",
|
|
1628
1634
|
component: wt
|
|
1629
1635
|
});
|
|
1630
|
-
const
|
|
1636
|
+
const Lr = {
|
|
1631
1637
|
components: !0
|
|
1632
1638
|
};
|
|
1633
|
-
function
|
|
1634
|
-
return Nt(n, r) ?? Nt(e, r) ?? Nt(t, r) ??
|
|
1639
|
+
function Nr({ routerPrefetch: t, routePrefetch: e, linkPrefetch: n }, r) {
|
|
1640
|
+
return Nt(n, r) ?? Nt(e, r) ?? Nt(t, r) ?? Lr[r];
|
|
1635
1641
|
}
|
|
1636
1642
|
function Nt(t, e) {
|
|
1637
1643
|
return ut(t) ? t[e] : t;
|
|
1638
1644
|
}
|
|
1639
|
-
const
|
|
1645
|
+
const Ur = Ke(() => new Promise((t) => {
|
|
1640
1646
|
t({ default: { template: "" } });
|
|
1641
1647
|
}));
|
|
1642
1648
|
function re(t) {
|
|
1643
|
-
return t.name ===
|
|
1649
|
+
return t.name === Ur.name && "setup" in t;
|
|
1644
1650
|
}
|
|
1645
|
-
function
|
|
1646
|
-
const r = Vt(), o =
|
|
1651
|
+
function Cr(t, e = {}, n = {}) {
|
|
1652
|
+
const r = Vt(), o = ze(t), a = j(() => D(o.value) ? {} : kt(e)), s = j(() => D(o.value) ? kt(e) : kt(n)), c = j(() => {
|
|
1647
1653
|
if (D(o.value))
|
|
1648
1654
|
return o.value;
|
|
1649
1655
|
try {
|
|
@@ -1651,27 +1657,27 @@ function Nr(t, e = {}, n = {}) {
|
|
|
1651
1657
|
} catch (i) {
|
|
1652
1658
|
throw i instanceof X && console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`, i), i;
|
|
1653
1659
|
}
|
|
1654
|
-
}), u = j(() => r.find(c.value, s.value)), l = j(() => !!u.value && r.route.matches.includes(u.value.matched)),
|
|
1660
|
+
}), u = j(() => r.find(c.value, s.value)), l = j(() => !!u.value && r.route.matches.includes(u.value.matched)), h = j(() => !!u.value && r.route.matched === u.value.matched);
|
|
1655
1661
|
return se(u, (i) => {
|
|
1656
1662
|
if (!i)
|
|
1657
1663
|
return;
|
|
1658
|
-
const { prefetch: v } = r, { prefetch:
|
|
1659
|
-
|
|
1664
|
+
const { prefetch: v } = r, { prefetch: m } = s.value;
|
|
1665
|
+
$r(i, {
|
|
1660
1666
|
routerPrefetch: v,
|
|
1661
|
-
linkPrefetch:
|
|
1667
|
+
linkPrefetch: m
|
|
1662
1668
|
});
|
|
1663
1669
|
}, { immediate: !0 }), {
|
|
1664
1670
|
route: u,
|
|
1665
1671
|
href: c,
|
|
1666
1672
|
isMatch: l,
|
|
1667
|
-
isExactMatch:
|
|
1673
|
+
isExactMatch: h,
|
|
1668
1674
|
push: (i) => r.push(c.value, {}, { ...s.value, ...i }),
|
|
1669
1675
|
replace: (i) => r.replace(c.value, {}, { ...s.value, ...i })
|
|
1670
1676
|
};
|
|
1671
1677
|
}
|
|
1672
|
-
function
|
|
1678
|
+
function $r(t, { routerPrefetch: e, linkPrefetch: n }) {
|
|
1673
1679
|
t.matches.forEach((r) => {
|
|
1674
|
-
|
|
1680
|
+
Nr({
|
|
1675
1681
|
routePrefetch: r.prefetch,
|
|
1676
1682
|
routerPrefetch: e,
|
|
1677
1683
|
linkPrefetch: n
|
|
@@ -1680,8 +1686,8 @@ function Ur(t, { routerPrefetch: e, linkPrefetch: n }) {
|
|
|
1680
1686
|
}));
|
|
1681
1687
|
});
|
|
1682
1688
|
}
|
|
1683
|
-
function
|
|
1684
|
-
if (!
|
|
1689
|
+
function Hr(t, e, { exact: n } = {}) {
|
|
1690
|
+
if (!Un(t))
|
|
1685
1691
|
return !1;
|
|
1686
1692
|
if (e === void 0)
|
|
1687
1693
|
return !0;
|
|
@@ -1692,39 +1698,39 @@ function Cr(t, e, { exact: n } = {}) {
|
|
|
1692
1698
|
}
|
|
1693
1699
|
return r.includes(e);
|
|
1694
1700
|
}
|
|
1695
|
-
function
|
|
1701
|
+
function Vr(t, e) {
|
|
1696
1702
|
const n = Vt();
|
|
1697
1703
|
function r() {
|
|
1698
1704
|
if (!t)
|
|
1699
1705
|
return;
|
|
1700
|
-
if (!
|
|
1701
|
-
throw new
|
|
1706
|
+
if (!Hr(n.route, t, e))
|
|
1707
|
+
throw new cn(t, n.route.name);
|
|
1702
1708
|
}
|
|
1703
1709
|
return se(n.route, r, { immediate: !0, deep: !0 }), n.route;
|
|
1704
1710
|
}
|
|
1705
|
-
const
|
|
1706
|
-
function
|
|
1707
|
-
return Et(
|
|
1711
|
+
const De = Symbol();
|
|
1712
|
+
function It() {
|
|
1713
|
+
return Et(De, 0);
|
|
1708
1714
|
}
|
|
1709
|
-
function
|
|
1715
|
+
function Me() {
|
|
1710
1716
|
const t = Et(be);
|
|
1711
1717
|
if (!t)
|
|
1712
1718
|
throw new Ht();
|
|
1713
1719
|
return t;
|
|
1714
1720
|
}
|
|
1715
|
-
function
|
|
1721
|
+
function Te(t) {
|
|
1716
1722
|
return (e) => {
|
|
1717
|
-
const n =
|
|
1723
|
+
const n = It(), o = Me().addBeforeRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
|
|
1718
1724
|
return ce(o), o;
|
|
1719
1725
|
};
|
|
1720
1726
|
}
|
|
1721
|
-
function
|
|
1727
|
+
function Ft(t) {
|
|
1722
1728
|
return (e) => {
|
|
1723
|
-
const n =
|
|
1729
|
+
const n = It(), o = Me().addAfterRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
|
|
1724
1730
|
return ce(o), o;
|
|
1725
1731
|
};
|
|
1726
1732
|
}
|
|
1727
|
-
const
|
|
1733
|
+
const Ir = Te("onBeforeRouteUpdate"), Fr = Te("onBeforeRouteLeave"), Jr = Ft("onAfterRouteEnter"), Qr = Ft("onAfterRouteUpdate"), Gr = Ft("onAfterRouteLeave"), jr = ["href"], Or = /* @__PURE__ */ ct({
|
|
1728
1734
|
__name: "routerLink",
|
|
1729
1735
|
props: {
|
|
1730
1736
|
to: {},
|
|
@@ -1738,37 +1744,37 @@ const Mr = Me("onBeforeRouteUpdate"), Tr = Me("onBeforeRouteLeave"), Fr = It("on
|
|
|
1738
1744
|
const e = t, n = Vt(), r = j(() => D(e.to) ? e.to : e.to(n.resolve)), o = j(() => {
|
|
1739
1745
|
const { to: i, ...v } = e;
|
|
1740
1746
|
return v;
|
|
1741
|
-
}), { href: a, isMatch: s, isExactMatch: c } =
|
|
1747
|
+
}), { href: a, isMatch: s, isExactMatch: c } = Cr(r, o), u = j(() => ({
|
|
1742
1748
|
"router-link--match": s.value,
|
|
1743
1749
|
"router-link--exact-match": c.value
|
|
1744
1750
|
})), l = j(() => n.isExternal(r.value));
|
|
1745
|
-
function
|
|
1751
|
+
function h(i) {
|
|
1746
1752
|
i.preventDefault(), n.push(a.value, o.value);
|
|
1747
1753
|
}
|
|
1748
|
-
return (i, v) => (ue(),
|
|
1754
|
+
return (i, v) => (ue(), Ye("a", {
|
|
1749
1755
|
href: r.value,
|
|
1750
|
-
class:
|
|
1751
|
-
onClick:
|
|
1756
|
+
class: Xe(["router-link", u.value]),
|
|
1757
|
+
onClick: h
|
|
1752
1758
|
}, [
|
|
1753
|
-
ie(i.$slots, "default", fe(
|
|
1754
|
-
], 10,
|
|
1759
|
+
ie(i.$slots, "default", fe(Ze({ resolved: r.value, isMatch: ht(s), isExactMatch: ht(c), isExternal: l.value })))
|
|
1760
|
+
], 10, jr));
|
|
1755
1761
|
}
|
|
1756
|
-
}),
|
|
1762
|
+
}), _r = /* @__PURE__ */ ct({
|
|
1757
1763
|
__name: "routerView",
|
|
1758
1764
|
props: {
|
|
1759
1765
|
name: {}
|
|
1760
1766
|
},
|
|
1761
1767
|
setup(t) {
|
|
1762
|
-
const { name: e = "default" } = t, n =
|
|
1763
|
-
|
|
1768
|
+
const { name: e = "default" } = t, n = Vr(), r = Nn(), o = It(), a = tn("RouterView", !0);
|
|
1769
|
+
en(De, o + 1);
|
|
1764
1770
|
const s = j(() => {
|
|
1765
1771
|
if (r.value)
|
|
1766
1772
|
return r.value.component;
|
|
1767
1773
|
const i = n.matches.at(o);
|
|
1768
1774
|
if (!i)
|
|
1769
1775
|
return null;
|
|
1770
|
-
const v = c(i),
|
|
1771
|
-
return v ?
|
|
1776
|
+
const v = c(i), m = l(i);
|
|
1777
|
+
return v ? m ? (n.params, wn(v, () => m(n.params))) : v : null;
|
|
1772
1778
|
});
|
|
1773
1779
|
function c(i) {
|
|
1774
1780
|
return u(i)[e];
|
|
@@ -1777,62 +1783,63 @@ const Mr = Me("onBeforeRouteUpdate"), Tr = Me("onBeforeRouteLeave"), Fr = It("on
|
|
|
1777
1783
|
return Ct(i) ? i.components : Ut(i) ? { default: i.component } : typeof a == "string" ? {} : { default: a };
|
|
1778
1784
|
}
|
|
1779
1785
|
function l(i) {
|
|
1780
|
-
return
|
|
1786
|
+
return h(i)[e];
|
|
1781
1787
|
}
|
|
1782
|
-
function
|
|
1788
|
+
function h(i) {
|
|
1783
1789
|
return Ct(i) ? i.props ?? {} : Ut(i) ? { default: i.props } : {};
|
|
1784
1790
|
}
|
|
1785
|
-
return (i, v) => s.value ? ie(i.$slots, "default", fe(
|
|
1786
|
-
(ue(),
|
|
1787
|
-
]) :
|
|
1791
|
+
return (i, v) => s.value ? ie(i.$slots, "default", fe(nn({ key: 0 }, { route: ht(n), component: s.value, rejection: ht(r) })), () => [
|
|
1792
|
+
(ue(), rn(on(s.value)))
|
|
1793
|
+
]) : an("", !0);
|
|
1788
1794
|
}
|
|
1789
1795
|
});
|
|
1790
|
-
function
|
|
1796
|
+
function qr(t) {
|
|
1791
1797
|
return ut(t) && typeof t.value == "string";
|
|
1792
1798
|
}
|
|
1793
1799
|
function oe(t) {
|
|
1794
|
-
return
|
|
1795
|
-
}
|
|
1796
|
-
function
|
|
1797
|
-
const e = Mt(t.name),
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1800
|
+
return qr(t) ? t : je(t, {});
|
|
1801
|
+
}
|
|
1802
|
+
function Kr(t) {
|
|
1803
|
+
const e = Ve(), n = Mt(t.name), r = _e(t.path), o = qe(t.query), a = Oe(t.hash), s = t.meta ?? {}, c = yn(t) ? oe(t.host) : oe(""), u = lt({ meta: {}, state: {}, ...t }), l = {
|
|
1804
|
+
id: e,
|
|
1805
|
+
matched: u,
|
|
1806
|
+
matches: [u],
|
|
1807
|
+
name: n,
|
|
1808
|
+
host: c,
|
|
1809
|
+
path: r,
|
|
1810
|
+
query: o,
|
|
1811
|
+
hash: a,
|
|
1812
|
+
meta: s,
|
|
1806
1813
|
depth: 1,
|
|
1807
1814
|
state: {}
|
|
1808
|
-
},
|
|
1809
|
-
return et(
|
|
1815
|
+
}, h = pe(t) ? me(t.parent, l) : l;
|
|
1816
|
+
return et(h.path.params, h.query.params, h.host.params), h;
|
|
1810
1817
|
}
|
|
1811
1818
|
export {
|
|
1812
|
-
|
|
1813
|
-
|
|
1819
|
+
sn as DuplicateParamsError,
|
|
1820
|
+
Or as RouterLink,
|
|
1814
1821
|
Ht as RouterNotInstalledError,
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1822
|
+
_r as RouterView,
|
|
1823
|
+
cn as UseRouteInvalidError,
|
|
1824
|
+
wn as component,
|
|
1825
|
+
Kr as createExternalRoute,
|
|
1826
|
+
kn as createParam,
|
|
1820
1827
|
J as createRoute,
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1828
|
+
Tr as createRouter,
|
|
1829
|
+
bn as isParamWithDefault,
|
|
1830
|
+
Hr as isRoute,
|
|
1831
|
+
Jr as onAfterRouteEnter,
|
|
1832
|
+
Qr as onAfterRouteLeave,
|
|
1833
|
+
Gr as onAfterRouteUpdate,
|
|
1834
|
+
Ir as onBeforeRouteLeave,
|
|
1835
|
+
Fr as onBeforeRouteUpdate,
|
|
1829
1836
|
ee as path,
|
|
1830
1837
|
ne as query,
|
|
1831
1838
|
le as routerInjectionKey,
|
|
1832
1839
|
Ee as routerRejectionKey,
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1840
|
+
Cr as useLink,
|
|
1841
|
+
Nn as useRejection,
|
|
1842
|
+
Vr as useRoute,
|
|
1836
1843
|
Vt as useRouter,
|
|
1837
|
-
|
|
1844
|
+
Mr as withDefault
|
|
1838
1845
|
};
|