@kitbag/router 0.15.2 → 0.15.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/kitbag-router.d.ts +0 -10
- package/dist/kitbag-router.js +154 -155
- package/dist/kitbag-router.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/kitbag-router.d.ts
CHANGED
|
@@ -516,16 +516,6 @@ export declare class MetaPropertyConflict extends Error {
|
|
|
516
516
|
constructor(property?: string);
|
|
517
517
|
}
|
|
518
518
|
|
|
519
|
-
/**
|
|
520
|
-
* Registers a hook that is called after a route has been entered. Must be called during setup.
|
|
521
|
-
* This allows performing actions right after the component becomes active, such as fetching data or setting up event listeners.
|
|
522
|
-
*
|
|
523
|
-
* @param AfterRouteHook - The hook callback function
|
|
524
|
-
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
525
|
-
* @group Hooks
|
|
526
|
-
*/
|
|
527
|
-
export declare const onAfterRouteEnter: AddAfterRouteHook;
|
|
528
|
-
|
|
529
519
|
/**
|
|
530
520
|
* Registers a hook that is called after a route has been left. Must be called during setup.
|
|
531
521
|
* This can be used for cleanup actions after the component is no longer active, ensuring proper resource management.
|
package/dist/kitbag-router.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var ir = Object.defineProperty;
|
|
2
2
|
var fr = (e, t, r) => t in e ? ir(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var M = (e, t, r) => fr(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { inject as ce, toRefs as lr, computed as N, reactive as Ne, defineComponent as ue, h as te, ref as De, markRaw as be, watch as le, onUnmounted as Ve, defineAsyncComponent as hr, toValue as H, openBlock as
|
|
4
|
+
import { inject as ce, toRefs as lr, computed as N, reactive as Ne, defineComponent as ue, h as te, ref as De, markRaw as be, watch as le, onUnmounted as Ve, defineAsyncComponent as hr, toValue as H, openBlock as yt, createElementBlock as dr, normalizeClass as pr, renderSlot as gt, normalizeProps as wt, guardReactiveProps as mr, unref as fe, getCurrentInstance as Rr, resolveComponent as vr, provide as yr, mergeProps as gr, createBlock as wr, resolveDynamicComponent as Er, createCommentVNode as Pr } from "vue";
|
|
5
5
|
function T(e) {
|
|
6
6
|
return typeof e != "string" ? !1 : /^(https?:\/\/|\/).*/g.test(e);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function Et(e) {
|
|
9
9
|
return T(e) ? e : `/${e}`;
|
|
10
10
|
}
|
|
11
11
|
class br extends Error {
|
|
@@ -38,9 +38,9 @@ class Ar extends Error {
|
|
|
38
38
|
super(`useRoute called with incorrect route. Given ${t}, expected ${r}`);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
const
|
|
41
|
+
const Pt = Symbol();
|
|
42
42
|
function Fe() {
|
|
43
|
-
const e = ce(
|
|
43
|
+
const e = ce(Pt);
|
|
44
44
|
if (!e)
|
|
45
45
|
throw new Re();
|
|
46
46
|
return e;
|
|
@@ -70,13 +70,13 @@ function Lr(e, t) {
|
|
|
70
70
|
function re(e) {
|
|
71
71
|
return Array.isArray(e) ? e : [e];
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function bt(e, t) {
|
|
74
74
|
return e.filter((r) => t === r).length;
|
|
75
75
|
}
|
|
76
76
|
function ie(...e) {
|
|
77
77
|
const t = e.flatMap((r) => Array.isArray(r) ? r : Object.keys(r).map(Ur));
|
|
78
78
|
for (const r of t)
|
|
79
|
-
if (
|
|
79
|
+
if (bt(t, r) > 1)
|
|
80
80
|
throw new br(r);
|
|
81
81
|
}
|
|
82
82
|
function Ur(e) {
|
|
@@ -100,7 +100,7 @@ function Nr(e, t) {
|
|
|
100
100
|
function Vr(e) {
|
|
101
101
|
return "host" in e && !!e.host;
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function St(e) {
|
|
104
104
|
return "parent" in e && !!e.parent;
|
|
105
105
|
}
|
|
106
106
|
function Me(e) {
|
|
@@ -112,7 +112,7 @@ function Te(e) {
|
|
|
112
112
|
function Hr(e) {
|
|
113
113
|
return "state" in e && !!e.state;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function At(e, t) {
|
|
116
116
|
return {
|
|
117
117
|
...t,
|
|
118
118
|
path: Br(e.path, t.path),
|
|
@@ -160,7 +160,7 @@ const _ = {
|
|
|
160
160
|
throw t();
|
|
161
161
|
return e;
|
|
162
162
|
}
|
|
163
|
-
},
|
|
163
|
+
}, kt = {
|
|
164
164
|
get: (e, { invalid: t }) => {
|
|
165
165
|
if (e === "true")
|
|
166
166
|
return !0;
|
|
@@ -173,7 +173,7 @@ const _ = {
|
|
|
173
173
|
throw t();
|
|
174
174
|
return e.toString();
|
|
175
175
|
}
|
|
176
|
-
},
|
|
176
|
+
}, xt = {
|
|
177
177
|
get: (e, { invalid: t }) => {
|
|
178
178
|
const r = Number(e);
|
|
179
179
|
if (isNaN(r))
|
|
@@ -185,7 +185,7 @@ const _ = {
|
|
|
185
185
|
throw t();
|
|
186
186
|
return e.toString();
|
|
187
187
|
}
|
|
188
|
-
},
|
|
188
|
+
}, Lt = {
|
|
189
189
|
get: (e, { invalid: t }) => {
|
|
190
190
|
const r = new Date(e);
|
|
191
191
|
if (isNaN(r.getTime()))
|
|
@@ -197,7 +197,7 @@ const _ = {
|
|
|
197
197
|
throw t();
|
|
198
198
|
return e.toISOString();
|
|
199
199
|
}
|
|
200
|
-
},
|
|
200
|
+
}, Ut = {
|
|
201
201
|
get: (e, { invalid: t }) => {
|
|
202
202
|
try {
|
|
203
203
|
return JSON.parse(e);
|
|
@@ -224,13 +224,13 @@ function de(e, t, r = !1) {
|
|
|
224
224
|
if (t === String)
|
|
225
225
|
return Ir.get(e, _);
|
|
226
226
|
if (t === Boolean)
|
|
227
|
-
return
|
|
227
|
+
return kt.get(e, _);
|
|
228
228
|
if (t === Number)
|
|
229
|
-
return
|
|
229
|
+
return xt.get(e, _);
|
|
230
230
|
if (t === Date)
|
|
231
|
-
return
|
|
231
|
+
return Lt.get(e, _);
|
|
232
232
|
if (t === JSON)
|
|
233
|
-
return
|
|
233
|
+
return Ut.get(e, _);
|
|
234
234
|
if ($r(t))
|
|
235
235
|
return t(e, _);
|
|
236
236
|
if (He(t))
|
|
@@ -249,13 +249,13 @@ function pe(e, t, r = !1) {
|
|
|
249
249
|
throw new he();
|
|
250
250
|
}
|
|
251
251
|
if (t === Boolean)
|
|
252
|
-
return
|
|
252
|
+
return kt.set(e, _);
|
|
253
253
|
if (t === Number)
|
|
254
|
-
return
|
|
254
|
+
return xt.set(e, _);
|
|
255
255
|
if (t === Date)
|
|
256
|
-
return
|
|
256
|
+
return Lt.set(e, _);
|
|
257
257
|
if (t === JSON)
|
|
258
|
-
return
|
|
258
|
+
return Ut.set(e, _);
|
|
259
259
|
if (He(t))
|
|
260
260
|
return t.set(e, _);
|
|
261
261
|
try {
|
|
@@ -298,8 +298,8 @@ function Y(e, t) {
|
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
-
var Ae = "beforeunload", Dr = "hashchange",
|
|
302
|
-
function
|
|
301
|
+
var Ae = "beforeunload", Dr = "hashchange", Bt = "popstate";
|
|
302
|
+
function at(e) {
|
|
303
303
|
e === void 0 && (e = {});
|
|
304
304
|
var t = e, r = t.window, n = r === void 0 ? document.defaultView : r, o = n.history;
|
|
305
305
|
function a() {
|
|
@@ -340,7 +340,7 @@ function st(e) {
|
|
|
340
340
|
A(d);
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
n.addEventListener(
|
|
343
|
+
n.addEventListener(Bt, f);
|
|
344
344
|
var u = V.Pop, c = a(), l = c[0], v = c[1], E = ae(), P = ae();
|
|
345
345
|
l == null && (l = 0, o.replaceState(z({}, o.state, {
|
|
346
346
|
idx: l
|
|
@@ -478,7 +478,7 @@ function Fr(e) {
|
|
|
478
478
|
R(h);
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
-
n.addEventListener(
|
|
481
|
+
n.addEventListener(Bt, f), n.addEventListener(Dr, function() {
|
|
482
482
|
var h = a(), g = h[1];
|
|
483
483
|
X(g) !== X(v) && f();
|
|
484
484
|
});
|
|
@@ -586,7 +586,7 @@ function Fr(e) {
|
|
|
586
586
|
};
|
|
587
587
|
return d;
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function st(e) {
|
|
590
590
|
e === void 0 && (e = {});
|
|
591
591
|
var t = e, r = t.initialEntries, n = r === void 0 ? ["/"] : r, o = t.initialIndex, a = n.map(function(R) {
|
|
592
592
|
var w = oe(z({
|
|
@@ -597,7 +597,7 @@ function ct(e) {
|
|
|
597
597
|
key: xe()
|
|
598
598
|
}, typeof R == "string" ? me(R) : R));
|
|
599
599
|
return process.env.NODE_ENV !== "production" && Y(w.pathname.charAt(0) === "/", "Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: " + JSON.stringify(R) + ")"), w;
|
|
600
|
-
}), s =
|
|
600
|
+
}), s = ct(o ?? a.length - 1, 0, a.length - 1), f = V.Pop, u = a[s], c = ae(), l = ae();
|
|
601
601
|
function v(R) {
|
|
602
602
|
return typeof R == "string" ? R : X(R);
|
|
603
603
|
}
|
|
@@ -639,7 +639,7 @@ function ct(e) {
|
|
|
639
639
|
process.env.NODE_ENV !== "production" && Y(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(R) + ")"), P(S, k, d) && (a[s] = k, m(S, k));
|
|
640
640
|
}
|
|
641
641
|
function p(R) {
|
|
642
|
-
var w =
|
|
642
|
+
var w = ct(s + R, 0, a.length - 1), S = V.Pop, k = a[w];
|
|
643
643
|
function d() {
|
|
644
644
|
p(R);
|
|
645
645
|
}
|
|
@@ -674,7 +674,7 @@ function ct(e) {
|
|
|
674
674
|
};
|
|
675
675
|
return A;
|
|
676
676
|
}
|
|
677
|
-
function
|
|
677
|
+
function ct(e, t, r) {
|
|
678
678
|
return Math.min(Math.max(e, t), r);
|
|
679
679
|
}
|
|
680
680
|
function ke(e) {
|
|
@@ -717,16 +717,16 @@ function me(e) {
|
|
|
717
717
|
}
|
|
718
718
|
return t;
|
|
719
719
|
}
|
|
720
|
-
const
|
|
720
|
+
const Ct = Symbol();
|
|
721
721
|
function Mr() {
|
|
722
|
-
const e = ce(
|
|
722
|
+
const e = ce(Ct);
|
|
723
723
|
if (!e)
|
|
724
724
|
throw new Re();
|
|
725
725
|
return e;
|
|
726
726
|
}
|
|
727
|
-
const
|
|
727
|
+
const Nt = Symbol("isRouterRouteSymbol");
|
|
728
728
|
function Tr(e) {
|
|
729
|
-
return typeof e == "object" && e !== null &&
|
|
729
|
+
return typeof e == "object" && e !== null && Nt in e;
|
|
730
730
|
}
|
|
731
731
|
function Wr(e, t) {
|
|
732
732
|
function r(i, p, A) {
|
|
@@ -806,14 +806,14 @@ function Wr(e, t) {
|
|
|
806
806
|
name: c,
|
|
807
807
|
href: v,
|
|
808
808
|
update: r,
|
|
809
|
-
[
|
|
809
|
+
[Nt]: !0
|
|
810
810
|
});
|
|
811
811
|
}
|
|
812
|
-
const
|
|
812
|
+
const Vt = Symbol();
|
|
813
813
|
function Jr(e, t) {
|
|
814
814
|
const r = Ne({ ...e }), n = (s) => {
|
|
815
815
|
Object.assign(r, {
|
|
816
|
-
[
|
|
816
|
+
[Vt]: !1,
|
|
817
817
|
...s
|
|
818
818
|
});
|
|
819
819
|
}, o = r, a = Wr(o, t);
|
|
@@ -879,11 +879,11 @@ function Kr({ mode: e, listener: t }) {
|
|
|
879
879
|
function Yr(e = "auto") {
|
|
880
880
|
switch (e) {
|
|
881
881
|
case "auto":
|
|
882
|
-
return We() ?
|
|
882
|
+
return We() ? at() : st();
|
|
883
883
|
case "browser":
|
|
884
|
-
return
|
|
884
|
+
return at();
|
|
885
885
|
case "memory":
|
|
886
|
-
return
|
|
886
|
+
return st();
|
|
887
887
|
case "hash":
|
|
888
888
|
return Fr();
|
|
889
889
|
default:
|
|
@@ -891,7 +891,7 @@ function Yr(e = "auto") {
|
|
|
891
891
|
throw new Error(`Switch is not exhaustive for mode: ${t}`);
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
|
-
class
|
|
894
|
+
class Ht extends Error {
|
|
895
895
|
constructor() {
|
|
896
896
|
super("Uncaught CallbackContextAbortError");
|
|
897
897
|
M(this, "response");
|
|
@@ -912,7 +912,7 @@ class Le extends Error {
|
|
|
912
912
|
this.response = { status: "REJECT", type: r };
|
|
913
913
|
}
|
|
914
914
|
}
|
|
915
|
-
function
|
|
915
|
+
function jt() {
|
|
916
916
|
return { reject: (o) => {
|
|
917
917
|
throw new Le(o);
|
|
918
918
|
}, push: (...o) => {
|
|
@@ -925,7 +925,7 @@ function $t() {
|
|
|
925
925
|
const f = a, u = s ?? {};
|
|
926
926
|
throw new ne([o, f, { ...u, replace: !0 }]);
|
|
927
927
|
}, abort: () => {
|
|
928
|
-
throw new
|
|
928
|
+
throw new Ht();
|
|
929
929
|
} };
|
|
930
930
|
}
|
|
931
931
|
class Z {
|
|
@@ -941,16 +941,16 @@ class Z {
|
|
|
941
941
|
const ye = (e, t, r) => {
|
|
942
942
|
var a, s;
|
|
943
943
|
const n = e.matches, o = (t == null ? void 0 : t.matches) ?? [];
|
|
944
|
-
return
|
|
944
|
+
return ((a = n.at(r)) == null ? void 0 : a.id) !== ((s = o.at(r)) == null ? void 0 : s.id);
|
|
945
945
|
}, ge = (e, t, r) => {
|
|
946
946
|
var a, s;
|
|
947
947
|
const n = e.matches, o = (t == null ? void 0 : t.matches) ?? [];
|
|
948
|
-
return
|
|
948
|
+
return ((a = n.at(r)) == null ? void 0 : a.id) !== ((s = o.at(r)) == null ? void 0 : s.id);
|
|
949
949
|
}, we = (e, t, r) => {
|
|
950
950
|
var n, o;
|
|
951
951
|
return ((n = e.matches.at(r)) == null ? void 0 : n.id) === ((o = t == null ? void 0 : t.matches.at(r)) == null ? void 0 : o.id);
|
|
952
952
|
};
|
|
953
|
-
function
|
|
953
|
+
function ut(e) {
|
|
954
954
|
switch (e) {
|
|
955
955
|
case "onBeforeRouteEnter":
|
|
956
956
|
case "onAfterRouteEnter":
|
|
@@ -997,12 +997,12 @@ function tn(e, t, r) {
|
|
|
997
997
|
ge(e, t, a) && r.onAfterRouteLeave.forEach((s) => n.onAfterRouteLeave.add(s));
|
|
998
998
|
}), n;
|
|
999
999
|
}
|
|
1000
|
-
const
|
|
1000
|
+
const $t = Symbol();
|
|
1001
1001
|
function rn() {
|
|
1002
1002
|
const e = {
|
|
1003
1003
|
global: new Z(),
|
|
1004
1004
|
component: new Z()
|
|
1005
|
-
}, { reject: t, push: r, replace: n, abort: o } =
|
|
1005
|
+
}, { reject: t, push: r, replace: n, abort: o } = jt(), a = (i) => (e.global.onBeforeRouteEnter.add(i), () => e.global.onBeforeRouteEnter.delete(i)), s = (i) => (e.global.onBeforeRouteUpdate.add(i), () => e.global.onBeforeRouteUpdate.delete(i)), f = (i) => (e.global.onBeforeRouteLeave.add(i), () => e.global.onBeforeRouteLeave.delete(i)), u = (i) => (e.global.onAfterRouteEnter.add(i), () => e.global.onAfterRouteEnter.delete(i)), c = (i) => (e.global.onAfterRouteUpdate.add(i), () => e.global.onAfterRouteUpdate.delete(i)), l = (i) => (e.global.onAfterRouteLeave.add(i), () => e.global.onAfterRouteLeave.delete(i));
|
|
1006
1006
|
async function v({ to: i, from: p }) {
|
|
1007
1007
|
const { global: A, component: R } = e, w = Xr(i, p), S = en(i, p, A), k = [
|
|
1008
1008
|
...S.onBeforeRouteEnter,
|
|
@@ -1024,7 +1024,7 @@ function rn() {
|
|
|
1024
1024
|
}));
|
|
1025
1025
|
await Promise.all(d);
|
|
1026
1026
|
} catch (d) {
|
|
1027
|
-
if (d instanceof ne || d instanceof Le || d instanceof
|
|
1027
|
+
if (d instanceof ne || d instanceof Le || d instanceof Ht)
|
|
1028
1028
|
return d.response;
|
|
1029
1029
|
throw d;
|
|
1030
1030
|
}
|
|
@@ -1065,14 +1065,14 @@ function rn() {
|
|
|
1065
1065
|
runBeforeRouteHooks: v,
|
|
1066
1066
|
runAfterRouteHooks: E,
|
|
1067
1067
|
addComponentBeforeRouteHook: ({ lifecycle: i, depth: p, hook: A }) => {
|
|
1068
|
-
const R =
|
|
1068
|
+
const R = ut(i), w = e.component[i], S = (k, d) => {
|
|
1069
1069
|
if (R(k, d.from, p))
|
|
1070
1070
|
return A(k, d);
|
|
1071
1071
|
};
|
|
1072
1072
|
return w.add(S), () => w.delete(S);
|
|
1073
1073
|
},
|
|
1074
1074
|
addComponentAfterRouteHook: ({ lifecycle: i, depth: p, hook: A }) => {
|
|
1075
|
-
const R =
|
|
1075
|
+
const R = ut(i), w = e.component[i], S = (k, d) => {
|
|
1076
1076
|
if (R(k, d.from, p))
|
|
1077
1077
|
return A(k, d);
|
|
1078
1078
|
};
|
|
@@ -1151,7 +1151,7 @@ function sn(e) {
|
|
|
1151
1151
|
state: {},
|
|
1152
1152
|
href: "/",
|
|
1153
1153
|
hash: "",
|
|
1154
|
-
[
|
|
1154
|
+
[Vt]: !0
|
|
1155
1155
|
};
|
|
1156
1156
|
}, n = (a) => {
|
|
1157
1157
|
if (!a) {
|
|
@@ -1179,18 +1179,18 @@ function un(e) {
|
|
|
1179
1179
|
return window.location.toString();
|
|
1180
1180
|
throw new cn();
|
|
1181
1181
|
}
|
|
1182
|
-
function
|
|
1182
|
+
function _t(e) {
|
|
1183
1183
|
return !!e && typeof e == "object";
|
|
1184
1184
|
}
|
|
1185
1185
|
const Ue = !0;
|
|
1186
1186
|
function fn(e, t, r) {
|
|
1187
|
-
if (
|
|
1187
|
+
if (_t(e) && t in e) {
|
|
1188
1188
|
const n = e[t];
|
|
1189
1189
|
return typeof n == "string" ? de(n, r, Ue) : n;
|
|
1190
1190
|
}
|
|
1191
1191
|
return de(void 0, r, Ue);
|
|
1192
1192
|
}
|
|
1193
|
-
function
|
|
1193
|
+
function qt(e, t) {
|
|
1194
1194
|
const r = {};
|
|
1195
1195
|
for (const [n, o] of Object.entries(e)) {
|
|
1196
1196
|
const a = fn(t, n, o);
|
|
@@ -1199,13 +1199,13 @@ function It(e, t) {
|
|
|
1199
1199
|
return r;
|
|
1200
1200
|
}
|
|
1201
1201
|
function ln(e, t, r) {
|
|
1202
|
-
if (
|
|
1202
|
+
if (_t(e) && t in e) {
|
|
1203
1203
|
const n = e[t];
|
|
1204
1204
|
return pe(n, r, Ue);
|
|
1205
1205
|
}
|
|
1206
1206
|
return pe(void 0, r, Ue);
|
|
1207
1207
|
}
|
|
1208
|
-
const
|
|
1208
|
+
const it = (e, t) => {
|
|
1209
1209
|
const r = {};
|
|
1210
1210
|
for (const [n, o] of Object.entries(e)) {
|
|
1211
1211
|
const a = ln(t, n, o);
|
|
@@ -1235,9 +1235,9 @@ function hn() {
|
|
|
1235
1235
|
isElementVisible: a
|
|
1236
1236
|
};
|
|
1237
1237
|
}
|
|
1238
|
-
const
|
|
1238
|
+
const It = Symbol("visibilityObserver");
|
|
1239
1239
|
function dn(e) {
|
|
1240
|
-
const t = ce(
|
|
1240
|
+
const t = ce(It);
|
|
1241
1241
|
if (!t)
|
|
1242
1242
|
throw new Re();
|
|
1243
1243
|
return le(e, (n, o) => {
|
|
@@ -1270,26 +1270,26 @@ function mn(e, t) {
|
|
|
1270
1270
|
return a && o.push(a), o;
|
|
1271
1271
|
}
|
|
1272
1272
|
function Rn(e) {
|
|
1273
|
-
const t =
|
|
1273
|
+
const t = Ot(e.path.value);
|
|
1274
1274
|
return new RegExp(`^${t}$`, "i");
|
|
1275
1275
|
}
|
|
1276
1276
|
function vn(e) {
|
|
1277
1277
|
const t = new URLSearchParams(e.query.value);
|
|
1278
1278
|
return Array.from(t.entries()).filter(([, r]) => !Ye(r)).map(([r, n]) => {
|
|
1279
|
-
const o =
|
|
1279
|
+
const o = Ot(n);
|
|
1280
1280
|
return new RegExp(`${ze(r)}=${o}(&|$)`, "i");
|
|
1281
1281
|
});
|
|
1282
1282
|
}
|
|
1283
|
-
function
|
|
1284
|
-
return mn(e, new RegExp(yn, "g")).map((t) => t.startsWith(G) ?
|
|
1283
|
+
function Ot(e) {
|
|
1284
|
+
return mn(e, new RegExp(yn, "g")).map((t) => t.startsWith(G) ? Dt(t) : ze(t)).join("");
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1286
|
+
function Dt(e) {
|
|
1287
1287
|
return [
|
|
1288
1288
|
gn,
|
|
1289
1289
|
wn
|
|
1290
1290
|
].reduce((t, r) => r(t), e);
|
|
1291
1291
|
}
|
|
1292
|
-
const yn = `\\${G}\\??([\\w-_]+)\\${K}`, Ke = `\\${G}\\?([\\w-_]+)\\${K}`,
|
|
1292
|
+
const yn = `\\${G}\\??([\\w-_]+)\\${K}`, Ke = `\\${G}\\?([\\w-_]+)\\${K}`, Ft = `\\${G}([\\w-_]+)\\${K}`;
|
|
1293
1293
|
function gn(e) {
|
|
1294
1294
|
return e.replace(new RegExp(Ke, "g"), ".*");
|
|
1295
1295
|
}
|
|
@@ -1297,30 +1297,30 @@ function Ye(e) {
|
|
|
1297
1297
|
return new RegExp(Ke, "g").test(e);
|
|
1298
1298
|
}
|
|
1299
1299
|
function wn(e) {
|
|
1300
|
-
return e.replace(new RegExp(
|
|
1300
|
+
return e.replace(new RegExp(Ft, "g"), ".+");
|
|
1301
1301
|
}
|
|
1302
1302
|
function Ee(e) {
|
|
1303
|
-
const [t] = Be(e, new RegExp(Ke, "g")), [r] = Be(e, new RegExp(
|
|
1303
|
+
const [t] = Be(e, new RegExp(Ke, "g")), [r] = Be(e, new RegExp(Ft, "g"));
|
|
1304
1304
|
return t ?? r;
|
|
1305
1305
|
}
|
|
1306
1306
|
function Be(e, t) {
|
|
1307
1307
|
return Array.from(e.matchAll(t)).flatMap(([, ...n]) => n.map((o) => J(o) ? o : ""));
|
|
1308
1308
|
}
|
|
1309
|
-
function
|
|
1310
|
-
const n =
|
|
1309
|
+
function Mt(e, t, r) {
|
|
1310
|
+
const n = Wt(t, r), [o] = Be(e, n);
|
|
1311
1311
|
return o;
|
|
1312
1312
|
}
|
|
1313
|
-
function
|
|
1313
|
+
function Tt(e, t) {
|
|
1314
1314
|
if (!t)
|
|
1315
1315
|
return e;
|
|
1316
|
-
const { name: r, param: n, value: o } = t, a =
|
|
1316
|
+
const { name: r, param: n, value: o } = t, a = Wt(e, r);
|
|
1317
1317
|
return Be(e, a).reduce((f, u) => u === void 0 ? f : f.replace(u, () => pe(o, n, r.startsWith("?"))), e);
|
|
1318
1318
|
}
|
|
1319
|
-
function
|
|
1319
|
+
function Wt(e, t) {
|
|
1320
1320
|
const r = [
|
|
1321
1321
|
En,
|
|
1322
1322
|
Pn,
|
|
1323
|
-
|
|
1323
|
+
Dt
|
|
1324
1324
|
].reduce((n, o) => o(n, t), e);
|
|
1325
1325
|
return new RegExp(r, "g");
|
|
1326
1326
|
}
|
|
@@ -1336,11 +1336,11 @@ function Pn(e, t) {
|
|
|
1336
1336
|
const r = new RegExp(`\\${G}${t}\\${K}`, "g");
|
|
1337
1337
|
return e.replace(r, "(.+)");
|
|
1338
1338
|
}
|
|
1339
|
-
function
|
|
1339
|
+
function Jt({ protocol: e, host: t, pathname: r, search: n, searchParams: o, hash: a }) {
|
|
1340
1340
|
const s = new URL("https://localhost");
|
|
1341
1341
|
e && (s.protocol = e), t && (s.host = t), r && (s.pathname = r), o ? s.search = new URLSearchParams(o).toString() : n && (s.search = n), a && (s.hash = a);
|
|
1342
1342
|
const f = s.toString().replace(/^https:\/\/localhost\/*/, "/");
|
|
1343
|
-
return
|
|
1343
|
+
return Et(f);
|
|
1344
1344
|
}
|
|
1345
1345
|
function Xe(...e) {
|
|
1346
1346
|
const t = new URLSearchParams();
|
|
@@ -1353,19 +1353,19 @@ function Xe(...e) {
|
|
|
1353
1353
|
}
|
|
1354
1354
|
function bn(e, t = {}) {
|
|
1355
1355
|
const { params: r = {}, query: n } = t, o = kn(e.query, r), a = Xe(o, n), s = An(e.path, r), f = Se(e.hash.value ?? t.hash).value, u = Sn(e.host, r), { protocol: c, host: l } = q(u);
|
|
1356
|
-
return
|
|
1356
|
+
return Jt({ protocol: c, host: l, pathname: s, searchParams: a, hash: f });
|
|
1357
1357
|
}
|
|
1358
1358
|
function Sn(e, t) {
|
|
1359
1359
|
const r = e.value && !e.value.startsWith("http") ? `https://${e.value}` : e.value;
|
|
1360
1360
|
return Object.entries(e.params).reduce((n, [o, a]) => {
|
|
1361
1361
|
const s = Ee(`${G}${o}${K}`);
|
|
1362
|
-
return s ?
|
|
1362
|
+
return s ? Tt(n, { name: o, param: a, value: t[s] }) : n;
|
|
1363
1363
|
}, r);
|
|
1364
1364
|
}
|
|
1365
1365
|
function An(e, t) {
|
|
1366
1366
|
return Object.entries(e.params).reduce((r, [n, o]) => {
|
|
1367
1367
|
const a = Ee(`${G}${n}${K}`);
|
|
1368
|
-
return a ?
|
|
1368
|
+
return a ? Tt(r, { name: n, param: o, value: t[a] }) : r;
|
|
1369
1369
|
}, e.value);
|
|
1370
1370
|
}
|
|
1371
1371
|
function kn(e, t) {
|
|
@@ -1398,7 +1398,7 @@ const xn = (e, t) => {
|
|
|
1398
1398
|
function Ln(e, t) {
|
|
1399
1399
|
const r = {}, n = decodeURIComponent(t);
|
|
1400
1400
|
for (const [o, a] of Object.entries(e.params)) {
|
|
1401
|
-
const s = o.startsWith("?"), f = s ? o.slice(1) : o, u =
|
|
1401
|
+
const s = o.startsWith("?"), f = s ? o.slice(1) : o, u = Mt(n, e.value, o), c = de(u, a, s);
|
|
1402
1402
|
r[f] = c;
|
|
1403
1403
|
}
|
|
1404
1404
|
return r;
|
|
@@ -1427,7 +1427,7 @@ function Bn(e, t = {}, r = {}) {
|
|
|
1427
1427
|
name: e.name,
|
|
1428
1428
|
query: Je(o),
|
|
1429
1429
|
params: Ze(e, n),
|
|
1430
|
-
state:
|
|
1430
|
+
state: qt(e.state, r.state),
|
|
1431
1431
|
hash: a,
|
|
1432
1432
|
href: n
|
|
1433
1433
|
};
|
|
@@ -1445,15 +1445,15 @@ const Cn = (e) => "name" in e.matched && !!e.matched.name, Nn = (e, t) => {
|
|
|
1445
1445
|
function Hn(e) {
|
|
1446
1446
|
const { searchParams: t, pathname: r } = q(e), n = -1, o = 1;
|
|
1447
1447
|
return (a, s) => {
|
|
1448
|
-
const f =
|
|
1448
|
+
const f = lt(a, t), u = ft(a, r), c = lt(s, t), l = ft(s, r);
|
|
1449
1449
|
return a.depth > s.depth ? n : a.depth < s.depth ? o : f + u > c + l ? n : f + u < c + l ? o : Ie(a, e) ? n : Ie(s, e) ? o : 0;
|
|
1450
1450
|
};
|
|
1451
1451
|
}
|
|
1452
|
-
function
|
|
1453
|
-
const r = Object.keys(e.path.params).filter((o) => o.startsWith("?")).map((o) => o), n = r.filter((o) =>
|
|
1452
|
+
function ft(e, t) {
|
|
1453
|
+
const r = Object.keys(e.path.params).filter((o) => o.startsWith("?")).map((o) => o), n = r.filter((o) => Mt(t, e.path.value, o) === void 0);
|
|
1454
1454
|
return r.length - n.length;
|
|
1455
1455
|
}
|
|
1456
|
-
function
|
|
1456
|
+
function lt(e, t) {
|
|
1457
1457
|
const r = new URLSearchParams(t), n = new URLSearchParams(e.query.value), o = Array.from(n.keys()), a = o.filter((s) => !r.has(s));
|
|
1458
1458
|
return o.length - a.length;
|
|
1459
1459
|
}
|
|
@@ -1480,14 +1480,14 @@ function _n(e, t, r) {
|
|
|
1480
1480
|
name: o.name,
|
|
1481
1481
|
query: Je(a),
|
|
1482
1482
|
params: Ze(o, t),
|
|
1483
|
-
state:
|
|
1483
|
+
state: qt(o.state, r),
|
|
1484
1484
|
hash: s,
|
|
1485
|
-
href:
|
|
1485
|
+
href: Et(t)
|
|
1486
1486
|
};
|
|
1487
1487
|
}
|
|
1488
|
-
function
|
|
1488
|
+
function ht(e, t) {
|
|
1489
1489
|
const r = typeof e == "string" ? q(e) : e, n = typeof t == "string" ? q(t) : t, o = r.searchParams ?? new URLSearchParams(r.search), a = n.searchParams ?? new URLSearchParams(n.search);
|
|
1490
|
-
return
|
|
1490
|
+
return Jt({
|
|
1491
1491
|
protocol: J(n.protocol) ? n.protocol : r.protocol,
|
|
1492
1492
|
host: J(n.host) ? n.host : r.host,
|
|
1493
1493
|
pathname: J(n.pathname) ? n.pathname : r.pathname,
|
|
@@ -1532,7 +1532,7 @@ class In extends Error {
|
|
|
1532
1532
|
function On(e) {
|
|
1533
1533
|
const t = e.map(({ name: r }) => r);
|
|
1534
1534
|
for (const r of t)
|
|
1535
|
-
if (
|
|
1535
|
+
if (bt(t, r) > 1)
|
|
1536
1536
|
throw new In(r);
|
|
1537
1537
|
}
|
|
1538
1538
|
function Dn(e, t = [], r) {
|
|
@@ -1631,17 +1631,17 @@ function ho(e, t, r = []) {
|
|
|
1631
1631
|
return Bn(O, U, W);
|
|
1632
1632
|
}, E = (b, U, W) => {
|
|
1633
1633
|
if (T(b)) {
|
|
1634
|
-
const F = { ...U }, D =
|
|
1634
|
+
const F = { ...U }, D = ht(b, {
|
|
1635
1635
|
searchParams: F.query,
|
|
1636
1636
|
hash: F.hash
|
|
1637
1637
|
});
|
|
1638
1638
|
return l(D, F);
|
|
1639
1639
|
}
|
|
1640
1640
|
if (typeof b == "string") {
|
|
1641
|
-
const { replace: F, ...D } = { ...W }, $e = { ...U }, _e = v(b, $e, D), ur =
|
|
1641
|
+
const { replace: F, ...D } = { ...W }, $e = { ...U }, _e = v(b, $e, D), ur = it({ ..._e.matched.state }, { ..._e.state, ...D.state });
|
|
1642
1642
|
return l(_e.href, { replace: F, state: ur });
|
|
1643
1643
|
}
|
|
1644
|
-
const { replace: O, ...$ } = { ...U }, Q =
|
|
1644
|
+
const { replace: O, ...$ } = { ...U }, Q = it({ ...b.matched.state }, { ...b.state, ...$.state }), je = ht(b.href, {
|
|
1645
1645
|
searchParams: $.query,
|
|
1646
1646
|
hash: $.hash
|
|
1647
1647
|
});
|
|
@@ -1676,10 +1676,10 @@ function ho(e, t, r = []) {
|
|
|
1676
1676
|
function I(b) {
|
|
1677
1677
|
return an(b) ? null : { ...R };
|
|
1678
1678
|
}
|
|
1679
|
-
function
|
|
1680
|
-
b.component("RouterView", co), b.component("RouterLink", ro), b.provide(
|
|
1679
|
+
function nt(b) {
|
|
1680
|
+
b.component("RouterView", co), b.component("RouterLink", ro), b.provide(Ct, i), b.provide($t, o), b.provide(tr, s), b.provide(It, f), b.provide(Pt, ot), C();
|
|
1681
1681
|
}
|
|
1682
|
-
const
|
|
1682
|
+
const ot = {
|
|
1683
1683
|
route: w,
|
|
1684
1684
|
resolve: v,
|
|
1685
1685
|
find: c,
|
|
@@ -1690,7 +1690,7 @@ function ho(e, t, r = []) {
|
|
|
1690
1690
|
forward: u.forward,
|
|
1691
1691
|
back: u.back,
|
|
1692
1692
|
go: u.go,
|
|
1693
|
-
install:
|
|
1693
|
+
install: nt,
|
|
1694
1694
|
isExternal: g,
|
|
1695
1695
|
onBeforeRouteEnter: o.onBeforeRouteEnter,
|
|
1696
1696
|
onBeforeRouteUpdate: o.onBeforeRouteUpdate,
|
|
@@ -1702,9 +1702,9 @@ function ho(e, t, r = []) {
|
|
|
1702
1702
|
start: C,
|
|
1703
1703
|
stop: j
|
|
1704
1704
|
};
|
|
1705
|
-
return
|
|
1705
|
+
return ot;
|
|
1706
1706
|
}
|
|
1707
|
-
function
|
|
1707
|
+
function dt(e, t) {
|
|
1708
1708
|
return {
|
|
1709
1709
|
value: e,
|
|
1710
1710
|
params: et(e, t)
|
|
@@ -1717,7 +1717,7 @@ function po(e) {
|
|
|
1717
1717
|
...e
|
|
1718
1718
|
};
|
|
1719
1719
|
}
|
|
1720
|
-
function
|
|
1720
|
+
function Gt(e, t) {
|
|
1721
1721
|
return {
|
|
1722
1722
|
value: e,
|
|
1723
1723
|
params: et(e, t)
|
|
@@ -1726,26 +1726,26 @@ function Qt(e, t) {
|
|
|
1726
1726
|
function Mn(e) {
|
|
1727
1727
|
return ve(e) && typeof e.hash == "string";
|
|
1728
1728
|
}
|
|
1729
|
-
function
|
|
1729
|
+
function Qt(e) {
|
|
1730
1730
|
return e === void 0 ? Se() : Mn(e) ? e : Se(e);
|
|
1731
1731
|
}
|
|
1732
|
-
function
|
|
1732
|
+
function zt(e) {
|
|
1733
1733
|
return e === void 0 ? "" : e;
|
|
1734
1734
|
}
|
|
1735
1735
|
function Tn(e) {
|
|
1736
1736
|
return ve(e) && typeof e.value == "string";
|
|
1737
1737
|
}
|
|
1738
|
-
function
|
|
1738
|
+
function Kt(e) {
|
|
1739
1739
|
return e === void 0 ? Oe("", {}) : Tn(e) ? e : Oe(e, {});
|
|
1740
1740
|
}
|
|
1741
1741
|
function Wn(e) {
|
|
1742
1742
|
return ve(e) && typeof e.value == "string";
|
|
1743
1743
|
}
|
|
1744
|
-
function
|
|
1745
|
-
return e === void 0 ?
|
|
1744
|
+
function Yt(e) {
|
|
1745
|
+
return e === void 0 ? dt("", {}) : Wn(e) ? e : dt(e, {});
|
|
1746
1746
|
}
|
|
1747
1747
|
function se(e) {
|
|
1748
|
-
const t = Qe(), r =
|
|
1748
|
+
const t = Qe(), r = zt(e.name), n = Kt(e.path), o = Yt(e.query), a = Qt(e.hash), s = e.meta ?? {}, f = Hr(e) ? e.state : {}, u = be({ id: t, meta: {}, state: {}, ...e }), c = {
|
|
1749
1749
|
id: t,
|
|
1750
1750
|
matched: u,
|
|
1751
1751
|
matches: [u],
|
|
@@ -1756,15 +1756,15 @@ function se(e) {
|
|
|
1756
1756
|
meta: s,
|
|
1757
1757
|
state: f,
|
|
1758
1758
|
depth: 1,
|
|
1759
|
-
host:
|
|
1759
|
+
host: Gt("", {}),
|
|
1760
1760
|
prefetch: e.prefetch
|
|
1761
|
-
}, l =
|
|
1761
|
+
}, l = St(e) ? At(e.parent, c) : c;
|
|
1762
1762
|
return ie(l.path.params, l.query.params), l;
|
|
1763
1763
|
}
|
|
1764
1764
|
const Ce = { template: "<div>This is component</div>" }, tt = se({
|
|
1765
1765
|
name: "parentA",
|
|
1766
1766
|
path: "/parentA/[paramA]"
|
|
1767
|
-
}),
|
|
1767
|
+
}), Xt = se({
|
|
1768
1768
|
parent: tt,
|
|
1769
1769
|
name: "parentA.childA",
|
|
1770
1770
|
path: "/childA/[?paramB]"
|
|
@@ -1774,7 +1774,7 @@ const Ce = { template: "<div>This is component</div>" }, tt = se({
|
|
|
1774
1774
|
path: "/childB/[paramD]",
|
|
1775
1775
|
component: Ce
|
|
1776
1776
|
}), Gn = se({
|
|
1777
|
-
parent:
|
|
1777
|
+
parent: Xt,
|
|
1778
1778
|
name: "parentA.childA.grandChildA",
|
|
1779
1779
|
path: "/[paramC]",
|
|
1780
1780
|
component: Ce
|
|
@@ -1795,7 +1795,7 @@ const Qn = "lazy", zn = {
|
|
|
1795
1795
|
function Pe(e) {
|
|
1796
1796
|
return ["eager", "lazy", "intent"].includes(e);
|
|
1797
1797
|
}
|
|
1798
|
-
function
|
|
1798
|
+
function Zt({ routerPrefetch: e, routePrefetch: t, linkPrefetch: r }, n) {
|
|
1799
1799
|
const o = qe(r, n), a = qe(t, n), s = qe(e, n), f = [
|
|
1800
1800
|
o,
|
|
1801
1801
|
a,
|
|
@@ -1808,23 +1808,23 @@ function er({ routerPrefetch: e, routePrefetch: t, linkPrefetch: r }, n) {
|
|
|
1808
1808
|
function qe(e, t) {
|
|
1809
1809
|
return ve(e) ? e[t] : e;
|
|
1810
1810
|
}
|
|
1811
|
-
function
|
|
1811
|
+
function er(e) {
|
|
1812
1812
|
return typeof e == "object" && e !== null && "then" in e;
|
|
1813
1813
|
}
|
|
1814
|
-
function
|
|
1814
|
+
function pt(e) {
|
|
1815
1815
|
try {
|
|
1816
1816
|
const t = e();
|
|
1817
|
-
return
|
|
1817
|
+
return er(t) ? t.catch((r) => r) : t;
|
|
1818
1818
|
} catch (t) {
|
|
1819
1819
|
return t;
|
|
1820
1820
|
}
|
|
1821
1821
|
}
|
|
1822
|
-
const
|
|
1822
|
+
const tr = Symbol();
|
|
1823
1823
|
function Kn() {
|
|
1824
|
-
const e = Ne(/* @__PURE__ */ new Map()), { push: t, replace: r, reject: n } =
|
|
1824
|
+
const e = Ne(/* @__PURE__ */ new Map()), { push: t, replace: r, reject: n } = jt(), o = (v, E, P) => E.matches.filter((m) => Zt({ ...P, routePrefetch: m.prefetch }, "props") === v).flatMap((m) => c(m)).reduce((m, { id: y, name: i, props: p }) => {
|
|
1825
1825
|
if (!p)
|
|
1826
1826
|
return m;
|
|
1827
|
-
const A = u(y, i, E), R =
|
|
1827
|
+
const A = u(y, i, E), R = pt(() => p(E, {
|
|
1828
1828
|
push: t,
|
|
1829
1829
|
replace: r,
|
|
1830
1830
|
reject: n
|
|
@@ -1841,7 +1841,7 @@ function Kn() {
|
|
|
1841
1841
|
continue;
|
|
1842
1842
|
const A = u(y, i, v);
|
|
1843
1843
|
if (P.push(A), !e.has(A)) {
|
|
1844
|
-
const R =
|
|
1844
|
+
const R = pt(() => p(v, {
|
|
1845
1845
|
push: t,
|
|
1846
1846
|
replace: r,
|
|
1847
1847
|
reject: n
|
|
@@ -1889,8 +1889,8 @@ function Kn() {
|
|
|
1889
1889
|
setProps: s
|
|
1890
1890
|
};
|
|
1891
1891
|
}
|
|
1892
|
-
function
|
|
1893
|
-
const e = ce(
|
|
1892
|
+
function rr() {
|
|
1893
|
+
const e = ce(tr);
|
|
1894
1894
|
if (!e)
|
|
1895
1895
|
throw new Re();
|
|
1896
1896
|
return e;
|
|
@@ -1898,10 +1898,10 @@ function nr() {
|
|
|
1898
1898
|
const Yn = hr(() => new Promise((e) => {
|
|
1899
1899
|
e({ default: { template: "foo" } });
|
|
1900
1900
|
}));
|
|
1901
|
-
function
|
|
1901
|
+
function mt(e) {
|
|
1902
1902
|
return e.name === Yn.name && "__asyncLoader" in e;
|
|
1903
1903
|
}
|
|
1904
|
-
function
|
|
1904
|
+
function Rt(e, t, r) {
|
|
1905
1905
|
le(e, (n, o) => {
|
|
1906
1906
|
n && n.addEventListener(t, r), o && o.removeEventListener(t, r);
|
|
1907
1907
|
}, { immediate: !0 }), Ve(() => {
|
|
@@ -1909,7 +1909,7 @@ function vt(e, t, r) {
|
|
|
1909
1909
|
});
|
|
1910
1910
|
}
|
|
1911
1911
|
function Xn(e) {
|
|
1912
|
-
const t = /* @__PURE__ */ new Map(), r = De(), { getPrefetchProps: n, setPrefetchProps: o } =
|
|
1912
|
+
const t = /* @__PURE__ */ new Map(), r = De(), { getPrefetchProps: n, setPrefetchProps: o } = rr(), { isElementVisible: a } = dn(r), s = () => {
|
|
1913
1913
|
const c = Array.from(t.values()).reduce((l, v) => (Object.assign(l, v), l), {});
|
|
1914
1914
|
o(c);
|
|
1915
1915
|
};
|
|
@@ -1918,7 +1918,7 @@ function Xn(e) {
|
|
|
1918
1918
|
}, { immediate: !0 }), le(a, (c) => {
|
|
1919
1919
|
const { route: l, ...v } = H(e);
|
|
1920
1920
|
!l || !c || u("lazy", l, v);
|
|
1921
|
-
}, { immediate: !0 }),
|
|
1921
|
+
}, { immediate: !0 }), Rt(r, "focusin", f), Rt(r, "mouseover", f);
|
|
1922
1922
|
function f() {
|
|
1923
1923
|
const { route: c, ...l } = H(e);
|
|
1924
1924
|
c && u("intent", c, l);
|
|
@@ -1933,15 +1933,15 @@ function Xn(e) {
|
|
|
1933
1933
|
}
|
|
1934
1934
|
function Zn(e, t, r) {
|
|
1935
1935
|
t.matches.forEach((n) => {
|
|
1936
|
-
|
|
1936
|
+
Zt({
|
|
1937
1937
|
...r,
|
|
1938
1938
|
routePrefetch: n.prefetch
|
|
1939
|
-
}, "components") === e && (Me(n) &&
|
|
1940
|
-
|
|
1939
|
+
}, "components") === e && (Me(n) && mt(n.component) && n.component.__asyncLoader(), Te(n) && Object.values(n.components).forEach((a) => {
|
|
1940
|
+
mt(a) && a.__asyncLoader();
|
|
1941
1941
|
}));
|
|
1942
1942
|
});
|
|
1943
1943
|
}
|
|
1944
|
-
function
|
|
1944
|
+
function nr(e, t, { exact: r } = {}) {
|
|
1945
1945
|
return Tr(e) ? t === void 0 ? !0 : r ? e.matched.name === t : e.matches.map((n) => n.name).includes(t) : !1;
|
|
1946
1946
|
}
|
|
1947
1947
|
function eo(e, t = {}, r = {}) {
|
|
@@ -1955,7 +1955,7 @@ function eo(e, t = {}, r = {}) {
|
|
|
1955
1955
|
if (T(m))
|
|
1956
1956
|
return m;
|
|
1957
1957
|
console.error(new Error("Failed to resolve route in RouterLink."));
|
|
1958
|
-
}), s = N(() =>
|
|
1958
|
+
}), s = N(() => nr(n.route) && n.route.matches.some((m) => {
|
|
1959
1959
|
var y;
|
|
1960
1960
|
return m.id === ((y = o.value) == null ? void 0 : y.id);
|
|
1961
1961
|
})), f = N(() => {
|
|
@@ -2024,14 +2024,14 @@ const to = ["href"], ro = /* @__PURE__ */ ue({
|
|
|
2024
2024
|
function m(y) {
|
|
2025
2025
|
y.preventDefault(), l();
|
|
2026
2026
|
}
|
|
2027
|
-
return (y, i) => (
|
|
2027
|
+
return (y, i) => (yt(), dr("a", {
|
|
2028
2028
|
ref_key: "element",
|
|
2029
2029
|
ref: s,
|
|
2030
2030
|
href: o.value,
|
|
2031
2031
|
class: pr(["router-link", v.value]),
|
|
2032
2032
|
onClick: m
|
|
2033
2033
|
}, [
|
|
2034
|
-
|
|
2034
|
+
gt(y.$slots, "default", wt(mr({ route: n.value, isMatch: fe(f), isExactMatch: fe(u), isExternal: fe(c) })))
|
|
2035
2035
|
], 10, to));
|
|
2036
2036
|
}
|
|
2037
2037
|
});
|
|
@@ -2040,14 +2040,14 @@ function no(e, t) {
|
|
|
2040
2040
|
function n() {
|
|
2041
2041
|
if (!e)
|
|
2042
2042
|
return;
|
|
2043
|
-
if (!
|
|
2043
|
+
if (!nr(r.route, e, t))
|
|
2044
2044
|
throw new Ar(e, r.route.name);
|
|
2045
2045
|
}
|
|
2046
2046
|
return le(r.route, n, { immediate: !0, deep: !0 }), r.route;
|
|
2047
2047
|
}
|
|
2048
|
-
const
|
|
2048
|
+
const or = Symbol();
|
|
2049
2049
|
function rt() {
|
|
2050
|
-
return ce(
|
|
2050
|
+
return ce(or, 0);
|
|
2051
2051
|
}
|
|
2052
2052
|
function oo(e, t) {
|
|
2053
2053
|
return ue({
|
|
@@ -2055,7 +2055,7 @@ function oo(e, t) {
|
|
|
2055
2055
|
expose: [],
|
|
2056
2056
|
setup() {
|
|
2057
2057
|
const r = t(), n = Rr();
|
|
2058
|
-
return () => r instanceof Error ? "" :
|
|
2058
|
+
return () => r instanceof Error ? "" : er(r) ? n != null && n.suspense ? te(so(e, r)) : te(ao(e, r)) : te(e, r);
|
|
2059
2059
|
}
|
|
2060
2060
|
});
|
|
2061
2061
|
}
|
|
@@ -2085,8 +2085,8 @@ const co = /* @__PURE__ */ ue({
|
|
|
2085
2085
|
name: { default: "default" }
|
|
2086
2086
|
},
|
|
2087
2087
|
setup(e) {
|
|
2088
|
-
const t = no(), r = Mr(), n = rt(), { getProps: o } =
|
|
2089
|
-
yr(
|
|
2088
|
+
const t = no(), r = Mr(), n = rt(), { getProps: o } = rr(), a = vr("RouterView", !0);
|
|
2089
|
+
yr(or, n + 1);
|
|
2090
2090
|
const s = N(() => {
|
|
2091
2091
|
if (r.value)
|
|
2092
2092
|
return r.value.component;
|
|
@@ -2102,38 +2102,38 @@ const co = /* @__PURE__ */ ue({
|
|
|
2102
2102
|
function u(c) {
|
|
2103
2103
|
return Te(c) ? c.components : Me(c) ? { default: c.component } : typeof a == "string" ? {} : { default: a };
|
|
2104
2104
|
}
|
|
2105
|
-
return (c, l) => s.value ?
|
|
2106
|
-
(
|
|
2105
|
+
return (c, l) => s.value ? gt(c.$slots, "default", wt(gr({ key: 0 }, { route: fe(t), component: s.value, rejection: fe(r) })), () => [
|
|
2106
|
+
(yt(), wr(Er(s.value)))
|
|
2107
2107
|
]) : Pr("", !0);
|
|
2108
2108
|
}
|
|
2109
2109
|
});
|
|
2110
|
-
function
|
|
2111
|
-
const e = ce(
|
|
2110
|
+
function ar() {
|
|
2111
|
+
const e = ce($t);
|
|
2112
2112
|
if (!e)
|
|
2113
2113
|
throw new Re();
|
|
2114
2114
|
return e;
|
|
2115
2115
|
}
|
|
2116
|
-
function
|
|
2116
|
+
function sr(e) {
|
|
2117
2117
|
return (t) => {
|
|
2118
|
-
const r = rt(), o =
|
|
2118
|
+
const r = rt(), o = ar().addComponentBeforeRouteHook({ lifecycle: e, hook: t, depth: r - 1 });
|
|
2119
2119
|
return Ve(o), o;
|
|
2120
2120
|
};
|
|
2121
2121
|
}
|
|
2122
|
-
function
|
|
2122
|
+
function cr(e) {
|
|
2123
2123
|
return (t) => {
|
|
2124
|
-
const r = rt(), o =
|
|
2124
|
+
const r = rt(), o = ar().addComponentAfterRouteHook({ lifecycle: e, hook: t, depth: r - 1 });
|
|
2125
2125
|
return Ve(o), o;
|
|
2126
2126
|
};
|
|
2127
2127
|
}
|
|
2128
|
-
const mo =
|
|
2128
|
+
const mo = sr("onBeforeRouteLeave"), Ro = sr("onBeforeRouteUpdate"), vo = cr("onAfterRouteLeave"), yo = cr("onAfterRouteUpdate");
|
|
2129
2129
|
function uo(e) {
|
|
2130
2130
|
return ve(e) && typeof e.value == "string";
|
|
2131
2131
|
}
|
|
2132
|
-
function
|
|
2133
|
-
return uo(e) ? e :
|
|
2132
|
+
function vt(e) {
|
|
2133
|
+
return uo(e) ? e : Gt(e, {});
|
|
2134
2134
|
}
|
|
2135
|
-
function
|
|
2136
|
-
const t = Qe(), r =
|
|
2135
|
+
function go(e) {
|
|
2136
|
+
const t = Qe(), r = zt(e.name), n = Kt(e.path), o = Yt(e.query), a = Qt(e.hash), s = e.meta ?? {}, f = Vr(e) ? vt(e.host) : vt(""), u = be({ id: t, meta: {}, state: {}, ...e }), c = {
|
|
2137
2137
|
id: t,
|
|
2138
2138
|
matched: u,
|
|
2139
2139
|
matches: [u],
|
|
@@ -2145,7 +2145,7 @@ function wo(e) {
|
|
|
2145
2145
|
meta: s,
|
|
2146
2146
|
depth: 1,
|
|
2147
2147
|
state: {}
|
|
2148
|
-
}, l =
|
|
2148
|
+
}, l = St(e) ? At(e.parent, c) : c;
|
|
2149
2149
|
return ie(l.path.params, l.query.params, l.host.params), l;
|
|
2150
2150
|
}
|
|
2151
2151
|
export {
|
|
@@ -2155,21 +2155,20 @@ export {
|
|
|
2155
2155
|
Re as RouterNotInstalledError,
|
|
2156
2156
|
co as RouterView,
|
|
2157
2157
|
Ar as UseRouteInvalidError,
|
|
2158
|
-
|
|
2159
|
-
|
|
2158
|
+
Et as asUrl,
|
|
2159
|
+
go as createExternalRoute,
|
|
2160
2160
|
Or as createParam,
|
|
2161
2161
|
se as createRoute,
|
|
2162
2162
|
ho as createRouter,
|
|
2163
2163
|
po as createRouterPlugin,
|
|
2164
|
-
|
|
2164
|
+
nr as isRoute,
|
|
2165
2165
|
T as isUrl,
|
|
2166
|
-
vo as
|
|
2167
|
-
yo as
|
|
2168
|
-
go as onAfterRouteUpdate,
|
|
2166
|
+
vo as onAfterRouteLeave,
|
|
2167
|
+
yo as onAfterRouteUpdate,
|
|
2169
2168
|
mo as onBeforeRouteLeave,
|
|
2170
2169
|
Ro as onBeforeRouteUpdate,
|
|
2171
2170
|
Oe as path,
|
|
2172
|
-
|
|
2171
|
+
dt as query,
|
|
2173
2172
|
eo as useLink,
|
|
2174
2173
|
no as useRoute,
|
|
2175
2174
|
Fe as useRouter,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(A,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],c):(A=typeof globalThis<"u"?globalThis:A||self,c(A["@kitbag/router"]={},A.Vue))})(this,function(A,c){"use strict";var Jr=Object.defineProperty;var Gr=(A,c,N)=>c in A?Jr(A,c,{enumerable:!0,configurable:!0,writable:!0,value:N}):A[c]=N;var F=(A,c,N)=>Gr(A,typeof c!="symbol"?c+"":c,N);function N(e){return typeof e!="string"?!1:/^(https?:\/\/|\/).*/g.test(e)}function Be(e){return N(e)?e:`/${e}`}class Xe extends Error{constructor(t){super(`Invalid Param "${t}": Router does not support multiple params by the same name. All param names must be unique.`)}}class Ze extends Error{constructor(t){super(`Child property on meta for ${t} conflicts with the parent meta.`)}}class te extends Error{constructor(){super("Router not installed")}}class et extends Error{constructor(t,n){super(`useRoute called with incorrect route. Given ${t}, expected ${n}`)}}const tt=Symbol();function ye(){const e=c.inject(tt);if(!e)throw new te;return e}function ue(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function W(e){return typeof e=="string"&&e.length>0}function ge(e){return{value:W(e)?e.replace(/^#*/,""):void 0}}function on(e,t){return ge(`${e.value??""}${t.value??""}`)}function an(e,t){return sn(e,t),{...e,...t}}function sn(e,t){const n=Object.keys(e).find(r=>r in t&&typeof t[r]!=typeof e[r]);if(n)throw new Ze(n)}function ne(e){return Array.isArray(e)?e:[e]}function nt(e,t){return e.filter(n=>t===n).length}function re(...e){const t=e.flatMap(n=>Array.isArray(n)?n:Object.keys(n).map(cn));for(const n of t)if(nt(t,n)>1)throw new Xe(n)}function cn(e){return e.startsWith("?")?e.slice(1):e}function un(e,t){return re(e.params,t.params),{value:`${e.value}${t.value}`,params:{...e.params,...t.params}}}function fn(e,t){return re(e.params,t.params),{value:[e.value,t.value].filter(W).join("&"),params:{...e.params,...t.params}}}function ln(e,t){return re(e,t),{...e,...t}}function hn(e){return"host"in e&&!!e.host}function rt(e){return"parent"in e&&!!e.parent}function xe(e){return"component"in e&&!!e.component}function Ce(e){return"components"in e&&!!e.components}function dn(e){return"state"in e&&!!e.state}function ot(e,t){return{...t,path:un(e.path,t.path),query:fn(e.query,t.query),meta:an(e.meta,t.meta),state:ln(e.state,t.state),hash:on(e.hash,t.hash),matches:[...e.matches,t.matched],host:e.host,depth:e.depth+1}}function Ve(){return typeof window<"u"&&typeof window.document<"u"}class ie extends Error{}const J="[",Q="]";function pn(e){return e!==String&&e!==Boolean&&e!==Number&&e!==Date}function mn(e){return typeof e=="function"&&pn(e)}function we(e){return typeof e=="object"&&"get"in e&&typeof e.get=="function"&&"set"in e&&typeof e.set=="function"}function Rn(e){return we(e)&&e.defaultValue!==void 0}function yn(e,t){return it(e,t)}function gn(e,t){return e[t]??String}const $={invalid:e=>{throw new ie(e)}},wn={get:e=>e,set:(e,{invalid:t})=>{if(typeof e!="string")throw t();return e}},at={get:(e,{invalid:t})=>{if(e==="true")return!0;if(e==="false")return!1;throw t()},set:(e,{invalid:t})=>{if(typeof e!="boolean")throw t();return e.toString()}},st={get:(e,{invalid:t})=>{const n=Number(e);if(isNaN(n))throw t();return n},set:(e,{invalid:t})=>{if(typeof e!="number")throw t();return e.toString()}},ct={get:(e,{invalid:t})=>{const n=new Date(e);if(isNaN(n.getTime()))throw t();return n},set:(e,{invalid:t})=>{if(typeof e!="object"||!(e instanceof Date))throw t();return e.toISOString()}},ut={get:(e,{invalid:t})=>{try{return JSON.parse(e)}catch{throw t()}},set:(e,{invalid:t})=>{try{return JSON.stringify(e)}catch{throw t()}}};function fe(e,t,n=!1){if(e===void 0||!W(e)){if(Rn(t))return t.defaultValue;if(n)return;throw new ie}if(t===String)return wn.get(e,$);if(t===Boolean)return at.get(e,$);if(t===Number)return st.get(e,$);if(t===Date)return ct.get(e,$);if(t===JSON)return ut.get(e,$);if(mn(t))return t(e,$);if(we(t))return t.get(e,$);if(t instanceof RegExp){if(t.test(e))return e;throw new ie}return e}function le(e,t,n=!1){if(e===void 0){if(n)return"";throw new ie}if(t===Boolean)return at.set(e,$);if(t===Number)return st.set(e,$);if(t===Date)return ct.set(e,$);if(t===JSON)return ut.set(e,$);if(we(t))return t.set(e,$);try{return e.toString()}catch{throw new ie}}function it(e,t){return we(e)?{...e,defaultValue:t??e.defaultValue}:{get:n=>fe(n,e),set:n=>le(n,e),defaultValue:t}}function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},z.apply(null,arguments)}var H;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(H||(H={}));var oe=process.env.NODE_ENV!=="production"?function(e){return Object.freeze(e)}:function(e){return e};function Y(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}var Ee="beforeunload",En="hashchange",ft="popstate";function lt(e){e===void 0&&(e={});var t=e,n=t.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var p=r.location,d=p.pathname,E=p.search,B=p.hash,x=o.state||{};return[x.idx,oe({pathname:d,search:E,hash:B,state:x.usr||null,key:x.key||"default"})]}var s=null;function l(){if(s)b.call(s),s=null;else{var p=H.Pop,d=a(),E=d[0],B=d[1];if(b.length)if(E!=null){var x=h-E;x&&(s={action:p,location:B,retry:function(){k(x*-1)}},k(x))}else process.env.NODE_ENV!=="production"&&Y(!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 U(p)}}r.addEventListener(ft,l);var i=H.Pop,u=a(),h=u[0],g=u[1],P=ae(),b=ae();h==null&&(h=0,o.replaceState(z({},o.state,{idx:h}),""));function R(p){return typeof p=="string"?p:X(p)}function w(p,d){return d===void 0&&(d=null),oe(z({pathname:g.pathname,hash:"",search:""},typeof p=="string"?he(p):p,{state:d,key:Pe()}))}function f(p,d){return[{usr:p.state,key:p.key,idx:d},R(p)]}function m(p,d,E){return!b.length||(b.call({action:p,location:d,retry:E}),!1)}function U(p){i=p;var d=a();h=d[0],g=d[1],P.call({action:i,location:g})}function y(p,d){var E=H.Push,B=w(p,d);function x(){y(p,d)}if(m(E,B,x)){var V=f(B,h+1),j=V[0],_=V[1];try{o.pushState(j,"",_)}catch{r.location.assign(_)}U(E)}}function v(p,d){var E=H.Replace,B=w(p,d);function x(){v(p,d)}if(m(E,B,x)){var V=f(B,h),j=V[0],_=V[1];o.replaceState(j,"",_),U(E)}}function k(p){o.go(p)}var L={get action(){return i},get location(){return g},createHref:R,push:y,replace:v,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(d){return P.push(d)},block:function(d){var E=b.push(d);return b.length===1&&r.addEventListener(Ee,ve),function(){E(),b.length||r.removeEventListener(Ee,ve)}}};return L}function vn(e){e===void 0&&(e={});var t=e,n=t.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var d=he(r.location.hash.substr(1)),E=d.pathname,B=E===void 0?"/":E,x=d.search,V=x===void 0?"":x,j=d.hash,_=j===void 0?"":j,O=o.state||{};return[O.idx,oe({pathname:B,search:V,hash:_,state:O.usr||null,key:O.key||"default"})]}var s=null;function l(){if(s)b.call(s),s=null;else{var d=H.Pop,E=a(),B=E[0],x=E[1];if(b.length)if(B!=null){var V=h-B;V&&(s={action:d,location:x,retry:function(){L(V*-1)}},L(V))}else process.env.NODE_ENV!=="production"&&Y(!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 y(d)}}r.addEventListener(ft,l),r.addEventListener(En,function(){var d=a(),E=d[1];X(E)!==X(g)&&l()});var i=H.Pop,u=a(),h=u[0],g=u[1],P=ae(),b=ae();h==null&&(h=0,o.replaceState(z({},o.state,{idx:h}),""));function R(){var d=document.querySelector("base"),E="";if(d&&d.getAttribute("href")){var B=r.location.href,x=B.indexOf("#");E=x===-1?B:B.slice(0,x)}return E}function w(d){return R()+"#"+(typeof d=="string"?d:X(d))}function f(d,E){return E===void 0&&(E=null),oe(z({pathname:g.pathname,hash:"",search:""},typeof d=="string"?he(d):d,{state:E,key:Pe()}))}function m(d,E){return[{usr:d.state,key:d.key,idx:E},w(d)]}function U(d,E,B){return!b.length||(b.call({action:d,location:E,retry:B}),!1)}function y(d){i=d;var E=a();h=E[0],g=E[1],P.call({action:i,location:g})}function v(d,E){var B=H.Push,x=f(d,E);function V(){v(d,E)}if(process.env.NODE_ENV!=="production"&&Y(x.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(d)+")"),U(B,x,V)){var j=m(x,h+1),_=j[0],O=j[1];try{o.pushState(_,"",O)}catch{r.location.assign(O)}y(B)}}function k(d,E){var B=H.Replace,x=f(d,E);function V(){k(d,E)}if(process.env.NODE_ENV!=="production"&&Y(x.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(d)+")"),U(B,x,V)){var j=m(x,h),_=j[0],O=j[1];o.replaceState(_,"",O),y(B)}}function L(d){o.go(d)}var p={get action(){return i},get location(){return g},createHref:w,push:v,replace:k,go:L,back:function(){L(-1)},forward:function(){L(1)},listen:function(E){return P.push(E)},block:function(E){var B=b.push(E);return b.length===1&&r.addEventListener(Ee,ve),function(){B(),b.length||r.removeEventListener(Ee,ve)}}};return p}function ht(e){e===void 0&&(e={});var t=e,n=t.initialEntries,r=n===void 0?["/"]:n,o=t.initialIndex,a=r.map(function(y){var v=oe(z({pathname:"/",search:"",hash:"",state:null,key:Pe()},typeof y=="string"?he(y):y));return process.env.NODE_ENV!=="production"&&Y(v.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(y)+")"),v}),s=dt(o??a.length-1,0,a.length-1),l=H.Pop,i=a[s],u=ae(),h=ae();function g(y){return typeof y=="string"?y:X(y)}function P(y,v){return v===void 0&&(v=null),oe(z({pathname:i.pathname,search:"",hash:""},typeof y=="string"?he(y):y,{state:v,key:Pe()}))}function b(y,v,k){return!h.length||(h.call({action:y,location:v,retry:k}),!1)}function R(y,v){l=y,i=v,u.call({action:l,location:i})}function w(y,v){var k=H.Push,L=P(y,v);function p(){w(y,v)}process.env.NODE_ENV!=="production"&&Y(i.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(y)+")"),b(k,L,p)&&(s+=1,a.splice(s,a.length,L),R(k,L))}function f(y,v){var k=H.Replace,L=P(y,v);function p(){f(y,v)}process.env.NODE_ENV!=="production"&&Y(i.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(y)+")"),b(k,L,p)&&(a[s]=L,R(k,L))}function m(y){var v=dt(s+y,0,a.length-1),k=H.Pop,L=a[v];function p(){m(y)}b(k,L,p)&&(s=v,R(k,L))}var U={get index(){return s},get action(){return l},get location(){return i},createHref:g,push:w,replace:f,go:m,back:function(){m(-1)},forward:function(){m(1)},listen:function(v){return u.push(v)},block:function(v){return h.push(v)}};return U}function dt(e,t,n){return Math.min(Math.max(e,t),n)}function ve(e){e.preventDefault(),e.returnValue=""}function ae(){var e=[];return{get length(){return e.length},push:function(n){return e.push(n),function(){e=e.filter(function(r){return r!==n})}},call:function(n){e.forEach(function(r){return r&&r(n)})}}}function Pe(){return Math.random().toString(36).substr(2,8)}function X(e){var t=e.pathname,n=t===void 0?"/":t,r=e.search,o=r===void 0?"":r,a=e.hash,s=a===void 0?"":a;return o&&o!=="?"&&(n+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(n+=s.charAt(0)==="#"?s:"#"+s),n}function he(e){var t={};if(e){var n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));var r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}const pt=Symbol();function Pn(){const e=c.inject(pt);if(!e)throw new te;return e}const mt=Symbol("isRouterRouteSymbol");function bn(e){return typeof e=="object"&&e!==null&&mt in e}function Sn(e,t){function n(f,m,U){if(typeof f=="object"){const v={...e.params,...f};return t(e.name,v,m)}const y={...e.params,[f]:m};return t(e.name,y,U)}const r=(...f)=>{const m=new URLSearchParams(e.query);m.set(...f),n({},{query:m})},o=(...f)=>{const m=new URLSearchParams(e.query);m.append(...f),n({},{query:m})},a=(...f)=>{const m=new URLSearchParams(e.query);m.delete(...f),n({},{query:m})},{id:s,matched:l,matches:i,name:u,hash:h,href:g}=c.toRefs(e),P=c.computed({get(){return new Proxy(e.params,{set(f,m,U){return n(m,U),!0}})},set(f){n(f)}}),b=c.computed({get(){return new Proxy(e.query,{get(f,m,U){switch(m){case"append":return o;case"set":return r;case"delete":return a;default:return Reflect.get(f,m,U)}}})},set(f){n({},{query:f})}}),R=c.computed({get(){return new Proxy(e.state,{set(f,m,U){return n({},{state:{...e.state,[m]:U}}),!0}})},set(f){n({},{state:f})}});return c.reactive({id:s,matched:l,matches:i,state:R,query:b,hash:h,params:P,name:u,href:g,update:n,[mt]:!0})}const Rt=Symbol();function An(e,t){const n=c.reactive({...e}),r=s=>{Object.assign(n,{[Rt]:!1,...s})},o=n,a=Sn(o,t);return{currentRoute:o,routerRoute:a,updateRoute:r}}function q(e){return!e.startsWith("http")?Un(e):kn(e)}function kn(e){const{protocol:t,host:n,pathname:r,search:o,searchParams:a,hash:s}=new URL(e,e);return{protocol:t,host:n,pathname:r,search:o,searchParams:a,hash:s}}function Un(e){const{pathname:t,search:n,searchParams:r,hash:o}=new URL(e,"https://localhost");return{pathname:t,search:n,searchParams:r,hash:o}}function Ln(e){return t=>{const{host:n}=q(t);return!(n===void 0||n===e)}}function Bn({mode:e,listener:t}){const n=xn(e),r=(i,u)=>{if(u!=null&&u.replace){n.replace(i,u.state);return}n.push(i,u==null?void 0:u.state)},o=()=>{const i=X(n.location);n.replace(i)};let a;return{...n,update:r,refresh:o,startListening:()=>{a==null||a(),a=n.listen(t)},stopListening:()=>{a==null||a()}}}function xn(e="auto"){switch(e){case"auto":return Ve()?lt():ht();case"browser":return lt();case"memory":return ht();case"hash":return vn();default:const t=e;throw new Error(`Switch is not exhaustive for mode: ${t}`)}}class yt extends Error{constructor(){super("Uncaught CallbackContextAbortError");F(this,"response");this.response={status:"ABORT"}}}class se extends Error{constructor(n){super("Uncaught CallbackContextPushError");F(this,"response");this.response={status:"PUSH",to:n}}}class be extends Error{constructor(n){super("Uncaught CallbackContextRejectionError");F(this,"response");this.response={status:"REJECT",type:n}}}function gt(){return{reject:o=>{throw new be(o)},push:(...o)=>{throw new se(o)},replace:(o,a,s)=>{if(N(o)){const u=a??{};throw new se([o,{...u,replace:!0}])}const l=a,i=s??{};throw new se([o,l,{...i,replace:!0}])},abort:()=>{throw new yt}}}class Z{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)}}const de=(e,t,n)=>{var a,s;const r=e.matches,o=(t==null?void 0:t.matches)??[];return r.length<n||((a=r.at(n))==null?void 0:a.id)!==((s=o.at(n))==null?void 0:s.id)},pe=(e,t,n)=>{var a,s;const r=e.matches,o=(t==null?void 0:t.matches)??[];return r.length<n||((a=r.at(n))==null?void 0:a.id)!==((s=o.at(n))==null?void 0:s.id)},me=(e,t,n)=>{var r,o;return((r=e.matches.at(n))==null?void 0:r.id)===((o=t==null?void 0:t.matches.at(n))==null?void 0:o.id)};function wt(e){switch(e){case"onBeforeRouteEnter":case"onAfterRouteEnter":return de;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return me;case"onBeforeRouteLeave":case"onAfterRouteLeave":return pe;default:throw new Error(`Switch is not exhaustive for lifecycle: ${e}`)}}function Cn(e,t){const n=new Z;return e.matches.forEach((r,o)=>{r.onBeforeRouteEnter&&de(e,t,o)&&ne(r.onBeforeRouteEnter).forEach(a=>n.onBeforeRouteEnter.add(a)),r.onBeforeRouteUpdate&&me(e,t,o)&&ne(r.onBeforeRouteUpdate).forEach(a=>n.onBeforeRouteUpdate.add(a))}),t==null||t.matches.forEach((r,o)=>{r.onBeforeRouteLeave&&pe(e,t,o)&&ne(r.onBeforeRouteLeave).forEach(a=>n.onBeforeRouteLeave.add(a))}),n}function Vn(e,t){const n=new Z;return e.matches.forEach((r,o)=>{r.onAfterRouteEnter&&de(e,t,o)&&ne(r.onAfterRouteEnter).forEach(a=>n.onAfterRouteEnter.add(a)),r.onAfterRouteUpdate&&me(e,t,o)&&ne(r.onAfterRouteUpdate).forEach(a=>n.onAfterRouteUpdate.add(a))}),t==null||t.matches.forEach((r,o)=>{r.onAfterRouteLeave&&pe(e,t,o)&&ne(r.onAfterRouteLeave).forEach(a=>n.onAfterRouteLeave.add(a))}),n}function Nn(e,t,n){const r=new Z;return e.matches.forEach((o,a)=>{de(e,t,a)&&n.onBeforeRouteEnter.forEach(s=>r.onBeforeRouteEnter.add(s)),me(e,t,a)&&n.onBeforeRouteUpdate.forEach(s=>r.onBeforeRouteUpdate.add(s))}),t==null||t.matches.forEach((o,a)=>{pe(e,t,a)&&n.onBeforeRouteLeave.forEach(s=>r.onBeforeRouteLeave.add(s))}),r}function jn(e,t,n){const r=new Z;return e.matches.forEach((o,a)=>{de(e,t,a)&&n.onAfterRouteEnter.forEach(s=>r.onAfterRouteEnter.add(s)),me(e,t,a)&&n.onAfterRouteUpdate.forEach(s=>r.onAfterRouteUpdate.add(s))}),t==null||t.matches.forEach((o,a)=>{pe(e,t,a)&&n.onAfterRouteLeave.forEach(s=>r.onAfterRouteLeave.add(s))}),r}const Et=Symbol();function Hn(){const e={global:new Z,component:new Z},{reject:t,push:n,replace:r,abort:o}=gt(),a=f=>(e.global.onBeforeRouteEnter.add(f),()=>e.global.onBeforeRouteEnter.delete(f)),s=f=>(e.global.onBeforeRouteUpdate.add(f),()=>e.global.onBeforeRouteUpdate.delete(f)),l=f=>(e.global.onBeforeRouteLeave.add(f),()=>e.global.onBeforeRouteLeave.delete(f)),i=f=>(e.global.onAfterRouteEnter.add(f),()=>e.global.onAfterRouteEnter.delete(f)),u=f=>(e.global.onAfterRouteUpdate.add(f),()=>e.global.onAfterRouteUpdate.delete(f)),h=f=>(e.global.onAfterRouteLeave.add(f),()=>e.global.onAfterRouteLeave.delete(f));async function g({to:f,from:m}){const{global:U,component:y}=e,v=Cn(f,m),k=Nn(f,m,U),L=[...k.onBeforeRouteEnter,...v.onBeforeRouteEnter,...k.onBeforeRouteUpdate,...v.onBeforeRouteUpdate,...y.onBeforeRouteUpdate,...k.onBeforeRouteLeave,...v.onBeforeRouteLeave,...y.onBeforeRouteLeave];try{const p=L.map(d=>d(f,{from:m,reject:t,push:n,replace:r,abort:o}));await Promise.all(p)}catch(p){if(p instanceof se||p instanceof be||p instanceof yt)return p.response;throw p}return{status:"SUCCESS"}}async function P({to:f,from:m}){const{global:U,component:y}=e,v=Vn(f,m),k=jn(f,m,U),L=[...y.onAfterRouteLeave,...v.onAfterRouteLeave,...k.onAfterRouteLeave,...y.onAfterRouteUpdate,...v.onAfterRouteUpdate,...k.onAfterRouteUpdate,...y.onAfterRouteEnter,...v.onAfterRouteEnter,...k.onAfterRouteEnter];try{const p=L.map(d=>d(f,{from:m,reject:t,push:n,replace:r}));await Promise.all(p)}catch(p){if(p instanceof se||p instanceof be)return p.response;throw p}return{status:"SUCCESS"}}return{runBeforeRouteHooks:g,runAfterRouteHooks:P,addComponentBeforeRouteHook:({lifecycle:f,depth:m,hook:U})=>{const y=wt(f),v=e.component[f],k=(L,p)=>{if(y(L,p.from,m))return U(L,p)};return v.add(k),()=>v.delete(k)},addComponentAfterRouteHook:({lifecycle:f,depth:m,hook:U})=>{const y=wt(f),v=e.component[f],k=(L,p)=>{if(y(L,p.from,m))return U(L,p)};return v.add(k),()=>v.delete(k)},addGlobalRouteHooks:f=>{f.onBeforeRouteEnter.forEach(m=>a(m)),f.onBeforeRouteUpdate.forEach(m=>s(m)),f.onBeforeRouteLeave.forEach(m=>l(m)),f.onAfterRouteEnter.forEach(m=>i(m)),f.onAfterRouteUpdate.forEach(m=>u(m)),f.onAfterRouteLeave.forEach(m=>h(m))},onBeforeRouteEnter:a,onBeforeRouteUpdate:s,onBeforeRouteLeave:l,onAfterRouteEnter:i,onAfterRouteUpdate:u,onAfterRouteLeave:h}}function $n(e){return c.defineComponent(()=>()=>c.h("h1",e),{name:e,props:[]})}function Ne(e){const t=new URLSearchParams(e);return{get:(...n)=>t.get(...n),getAll:(...n)=>t.getAll(...n),set:(...n)=>{t.set(...n)},append:(...n)=>{t.append(...n)},delete:(...n)=>{t.delete(...n)},toString:(...n)=>t.toString(...n),forEach:(...n)=>{t.forEach(...n)},entries:(...n)=>t.entries(...n),keys:(...n)=>t.keys(...n),values:(...n)=>t.values(...n),has:(...n)=>t.has(...n),size:t.size,sort:()=>{t.sort()},[Symbol.iterator]:()=>t[Symbol.iterator]()}}function je(){let e=0;return()=>(++e).toString()}const qn=je()();function _n(e){return e===qn}const He=je();function In(e){const t=a=>c.markRaw(e[a]??$n(a)),n=a=>{const s=c.markRaw(t(a)),l={id:He(),component:s,meta:{},state:{}};return{id:l.id,matched:l,matches:[l],name:a,query:Ne(""),params:{},state:{},href:"/",hash:"",[Rt]:!0}},r=a=>{if(!a){o.value=null;return}const s=t(a);o.value={type:a,component:s}},o=c.ref(null);return{setRejection:r,rejection:o,getRejectionRoute:n}}class On extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Tn(e){if(e)return e;if(Ve())return window.location.toString();throw new On}function vt(e){return!!e&&typeof e=="object"}const Se=!0;function Dn(e,t,n){if(vt(e)&&t in e){const r=e[t];return typeof r=="string"?fe(r,n,Se):r}return fe(void 0,n,Se)}function Pt(e,t){const n={};for(const[r,o]of Object.entries(e)){const a=Dn(t,r,o);n[r]=a}return n}function Mn(e,t,n){if(vt(e)&&t in e){const r=e[t];return le(r,n,Se)}return le(void 0,n,Se)}const bt=(e,t)=>{const n={};for(const[r,o]of Object.entries(e)){const a=Mn(t,r,o);n[r]=a}return n};function Fn(){const e=c.reactive(new Map),t=Ve()?s():null,n=l=>{e.set(l,!1),t==null||t.observe(l)},r=l=>{e.delete(l),t==null||t.unobserve(l)},o=()=>{t==null||t.disconnect()},a=l=>e.get(l)??!1;function s(){return new IntersectionObserver(l=>{l.forEach(i=>{e.set(i.target,i.isIntersecting)})})}return{observe:n,unobserve:r,disconnect:o,isElementVisible:a}}const St=Symbol("visibilityObserver");function Wn(e){const t=c.inject(St);if(!t)throw new te;return c.watch(e,(r,o)=>{r&&t.observe(r),o&&t.unobserve(o)},{immediate:!0}),c.onUnmounted(()=>{e.value&&t.unobserve(e.value)}),{isElementVisible:c.computed(()=>e.value?t.isElementVisible(e.value):!1)}}class Jn extends Error{constructor(t){super(`Route not found: "${t}"`)}}function $e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Gn(e,t){const n=Array.from(e.matchAll(t));if(n.length===0)return[e];let r=0;const o=n.reduce((s,l)=>{const i=$e(e.slice(r,l.index));i.length&&s.push(i);const[u]=l;return s.push(u),r=l.index+u.length,s},[]),a=e.slice(r);return a&&o.push(a),o}function Qn(e){const t=At(e.path.value);return new RegExp(`^${t}$`,"i")}function zn(e){const t=new URLSearchParams(e.query.value);return Array.from(t.entries()).filter(([,n])=>!_e(n)).map(([n,r])=>{const o=At(r);return new RegExp(`${$e(n)}=${o}(&|$)`,"i")})}function At(e){return Gn(e,new RegExp(Kn,"g")).map(t=>t.startsWith(J)?kt(t):$e(t)).join("")}function kt(e){return[Yn,Xn].reduce((t,n)=>n(t),e)}const Kn=`\\${J}\\??([\\w-_]+)\\${Q}`,qe=`\\${J}\\?([\\w-_]+)\\${Q}`,Ut=`\\${J}([\\w-_]+)\\${Q}`;function Yn(e){return e.replace(new RegExp(qe,"g"),".*")}function _e(e){return new RegExp(qe,"g").test(e)}function Xn(e){return e.replace(new RegExp(Ut,"g"),".+")}function Re(e){const[t]=Ae(e,new RegExp(qe,"g")),[n]=Ae(e,new RegExp(Ut,"g"));return t??n}function Ae(e,t){return Array.from(e.matchAll(t)).flatMap(([,...r])=>r.map(o=>W(o)?o:""))}function Lt(e,t,n){const r=xt(t,n),[o]=Ae(e,r);return o}function Bt(e,t){if(!t)return e;const{name:n,param:r,value:o}=t,a=xt(e,n);return Ae(e,a).reduce((l,i)=>i===void 0?l:l.replace(i,()=>le(o,r,n.startsWith("?"))),e)}function xt(e,t){const n=[Zn,er,kt].reduce((r,o)=>o(r,t),e);return new RegExp(n,"g")}function Zn(e,t){if(!t.startsWith("?"))return e;const n=new RegExp(`\\${J}\\${t}\\${Q}`,"g");return e.replace(n,"(.*)")}function er(e,t){if(t.startsWith("?"))return e;const n=new RegExp(`\\${J}${t}\\${Q}`,"g");return e.replace(n,"(.+)")}function Ct({protocol:e,host:t,pathname:n,search:r,searchParams:o,hash:a}){const s=new URL("https://localhost");e&&(s.protocol=e),t&&(s.host=t),n&&(s.pathname=n),o?s.search=new URLSearchParams(o).toString():r&&(s.search=r),a&&(s.hash=a);const l=s.toString().replace(/^https:\/\/localhost\/*/,"/");return Be(l)}function Ie(...e){const t=new URLSearchParams;for(const n of e){const r=new URLSearchParams(n);for(const[o,a]of r.entries())t.append(o,a)}return t}function tr(e,t={}){const{params:n={},query:r}=t,o=or(e.query,n),a=Ie(o,r),s=rr(e.path,n),l=ge(e.hash.value??t.hash).value,i=nr(e.host,n),{protocol:u,host:h}=q(i);return Ct({protocol:u,host:h,pathname:s,searchParams:a,hash:l})}function nr(e,t){const n=e.value&&!e.value.startsWith("http")?`https://${e.value}`:e.value;return Object.entries(e.params).reduce((r,[o,a])=>{const s=Re(`${J}${o}${Q}`);return s?Bt(r,{name:o,param:a,value:t[s]}):r},n)}function rr(e,t){return Object.entries(e.params).reduce((n,[r,o])=>{const a=Re(`${J}${r}${Q}`);return a?Bt(n,{name:r,param:o,value:t[a]}):n},e.value)}function or(e,t){const n=new URLSearchParams(e.value);if(!e.value)return n;for(const[r,o]of Array.from(n.entries())){const a=Re(o);if(!a)continue;const l=_e(o),i=l?`?${a}`:a,u=le(t[a],e.params[i],l),h=t[a]===void 0&&u==="";l&&h?n.delete(r,o):n.set(r,u)}return n}const ar=(e,t)=>{try{Oe(e,t)}catch{return!1}return!0},Oe=(e,t)=>{const{pathname:n,search:r}=q(t);return{...sr(e.path,n),...cr(e.query,r)}};function sr(e,t){const n={},r=decodeURIComponent(t);for(const[o,a]of Object.entries(e.params)){const s=o.startsWith("?"),l=s?o.slice(1):o,i=Lt(r,e.value,o),u=fe(i,a,s);n[l]=u}return n}function cr(e,t){const n={},r=new URLSearchParams(e.value),o=new URLSearchParams(t);for(const[a,s]of Array.from(r.entries())){const l=Re(s);if(!l)continue;const u=_e(s),h=u?`?${l}`:l,g=o.get(a)??void 0,P=fe(g,e.params[h],u);n[l]=P}return n}function ur(e,t={},n={}){const r=tr(e,{params:t,query:n.query,hash:n.hash}),{search:o,hash:a}=q(r);return{id:e.id,matched:e.matched,matches:e.matches,name:e.name,query:Ne(o),params:Oe(e,r),state:Pt(e.state,n.state),hash:a,href:r}}const ir=e=>"name"in e.matched&&!!e.matched.name,fr=(e,t)=>{const{pathname:n}=q(t);return Qn(e).test(n)},lr=(e,t)=>{const{search:n}=q(t);return zn(e).every(o=>o.test(n))},Te=(e,t)=>{const{hash:n}=q(t),{value:r}=e.hash;return r===void 0||`#${r.toLowerCase()}`===n.toLowerCase()};function hr(e){const{searchParams:t,pathname:n}=q(e),r=-1,o=1;return(a,s)=>{const l=Nt(a,t),i=Vt(a,n),u=Nt(s,t),h=Vt(s,n);return a.depth>s.depth?r:a.depth<s.depth?o:l+i>u+h?r:l+i<u+h?o:Te(a,e)?r:Te(s,e)?o:0}}function Vt(e,t){const n=Object.keys(e.path.params).filter(o=>o.startsWith("?")).map(o=>o),r=n.filter(o=>Lt(t,e.path.value,o)===void 0);return n.length-r.length}function Nt(e,t){const n=new URLSearchParams(t),r=new URLSearchParams(e.query.value),o=Array.from(r.keys()),a=o.filter(s=>!n.has(s));return o.length-a.length}const dr=[ir,fr,lr,Te,ar];function pr(e,t){const n=hr(t);return e.filter(r=>dr.every(o=>o(r,t))).sort(n)}function mr(e,t,n){const r=pr(e,t);if(!r.length)return;const[o]=r,{searchParams:a,hash:s}=q(t);return{id:o.id,matched:o.matched,matches:o.matches,name:o.name,query:Ne(a),params:Oe(o,t),state:Pt(o.state,n),hash:s,href:Be(t)}}function jt(e,t){const n=typeof e=="string"?q(e):e,r=typeof t=="string"?q(t):t,o=n.searchParams??new URLSearchParams(n.search),a=r.searchParams??new URLSearchParams(r.search);return Ct({protocol:W(r.protocol)?r.protocol:n.protocol,host:W(r.host)?r.host:n.host,pathname:W(r.pathname)?r.pathname:n.pathname,searchParams:Ie(a,o),hash:W(r.hash)?r.hash:n.hash})}function De(e,t){const n=new RegExp(`\\${J}(\\??[\\w-_]+)\\${Q}`,"g");return Array.from(e.matchAll(n)).reduce((o,[a,s])=>{const l=Re(a);if(!l)return o;const i=gn(t,l);return re([l],o),o[s]=i,o},{})}function ke(e,t){return{value:e,params:De(e,t)}}function Rr(e,t){return W(t)?e.map(n=>{const r=`${t}${n.path.value}`;return{...n,path:ke(r,n.path.params)}}):e}class yr extends Error{constructor(t){super(`Invalid Name "${t}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function gr(e){const t=e.map(({name:n})=>n);for(const n of t)if(nt(t,n)>1)throw new yr(n)}function wr(e,t=[],n){const r=[...e,...t.map(o=>o.routes)].flat();return gr(r),Rr(r,n)}function Er(e={},t=[]){const n=new Z;return ce("onBeforeRouteEnter",e,t).forEach(r=>n.onBeforeRouteEnter.add(r)),ce("onBeforeRouteUpdate",e,t).forEach(r=>n.onBeforeRouteUpdate.add(r)),ce("onBeforeRouteLeave",e,t).forEach(r=>n.onBeforeRouteLeave.add(r)),ce("onAfterRouteEnter",e,t).forEach(r=>n.onAfterRouteEnter.add(r)),ce("onAfterRouteUpdate",e,t).forEach(r=>n.onAfterRouteUpdate.add(r)),ce("onAfterRouteLeave",e,t).forEach(r=>n.onAfterRouteLeave.add(r)),n}function ce(e,t,n){return[t[e],...n.map(o=>o[e])].flat().filter(o=>o!==void 0)}function vr(e,t,n=[]){const r=wr(e,n,t==null?void 0:t.base),o=Hn();o.addGlobalRouteHooks(Er(t,n));const a=je(),s=xr(),l=Fn(),i=Bn({mode:t==null?void 0:t.historyMode,listener:({location:S})=>{const C=X(S);h(C,{state:S.state,replace:!0})}});function u(S,C={}){return mr(r,S,C.state)}async function h(S,C={}){const G=a();if(i.stopListening(),E(S)){i.update(S,C);return}const T=u(S,C)??m("NotFound"),I=O(G),K=await o.runBeforeRouteHooks({to:T,from:I});switch(K.status){case"ABORT":return;case"PUSH":i.update(S,C),await P(...K.to);return;case"REJECT":i.update(S,C),w(K.type);break;case"SUCCESS":i.update(S,C),w(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(K)}`)}const ze=G;s.setProps(T).then(D=>{if(ze===G)switch(D.status){case"SUCCESS":break;case"PUSH":P(...D.to);break;case"REJECT":w(D.type);break;default:const Ke=D;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(Ke)}`)}}),k(T);const M=await o.runAfterRouteHooks({to:T,from:I});switch(M.status){case"PUSH":await P(...M.to);break;case"REJECT":w(M.type);break;case"SUCCESS":break;default:const D=M;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(D)}`)}i.startListening()}const g=(S,C={},G={})=>{const T=r.find(I=>I.name===S);if(!T)throw new Jn(String(S));return ur(T,C,G)},P=(S,C,G)=>{if(N(S)){const M={...C},D=jt(S,{searchParams:M.query,hash:M.hash});return h(D,M)}if(typeof S=="string"){const{replace:M,...D}={...G},Ke={...C},Ye=g(S,Ke,D),Wr=bt({...Ye.matched.state},{...Ye.state,...D.state});return h(Ye.href,{replace:M,state:Wr})}const{replace:T,...I}={...C},K=bt({...S.matched.state},{...S.state,...I.state}),ze=jt(S.href,{searchParams:I.query,hash:I.hash});return h(ze,{replace:T,state:K})},b=(S,C,G)=>{if(N(S)){const I={...C,replace:!0};return P(S,I)}if(typeof S=="string"){const I={...G,replace:!0},K={...C};return P(S,K,I)}const T={...C,replace:!0};return P(S,T)},R=S=>{w(S)},{setRejection:w,rejection:f,getRejectionRoute:m}=In({...n.reduce((S,C)=>({...S,...C.rejections}),{}),...t==null?void 0:t.rejections}),U=m("NotFound"),{currentRoute:y,routerRoute:v,updateRoute:k}=An(U,P),L=Tn(t==null?void 0:t.initialUrl),p=i.location.state,{host:d}=q(L),E=Ln(d);let B=!1;const{promise:x,resolve:V}=Promise.withResolvers();async function j(){if(B)return x;B=!0,await h(L,{replace:!0,state:p}),i.startListening(),V()}function _(){i.stopListening()}function O(S){return _n(S)?null:{...y}}function nn(S){S.component("RouterView",Xt),S.component("RouterLink",zt),S.provide(pt,f),S.provide(Et,o),S.provide(Ft,s),S.provide(St,l),S.provide(tt,rn),j()}const rn={route:v,resolve:g,find:u,push:P,replace:b,reject:R,refresh:i.refresh,forward:i.forward,back:i.back,go:i.go,install:nn,isExternal:E,onBeforeRouteEnter:o.onBeforeRouteEnter,onBeforeRouteUpdate:o.onBeforeRouteUpdate,onBeforeRouteLeave:o.onBeforeRouteLeave,onAfterRouteEnter:o.onAfterRouteEnter,onAfterRouteUpdate:o.onAfterRouteUpdate,onAfterRouteLeave:o.onAfterRouteLeave,prefetch:t==null?void 0:t.prefetch,start:j,stop:_};return rn}function Me(e,t){return{value:e,params:De(e,t)}}function Pr(e){return{routes:e.routes??[],rejections:e.rejections??{},...e}}function Ht(e,t){return{value:e,params:De(e,t)}}function br(e){return ue(e)&&typeof e.hash=="string"}function $t(e){return e===void 0?ge():br(e)?e:ge(e)}function qt(e){return e===void 0?"":e}function Sr(e){return ue(e)&&typeof e.value=="string"}function _t(e){return e===void 0?ke("",{}):Sr(e)?e:ke(e,{})}function Ar(e){return ue(e)&&typeof e.value=="string"}function It(e){return e===void 0?Me("",{}):Ar(e)?e:Me(e,{})}function ee(e){const t=He(),n=qt(e.name),r=_t(e.path),o=It(e.query),a=$t(e.hash),s=e.meta??{},l=dn(e)?e.state:{},i=c.markRaw({id:t,meta:{},state:{},...e}),u={id:t,matched:i,matches:[i],name:n,path:r,query:o,hash:a,meta:s,state:l,depth:1,host:Ht("",{}),prefetch:e.prefetch},h=rt(e)?ot(e.parent,u):u;return re(h.path.params,h.query.params),h}const Ue={template:"<div>This is component</div>"},Fe=ee({name:"parentA",path:"/parentA/[paramA]"}),Ot=ee({parent:Fe,name:"parentA.childA",path:"/childA/[?paramB]"}),kr=ee({parent:Fe,name:"parentA.childB",path:"/childB/[paramD]",component:Ue}),Ur=ee({parent:Ot,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Ue});ee({name:"parentB",path:"/parentB",component:Ue}),ee({name:"parentC",path:"/",component:Ue});const Lr="lazy",Br={components:!0,props:!1};function Le(e){return["eager","lazy","intent"].includes(e)}function Tt({routerPrefetch:e,routePrefetch:t,linkPrefetch:n},r){const o=We(n,r),a=We(t,r),s=We(e,r),l=[o,a,s,Br[r],Lr].reduce((i,u)=>Le(i)?i:i===!0&&Le(u)?u:i===!0&&!Le(u)?i:i===void 0?u:i,void 0);return Le(l)?l:!1}function We(e,t){return ue(e)?e[t]:e}function Dt(e){return typeof e=="object"&&e!==null&&"then"in e}function Mt(e){try{const t=e();return Dt(t)?t.catch(n=>n):t}catch(t){return t}}const Ft=Symbol();function xr(){const e=c.reactive(new Map),{push:t,replace:n,reject:r}=gt(),o=(g,P,b)=>P.matches.filter(R=>Tt({...b,routePrefetch:R.prefetch},"props")===g).flatMap(R=>u(R)).reduce((R,{id:w,name:f,props:m})=>{if(!m)return R;const U=i(w,f,P),y=Mt(()=>m(P,{push:t,replace:n,reject:r}));return R[U]=y,R},{}),a=g=>{Object.entries(g).forEach(([P,b])=>{e.set(P,b)})},s=async g=>{const P=g.matches.flatMap(u),b=[],R=[];for(const{id:w,name:f,props:m}of P){if(!m)continue;const U=i(w,f,g);if(b.push(U),!e.has(U)){const y=Mt(()=>m(g,{push:t,replace:n,reject:r}));e.set(U,y)}R.push((async()=>{const y=await e.get(U);if(y instanceof Error)throw y})())}h(b);try{return await Promise.all(R),{status:"SUCCESS"}}catch(w){if(w instanceof se||w instanceof be)return w.response;throw w}},l=(g,P,b)=>{const R=i(g,P,b);return e.get(R)};function i(g,P,b){return[g,P,b.id,JSON.stringify(b.params)].join("-")}function u(g){return Ce(g)?Object.entries(g.props??{}).map(([P,b])=>({id:g.id,name:P,props:b})):xe(g)?[{id:g.id,name:"default",props:g.props}]:[]}function h(g){for(const P in e.keys())g.includes(P)||e.delete(P)}return{getPrefetchProps:o,setPrefetchProps:a,getProps:l,setProps:s}}function Wt(){const e=c.inject(Ft);if(!e)throw new te;return e}const Cr=c.defineAsyncComponent(()=>new Promise(e=>{e({default:{template:"foo"}})}));function Jt(e){return e.name===Cr.name&&"__asyncLoader"in e}function Gt(e,t,n){c.watch(e,(r,o)=>{r&&r.addEventListener(t,n),o&&o.removeEventListener(t,n)},{immediate:!0}),c.onUnmounted(()=>{e.value&&e.value.removeEventListener(t,n)})}function Vr(e){const t=new Map,n=c.ref(),{getPrefetchProps:r,setPrefetchProps:o}=Wt(),{isElementVisible:a}=Wn(n),s=()=>{const u=Array.from(t.values()).reduce((h,g)=>(Object.assign(h,g),h),{});o(u)};c.watch(()=>c.toValue(e),({route:u,...h})=>{t.clear(),u&&i("eager",u,h)},{immediate:!0}),c.watch(a,u=>{const{route:h,...g}=c.toValue(e);!h||!u||i("lazy",h,g)},{immediate:!0}),Gt(n,"focusin",l),Gt(n,"mouseover",l);function l(){const{route:u,...h}=c.toValue(e);u&&i("intent",u,h)}function i(u,h,g){Nr(u,h,g),t.has(u)||t.set(u,r(u,h,g))}return{element:n,commit:s}}function Nr(e,t,n){t.matches.forEach(r=>{Tt({...n,routePrefetch:r.prefetch},"components")===e&&(xe(r)&&Jt(r.component)&&r.component.__asyncLoader(),Ce(r)&&Object.values(r.components).forEach(a=>{Jt(a)&&a.__asyncLoader()}))})}function Je(e,t,{exact:n}={}){return bn(e)?t===void 0?!0:n?e.matched.name===t:e.matches.map(r=>r.name).includes(t):!1}function Qt(e,t={},n={}){const r=ye(),o=c.computed(()=>{const R=c.toValue(e);return typeof R!="string"?R:N(R)?r.find(R,c.toValue(n)):r.resolve(R,c.toValue(t),c.toValue(n))}),a=c.computed(()=>{if(o.value)return o.value.href;const R=c.toValue(e);if(N(R))return R;console.error(new Error("Failed to resolve route in RouterLink."))}),s=c.computed(()=>Je(r.route)&&r.route.matches.some(R=>{var w;return R.id===((w=o.value)==null?void 0:w.id)})),l=c.computed(()=>{var R;return r.route.id===((R=o.value)==null?void 0:R.id)}),i=c.computed(()=>!!a.value&&r.isExternal(a.value)),u=c.computed(()=>{const R=c.toValue(e);return typeof R!="string"||N(R)?c.toValue(t):c.toValue(n)}),{element:h,commit:g}=Vr(()=>({route:o.value,routerPrefetch:r.prefetch,linkPrefetch:u.value.prefetch})),P=R=>{g();const w={replace:(R==null?void 0:R.replace)??u.value.replace,query:Ie(u.value.query,R==null?void 0:R.query),hash:(R==null?void 0:R.hash)??u.value.hash,state:{...u.value.state,...R==null?void 0:R.state}},f=c.toValue(e);return N(f)||typeof f=="object"?r.push(f,w):r.push(f,c.toValue(t),w)};return{element:h,route:o,href:a,isMatch:s,isExactMatch:l,isExternal:i,push:P,replace:R=>P({...R,replace:!0})}}const jr=["href"],zt=c.defineComponent({__name:"routerLink",props:{to:{},prefetch:{type:[Boolean,String,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(e){const t=e,n=ye(),r=c.computed(()=>P(t.to)),o=c.computed(()=>b(t.to)),a=c.computed(()=>{const{to:w,...f}=t;return f}),{element:s,isMatch:l,isExactMatch:i,isExternal:u,push:h}=Qt(()=>typeof t.to=="function"?t.to(n.resolve):t.to,a),g=c.computed(()=>({"router-link--match":l.value,"router-link--exact-match":i.value}));function P(w){if(typeof w=="function"){const f=w(n.resolve);return P(f)}return N(w)?n.find(w):w}function b(w){if(typeof w=="function"){const f=w(n.resolve);return b(f)}return N(w)?w:w==null?void 0:w.href}function R(w){w.preventDefault(),h()}return(w,f)=>(c.openBlock(),c.createElementBlock("a",{ref_key:"element",ref:s,href:o.value,class:c.normalizeClass(["router-link",g.value]),onClick:R},[c.renderSlot(w.$slots,"default",c.normalizeProps(c.guardReactiveProps({route:r.value,isMatch:c.unref(l),isExactMatch:c.unref(i),isExternal:c.unref(u)})))],10,jr))}});function Kt(e,t){const n=ye();function r(){if(!e)return;if(!Je(n.route,e,t))throw new et(e,n.route.name)}return c.watch(n.route,r,{immediate:!0,deep:!0}),n.route}const Yt=Symbol();function Ge(){return c.inject(Yt,0)}function Hr(e,t){return c.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=t(),r=c.getCurrentInstance();return()=>n instanceof Error?"":Dt(n)?r!=null&&r.suspense?c.h(qr(e,n)):c.h($r(e,n)):c.h(e,n)}})}function $r(e,t){return c.defineComponent({name:"AsyncPropsWrapper",expose:[],setup(){const n=c.ref();return(async()=>n.value=await t)(),()=>n.value instanceof Error?"":n.value?c.h(e,n.value):""}})}function qr(e,t){return c.defineComponent({name:"SuspenseAsyncPropsWrapper",expose:[],async setup(){const n=await t;return()=>c.h(e,n)}})}const Xt=c.defineComponent({__name:"routerView",props:{name:{default:"default"}},setup(e){const t=Kt(),n=Pn(),r=Ge(),{getProps:o}=Wt(),a=c.resolveComponent("RouterView",!0);c.provide(Yt,r+1);const s=c.computed(()=>{if(n.value)return n.value.component;const u=t.matches.at(r);if(!u)return null;const h=l(u),g=o(u.id,e.name,t);return h?g?Hr(h,()=>g):h:null});function l(u){return i(u)[e.name]}function i(u){return Ce(u)?u.components:xe(u)?{default:u.component}:typeof a=="string"?{}:{default:a}}return(u,h)=>s.value?c.renderSlot(u.$slots,"default",c.normalizeProps(c.mergeProps({key:0},{route:c.unref(t),component:s.value,rejection:c.unref(n)})),()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(s.value)))]):c.createCommentVNode("",!0)}});function Zt(){const e=c.inject(Et);if(!e)throw new te;return e}function en(e){return t=>{const n=Ge(),o=Zt().addComponentBeforeRouteHook({lifecycle:e,hook:t,depth:n});return c.onUnmounted(o),o}}function Qe(e){return t=>{const n=Ge(),o=Zt().addComponentAfterRouteHook({lifecycle:e,hook:t,depth:n});return c.onUnmounted(o),o}}const _r=en("onBeforeRouteUpdate"),Ir=en("onBeforeRouteLeave"),Or=Qe("onAfterRouteEnter"),Tr=Qe("onAfterRouteUpdate"),Dr=Qe("onAfterRouteLeave");function Mr(e){return ue(e)&&typeof e.value=="string"}function tn(e){return Mr(e)?e:Ht(e,{})}function Fr(e){const t=He(),n=qt(e.name),r=_t(e.path),o=It(e.query),a=$t(e.hash),s=e.meta??{},l=hn(e)?tn(e.host):tn(""),i=c.markRaw({id:t,meta:{},state:{},...e}),u={id:t,matched:i,matches:[i],name:n,host:l,path:r,query:o,hash:a,meta:s,depth:1,state:{}},h=rt(e)?ot(e.parent,u):u;return re(h.path.params,h.query.params,h.host.params),h}A.DuplicateParamsError=Xe,A.MetaPropertyConflict=Ze,A.RouterLink=zt,A.RouterNotInstalledError=te,A.RouterView=Xt,A.UseRouteInvalidError=et,A.asUrl=Be,A.createExternalRoute=Fr,A.createParam=it,A.createRoute=ee,A.createRouter=vr,A.createRouterPlugin=Pr,A.isRoute=Je,A.isUrl=N,A.onAfterRouteEnter=Or,A.onAfterRouteLeave=Tr,A.onAfterRouteUpdate=Dr,A.onBeforeRouteLeave=_r,A.onBeforeRouteUpdate=Ir,A.path=ke,A.query=Me,A.useLink=Qt,A.useRoute=Kt,A.useRouter=ye,A.withDefault=yn,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(A,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],c):(A=typeof globalThis<"u"?globalThis:A||self,c(A["@kitbag/router"]={},A.Vue))})(this,function(A,c){"use strict";var Wn=Object.defineProperty;var Jn=(A,c,N)=>c in A?Wn(A,c,{enumerable:!0,configurable:!0,writable:!0,value:N}):A[c]=N;var F=(A,c,N)=>Jn(A,typeof c!="symbol"?c+"":c,N);function N(e){return typeof e!="string"?!1:/^(https?:\/\/|\/).*/g.test(e)}function xe(e){return N(e)?e:`/${e}`}class Ye extends Error{constructor(t){super(`Invalid Param "${t}": Router does not support multiple params by the same name. All param names must be unique.`)}}class Xe extends Error{constructor(t){super(`Child property on meta for ${t} conflicts with the parent meta.`)}}class te extends Error{constructor(){super("Router not installed")}}class Ze extends Error{constructor(t,r){super(`useRoute called with incorrect route. Given ${t}, expected ${r}`)}}const et=Symbol();function ye(){const e=c.inject(et);if(!e)throw new te;return e}function ue(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function W(e){return typeof e=="string"&&e.length>0}function ge(e){return{value:W(e)?e.replace(/^#*/,""):void 0}}function or(e,t){return ge(`${e.value??""}${t.value??""}`)}function ar(e,t){return sr(e,t),{...e,...t}}function sr(e,t){const r=Object.keys(e).find(n=>n in t&&typeof t[n]!=typeof e[n]);if(r)throw new Xe(r)}function re(e){return Array.isArray(e)?e:[e]}function tt(e,t){return e.filter(r=>t===r).length}function ne(...e){const t=e.flatMap(r=>Array.isArray(r)?r:Object.keys(r).map(cr));for(const r of t)if(tt(t,r)>1)throw new Ye(r)}function cr(e){return e.startsWith("?")?e.slice(1):e}function ur(e,t){return ne(e.params,t.params),{value:`${e.value}${t.value}`,params:{...e.params,...t.params}}}function ir(e,t){return ne(e.params,t.params),{value:[e.value,t.value].filter(W).join("&"),params:{...e.params,...t.params}}}function fr(e,t){return ne(e,t),{...e,...t}}function lr(e){return"host"in e&&!!e.host}function rt(e){return"parent"in e&&!!e.parent}function Be(e){return"component"in e&&!!e.component}function Ce(e){return"components"in e&&!!e.components}function hr(e){return"state"in e&&!!e.state}function nt(e,t){return{...t,path:ur(e.path,t.path),query:ir(e.query,t.query),meta:ar(e.meta,t.meta),state:fr(e.state,t.state),hash:or(e.hash,t.hash),matches:[...e.matches,t.matched],host:e.host,depth:e.depth+1}}function Ve(){return typeof window<"u"&&typeof window.document<"u"}class ie extends Error{}const J="[",Q="]";function dr(e){return e!==String&&e!==Boolean&&e!==Number&&e!==Date}function pr(e){return typeof e=="function"&&dr(e)}function we(e){return typeof e=="object"&&"get"in e&&typeof e.get=="function"&&"set"in e&&typeof e.set=="function"}function mr(e){return we(e)&&e.defaultValue!==void 0}function Rr(e,t){return ut(e,t)}function yr(e,t){return e[t]??String}const $={invalid:e=>{throw new ie(e)}},gr={get:e=>e,set:(e,{invalid:t})=>{if(typeof e!="string")throw t();return e}},ot={get:(e,{invalid:t})=>{if(e==="true")return!0;if(e==="false")return!1;throw t()},set:(e,{invalid:t})=>{if(typeof e!="boolean")throw t();return e.toString()}},at={get:(e,{invalid:t})=>{const r=Number(e);if(isNaN(r))throw t();return r},set:(e,{invalid:t})=>{if(typeof e!="number")throw t();return e.toString()}},st={get:(e,{invalid:t})=>{const r=new Date(e);if(isNaN(r.getTime()))throw t();return r},set:(e,{invalid:t})=>{if(typeof e!="object"||!(e instanceof Date))throw t();return e.toISOString()}},ct={get:(e,{invalid:t})=>{try{return JSON.parse(e)}catch{throw t()}},set:(e,{invalid:t})=>{try{return JSON.stringify(e)}catch{throw t()}}};function fe(e,t,r=!1){if(e===void 0||!W(e)){if(mr(t))return t.defaultValue;if(r)return;throw new ie}if(t===String)return gr.get(e,$);if(t===Boolean)return ot.get(e,$);if(t===Number)return at.get(e,$);if(t===Date)return st.get(e,$);if(t===JSON)return ct.get(e,$);if(pr(t))return t(e,$);if(we(t))return t.get(e,$);if(t instanceof RegExp){if(t.test(e))return e;throw new ie}return e}function le(e,t,r=!1){if(e===void 0){if(r)return"";throw new ie}if(t===Boolean)return ot.set(e,$);if(t===Number)return at.set(e,$);if(t===Date)return st.set(e,$);if(t===JSON)return ct.set(e,$);if(we(t))return t.set(e,$);try{return e.toString()}catch{throw new ie}}function ut(e,t){return we(e)?{...e,defaultValue:t??e.defaultValue}:{get:r=>fe(r,e),set:r=>le(r,e),defaultValue:t}}function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},z.apply(null,arguments)}var H;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(H||(H={}));var oe=process.env.NODE_ENV!=="production"?function(e){return Object.freeze(e)}:function(e){return e};function Y(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}var ve="beforeunload",wr="hashchange",it="popstate";function ft(e){e===void 0&&(e={});var t=e,r=t.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var p=n.location,d=p.pathname,v=p.search,x=p.hash,B=o.state||{};return[B.idx,oe({pathname:d,search:v,hash:x,state:B.usr||null,key:B.key||"default"})]}var s=null;function l(){if(s)b.call(s),s=null;else{var p=H.Pop,d=a(),v=d[0],x=d[1];if(b.length)if(v!=null){var B=h-v;B&&(s={action:p,location:x,retry:function(){k(B*-1)}},k(B))}else process.env.NODE_ENV!=="production"&&Y(!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 U(p)}}n.addEventListener(it,l);var i=H.Pop,u=a(),h=u[0],g=u[1],P=ae(),b=ae();h==null&&(h=0,o.replaceState(z({},o.state,{idx:h}),""));function R(p){return typeof p=="string"?p:X(p)}function w(p,d){return d===void 0&&(d=null),oe(z({pathname:g.pathname,hash:"",search:""},typeof p=="string"?he(p):p,{state:d,key:Pe()}))}function f(p,d){return[{usr:p.state,key:p.key,idx:d},R(p)]}function m(p,d,v){return!b.length||(b.call({action:p,location:d,retry:v}),!1)}function U(p){i=p;var d=a();h=d[0],g=d[1],P.call({action:i,location:g})}function y(p,d){var v=H.Push,x=w(p,d);function B(){y(p,d)}if(m(v,x,B)){var V=f(x,h+1),j=V[0],_=V[1];try{o.pushState(j,"",_)}catch{n.location.assign(_)}U(v)}}function E(p,d){var v=H.Replace,x=w(p,d);function B(){E(p,d)}if(m(v,x,B)){var V=f(x,h),j=V[0],_=V[1];o.replaceState(j,"",_),U(v)}}function k(p){o.go(p)}var L={get action(){return i},get location(){return g},createHref:R,push:y,replace:E,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(d){return P.push(d)},block:function(d){var v=b.push(d);return b.length===1&&n.addEventListener(ve,Ee),function(){v(),b.length||n.removeEventListener(ve,Ee)}}};return L}function vr(e){e===void 0&&(e={});var t=e,r=t.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var d=he(n.location.hash.substr(1)),v=d.pathname,x=v===void 0?"/":v,B=d.search,V=B===void 0?"":B,j=d.hash,_=j===void 0?"":j,O=o.state||{};return[O.idx,oe({pathname:x,search:V,hash:_,state:O.usr||null,key:O.key||"default"})]}var s=null;function l(){if(s)b.call(s),s=null;else{var d=H.Pop,v=a(),x=v[0],B=v[1];if(b.length)if(x!=null){var V=h-x;V&&(s={action:d,location:B,retry:function(){L(V*-1)}},L(V))}else process.env.NODE_ENV!=="production"&&Y(!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 y(d)}}n.addEventListener(it,l),n.addEventListener(wr,function(){var d=a(),v=d[1];X(v)!==X(g)&&l()});var i=H.Pop,u=a(),h=u[0],g=u[1],P=ae(),b=ae();h==null&&(h=0,o.replaceState(z({},o.state,{idx:h}),""));function R(){var d=document.querySelector("base"),v="";if(d&&d.getAttribute("href")){var x=n.location.href,B=x.indexOf("#");v=B===-1?x:x.slice(0,B)}return v}function w(d){return R()+"#"+(typeof d=="string"?d:X(d))}function f(d,v){return v===void 0&&(v=null),oe(z({pathname:g.pathname,hash:"",search:""},typeof d=="string"?he(d):d,{state:v,key:Pe()}))}function m(d,v){return[{usr:d.state,key:d.key,idx:v},w(d)]}function U(d,v,x){return!b.length||(b.call({action:d,location:v,retry:x}),!1)}function y(d){i=d;var v=a();h=v[0],g=v[1],P.call({action:i,location:g})}function E(d,v){var x=H.Push,B=f(d,v);function V(){E(d,v)}if(process.env.NODE_ENV!=="production"&&Y(B.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(d)+")"),U(x,B,V)){var j=m(B,h+1),_=j[0],O=j[1];try{o.pushState(_,"",O)}catch{n.location.assign(O)}y(x)}}function k(d,v){var x=H.Replace,B=f(d,v);function V(){k(d,v)}if(process.env.NODE_ENV!=="production"&&Y(B.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(d)+")"),U(x,B,V)){var j=m(B,h),_=j[0],O=j[1];o.replaceState(_,"",O),y(x)}}function L(d){o.go(d)}var p={get action(){return i},get location(){return g},createHref:w,push:E,replace:k,go:L,back:function(){L(-1)},forward:function(){L(1)},listen:function(v){return P.push(v)},block:function(v){var x=b.push(v);return b.length===1&&n.addEventListener(ve,Ee),function(){x(),b.length||n.removeEventListener(ve,Ee)}}};return p}function lt(e){e===void 0&&(e={});var t=e,r=t.initialEntries,n=r===void 0?["/"]:r,o=t.initialIndex,a=n.map(function(y){var E=oe(z({pathname:"/",search:"",hash:"",state:null,key:Pe()},typeof y=="string"?he(y):y));return process.env.NODE_ENV!=="production"&&Y(E.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(y)+")"),E}),s=ht(o??a.length-1,0,a.length-1),l=H.Pop,i=a[s],u=ae(),h=ae();function g(y){return typeof y=="string"?y:X(y)}function P(y,E){return E===void 0&&(E=null),oe(z({pathname:i.pathname,search:"",hash:""},typeof y=="string"?he(y):y,{state:E,key:Pe()}))}function b(y,E,k){return!h.length||(h.call({action:y,location:E,retry:k}),!1)}function R(y,E){l=y,i=E,u.call({action:l,location:i})}function w(y,E){var k=H.Push,L=P(y,E);function p(){w(y,E)}process.env.NODE_ENV!=="production"&&Y(i.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(y)+")"),b(k,L,p)&&(s+=1,a.splice(s,a.length,L),R(k,L))}function f(y,E){var k=H.Replace,L=P(y,E);function p(){f(y,E)}process.env.NODE_ENV!=="production"&&Y(i.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(y)+")"),b(k,L,p)&&(a[s]=L,R(k,L))}function m(y){var E=ht(s+y,0,a.length-1),k=H.Pop,L=a[E];function p(){m(y)}b(k,L,p)&&(s=E,R(k,L))}var U={get index(){return s},get action(){return l},get location(){return i},createHref:g,push:w,replace:f,go:m,back:function(){m(-1)},forward:function(){m(1)},listen:function(E){return u.push(E)},block:function(E){return h.push(E)}};return U}function ht(e,t,r){return Math.min(Math.max(e,t),r)}function Ee(e){e.preventDefault(),e.returnValue=""}function ae(){var e=[];return{get length(){return e.length},push:function(r){return e.push(r),function(){e=e.filter(function(n){return n!==r})}},call:function(r){e.forEach(function(n){return n&&n(r)})}}}function Pe(){return Math.random().toString(36).substr(2,8)}function X(e){var t=e.pathname,r=t===void 0?"/":t,n=e.search,o=n===void 0?"":n,a=e.hash,s=a===void 0?"":a;return o&&o!=="?"&&(r+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(r+=s.charAt(0)==="#"?s:"#"+s),r}function he(e){var t={};if(e){var r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));var n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}const dt=Symbol();function Er(){const e=c.inject(dt);if(!e)throw new te;return e}const pt=Symbol("isRouterRouteSymbol");function Pr(e){return typeof e=="object"&&e!==null&&pt in e}function br(e,t){function r(f,m,U){if(typeof f=="object"){const E={...e.params,...f};return t(e.name,E,m)}const y={...e.params,[f]:m};return t(e.name,y,U)}const n=(...f)=>{const m=new URLSearchParams(e.query);m.set(...f),r({},{query:m})},o=(...f)=>{const m=new URLSearchParams(e.query);m.append(...f),r({},{query:m})},a=(...f)=>{const m=new URLSearchParams(e.query);m.delete(...f),r({},{query:m})},{id:s,matched:l,matches:i,name:u,hash:h,href:g}=c.toRefs(e),P=c.computed({get(){return new Proxy(e.params,{set(f,m,U){return r(m,U),!0}})},set(f){r(f)}}),b=c.computed({get(){return new Proxy(e.query,{get(f,m,U){switch(m){case"append":return o;case"set":return n;case"delete":return a;default:return Reflect.get(f,m,U)}}})},set(f){r({},{query:f})}}),R=c.computed({get(){return new Proxy(e.state,{set(f,m,U){return r({},{state:{...e.state,[m]:U}}),!0}})},set(f){r({},{state:f})}});return c.reactive({id:s,matched:l,matches:i,state:R,query:b,hash:h,params:P,name:u,href:g,update:r,[pt]:!0})}const mt=Symbol();function Sr(e,t){const r=c.reactive({...e}),n=s=>{Object.assign(r,{[mt]:!1,...s})},o=r,a=br(o,t);return{currentRoute:o,routerRoute:a,updateRoute:n}}function q(e){return!e.startsWith("http")?kr(e):Ar(e)}function Ar(e){const{protocol:t,host:r,pathname:n,search:o,searchParams:a,hash:s}=new URL(e,e);return{protocol:t,host:r,pathname:n,search:o,searchParams:a,hash:s}}function kr(e){const{pathname:t,search:r,searchParams:n,hash:o}=new URL(e,"https://localhost");return{pathname:t,search:r,searchParams:n,hash:o}}function Ur(e){return t=>{const{host:r}=q(t);return!(r===void 0||r===e)}}function Lr({mode:e,listener:t}){const r=xr(e),n=(i,u)=>{if(u!=null&&u.replace){r.replace(i,u.state);return}r.push(i,u==null?void 0:u.state)},o=()=>{const i=X(r.location);r.replace(i)};let a;return{...r,update:n,refresh:o,startListening:()=>{a==null||a(),a=r.listen(t)},stopListening:()=>{a==null||a()}}}function xr(e="auto"){switch(e){case"auto":return Ve()?ft():lt();case"browser":return ft();case"memory":return lt();case"hash":return vr();default:const t=e;throw new Error(`Switch is not exhaustive for mode: ${t}`)}}class Rt extends Error{constructor(){super("Uncaught CallbackContextAbortError");F(this,"response");this.response={status:"ABORT"}}}class se extends Error{constructor(r){super("Uncaught CallbackContextPushError");F(this,"response");this.response={status:"PUSH",to:r}}}class be extends Error{constructor(r){super("Uncaught CallbackContextRejectionError");F(this,"response");this.response={status:"REJECT",type:r}}}function yt(){return{reject:o=>{throw new be(o)},push:(...o)=>{throw new se(o)},replace:(o,a,s)=>{if(N(o)){const u=a??{};throw new se([o,{...u,replace:!0}])}const l=a,i=s??{};throw new se([o,l,{...i,replace:!0}])},abort:()=>{throw new Rt}}}class Z{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)}}const de=(e,t,r)=>{var a,s;const n=e.matches,o=(t==null?void 0:t.matches)??[];return((a=n.at(r))==null?void 0:a.id)!==((s=o.at(r))==null?void 0:s.id)},pe=(e,t,r)=>{var a,s;const n=e.matches,o=(t==null?void 0:t.matches)??[];return((a=n.at(r))==null?void 0:a.id)!==((s=o.at(r))==null?void 0:s.id)},me=(e,t,r)=>{var n,o;return((n=e.matches.at(r))==null?void 0:n.id)===((o=t==null?void 0:t.matches.at(r))==null?void 0:o.id)};function gt(e){switch(e){case"onBeforeRouteEnter":case"onAfterRouteEnter":return de;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return me;case"onBeforeRouteLeave":case"onAfterRouteLeave":return pe;default:throw new Error(`Switch is not exhaustive for lifecycle: ${e}`)}}function Br(e,t){const r=new Z;return e.matches.forEach((n,o)=>{n.onBeforeRouteEnter&&de(e,t,o)&&re(n.onBeforeRouteEnter).forEach(a=>r.onBeforeRouteEnter.add(a)),n.onBeforeRouteUpdate&&me(e,t,o)&&re(n.onBeforeRouteUpdate).forEach(a=>r.onBeforeRouteUpdate.add(a))}),t==null||t.matches.forEach((n,o)=>{n.onBeforeRouteLeave&&pe(e,t,o)&&re(n.onBeforeRouteLeave).forEach(a=>r.onBeforeRouteLeave.add(a))}),r}function Cr(e,t){const r=new Z;return e.matches.forEach((n,o)=>{n.onAfterRouteEnter&&de(e,t,o)&&re(n.onAfterRouteEnter).forEach(a=>r.onAfterRouteEnter.add(a)),n.onAfterRouteUpdate&&me(e,t,o)&&re(n.onAfterRouteUpdate).forEach(a=>r.onAfterRouteUpdate.add(a))}),t==null||t.matches.forEach((n,o)=>{n.onAfterRouteLeave&&pe(e,t,o)&&re(n.onAfterRouteLeave).forEach(a=>r.onAfterRouteLeave.add(a))}),r}function Vr(e,t,r){const n=new Z;return e.matches.forEach((o,a)=>{de(e,t,a)&&r.onBeforeRouteEnter.forEach(s=>n.onBeforeRouteEnter.add(s)),me(e,t,a)&&r.onBeforeRouteUpdate.forEach(s=>n.onBeforeRouteUpdate.add(s))}),t==null||t.matches.forEach((o,a)=>{pe(e,t,a)&&r.onBeforeRouteLeave.forEach(s=>n.onBeforeRouteLeave.add(s))}),n}function Nr(e,t,r){const n=new Z;return e.matches.forEach((o,a)=>{de(e,t,a)&&r.onAfterRouteEnter.forEach(s=>n.onAfterRouteEnter.add(s)),me(e,t,a)&&r.onAfterRouteUpdate.forEach(s=>n.onAfterRouteUpdate.add(s))}),t==null||t.matches.forEach((o,a)=>{pe(e,t,a)&&r.onAfterRouteLeave.forEach(s=>n.onAfterRouteLeave.add(s))}),n}const wt=Symbol();function jr(){const e={global:new Z,component:new Z},{reject:t,push:r,replace:n,abort:o}=yt(),a=f=>(e.global.onBeforeRouteEnter.add(f),()=>e.global.onBeforeRouteEnter.delete(f)),s=f=>(e.global.onBeforeRouteUpdate.add(f),()=>e.global.onBeforeRouteUpdate.delete(f)),l=f=>(e.global.onBeforeRouteLeave.add(f),()=>e.global.onBeforeRouteLeave.delete(f)),i=f=>(e.global.onAfterRouteEnter.add(f),()=>e.global.onAfterRouteEnter.delete(f)),u=f=>(e.global.onAfterRouteUpdate.add(f),()=>e.global.onAfterRouteUpdate.delete(f)),h=f=>(e.global.onAfterRouteLeave.add(f),()=>e.global.onAfterRouteLeave.delete(f));async function g({to:f,from:m}){const{global:U,component:y}=e,E=Br(f,m),k=Vr(f,m,U),L=[...k.onBeforeRouteEnter,...E.onBeforeRouteEnter,...k.onBeforeRouteUpdate,...E.onBeforeRouteUpdate,...y.onBeforeRouteUpdate,...k.onBeforeRouteLeave,...E.onBeforeRouteLeave,...y.onBeforeRouteLeave];try{const p=L.map(d=>d(f,{from:m,reject:t,push:r,replace:n,abort:o}));await Promise.all(p)}catch(p){if(p instanceof se||p instanceof be||p instanceof Rt)return p.response;throw p}return{status:"SUCCESS"}}async function P({to:f,from:m}){const{global:U,component:y}=e,E=Cr(f,m),k=Nr(f,m,U),L=[...y.onAfterRouteLeave,...E.onAfterRouteLeave,...k.onAfterRouteLeave,...y.onAfterRouteUpdate,...E.onAfterRouteUpdate,...k.onAfterRouteUpdate,...y.onAfterRouteEnter,...E.onAfterRouteEnter,...k.onAfterRouteEnter];try{const p=L.map(d=>d(f,{from:m,reject:t,push:r,replace:n}));await Promise.all(p)}catch(p){if(p instanceof se||p instanceof be)return p.response;throw p}return{status:"SUCCESS"}}return{runBeforeRouteHooks:g,runAfterRouteHooks:P,addComponentBeforeRouteHook:({lifecycle:f,depth:m,hook:U})=>{const y=gt(f),E=e.component[f],k=(L,p)=>{if(y(L,p.from,m))return U(L,p)};return E.add(k),()=>E.delete(k)},addComponentAfterRouteHook:({lifecycle:f,depth:m,hook:U})=>{const y=gt(f),E=e.component[f],k=(L,p)=>{if(y(L,p.from,m))return U(L,p)};return E.add(k),()=>E.delete(k)},addGlobalRouteHooks:f=>{f.onBeforeRouteEnter.forEach(m=>a(m)),f.onBeforeRouteUpdate.forEach(m=>s(m)),f.onBeforeRouteLeave.forEach(m=>l(m)),f.onAfterRouteEnter.forEach(m=>i(m)),f.onAfterRouteUpdate.forEach(m=>u(m)),f.onAfterRouteLeave.forEach(m=>h(m))},onBeforeRouteEnter:a,onBeforeRouteUpdate:s,onBeforeRouteLeave:l,onAfterRouteEnter:i,onAfterRouteUpdate:u,onAfterRouteLeave:h}}function Hr(e){return c.defineComponent(()=>()=>c.h("h1",e),{name:e,props:[]})}function Ne(e){const t=new URLSearchParams(e);return{get:(...r)=>t.get(...r),getAll:(...r)=>t.getAll(...r),set:(...r)=>{t.set(...r)},append:(...r)=>{t.append(...r)},delete:(...r)=>{t.delete(...r)},toString:(...r)=>t.toString(...r),forEach:(...r)=>{t.forEach(...r)},entries:(...r)=>t.entries(...r),keys:(...r)=>t.keys(...r),values:(...r)=>t.values(...r),has:(...r)=>t.has(...r),size:t.size,sort:()=>{t.sort()},[Symbol.iterator]:()=>t[Symbol.iterator]()}}function je(){let e=0;return()=>(++e).toString()}const $r=je()();function qr(e){return e===$r}const He=je();function _r(e){const t=a=>c.markRaw(e[a]??Hr(a)),r=a=>{const s=c.markRaw(t(a)),l={id:He(),component:s,meta:{},state:{}};return{id:l.id,matched:l,matches:[l],name:a,query:Ne(""),params:{},state:{},href:"/",hash:"",[mt]:!0}},n=a=>{if(!a){o.value=null;return}const s=t(a);o.value={type:a,component:s}},o=c.ref(null);return{setRejection:n,rejection:o,getRejectionRoute:r}}class Ir extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Or(e){if(e)return e;if(Ve())return window.location.toString();throw new Ir}function vt(e){return!!e&&typeof e=="object"}const Se=!0;function Tr(e,t,r){if(vt(e)&&t in e){const n=e[t];return typeof n=="string"?fe(n,r,Se):n}return fe(void 0,r,Se)}function Et(e,t){const r={};for(const[n,o]of Object.entries(e)){const a=Tr(t,n,o);r[n]=a}return r}function Dr(e,t,r){if(vt(e)&&t in e){const n=e[t];return le(n,r,Se)}return le(void 0,r,Se)}const Pt=(e,t)=>{const r={};for(const[n,o]of Object.entries(e)){const a=Dr(t,n,o);r[n]=a}return r};function Mr(){const e=c.reactive(new Map),t=Ve()?s():null,r=l=>{e.set(l,!1),t==null||t.observe(l)},n=l=>{e.delete(l),t==null||t.unobserve(l)},o=()=>{t==null||t.disconnect()},a=l=>e.get(l)??!1;function s(){return new IntersectionObserver(l=>{l.forEach(i=>{e.set(i.target,i.isIntersecting)})})}return{observe:r,unobserve:n,disconnect:o,isElementVisible:a}}const bt=Symbol("visibilityObserver");function Fr(e){const t=c.inject(bt);if(!t)throw new te;return c.watch(e,(n,o)=>{n&&t.observe(n),o&&t.unobserve(o)},{immediate:!0}),c.onUnmounted(()=>{e.value&&t.unobserve(e.value)}),{isElementVisible:c.computed(()=>e.value?t.isElementVisible(e.value):!1)}}class Wr extends Error{constructor(t){super(`Route not found: "${t}"`)}}function $e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jr(e,t){const r=Array.from(e.matchAll(t));if(r.length===0)return[e];let n=0;const o=r.reduce((s,l)=>{const i=$e(e.slice(n,l.index));i.length&&s.push(i);const[u]=l;return s.push(u),n=l.index+u.length,s},[]),a=e.slice(n);return a&&o.push(a),o}function Gr(e){const t=St(e.path.value);return new RegExp(`^${t}$`,"i")}function Qr(e){const t=new URLSearchParams(e.query.value);return Array.from(t.entries()).filter(([,r])=>!_e(r)).map(([r,n])=>{const o=St(n);return new RegExp(`${$e(r)}=${o}(&|$)`,"i")})}function St(e){return Jr(e,new RegExp(zr,"g")).map(t=>t.startsWith(J)?At(t):$e(t)).join("")}function At(e){return[Kr,Yr].reduce((t,r)=>r(t),e)}const zr=`\\${J}\\??([\\w-_]+)\\${Q}`,qe=`\\${J}\\?([\\w-_]+)\\${Q}`,kt=`\\${J}([\\w-_]+)\\${Q}`;function Kr(e){return e.replace(new RegExp(qe,"g"),".*")}function _e(e){return new RegExp(qe,"g").test(e)}function Yr(e){return e.replace(new RegExp(kt,"g"),".+")}function Re(e){const[t]=Ae(e,new RegExp(qe,"g")),[r]=Ae(e,new RegExp(kt,"g"));return t??r}function Ae(e,t){return Array.from(e.matchAll(t)).flatMap(([,...n])=>n.map(o=>W(o)?o:""))}function Ut(e,t,r){const n=xt(t,r),[o]=Ae(e,n);return o}function Lt(e,t){if(!t)return e;const{name:r,param:n,value:o}=t,a=xt(e,r);return Ae(e,a).reduce((l,i)=>i===void 0?l:l.replace(i,()=>le(o,n,r.startsWith("?"))),e)}function xt(e,t){const r=[Xr,Zr,At].reduce((n,o)=>o(n,t),e);return new RegExp(r,"g")}function Xr(e,t){if(!t.startsWith("?"))return e;const r=new RegExp(`\\${J}\\${t}\\${Q}`,"g");return e.replace(r,"(.*)")}function Zr(e,t){if(t.startsWith("?"))return e;const r=new RegExp(`\\${J}${t}\\${Q}`,"g");return e.replace(r,"(.+)")}function Bt({protocol:e,host:t,pathname:r,search:n,searchParams:o,hash:a}){const s=new URL("https://localhost");e&&(s.protocol=e),t&&(s.host=t),r&&(s.pathname=r),o?s.search=new URLSearchParams(o).toString():n&&(s.search=n),a&&(s.hash=a);const l=s.toString().replace(/^https:\/\/localhost\/*/,"/");return xe(l)}function Ie(...e){const t=new URLSearchParams;for(const r of e){const n=new URLSearchParams(r);for(const[o,a]of n.entries())t.append(o,a)}return t}function en(e,t={}){const{params:r={},query:n}=t,o=nn(e.query,r),a=Ie(o,n),s=rn(e.path,r),l=ge(e.hash.value??t.hash).value,i=tn(e.host,r),{protocol:u,host:h}=q(i);return Bt({protocol:u,host:h,pathname:s,searchParams:a,hash:l})}function tn(e,t){const r=e.value&&!e.value.startsWith("http")?`https://${e.value}`:e.value;return Object.entries(e.params).reduce((n,[o,a])=>{const s=Re(`${J}${o}${Q}`);return s?Lt(n,{name:o,param:a,value:t[s]}):n},r)}function rn(e,t){return Object.entries(e.params).reduce((r,[n,o])=>{const a=Re(`${J}${n}${Q}`);return a?Lt(r,{name:n,param:o,value:t[a]}):r},e.value)}function nn(e,t){const r=new URLSearchParams(e.value);if(!e.value)return r;for(const[n,o]of Array.from(r.entries())){const a=Re(o);if(!a)continue;const l=_e(o),i=l?`?${a}`:a,u=le(t[a],e.params[i],l),h=t[a]===void 0&&u==="";l&&h?r.delete(n,o):r.set(n,u)}return r}const on=(e,t)=>{try{Oe(e,t)}catch{return!1}return!0},Oe=(e,t)=>{const{pathname:r,search:n}=q(t);return{...an(e.path,r),...sn(e.query,n)}};function an(e,t){const r={},n=decodeURIComponent(t);for(const[o,a]of Object.entries(e.params)){const s=o.startsWith("?"),l=s?o.slice(1):o,i=Ut(n,e.value,o),u=fe(i,a,s);r[l]=u}return r}function sn(e,t){const r={},n=new URLSearchParams(e.value),o=new URLSearchParams(t);for(const[a,s]of Array.from(n.entries())){const l=Re(s);if(!l)continue;const u=_e(s),h=u?`?${l}`:l,g=o.get(a)??void 0,P=fe(g,e.params[h],u);r[l]=P}return r}function cn(e,t={},r={}){const n=en(e,{params:t,query:r.query,hash:r.hash}),{search:o,hash:a}=q(n);return{id:e.id,matched:e.matched,matches:e.matches,name:e.name,query:Ne(o),params:Oe(e,n),state:Et(e.state,r.state),hash:a,href:n}}const un=e=>"name"in e.matched&&!!e.matched.name,fn=(e,t)=>{const{pathname:r}=q(t);return Gr(e).test(r)},ln=(e,t)=>{const{search:r}=q(t);return Qr(e).every(o=>o.test(r))},Te=(e,t)=>{const{hash:r}=q(t),{value:n}=e.hash;return n===void 0||`#${n.toLowerCase()}`===r.toLowerCase()};function hn(e){const{searchParams:t,pathname:r}=q(e),n=-1,o=1;return(a,s)=>{const l=Vt(a,t),i=Ct(a,r),u=Vt(s,t),h=Ct(s,r);return a.depth>s.depth?n:a.depth<s.depth?o:l+i>u+h?n:l+i<u+h?o:Te(a,e)?n:Te(s,e)?o:0}}function Ct(e,t){const r=Object.keys(e.path.params).filter(o=>o.startsWith("?")).map(o=>o),n=r.filter(o=>Ut(t,e.path.value,o)===void 0);return r.length-n.length}function Vt(e,t){const r=new URLSearchParams(t),n=new URLSearchParams(e.query.value),o=Array.from(n.keys()),a=o.filter(s=>!r.has(s));return o.length-a.length}const dn=[un,fn,ln,Te,on];function pn(e,t){const r=hn(t);return e.filter(n=>dn.every(o=>o(n,t))).sort(r)}function mn(e,t,r){const n=pn(e,t);if(!n.length)return;const[o]=n,{searchParams:a,hash:s}=q(t);return{id:o.id,matched:o.matched,matches:o.matches,name:o.name,query:Ne(a),params:Oe(o,t),state:Et(o.state,r),hash:s,href:xe(t)}}function Nt(e,t){const r=typeof e=="string"?q(e):e,n=typeof t=="string"?q(t):t,o=r.searchParams??new URLSearchParams(r.search),a=n.searchParams??new URLSearchParams(n.search);return Bt({protocol:W(n.protocol)?n.protocol:r.protocol,host:W(n.host)?n.host:r.host,pathname:W(n.pathname)?n.pathname:r.pathname,searchParams:Ie(a,o),hash:W(n.hash)?n.hash:r.hash})}function De(e,t){const r=new RegExp(`\\${J}(\\??[\\w-_]+)\\${Q}`,"g");return Array.from(e.matchAll(r)).reduce((o,[a,s])=>{const l=Re(a);if(!l)return o;const i=yr(t,l);return ne([l],o),o[s]=i,o},{})}function ke(e,t){return{value:e,params:De(e,t)}}function Rn(e,t){return W(t)?e.map(r=>{const n=`${t}${r.path.value}`;return{...r,path:ke(n,r.path.params)}}):e}class yn extends Error{constructor(t){super(`Invalid Name "${t}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function gn(e){const t=e.map(({name:r})=>r);for(const r of t)if(tt(t,r)>1)throw new yn(r)}function wn(e,t=[],r){const n=[...e,...t.map(o=>o.routes)].flat();return gn(n),Rn(n,r)}function vn(e={},t=[]){const r=new Z;return ce("onBeforeRouteEnter",e,t).forEach(n=>r.onBeforeRouteEnter.add(n)),ce("onBeforeRouteUpdate",e,t).forEach(n=>r.onBeforeRouteUpdate.add(n)),ce("onBeforeRouteLeave",e,t).forEach(n=>r.onBeforeRouteLeave.add(n)),ce("onAfterRouteEnter",e,t).forEach(n=>r.onAfterRouteEnter.add(n)),ce("onAfterRouteUpdate",e,t).forEach(n=>r.onAfterRouteUpdate.add(n)),ce("onAfterRouteLeave",e,t).forEach(n=>r.onAfterRouteLeave.add(n)),r}function ce(e,t,r){return[t[e],...r.map(o=>o[e])].flat().filter(o=>o!==void 0)}function En(e,t,r=[]){const n=wn(e,r,t==null?void 0:t.base),o=jr();o.addGlobalRouteHooks(vn(t,r));const a=je(),s=Bn(),l=Mr(),i=Lr({mode:t==null?void 0:t.historyMode,listener:({location:S})=>{const C=X(S);h(C,{state:S.state,replace:!0})}});function u(S,C={}){return mn(n,S,C.state)}async function h(S,C={}){const G=a();if(i.stopListening(),v(S)){i.update(S,C);return}const T=u(S,C)??m("NotFound"),I=O(G),K=await o.runBeforeRouteHooks({to:T,from:I});switch(K.status){case"ABORT":return;case"PUSH":i.update(S,C),await P(...K.to);return;case"REJECT":i.update(S,C),w(K.type);break;case"SUCCESS":i.update(S,C),w(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(K)}`)}const Qe=G;s.setProps(T).then(D=>{if(Qe===G)switch(D.status){case"SUCCESS":break;case"PUSH":P(...D.to);break;case"REJECT":w(D.type);break;default:const ze=D;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(ze)}`)}}),k(T);const M=await o.runAfterRouteHooks({to:T,from:I});switch(M.status){case"PUSH":await P(...M.to);break;case"REJECT":w(M.type);break;case"SUCCESS":break;default:const D=M;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(D)}`)}i.startListening()}const g=(S,C={},G={})=>{const T=n.find(I=>I.name===S);if(!T)throw new Wr(String(S));return cn(T,C,G)},P=(S,C,G)=>{if(N(S)){const M={...C},D=Nt(S,{searchParams:M.query,hash:M.hash});return h(D,M)}if(typeof S=="string"){const{replace:M,...D}={...G},ze={...C},Ke=g(S,ze,D),Fn=Pt({...Ke.matched.state},{...Ke.state,...D.state});return h(Ke.href,{replace:M,state:Fn})}const{replace:T,...I}={...C},K=Pt({...S.matched.state},{...S.state,...I.state}),Qe=Nt(S.href,{searchParams:I.query,hash:I.hash});return h(Qe,{replace:T,state:K})},b=(S,C,G)=>{if(N(S)){const I={...C,replace:!0};return P(S,I)}if(typeof S=="string"){const I={...G,replace:!0},K={...C};return P(S,K,I)}const T={...C,replace:!0};return P(S,T)},R=S=>{w(S)},{setRejection:w,rejection:f,getRejectionRoute:m}=_r({...r.reduce((S,C)=>({...S,...C.rejections}),{}),...t==null?void 0:t.rejections}),U=m("NotFound"),{currentRoute:y,routerRoute:E,updateRoute:k}=Sr(U,P),L=Or(t==null?void 0:t.initialUrl),p=i.location.state,{host:d}=q(L),v=Ur(d);let x=!1;const{promise:B,resolve:V}=Promise.withResolvers();async function j(){if(x)return B;x=!0,await h(L,{replace:!0,state:p}),i.startListening(),V()}function _(){i.stopListening()}function O(S){return qr(S)?null:{...y}}function rr(S){S.component("RouterView",Yt),S.component("RouterLink",Qt),S.provide(dt,f),S.provide(wt,o),S.provide(Mt,s),S.provide(bt,l),S.provide(et,nr),j()}const nr={route:E,resolve:g,find:u,push:P,replace:b,reject:R,refresh:i.refresh,forward:i.forward,back:i.back,go:i.go,install:rr,isExternal:v,onBeforeRouteEnter:o.onBeforeRouteEnter,onBeforeRouteUpdate:o.onBeforeRouteUpdate,onBeforeRouteLeave:o.onBeforeRouteLeave,onAfterRouteEnter:o.onAfterRouteEnter,onAfterRouteUpdate:o.onAfterRouteUpdate,onAfterRouteLeave:o.onAfterRouteLeave,prefetch:t==null?void 0:t.prefetch,start:j,stop:_};return nr}function Me(e,t){return{value:e,params:De(e,t)}}function Pn(e){return{routes:e.routes??[],rejections:e.rejections??{},...e}}function jt(e,t){return{value:e,params:De(e,t)}}function bn(e){return ue(e)&&typeof e.hash=="string"}function Ht(e){return e===void 0?ge():bn(e)?e:ge(e)}function $t(e){return e===void 0?"":e}function Sn(e){return ue(e)&&typeof e.value=="string"}function qt(e){return e===void 0?ke("",{}):Sn(e)?e:ke(e,{})}function An(e){return ue(e)&&typeof e.value=="string"}function _t(e){return e===void 0?Me("",{}):An(e)?e:Me(e,{})}function ee(e){const t=He(),r=$t(e.name),n=qt(e.path),o=_t(e.query),a=Ht(e.hash),s=e.meta??{},l=hr(e)?e.state:{},i=c.markRaw({id:t,meta:{},state:{},...e}),u={id:t,matched:i,matches:[i],name:r,path:n,query:o,hash:a,meta:s,state:l,depth:1,host:jt("",{}),prefetch:e.prefetch},h=rt(e)?nt(e.parent,u):u;return ne(h.path.params,h.query.params),h}const Ue={template:"<div>This is component</div>"},Fe=ee({name:"parentA",path:"/parentA/[paramA]"}),It=ee({parent:Fe,name:"parentA.childA",path:"/childA/[?paramB]"}),kn=ee({parent:Fe,name:"parentA.childB",path:"/childB/[paramD]",component:Ue}),Un=ee({parent:It,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Ue});ee({name:"parentB",path:"/parentB",component:Ue}),ee({name:"parentC",path:"/",component:Ue});const Ln="lazy",xn={components:!0,props:!1};function Le(e){return["eager","lazy","intent"].includes(e)}function Ot({routerPrefetch:e,routePrefetch:t,linkPrefetch:r},n){const o=We(r,n),a=We(t,n),s=We(e,n),l=[o,a,s,xn[n],Ln].reduce((i,u)=>Le(i)?i:i===!0&&Le(u)?u:i===!0&&!Le(u)?i:i===void 0?u:i,void 0);return Le(l)?l:!1}function We(e,t){return ue(e)?e[t]:e}function Tt(e){return typeof e=="object"&&e!==null&&"then"in e}function Dt(e){try{const t=e();return Tt(t)?t.catch(r=>r):t}catch(t){return t}}const Mt=Symbol();function Bn(){const e=c.reactive(new Map),{push:t,replace:r,reject:n}=yt(),o=(g,P,b)=>P.matches.filter(R=>Ot({...b,routePrefetch:R.prefetch},"props")===g).flatMap(R=>u(R)).reduce((R,{id:w,name:f,props:m})=>{if(!m)return R;const U=i(w,f,P),y=Dt(()=>m(P,{push:t,replace:r,reject:n}));return R[U]=y,R},{}),a=g=>{Object.entries(g).forEach(([P,b])=>{e.set(P,b)})},s=async g=>{const P=g.matches.flatMap(u),b=[],R=[];for(const{id:w,name:f,props:m}of P){if(!m)continue;const U=i(w,f,g);if(b.push(U),!e.has(U)){const y=Dt(()=>m(g,{push:t,replace:r,reject:n}));e.set(U,y)}R.push((async()=>{const y=await e.get(U);if(y instanceof Error)throw y})())}h(b);try{return await Promise.all(R),{status:"SUCCESS"}}catch(w){if(w instanceof se||w instanceof be)return w.response;throw w}},l=(g,P,b)=>{const R=i(g,P,b);return e.get(R)};function i(g,P,b){return[g,P,b.id,JSON.stringify(b.params)].join("-")}function u(g){return Ce(g)?Object.entries(g.props??{}).map(([P,b])=>({id:g.id,name:P,props:b})):Be(g)?[{id:g.id,name:"default",props:g.props}]:[]}function h(g){for(const P in e.keys())g.includes(P)||e.delete(P)}return{getPrefetchProps:o,setPrefetchProps:a,getProps:l,setProps:s}}function Ft(){const e=c.inject(Mt);if(!e)throw new te;return e}const Cn=c.defineAsyncComponent(()=>new Promise(e=>{e({default:{template:"foo"}})}));function Wt(e){return e.name===Cn.name&&"__asyncLoader"in e}function Jt(e,t,r){c.watch(e,(n,o)=>{n&&n.addEventListener(t,r),o&&o.removeEventListener(t,r)},{immediate:!0}),c.onUnmounted(()=>{e.value&&e.value.removeEventListener(t,r)})}function Vn(e){const t=new Map,r=c.ref(),{getPrefetchProps:n,setPrefetchProps:o}=Ft(),{isElementVisible:a}=Fr(r),s=()=>{const u=Array.from(t.values()).reduce((h,g)=>(Object.assign(h,g),h),{});o(u)};c.watch(()=>c.toValue(e),({route:u,...h})=>{t.clear(),u&&i("eager",u,h)},{immediate:!0}),c.watch(a,u=>{const{route:h,...g}=c.toValue(e);!h||!u||i("lazy",h,g)},{immediate:!0}),Jt(r,"focusin",l),Jt(r,"mouseover",l);function l(){const{route:u,...h}=c.toValue(e);u&&i("intent",u,h)}function i(u,h,g){Nn(u,h,g),t.has(u)||t.set(u,n(u,h,g))}return{element:r,commit:s}}function Nn(e,t,r){t.matches.forEach(n=>{Ot({...r,routePrefetch:n.prefetch},"components")===e&&(Be(n)&&Wt(n.component)&&n.component.__asyncLoader(),Ce(n)&&Object.values(n.components).forEach(a=>{Wt(a)&&a.__asyncLoader()}))})}function Je(e,t,{exact:r}={}){return Pr(e)?t===void 0?!0:r?e.matched.name===t:e.matches.map(n=>n.name).includes(t):!1}function Gt(e,t={},r={}){const n=ye(),o=c.computed(()=>{const R=c.toValue(e);return typeof R!="string"?R:N(R)?n.find(R,c.toValue(r)):n.resolve(R,c.toValue(t),c.toValue(r))}),a=c.computed(()=>{if(o.value)return o.value.href;const R=c.toValue(e);if(N(R))return R;console.error(new Error("Failed to resolve route in RouterLink."))}),s=c.computed(()=>Je(n.route)&&n.route.matches.some(R=>{var w;return R.id===((w=o.value)==null?void 0:w.id)})),l=c.computed(()=>{var R;return n.route.id===((R=o.value)==null?void 0:R.id)}),i=c.computed(()=>!!a.value&&n.isExternal(a.value)),u=c.computed(()=>{const R=c.toValue(e);return typeof R!="string"||N(R)?c.toValue(t):c.toValue(r)}),{element:h,commit:g}=Vn(()=>({route:o.value,routerPrefetch:n.prefetch,linkPrefetch:u.value.prefetch})),P=R=>{g();const w={replace:(R==null?void 0:R.replace)??u.value.replace,query:Ie(u.value.query,R==null?void 0:R.query),hash:(R==null?void 0:R.hash)??u.value.hash,state:{...u.value.state,...R==null?void 0:R.state}},f=c.toValue(e);return N(f)||typeof f=="object"?n.push(f,w):n.push(f,c.toValue(t),w)};return{element:h,route:o,href:a,isMatch:s,isExactMatch:l,isExternal:i,push:P,replace:R=>P({...R,replace:!0})}}const jn=["href"],Qt=c.defineComponent({__name:"routerLink",props:{to:{},prefetch:{type:[Boolean,String,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(e){const t=e,r=ye(),n=c.computed(()=>P(t.to)),o=c.computed(()=>b(t.to)),a=c.computed(()=>{const{to:w,...f}=t;return f}),{element:s,isMatch:l,isExactMatch:i,isExternal:u,push:h}=Gt(()=>typeof t.to=="function"?t.to(r.resolve):t.to,a),g=c.computed(()=>({"router-link--match":l.value,"router-link--exact-match":i.value}));function P(w){if(typeof w=="function"){const f=w(r.resolve);return P(f)}return N(w)?r.find(w):w}function b(w){if(typeof w=="function"){const f=w(r.resolve);return b(f)}return N(w)?w:w==null?void 0:w.href}function R(w){w.preventDefault(),h()}return(w,f)=>(c.openBlock(),c.createElementBlock("a",{ref_key:"element",ref:s,href:o.value,class:c.normalizeClass(["router-link",g.value]),onClick:R},[c.renderSlot(w.$slots,"default",c.normalizeProps(c.guardReactiveProps({route:n.value,isMatch:c.unref(l),isExactMatch:c.unref(i),isExternal:c.unref(u)})))],10,jn))}});function zt(e,t){const r=ye();function n(){if(!e)return;if(!Je(r.route,e,t))throw new Ze(e,r.route.name)}return c.watch(r.route,n,{immediate:!0,deep:!0}),r.route}const Kt=Symbol();function Ge(){return c.inject(Kt,0)}function Hn(e,t){return c.defineComponent({name:"PropsWrapper",expose:[],setup(){const r=t(),n=c.getCurrentInstance();return()=>r instanceof Error?"":Tt(r)?n!=null&&n.suspense?c.h(qn(e,r)):c.h($n(e,r)):c.h(e,r)}})}function $n(e,t){return c.defineComponent({name:"AsyncPropsWrapper",expose:[],setup(){const r=c.ref();return(async()=>r.value=await t)(),()=>r.value instanceof Error?"":r.value?c.h(e,r.value):""}})}function qn(e,t){return c.defineComponent({name:"SuspenseAsyncPropsWrapper",expose:[],async setup(){const r=await t;return()=>c.h(e,r)}})}const Yt=c.defineComponent({__name:"routerView",props:{name:{default:"default"}},setup(e){const t=zt(),r=Er(),n=Ge(),{getProps:o}=Ft(),a=c.resolveComponent("RouterView",!0);c.provide(Kt,n+1);const s=c.computed(()=>{if(r.value)return r.value.component;const u=t.matches.at(n);if(!u)return null;const h=l(u),g=o(u.id,e.name,t);return h?g?Hn(h,()=>g):h:null});function l(u){return i(u)[e.name]}function i(u){return Ce(u)?u.components:Be(u)?{default:u.component}:typeof a=="string"?{}:{default:a}}return(u,h)=>s.value?c.renderSlot(u.$slots,"default",c.normalizeProps(c.mergeProps({key:0},{route:c.unref(t),component:s.value,rejection:c.unref(r)})),()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(s.value)))]):c.createCommentVNode("",!0)}});function Xt(){const e=c.inject(wt);if(!e)throw new te;return e}function Zt(e){return t=>{const r=Ge(),o=Xt().addComponentBeforeRouteHook({lifecycle:e,hook:t,depth:r-1});return c.onUnmounted(o),o}}function er(e){return t=>{const r=Ge(),o=Xt().addComponentAfterRouteHook({lifecycle:e,hook:t,depth:r-1});return c.onUnmounted(o),o}}const _n=Zt("onBeforeRouteLeave"),In=Zt("onBeforeRouteUpdate"),On=er("onAfterRouteLeave"),Tn=er("onAfterRouteUpdate");function Dn(e){return ue(e)&&typeof e.value=="string"}function tr(e){return Dn(e)?e:jt(e,{})}function Mn(e){const t=He(),r=$t(e.name),n=qt(e.path),o=_t(e.query),a=Ht(e.hash),s=e.meta??{},l=lr(e)?tr(e.host):tr(""),i=c.markRaw({id:t,meta:{},state:{},...e}),u={id:t,matched:i,matches:[i],name:r,host:l,path:n,query:o,hash:a,meta:s,depth:1,state:{}},h=rt(e)?nt(e.parent,u):u;return ne(h.path.params,h.query.params,h.host.params),h}A.DuplicateParamsError=Ye,A.MetaPropertyConflict=Xe,A.RouterLink=Qt,A.RouterNotInstalledError=te,A.RouterView=Yt,A.UseRouteInvalidError=Ze,A.asUrl=xe,A.createExternalRoute=Mn,A.createParam=ut,A.createRoute=ee,A.createRouter=En,A.createRouterPlugin=Pn,A.isRoute=Je,A.isUrl=N,A.onAfterRouteLeave=On,A.onAfterRouteUpdate=Tn,A.onBeforeRouteLeave=_n,A.onBeforeRouteUpdate=In,A.path=ke,A.query=Me,A.useLink=Gt,A.useRoute=zt,A.useRouter=ye,A.withDefault=Rr,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|