@kitbag/router 0.11.1 → 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.js +220 -220
- 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 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
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
|
|
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
|
|
@@ -851,7 +851,7 @@ function Dn({ mode: t, listener: e }) {
|
|
|
851
851
|
}
|
|
852
852
|
n.push(c, f == null ? void 0 : f.state);
|
|
853
853
|
}, o = () => {
|
|
854
|
-
const c =
|
|
854
|
+
const c = G(n.location);
|
|
855
855
|
n.replace(c);
|
|
856
856
|
};
|
|
857
857
|
let a;
|
|
@@ -870,13 +870,13 @@ function Dn({ mode: t, listener: e }) {
|
|
|
870
870
|
function Tn(t = "auto") {
|
|
871
871
|
switch (t) {
|
|
872
872
|
case "auto":
|
|
873
|
-
return ye() ?
|
|
873
|
+
return ye() ? Xt() : Zt();
|
|
874
874
|
case "browser":
|
|
875
|
-
return Yt();
|
|
876
|
-
case "memory":
|
|
877
875
|
return Xt();
|
|
876
|
+
case "memory":
|
|
877
|
+
return Zt();
|
|
878
878
|
case "hash":
|
|
879
|
-
return
|
|
879
|
+
return Cn();
|
|
880
880
|
default:
|
|
881
881
|
const e = t;
|
|
882
882
|
throw new Error(`Switch is not exhaustive for mode: ${e}`);
|
|
@@ -892,7 +892,7 @@ class vt {
|
|
|
892
892
|
M(this, "onAfterRouteLeave", /* @__PURE__ */ new Set());
|
|
893
893
|
}
|
|
894
894
|
}
|
|
895
|
-
class
|
|
895
|
+
class ee extends Error {
|
|
896
896
|
}
|
|
897
897
|
class rt extends Error {
|
|
898
898
|
constructor(n) {
|
|
@@ -911,17 +911,17 @@ class Lt extends Error {
|
|
|
911
911
|
function In(t, e) {
|
|
912
912
|
const n = new vt();
|
|
913
913
|
return t.matches.forEach((r, o) => {
|
|
914
|
-
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));
|
|
915
915
|
}), e.matches.forEach((r, o) => {
|
|
916
|
-
r.onBeforeRouteLeave &&
|
|
916
|
+
r.onBeforeRouteLeave && qt(t, e, o) && z(r.onBeforeRouteLeave).forEach((a) => n.onBeforeRouteLeave.add(a));
|
|
917
917
|
}), n;
|
|
918
918
|
}
|
|
919
919
|
function Fn(t, e) {
|
|
920
920
|
const n = new vt();
|
|
921
921
|
return t.matches.forEach((r, o) => {
|
|
922
|
-
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));
|
|
923
923
|
}), e.matches.forEach((r, o) => {
|
|
924
|
-
r.onAfterRouteLeave &&
|
|
924
|
+
r.onAfterRouteLeave && qt(t, e, o) && z(r.onAfterRouteLeave).forEach((a) => n.onAfterRouteLeave.add(a));
|
|
925
925
|
}), n;
|
|
926
926
|
}
|
|
927
927
|
function W(t) {
|
|
@@ -940,7 +940,7 @@ function Jn() {
|
|
|
940
940
|
const f = u, i = c ?? {};
|
|
941
941
|
throw new rt([s, f, { ...i, replace: !0 }]);
|
|
942
942
|
}, r = () => {
|
|
943
|
-
throw new
|
|
943
|
+
throw new ee();
|
|
944
944
|
};
|
|
945
945
|
async function o({ to: s, from: u, hooks: c }) {
|
|
946
946
|
const { global: f, component: i } = c, h = In(s, u), y = [
|
|
@@ -973,7 +973,7 @@ function Jn() {
|
|
|
973
973
|
status: "REJECT",
|
|
974
974
|
type: p.type
|
|
975
975
|
};
|
|
976
|
-
if (p instanceof
|
|
976
|
+
if (p instanceof ee)
|
|
977
977
|
return {
|
|
978
978
|
status: "ABORT"
|
|
979
979
|
};
|
|
@@ -1025,24 +1025,24 @@ function Jn() {
|
|
|
1025
1025
|
runAfterRouteHooks: a
|
|
1026
1026
|
};
|
|
1027
1027
|
}
|
|
1028
|
-
const
|
|
1028
|
+
const _t = (t, e, n) => {
|
|
1029
1029
|
const r = t.matches, o = (e == null ? void 0 : e.matches) ?? [];
|
|
1030
1030
|
return r.length < n || r[n] !== o[n];
|
|
1031
|
-
},
|
|
1031
|
+
}, qt = (t, e, n) => {
|
|
1032
1032
|
const r = t.matches, o = (e == null ? void 0 : e.matches) ?? [];
|
|
1033
1033
|
return r.length < n || r[n] !== o[n];
|
|
1034
|
-
},
|
|
1035
|
-
function
|
|
1034
|
+
}, Mt = (t, e, n) => t.matches[n] === (e == null ? void 0 : e.matches[n]);
|
|
1035
|
+
function ne(t) {
|
|
1036
1036
|
switch (t) {
|
|
1037
1037
|
case "onBeforeRouteEnter":
|
|
1038
1038
|
case "onAfterRouteEnter":
|
|
1039
|
-
return
|
|
1039
|
+
return _t;
|
|
1040
1040
|
case "onBeforeRouteUpdate":
|
|
1041
1041
|
case "onAfterRouteUpdate":
|
|
1042
|
-
return
|
|
1042
|
+
return Mt;
|
|
1043
1043
|
case "onBeforeRouteLeave":
|
|
1044
1044
|
case "onAfterRouteLeave":
|
|
1045
|
-
return
|
|
1045
|
+
return qt;
|
|
1046
1046
|
default:
|
|
1047
1047
|
throw new Error(`Switch is not exhaustive for lifecycle: ${t}`);
|
|
1048
1048
|
}
|
|
@@ -1053,14 +1053,14 @@ function Qn() {
|
|
|
1053
1053
|
component: new vt()
|
|
1054
1054
|
};
|
|
1055
1055
|
function e({ lifecycle: r, timing: o, depth: a, hook: s }) {
|
|
1056
|
-
const u =
|
|
1056
|
+
const u = ne(r), c = t[o][r], f = (i, h) => {
|
|
1057
1057
|
if (u(i, h.from, a))
|
|
1058
1058
|
return s(i, h);
|
|
1059
1059
|
};
|
|
1060
1060
|
return c.add(f), () => c.delete(f);
|
|
1061
1061
|
}
|
|
1062
1062
|
function n({ lifecycle: r, timing: o, depth: a, hook: s }) {
|
|
1063
|
-
const u =
|
|
1063
|
+
const u = ne(r), c = t[o][r], f = (i, h) => {
|
|
1064
1064
|
if (u(i, h.from, a))
|
|
1065
1065
|
return s(i, h);
|
|
1066
1066
|
};
|
|
@@ -1098,7 +1098,7 @@ function zn() {
|
|
|
1098
1098
|
let t = 0;
|
|
1099
1099
|
return () => (++t).toString();
|
|
1100
1100
|
}
|
|
1101
|
-
const
|
|
1101
|
+
const Wt = zn();
|
|
1102
1102
|
function Yn({
|
|
1103
1103
|
rejections: t
|
|
1104
1104
|
}) {
|
|
@@ -1109,7 +1109,7 @@ function Yn({
|
|
|
1109
1109
|
return dt(s[a] ?? Kn(a));
|
|
1110
1110
|
}, n = (a) => {
|
|
1111
1111
|
const s = dt(e(a)), u = {
|
|
1112
|
-
id:
|
|
1112
|
+
id: Wt(),
|
|
1113
1113
|
name: a,
|
|
1114
1114
|
component: s,
|
|
1115
1115
|
meta: {},
|
|
@@ -1144,7 +1144,7 @@ class Xn extends Error {
|
|
|
1144
1144
|
super(`Route not found: "${e}"`);
|
|
1145
1145
|
}
|
|
1146
1146
|
}
|
|
1147
|
-
function
|
|
1147
|
+
function Dt(t) {
|
|
1148
1148
|
return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1149
1149
|
}
|
|
1150
1150
|
function Zn(t, e) {
|
|
@@ -1153,7 +1153,7 @@ function Zn(t, e) {
|
|
|
1153
1153
|
return [t];
|
|
1154
1154
|
let r = 0;
|
|
1155
1155
|
const o = n.reduce((s, u) => {
|
|
1156
|
-
const c =
|
|
1156
|
+
const c = Dt(t.slice(r, u.index));
|
|
1157
1157
|
c.length && s.push(c);
|
|
1158
1158
|
const [f] = u;
|
|
1159
1159
|
return s.push(f), r = u.index + f.length, s;
|
|
@@ -1166,13 +1166,13 @@ function tr(t) {
|
|
|
1166
1166
|
}
|
|
1167
1167
|
function er(t) {
|
|
1168
1168
|
const e = new URLSearchParams(t.query.toString());
|
|
1169
|
-
return Array.from(e.entries()).filter(([, n]) =>
|
|
1169
|
+
return Array.from(e.entries()).filter(([, n]) => !$t(n)).map(([n, r]) => {
|
|
1170
1170
|
const o = Ne(r);
|
|
1171
|
-
return new RegExp(`${
|
|
1171
|
+
return new RegExp(`${Dt(n)}=${o}(&|$)`, "i");
|
|
1172
1172
|
});
|
|
1173
1173
|
}
|
|
1174
1174
|
function Ne(t) {
|
|
1175
|
-
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("");
|
|
1176
1176
|
}
|
|
1177
1177
|
function Ue(t) {
|
|
1178
1178
|
return [
|
|
@@ -1180,24 +1180,24 @@ function Ue(t) {
|
|
|
1180
1180
|
or
|
|
1181
1181
|
].reduce((e, n) => n(e), t);
|
|
1182
1182
|
}
|
|
1183
|
-
const nr = `\\${T}\\??([\\w-_]+)\\${
|
|
1183
|
+
const nr = `\\${T}\\??([\\w-_]+)\\${J}`, Tt = `\\${T}\\?([\\w-_]+)\\${J}`, $e = `\\${T}([\\w-_]+)\\${J}`;
|
|
1184
1184
|
function rr(t) {
|
|
1185
|
-
return t.replace(new RegExp(
|
|
1185
|
+
return t.replace(new RegExp(Tt, "g"), ".*");
|
|
1186
1186
|
}
|
|
1187
|
-
function
|
|
1188
|
-
return new RegExp(
|
|
1187
|
+
function $t(t) {
|
|
1188
|
+
return new RegExp(Tt, "g").test(t);
|
|
1189
1189
|
}
|
|
1190
1190
|
function or(t) {
|
|
1191
|
-
return t.replace(new RegExp(
|
|
1191
|
+
return t.replace(new RegExp($e, "g"), ".+");
|
|
1192
1192
|
}
|
|
1193
1193
|
function At(t) {
|
|
1194
|
-
const [e] = wt(t, new RegExp(
|
|
1194
|
+
const [e] = wt(t, new RegExp(Tt, "g")), [n] = wt(t, new RegExp($e, "g"));
|
|
1195
1195
|
return e ?? n;
|
|
1196
1196
|
}
|
|
1197
1197
|
function wt(t, e) {
|
|
1198
1198
|
return Array.from(t.matchAll(e)).flatMap(([, ...r]) => r.map((o) => lt(o) ? o : ""));
|
|
1199
1199
|
}
|
|
1200
|
-
function
|
|
1200
|
+
function Ce(t, e, n) {
|
|
1201
1201
|
const r = Ve(e, n), [o] = wt(t, r);
|
|
1202
1202
|
return o;
|
|
1203
1203
|
}
|
|
@@ -1218,13 +1218,13 @@ function Ve(t, e) {
|
|
|
1218
1218
|
function ar(t, e) {
|
|
1219
1219
|
if (!e.startsWith("?"))
|
|
1220
1220
|
return t;
|
|
1221
|
-
const n = new RegExp(`\\${T}\\${e}\\${
|
|
1221
|
+
const n = new RegExp(`\\${T}\\${e}\\${J}`, "g");
|
|
1222
1222
|
return t.replace(n, "(.*)");
|
|
1223
1223
|
}
|
|
1224
1224
|
function sr(t, e) {
|
|
1225
1225
|
if (e.startsWith("?"))
|
|
1226
1226
|
return t;
|
|
1227
|
-
const n = new RegExp(`\\${T}${e}\\${
|
|
1227
|
+
const n = new RegExp(`\\${T}${e}\\${J}`, "g");
|
|
1228
1228
|
return t.replace(n, "(.+)");
|
|
1229
1229
|
}
|
|
1230
1230
|
function je(t, ...e) {
|
|
@@ -1242,14 +1242,14 @@ function cr(t, e = {}) {
|
|
|
1242
1242
|
function ur(t, e) {
|
|
1243
1243
|
const n = t.toString();
|
|
1244
1244
|
return Object.entries(t.params).reduce((r, [o, a]) => {
|
|
1245
|
-
const s = At(`${T}${o}${
|
|
1245
|
+
const s = At(`${T}${o}${J}`);
|
|
1246
1246
|
return s ? He(r, { name: o, param: a, value: e[s] }) : r;
|
|
1247
1247
|
}, n);
|
|
1248
1248
|
}
|
|
1249
1249
|
function ir(t, e) {
|
|
1250
1250
|
const n = t.toString();
|
|
1251
1251
|
return Object.entries(t.params).reduce((r, [o, a]) => {
|
|
1252
|
-
const s = At(`${T}${o}${
|
|
1252
|
+
const s = At(`${T}${o}${J}`);
|
|
1253
1253
|
return s ? He(r, { name: o, param: a, value: e[s] }) : r;
|
|
1254
1254
|
}, n);
|
|
1255
1255
|
}
|
|
@@ -1262,8 +1262,8 @@ function fr(t, e) {
|
|
|
1262
1262
|
const u = At(s);
|
|
1263
1263
|
if (!u)
|
|
1264
1264
|
return { ...o, [a]: s };
|
|
1265
|
-
const f = st(e[u], t.params[u],
|
|
1266
|
-
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 };
|
|
1267
1267
|
}, {});
|
|
1268
1268
|
}
|
|
1269
1269
|
function lr(t) {
|
|
@@ -1309,7 +1309,7 @@ const dr = (t, e) => {
|
|
|
1309
1309
|
function mr(t, e) {
|
|
1310
1310
|
const n = {}, r = decodeURIComponent(e);
|
|
1311
1311
|
for (const [o, a] of Object.entries(t.params)) {
|
|
1312
|
-
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);
|
|
1313
1313
|
n[u] = f;
|
|
1314
1314
|
}
|
|
1315
1315
|
return n;
|
|
@@ -1335,7 +1335,7 @@ const Rr = (t) => "name" in t.matched && !!t.matched.name, yr = (t, e) => {
|
|
|
1335
1335
|
function Pr(t) {
|
|
1336
1336
|
const { searchParams: e, pathname: n } = D(t), r = -1, o = 1;
|
|
1337
1337
|
return (a, s) => {
|
|
1338
|
-
const u =
|
|
1338
|
+
const u = oe(a, e), c = re(a, n), f = oe(s, e), i = re(s, n);
|
|
1339
1339
|
if (a.depth > s.depth)
|
|
1340
1340
|
return r;
|
|
1341
1341
|
if (a.depth < s.depth)
|
|
@@ -1348,11 +1348,11 @@ function Pr(t) {
|
|
|
1348
1348
|
return a.hash.toString() === h ? r : s.hash.toString() === h ? o : 0;
|
|
1349
1349
|
};
|
|
1350
1350
|
}
|
|
1351
|
-
function
|
|
1352
|
-
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);
|
|
1353
1353
|
return n.length - r.length;
|
|
1354
1354
|
}
|
|
1355
|
-
function
|
|
1355
|
+
function oe(t, e) {
|
|
1356
1356
|
const n = new URLSearchParams(t.query.toString()), r = Array.from(n.keys()), o = r.filter((a) => !e.has(a));
|
|
1357
1357
|
return r.length - o.length;
|
|
1358
1358
|
}
|
|
@@ -1383,7 +1383,7 @@ function br(t, e, n) {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
return st(void 0, n, Pt);
|
|
1385
1385
|
}
|
|
1386
|
-
const
|
|
1386
|
+
const ae = (t, e) => {
|
|
1387
1387
|
const n = {};
|
|
1388
1388
|
for (const [r, o] of Object.entries(t)) {
|
|
1389
1389
|
const a = br(e, r, o);
|
|
@@ -1413,8 +1413,8 @@ function Nt(t, e, n) {
|
|
|
1413
1413
|
hash: u
|
|
1414
1414
|
};
|
|
1415
1415
|
}
|
|
1416
|
-
function
|
|
1417
|
-
const n = new RegExp(`\\${T}(\\??[\\w-_]+)\\${
|
|
1416
|
+
function It(t, e) {
|
|
1417
|
+
const n = new RegExp(`\\${T}(\\??[\\w-_]+)\\${J}`, "g");
|
|
1418
1418
|
return Array.from(t.matchAll(n)).reduce((o, [a, s]) => {
|
|
1419
1419
|
const u = At(a);
|
|
1420
1420
|
if (!u)
|
|
@@ -1423,75 +1423,23 @@ function Tt(t, e) {
|
|
|
1423
1423
|
return et([u], o), o[s] = c, o;
|
|
1424
1424
|
}, {});
|
|
1425
1425
|
}
|
|
1426
|
-
function
|
|
1426
|
+
function Ct(t, e) {
|
|
1427
1427
|
return {
|
|
1428
1428
|
value: t,
|
|
1429
|
-
params:
|
|
1429
|
+
params: It(t, e),
|
|
1430
1430
|
toString: () => t
|
|
1431
1431
|
};
|
|
1432
1432
|
}
|
|
1433
|
-
function xr(t) {
|
|
1434
|
-
return
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
}
|
|
1442
|
-
function ae(t, e) {
|
|
1443
|
-
return {
|
|
1444
|
-
value: t,
|
|
1445
|
-
params: Tt(t, e),
|
|
1446
|
-
toString: () => t
|
|
1447
|
-
};
|
|
1448
|
-
}
|
|
1449
|
-
function kr(t) {
|
|
1450
|
-
return ft(t) && typeof t.value == "string";
|
|
1451
|
-
}
|
|
1452
|
-
function We(t) {
|
|
1453
|
-
return t === void 0 ? ae("", {}) : kr(t) ? t : ae(t, {});
|
|
1454
|
-
}
|
|
1455
|
-
function se(t, e) {
|
|
1456
|
-
return {
|
|
1457
|
-
value: t,
|
|
1458
|
-
params: Tt(t, e),
|
|
1459
|
-
toString: () => t
|
|
1460
|
-
};
|
|
1461
|
-
}
|
|
1462
|
-
function Br(t) {
|
|
1463
|
-
return ft(t) && typeof t.value == "string";
|
|
1464
|
-
}
|
|
1465
|
-
function De(t) {
|
|
1466
|
-
return t === void 0 ? se("", {}) : Br(t) ? t : se(t, {});
|
|
1467
|
-
}
|
|
1468
|
-
function J(t) {
|
|
1469
|
-
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 = {
|
|
1470
|
-
id: e,
|
|
1471
|
-
matched: c,
|
|
1472
|
-
matches: [c],
|
|
1473
|
-
name: n,
|
|
1474
|
-
path: r,
|
|
1475
|
-
query: o,
|
|
1476
|
-
hash: a,
|
|
1477
|
-
meta: s,
|
|
1478
|
-
state: u,
|
|
1479
|
-
depth: 1,
|
|
1480
|
-
host: qe("", {}),
|
|
1481
|
-
prefetch: t.prefetch
|
|
1482
|
-
}, i = ge(t) ? Re(t.parent, f) : f;
|
|
1483
|
-
return et(i.path.params, i.query.params), i;
|
|
1484
|
-
}
|
|
1485
|
-
function Lr(t, e) {
|
|
1486
|
-
if (!lt(e))
|
|
1487
|
-
return t;
|
|
1488
|
-
const n = J({ path: e });
|
|
1489
|
-
return t.map((r) => J({
|
|
1490
|
-
parent: n,
|
|
1491
|
-
...r
|
|
1492
|
-
}));
|
|
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;
|
|
1493
1441
|
}
|
|
1494
|
-
class
|
|
1442
|
+
class kr extends Error {
|
|
1495
1443
|
/**
|
|
1496
1444
|
* Constructs a new DuplicateNamesError instance with a message indicating the problematic name.
|
|
1497
1445
|
* @param name - The name of the name that was duplicated.
|
|
@@ -1500,19 +1448,19 @@ class Nr extends Error {
|
|
|
1500
1448
|
super(`Invalid Name "${e}": Router does not support multiple routes with the same name. All name names must be unique.`);
|
|
1501
1449
|
}
|
|
1502
1450
|
}
|
|
1503
|
-
function
|
|
1451
|
+
function Br(t) {
|
|
1504
1452
|
const e = t.map(({ name: n }) => n);
|
|
1505
1453
|
for (const n of e)
|
|
1506
1454
|
if (me(e, n) > 1)
|
|
1507
|
-
throw new
|
|
1455
|
+
throw new kr(n);
|
|
1508
1456
|
}
|
|
1509
1457
|
function Kr(t, e) {
|
|
1510
|
-
const n = hn(t) ? t.flat() : t, r =
|
|
1511
|
-
|
|
1458
|
+
const n = hn(t) ? t.flat() : t, r = xr(n, e == null ? void 0 : e.base);
|
|
1459
|
+
Br(r);
|
|
1512
1460
|
const o = Vr(), a = lr(r), s = Dn({
|
|
1513
1461
|
mode: e == null ? void 0 : e.historyMode,
|
|
1514
1462
|
listener: ({ location: R }) => {
|
|
1515
|
-
const L =
|
|
1463
|
+
const L = G(R);
|
|
1516
1464
|
A(L, { state: R.state });
|
|
1517
1465
|
}
|
|
1518
1466
|
}), { runBeforeRouteHooks: u, runAfterRouteHooks: c } = Jn(), {
|
|
@@ -1525,25 +1473,25 @@ function Kr(t, e) {
|
|
|
1525
1473
|
onAfterRouteLeave: E
|
|
1526
1474
|
} = Gn();
|
|
1527
1475
|
async function A(R, L = {}) {
|
|
1528
|
-
if (s.stopListening(),
|
|
1476
|
+
if (s.stopListening(), $(R)) {
|
|
1529
1477
|
s.update(R, L);
|
|
1530
1478
|
return;
|
|
1531
1479
|
}
|
|
1532
|
-
const O = Nt(r, R, L.state) ?? m("NotFound"), _ = { ...d },
|
|
1533
|
-
switch (
|
|
1480
|
+
const O = Nt(r, R, L.state) ?? m("NotFound"), _ = { ...d }, K = await u({ to: O, from: _, hooks: f });
|
|
1481
|
+
switch (K.status) {
|
|
1534
1482
|
case "ABORT":
|
|
1535
1483
|
return;
|
|
1536
1484
|
case "PUSH":
|
|
1537
|
-
s.update(R, L), await k(...
|
|
1485
|
+
s.update(R, L), await k(...K.to);
|
|
1538
1486
|
return;
|
|
1539
1487
|
case "REJECT":
|
|
1540
|
-
s.update(R, L), b(
|
|
1488
|
+
s.update(R, L), b(K.type);
|
|
1541
1489
|
break;
|
|
1542
1490
|
case "SUCCESS":
|
|
1543
1491
|
s.update(R, L), b(null);
|
|
1544
1492
|
break;
|
|
1545
1493
|
default:
|
|
1546
|
-
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)}`);
|
|
1547
1495
|
}
|
|
1548
1496
|
o.setProps(O), P(O);
|
|
1549
1497
|
const I = await c({ to: O, from: _, hooks: f });
|
|
@@ -1567,14 +1515,14 @@ function Kr(t, e) {
|
|
|
1567
1515
|
const nt = { ...L }, Bt = a(R, nt);
|
|
1568
1516
|
return A(Bt, nt);
|
|
1569
1517
|
}
|
|
1570
|
-
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);
|
|
1571
1519
|
return A(I, { ..._, state: kt });
|
|
1572
1520
|
}, j = (R, L, O) => {
|
|
1573
1521
|
if (W(R)) {
|
|
1574
1522
|
const nt = { ...L, replace: !0 }, Bt = a(R, nt);
|
|
1575
1523
|
return A(Bt, nt);
|
|
1576
1524
|
}
|
|
1577
|
-
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);
|
|
1578
1526
|
return A(I, { ..._, state: kt });
|
|
1579
1527
|
}, g = (R) => {
|
|
1580
1528
|
b(R);
|
|
@@ -1583,22 +1531,22 @@ function Kr(t, e) {
|
|
|
1583
1531
|
const O = a(R, L);
|
|
1584
1532
|
return Nt(r, O);
|
|
1585
1533
|
}
|
|
1586
|
-
if (
|
|
1534
|
+
if (!$(R))
|
|
1587
1535
|
return Nt(r, R);
|
|
1588
1536
|
}, { setRejection: b, rejection: x, getRejectionRoute: m } = Yn(e ?? {}), l = m("NotFound"), { currentRoute: d, routerRoute: w, updateRoute: P } = _n(l, k);
|
|
1589
1537
|
s.startListening();
|
|
1590
|
-
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);
|
|
1591
1539
|
let xt = !1;
|
|
1592
|
-
async function
|
|
1540
|
+
async function Kt() {
|
|
1593
1541
|
xt || (await A(B, { replace: !0, state: N }), xt = !0);
|
|
1594
1542
|
}
|
|
1595
|
-
function
|
|
1543
|
+
function zt(R) {
|
|
1596
1544
|
return r.find((L) => L.name === R);
|
|
1597
1545
|
}
|
|
1598
1546
|
function ze(R) {
|
|
1599
|
-
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();
|
|
1600
1548
|
}
|
|
1601
|
-
const
|
|
1549
|
+
const Yt = {
|
|
1602
1550
|
route: w,
|
|
1603
1551
|
resolve: a,
|
|
1604
1552
|
push: k,
|
|
@@ -1610,7 +1558,7 @@ function Kr(t, e) {
|
|
|
1610
1558
|
back: s.back,
|
|
1611
1559
|
go: s.go,
|
|
1612
1560
|
install: ze,
|
|
1613
|
-
isExternal:
|
|
1561
|
+
isExternal: $,
|
|
1614
1562
|
onBeforeRouteEnter: i,
|
|
1615
1563
|
onAfterRouteUpdate: h,
|
|
1616
1564
|
onBeforeRouteLeave: y,
|
|
@@ -1618,33 +1566,85 @@ function Kr(t, e) {
|
|
|
1618
1566
|
onBeforeRouteUpdate: S,
|
|
1619
1567
|
onAfterRouteLeave: E,
|
|
1620
1568
|
prefetch: e == null ? void 0 : e.prefetch,
|
|
1621
|
-
start:
|
|
1569
|
+
start: Kt
|
|
1570
|
+
};
|
|
1571
|
+
return Yt;
|
|
1572
|
+
}
|
|
1573
|
+
function se(t, e) {
|
|
1574
|
+
return {
|
|
1575
|
+
value: t,
|
|
1576
|
+
params: It(t, e),
|
|
1577
|
+
toString: () => t
|
|
1622
1578
|
};
|
|
1623
|
-
return zt;
|
|
1624
1579
|
}
|
|
1625
|
-
|
|
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;
|
|
1624
|
+
}
|
|
1625
|
+
const Et = { template: "<div>This is component</div>" }, Jt = tt({
|
|
1626
1626
|
name: "parentA",
|
|
1627
1627
|
path: "/parentA/[paramA]"
|
|
1628
|
-
}), Te =
|
|
1629
|
-
parent:
|
|
1628
|
+
}), Te = tt({
|
|
1629
|
+
parent: Jt,
|
|
1630
1630
|
name: "parentA.childA",
|
|
1631
1631
|
path: "/[?paramB]"
|
|
1632
|
-
}),
|
|
1633
|
-
parent:
|
|
1632
|
+
}), $r = tt({
|
|
1633
|
+
parent: Jt,
|
|
1634
1634
|
name: "parentA.childB",
|
|
1635
1635
|
path: "/[paramD]",
|
|
1636
1636
|
component: Et
|
|
1637
|
-
}),
|
|
1637
|
+
}), Cr = tt({
|
|
1638
1638
|
parent: Te,
|
|
1639
1639
|
name: "parentA.childA.grandChildA",
|
|
1640
1640
|
path: "/[paramC]",
|
|
1641
1641
|
component: Et
|
|
1642
1642
|
});
|
|
1643
|
-
|
|
1643
|
+
tt({
|
|
1644
1644
|
name: "parentB",
|
|
1645
1645
|
path: "/parentB",
|
|
1646
1646
|
component: Et
|
|
1647
|
-
}),
|
|
1647
|
+
}), tt({
|
|
1648
1648
|
name: "parentC",
|
|
1649
1649
|
path: "/",
|
|
1650
1650
|
component: Et
|
|
@@ -1661,7 +1661,7 @@ function Ut(t, e) {
|
|
|
1661
1661
|
}
|
|
1662
1662
|
const Fe = Symbol();
|
|
1663
1663
|
function Vr() {
|
|
1664
|
-
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 }) => {
|
|
1665
1665
|
const S = a(h, y, c);
|
|
1666
1666
|
return i[S] = p == null ? void 0 : p(c.params), i;
|
|
1667
1667
|
}, {}), n = (c) => {
|
|
@@ -1685,7 +1685,7 @@ function Vr() {
|
|
|
1685
1685
|
return [c, f, i.id, JSON.stringify(i.params)].join("-");
|
|
1686
1686
|
}
|
|
1687
1687
|
function s(c) {
|
|
1688
|
-
return
|
|
1688
|
+
return jt(c) ? Object.entries(c.props ?? {}).map(([f, i]) => ({ id: c.id, name: f, props: i })) : Vt(c) ? [
|
|
1689
1689
|
{
|
|
1690
1690
|
id: c.id,
|
|
1691
1691
|
name: "default",
|
|
@@ -1733,19 +1733,19 @@ function _r(t, { routerPrefetch: e, linkPrefetch: n }) {
|
|
|
1733
1733
|
routePrefetch: r.prefetch,
|
|
1734
1734
|
routerPrefetch: e,
|
|
1735
1735
|
linkPrefetch: n
|
|
1736
|
-
}, "components") && (
|
|
1736
|
+
}, "components") && (Vt(r) && ce(r.component) && r.component.setup(), jt(r) && Object.values(r.components).forEach((a) => {
|
|
1737
1737
|
ce(a) && a.setup();
|
|
1738
1738
|
}));
|
|
1739
1739
|
});
|
|
1740
1740
|
}
|
|
1741
1741
|
function qr(t, e = {}, n = {}) {
|
|
1742
|
-
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(() => {
|
|
1743
1743
|
if (W(o.value))
|
|
1744
1744
|
return o.value;
|
|
1745
1745
|
try {
|
|
1746
1746
|
return r.resolve(o.value, a.value, s.value);
|
|
1747
1747
|
} catch (E) {
|
|
1748
|
-
throw E instanceof
|
|
1748
|
+
throw E instanceof Y && console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`, E), E;
|
|
1749
1749
|
}
|
|
1750
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(() => ({
|
|
1751
1751
|
route: c.value,
|
|
@@ -1767,7 +1767,7 @@ function Mr(t, e, { exact: n } = {}) {
|
|
|
1767
1767
|
return !1;
|
|
1768
1768
|
if (e === void 0)
|
|
1769
1769
|
return !0;
|
|
1770
|
-
const r = t.matches.map((o) =>
|
|
1770
|
+
const r = t.matches.map((o) => Ft(o.name));
|
|
1771
1771
|
if (n) {
|
|
1772
1772
|
const o = r.at(-1);
|
|
1773
1773
|
return e === o;
|
|
@@ -1775,7 +1775,7 @@ function Mr(t, e, { exact: n } = {}) {
|
|
|
1775
1775
|
return r.includes(e);
|
|
1776
1776
|
}
|
|
1777
1777
|
function Wr(t, e) {
|
|
1778
|
-
const n =
|
|
1778
|
+
const n = Ot();
|
|
1779
1779
|
function r() {
|
|
1780
1780
|
if (!t)
|
|
1781
1781
|
return;
|
|
@@ -1785,7 +1785,7 @@ function Wr(t, e) {
|
|
|
1785
1785
|
return fe(n.route, r, { immediate: !0, deep: !0 }), n.route;
|
|
1786
1786
|
}
|
|
1787
1787
|
const Qe = Symbol();
|
|
1788
|
-
function
|
|
1788
|
+
function Qt() {
|
|
1789
1789
|
return it(Qe, 0);
|
|
1790
1790
|
}
|
|
1791
1791
|
function Ge() {
|
|
@@ -1796,17 +1796,17 @@ function Ge() {
|
|
|
1796
1796
|
}
|
|
1797
1797
|
function Ke(t) {
|
|
1798
1798
|
return (e) => {
|
|
1799
|
-
const n =
|
|
1799
|
+
const n = Qt(), o = Ge().addBeforeRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
|
|
1800
1800
|
return le(o), o;
|
|
1801
1801
|
};
|
|
1802
1802
|
}
|
|
1803
|
-
function
|
|
1803
|
+
function Gt(t) {
|
|
1804
1804
|
return (e) => {
|
|
1805
|
-
const n =
|
|
1805
|
+
const n = Qt(), o = Ge().addAfterRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
|
|
1806
1806
|
return le(o), o;
|
|
1807
1807
|
};
|
|
1808
1808
|
}
|
|
1809
|
-
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({
|
|
1810
1810
|
__name: "routerLink",
|
|
1811
1811
|
props: {
|
|
1812
1812
|
to: {},
|
|
@@ -1817,7 +1817,7 @@ const zr = Ke("onBeforeRouteUpdate"), Yr = Ke("onBeforeRouteLeave"), Xr = Qt("on
|
|
|
1817
1817
|
state: {}
|
|
1818
1818
|
},
|
|
1819
1819
|
setup(t) {
|
|
1820
|
-
const e = t, n =
|
|
1820
|
+
const e = t, n = Ot(), r = V(() => W(e.to) ? e.to : e.to(n.resolve)), o = V(() => {
|
|
1821
1821
|
const { to: h, ...y } = e;
|
|
1822
1822
|
return y;
|
|
1823
1823
|
}), { isMatch: a, isExactMatch: s, isExternal: u, push: c } = qr(r, o), f = V(() => ({
|
|
@@ -1841,7 +1841,7 @@ const zr = Ke("onBeforeRouteUpdate"), Yr = Ke("onBeforeRouteLeave"), Xr = Qt("on
|
|
|
1841
1841
|
name: {}
|
|
1842
1842
|
},
|
|
1843
1843
|
setup(t) {
|
|
1844
|
-
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);
|
|
1845
1845
|
sn(Qe, o + 1);
|
|
1846
1846
|
const u = V(() => {
|
|
1847
1847
|
if (r.value)
|
|
@@ -1856,7 +1856,7 @@ const zr = Ke("onBeforeRouteUpdate"), Yr = Ke("onBeforeRouteLeave"), Xr = Qt("on
|
|
|
1856
1856
|
return f(i)[e];
|
|
1857
1857
|
}
|
|
1858
1858
|
function f(i) {
|
|
1859
|
-
return
|
|
1859
|
+
return jt(i) ? i.components : Vt(i) ? { default: i.component } : typeof s == "string" ? {} : { default: s };
|
|
1860
1860
|
}
|
|
1861
1861
|
return (i, h) => u.value ? pe(i.$slots, "default", de(cn({ key: 0 }, { route: ot(n), component: u.value, rejection: ot(r) })), () => [
|
|
1862
1862
|
(he(), un(fn(u.value)))
|
|
@@ -1870,7 +1870,7 @@ function ue(t) {
|
|
|
1870
1870
|
return Fr(t) ? t : qe(t, {});
|
|
1871
1871
|
}
|
|
1872
1872
|
function eo(t) {
|
|
1873
|
-
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 = {
|
|
1874
1874
|
id: e,
|
|
1875
1875
|
matched: c,
|
|
1876
1876
|
matches: [c],
|
|
@@ -1894,7 +1894,7 @@ export {
|
|
|
1894
1894
|
bn as component,
|
|
1895
1895
|
eo as createExternalRoute,
|
|
1896
1896
|
Un as createParam,
|
|
1897
|
-
|
|
1897
|
+
tt as createRoute,
|
|
1898
1898
|
Kr as createRouter,
|
|
1899
1899
|
Bn as isParamWithDefault,
|
|
1900
1900
|
Mr as isRoute,
|
|
@@ -1904,13 +1904,13 @@ export {
|
|
|
1904
1904
|
to as onAfterRouteUpdate,
|
|
1905
1905
|
zr as onBeforeRouteLeave,
|
|
1906
1906
|
Yr as onBeforeRouteUpdate,
|
|
1907
|
-
|
|
1907
|
+
Ct as path,
|
|
1908
1908
|
se as query,
|
|
1909
1909
|
Ae as routerInjectionKey,
|
|
1910
1910
|
be as routerRejectionKey,
|
|
1911
1911
|
qr as useLink,
|
|
1912
1912
|
Vn as useRejection,
|
|
1913
1913
|
Wr as useRoute,
|
|
1914
|
-
|
|
1914
|
+
Ot as useRouter,
|
|
1915
1915
|
Gr as withDefault
|
|
1916
1916
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(y,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(y=typeof globalThis<"u"?globalThis:y||self,l(y["@kitbag/router"]={},y.Vue))})(this,function(y,l){"use strict";var Br=Object.defineProperty;var Lr=(y,l,O)=>l in y?Br(y,l,{enumerable:!0,configurable:!0,writable:!0,value:O}):y[l]=O;var J=(y,l,O)=>Lr(y,typeof l!="symbol"?l+"":l,O);class O extends Error{constructor(){super("Router not installed")}}function ot(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ge(t){return t.every(e=>Array.isArray(e))}function at(t){return typeof t=="string"&&t.length>0}function lt(t){const e=at(t)?t.replace(/^#/,""):void 0;function n(){return e!==void 0}function r(){return n()?`#${t}`:""}return{value:e,hasValue:n,toString:r}}function ze(t,e){return lt(`${t.value??""}${e.value??""}`)}class Ye extends Error{constructor(e){super(`Child property on meta for ${e} conflicts with the parent meta.`)}}function Xe(t,e){return Ze(t,e),{...t,...e}}function Ze(t,e){const n=Object.keys(t).find(r=>r in e&&typeof e[r]!=typeof t[r]);if(n)throw new Ye(n)}class Jt extends Error{constructor(e){super(`Invalid Param "${e}": Router does not support multiple params by the same name. All param names must be unique.`)}}function X(t){return Array.isArray(t)?t:[t]}function Qt(t,e){return t.filter(n=>e===n).length}function Z(...t){const e=t.flatMap(n=>Array.isArray(n)?n:Object.keys(n).map(tn));for(const n of e)if(Qt(e,n)>1)throw new Jt(n)}function tn(t){return t.startsWith("?")?t.slice(1):t}function en(t,e){Z(t.params,e.params);const n=`${t.value}${e.value}`;return{value:n,params:{...t.params,...e.params},toString:()=>n}}function nn(t,e){Z(t.params,e.params);const n=[t.value,e.value].filter(at).join("&");return{value:n,params:{...t.params,...e.params},toString:()=>n}}function rn(t,e){return Z(t,e),{...t,...e}}function on(t){return"host"in t&&!!t.host}function Kt(t){return"parent"in t&&!!t.parent}function Et(t){return"component"in t&&!!t.component}function St(t){return"components"in t&&!!t.components}function an(t){return"state"in t&&!!t.state}function Gt(t,e){return{...e,path:en(t.path,e.path),query:nn(t.query,e.query),meta:Xe(t.meta,e.meta),state:rn(t.state,e.state),hash:ze(t.hash,e.hash),matches:[...t.matches,e.matched],host:t.host,depth:t.depth+1}}function zt(){return typeof window<"u"&&typeof window.document<"u"}function Yt(t,e){return l.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=e();return"then"in n?()=>l.h(cn(t,n)):()=>l.h(t,n)}})}function cn(t,e){return l.defineComponent({name:"AsyncPropsWrapper",expose:[],setup(){const n=l.ref();return(async()=>n.value=await e)(),()=>n.value?l.h(t,n.value):""}})}class tt extends Error{}const W="[",Q="]";function sn(t){return t!==String&&t!==Boolean&&t!==Number&&t!==Date}function un(t){return typeof t=="function"&&sn(t)}function ht(t){return typeof t=="object"&&"get"in t&&typeof t.get=="function"&&"set"in t&&typeof t.set=="function"}function Xt(t){return ht(t)&&t.defaultValue!==void 0}function fn(t,e){return re(t,e)}function ln(t,e){return t[e]??String}const H={invalid:t=>{throw new tt(t)}},hn={get:t=>t,set:(t,{invalid:e})=>{if(typeof t!="string")throw e();return t}},Zt={get:(t,{invalid:e})=>{if(t==="true")return!0;if(t==="false")return!1;throw e()},set:(t,{invalid:e})=>{if(typeof t!="boolean")throw e();return t.toString()}},te={get:(t,{invalid:e})=>{const n=Number(t);if(isNaN(n))throw e();return n},set:(t,{invalid:e})=>{if(typeof t!="number")throw e();return t.toString()}},ee={get:(t,{invalid:e})=>{const n=new Date(t);if(isNaN(n.getTime()))throw e();return n},set:(t,{invalid:e})=>{if(typeof t!="object"||!(t instanceof Date))throw e();return t.toISOString()}},ne={get:(t,{invalid:e})=>{try{return JSON.parse(t)}catch{throw e()}},set:(t,{invalid:e})=>{try{return JSON.stringify(t)}catch{throw e()}}};function ct(t,e,n=!1){if(t===void 0||!at(t)){if(Xt(e))return e.defaultValue;if(n)return;throw new tt}if(e===String)return hn.get(t,H);if(e===Boolean)return Zt.get(t,H);if(e===Number)return te.get(t,H);if(e===Date)return ee.get(t,H);if(e===JSON)return ne.get(t,H);if(un(e))return e(t,H);if(ht(e))return e.get(t,H);if(e instanceof RegExp){if(e.test(t))return t;throw new tt}return t}function st(t,e,n=!1){if(t===void 0){if(n)return"";throw new tt}if(e===Boolean)return Zt.set(t,H);if(e===Number)return te.set(t,H);if(e===Date)return ee.set(t,H);if(e===JSON)return ne.set(t,H);if(ht(e))return e.set(t,H);try{return t.toString()}catch{throw new tt}}function re(t,e){return ht(t)?{...t,defaultValue:e??t.defaultValue}:{get:n=>ct(n,t),set:n=>st(n,t),defaultValue:e}}function K(){return K=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},K.apply(this,arguments)}var j;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(j||(j={}));var et=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function z(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}var pt="beforeunload",pn="hashchange",oe="popstate";function ae(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var g=r.location,h=g.pathname,m=g.search,E=g.hash,S=o.state||{};return[S.idx,et({pathname:h,search:m,hash:E,state:S.usr||null,key:S.key||"default"})]}var c=null;function u(){if(c)d.call(c),c=null;else{var g=j.Pop,h=a(),m=h[0],E=h[1];if(d.length)if(m!=null){var S=i-m;S&&(c={action:g,location:E,retry:function(){k(S*-1)}},k(S))}else process.env.NODE_ENV!=="production"&&z(!1,"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.");else q(g)}}r.addEventListener(oe,u);var s=j.Pop,f=a(),i=f[0],p=f[1],v=nt(),d=nt();i==null&&(i=0,o.replaceState(K({},o.state,{idx:i}),""));function A(g){return typeof g=="string"?g:Y(g)}function b(g,h){return h===void 0&&(h=null),et(K({pathname:p.pathname,hash:"",search:""},typeof g=="string"?ut(g):g,{state:h,key:mt()}))}function x(g,h){return[{usr:g.state,key:g.key,idx:h},A(g)]}function L(g,h,m){return!d.length||(d.call({action:g,location:h,retry:m}),!1)}function q(g){s=g;var h=a();i=h[0],p=h[1],v.call({action:s,location:p})}function R(g,h){var m=j.Push,E=b(g,h);function S(){R(g,h)}if(L(m,E,S)){var U=x(E,i+1),C=U[0],V=U[1];try{o.pushState(C,"",V)}catch{r.location.assign(V)}q(m)}}function P(g,h){var m=j.Replace,E=b(g,h);function S(){P(g,h)}if(L(m,E,S)){var U=x(E,i),C=U[0],V=U[1];o.replaceState(C,"",V),q(m)}}function k(g){o.go(g)}var B={get action(){return s},get location(){return p},createHref:A,push:R,replace:P,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(h){return v.push(h)},block:function(h){var m=d.push(h);return d.length===1&&r.addEventListener(pt,dt),function(){m(),d.length||r.removeEventListener(pt,dt)}}};return B}function dn(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var h=ut(r.location.hash.substr(1)),m=h.pathname,E=m===void 0?"/":m,S=h.search,U=S===void 0?"":S,C=h.hash,V=C===void 0?"":C,$=o.state||{};return[$.idx,et({pathname:E,search:U,hash:V,state:$.usr||null,key:$.key||"default"})]}var c=null;function u(){if(c)d.call(c),c=null;else{var h=j.Pop,m=a(),E=m[0],S=m[1];if(d.length)if(E!=null){var U=i-E;U&&(c={action:h,location:S,retry:function(){B(U*-1)}},B(U))}else process.env.NODE_ENV!=="production"&&z(!1,"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.");else R(h)}}r.addEventListener(oe,u),r.addEventListener(pn,function(){var h=a(),m=h[1];Y(m)!==Y(p)&&u()});var s=j.Pop,f=a(),i=f[0],p=f[1],v=nt(),d=nt();i==null&&(i=0,o.replaceState(K({},o.state,{idx:i}),""));function A(){var h=document.querySelector("base"),m="";if(h&&h.getAttribute("href")){var E=r.location.href,S=E.indexOf("#");m=S===-1?E:E.slice(0,S)}return m}function b(h){return A()+"#"+(typeof h=="string"?h:Y(h))}function x(h,m){return m===void 0&&(m=null),et(K({pathname:p.pathname,hash:"",search:""},typeof h=="string"?ut(h):h,{state:m,key:mt()}))}function L(h,m){return[{usr:h.state,key:h.key,idx:m},b(h)]}function q(h,m,E){return!d.length||(d.call({action:h,location:m,retry:E}),!1)}function R(h){s=h;var m=a();i=m[0],p=m[1],v.call({action:s,location:p})}function P(h,m){var E=j.Push,S=x(h,m);function U(){P(h,m)}if(process.env.NODE_ENV!=="production"&&z(S.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(h)+")"),q(E,S,U)){var C=L(S,i+1),V=C[0],$=C[1];try{o.pushState(V,"",$)}catch{r.location.assign($)}R(E)}}function k(h,m){var E=j.Replace,S=x(h,m);function U(){k(h,m)}if(process.env.NODE_ENV!=="production"&&z(S.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(h)+")"),q(E,S,U)){var C=L(S,i),V=C[0],$=C[1];o.replaceState(V,"",$),R(E)}}function B(h){o.go(h)}var g={get action(){return s},get location(){return p},createHref:b,push:P,replace:k,go:B,back:function(){B(-1)},forward:function(){B(1)},listen:function(m){return v.push(m)},block:function(m){var E=d.push(m);return d.length===1&&r.addEventListener(pt,dt),function(){E(),d.length||r.removeEventListener(pt,dt)}}};return g}function ce(t){t===void 0&&(t={});var e=t,n=e.initialEntries,r=n===void 0?["/"]:n,o=e.initialIndex,a=r.map(function(R){var P=et(K({pathname:"/",search:"",hash:"",state:null,key:mt()},typeof R=="string"?ut(R):R));return process.env.NODE_ENV!=="production"&&z(P.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(R)+")"),P}),c=se(o??a.length-1,0,a.length-1),u=j.Pop,s=a[c],f=nt(),i=nt();function p(R){return typeof R=="string"?R:Y(R)}function v(R,P){return P===void 0&&(P=null),et(K({pathname:s.pathname,search:"",hash:""},typeof R=="string"?ut(R):R,{state:P,key:mt()}))}function d(R,P,k){return!i.length||(i.call({action:R,location:P,retry:k}),!1)}function A(R,P){u=R,s=P,f.call({action:u,location:s})}function b(R,P){var k=j.Push,B=v(R,P);function g(){b(R,P)}process.env.NODE_ENV!=="production"&&z(s.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(R)+")"),d(k,B,g)&&(c+=1,a.splice(c,a.length,B),A(k,B))}function x(R,P){var k=j.Replace,B=v(R,P);function g(){x(R,P)}process.env.NODE_ENV!=="production"&&z(s.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(R)+")"),d(k,B,g)&&(a[c]=B,A(k,B))}function L(R){var P=se(c+R,0,a.length-1),k=j.Pop,B=a[P];function g(){L(R)}d(k,B,g)&&(c=P,A(k,B))}var q={get index(){return c},get action(){return u},get location(){return s},createHref:p,push:b,replace:x,go:L,back:function(){L(-1)},forward:function(){L(1)},listen:function(P){return f.push(P)},block:function(P){return i.push(P)}};return q}function se(t,e,n){return Math.min(Math.max(t,e),n)}function dt(t){t.preventDefault(),t.returnValue=""}function nt(){var t=[];return{get length(){return t.length},push:function(n){return t.push(n),function(){t=t.filter(function(r){return r!==n})}},call:function(n){t.forEach(function(r){return r&&r(n)})}}}function mt(){return Math.random().toString(36).substr(2,8)}function Y(t){var e=t.pathname,n=e===void 0?"/":e,r=t.search,o=r===void 0?"":r,a=t.hash,c=a===void 0?"":a;return o&&o!=="?"&&(n+=o.charAt(0)==="?"?o:"?"+o),c&&c!=="#"&&(n+=c.charAt(0)==="#"?c:"#"+c),n}function ut(t){var e={};if(t){var n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));var r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}class ue extends Error{constructor(e,n){super(`useRoute called with incorrect route. Given ${e}, expected ${n}`)}}const bt=Symbol();function ie(){const t=l.inject(bt);if(!t)throw new O;return t}const At=Symbol();function gt(){const t=l.inject(At);if(!t)throw new O;return t}const fe=Symbol("isRouterRouteSymbol");function mn(t){return typeof t=="object"&&t!==null&&fe in t}function gn(t,e){function n(v,d,A){if(typeof v=="object"){const x={...t.params,...v};return e(t.name,x,d)}const b={...t.params,[v]:d};return e(t.name,b,A)}const{id:r,matched:o,matches:a,name:c,query:u,params:s,state:f,hash:i}=l.toRefs(t),p=l.reactive({id:r,matched:o,matches:a,state:f,query:u,hash:i,params:s,name:c,update:n,[fe]:!0});return new Proxy(p,{get:(v,d,A)=>d==="params"?new Proxy(t.params,{set(b,x,L){return n(x,L),!0}}):d==="state"?new Proxy(t.state,{set(b,x,L){return n({},{state:{...t.state,[x]:L}}),!0}}):Reflect.get(v,d,A)})}const le=Symbol();function Rn(t,e){const n=l.reactive({...t}),r=c=>{Object.assign(n,{[le]:!1,...c})},o=n,a=gn(o,e);return{currentRoute:o,routerRoute:a,updateRoute:r}}function T(t){return!t.startsWith("http")?wn(t):yn(t)}function yn(t){const{protocol:e,host:n,pathname:r,search:o,searchParams:a,hash:c}=new URL(t,t);return{protocol:e,host:n,pathname:r,search:o,searchParams:a,hash:c}}function wn(t){const{pathname:e,search:n,searchParams:r,hash:o}=new URL(t,"https://localhost");return{pathname:e,search:n,searchParams:r,hash:o}}function vn(t){return e=>{const{host:n}=T(e);return!(n===void 0||n===t)}}function Pn({mode:t,listener:e}){const n=En(t),r=(s,f)=>{if(f!=null&&f.replace){n.replace(s,f.state);return}n.push(s,f==null?void 0:f.state)},o=()=>{const s=Y(n.location);n.replace(s)};let a;return{...n,update:r,refresh:o,startListening:()=>{a==null||a(),a=n.listen(e)},stopListening:()=>{a==null||a()}}}function En(t="auto"){switch(t){case"auto":return zt()?ae():ce();case"browser":return ae();case"memory":return ce();case"hash":return dn();default:const e=t;throw new Error(`Switch is not exhaustive for mode: ${e}`)}}class Rt{constructor(){J(this,"onBeforeRouteEnter",new Set);J(this,"onBeforeRouteUpdate",new Set);J(this,"onBeforeRouteLeave",new Set);J(this,"onAfterRouteEnter",new Set);J(this,"onAfterRouteUpdate",new Set);J(this,"onAfterRouteLeave",new Set)}}class he extends Error{}class it extends Error{constructor(n){super("Error occurred during a router push operation.");J(this,"to");this.to=n}}class kt extends Error{constructor(n){super(`Routing action rejected: ${n}`);J(this,"type");this.type=n}}function Sn(t,e){const n=new Rt;return t.matches.forEach((r,o)=>{r.onBeforeRouteEnter&&xt(t,e,o)&&X(r.onBeforeRouteEnter).forEach(a=>n.onBeforeRouteEnter.add(a)),r.onBeforeRouteUpdate&&Lt(t,e,o)&&X(r.onBeforeRouteUpdate).forEach(a=>n.onBeforeRouteUpdate.add(a))}),e.matches.forEach((r,o)=>{r.onBeforeRouteLeave&&Bt(t,e,o)&&X(r.onBeforeRouteLeave).forEach(a=>n.onBeforeRouteLeave.add(a))}),n}function bn(t,e){const n=new Rt;return t.matches.forEach((r,o)=>{r.onAfterRouteEnter&&xt(t,e,o)&&X(r.onAfterRouteEnter).forEach(a=>n.onAfterRouteEnter.add(a)),r.onAfterRouteUpdate&&Lt(t,e,o)&&X(r.onAfterRouteUpdate).forEach(a=>n.onAfterRouteUpdate.add(a))}),e.matches.forEach((r,o)=>{r.onAfterRouteLeave&&Bt(t,e,o)&&X(r.onAfterRouteLeave).forEach(a=>n.onAfterRouteLeave.add(a))}),n}function _(t){return typeof t!="string"?!1:/^(https?:\/\/|\/).*/g.test(t)}function An(){const t=c=>{throw new kt(c)},e=(...c)=>{throw new it(c)},n=(c,u,s)=>{if(_(c)){const p=u??{};throw new it([c,{...p,replace:!0}])}const f=u,i=s??{};throw new it([c,f,{...i,replace:!0}])},r=()=>{throw new he};async function o({to:c,from:u,hooks:s}){const{global:f,component:i}=s,p=Sn(c,u),v=[...f.onBeforeRouteEnter,...p.onBeforeRouteEnter,...f.onBeforeRouteUpdate,...p.onBeforeRouteUpdate,...i.onBeforeRouteUpdate,...f.onBeforeRouteLeave,...p.onBeforeRouteLeave,...i.onBeforeRouteLeave];try{const d=v.map(A=>A(c,{from:u,reject:t,push:e,replace:n,abort:r}));await Promise.all(d)}catch(d){if(d instanceof it)return{status:"PUSH",to:d.to};if(d instanceof kt)return{status:"REJECT",type:d.type};if(d instanceof he)return{status:"ABORT"};throw d}return{status:"SUCCESS"}}async function a({to:c,from:u,hooks:s}){const{global:f,component:i}=s,p=bn(c,u),v=[...i.onAfterRouteLeave,...p.onAfterRouteLeave,...f.onAfterRouteLeave,...i.onAfterRouteUpdate,...p.onAfterRouteUpdate,...f.onAfterRouteUpdate,...i.onAfterRouteEnter,...p.onAfterRouteEnter,...f.onAfterRouteEnter];try{const d=v.map(A=>A(c,{from:u,reject:t,push:e,replace:n}));await Promise.all(d)}catch(d){if(d instanceof it)return{status:"PUSH",to:d.to};if(d instanceof kt)return{status:"REJECT",type:d.type};throw d}return{status:"SUCCESS"}}return{runBeforeRouteHooks:o,runAfterRouteHooks:a}}const xt=(t,e,n)=>{const r=t.matches,o=(e==null?void 0:e.matches)??[];return r.length<n||r[n]!==o[n]},Bt=(t,e,n)=>{const r=t.matches,o=(e==null?void 0:e.matches)??[];return r.length<n||r[n]!==o[n]},Lt=(t,e,n)=>t.matches[n]===(e==null?void 0:e.matches[n]);function pe(t){switch(t){case"onBeforeRouteEnter":case"onAfterRouteEnter":return xt;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return Lt;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Bt;default:throw new Error(`Switch is not exhaustive for lifecycle: ${t}`)}}function kn(){const t={global:new Rt,component:new Rt};function e({lifecycle:r,timing:o,depth:a,hook:c}){const u=pe(r),s=t[o][r],f=(i,p)=>{if(u(i,p.from,a))return c(i,p)};return s.add(f),()=>s.delete(f)}function n({lifecycle:r,timing:o,depth:a,hook:c}){const u=pe(r),s=t[o][r],f=(i,p)=>{if(u(i,p.from,a))return c(i,p)};return s.add(f),()=>s.delete(f)}return{...t,addBeforeRouteHook:e,addAfterRouteHook:n}}const de=Symbol();function xn(){const t=kn();return{onBeforeRouteEnter:u=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteEnter",hook:u,timing:"global",depth:0}),onBeforeRouteUpdate:u=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteUpdate",hook:u,timing:"global",depth:0}),onBeforeRouteLeave:u=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteLeave",hook:u,timing:"global",depth:0}),onAfterRouteEnter:u=>t.addAfterRouteHook({lifecycle:"onAfterRouteEnter",hook:u,timing:"global",depth:0}),onAfterRouteUpdate:u=>t.addAfterRouteHook({lifecycle:"onAfterRouteUpdate",hook:u,timing:"global",depth:0}),onAfterRouteLeave:u=>t.addAfterRouteHook({lifecycle:"onAfterRouteLeave",hook:u,timing:"global",depth:0}),hooks:t}}function Bn(t){return l.defineComponent(()=>()=>l.h("h1",t),{name:t,props:[]})}function me(t){const e=new URLSearchParams(t);return{get:n=>e.get(n),getAll:n=>e.getAll(n)}}function Ln(){let t=0;return()=>(++t).toString()}const Ut=Ln();function Un({rejections:t}){const e=a=>{const c={...t};return l.markRaw(c[a]??Bn(a))},n=a=>{const c=l.markRaw(e(a)),u={id:Ut(),name:a,component:c,meta:{},state:{}};return{id:u.id,matched:u,matches:[u],name:a,query:me(""),params:{},state:{},[le]:!0}},r=a=>{if(!a){o.value=null;return}const c=e(a);o.value={type:a,component:c}},o=l.ref(null);return{setRejection:r,rejection:o,getRejectionRoute:n}}class Nn extends Error{constructor(e){super(`Route not found: "${e}"`)}}function Nt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Cn(t,e){const n=Array.from(t.matchAll(e));if(n.length===0)return[t];let r=0;const o=n.reduce((c,u)=>{const s=Nt(t.slice(r,u.index));s.length&&c.push(s);const[f]=u;return c.push(f),r=u.index+f.length,c},[]),a=t.slice(r);return a&&o.push(a),o}function jn(t){const e=ge(t.path.toString());return new RegExp(`^${e}$`,"i")}function $n(t){const e=new URLSearchParams(t.query.toString());return Array.from(e.entries()).filter(([,n])=>!jt(n)).map(([n,r])=>{const o=ge(r);return new RegExp(`${Nt(n)}=${o}(&|$)`,"i")})}function ge(t){return Cn(t,new RegExp(Hn,"g")).map(e=>e.startsWith(W)?Re(e):Nt(e)).join("")}function Re(t){return[Vn,On].reduce((e,n)=>n(e),t)}const Hn=`\\${W}\\??([\\w-_]+)\\${Q}`,Ct=`\\${W}\\?([\\w-_]+)\\${Q}`,ye=`\\${W}([\\w-_]+)\\${Q}`;function Vn(t){return t.replace(new RegExp(Ct,"g"),".*")}function jt(t){return new RegExp(Ct,"g").test(t)}function On(t){return t.replace(new RegExp(ye,"g"),".+")}function yt(t){const[e]=wt(t,new RegExp(Ct,"g")),[n]=wt(t,new RegExp(ye,"g"));return e??n}function wt(t,e){return Array.from(t.matchAll(e)).flatMap(([,...r])=>r.map(o=>at(o)?o:""))}function we(t,e,n){const r=Pe(e,n),[o]=wt(t,r);return o}function ve(t,e){if(!e)return t;const{name:n,param:r,value:o}=e,a=Pe(t,n);return wt(t,a).reduce((u,s)=>s===void 0?u:u.replace(s,()=>st(o,r,n.startsWith("?"))),t)}function Pe(t,e){const n=[_n,qn,Re].reduce((r,o)=>o(r,e),t);return new RegExp(n,"g")}function _n(t,e){if(!e.startsWith("?"))return t;const n=new RegExp(`\\${W}\\${e}\\${Q}`,"g");return t.replace(n,"(.*)")}function qn(t,e){if(e.startsWith("?"))return t;const n=new RegExp(`\\${W}${e}\\${Q}`,"g");return t.replace(n,"(.+)")}function Ee(t,...e){return e.reduce((n,r)=>{if(!r)return n;const o=new URLSearchParams(r).toString();return Object.keys(o).length===0?n:n.includes("?")?`${n}&${o}`:`${n}?${o}`},t)}function Dn(t,e={}){const{params:n={},query:r}=e,o=Mn(t.host,n),a=Wn(t.path,n),c=Tn(t.query,n),u=Ee(`${o}${a}`,c,r),s=lt(t.hash.value??e.hash).toString();return`${u}${s}`}function Mn(t,e){const n=t.toString();return Object.entries(t.params).reduce((r,[o,a])=>{const c=yt(`${W}${o}${Q}`);return c?ve(r,{name:o,param:a,value:e[c]}):r},n)}function Wn(t,e){const n=t.toString();return Object.entries(t.params).reduce((r,[o,a])=>{const c=yt(`${W}${o}${Q}`);return c?ve(r,{name:o,param:a,value:e[c]}):r},n)}function Tn(t,e){const n=t.toString();if(!n)return{};const r=new URLSearchParams(n);return Array.from(r.entries()).reduce((o,[a,c])=>{const u=yt(c);if(!u)return{...o,[a]:c};const f=st(e[u],t.params[u],jt(c)),i=e[u]===void 0&&f==="";return jt(c)&&i?o:{...o,[a]:f}},{})}function In(t){return(e,n,r)=>{if(_(e))return Ee(e,(n??{}).query);const o=n??{},a=r??{},c=t.find(s=>s.name===e);if(!c)throw new Nn(String(e));return Dn(c,{params:o,query:a.query,hash:a.hash})}}class Fn extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Jn(t){if(t)return t;if(zt())return window.location.toString();throw new Fn}const Qn=(t,e)=>{try{Se(t,e)}catch{return!1}return!0},Se=(t,e)=>{const{pathname:n,search:r}=T(e);return{...Kn(t.path,n),...Gn(t.query,r)}};function Kn(t,e){const n={},r=decodeURIComponent(e);for(const[o,a]of Object.entries(t.params)){const c=o.startsWith("?"),u=c?o.slice(1):o,s=we(r,t.toString(),o),f=ct(s,a,c);n[u]=f}return n}function Gn(t,e){const n={},r=new URLSearchParams(e);for(const[o,a]of Object.entries(t.params)){const c=o.startsWith("?"),u=c?o.slice(1):o,s=r.get(u)??void 0,f=ct(s,a,c);n[u]=f}return n}const zn=t=>"name"in t.matched&&!!t.matched.name,Yn=(t,e)=>{const{pathname:n}=T(e);return jn(t).test(n)},Xn=(t,e)=>{const{search:n}=T(e);return $n(t).every(o=>o.test(n))},Zn=(t,e)=>{const{hash:n}=T(e),r=t.hash.toString();return!t.hash.hasValue()||r.toLowerCase()===n.toLowerCase()};function tr(t){const{searchParams:e,pathname:n}=T(t),r=-1,o=1;return(a,c)=>{const u=Ae(a,e),s=be(a,n),f=Ae(c,e),i=be(c,n);if(a.depth>c.depth)return r;if(a.depth<c.depth)return o;if(u+s>f+i)return r;if(u+s<f+i)return o;const{hash:p}=T(t);return a.hash.toString()===p?r:c.hash.toString()===p?o:0}}function be(t,e){const n=Object.keys(t.path.params).filter(o=>o.startsWith("?")).map(o=>o),r=n.filter(o=>we(e,t.path.toString(),o)===void 0);return n.length-r.length}function Ae(t,e){const n=new URLSearchParams(t.query.toString()),r=Array.from(n.keys()),o=r.filter(a=>!e.has(a));return r.length-o.length}function ke(t){return!!t&&typeof t=="object"}const vt=!0;function er(t,e,n){if(ke(t)&&e in t){const r=t[e];if(typeof r=="string")return ct(r,n,vt)}return ct(void 0,n,vt)}function nr(t,e){const n={};for(const[r,o]of Object.entries(t)){const a=er(e,r,o);n[r]=a}return n}function rr(t,e,n){if(ke(t)&&e in t){const r=t[e];return st(r,n,vt)}return st(void 0,n,vt)}const xe=(t,e)=>{const n={};for(const[r,o]of Object.entries(t)){const a=rr(e,r,o);n[r]=a}return n},or=[zn,Yn,Xn,Zn,Qn];function $t(t,e,n){const r=tr(e),o=t.filter(s=>or.every(f=>f(s,e))).sort(r);if(o.length===0)return;const[a]=o,{search:c,hash:u}=T(e);return{id:a.id,matched:a.matched,matches:a.matches,name:a.name,query:me(c),params:Se(a,e),state:nr(a.state,n),hash:u}}function Ht(t,e){const n=new RegExp(`\\${W}(\\??[\\w-_]+)\\${Q}`,"g");return Array.from(t.matchAll(n)).reduce((o,[a,c])=>{const u=yt(a);if(!u)return o;const s=ln(e,u);return Z([u],o),o[c]=s,o},{})}function Be(t,e){return{value:t,params:Ht(t,e),toString:()=>t}}function ar(t){return ot(t)&&typeof t.hash=="string"}function Le(t){return t===void 0?lt():ar(t)?t:lt(t)}function Vt(t){return t===void 0?"":t}function Ot(t,e){return{value:t,params:Ht(t,e),toString:()=>t}}function cr(t){return ot(t)&&typeof t.value=="string"}function Ue(t){return t===void 0?Ot("",{}):cr(t)?t:Ot(t,{})}function _t(t,e){return{value:t,params:Ht(t,e),toString:()=>t}}function sr(t){return ot(t)&&typeof t.value=="string"}function Ne(t){return t===void 0?_t("",{}):sr(t)?t:_t(t,{})}function I(t){const e=Ut(),n=Vt(t.name),r=Ue(t.path),o=Ne(t.query),a=Le(t.hash),c=t.meta??{},u=an(t)?t.state:{},s=l.markRaw({id:e,meta:{},state:{},...t}),f={id:e,matched:s,matches:[s],name:n,path:r,query:o,hash:a,meta:c,state:u,depth:1,host:Be("",{}),prefetch:t.prefetch},i=Kt(t)?Gt(t.parent,f):f;return Z(i.path.params,i.query.params),i}function ur(t,e){if(!at(e))return t;const n=I({path:e});return t.map(r=>I({parent:n,...r}))}class ir extends Error{constructor(e){super(`Invalid Name "${e}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function fr(t){const e=t.map(({name:n})=>n);for(const n of e)if(Qt(e,n)>1)throw new ir(n)}function lr(t,e){const n=Ge(t)?t.flat():t,r=ur(n,e==null?void 0:e.base);fr(r);const o=mr(),a=In(r),c=Pn({mode:e==null?void 0:e.historyMode,listener:({location:w})=>{const N=Y(w);x(N,{state:w.state})}}),{runBeforeRouteHooks:u,runAfterRouteHooks:s}=An(),{hooks:f,onBeforeRouteEnter:i,onAfterRouteUpdate:p,onBeforeRouteLeave:v,onAfterRouteEnter:d,onBeforeRouteUpdate:A,onAfterRouteLeave:b}=xn();async function x(w,N={}){if(c.stopListening(),$(w)){c.update(w,N);return}const D=$t(r,w,N.state)??g("NotFound"),M={...m},rt=await u({to:D,from:M,hooks:f});switch(rt.status){case"ABORT":return;case"PUSH":c.update(w,N),await L(...rt.to);return;case"REJECT":c.update(w,N),k(rt.type);break;case"SUCCESS":c.update(w,N),k(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(rt)}`)}o.setProps(D),S(D);const G=await s({to:D,from:M,hooks:f});switch(G.status){case"PUSH":await L(...G.to);break;case"REJECT":k(G.type);break;case"SUCCESS":break;default:const F=G;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(F)}`)}c.startListening()}const L=(w,N,D)=>{if(_(w)){const ft={...N},Ft=a(w,ft);return x(Ft,ft)}const M={...D},G=a(w,N??{},M),F=Qe(w),It=xe((F==null?void 0:F.state)??{},M.state);return x(G,{...M,state:It})},q=(w,N,D)=>{if(_(w)){const ft={...N,replace:!0},Ft=a(w,ft);return x(Ft,ft)}const M={...D,replace:!0},G=a(w,N??{},M),F=Qe(w),It=xe((F==null?void 0:F.state)??{},M.state);return x(G,{...M,state:It})},R=w=>{k(w)},P=(w,N={})=>{if(!_(w)){const D=a(w,N);return $t(r,D)}if(!$(w))return $t(r,w)},{setRejection:k,rejection:B,getRejectionRoute:g}=Un(e??{}),h=g("NotFound"),{currentRoute:m,routerRoute:E,updateRoute:S}=Rn(h,L);c.startListening();const U=Jn(e==null?void 0:e.initialUrl),C=c.location.state,{host:V}=T(U),$=vn(V);let Tt=!1;async function Je(){Tt||(await x(U,{replace:!0,state:C}),Tt=!0)}function Qe(w){return r.find(N=>N.name===w)}function xr(w){w.component("RouterView",Ie),w.component("RouterLink",Te),w.provide(bt,B),w.provide(de,f),w.provide($e,o),w.provide(At,Ke),Je()}const Ke={route:E,resolve:a,push:L,replace:q,reject:R,find:P,refresh:c.refresh,forward:c.forward,back:c.back,go:c.go,install:xr,isExternal:$,onBeforeRouteEnter:i,onAfterRouteUpdate:p,onBeforeRouteLeave:v,onAfterRouteEnter:d,onBeforeRouteUpdate:A,onAfterRouteLeave:b,prefetch:e==null?void 0:e.prefetch,start:Je};return Ke}const Pt={template:"<div>This is component</div>"},qt=I({name:"parentA",path:"/parentA/[paramA]"}),Ce=I({parent:qt,name:"parentA.childA",path:"/[?paramB]"}),hr=I({parent:qt,name:"parentA.childB",path:"/[paramD]",component:Pt}),pr=I({parent:Ce,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Pt});I({name:"parentB",path:"/parentB",component:Pt}),I({name:"parentC",path:"/",component:Pt});const dr={components:!0,props:!1};function je({routerPrefetch:t,routePrefetch:e,linkPrefetch:n},r){return Dt(n,r)??Dt(e,r)??Dt(t,r)??dr[r]}function Dt(t,e){return ot(t)?t[e]:t}const $e=Symbol();function mr(){const t=l.reactive(new Map),e=(s,f)=>s.matches.filter(i=>je({...f,routePrefetch:i.prefetch},"props")).flatMap(i=>c(i)).reduce((i,{id:p,name:v,props:d})=>{const A=a(p,v,s);return i[A]=d==null?void 0:d(s.params),i},{}),n=s=>{Object.entries(s).forEach(([f,i])=>{t.set(f,i)})},r=s=>{const i=s.matches.flatMap(c).reduce((p,{id:v,name:d,props:A})=>{const b=a(v,d,s);if(!A||t.has(b))return p;const x=A(s.params);return t.set(b,x),p.push(b),p},[]);u(i)},o=(s,f,i)=>{const p=a(s,f,i);return t.get(p)};function a(s,f,i){return[s,f,i.id,JSON.stringify(i.params)].join("-")}function c(s){return St(s)?Object.entries(s.props??{}).map(([f,i])=>({id:s.id,name:f,props:i})):Et(s)?[{id:s.id,name:"default",props:s.props}]:[]}function u(s){for(const f in t.keys())s.includes(f)||t.delete(f)}return{getPrefetchProps:e,setPrefetchProps:n,getProps:o,setProps:r}}function He(){const t=l.inject($e);if(!t)throw new O;return t}const gr=l.defineAsyncComponent(()=>new Promise(t=>{t({default:{template:"foo"}})}));function Ve(t){return t.name===gr.name&&"setup"in t}function Rr(t){let e={};const{getPrefetchProps:n,setPrefetchProps:r}=He();return l.watch(()=>l.toValue(t),({route:a,...c})=>{a&&(yr(a,c),e=n(a,c))},{immediate:!0}),{commit:()=>{r(e)}}}function yr(t,{routerPrefetch:e,linkPrefetch:n}){t.matches.forEach(r=>{je({routePrefetch:r.prefetch,routerPrefetch:e,linkPrefetch:n},"components")&&(Et(r)&&Ve(r.component)&&r.component.setup(),St(r)&&Object.values(r.components).forEach(a=>{Ve(a)&&a.setup()}))})}function Oe(t,e={},n={}){const r=gt(),o=l.toRef(t),a=l.computed(()=>_(o.value)?{}:l.toValue(e)),c=l.computed(()=>_(o.value)?l.toValue(e):l.toValue(n)),u=l.computed(()=>{if(_(o.value))return o.value;try{return r.resolve(o.value,a.value,c.value)}catch(b){throw b instanceof tt&&console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`,b),b}}),s=l.computed(()=>r.find(u.value,c.value)),f=l.computed(()=>!!s.value&&r.route.matches.includes(s.value.matched)),i=l.computed(()=>!!s.value&&r.route.matched===s.value.matched),p=l.computed(()=>r.isExternal(u.value)),{commit:v}=Rr(()=>({route:s.value,routerPrefetch:r.prefetch,linkPrefetch:c.value.prefetch})),d=b=>(v(),r.push(u.value,{...c.value,...b}));return{route:s,href:u,isMatch:f,isExactMatch:i,isExternal:p,push:d,replace:b=>d(b)}}function _e(t,e,{exact:n}={}){if(!mn(t))return!1;if(e===void 0)return!0;const r=t.matches.map(o=>Vt(o.name));if(n){const o=r.at(-1);return e===o}return r.includes(e)}function qe(t,e){const n=gt();function r(){if(!t)return;if(!_e(n.route,t,e))throw new ue(t,n.route.name)}return l.watch(n.route,r,{immediate:!0,deep:!0}),n.route}const De=Symbol();function Mt(){return l.inject(De,0)}function Me(){const t=l.inject(de);if(!t)throw new O;return t}function We(t){return e=>{const n=Mt(),o=Me().addBeforeRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return l.onUnmounted(o),o}}function Wt(t){return e=>{const n=Mt(),o=Me().addAfterRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return l.onUnmounted(o),o}}const wr=We("onBeforeRouteUpdate"),vr=We("onBeforeRouteLeave"),Pr=Wt("onAfterRouteEnter"),Er=Wt("onAfterRouteUpdate"),Sr=Wt("onAfterRouteLeave"),br=["href"],Te=l.defineComponent({__name:"routerLink",props:{to:{},prefetch:{type:[Boolean,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(t){const e=t,n=gt(),r=l.computed(()=>_(e.to)?e.to:e.to(n.resolve)),o=l.computed(()=>{const{to:p,...v}=e;return v}),{isMatch:a,isExactMatch:c,isExternal:u,push:s}=Oe(r,o),f=l.computed(()=>({"router-link--match":a.value,"router-link--exact-match":c.value}));function i(p){p.preventDefault(),s()}return(p,v)=>(l.openBlock(),l.createElementBlock("a",{href:r.value,class:l.normalizeClass(["router-link",f.value]),onClick:i},[l.renderSlot(p.$slots,"default",l.normalizeProps(l.guardReactiveProps({resolved:r.value,isMatch:l.unref(a),isExactMatch:l.unref(c),isExternal:l.unref(u)})))],10,br))}}),Ie=l.defineComponent({__name:"routerView",props:{name:{}},setup(t){const{name:e="default"}=t,n=qe(),r=ie(),o=Mt(),{getProps:a}=He(),c=l.resolveComponent("RouterView",!0);l.provide(De,o+1);const u=l.computed(()=>{if(r.value)return r.value.component;const i=n.matches.at(o);if(!i)return null;const p=s(i),v=a(i.id,e,n);return p?v?Yt(p,()=>v):p:null});function s(i){return f(i)[e]}function f(i){return St(i)?i.components:Et(i)?{default:i.component}:typeof c=="string"?{}:{default:c}}return(i,p)=>u.value?l.renderSlot(i.$slots,"default",l.normalizeProps(l.mergeProps({key:0},{route:l.unref(n),component:u.value,rejection:l.unref(r)})),()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(u.value)))]):l.createCommentVNode("",!0)}});function Ar(t){return ot(t)&&typeof t.value=="string"}function Fe(t){return Ar(t)?t:Be(t,{})}function kr(t){const e=Ut(),n=Vt(t.name),r=Ue(t.path),o=Ne(t.query),a=Le(t.hash),c=t.meta??{},u=on(t)?Fe(t.host):Fe(""),s=l.markRaw({id:e,meta:{},state:{},...t}),f={id:e,matched:s,matches:[s],name:n,host:u,path:r,query:o,hash:a,meta:c,depth:1,state:{}},i=Kt(t)?Gt(t.parent,f):f;return Z(i.path.params,i.query.params,i.host.params),i}y.DuplicateParamsError=Jt,y.RouterLink=Te,y.RouterNotInstalledError=O,y.RouterView=Ie,y.UseRouteInvalidError=ue,y.component=Yt,y.createExternalRoute=kr,y.createParam=re,y.createRoute=I,y.createRouter=lr,y.isParamWithDefault=Xt,y.isRoute=_e,y.isUrl=_,y.onAfterRouteEnter=Pr,y.onAfterRouteLeave=Er,y.onAfterRouteUpdate=Sr,y.onBeforeRouteLeave=wr,y.onBeforeRouteUpdate=vr,y.path=Ot,y.query=_t,y.routerInjectionKey=At,y.routerRejectionKey=bt,y.useLink=Oe,y.useRejection=ie,y.useRoute=qe,y.useRouter=gt,y.withDefault=fn,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(y,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(y=typeof globalThis<"u"?globalThis:y||self,l(y["@kitbag/router"]={},y.Vue))})(this,function(y,l){"use strict";var Br=Object.defineProperty;var Lr=(y,l,O)=>l in y?Br(y,l,{enumerable:!0,configurable:!0,writable:!0,value:O}):y[l]=O;var F=(y,l,O)=>Lr(y,typeof l!="symbol"?l+"":l,O);class O extends Error{constructor(){super("Router not installed")}}function ot(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ge(t){return t.every(e=>Array.isArray(e))}function at(t){return typeof t=="string"&&t.length>0}function lt(t){const e=at(t)?t.replace(/^#/,""):void 0;function n(){return e!==void 0}function r(){return n()?`#${t}`:""}return{value:e,hasValue:n,toString:r}}function ze(t,e){return lt(`${t.value??""}${e.value??""}`)}class Ye extends Error{constructor(e){super(`Child property on meta for ${e} conflicts with the parent meta.`)}}function Xe(t,e){return Ze(t,e),{...t,...e}}function Ze(t,e){const n=Object.keys(t).find(r=>r in e&&typeof e[r]!=typeof t[r]);if(n)throw new Ye(n)}class Jt extends Error{constructor(e){super(`Invalid Param "${e}": Router does not support multiple params by the same name. All param names must be unique.`)}}function X(t){return Array.isArray(t)?t:[t]}function Qt(t,e){return t.filter(n=>e===n).length}function Z(...t){const e=t.flatMap(n=>Array.isArray(n)?n:Object.keys(n).map(tn));for(const n of e)if(Qt(e,n)>1)throw new Jt(n)}function tn(t){return t.startsWith("?")?t.slice(1):t}function en(t,e){Z(t.params,e.params);const n=`${t.value}${e.value}`;return{value:n,params:{...t.params,...e.params},toString:()=>n}}function nn(t,e){Z(t.params,e.params);const n=[t.value,e.value].filter(at).join("&");return{value:n,params:{...t.params,...e.params},toString:()=>n}}function rn(t,e){return Z(t,e),{...t,...e}}function on(t){return"host"in t&&!!t.host}function Kt(t){return"parent"in t&&!!t.parent}function St(t){return"component"in t&&!!t.component}function bt(t){return"components"in t&&!!t.components}function an(t){return"state"in t&&!!t.state}function Gt(t,e){return{...e,path:en(t.path,e.path),query:nn(t.query,e.query),meta:Xe(t.meta,e.meta),state:rn(t.state,e.state),hash:ze(t.hash,e.hash),matches:[...t.matches,e.matched],host:t.host,depth:t.depth+1}}function zt(){return typeof window<"u"&&typeof window.document<"u"}function Yt(t,e){return l.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=e();return"then"in n?()=>l.h(cn(t,n)):()=>l.h(t,n)}})}function cn(t,e){return l.defineComponent({name:"AsyncPropsWrapper",expose:[],setup(){const n=l.ref();return(async()=>n.value=await e)(),()=>n.value?l.h(t,n.value):""}})}class tt extends Error{}const W="[",J="]";function sn(t){return t!==String&&t!==Boolean&&t!==Number&&t!==Date}function un(t){return typeof t=="function"&&sn(t)}function ht(t){return typeof t=="object"&&"get"in t&&typeof t.get=="function"&&"set"in t&&typeof t.set=="function"}function Xt(t){return ht(t)&&t.defaultValue!==void 0}function fn(t,e){return re(t,e)}function ln(t,e){return t[e]??String}const H={invalid:t=>{throw new tt(t)}},hn={get:t=>t,set:(t,{invalid:e})=>{if(typeof t!="string")throw e();return t}},Zt={get:(t,{invalid:e})=>{if(t==="true")return!0;if(t==="false")return!1;throw e()},set:(t,{invalid:e})=>{if(typeof t!="boolean")throw e();return t.toString()}},te={get:(t,{invalid:e})=>{const n=Number(t);if(isNaN(n))throw e();return n},set:(t,{invalid:e})=>{if(typeof t!="number")throw e();return t.toString()}},ee={get:(t,{invalid:e})=>{const n=new Date(t);if(isNaN(n.getTime()))throw e();return n},set:(t,{invalid:e})=>{if(typeof t!="object"||!(t instanceof Date))throw e();return t.toISOString()}},ne={get:(t,{invalid:e})=>{try{return JSON.parse(t)}catch{throw e()}},set:(t,{invalid:e})=>{try{return JSON.stringify(t)}catch{throw e()}}};function ct(t,e,n=!1){if(t===void 0||!at(t)){if(Xt(e))return e.defaultValue;if(n)return;throw new tt}if(e===String)return hn.get(t,H);if(e===Boolean)return Zt.get(t,H);if(e===Number)return te.get(t,H);if(e===Date)return ee.get(t,H);if(e===JSON)return ne.get(t,H);if(un(e))return e(t,H);if(ht(e))return e.get(t,H);if(e instanceof RegExp){if(e.test(t))return t;throw new tt}return t}function st(t,e,n=!1){if(t===void 0){if(n)return"";throw new tt}if(e===Boolean)return Zt.set(t,H);if(e===Number)return te.set(t,H);if(e===Date)return ee.set(t,H);if(e===JSON)return ne.set(t,H);if(ht(e))return e.set(t,H);try{return t.toString()}catch{throw new tt}}function re(t,e){return ht(t)?{...t,defaultValue:e??t.defaultValue}:{get:n=>ct(n,t),set:n=>st(n,t),defaultValue:e}}function Q(){return Q=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Q.apply(this,arguments)}var j;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(j||(j={}));var et=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function G(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}var pt="beforeunload",pn="hashchange",oe="popstate";function ae(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var g=r.location,h=g.pathname,m=g.search,E=g.hash,S=o.state||{};return[S.idx,et({pathname:h,search:m,hash:E,state:S.usr||null,key:S.key||"default"})]}var c=null;function u(){if(c)d.call(c),c=null;else{var g=j.Pop,h=a(),m=h[0],E=h[1];if(d.length)if(m!=null){var S=i-m;S&&(c={action:g,location:E,retry:function(){k(S*-1)}},k(S))}else process.env.NODE_ENV!=="production"&&G(!1,"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.");else q(g)}}r.addEventListener(oe,u);var s=j.Pop,f=a(),i=f[0],p=f[1],v=nt(),d=nt();i==null&&(i=0,o.replaceState(Q({},o.state,{idx:i}),""));function A(g){return typeof g=="string"?g:z(g)}function b(g,h){return h===void 0&&(h=null),et(Q({pathname:p.pathname,hash:"",search:""},typeof g=="string"?ut(g):g,{state:h,key:mt()}))}function x(g,h){return[{usr:g.state,key:g.key,idx:h},A(g)]}function L(g,h,m){return!d.length||(d.call({action:g,location:h,retry:m}),!1)}function q(g){s=g;var h=a();i=h[0],p=h[1],v.call({action:s,location:p})}function R(g,h){var m=j.Push,E=b(g,h);function S(){R(g,h)}if(L(m,E,S)){var U=x(E,i+1),C=U[0],V=U[1];try{o.pushState(C,"",V)}catch{r.location.assign(V)}q(m)}}function P(g,h){var m=j.Replace,E=b(g,h);function S(){P(g,h)}if(L(m,E,S)){var U=x(E,i),C=U[0],V=U[1];o.replaceState(C,"",V),q(m)}}function k(g){o.go(g)}var B={get action(){return s},get location(){return p},createHref:A,push:R,replace:P,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(h){return v.push(h)},block:function(h){var m=d.push(h);return d.length===1&&r.addEventListener(pt,dt),function(){m(),d.length||r.removeEventListener(pt,dt)}}};return B}function dn(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var h=ut(r.location.hash.substr(1)),m=h.pathname,E=m===void 0?"/":m,S=h.search,U=S===void 0?"":S,C=h.hash,V=C===void 0?"":C,$=o.state||{};return[$.idx,et({pathname:E,search:U,hash:V,state:$.usr||null,key:$.key||"default"})]}var c=null;function u(){if(c)d.call(c),c=null;else{var h=j.Pop,m=a(),E=m[0],S=m[1];if(d.length)if(E!=null){var U=i-E;U&&(c={action:h,location:S,retry:function(){B(U*-1)}},B(U))}else process.env.NODE_ENV!=="production"&&G(!1,"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.");else R(h)}}r.addEventListener(oe,u),r.addEventListener(pn,function(){var h=a(),m=h[1];z(m)!==z(p)&&u()});var s=j.Pop,f=a(),i=f[0],p=f[1],v=nt(),d=nt();i==null&&(i=0,o.replaceState(Q({},o.state,{idx:i}),""));function A(){var h=document.querySelector("base"),m="";if(h&&h.getAttribute("href")){var E=r.location.href,S=E.indexOf("#");m=S===-1?E:E.slice(0,S)}return m}function b(h){return A()+"#"+(typeof h=="string"?h:z(h))}function x(h,m){return m===void 0&&(m=null),et(Q({pathname:p.pathname,hash:"",search:""},typeof h=="string"?ut(h):h,{state:m,key:mt()}))}function L(h,m){return[{usr:h.state,key:h.key,idx:m},b(h)]}function q(h,m,E){return!d.length||(d.call({action:h,location:m,retry:E}),!1)}function R(h){s=h;var m=a();i=m[0],p=m[1],v.call({action:s,location:p})}function P(h,m){var E=j.Push,S=x(h,m);function U(){P(h,m)}if(process.env.NODE_ENV!=="production"&&G(S.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(h)+")"),q(E,S,U)){var C=L(S,i+1),V=C[0],$=C[1];try{o.pushState(V,"",$)}catch{r.location.assign($)}R(E)}}function k(h,m){var E=j.Replace,S=x(h,m);function U(){k(h,m)}if(process.env.NODE_ENV!=="production"&&G(S.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(h)+")"),q(E,S,U)){var C=L(S,i),V=C[0],$=C[1];o.replaceState(V,"",$),R(E)}}function B(h){o.go(h)}var g={get action(){return s},get location(){return p},createHref:b,push:P,replace:k,go:B,back:function(){B(-1)},forward:function(){B(1)},listen:function(m){return v.push(m)},block:function(m){var E=d.push(m);return d.length===1&&r.addEventListener(pt,dt),function(){E(),d.length||r.removeEventListener(pt,dt)}}};return g}function ce(t){t===void 0&&(t={});var e=t,n=e.initialEntries,r=n===void 0?["/"]:n,o=e.initialIndex,a=r.map(function(R){var P=et(Q({pathname:"/",search:"",hash:"",state:null,key:mt()},typeof R=="string"?ut(R):R));return process.env.NODE_ENV!=="production"&&G(P.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(R)+")"),P}),c=se(o??a.length-1,0,a.length-1),u=j.Pop,s=a[c],f=nt(),i=nt();function p(R){return typeof R=="string"?R:z(R)}function v(R,P){return P===void 0&&(P=null),et(Q({pathname:s.pathname,search:"",hash:""},typeof R=="string"?ut(R):R,{state:P,key:mt()}))}function d(R,P,k){return!i.length||(i.call({action:R,location:P,retry:k}),!1)}function A(R,P){u=R,s=P,f.call({action:u,location:s})}function b(R,P){var k=j.Push,B=v(R,P);function g(){b(R,P)}process.env.NODE_ENV!=="production"&&G(s.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(R)+")"),d(k,B,g)&&(c+=1,a.splice(c,a.length,B),A(k,B))}function x(R,P){var k=j.Replace,B=v(R,P);function g(){x(R,P)}process.env.NODE_ENV!=="production"&&G(s.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(R)+")"),d(k,B,g)&&(a[c]=B,A(k,B))}function L(R){var P=se(c+R,0,a.length-1),k=j.Pop,B=a[P];function g(){L(R)}d(k,B,g)&&(c=P,A(k,B))}var q={get index(){return c},get action(){return u},get location(){return s},createHref:p,push:b,replace:x,go:L,back:function(){L(-1)},forward:function(){L(1)},listen:function(P){return f.push(P)},block:function(P){return i.push(P)}};return q}function se(t,e,n){return Math.min(Math.max(t,e),n)}function dt(t){t.preventDefault(),t.returnValue=""}function nt(){var t=[];return{get length(){return t.length},push:function(n){return t.push(n),function(){t=t.filter(function(r){return r!==n})}},call:function(n){t.forEach(function(r){return r&&r(n)})}}}function mt(){return Math.random().toString(36).substr(2,8)}function z(t){var e=t.pathname,n=e===void 0?"/":e,r=t.search,o=r===void 0?"":r,a=t.hash,c=a===void 0?"":a;return o&&o!=="?"&&(n+=o.charAt(0)==="?"?o:"?"+o),c&&c!=="#"&&(n+=c.charAt(0)==="#"?c:"#"+c),n}function ut(t){var e={};if(t){var n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));var r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}class ue extends Error{constructor(e,n){super(`useRoute called with incorrect route. Given ${e}, expected ${n}`)}}const At=Symbol();function ie(){const t=l.inject(At);if(!t)throw new O;return t}const kt=Symbol();function gt(){const t=l.inject(kt);if(!t)throw new O;return t}const fe=Symbol("isRouterRouteSymbol");function mn(t){return typeof t=="object"&&t!==null&&fe in t}function gn(t,e){function n(v,d,A){if(typeof v=="object"){const x={...t.params,...v};return e(t.name,x,d)}const b={...t.params,[v]:d};return e(t.name,b,A)}const{id:r,matched:o,matches:a,name:c,query:u,params:s,state:f,hash:i}=l.toRefs(t),p=l.reactive({id:r,matched:o,matches:a,state:f,query:u,hash:i,params:s,name:c,update:n,[fe]:!0});return new Proxy(p,{get:(v,d,A)=>d==="params"?new Proxy(t.params,{set(b,x,L){return n(x,L),!0}}):d==="state"?new Proxy(t.state,{set(b,x,L){return n({},{state:{...t.state,[x]:L}}),!0}}):Reflect.get(v,d,A)})}const le=Symbol();function Rn(t,e){const n=l.reactive({...t}),r=c=>{Object.assign(n,{[le]:!1,...c})},o=n,a=gn(o,e);return{currentRoute:o,routerRoute:a,updateRoute:r}}function T(t){return!t.startsWith("http")?wn(t):yn(t)}function yn(t){const{protocol:e,host:n,pathname:r,search:o,searchParams:a,hash:c}=new URL(t,t);return{protocol:e,host:n,pathname:r,search:o,searchParams:a,hash:c}}function wn(t){const{pathname:e,search:n,searchParams:r,hash:o}=new URL(t,"https://localhost");return{pathname:e,search:n,searchParams:r,hash:o}}function vn(t){return e=>{const{host:n}=T(e);return!(n===void 0||n===t)}}function Pn({mode:t,listener:e}){const n=En(t),r=(s,f)=>{if(f!=null&&f.replace){n.replace(s,f.state);return}n.push(s,f==null?void 0:f.state)},o=()=>{const s=z(n.location);n.replace(s)};let a;return{...n,update:r,refresh:o,startListening:()=>{a==null||a(),a=n.listen(e)},stopListening:()=>{a==null||a()}}}function En(t="auto"){switch(t){case"auto":return zt()?ae():ce();case"browser":return ae();case"memory":return ce();case"hash":return dn();default:const e=t;throw new Error(`Switch is not exhaustive for mode: ${e}`)}}class Rt{constructor(){F(this,"onBeforeRouteEnter",new Set);F(this,"onBeforeRouteUpdate",new Set);F(this,"onBeforeRouteLeave",new Set);F(this,"onAfterRouteEnter",new Set);F(this,"onAfterRouteUpdate",new Set);F(this,"onAfterRouteLeave",new Set)}}class he extends Error{}class it extends Error{constructor(n){super("Error occurred during a router push operation.");F(this,"to");this.to=n}}class xt extends Error{constructor(n){super(`Routing action rejected: ${n}`);F(this,"type");this.type=n}}function Sn(t,e){const n=new Rt;return t.matches.forEach((r,o)=>{r.onBeforeRouteEnter&&Bt(t,e,o)&&X(r.onBeforeRouteEnter).forEach(a=>n.onBeforeRouteEnter.add(a)),r.onBeforeRouteUpdate&&Ut(t,e,o)&&X(r.onBeforeRouteUpdate).forEach(a=>n.onBeforeRouteUpdate.add(a))}),e.matches.forEach((r,o)=>{r.onBeforeRouteLeave&&Lt(t,e,o)&&X(r.onBeforeRouteLeave).forEach(a=>n.onBeforeRouteLeave.add(a))}),n}function bn(t,e){const n=new Rt;return t.matches.forEach((r,o)=>{r.onAfterRouteEnter&&Bt(t,e,o)&&X(r.onAfterRouteEnter).forEach(a=>n.onAfterRouteEnter.add(a)),r.onAfterRouteUpdate&&Ut(t,e,o)&&X(r.onAfterRouteUpdate).forEach(a=>n.onAfterRouteUpdate.add(a))}),e.matches.forEach((r,o)=>{r.onAfterRouteLeave&&Lt(t,e,o)&&X(r.onAfterRouteLeave).forEach(a=>n.onAfterRouteLeave.add(a))}),n}function _(t){return typeof t!="string"?!1:/^(https?:\/\/|\/).*/g.test(t)}function An(){const t=c=>{throw new xt(c)},e=(...c)=>{throw new it(c)},n=(c,u,s)=>{if(_(c)){const p=u??{};throw new it([c,{...p,replace:!0}])}const f=u,i=s??{};throw new it([c,f,{...i,replace:!0}])},r=()=>{throw new he};async function o({to:c,from:u,hooks:s}){const{global:f,component:i}=s,p=Sn(c,u),v=[...f.onBeforeRouteEnter,...p.onBeforeRouteEnter,...f.onBeforeRouteUpdate,...p.onBeforeRouteUpdate,...i.onBeforeRouteUpdate,...f.onBeforeRouteLeave,...p.onBeforeRouteLeave,...i.onBeforeRouteLeave];try{const d=v.map(A=>A(c,{from:u,reject:t,push:e,replace:n,abort:r}));await Promise.all(d)}catch(d){if(d instanceof it)return{status:"PUSH",to:d.to};if(d instanceof xt)return{status:"REJECT",type:d.type};if(d instanceof he)return{status:"ABORT"};throw d}return{status:"SUCCESS"}}async function a({to:c,from:u,hooks:s}){const{global:f,component:i}=s,p=bn(c,u),v=[...i.onAfterRouteLeave,...p.onAfterRouteLeave,...f.onAfterRouteLeave,...i.onAfterRouteUpdate,...p.onAfterRouteUpdate,...f.onAfterRouteUpdate,...i.onAfterRouteEnter,...p.onAfterRouteEnter,...f.onAfterRouteEnter];try{const d=v.map(A=>A(c,{from:u,reject:t,push:e,replace:n}));await Promise.all(d)}catch(d){if(d instanceof it)return{status:"PUSH",to:d.to};if(d instanceof xt)return{status:"REJECT",type:d.type};throw d}return{status:"SUCCESS"}}return{runBeforeRouteHooks:o,runAfterRouteHooks:a}}const Bt=(t,e,n)=>{const r=t.matches,o=(e==null?void 0:e.matches)??[];return r.length<n||r[n]!==o[n]},Lt=(t,e,n)=>{const r=t.matches,o=(e==null?void 0:e.matches)??[];return r.length<n||r[n]!==o[n]},Ut=(t,e,n)=>t.matches[n]===(e==null?void 0:e.matches[n]);function pe(t){switch(t){case"onBeforeRouteEnter":case"onAfterRouteEnter":return Bt;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return Ut;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Lt;default:throw new Error(`Switch is not exhaustive for lifecycle: ${t}`)}}function kn(){const t={global:new Rt,component:new Rt};function e({lifecycle:r,timing:o,depth:a,hook:c}){const u=pe(r),s=t[o][r],f=(i,p)=>{if(u(i,p.from,a))return c(i,p)};return s.add(f),()=>s.delete(f)}function n({lifecycle:r,timing:o,depth:a,hook:c}){const u=pe(r),s=t[o][r],f=(i,p)=>{if(u(i,p.from,a))return c(i,p)};return s.add(f),()=>s.delete(f)}return{...t,addBeforeRouteHook:e,addAfterRouteHook:n}}const de=Symbol();function xn(){const t=kn();return{onBeforeRouteEnter:u=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteEnter",hook:u,timing:"global",depth:0}),onBeforeRouteUpdate:u=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteUpdate",hook:u,timing:"global",depth:0}),onBeforeRouteLeave:u=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteLeave",hook:u,timing:"global",depth:0}),onAfterRouteEnter:u=>t.addAfterRouteHook({lifecycle:"onAfterRouteEnter",hook:u,timing:"global",depth:0}),onAfterRouteUpdate:u=>t.addAfterRouteHook({lifecycle:"onAfterRouteUpdate",hook:u,timing:"global",depth:0}),onAfterRouteLeave:u=>t.addAfterRouteHook({lifecycle:"onAfterRouteLeave",hook:u,timing:"global",depth:0}),hooks:t}}function Bn(t){return l.defineComponent(()=>()=>l.h("h1",t),{name:t,props:[]})}function me(t){const e=new URLSearchParams(t);return{get:n=>e.get(n),getAll:n=>e.getAll(n)}}function Ln(){let t=0;return()=>(++t).toString()}const Nt=Ln();function Un({rejections:t}){const e=a=>{const c={...t};return l.markRaw(c[a]??Bn(a))},n=a=>{const c=l.markRaw(e(a)),u={id:Nt(),name:a,component:c,meta:{},state:{}};return{id:u.id,matched:u,matches:[u],name:a,query:me(""),params:{},state:{},[le]:!0}},r=a=>{if(!a){o.value=null;return}const c=e(a);o.value={type:a,component:c}},o=l.ref(null);return{setRejection:r,rejection:o,getRejectionRoute:n}}class Nn extends Error{constructor(e){super(`Route not found: "${e}"`)}}function Ct(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Cn(t,e){const n=Array.from(t.matchAll(e));if(n.length===0)return[t];let r=0;const o=n.reduce((c,u)=>{const s=Ct(t.slice(r,u.index));s.length&&c.push(s);const[f]=u;return c.push(f),r=u.index+f.length,c},[]),a=t.slice(r);return a&&o.push(a),o}function jn(t){const e=ge(t.path.toString());return new RegExp(`^${e}$`,"i")}function $n(t){const e=new URLSearchParams(t.query.toString());return Array.from(e.entries()).filter(([,n])=>!$t(n)).map(([n,r])=>{const o=ge(r);return new RegExp(`${Ct(n)}=${o}(&|$)`,"i")})}function ge(t){return Cn(t,new RegExp(Hn,"g")).map(e=>e.startsWith(W)?Re(e):Ct(e)).join("")}function Re(t){return[Vn,On].reduce((e,n)=>n(e),t)}const Hn=`\\${W}\\??([\\w-_]+)\\${J}`,jt=`\\${W}\\?([\\w-_]+)\\${J}`,ye=`\\${W}([\\w-_]+)\\${J}`;function Vn(t){return t.replace(new RegExp(jt,"g"),".*")}function $t(t){return new RegExp(jt,"g").test(t)}function On(t){return t.replace(new RegExp(ye,"g"),".+")}function yt(t){const[e]=wt(t,new RegExp(jt,"g")),[n]=wt(t,new RegExp(ye,"g"));return e??n}function wt(t,e){return Array.from(t.matchAll(e)).flatMap(([,...r])=>r.map(o=>at(o)?o:""))}function we(t,e,n){const r=Pe(e,n),[o]=wt(t,r);return o}function ve(t,e){if(!e)return t;const{name:n,param:r,value:o}=e,a=Pe(t,n);return wt(t,a).reduce((u,s)=>s===void 0?u:u.replace(s,()=>st(o,r,n.startsWith("?"))),t)}function Pe(t,e){const n=[_n,qn,Re].reduce((r,o)=>o(r,e),t);return new RegExp(n,"g")}function _n(t,e){if(!e.startsWith("?"))return t;const n=new RegExp(`\\${W}\\${e}\\${J}`,"g");return t.replace(n,"(.*)")}function qn(t,e){if(e.startsWith("?"))return t;const n=new RegExp(`\\${W}${e}\\${J}`,"g");return t.replace(n,"(.+)")}function Ee(t,...e){return e.reduce((n,r)=>{if(!r)return n;const o=new URLSearchParams(r).toString();return Object.keys(o).length===0?n:n.includes("?")?`${n}&${o}`:`${n}?${o}`},t)}function Dn(t,e={}){const{params:n={},query:r}=e,o=Mn(t.host,n),a=Wn(t.path,n),c=Tn(t.query,n),u=Ee(`${o}${a}`,c,r),s=lt(t.hash.value??e.hash).toString();return`${u}${s}`}function Mn(t,e){const n=t.toString();return Object.entries(t.params).reduce((r,[o,a])=>{const c=yt(`${W}${o}${J}`);return c?ve(r,{name:o,param:a,value:e[c]}):r},n)}function Wn(t,e){const n=t.toString();return Object.entries(t.params).reduce((r,[o,a])=>{const c=yt(`${W}${o}${J}`);return c?ve(r,{name:o,param:a,value:e[c]}):r},n)}function Tn(t,e){const n=t.toString();if(!n)return{};const r=new URLSearchParams(n);return Array.from(r.entries()).reduce((o,[a,c])=>{const u=yt(c);if(!u)return{...o,[a]:c};const f=st(e[u],t.params[u],$t(c)),i=e[u]===void 0&&f==="";return $t(c)&&i?o:{...o,[a]:f}},{})}function In(t){return(e,n,r)=>{if(_(e))return Ee(e,(n??{}).query);const o=n??{},a=r??{},c=t.find(s=>s.name===e);if(!c)throw new Nn(String(e));return Dn(c,{params:o,query:a.query,hash:a.hash})}}class Fn extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Jn(t){if(t)return t;if(zt())return window.location.toString();throw new Fn}const Qn=(t,e)=>{try{Se(t,e)}catch{return!1}return!0},Se=(t,e)=>{const{pathname:n,search:r}=T(e);return{...Kn(t.path,n),...Gn(t.query,r)}};function Kn(t,e){const n={},r=decodeURIComponent(e);for(const[o,a]of Object.entries(t.params)){const c=o.startsWith("?"),u=c?o.slice(1):o,s=we(r,t.toString(),o),f=ct(s,a,c);n[u]=f}return n}function Gn(t,e){const n={},r=new URLSearchParams(e);for(const[o,a]of Object.entries(t.params)){const c=o.startsWith("?"),u=c?o.slice(1):o,s=r.get(u)??void 0,f=ct(s,a,c);n[u]=f}return n}const zn=t=>"name"in t.matched&&!!t.matched.name,Yn=(t,e)=>{const{pathname:n}=T(e);return jn(t).test(n)},Xn=(t,e)=>{const{search:n}=T(e);return $n(t).every(o=>o.test(n))},Zn=(t,e)=>{const{hash:n}=T(e),r=t.hash.toString();return!t.hash.hasValue()||r.toLowerCase()===n.toLowerCase()};function tr(t){const{searchParams:e,pathname:n}=T(t),r=-1,o=1;return(a,c)=>{const u=Ae(a,e),s=be(a,n),f=Ae(c,e),i=be(c,n);if(a.depth>c.depth)return r;if(a.depth<c.depth)return o;if(u+s>f+i)return r;if(u+s<f+i)return o;const{hash:p}=T(t);return a.hash.toString()===p?r:c.hash.toString()===p?o:0}}function be(t,e){const n=Object.keys(t.path.params).filter(o=>o.startsWith("?")).map(o=>o),r=n.filter(o=>we(e,t.path.toString(),o)===void 0);return n.length-r.length}function Ae(t,e){const n=new URLSearchParams(t.query.toString()),r=Array.from(n.keys()),o=r.filter(a=>!e.has(a));return r.length-o.length}function ke(t){return!!t&&typeof t=="object"}const vt=!0;function er(t,e,n){if(ke(t)&&e in t){const r=t[e];if(typeof r=="string")return ct(r,n,vt)}return ct(void 0,n,vt)}function nr(t,e){const n={};for(const[r,o]of Object.entries(t)){const a=er(e,r,o);n[r]=a}return n}function rr(t,e,n){if(ke(t)&&e in t){const r=t[e];return st(r,n,vt)}return st(void 0,n,vt)}const xe=(t,e)=>{const n={};for(const[r,o]of Object.entries(t)){const a=rr(e,r,o);n[r]=a}return n},or=[zn,Yn,Xn,Zn,Qn];function Ht(t,e,n){const r=tr(e),o=t.filter(s=>or.every(f=>f(s,e))).sort(r);if(o.length===0)return;const[a]=o,{search:c,hash:u}=T(e);return{id:a.id,matched:a.matched,matches:a.matches,name:a.name,query:me(c),params:Se(a,e),state:nr(a.state,n),hash:u}}function Vt(t,e){const n=new RegExp(`\\${W}(\\??[\\w-_]+)\\${J}`,"g");return Array.from(t.matchAll(n)).reduce((o,[a,c])=>{const u=yt(a);if(!u)return o;const s=ln(e,u);return Z([u],o),o[c]=s,o},{})}function Pt(t,e){return{value:t,params:Vt(t,e),toString:()=>t}}function ar(t,e){return at(e)?t.map(n=>{const r=`${e}${n.path.value}`;return{...n,path:Pt(r,n.path.params)}}):t}class cr extends Error{constructor(e){super(`Invalid Name "${e}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function sr(t){const e=t.map(({name:n})=>n);for(const n of e)if(Qt(e,n)>1)throw new cr(n)}function ur(t,e){const n=Ge(t)?t.flat():t,r=ar(n,e==null?void 0:e.base);sr(r);const o=mr(),a=In(r),c=Pn({mode:e==null?void 0:e.historyMode,listener:({location:w})=>{const N=z(w);x(N,{state:w.state})}}),{runBeforeRouteHooks:u,runAfterRouteHooks:s}=An(),{hooks:f,onBeforeRouteEnter:i,onAfterRouteUpdate:p,onBeforeRouteLeave:v,onAfterRouteEnter:d,onBeforeRouteUpdate:A,onAfterRouteLeave:b}=xn();async function x(w,N={}){if(c.stopListening(),$(w)){c.update(w,N);return}const D=Ht(r,w,N.state)??g("NotFound"),M={...m},rt=await u({to:D,from:M,hooks:f});switch(rt.status){case"ABORT":return;case"PUSH":c.update(w,N),await L(...rt.to);return;case"REJECT":c.update(w,N),k(rt.type);break;case"SUCCESS":c.update(w,N),k(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(rt)}`)}o.setProps(D),S(D);const K=await s({to:D,from:M,hooks:f});switch(K.status){case"PUSH":await L(...K.to);break;case"REJECT":k(K.type);break;case"SUCCESS":break;default:const I=K;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(I)}`)}c.startListening()}const L=(w,N,D)=>{if(_(w)){const ft={...N},Ft=a(w,ft);return x(Ft,ft)}const M={...D},K=a(w,N??{},M),I=Qe(w),It=xe((I==null?void 0:I.state)??{},M.state);return x(K,{...M,state:It})},q=(w,N,D)=>{if(_(w)){const ft={...N,replace:!0},Ft=a(w,ft);return x(Ft,ft)}const M={...D,replace:!0},K=a(w,N??{},M),I=Qe(w),It=xe((I==null?void 0:I.state)??{},M.state);return x(K,{...M,state:It})},R=w=>{k(w)},P=(w,N={})=>{if(!_(w)){const D=a(w,N);return Ht(r,D)}if(!$(w))return Ht(r,w)},{setRejection:k,rejection:B,getRejectionRoute:g}=Un(e??{}),h=g("NotFound"),{currentRoute:m,routerRoute:E,updateRoute:S}=Rn(h,L);c.startListening();const U=Jn(e==null?void 0:e.initialUrl),C=c.location.state,{host:V}=T(U),$=vn(V);let Tt=!1;async function Je(){Tt||(await x(U,{replace:!0,state:C}),Tt=!0)}function Qe(w){return r.find(N=>N.name===w)}function xr(w){w.component("RouterView",Ie),w.component("RouterLink",Te),w.provide(At,B),w.provide(de,f),w.provide($e,o),w.provide(kt,Ke),Je()}const Ke={route:E,resolve:a,push:L,replace:q,reject:R,find:P,refresh:c.refresh,forward:c.forward,back:c.back,go:c.go,install:xr,isExternal:$,onBeforeRouteEnter:i,onAfterRouteUpdate:p,onBeforeRouteLeave:v,onAfterRouteEnter:d,onBeforeRouteUpdate:A,onAfterRouteLeave:b,prefetch:e==null?void 0:e.prefetch,start:Je};return Ke}function Ot(t,e){return{value:t,params:Vt(t,e),toString:()=>t}}function Be(t,e){return{value:t,params:Vt(t,e),toString:()=>t}}function ir(t){return ot(t)&&typeof t.hash=="string"}function Le(t){return t===void 0?lt():ir(t)?t:lt(t)}function _t(t){return t===void 0?"":t}function fr(t){return ot(t)&&typeof t.value=="string"}function Ue(t){return t===void 0?Pt("",{}):fr(t)?t:Pt(t,{})}function lr(t){return ot(t)&&typeof t.value=="string"}function Ne(t){return t===void 0?Ot("",{}):lr(t)?t:Ot(t,{})}function Y(t){const e=Nt(),n=_t(t.name),r=Ue(t.path),o=Ne(t.query),a=Le(t.hash),c=t.meta??{},u=an(t)?t.state:{},s=l.markRaw({id:e,meta:{},state:{},...t}),f={id:e,matched:s,matches:[s],name:n,path:r,query:o,hash:a,meta:c,state:u,depth:1,host:Be("",{}),prefetch:t.prefetch},i=Kt(t)?Gt(t.parent,f):f;return Z(i.path.params,i.query.params),i}const Et={template:"<div>This is component</div>"},qt=Y({name:"parentA",path:"/parentA/[paramA]"}),Ce=Y({parent:qt,name:"parentA.childA",path:"/[?paramB]"}),hr=Y({parent:qt,name:"parentA.childB",path:"/[paramD]",component:Et}),pr=Y({parent:Ce,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Et});Y({name:"parentB",path:"/parentB",component:Et}),Y({name:"parentC",path:"/",component:Et});const dr={components:!0,props:!1};function je({routerPrefetch:t,routePrefetch:e,linkPrefetch:n},r){return Dt(n,r)??Dt(e,r)??Dt(t,r)??dr[r]}function Dt(t,e){return ot(t)?t[e]:t}const $e=Symbol();function mr(){const t=l.reactive(new Map),e=(s,f)=>s.matches.filter(i=>je({...f,routePrefetch:i.prefetch},"props")).flatMap(i=>c(i)).reduce((i,{id:p,name:v,props:d})=>{const A=a(p,v,s);return i[A]=d==null?void 0:d(s.params),i},{}),n=s=>{Object.entries(s).forEach(([f,i])=>{t.set(f,i)})},r=s=>{const i=s.matches.flatMap(c).reduce((p,{id:v,name:d,props:A})=>{const b=a(v,d,s);if(!A||t.has(b))return p;const x=A(s.params);return t.set(b,x),p.push(b),p},[]);u(i)},o=(s,f,i)=>{const p=a(s,f,i);return t.get(p)};function a(s,f,i){return[s,f,i.id,JSON.stringify(i.params)].join("-")}function c(s){return bt(s)?Object.entries(s.props??{}).map(([f,i])=>({id:s.id,name:f,props:i})):St(s)?[{id:s.id,name:"default",props:s.props}]:[]}function u(s){for(const f in t.keys())s.includes(f)||t.delete(f)}return{getPrefetchProps:e,setPrefetchProps:n,getProps:o,setProps:r}}function He(){const t=l.inject($e);if(!t)throw new O;return t}const gr=l.defineAsyncComponent(()=>new Promise(t=>{t({default:{template:"foo"}})}));function Ve(t){return t.name===gr.name&&"setup"in t}function Rr(t){let e={};const{getPrefetchProps:n,setPrefetchProps:r}=He();return l.watch(()=>l.toValue(t),({route:a,...c})=>{a&&(yr(a,c),e=n(a,c))},{immediate:!0}),{commit:()=>{r(e)}}}function yr(t,{routerPrefetch:e,linkPrefetch:n}){t.matches.forEach(r=>{je({routePrefetch:r.prefetch,routerPrefetch:e,linkPrefetch:n},"components")&&(St(r)&&Ve(r.component)&&r.component.setup(),bt(r)&&Object.values(r.components).forEach(a=>{Ve(a)&&a.setup()}))})}function Oe(t,e={},n={}){const r=gt(),o=l.toRef(t),a=l.computed(()=>_(o.value)?{}:l.toValue(e)),c=l.computed(()=>_(o.value)?l.toValue(e):l.toValue(n)),u=l.computed(()=>{if(_(o.value))return o.value;try{return r.resolve(o.value,a.value,c.value)}catch(b){throw b instanceof tt&&console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`,b),b}}),s=l.computed(()=>r.find(u.value,c.value)),f=l.computed(()=>!!s.value&&r.route.matches.includes(s.value.matched)),i=l.computed(()=>!!s.value&&r.route.matched===s.value.matched),p=l.computed(()=>r.isExternal(u.value)),{commit:v}=Rr(()=>({route:s.value,routerPrefetch:r.prefetch,linkPrefetch:c.value.prefetch})),d=b=>(v(),r.push(u.value,{...c.value,...b}));return{route:s,href:u,isMatch:f,isExactMatch:i,isExternal:p,push:d,replace:b=>d(b)}}function _e(t,e,{exact:n}={}){if(!mn(t))return!1;if(e===void 0)return!0;const r=t.matches.map(o=>_t(o.name));if(n){const o=r.at(-1);return e===o}return r.includes(e)}function qe(t,e){const n=gt();function r(){if(!t)return;if(!_e(n.route,t,e))throw new ue(t,n.route.name)}return l.watch(n.route,r,{immediate:!0,deep:!0}),n.route}const De=Symbol();function Mt(){return l.inject(De,0)}function Me(){const t=l.inject(de);if(!t)throw new O;return t}function We(t){return e=>{const n=Mt(),o=Me().addBeforeRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return l.onUnmounted(o),o}}function Wt(t){return e=>{const n=Mt(),o=Me().addAfterRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return l.onUnmounted(o),o}}const wr=We("onBeforeRouteUpdate"),vr=We("onBeforeRouteLeave"),Pr=Wt("onAfterRouteEnter"),Er=Wt("onAfterRouteUpdate"),Sr=Wt("onAfterRouteLeave"),br=["href"],Te=l.defineComponent({__name:"routerLink",props:{to:{},prefetch:{type:[Boolean,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(t){const e=t,n=gt(),r=l.computed(()=>_(e.to)?e.to:e.to(n.resolve)),o=l.computed(()=>{const{to:p,...v}=e;return v}),{isMatch:a,isExactMatch:c,isExternal:u,push:s}=Oe(r,o),f=l.computed(()=>({"router-link--match":a.value,"router-link--exact-match":c.value}));function i(p){p.preventDefault(),s()}return(p,v)=>(l.openBlock(),l.createElementBlock("a",{href:r.value,class:l.normalizeClass(["router-link",f.value]),onClick:i},[l.renderSlot(p.$slots,"default",l.normalizeProps(l.guardReactiveProps({resolved:r.value,isMatch:l.unref(a),isExactMatch:l.unref(c),isExternal:l.unref(u)})))],10,br))}}),Ie=l.defineComponent({__name:"routerView",props:{name:{}},setup(t){const{name:e="default"}=t,n=qe(),r=ie(),o=Mt(),{getProps:a}=He(),c=l.resolveComponent("RouterView",!0);l.provide(De,o+1);const u=l.computed(()=>{if(r.value)return r.value.component;const i=n.matches.at(o);if(!i)return null;const p=s(i),v=a(i.id,e,n);return p?v?Yt(p,()=>v):p:null});function s(i){return f(i)[e]}function f(i){return bt(i)?i.components:St(i)?{default:i.component}:typeof c=="string"?{}:{default:c}}return(i,p)=>u.value?l.renderSlot(i.$slots,"default",l.normalizeProps(l.mergeProps({key:0},{route:l.unref(n),component:u.value,rejection:l.unref(r)})),()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(u.value)))]):l.createCommentVNode("",!0)}});function Ar(t){return ot(t)&&typeof t.value=="string"}function Fe(t){return Ar(t)?t:Be(t,{})}function kr(t){const e=Nt(),n=_t(t.name),r=Ue(t.path),o=Ne(t.query),a=Le(t.hash),c=t.meta??{},u=on(t)?Fe(t.host):Fe(""),s=l.markRaw({id:e,meta:{},state:{},...t}),f={id:e,matched:s,matches:[s],name:n,host:u,path:r,query:o,hash:a,meta:c,depth:1,state:{}},i=Kt(t)?Gt(t.parent,f):f;return Z(i.path.params,i.query.params,i.host.params),i}y.DuplicateParamsError=Jt,y.RouterLink=Te,y.RouterNotInstalledError=O,y.RouterView=Ie,y.UseRouteInvalidError=ue,y.component=Yt,y.createExternalRoute=kr,y.createParam=re,y.createRoute=Y,y.createRouter=ur,y.isParamWithDefault=Xt,y.isRoute=_e,y.isUrl=_,y.onAfterRouteEnter=Pr,y.onAfterRouteLeave=Er,y.onAfterRouteUpdate=Sr,y.onBeforeRouteLeave=wr,y.onBeforeRouteUpdate=vr,y.path=Pt,y.query=Ot,y.routerInjectionKey=kt,y.routerRejectionKey=At,y.useLink=Oe,y.useRejection=ie,y.useRoute=qe,y.useRouter=gt,y.withDefault=fn,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|