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