lone-format 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { defineComponent as fe, useCssVars as pe, ref as R, computed as D, resolveComponent as ve, createElementBlock as A, openBlock as w, createElementVNode as P, createCommentVNode as B, withDirectives as ae, toDisplayString as $, withKeys as Q, vModelText as le, createTextVNode as de, Fragment as _e, renderList as xe, createVNode as ye, normalizeClass as ge, nextTick as ee, watch as ke } from "vue";
2
- class Oe {
1
+ import { defineComponent as pe, useCssVars as ye, ref as H, computed as j, resolveComponent as _e, createElementBlock as C, openBlock as A, createElementVNode as B, createCommentVNode as I, withDirectives as le, toDisplayString as F, withKeys as q, vModelText as ce, createTextVNode as he, Fragment as xe, renderList as ke, createVNode as ge, normalizeClass as be, nextTick as ee, watch as Oe } from "vue";
2
+ class Ce {
3
3
  /**
4
4
  * @callback HookCallback
5
5
  * @this {*|Jsep} this
@@ -42,7 +42,7 @@ class Oe {
42
42
  });
43
43
  }
44
44
  }
45
- class Ce {
45
+ class Ae {
46
46
  constructor(e) {
47
47
  this.jsep = e, this.registered = {};
48
48
  }
@@ -351,7 +351,7 @@ class o {
351
351
  * @returns {?jsep.BinaryExpression}
352
352
  */
353
353
  gobbleBinaryExpression() {
354
- let e, t, s, n, a, c, f, d, h;
354
+ let e, t, s, n, a, c, f, h, d;
355
355
  if (c = this.gobbleToken(), !c || (t = this.gobbleBinaryOp(), !t))
356
356
  return c;
357
357
  for (a = {
@@ -367,24 +367,24 @@ class o {
367
367
  value: t,
368
368
  prec: s,
369
369
  right_a: o.right_associative.has(t)
370
- }, h = t;
371
- const v = (g) => a.right_a && g.right_a ? s > g.prec : s <= g.prec;
372
- for (; n.length > 2 && v(n[n.length - 2]); )
370
+ }, d = t;
371
+ const _ = (b) => a.right_a && b.right_a ? s > b.prec : s <= b.prec;
372
+ for (; n.length > 2 && _(n[n.length - 2]); )
373
373
  f = n.pop(), t = n.pop().value, c = n.pop(), e = {
374
374
  type: o.BINARY_EXP,
375
375
  operator: t,
376
376
  left: c,
377
377
  right: f
378
378
  }, n.push(e);
379
- e = this.gobbleToken(), e || this.throwError("Expected expression after " + h), n.push(a, e);
379
+ e = this.gobbleToken(), e || this.throwError("Expected expression after " + d), n.push(a, e);
380
380
  }
381
- for (d = n.length - 1, e = n[d]; d > 1; )
381
+ for (h = n.length - 1, e = n[h]; h > 1; )
382
382
  e = {
383
383
  type: o.BINARY_EXP,
384
- operator: n[d - 1].value,
385
- left: n[d - 2],
384
+ operator: n[h - 1].value,
385
+ left: n[h - 2],
386
386
  right: e
387
- }, d -= 2;
387
+ }, h -= 2;
388
388
  return e;
389
389
  }
390
390
  /**
@@ -615,10 +615,10 @@ class o {
615
615
  };
616
616
  }
617
617
  }
618
- const Ae = new Oe();
618
+ const we = new Ce();
619
619
  Object.assign(o, {
620
- hooks: Ae,
621
- plugins: new Ce(o),
620
+ hooks: we,
621
+ plugins: new Ae(o),
622
622
  // Node Types
623
623
  // ----------
624
624
  // This is the full set of types that any JSEP node can be.
@@ -714,14 +714,14 @@ Object.assign(o, {
714
714
  });
715
715
  o.max_unop_len = o.getMaxKeyLen(o.unary_ops);
716
716
  o.max_binop_len = o.getMaxKeyLen(o.binary_ops);
717
- const L = (r) => new o(r).parse(), we = Object.getOwnPropertyNames(class {
717
+ const K = (r) => new o(r).parse(), Se = Object.getOwnPropertyNames(class {
718
718
  });
719
- Object.getOwnPropertyNames(o).filter((r) => !we.includes(r) && L[r] === void 0).forEach((r) => {
720
- L[r] = o[r];
719
+ Object.getOwnPropertyNames(o).filter((r) => !Se.includes(r) && K[r] === void 0).forEach((r) => {
720
+ K[r] = o[r];
721
721
  });
722
- L.Jsep = o;
723
- const Se = "ConditionalExpression";
724
- var Pe = {
722
+ K.Jsep = o;
723
+ const Pe = "ConditionalExpression";
724
+ var Ne = {
725
725
  name: "ternary",
726
726
  init(r) {
727
727
  r.hooks.add("after-expression", function(t) {
@@ -732,7 +732,7 @@ var Pe = {
732
732
  this.index++;
733
733
  const a = this.gobbleExpression();
734
734
  if (a || this.throwError("Expected expression"), t.node = {
735
- type: Se,
735
+ type: Pe,
736
736
  test: s,
737
737
  consequent: n,
738
738
  alternate: a
@@ -748,22 +748,22 @@ var Pe = {
748
748
  });
749
749
  }
750
750
  };
751
- L.plugins.register(Pe);
752
- const he = 47, Ne = 92;
753
- var Te = {
751
+ K.plugins.register(Ne);
752
+ const fe = 47, Te = 92;
753
+ var Be = {
754
754
  name: "regex",
755
755
  init(r) {
756
756
  r.hooks.add("gobble-token", function(t) {
757
- if (this.code === he) {
757
+ if (this.code === fe) {
758
758
  const s = ++this.index;
759
759
  let n = !1;
760
760
  for (; this.index < this.expr.length; ) {
761
- if (this.code === he && !n) {
761
+ if (this.code === fe && !n) {
762
762
  const a = this.expr.slice(s, this.index);
763
763
  let c = "";
764
764
  for (; ++this.index < this.expr.length; ) {
765
- const d = this.code;
766
- if (d >= 97 && d <= 122 || d >= 65 && d <= 90 || d >= 48 && d <= 57)
765
+ const h = this.code;
766
+ if (h >= 97 && h <= 122 || h >= 65 && h <= 90 || h >= 48 && h <= 57)
767
767
  c += this.char;
768
768
  else
769
769
  break;
@@ -771,8 +771,8 @@ var Te = {
771
771
  let f;
772
772
  try {
773
773
  f = new RegExp(a, c);
774
- } catch (d) {
775
- this.throwError(d.message);
774
+ } catch (h) {
775
+ this.throwError(h.message);
776
776
  }
777
777
  return t.node = {
778
778
  type: r.LITERAL,
@@ -780,34 +780,34 @@ var Te = {
780
780
  raw: this.expr.slice(s - 1, this.index)
781
781
  }, t.node = this.gobbleTokenProperty(t.node), t.node;
782
782
  }
783
- this.code === r.OBRACK_CODE ? n = !0 : n && this.code === r.CBRACK_CODE && (n = !1), this.index += this.code === Ne ? 2 : 1;
783
+ this.code === r.OBRACK_CODE ? n = !0 : n && this.code === r.CBRACK_CODE && (n = !1), this.index += this.code === Te ? 2 : 1;
784
784
  }
785
785
  this.throwError("Unclosed Regex");
786
786
  }
787
787
  });
788
788
  }
789
789
  };
790
- const ce = 43, Be = 45, Y = {
790
+ const ue = 43, De = 45, z = {
791
791
  name: "assignment",
792
792
  assignmentOperators: /* @__PURE__ */ new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "||=", "&&=", "??="]),
793
- updateOperators: [ce, Be],
793
+ updateOperators: [ue, De],
794
794
  assignmentPrecedence: 0.9,
795
795
  init(r) {
796
796
  const e = [r.IDENTIFIER, r.MEMBER_EXP];
797
- Y.assignmentOperators.forEach((s) => r.addBinaryOp(s, Y.assignmentPrecedence, !0)), r.hooks.add("gobble-token", function(n) {
797
+ z.assignmentOperators.forEach((s) => r.addBinaryOp(s, z.assignmentPrecedence, !0)), r.hooks.add("gobble-token", function(n) {
798
798
  const a = this.code;
799
- Y.updateOperators.some((c) => c === a && c === this.expr.charCodeAt(this.index + 1)) && (this.index += 2, n.node = {
799
+ z.updateOperators.some((c) => c === a && c === this.expr.charCodeAt(this.index + 1)) && (this.index += 2, n.node = {
800
800
  type: "UpdateExpression",
801
- operator: a === ce ? "++" : "--",
801
+ operator: a === ue ? "++" : "--",
802
802
  argument: this.gobbleTokenProperty(this.gobbleIdentifier()),
803
803
  prefix: !0
804
804
  }, (!n.node.argument || !e.includes(n.node.argument.type)) && this.throwError(`Unexpected ${n.node.operator}`));
805
805
  }), r.hooks.add("after-token", function(n) {
806
806
  if (n.node) {
807
807
  const a = this.code;
808
- Y.updateOperators.some((c) => c === a && c === this.expr.charCodeAt(this.index + 1)) && (e.includes(n.node.type) || this.throwError(`Unexpected ${n.node.operator}`), this.index += 2, n.node = {
808
+ z.updateOperators.some((c) => c === a && c === this.expr.charCodeAt(this.index + 1)) && (e.includes(n.node.type) || this.throwError(`Unexpected ${n.node.operator}`), this.index += 2, n.node = {
809
809
  type: "UpdateExpression",
810
- operator: a === ce ? "++" : "--",
810
+ operator: a === ue ? "++" : "--",
811
811
  argument: n.node,
812
812
  prefix: !1
813
813
  });
@@ -816,17 +816,17 @@ const ce = 43, Be = 45, Y = {
816
816
  n.node && t(n.node);
817
817
  });
818
818
  function t(s) {
819
- Y.assignmentOperators.has(s.operator) ? (s.type = "AssignmentExpression", t(s.left), t(s.right)) : s.operator || Object.values(s).forEach((n) => {
819
+ z.assignmentOperators.has(s.operator) ? (s.type = "AssignmentExpression", t(s.left), t(s.right)) : s.operator || Object.values(s).forEach((n) => {
820
820
  n && typeof n == "object" && t(n);
821
821
  });
822
822
  }
823
823
  }
824
824
  };
825
- L.plugins.register(Te, Y);
826
- L.addUnaryOp("typeof");
827
- L.addLiteral("null", null);
828
- L.addLiteral("undefined", void 0);
829
- const De = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__"]), O = {
825
+ K.plugins.register(Be, z);
826
+ K.addUnaryOp("typeof");
827
+ K.addLiteral("null", null);
828
+ K.addLiteral("undefined", void 0);
829
+ const Ie = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__"]), O = {
830
830
  /**
831
831
  * @param {jsep.Expression} ast
832
832
  * @param {Record<string, any>} subs
@@ -915,7 +915,7 @@ const De = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
915
915
  ), s = O.evalAst(r.object, e);
916
916
  if (s == null)
917
917
  throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);
918
- if (!Object.hasOwn(s, t) && De.has(t))
918
+ if (!Object.hasOwn(s, t) && Ie.has(t))
919
919
  throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);
920
920
  const n = s[t];
921
921
  return typeof n == "function" ? n.bind(s) : n;
@@ -949,7 +949,7 @@ class je {
949
949
  * @param {string} expr Expression to evaluate
950
950
  */
951
951
  constructor(e) {
952
- this.code = e, this.ast = L(this.code);
952
+ this.code = e, this.ast = K(this.code);
953
953
  }
954
954
  /**
955
955
  * @param {object} context Object whose items will be added
@@ -961,13 +961,13 @@ class je {
961
961
  return O.evalAst(this.ast, t);
962
962
  }
963
963
  }
964
- function M(r, e) {
964
+ function G(r, e) {
965
965
  return r = r.slice(), r.push(e), r;
966
966
  }
967
- function ue(r, e) {
967
+ function de(r, e) {
968
968
  return e = e.slice(), e.unshift(r), e;
969
969
  }
970
- class Ie extends Error {
970
+ class $e extends Error {
971
971
  /**
972
972
  * @param {AnyResult} value The evaluated scalar value
973
973
  */
@@ -975,10 +975,10 @@ class Ie extends Error {
975
975
  super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'), this.avoidNew = !0, this.value = e, this.name = "NewError";
976
976
  }
977
977
  }
978
- function x(r, e, t, s, n) {
979
- if (!(this instanceof x))
978
+ function k(r, e, t, s, n) {
979
+ if (!(this instanceof k))
980
980
  try {
981
- return new x(r, e, t, s, n);
981
+ return new k(r, e, t, s, n);
982
982
  } catch (c) {
983
983
  if (!c.avoidNew)
984
984
  throw c;
@@ -995,11 +995,11 @@ function x(r, e, t, s, n) {
995
995
  a ? "json" in r && (c.json = r.json) : c.json = t;
996
996
  const f = this.evaluate(c);
997
997
  if (!f || typeof f != "object")
998
- throw new Ie(f);
998
+ throw new $e(f);
999
999
  return f;
1000
1000
  }
1001
1001
  }
1002
- x.prototype.evaluate = function(r, e, t, s) {
1002
+ k.prototype.evaluate = function(r, e, t, s) {
1003
1003
  let n = this.parent, a = this.parentProperty, {
1004
1004
  flatten: c,
1005
1005
  wrap: f
@@ -1013,172 +1013,172 @@ x.prototype.evaluate = function(r, e, t, s) {
1013
1013
  json: e
1014
1014
  } = r), c = Object.hasOwn(r, "flatten") ? r.flatten : c, this.currResultType = Object.hasOwn(r, "resultType") ? r.resultType : this.currResultType, this.currSandbox = Object.hasOwn(r, "sandbox") ? r.sandbox : this.currSandbox, f = Object.hasOwn(r, "wrap") ? r.wrap : f, this.currEval = Object.hasOwn(r, "eval") ? r.eval : this.currEval, t = Object.hasOwn(r, "callback") ? r.callback : t, this.currOtherTypeCallback = Object.hasOwn(r, "otherTypeCallback") ? r.otherTypeCallback : this.currOtherTypeCallback, n = Object.hasOwn(r, "parent") ? r.parent : n, a = Object.hasOwn(r, "parentProperty") ? r.parentProperty : a, r = r.path;
1015
1015
  }
1016
- if (n = n || null, a = a || null, Array.isArray(r) && (r = x.toPathString(r)), !r && r !== "" || !e)
1016
+ if (n = n || null, a = a || null, Array.isArray(r) && (r = k.toPathString(r)), !r && r !== "" || !e)
1017
1017
  return;
1018
- const d = x.toPathArray(r);
1019
- d[0] === "$" && d.length > 1 && d.shift(), this._hasParentSelector = null;
1020
- const h = this._trace(d, e, ["$"], n, a, t).filter(function(v) {
1021
- return v && !v.isParentSelector;
1018
+ const h = k.toPathArray(r);
1019
+ h[0] === "$" && h.length > 1 && h.shift(), this._hasParentSelector = null;
1020
+ const d = this._trace(h, e, ["$"], n, a, t).filter(function(_) {
1021
+ return _ && !_.isParentSelector;
1022
1022
  });
1023
- return h.length ? !f && h.length === 1 && !h[0].hasArrExpr ? this._getPreferredOutput(h[0]) : h.reduce((v, g) => {
1024
- const k = this._getPreferredOutput(g);
1025
- return c && Array.isArray(k) ? v = v.concat(k) : v.push(k), v;
1023
+ return d.length ? !f && d.length === 1 && !d[0].hasArrExpr ? this._getPreferredOutput(d[0]) : d.reduce((_, b) => {
1024
+ const x = this._getPreferredOutput(b);
1025
+ return c && Array.isArray(x) ? _ = _.concat(x) : _.push(x), _;
1026
1026
  }, []) : f ? [] : void 0;
1027
1027
  };
1028
- x.prototype._getPreferredOutput = function(r) {
1028
+ k.prototype._getPreferredOutput = function(r) {
1029
1029
  const e = this.currResultType;
1030
1030
  switch (e) {
1031
1031
  case "all": {
1032
- const t = Array.isArray(r.path) ? r.path : x.toPathArray(r.path);
1033
- return r.pointer = x.toPointer(t), r.path = typeof r.path == "string" ? r.path : x.toPathString(r.path), r;
1032
+ const t = Array.isArray(r.path) ? r.path : k.toPathArray(r.path);
1033
+ return r.pointer = k.toPointer(t), r.path = typeof r.path == "string" ? r.path : k.toPathString(r.path), r;
1034
1034
  }
1035
1035
  case "value":
1036
1036
  case "parent":
1037
1037
  case "parentProperty":
1038
1038
  return r[e];
1039
1039
  case "path":
1040
- return x.toPathString(r[e]);
1040
+ return k.toPathString(r[e]);
1041
1041
  case "pointer":
1042
- return x.toPointer(r.path);
1042
+ return k.toPointer(r.path);
1043
1043
  default:
1044
1044
  throw new TypeError("Unknown result type");
1045
1045
  }
1046
1046
  };
1047
- x.prototype._handleCallback = function(r, e, t) {
1047
+ k.prototype._handleCallback = function(r, e, t) {
1048
1048
  if (e) {
1049
1049
  const s = this._getPreferredOutput(r);
1050
- r.path = typeof r.path == "string" ? r.path : x.toPathString(r.path), e(s, t, r);
1050
+ r.path = typeof r.path == "string" ? r.path : k.toPathString(r.path), e(s, t, r);
1051
1051
  }
1052
1052
  };
1053
- x.prototype._trace = function(r, e, t, s, n, a, c, f) {
1054
- let d;
1053
+ k.prototype._trace = function(r, e, t, s, n, a, c, f) {
1054
+ let h;
1055
1055
  if (!r.length)
1056
- return d = {
1056
+ return h = {
1057
1057
  path: t,
1058
1058
  value: e,
1059
1059
  parent: s,
1060
1060
  parentProperty: n,
1061
1061
  hasArrExpr: c
1062
- }, this._handleCallback(d, a, "value"), d;
1063
- const h = r[0], v = r.slice(1), g = [];
1064
- function k(E) {
1065
- Array.isArray(E) ? E.forEach((S) => {
1066
- g.push(S);
1067
- }) : g.push(E);
1068
- }
1069
- if ((typeof h != "string" || f) && e && Object.hasOwn(e, h))
1070
- k(this._trace(v, e[h], M(t, h), e, h, a, c));
1071
- else if (h === "*")
1072
- this._walk(e, (E) => {
1073
- k(this._trace(v, e[E], M(t, E), e, E, a, !0, !0));
1062
+ }, this._handleCallback(h, a, "value"), h;
1063
+ const d = r[0], _ = r.slice(1), b = [];
1064
+ function x(g) {
1065
+ Array.isArray(g) ? g.forEach((w) => {
1066
+ b.push(w);
1067
+ }) : b.push(g);
1068
+ }
1069
+ if ((typeof d != "string" || f) && e && Object.hasOwn(e, d))
1070
+ x(this._trace(_, e[d], G(t, d), e, d, a, c));
1071
+ else if (d === "*")
1072
+ this._walk(e, (g) => {
1073
+ x(this._trace(_, e[g], G(t, g), e, g, a, !0, !0));
1074
1074
  });
1075
- else if (h === "..")
1076
- k(this._trace(v, e, t, s, n, a, c)), this._walk(e, (E) => {
1077
- typeof e[E] == "object" && k(this._trace(r.slice(), e[E], M(t, E), e, E, a, !0));
1075
+ else if (d === "..")
1076
+ x(this._trace(_, e, t, s, n, a, c)), this._walk(e, (g) => {
1077
+ typeof e[g] == "object" && x(this._trace(r.slice(), e[g], G(t, g), e, g, a, !0));
1078
1078
  });
1079
1079
  else {
1080
- if (h === "^")
1080
+ if (d === "^")
1081
1081
  return this._hasParentSelector = !0, {
1082
1082
  path: t.slice(0, -1),
1083
- expr: v,
1083
+ expr: _,
1084
1084
  isParentSelector: !0
1085
1085
  };
1086
- if (h === "~")
1087
- return d = {
1088
- path: M(t, h),
1086
+ if (d === "~")
1087
+ return h = {
1088
+ path: G(t, d),
1089
1089
  value: n,
1090
1090
  parent: s,
1091
1091
  parentProperty: null
1092
- }, this._handleCallback(d, a, "property"), d;
1093
- if (h === "$")
1094
- k(this._trace(v, e, t, null, null, a, c));
1095
- else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(h))
1096
- k(this._slice(h, v, e, t, s, n, a));
1097
- else if (h.indexOf("?(") === 0) {
1092
+ }, this._handleCallback(h, a, "property"), h;
1093
+ if (d === "$")
1094
+ x(this._trace(_, e, t, null, null, a, c));
1095
+ else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(d))
1096
+ x(this._slice(d, _, e, t, s, n, a));
1097
+ else if (d.indexOf("?(") === 0) {
1098
1098
  if (this.currEval === !1)
1099
1099
  throw new Error("Eval [?(expr)] prevented in JSONPath expression.");
1100
- const E = h.replace(/^\?\((.*?)\)$/u, "$1"), S = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(E);
1101
- S ? this._walk(e, (C) => {
1102
- const U = [S[2]], I = S[1] ? e[C][S[1]] : e[C];
1103
- this._trace(U, I, t, s, n, a, !0).length > 0 && k(this._trace(v, e[C], M(t, C), e, C, a, !0));
1104
- }) : this._walk(e, (C) => {
1105
- this._eval(E, e[C], C, t, s, n) && k(this._trace(v, e[C], M(t, C), e, C, a, !0));
1100
+ const g = d.replace(/^\?\((.*?)\)$/u, "$1"), w = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(g);
1101
+ w ? this._walk(e, (S) => {
1102
+ const M = [w[2]], $ = w[1] ? e[S][w[1]] : e[S];
1103
+ this._trace(M, $, t, s, n, a, !0).length > 0 && x(this._trace(_, e[S], G(t, S), e, S, a, !0));
1104
+ }) : this._walk(e, (S) => {
1105
+ this._eval(g, e[S], S, t, s, n) && x(this._trace(_, e[S], G(t, S), e, S, a, !0));
1106
1106
  });
1107
- } else if (h[0] === "(") {
1107
+ } else if (d[0] === "(") {
1108
1108
  if (this.currEval === !1)
1109
1109
  throw new Error("Eval [(expr)] prevented in JSONPath expression.");
1110
- k(this._trace(ue(this._eval(h, e, t.at(-1), t.slice(0, -1), s, n), v), e, t, s, n, a, c));
1111
- } else if (h[0] === "@") {
1112
- let E = !1;
1113
- const S = h.slice(1, -2);
1114
- switch (S) {
1110
+ x(this._trace(de(this._eval(d, e, t.at(-1), t.slice(0, -1), s, n), _), e, t, s, n, a, c));
1111
+ } else if (d[0] === "@") {
1112
+ let g = !1;
1113
+ const w = d.slice(1, -2);
1114
+ switch (w) {
1115
1115
  case "scalar":
1116
- (!e || !["object", "function"].includes(typeof e)) && (E = !0);
1116
+ (!e || !["object", "function"].includes(typeof e)) && (g = !0);
1117
1117
  break;
1118
1118
  case "boolean":
1119
1119
  case "string":
1120
1120
  case "undefined":
1121
1121
  case "function":
1122
- typeof e === S && (E = !0);
1122
+ typeof e === w && (g = !0);
1123
1123
  break;
1124
1124
  case "integer":
1125
- Number.isFinite(e) && !(e % 1) && (E = !0);
1125
+ Number.isFinite(e) && !(e % 1) && (g = !0);
1126
1126
  break;
1127
1127
  case "number":
1128
- Number.isFinite(e) && (E = !0);
1128
+ Number.isFinite(e) && (g = !0);
1129
1129
  break;
1130
1130
  case "nonFinite":
1131
- typeof e == "number" && !Number.isFinite(e) && (E = !0);
1131
+ typeof e == "number" && !Number.isFinite(e) && (g = !0);
1132
1132
  break;
1133
1133
  case "object":
1134
- e && typeof e === S && (E = !0);
1134
+ e && typeof e === w && (g = !0);
1135
1135
  break;
1136
1136
  case "array":
1137
- Array.isArray(e) && (E = !0);
1137
+ Array.isArray(e) && (g = !0);
1138
1138
  break;
1139
1139
  case "other":
1140
- E = this.currOtherTypeCallback(e, t, s, n);
1140
+ g = this.currOtherTypeCallback(e, t, s, n);
1141
1141
  break;
1142
1142
  case "null":
1143
- e === null && (E = !0);
1143
+ e === null && (g = !0);
1144
1144
  break;
1145
1145
  /* c8 ignore next 2 */
1146
1146
  default:
1147
- throw new TypeError("Unknown value type " + S);
1147
+ throw new TypeError("Unknown value type " + w);
1148
1148
  }
1149
- if (E)
1150
- return d = {
1149
+ if (g)
1150
+ return h = {
1151
1151
  path: t,
1152
1152
  value: e,
1153
1153
  parent: s,
1154
1154
  parentProperty: n
1155
- }, this._handleCallback(d, a, "value"), d;
1156
- } else if (h[0] === "`" && e && Object.hasOwn(e, h.slice(1))) {
1157
- const E = h.slice(1);
1158
- k(this._trace(v, e[E], M(t, E), e, E, a, c, !0));
1159
- } else if (h.includes(",")) {
1160
- const E = h.split(",");
1161
- for (const S of E)
1162
- k(this._trace(ue(S, v), e, t, s, n, a, !0));
1163
- } else !f && e && Object.hasOwn(e, h) && k(this._trace(v, e[h], M(t, h), e, h, a, c, !0));
1155
+ }, this._handleCallback(h, a, "value"), h;
1156
+ } else if (d[0] === "`" && e && Object.hasOwn(e, d.slice(1))) {
1157
+ const g = d.slice(1);
1158
+ x(this._trace(_, e[g], G(t, g), e, g, a, c, !0));
1159
+ } else if (d.includes(",")) {
1160
+ const g = d.split(",");
1161
+ for (const w of g)
1162
+ x(this._trace(de(w, _), e, t, s, n, a, !0));
1163
+ } else !f && e && Object.hasOwn(e, d) && x(this._trace(_, e[d], G(t, d), e, d, a, c, !0));
1164
1164
  }
1165
1165
  if (this._hasParentSelector)
1166
- for (let E = 0; E < g.length; E++) {
1167
- const S = g[E];
1168
- if (S && S.isParentSelector) {
1169
- const C = this._trace(S.expr, e, S.path, s, n, a, c);
1170
- if (Array.isArray(C)) {
1171
- g[E] = C[0];
1172
- const U = C.length;
1173
- for (let I = 1; I < U; I++)
1174
- E++, g.splice(E, 0, C[I]);
1166
+ for (let g = 0; g < b.length; g++) {
1167
+ const w = b[g];
1168
+ if (w && w.isParentSelector) {
1169
+ const S = this._trace(w.expr, e, w.path, s, n, a, c);
1170
+ if (Array.isArray(S)) {
1171
+ b[g] = S[0];
1172
+ const M = S.length;
1173
+ for (let $ = 1; $ < M; $++)
1174
+ g++, b.splice(g, 0, S[$]);
1175
1175
  } else
1176
- g[E] = C;
1176
+ b[g] = S;
1177
1177
  }
1178
1178
  }
1179
- return g;
1179
+ return b;
1180
1180
  };
1181
- x.prototype._walk = function(r, e) {
1181
+ k.prototype._walk = function(r, e) {
1182
1182
  if (Array.isArray(r)) {
1183
1183
  const t = r.length;
1184
1184
  for (let s = 0; s < t; s++)
@@ -1187,67 +1187,67 @@ x.prototype._walk = function(r, e) {
1187
1187
  e(t);
1188
1188
  });
1189
1189
  };
1190
- x.prototype._slice = function(r, e, t, s, n, a, c) {
1190
+ k.prototype._slice = function(r, e, t, s, n, a, c) {
1191
1191
  if (!Array.isArray(t))
1192
1192
  return;
1193
- const f = t.length, d = r.split(":"), h = d[2] && Number.parseInt(d[2]) || 1;
1194
- let v = d[0] && Number.parseInt(d[0]) || 0, g = d[1] && Number.parseInt(d[1]) || f;
1195
- v = v < 0 ? Math.max(0, v + f) : Math.min(f, v), g = g < 0 ? Math.max(0, g + f) : Math.min(f, g);
1196
- const k = [];
1197
- for (let E = v; E < g; E += h)
1198
- this._trace(ue(E, e), t, s, n, a, c, !0).forEach((C) => {
1199
- k.push(C);
1193
+ const f = t.length, h = r.split(":"), d = h[2] && Number.parseInt(h[2]) || 1;
1194
+ let _ = h[0] && Number.parseInt(h[0]) || 0, b = h[1] && Number.parseInt(h[1]) || f;
1195
+ _ = _ < 0 ? Math.max(0, _ + f) : Math.min(f, _), b = b < 0 ? Math.max(0, b + f) : Math.min(f, b);
1196
+ const x = [];
1197
+ for (let g = _; g < b; g += d)
1198
+ this._trace(de(g, e), t, s, n, a, c, !0).forEach((S) => {
1199
+ x.push(S);
1200
1200
  });
1201
- return k;
1201
+ return x;
1202
1202
  };
1203
- x.prototype._eval = function(r, e, t, s, n, a) {
1203
+ k.prototype._eval = function(r, e, t, s, n, a) {
1204
1204
  this.currSandbox._$_parentProperty = a, this.currSandbox._$_parent = n, this.currSandbox._$_property = t, this.currSandbox._$_root = this.json, this.currSandbox._$_v = e;
1205
1205
  const c = r.includes("@path");
1206
- c && (this.currSandbox._$_path = x.toPathString(s.concat([t])));
1206
+ c && (this.currSandbox._$_path = k.toPathString(s.concat([t])));
1207
1207
  const f = this.currEval + "Script:" + r;
1208
- if (!x.cache[f]) {
1209
- let d = r.replaceAll("@parentProperty", "_$_parentProperty").replaceAll("@parent", "_$_parent").replaceAll("@property", "_$_property").replaceAll("@root", "_$_root").replaceAll(/@([.\s)[])/gu, "_$_v$1");
1210
- if (c && (d = d.replaceAll("@path", "_$_path")), this.currEval === "safe" || this.currEval === !0 || this.currEval === void 0)
1211
- x.cache[f] = new this.safeVm.Script(d);
1208
+ if (!k.cache[f]) {
1209
+ let h = r.replaceAll("@parentProperty", "_$_parentProperty").replaceAll("@parent", "_$_parent").replaceAll("@property", "_$_property").replaceAll("@root", "_$_root").replaceAll(/@([.\s)[])/gu, "_$_v$1");
1210
+ if (c && (h = h.replaceAll("@path", "_$_path")), this.currEval === "safe" || this.currEval === !0 || this.currEval === void 0)
1211
+ k.cache[f] = new this.safeVm.Script(h);
1212
1212
  else if (this.currEval === "native")
1213
- x.cache[f] = new this.vm.Script(d);
1213
+ k.cache[f] = new this.vm.Script(h);
1214
1214
  else if (typeof this.currEval == "function" && this.currEval.prototype && Object.hasOwn(this.currEval.prototype, "runInNewContext")) {
1215
- const h = this.currEval;
1216
- x.cache[f] = new h(d);
1215
+ const d = this.currEval;
1216
+ k.cache[f] = new d(h);
1217
1217
  } else if (typeof this.currEval == "function")
1218
- x.cache[f] = {
1219
- runInNewContext: (h) => this.currEval(d, h)
1218
+ k.cache[f] = {
1219
+ runInNewContext: (d) => this.currEval(h, d)
1220
1220
  };
1221
1221
  else
1222
1222
  throw new TypeError(`Unknown "eval" property "${this.currEval}"`);
1223
1223
  }
1224
1224
  try {
1225
- return x.cache[f].runInNewContext(this.currSandbox);
1226
- } catch (d) {
1225
+ return k.cache[f].runInNewContext(this.currSandbox);
1226
+ } catch (h) {
1227
1227
  if (this.ignoreEvalErrors)
1228
1228
  return !1;
1229
- throw new Error("jsonPath: " + d.message + ": " + r);
1229
+ throw new Error("jsonPath: " + h.message + ": " + r);
1230
1230
  }
1231
1231
  };
1232
- x.cache = {};
1233
- x.toPathString = function(r) {
1232
+ k.cache = {};
1233
+ k.toPathString = function(r) {
1234
1234
  const e = r, t = e.length;
1235
1235
  let s = "$";
1236
1236
  for (let n = 1; n < t; n++)
1237
1237
  /^(~|\^|@.*?\(\))$/u.test(e[n]) || (s += /^[0-9*]+$/u.test(e[n]) ? "[" + e[n] + "]" : "['" + e[n] + "']");
1238
1238
  return s;
1239
1239
  };
1240
- x.toPointer = function(r) {
1240
+ k.toPointer = function(r) {
1241
1241
  const e = r, t = e.length;
1242
1242
  let s = "";
1243
1243
  for (let n = 1; n < t; n++)
1244
1244
  /^(~|\^|@.*?\(\))$/u.test(e[n]) || (s += "/" + e[n].toString().replaceAll("~", "~0").replaceAll("/", "~1"));
1245
1245
  return s;
1246
1246
  };
1247
- x.toPathArray = function(r) {
1247
+ k.toPathArray = function(r) {
1248
1248
  const {
1249
1249
  cache: e
1250
- } = x;
1250
+ } = k;
1251
1251
  if (e[r])
1252
1252
  return e[r].concat();
1253
1253
  const t = [], n = r.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu, function(a, c) {
@@ -1262,17 +1262,17 @@ x.toPathArray = function(r) {
1262
1262
  });
1263
1263
  return e[r] = n, e[r].concat();
1264
1264
  };
1265
- x.prototype.safeVm = {
1265
+ k.prototype.safeVm = {
1266
1266
  Script: je
1267
1267
  };
1268
- const $e = function(r, e, t) {
1268
+ const Re = function(r, e, t) {
1269
1269
  const s = r.length;
1270
1270
  for (let n = 0; n < s; n++) {
1271
1271
  const a = r[n];
1272
1272
  t(a) && e.push(r.splice(n--, 1)[0]);
1273
1273
  }
1274
1274
  };
1275
- class Re {
1275
+ class Le {
1276
1276
  /**
1277
1277
  * @param {string} expr Expression to evaluate
1278
1278
  */
@@ -1287,47 +1287,47 @@ class Re {
1287
1287
  runInNewContext(e) {
1288
1288
  let t = this.code;
1289
1289
  const s = Object.keys(e), n = [];
1290
- $e(s, n, (h) => typeof e[h] == "function");
1291
- const a = s.map((h) => e[h]);
1292
- t = n.reduce((h, v) => {
1293
- let g = e[v].toString();
1294
- return /function/u.test(g) || (g = "function " + g), "var " + v + "=" + g + ";" + h;
1290
+ Re(s, n, (d) => typeof e[d] == "function");
1291
+ const a = s.map((d) => e[d]);
1292
+ t = n.reduce((d, _) => {
1293
+ let b = e[_].toString();
1294
+ return /function/u.test(b) || (b = "function " + b), "var " + _ + "=" + b + ";" + d;
1295
1295
  }, "") + t, !/(['"])use strict\1/u.test(t) && !s.includes("arguments") && (t = "var arguments = undefined;" + t), t = t.replace(/;\s*$/u, "");
1296
- const f = t.lastIndexOf(";"), d = f !== -1 ? t.slice(0, f + 1) + " return " + t.slice(f + 1) : " return " + t;
1297
- return new Function(...s, d)(...a);
1296
+ const f = t.lastIndexOf(";"), h = f !== -1 ? t.slice(0, f + 1) + " return " + t.slice(f + 1) : " return " + t;
1297
+ return new Function(...s, h)(...a);
1298
1298
  }
1299
1299
  }
1300
- x.prototype.vm = {
1301
- Script: Re
1300
+ k.prototype.vm = {
1301
+ Script: Le
1302
1302
  };
1303
- const Le = { class: "json-node" }, Ue = {
1303
+ const Ue = { class: "json-node" }, Me = {
1304
1304
  key: 0,
1305
1305
  class: "json-node__container"
1306
- }, Me = { class: "json-node__line" }, Ve = {
1306
+ }, Ve = { class: "json-node__line" }, Fe = {
1307
1307
  key: 2,
1308
1308
  class: "json-node__colon"
1309
- }, Fe = ["title"], He = {
1309
+ }, He = ["title"], Ke = {
1310
1310
  key: 3,
1311
1311
  class: "json-node__collapsed"
1312
- }, Ke = {
1312
+ }, Xe = {
1313
1313
  key: 4,
1314
1314
  class: "json-node__comma"
1315
- }, Xe = {
1315
+ }, Ge = {
1316
1316
  key: 0,
1317
1317
  class: "json-node__children"
1318
- }, Ge = { class: "json-node__children-content" }, Qe = { class: "json-node__line json-node__closing-bracket" }, Ye = { class: "json-node__bracket" }, qe = {
1318
+ }, Qe = { class: "json-node__children-content" }, Ye = { class: "json-node__line json-node__closing-bracket" }, qe = { class: "json-node__bracket" }, ze = {
1319
1319
  key: 0,
1320
1320
  class: "json-node__comma"
1321
- }, ze = {
1321
+ }, We = {
1322
1322
  key: 1,
1323
1323
  class: "json-node__primitive"
1324
- }, We = {
1324
+ }, Ze = {
1325
1325
  key: 2,
1326
1326
  class: "json-node__colon"
1327
- }, Ze = ["title"], Je = {
1327
+ }, Je = ["title"], et = {
1328
1328
  key: 0,
1329
1329
  class: "json-node__comma"
1330
- }, et = /* @__PURE__ */ fe({
1330
+ }, tt = /* @__PURE__ */ pe({
1331
1331
  name: "JsonNode",
1332
1332
  __name: "JsonNode",
1333
1333
  props: {
@@ -1341,195 +1341,201 @@ const Le = { class: "json-node" }, Ue = {
1341
1341
  },
1342
1342
  emits: ["update:value", "toggle-expand", "copy", "update:key"],
1343
1343
  setup(r, { emit: e }) {
1344
- pe((u) => ({
1345
- "41b58a02": u.level,
1346
- "63accfe8": u.theme.colors.syntaxKey,
1347
- "7a4b22f6": u.theme.colors.hoverBackground,
1348
- "5865f1b1": u.theme.colors.syntaxBracket,
1349
- "79c93d33": u.theme.colors.textSecondary,
1350
- "59ced5e8": u.theme.colors.syntaxString,
1351
- 51525120: u.theme.colors.syntaxNumber,
1352
- "5410b131": u.theme.colors.syntaxBoolean,
1353
- "11eec51e": u.theme.colors.syntaxNull,
1354
- ac53437c: u.theme.colors.background,
1355
- "15cbe7d4": u.theme.colors.indentLine
1344
+ ye((u) => ({
1345
+ a64439cc: u.level,
1346
+ "34bc012d": u.theme.colors.syntaxKey,
1347
+ "577f8c7b": u.theme.colors.hoverBackground,
1348
+ "7f7e0f14": u.theme.colors.syntaxBracket,
1349
+ "3cb77810": u.theme.colors.textSecondary,
1350
+ "5e753afa": u.theme.colors.syntaxString,
1351
+ "6f6e448a": u.theme.colors.syntaxNumber,
1352
+ 88289014: u.theme.colors.syntaxBoolean,
1353
+ "62c5bc79": u.theme.colors.syntaxNull,
1354
+ "0aa554c6": u.theme.colors.background,
1355
+ "66a2df2f": u.theme.colors.indentLine
1356
1356
  }));
1357
- const t = r, s = e, n = R(!1), a = R(!1), c = R(""), f = R(""), d = (u) => {
1357
+ const t = r, s = e, n = H(!1), a = H(!1), c = H(""), f = H(""), h = (u) => {
1358
1358
  if (!/^-?\d+(\.\d+)?$/.test(u)) return !1;
1359
- const _ = Number(u);
1360
- return !Number.isSafeInteger(_) || u.length > 15;
1361
- }, h = D(() => t.value !== null && typeof t.value == "object"), v = D(() => Array.isArray(t.value)), g = D(() => t.path ? t.path : t.keyName ? t.keyName : "root"), k = D(() => t.expanded.has(g.value)), E = D(() => t.keyName), S = D(() => v.value ? "[" : "{"), C = D(() => v.value ? "]" : "}"), U = D(() => {
1359
+ const E = Number(u);
1360
+ return !Number.isSafeInteger(E) || u.length > 15;
1361
+ }, d = (u) => {
1362
+ if (typeof u != "string" || !/^-?\d+(\.\d+)?$/.test(u)) return !1;
1363
+ if (u.includes(".") && /\.\d*0$/.test(u))
1364
+ return !0;
1365
+ const E = Number(u), i = u.startsWith("-") ? u.slice(1) : u;
1366
+ return !Number.isSafeInteger(E) || i.length > 15;
1367
+ }, _ = j(() => t.value !== null && typeof t.value == "object"), b = j(() => Array.isArray(t.value)), x = j(() => t.path ? t.path : t.keyName ? t.keyName : "root"), g = j(() => t.expanded.has(x.value)), w = j(() => t.keyName), S = j(() => b.value ? "[" : "{"), M = j(() => b.value ? "]" : "}"), $ = j(() => {
1362
1368
  if (!t.value) return "";
1363
- const _ = Object.keys(t.value).length;
1364
- return v.value ? _ > 0 ? ` ${_} items ` : " " : _ > 0 ? ` ${_} keys ` : " ";
1365
- }), I = D(() => {
1369
+ const E = Object.keys(t.value).length;
1370
+ return b.value ? E > 0 ? ` ${E} items ` : " " : E > 0 ? ` ${E} keys ` : " ";
1371
+ }), W = j(() => {
1366
1372
  const u = typeof t.value;
1367
1373
  return t.value === null ? "json-node__value--null" : u === "boolean" ? "json-node__value--boolean" : u === "number" ? "json-node__value--number" : u === "string" ? d(t.value) ? "json-node__value--number" : "json-node__value--string" : "";
1368
- }), q = D(() => a.value ? f.value : t.value === null ? "null" : typeof t.value == "boolean" || typeof t.value == "number" ? String(t.value) : typeof t.value == "string" ? d(t.value) ? t.value : `"${t.value}"` : String(t.value)), se = D(() => "Click to edit, double-click to copy"), te = (u) => t.level === 0 ? u : g.value ? `${g.value}.${u}` : u, V = (u) => {
1369
- const _ = Object.keys(t.value);
1370
- return _.indexOf(u) === _.length - 1;
1371
- }, z = () => {
1372
- s("toggle-expand", g.value);
1373
- }, W = () => {
1374
+ }), ae = j(() => a.value ? f.value : t.value === null ? "null" : typeof t.value == "boolean" || typeof t.value == "number" ? String(t.value) : typeof t.value == "string" ? d(t.value) ? t.value : `"${t.value}"` : String(t.value)), te = j(() => "Click to edit, double-click to copy"), Q = (u) => t.level === 0 ? u : x.value ? `${x.value}.${u}` : u, re = (u) => {
1375
+ const E = Object.keys(t.value);
1376
+ return E.indexOf(u) === E.length - 1;
1377
+ }, Z = () => {
1378
+ s("toggle-expand", x.value);
1379
+ }, J = () => {
1374
1380
  t.level !== 0 && (n.value = !0, c.value = t.keyName, ee(() => {
1375
- const u = document.querySelectorAll(".json-node__key-input"), _ = u[u.length - 1];
1376
- _ && (_.focus(), _.select());
1381
+ const u = document.querySelectorAll(".json-node__key-input"), E = u[u.length - 1];
1382
+ E && (E.focus(), E.select());
1377
1383
  }));
1378
- }, re = () => {
1379
- h.value || (a.value = !0, typeof t.value == "string" && d(t.value) || typeof t.value == "string" ? f.value = t.value : f.value = String(t.value), ee(() => {
1380
- const u = document.querySelectorAll(".json-node__value-input"), _ = u[u.length - 1];
1381
- _ && (_.focus(), _.select());
1384
+ }, ne = () => {
1385
+ _.value || (a.value = !0, typeof t.value == "string" && h(t.value) || typeof t.value == "string" ? f.value = t.value : f.value = String(t.value), ee(() => {
1386
+ const u = document.querySelectorAll(".json-node__value-input"), E = u[u.length - 1];
1387
+ E && (E.focus(), E.select());
1382
1388
  }));
1383
- }, F = () => {
1389
+ }, Y = () => {
1384
1390
  if (t.level === 0 || !n.value) return;
1385
1391
  const u = c.value.trim();
1386
1392
  if (!u) {
1387
- J();
1393
+ X();
1388
1394
  return;
1389
1395
  }
1390
1396
  if (u === t.keyName) {
1391
1397
  n.value = !1;
1392
1398
  return;
1393
1399
  }
1394
- n.value = !1, s("update:key", g.value, u);
1395
- }, Z = () => {
1400
+ n.value = !1, s("update:key", x.value, u);
1401
+ }, se = () => {
1396
1402
  try {
1397
1403
  let u;
1398
- const _ = f.value.trim();
1399
- if (_ === "null")
1404
+ const E = f.value.trim();
1405
+ if (E === "null")
1400
1406
  u = null;
1401
- else if (_ === "true" || _ === "false")
1402
- u = _ === "true";
1403
- else if (!isNaN(Number(_)) && _ !== "") {
1404
- const X = Number(_);
1405
- !Number.isSafeInteger(X) || _.length > 15 ? u = _ : u = X;
1407
+ else if (E === "true" || E === "false")
1408
+ u = E === "true";
1409
+ else if (!isNaN(Number(E)) && E !== "") {
1410
+ const i = Number(E);
1411
+ !Number.isSafeInteger(i) || E.length > 15 ? u = E : u = i;
1406
1412
  } else
1407
1413
  u = f.value;
1408
- s("update:value", g.value, u), a.value = !1;
1414
+ s("update:value", x.value, u), a.value = !1;
1409
1415
  } catch (u) {
1410
1416
  console.error("Failed to parse value:", u), a.value = !1;
1411
1417
  }
1412
- }, J = () => {
1418
+ }, X = () => {
1413
1419
  n.value = !1, c.value = t.keyName;
1414
- }, K = () => {
1415
- a.value = !1, typeof t.value == "string" && d(t.value) || typeof t.value == "string" ? f.value = t.value : f.value = String(t.value);
1420
+ }, oe = () => {
1421
+ a.value = !1, typeof t.value == "string" && h(t.value) || typeof t.value == "string" ? f.value = t.value : f.value = String(t.value);
1416
1422
  };
1417
- return (u, _) => {
1418
- const X = ve("JsonNode", !0);
1419
- return w(), A("div", Le, [
1420
- h.value ? (w(), A("div", Ue, [
1421
- P("div", Me, [
1422
- u.keyName && !n.value ? (w(), A("span", {
1423
+ return (u, E) => {
1424
+ const i = _e("JsonNode", !0);
1425
+ return A(), C("div", Ue, [
1426
+ _.value ? (A(), C("div", Me, [
1427
+ B("div", Ve, [
1428
+ u.keyName && !n.value ? (A(), C("span", {
1423
1429
  key: 0,
1424
1430
  class: "json-node__key",
1425
- onClick: W,
1431
+ onClick: J,
1426
1432
  title: "Click to edit key"
1427
- }, ' "' + $(E.value) + '" ', 1)) : B("", !0),
1428
- u.keyName && n.value ? ae((w(), A("input", {
1433
+ }, ' "' + F(w.value) + '" ', 1)) : I("", !0),
1434
+ u.keyName && n.value ? le((A(), C("input", {
1429
1435
  key: 1,
1430
- "onUpdate:modelValue": _[0] || (_[0] = (i) => c.value = i),
1436
+ "onUpdate:modelValue": E[0] || (E[0] = (l) => c.value = l),
1431
1437
  onKeyup: [
1432
- Q(F, ["enter"]),
1433
- Q(J, ["escape"])
1438
+ q(Y, ["enter"]),
1439
+ q(X, ["escape"])
1434
1440
  ],
1435
- onBlur: F,
1441
+ onBlur: Y,
1436
1442
  class: "json-node__key-input"
1437
1443
  }, null, 544)), [
1438
- [le, c.value]
1439
- ]) : B("", !0),
1440
- u.keyName ? (w(), A("span", Ve, ": ")) : B("", !0),
1441
- P("span", {
1444
+ [ce, c.value]
1445
+ ]) : I("", !0),
1446
+ u.keyName ? (A(), C("span", Fe, ": ")) : I("", !0),
1447
+ B("span", {
1442
1448
  class: "json-node__bracket json-node__bracket--clickable",
1443
- onClick: z,
1444
- title: k.value ? "Click to collapse" : "Click to expand"
1445
- }, $(S.value), 9, Fe),
1446
- k.value ? B("", !0) : (w(), A("span", He, [
1447
- de($(U.value) + " ", 1),
1448
- P("span", {
1449
+ onClick: Z,
1450
+ title: g.value ? "Click to collapse" : "Click to expand"
1451
+ }, F(S.value), 9, He),
1452
+ g.value ? I("", !0) : (A(), C("span", Ke, [
1453
+ he(F($.value) + " ", 1),
1454
+ B("span", {
1449
1455
  class: "json-node__bracket json-node__bracket--clickable",
1450
- onClick: z
1451
- }, $(C.value), 1)
1456
+ onClick: Z
1457
+ }, F(M.value), 1)
1452
1458
  ])),
1453
- !k.value && !u.isLast ? (w(), A("span", Ke, ",")) : B("", !0)
1459
+ !g.value && !u.isLast ? (A(), C("span", Xe, ",")) : I("", !0)
1454
1460
  ]),
1455
- k.value ? (w(), A("div", Xe, [
1456
- P("div", Ge, [
1457
- (w(!0), A(_e, null, xe(u.value, (i, l) => (w(), A("div", {
1458
- key: l,
1461
+ g.value ? (A(), C("div", Ge, [
1462
+ B("div", Qe, [
1463
+ (A(!0), C(xe, null, ke(u.value, (l, m) => (A(), C("div", {
1464
+ key: m,
1459
1465
  class: "json-node__child"
1460
1466
  }, [
1461
- ye(X, {
1462
- value: i,
1463
- "key-name": v.value ? "" : String(l),
1467
+ ge(i, {
1468
+ value: l,
1469
+ "key-name": b.value ? "" : String(m),
1464
1470
  level: u.level + 1,
1465
- path: te(String(l)),
1471
+ path: Q(String(m)),
1466
1472
  expanded: u.expanded,
1467
1473
  theme: u.theme,
1468
- "onUpdate:value": _[1] || (_[1] = (p, y) => u.$emit("update:value", p, y)),
1469
- onToggleExpand: _[2] || (_[2] = (p) => u.$emit("toggle-expand", p)),
1470
- onCopy: _[3] || (_[3] = (p) => u.$emit("copy", p)),
1471
- "onUpdate:key": _[4] || (_[4] = (p, y) => u.$emit("update:key", p, y)),
1472
- "is-last": V(String(l))
1474
+ "onUpdate:value": E[1] || (E[1] = (p, y) => u.$emit("update:value", p, y)),
1475
+ onToggleExpand: E[2] || (E[2] = (p) => u.$emit("toggle-expand", p)),
1476
+ onCopy: E[3] || (E[3] = (p) => u.$emit("copy", p)),
1477
+ "onUpdate:key": E[4] || (E[4] = (p, y) => u.$emit("update:key", p, y)),
1478
+ "is-last": re(String(m))
1473
1479
  }, null, 8, ["value", "key-name", "level", "path", "expanded", "theme", "is-last"])
1474
1480
  ]))), 128))
1475
1481
  ]),
1476
- P("div", Qe, [
1477
- P("span", Ye, $(C.value), 1),
1478
- u.isLast ? B("", !0) : (w(), A("span", qe, ","))
1482
+ B("div", Ye, [
1483
+ B("span", qe, F(M.value), 1),
1484
+ u.isLast ? I("", !0) : (A(), C("span", ze, ","))
1479
1485
  ])
1480
- ])) : B("", !0)
1481
- ])) : (w(), A("div", ze, [
1482
- u.keyName && !n.value ? (w(), A("span", {
1486
+ ])) : I("", !0)
1487
+ ])) : (A(), C("div", We, [
1488
+ u.keyName && !n.value ? (A(), C("span", {
1483
1489
  key: 0,
1484
1490
  class: "json-node__key",
1485
- onClick: W,
1491
+ onClick: J,
1486
1492
  title: "Click to edit key"
1487
- }, ' "' + $(E.value) + '" ', 1)) : B("", !0),
1488
- u.keyName && n.value ? ae((w(), A("input", {
1493
+ }, ' "' + F(w.value) + '" ', 1)) : I("", !0),
1494
+ u.keyName && n.value ? le((A(), C("input", {
1489
1495
  key: 1,
1490
- "onUpdate:modelValue": _[5] || (_[5] = (i) => c.value = i),
1496
+ "onUpdate:modelValue": E[5] || (E[5] = (l) => c.value = l),
1491
1497
  onKeyup: [
1492
- Q(F, ["enter"]),
1493
- Q(J, ["escape"])
1498
+ q(Y, ["enter"]),
1499
+ q(X, ["escape"])
1494
1500
  ],
1495
- onBlur: F,
1501
+ onBlur: Y,
1496
1502
  class: "json-node__key-input"
1497
1503
  }, null, 544)), [
1498
- [le, c.value]
1499
- ]) : B("", !0),
1500
- u.keyName ? (w(), A("span", We, ": ")) : B("", !0),
1501
- a.value ? B("", !0) : (w(), A("span", {
1504
+ [ce, c.value]
1505
+ ]) : I("", !0),
1506
+ u.keyName ? (A(), C("span", Ze, ": ")) : I("", !0),
1507
+ a.value ? I("", !0) : (A(), C("span", {
1502
1508
  key: 3,
1503
- class: ge(["json-node__value", I.value]),
1504
- onClick: re,
1505
- onDblclick: _[6] || (_[6] = (i) => u.$emit("copy", u.value)),
1506
- title: se.value
1509
+ class: be(["json-node__value", W.value]),
1510
+ onClick: ne,
1511
+ onDblclick: E[6] || (E[6] = (l) => u.$emit("copy", u.value)),
1512
+ title: te.value
1507
1513
  }, [
1508
- de($(q.value), 1),
1509
- u.isLast ? B("", !0) : (w(), A("span", Je, ","))
1510
- ], 42, Ze)),
1511
- a.value ? ae((w(), A("input", {
1514
+ he(F(ae.value), 1),
1515
+ u.isLast ? I("", !0) : (A(), C("span", et, ","))
1516
+ ], 42, Je)),
1517
+ a.value ? le((A(), C("input", {
1512
1518
  key: 4,
1513
- "onUpdate:modelValue": _[7] || (_[7] = (i) => f.value = i),
1519
+ "onUpdate:modelValue": E[7] || (E[7] = (l) => f.value = l),
1514
1520
  onKeyup: [
1515
- Q(Z, ["enter"]),
1516
- Q(K, ["escape"])
1521
+ q(se, ["enter"]),
1522
+ q(oe, ["escape"])
1517
1523
  ],
1518
- onBlur: Z,
1524
+ onBlur: se,
1519
1525
  class: "json-node__value-input"
1520
1526
  }, null, 544)), [
1521
- [le, f.value]
1522
- ]) : B("", !0)
1527
+ [ce, f.value]
1528
+ ]) : I("", !0)
1523
1529
  ]))
1524
1530
  ]);
1525
1531
  };
1526
1532
  }
1527
- }), be = (r, e) => {
1533
+ }), me = (r, e) => {
1528
1534
  const t = r.__vccOpts || r;
1529
1535
  for (const [s, n] of e)
1530
1536
  t[s] = n;
1531
1537
  return t;
1532
- }, tt = /* @__PURE__ */ be(et, [["__scopeId", "data-v-f3f3cbc9"]]), Ee = {
1538
+ }, rt = /* @__PURE__ */ me(tt, [["__scopeId", "data-v-c799bdec"]]), Ee = {
1533
1539
  name: "github-light",
1534
1540
  colors: {
1535
1541
  // 背景色
@@ -1568,7 +1574,7 @@ const Le = { class: "json-node" }, Ue = {
1568
1574
  // 缩进线
1569
1575
  indentLine: "#d0d7de"
1570
1576
  }
1571
- }, rt = {
1577
+ }, nt = {
1572
1578
  name: "github-dark",
1573
1579
  colors: {
1574
1580
  // 背景色
@@ -1607,7 +1613,7 @@ const Le = { class: "json-node" }, Ue = {
1607
1613
  // 缩进线
1608
1614
  indentLine: "#30363d"
1609
1615
  }
1610
- }, nt = {
1616
+ }, st = {
1611
1617
  name: "min-light",
1612
1618
  colors: {
1613
1619
  // 背景色 - 纯白简洁
@@ -1646,7 +1652,7 @@ const Le = { class: "json-node" }, Ue = {
1646
1652
  // 缩进线
1647
1653
  indentLine: "#e5e7eb"
1648
1654
  }
1649
- }, st = {
1655
+ }, ot = {
1650
1656
  name: "slack-ochin",
1651
1657
  colors: {
1652
1658
  // 背景色 - 温暖的米色调
@@ -1685,34 +1691,34 @@ const Le = { class: "json-node" }, Ue = {
1685
1691
  // 缩进线
1686
1692
  indentLine: "#e8d5b7"
1687
1693
  }
1688
- }, ot = {
1694
+ }, it = {
1689
1695
  "github-light": Ee,
1690
- "github-dark": rt,
1691
- "min-light": nt,
1692
- "slack-ochin": st
1696
+ "github-dark": nt,
1697
+ "min-light": st,
1698
+ "slack-ochin": ot
1693
1699
  };
1694
- function it(r = "github-light") {
1695
- return ot[r] || Ee;
1700
+ function at(r = "github-light") {
1701
+ return it[r] || Ee;
1696
1702
  }
1697
- const at = {
1703
+ const lt = {
1698
1704
  key: 0,
1699
1705
  class: "json-format__toolbar"
1700
- }, lt = { class: "json-format__actions" }, ct = ["disabled"], ut = ["disabled"], dt = ["disabled"], ht = ["disabled"], ft = { class: "json-format__info" }, pt = {
1706
+ }, ct = { class: "json-format__actions" }, ut = ["disabled"], dt = ["disabled"], ht = ["disabled"], ft = ["disabled"], pt = { class: "json-format__info" }, yt = {
1701
1707
  key: 0,
1702
1708
  class: "json-format__status json-format__status--success"
1703
- }, yt = {
1709
+ }, gt = {
1704
1710
  key: 1,
1705
1711
  class: "json-format__status json-format__status--error"
1706
- }, gt = { class: "json-format__content" }, bt = {
1712
+ }, bt = { class: "json-format__content" }, mt = {
1707
1713
  key: 0,
1708
1714
  class: "json-format__error"
1709
1715
  }, Et = {
1710
1716
  key: 1,
1711
1717
  class: "json-format__error"
1712
- }, mt = {
1718
+ }, vt = {
1713
1719
  key: 2,
1714
1720
  class: "json-format__viewer"
1715
- }, vt = /* @__PURE__ */ fe({
1721
+ }, _t = /* @__PURE__ */ pe({
1716
1722
  name: "JsonFormat",
1717
1723
  __name: "index",
1718
1724
  props: {
@@ -1724,87 +1730,102 @@ const at = {
1724
1730
  },
1725
1731
  emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress"],
1726
1732
  setup(r, { expose: e, emit: t }) {
1727
- pe((i) => ({
1728
- ef037492: g.value.colors.border,
1729
- "33e06939": g.value.colors.background,
1730
- 60160510: g.value.colors.text,
1731
- "5ef04350": g.value.colors.surfaceBackground,
1732
- "2635d16e": g.value.colors.buttonBorder,
1733
- "7e8021cb": g.value.colors.buttonBackground,
1734
- ceb1e8ec: g.value.colors.buttonText,
1735
- "3fff1e31": g.value.colors.buttonBackgroundHover,
1736
- ce0e62f6: g.value.colors.buttonPrimary,
1737
- a1115492: g.value.colors.buttonPrimaryHover,
1738
- "61b839b4": g.value.colors.successBackground,
1739
- "13fd9fd8": g.value.colors.success,
1740
- f14057aa: g.value.colors.errorBackground,
1741
- "2ddd231d": g.value.colors.error,
1742
- c81a0d60: g.value.colors.scrollbarTrack,
1743
- c8228c4a: g.value.colors.scrollbarThumb,
1744
- "5985dfbe": g.value.colors.scrollbarThumbHover
1733
+ ye((i) => ({
1734
+ "4580f20e": b.value.colors.border,
1735
+ "1c771210": b.value.colors.background,
1736
+ "7594d38f": b.value.colors.text,
1737
+ "75ad6ace": b.value.colors.surfaceBackground,
1738
+ "0a74e660": b.value.colors.buttonBorder,
1739
+ ba56e53c: b.value.colors.buttonBackground,
1740
+ fd84973e: b.value.colors.buttonText,
1741
+ "486158fa": b.value.colors.buttonBackgroundHover,
1742
+ "2d62e24e": b.value.colors.buttonPrimary,
1743
+ "105f378e": b.value.colors.buttonPrimaryHover,
1744
+ "355cea6f": b.value.colors.successBackground,
1745
+ "115f033e": b.value.colors.success,
1746
+ acd7cc98: b.value.colors.errorBackground,
1747
+ "3c380fe6": b.value.colors.error,
1748
+ d66942b2: b.value.colors.scrollbarTrack,
1749
+ d671c19c: b.value.colors.scrollbarThumb,
1750
+ e15d2dac: b.value.colors.scrollbarThumbHover
1745
1751
  }));
1746
- const s = r, n = t, a = R(null), c = R(""), f = R(/* @__PURE__ */ new Set()), d = R(null), h = R(""), v = D(() => c.value === ""), g = D(() => it(s.theme)), k = D(() => h.value ? null : d.value !== null ? d.value : a.value), E = (i) => {
1752
+ const s = r, n = t, a = H(null), c = H(""), f = H(/* @__PURE__ */ new Set()), h = H(null), d = H(""), _ = j(() => c.value === ""), b = j(() => at(s.theme)), x = j(() => d.value ? null : h.value !== null ? h.value : a.value), g = (i) => {
1747
1753
  if (!i.trim()) {
1748
- a.value = null, c.value = "", d.value = null, h.value = "";
1754
+ a.value = null, c.value = "", h.value = null, d.value = "";
1749
1755
  return;
1750
1756
  }
1751
1757
  try {
1752
1758
  let l = i;
1753
- const p = /:\s*\d{16,}/.test(l), y = /:\s*\d+\.\d*0+\s*[,}\]]/.test(l);
1754
- if (!p && !y)
1759
+ const m = /(:\s*|,\s*|\[\s*)-?\d{16,}/.test(l), p = /(:\s*|,\s*|\[\s*)-?\d+\.\d*0+\s*[,}\]\s]*/.test(l);
1760
+ if (!m && !p)
1755
1761
  try {
1756
- a.value = JSON.parse(l), c.value = "", d.value = null, h.value = "", ee(() => {
1757
- k.value !== null && V();
1762
+ a.value = JSON.parse(l), c.value = "", h.value = null, d.value = "", ee(() => {
1763
+ x.value !== null && Q();
1758
1764
  });
1759
1765
  return;
1760
1766
  } catch {
1761
1767
  }
1762
- const b = (m, N, j) => {
1763
- let T = "", oe = !1, ie = !1, H = 0;
1764
- for (; H < m.length; ) {
1765
- const G = m[H];
1766
- if (oe)
1767
- ie ? ie = !1 : G === "\\" ? ie = !0 : G === '"' && (oe = !1), T += G, H++;
1768
- else if (G === '"')
1769
- oe = !0, T += G, H++;
1768
+ const y = (P, N, D) => {
1769
+ let V = "", R = !1, L = !1, U = 0;
1770
+ for (; U < P.length; ) {
1771
+ const T = P[U];
1772
+ if (R)
1773
+ L ? L = !1 : T === "\\" ? L = !0 : T === '"' && (R = !1), V += T, U++;
1774
+ else if (T === '"')
1775
+ R = !0, V += T, U++;
1770
1776
  else {
1771
- const ne = m.slice(H).match(N);
1772
- if (ne && ne.index === 0) {
1773
- const me = ne[0].replace(N, j);
1774
- T += me, H += ne[0].length;
1777
+ const ie = P.slice(U).match(N);
1778
+ if (ie && ie.index === 0) {
1779
+ const ve = ie[0].replace(N, D);
1780
+ V += ve, U += ie[0].length;
1775
1781
  } else
1776
- T += G, H++;
1782
+ V += T, U++;
1777
1783
  }
1778
1784
  }
1779
- return T;
1785
+ return V;
1780
1786
  };
1781
- l = b(
1782
- l,
1783
- /:\s*(\d{16,})(\s*[,}\]\n\r])/,
1784
- ': "$1"$2'
1785
- ), l = b(
1786
- l,
1787
- /:\s*(\d+\.\d*?0+)(\s*[,}\]\n\r])/,
1788
- ': "$1"$2'
1789
- ), a.value = JSON.parse(l), c.value = "", d.value = null, h.value = "", ee(() => {
1790
- k.value !== null && V();
1787
+ l = ((P) => {
1788
+ let N = "", D = !1, V = !1, R = 0;
1789
+ for (; R < P.length; ) {
1790
+ const L = P[R];
1791
+ if (D)
1792
+ V ? V = !1 : L === "\\" ? V = !0 : L === '"' && (D = !1), N += L, R++;
1793
+ else if (L === '"')
1794
+ D = !0, N += L, R++;
1795
+ else {
1796
+ const U = P.slice(R);
1797
+ let T = U.match(/^([:,\[\s]*)(-?\d{16,})(\s*[,\}\]\s]|$)/);
1798
+ if (T) {
1799
+ N += T[1] + '"' + T[2] + '"' + T[3], R += T[0].length;
1800
+ continue;
1801
+ }
1802
+ if (T = U.match(/^([:,\[\s]*)(-?\d+\.\d*0+)(\s*[,\}\]\s]|$)/), T) {
1803
+ N += T[1] + '"' + T[2] + '"' + T[3], R += T[0].length;
1804
+ continue;
1805
+ }
1806
+ N += L, R++;
1807
+ }
1808
+ }
1809
+ return N;
1810
+ })(l), a.value = JSON.parse(l), c.value = "", h.value = null, d.value = "", ee(() => {
1811
+ x.value !== null && Q();
1791
1812
  });
1792
1813
  } catch (l) {
1793
- c.value = l instanceof Error ? l.message : "Unknown parsing error", a.value = null, d.value = null, h.value = "";
1814
+ c.value = l instanceof Error ? l.message : "Unknown parsing error", a.value = null, h.value = null, d.value = "";
1794
1815
  }
1795
- }, S = (i) => {
1816
+ }, w = (i) => {
1796
1817
  if (!i || !i.expression.trim()) {
1797
- C();
1818
+ S();
1798
1819
  return;
1799
1820
  }
1800
1821
  if (!a.value) {
1801
- h.value = "No valid JSON data to filter";
1822
+ d.value = "No valid JSON data to filter";
1802
1823
  return;
1803
1824
  }
1804
1825
  try {
1805
1826
  let l;
1806
1827
  if (i.type === "jsonpath")
1807
- l = x({ path: i.expression, json: a.value }), l.length === 1 && i.expression.includes("$[") === !1 && !i.expression.endsWith("[*]") ? d.value = l[0] : d.value = l;
1828
+ l = k({ path: i.expression, json: a.value }), l.length === 1 && i.expression.includes("$[") === !1 && !i.expression.endsWith("[*]") ? h.value = l[0] : h.value = l;
1808
1829
  else if (i.type === "js")
1809
1830
  l = new Function("data", `
1810
1831
  try {
@@ -1812,249 +1833,249 @@ const at = {
1812
1833
  } catch (error) {
1813
1834
  throw new Error('JavaScript expression error: ' + error.message);
1814
1835
  }
1815
- `)(a.value), d.value = l;
1836
+ `)(a.value), h.value = l;
1816
1837
  else
1817
1838
  throw new Error(`Unsupported filter type: ${i.type}`);
1818
- h.value = "", ee(() => {
1819
- V();
1839
+ d.value = "", ee(() => {
1840
+ Q();
1820
1841
  });
1821
1842
  } catch (l) {
1822
- h.value = l instanceof Error ? l.message : "Filter execution error", d.value = null;
1843
+ d.value = l instanceof Error ? l.message : "Filter execution error", h.value = null;
1823
1844
  }
1824
- }, C = () => {
1825
- d.value = null, h.value = "";
1845
+ }, S = () => {
1846
+ h.value = null, d.value = "";
1826
1847
  };
1827
- ke(() => s.modelValue, (i) => {
1828
- E(i);
1848
+ Oe(() => s.modelValue, (i) => {
1849
+ g(i);
1829
1850
  }, { immediate: !0 });
1830
- const U = (i) => {
1851
+ const M = (i) => {
1831
1852
  if (!/^-?\d+(\.\d+)?$/.test(i)) return !1;
1832
1853
  const l = Number(i);
1833
1854
  return !Number.isSafeInteger(l) || i.length > 15;
1834
- }, I = (i, l, p) => JSON.stringify(i, (y, b) => {
1835
- if (typeof b == "string" && U(b))
1836
- return `__BIG_NUMBER__${b}__BIG_NUMBER__`;
1837
- if (typeof b == "string" && /^-?\d+(\.\d+)?$/.test(b)) {
1838
- const m = Number(b);
1839
- if (Number.isSafeInteger(m) && m.toString() === b)
1840
- return m;
1841
- if (!Number.isNaN(m) && isFinite(m) && b.includes("."))
1842
- return m.toString() === b ? m : `__PRESERVE_STRING__${b}__PRESERVE_STRING__`;
1843
- if (!Number.isNaN(m) && isFinite(m))
1844
- return m;
1855
+ }, $ = (i, l, m) => JSON.stringify(i, (p, y) => {
1856
+ if (typeof y == "string" && M(y))
1857
+ return `__BIG_NUMBER__${y}__BIG_NUMBER__`;
1858
+ if (typeof y == "string" && /^-?\d+(\.\d+)?$/.test(y)) {
1859
+ const v = Number(y);
1860
+ if (Number.isSafeInteger(v) && v.toString() === y)
1861
+ return v;
1862
+ if (!Number.isNaN(v) && isFinite(v) && y.includes("."))
1863
+ return v.toString() === y ? v : `__PRESERVE_STRING__${y}__PRESERVE_STRING__`;
1864
+ if (!Number.isNaN(v) && isFinite(v))
1865
+ return v;
1845
1866
  }
1846
- return l && typeof l == "function" ? l(y, b) : b;
1847
- }, p).replace(/"__BIG_NUMBER__(.+?)__BIG_NUMBER__"/g, "$1").replace(/"__PRESERVE_STRING__(.+?)__PRESERVE_STRING__"/g, "$1"), q = (i, l) => {
1867
+ return l && typeof l == "function" ? l(p, y) : y;
1868
+ }, m).replace(/"__BIG_NUMBER__(.+?)__BIG_NUMBER__"/g, "$1").replace(/"__PRESERVE_STRING__(.+?)__PRESERVE_STRING__"/g, "$1"), W = (i, l) => {
1848
1869
  if (!s.readonly)
1849
1870
  try {
1850
- const p = se(a.value, i, l), y = I(p, null, 2);
1851
- n("update:modelValue", y);
1852
- } catch (p) {
1853
- console.error("Failed to update JSON:", p);
1871
+ const m = ae(a.value, i, l), p = $(m, null, 2);
1872
+ n("update:modelValue", p);
1873
+ } catch (m) {
1874
+ console.error("Failed to update JSON:", m);
1854
1875
  }
1855
- }, se = (i, l, p) => {
1856
- if (!l || l === "root") return p;
1857
- const y = l.split("."), b = K(i, y.slice(0, -1));
1858
- let m = b;
1859
- for (let j = 0; j < y.length - 1; j++) {
1860
- const T = y[j];
1861
- T !== "root" && (Array.isArray(m) ? m = m[parseInt(T)] : m = m[T]);
1876
+ }, ae = (i, l, m) => {
1877
+ if (!l || l === "root") return m;
1878
+ const p = l.split("."), y = X(i, p.slice(0, -1));
1879
+ let v = y;
1880
+ for (let N = 0; N < p.length - 1; N++) {
1881
+ const D = p[N];
1882
+ D !== "root" && (Array.isArray(v) ? v = v[parseInt(D)] : v = v[D]);
1862
1883
  }
1863
- const N = y[y.length - 1];
1864
- return N === "root" ? p : (Array.isArray(m) ? m[parseInt(N)] = p : m[N] = p, b);
1884
+ const P = p[p.length - 1];
1885
+ return P === "root" ? m : (Array.isArray(v) ? v[parseInt(P)] = m : v[P] = m, y);
1865
1886
  }, te = (i) => {
1866
1887
  f.value.has(i) ? f.value.delete(i) : f.value.add(i);
1867
- }, V = () => {
1868
- const i = /* @__PURE__ */ new Set(), l = (p, y = "") => {
1869
- p !== null && typeof p == "object" && (i.add(y || "root"), Array.isArray(p) ? p.forEach((b, m) => {
1870
- const N = y ? `${y}.${m}` : `${m}`;
1871
- l(b, N);
1872
- }) : Object.keys(p).forEach((b) => {
1873
- const m = y ? `${y}.${b}` : b;
1874
- l(p[b], m);
1888
+ }, Q = () => {
1889
+ const i = /* @__PURE__ */ new Set(), l = (m, p = "") => {
1890
+ m !== null && typeof m == "object" && (i.add(p || "root"), Array.isArray(m) ? m.forEach((y, v) => {
1891
+ const P = p ? `${p}.${v}` : `${v}`;
1892
+ l(y, P);
1893
+ }) : Object.keys(m).forEach((y) => {
1894
+ const v = p ? `${p}.${y}` : y;
1895
+ l(m[y], v);
1875
1896
  }));
1876
1897
  };
1877
- l(k.value), f.value = i, n("expand-all");
1878
- }, z = () => {
1898
+ l(x.value), f.value = i, n("expand-all");
1899
+ }, re = () => {
1879
1900
  f.value = /* @__PURE__ */ new Set(["root"]), n("collapse-all");
1880
- }, W = async () => {
1881
- if (v.value)
1901
+ }, Z = async () => {
1902
+ if (_.value)
1882
1903
  try {
1883
- const i = k.value, l = I(i, null, 2);
1904
+ const i = x.value, l = $(i, null, 2);
1884
1905
  await navigator.clipboard.writeText(l), n("copy-success", l);
1885
1906
  } catch (i) {
1886
1907
  console.error("Failed to copy JSON:", i), n("copy-error", i instanceof Error ? i : new Error("Failed to copy JSON"));
1887
1908
  }
1888
- }, re = () => {
1889
- if (v.value)
1909
+ }, J = () => {
1910
+ if (_.value)
1890
1911
  try {
1891
- const i = k.value, l = I(i);
1912
+ const i = x.value, l = $(i);
1892
1913
  n("update:modelValue", l), n("compress", l);
1893
1914
  } catch (i) {
1894
1915
  console.error("Failed to compress JSON:", i);
1895
1916
  }
1896
- }, F = async (i) => {
1917
+ }, ne = async (i) => {
1897
1918
  try {
1898
1919
  let l;
1899
- typeof i == "string" && U(i) ? l = i : typeof i == "string" ? l = `"${i}"` : l = JSON.stringify(i), await navigator.clipboard.writeText(l);
1920
+ typeof i == "string" && M(i) ? l = i : typeof i == "string" ? l = `"${i}"` : l = JSON.stringify(i), await navigator.clipboard.writeText(l);
1900
1921
  } catch (l) {
1901
1922
  console.error("Failed to copy value:", l);
1902
1923
  }
1903
- }, Z = (i, l) => {
1924
+ }, Y = (i, l) => {
1904
1925
  if (!s.readonly)
1905
1926
  try {
1906
- const p = J(a.value, i, l), y = I(p, null, 2);
1907
- n("update:modelValue", y), X(i, l);
1908
- } catch (p) {
1909
- console.error("Failed to rename key:", p);
1927
+ const m = se(a.value, i, l), p = $(m, null, 2);
1928
+ n("update:modelValue", p), E(i, l);
1929
+ } catch (m) {
1930
+ console.error("Failed to rename key:", m);
1910
1931
  }
1911
- }, J = (i, l, p) => {
1932
+ }, se = (i, l, m) => {
1912
1933
  if (!l || l === "root") return i;
1913
- const y = l.split("."), b = K(i, y.slice(0, -1));
1914
- if (y.length === 1) {
1915
- const j = y[0];
1916
- return b && typeof b == "object" && !Array.isArray(b) ? u(b, j, p) : b;
1934
+ const p = l.split("."), y = X(i, p.slice(0, -1));
1935
+ if (p.length === 1) {
1936
+ const N = p[0];
1937
+ return y && typeof y == "object" && !Array.isArray(y) ? oe(y, N, m) : y;
1917
1938
  }
1918
- let m = b;
1919
- for (let j = 0; j < y.length - 1; j++) {
1920
- const T = y[j];
1921
- Array.isArray(m) ? m = m[parseInt(T)] : m = m[T];
1939
+ let v = y;
1940
+ for (let N = 0; N < p.length - 1; N++) {
1941
+ const D = p[N];
1942
+ Array.isArray(v) ? v = v[parseInt(D)] : v = v[D];
1922
1943
  }
1923
- const N = y[y.length - 1];
1924
- if (!Array.isArray(m) && m && typeof m == "object") {
1925
- const j = u(m, N, p), T = y.slice(0, -1);
1926
- T.length > 0 && _(b, T, j);
1944
+ const P = p[p.length - 1];
1945
+ if (!Array.isArray(v) && v && typeof v == "object") {
1946
+ const N = oe(v, P, m), D = p.slice(0, -1);
1947
+ D.length > 0 && u(y, D, N);
1927
1948
  }
1928
- return b;
1929
- }, K = (i, l) => {
1949
+ return y;
1950
+ }, X = (i, l) => {
1930
1951
  if (l.length === 0) return i;
1931
1952
  if (Array.isArray(i)) {
1932
- const p = [...i], y = l[0], b = parseInt(y);
1933
- return l.length === 1 || (p[b] = K(i[b], l.slice(1))), p;
1953
+ const m = [...i], p = l[0], y = parseInt(p);
1954
+ return l.length === 1 || (m[y] = X(i[y], l.slice(1))), m;
1934
1955
  } else if (i && typeof i == "object") {
1935
- const p = { ...i }, y = l[0];
1936
- return l.length === 1 || (p[y] = K(i[y], l.slice(1))), p;
1956
+ const m = { ...i }, p = l[0];
1957
+ return l.length === 1 || (m[p] = X(i[p], l.slice(1))), m;
1937
1958
  }
1938
1959
  return i;
1939
- }, u = (i, l, p) => {
1960
+ }, oe = (i, l, m) => {
1940
1961
  if (!i || typeof i != "object" || Array.isArray(i))
1941
1962
  return i;
1942
- const y = Object.keys(i), b = {};
1943
- for (const m of y)
1944
- m === l ? b[p] = i[m] : b[m] = i[m];
1945
- return b;
1946
- }, _ = (i, l, p) => {
1947
- let y = i;
1948
- for (let m = 0; m < l.length - 1; m++) {
1949
- const N = l[m];
1950
- Array.isArray(y) ? y = y[parseInt(N)] : y = y[N];
1963
+ const p = Object.keys(i), y = {};
1964
+ for (const v of p)
1965
+ v === l ? y[m] = i[v] : y[v] = i[v];
1966
+ return y;
1967
+ }, u = (i, l, m) => {
1968
+ let p = i;
1969
+ for (let v = 0; v < l.length - 1; v++) {
1970
+ const P = l[v];
1971
+ Array.isArray(p) ? p = p[parseInt(P)] : p = p[P];
1951
1972
  }
1952
- const b = l[l.length - 1];
1953
- Array.isArray(y) ? y[parseInt(b)] = p : y[b] = p;
1954
- }, X = (i, l) => {
1955
- const p = /* @__PURE__ */ new Set();
1956
- f.value.forEach((y) => {
1957
- if (y === i) {
1958
- const b = i.split(".");
1959
- b[b.length - 1] = l, p.add(b.join("."));
1960
- } else if (y.startsWith(i + ".")) {
1961
- const b = i.split(".");
1962
- b[b.length - 1] = l;
1963
- const m = b.join("."), N = y.substring(i.length);
1964
- p.add(m + N);
1973
+ const y = l[l.length - 1];
1974
+ Array.isArray(p) ? p[parseInt(y)] = m : p[y] = m;
1975
+ }, E = (i, l) => {
1976
+ const m = /* @__PURE__ */ new Set();
1977
+ f.value.forEach((p) => {
1978
+ if (p === i) {
1979
+ const y = i.split(".");
1980
+ y[y.length - 1] = l, m.add(y.join("."));
1981
+ } else if (p.startsWith(i + ".")) {
1982
+ const y = i.split(".");
1983
+ y[y.length - 1] = l;
1984
+ const v = y.join("."), P = p.substring(i.length);
1985
+ m.add(v + P);
1965
1986
  } else
1966
- p.add(y);
1967
- }), f.value = p;
1987
+ m.add(p);
1988
+ }), f.value = m;
1968
1989
  };
1969
1990
  return e({
1970
1991
  // 核心操作方法
1971
- copyJson: W,
1972
- compressSource: re,
1973
- expandAll: V,
1974
- collapseAll: z,
1992
+ copyJson: Z,
1993
+ compressSource: J,
1994
+ expandAll: Q,
1995
+ collapseAll: re,
1975
1996
  toggleExpand: te,
1976
- updateValue: q,
1977
- updateKey: Z,
1997
+ updateValue: W,
1998
+ updateKey: Y,
1978
1999
  // Filter 相关方法
1979
- filter: S,
1980
- clearFilter: C,
2000
+ filter: w,
2001
+ clearFilter: S,
1981
2002
  // 状态访问方法
1982
- isValidJson: () => v.value,
2003
+ isValidJson: () => _.value,
1983
2004
  getParsedJson: () => a.value,
1984
- getFilteredJson: () => d.value,
2005
+ getFilteredJson: () => h.value,
1985
2006
  getExpandedNodes: () => f.value,
1986
2007
  getParseError: () => c.value,
1987
- getFilterError: () => h.value,
2008
+ getFilterError: () => d.value,
1988
2009
  // 工具方法
1989
- parseJson: (i) => E(i),
1990
- copyValue: (i) => F(i)
1991
- }), (i, l) => (w(), A("div", {
1992
- class: ge(["json-format", `json-format--${g.value.name}`])
2010
+ parseJson: (i) => g(i),
2011
+ copyValue: (i) => ne(i)
2012
+ }), (i, l) => (A(), C("div", {
2013
+ class: be(["json-format", `json-format--${b.value.name}`])
1993
2014
  }, [
1994
- i.showToolbar ? (w(), A("div", at, [
1995
- P("div", lt, [
1996
- P("button", {
2015
+ i.showToolbar ? (A(), C("div", lt, [
2016
+ B("div", ct, [
2017
+ B("button", {
1997
2018
  class: "json-format__btn json-format__btn--primary",
1998
- onClick: W,
1999
- disabled: !v.value,
2019
+ onClick: Z,
2020
+ disabled: !_.value,
2000
2021
  title: "Copy JSON"
2001
- }, " 📋 Copy ", 8, ct),
2002
- P("button", {
2022
+ }, " 📋 Copy ", 8, ut),
2023
+ B("button", {
2003
2024
  class: "json-format__btn json-format__btn--secondary",
2004
- onClick: V,
2005
- disabled: !v.value,
2025
+ onClick: Q,
2026
+ disabled: !_.value,
2006
2027
  title: "Expand All"
2007
- }, " ⬇️ Expand All ", 8, ut),
2008
- P("button", {
2028
+ }, " ⬇️ Expand All ", 8, dt),
2029
+ B("button", {
2009
2030
  class: "json-format__btn json-format__btn--secondary",
2010
- onClick: z,
2011
- disabled: !v.value,
2031
+ onClick: re,
2032
+ disabled: !_.value,
2012
2033
  title: "Collapse All"
2013
- }, " ➡️ Collapse All ", 8, dt),
2014
- P("button", {
2034
+ }, " ➡️ Collapse All ", 8, ht),
2035
+ B("button", {
2015
2036
  class: "json-format__btn json-format__btn--secondary",
2016
- onClick: re,
2017
- disabled: !v.value,
2037
+ onClick: J,
2038
+ disabled: !_.value,
2018
2039
  title: "Compress JSON"
2019
- }, " 📦 Compress ", 8, ht)
2040
+ }, " 📦 Compress ", 8, ft)
2020
2041
  ]),
2021
- P("div", ft, [
2022
- v.value ? (w(), A("span", pt, " ✅ Valid JSON ")) : (w(), A("span", yt, " ❌ Invalid JSON "))
2042
+ B("div", pt, [
2043
+ _.value ? (A(), C("span", yt, " ✅ Valid JSON ")) : (A(), C("span", gt, " ❌ Invalid JSON "))
2023
2044
  ])
2024
- ])) : B("", !0),
2025
- P("div", gt, [
2026
- v.value ? h.value ? (w(), A("div", Et, [
2027
- l[1] || (l[1] = P("h4", null, "Filter Error:", -1)),
2028
- P("pre", null, $(h.value), 1)
2029
- ])) : (w(), A("div", mt, [
2030
- ye(tt, {
2031
- value: k.value,
2045
+ ])) : I("", !0),
2046
+ B("div", bt, [
2047
+ _.value ? d.value ? (A(), C("div", Et, [
2048
+ l[1] || (l[1] = B("h4", null, "Filter Error:", -1)),
2049
+ B("pre", null, F(d.value), 1)
2050
+ ])) : (A(), C("div", vt, [
2051
+ ge(rt, {
2052
+ value: x.value,
2032
2053
  "key-name": "",
2033
2054
  level: 0,
2034
2055
  expanded: f.value,
2035
2056
  "is-last": !0,
2036
- theme: g.value,
2037
- "onUpdate:value": q,
2057
+ theme: b.value,
2058
+ "onUpdate:value": W,
2038
2059
  onToggleExpand: te,
2039
- onCopy: F,
2040
- "onUpdate:key": Z
2060
+ onCopy: ne,
2061
+ "onUpdate:key": Y
2041
2062
  }, null, 8, ["value", "expanded", "theme"])
2042
- ])) : (w(), A("div", bt, [
2043
- l[0] || (l[0] = P("h4", null, "JSON Parse Error:", -1)),
2044
- P("pre", null, $(c.value), 1)
2063
+ ])) : (A(), C("div", mt, [
2064
+ l[0] || (l[0] = B("h4", null, "JSON Parse Error:", -1)),
2065
+ B("pre", null, F(c.value), 1)
2045
2066
  ]))
2046
2067
  ])
2047
2068
  ], 2));
2048
2069
  }
2049
- }), _t = /* @__PURE__ */ be(vt, [["__scopeId", "data-v-ad4d00ac"]]), xt = [_t], kt = (r) => {
2050
- xt.forEach((e) => {
2070
+ }), xt = /* @__PURE__ */ me(_t, [["__scopeId", "data-v-632b8436"]]), kt = [xt], Ot = (r) => {
2071
+ kt.forEach((e) => {
2051
2072
  const t = e.name || e.__name || "UnknownComponent";
2052
2073
  r.component(t, e);
2053
2074
  });
2054
- }, wt = {
2055
- install: kt
2075
+ }, St = {
2076
+ install: Ot
2056
2077
  };
2057
2078
  export {
2058
- _t as JsonFormat,
2059
- wt as default
2079
+ xt as JsonFormat,
2080
+ St as default
2060
2081
  };