@jasonshimmy/custom-elements-runtime 2.5.1 → 2.5.2

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