@jasonshimmy/custom-elements-runtime 2.5.2 → 2.5.6
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/README.md +115 -40
- package/dist/css/colors.d.ts +14 -0
- package/dist/custom-elements-runtime.cjs.js +6 -1
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.colors.cjs.js +2 -0
- package/dist/custom-elements-runtime.colors.cjs.js.map +1 -0
- package/dist/custom-elements-runtime.colors.es.js +279 -0
- package/dist/custom-elements-runtime.colors.es.js.map +1 -0
- package/dist/custom-elements-runtime.directive-enhancements.es.js +1 -1
- package/dist/custom-elements-runtime.es.js +258 -166
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.event-bus.cjs.js +1 -1
- package/dist/custom-elements-runtime.event-bus.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.event-bus.es.js +28 -25
- package/dist/custom-elements-runtime.event-bus.es.js.map +1 -1
- package/dist/custom-elements-runtime.router.cjs.js +20 -20
- package/dist/custom-elements-runtime.router.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.router.es.js +549 -531
- package/dist/custom-elements-runtime.router.es.js.map +1 -1
- package/dist/custom-elements-runtime.ssr.cjs.js +1 -1
- package/dist/custom-elements-runtime.ssr.es.js +12 -8
- package/dist/custom-elements-runtime.ssr.es.js.map +1 -1
- package/dist/custom-elements-runtime.store.cjs.js +1 -1
- package/dist/custom-elements-runtime.store.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.store.es.js +5 -5
- package/dist/custom-elements-runtime.store.es.js.map +1 -1
- package/dist/custom-elements-runtime.transitions.cjs.js +1 -1
- package/dist/custom-elements-runtime.transitions.es.js +1 -1
- package/dist/event-bus.d.ts +17 -4
- package/dist/index.d.ts +13 -5
- package/dist/keep-alive.d.ts +50 -0
- package/dist/{logger-BuUYv7C_.js → logger-BvkEbVM4.js} +15 -11
- package/dist/logger-BvkEbVM4.js.map +1 -0
- package/dist/logger-CSALKaYm.cjs +2 -0
- package/dist/logger-CSALKaYm.cjs.map +1 -0
- package/dist/namespace-helpers-4qeKVqQw.cjs +5 -0
- package/dist/namespace-helpers-4qeKVqQw.cjs.map +1 -0
- package/dist/namespace-helpers-DcD_6_K1.js +989 -0
- package/dist/namespace-helpers-DcD_6_K1.js.map +1 -0
- package/dist/router/active-proxy.d.ts +5 -0
- package/dist/router/component-loader.d.ts +11 -0
- package/dist/router/instance.d.ts +11 -0
- package/dist/router/matcher.d.ts +14 -0
- package/dist/router/path-utils.d.ts +48 -0
- package/dist/router/types.d.ts +134 -0
- package/dist/router.d.ts +6 -208
- package/dist/runtime/builtin-components.d.ts +78 -0
- package/dist/runtime/component/element-class.d.ts +4 -0
- package/dist/runtime/component/factory.d.ts +39 -0
- package/dist/runtime/component/registry.d.ts +16 -0
- package/dist/runtime/component.d.ts +3 -50
- package/dist/runtime/discovery-state.d.ts +30 -0
- package/dist/runtime/hooks.d.ts +115 -0
- package/dist/runtime/logger.d.ts +19 -1
- package/dist/runtime/monitoring/health-monitor.d.ts +22 -65
- package/dist/runtime/reactive.d.ts +39 -7
- package/dist/runtime/render.d.ts +20 -4
- package/dist/runtime/scheduler.d.ts +69 -2
- package/dist/runtime/template-compiler/impl.d.ts +14 -0
- package/dist/runtime/template-compiler/lru-cache.d.ts +20 -0
- package/dist/runtime/template-compiler/props-parser.d.ts +15 -0
- package/dist/runtime/template-compiler/vnode-utils.d.ts +5 -0
- package/dist/runtime/template-compiler.d.ts +5 -28
- package/dist/runtime/types.d.ts +10 -0
- package/dist/runtime/vdom-directives.d.ts +71 -0
- package/dist/runtime/vdom-helpers.d.ts +126 -0
- package/dist/runtime/vdom-patch.d.ts +67 -0
- package/dist/runtime/vdom.d.ts +16 -140
- package/dist/ssr.d.ts +2 -1
- package/dist/teleport.d.ts +68 -0
- package/dist/template-compiler-BO8UEEDA.js +3984 -0
- package/dist/template-compiler-BO8UEEDA.js.map +1 -0
- package/dist/template-compiler-C4L8vT-6.cjs +23 -0
- package/dist/template-compiler-C4L8vT-6.cjs.map +1 -0
- package/dist/transitions-DPZiuXb9.cjs +330 -0
- package/dist/transitions-DPZiuXb9.cjs.map +1 -0
- package/dist/{transitions-Bx0Nc9zR.js → transitions-Di5wW9yc.js} +1072 -632
- package/dist/transitions-Di5wW9yc.js.map +1 -0
- package/dist/transitions.d.ts +1 -1
- package/package.json +18 -11
- package/dist/logger-BuUYv7C_.js.map +0 -1
- package/dist/logger-DiXdWaF-.cjs +0 -2
- package/dist/logger-DiXdWaF-.cjs.map +0 -1
- package/dist/namespace-helpers-BCVTzhAO.cjs +0 -5
- package/dist/namespace-helpers-BCVTzhAO.cjs.map +0 -1
- package/dist/namespace-helpers-CF28TyaG.js +0 -786
- package/dist/namespace-helpers-CF28TyaG.js.map +0 -1
- package/dist/template-compiler-CXHEnaBh.cjs +0 -17
- package/dist/template-compiler-CXHEnaBh.cjs.map +0 -1
- package/dist/template-compiler-DD_VZrte.js +0 -3729
- package/dist/template-compiler-DD_VZrte.js.map +0 -1
- package/dist/transitions-Bx0Nc9zR.js.map +0 -1
- package/dist/transitions-DfcqL-X4.cjs +0 -302
- package/dist/transitions-DfcqL-X4.cjs.map +0 -1
|
@@ -1,222 +1,368 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { f as
|
|
1
|
+
import { a as y, d as I } from "./logger-BvkEbVM4.js";
|
|
2
|
+
import { f as rt, r as tt, c as T } from "./namespace-helpers-DcD_6_K1.js";
|
|
3
|
+
import { c as st, h as F, k as ct, l as it, b as bt, n as wt } from "./template-compiler-BO8UEEDA.js";
|
|
3
4
|
import { createStore as lt } from "./custom-elements-runtime.store.es.js";
|
|
4
|
-
import {
|
|
5
|
-
import { match as wt } from "./custom-elements-runtime.directives.es.js";
|
|
5
|
+
import { match as St } from "./custom-elements-runtime.directives.es.js";
|
|
6
6
|
const ut = {
|
|
7
7
|
enabled: !0,
|
|
8
8
|
offset: 0,
|
|
9
9
|
timeoutMs: 2e3
|
|
10
|
-
}, at = (t) => t ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(t)) : {},
|
|
10
|
+
}, at = (t) => t ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(t)) : {}, Rt = (t) => {
|
|
11
11
|
if (!t || Object.keys(t).length === 0) return "";
|
|
12
12
|
try {
|
|
13
13
|
return "?" + new URLSearchParams(t).toString();
|
|
14
14
|
} catch {
|
|
15
15
|
return "";
|
|
16
16
|
}
|
|
17
|
-
}, ft = (t) => t ? /^\s*javascript\s*:/i.test(t) : !1,
|
|
17
|
+
}, ft = (t) => t ? /^\s*javascript\s*:/i.test(t) : !1, Z = (t) => /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t) || t.startsWith("//"), $t = (t) => {
|
|
18
18
|
try {
|
|
19
19
|
return decodeURIComponent(t);
|
|
20
20
|
} catch {
|
|
21
21
|
return t;
|
|
22
22
|
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const r = x(t);
|
|
26
|
-
return r === "/" ? "" : r;
|
|
27
|
-
}, ht = /* @__PURE__ */ new WeakMap();
|
|
28
|
-
function Et(t) {
|
|
29
|
-
return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
30
|
-
}
|
|
31
|
-
function x(t) {
|
|
23
|
+
};
|
|
24
|
+
function C(t) {
|
|
32
25
|
if (!t) return "/";
|
|
33
26
|
let r = t.replace(/\/+/g, "/");
|
|
34
27
|
return r.startsWith("/") || (r = "/" + r), r.length > 1 && r.endsWith("/") && (r = r.slice(0, -1)), r;
|
|
35
28
|
}
|
|
29
|
+
const Et = (t) => {
|
|
30
|
+
if (!t) return "";
|
|
31
|
+
const r = C(t);
|
|
32
|
+
return r === "/" ? "" : r;
|
|
33
|
+
}, ht = /* @__PURE__ */ new WeakMap();
|
|
36
34
|
function Ct(t) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
36
|
+
}
|
|
37
|
+
function At(t) {
|
|
38
|
+
const r = t.path || "/", g = C(r), a = g === "/" ? [] : g.split("/").filter(Boolean), i = [], o = [];
|
|
39
|
+
for (let l = 0; l < a.length; l++) {
|
|
40
|
+
const u = a[l];
|
|
41
|
+
if (u === "*") {
|
|
42
|
+
if (l !== a.length - 1)
|
|
43
|
+
return y(
|
|
43
44
|
`Route '${t.path}' contains a '*' splat in a non-terminal position; splats must be the last segment. This route will be ignored.`
|
|
44
45
|
), { invalid: !0 };
|
|
45
|
-
const
|
|
46
|
-
|
|
46
|
+
const A = `splat${i.length}`;
|
|
47
|
+
i.push(A), o.push("__SPLAT__");
|
|
47
48
|
continue;
|
|
48
49
|
}
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
53
|
-
return
|
|
54
|
-
`Route '${t.path}' contains a splat param ':${
|
|
50
|
+
const d = u.match(/^:([A-Za-z0-9_-]+)(\*)?$/);
|
|
51
|
+
if (d) {
|
|
52
|
+
const A = d[1], k = !!d[2];
|
|
53
|
+
if (k && l !== a.length - 1)
|
|
54
|
+
return y(
|
|
55
|
+
`Route '${t.path}' contains a splat param ':${A}*' in a non-terminal position; splats must be the last segment. This route will be ignored.`
|
|
55
56
|
), { invalid: !0 };
|
|
56
|
-
|
|
57
|
+
i.push(A), o.push(k ? "__SPLAT__" : "([^/]+)");
|
|
57
58
|
continue;
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
+
o.push(Ct(u));
|
|
60
61
|
}
|
|
61
|
-
let
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
else if (
|
|
65
|
-
const
|
|
66
|
-
|
|
62
|
+
let b;
|
|
63
|
+
if (o.length === 0)
|
|
64
|
+
b = "^/$";
|
|
65
|
+
else if (o[o.length - 1] === "__SPLAT__") {
|
|
66
|
+
const u = o.slice(0, -1).join("/");
|
|
67
|
+
u ? b = `^/${u}(?:/(.*))?(?:/)?$` : b = "^(?:/(.*))?(?:/)?$";
|
|
67
68
|
} else
|
|
68
|
-
|
|
69
|
+
b = `^/${o.join("/")}(?:/)?$`;
|
|
69
70
|
try {
|
|
70
|
-
return { regex: new RegExp(
|
|
71
|
-
} catch (
|
|
72
|
-
return
|
|
71
|
+
return { regex: new RegExp(b), paramNames: i };
|
|
72
|
+
} catch (l) {
|
|
73
|
+
return y(`Failed to compile route regex for '${t.path}': ${String(l)}`), { invalid: !0 };
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
for (const
|
|
78
|
-
let
|
|
79
|
-
if (
|
|
80
|
-
const { regex:
|
|
81
|
-
if (
|
|
82
|
-
const
|
|
83
|
-
for (let
|
|
84
|
-
const
|
|
85
|
-
|
|
76
|
+
const Q = (t, r) => {
|
|
77
|
+
const g = C(r);
|
|
78
|
+
for (const a of t) {
|
|
79
|
+
let i = ht.get(a);
|
|
80
|
+
if (i || (i = At(a), ht.set(a, i)), i.invalid) continue;
|
|
81
|
+
const { regex: o, paramNames: b } = i, l = o.exec(g);
|
|
82
|
+
if (l) {
|
|
83
|
+
const u = {};
|
|
84
|
+
for (let d = 0; d < b.length; d++) {
|
|
85
|
+
const A = l[d + 1] || "";
|
|
86
|
+
u[b[d]] = A ? $t(A) : "";
|
|
86
87
|
}
|
|
87
|
-
return { route:
|
|
88
|
+
return { route: a, params: u };
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
return { route: null, params: {} };
|
|
91
92
|
};
|
|
92
|
-
function
|
|
93
|
-
for (const
|
|
94
|
-
if (
|
|
93
|
+
function et(t, r) {
|
|
94
|
+
for (const g of t)
|
|
95
|
+
if (Q([g], r).route !== null) return g;
|
|
95
96
|
return null;
|
|
96
97
|
}
|
|
98
|
+
function Lt(t, r) {
|
|
99
|
+
return Q(t, r);
|
|
100
|
+
}
|
|
97
101
|
const pt = 50;
|
|
98
|
-
let
|
|
102
|
+
let J = {}, U = {};
|
|
99
103
|
function xt() {
|
|
100
|
-
|
|
104
|
+
J = {}, U = {};
|
|
101
105
|
}
|
|
102
|
-
function
|
|
103
|
-
const t = Object.entries(
|
|
106
|
+
function kt() {
|
|
107
|
+
const t = Object.entries(J);
|
|
104
108
|
if (t.length <= pt) return;
|
|
105
|
-
const
|
|
106
|
-
([,
|
|
109
|
+
const g = t.sort(
|
|
110
|
+
([, a], [, i]) => a.lastAccessed - i.lastAccessed
|
|
107
111
|
).slice(
|
|
108
112
|
0,
|
|
109
113
|
t.length - pt
|
|
110
114
|
);
|
|
111
|
-
for (const [
|
|
112
|
-
delete
|
|
115
|
+
for (const [a] of g)
|
|
116
|
+
delete J[a];
|
|
113
117
|
}
|
|
114
|
-
async function
|
|
118
|
+
async function Pt(t) {
|
|
115
119
|
if (t.component) return t.component;
|
|
116
120
|
if (t.load) {
|
|
117
|
-
const r =
|
|
121
|
+
const r = J[t.path];
|
|
118
122
|
if (r)
|
|
119
123
|
return r.lastAccessed = Date.now(), r.component;
|
|
120
|
-
if (
|
|
121
|
-
return
|
|
122
|
-
const
|
|
124
|
+
if (U[t.path] !== void 0)
|
|
125
|
+
return U[t.path];
|
|
126
|
+
const g = typeof window > "u";
|
|
123
127
|
try {
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
return
|
|
128
|
-
component:
|
|
128
|
+
const a = t.load().then((i) => {
|
|
129
|
+
kt();
|
|
130
|
+
const o = i.default;
|
|
131
|
+
return J[t.path] = {
|
|
132
|
+
component: o,
|
|
129
133
|
lastAccessed: Date.now()
|
|
130
|
-
}, delete
|
|
131
|
-
}).catch((
|
|
132
|
-
delete
|
|
133
|
-
const
|
|
134
|
-
throw
|
|
135
|
-
`SSR component load failed for route: ${t.path}. ${
|
|
134
|
+
}, delete U[t.path], o;
|
|
135
|
+
}).catch((i) => {
|
|
136
|
+
delete U[t.path];
|
|
137
|
+
const o = i instanceof Error ? i.message : String(i);
|
|
138
|
+
throw g && I(
|
|
139
|
+
`SSR component load failed for route: ${t.path}. ${o}`
|
|
136
140
|
), new Error(
|
|
137
|
-
`Failed to load component for route: ${t.path}. ${
|
|
141
|
+
`Failed to load component for route: ${t.path}. ${o}`
|
|
138
142
|
);
|
|
139
143
|
});
|
|
140
|
-
return
|
|
141
|
-
} catch (
|
|
142
|
-
const
|
|
144
|
+
return U[t.path] = a, await a;
|
|
145
|
+
} catch (a) {
|
|
146
|
+
const i = a instanceof Error ? a.message : String(a);
|
|
143
147
|
throw new Error(
|
|
144
|
-
`Failed to load component for route: ${t.path}. ${
|
|
148
|
+
`Failed to load component for route: ${t.path}. ${i}`,
|
|
149
|
+
{ cause: a }
|
|
145
150
|
);
|
|
146
151
|
}
|
|
147
152
|
}
|
|
148
153
|
throw new Error(`No component or loader defined for route: ${t.path}`);
|
|
149
154
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
155
|
+
let v = null;
|
|
156
|
+
function _t(t) {
|
|
157
|
+
v = t;
|
|
158
|
+
}
|
|
159
|
+
function dt() {
|
|
160
|
+
return v;
|
|
161
|
+
}
|
|
162
|
+
const W = /* @__PURE__ */ new Set();
|
|
163
|
+
let D = null;
|
|
164
|
+
function gt() {
|
|
165
|
+
if (D) {
|
|
166
|
+
try {
|
|
167
|
+
D();
|
|
168
|
+
} catch {
|
|
169
|
+
}
|
|
170
|
+
D = null;
|
|
171
|
+
}
|
|
172
|
+
if (v)
|
|
173
|
+
try {
|
|
174
|
+
let t = !1;
|
|
175
|
+
D = v.subscribe((r) => {
|
|
176
|
+
t = !0;
|
|
177
|
+
for (const g of W)
|
|
178
|
+
try {
|
|
179
|
+
g(r);
|
|
180
|
+
} catch {
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
try {
|
|
184
|
+
E.base = v.base;
|
|
185
|
+
} catch {
|
|
186
|
+
}
|
|
187
|
+
if (t) {
|
|
188
|
+
const r = v.getCurrent();
|
|
189
|
+
for (const g of W)
|
|
190
|
+
try {
|
|
191
|
+
g(r);
|
|
192
|
+
} catch {
|
|
193
|
+
}
|
|
194
|
+
} else {
|
|
195
|
+
const r = v.getCurrent();
|
|
196
|
+
for (const g of W)
|
|
197
|
+
try {
|
|
198
|
+
g(r);
|
|
199
|
+
} catch {
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
try {
|
|
203
|
+
typeof window < "u" && rt();
|
|
204
|
+
} catch {
|
|
205
|
+
}
|
|
206
|
+
} catch {
|
|
207
|
+
D = null;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function qt() {
|
|
211
|
+
gt();
|
|
212
|
+
}
|
|
213
|
+
const E = {
|
|
214
|
+
store: {
|
|
215
|
+
subscribe(t) {
|
|
216
|
+
if (v) return v.store.subscribe(t);
|
|
217
|
+
try {
|
|
218
|
+
t({ path: "/", params: {}, query: {} });
|
|
219
|
+
} catch {
|
|
220
|
+
}
|
|
221
|
+
return () => {
|
|
222
|
+
};
|
|
223
|
+
},
|
|
224
|
+
getState() {
|
|
225
|
+
return v ? v.getCurrent() : { path: "/", params: {}, query: {} };
|
|
226
|
+
},
|
|
227
|
+
setState(t) {
|
|
228
|
+
if (v)
|
|
229
|
+
try {
|
|
230
|
+
v.store.setState(
|
|
231
|
+
t
|
|
232
|
+
);
|
|
233
|
+
} catch {
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
subscribe(t) {
|
|
238
|
+
if (typeof t != "function")
|
|
239
|
+
return y("activeRouterProxy.subscribe: listener must be a function"), () => {
|
|
240
|
+
};
|
|
241
|
+
if (W.add(t), v)
|
|
242
|
+
if (!D)
|
|
243
|
+
gt();
|
|
244
|
+
else
|
|
245
|
+
try {
|
|
246
|
+
const r = v.getCurrent();
|
|
247
|
+
r && t(r);
|
|
248
|
+
} catch (r) {
|
|
249
|
+
y("activeRouterProxy subscription failed", r);
|
|
250
|
+
}
|
|
251
|
+
else
|
|
252
|
+
try {
|
|
253
|
+
t({ path: "/", params: {}, query: {} });
|
|
254
|
+
} catch (r) {
|
|
255
|
+
y("activeRouterProxy fallback state delivery failed", r);
|
|
256
|
+
}
|
|
257
|
+
return () => {
|
|
258
|
+
try {
|
|
259
|
+
if (W.delete(t), W.size === 0 && D) {
|
|
260
|
+
try {
|
|
261
|
+
D();
|
|
262
|
+
} catch (r) {
|
|
263
|
+
y("activeRouterProxy inner unsubscribe failed", r);
|
|
264
|
+
}
|
|
265
|
+
D = null;
|
|
266
|
+
}
|
|
267
|
+
} catch (r) {
|
|
268
|
+
y("activeRouterProxy unsubscribe failed", r);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
getCurrent() {
|
|
273
|
+
return v ? v.getCurrent() : { path: "/", params: {}, query: {} };
|
|
274
|
+
},
|
|
275
|
+
async push(t) {
|
|
276
|
+
return v ? v.push(t) : Promise.resolve();
|
|
277
|
+
},
|
|
278
|
+
async replace(t) {
|
|
279
|
+
return v ? v.replace(t) : Promise.resolve();
|
|
280
|
+
},
|
|
281
|
+
back() {
|
|
282
|
+
if (v)
|
|
283
|
+
return v.back();
|
|
284
|
+
},
|
|
285
|
+
matchRoute(t) {
|
|
286
|
+
return v ? v.matchRoute(t) : { route: null, params: {} };
|
|
287
|
+
},
|
|
288
|
+
resolveRouteComponent(t) {
|
|
289
|
+
return v ? v.resolveRouteComponent(t) : Promise.reject(new Error("No active router"));
|
|
290
|
+
},
|
|
291
|
+
base: "",
|
|
292
|
+
scrollToFragment(t) {
|
|
293
|
+
return v ? v.scrollToFragment(t) : Promise.resolve(!1);
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
function Tt(t) {
|
|
297
|
+
const { routes: r, base: g = "", initialUrl: a, scrollToFragment: i = !0 } = t, o = Et(g), b = typeof i == "boolean" ? { ...ut, enabled: i } : { ...ut, ...i };
|
|
298
|
+
let l, u, d, A, k, L, j;
|
|
299
|
+
const _ = /* @__PURE__ */ new Set(), B = 10;
|
|
154
300
|
let P = 0;
|
|
155
|
-
const
|
|
156
|
-
const e =
|
|
301
|
+
const X = async (s, c) => {
|
|
302
|
+
const e = et(r, s.path);
|
|
157
303
|
if (!e || !e.beforeEnter) return !0;
|
|
158
304
|
try {
|
|
159
305
|
const n = await e.beforeEnter(s, c);
|
|
160
306
|
if (typeof n == "string") {
|
|
161
|
-
const
|
|
162
|
-
return
|
|
307
|
+
const p = `${s.path}->${n}`;
|
|
308
|
+
return _.has(p) || P >= B ? (I(`Redirect loop detected: ${p}`), !1) : n;
|
|
163
309
|
}
|
|
164
310
|
return n !== !1;
|
|
165
311
|
} catch (n) {
|
|
166
312
|
I("beforeEnter error", n);
|
|
167
313
|
try {
|
|
168
|
-
|
|
314
|
+
d.setState(c);
|
|
169
315
|
} catch {
|
|
170
316
|
}
|
|
171
317
|
throw n;
|
|
172
318
|
}
|
|
173
|
-
},
|
|
174
|
-
const e =
|
|
319
|
+
}, G = async (s, c) => {
|
|
320
|
+
const e = et(r, s.path);
|
|
175
321
|
if (!e || !e.onEnter) return !0;
|
|
176
322
|
try {
|
|
177
323
|
const n = await e.onEnter(s, c);
|
|
178
324
|
if (typeof n == "string") {
|
|
179
|
-
const
|
|
180
|
-
return
|
|
325
|
+
const p = `${s.path}->${n}`;
|
|
326
|
+
return _.has(p) || P >= B ? (I(`Redirect loop detected: ${p}`), !1) : n;
|
|
181
327
|
}
|
|
182
328
|
return n !== !1;
|
|
183
329
|
} catch (n) {
|
|
184
330
|
I("onEnter error", n);
|
|
185
331
|
try {
|
|
186
|
-
|
|
332
|
+
d.setState(c);
|
|
187
333
|
} catch {
|
|
188
334
|
}
|
|
189
335
|
throw n;
|
|
190
336
|
}
|
|
191
|
-
},
|
|
192
|
-
const e =
|
|
337
|
+
}, nt = (s, c) => {
|
|
338
|
+
const e = et(r, s.path);
|
|
193
339
|
if (!(!e || !e.afterEnter))
|
|
194
340
|
try {
|
|
195
341
|
e.afterEnter(s, c);
|
|
196
342
|
} catch (n) {
|
|
197
343
|
I("afterEnter error", n);
|
|
198
344
|
}
|
|
199
|
-
},
|
|
200
|
-
if (
|
|
201
|
-
return
|
|
202
|
-
const c =
|
|
203
|
-
if (
|
|
204
|
-
const e = Math.floor(
|
|
205
|
-
for (let
|
|
206
|
-
|
|
345
|
+
}, z = /* @__PURE__ */ new Map(), M = 100, O = (s) => {
|
|
346
|
+
if (z.has(s))
|
|
347
|
+
return z.get(s);
|
|
348
|
+
const c = Q(r, s);
|
|
349
|
+
if (z.size >= M) {
|
|
350
|
+
const e = Math.floor(M * 0.25), n = Array.from(z.keys());
|
|
351
|
+
for (let p = 0; p < e && p < n.length; p++)
|
|
352
|
+
z.delete(n[p]);
|
|
207
353
|
}
|
|
208
|
-
return
|
|
209
|
-
},
|
|
354
|
+
return z.set(s, c), c;
|
|
355
|
+
}, Y = () => {
|
|
210
356
|
};
|
|
211
|
-
async function
|
|
357
|
+
async function K(s, c = 0) {
|
|
212
358
|
try {
|
|
213
359
|
const e = document.getElementById(s);
|
|
214
360
|
if (!e)
|
|
215
361
|
return !1;
|
|
216
362
|
if (c > 0)
|
|
217
363
|
try {
|
|
218
|
-
const n = e.getBoundingClientRect(),
|
|
219
|
-
typeof window.scrollTo == "function" && window.scrollTo({ top:
|
|
364
|
+
const n = e.getBoundingClientRect(), p = Math.max(0, window.scrollY + n.top - c);
|
|
365
|
+
typeof window.scrollTo == "function" && window.scrollTo({ top: p, behavior: "auto" });
|
|
220
366
|
} catch {
|
|
221
367
|
try {
|
|
222
368
|
e.scrollIntoView();
|
|
@@ -243,95 +389,95 @@ function Pt(t) {
|
|
|
243
389
|
return !1;
|
|
244
390
|
}
|
|
245
391
|
}
|
|
246
|
-
function
|
|
392
|
+
function h(s, c = 0, e = 2e3) {
|
|
247
393
|
return new Promise((n) => {
|
|
248
|
-
let
|
|
249
|
-
const w = Date.now(), S = (
|
|
250
|
-
|
|
251
|
-
},
|
|
252
|
-
if (!
|
|
394
|
+
let p = !1, m = null;
|
|
395
|
+
const w = Date.now(), S = (x) => {
|
|
396
|
+
p || (p = !0, m && clearTimeout(m), n(x));
|
|
397
|
+
}, $ = async () => {
|
|
398
|
+
if (!p)
|
|
253
399
|
try {
|
|
254
|
-
if (await
|
|
400
|
+
if (await K(s, c))
|
|
255
401
|
return S(!0);
|
|
256
|
-
const
|
|
257
|
-
if (
|
|
402
|
+
const x = async () => {
|
|
403
|
+
if (p) return;
|
|
258
404
|
if (Date.now() - w >= e)
|
|
259
405
|
return S(!1);
|
|
260
406
|
try {
|
|
261
|
-
if (await
|
|
407
|
+
if (await K(s, c))
|
|
262
408
|
return S(!0);
|
|
263
|
-
requestAnimationFrame(
|
|
264
|
-
} catch (
|
|
265
|
-
|
|
409
|
+
requestAnimationFrame(x);
|
|
410
|
+
} catch (vt) {
|
|
411
|
+
y("Scroll retry attempt failed:", vt), requestAnimationFrame(x);
|
|
266
412
|
}
|
|
267
413
|
};
|
|
268
|
-
requestAnimationFrame(
|
|
269
|
-
} catch (
|
|
270
|
-
|
|
414
|
+
requestAnimationFrame(x);
|
|
415
|
+
} catch (x) {
|
|
416
|
+
y("Initial scroll attempt failed:", x), S(!1);
|
|
271
417
|
}
|
|
272
418
|
};
|
|
273
|
-
|
|
419
|
+
m = setTimeout(() => {
|
|
274
420
|
S(!1);
|
|
275
|
-
}, e),
|
|
276
|
-
|
|
421
|
+
}, e), $().catch((x) => {
|
|
422
|
+
y("Scroll attempt failed:", x), S(!1);
|
|
277
423
|
});
|
|
278
424
|
});
|
|
279
425
|
}
|
|
280
|
-
let
|
|
281
|
-
const
|
|
282
|
-
if (
|
|
283
|
-
|
|
426
|
+
let R = !1;
|
|
427
|
+
const f = async (s, c = !1) => {
|
|
428
|
+
if (R) {
|
|
429
|
+
y(`Navigation to ${s} blocked - navigation already in progress`);
|
|
284
430
|
return;
|
|
285
431
|
}
|
|
286
|
-
|
|
432
|
+
R = !0, P = 0, _.clear();
|
|
287
433
|
try {
|
|
288
|
-
await
|
|
434
|
+
await N(s, c);
|
|
289
435
|
} finally {
|
|
290
|
-
|
|
436
|
+
R = !1, P = 0, _.clear();
|
|
291
437
|
}
|
|
292
|
-
},
|
|
293
|
-
const c = s.indexOf("#"), e = c >= 0 ? s.slice(c + 1) : "", n = c >= 0 ? s.slice(0, c) : s,
|
|
438
|
+
}, q = (s) => {
|
|
439
|
+
const c = s.indexOf("#"), e = c >= 0 ? s.slice(c + 1) : "", n = c >= 0 ? s.slice(0, c) : s, p = n.indexOf("?"), m = p >= 0 ? n.slice(0, p) : n, w = p >= 0 ? at(n.slice(p)) : {}, S = m.startsWith(o) ? m.slice(o.length) : m;
|
|
294
440
|
return {
|
|
295
|
-
path:
|
|
441
|
+
path: C(S || "/"),
|
|
296
442
|
query: w,
|
|
297
443
|
fragment: e
|
|
298
444
|
};
|
|
299
|
-
},
|
|
445
|
+
}, N = async (s, c = !1) => {
|
|
300
446
|
try {
|
|
301
|
-
const e =
|
|
447
|
+
const e = q(s), n = O(e.path);
|
|
302
448
|
if (!n.route) throw new Error(`No route found for ${e.path}`);
|
|
303
|
-
const
|
|
449
|
+
const p = d.getState(), m = {
|
|
304
450
|
path: e.path,
|
|
305
451
|
params: n.params,
|
|
306
452
|
query: e.query,
|
|
307
453
|
fragment: e.fragment
|
|
308
|
-
}, w = await
|
|
454
|
+
}, w = await X(m, p);
|
|
309
455
|
if (w === !1) return;
|
|
310
456
|
if (typeof w == "string") {
|
|
311
457
|
P++;
|
|
312
|
-
const
|
|
313
|
-
|
|
458
|
+
const $ = `${m.path}->${w}`;
|
|
459
|
+
_.add($), await N(w, !0);
|
|
314
460
|
return;
|
|
315
461
|
}
|
|
316
|
-
const S = await
|
|
462
|
+
const S = await G(m, p);
|
|
317
463
|
if (S === !1) return;
|
|
318
464
|
if (typeof S == "string") {
|
|
319
465
|
P++;
|
|
320
|
-
const
|
|
321
|
-
|
|
466
|
+
const $ = `${m.path}->${S}`;
|
|
467
|
+
_.add($), await N(S, !0);
|
|
322
468
|
return;
|
|
323
469
|
}
|
|
324
470
|
if (typeof window < "u" && typeof document < "u") {
|
|
325
|
-
const
|
|
326
|
-
c ? window.history.replaceState({}, "",
|
|
471
|
+
const $ = Rt(e.query), x = o + e.path + ($ || "") + (e.fragment ? "#" + e.fragment : "");
|
|
472
|
+
c ? window.history.replaceState({}, "", x) : window.history.pushState({}, "", x);
|
|
327
473
|
}
|
|
328
|
-
if (
|
|
474
|
+
if (d.setState(m), nt(m, p), typeof window < "u" && typeof document < "u")
|
|
329
475
|
try {
|
|
330
|
-
const
|
|
331
|
-
|
|
332
|
-
String(
|
|
333
|
-
|
|
334
|
-
|
|
476
|
+
const $ = m.fragment;
|
|
477
|
+
b.enabled && $ && h(
|
|
478
|
+
String($),
|
|
479
|
+
b.offset,
|
|
480
|
+
b.timeoutMs
|
|
335
481
|
).catch(() => {
|
|
336
482
|
});
|
|
337
483
|
} catch {
|
|
@@ -340,15 +486,15 @@ function Pt(t) {
|
|
|
340
486
|
if (I("Navigation error:", e), e instanceof Error && (e.stack?.includes("runBeforeEnter") || e.stack?.includes("runOnEnter")))
|
|
341
487
|
throw e;
|
|
342
488
|
try {
|
|
343
|
-
const n =
|
|
344
|
-
if (!
|
|
345
|
-
let
|
|
346
|
-
if (
|
|
489
|
+
const n = d.getState();
|
|
490
|
+
if (!Q(r, n.path).route) {
|
|
491
|
+
let m = r.find((w) => w.path === "/");
|
|
492
|
+
if (m || (m = r.find(
|
|
347
493
|
(w) => !w.path.includes(":") && !w.path.includes("*")
|
|
348
|
-
)), !
|
|
349
|
-
const w =
|
|
350
|
-
|
|
351
|
-
path:
|
|
494
|
+
)), !m && r.length > 0 && (m = r[0]), m) {
|
|
495
|
+
const w = Q(r, m.path);
|
|
496
|
+
d.setState({
|
|
497
|
+
path: m.path,
|
|
352
498
|
params: w.params,
|
|
353
499
|
query: {}
|
|
354
500
|
});
|
|
@@ -356,7 +502,7 @@ function Pt(t) {
|
|
|
356
502
|
I("No fallback route available for error recovery");
|
|
357
503
|
}
|
|
358
504
|
} catch (n) {
|
|
359
|
-
|
|
505
|
+
y(
|
|
360
506
|
"State recovery failed during navigation error:",
|
|
361
507
|
n
|
|
362
508
|
);
|
|
@@ -370,274 +516,139 @@ function Pt(t) {
|
|
|
370
516
|
for (const e of s) {
|
|
371
517
|
if (!e.path)
|
|
372
518
|
return I("Router configuration error: Route missing path", e), !1;
|
|
373
|
-
c.has(e.path) &&
|
|
519
|
+
c.has(e.path) && y(`Duplicate route path detected: ${e.path}`), c.add(e.path), !e.component && !e.load && y(`Route '${e.path}' has no component or load function`);
|
|
374
520
|
}
|
|
375
521
|
return !0;
|
|
376
|
-
})(r), typeof window > "u" || typeof
|
|
522
|
+
})(r), typeof window > "u" || typeof a < "u") {
|
|
377
523
|
for (const s of r)
|
|
378
524
|
O(s.path);
|
|
379
|
-
|
|
525
|
+
y(`Pre-compiled ${r.length} routes for SSR`);
|
|
380
526
|
}
|
|
381
|
-
if (typeof window < "u" && typeof document < "u" && typeof
|
|
382
|
-
|
|
527
|
+
if (typeof window < "u" && typeof document < "u" && typeof a > "u") {
|
|
528
|
+
l = () => {
|
|
383
529
|
try {
|
|
384
|
-
const e = new URL(window.location.href), n = e.pathname,
|
|
385
|
-
return { path:
|
|
530
|
+
const e = new URL(window.location.href), n = e.pathname, p = n.startsWith(o) ? n.slice(o.length) : n, m = C(p || "/"), w = at(e.search), S = e.hash && e.hash.length ? e.hash.slice(1) : "";
|
|
531
|
+
return { path: m, query: w, fragment: S };
|
|
386
532
|
} catch (e) {
|
|
387
|
-
return
|
|
533
|
+
return y("Invalid URL detected, falling back to safe defaults", e), { path: "/", query: {}, fragment: "" };
|
|
388
534
|
}
|
|
389
|
-
},
|
|
390
|
-
const s = O(
|
|
391
|
-
|
|
392
|
-
path:
|
|
535
|
+
}, u = l();
|
|
536
|
+
const s = O(u.path);
|
|
537
|
+
d = lt({
|
|
538
|
+
path: u.path,
|
|
393
539
|
params: s.params,
|
|
394
|
-
query:
|
|
395
|
-
fragment:
|
|
396
|
-
}),
|
|
397
|
-
const n =
|
|
398
|
-
await
|
|
540
|
+
query: u.query,
|
|
541
|
+
fragment: u.fragment
|
|
542
|
+
}), A = async (e = !1) => {
|
|
543
|
+
const n = l();
|
|
544
|
+
await f(n.path, e);
|
|
399
545
|
};
|
|
400
|
-
const c = () =>
|
|
401
|
-
window.addEventListener("popstate", c),
|
|
546
|
+
const c = () => A(!0);
|
|
547
|
+
window.addEventListener("popstate", c), k = (e) => f(e, !1), L = (e) => f(e, !0), j = () => window.history.back();
|
|
402
548
|
} else {
|
|
403
|
-
|
|
549
|
+
l = () => {
|
|
404
550
|
try {
|
|
405
|
-
const e = new URL(
|
|
406
|
-
return { path:
|
|
551
|
+
const e = new URL(a || "/", "http://localhost"), n = e.pathname, p = n.startsWith(o) ? n.slice(o.length) : n, m = C(p || "/"), w = at(e.search), S = e.hash && e.hash.length ? e.hash.slice(1) : "";
|
|
552
|
+
return { path: m, query: w, fragment: S };
|
|
407
553
|
} catch (e) {
|
|
408
|
-
return
|
|
554
|
+
return y(
|
|
409
555
|
"Invalid SSR URL detected, falling back to safe defaults",
|
|
410
556
|
e
|
|
411
557
|
), { path: "/", query: {}, fragment: "" };
|
|
412
558
|
}
|
|
413
|
-
},
|
|
414
|
-
const s = O(
|
|
415
|
-
|
|
416
|
-
path:
|
|
559
|
+
}, u = l();
|
|
560
|
+
const s = O(u.path);
|
|
561
|
+
d = lt({
|
|
562
|
+
path: u.path,
|
|
417
563
|
params: s.params,
|
|
418
|
-
query:
|
|
419
|
-
fragment:
|
|
420
|
-
}),
|
|
421
|
-
const e =
|
|
564
|
+
query: u.query,
|
|
565
|
+
fragment: u.fragment
|
|
566
|
+
}), A = async () => {
|
|
567
|
+
const e = l();
|
|
422
568
|
await c(e.path);
|
|
423
569
|
};
|
|
424
570
|
const c = async (e) => {
|
|
425
|
-
if (P++, P >
|
|
571
|
+
if (P++, P > B) {
|
|
426
572
|
I(`SSR redirect depth exceeded for path: ${e}`);
|
|
427
573
|
return;
|
|
428
574
|
}
|
|
429
575
|
try {
|
|
430
|
-
const n =
|
|
431
|
-
if (!
|
|
432
|
-
const
|
|
576
|
+
const n = q(e), p = O(n.path);
|
|
577
|
+
if (!p.route) throw new Error(`No route found for ${n.path}`);
|
|
578
|
+
const m = d.getState(), w = {
|
|
433
579
|
path: n.path,
|
|
434
|
-
params:
|
|
580
|
+
params: p.params,
|
|
435
581
|
query: n.query,
|
|
436
582
|
fragment: n.fragment
|
|
437
|
-
}, S =
|
|
583
|
+
}, S = et(r, w.path);
|
|
438
584
|
if (S?.beforeEnter) {
|
|
439
|
-
const
|
|
440
|
-
if (typeof
|
|
441
|
-
const
|
|
442
|
-
|
|
585
|
+
const $ = await S.beforeEnter(w, m);
|
|
586
|
+
if (typeof $ == "string") {
|
|
587
|
+
const x = `${w.path}->${$}`;
|
|
588
|
+
_.add(x), await c($);
|
|
443
589
|
return;
|
|
444
590
|
}
|
|
445
|
-
if (
|
|
591
|
+
if ($ === !1) return;
|
|
446
592
|
}
|
|
447
593
|
if (S?.onEnter) {
|
|
448
|
-
const
|
|
449
|
-
if (typeof
|
|
450
|
-
const
|
|
451
|
-
|
|
594
|
+
const $ = await S.onEnter(w, m);
|
|
595
|
+
if (typeof $ == "string") {
|
|
596
|
+
const x = `${w.path}->${$}`;
|
|
597
|
+
_.add(x), await c($);
|
|
452
598
|
return;
|
|
453
599
|
}
|
|
454
|
-
if (
|
|
600
|
+
if ($ === !1) return;
|
|
455
601
|
}
|
|
456
|
-
|
|
602
|
+
d.setState(w), S?.afterEnter && S.afterEnter(w, m);
|
|
457
603
|
} catch (n) {
|
|
458
604
|
throw I("SSR navigation error:", n), n;
|
|
459
605
|
}
|
|
460
606
|
};
|
|
461
|
-
|
|
607
|
+
k = async (e) => (P = 0, _.clear(), c(e)), L = async (e) => (P = 0, _.clear(), c(e)), j = () => {
|
|
462
608
|
};
|
|
463
609
|
}
|
|
464
610
|
return {
|
|
465
|
-
_cleanupScrollState:
|
|
466
|
-
store:
|
|
467
|
-
push:
|
|
468
|
-
replace:
|
|
469
|
-
back:
|
|
470
|
-
subscribe:
|
|
611
|
+
_cleanupScrollState: Y,
|
|
612
|
+
store: d,
|
|
613
|
+
push: k,
|
|
614
|
+
replace: L,
|
|
615
|
+
back: j,
|
|
616
|
+
subscribe: d.subscribe,
|
|
471
617
|
matchRoute: (s) => O(s),
|
|
472
|
-
getCurrent: () =>
|
|
473
|
-
resolveRouteComponent:
|
|
474
|
-
base:
|
|
618
|
+
getCurrent: () => d.getState(),
|
|
619
|
+
resolveRouteComponent: Pt,
|
|
620
|
+
base: o,
|
|
475
621
|
// Public API: allow components or tests to explicitly request scrolling to
|
|
476
622
|
// a fragment when they know their DOM is ready. Returns true if scrolled.
|
|
477
623
|
scrollToFragment: (s) => {
|
|
478
|
-
const c = s ||
|
|
479
|
-
return !c || typeof window > "u" || typeof document > "u" ? Promise.resolve(!1) :
|
|
624
|
+
const c = s || d.getState().fragment;
|
|
625
|
+
return !c || typeof window > "u" || typeof document > "u" ? Promise.resolve(!1) : h(
|
|
480
626
|
c,
|
|
481
|
-
|
|
482
|
-
|
|
627
|
+
b.offset,
|
|
628
|
+
b.timeoutMs
|
|
483
629
|
);
|
|
484
630
|
}
|
|
485
631
|
};
|
|
486
632
|
}
|
|
487
|
-
function
|
|
488
|
-
return Z(t, r);
|
|
489
|
-
}
|
|
490
|
-
let m = null;
|
|
491
|
-
const j = /* @__PURE__ */ new Set();
|
|
492
|
-
let z = null;
|
|
493
|
-
function mt() {
|
|
494
|
-
if (z) {
|
|
495
|
-
try {
|
|
496
|
-
z();
|
|
497
|
-
} catch {
|
|
498
|
-
}
|
|
499
|
-
z = null;
|
|
500
|
-
}
|
|
501
|
-
if (m)
|
|
502
|
-
try {
|
|
503
|
-
let t = !1;
|
|
504
|
-
z = m.subscribe((r) => {
|
|
505
|
-
t = !0;
|
|
506
|
-
for (const a of j)
|
|
507
|
-
try {
|
|
508
|
-
a(r);
|
|
509
|
-
} catch {
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
try {
|
|
513
|
-
C.base = m.base;
|
|
514
|
-
} catch {
|
|
515
|
-
}
|
|
516
|
-
if (t) {
|
|
517
|
-
const r = m.getCurrent();
|
|
518
|
-
for (const a of j)
|
|
519
|
-
try {
|
|
520
|
-
a(r);
|
|
521
|
-
} catch {
|
|
522
|
-
}
|
|
523
|
-
} else {
|
|
524
|
-
const r = m.getCurrent();
|
|
525
|
-
for (const a of j)
|
|
526
|
-
try {
|
|
527
|
-
a(r);
|
|
528
|
-
} catch {
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
try {
|
|
532
|
-
typeof window < "u" && et();
|
|
533
|
-
} catch {
|
|
534
|
-
}
|
|
535
|
-
} catch {
|
|
536
|
-
z = null;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
const C = {
|
|
540
|
-
store: {
|
|
541
|
-
subscribe(t) {
|
|
542
|
-
if (m) return m.store.subscribe(t);
|
|
543
|
-
try {
|
|
544
|
-
t({ path: "/", params: {}, query: {} });
|
|
545
|
-
} catch {
|
|
546
|
-
}
|
|
547
|
-
return () => {
|
|
548
|
-
};
|
|
549
|
-
},
|
|
550
|
-
getState() {
|
|
551
|
-
return m ? m.getCurrent() : { path: "/", params: {}, query: {} };
|
|
552
|
-
},
|
|
553
|
-
setState(t) {
|
|
554
|
-
if (m)
|
|
555
|
-
try {
|
|
556
|
-
m.store.setState(
|
|
557
|
-
t
|
|
558
|
-
);
|
|
559
|
-
} catch {
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
},
|
|
563
|
-
subscribe(t) {
|
|
564
|
-
if (typeof t != "function")
|
|
565
|
-
return g("activeRouterProxy.subscribe: listener must be a function"), () => {
|
|
566
|
-
};
|
|
567
|
-
if (j.add(t), m)
|
|
568
|
-
if (!z)
|
|
569
|
-
mt();
|
|
570
|
-
else
|
|
571
|
-
try {
|
|
572
|
-
const r = m.getCurrent();
|
|
573
|
-
r && t(r);
|
|
574
|
-
} catch (r) {
|
|
575
|
-
g("activeRouterProxy subscription failed", r);
|
|
576
|
-
}
|
|
577
|
-
else
|
|
578
|
-
try {
|
|
579
|
-
t({ path: "/", params: {}, query: {} });
|
|
580
|
-
} catch (r) {
|
|
581
|
-
g("activeRouterProxy fallback state delivery failed", r);
|
|
582
|
-
}
|
|
583
|
-
return () => {
|
|
584
|
-
try {
|
|
585
|
-
if (j.delete(t), j.size === 0 && z) {
|
|
586
|
-
try {
|
|
587
|
-
z();
|
|
588
|
-
} catch (r) {
|
|
589
|
-
g("activeRouterProxy inner unsubscribe failed", r);
|
|
590
|
-
}
|
|
591
|
-
z = null;
|
|
592
|
-
}
|
|
593
|
-
} catch (r) {
|
|
594
|
-
g("activeRouterProxy unsubscribe failed", r);
|
|
595
|
-
}
|
|
596
|
-
};
|
|
597
|
-
},
|
|
598
|
-
getCurrent() {
|
|
599
|
-
return m ? m.getCurrent() : { path: "/", params: {}, query: {} };
|
|
600
|
-
},
|
|
601
|
-
async push(t) {
|
|
602
|
-
return m ? m.push(t) : Promise.resolve();
|
|
603
|
-
},
|
|
604
|
-
async replace(t) {
|
|
605
|
-
return m ? m.replace(t) : Promise.resolve();
|
|
606
|
-
},
|
|
607
|
-
back() {
|
|
608
|
-
if (m)
|
|
609
|
-
return m.back();
|
|
610
|
-
},
|
|
611
|
-
matchRoute(t) {
|
|
612
|
-
return m ? m.matchRoute(t) : { route: null, params: {} };
|
|
613
|
-
},
|
|
614
|
-
resolveRouteComponent(t) {
|
|
615
|
-
return m ? m.resolveRouteComponent(t) : Promise.reject(new Error("No active router"));
|
|
616
|
-
},
|
|
617
|
-
base: "",
|
|
618
|
-
scrollToFragment(t) {
|
|
619
|
-
return m ? m.scrollToFragment(t) : Promise.resolve(!1);
|
|
620
|
-
}
|
|
621
|
-
};
|
|
622
|
-
function zt(t) {
|
|
633
|
+
function Ft(t) {
|
|
623
634
|
xt();
|
|
624
|
-
const r =
|
|
625
|
-
if (
|
|
635
|
+
const r = Tt(t), g = dt();
|
|
636
|
+
if (g)
|
|
626
637
|
try {
|
|
627
|
-
|
|
638
|
+
g._cleanupScrollState?.();
|
|
628
639
|
} catch {
|
|
629
640
|
}
|
|
630
|
-
|
|
641
|
+
_t(r);
|
|
631
642
|
try {
|
|
632
|
-
|
|
643
|
+
qt();
|
|
633
644
|
try {
|
|
634
|
-
typeof window < "u" &&
|
|
645
|
+
typeof window < "u" && rt();
|
|
635
646
|
} catch {
|
|
636
647
|
}
|
|
637
648
|
try {
|
|
638
649
|
typeof window < "u" && queueMicrotask(() => {
|
|
639
650
|
try {
|
|
640
|
-
|
|
651
|
+
rt();
|
|
641
652
|
} catch {
|
|
642
653
|
}
|
|
643
654
|
});
|
|
@@ -646,16 +657,16 @@ function zt(t) {
|
|
|
646
657
|
} catch {
|
|
647
658
|
}
|
|
648
659
|
return st("router-view", async () => {
|
|
649
|
-
if (!
|
|
650
|
-
const a =
|
|
660
|
+
if (!dt()) return F`<div>Router not initialized.</div>`;
|
|
661
|
+
const a = tt(E.getCurrent()), i = typeof window > "u";
|
|
651
662
|
let o;
|
|
652
|
-
|
|
663
|
+
i || (ct(() => {
|
|
653
664
|
try {
|
|
654
|
-
typeof
|
|
665
|
+
typeof E.subscribe == "function" && (o = E.subscribe((l) => {
|
|
655
666
|
try {
|
|
656
|
-
l && typeof l == "object" && typeof l.path == "string" ? a.value = l : (
|
|
667
|
+
l && typeof l == "object" && typeof l.path == "string" ? a.value = l : (y("router-view received invalid state", l), a.value = { path: "/", params: {}, query: {} });
|
|
657
668
|
} catch (u) {
|
|
658
|
-
|
|
669
|
+
y("router-view subscription update failed", u);
|
|
659
670
|
try {
|
|
660
671
|
a.value = { path: "/", params: {}, query: {} };
|
|
661
672
|
} catch {
|
|
@@ -663,36 +674,36 @@ function zt(t) {
|
|
|
663
674
|
}
|
|
664
675
|
}));
|
|
665
676
|
} catch (l) {
|
|
666
|
-
|
|
677
|
+
y("router-view subscribe failed", l);
|
|
667
678
|
}
|
|
668
679
|
}), it(() => {
|
|
669
680
|
if (typeof o == "function") {
|
|
670
681
|
try {
|
|
671
682
|
o();
|
|
672
683
|
} catch (l) {
|
|
673
|
-
|
|
684
|
+
y("router-view unsubscribe failed", l);
|
|
674
685
|
}
|
|
675
686
|
o = void 0;
|
|
676
687
|
}
|
|
677
688
|
}));
|
|
678
|
-
const
|
|
679
|
-
if (!
|
|
689
|
+
const b = E.matchRoute(a.value.path);
|
|
690
|
+
if (!b || !b.route) return F`<div>Not found</div>`;
|
|
680
691
|
try {
|
|
681
|
-
const u = await
|
|
682
|
-
|
|
692
|
+
const u = await E.resolveRouteComponent(
|
|
693
|
+
b.route
|
|
683
694
|
);
|
|
684
695
|
if (typeof u == "string")
|
|
685
696
|
return { tag: u, props: {}, children: [] };
|
|
686
697
|
if (typeof u == "function") {
|
|
687
|
-
const
|
|
688
|
-
return (
|
|
698
|
+
const d = u();
|
|
699
|
+
return (d instanceof Promise ? d : Promise.resolve(d)).then((k) => typeof k == "string" ? { tag: k, props: {}, children: [] } : k);
|
|
689
700
|
}
|
|
690
|
-
return
|
|
701
|
+
return F`<div>Invalid route component</div>`;
|
|
691
702
|
} catch {
|
|
692
|
-
return
|
|
703
|
+
return F`<div>Invalid route component</div>`;
|
|
693
704
|
}
|
|
694
705
|
}), st("router-link", () => {
|
|
695
|
-
const a =
|
|
706
|
+
const a = bt({
|
|
696
707
|
to: "",
|
|
697
708
|
tag: "a",
|
|
698
709
|
replace: !1,
|
|
@@ -705,32 +716,32 @@ function zt(t) {
|
|
|
705
716
|
// allow host `class` and `style` attributes to be read via useProps
|
|
706
717
|
class: "",
|
|
707
718
|
style: ""
|
|
708
|
-
}),
|
|
709
|
-
isExactActive:
|
|
710
|
-
|
|
719
|
+
}), i = typeof window > "u", o = tt(E.getCurrent()), b = o.value?.path || "/", l = String(a.to || ""), u = i ? {
|
|
720
|
+
isExactActive: yt(
|
|
721
|
+
b,
|
|
711
722
|
l,
|
|
712
|
-
|
|
723
|
+
E.base
|
|
713
724
|
),
|
|
714
|
-
isActive:
|
|
715
|
-
|
|
725
|
+
isActive: mt(
|
|
726
|
+
b,
|
|
716
727
|
l,
|
|
717
|
-
|
|
728
|
+
E.base
|
|
718
729
|
),
|
|
719
|
-
isExternal:
|
|
730
|
+
isExternal: Z(l) || !!a.external
|
|
720
731
|
} : null;
|
|
721
|
-
let
|
|
722
|
-
|
|
723
|
-
const
|
|
724
|
-
if (!
|
|
725
|
-
let
|
|
726
|
-
ct((
|
|
732
|
+
let d;
|
|
733
|
+
wt(() => "a,button{display:inline-block;}");
|
|
734
|
+
const A = tt(a.class || ""), k = tt(a.style || "");
|
|
735
|
+
if (!i) {
|
|
736
|
+
let h = null;
|
|
737
|
+
ct((R) => {
|
|
727
738
|
try {
|
|
728
|
-
if (typeof
|
|
729
|
-
|
|
739
|
+
if (typeof E.subscribe == "function") {
|
|
740
|
+
d = E.subscribe((f) => {
|
|
730
741
|
try {
|
|
731
|
-
|
|
732
|
-
} catch (
|
|
733
|
-
|
|
742
|
+
f && typeof f == "object" && typeof f.path == "string" ? o.value = f : (y("router-link received invalid state", f), o.value = { path: "/", params: {}, query: {} });
|
|
743
|
+
} catch (q) {
|
|
744
|
+
y("router-link subscription update failed", q);
|
|
734
745
|
try {
|
|
735
746
|
o.value = { path: "/", params: {}, query: {} };
|
|
736
747
|
} catch {
|
|
@@ -738,187 +749,194 @@ function zt(t) {
|
|
|
738
749
|
}
|
|
739
750
|
});
|
|
740
751
|
try {
|
|
741
|
-
const
|
|
742
|
-
|
|
743
|
-
} catch (
|
|
744
|
-
|
|
752
|
+
const f = E.getCurrent();
|
|
753
|
+
f && typeof f.path == "string" && (o.value = f);
|
|
754
|
+
} catch (f) {
|
|
755
|
+
y("router-link initial state sync failed", f);
|
|
745
756
|
}
|
|
746
|
-
|
|
757
|
+
h = setInterval(() => {
|
|
747
758
|
try {
|
|
748
|
-
const
|
|
749
|
-
|
|
759
|
+
const f = E.getCurrent();
|
|
760
|
+
f && typeof f.path == "string" && JSON.stringify(o.value) !== JSON.stringify(f) && (o.value = f);
|
|
750
761
|
} catch {
|
|
751
762
|
}
|
|
752
763
|
}, 100);
|
|
753
764
|
}
|
|
754
|
-
} catch (
|
|
755
|
-
|
|
765
|
+
} catch (f) {
|
|
766
|
+
y("router-link subscribe failed", f);
|
|
756
767
|
}
|
|
757
768
|
try {
|
|
758
|
-
const
|
|
759
|
-
if (
|
|
760
|
-
const
|
|
761
|
-
|
|
769
|
+
const f = R?._host;
|
|
770
|
+
if (f instanceof HTMLElement) {
|
|
771
|
+
const q = f.getAttribute("class"), N = f.getAttribute("style");
|
|
772
|
+
q && (A.value = q), N && (k.value = N), q !== null && f.removeAttribute("class"), N !== null && f.removeAttribute("style");
|
|
762
773
|
try {
|
|
763
|
-
|
|
774
|
+
R?._requestRender?.();
|
|
764
775
|
try {
|
|
765
|
-
|
|
776
|
+
rt();
|
|
766
777
|
} catch {
|
|
767
778
|
}
|
|
768
779
|
} catch {
|
|
769
780
|
}
|
|
770
781
|
}
|
|
771
|
-
} catch (
|
|
772
|
-
|
|
782
|
+
} catch (f) {
|
|
783
|
+
y("router-link host migration failed", f);
|
|
773
784
|
}
|
|
774
785
|
}), it(() => {
|
|
775
|
-
if (typeof
|
|
786
|
+
if (typeof d == "function")
|
|
776
787
|
try {
|
|
777
|
-
|
|
778
|
-
} catch (
|
|
779
|
-
|
|
788
|
+
d();
|
|
789
|
+
} catch (R) {
|
|
790
|
+
y("router-link unsubscribe failed", R);
|
|
780
791
|
} finally {
|
|
781
|
-
|
|
792
|
+
d = void 0;
|
|
782
793
|
}
|
|
783
|
-
if (
|
|
794
|
+
if (h)
|
|
784
795
|
try {
|
|
785
|
-
clearInterval(
|
|
786
|
-
} catch (
|
|
787
|
-
|
|
796
|
+
clearInterval(h);
|
|
797
|
+
} catch (R) {
|
|
798
|
+
y("router-link sync interval cleanup failed", R);
|
|
788
799
|
} finally {
|
|
789
|
-
|
|
800
|
+
h = null;
|
|
790
801
|
}
|
|
791
802
|
});
|
|
792
803
|
}
|
|
793
|
-
const
|
|
794
|
-
if (
|
|
804
|
+
const L = T(() => {
|
|
805
|
+
if (i && u)
|
|
795
806
|
return u.isExactActive;
|
|
796
807
|
try {
|
|
797
|
-
const
|
|
798
|
-
return !o.value || typeof o.value.path != "string" ? !1 :
|
|
799
|
-
} catch (
|
|
800
|
-
return
|
|
808
|
+
const h = E.base ?? "", R = a.to || "";
|
|
809
|
+
return !o.value || typeof o.value.path != "string" ? !1 : yt(o.value.path, R, h);
|
|
810
|
+
} catch (h) {
|
|
811
|
+
return y("isExactActive computation error", h), !1;
|
|
801
812
|
}
|
|
802
|
-
}),
|
|
803
|
-
if (
|
|
813
|
+
}), j = T(() => {
|
|
814
|
+
if (i && u)
|
|
804
815
|
return u.isActive;
|
|
805
816
|
try {
|
|
806
|
-
const
|
|
807
|
-
return !o.value || typeof o.value.path != "string" ? !1 : a.exact ?
|
|
808
|
-
} catch (
|
|
809
|
-
return
|
|
817
|
+
const h = E.base ?? "", R = a.to || "";
|
|
818
|
+
return !o.value || typeof o.value.path != "string" ? !1 : a.exact ? L.value : mt(o.value.path, R, h);
|
|
819
|
+
} catch (h) {
|
|
820
|
+
return y("isActive computation error", h), !1;
|
|
810
821
|
}
|
|
811
|
-
}),
|
|
812
|
-
const
|
|
813
|
-
if (ft(
|
|
814
|
-
if (
|
|
815
|
-
const [
|
|
816
|
-
let
|
|
817
|
-
if (
|
|
818
|
-
const
|
|
819
|
-
|
|
822
|
+
}), _ = T(() => {
|
|
823
|
+
const h = String(a.to || "");
|
|
824
|
+
if (ft(h)) return null;
|
|
825
|
+
if (Z(h)) return h;
|
|
826
|
+
const [R, f] = h.split("#"), [q, N] = (R || "").split("?"), V = E.base ?? "";
|
|
827
|
+
let H = q || "/";
|
|
828
|
+
if (V && V !== "/") {
|
|
829
|
+
const s = C(V), c = C(H);
|
|
830
|
+
c.startsWith(s) ? H = c.slice(s.length) || "/" : H = c;
|
|
820
831
|
}
|
|
821
|
-
const ot =
|
|
822
|
-
return
|
|
823
|
-
}),
|
|
824
|
-
const
|
|
825
|
-
for (const
|
|
826
|
-
return
|
|
827
|
-
}),
|
|
828
|
-
...
|
|
829
|
-
[a.activeClass || "active"]:
|
|
830
|
-
[a.exactActiveClass || "exact-active"]:
|
|
831
|
-
})),
|
|
832
|
-
() => Object.keys(
|
|
833
|
-
),
|
|
834
|
-
() =>
|
|
835
|
-
),
|
|
836
|
-
const
|
|
837
|
-
return (
|
|
838
|
-
}),
|
|
839
|
-
() =>
|
|
840
|
-
),
|
|
841
|
-
if (
|
|
832
|
+
const ot = C(H || "/");
|
|
833
|
+
return V + ot + (N ? "?" + N : "") + (f ? "#" + f : "");
|
|
834
|
+
}), B = T(() => {
|
|
835
|
+
const R = (A && A.value || a.class || "").split(/\s+/).filter(Boolean), f = {};
|
|
836
|
+
for (const q of R) f[q] = !0;
|
|
837
|
+
return f;
|
|
838
|
+
}), P = T(() => ({
|
|
839
|
+
...B.value,
|
|
840
|
+
[a.activeClass || "active"]: j.value,
|
|
841
|
+
[a.exactActiveClass || "exact-active"]: L.value
|
|
842
|
+
})), X = T(
|
|
843
|
+
() => Object.keys(P.value).filter((h) => P.value[h]).join(" ")
|
|
844
|
+
), G = T(() => a.tag || "a"), nt = T(() => G.value === "button"), z = T(
|
|
845
|
+
() => L.value ? a.ariaCurrentValue : null
|
|
846
|
+
), M = T(() => !!a.disabled), O = T(() => {
|
|
847
|
+
const h = String(a.to || "");
|
|
848
|
+
return (Z(h) || !!a.external) && G.value === "a";
|
|
849
|
+
}), Y = T(
|
|
850
|
+
() => k && k.value || a.style || ""
|
|
851
|
+
), K = (h) => {
|
|
852
|
+
if (h.defaultPrevented || h.button !== 0 || h.metaKey || h.altKey || h.ctrlKey || h.shiftKey)
|
|
842
853
|
return;
|
|
843
|
-
if (
|
|
844
|
-
|
|
854
|
+
if (M.value) {
|
|
855
|
+
h.preventDefault();
|
|
845
856
|
return;
|
|
846
857
|
}
|
|
847
|
-
const
|
|
848
|
-
if (ft(
|
|
858
|
+
const R = String(a.to || "");
|
|
859
|
+
if (ft(R)) {
|
|
849
860
|
try {
|
|
850
|
-
|
|
861
|
+
h.preventDefault();
|
|
851
862
|
} catch {
|
|
852
863
|
}
|
|
853
|
-
|
|
864
|
+
y("Blocked unsafe javascript: URI in router-link.to");
|
|
854
865
|
return;
|
|
855
866
|
}
|
|
856
|
-
|
|
867
|
+
O.value || (h.preventDefault(), a.replace ? E.replace(a.to) : E.push(a.to));
|
|
857
868
|
};
|
|
858
|
-
return
|
|
859
|
-
${
|
|
860
|
-
|
|
861
|
-
|
|
869
|
+
return F`
|
|
870
|
+
${St().when(
|
|
871
|
+
nt.value,
|
|
872
|
+
F`
|
|
862
873
|
<button
|
|
863
874
|
part="button"
|
|
864
|
-
class="${
|
|
865
|
-
style="${
|
|
866
|
-
aria-current="${
|
|
867
|
-
disabled="${
|
|
868
|
-
aria-disabled="${
|
|
869
|
-
tabindex="${
|
|
870
|
-
@click="${
|
|
875
|
+
class="${X.value}"
|
|
876
|
+
style="${Y.value || null}"
|
|
877
|
+
aria-current="${z.value}"
|
|
878
|
+
disabled="${M.value ? "" : null}"
|
|
879
|
+
aria-disabled="${M.value ? "true" : null}"
|
|
880
|
+
tabindex="${M.value ? "-1" : null}"
|
|
881
|
+
@click="${K}"
|
|
871
882
|
>
|
|
872
883
|
<slot></slot>
|
|
873
884
|
</button>
|
|
874
885
|
`
|
|
875
|
-
).otherwise(
|
|
886
|
+
).otherwise(F`
|
|
876
887
|
<a
|
|
877
888
|
part="link"
|
|
878
|
-
href="${
|
|
879
|
-
class="${
|
|
880
|
-
style="${
|
|
881
|
-
aria-current="${
|
|
882
|
-
aria-disabled="${
|
|
883
|
-
tabindex="${
|
|
884
|
-
target="${
|
|
885
|
-
rel="${
|
|
886
|
-
@click="${
|
|
889
|
+
href="${M.value ? null : _.value}"
|
|
890
|
+
class="${X.value}"
|
|
891
|
+
style="${Y.value || null}"
|
|
892
|
+
aria-current="${z.value}"
|
|
893
|
+
aria-disabled="${M.value ? "true" : null}"
|
|
894
|
+
tabindex="${M.value ? "-1" : null}"
|
|
895
|
+
target="${O.value ? "_blank" : null}"
|
|
896
|
+
rel="${O.value ? "noopener noreferrer" : null}"
|
|
897
|
+
@click="${K}"
|
|
887
898
|
><slot></slot
|
|
888
899
|
></a>
|
|
889
900
|
`).done()}
|
|
890
901
|
`;
|
|
891
902
|
}), r;
|
|
892
903
|
}
|
|
893
|
-
function
|
|
894
|
-
if (
|
|
895
|
-
let
|
|
896
|
-
if (
|
|
897
|
-
const
|
|
898
|
-
|
|
904
|
+
function yt(t, r, g) {
|
|
905
|
+
if (Z(r)) return !1;
|
|
906
|
+
let i = (r.split("#")[0] || "/").split("?")[0];
|
|
907
|
+
if (g && g !== "/") {
|
|
908
|
+
const l = C(g), u = C(i);
|
|
909
|
+
u.startsWith(l) ? i = u.slice(l.length) || "/" : i = u;
|
|
899
910
|
}
|
|
900
|
-
const
|
|
901
|
-
return
|
|
911
|
+
const o = C(t), b = C(i);
|
|
912
|
+
return o === b;
|
|
902
913
|
}
|
|
903
|
-
function
|
|
904
|
-
if (
|
|
905
|
-
let
|
|
906
|
-
if (
|
|
907
|
-
const
|
|
908
|
-
|
|
914
|
+
function mt(t, r, g) {
|
|
915
|
+
if (Z(r)) return !1;
|
|
916
|
+
let i = (r.split("#")[0] || "/").split("?")[0];
|
|
917
|
+
if (g && g !== "/") {
|
|
918
|
+
const l = C(g), u = C(i);
|
|
919
|
+
u.startsWith(l) ? i = u.slice(l.length) || "/" : i = u;
|
|
909
920
|
}
|
|
910
|
-
const
|
|
911
|
-
return
|
|
921
|
+
const o = C(t), b = C(i);
|
|
922
|
+
return b === "/" ? o === "/" : o === b ? !0 : o.startsWith(b.endsWith("/") ? b : b + "/");
|
|
912
923
|
}
|
|
913
924
|
export {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
925
|
+
ut as DEFAULT_SCROLL_CONFIG,
|
|
926
|
+
E as activeRouterProxy,
|
|
927
|
+
Et as canonicalizeBase,
|
|
928
|
+
xt as clearComponentCache,
|
|
929
|
+
et as findMatchedRoute,
|
|
930
|
+
Ft as initRouter,
|
|
931
|
+
Z as isAbsoluteUrl,
|
|
932
|
+
ft as isDangerousScheme,
|
|
933
|
+
Q as matchRoute,
|
|
934
|
+
Lt as matchRouteSSR,
|
|
935
|
+
C as normalizePathForRoute,
|
|
919
936
|
at as parseQuery,
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
937
|
+
Pt as resolveRouteComponent,
|
|
938
|
+
$t as safeDecode,
|
|
939
|
+
Rt as serializeQuery,
|
|
940
|
+
Tt as useRouter
|
|
923
941
|
};
|
|
924
942
|
//# sourceMappingURL=custom-elements-runtime.router.es.js.map
|