@jasonshimmy/custom-elements-runtime 2.8.2 → 3.1.0

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