@jasonshimmy/custom-elements-runtime 3.1.3 → 3.2.0

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