@jasonshimmy/custom-elements-runtime 3.3.0 → 3.5.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 -13
  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-DcEpRwq5.cjs +5 -0
  57. package/dist/helpers-DcEpRwq5.cjs.map +1 -0
  58. package/dist/helpers-tJgb4Qve.js +693 -0
  59. package/dist/helpers-tJgb4Qve.js.map +1 -0
  60. package/dist/hooks-CEUnvtsA.js +407 -0
  61. package/dist/hooks-CEUnvtsA.js.map +1 -0
  62. package/dist/hooks-CNfugc95.cjs +2 -0
  63. package/dist/hooks-CNfugc95.cjs.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-BpYy9XlW.js +170 -0
  74. package/dist/{ssr-B3lxl1vr.js.map → ssr-BpYy9XlW.js.map} +1 -1
  75. package/dist/ssr-CFabTOyi.cjs +4 -0
  76. package/dist/{ssr-DtD9e5iA.cjs.map → ssr-CFabTOyi.cjs.map} +1 -1
  77. package/dist/ssr.d.ts +33 -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-CoSXTr1F.js +10 -0
  83. package/dist/tag-utils-CoSXTr1F.js.map +1 -0
  84. package/dist/tag-utils-XJ3dkcPQ.cjs +2 -0
  85. package/dist/tag-utils-XJ3dkcPQ.cjs.map +1 -0
  86. package/dist/template-compiler-B4B_jAPN.cjs +19 -0
  87. package/dist/{template-compiler-BB4JJdqk.cjs.map → template-compiler-B4B_jAPN.cjs.map} +1 -1
  88. package/dist/template-compiler-C3h8_vbE.js +3044 -0
  89. package/dist/{template-compiler-Cs5axmn4.js.map → template-compiler-C3h8_vbE.js.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-B3lxl1vr.js +0 -165
  102. package/dist/ssr-DtD9e5iA.cjs +0 -5
  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
@@ -0,0 +1,3044 @@
1
+ import { r as e, t } from "./logger-DIJ0UH3R.js";
2
+ import { a as n, i as r, n as i, o as a, r as o } from "./namespace-helpers-CIUkG8Mn.js";
3
+ import { C as s, O as c, S as l, T as u, _ as d, a as f, d as p, f as m, i as h, l as g, n as _, o as v, p as y, u as b, v as x, w as S } from "./helpers-tJgb4Qve.js";
4
+ import { a as C, d as w, f as T, i as E, n as ee, r as D, u as O } from "./css-utils-Bn-dO44e.js";
5
+ import { resetWhenCounter as te } from "./custom-elements-runtime.directives.es.js";
6
+ import { getTransitionStyleSheet as ne } from "./custom-elements-runtime.transitions.es.js";
7
+ import { t as re } from "./tag-utils-CoSXTr1F.js";
8
+ import { c as ie, t as k } from "./hooks-CEUnvtsA.js";
9
+ //#region src/lib/runtime/watchers.ts
10
+ function ae(e, n, r) {
11
+ if (r) for (let [i, a] of Object.entries(r)) {
12
+ let r, o = {};
13
+ if (Array.isArray(a) ? (r = a[0], o = a[1] || {}) : r = a, n.set(i, {
14
+ callback: r,
15
+ options: o,
16
+ oldValue: h(e, i)
17
+ }), o.immediate) try {
18
+ let t = h(e, i);
19
+ r(t, void 0, e);
20
+ } catch (e) {
21
+ t(`Error in immediate watcher for "${i}":`, e);
22
+ }
23
+ }
24
+ }
25
+ function oe(e, n, r, i) {
26
+ let a = (e, t) => {
27
+ if (e === t) return !0;
28
+ if (typeof e != typeof t || typeof e != "object" || !e || t === null) return !1;
29
+ if (Array.isArray(e) && Array.isArray(t)) return e.length === t.length ? e.every((e, n) => a(e, t[n])) : !1;
30
+ let n = e, r = t, i = Object.keys(n || {}), o = Object.keys(r || {});
31
+ return i.length === o.length ? i.every((e) => a(n[e], r[e])) : !1;
32
+ }, o = n.get(r);
33
+ if (o && !a(i, o.oldValue)) try {
34
+ o.callback(i, o.oldValue, e), o.oldValue = i;
35
+ } catch (e) {
36
+ t(`Error in watcher for "${r}":`, e);
37
+ }
38
+ for (let [i, o] of n.entries()) if (o.options.deep && r.startsWith(i + ".")) try {
39
+ let t = h(e, i);
40
+ a(t, o.oldValue) || (o.callback(t, o.oldValue, e), o.oldValue = t);
41
+ } catch (e) {
42
+ t(`Error in deep watcher for "${i}":`, e);
43
+ }
44
+ }
45
+ //#endregion
46
+ //#region src/lib/runtime/props.ts
47
+ function se(e, t) {
48
+ return t === Boolean ? e === "" || e === "true" : t === Number ? Number(e) : e;
49
+ }
50
+ function ce(e, t, n) {
51
+ if (t) for (let r in t) {
52
+ let i = t[r], a = y(r), o = e.getAttribute(a);
53
+ if (i.type === Function && typeof e[r] == "function") n[r] = e[r];
54
+ else if (o !== null) n[r] = se(o, i.type);
55
+ else if (e[r] !== void 0) try {
56
+ let t = e[r];
57
+ if (i.type === String && t && typeof t == "object") try {
58
+ n[r] = se(String(t), i.type);
59
+ } catch {
60
+ n[r] = t;
61
+ }
62
+ else i.type === Boolean && typeof t == "boolean" || i.type === Number && typeof t == "number" || i.type === Function && typeof t == "function" ? n[r] = t : n[r] = se(String(t), i.type);
63
+ } catch {
64
+ n[r] = e[r];
65
+ }
66
+ else "default" in i && i.default !== void 0 && (n[r] = i.default);
67
+ }
68
+ }
69
+ function le(e, t, n) {
70
+ if (!t.props) {
71
+ try {
72
+ let t = n?._hookCallbacks?.props || {}, r = Array.from(new Set([...Object.keys(e || {}), ...Object.keys(t || {})]));
73
+ for (let i of r) {
74
+ if (typeof i != "string" || i.startsWith("_")) continue;
75
+ let r = Object.getOwnPropertyDescriptor(n, i);
76
+ if (!(!Object.prototype.hasOwnProperty.call(t, i) && r && (r.get || r.set || !r.configurable))) try {
77
+ Object.defineProperty(n, i, {
78
+ enumerable: !0,
79
+ configurable: !0,
80
+ get() {
81
+ try {
82
+ let t = y(i), n = e.getAttribute(t);
83
+ if (n !== null) return n;
84
+ let r = e[i], a;
85
+ return a = d(r) || r && typeof r == "object" && "value" in r && !(typeof Node < "u" && r instanceof Node) ? r.value : r, a;
86
+ } catch {
87
+ return e[i];
88
+ }
89
+ }
90
+ });
91
+ } catch {}
92
+ }
93
+ } catch {}
94
+ return;
95
+ }
96
+ ce(e, t.props, n);
97
+ }
98
+ //#endregion
99
+ //#region src/lib/runtime/lifecycle.ts
100
+ function ue(e, t, n, r) {
101
+ e.onConnected && !n && (e.onConnected(t), r(!0));
102
+ }
103
+ function de(e, t, n, r, i, a, o, s) {
104
+ e.onDisconnected && e.onDisconnected(t), n.forEach((e) => e()), r(), i(), a(!1), o(null), s(!1);
105
+ }
106
+ function fe(e, t, n, r, i) {
107
+ e.onAttributeChanged && e.onAttributeChanged(t, n, r, i);
108
+ }
109
+ //#endregion
110
+ //#region src/lib/runtime/event-manager.ts
111
+ var A = class {
112
+ static cleanupFunctions = /* @__PURE__ */ new WeakMap();
113
+ static addListener(e, t, n, r) {
114
+ e.addEventListener(t, n, r);
115
+ let i = {
116
+ event: t,
117
+ handler: n,
118
+ wrapper: n,
119
+ options: r,
120
+ cleanup: () => e.removeEventListener(t, n, r),
121
+ addedAt: Date.now()
122
+ };
123
+ this.cleanupFunctions.has(e) || this.cleanupFunctions.set(e, []), this.cleanupFunctions.get(e).push(i);
124
+ }
125
+ static removeListener(e, t, n, r) {
126
+ e.removeEventListener(t, n, r);
127
+ let i = this.cleanupFunctions.get(e);
128
+ if (i) for (let r = 0; r < i.length; r++) {
129
+ let a = i[r];
130
+ if (a.event === t && a.handler === n) {
131
+ i.splice(r, 1), i.length === 0 && this.cleanupFunctions.delete(e);
132
+ return;
133
+ }
134
+ }
135
+ }
136
+ static cleanup(e) {
137
+ let t = this.cleanupFunctions.get(e);
138
+ t && (t.forEach((e) => {
139
+ try {
140
+ e.cleanup();
141
+ } catch {}
142
+ }), this.cleanupFunctions.delete(e));
143
+ }
144
+ static cleanupAll() {
145
+ this.cleanupFunctions = /* @__PURE__ */ new WeakMap();
146
+ }
147
+ static hasListeners(e) {
148
+ let t = this.cleanupFunctions.get(e);
149
+ return !!(t && t.length > 0);
150
+ }
151
+ static getListenerCount(e) {
152
+ let t = this.cleanupFunctions.get(e);
153
+ return t ? t.length : 0;
154
+ }
155
+ static getListenerInfo(e) {
156
+ let t = this.cleanupFunctions.get(e);
157
+ return t ? t.map((e) => ({
158
+ event: e.event,
159
+ handler: e.handler,
160
+ wrapper: e.wrapper,
161
+ options: e.options
162
+ })) : [];
163
+ }
164
+ }, pe = class {
165
+ map = /* @__PURE__ */ new Map();
166
+ maxSize;
167
+ constructor(e) {
168
+ this.maxSize = Math.max(1, e);
169
+ }
170
+ get(e) {
171
+ let t = this.map.get(e);
172
+ if (t !== void 0) return this.map.delete(e), this.map.set(e, t), t;
173
+ }
174
+ set(e, t) {
175
+ if (this.map.has(e) && this.map.delete(e), this.map.set(e, t), this.map.size > this.maxSize) {
176
+ let e = this.map.keys().next().value;
177
+ this.map.delete(e);
178
+ }
179
+ }
180
+ has(e) {
181
+ return this.map.has(e);
182
+ }
183
+ clear() {
184
+ this.map.clear();
185
+ }
186
+ get size() {
187
+ return this.map.size;
188
+ }
189
+ }, me = new pe((() => {
190
+ if (typeof navigator < "u" && "deviceMemory" in navigator) {
191
+ let e = navigator.deviceMemory;
192
+ if (e) return Math.min(1e3, Math.max(200, e * 100));
193
+ }
194
+ return (() => {
195
+ try {
196
+ return globalThis.process?.env?.NODE_ENV === "test";
197
+ } catch {
198
+ return !1;
199
+ }
200
+ })() ? 100 : 500;
201
+ })()), he = new Set(/* @__PURE__ */ "true.false.null.undefined.typeof.instanceof.in.of.new.delete.void.throw.return.this.class.extends.import.export.from.as.async.await.yield.if.else.for.while.do.switch.case.break.continue.try.catch.finally.let.const.var.function.NaN.Infinity".split(".")), ge = class {
202
+ static cache = new pe(1e3);
203
+ static dangerousPatterns = [
204
+ /constructor/i,
205
+ /prototype/i,
206
+ /__proto__/i,
207
+ /\bfunction\b/i,
208
+ /eval/i,
209
+ /import/i,
210
+ /require/i,
211
+ /window/i,
212
+ /document/i,
213
+ /global/i,
214
+ /process/i,
215
+ /setTimeout/i,
216
+ /setInterval/i,
217
+ /fetch/i,
218
+ /XMLHttpRequest/i
219
+ ];
220
+ static evaluate(t, n) {
221
+ let r = this.cache.get(t);
222
+ if (r) {
223
+ if (!r.isSecure) {
224
+ e("Blocked cached dangerous expression:", t);
225
+ return;
226
+ }
227
+ return r.evaluator(n);
228
+ }
229
+ let i = this.createEvaluator(t);
230
+ if (this.cache.set(t, i), !i.isSecure) {
231
+ e("Blocked dangerous expression:", t);
232
+ return;
233
+ }
234
+ return i.evaluator(n);
235
+ }
236
+ static createEvaluator(t) {
237
+ if (this.hasDangerousPatterns(t) || t.length > 1e3) return {
238
+ evaluator: () => void 0,
239
+ isSecure: !1
240
+ };
241
+ try {
242
+ return {
243
+ evaluator: this.createSafeEvaluator(t),
244
+ isSecure: !0
245
+ };
246
+ } catch (n) {
247
+ return e("Failed to create evaluator for expression:", t, n), {
248
+ evaluator: () => void 0,
249
+ isSecure: !1
250
+ };
251
+ }
252
+ }
253
+ static hasDangerousPatterns(e) {
254
+ return this.dangerousPatterns.some((t) => t.test(e));
255
+ }
256
+ static createSafeEvaluator(e) {
257
+ let t = e.trim();
258
+ if (t.startsWith("{") && t.endsWith("}")) return this.createObjectEvaluator(e);
259
+ if (/^ctx\.[a-zA-Z0-9_.]+$/.test(e.trim())) {
260
+ let t = e.trim().slice(4);
261
+ return (e) => h(e, t);
262
+ }
263
+ return e.includes("ctx") || /[+\-*/%<>=&|?:[\]]/.test(e) ? this.createSimpleEvaluator(e) : (t) => h(t, e);
264
+ }
265
+ static createObjectEvaluator(e) {
266
+ let t = e.trim().slice(1, -1), n = this.parseObjectProperties(t);
267
+ return (e) => {
268
+ let t = {};
269
+ for (let { key: r, value: i } of n) try {
270
+ i.startsWith("ctx.") ? t[r] = h(e, i.slice(4)) : t[r] = this.evaluateSimpleValue(i, e);
271
+ } catch {
272
+ t[r] = void 0;
273
+ }
274
+ return t;
275
+ };
276
+ }
277
+ static parseObjectProperties(e) {
278
+ let t = [], n = [], r = 0, i = null, a = 0;
279
+ for (let t = 0; t < e.length; t++) {
280
+ let o = e[t];
281
+ if (i) {
282
+ if (o === "\\") {
283
+ t++;
284
+ continue;
285
+ }
286
+ o === i && (i = null);
287
+ } else o === "\"" || o === "'" ? i = o : o === "(" || o === "[" || o === "{" ? r++ : o === ")" || o === "]" || o === "}" ? r-- : o === "," && r === 0 && (n.push(e.slice(a, t)), a = t + 1);
288
+ }
289
+ n.push(e.slice(a));
290
+ for (let e of n) {
291
+ let n = -1, r = 0, i = null;
292
+ for (let t = 0; t < e.length; t++) {
293
+ let a = e[t];
294
+ if (i) {
295
+ if (a === "\\") {
296
+ t++;
297
+ continue;
298
+ }
299
+ a === i && (i = null);
300
+ } else if (a === "\"" || a === "'") i = a;
301
+ else if (a === "(" || a === "[" || a === "{") r++;
302
+ else if (a === ")" || a === "]" || a === "}") r--;
303
+ else if (a === ":" && r === 0) {
304
+ n = t;
305
+ break;
306
+ }
307
+ }
308
+ if (n === -1) continue;
309
+ let a = e.slice(0, n).trim(), o = e.slice(n + 1).trim(), s = a.replace(/^['"]|['"]$/g, "");
310
+ t.push({
311
+ key: s,
312
+ value: o
313
+ });
314
+ }
315
+ return t;
316
+ }
317
+ static createSimpleEvaluator(e) {
318
+ return (t) => {
319
+ try {
320
+ let n = e, r = [];
321
+ n = n.replace(/("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')/g, (e) => `<<#${r.push(e) - 1}#>>`);
322
+ let i = n.match(/ctx\.[\w.]+/g) || [];
323
+ for (let e of i) {
324
+ let i = h(t, e.slice(4));
325
+ if (i === void 0) return;
326
+ let a = r.push(JSON.stringify(i)) - 1;
327
+ n = n.split(e).join(`<<#${a}#>>`);
328
+ }
329
+ let a = n.match(/\b[a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)+\b/g) || [];
330
+ for (let e of a) {
331
+ if (e.startsWith("ctx.")) continue;
332
+ let i = h(t, e);
333
+ if (i === void 0) return;
334
+ let a = r.push(JSON.stringify(i)) - 1;
335
+ n = n.split(e).join(`<<#${a}#>>`);
336
+ }
337
+ let o = /\b([a-zA-Z_][a-zA-Z0-9_]*)\b/g, s, c = /* @__PURE__ */ new Set();
338
+ for (; (s = o.exec(n)) !== null;) {
339
+ let e = s[1];
340
+ if (he.has(e) || /^[0-9]+$/.test(e) || e === "ctx" || c.has(e)) continue;
341
+ c.add(e);
342
+ let i = h(t, e);
343
+ if (i === void 0) return;
344
+ let a = JSON.stringify(i), l = r.push(a) - 1;
345
+ n = e.includes(".") ? n.split(e).join(`<<#${l}#>>`) : n.replace(RegExp("\\b" + e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "\\b", "g"), `<<#${l}#>>`), o.lastIndex = 0;
346
+ }
347
+ n = n.replace(/<<#(\d+)#>>/g, (e, t) => r[Number(t)]);
348
+ try {
349
+ return this.evaluateBasicExpression(n);
350
+ } catch {
351
+ return;
352
+ }
353
+ } catch {
354
+ return;
355
+ }
356
+ };
357
+ }
358
+ static evaluateBasicExpression(e) {
359
+ let t = this.tokenize(e), n = 0;
360
+ function r() {
361
+ return t[n];
362
+ }
363
+ function i(e) {
364
+ let r = t[n++];
365
+ if (e && !r) throw Error(`Unexpected token EOF, expected ${e}`);
366
+ if (e && r && r.type !== e && r.value !== e) throw Error(`Unexpected token ${r.type}/${r.value}, expected ${e}`);
367
+ return r;
368
+ }
369
+ function a() {
370
+ return p();
371
+ }
372
+ function o(e) {
373
+ if (typeof e == "number") return e;
374
+ if (e == null) return NaN;
375
+ if (typeof e == "boolean") return e ? 1 : 0;
376
+ let t = Number(e);
377
+ return Number.isNaN(t) ? NaN : t;
378
+ }
379
+ function s(e, t) {
380
+ return typeof e == "string" || typeof t == "string" ? String(e) + String(t) : o(e) + o(t);
381
+ }
382
+ function c(e, t) {
383
+ return o(e) - o(t);
384
+ }
385
+ function l(e, t) {
386
+ return o(e) * o(t);
387
+ }
388
+ function u(e, t) {
389
+ return o(e) / o(t);
390
+ }
391
+ function d(e, t) {
392
+ return o(e) % o(t);
393
+ }
394
+ function f(e, t, n) {
395
+ if (typeof t == "number" && typeof n == "number") switch (e) {
396
+ case ">": return t > n;
397
+ case "<": return t < n;
398
+ case ">=": return t >= n;
399
+ case "<=": return t <= n;
400
+ default: return !1;
401
+ }
402
+ let r = String(t), i = String(n);
403
+ switch (e) {
404
+ case ">": return r > i;
405
+ case "<": return r < i;
406
+ case ">=": return r >= i;
407
+ case "<=": return r <= i;
408
+ default: return !1;
409
+ }
410
+ }
411
+ function p() {
412
+ let e = m(), t = r();
413
+ if (t && t.value === "?") {
414
+ i("?");
415
+ let t = a();
416
+ i(":");
417
+ let n = a();
418
+ return e ? t : n;
419
+ }
420
+ return e;
421
+ }
422
+ function m() {
423
+ let e = h();
424
+ for (;;) {
425
+ let t = r();
426
+ if (!t || t.value !== "||") break;
427
+ i("OP");
428
+ let n = h();
429
+ e ||= n;
430
+ }
431
+ return e;
432
+ }
433
+ function h() {
434
+ let e = g();
435
+ for (;;) {
436
+ let t = r();
437
+ if (!t || t.value !== "&&") break;
438
+ i("OP");
439
+ let n = g();
440
+ e &&= n;
441
+ }
442
+ return e;
443
+ }
444
+ function g() {
445
+ let e = _();
446
+ for (;;) {
447
+ let t = r();
448
+ if (!t || ![
449
+ "==",
450
+ "!=",
451
+ "===",
452
+ "!=="
453
+ ].includes(t.value)) break;
454
+ let n = i("OP").value, a = _();
455
+ switch (n) {
456
+ case "==":
457
+ e = e == a;
458
+ break;
459
+ case "!=":
460
+ e = e != a;
461
+ break;
462
+ case "===":
463
+ e = e === a;
464
+ break;
465
+ case "!==":
466
+ e = e !== a;
467
+ break;
468
+ }
469
+ }
470
+ return e;
471
+ }
472
+ function _() {
473
+ let e = v();
474
+ for (;;) {
475
+ let t = r();
476
+ if (!t || ![
477
+ ">",
478
+ "<",
479
+ ">=",
480
+ "<="
481
+ ].includes(t.value)) break;
482
+ let n = i("OP").value, a = v();
483
+ switch (n) {
484
+ case ">":
485
+ e = f(">", e, a);
486
+ break;
487
+ case "<":
488
+ e = f("<", e, a);
489
+ break;
490
+ case ">=":
491
+ e = f(">=", e, a);
492
+ break;
493
+ case "<=":
494
+ e = f("<=", e, a);
495
+ break;
496
+ }
497
+ }
498
+ return e;
499
+ }
500
+ function v() {
501
+ let e = y();
502
+ for (;;) {
503
+ let t = r();
504
+ if (!t || t.value !== "+" && t.value !== "-") break;
505
+ let n = i("OP").value, a = y();
506
+ e = n === "+" ? s(e, a) : c(e, a);
507
+ }
508
+ return e;
509
+ }
510
+ function y() {
511
+ let e = b();
512
+ for (;;) {
513
+ let t = r();
514
+ if (!t || t.value !== "*" && t.value !== "/" && t.value !== "%") break;
515
+ let n = i("OP").value, a = b();
516
+ switch (n) {
517
+ case "*":
518
+ e = l(e, a);
519
+ break;
520
+ case "/":
521
+ e = u(e, a);
522
+ break;
523
+ case "%":
524
+ e = d(e, a);
525
+ break;
526
+ }
527
+ }
528
+ return e;
529
+ }
530
+ function b() {
531
+ let e = r();
532
+ return e && e.value === "!" ? (i("OP"), !b()) : e && e.value === "-" ? (i("OP"), c(0, b())) : x();
533
+ }
534
+ function x() {
535
+ let e = r();
536
+ if (e) {
537
+ if (e.type === "NUMBER") return i("NUMBER"), Number(e.value);
538
+ if (e.type === "STRING") return i("STRING"), e.value.slice(1, -1);
539
+ if (e.type === "IDENT") return i("IDENT"), e.value === "true" ? !0 : e.value === "false" ? !1 : e.value === "null" ? null : void 0;
540
+ if (e.value === "[") {
541
+ i("PUNC");
542
+ let e = [];
543
+ for (;;) {
544
+ let t = r();
545
+ if (!t || t.value === "]") break;
546
+ e.push(a());
547
+ let n = r();
548
+ n && n.value === "," && i("PUNC");
549
+ }
550
+ return i("PUNC"), e;
551
+ }
552
+ if (e.value === "(") {
553
+ i("PUNC");
554
+ let e = a();
555
+ return i("PUNC"), e;
556
+ }
557
+ throw Error("Unexpected token in expression");
558
+ }
559
+ }
560
+ return a();
561
+ }
562
+ static tokenize(e) {
563
+ let t = [], n = /\s*(=>|===|!==|==|!=|>=|<=|\|\||&&|[()?:,[\]]|\+|-|\*|\/|%|>|<|!|\d+\.?\d*|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[a-zA-Z_][a-zA-Z0-9_]*|\S)\s*/g, r;
564
+ for (; (r = n.exec(e)) !== null;) {
565
+ let e = r[1];
566
+ e && (/^\d/.test(e) ? t.push({
567
+ type: "NUMBER",
568
+ value: e
569
+ }) : /^"/.test(e) || /^'/.test(e) ? t.push({
570
+ type: "STRING",
571
+ value: e
572
+ }) : /^[a-zA-Z_]/.test(e) ? t.push({
573
+ type: "IDENT",
574
+ value: e
575
+ }) : /^[()?:,[\]]$/.test(e) ? t.push({
576
+ type: "PUNC",
577
+ value: e
578
+ }) : t.push({
579
+ type: "OP",
580
+ value: e
581
+ }));
582
+ }
583
+ return t;
584
+ }
585
+ static evaluateSimpleValue(e, t) {
586
+ return e === "true" ? !0 : e === "false" ? !1 : isNaN(Number(e)) ? e.startsWith("ctx.") ? h(t, e.slice(4)) : e.startsWith("\"") && e.endsWith("\"") || e.startsWith("'") && e.endsWith("'") ? e.slice(1, -1) : e : Number(e);
587
+ }
588
+ static clearCache() {
589
+ this.cache.clear();
590
+ }
591
+ static getCacheSize() {
592
+ return this.cache.size;
593
+ }
594
+ };
595
+ //#endregion
596
+ //#region src/lib/runtime/vdom-model-helpers.ts
597
+ function j(e, t) {
598
+ return Array.isArray(e) && Array.isArray(t) ? JSON.stringify([...e].sort()) !== JSON.stringify([...t].sort()) : e !== t;
599
+ }
600
+ function _e(e, t, n, r, i) {
601
+ if (e) {
602
+ let e = t.value;
603
+ if (i && typeof e == "object" && e) {
604
+ let r = { ...e };
605
+ r[i] = n, t.value = r;
606
+ } else t.value = n;
607
+ } else p(r._state || r, t, n);
608
+ }
609
+ function M(e, t, n, r) {
610
+ if (typeof e._requestRender == "function" && e._requestRender(), typeof e._triggerWatchers == "function") {
611
+ let i = t ? "reactiveState" : n;
612
+ e._triggerWatchers(i, r);
613
+ }
614
+ }
615
+ function ve(e, t, n) {
616
+ let r = `update:${y(t)}`, i = `update:${t}`, a = new CustomEvent(r, {
617
+ detail: n,
618
+ bubbles: !0,
619
+ cancelable: !0
620
+ }), o = new CustomEvent(i, {
621
+ detail: n,
622
+ bubbles: !0,
623
+ cancelable: !0
624
+ });
625
+ e.dispatchEvent(a), e.dispatchEvent(o);
626
+ }
627
+ function ye(e, t, n, i) {
628
+ let a = n;
629
+ if (g(() => {
630
+ if (typeof e.setAttribute == "function") try {
631
+ e[t] = a;
632
+ } catch {}
633
+ else e[t] = a;
634
+ }), a == null || typeof a == "string" || typeof a == "number" || typeof a == "boolean") {
635
+ let n = b(a);
636
+ g(n === null ? () => {
637
+ typeof e.removeAttribute == "function" && o(e, y(t));
638
+ } : () => {
639
+ typeof e.setAttribute == "function" && r(e, y(t), String(n));
640
+ });
641
+ }
642
+ }
643
+ function be(e, t, n, r) {
644
+ if (e) {
645
+ let e = t.value;
646
+ return r && typeof e == "object" && e ? e[r] : e;
647
+ } else return h(n._state || n, t);
648
+ }
649
+ //#endregion
650
+ //#region src/lib/runtime/vdom-helpers.ts
651
+ function N(e) {
652
+ return typeof e == "object" && !!e && "value" in e;
653
+ }
654
+ function xe(e) {
655
+ return typeof e == "object" && e && "value" in e ? e.value : e;
656
+ }
657
+ function P(e, t, n) {
658
+ if (!e) return;
659
+ e.attrs ||= {};
660
+ let r = e.attrs;
661
+ r[t] = n;
662
+ }
663
+ function F(e) {
664
+ return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement;
665
+ }
666
+ function I(e) {
667
+ return typeof e == "object" && e && "value" in e ? I(e.value) : !(typeof e == "object" && e || e === !1 || e === "false" || e == null || e === 0);
668
+ }
669
+ function Se(e) {
670
+ return e.substring(2, 3).toLowerCase() + e.substring(3);
671
+ }
672
+ function Ce(e) {
673
+ return typeof e == "boolean" || e === "true" || e === "false";
674
+ }
675
+ //#endregion
676
+ //#region src/lib/runtime/vdom-directives.ts
677
+ function we(e, t, n, r, i, a, o, s) {
678
+ if (!a) return;
679
+ let c = t.includes("lazy"), l = t.includes("trim"), u = t.includes("number"), f = () => {
680
+ if (d(e)) {
681
+ let t = e.value;
682
+ return s && o && (o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement) && typeof t == "object" && t ? t[s] : t;
683
+ }
684
+ return h(a?._state || a, e);
685
+ }, m = f(), g = "text";
686
+ o instanceof HTMLInputElement ? g = r?.type || o.type || "text" : o instanceof HTMLSelectElement ? g = "select" : o instanceof HTMLTextAreaElement && (g = "textarea");
687
+ let _ = o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement, v = _ ? g === "checkbox" || g === "radio" ? "checked" : "value" : s ?? "modelValue";
688
+ if (g === "checkbox") Array.isArray(m) ? n[v] = m.includes(String(o?.getAttribute("value") ?? r?.value ?? "")) : n[v] = m === (o?.getAttribute("true-value") ?? !0);
689
+ else if (g === "radio") n[v] = m === (r?.value ?? "");
690
+ else if (g === "select") if (o && o.hasAttribute("multiple") && o instanceof HTMLSelectElement) {
691
+ let e = Array.isArray(m) ? m.map(String) : [];
692
+ queueMicrotask(() => {
693
+ Array.from(o.options).forEach((t) => {
694
+ t.selected = e.includes(t.value);
695
+ });
696
+ }), n[v] = Array.isArray(m) ? m : [];
697
+ } else n[v] = m;
698
+ else if (!_ && d(e)) n[v] = e;
699
+ else {
700
+ n[v] = m;
701
+ try {
702
+ let e = y(v);
703
+ r && (r[e] = m);
704
+ } catch {}
705
+ }
706
+ let b = c || g === "checkbox" || g === "radio" || g === "select" ? "change" : "input", x = (t) => {
707
+ if (t.isComposing || i._isComposing) return;
708
+ let n = globalThis.process, r = !!n && n.env?.NODE_ENV === "test" || typeof window < "u" && globalThis.__vitest__;
709
+ if (t.isTrusted === !1 && !r) return;
710
+ let o = t.target;
711
+ if (!o || o._modelUpdating) return;
712
+ let c = o.value;
713
+ if (g === "checkbox") {
714
+ let e = f();
715
+ if (Array.isArray(e)) {
716
+ let t = o.getAttribute("value") ?? "", n = Array.from(e);
717
+ if (o.checked) n.includes(t) || n.push(t);
718
+ else {
719
+ let e = n.indexOf(t);
720
+ e > -1 && n.splice(e, 1);
721
+ }
722
+ c = n;
723
+ } else {
724
+ let e = o.getAttribute("true-value") ?? !0, t = o.getAttribute("false-value") ?? !1;
725
+ c = o.checked ? e : t;
726
+ }
727
+ } else if (g === "radio") c = o.getAttribute("value") ?? o.value;
728
+ else if (g === "select" && o.multiple) c = Array.from(o.selectedOptions).map((e) => e.value);
729
+ else if (l && typeof c == "string" && (c = c.trim()), u) {
730
+ let e = Number(c);
731
+ isNaN(e) || (c = e);
732
+ }
733
+ let p = f();
734
+ if (j(c, p)) {
735
+ o._modelUpdating = !0;
736
+ try {
737
+ _e(d(e), e, c, a, s), M(a, d(e), e, c), o && ve(o, v, c);
738
+ } finally {
739
+ queueMicrotask(() => o._modelUpdating = !1);
740
+ }
741
+ }
742
+ };
743
+ if (_) {
744
+ if (i[b]) {
745
+ let e = i[b];
746
+ o && A.removeListener(o, b, e);
747
+ }
748
+ i[b] = x;
749
+ } else {
750
+ let t = `update:${y(v)}`, n = `update:${v}`;
751
+ if (i[t]) {
752
+ let e = i[t];
753
+ o && A.removeListener(o, t, e);
754
+ }
755
+ if (i[n]) {
756
+ let e = i[n];
757
+ o && A.removeListener(o, n, e);
758
+ }
759
+ if (i[t] = (t) => {
760
+ let n = t.detail, r = n === void 0 ? void 0 : n;
761
+ if (r === void 0) {
762
+ let e = t.target;
763
+ if (e && typeof e == "object" && "value" in e) try {
764
+ r = e.value;
765
+ } catch {
766
+ r = void 0;
767
+ }
768
+ }
769
+ let i = be(d(e), e, a, s);
770
+ if (j(r, i)) {
771
+ _e(d(e), e, r, a, s), M(a, d(e), e, r);
772
+ let n = t.target;
773
+ n && ye(n, v, d(e) ? e : r, d(e));
774
+ }
775
+ }, d(e) && typeof e.value == "object" && e.value !== null) {
776
+ let r;
777
+ try {
778
+ r = Reflect.ownKeys(e.value);
779
+ } catch {
780
+ r = Object.keys(e.value);
781
+ }
782
+ let s = r.filter((e) => typeof e == "string" && !String(e).startsWith("_") && e !== "constructor"), c = new Set(s.map((e) => `update:${y(e)}`));
783
+ for (let e of Object.keys(i)) e.startsWith("update:") && e !== t && e !== n && !c.has(e) && (o && A.removeListener(o, e, i[e]), delete i[e]);
784
+ for (let n of s) {
785
+ let r = String(n), s = `update:${y(r)}`, c = `update:${r}`;
786
+ s !== t && (i[s] && o && (A.removeListener(o, s, i[s]), delete i[s]), i[s] = (t) => {
787
+ let n = t.detail === void 0 ? t.target?.value : t.detail;
788
+ if (!j(n, d(e) ? e.value[r] : h(a?._state || a, e))) return;
789
+ if (d(e)) {
790
+ let t = { ...e.value };
791
+ t[r] = n, e.value = t;
792
+ } else p(a?._state || a, e, n);
793
+ M(a, d(e), e, n);
794
+ let i = t.currentTarget || o || t.target;
795
+ i && ye(i, v, d(e) ? e : n, d(e));
796
+ }, i[c] = i[s]);
797
+ }
798
+ }
799
+ i[n] = i[t];
800
+ }
801
+ (g === "text" || g === "textarea") && (i.compositionstart = () => i._isComposing = !0, i.compositionend = (t) => {
802
+ i._isComposing = !1;
803
+ let n = t.target;
804
+ n && queueMicrotask(() => {
805
+ let t = n.value, r = a?._state || a, i = h(r, e), o = t;
806
+ if (l && (o = o.trim()), u) {
807
+ let e = Number(o);
808
+ isNaN(e) || (o = e);
809
+ }
810
+ if (j(o, i)) {
811
+ n._modelUpdating = !0;
812
+ try {
813
+ p(r, e, o), M(a, d(e), e, o);
814
+ } finally {
815
+ queueMicrotask(() => n._modelUpdating = !1);
816
+ }
817
+ }
818
+ });
819
+ });
820
+ }
821
+ function Te(e, t, n, r, i) {
822
+ if (typeof e == "object" && e) for (let [r, a] of Object.entries(e)) if (r.startsWith("data-") || r.startsWith("aria-") || r === "class") n[r] = a;
823
+ else if (r === "disabled" && i && F(i)) {
824
+ let e = a && typeof a == "object" && "value" in a;
825
+ (() => {
826
+ try {
827
+ return d(a);
828
+ } catch {
829
+ return !1;
830
+ }
831
+ })() || e ? t[r] = a : n[r] = a;
832
+ } else t[r] = a;
833
+ else if (typeof e == "string") {
834
+ if (!r) return;
835
+ try {
836
+ let a = L(e, r);
837
+ if (typeof a == "object" && a) {
838
+ for (let [e, r] of Object.entries(a)) if (e.startsWith("data-") || e.startsWith("aria-") || e === "class") n[e] = r;
839
+ else if (e === "disabled" && i && F(i)) {
840
+ let i = r && typeof r == "object" && "value" in r;
841
+ (() => {
842
+ try {
843
+ return d(r);
844
+ } catch {
845
+ return !1;
846
+ }
847
+ })() || i ? t[e] = r : n[e] = r;
848
+ } else t[e] = r;
849
+ return;
850
+ } else {
851
+ n[e] = a;
852
+ return;
853
+ }
854
+ } catch {
855
+ n[e] = h(r, e);
856
+ }
857
+ }
858
+ }
859
+ function Ee(e, t, n) {
860
+ let r;
861
+ if (typeof e == "string") {
862
+ if (!n) return;
863
+ r = L(e, n);
864
+ } else r = e;
865
+ let i = String(t.style || ""), a = i;
866
+ if (!r) if (i) {
867
+ let e = String(i).split(";").filter(Boolean), t = e.findIndex((e) => e.trim().startsWith("display:"));
868
+ t >= 0 ? e[t] = "display: none" : e.push("display: none"), a = e.join("; ");
869
+ } else a = "display: none";
870
+ else if (i) {
871
+ let e = String(i).split(";").map((e) => e.trim()).filter(Boolean), t = e.findIndex((e) => e.startsWith("display:"));
872
+ t >= 0 && e[t] === "display: none" && (e.splice(t, 1), a = e.length > 0 ? e.join("; ") + ";" : "");
873
+ }
874
+ a !== i && (a ? t.style = a : t.style = void 0);
875
+ }
876
+ function L(e, t) {
877
+ return ge.evaluate(e, t);
878
+ }
879
+ function De(e, t, n, r) {
880
+ let i;
881
+ if (typeof e == "string") {
882
+ if (!n) return;
883
+ i = L(e, n);
884
+ } else i = e;
885
+ try {
886
+ if (i && typeof i == "object") {
887
+ if (d(i)) i = i.value;
888
+ else if ("value" in i && i.value !== void 0) {
889
+ let e = i.value;
890
+ e instanceof Node || (i = e);
891
+ }
892
+ }
893
+ } catch {}
894
+ let a = [];
895
+ if (typeof i == "string") a = [i];
896
+ else if (Array.isArray(i)) a = i.filter(Boolean);
897
+ else if (typeof i == "object" && i) for (let [e, t] of Object.entries(i)) t && a.push(e);
898
+ let o = a.join(" "), s = r && r.class || t.class || "", c = s ? `${s} ${o}`.trim() : o.trim();
899
+ c ? t.class = c : t.class = void 0;
900
+ }
901
+ function Oe(e, t, n) {
902
+ let r;
903
+ if (typeof e == "string") {
904
+ if (!n) return;
905
+ r = L(e, n);
906
+ } else r = e;
907
+ let i = "";
908
+ if (typeof r == "string") i = r;
909
+ else if (r && typeof r == "object") {
910
+ let e = [];
911
+ for (let [t, n] of Object.entries(r)) if (n != null && n !== "") {
912
+ let r = t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), i = [
913
+ "width",
914
+ "height",
915
+ "top",
916
+ "right",
917
+ "bottom",
918
+ "left",
919
+ "margin",
920
+ "margin-top",
921
+ "margin-right",
922
+ "margin-bottom",
923
+ "margin-left",
924
+ "padding",
925
+ "padding-top",
926
+ "padding-right",
927
+ "padding-bottom",
928
+ "padding-left",
929
+ "font-size",
930
+ "line-height",
931
+ "border-width",
932
+ "border-radius",
933
+ "min-width",
934
+ "max-width",
935
+ "min-height",
936
+ "max-height"
937
+ ], a = String(n);
938
+ typeof n == "number" && i.includes(r) && (a = `${n}px`), e.push(`${r}: ${a}`);
939
+ }
940
+ i = e.join("; ") + (e.length > 0 ? ";" : "");
941
+ }
942
+ let a = String(t.style || "");
943
+ t.style = a + (a && !a.endsWith(";") ? "; " : "") + i;
944
+ }
945
+ function ke(e, t, n) {
946
+ let r = e;
947
+ typeof e == "string" && n && (r = L(e, n)), d(r) ? t.reactiveRef = r : t.ref = r;
948
+ }
949
+ function Ae(e, t, n, r) {
950
+ let i = {}, a = { ...r || {} }, o = {};
951
+ for (let [s, c] of Object.entries(e)) {
952
+ let { value: e, modifiers: l, arg: u } = c;
953
+ if (s === "model" || s.startsWith("model:")) {
954
+ let r = s.split(":");
955
+ we(e, l, i, a, o, t, n, r.length > 1 ? r[1] : u);
956
+ continue;
957
+ }
958
+ switch (s) {
959
+ case "bind":
960
+ Te(e, i, a, t, n);
961
+ break;
962
+ case "show":
963
+ Ee(e, a, t);
964
+ break;
965
+ case "class":
966
+ De(e, a, t, r);
967
+ break;
968
+ case "style":
969
+ Oe(e, a, t);
970
+ break;
971
+ case "ref":
972
+ ke(e, i, t);
973
+ break;
974
+ case "when": break;
975
+ }
976
+ }
977
+ try {
978
+ if (Object.prototype.hasOwnProperty.call(i, "disabled") && n && F(n)) {
979
+ let e = i.disabled, t = e && typeof e == "object" && "value" in e, n = !1;
980
+ try {
981
+ n = d(e);
982
+ } catch {
983
+ n = !1;
984
+ }
985
+ !t && !n && (a.disabled = e, delete i.disabled);
986
+ }
987
+ } catch {}
988
+ return {
989
+ props: i,
990
+ attrs: a,
991
+ listeners: o
992
+ };
993
+ }
994
+ //#endregion
995
+ //#region src/lib/runtime/transition-utils.ts
996
+ function R(e) {
997
+ return e ? e.split(/\s+/).filter(Boolean) : [];
998
+ }
999
+ function z(e, t) {
1000
+ if (t.length === 0) return;
1001
+ let n = t.filter((t) => t && !e.classList.contains(t));
1002
+ n.length > 0 && e.classList.add(...n);
1003
+ }
1004
+ function B(e, t) {
1005
+ if (t.length === 0) return;
1006
+ let n = t.filter(Boolean);
1007
+ n.length > 0 && e.classList.remove(...n);
1008
+ }
1009
+ function je(e) {
1010
+ let t = window.getComputedStyle(e), n = t.transitionDuration || "0s", r = t.transitionDelay || "0s", i = (e) => {
1011
+ let t = parseFloat(e);
1012
+ return e.includes("ms") ? t : t * 1e3;
1013
+ };
1014
+ return i(n) + i(r);
1015
+ }
1016
+ function Me(e, t) {
1017
+ return new Promise((n) => {
1018
+ let r = t ?? je(e);
1019
+ if (r <= 0) {
1020
+ n();
1021
+ return;
1022
+ }
1023
+ let i = !1, a = () => {
1024
+ i || (i = !0, e.removeEventListener("transitionend", o), e.removeEventListener("transitioncancel", o), n());
1025
+ }, o = () => a();
1026
+ e.addEventListener("transitionend", o), e.addEventListener("transitioncancel", o), setTimeout(a, r + 50);
1027
+ });
1028
+ }
1029
+ async function V(e, n) {
1030
+ let { classes: r, hooks: i, css: a, duration: o } = n;
1031
+ if (i?.onBeforeEnter) try {
1032
+ i.onBeforeEnter(e);
1033
+ } catch (e) {
1034
+ t("Transition onBeforeEnter error:", e);
1035
+ }
1036
+ if (!a) return i?.onEnter ? new Promise((n) => {
1037
+ let r = i.onEnter;
1038
+ typeof r == "function" ? r(e, () => {
1039
+ if (i?.onAfterEnter) try {
1040
+ i.onAfterEnter(e);
1041
+ } catch (e) {
1042
+ t("Transition onAfterEnter error:", e);
1043
+ }
1044
+ n();
1045
+ }) : n();
1046
+ }) : void 0;
1047
+ let s = R(r?.enterFrom), c = R(r?.enterActive), l = R(r?.enterTo);
1048
+ z(e, s), e.offsetHeight, z(e, c), e.offsetHeight;
1049
+ let u;
1050
+ if (i?.onEnter) {
1051
+ let n = new Promise((e) => {
1052
+ u = e;
1053
+ });
1054
+ try {
1055
+ let t = i.onEnter;
1056
+ typeof t == "function" && t(e, () => {
1057
+ u && u();
1058
+ });
1059
+ } catch (e) {
1060
+ t("Transition onEnter error:", e);
1061
+ }
1062
+ u && await n;
1063
+ }
1064
+ await new Promise((e) => requestAnimationFrame(() => e())), e.offsetHeight, B(e, s), z(e, l), e.offsetHeight, await new Promise((e) => requestAnimationFrame(() => e()));
1065
+ let d;
1066
+ if (typeof o == "number" ? d = o : o && typeof o == "object" && "enter" in o && (d = o.enter), await Me(e, d), B(e, c), i?.onAfterEnter) try {
1067
+ i.onAfterEnter(e);
1068
+ } catch (e) {
1069
+ t("Transition onAfterEnter error:", e);
1070
+ }
1071
+ }
1072
+ async function Ne(e, n) {
1073
+ let { classes: r, hooks: i, css: a, duration: o } = n;
1074
+ if (i?.onBeforeLeave) try {
1075
+ i.onBeforeLeave(e);
1076
+ } catch (e) {
1077
+ t("Transition onBeforeLeave error:", e);
1078
+ }
1079
+ if (!a) return i?.onLeave ? new Promise((n) => {
1080
+ let r = i.onLeave;
1081
+ typeof r == "function" ? r(e, () => {
1082
+ if (i?.onAfterLeave) try {
1083
+ i.onAfterLeave(e);
1084
+ } catch (e) {
1085
+ t("Transition onAfterLeave error:", e);
1086
+ }
1087
+ n();
1088
+ }) : n();
1089
+ }) : void 0;
1090
+ let s = R(r?.leaveFrom), c = R(r?.leaveActive), l = R(r?.leaveTo);
1091
+ z(e, s), e.offsetHeight, z(e, c);
1092
+ let u;
1093
+ if (i?.onLeave) {
1094
+ let n = new Promise((e) => {
1095
+ u = e;
1096
+ });
1097
+ try {
1098
+ let t = i.onLeave;
1099
+ typeof t == "function" && t(e, () => {
1100
+ u && u();
1101
+ });
1102
+ } catch (e) {
1103
+ t("Transition onLeave error:", e);
1104
+ }
1105
+ u && await n;
1106
+ }
1107
+ await new Promise((e) => requestAnimationFrame(() => e())), B(e, s), z(e, l);
1108
+ let d;
1109
+ if (typeof o == "number" ? d = o : o && typeof o == "object" && "leave" in o && (d = o.leave), await Me(e, d), B(e, c), B(e, l), B(e, s), i?.onAfterLeave) try {
1110
+ i.onAfterLeave(e);
1111
+ } catch (e) {
1112
+ t("Transition onAfterLeave error:", e);
1113
+ }
1114
+ }
1115
+ //#endregion
1116
+ //#region src/lib/runtime/node-metadata.ts
1117
+ var Pe = /* @__PURE__ */ new WeakMap(), Fe = /* @__PURE__ */ new WeakMap();
1118
+ function H(e) {
1119
+ if (!e) return;
1120
+ let t = Pe.get(e);
1121
+ if (t !== void 0) return t;
1122
+ try {
1123
+ let t = e;
1124
+ if (t && t.key != null) return String(t.key);
1125
+ } catch {}
1126
+ if (e instanceof Element) {
1127
+ let t = e.getAttribute("data-anchor-key");
1128
+ if (t) return t;
1129
+ }
1130
+ }
1131
+ function U(e, t) {
1132
+ try {
1133
+ Pe.set(e, t);
1134
+ } catch {}
1135
+ try {
1136
+ e.key = t;
1137
+ } catch {}
1138
+ try {
1139
+ if (e instanceof Element) {
1140
+ let n = b(t);
1141
+ n !== null && r(e, "data-anchor-key", n);
1142
+ }
1143
+ } catch {}
1144
+ }
1145
+ function Ie(e) {
1146
+ if (!e) return;
1147
+ let t = Fe.get(e);
1148
+ if (t !== void 0) return t;
1149
+ try {
1150
+ let t = e;
1151
+ if (t && t._transitionGroup != null) return t._transitionGroup;
1152
+ } catch {}
1153
+ }
1154
+ function Le(e, t) {
1155
+ try {
1156
+ Fe.set(e, t);
1157
+ } catch {}
1158
+ try {
1159
+ e._transitionGroup = t;
1160
+ } catch {}
1161
+ }
1162
+ //#endregion
1163
+ //#region src/lib/runtime/vdom-patch.ts
1164
+ var W = /* @__PURE__ */ new WeakMap();
1165
+ function G(e, t) {
1166
+ if (t) {
1167
+ if (e instanceof Element) {
1168
+ A.cleanup(e);
1169
+ let n = [];
1170
+ for (let r in t) t[r] === e && n.push(r);
1171
+ for (let e of n) delete t[e];
1172
+ }
1173
+ if (e.hasChildNodes()) {
1174
+ let n = e.childNodes;
1175
+ for (let e = n.length - 1; e >= 0; e--) G(n[e], t);
1176
+ }
1177
+ }
1178
+ }
1179
+ function K(e, t, n) {
1180
+ if (typeof e == "string") return;
1181
+ let r = e.props?.reactiveRef ?? (e.props?.props && e.props.props.reactiveRef), i = e.props?.ref ?? (e.props?.props && e.props.props.ref);
1182
+ if (r) try {
1183
+ if (d(r) || typeof r == "object" && "value" in r) r.value = t;
1184
+ else if (typeof r == "function") r(t);
1185
+ else if (typeof r == "string" && n) try {
1186
+ let e = String(r);
1187
+ n[e] = t;
1188
+ } catch {}
1189
+ } catch {}
1190
+ else if (i && n) try {
1191
+ let e = String(i);
1192
+ n[e] = t;
1193
+ } catch {}
1194
+ }
1195
+ function Re(e, t) {
1196
+ if (Array.isArray(e)) {
1197
+ let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
1198
+ return e.map((e) => {
1199
+ if (!e || typeof e != "object") return e;
1200
+ let i = e.props?.key ?? e.key;
1201
+ if (!i) {
1202
+ let n = e.tag || "node", r = [
1203
+ e.props?.attrs?.id,
1204
+ e.props?.attrs?.name,
1205
+ e.props?.attrs?.["data-key"],
1206
+ e.props?.props?.id,
1207
+ e.props?.props?.name,
1208
+ e.props?.props?.dataKey,
1209
+ e.props?.props?.["data-key"]
1210
+ ].find((e) => e != null) ?? "";
1211
+ i = r ? `${t}:${n}:${r}` : `${t}:${n}`;
1212
+ }
1213
+ let a = i;
1214
+ if (n.has(a)) {
1215
+ let e = (r.get(a) ?? 1) + 1;
1216
+ r.set(a, e), a = `${i}#${e}`;
1217
+ }
1218
+ r.set(i, (r.get(i) ?? 0) + 1), n.add(a);
1219
+ let o = e.children;
1220
+ return Array.isArray(o) && (o = Re(o, a)), {
1221
+ ...e,
1222
+ key: a,
1223
+ children: o
1224
+ };
1225
+ });
1226
+ }
1227
+ let n = e, r = n.props?.key ?? n.key ?? t, i = n.children;
1228
+ return Array.isArray(i) && (i = Re(i, r)), {
1229
+ ...n,
1230
+ key: r,
1231
+ children: i
1232
+ };
1233
+ }
1234
+ function ze(e, t, n, i) {
1235
+ let a = n.directives ?? {}, s = n.attrs ? { ...n.attrs } : {}, c = Ae(a, i, e, s), l = {
1236
+ ...t.props || {},
1237
+ ...n.props || {},
1238
+ ...c.props || {}
1239
+ }, u = {
1240
+ ...s || {},
1241
+ ...c.attrs || {}
1242
+ }, p = t.props ?? {}, h = l, _ = !!(n?.isCustomElement ?? t?.isCustomElement ?? !1), v = !1, y = /* @__PURE__ */ new Set();
1243
+ for (let e in p) y.add(e);
1244
+ for (let e in h) y.add(e);
1245
+ for (let r of y) {
1246
+ let i = p[r], a = h[r], s = i, c = a;
1247
+ if (g(() => {
1248
+ d(i) ? s = i.peek() : N(i) && (s = i.value);
1249
+ }), g(() => {
1250
+ d(a) ? c = a.peek() : N(a) && (c = a.value);
1251
+ }), !(i === a && s === c)) if (v = !0, r === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement)) {
1252
+ let t = xe(a), n = t == null ? "" : String(t);
1253
+ e.value !== n && (e.value = n);
1254
+ } else if (r === "checked" && e instanceof HTMLInputElement) e.checked = !!xe(a);
1255
+ else if (r.startsWith("on") && typeof a == "function") {
1256
+ let t = Se(r);
1257
+ typeof i == "function" && A.removeListener(e, t, i), typeof a == "function" && A.addListener(e, t, a);
1258
+ try {
1259
+ if (t && t.startsWith("update:")) {
1260
+ let n = t.split(":", 2)[1], r = h[n], i = [];
1261
+ try {
1262
+ if (d(r)) {
1263
+ let e = r.value;
1264
+ i = e && typeof e == "object" ? Object.keys(e) : [];
1265
+ } else r && typeof r == "object" && (i = Object.keys(r));
1266
+ } catch {
1267
+ i = [];
1268
+ }
1269
+ let o = i.filter((e) => typeof e == "string" && !e.startsWith("_") && e !== "constructor");
1270
+ for (let t of o) {
1271
+ let i = `update:${t}`, o = (e) => {
1272
+ let i = e.detail === void 0 ? e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLSelectElement ? e.target.value : void 0 : e.detail, o = {
1273
+ ...d(r) ? r.value || {} : h[n] || {},
1274
+ [t]: i
1275
+ };
1276
+ try {
1277
+ typeof a == "function" && a({ detail: o });
1278
+ } catch {}
1279
+ };
1280
+ g(() => {
1281
+ A.addListener(e, i, o);
1282
+ });
1283
+ }
1284
+ }
1285
+ } catch {}
1286
+ } else if (a == null) o(e, r);
1287
+ else {
1288
+ let i = n?.isCustomElement ?? t?.isCustomElement ?? !1;
1289
+ if (i || r in e) try {
1290
+ e[r] = a, r === "disabled" && a === !1 && !i && F(e) && o(e, "disabled");
1291
+ } catch {}
1292
+ else a === !1 && o(e, r);
1293
+ }
1294
+ }
1295
+ let x = c.listeners ?? {}, S = W.get(e) ?? {};
1296
+ for (let [t, n] of Object.entries(S)) A.removeListener(e, t, n);
1297
+ for (let [t, n] of Object.entries(x)) A.addListener(e, t, n);
1298
+ Object.keys(x).length > 0 ? W.set(e, x) : W.delete(e);
1299
+ let C = { ...t.attrs ?? {} }, w = u, T = c && c.attrs || {};
1300
+ if (Object.prototype.hasOwnProperty.call(T, "class") && typeof e.getAttribute == "function") {
1301
+ let t = e.getAttribute("class");
1302
+ t !== null && (C.class = t);
1303
+ }
1304
+ if (Object.prototype.hasOwnProperty.call(T, "style") && typeof e.getAttribute == "function") {
1305
+ let t = e.getAttribute("style");
1306
+ t !== null && (C.style = t);
1307
+ }
1308
+ try {
1309
+ if (Object.prototype.hasOwnProperty.call(T, "class") && T.class === void 0 && typeof e.getAttribute == "function") {
1310
+ let t = e.getAttribute("class");
1311
+ t !== null && (C.class = t);
1312
+ }
1313
+ if (Object.prototype.hasOwnProperty.call(T, "style") && T.style === void 0 && typeof e.getAttribute == "function") {
1314
+ let t = e.getAttribute("style");
1315
+ t !== null && (C.style = t);
1316
+ }
1317
+ try {
1318
+ if (typeof e.getAttribute == "function") {
1319
+ let t = e.getAttribute("class");
1320
+ try {
1321
+ e instanceof HTMLInputElement && e.type === "text" && t !== null && t !== C.class && (C.class = t);
1322
+ } catch {}
1323
+ }
1324
+ } catch {}
1325
+ } catch {}
1326
+ for (let n in {
1327
+ ...C,
1328
+ ...w
1329
+ }) {
1330
+ let i = C[n], a = w[n], s = i, c = a;
1331
+ if (d(i) && (s = i.peek()), d(a) && (c = a.peek()), s !== c) if (v = !0, c == null || c === !1) g(() => {
1332
+ o(e, n);
1333
+ }), P(t, n, void 0), n === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? g(() => {
1334
+ e.value = "";
1335
+ }) : e instanceof HTMLProgressElement && g(() => {
1336
+ e.value = 0;
1337
+ })), n === "checked" && e instanceof HTMLInputElement && g(() => {
1338
+ e.checked = !1;
1339
+ }), n === "disabled" && F(e) && g(() => {
1340
+ (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement) && (e.disabled = !1);
1341
+ });
1342
+ else {
1343
+ if (n === "value") {
1344
+ if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) {
1345
+ g(() => {
1346
+ e.value = c ?? "";
1347
+ });
1348
+ continue;
1349
+ } else if (e instanceof HTMLSelectElement) {
1350
+ g(() => {
1351
+ e.value = c ?? "";
1352
+ });
1353
+ continue;
1354
+ } else if (e instanceof HTMLProgressElement) {
1355
+ g(() => {
1356
+ e.value = Number(c);
1357
+ });
1358
+ continue;
1359
+ }
1360
+ }
1361
+ if (n === "checked" && e instanceof HTMLInputElement) {
1362
+ g(() => {
1363
+ e.checked = !!c;
1364
+ });
1365
+ continue;
1366
+ }
1367
+ if (n === "style") {
1368
+ let i = b(c);
1369
+ i !== null && r(e, n, String(i)), P(t, n, c);
1370
+ continue;
1371
+ }
1372
+ if (n === "class") {
1373
+ let i = b(c);
1374
+ i !== null && r(e, n, String(i)), P(t, n, c);
1375
+ continue;
1376
+ }
1377
+ if (n === "disabled" && F(e)) {
1378
+ g(() => {
1379
+ let t = I(c);
1380
+ (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement) && (e.disabled = t);
1381
+ }), I(c) ? g(() => {
1382
+ r(e, n, "");
1383
+ }) : g(() => {
1384
+ o(e, n);
1385
+ });
1386
+ continue;
1387
+ }
1388
+ let i = e.namespaceURI === "http://www.w3.org/2000/svg";
1389
+ if (_ && !i && n.includes("-")) if (f(n)) {
1390
+ let i = b(a ?? c);
1391
+ if (i !== null) {
1392
+ try {
1393
+ r(e, n, String(i));
1394
+ } catch {}
1395
+ P(t, n, c);
1396
+ }
1397
+ } else {
1398
+ let i = m(n);
1399
+ try {
1400
+ let r = e;
1401
+ r[i] = d(a) ? a : c, P(t, n, c);
1402
+ } catch {
1403
+ let t = b(a ?? c);
1404
+ t !== null && r(e, n, String(t));
1405
+ }
1406
+ }
1407
+ else if (!i && n in e) try {
1408
+ let r = e;
1409
+ r[n] = d(a) ? a : c, P(t, n, c);
1410
+ } catch {
1411
+ let i = b(c);
1412
+ i !== null && (r(e, n, String(i)), P(t, n, c));
1413
+ }
1414
+ else {
1415
+ let i = b(c);
1416
+ i !== null && (r(e, n, String(i)), P(t, n, c));
1417
+ }
1418
+ }
1419
+ }
1420
+ try {
1421
+ if (F(e)) {
1422
+ let t = l.disabled, n;
1423
+ try {
1424
+ let e = Object.prototype.hasOwnProperty.call(c.props || {}, "disabled"), r = t && typeof t == "object" && "value" in t, i = !1;
1425
+ g(() => {
1426
+ i = !!d(t);
1427
+ });
1428
+ let a = Ce(t);
1429
+ n = i || r || e || a ? t : u.disabled;
1430
+ } catch {
1431
+ n = u.disabled;
1432
+ }
1433
+ let i = I(n);
1434
+ g(() => {
1435
+ (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement) && (e.disabled = i);
1436
+ }), g(i ? () => {
1437
+ r(e, "disabled", "");
1438
+ } : () => {
1439
+ o(e, "disabled");
1440
+ });
1441
+ }
1442
+ } catch {}
1443
+ if (_ && v) {
1444
+ let t = e;
1445
+ g(() => {
1446
+ t._applyProps?.(t._cfg);
1447
+ }), g(() => {
1448
+ typeof t.requestRender == "function" ? t.requestRender() : typeof t._render == "function" && t._render?.(t._cfg);
1449
+ });
1450
+ }
1451
+ }
1452
+ function q(t, n, a, s = null) {
1453
+ if (typeof t == "string") return document.createTextNode(t);
1454
+ if (t.tag === "#text") {
1455
+ let e = document.createTextNode(typeof t.children == "string" ? t.children : "");
1456
+ return t.key != null && U(e, t.key), e;
1457
+ }
1458
+ if (t.tag === "#raw") {
1459
+ let n = typeof t.children == "string" ? t.children : "";
1460
+ return e("[#raw] Inserting unsanitized HTML. Ensure the content is trusted or sanitized before use — unsanitized input can lead to XSS vulnerabilities."), document.createRange().createContextualFragment(n);
1461
+ }
1462
+ if (t.tag === "#anchor") {
1463
+ let e = t, r = Array.isArray(e.children) ? e.children : [], i = document.createTextNode(""), o = document.createTextNode("");
1464
+ e.key != null && (U(i, `${e.key}:start`), U(o, `${e.key}:end`)), e._startNode = i, e._endNode = o;
1465
+ let c = document.createDocumentFragment();
1466
+ c.appendChild(i);
1467
+ for (let t of r) {
1468
+ let r = q(t, n, a, s);
1469
+ if (e.key != null && r instanceof Element && !r.hasAttribute("data-anchor-key")) {
1470
+ let n = t;
1471
+ n && typeof n == "object" && n.key != null || U(r, String(e.key));
1472
+ }
1473
+ c.appendChild(r);
1474
+ }
1475
+ return c.appendChild(o), c;
1476
+ }
1477
+ let c = t && typeof t == "object" && t.props && t.props.attrs ? t.props.attrs : void 0, l = (c && typeof c.xmlns == "string" ? String(c.xmlns) : void 0) ?? s ?? i[t.tag] ?? null, u = l ? document.createElementNS(l, t.tag) : document.createElement(t.tag);
1478
+ t.key != null && U(u, t.key), t.props && t.props?._transitionGroup && Le(u, t.props?._transitionGroup);
1479
+ let { props: f = {}, attrs: p = {}, directives: h = {} } = t.props ?? {}, _ = Ae(h, n, u instanceof HTMLElement ? u : void 0, p), v = {
1480
+ ...f,
1481
+ ..._.props
1482
+ }, y = {
1483
+ ...p,
1484
+ ..._.attrs
1485
+ };
1486
+ try {
1487
+ let e = b((y && y.class) ?? (v && v.class) ?? (t.props && t.props.attrs && t.props.attrs.class) ?? (t.props && t.props.props && t.props.props.class));
1488
+ if (e !== null) {
1489
+ let t = String(e).trim();
1490
+ t && r(u, "class", t);
1491
+ }
1492
+ } catch {}
1493
+ try {
1494
+ if (v.disabled !== void 0 && u && F(u)) {
1495
+ let e = v.disabled, t = e && typeof e == "object" && "value" in e, n = !1;
1496
+ try {
1497
+ n = d(e);
1498
+ } catch {
1499
+ n = !1;
1500
+ }
1501
+ !t && !n && g(() => {
1502
+ y.disabled = e, delete v.disabled;
1503
+ });
1504
+ }
1505
+ } catch {}
1506
+ let x = u.namespaceURI === "http://www.w3.org/2000/svg";
1507
+ for (let e in y) {
1508
+ let n = y[e];
1509
+ if (typeof e != "string" || /\[object Object\]/.test(e)) continue;
1510
+ let i = xe(n);
1511
+ if (typeof i == "boolean") i ? r(u, e, "") : g(() => {
1512
+ o(u, e);
1513
+ });
1514
+ else if (i != null) {
1515
+ if (e === "disabled" && F(u)) {
1516
+ let t = v.disabled, n = I(Ce(t) ? t : i);
1517
+ g(() => {
1518
+ u.disabled = n;
1519
+ }), g(n ? () => {
1520
+ r(u, e, "");
1521
+ } : () => {
1522
+ o(u, e);
1523
+ });
1524
+ continue;
1525
+ }
1526
+ if (!x && e === "value" && (u instanceof HTMLInputElement || u instanceof HTMLTextAreaElement || u instanceof HTMLSelectElement || u instanceof HTMLProgressElement)) try {
1527
+ u instanceof HTMLProgressElement ? u.value = Number(i) : u.value = String(i ?? "");
1528
+ } catch {
1529
+ let t = b(i);
1530
+ t !== null && r(u, e, String(t));
1531
+ }
1532
+ else if (!x && e === "checked" && u instanceof HTMLInputElement) try {
1533
+ u.checked = !!i;
1534
+ } catch {
1535
+ let t = b(i);
1536
+ t !== null && r(u, e, String(t));
1537
+ }
1538
+ else if (!x && e in u) try {
1539
+ u[e] = i, e === "disabled" && i === !1 && F(u) && o(u, "disabled"), P(t.props, e, i);
1540
+ } catch {
1541
+ let t = b(i);
1542
+ t !== null && r(u, e, String(t));
1543
+ }
1544
+ else if ((t.props?.isCustomElement ?? !1) && !x && e.includes("-")) {
1545
+ let t = m(e);
1546
+ try {
1547
+ u[t] = i;
1548
+ } catch {
1549
+ let t = b(i);
1550
+ t !== null && r(u, e, String(t));
1551
+ }
1552
+ } else {
1553
+ let t = b(i);
1554
+ t !== null && r(u, e, String(t));
1555
+ }
1556
+ }
1557
+ }
1558
+ for (let e in v) {
1559
+ let n = v[e];
1560
+ if (!(typeof e != "string" || /\[object Object\]/.test(e))) if (e === "value" && (u instanceof HTMLInputElement || u instanceof HTMLTextAreaElement || u instanceof HTMLSelectElement)) {
1561
+ let e = typeof n == "object" && n && N(n) ? n.value : n;
1562
+ g(() => {
1563
+ u.value = String(e ?? "");
1564
+ });
1565
+ } else if (e.startsWith("on") && typeof n == "function") {
1566
+ let t = Se(e), r = t.includes(":") ? (() => {
1567
+ let e = t.split(":"), n = e[1];
1568
+ if (n.includes("-")) {
1569
+ let t = n.split("-").map((e, t) => t === 0 ? e : e.charAt(0).toUpperCase() + e.slice(1)).join("");
1570
+ return `${e[0]}:${t}`;
1571
+ } else {
1572
+ let t = n.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1573
+ return `${e[0]}:${t}`;
1574
+ }
1575
+ })() : t;
1576
+ _.listeners && (_.listeners[t] || _.listeners[r]) || A.addListener(u, t, n);
1577
+ } else if (e.startsWith("on") && n === void 0) continue;
1578
+ else if (n == null || n === !1) o(u, e);
1579
+ else {
1580
+ let i = t.props?.isCustomElement ?? !1, a = typeof n == "object" && n && d(n) ? n : N(n) && n.value !== void 0 ? n.value : n;
1581
+ if (e === "class" || e === "style") {
1582
+ try {
1583
+ let t = b(a);
1584
+ t !== null && r(u, e, String(t));
1585
+ } catch {}
1586
+ continue;
1587
+ }
1588
+ if (i || e in u) try {
1589
+ let t = typeof n == "object" && n && d(n) ? n : N(n) ? n.value : n;
1590
+ if (e === "disabled" && F(u)) {
1591
+ let n = I(v.disabled === void 0 ? t : v.disabled);
1592
+ g(() => {
1593
+ u.disabled = n;
1594
+ }), g(n ? () => {
1595
+ r(u, e, "");
1596
+ } : () => {
1597
+ o(u, e);
1598
+ });
1599
+ continue;
1600
+ }
1601
+ try {
1602
+ if (typeof u[e] == "boolean") {
1603
+ let n = t;
1604
+ n = typeof t == "string" ? t === "false" ? !1 : t === "true" ? !0 : !!t && t !== "" : !!t, u[e] = n;
1605
+ } else u[e] = t;
1606
+ } catch {
1607
+ u[e] = t;
1608
+ }
1609
+ } catch {}
1610
+ }
1611
+ }
1612
+ let S = _.listeners ?? {};
1613
+ for (let [e, t] of Object.entries(S)) A.addListener(u, e, t);
1614
+ Object.keys(S).length > 0 && W.set(u, S), K({
1615
+ ...t,
1616
+ props: {
1617
+ ...t.props,
1618
+ ..._.props
1619
+ }
1620
+ }, u, a);
1621
+ try {
1622
+ let e = u;
1623
+ if (typeof e._applyProps == "function") try {
1624
+ e._applyProps(e._cfg);
1625
+ } catch {}
1626
+ typeof e.requestRender == "function" ? e.requestRender() : typeof e._render == "function" && e._render(e._cfg);
1627
+ } catch {}
1628
+ if (Array.isArray(t.children)) {
1629
+ let e = t.tag === "foreignObject" && l === "http://www.w3.org/2000/svg" ? null : u.namespaceURI ?? null;
1630
+ for (let r of t.children) u.appendChild(q(r, n, a, e));
1631
+ } else typeof t.children == "string" && (u.textContent = t.children);
1632
+ try {
1633
+ if (u instanceof HTMLSelectElement && y && Object.prototype.hasOwnProperty.call(y, "value")) try {
1634
+ u.value = String(y.value ?? "");
1635
+ } catch {}
1636
+ } catch {}
1637
+ try {
1638
+ if (F(u)) {
1639
+ let e = v.disabled, t = y.disabled, n = e && typeof e == "object" && "value" in e, i = !1;
1640
+ try {
1641
+ i = !!d(e);
1642
+ } catch {
1643
+ i = !1;
1644
+ }
1645
+ let a = I(i || n || Ce(e) ? e : t);
1646
+ g(() => {
1647
+ u.disabled = a;
1648
+ }), g(a ? () => {
1649
+ r(u, "disabled", "");
1650
+ } : () => {
1651
+ o(u, "disabled");
1652
+ });
1653
+ }
1654
+ } catch {}
1655
+ return u;
1656
+ }
1657
+ function Be(e, n, r, i, a) {
1658
+ if (typeof r == "string") {
1659
+ e.textContent !== r && (e.textContent = r);
1660
+ return;
1661
+ }
1662
+ if (!Array.isArray(r)) return;
1663
+ let o = e.childNodes, s = [];
1664
+ for (let e = 0; e < o.length; e++) s.push(o[e]);
1665
+ let c = Array.isArray(n) ? n : [], l = Ie(e);
1666
+ if (l) {
1667
+ let n = (e) => {
1668
+ if (typeof e == "string") return e.startsWith("each-") ? e.substring(5) : e;
1669
+ if (typeof e == "number") return String(e);
1670
+ }, a = [], o = [];
1671
+ for (let e of r) if (e && e.tag === "#anchor") {
1672
+ let t = Array.isArray(e.children) ? e.children : [];
1673
+ for (let r of t) {
1674
+ let t = n(r.key ?? e.key ?? "unknown");
1675
+ a.push({
1676
+ ...r,
1677
+ key: t
1678
+ });
1679
+ }
1680
+ } else e && a.push({
1681
+ ...e,
1682
+ key: n(e.key)
1683
+ });
1684
+ for (let e of c) if (e && e.tag === "#anchor") {
1685
+ let t = Array.isArray(e.children) ? e.children : [];
1686
+ for (let r of t) {
1687
+ let t = n(r.key ?? e.key ?? "unknown");
1688
+ o.push({
1689
+ ...r,
1690
+ key: t
1691
+ });
1692
+ }
1693
+ } else e && o.push({
1694
+ ...e,
1695
+ key: n(e.key)
1696
+ });
1697
+ if (a.some((e) => e && e.key != null) || o.some((e) => e && e.key != null)) {
1698
+ let r = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
1699
+ for (let e of o) if (e && e.key != null) {
1700
+ let t = String(e.key);
1701
+ r.set(t, e);
1702
+ }
1703
+ for (let e = 0; e < s.length; e++) {
1704
+ let t = s[e], r = H(t);
1705
+ if (r = n(r), r != null && t instanceof Element && t.nodeType === Node.ELEMENT_NODE) {
1706
+ let e = typeof r == "string" && r.includes(":") ? r.substring(0, r.lastIndexOf(":")) : r;
1707
+ e = String(e), c.set(e, t);
1708
+ }
1709
+ }
1710
+ let u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Map(), f = s.length > 0;
1711
+ if (l.moveClass && f) for (let e = 0; e < s.length; e++) {
1712
+ let t = s[e];
1713
+ if (t instanceof HTMLElement && t.parentElement) {
1714
+ let e = t.getBoundingClientRect();
1715
+ d.set(t, e);
1716
+ }
1717
+ }
1718
+ let p = [];
1719
+ for (let n of a) {
1720
+ let a = n.key;
1721
+ if (a == null) continue;
1722
+ a = String(a);
1723
+ let o = r.get(a), s = c.get(a);
1724
+ if (s && o) {
1725
+ let e = J(s, o, n, i);
1726
+ u.add(s), U(e, String(a)), p.push({
1727
+ node: e,
1728
+ key: a,
1729
+ newVNode: n,
1730
+ oldVNode: o,
1731
+ isNew: !1
1732
+ });
1733
+ } else {
1734
+ s = q(n, i, void 0, e instanceof Element ? e.namespaceURI ?? null : null), U(s, String(a)), e.appendChild(s);
1735
+ let r = f || l.appear === !0;
1736
+ s instanceof HTMLElement && r && V(s, l).catch((e) => {
1737
+ t("Enter transition error:", e);
1738
+ }), p.push({
1739
+ node: s,
1740
+ key: a,
1741
+ newVNode: n,
1742
+ isNew: !0
1743
+ });
1744
+ }
1745
+ }
1746
+ let m = [];
1747
+ for (let n = 0; n < s.length; n++) {
1748
+ let r = s[n], i = H(r);
1749
+ if (!u.has(r) && i != null && r instanceof HTMLElement) {
1750
+ let n = Ne(r, l).then(() => {
1751
+ e.contains(r) && e.removeChild(r);
1752
+ }).catch((n) => {
1753
+ t("Leave transition error:", n), e.contains(r) && e.removeChild(r);
1754
+ });
1755
+ m.push(n);
1756
+ }
1757
+ }
1758
+ if (m.length === 0) {
1759
+ let t = e.firstChild;
1760
+ for (let { node: n } of p) n !== t && e.insertBefore(n, t), t = n.nextSibling;
1761
+ if (l.moveClass && d.size > 0) {
1762
+ let t = [];
1763
+ for (let { node: e, isNew: n } of p) if (!n && e instanceof HTMLElement) {
1764
+ let n = d.get(e);
1765
+ if (n) {
1766
+ let r = e.getBoundingClientRect(), i = n.left - r.left, a = n.top - r.top;
1767
+ if (i !== 0 || a !== 0) {
1768
+ let n = l.moveClass.split(/\s+/).filter((e) => e);
1769
+ t.push({
1770
+ node: e,
1771
+ deltaX: i,
1772
+ deltaY: a,
1773
+ moveClasses: n
1774
+ });
1775
+ }
1776
+ }
1777
+ }
1778
+ if (t.length > 0) {
1779
+ for (let { node: e, deltaX: n, deltaY: r } of t) e.style.transform = `translate(${n}px, ${r}px)`, e.style.transitionProperty = "none";
1780
+ e.offsetHeight, requestAnimationFrame(() => {
1781
+ requestAnimationFrame(() => {
1782
+ for (let { node: e, moveClasses: n } of t) for (let t of n) e.classList.add(t);
1783
+ requestAnimationFrame(() => {
1784
+ let e = l.moveClass || "", n = e.match(/duration-(\d+)/), r = n ? `${n[1]}ms` : "300ms", i = e.match(/ease-(out|in|in-out|linear)/), a = i ? `ease-${i[1]}` : "ease-out";
1785
+ for (let { node: e } of t) e.style.transition = `transform ${r} ${a}`;
1786
+ requestAnimationFrame(() => {
1787
+ for (let { node: e, moveClasses: n } of t) {
1788
+ e.style.removeProperty("transform");
1789
+ let t = () => {
1790
+ for (let t of n) e.classList.remove(t);
1791
+ e.style.removeProperty("transition"), e.removeEventListener("transitionend", t), e.removeEventListener("transitioncancel", t);
1792
+ };
1793
+ e.addEventListener("transitionend", t, { once: !0 }), e.addEventListener("transitioncancel", t, { once: !0 });
1794
+ }
1795
+ });
1796
+ });
1797
+ });
1798
+ });
1799
+ }
1800
+ }
1801
+ }
1802
+ return;
1803
+ }
1804
+ }
1805
+ let u = /* @__PURE__ */ new Map();
1806
+ for (let e of c) e && e.key != null && u.set(e.key, e);
1807
+ let d = /* @__PURE__ */ new Map();
1808
+ for (let e = 0; e < s.length; e++) {
1809
+ let t = s[e], n = H(t);
1810
+ n != null && d.set(n, t);
1811
+ }
1812
+ let f = /* @__PURE__ */ new Set(), p = e.firstChild;
1813
+ function m(e, t) {
1814
+ let n = e;
1815
+ for (; n && (f.add(n), n !== t);) n = n.nextSibling;
1816
+ }
1817
+ function h(n, r, a, o, s, c = !0) {
1818
+ let l = [], u = n.nextSibling;
1819
+ for (; u && u !== r;) l.push(u), u = u.nextSibling;
1820
+ let d = Array.isArray(a) ? a : [];
1821
+ if (o.some((e) => e && e.key != null) || d.some((e) => e && e.key != null)) {
1822
+ let r = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
1823
+ for (let e of d) e && e.key != null && r.set(e.key, e);
1824
+ for (let e of l) {
1825
+ let t = H(e);
1826
+ t != null && a.set(t, e);
1827
+ }
1828
+ let u = s && s.state === "visible" && d.length === 0 && o.length > 0, f = /* @__PURE__ */ new Set(), p = n.nextSibling;
1829
+ for (let n of o) {
1830
+ if (typeof n == "object" && n.tag === "#anchor") {
1831
+ let t = n.key, o = `${t}:start`, s = `${t}:end`, c = a.get(o), l = a.get(s), u = Array.isArray(n.children) ? n.children : [], d = r.get(t), m, g;
1832
+ if (c && l && e.contains(c)) m = c, g = l, h(m, g, d?.children, u);
1833
+ else {
1834
+ m = document.createTextNode(""), g = document.createTextNode(""), U(m, o), U(g, s), e.insertBefore(m, p);
1835
+ for (let t of u) {
1836
+ let n = q(t, i, void 0, e instanceof Element ? e.namespaceURI ?? null : null);
1837
+ e.insertBefore(n, p), f.add(n);
1838
+ }
1839
+ e.insertBefore(g, p);
1840
+ }
1841
+ let _ = m;
1842
+ for (; _ && (f.add(_), _ !== g);) _ = _.nextSibling;
1843
+ n._startNode = m, n._endNode = g, p = g.nextSibling;
1844
+ continue;
1845
+ }
1846
+ let o;
1847
+ if (n.key != null && a.has(n.key)) {
1848
+ let c = r.get(n.key);
1849
+ o = J(a.get(n.key), c, n, i), f.add(o), s && o instanceof HTMLElement && u && s.appear && V(o, s).catch((e) => {
1850
+ t("Transition enter error (appear):", e);
1851
+ }), o !== p && e.contains(o) && e.insertBefore(o, p);
1852
+ } else o = q(n, i, void 0, e instanceof Element ? e.namespaceURI ?? null : null), e.insertBefore(o, p), f.add(o), s && o instanceof HTMLElement && c && V(o, s).catch((e) => {
1853
+ t("Transition enter error:", e);
1854
+ });
1855
+ p = o.nextSibling;
1856
+ }
1857
+ for (let n of l) !f.has(n) && e.contains(n) && (s && n instanceof HTMLElement && c ? Ne(n, s).then(() => {
1858
+ e.contains(n) && e.removeChild(n);
1859
+ }).catch((r) => {
1860
+ t("Transition leave error:", r), e.contains(n) && e.removeChild(n);
1861
+ }) : e.removeChild(n));
1862
+ } else {
1863
+ let n = Math.min(d.length, o.length);
1864
+ for (let t = 0; t < n; t++) {
1865
+ let n = d[t], r = o[t], a = J(l[t], n, r, i);
1866
+ a !== l[t] && (e.insertBefore(a, l[t]), e.removeChild(l[t]));
1867
+ }
1868
+ for (let a = n; a < o.length; a++) {
1869
+ let n = q(o[a], i, void 0, e instanceof Element ? e.namespaceURI ?? null : null);
1870
+ e.insertBefore(n, r), s && n instanceof HTMLElement && c && V(n, s).catch((e) => {
1871
+ t("Transition enter error:", e);
1872
+ });
1873
+ }
1874
+ for (let r = n; r < l.length; r++) {
1875
+ let n = l[r];
1876
+ s && n instanceof HTMLElement && c ? Ne(n, s).then(() => {
1877
+ e.contains(n) && e.removeChild(n);
1878
+ }).catch((r) => {
1879
+ t("Transition leave error:", r), e.contains(n) && e.removeChild(n);
1880
+ }) : e.removeChild(n);
1881
+ }
1882
+ }
1883
+ }
1884
+ for (let n of r) {
1885
+ let r;
1886
+ if (n.tag === "#anchor") {
1887
+ let r = n.key, o = `${r}:start`, s = `${r}:end`, c = d.get(o), l = d.get(s), f = Array.isArray(n.children) ? n.children : [];
1888
+ if (c || (c = document.createTextNode(""), U(c, o)), l || (l = document.createTextNode(""), U(l, s)), n._startNode = c, n._endNode = l, !e.contains(c) || !e.contains(l)) {
1889
+ e.insertBefore(c, p);
1890
+ let r = n._transition, o = !(r && r.state === "visible" && f.length > 0) || r.appear;
1891
+ for (let n of f) {
1892
+ let s = q(n, i, a, e instanceof Element ? e.namespaceURI ?? null : null);
1893
+ e.insertBefore(s, p), r && s instanceof HTMLElement && o && V(s, r).catch((e) => {
1894
+ t("Transition enter error:", e);
1895
+ });
1896
+ }
1897
+ e.insertBefore(l, p);
1898
+ } else {
1899
+ let e = n._transition, t = u.get(r)._transition, i = t && t.state !== e?.state, a = e && e.state === "visible" && f.length > 0 && !i, o = i || !a || e?.appear === !0;
1900
+ h(c, l, u.get(r)?.children, f, e, o);
1901
+ }
1902
+ m(c, l), p = l.nextSibling;
1903
+ continue;
1904
+ }
1905
+ if (n.key != null && d.has(n.key)) {
1906
+ let t = u.get(n.key);
1907
+ r = J(d.get(n.key), t, n, i, a), f.add(r), r !== p && e.contains(r) && (p && !e.contains(p) && (p = null), e.insertBefore(r, p));
1908
+ } else r = q(n, i, a, e instanceof Element ? e.namespaceURI ?? null : null), p && !e.contains(p) && (p = null), e.insertBefore(r, p), f.add(r);
1909
+ p = r.nextSibling;
1910
+ }
1911
+ for (let t = 0; t < s.length; t++) {
1912
+ let n = s[t];
1913
+ !f.has(n) && e.contains(n) && (G(n, a), e.removeChild(n));
1914
+ }
1915
+ }
1916
+ function J(e, t, n, r, i) {
1917
+ if (t && typeof t != "string" && t.props?.ref && i && G(e, i), t === n) return e;
1918
+ if (typeof n == "string") {
1919
+ if (e.nodeType === Node.TEXT_NODE) return e.textContent !== n && (e.textContent = n), e;
1920
+ {
1921
+ let t = document.createTextNode(n);
1922
+ return e.parentNode?.replaceChild(t, e), t;
1923
+ }
1924
+ }
1925
+ if (n && typeof n != "string" && n.tag === "#anchor") {
1926
+ let t = n, a = Array.isArray(t.children) ? t.children : [], o = t._startNode ?? document.createTextNode(""), s = t._endNode ?? document.createTextNode("");
1927
+ t.key != null && (U(o, `${t.key}:start`), U(s, `${t.key}:end`)), t._startNode = o, t._endNode = s;
1928
+ let c = document.createDocumentFragment();
1929
+ c.appendChild(o);
1930
+ for (let t of a) {
1931
+ let n = q(t, r, i, e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null);
1932
+ c.appendChild(n);
1933
+ }
1934
+ return c.appendChild(s), e.parentNode?.replaceChild(c, e), o;
1935
+ }
1936
+ if (!n) {
1937
+ G(e, i);
1938
+ let t = document.createComment("removed");
1939
+ return e.parentNode?.replaceChild(t, e), t;
1940
+ }
1941
+ if (!t || typeof t == "string") {
1942
+ G(e, i);
1943
+ let t = q(n, r, i, e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null);
1944
+ return K(n, t, i), e.parentNode?.replaceChild(t, e), t;
1945
+ }
1946
+ if (n.tag === "#anchor") {
1947
+ let t = Array.isArray(n.children) ? n.children : [], a = n._startNode ?? document.createTextNode(""), o = n._endNode ?? document.createTextNode("");
1948
+ n.key != null && (U(a, `${n.key}:start`), U(o, `${n.key}:end`)), n._startNode = a, n._endNode = o;
1949
+ let s = document.createDocumentFragment();
1950
+ s.appendChild(a);
1951
+ for (let n of t) s.appendChild(q(n, r, i, e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null));
1952
+ return s.appendChild(o), e.parentNode?.replaceChild(s, e), a;
1953
+ }
1954
+ if (typeof t != "string" && typeof n != "string" && t.tag === n.tag && t.key === n.key) {
1955
+ let a = e;
1956
+ return ze(a, t.props || {}, n.props || {}, r), Be(a, t.children, n.children, r, i), K(n, a, i), a;
1957
+ }
1958
+ if (typeof t != "string" && typeof n != "string" && t.tag === n.tag && (t.tag && String(t.tag).includes("-") || n.props && n.props.isCustomElement || t.props && t.props.isCustomElement)) try {
1959
+ let a = e;
1960
+ return ze(a, t.props || {}, n.props || {}, r), K(n, a, i), a;
1961
+ } catch {}
1962
+ G(e, i);
1963
+ let a = q(n, r, i, e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null);
1964
+ return K(n, a, i), e.parentNode?.replaceChild(a, e), a;
1965
+ }
1966
+ function Ve(e, t, n, r) {
1967
+ let i;
1968
+ Array.isArray(t) ? t.length === 1 ? (i = t[0], i && typeof i == "object" && i.key == null && (i = {
1969
+ ...i,
1970
+ key: "__root__"
1971
+ })) : i = {
1972
+ tag: "div",
1973
+ key: "__root__",
1974
+ children: t
1975
+ } : (i = t, i && typeof i == "object" && i.key == null && (i = {
1976
+ ...i,
1977
+ key: "__root__"
1978
+ })), i && typeof i == "object" && i.tag === "#anchor" && (i = {
1979
+ tag: "div",
1980
+ key: "__anchor_root__",
1981
+ props: { attrs: {
1982
+ "data-anchor-block-root": "",
1983
+ key: "__anchor_root__"
1984
+ } },
1985
+ children: [i]
1986
+ }), i = Re(i, String(i.key ?? "root"));
1987
+ let a = e._prevVNode ?? null, o = e._prevDom ?? e.firstChild ?? null, s;
1988
+ a && o ? typeof a != "string" && typeof i != "string" && a.tag === i.tag && a.key === i.key ? s = J(o, a, i, n, r) : (s = q(i, n, r, e.host instanceof Element ? e.host.namespaceURI ?? null : null), e.replaceChild(s, o)) : (s = q(i, n, r, e.host instanceof Element ? e.host.namespaceURI ?? null : null), e.firstChild ? e.replaceChild(s, e.firstChild) : e.appendChild(s));
1989
+ let c = [];
1990
+ for (let t = 0; t < e.childNodes.length; t++) {
1991
+ let n = e.childNodes[t];
1992
+ n !== s && n.nodeName !== "STYLE" && (G(n, r), c.push(n));
1993
+ }
1994
+ c.forEach((t) => e.removeChild(t)), e._prevVNode = i && typeof i == "object" && i.props ? {
1995
+ ...i,
1996
+ props: {
1997
+ ...i.props,
1998
+ attrs: i.props.attrs ? { ...i.props.attrs } : void 0,
1999
+ props: i.props.props ? { ...i.props.props } : void 0
2000
+ }
2001
+ } : i, e._prevDom = s;
2002
+ }
2003
+ //#endregion
2004
+ //#region src/lib/runtime/render.ts
2005
+ var Y = [], He = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap();
2006
+ function Ue(e, t) {
2007
+ X.has(e) || X.set(e, /* @__PURE__ */ new Set()), X.get(e).add(t);
2008
+ }
2009
+ function We(e, t) {
2010
+ let n = X.get(e);
2011
+ n && (n.delete(t), n.size === 0 && X.delete(e));
2012
+ }
2013
+ function Ge(e, n, r, i, a, o, s, c) {
2014
+ if (e) {
2015
+ Y.push(r);
2016
+ try {
2017
+ let l = n.render(r);
2018
+ if (l instanceof Promise) {
2019
+ o(!0);
2020
+ let n = e.host.isConnected, u = e, d = u._asyncRenderToken = (u._asyncRenderToken ?? 0) + 1;
2021
+ l.then((t) => {
2022
+ n && !e.host.isConnected || u._asyncRenderToken === d && (o(!1), s(null), Ke(e, t, r, i, a), c(e.innerHTML));
2023
+ }).catch((r) => {
2024
+ if (n && !e.host.isConnected || u._asyncRenderToken !== d) return;
2025
+ o(!1);
2026
+ let i = r instanceof Error ? r : Error(String(r));
2027
+ t(`[${e.host.tagName.toLowerCase()}] Async render error:`, i), s(i);
2028
+ });
2029
+ return;
2030
+ }
2031
+ Ke(e, l, r, i, a), c(e.innerHTML);
2032
+ } catch (n) {
2033
+ let r = n instanceof Error ? n : Error(String(n));
2034
+ t(`[${e.host.tagName.toLowerCase()}] Render error:`, r), s(r);
2035
+ } finally {
2036
+ Y.pop();
2037
+ }
2038
+ }
2039
+ }
2040
+ function Ke(e, t, n, r, i) {
2041
+ e && (Ve(e, Array.isArray(t) ? t : [t], n, r), i(e.innerHTML));
2042
+ }
2043
+ function qe(n, r, i, a, o, s, c) {
2044
+ s !== null && clearTimeout(s);
2045
+ let l = Date.now() - r < 16, { isVitest: d, isCypress: f, isTest: p } = u(), m = (d || p) && !f;
2046
+ if (l) {
2047
+ let n = i + 1;
2048
+ o(n);
2049
+ let r = p ? 50 : 10, a = p ? 100 : 25, s = m ? 12 : 50;
2050
+ if (n === r && !p) e("⚠️ Component rendering frequently. Performance may be impacted.\nCommon causes:\n• State updates during render cycle\n• Event handlers with immediate function calls\n• Missing effect dependencies");
2051
+ else if (n === a && !p) e("⚠️ Component is re-rendering rapidly. Applying throttling.\nThis might indicate:\n• Event handler calling function immediately: @click=\"${fn()}\" should be @click=\"${fn}\"\n• State modification during render\n• Missing dependencies in computed/watch");
2052
+ else if (n >= s) {
2053
+ t("🛑 Infinite render loop detected. Stopping to prevent browser freeze.\nPossible causes:\n• State updates triggering immediate re-renders\n• Computed values changing during evaluation\n• Circular dependencies in reactive system"), c(null);
2054
+ return;
2055
+ }
2056
+ } else o(0);
2057
+ let h = 0;
2058
+ p || (i >= 40 ? h = 500 : i >= 25 ? h = 100 : i >= 15 && (h = 16));
2059
+ let g = () => {
2060
+ a(Date.now());
2061
+ try {
2062
+ n();
2063
+ } catch (e) {
2064
+ t("Error during render execution:", e);
2065
+ } finally {
2066
+ c(null);
2067
+ }
2068
+ };
2069
+ h > 0 ? c(setTimeout(g, h)) : p ? g() : (c({}), queueMicrotask(g));
2070
+ }
2071
+ function Je(e, t) {
2072
+ let n = t;
2073
+ try {
2074
+ let t = X.get(e);
2075
+ if (t?.size) for (let e of t) try {
2076
+ let t = e.lastHtmlStringForJitCSS;
2077
+ t?.trim() && (n += "\n" + t);
2078
+ } catch {}
2079
+ else {
2080
+ let t = e.querySelectorAll("*");
2081
+ for (let e of t) try {
2082
+ let t = e.lastHtmlStringForJitCSS;
2083
+ t?.trim() && (n += "\n" + t);
2084
+ } catch {}
2085
+ }
2086
+ } catch {}
2087
+ return n;
2088
+ }
2089
+ function Ye(e) {
2090
+ return "adoptedStyleSheets" in e && typeof CSSStyleSheet < "u" && "replaceSync" in CSSStyleSheet.prototype;
2091
+ }
2092
+ function Xe(e, t) {
2093
+ let n = e.querySelector("style[data-cer-runtime]");
2094
+ n || (n = document.createElement("style"), r(n, "data-cer-runtime", "true"), e.appendChild(n));
2095
+ try {
2096
+ n.textContent = t;
2097
+ } catch {}
2098
+ }
2099
+ function Ze(e, t, n, r, i) {
2100
+ if (!e) return;
2101
+ let a = Je(e, n);
2102
+ if (He.get(e) === a) return;
2103
+ He.set(e, a);
2104
+ let o = D(e) ? E(a) : "", s = ee(), c = t._computedStyle, l = Ye(e), u = ne(), d = "";
2105
+ if (!l) try {
2106
+ u?.cssRules && (d = Array.from(u.cssRules).map((e) => e.cssText).join("\n"));
2107
+ } catch {
2108
+ d = "";
2109
+ }
2110
+ if (!o?.trim() && !c && !s) {
2111
+ if (i(null), l) e.adoptedStyleSheets = [O(), u];
2112
+ else {
2113
+ Xe(e, w(`${w(C)}\n${d}`));
2114
+ try {
2115
+ e.adoptedStyleSheets = [O(), u];
2116
+ } catch {}
2117
+ }
2118
+ return;
2119
+ }
2120
+ let f = "";
2121
+ if (c && (f += c + "\n"), o && (f += o + "\n"), f = T(f), f = w(f), l) {
2122
+ let t = r;
2123
+ t ||= new CSSStyleSheet();
2124
+ try {
2125
+ t.replaceSync(f);
2126
+ let n = [O(), u];
2127
+ s && n.push(s), n.push(t), e.adoptedStyleSheets = n, i(t);
2128
+ return;
2129
+ } catch {}
2130
+ }
2131
+ Xe(e, w(`${w(C)}\n${d}\n${f}`));
2132
+ try {
2133
+ let t = [O(), u];
2134
+ if (s && t.push(s), typeof CSSStyleSheet < "u") try {
2135
+ let e = new CSSStyleSheet();
2136
+ e.replaceSync(f), t.push(e);
2137
+ } catch {
2138
+ t.push({
2139
+ cssRules: [],
2140
+ replaceSync: () => {}
2141
+ });
2142
+ }
2143
+ e.adoptedStyleSheets = t;
2144
+ } catch {}
2145
+ i(null);
2146
+ }
2147
+ //#endregion
2148
+ //#region src/lib/runtime/component/element-class.ts
2149
+ function Qe(n, r) {
2150
+ if (!r.render) throw Error("Component must have a render function");
2151
+ return typeof window > "u" ? class {
2152
+ constructor() {}
2153
+ } : class extends HTMLElement {
2154
+ context;
2155
+ _refs = {};
2156
+ _listeners = [];
2157
+ _watchers = /* @__PURE__ */ new Map();
2158
+ _renderTimeoutId = null;
2159
+ _mounted = !1;
2160
+ _hasError = !1;
2161
+ _initializing = !0;
2162
+ _componentId;
2163
+ _styleSheet = null;
2164
+ _lastHtmlStringForJitCSS = "";
2165
+ get lastHtmlStringForJitCSS() {
2166
+ return this._lastHtmlStringForJitCSS;
2167
+ }
2168
+ get hasError() {
2169
+ return this._hasError;
2170
+ }
2171
+ get isLoading() {
2172
+ return this._templateLoading;
2173
+ }
2174
+ get lastError() {
2175
+ return this._templateError;
2176
+ }
2177
+ _cfg;
2178
+ _lastRenderTime = 0;
2179
+ _renderCount = 0;
2180
+ _templateLoading = !1;
2181
+ _templateError = null;
2182
+ constructor() {
2183
+ super(), this.shadowRoot || this.attachShadow({ mode: "open" }), this._cfg = a.get(n) || r, this._componentId = `${n}-${crypto.randomUUID()}`;
2184
+ let e = this._initContext(r), t = (e, t, n) => {
2185
+ Object.defineProperty(e, t, {
2186
+ value: n,
2187
+ writable: !1,
2188
+ enumerable: !1,
2189
+ configurable: !1
2190
+ });
2191
+ };
2192
+ t(e, "refs", this._refs), t(e, "requestRender", () => this.requestRender()), t(e, "_requestRender", () => this._requestRender()), t(e, "_componentId", this._componentId), t(e, "_triggerWatchers", (e, t) => this._triggerWatchers(e, t)), this.context = e, g(() => {
2193
+ t(e, "_host", this);
2194
+ }), t(this.context, "emit", (e, t, n) => {
2195
+ let r = {
2196
+ detail: t,
2197
+ bubbles: !0,
2198
+ composed: !0,
2199
+ ...n || {}
2200
+ }, i = new CustomEvent(e, r);
2201
+ this.dispatchEvent(i);
2202
+ let a = e.indexOf(":");
2203
+ if (a > 0) {
2204
+ let t = e.substring(0, a), n = e.substring(a + 1), i = n.includes("-") ? `${t}:${n.split("-").map((e, t) => t === 0 ? e : e.charAt(0).toUpperCase() + e.slice(1)).join("")}` : `${t}:${n.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase()}`;
2205
+ i !== e && g(() => {
2206
+ this.dispatchEvent(new CustomEvent(i, r));
2207
+ });
2208
+ }
2209
+ return !i.defaultPrevented;
2210
+ });
2211
+ let i = a.get(n) || r;
2212
+ for (let e in i) {
2213
+ let t = i[e];
2214
+ typeof t == "function" && (this.context[e] = (...e) => t(...e, this.context));
2215
+ }
2216
+ if (i.props) for (let e in i.props) {
2217
+ let t = this[e];
2218
+ Object.defineProperty(this, e, {
2219
+ get() {
2220
+ return t;
2221
+ },
2222
+ set(n) {
2223
+ let r = t;
2224
+ t = n, this.context[e] = n, this._initializing || (this._applyProps(i), r !== n && this._requestRender());
2225
+ },
2226
+ enumerable: !0,
2227
+ configurable: !0
2228
+ });
2229
+ }
2230
+ this._initializing = !1, this._initWatchers(i), this._applyProps(i), this._render(i);
2231
+ }
2232
+ connectedCallback() {
2233
+ this._runLogicWithinErrorBoundary(r, () => {
2234
+ let e = this.getRootNode();
2235
+ e && e !== document && "host" in e && Ue(e, this);
2236
+ let t = this.getAttribute("data-cer-hydrate");
2237
+ if (t !== "none") {
2238
+ if (t === "idle") {
2239
+ let e = () => this._hydrateNow(r);
2240
+ typeof requestIdleCallback < "u" ? requestIdleCallback(e) : setTimeout(e, 200);
2241
+ return;
2242
+ }
2243
+ if (t === "visible") {
2244
+ new IntersectionObserver((e, t) => {
2245
+ e.some((e) => e.isIntersecting) && (t.disconnect(), this._hydrateNow(r));
2246
+ }, {
2247
+ rootMargin: "0px",
2248
+ threshold: 0
2249
+ }).observe(this);
2250
+ return;
2251
+ }
2252
+ this._applyProps(r), this._requestRender(), ue(r, this.context, this._mounted, (e) => {
2253
+ this._mounted = e;
2254
+ });
2255
+ }
2256
+ });
2257
+ }
2258
+ _hydrateNow(e) {
2259
+ this._runLogicWithinErrorBoundary(e, () => {
2260
+ this._applyProps(e), this._requestRender(), ue(e, this.context, this._mounted, (e) => {
2261
+ this._mounted = e;
2262
+ });
2263
+ });
2264
+ }
2265
+ disconnectedCallback() {
2266
+ this._runLogicWithinErrorBoundary(r, () => {
2267
+ let e = this.getRootNode();
2268
+ e && e !== document && "host" in e && We(e, this), de(r, this.context, this._listeners, () => {
2269
+ this._listeners = [];
2270
+ }, () => {
2271
+ this._watchers.clear();
2272
+ }, (e) => {
2273
+ this._templateLoading = e;
2274
+ }, (e) => {
2275
+ this._templateError = e;
2276
+ }, (e) => {
2277
+ this._mounted = e;
2278
+ }), x.cleanup(this._componentId);
2279
+ });
2280
+ }
2281
+ attributeChangedCallback(e, t, n) {
2282
+ this._runLogicWithinErrorBoundary(r, () => {
2283
+ this._applyProps(r), t !== n && this._requestRender(), fe(r, e, t, n, this.context);
2284
+ });
2285
+ }
2286
+ static get observedAttributes() {
2287
+ return r.props ? Object.keys(r.props).map(y) : [];
2288
+ }
2289
+ _render(e) {
2290
+ this._runLogicWithinErrorBoundary(e, () => {
2291
+ Ge(this.shadowRoot, e, this.context, this._refs, (e) => {
2292
+ this._lastHtmlStringForJitCSS = e, typeof this.onHtmlStringUpdate == "function" && this?.onHtmlStringUpdate?.(e);
2293
+ }, (e) => {
2294
+ this._templateLoading = e, this?.onLoadingStateChange?.(e);
2295
+ }, (e) => {
2296
+ this._templateError = e, this?.onErrorStateChange?.(e);
2297
+ }, (t) => this._applyStyle(e, t));
2298
+ });
2299
+ }
2300
+ requestRender() {
2301
+ this._requestRender();
2302
+ }
2303
+ _requestRender() {
2304
+ this._runLogicWithinErrorBoundary(this._cfg, () => {
2305
+ c(() => {
2306
+ qe(() => this._render(this._cfg), this._lastRenderTime, this._renderCount, (e) => {
2307
+ this._lastRenderTime = e;
2308
+ }, (e) => {
2309
+ this._renderCount = e;
2310
+ }, this._renderTimeoutId, (e) => {
2311
+ this._renderTimeoutId = e;
2312
+ });
2313
+ }, this._componentId);
2314
+ });
2315
+ }
2316
+ _applyStyle(e, t) {
2317
+ this._runLogicWithinErrorBoundary(e, () => {
2318
+ Ze(this.shadowRoot, this.context, t, this._styleSheet, (e) => {
2319
+ this._styleSheet = e;
2320
+ });
2321
+ });
2322
+ }
2323
+ _runLogicWithinErrorBoundary(n, r) {
2324
+ try {
2325
+ r(), this._hasError = !1;
2326
+ } catch (r) {
2327
+ this._hasError = !0;
2328
+ try {
2329
+ let i = this.tagName?.toLowerCase?.() || "<unknown>", a = this._componentId || "<unknown-id>", o = {};
2330
+ if (n && n.props) for (let e of Object.keys(n.props)) try {
2331
+ let t = this.context[e];
2332
+ t instanceof Node ? o[e] = `[DOM Node: ${t.nodeName}]` : typeof t == "object" && t ? o[e] = Object.keys(t).length > 5 ? `[object(${Object.keys(t).length} keys)]` : t : o[e] = t;
2333
+ } catch {
2334
+ o[e] = "[unreadable]";
2335
+ }
2336
+ t(`Error rendering component <${i}> (id=${a}):`, r), t("Component props snapshot:", o), e("Common causes: accessing properties of null/undefined inside template interpolations; expensive or throwing expressions inside templates that evaluate eagerly. Fixes: use optional chaining (obj?.prop), guard with ternary, or use the runtime lazy overload: when(cond, () => html`...`).");
2337
+ } catch {}
2338
+ if (n.onError && n.onError(r, this.context), this.tagName.toLowerCase() !== "cer-error-boundary") {
2339
+ let e = this.parentElement;
2340
+ if (!e) {
2341
+ let t = this.getRootNode();
2342
+ t instanceof ShadowRoot && (e = t.host.parentElement);
2343
+ }
2344
+ for (; e;) {
2345
+ if (e.tagName.toLowerCase() === "cer-error-boundary") {
2346
+ e._cerHandleChildError?.(r);
2347
+ break;
2348
+ }
2349
+ let t = e.parentElement;
2350
+ if (!t) {
2351
+ let n = e.getRootNode();
2352
+ n instanceof ShadowRoot && (t = n.host.parentElement);
2353
+ }
2354
+ e = t;
2355
+ }
2356
+ }
2357
+ }
2358
+ }
2359
+ _initContext(e) {
2360
+ try {
2361
+ let t = this;
2362
+ function n(r, i = "") {
2363
+ if (Array.isArray(r)) return new Proxy(r, {
2364
+ get(n, r, a) {
2365
+ let o = Reflect.get(n, r, a);
2366
+ return typeof o == "function" && typeof r == "string" && [
2367
+ "push",
2368
+ "pop",
2369
+ "shift",
2370
+ "unshift",
2371
+ "splice",
2372
+ "sort",
2373
+ "reverse"
2374
+ ].includes(r) ? function(...r) {
2375
+ let a = o.apply(n, r);
2376
+ if (!t._initializing) {
2377
+ let r = i || "root";
2378
+ t._triggerWatchers(r, n), c(() => t._render(e), t._componentId);
2379
+ }
2380
+ return a;
2381
+ } : o;
2382
+ },
2383
+ set(n, r, a) {
2384
+ if (n[String(r)] = a, !t._initializing) {
2385
+ let n = i ? `${i}.${String(r)}` : String(r);
2386
+ t._triggerWatchers(n, a), c(() => t._render(e), t._componentId);
2387
+ }
2388
+ return !0;
2389
+ },
2390
+ deleteProperty(n, r) {
2391
+ if (delete n[String(r)], !t._initializing) {
2392
+ let n = i ? `${i}.${String(r)}` : String(r);
2393
+ t._triggerWatchers(n, void 0), c(() => t._render(e), t._componentId);
2394
+ }
2395
+ return !0;
2396
+ }
2397
+ });
2398
+ if (r && typeof r == "object") {
2399
+ if (d(r)) return r;
2400
+ for (let e in r) {
2401
+ let t = i ? `${i}.${e}` : e;
2402
+ r[e] = n(r[e], t);
2403
+ }
2404
+ return new Proxy(r, {
2405
+ set(r, a, o) {
2406
+ let s = i ? `${i}.${String(a)}` : String(a);
2407
+ return r[String(a)] = n(o, s), t._initializing || (t._triggerWatchers(s, r[String(a)]), c(() => t._render(e), t._componentId)), !0;
2408
+ },
2409
+ get(e, t, n) {
2410
+ return Reflect.get(e, t, n);
2411
+ }
2412
+ });
2413
+ }
2414
+ return r;
2415
+ }
2416
+ return n({ ...e.props ? Object.fromEntries(Object.entries(e.props).map(([e, t]) => [e, t.default])) : {} });
2417
+ } catch {
2418
+ return {};
2419
+ }
2420
+ }
2421
+ _initWatchers(e) {
2422
+ this._runLogicWithinErrorBoundary(e, () => {
2423
+ ae(this.context, this._watchers, {});
2424
+ });
2425
+ }
2426
+ _triggerWatchers(e, t) {
2427
+ oe(this.context, this._watchers, e, t);
2428
+ }
2429
+ _applyProps(e) {
2430
+ this._runLogicWithinErrorBoundary(e, () => {
2431
+ le(this, e, this.context);
2432
+ });
2433
+ }
2434
+ };
2435
+ }
2436
+ //#endregion
2437
+ //#region src/lib/runtime/component/factory.ts
2438
+ function $e(e, n, r, i) {
2439
+ for (let a of r) try {
2440
+ a(...i);
2441
+ } catch (r) {
2442
+ t(`[${e}] Error in ${n} lifecycle hook:`, r);
2443
+ }
2444
+ }
2445
+ function et(r, i, o) {
2446
+ n();
2447
+ let c = re(r), u = {}, d = {
2448
+ props: {},
2449
+ hydrate: o?.hydrate,
2450
+ onConnected: (e) => {
2451
+ if (u.onConnected) try {
2452
+ u.onConnected(e);
2453
+ } catch (e) {
2454
+ t(`[${c}] Error in onConnected lifecycle hook:`, e);
2455
+ }
2456
+ },
2457
+ onDisconnected: (e) => {
2458
+ if (u.onDisconnected) try {
2459
+ u.onDisconnected(e);
2460
+ } catch (e) {
2461
+ t(`[${c}] Error in onDisconnected lifecycle hook:`, e);
2462
+ }
2463
+ },
2464
+ onAttributeChanged: (e, n, r, i) => {
2465
+ if (u.onAttributeChanged) try {
2466
+ u.onAttributeChanged(e, n, r, i);
2467
+ } catch (e) {
2468
+ t(`[${c}] Error in onAttributeChanged lifecycle hook:`, e);
2469
+ }
2470
+ },
2471
+ onError: (e, n) => {
2472
+ if (u.onError && e) try {
2473
+ u.onError(e, n);
2474
+ } catch (e) {
2475
+ t(`[${c}] Error in onError handler (the error handler itself threw):`, e);
2476
+ }
2477
+ },
2478
+ render: (e) => {
2479
+ let t = e, n = t._componentId || `${c}-${crypto.randomUUID()}`;
2480
+ x.setCurrentComponent(n, () => {
2481
+ e.requestRender && e.requestRender();
2482
+ });
2483
+ try {
2484
+ Object.defineProperty(e, "_hookCallbacks", {
2485
+ value: {},
2486
+ writable: !0,
2487
+ enumerable: !1,
2488
+ configurable: !0
2489
+ }), Object.defineProperty(e, "_computedStyle", {
2490
+ value: void 0,
2491
+ writable: !0,
2492
+ enumerable: !1,
2493
+ configurable: !0
2494
+ }), ie(e), te();
2495
+ let n;
2496
+ try {
2497
+ n = i();
2498
+ } catch (e) {
2499
+ try {
2500
+ let n = t._hookCallbacks?.onError;
2501
+ if (Array.isArray(n)) for (let t of n) try {
2502
+ t(e);
2503
+ } catch {}
2504
+ else if (typeof n == "function") try {
2505
+ n(e);
2506
+ } catch {}
2507
+ } catch {}
2508
+ try {
2509
+ let n = t._host;
2510
+ if (n?.parentElement) {
2511
+ let t = n.parentElement;
2512
+ for (; t;) {
2513
+ if (t.tagName.toLowerCase() === "cer-error-boundary") {
2514
+ t._cerHandleChildError?.(e);
2515
+ break;
2516
+ }
2517
+ let n = t.parentElement;
2518
+ if (!n) {
2519
+ let e = t.getRootNode();
2520
+ typeof ShadowRoot < "u" && e instanceof ShadowRoot && (n = e.host.parentElement);
2521
+ }
2522
+ t = n;
2523
+ }
2524
+ }
2525
+ } catch {}
2526
+ throw e;
2527
+ }
2528
+ if (n == null) throw Error(`[${c}] Component render function did not return a value. Make sure your component returns an html\`...\` template.`);
2529
+ if (t._hookCallbacks) {
2530
+ let e = t._hookCallbacks;
2531
+ if (e.onConnected) {
2532
+ let t = e.onConnected;
2533
+ u.onConnected = (e) => {
2534
+ $e(c, "useOnConnected", t, [e]);
2535
+ };
2536
+ }
2537
+ if (e.onDisconnected) {
2538
+ let t = e.onDisconnected;
2539
+ u.onDisconnected = (e) => {
2540
+ $e(c, "useOnDisconnected", t, [e]);
2541
+ };
2542
+ }
2543
+ if (e.onAttributeChanged) {
2544
+ let t = e.onAttributeChanged;
2545
+ u.onAttributeChanged = (e, n, r, i) => {
2546
+ $e(c, "useOnAttributeChanged", t, [
2547
+ e,
2548
+ n,
2549
+ r,
2550
+ i
2551
+ ]);
2552
+ };
2553
+ }
2554
+ if (e.onError) {
2555
+ let t = e.onError;
2556
+ u.onError = (e) => {
2557
+ $e(c, "useOnError", t, [e]);
2558
+ };
2559
+ }
2560
+ if (e.props && !Object.keys(d.props ?? {}).length) {
2561
+ let t = e.props;
2562
+ d.props = Object.fromEntries(Object.entries(t).map(([e, t]) => [e, {
2563
+ type: typeof t == "boolean" ? Boolean : typeof t == "number" ? Number : typeof t == "string" ? String : Function,
2564
+ default: t
2565
+ }])), a.set(c, d);
2566
+ }
2567
+ }
2568
+ return n;
2569
+ } finally {
2570
+ k(), x.clearCurrentComponent();
2571
+ }
2572
+ }
2573
+ };
2574
+ if (a.set(c, d), typeof window < "u") {
2575
+ try {
2576
+ let n = {
2577
+ _hookCallbacks: {},
2578
+ requestRender: () => {},
2579
+ emit: () => !0
2580
+ };
2581
+ ie(n), l(), te();
2582
+ try {
2583
+ i();
2584
+ } catch (r) {
2585
+ try {
2586
+ let i = n?._hookCallbacks?.onError;
2587
+ if (Array.isArray(i)) for (let e of i) try {
2588
+ e(r);
2589
+ } catch {}
2590
+ else if (typeof i == "function") try {
2591
+ i(r);
2592
+ } catch {}
2593
+ t(`Error during component discovery render <${c}>:`, r), e("Error occurred during initial component discovery render. Consider guarding expensive expressions or using lazy factories for directives like when().");
2594
+ } catch {}
2595
+ throw r;
2596
+ } finally {
2597
+ s(), k();
2598
+ }
2599
+ if (n._hookCallbacks?.props) {
2600
+ let e = n._hookCallbacks.props;
2601
+ d.props = Object.fromEntries(Object.entries(e).map(([e, t]) => [e, {
2602
+ type: typeof t == "boolean" ? Boolean : typeof t == "number" ? Number : typeof t == "string" ? String : Function,
2603
+ default: t
2604
+ }])), a.set(c, d);
2605
+ }
2606
+ } catch (t) {
2607
+ e(`[${c}] Failed to register component. Check your component definition for errors.`, t);
2608
+ }
2609
+ typeof customElements < "u" && !customElements.get(c) && customElements.define(c, Qe(c, d));
2610
+ }
2611
+ }
2612
+ //#endregion
2613
+ //#region src/lib/runtime/template-compiler/vnode-utils.ts
2614
+ function Z(e, t = {}, n, r) {
2615
+ return {
2616
+ tag: e,
2617
+ key: r ?? t.key,
2618
+ props: t,
2619
+ children: n
2620
+ };
2621
+ }
2622
+ function Q(e) {
2623
+ return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
2624
+ }
2625
+ function $(e) {
2626
+ return typeof e == "object" && !!e && "tag" in e && !Q(e);
2627
+ }
2628
+ function tt(e, t) {
2629
+ return e.key == null ? {
2630
+ ...e,
2631
+ key: t
2632
+ } : e;
2633
+ }
2634
+ //#endregion
2635
+ //#region src/lib/runtime/template-compiler/props-parser.ts
2636
+ function nt(t, n) {
2637
+ if (t == null) {
2638
+ e(`⚠️ Event handler for '@${n}' is ${t}. This will prevent the event from working. Use a function reference instead: @${n}="\${functionName}"`);
2639
+ return;
2640
+ }
2641
+ typeof t != "function" && e(`🚨 Potential infinite loop detected! Event handler for '@${n}' appears to be the result of a function call (${typeof t}) instead of a function reference. Change @${n}="\${functionName()}" to @${n}="\${functionName}" to pass the function reference instead of calling it immediately.`), t === void 0 && typeof t != "function" && e(`💡 Tip: If your event handler function returns undefined, make sure you're passing the function reference, not calling it. Use @${n}="\${fn}" not @${n}="\${fn()}"`);
2642
+ }
2643
+ function rt(e, t = [], n = {}) {
2644
+ let r = {}, i = {}, a = {}, o = [], s = /([:@#]?)([a-zA-Z0-9-:.]+)(?:\s*=\s*("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|([^\s>]+)))?/g, c;
2645
+ for (; c = s.exec(e);) {
2646
+ let e = c[1], s = c[2], l = "";
2647
+ for (let e = 3; e < c.length; e++) if (c[e] !== void 0) {
2648
+ l = c[e];
2649
+ break;
2650
+ }
2651
+ l.length >= 2 && (l[0] === "\"" && l[l.length - 1] === "\"" || l[0] === "'" && l[l.length - 1] === "'") && (l = l.slice(1, -1));
2652
+ let u = !/=/.test(c[0]), f = l.match(/^{{(\d+)}}$/), p = !f && /{{(\d+)}}/.test(l), m = u ? !0 : f ? t[Number(f[1])] ?? null : p ? l.replace(/{{(\d+)}}/g, (e, n) => String(t[Number(n)] ?? "")) : l;
2653
+ !f && !p && (m === "true" ? m = !0 : m === "false" ? m = !1 : m === "null" ? m = null : isNaN(Number(m)) || (m = Number(m)));
2654
+ let h = [
2655
+ "model",
2656
+ "bind",
2657
+ "show",
2658
+ "class",
2659
+ "style",
2660
+ "ref",
2661
+ "when"
2662
+ ];
2663
+ if (e === ":") {
2664
+ let [e, t] = s.split(":"), [n, ...c] = e.split(".");
2665
+ if (h.includes(n)) {
2666
+ let e = [...c], r = n === "model" && t ? `model:${t}` : n;
2667
+ a[r] = {
2668
+ value: m,
2669
+ modifiers: e,
2670
+ arg: t
2671
+ };
2672
+ } else if (s === "disabled") {
2673
+ let e = m;
2674
+ e && d(e) && (e = e.value);
2675
+ let t = typeof e;
2676
+ if (e === "" || t === "boolean" || t === "string" && (e === "true" || e === "false") || e == null || t === "number") r[s] = e;
2677
+ else {
2678
+ let e = m;
2679
+ e && d(e) && (e = e.value), i[s] = e;
2680
+ }
2681
+ o.push(s);
2682
+ } else {
2683
+ let e = m;
2684
+ e && d(e) && (e = e.value), i[s] = e, o.push(s);
2685
+ }
2686
+ } else if (e === "@") {
2687
+ let [e, ...t] = s.split("."), i = t;
2688
+ nt(m, e);
2689
+ let a = typeof m == "function" ? m : typeof n[m] == "function" ? n[m] : void 0;
2690
+ if (a) {
2691
+ let t = (n) => {
2692
+ if (i.includes("prevent") && n.preventDefault(), i.includes("stop") && n.stopPropagation(), !(i.includes("self") && n.target !== n.currentTarget)) return i.includes("once") && n.currentTarget?.removeEventListener(e, t), a(n);
2693
+ }, n = "on" + e.charAt(0).toUpperCase() + e.slice(1);
2694
+ r[n] = t;
2695
+ }
2696
+ } else s === "ref" ? r.ref = m : i[s] = m;
2697
+ }
2698
+ return {
2699
+ props: r,
2700
+ attrs: i,
2701
+ directives: a,
2702
+ bound: o
2703
+ };
2704
+ }
2705
+ //#endregion
2706
+ //#region src/lib/runtime/template-compiler/impl.ts
2707
+ function it(e) {
2708
+ if (!$(e) || Q(e)) return e;
2709
+ let t = e.props?.directives;
2710
+ if (t && t.when) {
2711
+ let n = t.when.value, r = d(n) ? n.value : n, i = { ...t };
2712
+ delete i.when;
2713
+ let a = { ...e.props };
2714
+ Object.keys(i).length > 0 ? a.directives = i : delete a.directives;
2715
+ let o = {
2716
+ ...e,
2717
+ props: a
2718
+ };
2719
+ return Array.isArray(o.children) && (o.children = o.children.map((e) => typeof e == "object" && e ? it(e) : e)), {
2720
+ tag: "#anchor",
2721
+ key: e.key == null ? `when-${e.tag}` : `when-${e.key}`,
2722
+ children: r ? [o] : []
2723
+ };
2724
+ }
2725
+ if (Array.isArray(e.children)) {
2726
+ let t = e.children.map((e) => typeof e == "object" && e ? it(e) : e);
2727
+ return {
2728
+ ...e,
2729
+ children: t
2730
+ };
2731
+ }
2732
+ return e;
2733
+ }
2734
+ function at(e, t, n) {
2735
+ let r = Y.length > 0 ? Y[Y.length - 1] : void 0, i = n ?? r, a = !n && t.length === 0, o = a ? e.join("<!--TEMPLATE_DELIM-->") : null;
2736
+ if (a && o) {
2737
+ let e = me.get(o);
2738
+ if (e) return e;
2739
+ }
2740
+ function s(e, t) {
2741
+ return Z("#text", {}, e, t);
2742
+ }
2743
+ function c(e, t, n = !1) {
2744
+ let r = typeof e == "string" ? _(e) : e;
2745
+ return !n && typeof r == "string" && /[\r\n]/.test(r) && (r = r.replace(/\s+/g, " ")), Z("#text", {}, r, t);
2746
+ }
2747
+ let l = "";
2748
+ for (let n = 0; n < e.length; n++) l += e[n], n < t.length && (l += `{{${n}}}`);
2749
+ let u = /<!--[\s\S]*?-->|<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, x = [], S, C = [], w = null, T = {}, E, ee = 0, D = [], O = new Set([
2750
+ "pre",
2751
+ "code",
2752
+ "textarea",
2753
+ "script",
2754
+ "style"
2755
+ ]);
2756
+ function te() {
2757
+ if (w && O.has(w.toLowerCase())) return !0;
2758
+ for (let e of x) if (O.has(e.tag.toLowerCase())) return !0;
2759
+ return !1;
2760
+ }
2761
+ function ne(e) {
2762
+ if (!e || typeof e != "object" || Q(e)) return;
2763
+ let t = e, n = T;
2764
+ if (t.props || t.attrs) {
2765
+ let e = t;
2766
+ e.props && (n.props ||= {}, Object.assign(n.props, e.props)), e.attrs && (n.attrs ||= {}, Object.keys(e.attrs).forEach((t) => {
2767
+ if (t === "style" && n.attrs.style) {
2768
+ let t = String(n.attrs.style).replace(/;?\s*$/, ""), r = String(e.attrs.style).replace(/^;?\s*/, "");
2769
+ n.attrs.style = t + "; " + r;
2770
+ } else if (t === "class" && n.attrs.class) {
2771
+ let t = String(n.attrs.class).trim().split(/\s+/).filter(Boolean), r = String(e.attrs.class).trim().split(/\s+/).filter(Boolean), i = [...new Set([...t, ...r])];
2772
+ n.attrs.class = i.join(" ");
2773
+ } else n.attrs[t] = e.attrs[t];
2774
+ }));
2775
+ } else n.props ||= {}, Object.assign(n.props, t);
2776
+ }
2777
+ function re(e, t) {
2778
+ let n = w ? C : D;
2779
+ if (Q(e)) {
2780
+ let r = e.key ?? t, i = e.children;
2781
+ n.push({
2782
+ ...e,
2783
+ key: r,
2784
+ children: i
2785
+ });
2786
+ return;
2787
+ }
2788
+ if ($(e)) {
2789
+ n.push(tt(e, void 0));
2790
+ return;
2791
+ }
2792
+ if (Array.isArray(e)) {
2793
+ if (e.length === 0) return;
2794
+ for (let r = 0; r < e.length; r++) {
2795
+ let i = e[r];
2796
+ Q(i) || $(i) || Array.isArray(i) ? re(i, `${t}-${r}`) : typeof i == "object" && i ? v(i) ? n.push(Z("#raw", {}, i.__rawHTML, `${t}-${r}`)) : ne(i) : n.push(s(String(i), `${t}-${r}`));
2797
+ }
2798
+ return;
2799
+ }
2800
+ if (typeof e == "object" && e) {
2801
+ if (v(e)) {
2802
+ let r = e.__rawHTML ?? "";
2803
+ n.push(Z("#raw", {}, r, t));
2804
+ return;
2805
+ }
2806
+ ne(e);
2807
+ return;
2808
+ }
2809
+ n.push(s(String(e), t));
2810
+ }
2811
+ let ie = new Set([
2812
+ "area",
2813
+ "base",
2814
+ "br",
2815
+ "col",
2816
+ "embed",
2817
+ "hr",
2818
+ "img",
2819
+ "input",
2820
+ "link",
2821
+ "meta",
2822
+ "param",
2823
+ "source",
2824
+ "track",
2825
+ "wbr"
2826
+ ]);
2827
+ for (; S = u.exec(l);) if (!(S[0].startsWith("<!--") && S[0].endsWith("-->"))) {
2828
+ if (S[1]) {
2829
+ let e = S[1], n = S[0][1] === "/", r = S[0][S[0].length - 2] === "/" || ie.has(e), { props: a, attrs: o, directives: s, bound: c } = rt(S[2] || "", t, i ?? {}), l = {
2830
+ props: {},
2831
+ attrs: {}
2832
+ };
2833
+ for (let e in a) l.props[e] = a[e];
2834
+ for (let e in o) l.attrs[e] = o[e];
2835
+ l.attrs && Object.prototype.hasOwnProperty.call(l.attrs, "key") && !(l.props && Object.prototype.hasOwnProperty.call(l.props, "key")) && g(() => {
2836
+ l.props.key = l.attrs.key;
2837
+ });
2838
+ try {
2839
+ let t = {
2840
+ input: [
2841
+ "value",
2842
+ "checked",
2843
+ "readonly",
2844
+ "required",
2845
+ "placeholder",
2846
+ "maxlength",
2847
+ "minlength"
2848
+ ],
2849
+ textarea: [
2850
+ "value",
2851
+ "readonly",
2852
+ "required",
2853
+ "placeholder",
2854
+ "maxlength",
2855
+ "minlength"
2856
+ ],
2857
+ select: [
2858
+ "value",
2859
+ "required",
2860
+ "multiple"
2861
+ ],
2862
+ option: ["selected", "value"],
2863
+ video: [
2864
+ "muted",
2865
+ "autoplay",
2866
+ "controls",
2867
+ "loop",
2868
+ "playsinline"
2869
+ ],
2870
+ audio: [
2871
+ "muted",
2872
+ "autoplay",
2873
+ "controls",
2874
+ "loop"
2875
+ ],
2876
+ img: [
2877
+ "src",
2878
+ "alt",
2879
+ "width",
2880
+ "height"
2881
+ ],
2882
+ button: [
2883
+ "type",
2884
+ "name",
2885
+ "value",
2886
+ "autofocus",
2887
+ "form"
2888
+ ]
2889
+ }, n = e.toLowerCase(), r = t[n] ?? [];
2890
+ if (l.attrs) {
2891
+ for (let e of r) if (c && c.includes(e) && e in l.attrs && !(l.props && e in l.props)) {
2892
+ let t = l.attrs[e];
2893
+ if (t && d(t)) t = t.value, l.props[e] = t, delete l.attrs[e];
2894
+ else if (t && typeof t == "object" && "value" in t && !(t instanceof Node)) try {
2895
+ let r = t.value;
2896
+ l.props[e] = (n === "select" || n === "option") && e === "value" ? String(r) : r, delete l.attrs[e];
2897
+ } catch {}
2898
+ else {
2899
+ let r = typeof t;
2900
+ if (e === "disabled") (t === "" || r === "boolean" || r === "string" && (t === "true" || t === "false") || t == null || r === "number") && (l.props[e] = t, delete l.attrs[e]);
2901
+ else if (t === "" || r === "string" || r === "number" || r === "boolean" || t == null) {
2902
+ let r = (n === "select" || n === "option") && e === "value" ? String(t) : t;
2903
+ l.props[e] = r, delete l.attrs[e];
2904
+ }
2905
+ }
2906
+ }
2907
+ }
2908
+ if (e.includes("-") || i?.__customElements?.has?.(e)) {
2909
+ if (l.isCustomElement = !0, c && l.attrs) {
2910
+ let e = new Set([
2911
+ "id",
2912
+ "name",
2913
+ "data-key",
2914
+ "key"
2915
+ ]);
2916
+ for (let t of c) if (t in l.attrs && !(l.props && t in l.props)) {
2917
+ let n = t.includes("-") ? m(t) : t, r = l.attrs[t];
2918
+ if (l.props[n] = r, e.has(t) || f(t)) try {
2919
+ let e = b(l.attrs[t]);
2920
+ e === null ? delete l.attrs[t] : l.attrs[t] = e;
2921
+ } catch {
2922
+ delete l.attrs[t];
2923
+ }
2924
+ else delete l.attrs[t];
2925
+ }
2926
+ }
2927
+ try {
2928
+ if (l.attrs && !(l.props && "modelValue" in l.props)) {
2929
+ let e = l.attrs["model-value"] ?? l.attrs.modelValue;
2930
+ e !== void 0 && (l.props.modelValue = e);
2931
+ }
2932
+ } catch {}
2933
+ }
2934
+ } catch {}
2935
+ if (s && Object.keys(s).some((e) => e === "model" || e.startsWith("model:"))) try {
2936
+ let t = globalThis[Symbol.for("cer.registry")], n = !!(t && typeof t.has == "function" && t.has(e)), r = i, a = !!(r && (r.__customElements instanceof Set && r.__customElements.has(e) || Array.isArray(r.__isCustomElements) && r.__isCustomElements.includes(e)));
2937
+ if (e.includes("-") || a || n) for (let e of Object.keys(s)) {
2938
+ if (e !== "model" && !e.startsWith("model:")) continue;
2939
+ let t = s[e], n = t.arg ?? (e.includes(":") ? e.split(":", 2)[1] : void 0), r = t.value, a = n ?? "modelValue", o = h, c = p, u = i?._state || i, f;
2940
+ if (typeof r == "string" && u) f = o(u, r);
2941
+ else if (f = r, d(r)) try {
2942
+ r.value;
2943
+ } catch {}
2944
+ l.props[a] = f;
2945
+ try {
2946
+ let e = y(a);
2947
+ l.attrs ||= {}, f != null && (typeof f == "string" || typeof f == "number" || typeof f == "boolean") && (l.attrs[e] = f);
2948
+ } catch {}
2949
+ l.isCustomElement = !0;
2950
+ let m = `update:${y(a)}`.replace(/-([a-z])/g, (e, t) => t.toUpperCase()), g = "on" + m.charAt(0).toUpperCase() + m.slice(1);
2951
+ l.props[g] = function(e) {
2952
+ let t = e.detail === void 0 ? e.target ? e.target.value : void 0 : e.detail;
2953
+ if (u) if (r && d(r)) {
2954
+ let e = r.value;
2955
+ if (Array.isArray(t) && Array.isArray(e) ? JSON.stringify([...t].sort()) !== JSON.stringify([...e].sort()) : t !== e) {
2956
+ r.value = t;
2957
+ try {
2958
+ let e = i;
2959
+ if (e) {
2960
+ let t = e.requestRender, n = e._requestRender;
2961
+ typeof t == "function" ? t() : typeof n == "function" && n();
2962
+ }
2963
+ } catch {}
2964
+ }
2965
+ } else {
2966
+ let e = o(u || {}, typeof r == "string" ? r : String(r));
2967
+ if (Array.isArray(t) && Array.isArray(e) ? JSON.stringify([...t].sort()) !== JSON.stringify([...e].sort()) : t !== e) {
2968
+ c(u || {}, typeof r == "string" ? r : String(r), t);
2969
+ try {
2970
+ let e = i;
2971
+ if (e) {
2972
+ let t = e.requestRender, n = e._requestRender;
2973
+ typeof t == "function" ? t() : typeof n == "function" && n();
2974
+ }
2975
+ } catch {}
2976
+ }
2977
+ }
2978
+ }, delete s[e];
2979
+ }
2980
+ } catch {}
2981
+ if (Object.keys(s).length > 0 && (l.directives = { ...s }), n) {
2982
+ let e = C.some((e) => typeof e == "object" && e.tag !== "#text"), t = C;
2983
+ if (e && C.length > 0) {
2984
+ let e = 0;
2985
+ for (; e < C.length;) {
2986
+ let t = C[e];
2987
+ if (!$(t) || t.tag !== "#text" || typeof t.children != "string" || t.children.trim() !== "") break;
2988
+ e++;
2989
+ }
2990
+ let n = C.length - 1;
2991
+ for (; n >= 0;) {
2992
+ let e = C[n];
2993
+ if (!$(e) || e.tag !== "#text" || typeof e.children != "string" || e.children.trim() !== "") break;
2994
+ n--;
2995
+ }
2996
+ t = e === 0 && n === C.length - 1 ? C : e > n ? [] : C.slice(e, n + 1);
2997
+ }
2998
+ let n = Z(w, T, t.length === 1 && $(t[0]) && t[0].tag === "#text" ? typeof t[0].children == "string" ? t[0].children : "" : t.length ? t : void 0, E), r = x.pop();
2999
+ r ? (w = r.tag, T = r.props, E = r.key, C = r.children, C.push(n)) : (D.push(n), w = null, T = {}, E = void 0, C = []);
3000
+ } else r ? w ? C.push(Z(e, l, void 0, void 0)) : D.push(Z(e, l, void 0, void 0)) : (w && x.push({
3001
+ tag: w,
3002
+ props: T,
3003
+ children: C,
3004
+ key: E
3005
+ }), w = e, T = l, C = []);
3006
+ } else if (S[3] !== void 0) {
3007
+ let e = Number(S[3]), n = t[e];
3008
+ re(n, `interp-${e}`);
3009
+ } else if (S[4]) {
3010
+ let e = S[4], n = w ? C : D, r = e.split(/({{\d+}})/);
3011
+ for (let e of r) {
3012
+ if (!e) continue;
3013
+ let r = e.match(/^{{(\d+)}}$/);
3014
+ if (r) {
3015
+ let e = Number(r[1]), n = t[e];
3016
+ re(n, `interp-${e}`);
3017
+ } else {
3018
+ let t = `text-${ee++}`, r = te();
3019
+ n.push(c(e, t, r));
3020
+ }
3021
+ }
3022
+ }
3023
+ }
3024
+ let k = D.filter((e) => $(e) && e.tag === "#text" ? typeof e.children == "string" && e.children.trim() !== "" : !0).map((e) => it(e));
3025
+ if (k.length === 1) {
3026
+ let e = k[0];
3027
+ return a && o && me.set(o, e), e;
3028
+ } else if (k.length > 1) {
3029
+ let e = k;
3030
+ return a && o && me.set(o, e), e;
3031
+ }
3032
+ return Z("div", {}, "", "fallback-root");
3033
+ }
3034
+ //#endregion
3035
+ //#region src/lib/runtime/template-compiler.ts
3036
+ function ot(e, ...t) {
3037
+ if (S()) return [];
3038
+ let n = t[t.length - 1];
3039
+ return at(e, t, typeof n == "object" && n && !Array.isArray(n) ? n : void 0);
3040
+ }
3041
+ //#endregion
3042
+ export { et as n, Ve as r, ot as t };
3043
+
3044
+ //# sourceMappingURL=template-compiler-C3h8_vbE.js.map