@vtj/parser 0.18.24 → 0.18.25

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.mjs CHANGED
@@ -4,7 +4,7 @@ import vu from "@babel/traverse";
4
4
  import Eu from "@babel/generator";
5
5
  import { BlockModel as Hu } from "@vtj/core";
6
6
  import { GLOBAL_API_MAP as gu, UI_PACKAGES as xe, UI_GLOBAL_API_MAPS as Wu, tsFormatter as nu } from "@vtj/coder";
7
- import { NodeTypes as E } from "@vue/compiler-core";
7
+ import { NodeTypes as w } from "@vue/compiler-core";
8
8
  import { upperFirstCamelCase as ge, unBase64 as ye, uid as su } from "@vtj/base";
9
9
  import Se from "postcss";
10
10
  import * as ve from "sass";
@@ -13,11 +13,11 @@ import * as q from "@babel/types";
13
13
  * Copyright (c) 2026, VTJ.PRO All rights reserved.
14
14
  * @name @vtj/parser
15
15
  * @author CHC chenhuachun1549@dingtalk.com
16
- * @version 0.18.24
16
+ * @version 0.18.25
17
17
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
18
18
  */
19
- const f0 = "0.18.24";
20
- function P(e) {
19
+ const f0 = "0.18.25";
20
+ function M(e) {
21
21
  const { descriptor: u, errors: t } = Uu(e), a = u.template?.content || "", r = !!u.scriptSetup, n = (u.scriptSetup || u.script)?.content || "", s = u.styles.map((i) => i.content);
22
22
  return {
23
23
  template: a,
@@ -174,7 +174,7 @@ function ke(e, u) {
174
174
  return t.length > 0 ? t : null;
175
175
  }
176
176
  function b0(e) {
177
- const u = P(e), t = _(u.script), a = {};
177
+ const u = M(e), t = _(u.script), a = {};
178
178
  return u.styles && (a.css = u.styles[0] || ""), J(t, {
179
179
  CallExpression(r) {
180
180
  const n = r.node.callee?.name;
@@ -201,8 +201,13 @@ function Te(e, u, t) {
201
201
  try {
202
202
  a = _(e);
203
203
  } catch {
204
- const i = "(()=>{", c = i + e + "})";
205
- a = _(c), r = i.length;
204
+ try {
205
+ const i = "(()=>{", c = i + e + "})";
206
+ a = _(c), r = i.length;
207
+ } catch {
208
+ const i = "(()=>(", c = i + e + "))";
209
+ a = _(c), r = i.length;
210
+ }
206
211
  }
207
212
  const n = [];
208
213
  if (J(a, {
@@ -265,7 +270,7 @@ function je(e, u, t, a, r, n) {
265
270
  const b = (c.start ?? 0) - a;
266
271
  if (b < 0 || b > r.length) break;
267
272
  const m = b + p, S = m + u.length;
268
- m >= 0 && S <= r.length && !n.some((w) => w.start === m && w.end === S) && n.push({ start: m, end: S, text: t }), l = p + u.length;
273
+ m >= 0 && S <= r.length && !n.some((v) => v.start === m && v.end === S) && n.push({ start: m, end: S, text: t }), l = p + u.length;
269
274
  }
270
275
  }
271
276
  }
@@ -434,7 +439,7 @@ function Iu(e, u, t) {
434
439
  }
435
440
  return e = e.replace(/_ctx\./g, "this."), e = e.replace(/this\.this\./g, "this."), e;
436
441
  }
437
- function T(e) {
442
+ function k(e) {
438
443
  return {
439
444
  type: "JSExpression",
440
445
  value: /^\{[\w\W]*\}$/.test(e) ? `(${e})` : e
@@ -465,19 +470,19 @@ const Re = [
465
470
  ), _e = "component,slot,template".split(","), Le = "view,swiper,progress,icon,text,button,checkbox,editor,form,input,label,picker,radio,slider,switch,textarea,audio,camera,image,video,map,canvas".split(
466
471
  ","
467
472
  );
468
- function Me(e, u = "web") {
473
+ function Pe(e, u = "web") {
469
474
  return u === "uniapp" && Le.includes(e);
470
475
  }
471
- function zu(e, u = "web") {
472
- return (Ce.includes(e) || _e.includes(e)) && !Me(e, u) ? e : ge(e);
476
+ function Xu(e, u = "web") {
477
+ return (Ce.includes(e) || _e.includes(e)) && !Pe(e, u) ? e : ge(e);
473
478
  }
474
- function Xu(e) {
479
+ function zu(e) {
475
480
  return e.replace(/\s+/g, " ").split(";").reduce((t, a) => {
476
481
  const [r, n] = a.split(":").map((s) => s.trim());
477
482
  return r && n && (t[r] = n), t;
478
483
  }, {});
479
484
  }
480
- function Pe(e, u, t) {
485
+ function Me(e, u, t) {
481
486
  if (t === "ObjectExpression")
482
487
  return `(Object.assign({${e.split(" ").map((r) => `'${r}': true`).join(",")}}, ${u}))`;
483
488
  if (t === "ArrayExpression")
@@ -697,7 +702,7 @@ class Je {
697
702
  let r = a[this.treeIndex], n = (r & W.VALUE_LENGTH) >> 14;
698
703
  for (; t < u.length; t++, this.excess++) {
699
704
  const s = u.charCodeAt(t);
700
- if (this.treeIndex = ze(a, r, this.treeIndex + Math.max(1, n), s), this.treeIndex < 0)
705
+ if (this.treeIndex = Xe(a, r, this.treeIndex + Math.max(1, n), s), this.treeIndex < 0)
701
706
  return this.result === 0 || // If we are parsing an attribute
702
707
  this.decodeMode === O.Attribute && // We shouldn't have consumed any characters after the entity,
703
708
  (n === 0 || // And there should be no invalid characters.
@@ -757,7 +762,7 @@ class Je {
757
762
  }
758
763
  }
759
764
  }
760
- function ze(e, u, t, a) {
765
+ function Xe(e, u, t, a) {
761
766
  const r = (u & W.BRANCH_LENGTH) >> 7, n = u & W.JUMP_TABLE;
762
767
  if (r === 0)
763
768
  return n !== 0 && a === n ? t : -1;
@@ -791,7 +796,7 @@ function U(e) {
791
796
  function au(e) {
792
797
  return e === y.Slash || e === y.Gt || U(e);
793
798
  }
794
- function Xe(e) {
799
+ function ze(e) {
795
800
  return e >= y.LowerA && e <= y.LowerZ || e >= y.UpperA && e <= y.UpperZ;
796
801
  }
797
802
  var B;
@@ -914,7 +919,7 @@ class Ze {
914
919
  * We allow anything that wouldn't end the tag.
915
920
  */
916
921
  isTagStartChar(u) {
917
- return this.xmlMode ? !au(u) : Xe(u);
922
+ return this.xmlMode ? !au(u) : ze(u);
918
923
  }
919
924
  startSpecial(u, t) {
920
925
  this.isSpecial = !0, this.currentSequence = u, this.sequenceIndex = t, this.state = f.SpecialStartSequence;
@@ -1151,7 +1156,7 @@ class Ze {
1151
1156
  this.baseState !== f.Text && this.baseState !== f.InSpecialTag ? (this.sectionStart < this.entityStart && this.cbs.onattribdata(this.sectionStart, this.entityStart), this.sectionStart = this.entityStart + t, this.index = this.sectionStart - 1, this.cbs.onattribentity(u)) : (this.sectionStart < this.entityStart && this.cbs.ontext(this.sectionStart, this.entityStart), this.sectionStart = this.entityStart + t, this.index = this.sectionStart - 1, this.cbs.ontextentity(u, this.sectionStart));
1152
1157
  }
1153
1158
  }
1154
- const X = /* @__PURE__ */ new Set([
1159
+ const z = /* @__PURE__ */ new Set([
1155
1160
  "input",
1156
1161
  "option",
1157
1162
  "optgroup",
@@ -1159,50 +1164,50 @@ const X = /* @__PURE__ */ new Set([
1159
1164
  "button",
1160
1165
  "datalist",
1161
1166
  "textarea"
1162
- ]), k = /* @__PURE__ */ new Set(["p"]), ku = /* @__PURE__ */ new Set(["thead", "tbody"]), Tu = /* @__PURE__ */ new Set(["dd", "dt"]), Nu = /* @__PURE__ */ new Set(["rt", "rp"]), Qe = /* @__PURE__ */ new Map([
1167
+ ]), T = /* @__PURE__ */ new Set(["p"]), ku = /* @__PURE__ */ new Set(["thead", "tbody"]), Tu = /* @__PURE__ */ new Set(["dd", "dt"]), Nu = /* @__PURE__ */ new Set(["rt", "rp"]), Qe = /* @__PURE__ */ new Map([
1163
1168
  ["tr", /* @__PURE__ */ new Set(["tr", "th", "td"])],
1164
1169
  ["th", /* @__PURE__ */ new Set(["th"])],
1165
1170
  ["td", /* @__PURE__ */ new Set(["thead", "th", "td"])],
1166
1171
  ["body", /* @__PURE__ */ new Set(["head", "link", "script"])],
1167
1172
  ["li", /* @__PURE__ */ new Set(["li"])],
1168
- ["p", k],
1169
- ["h1", k],
1170
- ["h2", k],
1171
- ["h3", k],
1172
- ["h4", k],
1173
- ["h5", k],
1174
- ["h6", k],
1175
- ["select", X],
1176
- ["input", X],
1177
- ["output", X],
1178
- ["button", X],
1179
- ["datalist", X],
1180
- ["textarea", X],
1173
+ ["p", T],
1174
+ ["h1", T],
1175
+ ["h2", T],
1176
+ ["h3", T],
1177
+ ["h4", T],
1178
+ ["h5", T],
1179
+ ["h6", T],
1180
+ ["select", z],
1181
+ ["input", z],
1182
+ ["output", z],
1183
+ ["button", z],
1184
+ ["datalist", z],
1185
+ ["textarea", z],
1181
1186
  ["option", /* @__PURE__ */ new Set(["option"])],
1182
1187
  ["optgroup", /* @__PURE__ */ new Set(["optgroup", "option"])],
1183
1188
  ["dd", Tu],
1184
1189
  ["dt", Tu],
1185
- ["address", k],
1186
- ["article", k],
1187
- ["aside", k],
1188
- ["blockquote", k],
1189
- ["details", k],
1190
- ["div", k],
1191
- ["dl", k],
1192
- ["fieldset", k],
1193
- ["figcaption", k],
1194
- ["figure", k],
1195
- ["footer", k],
1196
- ["form", k],
1197
- ["header", k],
1198
- ["hr", k],
1199
- ["main", k],
1200
- ["nav", k],
1201
- ["ol", k],
1202
- ["pre", k],
1203
- ["section", k],
1204
- ["table", k],
1205
- ["ul", k],
1190
+ ["address", T],
1191
+ ["article", T],
1192
+ ["aside", T],
1193
+ ["blockquote", T],
1194
+ ["details", T],
1195
+ ["div", T],
1196
+ ["dl", T],
1197
+ ["fieldset", T],
1198
+ ["figcaption", T],
1199
+ ["figure", T],
1200
+ ["footer", T],
1201
+ ["form", T],
1202
+ ["header", T],
1203
+ ["hr", T],
1204
+ ["main", T],
1205
+ ["nav", T],
1206
+ ["ol", T],
1207
+ ["pre", T],
1208
+ ["section", T],
1209
+ ["table", T],
1210
+ ["ul", T],
1206
1211
  ["rt", Nu],
1207
1212
  ["rp", Nu],
1208
1213
  ["tbody", ku],
@@ -1484,9 +1489,9 @@ function qu(e, u = "web") {
1484
1489
  },
1485
1490
  {}
1486
1491
  );
1487
- d.style && (d.style = Xu(d.style));
1492
+ d.style && (d.style = zu(d.style));
1488
1493
  const l = {
1489
- name: zu(s, u),
1494
+ name: Xu(s, u),
1490
1495
  props: d
1491
1496
  };
1492
1497
  Array.isArray(c.children) ? c.children.push(l) : c.children ? c.children = [
@@ -1620,29 +1625,36 @@ function rt(e) {
1620
1625
  const { key: r, value: n } = a;
1621
1626
  if (r.type === "Identifier") {
1622
1627
  const s = A(n);
1623
- t[r.name] = T(s);
1628
+ t[r.name] = k(s);
1624
1629
  }
1625
1630
  } else if (a.type === "ObjectMethod") {
1626
1631
  const { key: r, params: n, body: s } = a;
1627
1632
  if (r.type === "Identifier") {
1628
1633
  const i = A(s), c = `(${n.map((d) => d.name || "none").join(",")}) => ${i}`;
1629
- t[r.name] = T(c);
1634
+ t[r.name] = k(c);
1630
1635
  }
1631
1636
  }
1632
1637
  return t;
1633
1638
  }
1634
- function z(e) {
1639
+ function X(e) {
1635
1640
  const { key: u, async: t, params: a, body: r } = e, n = a?.map((s) => s.type === "ObjectPattern" ? `{${s.properties.map((o) => o.key?.name || o.name).join(",")}}` : s.type === "AssignmentPattern" ? s.left.name + "=" + (s.right?.extra?.raw || "null") : s.name).join(", ");
1636
1641
  if (u.type === "Identifier") {
1637
- const s = u.name;
1638
- let i = "{}";
1639
- r && (i = A(r) || "{}");
1640
- const o = e.value;
1641
- if (o && o.type === "CallExpression") {
1642
- let b = A(o) || "";
1643
- b = b.replace("function () {", "() => {"), i = `{ return (${b})}`;
1644
- }
1645
- const d = `${t ? "async " : ""}(${n}) => ${i}`, l = s.startsWith("watcher_");
1642
+ const s = u.name, i = e.value;
1643
+ if (i && i.type === "ObjectExpression") {
1644
+ const b = A(i), m = s.startsWith("watcher_");
1645
+ return {
1646
+ id: m ? s.replace("watcher_", "") : "",
1647
+ name: s,
1648
+ watcher: m,
1649
+ exp: k(b)
1650
+ };
1651
+ }
1652
+ let o = "{}";
1653
+ if (r && (o = A(r) || "{}"), i && i.type === "CallExpression") {
1654
+ let b = A(i) || "";
1655
+ b = b.replace("function () {", "() => {"), o = `{ return (${b})}`;
1656
+ }
1657
+ const d = `${t ? "async " : ""}(${n}) => ${o}`, l = s.startsWith("watcher_");
1646
1658
  return {
1647
1659
  id: l ? s.replace("watcher_", "") : "",
1648
1660
  name: s,
@@ -1655,7 +1667,7 @@ function Qu(e) {
1655
1667
  if (!e) return {};
1656
1668
  const u = {};
1657
1669
  for (const t of e.properties) {
1658
- const a = z(t);
1670
+ const a = X(t);
1659
1671
  a && !a.watcher && !a.exp.value.includes("this.provider.createMock") && !a.exp.value.includes("this.provider.apis") && (u[a.name] = a.exp);
1660
1672
  }
1661
1673
  return u;
@@ -1673,7 +1685,7 @@ function nt(e, u) {
1673
1685
  return n.substring(s + 6, o - 1).trim();
1674
1686
  };
1675
1687
  for (const n of e.properties) {
1676
- const s = z(n), i = n.body.body?.[0], o = (i?.leadingComments?.[0].value || "").trim(), c = Zu(o);
1688
+ const s = X(n), i = n.body.body?.[0], o = (i?.leadingComments?.[0].value || "").trim(), c = Zu(o);
1677
1689
  if (s && s.exp.value.includes("this.provider.apis")) {
1678
1690
  const l = (s.exp.value.match(a) || [])[1];
1679
1691
  if (!l) continue;
@@ -1731,7 +1743,10 @@ function nt(e, u) {
1731
1743
  function st(e) {
1732
1744
  const u = Qu(e), t = /\_([\w]{5,})$/, a = {};
1733
1745
  for (const r of Object.keys(u))
1734
- t.test(r) || (a[r] = u[r]);
1746
+ if (!t.test(r)) {
1747
+ const n = u[r];
1748
+ n && (a[r] = n);
1749
+ }
1735
1750
  return a;
1736
1751
  }
1737
1752
  function it(e) {
@@ -1747,7 +1762,7 @@ function it(e) {
1747
1762
  );
1748
1763
  u[r] = C(n);
1749
1764
  } else
1750
- u[r] = z(a)?.exp;
1765
+ u[r] = X(a)?.exp;
1751
1766
  } catch (n) {
1752
1767
  console.warn(n);
1753
1768
  }
@@ -1758,7 +1773,7 @@ function ct(e) {
1758
1773
  if (!e) return {};
1759
1774
  const u = {};
1760
1775
  for (const t of e.properties) {
1761
- const a = z(t);
1776
+ const a = X(t);
1762
1777
  a && a.watcher && (u[a.name] = a.exp);
1763
1778
  }
1764
1779
  return u;
@@ -1776,7 +1791,7 @@ function Du(e, u) {
1776
1791
  (a) => a.key?.name === u
1777
1792
  );
1778
1793
  if (t)
1779
- return z(t)?.exp;
1794
+ return X(t)?.exp;
1780
1795
  }
1781
1796
  function ot(e, u = {}) {
1782
1797
  const t = [];
@@ -1799,7 +1814,7 @@ function ot(e, u = {}) {
1799
1814
  },
1800
1815
  deep: !1,
1801
1816
  immediate: !1,
1802
- handler: z(a)?.exp
1817
+ handler: X(a)?.exp
1803
1818
  }), a.type === "ObjectProperty") {
1804
1819
  const i = n.properties;
1805
1820
  t.push({
@@ -1821,7 +1836,7 @@ function dt(e) {
1821
1836
  for (const t of e) {
1822
1837
  const a = t.key.name;
1823
1838
  if (Re.includes(a)) {
1824
- const r = z(t);
1839
+ const r = X(t);
1825
1840
  r && (u[r.name] = r.exp);
1826
1841
  }
1827
1842
  }
@@ -1839,7 +1854,7 @@ function Yu(e) {
1839
1854
  (t) => t.key?.name === "default"
1840
1855
  );
1841
1856
  if (u)
1842
- return T(A(u.value));
1857
+ return k(A(u.value));
1843
1858
  }
1844
1859
  function ft(e) {
1845
1860
  if (!e) return [];
@@ -1934,25 +1949,25 @@ function yt(e) {
1934
1949
  function St(e) {
1935
1950
  const u = {};
1936
1951
  for (const t of e) {
1937
- if (t.type === E.ATTRIBUTE)
1952
+ if (t.type === w.ATTRIBUTE)
1938
1953
  if (t.name === "class") {
1939
1954
  const a = t.value?.content || "", r = /[\w]+_[\w]{5,}/, n = a.match(r)?.[0] || "", s = a.split(" ").filter((o) => o !== n), i = te[`.${n}`];
1940
1955
  i && (u.style = i), s.length && (u.class = s.join(" "));
1941
1956
  } else if (t.name === "style") {
1942
1957
  const a = t.value?.content || "";
1943
- a && (u.style = Xu(a));
1958
+ a && (u.style = zu(a));
1944
1959
  } else
1945
1960
  u[t.name] = t.value?.content || "";
1946
- if (t.type === E.DIRECTIVE && t.name === "bind" && (t.exp?.type === E.SIMPLE_EXPRESSION && t.arg?.type === E.SIMPLE_EXPRESSION && (u[t.arg.content] = T(`(${t.exp.content})`)), t.exp?.type === E.COMPOUND_EXPRESSION && t.arg?.type === E.SIMPLE_EXPRESSION))
1961
+ if (t.type === w.DIRECTIVE && t.name === "bind" && (t.exp?.type === w.SIMPLE_EXPRESSION && t.arg?.type === w.SIMPLE_EXPRESSION && (u[t.arg.content] = k(`(${t.exp.content})`)), t.exp?.type === w.COMPOUND_EXPRESSION && t.arg?.type === w.SIMPLE_EXPRESSION))
1947
1962
  if (t.arg.content === "class" && u.class) {
1948
- const a = t.exp.ast.type, r = Pe(
1963
+ const a = t.exp.ast.type, r = Me(
1949
1964
  u.class,
1950
1965
  t.exp.loc.source,
1951
1966
  a
1952
1967
  );
1953
- r && (u[t.arg.content] = T(r));
1968
+ r && (u[t.arg.content] = k(r));
1954
1969
  } else
1955
- u[t.arg.content] = T(
1970
+ u[t.arg.content] = k(
1956
1971
  `(${t.exp.loc.source})`
1957
1972
  );
1958
1973
  }
@@ -1967,7 +1982,7 @@ function vt(e = {}) {
1967
1982
  function Et(e, u = {}) {
1968
1983
  const t = {};
1969
1984
  for (const a of e)
1970
- if (a.type === E.DIRECTIVE && a.name === "on" && a.arg?.type === E.SIMPLE_EXPRESSION) {
1985
+ if (a.type === w.DIRECTIVE && a.name === "on" && a.arg?.type === w.SIMPLE_EXPRESSION) {
1971
1986
  const r = a.modifiers.reduce(
1972
1987
  (c, d) => (d.content && (c[d.content] = !0), c),
1973
1988
  {}
@@ -1982,11 +1997,11 @@ function Et(e, u = {}) {
1982
1997
  modifiers: r
1983
1998
  };
1984
1999
  else {
1985
- const c = a.exp?.ast, d = c?.type, l = d === "CallExpression", p = d === "ArrowFunctionExpression", b = d === "FunctionExpression", m = d === "Identifier", S = d === "MemberExpression", w = !c && /^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/.test(n);
2000
+ const c = a.exp?.ast, d = c?.type, l = d === "CallExpression", p = d === "ArrowFunctionExpression", b = d === "FunctionExpression", m = d === "Identifier", S = d === "MemberExpression", v = !c && /^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/.test(n);
1986
2001
  let h;
1987
2002
  if (l)
1988
- h = T(n);
1989
- else if (m || S || w)
2003
+ h = k(n);
2004
+ else if (m || S || v)
1990
2005
  h = C(n);
1991
2006
  else if (p || b) {
1992
2007
  const g = c?.body, x = c?.params;
@@ -1994,9 +2009,9 @@ function Et(e, u = {}) {
1994
2009
  } else {
1995
2010
  let g = !1;
1996
2011
  try {
1997
- const v = _(n).program.body;
1998
- if (v.length === 1 && v[0].type === "ExpressionStatement") {
1999
- const I = v[0].expression?.type;
2012
+ const E = _(n).program.body;
2013
+ if (E.length === 1 && E[0].type === "ExpressionStatement") {
2014
+ const I = E[0].expression?.type;
2000
2015
  g = I === "ArrowFunctionExpression" || I === "FunctionExpression";
2001
2016
  }
2002
2017
  } catch {
@@ -2004,8 +2019,8 @@ function Et(e, u = {}) {
2004
2019
  if (g)
2005
2020
  h = C(n);
2006
2021
  else {
2007
- const v = /\$event\b/.test(n) ? "($event) => " : "() => ";
2008
- h = C(`${v}${n}`);
2022
+ const E = /\$event\b/.test(n) ? "($event) => " : "() => ";
2023
+ h = C(`${E}${n}`);
2009
2024
  }
2010
2025
  }
2011
2026
  t[a.arg.content] = {
@@ -2019,51 +2034,51 @@ function Et(e, u = {}) {
2019
2034
  }
2020
2035
  function K(e, u) {
2021
2036
  const t = [], a = ["if", "for", "model", "show", "bind", "html"];
2022
- if (u && (e.type === E.IF_BRANCH || e.type === E.IF) && u.forEach((r, n) => {
2037
+ if (u && (e.type === w.IF_BRANCH || e.type === w.IF) && u.forEach((r, n) => {
2023
2038
  if (e === r) {
2024
2039
  const s = n === 0 ? "vIf" : r.condition ? "vElseIf" : "vElse", i = r.condition?.loc.source || "";
2025
2040
  t.push({
2026
2041
  name: s,
2027
- value: s === "vElse" ? !0 : T(i)
2042
+ value: s === "vElse" ? !0 : k(i)
2028
2043
  });
2029
2044
  const o = e.children?.[0];
2030
- if (o && o.type !== E.FOR) {
2045
+ if (o && o.type !== w.FOR) {
2031
2046
  const c = K(o);
2032
2047
  t.push(...c);
2033
2048
  }
2034
2049
  }
2035
- }), e.type === E.FOR && t.push({
2050
+ }), e.type === w.FOR && t.push({
2036
2051
  name: "vFor",
2037
- value: T(e.source.loc.source),
2052
+ value: k(e.source.loc.source),
2038
2053
  iterator: {
2039
2054
  item: e.valueAlias?.loc.source || "item",
2040
2055
  index: e.keyAlias?.loc.source || "index"
2041
2056
  }
2042
- }), e.type === E.ELEMENT) {
2057
+ }), e.type === w.ELEMENT) {
2043
2058
  const r = e.props.filter(
2044
- (d) => d.type === E.DIRECTIVE
2059
+ (d) => d.type === w.DIRECTIVE
2045
2060
  ), n = r.filter((d) => d.name === "model");
2046
2061
  n.length && n.forEach((d) => {
2047
2062
  t.push({
2048
2063
  name: "vModel",
2049
2064
  arg: d.arg?.content,
2050
- value: T(d.exp?.loc.source || "")
2065
+ value: k(d.exp?.loc.source || "")
2051
2066
  });
2052
2067
  });
2053
2068
  const s = r.find((d) => d.name === "show");
2054
2069
  s && t.push({
2055
2070
  name: "vShow",
2056
- value: T(s.exp?.loc.source || "")
2071
+ value: k(s.exp?.loc.source || "")
2057
2072
  });
2058
2073
  const i = r.find((d) => d.name === "bind" && !d.arg);
2059
2074
  i && t.push({
2060
2075
  name: "vBind",
2061
- value: T(i.exp?.loc.source || "")
2076
+ value: k(i.exp?.loc.source || "")
2062
2077
  });
2063
2078
  const o = r.find((d) => d.name === "html");
2064
2079
  o && t.push({
2065
2080
  name: "vHtml",
2066
- value: T(o.exp?.loc.source || "")
2081
+ value: k(o.exp?.loc.source || "")
2067
2082
  });
2068
2083
  const c = r.filter((d) => !a.includes(d.name));
2069
2084
  for (const d of c) {
@@ -2073,7 +2088,7 @@ function K(e, u) {
2073
2088
  ), p = d.arg?.content || void 0, b = ee[d.name];
2074
2089
  b && t.push({
2075
2090
  name: b,
2076
- value: T(d.exp?.loc.source || ""),
2091
+ value: k(d.exp?.loc.source || ""),
2077
2092
  arg: p,
2078
2093
  modifiers: l
2079
2094
  });
@@ -2083,13 +2098,13 @@ function K(e, u) {
2083
2098
  }
2084
2099
  function ne(e) {
2085
2100
  let u = "";
2086
- if (e.type === E.ELEMENT) {
2101
+ if (e.type === w.ELEMENT) {
2087
2102
  const { props: t = [], tag: a } = e;
2088
2103
  for (const r of t)
2089
2104
  if (r.name === "class") {
2090
2105
  const n = r.value?.content || "", s = new RegExp(`${a}_([\\w]+)`);
2091
2106
  u = n.match(s)?.[1] || "";
2092
- } else if (r.type === E.DIRECTIVE && r.name === "on") {
2107
+ } else if (r.type === w.DIRECTIVE && r.name === "on") {
2093
2108
  const n = r.arg?.loc?.source || "", s = r.exp?.loc?.source || "", i = new RegExp(`${n}_([\\w]+)`);
2094
2109
  u = s.match(i)?.[1] || "";
2095
2110
  }
@@ -2127,7 +2142,7 @@ function hu(e, u) {
2127
2142
  }
2128
2143
  function bu(e, u, t, a) {
2129
2144
  const r = {
2130
- name: zu(e.tag, ou),
2145
+ name: Xu(e.tag, ou),
2131
2146
  from: wt(e.tag),
2132
2147
  props: St(e.props),
2133
2148
  events: Et(e.props, ue),
@@ -2141,52 +2156,52 @@ function It(e = [], u) {
2141
2156
  return e.map((t) => Z(t, u, e));
2142
2157
  }
2143
2158
  function Z(e, u, t) {
2144
- if (e.type === E.ELEMENT)
2159
+ if (e.type === w.ELEMENT)
2145
2160
  return bu(e, u);
2146
- if (e.type === E.IF)
2161
+ if (e.type === w.IF)
2147
2162
  return At(e);
2148
- if (t && e.type === E.IF_BRANCH) {
2163
+ if (t && e.type === w.IF_BRANCH) {
2149
2164
  const a = e.children.find(
2150
- (r) => r.type === E.ELEMENT || r.type === E.FOR
2165
+ (r) => r.type === w.ELEMENT || r.type === w.FOR
2151
2166
  );
2152
2167
  if (a) {
2153
- if (a.type === E.ELEMENT)
2168
+ if (a.type === w.ELEMENT)
2154
2169
  return bu(a, u, e, t);
2155
- if (a.type === E.FOR) {
2170
+ if (a.type === w.FOR) {
2156
2171
  const n = { name: "div", directives: K(e) };
2157
2172
  return tu(n, e.children || []);
2158
2173
  }
2159
2174
  }
2160
2175
  return "";
2161
2176
  }
2162
- if (e.type === E.FOR) {
2177
+ if (e.type === w.FOR) {
2163
2178
  const a = e.children[0];
2164
- if (e.children.length > 1 || a.type !== E.ELEMENT) {
2179
+ if (e.children.length > 1 || a.type !== w.ELEMENT) {
2165
2180
  const n = { name: "span", directives: K(e) };
2166
2181
  return tu(n, e.children);
2167
2182
  } else
2168
2183
  return bu(a, u, e);
2169
2184
  }
2170
- if (e.type === E.TEXT_CALL)
2171
- return e.content.type == E.TEXT ? e.content.content : e.content.type === E.INTERPOLATION ? T(e.content.content.loc.source) : e.content.type === E.COMPOUND_EXPRESSION ? Ru(
2185
+ if (e.type === w.TEXT_CALL)
2186
+ return e.content.type == w.TEXT ? e.content.content : e.content.type === w.INTERPOLATION ? k(e.content.content.loc.source) : e.content.type === w.COMPOUND_EXPRESSION ? Ru(
2172
2187
  e.content.children
2173
2188
  ) : "";
2174
- if (e.type === E.TEXT)
2189
+ if (e.type === w.TEXT)
2175
2190
  return e.content;
2176
- if (e.type === E.INTERPOLATION && (e.content.type === E.SIMPLE_EXPRESSION || e.content.type === E.COMPOUND_EXPRESSION))
2177
- return T(e.content.loc.source);
2178
- if (e.type === E.COMPOUND_EXPRESSION)
2191
+ if (e.type === w.INTERPOLATION && (e.content.type === w.SIMPLE_EXPRESSION || e.content.type === w.COMPOUND_EXPRESSION))
2192
+ return k(e.content.loc.source);
2193
+ if (e.type === w.COMPOUND_EXPRESSION)
2179
2194
  return Ru(
2180
2195
  e.children
2181
2196
  );
2182
- e.type !== E.COMMENT && console.warn("未处理", e.type);
2197
+ e.type !== w.COMMENT && console.warn("未处理", e.type);
2183
2198
  }
2184
2199
  function Ru(e = []) {
2185
2200
  const u = e.filter((a) => typeof a != "string"), t = [];
2186
2201
  for (const a of u)
2187
2202
  t.push({
2188
2203
  name: "span",
2189
- children: a.type === E.TEXT ? a.loc.source : T(a.content?.loc.source)
2204
+ children: a.type === w.TEXT ? a.loc.source : k(a.content?.loc.source)
2190
2205
  });
2191
2206
  return {
2192
2207
  name: "span",
@@ -2196,34 +2211,34 @@ function Ru(e = []) {
2196
2211
  function tu(e, u = []) {
2197
2212
  const t = [];
2198
2213
  for (const a of u)
2199
- if (a.type === E.ELEMENT && a.codegenNode?.value?.arguments) {
2214
+ if (a.type === w.ELEMENT && a.codegenNode?.value?.arguments) {
2200
2215
  const r = a.codegenNode.value.arguments[0];
2201
2216
  if (r) {
2202
2217
  const n = qu(r, ou);
2203
2218
  t.push(...n);
2204
2219
  }
2205
- } else if (a.type === E.ELEMENT && a.tag === "template") {
2220
+ } else if (a.type === w.ELEMENT && a.tag === "template") {
2206
2221
  const r = a.props.find((n) => n.name === "slot");
2207
2222
  for (const n of a.children) {
2208
- const s = n.type === E.TEXT || n.type === E.TEXT_CALL ? {
2223
+ const s = n.type === w.TEXT || n.type === w.TEXT_CALL ? {
2209
2224
  name: "span",
2210
2225
  children: Z(n, e)
2211
2226
  } : Z(n, e);
2212
2227
  s && (Array.isArray(s) ? s : [s]).forEach((o) => {
2213
- Ie(o) && r?.type === E.DIRECTIVE && (o.id = ne(n), o.slot = {
2228
+ Ie(o) && r?.type === w.DIRECTIVE && (o.id = ne(n), o.slot = {
2214
2229
  name: r.arg?.content || "default",
2215
2230
  params: r.exp?.identifiers || [],
2216
- scope: r.exp?.type === E.SIMPLE_EXPRESSION ? r.exp.content : ""
2231
+ scope: r.exp?.type === w.SIMPLE_EXPRESSION ? r.exp.content : ""
2217
2232
  }, hu(o, e)), t.push(o);
2218
2233
  });
2219
2234
  }
2220
- } else if (a.type === E.JS_CALL_EXPRESSION) {
2235
+ } else if (a.type === w.JS_CALL_EXPRESSION) {
2221
2236
  const r = a.arguments?.[0];
2222
2237
  if (r) {
2223
2238
  const n = qu(r, ou);
2224
2239
  t.push(...n);
2225
2240
  }
2226
- } else if (a.type === E.TEXT_CALL) {
2241
+ } else if (a.type === w.TEXT_CALL) {
2227
2242
  const r = Z(a, e);
2228
2243
  r && (Array.isArray(r) ? t.push(...r) : t.push(r));
2229
2244
  } else {
@@ -2244,7 +2259,7 @@ function At(e) {
2244
2259
  const s = { name: "div", directives: K(r, u) };
2245
2260
  return tu(s, r.children || []);
2246
2261
  });
2247
- if (a.length > 1 || a[0] && a[0].type !== E.ELEMENT) {
2262
+ if (a.length > 1 || a[0] && a[0].type !== w.ELEMENT) {
2248
2263
  const n = { name: "div", directives: K(t, u) };
2249
2264
  return tu(n, t.children);
2250
2265
  }
@@ -2324,46 +2339,46 @@ function jt(e, u) {
2324
2339
  if (b.type === "CallExpression") {
2325
2340
  const m = Cu(b);
2326
2341
  if (m === "ref") {
2327
- const w = L(p.id);
2328
- if (w) {
2342
+ const v = L(p.id);
2343
+ if (v) {
2329
2344
  const h = b.arguments[0] ? A(b.arguments[0]) : "undefined";
2330
- s.refs[w] = T(h);
2345
+ s.refs[v] = k(h);
2331
2346
  }
2332
2347
  return;
2333
2348
  }
2334
2349
  if (m === "reactive") {
2335
- const w = L(p.id);
2336
- if (w)
2337
- if (w === "__state")
2350
+ const v = L(p.id);
2351
+ if (v)
2352
+ if (v === "__state")
2338
2353
  s.state = Rt(b.arguments[0]);
2339
2354
  else {
2340
2355
  const h = b.arguments[0] ? A(b.arguments[0]) : "{}";
2341
- s.reactives[w] = T(h);
2356
+ s.reactives[v] = k(h);
2342
2357
  }
2343
2358
  return;
2344
2359
  }
2345
2360
  if (m === "computed") {
2346
- const w = L(p.id);
2347
- if (w) {
2348
- const h = b.arguments[0] ? A(b.arguments[0]) : "() => {}";
2349
- s.computed[w] = C(h);
2350
- }
2361
+ const v = L(p.id);
2362
+ if (v && b.arguments[0]) {
2363
+ const h = b.arguments[0], g = A(h);
2364
+ h.type === "ArrowFunctionExpression" || h.type === "FunctionExpression" ? s.computed[v] = C(g) : s.computed[v] = k(g);
2365
+ } else v && (s.computed[v] = C("() => {}"));
2351
2366
  return;
2352
2367
  }
2353
2368
  if (m === "inject") {
2354
- const w = L(p.id);
2355
- if (w) {
2356
- const h = b.arguments[0], g = b.arguments[1], x = h ? Lu(h) : w;
2369
+ const v = L(p.id);
2370
+ if (v) {
2371
+ const h = b.arguments[0], g = b.arguments[1], x = h ? Lu(h) : v;
2357
2372
  s.inject.push({
2358
- name: w,
2359
- from: x || w,
2360
- default: g ? T(A(g)) : void 0
2373
+ name: v,
2374
+ from: x || v,
2375
+ default: g ? k(A(g)) : void 0
2361
2376
  });
2362
2377
  }
2363
2378
  return;
2364
2379
  }
2365
2380
  if (m === "defineProps" || m === "withDefaults") {
2366
- s.props = Mu(b);
2381
+ s.props = Pu(b);
2367
2382
  return;
2368
2383
  }
2369
2384
  if (m === "defineEmits") {
@@ -2371,22 +2386,22 @@ function jt(e, u) {
2371
2386
  return;
2372
2387
  }
2373
2388
  if (m && /^use[A-Z]/.test(m)) {
2374
- const w = a.get(m);
2375
- if (Dt(m, w)) {
2389
+ const v = a.get(m);
2390
+ if (Dt(m, v)) {
2376
2391
  const x = _u(p.id);
2377
2392
  x.length > 0 && (s.globalApiDestructured ??= [], s.globalApiDestructured.push({ callee: m, destructure: x }));
2378
2393
  return;
2379
2394
  }
2380
2395
  if (m === "useProvider") return;
2381
- if (!w)
2396
+ if (!v)
2382
2397
  continue;
2383
2398
  const h = L(p.id), g = _u(p.id);
2384
2399
  if (h || g.length) {
2385
2400
  if (h && s.composables.some((D) => D.name === h))
2386
2401
  return;
2387
2402
  let x;
2388
- const v = n[w];
2389
- v ? x = `this.$libs.${v}.${m}` : x = m;
2403
+ const E = n[v];
2404
+ E ? x = `this.$libs.${E}.${m}` : x = m;
2390
2405
  const I = {
2391
2406
  name: h || g[0] || m,
2392
2407
  composable: {
@@ -2395,7 +2410,7 @@ function jt(e, u) {
2395
2410
  }
2396
2411
  };
2397
2412
  b.arguments.length > 0 && (I.args = b.arguments.map(
2398
- (D) => T(A(D))
2413
+ (D) => k(A(D))
2399
2414
  )), g.length > 0 && (I.destructure = g), s.composables.push(I);
2400
2415
  }
2401
2416
  return;
@@ -2409,9 +2424,9 @@ function jt(e, u) {
2409
2424
  if (m) {
2410
2425
  const S = A(b);
2411
2426
  if (Bu(S)) {
2412
- const w = Fu(m, S, u);
2413
- if (w) {
2414
- s.dataSources[m] = w;
2427
+ const v = Fu(m, S, u);
2428
+ if (v) {
2429
+ s.dataSources[m] = v;
2415
2430
  return;
2416
2431
  }
2417
2432
  }
@@ -2436,16 +2451,16 @@ function jt(e, u) {
2436
2451
  }) && d.declarations.length > 0) {
2437
2452
  for (const p of d.declarations) {
2438
2453
  const b = L(p.id);
2439
- b && p.init && (s.reactives[b] = T(A(p.init)));
2454
+ b && p.init && (s.reactives[b] = k(A(p.init)));
2440
2455
  }
2441
2456
  return;
2442
2457
  }
2443
2458
  for (const p of d.declarations) {
2444
2459
  const b = p.init;
2445
2460
  if (b) {
2446
- const m = L(p.id) || "(unknown)", S = A(b), w = b.type;
2461
+ const m = L(p.id) || "(unknown)", S = A(b), v = b.type;
2447
2462
  throw new Error(
2448
- `[vtj/parser] 无法处理顶层变量声明 "const ${m} = ${S}":不支持的类型 "${w}"。仅支持 ObjectExpression / ArrayExpression 兜底自动转换为 reactive()。请改用 ref()、reactive()、computed() 或函数声明。`
2463
+ `[vtj/parser] 无法处理顶层变量声明 "const ${m} = ${S}":不支持的类型 "${v}"。仅支持 ObjectExpression / ArrayExpression 兜底自动转换为 reactive()。请改用 ref()、reactive()、computed() 或函数声明。`
2449
2464
  );
2450
2465
  }
2451
2466
  }
@@ -2458,7 +2473,7 @@ function jt(e, u) {
2458
2473
  if (c.parent.type !== "Program") return;
2459
2474
  const d = c.node;
2460
2475
  if (!d.id) return;
2461
- const l = d.id.name, p = Mt(d);
2476
+ const l = d.id.name, p = Pt(d);
2462
2477
  if (Bu(p)) {
2463
2478
  const b = Fu(l, p, u);
2464
2479
  if (b) {
@@ -2500,10 +2515,10 @@ function jt(e, u) {
2500
2515
  if (p === "provide") {
2501
2516
  const m = l.arguments[0], S = l.arguments[1];
2502
2517
  if (m && S) {
2503
- const w = Lu(m);
2504
- if (w) {
2518
+ const v = Lu(m);
2519
+ if (v) {
2505
2520
  const h = A(S);
2506
- S.type === "ArrowFunctionExpression" || S.type === "FunctionExpression" ? s.provide[w] = C(h) : s.provide[w] = T(h);
2521
+ S.type === "ArrowFunctionExpression" || S.type === "FunctionExpression" ? s.provide[v] = C(h) : s.provide[v] = k(h);
2507
2522
  }
2508
2523
  }
2509
2524
  return;
@@ -2513,7 +2528,7 @@ function jt(e, u) {
2513
2528
  return;
2514
2529
  }
2515
2530
  if (p === "defineProps" || p === "withDefaults") {
2516
- s.props = Mu(l);
2531
+ s.props = Pu(l);
2517
2532
  return;
2518
2533
  }
2519
2534
  if (p === "defineEmits") {
@@ -2589,27 +2604,27 @@ function Rt(e) {
2589
2604
  for (const t of e.properties)
2590
2605
  if (t.type === "ObjectProperty") {
2591
2606
  const a = t.key?.name;
2592
- a && (u[a] = T(A(t.value)));
2607
+ a && (u[a] = k(A(t.value)));
2593
2608
  } else if (t.type === "ObjectMethod") {
2594
2609
  const a = t.key?.name;
2595
2610
  if (a) {
2596
2611
  const r = A(t.body), n = t.params.map((s) => s.name || "none").join(",");
2597
- u[a] = T(`(${n}) => ${r}`);
2612
+ u[a] = k(`(${n}) => ${r}`);
2598
2613
  }
2599
2614
  }
2600
2615
  return u;
2601
2616
  }
2602
- function Mu(e) {
2617
+ function Pu(e) {
2603
2618
  if (e.callee.type === "Identifier" && e.callee.name === "withDefaults") {
2604
2619
  const u = e.arguments[0];
2605
2620
  if (u?.type === "CallExpression") {
2606
- const t = Pu(u), a = e.arguments[1];
2621
+ const t = Mu(u), a = e.arguments[1];
2607
2622
  return a?.type === "ObjectExpression" && Ct(t, a), t;
2608
2623
  }
2609
2624
  }
2610
- return Pu(e);
2625
+ return Mu(e);
2611
2626
  }
2612
- function Pu(e) {
2627
+ function Mu(e) {
2613
2628
  const u = e.arguments[0];
2614
2629
  return u ? u.type === "ArrayExpression" ? u.elements.map((t) => t?.type === "StringLiteral" ? t.value : "").filter(Boolean) : u.type === "ObjectExpression" ? u.properties.map((t) => {
2615
2630
  if (t.type !== "ObjectProperty") return null;
@@ -2621,7 +2636,7 @@ function Pu(e) {
2621
2636
  const r = t.value.properties;
2622
2637
  return {
2623
2638
  name: a,
2624
- type: Pt(r),
2639
+ type: Mt(r),
2625
2640
  required: xu(r, "required"),
2626
2641
  default: Ot(r)
2627
2642
  };
@@ -2641,8 +2656,8 @@ function Ct(e, u) {
2641
2656
  const n = e[r];
2642
2657
  typeof n == "string" ? e[r] = {
2643
2658
  name: a,
2644
- default: T(A(t.value))
2645
- } : n.default = T(A(t.value));
2659
+ default: k(A(t.value))
2660
+ } : n.default = k(A(t.value));
2646
2661
  }
2647
2662
  }
2648
2663
  }
@@ -2673,7 +2688,7 @@ function Lt(e) {
2673
2688
  immediate: i
2674
2689
  };
2675
2690
  }
2676
- function Mt(e) {
2691
+ function Pt(e) {
2677
2692
  const u = e.async ? "async " : "", t = e.params.map((r) => r.type === "ObjectPattern" ? `{${r.properties.map((s) => s.key?.name || s.name).join(",")}}` : r.type === "AssignmentPattern" ? r.left.name + "=" + (r.right?.extra?.raw || "null") : r.name).join(", "), a = A(e.body) || "{}";
2678
2693
  return `${u}(${t}) => ${a}`;
2679
2694
  }
@@ -2749,7 +2764,7 @@ function xu(e, u) {
2749
2764
  (a) => a.key?.name === u
2750
2765
  )?.value?.value;
2751
2766
  }
2752
- function Pt(e) {
2767
+ function Mt(e) {
2753
2768
  const u = e?.find(
2754
2769
  (t) => t.key?.name === "type"
2755
2770
  );
@@ -2761,7 +2776,7 @@ function Ot(e) {
2761
2776
  (t) => t.key?.name === "default"
2762
2777
  );
2763
2778
  if (u)
2764
- return T(A(u.value));
2779
+ return k(A(u.value));
2765
2780
  }
2766
2781
  function Bt(e) {
2767
2782
  const u = [], t = {}, a = [];
@@ -2972,8 +2987,8 @@ const ie = "arrow-double-left, arrow-double-right, contact, notes, records, cash
2972
2987
  ", "
2973
2988
  ), Jt = "AddLocation, Aim, AlarmClock, Apple, ArrowDownBold, ArrowDown, ArrowLeftBold, ArrowLeft, ArrowRightBold, ArrowRight, ArrowUpBold, ArrowUp, Avatar, Back, Baseball, Basketball, BellFilled, Bell, Bicycle, BottomLeft, BottomRight, Bottom, Bowl, Box, Briefcase, BrushFilled, Brush, Burger, Calendar, CameraFilled, Camera, CaretBottom, CaretLeft, CaretRight, CaretTop, Cellphone, ChatDotRound, ChatDotSquare, ChatLineRound, ChatLineSquare, ChatRound, ChatSquare, Check, Checked, Cherry, Chicken, ChromeFilled, CircleCheckFilled, CircleCheck, CircleCloseFilled, CircleClose, CirclePlusFilled, CirclePlus, Clock, CloseBold, Close, Cloudy, CoffeeCup, Coffee, Coin, ColdDrink, CollectionTag, Collection, Comment, Compass, Connection, Coordinate, CopyDocument, Cpu, CreditCard, Crop, DArrowLeft, DArrowRight, DCaret, DataAnalysis, DataBoard, DataLine, DeleteFilled, DeleteLocation, Delete, Dessert, Discount, DishDot, Dish, DocumentAdd, DocumentChecked, DocumentCopy, DocumentDelete, DocumentRemove, Document, Download, Drizzling, EditPen, Edit, ElemeFilled, Eleme, ElementPlus, Expand, Failed, Female, Files, Film, Filter, Finished, FirstAidKit, Flag, Fold, FolderAdd, FolderChecked, FolderDelete, FolderOpened, FolderRemove, Folder, Food, Football, ForkSpoon, Fries, FullScreen, GobletFull, GobletSquareFull, GobletSquare, Goblet, GoldMedal, GoodsFilled, Goods, Grape, Grid, Guide, Handbag, Headset, HelpFilled, Help, Hide, Histogram, HomeFilled, HotWater, House, IceCreamRound, IceCreamSquare, IceCream, IceDrink, IceTea, InfoFilled, Iphone, Key, KnifeFork, Lightning, Link, List, Loading, LocationFilled, LocationInformation, Location, Lock, Lollipop, MagicStick, Magnet, Male, Management, MapLocation, Medal, Memo, Menu, MessageBox, Message, Mic, Microphone, MilkTea, Minus, Money, Monitor, MoonNight, Moon, MoreFilled, More, MostlyCloudy, Mouse, Mug, MuteNotification, Mute, NoSmoking, Notebook, Notification, Odometer, OfficeBuilding, Open, Operation, Opportunity, Orange, Paperclip, PartlyCloudy, Pear, PhoneFilled, Phone, PictureFilled, PictureRounded, Picture, PieChart, Place, Platform, Plus, Pointer, Position, Postcard, Pouring, Present, PriceTag, Printer, Promotion, QuartzWatch, QuestionFilled, Rank, ReadingLamp, Reading, RefreshLeft, RefreshRight, Refresh, Refrigerator, RemoveFilled, Remove, Right, ScaleToOriginal, School, Scissor, Search, Select, Sell, SemiSelect, Service, SetUp, Setting, Share, Ship, Shop, ShoppingBag, ShoppingCartFull, ShoppingCart, ShoppingTrolley, Smoking, Soccer, SoldOut, SortDown, SortUp, Sort, Stamp, StarFilled, Star, Stopwatch, SuccessFilled, Sugar, SuitcaseLine, Suitcase, Sunny, Sunrise, Sunset, SwitchButton, SwitchFilled, Switch, TakeawayBox, Ticket, Tickets, Timer, ToiletPaper, Tools, TopLeft, TopRight, Top, TrendCharts, TrophyBase, Trophy, TurnOff, Umbrella, Unlock, UploadFilled, Upload, UserFilled, User, Van, VideoCameraFilled, VideoCamera, VideoPause, VideoPlay, View, WalletFilled, Wallet, WarnTriangleFilled, WarningFilled, Warning, Watch, Watermelon, WindPower, ZoomIn, ZoomOut, VtjIconChatRecord, VtjIconNewChat, VtjIconAi, VtjIconUniapp, VtjIconWindowMax, VtjIconWindowMin, VtjIconWindowClose, VtjIconWindowNormal, VtjIconWindowDown, VtjIconWindowUp, VtjIconNpSave, VtjIconNpFile, VtjIconNpEdit, VtjIconNpShare, VtjIconNpSearch, VtjIconNpExport, VtjIconNpImport, VtjIconNpList, VtjIconNpPrint, VtjIconNpCancel, VtjIconNpConfirm, VtjIconNpReset, VtjIconNpReturnAll, VtjIconNpReturn, VtjIconNpRemove, VtjIconNpRemoveRow, VtjIconNpDelete, VtjIconNpExit, VtjIconNpRefresh, VtjIconNpAdd, VtjIconNpSelect, VtjIconNpAddRow, VtjIconNpExtend, VtjIconNpClose, VtjIconNpSubmit, VtjIconDeps, VtjIconBack, VtjIconHome, VtjIconApi, VtjIconExport, VtjIconImport, VtjIconGreater, VtjIconSmaller, VtjIconCheck, VtjIconSwitch, VtjIconCopy, VtjIconLock, VtjIconUnlock, VtjIconLayers, VtjIconConsole, VtjIconTeam, VtjIconPublish, VtjIconPreview, VtjIconSave, VtjIconPc, VtjIconPhone, VtjIconPad, VtjIconRedo, VtjIconRefresh, VtjIconUndo, VtjIconCategory, VtjIconProject, VtjIconNotice, VtjIconFav, VtjIconBug, VtjIconFile, VtjIconFolder, VtjIconUpload, VtjIconDownload, VtjIconUser, VtjIconSetting, VtjIconArrowRight, VtjIconArrowLeft, VtjIconArrowDown, VtjIconArrowUp, VtjIconShare, VtjIconData, VtjIconTemplate, VtjIconExitFullscreen, VtjIconFullscreen, VtjIconEdit, VtjIconRemove, VtjIconJs, VtjIconDatabase, VtjIconInfo, VtjIconPlus, VtjIconMinus, VtjIconHelp, VtjIconVars, VtjIconOutline, VtjIconVisible, VtjIconInvisible, VtjIconDocument, VtjIconHistory, VtjIconFixed, VtjIconUnfixed, VtjIconSearch, VtjIconMore, VtjIconClose, VtjIconComponents, VtjIconBlock".split(
2974
2989
  ", "
2975
- ), zt = "user", M = "User";
2976
- class Xt {
2990
+ ), Xt = "user", P = "User";
2991
+ class zt {
2977
2992
  validate(u) {
2978
2993
  const t = {
2979
2994
  valid: !0,
@@ -2987,7 +3002,7 @@ class Xt {
2987
3002
  }
2988
3003
  isCompleteSFC(u) {
2989
3004
  try {
2990
- const t = P(u);
3005
+ const t = M(u);
2991
3006
  return !!(t.template && t.script && t.styles);
2992
3007
  } catch {
2993
3008
  return !1;
@@ -2996,7 +3011,7 @@ class Xt {
2996
3011
  checkSyntax(u) {
2997
3012
  let t = "";
2998
3013
  try {
2999
- const a = P(u);
3014
+ const a = M(u);
3000
3015
  _(a.script);
3001
3016
  } catch (a) {
3002
3017
  a instanceof SyntaxError && (t = a.message);
@@ -3004,7 +3019,7 @@ class Xt {
3004
3019
  return t;
3005
3020
  }
3006
3021
  checkSetup(u) {
3007
- const t = P(u);
3022
+ const t = M(u);
3008
3023
  if (t.isScriptSetup)
3009
3024
  return !0;
3010
3025
  let a = 0;
@@ -3017,7 +3032,7 @@ class Xt {
3017
3032
  }), a === 3;
3018
3033
  }
3019
3034
  findVantIcons(u) {
3020
- const t = P(u), a = /<(?:VanIcon|van-icon)\b[^>]*>/g, r = t.template.match(a) || [], n = [];
3035
+ const t = M(u), a = /<(?:VanIcon|van-icon)\b[^>]*>/g, r = t.template.match(a) || [], n = [];
3021
3036
  return r.forEach((s) => {
3022
3037
  const i = s.match(/\bname="([^"]+)"/);
3023
3038
  i && n.push(i[1]);
@@ -3030,7 +3045,7 @@ class Xt {
3030
3045
  return a;
3031
3046
  }
3032
3047
  findVtjIcons(u) {
3033
- const t = P(u), a = /import\s*{([^}]+)}\s*from\s*['"]\@vtj\/icons['"]/, r = t.script.match(a);
3048
+ const t = M(u), a = /import\s*{([^}]+)}\s*from\s*['"]\@vtj\/icons['"]/, r = t.script.match(a);
3034
3049
  return !r || !r[1] ? [] : r[1].split(",").map((n) => n.trim()).filter(Boolean);
3035
3050
  }
3036
3051
  checkVtjIcons(u) {
@@ -3054,7 +3069,7 @@ class Xt {
3054
3069
  function Zt(e) {
3055
3070
  const u = [];
3056
3071
  let t = e;
3057
- const a = P(e);
3072
+ const a = M(e);
3058
3073
  if (!a.template || !a.script)
3059
3074
  return {
3060
3075
  fixed: !1,
@@ -3069,17 +3084,17 @@ function Zt(e) {
3069
3084
  for (; (c = o.exec(n)) !== null; ) {
3070
3085
  const h = c[0], g = c[1], x = H(g, r);
3071
3086
  if (x !== g) {
3072
- const v = G(n, c.index);
3087
+ const E = G(n, c.index);
3073
3088
  i.push({
3074
3089
  start: c.index,
3075
3090
  end: c.index + h.length,
3076
3091
  original: h,
3077
3092
  replacement: `{{${x}}}`,
3078
- line: v.line,
3079
- column: v.column
3093
+ line: E.line,
3094
+ column: E.column
3080
3095
  }), u.push({
3081
- line: v.line + 1,
3082
- column: v.column,
3096
+ line: E.line + 1,
3097
+ column: E.column,
3083
3098
  original: g.trim(),
3084
3099
  fixed: x.trim(),
3085
3100
  message: "修复插值表达式:添加 state. 前缀"
@@ -3088,42 +3103,42 @@ function Zt(e) {
3088
3103
  }
3089
3104
  const d = /:(\w+)="([^"]+)"/g;
3090
3105
  for (; (c = d.exec(n)) !== null; ) {
3091
- const h = c[0], g = c[1], x = c[2], v = H(x, r);
3092
- if (v !== x) {
3106
+ const h = c[0], g = c[1], x = c[2], E = H(x, r);
3107
+ if (E !== x) {
3093
3108
  const I = G(n, c.index);
3094
3109
  i.push({
3095
3110
  start: c.index,
3096
3111
  end: c.index + h.length,
3097
3112
  original: h,
3098
- replacement: `:${g}="${v}"`,
3113
+ replacement: `:${g}="${E}"`,
3099
3114
  line: I.line,
3100
3115
  column: I.column
3101
3116
  }), u.push({
3102
3117
  line: I.line + 1,
3103
3118
  column: I.column,
3104
3119
  original: x,
3105
- fixed: v,
3120
+ fixed: E,
3106
3121
  message: "修复绑定属性:添加 state. 前缀"
3107
3122
  });
3108
3123
  }
3109
3124
  }
3110
3125
  const l = /v-(if|else-if|show)="([^"]+)"/g;
3111
3126
  for (; (c = l.exec(n)) !== null; ) {
3112
- const h = c[0], g = c[1], x = c[2], v = H(x, r);
3113
- if (v !== x) {
3127
+ const h = c[0], g = c[1], x = c[2], E = H(x, r);
3128
+ if (E !== x) {
3114
3129
  const I = G(n, c.index);
3115
3130
  i.push({
3116
3131
  start: c.index,
3117
3132
  end: c.index + h.length,
3118
3133
  original: h,
3119
- replacement: `v-${g}="${v}"`,
3134
+ replacement: `v-${g}="${E}"`,
3120
3135
  line: I.line,
3121
3136
  column: I.column
3122
3137
  }), u.push({
3123
3138
  line: I.line + 1,
3124
3139
  column: I.column,
3125
3140
  original: x,
3126
- fixed: v,
3141
+ fixed: E,
3127
3142
  message: `修复 v-${g} 指令:添加 state. 前缀`
3128
3143
  });
3129
3144
  }
@@ -3132,12 +3147,12 @@ function Zt(e) {
3132
3147
  for (; (c = p.exec(n)) !== null; ) {
3133
3148
  const h = c[0], x = c[1].match(/^(.+)\s+in\s+(.+)$/);
3134
3149
  if (x) {
3135
- const [, v, I] = x, D = H(
3150
+ const [, E, I] = x, D = H(
3136
3151
  I,
3137
3152
  r
3138
3153
  );
3139
3154
  if (D !== I) {
3140
- const F = G(n, c.index), lu = `v-for="${v} in ${D}"`;
3155
+ const F = G(n, c.index), lu = `v-for="${E} in ${D}"`;
3141
3156
  i.push({
3142
3157
  start: c.index,
3143
3158
  end: c.index + h.length,
@@ -3159,17 +3174,17 @@ function Zt(e) {
3159
3174
  for (; (c = b.exec(n)) !== null; ) {
3160
3175
  const h = c[0], g = c[1], x = H(g, r);
3161
3176
  if (x !== g) {
3162
- const v = G(n, c.index);
3177
+ const E = G(n, c.index);
3163
3178
  i.push({
3164
3179
  start: c.index,
3165
3180
  end: c.index + h.length,
3166
3181
  original: h,
3167
3182
  replacement: `v-model="${x}"`,
3168
- line: v.line,
3169
- column: v.column
3183
+ line: E.line,
3184
+ column: E.column
3170
3185
  }), u.push({
3171
- line: v.line + 1,
3172
- column: v.column,
3186
+ line: E.line + 1,
3187
+ column: E.column,
3173
3188
  original: g,
3174
3189
  fixed: x,
3175
3190
  message: "修复 v-model 指令:添加 state. 前缀"
@@ -3180,17 +3195,17 @@ function Zt(e) {
3180
3195
  for (; (c = m.exec(n)) !== null; ) {
3181
3196
  const h = c[0], g = c[1], x = H(g, r);
3182
3197
  if (x !== g) {
3183
- const v = G(n, c.index);
3198
+ const E = G(n, c.index);
3184
3199
  i.push({
3185
3200
  start: c.index,
3186
3201
  end: c.index + h.length,
3187
3202
  original: h,
3188
3203
  replacement: `v-bind="${x}"`,
3189
- line: v.line,
3190
- column: v.column
3204
+ line: E.line,
3205
+ column: E.column
3191
3206
  }), u.push({
3192
- line: v.line + 1,
3193
- column: v.column,
3207
+ line: E.line + 1,
3208
+ column: E.column,
3194
3209
  original: g,
3195
3210
  fixed: x,
3196
3211
  message: "修复 v-bind 指令:添加 state. 前缀"
@@ -3199,29 +3214,29 @@ function Zt(e) {
3199
3214
  }
3200
3215
  const S = /v-(text|html)="([^"]+)"/g;
3201
3216
  for (; (c = S.exec(n)) !== null; ) {
3202
- const h = c[0], g = c[1], x = c[2], v = H(x, r);
3203
- if (v !== x) {
3217
+ const h = c[0], g = c[1], x = c[2], E = H(x, r);
3218
+ if (E !== x) {
3204
3219
  const I = G(n, c.index);
3205
3220
  i.push({
3206
3221
  start: c.index,
3207
3222
  end: c.index + h.length,
3208
3223
  original: h,
3209
- replacement: `v-${g}="${v}"`,
3224
+ replacement: `v-${g}="${E}"`,
3210
3225
  line: I.line,
3211
3226
  column: I.column
3212
3227
  }), u.push({
3213
3228
  line: I.line + 1,
3214
3229
  column: I.column,
3215
3230
  original: x,
3216
- fixed: v,
3231
+ fixed: E,
3217
3232
  message: `修复 v-${g} 指令:添加 state. 前缀`
3218
3233
  });
3219
3234
  }
3220
3235
  }
3221
- const w = /(@|v-on:)(\w+)="([^"]+)"/g;
3222
- for (; (c = w.exec(n)) !== null; ) {
3223
- const h = c[0], g = c[1], x = c[2], v = c[3], I = Kt(v, r);
3224
- if (I !== v) {
3236
+ const v = /(@|v-on:)(\w+)="([^"]+)"/g;
3237
+ for (; (c = v.exec(n)) !== null; ) {
3238
+ const h = c[0], g = c[1], x = c[2], E = c[3], I = Kt(E, r);
3239
+ if (I !== E) {
3225
3240
  const D = G(n, c.index);
3226
3241
  i.push({
3227
3242
  start: c.index,
@@ -3233,7 +3248,7 @@ function Zt(e) {
3233
3248
  }), u.push({
3234
3249
  line: D.line + 1,
3235
3250
  column: D.column,
3236
- original: v,
3251
+ original: E,
3237
3252
  fixed: I,
3238
3253
  message: "修复事件处理器:添加 state. 前缀"
3239
3254
  });
@@ -3307,14 +3322,14 @@ class Yt {
3307
3322
  return t.illegalVantIcons.length && (a = this.fixVantIcons(a)), t.illegalVtjIcons.length && (a = this.fixVtjIcons(a, t.illegalVtjIcons)), Zt(a).fixedCode;
3308
3323
  }
3309
3324
  fixVantIcons(u) {
3310
- const t = P(u), a = t.template.replace(
3325
+ const t = M(u), a = t.template.replace(
3311
3326
  /<(?:VanIcon|van-icon)\s+[^>]*name="([^"]+)"[^>]*>/g,
3312
- (r, n) => r.includes(":name=") || r.includes("v-bind:name=") || ie.includes(n) ? r : r.replace(n, zt)
3327
+ (r, n) => r.includes(":name=") || r.includes("v-bind:name=") || ie.includes(n) ? r : r.replace(n, Xt)
3313
3328
  );
3314
3329
  return this.reconstructSFC(t, a, t.script);
3315
3330
  }
3316
3331
  fixVtjIcons(u, t = []) {
3317
- const a = P(u);
3332
+ const a = M(u);
3318
3333
  let r = !1;
3319
3334
  a.script = Ju(a.script, {
3320
3335
  ImportDeclaration(i) {
@@ -3323,14 +3338,14 @@ class Yt {
3323
3338
  let d = !1;
3324
3339
  for (const l of o) {
3325
3340
  const p = l.imported?.name;
3326
- p === M && (d = !0, r = !0), t.includes(p) || c.push(
3341
+ p === P && (d = !0, r = !0), t.includes(p) || c.push(
3327
3342
  q.importSpecifier(l.local, l.imported)
3328
3343
  );
3329
3344
  }
3330
3345
  !d && !r && (r = !0, c.push(
3331
3346
  q.importSpecifier(
3332
- q.identifier(M),
3333
- q.identifier(M)
3347
+ q.identifier(P),
3348
+ q.identifier(P)
3334
3349
  )
3335
3350
  )), i.node.specifiers = c;
3336
3351
  }
@@ -3345,8 +3360,8 @@ class Yt {
3345
3360
  (l) => !t.includes(l.key.name)
3346
3361
  ), c.argument.properties.push(
3347
3362
  q.objectProperty(
3348
- q.identifier(M),
3349
- q.identifier(M),
3363
+ q.identifier(P),
3364
+ q.identifier(P),
3350
3365
  !1,
3351
3366
  !0
3352
3367
  )
@@ -3355,13 +3370,13 @@ class Yt {
3355
3370
  }
3356
3371
  },
3357
3372
  ObjectProperty(i) {
3358
- if (q.isIdentifier(i.node.value) && t.includes(i.node.value.name) && (i.node.value = q.identifier(M)), q.isArrayExpression(i.node.value)) {
3373
+ if (q.isIdentifier(i.node.value) && t.includes(i.node.value.name) && (i.node.value = q.identifier(P)), q.isArrayExpression(i.node.value)) {
3359
3374
  const o = i.node.value.elements;
3360
- i.node.value.elements = o.map((c) => q.isIdentifier(c) && t.includes(c.name) ? q.identifier(M) : c);
3375
+ i.node.value.elements = o.map((c) => q.isIdentifier(c) && t.includes(c.name) ? q.identifier(P) : c);
3361
3376
  }
3362
3377
  },
3363
3378
  AssignmentExpression(i) {
3364
- q.isIdentifier(i.node.right) && t.includes(i.node.right.name) && (i.node.right = q.identifier(M));
3379
+ q.isIdentifier(i.node.right) && t.includes(i.node.right.name) && (i.node.right = q.identifier(P));
3365
3380
  }
3366
3381
  });
3367
3382
  const n = /:icon\s*=\s*["']([^"']+)["']/g, s = a.template.match(n);
@@ -3369,13 +3384,13 @@ class Yt {
3369
3384
  for (const i of s) {
3370
3385
  let o = i;
3371
3386
  for (const c of t)
3372
- o = o.replace(new RegExp(c, "g"), M);
3387
+ o = o.replace(new RegExp(c, "g"), P);
3373
3388
  a.template = a.template.replace(i, o);
3374
3389
  }
3375
3390
  for (const i of t)
3376
3391
  a.template = a.template.replace(
3377
3392
  new RegExp(`:icon="${i}"`, "g"),
3378
- `:icon="${M}"`
3393
+ `:icon="${P}"`
3379
3394
  );
3380
3395
  return this.reconstructSFC(a, a.template, a.script);
3381
3396
  }
@@ -3406,19 +3421,19 @@ async function p0(e) {
3406
3421
  const { id: u, name: t, source: a, project: r } = e, n = ke(a, t);
3407
3422
  if (n)
3408
3423
  return Promise.reject(n);
3409
- const { dependencies: s = [], platform: i = "web" } = r || {}, o = new Xt(), c = new Yt(), d = o.validate(a);
3424
+ const { dependencies: s = [], platform: i = "web" } = r || {}, o = new zt(), c = new Yt(), d = o.validate(a);
3410
3425
  let l = [];
3411
3426
  if (!d.valid)
3412
3427
  return l = d.errors, Promise.reject(l);
3413
- const p = c.fixBasedOnValidation(a, d), b = P(p);
3428
+ const p = c.fixBasedOnValidation(a, d), b = M(p);
3414
3429
  b.script = Ae(b.script);
3415
3430
  const {
3416
3431
  styles: m,
3417
3432
  css: S,
3418
- errors: w
3433
+ errors: v
3419
3434
  } = Bt(b.styles.join(`
3420
3435
  `));
3421
- return l.push(...w), l.length ? Promise.reject(l) : b.isScriptSetup ? e0(b, {
3436
+ return l.push(...v), l.length ? Promise.reject(l) : b.isScriptSetup ? e0(b, {
3422
3437
  id: u,
3423
3438
  name: t,
3424
3439
  project: r,
@@ -3445,11 +3460,11 @@ async function u0(e, u) {
3445
3460
  methods: b,
3446
3461
  props: m,
3447
3462
  emits: S,
3448
- expose: w,
3463
+ expose: v,
3449
3464
  inject: h,
3450
3465
  handlers: g,
3451
3466
  imports: x,
3452
- dataSources: v,
3467
+ dataSources: E,
3453
3468
  directives: I
3454
3469
  } = et(e.script, r), { nodes: D, slots: F, context: lu } = re(t, a, e.template, {
3455
3470
  platform: n,
@@ -3467,10 +3482,10 @@ async function u0(e, u) {
3467
3482
  lifeCycles: l,
3468
3483
  computed: p,
3469
3484
  methods: b,
3470
- dataSources: v,
3485
+ dataSources: E,
3471
3486
  slots: F,
3472
3487
  emits: S,
3473
- expose: w,
3488
+ expose: v,
3474
3489
  nodes: D,
3475
3490
  css: o
3476
3491
  }, le = Object.keys(p || {}), fe = (m || []).map(
@@ -3545,7 +3560,7 @@ async function e0(e, u) {
3545
3560
  expose: c.expose,
3546
3561
  nodes: d,
3547
3562
  css: i
3548
- }, { libs: m } = de(c.imports, o), S = Wt(c), w = {
3563
+ }, { libs: m } = de(c.imports, o), S = Wt(c), v = {
3549
3564
  refs: Array.from(S.refs),
3550
3565
  reactives: Array.from(S.reactives),
3551
3566
  hasState: S.hasState,
@@ -3564,8 +3579,8 @@ async function e0(e, u) {
3564
3579
  async (g) => {
3565
3580
  await oe(g, async (x) => {
3566
3581
  if (du(x)) {
3567
- const v = await nu(x.value);
3568
- let I = $u(v, w);
3582
+ const E = await nu(x.value);
3583
+ let I = $u(E, v);
3569
3584
  const D = Array.from(
3570
3585
  p[g.id] || /* @__PURE__ */ new Set()
3571
3586
  );
@@ -3577,7 +3592,7 @@ async function e0(e, u) {
3577
3592
  },
3578
3593
  async (g) => {
3579
3594
  const x = await nu(g.value);
3580
- g.value = $u(x, w);
3595
+ g.value = $u(x, v);
3581
3596
  }
3582
3597
  ), new Hu(b).toDsl();
3583
3598
  }
@@ -3608,7 +3623,7 @@ async function ce(e, u, t) {
3608
3623
  setup: b,
3609
3624
  provide: m,
3610
3625
  refs: S,
3611
- reactives: w
3626
+ reactives: v
3612
3627
  } = e;
3613
3628
  if (await r({
3614
3629
  state: n,
@@ -3622,7 +3637,7 @@ async function ce(e, u, t) {
3622
3637
  setup: b,
3623
3638
  provide: m,
3624
3639
  refs: S,
3625
- reactives: w
3640
+ reactives: v
3626
3641
  }), Array.isArray(e.nodes))
3627
3642
  for (const h of e.nodes)
3628
3643
  await a(h);
@@ -3666,7 +3681,7 @@ function de(e = [], u = []) {
3666
3681
  }
3667
3682
  export {
3668
3683
  Yt as AutoFixer,
3669
- Xt as ComponentValidator,
3684
+ zt as ComponentValidator,
3670
3685
  f0 as VTJ_PARSER_VERSION,
3671
3686
  qu as htmlToNodes,
3672
3687
  b0 as parseUniApp,