@koppajs/koppajs-core 3.0.9 → 3.0.10

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.
package/dist/index.es.js CHANGED
@@ -1,11 +1,11 @@
1
- var Ie = /* @__PURE__ */ ((e) => (e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e[e.NONE = 4] = "NONE", e))(Ie || {});
2
- const q = {
1
+ var Le = /* @__PURE__ */ ((e) => (e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e[e.NONE = 4] = "NONE", e))(Le || {});
2
+ const z = {
3
3
  ERROR: "❌",
4
4
  WARN: "⚠️",
5
5
  INFO: "ℹ️",
6
6
  DEBUG: "🔍"
7
7
  };
8
- class Le {
8
+ class De {
9
9
  level = 3;
10
10
  isDevelopment = !1;
11
11
  /**
@@ -34,57 +34,57 @@ class Le {
34
34
  shouldLog(t) {
35
35
  return t >= this.level;
36
36
  }
37
- formatMessage(t, o, n) {
38
- const i = [t, o];
37
+ formatMessage(t, r, n) {
38
+ const o = [t, r];
39
39
  if (n) {
40
- const l = Object.entries(n).map(([r, s]) => `${r}: ${s}`).join(", ");
41
- l && i.push(`[${l}]`);
40
+ const l = Object.entries(n).map(([i, s]) => `${i}: ${s}`).join(", ");
41
+ l && o.push(`[${l}]`);
42
42
  }
43
- return i.join(" ");
43
+ return o.join(" ");
44
44
  }
45
45
  /**
46
46
  * Log an error message.
47
47
  * @param message - Error message
48
48
  * @param args - Additional arguments to log
49
49
  */
50
- error(t, ...o) {
50
+ error(t, ...r) {
51
51
  this.shouldLog(
52
52
  3
53
53
  /* ERROR */
54
- ) && console.error(this.formatMessage(q.ERROR, t), ...o);
54
+ ) && console.error(this.formatMessage(z.ERROR, t), ...r);
55
55
  }
56
56
  /**
57
57
  * Log a warning message.
58
58
  * @param message - Warning message
59
59
  * @param args - Additional arguments to log
60
60
  */
61
- warn(t, ...o) {
61
+ warn(t, ...r) {
62
62
  this.shouldLog(
63
63
  2
64
64
  /* WARN */
65
- ) && console.warn(this.formatMessage(q.WARN, t), ...o);
65
+ ) && console.warn(this.formatMessage(z.WARN, t), ...r);
66
66
  }
67
67
  /**
68
68
  * Log an info message.
69
69
  * @param message - Info message
70
70
  * @param args - Additional arguments to log
71
71
  */
72
- info(t, ...o) {
72
+ info(t, ...r) {
73
73
  this.shouldLog(
74
74
  1
75
75
  /* INFO */
76
- ) && console.info(this.formatMessage(q.INFO, t), ...o);
76
+ ) && console.info(this.formatMessage(z.INFO, t), ...r);
77
77
  }
78
78
  /**
79
79
  * Log a debug message.
80
80
  * @param message - Debug message
81
81
  * @param args - Additional arguments to log
82
82
  */
83
- debug(t, ...o) {
83
+ debug(t, ...r) {
84
84
  this.shouldLog(
85
85
  0
86
86
  /* DEBUG */
87
- ) && console.debug(this.formatMessage(q.DEBUG, t), ...o);
87
+ ) && console.debug(this.formatMessage(z.DEBUG, t), ...r);
88
88
  }
89
89
  /**
90
90
  * Log an error with context information.
@@ -92,29 +92,29 @@ class Le {
92
92
  * @param context - Context object with additional information
93
93
  * @param error - Optional error object
94
94
  */
95
- errorWithContext(t, o, n) {
95
+ errorWithContext(t, r, n) {
96
96
  if (!this.shouldLog(
97
97
  3
98
98
  /* ERROR */
99
99
  )) return;
100
- const i = this.formatMessage(q.ERROR, t, o);
101
- n ? console.error(i, n) : console.error(i);
100
+ const o = this.formatMessage(z.ERROR, t, r);
101
+ n ? console.error(o, n) : console.error(o);
102
102
  }
103
103
  /**
104
104
  * Log a warning with context information.
105
105
  * @param message - Warning message
106
106
  * @param context - Context object with additional information
107
107
  */
108
- warnWithContext(t, o) {
108
+ warnWithContext(t, r) {
109
109
  this.shouldLog(
110
110
  2
111
111
  /* WARN */
112
- ) && console.warn(this.formatMessage(q.WARN, t, o));
112
+ ) && console.warn(this.formatMessage(z.WARN, t, r));
113
113
  }
114
114
  }
115
- const S = new Le();
116
- S.init();
117
- const fe = /* @__PURE__ */ Symbol("isBounded"), ge = /* @__PURE__ */ Symbol("isProxy"), De = [
115
+ const N = new De();
116
+ N.init();
117
+ const ue = /* @__PURE__ */ Symbol("isBounded"), Ee = /* @__PURE__ */ Symbol("isProxy"), Ve = [
118
118
  "created",
119
119
  "beforeMount",
120
120
  "mounted",
@@ -124,51 +124,51 @@ const fe = /* @__PURE__ */ Symbol("isBounded"), ge = /* @__PURE__ */ Symbol("isP
124
124
  "destroyed",
125
125
  "processed"
126
126
  ];
127
- function Y(e, t) {
128
- if (typeof e != "function" || e[fe]) return e;
127
+ function Q(e, t) {
128
+ if (typeof e != "function" || e[ue]) return e;
129
129
  const n = e.bind(t);
130
- return n[fe] = !0, n;
130
+ return n[ue] = !0, n;
131
131
  }
132
132
  function We(e, t) {
133
- for (const o in e) {
134
- const n = e[o];
135
- if (Object.prototype.hasOwnProperty.call(e, o) && typeof n == "function")
133
+ for (const r in e) {
134
+ const n = e[r];
135
+ if (Object.prototype.hasOwnProperty.call(e, r) && typeof n == "function")
136
136
  try {
137
- e[o] = Y(n, t);
138
- } catch (i) {
139
- S.errorWithContext(
140
- `Failed to bind method "${o}"`,
141
- { methodName: o },
142
- i
137
+ e[r] = Q(n, t);
138
+ } catch (o) {
139
+ N.errorWithContext(
140
+ `Failed to bind method "${r}"`,
141
+ { methodName: r },
142
+ o
143
143
  );
144
144
  }
145
145
  }
146
146
  }
147
- function Fe(e) {
147
+ function je(e) {
148
148
  return /<\/?[a-z][^>]*>/i.test(e);
149
149
  }
150
- function re(e, t) {
150
+ function se(e, t) {
151
151
  if (e == null || typeof t != "string") return;
152
- const o = t.trim().replace(/\[(\w+)\]/g, ".$1").split(".").filter(Boolean);
152
+ const r = t.trim().replace(/\[(\w+)\]/g, ".$1").split(".").filter(Boolean);
153
153
  try {
154
- return o.reduce((n, i) => {
154
+ return r.reduce((n, o) => {
155
155
  if (n != null)
156
- return n[i];
156
+ return n[o];
157
157
  }, e);
158
158
  } catch {
159
159
  return;
160
160
  }
161
161
  }
162
- function Ve(e) {
162
+ function He(e) {
163
163
  return typeof e == "string" ? e.toLowerCase() : typeof e == "function" && typeof e.name == "string" ? e.name.toLowerCase() : "unknown";
164
164
  }
165
- function be(e) {
165
+ function ve(e) {
166
166
  const t = e.trim();
167
167
  return /^[a-zA-Z_$][0-9a-zA-Z_$]*(?:\[(?:\d+|\w+)\]|\.[a-zA-Z_$][0-9a-zA-Z_$]*)*$/.test(
168
168
  t
169
169
  );
170
170
  }
171
- function je(e, t, o) {
171
+ function Be(e, t, r) {
172
172
  if (e == null || typeof e != "object" && typeof e != "function")
173
173
  throw new Error("❌ setValueByPath: target must be an object.");
174
174
  if (typeof t != "string" || !t.trim())
@@ -176,40 +176,40 @@ function je(e, t, o) {
176
176
  const n = t.trim().replace(/\[(\w+)\]/g, ".$1").split(".").filter(Boolean);
177
177
  if (n.length === 0)
178
178
  throw new Error(`❌ setValueByPath: invalid path "${t}".`);
179
- const i = (c, a) => Object.prototype.hasOwnProperty.call(c, a), l = n.pop();
180
- let r = e;
179
+ const o = (c, a) => Object.prototype.hasOwnProperty.call(c, a), l = n.pop();
180
+ let i = e;
181
181
  for (const c of n) {
182
- if (r == null || typeof r != "object" && typeof r != "function")
182
+ if (i == null || typeof i != "object" && typeof i != "function")
183
183
  throw new Error(
184
184
  `❌ setValueByPath: invalid path "${t}". Segment "${c}" is not an object.`
185
185
  );
186
- if (!i(r, c))
186
+ if (!o(i, c))
187
187
  throw new Error(
188
188
  `❌ setValueByPath: invalid path "${t}". Missing segment "${c}".`
189
189
  );
190
- const a = r[c];
190
+ const a = i[c];
191
191
  if (a == null || typeof a != "object" && typeof a != "function")
192
192
  throw new Error(
193
193
  `❌ setValueByPath: invalid path "${t}". Segment "${c}" is not an object.`
194
194
  );
195
- r = a;
195
+ i = a;
196
196
  }
197
- if (r == null || typeof r != "object" && typeof r != "function")
197
+ if (i == null || typeof i != "object" && typeof i != "function")
198
198
  throw new Error(
199
199
  `❌ setValueByPath: invalid path "${t}". Final target is not an object.`
200
200
  );
201
- if (!i(r, l))
201
+ if (!o(i, l))
202
202
  throw new Error(
203
203
  `❌ setValueByPath: invalid path "${t}". Final key "${l}" does not exist.`
204
204
  );
205
- const s = Object.getOwnPropertyDescriptor(r, l);
205
+ const s = Object.getOwnPropertyDescriptor(i, l);
206
206
  if (s && s.writable === !1 && !s.set)
207
207
  throw new Error(
208
208
  `❌ setValueByPath: cannot write "${t}". Property "${l}" is read-only.`
209
209
  );
210
- r[l] = o;
210
+ i[l] = r;
211
211
  }
212
- const He = {
212
+ const qe = {
213
213
  select: {
214
214
  get() {
215
215
  return (e) => this instanceof HTMLInputElement || this instanceof HTMLTextAreaElement ? (this.select(), null) : this.querySelector(e);
@@ -252,9 +252,9 @@ const He = {
252
252
  return (e) => {
253
253
  if (!this.parentNode) return [];
254
254
  const t = [];
255
- let o = this.parentNode.firstChild;
256
- for (; o; )
257
- o.nodeType === Node.ELEMENT_NODE && o !== this && o instanceof HTMLElement && (e?.(o), t.push(o)), o = o.nextSibling;
255
+ let r = this.parentNode.firstChild;
256
+ for (; r; )
257
+ r.nodeType === Node.ELEMENT_NODE && r !== this && r instanceof HTMLElement && (e?.(r), t.push(r)), r = r.nextSibling;
258
258
  return t;
259
259
  };
260
260
  }
@@ -278,51 +278,51 @@ const He = {
278
278
  return (e, t) => (t !== void 0 && this.setAttribute(e, t || "true"), this.getAttribute(e));
279
279
  }
280
280
  }
281
- }, Be = {};
282
- function qe(e) {
281
+ }, ze = {};
282
+ function Ue(e) {
283
283
  return e.replace(/-./g, (t) => t[1].toUpperCase());
284
284
  }
285
- const ze = /(?:\bwindow\b|\bdocument\b|\bglobalThis\b|\bFunction\b|\beval\b|\bsetTimeout\b|\bsetInterval\b|\bfetch\b|\bXMLHttpRequest\b|\bimport\b|\brequire\b|\bthis\b)/, z = /* @__PURE__ */ new Map(), Ue = 1e3, ue = /* @__PURE__ */ new WeakMap();
286
- function Xe(e) {
287
- const t = Object.keys(e), o = t.join("\0"), n = ue.get(e);
288
- if (n && n.fingerprint === o)
285
+ const Xe = /(?:\bwindow\b|\bdocument\b|\bglobalThis\b|\bFunction\b|\beval\b|\bsetTimeout\b|\bsetInterval\b|\bfetch\b|\bXMLHttpRequest\b|\bimport\b|\brequire\b|\bthis\b)/, U = /* @__PURE__ */ new Map(), Ge = 1e3, de = /* @__PURE__ */ new WeakMap();
286
+ function Ke(e) {
287
+ const t = Object.keys(e), r = t.join("\0"), n = de.get(e);
288
+ if (n && n.fingerprint === r)
289
289
  return n.keys;
290
- const i = t.sort();
291
- return ue.set(e, { keys: i, fingerprint: o }), i;
290
+ const o = t.sort();
291
+ return de.set(e, { keys: o, fingerprint: r }), o;
292
292
  }
293
- function B(e, t = {}) {
294
- const o = (e ?? "").trim();
295
- if (o)
293
+ function q(e, t = {}) {
294
+ const r = (e ?? "").trim();
295
+ if (r)
296
296
  try {
297
- if (ze.test(o))
297
+ if (Xe.test(r))
298
298
  return;
299
- if (be(o)) {
300
- const r = re(t, o);
301
- return typeof r == "function" ? r.call(t) : r;
299
+ if (ve(r)) {
300
+ const i = se(t, r);
301
+ return typeof i == "function" ? i.call(t) : i;
302
302
  }
303
- const n = Xe(t), i = `${o}|${n.join(",")}`;
304
- let l = z.get(i);
303
+ const n = Ke(t), o = `${r}|${n.join(",")}`;
304
+ let l = U.get(o);
305
305
  if (!l) {
306
- const r = `"use strict"; return (${o});`;
307
- if (l = new Function(...n, r), z.size >= Ue) {
308
- const s = z.keys().next().value;
309
- s && z.delete(s);
306
+ const i = `"use strict"; return (${r});`;
307
+ if (l = new Function(...n, i), U.size >= Ge) {
308
+ const s = U.keys().next().value;
309
+ s && U.delete(s);
310
310
  }
311
- z.set(i, l);
311
+ U.set(o, l);
312
312
  }
313
- return l(...n.map((r) => t[r]));
313
+ return l(...n.map((i) => t[i]));
314
314
  } catch (n) {
315
- S.debug(`Expression evaluation failed: ${o}`, n);
315
+ N.debug(`Expression evaluation failed: ${r}`, n);
316
316
  return;
317
317
  }
318
318
  }
319
- function Ge(e) {
319
+ function Ze(e) {
320
320
  return e.length === 0 ? "" : e.map((t) => `var ${t} = __deps.${t};`).join(`
321
321
  `) + `
322
322
  `;
323
323
  }
324
- function Ke(e, t) {
325
- const o = e.replace(/\$-\{/g, "${"), n = t ? Object.keys(t) : [], l = `
324
+ function Ye(e, t) {
325
+ const r = e.replace(/\$-\{/g, "${"), n = t ? Object.keys(t) : [], l = `
326
326
  const { $refs, $parent, $emit, $take, $handleEventFromChild, ...rest } = context;
327
327
 
328
328
  // Expose all $*-prefixed context entries (e.g. $router, $store) as local variables
@@ -335,109 +335,109 @@ function Ke(e, t) {
335
335
  }
336
336
 
337
337
  // Inject resolved dependencies as local variables
338
- ${Ge(n)}
338
+ ${Ze(n)}
339
339
 
340
- return (${o});
340
+ return (${r});
341
341
  `;
342
342
  try {
343
- const r = t ? new Function("context", "__deps", l) : new Function("context", l);
344
- return ((c) => t ? r(c, t) : r(c));
345
- } catch (r) {
346
- throw S.errorWithContext("Failed to compile dynamic code", { functionBody: l }, r), r;
343
+ const i = t ? new Function("context", "__deps", l) : new Function("context", l);
344
+ return ((c) => t ? i(c, t) : i(c));
345
+ } catch (i) {
346
+ throw N.errorWithContext("Failed to compile dynamic code", { functionBody: l }, i), i;
347
347
  }
348
348
  }
349
- function Ee() {
349
+ function we() {
350
350
  return /* @__PURE__ */ new Map();
351
351
  }
352
- const ve = Ee();
353
- function we(e, t, o) {
354
- e === "global" && (e = ve), e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(o);
352
+ const _e = we();
353
+ function Ce(e, t, r) {
354
+ e === "global" && (e = _e), e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(r);
355
355
  }
356
- async function P(e, t, o) {
357
- e === "global" && (e = ve);
356
+ async function I(e, t, r) {
357
+ e === "global" && (e = _e);
358
358
  const n = Array.from(e.get(t) ?? []);
359
- for (const i of n)
359
+ for (const o of n)
360
360
  try {
361
- await i(o);
361
+ await o(r);
362
362
  } catch (l) {
363
- S.errorWithContext(`Hook "${t}" callback failed`, { hook: t }, l);
363
+ N.errorWithContext(`Hook "${t}" callback failed`, { hook: t }, l);
364
364
  }
365
365
  }
366
- const Z = {
366
+ const J = {
367
367
  modules: {},
368
368
  plugins: {}
369
369
  };
370
- function Ze(e) {
370
+ function Je(e) {
371
371
  if (e == null || typeof e != "object") return !1;
372
372
  const t = e;
373
373
  return typeof t.template == "string" && typeof t.script == "string" && typeof t.style == "string";
374
374
  }
375
- function J(e) {
375
+ function ee(e) {
376
376
  if (e == null || typeof e != "object") return !1;
377
377
  const t = e;
378
378
  return typeof t.setup == "function" && t.attach === void 0;
379
379
  }
380
- function Ye(e) {
380
+ function Qe(e) {
381
381
  if (e == null || typeof e != "object") return !1;
382
382
  const t = e;
383
383
  return typeof t.attach == "function" && t.setup === void 0;
384
384
  }
385
- function Je(e) {
385
+ function et(e) {
386
386
  return e instanceof HTMLElement && "instance" in e && e.instance !== void 0;
387
387
  }
388
- const Qe = () => {
389
- Object.defineProperties(Object.prototype, Be), typeof HTMLElement < "u" && Object.defineProperties(HTMLElement.prototype, He);
388
+ const tt = () => {
389
+ Object.defineProperties(Object.prototype, ze), typeof HTMLElement < "u" && Object.defineProperties(HTMLElement.prototype, qe);
390
390
  };
391
- function U(e) {
391
+ function X(e) {
392
392
  return e.nodeType === Node.ELEMENT_NODE && e.tagName.includes("-");
393
393
  }
394
- function et(e, t) {
395
- const o = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
396
- acceptNode: (i) => U(i) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
394
+ function nt(e, t) {
395
+ const r = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
396
+ acceptNode: (o) => X(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
397
397
  });
398
- let n = o.nextNode();
398
+ let n = r.nextNode();
399
399
  for (; n; ) {
400
- const i = n.getAttribute(t);
401
- i !== null && (Ae(n) === void 0 && Ce(n, i), n.removeAttribute(t)), n = o.nextNode();
400
+ const o = n.getAttribute(t);
401
+ o !== null && (Se(n) === void 0 && Te(n, o), n.removeAttribute(t)), n = r.nextNode();
402
402
  }
403
403
  }
404
- function de(e, t) {
405
- if (!U(e)) return null;
406
- const o = e.tagName;
407
- let n = Ae(e);
408
- const i = rt(e);
404
+ function he(e, t) {
405
+ if (!X(e)) return null;
406
+ const r = e.tagName;
407
+ let n = Se(e);
408
+ const o = st(e);
409
409
  if (n === void 0 && t) {
410
410
  const l = e.getAttribute(t);
411
- l !== null && (Ce(e, l), n = l, e.removeAttribute(t));
411
+ l !== null && (Te(e, l), n = l, e.removeAttribute(t));
412
412
  }
413
- return n === void 0 ? null : i !== void 0 ? `${o}:${String(n)}:${String(i)}` : `${o}:${String(n)}`;
413
+ return n === void 0 ? null : o !== void 0 ? `${r}:${String(n)}:${String(o)}` : `${r}:${String(n)}`;
414
414
  }
415
- function tt(e, t) {
415
+ function rt(e, t) {
416
416
  return e.nodeType !== t.nodeType ? !1 : e.nodeType === Node.TEXT_NODE || e.nodeType === Node.COMMENT_NODE ? !0 : e.nodeType === Node.ELEMENT_NODE ? e.tagName === t.tagName : !1;
417
417
  }
418
- function Q(e, t) {
419
- const o = new Set(e.getAttributeNames()), n = new Set(t.getAttributeNames());
420
- for (const i of o)
421
- !n.has(i) && !i.startsWith("@") && e.removeAttribute(i);
422
- for (const i of n) {
423
- const l = t.getAttribute(i), r = e.getAttribute(i);
424
- l !== r && (l === null ? e.removeAttribute(i) : e.setAttribute(i, l));
418
+ function te(e, t) {
419
+ const r = new Set(e.getAttributeNames()), n = new Set(t.getAttributeNames());
420
+ for (const o of r)
421
+ !n.has(o) && !o.startsWith("@") && e.removeAttribute(o);
422
+ for (const o of n) {
423
+ const l = t.getAttribute(o), i = e.getAttribute(o);
424
+ l !== i && (l === null ? e.removeAttribute(o) : e.setAttribute(o, l));
425
425
  }
426
426
  }
427
- function Ne(e, t, o) {
428
- const n = Array.from(e.childNodes), i = Array.from(t.childNodes), l = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
427
+ function Ne(e, t, r) {
428
+ const n = Array.from(e.childNodes), o = Array.from(t.childNodes), l = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
429
429
  for (const s of n) {
430
- const c = de(s, o);
430
+ const c = he(s, r);
431
431
  c !== null && !l.has(c) && l.set(c, s);
432
432
  }
433
- for (let s = 0; s < i.length; s++) {
434
- const c = i[s], a = n[s], u = de(c, o);
433
+ for (let s = 0; s < o.length; s++) {
434
+ const c = o[s], a = n[s], u = he(c, r);
435
435
  let d = null;
436
- if (u !== null && l.has(u) && (d = l.get(u), r.add(d)), d && U(d)) {
437
- a !== d && (s < e.childNodes.length ? e.insertBefore(d, e.childNodes[s]) : e.appendChild(d)), Q(d, c);
436
+ if (u !== null && l.has(u) && (d = l.get(u), i.add(d)), d && X(d)) {
437
+ a !== d && (s < e.childNodes.length ? e.insertBefore(d, e.childNodes[s]) : e.appendChild(d)), te(d, c);
438
438
  continue;
439
439
  }
440
- if (U(c) && u !== null) {
440
+ if (X(c) && u !== null) {
441
441
  a ? e.replaceChild(c, a) : e.appendChild(c);
442
442
  continue;
443
443
  }
@@ -445,7 +445,7 @@ function Ne(e, t, o) {
445
445
  e.appendChild(c);
446
446
  continue;
447
447
  }
448
- if (!tt(a, c)) {
448
+ if (!rt(a, c)) {
449
449
  e.replaceChild(c, a);
450
450
  continue;
451
451
  }
@@ -458,124 +458,124 @@ function Ne(e, t, o) {
458
458
  continue;
459
459
  }
460
460
  if (a.nodeType === Node.ELEMENT_NODE) {
461
- const v = a, x = c;
462
- if (U(v)) {
463
- Q(v, x);
461
+ const v = a, A = c;
462
+ if (X(v)) {
463
+ te(v, A);
464
464
  continue;
465
465
  }
466
- Q(v, x), Ne(v, x, o);
466
+ te(v, A), Ne(v, A, r);
467
467
  }
468
468
  }
469
- for (; e.childNodes.length > i.length; ) {
469
+ for (; e.childNodes.length > o.length; ) {
470
470
  const s = e.lastChild;
471
471
  s && e.removeChild(s);
472
472
  }
473
473
  }
474
- function nt(e, t, o, n) {
475
- if (o || e.childNodes.length === 0) {
476
- n && et(t, n), e.replaceChildren(t);
474
+ function ot(e, t, r, n) {
475
+ if (r || e.childNodes.length === 0) {
476
+ n && nt(t, n), e.replaceChildren(t);
477
477
  return;
478
478
  }
479
- const i = document.createElement("div");
480
- i.appendChild(t), Ne(e, i, n);
479
+ const o = document.createElement("div");
480
+ o.appendChild(t), Ne(e, o, n);
481
481
  }
482
- const ie = /* @__PURE__ */ Symbol("STRUCT_ID"), se = /* @__PURE__ */ Symbol("SLOT_ID");
483
- function _e(e, t, o) {
482
+ const ce = /* @__PURE__ */ Symbol("STRUCT_ID"), ae = /* @__PURE__ */ Symbol("SLOT_ID");
483
+ function Ae(e, t, r) {
484
484
  Object.defineProperty(e, t, {
485
- value: o,
485
+ value: r,
486
486
  writable: !0,
487
487
  configurable: !0,
488
488
  enumerable: !1
489
489
  });
490
490
  }
491
- function Ce(e, t) {
492
- _e(e, ie, t);
491
+ function Te(e, t) {
492
+ Ae(e, ce, t);
493
493
  }
494
- function Ae(e) {
495
- return Object.prototype.hasOwnProperty.call(e, ie) ? e[ie] : void 0;
494
+ function Se(e) {
495
+ return Object.prototype.hasOwnProperty.call(e, ce) ? e[ce] : void 0;
496
496
  }
497
- function ot(e, t) {
498
- _e(e, se, t);
497
+ function it(e, t) {
498
+ Ae(e, ae, t);
499
499
  }
500
- function rt(e) {
501
- return Object.prototype.hasOwnProperty.call(e, se) ? e[se] : void 0;
500
+ function st(e) {
501
+ return Object.prototype.hasOwnProperty.call(e, ae) ? e[ae] : void 0;
502
502
  }
503
- function it(e, t, o, n) {
503
+ function ct(e, t, r, n) {
504
504
  if (!Array.isArray(t)) return () => {
505
505
  };
506
- const i = [];
507
- return t.forEach(([l, r, s]) => {
506
+ const o = [];
507
+ return t.forEach(([l, i, s]) => {
508
508
  if (typeof l != "string" || typeof s != "function") {
509
- S.error("Provided handler is not a function", s);
509
+ N.error("Provided handler is not a function", s);
510
510
  return;
511
511
  }
512
512
  let c = [];
513
- if (r === "window")
513
+ if (i === "window")
514
514
  c = [window];
515
- else if (typeof r == "string")
516
- if (r.startsWith("$refs.")) {
517
- const [a, ...u] = r.slice(6).split(" "), d = n[a];
515
+ else if (typeof i == "string")
516
+ if (i.startsWith("$refs.")) {
517
+ const [a, ...u] = i.slice(6).split(" "), d = n[a];
518
518
  d && (c = u.length ? Array.from(d.querySelectorAll(u.join(" "))) : [d]);
519
519
  } else
520
- c = Array.from(o.querySelectorAll(r));
521
- else if (r instanceof Element || r instanceof Window)
522
- c = [r];
523
- else if (typeof r == "object" && r && "ref" in r) {
524
- const { ref: a, selector: u } = r, d = n[a];
520
+ c = Array.from(r.querySelectorAll(i));
521
+ else if (i instanceof Element || i instanceof Window)
522
+ c = [i];
523
+ else if (typeof i == "object" && i && "ref" in i) {
524
+ const { ref: a, selector: u } = i, d = n[a];
525
525
  d && (c = u ? Array.from(d.querySelectorAll(u)) : [d]);
526
526
  }
527
527
  for (const a of c) {
528
- const u = Y(s, e);
529
- a.addEventListener(l, u), i.push({ target: a, type: l, handler: u });
528
+ const u = Q(s, e);
529
+ a.addEventListener(l, u), o.push({ target: a, type: l, handler: u });
530
530
  }
531
531
  }), () => {
532
- for (const { target: l, type: r, handler: s } of i)
533
- l.removeEventListener(r, s);
534
- i.length = 0;
532
+ for (const { target: l, type: i, handler: s } of o)
533
+ l.removeEventListener(i, s);
534
+ o.length = 0;
535
535
  };
536
536
  }
537
- const Te = /^on([a-z]+)$/i;
538
- function st(e, t) {
539
- const o = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT);
540
- let n = o.nextNode();
537
+ const xe = /^on([a-z]+)$/i;
538
+ function at(e, t) {
539
+ const r = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT);
540
+ let n = r.nextNode();
541
541
  for (; n; ) {
542
- for (const i of Array.from(n.attributes)) {
543
- const l = i.name.match(Te);
542
+ for (const o of Array.from(n.attributes)) {
543
+ const l = o.name.match(xe);
544
544
  if (l) {
545
- const r = l[1].toLowerCase(), s = i.value;
545
+ const i = l[1].toLowerCase(), s = o.value;
546
546
  if (s) {
547
547
  const c = e[s];
548
- typeof c == "function" && (n.removeAttribute(i.name), n.addEventListener(r, c));
548
+ typeof c == "function" && (n.removeAttribute(o.name), n.addEventListener(i, c));
549
549
  }
550
550
  }
551
551
  }
552
- n = o.nextNode();
552
+ n = r.nextNode();
553
553
  }
554
554
  }
555
- function ct(e, t) {
556
- const o = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT);
557
- let n = o.nextNode();
555
+ function lt(e, t) {
556
+ const r = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT);
557
+ let n = r.nextNode();
558
558
  for (; n; ) {
559
- for (const i of Array.from(n.attributes)) {
560
- const l = i.name.match(Te);
559
+ for (const o of Array.from(n.attributes)) {
560
+ const l = o.name.match(xe);
561
561
  if (l) {
562
- const r = l[1].toLowerCase(), s = i.value;
562
+ const i = l[1].toLowerCase(), s = o.value;
563
563
  if (s) {
564
564
  const c = e[s];
565
- typeof c == "function" && (n.removeAttribute(i.name), n.addEventListener(r, c));
565
+ typeof c == "function" && (n.removeAttribute(o.name), n.addEventListener(i, c));
566
566
  }
567
567
  }
568
568
  }
569
- n = o.nextNode();
569
+ n = r.nextNode();
570
570
  }
571
571
  }
572
- function at(e, t, o, n, i) {
573
- if (!Array.isArray(o)) return () => {
572
+ function ft(e, t, r, n, o) {
573
+ if (!Array.isArray(r)) return () => {
574
574
  };
575
575
  const l = [];
576
- return o.forEach(([r, s, c]) => {
577
- if (typeof r != "string" || typeof c != "function") {
578
- S.error("Provided handler is not a function", c);
576
+ return r.forEach(([i, s, c]) => {
577
+ if (typeof i != "string" || typeof c != "function") {
578
+ N.error("Provided handler is not a function", c);
579
579
  return;
580
580
  }
581
581
  let a = [];
@@ -583,208 +583,208 @@ function at(e, t, o, n, i) {
583
583
  a = [window];
584
584
  else if (typeof s == "string")
585
585
  if (s.startsWith("$refs.")) {
586
- const [u, ...d] = s.slice(6).split(" "), v = i[u];
586
+ const [u, ...d] = s.slice(6).split(" "), v = o[u];
587
587
  v && (a = d.length ? Array.from(v.querySelectorAll(d.join(" "))) : [v]);
588
588
  } else
589
589
  a = Array.from(n.querySelectorAll(s));
590
590
  else if (s instanceof Element || s instanceof Window)
591
591
  a = [s];
592
592
  else if (typeof s == "object" && s && "ref" in s) {
593
- const { ref: u, selector: d } = s, v = i[u];
593
+ const { ref: u, selector: d } = s, v = o[u];
594
594
  v && (a = d ? Array.from(v.querySelectorAll(d)) : [v]);
595
595
  }
596
596
  for (const u of a) {
597
- const d = Y(c, t);
598
- u.addEventListener(r, d), l.push({ target: u, type: r, handler: d });
597
+ const d = Q(c, t);
598
+ u.addEventListener(i, d), l.push({ target: u, type: i, handler: d });
599
599
  }
600
600
  }), () => {
601
- for (const { target: r, type: s, handler: c } of l)
602
- r.removeEventListener(s, c);
601
+ for (const { target: i, type: s, handler: c } of l)
602
+ i.removeEventListener(s, c);
603
603
  l.length = 0;
604
604
  };
605
605
  }
606
- const V = /* @__PURE__ */ new WeakMap();
607
- let ee;
608
- function lt() {
606
+ const j = /* @__PURE__ */ new WeakMap();
607
+ let ne;
608
+ function ut() {
609
609
  if (typeof EventTarget > "u") return;
610
610
  const e = globalThis;
611
611
  if (e.__koppajsEventTrackingPatched) return;
612
612
  e.__koppajsEventTrackingPatched = !0;
613
- const t = EventTarget.prototype.addEventListener, o = EventTarget.prototype.removeEventListener;
614
- EventTarget.prototype.addEventListener = function(n, i, l) {
615
- return V.has(this) || V.set(this, /* @__PURE__ */ new Set()), V.get(this).add({ type: n, listener: i, options: l }), t.call(this, n, i, l);
616
- }, EventTarget.prototype.removeEventListener = function(n, i, l) {
617
- const r = V.get(this);
618
- if (r) {
619
- for (const s of r)
620
- if (s.type === n && s.listener === i) {
621
- r.delete(s);
613
+ const t = EventTarget.prototype.addEventListener, r = EventTarget.prototype.removeEventListener;
614
+ EventTarget.prototype.addEventListener = function(n, o, l) {
615
+ return j.has(this) || j.set(this, /* @__PURE__ */ new Set()), j.get(this).add({ type: n, listener: o, options: l }), t.call(this, n, o, l);
616
+ }, EventTarget.prototype.removeEventListener = function(n, o, l) {
617
+ const i = j.get(this);
618
+ if (i) {
619
+ for (const s of i)
620
+ if (s.type === n && s.listener === o) {
621
+ i.delete(s);
622
622
  break;
623
623
  }
624
- r.size === 0 && V.delete(this);
624
+ i.size === 0 && j.delete(this);
625
625
  }
626
- return o.call(this, n, i, l);
626
+ return r.call(this, n, o, l);
627
627
  };
628
628
  }
629
- function ft(e) {
630
- const t = V.get(e);
629
+ function dt(e) {
630
+ const t = j.get(e);
631
631
  if (t) {
632
- for (const { type: o, listener: n, options: i } of t)
633
- e.removeEventListener(o, n, i);
634
- V.delete(e);
632
+ for (const { type: r, listener: n, options: o } of t)
633
+ e.removeEventListener(r, n, o);
634
+ j.delete(e);
635
635
  }
636
636
  }
637
- function Se(e) {
637
+ function Pe(e) {
638
638
  if (typeof document > "u" || typeof NodeFilter > "u" || typeof Element > "u")
639
639
  return;
640
640
  const t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT);
641
- let o = e instanceof Element ? e : null;
642
- for (; o; )
643
- V.has(o) && ft(o), o = t.nextNode();
641
+ let r = e instanceof Element ? e : null;
642
+ for (; r; )
643
+ j.has(r) && dt(r), r = t.nextNode();
644
644
  }
645
- function ut() {
646
- ee || typeof MutationObserver > "u" || typeof document > "u" || document.body && (ee = new MutationObserver((e) => {
645
+ function ht() {
646
+ ne || typeof MutationObserver > "u" || typeof document > "u" || document.body && (ne = new MutationObserver((e) => {
647
647
  for (const t of e)
648
- t.removedNodes.forEach((o) => {
649
- o.nodeType === Node.ELEMENT_NODE && Se(o);
648
+ t.removedNodes.forEach((r) => {
649
+ r.nodeType !== Node.ELEMENT_NODE || r.isConnected || Pe(r);
650
650
  });
651
- }), ee.observe(document.body, { childList: !0, subtree: !0 }));
651
+ }), ne.observe(document.body, { childList: !0, subtree: !0 }));
652
652
  }
653
- const xe = /* @__PURE__ */ new WeakMap(), Me = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap();
654
- let dt = 0;
655
- const H = () => `slot-${++dt}`, W = (e) => typeof e == "object" && e !== null, te = (e) => typeof e == "symbol" ? e.toString() : String(e), ht = (e) => {
656
- const t = xe.get(e);
657
- return t && W(t) ? t : void 0;
653
+ const ke = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap();
654
+ let pt = 0;
655
+ const B = () => `slot-${++pt}`, L = (e) => typeof e == "object" && e !== null, re = (e) => typeof e == "symbol" ? e.toString() : String(e), mt = (e) => {
656
+ const t = ke.get(e);
657
+ return t && L(t) ? t : void 0;
658
658
  };
659
659
  function Oe(e) {
660
- const t = Me.get(e);
660
+ const t = Re.get(e);
661
661
  return t || e;
662
662
  }
663
- const F = (e) => W(e) ? Reflect.get(e, ge) === !0 : !1;
664
- function pt(e) {
665
- const t = F(e) ? Oe(e) : e;
666
- return X.get(t);
663
+ const W = (e) => L(e) ? Reflect.get(e, Ee) === !0 : !1;
664
+ function yt(e) {
665
+ const t = W(e) ? Oe(e) : e;
666
+ return G.get(t);
667
667
  }
668
- const mt = (e) => e !== null && (typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "function" || typeof e > "u"), K = (e) => {
669
- let t = X.get(e);
670
- return t || (t = e.map(() => H()), X.set(e, t)), t;
671
- }, he = (e) => {
672
- const t = X.get(e);
668
+ const gt = (e) => e !== null && (typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "function" || typeof e > "u"), Y = (e) => {
669
+ let t = G.get(e);
670
+ return t || (t = e.map(() => B()), G.set(e, t)), t;
671
+ }, pe = (e) => {
672
+ const t = G.get(e);
673
673
  if (t && t.length !== e.length)
674
674
  throw new Error(
675
675
  `Slot sidecar invariant violation: slotIds length (${t.length}) does not match array length (${e.length})`
676
676
  );
677
677
  };
678
- function yt(e) {
679
- const t = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new WeakMap();
680
- let n = 0, i = /* @__PURE__ */ new Set();
681
- const l = /* @__PURE__ */ new Map(), r = (f, y) => !!(f === y || f.startsWith(y + ".")), s = (f, y) => {
682
- const b = o.get(f) ?? "";
683
- return b ? `${b}.${y}` : y;
678
+ function bt(e) {
679
+ const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new WeakMap();
680
+ let n = 0, o = /* @__PURE__ */ new Set();
681
+ const l = /* @__PURE__ */ new Map(), i = (f, h) => !!(f === h || f.startsWith(h + ".")), s = (f, h) => {
682
+ const b = r.get(f) ?? "";
683
+ return b ? `${b}.${h}` : h;
684
684
  };
685
685
  let c = !1;
686
686
  const a = (f) => {
687
- i.add(f), n++, c || (c = !0, queueMicrotask(() => {
688
- c = !1, t.forEach((y) => {
687
+ o.add(f), n++, c || (c = !0, queueMicrotask(() => {
688
+ c = !1, t.forEach((h) => {
689
689
  try {
690
- y();
690
+ h();
691
691
  } catch (b) {
692
692
  console.error("Observer error:", b);
693
693
  }
694
694
  });
695
695
  }));
696
- }, u = (f, y, b) => {
697
- if (f === y) return;
698
- let w = f.length !== y.length;
699
- if (!w) {
700
- for (let h = 0; h < f.length; h++)
701
- if (f[h] !== y[h]) {
702
- w = !0;
696
+ }, u = (f, h, b) => {
697
+ if (f === h) return;
698
+ let _ = f.length !== h.length;
699
+ if (!_) {
700
+ for (let p = 0; p < f.length; p++)
701
+ if (f[p] !== h[p]) {
702
+ _ = !0;
703
703
  break;
704
704
  }
705
705
  }
706
- f.splice(0, f.length, ...y), w && a(b);
707
- }, d = (f, y, b) => {
708
- const w = new Set(f), h = new Set(y);
709
- let m = !1;
710
- for (const E of w)
711
- if (!h.has(E)) {
712
- m = !0;
706
+ f.splice(0, f.length, ...h), _ && a(b);
707
+ }, d = (f, h, b) => {
708
+ const _ = new Set(f), p = new Set(h);
709
+ let y = !1;
710
+ for (const E of _)
711
+ if (!p.has(E)) {
712
+ y = !0;
713
713
  break;
714
714
  }
715
- if (!m) {
716
- for (const E of h)
717
- if (!w.has(E)) {
718
- m = !0;
715
+ if (!y) {
716
+ for (const E of p)
717
+ if (!_.has(E)) {
718
+ y = !0;
719
719
  break;
720
720
  }
721
721
  }
722
- m && (f.splice(0, f.length, ...y), a(b));
723
- }, v = (f, y, b) => {
724
- const w = new Set(f), h = new Set(y);
725
- f.length !== y.length || [...w].some((E) => !h.has(E)) || [...h].some((E) => !w.has(E)) ? d(f, y, b) : u(f, y, b);
726
- }, x = (f, y, b) => {
727
- if (f === y) return !1;
728
- let w = !1;
729
- for (const h of Object.keys(f))
730
- h in y || (w = !0, Reflect.deleteProperty(f, h));
731
- for (const h of Object.keys(y)) {
732
- const m = f[h], E = y[h];
733
- m !== E && (W(m) && F(m) && W(E) && !F(E) ? (x(
734
- m,
722
+ y && (f.splice(0, f.length, ...h), a(b));
723
+ }, v = (f, h, b) => {
724
+ const _ = new Set(f), p = new Set(h);
725
+ f.length !== h.length || [..._].some((E) => !p.has(E)) || [...p].some((E) => !_.has(E)) ? d(f, h, b) : u(f, h, b);
726
+ }, A = (f, h, b) => {
727
+ if (f === h) return !1;
728
+ let _ = !1;
729
+ for (const p of Object.keys(f))
730
+ p in h || (_ = !0, Reflect.deleteProperty(f, p));
731
+ for (const p of Object.keys(h)) {
732
+ const y = f[p], E = h[p];
733
+ y !== E && (L(y) && W(y) && L(E) && !W(E) ? (A(
734
+ y,
735
735
  E
736
- ) && (w = !0), m !== E && (w = !0, Reflect.set(f, h, E))) : (w = !0, Reflect.set(f, h, E)));
736
+ ) && (_ = !0), y !== E && (_ = !0, Reflect.set(f, p, E))) : (_ = !0, Reflect.set(f, p, E)));
737
737
  }
738
- return w;
739
- }, M = (f, y, b) => {
740
- const w = K(f);
741
- switch (y) {
738
+ return _;
739
+ }, R = (f, h, b) => {
740
+ const _ = Y(f);
741
+ switch (h) {
742
742
  case "push": {
743
- const h = Array.from({ length: b.length }, () => H());
744
- w.push(...h);
743
+ const p = Array.from({ length: b.length }, () => B());
744
+ _.push(...p);
745
745
  break;
746
746
  }
747
747
  case "pop": {
748
- w.pop();
748
+ _.pop();
749
749
  break;
750
750
  }
751
751
  case "shift": {
752
- w.shift();
752
+ _.shift();
753
753
  break;
754
754
  }
755
755
  case "unshift": {
756
- const h = Array.from({ length: b.length }, () => H());
757
- w.unshift(...h);
756
+ const p = Array.from({ length: b.length }, () => B());
757
+ _.unshift(...p);
758
758
  break;
759
759
  }
760
760
  case "splice": {
761
- const h = b[0] ?? 0, m = b[1] !== void 0 ? b[1] : f.length - h, E = b.slice(2), T = Array.from(
761
+ const p = b[0] ?? 0, y = b[1] !== void 0 ? b[1] : f.length - p, E = b.slice(2), S = Array.from(
762
762
  { length: E.length },
763
- () => H()
763
+ () => B()
764
764
  );
765
- w.splice(h, m, ...T);
765
+ _.splice(p, y, ...S);
766
766
  break;
767
767
  }
768
768
  case "reverse": {
769
- w.reverse();
769
+ _.reverse();
770
770
  break;
771
771
  }
772
772
  }
773
- he(f);
774
- }, N = (f, y = "") => {
773
+ pe(f);
774
+ }, w = (f, h = "") => {
775
775
  if (f instanceof Node || f instanceof Window || f instanceof Document)
776
776
  return f;
777
- const b = ht(f);
777
+ const b = mt(f);
778
778
  if (b) return b;
779
- y && o.set(f, y), Array.isArray(f) && K(f);
780
- const w = new Proxy(f, {
781
- get: (h, m, E) => {
782
- if (m === ge) return !0;
783
- if (m === "toJSON")
779
+ h && r.set(f, h), Array.isArray(f) && Y(f);
780
+ const _ = new Proxy(f, {
781
+ get: (p, y, E) => {
782
+ if (y === Ee) return !0;
783
+ if (y === "toJSON")
784
784
  return function() {
785
- return Oe(h);
785
+ return Oe(p);
786
786
  };
787
- if (Array.isArray(h) && typeof m == "string" && [
787
+ if (Array.isArray(p) && typeof y == "string" && [
788
788
  "push",
789
789
  "pop",
790
790
  "shift",
@@ -792,86 +792,86 @@ function yt(e) {
792
792
  "splice",
793
793
  "reverse",
794
794
  "sort"
795
- ].includes(m)) {
796
- const R = h[m];
797
- if (typeof R == "function")
795
+ ].includes(y)) {
796
+ const k = p[y];
797
+ if (typeof k == "function")
798
798
  return function(...D) {
799
- if (m === "sort") {
800
- const k = K(h), $ = h.map((p, _) => ({
801
- el: p,
802
- slotId: k[_] || H()
803
- })), G = R.apply(this, D), g = /* @__PURE__ */ new Map();
804
- for (let p = 0; p < $.length; p++) {
805
- const _ = $[p].el;
806
- let O = g.get(_);
807
- O || (O = [], g.set(_, O)), O.push(p);
799
+ if (y === "sort") {
800
+ const O = Y(p), $ = p.map((m, g) => ({
801
+ el: m,
802
+ slotId: O[g] || B()
803
+ })), V = k.apply(this, D), K = /* @__PURE__ */ new Map();
804
+ for (let m = 0; m < $.length; m++) {
805
+ const g = $[m].el;
806
+ let C = K.get(g);
807
+ C || (C = [], K.set(g, C)), C.push(m);
808
808
  }
809
- for (let p = 0; p < h.length; p++) {
810
- const _ = h[p], O = g.get(_);
811
- if (O && O.length > 0) {
812
- const L = O.shift();
813
- k[p] = $[L].slotId;
809
+ for (let m = 0; m < p.length; m++) {
810
+ const g = p[m], C = K.get(g);
811
+ if (C && C.length > 0) {
812
+ const M = C.shift();
813
+ O[m] = $[M].slotId;
814
814
  } else
815
- k[p] = H();
815
+ O[m] = B();
816
816
  }
817
- return he(h), G;
817
+ return pe(p), V;
818
818
  } else {
819
- const k = R.apply(this, D);
820
- return M(h, m, D), k;
819
+ const O = k.apply(this, D);
820
+ return R(p, y, D), O;
821
821
  }
822
822
  };
823
823
  }
824
- const T = Reflect.get(h, m, E), A = Array.isArray(h) && typeof m == "string" && /^\d+$/.test(m);
825
- if (W(T) && !F(T) && !A && (Array.isArray(T) || !Array.isArray(h))) {
826
- const I = te(m), R = s(h, I);
827
- return N(T, R);
824
+ const S = Reflect.get(p, y, E), x = Array.isArray(p) && typeof y == "string" && /^\d+$/.test(y);
825
+ if (L(S) && !W(S) && !x && (Array.isArray(S) || !Array.isArray(p))) {
826
+ const T = re(y), k = s(p, T);
827
+ return w(S, k);
828
828
  }
829
- return T;
829
+ return S;
830
830
  },
831
- set: (h, m, E, T) => {
832
- const A = Reflect.get(h, m, T);
833
- if (A === E) return !0;
834
- const I = te(m), R = s(h, I);
835
- if (Array.isArray(h) && typeof m == "string" && /^\d+$/.test(m)) {
836
- const k = parseInt(m, 10);
837
- if (k >= 0 && k < h.length) {
838
- const $ = Reflect.set(h, m, E, T);
839
- return a(R), $;
831
+ set: (p, y, E, S) => {
832
+ const x = Reflect.get(p, y, S);
833
+ if (x === E) return !0;
834
+ const T = re(y), k = s(p, T);
835
+ if (Array.isArray(p) && typeof y == "string" && /^\d+$/.test(y)) {
836
+ const O = parseInt(y, 10);
837
+ if (O >= 0 && O < p.length) {
838
+ const $ = Reflect.set(p, y, E, S);
839
+ return a(k), $;
840
840
  }
841
841
  }
842
- if (Array.isArray(A) && !mt(E) && Array.isArray(E)) {
843
- v(A, E, R);
844
- const k = A.map(() => H());
845
- return X.set(A, k), !0;
842
+ if (Array.isArray(x) && !gt(E) && Array.isArray(E)) {
843
+ v(x, E, k);
844
+ const O = x.map(() => B());
845
+ return G.set(x, O), !0;
846
846
  }
847
- if (W(A) && F(A) && W(E) && !F(E)) {
848
- if (x(
849
- A,
847
+ if (L(x) && W(x) && L(E) && !W(E)) {
848
+ if (A(
849
+ x,
850
850
  E
851
851
  )) {
852
852
  let $ = E;
853
- W($) && !F($) && ($ = N($, R)), Reflect.set(h, m, $, T), a(R);
853
+ L($) && !W($) && ($ = w($, k)), Reflect.set(p, y, $, S), a(k);
854
854
  }
855
855
  return !0;
856
856
  }
857
- const D = Reflect.set(h, m, E, T);
858
- if (W(E) && !F(E)) {
859
- const k = N(E, R);
860
- Reflect.set(h, m, k, T), Array.isArray(E) && K(E);
857
+ const D = Reflect.set(p, y, E, S);
858
+ if (L(E) && !W(E)) {
859
+ const O = w(E, k);
860
+ Reflect.set(p, y, O, S), Array.isArray(E) && Y(E);
861
861
  }
862
- return a(R), D;
862
+ return a(k), D;
863
863
  },
864
- deleteProperty: (h, m) => {
865
- if (m === "changedPaths")
866
- return Reflect.deleteProperty(h, m);
867
- const E = te(m), T = s(h, E), A = Reflect.get(h, m), I = Reflect.deleteProperty(h, m);
868
- return I && A !== void 0 && a(T), I;
864
+ deleteProperty: (p, y) => {
865
+ if (y === "changedPaths")
866
+ return Reflect.deleteProperty(p, y);
867
+ const E = re(y), S = s(p, E), x = Reflect.get(p, y), T = Reflect.deleteProperty(p, y);
868
+ return T && x !== void 0 && a(S), T;
869
869
  }
870
870
  });
871
- return xe.set(f, w), Me.set(w, f), w;
871
+ return ke.set(f, _), Re.set(_, f), _;
872
872
  };
873
873
  return {
874
- state: N(e),
874
+ state: w(e),
875
875
  /**
876
876
  * Registers a watcher for a path prefix.
877
877
  * The callback is called at most once per flush cycle with the subset of
@@ -884,15 +884,15 @@ function yt(e) {
884
884
  * @param cb - Callback receiving { changedPaths: Set<string> } with matching paths
885
885
  * @returns A cleanup function stop() that unregisters this watcher (idempotent)
886
886
  */
887
- watch(f, y) {
887
+ watch(f, h) {
888
888
  let b = l.get(f);
889
- b || (b = /* @__PURE__ */ new Set(), l.set(f, b)), b.add(y);
890
- let w = !1;
889
+ b || (b = /* @__PURE__ */ new Set(), l.set(f, b)), b.add(h);
890
+ let _ = !1;
891
891
  return () => {
892
- if (w) return;
893
- w = !0;
894
- const h = l.get(f);
895
- h && (h.delete(y), h.size === 0 && l.delete(f));
892
+ if (_) return;
893
+ _ = !0;
894
+ const p = l.get(f);
895
+ p && (p.delete(h), p.size === 0 && l.delete(f));
896
896
  };
897
897
  },
898
898
  addObserver(f) {
@@ -911,9 +911,9 @@ function yt(e) {
911
911
  * @returns True if at least one pending change matches a prefix
912
912
  */
913
913
  hasPendingChangesFor(f) {
914
- for (const y of i)
914
+ for (const h of o)
915
915
  for (const b of f)
916
- if (y === b || y.startsWith(b + ".")) return !0;
916
+ if (h === b || h.startsWith(b + ".")) return !0;
917
917
  return !1;
918
918
  },
919
919
  /**
@@ -924,50 +924,50 @@ function yt(e) {
924
924
  * @returns A copy of all changed paths since the last flush
925
925
  */
926
926
  flushChanges() {
927
- const f = new Set(i);
927
+ const f = new Set(o);
928
928
  if (f.size > 0 && l.size > 0) {
929
- const y = /* @__PURE__ */ new Map();
930
- for (const [b, w] of l) {
931
- const h = /* @__PURE__ */ new Set();
932
- for (const m of f)
933
- r(m, b) && h.add(m);
934
- if (h.size > 0)
935
- for (const m of w) {
936
- const E = y.get(m);
929
+ const h = /* @__PURE__ */ new Map();
930
+ for (const [b, _] of l) {
931
+ const p = /* @__PURE__ */ new Set();
932
+ for (const y of f)
933
+ i(y, b) && p.add(y);
934
+ if (p.size > 0)
935
+ for (const y of _) {
936
+ const E = h.get(y);
937
937
  if (E)
938
- for (const T of h)
939
- E.add(T);
938
+ for (const S of p)
939
+ E.add(S);
940
940
  else
941
- y.set(m, new Set(h));
941
+ h.set(y, new Set(p));
942
942
  }
943
943
  }
944
- for (const [b, w] of y)
945
- b({ changedPaths: w });
944
+ for (const [b, _] of h)
945
+ b({ changedPaths: _ });
946
946
  }
947
- return i = /* @__PURE__ */ new Set(), f;
947
+ return o = /* @__PURE__ */ new Set(), f;
948
948
  }
949
949
  };
950
950
  }
951
- const ne = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
952
- function gt(e) {
951
+ const oe = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
952
+ function Et(e) {
953
953
  const t = e.trim();
954
954
  if (t.startsWith("[") && t.endsWith("]")) {
955
- const n = t.slice(1, -1).split(",").map((r) => r.trim());
955
+ const n = t.slice(1, -1).split(",").map((i) => i.trim());
956
956
  if (n.length !== 2)
957
957
  throw new Error("Invalid loop binding: expected <id> or [<id>, <id>]");
958
- const [i, l] = n;
959
- if (!ne.test(i) || !ne.test(l))
958
+ const [o, l] = n;
959
+ if (!oe.test(o) || !oe.test(l))
960
960
  throw new Error("Invalid loop binding: expected <id> or [<id>, <id>]");
961
- return { type: "tuple", keyVar: i, itemVar: l };
961
+ return { type: "tuple", keyVar: o, itemVar: l };
962
962
  }
963
- if (!ne.test(t))
963
+ if (!oe.test(t))
964
964
  throw new Error("Invalid loop binding: expected <id> or [<id>, <id>]");
965
965
  return { type: "single", itemVar: t };
966
966
  }
967
- function bt(e) {
967
+ function vt(e) {
968
968
  const t = {
969
- acceptNode(o) {
970
- return o.nodeType === Node.ELEMENT_NODE || o.nodeType === Node.TEXT_NODE && /\{\{(.+?)\}\}/g.test(o.nodeValue || "") ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
969
+ acceptNode(r) {
970
+ return r.nodeType === Node.ELEMENT_NODE || r.nodeType === Node.TEXT_NODE && /\{\{(.+?)\}\}/g.test(r.nodeValue || "") ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
971
971
  }
972
972
  };
973
973
  return document.createTreeWalker(
@@ -976,80 +976,80 @@ function bt(e) {
976
976
  t
977
977
  );
978
978
  }
979
- function Et(e) {
979
+ function wt(e) {
980
980
  const t = e.currentNode;
981
981
  return t?.nextSibling ? e.currentNode = t.nextSibling : e.nextNode();
982
982
  }
983
- function vt(e, t) {
984
- let o = t.nextSibling;
985
- if (!o) {
983
+ function _t(e, t) {
984
+ let r = t.nextSibling;
985
+ if (!r) {
986
986
  let n = t.parentNode;
987
987
  for (; n && n !== e.root; ) {
988
988
  if (n.nextSibling) {
989
- o = n.nextSibling;
989
+ r = n.nextSibling;
990
990
  break;
991
991
  }
992
992
  n = n.parentNode;
993
993
  }
994
994
  }
995
- return o ? (e.currentNode = o, o) : null;
995
+ return r ? (e.currentNode = r, r) : null;
996
996
  }
997
- function wt(e) {
997
+ function Ct(e) {
998
998
  return e == null || e === !0 || e === !1 ? "" : String(e);
999
999
  }
1000
- function ke(e, t) {
1001
- return e.replace(/\{\{(.+?)\}\}/g, (o, n) => {
1002
- const i = B(n.trim(), t);
1003
- return wt(i);
1000
+ function $e(e, t) {
1001
+ return e.replace(/\{\{(.+?)\}\}/g, (r, n) => {
1002
+ const o = q(n.trim(), t);
1003
+ return Ct(o);
1004
1004
  });
1005
1005
  }
1006
- async function Nt(e, t, o) {
1006
+ async function Nt(e, t, r) {
1007
1007
  const n = e.getAttribute("loop");
1008
1008
  if (!n) return;
1009
1009
  e.removeAttribute("loop");
1010
- const i = e.getAttribute("if");
1011
- i && e.removeAttribute("if");
1010
+ const o = e.getAttribute("if");
1011
+ o && e.removeAttribute("if");
1012
1012
  const l = n.match(/^(.+?)\s+in\s+(.+)$/);
1013
1013
  if (!l)
1014
1014
  throw new Error("Invalid loop binding: expected <id> or [<id>, <id>]");
1015
- const [, r, s] = l, c = gt(r), a = B(s.trim(), t);
1015
+ const [, i, s] = l, c = Et(i), a = q(s.trim(), t);
1016
1016
  if (a == null) {
1017
1017
  e.remove();
1018
1018
  return;
1019
1019
  }
1020
1020
  if (typeof a != "object") {
1021
- S.error("State source is not iterable", { collectionExp: s, raw: a });
1021
+ N.error("State source is not iterable", { collectionExp: s, raw: a });
1022
1022
  return;
1023
1023
  }
1024
- const u = Array.isArray(a), d = u ? a.map((f, y) => [String(y), f]) : Object.entries(a), v = d.length, x = document.createDocumentFragment(), M = u ? pt(a) : void 0, N = { ...t };
1025
- let C = 0;
1026
- for (const [f, y] of d) {
1027
- if (N.index = C, N.key = f, N.isFirst = C === 0, N.isLast = C === v - 1, N.isEven = C % 2 === 0, N.isOdd = C % 2 !== 0, c.type === "single" || (N[c.keyVar] = f), N[c.itemVar] = y, i && !B(i, N)) {
1028
- C++;
1024
+ const u = Array.isArray(a), d = u ? a.map((f, h) => [String(h), f]) : Object.entries(a), v = d.length, A = document.createDocumentFragment(), R = u ? yt(a) : void 0, w = { ...t };
1025
+ let P = 0;
1026
+ for (const [f, h] of d) {
1027
+ if (w.index = P, w.key = f, w.isFirst = P === 0, w.isLast = P === v - 1, w.isEven = P % 2 === 0, w.isOdd = P % 2 !== 0, c.type === "single" || (w[c.keyVar] = f), w[c.itemVar] = h, o && !q(o, w)) {
1028
+ P++;
1029
1029
  continue;
1030
1030
  }
1031
1031
  const b = e.cloneNode(!0);
1032
- u && b instanceof HTMLElement && M && M[C] !== void 0 && ot(b, M[C]), b instanceof HTMLElement && (await $e(b, N, o), x.appendChild(b)), C++;
1032
+ u && b instanceof HTMLElement && R && R[P] !== void 0 && it(b, R[P]), b instanceof HTMLElement && (await Me(b, w, r), A.appendChild(b)), P++;
1033
1033
  }
1034
- x.childNodes.length > 0 && e.parentNode ? e.parentNode.replaceChild(x, e) : e.remove();
1034
+ A.childNodes.length > 0 && e.parentNode ? e.parentNode.replaceChild(A, e) : e.remove();
1035
1035
  }
1036
- function _t(e, t, o) {
1037
- const n = e.parentNode, i = () => {
1036
+ function At(e, t, r) {
1037
+ const n = e.parentNode, o = () => {
1038
1038
  if (n)
1039
- return o.get(n);
1039
+ return r.get(n);
1040
1040
  }, l = (a) => {
1041
- n && o.set(n, a);
1042
- }, r = () => {
1043
- n && o.delete(n);
1041
+ n && r.set(n, a);
1042
+ }, i = () => {
1043
+ n && r.delete(n);
1044
1044
  }, s = e.getAttribute("if");
1045
1045
  if (s !== null) {
1046
- const a = !!B(s, t);
1046
+ const a = !!q(s, t);
1047
1047
  l({ hasHead: !0, resolved: a }), a ? e.removeAttribute("if") : e.remove();
1048
1048
  return;
1049
1049
  }
1050
1050
  const c = e.getAttribute("else-if");
1051
1051
  if (c !== null) {
1052
- const a = i();
1052
+ const a = o();
1053
1053
  if (!a?.hasHead) {
1054
1054
  e.remove();
1055
1055
  return;
@@ -1058,79 +1058,79 @@ function _t(e, t, o) {
1058
1058
  e.remove();
1059
1059
  return;
1060
1060
  }
1061
- const u = !!B(c, t);
1061
+ const u = !!q(c, t);
1062
1062
  l({ hasHead: !0, resolved: u }), u ? e.removeAttribute("else-if") : e.remove();
1063
1063
  return;
1064
1064
  }
1065
1065
  if (e.hasAttribute("else")) {
1066
- const a = i();
1066
+ const a = o();
1067
1067
  if (!a?.hasHead) {
1068
1068
  e.remove();
1069
1069
  return;
1070
1070
  }
1071
- a.resolved ? e.remove() : e.removeAttribute("else"), r();
1071
+ a.resolved ? e.remove() : e.removeAttribute("else"), i();
1072
1072
  return;
1073
1073
  }
1074
1074
  }
1075
- async function Ct(e, t, o = 50) {
1075
+ async function Tt(e, t, r = 50) {
1076
1076
  const n = /* @__PURE__ */ new WeakMap();
1077
- for (let i = 0; i < e.length; i += o) {
1078
- const l = e.slice(i, i + o);
1079
- for (const { node: r, state: s } of l) {
1080
- if (r instanceof HTMLElement) {
1081
- if (r.hasAttribute("loop")) {
1082
- await Nt(r, s, t);
1077
+ for (let o = 0; o < e.length; o += r) {
1078
+ const l = e.slice(o, o + r);
1079
+ for (const { node: i, state: s } of l) {
1080
+ if (i instanceof HTMLElement) {
1081
+ if (i.hasAttribute("loop")) {
1082
+ await Nt(i, s, t);
1083
1083
  continue;
1084
1084
  }
1085
- if (r.hasAttribute("if") || r.hasAttribute("else") || r.hasAttribute("else-if")) {
1086
- _t(r, s, n);
1085
+ if (i.hasAttribute("if") || i.hasAttribute("else") || i.hasAttribute("else-if")) {
1086
+ At(i, s, n);
1087
1087
  continue;
1088
1088
  }
1089
1089
  continue;
1090
1090
  }
1091
- const c = ke(r.nodeValue, s);
1092
- if (Fe(c)) {
1091
+ const c = $e(i.nodeValue, s);
1092
+ if (je(c)) {
1093
1093
  const a = document.createRange().createContextualFragment(c);
1094
- r.replaceWith(a);
1094
+ i.replaceWith(a);
1095
1095
  } else
1096
- r.nodeValue = c;
1096
+ i.nodeValue = c;
1097
1097
  }
1098
- i + o < e.length && await new Promise(requestAnimationFrame);
1098
+ o + r < e.length && await new Promise(requestAnimationFrame);
1099
1099
  }
1100
1100
  }
1101
- async function $e(e, t, o) {
1101
+ async function Me(e, t, r) {
1102
1102
  try {
1103
- const n = bt(e), i = /* @__PURE__ */ new Set(), l = [];
1104
- let r = n.currentNode;
1105
- for (; r; ) {
1106
- if (i.has(r)) {
1107
- r = n.nextNode();
1103
+ const n = vt(e), o = /* @__PURE__ */ new Set(), l = [];
1104
+ let i = n.currentNode;
1105
+ for (; i; ) {
1106
+ if (o.has(i)) {
1107
+ i = n.nextNode();
1108
1108
  continue;
1109
1109
  }
1110
- if (i.add(r), r.nodeType === Node.ELEMENT_NODE && r instanceof HTMLElement) {
1111
- const s = r;
1110
+ if (o.add(i), i.nodeType === Node.ELEMENT_NODE && i instanceof HTMLElement) {
1111
+ const s = i;
1112
1112
  if (s.hasAttribute("loop")) {
1113
- l.push({ node: s, state: t }), r = vt(n, s);
1113
+ l.push({ node: s, state: t }), i = _t(n, s);
1114
1114
  continue;
1115
1115
  }
1116
1116
  (s.hasAttribute("if") || s.hasAttribute("else") || s.hasAttribute("else-if")) && l.push({ node: s, state: t });
1117
1117
  for (const c of Array.from(s.attributes)) {
1118
- if (c.name === "ref" && (o[c.value] = s), c.name.startsWith(":")) {
1118
+ if (c.name === "ref" && (r[c.value] = s), c.name.startsWith(":")) {
1119
1119
  const a = c.name.slice(1), u = c.value.trim();
1120
1120
  try {
1121
- const d = B(u, t);
1121
+ const d = q(u, t);
1122
1122
  if (a === "class" && typeof d == "object" && d !== null) {
1123
1123
  const v = [];
1124
- for (const [x, M] of Object.entries(d))
1125
- M && v.push(x);
1124
+ for (const [A, R] of Object.entries(d))
1125
+ R && v.push(A);
1126
1126
  if (v.length > 0) {
1127
- const x = s.getAttribute("class") || "", M = x ? `${x} ${v.join(" ")}` : v.join(" ");
1128
- s.setAttribute("class", M);
1127
+ const A = s.getAttribute("class") || "", R = A ? `${A} ${v.join(" ")}` : v.join(" ");
1128
+ s.setAttribute("class", R);
1129
1129
  }
1130
1130
  } else d != null && d !== !1 && (d === !0 ? s.setAttribute(a, "") : s.setAttribute(a, String(d)));
1131
1131
  s.removeAttribute(c.name);
1132
1132
  } catch (d) {
1133
- S.errorWithContext(
1133
+ N.errorWithContext(
1134
1134
  `Error evaluating dynamic attribute "${c.name}"`,
1135
1135
  { attributeName: c.name, expression: u },
1136
1136
  d
@@ -1140,10 +1140,10 @@ async function $e(e, t, o) {
1140
1140
  }
1141
1141
  if (c.value.includes("{{"))
1142
1142
  try {
1143
- let a = ke(c.value, t);
1143
+ let a = $e(c.value, t);
1144
1144
  c.name === "class" && (a = a.replace(/\s+/g, " ").trim()), a !== c.value && s.setAttribute(c.name, a);
1145
1145
  } catch (a) {
1146
- S.errorWithContext(
1146
+ N.errorWithContext(
1147
1147
  `Error replacing attribute "${c.name}"`,
1148
1148
  { attributeName: c.name },
1149
1149
  a
@@ -1151,11 +1151,11 @@ async function $e(e, t, o) {
1151
1151
  }
1152
1152
  }
1153
1153
  if (s.tagName.includes("-")) {
1154
- r = Et(n) || n.nextNode();
1154
+ i = wt(n) || n.nextNode();
1155
1155
  continue;
1156
1156
  }
1157
- } else if (r.nodeType === Node.TEXT_NODE && r instanceof Text) {
1158
- let s = r.parentElement, c = !1;
1157
+ } else if (i.nodeType === Node.TEXT_NODE && i instanceof Text) {
1158
+ let s = i.parentElement, c = !1;
1159
1159
  for (; s; ) {
1160
1160
  if (s.tagName.includes("-")) {
1161
1161
  c = !0;
@@ -1163,45 +1163,45 @@ async function $e(e, t, o) {
1163
1163
  }
1164
1164
  s = s.parentElement;
1165
1165
  }
1166
- c || l.push({ node: r, state: t });
1166
+ c || l.push({ node: i, state: t });
1167
1167
  }
1168
- r = n.nextNode();
1168
+ i = n.nextNode();
1169
1169
  }
1170
- await Ct(l, o);
1170
+ await Tt(l, r);
1171
1171
  } catch (n) {
1172
- throw S.errorWithContext("Error processing template", {}, n), n;
1172
+ throw N.errorWithContext("Error processing template", {}, n), n;
1173
1173
  }
1174
1174
  }
1175
- function At(e, t = {}) {
1175
+ function St(e, t = {}) {
1176
1176
  if (!Array.isArray(e) || e.length === 0)
1177
1177
  throw new Error("composeBySource: layers must be a non-empty array");
1178
1178
  if (e.some((s) => s == null || typeof s != "object"))
1179
1179
  throw new Error("composeBySource: all layers must be objects");
1180
- const { defaultWriteIndex: o = e.length - 1, includePrototype: n = !1 } = t, i = o >= 0 && o < e.length && Number.isInteger(o) ? o : e.length - 1;
1181
- o !== i && S.warnWithContext(
1182
- `Invalid defaultWriteIndex ${o}, using ${i}`,
1183
- { defaultWriteIndex: o, validWriteIndex: i, layersLength: e.length }
1180
+ const { defaultWriteIndex: r = e.length - 1, includePrototype: n = !1 } = t, o = r >= 0 && r < e.length && Number.isInteger(r) ? r : e.length - 1;
1181
+ r !== o && N.warnWithContext(
1182
+ `Invalid defaultWriteIndex ${r}, using ${o}`,
1183
+ { defaultWriteIndex: r, validWriteIndex: o, layersLength: e.length }
1184
1184
  );
1185
- const l = (s, c) => n ? c in s : Object.prototype.hasOwnProperty.call(s, c), r = (s) => {
1185
+ const l = (s, c) => n ? c in s : Object.prototype.hasOwnProperty.call(s, c), i = (s) => {
1186
1186
  for (let c = 0; c < e.length; c++)
1187
1187
  if (l(e[c], s)) return c;
1188
1188
  return -1;
1189
1189
  };
1190
- return new Proxy(e[i], {
1190
+ return new Proxy(e[o], {
1191
1191
  get(s, c) {
1192
- const a = r(c);
1192
+ const a = i(c);
1193
1193
  if (a !== -1) return e[a][c];
1194
1194
  },
1195
1195
  set(s, c, a) {
1196
- const u = r(c), d = u !== -1 ? u : i;
1196
+ const u = i(c), d = u !== -1 ? u : o;
1197
1197
  return e[d][c] = a, !0;
1198
1198
  },
1199
1199
  deleteProperty(s, c) {
1200
- const a = r(c);
1200
+ const a = i(c);
1201
1201
  return a === -1 ? !0 : delete e[a][c];
1202
1202
  },
1203
1203
  has(s, c) {
1204
- return r(c) !== -1;
1204
+ return i(c) !== -1;
1205
1205
  },
1206
1206
  ownKeys() {
1207
1207
  const s = /* @__PURE__ */ new Set();
@@ -1219,43 +1219,43 @@ function At(e, t = {}) {
1219
1219
  }
1220
1220
  });
1221
1221
  }
1222
- function pe(e) {
1223
- const t = e.getRootNode(), o = e.parentElement ?? (t instanceof ShadowRoot ? t.host : void 0);
1224
- if (Je(o))
1225
- return o.instance;
1222
+ function me(e) {
1223
+ const t = e.getRootNode(), r = e.parentElement ?? (t instanceof ShadowRoot ? t.host : void 0);
1224
+ if (et(r))
1225
+ return r.instance;
1226
1226
  }
1227
- function Tt({
1227
+ function xt({
1228
1228
  container: e,
1229
1229
  host: t
1230
1230
  }) {
1231
- const o = Array.from(t.childNodes).filter(
1232
- (i) => i.nodeType === Node.ELEMENT_NODE || i.nodeType === Node.TEXT_NODE
1231
+ const r = Array.from(t.childNodes).filter(
1232
+ (o) => o.nodeType === Node.ELEMENT_NODE || o.nodeType === Node.TEXT_NODE
1233
1233
  ), n = {};
1234
- for (const i of o) {
1235
- const l = i instanceof HTMLElement && i.hasAttribute("slot") ? i.getAttribute("slot") : "default";
1236
- n[l] || (n[l] = []), n[l].push(i);
1234
+ for (const o of r) {
1235
+ const l = o instanceof HTMLElement && o.hasAttribute("slot") ? o.getAttribute("slot") : "default";
1236
+ n[l] || (n[l] = []), n[l].push(o);
1237
1237
  }
1238
- e.querySelectorAll("slot").forEach((i) => {
1239
- const l = i.getAttribute("name") || "default", r = n[l];
1240
- r && r.length > 0 && r.forEach((s) => {
1241
- i.parentNode.insertBefore(s, i);
1242
- }), i.remove();
1238
+ e.querySelectorAll("slot").forEach((o) => {
1239
+ const l = o.getAttribute("name") || "default", i = n[l];
1240
+ i && i.length > 0 && i.forEach((s) => {
1241
+ o.parentNode.insertBefore(s, o);
1242
+ }), o.remove();
1243
1243
  });
1244
1244
  }
1245
- function St(e, t, o) {
1246
- const n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), l = () => {
1247
- for (const a of Object.keys(o)) {
1248
- const u = n.get(o[a]);
1249
- u instanceof HTMLElement && (o[a] = u);
1245
+ function Pt(e, t, r) {
1246
+ const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), l = () => {
1247
+ for (const a of Object.keys(r)) {
1248
+ const u = n.get(r[a]);
1249
+ u instanceof HTMLElement && (r[a] = u);
1250
1250
  }
1251
1251
  };
1252
1252
  if (!e.querySelector("slot")) return { commit: () => {
1253
1253
  }, remapRefs: l };
1254
- const r = document.createElement("div"), s = (a) => {
1254
+ const i = document.createElement("div"), s = (a) => {
1255
1255
  const u = a.cloneNode(!1);
1256
1256
  if (n.set(u, a), !(a instanceof HTMLElement && a.tagName.includes("-")))
1257
1257
  for (const d of a.childNodes) u.appendChild(s(d));
1258
- return i.set(u, {
1258
+ return o.set(u, {
1259
1259
  attributes: new Map(
1260
1260
  a instanceof HTMLElement ? Array.from(a.attributes, (d) => [d.name, d.value]) : []
1261
1261
  ),
@@ -1263,20 +1263,20 @@ function St(e, t, o) {
1263
1263
  value: u.nodeValue
1264
1264
  }), u;
1265
1265
  };
1266
- for (const a of t.childNodes) r.appendChild(s(a));
1267
- return Tt({ container: e, host: r }), { commit: () => {
1266
+ for (const a of t.childNodes) i.appendChild(s(a));
1267
+ return xt({ container: e, host: i }), { commit: () => {
1268
1268
  const a = (u) => {
1269
- const d = n.get(u), v = i.get(u), x = Array.from(u.childNodes), M = x.map(a);
1269
+ const d = n.get(u), v = o.get(u), A = Array.from(u.childNodes), R = A.map(a);
1270
1270
  if (!d || !v)
1271
- return x.forEach((N, C) => {
1272
- M[C] !== N && N.replaceWith(M[C]);
1271
+ return A.forEach((w, P) => {
1272
+ R[P] !== w && w.replaceWith(R[P]);
1273
1273
  }), u;
1274
1274
  if (d instanceof HTMLElement && u instanceof HTMLElement) {
1275
- for (const N of v.attributes.keys())
1276
- u.hasAttribute(N) || d.removeAttribute(N);
1277
- for (const N of Array.from(u.attributes))
1278
- v.attributes.get(N.name) !== N.value && d.setAttribute(N.name, N.value);
1279
- !d.tagName.includes("-") && (x.length !== v.children.length || x.some((N, C) => N !== v.children[C])) && d.replaceChildren(...M);
1275
+ for (const w of v.attributes.keys())
1276
+ u.hasAttribute(w) || d.removeAttribute(w);
1277
+ for (const w of Array.from(u.attributes))
1278
+ v.attributes.get(w.name) !== w.value && d.setAttribute(w.name, w.value);
1279
+ !d.tagName.includes("-") && (A.length !== v.children.length || A.some((w, P) => w !== v.children[P])) && d.replaceChildren(...R);
1280
1280
  } else u.nodeValue !== v.value && (d.nodeValue = u.nodeValue);
1281
1281
  return d;
1282
1282
  };
@@ -1287,76 +1287,93 @@ function St(e, t, o) {
1287
1287
  l();
1288
1288
  }, remapRefs: l };
1289
1289
  }
1290
- function oe({
1290
+ function ye(e) {
1291
+ const t = ["opacity", "transition-property"], r = t.map((o) => ({
1292
+ name: o,
1293
+ value: e.style.getPropertyValue(o),
1294
+ priority: e.style.getPropertyPriority(o)
1295
+ }));
1296
+ e.style.setProperty("transition-property", "none", "important"), e.style.setProperty("opacity", "0", "important");
1297
+ const n = t.map(
1298
+ (o) => e.style.getPropertyPriority(o)
1299
+ );
1300
+ return () => {
1301
+ for (const [o, { name: l, value: i, priority: s }] of r.entries()) {
1302
+ const c = l === "opacity" ? "0" : "none";
1303
+ e.style.getPropertyValue(l) !== c || e.style.getPropertyPriority(l) !== n[o] || (i ? e.style.setProperty(l, i, s) : e.style.removeProperty(l));
1304
+ }
1305
+ };
1306
+ }
1307
+ function ie({
1291
1308
  propName: e,
1292
1309
  propValue: t,
1293
- props: o
1310
+ props: r
1294
1311
  }) {
1295
- const n = o[e], i = t ?? n?.default;
1312
+ const n = r[e], o = t ?? n?.default;
1296
1313
  if (!n) return !0;
1297
- const l = Ve(n.type), r = Array.isArray(i) ? "array" : typeof i, s = {
1298
- string: r === "string",
1299
- number: r === "number",
1300
- boolean: r === "boolean",
1301
- array: Array.isArray(i),
1302
- object: r === "object" && i !== null && !Array.isArray(i),
1303
- function: r === "function"
1314
+ const l = He(n.type), i = Array.isArray(o) ? "array" : typeof o, s = {
1315
+ string: i === "string",
1316
+ number: i === "number",
1317
+ boolean: i === "boolean",
1318
+ array: Array.isArray(o),
1319
+ object: i === "object" && o !== null && !Array.isArray(o),
1320
+ function: i === "function"
1304
1321
  };
1305
- return (l === "unknown" ? !0 : s[l] ?? !1) ? n.regex && typeof i == "string" && !new RegExp(n.regex).test(i) ? (S.error(`Prop "${e}" does not match regex "${n.regex}".`), !1) : !0 : (S.error(
1306
- `Prop "${e}" should be of type "${l}", but got "${r}".`,
1307
- i
1322
+ return (l === "unknown" ? !0 : s[l] ?? !1) ? n.regex && typeof o == "string" && !new RegExp(n.regex).test(o) ? (N.error(`Prop "${e}" does not match regex "${n.regex}".`), !1) : !0 : (N.error(
1323
+ `Prop "${e}" should be of type "${l}", but got "${i}".`,
1324
+ o
1308
1325
  ), !1);
1309
1326
  }
1310
- function me({
1327
+ function ge({
1311
1328
  ele: e,
1312
1329
  parent: t,
1313
- props: o,
1330
+ props: r,
1314
1331
  state: n
1315
1332
  }) {
1316
- const i = Object.keys(o).length > 0, l = (r, s) => {
1317
- Object.defineProperty(n, r, {
1333
+ const o = Object.keys(r).length > 0, l = (i, s) => {
1334
+ Object.defineProperty(n, i, {
1318
1335
  enumerable: !0,
1319
1336
  configurable: !0,
1320
1337
  get() {
1321
1338
  if (t)
1322
- return re(t.state, s);
1339
+ return se(t.state, s);
1323
1340
  },
1324
1341
  set(c) {
1325
1342
  if (!(!t || !t.state))
1326
1343
  try {
1327
- je(t.state, s, c);
1344
+ Be(t.state, s, c);
1328
1345
  } catch (a) {
1329
- S.errorWithContext(
1330
- `Failed to set bound prop "${r}" → "${s}"`,
1331
- { propName: r, parentPath: s },
1346
+ N.errorWithContext(
1347
+ `Failed to set bound prop "${i}" → "${s}"`,
1348
+ { propName: i, parentPath: s },
1332
1349
  a
1333
1350
  );
1334
1351
  }
1335
1352
  }
1336
1353
  });
1337
1354
  };
1338
- for (const r of e.attributes) {
1339
- const s = r.name.startsWith(":"), c = qe(r.name.substring(s ? 1 : 0));
1340
- if (s && !t || !(!i || o[c] && o[c] !== void 0)) continue;
1355
+ for (const i of e.attributes) {
1356
+ const s = i.name.startsWith(":"), c = Ue(i.name.substring(s ? 1 : 0));
1357
+ if (s && !t || !(!o || r[c] && r[c] !== void 0)) continue;
1341
1358
  if (!s) {
1342
- const v = r.value !== "" ? r.value : !0;
1343
- (!i || oe({ propName: c, propValue: v, props: o })) && (n[c] = v);
1359
+ const v = i.value !== "" ? i.value : !0;
1360
+ (!o || ie({ propName: c, propValue: v, props: r })) && (n[c] = v);
1344
1361
  continue;
1345
1362
  }
1346
- const u = r.value?.trim() ?? "";
1347
- if (u && be(u)) {
1348
- const v = re(t.state, u);
1349
- (!i || oe({ propName: c, propValue: v, props: o })) && l(c, u);
1363
+ const u = i.value?.trim() ?? "";
1364
+ if (u && ve(u)) {
1365
+ const v = se(t.state, u);
1366
+ (!o || ie({ propName: c, propValue: v, props: r })) && l(c, u);
1350
1367
  continue;
1351
1368
  }
1352
- const d = u ? B(u, t.state) : void 0;
1353
- (!i || oe({ propName: c, propValue: d, props: o })) && (n[c] = d);
1369
+ const d = u ? q(u, t.state) : void 0;
1370
+ (!o || ie({ propName: c, propValue: d, props: r })) && (n[c] = d);
1354
1371
  }
1355
- for (const [r, s] of Object.entries(o))
1356
- r in n || (s.default !== void 0 ? n[r] = s.default : s.required && S.error(`Required prop "${r}" is missing.`));
1372
+ for (const [i, s] of Object.entries(r))
1373
+ i in n || (s.default !== void 0 ? n[i] = s.default : s.required && N.error(`Required prop "${i}" is missing.`));
1357
1374
  }
1358
- function xt(e, t) {
1359
- const o = /* @__PURE__ */ new Set();
1375
+ function kt(e, t) {
1376
+ const r = /* @__PURE__ */ new Set();
1360
1377
  customElements.define(
1361
1378
  e,
1362
1379
  class extends HTMLElement {
@@ -1368,8 +1385,8 @@ function xt(e, t) {
1368
1385
  // Cleanup state for deterministic teardown
1369
1386
  _connectionVersion = 0;
1370
1387
  _isDisconnected = !1;
1371
- _isMounted = !1;
1372
- // Track if component has been mounted (persists across connectedCallback calls)
1388
+ _hasRendered = !1;
1389
+ _releaseFirstPresentation;
1373
1390
  _model;
1374
1391
  _observerFn;
1375
1392
  _renderAborted = !1;
@@ -1380,288 +1397,297 @@ function xt(e, t) {
1380
1397
  super(), this.template = document.createElement("template"), this.template.innerHTML = t.template;
1381
1398
  }
1382
1399
  async connectedCallback() {
1383
- const n = this, i = ++this._connectionVersion;
1384
- if (this._isDisconnected = !1, this._renderAborted = !1, this._pendingRender = null, o.add(this), !document.head.querySelector(`style#style-${e}`)) {
1385
- const g = document.createElement("style");
1386
- g.id = `style-${e}`, g.textContent = t.style, document.head.appendChild(g);
1400
+ const n = this, o = ++this._connectionVersion;
1401
+ this._isDisconnected = !1, this._renderAborted = !1, this._pendingRender = null, !this._hasRendered && !this._releaseFirstPresentation && (this._releaseFirstPresentation = ye(this));
1402
+ try {
1403
+ await this.initializeConnection(n, o);
1404
+ } catch (l) {
1405
+ if (o !== this._connectionVersion || this._isDisconnected)
1406
+ return;
1407
+ this.releaseFirstPresentation(), N.errorWithContext("Error during initialization", { componentName: e }, l);
1408
+ }
1409
+ }
1410
+ async initializeConnection(n, o) {
1411
+ if (r.add(this), !document.head.querySelector(`style#style-${e}`)) {
1412
+ const m = document.createElement("style");
1413
+ m.id = `style-${e}`, m.textContent = t.style, document.head.appendChild(m);
1387
1414
  }
1388
1415
  if (n.instance && this._model && this._observerFn) {
1389
- const g = n.instance, p = pe(n);
1390
- g.$parent = p, this._isDisconnected = !1, this._renderAborted = !1, this._pendingRender = null, this._model.addObserver(this._observerFn), g.props && g.state && me({
1416
+ const m = n.instance, g = me(n);
1417
+ m.$parent = g, this._isDisconnected = !1, this._renderAborted = !1, this._pendingRender = null, this._model.addObserver(this._observerFn), m.props && m.state && ge({
1391
1418
  ele: n,
1392
- parent: p,
1393
- props: g.props,
1394
- state: g.state
1419
+ parent: g,
1420
+ props: m.props,
1421
+ state: m.state
1395
1422
  });
1396
1423
  return;
1397
1424
  }
1398
- const r = (t.type || "options") === "options", s = pe(n), c = this.template.cloneNode(!0);
1425
+ const i = (t.type || "options") === "options", s = me(n), c = this.template.cloneNode(!0);
1399
1426
  let a;
1400
1427
  if (t.deps) {
1401
1428
  a = {};
1402
- const g = Object.entries(t.deps), p = await Promise.all(
1403
- g.map(([, _]) => _())
1429
+ const m = Object.entries(t.deps), g = await Promise.all(
1430
+ m.map(([, C]) => C())
1404
1431
  );
1405
- for (let _ = 0; _ < g.length; _++)
1406
- a[g[_][0]] = p[_];
1432
+ for (let C = 0; C < m.length; C++)
1433
+ a[m[C][0]] = g[C];
1407
1434
  }
1408
- if (i !== this._connectionVersion || this._isDisconnected) return;
1409
- const u = Ke(t.script, a), d = {};
1410
- let v = !1, x = -1;
1435
+ if (o !== this._connectionVersion || this._isDisconnected) return;
1436
+ const u = Ye(t.script, a), d = {};
1437
+ let v = !1, A = -1, R;
1411
1438
  this._isDisconnected = !1, this._renderAborted = !1, this._pendingRender = null;
1412
- const M = Ee(), N = (() => {
1413
- let g;
1414
- return { promise: new Promise((_) => {
1415
- g = _;
1416
- }), resolve: g };
1439
+ const w = we(), P = (() => {
1440
+ let m;
1441
+ return { promise: new Promise((C) => {
1442
+ m = C;
1443
+ }), resolve: m };
1417
1444
  })();
1418
- let C, f;
1419
- const y = (g) => {
1420
- const p = Z.plugins[g];
1421
- if (!p || typeof p.setup != "function") {
1422
- S.warnWithContext(
1423
- `Plugin "${g}" not found or has no setup method`,
1424
- { pluginName: g }
1445
+ let f, h;
1446
+ const b = (m) => {
1447
+ const g = J.plugins[m];
1448
+ if (!g || typeof g.setup != "function") {
1449
+ N.warnWithContext(
1450
+ `Plugin "${m}" not found or has no setup method`,
1451
+ { pluginName: m }
1425
1452
  );
1426
1453
  return;
1427
1454
  }
1428
1455
  try {
1429
- const _ = r && f ? f : C;
1430
- return p.setup.call(_);
1431
- } catch (_) {
1432
- S.errorWithContext(
1433
- `Plugin "${g}" setup failed`,
1434
- { pluginName: g },
1435
- _
1456
+ const C = i && h ? h : f;
1457
+ return g.setup.call(C);
1458
+ } catch (C) {
1459
+ N.errorWithContext(
1460
+ `Plugin "${m}" setup failed`,
1461
+ { pluginName: m },
1462
+ C
1436
1463
  );
1437
1464
  return;
1438
1465
  }
1439
- }, b = {};
1440
- for (const [g, p] of Object.entries(Z.modules))
1441
- if (typeof p.attach == "function") {
1442
- const _ = p.attach.call({
1466
+ }, _ = {};
1467
+ for (const [m, g] of Object.entries(J.modules))
1468
+ if (typeof g.attach == "function") {
1469
+ const C = g.attach.call({
1443
1470
  element: n,
1444
1471
  parent: s,
1445
- core: { take: Pe.take }
1472
+ core: { take: Fe.take }
1446
1473
  });
1447
- _ && (b[`$${g}`] = _);
1474
+ C && (_[`$${m}`] = C);
1448
1475
  }
1449
- const w = /* @__PURE__ */ new Map(), h = (g) => {
1450
- let p = w.get(g);
1451
- return p || (p = `on${g.charAt(0).toUpperCase()}${g.slice(1)}`, w.set(g, p)), p;
1452
- }, m = (g, ...p) => {
1453
- const _ = h(g);
1454
- let O = s;
1455
- for (; O; ) {
1456
- const L = O.userContext;
1457
- if (L) {
1458
- const j = L[_];
1459
- typeof j == "function" && j(...p);
1460
- } else if (O.methods) {
1461
- const j = O.methods[_];
1462
- typeof j == "function" && j(...p);
1476
+ const p = /* @__PURE__ */ new Map(), y = (m) => {
1477
+ let g = p.get(m);
1478
+ return g || (g = `on${m.charAt(0).toUpperCase()}${m.slice(1)}`, p.set(m, g)), g;
1479
+ }, E = (m, ...g) => {
1480
+ const C = y(m);
1481
+ let M = s;
1482
+ for (; M; ) {
1483
+ const F = M.userContext;
1484
+ if (F) {
1485
+ const H = F[C];
1486
+ typeof H == "function" && H(...g);
1487
+ } else if (M.methods) {
1488
+ const H = M.methods[C];
1489
+ typeof H == "function" && H(...g);
1463
1490
  }
1464
- O = O.$parent;
1491
+ M = M.$parent;
1465
1492
  }
1466
- }, E = {
1493
+ }, S = {
1467
1494
  $refs: d,
1468
1495
  $parent: s,
1469
- $emit: m,
1470
- $take: y,
1471
- ...b
1472
- }, T = u(E), A = yt(T.state ?? {});
1473
- C = A.state;
1474
- const I = T.methods || {}, R = T.props || {}, D = T.events || [];
1475
- let k = T.watchList || [];
1476
- r && (f = At([I, C])), me({
1496
+ $emit: E,
1497
+ $take: b,
1498
+ ..._
1499
+ }, x = u(S), T = bt(x.state ?? {});
1500
+ f = T.state;
1501
+ const k = x.methods || {}, D = x.props || {}, O = x.events || [];
1502
+ let $ = x.watchList || [];
1503
+ i && (h = St([k, f])), ge({
1477
1504
  ele: n,
1478
1505
  parent: s,
1479
- props: R,
1480
- state: C
1481
- }), r && f && We(I, f);
1482
- for (const g of De) {
1483
- const p = T[g];
1484
- if (typeof p == "function") {
1485
- const _ = r && f ? Y(p, f) : p;
1486
- we(M, g, async () => {
1487
- const O = _();
1488
- O instanceof Promise && await O;
1506
+ props: D,
1507
+ state: f
1508
+ }), i && h && We(k, h);
1509
+ for (const m of Ve) {
1510
+ const g = x[m];
1511
+ if (typeof g == "function") {
1512
+ const C = i && h ? Q(g, h) : g;
1513
+ Ce(w, m, async () => {
1514
+ const M = C();
1515
+ M instanceof Promise && await M;
1489
1516
  });
1490
1517
  }
1491
1518
  }
1492
- this._model = A;
1493
- const $ = async () => {
1519
+ this._model = T;
1520
+ const V = async () => {
1494
1521
  if (this._isDisconnected)
1495
1522
  return;
1496
1523
  if (v) {
1497
- this._renderAborted = !0, this._pendingRender = $;
1524
+ this._renderAborted = !0, this._pendingRender = V;
1498
1525
  return;
1499
1526
  }
1500
- const g = A.getStateVersion();
1501
- if (x !== g) {
1502
- v = !0, this._renderAborted = !1, n.instance && (n.instance.isRendering = !0);
1527
+ const m = T.getStateVersion();
1528
+ if (A !== m) {
1529
+ !this._hasRendered && !this._releaseFirstPresentation && (this._releaseFirstPresentation = ye(this)), v = !0, this._renderAborted = !1, n.instance && (n.instance.isRendering = !0);
1503
1530
  try {
1504
- const p = c.content.cloneNode(!0), _ = St(p, n, d);
1505
- if (await $e(p, r && f ? f : C, d), _.remapRefs(), this._renderAborted || this._model !== A) {
1506
- this._pendingRender = $;
1531
+ const g = c.content.cloneNode(!0), C = Pt(g, n, d);
1532
+ if (await Me(g, i && h ? h : f, d), C.remapRefs(), this._renderAborted || this._model !== T) {
1533
+ this._pendingRender = V;
1507
1534
  return;
1508
1535
  }
1509
- const L = r && f ? f : C;
1510
- if (await P("global", "processed", L), await P(M, "processed"), this._renderAborted || this._model !== A) {
1511
- this._pendingRender = $;
1536
+ const F = i && h ? h : f;
1537
+ if (await I("global", "processed", F), await I(w, "processed"), this._renderAborted || this._model !== T) {
1538
+ this._pendingRender = V;
1512
1539
  return;
1513
1540
  }
1514
- const j = A.flushChanges();
1515
- Object.defineProperty(L, "changedPaths", {
1516
- value: j,
1541
+ const H = T.flushChanges();
1542
+ Object.defineProperty(F, "changedPaths", {
1543
+ value: H,
1517
1544
  writable: !0,
1518
1545
  configurable: !0,
1519
1546
  enumerable: !1
1520
1547
  });
1521
- const le = !this._isMounted;
1522
- if (await P(
1548
+ const Z = !this._hasRendered;
1549
+ if (await I(
1523
1550
  "global",
1524
- le ? "beforeMount" : "beforeUpdate",
1525
- L
1526
- ), await P(
1527
- M,
1528
- le ? "beforeMount" : "beforeUpdate",
1529
- L
1530
- ), this._renderAborted || this._model !== A) {
1531
- delete L.changedPaths, this._pendingRender = $;
1551
+ Z ? "beforeMount" : "beforeUpdate",
1552
+ F
1553
+ ), await I(
1554
+ w,
1555
+ Z ? "beforeMount" : "beforeUpdate",
1556
+ F
1557
+ ), this._renderAborted || this._model !== T) {
1558
+ delete F.changedPaths, this._pendingRender = V;
1532
1559
  return;
1533
1560
  }
1534
- _.commit(), r && f ? (st(f, p), this._eventCleanup && this._eventCleanup(), this._eventCleanup = it(f, D, p, d)) : (ct(I, p), this._eventCleanup && this._eventCleanup(), this._eventCleanup = at(
1535
- I,
1536
- C,
1537
- D,
1538
- p,
1561
+ C.commit(), i && h ? (at(h, g), this._eventCleanup && this._eventCleanup(), this._eventCleanup = ct(h, O, g, d)) : (lt(k, g), this._eventCleanup && this._eventCleanup(), this._eventCleanup = ft(
1562
+ k,
1563
+ f,
1564
+ O,
1565
+ g,
1539
1566
  d
1540
- )), nt(n, p, !this._isMounted, t.structAttr), this._isMounted && (await P("global", "updated", L), await P(M, "updated", L)), delete L.changedPaths, x = g, n.instance && (n.instance._lastRenderedStateVersion = x);
1541
- } catch (p) {
1542
- S.errorWithContext("Error during render", { componentName: e }, p);
1567
+ )), ot(n, g, Z, t.structAttr), this._hasRendered = !0, this.releaseFirstPresentation(), Z || (await I("global", "updated", F), await I(w, "updated", F)), delete F.changedPaths, A = m, n.instance && (n.instance._lastRenderedStateVersion = A);
1568
+ } catch (g) {
1569
+ this._model === T && this.releaseFirstPresentation(), N.errorWithContext("Error during render", { componentName: e }, g);
1570
+ return;
1543
1571
  } finally {
1544
- const p = r && f ? f : C;
1545
- if (delete p.changedPaths, v = !1, n.instance && (n.instance.isRendering = !1), this._pendingRender && !this._isDisconnected) {
1546
- const _ = this._pendingRender;
1572
+ const g = i && h ? h : f;
1573
+ if (delete g.changedPaths, v = !1, n.instance && (n.instance.isRendering = !1), this._pendingRender && !this._isDisconnected) {
1574
+ const C = this._pendingRender;
1547
1575
  this._pendingRender = null, requestAnimationFrame(() => {
1548
- this._isDisconnected || _().catch((O) => {
1549
- S.errorWithContext(
1576
+ this._isDisconnected || C().catch((M) => {
1577
+ N.errorWithContext(
1550
1578
  "Error during pending render",
1551
1579
  { componentName: e },
1552
- O
1580
+ M
1553
1581
  );
1554
1582
  });
1555
1583
  });
1556
1584
  }
1557
1585
  }
1586
+ this._isDisconnected || this._model !== T || (R || (R = (async () => {
1587
+ await I("global", "mounted", i && h ? h : f), !(this._isDisconnected || this._model !== T) && await I(w, "mounted");
1588
+ })()), await R, !(this._isDisconnected || this._model !== T) && P.resolve());
1558
1589
  }
1559
1590
  };
1560
1591
  n.instance = {
1561
1592
  element: n,
1562
1593
  template: c,
1563
- state: C,
1564
- userContext: r ? f : void 0,
1565
- props: R,
1566
- methods: I,
1567
- events: D,
1568
- watchList: k,
1594
+ state: f,
1595
+ userContext: i ? h : void 0,
1596
+ props: D,
1597
+ methods: k,
1598
+ events: O,
1599
+ watchList: $,
1569
1600
  $refs: d,
1570
1601
  $parent: s,
1571
- $emit: m,
1572
- $take: y,
1573
- readyPromise: N.promise,
1574
- lifecycleRegistry: M,
1575
- ...b,
1602
+ $emit: E,
1603
+ $take: b,
1604
+ readyPromise: P.promise,
1605
+ lifecycleRegistry: w,
1606
+ ..._,
1576
1607
  isRendering: !1
1577
1608
  }, this._observerFn = () => {
1578
- if (this._isDisconnected || k && k.length > 0 && !A.hasPendingChangesFor(k))
1609
+ if (this._isDisconnected || $ && $.length > 0 && !T.hasPendingChangesFor($))
1579
1610
  return;
1580
- let g = s;
1581
- for (; g; ) {
1582
- if (g.isRendering)
1611
+ let m = s;
1612
+ for (; m; ) {
1613
+ if (m.isRendering)
1583
1614
  return;
1584
- g = g.$parent;
1615
+ m = m.$parent;
1585
1616
  }
1586
1617
  requestAnimationFrame(() => {
1587
- this._isDisconnected || $().catch((p) => {
1588
- S.errorWithContext(
1618
+ this._isDisconnected || V().catch((g) => {
1619
+ N.errorWithContext(
1589
1620
  "Error during render (observer)",
1590
1621
  { componentName: e },
1591
- p
1622
+ g
1592
1623
  );
1593
1624
  });
1594
1625
  });
1595
- }, A.addObserver(this._observerFn);
1596
- const G = r && f ? f : C;
1597
- if (await P("global", "created", G), await P(M, "created"), !(this._isDisconnected || this._model !== A) && (await $(), !(this._isDisconnected || this._model !== A))) {
1598
- if (!this._isMounted) {
1599
- if (await P("global", "mounted", G), this._isDisconnected || this._model !== A || (await P(M, "mounted"), this._isDisconnected || this._model !== A)) return;
1600
- this._isMounted = !0;
1601
- }
1602
- N.resolve();
1603
- }
1626
+ }, T.addObserver(this._observerFn), await I("global", "created", i && h ? h : f), await I(w, "created"), !(this._isDisconnected || this._model !== T) && await V();
1627
+ }
1628
+ releaseFirstPresentation() {
1629
+ this._releaseFirstPresentation?.(), this._releaseFirstPresentation = void 0;
1604
1630
  }
1605
1631
  async disconnectedCallback() {
1606
- const n = this, i = ++this._connectionVersion;
1607
- if (this._isDisconnected = !0, this._renderAborted = !0, this._pendingRender = null, o.delete(this), o.size === 0 && document.head.querySelector(`style#style-${e}`)?.remove(), !n.instance) return;
1632
+ const n = this, o = ++this._connectionVersion;
1633
+ if (this._isDisconnected = !0, this._renderAborted = !0, this._pendingRender = null, this.releaseFirstPresentation(), r.delete(this), r.size === 0 && document.head.querySelector(`style#style-${e}`)?.remove(), !n.instance) return;
1608
1634
  const l = n.instance;
1609
1635
  this._isDisconnected = !0, this._renderAborted = !0, this._pendingRender = null, this._model && this._observerFn && this._model.removeObserver(this._observerFn);
1610
- const r = l.userContext || l.state;
1611
- await P("global", "beforeDestroy", r), await P(l.lifecycleRegistry, "beforeDestroy"), !(!this._isDisconnected || i !== this._connectionVersion) && (Se(this), this._eventCleanup && (this._eventCleanup(), this._eventCleanup = null), await P("global", "destroyed", r), await P(l.lifecycleRegistry, "destroyed"), !(!this._isDisconnected || i !== this._connectionVersion) && (this._isMounted = !1, this._model = void 0, this._observerFn = void 0, this._eventCleanup = null, n.instance = void 0));
1636
+ const i = l.userContext || l.state;
1637
+ await I("global", "beforeDestroy", i), await I(l.lifecycleRegistry, "beforeDestroy"), !(!this._isDisconnected || o !== this._connectionVersion) && (Pe(this), this._eventCleanup && (this._eventCleanup(), this._eventCleanup = null), await I("global", "destroyed", i), await I(l.lifecycleRegistry, "destroyed"), !(!this._isDisconnected || o !== this._connectionVersion) && (this._hasRendered = !1, this._model = void 0, this._observerFn = void 0, this._eventCleanup = null, n.instance = void 0));
1612
1638
  }
1613
1639
  }
1614
1640
  );
1615
1641
  }
1616
- let ce = !1, ye = !1, ae = [];
1617
- function Mt() {
1618
- ye || (ye = !0, !(typeof document > "u" || typeof HTMLElement > "u") && (lt(), Qe(), ut()));
1642
+ let le = !1, be = !1, fe = [];
1643
+ function Rt() {
1644
+ be || (be = !0, !(typeof document > "u" || typeof HTMLElement > "u") && (ut(), tt(), ht()));
1619
1645
  }
1620
- function Re(...e) {
1621
- const t = e[0], o = e[1];
1622
- if (Ze(t)) {
1623
- if (!o) {
1624
- S.error("ComponentSource requires a component name when calling take()");
1646
+ function Ie(...e) {
1647
+ const t = e[0], r = e[1];
1648
+ if (Je(t)) {
1649
+ if (!r) {
1650
+ N.error("ComponentSource requires a component name when calling take()");
1625
1651
  return;
1626
1652
  }
1627
- xt(o, t);
1653
+ kt(r, t);
1628
1654
  return;
1629
1655
  }
1630
- if (J(t) || Ye(t)) {
1656
+ if (ee(t) || Qe(t)) {
1631
1657
  const n = {
1632
- registerHook: (i, l) => {
1633
- we("global", i, l);
1658
+ registerHook: (o, l) => {
1659
+ Ce("global", o, l);
1634
1660
  },
1635
- take: Pe.take
1661
+ take: Fe.take
1636
1662
  };
1637
1663
  try {
1638
- t.install(n), J(t) ? Z.plugins[t.name] = t : Z.modules[t.name] = t;
1639
- } catch (i) {
1640
- S.errorWithContext(
1664
+ t.install(n), ee(t) ? J.plugins[t.name] = t : J.modules[t.name] = t;
1665
+ } catch (o) {
1666
+ N.errorWithContext(
1641
1667
  "Failed to install extension",
1642
- { name: t.name, type: J(t) ? "plugin" : "module" },
1643
- i
1668
+ { name: t.name, type: ee(t) ? "plugin" : "module" },
1669
+ o
1644
1670
  );
1645
1671
  }
1646
1672
  return;
1647
1673
  }
1648
- S.error("Unknown extension type", t);
1674
+ N.error("Unknown extension type", t);
1649
1675
  }
1650
1676
  function Ot() {
1651
- ce || (ce = !0, ae.forEach((e) => Re(...e)), ae = [], S.info("Core initialized"));
1677
+ le || (le = !0, fe.forEach((e) => Ie(...e)), fe = [], N.info("Core initialized"));
1652
1678
  }
1653
- const Pe = Object.assign(
1679
+ const Fe = Object.assign(
1654
1680
  () => {
1655
- Mt(), Ot();
1681
+ Rt(), Ot();
1656
1682
  },
1657
1683
  {
1658
1684
  take: (...t) => {
1659
- ce ? Re(...t) : ae.push(t);
1685
+ le ? Ie(...t) : fe.push(t);
1660
1686
  }
1661
1687
  }
1662
1688
  );
1663
1689
  export {
1664
- Pe as Core,
1665
- Ie as LogLevel,
1666
- S as logger
1690
+ Fe as Core,
1691
+ Le as LogLevel,
1692
+ N as logger
1667
1693
  };