@jasonshimmy/custom-elements-runtime 2.8.1 → 3.0.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 (91) hide show
  1. package/README.md +159 -46
  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 +70 -67
  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 +38 -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 +448 -434
  25. package/dist/custom-elements-runtime.router.es.js.map +1 -1
  26. package/dist/custom-elements-runtime.ssr.cjs.js +1 -1
  27. package/dist/custom-elements-runtime.ssr.cjs.js.map +1 -1
  28. package/dist/custom-elements-runtime.ssr.es.js +33 -18
  29. package/dist/custom-elements-runtime.ssr.es.js.map +1 -1
  30. package/dist/custom-elements-runtime.store.cjs.js +1 -1
  31. package/dist/custom-elements-runtime.store.cjs.js.map +1 -1
  32. package/dist/custom-elements-runtime.store.es.js +21 -16
  33. package/dist/custom-elements-runtime.store.es.js.map +1 -1
  34. package/dist/custom-elements-runtime.transitions.cjs.js +1 -1
  35. package/dist/custom-elements-runtime.transitions.cjs.js.map +1 -1
  36. package/dist/custom-elements-runtime.transitions.es.js +279 -7
  37. package/dist/custom-elements-runtime.transitions.es.js.map +1 -1
  38. package/dist/custom-elements-runtime.vite-plugin.cjs.js +2 -0
  39. package/dist/custom-elements-runtime.vite-plugin.cjs.js.map +1 -0
  40. package/dist/custom-elements-runtime.vite-plugin.es.js +73 -0
  41. package/dist/custom-elements-runtime.vite-plugin.es.js.map +1 -0
  42. package/dist/dom-jit-css.d.ts +66 -0
  43. package/dist/event-bus.d.ts +3 -1
  44. package/dist/{namespace-helpers-DhLBqt-7.js → helpers-CweFZFWU.js} +265 -287
  45. package/dist/helpers-CweFZFWU.js.map +1 -0
  46. package/dist/helpers-DeWjSmOl.cjs +5 -0
  47. package/dist/helpers-DeWjSmOl.cjs.map +1 -0
  48. package/dist/hooks-BrrLKSub.cjs +3 -0
  49. package/dist/hooks-BrrLKSub.cjs.map +1 -0
  50. package/dist/hooks-DyShDHKo.js +403 -0
  51. package/dist/hooks-DyShDHKo.js.map +1 -0
  52. package/dist/index.d.ts +3 -3
  53. package/dist/jit-css.d.ts +30 -0
  54. package/dist/namespace-helpers-CnpZ5__p.js +45 -0
  55. package/dist/namespace-helpers-CnpZ5__p.js.map +1 -0
  56. package/dist/namespace-helpers-CyIDtI97.cjs +2 -0
  57. package/dist/namespace-helpers-CyIDtI97.cjs.map +1 -0
  58. package/dist/router/types.d.ts +4 -2
  59. package/dist/runtime/css-utils.d.ts +33 -0
  60. package/dist/runtime/discovery-state.d.ts +3 -0
  61. package/dist/runtime/hooks.d.ts +78 -0
  62. package/dist/runtime/jit-hooks.d.ts +28 -0
  63. package/dist/runtime/render-bridge.d.ts +37 -0
  64. package/dist/runtime/scheduler.d.ts +3 -4
  65. package/dist/runtime/secure-expression-evaluator.d.ts +0 -1
  66. package/dist/runtime/style.d.ts +84 -26
  67. package/dist/runtime/template-compiler/lru-cache.d.ts +0 -3
  68. package/dist/runtime/vdom-helpers.d.ts +0 -1
  69. package/dist/ssr.d.ts +42 -0
  70. package/dist/{transitions-DMJXs_tY.js → style-BmyOIMcU.js} +904 -1344
  71. package/dist/style-BmyOIMcU.js.map +1 -0
  72. package/dist/style-D40DsIqJ.cjs +55 -0
  73. package/dist/style-D40DsIqJ.cjs.map +1 -0
  74. package/dist/style.css +1 -1
  75. package/dist/template-compiler-B5uN1EQw.js +3731 -0
  76. package/dist/template-compiler-B5uN1EQw.js.map +1 -0
  77. package/dist/template-compiler-Cx623BSB.cjs +23 -0
  78. package/dist/template-compiler-Cx623BSB.cjs.map +1 -0
  79. package/dist/variables.css +1 -1
  80. package/dist/vite-plugin.d.ts +52 -0
  81. package/package.json +55 -6
  82. package/dist/namespace-helpers-Ctd_h7j2.cjs +0 -5
  83. package/dist/namespace-helpers-Ctd_h7j2.cjs.map +0 -1
  84. package/dist/namespace-helpers-DhLBqt-7.js.map +0 -1
  85. package/dist/template-compiler-CVBKYu3j.js +0 -3991
  86. package/dist/template-compiler-CVBKYu3j.js.map +0 -1
  87. package/dist/template-compiler-G8h2OJbA.cjs +0 -23
  88. package/dist/template-compiler-G8h2OJbA.cjs.map +0 -1
  89. package/dist/transitions-DMJXs_tY.js.map +0 -1
  90. package/dist/transitions-f4KfN29T.cjs +0 -330
  91. package/dist/transitions-f4KfN29T.cjs.map +0 -1
@@ -1,3991 +0,0 @@
1
- import { j as K, t as J, i as P, k as We, m as x, o as V, p as U, q, T as Ct, v as Xe, S as kt, x as pt, y as _e, z as Y, 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 ee, d as B } 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 ye, m as Ae, s as Lt, d as ot } from "./transitions-DMJXs_tY.js";
5
- const ge = /* @__PURE__ */ new Map(), Ke = /* @__PURE__ */ Symbol.for("cer.registry");
6
- function Nt() {
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([...ge.entries()]), n[Ke].__realmId = t;
13
- }
14
- } catch (n) {
15
- ee("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: K(e, s)
26
- }), o.immediate)
27
- try {
28
- const c = K(e, s);
29
- i(c, void 0, e);
30
- } catch (c) {
31
- B(`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
- B(`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 = K(e, o);
54
- r(f, c.oldValue) || (c.callback(f, c.oldValue, e), c.oldValue = f);
55
- } catch (f) {
56
- B(`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 = J(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 = J(i), u = e.getAttribute(f);
109
- if (u !== null)
110
- return u;
111
- const h = e[i];
112
- let p;
113
- return P(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 $t(e, n, t, s) {
129
- e.onConnected && !t && (e.onConnected(n), s(!0));
130
- }
131
- function xt(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 ne {
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
- ee("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
- ee("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 ee("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) => K(r, s);
285
- }
286
- return n.includes("ctx") || /[+\-*/%<>=&|?:[\]]/.test(n) ? this.createSimpleEvaluator(n) : (s) => K(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] = K(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 = K(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 = K(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 = K(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 K(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:${J(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 (x(() => {
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 = V(r);
678
- i !== null ? x(() => {
679
- typeof e.setAttribute == "function" && U(
680
- e,
681
- J(n),
682
- String(i)
683
- );
684
- }) : x(() => {
685
- typeof e.removeAttribute == "function" && q(e, J(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 K(r, n);
696
- }
697
- }
698
- function Ne(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 oe(e, n, t) {
705
- if (!e) return;
706
- e.attrs || (e.attrs = {});
707
- const s = e.attrs;
708
- s[n] = t;
709
- }
710
- function Q(e) {
711
- return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement;
712
- }
713
- function pe(e) {
714
- return e != null && typeof e == "object" && "value" in e ? pe(e.value) : !(e != null && typeof e == "object" || e === !1 || e === "false" || e === null || e === void 0 || e === 0);
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 (P(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 K(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 && P(e))
757
- t[a] = e;
758
- else {
759
- t[a] = d;
760
- try {
761
- const m = J(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 L = w.indexOf(y);
784
- L > -1 && w.splice(L, 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(P(e), e, T, i, c), Ie(i, P(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 && ne.removeListener(o, b, m);
818
- }
819
- r[b] = E;
820
- } else {
821
- const m = `update:${J(a)}`, v = `update:${a}`;
822
- if (r[m]) {
823
- const S = r[m];
824
- o && ne.removeListener(o, m, S);
825
- }
826
- if (r[v]) {
827
- const S = r[v];
828
- o && ne.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
- P(e),
844
- e,
845
- i,
846
- c
847
- );
848
- if (He(T, g)) {
849
- it(P(e), e, T, i, c), Ie(i, P(e), e, T);
850
- const l = S.target;
851
- l && ct(
852
- l,
853
- a,
854
- P(e) ? e : T,
855
- P(e)
856
- );
857
- }
858
- }, P(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:${J(g)}`, l = `update:${g}`;
870
- r[_] || (r[_] = (y) => {
871
- const w = y.detail !== void 0 ? y.detail : y.target?.value, L = P(e) ? e.value[g] : K(
872
- i?._state || i,
873
- e
874
- );
875
- if (!He(w, L)) return;
876
- if (P(e)) {
877
- const D = {
878
- ...e.value
879
- };
880
- D[g] = w, e.value = D;
881
- } else
882
- We(
883
- i?._state || i,
884
- e,
885
- w
886
- );
887
- Ie(i, P(e), e, w);
888
- const M = y.currentTarget || o || y.target;
889
- M && ct(
890
- M,
891
- a,
892
- P(e) ? e : w,
893
- P(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 = K(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, P(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 && Q(r)) {
930
- const c = o && typeof o == "object" && "value" in o;
931
- (() => {
932
- try {
933
- return P(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 = Pe(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 && Q(r)) {
949
- const f = c && typeof c == "object" && "value" in c;
950
- (() => {
951
- try {
952
- return P(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 = K(
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 = Pe(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 Pe(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 = Pe(e, t);
1006
- } else
1007
- r = e;
1008
- try {
1009
- if (r && typeof r == "object") {
1010
- if (P(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 = Pe(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 = Pe(e, t)), P(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 && Q(t)) {
1124
- const f = r.disabled, u = f && typeof f == "object" && "value" in f;
1125
- let h = !1;
1126
- try {
1127
- h = P(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 be(e) {
1151
- return e ? e.split(/\s+/).filter(Boolean) : [];
1152
- }
1153
- function ve(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 me(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 we(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
- B("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
- B("Transition onAfterEnter error:", k);
1203
- }
1204
- p();
1205
- }) : p();
1206
- }) : void 0;
1207
- const o = be(t?.enterFrom), c = be(t?.enterActive), f = be(t?.enterTo);
1208
- ve(e, o), e.offsetHeight, ve(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
- B("Transition onEnter error:", d);
1221
- }
1222
- u && await p;
1223
- }
1224
- await new Promise((p) => requestAnimationFrame(() => p())), e.offsetHeight, me(e, o), ve(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), me(e, c), s?.onAfterEnter)
1227
- try {
1228
- s.onAfterEnter(e);
1229
- } catch (p) {
1230
- B("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
- B("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
- B("Transition onAfterLeave error:", k);
1250
- }
1251
- p();
1252
- }) : p();
1253
- }) : void 0;
1254
- const o = be(t?.leaveFrom), c = be(t?.leaveActive), f = be(t?.leaveTo);
1255
- ve(e, o), e.offsetHeight, ve(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
- B("Transition onLeave error:", d);
1268
- }
1269
- u && await p;
1270
- }
1271
- await new Promise((p) => requestAnimationFrame(() => p())), me(e, o), ve(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), me(e, c), me(e, f), me(e, o), s?.onAfterLeave)
1274
- try {
1275
- s.onAfterLeave(e);
1276
- } catch (p) {
1277
- B("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 G(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 = V(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 de(e, n) {
1334
- if (n) {
1335
- if (e instanceof Element) {
1336
- ne.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
- de(t[s], n);
1347
- }
1348
- }
1349
- }
1350
- function Te(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 (P(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 (x(() => {
1425
- (P(b) || Ne(b)) && (m = b.value);
1426
- }), x(() => {
1427
- (P(E) || Ne(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" && ne.removeListener(e, S, b), typeof E == "function" && ne.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 (P(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 = (L) => {
1455
- const N = L.detail !== void 0 ? L.detail : L.target instanceof HTMLInputElement || L.target instanceof HTMLTextAreaElement || L.target instanceof HTMLSelectElement ? L.target.value : void 0, D = { ...P(T) ? T.value || {} : h[C] || {}, [l]: N };
1456
- try {
1457
- typeof E == "function" && E({
1458
- detail: D
1459
- });
1460
- } catch {
1461
- }
1462
- };
1463
- x(() => {
1464
- ne.addListener(e, y, w);
1465
- });
1466
- }
1467
- }
1468
- } catch {
1469
- }
1470
- } else if (E == null)
1471
- q(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 && Q(e) && q(e, "disabled");
1477
- } catch {
1478
- }
1479
- else
1480
- E === !1 && q(e, a);
1481
- }
1482
- }
1483
- for (const [a, b] of Object.entries(
1484
- o.listeners || {}
1485
- )) {
1486
- ne.addListener(e, a, b);
1487
- try {
1488
- const E = e && e.parentElement;
1489
- E && E !== e && ne.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 (P(b) && (m = b.value), P(E) && (v = E.value), m !== v)
1531
- if (d = !0, v == null || v === !1)
1532
- x(() => {
1533
- q(e, a);
1534
- }), oe(n, a, void 0), a === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement ? x(() => {
1535
- e.value = "";
1536
- }) : e instanceof HTMLSelectElement ? x(() => {
1537
- e.value = "";
1538
- }) : e instanceof HTMLProgressElement && x(() => {
1539
- e.value = 0;
1540
- })), a === "checked" && e instanceof HTMLInputElement && x(() => {
1541
- e.checked = !1;
1542
- }), a === "disabled" && Q(e) && x(() => {
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
- x(() => {
1549
- e.value = v ?? "";
1550
- });
1551
- continue;
1552
- } else if (e instanceof HTMLSelectElement) {
1553
- x(() => {
1554
- e.value = v ?? "";
1555
- });
1556
- continue;
1557
- } else if (e instanceof HTMLProgressElement) {
1558
- x(() => {
1559
- e.value = Number(v);
1560
- });
1561
- continue;
1562
- }
1563
- }
1564
- if (a === "checked" && e instanceof HTMLInputElement) {
1565
- x(() => {
1566
- e.checked = !!v;
1567
- });
1568
- continue;
1569
- }
1570
- if (a === "style") {
1571
- const C = V(v);
1572
- C !== null && U(e, a, String(C)), oe(n, a, v);
1573
- continue;
1574
- }
1575
- if (a === "class") {
1576
- const C = V(v);
1577
- C !== null && U(e, a, String(C)), oe(n, a, v);
1578
- continue;
1579
- }
1580
- if (a === "disabled" && Q(e)) {
1581
- x(() => {
1582
- const C = pe(v);
1583
- (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement) && (e.disabled = C);
1584
- }), pe(v) ? x(() => {
1585
- U(e, a, "");
1586
- }) : x(() => {
1587
- q(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 = V(E ?? v);
1595
- if (C !== null) {
1596
- try {
1597
- U(e, a, String(C));
1598
- } catch {
1599
- }
1600
- oe(n, a, v);
1601
- }
1602
- } else {
1603
- const C = Xe(a);
1604
- try {
1605
- const T = e;
1606
- T[C] = P(E) ? E : v, oe(n, a, v);
1607
- } catch {
1608
- const T = V(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] = P(E) ? E : v, oe(n, a, v);
1616
- } catch {
1617
- const C = V(v);
1618
- C !== null && (U(e, a, String(C)), oe(n, a, v));
1619
- }
1620
- else {
1621
- const C = V(v);
1622
- C !== null && (U(e, a, String(C)), oe(n, a, v));
1623
- }
1624
- }
1625
- }
1626
- try {
1627
- if (Q(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
- x(() => {
1637
- S = !!P(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 = pe(b);
1645
- x(() => {
1646
- (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement) && (e.disabled = E);
1647
- }), E ? x(() => {
1648
- U(e, "disabled", "");
1649
- }) : x(() => {
1650
- q(e, "disabled");
1651
- });
1652
- }
1653
- } catch {
1654
- }
1655
- if (p && d) {
1656
- const a = e;
1657
- x(() => {
1658
- a._applyProps?.(a._cfg);
1659
- }), x(() => {
1660
- typeof a.requestRender == "function" ? a.requestRender() : typeof a._render == "function" && a._render?.(a._cfg);
1661
- });
1662
- }
1663
- }
1664
- function Z(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 && G(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 && (G(E, `${a.key}:start`), G(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 = Z(
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 || G(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 && G(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 = V(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 && Q(c)) {
1725
- const a = d.disabled, b = a && typeof a == "object" && "value" in a;
1726
- let E = !1;
1727
- try {
1728
- E = P(a);
1729
- } catch {
1730
- E = !1;
1731
- }
1732
- !b && !E && x(() => {
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, "") : x(() => {
1746
- q(c, a);
1747
- });
1748
- else if (E != null) {
1749
- if (a === "disabled" && Q(c)) {
1750
- const m = d.disabled, v = Ze(m) ? m : E, S = pe(v);
1751
- x(() => {
1752
- c.disabled = S;
1753
- }), S ? x(() => {
1754
- U(c, a, "");
1755
- }) : x(() => {
1756
- q(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 = V(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 = V(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 && Q(c) && q(c, "disabled"), oe(e.props, a, E);
1777
- } catch {
1778
- const m = V(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 = V(E);
1787
- S !== null && U(c, a, String(S));
1788
- }
1789
- } else {
1790
- const v = V(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 && Ne(b) ? b.value : b;
1800
- x(() => {
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]) || ne.addListener(c, E, b);
1817
- } else {
1818
- if (a.startsWith("on") && b === void 0)
1819
- continue;
1820
- if (b == null || b === !1)
1821
- q(c, a);
1822
- else {
1823
- const E = e.props?.isCustomElement ?? !1, m = typeof b == "object" && b !== null && P(b) ? b : Ne(b) && typeof b.value < "u" ? b.value : b;
1824
- if (a === "class" || a === "style") {
1825
- try {
1826
- const v = V(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 && P(b) ? b : Ne(b) ? b.value : b;
1835
- if (a === "disabled" && Q(c)) {
1836
- const S = d.disabled !== void 0 ? d.disabled : v, C = pe(S);
1837
- x(() => {
1838
- c.disabled = C;
1839
- }), C ? x(() => {
1840
- U(c, a, "");
1841
- }) : x(() => {
1842
- q(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
- ne.addListener(c, a, b);
1864
- const A = {
1865
- ...e,
1866
- props: {
1867
- ...e.props,
1868
- ...p.props
1869
- }
1870
- };
1871
- Te(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(Z(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 (Q(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 = !!P(a);
1901
- } catch {
1902
- m = !1;
1903
- }
1904
- const S = m || E || Ze(a) ? a : b, C = pe(S);
1905
- x(() => {
1906
- c.disabled = C;
1907
- }), C ? x(() => {
1908
- U(c, "disabled", "");
1909
- }) : x(() => {
1910
- q(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 L = typeof w == "string" && w.includes(":") ? w.substring(0, w.lastIndexOf(":")) : w;
1968
- L = String(L), v.set(L, 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 L = v.get(y);
1987
- if (L && w) {
1988
- const N = Le(L, w, l, s);
1989
- S.add(L);
1990
- const M = String(y);
1991
- G(N, M), g.push({
1992
- node: N,
1993
- key: y,
1994
- newVNode: l,
1995
- oldVNode: w,
1996
- isNew: !1
1997
- });
1998
- } else {
1999
- L = Z(
2000
- l,
2001
- s,
2002
- void 0,
2003
- e instanceof Element ? e.namespaceURI ?? null : null
2004
- ), G(L, String(y)), e.appendChild(L);
2005
- const N = T || f.appear === !0;
2006
- L instanceof HTMLElement && N && we(L, f).catch((M) => {
2007
- B("Enter transition error:", M);
2008
- }), g.push({ node: L, 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 N = Fe(y, f).then(() => {
2016
- e.contains(y) && e.removeChild(y);
2017
- }).catch((M) => {
2018
- B("Leave transition error:", M), e.contains(y) && e.removeChild(y);
2019
- });
2020
- _.push(N);
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: L } of g)
2030
- if (!L && w instanceof HTMLElement) {
2031
- const N = C.get(w);
2032
- if (N) {
2033
- const M = w.getBoundingClientRect(), D = N.left - M.left, O = N.top - M.top;
2034
- if (D !== 0 || O !== 0) {
2035
- const z = f.moveClass.split(/\s+/).filter((I) => I);
2036
- y.push({ node: w, deltaX: D, deltaY: O, moveClasses: z });
2037
- }
2038
- }
2039
- }
2040
- if (y.length > 0) {
2041
- for (const { node: w, deltaX: L, deltaY: N } of y)
2042
- w.style.transform = `translate(${L}px, ${N}px)`, w.style.transitionProperty = "none";
2043
- e.offsetHeight, requestAnimationFrame(() => {
2044
- requestAnimationFrame(() => {
2045
- for (const { node: w, moveClasses: L } of y)
2046
- for (const N of L)
2047
- w.classList.add(N);
2048
- requestAnimationFrame(() => {
2049
- const w = f.moveClass || "", L = w.match(/duration-(\d+)/), N = L ? `${L[1]}ms` : "300ms", M = w.match(
2050
- /ease-(out|in|in-out|linear)/
2051
- ), D = M ? `ease-${M[1]}` : "ease-out";
2052
- for (const { node: O } of y)
2053
- O.style.transition = `transform ${N} ${D}`;
2054
- requestAnimationFrame(() => {
2055
- for (const { node: O, moveClasses: z } of y) {
2056
- O.style.removeProperty("transform");
2057
- const I = () => {
2058
- for (const ie of z)
2059
- O.classList.remove(ie);
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 N of T)
2102
- N && N.key != null && _.set(N.key, N);
2103
- for (const N of S) {
2104
- const M = De(N);
2105
- M != null && l.set(M, N);
2106
- }
2107
- const y = m && m.state === "visible" && T.length === 0 && E.length > 0, w = /* @__PURE__ */ new Set();
2108
- let L = A.nextSibling;
2109
- for (const N of E) {
2110
- let M;
2111
- if (N.key != null && l.has(N.key)) {
2112
- const D = _.get(N.key);
2113
- M = Le(
2114
- l.get(N.key),
2115
- D,
2116
- N,
2117
- s
2118
- ), w.add(M), m && M instanceof HTMLElement && y && m.appear && we(M, m).catch((O) => {
2119
- B("Transition enter error (appear):", O);
2120
- }), M !== L && e.contains(M) && e.insertBefore(M, L);
2121
- } else
2122
- M = Z(
2123
- N,
2124
- s,
2125
- void 0,
2126
- e instanceof Element ? e.namespaceURI ?? null : null
2127
- ), e.insertBefore(M, L), w.add(M), m && M instanceof HTMLElement && v && we(M, m).catch((D) => {
2128
- B("Transition enter error:", D);
2129
- });
2130
- L = M.nextSibling;
2131
- }
2132
- for (const N of S)
2133
- !w.has(N) && e.contains(N) && (m && N instanceof HTMLElement && v ? Fe(N, m).then(() => {
2134
- e.contains(N) && e.removeChild(N);
2135
- }).catch((M) => {
2136
- B("Transition leave error:", M), e.contains(N) && e.removeChild(N);
2137
- }) : e.removeChild(N));
2138
- } else {
2139
- const _ = Math.min(
2140
- T.length,
2141
- E.length
2142
- );
2143
- for (let l = 0; l < _; l++) {
2144
- const y = T[l], w = E[l], L = Le(S[l], y, w, s);
2145
- L !== S[l] && (e.insertBefore(L, S[l]), e.removeChild(S[l]));
2146
- }
2147
- for (let l = _; l < E.length; l++) {
2148
- const y = Z(
2149
- E[l],
2150
- s,
2151
- void 0,
2152
- e instanceof Element ? e.namespaceURI ?? null : null
2153
- );
2154
- e.insertBefore(y, a), m && y instanceof HTMLElement && v && we(y, m).catch((w) => {
2155
- B("Transition enter error:", w);
2156
- });
2157
- }
2158
- for (let l = _; l < S.length; l++) {
2159
- const y = S[l];
2160
- m && y instanceof HTMLElement && v ? Fe(y, m).then(() => {
2161
- e.contains(y) && e.removeChild(y);
2162
- }).catch((w) => {
2163
- B("Transition leave error:", w), e.contains(y) && e.removeChild(y);
2164
- }) : e.removeChild(y);
2165
- }
2166
- }
2167
- }
2168
- for (const A of t) {
2169
- let a;
2170
- if (A.tag === "#anchor") {
2171
- const b = A.key, E = `${b}:start`, m = `${b}:end`;
2172
- let v = h.get(E), S = h.get(m);
2173
- const C = Array.isArray(A.children) ? A.children : [];
2174
- if (v || (v = document.createTextNode(""), G(v, E)), S || (S = document.createTextNode(""), G(S, m)), A._startNode = v, A._endNode = S, !e.contains(v) || !e.contains(S)) {
2175
- e.insertBefore(v, d);
2176
- const T = A._transition, _ = !(T && T.state === "visible" && C.length > 0) || T.appear;
2177
- for (const l of C) {
2178
- const y = Z(
2179
- l,
2180
- s,
2181
- r,
2182
- e instanceof Element ? e.namespaceURI ?? null : null
2183
- );
2184
- e.insertBefore(y, d), T && y instanceof HTMLElement && _ && we(y, T).catch((w) => {
2185
- B("Transition enter error:", w);
2186
- });
2187
- }
2188
- e.insertBefore(S, d);
2189
- } else {
2190
- 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;
2191
- j(
2192
- v,
2193
- S,
2194
- u.get(b)?.children,
2195
- C,
2196
- T,
2197
- w
2198
- );
2199
- }
2200
- k(v, S), d = S.nextSibling;
2201
- continue;
2202
- }
2203
- if (A.key != null && h.has(A.key)) {
2204
- const b = u.get(A.key);
2205
- a = Le(
2206
- h.get(A.key),
2207
- b,
2208
- A,
2209
- s,
2210
- r
2211
- ), p.add(a), a !== d && e.contains(a) && (d && !e.contains(d) && (d = null), e.insertBefore(a, d));
2212
- } else
2213
- a = Z(
2214
- A,
2215
- s,
2216
- r,
2217
- e instanceof Element ? e.namespaceURI ?? null : null
2218
- ), d && !e.contains(d) && (d = null), e.insertBefore(a, d), p.add(a);
2219
- d = a.nextSibling;
2220
- }
2221
- for (let A = 0; A < o.length; A++) {
2222
- const a = o[A];
2223
- !p.has(a) && e.contains(a) && (de(a, r), e.removeChild(a));
2224
- }
2225
- }
2226
- function Le(e, n, t, s, r) {
2227
- if (n && typeof n != "string" && n.props?.ref && r && de(e, r), n === t) return e;
2228
- if (typeof t == "string") {
2229
- if (e.nodeType === Node.TEXT_NODE)
2230
- return e.textContent !== t && (e.textContent = t), e;
2231
- {
2232
- const o = document.createTextNode(t);
2233
- return e.parentNode?.replaceChild(o, e), o;
2234
- }
2235
- }
2236
- if (t && typeof t != "string" && t.tag === "#anchor") {
2237
- const o = t, c = Array.isArray(o.children) ? o.children : [], f = o._startNode ?? document.createTextNode(""), u = o._endNode ?? document.createTextNode("");
2238
- o.key != null && (G(f, `${o.key}:start`), G(u, `${o.key}:end`)), o._startNode = f, o._endNode = u;
2239
- const h = document.createDocumentFragment();
2240
- h.appendChild(f);
2241
- for (const p of c) {
2242
- const d = Z(
2243
- p,
2244
- s,
2245
- r,
2246
- e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null
2247
- );
2248
- h.appendChild(d);
2249
- }
2250
- return h.appendChild(u), e.parentNode?.replaceChild(h, e), f;
2251
- }
2252
- if (!t) {
2253
- de(e, r);
2254
- const o = document.createComment("removed");
2255
- return e.parentNode?.replaceChild(o, e), o;
2256
- }
2257
- if (!n || typeof n == "string") {
2258
- de(e, r);
2259
- const o = Z(
2260
- t,
2261
- s,
2262
- r,
2263
- e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null
2264
- );
2265
- return Te(t, o, r), e.parentNode?.replaceChild(o, e), o;
2266
- }
2267
- if (t.tag === "#anchor") {
2268
- const o = Array.isArray(t.children) ? t.children : [], c = t._startNode ?? document.createTextNode(""), f = t._endNode ?? document.createTextNode("");
2269
- t.key != null && (G(c, `${t.key}:start`), G(f, `${t.key}:end`)), t._startNode = c, t._endNode = f;
2270
- const u = document.createDocumentFragment();
2271
- u.appendChild(c);
2272
- for (const h of o)
2273
- u.appendChild(
2274
- Z(
2275
- h,
2276
- s,
2277
- r,
2278
- e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null
2279
- )
2280
- );
2281
- return u.appendChild(f), e.parentNode?.replaceChild(u, e), c;
2282
- }
2283
- if (typeof n != "string" && typeof t != "string" && n.tag === t.tag && n.key === t.key) {
2284
- const o = e;
2285
- return at(o, n.props || {}, t.props || {}, s), Zt(o, n.children, t.children, s, r), Te(t, o, r), o;
2286
- }
2287
- 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))
2288
- try {
2289
- const c = e;
2290
- return at(c, n.props || {}, t.props || {}, s), Te(t, c, r), c;
2291
- } catch {
2292
- }
2293
- de(e, r);
2294
- const i = Z(
2295
- t,
2296
- s,
2297
- r,
2298
- e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null
2299
- );
2300
- return Te(t, i, r), e.parentNode?.replaceChild(i, e), i;
2301
- }
2302
- function Jt(e, n, t, s) {
2303
- let r;
2304
- 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 = {
2305
- tag: "div",
2306
- key: "__anchor_root__",
2307
- props: {
2308
- attrs: { "data-anchor-block-root": "", key: "__anchor_root__" }
2309
- },
2310
- children: [r]
2311
- }), r = Je(r, String(r.key ?? "root"));
2312
- const i = e._prevVNode ?? null, o = e._prevDom ?? e.firstChild ?? null;
2313
- let c;
2314
- i && o ? typeof i != "string" && typeof r != "string" && i.tag === r.tag && i.key === r.key ? c = Le(o, i, r, t, s) : (c = Z(
2315
- r,
2316
- t,
2317
- s,
2318
- e.host instanceof Element ? e.host.namespaceURI ?? null : null
2319
- ), e.replaceChild(c, o)) : (c = Z(
2320
- r,
2321
- t,
2322
- s,
2323
- e.host instanceof Element ? e.host.namespaceURI ?? null : null
2324
- ), e.firstChild ? e.replaceChild(c, e.firstChild) : e.appendChild(c));
2325
- const f = [];
2326
- for (let h = 0; h < e.childNodes.length; h++) {
2327
- const p = e.childNodes[h];
2328
- p !== c && p.nodeName !== "STYLE" && (de(p, s), f.push(p));
2329
- }
2330
- f.forEach((h) => e.removeChild(h));
2331
- const u = r && typeof r == "object" && r.props ? {
2332
- ...r,
2333
- props: {
2334
- ...r.props,
2335
- attrs: r.props.attrs ? { ...r.props.attrs } : void 0,
2336
- props: r.props.props ? { ...r.props.props } : void 0
2337
- }
2338
- } : r;
2339
- e._prevVNode = u, e._prevDom = c;
2340
- }
2341
- const Oe = [], lt = /* @__PURE__ */ new WeakMap(), Ee = /* @__PURE__ */ new WeakMap();
2342
- function Yt(e, n) {
2343
- Ee.has(e) || Ee.set(e, /* @__PURE__ */ new Set()), Ee.get(e).add(n);
2344
- }
2345
- function Xt(e, n) {
2346
- const t = Ee.get(e);
2347
- t && (t.delete(n), t.size === 0 && Ee.delete(e));
2348
- }
2349
- function Qt(e, n, t, s, r, i, o, c) {
2350
- if (e) {
2351
- Oe.push(t);
2352
- try {
2353
- const f = n.render(t);
2354
- if (f instanceof Promise) {
2355
- i(!0), f.then((u) => {
2356
- i(!1), o(null), ft(e, u, t, s, r), c(e.innerHTML);
2357
- }).catch((u) => {
2358
- i(!1), o(u instanceof Error ? u : new Error(String(u)));
2359
- });
2360
- return;
2361
- }
2362
- ft(e, f, t, s, r), c(e.innerHTML);
2363
- } catch (f) {
2364
- o(f instanceof Error ? f : new Error(String(f)));
2365
- } finally {
2366
- Oe.pop();
2367
- }
2368
- }
2369
- }
2370
- function ft(e, n, t, s, r) {
2371
- if (e)
2372
- try {
2373
- Jt(
2374
- e,
2375
- Array.isArray(n) ? n : [n],
2376
- t,
2377
- s
2378
- ), r(e.innerHTML);
2379
- } catch (i) {
2380
- throw B("Error during VDOM rendering:", i), i;
2381
- }
2382
- }
2383
- function en(e, n, t, s, r, i, o) {
2384
- i !== null && clearTimeout(i);
2385
- const u = Date.now() - n < 16, h = (() => {
2386
- try {
2387
- return typeof window < "u" && !!window.Cypress;
2388
- } catch {
2389
- return !1;
2390
- }
2391
- })(), p = (() => {
2392
- try {
2393
- return globalThis.process?.env?.NODE_ENV === "test" && !h;
2394
- } catch {
2395
- return !1;
2396
- }
2397
- })(), d = p || h;
2398
- if (u) {
2399
- const A = t + 1;
2400
- r(A);
2401
- const a = d ? 50 : 10, b = d ? 100 : 25, E = p ? 12 : 50;
2402
- if (A === a && !d)
2403
- ee(
2404
- `⚠️ Component rendering frequently. Performance may be impacted.
2405
- Common causes:
2406
- • State updates during render cycle
2407
- • Event handlers with immediate function calls
2408
- • Missing effect dependencies`
2409
- );
2410
- else if (A === b && !d)
2411
- ee(
2412
- `⚠️ Component is re-rendering rapidly. Applying throttling.
2413
- This might indicate:
2414
- • Event handler calling function immediately: @click="\${fn()}" should be @click="\${fn}"
2415
- • State modification during render
2416
- • Missing dependencies in computed/watch`
2417
- );
2418
- else if (A >= E) {
2419
- B(
2420
- `🛑 Infinite render loop detected. Stopping to prevent browser freeze.
2421
- Possible causes:
2422
- • State updates triggering immediate re-renders
2423
- • Computed values changing during evaluation
2424
- • Circular dependencies in reactive system`
2425
- ), o(null);
2426
- return;
2427
- }
2428
- } else
2429
- r(0);
2430
- let k = 0;
2431
- d || (t >= 40 ? k = 500 : t >= 25 ? k = 100 : t >= 15 && (k = 16));
2432
- const j = () => {
2433
- s(Date.now());
2434
- try {
2435
- e();
2436
- } catch (A) {
2437
- B("Error during render execution:", A);
2438
- } finally {
2439
- o(null);
2440
- }
2441
- };
2442
- if (k > 0) {
2443
- const A = setTimeout(j, k);
2444
- o(A);
2445
- } else d ? j() : (o({}), queueMicrotask(j));
2446
- }
2447
- function tn(e, n) {
2448
- let t = n;
2449
- try {
2450
- const s = Ee.get(e);
2451
- if (s?.size)
2452
- for (const r of s)
2453
- try {
2454
- const i = r.lastHtmlStringForJitCSS;
2455
- i?.trim() && (t += `
2456
- ` + i);
2457
- } catch {
2458
- }
2459
- else {
2460
- const r = e.querySelectorAll("*");
2461
- for (const i of r)
2462
- try {
2463
- const o = i.lastHtmlStringForJitCSS;
2464
- o?.trim() && (t += `
2465
- ` + o);
2466
- } catch {
2467
- }
2468
- }
2469
- } catch {
2470
- }
2471
- return t;
2472
- }
2473
- function ut(e) {
2474
- return "adoptedStyleSheets" in e && typeof CSSStyleSheet < "u" && "replaceSync" in CSSStyleSheet.prototype;
2475
- }
2476
- function dt(e, n) {
2477
- let t = e.querySelector(
2478
- "style[data-cer-runtime]"
2479
- );
2480
- t || (t = document.createElement("style"), U(t, "data-cer-runtime", "true"), e.appendChild(t));
2481
- try {
2482
- t.textContent = n;
2483
- } catch {
2484
- }
2485
- }
2486
- function nn(e, n, t, s, r) {
2487
- if (!e) return;
2488
- const i = tn(e, t);
2489
- if (lt.get(e) === i)
2490
- return;
2491
- lt.set(e, i);
2492
- const c = wt(i), f = Tt(), u = n._computedStyle;
2493
- if (!c?.trim() && !u && !f) {
2494
- if (r(null), ut(e))
2495
- e.adoptedStyleSheets = [
2496
- Re(),
2497
- ye()
2498
- ];
2499
- else {
2500
- const b = Ae(ot), E = ye();
2501
- let m = "";
2502
- try {
2503
- E?.cssRules && (m = Array.from(E.cssRules).map((S) => S.cssText).join(`
2504
- `));
2505
- } catch {
2506
- m = "";
2507
- }
2508
- const v = Ae(`${b}
2509
- ${m}`);
2510
- dt(e, v);
2511
- try {
2512
- e.adoptedStyleSheets = [Re(), ye()];
2513
- } catch {
2514
- }
2515
- }
2516
- return;
2517
- }
2518
- let h = "";
2519
- if (u && (h += u + `
2520
- `), c && (h += c + `
2521
- `), h = Lt(h), h = Ae(h), ut(e)) {
2522
- let a = s;
2523
- a || (a = new CSSStyleSheet());
2524
- try {
2525
- a.replaceSync(h);
2526
- const b = [Re(), ye()];
2527
- f && b.push(f), b.push(a), e.adoptedStyleSheets = b, r(a);
2528
- return;
2529
- } catch {
2530
- }
2531
- }
2532
- const d = Ae(ot), k = ye();
2533
- let j = "";
2534
- try {
2535
- k?.cssRules && (j = Array.from(k.cssRules).map((a) => a.cssText).join(`
2536
- `));
2537
- } catch {
2538
- j = "";
2539
- }
2540
- const A = Ae(`${d}
2541
- ${j}
2542
- ${h}`);
2543
- dt(e, A);
2544
- try {
2545
- const a = [
2546
- Re(),
2547
- ye()
2548
- ];
2549
- if (f && a.push(f), typeof CSSStyleSheet < "u")
2550
- try {
2551
- const b = new CSSStyleSheet();
2552
- b.replaceSync(h), a.push(b);
2553
- } catch {
2554
- a.push({
2555
- cssRules: [],
2556
- replaceSync: () => {
2557
- }
2558
- });
2559
- }
2560
- e.adoptedStyleSheets = a;
2561
- } catch {
2562
- }
2563
- r(null);
2564
- }
2565
- function rn(e, n) {
2566
- if (!n.render)
2567
- throw new Error("Component must have a render function");
2568
- return typeof window > "u" ? class {
2569
- constructor() {
2570
- }
2571
- } : class extends HTMLElement {
2572
- context;
2573
- _refs = {};
2574
- _listeners = [];
2575
- _watchers = /* @__PURE__ */ new Map();
2576
- /** @internal */
2577
- _renderTimeoutId = null;
2578
- _mounted = !1;
2579
- _hasError = !1;
2580
- _initializing = !0;
2581
- _componentId;
2582
- _styleSheet = null;
2583
- _lastHtmlStringForJitCSS = "";
2584
- /**
2585
- * Returns the last rendered HTML string for JIT CSS.
2586
- */
2587
- get lastHtmlStringForJitCSS() {
2588
- return this._lastHtmlStringForJitCSS;
2589
- }
2590
- /**
2591
- * Returns true if the component is currently loading.
2592
- */
2593
- get isLoading() {
2594
- return this._templateLoading;
2595
- }
2596
- /**
2597
- * Returns the last error thrown during rendering, or null if none.
2598
- */
2599
- get lastError() {
2600
- return this._templateError;
2601
- }
2602
- _cfg;
2603
- _lastRenderTime = 0;
2604
- _renderCount = 0;
2605
- _templateLoading = !1;
2606
- _templateError = null;
2607
- constructor() {
2608
- super(), this.attachShadow({ mode: "open" }), this._cfg = ge.get(e) || n, this._componentId = `${e}-${crypto.randomUUID()}`;
2609
- const t = this._initContext(n), s = (i, o, c) => {
2610
- Object.defineProperty(i, o, {
2611
- value: c,
2612
- writable: !1,
2613
- enumerable: !1,
2614
- configurable: !1
2615
- });
2616
- };
2617
- s(t, "refs", this._refs), s(
2618
- t,
2619
- "requestRender",
2620
- () => this.requestRender()
2621
- ), s(
2622
- t,
2623
- "_requestRender",
2624
- () => this._requestRender()
2625
- ), s(t, "_componentId", this._componentId), s(
2626
- t,
2627
- "_triggerWatchers",
2628
- (i, o) => this._triggerWatchers(i, o)
2629
- ), this.context = t, x(() => {
2630
- s(t, "_host", this);
2631
- }), s(
2632
- this.context,
2633
- "emit",
2634
- (i, o, c) => {
2635
- const f = {
2636
- detail: o,
2637
- bubbles: !0,
2638
- composed: !0,
2639
- ...c || {}
2640
- }, u = new CustomEvent(i, f);
2641
- this.dispatchEvent(u);
2642
- const h = i.indexOf(":");
2643
- if (h > 0) {
2644
- const p = i.substring(0, h), d = i.substring(h + 1), k = d.includes("-") ? `${p}:${d.split("-").map(
2645
- (j, A) => A === 0 ? j : j.charAt(0).toUpperCase() + j.slice(1)
2646
- ).join("")}` : `${p}:${d.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase()}`;
2647
- k !== i && x(() => {
2648
- this.dispatchEvent(new CustomEvent(k, f));
2649
- });
2650
- }
2651
- return !u.defaultPrevented;
2652
- }
2653
- );
2654
- const r = ge.get(e) || n;
2655
- for (const i in r) {
2656
- const o = r[i];
2657
- typeof o == "function" && (this.context[i] = (...c) => o(...c, this.context));
2658
- }
2659
- if (r.props)
2660
- for (const i in r.props) {
2661
- let o = this[i];
2662
- Object.defineProperty(this, i, {
2663
- get() {
2664
- return o;
2665
- },
2666
- set(c) {
2667
- const f = o;
2668
- o = c, this.context[i] = c, this._initializing || (this._applyProps(r), f !== c && this._requestRender());
2669
- },
2670
- enumerable: !0,
2671
- configurable: !0
2672
- });
2673
- }
2674
- this._initializing = !1, this._initWatchers(r), this._applyProps(r), this._render(r);
2675
- }
2676
- connectedCallback() {
2677
- this._runLogicWithinErrorBoundary(n, () => {
2678
- const t = this.getRootNode();
2679
- t && t !== document && "host" in t && Yt(t, this), this._applyProps(n), this._requestRender(), $t(n, this.context, this._mounted, (s) => {
2680
- this._mounted = s;
2681
- });
2682
- });
2683
- }
2684
- disconnectedCallback() {
2685
- this._runLogicWithinErrorBoundary(n, () => {
2686
- const t = this.getRootNode();
2687
- t && t !== document && "host" in t && Xt(t, this), xt(
2688
- n,
2689
- this.context,
2690
- this._listeners,
2691
- () => {
2692
- this._listeners = [];
2693
- },
2694
- () => {
2695
- this._watchers.clear();
2696
- },
2697
- (s) => {
2698
- this._templateLoading = s;
2699
- },
2700
- (s) => {
2701
- this._templateError = s;
2702
- },
2703
- (s) => {
2704
- this._mounted = s;
2705
- }
2706
- );
2707
- });
2708
- }
2709
- attributeChangedCallback(t, s, r) {
2710
- this._runLogicWithinErrorBoundary(n, () => {
2711
- this._applyProps(n), s !== r && this._requestRender(), Rt(n, t, s, r, this.context);
2712
- });
2713
- }
2714
- static get observedAttributes() {
2715
- return n.props ? Object.keys(n.props).map(J) : [];
2716
- }
2717
- // --- Render ---
2718
- _render(t) {
2719
- this._runLogicWithinErrorBoundary(t, () => {
2720
- Qt(
2721
- this.shadowRoot,
2722
- t,
2723
- this.context,
2724
- this._refs,
2725
- (s) => {
2726
- this._lastHtmlStringForJitCSS = s, typeof this.onHtmlStringUpdate == "function" && this?.onHtmlStringUpdate?.(s);
2727
- },
2728
- (s) => {
2729
- this._templateLoading = s, this?.onLoadingStateChange?.(s);
2730
- },
2731
- (s) => {
2732
- this._templateError = s, this?.onErrorStateChange?.(s);
2733
- },
2734
- (s) => this._applyStyle(t, s)
2735
- );
2736
- });
2737
- }
2738
- requestRender() {
2739
- this._requestRender();
2740
- }
2741
- _requestRender() {
2742
- this._runLogicWithinErrorBoundary(this._cfg, () => {
2743
- _e(() => {
2744
- en(
2745
- () => this._render(this._cfg),
2746
- this._lastRenderTime,
2747
- this._renderCount,
2748
- (t) => {
2749
- this._lastRenderTime = t;
2750
- },
2751
- (t) => {
2752
- this._renderCount = t;
2753
- },
2754
- this._renderTimeoutId,
2755
- (t) => {
2756
- this._renderTimeoutId = t;
2757
- }
2758
- );
2759
- }, this._componentId);
2760
- });
2761
- }
2762
- // --- Style ---
2763
- _applyStyle(t, s) {
2764
- this._runLogicWithinErrorBoundary(t, () => {
2765
- nn(
2766
- this.shadowRoot,
2767
- this.context,
2768
- s,
2769
- this._styleSheet,
2770
- (r) => {
2771
- this._styleSheet = r;
2772
- }
2773
- );
2774
- });
2775
- }
2776
- // --- Error Boundary function ---
2777
- _runLogicWithinErrorBoundary(t, s) {
2778
- this._hasError && (this._hasError = !1);
2779
- try {
2780
- s();
2781
- } catch (r) {
2782
- this._hasError = !0;
2783
- try {
2784
- const i = this.tagName?.toLowerCase?.() || "<unknown>", o = this._componentId || "<unknown-id>", c = {};
2785
- if (t && t.props)
2786
- for (const f of Object.keys(t.props))
2787
- try {
2788
- const u = this.context[f];
2789
- 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;
2790
- } catch {
2791
- c[f] = "[unreadable]";
2792
- }
2793
- B(`Error rendering component <${i}> (id=${o}):`, r), B("Component props snapshot:", c), ee(
2794
- "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`...`)."
2795
- );
2796
- } catch {
2797
- }
2798
- if (t.onError && t.onError(r, this.context), this.tagName.toLowerCase() !== "cer-error-boundary") {
2799
- let i = this.parentElement;
2800
- if (!i) {
2801
- const o = this.getRootNode();
2802
- o instanceof ShadowRoot && (i = o.host.parentElement);
2803
- }
2804
- for (; i; ) {
2805
- if (i.tagName.toLowerCase() === "cer-error-boundary") {
2806
- i._cerHandleChildError?.(
2807
- r
2808
- );
2809
- break;
2810
- }
2811
- let o = i.parentElement;
2812
- if (!o) {
2813
- const c = i.getRootNode();
2814
- c instanceof ShadowRoot && (o = c.host.parentElement);
2815
- }
2816
- i = o;
2817
- }
2818
- }
2819
- }
2820
- }
2821
- // --- State, props, computed ---
2822
- _initContext(t) {
2823
- try {
2824
- let s = function(i, o = "") {
2825
- if (Array.isArray(i))
2826
- return new Proxy(i, {
2827
- get(c, f, u) {
2828
- const h = Reflect.get(c, f, u);
2829
- return typeof h == "function" && typeof f == "string" && [
2830
- "push",
2831
- "pop",
2832
- "shift",
2833
- "unshift",
2834
- "splice",
2835
- "sort",
2836
- "reverse"
2837
- ].includes(f) ? function(...d) {
2838
- const k = h.apply(c, d);
2839
- if (!r._initializing) {
2840
- const j = o || "root";
2841
- r._triggerWatchers(j, c), _e(
2842
- () => r._render(t),
2843
- r._componentId
2844
- );
2845
- }
2846
- return k;
2847
- } : h;
2848
- },
2849
- set(c, f, u) {
2850
- if (c[String(f)] = u, !r._initializing) {
2851
- const h = o ? `${o}.${String(f)}` : String(f);
2852
- r._triggerWatchers(h, u), _e(() => r._render(t), r._componentId);
2853
- }
2854
- return !0;
2855
- },
2856
- deleteProperty(c, f) {
2857
- if (delete c[String(f)], !r._initializing) {
2858
- const u = o ? `${o}.${String(f)}` : String(f);
2859
- r._triggerWatchers(u, void 0), _e(() => r._render(t), r._componentId);
2860
- }
2861
- return !0;
2862
- }
2863
- });
2864
- if (i && typeof i == "object") {
2865
- if (P(i))
2866
- return i;
2867
- for (const c in i) {
2868
- const f = o ? `${o}.${c}` : c;
2869
- i[c] = s(i[c], f);
2870
- }
2871
- return new Proxy(i, {
2872
- set(c, f, u) {
2873
- const h = o ? `${o}.${String(f)}` : String(f);
2874
- return c[String(f)] = s(u, h), r._initializing || (r._triggerWatchers(
2875
- h,
2876
- c[String(f)]
2877
- ), _e(() => r._render(t), r._componentId)), !0;
2878
- },
2879
- get(c, f, u) {
2880
- return Reflect.get(c, f, u);
2881
- }
2882
- });
2883
- }
2884
- return i;
2885
- };
2886
- const r = this;
2887
- return s({
2888
- // For functional components, state is managed by state() function calls
2889
- // Include prop defaults in initial reactive context so prop updates trigger reactivity
2890
- ...t.props ? Object.fromEntries(
2891
- Object.entries(t.props).map(([i, o]) => [
2892
- i,
2893
- o.default
2894
- ])
2895
- ) : {}
2896
- });
2897
- } catch {
2898
- return {};
2899
- }
2900
- }
2901
- _initWatchers(t) {
2902
- this._runLogicWithinErrorBoundary(t, () => {
2903
- Ot(
2904
- this.context,
2905
- this._watchers,
2906
- {}
2907
- // Watchers are now handled by the watch() function in functional API
2908
- );
2909
- });
2910
- }
2911
- _triggerWatchers(t, s) {
2912
- jt(this.context, this._watchers, t, s);
2913
- }
2914
- _applyProps(t) {
2915
- this._runLogicWithinErrorBoundary(t, () => {
2916
- Pt(this, t, this.context);
2917
- });
2918
- }
2919
- };
2920
- }
2921
- function gn() {
2922
- return Y();
2923
- }
2924
- let R = null;
2925
- function Ue(e) {
2926
- R = e;
2927
- }
2928
- function Be() {
2929
- R = null;
2930
- }
2931
- function bn() {
2932
- return R;
2933
- }
2934
- function vn() {
2935
- if (!R)
2936
- throw new Error("useEmit must be called during component render");
2937
- if (Y())
2938
- return () => !1;
2939
- const e = R.emit;
2940
- if (typeof e != "function")
2941
- throw new Error(
2942
- "useEmit requires an emit function on the component context"
2943
- );
2944
- const n = e;
2945
- return (t, s, r) => n(t, s, r);
2946
- }
2947
- function he(e) {
2948
- e._hookCallbacks || Object.defineProperty(e, "_hookCallbacks", {
2949
- value: {},
2950
- writable: !0,
2951
- enumerable: !1,
2952
- configurable: !1
2953
- });
2954
- }
2955
- function En(e) {
2956
- if (!R)
2957
- throw new Error("useOnConnected must be called during component render");
2958
- if (Y()) return;
2959
- he(R);
2960
- const n = R._hookCallbacks;
2961
- n.onConnected || (n.onConnected = []), n.onConnected.push(e);
2962
- }
2963
- function Sn(e) {
2964
- if (!R)
2965
- throw new Error("useOnDisconnected must be called during component render");
2966
- if (Y()) return;
2967
- he(R);
2968
- const n = R._hookCallbacks;
2969
- n.onDisconnected || (n.onDisconnected = []), n.onDisconnected.push(e);
2970
- }
2971
- function Cn(e) {
2972
- if (!R)
2973
- throw new Error(
2974
- "useOnAttributeChanged must be called during component render"
2975
- );
2976
- if (Y()) return;
2977
- he(R);
2978
- const n = R._hookCallbacks;
2979
- n.onAttributeChanged || (n.onAttributeChanged = []), n.onAttributeChanged.push(e);
2980
- }
2981
- function kn(e) {
2982
- if (!R)
2983
- throw new Error("useOnError must be called during component render");
2984
- if (Y()) return;
2985
- he(R);
2986
- const n = R._hookCallbacks;
2987
- n.onError || (n.onError = []), n.onError.push((t) => {
2988
- try {
2989
- t instanceof Error ? e(t) : e(new Error(String(t)));
2990
- } catch {
2991
- }
2992
- });
2993
- }
2994
- function sn(e) {
2995
- if (!R)
2996
- throw new Error("useProps must be called during component render");
2997
- he(R);
2998
- const n = R._hookCallbacks;
2999
- n.props = {
3000
- ...n.props || {},
3001
- ...e
3002
- };
3003
- const t = R;
3004
- try {
3005
- const r = Object.keys(e || {});
3006
- for (const i of r) {
3007
- if (typeof i != "string" || i.startsWith("_")) continue;
3008
- const o = Object.getOwnPropertyDescriptor(t, i);
3009
- if (!(o && !o.configurable))
3010
- try {
3011
- let f = Object.prototype.hasOwnProperty.call(t, i) ? t[i] : void 0;
3012
- Object.defineProperty(t, i, {
3013
- configurable: !0,
3014
- enumerable: !0,
3015
- get() {
3016
- try {
3017
- const u = t && t._host;
3018
- if (u) {
3019
- const h = J(i), p = u.getAttribute(h);
3020
- if (p !== null) {
3021
- const d = typeof e[i];
3022
- return d === "boolean" ? p === "" || p === "true" : d === "number" ? Number(p) : p;
3023
- }
3024
- if (typeof u[i] < "u") {
3025
- const d = u[i];
3026
- if (P(d) || d && typeof d == "object" && "value" in d && !(d instanceof Node))
3027
- return d.value;
3028
- const k = typeof e[i];
3029
- if (!(k === "string" && d && typeof d == "object"))
3030
- return k === "boolean" && typeof d == "string" ? d === "" || d === "true" : d;
3031
- }
3032
- }
3033
- } catch {
3034
- }
3035
- return f;
3036
- },
3037
- set(u) {
3038
- f = u;
3039
- }
3040
- });
3041
- } catch {
3042
- }
3043
- }
3044
- } catch {
3045
- }
3046
- return new Proxy({}, {
3047
- get(r, i) {
3048
- if (typeof i != "string") return;
3049
- const o = e[i];
3050
- try {
3051
- const f = t && t._host;
3052
- if (f) {
3053
- if (f instanceof HTMLElement || typeof f.getAttribute == "function" && typeof f.hasAttribute == "function") {
3054
- const h = i.replace(/([A-Z])/g, "-$1").toLowerCase(), p = f.getAttribute(h);
3055
- if (p !== null)
3056
- return typeof o == "boolean" ? p === "" || p === "true" : typeof o == "number" ? Number(p) : p;
3057
- }
3058
- const u = f[i];
3059
- if (typeof u < "u" && u !== "") {
3060
- const h = u && typeof u == "object" && "value" in u && !(u instanceof Node);
3061
- if (!(typeof o == "string" && u && typeof u == "object" && !h && !P(u)))
3062
- return typeof o == "boolean" && o === !1 && u === "" ? o : P(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;
3063
- }
3064
- }
3065
- } catch {
3066
- }
3067
- const c = t[i];
3068
- return typeof o == "boolean" && c === "" ? o === !1 ? o : !0 : P(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;
3069
- },
3070
- has(r, i) {
3071
- return typeof i == "string" && (i in t || i in e);
3072
- },
3073
- ownKeys() {
3074
- return Array.from(
3075
- /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t || {})])
3076
- );
3077
- },
3078
- getOwnPropertyDescriptor() {
3079
- return { configurable: !0, enumerable: !0 };
3080
- }
3081
- });
3082
- }
3083
- function _n(e) {
3084
- if (!R)
3085
- throw new Error("useStyle must be called during component render");
3086
- if (!Y()) {
3087
- he(R);
3088
- try {
3089
- const n = e();
3090
- Object.defineProperty(R, "_computedStyle", {
3091
- value: n,
3092
- writable: !0,
3093
- enumerable: !1,
3094
- configurable: !0
3095
- });
3096
- } catch (n) {
3097
- ee("Error in useStyle callback:", n), Object.defineProperty(R, "_computedStyle", {
3098
- value: "",
3099
- writable: !0,
3100
- enumerable: !1,
3101
- configurable: !0
3102
- });
3103
- }
3104
- }
3105
- }
3106
- const je = /* @__PURE__ */ Symbol.for("@cer/provides");
3107
- function An(e, n) {
3108
- if (!R)
3109
- throw new Error("provide must be called during component render");
3110
- if (Y()) return;
3111
- const t = R;
3112
- t[je] || Object.defineProperty(t, je, {
3113
- value: /* @__PURE__ */ new Map(),
3114
- writable: !1,
3115
- enumerable: !1,
3116
- configurable: !0
3117
- }), t[je].set(e, n);
3118
- }
3119
- function wn(e, n) {
3120
- if (!R)
3121
- throw new Error("inject must be called during component render");
3122
- if (Y()) return n;
3123
- try {
3124
- const t = R._host;
3125
- if (t) {
3126
- let s = t.parentNode;
3127
- for (s || (s = t.getRootNode()); s; )
3128
- if (s instanceof ShadowRoot) {
3129
- const r = s.host, i = r.context;
3130
- if (i) {
3131
- const c = i[je];
3132
- if (c?.has(e))
3133
- return c.get(e);
3134
- }
3135
- if (s = r.parentNode ?? r.getRootNode(), s === document || s === r) break;
3136
- } else {
3137
- if (s instanceof Element) {
3138
- const o = s.context;
3139
- if (o) {
3140
- const c = o[je];
3141
- if (c?.has(e))
3142
- return c.get(e);
3143
- }
3144
- }
3145
- const r = s;
3146
- if (s = s.parentNode ?? s.getRootNode?.(), s === document || s === r) break;
3147
- }
3148
- }
3149
- } catch {
3150
- }
3151
- return n;
3152
- }
3153
- function Tn(e) {
3154
- return (n) => {
3155
- const t = n ?? R;
3156
- if (!t)
3157
- throw new Error(
3158
- "createComposable: no component context available. Pass a context explicitly or call inside a render function."
3159
- );
3160
- const s = R;
3161
- Ue(t);
3162
- try {
3163
- return e();
3164
- } finally {
3165
- s ? Ue(s) : Be();
3166
- }
3167
- };
3168
- }
3169
- function Ln(e) {
3170
- if (!R)
3171
- throw new Error("useExpose must be called during component render");
3172
- if (Y()) return;
3173
- he(R);
3174
- const n = R._hookCallbacks;
3175
- n.expose = { ...n.expose ?? {}, ...e };
3176
- const t = R._host;
3177
- if (t)
3178
- for (const [s, r] of Object.entries(e))
3179
- try {
3180
- t[s] = r;
3181
- } catch {
3182
- }
3183
- }
3184
- function Nn() {
3185
- if (!R)
3186
- throw new Error("useSlots must be called during component render");
3187
- if (Y())
3188
- return { has: () => !1, getNodes: () => [], names: () => [] };
3189
- const e = R._host;
3190
- return {
3191
- /**
3192
- * Returns true if the named slot (or the default slot when name is
3193
- * omitted) has at least one slotted child element.
3194
- */
3195
- has(n) {
3196
- return e ? !n || n === "default" ? Array.from(e.children).some((t) => !t.hasAttribute("slot")) : Array.from(e.children).some(
3197
- (t) => t.getAttribute("slot") === n
3198
- ) : !1;
3199
- },
3200
- /**
3201
- * Returns all child elements assigned to the named slot (or the default
3202
- * slot when name is omitted).
3203
- */
3204
- getNodes(n) {
3205
- return e ? !n || n === "default" ? Array.from(e.children).filter(
3206
- (t) => !t.hasAttribute("slot")
3207
- ) : Array.from(e.children).filter(
3208
- (t) => t.getAttribute("slot") === n
3209
- ) : [];
3210
- },
3211
- /** Returns the names of all slots that have content, including 'default'. */
3212
- names() {
3213
- if (!e) return [];
3214
- const n = /* @__PURE__ */ new Set();
3215
- for (const t of Array.from(e.children)) {
3216
- const s = t.getAttribute("slot");
3217
- n.add(s ?? "default");
3218
- }
3219
- return Array.from(n);
3220
- }
3221
- };
3222
- }
3223
- function On(...e) {
3224
- if (!R)
3225
- throw new Error("defineModel must be called during component render");
3226
- const n = e.length === 2 ? e[0] : "modelValue", t = e.length === 2 ? e[1] : e.length === 1 ? e[0] : void 0, s = sn({
3227
- [n]: t
3228
- }), i = Y() ? null : (() => {
3229
- const c = R.emit;
3230
- return typeof c != "function" ? null : c;
3231
- })(), o = {
3232
- get value() {
3233
- return s[n];
3234
- },
3235
- set value(c) {
3236
- i && i(`update:${n}`, c);
3237
- }
3238
- };
3239
- try {
3240
- Object.defineProperty(o, /* @__PURE__ */ Symbol.for("@cer/ReactiveState"), {
3241
- value: !0,
3242
- enumerable: !1,
3243
- configurable: !1
3244
- });
3245
- } catch {
3246
- }
3247
- return o;
3248
- }
3249
- function jn(e, n) {
3250
- Nt();
3251
- let t = J(e);
3252
- t.includes("-") || (t = `cer-${t}`);
3253
- const s = {}, r = {
3254
- // Props are accessed via useProps() hook
3255
- props: {},
3256
- // Add lifecycle hooks from the stored functions
3257
- onConnected: (i) => {
3258
- if (s.onConnected)
3259
- try {
3260
- s.onConnected(i);
3261
- } catch {
3262
- }
3263
- },
3264
- onDisconnected: (i) => {
3265
- if (s.onDisconnected)
3266
- try {
3267
- s.onDisconnected(i);
3268
- } catch {
3269
- }
3270
- },
3271
- onAttributeChanged: (i, o, c, f) => {
3272
- if (s.onAttributeChanged)
3273
- try {
3274
- s.onAttributeChanged(i, o, c, f);
3275
- } catch {
3276
- }
3277
- },
3278
- onError: (i, o) => {
3279
- if (s.onError && i)
3280
- try {
3281
- s.onError(i, o);
3282
- } catch {
3283
- }
3284
- },
3285
- render: (i) => {
3286
- const o = i, c = o._componentId || `${t}-${crypto.randomUUID()}`;
3287
- nt.setCurrentComponent(c, () => {
3288
- i.requestRender && i.requestRender();
3289
- });
3290
- try {
3291
- Object.defineProperty(i, "_hookCallbacks", {
3292
- value: {},
3293
- writable: !0,
3294
- enumerable: !1,
3295
- configurable: !0
3296
- }), Ue(i), st();
3297
- let f;
3298
- try {
3299
- f = n();
3300
- } catch (u) {
3301
- try {
3302
- const p = o._hookCallbacks?.onError;
3303
- if (Array.isArray(p))
3304
- for (const d of p)
3305
- try {
3306
- d(u);
3307
- } catch {
3308
- }
3309
- else if (typeof p == "function")
3310
- try {
3311
- p(u);
3312
- } catch {
3313
- }
3314
- } catch {
3315
- }
3316
- try {
3317
- const h = o._host;
3318
- if (h?.parentElement) {
3319
- let p = h.parentElement;
3320
- for (; p; ) {
3321
- if (p.tagName.toLowerCase() === "cer-error-boundary") {
3322
- p._cerHandleChildError?.(
3323
- u
3324
- );
3325
- break;
3326
- }
3327
- let d = p.parentElement;
3328
- if (!d) {
3329
- const k = p.getRootNode();
3330
- k instanceof ShadowRoot && (d = k.host.parentElement);
3331
- }
3332
- p = d;
3333
- }
3334
- }
3335
- } catch {
3336
- }
3337
- throw u;
3338
- }
3339
- if (o._hookCallbacks) {
3340
- const u = o._hookCallbacks;
3341
- if (u.onConnected) {
3342
- const h = u.onConnected;
3343
- s.onConnected = (p) => {
3344
- for (const d of h)
3345
- try {
3346
- d(p);
3347
- } catch {
3348
- }
3349
- };
3350
- }
3351
- if (u.onDisconnected) {
3352
- const h = u.onDisconnected;
3353
- s.onDisconnected = (p) => {
3354
- for (const d of h)
3355
- try {
3356
- d(p);
3357
- } catch {
3358
- }
3359
- };
3360
- }
3361
- if (u.onAttributeChanged) {
3362
- const h = u.onAttributeChanged;
3363
- s.onAttributeChanged = (p, d, k, j) => {
3364
- for (const A of h)
3365
- try {
3366
- A(p, d, k, j);
3367
- } catch {
3368
- }
3369
- };
3370
- }
3371
- if (u.onError) {
3372
- const h = u.onError;
3373
- s.onError = (p) => {
3374
- for (const d of h)
3375
- try {
3376
- d(p);
3377
- } catch {
3378
- }
3379
- };
3380
- }
3381
- if (u.props) {
3382
- const h = u.props;
3383
- r.props = Object.fromEntries(
3384
- Object.entries(h).map(([p, d]) => [
3385
- p,
3386
- { type: typeof d == "boolean" ? Boolean : typeof d == "number" ? Number : typeof d == "string" ? String : Function, default: d }
3387
- ])
3388
- ), ge.set(t, r);
3389
- }
3390
- }
3391
- return f;
3392
- } finally {
3393
- Be(), nt.clearCurrentComponent();
3394
- }
3395
- }
3396
- };
3397
- if (ge.set(t, r), typeof window < "u") {
3398
- try {
3399
- const i = {
3400
- _hookCallbacks: {},
3401
- requestRender: () => {
3402
- },
3403
- emit: () => !0
3404
- };
3405
- Ue(i), _t(), st();
3406
- try {
3407
- n();
3408
- } catch (o) {
3409
- try {
3410
- const f = i?._hookCallbacks?.onError;
3411
- if (Array.isArray(f))
3412
- for (const u of f)
3413
- try {
3414
- u(o);
3415
- } catch {
3416
- }
3417
- else if (typeof f == "function")
3418
- try {
3419
- f(o);
3420
- } catch {
3421
- }
3422
- B(
3423
- `Error during component discovery render <${t}>:`,
3424
- o
3425
- ), ee(
3426
- "Error occurred during initial component discovery render. Consider guarding expensive expressions or using lazy factories for directives like when()."
3427
- );
3428
- } catch {
3429
- }
3430
- throw tt(), Be(), o;
3431
- }
3432
- if (tt(), Be(), i._hookCallbacks?.props) {
3433
- const o = i._hookCallbacks.props;
3434
- r.props = Object.fromEntries(
3435
- Object.entries(o).map(([c, f]) => [
3436
- c,
3437
- { type: typeof f == "boolean" ? Boolean : typeof f == "number" ? Number : typeof f == "string" ? String : Function, default: f }
3438
- ])
3439
- ), ge.set(t, r);
3440
- }
3441
- } catch {
3442
- }
3443
- customElements.get(t) || customElements.define(
3444
- t,
3445
- rn(t, r)
3446
- );
3447
- }
3448
- }
3449
- function ce(e, n = {}, t, s) {
3450
- const r = s ?? n.key;
3451
- return { tag: e, key: r, props: n, children: t };
3452
- }
3453
- function Me(e) {
3454
- return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
3455
- }
3456
- function ue(e) {
3457
- return typeof e == "object" && e !== null && "tag" in e && !Me(e);
3458
- }
3459
- function on(e, n) {
3460
- return e.key != null ? e : { ...e, key: n };
3461
- }
3462
- class cn {
3463
- map = /* @__PURE__ */ new Map();
3464
- maxSize;
3465
- accessOrder = /* @__PURE__ */ new Map();
3466
- accessCounter = 0;
3467
- constructor(n) {
3468
- this.maxSize = Math.max(1, n);
3469
- }
3470
- get(n) {
3471
- const t = this.map.get(n);
3472
- if (t !== void 0)
3473
- return this.accessOrder.set(n, ++this.accessCounter), t;
3474
- }
3475
- set(n, t) {
3476
- const s = this.map.has(n);
3477
- this.map.set(n, t), this.accessOrder.set(n, ++this.accessCounter), !s && this.map.size > this.maxSize && this.evictLRU();
3478
- }
3479
- evictLRU() {
3480
- let n, t = 1 / 0;
3481
- for (const [s, r] of this.accessOrder)
3482
- r < t && (t = r, n = s);
3483
- n !== void 0 && (this.map.delete(n), this.accessOrder.delete(n));
3484
- }
3485
- has(n) {
3486
- return this.map.has(n);
3487
- }
3488
- clear() {
3489
- this.map.clear(), this.accessOrder.clear(), this.accessCounter = 0;
3490
- }
3491
- get size() {
3492
- return this.map.size;
3493
- }
3494
- }
3495
- const an = () => {
3496
- if (typeof navigator < "u" && "deviceMemory" in navigator) {
3497
- const n = navigator.deviceMemory;
3498
- if (n)
3499
- return Math.min(1e3, Math.max(200, n * 100));
3500
- }
3501
- return (() => {
3502
- try {
3503
- return globalThis.process?.env?.NODE_ENV === "test";
3504
- } catch {
3505
- return !1;
3506
- }
3507
- })() ? 100 : 500;
3508
- }, qe = new cn(
3509
- an()
3510
- );
3511
- function ln(e, n) {
3512
- if (e == null) {
3513
- ee(
3514
- `⚠️ Event handler for '@${n}' is ${e}. This will prevent the event from working. Use a function reference instead: @${n}="\${functionName}"`
3515
- );
3516
- return;
3517
- }
3518
- typeof e != "function" && ee(
3519
- `🚨 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.`
3520
- ), e === void 0 && typeof e != "function" && ee(
3521
- `💡 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()}"`
3522
- );
3523
- }
3524
- function fn(e, n = [], t = {}) {
3525
- const s = {}, r = {}, i = {}, o = [], c = /([:@#]?)([a-zA-Z0-9-:.]+)(?:\s*=\s*("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|([^\s>]+)))?/g;
3526
- let f;
3527
- for (; f = c.exec(e); ) {
3528
- const u = f[1], h = f[2];
3529
- let p = "";
3530
- for (let b = 3; b < f.length; b++)
3531
- if (f[b] !== void 0) {
3532
- p = f[b];
3533
- break;
3534
- }
3535
- p.length >= 2 && (p[0] === '"' && p[p.length - 1] === '"' || p[0] === "'" && p[p.length - 1] === "'") && (p = p.slice(1, -1));
3536
- const d = !/=/.test(f[0]), k = p.match(/^{{(\d+)}}$/), j = !k && /{{(\d+)}}/.test(p);
3537
- let A = d ? !0 : k ? n[Number(k[1])] ?? null : j ? p.replace(
3538
- /{{(\d+)}}/g,
3539
- (b, E) => String(n[Number(E)] ?? "")
3540
- ) : p;
3541
- !k && !j && (A === "true" ? A = !0 : A === "false" ? A = !1 : A === "null" ? A = null : isNaN(Number(A)) || (A = Number(A)));
3542
- const a = [
3543
- "model",
3544
- "bind",
3545
- "show",
3546
- "class",
3547
- "style",
3548
- "ref",
3549
- "when"
3550
- ];
3551
- if (u === ":") {
3552
- const [b, E] = h.split(":"), [m, ...v] = b.split(".");
3553
- if (a.includes(m)) {
3554
- const S = [...v], C = m === "model" && E ? `model:${E}` : m;
3555
- i[C] = {
3556
- value: A,
3557
- modifiers: S,
3558
- arg: E
3559
- };
3560
- } else if (h === "disabled") {
3561
- let S = A;
3562
- S && P(S) && (S = S.value);
3563
- const C = typeof S;
3564
- if (S === "" || C === "boolean" || C === "string" && (S === "true" || S === "false") || S == null || C === "number")
3565
- s[h] = S;
3566
- else {
3567
- let _ = A;
3568
- _ && P(_) && (_ = _.value), r[h] = _;
3569
- }
3570
- o.push(h);
3571
- } else {
3572
- let S = A;
3573
- S && P(S) && (S = S.value), r[h] = S, o.push(h);
3574
- }
3575
- } else if (u === "@") {
3576
- const [b, ...E] = h.split("."), m = E;
3577
- ln(A, b);
3578
- const v = typeof A == "function" ? A : typeof t[A] == "function" ? t[A] : void 0;
3579
- if (v) {
3580
- const S = (T) => {
3581
- if (m.includes("prevent") && T.preventDefault(), m.includes("stop") && T.stopPropagation(), !(m.includes("self") && T.target !== T.currentTarget))
3582
- return m.includes("once") && T.currentTarget?.removeEventListener(
3583
- b,
3584
- S
3585
- ), v(T);
3586
- }, C = "on" + b.charAt(0).toUpperCase() + b.slice(1);
3587
- s[C] = S;
3588
- }
3589
- } else h === "ref" ? s.ref = A : r[h] = A;
3590
- }
3591
- return { props: s, attrs: r, directives: i, bound: o };
3592
- }
3593
- function Ye(e) {
3594
- if (!ue(e) || Me(e))
3595
- return e;
3596
- const n = e.props?.directives;
3597
- if (n && n.when) {
3598
- const t = n.when.value, s = P(t) ? t.value : t, r = { ...n };
3599
- delete r.when;
3600
- const i = { ...e.props };
3601
- Object.keys(r).length > 0 ? i.directives = r : delete i.directives;
3602
- const o = {
3603
- ...e,
3604
- props: i
3605
- };
3606
- return Array.isArray(o.children) && (o.children = o.children.map(
3607
- (f) => typeof f == "object" && f !== null ? Ye(f) : f
3608
- )), {
3609
- tag: "#anchor",
3610
- key: e.key != null ? `when-${e.key}` : `when-${e.tag}`,
3611
- children: s ? [o] : []
3612
- };
3613
- }
3614
- if (Array.isArray(e.children)) {
3615
- const t = e.children.map(
3616
- (s) => typeof s == "object" && s !== null ? Ye(s) : s
3617
- );
3618
- return {
3619
- ...e,
3620
- children: t
3621
- };
3622
- }
3623
- return e;
3624
- }
3625
- function un(e, n, t) {
3626
- const s = Oe.length > 0 ? Oe[Oe.length - 1] : void 0, r = t ?? s, i = !t && n.length === 0, o = i ? e.join("<!--TEMPLATE_DELIM-->") : null;
3627
- if (i && o) {
3628
- const l = qe.get(o);
3629
- if (l) return l;
3630
- }
3631
- function c(l, y) {
3632
- return ce("#text", {}, l, y);
3633
- }
3634
- function f(l, y, w = !1) {
3635
- let L = typeof l == "string" ? At(l) : l;
3636
- return !w && typeof L == "string" && /[\r\n]/.test(L) && (L = L.replace(/\s+/g, " ")), ce("#text", {}, L, y);
3637
- }
3638
- let u = "";
3639
- for (let l = 0; l < e.length; l++)
3640
- u += e[l], l < n.length && (u += `{{${l}}}`);
3641
- const h = /<!--[\s\S]*?-->|<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, p = [];
3642
- let d, k = [], j = null, A = {}, a, b = 0;
3643
- const E = [], m = /* @__PURE__ */ new Set([
3644
- "pre",
3645
- "code",
3646
- "textarea",
3647
- "script",
3648
- "style"
3649
- ]);
3650
- function v() {
3651
- if (j && m.has(j.toLowerCase()))
3652
- return !0;
3653
- for (const l of p)
3654
- if (m.has(l.tag.toLowerCase()))
3655
- return !0;
3656
- return !1;
3657
- }
3658
- function S(l) {
3659
- if (!l || typeof l != "object" || Me(l)) return;
3660
- const y = l, w = A;
3661
- if (y.props || y.attrs) {
3662
- const L = y;
3663
- L.props && (w.props || (w.props = {}), Object.assign(w.props, L.props)), L.attrs && (w.attrs || (w.attrs = {}), Object.keys(L.attrs).forEach((N) => {
3664
- if (N === "style" && w.attrs.style) {
3665
- const M = String(w.attrs.style).replace(/;?\s*$/, ""), D = String(L.attrs.style).replace(/^;?\s*/, "");
3666
- w.attrs.style = M + "; " + D;
3667
- } else if (N === "class" && w.attrs.class) {
3668
- const M = String(w.attrs.class).trim().split(/\s+/).filter(Boolean), D = String(L.attrs.class).trim().split(/\s+/).filter(Boolean), O = [
3669
- .../* @__PURE__ */ new Set([...M, ...D])
3670
- ];
3671
- w.attrs.class = O.join(" ");
3672
- } else
3673
- w.attrs[N] = L.attrs[N];
3674
- }));
3675
- } else
3676
- w.props || (w.props = {}), Object.assign(w.props, y);
3677
- }
3678
- function C(l, y) {
3679
- const w = j ? k : E;
3680
- if (Me(l)) {
3681
- const L = l.key ?? y, N = l.children;
3682
- w.push({
3683
- ...l,
3684
- key: L,
3685
- children: N
3686
- });
3687
- return;
3688
- }
3689
- if (ue(l)) {
3690
- w.push(on(l, void 0));
3691
- return;
3692
- }
3693
- if (Array.isArray(l)) {
3694
- if (l.length === 0) return;
3695
- for (let L = 0; L < l.length; L++) {
3696
- const N = l[L];
3697
- Me(N) || ue(N) || Array.isArray(N) ? C(N, `${y}-${L}`) : N !== null && typeof N == "object" ? rt(N) ? w.push(
3698
- ce(
3699
- "#raw",
3700
- {},
3701
- N.__rawHTML,
3702
- `${y}-${L}`
3703
- )
3704
- ) : S(N) : w.push(c(String(N), `${y}-${L}`));
3705
- }
3706
- return;
3707
- }
3708
- if (l !== null && typeof l == "object") {
3709
- if (rt(l)) {
3710
- const L = l.__rawHTML ?? "";
3711
- w.push(ce("#raw", {}, L, y));
3712
- return;
3713
- }
3714
- S(l);
3715
- return;
3716
- }
3717
- w.push(c(String(l), y));
3718
- }
3719
- const T = /* @__PURE__ */ new Set([
3720
- "area",
3721
- "base",
3722
- "br",
3723
- "col",
3724
- "embed",
3725
- "hr",
3726
- "img",
3727
- "input",
3728
- "link",
3729
- "meta",
3730
- "param",
3731
- "source",
3732
- "track",
3733
- "wbr"
3734
- ]);
3735
- for (; d = h.exec(u); )
3736
- if (!(d[0].startsWith("<!--") && d[0].endsWith("-->"))) {
3737
- if (d[1]) {
3738
- const l = d[1], y = d[0][1] === "/", w = d[0][d[0].length - 2] === "/" || T.has(l), {
3739
- props: L,
3740
- attrs: N,
3741
- directives: M,
3742
- bound: D
3743
- } = fn(
3744
- d[2] || "",
3745
- n,
3746
- r ?? {}
3747
- ), O = { props: {}, attrs: {} };
3748
- for (const z in L) O.props[z] = L[z];
3749
- for (const z in N) O.attrs[z] = N[z];
3750
- O.attrs && Object.prototype.hasOwnProperty.call(O.attrs, "key") && !(O.props && Object.prototype.hasOwnProperty.call(O.props, "key")) && x(() => {
3751
- O.props.key = O.attrs.key;
3752
- });
3753
- try {
3754
- const z = {
3755
- input: [
3756
- "value",
3757
- "checked",
3758
- "readonly",
3759
- "required",
3760
- "placeholder",
3761
- "maxlength",
3762
- "minlength"
3763
- ],
3764
- textarea: [
3765
- "value",
3766
- "readonly",
3767
- "required",
3768
- "placeholder",
3769
- "maxlength",
3770
- "minlength"
3771
- ],
3772
- select: ["value", "required", "multiple"],
3773
- option: ["selected", "value"],
3774
- video: ["muted", "autoplay", "controls", "loop", "playsinline"],
3775
- audio: ["muted", "autoplay", "controls", "loop"],
3776
- img: ["src", "alt", "width", "height"],
3777
- button: ["type", "name", "value", "autofocus", "form"]
3778
- }, I = l.toLowerCase(), ie = z[I] ?? [];
3779
- if (O.attrs) {
3780
- for (const H of ie)
3781
- if (D && D.includes(H) && H in O.attrs && !(O.props && H in O.props)) {
3782
- let $ = O.attrs[H];
3783
- if ($ && P($))
3784
- $ = $.value, O.props[H] = $, delete O.attrs[H];
3785
- else if ($ && typeof $ == "object" && "value" in $ && !($ instanceof Node))
3786
- try {
3787
- const W = $.value;
3788
- O.props[H] = (I === "select" || I === "option") && H === "value" ? String(W) : W, delete O.attrs[H];
3789
- } catch {
3790
- }
3791
- else {
3792
- const W = typeof $;
3793
- if (H === "disabled")
3794
- ($ === "" || W === "boolean" || W === "string" && ($ === "true" || $ === "false") || $ == null || W === "number") && (O.props[H] = $, delete O.attrs[H]);
3795
- else if ($ === "" || W === "string" || W === "number" || W === "boolean" || $ == null) {
3796
- const te = (I === "select" || I === "option") && H === "value" ? String($) : $;
3797
- O.props[H] = te, delete O.attrs[H];
3798
- }
3799
- }
3800
- }
3801
- }
3802
- if (l.includes("-") || !!r?.__customElements?.has?.(l)) {
3803
- if (O.isCustomElement = !0, D && O.attrs) {
3804
- const H = /* @__PURE__ */ new Set(["id", "name", "data-key", "key"]);
3805
- for (const $ of D)
3806
- if ($ in O.attrs && !(O.props && $ in O.props)) {
3807
- const W = $.includes("-") ? Xe($) : $, te = O.attrs[$];
3808
- if (O.props[W] = te, H.has($) || pt($))
3809
- try {
3810
- const xe = V(O.attrs[$]);
3811
- xe === null ? delete O.attrs[$] : O.attrs[$] = xe;
3812
- } catch {
3813
- delete O.attrs[$];
3814
- }
3815
- else
3816
- delete O.attrs[$];
3817
- }
3818
- }
3819
- try {
3820
- if (O.attrs && !(O.props && "modelValue" in O.props)) {
3821
- const H = O.attrs["model-value"] ?? O.attrs.modelValue;
3822
- typeof H < "u" && (O.props.modelValue = H);
3823
- }
3824
- } catch {
3825
- }
3826
- }
3827
- } catch {
3828
- }
3829
- if (M && Object.keys(M).some(
3830
- (z) => z === "model" || z.startsWith("model:")
3831
- ))
3832
- try {
3833
- const I = globalThis[/* @__PURE__ */ Symbol.for("cer.registry")], ie = !!(I && typeof I.has == "function" && I.has(l)), X = r, H = !!(X && (X.__customElements instanceof Set && X.__customElements.has(l) || Array.isArray(X.__isCustomElements) && X.__isCustomElements.includes(l)));
3834
- if (!!(l.includes("-") || H || ie))
3835
- for (const te of Object.keys(M)) {
3836
- if (te !== "model" && !te.startsWith("model:")) continue;
3837
- const $e = M[te], xe = $e.arg ?? (te.includes(":") ? te.split(":", 2)[1] : void 0), F = $e.value, ze = xe ?? "modelValue", Qe = K, vt = We, Se = r?._state || r;
3838
- let se;
3839
- if (typeof F == "string" && Se)
3840
- se = Qe(
3841
- Se,
3842
- F
3843
- );
3844
- else if (se = F, P(F))
3845
- try {
3846
- F.value;
3847
- } catch {
3848
- }
3849
- O.props[ze] = se;
3850
- try {
3851
- const ae = J(ze);
3852
- O.attrs || (O.attrs = {}), se != null && (typeof se == "string" || typeof se == "number" || typeof se == "boolean") && (O.attrs[ae] = se);
3853
- } catch {
3854
- }
3855
- O.isCustomElement = !0;
3856
- const et = `update:${J(ze)}`.replace(
3857
- /-([a-z])/g,
3858
- (ae, re) => re.toUpperCase()
3859
- ), Et = "on" + et.charAt(0).toUpperCase() + et.slice(1);
3860
- O.props[Et] = function(ae) {
3861
- const re = ae.detail !== void 0 ? ae.detail : ae.target ? ae.target.value : void 0;
3862
- if (Se)
3863
- if (F && P(F)) {
3864
- const le = F.value;
3865
- if (Array.isArray(re) && Array.isArray(le) ? JSON.stringify([...re].sort()) !== JSON.stringify([...le].sort()) : re !== le) {
3866
- F.value = re;
3867
- try {
3868
- const fe = r;
3869
- if (fe) {
3870
- const Ce = fe.requestRender, ke = fe._requestRender;
3871
- typeof Ce == "function" ? Ce() : typeof ke == "function" && ke();
3872
- }
3873
- } catch {
3874
- }
3875
- }
3876
- } else {
3877
- const le = Qe(
3878
- Se || {},
3879
- typeof F == "string" ? F : String(F)
3880
- );
3881
- if (Array.isArray(re) && Array.isArray(le) ? JSON.stringify([...re].sort()) !== JSON.stringify([...le].sort()) : re !== le) {
3882
- vt(
3883
- Se || {},
3884
- typeof F == "string" ? F : String(F),
3885
- re
3886
- );
3887
- try {
3888
- const fe = r;
3889
- if (fe) {
3890
- const Ce = fe.requestRender, ke = fe._requestRender;
3891
- typeof Ce == "function" ? Ce() : typeof ke == "function" && ke();
3892
- }
3893
- } catch {
3894
- }
3895
- }
3896
- }
3897
- }, delete M[te];
3898
- }
3899
- } catch {
3900
- }
3901
- if (Object.keys(M).length > 0 && (O.directives = { ...M }), y) {
3902
- const z = k.some(
3903
- (H) => typeof H == "object" && H.tag !== "#text"
3904
- );
3905
- let I = k;
3906
- if (z && k.length > 0) {
3907
- let H = 0;
3908
- for (; H < k.length; ) {
3909
- const W = k[H];
3910
- if (!ue(W) || W.tag !== "#text" || typeof W.children != "string" || W.children.trim() !== "")
3911
- break;
3912
- H++;
3913
- }
3914
- let $ = k.length - 1;
3915
- for (; $ >= 0; ) {
3916
- const W = k[$];
3917
- if (!ue(W) || W.tag !== "#text" || typeof W.children != "string" || W.children.trim() !== "")
3918
- break;
3919
- $--;
3920
- }
3921
- H === 0 && $ === k.length - 1 ? I = k : H > $ ? I = [] : I = k.slice(H, $ + 1);
3922
- }
3923
- const ie = ce(
3924
- j,
3925
- A,
3926
- I.length === 1 && ue(I[0]) && I[0].tag === "#text" ? typeof I[0].children == "string" ? I[0].children : "" : I.length ? I : void 0,
3927
- a
3928
- ), X = p.pop();
3929
- X ? (j = X.tag, A = X.props, a = X.key, k = X.children, k.push(ie)) : (E.push(ie), j = null, A = {}, a = void 0, k = []);
3930
- } else w ? j ? k.push(ce(l, O, void 0, void 0)) : E.push(ce(l, O, void 0, void 0)) : (j && p.push({
3931
- tag: j,
3932
- props: A,
3933
- children: k,
3934
- key: a
3935
- }), j = l, A = O, k = []);
3936
- } else if (typeof d[3] < "u") {
3937
- const l = Number(d[3]), y = n[l], w = `interp-${l}`;
3938
- C(y, w);
3939
- } else if (d[4]) {
3940
- const l = d[4], y = j ? k : E, w = l.split(/({{\d+}})/);
3941
- for (const L of w) {
3942
- if (!L) continue;
3943
- const N = L.match(/^{{(\d+)}}$/);
3944
- if (N) {
3945
- const M = Number(N[1]), D = n[M], O = `interp-${M}`;
3946
- C(D, O);
3947
- } else {
3948
- const M = `text-${b++}`, D = v();
3949
- y.push(f(L, M, D));
3950
- }
3951
- }
3952
- }
3953
- }
3954
- const _ = E.filter((l) => ue(l) && l.tag === "#text" ? typeof l.children == "string" && l.children.trim() !== "" : !0).map(
3955
- (l) => Ye(l)
3956
- );
3957
- if (_.length === 1) {
3958
- const l = _[0];
3959
- return i && o && qe.set(o, l), l;
3960
- } else if (_.length > 1) {
3961
- const l = _;
3962
- return i && o && qe.set(o, l), l;
3963
- }
3964
- return ce("div", {}, "", "fallback-root");
3965
- }
3966
- function Mn(e, ...n) {
3967
- if (Y()) return [];
3968
- const t = n[n.length - 1], s = typeof t == "object" && t && !Array.isArray(t) ? t : void 0;
3969
- return un(e, n, s);
3970
- }
3971
- export {
3972
- Ln as a,
3973
- sn as b,
3974
- jn as c,
3975
- Tn as d,
3976
- On as e,
3977
- wn as f,
3978
- bn as g,
3979
- Mn as h,
3980
- gn as i,
3981
- vn as j,
3982
- Cn as k,
3983
- En as l,
3984
- Sn as m,
3985
- Nn as n,
3986
- _n as o,
3987
- An as p,
3988
- kn as u,
3989
- Jt as v
3990
- };
3991
- //# sourceMappingURL=template-compiler-CVBKYu3j.js.map