lone-format 0.3.0 → 0.3.2

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 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 {
1
+ import { defineComponent as be, useCssVars as Ce, ref as G, computed as L, resolveComponent as Me, createElementBlock as N, openBlock as x, createElementVNode as E, createCommentVNode as F, withDirectives as ve, toDisplayString as R, withKeys as le, vModelText as _e, createTextVNode as Se, Fragment as he, renderList as pe, createVNode as Ue, normalizeClass as Oe, nextTick as ce, watch as Fe, normalizeStyle as I, createBlock as Xe } from "vue";
2
+ class De {
3
3
  /**
4
4
  * @callback HookCallback
5
5
  * @this {*|Jsep} this
@@ -42,7 +42,7 @@ class Ce {
42
42
  });
43
43
  }
44
44
  }
45
- class Ae {
45
+ class Je {
46
46
  constructor(e) {
47
47
  this.jsep = e, this.registered = {};
48
48
  }
@@ -69,7 +69,7 @@ class Ae {
69
69
  });
70
70
  }
71
71
  }
72
- class o {
72
+ class c {
73
73
  /**
74
74
  * @returns {string}
75
75
  */
@@ -80,7 +80,7 @@ class o {
80
80
  * @returns {string}
81
81
  */
82
82
  static toString() {
83
- return "JavaScript Expression Parser (JSEP) v" + o.version;
83
+ return "JavaScript Expression Parser (JSEP) v" + c.version;
84
84
  }
85
85
  // ==================== CONFIG ================================
86
86
  /**
@@ -89,7 +89,7 @@ class o {
89
89
  * @returns {Jsep}
90
90
  */
91
91
  static addUnaryOp(e) {
92
- return o.max_unop_len = Math.max(e.length, o.max_unop_len), o.unary_ops[e] = 1, o;
92
+ return c.max_unop_len = Math.max(e.length, c.max_unop_len), c.unary_ops[e] = 1, c;
93
93
  }
94
94
  /**
95
95
  * @method jsep.addBinaryOp
@@ -99,7 +99,7 @@ class o {
99
99
  * @returns {Jsep}
100
100
  */
101
101
  static addBinaryOp(e, t, s) {
102
- return o.max_binop_len = Math.max(e.length, o.max_binop_len), o.binary_ops[e] = t, s ? o.right_associative.add(e) : o.right_associative.delete(e), o;
102
+ return c.max_binop_len = Math.max(e.length, c.max_binop_len), c.binary_ops[e] = t, s ? c.right_associative.add(e) : c.right_associative.delete(e), c;
103
103
  }
104
104
  /**
105
105
  * @method addIdentifierChar
@@ -107,7 +107,7 @@ class o {
107
107
  * @returns {Jsep}
108
108
  */
109
109
  static addIdentifierChar(e) {
110
- return o.additional_identifier_chars.add(e), o;
110
+ return c.additional_identifier_chars.add(e), c;
111
111
  }
112
112
  /**
113
113
  * @method addLiteral
@@ -116,7 +116,7 @@ class o {
116
116
  * @returns {Jsep}
117
117
  */
118
118
  static addLiteral(e, t) {
119
- return o.literals[e] = t, o;
119
+ return c.literals[e] = t, c;
120
120
  }
121
121
  /**
122
122
  * @method removeUnaryOp
@@ -124,14 +124,14 @@ class o {
124
124
  * @returns {Jsep}
125
125
  */
126
126
  static removeUnaryOp(e) {
127
- return delete o.unary_ops[e], e.length === o.max_unop_len && (o.max_unop_len = o.getMaxKeyLen(o.unary_ops)), o;
127
+ return delete c.unary_ops[e], e.length === c.max_unop_len && (c.max_unop_len = c.getMaxKeyLen(c.unary_ops)), c;
128
128
  }
129
129
  /**
130
130
  * @method removeAllUnaryOps
131
131
  * @returns {Jsep}
132
132
  */
133
133
  static removeAllUnaryOps() {
134
- return o.unary_ops = {}, o.max_unop_len = 0, o;
134
+ return c.unary_ops = {}, c.max_unop_len = 0, c;
135
135
  }
136
136
  /**
137
137
  * @method removeIdentifierChar
@@ -139,7 +139,7 @@ class o {
139
139
  * @returns {Jsep}
140
140
  */
141
141
  static removeIdentifierChar(e) {
142
- return o.additional_identifier_chars.delete(e), o;
142
+ return c.additional_identifier_chars.delete(e), c;
143
143
  }
144
144
  /**
145
145
  * @method removeBinaryOp
@@ -147,14 +147,14 @@ class o {
147
147
  * @returns {Jsep}
148
148
  */
149
149
  static removeBinaryOp(e) {
150
- return delete o.binary_ops[e], e.length === o.max_binop_len && (o.max_binop_len = o.getMaxKeyLen(o.binary_ops)), o.right_associative.delete(e), o;
150
+ return delete c.binary_ops[e], e.length === c.max_binop_len && (c.max_binop_len = c.getMaxKeyLen(c.binary_ops)), c.right_associative.delete(e), c;
151
151
  }
152
152
  /**
153
153
  * @method removeAllBinaryOps
154
154
  * @returns {Jsep}
155
155
  */
156
156
  static removeAllBinaryOps() {
157
- return o.binary_ops = {}, o.max_binop_len = 0, o;
157
+ return c.binary_ops = {}, c.max_binop_len = 0, c;
158
158
  }
159
159
  /**
160
160
  * @method removeLiteral
@@ -162,14 +162,14 @@ class o {
162
162
  * @returns {Jsep}
163
163
  */
164
164
  static removeLiteral(e) {
165
- return delete o.literals[e], o;
165
+ return delete c.literals[e], c;
166
166
  }
167
167
  /**
168
168
  * @method removeAllLiterals
169
169
  * @returns {Jsep}
170
170
  */
171
171
  static removeAllLiterals() {
172
- return o.literals = {}, o;
172
+ return c.literals = {}, c;
173
173
  }
174
174
  // ==================== END CONFIG ============================
175
175
  /**
@@ -196,7 +196,7 @@ class o {
196
196
  * @returns {jsep.Expression}
197
197
  */
198
198
  static parse(e) {
199
- return new o(e).parse();
199
+ return new c(e).parse();
200
200
  }
201
201
  /**
202
202
  * Get the longest key length of any object
@@ -220,7 +220,7 @@ class o {
220
220
  * @returns {number}
221
221
  */
222
222
  static binaryPrecedence(e) {
223
- return o.binary_ops[e] || 0;
223
+ return c.binary_ops[e] || 0;
224
224
  }
225
225
  /**
226
226
  * Looks for start of identifier
@@ -230,15 +230,15 @@ class o {
230
230
  static isIdentifierStart(e) {
231
231
  return e >= 65 && e <= 90 || // A...Z
232
232
  e >= 97 && e <= 122 || // a...z
233
- e >= 128 && !o.binary_ops[String.fromCharCode(e)] || // any non-ASCII that is not an operator
234
- o.additional_identifier_chars.has(String.fromCharCode(e));
233
+ e >= 128 && !c.binary_ops[String.fromCharCode(e)] || // any non-ASCII that is not an operator
234
+ c.additional_identifier_chars.has(String.fromCharCode(e));
235
235
  }
236
236
  /**
237
237
  * @param {number} ch
238
238
  * @returns {boolean}
239
239
  */
240
240
  static isIdentifierPart(e) {
241
- return o.isIdentifierStart(e) || o.isDecimalDigit(e);
241
+ return c.isIdentifierStart(e) || c.isDecimalDigit(e);
242
242
  }
243
243
  /**
244
244
  * throw error at index of the expression
@@ -256,12 +256,12 @@ class o {
256
256
  * @returns {?jsep.Expression}
257
257
  */
258
258
  runHook(e, t) {
259
- if (o.hooks[e]) {
259
+ if (c.hooks[e]) {
260
260
  const s = {
261
261
  context: this,
262
262
  node: t
263
263
  };
264
- return o.hooks.run(e, s), s.node;
264
+ return c.hooks.run(e, s), s.node;
265
265
  }
266
266
  return t;
267
267
  }
@@ -271,11 +271,11 @@ class o {
271
271
  * @returns {?jsep.Expression}
272
272
  */
273
273
  searchHook(e) {
274
- if (o.hooks[e]) {
274
+ if (c.hooks[e]) {
275
275
  const t = {
276
276
  context: this
277
277
  };
278
- return o.hooks[e].find(function(s) {
278
+ return c.hooks[e].find(function(s) {
279
279
  return s.call(t.context, t), t.node;
280
280
  }), t.node;
281
281
  }
@@ -285,7 +285,7 @@ class o {
285
285
  */
286
286
  gobbleSpaces() {
287
287
  let e = this.code;
288
- for (; e === o.SPACE_CODE || e === o.TAB_CODE || e === o.LF_CODE || e === o.CR_CODE; )
288
+ for (; e === c.SPACE_CODE || e === c.TAB_CODE || e === c.LF_CODE || e === c.CR_CODE; )
289
289
  e = this.expr.charCodeAt(++this.index);
290
290
  this.runHook("gobble-spaces");
291
291
  }
@@ -296,7 +296,7 @@ class o {
296
296
  parse() {
297
297
  this.runHook("before-all");
298
298
  const e = this.gobbleExpressions(), t = e.length === 1 ? e[0] : {
299
- type: o.COMPOUND,
299
+ type: c.COMPOUND,
300
300
  body: e
301
301
  };
302
302
  return this.runHook("after-all", t);
@@ -309,7 +309,7 @@ class o {
309
309
  gobbleExpressions(e) {
310
310
  let t = [], s, n;
311
311
  for (; this.index < this.expr.length; )
312
- if (s = this.code, s === o.SEMCOL_CODE || s === o.COMMA_CODE)
312
+ if (s = this.code, s === c.SEMCOL_CODE || s === c.COMMA_CODE)
313
313
  this.index++;
314
314
  else if (n = this.gobbleExpression())
315
315
  t.push(n);
@@ -337,9 +337,9 @@ class o {
337
337
  */
338
338
  gobbleBinaryOp() {
339
339
  this.gobbleSpaces();
340
- let e = this.expr.substr(this.index, o.max_binop_len), t = e.length;
340
+ let e = this.expr.substr(this.index, c.max_binop_len), t = e.length;
341
341
  for (; t > 0; ) {
342
- if (o.binary_ops.hasOwnProperty(e) && (!o.isIdentifierStart(this.code) || this.index + e.length < this.expr.length && !o.isIdentifierPart(this.expr.charCodeAt(this.index + e.length))))
342
+ if (c.binary_ops.hasOwnProperty(e) && (!c.isIdentifierStart(this.code) || this.index + e.length < this.expr.length && !c.isIdentifierPart(this.expr.charCodeAt(this.index + e.length))))
343
343
  return this.index += t, e;
344
344
  e = e.substr(0, --t);
345
345
  }
@@ -351,40 +351,40 @@ class o {
351
351
  * @returns {?jsep.BinaryExpression}
352
352
  */
353
353
  gobbleBinaryExpression() {
354
- let e, t, s, n, a, c, f, h, d;
355
- if (c = this.gobbleToken(), !c || (t = this.gobbleBinaryOp(), !t))
356
- return c;
357
- for (a = {
354
+ let e, t, s, n, o, i, u, a, l;
355
+ if (i = this.gobbleToken(), !i || (t = this.gobbleBinaryOp(), !t))
356
+ return i;
357
+ for (o = {
358
358
  value: t,
359
- prec: o.binaryPrecedence(t),
360
- right_a: o.right_associative.has(t)
361
- }, f = this.gobbleToken(), f || this.throwError("Expected expression after " + t), n = [c, a, f]; t = this.gobbleBinaryOp(); ) {
362
- if (s = o.binaryPrecedence(t), s === 0) {
359
+ prec: c.binaryPrecedence(t),
360
+ right_a: c.right_associative.has(t)
361
+ }, u = this.gobbleToken(), u || this.throwError("Expected expression after " + t), n = [i, o, u]; t = this.gobbleBinaryOp(); ) {
362
+ if (s = c.binaryPrecedence(t), s === 0) {
363
363
  this.index -= t.length;
364
364
  break;
365
365
  }
366
- a = {
366
+ o = {
367
367
  value: t,
368
368
  prec: s,
369
- right_a: o.right_associative.has(t)
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
- f = n.pop(), t = n.pop().value, c = n.pop(), e = {
374
- type: o.BINARY_EXP,
369
+ right_a: c.right_associative.has(t)
370
+ }, l = t;
371
+ const h = (f) => o.right_a && f.right_a ? s > f.prec : s <= f.prec;
372
+ for (; n.length > 2 && h(n[n.length - 2]); )
373
+ u = n.pop(), t = n.pop().value, i = n.pop(), e = {
374
+ type: c.BINARY_EXP,
375
375
  operator: t,
376
- left: c,
377
- right: f
376
+ left: i,
377
+ right: u
378
378
  }, n.push(e);
379
- e = this.gobbleToken(), e || this.throwError("Expected expression after " + d), n.push(a, e);
379
+ e = this.gobbleToken(), e || this.throwError("Expected expression after " + l), n.push(o, e);
380
380
  }
381
- for (h = n.length - 1, e = n[h]; h > 1; )
381
+ for (a = n.length - 1, e = n[a]; a > 1; )
382
382
  e = {
383
- type: o.BINARY_EXP,
384
- operator: n[h - 1].value,
385
- left: n[h - 2],
383
+ type: c.BINARY_EXP,
384
+ operator: n[a - 1].value,
385
+ left: n[a - 2],
386
386
  right: e
387
- }, h -= 2;
387
+ }, a -= 2;
388
388
  return e;
389
389
  }
390
390
  /**
@@ -396,33 +396,33 @@ class o {
396
396
  let e, t, s, n;
397
397
  if (this.gobbleSpaces(), n = this.searchHook("gobble-token"), n)
398
398
  return this.runHook("after-token", n);
399
- if (e = this.code, o.isDecimalDigit(e) || e === o.PERIOD_CODE)
399
+ if (e = this.code, c.isDecimalDigit(e) || e === c.PERIOD_CODE)
400
400
  return this.gobbleNumericLiteral();
401
- if (e === o.SQUOTE_CODE || e === o.DQUOTE_CODE)
401
+ if (e === c.SQUOTE_CODE || e === c.DQUOTE_CODE)
402
402
  n = this.gobbleStringLiteral();
403
- else if (e === o.OBRACK_CODE)
403
+ else if (e === c.OBRACK_CODE)
404
404
  n = this.gobbleArray();
405
405
  else {
406
- for (t = this.expr.substr(this.index, o.max_unop_len), s = t.length; s > 0; ) {
407
- if (o.unary_ops.hasOwnProperty(t) && (!o.isIdentifierStart(this.code) || this.index + t.length < this.expr.length && !o.isIdentifierPart(this.expr.charCodeAt(this.index + t.length)))) {
406
+ for (t = this.expr.substr(this.index, c.max_unop_len), s = t.length; s > 0; ) {
407
+ if (c.unary_ops.hasOwnProperty(t) && (!c.isIdentifierStart(this.code) || this.index + t.length < this.expr.length && !c.isIdentifierPart(this.expr.charCodeAt(this.index + t.length)))) {
408
408
  this.index += s;
409
- const a = this.gobbleToken();
410
- return a || this.throwError("missing unaryOp argument"), this.runHook("after-token", {
411
- type: o.UNARY_EXP,
409
+ const o = this.gobbleToken();
410
+ return o || this.throwError("missing unaryOp argument"), this.runHook("after-token", {
411
+ type: c.UNARY_EXP,
412
412
  operator: t,
413
- argument: a,
413
+ argument: o,
414
414
  prefix: !0
415
415
  });
416
416
  }
417
417
  t = t.substr(0, --s);
418
418
  }
419
- o.isIdentifierStart(e) ? (n = this.gobbleIdentifier(), o.literals.hasOwnProperty(n.name) ? n = {
420
- type: o.LITERAL,
421
- value: o.literals[n.name],
419
+ c.isIdentifierStart(e) ? (n = this.gobbleIdentifier(), c.literals.hasOwnProperty(n.name) ? n = {
420
+ type: c.LITERAL,
421
+ value: c.literals[n.name],
422
422
  raw: n.name
423
- } : n.name === o.this_str && (n = {
424
- type: o.THIS_EXP
425
- })) : e === o.OPAREN_CODE && (n = this.gobbleGroup());
423
+ } : n.name === c.this_str && (n = {
424
+ type: c.THIS_EXP
425
+ })) : e === c.OPAREN_CODE && (n = this.gobbleGroup());
426
426
  }
427
427
  return n ? (n = this.gobbleTokenProperty(n), this.runHook("after-token", n)) : this.runHook("after-token", !1);
428
428
  }
@@ -437,24 +437,24 @@ class o {
437
437
  gobbleTokenProperty(e) {
438
438
  this.gobbleSpaces();
439
439
  let t = this.code;
440
- for (; t === o.PERIOD_CODE || t === o.OBRACK_CODE || t === o.OPAREN_CODE || t === o.QUMARK_CODE; ) {
440
+ for (; t === c.PERIOD_CODE || t === c.OBRACK_CODE || t === c.OPAREN_CODE || t === c.QUMARK_CODE; ) {
441
441
  let s;
442
- if (t === o.QUMARK_CODE) {
443
- if (this.expr.charCodeAt(this.index + 1) !== o.PERIOD_CODE)
442
+ if (t === c.QUMARK_CODE) {
443
+ if (this.expr.charCodeAt(this.index + 1) !== c.PERIOD_CODE)
444
444
  break;
445
445
  s = !0, this.index += 2, this.gobbleSpaces(), t = this.code;
446
446
  }
447
- this.index++, t === o.OBRACK_CODE ? (e = {
448
- type: o.MEMBER_EXP,
447
+ this.index++, t === c.OBRACK_CODE ? (e = {
448
+ type: c.MEMBER_EXP,
449
449
  computed: !0,
450
450
  object: e,
451
451
  property: this.gobbleExpression()
452
- }, e.property || this.throwError('Unexpected "' + this.char + '"'), this.gobbleSpaces(), t = this.code, t !== o.CBRACK_CODE && this.throwError("Unclosed ["), this.index++) : t === o.OPAREN_CODE ? e = {
453
- type: o.CALL_EXP,
454
- arguments: this.gobbleArguments(o.CPAREN_CODE),
452
+ }, e.property || this.throwError('Unexpected "' + this.char + '"'), this.gobbleSpaces(), t = this.code, t !== c.CBRACK_CODE && this.throwError("Unclosed ["), this.index++) : t === c.OPAREN_CODE ? e = {
453
+ type: c.CALL_EXP,
454
+ arguments: this.gobbleArguments(c.CPAREN_CODE),
455
455
  callee: e
456
- } : (t === o.PERIOD_CODE || s) && (s && this.index--, this.gobbleSpaces(), e = {
457
- type: o.MEMBER_EXP,
456
+ } : (t === c.PERIOD_CODE || s) && (s && this.index--, this.gobbleSpaces(), e = {
457
+ type: c.MEMBER_EXP,
458
458
  computed: !1,
459
459
  object: e,
460
460
  property: this.gobbleIdentifier()
@@ -469,18 +469,18 @@ class o {
469
469
  */
470
470
  gobbleNumericLiteral() {
471
471
  let e = "", t, s;
472
- for (; o.isDecimalDigit(this.code); )
472
+ for (; c.isDecimalDigit(this.code); )
473
473
  e += this.expr.charAt(this.index++);
474
- if (this.code === o.PERIOD_CODE)
475
- for (e += this.expr.charAt(this.index++); o.isDecimalDigit(this.code); )
474
+ if (this.code === c.PERIOD_CODE)
475
+ for (e += this.expr.charAt(this.index++); c.isDecimalDigit(this.code); )
476
476
  e += this.expr.charAt(this.index++);
477
477
  if (t = this.char, t === "e" || t === "E") {
478
- for (e += this.expr.charAt(this.index++), t = this.char, (t === "+" || t === "-") && (e += this.expr.charAt(this.index++)); o.isDecimalDigit(this.code); )
478
+ for (e += this.expr.charAt(this.index++), t = this.char, (t === "+" || t === "-") && (e += this.expr.charAt(this.index++)); c.isDecimalDigit(this.code); )
479
479
  e += this.expr.charAt(this.index++);
480
- o.isDecimalDigit(this.expr.charCodeAt(this.index - 1)) || this.throwError("Expected exponent (" + e + this.char + ")");
480
+ c.isDecimalDigit(this.expr.charCodeAt(this.index - 1)) || this.throwError("Expected exponent (" + e + this.char + ")");
481
481
  }
482
- return s = this.code, o.isIdentifierStart(s) ? this.throwError("Variable names cannot start with a number (" + e + this.char + ")") : (s === o.PERIOD_CODE || e.length === 1 && e.charCodeAt(0) === o.PERIOD_CODE) && this.throwError("Unexpected period"), {
483
- type: o.LITERAL,
482
+ return s = this.code, c.isIdentifierStart(s) ? this.throwError("Variable names cannot start with a number (" + e + this.char + ")") : (s === c.PERIOD_CODE || e.length === 1 && e.charCodeAt(0) === c.PERIOD_CODE) && this.throwError("Unexpected period"), {
483
+ type: c.LITERAL,
484
484
  value: parseFloat(e),
485
485
  raw: e
486
486
  };
@@ -495,12 +495,12 @@ class o {
495
495
  const t = this.index, s = this.expr.charAt(this.index++);
496
496
  let n = !1;
497
497
  for (; this.index < this.expr.length; ) {
498
- let a = this.expr.charAt(this.index++);
499
- if (a === s) {
498
+ let o = this.expr.charAt(this.index++);
499
+ if (o === s) {
500
500
  n = !0;
501
501
  break;
502
- } else if (a === "\\")
503
- switch (a = this.expr.charAt(this.index++), a) {
502
+ } else if (o === "\\")
503
+ switch (o = this.expr.charAt(this.index++), o) {
504
504
  case "n":
505
505
  e += `
506
506
  `;
@@ -521,13 +521,13 @@ class o {
521
521
  e += "\v";
522
522
  break;
523
523
  default:
524
- e += a;
524
+ e += o;
525
525
  }
526
526
  else
527
- e += a;
527
+ e += o;
528
528
  }
529
529
  return n || this.throwError('Unclosed quote after "' + e + '"'), {
530
- type: o.LITERAL,
530
+ type: c.LITERAL,
531
531
  value: e,
532
532
  raw: this.expr.substring(t, this.index)
533
533
  };
@@ -541,10 +541,10 @@ class o {
541
541
  */
542
542
  gobbleIdentifier() {
543
543
  let e = this.code, t = this.index;
544
- for (o.isIdentifierStart(e) ? this.index++ : this.throwError("Unexpected " + this.char); this.index < this.expr.length && (e = this.code, o.isIdentifierPart(e)); )
544
+ for (c.isIdentifierStart(e) ? this.index++ : this.throwError("Unexpected " + this.char); this.index < this.expr.length && (e = this.code, c.isIdentifierPart(e)); )
545
545
  this.index++;
546
546
  return {
547
- type: o.IDENTIFIER,
547
+ type: c.IDENTIFIER,
548
548
  name: this.expr.slice(t, this.index)
549
549
  };
550
550
  }
@@ -562,23 +562,23 @@ class o {
562
562
  let s = !1, n = 0;
563
563
  for (; this.index < this.expr.length; ) {
564
564
  this.gobbleSpaces();
565
- let a = this.code;
566
- if (a === e) {
567
- s = !0, this.index++, e === o.CPAREN_CODE && n && n >= t.length && this.throwError("Unexpected token " + String.fromCharCode(e));
565
+ let o = this.code;
566
+ if (o === e) {
567
+ s = !0, this.index++, e === c.CPAREN_CODE && n && n >= t.length && this.throwError("Unexpected token " + String.fromCharCode(e));
568
568
  break;
569
- } else if (a === o.COMMA_CODE) {
569
+ } else if (o === c.COMMA_CODE) {
570
570
  if (this.index++, n++, n !== t.length) {
571
- if (e === o.CPAREN_CODE)
571
+ if (e === c.CPAREN_CODE)
572
572
  this.throwError("Unexpected token ,");
573
- else if (e === o.CBRACK_CODE)
574
- for (let c = t.length; c < n; c++)
573
+ else if (e === c.CBRACK_CODE)
574
+ for (let i = t.length; i < n; i++)
575
575
  t.push(null);
576
576
  }
577
577
  } else if (t.length !== n && n !== 0)
578
578
  this.throwError("Expected comma");
579
579
  else {
580
- const c = this.gobbleExpression();
581
- (!c || c.type === o.COMPOUND) && this.throwError("Expected comma"), t.push(c);
580
+ const i = this.gobbleExpression();
581
+ (!i || i.type === c.COMPOUND) && this.throwError("Expected comma"), t.push(i);
582
582
  }
583
583
  }
584
584
  return s || this.throwError("Expected " + String.fromCharCode(e)), t;
@@ -594,10 +594,10 @@ class o {
594
594
  */
595
595
  gobbleGroup() {
596
596
  this.index++;
597
- let e = this.gobbleExpressions(o.CPAREN_CODE);
598
- if (this.code === o.CPAREN_CODE)
597
+ let e = this.gobbleExpressions(c.CPAREN_CODE);
598
+ if (this.code === c.CPAREN_CODE)
599
599
  return this.index++, e.length === 1 ? e[0] : e.length ? {
600
- type: o.SEQUENCE_EXP,
600
+ type: c.SEQUENCE_EXP,
601
601
  expressions: e
602
602
  } : !1;
603
603
  this.throwError("Unclosed (");
@@ -610,15 +610,15 @@ class o {
610
610
  */
611
611
  gobbleArray() {
612
612
  return this.index++, {
613
- type: o.ARRAY_EXP,
614
- elements: this.gobbleArguments(o.CBRACK_CODE)
613
+ type: c.ARRAY_EXP,
614
+ elements: this.gobbleArguments(c.CBRACK_CODE)
615
615
  };
616
616
  }
617
617
  }
618
- const we = new Ce();
619
- Object.assign(o, {
620
- hooks: we,
621
- plugins: new Ae(o),
618
+ const et = new De();
619
+ Object.assign(c, {
620
+ hooks: et,
621
+ plugins: new Je(c),
622
622
  // Node Types
623
623
  // ----------
624
624
  // This is the full set of types that any JSEP node can be.
@@ -712,16 +712,16 @@ Object.assign(o, {
712
712
  // Except for `this`, which is special. This could be changed to something like `'self'` as well
713
713
  this_str: "this"
714
714
  });
715
- o.max_unop_len = o.getMaxKeyLen(o.unary_ops);
716
- o.max_binop_len = o.getMaxKeyLen(o.binary_ops);
717
- const K = (r) => new o(r).parse(), Se = Object.getOwnPropertyNames(class {
715
+ c.max_unop_len = c.getMaxKeyLen(c.unary_ops);
716
+ c.max_binop_len = c.getMaxKeyLen(c.binary_ops);
717
+ const ee = (r) => new c(r).parse(), tt = Object.getOwnPropertyNames(class {
718
718
  });
719
- Object.getOwnPropertyNames(o).filter((r) => !Se.includes(r) && K[r] === void 0).forEach((r) => {
720
- K[r] = o[r];
719
+ Object.getOwnPropertyNames(c).filter((r) => !tt.includes(r) && ee[r] === void 0).forEach((r) => {
720
+ ee[r] = c[r];
721
721
  });
722
- K.Jsep = o;
723
- const Pe = "ConditionalExpression";
724
- var Ne = {
722
+ ee.Jsep = c;
723
+ const rt = "ConditionalExpression";
724
+ var nt = {
725
725
  name: "ternary",
726
726
  init(r) {
727
727
  r.hooks.add("after-expression", function(t) {
@@ -730,17 +730,17 @@ var Ne = {
730
730
  const s = t.node, n = this.gobbleExpression();
731
731
  if (n || this.throwError("Expected expression"), this.gobbleSpaces(), this.code === r.COLON_CODE) {
732
732
  this.index++;
733
- const a = this.gobbleExpression();
734
- if (a || this.throwError("Expected expression"), t.node = {
735
- type: Pe,
733
+ const o = this.gobbleExpression();
734
+ if (o || this.throwError("Expected expression"), t.node = {
735
+ type: rt,
736
736
  test: s,
737
737
  consequent: n,
738
- alternate: a
738
+ alternate: o
739
739
  }, s.operator && r.binary_ops[s.operator] <= 0.9) {
740
- let c = s;
741
- for (; c.right.operator && r.binary_ops[c.right.operator] <= 0.9; )
742
- c = c.right;
743
- t.node.test = c.right, c.right = t.node, t.node = s;
740
+ let i = s;
741
+ for (; i.right.operator && r.binary_ops[i.right.operator] <= 0.9; )
742
+ i = i.right;
743
+ t.node.test = i.right, i.right = t.node, t.node = s;
744
744
  }
745
745
  } else
746
746
  this.throwError("Expected :");
@@ -748,66 +748,66 @@ var Ne = {
748
748
  });
749
749
  }
750
750
  };
751
- K.plugins.register(Ne);
752
- const fe = 47, Te = 92;
753
- var Be = {
751
+ ee.plugins.register(nt);
752
+ const Ie = 47, st = 92;
753
+ var ot = {
754
754
  name: "regex",
755
755
  init(r) {
756
756
  r.hooks.add("gobble-token", function(t) {
757
- if (this.code === fe) {
757
+ if (this.code === Ie) {
758
758
  const s = ++this.index;
759
759
  let n = !1;
760
760
  for (; this.index < this.expr.length; ) {
761
- if (this.code === fe && !n) {
762
- const a = this.expr.slice(s, this.index);
763
- let c = "";
761
+ if (this.code === Ie && !n) {
762
+ const o = this.expr.slice(s, this.index);
763
+ let i = "";
764
764
  for (; ++this.index < this.expr.length; ) {
765
- const h = this.code;
766
- if (h >= 97 && h <= 122 || h >= 65 && h <= 90 || h >= 48 && h <= 57)
767
- c += this.char;
765
+ const a = this.code;
766
+ if (a >= 97 && a <= 122 || a >= 65 && a <= 90 || a >= 48 && a <= 57)
767
+ i += this.char;
768
768
  else
769
769
  break;
770
770
  }
771
- let f;
771
+ let u;
772
772
  try {
773
- f = new RegExp(a, c);
774
- } catch (h) {
775
- this.throwError(h.message);
773
+ u = new RegExp(o, i);
774
+ } catch (a) {
775
+ this.throwError(a.message);
776
776
  }
777
777
  return t.node = {
778
778
  type: r.LITERAL,
779
- value: f,
779
+ value: u,
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 === Te ? 2 : 1;
783
+ this.code === r.OBRACK_CODE ? n = !0 : n && this.code === r.CBRACK_CODE && (n = !1), this.index += this.code === st ? 2 : 1;
784
784
  }
785
785
  this.throwError("Unclosed Regex");
786
786
  }
787
787
  });
788
788
  }
789
789
  };
790
- const ue = 43, De = 45, z = {
790
+ const xe = 43, it = 45, ue = {
791
791
  name: "assignment",
792
792
  assignmentOperators: /* @__PURE__ */ new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "||=", "&&=", "??="]),
793
- updateOperators: [ue, De],
793
+ updateOperators: [xe, it],
794
794
  assignmentPrecedence: 0.9,
795
795
  init(r) {
796
796
  const e = [r.IDENTIFIER, r.MEMBER_EXP];
797
- z.assignmentOperators.forEach((s) => r.addBinaryOp(s, z.assignmentPrecedence, !0)), r.hooks.add("gobble-token", function(n) {
798
- const a = this.code;
799
- z.updateOperators.some((c) => c === a && c === this.expr.charCodeAt(this.index + 1)) && (this.index += 2, n.node = {
797
+ ue.assignmentOperators.forEach((s) => r.addBinaryOp(s, ue.assignmentPrecedence, !0)), r.hooks.add("gobble-token", function(n) {
798
+ const o = this.code;
799
+ ue.updateOperators.some((i) => i === o && i === this.expr.charCodeAt(this.index + 1)) && (this.index += 2, n.node = {
800
800
  type: "UpdateExpression",
801
- operator: a === ue ? "++" : "--",
801
+ operator: o === xe ? "++" : "--",
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
- const a = this.code;
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 = {
807
+ const o = this.code;
808
+ ue.updateOperators.some((i) => i === o && i === 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 === ue ? "++" : "--",
810
+ operator: o === xe ? "++" : "--",
811
811
  argument: n.node,
812
812
  prefix: !1
813
813
  });
@@ -816,17 +816,17 @@ const ue = 43, De = 45, z = {
816
816
  n.node && t(n.node);
817
817
  });
818
818
  function t(s) {
819
- z.assignmentOperators.has(s.operator) ? (s.type = "AssignmentExpression", t(s.left), t(s.right)) : s.operator || Object.values(s).forEach((n) => {
819
+ ue.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
- 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 = {
825
+ ee.plugins.register(ot, ue);
826
+ ee.addUnaryOp("typeof");
827
+ ee.addLiteral("null", null);
828
+ ee.addLiteral("undefined", void 0);
829
+ const at = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__"]), V = {
830
830
  /**
831
831
  * @param {jsep.Expression} ast
832
832
  * @param {Record<string, any>} subs
@@ -835,25 +835,25 @@ const Ie = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
835
835
  switch (r.type) {
836
836
  case "BinaryExpression":
837
837
  case "LogicalExpression":
838
- return O.evalBinaryExpression(r, e);
838
+ return V.evalBinaryExpression(r, e);
839
839
  case "Compound":
840
- return O.evalCompound(r, e);
840
+ return V.evalCompound(r, e);
841
841
  case "ConditionalExpression":
842
- return O.evalConditionalExpression(r, e);
842
+ return V.evalConditionalExpression(r, e);
843
843
  case "Identifier":
844
- return O.evalIdentifier(r, e);
844
+ return V.evalIdentifier(r, e);
845
845
  case "Literal":
846
- return O.evalLiteral(r, e);
846
+ return V.evalLiteral(r, e);
847
847
  case "MemberExpression":
848
- return O.evalMemberExpression(r, e);
848
+ return V.evalMemberExpression(r, e);
849
849
  case "UnaryExpression":
850
- return O.evalUnaryExpression(r, e);
850
+ return V.evalUnaryExpression(r, e);
851
851
  case "ArrayExpression":
852
- return O.evalArrayExpression(r, e);
852
+ return V.evalArrayExpression(r, e);
853
853
  case "CallExpression":
854
- return O.evalCallExpression(r, e);
854
+ return V.evalCallExpression(r, e);
855
855
  case "AssignmentExpression":
856
- return O.evalAssignmentExpression(r, e);
856
+ return V.evalAssignmentExpression(r, e);
857
857
  default:
858
858
  throw SyntaxError("Unexpected expression", r);
859
859
  }
@@ -883,19 +883,19 @@ const Ie = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
883
883
  "*": (s, n) => s * n(),
884
884
  "/": (s, n) => s / n(),
885
885
  "%": (s, n) => s % n()
886
- }[r.operator](O.evalAst(r.left, e), () => O.evalAst(r.right, e));
886
+ }[r.operator](V.evalAst(r.left, e), () => V.evalAst(r.right, e));
887
887
  },
888
888
  evalCompound(r, e) {
889
889
  let t;
890
890
  for (let s = 0; s < r.body.length; s++) {
891
891
  r.body[s].type === "Identifier" && ["var", "let", "const"].includes(r.body[s].name) && r.body[s + 1] && r.body[s + 1].type === "AssignmentExpression" && (s += 1);
892
892
  const n = r.body[s];
893
- t = O.evalAst(n, e);
893
+ t = V.evalAst(n, e);
894
894
  }
895
895
  return t;
896
896
  },
897
897
  evalConditionalExpression(r, e) {
898
- return O.evalAst(r.test, e) ? O.evalAst(r.consequent, e) : O.evalAst(r.alternate, e);
898
+ return V.evalAst(r.test, e) ? V.evalAst(r.consequent, e) : V.evalAst(r.alternate, e);
899
899
  },
900
900
  evalIdentifier(r, e) {
901
901
  if (Object.hasOwn(e, r.name))
@@ -910,46 +910,46 @@ const Ie = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
910
910
  // NOTE: `String(value)` throws error when
911
911
  // value has overwritten the toString method to return non-string
912
912
  // i.e. `value = {toString: () => []}`
913
- r.computed ? O.evalAst(r.property) : r.property.name
913
+ r.computed ? V.evalAst(r.property) : r.property.name
914
914
  // `object.property` property is Identifier
915
- ), s = O.evalAst(r.object, e);
915
+ ), s = V.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) && Ie.has(t))
918
+ if (!Object.hasOwn(s, t) && at.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;
922
922
  },
923
923
  evalUnaryExpression(r, e) {
924
924
  return {
925
- "-": (s) => -O.evalAst(s, e),
926
- "!": (s) => !O.evalAst(s, e),
927
- "~": (s) => ~O.evalAst(s, e),
925
+ "-": (s) => -V.evalAst(s, e),
926
+ "!": (s) => !V.evalAst(s, e),
927
+ "~": (s) => ~V.evalAst(s, e),
928
928
  // eslint-disable-next-line no-implicit-coercion -- API
929
- "+": (s) => +O.evalAst(s, e),
930
- typeof: (s) => typeof O.evalAst(s, e)
929
+ "+": (s) => +V.evalAst(s, e),
930
+ typeof: (s) => typeof V.evalAst(s, e)
931
931
  }[r.operator](r.argument);
932
932
  },
933
933
  evalArrayExpression(r, e) {
934
- return r.elements.map((t) => O.evalAst(t, e));
934
+ return r.elements.map((t) => V.evalAst(t, e));
935
935
  },
936
936
  evalCallExpression(r, e) {
937
- const t = r.arguments.map((n) => O.evalAst(n, e));
938
- return O.evalAst(r.callee, e)(...t);
937
+ const t = r.arguments.map((n) => V.evalAst(n, e));
938
+ return V.evalAst(r.callee, e)(...t);
939
939
  },
940
940
  evalAssignmentExpression(r, e) {
941
941
  if (r.left.type !== "Identifier")
942
942
  throw SyntaxError("Invalid left-hand side in assignment");
943
- const t = r.left.name, s = O.evalAst(r.right, e);
943
+ const t = r.left.name, s = V.evalAst(r.right, e);
944
944
  return e[t] = s, e[t];
945
945
  }
946
946
  };
947
- class je {
947
+ class lt {
948
948
  /**
949
949
  * @param {string} expr Expression to evaluate
950
950
  */
951
951
  constructor(e) {
952
- this.code = e, this.ast = K(this.code);
952
+ this.code = e, this.ast = ee(this.code);
953
953
  }
954
954
  /**
955
955
  * @param {object} context Object whose items will be added
@@ -958,16 +958,16 @@ class je {
958
958
  */
959
959
  runInNewContext(e) {
960
960
  const t = Object.assign(/* @__PURE__ */ Object.create(null), e);
961
- return O.evalAst(this.ast, t);
961
+ return V.evalAst(this.ast, t);
962
962
  }
963
963
  }
964
- function G(r, e) {
964
+ function te(r, e) {
965
965
  return r = r.slice(), r.push(e), r;
966
966
  }
967
- function de(r, e) {
967
+ function ke(r, e) {
968
968
  return e = e.slice(), e.unshift(r), e;
969
969
  }
970
- class $e extends Error {
970
+ class ut extends Error {
971
971
  /**
972
972
  * @param {AnyResult} value The evaluated scalar value
973
973
  */
@@ -975,34 +975,34 @@ class $e 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 k(r, e, t, s, n) {
979
- if (!(this instanceof k))
978
+ function $(r, e, t, s, n) {
979
+ if (!(this instanceof $))
980
980
  try {
981
- return new k(r, e, t, s, n);
982
- } catch (c) {
983
- if (!c.avoidNew)
984
- throw c;
985
- return c.value;
981
+ return new $(r, e, t, s, n);
982
+ } catch (i) {
983
+ if (!i.avoidNew)
984
+ throw i;
985
+ return i.value;
986
986
  }
987
987
  typeof r == "string" && (n = s, s = t, t = e, e = r, r = null);
988
- const a = r && typeof r == "object";
988
+ const o = r && typeof r == "object";
989
989
  if (r = r || {}, this.json = r.json || t, this.path = r.path || e, this.resultType = r.resultType || "value", this.flatten = r.flatten || !1, this.wrap = Object.hasOwn(r, "wrap") ? r.wrap : !0, this.sandbox = r.sandbox || {}, this.eval = r.eval === void 0 ? "safe" : r.eval, this.ignoreEvalErrors = typeof r.ignoreEvalErrors > "u" ? !1 : r.ignoreEvalErrors, this.parent = r.parent || null, this.parentProperty = r.parentProperty || null, this.callback = r.callback || s || null, this.otherTypeCallback = r.otherTypeCallback || n || function() {
990
990
  throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.");
991
991
  }, r.autostart !== !1) {
992
- const c = {
993
- path: a ? r.path : e
992
+ const i = {
993
+ path: o ? r.path : e
994
994
  };
995
- a ? "json" in r && (c.json = r.json) : c.json = t;
996
- const f = this.evaluate(c);
997
- if (!f || typeof f != "object")
998
- throw new $e(f);
999
- return f;
995
+ o ? "json" in r && (i.json = r.json) : i.json = t;
996
+ const u = this.evaluate(i);
997
+ if (!u || typeof u != "object")
998
+ throw new ut(u);
999
+ return u;
1000
1000
  }
1001
1001
  }
1002
- k.prototype.evaluate = function(r, e, t, s) {
1003
- let n = this.parent, a = this.parentProperty, {
1004
- flatten: c,
1005
- wrap: f
1002
+ $.prototype.evaluate = function(r, e, t, s) {
1003
+ let n = this.parent, o = this.parentProperty, {
1004
+ flatten: i,
1005
+ wrap: u
1006
1006
  } = this;
1007
1007
  if (this.currResultType = this.resultType, this.currEval = this.eval, this.currSandbox = this.sandbox, t = t || this.callback, this.currOtherTypeCallback = s || this.otherTypeCallback, e = e || this.json, r = r || this.path, r && typeof r == "object" && !Array.isArray(r)) {
1008
1008
  if (!r.path && r.path !== "")
@@ -1011,174 +1011,174 @@ k.prototype.evaluate = function(r, e, t, s) {
1011
1011
  throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');
1012
1012
  ({
1013
1013
  json: e
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;
1014
+ } = r), i = Object.hasOwn(r, "flatten") ? r.flatten : i, this.currResultType = Object.hasOwn(r, "resultType") ? r.resultType : this.currResultType, this.currSandbox = Object.hasOwn(r, "sandbox") ? r.sandbox : this.currSandbox, u = Object.hasOwn(r, "wrap") ? r.wrap : u, 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, o = Object.hasOwn(r, "parentProperty") ? r.parentProperty : o, r = r.path;
1015
1015
  }
1016
- if (n = n || null, a = a || null, Array.isArray(r) && (r = k.toPathString(r)), !r && r !== "" || !e)
1016
+ if (n = n || null, o = o || null, Array.isArray(r) && (r = $.toPathString(r)), !r && r !== "" || !e)
1017
1017
  return;
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;
1018
+ const a = $.toPathArray(r);
1019
+ a[0] === "$" && a.length > 1 && a.shift(), this._hasParentSelector = null;
1020
+ const l = this._trace(a, e, ["$"], n, o, t).filter(function(h) {
1021
+ return h && !h.isParentSelector;
1022
1022
  });
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
- }, []) : f ? [] : void 0;
1023
+ return l.length ? !u && l.length === 1 && !l[0].hasArrExpr ? this._getPreferredOutput(l[0]) : l.reduce((h, f) => {
1024
+ const y = this._getPreferredOutput(f);
1025
+ return i && Array.isArray(y) ? h = h.concat(y) : h.push(y), h;
1026
+ }, []) : u ? [] : void 0;
1027
1027
  };
1028
- k.prototype._getPreferredOutput = function(r) {
1028
+ $.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 : k.toPathArray(r.path);
1033
- return r.pointer = k.toPointer(t), r.path = typeof r.path == "string" ? r.path : k.toPathString(r.path), r;
1032
+ const t = Array.isArray(r.path) ? r.path : $.toPathArray(r.path);
1033
+ return r.pointer = $.toPointer(t), r.path = typeof r.path == "string" ? r.path : $.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 k.toPathString(r[e]);
1040
+ return $.toPathString(r[e]);
1041
1041
  case "pointer":
1042
- return k.toPointer(r.path);
1042
+ return $.toPointer(r.path);
1043
1043
  default:
1044
1044
  throw new TypeError("Unknown result type");
1045
1045
  }
1046
1046
  };
1047
- k.prototype._handleCallback = function(r, e, t) {
1047
+ $.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 : k.toPathString(r.path), e(s, t, r);
1050
+ r.path = typeof r.path == "string" ? r.path : $.toPathString(r.path), e(s, t, r);
1051
1051
  }
1052
1052
  };
1053
- k.prototype._trace = function(r, e, t, s, n, a, c, f) {
1054
- let h;
1053
+ $.prototype._trace = function(r, e, t, s, n, o, i, u) {
1054
+ let a;
1055
1055
  if (!r.length)
1056
- return h = {
1056
+ return a = {
1057
1057
  path: t,
1058
1058
  value: e,
1059
1059
  parent: s,
1060
1060
  parentProperty: n,
1061
- hasArrExpr: c
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));
1061
+ hasArrExpr: i
1062
+ }, this._handleCallback(a, o, "value"), a;
1063
+ const l = r[0], h = r.slice(1), f = [];
1064
+ function y(m) {
1065
+ Array.isArray(m) ? m.forEach((C) => {
1066
+ f.push(C);
1067
+ }) : f.push(m);
1068
+ }
1069
+ if ((typeof l != "string" || u) && e && Object.hasOwn(e, l))
1070
+ y(this._trace(h, e[l], te(t, l), e, l, o, i));
1071
+ else if (l === "*")
1072
+ this._walk(e, (m) => {
1073
+ y(this._trace(h, e[m], te(t, m), e, m, o, !0, !0));
1074
1074
  });
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));
1075
+ else if (l === "..")
1076
+ y(this._trace(h, e, t, s, n, o, i)), this._walk(e, (m) => {
1077
+ typeof e[m] == "object" && y(this._trace(r.slice(), e[m], te(t, m), e, m, o, !0));
1078
1078
  });
1079
1079
  else {
1080
- if (d === "^")
1080
+ if (l === "^")
1081
1081
  return this._hasParentSelector = !0, {
1082
1082
  path: t.slice(0, -1),
1083
- expr: _,
1083
+ expr: h,
1084
1084
  isParentSelector: !0
1085
1085
  };
1086
- if (d === "~")
1087
- return h = {
1088
- path: G(t, d),
1086
+ if (l === "~")
1087
+ return a = {
1088
+ path: te(t, l),
1089
1089
  value: n,
1090
1090
  parent: s,
1091
1091
  parentProperty: null
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) {
1092
+ }, this._handleCallback(a, o, "property"), a;
1093
+ if (l === "$")
1094
+ y(this._trace(h, e, t, null, null, o, i));
1095
+ else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(l))
1096
+ y(this._slice(l, h, e, t, s, n, o));
1097
+ else if (l.indexOf("?(") === 0) {
1098
1098
  if (this.currEval === !1)
1099
1099
  throw new Error("Eval [?(expr)] prevented in JSONPath expression.");
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));
1100
+ const m = l.replace(/^\?\((.*?)\)$/u, "$1"), C = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(m);
1101
+ C ? this._walk(e, (O) => {
1102
+ const P = [C[2]], M = C[1] ? e[O][C[1]] : e[O];
1103
+ this._trace(P, M, t, s, n, o, !0).length > 0 && y(this._trace(h, e[O], te(t, O), e, O, o, !0));
1104
+ }) : this._walk(e, (O) => {
1105
+ this._eval(m, e[O], O, t, s, n) && y(this._trace(h, e[O], te(t, O), e, O, o, !0));
1106
1106
  });
1107
- } else if (d[0] === "(") {
1107
+ } else if (l[0] === "(") {
1108
1108
  if (this.currEval === !1)
1109
1109
  throw new Error("Eval [(expr)] prevented in JSONPath expression.");
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) {
1110
+ y(this._trace(ke(this._eval(l, e, t.at(-1), t.slice(0, -1), s, n), h), e, t, s, n, o, i));
1111
+ } else if (l[0] === "@") {
1112
+ let m = !1;
1113
+ const C = l.slice(1, -2);
1114
+ switch (C) {
1115
1115
  case "scalar":
1116
- (!e || !["object", "function"].includes(typeof e)) && (g = !0);
1116
+ (!e || !["object", "function"].includes(typeof e)) && (m = !0);
1117
1117
  break;
1118
1118
  case "boolean":
1119
1119
  case "string":
1120
1120
  case "undefined":
1121
1121
  case "function":
1122
- typeof e === w && (g = !0);
1122
+ typeof e === C && (m = !0);
1123
1123
  break;
1124
1124
  case "integer":
1125
- Number.isFinite(e) && !(e % 1) && (g = !0);
1125
+ Number.isFinite(e) && !(e % 1) && (m = !0);
1126
1126
  break;
1127
1127
  case "number":
1128
- Number.isFinite(e) && (g = !0);
1128
+ Number.isFinite(e) && (m = !0);
1129
1129
  break;
1130
1130
  case "nonFinite":
1131
- typeof e == "number" && !Number.isFinite(e) && (g = !0);
1131
+ typeof e == "number" && !Number.isFinite(e) && (m = !0);
1132
1132
  break;
1133
1133
  case "object":
1134
- e && typeof e === w && (g = !0);
1134
+ e && typeof e === C && (m = !0);
1135
1135
  break;
1136
1136
  case "array":
1137
- Array.isArray(e) && (g = !0);
1137
+ Array.isArray(e) && (m = !0);
1138
1138
  break;
1139
1139
  case "other":
1140
- g = this.currOtherTypeCallback(e, t, s, n);
1140
+ m = this.currOtherTypeCallback(e, t, s, n);
1141
1141
  break;
1142
1142
  case "null":
1143
- e === null && (g = !0);
1143
+ e === null && (m = !0);
1144
1144
  break;
1145
1145
  /* c8 ignore next 2 */
1146
1146
  default:
1147
- throw new TypeError("Unknown value type " + w);
1147
+ throw new TypeError("Unknown value type " + C);
1148
1148
  }
1149
- if (g)
1150
- return h = {
1149
+ if (m)
1150
+ return a = {
1151
1151
  path: t,
1152
1152
  value: e,
1153
1153
  parent: s,
1154
1154
  parentProperty: n
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));
1155
+ }, this._handleCallback(a, o, "value"), a;
1156
+ } else if (l[0] === "`" && e && Object.hasOwn(e, l.slice(1))) {
1157
+ const m = l.slice(1);
1158
+ y(this._trace(h, e[m], te(t, m), e, m, o, i, !0));
1159
+ } else if (l.includes(",")) {
1160
+ const m = l.split(",");
1161
+ for (const C of m)
1162
+ y(this._trace(ke(C, h), e, t, s, n, o, !0));
1163
+ } else !u && e && Object.hasOwn(e, l) && y(this._trace(h, e[l], te(t, l), e, l, o, i, !0));
1164
1164
  }
1165
1165
  if (this._hasParentSelector)
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[$]);
1166
+ for (let m = 0; m < f.length; m++) {
1167
+ const C = f[m];
1168
+ if (C && C.isParentSelector) {
1169
+ const O = this._trace(C.expr, e, C.path, s, n, o, i);
1170
+ if (Array.isArray(O)) {
1171
+ f[m] = O[0];
1172
+ const P = O.length;
1173
+ for (let M = 1; M < P; M++)
1174
+ m++, f.splice(m, 0, O[M]);
1175
1175
  } else
1176
- b[g] = S;
1176
+ f[m] = O;
1177
1177
  }
1178
1178
  }
1179
- return b;
1179
+ return f;
1180
1180
  };
1181
- k.prototype._walk = function(r, e) {
1181
+ $.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,92 +1187,92 @@ k.prototype._walk = function(r, e) {
1187
1187
  e(t);
1188
1188
  });
1189
1189
  };
1190
- k.prototype._slice = function(r, e, t, s, n, a, c) {
1190
+ $.prototype._slice = function(r, e, t, s, n, o, i) {
1191
1191
  if (!Array.isArray(t))
1192
1192
  return;
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);
1193
+ const u = t.length, a = r.split(":"), l = a[2] && Number.parseInt(a[2]) || 1;
1194
+ let h = a[0] && Number.parseInt(a[0]) || 0, f = a[1] && Number.parseInt(a[1]) || u;
1195
+ h = h < 0 ? Math.max(0, h + u) : Math.min(u, h), f = f < 0 ? Math.max(0, f + u) : Math.min(u, f);
1196
+ const y = [];
1197
+ for (let m = h; m < f; m += l)
1198
+ this._trace(ke(m, e), t, s, n, o, i, !0).forEach((O) => {
1199
+ y.push(O);
1200
1200
  });
1201
- return x;
1201
+ return y;
1202
1202
  };
1203
- k.prototype._eval = function(r, e, t, s, n, a) {
1204
- this.currSandbox._$_parentProperty = a, this.currSandbox._$_parent = n, this.currSandbox._$_property = t, this.currSandbox._$_root = this.json, this.currSandbox._$_v = e;
1205
- const c = r.includes("@path");
1206
- c && (this.currSandbox._$_path = k.toPathString(s.concat([t])));
1207
- const f = this.currEval + "Script:" + r;
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);
1203
+ $.prototype._eval = function(r, e, t, s, n, o) {
1204
+ this.currSandbox._$_parentProperty = o, this.currSandbox._$_parent = n, this.currSandbox._$_property = t, this.currSandbox._$_root = this.json, this.currSandbox._$_v = e;
1205
+ const i = r.includes("@path");
1206
+ i && (this.currSandbox._$_path = $.toPathString(s.concat([t])));
1207
+ const u = this.currEval + "Script:" + r;
1208
+ if (!$.cache[u]) {
1209
+ let a = r.replaceAll("@parentProperty", "_$_parentProperty").replaceAll("@parent", "_$_parent").replaceAll("@property", "_$_property").replaceAll("@root", "_$_root").replaceAll(/@([.\s)[])/gu, "_$_v$1");
1210
+ if (i && (a = a.replaceAll("@path", "_$_path")), this.currEval === "safe" || this.currEval === !0 || this.currEval === void 0)
1211
+ $.cache[u] = new this.safeVm.Script(a);
1212
1212
  else if (this.currEval === "native")
1213
- k.cache[f] = new this.vm.Script(h);
1213
+ $.cache[u] = new this.vm.Script(a);
1214
1214
  else if (typeof this.currEval == "function" && this.currEval.prototype && Object.hasOwn(this.currEval.prototype, "runInNewContext")) {
1215
- const d = this.currEval;
1216
- k.cache[f] = new d(h);
1215
+ const l = this.currEval;
1216
+ $.cache[u] = new l(a);
1217
1217
  } else if (typeof this.currEval == "function")
1218
- k.cache[f] = {
1219
- runInNewContext: (d) => this.currEval(h, d)
1218
+ $.cache[u] = {
1219
+ runInNewContext: (l) => this.currEval(a, l)
1220
1220
  };
1221
1221
  else
1222
1222
  throw new TypeError(`Unknown "eval" property "${this.currEval}"`);
1223
1223
  }
1224
1224
  try {
1225
- return k.cache[f].runInNewContext(this.currSandbox);
1226
- } catch (h) {
1225
+ return $.cache[u].runInNewContext(this.currSandbox);
1226
+ } catch (a) {
1227
1227
  if (this.ignoreEvalErrors)
1228
1228
  return !1;
1229
- throw new Error("jsonPath: " + h.message + ": " + r);
1229
+ throw new Error("jsonPath: " + a.message + ": " + r);
1230
1230
  }
1231
1231
  };
1232
- k.cache = {};
1233
- k.toPathString = function(r) {
1232
+ $.cache = {};
1233
+ $.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
- k.toPointer = function(r) {
1240
+ $.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
- k.toPathArray = function(r) {
1247
+ $.toPathArray = function(r) {
1248
1248
  const {
1249
1249
  cache: e
1250
- } = k;
1250
+ } = $;
1251
1251
  if (e[r])
1252
1252
  return e[r].concat();
1253
- const t = [], n = r.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu, function(a, c) {
1254
- return "[#" + (t.push(c) - 1) + "]";
1255
- }).replaceAll(/\[['"]([^'\]]*)['"]\]/gu, function(a, c) {
1256
- return "['" + c.replaceAll(".", "%@%").replaceAll("~", "%%@@%%") + "']";
1257
- }).replaceAll("~", ";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu, ";").replaceAll("%@%", ".").replaceAll("%%@@%%", "~").replaceAll(/(?:;)?(\^+)(?:;)?/gu, function(a, c) {
1258
- return ";" + c.split("").join(";") + ";";
1259
- }).replaceAll(/;;;|;;/gu, ";..;").replaceAll(/;$|'?\]|'$/gu, "").split(";").map(function(a) {
1260
- const c = a.match(/#(\d+)/u);
1261
- return !c || !c[1] ? a : t[c[1]];
1253
+ const t = [], n = r.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu, function(o, i) {
1254
+ return "[#" + (t.push(i) - 1) + "]";
1255
+ }).replaceAll(/\[['"]([^'\]]*)['"]\]/gu, function(o, i) {
1256
+ return "['" + i.replaceAll(".", "%@%").replaceAll("~", "%%@@%%") + "']";
1257
+ }).replaceAll("~", ";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu, ";").replaceAll("%@%", ".").replaceAll("%%@@%%", "~").replaceAll(/(?:;)?(\^+)(?:;)?/gu, function(o, i) {
1258
+ return ";" + i.split("").join(";") + ";";
1259
+ }).replaceAll(/;;;|;;/gu, ";..;").replaceAll(/;$|'?\]|'$/gu, "").split(";").map(function(o) {
1260
+ const i = o.match(/#(\d+)/u);
1261
+ return !i || !i[1] ? o : t[i[1]];
1262
1262
  });
1263
1263
  return e[r] = n, e[r].concat();
1264
1264
  };
1265
- k.prototype.safeVm = {
1266
- Script: je
1265
+ $.prototype.safeVm = {
1266
+ Script: lt
1267
1267
  };
1268
- const Re = function(r, e, t) {
1268
+ const ct = function(r, e, t) {
1269
1269
  const s = r.length;
1270
1270
  for (let n = 0; n < s; n++) {
1271
- const a = r[n];
1272
- t(a) && e.push(r.splice(n--, 1)[0]);
1271
+ const o = r[n];
1272
+ t(o) && e.push(r.splice(n--, 1)[0]);
1273
1273
  }
1274
1274
  };
1275
- class Le {
1275
+ class dt {
1276
1276
  /**
1277
1277
  * @param {string} expr Expression to evaluate
1278
1278
  */
@@ -1287,47 +1287,47 @@ class Le {
1287
1287
  runInNewContext(e) {
1288
1288
  let t = this.code;
1289
1289
  const s = Object.keys(e), n = [];
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;
1290
+ ct(s, n, (l) => typeof e[l] == "function");
1291
+ const o = s.map((l) => e[l]);
1292
+ t = n.reduce((l, h) => {
1293
+ let f = e[h].toString();
1294
+ return /function/u.test(f) || (f = "function " + f), "var " + h + "=" + f + ";" + l;
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(";"), h = f !== -1 ? t.slice(0, f + 1) + " return " + t.slice(f + 1) : " return " + t;
1297
- return new Function(...s, h)(...a);
1296
+ const u = t.lastIndexOf(";"), a = u !== -1 ? t.slice(0, u + 1) + " return " + t.slice(u + 1) : " return " + t;
1297
+ return new Function(...s, a)(...o);
1298
1298
  }
1299
1299
  }
1300
- k.prototype.vm = {
1301
- Script: Le
1300
+ $.prototype.vm = {
1301
+ Script: dt
1302
1302
  };
1303
- const Ue = { class: "json-node" }, Me = {
1303
+ const ft = { class: "json-node" }, ht = {
1304
1304
  key: 0,
1305
1305
  class: "json-node__container"
1306
- }, Ve = { class: "json-node__line" }, Fe = {
1306
+ }, pt = { class: "json-node__line" }, gt = {
1307
1307
  key: 2,
1308
1308
  class: "json-node__colon"
1309
- }, He = ["title"], Ke = {
1309
+ }, bt = ["title"], mt = {
1310
1310
  key: 3,
1311
1311
  class: "json-node__collapsed"
1312
- }, Xe = {
1312
+ }, yt = {
1313
1313
  key: 4,
1314
1314
  class: "json-node__comma"
1315
- }, Ge = {
1315
+ }, Et = {
1316
1316
  key: 0,
1317
1317
  class: "json-node__children"
1318
- }, Qe = { class: "json-node__children-content" }, Ye = { class: "json-node__line json-node__closing-bracket" }, qe = { class: "json-node__bracket" }, ze = {
1318
+ }, vt = { class: "json-node__children-content" }, _t = { class: "json-node__line json-node__closing-bracket" }, xt = { class: "json-node__bracket" }, Nt = {
1319
1319
  key: 0,
1320
1320
  class: "json-node__comma"
1321
- }, We = {
1321
+ }, kt = {
1322
1322
  key: 1,
1323
1323
  class: "json-node__primitive"
1324
- }, Ze = {
1324
+ }, wt = {
1325
1325
  key: 2,
1326
1326
  class: "json-node__colon"
1327
- }, Je = ["title"], et = {
1327
+ }, At = ["title"], Ct = {
1328
1328
  key: 0,
1329
1329
  class: "json-node__comma"
1330
- }, tt = /* @__PURE__ */ pe({
1330
+ }, Ot = /* @__PURE__ */ be({
1331
1331
  name: "JsonNode",
1332
1332
  __name: "JsonNode",
1333
1333
  props: {
@@ -1341,191 +1341,181 @@ const Ue = { class: "json-node" }, Me = {
1341
1341
  },
1342
1342
  emits: ["update:value", "toggle-expand", "copy", "update:key"],
1343
1343
  setup(r, { emit: e }) {
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
1344
+ Ce((b) => ({
1345
+ "7b112182": b.level,
1346
+ "1501a3a8": b.theme.colors.syntaxKey,
1347
+ "4c2226b6": b.theme.colors.hoverBackground,
1348
+ "30aa351e": b.theme.colors.syntaxBracket,
1349
+ "090e30f3": b.theme.colors.textSecondary,
1350
+ cf872bb0: b.theme.colors.syntaxString,
1351
+ e0803540: b.theme.colors.syntaxNumber,
1352
+ "3954b61e": b.theme.colors.syntaxBoolean,
1353
+ e9972d44: b.theme.colors.syntaxNull,
1354
+ "231c0282": b.theme.colors.background,
1355
+ e1dce7d8: b.theme.colors.indentLine
1356
1356
  }));
1357
- const t = r, s = e, n = H(!1), a = H(!1), c = H(""), f = H(""), h = (u) => {
1358
- if (!/^-?\d+(\.\d+)?$/.test(u)) return !1;
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(() => {
1357
+ const t = r, s = e, n = G(!1), o = G(!1), i = G(""), u = G(""), a = (b) => b !== null && typeof b == "object" && !Array.isArray(b) && "__protected_number__" in b && Object.keys(b).length === 1, l = (b) => a(b) ? b.__protected_number__ : "", h = L(() => a(t.value) ? !1 : t.value !== null && typeof t.value == "object"), f = L(() => Array.isArray(t.value)), y = L(() => t.path ? t.path : t.keyName ? t.keyName : "root"), m = L(() => t.expanded.has(y.value)), C = L(() => t.keyName), O = L(() => f.value ? "[" : "{"), P = L(() => f.value ? "]" : "}"), M = L(() => {
1368
1358
  if (!t.value) return "";
1369
- const E = Object.keys(t.value).length;
1370
- return b.value ? E > 0 ? ` ${E} items ` : " " : E > 0 ? ` ${E} keys ` : " ";
1371
- }), W = j(() => {
1372
- const u = typeof t.value;
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" : "";
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 = () => {
1380
- t.level !== 0 && (n.value = !0, c.value = t.keyName, ee(() => {
1381
- const u = document.querySelectorAll(".json-node__key-input"), E = u[u.length - 1];
1382
- E && (E.focus(), E.select());
1359
+ const d = Object.keys(t.value).length;
1360
+ return f.value ? d > 0 ? ` ${d} items ` : " " : d > 0 ? ` ${d} keys ` : " ";
1361
+ }), k = L(() => {
1362
+ const b = typeof t.value;
1363
+ return t.value === null ? "json-node__value--null" : b === "boolean" ? "json-node__value--boolean" : b === "number" || a(t.value) ? "json-node__value--number" : b === "string" ? "json-node__value--string" : "";
1364
+ }), S = L(() => o.value ? u.value : t.value === null ? "null" : typeof t.value == "boolean" || typeof t.value == "number" ? String(t.value) : a(t.value) ? l(t.value) : typeof t.value == "string" ? `"${t.value}"` : String(t.value)), g = L(() => "Click to edit, double-click to copy"), T = (b) => t.level === 0 ? b : y.value ? `${y.value}.${b}` : b, X = (b) => {
1365
+ const d = Object.keys(t.value);
1366
+ return d.indexOf(b) === d.length - 1;
1367
+ }, j = () => {
1368
+ s("toggle-expand", y.value);
1369
+ }, Y = () => {
1370
+ t.level !== 0 && (n.value = !0, i.value = t.keyName, ce(() => {
1371
+ const b = document.querySelectorAll(".json-node__key-input"), d = b[b.length - 1];
1372
+ d && (d.focus(), d.select());
1383
1373
  }));
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());
1374
+ }, Z = () => {
1375
+ h.value || (o.value = !0, a(t.value) ? u.value = l(t.value) : typeof t.value == "string" ? u.value = t.value : u.value = String(t.value), ce(() => {
1376
+ const b = document.querySelectorAll(".json-node__value-input"), d = b[b.length - 1];
1377
+ d && (d.focus(), d.select());
1388
1378
  }));
1389
- }, Y = () => {
1379
+ }, D = () => {
1390
1380
  if (t.level === 0 || !n.value) return;
1391
- const u = c.value.trim();
1392
- if (!u) {
1393
- X();
1381
+ const b = i.value.trim();
1382
+ if (!b) {
1383
+ ie();
1394
1384
  return;
1395
1385
  }
1396
- if (u === t.keyName) {
1386
+ if (b === t.keyName) {
1397
1387
  n.value = !1;
1398
1388
  return;
1399
1389
  }
1400
- n.value = !1, s("update:key", x.value, u);
1401
- }, se = () => {
1390
+ n.value = !1, s("update:key", y.value, b);
1391
+ }, J = () => {
1402
1392
  try {
1403
- let u;
1404
- const E = f.value.trim();
1405
- if (E === "null")
1406
- u = null;
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;
1393
+ let b;
1394
+ const d = u.value.trim();
1395
+ if (d === "null")
1396
+ b = null;
1397
+ else if (d === "true" || d === "false")
1398
+ b = d === "true";
1399
+ else if (!isNaN(Number(d)) && d !== "") {
1400
+ const p = Number(d);
1401
+ !Number.isSafeInteger(p) || d.length > 15 ? b = { __protected_number__: d } : b = p;
1412
1402
  } else
1413
- u = f.value;
1414
- s("update:value", x.value, u), a.value = !1;
1415
- } catch (u) {
1416
- console.error("Failed to parse value:", u), a.value = !1;
1403
+ b = u.value;
1404
+ s("update:value", y.value, b), o.value = !1;
1405
+ } catch (b) {
1406
+ console.error("Failed to parse value:", b), o.value = !1;
1417
1407
  }
1418
- }, X = () => {
1419
- n.value = !1, c.value = t.keyName;
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);
1408
+ }, ie = () => {
1409
+ n.value = !1, i.value = t.keyName;
1410
+ }, Ee = () => {
1411
+ o.value = !1, a(t.value) ? u.value = l(t.value) : typeof t.value == "string" ? u.value = t.value : u.value = String(t.value);
1422
1412
  };
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", {
1413
+ return (b, d) => {
1414
+ const p = Me("JsonNode", !0);
1415
+ return x(), N("div", ft, [
1416
+ h.value ? (x(), N("div", ht, [
1417
+ E("div", pt, [
1418
+ b.keyName && !n.value ? (x(), N("span", {
1429
1419
  key: 0,
1430
1420
  class: "json-node__key",
1431
- onClick: J,
1421
+ onClick: Y,
1432
1422
  title: "Click to edit key"
1433
- }, ' "' + F(w.value) + '" ', 1)) : I("", !0),
1434
- u.keyName && n.value ? le((A(), C("input", {
1423
+ }, ' "' + R(C.value) + '" ', 1)) : F("", !0),
1424
+ b.keyName && n.value ? ve((x(), N("input", {
1435
1425
  key: 1,
1436
- "onUpdate:modelValue": E[0] || (E[0] = (l) => c.value = l),
1426
+ "onUpdate:modelValue": d[0] || (d[0] = (_) => i.value = _),
1437
1427
  onKeyup: [
1438
- q(Y, ["enter"]),
1439
- q(X, ["escape"])
1428
+ le(D, ["enter"]),
1429
+ le(ie, ["escape"])
1440
1430
  ],
1441
- onBlur: Y,
1431
+ onBlur: D,
1442
1432
  class: "json-node__key-input"
1443
1433
  }, null, 544)), [
1444
- [ce, c.value]
1445
- ]) : I("", !0),
1446
- u.keyName ? (A(), C("span", Fe, ": ")) : I("", !0),
1447
- B("span", {
1434
+ [_e, i.value]
1435
+ ]) : F("", !0),
1436
+ b.keyName ? (x(), N("span", gt, ": ")) : F("", !0),
1437
+ E("span", {
1448
1438
  class: "json-node__bracket json-node__bracket--clickable",
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", {
1439
+ onClick: j,
1440
+ title: m.value ? "Click to collapse" : "Click to expand"
1441
+ }, R(O.value), 9, bt),
1442
+ m.value ? F("", !0) : (x(), N("span", mt, [
1443
+ Se(R(M.value) + " ", 1),
1444
+ E("span", {
1455
1445
  class: "json-node__bracket json-node__bracket--clickable",
1456
- onClick: Z
1457
- }, F(M.value), 1)
1446
+ onClick: j
1447
+ }, R(P.value), 1)
1458
1448
  ])),
1459
- !g.value && !u.isLast ? (A(), C("span", Xe, ",")) : I("", !0)
1449
+ !m.value && !b.isLast ? (x(), N("span", yt, ",")) : F("", !0)
1460
1450
  ]),
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,
1451
+ m.value ? (x(), N("div", Et, [
1452
+ E("div", vt, [
1453
+ (x(!0), N(he, null, pe(b.value, (_, v) => (x(), N("div", {
1454
+ key: v,
1465
1455
  class: "json-node__child"
1466
1456
  }, [
1467
- ge(i, {
1468
- value: l,
1469
- "key-name": b.value ? "" : String(m),
1470
- level: u.level + 1,
1471
- path: Q(String(m)),
1472
- expanded: u.expanded,
1473
- theme: u.theme,
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))
1457
+ Ue(p, {
1458
+ value: _,
1459
+ "key-name": f.value ? "" : String(v),
1460
+ level: b.level + 1,
1461
+ path: T(String(v)),
1462
+ expanded: b.expanded,
1463
+ theme: b.theme,
1464
+ "onUpdate:value": d[1] || (d[1] = (w, A) => b.$emit("update:value", w, A)),
1465
+ onToggleExpand: d[2] || (d[2] = (w) => b.$emit("toggle-expand", w)),
1466
+ onCopy: d[3] || (d[3] = (w) => b.$emit("copy", w)),
1467
+ "onUpdate:key": d[4] || (d[4] = (w, A) => b.$emit("update:key", w, A)),
1468
+ "is-last": X(String(v))
1479
1469
  }, null, 8, ["value", "key-name", "level", "path", "expanded", "theme", "is-last"])
1480
1470
  ]))), 128))
1481
1471
  ]),
1482
- B("div", Ye, [
1483
- B("span", qe, F(M.value), 1),
1484
- u.isLast ? I("", !0) : (A(), C("span", ze, ","))
1472
+ E("div", _t, [
1473
+ E("span", xt, R(P.value), 1),
1474
+ b.isLast ? F("", !0) : (x(), N("span", Nt, ","))
1485
1475
  ])
1486
- ])) : I("", !0)
1487
- ])) : (A(), C("div", We, [
1488
- u.keyName && !n.value ? (A(), C("span", {
1476
+ ])) : F("", !0)
1477
+ ])) : (x(), N("div", kt, [
1478
+ b.keyName && !n.value ? (x(), N("span", {
1489
1479
  key: 0,
1490
1480
  class: "json-node__key",
1491
- onClick: J,
1481
+ onClick: Y,
1492
1482
  title: "Click to edit key"
1493
- }, ' "' + F(w.value) + '" ', 1)) : I("", !0),
1494
- u.keyName && n.value ? le((A(), C("input", {
1483
+ }, ' "' + R(C.value) + '" ', 1)) : F("", !0),
1484
+ b.keyName && n.value ? ve((x(), N("input", {
1495
1485
  key: 1,
1496
- "onUpdate:modelValue": E[5] || (E[5] = (l) => c.value = l),
1486
+ "onUpdate:modelValue": d[5] || (d[5] = (_) => i.value = _),
1497
1487
  onKeyup: [
1498
- q(Y, ["enter"]),
1499
- q(X, ["escape"])
1488
+ le(D, ["enter"]),
1489
+ le(ie, ["escape"])
1500
1490
  ],
1501
- onBlur: Y,
1491
+ onBlur: D,
1502
1492
  class: "json-node__key-input"
1503
1493
  }, null, 544)), [
1504
- [ce, c.value]
1505
- ]) : I("", !0),
1506
- u.keyName ? (A(), C("span", Ze, ": ")) : I("", !0),
1507
- a.value ? I("", !0) : (A(), C("span", {
1494
+ [_e, i.value]
1495
+ ]) : F("", !0),
1496
+ b.keyName ? (x(), N("span", wt, ": ")) : F("", !0),
1497
+ o.value ? F("", !0) : (x(), N("span", {
1508
1498
  key: 3,
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
1499
+ class: Oe(["json-node__value", k.value]),
1500
+ onClick: Z,
1501
+ onDblclick: d[6] || (d[6] = (_) => b.$emit("copy", b.value)),
1502
+ title: g.value
1513
1503
  }, [
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", {
1504
+ Se(R(S.value), 1),
1505
+ b.isLast ? F("", !0) : (x(), N("span", Ct, ","))
1506
+ ], 42, At)),
1507
+ o.value ? ve((x(), N("input", {
1518
1508
  key: 4,
1519
- "onUpdate:modelValue": E[7] || (E[7] = (l) => f.value = l),
1509
+ "onUpdate:modelValue": d[7] || (d[7] = (_) => u.value = _),
1520
1510
  onKeyup: [
1521
- q(se, ["enter"]),
1522
- q(oe, ["escape"])
1511
+ le(J, ["enter"]),
1512
+ le(Ee, ["escape"])
1523
1513
  ],
1524
- onBlur: se,
1514
+ onBlur: J,
1525
1515
  class: "json-node__value-input"
1526
1516
  }, null, 544)), [
1527
- [ce, f.value]
1528
- ]) : I("", !0)
1517
+ [_e, u.value]
1518
+ ]) : F("", !0)
1529
1519
  ]))
1530
1520
  ]);
1531
1521
  };
@@ -1535,7 +1525,7 @@ const Ue = { class: "json-node" }, Me = {
1535
1525
  for (const [s, n] of e)
1536
1526
  t[s] = n;
1537
1527
  return t;
1538
- }, rt = /* @__PURE__ */ me(tt, [["__scopeId", "data-v-c799bdec"]]), Ee = {
1528
+ }, Tt = /* @__PURE__ */ me(Ot, [["__scopeId", "data-v-860beb35"]]), He = {
1539
1529
  name: "github-light",
1540
1530
  colors: {
1541
1531
  // 背景色
@@ -1574,7 +1564,7 @@ const Ue = { class: "json-node" }, Me = {
1574
1564
  // 缩进线
1575
1565
  indentLine: "#d0d7de"
1576
1566
  }
1577
- }, nt = {
1567
+ }, Pt = {
1578
1568
  name: "github-dark",
1579
1569
  colors: {
1580
1570
  // 背景色
@@ -1613,7 +1603,7 @@ const Ue = { class: "json-node" }, Me = {
1613
1603
  // 缩进线
1614
1604
  indentLine: "#30363d"
1615
1605
  }
1616
- }, st = {
1606
+ }, St = {
1617
1607
  name: "min-light",
1618
1608
  colors: {
1619
1609
  // 背景色 - 纯白简洁
@@ -1652,7 +1642,7 @@ const Ue = { class: "json-node" }, Me = {
1652
1642
  // 缩进线
1653
1643
  indentLine: "#e5e7eb"
1654
1644
  }
1655
- }, ot = {
1645
+ }, It = {
1656
1646
  name: "slack-ochin",
1657
1647
  colors: {
1658
1648
  // 背景色 - 温暖的米色调
@@ -1691,34 +1681,34 @@ const Ue = { class: "json-node" }, Me = {
1691
1681
  // 缩进线
1692
1682
  indentLine: "#e8d5b7"
1693
1683
  }
1694
- }, it = {
1695
- "github-light": Ee,
1696
- "github-dark": nt,
1697
- "min-light": st,
1698
- "slack-ochin": ot
1684
+ }, $t = {
1685
+ "github-light": He,
1686
+ "github-dark": Pt,
1687
+ "min-light": St,
1688
+ "slack-ochin": It
1699
1689
  };
1700
- function at(r = "github-light") {
1701
- return it[r] || Ee;
1690
+ function Bt(r = "github-light") {
1691
+ return $t[r] || He;
1702
1692
  }
1703
- const lt = {
1693
+ const Lt = {
1704
1694
  key: 0,
1705
1695
  class: "json-format__toolbar"
1706
- }, ct = { class: "json-format__actions" }, ut = ["disabled"], dt = ["disabled"], ht = ["disabled"], ft = ["disabled"], pt = { class: "json-format__info" }, yt = {
1696
+ }, Vt = { class: "json-format__actions" }, Rt = ["disabled"], jt = ["disabled"], Mt = ["disabled"], Ut = ["disabled"], Ft = { class: "json-format__info" }, Xt = {
1707
1697
  key: 0,
1708
1698
  class: "json-format__status json-format__status--success"
1709
- }, gt = {
1699
+ }, Ht = {
1710
1700
  key: 1,
1711
1701
  class: "json-format__status json-format__status--error"
1712
- }, bt = { class: "json-format__content" }, mt = {
1702
+ }, Kt = { class: "json-format__content" }, Yt = {
1713
1703
  key: 0,
1714
1704
  class: "json-format__error"
1715
- }, Et = {
1705
+ }, qt = {
1716
1706
  key: 1,
1717
1707
  class: "json-format__error"
1718
- }, vt = {
1708
+ }, Qt = {
1719
1709
  key: 2,
1720
1710
  class: "json-format__viewer"
1721
- }, _t = /* @__PURE__ */ pe({
1711
+ }, Gt = /* @__PURE__ */ be({
1722
1712
  name: "JsonFormat",
1723
1713
  __name: "index",
1724
1714
  props: {
@@ -1730,352 +1720,2196 @@ const lt = {
1730
1720
  },
1731
1721
  emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress"],
1732
1722
  setup(r, { expose: e, emit: t }) {
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
1723
+ Ce((d) => ({
1724
+ "50e4672c": f.value.colors.border,
1725
+ "64d14328": f.value.colors.background,
1726
+ "668c94eb": f.value.colors.text,
1727
+ "8370c286": f.value.colors.surfaceBackground,
1728
+ "1698e888": f.value.colors.buttonBorder,
1729
+ "584924be": f.value.colors.buttonBackground,
1730
+ "325e00bd": f.value.colors.buttonText,
1731
+ "2430fb1e": f.value.colors.buttonBackgroundHover,
1732
+ ea0e2f1c: f.value.colors.buttonPrimary,
1733
+ "3b0b67ea": f.value.colors.buttonPrimaryHover,
1734
+ "2e7b3e93": f.value.colors.successBackground,
1735
+ b24220f6: f.value.colors.success,
1736
+ "0c7db250": f.value.colors.errorBackground,
1737
+ "6a387a0a": f.value.colors.error,
1738
+ "2c13c5fa": f.value.colors.scrollbarTrack,
1739
+ "2c1c44e4": f.value.colors.scrollbarThumb,
1740
+ "8ba97764": f.value.colors.scrollbarThumbHover
1751
1741
  }));
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) => {
1753
- if (!i.trim()) {
1754
- a.value = null, c.value = "", h.value = null, d.value = "";
1742
+ const s = r, n = t, o = G(null), i = G(""), u = G(/* @__PURE__ */ new Set()), a = G(null), l = G(""), h = L(() => i.value === ""), f = L(() => Bt(s.theme)), y = L(() => l.value ? null : a.value !== null ? a.value : o.value), m = (d) => {
1743
+ if (!d.trim()) {
1744
+ o.value = null, i.value = "", a.value = null, l.value = "";
1755
1745
  return;
1756
1746
  }
1757
1747
  try {
1758
- let l = i;
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)
1748
+ let p = d;
1749
+ const _ = /(:\s*|,\s*|\[\s*)-?\d{16,}/.test(p), v = /(:\s*|,\s*|\[\s*)-?\d+\.\d*0+\s*[,}\]\s]*/.test(p);
1750
+ if (!_ && !v)
1761
1751
  try {
1762
- a.value = JSON.parse(l), c.value = "", h.value = null, d.value = "", ee(() => {
1763
- x.value !== null && Q();
1752
+ o.value = JSON.parse(p), i.value = "", a.value = null, l.value = "", ce(() => {
1753
+ y.value !== null && g();
1764
1754
  });
1765
1755
  return;
1766
1756
  } catch {
1767
1757
  }
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++;
1776
- else {
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;
1781
- } else
1782
- V += T, U++;
1783
- }
1784
- }
1785
- return V;
1786
- };
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++;
1758
+ p = ((A) => {
1759
+ let B = "", H = !1, K = !1, z = 0;
1760
+ for (; z < A.length; ) {
1761
+ const ae = A[z];
1762
+ if (H)
1763
+ K ? K = !1 : ae === "\\" ? K = !0 : ae === '"' && (H = !1), B += ae, z++;
1764
+ else if (ae === '"')
1765
+ H = !0, B += ae, z++;
1795
1766
  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;
1767
+ const Pe = A.slice(z);
1768
+ let W = Pe.match(/^([:,\[\s]*)(-?\d{16,})(\s*[,\}\]\s]|$)/);
1769
+ if (W) {
1770
+ B += W[1] + '{"__protected_number__":"' + W[2] + '"}' + W[3], z += W[0].length;
1800
1771
  continue;
1801
1772
  }
1802
- if (T = U.match(/^([:,\[\s]*)(-?\d+\.\d*0+)(\s*[,\}\]\s]|$)/), T) {
1803
- N += T[1] + '"' + T[2] + '"' + T[3], R += T[0].length;
1773
+ if (W = Pe.match(/^([:,\[\s]*)(-?\d+\.\d*0+)(\s*[,\}\]\s]|$)/), W) {
1774
+ B += W[1] + '{"__protected_number__":"' + W[2] + '"}' + W[3], z += W[0].length;
1804
1775
  continue;
1805
1776
  }
1806
- N += L, R++;
1777
+ B += ae, z++;
1807
1778
  }
1808
1779
  }
1809
- return N;
1810
- })(l), a.value = JSON.parse(l), c.value = "", h.value = null, d.value = "", ee(() => {
1811
- x.value !== null && Q();
1780
+ return B;
1781
+ })(p), o.value = JSON.parse(p), i.value = "", a.value = null, l.value = "", ce(() => {
1782
+ y.value !== null && g();
1812
1783
  });
1813
- } catch (l) {
1814
- c.value = l instanceof Error ? l.message : "Unknown parsing error", a.value = null, h.value = null, d.value = "";
1784
+ } catch (p) {
1785
+ i.value = p instanceof Error ? p.message : "Unknown parsing error", o.value = null, a.value = null, l.value = "";
1815
1786
  }
1816
- }, w = (i) => {
1817
- if (!i || !i.expression.trim()) {
1818
- S();
1787
+ }, C = (d) => {
1788
+ if (!d || !d.expression.trim()) {
1789
+ O();
1819
1790
  return;
1820
1791
  }
1821
- if (!a.value) {
1822
- d.value = "No valid JSON data to filter";
1792
+ if (!o.value) {
1793
+ l.value = "No valid JSON data to filter";
1823
1794
  return;
1824
1795
  }
1825
1796
  try {
1826
- let l;
1827
- if (i.type === "jsonpath")
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;
1829
- else if (i.type === "js")
1830
- l = new Function("data", `
1797
+ let p;
1798
+ if (d.type === "jsonpath")
1799
+ p = $({ path: d.expression, json: o.value }), p.length === 1 && d.expression.includes("$[") === !1 && !d.expression.endsWith("[*]") ? a.value = p[0] : a.value = p;
1800
+ else if (d.type === "js")
1801
+ p = new Function("data", `
1831
1802
  try {
1832
- return ${i.expression};
1803
+ return ${d.expression};
1833
1804
  } catch (error) {
1834
1805
  throw new Error('JavaScript expression error: ' + error.message);
1835
1806
  }
1836
- `)(a.value), h.value = l;
1807
+ `)(o.value), a.value = p;
1837
1808
  else
1838
- throw new Error(`Unsupported filter type: ${i.type}`);
1839
- d.value = "", ee(() => {
1840
- Q();
1809
+ throw new Error(`Unsupported filter type: ${d.type}`);
1810
+ l.value = "", ce(() => {
1811
+ g();
1841
1812
  });
1842
- } catch (l) {
1843
- d.value = l instanceof Error ? l.message : "Filter execution error", h.value = null;
1813
+ } catch (p) {
1814
+ l.value = p instanceof Error ? p.message : "Filter execution error", a.value = null;
1844
1815
  }
1845
- }, S = () => {
1846
- h.value = null, d.value = "";
1816
+ }, O = () => {
1817
+ a.value = null, l.value = "";
1847
1818
  };
1848
- Oe(() => s.modelValue, (i) => {
1849
- g(i);
1819
+ Fe(() => s.modelValue, (d) => {
1820
+ m(d);
1850
1821
  }, { immediate: !0 });
1851
- const M = (i) => {
1852
- if (!/^-?\d+(\.\d+)?$/.test(i)) return !1;
1853
- const l = Number(i);
1854
- return !Number.isSafeInteger(l) || i.length > 15;
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;
1866
- }
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) => {
1822
+ const P = (d, p, _) => {
1823
+ const v = (B) => {
1824
+ if (B === null || typeof B != "object")
1825
+ return B;
1826
+ if (!Array.isArray(B) && "__protected_number__" in B && Object.keys(B).length === 1)
1827
+ return `__PROTECTED_NUMBER_${B.__protected_number__}_PROTECTED_NUMBER__`;
1828
+ if (Array.isArray(B))
1829
+ return B.map((K) => v(K));
1830
+ const H = {};
1831
+ for (const [K, z] of Object.entries(B))
1832
+ H[K] = v(z);
1833
+ return H;
1834
+ }, w = v(d);
1835
+ return JSON.stringify(w, p, _).replace(/"__PROTECTED_NUMBER_(.+?)_PROTECTED_NUMBER__"/g, "$1");
1836
+ }, M = (d, p) => {
1869
1837
  if (!s.readonly)
1870
1838
  try {
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);
1839
+ const _ = k(o.value, d, p), v = P(_, null, 2);
1840
+ n("update:modelValue", v);
1841
+ } catch (_) {
1842
+ console.error("Failed to update JSON:", _);
1875
1843
  }
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]);
1844
+ }, k = (d, p, _) => {
1845
+ if (!p || p === "root") return _;
1846
+ const v = p.split("."), w = J(d, v.slice(0, -1));
1847
+ let A = w;
1848
+ for (let H = 0; H < v.length - 1; H++) {
1849
+ const K = v[H];
1850
+ K !== "root" && (Array.isArray(A) ? A = A[parseInt(K)] : A = A[K]);
1883
1851
  }
1884
- const P = p[p.length - 1];
1885
- return P === "root" ? m : (Array.isArray(v) ? v[parseInt(P)] = m : v[P] = m, y);
1886
- }, te = (i) => {
1887
- f.value.has(i) ? f.value.delete(i) : f.value.add(i);
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);
1852
+ const B = v[v.length - 1];
1853
+ return B === "root" ? _ : (Array.isArray(A) ? A[parseInt(B)] = _ : A[B] = _, w);
1854
+ }, S = (d) => {
1855
+ u.value.has(d) ? u.value.delete(d) : u.value.add(d);
1856
+ }, g = () => {
1857
+ const d = /* @__PURE__ */ new Set(), p = (_, v = "") => {
1858
+ _ !== null && typeof _ == "object" && (d.add(v || "root"), Array.isArray(_) ? _.forEach((w, A) => {
1859
+ const B = v ? `${v}.${A}` : `${A}`;
1860
+ p(w, B);
1861
+ }) : Object.keys(_).forEach((w) => {
1862
+ const A = v ? `${v}.${w}` : w;
1863
+ p(_[w], A);
1896
1864
  }));
1897
1865
  };
1898
- l(x.value), f.value = i, n("expand-all");
1899
- }, re = () => {
1900
- f.value = /* @__PURE__ */ new Set(["root"]), n("collapse-all");
1901
- }, Z = async () => {
1902
- if (_.value)
1866
+ p(y.value), u.value = d, n("expand-all");
1867
+ }, T = () => {
1868
+ u.value = /* @__PURE__ */ new Set(["root"]), n("collapse-all");
1869
+ }, X = async () => {
1870
+ if (h.value)
1903
1871
  try {
1904
- const i = x.value, l = $(i, null, 2);
1905
- await navigator.clipboard.writeText(l), n("copy-success", l);
1906
- } catch (i) {
1907
- console.error("Failed to copy JSON:", i), n("copy-error", i instanceof Error ? i : new Error("Failed to copy JSON"));
1872
+ const d = y.value, p = P(d, null, 2);
1873
+ await navigator.clipboard.writeText(p), n("copy-success", p);
1874
+ } catch (d) {
1875
+ console.error("Failed to copy JSON:", d), n("copy-error", d instanceof Error ? d : new Error("Failed to copy JSON"));
1908
1876
  }
1909
- }, J = () => {
1910
- if (_.value)
1877
+ }, j = () => {
1878
+ if (h.value)
1911
1879
  try {
1912
- const i = x.value, l = $(i);
1913
- n("update:modelValue", l), n("compress", l);
1914
- } catch (i) {
1915
- console.error("Failed to compress JSON:", i);
1880
+ const d = y.value, p = P(d);
1881
+ n("update:modelValue", p), n("compress", p);
1882
+ } catch (d) {
1883
+ console.error("Failed to compress JSON:", d);
1916
1884
  }
1917
- }, ne = async (i) => {
1885
+ }, Y = async (d) => {
1918
1886
  try {
1919
- let l;
1920
- typeof i == "string" && M(i) ? l = i : typeof i == "string" ? l = `"${i}"` : l = JSON.stringify(i), await navigator.clipboard.writeText(l);
1921
- } catch (l) {
1922
- console.error("Failed to copy value:", l);
1887
+ let p;
1888
+ typeof d == "object" && d !== null && !Array.isArray(d) && "__protected_number__" in d && Object.keys(d).length === 1 ? p = d.__protected_number__ : typeof d == "string" ? p = `"${d}"` : p = JSON.stringify(d), await navigator.clipboard.writeText(p);
1889
+ } catch (p) {
1890
+ console.error("Failed to copy value:", p);
1923
1891
  }
1924
- }, Y = (i, l) => {
1892
+ }, Z = (d, p) => {
1925
1893
  if (!s.readonly)
1926
1894
  try {
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);
1895
+ const _ = D(o.value, d, p), v = P(_, null, 2);
1896
+ n("update:modelValue", v), b(d, p);
1897
+ } catch (_) {
1898
+ console.error("Failed to rename key:", _);
1931
1899
  }
1932
- }, se = (i, l, m) => {
1933
- if (!l || l === "root") return i;
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;
1900
+ }, D = (d, p, _) => {
1901
+ if (!p || p === "root") return d;
1902
+ const v = p.split("."), w = J(d, v.slice(0, -1));
1903
+ if (v.length === 1) {
1904
+ const H = v[0];
1905
+ return w && typeof w == "object" && !Array.isArray(w) ? ie(w, H, _) : w;
1938
1906
  }
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];
1907
+ let A = w;
1908
+ for (let H = 0; H < v.length - 1; H++) {
1909
+ const K = v[H];
1910
+ Array.isArray(A) ? A = A[parseInt(K)] : A = A[K];
1943
1911
  }
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);
1912
+ const B = v[v.length - 1];
1913
+ if (!Array.isArray(A) && A && typeof A == "object") {
1914
+ const H = ie(A, B, _), K = v.slice(0, -1);
1915
+ K.length > 0 && Ee(w, K, H);
1948
1916
  }
1949
- return y;
1950
- }, X = (i, l) => {
1951
- if (l.length === 0) return i;
1952
- if (Array.isArray(i)) {
1953
- const m = [...i], p = l[0], y = parseInt(p);
1954
- return l.length === 1 || (m[y] = X(i[y], l.slice(1))), m;
1955
- } else if (i && typeof i == "object") {
1956
- const m = { ...i }, p = l[0];
1957
- return l.length === 1 || (m[p] = X(i[p], l.slice(1))), m;
1917
+ return w;
1918
+ }, J = (d, p) => {
1919
+ if (p.length === 0) return d;
1920
+ if (Array.isArray(d)) {
1921
+ const _ = [...d], v = p[0], w = parseInt(v);
1922
+ return p.length === 1 || (_[w] = J(d[w], p.slice(1))), _;
1923
+ } else if (d && typeof d == "object") {
1924
+ const _ = { ...d }, v = p[0];
1925
+ return p.length === 1 || (_[v] = J(d[v], p.slice(1))), _;
1958
1926
  }
1959
- return i;
1960
- }, oe = (i, l, m) => {
1961
- if (!i || typeof i != "object" || Array.isArray(i))
1962
- return i;
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];
1927
+ return d;
1928
+ }, ie = (d, p, _) => {
1929
+ if (!d || typeof d != "object" || Array.isArray(d))
1930
+ return d;
1931
+ const v = Object.keys(d), w = {};
1932
+ for (const A of v)
1933
+ A === p ? w[_] = d[A] : w[A] = d[A];
1934
+ return w;
1935
+ }, Ee = (d, p, _) => {
1936
+ let v = d;
1937
+ for (let A = 0; A < p.length - 1; A++) {
1938
+ const B = p[A];
1939
+ Array.isArray(v) ? v = v[parseInt(B)] : v = v[B];
1972
1940
  }
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);
1941
+ const w = p[p.length - 1];
1942
+ Array.isArray(v) ? v[parseInt(w)] = _ : v[w] = _;
1943
+ }, b = (d, p) => {
1944
+ const _ = /* @__PURE__ */ new Set();
1945
+ u.value.forEach((v) => {
1946
+ if (v === d) {
1947
+ const w = d.split(".");
1948
+ w[w.length - 1] = p, _.add(w.join("."));
1949
+ } else if (v.startsWith(d + ".")) {
1950
+ const w = d.split(".");
1951
+ w[w.length - 1] = p;
1952
+ const A = w.join("."), B = v.substring(d.length);
1953
+ _.add(A + B);
1986
1954
  } else
1987
- m.add(p);
1988
- }), f.value = m;
1955
+ _.add(v);
1956
+ }), u.value = _;
1989
1957
  };
1990
1958
  return e({
1991
1959
  // 核心操作方法
1992
- copyJson: Z,
1993
- compressSource: J,
1994
- expandAll: Q,
1995
- collapseAll: re,
1996
- toggleExpand: te,
1997
- updateValue: W,
1998
- updateKey: Y,
1960
+ copyJson: X,
1961
+ compressSource: j,
1962
+ expandAll: g,
1963
+ collapseAll: T,
1964
+ toggleExpand: S,
1965
+ updateValue: M,
1966
+ updateKey: Z,
1999
1967
  // Filter 相关方法
2000
- filter: w,
2001
- clearFilter: S,
1968
+ filter: C,
1969
+ clearFilter: O,
2002
1970
  // 状态访问方法
2003
- isValidJson: () => _.value,
2004
- getParsedJson: () => a.value,
2005
- getFilteredJson: () => h.value,
2006
- getExpandedNodes: () => f.value,
2007
- getParseError: () => c.value,
2008
- getFilterError: () => d.value,
1971
+ isValidJson: () => h.value,
1972
+ getParsedJson: () => o.value,
1973
+ getFilteredJson: () => a.value,
1974
+ getExpandedNodes: () => u.value,
1975
+ getParseError: () => i.value,
1976
+ getFilterError: () => l.value,
2009
1977
  // 工具方法
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}`])
1978
+ parseJson: (d) => m(d),
1979
+ copyValue: (d) => Y(d)
1980
+ }), (d, p) => (x(), N("div", {
1981
+ class: Oe(["json-format", `json-format--${f.value.name}`])
2014
1982
  }, [
2015
- i.showToolbar ? (A(), C("div", lt, [
2016
- B("div", ct, [
2017
- B("button", {
1983
+ d.showToolbar ? (x(), N("div", Lt, [
1984
+ E("div", Vt, [
1985
+ E("button", {
2018
1986
  class: "json-format__btn json-format__btn--primary",
2019
- onClick: Z,
2020
- disabled: !_.value,
1987
+ onClick: X,
1988
+ disabled: !h.value,
2021
1989
  title: "Copy JSON"
2022
- }, " 📋 Copy ", 8, ut),
2023
- B("button", {
1990
+ }, " 📋 Copy ", 8, Rt),
1991
+ E("button", {
2024
1992
  class: "json-format__btn json-format__btn--secondary",
2025
- onClick: Q,
2026
- disabled: !_.value,
1993
+ onClick: g,
1994
+ disabled: !h.value,
2027
1995
  title: "Expand All"
2028
- }, " ⬇️ Expand All ", 8, dt),
2029
- B("button", {
1996
+ }, " ⬇️ Expand All ", 8, jt),
1997
+ E("button", {
2030
1998
  class: "json-format__btn json-format__btn--secondary",
2031
- onClick: re,
2032
- disabled: !_.value,
1999
+ onClick: T,
2000
+ disabled: !h.value,
2033
2001
  title: "Collapse All"
2034
- }, " ➡️ Collapse All ", 8, ht),
2035
- B("button", {
2002
+ }, " ➡️ Collapse All ", 8, Mt),
2003
+ E("button", {
2036
2004
  class: "json-format__btn json-format__btn--secondary",
2037
- onClick: J,
2038
- disabled: !_.value,
2005
+ onClick: j,
2006
+ disabled: !h.value,
2039
2007
  title: "Compress JSON"
2040
- }, " 📦 Compress ", 8, ft)
2008
+ }, " 📦 Compress ", 8, Ut)
2041
2009
  ]),
2042
- B("div", pt, [
2043
- _.value ? (A(), C("span", yt, " ✅ Valid JSON ")) : (A(), C("span", gt, " ❌ Invalid JSON "))
2010
+ E("div", Ft, [
2011
+ h.value ? (x(), N("span", Xt, " ✅ Valid JSON ")) : (x(), N("span", Ht, " ❌ Invalid JSON "))
2044
2012
  ])
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,
2013
+ ])) : F("", !0),
2014
+ E("div", Kt, [
2015
+ h.value ? l.value ? (x(), N("div", qt, [
2016
+ p[1] || (p[1] = E("h4", null, "Filter Error:", -1)),
2017
+ E("pre", null, R(l.value), 1)
2018
+ ])) : (x(), N("div", Qt, [
2019
+ Ue(Tt, {
2020
+ value: y.value,
2053
2021
  "key-name": "",
2054
2022
  level: 0,
2055
- expanded: f.value,
2023
+ expanded: u.value,
2056
2024
  "is-last": !0,
2057
- theme: b.value,
2058
- "onUpdate:value": W,
2059
- onToggleExpand: te,
2060
- onCopy: ne,
2061
- "onUpdate:key": Y
2025
+ theme: f.value,
2026
+ "onUpdate:value": M,
2027
+ onToggleExpand: S,
2028
+ onCopy: Y,
2029
+ "onUpdate:key": Z
2062
2030
  }, null, 8, ["value", "expanded", "theme"])
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)
2031
+ ])) : (x(), N("div", Yt, [
2032
+ p[0] || (p[0] = E("h4", null, "JSON Parse Error:", -1)),
2033
+ E("pre", null, R(i.value), 1)
2066
2034
  ]))
2067
2035
  ])
2068
2036
  ], 2));
2069
2037
  }
2070
- }), xt = /* @__PURE__ */ me(_t, [["__scopeId", "data-v-632b8436"]]), kt = [xt], Ot = (r) => {
2071
- kt.forEach((e) => {
2038
+ }), Wt = /* @__PURE__ */ me(Gt, [["__scopeId", "data-v-7a477244"]]), Ke = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD", Zt = Ke + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", zt = "[" + Ke + "][" + Zt + "]*", Dt = new RegExp("^" + zt + "$");
2039
+ function Ye(r, e) {
2040
+ const t = [];
2041
+ let s = e.exec(r);
2042
+ for (; s; ) {
2043
+ const n = [];
2044
+ n.startIndex = e.lastIndex - s[0].length;
2045
+ const o = s.length;
2046
+ for (let i = 0; i < o; i++)
2047
+ n.push(s[i]);
2048
+ t.push(n), s = e.exec(r);
2049
+ }
2050
+ return t;
2051
+ }
2052
+ const ye = function(r) {
2053
+ const e = Dt.exec(r);
2054
+ return !(e === null || typeof e > "u");
2055
+ };
2056
+ function Jt(r) {
2057
+ return typeof r < "u";
2058
+ }
2059
+ const er = {
2060
+ allowBooleanAttributes: !1,
2061
+ //A tag can have attributes without any value
2062
+ unpairedTags: []
2063
+ };
2064
+ function qe(r, e) {
2065
+ e = Object.assign({}, er, e);
2066
+ const t = [];
2067
+ let s = !1, n = !1;
2068
+ r[0] === "\uFEFF" && (r = r.substr(1));
2069
+ for (let o = 0; o < r.length; o++)
2070
+ if (r[o] === "<" && r[o + 1] === "?") {
2071
+ if (o += 2, o = Be(r, o), o.err) return o;
2072
+ } else if (r[o] === "<") {
2073
+ let i = o;
2074
+ if (o++, r[o] === "!") {
2075
+ o = Le(r, o);
2076
+ continue;
2077
+ } else {
2078
+ let u = !1;
2079
+ r[o] === "/" && (u = !0, o++);
2080
+ let a = "";
2081
+ for (; o < r.length && r[o] !== ">" && r[o] !== " " && r[o] !== " " && r[o] !== `
2082
+ ` && r[o] !== "\r"; o++)
2083
+ a += r[o];
2084
+ if (a = a.trim(), a[a.length - 1] === "/" && (a = a.substring(0, a.length - 1), o--), !lr(a)) {
2085
+ let f;
2086
+ return a.trim().length === 0 ? f = "Invalid space after '<'." : f = "Tag '" + a + "' is an invalid name.", U("InvalidTag", f, q(r, o));
2087
+ }
2088
+ const l = nr(r, o);
2089
+ if (l === !1)
2090
+ return U("InvalidAttr", "Attributes for '" + a + "' have open quote.", q(r, o));
2091
+ let h = l.value;
2092
+ if (o = l.index, h[h.length - 1] === "/") {
2093
+ const f = o - h.length;
2094
+ h = h.substring(0, h.length - 1);
2095
+ const y = Ve(h, e);
2096
+ if (y === !0)
2097
+ s = !0;
2098
+ else
2099
+ return U(y.err.code, y.err.msg, q(r, f + y.err.line));
2100
+ } else if (u)
2101
+ if (l.tagClosed) {
2102
+ if (h.trim().length > 0)
2103
+ return U("InvalidTag", "Closing tag '" + a + "' can't have attributes or invalid starting.", q(r, i));
2104
+ if (t.length === 0)
2105
+ return U("InvalidTag", "Closing tag '" + a + "' has not been opened.", q(r, i));
2106
+ {
2107
+ const f = t.pop();
2108
+ if (a !== f.tagName) {
2109
+ let y = q(r, f.tagStartPos);
2110
+ return U(
2111
+ "InvalidTag",
2112
+ "Expected closing tag '" + f.tagName + "' (opened in line " + y.line + ", col " + y.col + ") instead of closing tag '" + a + "'.",
2113
+ q(r, i)
2114
+ );
2115
+ }
2116
+ t.length == 0 && (n = !0);
2117
+ }
2118
+ } else return U("InvalidTag", "Closing tag '" + a + "' doesn't have proper closing.", q(r, o));
2119
+ else {
2120
+ const f = Ve(h, e);
2121
+ if (f !== !0)
2122
+ return U(f.err.code, f.err.msg, q(r, o - h.length + f.err.line));
2123
+ if (n === !0)
2124
+ return U("InvalidXml", "Multiple possible root nodes found.", q(r, o));
2125
+ e.unpairedTags.indexOf(a) !== -1 || t.push({ tagName: a, tagStartPos: i }), s = !0;
2126
+ }
2127
+ for (o++; o < r.length; o++)
2128
+ if (r[o] === "<")
2129
+ if (r[o + 1] === "!") {
2130
+ o++, o = Le(r, o);
2131
+ continue;
2132
+ } else if (r[o + 1] === "?") {
2133
+ if (o = Be(r, ++o), o.err) return o;
2134
+ } else
2135
+ break;
2136
+ else if (r[o] === "&") {
2137
+ const f = ir(r, o);
2138
+ if (f == -1)
2139
+ return U("InvalidChar", "char '&' is not expected.", q(r, o));
2140
+ o = f;
2141
+ } else if (n === !0 && !$e(r[o]))
2142
+ return U("InvalidXml", "Extra text at the end", q(r, o));
2143
+ r[o] === "<" && o--;
2144
+ }
2145
+ } else {
2146
+ if ($e(r[o]))
2147
+ continue;
2148
+ return U("InvalidChar", "char '" + r[o] + "' is not expected.", q(r, o));
2149
+ }
2150
+ if (s) {
2151
+ if (t.length == 1)
2152
+ return U("InvalidTag", "Unclosed tag '" + t[0].tagName + "'.", q(r, t[0].tagStartPos));
2153
+ if (t.length > 0)
2154
+ return U("InvalidXml", "Invalid '" + JSON.stringify(t.map((o) => o.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
2155
+ } else return U("InvalidXml", "Start tag expected.", 1);
2156
+ return !0;
2157
+ }
2158
+ function $e(r) {
2159
+ return r === " " || r === " " || r === `
2160
+ ` || r === "\r";
2161
+ }
2162
+ function Be(r, e) {
2163
+ const t = e;
2164
+ for (; e < r.length; e++)
2165
+ if (r[e] == "?" || r[e] == " ") {
2166
+ const s = r.substr(t, e - t);
2167
+ if (e > 5 && s === "xml")
2168
+ return U("InvalidXml", "XML declaration allowed only at the start of the document.", q(r, e));
2169
+ if (r[e] == "?" && r[e + 1] == ">") {
2170
+ e++;
2171
+ break;
2172
+ } else
2173
+ continue;
2174
+ }
2175
+ return e;
2176
+ }
2177
+ function Le(r, e) {
2178
+ if (r.length > e + 5 && r[e + 1] === "-" && r[e + 2] === "-") {
2179
+ for (e += 3; e < r.length; e++)
2180
+ if (r[e] === "-" && r[e + 1] === "-" && r[e + 2] === ">") {
2181
+ e += 2;
2182
+ break;
2183
+ }
2184
+ } else if (r.length > e + 8 && r[e + 1] === "D" && r[e + 2] === "O" && r[e + 3] === "C" && r[e + 4] === "T" && r[e + 5] === "Y" && r[e + 6] === "P" && r[e + 7] === "E") {
2185
+ let t = 1;
2186
+ for (e += 8; e < r.length; e++)
2187
+ if (r[e] === "<")
2188
+ t++;
2189
+ else if (r[e] === ">" && (t--, t === 0))
2190
+ break;
2191
+ } else if (r.length > e + 9 && r[e + 1] === "[" && r[e + 2] === "C" && r[e + 3] === "D" && r[e + 4] === "A" && r[e + 5] === "T" && r[e + 6] === "A" && r[e + 7] === "[") {
2192
+ for (e += 8; e < r.length; e++)
2193
+ if (r[e] === "]" && r[e + 1] === "]" && r[e + 2] === ">") {
2194
+ e += 2;
2195
+ break;
2196
+ }
2197
+ }
2198
+ return e;
2199
+ }
2200
+ const tr = '"', rr = "'";
2201
+ function nr(r, e) {
2202
+ let t = "", s = "", n = !1;
2203
+ for (; e < r.length; e++) {
2204
+ if (r[e] === tr || r[e] === rr)
2205
+ s === "" ? s = r[e] : s !== r[e] || (s = "");
2206
+ else if (r[e] === ">" && s === "") {
2207
+ n = !0;
2208
+ break;
2209
+ }
2210
+ t += r[e];
2211
+ }
2212
+ return s !== "" ? !1 : {
2213
+ value: t,
2214
+ index: e,
2215
+ tagClosed: n
2216
+ };
2217
+ }
2218
+ const sr = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
2219
+ function Ve(r, e) {
2220
+ const t = Ye(r, sr), s = {};
2221
+ for (let n = 0; n < t.length; n++) {
2222
+ if (t[n][1].length === 0)
2223
+ return U("InvalidAttr", "Attribute '" + t[n][2] + "' has no space in starting.", de(t[n]));
2224
+ if (t[n][3] !== void 0 && t[n][4] === void 0)
2225
+ return U("InvalidAttr", "Attribute '" + t[n][2] + "' is without value.", de(t[n]));
2226
+ if (t[n][3] === void 0 && !e.allowBooleanAttributes)
2227
+ return U("InvalidAttr", "boolean attribute '" + t[n][2] + "' is not allowed.", de(t[n]));
2228
+ const o = t[n][2];
2229
+ if (!ar(o))
2230
+ return U("InvalidAttr", "Attribute '" + o + "' is an invalid name.", de(t[n]));
2231
+ if (!s.hasOwnProperty(o))
2232
+ s[o] = 1;
2233
+ else
2234
+ return U("InvalidAttr", "Attribute '" + o + "' is repeated.", de(t[n]));
2235
+ }
2236
+ return !0;
2237
+ }
2238
+ function or(r, e) {
2239
+ let t = /\d/;
2240
+ for (r[e] === "x" && (e++, t = /[\da-fA-F]/); e < r.length; e++) {
2241
+ if (r[e] === ";")
2242
+ return e;
2243
+ if (!r[e].match(t))
2244
+ break;
2245
+ }
2246
+ return -1;
2247
+ }
2248
+ function ir(r, e) {
2249
+ if (e++, r[e] === ";")
2250
+ return -1;
2251
+ if (r[e] === "#")
2252
+ return e++, or(r, e);
2253
+ let t = 0;
2254
+ for (; e < r.length; e++, t++)
2255
+ if (!(r[e].match(/\w/) && t < 20)) {
2256
+ if (r[e] === ";")
2257
+ break;
2258
+ return -1;
2259
+ }
2260
+ return e;
2261
+ }
2262
+ function U(r, e, t) {
2263
+ return {
2264
+ err: {
2265
+ code: r,
2266
+ msg: e,
2267
+ line: t.line || t,
2268
+ col: t.col
2269
+ }
2270
+ };
2271
+ }
2272
+ function ar(r) {
2273
+ return ye(r);
2274
+ }
2275
+ function lr(r) {
2276
+ return ye(r);
2277
+ }
2278
+ function q(r, e) {
2279
+ const t = r.substring(0, e).split(/\r?\n/);
2280
+ return {
2281
+ line: t.length,
2282
+ // column number is last line's length + 1, because column numbering starts at 1:
2283
+ col: t[t.length - 1].length + 1
2284
+ };
2285
+ }
2286
+ function de(r) {
2287
+ return r.startIndex + r[1].length;
2288
+ }
2289
+ const ur = {
2290
+ preserveOrder: !1,
2291
+ attributeNamePrefix: "@_",
2292
+ attributesGroupName: !1,
2293
+ textNodeName: "#text",
2294
+ ignoreAttributes: !0,
2295
+ removeNSPrefix: !1,
2296
+ // remove NS from tag name or attribute name if true
2297
+ allowBooleanAttributes: !1,
2298
+ //a tag can have attributes without any value
2299
+ //ignoreRootElement : false,
2300
+ parseTagValue: !0,
2301
+ parseAttributeValue: !1,
2302
+ trimValues: !0,
2303
+ //Trim string values of tag and attributes
2304
+ cdataPropName: !1,
2305
+ numberParseOptions: {
2306
+ hex: !0,
2307
+ leadingZeros: !0,
2308
+ eNotation: !0
2309
+ },
2310
+ tagValueProcessor: function(r, e) {
2311
+ return e;
2312
+ },
2313
+ attributeValueProcessor: function(r, e) {
2314
+ return e;
2315
+ },
2316
+ stopNodes: [],
2317
+ //nested tags will not be parsed even for errors
2318
+ alwaysCreateTextNode: !1,
2319
+ isArray: () => !1,
2320
+ commentPropName: !1,
2321
+ unpairedTags: [],
2322
+ processEntities: !0,
2323
+ htmlEntities: !1,
2324
+ ignoreDeclaration: !1,
2325
+ ignorePiTags: !1,
2326
+ transformTagName: !1,
2327
+ transformAttributeName: !1,
2328
+ updateTag: function(r, e, t) {
2329
+ return r;
2330
+ },
2331
+ // skipEmptyListItem: false
2332
+ captureMetaData: !1
2333
+ }, cr = function(r) {
2334
+ return Object.assign({}, ur, r);
2335
+ };
2336
+ let ge;
2337
+ typeof Symbol != "function" ? ge = "@@xmlMetadata" : ge = Symbol("XML Node Metadata");
2338
+ let se = class {
2339
+ constructor(e) {
2340
+ this.tagname = e, this.child = [], this[":@"] = {};
2341
+ }
2342
+ add(e, t) {
2343
+ e === "__proto__" && (e = "#__proto__"), this.child.push({ [e]: t });
2344
+ }
2345
+ addChild(e, t) {
2346
+ e.tagname === "__proto__" && (e.tagname = "#__proto__"), e[":@"] && Object.keys(e[":@"]).length > 0 ? this.child.push({ [e.tagname]: e.child, ":@": e[":@"] }) : this.child.push({ [e.tagname]: e.child }), t !== void 0 && (this.child[this.child.length - 1][ge] = { startIndex: t });
2347
+ }
2348
+ /** symbol used for metadata */
2349
+ static getMetaDataSymbol() {
2350
+ return ge;
2351
+ }
2352
+ };
2353
+ class dr {
2354
+ constructor(e) {
2355
+ this.suppressValidationErr = !e;
2356
+ }
2357
+ readDocType(e, t) {
2358
+ const s = {};
2359
+ if (e[t + 3] === "O" && e[t + 4] === "C" && e[t + 5] === "T" && e[t + 6] === "Y" && e[t + 7] === "P" && e[t + 8] === "E") {
2360
+ t = t + 9;
2361
+ let n = 1, o = !1, i = !1, u = "";
2362
+ for (; t < e.length; t++)
2363
+ if (e[t] === "<" && !i) {
2364
+ if (o && ne(e, "!ENTITY", t)) {
2365
+ t += 7;
2366
+ let a, l;
2367
+ [a, l, t] = this.readEntityExp(e, t + 1, this.suppressValidationErr), l.indexOf("&") === -1 && (s[a] = {
2368
+ regx: RegExp(`&${a};`, "g"),
2369
+ val: l
2370
+ });
2371
+ } else if (o && ne(e, "!ELEMENT", t)) {
2372
+ t += 8;
2373
+ const { index: a } = this.readElementExp(e, t + 1);
2374
+ t = a;
2375
+ } else if (o && ne(e, "!ATTLIST", t))
2376
+ t += 8;
2377
+ else if (o && ne(e, "!NOTATION", t)) {
2378
+ t += 9;
2379
+ const { index: a } = this.readNotationExp(e, t + 1, this.suppressValidationErr);
2380
+ t = a;
2381
+ } else if (ne(e, "!--", t)) i = !0;
2382
+ else throw new Error("Invalid DOCTYPE");
2383
+ n++, u = "";
2384
+ } else if (e[t] === ">") {
2385
+ if (i ? e[t - 1] === "-" && e[t - 2] === "-" && (i = !1, n--) : n--, n === 0)
2386
+ break;
2387
+ } else e[t] === "[" ? o = !0 : u += e[t];
2388
+ if (n !== 0)
2389
+ throw new Error("Unclosed DOCTYPE");
2390
+ } else
2391
+ throw new Error("Invalid Tag instead of DOCTYPE");
2392
+ return { entities: s, i: t };
2393
+ }
2394
+ readEntityExp(e, t) {
2395
+ t = Q(e, t);
2396
+ let s = "";
2397
+ for (; t < e.length && !/\s/.test(e[t]) && e[t] !== '"' && e[t] !== "'"; )
2398
+ s += e[t], t++;
2399
+ if (fe(s), t = Q(e, t), !this.suppressValidationErr) {
2400
+ if (e.substring(t, t + 6).toUpperCase() === "SYSTEM")
2401
+ throw new Error("External entities are not supported");
2402
+ if (e[t] === "%")
2403
+ throw new Error("Parameter entities are not supported");
2404
+ }
2405
+ let n = "";
2406
+ return [t, n] = this.readIdentifierVal(e, t, "entity"), t--, [s, n, t];
2407
+ }
2408
+ readNotationExp(e, t) {
2409
+ t = Q(e, t);
2410
+ let s = "";
2411
+ for (; t < e.length && !/\s/.test(e[t]); )
2412
+ s += e[t], t++;
2413
+ !this.suppressValidationErr && fe(s), t = Q(e, t);
2414
+ const n = e.substring(t, t + 6).toUpperCase();
2415
+ if (!this.suppressValidationErr && n !== "SYSTEM" && n !== "PUBLIC")
2416
+ throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);
2417
+ t += n.length, t = Q(e, t);
2418
+ let o = null, i = null;
2419
+ if (n === "PUBLIC")
2420
+ [t, o] = this.readIdentifierVal(e, t, "publicIdentifier"), t = Q(e, t), (e[t] === '"' || e[t] === "'") && ([t, i] = this.readIdentifierVal(e, t, "systemIdentifier"));
2421
+ else if (n === "SYSTEM" && ([t, i] = this.readIdentifierVal(e, t, "systemIdentifier"), !this.suppressValidationErr && !i))
2422
+ throw new Error("Missing mandatory system identifier for SYSTEM notation");
2423
+ return { notationName: s, publicIdentifier: o, systemIdentifier: i, index: --t };
2424
+ }
2425
+ readIdentifierVal(e, t, s) {
2426
+ let n = "";
2427
+ const o = e[t];
2428
+ if (o !== '"' && o !== "'")
2429
+ throw new Error(`Expected quoted string, found "${o}"`);
2430
+ for (t++; t < e.length && e[t] !== o; )
2431
+ n += e[t], t++;
2432
+ if (e[t] !== o)
2433
+ throw new Error(`Unterminated ${s} value`);
2434
+ return t++, [t, n];
2435
+ }
2436
+ readElementExp(e, t) {
2437
+ t = Q(e, t);
2438
+ let s = "";
2439
+ for (; t < e.length && !/\s/.test(e[t]); )
2440
+ s += e[t], t++;
2441
+ if (!this.suppressValidationErr && !ye(s))
2442
+ throw new Error(`Invalid element name: "${s}"`);
2443
+ t = Q(e, t);
2444
+ let n = "";
2445
+ if (e[t] === "E" && ne(e, "MPTY", t)) t += 4;
2446
+ else if (e[t] === "A" && ne(e, "NY", t)) t += 2;
2447
+ else if (e[t] === "(") {
2448
+ for (t++; t < e.length && e[t] !== ")"; )
2449
+ n += e[t], t++;
2450
+ if (e[t] !== ")")
2451
+ throw new Error("Unterminated content model");
2452
+ } else if (!this.suppressValidationErr)
2453
+ throw new Error(`Invalid Element Expression, found "${e[t]}"`);
2454
+ return {
2455
+ elementName: s,
2456
+ contentModel: n.trim(),
2457
+ index: t
2458
+ };
2459
+ }
2460
+ readAttlistExp(e, t) {
2461
+ t = Q(e, t);
2462
+ let s = "";
2463
+ for (; t < e.length && !/\s/.test(e[t]); )
2464
+ s += e[t], t++;
2465
+ fe(s), t = Q(e, t);
2466
+ let n = "";
2467
+ for (; t < e.length && !/\s/.test(e[t]); )
2468
+ n += e[t], t++;
2469
+ if (!fe(n))
2470
+ throw new Error(`Invalid attribute name: "${n}"`);
2471
+ t = Q(e, t);
2472
+ let o = "";
2473
+ if (e.substring(t, t + 8).toUpperCase() === "NOTATION") {
2474
+ if (o = "NOTATION", t += 8, t = Q(e, t), e[t] !== "(")
2475
+ throw new Error(`Expected '(', found "${e[t]}"`);
2476
+ t++;
2477
+ let u = [];
2478
+ for (; t < e.length && e[t] !== ")"; ) {
2479
+ let a = "";
2480
+ for (; t < e.length && e[t] !== "|" && e[t] !== ")"; )
2481
+ a += e[t], t++;
2482
+ if (a = a.trim(), !fe(a))
2483
+ throw new Error(`Invalid notation name: "${a}"`);
2484
+ u.push(a), e[t] === "|" && (t++, t = Q(e, t));
2485
+ }
2486
+ if (e[t] !== ")")
2487
+ throw new Error("Unterminated list of notations");
2488
+ t++, o += " (" + u.join("|") + ")";
2489
+ } else {
2490
+ for (; t < e.length && !/\s/.test(e[t]); )
2491
+ o += e[t], t++;
2492
+ const u = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
2493
+ if (!this.suppressValidationErr && !u.includes(o.toUpperCase()))
2494
+ throw new Error(`Invalid attribute type: "${o}"`);
2495
+ }
2496
+ t = Q(e, t);
2497
+ let i = "";
2498
+ return e.substring(t, t + 8).toUpperCase() === "#REQUIRED" ? (i = "#REQUIRED", t += 8) : e.substring(t, t + 7).toUpperCase() === "#IMPLIED" ? (i = "#IMPLIED", t += 7) : [t, i] = this.readIdentifierVal(e, t, "ATTLIST"), {
2499
+ elementName: s,
2500
+ attributeName: n,
2501
+ attributeType: o,
2502
+ defaultValue: i,
2503
+ index: t
2504
+ };
2505
+ }
2506
+ }
2507
+ const Q = (r, e) => {
2508
+ for (; e < r.length && /\s/.test(r[e]); )
2509
+ e++;
2510
+ return e;
2511
+ };
2512
+ function ne(r, e, t) {
2513
+ for (let s = 0; s < e.length; s++)
2514
+ if (e[s] !== r[t + s + 1]) return !1;
2515
+ return !0;
2516
+ }
2517
+ function fe(r) {
2518
+ if (ye(r))
2519
+ return r;
2520
+ throw new Error(`Invalid entity name ${r}`);
2521
+ }
2522
+ const fr = /^[-+]?0x[a-fA-F0-9]+$/, hr = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, pr = {
2523
+ hex: !0,
2524
+ // oct: false,
2525
+ leadingZeros: !0,
2526
+ decimalPoint: ".",
2527
+ eNotation: !0
2528
+ //skipLike: /regex/
2529
+ };
2530
+ function gr(r, e = {}) {
2531
+ if (e = Object.assign({}, pr, e), !r || typeof r != "string") return r;
2532
+ let t = r.trim();
2533
+ if (e.skipLike !== void 0 && e.skipLike.test(t)) return r;
2534
+ if (r === "0") return 0;
2535
+ if (e.hex && fr.test(t))
2536
+ return Er(t, 16);
2537
+ if (t.search(/.+[eE].+/) !== -1)
2538
+ return mr(r, t, e);
2539
+ {
2540
+ const s = hr.exec(t);
2541
+ if (s) {
2542
+ const n = s[1] || "", o = s[2];
2543
+ let i = yr(s[3]);
2544
+ const u = n ? (
2545
+ // 0., -00., 000.
2546
+ r[o.length + 1] === "."
2547
+ ) : r[o.length] === ".";
2548
+ if (!e.leadingZeros && (o.length > 1 || o.length === 1 && !u))
2549
+ return r;
2550
+ {
2551
+ const a = Number(t), l = String(a);
2552
+ if (a === 0) return a;
2553
+ if (l.search(/[eE]/) !== -1)
2554
+ return e.eNotation ? a : r;
2555
+ if (t.indexOf(".") !== -1)
2556
+ return l === "0" || l === i || l === `${n}${i}` ? a : r;
2557
+ let h = o ? i : t;
2558
+ return o ? h === l || n + h === l ? a : r : h === l || h === n + l ? a : r;
2559
+ }
2560
+ } else
2561
+ return r;
2562
+ }
2563
+ }
2564
+ const br = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
2565
+ function mr(r, e, t) {
2566
+ if (!t.eNotation) return r;
2567
+ const s = e.match(br);
2568
+ if (s) {
2569
+ let n = s[1] || "";
2570
+ const o = s[3].indexOf("e") === -1 ? "E" : "e", i = s[2], u = n ? (
2571
+ // 0E.
2572
+ r[i.length + 1] === o
2573
+ ) : r[i.length] === o;
2574
+ return i.length > 1 && u ? r : i.length === 1 && (s[3].startsWith(`.${o}`) || s[3][0] === o) ? Number(e) : t.leadingZeros && !u ? (e = (s[1] || "") + s[3], Number(e)) : r;
2575
+ } else
2576
+ return r;
2577
+ }
2578
+ function yr(r) {
2579
+ return r && r.indexOf(".") !== -1 && (r = r.replace(/0+$/, ""), r === "." ? r = "0" : r[0] === "." ? r = "0" + r : r[r.length - 1] === "." && (r = r.substring(0, r.length - 1))), r;
2580
+ }
2581
+ function Er(r, e) {
2582
+ if (parseInt) return parseInt(r, e);
2583
+ if (Number.parseInt) return Number.parseInt(r, e);
2584
+ if (window && window.parseInt) return window.parseInt(r, e);
2585
+ throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
2586
+ }
2587
+ function Qe(r) {
2588
+ return typeof r == "function" ? r : Array.isArray(r) ? (e) => {
2589
+ for (const t of r)
2590
+ if (typeof t == "string" && e === t || t instanceof RegExp && t.test(e))
2591
+ return !0;
2592
+ } : () => !1;
2593
+ }
2594
+ class vr {
2595
+ constructor(e) {
2596
+ this.options = e, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
2597
+ apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
2598
+ gt: { regex: /&(gt|#62|#x3E);/g, val: ">" },
2599
+ lt: { regex: /&(lt|#60|#x3C);/g, val: "<" },
2600
+ quot: { regex: /&(quot|#34|#x22);/g, val: '"' }
2601
+ }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = {
2602
+ space: { regex: /&(nbsp|#160);/g, val: " " },
2603
+ // "lt" : { regex: /&(lt|#60);/g, val: "<" },
2604
+ // "gt" : { regex: /&(gt|#62);/g, val: ">" },
2605
+ // "amp" : { regex: /&(amp|#38);/g, val: "&" },
2606
+ // "quot" : { regex: /&(quot|#34);/g, val: "\"" },
2607
+ // "apos" : { regex: /&(apos|#39);/g, val: "'" },
2608
+ cent: { regex: /&(cent|#162);/g, val: "¢" },
2609
+ pound: { regex: /&(pound|#163);/g, val: "£" },
2610
+ yen: { regex: /&(yen|#165);/g, val: "¥" },
2611
+ euro: { regex: /&(euro|#8364);/g, val: "€" },
2612
+ copyright: { regex: /&(copy|#169);/g, val: "©" },
2613
+ reg: { regex: /&(reg|#174);/g, val: "®" },
2614
+ inr: { regex: /&(inr|#8377);/g, val: "₹" },
2615
+ num_dec: { regex: /&#([0-9]{1,7});/g, val: (t, s) => String.fromCodePoint(Number.parseInt(s, 10)) },
2616
+ num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t, s) => String.fromCodePoint(Number.parseInt(s, 16)) }
2617
+ }, this.addExternalEntities = _r, this.parseXml = Ar, this.parseTextData = xr, this.resolveNameSpace = Nr, this.buildAttributesMap = wr, this.isItStopNode = Pr, this.replaceEntitiesValue = Or, this.readStopNodeData = Ir, this.saveTextToParentTag = Tr, this.addChild = Cr, this.ignoreAttributesFn = Qe(this.options.ignoreAttributes);
2618
+ }
2619
+ }
2620
+ function _r(r) {
2621
+ const e = Object.keys(r);
2622
+ for (let t = 0; t < e.length; t++) {
2623
+ const s = e[t];
2624
+ this.lastEntities[s] = {
2625
+ regex: new RegExp("&" + s + ";", "g"),
2626
+ val: r[s]
2627
+ };
2628
+ }
2629
+ }
2630
+ function xr(r, e, t, s, n, o, i) {
2631
+ if (r !== void 0 && (this.options.trimValues && !s && (r = r.trim()), r.length > 0)) {
2632
+ i || (r = this.replaceEntitiesValue(r));
2633
+ const u = this.options.tagValueProcessor(e, r, t, n, o);
2634
+ return u == null ? r : typeof u != typeof r || u !== r ? u : this.options.trimValues ? Ae(r, this.options.parseTagValue, this.options.numberParseOptions) : r.trim() === r ? Ae(r, this.options.parseTagValue, this.options.numberParseOptions) : r;
2635
+ }
2636
+ }
2637
+ function Nr(r) {
2638
+ if (this.options.removeNSPrefix) {
2639
+ const e = r.split(":"), t = r.charAt(0) === "/" ? "/" : "";
2640
+ if (e[0] === "xmlns")
2641
+ return "";
2642
+ e.length === 2 && (r = t + e[1]);
2643
+ }
2644
+ return r;
2645
+ }
2646
+ const kr = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
2647
+ function wr(r, e, t) {
2648
+ if (this.options.ignoreAttributes !== !0 && typeof r == "string") {
2649
+ const s = Ye(r, kr), n = s.length, o = {};
2650
+ for (let i = 0; i < n; i++) {
2651
+ const u = this.resolveNameSpace(s[i][1]);
2652
+ if (this.ignoreAttributesFn(u, e))
2653
+ continue;
2654
+ let a = s[i][4], l = this.options.attributeNamePrefix + u;
2655
+ if (u.length)
2656
+ if (this.options.transformAttributeName && (l = this.options.transformAttributeName(l)), l === "__proto__" && (l = "#__proto__"), a !== void 0) {
2657
+ this.options.trimValues && (a = a.trim()), a = this.replaceEntitiesValue(a);
2658
+ const h = this.options.attributeValueProcessor(u, a, e);
2659
+ h == null ? o[l] = a : typeof h != typeof a || h !== a ? o[l] = h : o[l] = Ae(
2660
+ a,
2661
+ this.options.parseAttributeValue,
2662
+ this.options.numberParseOptions
2663
+ );
2664
+ } else this.options.allowBooleanAttributes && (o[l] = !0);
2665
+ }
2666
+ if (!Object.keys(o).length)
2667
+ return;
2668
+ if (this.options.attributesGroupName) {
2669
+ const i = {};
2670
+ return i[this.options.attributesGroupName] = o, i;
2671
+ }
2672
+ return o;
2673
+ }
2674
+ }
2675
+ const Ar = function(r) {
2676
+ r = r.replace(/\r\n?/g, `
2677
+ `);
2678
+ const e = new se("!xml");
2679
+ let t = e, s = "", n = "";
2680
+ const o = new dr(this.options.processEntities);
2681
+ for (let i = 0; i < r.length; i++)
2682
+ if (r[i] === "<")
2683
+ if (r[i + 1] === "/") {
2684
+ const a = oe(r, ">", i, "Closing Tag is not closed.");
2685
+ let l = r.substring(i + 2, a).trim();
2686
+ if (this.options.removeNSPrefix) {
2687
+ const y = l.indexOf(":");
2688
+ y !== -1 && (l = l.substr(y + 1));
2689
+ }
2690
+ this.options.transformTagName && (l = this.options.transformTagName(l)), t && (s = this.saveTextToParentTag(s, t, n));
2691
+ const h = n.substring(n.lastIndexOf(".") + 1);
2692
+ if (l && this.options.unpairedTags.indexOf(l) !== -1)
2693
+ throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);
2694
+ let f = 0;
2695
+ h && this.options.unpairedTags.indexOf(h) !== -1 ? (f = n.lastIndexOf(".", n.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : f = n.lastIndexOf("."), n = n.substring(0, f), t = this.tagsNodeStack.pop(), s = "", i = a;
2696
+ } else if (r[i + 1] === "?") {
2697
+ let a = we(r, i, !1, "?>");
2698
+ if (!a) throw new Error("Pi Tag is not closed.");
2699
+ if (s = this.saveTextToParentTag(s, t, n), !(this.options.ignoreDeclaration && a.tagName === "?xml" || this.options.ignorePiTags)) {
2700
+ const l = new se(a.tagName);
2701
+ l.add(this.options.textNodeName, ""), a.tagName !== a.tagExp && a.attrExpPresent && (l[":@"] = this.buildAttributesMap(a.tagExp, n, a.tagName)), this.addChild(t, l, n, i);
2702
+ }
2703
+ i = a.closeIndex + 1;
2704
+ } else if (r.substr(i + 1, 3) === "!--") {
2705
+ const a = oe(r, "-->", i + 4, "Comment is not closed.");
2706
+ if (this.options.commentPropName) {
2707
+ const l = r.substring(i + 4, a - 2);
2708
+ s = this.saveTextToParentTag(s, t, n), t.add(this.options.commentPropName, [{ [this.options.textNodeName]: l }]);
2709
+ }
2710
+ i = a;
2711
+ } else if (r.substr(i + 1, 2) === "!D") {
2712
+ const a = o.readDocType(r, i);
2713
+ this.docTypeEntities = a.entities, i = a.i;
2714
+ } else if (r.substr(i + 1, 2) === "![") {
2715
+ const a = oe(r, "]]>", i, "CDATA is not closed.") - 2, l = r.substring(i + 9, a);
2716
+ s = this.saveTextToParentTag(s, t, n);
2717
+ let h = this.parseTextData(l, t.tagname, n, !0, !1, !0, !0);
2718
+ h == null && (h = ""), this.options.cdataPropName ? t.add(this.options.cdataPropName, [{ [this.options.textNodeName]: l }]) : t.add(this.options.textNodeName, h), i = a + 2;
2719
+ } else {
2720
+ let a = we(r, i, this.options.removeNSPrefix), l = a.tagName;
2721
+ const h = a.rawTagName;
2722
+ let f = a.tagExp, y = a.attrExpPresent, m = a.closeIndex;
2723
+ this.options.transformTagName && (l = this.options.transformTagName(l)), t && s && t.tagname !== "!xml" && (s = this.saveTextToParentTag(s, t, n, !1));
2724
+ const C = t;
2725
+ C && this.options.unpairedTags.indexOf(C.tagname) !== -1 && (t = this.tagsNodeStack.pop(), n = n.substring(0, n.lastIndexOf("."))), l !== e.tagname && (n += n ? "." + l : l);
2726
+ const O = i;
2727
+ if (this.isItStopNode(this.options.stopNodes, n, l)) {
2728
+ let P = "";
2729
+ if (f.length > 0 && f.lastIndexOf("/") === f.length - 1)
2730
+ l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), n = n.substr(0, n.length - 1), f = l) : f = f.substr(0, f.length - 1), i = a.closeIndex;
2731
+ else if (this.options.unpairedTags.indexOf(l) !== -1)
2732
+ i = a.closeIndex;
2733
+ else {
2734
+ const k = this.readStopNodeData(r, h, m + 1);
2735
+ if (!k) throw new Error(`Unexpected end of ${h}`);
2736
+ i = k.i, P = k.tagContent;
2737
+ }
2738
+ const M = new se(l);
2739
+ l !== f && y && (M[":@"] = this.buildAttributesMap(f, n, l)), P && (P = this.parseTextData(P, l, n, !0, y, !0, !0)), n = n.substr(0, n.lastIndexOf(".")), M.add(this.options.textNodeName, P), this.addChild(t, M, n, O);
2740
+ } else {
2741
+ if (f.length > 0 && f.lastIndexOf("/") === f.length - 1) {
2742
+ l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), n = n.substr(0, n.length - 1), f = l) : f = f.substr(0, f.length - 1), this.options.transformTagName && (l = this.options.transformTagName(l));
2743
+ const P = new se(l);
2744
+ l !== f && y && (P[":@"] = this.buildAttributesMap(f, n, l)), this.addChild(t, P, n, O), n = n.substr(0, n.lastIndexOf("."));
2745
+ } else {
2746
+ const P = new se(l);
2747
+ this.tagsNodeStack.push(t), l !== f && y && (P[":@"] = this.buildAttributesMap(f, n, l)), this.addChild(t, P, n, O), t = P;
2748
+ }
2749
+ s = "", i = m;
2750
+ }
2751
+ }
2752
+ else
2753
+ s += r[i];
2754
+ return e.child;
2755
+ };
2756
+ function Cr(r, e, t, s) {
2757
+ this.options.captureMetaData || (s = void 0);
2758
+ const n = this.options.updateTag(e.tagname, t, e[":@"]);
2759
+ n === !1 || (typeof n == "string" && (e.tagname = n), r.addChild(e, s));
2760
+ }
2761
+ const Or = function(r) {
2762
+ if (this.options.processEntities) {
2763
+ for (let e in this.docTypeEntities) {
2764
+ const t = this.docTypeEntities[e];
2765
+ r = r.replace(t.regx, t.val);
2766
+ }
2767
+ for (let e in this.lastEntities) {
2768
+ const t = this.lastEntities[e];
2769
+ r = r.replace(t.regex, t.val);
2770
+ }
2771
+ if (this.options.htmlEntities)
2772
+ for (let e in this.htmlEntities) {
2773
+ const t = this.htmlEntities[e];
2774
+ r = r.replace(t.regex, t.val);
2775
+ }
2776
+ r = r.replace(this.ampEntity.regex, this.ampEntity.val);
2777
+ }
2778
+ return r;
2779
+ };
2780
+ function Tr(r, e, t, s) {
2781
+ return r && (s === void 0 && (s = e.child.length === 0), r = this.parseTextData(
2782
+ r,
2783
+ e.tagname,
2784
+ t,
2785
+ !1,
2786
+ e[":@"] ? Object.keys(e[":@"]).length !== 0 : !1,
2787
+ s
2788
+ ), r !== void 0 && r !== "" && e.add(this.options.textNodeName, r), r = ""), r;
2789
+ }
2790
+ function Pr(r, e, t) {
2791
+ const s = "*." + t;
2792
+ for (const n in r) {
2793
+ const o = r[n];
2794
+ if (s === o || e === o) return !0;
2795
+ }
2796
+ return !1;
2797
+ }
2798
+ function Sr(r, e, t = ">") {
2799
+ let s, n = "";
2800
+ for (let o = e; o < r.length; o++) {
2801
+ let i = r[o];
2802
+ if (s)
2803
+ i === s && (s = "");
2804
+ else if (i === '"' || i === "'")
2805
+ s = i;
2806
+ else if (i === t[0])
2807
+ if (t[1]) {
2808
+ if (r[o + 1] === t[1])
2809
+ return {
2810
+ data: n,
2811
+ index: o
2812
+ };
2813
+ } else
2814
+ return {
2815
+ data: n,
2816
+ index: o
2817
+ };
2818
+ else i === " " && (i = " ");
2819
+ n += i;
2820
+ }
2821
+ }
2822
+ function oe(r, e, t, s) {
2823
+ const n = r.indexOf(e, t);
2824
+ if (n === -1)
2825
+ throw new Error(s);
2826
+ return n + e.length - 1;
2827
+ }
2828
+ function we(r, e, t, s = ">") {
2829
+ const n = Sr(r, e + 1, s);
2830
+ if (!n) return;
2831
+ let o = n.data;
2832
+ const i = n.index, u = o.search(/\s/);
2833
+ let a = o, l = !0;
2834
+ u !== -1 && (a = o.substring(0, u), o = o.substring(u + 1).trimStart());
2835
+ const h = a;
2836
+ if (t) {
2837
+ const f = a.indexOf(":");
2838
+ f !== -1 && (a = a.substr(f + 1), l = a !== n.data.substr(f + 1));
2839
+ }
2840
+ return {
2841
+ tagName: a,
2842
+ tagExp: o,
2843
+ closeIndex: i,
2844
+ attrExpPresent: l,
2845
+ rawTagName: h
2846
+ };
2847
+ }
2848
+ function Ir(r, e, t) {
2849
+ const s = t;
2850
+ let n = 1;
2851
+ for (; t < r.length; t++)
2852
+ if (r[t] === "<")
2853
+ if (r[t + 1] === "/") {
2854
+ const o = oe(r, ">", t, `${e} is not closed`);
2855
+ if (r.substring(t + 2, o).trim() === e && (n--, n === 0))
2856
+ return {
2857
+ tagContent: r.substring(s, t),
2858
+ i: o
2859
+ };
2860
+ t = o;
2861
+ } else if (r[t + 1] === "?")
2862
+ t = oe(r, "?>", t + 1, "StopNode is not closed.");
2863
+ else if (r.substr(t + 1, 3) === "!--")
2864
+ t = oe(r, "-->", t + 3, "StopNode is not closed.");
2865
+ else if (r.substr(t + 1, 2) === "![")
2866
+ t = oe(r, "]]>", t, "StopNode is not closed.") - 2;
2867
+ else {
2868
+ const o = we(r, t, ">");
2869
+ o && ((o && o.tagName) === e && o.tagExp[o.tagExp.length - 1] !== "/" && n++, t = o.closeIndex);
2870
+ }
2871
+ }
2872
+ function Ae(r, e, t) {
2873
+ if (e && typeof r == "string") {
2874
+ const s = r.trim();
2875
+ return s === "true" ? !0 : s === "false" ? !1 : gr(r, t);
2876
+ } else
2877
+ return Jt(r) ? r : "";
2878
+ }
2879
+ const Ne = se.getMetaDataSymbol();
2880
+ function $r(r, e) {
2881
+ return Ge(r, e);
2882
+ }
2883
+ function Ge(r, e, t) {
2884
+ let s;
2885
+ const n = {};
2886
+ for (let o = 0; o < r.length; o++) {
2887
+ const i = r[o], u = Br(i);
2888
+ let a = "";
2889
+ if (t === void 0 ? a = u : a = t + "." + u, u === e.textNodeName)
2890
+ s === void 0 ? s = i[u] : s += "" + i[u];
2891
+ else {
2892
+ if (u === void 0)
2893
+ continue;
2894
+ if (i[u]) {
2895
+ let l = Ge(i[u], e, a);
2896
+ const h = Vr(l, e);
2897
+ i[Ne] !== void 0 && (l[Ne] = i[Ne]), i[":@"] ? Lr(l, i[":@"], a, e) : Object.keys(l).length === 1 && l[e.textNodeName] !== void 0 && !e.alwaysCreateTextNode ? l = l[e.textNodeName] : Object.keys(l).length === 0 && (e.alwaysCreateTextNode ? l[e.textNodeName] = "" : l = ""), n[u] !== void 0 && n.hasOwnProperty(u) ? (Array.isArray(n[u]) || (n[u] = [n[u]]), n[u].push(l)) : e.isArray(u, a, h) ? n[u] = [l] : n[u] = l;
2898
+ }
2899
+ }
2900
+ }
2901
+ return typeof s == "string" ? s.length > 0 && (n[e.textNodeName] = s) : s !== void 0 && (n[e.textNodeName] = s), n;
2902
+ }
2903
+ function Br(r) {
2904
+ const e = Object.keys(r);
2905
+ for (let t = 0; t < e.length; t++) {
2906
+ const s = e[t];
2907
+ if (s !== ":@") return s;
2908
+ }
2909
+ }
2910
+ function Lr(r, e, t, s) {
2911
+ if (e) {
2912
+ const n = Object.keys(e), o = n.length;
2913
+ for (let i = 0; i < o; i++) {
2914
+ const u = n[i];
2915
+ s.isArray(u, t + "." + u, !0, !0) ? r[u] = [e[u]] : r[u] = e[u];
2916
+ }
2917
+ }
2918
+ }
2919
+ function Vr(r, e) {
2920
+ const { textNodeName: t } = e, s = Object.keys(r).length;
2921
+ return !!(s === 0 || s === 1 && (r[t] || typeof r[t] == "boolean" || r[t] === 0));
2922
+ }
2923
+ class Rr {
2924
+ constructor(e) {
2925
+ this.externalEntities = {}, this.options = cr(e);
2926
+ }
2927
+ /**
2928
+ * Parse XML dats to JS object
2929
+ * @param {string|Uint8Array} xmlData
2930
+ * @param {boolean|Object} validationOption
2931
+ */
2932
+ parse(e, t) {
2933
+ if (typeof e != "string" && e.toString)
2934
+ e = e.toString();
2935
+ else if (typeof e != "string")
2936
+ throw new Error("XML data is accepted in String or Bytes[] form.");
2937
+ if (t) {
2938
+ t === !0 && (t = {});
2939
+ const o = qe(e, t);
2940
+ if (o !== !0)
2941
+ throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`);
2942
+ }
2943
+ const s = new vr(this.options);
2944
+ s.addExternalEntities(this.externalEntities);
2945
+ const n = s.parseXml(e);
2946
+ return this.options.preserveOrder || n === void 0 ? n : $r(n, this.options);
2947
+ }
2948
+ /**
2949
+ * Add Entity which is not by default supported by this library
2950
+ * @param {string} key
2951
+ * @param {string} value
2952
+ */
2953
+ addEntity(e, t) {
2954
+ if (t.indexOf("&") !== -1)
2955
+ throw new Error("Entity value can't have '&'");
2956
+ if (e.indexOf("&") !== -1 || e.indexOf(";") !== -1)
2957
+ throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");
2958
+ if (t === "&")
2959
+ throw new Error("An entity with value '&' is not permitted");
2960
+ this.externalEntities[e] = t;
2961
+ }
2962
+ /**
2963
+ * Returns a Symbol that can be used to access the metadata
2964
+ * property on a node.
2965
+ *
2966
+ * If Symbol is not available in the environment, an ordinary property is used
2967
+ * and the name of the property is here returned.
2968
+ *
2969
+ * The XMLMetaData property is only present when `captureMetaData`
2970
+ * is true in the options.
2971
+ */
2972
+ static getMetaDataSymbol() {
2973
+ return se.getMetaDataSymbol();
2974
+ }
2975
+ }
2976
+ const jr = `
2977
+ `;
2978
+ function Mr(r, e) {
2979
+ let t = "";
2980
+ return e.format && e.indentBy.length > 0 && (t = jr), We(r, e, "", t);
2981
+ }
2982
+ function We(r, e, t, s) {
2983
+ let n = "", o = !1;
2984
+ for (let i = 0; i < r.length; i++) {
2985
+ const u = r[i], a = Ur(u);
2986
+ if (a === void 0) continue;
2987
+ let l = "";
2988
+ if (t.length === 0 ? l = a : l = `${t}.${a}`, a === e.textNodeName) {
2989
+ let C = u[a];
2990
+ Fr(l, e) || (C = e.tagValueProcessor(a, C), C = Ze(C, e)), o && (n += s), n += C, o = !1;
2991
+ continue;
2992
+ } else if (a === e.cdataPropName) {
2993
+ o && (n += s), n += `<![CDATA[${u[a][0][e.textNodeName]}]]>`, o = !1;
2994
+ continue;
2995
+ } else if (a === e.commentPropName) {
2996
+ n += s + `<!--${u[a][0][e.textNodeName]}-->`, o = !0;
2997
+ continue;
2998
+ } else if (a[0] === "?") {
2999
+ const C = Re(u[":@"], e), O = a === "?xml" ? "" : s;
3000
+ let P = u[a][0][e.textNodeName];
3001
+ P = P.length !== 0 ? " " + P : "", n += O + `<${a}${P}${C}?>`, o = !0;
3002
+ continue;
3003
+ }
3004
+ let h = s;
3005
+ h !== "" && (h += e.indentBy);
3006
+ const f = Re(u[":@"], e), y = s + `<${a}${f}`, m = We(u[a], e, l, h);
3007
+ e.unpairedTags.indexOf(a) !== -1 ? e.suppressUnpairedNode ? n += y + ">" : n += y + "/>" : (!m || m.length === 0) && e.suppressEmptyNode ? n += y + "/>" : m && m.endsWith(">") ? n += y + `>${m}${s}</${a}>` : (n += y + ">", m && s !== "" && (m.includes("/>") || m.includes("</")) ? n += s + e.indentBy + m + s : n += m, n += `</${a}>`), o = !0;
3008
+ }
3009
+ return n;
3010
+ }
3011
+ function Ur(r) {
3012
+ const e = Object.keys(r);
3013
+ for (let t = 0; t < e.length; t++) {
3014
+ const s = e[t];
3015
+ if (r.hasOwnProperty(s) && s !== ":@")
3016
+ return s;
3017
+ }
3018
+ }
3019
+ function Re(r, e) {
3020
+ let t = "";
3021
+ if (r && !e.ignoreAttributes)
3022
+ for (let s in r) {
3023
+ if (!r.hasOwnProperty(s)) continue;
3024
+ let n = e.attributeValueProcessor(s, r[s]);
3025
+ n = Ze(n, e), n === !0 && e.suppressBooleanAttributes ? t += ` ${s.substr(e.attributeNamePrefix.length)}` : t += ` ${s.substr(e.attributeNamePrefix.length)}="${n}"`;
3026
+ }
3027
+ return t;
3028
+ }
3029
+ function Fr(r, e) {
3030
+ r = r.substr(0, r.length - e.textNodeName.length - 1);
3031
+ let t = r.substr(r.lastIndexOf(".") + 1);
3032
+ for (let s in e.stopNodes)
3033
+ if (e.stopNodes[s] === r || e.stopNodes[s] === "*." + t) return !0;
3034
+ return !1;
3035
+ }
3036
+ function Ze(r, e) {
3037
+ if (r && r.length > 0 && e.processEntities)
3038
+ for (let t = 0; t < e.entities.length; t++) {
3039
+ const s = e.entities[t];
3040
+ r = r.replace(s.regex, s.val);
3041
+ }
3042
+ return r;
3043
+ }
3044
+ const Xr = {
3045
+ attributeNamePrefix: "@_",
3046
+ attributesGroupName: !1,
3047
+ textNodeName: "#text",
3048
+ ignoreAttributes: !0,
3049
+ cdataPropName: !1,
3050
+ format: !1,
3051
+ indentBy: " ",
3052
+ suppressEmptyNode: !1,
3053
+ suppressUnpairedNode: !0,
3054
+ suppressBooleanAttributes: !0,
3055
+ tagValueProcessor: function(r, e) {
3056
+ return e;
3057
+ },
3058
+ attributeValueProcessor: function(r, e) {
3059
+ return e;
3060
+ },
3061
+ preserveOrder: !1,
3062
+ commentPropName: !1,
3063
+ unpairedTags: [],
3064
+ entities: [
3065
+ { regex: new RegExp("&", "g"), val: "&amp;" },
3066
+ //it must be on top
3067
+ { regex: new RegExp(">", "g"), val: "&gt;" },
3068
+ { regex: new RegExp("<", "g"), val: "&lt;" },
3069
+ { regex: new RegExp("'", "g"), val: "&apos;" },
3070
+ { regex: new RegExp('"', "g"), val: "&quot;" }
3071
+ ],
3072
+ processEntities: !0,
3073
+ stopNodes: [],
3074
+ // transformTagName: false,
3075
+ // transformAttributeName: false,
3076
+ oneListGroup: !1
3077
+ };
3078
+ function re(r) {
3079
+ this.options = Object.assign({}, Xr, r), this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
3080
+ return !1;
3081
+ } : (this.ignoreAttributesFn = Qe(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = Yr), this.processTextOrObjNode = Hr, this.options.format ? (this.indentate = Kr, this.tagEndChar = `>
3082
+ `, this.newLine = `
3083
+ `) : (this.indentate = function() {
3084
+ return "";
3085
+ }, this.tagEndChar = ">", this.newLine = "");
3086
+ }
3087
+ re.prototype.build = function(r) {
3088
+ return this.options.preserveOrder ? Mr(r, this.options) : (Array.isArray(r) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (r = {
3089
+ [this.options.arrayNodeName]: r
3090
+ }), this.j2x(r, 0, []).val);
3091
+ };
3092
+ re.prototype.j2x = function(r, e, t) {
3093
+ let s = "", n = "";
3094
+ const o = t.join(".");
3095
+ for (let i in r)
3096
+ if (Object.prototype.hasOwnProperty.call(r, i))
3097
+ if (typeof r[i] > "u")
3098
+ this.isAttribute(i) && (n += "");
3099
+ else if (r[i] === null)
3100
+ this.isAttribute(i) || i === this.options.cdataPropName ? n += "" : i[0] === "?" ? n += this.indentate(e) + "<" + i + "?" + this.tagEndChar : n += this.indentate(e) + "<" + i + "/" + this.tagEndChar;
3101
+ else if (r[i] instanceof Date)
3102
+ n += this.buildTextValNode(r[i], i, "", e);
3103
+ else if (typeof r[i] != "object") {
3104
+ const u = this.isAttribute(i);
3105
+ if (u && !this.ignoreAttributesFn(u, o))
3106
+ s += this.buildAttrPairStr(u, "" + r[i]);
3107
+ else if (!u)
3108
+ if (i === this.options.textNodeName) {
3109
+ let a = this.options.tagValueProcessor(i, "" + r[i]);
3110
+ n += this.replaceEntitiesValue(a);
3111
+ } else
3112
+ n += this.buildTextValNode(r[i], i, "", e);
3113
+ } else if (Array.isArray(r[i])) {
3114
+ const u = r[i].length;
3115
+ let a = "", l = "";
3116
+ for (let h = 0; h < u; h++) {
3117
+ const f = r[i][h];
3118
+ if (!(typeof f > "u")) if (f === null)
3119
+ i[0] === "?" ? n += this.indentate(e) + "<" + i + "?" + this.tagEndChar : n += this.indentate(e) + "<" + i + "/" + this.tagEndChar;
3120
+ else if (typeof f == "object")
3121
+ if (this.options.oneListGroup) {
3122
+ const y = this.j2x(f, e + 1, t.concat(i));
3123
+ a += y.val, this.options.attributesGroupName && f.hasOwnProperty(this.options.attributesGroupName) && (l += y.attrStr);
3124
+ } else
3125
+ a += this.processTextOrObjNode(f, i, e, t);
3126
+ else if (this.options.oneListGroup) {
3127
+ let y = this.options.tagValueProcessor(i, f);
3128
+ y = this.replaceEntitiesValue(y), a += y;
3129
+ } else
3130
+ a += this.buildTextValNode(f, i, "", e);
3131
+ }
3132
+ this.options.oneListGroup && (a = this.buildObjectNode(a, i, l, e)), n += a;
3133
+ } else if (this.options.attributesGroupName && i === this.options.attributesGroupName) {
3134
+ const u = Object.keys(r[i]), a = u.length;
3135
+ for (let l = 0; l < a; l++)
3136
+ s += this.buildAttrPairStr(u[l], "" + r[i][u[l]]);
3137
+ } else
3138
+ n += this.processTextOrObjNode(r[i], i, e, t);
3139
+ return { attrStr: s, val: n };
3140
+ };
3141
+ re.prototype.buildAttrPairStr = function(r, e) {
3142
+ return e = this.options.attributeValueProcessor(r, "" + e), e = this.replaceEntitiesValue(e), this.options.suppressBooleanAttributes && e === "true" ? " " + r : " " + r + '="' + e + '"';
3143
+ };
3144
+ function Hr(r, e, t, s) {
3145
+ const n = this.j2x(r, t + 1, s.concat(e));
3146
+ return r[this.options.textNodeName] !== void 0 && Object.keys(r).length === 1 ? this.buildTextValNode(r[this.options.textNodeName], e, n.attrStr, t) : this.buildObjectNode(n.val, e, n.attrStr, t);
3147
+ }
3148
+ re.prototype.buildObjectNode = function(r, e, t, s) {
3149
+ if (r === "")
3150
+ return e[0] === "?" ? this.indentate(s) + "<" + e + t + "?" + this.tagEndChar : this.indentate(s) + "<" + e + t + this.closeTag(e) + this.tagEndChar;
3151
+ {
3152
+ let n = "</" + e + this.tagEndChar, o = "";
3153
+ return e[0] === "?" && (o = "?", n = ""), (t || t === "") && r.indexOf("<") === -1 ? this.indentate(s) + "<" + e + t + o + ">" + r + n : this.options.commentPropName !== !1 && e === this.options.commentPropName && o.length === 0 ? this.indentate(s) + `<!--${r}-->` + this.newLine : this.indentate(s) + "<" + e + t + o + this.tagEndChar + r + this.indentate(s) + n;
3154
+ }
3155
+ };
3156
+ re.prototype.closeTag = function(r) {
3157
+ let e = "";
3158
+ return this.options.unpairedTags.indexOf(r) !== -1 ? this.options.suppressUnpairedNode || (e = "/") : this.options.suppressEmptyNode ? e = "/" : e = `></${r}`, e;
3159
+ };
3160
+ re.prototype.buildTextValNode = function(r, e, t, s) {
3161
+ if (this.options.cdataPropName !== !1 && e === this.options.cdataPropName)
3162
+ return this.indentate(s) + `<![CDATA[${r}]]>` + this.newLine;
3163
+ if (this.options.commentPropName !== !1 && e === this.options.commentPropName)
3164
+ return this.indentate(s) + `<!--${r}-->` + this.newLine;
3165
+ if (e[0] === "?")
3166
+ return this.indentate(s) + "<" + e + t + "?" + this.tagEndChar;
3167
+ {
3168
+ let n = this.options.tagValueProcessor(e, r);
3169
+ return n = this.replaceEntitiesValue(n), n === "" ? this.indentate(s) + "<" + e + t + this.closeTag(e) + this.tagEndChar : this.indentate(s) + "<" + e + t + ">" + n + "</" + e + this.tagEndChar;
3170
+ }
3171
+ };
3172
+ re.prototype.replaceEntitiesValue = function(r) {
3173
+ if (r && r.length > 0 && this.options.processEntities)
3174
+ for (let e = 0; e < this.options.entities.length; e++) {
3175
+ const t = this.options.entities[e];
3176
+ r = r.replace(t.regex, t.val);
3177
+ }
3178
+ return r;
3179
+ };
3180
+ function Kr(r) {
3181
+ return this.options.indentBy.repeat(r);
3182
+ }
3183
+ function Yr(r) {
3184
+ return r.startsWith(this.options.attributeNamePrefix) && r !== this.options.textNodeName ? r.substr(this.attrPrefixLen) : !1;
3185
+ }
3186
+ const qr = {
3187
+ validate: qe
3188
+ }, Qr = {
3189
+ ignoreAttributes: !1,
3190
+ // 保留属性
3191
+ attributeNamePrefix: "@_",
3192
+ // 属性前缀
3193
+ textNodeName: "#text",
3194
+ // 文本节点名
3195
+ ignoreDeclaration: !1,
3196
+ // 保留 XML 声明
3197
+ commentPropName: "#comment",
3198
+ // 注释属性名
3199
+ cdataPropName: "__cdata",
3200
+ // CDATA 属性名
3201
+ preserveOrder: !1,
3202
+ // 不保留顺序(使用对象结构)
3203
+ parseAttributeValue: !1,
3204
+ // 不解析属性值(保持字符串)
3205
+ trimValues: !0,
3206
+ // 去除首尾空白
3207
+ parseTagValue: !1,
3208
+ // 不解析标签值(保持字符串)
3209
+ processEntities: !0,
3210
+ // 处理实体
3211
+ htmlEntities: !1,
3212
+ // 不是 HTML 实体
3213
+ ignoreNameSpace: !1,
3214
+ // 保留命名空间
3215
+ allowBooleanAttributes: !0,
3216
+ // 允许布尔属性
3217
+ unpairedTags: [],
3218
+ // 未配对的标签
3219
+ stopNodes: [],
3220
+ // 停止解析的节点
3221
+ alwaysCreateTextNode: !1
3222
+ // 仅在有文本时创建文本节点
3223
+ }, Gr = {
3224
+ ignoreAttributes: !1,
3225
+ attributeNamePrefix: "@_",
3226
+ textNodeName: "#text",
3227
+ format: !0,
3228
+ // 格式化输出
3229
+ indentBy: " ",
3230
+ // 缩进 2 空格
3231
+ suppressEmptyNode: !1,
3232
+ // 不抑制空节点
3233
+ suppressBooleanAttributes: !1,
3234
+ suppressUnpairedNode: !1
3235
+ }, Wr = (r) => {
3236
+ try {
3237
+ const e = qr.validate(r, {
3238
+ allowBooleanAttributes: !0
3239
+ });
3240
+ return e === !0 ? { valid: !0 } : {
3241
+ valid: !1,
3242
+ error: `Line ${e.err.line}: ${e.err.msg}`
3243
+ };
3244
+ } catch (e) {
3245
+ return {
3246
+ valid: !1,
3247
+ error: e instanceof Error ? e.message : "Unknown validation error"
3248
+ };
3249
+ }
3250
+ }, ze = (r, e) => {
3251
+ try {
3252
+ return new Rr({
3253
+ ...Qr,
3254
+ ...e
3255
+ }).parse(r);
3256
+ } catch (t) {
3257
+ throw new Error(
3258
+ `XML 解析失败: ${t instanceof Error ? t.message : "Unknown error"}`
3259
+ );
3260
+ }
3261
+ }, Te = (r, e) => {
3262
+ try {
3263
+ let s = new re({
3264
+ ...Gr,
3265
+ format: e?.format ?? !0,
3266
+ indentBy: e?.indentBy ?? " "
3267
+ }).build(r);
3268
+ return e?.showDeclaration !== !1 && !s.startsWith("<?xml") && (s = `<?xml version="1.0" encoding="UTF-8"?>
3269
+ ` + s), s;
3270
+ } catch (t) {
3271
+ throw new Error(
3272
+ `XML 构建失败: ${t instanceof Error ? t.message : "Unknown error"}`
3273
+ );
3274
+ }
3275
+ }, Zr = (r) => Te(r, { format: !1, showDeclaration: !1 }), zr = (r, e) => {
3276
+ const t = ze(r);
3277
+ return Te(t, e);
3278
+ }, Dr = (r) => {
3279
+ if (!r || typeof r != "object") return {};
3280
+ const e = {};
3281
+ return Object.keys(r).forEach((t) => {
3282
+ if (t.startsWith("@_")) {
3283
+ const s = t.substring(2);
3284
+ e[s] = r[t];
3285
+ }
3286
+ }), e;
3287
+ }, Jr = (r) => !r || typeof r != "object" ? typeof r == "string" ? r : null : r["#text"] || null, en = {
3288
+ key: 0,
3289
+ class: "xml-node__element"
3290
+ }, tn = {
3291
+ key: 0,
3292
+ class: "xml-node__line"
3293
+ }, rn = { key: 1 }, nn = { class: "xml-node__line" }, sn = ["title"], on = { key: 1 }, an = ["title"], ln = {
3294
+ key: 0,
3295
+ class: "xml-node__children"
3296
+ }, un = {
3297
+ key: 0,
3298
+ class: "xml-node__text"
3299
+ }, cn = {
3300
+ key: 1,
3301
+ class: "xml-node__line"
3302
+ }, dn = {
3303
+ key: 1,
3304
+ class: "xml-node__text"
3305
+ }, fn = {
3306
+ key: 2,
3307
+ class: "xml-node__comment"
3308
+ }, hn = {
3309
+ key: 3,
3310
+ class: "xml-node__cdata"
3311
+ }, pn = /* @__PURE__ */ be({
3312
+ __name: "XmlNode",
3313
+ props: {
3314
+ value: {},
3315
+ tagName: {},
3316
+ level: { default: 0 },
3317
+ path: { default: "" },
3318
+ expanded: {},
3319
+ theme: {}
3320
+ },
3321
+ emits: ["toggle-expand", "copy"],
3322
+ setup(r, { emit: e }) {
3323
+ const t = r, s = e, n = L(() => t.path || t.tagName), o = L(() => t.expanded.has(n.value)), i = L(() => t.tagName && !t.tagName.startsWith("#") && t.tagName !== "__cdata" ? !0 : t.value !== null && typeof t.value == "object"), u = L(() => !t.tagName && typeof t.value == "string"), a = L(() => t.tagName === "#comment"), l = L(() => t.tagName === "__cdata"), h = L(() => i.value ? Dr(t.value) : {}), f = L(() => typeof t.value == "string" ? t.value : i.value ? Jr(t.value) || "" : t.value || ""), y = L(() => t.value || ""), m = L(() => t.value || ""), C = L(() => {
3324
+ if (typeof t.value != "object" || t.value === null)
3325
+ return [];
3326
+ const g = [];
3327
+ return Object.keys(t.value).forEach((T) => {
3328
+ if (T.startsWith("@_") || T === "#text") return;
3329
+ const X = t.value[T];
3330
+ Array.isArray(X) ? X.forEach((j) => {
3331
+ g.push({ tagName: T, value: j });
3332
+ }) : g.push({ tagName: T, value: X });
3333
+ }), g;
3334
+ }), O = L(() => C.value.length > 0 ? !0 : f.value.trim() !== ""), P = L(() => i.value && C.value.length === 0 && f.value.trim() !== ""), M = () => {
3335
+ O.value && s("toggle-expand", n.value);
3336
+ }, k = (g, T) => `${n.value}.${g}[${T}]`, S = (g, T) => `${g.tagName}-${T}`;
3337
+ return (g, T) => {
3338
+ const X = Me("XmlNode", !0);
3339
+ return x(), N("div", {
3340
+ class: "xml-node",
3341
+ style: I({ paddingLeft: g.level > 0 ? "16px" : "0" })
3342
+ }, [
3343
+ i.value ? (x(), N("div", en, [
3344
+ P.value ? (x(), N("div", tn, [
3345
+ E("span", {
3346
+ class: "xml-node__bracket",
3347
+ style: I({ color: g.theme.colors.xmlBracket })
3348
+ }, "<", 4),
3349
+ E("span", {
3350
+ class: "xml-node__tag",
3351
+ style: I({ color: g.theme.colors.xmlTag })
3352
+ }, R(g.tagName), 5),
3353
+ (x(!0), N(he, null, pe(h.value, (j, Y) => (x(), N("span", {
3354
+ key: Y,
3355
+ class: "xml-node__attribute"
3356
+ }, [
3357
+ E("span", {
3358
+ class: "xml-node__attr-name",
3359
+ style: I({ color: g.theme.colors.xmlAttribute })
3360
+ }, R(Y), 5),
3361
+ E("span", {
3362
+ class: "xml-node__equals",
3363
+ style: I({ color: g.theme.colors.xmlEquals })
3364
+ }, "=", 4),
3365
+ E("span", {
3366
+ class: "xml-node__quote",
3367
+ style: I({ color: g.theme.colors.xmlQuote })
3368
+ }, '"', 4),
3369
+ E("span", {
3370
+ class: "xml-node__attr-value",
3371
+ style: I({ color: g.theme.colors.xmlAttributeValue })
3372
+ }, R(j), 5),
3373
+ E("span", {
3374
+ class: "xml-node__quote",
3375
+ style: I({ color: g.theme.colors.xmlQuote })
3376
+ }, '"', 4)
3377
+ ]))), 128)),
3378
+ E("span", {
3379
+ class: "xml-node__bracket",
3380
+ style: I({ color: g.theme.colors.xmlBracket })
3381
+ }, ">", 4),
3382
+ E("span", {
3383
+ class: "xml-node__text-content",
3384
+ style: I({ color: g.theme.colors.xmlText })
3385
+ }, R(f.value), 5),
3386
+ E("span", {
3387
+ class: "xml-node__bracket",
3388
+ style: I({ color: g.theme.colors.xmlBracket })
3389
+ }, "</", 4),
3390
+ E("span", {
3391
+ class: "xml-node__tag",
3392
+ style: I({ color: g.theme.colors.xmlTag })
3393
+ }, R(g.tagName), 5),
3394
+ E("span", {
3395
+ class: "xml-node__bracket",
3396
+ style: I({ color: g.theme.colors.xmlBracket })
3397
+ }, ">", 4)
3398
+ ])) : (x(), N("div", rn, [
3399
+ E("div", nn, [
3400
+ O.value ? (x(), N("span", {
3401
+ key: 0,
3402
+ class: "xml-node__clickable-part",
3403
+ onClick: T[0] || (T[0] = (j) => M()),
3404
+ title: o.value ? "Click to collapse" : "Click to expand"
3405
+ }, [
3406
+ E("span", {
3407
+ class: "xml-node__bracket",
3408
+ style: I({ color: g.theme.colors.xmlBracket })
3409
+ }, "<", 4),
3410
+ E("span", {
3411
+ class: "xml-node__tag",
3412
+ style: I({ color: g.theme.colors.xmlTag })
3413
+ }, R(g.tagName), 5)
3414
+ ], 8, sn)) : (x(), N("span", on, [
3415
+ E("span", {
3416
+ class: "xml-node__bracket",
3417
+ style: I({ color: g.theme.colors.xmlBracket })
3418
+ }, "<", 4),
3419
+ E("span", {
3420
+ class: "xml-node__tag",
3421
+ style: I({ color: g.theme.colors.xmlTag })
3422
+ }, R(g.tagName), 5)
3423
+ ])),
3424
+ (x(!0), N(he, null, pe(h.value, (j, Y) => (x(), N("span", {
3425
+ key: Y,
3426
+ class: "xml-node__attribute"
3427
+ }, [
3428
+ E("span", {
3429
+ class: "xml-node__attr-name",
3430
+ style: I({ color: g.theme.colors.xmlAttribute })
3431
+ }, R(Y), 5),
3432
+ E("span", {
3433
+ class: "xml-node__equals",
3434
+ style: I({ color: g.theme.colors.xmlEquals })
3435
+ }, "=", 4),
3436
+ E("span", {
3437
+ class: "xml-node__quote",
3438
+ style: I({ color: g.theme.colors.xmlQuote })
3439
+ }, '"', 4),
3440
+ E("span", {
3441
+ class: "xml-node__attr-value",
3442
+ style: I({ color: g.theme.colors.xmlAttributeValue })
3443
+ }, R(j), 5),
3444
+ E("span", {
3445
+ class: "xml-node__quote",
3446
+ style: I({ color: g.theme.colors.xmlQuote })
3447
+ }, '"', 4)
3448
+ ]))), 128)),
3449
+ O.value ? (x(), N("span", {
3450
+ key: 2,
3451
+ class: "xml-node__clickable-part",
3452
+ onClick: T[1] || (T[1] = (j) => M()),
3453
+ title: o.value ? "Click to collapse" : "Click to expand"
3454
+ }, [
3455
+ E("span", {
3456
+ class: "xml-node__bracket",
3457
+ style: I({ color: g.theme.colors.xmlBracket })
3458
+ }, ">", 4)
3459
+ ], 8, an)) : (x(), N("span", {
3460
+ key: 3,
3461
+ class: "xml-node__bracket",
3462
+ style: I({ color: g.theme.colors.xmlBracket })
3463
+ }, R(O.value ? ">" : "/>"), 5)),
3464
+ !o.value && O.value ? (x(), N("span", {
3465
+ key: 4,
3466
+ class: "xml-node__collapsed xml-node__collapsed--clickable",
3467
+ style: I({ color: g.theme.colors.textSecondary }),
3468
+ onClick: T[2] || (T[2] = (j) => M()),
3469
+ title: "Click to expand"
3470
+ }, "...", 4)) : F("", !0)
3471
+ ]),
3472
+ o.value && O.value ? (x(), N("div", ln, [
3473
+ C.value.length === 0 && f.value.trim() ? (x(), N("div", un, [
3474
+ E("span", {
3475
+ class: "xml-node__text-content",
3476
+ style: I({ color: g.theme.colors.xmlText })
3477
+ }, R(f.value), 5)
3478
+ ])) : F("", !0),
3479
+ (x(!0), N(he, null, pe(C.value, (j, Y) => (x(), Xe(X, {
3480
+ key: S(j, Y),
3481
+ value: j.value,
3482
+ "tag-name": j.tagName,
3483
+ level: g.level + 1,
3484
+ path: k(j.tagName, Y),
3485
+ expanded: g.expanded,
3486
+ theme: g.theme,
3487
+ onToggleExpand: T[3] || (T[3] = (Z) => g.$emit("toggle-expand", Z)),
3488
+ onCopy: T[4] || (T[4] = (Z) => g.$emit("copy", Z))
3489
+ }, null, 8, ["value", "tag-name", "level", "path", "expanded", "theme"]))), 128))
3490
+ ])) : F("", !0),
3491
+ o.value && O.value ? (x(), N("div", cn, [
3492
+ E("span", {
3493
+ class: "xml-node__clickable-part",
3494
+ onClick: T[5] || (T[5] = (j) => M()),
3495
+ title: "Click to collapse"
3496
+ }, [
3497
+ E("span", {
3498
+ class: "xml-node__bracket",
3499
+ style: I({ color: g.theme.colors.xmlBracket })
3500
+ }, "</", 4),
3501
+ E("span", {
3502
+ class: "xml-node__tag",
3503
+ style: I({ color: g.theme.colors.xmlTag })
3504
+ }, R(g.tagName), 5),
3505
+ E("span", {
3506
+ class: "xml-node__bracket",
3507
+ style: I({ color: g.theme.colors.xmlBracket })
3508
+ }, ">", 4)
3509
+ ])
3510
+ ])) : F("", !0)
3511
+ ]))
3512
+ ])) : u.value ? (x(), N("div", dn, [
3513
+ E("span", {
3514
+ class: "xml-node__text-content",
3515
+ style: I({ color: g.theme.colors.xmlText })
3516
+ }, R(f.value), 5)
3517
+ ])) : a.value ? (x(), N("div", fn, [
3518
+ E("span", {
3519
+ style: I({ color: g.theme.colors.xmlComment })
3520
+ }, " <!-- " + R(y.value) + " --> ", 5)
3521
+ ])) : l.value ? (x(), N("div", hn, [
3522
+ E("span", {
3523
+ style: I({ color: g.theme.colors.xmlCdata })
3524
+ }, " <![CDATA[" + R(m.value) + "]]> ", 5)
3525
+ ])) : F("", !0)
3526
+ ], 4);
3527
+ };
3528
+ }
3529
+ }), gn = /* @__PURE__ */ me(pn, [["__scopeId", "data-v-c3ce3f83"]]), bn = {
3530
+ name: "github-light",
3531
+ colors: {
3532
+ // 背景色
3533
+ background: "#ffffff",
3534
+ surfaceBackground: "#f6f8fa",
3535
+ // 边框色
3536
+ border: "#d0d7de",
3537
+ // 文本色
3538
+ text: "#24292f",
3539
+ textSecondary: "#57606a",
3540
+ // 按钮样式
3541
+ buttonBackground: "#f6f8fa",
3542
+ buttonBackgroundHover: "#f3f4f6",
3543
+ buttonBorder: "#d0d7de",
3544
+ buttonText: "#24292f",
3545
+ buttonPrimary: "#1f883d",
3546
+ buttonPrimaryHover: "#1a7f37",
3547
+ // 状态指示
3548
+ success: "#1f883d",
3549
+ successBackground: "#dafbe1",
3550
+ error: "#cf222e",
3551
+ errorBackground: "#ffebe9",
3552
+ // XML 语法高亮
3553
+ xmlTag: "#116329",
3554
+ // 标签名 - 绿色
3555
+ xmlAttribute: "#0550ae",
3556
+ // 属性名 - 蓝色
3557
+ xmlAttributeValue: "#0a3069",
3558
+ // 属性值 - 深蓝
3559
+ xmlText: "#24292f",
3560
+ // 文本内容 - 黑色
3561
+ xmlComment: "#6e7781",
3562
+ // 注释 - 灰色
3563
+ xmlCdata: "#8250df",
3564
+ // CDATA - 紫色
3565
+ xmlDeclaration: "#953800",
3566
+ // 声明 - 橙色
3567
+ xmlBracket: "#6e7781",
3568
+ // 括号 - 灰色
3569
+ xmlEquals: "#6e7781",
3570
+ // 等号 - 灰色
3571
+ xmlQuote: "#0550ae"
3572
+ // 引号 - 蓝色
3573
+ }
3574
+ }, mn = {
3575
+ name: "github-dark",
3576
+ colors: {
3577
+ // 背景色
3578
+ background: "#0d1117",
3579
+ surfaceBackground: "#161b22",
3580
+ // 边框色
3581
+ border: "#30363d",
3582
+ // 文本色
3583
+ text: "#c9d1d9",
3584
+ textSecondary: "#8b949e",
3585
+ // 按钮样式
3586
+ buttonBackground: "#21262d",
3587
+ buttonBackgroundHover: "#30363d",
3588
+ buttonBorder: "#30363d",
3589
+ buttonText: "#c9d1d9",
3590
+ buttonPrimary: "#238636",
3591
+ buttonPrimaryHover: "#2ea043",
3592
+ // 状态指示
3593
+ success: "#3fb950",
3594
+ successBackground: "#0f2e1c",
3595
+ error: "#f85149",
3596
+ errorBackground: "#3d1319",
3597
+ // XML 语法高亮
3598
+ xmlTag: "#7ee787",
3599
+ // 标签名 - 亮绿色
3600
+ xmlAttribute: "#79c0ff",
3601
+ // 属性名 - 亮蓝色
3602
+ xmlAttributeValue: "#a5d6ff",
3603
+ // 属性值 - 淡蓝色
3604
+ xmlText: "#c9d1d9",
3605
+ // 文本内容 - 白色
3606
+ xmlComment: "#8b949e",
3607
+ // 注释 - 灰色
3608
+ xmlCdata: "#d2a8ff",
3609
+ // CDATA - 紫色
3610
+ xmlDeclaration: "#ffa657",
3611
+ // 声明 - 橙色
3612
+ xmlBracket: "#8b949e",
3613
+ // 括号 - 灰色
3614
+ xmlEquals: "#8b949e",
3615
+ // 等号 - 灰色
3616
+ xmlQuote: "#79c0ff"
3617
+ // 引号 - 亮蓝色
3618
+ }
3619
+ }, yn = {
3620
+ name: "min-light",
3621
+ colors: {
3622
+ // 背景色
3623
+ background: "#ffffff",
3624
+ surfaceBackground: "#fafafa",
3625
+ // 边框色
3626
+ border: "#e5e5e5",
3627
+ // 文本色
3628
+ text: "#171717",
3629
+ textSecondary: "#737373",
3630
+ // 按钮样式
3631
+ buttonBackground: "#fafafa",
3632
+ buttonBackgroundHover: "#f5f5f5",
3633
+ buttonBorder: "#e5e5e5",
3634
+ buttonText: "#171717",
3635
+ buttonPrimary: "#22c55e",
3636
+ buttonPrimaryHover: "#16a34a",
3637
+ // 状态指示
3638
+ success: "#22c55e",
3639
+ successBackground: "#dcfce7",
3640
+ error: "#ef4444",
3641
+ errorBackground: "#fee2e2",
3642
+ // XML 语法高亮
3643
+ xmlTag: "#16a34a",
3644
+ // 标签名 - 绿色
3645
+ xmlAttribute: "#2563eb",
3646
+ // 属性名 - 蓝色
3647
+ xmlAttributeValue: "#1e40af",
3648
+ // 属性值 - 深蓝
3649
+ xmlText: "#171717",
3650
+ // 文本内容 - 黑色
3651
+ xmlComment: "#737373",
3652
+ // 注释 - 灰色
3653
+ xmlCdata: "#9333ea",
3654
+ // CDATA - 紫色
3655
+ xmlDeclaration: "#ea580c",
3656
+ // 声明 - 橙色
3657
+ xmlBracket: "#737373",
3658
+ // 括号 - 灰色
3659
+ xmlEquals: "#737373",
3660
+ // 等号 - 灰色
3661
+ xmlQuote: "#2563eb"
3662
+ // 引号 - 蓝色
3663
+ }
3664
+ }, En = {
3665
+ name: "slack-ochin",
3666
+ colors: {
3667
+ // 背景色
3668
+ background: "#fef5ed",
3669
+ surfaceBackground: "#fef9f3",
3670
+ // 边框色
3671
+ border: "#e9dcc9",
3672
+ // 文本色
3673
+ text: "#3d3c40",
3674
+ textSecondary: "#616061",
3675
+ // 按钮样式
3676
+ buttonBackground: "#fef9f3",
3677
+ buttonBackgroundHover: "#f9f0e5",
3678
+ buttonBorder: "#e9dcc9",
3679
+ buttonText: "#3d3c40",
3680
+ buttonPrimary: "#007a5a",
3681
+ buttonPrimaryHover: "#006644",
3682
+ // 状态指示
3683
+ success: "#007a5a",
3684
+ successBackground: "#d1f4e0",
3685
+ error: "#e01e5a",
3686
+ errorBackground: "#ffdbea",
3687
+ // XML 语法高亮
3688
+ xmlTag: "#007a5a",
3689
+ // 标签名 - 绿色
3690
+ xmlAttribute: "#1264a3",
3691
+ // 属性名 - 蓝色
3692
+ xmlAttributeValue: "#0b4c8c",
3693
+ // 属性值 - 深蓝
3694
+ xmlText: "#3d3c40",
3695
+ // 文本内容 - 黑色
3696
+ xmlComment: "#616061",
3697
+ // 注释 - 灰色
3698
+ xmlCdata: "#8b2eff",
3699
+ // CDATA - 紫色
3700
+ xmlDeclaration: "#e8912d",
3701
+ // 声明 - 橙色
3702
+ xmlBracket: "#616061",
3703
+ // 括号 - 灰色
3704
+ xmlEquals: "#616061",
3705
+ // 等号 - 灰色
3706
+ xmlQuote: "#1264a3"
3707
+ // 引号 - 蓝色
3708
+ }
3709
+ }, je = {
3710
+ "github-light": bn,
3711
+ "github-dark": mn,
3712
+ "min-light": yn,
3713
+ "slack-ochin": En
3714
+ }, vn = (r) => je[r] || je["github-light"], _n = {
3715
+ key: 0,
3716
+ class: "xml-format__toolbar"
3717
+ }, xn = { class: "xml-format__actions" }, Nn = ["disabled"], kn = ["disabled"], wn = ["disabled"], An = ["disabled"], Cn = ["disabled"], On = { class: "xml-format__info" }, Tn = {
3718
+ key: 0,
3719
+ class: "xml-format__status xml-format__status--success"
3720
+ }, Pn = {
3721
+ key: 1,
3722
+ class: "xml-format__status xml-format__status--error"
3723
+ }, Sn = { class: "xml-format__content" }, In = {
3724
+ key: 0,
3725
+ class: "xml-format__error"
3726
+ }, $n = {
3727
+ key: 1,
3728
+ class: "xml-format__viewer"
3729
+ }, Bn = /* @__PURE__ */ be({
3730
+ __name: "index",
3731
+ props: {
3732
+ modelValue: { default: "" },
3733
+ readonly: { type: Boolean, default: !1 },
3734
+ maxDepth: { default: 10 },
3735
+ showToolbar: { type: Boolean, default: !0 },
3736
+ theme: { default: "github-light" },
3737
+ showComments: { type: Boolean, default: !0 },
3738
+ showCdata: { type: Boolean, default: !0 },
3739
+ preserveWhitespace: { type: Boolean, default: !1 }
3740
+ },
3741
+ emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress", "format"],
3742
+ setup(r, { emit: e }) {
3743
+ Ce((k) => ({
3744
+ "5da93aa4": a.value.colors.border,
3745
+ "138f9aa0": a.value.colors.background,
3746
+ "9abf940e": a.value.colors.surfaceBackground,
3747
+ "78705f00": a.value.colors.buttonBorder,
3748
+ "3f22b602": a.value.colors.buttonBackground,
3749
+ "5afed501": a.value.colors.buttonText,
3750
+ "7fb3945a": a.value.colors.buttonBackgroundHover,
3751
+ "7ed67dae": a.value.colors.buttonPrimary,
3752
+ "5c748fa4": a.value.colors.buttonPrimaryHover,
3753
+ "3e17bc7e": a.value.colors.success,
3754
+ "22d3d5cf": a.value.colors.successBackground,
3755
+ "0f2d0b46": a.value.colors.error,
3756
+ "6c8e5d14": a.value.colors.errorBackground,
3757
+ "7c62ec2f": a.value.colors.text
3758
+ }));
3759
+ const t = r, s = e, n = G(null), o = G(""), i = G(/* @__PURE__ */ new Set()), u = L(() => o.value === ""), a = L(() => vn(t.theme)), l = L(() => {
3760
+ if (!n.value) return {};
3761
+ const k = {};
3762
+ return Object.keys(n.value).forEach((S) => {
3763
+ !S.startsWith("?") && !S.startsWith("#") && (k[S] = n.value[S]);
3764
+ }), k;
3765
+ }), h = (k) => {
3766
+ if (!k || !k.trim()) {
3767
+ o.value = "XML string is empty", n.value = null;
3768
+ return;
3769
+ }
3770
+ try {
3771
+ const S = Wr(k);
3772
+ if (!S.valid) {
3773
+ o.value = S.error || "Invalid XML", n.value = null;
3774
+ return;
3775
+ }
3776
+ n.value = ze(k), o.value = "", ce(() => {
3777
+ Object.keys(l.value).forEach((g) => {
3778
+ i.value.add(g);
3779
+ });
3780
+ });
3781
+ } catch (S) {
3782
+ o.value = S instanceof Error ? S.message : "Unknown parse error", n.value = null;
3783
+ }
3784
+ }, f = (k) => {
3785
+ i.value.has(k) ? i.value.delete(k) : i.value.add(k);
3786
+ }, y = () => {
3787
+ const k = /* @__PURE__ */ new Set(), S = (g, T = "") => {
3788
+ g !== null && typeof g == "object" && (T && k.add(T), Object.keys(g).forEach((X) => {
3789
+ if (X.startsWith("@_") || X === "#text") return;
3790
+ const j = g[X], Y = T ? `${T}.${X}[0]` : X;
3791
+ Array.isArray(j) ? j.forEach((Z, D) => {
3792
+ const J = T ? `${T}.${X}[${D}]` : `${X}[${D}]`;
3793
+ S(Z, J);
3794
+ }) : S(j, Y);
3795
+ }));
3796
+ };
3797
+ Object.keys(l.value).forEach((g) => {
3798
+ S(l.value[g], g);
3799
+ }), i.value = k, s("expand-all");
3800
+ }, m = () => {
3801
+ i.value.clear(), s("collapse-all");
3802
+ }, C = async () => {
3803
+ if (!(!u.value || !n.value))
3804
+ try {
3805
+ const k = Te(n.value, {
3806
+ format: !0,
3807
+ indentBy: " "
3808
+ });
3809
+ await navigator.clipboard.writeText(k), s("copy-success", k);
3810
+ } catch (k) {
3811
+ const S = k instanceof Error ? k : new Error("Copy failed");
3812
+ s("copy-error", S), console.error("Failed to copy XML:", k);
3813
+ }
3814
+ }, O = () => {
3815
+ if (!(!u.value || !n.value))
3816
+ try {
3817
+ const k = Zr(n.value);
3818
+ s("update:modelValue", k), s("compress", k);
3819
+ } catch (k) {
3820
+ console.error("Failed to compress XML:", k);
3821
+ }
3822
+ }, P = () => {
3823
+ if (u.value)
3824
+ try {
3825
+ const k = zr(t.modelValue, {
3826
+ format: !0,
3827
+ indentBy: " "
3828
+ });
3829
+ s("update:modelValue", k), s("format", k);
3830
+ } catch (k) {
3831
+ console.error("Failed to format XML:", k);
3832
+ }
3833
+ }, M = async (k) => {
3834
+ try {
3835
+ const S = typeof k == "string" ? k : JSON.stringify(k, null, 2);
3836
+ await navigator.clipboard.writeText(S), s("copy-success", S);
3837
+ } catch (S) {
3838
+ const g = S instanceof Error ? S : new Error("Copy failed");
3839
+ s("copy-error", g), console.error("Failed to copy value:", S);
3840
+ }
3841
+ };
3842
+ return Fe(() => t.modelValue, (k) => {
3843
+ h(k);
3844
+ }, { immediate: !0 }), (k, S) => (x(), N("div", {
3845
+ class: Oe(["xml-format", `xml-format--${a.value.name}`])
3846
+ }, [
3847
+ k.showToolbar ? (x(), N("div", _n, [
3848
+ E("div", xn, [
3849
+ E("button", {
3850
+ class: "xml-format__btn xml-format__btn--primary",
3851
+ onClick: C,
3852
+ disabled: !u.value,
3853
+ title: "Copy XML"
3854
+ }, " 📋 Copy ", 8, Nn),
3855
+ E("button", {
3856
+ class: "xml-format__btn xml-format__btn--secondary",
3857
+ onClick: y,
3858
+ disabled: !u.value,
3859
+ title: "Expand All"
3860
+ }, " ⬇️ Expand All ", 8, kn),
3861
+ E("button", {
3862
+ class: "xml-format__btn xml-format__btn--secondary",
3863
+ onClick: m,
3864
+ disabled: !u.value,
3865
+ title: "Collapse All"
3866
+ }, " ➡️ Collapse All ", 8, wn),
3867
+ E("button", {
3868
+ class: "xml-format__btn xml-format__btn--secondary",
3869
+ onClick: O,
3870
+ disabled: !u.value,
3871
+ title: "Compress XML"
3872
+ }, " 📦 Compress ", 8, An),
3873
+ E("button", {
3874
+ class: "xml-format__btn xml-format__btn--secondary",
3875
+ onClick: P,
3876
+ disabled: !u.value,
3877
+ title: "Format XML"
3878
+ }, " ✨ Format ", 8, Cn)
3879
+ ]),
3880
+ E("div", On, [
3881
+ u.value ? (x(), N("span", Tn, " ✅ Valid XML ")) : (x(), N("span", Pn, " ❌ Invalid XML "))
3882
+ ])
3883
+ ])) : F("", !0),
3884
+ E("div", Sn, [
3885
+ u.value ? (x(), N("div", $n, [
3886
+ (x(!0), N(he, null, pe(l.value, (g, T) => (x(), Xe(gn, {
3887
+ key: String(T),
3888
+ value: g,
3889
+ "tag-name": String(T),
3890
+ level: 0,
3891
+ expanded: i.value,
3892
+ theme: a.value,
3893
+ onToggleExpand: f,
3894
+ onCopy: M
3895
+ }, null, 8, ["value", "tag-name", "expanded", "theme"]))), 128))
3896
+ ])) : (x(), N("div", In, [
3897
+ S[0] || (S[0] = E("h4", null, "XML Parse Error:", -1)),
3898
+ E("pre", null, R(o.value), 1)
3899
+ ]))
3900
+ ])
3901
+ ], 2));
3902
+ }
3903
+ }), Un = /* @__PURE__ */ me(Bn, [["__scopeId", "data-v-2b795c5a"]]), Ln = [Wt], Vn = (r) => {
3904
+ Ln.forEach((e) => {
2072
3905
  const t = e.name || e.__name || "UnknownComponent";
2073
3906
  r.component(t, e);
2074
3907
  });
2075
- }, St = {
2076
- install: Ot
3908
+ }, Fn = {
3909
+ install: Vn
2077
3910
  };
2078
3911
  export {
2079
- xt as JsonFormat,
2080
- St as default
3912
+ Wt as JsonFormat,
3913
+ Un as XmlFormat,
3914
+ Fn as default
2081
3915
  };