@jasonshimmy/custom-elements-runtime 3.4.0 → 3.6.0

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