solely 0.1.7 → 0.1.8

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.js CHANGED
@@ -1,10 +1,10 @@
1
1
  var re = Object.defineProperty;
2
- var Nt = (n) => {
2
+ var _t = (n) => {
3
3
  throw TypeError(n);
4
4
  };
5
5
  var ie = (n, t, e) => t in n ? re(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
6
- var S = (n, t, e) => ie(n, typeof t != "symbol" ? t + "" : t, e), pt = (n, t, e) => t.has(n) || Nt("Cannot " + e);
7
- var C = (n, t, e) => (pt(n, t, "read from private field"), e ? e.call(n) : t.get(n)), M = (n, t, e) => t.has(n) ? Nt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), A = (n, t, e, s) => (pt(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), I = (n, t, e) => (pt(n, t, "access private method"), e);
6
+ var x = (n, t, e) => ie(n, typeof t != "symbol" ? t + "" : t, e), gt = (n, t, e) => t.has(n) || _t("Cannot " + e);
7
+ var C = (n, t, e) => (gt(n, t, "read from private field"), e ? e.call(n) : t.get(n)), P = (n, t, e) => t.has(n) ? _t("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), A = (n, t, e, s) => (gt(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), M = (n, t, e) => (gt(n, t, "access private method"), e);
8
8
  const oe = {
9
9
  dark: {
10
10
  gutter: "#858585",
@@ -16,8 +16,8 @@ const oe = {
16
16
  exprLabel: "#a0a0a0",
17
17
  exprCode: "#5ddcff"
18
18
  }
19
- }, P = oe.dark;
20
- function st(n) {
19
+ }, I = oe.dark;
20
+ function it(n) {
21
21
  let t = 0;
22
22
  for (let e = 0; e < n.length; ) {
23
23
  const s = n.codePointAt(e);
@@ -29,15 +29,15 @@ function st(n) {
29
29
  }
30
30
  return t;
31
31
  }
32
- function _t(n, t = {}) {
32
+ function Nt(n, t = {}) {
33
33
  const { lineIndex: e = 0, totalLines: s = 1 } = t, r = Math.max(1, Math.floor(n));
34
34
  return (s <= 1 || e === 0 ? "^" : "~").repeat(r);
35
35
  }
36
36
  function ae(n, t = "", e, s = "component") {
37
- var et;
37
+ var st;
38
38
  const r = (n == null ? void 0 : n.message) ?? String(n), o = `%cTemplate Error%c in <${s}> → ${r}`, i = [
39
- `color:${P.badgeFg};background:${P.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,
40
- `color:${P.arrow};font-weight:bold;`
39
+ `color:${I.badgeFg};background:${I.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,
40
+ `color:${I.arrow};font-weight:bold;`
41
41
  ];
42
42
  if (!t || !(e != null && e.loc) || e.loc.length < 2) {
43
43
  console.error(o, ...i), e != null && e.expr && console.log(`Expression: ${e.expr.trim()}`);
@@ -52,74 +52,77 @@ function ae(n, t = "", e, s = "component") {
52
52
  console.error(`[Template Error] 行号 ${a} 超出范围`);
53
53
  return;
54
54
  }
55
- const u = a - 1, p = Math.max(0, u - 3), v = Math.min(h.length - 1, u + 3), f = String(v + 1).length, d = ((et = e.expr) == null ? void 0 : et.trim()) ?? "", $ = d ? d.split(`
56
- `) : [], m = d ? Math.max(...$.map(st)) : 0, y = $.length > 1, g = `color:${P.gutter};`, b = `color:${P.arrow};font-weight:bold;`, E = `color:${P.gutter};`, x = `color:${P.errorLineFg};background:${P.errorLineBg};padding:0 4px;`, R = `color:${P.gutter};`, L = `color:${P.arrow};font-weight:bold;padding:0 4px;`;
55
+ const u = a - 1, p = Math.max(0, u - 3), v = Math.min(h.length - 1, u + 3), f = String(v + 1).length, d = ((st = e.expr) == null ? void 0 : st.trim()) ?? "", $ = d ? d.split(`
56
+ `) : [], m = d ? Math.max(...$.map(it)) : 0, y = $.length > 1, g = `color:${I.gutter};`, b = `color:${I.arrow};font-weight:bold;`, E = `color:${I.gutter};`, S = `color:${I.errorLineFg};background:${I.errorLineBg};padding:0 4px;`, R = `color:${I.gutter};`, L = `color:${I.arrow};font-weight:bold;padding:0 4px;`;
57
57
  console.groupCollapsed(
58
58
  `${o} %c(Line:${a}, Col:${c})`,
59
59
  ...i,
60
- `color:${P.gutter};font-weight:normal;`
60
+ `color:${I.gutter};font-weight:normal;`
61
61
  );
62
- for (let G = p; G <= v; G++) {
63
- const ht = h[G], Lt = String(G + 1).padStart(f, " ");
64
- if (!(G === u)) {
65
- console.log(`%c${Lt} │%c ${ht}`, g, E);
62
+ for (let q = p; q <= v; q++) {
63
+ const dt = h[q], Lt = String(q + 1).padStart(f, " ");
64
+ if (!(q === u)) {
65
+ console.log(`%c${Lt} │%c ${dt}`, g, E);
66
66
  continue;
67
67
  }
68
- const te = ht.slice(0, Math.max(0, c - 1)), It = st(te), Mt = " ".repeat(f + 3), ee = Lt.padEnd(f, " ");
69
- if (console.log(`%c${ee} │%c ${ht}`, b, x), y)
70
- for (let _ = 0; _ < $.length; _++) {
71
- const ft = $[_], Z = u + _;
72
- let dt = 0;
73
- if (_ === 0)
74
- dt = It;
75
- else if (Z < h.length) {
76
- const J = h[Z], nt = J.search(/\S/), se = nt === -1 ? J : J.slice(0, nt);
77
- dt = st(se);
68
+ const te = dt.slice(0, Math.max(0, c - 1)), Mt = it(te), It = " ".repeat(f + 3), ee = Lt.padEnd(f, " ");
69
+ if (console.log(`%c${ee} │%c ${dt}`, b, S), y)
70
+ for (let T = 0; T < $.length; T++) {
71
+ const pt = $[T], J = u + T;
72
+ let mt = 0;
73
+ if (T === 0)
74
+ mt = Mt;
75
+ else if (J < h.length) {
76
+ const X = h[J], rt = X.search(/\S/), se = rt === -1 ? X : X.slice(0, rt);
77
+ mt = it(se);
78
78
  }
79
- const ne = Math.max(1, st(ft.trim())), Pt = _t(ne, { lineIndex: _, totalLines: $.length }), Ot = Mt + " ".repeat(dt);
80
- if (_ === 0)
79
+ const ne = Math.max(1, it(pt.trim())), Pt = Nt(ne, { lineIndex: T, totalLines: $.length }), Ot = It + " ".repeat(mt);
80
+ if (T === 0)
81
81
  console.log(`%c${Ot}%c${Pt}`, R, L);
82
- else if (Z < h.length) {
83
- const J = String(Z + 1).padEnd(f, " "), nt = h[Z];
84
- console.log(`%c${J} │%c ${nt}`, b, x), console.log(`%c${Ot}%c${Pt}`, R, L);
82
+ else if (J < h.length) {
83
+ const X = String(J + 1).padEnd(f, " "), rt = h[J];
84
+ console.log(`%c${X} │%c ${rt}`, b, S), console.log(`%c${Ot}%c${Pt}`, R, L);
85
85
  }
86
86
  }
87
87
  else {
88
- const _ = Mt + " ".repeat(It), ft = _t(m || 1);
89
- console.log(`%c${_}%c${ft}`, R, L);
88
+ const T = It + " ".repeat(Mt), pt = Nt(m || 1);
89
+ console.log(`%c${T}%c${pt}`, R, L);
90
90
  }
91
91
  }
92
92
  d && console.log(
93
93
  `%cExpression:%c ${d}`,
94
- `color:${P.exprLabel};font-weight:bold;`,
95
- `color:${P.exprCode};font-family:monospace;`
94
+ `color:${I.exprLabel};font-weight:bold;`,
95
+ `color:${I.exprCode};font-family:monospace;`
96
96
  ), console.groupEnd();
97
97
  }
98
- const mt = {};
99
98
  function ce(n) {
100
- const t = n.map((e) => e.replace(/[',"]/g, "")).join(",");
101
- if (!mt[t]) {
102
- const e = n[n.length - 1];
103
- if (e.trim() === "")
104
- throw new Error("Function body cannot be empty");
105
- if (ue(e))
106
- throw new Error("Input contains potentially dangerous code: " + e);
107
- mt[t] = new Function(...n);
108
- }
109
- return mt[t];
99
+ if (n[n.length - 1].trim() === "")
100
+ throw new Error("Function body cannot be empty");
101
+ return new Function(...n);
110
102
  }
111
- const le = ["eval", "Function", "process", "require"];
112
- function ue(n) {
113
- return le.some((t) => new RegExp(`\\b${t}\\b`, "g").test(n));
103
+ const _ = (() => {
104
+ var n, t, e;
105
+ return !!(typeof window < "u" && ((n = window.location) != null && n.search.includes("debug") || globalThis.__DEBUG__ === !0 || globalThis.__IS_DEV__ === !0) || typeof process < "u" && ((t = process.env) == null ? void 0 : t.NODE_ENV) === "development" || typeof window < "u" && ["localhost", "127.0.0.1", "0.0.0.0"].includes(((e = window.location) == null ? void 0 : e.hostname) || ""));
106
+ })(), on = !_, le = /\{\{\{\s*[\s\S]*?\s*\}\}\}/, ue = /\{\{\s*([\s\S]*?)\s*\}\}/g, he = 1e3, D = /* @__PURE__ */ new Map();
107
+ function fe(n, t) {
108
+ if (!(n != null && n.trim())) return { processed: "" };
109
+ if (le.test(n))
110
+ return {
111
+ processed: n,
112
+ error: "Illegal interpolation syntax: use {{ }} instead of {{{ }}}"
113
+ };
114
+ if (t === "template")
115
+ try {
116
+ return { processed: n.replace(ue, (s, r) => `\${${r.trim()}}`) };
117
+ } catch (e) {
118
+ return {
119
+ processed: n,
120
+ error: `Template parse error: ${e instanceof Error ? e.message : String(e)}`
121
+ };
122
+ }
123
+ return { processed: n };
114
124
  }
115
- const he = /\{\{\{\s*[\s\S]*?\s*\}\}\}/, fe = /\{\{\s*([\s\S]*?)\s*\}\}/g;
116
125
  function de(n, t) {
117
- if (!(n != null && n.trim())) return "";
118
- if (he.test(n))
119
- throw new Error("Illegal interpolation syntax: use {{ }} instead of {{{ }}}");
120
- return t === "template" ? n.replace(fe, (e, s) => `\${${s.trim()}}`) : n;
121
- }
122
- function pe(n, t) {
123
126
  const e = (s) => s.endsWith(";") ? s : s + ";";
124
127
  switch (t) {
125
128
  case "template":
@@ -129,9 +132,11 @@ function pe(n, t) {
129
132
  case "handler":
130
133
  case "lifecycle":
131
134
  return e(n);
135
+ default:
136
+ return "return undefined;";
132
137
  }
133
138
  }
134
- function me(n) {
139
+ function pe(n) {
135
140
  if (!n.length) return { loopValues: "", loopIndices: "" };
136
141
  const t = n.map((s) => s.item).join(", "), e = n.map((s) => s.index).join(", ");
137
142
  return {
@@ -139,20 +144,57 @@ function me(n) {
139
144
  loopIndices: `var [${e}] = loops.map(l => l.idxVal);`
140
145
  };
141
146
  }
142
- function ge(n, t, e, s) {
143
- const r = n === "lifecycle" ? ["el", "loops"] : n === "handler" ? ["event", "loops"] : ["loops"], i = `
147
+ function me(n) {
148
+ let t = 0;
149
+ for (let e = 0; e < n.length; e++)
150
+ t = (t << 5) - t + n.charCodeAt(e), t |= 0;
151
+ return Math.abs(t).toString(36);
152
+ }
153
+ function ge(n, t, e, s, r) {
154
+ const o = n === "lifecycle" ? ["el", "loops"] : n === "handler" ? ["event", "loops"] : ["loops"], i = n === "handler" ? "const { value, checked } = event?.target || {};" : "";
155
+ let l = "";
156
+ if (_) {
157
+ const c = me(r);
158
+ l = `
159
+ //# sourceURL=vm:///${n}_${c}.js`;
160
+ }
161
+ const a = `
144
162
  const { $data } = this;
145
- ${n === "handler" ? "const { value, checked } = event?.target || {};" : ""}
163
+ ${i}
146
164
  ${e}
147
165
  ${s}
148
- ${t}
166
+ ${t}${l}
149
167
  `.replace(/^\s+|\s+$/gm, "");
150
- return r.push(i), r;
168
+ return o.push(a), o;
151
169
  }
152
170
  function ye(n, t, e) {
153
171
  if (!(n != null && n.trim())) return () => "";
154
- const s = de(n, t), r = pe(s, t), { loopValues: o, loopIndices: i } = me(e), l = ge(t, r, o, i);
155
- return ce(l);
172
+ const s = e.map((a) => `${a.item}:${a.index}`).join(","), r = `${t}|${n}|${s}`;
173
+ if (D.has(r)) {
174
+ const a = D.get(r);
175
+ return D.delete(r), D.set(r, a), a;
176
+ }
177
+ const { processed: o, error: i } = fe(n, t);
178
+ let l;
179
+ if (i)
180
+ l = function() {
181
+ throw new Error(`[Compile Error] ${i} Original: ${n}`);
182
+ };
183
+ else
184
+ try {
185
+ const a = de(o, t), { loopValues: c, loopIndices: h } = pe(e), u = ge(t, a, c, h, n);
186
+ l = ce(u);
187
+ } catch (a) {
188
+ const c = a instanceof Error ? a.message : String(a);
189
+ l = function() {
190
+ throw new Error(`[Parse Error] ${c} Original: ${n}`);
191
+ };
192
+ }
193
+ if (D.size >= he) {
194
+ const a = D.keys().next().value;
195
+ a && D.delete(a);
196
+ }
197
+ return D.set(r, l), l;
156
198
  }
157
199
  const be = /* @__PURE__ */ new Set([
158
200
  "onabort",
@@ -217,7 +259,7 @@ const be = /* @__PURE__ */ new Set([
217
259
  "ontoggle",
218
260
  "onvolumechange",
219
261
  "onwaiting"
220
- ]), V = (n) => {
262
+ ]), j = (n) => {
221
263
  if (n === null || typeof n != "object") return !1;
222
264
  const t = Object.prototype.toString.call(n);
223
265
  return ![
@@ -230,7 +272,7 @@ const be = /* @__PURE__ */ new Set([
230
272
  "[object WeakSet]"
231
273
  ].includes(t);
232
274
  };
233
- function on(n = window.location) {
275
+ function an(n = window.location) {
234
276
  let t;
235
277
  typeof n == "string" ? t = new URL(n).hash : t = n.hash;
236
278
  const e = t.split("?");
@@ -259,14 +301,14 @@ function Ee(n) {
259
301
  function ve(n) {
260
302
  return n === "mounted" || n === "updated" || n === "unmounted";
261
303
  }
262
- const wt = Symbol.for("solely.irMeta"), Y = process.env.NODE_ENV !== "production", $e = /\{\{[\s\S]*?\}\}/;
263
- class xe {
304
+ const Et = Symbol.for("solely.irMeta"), $e = /\{\{[\s\S]*?\}\}/;
305
+ class Se {
264
306
  constructor() {
265
- S(this, "compilers", /* @__PURE__ */ new Map());
307
+ x(this, "compilers", /* @__PURE__ */ new Map());
266
308
  }
267
309
  get(t = "anonymous") {
268
310
  let e = this.compilers.get(t);
269
- return e || (e = new Se(), this.compilers.set(t, e)), e;
311
+ return e || (e = new xe(), this.compilers.set(t, e)), e;
270
312
  }
271
313
  clear(t) {
272
314
  var e;
@@ -278,11 +320,11 @@ class xe {
278
320
  }
279
321
  }
280
322
  }
281
- const Gt = new xe();
282
- class Se {
323
+ const Gt = new Se();
324
+ class xe {
283
325
  constructor() {
284
- S(this, "cache", /* @__PURE__ */ new Map());
285
- S(this, "functions", []);
326
+ x(this, "cache", /* @__PURE__ */ new Map());
327
+ x(this, "functions", []);
286
328
  }
287
329
  // 缓存 key 生成优化:避免每次都重新分配数组
288
330
  makeCacheKey(t, e, s) {
@@ -299,7 +341,7 @@ class Se {
299
341
  try {
300
342
  l = ye(r, t, s);
301
343
  } catch (c) {
302
- Y && console.error(`[IR Compile Error] Type: ${t}, Expr: "${r}"`, c), l = () => "";
344
+ _ && console.error(`[IR Compile Error] Type: ${t}, Expr: "${r}"`, c), l = () => "";
303
345
  }
304
346
  const a = this.functions.push(l);
305
347
  return this.cache.set(o, a), a;
@@ -314,15 +356,15 @@ class Se {
314
356
  this.cache.clear(), this.functions = [];
315
357
  }
316
358
  }
317
- function qt(n) {
359
+ function Ut(n) {
318
360
  const t = n[0];
319
361
  return t === ":" ? { isDynamic: !0, type: "expression" } : t === "@" ? { isDynamic: !0, type: "handler" } : ve(n) ? { isDynamic: !0, type: "lifecycle" } : { isDynamic: !1, type: null };
320
362
  }
321
363
  function ke(n) {
322
364
  return n ? $e.test(n) : !1;
323
365
  }
324
- function Et(n, t, e) {
325
- Y && (n[wt] = { expr: t ?? "", loc: e ?? null });
366
+ function vt(n, t, e) {
367
+ _ && (n[Et] = { expr: t ?? "", loc: e ?? null });
326
368
  }
327
369
  function Ce(n) {
328
370
  if (!n.attrs) return;
@@ -372,15 +414,15 @@ function Ce(n) {
372
414
  }
373
415
  l(":value", e), l("@input", `${e} = $event`, "model");
374
416
  }
375
- function ot(n, t, e, s = null) {
417
+ function ct(n, t, e, s = null) {
376
418
  if (!n.attrs || n.attrs.length === 0) return [];
377
419
  const r = [];
378
420
  for (const o of n.attrs) {
379
421
  if (s && s.has(o.key)) continue;
380
- const { key: i, value: l, role: a } = o, { isDynamic: c, type: h } = qt(i);
422
+ const { key: i, value: l, role: a } = o, { isDynamic: c, type: h } = Ut(i);
381
423
  if (c && h) {
382
424
  const u = e.compile(h, l ?? "", t), p = { key: i, fid: u, dynamic: 1, role: a };
383
- Et(p, l, o.loc ?? n.loc), r.push(p);
425
+ vt(p, l, o.loc ?? n.loc), r.push(p);
384
426
  } else
385
427
  r.push({ key: i, value: l, dynamic: 0, role: a });
386
428
  }
@@ -390,29 +432,29 @@ function Re(n, t, e) {
390
432
  var o, i, l, a, c, h;
391
433
  const s = { type: n.type, dynamic: 0 };
392
434
  let r = !1;
393
- switch (n.type === w.Text ? ke(n.content) && (r = !0) : ((o = n.attrs) != null && o.some((u) => u.key === "s-model" || qt(u.key).isDynamic) && (r = !0), n.type === w.For && (r = !0)), s.dynamic = r ? 1 : 0, n.type) {
435
+ switch (n.type === w.Text ? ke(n.content) && (r = !0) : ((o = n.attrs) != null && o.some((u) => u.key === "s-model" || Ut(u.key).isDynamic) && (r = !0), n.type === w.For && (r = !0)), s.dynamic = r ? 1 : 0, n.type) {
394
436
  case w.Text: {
395
437
  const u = n.content ?? "";
396
- r ? (s.fid = e.compile("template", u, t), Et(s, u, n.loc)) : s.txt = u;
438
+ r ? (s.fid = e.compile("template", u, t), vt(s, u, n.loc)) : s.txt = u;
397
439
  break;
398
440
  }
399
441
  case w.Element: {
400
- s.tag = n.tag, Ce(n), s.attrs = ot(n, t, e), n.children && (s.children = X(n.children, t, e));
442
+ s.tag = n.tag, Ce(n), s.attrs = ct(n, t, e), n.children && (s.children = Q(n.children, t, e));
401
443
  break;
402
444
  }
403
445
  case w.For: {
404
446
  const u = (i = n.attrs) == null ? void 0 : i.find((d) => d.key === "each"), p = (u == null ? void 0 : u.value) ?? "";
405
- s.fid = e.compile("expression", p, t), s.item = ((a = (l = n.attrs) == null ? void 0 : l.find((d) => d.key === "item")) == null ? void 0 : a.value) ?? "item", s.index = ((h = (c = n.attrs) == null ? void 0 : c.find((d) => d.key === "index")) == null ? void 0 : h.value) ?? "index", Et(s, p, (u == null ? void 0 : u.loc) ?? n.loc);
447
+ s.fid = e.compile("expression", p, t), s.item = ((a = (l = n.attrs) == null ? void 0 : l.find((d) => d.key === "item")) == null ? void 0 : a.value) ?? "item", s.index = ((h = (c = n.attrs) == null ? void 0 : c.find((d) => d.key === "index")) == null ? void 0 : h.value) ?? "index", vt(s, p, (u == null ? void 0 : u.loc) ?? n.loc);
406
448
  const v = /* @__PURE__ */ new Set(["each", "item", "index"]);
407
- s.attrs = ot(n, t, e, v);
449
+ s.attrs = ct(n, t, e, v);
408
450
  const f = [...t, { item: s.item, index: s.index }];
409
- n.children && (s.children = X(n.children, f, e));
451
+ n.children && (s.children = Q(n.children, f, e));
410
452
  break;
411
453
  }
412
454
  case w.If:
413
455
  case w.ElseIf:
414
456
  case w.Else: {
415
- Y && console.warn(`[IR] Orphaned conditional node found: ${w[n.type]}`), s.attrs = ot(n, t, e), n.children && (s.children = X(n.children, t, e));
457
+ _ && console.warn(`[IR] Orphaned conditional node found: ${w[n.type]}`), s.attrs = ct(n, t, e), n.children && (s.children = Q(n.children, t, e));
416
458
  break;
417
459
  }
418
460
  case w.Comment: {
@@ -422,7 +464,7 @@ function Re(n, t, e) {
422
464
  }
423
465
  return s;
424
466
  }
425
- function X(n, t, e) {
467
+ function Q(n, t, e) {
426
468
  var o;
427
469
  const s = [];
428
470
  let r = 0;
@@ -442,19 +484,19 @@ function X(n, t, e) {
442
484
  );
443
485
  p = (m == null ? void 0 : m.value) ?? "false", u = e.compile("expression", p, t), v = (m == null ? void 0 : m.loc) ?? c.loc;
444
486
  }
445
- const f = c.children ? X(c.children, t, e) : [], $ = ot(c, t, e, /* @__PURE__ */ new Set(["test", "condition"]));
487
+ const f = c.children ? Q(c.children, t, e) : [], $ = ct(c, t, e, /* @__PURE__ */ new Set(["test", "condition"]));
446
488
  if (l.push({
447
489
  condFid: u,
448
490
  children: f,
449
491
  attrs: $.length > 0 ? $ : void 0,
450
- [wt]: Y ? { expr: p, loc: v } : void 0
492
+ [Et]: _ ? { expr: p, loc: v } : void 0
451
493
  }), a++, h === w.Else) break;
452
494
  }
453
495
  s.push({
454
496
  type: w.Conditional,
455
497
  dynamic: 1,
456
498
  branches: l,
457
- ...Y && { [wt]: { loc: i.loc } }
499
+ ..._ && { [Et]: { loc: i.loc } }
458
500
  }), r = a;
459
501
  } else
460
502
  s.push(Re(i, t, e)), r++;
@@ -464,7 +506,7 @@ function X(n, t, e) {
464
506
  function Ae(n, t = {}) {
465
507
  const { filename: e = "anonymous", source: s } = t, r = Gt.get(e);
466
508
  r.clear();
467
- const o = performance.now(), i = X(n, [], r), l = performance.now(), a = r.getStats(), c = i.filter((u) => u.dynamic === 1).length, h = {
509
+ const o = performance.now(), i = Q(n, [], r), l = performance.now(), a = r.getStats(), c = i.filter((u) => u.dynamic === 1).length, h = {
468
510
  type: "root",
469
511
  version: "1.1.0",
470
512
  // Bump version
@@ -484,14 +526,14 @@ function Ae(n, t = {}) {
484
526
  ...s && { source: s }
485
527
  }
486
528
  };
487
- return Y && console.log(
529
+ return _ && console.log(
488
530
  `[IRBuilder] ${e} | ${(l - o).toFixed(2)}ms | Nodes: ${i.length} | Fns: ${a.total}`
489
531
  ), h;
490
532
  }
491
- function an(n) {
533
+ function cn(n) {
492
534
  Gt.clear(n);
493
535
  }
494
- const Le = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, Ie = /* @__PURE__ */ new Set([
536
+ const Le = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, Me = /* @__PURE__ */ new Set([
495
537
  "area",
496
538
  "base",
497
539
  "br",
@@ -506,12 +548,12 @@ const Le = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, Ie = /* @__PURE__ */ new Set
506
548
  "source",
507
549
  "track",
508
550
  "wbr"
509
- ]), Me = /\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;
551
+ ]), Ie = /\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;
510
552
  function Pe(n, t) {
511
553
  const e = [];
512
554
  let s;
513
555
  const r = n.replace(/^\s*[^\s"'/>]+/, ""), o = n.length - r.length;
514
- for (; (s = Me.exec(r)) !== null; ) {
556
+ for (; (s = Ie.exec(r)) !== null; ) {
515
557
  const i = s[1];
516
558
  if (!i) continue;
517
559
  const l = s[2] ?? s[3] ?? s[4] ?? "";
@@ -558,7 +600,7 @@ function Oe(n, t) {
558
600
  attrs: s
559
601
  };
560
602
  }
561
- function Ne(n, t) {
603
+ function _e(n, t) {
562
604
  const e = n.length;
563
605
  if (n.startsWith("!--", t)) {
564
606
  const i = n.indexOf("-->", t + 3);
@@ -587,7 +629,7 @@ function Ne(n, t) {
587
629
  }
588
630
  return -1;
589
631
  }
590
- function _e(n) {
632
+ function Ne(n) {
591
633
  const t = [];
592
634
  if (!n) return [];
593
635
  const e = [], s = [], r = () => {
@@ -609,7 +651,7 @@ function _e(n) {
609
651
  if (c === -1 || c > o) {
610
652
  const g = n.substring(o, c === -1 ? void 0 : c), b = g.trim();
611
653
  if (b) {
612
- const E = g.indexOf(b), x = o + E, R = a(x);
654
+ const E = g.indexOf(b), S = o + E, R = a(S);
613
655
  r().push({
614
656
  type: w.Text,
615
657
  tag: "text",
@@ -621,7 +663,7 @@ function _e(n) {
621
663
  if (c === -1) break;
622
664
  o = c;
623
665
  }
624
- const h = Ne(n, o + 1);
666
+ const h = _e(n, o + 1);
625
667
  if (h === -1) {
626
668
  const g = n.substring(o);
627
669
  g.trim() && r().push({
@@ -688,7 +730,7 @@ function _e(n) {
688
730
  }
689
731
  const f = Oe(u, v);
690
732
  p.push(f);
691
- const d = f.tag || "", $ = d.toLowerCase().startsWith("script"), m = d.toLowerCase().startsWith("style"), y = u.endsWith("/>") || Ie.has(d.toLowerCase());
733
+ const d = f.tag || "", $ = d.toLowerCase().startsWith("script"), m = d.toLowerCase().startsWith("style"), y = u.endsWith("/>") || Me.has(d.toLowerCase());
692
734
  if (($ || m) && !y) {
693
735
  const g = `</${d}>`, b = n.toLowerCase().indexOf(g, h + 1);
694
736
  if (b !== -1) {
@@ -717,19 +759,19 @@ function _e(n) {
717
759
  }
718
760
  return t;
719
761
  }
720
- const ct = Symbol("solely.raw"), F = /* @__PURE__ */ new WeakMap(), Tt = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakMap(), Wt = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap();
762
+ const ut = Symbol("solely.raw"), B = /* @__PURE__ */ new WeakMap(), Tt = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakMap(), Wt = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap();
721
763
  function Te(n) {
722
764
  if (n && typeof n == "object") {
723
- const t = n[ct];
765
+ const t = n[ut];
724
766
  if (t) return t;
725
767
  }
726
768
  return n;
727
769
  }
728
770
  const Dt = (n) => !n || typeof n != "object" ? !1 : n instanceof File || n instanceof Blob || n instanceof FormData || n instanceof ArrayBuffer || n instanceof Response || n instanceof Request;
729
771
  function We(n) {
730
- return !!(n && n[ct]);
772
+ return !!(n && n[ut]);
731
773
  }
732
- const vt = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
774
+ const $t = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
733
775
  if (n === t) return !0;
734
776
  if (n == null || t == null || typeof n != "object" || typeof t != "object") return n === t;
735
777
  if (Array.isArray(n) !== Array.isArray(t)) return !1;
@@ -738,7 +780,7 @@ const vt = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
738
780
  if (e.set(n, t), Array.isArray(n) && Array.isArray(t)) {
739
781
  if (n.length !== t.length) return !1;
740
782
  for (let r = 0; r < n.length; r++)
741
- if (!vt(n[r], t[r], e)) return !1;
783
+ if (!$t(n[r], t[r], e)) return !1;
742
784
  return !0;
743
785
  }
744
786
  const s = Reflect.ownKeys(n);
@@ -746,7 +788,7 @@ const vt = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
746
788
  for (const r of s) {
747
789
  if (!Reflect.has(t, r)) return !1;
748
790
  const o = n[r], i = t[r];
749
- if (!vt(o, i, e)) return !1;
791
+ if (!$t(o, i, e)) return !1;
750
792
  }
751
793
  return !0;
752
794
  }, Ft = (n) => {
@@ -770,7 +812,7 @@ const vt = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
770
812
  const e = Ft(n);
771
813
  let s = n;
772
814
  for (; s; ) {
773
- const r = F.get(s);
815
+ const r = B.get(s);
774
816
  r && r.forEach((i) => {
775
817
  var h;
776
818
  if (!i.active) return;
@@ -802,10 +844,10 @@ function Ve(n, t, e = {}) {
802
844
  return ["push", "pop", "shift", "unshift", "splice"].forEach((m) => {
803
845
  $[m] = function(...y) {
804
846
  if (!d) return;
805
- const g = W.get(d) || 0;
806
- W.set(d, g + 1);
847
+ const g = F.get(d) || 0;
848
+ F.set(d, g + 1);
807
849
  const b = f[m].apply(f, y);
808
- if (W.set(d, g), m === "push")
850
+ if (F.set(d, g), m === "push")
809
851
  N(d, { type: "array-push", index: f.length - y.length, values: y });
810
852
  else if (m === "unshift")
811
853
  N(d, { type: "array-push", index: 0, values: y });
@@ -814,18 +856,18 @@ function Ve(n, t, e = {}) {
814
856
  else if (m === "shift")
815
857
  N(d, { type: "array-splice", index: 0, deleteCount: 1, insert: [] });
816
858
  else if (m === "splice") {
817
- const [E, x, ...R] = y;
818
- N(d, { type: "array-splice", index: E, deleteCount: x, insert: R });
859
+ const [E, S, ...R] = y;
860
+ N(d, { type: "array-splice", index: E, deleteCount: S, insert: R });
819
861
  }
820
862
  return b;
821
863
  };
822
864
  }), ["sort", "reverse", "fill", "copyWithin"].forEach((m) => {
823
865
  $[m] = function(...y) {
824
866
  if (!d) return;
825
- const g = W.get(d) || 0;
826
- W.set(d, g + 1);
867
+ const g = F.get(d) || 0;
868
+ F.set(d, g + 1);
827
869
  const b = f[m].apply(f, y);
828
- return W.set(d, g), N(d, { type: "array-reset", method: m }), b;
870
+ return F.set(d, g), N(d, { type: "array-reset", method: m }), b;
829
871
  };
830
872
  }), ["indexOf", "lastIndexOf", "includes"].forEach((m) => {
831
873
  $[m] = function(y, ...g) {
@@ -834,42 +876,42 @@ function Ve(n, t, e = {}) {
834
876
  };
835
877
  }), $;
836
878
  }, u = (f, d, $) => {
837
- if (!Object.isExtensible(f) || Dt(f) || f[ct])
879
+ if (!Object.isExtensible(f) || Dt(f) || f[ut])
838
880
  return f;
839
881
  const m = Tt.get(f);
840
882
  if (m)
841
883
  return m;
842
884
  const y = {
843
- get(b, E, x) {
844
- if (E === ct) return b;
885
+ get(b, E, S) {
886
+ if (E === ut) return b;
845
887
  if (Array.isArray(b)) {
846
888
  const L = Wt.get(g);
847
889
  if (L && Object.prototype.hasOwnProperty.call(L, E))
848
- return Reflect.get(L, E, x);
890
+ return Reflect.get(L, E, S);
849
891
  }
850
- const R = Reflect.get(b, E, x);
851
- return typeof E == "symbol" ? R : V(R) && !Dt(R) ? u(R, g, E) : R;
892
+ const R = Reflect.get(b, E, S);
893
+ return typeof E == "symbol" ? R : j(R) && !Dt(R) ? u(R, g, E) : R;
852
894
  },
853
- set(b, E, x, R) {
895
+ set(b, E, S, R) {
854
896
  const L = b[E];
855
- if (i ? vt(L, x) : L === x) return !0;
856
- const et = Reflect.set(b, E, x, R);
857
- return (W.get(g) || 0) === 0 && (Array.isArray(L) && Array.isArray(x) ? N(g, { type: "array-replace", oldValue: L, newValue: x }) : N(g, { type: "set", key: E, newValue: x, oldValue: L })), et;
897
+ if (i ? $t(L, S) : L === S) return !0;
898
+ const st = Reflect.set(b, E, S, R);
899
+ return (F.get(g) || 0) === 0 && (Array.isArray(L) && Array.isArray(S) ? N(g, { type: "array-replace", oldValue: L, newValue: S }) : N(g, { type: "set", key: E, newValue: S, oldValue: L })), st;
858
900
  },
859
901
  deleteProperty(b, E) {
860
902
  if (!Reflect.has(b, E)) return !1;
861
- const x = b[E], R = Reflect.deleteProperty(b, E), L = W.get(g) || 0;
862
- return R && L === 0 && N(g, { type: "delete", key: E, oldValue: x }), R;
903
+ const S = b[E], R = Reflect.deleteProperty(b, E), L = F.get(g) || 0;
904
+ return R && L === 0 && N(g, { type: "delete", key: E, oldValue: S }), R;
863
905
  }
864
906
  }, g = new Proxy(f, y);
865
907
  return Tt.set(f, g), At.set(g, { parent: d, key: $ }), Array.isArray(f) && Wt.set(g, h(f, g)), g;
866
908
  }, p = u(n, null, null);
867
- let v = F.get(p);
868
- if (v || (v = /* @__PURE__ */ new Set(), F.set(p, v)), v.add(c), o) {
909
+ let v = B.get(p);
910
+ if (v || (v = /* @__PURE__ */ new Set(), B.set(p, v)), v.add(c), o) {
869
911
  const f = (d, $, m = /* @__PURE__ */ new WeakSet()) => {
870
- !V(d) || m.has(d) || (m.add(d), Reflect.ownKeys(d).forEach((y) => {
912
+ !j(d) || m.has(d) || (m.add(d), Reflect.ownKeys(d).forEach((y) => {
871
913
  const g = d[y];
872
- V(g) && m.has(g) || (N($, { type: "set", key: y, newValue: g, oldValue: void 0 }), V(g) && f(g, u(g, $, y), m));
914
+ j(g) && m.has(g) || (N($, { type: "set", key: y, newValue: g, oldValue: void 0 }), j(g) && f(g, u(g, $, y), m));
873
915
  }));
874
916
  };
875
917
  f(n, p);
@@ -878,24 +920,24 @@ function Ve(n, t, e = {}) {
878
920
  proxy: p,
879
921
  unobserve: () => {
880
922
  c.active = !1, c.pending = [], c.timer && (clearTimeout(c.timer), c.timer = null);
881
- const f = F.get(p);
923
+ const f = B.get(p);
882
924
  f && f.delete(c);
883
925
  },
884
926
  resume: () => {
885
927
  if (c.active) return;
886
928
  c.active = !0;
887
- let f = F.get(p);
888
- f || (f = /* @__PURE__ */ new Set(), F.set(p, f)), f.has(c) || f.add(c);
929
+ let f = B.get(p);
930
+ f || (f = /* @__PURE__ */ new Set(), B.set(p, f)), f.has(c) || f.add(c);
889
931
  },
890
932
  dispose: () => {
891
933
  c.active = !1, c.pending = [], c.timer && (clearTimeout(c.timer), c.timer = null);
892
- const f = F.get(p);
934
+ const f = B.get(p);
893
935
  f && f.delete(c), c.callback = () => {
894
936
  }, c.onBatch = void 0;
895
937
  }
896
938
  };
897
939
  }
898
- const rt = Symbol("solely.irCtx"), it = Symbol("solely.irEvents"), O = Symbol.for("solely.irMeta"), gt = Symbol("solely.prevClassObj"), yt = Symbol("solely.prevStyleObj"), Be = {
940
+ const ot = Symbol("solely.irCtx"), at = Symbol("solely.irEvents"), O = Symbol.for("solely.irMeta"), yt = Symbol("solely.prevClassObj"), bt = Symbol("solely.prevStyleObj"), Be = {
899
941
  xml: "http://www.w3.org/XML/1998/namespace",
900
942
  xlink: "http://www.w3.org/1999/xlink",
901
943
  xmlns: "http://www.w3.org/2000/xmlns/"
@@ -909,28 +951,28 @@ const rt = Symbol("solely.irCtx"), it = Symbol("solely.irEvents"), O = Symbol.fo
909
951
  "value",
910
952
  "selectedIndex"
911
953
  ]);
912
- function qe(n, t) {
954
+ function Ue(n, t) {
913
955
  var s;
914
956
  const e = (s = t.attrs) == null ? void 0 : s.find((r) => r.key === "class" && !r.dynamic);
915
957
  e != null && e.value && n.setAttribute("class", e.value);
916
958
  }
917
- function ze(n, t) {
959
+ function qe(n, t) {
918
960
  var o;
919
961
  if (!n.style) return;
920
- const s = (o = t.attrs) == null ? void 0 : o.find((i) => i.key === "style" && !i.dynamic), r = s ? zt(s.value) : {};
962
+ const s = (o = t.attrs) == null ? void 0 : o.find((i) => i.key === "style" && !i.dynamic), r = s ? qt(s.value) : {};
921
963
  for (const i in r) {
922
964
  const l = r[i];
923
965
  i.startsWith("--") ? n.style.setProperty(i, l) : n.style[i] = l;
924
966
  }
925
967
  }
926
- const Ue = (n, t) => {
927
- const e = n, s = zt(t), r = e[yt];
968
+ const ze = (n, t) => {
969
+ const e = n, s = qt(t), r = e[bt];
928
970
  if (!r) {
929
971
  for (const i in s) {
930
972
  const l = s[i];
931
973
  i.startsWith("--") ? n.style.setProperty(i, l) : n.style[i] = l;
932
974
  }
933
- e[yt] = s;
975
+ e[bt] = s;
934
976
  return;
935
977
  }
936
978
  let o = !1;
@@ -940,13 +982,13 @@ const Ue = (n, t) => {
940
982
  const l = s[i], a = r[i];
941
983
  l !== a && (i.startsWith("--") ? n.style.setProperty(i, l) : n.style[i] = l, o = !0);
942
984
  }
943
- o && (e[yt] = s);
985
+ o && (e[bt] = s);
944
986
  }, Ke = (n, t) => {
945
- const e = n, s = e[gt], r = He(t);
987
+ const e = n, s = e[yt], r = He(t);
946
988
  if (!s) {
947
989
  for (const i in r)
948
990
  n.classList.add(i);
949
- e[gt] = r;
991
+ e[yt] = r;
950
992
  return;
951
993
  }
952
994
  let o = !1;
@@ -954,9 +996,9 @@ const Ue = (n, t) => {
954
996
  r[i] || (n.classList.remove(i), o = !0);
955
997
  for (const i in r)
956
998
  s[i] || (n.classList.add(i), o = !0);
957
- o && (e[gt] = r);
999
+ o && (e[yt] = r);
958
1000
  };
959
- function zt(n) {
1001
+ function qt(n) {
960
1002
  const t = {}, e = [[n]];
961
1003
  for (; e.length; ) {
962
1004
  const [s, r] = e.pop();
@@ -1007,7 +1049,7 @@ function He(n) {
1007
1049
  }
1008
1050
  return t;
1009
1051
  }
1010
- function $t(n, t, e) {
1052
+ function St(n, t, e) {
1011
1053
  const s = e == null ? "" : String(e), r = t.indexOf(":");
1012
1054
  if (r > 0) {
1013
1055
  const o = t.slice(0, r), i = Be[o];
@@ -1021,7 +1063,7 @@ function $t(n, t, e) {
1021
1063
  function Bt(n, t, e) {
1022
1064
  const s = Vt[t] || t;
1023
1065
  if (t.startsWith("data-") || t.startsWith("aria-") || je.has(t)) {
1024
- $t(n, t, e);
1066
+ St(n, t, e);
1025
1067
  return;
1026
1068
  }
1027
1069
  const r = n, o = r.tagName;
@@ -1047,12 +1089,12 @@ function Bt(n, t, e) {
1047
1089
  r[s] = e;
1048
1090
  return;
1049
1091
  }
1050
- (n instanceof SVGElement || r.ownerSVGElement !== void 0) && !Vt[t] ? $t(n, t, e) : r[s] !== e && (r[s] = e);
1092
+ (n instanceof SVGElement || r.ownerSVGElement !== void 0) && !Vt[t] ? St(n, t, e) : r[s] !== e && (r[s] = e);
1051
1093
  }
1052
1094
  class Ye {
1053
1095
  constructor(t, e, s = {}) {
1054
- S(this, "nodeMap", /* @__PURE__ */ new Map());
1055
- S(this, "marker", !1);
1096
+ x(this, "nodeMap", /* @__PURE__ */ new Map());
1097
+ x(this, "marker", !1);
1056
1098
  this.ir = t, this.container = e, this.scope = s;
1057
1099
  }
1058
1100
  evalIR(t, e, s) {
@@ -1080,9 +1122,9 @@ class Ye {
1080
1122
  // ================ 属性全量应用(创建或更新时用) ================
1081
1123
  applyAttrs(t, e, s, r = !1) {
1082
1124
  const o = [], i = t;
1083
- i[rt] || (i[rt] = {
1125
+ i[ot] || (i[ot] = {
1084
1126
  loops: null
1085
- }), i[rt].loops = s, i[it] || (i[it] = /* @__PURE__ */ Object.create(null));
1127
+ }), i[ot].loops = s, i[at] || (i[at] = /* @__PURE__ */ Object.create(null));
1086
1128
  let l, a = !1, c, h = !1;
1087
1129
  for (const u of e) {
1088
1130
  const { key: p, fid: v, dynamic: f, value: d } = u;
@@ -1099,19 +1141,19 @@ class Ye {
1099
1141
  const $ = p[0];
1100
1142
  if ($ === "@") {
1101
1143
  const y = p.slice(1), g = u.role ?? "user";
1102
- let b = i[it][y];
1103
- if (b || (b = i[it][y] = {
1144
+ let b = i[at][y];
1145
+ if (b || (b = i[at][y] = {
1104
1146
  model: [],
1105
1147
  user: []
1106
1148
  }, t.addEventListener(y, (E) => {
1107
- for (const x of b.model)
1108
- x(E);
1109
- for (const x of b.user)
1110
- x(E);
1149
+ for (const S of b.model)
1150
+ S(E);
1151
+ for (const S of b.user)
1152
+ S(E);
1111
1153
  })), !r) {
1112
- const E = (x) => this.evalIR(
1154
+ const E = (S) => this.evalIR(
1113
1155
  v,
1114
- [x, i[rt].loops],
1156
+ [S, i[ot].loops],
1115
1157
  u[O]
1116
1158
  );
1117
1159
  b[g].push(E);
@@ -1138,9 +1180,9 @@ class Ye {
1138
1180
  if ($ === ":") {
1139
1181
  const y = p.slice(1);
1140
1182
  t.tagName === "SELECT" && Ge.has(y) ? o.push(() => Bt(t, y, m)) : Bt(t, y, m);
1141
- } else r || $t(t, p, String(m));
1183
+ } else r || St(t, p, String(m));
1142
1184
  }
1143
- return a && Ke(t, l), h && Ue(t, c), o;
1185
+ return a && Ke(t, l), h && ze(t, c), o;
1144
1186
  }
1145
1187
  // ================ 更新已有节点 Text Or Comment ================
1146
1188
  updateNode(t, e, s) {
@@ -1166,7 +1208,7 @@ class Ye {
1166
1208
  } else
1167
1209
  switch (t.type) {
1168
1210
  case w.Element:
1169
- a = this.createElement(t, r), qe(a, t), ze(a, t);
1211
+ a = this.createElement(t, r), Ue(a, t), qe(a, t);
1170
1212
  const v = this.applyAttrs(a, t.attrs ?? [], o);
1171
1213
  r.appendChild(a), this.nodeMap.set(i, { irNode: t, node: a, loops: o, marker: this.marker }), (h = t.children) == null || h.forEach((f, d) => {
1172
1214
  this.irToNode(f, d, i, a, o);
@@ -1191,8 +1233,8 @@ class Ye {
1191
1233
  $.forEach((y, g) => {
1192
1234
  var E;
1193
1235
  const b = [...o, { itmVal: y, idxVal: g }];
1194
- (E = t.children) == null || E.forEach((x, R) => {
1195
- this.irToNode(x, R, `${i}-for-${g}`, m, b);
1236
+ (E = t.children) == null || E.forEach((S, R) => {
1237
+ this.irToNode(S, R, `${i}-for-${g}`, m, b);
1196
1238
  });
1197
1239
  }), d.parentNode.insertBefore(m, d);
1198
1240
  break;
@@ -1257,27 +1299,27 @@ const Ze = (n, t, e = {}) => {
1257
1299
  destroy: () => s.destroy()
1258
1300
  };
1259
1301
  }, jt = Symbol.for("solely.manifest");
1260
- var T, D, z, Q, U, B, K, H, j, tt, k, Ut, xt, Kt, Ht, St, at, Yt, Zt, kt, Rt;
1261
- class lt extends HTMLElement {
1302
+ var W, V, K, et, H, G, Y, Z, U, nt, k, zt, xt, Kt, Ht, kt, lt, Yt, Zt, Ct;
1303
+ const tt = class tt extends HTMLElement {
1262
1304
  /* -------------------- 构造 -------------------- */
1263
1305
  constructor(e = {}) {
1264
1306
  var o;
1265
1307
  super();
1266
- M(this, k);
1267
- M(this, T);
1268
- M(this, D);
1269
- M(this, z);
1270
- M(this, Q);
1271
- M(this, U);
1272
- M(this, B);
1273
- M(this, K, !1);
1274
- M(this, H, !1);
1275
- M(this, j, !1);
1276
- M(this, tt, !1);
1308
+ P(this, k);
1309
+ P(this, W);
1310
+ P(this, V);
1311
+ P(this, K);
1312
+ P(this, et);
1313
+ P(this, H);
1314
+ P(this, G);
1315
+ P(this, Y, !1);
1316
+ P(this, Z, !1);
1317
+ P(this, U, !1);
1318
+ P(this, nt, !1);
1277
1319
  const s = this.constructor;
1278
- A(this, T, s[jt] || { tagName: "base-element" });
1279
- const r = C(this, T);
1280
- A(this, U, (o = r.shadowDOM) != null && o.use ? this.attachShadow({ mode: r.shadowDOM.mode || "open" }) : this), I(this, k, xt).call(this, e), I(this, k, Ht).call(this, r), queueMicrotask(() => I(this, k, kt).call(this));
1320
+ A(this, W, s[jt] || { tagName: "base-element" });
1321
+ const r = C(this, W);
1322
+ A(this, H, (o = r.shadowDOM) != null && o.use ? this.attachShadow({ mode: r.shadowDOM.mode || "open" }) : this), M(this, k, xt).call(this, e), M(this, k, Ht).call(this, r), queueMicrotask(() => M(this, k, Ct).call(this));
1281
1323
  }
1282
1324
  // 需要在元素定义前设置的属性列表(Upgrade Property)
1283
1325
  /* -------------------- observedAttributes -------------------- */
@@ -1287,47 +1329,47 @@ class lt extends HTMLElement {
1287
1329
  }
1288
1330
  /* -------------------- $data -------------------- */
1289
1331
  get $data() {
1290
- return C(this, Q);
1332
+ return C(this, et);
1291
1333
  }
1292
1334
  set $data(e) {
1293
1335
  var s;
1294
- V(e) || (e = {}), (s = C(this, B)) == null || s.call(this), I(this, k, xt).call(this, e), I(this, k, at).call(this);
1336
+ j(e) || (e = {}), (s = C(this, G)) == null || s.call(this), M(this, k, xt).call(this, e), M(this, k, lt).call(this);
1295
1337
  }
1296
1338
  refresh() {
1297
- I(this, k, at).call(this);
1339
+ M(this, k, lt).call(this);
1298
1340
  }
1299
1341
  /* -------------------- 生命周期 -------------------- */
1300
1342
  connectedCallback() {
1301
1343
  var l;
1302
1344
  const s = this.constructor.upgradeProps;
1303
1345
  let r;
1304
- Array.isArray(s) ? r = s.includes("$data") ? s : [...s, "$data"] : r = ["$data"], I(this, k, Ut).call(this, r), I(this, k, kt).call(this);
1305
- const o = C(this, T);
1306
- if ((o.className || o.tagName || "").split(" ").forEach((a) => a && this.classList.add(a)), I(this, k, Zt).call(this), o.propMap && V(this.$data))
1346
+ Array.isArray(s) ? r = s.includes("$data") ? s : [...s, "$data"] : r = ["$data"], M(this, k, zt).call(this, r), M(this, k, Ct).call(this);
1347
+ const o = C(this, W);
1348
+ if ((o.className || o.tagName || "").split(" ").forEach((a) => a && this.classList.add(a)), M(this, k, Zt).call(this), o.propMap && j(this.$data))
1307
1349
  for (const [a, c] of o.propMap) {
1308
1350
  const h = c.name;
1309
1351
  if (this.hasAttribute(a)) {
1310
- const u = this.getAttribute(a), p = I(this, k, St).call(this, u, c.default, c.type);
1352
+ const u = this.getAttribute(a), p = M(this, k, kt).call(this, u, c.default, c.type);
1311
1353
  this.$data[h] = p;
1312
1354
  } else "default" in c && (this.$data[h] = c.default);
1313
1355
  }
1314
- C(this, z) && A(this, D, Ze(
1315
- C(this, z),
1316
- C(this, U),
1356
+ C(this, K) && A(this, V, Ze(
1357
+ C(this, K),
1358
+ C(this, H),
1317
1359
  this
1318
1360
  )), this.mounted(), (l = this.onInit) == null || l.call(this);
1319
1361
  }
1320
1362
  disconnectedCallback() {
1321
1363
  var e, s, r;
1322
- this.unmounted(), (e = C(this, B)) == null || e.call(this), A(this, B, void 0), (r = (s = C(this, D)) == null ? void 0 : s.destroy) == null || r.call(s), A(this, D, null);
1364
+ this.unmounted(), (e = C(this, G)) == null || e.call(this), A(this, G, void 0), (r = (s = C(this, V)) == null ? void 0 : s.destroy) == null || r.call(s), A(this, V, null);
1323
1365
  }
1324
1366
  attributeChangedCallback(e, s, r) {
1325
1367
  var h;
1326
- if (s === r || !V(this.$data)) return;
1327
- const i = (h = C(this, T).propMap) == null ? void 0 : h.get(e);
1368
+ if (s === r || !j(this.$data)) return;
1369
+ const i = (h = C(this, W).propMap) == null ? void 0 : h.get(e);
1328
1370
  if (!i) return;
1329
- const l = i.name, a = this.$data[l], c = I(this, k, St).call(this, r, i.default ?? a, i.type);
1330
- this.$data[l] = c, A(this, j, !0), this.attributeChanged(e, a, c);
1371
+ const l = i.name, a = this.$data[l], c = M(this, k, kt).call(this, r, i.default ?? a, i.type);
1372
+ this.$data[l] = c, A(this, U, !0), this.attributeChanged(e, a, c);
1331
1373
  }
1332
1374
  /* -------------------- 事件派发 -------------------- */
1333
1375
  emit(e, s, r) {
@@ -1359,9 +1401,9 @@ class lt extends HTMLElement {
1359
1401
  }
1360
1402
  afterAttributesUpdate() {
1361
1403
  }
1362
- }
1363
- T = new WeakMap(), D = new WeakMap(), z = new WeakMap(), Q = new WeakMap(), U = new WeakMap(), B = new WeakMap(), K = new WeakMap(), H = new WeakMap(), j = new WeakMap(), tt = new WeakMap(), k = new WeakSet(), // 升级属性(Upgrade Property), 保障在元素被定义前设置的属性能正确触发响应式更新
1364
- Ut = function(e) {
1404
+ };
1405
+ W = new WeakMap(), V = new WeakMap(), K = new WeakMap(), et = new WeakMap(), H = new WeakMap(), G = new WeakMap(), Y = new WeakMap(), Z = new WeakMap(), U = new WeakMap(), nt = new WeakMap(), k = new WeakSet(), // 升级属性(Upgrade Property), 保障在元素被定义前设置的属性能正确触发响应式更新
1406
+ zt = function(e) {
1365
1407
  for (const s of e)
1366
1408
  if (this.hasOwnProperty(s)) {
1367
1409
  const r = this[s];
@@ -1372,17 +1414,17 @@ xt = function(e) {
1372
1414
  const { proxy: s, dispose: r } = Ve(e, (o) => {
1373
1415
  var i, l;
1374
1416
  if (o.type === "set") {
1375
- const { key: a, newValue: c } = o, h = C(this, T), u = String(a), p = ((i = h.propMap) == null ? void 0 : i.get(
1417
+ const { key: a, newValue: c } = o, h = C(this, W), u = String(a), p = ((i = h.propMap) == null ? void 0 : i.get(
1376
1418
  u.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()
1377
1419
  )) || Array.from(((l = h.propMap) == null ? void 0 : l.values()) || []).find((v) => v.name === u);
1378
- p != null && p.reflect && I(this, k, Kt).call(this, p, c);
1420
+ p != null && p.reflect && M(this, k, Kt).call(this, p, c);
1379
1421
  }
1380
1422
  this.emit("change", {
1381
1423
  source: "state",
1382
1424
  ...o
1383
- }), I(this, k, at).call(this);
1425
+ }), M(this, k, lt).call(this);
1384
1426
  });
1385
- A(this, Q, s), A(this, B, r);
1427
+ A(this, et, s), A(this, G, r);
1386
1428
  }, Kt = function(e, s) {
1387
1429
  const r = e.name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
1388
1430
  if (e.type === "boolean")
@@ -1392,8 +1434,8 @@ xt = function(e) {
1392
1434
  this.setAttribute(r, o);
1393
1435
  }
1394
1436
  }, Ht = function(e) {
1395
- e.ir && A(this, z, e.ir);
1396
- }, St = function(e, s, r) {
1437
+ e.ir && A(this, K, e.ir);
1438
+ }, kt = function(e, s, r) {
1397
1439
  if (e === null)
1398
1440
  return r === "boolean" ? s ?? !1 : s;
1399
1441
  switch (r) {
@@ -1413,16 +1455,16 @@ xt = function(e) {
1413
1455
  return e;
1414
1456
  }
1415
1457
  }, /* -------------------- 刷新调度 -------------------- */
1416
- at = function() {
1417
- C(this, H) || !C(this, D) || (A(this, H, !0), queueMicrotask(() => {
1418
- A(this, H, !1), I(this, k, Yt).call(this);
1458
+ lt = function() {
1459
+ C(this, Z) || !C(this, V) || (A(this, Z, !0), queueMicrotask(() => {
1460
+ A(this, Z, !1), M(this, k, Yt).call(this);
1419
1461
  }));
1420
1462
  }, Yt = function() {
1421
- C(this, K) || !this.isConnected || (A(this, K, !0), C(this, j) && this.beforeAttributesUpdate(), this.beforeUpdate(), C(this, D).update(), this.updated(), C(this, j) && (this.afterAttributesUpdate(), A(this, j, !1)), A(this, K, !1));
1463
+ C(this, Y) || !this.isConnected || (A(this, Y, !0), C(this, U) && this.beforeAttributesUpdate(), this.beforeUpdate(), C(this, V).update(), this.updated(), C(this, U) && (this.afterAttributesUpdate(), A(this, U, !1)), A(this, Y, !1));
1422
1464
  }, Zt = function() {
1423
- const e = C(this, T);
1465
+ const e = C(this, W);
1424
1466
  if (!e.styles) return;
1425
- const s = C(this, U);
1467
+ const s = C(this, H);
1426
1468
  if (e.sheet && s instanceof ShadowRoot && "adoptedStyleSheets" in s) {
1427
1469
  s.adoptedStyleSheets.includes(e.sheet) || (s.adoptedStyleSheets = [...s.adoptedStyleSheets, e.sheet]);
1428
1470
  return;
@@ -1433,19 +1475,38 @@ at = function() {
1433
1475
  i.id = o, i.textContent = e.styles, r.appendChild(i);
1434
1476
  }
1435
1477
  }, /* -------------------- created 保障 -------------------- */
1436
- kt = function() {
1437
- C(this, tt) || (A(this, tt, !0), this.created());
1438
- }, Rt = new WeakMap(), S(lt, "upgradeProps"), /* -------------------- DEV define 保护 -------------------- */
1439
- M(lt, Rt, !1);
1478
+ Ct = function() {
1479
+ C(this, nt) || (A(this, nt, !0), this.created());
1480
+ }, x(tt, "upgradeProps"), (() => {
1481
+ if (_) {
1482
+ const e = customElements.define, s = /* @__PURE__ */ new WeakSet();
1483
+ customElements.define = function(r, o, i) {
1484
+ if (tt.isPrototypeOf(o) && !s.has(o)) {
1485
+ s.add(o);
1486
+ const l = o.prototype, a = [
1487
+ "connectedCallback",
1488
+ "disconnectedCallback",
1489
+ "attributeChangedCallback"
1490
+ ];
1491
+ for (const c of a)
1492
+ l[c] !== tt.prototype[c] && console.error(
1493
+ `[${r}] 禁止重写 ${c}(),请使用框架钩子`
1494
+ );
1495
+ }
1496
+ return e.call(this, r, o, i);
1497
+ };
1498
+ }
1499
+ })();
1500
+ let ht = tt;
1440
1501
  const Je = Symbol.for("solely.manifest"), Jt = (n) => {
1441
1502
  const t = n;
1442
1503
  return (e) => {
1443
1504
  const { tagName: s } = t;
1444
1505
  if (customElements.get(s))
1445
- return e;
1506
+ return _ && console.warn(`[Solely] 标签名称 "${s}" 已经被注册,跳过重复定义。`), e;
1446
1507
  if (typeof t.template == "string" && !t.ir)
1447
1508
  try {
1448
- const o = _e(t.template);
1509
+ const o = Ne(t.template);
1449
1510
  t.ir = Ae(o, {
1450
1511
  source: t.template,
1451
1512
  filename: s
@@ -1456,9 +1517,9 @@ const Je = Symbol.for("solely.manifest"), Jt = (n) => {
1456
1517
  if (t.styles && !t.sheet && "CSSStyleSheet" in window)
1457
1518
  try {
1458
1519
  const o = new CSSStyleSheet();
1459
- o.replaceSync(t.styles), t.sheet = o;
1460
- } catch (o) {
1461
- console.error(`[Style Error] <${s}>:`, o);
1520
+ typeof o.replaceSync == "function" && (o.replaceSync(t.styles), t.sheet = o);
1521
+ } catch {
1522
+ _ && console.warn(`[Style Warning] <${s}>: CSSStyleSheet 不可用,将使用 style 标签回退方案`);
1462
1523
  }
1463
1524
  if (t.props && !t.propMap) {
1464
1525
  const o = /* @__PURE__ */ new Map();
@@ -1472,26 +1533,26 @@ const Je = Symbol.for("solely.manifest"), Jt = (n) => {
1472
1533
  return r[Je] = t, customElements.define(s, r), r;
1473
1534
  };
1474
1535
  };
1475
- let q = null, Xt;
1536
+ let z = null, Xt;
1476
1537
  const Qt = new Promise((n) => {
1477
1538
  Xt = n;
1478
1539
  });
1479
- function cn(n) {
1480
- return q || (q = new Xe(n), Xt(q), q);
1540
+ function ln(n) {
1541
+ return z || (z = new Xe(n), Xt(z), z);
1481
1542
  }
1482
- function bt() {
1483
- return q;
1543
+ function wt() {
1544
+ return z;
1484
1545
  }
1485
1546
  class Xe {
1486
1547
  constructor(t) {
1487
- S(this, "routes");
1488
- S(this, "base");
1489
- S(this, "mode");
1490
- S(this, "beforeEachGuard");
1491
- S(this, "afterEachGuard");
1492
- S(this, "currentRoute", null);
1493
- S(this, "listeners", /* @__PURE__ */ new Set());
1494
- S(this, "isStarted", !1);
1548
+ x(this, "routes");
1549
+ x(this, "base");
1550
+ x(this, "mode");
1551
+ x(this, "beforeEachGuard");
1552
+ x(this, "afterEachGuard");
1553
+ x(this, "currentRoute", null);
1554
+ x(this, "listeners", /* @__PURE__ */ new Set());
1555
+ x(this, "isStarted", !1);
1495
1556
  this.routes = t.routes, this.base = t.base ?? "/", this.mode = t.mode || "history", this.beforeEachGuard = t.beforeEach, this.afterEachGuard = t.afterEach;
1496
1557
  }
1497
1558
  // --- 核心匹配逻辑 ---
@@ -1660,18 +1721,18 @@ var Qe = Object.getOwnPropertyDescriptor, tn = (n, t, e, s) => {
1660
1721
  (i = n[o]) && (r = i(r) || r);
1661
1722
  return r;
1662
1723
  };
1663
- let ut = class extends lt {
1724
+ let ft = class extends ht {
1664
1725
  constructor() {
1665
1726
  super(...arguments);
1666
- S(this, "unsubscribe");
1667
- S(this, "level", 0);
1668
- S(this, "currentElement", null);
1669
- S(this, "currentTagName", null);
1670
- S(this, "routerAttrs", /* @__PURE__ */ new Set());
1671
- S(this, "prevPropKeys", /* @__PURE__ */ new Set());
1672
- S(this, "scheduled", !1);
1673
- S(this, "cache", /* @__PURE__ */ new Map());
1674
- S(this, "latestLoadId", 0);
1727
+ x(this, "unsubscribe");
1728
+ x(this, "level", 0);
1729
+ x(this, "currentElement", null);
1730
+ x(this, "currentTagName", null);
1731
+ x(this, "routerAttrs", /* @__PURE__ */ new Set());
1732
+ x(this, "prevPropKeys", /* @__PURE__ */ new Set());
1733
+ x(this, "scheduled", !1);
1734
+ x(this, "cache", /* @__PURE__ */ new Map());
1735
+ x(this, "latestLoadId", 0);
1675
1736
  }
1676
1737
  /* -------------------- 生命周期 -------------------- */
1677
1738
  async mounted() {
@@ -1694,7 +1755,7 @@ let ut = class extends lt {
1694
1755
  detectLevel() {
1695
1756
  let t = 0, e = this.parentElement;
1696
1757
  for (; e; )
1697
- e instanceof ut && t++, e = e.parentElement;
1758
+ e instanceof ft && t++, e = e.parentElement;
1698
1759
  this.level = t;
1699
1760
  }
1700
1761
  async loadRoute(t) {
@@ -1762,22 +1823,22 @@ let ut = class extends lt {
1762
1823
  this.currentElement ? this.contains(this.currentElement) && this.removeChild(this.currentElement) : t || (this.innerHTML = ""), this.currentElement = null, this.currentTagName = null, this.routerAttrs.clear(), this.prevPropKeys.clear();
1763
1824
  }
1764
1825
  };
1765
- ut = tn([
1826
+ ft = tn([
1766
1827
  Jt({
1767
1828
  tagName: "router-view"
1768
1829
  // 注意:删除了 shadowDOM 配置,默认为 false
1769
1830
  })
1770
- ], ut);
1771
- const ln = ut;
1831
+ ], ft);
1832
+ const un = ft;
1772
1833
  var en = Object.getOwnPropertyDescriptor, nn = (n, t, e, s) => {
1773
1834
  for (var r = s > 1 ? void 0 : s ? en(t, e) : t, o = n.length - 1, i; o >= 0; o--)
1774
1835
  (i = n[o]) && (r = i(r) || r);
1775
1836
  return r;
1776
1837
  };
1777
- let Ct = class extends lt {
1838
+ let Rt = class extends ht {
1778
1839
  constructor() {
1779
1840
  super(...arguments);
1780
- S(this, "_prefetched", !1);
1841
+ x(this, "_prefetched", !1);
1781
1842
  }
1782
1843
  set to(t) {
1783
1844
  this.$data.to = t, this.updateState();
@@ -1788,13 +1849,13 @@ let Ct = class extends lt {
1788
1849
  async mounted() {
1789
1850
  (await Qt).listen(() => this.updateState()), this.updateState(), this.addEventListener("click", (e) => {
1790
1851
  var r, o;
1791
- e.defaultPrevented || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || e.button !== 0 || (r = e.target.closest("a")) != null && r.getAttribute("target") || (e.preventDefault(), (o = bt()) == null || o.push(this.$data.to));
1852
+ e.defaultPrevented || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || e.button !== 0 || (r = e.target.closest("a")) != null && r.getAttribute("target") || (e.preventDefault(), (o = wt()) == null || o.push(this.$data.to));
1792
1853
  }), this.addEventListener("mouseenter", () => {
1793
1854
  this.prefetchRoute();
1794
1855
  }, { once: !0 });
1795
1856
  }
1796
1857
  updateState() {
1797
- const t = bt();
1858
+ const t = wt();
1798
1859
  if (!t) return;
1799
1860
  this.$data.href = t.resolve(this.$data.to);
1800
1861
  let e = !1;
@@ -1814,11 +1875,11 @@ let Ct = class extends lt {
1814
1875
  // 预加载路由的具体实现
1815
1876
  prefetchRoute() {
1816
1877
  if (this._prefetched || !this.hasAttribute("prefetch")) return;
1817
- const t = bt();
1878
+ const t = wt();
1818
1879
  t && typeof t.prefetch == "function" && (t.prefetch(this.$data.to), this._prefetched = !0);
1819
1880
  }
1820
1881
  };
1821
- Ct = nn([
1882
+ Rt = nn([
1822
1883
  Jt({
1823
1884
  tagName: "router-link",
1824
1885
  // template 中 slot 包裹 label 作为 fallback:
@@ -1852,32 +1913,34 @@ Ct = nn([
1852
1913
  // 注册所有支持的 props
1853
1914
  props: ["to", "active", "exact", "label", "custom", "activeClass", "prefetch"]
1854
1915
  })
1855
- ], Ct);
1856
- const un = Ct;
1916
+ ], Rt);
1917
+ const hn = Rt;
1857
1918
  export {
1858
1919
  w as ASTType,
1859
- lt as BaseElement,
1920
+ ht as BaseElement,
1860
1921
  Jt as CustomElement,
1861
1922
  Ye as IRRenderer,
1923
+ _ as IS_DEV,
1924
+ on as IS_PROD,
1862
1925
  we as LIFECYCLE_ATTRS_MAP,
1863
1926
  Xe as Router,
1864
- un as RouterLink,
1865
- ln as RouterView,
1927
+ hn as RouterLink,
1928
+ un as RouterView,
1866
1929
  Ae as buildIR,
1867
- an as clearIRCache,
1930
+ cn as clearIRCache,
1868
1931
  ce as createFunction,
1869
1932
  Ze as createRender,
1870
- cn as createRouter,
1933
+ ln as createRouter,
1871
1934
  ye as genFunction,
1872
- bt as getRouter,
1935
+ wt as getRouter,
1873
1936
  ve as isLifecycleKind,
1874
- V as isObject,
1937
+ j as isObject,
1875
1938
  We as isProxy,
1876
1939
  be as listeners,
1877
1940
  Ee as mapAttrKeyToLifecycleKind,
1878
1941
  Ve as observe,
1879
- on as parseHashUrl,
1880
- _e as parseHtml,
1942
+ an as parseHashUrl,
1943
+ Ne as parseHtml,
1881
1944
  Qt as routerReady,
1882
1945
  ae as showTemplateError,
1883
1946
  Te as toRaw,