@jasonshimmy/custom-elements-runtime 2.5.1 → 2.5.5

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 (90) hide show
  1. package/README.md +115 -40
  2. package/dist/css/colors.d.ts +14 -0
  3. package/dist/custom-elements-runtime.cjs.js +6 -18
  4. package/dist/custom-elements-runtime.cjs.js.map +1 -1
  5. package/dist/custom-elements-runtime.colors.cjs.js +2 -0
  6. package/dist/custom-elements-runtime.colors.cjs.js.map +1 -0
  7. package/dist/custom-elements-runtime.colors.es.js +279 -0
  8. package/dist/custom-elements-runtime.colors.es.js.map +1 -0
  9. package/dist/custom-elements-runtime.directive-enhancements.es.js +1 -1
  10. package/dist/custom-elements-runtime.es.js +246 -3648
  11. package/dist/custom-elements-runtime.es.js.map +1 -1
  12. package/dist/custom-elements-runtime.event-bus.cjs.js +1 -1
  13. package/dist/custom-elements-runtime.event-bus.cjs.js.map +1 -1
  14. package/dist/custom-elements-runtime.event-bus.es.js +28 -25
  15. package/dist/custom-elements-runtime.event-bus.es.js.map +1 -1
  16. package/dist/custom-elements-runtime.router.cjs.js +20 -20
  17. package/dist/custom-elements-runtime.router.cjs.js.map +1 -1
  18. package/dist/custom-elements-runtime.router.es.js +790 -464
  19. package/dist/custom-elements-runtime.router.es.js.map +1 -1
  20. package/dist/custom-elements-runtime.ssr.cjs.js +1 -1
  21. package/dist/custom-elements-runtime.ssr.es.js +12 -8
  22. package/dist/custom-elements-runtime.ssr.es.js.map +1 -1
  23. package/dist/custom-elements-runtime.store.cjs.js +1 -1
  24. package/dist/custom-elements-runtime.store.cjs.js.map +1 -1
  25. package/dist/custom-elements-runtime.store.es.js +5 -5
  26. package/dist/custom-elements-runtime.store.es.js.map +1 -1
  27. package/dist/custom-elements-runtime.transitions.cjs.js +1 -1
  28. package/dist/custom-elements-runtime.transitions.es.js +1 -1
  29. package/dist/event-bus.d.ts +17 -4
  30. package/dist/index.d.ts +13 -3
  31. package/dist/keep-alive.d.ts +50 -0
  32. package/dist/{logger-BuUYv7C_.js → logger-BvkEbVM4.js} +15 -11
  33. package/dist/logger-BvkEbVM4.js.map +1 -0
  34. package/dist/logger-CSALKaYm.cjs +2 -0
  35. package/dist/logger-CSALKaYm.cjs.map +1 -0
  36. package/dist/namespace-helpers-4qeKVqQw.cjs +5 -0
  37. package/dist/namespace-helpers-4qeKVqQw.cjs.map +1 -0
  38. package/dist/namespace-helpers-DcD_6_K1.js +989 -0
  39. package/dist/namespace-helpers-DcD_6_K1.js.map +1 -0
  40. package/dist/router/active-proxy.d.ts +5 -0
  41. package/dist/router/component-loader.d.ts +11 -0
  42. package/dist/router/instance.d.ts +11 -0
  43. package/dist/router/matcher.d.ts +14 -0
  44. package/dist/router/path-utils.d.ts +48 -0
  45. package/dist/router/types.d.ts +134 -0
  46. package/dist/router.d.ts +6 -147
  47. package/dist/runtime/builtin-components.d.ts +78 -0
  48. package/dist/runtime/component/element-class.d.ts +4 -0
  49. package/dist/runtime/component/factory.d.ts +39 -0
  50. package/dist/runtime/component/registry.d.ts +16 -0
  51. package/dist/runtime/component.d.ts +3 -50
  52. package/dist/runtime/discovery-state.d.ts +30 -0
  53. package/dist/runtime/hooks.d.ts +115 -0
  54. package/dist/runtime/logger.d.ts +19 -1
  55. package/dist/runtime/monitoring/health-monitor.d.ts +56 -0
  56. package/dist/runtime/reactive.d.ts +39 -7
  57. package/dist/runtime/render.d.ts +20 -4
  58. package/dist/runtime/scheduler.d.ts +115 -2
  59. package/dist/runtime/template-compiler/impl.d.ts +14 -0
  60. package/dist/runtime/template-compiler/lru-cache.d.ts +20 -0
  61. package/dist/runtime/template-compiler/props-parser.d.ts +15 -0
  62. package/dist/runtime/template-compiler/vnode-utils.d.ts +5 -0
  63. package/dist/runtime/template-compiler.d.ts +5 -28
  64. package/dist/runtime/types.d.ts +10 -0
  65. package/dist/runtime/vdom-directives.d.ts +71 -0
  66. package/dist/runtime/vdom-helpers.d.ts +126 -0
  67. package/dist/runtime/vdom-patch.d.ts +67 -0
  68. package/dist/runtime/vdom.d.ts +16 -140
  69. package/dist/ssr.d.ts +2 -1
  70. package/dist/teleport.d.ts +68 -0
  71. package/dist/template-compiler-CA4YRaBu.cjs +23 -0
  72. package/dist/template-compiler-CA4YRaBu.cjs.map +1 -0
  73. package/dist/template-compiler-CJFwjLCP.js +3981 -0
  74. package/dist/template-compiler-CJFwjLCP.js.map +1 -0
  75. package/dist/transitions-DPZiuXb9.cjs +330 -0
  76. package/dist/transitions-DPZiuXb9.cjs.map +1 -0
  77. package/dist/{transitions-CZ21fzhh.js → transitions-Di5wW9yc.js} +1059 -618
  78. package/dist/transitions-Di5wW9yc.js.map +1 -0
  79. package/dist/transitions.d.ts +1 -1
  80. package/package.json +20 -12
  81. package/dist/logger-BuUYv7C_.js.map +0 -1
  82. package/dist/logger-DiXdWaF-.cjs +0 -2
  83. package/dist/logger-DiXdWaF-.cjs.map +0 -1
  84. package/dist/namespace-helpers-BsKQl3aH.cjs +0 -5
  85. package/dist/namespace-helpers-BsKQl3aH.cjs.map +0 -1
  86. package/dist/namespace-helpers-Dw1mgQab.js +0 -692
  87. package/dist/namespace-helpers-Dw1mgQab.js.map +0 -1
  88. package/dist/transitions-CZ21fzhh.js.map +0 -1
  89. package/dist/transitions-RXe2brRm.cjs +0 -302
  90. package/dist/transitions-RXe2brRm.cjs.map +0 -1
@@ -0,0 +1,3981 @@
1
+ import { j as K, t as Y, i as M, k as We, m as x, o as F, p as U, q as G, T as Ct, v as Qe, S as kt, x as pt, y as _e, z as ee, A as _t, B as nt, a as rt, C as st, d as At } from "./namespace-helpers-DcD_6_K1.js";
2
+ import { a as V, d as B } from "./logger-BvkEbVM4.js";
3
+ import { j as wt, g as Tt, a as He, b as ye, m as Ae, s as Lt, d as ot } from "./transitions-Di5wW9yc.js";
4
+ const ge = /* @__PURE__ */ new Map(), Ke = /* @__PURE__ */ Symbol.for("cer.registry");
5
+ function Nt() {
6
+ if (!(typeof window > "u" && typeof document > "u" && typeof navigator > "u"))
7
+ try {
8
+ const n = globalThis;
9
+ if (!n[Ke]) {
10
+ const t = crypto.randomUUID();
11
+ n[Ke] = new Map([...ge.entries()]), n[Ke].__realmId = t;
12
+ }
13
+ } catch (n) {
14
+ V("Could not initialize global registry:", n);
15
+ }
16
+ }
17
+ function Ot(e, n, t) {
18
+ if (t)
19
+ for (const [s, r] of Object.entries(t)) {
20
+ let i, o = {};
21
+ if (Array.isArray(r) ? (i = r[0], o = r[1] || {}) : i = r, n.set(s, {
22
+ callback: i,
23
+ options: o,
24
+ oldValue: K(e, s)
25
+ }), o.immediate)
26
+ try {
27
+ const c = K(e, s);
28
+ i(c, void 0, e);
29
+ } catch (c) {
30
+ B(`Error in immediate watcher for "${s}":`, c);
31
+ }
32
+ }
33
+ }
34
+ function jt(e, n, t, s) {
35
+ const r = (o, c) => {
36
+ if (o === c) return !0;
37
+ if (typeof o != typeof c || typeof o != "object" || o === null || c === null) return !1;
38
+ if (Array.isArray(o) && Array.isArray(c))
39
+ return o.length !== c.length ? !1 : o.every((d, C) => r(d, c[C]));
40
+ const f = o, u = c, m = Object.keys(f || {}), p = Object.keys(u || {});
41
+ return m.length !== p.length ? !1 : m.every((d) => r(f[d], u[d]));
42
+ }, i = n.get(t);
43
+ if (i && !r(s, i.oldValue))
44
+ try {
45
+ i.callback(s, i.oldValue, e), i.oldValue = s;
46
+ } catch (o) {
47
+ B(`Error in watcher for "${t}":`, o);
48
+ }
49
+ for (const [o, c] of n.entries())
50
+ if (c.options.deep && t.startsWith(o + "."))
51
+ try {
52
+ const f = K(e, o);
53
+ r(f, c.oldValue) || (c.callback(f, c.oldValue, e), c.oldValue = f);
54
+ } catch (f) {
55
+ B(`Error in deep watcher for "${o}":`, f);
56
+ }
57
+ }
58
+ function Fe(e, n) {
59
+ return n === Boolean ? e === "" || e === "true" : n === Number ? Number(e) : e;
60
+ }
61
+ function Pt(e, n, t) {
62
+ if (n)
63
+ for (const s in n) {
64
+ const r = n[s], i = Y(s), o = e.getAttribute(i);
65
+ if (r.type === Function && typeof e[s] == "function")
66
+ t[s] = e[s];
67
+ else if (o !== null)
68
+ t[s] = Fe(o, r.type);
69
+ else if (typeof e[s] < "u")
70
+ try {
71
+ const c = e[s];
72
+ if (r.type === String && c && typeof c == "object")
73
+ try {
74
+ t[s] = Fe(String(c), r.type);
75
+ } catch {
76
+ t[s] = c;
77
+ }
78
+ else r.type === Boolean && typeof c == "boolean" || r.type === Number && typeof c == "number" || r.type === Function && typeof c == "function" ? t[s] = c : t[s] = Fe(String(c), r.type);
79
+ } catch {
80
+ t[s] = e[s];
81
+ }
82
+ else "default" in r && r.default !== void 0 && (t[s] = r.default);
83
+ }
84
+ }
85
+ function Mt(e, n, t) {
86
+ if (!n.props) {
87
+ try {
88
+ const s = t?._hookCallbacks?.props || {}, r = Array.from(
89
+ /* @__PURE__ */ new Set([
90
+ ...Object.keys(e || {}),
91
+ ...Object.keys(s || {})
92
+ ])
93
+ );
94
+ for (const i of r) {
95
+ if (typeof i != "string" || i.startsWith("_")) continue;
96
+ const o = Object.getOwnPropertyDescriptor(t, i);
97
+ if (!(!Object.prototype.hasOwnProperty.call(
98
+ s,
99
+ i
100
+ ) && o && (o.get || o.set || !o.configurable)))
101
+ try {
102
+ Object.defineProperty(t, i, {
103
+ enumerable: !0,
104
+ configurable: !0,
105
+ get() {
106
+ try {
107
+ const f = Y(i), u = e.getAttribute(f);
108
+ if (u !== null)
109
+ return u;
110
+ const m = e[i];
111
+ let p;
112
+ return M(m) || m && typeof m == "object" && "value" in m && !(m instanceof Node) ? p = m.value : p = m, p;
113
+ } catch {
114
+ return e[i];
115
+ }
116
+ }
117
+ });
118
+ } catch {
119
+ }
120
+ }
121
+ } catch {
122
+ }
123
+ return;
124
+ }
125
+ Pt(e, n.props, t);
126
+ }
127
+ function $t(e, n, t, s) {
128
+ e.onConnected && !t && (e.onConnected(n), s(!0));
129
+ }
130
+ function xt(e, n, t, s, r, i, o, c) {
131
+ e.onDisconnected && e.onDisconnected(n), t.forEach((f) => f()), s(), r(), i(!1), o(null), c(!1);
132
+ }
133
+ function Ht(e, n, t, s, r) {
134
+ e.onAttributeChanged && e.onAttributeChanged(n, t, s, r);
135
+ }
136
+ class ne {
137
+ static cleanupFunctions = /* @__PURE__ */ new WeakMap();
138
+ /**
139
+ * Add an event listener with automatic cleanup tracking
140
+ */
141
+ static addListener(n, t, s, r) {
142
+ n.addEventListener(t, s, r);
143
+ const o = {
144
+ event: t,
145
+ handler: s,
146
+ wrapper: s,
147
+ options: r,
148
+ cleanup: () => n.removeEventListener(t, s, r),
149
+ addedAt: Date.now()
150
+ };
151
+ this.cleanupFunctions.has(n) || this.cleanupFunctions.set(n, []);
152
+ const c = this.cleanupFunctions.get(n);
153
+ c.push(o), c.__metaList = c;
154
+ }
155
+ /**
156
+ * Remove a specific event listener
157
+ */
158
+ static removeListener(n, t, s, r) {
159
+ n.removeEventListener(t, s, r);
160
+ const i = this.cleanupFunctions.get(n);
161
+ if (i)
162
+ for (let o = 0; o < i.length; o++) {
163
+ const c = i[o];
164
+ if (c.event === t && c.handler === s) {
165
+ i.splice(o, 1), i.length === 0 && this.cleanupFunctions.delete(n);
166
+ return;
167
+ }
168
+ }
169
+ }
170
+ /**
171
+ * Clean up all event listeners for an element
172
+ */
173
+ static cleanup(n) {
174
+ const t = this.cleanupFunctions.get(n);
175
+ t && (t.forEach((s) => {
176
+ try {
177
+ s.cleanup();
178
+ } catch {
179
+ }
180
+ }), this.cleanupFunctions.delete(n));
181
+ }
182
+ /**
183
+ * Clean up all tracked event listeners (useful for testing)
184
+ */
185
+ static cleanupAll() {
186
+ this.cleanupFunctions = /* @__PURE__ */ new WeakMap();
187
+ }
188
+ /**
189
+ * Check if an element has any tracked event listeners
190
+ */
191
+ static hasListeners(n) {
192
+ const t = this.cleanupFunctions.get(n);
193
+ return !!(t && t.length > 0);
194
+ }
195
+ /**
196
+ * Get the number of tracked event listeners for an element
197
+ */
198
+ static getListenerCount(n) {
199
+ const t = this.cleanupFunctions.get(n);
200
+ return t ? t.length : 0;
201
+ }
202
+ /**
203
+ * Return listener metadata stored for the element (test/debug only)
204
+ */
205
+ static getListenerInfo(n) {
206
+ const t = this.cleanupFunctions.get(n);
207
+ return t ? t.map((s) => ({
208
+ event: s.event,
209
+ handler: s.handler,
210
+ wrapper: s.wrapper,
211
+ options: s.options
212
+ })) : [];
213
+ }
214
+ }
215
+ class Rt {
216
+ static cache = /* @__PURE__ */ new Map();
217
+ static maxCacheSize = 1e3;
218
+ // Dangerous patterns to block
219
+ static dangerousPatterns = [
220
+ /constructor/i,
221
+ /prototype/i,
222
+ /__proto__/i,
223
+ /function/i,
224
+ /eval/i,
225
+ /import/i,
226
+ /require/i,
227
+ /window/i,
228
+ /document/i,
229
+ /global/i,
230
+ /process/i,
231
+ /setTimeout/i,
232
+ /setInterval/i,
233
+ /fetch/i,
234
+ /XMLHttpRequest/i
235
+ ];
236
+ static evaluate(n, t) {
237
+ const s = this.cache.get(n);
238
+ if (s) {
239
+ if (!s.isSecure) {
240
+ V("Blocked cached dangerous expression:", n);
241
+ return;
242
+ }
243
+ try {
244
+ this.cache.delete(n), this.cache.set(n, s);
245
+ } catch {
246
+ }
247
+ return s.evaluator(t);
248
+ }
249
+ const r = this.createEvaluator(n);
250
+ if (this.cache.size >= this.maxCacheSize) {
251
+ const i = this.cache.keys().next().value;
252
+ i && this.cache.delete(i);
253
+ }
254
+ if (this.cache.set(n, r), !r.isSecure) {
255
+ V("Blocked dangerous expression:", n);
256
+ return;
257
+ }
258
+ return r.evaluator(t);
259
+ }
260
+ static createEvaluator(n) {
261
+ if (this.hasDangerousPatterns(n))
262
+ return { evaluator: () => {
263
+ }, isSecure: !1 };
264
+ if (n.length > 1e3)
265
+ return { evaluator: () => {
266
+ }, isSecure: !1 };
267
+ try {
268
+ return { evaluator: this.createSafeEvaluator(n), isSecure: !0 };
269
+ } catch (t) {
270
+ return V("Failed to create evaluator for expression:", n, t), { evaluator: () => {
271
+ }, isSecure: !1 };
272
+ }
273
+ }
274
+ static hasDangerousPatterns(n) {
275
+ return this.dangerousPatterns.some((t) => t.test(n));
276
+ }
277
+ static createSafeEvaluator(n) {
278
+ const t = n.trim();
279
+ if (t.startsWith("{") && t.endsWith("}"))
280
+ return this.createObjectEvaluator(n);
281
+ if (/^ctx\.[a-zA-Z0-9_.]+$/.test(n.trim())) {
282
+ const s = n.trim().slice(4);
283
+ return (r) => K(r, s);
284
+ }
285
+ return n.includes("ctx") || /[+\-*/%<>=&|?:[\]]/.test(n) ? this.createSimpleEvaluator(n) : (s) => K(s, n);
286
+ }
287
+ static createObjectEvaluator(n) {
288
+ const t = n.trim().slice(1, -1), s = this.parseObjectProperties(t);
289
+ return (r) => {
290
+ const i = {};
291
+ for (const { key: o, value: c } of s)
292
+ try {
293
+ if (c.startsWith("ctx.")) {
294
+ const f = c.slice(4);
295
+ i[o] = K(r, f);
296
+ } else
297
+ i[o] = this.evaluateSimpleValue(c, r);
298
+ } catch {
299
+ i[o] = void 0;
300
+ }
301
+ return i;
302
+ };
303
+ }
304
+ static parseObjectProperties(n) {
305
+ const t = [], s = n.split(",");
306
+ for (const r of s) {
307
+ const i = r.indexOf(":");
308
+ if (i === -1) continue;
309
+ const o = r.slice(0, i).trim(), c = r.slice(i + 1).trim(), f = o.replace(/^['"]|['"]$/g, "");
310
+ t.push({ key: f, value: c });
311
+ }
312
+ return t;
313
+ }
314
+ static createSimpleEvaluator(n) {
315
+ return (t) => {
316
+ try {
317
+ let s = n;
318
+ const r = [];
319
+ s = s.replace(
320
+ /("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')/g,
321
+ (p) => `<<#${r.push(p) - 1}#>>`
322
+ );
323
+ const i = s.match(/ctx\.[\w.]+/g) || [];
324
+ for (const p of i) {
325
+ const d = p.slice(4), C = K(t, d);
326
+ if (C === void 0) return;
327
+ const T = r.push(JSON.stringify(C)) - 1;
328
+ s = s.replace(
329
+ new RegExp(p.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"),
330
+ `<<#${T}#>>`
331
+ );
332
+ }
333
+ const o = /\b[a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)+\b/g, c = s.match(o) || [];
334
+ for (const p of c) {
335
+ if (p.startsWith("ctx.")) continue;
336
+ const d = K(t, p);
337
+ if (d === void 0) return;
338
+ const C = r.push(JSON.stringify(d)) - 1;
339
+ s = s.replace(
340
+ new RegExp(p.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"),
341
+ `<<#${C}#>>`
342
+ );
343
+ }
344
+ const f = /\b([a-zA-Z_][a-zA-Z0-9_]*)\b/g;
345
+ let u;
346
+ const m = /* @__PURE__ */ new Set();
347
+ for (; (u = f.exec(s)) !== null; ) {
348
+ const p = u[1];
349
+ if (["true", "false", "null", "undefined"].includes(p) || /^[0-9]+$/.test(p) || p === "ctx" || m.has(p)) continue;
350
+ m.add(p);
351
+ const d = K(t, p);
352
+ if (d === void 0) return;
353
+ const C = JSON.stringify(d), T = r.push(C) - 1;
354
+ p.includes(".") ? s = s.replace(
355
+ new RegExp(p.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"),
356
+ `<<#${T}#>>`
357
+ ) : s = s.replace(
358
+ new RegExp(
359
+ "\\b" + p.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "\\b",
360
+ "g"
361
+ ),
362
+ `<<#${T}#>>`
363
+ );
364
+ }
365
+ s = s.replace(
366
+ /<<#(\d+)#>>/g,
367
+ (p, d) => r[Number(d)]
368
+ );
369
+ try {
370
+ return this.evaluateBasicExpression(s);
371
+ } catch {
372
+ return;
373
+ }
374
+ } catch {
375
+ return;
376
+ }
377
+ };
378
+ }
379
+ /**
380
+ * Evaluate a very small, safe expression grammar without using eval/Function.
381
+ * Supports: numbers, string literals, true/false, null, arrays, unary !,
382
+ * arithmetic (+ - * / %), comparisons, logical && and ||, parentheses, and ternary `a ? b : c`.
383
+ */
384
+ static evaluateBasicExpression(n) {
385
+ const t = this.tokenize(n);
386
+ let s = 0;
387
+ function r() {
388
+ return t[s];
389
+ }
390
+ function i(y) {
391
+ const _ = t[s++];
392
+ if (y && !_)
393
+ throw new Error(`Unexpected token EOF, expected ${y}`);
394
+ if (y && _ && _.type !== y && _.value !== y)
395
+ throw new Error(
396
+ `Unexpected token ${_.type}/${_.value}, expected ${y}`
397
+ );
398
+ return _;
399
+ }
400
+ function o() {
401
+ return T();
402
+ }
403
+ function c(y) {
404
+ if (typeof y == "number") return y;
405
+ if (y == null) return NaN;
406
+ if (typeof y == "boolean") return y ? 1 : 0;
407
+ const _ = Number(y);
408
+ return Number.isNaN(_) ? NaN : _;
409
+ }
410
+ function f(y, _) {
411
+ return typeof y == "string" || typeof _ == "string" ? String(y) + String(_) : c(y) + c(_);
412
+ }
413
+ function u(y, _) {
414
+ return c(y) - c(_);
415
+ }
416
+ function m(y, _) {
417
+ return c(y) * c(_);
418
+ }
419
+ function p(y, _) {
420
+ return c(y) / c(_);
421
+ }
422
+ function d(y, _) {
423
+ return c(y) % c(_);
424
+ }
425
+ function C(y, _, l) {
426
+ if (typeof _ == "number" && typeof l == "number")
427
+ switch (y) {
428
+ case ">":
429
+ return _ > l;
430
+ case "<":
431
+ return _ < l;
432
+ case ">=":
433
+ return _ >= l;
434
+ case "<=":
435
+ return _ <= l;
436
+ default:
437
+ return !1;
438
+ }
439
+ const g = String(_), A = String(l);
440
+ switch (y) {
441
+ case ">":
442
+ return g > A;
443
+ case "<":
444
+ return g < A;
445
+ case ">=":
446
+ return g >= A;
447
+ case "<=":
448
+ return g <= A;
449
+ default:
450
+ return !1;
451
+ }
452
+ }
453
+ function T() {
454
+ const y = w(), _ = r();
455
+ if (_ && _.value === "?") {
456
+ i("?");
457
+ const l = o();
458
+ i(":");
459
+ const g = o();
460
+ return y ? l : g;
461
+ }
462
+ return y;
463
+ }
464
+ function w() {
465
+ let y = a();
466
+ for (; ; ) {
467
+ const _ = r();
468
+ if (!_ || _.value !== "||") break;
469
+ i("OP");
470
+ const l = a();
471
+ y = y || l;
472
+ }
473
+ return y;
474
+ }
475
+ function a() {
476
+ let y = E();
477
+ for (; ; ) {
478
+ const _ = r();
479
+ if (!_ || _.value !== "&&") break;
480
+ i("OP");
481
+ const l = E();
482
+ y = y && l;
483
+ }
484
+ return y;
485
+ }
486
+ function E() {
487
+ let y = v();
488
+ for (; ; ) {
489
+ const _ = r();
490
+ if (!_ || !["==", "!=", "===", "!=="].includes(_.value)) break;
491
+ const l = i("OP").value, g = v();
492
+ switch (l) {
493
+ case "==":
494
+ y = y == g;
495
+ break;
496
+ case "!=":
497
+ y = y != g;
498
+ break;
499
+ case "===":
500
+ y = y === g;
501
+ break;
502
+ case "!==":
503
+ y = y !== g;
504
+ break;
505
+ }
506
+ }
507
+ return y;
508
+ }
509
+ function v() {
510
+ let y = b();
511
+ for (; ; ) {
512
+ const _ = r();
513
+ if (!_ || ![">", "<", ">=", "<="].includes(_.value)) break;
514
+ const l = i("OP").value, g = b();
515
+ switch (l) {
516
+ case ">":
517
+ y = C(">", y, g);
518
+ break;
519
+ case "<":
520
+ y = C("<", y, g);
521
+ break;
522
+ case ">=":
523
+ y = C(">=", y, g);
524
+ break;
525
+ case "<=":
526
+ y = C("<=", y, g);
527
+ break;
528
+ }
529
+ }
530
+ return y;
531
+ }
532
+ function b() {
533
+ let y = h();
534
+ for (; ; ) {
535
+ const _ = r();
536
+ if (!_ || _.value !== "+" && _.value !== "-") break;
537
+ const l = i("OP").value, g = h();
538
+ y = l === "+" ? f(y, g) : u(y, g);
539
+ }
540
+ return y;
541
+ }
542
+ function h() {
543
+ let y = k();
544
+ for (; ; ) {
545
+ const _ = r();
546
+ if (!_ || _.value !== "*" && _.value !== "/" && _.value !== "%")
547
+ break;
548
+ const l = i("OP").value, g = k();
549
+ switch (l) {
550
+ case "*":
551
+ y = m(y, g);
552
+ break;
553
+ case "/":
554
+ y = p(y, g);
555
+ break;
556
+ case "%":
557
+ y = d(y, g);
558
+ break;
559
+ }
560
+ }
561
+ return y;
562
+ }
563
+ function k() {
564
+ const y = r();
565
+ if (y && y.value === "!")
566
+ return i("OP"), !k();
567
+ if (y && y.value === "-") {
568
+ i("OP");
569
+ const _ = k();
570
+ return u(0, _);
571
+ }
572
+ return S();
573
+ }
574
+ function S() {
575
+ const y = r();
576
+ if (y) {
577
+ if (y.type === "NUMBER")
578
+ return i("NUMBER"), Number(y.value);
579
+ if (y.type === "STRING")
580
+ return i("STRING"), y.value.slice(1, -1);
581
+ if (y.type === "IDENT")
582
+ return i("IDENT"), y.value === "true" ? !0 : y.value === "false" ? !1 : y.value === "null" ? null : void 0;
583
+ if (y.value === "[") {
584
+ i("PUNC");
585
+ const _ = [];
586
+ for (; ; ) {
587
+ const l = r();
588
+ if (!l || l.value === "]") break;
589
+ _.push(o());
590
+ const g = r();
591
+ g && g.value === "," && i("PUNC");
592
+ }
593
+ return i("PUNC"), _;
594
+ }
595
+ if (y.value === "(") {
596
+ i("PUNC");
597
+ const _ = o();
598
+ return i("PUNC"), _;
599
+ }
600
+ throw new Error("Unexpected token in expression");
601
+ }
602
+ }
603
+ return o();
604
+ }
605
+ static tokenize(n) {
606
+ const t = [], s = /\s*(=>|===|!==|==|!=|>=|<=|\|\||&&|[()?:,[\]]|\+|-|\*|\/|%|>|<|!|\d+\.?\d*|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[a-zA-Z_][a-zA-Z0-9_]*|\S)\s*/g;
607
+ let r;
608
+ for (; (r = s.exec(n)) !== null; ) {
609
+ const i = r[1];
610
+ i && (/^\d/.test(i) ? t.push({ type: "NUMBER", value: i }) : /^"/.test(i) || /^'/.test(i) ? t.push({ type: "STRING", value: i }) : /^[a-zA-Z_]/.test(i) ? t.push({ type: "IDENT", value: i }) : /^[()?:,[\]]$/.test(i) ? t.push({ type: "PUNC", value: i }) : t.push({ type: "OP", value: i }));
611
+ }
612
+ return t;
613
+ }
614
+ static evaluateSimpleValue(n, t) {
615
+ if (n === "true") return !0;
616
+ if (n === "false") return !1;
617
+ if (!isNaN(Number(n))) return Number(n);
618
+ if (n.startsWith("ctx.")) {
619
+ const s = n.slice(4);
620
+ return K(t, s);
621
+ }
622
+ return n.startsWith('"') && n.endsWith('"') || n.startsWith("'") && n.endsWith("'") ? n.slice(1, -1) : n;
623
+ }
624
+ static clearCache() {
625
+ this.cache.clear();
626
+ }
627
+ static getCacheSize() {
628
+ return this.cache.size;
629
+ }
630
+ }
631
+ function Re(e, n) {
632
+ return Array.isArray(e) && Array.isArray(n) ? JSON.stringify([...e].sort()) !== JSON.stringify([...n].sort()) : e !== n;
633
+ }
634
+ function it(e, n, t, s, r) {
635
+ if (e) {
636
+ const i = n.value;
637
+ if (r && typeof i == "object" && i !== null) {
638
+ const o = { ...i };
639
+ o[r] = t, n.value = o;
640
+ } else
641
+ n.value = t;
642
+ } else {
643
+ const i = s._state || s;
644
+ We(i, n, t);
645
+ }
646
+ }
647
+ function Ie(e, n, t, s) {
648
+ if (typeof e._requestRender == "function" && e._requestRender(), typeof e._triggerWatchers == "function") {
649
+ const r = n ? "reactiveState" : t;
650
+ e._triggerWatchers(r, s);
651
+ }
652
+ }
653
+ function It(e, n, t) {
654
+ const s = `update:${Y(n)}`, r = `update:${n}`, i = new CustomEvent(s, {
655
+ detail: t,
656
+ bubbles: !0,
657
+ cancelable: !0
658
+ }), o = new CustomEvent(r, {
659
+ detail: t,
660
+ bubbles: !0,
661
+ cancelable: !0
662
+ });
663
+ e.dispatchEvent(i), e.dispatchEvent(o);
664
+ }
665
+ function ct(e, n, t, s) {
666
+ const r = t;
667
+ if (x(() => {
668
+ if (typeof e.setAttribute == "function")
669
+ try {
670
+ e[n] = r;
671
+ } catch {
672
+ }
673
+ else
674
+ e[n] = r;
675
+ }), r == null || typeof r == "string" || typeof r == "number" || typeof r == "boolean") {
676
+ const i = F(r);
677
+ i !== null ? x(() => {
678
+ typeof e.setAttribute == "function" && U(
679
+ e,
680
+ Y(n),
681
+ String(i)
682
+ );
683
+ }) : x(() => {
684
+ typeof e.removeAttribute == "function" && G(e, Y(n));
685
+ });
686
+ }
687
+ }
688
+ function Dt(e, n, t, s) {
689
+ if (e) {
690
+ const r = n.value;
691
+ return s && typeof r == "object" && r !== null ? r[s] : r;
692
+ } else {
693
+ const r = t._state || t;
694
+ return K(r, n);
695
+ }
696
+ }
697
+ function Ne(e) {
698
+ return e != null && typeof e == "object" && "value" in e;
699
+ }
700
+ function Ze(e) {
701
+ return e != null && typeof e == "object" && "value" in e ? e.value : e;
702
+ }
703
+ function oe(e, n, t) {
704
+ if (!e) return;
705
+ e.attrs || (e.attrs = {});
706
+ const s = e.attrs;
707
+ s[n] = t;
708
+ }
709
+ function Q(e) {
710
+ return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement;
711
+ }
712
+ function pe(e) {
713
+ return e != null && typeof e == "object" && "value" in e ? pe(e.value) : !(e != null && typeof e == "object" || e === !1 || e === "false" || e === null || e === void 0 || e === 0);
714
+ }
715
+ function ht(e) {
716
+ return e.substring(2, 3).toLowerCase() + e.substring(3);
717
+ }
718
+ function Je(e) {
719
+ return typeof e == "boolean" || e === "true" || e === "false";
720
+ }
721
+ function Bt(e, n, t, s, r, i, o, c) {
722
+ if (!i) return;
723
+ const f = n.includes("lazy"), u = n.includes("trim"), m = n.includes("number"), p = () => {
724
+ if (M(e)) {
725
+ const h = e.value;
726
+ return c && o && (o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement) && typeof h == "object" && h !== null ? h[c] : h;
727
+ }
728
+ const b = i?._state || i;
729
+ return K(b, e);
730
+ }, d = p();
731
+ let C = "text";
732
+ o instanceof HTMLInputElement ? C = s?.type || o.type || "text" : o instanceof HTMLSelectElement ? C = "select" : o instanceof HTMLTextAreaElement && (C = "textarea");
733
+ const T = o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement, a = T ? C === "checkbox" || C === "radio" ? "checked" : "value" : c ?? "modelValue";
734
+ if (C === "checkbox")
735
+ if (Array.isArray(d))
736
+ t[a] = d.includes(
737
+ String(o?.getAttribute("value") ?? s?.value ?? "")
738
+ );
739
+ else {
740
+ const b = o?.getAttribute("true-value") ?? !0;
741
+ t[a] = d === b;
742
+ }
743
+ else if (C === "radio")
744
+ t[a] = d === (s?.value ?? "");
745
+ else if (C === "select")
746
+ if (o && o.hasAttribute("multiple") && o instanceof HTMLSelectElement) {
747
+ const b = Array.isArray(d) ? d.map(String) : [];
748
+ setTimeout(() => {
749
+ Array.from(o.options).forEach((h) => {
750
+ h.selected = b.includes(h.value);
751
+ });
752
+ }, 0), t[a] = Array.isArray(d) ? d : [];
753
+ } else
754
+ t[a] = d;
755
+ else {
756
+ !T && M(e) ? t[a] = e : t[a] = d;
757
+ try {
758
+ const b = Y(a);
759
+ s && (s[b] = d);
760
+ } catch {
761
+ }
762
+ }
763
+ const E = f || C === "checkbox" || C === "radio" || C === "select" ? "change" : "input", v = (b) => {
764
+ if (b.isComposing || r._isComposing)
765
+ return;
766
+ const h = globalThis.process, k = !!h && h.env?.NODE_ENV === "test" || typeof window < "u" && globalThis.__vitest__;
767
+ if (b.isTrusted === !1 && !k)
768
+ return;
769
+ const S = b.target;
770
+ if (!S || S._modelUpdating)
771
+ return;
772
+ let L = S.value;
773
+ if (C === "checkbox") {
774
+ const l = p();
775
+ if (Array.isArray(l)) {
776
+ const g = S.getAttribute("value") ?? "", A = Array.from(l);
777
+ if (S.checked)
778
+ A.includes(g) || A.push(g);
779
+ else {
780
+ const N = A.indexOf(g);
781
+ N > -1 && A.splice(N, 1);
782
+ }
783
+ L = A;
784
+ } else {
785
+ const g = S.getAttribute("true-value") ?? !0, A = S.getAttribute("false-value") ?? !1;
786
+ L = S.checked ? g : A;
787
+ }
788
+ } else if (C === "radio")
789
+ L = S.getAttribute("value") ?? S.value;
790
+ else if (C === "select" && S.multiple)
791
+ L = Array.from(S.selectedOptions).map(
792
+ (l) => l.value
793
+ );
794
+ else if (u && typeof L == "string" && (L = L.trim()), m) {
795
+ const l = Number(L);
796
+ isNaN(l) || (L = l);
797
+ }
798
+ const y = p();
799
+ if (Re(L, y)) {
800
+ S._modelUpdating = !0;
801
+ try {
802
+ it(M(e), e, L, i, c), Ie(i, M(e), e, L), S && It(S, a, L);
803
+ } finally {
804
+ setTimeout(
805
+ () => S._modelUpdating = !1,
806
+ 0
807
+ );
808
+ }
809
+ }
810
+ };
811
+ if (T) {
812
+ if (r[E]) {
813
+ const b = r[E];
814
+ o && ne.removeListener(o, E, b);
815
+ }
816
+ r[E] = v;
817
+ } else {
818
+ const b = `update:${Y(a)}`, h = `update:${a}`;
819
+ if (r[b]) {
820
+ const k = r[b];
821
+ o && ne.removeListener(o, b, k);
822
+ }
823
+ if (r[h]) {
824
+ const k = r[h];
825
+ o && ne.removeListener(o, h, k);
826
+ }
827
+ if (r[b] = (k) => {
828
+ const S = k.detail;
829
+ let L = S !== void 0 ? S : void 0;
830
+ if (L === void 0) {
831
+ const l = k.target;
832
+ if (l && typeof l == "object" && "value" in l)
833
+ try {
834
+ L = l.value;
835
+ } catch {
836
+ L = void 0;
837
+ }
838
+ }
839
+ const y = Dt(
840
+ M(e),
841
+ e,
842
+ i,
843
+ c
844
+ );
845
+ if (Re(L, y)) {
846
+ it(M(e), e, L, i, c), Ie(i, M(e), e, L);
847
+ const l = k.target;
848
+ l && ct(
849
+ l,
850
+ a,
851
+ M(e) ? e : L,
852
+ M(e)
853
+ );
854
+ }
855
+ }, M(e) && typeof e.value == "object" && e.value !== null) {
856
+ let k;
857
+ try {
858
+ k = Reflect.ownKeys(e.value);
859
+ } catch {
860
+ k = Object.keys(e.value);
861
+ }
862
+ const S = k.filter(
863
+ (L) => typeof L == "string" && !String(L).startsWith("_") && L !== "constructor"
864
+ );
865
+ for (const L of S) {
866
+ const y = String(L), _ = `update:${Y(y)}`, l = `update:${y}`;
867
+ r[_] || (r[_] = (g) => {
868
+ const A = g.detail !== void 0 ? g.detail : g.target?.value, N = M(e) ? e.value[y] : K(
869
+ i?._state || i,
870
+ e
871
+ );
872
+ if (!Re(A, N)) return;
873
+ if (M(e)) {
874
+ const D = {
875
+ ...e.value
876
+ };
877
+ D[y] = A, e.value = D;
878
+ } else
879
+ We(
880
+ i?._state || i,
881
+ e,
882
+ A
883
+ );
884
+ Ie(i, M(e), e, A);
885
+ const P = g.currentTarget || o || g.target;
886
+ P && ct(
887
+ P,
888
+ a,
889
+ M(e) ? e : A,
890
+ M(e)
891
+ );
892
+ }, r[l] = r[_]);
893
+ }
894
+ }
895
+ r[h] = r[b];
896
+ }
897
+ (C === "text" || C === "textarea") && (r.compositionstart = () => r._isComposing = !0, r.compositionend = (b) => {
898
+ r._isComposing = !1;
899
+ const h = b.target;
900
+ h && setTimeout(() => {
901
+ const k = h.value, S = i?._state || i, L = K(S, e);
902
+ let y = k;
903
+ if (u && (y = y.trim()), m) {
904
+ const l = Number(y);
905
+ isNaN(l) || (y = l);
906
+ }
907
+ if (Re(y, L)) {
908
+ h._modelUpdating = !0;
909
+ try {
910
+ We(S, e, y), Ie(i, M(e), e, y);
911
+ } finally {
912
+ setTimeout(
913
+ () => h._modelUpdating = !1,
914
+ 0
915
+ );
916
+ }
917
+ }
918
+ }, 0);
919
+ });
920
+ }
921
+ function Wt(e, n, t, s, r) {
922
+ if (typeof e == "object" && e !== null)
923
+ for (const [i, o] of Object.entries(e))
924
+ if (i.startsWith("data-") || i.startsWith("aria-") || i === "class")
925
+ t[i] = o;
926
+ else if (i === "disabled" && r && Q(r)) {
927
+ const c = o && typeof o == "object" && "value" in o;
928
+ (() => {
929
+ try {
930
+ return M(o);
931
+ } catch {
932
+ return !1;
933
+ }
934
+ })() || c ? n[i] = o : t[i] = o;
935
+ } else
936
+ n[i] = o;
937
+ else if (typeof e == "string") {
938
+ if (!s) return;
939
+ try {
940
+ const i = Me(e, s);
941
+ if (typeof i == "object" && i !== null) {
942
+ for (const [o, c] of Object.entries(i))
943
+ if (o.startsWith("data-") || o.startsWith("aria-") || o === "class")
944
+ t[o] = c;
945
+ else if (o === "disabled" && r && Q(r)) {
946
+ const f = c && typeof c == "object" && "value" in c;
947
+ (() => {
948
+ try {
949
+ return M(c);
950
+ } catch {
951
+ return !1;
952
+ }
953
+ })() || f ? n[o] = c : t[o] = c;
954
+ } else
955
+ n[o] = c;
956
+ return;
957
+ } else {
958
+ t[e] = i;
959
+ return;
960
+ }
961
+ } catch {
962
+ const i = K(
963
+ s,
964
+ e
965
+ );
966
+ t[e] = i;
967
+ }
968
+ }
969
+ }
970
+ function Ut(e, n, t) {
971
+ let s;
972
+ if (typeof e == "string") {
973
+ if (!t) return;
974
+ s = Me(e, t);
975
+ } else
976
+ s = e;
977
+ const r = String(n.style || "");
978
+ let i = r;
979
+ if (s) {
980
+ if (r) {
981
+ const o = String(r).split(";").map((f) => f.trim()).filter(Boolean), c = o.findIndex(
982
+ (f) => f.startsWith("display:")
983
+ );
984
+ c >= 0 && o[c] === "display: none" && (o.splice(c, 1), i = o.length > 0 ? o.join("; ") + ";" : "");
985
+ }
986
+ } else if (r) {
987
+ const o = String(r).split(";").filter(Boolean), c = o.findIndex(
988
+ (f) => f.trim().startsWith("display:")
989
+ );
990
+ c >= 0 ? o[c] = "display: none" : o.push("display: none"), i = o.join("; ");
991
+ } else
992
+ i = "display: none";
993
+ i !== r && (i ? n.style = i : n.style = void 0);
994
+ }
995
+ function Me(e, n) {
996
+ return Rt.evaluate(e, n);
997
+ }
998
+ function zt(e, n, t, s) {
999
+ let r;
1000
+ if (typeof e == "string") {
1001
+ if (!t) return;
1002
+ r = Me(e, t);
1003
+ } else
1004
+ r = e;
1005
+ try {
1006
+ if (r && typeof r == "object") {
1007
+ if (M(r))
1008
+ r = r.value;
1009
+ else if ("value" in r && typeof r.value < "u") {
1010
+ const u = r.value;
1011
+ u instanceof Node || (r = u);
1012
+ }
1013
+ }
1014
+ } catch {
1015
+ }
1016
+ let i = [];
1017
+ if (typeof r == "string")
1018
+ i = [r];
1019
+ else if (Array.isArray(r))
1020
+ i = r.filter(Boolean);
1021
+ else if (typeof r == "object" && r !== null)
1022
+ for (const [u, m] of Object.entries(r))
1023
+ m && i.push(u);
1024
+ const o = i.join(" "), c = s && s.class || n.class || "", f = c ? `${c} ${o}`.trim() : o.trim();
1025
+ f ? n.class = f : n.class = void 0;
1026
+ }
1027
+ function Kt(e, n, t) {
1028
+ let s;
1029
+ if (typeof e == "string") {
1030
+ if (!t) return;
1031
+ s = Me(e, t);
1032
+ } else
1033
+ s = e;
1034
+ let r = "";
1035
+ if (typeof s == "string")
1036
+ r = s;
1037
+ else if (s && typeof s == "object") {
1038
+ const o = [];
1039
+ for (const [c, f] of Object.entries(s))
1040
+ if (f != null && f !== "") {
1041
+ const u = c.replace(
1042
+ /[A-Z]/g,
1043
+ (d) => `-${d.toLowerCase()}`
1044
+ ), m = [
1045
+ "width",
1046
+ "height",
1047
+ "top",
1048
+ "right",
1049
+ "bottom",
1050
+ "left",
1051
+ "margin",
1052
+ "margin-top",
1053
+ "margin-right",
1054
+ "margin-bottom",
1055
+ "margin-left",
1056
+ "padding",
1057
+ "padding-top",
1058
+ "padding-right",
1059
+ "padding-bottom",
1060
+ "padding-left",
1061
+ "font-size",
1062
+ "line-height",
1063
+ "border-width",
1064
+ "border-radius",
1065
+ "min-width",
1066
+ "max-width",
1067
+ "min-height",
1068
+ "max-height"
1069
+ ];
1070
+ let p = String(f);
1071
+ typeof f == "number" && m.includes(u) && (p = `${f}px`), o.push(`${u}: ${p}`);
1072
+ }
1073
+ r = o.join("; ") + (o.length > 0 ? ";" : "");
1074
+ }
1075
+ const i = String(n.style || "");
1076
+ n.style = i + (i && !i.endsWith(";") ? "; " : "") + r;
1077
+ }
1078
+ function Ft(e, n, t) {
1079
+ let s = e;
1080
+ typeof e == "string" && t && (s = Me(e, t)), M(s) ? n.reactiveRef = s : n.ref = s;
1081
+ }
1082
+ function yt(e, n, t, s) {
1083
+ const r = {}, i = { ...s || {} }, o = {};
1084
+ for (const [c, f] of Object.entries(e)) {
1085
+ const { value: u, modifiers: m, arg: p } = f;
1086
+ if (c === "model" || c.startsWith("model:")) {
1087
+ const d = c.split(":"), C = d.length > 1 ? d[1] : p;
1088
+ Bt(
1089
+ u,
1090
+ // Pass the original value (could be string or reactive state object)
1091
+ m,
1092
+ r,
1093
+ i,
1094
+ o,
1095
+ n,
1096
+ t,
1097
+ C
1098
+ );
1099
+ continue;
1100
+ }
1101
+ switch (c) {
1102
+ case "bind":
1103
+ Wt(u, r, i, n, t);
1104
+ break;
1105
+ case "show":
1106
+ Ut(u, i, n);
1107
+ break;
1108
+ case "class":
1109
+ zt(u, i, n, s);
1110
+ break;
1111
+ case "style":
1112
+ Kt(u, i, n);
1113
+ break;
1114
+ case "ref":
1115
+ Ft(u, r, n);
1116
+ break;
1117
+ }
1118
+ }
1119
+ try {
1120
+ if (Object.prototype.hasOwnProperty.call(r, "disabled") && t && Q(t)) {
1121
+ const f = r.disabled, u = f && typeof f == "object" && "value" in f;
1122
+ let m = !1;
1123
+ try {
1124
+ m = M(f);
1125
+ } catch {
1126
+ m = !1;
1127
+ }
1128
+ if (!u && !m)
1129
+ try {
1130
+ i.disabled = f, delete r.disabled;
1131
+ const p = globalThis;
1132
+ p.__VDOM_DISABLED_PROMOTIONS || (p.__VDOM_DISABLED_PROMOTIONS = []), p.__VDOM_DISABLED_PROMOTIONS.push({
1133
+ phase: "bind-directive:postfix-move",
1134
+ location: "attrs",
1135
+ key: "disabled",
1136
+ value: f,
1137
+ time: Date.now(),
1138
+ stack: new Error().stack
1139
+ });
1140
+ } catch {
1141
+ }
1142
+ }
1143
+ } catch {
1144
+ }
1145
+ return { props: r, attrs: i, listeners: o };
1146
+ }
1147
+ function be(e) {
1148
+ return e ? e.split(/\s+/).filter(Boolean) : [];
1149
+ }
1150
+ function ve(e, n) {
1151
+ if (n.length === 0) return;
1152
+ const t = n.filter(
1153
+ (s) => s && !e.classList.contains(s)
1154
+ );
1155
+ t.length > 0 && e.classList.add(...t);
1156
+ }
1157
+ function me(e, n) {
1158
+ if (n.length === 0) return;
1159
+ const t = n.filter(Boolean);
1160
+ t.length > 0 && e.classList.remove(...t);
1161
+ }
1162
+ let Ve = !1;
1163
+ async function Vt(e, n, t = 10) {
1164
+ if (!Ve) {
1165
+ if (!e.isConnected) {
1166
+ V("⚠️ Element not connected to DOM, skipping style wait");
1167
+ return;
1168
+ }
1169
+ for (let s = 0; s < t; s++) {
1170
+ const r = window.getComputedStyle(e), i = r.transform && r.transform !== "", o = r.opacity && r.opacity !== "";
1171
+ if (i || o) {
1172
+ Ve = !0;
1173
+ return;
1174
+ }
1175
+ await new Promise(
1176
+ (c) => requestAnimationFrame(() => c(void 0))
1177
+ );
1178
+ }
1179
+ Ve = !0, V("⚠️ Styles did not load in time for transition, continuing anyway");
1180
+ }
1181
+ }
1182
+ function qt(e) {
1183
+ const n = window.getComputedStyle(e), t = n.transitionDuration || "0s", s = n.transitionDelay || "0s", r = (i) => {
1184
+ const o = parseFloat(i);
1185
+ return i.includes("ms") ? o : o * 1e3;
1186
+ };
1187
+ return r(t) + r(s);
1188
+ }
1189
+ function mt(e, n) {
1190
+ return new Promise((t) => {
1191
+ const s = n ?? qt(e);
1192
+ if (s <= 0) {
1193
+ t();
1194
+ return;
1195
+ }
1196
+ let r = !1;
1197
+ const i = () => {
1198
+ r || (r = !0, e.removeEventListener("transitionend", o), e.removeEventListener("transitioncancel", o), t());
1199
+ }, o = () => i();
1200
+ e.addEventListener("transitionend", o), e.addEventListener("transitioncancel", o), setTimeout(i, s + 50);
1201
+ });
1202
+ }
1203
+ async function we(e, n) {
1204
+ const { classes: t, hooks: s, css: r, duration: i } = n;
1205
+ if (s?.onBeforeEnter)
1206
+ try {
1207
+ s.onBeforeEnter(e);
1208
+ } catch (T) {
1209
+ B("Transition onBeforeEnter error:", T);
1210
+ }
1211
+ if (!r)
1212
+ return s?.onEnter ? new Promise((T) => {
1213
+ const w = s.onEnter;
1214
+ typeof w == "function" ? w(e, () => {
1215
+ if (s?.onAfterEnter)
1216
+ try {
1217
+ s.onAfterEnter(e);
1218
+ } catch (a) {
1219
+ B("Transition onAfterEnter error:", a);
1220
+ }
1221
+ T();
1222
+ }) : T();
1223
+ }) : void 0;
1224
+ const o = be(t?.enterFrom), c = be(t?.enterActive), f = be(t?.enterTo);
1225
+ ve(e, o), e.offsetHeight, ve(e, c), e.offsetHeight;
1226
+ let u;
1227
+ if (s?.onEnter) {
1228
+ const T = new Promise((w) => {
1229
+ u = w;
1230
+ });
1231
+ try {
1232
+ const w = s.onEnter;
1233
+ typeof w == "function" && w(e, () => {
1234
+ u && u();
1235
+ });
1236
+ } catch (w) {
1237
+ B("Transition onEnter error:", w);
1238
+ }
1239
+ u && await T;
1240
+ }
1241
+ await new Promise(
1242
+ (T) => requestAnimationFrame(() => T(void 0))
1243
+ ), e.offsetHeight;
1244
+ const m = window.getComputedStyle(e), p = m.transform, d = m.opacity;
1245
+ me(e, o), p && p !== "none" && (e.style.transform = p), d && d !== "" && (e.style.opacity = d), e.offsetHeight, await new Promise(
1246
+ (T) => requestAnimationFrame(() => T(void 0))
1247
+ ), e.style.transform = "", e.style.opacity = "", ve(e, f), e.offsetHeight, await new Promise(
1248
+ (T) => requestAnimationFrame(() => T(void 0))
1249
+ );
1250
+ let C;
1251
+ if (typeof i == "number" ? C = i : i && typeof i == "object" && "enter" in i && (C = i.enter), await mt(e, C), me(e, c), s?.onAfterEnter)
1252
+ try {
1253
+ s.onAfterEnter(e);
1254
+ } catch (T) {
1255
+ B("Transition onAfterEnter error:", T);
1256
+ }
1257
+ }
1258
+ async function qe(e, n) {
1259
+ const { classes: t, hooks: s, css: r, duration: i } = n;
1260
+ if (s?.onBeforeLeave)
1261
+ try {
1262
+ s.onBeforeLeave(e);
1263
+ } catch (p) {
1264
+ B("Transition onBeforeLeave error:", p);
1265
+ }
1266
+ if (!r)
1267
+ return s?.onLeave ? new Promise((p) => {
1268
+ const d = s.onLeave;
1269
+ typeof d == "function" ? d(e, () => {
1270
+ if (s?.onAfterLeave)
1271
+ try {
1272
+ s.onAfterLeave(e);
1273
+ } catch (C) {
1274
+ B("Transition onAfterLeave error:", C);
1275
+ }
1276
+ p();
1277
+ }) : p();
1278
+ }) : void 0;
1279
+ const o = be(t?.leaveFrom), c = be(t?.leaveActive), f = be(t?.leaveTo);
1280
+ ve(e, o), e.offsetHeight, ve(e, c);
1281
+ let u;
1282
+ if (s?.onLeave) {
1283
+ const p = new Promise((d) => {
1284
+ u = d;
1285
+ });
1286
+ try {
1287
+ const d = s.onLeave;
1288
+ typeof d == "function" && d(e, () => {
1289
+ u && u();
1290
+ });
1291
+ } catch (d) {
1292
+ B("Transition onLeave error:", d);
1293
+ }
1294
+ u && await p;
1295
+ }
1296
+ await new Promise(
1297
+ (p) => requestAnimationFrame(() => p(void 0))
1298
+ ), await Vt(e, [...o, ...c]), me(e, o), ve(e, f);
1299
+ let m;
1300
+ if (typeof i == "number" ? m = i : i && typeof i == "object" && "leave" in i && (m = i.leave), await mt(e, m), me(e, c), me(e, f), me(e, o), s?.onAfterLeave)
1301
+ try {
1302
+ s.onAfterLeave(e);
1303
+ } catch (p) {
1304
+ B("Transition onAfterLeave error:", p);
1305
+ }
1306
+ }
1307
+ const gt = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakMap();
1308
+ function De(e) {
1309
+ if (!e) return;
1310
+ const n = gt.get(e);
1311
+ if (n !== void 0) return n;
1312
+ try {
1313
+ const t = e;
1314
+ if (t && t.key != null) return String(t.key);
1315
+ } catch {
1316
+ }
1317
+ if (e instanceof Element) {
1318
+ const t = e.getAttribute("data-anchor-key");
1319
+ if (t) return t;
1320
+ }
1321
+ }
1322
+ function Z(e, n) {
1323
+ try {
1324
+ gt.set(e, n);
1325
+ } catch {
1326
+ }
1327
+ try {
1328
+ e.key = n;
1329
+ } catch {
1330
+ }
1331
+ try {
1332
+ if (e instanceof Element) {
1333
+ const t = F(n);
1334
+ t !== null && U(e, "data-anchor-key", t);
1335
+ }
1336
+ } catch {
1337
+ }
1338
+ }
1339
+ function Gt(e) {
1340
+ if (!e) return;
1341
+ const n = bt.get(e);
1342
+ if (n !== void 0) return n;
1343
+ try {
1344
+ const t = e;
1345
+ if (t && t._transitionGroup != null)
1346
+ return t._transitionGroup;
1347
+ } catch {
1348
+ }
1349
+ }
1350
+ function Zt(e, n) {
1351
+ try {
1352
+ bt.set(e, n);
1353
+ } catch {
1354
+ }
1355
+ try {
1356
+ e._transitionGroup = n;
1357
+ } catch {
1358
+ }
1359
+ }
1360
+ function de(e, n) {
1361
+ if (n) {
1362
+ if (e instanceof Element) {
1363
+ ne.cleanup(e);
1364
+ const t = [];
1365
+ for (const s in n)
1366
+ n[s] === e && t.push(s);
1367
+ for (const s of t)
1368
+ delete n[s];
1369
+ }
1370
+ if (e.hasChildNodes()) {
1371
+ const t = e.childNodes;
1372
+ for (let s = t.length - 1; s >= 0; s--)
1373
+ de(t[s], n);
1374
+ }
1375
+ }
1376
+ }
1377
+ function Te(e, n, t) {
1378
+ if (typeof e == "string") return;
1379
+ const s = e.props?.reactiveRef ?? (e.props?.props && e.props.props.reactiveRef), r = e.props?.ref ?? (e.props?.props && e.props.props.ref);
1380
+ if (s)
1381
+ try {
1382
+ if (M(s) || typeof s == "object" && "value" in s)
1383
+ s.value = n;
1384
+ else if (typeof s == "function")
1385
+ s(n);
1386
+ else if (typeof s == "string" && t)
1387
+ try {
1388
+ const i = String(s);
1389
+ t[i] = n;
1390
+ } catch {
1391
+ }
1392
+ } catch {
1393
+ }
1394
+ else if (r && t)
1395
+ try {
1396
+ const i = String(r);
1397
+ t[i] = n;
1398
+ } catch {
1399
+ }
1400
+ }
1401
+ function Ye(e, n) {
1402
+ if (Array.isArray(e)) {
1403
+ const i = /* @__PURE__ */ new Set();
1404
+ return e.map((o) => {
1405
+ if (!o || typeof o != "object") return o;
1406
+ let c = o.props?.key ?? o.key;
1407
+ if (!c) {
1408
+ const p = o.tag || "node", C = [
1409
+ // attrs (kebab-case)
1410
+ o.props?.attrs?.id,
1411
+ o.props?.attrs?.name,
1412
+ o.props?.attrs?.["data-key"],
1413
+ // promoted JS props (camelCase or original)
1414
+ o.props?.props?.id,
1415
+ o.props?.props?.name,
1416
+ o.props?.props?.dataKey,
1417
+ o.props?.props?.["data-key"]
1418
+ ].find((T) => T != null) ?? "";
1419
+ c = C ? `${n}:${p}:${C}` : `${n}:${p}`;
1420
+ }
1421
+ let f = c, u = 1;
1422
+ for (; i.has(f); )
1423
+ f = `${c}#${u++}`;
1424
+ i.add(f);
1425
+ let m = o.children;
1426
+ return Array.isArray(m) && (m = Ye(m, f)), { ...o, key: f, children: m };
1427
+ });
1428
+ }
1429
+ const t = e, s = t.props?.key ?? t.key ?? n;
1430
+ let r = t.children;
1431
+ return Array.isArray(r) && (r = Ye(r, s)), { ...t, key: s, children: r };
1432
+ }
1433
+ function at(e, n, t, s) {
1434
+ const r = t.directives ?? {}, i = t.attrs ? { ...t.attrs } : {}, o = yt(
1435
+ r,
1436
+ s,
1437
+ e,
1438
+ i
1439
+ ), c = {
1440
+ ...n.props || {},
1441
+ ...t.props || {},
1442
+ ...o.props || {}
1443
+ }, f = {
1444
+ ...i || {},
1445
+ ...o.attrs || {}
1446
+ }, u = n.props ?? {}, m = c, p = !!(t?.isCustomElement ?? n?.isCustomElement ?? !1);
1447
+ let d = !1;
1448
+ for (const a in { ...u, ...m }) {
1449
+ const E = u[a], v = m[a];
1450
+ let b = E, h = v;
1451
+ if (x(() => {
1452
+ (M(E) || Ne(E)) && (b = E.value);
1453
+ }), x(() => {
1454
+ (M(v) || Ne(v)) && (h = v.value);
1455
+ }), !(E === v && b === h))
1456
+ if (d = !0, a === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement)) {
1457
+ const k = Ze(v), S = k == null ? "" : String(k);
1458
+ e.value !== S && (e.value = S);
1459
+ } else if (a === "checked" && e instanceof HTMLInputElement) {
1460
+ const k = Ze(v);
1461
+ e.checked = !!k;
1462
+ } else if (a.startsWith("on") && typeof v == "function") {
1463
+ const k = ht(a);
1464
+ typeof E == "function" && ne.removeListener(e, k, E), typeof v == "function" && ne.addListener(e, k, v);
1465
+ try {
1466
+ if (k && k.startsWith("update:")) {
1467
+ const S = k.split(":", 2)[1], L = m[S];
1468
+ let y = [];
1469
+ try {
1470
+ if (M(L)) {
1471
+ const l = L.value;
1472
+ y = l && typeof l == "object" ? Object.keys(l) : [];
1473
+ } else L && typeof L == "object" && (y = Object.keys(L));
1474
+ } catch {
1475
+ y = [];
1476
+ }
1477
+ const _ = y.filter(
1478
+ (l) => typeof l == "string" && !l.startsWith("_") && l !== "constructor"
1479
+ );
1480
+ for (const l of _) {
1481
+ const g = `update:${l}`, A = (N) => {
1482
+ const O = N.detail !== void 0 ? N.detail : N.target instanceof HTMLInputElement || N.target instanceof HTMLTextAreaElement || N.target instanceof HTMLSelectElement ? N.target.value : void 0, D = { ...M(L) ? L.value || {} : m[S] || {}, [l]: O };
1483
+ try {
1484
+ typeof v == "function" && v({
1485
+ detail: D
1486
+ });
1487
+ } catch {
1488
+ }
1489
+ };
1490
+ x(() => {
1491
+ ne.addListener(e, g, A);
1492
+ });
1493
+ }
1494
+ }
1495
+ } catch {
1496
+ }
1497
+ } else if (v == null)
1498
+ G(e, a);
1499
+ else {
1500
+ const k = t?.isCustomElement ?? n?.isCustomElement ?? !1;
1501
+ if (k || a in e)
1502
+ try {
1503
+ e[a] = v, a === "disabled" && v === !1 && !k && Q(e) && G(e, "disabled");
1504
+ } catch {
1505
+ }
1506
+ else
1507
+ v === !1 && G(e, a);
1508
+ }
1509
+ }
1510
+ for (const [a, E] of Object.entries(
1511
+ o.listeners || {}
1512
+ )) {
1513
+ ne.addListener(e, a, E);
1514
+ try {
1515
+ const v = e && e.parentElement;
1516
+ v && v !== e && ne.addListener(
1517
+ v,
1518
+ a,
1519
+ E
1520
+ );
1521
+ } catch {
1522
+ }
1523
+ }
1524
+ const C = { ...n.attrs ?? {} }, T = f, w = o && o.attrs || {};
1525
+ if (Object.prototype.hasOwnProperty.call(w, "class") && typeof e.getAttribute == "function") {
1526
+ const a = e.getAttribute("class");
1527
+ a !== null && (C.class = a);
1528
+ }
1529
+ if (Object.prototype.hasOwnProperty.call(w, "style") && typeof e.getAttribute == "function") {
1530
+ const a = e.getAttribute("style");
1531
+ a !== null && (C.style = a);
1532
+ }
1533
+ try {
1534
+ if (Object.prototype.hasOwnProperty.call(w, "class") && w.class === void 0 && typeof e.getAttribute == "function") {
1535
+ const a = e.getAttribute("class");
1536
+ a !== null && (C.class = a);
1537
+ }
1538
+ if (Object.prototype.hasOwnProperty.call(w, "style") && w.style === void 0 && typeof e.getAttribute == "function") {
1539
+ const a = e.getAttribute("style");
1540
+ a !== null && (C.style = a);
1541
+ }
1542
+ try {
1543
+ if (typeof e.getAttribute == "function") {
1544
+ const a = e.getAttribute("class");
1545
+ try {
1546
+ e instanceof HTMLInputElement && e.type === "text" && a !== null && a !== C.class && (C.class = a);
1547
+ } catch {
1548
+ }
1549
+ }
1550
+ } catch {
1551
+ }
1552
+ } catch {
1553
+ }
1554
+ for (const a in { ...C, ...T }) {
1555
+ const E = C[a], v = T[a];
1556
+ let b = E, h = v;
1557
+ if (M(E) && (b = E.value), M(v) && (h = v.value), b !== h)
1558
+ if (d = !0, h == null || h === !1)
1559
+ x(() => {
1560
+ G(e, a);
1561
+ }), oe(n, a, void 0), a === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement ? x(() => {
1562
+ e.value = "";
1563
+ }) : e instanceof HTMLSelectElement ? x(() => {
1564
+ e.value = "";
1565
+ }) : e instanceof HTMLProgressElement && x(() => {
1566
+ e.value = 0;
1567
+ })), a === "checked" && e instanceof HTMLInputElement && x(() => {
1568
+ e.checked = !1;
1569
+ }), a === "disabled" && Q(e) && x(() => {
1570
+ (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement) && (e.disabled = !1);
1571
+ });
1572
+ else {
1573
+ if (a === "value") {
1574
+ if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) {
1575
+ x(() => {
1576
+ e.value = h ?? "";
1577
+ });
1578
+ continue;
1579
+ } else if (e instanceof HTMLSelectElement) {
1580
+ x(() => {
1581
+ e.value = h ?? "";
1582
+ });
1583
+ continue;
1584
+ } else if (e instanceof HTMLProgressElement) {
1585
+ x(() => {
1586
+ e.value = Number(h);
1587
+ });
1588
+ continue;
1589
+ }
1590
+ }
1591
+ if (a === "checked" && e instanceof HTMLInputElement) {
1592
+ x(() => {
1593
+ e.checked = !!h;
1594
+ });
1595
+ continue;
1596
+ }
1597
+ if (a === "style") {
1598
+ const S = F(h);
1599
+ S !== null && U(e, a, String(S)), oe(n, a, h);
1600
+ continue;
1601
+ }
1602
+ if (a === "class") {
1603
+ const S = F(h);
1604
+ S !== null && U(e, a, String(S)), oe(n, a, h);
1605
+ continue;
1606
+ }
1607
+ if (a === "disabled" && Q(e)) {
1608
+ x(() => {
1609
+ const S = pe(h);
1610
+ (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement) && (e.disabled = S);
1611
+ }), pe(h) ? x(() => {
1612
+ U(e, a, "");
1613
+ }) : x(() => {
1614
+ G(e, a);
1615
+ });
1616
+ continue;
1617
+ }
1618
+ const k = e.namespaceURI === "http://www.w3.org/2000/svg";
1619
+ if (p && !k && a.includes("-"))
1620
+ if (pt(a)) {
1621
+ const S = F(v ?? h);
1622
+ if (S !== null) {
1623
+ try {
1624
+ U(e, a, String(S));
1625
+ } catch {
1626
+ }
1627
+ oe(n, a, h);
1628
+ }
1629
+ } else {
1630
+ const S = Qe(a);
1631
+ try {
1632
+ const L = e;
1633
+ L[S] = M(v) ? v : h, oe(n, a, h);
1634
+ } catch {
1635
+ const L = F(v ?? h);
1636
+ L !== null && U(e, a, String(L));
1637
+ }
1638
+ }
1639
+ else if (!k && a in e)
1640
+ try {
1641
+ const S = e;
1642
+ S[a] = M(v) ? v : h, oe(n, a, h);
1643
+ } catch {
1644
+ const S = F(h);
1645
+ S !== null && (U(e, a, String(S)), oe(n, a, h));
1646
+ }
1647
+ else {
1648
+ const S = F(h);
1649
+ S !== null && (U(e, a, String(S)), oe(n, a, h));
1650
+ }
1651
+ }
1652
+ }
1653
+ try {
1654
+ if (Q(e)) {
1655
+ const a = c.disabled;
1656
+ let E;
1657
+ try {
1658
+ const b = Object.prototype.hasOwnProperty.call(
1659
+ o.props || {},
1660
+ "disabled"
1661
+ ), h = a && typeof a == "object" && "value" in a;
1662
+ let k = !1;
1663
+ x(() => {
1664
+ k = !!M(a);
1665
+ });
1666
+ const S = Je(a);
1667
+ k || h || b || S ? E = a : E = f.disabled;
1668
+ } catch {
1669
+ E = f.disabled;
1670
+ }
1671
+ const v = pe(E);
1672
+ x(() => {
1673
+ (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement) && (e.disabled = v);
1674
+ }), v ? x(() => {
1675
+ U(e, "disabled", "");
1676
+ }) : x(() => {
1677
+ G(e, "disabled");
1678
+ });
1679
+ }
1680
+ } catch {
1681
+ }
1682
+ if (p && d) {
1683
+ const a = e;
1684
+ x(() => {
1685
+ a._applyProps?.(a._cfg);
1686
+ }), x(() => {
1687
+ typeof a.requestRender == "function" ? a.requestRender() : typeof a._render == "function" && a._render?.(a._cfg);
1688
+ });
1689
+ }
1690
+ }
1691
+ function J(e, n, t, s = null) {
1692
+ if (typeof e == "string")
1693
+ return document.createTextNode(e);
1694
+ if (e.tag === "#text") {
1695
+ const a = document.createTextNode(
1696
+ typeof e.children == "string" ? e.children : ""
1697
+ );
1698
+ return e.key != null && Z(a, e.key), a;
1699
+ }
1700
+ if (e.tag === "#raw") {
1701
+ const a = typeof e.children == "string" ? e.children : "";
1702
+ return document.createRange().createContextualFragment(a);
1703
+ }
1704
+ if (e.tag === "#anchor") {
1705
+ const a = e, E = Array.isArray(a.children) ? a.children : [], v = document.createTextNode(""), b = document.createTextNode("");
1706
+ a.key != null && (Z(v, `${a.key}:start`), Z(b, `${a.key}:end`)), a._startNode = v, a._endNode = b;
1707
+ const h = document.createDocumentFragment();
1708
+ h.appendChild(v);
1709
+ for (const k of E) {
1710
+ const S = J(
1711
+ k,
1712
+ n,
1713
+ t,
1714
+ // propagate parent namespace (was previously a boolean)
1715
+ s
1716
+ );
1717
+ if (a.key != null && S instanceof Element && !S.hasAttribute("data-anchor-key")) {
1718
+ const L = k;
1719
+ L && typeof L == "object" && L.key != null || Z(S, String(a.key));
1720
+ }
1721
+ h.appendChild(S);
1722
+ }
1723
+ return h.appendChild(b), h;
1724
+ }
1725
+ const r = e && typeof e == "object" && e.props && e.props.attrs ? e.props.attrs : void 0, o = (r && typeof r.xmlns == "string" ? String(r.xmlns) : void 0) ?? s ?? Ct[e.tag] ?? null, c = o ? document.createElementNS(o, e.tag) : document.createElement(e.tag);
1726
+ e.key != null && Z(c, e.key), e.props && e.props?._transitionGroup && Zt(
1727
+ c,
1728
+ e.props?._transitionGroup
1729
+ );
1730
+ const { props: f = {}, attrs: u = {}, directives: m = {} } = e.props ?? {}, p = yt(
1731
+ m,
1732
+ n,
1733
+ c instanceof HTMLElement ? c : void 0,
1734
+ u
1735
+ ), d = {
1736
+ ...f,
1737
+ ...p.props
1738
+ }, C = {
1739
+ ...u,
1740
+ ...p.attrs
1741
+ };
1742
+ try {
1743
+ const a = (C && C.class) ?? (d && d.class) ?? (e.props && e.props.attrs && e.props.attrs.class) ?? (e.props && e.props.props && e.props.props.class), E = F(a);
1744
+ if (E !== null) {
1745
+ const v = String(E).trim();
1746
+ v && U(c, "class", v);
1747
+ }
1748
+ } catch {
1749
+ }
1750
+ try {
1751
+ if (d.disabled !== void 0 && c && Q(c)) {
1752
+ const a = d.disabled, E = a && typeof a == "object" && "value" in a;
1753
+ let v = !1;
1754
+ try {
1755
+ v = M(a);
1756
+ } catch {
1757
+ v = !1;
1758
+ }
1759
+ !E && !v && x(() => {
1760
+ C.disabled = a, delete d.disabled;
1761
+ });
1762
+ }
1763
+ } catch {
1764
+ }
1765
+ const T = c.namespaceURI === "http://www.w3.org/2000/svg";
1766
+ for (const a in C) {
1767
+ const E = C[a];
1768
+ if (typeof a != "string" || /\[object Object\]/.test(a))
1769
+ continue;
1770
+ const v = Ze(E);
1771
+ if (typeof v == "boolean")
1772
+ v ? U(c, a, "") : x(() => {
1773
+ G(c, a);
1774
+ });
1775
+ else if (v != null) {
1776
+ if (a === "disabled" && Q(c)) {
1777
+ const b = d.disabled, h = Je(b) ? b : v, k = pe(h);
1778
+ x(() => {
1779
+ c.disabled = k;
1780
+ }), k ? x(() => {
1781
+ U(c, a, "");
1782
+ }) : x(() => {
1783
+ G(c, a);
1784
+ });
1785
+ continue;
1786
+ }
1787
+ if (!T && a === "value" && (c instanceof HTMLInputElement || c instanceof HTMLTextAreaElement || c instanceof HTMLSelectElement || c instanceof HTMLProgressElement))
1788
+ try {
1789
+ c instanceof HTMLProgressElement ? c.value = Number(v) : c.value = String(v ?? "");
1790
+ } catch {
1791
+ const b = F(v);
1792
+ b !== null && U(c, a, String(b));
1793
+ }
1794
+ else if (!T && a === "checked" && c instanceof HTMLInputElement)
1795
+ try {
1796
+ c.checked = !!v;
1797
+ } catch {
1798
+ const b = F(v);
1799
+ b !== null && U(c, a, String(b));
1800
+ }
1801
+ else if (!T && a in c)
1802
+ try {
1803
+ c[a] = v, a === "disabled" && v === !1 && Q(c) && G(c, "disabled"), oe(e.props, a, v);
1804
+ } catch {
1805
+ const b = F(v);
1806
+ b !== null && U(c, a, String(b));
1807
+ }
1808
+ else if ((e.props?.isCustomElement ?? !1) && !T && a.includes("-")) {
1809
+ const h = Qe(a);
1810
+ try {
1811
+ c[h] = v;
1812
+ } catch {
1813
+ const k = F(v);
1814
+ k !== null && U(c, a, String(k));
1815
+ }
1816
+ } else {
1817
+ const h = F(v);
1818
+ h !== null && U(c, a, String(h));
1819
+ }
1820
+ }
1821
+ }
1822
+ for (const a in d) {
1823
+ const E = d[a];
1824
+ if (!(typeof a != "string" || /\[object Object\]/.test(a)))
1825
+ if (a === "value" && (c instanceof HTMLInputElement || c instanceof HTMLTextAreaElement || c instanceof HTMLSelectElement)) {
1826
+ const v = typeof E == "object" && E !== null && Ne(E) ? E.value : E;
1827
+ x(() => {
1828
+ c.value = String(v ?? "");
1829
+ });
1830
+ } else if (a.startsWith("on") && typeof E == "function") {
1831
+ const v = ht(a), b = v.includes(":") ? (() => {
1832
+ const h = v.split(":"), k = h[1];
1833
+ if (k.includes("-")) {
1834
+ const S = k.split("-").map(
1835
+ (L, y) => y === 0 ? L : L.charAt(0).toUpperCase() + L.slice(1)
1836
+ ).join("");
1837
+ return `${h[0]}:${S}`;
1838
+ } else {
1839
+ const S = k.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1840
+ return `${h[0]}:${S}`;
1841
+ }
1842
+ })() : v;
1843
+ p.listeners && (p.listeners[v] || p.listeners[b]) || ne.addListener(c, v, E);
1844
+ } else {
1845
+ if (a.startsWith("on") && E === void 0)
1846
+ continue;
1847
+ if (E == null || E === !1)
1848
+ G(c, a);
1849
+ else {
1850
+ const v = e.props?.isCustomElement ?? !1, b = typeof E == "object" && E !== null && M(E) ? E : Ne(E) && typeof E.value < "u" ? E.value : E;
1851
+ if (a === "class" || a === "style") {
1852
+ try {
1853
+ const h = F(b);
1854
+ h !== null && U(c, a, String(h));
1855
+ } catch {
1856
+ }
1857
+ continue;
1858
+ }
1859
+ if (v || a in c)
1860
+ try {
1861
+ const h = typeof E == "object" && E !== null && M(E) ? E : Ne(E) ? E.value : E;
1862
+ if (a === "disabled" && Q(c)) {
1863
+ const k = d.disabled !== void 0 ? d.disabled : h, S = pe(k);
1864
+ x(() => {
1865
+ c.disabled = S;
1866
+ }), S ? x(() => {
1867
+ U(c, a, "");
1868
+ }) : x(() => {
1869
+ G(c, a);
1870
+ });
1871
+ continue;
1872
+ }
1873
+ try {
1874
+ if (typeof c[a] == "boolean") {
1875
+ let S = h;
1876
+ typeof h == "string" ? h === "false" ? S = !1 : h === "true" ? S = !0 : S = !!h && h !== "" : S = !!h, c[a] = S;
1877
+ } else
1878
+ c[a] = h;
1879
+ } catch {
1880
+ c[a] = h;
1881
+ }
1882
+ } catch {
1883
+ }
1884
+ }
1885
+ }
1886
+ }
1887
+ for (const [a, E] of Object.entries(
1888
+ p.listeners || {}
1889
+ ))
1890
+ ne.addListener(c, a, E);
1891
+ const w = {
1892
+ ...e,
1893
+ props: {
1894
+ ...e.props,
1895
+ ...p.props
1896
+ }
1897
+ };
1898
+ Te(w, c, t);
1899
+ try {
1900
+ const a = c;
1901
+ if (typeof a._applyProps == "function")
1902
+ try {
1903
+ a._applyProps(a._cfg);
1904
+ } catch {
1905
+ }
1906
+ typeof a.requestRender == "function" ? a.requestRender() : typeof a._render == "function" && a._render(a._cfg);
1907
+ } catch {
1908
+ }
1909
+ if (Array.isArray(e.children)) {
1910
+ const a = e.tag === "foreignObject" && o === kt ? null : c.namespaceURI ?? null;
1911
+ for (const E of e.children)
1912
+ c.appendChild(J(E, n, t, a));
1913
+ } else typeof e.children == "string" && (c.textContent = e.children);
1914
+ try {
1915
+ if (c instanceof HTMLSelectElement && C && Object.prototype.hasOwnProperty.call(C, "value"))
1916
+ try {
1917
+ c.value = String(C.value ?? "");
1918
+ } catch {
1919
+ }
1920
+ } catch {
1921
+ }
1922
+ try {
1923
+ if (Q(c)) {
1924
+ const a = d.disabled, E = C.disabled, v = a && typeof a == "object" && "value" in a;
1925
+ let b = !1;
1926
+ try {
1927
+ b = !!M(a);
1928
+ } catch {
1929
+ b = !1;
1930
+ }
1931
+ const k = b || v || Je(a) ? a : E, S = pe(k);
1932
+ x(() => {
1933
+ c.disabled = S;
1934
+ }), S ? x(() => {
1935
+ U(c, "disabled", "");
1936
+ }) : x(() => {
1937
+ G(c, "disabled");
1938
+ });
1939
+ }
1940
+ } catch {
1941
+ }
1942
+ return c;
1943
+ }
1944
+ function Jt(e, n, t, s, r) {
1945
+ if (typeof t == "string") {
1946
+ e.textContent !== t && (e.textContent = t);
1947
+ return;
1948
+ }
1949
+ if (!Array.isArray(t)) return;
1950
+ const i = e.childNodes, o = [];
1951
+ for (let w = 0; w < i.length; w++)
1952
+ o.push(i[w]);
1953
+ const c = Array.isArray(n) ? n : [], f = Gt(e);
1954
+ if (f) {
1955
+ const w = (b) => {
1956
+ if (typeof b == "string")
1957
+ return b.startsWith("each-") ? b.substring(5) : b;
1958
+ if (typeof b == "number") return String(b);
1959
+ }, a = [], E = [];
1960
+ for (const b of t)
1961
+ if (b && b.tag === "#anchor") {
1962
+ const h = Array.isArray(b.children) ? b.children : [];
1963
+ for (const k of h) {
1964
+ const S = w(
1965
+ k.key ?? b.key ?? "unknown"
1966
+ );
1967
+ a.push({ ...k, key: S });
1968
+ }
1969
+ } else b && a.push({ ...b, key: w(b.key) });
1970
+ for (const b of c)
1971
+ if (b && b.tag === "#anchor") {
1972
+ const h = Array.isArray(b.children) ? b.children : [];
1973
+ for (const k of h) {
1974
+ const S = w(
1975
+ k.key ?? b.key ?? "unknown"
1976
+ );
1977
+ E.push({ ...k, key: S });
1978
+ }
1979
+ } else b && E.push({
1980
+ ...b,
1981
+ key: w(b.key)
1982
+ });
1983
+ if (a.some((b) => b && b.key != null) || E.some((b) => b && b.key != null)) {
1984
+ const b = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
1985
+ for (const l of E)
1986
+ if (l && l.key != null) {
1987
+ const g = String(l.key);
1988
+ b.set(g, l);
1989
+ }
1990
+ for (let l = 0; l < o.length; l++) {
1991
+ const g = o[l];
1992
+ let A = De(g);
1993
+ if (A = w(A), A != null && g instanceof Element && g.nodeType === Node.ELEMENT_NODE) {
1994
+ let N = typeof A == "string" && A.includes(":") ? A.substring(0, A.lastIndexOf(":")) : A;
1995
+ N = String(N), h.set(N, g);
1996
+ }
1997
+ }
1998
+ const k = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Map(), L = o.length > 0;
1999
+ if (f.moveClass && L)
2000
+ for (let l = 0; l < o.length; l++) {
2001
+ const g = o[l];
2002
+ if (g instanceof HTMLElement && g.parentElement) {
2003
+ const A = g.getBoundingClientRect();
2004
+ S.set(g, A);
2005
+ }
2006
+ }
2007
+ const y = [];
2008
+ for (const l of a) {
2009
+ let g = l.key;
2010
+ if (g == null) continue;
2011
+ g = String(g);
2012
+ const A = b.get(g);
2013
+ let N = h.get(g);
2014
+ if (N && A) {
2015
+ const O = Le(N, A, l, s);
2016
+ k.add(N);
2017
+ const P = String(g);
2018
+ Z(O, P), y.push({
2019
+ node: O,
2020
+ key: g,
2021
+ newVNode: l,
2022
+ oldVNode: A,
2023
+ isNew: !1
2024
+ });
2025
+ } else {
2026
+ N = J(
2027
+ l,
2028
+ s,
2029
+ void 0,
2030
+ e instanceof Element ? e.namespaceURI ?? null : null
2031
+ ), Z(N, String(g)), e.appendChild(N);
2032
+ const O = L || f.appear === !0;
2033
+ N instanceof HTMLElement && O && we(N, f).catch((P) => {
2034
+ B("Enter transition error:", P);
2035
+ }), y.push({ node: N, key: g, newVNode: l, isNew: !0 });
2036
+ }
2037
+ }
2038
+ const _ = [];
2039
+ for (let l = 0; l < o.length; l++) {
2040
+ const g = o[l], A = De(g);
2041
+ if (!k.has(g) && A != null && g instanceof HTMLElement) {
2042
+ const O = qe(g, f).then(() => {
2043
+ e.contains(g) && e.removeChild(g);
2044
+ }).catch((P) => {
2045
+ B("Leave transition error:", P), e.contains(g) && e.removeChild(g);
2046
+ });
2047
+ _.push(O);
2048
+ }
2049
+ }
2050
+ if (_.length === 0) {
2051
+ let l = e.firstChild;
2052
+ for (const { node: g } of y)
2053
+ g !== l && e.insertBefore(g, l), l = g.nextSibling;
2054
+ if (f.moveClass && S.size > 0) {
2055
+ const g = [];
2056
+ for (const { node: A, isNew: N } of y)
2057
+ if (!N && A instanceof HTMLElement) {
2058
+ const O = S.get(A);
2059
+ if (O) {
2060
+ const P = A.getBoundingClientRect(), D = O.left - P.left, j = O.top - P.top;
2061
+ if (D !== 0 || j !== 0) {
2062
+ const z = f.moveClass.split(/\s+/).filter((I) => I);
2063
+ g.push({ node: A, deltaX: D, deltaY: j, moveClasses: z });
2064
+ }
2065
+ }
2066
+ }
2067
+ if (g.length > 0) {
2068
+ for (const { node: A, deltaX: N, deltaY: O } of g)
2069
+ A.style.transform = `translate(${N}px, ${O}px)`, A.style.transitionProperty = "none";
2070
+ e.offsetHeight, requestAnimationFrame(() => {
2071
+ requestAnimationFrame(() => {
2072
+ for (const { node: A, moveClasses: N } of g)
2073
+ for (const O of N)
2074
+ A.classList.add(O);
2075
+ requestAnimationFrame(() => {
2076
+ const A = f.moveClass || "", N = A.match(/duration-(\d+)/), O = N ? `${N[1]}ms` : "300ms", P = A.match(
2077
+ /ease-(out|in|in-out|linear)/
2078
+ ), D = P ? `ease-${P[1]}` : "ease-out";
2079
+ for (const { node: j } of g)
2080
+ j.style.transition = `transform ${O} ${D}`;
2081
+ requestAnimationFrame(() => {
2082
+ for (const { node: j, moveClasses: z } of g) {
2083
+ j.style.removeProperty("transform");
2084
+ const I = () => {
2085
+ for (const ie of z)
2086
+ j.classList.remove(ie);
2087
+ j.style.removeProperty("transition"), j.removeEventListener("transitionend", I), j.removeEventListener("transitioncancel", I);
2088
+ };
2089
+ j.addEventListener("transitionend", I, {
2090
+ once: !0
2091
+ }), j.addEventListener("transitioncancel", I, {
2092
+ once: !0
2093
+ });
2094
+ }
2095
+ });
2096
+ });
2097
+ });
2098
+ });
2099
+ }
2100
+ }
2101
+ }
2102
+ return;
2103
+ }
2104
+ }
2105
+ const u = /* @__PURE__ */ new Map();
2106
+ for (const w of c)
2107
+ w && w.key != null && u.set(w.key, w);
2108
+ const m = /* @__PURE__ */ new Map();
2109
+ for (let w = 0; w < o.length; w++) {
2110
+ const a = o[w], E = De(a);
2111
+ E != null && m.set(E, a);
2112
+ }
2113
+ const p = /* @__PURE__ */ new Set();
2114
+ let d = e.firstChild;
2115
+ function C(w, a) {
2116
+ let E = w;
2117
+ for (; E && (p.add(E), E !== a); )
2118
+ E = E.nextSibling;
2119
+ }
2120
+ function T(w, a, E, v, b, h = !0) {
2121
+ const k = [];
2122
+ let S = w.nextSibling;
2123
+ for (; S && S !== a; )
2124
+ k.push(S), S = S.nextSibling;
2125
+ const L = Array.isArray(E) ? E : [];
2126
+ if (v.some((_) => _ && _.key != null) || L.some((_) => _ && _.key != null)) {
2127
+ const _ = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
2128
+ for (const O of L)
2129
+ O && O.key != null && _.set(O.key, O);
2130
+ for (const O of k) {
2131
+ const P = De(O);
2132
+ P != null && l.set(P, O);
2133
+ }
2134
+ const g = b && b.state === "visible" && L.length === 0 && v.length > 0, A = /* @__PURE__ */ new Set();
2135
+ let N = w.nextSibling;
2136
+ for (const O of v) {
2137
+ let P;
2138
+ if (O.key != null && l.has(O.key)) {
2139
+ const D = _.get(O.key);
2140
+ P = Le(
2141
+ l.get(O.key),
2142
+ D,
2143
+ O,
2144
+ s
2145
+ ), A.add(P), b && P instanceof HTMLElement && g && b.appear && we(P, b).catch((j) => {
2146
+ B("Transition enter error (appear):", j);
2147
+ }), P !== N && e.contains(P) && e.insertBefore(P, N);
2148
+ } else
2149
+ P = J(
2150
+ O,
2151
+ s,
2152
+ void 0,
2153
+ e instanceof Element ? e.namespaceURI ?? null : null
2154
+ ), e.insertBefore(P, N), A.add(P), b && P instanceof HTMLElement && h && we(P, b).catch((D) => {
2155
+ B("Transition enter error:", D);
2156
+ });
2157
+ N = P.nextSibling;
2158
+ }
2159
+ for (const O of k)
2160
+ !A.has(O) && e.contains(O) && (b && O instanceof HTMLElement && h ? qe(O, b).then(() => {
2161
+ e.contains(O) && e.removeChild(O);
2162
+ }).catch((P) => {
2163
+ B("Transition leave error:", P), e.contains(O) && e.removeChild(O);
2164
+ }) : e.removeChild(O));
2165
+ } else {
2166
+ const _ = Math.min(
2167
+ L.length,
2168
+ v.length
2169
+ );
2170
+ for (let l = 0; l < _; l++) {
2171
+ const g = L[l], A = v[l], N = Le(k[l], g, A, s);
2172
+ N !== k[l] && (e.insertBefore(N, k[l]), e.removeChild(k[l]));
2173
+ }
2174
+ for (let l = _; l < v.length; l++) {
2175
+ const g = J(
2176
+ v[l],
2177
+ s,
2178
+ void 0,
2179
+ e instanceof Element ? e.namespaceURI ?? null : null
2180
+ );
2181
+ e.insertBefore(g, a), b && g instanceof HTMLElement && h && we(g, b).catch((A) => {
2182
+ B("Transition enter error:", A);
2183
+ });
2184
+ }
2185
+ for (let l = _; l < k.length; l++) {
2186
+ const g = k[l];
2187
+ b && g instanceof HTMLElement && h ? qe(g, b).then(() => {
2188
+ e.contains(g) && e.removeChild(g);
2189
+ }).catch((A) => {
2190
+ B("Transition leave error:", A), e.contains(g) && e.removeChild(g);
2191
+ }) : e.removeChild(g);
2192
+ }
2193
+ }
2194
+ }
2195
+ for (const w of t) {
2196
+ let a;
2197
+ if (w.tag === "#anchor") {
2198
+ const E = w.key, v = `${E}:start`, b = `${E}:end`;
2199
+ let h = m.get(v), k = m.get(b);
2200
+ const S = Array.isArray(w.children) ? w.children : [];
2201
+ if (h || (h = document.createTextNode(""), Z(h, v)), k || (k = document.createTextNode(""), Z(k, b)), w._startNode = h, w._endNode = k, !e.contains(h) || !e.contains(k)) {
2202
+ e.insertBefore(h, d);
2203
+ const L = w._transition, _ = !(L && L.state === "visible" && S.length > 0) || L.appear;
2204
+ for (const l of S) {
2205
+ const g = J(
2206
+ l,
2207
+ s,
2208
+ r,
2209
+ e instanceof Element ? e.namespaceURI ?? null : null
2210
+ );
2211
+ e.insertBefore(g, d), L && g instanceof HTMLElement && _ && we(g, L).catch((A) => {
2212
+ B("Transition enter error:", A);
2213
+ });
2214
+ }
2215
+ e.insertBefore(k, d);
2216
+ } else {
2217
+ const L = w._transition, _ = u.get(E)._transition, l = _ && _.state !== L?.state, g = L && L.state === "visible" && S.length > 0 && !l, A = l || !g || L?.appear === !0;
2218
+ T(
2219
+ h,
2220
+ k,
2221
+ u.get(E)?.children,
2222
+ S,
2223
+ L,
2224
+ A
2225
+ );
2226
+ }
2227
+ C(h, k), d = k.nextSibling;
2228
+ continue;
2229
+ }
2230
+ if (w.key != null && m.has(w.key)) {
2231
+ const E = u.get(w.key);
2232
+ a = Le(
2233
+ m.get(w.key),
2234
+ E,
2235
+ w,
2236
+ s,
2237
+ r
2238
+ ), p.add(a), a !== d && e.contains(a) && (d && !e.contains(d) && (d = null), e.insertBefore(a, d));
2239
+ } else
2240
+ a = J(
2241
+ w,
2242
+ s,
2243
+ r,
2244
+ e instanceof Element ? e.namespaceURI ?? null : null
2245
+ ), d && !e.contains(d) && (d = null), e.insertBefore(a, d), p.add(a);
2246
+ d = a.nextSibling;
2247
+ }
2248
+ for (let w = 0; w < o.length; w++) {
2249
+ const a = o[w];
2250
+ !p.has(a) && e.contains(a) && (de(a, r), e.removeChild(a));
2251
+ }
2252
+ }
2253
+ function Le(e, n, t, s, r) {
2254
+ if (n && typeof n != "string" && n.props?.ref && r && de(e, r), n === t) return e;
2255
+ if (typeof t == "string") {
2256
+ if (e.nodeType === Node.TEXT_NODE)
2257
+ return e.textContent !== t && (e.textContent = t), e;
2258
+ {
2259
+ const o = document.createTextNode(t);
2260
+ return e.parentNode?.replaceChild(o, e), o;
2261
+ }
2262
+ }
2263
+ if (t && typeof t != "string" && t.tag === "#anchor") {
2264
+ const o = t, c = Array.isArray(o.children) ? o.children : [], f = o._startNode ?? document.createTextNode(""), u = o._endNode ?? document.createTextNode("");
2265
+ o.key != null && (Z(f, `${o.key}:start`), Z(u, `${o.key}:end`)), o._startNode = f, o._endNode = u;
2266
+ const m = document.createDocumentFragment();
2267
+ m.appendChild(f);
2268
+ for (const p of c) {
2269
+ const d = J(
2270
+ p,
2271
+ s,
2272
+ r,
2273
+ e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null
2274
+ );
2275
+ m.appendChild(d);
2276
+ }
2277
+ return m.appendChild(u), e.parentNode?.replaceChild(m, e), f;
2278
+ }
2279
+ if (!t) {
2280
+ de(e, r);
2281
+ const o = document.createComment("removed");
2282
+ return e.parentNode?.replaceChild(o, e), o;
2283
+ }
2284
+ if (!n || typeof n == "string") {
2285
+ de(e, r);
2286
+ const o = J(
2287
+ t,
2288
+ s,
2289
+ r,
2290
+ e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null
2291
+ );
2292
+ return Te(t, o, r), e.parentNode?.replaceChild(o, e), o;
2293
+ }
2294
+ if (t.tag === "#anchor") {
2295
+ const o = Array.isArray(t.children) ? t.children : [], c = t._startNode ?? document.createTextNode(""), f = t._endNode ?? document.createTextNode("");
2296
+ t.key != null && (Z(c, `${t.key}:start`), Z(f, `${t.key}:end`)), t._startNode = c, t._endNode = f;
2297
+ const u = document.createDocumentFragment();
2298
+ u.appendChild(c);
2299
+ for (const m of o)
2300
+ u.appendChild(
2301
+ J(
2302
+ m,
2303
+ s,
2304
+ r,
2305
+ e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null
2306
+ )
2307
+ );
2308
+ return u.appendChild(f), e.parentNode?.replaceChild(u, e), c;
2309
+ }
2310
+ if (typeof n != "string" && typeof t != "string" && n.tag === t.tag && n.key === t.key) {
2311
+ const o = e;
2312
+ return at(o, n.props || {}, t.props || {}, s), Jt(o, n.children, t.children, s, r), Te(t, o, r), o;
2313
+ }
2314
+ if (typeof n != "string" && typeof t != "string" && n.tag === t.tag && (n.tag && String(n.tag).includes("-") || t.props && t.props.isCustomElement || n.props && n.props.isCustomElement))
2315
+ try {
2316
+ const c = e;
2317
+ return at(c, n.props || {}, t.props || {}, s), Te(t, c, r), c;
2318
+ } catch {
2319
+ }
2320
+ de(e, r);
2321
+ const i = J(
2322
+ t,
2323
+ s,
2324
+ r,
2325
+ e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null
2326
+ );
2327
+ return Te(t, i, r), e.parentNode?.replaceChild(i, e), i;
2328
+ }
2329
+ function Yt(e, n, t, s) {
2330
+ let r;
2331
+ Array.isArray(n) ? n.length === 1 ? (r = n[0], r && typeof r == "object" && r.key == null && (r = { ...r, key: "__root__" })) : r = { tag: "div", key: "__root__", children: n } : (r = n, r && typeof r == "object" && r.key == null && (r = { ...r, key: "__root__" })), r && typeof r == "object" && r.tag === "#anchor" && (r = {
2332
+ tag: "div",
2333
+ key: "__anchor_root__",
2334
+ props: {
2335
+ attrs: { "data-anchor-block-root": "", key: "__anchor_root__" }
2336
+ },
2337
+ children: [r]
2338
+ }), r = Ye(r, String(r.key ?? "root"));
2339
+ const i = e._prevVNode ?? null, o = e._prevDom ?? e.firstChild ?? null;
2340
+ let c;
2341
+ i && o ? typeof i != "string" && typeof r != "string" && i.tag === r.tag && i.key === r.key ? c = Le(o, i, r, t, s) : (c = J(
2342
+ r,
2343
+ t,
2344
+ s,
2345
+ e.host instanceof Element ? e.host.namespaceURI ?? null : null
2346
+ ), e.replaceChild(c, o)) : (c = J(
2347
+ r,
2348
+ t,
2349
+ s,
2350
+ e.host instanceof Element ? e.host.namespaceURI ?? null : null
2351
+ ), e.firstChild ? e.replaceChild(c, e.firstChild) : e.appendChild(c));
2352
+ const f = [];
2353
+ for (let m = 0; m < e.childNodes.length; m++) {
2354
+ const p = e.childNodes[m];
2355
+ p !== c && p.nodeName !== "STYLE" && (de(p, s), f.push(p));
2356
+ }
2357
+ f.forEach((m) => e.removeChild(m));
2358
+ const u = r && typeof r == "object" && r.props ? {
2359
+ ...r,
2360
+ props: {
2361
+ ...r.props,
2362
+ attrs: r.props.attrs ? { ...r.props.attrs } : void 0,
2363
+ props: r.props.props ? { ...r.props.props } : void 0
2364
+ }
2365
+ } : r;
2366
+ e._prevVNode = u, e._prevDom = c;
2367
+ }
2368
+ const Oe = [], lt = /* @__PURE__ */ new WeakMap(), Ee = /* @__PURE__ */ new WeakMap();
2369
+ function Xt(e, n) {
2370
+ Ee.has(e) || Ee.set(e, /* @__PURE__ */ new Set()), Ee.get(e).add(n);
2371
+ }
2372
+ function Qt(e, n) {
2373
+ const t = Ee.get(e);
2374
+ t && (t.delete(n), t.size === 0 && Ee.delete(e));
2375
+ }
2376
+ function en(e, n, t, s, r, i, o, c) {
2377
+ if (e) {
2378
+ Oe.push(t);
2379
+ try {
2380
+ const f = n.render(t);
2381
+ if (f instanceof Promise) {
2382
+ i(!0), f.then((u) => {
2383
+ i(!1), o(null), ft(e, u, t, s, r), c(e.innerHTML);
2384
+ }).catch((u) => {
2385
+ i(!1), o(u instanceof Error ? u : new Error(String(u)));
2386
+ });
2387
+ return;
2388
+ }
2389
+ ft(e, f, t, s, r), c(e.innerHTML);
2390
+ } catch (f) {
2391
+ o(f instanceof Error ? f : new Error(String(f)));
2392
+ } finally {
2393
+ Oe.pop();
2394
+ }
2395
+ }
2396
+ }
2397
+ function ft(e, n, t, s, r) {
2398
+ if (e)
2399
+ try {
2400
+ Yt(
2401
+ e,
2402
+ Array.isArray(n) ? n : [n],
2403
+ t,
2404
+ s
2405
+ ), r(e.innerHTML);
2406
+ } catch (i) {
2407
+ throw B("Error during VDOM rendering:", i), i;
2408
+ }
2409
+ }
2410
+ function tn(e, n, t, s, r, i, o) {
2411
+ i !== null && clearTimeout(i);
2412
+ const u = Date.now() - n < 16, m = (() => {
2413
+ try {
2414
+ return typeof window < "u" && !!window.Cypress;
2415
+ } catch {
2416
+ return !1;
2417
+ }
2418
+ })(), p = (() => {
2419
+ try {
2420
+ return globalThis.process?.env?.NODE_ENV === "test" && !m;
2421
+ } catch {
2422
+ return !1;
2423
+ }
2424
+ })(), d = p || m;
2425
+ if (u) {
2426
+ const w = t + 1;
2427
+ r(w);
2428
+ const a = d ? 50 : 10, E = d ? 100 : 25, v = p ? 12 : 50;
2429
+ if (w === a && !d)
2430
+ V(
2431
+ `⚠️ Component rendering frequently. Performance may be impacted.
2432
+ Common causes:
2433
+ • State updates during render cycle
2434
+ • Event handlers with immediate function calls
2435
+ • Missing effect dependencies`
2436
+ );
2437
+ else if (w === E && !d)
2438
+ V(
2439
+ `⚠️ Component is re-rendering rapidly. Applying throttling.
2440
+ This might indicate:
2441
+ • Event handler calling function immediately: @click="\${fn()}" should be @click="\${fn}"
2442
+ • State modification during render
2443
+ • Missing dependencies in computed/watch`
2444
+ );
2445
+ else if (w >= v) {
2446
+ B(
2447
+ `🛑 Infinite render loop detected. Stopping to prevent browser freeze.
2448
+ Possible causes:
2449
+ • State updates triggering immediate re-renders
2450
+ • Computed values changing during evaluation
2451
+ • Circular dependencies in reactive system`
2452
+ ), o(null);
2453
+ return;
2454
+ }
2455
+ } else
2456
+ r(0);
2457
+ let C = 0;
2458
+ d || (t >= 40 ? C = 500 : t >= 25 ? C = 100 : t >= 15 && (C = 16));
2459
+ const T = () => {
2460
+ s(Date.now());
2461
+ try {
2462
+ e();
2463
+ } catch (w) {
2464
+ B("Error during render execution:", w);
2465
+ } finally {
2466
+ o(null);
2467
+ }
2468
+ };
2469
+ if (C > 0) {
2470
+ const w = setTimeout(T, C);
2471
+ o(w);
2472
+ } else d ? T() : (o({}), queueMicrotask(T));
2473
+ }
2474
+ function nn(e, n) {
2475
+ let t = n;
2476
+ try {
2477
+ const s = Ee.get(e);
2478
+ if (s?.size)
2479
+ for (const r of s)
2480
+ try {
2481
+ const i = r.lastHtmlStringForJitCSS;
2482
+ i?.trim() && (t += `
2483
+ ` + i);
2484
+ } catch {
2485
+ }
2486
+ else {
2487
+ const r = e.querySelectorAll("*");
2488
+ for (const i of r)
2489
+ try {
2490
+ const o = i.lastHtmlStringForJitCSS;
2491
+ o?.trim() && (t += `
2492
+ ` + o);
2493
+ } catch {
2494
+ }
2495
+ }
2496
+ } catch {
2497
+ }
2498
+ return t;
2499
+ }
2500
+ function ut(e) {
2501
+ return "adoptedStyleSheets" in e && typeof CSSStyleSheet < "u" && "replaceSync" in CSSStyleSheet.prototype;
2502
+ }
2503
+ function dt(e, n) {
2504
+ let t = e.querySelector(
2505
+ "style[data-cer-runtime]"
2506
+ );
2507
+ t || (t = document.createElement("style"), U(t, "data-cer-runtime", "true"), e.appendChild(t));
2508
+ try {
2509
+ t.textContent = n;
2510
+ } catch {
2511
+ }
2512
+ }
2513
+ function rn(e, n, t, s, r) {
2514
+ if (!e) return;
2515
+ const i = nn(e, t);
2516
+ if (lt.get(e) === i)
2517
+ return;
2518
+ lt.set(e, i);
2519
+ const c = wt(i), f = Tt(), u = n._computedStyle;
2520
+ if (!c?.trim() && !u && !f) {
2521
+ if (r(null), ut(e))
2522
+ e.adoptedStyleSheets = [
2523
+ He(),
2524
+ ye()
2525
+ ];
2526
+ else {
2527
+ const E = Ae(ot), v = ye();
2528
+ let b = "";
2529
+ try {
2530
+ v?.cssRules && (b = Array.from(v.cssRules).map((k) => k.cssText).join(`
2531
+ `));
2532
+ } catch {
2533
+ b = "";
2534
+ }
2535
+ const h = Ae(`${E}
2536
+ ${b}`);
2537
+ dt(e, h);
2538
+ try {
2539
+ e.adoptedStyleSheets = [He(), ye()];
2540
+ } catch {
2541
+ }
2542
+ }
2543
+ return;
2544
+ }
2545
+ let m = "";
2546
+ if (u && (m += u + `
2547
+ `), c && (m += c + `
2548
+ `), m = Lt(m), m = Ae(m), ut(e)) {
2549
+ let a = s;
2550
+ a || (a = new CSSStyleSheet());
2551
+ try {
2552
+ a.replaceSync(m);
2553
+ const E = [He(), ye()];
2554
+ f && E.push(f), E.push(a), e.adoptedStyleSheets = E, r(a);
2555
+ return;
2556
+ } catch {
2557
+ }
2558
+ }
2559
+ const d = Ae(ot), C = ye();
2560
+ let T = "";
2561
+ try {
2562
+ C?.cssRules && (T = Array.from(C.cssRules).map((a) => a.cssText).join(`
2563
+ `));
2564
+ } catch {
2565
+ T = "";
2566
+ }
2567
+ const w = Ae(`${d}
2568
+ ${T}
2569
+ ${m}`);
2570
+ dt(e, w);
2571
+ try {
2572
+ const a = [
2573
+ He(),
2574
+ ye()
2575
+ ];
2576
+ if (f && a.push(f), typeof CSSStyleSheet < "u")
2577
+ try {
2578
+ const E = new CSSStyleSheet();
2579
+ E.replaceSync(m), a.push(E);
2580
+ } catch {
2581
+ a.push({
2582
+ cssRules: [],
2583
+ replaceSync: () => {
2584
+ }
2585
+ });
2586
+ }
2587
+ e.adoptedStyleSheets = a;
2588
+ } catch {
2589
+ }
2590
+ r(null);
2591
+ }
2592
+ function sn(e, n) {
2593
+ if (!n.render)
2594
+ throw new Error("Component must have a render function");
2595
+ return typeof window > "u" ? class {
2596
+ constructor() {
2597
+ }
2598
+ } : class extends HTMLElement {
2599
+ context;
2600
+ _refs = {};
2601
+ _listeners = [];
2602
+ _watchers = /* @__PURE__ */ new Map();
2603
+ /** @internal */
2604
+ _renderTimeoutId = null;
2605
+ _mounted = !1;
2606
+ _hasError = !1;
2607
+ _initializing = !0;
2608
+ _componentId;
2609
+ _styleSheet = null;
2610
+ _lastHtmlStringForJitCSS = "";
2611
+ /**
2612
+ * Returns the last rendered HTML string for JIT CSS.
2613
+ */
2614
+ get lastHtmlStringForJitCSS() {
2615
+ return this._lastHtmlStringForJitCSS;
2616
+ }
2617
+ /**
2618
+ * Returns true if the component is currently loading.
2619
+ */
2620
+ get isLoading() {
2621
+ return this._templateLoading;
2622
+ }
2623
+ /**
2624
+ * Returns the last error thrown during rendering, or null if none.
2625
+ */
2626
+ get lastError() {
2627
+ return this._templateError;
2628
+ }
2629
+ _cfg;
2630
+ _lastRenderTime = 0;
2631
+ _renderCount = 0;
2632
+ _templateLoading = !1;
2633
+ _templateError = null;
2634
+ constructor() {
2635
+ super(), this.attachShadow({ mode: "open" }), this._cfg = ge.get(e) || n, this._componentId = `${e}-${crypto.randomUUID()}`;
2636
+ const t = this._initContext(n), s = (i, o, c) => {
2637
+ Object.defineProperty(i, o, {
2638
+ value: c,
2639
+ writable: !1,
2640
+ enumerable: !1,
2641
+ configurable: !1
2642
+ });
2643
+ };
2644
+ s(t, "refs", this._refs), s(
2645
+ t,
2646
+ "requestRender",
2647
+ () => this.requestRender()
2648
+ ), s(
2649
+ t,
2650
+ "_requestRender",
2651
+ () => this._requestRender()
2652
+ ), s(t, "_componentId", this._componentId), s(
2653
+ t,
2654
+ "_triggerWatchers",
2655
+ (i, o) => this._triggerWatchers(i, o)
2656
+ ), this.context = t, x(() => {
2657
+ s(t, "_host", this);
2658
+ }), s(
2659
+ this.context,
2660
+ "emit",
2661
+ (i, o, c) => {
2662
+ const f = {
2663
+ detail: o,
2664
+ bubbles: !0,
2665
+ composed: !0,
2666
+ ...c || {}
2667
+ }, u = new CustomEvent(i, f);
2668
+ this.dispatchEvent(u);
2669
+ const m = i.indexOf(":");
2670
+ if (m > 0) {
2671
+ const p = i.substring(0, m), d = i.substring(m + 1), C = d.includes("-") ? `${p}:${d.split("-").map(
2672
+ (T, w) => w === 0 ? T : T.charAt(0).toUpperCase() + T.slice(1)
2673
+ ).join("")}` : `${p}:${d.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase()}`;
2674
+ C !== i && x(() => {
2675
+ this.dispatchEvent(new CustomEvent(C, f));
2676
+ });
2677
+ }
2678
+ return !u.defaultPrevented;
2679
+ }
2680
+ );
2681
+ const r = ge.get(e) || n;
2682
+ for (const i in r) {
2683
+ const o = r[i];
2684
+ typeof o == "function" && (this.context[i] = (...c) => o(...c, this.context));
2685
+ }
2686
+ if (r.props)
2687
+ for (const i in r.props) {
2688
+ let o = this[i];
2689
+ Object.defineProperty(this, i, {
2690
+ get() {
2691
+ return o;
2692
+ },
2693
+ set(c) {
2694
+ const f = o;
2695
+ o = c, this.context[i] = c, this._initializing || (this._applyProps(r), f !== c && this._requestRender());
2696
+ },
2697
+ enumerable: !0,
2698
+ configurable: !0
2699
+ });
2700
+ }
2701
+ this._initializing = !1, this._initWatchers(r), this._applyProps(r), this._render(r);
2702
+ }
2703
+ connectedCallback() {
2704
+ this._runLogicWithinErrorBoundary(n, () => {
2705
+ const t = this.getRootNode();
2706
+ t && t !== document && "host" in t && Xt(t, this), this._applyProps(n), this._requestRender(), $t(n, this.context, this._mounted, (s) => {
2707
+ this._mounted = s;
2708
+ });
2709
+ });
2710
+ }
2711
+ disconnectedCallback() {
2712
+ this._runLogicWithinErrorBoundary(n, () => {
2713
+ const t = this.getRootNode();
2714
+ t && t !== document && "host" in t && Qt(t, this), xt(
2715
+ n,
2716
+ this.context,
2717
+ this._listeners,
2718
+ () => {
2719
+ this._listeners = [];
2720
+ },
2721
+ () => {
2722
+ this._watchers.clear();
2723
+ },
2724
+ (s) => {
2725
+ this._templateLoading = s;
2726
+ },
2727
+ (s) => {
2728
+ this._templateError = s;
2729
+ },
2730
+ (s) => {
2731
+ this._mounted = s;
2732
+ }
2733
+ );
2734
+ });
2735
+ }
2736
+ attributeChangedCallback(t, s, r) {
2737
+ this._runLogicWithinErrorBoundary(n, () => {
2738
+ this._applyProps(n), s !== r && this._requestRender(), Ht(n, t, s, r, this.context);
2739
+ });
2740
+ }
2741
+ static get observedAttributes() {
2742
+ return n.props ? Object.keys(n.props).map(Y) : [];
2743
+ }
2744
+ // --- Render ---
2745
+ _render(t) {
2746
+ this._runLogicWithinErrorBoundary(t, () => {
2747
+ en(
2748
+ this.shadowRoot,
2749
+ t,
2750
+ this.context,
2751
+ this._refs,
2752
+ (s) => {
2753
+ this._lastHtmlStringForJitCSS = s, typeof this.onHtmlStringUpdate == "function" && this?.onHtmlStringUpdate?.(s);
2754
+ },
2755
+ (s) => {
2756
+ this._templateLoading = s, this?.onLoadingStateChange?.(s);
2757
+ },
2758
+ (s) => {
2759
+ this._templateError = s, this?.onErrorStateChange?.(s);
2760
+ },
2761
+ (s) => this._applyStyle(t, s)
2762
+ );
2763
+ });
2764
+ }
2765
+ requestRender() {
2766
+ this._requestRender();
2767
+ }
2768
+ _requestRender() {
2769
+ this._runLogicWithinErrorBoundary(this._cfg, () => {
2770
+ _e(() => {
2771
+ tn(
2772
+ () => this._render(this._cfg),
2773
+ this._lastRenderTime,
2774
+ this._renderCount,
2775
+ (t) => {
2776
+ this._lastRenderTime = t;
2777
+ },
2778
+ (t) => {
2779
+ this._renderCount = t;
2780
+ },
2781
+ this._renderTimeoutId,
2782
+ (t) => {
2783
+ this._renderTimeoutId = t;
2784
+ }
2785
+ );
2786
+ }, this._componentId);
2787
+ });
2788
+ }
2789
+ // --- Style ---
2790
+ _applyStyle(t, s) {
2791
+ this._runLogicWithinErrorBoundary(t, () => {
2792
+ rn(
2793
+ this.shadowRoot,
2794
+ this.context,
2795
+ s,
2796
+ this._styleSheet,
2797
+ (r) => {
2798
+ this._styleSheet = r;
2799
+ }
2800
+ );
2801
+ });
2802
+ }
2803
+ // --- Error Boundary function ---
2804
+ _runLogicWithinErrorBoundary(t, s) {
2805
+ this._hasError && (this._hasError = !1);
2806
+ try {
2807
+ s();
2808
+ } catch (r) {
2809
+ this._hasError = !0;
2810
+ try {
2811
+ const i = this.tagName?.toLowerCase?.() || "<unknown>", o = this._componentId || "<unknown-id>", c = {};
2812
+ if (t && t.props)
2813
+ for (const f of Object.keys(t.props))
2814
+ try {
2815
+ const u = this.context[f];
2816
+ u instanceof Node ? c[f] = `[DOM Node: ${u.nodeName}]` : typeof u == "object" && u !== null ? c[f] = Object.keys(u).length > 5 ? `[object(${Object.keys(u).length} keys)]` : u : c[f] = u;
2817
+ } catch {
2818
+ c[f] = "[unreadable]";
2819
+ }
2820
+ B(`Error rendering component <${i}> (id=${o}):`, r), B("Component props snapshot:", c), V(
2821
+ "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`...`)."
2822
+ );
2823
+ } catch {
2824
+ }
2825
+ if (t.onError && t.onError(r, this.context), this.tagName.toLowerCase() !== "cer-error-boundary") {
2826
+ let i = this.parentElement;
2827
+ if (!i) {
2828
+ const o = this.getRootNode();
2829
+ o instanceof ShadowRoot && (i = o.host.parentElement);
2830
+ }
2831
+ for (; i; ) {
2832
+ if (i.tagName.toLowerCase() === "cer-error-boundary") {
2833
+ i._cerHandleChildError?.(
2834
+ r
2835
+ );
2836
+ break;
2837
+ }
2838
+ let o = i.parentElement;
2839
+ if (!o) {
2840
+ const c = i.getRootNode();
2841
+ c instanceof ShadowRoot && (o = c.host.parentElement);
2842
+ }
2843
+ i = o;
2844
+ }
2845
+ }
2846
+ }
2847
+ }
2848
+ // --- State, props, computed ---
2849
+ _initContext(t) {
2850
+ try {
2851
+ let s = function(i, o = "") {
2852
+ if (Array.isArray(i))
2853
+ return new Proxy(i, {
2854
+ get(c, f, u) {
2855
+ const m = Reflect.get(c, f, u);
2856
+ return typeof m == "function" && typeof f == "string" && [
2857
+ "push",
2858
+ "pop",
2859
+ "shift",
2860
+ "unshift",
2861
+ "splice",
2862
+ "sort",
2863
+ "reverse"
2864
+ ].includes(f) ? function(...d) {
2865
+ const C = m.apply(c, d);
2866
+ if (!r._initializing) {
2867
+ const T = o || "root";
2868
+ r._triggerWatchers(T, c), _e(
2869
+ () => r._render(t),
2870
+ r._componentId
2871
+ );
2872
+ }
2873
+ return C;
2874
+ } : m;
2875
+ },
2876
+ set(c, f, u) {
2877
+ if (c[String(f)] = u, !r._initializing) {
2878
+ const m = o ? `${o}.${String(f)}` : String(f);
2879
+ r._triggerWatchers(m, u), _e(() => r._render(t), r._componentId);
2880
+ }
2881
+ return !0;
2882
+ },
2883
+ deleteProperty(c, f) {
2884
+ if (delete c[String(f)], !r._initializing) {
2885
+ const u = o ? `${o}.${String(f)}` : String(f);
2886
+ r._triggerWatchers(u, void 0), _e(() => r._render(t), r._componentId);
2887
+ }
2888
+ return !0;
2889
+ }
2890
+ });
2891
+ if (i && typeof i == "object") {
2892
+ if (M(i))
2893
+ return i;
2894
+ for (const c in i) {
2895
+ const f = o ? `${o}.${c}` : c;
2896
+ i[c] = s(i[c], f);
2897
+ }
2898
+ return new Proxy(i, {
2899
+ set(c, f, u) {
2900
+ const m = o ? `${o}.${String(f)}` : String(f);
2901
+ return c[String(f)] = s(u, m), r._initializing || (r._triggerWatchers(
2902
+ m,
2903
+ c[String(f)]
2904
+ ), _e(() => r._render(t), r._componentId)), !0;
2905
+ },
2906
+ get(c, f, u) {
2907
+ return Reflect.get(c, f, u);
2908
+ }
2909
+ });
2910
+ }
2911
+ return i;
2912
+ };
2913
+ const r = this;
2914
+ return s({
2915
+ // For functional components, state is managed by state() function calls
2916
+ // Include prop defaults in initial reactive context so prop updates trigger reactivity
2917
+ ...t.props ? Object.fromEntries(
2918
+ Object.entries(t.props).map(([i, o]) => [
2919
+ i,
2920
+ o.default
2921
+ ])
2922
+ ) : {}
2923
+ });
2924
+ } catch {
2925
+ return {};
2926
+ }
2927
+ }
2928
+ _initWatchers(t) {
2929
+ this._runLogicWithinErrorBoundary(t, () => {
2930
+ Ot(
2931
+ this.context,
2932
+ this._watchers,
2933
+ {}
2934
+ // Watchers are now handled by the watch() function in functional API
2935
+ );
2936
+ });
2937
+ }
2938
+ _triggerWatchers(t, s) {
2939
+ jt(this.context, this._watchers, t, s);
2940
+ }
2941
+ _applyProps(t) {
2942
+ this._runLogicWithinErrorBoundary(t, () => {
2943
+ Mt(this, t, this.context);
2944
+ });
2945
+ }
2946
+ };
2947
+ }
2948
+ function mn() {
2949
+ return ee();
2950
+ }
2951
+ let H = null;
2952
+ function Ue(e) {
2953
+ H = e;
2954
+ }
2955
+ function Be() {
2956
+ H = null;
2957
+ }
2958
+ function gn() {
2959
+ return H;
2960
+ }
2961
+ function bn() {
2962
+ if (!H)
2963
+ throw new Error("useEmit must be called during component render");
2964
+ if (ee())
2965
+ return () => !1;
2966
+ const e = H.emit;
2967
+ if (typeof e != "function")
2968
+ throw new Error(
2969
+ "useEmit requires an emit function on the component context"
2970
+ );
2971
+ const n = e;
2972
+ return (t, s, r) => n(t, s, r);
2973
+ }
2974
+ function he(e) {
2975
+ e._hookCallbacks || Object.defineProperty(e, "_hookCallbacks", {
2976
+ value: {},
2977
+ writable: !0,
2978
+ enumerable: !1,
2979
+ configurable: !1
2980
+ });
2981
+ }
2982
+ function vn(e) {
2983
+ if (!H)
2984
+ throw new Error("useOnConnected must be called during component render");
2985
+ if (ee()) return;
2986
+ he(H);
2987
+ const n = H._hookCallbacks;
2988
+ n.onConnected || (n.onConnected = []), n.onConnected.push(e);
2989
+ }
2990
+ function En(e) {
2991
+ if (!H)
2992
+ throw new Error("useOnDisconnected must be called during component render");
2993
+ if (ee()) return;
2994
+ he(H);
2995
+ const n = H._hookCallbacks;
2996
+ n.onDisconnected || (n.onDisconnected = []), n.onDisconnected.push(e);
2997
+ }
2998
+ function Sn(e) {
2999
+ if (!H)
3000
+ throw new Error(
3001
+ "useOnAttributeChanged must be called during component render"
3002
+ );
3003
+ if (ee()) return;
3004
+ he(H);
3005
+ const n = H._hookCallbacks;
3006
+ n.onAttributeChanged || (n.onAttributeChanged = []), n.onAttributeChanged.push(e);
3007
+ }
3008
+ function Cn(e) {
3009
+ if (!H)
3010
+ throw new Error("useOnError must be called during component render");
3011
+ if (ee()) return;
3012
+ he(H);
3013
+ const n = H._hookCallbacks;
3014
+ n.onError || (n.onError = []), n.onError.push((t) => {
3015
+ try {
3016
+ t instanceof Error ? e(t) : e(new Error(String(t)));
3017
+ } catch {
3018
+ }
3019
+ });
3020
+ }
3021
+ function kn(e) {
3022
+ if (!H)
3023
+ throw new Error("useProps must be called during component render");
3024
+ he(H);
3025
+ const n = H._hookCallbacks;
3026
+ n.props = {
3027
+ ...n.props || {},
3028
+ ...e
3029
+ };
3030
+ const t = H;
3031
+ try {
3032
+ const r = Object.keys(e || {});
3033
+ for (const i of r) {
3034
+ if (typeof i != "string" || i.startsWith("_")) continue;
3035
+ const o = Object.getOwnPropertyDescriptor(t, i);
3036
+ if (!(o && !o.configurable))
3037
+ try {
3038
+ let f = Object.prototype.hasOwnProperty.call(t, i) ? t[i] : void 0;
3039
+ Object.defineProperty(t, i, {
3040
+ configurable: !0,
3041
+ enumerable: !0,
3042
+ get() {
3043
+ try {
3044
+ const u = t && t._host;
3045
+ if (u) {
3046
+ const m = Y(i), p = u.getAttribute(m);
3047
+ if (p !== null) {
3048
+ const d = typeof e[i];
3049
+ return d === "boolean" ? p === "" || p === "true" : d === "number" ? Number(p) : p;
3050
+ }
3051
+ if (typeof u[i] < "u") {
3052
+ const d = u[i];
3053
+ if (M(d) || d && typeof d == "object" && "value" in d && !(d instanceof Node))
3054
+ return d.value;
3055
+ const C = typeof e[i];
3056
+ if (!(C === "string" && d && typeof d == "object"))
3057
+ return C === "boolean" && typeof d == "string" ? d === "" || d === "true" : d;
3058
+ }
3059
+ }
3060
+ } catch {
3061
+ }
3062
+ return f;
3063
+ },
3064
+ set(u) {
3065
+ f = u;
3066
+ }
3067
+ });
3068
+ } catch {
3069
+ }
3070
+ }
3071
+ } catch {
3072
+ }
3073
+ return new Proxy({}, {
3074
+ get(r, i) {
3075
+ if (typeof i != "string") return;
3076
+ const o = e[i];
3077
+ try {
3078
+ const f = t && t._host;
3079
+ if (f) {
3080
+ if (f instanceof HTMLElement || typeof f.getAttribute == "function" && typeof f.hasAttribute == "function") {
3081
+ const m = i.replace(/([A-Z])/g, "-$1").toLowerCase(), p = f.getAttribute(m);
3082
+ if (p !== null)
3083
+ return typeof o == "boolean" ? p === "" || p === "true" : typeof o == "number" ? Number(p) : p;
3084
+ }
3085
+ const u = f[i];
3086
+ if (typeof u < "u" && u !== "") {
3087
+ const m = u && typeof u == "object" && "value" in u && !(u instanceof Node);
3088
+ if (!(typeof o == "string" && u && typeof u == "object" && !m && !M(u)))
3089
+ return typeof o == "boolean" && o === !1 && u === "" ? o : M(u) || m ? u.value : typeof o == "boolean" && typeof u == "string" ? u === "true" || u !== "" && u !== "false" : typeof o == "number" && typeof u == "string" && !Number.isNaN(Number(u)) ? Number(u) : u;
3090
+ }
3091
+ }
3092
+ } catch {
3093
+ }
3094
+ const c = t[i];
3095
+ return typeof o == "boolean" && c === "" ? o === !1 ? o : !0 : M(c) || c && typeof c == "object" && "value" in c && !(c instanceof Node) ? c.value : c != null && c !== "" ? typeof o == "boolean" && typeof c == "string" ? c === "true" : typeof o == "number" && typeof c == "string" && !Number.isNaN(Number(c)) ? Number(c) : c : o;
3096
+ },
3097
+ has(r, i) {
3098
+ return typeof i == "string" && (i in t || i in e);
3099
+ },
3100
+ ownKeys() {
3101
+ return Array.from(
3102
+ /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t || {})])
3103
+ );
3104
+ },
3105
+ getOwnPropertyDescriptor() {
3106
+ return { configurable: !0, enumerable: !0 };
3107
+ }
3108
+ });
3109
+ }
3110
+ function _n(e) {
3111
+ if (!H)
3112
+ throw new Error("useStyle must be called during component render");
3113
+ if (!ee()) {
3114
+ he(H);
3115
+ try {
3116
+ const n = e();
3117
+ Object.defineProperty(H, "_computedStyle", {
3118
+ value: n,
3119
+ writable: !0,
3120
+ enumerable: !1,
3121
+ configurable: !0
3122
+ });
3123
+ } catch (n) {
3124
+ V("Error in useStyle callback:", n), Object.defineProperty(H, "_computedStyle", {
3125
+ value: "",
3126
+ writable: !0,
3127
+ enumerable: !1,
3128
+ configurable: !0
3129
+ });
3130
+ }
3131
+ }
3132
+ }
3133
+ const je = /* @__PURE__ */ Symbol.for("@cer/provides");
3134
+ function An(e, n) {
3135
+ if (!H)
3136
+ throw new Error("provide must be called during component render");
3137
+ if (ee()) return;
3138
+ const t = H;
3139
+ t[je] || Object.defineProperty(t, je, {
3140
+ value: /* @__PURE__ */ new Map(),
3141
+ writable: !1,
3142
+ enumerable: !1,
3143
+ configurable: !0
3144
+ }), t[je].set(e, n);
3145
+ }
3146
+ function wn(e, n) {
3147
+ if (!H)
3148
+ throw new Error("inject must be called during component render");
3149
+ if (ee()) return n;
3150
+ try {
3151
+ const t = H._host;
3152
+ if (t) {
3153
+ let s = t.parentNode;
3154
+ for (s || (s = t.getRootNode()); s; )
3155
+ if (s instanceof ShadowRoot) {
3156
+ const r = s.host, i = r.context;
3157
+ if (i) {
3158
+ const c = i[je];
3159
+ if (c?.has(e))
3160
+ return c.get(e);
3161
+ }
3162
+ if (s = r.parentNode ?? r.getRootNode(), s === document || s === r) break;
3163
+ } else {
3164
+ if (s instanceof Element) {
3165
+ const o = s.context;
3166
+ if (o) {
3167
+ const c = o[je];
3168
+ if (c?.has(e))
3169
+ return c.get(e);
3170
+ }
3171
+ }
3172
+ const r = s;
3173
+ if (s = s.parentNode ?? s.getRootNode?.(), s === document || s === r) break;
3174
+ }
3175
+ }
3176
+ } catch {
3177
+ }
3178
+ return n;
3179
+ }
3180
+ function Tn(e) {
3181
+ return (n) => {
3182
+ const t = n ?? H;
3183
+ if (!t)
3184
+ throw new Error(
3185
+ "createComposable: no component context available. Pass a context explicitly or call inside a render function."
3186
+ );
3187
+ const s = H;
3188
+ Ue(t);
3189
+ try {
3190
+ return e();
3191
+ } finally {
3192
+ s ? Ue(s) : Be();
3193
+ }
3194
+ };
3195
+ }
3196
+ function Ln(e) {
3197
+ if (!H)
3198
+ throw new Error("useExpose must be called during component render");
3199
+ if (ee()) return;
3200
+ he(H);
3201
+ const n = H._hookCallbacks;
3202
+ n.expose = { ...n.expose ?? {}, ...e };
3203
+ const t = H._host;
3204
+ if (t)
3205
+ for (const [s, r] of Object.entries(e))
3206
+ try {
3207
+ t[s] = r;
3208
+ } catch {
3209
+ }
3210
+ }
3211
+ function Nn() {
3212
+ if (!H)
3213
+ throw new Error("useSlots must be called during component render");
3214
+ if (ee())
3215
+ return { has: () => !1, getNodes: () => [], names: () => [] };
3216
+ const e = H._host;
3217
+ return {
3218
+ /**
3219
+ * Returns true if the named slot (or the default slot when name is
3220
+ * omitted) has at least one slotted child element.
3221
+ */
3222
+ has(n) {
3223
+ return e ? !n || n === "default" ? Array.from(e.children).some((t) => !t.hasAttribute("slot")) : Array.from(e.children).some(
3224
+ (t) => t.getAttribute("slot") === n
3225
+ ) : !1;
3226
+ },
3227
+ /**
3228
+ * Returns all child elements assigned to the named slot (or the default
3229
+ * slot when name is omitted).
3230
+ */
3231
+ getNodes(n) {
3232
+ return e ? !n || n === "default" ? Array.from(e.children).filter(
3233
+ (t) => !t.hasAttribute("slot")
3234
+ ) : Array.from(e.children).filter(
3235
+ (t) => t.getAttribute("slot") === n
3236
+ ) : [];
3237
+ },
3238
+ /** Returns the names of all slots that have content, including 'default'. */
3239
+ names() {
3240
+ if (!e) return [];
3241
+ const n = /* @__PURE__ */ new Set();
3242
+ for (const t of Array.from(e.children)) {
3243
+ const s = t.getAttribute("slot");
3244
+ n.add(s ?? "default");
3245
+ }
3246
+ return Array.from(n);
3247
+ }
3248
+ };
3249
+ }
3250
+ function On(e, n) {
3251
+ Nt();
3252
+ let t = Y(e);
3253
+ t.includes("-") || (t = `cer-${t}`);
3254
+ const s = {}, r = {
3255
+ // Props are accessed via useProps() hook
3256
+ props: {},
3257
+ // Add lifecycle hooks from the stored functions
3258
+ onConnected: (i) => {
3259
+ if (s.onConnected)
3260
+ try {
3261
+ s.onConnected(i);
3262
+ } catch {
3263
+ }
3264
+ },
3265
+ onDisconnected: (i) => {
3266
+ if (s.onDisconnected)
3267
+ try {
3268
+ s.onDisconnected(i);
3269
+ } catch {
3270
+ }
3271
+ },
3272
+ onAttributeChanged: (i, o, c, f) => {
3273
+ if (s.onAttributeChanged)
3274
+ try {
3275
+ s.onAttributeChanged(i, o, c, f);
3276
+ } catch {
3277
+ }
3278
+ },
3279
+ onError: (i, o) => {
3280
+ if (s.onError && i)
3281
+ try {
3282
+ s.onError(i, o);
3283
+ } catch {
3284
+ }
3285
+ },
3286
+ render: (i) => {
3287
+ const o = i, c = o._componentId || `${t}-${crypto.randomUUID()}`;
3288
+ rt.setCurrentComponent(c, () => {
3289
+ i.requestRender && i.requestRender();
3290
+ });
3291
+ try {
3292
+ Object.defineProperty(i, "_hookCallbacks", {
3293
+ value: {},
3294
+ writable: !0,
3295
+ enumerable: !1,
3296
+ configurable: !0
3297
+ }), Ue(i);
3298
+ let f;
3299
+ try {
3300
+ f = n();
3301
+ } catch (u) {
3302
+ try {
3303
+ const p = o._hookCallbacks?.onError;
3304
+ if (Array.isArray(p))
3305
+ for (const d of p)
3306
+ try {
3307
+ d(u);
3308
+ } catch {
3309
+ }
3310
+ else if (typeof p == "function")
3311
+ try {
3312
+ p(u);
3313
+ } catch {
3314
+ }
3315
+ } catch {
3316
+ }
3317
+ try {
3318
+ const m = o._host;
3319
+ if (m?.parentElement) {
3320
+ let p = m.parentElement;
3321
+ for (; p; ) {
3322
+ if (p.tagName.toLowerCase() === "cer-error-boundary") {
3323
+ p._cerHandleChildError?.(
3324
+ u
3325
+ );
3326
+ break;
3327
+ }
3328
+ let d = p.parentElement;
3329
+ if (!d) {
3330
+ const C = p.getRootNode();
3331
+ C instanceof ShadowRoot && (d = C.host.parentElement);
3332
+ }
3333
+ p = d;
3334
+ }
3335
+ }
3336
+ } catch {
3337
+ }
3338
+ throw u;
3339
+ }
3340
+ if (o._hookCallbacks) {
3341
+ const u = o._hookCallbacks;
3342
+ if (u.onConnected) {
3343
+ const m = u.onConnected;
3344
+ s.onConnected = (p) => {
3345
+ for (const d of m)
3346
+ try {
3347
+ d(p);
3348
+ } catch {
3349
+ }
3350
+ };
3351
+ }
3352
+ if (u.onDisconnected) {
3353
+ const m = u.onDisconnected;
3354
+ s.onDisconnected = (p) => {
3355
+ for (const d of m)
3356
+ try {
3357
+ d(p);
3358
+ } catch {
3359
+ }
3360
+ };
3361
+ }
3362
+ if (u.onAttributeChanged) {
3363
+ const m = u.onAttributeChanged;
3364
+ s.onAttributeChanged = (p, d, C, T) => {
3365
+ for (const w of m)
3366
+ try {
3367
+ w(p, d, C, T);
3368
+ } catch {
3369
+ }
3370
+ };
3371
+ }
3372
+ if (u.onError) {
3373
+ const m = u.onError;
3374
+ s.onError = (p) => {
3375
+ for (const d of m)
3376
+ try {
3377
+ d(p);
3378
+ } catch {
3379
+ }
3380
+ };
3381
+ }
3382
+ if (u.props) {
3383
+ const m = u.props;
3384
+ r.props = Object.fromEntries(
3385
+ Object.entries(m).map(([p, d]) => [
3386
+ p,
3387
+ { type: typeof d == "boolean" ? Boolean : typeof d == "number" ? Number : typeof d == "string" ? String : Function, default: d }
3388
+ ])
3389
+ ), ge.set(t, r);
3390
+ }
3391
+ }
3392
+ return f;
3393
+ } finally {
3394
+ Be(), rt.clearCurrentComponent();
3395
+ }
3396
+ }
3397
+ };
3398
+ if (ge.set(t, r), typeof window < "u") {
3399
+ try {
3400
+ const i = {
3401
+ _hookCallbacks: {},
3402
+ requestRender: () => {
3403
+ },
3404
+ emit: () => !0
3405
+ };
3406
+ Ue(i), _t();
3407
+ try {
3408
+ n();
3409
+ } catch (o) {
3410
+ try {
3411
+ const f = i?._hookCallbacks?.onError;
3412
+ if (Array.isArray(f))
3413
+ for (const u of f)
3414
+ try {
3415
+ u(o);
3416
+ } catch {
3417
+ }
3418
+ else if (typeof f == "function")
3419
+ try {
3420
+ f(o);
3421
+ } catch {
3422
+ }
3423
+ B(
3424
+ `Error during component discovery render <${t}>:`,
3425
+ o
3426
+ ), V(
3427
+ "Error occurred during initial component discovery render. Consider guarding expensive expressions or using lazy factories for directives like when()."
3428
+ );
3429
+ } catch {
3430
+ }
3431
+ throw nt(), Be(), o;
3432
+ }
3433
+ if (nt(), Be(), i._hookCallbacks?.props) {
3434
+ const o = i._hookCallbacks.props;
3435
+ r.props = Object.fromEntries(
3436
+ Object.entries(o).map(([c, f]) => [
3437
+ c,
3438
+ { type: typeof f == "boolean" ? Boolean : typeof f == "number" ? Number : typeof f == "string" ? String : Function, default: f }
3439
+ ])
3440
+ ), ge.set(t, r);
3441
+ }
3442
+ } catch {
3443
+ }
3444
+ customElements.get(t) || customElements.define(
3445
+ t,
3446
+ sn(t, r)
3447
+ );
3448
+ }
3449
+ }
3450
+ function ce(e, n = {}, t, s) {
3451
+ const r = s ?? n.key;
3452
+ return { tag: e, key: r, props: n, children: t };
3453
+ }
3454
+ function Pe(e) {
3455
+ return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
3456
+ }
3457
+ function ue(e) {
3458
+ return typeof e == "object" && e !== null && "tag" in e && !Pe(e);
3459
+ }
3460
+ function on(e, n) {
3461
+ return e.key != null ? e : { ...e, key: n };
3462
+ }
3463
+ class cn {
3464
+ map = /* @__PURE__ */ new Map();
3465
+ maxSize;
3466
+ accessOrder = /* @__PURE__ */ new Map();
3467
+ accessCounter = 0;
3468
+ constructor(n) {
3469
+ this.maxSize = Math.max(1, n);
3470
+ }
3471
+ get(n) {
3472
+ const t = this.map.get(n);
3473
+ if (t !== void 0)
3474
+ return this.accessOrder.set(n, ++this.accessCounter), t;
3475
+ }
3476
+ set(n, t) {
3477
+ const s = this.map.has(n);
3478
+ this.map.set(n, t), this.accessOrder.set(n, ++this.accessCounter), !s && this.map.size > this.maxSize && this.evictLRU();
3479
+ }
3480
+ evictLRU() {
3481
+ let n, t = 1 / 0;
3482
+ for (const [s, r] of this.accessOrder)
3483
+ r < t && (t = r, n = s);
3484
+ n !== void 0 && (this.map.delete(n), this.accessOrder.delete(n));
3485
+ }
3486
+ has(n) {
3487
+ return this.map.has(n);
3488
+ }
3489
+ clear() {
3490
+ this.map.clear(), this.accessOrder.clear(), this.accessCounter = 0;
3491
+ }
3492
+ get size() {
3493
+ return this.map.size;
3494
+ }
3495
+ }
3496
+ const an = () => {
3497
+ if (typeof navigator < "u" && "deviceMemory" in navigator) {
3498
+ const n = navigator.deviceMemory;
3499
+ if (n)
3500
+ return Math.min(1e3, Math.max(200, n * 100));
3501
+ }
3502
+ return (() => {
3503
+ try {
3504
+ return globalThis.process?.env?.NODE_ENV === "test";
3505
+ } catch {
3506
+ return !1;
3507
+ }
3508
+ })() ? 100 : 500;
3509
+ }, Ge = new cn(
3510
+ an()
3511
+ );
3512
+ function ln(e, n) {
3513
+ if (e == null) {
3514
+ V(
3515
+ `⚠️ Event handler for '@${n}' is ${e}. This will prevent the event from working. Use a function reference instead: @${n}="\${functionName}"`
3516
+ );
3517
+ return;
3518
+ }
3519
+ typeof e != "function" && V(
3520
+ `🚨 Potential infinite loop detected! Event handler for '@${n}' appears to be the result of a function call (${typeof e}) instead of a function reference. Change @${n}="\${functionName()}" to @${n}="\${functionName}" to pass the function reference instead of calling it immediately.`
3521
+ ), e === void 0 && typeof e != "function" && V(
3522
+ `💡 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()}"`
3523
+ );
3524
+ }
3525
+ function fn(e, n = [], t = {}) {
3526
+ const s = {}, r = {}, i = {}, o = [], c = /([:@#]?)([a-zA-Z0-9-:.]+)(?:\s*=\s*("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|([^\s>]+)))?/g;
3527
+ let f;
3528
+ for (; f = c.exec(e); ) {
3529
+ const u = f[1], m = f[2];
3530
+ let p = "";
3531
+ for (let a = 3; a < f.length; a++)
3532
+ if (f[a] !== void 0) {
3533
+ p = f[a];
3534
+ break;
3535
+ }
3536
+ p.length >= 2 && (p[0] === '"' && p[p.length - 1] === '"' || p[0] === "'" && p[p.length - 1] === "'") && (p = p.slice(1, -1));
3537
+ const d = !/=/.test(f[0]), C = p.match(/^{{(\d+)}}$/);
3538
+ let T = d ? !0 : C ? n[Number(C[1])] ?? null : p;
3539
+ C || (T === "true" ? T = !0 : T === "false" ? T = !1 : T === "null" ? T = null : isNaN(Number(T)) || (T = Number(T)));
3540
+ const w = [
3541
+ "model",
3542
+ "bind",
3543
+ "show",
3544
+ "class",
3545
+ "style",
3546
+ "ref",
3547
+ "when"
3548
+ ];
3549
+ if (u === ":") {
3550
+ const [a, E] = m.split(":"), [v, ...b] = a.split(".");
3551
+ if (w.includes(v)) {
3552
+ const h = [...b], k = v === "model" && E ? `model:${E}` : v;
3553
+ i[k] = {
3554
+ value: T,
3555
+ modifiers: h,
3556
+ arg: E
3557
+ };
3558
+ } else if (m === "disabled") {
3559
+ let h = T;
3560
+ h && M(h) && (h = h.value);
3561
+ const k = typeof h;
3562
+ if (h === "" || k === "boolean" || k === "string" && (h === "true" || h === "false") || h == null || k === "number")
3563
+ s[m] = h;
3564
+ else {
3565
+ let y = T;
3566
+ y && M(y) && (y = y.value), r[m] = y;
3567
+ }
3568
+ o.push(m);
3569
+ } else {
3570
+ let h = T;
3571
+ h && M(h) && (h = h.value), r[m] = h, o.push(m);
3572
+ }
3573
+ } else if (u === "@") {
3574
+ const [a, ...E] = m.split("."), v = E;
3575
+ ln(T, a);
3576
+ const b = typeof T == "function" ? T : typeof t[T] == "function" ? t[T] : void 0;
3577
+ if (b) {
3578
+ const h = (S) => {
3579
+ if (v.includes("prevent") && S.preventDefault(), v.includes("stop") && S.stopPropagation(), !(v.includes("self") && S.target !== S.currentTarget))
3580
+ return v.includes("once") && S.currentTarget?.removeEventListener(
3581
+ a,
3582
+ h
3583
+ ), b(S);
3584
+ }, k = "on" + a.charAt(0).toUpperCase() + a.slice(1);
3585
+ s[k] = h;
3586
+ }
3587
+ } else m === "ref" ? s.ref = T : r[m] = T;
3588
+ }
3589
+ return { props: s, attrs: r, directives: i, bound: o };
3590
+ }
3591
+ function Xe(e) {
3592
+ if (!ue(e) || Pe(e))
3593
+ return e;
3594
+ const n = e.props?.directives;
3595
+ if (n && n.when) {
3596
+ const t = n.when.value, s = M(t) ? t.value : t, r = { ...n };
3597
+ delete r.when;
3598
+ const i = { ...e.props };
3599
+ Object.keys(r).length > 0 ? i.directives = r : delete i.directives;
3600
+ const o = {
3601
+ ...e,
3602
+ props: i
3603
+ };
3604
+ return Array.isArray(o.children) && (o.children = o.children.map(
3605
+ (f) => typeof f == "object" && f !== null ? Xe(f) : f
3606
+ )), {
3607
+ tag: "#anchor",
3608
+ key: e.key != null ? `when-${e.key}` : `when-${e.tag}`,
3609
+ children: s ? [o] : []
3610
+ };
3611
+ }
3612
+ if (Array.isArray(e.children)) {
3613
+ const t = e.children.map(
3614
+ (s) => typeof s == "object" && s !== null ? Xe(s) : s
3615
+ );
3616
+ return {
3617
+ ...e,
3618
+ children: t
3619
+ };
3620
+ }
3621
+ return e;
3622
+ }
3623
+ function un(e, n, t) {
3624
+ const s = Oe.length > 0 ? Oe[Oe.length - 1] : void 0, r = t ?? s, i = !t && n.length === 0, o = i ? e.join("<!--TEMPLATE_DELIM-->") : null;
3625
+ if (i && o) {
3626
+ const l = Ge.get(o);
3627
+ if (l) return l;
3628
+ }
3629
+ function c(l, g) {
3630
+ return ce("#text", {}, l, g);
3631
+ }
3632
+ function f(l, g, A = !1) {
3633
+ let N = typeof l == "string" ? At(l) : l;
3634
+ return !A && typeof N == "string" && /[\r\n]/.test(N) && (N = N.replace(/\s+/g, " ")), ce("#text", {}, N, g);
3635
+ }
3636
+ let u = "";
3637
+ for (let l = 0; l < e.length; l++)
3638
+ u += e[l], l < n.length && (u += `{{${l}}}`);
3639
+ const m = /<!--[\s\S]*?-->|<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, p = [];
3640
+ let d, C = [], T = null, w = {}, a, E = 0;
3641
+ const v = [], b = /* @__PURE__ */ new Set([
3642
+ "pre",
3643
+ "code",
3644
+ "textarea",
3645
+ "script",
3646
+ "style"
3647
+ ]);
3648
+ function h() {
3649
+ if (T && b.has(T.toLowerCase()))
3650
+ return !0;
3651
+ for (const l of p)
3652
+ if (b.has(l.tag.toLowerCase()))
3653
+ return !0;
3654
+ return !1;
3655
+ }
3656
+ function k(l) {
3657
+ if (!l || typeof l != "object" || Pe(l)) return;
3658
+ const g = l, A = w;
3659
+ if (g.props || g.attrs) {
3660
+ const N = g;
3661
+ N.props && (A.props || (A.props = {}), Object.assign(A.props, N.props)), N.attrs && (A.attrs || (A.attrs = {}), Object.keys(N.attrs).forEach((O) => {
3662
+ if (O === "style" && A.attrs.style) {
3663
+ const P = String(A.attrs.style).replace(/;?\s*$/, ""), D = String(N.attrs.style).replace(/^;?\s*/, "");
3664
+ A.attrs.style = P + "; " + D;
3665
+ } else if (O === "class" && A.attrs.class) {
3666
+ const P = String(A.attrs.class).trim().split(/\s+/).filter(Boolean), D = String(N.attrs.class).trim().split(/\s+/).filter(Boolean), j = [
3667
+ .../* @__PURE__ */ new Set([...P, ...D])
3668
+ ];
3669
+ A.attrs.class = j.join(" ");
3670
+ } else
3671
+ A.attrs[O] = N.attrs[O];
3672
+ }));
3673
+ } else
3674
+ A.props || (A.props = {}), Object.assign(A.props, g);
3675
+ }
3676
+ function S(l, g) {
3677
+ const A = T ? C : v;
3678
+ if (Pe(l)) {
3679
+ const N = l.key ?? g, O = l.children;
3680
+ A.push({
3681
+ ...l,
3682
+ key: N,
3683
+ children: O
3684
+ });
3685
+ return;
3686
+ }
3687
+ if (ue(l)) {
3688
+ A.push(on(l, void 0));
3689
+ return;
3690
+ }
3691
+ if (Array.isArray(l)) {
3692
+ if (l.length === 0) return;
3693
+ for (let N = 0; N < l.length; N++) {
3694
+ const O = l[N];
3695
+ Pe(O) || ue(O) || Array.isArray(O) ? S(O, `${g}-${N}`) : O !== null && typeof O == "object" ? st(O) ? A.push(
3696
+ ce(
3697
+ "#raw",
3698
+ {},
3699
+ O.__rawHTML,
3700
+ `${g}-${N}`
3701
+ )
3702
+ ) : k(O) : A.push(c(String(O), `${g}-${N}`));
3703
+ }
3704
+ return;
3705
+ }
3706
+ if (l !== null && typeof l == "object") {
3707
+ if (st(l)) {
3708
+ const N = l.__rawHTML ?? "";
3709
+ A.push(ce("#raw", {}, N, g));
3710
+ return;
3711
+ }
3712
+ k(l);
3713
+ return;
3714
+ }
3715
+ A.push(c(String(l), g));
3716
+ }
3717
+ const L = /* @__PURE__ */ new Set([
3718
+ "area",
3719
+ "base",
3720
+ "br",
3721
+ "col",
3722
+ "embed",
3723
+ "hr",
3724
+ "img",
3725
+ "input",
3726
+ "link",
3727
+ "meta",
3728
+ "param",
3729
+ "source",
3730
+ "track",
3731
+ "wbr"
3732
+ ]);
3733
+ for (; d = m.exec(u); )
3734
+ if (!(d[0].startsWith("<!--") && d[0].endsWith("-->"))) {
3735
+ if (d[1]) {
3736
+ const l = d[1], g = d[0][1] === "/", A = d[0][d[0].length - 2] === "/" || L.has(l), {
3737
+ props: N,
3738
+ attrs: O,
3739
+ directives: P,
3740
+ bound: D
3741
+ } = fn(
3742
+ d[2] || "",
3743
+ n,
3744
+ r ?? {}
3745
+ ), j = { props: {}, attrs: {} };
3746
+ for (const z in N) j.props[z] = N[z];
3747
+ for (const z in O) j.attrs[z] = O[z];
3748
+ j.attrs && Object.prototype.hasOwnProperty.call(j.attrs, "key") && !(j.props && Object.prototype.hasOwnProperty.call(j.props, "key")) && x(() => {
3749
+ j.props.key = j.attrs.key;
3750
+ });
3751
+ try {
3752
+ const z = {
3753
+ input: [
3754
+ "value",
3755
+ "checked",
3756
+ "readonly",
3757
+ "required",
3758
+ "placeholder",
3759
+ "maxlength",
3760
+ "minlength"
3761
+ ],
3762
+ textarea: [
3763
+ "value",
3764
+ "readonly",
3765
+ "required",
3766
+ "placeholder",
3767
+ "maxlength",
3768
+ "minlength"
3769
+ ],
3770
+ select: ["value", "required", "multiple"],
3771
+ option: ["selected", "value"],
3772
+ video: ["muted", "autoplay", "controls", "loop", "playsinline"],
3773
+ audio: ["muted", "autoplay", "controls", "loop"],
3774
+ img: ["src", "alt", "width", "height"],
3775
+ button: ["type", "name", "value", "autofocus", "form"]
3776
+ }, I = l.toLowerCase(), ie = z[I] ?? [];
3777
+ if (j.attrs) {
3778
+ for (const R of ie)
3779
+ if (D && D.includes(R) && R in j.attrs && !(j.props && R in j.props)) {
3780
+ let $ = j.attrs[R];
3781
+ if ($ && M($))
3782
+ $ = $.value, j.props[R] = $, delete j.attrs[R];
3783
+ else if ($ && typeof $ == "object" && "value" in $ && !($ instanceof Node))
3784
+ try {
3785
+ const W = $.value;
3786
+ j.props[R] = (I === "select" || I === "option") && R === "value" ? String(W) : W, delete j.attrs[R];
3787
+ } catch {
3788
+ }
3789
+ else {
3790
+ const W = typeof $;
3791
+ if (R === "disabled")
3792
+ ($ === "" || W === "boolean" || W === "string" && ($ === "true" || $ === "false") || $ == null || W === "number") && (j.props[R] = $, delete j.attrs[R]);
3793
+ else if ($ === "" || W === "string" || W === "number" || W === "boolean" || $ == null) {
3794
+ const te = (I === "select" || I === "option") && R === "value" ? String($) : $;
3795
+ j.props[R] = te, delete j.attrs[R];
3796
+ }
3797
+ }
3798
+ }
3799
+ }
3800
+ if (l.includes("-") || !!r?.__customElements?.has?.(l)) {
3801
+ if (j.isCustomElement = !0, D && j.attrs) {
3802
+ const R = /* @__PURE__ */ new Set(["id", "name", "data-key", "key"]);
3803
+ for (const $ of D)
3804
+ if ($ in j.attrs && !(j.props && $ in j.props)) {
3805
+ const W = $.includes("-") ? Qe($) : $, te = j.attrs[$];
3806
+ if (j.props[W] = te, R.has($) || pt($))
3807
+ try {
3808
+ const xe = F(j.attrs[$]);
3809
+ xe === null ? delete j.attrs[$] : j.attrs[$] = xe;
3810
+ } catch {
3811
+ delete j.attrs[$];
3812
+ }
3813
+ else
3814
+ delete j.attrs[$];
3815
+ }
3816
+ }
3817
+ try {
3818
+ if (j.attrs && !(j.props && "modelValue" in j.props)) {
3819
+ const R = j.attrs["model-value"] ?? j.attrs.modelValue;
3820
+ typeof R < "u" && (j.props.modelValue = R);
3821
+ }
3822
+ } catch {
3823
+ }
3824
+ }
3825
+ } catch {
3826
+ }
3827
+ if (P && Object.keys(P).some(
3828
+ (z) => z === "model" || z.startsWith("model:")
3829
+ ))
3830
+ try {
3831
+ const I = globalThis[/* @__PURE__ */ Symbol.for("cer.registry")], ie = !!(I && typeof I.has == "function" && I.has(l)), X = r, R = !!(X && (X.__customElements instanceof Set && X.__customElements.has(l) || Array.isArray(X.__isCustomElements) && X.__isCustomElements.includes(l)));
3832
+ if (!!(l.includes("-") || R || ie))
3833
+ for (const te of Object.keys(P)) {
3834
+ if (te !== "model" && !te.startsWith("model:")) continue;
3835
+ const $e = P[te], xe = $e.arg ?? (te.includes(":") ? te.split(":", 2)[1] : void 0), q = $e.value, ze = xe ?? "modelValue", et = K, vt = We, Se = r?._state || r;
3836
+ let se;
3837
+ typeof q == "string" && Se ? se = et(
3838
+ Se,
3839
+ q
3840
+ ) : se = q, j.props[ze] = se;
3841
+ try {
3842
+ const ae = Y(ze);
3843
+ j.attrs || (j.attrs = {}), se != null && (typeof se == "string" || typeof se == "number" || typeof se == "boolean") && (j.attrs[ae] = se);
3844
+ } catch {
3845
+ }
3846
+ j.isCustomElement = !0;
3847
+ const tt = `update:${Y(ze)}`.replace(
3848
+ /-([a-z])/g,
3849
+ (ae, re) => re.toUpperCase()
3850
+ ), Et = "on" + tt.charAt(0).toUpperCase() + tt.slice(1);
3851
+ j.props[Et] = function(ae) {
3852
+ const re = ae.detail !== void 0 ? ae.detail : ae.target ? ae.target.value : void 0;
3853
+ if (Se)
3854
+ if (q && M(q)) {
3855
+ const le = q.value;
3856
+ if (Array.isArray(re) && Array.isArray(le) ? JSON.stringify([...re].sort()) !== JSON.stringify([...le].sort()) : re !== le) {
3857
+ q.value = re;
3858
+ try {
3859
+ const fe = r;
3860
+ if (fe) {
3861
+ const Ce = fe.requestRender, ke = fe._requestRender;
3862
+ typeof Ce == "function" ? Ce() : typeof ke == "function" && ke();
3863
+ }
3864
+ } catch {
3865
+ }
3866
+ }
3867
+ } else {
3868
+ const le = et(
3869
+ Se || {},
3870
+ typeof q == "string" ? q : String(q)
3871
+ );
3872
+ if (Array.isArray(re) && Array.isArray(le) ? JSON.stringify([...re].sort()) !== JSON.stringify([...le].sort()) : re !== le) {
3873
+ vt(
3874
+ Se || {},
3875
+ typeof q == "string" ? q : String(q),
3876
+ re
3877
+ );
3878
+ try {
3879
+ const fe = r;
3880
+ if (fe) {
3881
+ const Ce = fe.requestRender, ke = fe._requestRender;
3882
+ typeof Ce == "function" ? Ce() : typeof ke == "function" && ke();
3883
+ }
3884
+ } catch {
3885
+ }
3886
+ }
3887
+ }
3888
+ }, delete P[te];
3889
+ }
3890
+ } catch {
3891
+ }
3892
+ if (Object.keys(P).length > 0 && (j.directives = { ...P }), g) {
3893
+ const z = C.some(
3894
+ (R) => typeof R == "object" && R.tag !== "#text"
3895
+ );
3896
+ let I = C;
3897
+ if (z && C.length > 0) {
3898
+ let R = 0;
3899
+ for (; R < C.length; ) {
3900
+ const W = C[R];
3901
+ if (!ue(W) || W.tag !== "#text" || typeof W.children != "string" || W.children.trim() !== "")
3902
+ break;
3903
+ R++;
3904
+ }
3905
+ let $ = C.length - 1;
3906
+ for (; $ >= 0; ) {
3907
+ const W = C[$];
3908
+ if (!ue(W) || W.tag !== "#text" || typeof W.children != "string" || W.children.trim() !== "")
3909
+ break;
3910
+ $--;
3911
+ }
3912
+ R === 0 && $ === C.length - 1 ? I = C : R > $ ? I = [] : I = C.slice(R, $ + 1);
3913
+ }
3914
+ const ie = ce(
3915
+ T,
3916
+ w,
3917
+ I.length === 1 && ue(I[0]) && I[0].tag === "#text" ? typeof I[0].children == "string" ? I[0].children : "" : I.length ? I : void 0,
3918
+ a
3919
+ ), X = p.pop();
3920
+ X ? (T = X.tag, w = X.props, a = X.key, C = X.children, C.push(ie)) : (v.push(ie), T = null, w = {}, a = void 0, C = []);
3921
+ } else A ? T ? C.push(ce(l, j, void 0, void 0)) : v.push(ce(l, j, void 0, void 0)) : (T && p.push({
3922
+ tag: T,
3923
+ props: w,
3924
+ children: C,
3925
+ key: a
3926
+ }), T = l, w = j, C = []);
3927
+ } else if (typeof d[3] < "u") {
3928
+ const l = Number(d[3]), g = n[l], A = `interp-${l}`;
3929
+ S(g, A);
3930
+ } else if (d[4]) {
3931
+ const l = d[4], g = T ? C : v, A = l.split(/({{\d+}})/);
3932
+ for (const N of A) {
3933
+ if (!N) continue;
3934
+ const O = N.match(/^{{(\d+)}}$/);
3935
+ if (O) {
3936
+ const P = Number(O[1]), D = n[P], j = `interp-${P}`;
3937
+ S(D, j);
3938
+ } else {
3939
+ const P = `text-${E++}`, D = h();
3940
+ g.push(f(N, P, D));
3941
+ }
3942
+ }
3943
+ }
3944
+ }
3945
+ const _ = v.filter((l) => ue(l) && l.tag === "#text" ? typeof l.children == "string" && l.children.trim() !== "" : !0).map(
3946
+ (l) => Xe(l)
3947
+ );
3948
+ if (_.length === 1) {
3949
+ const l = _[0];
3950
+ return i && o && Ge.set(o, l), l;
3951
+ } else if (_.length > 1) {
3952
+ const l = _;
3953
+ return i && o && Ge.set(o, l), l;
3954
+ }
3955
+ return ce("div", {}, "", "fallback-root");
3956
+ }
3957
+ function jn(e, ...n) {
3958
+ if (ee()) return [];
3959
+ const t = n[n.length - 1], s = typeof t == "object" && t && !Array.isArray(t) ? t : void 0;
3960
+ return un(e, n, s);
3961
+ }
3962
+ export {
3963
+ Ln as a,
3964
+ kn as b,
3965
+ On as c,
3966
+ Tn as d,
3967
+ wn as e,
3968
+ bn as f,
3969
+ gn as g,
3970
+ jn as h,
3971
+ mn as i,
3972
+ Sn as j,
3973
+ vn as k,
3974
+ En as l,
3975
+ Nn as m,
3976
+ _n as n,
3977
+ An as p,
3978
+ Cn as u,
3979
+ Yt as v
3980
+ };
3981
+ //# sourceMappingURL=template-compiler-CJFwjLCP.js.map