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