@kitbag/router 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/kitbag-router.d.ts +24 -17
- package/dist/kitbag-router.js +318 -312
- package/dist/kitbag-router.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/kitbag-router.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Me = Object.defineProperty;
|
|
2
2
|
var Te = (t, e, n) => e in t ? Me(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
3
|
var V = (t, e, n) => (Te(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
|
-
import { inject as yt, defineComponent as ct, h as ut, toRefs as Fe, reactive as
|
|
4
|
+
import { inject as yt, defineComponent as ct, h as ut, toRefs as Fe, reactive as oe, ref as Ie, markRaw as it, defineAsyncComponent as Je, toRef as Qe, computed as j, toValue as xt, watch as ae, onUnmounted as se, openBlock as ce, createElementBlock as Ge, normalizeClass as Ke, renderSlot as ue, normalizeProps as ie, guardReactiveProps as ze, unref as ft, resolveComponent as Ye, provide as Xe, mergeProps as Ze, createBlock as tn, resolveDynamicComponent as en, createCommentVNode as nn } from "vue";
|
|
5
5
|
class rn extends Error {
|
|
6
6
|
/**
|
|
7
7
|
* Constructs a new DuplicateParamsError instance with a message indicating the problematic parameter.
|
|
@@ -27,9 +27,9 @@ class on extends Error {
|
|
|
27
27
|
super(`useRoute called with incorrect route. Given ${e}, expected ${n}`);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const fe = Symbol();
|
|
31
31
|
function Ht() {
|
|
32
|
-
const t = yt(
|
|
32
|
+
const t = yt(fe);
|
|
33
33
|
if (!t)
|
|
34
34
|
throw new Ct();
|
|
35
35
|
return t;
|
|
@@ -52,13 +52,13 @@ function cn(t, e) {
|
|
|
52
52
|
function Y(t) {
|
|
53
53
|
return Array.isArray(t) ? t : [t];
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function le(t, e) {
|
|
56
56
|
return t.filter((n) => e === n).length;
|
|
57
57
|
}
|
|
58
58
|
function et(...t) {
|
|
59
59
|
const e = t.flatMap((n) => Array.isArray(n) ? n : Object.keys(n).map(un));
|
|
60
60
|
for (const n of e)
|
|
61
|
-
if (
|
|
61
|
+
if (le(e, n) > 1)
|
|
62
62
|
throw new rn(n);
|
|
63
63
|
}
|
|
64
64
|
function un(t) {
|
|
@@ -97,7 +97,7 @@ function pn(t, e) {
|
|
|
97
97
|
function mn(t) {
|
|
98
98
|
return "host" in t && !!t.host;
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function he(t) {
|
|
101
101
|
return "parent" in t && !!t.parent;
|
|
102
102
|
}
|
|
103
103
|
function Nt(t) {
|
|
@@ -109,7 +109,7 @@ function Ut(t) {
|
|
|
109
109
|
function dn(t) {
|
|
110
110
|
return "state" in t && !!t.state;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function pe(t, e) {
|
|
113
113
|
return {
|
|
114
114
|
...e,
|
|
115
115
|
path: fn(t.path, e.path),
|
|
@@ -121,7 +121,7 @@ function me(t, e) {
|
|
|
121
121
|
depth: t.depth + 1
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function me() {
|
|
125
125
|
return typeof window < "u" && typeof window.document < "u";
|
|
126
126
|
}
|
|
127
127
|
function gn(t, e) {
|
|
@@ -174,7 +174,7 @@ const C = {
|
|
|
174
174
|
throw e();
|
|
175
175
|
return t;
|
|
176
176
|
}
|
|
177
|
-
},
|
|
177
|
+
}, de = {
|
|
178
178
|
get: (t, { invalid: e }) => {
|
|
179
179
|
if (t === "true")
|
|
180
180
|
return !0;
|
|
@@ -187,7 +187,7 @@ const C = {
|
|
|
187
187
|
throw e();
|
|
188
188
|
return t.toString();
|
|
189
189
|
}
|
|
190
|
-
},
|
|
190
|
+
}, ge = {
|
|
191
191
|
get: (t, { invalid: e }) => {
|
|
192
192
|
const n = Number(t);
|
|
193
193
|
if (isNaN(n))
|
|
@@ -199,7 +199,7 @@ const C = {
|
|
|
199
199
|
throw e();
|
|
200
200
|
return t.toString();
|
|
201
201
|
}
|
|
202
|
-
},
|
|
202
|
+
}, Re = {
|
|
203
203
|
get: (t, { invalid: e }) => {
|
|
204
204
|
const n = new Date(t);
|
|
205
205
|
if (isNaN(n.getTime()))
|
|
@@ -211,7 +211,7 @@ const C = {
|
|
|
211
211
|
throw e();
|
|
212
212
|
return t.toISOString();
|
|
213
213
|
}
|
|
214
|
-
},
|
|
214
|
+
}, ye = {
|
|
215
215
|
get: (t, { invalid: e }) => {
|
|
216
216
|
try {
|
|
217
217
|
return JSON.parse(t);
|
|
@@ -238,13 +238,13 @@ function ot(t, e, n = !1) {
|
|
|
238
238
|
if (e === String)
|
|
239
239
|
return Pn.get(t, C);
|
|
240
240
|
if (e === Boolean)
|
|
241
|
-
return
|
|
241
|
+
return de.get(t, C);
|
|
242
242
|
if (e === Number)
|
|
243
|
-
return
|
|
243
|
+
return ge.get(t, C);
|
|
244
244
|
if (e === Date)
|
|
245
|
-
return
|
|
245
|
+
return Re.get(t, C);
|
|
246
246
|
if (e === JSON)
|
|
247
|
-
return
|
|
247
|
+
return ye.get(t, C);
|
|
248
248
|
if (vn(e))
|
|
249
249
|
return e(t, C);
|
|
250
250
|
if (Et(e))
|
|
@@ -263,13 +263,13 @@ function at(t, e, n = !1) {
|
|
|
263
263
|
throw new X();
|
|
264
264
|
}
|
|
265
265
|
if (e === Boolean)
|
|
266
|
-
return
|
|
266
|
+
return de.set(t, C);
|
|
267
267
|
if (e === Number)
|
|
268
|
-
return
|
|
268
|
+
return ge.set(t, C);
|
|
269
269
|
if (e === Date)
|
|
270
|
-
return
|
|
270
|
+
return Re.set(t, C);
|
|
271
271
|
if (e === JSON)
|
|
272
|
-
return
|
|
272
|
+
return ye.set(t, C);
|
|
273
273
|
if (Et(e))
|
|
274
274
|
return e.set(t, C);
|
|
275
275
|
try {
|
|
@@ -295,10 +295,10 @@ function F() {
|
|
|
295
295
|
return t;
|
|
296
296
|
}, F.apply(this, arguments);
|
|
297
297
|
}
|
|
298
|
-
var
|
|
298
|
+
var U;
|
|
299
299
|
(function(t) {
|
|
300
300
|
t.Pop = "POP", t.Push = "PUSH", t.Replace = "REPLACE";
|
|
301
|
-
})(
|
|
301
|
+
})(U || (U = {}));
|
|
302
302
|
var Z = process.env.NODE_ENV !== "production" ? function(t) {
|
|
303
303
|
return Object.freeze(t);
|
|
304
304
|
} : function(t) {
|
|
@@ -313,16 +313,16 @@ function Q(t, e) {
|
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
-
var lt = "beforeunload", Sn = "hashchange",
|
|
316
|
+
var lt = "beforeunload", Sn = "hashchange", ve = "popstate";
|
|
317
317
|
function Jt(t) {
|
|
318
318
|
t === void 0 && (t = {});
|
|
319
319
|
var e = t, n = e.window, r = n === void 0 ? document.defaultView : n, o = r.history;
|
|
320
320
|
function a() {
|
|
321
|
-
var
|
|
321
|
+
var m = r.location, i = m.pathname, h = m.search, w = m.hash, E = o.state || {};
|
|
322
322
|
return [E.idx, Z({
|
|
323
323
|
pathname: i,
|
|
324
324
|
search: h,
|
|
325
|
-
hash:
|
|
325
|
+
hash: w,
|
|
326
326
|
state: E.usr || null,
|
|
327
327
|
key: E.key || "default"
|
|
328
328
|
})];
|
|
@@ -330,19 +330,19 @@ function Jt(t) {
|
|
|
330
330
|
var s = null;
|
|
331
331
|
function c() {
|
|
332
332
|
if (s)
|
|
333
|
-
|
|
333
|
+
p.call(s), s = null;
|
|
334
334
|
else {
|
|
335
|
-
var
|
|
336
|
-
if (
|
|
335
|
+
var m = U.Pop, i = a(), h = i[0], w = i[1];
|
|
336
|
+
if (p.length)
|
|
337
337
|
if (h != null) {
|
|
338
|
-
var E =
|
|
338
|
+
var E = d - h;
|
|
339
339
|
E && (s = {
|
|
340
|
-
action:
|
|
341
|
-
location:
|
|
340
|
+
action: m,
|
|
341
|
+
location: w,
|
|
342
342
|
retry: function() {
|
|
343
|
-
|
|
343
|
+
b(E * -1);
|
|
344
344
|
}
|
|
345
|
-
},
|
|
345
|
+
}, b(E));
|
|
346
346
|
} else
|
|
347
347
|
process.env.NODE_ENV !== "production" && Q(
|
|
348
348
|
!1,
|
|
@@ -352,115 +352,115 @@ function Jt(t) {
|
|
|
352
352
|
"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."
|
|
353
353
|
);
|
|
354
354
|
else
|
|
355
|
-
O(
|
|
355
|
+
O(m);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
r.addEventListener(
|
|
359
|
-
var u =
|
|
360
|
-
|
|
361
|
-
idx:
|
|
358
|
+
r.addEventListener(ve, c);
|
|
359
|
+
var u = U.Pop, l = a(), d = l[0], f = l[1], v = tt(), p = tt();
|
|
360
|
+
d == null && (d = 0, o.replaceState(F({}, o.state, {
|
|
361
|
+
idx: d
|
|
362
362
|
}), ""));
|
|
363
|
-
function
|
|
364
|
-
return typeof
|
|
363
|
+
function A(m) {
|
|
364
|
+
return typeof m == "string" ? m : G(m);
|
|
365
365
|
}
|
|
366
|
-
function
|
|
366
|
+
function P(m, i) {
|
|
367
367
|
return i === void 0 && (i = null), Z(F({
|
|
368
368
|
pathname: f.pathname,
|
|
369
369
|
hash: "",
|
|
370
370
|
search: ""
|
|
371
|
-
}, typeof
|
|
371
|
+
}, typeof m == "string" ? st(m) : m, {
|
|
372
372
|
state: i,
|
|
373
373
|
key: pt()
|
|
374
374
|
}));
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function k(m, i) {
|
|
377
377
|
return [{
|
|
378
|
-
usr:
|
|
379
|
-
key:
|
|
378
|
+
usr: m.state,
|
|
379
|
+
key: m.key,
|
|
380
380
|
idx: i
|
|
381
|
-
},
|
|
381
|
+
}, A(m)];
|
|
382
382
|
}
|
|
383
|
-
function $(
|
|
384
|
-
return !
|
|
385
|
-
action:
|
|
383
|
+
function $(m, i, h) {
|
|
384
|
+
return !p.length || (p.call({
|
|
385
|
+
action: m,
|
|
386
386
|
location: i,
|
|
387
387
|
retry: h
|
|
388
388
|
}), !1);
|
|
389
389
|
}
|
|
390
|
-
function O(
|
|
391
|
-
u =
|
|
390
|
+
function O(m) {
|
|
391
|
+
u = m;
|
|
392
392
|
var i = a();
|
|
393
|
-
|
|
393
|
+
d = i[0], f = i[1], v.call({
|
|
394
394
|
action: u,
|
|
395
395
|
location: f
|
|
396
396
|
});
|
|
397
397
|
}
|
|
398
|
-
function g(
|
|
399
|
-
var h =
|
|
398
|
+
function g(m, i) {
|
|
399
|
+
var h = U.Push, w = P(m, i);
|
|
400
400
|
function E() {
|
|
401
|
-
g(
|
|
401
|
+
g(m, i);
|
|
402
402
|
}
|
|
403
|
-
if ($(h,
|
|
404
|
-
var x =
|
|
403
|
+
if ($(h, w, E)) {
|
|
404
|
+
var x = k(w, d + 1), L = x[0], N = x[1];
|
|
405
405
|
try {
|
|
406
|
-
o.pushState(
|
|
406
|
+
o.pushState(L, "", N);
|
|
407
407
|
} catch {
|
|
408
|
-
r.location.assign(
|
|
408
|
+
r.location.assign(N);
|
|
409
409
|
}
|
|
410
410
|
O(h);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
function R(
|
|
414
|
-
var h =
|
|
413
|
+
function R(m, i) {
|
|
414
|
+
var h = U.Replace, w = P(m, i);
|
|
415
415
|
function E() {
|
|
416
|
-
R(
|
|
416
|
+
R(m, i);
|
|
417
417
|
}
|
|
418
|
-
if ($(h,
|
|
419
|
-
var x =
|
|
420
|
-
o.replaceState(
|
|
418
|
+
if ($(h, w, E)) {
|
|
419
|
+
var x = k(w, d), L = x[0], N = x[1];
|
|
420
|
+
o.replaceState(L, "", N), O(h);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
|
-
function
|
|
424
|
-
o.go(
|
|
423
|
+
function b(m) {
|
|
424
|
+
o.go(m);
|
|
425
425
|
}
|
|
426
|
-
var
|
|
426
|
+
var S = {
|
|
427
427
|
get action() {
|
|
428
428
|
return u;
|
|
429
429
|
},
|
|
430
430
|
get location() {
|
|
431
431
|
return f;
|
|
432
432
|
},
|
|
433
|
-
createHref:
|
|
433
|
+
createHref: A,
|
|
434
434
|
push: g,
|
|
435
435
|
replace: R,
|
|
436
|
-
go:
|
|
436
|
+
go: b,
|
|
437
437
|
back: function() {
|
|
438
|
-
|
|
438
|
+
b(-1);
|
|
439
439
|
},
|
|
440
440
|
forward: function() {
|
|
441
|
-
|
|
441
|
+
b(1);
|
|
442
442
|
},
|
|
443
443
|
listen: function(i) {
|
|
444
|
-
return
|
|
444
|
+
return v.push(i);
|
|
445
445
|
},
|
|
446
446
|
block: function(i) {
|
|
447
|
-
var h =
|
|
448
|
-
return
|
|
449
|
-
h(),
|
|
447
|
+
var h = p.push(i);
|
|
448
|
+
return p.length === 1 && r.addEventListener(lt, ht), function() {
|
|
449
|
+
h(), p.length || r.removeEventListener(lt, ht);
|
|
450
450
|
};
|
|
451
451
|
}
|
|
452
452
|
};
|
|
453
|
-
return
|
|
453
|
+
return S;
|
|
454
454
|
}
|
|
455
455
|
function An(t) {
|
|
456
456
|
t === void 0 && (t = {});
|
|
457
457
|
var e = t, n = e.window, r = n === void 0 ? document.defaultView : n, o = r.history;
|
|
458
458
|
function a() {
|
|
459
|
-
var i = st(r.location.hash.substr(1)), h = i.pathname,
|
|
459
|
+
var i = st(r.location.hash.substr(1)), h = i.pathname, w = h === void 0 ? "/" : h, E = i.search, x = E === void 0 ? "" : E, L = i.hash, N = L === void 0 ? "" : L, H = o.state || {};
|
|
460
460
|
return [H.idx, Z({
|
|
461
|
-
pathname:
|
|
461
|
+
pathname: w,
|
|
462
462
|
search: x,
|
|
463
|
-
hash:
|
|
463
|
+
hash: N,
|
|
464
464
|
state: H.usr || null,
|
|
465
465
|
key: H.key || "default"
|
|
466
466
|
})];
|
|
@@ -468,19 +468,19 @@ function An(t) {
|
|
|
468
468
|
var s = null;
|
|
469
469
|
function c() {
|
|
470
470
|
if (s)
|
|
471
|
-
|
|
471
|
+
p.call(s), s = null;
|
|
472
472
|
else {
|
|
473
|
-
var i =
|
|
474
|
-
if (
|
|
475
|
-
if (
|
|
476
|
-
var x =
|
|
473
|
+
var i = U.Pop, h = a(), w = h[0], E = h[1];
|
|
474
|
+
if (p.length)
|
|
475
|
+
if (w != null) {
|
|
476
|
+
var x = d - w;
|
|
477
477
|
x && (s = {
|
|
478
478
|
action: i,
|
|
479
479
|
location: E,
|
|
480
480
|
retry: function() {
|
|
481
|
-
|
|
481
|
+
S(x * -1);
|
|
482
482
|
}
|
|
483
|
-
},
|
|
483
|
+
}, S(x));
|
|
484
484
|
} else
|
|
485
485
|
process.env.NODE_ENV !== "production" && Q(
|
|
486
486
|
!1,
|
|
@@ -493,26 +493,26 @@ function An(t) {
|
|
|
493
493
|
g(i);
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
r.addEventListener(
|
|
496
|
+
r.addEventListener(ve, c), r.addEventListener(Sn, function() {
|
|
497
497
|
var i = a(), h = i[1];
|
|
498
498
|
G(h) !== G(f) && c();
|
|
499
499
|
});
|
|
500
|
-
var u =
|
|
501
|
-
|
|
502
|
-
idx:
|
|
500
|
+
var u = U.Pop, l = a(), d = l[0], f = l[1], v = tt(), p = tt();
|
|
501
|
+
d == null && (d = 0, o.replaceState(F({}, o.state, {
|
|
502
|
+
idx: d
|
|
503
503
|
}), ""));
|
|
504
|
-
function
|
|
504
|
+
function A() {
|
|
505
505
|
var i = document.querySelector("base"), h = "";
|
|
506
506
|
if (i && i.getAttribute("href")) {
|
|
507
|
-
var
|
|
508
|
-
h = E === -1 ?
|
|
507
|
+
var w = r.location.href, E = w.indexOf("#");
|
|
508
|
+
h = E === -1 ? w : w.slice(0, E);
|
|
509
509
|
}
|
|
510
510
|
return h;
|
|
511
511
|
}
|
|
512
|
-
function
|
|
513
|
-
return
|
|
512
|
+
function P(i) {
|
|
513
|
+
return A() + "#" + (typeof i == "string" ? i : G(i));
|
|
514
514
|
}
|
|
515
|
-
function
|
|
515
|
+
function k(i, h) {
|
|
516
516
|
return h === void 0 && (h = null), Z(F({
|
|
517
517
|
pathname: f.pathname,
|
|
518
518
|
hash: "",
|
|
@@ -527,79 +527,79 @@ function An(t) {
|
|
|
527
527
|
usr: i.state,
|
|
528
528
|
key: i.key,
|
|
529
529
|
idx: h
|
|
530
|
-
},
|
|
530
|
+
}, P(i)];
|
|
531
531
|
}
|
|
532
|
-
function O(i, h,
|
|
533
|
-
return !
|
|
532
|
+
function O(i, h, w) {
|
|
533
|
+
return !p.length || (p.call({
|
|
534
534
|
action: i,
|
|
535
535
|
location: h,
|
|
536
|
-
retry:
|
|
536
|
+
retry: w
|
|
537
537
|
}), !1);
|
|
538
538
|
}
|
|
539
539
|
function g(i) {
|
|
540
540
|
u = i;
|
|
541
541
|
var h = a();
|
|
542
|
-
|
|
542
|
+
d = h[0], f = h[1], v.call({
|
|
543
543
|
action: u,
|
|
544
544
|
location: f
|
|
545
545
|
});
|
|
546
546
|
}
|
|
547
547
|
function R(i, h) {
|
|
548
|
-
var
|
|
548
|
+
var w = U.Push, E = k(i, h);
|
|
549
549
|
function x() {
|
|
550
550
|
R(i, h);
|
|
551
551
|
}
|
|
552
|
-
if (process.env.NODE_ENV !== "production" && Q(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(i) + ")"), O(
|
|
553
|
-
var
|
|
552
|
+
if (process.env.NODE_ENV !== "production" && Q(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(i) + ")"), O(w, E, x)) {
|
|
553
|
+
var L = $(E, d + 1), N = L[0], H = L[1];
|
|
554
554
|
try {
|
|
555
|
-
o.pushState(
|
|
555
|
+
o.pushState(N, "", H);
|
|
556
556
|
} catch {
|
|
557
557
|
r.location.assign(H);
|
|
558
558
|
}
|
|
559
|
-
g(
|
|
559
|
+
g(w);
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
|
-
function
|
|
563
|
-
var
|
|
562
|
+
function b(i, h) {
|
|
563
|
+
var w = U.Replace, E = k(i, h);
|
|
564
564
|
function x() {
|
|
565
|
-
|
|
565
|
+
b(i, h);
|
|
566
566
|
}
|
|
567
|
-
if (process.env.NODE_ENV !== "production" && Q(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(i) + ")"), O(
|
|
568
|
-
var
|
|
569
|
-
o.replaceState(
|
|
567
|
+
if (process.env.NODE_ENV !== "production" && Q(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(i) + ")"), O(w, E, x)) {
|
|
568
|
+
var L = $(E, d), N = L[0], H = L[1];
|
|
569
|
+
o.replaceState(N, "", H), g(w);
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
|
-
function
|
|
572
|
+
function S(i) {
|
|
573
573
|
o.go(i);
|
|
574
574
|
}
|
|
575
|
-
var
|
|
575
|
+
var m = {
|
|
576
576
|
get action() {
|
|
577
577
|
return u;
|
|
578
578
|
},
|
|
579
579
|
get location() {
|
|
580
580
|
return f;
|
|
581
581
|
},
|
|
582
|
-
createHref:
|
|
582
|
+
createHref: P,
|
|
583
583
|
push: R,
|
|
584
|
-
replace:
|
|
585
|
-
go:
|
|
584
|
+
replace: b,
|
|
585
|
+
go: S,
|
|
586
586
|
back: function() {
|
|
587
|
-
|
|
587
|
+
S(-1);
|
|
588
588
|
},
|
|
589
589
|
forward: function() {
|
|
590
|
-
|
|
590
|
+
S(1);
|
|
591
591
|
},
|
|
592
592
|
listen: function(h) {
|
|
593
|
-
return
|
|
593
|
+
return v.push(h);
|
|
594
594
|
},
|
|
595
595
|
block: function(h) {
|
|
596
|
-
var
|
|
597
|
-
return
|
|
598
|
-
|
|
596
|
+
var w = p.push(h);
|
|
597
|
+
return p.length === 1 && r.addEventListener(lt, ht), function() {
|
|
598
|
+
w(), p.length || r.removeEventListener(lt, ht);
|
|
599
599
|
};
|
|
600
600
|
}
|
|
601
601
|
};
|
|
602
|
-
return
|
|
602
|
+
return m;
|
|
603
603
|
}
|
|
604
604
|
function Qt(t) {
|
|
605
605
|
t === void 0 && (t = {});
|
|
@@ -612,11 +612,11 @@ function Qt(t) {
|
|
|
612
612
|
key: pt()
|
|
613
613
|
}, typeof g == "string" ? st(g) : g));
|
|
614
614
|
return process.env.NODE_ENV !== "production" && Q(R.pathname.charAt(0) === "/", "Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: " + JSON.stringify(g) + ")"), R;
|
|
615
|
-
}), s = Gt(o ?? a.length - 1, 0, a.length - 1), c =
|
|
615
|
+
}), s = Gt(o ?? a.length - 1, 0, a.length - 1), c = U.Pop, u = a[s], l = tt(), d = tt();
|
|
616
616
|
function f(g) {
|
|
617
617
|
return typeof g == "string" ? g : G(g);
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function v(g, R) {
|
|
620
620
|
return R === void 0 && (R = null), Z(F({
|
|
621
621
|
pathname: u.pathname,
|
|
622
622
|
search: "",
|
|
@@ -626,39 +626,39 @@ function Qt(t) {
|
|
|
626
626
|
key: pt()
|
|
627
627
|
}));
|
|
628
628
|
}
|
|
629
|
-
function
|
|
630
|
-
return !
|
|
629
|
+
function p(g, R, b) {
|
|
630
|
+
return !d.length || (d.call({
|
|
631
631
|
action: g,
|
|
632
632
|
location: R,
|
|
633
|
-
retry:
|
|
633
|
+
retry: b
|
|
634
634
|
}), !1);
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function A(g, R) {
|
|
637
637
|
c = g, u = R, l.call({
|
|
638
638
|
action: c,
|
|
639
639
|
location: u
|
|
640
640
|
});
|
|
641
641
|
}
|
|
642
|
-
function
|
|
643
|
-
var
|
|
644
|
-
function
|
|
645
|
-
|
|
642
|
+
function P(g, R) {
|
|
643
|
+
var b = U.Push, S = v(g, R);
|
|
644
|
+
function m() {
|
|
645
|
+
P(g, R);
|
|
646
646
|
}
|
|
647
|
-
process.env.NODE_ENV !== "production" && Q(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.push(" + JSON.stringify(g) + ")"),
|
|
647
|
+
process.env.NODE_ENV !== "production" && Q(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.push(" + JSON.stringify(g) + ")"), p(b, S, m) && (s += 1, a.splice(s, a.length, S), A(b, S));
|
|
648
648
|
}
|
|
649
|
-
function
|
|
650
|
-
var
|
|
651
|
-
function
|
|
652
|
-
|
|
649
|
+
function k(g, R) {
|
|
650
|
+
var b = U.Replace, S = v(g, R);
|
|
651
|
+
function m() {
|
|
652
|
+
k(g, R);
|
|
653
653
|
}
|
|
654
|
-
process.env.NODE_ENV !== "production" && Q(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(g) + ")"),
|
|
654
|
+
process.env.NODE_ENV !== "production" && Q(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(g) + ")"), p(b, S, m) && (a[s] = S, A(b, S));
|
|
655
655
|
}
|
|
656
656
|
function $(g) {
|
|
657
|
-
var R = Gt(s + g, 0, a.length - 1),
|
|
658
|
-
function
|
|
657
|
+
var R = Gt(s + g, 0, a.length - 1), b = U.Pop, S = a[R];
|
|
658
|
+
function m() {
|
|
659
659
|
$(g);
|
|
660
660
|
}
|
|
661
|
-
|
|
661
|
+
p(b, S, m) && (s = R, A(b, S));
|
|
662
662
|
}
|
|
663
663
|
var O = {
|
|
664
664
|
get index() {
|
|
@@ -671,8 +671,8 @@ function Qt(t) {
|
|
|
671
671
|
return u;
|
|
672
672
|
},
|
|
673
673
|
createHref: f,
|
|
674
|
-
push:
|
|
675
|
-
replace:
|
|
674
|
+
push: P,
|
|
675
|
+
replace: k,
|
|
676
676
|
go: $,
|
|
677
677
|
back: function() {
|
|
678
678
|
$(-1);
|
|
@@ -684,7 +684,7 @@ function Qt(t) {
|
|
|
684
684
|
return l.push(R);
|
|
685
685
|
},
|
|
686
686
|
block: function(R) {
|
|
687
|
-
return
|
|
687
|
+
return d.push(R);
|
|
688
688
|
}
|
|
689
689
|
};
|
|
690
690
|
return O;
|
|
@@ -732,57 +732,62 @@ function st(t) {
|
|
|
732
732
|
}
|
|
733
733
|
return e;
|
|
734
734
|
}
|
|
735
|
-
const
|
|
735
|
+
const we = Symbol();
|
|
736
736
|
function xn() {
|
|
737
|
-
const t = yt(
|
|
737
|
+
const t = yt(we);
|
|
738
738
|
if (!t)
|
|
739
739
|
throw new Ct();
|
|
740
740
|
return t;
|
|
741
741
|
}
|
|
742
|
-
const
|
|
742
|
+
const Ee = Symbol("isRouterRouteSymbol");
|
|
743
743
|
function kn(t) {
|
|
744
|
-
return typeof t == "object" && t !== null &&
|
|
744
|
+
return typeof t == "object" && t !== null && Ee in t;
|
|
745
745
|
}
|
|
746
746
|
function Bn(t, e) {
|
|
747
|
-
function n(
|
|
748
|
-
if (typeof
|
|
749
|
-
const
|
|
747
|
+
function n(f, v, p) {
|
|
748
|
+
if (typeof f == "object") {
|
|
749
|
+
const P = {
|
|
750
750
|
...t.params,
|
|
751
|
-
...
|
|
751
|
+
...f
|
|
752
752
|
};
|
|
753
|
-
return e(t.name,
|
|
753
|
+
return e(t.name, P, v);
|
|
754
754
|
}
|
|
755
|
-
const
|
|
755
|
+
const A = {
|
|
756
756
|
...t.params,
|
|
757
|
-
[
|
|
757
|
+
[f]: v
|
|
758
758
|
};
|
|
759
|
-
return e(t.name,
|
|
759
|
+
return e(t.name, A, p);
|
|
760
760
|
}
|
|
761
|
-
const { matched: r, matches: o, name: a, query: s, params: c, state: u } = Fe(t),
|
|
761
|
+
const { matched: r, matches: o, name: a, query: s, params: c, state: u, hash: l } = Fe(t), d = oe({
|
|
762
762
|
matched: r,
|
|
763
763
|
matches: o,
|
|
764
764
|
state: u,
|
|
765
765
|
query: s,
|
|
766
|
+
hash: l,
|
|
766
767
|
params: c,
|
|
767
768
|
name: a,
|
|
768
769
|
update: n,
|
|
769
|
-
[
|
|
770
|
+
[Ee]: !0
|
|
770
771
|
});
|
|
771
|
-
return new Proxy(
|
|
772
|
-
get: (
|
|
773
|
-
set(
|
|
774
|
-
return n(
|
|
772
|
+
return new Proxy(d, {
|
|
773
|
+
get: (f, v, p) => v === "params" ? new Proxy(t.params, {
|
|
774
|
+
set(A, P, k) {
|
|
775
|
+
return n(P, k), !0;
|
|
775
776
|
}
|
|
776
|
-
}) :
|
|
777
|
-
set(
|
|
778
|
-
return n({}, { state: { ...t.state, [
|
|
777
|
+
}) : v === "state" ? new Proxy(t.state, {
|
|
778
|
+
set(A, P, k) {
|
|
779
|
+
return n({}, { state: { ...t.state, [P]: k } }), !0;
|
|
779
780
|
}
|
|
780
|
-
}) : Reflect.get(
|
|
781
|
+
}) : Reflect.get(f, v, p)
|
|
781
782
|
});
|
|
782
783
|
}
|
|
784
|
+
const Pe = Symbol();
|
|
783
785
|
function Ln(t, e) {
|
|
784
|
-
const n =
|
|
785
|
-
Object.assign(n, {
|
|
786
|
+
const n = oe({ ...t }), r = (s) => {
|
|
787
|
+
Object.assign(n, {
|
|
788
|
+
[Pe]: !1,
|
|
789
|
+
...s
|
|
790
|
+
});
|
|
786
791
|
}, o = n, a = Bn(o, e);
|
|
787
792
|
return {
|
|
788
793
|
currentRoute: o,
|
|
@@ -844,7 +849,7 @@ function Cn({ mode: t, listener: e }) {
|
|
|
844
849
|
function Hn(t = "auto") {
|
|
845
850
|
switch (t) {
|
|
846
851
|
case "auto":
|
|
847
|
-
return
|
|
852
|
+
return me() ? Jt() : Qt();
|
|
848
853
|
case "browser":
|
|
849
854
|
return Jt();
|
|
850
855
|
case "memory":
|
|
@@ -911,84 +916,84 @@ function On() {
|
|
|
911
916
|
const f = c ?? {};
|
|
912
917
|
throw new rt([s, { ...f, replace: !0 }]);
|
|
913
918
|
}
|
|
914
|
-
const l = c,
|
|
915
|
-
throw new rt([s, l, { ...
|
|
919
|
+
const l = c, d = u ?? {};
|
|
920
|
+
throw new rt([s, l, { ...d, replace: !0 }]);
|
|
916
921
|
}, r = () => {
|
|
917
922
|
throw new Kt();
|
|
918
923
|
};
|
|
919
924
|
async function o({ to: s, from: c, hooks: u }) {
|
|
920
|
-
const { global: l, component:
|
|
925
|
+
const { global: l, component: d } = u, f = Vn(s, c), v = [
|
|
921
926
|
...l.onBeforeRouteEnter,
|
|
922
927
|
...f.onBeforeRouteEnter,
|
|
923
928
|
...l.onBeforeRouteUpdate,
|
|
924
929
|
...f.onBeforeRouteUpdate,
|
|
925
|
-
...
|
|
930
|
+
...d.onBeforeRouteUpdate,
|
|
926
931
|
...l.onBeforeRouteLeave,
|
|
927
932
|
...f.onBeforeRouteLeave,
|
|
928
|
-
...
|
|
933
|
+
...d.onBeforeRouteLeave
|
|
929
934
|
];
|
|
930
935
|
try {
|
|
931
|
-
const
|
|
936
|
+
const p = v.map((A) => A(s, {
|
|
932
937
|
from: c,
|
|
933
938
|
reject: t,
|
|
934
939
|
push: e,
|
|
935
940
|
replace: n,
|
|
936
941
|
abort: r
|
|
937
942
|
}));
|
|
938
|
-
await Promise.all(
|
|
939
|
-
} catch (
|
|
940
|
-
if (
|
|
943
|
+
await Promise.all(p);
|
|
944
|
+
} catch (p) {
|
|
945
|
+
if (p instanceof rt)
|
|
941
946
|
return {
|
|
942
947
|
status: "PUSH",
|
|
943
|
-
to:
|
|
948
|
+
to: p.to
|
|
944
949
|
};
|
|
945
|
-
if (
|
|
950
|
+
if (p instanceof kt)
|
|
946
951
|
return {
|
|
947
952
|
status: "REJECT",
|
|
948
|
-
type:
|
|
953
|
+
type: p.type
|
|
949
954
|
};
|
|
950
|
-
if (
|
|
955
|
+
if (p instanceof Kt)
|
|
951
956
|
return {
|
|
952
957
|
status: "ABORT"
|
|
953
958
|
};
|
|
954
|
-
throw
|
|
959
|
+
throw p;
|
|
955
960
|
}
|
|
956
961
|
return {
|
|
957
962
|
status: "SUCCESS"
|
|
958
963
|
};
|
|
959
964
|
}
|
|
960
965
|
async function a({ to: s, from: c, hooks: u }) {
|
|
961
|
-
const { global: l, component:
|
|
962
|
-
...
|
|
966
|
+
const { global: l, component: d } = u, f = jn(s, c), v = [
|
|
967
|
+
...d.onAfterRouteLeave,
|
|
963
968
|
...f.onAfterRouteLeave,
|
|
964
969
|
...l.onAfterRouteLeave,
|
|
965
|
-
...
|
|
970
|
+
...d.onAfterRouteUpdate,
|
|
966
971
|
...f.onAfterRouteUpdate,
|
|
967
972
|
...l.onAfterRouteUpdate,
|
|
968
|
-
...
|
|
973
|
+
...d.onAfterRouteEnter,
|
|
969
974
|
...f.onAfterRouteEnter,
|
|
970
975
|
...l.onAfterRouteEnter
|
|
971
976
|
];
|
|
972
977
|
try {
|
|
973
|
-
const
|
|
978
|
+
const p = v.map((A) => A(s, {
|
|
974
979
|
from: c,
|
|
975
980
|
reject: t,
|
|
976
981
|
push: e,
|
|
977
982
|
replace: n
|
|
978
983
|
}));
|
|
979
|
-
await Promise.all(
|
|
980
|
-
} catch (
|
|
981
|
-
if (
|
|
984
|
+
await Promise.all(p);
|
|
985
|
+
} catch (p) {
|
|
986
|
+
if (p instanceof rt)
|
|
982
987
|
return {
|
|
983
988
|
status: "PUSH",
|
|
984
|
-
to:
|
|
989
|
+
to: p.to
|
|
985
990
|
};
|
|
986
|
-
if (
|
|
991
|
+
if (p instanceof kt)
|
|
987
992
|
return {
|
|
988
993
|
status: "REJECT",
|
|
989
|
-
type:
|
|
994
|
+
type: p.type
|
|
990
995
|
};
|
|
991
|
-
throw
|
|
996
|
+
throw p;
|
|
992
997
|
}
|
|
993
998
|
return {
|
|
994
999
|
status: "SUCCESS"
|
|
@@ -1067,44 +1072,42 @@ function Se(t) {
|
|
|
1067
1072
|
getAll: (n) => e.getAll(n)
|
|
1068
1073
|
};
|
|
1069
1074
|
}
|
|
1070
|
-
const Yt = Symbol();
|
|
1071
1075
|
function Dn({
|
|
1072
1076
|
rejections: t
|
|
1073
1077
|
}) {
|
|
1074
|
-
const e = (
|
|
1075
|
-
const
|
|
1078
|
+
const e = (a) => {
|
|
1079
|
+
const s = {
|
|
1076
1080
|
...t
|
|
1077
1081
|
};
|
|
1078
|
-
return it(
|
|
1079
|
-
}, n = (
|
|
1080
|
-
const
|
|
1081
|
-
name:
|
|
1082
|
-
component:
|
|
1082
|
+
return it(s[a] ?? Wn(a));
|
|
1083
|
+
}, n = (a) => {
|
|
1084
|
+
const s = it(e(a)), c = {
|
|
1085
|
+
name: a,
|
|
1086
|
+
component: s,
|
|
1083
1087
|
meta: {},
|
|
1084
1088
|
state: {}
|
|
1085
1089
|
};
|
|
1086
1090
|
return {
|
|
1087
|
-
matched:
|
|
1088
|
-
matches: [
|
|
1089
|
-
name:
|
|
1091
|
+
matched: c,
|
|
1092
|
+
matches: [c],
|
|
1093
|
+
name: a,
|
|
1090
1094
|
query: Se(""),
|
|
1091
1095
|
params: {},
|
|
1092
1096
|
state: {},
|
|
1093
|
-
[
|
|
1097
|
+
[Pe]: !0
|
|
1094
1098
|
};
|
|
1095
|
-
}, r = (
|
|
1096
|
-
if (!
|
|
1097
|
-
|
|
1099
|
+
}, r = (a) => {
|
|
1100
|
+
if (!a) {
|
|
1101
|
+
o.value = null;
|
|
1098
1102
|
return;
|
|
1099
1103
|
}
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
},
|
|
1104
|
+
const s = e(a);
|
|
1105
|
+
o.value = { type: a, component: s };
|
|
1106
|
+
}, o = Ie(null);
|
|
1103
1107
|
return {
|
|
1104
|
-
setRejection:
|
|
1105
|
-
rejection:
|
|
1106
|
-
getRejectionRoute: n
|
|
1107
|
-
isRejectionRoute: r
|
|
1108
|
+
setRejection: r,
|
|
1109
|
+
rejection: o,
|
|
1110
|
+
getRejectionRoute: n
|
|
1108
1111
|
};
|
|
1109
1112
|
}
|
|
1110
1113
|
class Mn extends Error {
|
|
@@ -1204,8 +1207,8 @@ function Ue(t, ...e) {
|
|
|
1204
1207
|
}, t);
|
|
1205
1208
|
}
|
|
1206
1209
|
function Yn(t, e = {}) {
|
|
1207
|
-
const { params: n = {}, query: r } = e, o = Xn(t.host, n), a = Zn(t.path, n), s = tr(t.query, n);
|
|
1208
|
-
return
|
|
1210
|
+
const { params: n = {}, query: r } = e, o = Xn(t.host, n), a = Zn(t.path, n), s = tr(t.query, n), c = Ue(`${o}${a}`, s, r), u = e.hash ? `#${e.hash.replace(/^#/, "")}` : "";
|
|
1211
|
+
return `${c}${u}`;
|
|
1209
1212
|
}
|
|
1210
1213
|
function Xn(t, e) {
|
|
1211
1214
|
const n = t.toString();
|
|
@@ -1230,8 +1233,8 @@ function tr(t, e) {
|
|
|
1230
1233
|
const c = Pt(s);
|
|
1231
1234
|
if (!c)
|
|
1232
1235
|
return { ...o, [a]: s };
|
|
1233
|
-
const l = at(e[c], t.params[c], $t(s)),
|
|
1234
|
-
return $t(s) &&
|
|
1236
|
+
const l = at(e[c], t.params[c], $t(s)), d = e[c] === void 0 && l === "";
|
|
1237
|
+
return $t(s) && d ? o : { ...o, [a]: l };
|
|
1235
1238
|
}, {});
|
|
1236
1239
|
}
|
|
1237
1240
|
function er(t) {
|
|
@@ -1243,7 +1246,8 @@ function er(t) {
|
|
|
1243
1246
|
throw new Mn(String(e));
|
|
1244
1247
|
return Yn(s, {
|
|
1245
1248
|
params: o,
|
|
1246
|
-
query: a.query
|
|
1249
|
+
query: a.query,
|
|
1250
|
+
hash: a.hash
|
|
1247
1251
|
});
|
|
1248
1252
|
};
|
|
1249
1253
|
}
|
|
@@ -1255,7 +1259,7 @@ class nr extends Error {
|
|
|
1255
1259
|
function rr(t) {
|
|
1256
1260
|
if (t)
|
|
1257
1261
|
return t;
|
|
1258
|
-
if (
|
|
1262
|
+
if (me())
|
|
1259
1263
|
return window.location.toString();
|
|
1260
1264
|
throw new nr();
|
|
1261
1265
|
}
|
|
@@ -1299,15 +1303,15 @@ const cr = (t) => "name" in t.matched && !!t.matched.name, ur = (t, e) => {
|
|
|
1299
1303
|
function fr(t) {
|
|
1300
1304
|
const { searchParams: e, pathname: n } = K(t), r = -1, o = 1;
|
|
1301
1305
|
return (a, s) => {
|
|
1302
|
-
const c =
|
|
1303
|
-
return a.depth > s.depth ? r : a.depth < s.depth ? o : c + u > l +
|
|
1306
|
+
const c = Xt(a, e), u = Yt(a, n), l = Xt(s, e), d = Yt(s, n);
|
|
1307
|
+
return a.depth > s.depth ? r : a.depth < s.depth ? o : c + u > l + d ? r : c + u < l + d ? o : 0;
|
|
1304
1308
|
};
|
|
1305
1309
|
}
|
|
1306
|
-
function
|
|
1310
|
+
function Yt(t, e) {
|
|
1307
1311
|
const n = Object.keys(t.path.params).filter((o) => o.startsWith("?")).map((o) => o), r = n.filter((o) => Be(e, t.path.toString(), o) === void 0);
|
|
1308
1312
|
return n.length - r.length;
|
|
1309
1313
|
}
|
|
1310
|
-
function
|
|
1314
|
+
function Xt(t, e) {
|
|
1311
1315
|
const n = new URLSearchParams(t.query.toString()), r = Array.from(n.keys()), o = r.filter((a) => !e.has(a));
|
|
1312
1316
|
return r.length - o.length;
|
|
1313
1317
|
}
|
|
@@ -1338,7 +1342,7 @@ function pr(t, e, n) {
|
|
|
1338
1342
|
}
|
|
1339
1343
|
return at(void 0, n, gt);
|
|
1340
1344
|
}
|
|
1341
|
-
const
|
|
1345
|
+
const Zt = (t, e) => {
|
|
1342
1346
|
const n = {};
|
|
1343
1347
|
for (const [r, o] of Object.entries(t)) {
|
|
1344
1348
|
const a = pr(e, r, o);
|
|
@@ -1352,17 +1356,18 @@ const te = (t, e) => {
|
|
|
1352
1356
|
or
|
|
1353
1357
|
];
|
|
1354
1358
|
function Bt(t, e, n) {
|
|
1355
|
-
const r = fr(e), o = t.filter((
|
|
1359
|
+
const r = fr(e), o = t.filter((u) => mr.every((l) => l(u, e))).sort(r);
|
|
1356
1360
|
if (o.length === 0)
|
|
1357
1361
|
return;
|
|
1358
|
-
const [a] = o, { search: s } = K(e);
|
|
1362
|
+
const [a] = o, { search: s, hash: c } = K(e);
|
|
1359
1363
|
return {
|
|
1360
1364
|
matched: a.matched,
|
|
1361
1365
|
matches: a.matches,
|
|
1362
1366
|
name: a.name,
|
|
1363
1367
|
query: Se(s),
|
|
1364
1368
|
params: $e(a, e),
|
|
1365
|
-
state: hr(a.state, n)
|
|
1369
|
+
state: hr(a.state, n),
|
|
1370
|
+
hash: c
|
|
1366
1371
|
};
|
|
1367
1372
|
}
|
|
1368
1373
|
function Wt(t, e) {
|
|
@@ -1385,7 +1390,7 @@ function He(t, e) {
|
|
|
1385
1390
|
function Dt(t) {
|
|
1386
1391
|
return t === void 0 ? "" : t;
|
|
1387
1392
|
}
|
|
1388
|
-
function
|
|
1393
|
+
function te(t, e) {
|
|
1389
1394
|
return {
|
|
1390
1395
|
path: t,
|
|
1391
1396
|
params: Wt(t, e),
|
|
@@ -1396,9 +1401,9 @@ function dr(t) {
|
|
|
1396
1401
|
return vt(t) && typeof t.path == "string";
|
|
1397
1402
|
}
|
|
1398
1403
|
function Ve(t) {
|
|
1399
|
-
return t === void 0 ?
|
|
1404
|
+
return t === void 0 ? te("", {}) : dr(t) ? t : te(t, {});
|
|
1400
1405
|
}
|
|
1401
|
-
function
|
|
1406
|
+
function ee(t, e) {
|
|
1402
1407
|
return {
|
|
1403
1408
|
query: t,
|
|
1404
1409
|
params: Wt(t, e),
|
|
@@ -1409,7 +1414,7 @@ function gr(t) {
|
|
|
1409
1414
|
return vt(t) && typeof t.query == "string";
|
|
1410
1415
|
}
|
|
1411
1416
|
function je(t) {
|
|
1412
|
-
return t === void 0 ?
|
|
1417
|
+
return t === void 0 ? ee("", {}) : gr(t) ? t : ee(t, {});
|
|
1413
1418
|
}
|
|
1414
1419
|
function I(t) {
|
|
1415
1420
|
const e = Dt(t.name), n = Ve(t.path), r = je(t.query), o = t.meta ?? {}, a = dn(t) ? t.state : {}, s = it({ meta: {}, state: {}, ...t }), c = {
|
|
@@ -1423,7 +1428,7 @@ function I(t) {
|
|
|
1423
1428
|
depth: 1,
|
|
1424
1429
|
host: He("", {}),
|
|
1425
1430
|
prefetch: t.prefetch
|
|
1426
|
-
}, u =
|
|
1431
|
+
}, u = he(t) ? pe(t.parent, c) : c;
|
|
1427
1432
|
return et(u.path.params, u.query.params), u;
|
|
1428
1433
|
}
|
|
1429
1434
|
function Rr(t, e) {
|
|
@@ -1447,42 +1452,42 @@ class yr extends Error {
|
|
|
1447
1452
|
function vr(t) {
|
|
1448
1453
|
const e = t.map(({ name: n }) => n);
|
|
1449
1454
|
for (const n of e)
|
|
1450
|
-
if (
|
|
1455
|
+
if (le(e, n) > 1)
|
|
1451
1456
|
throw new yr(n);
|
|
1452
1457
|
}
|
|
1453
|
-
function jr(t, e
|
|
1454
|
-
const n = ln(t) ? t.flat() : t, r = Rr(n, e.base);
|
|
1458
|
+
function jr(t, e) {
|
|
1459
|
+
const n = ln(t) ? t.flat() : t, r = Rr(n, e == null ? void 0 : e.base);
|
|
1455
1460
|
vr(r);
|
|
1456
1461
|
const o = er(r), a = Cn({
|
|
1457
|
-
mode: e.historyMode,
|
|
1462
|
+
mode: e == null ? void 0 : e.historyMode,
|
|
1458
1463
|
listener: ({ location: y }) => {
|
|
1459
|
-
const
|
|
1460
|
-
|
|
1464
|
+
const B = G(y);
|
|
1465
|
+
P(B, { state: y.state });
|
|
1461
1466
|
}
|
|
1462
1467
|
}), { runBeforeRouteHooks: s, runAfterRouteHooks: c } = On(), {
|
|
1463
1468
|
hooks: u,
|
|
1464
1469
|
onBeforeRouteEnter: l,
|
|
1465
|
-
onAfterRouteUpdate:
|
|
1470
|
+
onAfterRouteUpdate: d,
|
|
1466
1471
|
onBeforeRouteLeave: f,
|
|
1467
|
-
onAfterRouteEnter:
|
|
1468
|
-
onBeforeRouteUpdate:
|
|
1469
|
-
onAfterRouteLeave:
|
|
1472
|
+
onAfterRouteEnter: v,
|
|
1473
|
+
onBeforeRouteUpdate: p,
|
|
1474
|
+
onAfterRouteLeave: A
|
|
1470
1475
|
} = qn();
|
|
1471
|
-
async function
|
|
1472
|
-
if (a.stopListening(),
|
|
1473
|
-
return a.update(y,
|
|
1474
|
-
const _ = Bt(r, y,
|
|
1476
|
+
async function P(y, B = {}) {
|
|
1477
|
+
if (a.stopListening(), N(y))
|
|
1478
|
+
return a.update(y, B);
|
|
1479
|
+
const _ = Bt(r, y, B.state) ?? S("NotFound"), q = { ...i }, z = await s({ to: _, from: q, hooks: u });
|
|
1475
1480
|
switch (z.status) {
|
|
1476
1481
|
case "ABORT":
|
|
1477
1482
|
return;
|
|
1478
1483
|
case "PUSH":
|
|
1479
|
-
a.update(y,
|
|
1484
|
+
a.update(y, B), await k(...z.to);
|
|
1480
1485
|
return;
|
|
1481
1486
|
case "REJECT":
|
|
1482
|
-
a.update(y,
|
|
1487
|
+
a.update(y, B), R(z.type), w(_);
|
|
1483
1488
|
break;
|
|
1484
1489
|
case "SUCCESS":
|
|
1485
|
-
a.update(y,
|
|
1490
|
+
a.update(y, B), R(null), w(_);
|
|
1486
1491
|
break;
|
|
1487
1492
|
default:
|
|
1488
1493
|
throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(z)}`);
|
|
@@ -1490,7 +1495,7 @@ function jr(t, e = {}) {
|
|
|
1490
1495
|
const T = await c({ to: _, from: q, hooks: u });
|
|
1491
1496
|
switch (T.status) {
|
|
1492
1497
|
case "PUSH":
|
|
1493
|
-
await
|
|
1498
|
+
await k(...T.to);
|
|
1494
1499
|
break;
|
|
1495
1500
|
case "REJECT":
|
|
1496
1501
|
R(T.type);
|
|
@@ -1503,40 +1508,40 @@ function jr(t, e = {}) {
|
|
|
1503
1508
|
}
|
|
1504
1509
|
a.startListening();
|
|
1505
1510
|
}
|
|
1506
|
-
const
|
|
1511
|
+
const k = (y, B, _) => {
|
|
1507
1512
|
if (D(y)) {
|
|
1508
|
-
const nt = { ...
|
|
1509
|
-
return
|
|
1513
|
+
const nt = { ...B }, At = o(y, nt);
|
|
1514
|
+
return P(At, nt);
|
|
1510
1515
|
}
|
|
1511
|
-
const q = { ..._ }, T = o(y,
|
|
1512
|
-
return
|
|
1513
|
-
}, $ = (y,
|
|
1516
|
+
const q = { ..._ }, T = o(y, B ?? {}, q), W = bt(y), St = Zt((W == null ? void 0 : W.state) ?? {}, q.state);
|
|
1517
|
+
return P(T, { ...q, state: St });
|
|
1518
|
+
}, $ = (y, B, _) => {
|
|
1514
1519
|
if (D(y)) {
|
|
1515
|
-
const nt = { ...
|
|
1516
|
-
return
|
|
1520
|
+
const nt = { ...B, replace: !0 }, At = o(y, nt);
|
|
1521
|
+
return P(At, nt);
|
|
1517
1522
|
}
|
|
1518
|
-
const q = { ..._, replace: !0 }, T = o(y,
|
|
1519
|
-
return
|
|
1520
|
-
}, O = (y) => R(y), g = (y,
|
|
1523
|
+
const q = { ..._, replace: !0 }, T = o(y, B ?? {}, q), W = bt(y), St = Zt((W == null ? void 0 : W.state) ?? {}, q.state);
|
|
1524
|
+
return P(T, { ...q, state: St });
|
|
1525
|
+
}, O = (y) => R(y), g = (y, B = {}) => {
|
|
1521
1526
|
if (!D(y)) {
|
|
1522
|
-
const _ = o(y,
|
|
1527
|
+
const _ = o(y, B);
|
|
1523
1528
|
return Bt(r, _);
|
|
1524
1529
|
}
|
|
1525
|
-
if (!
|
|
1530
|
+
if (!N(y))
|
|
1526
1531
|
return Bt(r, y);
|
|
1527
|
-
}, { setRejection: R, rejection:
|
|
1532
|
+
}, { setRejection: R, rejection: b, getRejectionRoute: S } = Dn(e ?? {}), m = S("NotFound"), { currentRoute: i, routerRoute: h, updateRoute: w } = Ln(m, k);
|
|
1528
1533
|
a.startListening();
|
|
1529
|
-
const E = rr(e.initialUrl), x = a.location.state, { host:
|
|
1534
|
+
const E = rr(e == null ? void 0 : e.initialUrl), x = a.location.state, { host: L } = K(E), N = $n(L), H = P(E, { replace: !0, state: x });
|
|
1530
1535
|
function bt(y) {
|
|
1531
|
-
return r.find((
|
|
1536
|
+
return r.find((B) => B.name === y);
|
|
1532
1537
|
}
|
|
1533
1538
|
function De(y) {
|
|
1534
|
-
y.component("RouterView", Ur), y.component("RouterLink", Nr), y.provide(
|
|
1539
|
+
y.component("RouterView", Ur), y.component("RouterLink", Nr), y.provide(we, b), y.provide(be, u), y.provide(fe, It);
|
|
1535
1540
|
}
|
|
1536
1541
|
const It = {
|
|
1537
1542
|
route: h,
|
|
1538
1543
|
resolve: o,
|
|
1539
|
-
push:
|
|
1544
|
+
push: k,
|
|
1540
1545
|
replace: $,
|
|
1541
1546
|
reject: O,
|
|
1542
1547
|
find: g,
|
|
@@ -1546,14 +1551,14 @@ function jr(t, e = {}) {
|
|
|
1546
1551
|
go: a.go,
|
|
1547
1552
|
install: De,
|
|
1548
1553
|
initialized: H,
|
|
1549
|
-
isExternal:
|
|
1554
|
+
isExternal: N,
|
|
1550
1555
|
onBeforeRouteEnter: l,
|
|
1551
|
-
onAfterRouteUpdate:
|
|
1556
|
+
onAfterRouteUpdate: d,
|
|
1552
1557
|
onBeforeRouteLeave: f,
|
|
1553
|
-
onAfterRouteEnter:
|
|
1554
|
-
onBeforeRouteUpdate:
|
|
1555
|
-
onAfterRouteLeave:
|
|
1556
|
-
prefetch: e.prefetch
|
|
1558
|
+
onAfterRouteEnter: v,
|
|
1559
|
+
onBeforeRouteUpdate: p,
|
|
1560
|
+
onAfterRouteLeave: A,
|
|
1561
|
+
prefetch: e == null ? void 0 : e.prefetch
|
|
1557
1562
|
};
|
|
1558
1563
|
return It;
|
|
1559
1564
|
}
|
|
@@ -1596,7 +1601,7 @@ function Lt(t, e) {
|
|
|
1596
1601
|
const Sr = Je(() => new Promise((t) => {
|
|
1597
1602
|
t({ default: { template: "" } });
|
|
1598
1603
|
}));
|
|
1599
|
-
function
|
|
1604
|
+
function ne(t) {
|
|
1600
1605
|
return t.name === Sr.name && "setup" in t;
|
|
1601
1606
|
}
|
|
1602
1607
|
function Ar(t, e = {}, n = {}) {
|
|
@@ -1608,20 +1613,20 @@ function Ar(t, e = {}, n = {}) {
|
|
|
1608
1613
|
} catch (f) {
|
|
1609
1614
|
throw f instanceof X && console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`, f), f;
|
|
1610
1615
|
}
|
|
1611
|
-
}), u = j(() => r.find(c.value, s.value)), l = j(() => !!u.value && r.route.matches.includes(u.value.matched)),
|
|
1612
|
-
return
|
|
1616
|
+
}), u = j(() => r.find(c.value, s.value)), l = j(() => !!u.value && r.route.matches.includes(u.value.matched)), d = j(() => !!u.value && r.route.matched === u.value.matched);
|
|
1617
|
+
return ae(u, (f) => {
|
|
1613
1618
|
if (!f)
|
|
1614
1619
|
return;
|
|
1615
|
-
const { prefetch:
|
|
1620
|
+
const { prefetch: v } = r, { prefetch: p } = s.value;
|
|
1616
1621
|
xr(f, {
|
|
1617
|
-
routerPrefetch:
|
|
1618
|
-
linkPrefetch:
|
|
1622
|
+
routerPrefetch: v,
|
|
1623
|
+
linkPrefetch: p
|
|
1619
1624
|
});
|
|
1620
1625
|
}, { immediate: !0 }), {
|
|
1621
1626
|
route: u,
|
|
1622
1627
|
href: c,
|
|
1623
1628
|
isMatch: l,
|
|
1624
|
-
isExactMatch:
|
|
1629
|
+
isExactMatch: d,
|
|
1625
1630
|
push: (f) => r.push(c.value, {}, { ...s.value, ...f }),
|
|
1626
1631
|
replace: (f) => r.replace(c.value, {}, { ...s.value, ...f })
|
|
1627
1632
|
};
|
|
@@ -1632,8 +1637,8 @@ function xr(t, { routerPrefetch: e, linkPrefetch: n }) {
|
|
|
1632
1637
|
routePrefetch: r.prefetch,
|
|
1633
1638
|
routerPrefetch: e,
|
|
1634
1639
|
linkPrefetch: n
|
|
1635
|
-
}, "components") && (Nt(r) &&
|
|
1636
|
-
|
|
1640
|
+
}, "components") && (Nt(r) && ne(r.component) && r.component.setup(), Ut(r) && Object.values(r.components).forEach((a) => {
|
|
1641
|
+
ne(a) && a.setup();
|
|
1637
1642
|
}));
|
|
1638
1643
|
});
|
|
1639
1644
|
}
|
|
@@ -1657,7 +1662,7 @@ function Br(t, e) {
|
|
|
1657
1662
|
if (!kr(n.route, t, e))
|
|
1658
1663
|
throw new on(t, n.route.name);
|
|
1659
1664
|
}
|
|
1660
|
-
return
|
|
1665
|
+
return ae(n.route, r, { immediate: !0, deep: !0 }), n.route;
|
|
1661
1666
|
}
|
|
1662
1667
|
const _e = Symbol();
|
|
1663
1668
|
function Tt() {
|
|
@@ -1672,13 +1677,13 @@ function qe() {
|
|
|
1672
1677
|
function We(t) {
|
|
1673
1678
|
return (e) => {
|
|
1674
1679
|
const n = Tt(), o = qe().addBeforeRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
|
|
1675
|
-
return
|
|
1680
|
+
return se(o), o;
|
|
1676
1681
|
};
|
|
1677
1682
|
}
|
|
1678
1683
|
function Ft(t) {
|
|
1679
1684
|
return (e) => {
|
|
1680
1685
|
const n = Tt(), o = qe().addAfterRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
|
|
1681
|
-
return
|
|
1686
|
+
return se(o), o;
|
|
1682
1687
|
};
|
|
1683
1688
|
}
|
|
1684
1689
|
const Or = We("onBeforeRouteUpdate"), _r = We("onBeforeRouteLeave"), qr = Ft("onAfterRouteEnter"), Wr = Ft("onAfterRouteUpdate"), Dr = Ft("onAfterRouteLeave"), Lr = ["href"], Nr = /* @__PURE__ */ ct({
|
|
@@ -1687,26 +1692,27 @@ const Or = We("onBeforeRouteUpdate"), _r = We("onBeforeRouteLeave"), qr = Ft("on
|
|
|
1687
1692
|
to: {},
|
|
1688
1693
|
prefetch: { type: [Boolean, Object], default: void 0 },
|
|
1689
1694
|
query: {},
|
|
1695
|
+
hash: {},
|
|
1690
1696
|
replace: { type: Boolean },
|
|
1691
1697
|
state: {}
|
|
1692
1698
|
},
|
|
1693
1699
|
setup(t) {
|
|
1694
1700
|
const e = t, n = Ht(), r = j(() => D(e.to) ? e.to : e.to(n.resolve)), o = j(() => {
|
|
1695
|
-
const { to: f, ...
|
|
1696
|
-
return
|
|
1701
|
+
const { to: f, ...v } = e;
|
|
1702
|
+
return v;
|
|
1697
1703
|
}), { href: a, isMatch: s, isExactMatch: c } = Ar(r, o), u = j(() => ({
|
|
1698
1704
|
"router-link--match": s.value,
|
|
1699
1705
|
"router-link--exact-match": c.value
|
|
1700
1706
|
})), l = j(() => n.isExternal(r.value));
|
|
1701
|
-
function
|
|
1707
|
+
function d(f) {
|
|
1702
1708
|
f.preventDefault(), n.push(a.value, o.value);
|
|
1703
1709
|
}
|
|
1704
|
-
return (f,
|
|
1710
|
+
return (f, v) => (ce(), Ge("a", {
|
|
1705
1711
|
href: r.value,
|
|
1706
1712
|
class: Ke(["router-link", u.value]),
|
|
1707
|
-
onClick:
|
|
1713
|
+
onClick: d
|
|
1708
1714
|
}, [
|
|
1709
|
-
|
|
1715
|
+
ue(f.$slots, "default", ie(ze({ resolved: r.value, isMatch: ft(s), isExactMatch: ft(c), isExternal: l.value })))
|
|
1710
1716
|
], 10, Lr));
|
|
1711
1717
|
}
|
|
1712
1718
|
}), Ur = /* @__PURE__ */ ct({
|
|
@@ -1723,8 +1729,8 @@ const Or = We("onBeforeRouteUpdate"), _r = We("onBeforeRouteLeave"), qr = Ft("on
|
|
|
1723
1729
|
const f = n.matches.at(o);
|
|
1724
1730
|
if (!f)
|
|
1725
1731
|
return null;
|
|
1726
|
-
const
|
|
1727
|
-
return
|
|
1732
|
+
const v = c(f), p = l(f);
|
|
1733
|
+
return v ? p ? (n.params, gn(v, () => p(n.params))) : v : null;
|
|
1728
1734
|
});
|
|
1729
1735
|
function c(f) {
|
|
1730
1736
|
return u(f)[e];
|
|
@@ -1733,24 +1739,24 @@ const Or = We("onBeforeRouteUpdate"), _r = We("onBeforeRouteLeave"), qr = Ft("on
|
|
|
1733
1739
|
return Ut(f) ? f.components : Nt(f) ? { default: f.component } : typeof a == "string" ? {} : { default: a };
|
|
1734
1740
|
}
|
|
1735
1741
|
function l(f) {
|
|
1736
|
-
return
|
|
1742
|
+
return d(f)[e];
|
|
1737
1743
|
}
|
|
1738
|
-
function
|
|
1744
|
+
function d(f) {
|
|
1739
1745
|
return Ut(f) ? f.props ?? {} : Nt(f) ? { default: f.props } : {};
|
|
1740
1746
|
}
|
|
1741
|
-
return (f,
|
|
1742
|
-
(
|
|
1747
|
+
return (f, v) => s.value ? ue(f.$slots, "default", ie(Ze({ key: 0 }, { route: ft(n), component: s.value, rejection: ft(r) })), () => [
|
|
1748
|
+
(ce(), tn(en(s.value)))
|
|
1743
1749
|
]) : nn("", !0);
|
|
1744
1750
|
}
|
|
1745
1751
|
});
|
|
1746
1752
|
function $r(t) {
|
|
1747
1753
|
return vt(t) && typeof t.host == "string";
|
|
1748
1754
|
}
|
|
1749
|
-
function
|
|
1755
|
+
function re(t) {
|
|
1750
1756
|
return $r(t) ? t : He(t, {});
|
|
1751
1757
|
}
|
|
1752
1758
|
function Mr(t) {
|
|
1753
|
-
const e = Dt(t.name), n = Ve(t.path), r = je(t.query), o = t.meta ?? {}, a = mn(t) ?
|
|
1759
|
+
const e = Dt(t.name), n = Ve(t.path), r = je(t.query), o = t.meta ?? {}, a = mn(t) ? re(t.host) : re(""), s = it({ meta: {}, state: {}, ...t }), c = {
|
|
1754
1760
|
matched: s,
|
|
1755
1761
|
matches: [s],
|
|
1756
1762
|
name: e,
|
|
@@ -1760,7 +1766,7 @@ function Mr(t) {
|
|
|
1760
1766
|
meta: o,
|
|
1761
1767
|
depth: 1,
|
|
1762
1768
|
state: {}
|
|
1763
|
-
}, u =
|
|
1769
|
+
}, u = he(t) ? pe(t.parent, c) : c;
|
|
1764
1770
|
return et(u.path.params, u.query.params, u.host.params), u;
|
|
1765
1771
|
}
|
|
1766
1772
|
export {
|
|
@@ -1781,10 +1787,10 @@ export {
|
|
|
1781
1787
|
Dr as onAfterRouteUpdate,
|
|
1782
1788
|
Or as onBeforeRouteLeave,
|
|
1783
1789
|
_r as onBeforeRouteUpdate,
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1790
|
+
te as path,
|
|
1791
|
+
ee as query,
|
|
1792
|
+
fe as routerInjectionKey,
|
|
1793
|
+
we as routerRejectionKey,
|
|
1788
1794
|
Ar as useLink,
|
|
1789
1795
|
xn as useRejection,
|
|
1790
1796
|
Br as useRoute,
|