@kitbag/router 0.11.0 → 0.11.2
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 +11 -15
- package/dist/kitbag-router.js +233 -226
- package/dist/kitbag-router.umd.cjs +1 -1
- package/package.json +4 -3
package/dist/kitbag-router.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Ye = Object.defineProperty;
|
|
2
2
|
var Xe = (t, e, n) => e in t ? Ye(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
-
var M = (t, e, n) =>
|
|
4
|
-
import { defineComponent as ut, h as pt, ref as ie, inject as it, toRefs as Ze, reactive as
|
|
3
|
+
var M = (t, e, n) => Xe(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { defineComponent as ut, h as pt, ref as ie, inject as it, toRefs as Ze, reactive as Ht, markRaw as dt, defineAsyncComponent as tn, watch as fe, toValue as ht, toRef as en, computed as V, onUnmounted as le, openBlock as he, createElementBlock as nn, normalizeClass as rn, renderSlot as pe, normalizeProps as de, guardReactiveProps as on, unref as ot, resolveComponent as an, provide as sn, mergeProps as cn, createBlock as un, resolveDynamicComponent as fn, createCommentVNode as ln } from "vue";
|
|
5
5
|
class St extends Error {
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Router not installed");
|
|
@@ -55,7 +55,7 @@ class Rn extends Error {
|
|
|
55
55
|
super(`Invalid Param "${e}": Router does not support multiple params by the same name. All param names must be unique.`);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function z(t) {
|
|
59
59
|
return Array.isArray(t) ? t : [t];
|
|
60
60
|
}
|
|
61
61
|
function me(t, e) {
|
|
@@ -97,10 +97,10 @@ function En(t) {
|
|
|
97
97
|
function ge(t) {
|
|
98
98
|
return "parent" in t && !!t.parent;
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function Vt(t) {
|
|
101
101
|
return "component" in t && !!t.component;
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function jt(t) {
|
|
104
104
|
return "components" in t && !!t.components;
|
|
105
105
|
}
|
|
106
106
|
function Sn(t) {
|
|
@@ -142,9 +142,9 @@ function An(t, e) {
|
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
class Y extends Error {
|
|
146
146
|
}
|
|
147
|
-
const T = "[",
|
|
147
|
+
const T = "[", J = "]";
|
|
148
148
|
function xn(t) {
|
|
149
149
|
return t !== String && t !== Boolean && t !== Number && t !== Date;
|
|
150
150
|
}
|
|
@@ -165,7 +165,7 @@ function Ln(t, e) {
|
|
|
165
165
|
}
|
|
166
166
|
const H = {
|
|
167
167
|
invalid: (t) => {
|
|
168
|
-
throw new
|
|
168
|
+
throw new Y(t);
|
|
169
169
|
}
|
|
170
170
|
}, Nn = {
|
|
171
171
|
get: (t) => t,
|
|
@@ -233,7 +233,7 @@ function at(t, e, n = !1) {
|
|
|
233
233
|
return e.defaultValue;
|
|
234
234
|
if (n)
|
|
235
235
|
return;
|
|
236
|
-
throw new
|
|
236
|
+
throw new Y();
|
|
237
237
|
}
|
|
238
238
|
if (e === String)
|
|
239
239
|
return Nn.get(t, H);
|
|
@@ -252,7 +252,7 @@ function at(t, e, n = !1) {
|
|
|
252
252
|
if (e instanceof RegExp) {
|
|
253
253
|
if (e.test(t))
|
|
254
254
|
return t;
|
|
255
|
-
throw new
|
|
255
|
+
throw new Y();
|
|
256
256
|
}
|
|
257
257
|
return t;
|
|
258
258
|
}
|
|
@@ -260,7 +260,7 @@ function st(t, e, n = !1) {
|
|
|
260
260
|
if (t === void 0) {
|
|
261
261
|
if (n)
|
|
262
262
|
return "";
|
|
263
|
-
throw new
|
|
263
|
+
throw new Y();
|
|
264
264
|
}
|
|
265
265
|
if (e === Boolean)
|
|
266
266
|
return ve.set(t, H);
|
|
@@ -275,7 +275,7 @@ function st(t, e, n = !1) {
|
|
|
275
275
|
try {
|
|
276
276
|
return t.toString();
|
|
277
277
|
} catch {
|
|
278
|
-
throw new
|
|
278
|
+
throw new Y();
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
function Un(t, e) {
|
|
@@ -299,12 +299,12 @@ var U;
|
|
|
299
299
|
(function(t) {
|
|
300
300
|
t.Pop = "POP", t.Push = "PUSH", t.Replace = "REPLACE";
|
|
301
301
|
})(U || (U = {}));
|
|
302
|
-
var
|
|
302
|
+
var X = process.env.NODE_ENV !== "production" ? function(t) {
|
|
303
303
|
return Object.freeze(t);
|
|
304
304
|
} : function(t) {
|
|
305
305
|
return t;
|
|
306
306
|
};
|
|
307
|
-
function
|
|
307
|
+
function Q(t, e) {
|
|
308
308
|
if (!t) {
|
|
309
309
|
typeof console < "u" && console.warn(e);
|
|
310
310
|
try {
|
|
@@ -313,13 +313,13 @@ function G(t, e) {
|
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
-
var gt = "beforeunload",
|
|
317
|
-
function
|
|
316
|
+
var gt = "beforeunload", $n = "hashchange", Se = "popstate";
|
|
317
|
+
function Xt(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
321
|
var m = r.location, l = m.pathname, d = m.search, w = m.hash, P = o.state || {};
|
|
322
|
-
return [P.idx,
|
|
322
|
+
return [P.idx, X({
|
|
323
323
|
pathname: l,
|
|
324
324
|
search: d,
|
|
325
325
|
hash: w,
|
|
@@ -344,7 +344,7 @@ function Yt(t) {
|
|
|
344
344
|
}
|
|
345
345
|
}, b(P));
|
|
346
346
|
} else
|
|
347
|
-
process.env.NODE_ENV !== "production" &&
|
|
347
|
+
process.env.NODE_ENV !== "production" && Q(
|
|
348
348
|
!1,
|
|
349
349
|
// TODO: Write up a doc that explains our blocking strategy in
|
|
350
350
|
// detail and link to it here so people can understand better what
|
|
@@ -356,15 +356,15 @@ function Yt(t) {
|
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
r.addEventListener(Se, u);
|
|
359
|
-
var c = U.Pop, f = a(), i = f[0], h = f[1], y =
|
|
359
|
+
var c = U.Pop, f = a(), i = f[0], h = f[1], y = Z(), p = Z();
|
|
360
360
|
i == null && (i = 0, o.replaceState(F({}, o.state, {
|
|
361
361
|
idx: i
|
|
362
362
|
}), ""));
|
|
363
363
|
function S(m) {
|
|
364
|
-
return typeof m == "string" ? m :
|
|
364
|
+
return typeof m == "string" ? m : G(m);
|
|
365
365
|
}
|
|
366
366
|
function E(m, l) {
|
|
367
|
-
return l === void 0 && (l = null),
|
|
367
|
+
return l === void 0 && (l = null), X(F({
|
|
368
368
|
pathname: h.pathname,
|
|
369
369
|
hash: "",
|
|
370
370
|
search: ""
|
|
@@ -401,11 +401,11 @@ function Yt(t) {
|
|
|
401
401
|
g(m, l);
|
|
402
402
|
}
|
|
403
403
|
if (k(d, w, P)) {
|
|
404
|
-
var B = A(w, i + 1), N = B[0],
|
|
404
|
+
var B = A(w, i + 1), N = B[0], C = B[1];
|
|
405
405
|
try {
|
|
406
|
-
o.pushState(N, "",
|
|
406
|
+
o.pushState(N, "", C);
|
|
407
407
|
} catch {
|
|
408
|
-
r.location.assign(
|
|
408
|
+
r.location.assign(C);
|
|
409
409
|
}
|
|
410
410
|
j(d);
|
|
411
411
|
}
|
|
@@ -416,8 +416,8 @@ function Yt(t) {
|
|
|
416
416
|
v(m, l);
|
|
417
417
|
}
|
|
418
418
|
if (k(d, w, P)) {
|
|
419
|
-
var B = A(w, i), N = B[0],
|
|
420
|
-
o.replaceState(N, "",
|
|
419
|
+
var B = A(w, i), N = B[0], C = B[1];
|
|
420
|
+
o.replaceState(N, "", C), j(d);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
function b(m) {
|
|
@@ -452,17 +452,17 @@ function Yt(t) {
|
|
|
452
452
|
};
|
|
453
453
|
return x;
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function Cn(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 l = ct(r.location.hash.substr(1)), d = l.pathname, w = d === void 0 ? "/" : d, P = l.search, B = P === void 0 ? "" : P, N = l.hash,
|
|
460
|
-
return [
|
|
459
|
+
var l = ct(r.location.hash.substr(1)), d = l.pathname, w = d === void 0 ? "/" : d, P = l.search, B = P === void 0 ? "" : P, N = l.hash, C = N === void 0 ? "" : N, $ = o.state || {};
|
|
460
|
+
return [$.idx, X({
|
|
461
461
|
pathname: w,
|
|
462
462
|
search: B,
|
|
463
|
-
hash:
|
|
464
|
-
state:
|
|
465
|
-
key:
|
|
463
|
+
hash: C,
|
|
464
|
+
state: $.usr || null,
|
|
465
|
+
key: $.key || "default"
|
|
466
466
|
})];
|
|
467
467
|
}
|
|
468
468
|
var s = null;
|
|
@@ -482,7 +482,7 @@ function $n(t) {
|
|
|
482
482
|
}
|
|
483
483
|
}, x(B));
|
|
484
484
|
} else
|
|
485
|
-
process.env.NODE_ENV !== "production" &&
|
|
485
|
+
process.env.NODE_ENV !== "production" && Q(
|
|
486
486
|
!1,
|
|
487
487
|
// TODO: Write up a doc that explains our blocking strategy in
|
|
488
488
|
// detail and link to it here so people can understand better
|
|
@@ -493,11 +493,11 @@ function $n(t) {
|
|
|
493
493
|
g(l);
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
r.addEventListener(Se, u), r.addEventListener(
|
|
496
|
+
r.addEventListener(Se, u), r.addEventListener($n, function() {
|
|
497
497
|
var l = a(), d = l[1];
|
|
498
|
-
|
|
498
|
+
G(d) !== G(h) && u();
|
|
499
499
|
});
|
|
500
|
-
var c = U.Pop, f = a(), i = f[0], h = f[1], y =
|
|
500
|
+
var c = U.Pop, f = a(), i = f[0], h = f[1], y = Z(), p = Z();
|
|
501
501
|
i == null && (i = 0, o.replaceState(F({}, o.state, {
|
|
502
502
|
idx: i
|
|
503
503
|
}), ""));
|
|
@@ -510,10 +510,10 @@ function $n(t) {
|
|
|
510
510
|
return d;
|
|
511
511
|
}
|
|
512
512
|
function E(l) {
|
|
513
|
-
return S() + "#" + (typeof l == "string" ? l :
|
|
513
|
+
return S() + "#" + (typeof l == "string" ? l : G(l));
|
|
514
514
|
}
|
|
515
515
|
function A(l, d) {
|
|
516
|
-
return d === void 0 && (d = null),
|
|
516
|
+
return d === void 0 && (d = null), X(F({
|
|
517
517
|
pathname: h.pathname,
|
|
518
518
|
hash: "",
|
|
519
519
|
search: ""
|
|
@@ -549,12 +549,12 @@ function $n(t) {
|
|
|
549
549
|
function B() {
|
|
550
550
|
v(l, d);
|
|
551
551
|
}
|
|
552
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
553
|
-
var N = k(P, i + 1),
|
|
552
|
+
if (process.env.NODE_ENV !== "production" && Q(P.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(l) + ")"), j(w, P, B)) {
|
|
553
|
+
var N = k(P, i + 1), C = N[0], $ = N[1];
|
|
554
554
|
try {
|
|
555
|
-
o.pushState(
|
|
555
|
+
o.pushState(C, "", $);
|
|
556
556
|
} catch {
|
|
557
|
-
r.location.assign(
|
|
557
|
+
r.location.assign($);
|
|
558
558
|
}
|
|
559
559
|
g(w);
|
|
560
560
|
}
|
|
@@ -564,9 +564,9 @@ function $n(t) {
|
|
|
564
564
|
function B() {
|
|
565
565
|
b(l, d);
|
|
566
566
|
}
|
|
567
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
568
|
-
var N = k(P, i),
|
|
569
|
-
o.replaceState(
|
|
567
|
+
if (process.env.NODE_ENV !== "production" && Q(P.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(l) + ")"), j(w, P, B)) {
|
|
568
|
+
var N = k(P, i), C = N[0], $ = N[1];
|
|
569
|
+
o.replaceState(C, "", $), g(w);
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
572
|
function x(l) {
|
|
@@ -601,23 +601,23 @@ function $n(t) {
|
|
|
601
601
|
};
|
|
602
602
|
return m;
|
|
603
603
|
}
|
|
604
|
-
function
|
|
604
|
+
function Zt(t) {
|
|
605
605
|
t === void 0 && (t = {});
|
|
606
606
|
var e = t, n = e.initialEntries, r = n === void 0 ? ["/"] : n, o = e.initialIndex, a = r.map(function(g) {
|
|
607
|
-
var v =
|
|
607
|
+
var v = X(F({
|
|
608
608
|
pathname: "/",
|
|
609
609
|
search: "",
|
|
610
610
|
hash: "",
|
|
611
611
|
state: null,
|
|
612
612
|
key: yt()
|
|
613
613
|
}, typeof g == "string" ? ct(g) : g));
|
|
614
|
-
return process.env.NODE_ENV !== "production" &&
|
|
615
|
-
}), s =
|
|
614
|
+
return process.env.NODE_ENV !== "production" && Q(v.pathname.charAt(0) === "/", "Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: " + JSON.stringify(g) + ")"), v;
|
|
615
|
+
}), s = te(o ?? a.length - 1, 0, a.length - 1), u = U.Pop, c = a[s], f = Z(), i = Z();
|
|
616
616
|
function h(g) {
|
|
617
|
-
return typeof g == "string" ? g :
|
|
617
|
+
return typeof g == "string" ? g : G(g);
|
|
618
618
|
}
|
|
619
619
|
function y(g, v) {
|
|
620
|
-
return v === void 0 && (v = null),
|
|
620
|
+
return v === void 0 && (v = null), X(F({
|
|
621
621
|
pathname: c.pathname,
|
|
622
622
|
search: "",
|
|
623
623
|
hash: ""
|
|
@@ -644,17 +644,17 @@ function Xt(t) {
|
|
|
644
644
|
function m() {
|
|
645
645
|
E(g, v);
|
|
646
646
|
}
|
|
647
|
-
process.env.NODE_ENV !== "production" &&
|
|
647
|
+
process.env.NODE_ENV !== "production" && Q(c.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.push(" + JSON.stringify(g) + ")"), p(b, x, m) && (s += 1, a.splice(s, a.length, x), S(b, x));
|
|
648
648
|
}
|
|
649
649
|
function A(g, v) {
|
|
650
650
|
var b = U.Replace, x = y(g, v);
|
|
651
651
|
function m() {
|
|
652
652
|
A(g, v);
|
|
653
653
|
}
|
|
654
|
-
process.env.NODE_ENV !== "production" &&
|
|
654
|
+
process.env.NODE_ENV !== "production" && Q(c.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(g) + ")"), p(b, x, m) && (a[s] = x, S(b, x));
|
|
655
655
|
}
|
|
656
656
|
function k(g) {
|
|
657
|
-
var v =
|
|
657
|
+
var v = te(s + g, 0, a.length - 1), b = U.Pop, x = a[v];
|
|
658
658
|
function m() {
|
|
659
659
|
k(g);
|
|
660
660
|
}
|
|
@@ -689,13 +689,13 @@ function Xt(t) {
|
|
|
689
689
|
};
|
|
690
690
|
return j;
|
|
691
691
|
}
|
|
692
|
-
function
|
|
692
|
+
function te(t, e, n) {
|
|
693
693
|
return Math.min(Math.max(t, e), n);
|
|
694
694
|
}
|
|
695
695
|
function Rt(t) {
|
|
696
696
|
t.preventDefault(), t.returnValue = "";
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function Z() {
|
|
699
699
|
var t = [];
|
|
700
700
|
return {
|
|
701
701
|
get length() {
|
|
@@ -718,7 +718,7 @@ function tt() {
|
|
|
718
718
|
function yt() {
|
|
719
719
|
return Math.random().toString(36).substr(2, 8);
|
|
720
720
|
}
|
|
721
|
-
function
|
|
721
|
+
function G(t) {
|
|
722
722
|
var e = t.pathname, n = e === void 0 ? "/" : e, r = t.search, o = r === void 0 ? "" : r, a = t.hash, s = a === void 0 ? "" : a;
|
|
723
723
|
return o && o !== "?" && (n += o.charAt(0) === "?" ? o : "?" + o), s && s !== "#" && (n += s.charAt(0) === "#" ? s : "#" + s), n;
|
|
724
724
|
}
|
|
@@ -751,7 +751,7 @@ function Vn() {
|
|
|
751
751
|
return t;
|
|
752
752
|
}
|
|
753
753
|
const Ae = Symbol();
|
|
754
|
-
function
|
|
754
|
+
function Ot() {
|
|
755
755
|
const t = it(Ae);
|
|
756
756
|
if (!t)
|
|
757
757
|
throw new St();
|
|
@@ -776,7 +776,7 @@ function On(t, e) {
|
|
|
776
776
|
};
|
|
777
777
|
return e(t.name, E, S);
|
|
778
778
|
}
|
|
779
|
-
const { id: r, matched: o, matches: a, name: s, query: u, params: c, state: f, hash: i } = Ze(t), h =
|
|
779
|
+
const { id: r, matched: o, matches: a, name: s, query: u, params: c, state: f, hash: i } = Ze(t), h = Ht({
|
|
780
780
|
id: r,
|
|
781
781
|
matched: o,
|
|
782
782
|
matches: a,
|
|
@@ -802,7 +802,7 @@ function On(t, e) {
|
|
|
802
802
|
}
|
|
803
803
|
const ke = Symbol();
|
|
804
804
|
function _n(t, e) {
|
|
805
|
-
const n =
|
|
805
|
+
const n = Ht({ ...t }), r = (s) => {
|
|
806
806
|
Object.assign(n, {
|
|
807
807
|
[ke]: !1,
|
|
808
808
|
...s
|
|
@@ -845,12 +845,14 @@ function Wn(t) {
|
|
|
845
845
|
}
|
|
846
846
|
function Dn({ mode: t, listener: e }) {
|
|
847
847
|
const n = Tn(t), r = (c, f) => {
|
|
848
|
-
if (f != null && f.replace)
|
|
849
|
-
|
|
848
|
+
if (f != null && f.replace) {
|
|
849
|
+
n.replace(c, f.state);
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
850
852
|
n.push(c, f == null ? void 0 : f.state);
|
|
851
853
|
}, o = () => {
|
|
852
|
-
const c =
|
|
853
|
-
|
|
854
|
+
const c = G(n.location);
|
|
855
|
+
n.replace(c);
|
|
854
856
|
};
|
|
855
857
|
let a;
|
|
856
858
|
return {
|
|
@@ -868,13 +870,13 @@ function Dn({ mode: t, listener: e }) {
|
|
|
868
870
|
function Tn(t = "auto") {
|
|
869
871
|
switch (t) {
|
|
870
872
|
case "auto":
|
|
871
|
-
return ye() ?
|
|
873
|
+
return ye() ? Xt() : Zt();
|
|
872
874
|
case "browser":
|
|
873
|
-
return Yt();
|
|
874
|
-
case "memory":
|
|
875
875
|
return Xt();
|
|
876
|
+
case "memory":
|
|
877
|
+
return Zt();
|
|
876
878
|
case "hash":
|
|
877
|
-
return
|
|
879
|
+
return Cn();
|
|
878
880
|
default:
|
|
879
881
|
const e = t;
|
|
880
882
|
throw new Error(`Switch is not exhaustive for mode: ${e}`);
|
|
@@ -890,7 +892,7 @@ class vt {
|
|
|
890
892
|
M(this, "onAfterRouteLeave", /* @__PURE__ */ new Set());
|
|
891
893
|
}
|
|
892
894
|
}
|
|
893
|
-
class
|
|
895
|
+
class ee extends Error {
|
|
894
896
|
}
|
|
895
897
|
class rt extends Error {
|
|
896
898
|
constructor(n) {
|
|
@@ -909,17 +911,17 @@ class Lt extends Error {
|
|
|
909
911
|
function In(t, e) {
|
|
910
912
|
const n = new vt();
|
|
911
913
|
return t.matches.forEach((r, o) => {
|
|
912
|
-
r.onBeforeRouteEnter &&
|
|
914
|
+
r.onBeforeRouteEnter && _t(t, e, o) && z(r.onBeforeRouteEnter).forEach((a) => n.onBeforeRouteEnter.add(a)), r.onBeforeRouteUpdate && Mt(t, e, o) && z(r.onBeforeRouteUpdate).forEach((a) => n.onBeforeRouteUpdate.add(a));
|
|
913
915
|
}), e.matches.forEach((r, o) => {
|
|
914
|
-
r.onBeforeRouteLeave &&
|
|
916
|
+
r.onBeforeRouteLeave && qt(t, e, o) && z(r.onBeforeRouteLeave).forEach((a) => n.onBeforeRouteLeave.add(a));
|
|
915
917
|
}), n;
|
|
916
918
|
}
|
|
917
919
|
function Fn(t, e) {
|
|
918
920
|
const n = new vt();
|
|
919
921
|
return t.matches.forEach((r, o) => {
|
|
920
|
-
r.onAfterRouteEnter &&
|
|
922
|
+
r.onAfterRouteEnter && _t(t, e, o) && z(r.onAfterRouteEnter).forEach((a) => n.onAfterRouteEnter.add(a)), r.onAfterRouteUpdate && Mt(t, e, o) && z(r.onAfterRouteUpdate).forEach((a) => n.onAfterRouteUpdate.add(a));
|
|
921
923
|
}), e.matches.forEach((r, o) => {
|
|
922
|
-
r.onAfterRouteLeave &&
|
|
924
|
+
r.onAfterRouteLeave && qt(t, e, o) && z(r.onAfterRouteLeave).forEach((a) => n.onAfterRouteLeave.add(a));
|
|
923
925
|
}), n;
|
|
924
926
|
}
|
|
925
927
|
function W(t) {
|
|
@@ -938,7 +940,7 @@ function Jn() {
|
|
|
938
940
|
const f = u, i = c ?? {};
|
|
939
941
|
throw new rt([s, f, { ...i, replace: !0 }]);
|
|
940
942
|
}, r = () => {
|
|
941
|
-
throw new
|
|
943
|
+
throw new ee();
|
|
942
944
|
};
|
|
943
945
|
async function o({ to: s, from: u, hooks: c }) {
|
|
944
946
|
const { global: f, component: i } = c, h = In(s, u), y = [
|
|
@@ -971,7 +973,7 @@ function Jn() {
|
|
|
971
973
|
status: "REJECT",
|
|
972
974
|
type: p.type
|
|
973
975
|
};
|
|
974
|
-
if (p instanceof
|
|
976
|
+
if (p instanceof ee)
|
|
975
977
|
return {
|
|
976
978
|
status: "ABORT"
|
|
977
979
|
};
|
|
@@ -1023,24 +1025,24 @@ function Jn() {
|
|
|
1023
1025
|
runAfterRouteHooks: a
|
|
1024
1026
|
};
|
|
1025
1027
|
}
|
|
1026
|
-
const
|
|
1028
|
+
const _t = (t, e, n) => {
|
|
1027
1029
|
const r = t.matches, o = (e == null ? void 0 : e.matches) ?? [];
|
|
1028
1030
|
return r.length < n || r[n] !== o[n];
|
|
1029
|
-
},
|
|
1031
|
+
}, qt = (t, e, n) => {
|
|
1030
1032
|
const r = t.matches, o = (e == null ? void 0 : e.matches) ?? [];
|
|
1031
1033
|
return r.length < n || r[n] !== o[n];
|
|
1032
|
-
},
|
|
1033
|
-
function
|
|
1034
|
+
}, Mt = (t, e, n) => t.matches[n] === (e == null ? void 0 : e.matches[n]);
|
|
1035
|
+
function ne(t) {
|
|
1034
1036
|
switch (t) {
|
|
1035
1037
|
case "onBeforeRouteEnter":
|
|
1036
1038
|
case "onAfterRouteEnter":
|
|
1037
|
-
return
|
|
1039
|
+
return _t;
|
|
1038
1040
|
case "onBeforeRouteUpdate":
|
|
1039
1041
|
case "onAfterRouteUpdate":
|
|
1040
|
-
return
|
|
1042
|
+
return Mt;
|
|
1041
1043
|
case "onBeforeRouteLeave":
|
|
1042
1044
|
case "onAfterRouteLeave":
|
|
1043
|
-
return
|
|
1045
|
+
return qt;
|
|
1044
1046
|
default:
|
|
1045
1047
|
throw new Error(`Switch is not exhaustive for lifecycle: ${t}`);
|
|
1046
1048
|
}
|
|
@@ -1051,14 +1053,14 @@ function Qn() {
|
|
|
1051
1053
|
component: new vt()
|
|
1052
1054
|
};
|
|
1053
1055
|
function e({ lifecycle: r, timing: o, depth: a, hook: s }) {
|
|
1054
|
-
const u =
|
|
1056
|
+
const u = ne(r), c = t[o][r], f = (i, h) => {
|
|
1055
1057
|
if (u(i, h.from, a))
|
|
1056
1058
|
return s(i, h);
|
|
1057
1059
|
};
|
|
1058
1060
|
return c.add(f), () => c.delete(f);
|
|
1059
1061
|
}
|
|
1060
1062
|
function n({ lifecycle: r, timing: o, depth: a, hook: s }) {
|
|
1061
|
-
const u =
|
|
1063
|
+
const u = ne(r), c = t[o][r], f = (i, h) => {
|
|
1062
1064
|
if (u(i, h.from, a))
|
|
1063
1065
|
return s(i, h);
|
|
1064
1066
|
};
|
|
@@ -1096,7 +1098,7 @@ function zn() {
|
|
|
1096
1098
|
let t = 0;
|
|
1097
1099
|
return () => (++t).toString();
|
|
1098
1100
|
}
|
|
1099
|
-
const
|
|
1101
|
+
const Wt = zn();
|
|
1100
1102
|
function Yn({
|
|
1101
1103
|
rejections: t
|
|
1102
1104
|
}) {
|
|
@@ -1107,7 +1109,7 @@ function Yn({
|
|
|
1107
1109
|
return dt(s[a] ?? Kn(a));
|
|
1108
1110
|
}, n = (a) => {
|
|
1109
1111
|
const s = dt(e(a)), u = {
|
|
1110
|
-
id:
|
|
1112
|
+
id: Wt(),
|
|
1111
1113
|
name: a,
|
|
1112
1114
|
component: s,
|
|
1113
1115
|
meta: {},
|
|
@@ -1142,7 +1144,7 @@ class Xn extends Error {
|
|
|
1142
1144
|
super(`Route not found: "${e}"`);
|
|
1143
1145
|
}
|
|
1144
1146
|
}
|
|
1145
|
-
function
|
|
1147
|
+
function Dt(t) {
|
|
1146
1148
|
return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1147
1149
|
}
|
|
1148
1150
|
function Zn(t, e) {
|
|
@@ -1151,7 +1153,7 @@ function Zn(t, e) {
|
|
|
1151
1153
|
return [t];
|
|
1152
1154
|
let r = 0;
|
|
1153
1155
|
const o = n.reduce((s, u) => {
|
|
1154
|
-
const c =
|
|
1156
|
+
const c = Dt(t.slice(r, u.index));
|
|
1155
1157
|
c.length && s.push(c);
|
|
1156
1158
|
const [f] = u;
|
|
1157
1159
|
return s.push(f), r = u.index + f.length, s;
|
|
@@ -1164,13 +1166,13 @@ function tr(t) {
|
|
|
1164
1166
|
}
|
|
1165
1167
|
function er(t) {
|
|
1166
1168
|
const e = new URLSearchParams(t.query.toString());
|
|
1167
|
-
return Array.from(e.entries()).filter(([, n]) =>
|
|
1169
|
+
return Array.from(e.entries()).filter(([, n]) => !$t(n)).map(([n, r]) => {
|
|
1168
1170
|
const o = Ne(r);
|
|
1169
|
-
return new RegExp(`${
|
|
1171
|
+
return new RegExp(`${Dt(n)}=${o}(&|$)`, "i");
|
|
1170
1172
|
});
|
|
1171
1173
|
}
|
|
1172
1174
|
function Ne(t) {
|
|
1173
|
-
return Zn(t, new RegExp(nr, "g")).map((e) => e.startsWith(T) ? Ue(e) :
|
|
1175
|
+
return Zn(t, new RegExp(nr, "g")).map((e) => e.startsWith(T) ? Ue(e) : Dt(e)).join("");
|
|
1174
1176
|
}
|
|
1175
1177
|
function Ue(t) {
|
|
1176
1178
|
return [
|
|
@@ -1178,24 +1180,24 @@ function Ue(t) {
|
|
|
1178
1180
|
or
|
|
1179
1181
|
].reduce((e, n) => n(e), t);
|
|
1180
1182
|
}
|
|
1181
|
-
const nr = `\\${T}\\??([\\w-_]+)\\${
|
|
1183
|
+
const nr = `\\${T}\\??([\\w-_]+)\\${J}`, Tt = `\\${T}\\?([\\w-_]+)\\${J}`, $e = `\\${T}([\\w-_]+)\\${J}`;
|
|
1182
1184
|
function rr(t) {
|
|
1183
|
-
return t.replace(new RegExp(
|
|
1185
|
+
return t.replace(new RegExp(Tt, "g"), ".*");
|
|
1184
1186
|
}
|
|
1185
|
-
function
|
|
1186
|
-
return new RegExp(
|
|
1187
|
+
function $t(t) {
|
|
1188
|
+
return new RegExp(Tt, "g").test(t);
|
|
1187
1189
|
}
|
|
1188
1190
|
function or(t) {
|
|
1189
|
-
return t.replace(new RegExp(
|
|
1191
|
+
return t.replace(new RegExp($e, "g"), ".+");
|
|
1190
1192
|
}
|
|
1191
1193
|
function At(t) {
|
|
1192
|
-
const [e] = wt(t, new RegExp(
|
|
1194
|
+
const [e] = wt(t, new RegExp(Tt, "g")), [n] = wt(t, new RegExp($e, "g"));
|
|
1193
1195
|
return e ?? n;
|
|
1194
1196
|
}
|
|
1195
1197
|
function wt(t, e) {
|
|
1196
1198
|
return Array.from(t.matchAll(e)).flatMap(([, ...r]) => r.map((o) => lt(o) ? o : ""));
|
|
1197
1199
|
}
|
|
1198
|
-
function
|
|
1200
|
+
function Ce(t, e, n) {
|
|
1199
1201
|
const r = Ve(e, n), [o] = wt(t, r);
|
|
1200
1202
|
return o;
|
|
1201
1203
|
}
|
|
@@ -1216,13 +1218,13 @@ function Ve(t, e) {
|
|
|
1216
1218
|
function ar(t, e) {
|
|
1217
1219
|
if (!e.startsWith("?"))
|
|
1218
1220
|
return t;
|
|
1219
|
-
const n = new RegExp(`\\${T}\\${e}\\${
|
|
1221
|
+
const n = new RegExp(`\\${T}\\${e}\\${J}`, "g");
|
|
1220
1222
|
return t.replace(n, "(.*)");
|
|
1221
1223
|
}
|
|
1222
1224
|
function sr(t, e) {
|
|
1223
1225
|
if (e.startsWith("?"))
|
|
1224
1226
|
return t;
|
|
1225
|
-
const n = new RegExp(`\\${T}${e}\\${
|
|
1227
|
+
const n = new RegExp(`\\${T}${e}\\${J}`, "g");
|
|
1226
1228
|
return t.replace(n, "(.+)");
|
|
1227
1229
|
}
|
|
1228
1230
|
function je(t, ...e) {
|
|
@@ -1240,14 +1242,14 @@ function cr(t, e = {}) {
|
|
|
1240
1242
|
function ur(t, e) {
|
|
1241
1243
|
const n = t.toString();
|
|
1242
1244
|
return Object.entries(t.params).reduce((r, [o, a]) => {
|
|
1243
|
-
const s = At(`${T}${o}${
|
|
1245
|
+
const s = At(`${T}${o}${J}`);
|
|
1244
1246
|
return s ? He(r, { name: o, param: a, value: e[s] }) : r;
|
|
1245
1247
|
}, n);
|
|
1246
1248
|
}
|
|
1247
1249
|
function ir(t, e) {
|
|
1248
1250
|
const n = t.toString();
|
|
1249
1251
|
return Object.entries(t.params).reduce((r, [o, a]) => {
|
|
1250
|
-
const s = At(`${T}${o}${
|
|
1252
|
+
const s = At(`${T}${o}${J}`);
|
|
1251
1253
|
return s ? He(r, { name: o, param: a, value: e[s] }) : r;
|
|
1252
1254
|
}, n);
|
|
1253
1255
|
}
|
|
@@ -1260,8 +1262,8 @@ function fr(t, e) {
|
|
|
1260
1262
|
const u = At(s);
|
|
1261
1263
|
if (!u)
|
|
1262
1264
|
return { ...o, [a]: s };
|
|
1263
|
-
const f = st(e[u], t.params[u],
|
|
1264
|
-
return
|
|
1265
|
+
const f = st(e[u], t.params[u], $t(s)), i = e[u] === void 0 && f === "";
|
|
1266
|
+
return $t(s) && i ? o : { ...o, [a]: f };
|
|
1265
1267
|
}, {});
|
|
1266
1268
|
}
|
|
1267
1269
|
function lr(t) {
|
|
@@ -1307,7 +1309,7 @@ const dr = (t, e) => {
|
|
|
1307
1309
|
function mr(t, e) {
|
|
1308
1310
|
const n = {}, r = decodeURIComponent(e);
|
|
1309
1311
|
for (const [o, a] of Object.entries(t.params)) {
|
|
1310
|
-
const s = o.startsWith("?"), u = s ? o.slice(1) : o, c =
|
|
1312
|
+
const s = o.startsWith("?"), u = s ? o.slice(1) : o, c = Ce(r, t.toString(), o), f = at(c, a, s);
|
|
1311
1313
|
n[u] = f;
|
|
1312
1314
|
}
|
|
1313
1315
|
return n;
|
|
@@ -1333,7 +1335,7 @@ const Rr = (t) => "name" in t.matched && !!t.matched.name, yr = (t, e) => {
|
|
|
1333
1335
|
function Pr(t) {
|
|
1334
1336
|
const { searchParams: e, pathname: n } = D(t), r = -1, o = 1;
|
|
1335
1337
|
return (a, s) => {
|
|
1336
|
-
const u =
|
|
1338
|
+
const u = oe(a, e), c = re(a, n), f = oe(s, e), i = re(s, n);
|
|
1337
1339
|
if (a.depth > s.depth)
|
|
1338
1340
|
return r;
|
|
1339
1341
|
if (a.depth < s.depth)
|
|
@@ -1346,11 +1348,11 @@ function Pr(t) {
|
|
|
1346
1348
|
return a.hash.toString() === h ? r : s.hash.toString() === h ? o : 0;
|
|
1347
1349
|
};
|
|
1348
1350
|
}
|
|
1349
|
-
function
|
|
1350
|
-
const n = Object.keys(t.path.params).filter((o) => o.startsWith("?")).map((o) => o), r = n.filter((o) =>
|
|
1351
|
+
function re(t, e) {
|
|
1352
|
+
const n = Object.keys(t.path.params).filter((o) => o.startsWith("?")).map((o) => o), r = n.filter((o) => Ce(e, t.path.toString(), o) === void 0);
|
|
1351
1353
|
return n.length - r.length;
|
|
1352
1354
|
}
|
|
1353
|
-
function
|
|
1355
|
+
function oe(t, e) {
|
|
1354
1356
|
const n = new URLSearchParams(t.query.toString()), r = Array.from(n.keys()), o = r.filter((a) => !e.has(a));
|
|
1355
1357
|
return r.length - o.length;
|
|
1356
1358
|
}
|
|
@@ -1381,7 +1383,7 @@ function br(t, e, n) {
|
|
|
1381
1383
|
}
|
|
1382
1384
|
return st(void 0, n, Pt);
|
|
1383
1385
|
}
|
|
1384
|
-
const
|
|
1386
|
+
const ae = (t, e) => {
|
|
1385
1387
|
const n = {};
|
|
1386
1388
|
for (const [r, o] of Object.entries(t)) {
|
|
1387
1389
|
const a = br(e, r, o);
|
|
@@ -1411,8 +1413,8 @@ function Nt(t, e, n) {
|
|
|
1411
1413
|
hash: u
|
|
1412
1414
|
};
|
|
1413
1415
|
}
|
|
1414
|
-
function
|
|
1415
|
-
const n = new RegExp(`\\${T}(\\??[\\w-_]+)\\${
|
|
1416
|
+
function It(t, e) {
|
|
1417
|
+
const n = new RegExp(`\\${T}(\\??[\\w-_]+)\\${J}`, "g");
|
|
1416
1418
|
return Array.from(t.matchAll(n)).reduce((o, [a, s]) => {
|
|
1417
1419
|
const u = At(a);
|
|
1418
1420
|
if (!u)
|
|
@@ -1421,75 +1423,23 @@ function Tt(t, e) {
|
|
|
1421
1423
|
return et([u], o), o[s] = c, o;
|
|
1422
1424
|
}, {});
|
|
1423
1425
|
}
|
|
1424
|
-
function
|
|
1426
|
+
function Ct(t, e) {
|
|
1425
1427
|
return {
|
|
1426
1428
|
value: t,
|
|
1427
|
-
params:
|
|
1429
|
+
params: It(t, e),
|
|
1428
1430
|
toString: () => t
|
|
1429
1431
|
};
|
|
1430
1432
|
}
|
|
1431
|
-
function xr(t) {
|
|
1432
|
-
return
|
|
1433
|
-
}
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
}
|
|
1440
|
-
function ae(t, e) {
|
|
1441
|
-
return {
|
|
1442
|
-
value: t,
|
|
1443
|
-
params: Tt(t, e),
|
|
1444
|
-
toString: () => t
|
|
1445
|
-
};
|
|
1446
|
-
}
|
|
1447
|
-
function kr(t) {
|
|
1448
|
-
return ft(t) && typeof t.value == "string";
|
|
1449
|
-
}
|
|
1450
|
-
function We(t) {
|
|
1451
|
-
return t === void 0 ? ae("", {}) : kr(t) ? t : ae(t, {});
|
|
1452
|
-
}
|
|
1453
|
-
function se(t, e) {
|
|
1454
|
-
return {
|
|
1455
|
-
value: t,
|
|
1456
|
-
params: Tt(t, e),
|
|
1457
|
-
toString: () => t
|
|
1458
|
-
};
|
|
1459
|
-
}
|
|
1460
|
-
function Br(t) {
|
|
1461
|
-
return ft(t) && typeof t.value == "string";
|
|
1462
|
-
}
|
|
1463
|
-
function De(t) {
|
|
1464
|
-
return t === void 0 ? se("", {}) : Br(t) ? t : se(t, {});
|
|
1465
|
-
}
|
|
1466
|
-
function J(t) {
|
|
1467
|
-
const e = Mt(), n = It(t.name), r = We(t.path), o = De(t.query), a = Me(t.hash), s = t.meta ?? {}, u = Sn(t) ? t.state : {}, c = dt({ id: e, meta: {}, state: {}, ...t }), f = {
|
|
1468
|
-
id: e,
|
|
1469
|
-
matched: c,
|
|
1470
|
-
matches: [c],
|
|
1471
|
-
name: n,
|
|
1472
|
-
path: r,
|
|
1473
|
-
query: o,
|
|
1474
|
-
hash: a,
|
|
1475
|
-
meta: s,
|
|
1476
|
-
state: u,
|
|
1477
|
-
depth: 1,
|
|
1478
|
-
host: qe("", {}),
|
|
1479
|
-
prefetch: t.prefetch
|
|
1480
|
-
}, i = ge(t) ? Re(t.parent, f) : f;
|
|
1481
|
-
return et(i.path.params, i.query.params), i;
|
|
1482
|
-
}
|
|
1483
|
-
function Lr(t, e) {
|
|
1484
|
-
if (!lt(e))
|
|
1485
|
-
return t;
|
|
1486
|
-
const n = J({ path: e });
|
|
1487
|
-
return t.map((r) => J({
|
|
1488
|
-
parent: n,
|
|
1489
|
-
...r
|
|
1490
|
-
}));
|
|
1433
|
+
function xr(t, e) {
|
|
1434
|
+
return lt(e) ? t.map((n) => {
|
|
1435
|
+
const r = `${e}${n.path.value}`;
|
|
1436
|
+
return {
|
|
1437
|
+
...n,
|
|
1438
|
+
path: Ct(r, n.path.params)
|
|
1439
|
+
};
|
|
1440
|
+
}) : t;
|
|
1491
1441
|
}
|
|
1492
|
-
class
|
|
1442
|
+
class kr extends Error {
|
|
1493
1443
|
/**
|
|
1494
1444
|
* Constructs a new DuplicateNamesError instance with a message indicating the problematic name.
|
|
1495
1445
|
* @param name - The name of the name that was duplicated.
|
|
@@ -1498,19 +1448,19 @@ class Nr extends Error {
|
|
|
1498
1448
|
super(`Invalid Name "${e}": Router does not support multiple routes with the same name. All name names must be unique.`);
|
|
1499
1449
|
}
|
|
1500
1450
|
}
|
|
1501
|
-
function
|
|
1451
|
+
function Br(t) {
|
|
1502
1452
|
const e = t.map(({ name: n }) => n);
|
|
1503
1453
|
for (const n of e)
|
|
1504
1454
|
if (me(e, n) > 1)
|
|
1505
|
-
throw new
|
|
1455
|
+
throw new kr(n);
|
|
1506
1456
|
}
|
|
1507
1457
|
function Kr(t, e) {
|
|
1508
|
-
const n = hn(t) ? t.flat() : t, r =
|
|
1509
|
-
|
|
1458
|
+
const n = hn(t) ? t.flat() : t, r = xr(n, e == null ? void 0 : e.base);
|
|
1459
|
+
Br(r);
|
|
1510
1460
|
const o = Vr(), a = lr(r), s = Dn({
|
|
1511
1461
|
mode: e == null ? void 0 : e.historyMode,
|
|
1512
1462
|
listener: ({ location: R }) => {
|
|
1513
|
-
const L =
|
|
1463
|
+
const L = G(R);
|
|
1514
1464
|
A(L, { state: R.state });
|
|
1515
1465
|
}
|
|
1516
1466
|
}), { runBeforeRouteHooks: u, runAfterRouteHooks: c } = Jn(), {
|
|
@@ -1523,23 +1473,25 @@ function Kr(t, e) {
|
|
|
1523
1473
|
onAfterRouteLeave: E
|
|
1524
1474
|
} = Gn();
|
|
1525
1475
|
async function A(R, L = {}) {
|
|
1526
|
-
if (s.stopListening(),
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1476
|
+
if (s.stopListening(), $(R)) {
|
|
1477
|
+
s.update(R, L);
|
|
1478
|
+
return;
|
|
1479
|
+
}
|
|
1480
|
+
const O = Nt(r, R, L.state) ?? m("NotFound"), _ = { ...d }, K = await u({ to: O, from: _, hooks: f });
|
|
1481
|
+
switch (K.status) {
|
|
1530
1482
|
case "ABORT":
|
|
1531
1483
|
return;
|
|
1532
1484
|
case "PUSH":
|
|
1533
|
-
s.update(R, L), await k(...
|
|
1485
|
+
s.update(R, L), await k(...K.to);
|
|
1534
1486
|
return;
|
|
1535
1487
|
case "REJECT":
|
|
1536
|
-
s.update(R, L), b(
|
|
1488
|
+
s.update(R, L), b(K.type);
|
|
1537
1489
|
break;
|
|
1538
1490
|
case "SUCCESS":
|
|
1539
1491
|
s.update(R, L), b(null);
|
|
1540
1492
|
break;
|
|
1541
1493
|
default:
|
|
1542
|
-
throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(
|
|
1494
|
+
throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(K)}`);
|
|
1543
1495
|
}
|
|
1544
1496
|
o.setProps(O), P(O);
|
|
1545
1497
|
const I = await c({ to: O, from: _, hooks: f });
|
|
@@ -1563,36 +1515,38 @@ function Kr(t, e) {
|
|
|
1563
1515
|
const nt = { ...L }, Bt = a(R, nt);
|
|
1564
1516
|
return A(Bt, nt);
|
|
1565
1517
|
}
|
|
1566
|
-
const _ = { ...O }, I = a(R, L ?? {}, _), q =
|
|
1518
|
+
const _ = { ...O }, I = a(R, L ?? {}, _), q = zt(R), kt = ae((q == null ? void 0 : q.state) ?? {}, _.state);
|
|
1567
1519
|
return A(I, { ..._, state: kt });
|
|
1568
1520
|
}, j = (R, L, O) => {
|
|
1569
1521
|
if (W(R)) {
|
|
1570
1522
|
const nt = { ...L, replace: !0 }, Bt = a(R, nt);
|
|
1571
1523
|
return A(Bt, nt);
|
|
1572
1524
|
}
|
|
1573
|
-
const _ = { ...O, replace: !0 }, I = a(R, L ?? {}, _), q =
|
|
1525
|
+
const _ = { ...O, replace: !0 }, I = a(R, L ?? {}, _), q = zt(R), kt = ae((q == null ? void 0 : q.state) ?? {}, _.state);
|
|
1574
1526
|
return A(I, { ..._, state: kt });
|
|
1575
|
-
}, g = (R) =>
|
|
1527
|
+
}, g = (R) => {
|
|
1528
|
+
b(R);
|
|
1529
|
+
}, v = (R, L = {}) => {
|
|
1576
1530
|
if (!W(R)) {
|
|
1577
1531
|
const O = a(R, L);
|
|
1578
1532
|
return Nt(r, O);
|
|
1579
1533
|
}
|
|
1580
|
-
if (
|
|
1534
|
+
if (!$(R))
|
|
1581
1535
|
return Nt(r, R);
|
|
1582
1536
|
}, { setRejection: b, rejection: x, getRejectionRoute: m } = Yn(e ?? {}), l = m("NotFound"), { currentRoute: d, routerRoute: w, updateRoute: P } = _n(l, k);
|
|
1583
1537
|
s.startListening();
|
|
1584
|
-
const B = pr(e == null ? void 0 : e.initialUrl), N = s.location.state, { host:
|
|
1538
|
+
const B = pr(e == null ? void 0 : e.initialUrl), N = s.location.state, { host: C } = D(B), $ = Wn(C);
|
|
1585
1539
|
let xt = !1;
|
|
1586
|
-
async function
|
|
1540
|
+
async function Kt() {
|
|
1587
1541
|
xt || (await A(B, { replace: !0, state: N }), xt = !0);
|
|
1588
1542
|
}
|
|
1589
|
-
function
|
|
1543
|
+
function zt(R) {
|
|
1590
1544
|
return r.find((L) => L.name === R);
|
|
1591
1545
|
}
|
|
1592
1546
|
function ze(R) {
|
|
1593
|
-
R.component("RouterView", Ir), R.component("RouterLink", Tr), R.provide(be, x), R.provide(Be, f), R.provide(Fe, o), R.provide(Ae,
|
|
1547
|
+
R.component("RouterView", Ir), R.component("RouterLink", Tr), R.provide(be, x), R.provide(Be, f), R.provide(Fe, o), R.provide(Ae, Yt), Kt();
|
|
1594
1548
|
}
|
|
1595
|
-
const
|
|
1549
|
+
const Yt = {
|
|
1596
1550
|
route: w,
|
|
1597
1551
|
resolve: a,
|
|
1598
1552
|
push: k,
|
|
@@ -1604,7 +1558,7 @@ function Kr(t, e) {
|
|
|
1604
1558
|
back: s.back,
|
|
1605
1559
|
go: s.go,
|
|
1606
1560
|
install: ze,
|
|
1607
|
-
isExternal:
|
|
1561
|
+
isExternal: $,
|
|
1608
1562
|
onBeforeRouteEnter: i,
|
|
1609
1563
|
onAfterRouteUpdate: h,
|
|
1610
1564
|
onBeforeRouteLeave: y,
|
|
@@ -1612,33 +1566,85 @@ function Kr(t, e) {
|
|
|
1612
1566
|
onBeforeRouteUpdate: S,
|
|
1613
1567
|
onAfterRouteLeave: E,
|
|
1614
1568
|
prefetch: e == null ? void 0 : e.prefetch,
|
|
1615
|
-
start:
|
|
1569
|
+
start: Kt
|
|
1616
1570
|
};
|
|
1617
|
-
return
|
|
1571
|
+
return Yt;
|
|
1572
|
+
}
|
|
1573
|
+
function se(t, e) {
|
|
1574
|
+
return {
|
|
1575
|
+
value: t,
|
|
1576
|
+
params: It(t, e),
|
|
1577
|
+
toString: () => t
|
|
1578
|
+
};
|
|
1579
|
+
}
|
|
1580
|
+
function qe(t, e) {
|
|
1581
|
+
return {
|
|
1582
|
+
value: t,
|
|
1583
|
+
params: It(t, e),
|
|
1584
|
+
toString: () => t
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
1587
|
+
function Lr(t) {
|
|
1588
|
+
return ft(t) && typeof t.hash == "string";
|
|
1589
|
+
}
|
|
1590
|
+
function Me(t) {
|
|
1591
|
+
return t === void 0 ? mt() : Lr(t) ? t : mt(t);
|
|
1592
|
+
}
|
|
1593
|
+
function Ft(t) {
|
|
1594
|
+
return t === void 0 ? "" : t;
|
|
1595
|
+
}
|
|
1596
|
+
function Nr(t) {
|
|
1597
|
+
return ft(t) && typeof t.value == "string";
|
|
1598
|
+
}
|
|
1599
|
+
function We(t) {
|
|
1600
|
+
return t === void 0 ? Ct("", {}) : Nr(t) ? t : Ct(t, {});
|
|
1601
|
+
}
|
|
1602
|
+
function Ur(t) {
|
|
1603
|
+
return ft(t) && typeof t.value == "string";
|
|
1604
|
+
}
|
|
1605
|
+
function De(t) {
|
|
1606
|
+
return t === void 0 ? se("", {}) : Ur(t) ? t : se(t, {});
|
|
1607
|
+
}
|
|
1608
|
+
function tt(t) {
|
|
1609
|
+
const e = Wt(), n = Ft(t.name), r = We(t.path), o = De(t.query), a = Me(t.hash), s = t.meta ?? {}, u = Sn(t) ? t.state : {}, c = dt({ id: e, meta: {}, state: {}, ...t }), f = {
|
|
1610
|
+
id: e,
|
|
1611
|
+
matched: c,
|
|
1612
|
+
matches: [c],
|
|
1613
|
+
name: n,
|
|
1614
|
+
path: r,
|
|
1615
|
+
query: o,
|
|
1616
|
+
hash: a,
|
|
1617
|
+
meta: s,
|
|
1618
|
+
state: u,
|
|
1619
|
+
depth: 1,
|
|
1620
|
+
host: qe("", {}),
|
|
1621
|
+
prefetch: t.prefetch
|
|
1622
|
+
}, i = ge(t) ? Re(t.parent, f) : f;
|
|
1623
|
+
return et(i.path.params, i.query.params), i;
|
|
1618
1624
|
}
|
|
1619
|
-
const Et = { template: "<div>This is component</div>" },
|
|
1625
|
+
const Et = { template: "<div>This is component</div>" }, Jt = tt({
|
|
1620
1626
|
name: "parentA",
|
|
1621
1627
|
path: "/parentA/[paramA]"
|
|
1622
|
-
}), Te =
|
|
1623
|
-
parent:
|
|
1628
|
+
}), Te = tt({
|
|
1629
|
+
parent: Jt,
|
|
1624
1630
|
name: "parentA.childA",
|
|
1625
1631
|
path: "/[?paramB]"
|
|
1626
|
-
}),
|
|
1627
|
-
parent:
|
|
1632
|
+
}), $r = tt({
|
|
1633
|
+
parent: Jt,
|
|
1628
1634
|
name: "parentA.childB",
|
|
1629
1635
|
path: "/[paramD]",
|
|
1630
1636
|
component: Et
|
|
1631
|
-
}),
|
|
1637
|
+
}), Cr = tt({
|
|
1632
1638
|
parent: Te,
|
|
1633
1639
|
name: "parentA.childA.grandChildA",
|
|
1634
1640
|
path: "/[paramC]",
|
|
1635
1641
|
component: Et
|
|
1636
1642
|
});
|
|
1637
|
-
|
|
1643
|
+
tt({
|
|
1638
1644
|
name: "parentB",
|
|
1639
1645
|
path: "/parentB",
|
|
1640
1646
|
component: Et
|
|
1641
|
-
}),
|
|
1647
|
+
}), tt({
|
|
1642
1648
|
name: "parentC",
|
|
1643
1649
|
path: "/",
|
|
1644
1650
|
component: Et
|
|
@@ -1655,7 +1661,7 @@ function Ut(t, e) {
|
|
|
1655
1661
|
}
|
|
1656
1662
|
const Fe = Symbol();
|
|
1657
1663
|
function Vr() {
|
|
1658
|
-
const t =
|
|
1664
|
+
const t = Ht(/* @__PURE__ */ new Map()), e = (c, f) => c.matches.filter((i) => Ie({ ...f, routePrefetch: i.prefetch }, "props")).flatMap((i) => s(i)).reduce((i, { id: h, name: y, props: p }) => {
|
|
1659
1665
|
const S = a(h, y, c);
|
|
1660
1666
|
return i[S] = p == null ? void 0 : p(c.params), i;
|
|
1661
1667
|
}, {}), n = (c) => {
|
|
@@ -1679,7 +1685,7 @@ function Vr() {
|
|
|
1679
1685
|
return [c, f, i.id, JSON.stringify(i.params)].join("-");
|
|
1680
1686
|
}
|
|
1681
1687
|
function s(c) {
|
|
1682
|
-
return
|
|
1688
|
+
return jt(c) ? Object.entries(c.props ?? {}).map(([f, i]) => ({ id: c.id, name: f, props: i })) : Vt(c) ? [
|
|
1683
1689
|
{
|
|
1684
1690
|
id: c.id,
|
|
1685
1691
|
name: "default",
|
|
@@ -1727,19 +1733,19 @@ function _r(t, { routerPrefetch: e, linkPrefetch: n }) {
|
|
|
1727
1733
|
routePrefetch: r.prefetch,
|
|
1728
1734
|
routerPrefetch: e,
|
|
1729
1735
|
linkPrefetch: n
|
|
1730
|
-
}, "components") && (
|
|
1736
|
+
}, "components") && (Vt(r) && ce(r.component) && r.component.setup(), jt(r) && Object.values(r.components).forEach((a) => {
|
|
1731
1737
|
ce(a) && a.setup();
|
|
1732
1738
|
}));
|
|
1733
1739
|
});
|
|
1734
1740
|
}
|
|
1735
1741
|
function qr(t, e = {}, n = {}) {
|
|
1736
|
-
const r =
|
|
1742
|
+
const r = Ot(), o = en(t), a = V(() => W(o.value) ? {} : ht(e)), s = V(() => W(o.value) ? ht(e) : ht(n)), u = V(() => {
|
|
1737
1743
|
if (W(o.value))
|
|
1738
1744
|
return o.value;
|
|
1739
1745
|
try {
|
|
1740
1746
|
return r.resolve(o.value, a.value, s.value);
|
|
1741
1747
|
} catch (E) {
|
|
1742
|
-
throw E instanceof
|
|
1748
|
+
throw E instanceof Y && console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`, E), E;
|
|
1743
1749
|
}
|
|
1744
1750
|
}), c = V(() => r.find(u.value, s.value)), f = V(() => !!c.value && r.route.matches.includes(c.value.matched)), i = V(() => !!c.value && r.route.matched === c.value.matched), h = V(() => r.isExternal(u.value)), { commit: y } = Or(() => ({
|
|
1745
1751
|
route: c.value,
|
|
@@ -1761,7 +1767,7 @@ function Mr(t, e, { exact: n } = {}) {
|
|
|
1761
1767
|
return !1;
|
|
1762
1768
|
if (e === void 0)
|
|
1763
1769
|
return !0;
|
|
1764
|
-
const r = t.matches.map((o) =>
|
|
1770
|
+
const r = t.matches.map((o) => Ft(o.name));
|
|
1765
1771
|
if (n) {
|
|
1766
1772
|
const o = r.at(-1);
|
|
1767
1773
|
return e === o;
|
|
@@ -1769,7 +1775,7 @@ function Mr(t, e, { exact: n } = {}) {
|
|
|
1769
1775
|
return r.includes(e);
|
|
1770
1776
|
}
|
|
1771
1777
|
function Wr(t, e) {
|
|
1772
|
-
const n =
|
|
1778
|
+
const n = Ot();
|
|
1773
1779
|
function r() {
|
|
1774
1780
|
if (!t)
|
|
1775
1781
|
return;
|
|
@@ -1779,7 +1785,7 @@ function Wr(t, e) {
|
|
|
1779
1785
|
return fe(n.route, r, { immediate: !0, deep: !0 }), n.route;
|
|
1780
1786
|
}
|
|
1781
1787
|
const Qe = Symbol();
|
|
1782
|
-
function
|
|
1788
|
+
function Qt() {
|
|
1783
1789
|
return it(Qe, 0);
|
|
1784
1790
|
}
|
|
1785
1791
|
function Ge() {
|
|
@@ -1790,17 +1796,17 @@ function Ge() {
|
|
|
1790
1796
|
}
|
|
1791
1797
|
function Ke(t) {
|
|
1792
1798
|
return (e) => {
|
|
1793
|
-
const n =
|
|
1799
|
+
const n = Qt(), o = Ge().addBeforeRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
|
|
1794
1800
|
return le(o), o;
|
|
1795
1801
|
};
|
|
1796
1802
|
}
|
|
1797
|
-
function
|
|
1803
|
+
function Gt(t) {
|
|
1798
1804
|
return (e) => {
|
|
1799
|
-
const n =
|
|
1805
|
+
const n = Qt(), o = Ge().addAfterRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
|
|
1800
1806
|
return le(o), o;
|
|
1801
1807
|
};
|
|
1802
1808
|
}
|
|
1803
|
-
const zr = Ke("onBeforeRouteUpdate"), Yr = Ke("onBeforeRouteLeave"), Xr =
|
|
1809
|
+
const zr = Ke("onBeforeRouteUpdate"), Yr = Ke("onBeforeRouteLeave"), Xr = Gt("onAfterRouteEnter"), Zr = Gt("onAfterRouteUpdate"), to = Gt("onAfterRouteLeave"), Dr = ["href"], Tr = /* @__PURE__ */ ut({
|
|
1804
1810
|
__name: "routerLink",
|
|
1805
1811
|
props: {
|
|
1806
1812
|
to: {},
|
|
@@ -1811,7 +1817,7 @@ const zr = Ke("onBeforeRouteUpdate"), Yr = Ke("onBeforeRouteLeave"), Xr = Qt("on
|
|
|
1811
1817
|
state: {}
|
|
1812
1818
|
},
|
|
1813
1819
|
setup(t) {
|
|
1814
|
-
const e = t, n =
|
|
1820
|
+
const e = t, n = Ot(), r = V(() => W(e.to) ? e.to : e.to(n.resolve)), o = V(() => {
|
|
1815
1821
|
const { to: h, ...y } = e;
|
|
1816
1822
|
return y;
|
|
1817
1823
|
}), { isMatch: a, isExactMatch: s, isExternal: u, push: c } = qr(r, o), f = V(() => ({
|
|
@@ -1835,7 +1841,7 @@ const zr = Ke("onBeforeRouteUpdate"), Yr = Ke("onBeforeRouteLeave"), Xr = Qt("on
|
|
|
1835
1841
|
name: {}
|
|
1836
1842
|
},
|
|
1837
1843
|
setup(t) {
|
|
1838
|
-
const { name: e = "default" } = t, n = Wr(), r = Vn(), o =
|
|
1844
|
+
const { name: e = "default" } = t, n = Wr(), r = Vn(), o = Qt(), { getProps: a } = Je(), s = an("RouterView", !0);
|
|
1839
1845
|
sn(Qe, o + 1);
|
|
1840
1846
|
const u = V(() => {
|
|
1841
1847
|
if (r.value)
|
|
@@ -1850,7 +1856,7 @@ const zr = Ke("onBeforeRouteUpdate"), Yr = Ke("onBeforeRouteLeave"), Xr = Qt("on
|
|
|
1850
1856
|
return f(i)[e];
|
|
1851
1857
|
}
|
|
1852
1858
|
function f(i) {
|
|
1853
|
-
return
|
|
1859
|
+
return jt(i) ? i.components : Vt(i) ? { default: i.component } : typeof s == "string" ? {} : { default: s };
|
|
1854
1860
|
}
|
|
1855
1861
|
return (i, h) => u.value ? pe(i.$slots, "default", de(cn({ key: 0 }, { route: ot(n), component: u.value, rejection: ot(r) })), () => [
|
|
1856
1862
|
(he(), un(fn(u.value)))
|
|
@@ -1864,7 +1870,7 @@ function ue(t) {
|
|
|
1864
1870
|
return Fr(t) ? t : qe(t, {});
|
|
1865
1871
|
}
|
|
1866
1872
|
function eo(t) {
|
|
1867
|
-
const e =
|
|
1873
|
+
const e = Wt(), n = Ft(t.name), r = We(t.path), o = De(t.query), a = Me(t.hash), s = t.meta ?? {}, u = En(t) ? ue(t.host) : ue(""), c = dt({ id: e, meta: {}, state: {}, ...t }), f = {
|
|
1868
1874
|
id: e,
|
|
1869
1875
|
matched: c,
|
|
1870
1876
|
matches: [c],
|
|
@@ -1888,22 +1894,23 @@ export {
|
|
|
1888
1894
|
bn as component,
|
|
1889
1895
|
eo as createExternalRoute,
|
|
1890
1896
|
Un as createParam,
|
|
1891
|
-
|
|
1897
|
+
tt as createRoute,
|
|
1892
1898
|
Kr as createRouter,
|
|
1893
1899
|
Bn as isParamWithDefault,
|
|
1894
1900
|
Mr as isRoute,
|
|
1901
|
+
W as isUrl,
|
|
1895
1902
|
Xr as onAfterRouteEnter,
|
|
1896
1903
|
Zr as onAfterRouteLeave,
|
|
1897
1904
|
to as onAfterRouteUpdate,
|
|
1898
1905
|
zr as onBeforeRouteLeave,
|
|
1899
1906
|
Yr as onBeforeRouteUpdate,
|
|
1900
|
-
|
|
1907
|
+
Ct as path,
|
|
1901
1908
|
se as query,
|
|
1902
1909
|
Ae as routerInjectionKey,
|
|
1903
1910
|
be as routerRejectionKey,
|
|
1904
1911
|
qr as useLink,
|
|
1905
1912
|
Vn as useRejection,
|
|
1906
1913
|
Wr as useRoute,
|
|
1907
|
-
|
|
1914
|
+
Ot as useRouter,
|
|
1908
1915
|
Gr as withDefault
|
|
1909
1916
|
};
|