lone-format 0.3.1 → 0.3.3

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 de, useCssVars as he, ref as U, computed as D, resolveComponent as ge, createElementBlock as A, openBlock as C, createElementVNode as N, createCommentVNode as j, withDirectives as oe, toDisplayString as L, withKeys as Y, vModelText as se, createTextVNode as ce, Fragment as ve, renderList as me, createVNode as fe, normalizeClass as pe, nextTick as W, watch as Ee } from "vue";
2
- class _e {
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 X, withDirectives as ve, toDisplayString as j, 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
@@ -18,13 +18,13 @@ class _e {
18
18
  * @param {?boolean} [first=false] Will add the hook to the top of the list (defaults to the bottom)
19
19
  * @public
20
20
  */
21
- add(e, t, o) {
21
+ add(e, t, s) {
22
22
  if (typeof arguments[0] != "string")
23
23
  for (let n in arguments[0])
24
24
  this.add(n, arguments[0][n], arguments[1]);
25
25
  else
26
26
  (Array.isArray(e) ? e : [e]).forEach(function(n) {
27
- this[n] = this[n] || [], t && this[n][o ? "unshift" : "push"](t);
27
+ this[n] = this[n] || [], t && this[n][s ? "unshift" : "push"](t);
28
28
  }, this);
29
29
  }
30
30
  /**
@@ -37,12 +37,12 @@ class _e {
37
37
  * @public
38
38
  */
39
39
  run(e, t) {
40
- this[e] = this[e] || [], this[e].forEach(function(o) {
41
- o.call(t && t.context ? t.context : t, t);
40
+ this[e] = this[e] || [], this[e].forEach(function(s) {
41
+ s.call(t && t.context ? t.context : t, t);
42
42
  });
43
43
  }
44
44
  }
45
- class xe {
45
+ class Je {
46
46
  constructor(e) {
47
47
  this.jsep = e, this.registered = {};
48
48
  }
@@ -60,8 +60,8 @@ class xe {
60
60
  * @public
61
61
  */
62
62
  register() {
63
- for (var e = arguments.length, t = new Array(e), o = 0; o < e; o++)
64
- t[o] = arguments[o];
63
+ for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
64
+ t[s] = arguments[s];
65
65
  t.forEach((n) => {
66
66
  if (typeof n != "object" || !n.name || !n.init)
67
67
  throw new Error("Invalid JSEP plugin format");
@@ -69,7 +69,7 @@ class xe {
69
69
  });
70
70
  }
71
71
  }
72
- class s {
72
+ class c {
73
73
  /**
74
74
  * @returns {string}
75
75
  */
@@ -80,7 +80,7 @@ class s {
80
80
  * @returns {string}
81
81
  */
82
82
  static toString() {
83
- return "JavaScript Expression Parser (JSEP) v" + s.version;
83
+ return "JavaScript Expression Parser (JSEP) v" + c.version;
84
84
  }
85
85
  // ==================== CONFIG ================================
86
86
  /**
@@ -89,7 +89,7 @@ class s {
89
89
  * @returns {Jsep}
90
90
  */
91
91
  static addUnaryOp(e) {
92
- return s.max_unop_len = Math.max(e.length, s.max_unop_len), s.unary_ops[e] = 1, s;
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
@@ -98,8 +98,8 @@ class s {
98
98
  * @param {boolean} [isRightAssociative=false] whether operator is right-associative
99
99
  * @returns {Jsep}
100
100
  */
101
- static addBinaryOp(e, t, o) {
102
- return s.max_binop_len = Math.max(e.length, s.max_binop_len), s.binary_ops[e] = t, o ? s.right_associative.add(e) : s.right_associative.delete(e), s;
101
+ static addBinaryOp(e, t, s) {
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 s {
107
107
  * @returns {Jsep}
108
108
  */
109
109
  static addIdentifierChar(e) {
110
- return s.additional_identifier_chars.add(e), s;
110
+ return c.additional_identifier_chars.add(e), c;
111
111
  }
112
112
  /**
113
113
  * @method addLiteral
@@ -116,7 +116,7 @@ class s {
116
116
  * @returns {Jsep}
117
117
  */
118
118
  static addLiteral(e, t) {
119
- return s.literals[e] = t, s;
119
+ return c.literals[e] = t, c;
120
120
  }
121
121
  /**
122
122
  * @method removeUnaryOp
@@ -124,14 +124,14 @@ class s {
124
124
  * @returns {Jsep}
125
125
  */
126
126
  static removeUnaryOp(e) {
127
- return delete s.unary_ops[e], e.length === s.max_unop_len && (s.max_unop_len = s.getMaxKeyLen(s.unary_ops)), s;
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 s.unary_ops = {}, s.max_unop_len = 0, s;
134
+ return c.unary_ops = {}, c.max_unop_len = 0, c;
135
135
  }
136
136
  /**
137
137
  * @method removeIdentifierChar
@@ -139,7 +139,7 @@ class s {
139
139
  * @returns {Jsep}
140
140
  */
141
141
  static removeIdentifierChar(e) {
142
- return s.additional_identifier_chars.delete(e), s;
142
+ return c.additional_identifier_chars.delete(e), c;
143
143
  }
144
144
  /**
145
145
  * @method removeBinaryOp
@@ -147,14 +147,14 @@ class s {
147
147
  * @returns {Jsep}
148
148
  */
149
149
  static removeBinaryOp(e) {
150
- return delete s.binary_ops[e], e.length === s.max_binop_len && (s.max_binop_len = s.getMaxKeyLen(s.binary_ops)), s.right_associative.delete(e), s;
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 s.binary_ops = {}, s.max_binop_len = 0, s;
157
+ return c.binary_ops = {}, c.max_binop_len = 0, c;
158
158
  }
159
159
  /**
160
160
  * @method removeLiteral
@@ -162,14 +162,14 @@ class s {
162
162
  * @returns {Jsep}
163
163
  */
164
164
  static removeLiteral(e) {
165
- return delete s.literals[e], s;
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 s.literals = {}, s;
172
+ return c.literals = {}, c;
173
173
  }
174
174
  // ==================== END CONFIG ============================
175
175
  /**
@@ -196,7 +196,7 @@ class s {
196
196
  * @returns {jsep.Expression}
197
197
  */
198
198
  static parse(e) {
199
- return new s(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 s {
220
220
  * @returns {number}
221
221
  */
222
222
  static binaryPrecedence(e) {
223
- return s.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 s {
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 && !s.binary_ops[String.fromCharCode(e)] || // any non-ASCII that is not an operator
234
- s.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 s.isIdentifierStart(e) || s.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 s {
256
256
  * @returns {?jsep.Expression}
257
257
  */
258
258
  runHook(e, t) {
259
- if (s.hooks[e]) {
260
- const o = {
259
+ if (c.hooks[e]) {
260
+ const s = {
261
261
  context: this,
262
262
  node: t
263
263
  };
264
- return s.hooks.run(e, o), o.node;
264
+ return c.hooks.run(e, s), s.node;
265
265
  }
266
266
  return t;
267
267
  }
@@ -271,12 +271,12 @@ class s {
271
271
  * @returns {?jsep.Expression}
272
272
  */
273
273
  searchHook(e) {
274
- if (s.hooks[e]) {
274
+ if (c.hooks[e]) {
275
275
  const t = {
276
276
  context: this
277
277
  };
278
- return s.hooks[e].find(function(o) {
279
- return o.call(t.context, t), t.node;
278
+ return c.hooks[e].find(function(s) {
279
+ return s.call(t.context, t), t.node;
280
280
  }), t.node;
281
281
  }
282
282
  }
@@ -285,7 +285,7 @@ class s {
285
285
  */
286
286
  gobbleSpaces() {
287
287
  let e = this.code;
288
- for (; e === s.SPACE_CODE || e === s.TAB_CODE || e === s.LF_CODE || e === s.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 s {
296
296
  parse() {
297
297
  this.runHook("before-all");
298
298
  const e = this.gobbleExpressions(), t = e.length === 1 ? e[0] : {
299
- type: s.COMPOUND,
299
+ type: c.COMPOUND,
300
300
  body: e
301
301
  };
302
302
  return this.runHook("after-all", t);
@@ -307,14 +307,14 @@ class s {
307
307
  * @returns {jsep.Expression[]}
308
308
  */
309
309
  gobbleExpressions(e) {
310
- let t = [], o, n;
310
+ let t = [], s, n;
311
311
  for (; this.index < this.expr.length; )
312
- if (o = this.code, o === s.SEMCOL_CODE || o === s.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);
316
316
  else if (this.index < this.expr.length) {
317
- if (o === e)
317
+ if (s === e)
318
318
  break;
319
319
  this.throwError('Unexpected "' + this.char + '"');
320
320
  }
@@ -337,9 +337,9 @@ class s {
337
337
  */
338
338
  gobbleBinaryOp() {
339
339
  this.gobbleSpaces();
340
- let e = this.expr.substr(this.index, s.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 (s.binary_ops.hasOwnProperty(e) && (!s.isIdentifierStart(this.code) || this.index + e.length < this.expr.length && !s.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 s {
351
351
  * @returns {?jsep.BinaryExpression}
352
352
  */
353
353
  gobbleBinaryExpression() {
354
- let e, t, o, n, a, l, f, d, h;
355
- if (l = this.gobbleToken(), !l || (t = this.gobbleBinaryOp(), !t))
356
- return l;
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: s.binaryPrecedence(t),
360
- right_a: s.right_associative.has(t)
361
- }, f = this.gobbleToken(), f || this.throwError("Expected expression after " + t), n = [l, a, f]; t = this.gobbleBinaryOp(); ) {
362
- if (o = s.binaryPrecedence(t), o === 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
- prec: o,
369
- right_a: s.right_associative.has(t)
370
- }, h = t;
371
- const m = (g) => a.right_a && g.right_a ? o > g.prec : o <= g.prec;
372
- for (; n.length > 2 && m(n[n.length - 2]); )
373
- f = n.pop(), t = n.pop().value, l = n.pop(), e = {
374
- type: s.BINARY_EXP,
368
+ prec: s,
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: l,
377
- right: f
376
+ left: i,
377
+ right: u
378
378
  }, n.push(e);
379
- e = this.gobbleToken(), e || this.throwError("Expected expression after " + h), n.push(a, e);
379
+ e = this.gobbleToken(), e || this.throwError("Expected expression after " + l), n.push(o, e);
380
380
  }
381
- for (d = n.length - 1, e = n[d]; d > 1; )
381
+ for (a = n.length - 1, e = n[a]; a > 1; )
382
382
  e = {
383
- type: s.BINARY_EXP,
384
- operator: n[d - 1].value,
385
- left: n[d - 2],
383
+ type: c.BINARY_EXP,
384
+ operator: n[a - 1].value,
385
+ left: n[a - 2],
386
386
  right: e
387
- }, d -= 2;
387
+ }, a -= 2;
388
388
  return e;
389
389
  }
390
390
  /**
@@ -393,36 +393,36 @@ class s {
393
393
  * @returns {boolean|jsep.Expression}
394
394
  */
395
395
  gobbleToken() {
396
- let e, t, o, n;
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, s.isDecimalDigit(e) || e === s.PERIOD_CODE)
399
+ if (e = this.code, c.isDecimalDigit(e) || e === c.PERIOD_CODE)
400
400
  return this.gobbleNumericLiteral();
401
- if (e === s.SQUOTE_CODE || e === s.DQUOTE_CODE)
401
+ if (e === c.SQUOTE_CODE || e === c.DQUOTE_CODE)
402
402
  n = this.gobbleStringLiteral();
403
- else if (e === s.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, s.max_unop_len), o = t.length; o > 0; ) {
407
- if (s.unary_ops.hasOwnProperty(t) && (!s.isIdentifierStart(this.code) || this.index + t.length < this.expr.length && !s.isIdentifierPart(this.expr.charCodeAt(this.index + t.length)))) {
408
- this.index += o;
409
- const a = this.gobbleToken();
410
- return a || this.throwError("missing unaryOp argument"), this.runHook("after-token", {
411
- type: s.UNARY_EXP,
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
+ this.index += s;
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
- t = t.substr(0, --o);
417
+ t = t.substr(0, --s);
418
418
  }
419
- s.isIdentifierStart(e) ? (n = this.gobbleIdentifier(), s.literals.hasOwnProperty(n.name) ? n = {
420
- type: s.LITERAL,
421
- value: s.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 === s.this_str && (n = {
424
- type: s.THIS_EXP
425
- })) : e === s.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,28 +437,28 @@ class s {
437
437
  gobbleTokenProperty(e) {
438
438
  this.gobbleSpaces();
439
439
  let t = this.code;
440
- for (; t === s.PERIOD_CODE || t === s.OBRACK_CODE || t === s.OPAREN_CODE || t === s.QUMARK_CODE; ) {
441
- let o;
442
- if (t === s.QUMARK_CODE) {
443
- if (this.expr.charCodeAt(this.index + 1) !== s.PERIOD_CODE)
440
+ for (; t === c.PERIOD_CODE || t === c.OBRACK_CODE || t === c.OPAREN_CODE || t === c.QUMARK_CODE; ) {
441
+ let s;
442
+ if (t === c.QUMARK_CODE) {
443
+ if (this.expr.charCodeAt(this.index + 1) !== c.PERIOD_CODE)
444
444
  break;
445
- o = !0, this.index += 2, this.gobbleSpaces(), t = this.code;
445
+ s = !0, this.index += 2, this.gobbleSpaces(), t = this.code;
446
446
  }
447
- this.index++, t === s.OBRACK_CODE ? (e = {
448
- type: s.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 !== s.CBRACK_CODE && this.throwError("Unclosed ["), this.index++) : t === s.OPAREN_CODE ? e = {
453
- type: s.CALL_EXP,
454
- arguments: this.gobbleArguments(s.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 === s.PERIOD_CODE || o) && (o && this.index--, this.gobbleSpaces(), e = {
457
- type: s.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()
461
- }), o && (e.optional = !0), this.gobbleSpaces(), t = this.code;
461
+ }), s && (e.optional = !0), this.gobbleSpaces(), t = this.code;
462
462
  }
463
463
  return e;
464
464
  }
@@ -468,19 +468,19 @@ class s {
468
468
  * @returns {jsep.Literal}
469
469
  */
470
470
  gobbleNumericLiteral() {
471
- let e = "", t, o;
472
- for (; s.isDecimalDigit(this.code); )
471
+ let e = "", t, s;
472
+ for (; c.isDecimalDigit(this.code); )
473
473
  e += this.expr.charAt(this.index++);
474
- if (this.code === s.PERIOD_CODE)
475
- for (e += this.expr.charAt(this.index++); s.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++)); s.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
- s.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 o = this.code, s.isIdentifierStart(o) ? this.throwError("Variable names cannot start with a number (" + e + this.char + ")") : (o === s.PERIOD_CODE || e.length === 1 && e.charCodeAt(0) === s.PERIOD_CODE) && this.throwError("Unexpected period"), {
483
- type: s.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
  };
@@ -492,15 +492,15 @@ class s {
492
492
  */
493
493
  gobbleStringLiteral() {
494
494
  let e = "";
495
- const t = this.index, o = this.expr.charAt(this.index++);
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 === o) {
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 s {
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: s.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 s {
541
541
  */
542
542
  gobbleIdentifier() {
543
543
  let e = this.code, t = this.index;
544
- for (s.isIdentifierStart(e) ? this.index++ : this.throwError("Unexpected " + this.char); this.index < this.expr.length && (e = this.code, s.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: s.IDENTIFIER,
547
+ type: c.IDENTIFIER,
548
548
  name: this.expr.slice(t, this.index)
549
549
  };
550
550
  }
@@ -559,29 +559,29 @@ class s {
559
559
  */
560
560
  gobbleArguments(e) {
561
561
  const t = [];
562
- let o = !1, n = 0;
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
- o = !0, this.index++, e === s.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 === s.COMMA_CODE) {
569
+ } else if (o === c.COMMA_CODE) {
570
570
  if (this.index++, n++, n !== t.length) {
571
- if (e === s.CPAREN_CODE)
571
+ if (e === c.CPAREN_CODE)
572
572
  this.throwError("Unexpected token ,");
573
- else if (e === s.CBRACK_CODE)
574
- for (let l = t.length; l < n; l++)
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 l = this.gobbleExpression();
581
- (!l || l.type === s.COMPOUND) && this.throwError("Expected comma"), t.push(l);
580
+ const i = this.gobbleExpression();
581
+ (!i || i.type === c.COMPOUND) && this.throwError("Expected comma"), t.push(i);
582
582
  }
583
583
  }
584
- return o || this.throwError("Expected " + String.fromCharCode(e)), t;
584
+ return s || this.throwError("Expected " + String.fromCharCode(e)), t;
585
585
  }
586
586
  /**
587
587
  * Responsible for parsing a group of things within parentheses `()`
@@ -594,10 +594,10 @@ class s {
594
594
  */
595
595
  gobbleGroup() {
596
596
  this.index++;
597
- let e = this.gobbleExpressions(s.CPAREN_CODE);
598
- if (this.code === s.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: s.SEQUENCE_EXP,
600
+ type: c.SEQUENCE_EXP,
601
601
  expressions: e
602
602
  } : !1;
603
603
  this.throwError("Unclosed (");
@@ -610,15 +610,15 @@ class s {
610
610
  */
611
611
  gobbleArray() {
612
612
  return this.index++, {
613
- type: s.ARRAY_EXP,
614
- elements: this.gobbleArguments(s.CBRACK_CODE)
613
+ type: c.ARRAY_EXP,
614
+ elements: this.gobbleArguments(c.CBRACK_CODE)
615
615
  };
616
616
  }
617
617
  }
618
- const ke = new _e();
619
- Object.assign(s, {
620
- hooks: ke,
621
- plugins: new xe(s),
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,35 +712,35 @@ Object.assign(s, {
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
- s.max_unop_len = s.getMaxKeyLen(s.unary_ops);
716
- s.max_binop_len = s.getMaxKeyLen(s.binary_ops);
717
- const M = (r) => new s(r).parse(), Oe = 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(s).filter((r) => !Oe.includes(r) && M[r] === void 0).forEach((r) => {
720
- M[r] = s[r];
719
+ Object.getOwnPropertyNames(c).filter((r) => !tt.includes(r) && ee[r] === void 0).forEach((r) => {
720
+ ee[r] = c[r];
721
721
  });
722
- M.Jsep = s;
723
- const Ae = "ConditionalExpression";
724
- var Ce = {
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) {
728
728
  if (t.node && this.code === r.QUMARK_CODE) {
729
729
  this.index++;
730
- const o = t.node, n = this.gobbleExpression();
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: Ae,
736
- test: o,
733
+ const o = this.gobbleExpression();
734
+ if (o || this.throwError("Expected expression"), t.node = {
735
+ type: rt,
736
+ test: s,
737
737
  consequent: n,
738
- alternate: a
739
- }, o.operator && r.binary_ops[o.operator] <= 0.9) {
740
- let l = o;
741
- for (; l.right.operator && r.binary_ops[l.right.operator] <= 0.9; )
742
- l = l.right;
743
- t.node.test = l.right, l.right = t.node, t.node = o;
738
+ alternate: o
739
+ }, s.operator && r.binary_ops[s.operator] <= 0.9) {
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 Ce = {
748
748
  });
749
749
  }
750
750
  };
751
- M.plugins.register(Ce);
752
- const ue = 47, we = 92;
753
- var Se = {
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 === ue) {
758
- const o = ++this.index;
757
+ if (this.code === Ie) {
758
+ const s = ++this.index;
759
759
  let n = !1;
760
760
  for (; this.index < this.expr.length; ) {
761
- if (this.code === ue && !n) {
762
- const a = this.expr.slice(o, this.index);
763
- let l = "";
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 d = this.code;
766
- if (d >= 97 && d <= 122 || d >= 65 && d <= 90 || d >= 48 && d <= 57)
767
- l += 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, l);
774
- } catch (d) {
775
- this.throwError(d.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,
780
- raw: this.expr.slice(o - 1, this.index)
779
+ value: u,
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 === we ? 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 ie = 43, Pe = 45, q = {
790
+ const xe = 43, it = 45, ue = {
791
791
  name: "assignment",
792
792
  assignmentOperators: /* @__PURE__ */ new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "||=", "&&=", "??="]),
793
- updateOperators: [ie, Pe],
793
+ updateOperators: [xe, it],
794
794
  assignmentPrecedence: 0.9,
795
795
  init(r) {
796
796
  const e = [r.IDENTIFIER, r.MEMBER_EXP];
797
- q.assignmentOperators.forEach((o) => r.addBinaryOp(o, q.assignmentPrecedence, !0)), r.hooks.add("gobble-token", function(n) {
798
- const a = this.code;
799
- q.updateOperators.some((l) => l === a && l === 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 === ie ? "++" : "--",
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
- q.updateOperators.some((l) => l === a && l === 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 === ie ? "++" : "--",
810
+ operator: o === xe ? "++" : "--",
811
811
  argument: n.node,
812
812
  prefix: !1
813
813
  });
@@ -815,18 +815,18 @@ const ie = 43, Pe = 45, q = {
815
815
  }), r.hooks.add("after-expression", function(n) {
816
816
  n.node && t(n.node);
817
817
  });
818
- function t(o) {
819
- q.assignmentOperators.has(o.operator) ? (o.type = "AssignmentExpression", t(o.left), t(o.right)) : o.operator || Object.values(o).forEach((n) => {
818
+ function t(s) {
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
- M.plugins.register(Se, q);
826
- M.addUnaryOp("typeof");
827
- M.addLiteral("null", null);
828
- M.addLiteral("undefined", void 0);
829
- const Te = /* @__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__"]), R = {
830
830
  /**
831
831
  * @param {jsep.Expression} ast
832
832
  * @param {Record<string, any>} subs
@@ -835,67 +835,67 @@ const Te = /* @__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 R.evalBinaryExpression(r, e);
839
839
  case "Compound":
840
- return O.evalCompound(r, e);
840
+ return R.evalCompound(r, e);
841
841
  case "ConditionalExpression":
842
- return O.evalConditionalExpression(r, e);
842
+ return R.evalConditionalExpression(r, e);
843
843
  case "Identifier":
844
- return O.evalIdentifier(r, e);
844
+ return R.evalIdentifier(r, e);
845
845
  case "Literal":
846
- return O.evalLiteral(r, e);
846
+ return R.evalLiteral(r, e);
847
847
  case "MemberExpression":
848
- return O.evalMemberExpression(r, e);
848
+ return R.evalMemberExpression(r, e);
849
849
  case "UnaryExpression":
850
- return O.evalUnaryExpression(r, e);
850
+ return R.evalUnaryExpression(r, e);
851
851
  case "ArrayExpression":
852
- return O.evalArrayExpression(r, e);
852
+ return R.evalArrayExpression(r, e);
853
853
  case "CallExpression":
854
- return O.evalCallExpression(r, e);
854
+ return R.evalCallExpression(r, e);
855
855
  case "AssignmentExpression":
856
- return O.evalAssignmentExpression(r, e);
856
+ return R.evalAssignmentExpression(r, e);
857
857
  default:
858
858
  throw SyntaxError("Unexpected expression", r);
859
859
  }
860
860
  },
861
861
  evalBinaryExpression(r, e) {
862
862
  return {
863
- "||": (o, n) => o || n(),
864
- "&&": (o, n) => o && n(),
865
- "|": (o, n) => o | n(),
866
- "^": (o, n) => o ^ n(),
867
- "&": (o, n) => o & n(),
863
+ "||": (s, n) => s || n(),
864
+ "&&": (s, n) => s && n(),
865
+ "|": (s, n) => s | n(),
866
+ "^": (s, n) => s ^ n(),
867
+ "&": (s, n) => s & n(),
868
868
  // eslint-disable-next-line eqeqeq -- API
869
- "==": (o, n) => o == n(),
869
+ "==": (s, n) => s == n(),
870
870
  // eslint-disable-next-line eqeqeq -- API
871
- "!=": (o, n) => o != n(),
872
- "===": (o, n) => o === n(),
873
- "!==": (o, n) => o !== n(),
874
- "<": (o, n) => o < n(),
875
- ">": (o, n) => o > n(),
876
- "<=": (o, n) => o <= n(),
877
- ">=": (o, n) => o >= n(),
878
- "<<": (o, n) => o << n(),
879
- ">>": (o, n) => o >> n(),
880
- ">>>": (o, n) => o >>> n(),
881
- "+": (o, n) => o + n(),
882
- "-": (o, n) => o - n(),
883
- "*": (o, n) => o * n(),
884
- "/": (o, n) => o / n(),
885
- "%": (o, n) => o % n()
886
- }[r.operator](O.evalAst(r.left, e), () => O.evalAst(r.right, e));
871
+ "!=": (s, n) => s != n(),
872
+ "===": (s, n) => s === n(),
873
+ "!==": (s, n) => s !== n(),
874
+ "<": (s, n) => s < n(),
875
+ ">": (s, n) => s > n(),
876
+ "<=": (s, n) => s <= n(),
877
+ ">=": (s, n) => s >= n(),
878
+ "<<": (s, n) => s << n(),
879
+ ">>": (s, n) => s >> n(),
880
+ ">>>": (s, n) => s >>> n(),
881
+ "+": (s, n) => s + n(),
882
+ "-": (s, n) => s - n(),
883
+ "*": (s, n) => s * n(),
884
+ "/": (s, n) => s / n(),
885
+ "%": (s, n) => s % n()
886
+ }[r.operator](R.evalAst(r.left, e), () => R.evalAst(r.right, e));
887
887
  },
888
888
  evalCompound(r, e) {
889
889
  let t;
890
- for (let o = 0; o < r.body.length; o++) {
891
- r.body[o].type === "Identifier" && ["var", "let", "const"].includes(r.body[o].name) && r.body[o + 1] && r.body[o + 1].type === "AssignmentExpression" && (o += 1);
892
- const n = r.body[o];
893
- t = O.evalAst(n, e);
890
+ for (let s = 0; s < r.body.length; s++) {
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
+ const n = r.body[s];
893
+ t = R.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 R.evalAst(r.test, e) ? R.evalAst(r.consequent, e) : R.evalAst(r.alternate, e);
899
899
  },
900
900
  evalIdentifier(r, e) {
901
901
  if (Object.hasOwn(e, r.name))
@@ -910,46 +910,46 @@ const Te = /* @__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 ? R.evalAst(r.property) : r.property.name
914
914
  // `object.property` property is Identifier
915
- ), o = O.evalAst(r.object, e);
916
- if (o == null)
917
- throw TypeError(`Cannot read properties of ${o} (reading '${t}')`);
918
- if (!Object.hasOwn(o, t) && Te.has(t))
919
- throw TypeError(`Cannot read properties of ${o} (reading '${t}')`);
920
- const n = o[t];
921
- return typeof n == "function" ? n.bind(o) : n;
915
+ ), s = R.evalAst(r.object, e);
916
+ if (s == null)
917
+ throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);
918
+ if (!Object.hasOwn(s, t) && at.has(t))
919
+ throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);
920
+ const n = s[t];
921
+ return typeof n == "function" ? n.bind(s) : n;
922
922
  },
923
923
  evalUnaryExpression(r, e) {
924
924
  return {
925
- "-": (o) => -O.evalAst(o, e),
926
- "!": (o) => !O.evalAst(o, e),
927
- "~": (o) => ~O.evalAst(o, e),
925
+ "-": (s) => -R.evalAst(s, e),
926
+ "!": (s) => !R.evalAst(s, e),
927
+ "~": (s) => ~R.evalAst(s, e),
928
928
  // eslint-disable-next-line no-implicit-coercion -- API
929
- "+": (o) => +O.evalAst(o, e),
930
- typeof: (o) => typeof O.evalAst(o, e)
929
+ "+": (s) => +R.evalAst(s, e),
930
+ typeof: (s) => typeof R.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) => R.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) => R.evalAst(n, e));
938
+ return R.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, o = O.evalAst(r.right, e);
944
- return e[t] = o, e[t];
943
+ const t = r.left.name, s = R.evalAst(r.right, e);
944
+ return e[t] = s, e[t];
945
945
  }
946
946
  };
947
- class Ne {
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 = M(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 Ne {
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 R.evalAst(this.ast, t);
962
962
  }
963
963
  }
964
- function V(r, e) {
964
+ function te(r, e) {
965
965
  return r = r.slice(), r.push(e), r;
966
966
  }
967
- function ae(r, e) {
967
+ function ke(r, e) {
968
968
  return e = e.slice(), e.unshift(r), e;
969
969
  }
970
- class je extends Error {
970
+ class ut extends Error {
971
971
  /**
972
972
  * @param {AnyResult} value The evaluated scalar value
973
973
  */
@@ -975,304 +975,304 @@ class je extends Error {
975
975
  super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'), this.avoidNew = !0, this.value = e, this.name = "NewError";
976
976
  }
977
977
  }
978
- function x(r, e, t, o, n) {
979
- if (!(this instanceof x))
978
+ function $(r, e, t, s, n) {
979
+ if (!(this instanceof $))
980
980
  try {
981
- return new x(r, e, t, o, n);
982
- } catch (l) {
983
- if (!l.avoidNew)
984
- throw l;
985
- return l.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
- typeof r == "string" && (n = o, o = t, t = e, e = r, r = null);
988
- const a = r && typeof r == "object";
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 || o || null, this.otherTypeCallback = r.otherTypeCallback || n || function() {
987
+ typeof r == "string" && (n = s, s = t, t = e, e = r, r = null);
988
+ const o = r && typeof r == "object";
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 l = {
993
- path: a ? r.path : e
992
+ const i = {
993
+ path: o ? r.path : e
994
994
  };
995
- a ? "json" in r && (l.json = r.json) : l.json = t;
996
- const f = this.evaluate(l);
997
- if (!f || typeof f != "object")
998
- throw new je(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
- x.prototype.evaluate = function(r, e, t, o) {
1003
- let n = this.parent, a = this.parentProperty, {
1004
- flatten: l,
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
- if (this.currResultType = this.resultType, this.currEval = this.eval, this.currSandbox = this.sandbox, t = t || this.callback, this.currOtherTypeCallback = o || this.otherTypeCallback, e = e || this.json, r = r || this.path, r && typeof r == "object" && !Array.isArray(r)) {
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 !== "")
1009
1009
  throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');
1010
1010
  if (!Object.hasOwn(r, "json"))
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), l = Object.hasOwn(r, "flatten") ? r.flatten : l, 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 = x.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 d = x.toPathArray(r);
1019
- d[0] === "$" && d.length > 1 && d.shift(), this._hasParentSelector = null;
1020
- const h = this._trace(d, e, ["$"], n, a, t).filter(function(m) {
1021
- return m && !m.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 h.length ? !f && h.length === 1 && !h[0].hasArrExpr ? this._getPreferredOutput(h[0]) : h.reduce((m, g) => {
1024
- const _ = this._getPreferredOutput(g);
1025
- return l && Array.isArray(_) ? m = m.concat(_) : m.push(_), m;
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
- x.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 : x.toPathArray(r.path);
1033
- return r.pointer = x.toPointer(t), r.path = typeof r.path == "string" ? r.path : x.toPathString(r.path), r;
1032
+ const t = Array.isArray(r.path) ? r.path : $.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 x.toPathString(r[e]);
1040
+ return $.toPathString(r[e]);
1041
1041
  case "pointer":
1042
- return x.toPointer(r.path);
1042
+ return $.toPointer(r.path);
1043
1043
  default:
1044
1044
  throw new TypeError("Unknown result type");
1045
1045
  }
1046
1046
  };
1047
- x.prototype._handleCallback = function(r, e, t) {
1047
+ $.prototype._handleCallback = function(r, e, t) {
1048
1048
  if (e) {
1049
- const o = this._getPreferredOutput(r);
1050
- r.path = typeof r.path == "string" ? r.path : x.toPathString(r.path), e(o, t, r);
1049
+ const s = this._getPreferredOutput(r);
1050
+ r.path = typeof r.path == "string" ? r.path : $.toPathString(r.path), e(s, t, r);
1051
1051
  }
1052
1052
  };
1053
- x.prototype._trace = function(r, e, t, o, n, a, l, f) {
1054
- let d;
1053
+ $.prototype._trace = function(r, e, t, s, n, o, i, u) {
1054
+ let a;
1055
1055
  if (!r.length)
1056
- return d = {
1056
+ return a = {
1057
1057
  path: t,
1058
1058
  value: e,
1059
- parent: o,
1059
+ parent: s,
1060
1060
  parentProperty: n,
1061
- hasArrExpr: l
1062
- }, this._handleCallback(d, a, "value"), d;
1063
- const h = r[0], m = r.slice(1), g = [];
1064
- function _(b) {
1065
- Array.isArray(b) ? b.forEach((w) => {
1066
- g.push(w);
1067
- }) : g.push(b);
1068
- }
1069
- if ((typeof h != "string" || f) && e && Object.hasOwn(e, h))
1070
- _(this._trace(m, e[h], V(t, h), e, h, a, l));
1071
- else if (h === "*")
1072
- this._walk(e, (b) => {
1073
- _(this._trace(m, e[b], V(t, b), e, b, 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 (h === "..")
1076
- _(this._trace(m, e, t, o, n, a, l)), this._walk(e, (b) => {
1077
- typeof e[b] == "object" && _(this._trace(r.slice(), e[b], V(t, b), e, b, 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 (h === "^")
1080
+ if (l === "^")
1081
1081
  return this._hasParentSelector = !0, {
1082
1082
  path: t.slice(0, -1),
1083
- expr: m,
1083
+ expr: h,
1084
1084
  isParentSelector: !0
1085
1085
  };
1086
- if (h === "~")
1087
- return d = {
1088
- path: V(t, h),
1086
+ if (l === "~")
1087
+ return a = {
1088
+ path: te(t, l),
1089
1089
  value: n,
1090
- parent: o,
1090
+ parent: s,
1091
1091
  parentProperty: null
1092
- }, this._handleCallback(d, a, "property"), d;
1093
- if (h === "$")
1094
- _(this._trace(m, e, t, null, null, a, l));
1095
- else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(h))
1096
- _(this._slice(h, m, e, t, o, n, a));
1097
- else if (h.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 b = h.replace(/^\?\((.*?)\)$/u, "$1"), w = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(b);
1101
- w ? this._walk(e, (S) => {
1102
- const B = [w[2]], I = w[1] ? e[S][w[1]] : e[S];
1103
- this._trace(B, I, t, o, n, a, !0).length > 0 && _(this._trace(m, e[S], V(t, S), e, S, a, !0));
1104
- }) : this._walk(e, (S) => {
1105
- this._eval(b, e[S], S, t, o, n) && _(this._trace(m, e[S], V(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 (h[0] === "(") {
1107
+ } else if (l[0] === "(") {
1108
1108
  if (this.currEval === !1)
1109
1109
  throw new Error("Eval [(expr)] prevented in JSONPath expression.");
1110
- _(this._trace(ae(this._eval(h, e, t.at(-1), t.slice(0, -1), o, n), m), e, t, o, n, a, l));
1111
- } else if (h[0] === "@") {
1112
- let b = !1;
1113
- const w = h.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)) && (b = !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 && (b = !0);
1122
+ typeof e === C && (m = !0);
1123
1123
  break;
1124
1124
  case "integer":
1125
- Number.isFinite(e) && !(e % 1) && (b = !0);
1125
+ Number.isFinite(e) && !(e % 1) && (m = !0);
1126
1126
  break;
1127
1127
  case "number":
1128
- Number.isFinite(e) && (b = !0);
1128
+ Number.isFinite(e) && (m = !0);
1129
1129
  break;
1130
1130
  case "nonFinite":
1131
- typeof e == "number" && !Number.isFinite(e) && (b = !0);
1131
+ typeof e == "number" && !Number.isFinite(e) && (m = !0);
1132
1132
  break;
1133
1133
  case "object":
1134
- e && typeof e === w && (b = !0);
1134
+ e && typeof e === C && (m = !0);
1135
1135
  break;
1136
1136
  case "array":
1137
- Array.isArray(e) && (b = !0);
1137
+ Array.isArray(e) && (m = !0);
1138
1138
  break;
1139
1139
  case "other":
1140
- b = this.currOtherTypeCallback(e, t, o, n);
1140
+ m = this.currOtherTypeCallback(e, t, s, n);
1141
1141
  break;
1142
1142
  case "null":
1143
- e === null && (b = !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 (b)
1150
- return d = {
1149
+ if (m)
1150
+ return a = {
1151
1151
  path: t,
1152
1152
  value: e,
1153
- parent: o,
1153
+ parent: s,
1154
1154
  parentProperty: n
1155
- }, this._handleCallback(d, a, "value"), d;
1156
- } else if (h[0] === "`" && e && Object.hasOwn(e, h.slice(1))) {
1157
- const b = h.slice(1);
1158
- _(this._trace(m, e[b], V(t, b), e, b, a, l, !0));
1159
- } else if (h.includes(",")) {
1160
- const b = h.split(",");
1161
- for (const w of b)
1162
- _(this._trace(ae(w, m), e, t, o, n, a, !0));
1163
- } else !f && e && Object.hasOwn(e, h) && _(this._trace(m, e[h], V(t, h), e, h, a, l, !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 b = 0; b < g.length; b++) {
1167
- const w = g[b];
1168
- if (w && w.isParentSelector) {
1169
- const S = this._trace(w.expr, e, w.path, o, n, a, l);
1170
- if (Array.isArray(S)) {
1171
- g[b] = S[0];
1172
- const B = S.length;
1173
- for (let I = 1; I < B; I++)
1174
- b++, g.splice(b, 0, S[I]);
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
- g[b] = S;
1176
+ f[m] = O;
1177
1177
  }
1178
1178
  }
1179
- return g;
1179
+ return f;
1180
1180
  };
1181
- x.prototype._walk = function(r, e) {
1181
+ $.prototype._walk = function(r, e) {
1182
1182
  if (Array.isArray(r)) {
1183
1183
  const t = r.length;
1184
- for (let o = 0; o < t; o++)
1185
- e(o);
1184
+ for (let s = 0; s < t; s++)
1185
+ e(s);
1186
1186
  } else r && typeof r == "object" && Object.keys(r).forEach((t) => {
1187
1187
  e(t);
1188
1188
  });
1189
1189
  };
1190
- x.prototype._slice = function(r, e, t, o, n, a, l) {
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, d = r.split(":"), h = d[2] && Number.parseInt(d[2]) || 1;
1194
- let m = d[0] && Number.parseInt(d[0]) || 0, g = d[1] && Number.parseInt(d[1]) || f;
1195
- m = m < 0 ? Math.max(0, m + f) : Math.min(f, m), g = g < 0 ? Math.max(0, g + f) : Math.min(f, g);
1196
- const _ = [];
1197
- for (let b = m; b < g; b += h)
1198
- this._trace(ae(b, e), t, o, n, a, l, !0).forEach((S) => {
1199
- _.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 _;
1201
+ return y;
1202
1202
  };
1203
- x.prototype._eval = function(r, e, t, o, 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 l = r.includes("@path");
1206
- l && (this.currSandbox._$_path = x.toPathString(o.concat([t])));
1207
- const f = this.currEval + "Script:" + r;
1208
- if (!x.cache[f]) {
1209
- let d = r.replaceAll("@parentProperty", "_$_parentProperty").replaceAll("@parent", "_$_parent").replaceAll("@property", "_$_property").replaceAll("@root", "_$_root").replaceAll(/@([.\s)[])/gu, "_$_v$1");
1210
- if (l && (d = d.replaceAll("@path", "_$_path")), this.currEval === "safe" || this.currEval === !0 || this.currEval === void 0)
1211
- x.cache[f] = new this.safeVm.Script(d);
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
- x.cache[f] = new this.vm.Script(d);
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 h = this.currEval;
1216
- x.cache[f] = new h(d);
1215
+ const l = this.currEval;
1216
+ $.cache[u] = new l(a);
1217
1217
  } else if (typeof this.currEval == "function")
1218
- x.cache[f] = {
1219
- runInNewContext: (h) => this.currEval(d, h)
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 x.cache[f].runInNewContext(this.currSandbox);
1226
- } catch (d) {
1225
+ return $.cache[u].runInNewContext(this.currSandbox);
1226
+ } catch (a) {
1227
1227
  if (this.ignoreEvalErrors)
1228
1228
  return !1;
1229
- throw new Error("jsonPath: " + d.message + ": " + r);
1229
+ throw new Error("jsonPath: " + a.message + ": " + r);
1230
1230
  }
1231
1231
  };
1232
- x.cache = {};
1233
- x.toPathString = function(r) {
1232
+ $.cache = {};
1233
+ $.toPathString = function(r) {
1234
1234
  const e = r, t = e.length;
1235
- let o = "$";
1235
+ let s = "$";
1236
1236
  for (let n = 1; n < t; n++)
1237
- /^(~|\^|@.*?\(\))$/u.test(e[n]) || (o += /^[0-9*]+$/u.test(e[n]) ? "[" + e[n] + "]" : "['" + e[n] + "']");
1238
- return o;
1237
+ /^(~|\^|@.*?\(\))$/u.test(e[n]) || (s += /^[0-9*]+$/u.test(e[n]) ? "[" + e[n] + "]" : "['" + e[n] + "']");
1238
+ return s;
1239
1239
  };
1240
- x.toPointer = function(r) {
1240
+ $.toPointer = function(r) {
1241
1241
  const e = r, t = e.length;
1242
- let o = "";
1242
+ let s = "";
1243
1243
  for (let n = 1; n < t; n++)
1244
- /^(~|\^|@.*?\(\))$/u.test(e[n]) || (o += "/" + e[n].toString().replaceAll("~", "~0").replaceAll("/", "~1"));
1245
- return o;
1244
+ /^(~|\^|@.*?\(\))$/u.test(e[n]) || (s += "/" + e[n].toString().replaceAll("~", "~0").replaceAll("/", "~1"));
1245
+ return s;
1246
1246
  };
1247
- x.toPathArray = function(r) {
1247
+ $.toPathArray = function(r) {
1248
1248
  const {
1249
1249
  cache: e
1250
- } = x;
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, l) {
1254
- return "[#" + (t.push(l) - 1) + "]";
1255
- }).replaceAll(/\[['"]([^'\]]*)['"]\]/gu, function(a, l) {
1256
- return "['" + l.replaceAll(".", "%@%").replaceAll("~", "%%@@%%") + "']";
1257
- }).replaceAll("~", ";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu, ";").replaceAll("%@%", ".").replaceAll("%%@@%%", "~").replaceAll(/(?:;)?(\^+)(?:;)?/gu, function(a, l) {
1258
- return ";" + l.split("").join(";") + ";";
1259
- }).replaceAll(/;;;|;;/gu, ";..;").replaceAll(/;$|'?\]|'$/gu, "").split(";").map(function(a) {
1260
- const l = a.match(/#(\d+)/u);
1261
- return !l || !l[1] ? a : t[l[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
- x.prototype.safeVm = {
1266
- Script: Ne
1265
+ $.prototype.safeVm = {
1266
+ Script: lt
1267
1267
  };
1268
- const De = function(r, e, t) {
1269
- const o = r.length;
1270
- for (let n = 0; n < o; n++) {
1271
- const a = r[n];
1272
- t(a) && e.push(r.splice(n--, 1)[0]);
1268
+ const ct = function(r, e, t) {
1269
+ const s = r.length;
1270
+ for (let n = 0; n < s; n++) {
1271
+ const o = r[n];
1272
+ t(o) && e.push(r.splice(n--, 1)[0]);
1273
1273
  }
1274
1274
  };
1275
- class Be {
1275
+ class dt {
1276
1276
  /**
1277
1277
  * @param {string} expr Expression to evaluate
1278
1278
  */
@@ -1286,48 +1286,48 @@ class Be {
1286
1286
  */
1287
1287
  runInNewContext(e) {
1288
1288
  let t = this.code;
1289
- const o = Object.keys(e), n = [];
1290
- De(o, n, (h) => typeof e[h] == "function");
1291
- const a = o.map((h) => e[h]);
1292
- t = n.reduce((h, m) => {
1293
- let g = e[m].toString();
1294
- return /function/u.test(g) || (g = "function " + g), "var " + m + "=" + g + ";" + h;
1295
- }, "") + t, !/(['"])use strict\1/u.test(t) && !o.includes("arguments") && (t = "var arguments = undefined;" + t), t = t.replace(/;\s*$/u, "");
1296
- const f = t.lastIndexOf(";"), d = f !== -1 ? t.slice(0, f + 1) + " return " + t.slice(f + 1) : " return " + t;
1297
- return new Function(...o, d)(...a);
1289
+ const s = Object.keys(e), n = [];
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
+ }, "") + t, !/(['"])use strict\1/u.test(t) && !s.includes("arguments") && (t = "var arguments = undefined;" + t), t = t.replace(/;\s*$/u, "");
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
- x.prototype.vm = {
1301
- Script: Be
1300
+ $.prototype.vm = {
1301
+ Script: dt
1302
1302
  };
1303
- const $e = { class: "json-node" }, Ie = {
1303
+ const ft = { class: "json-node" }, ht = {
1304
1304
  key: 0,
1305
1305
  class: "json-node__container"
1306
- }, Re = { class: "json-node__line" }, Le = {
1306
+ }, pt = { class: "json-node__line" }, gt = {
1307
1307
  key: 2,
1308
1308
  class: "json-node__colon"
1309
- }, Ue = ["title"], Me = {
1309
+ }, bt = ["title"], mt = {
1310
1310
  key: 3,
1311
1311
  class: "json-node__collapsed"
1312
- }, Ve = {
1312
+ }, yt = {
1313
1313
  key: 4,
1314
1314
  class: "json-node__comma"
1315
- }, He = {
1315
+ }, Et = {
1316
1316
  key: 0,
1317
1317
  class: "json-node__children"
1318
- }, Fe = { class: "json-node__children-content" }, Ke = { class: "json-node__line json-node__closing-bracket" }, Xe = { class: "json-node__bracket" }, Qe = {
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
- }, Ye = {
1321
+ }, kt = {
1322
1322
  key: 1,
1323
1323
  class: "json-node__primitive"
1324
- }, qe = {
1324
+ }, wt = {
1325
1325
  key: 2,
1326
1326
  class: "json-node__colon"
1327
- }, ze = ["title"], Ge = {
1327
+ }, At = ["title"], Ct = {
1328
1328
  key: 0,
1329
1329
  class: "json-node__comma"
1330
- }, We = /* @__PURE__ */ de({
1330
+ }, Ot = /* @__PURE__ */ be({
1331
1331
  name: "JsonNode",
1332
1332
  __name: "JsonNode",
1333
1333
  props: {
@@ -1341,191 +1341,191 @@ const $e = { class: "json-node" }, Ie = {
1341
1341
  },
1342
1342
  emits: ["update:value", "toggle-expand", "copy", "update:key"],
1343
1343
  setup(r, { emit: e }) {
1344
- he((u) => ({
1345
- "7b112182": u.level,
1346
- "1501a3a8": u.theme.colors.syntaxKey,
1347
- "4c2226b6": u.theme.colors.hoverBackground,
1348
- "30aa351e": u.theme.colors.syntaxBracket,
1349
- "090e30f3": u.theme.colors.textSecondary,
1350
- cf872bb0: u.theme.colors.syntaxString,
1351
- e0803540: u.theme.colors.syntaxNumber,
1352
- "3954b61e": u.theme.colors.syntaxBoolean,
1353
- e9972d44: u.theme.colors.syntaxNull,
1354
- "231c0282": u.theme.colors.background,
1355
- e1dce7d8: 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, o = e, n = U(!1), a = U(!1), l = U(""), f = U(""), d = (u) => u !== null && typeof u == "object" && !Array.isArray(u) && "__protected_number__" in u && Object.keys(u).length === 1, h = (u) => d(u) ? u.__protected_number__ : "", m = D(() => d(t.value) ? !1 : t.value !== null && typeof t.value == "object"), g = D(() => Array.isArray(t.value)), _ = D(() => t.path ? t.path : t.keyName ? t.keyName : "root"), b = D(() => t.expanded.has(_.value)), w = D(() => t.keyName), S = D(() => g.value ? "[" : "{"), B = D(() => g.value ? "]" : "}"), I = D(() => {
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(() => {
1358
1358
  if (!t.value) return "";
1359
- const i = Object.keys(t.value).length;
1360
- return g.value ? i > 0 ? ` ${i} items ` : " " : i > 0 ? ` ${i} keys ` : " ";
1361
- }), Z = D(() => {
1362
- const u = typeof t.value;
1363
- return t.value === null ? "json-node__value--null" : u === "boolean" ? "json-node__value--boolean" : u === "number" || d(t.value) ? "json-node__value--number" : u === "string" ? "json-node__value--string" : "";
1364
- }), J = D(() => a.value ? f.value : t.value === null ? "null" : typeof t.value == "boolean" || typeof t.value == "number" ? String(t.value) : d(t.value) ? h(t.value) : typeof t.value == "string" ? `"${t.value}"` : String(t.value)), H = D(() => "Click to edit, double-click to copy"), ee = (u) => t.level === 0 ? u : _.value ? `${_.value}.${u}` : u, te = (u) => {
1365
- const i = Object.keys(t.value);
1366
- return i.indexOf(u) === i.length - 1;
1367
- }, z = () => {
1368
- o("toggle-expand", _.value);
1369
- }, G = () => {
1370
- t.level !== 0 && (n.value = !0, l.value = t.keyName, W(() => {
1371
- const u = document.querySelectorAll(".json-node__key-input"), i = u[u.length - 1];
1372
- i && (i.focus(), i.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, U = (b) => {
1365
+ const d = Object.keys(t.value);
1366
+ return d.indexOf(b) === d.length - 1;
1367
+ }, V = () => {
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());
1373
1373
  }));
1374
- }, re = () => {
1375
- m.value || (a.value = !0, d(t.value) ? f.value = h(t.value) : typeof t.value == "string" ? f.value = t.value : f.value = String(t.value), W(() => {
1376
- const u = document.querySelectorAll(".json-node__value-input"), i = u[u.length - 1];
1377
- i && (i.focus(), i.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());
1378
1378
  }));
1379
- }, K = () => {
1379
+ }, D = () => {
1380
1380
  if (t.level === 0 || !n.value) return;
1381
- const u = l.value.trim();
1382
- if (!u) {
1383
- X();
1381
+ const b = i.value.trim();
1382
+ if (!b) {
1383
+ ie();
1384
1384
  return;
1385
1385
  }
1386
- if (u === t.keyName) {
1386
+ if (b === t.keyName) {
1387
1387
  n.value = !1;
1388
1388
  return;
1389
1389
  }
1390
- n.value = !1, o("update:key", _.value, u);
1391
- }, F = () => {
1390
+ n.value = !1, s("update:key", y.value, b);
1391
+ }, J = () => {
1392
1392
  try {
1393
- let u;
1394
- const i = f.value.trim();
1395
- if (i === "null")
1396
- u = null;
1397
- else if (i === "true" || i === "false")
1398
- u = i === "true";
1399
- else if (!isNaN(Number(i)) && i !== "") {
1400
- const c = Number(i);
1401
- !Number.isSafeInteger(c) || i.length > 15 ? u = { __protected_number__: i } : u = c;
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;
1402
1402
  } else
1403
- u = f.value;
1404
- o("update:value", _.value, u), a.value = !1;
1405
- } catch (u) {
1406
- 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;
1407
1407
  }
1408
- }, X = () => {
1409
- n.value = !1, l.value = t.keyName;
1410
- }, ne = () => {
1411
- a.value = !1, d(t.value) ? f.value = 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);
1412
1412
  };
1413
- return (u, i) => {
1414
- const c = ge("JsonNode", !0);
1415
- return C(), A("div", $e, [
1416
- m.value ? (C(), A("div", Ie, [
1417
- N("div", Re, [
1418
- u.keyName && !n.value ? (C(), A("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", {
1419
1419
  key: 0,
1420
1420
  class: "json-node__key",
1421
- onClick: G,
1421
+ onClick: Y,
1422
1422
  title: "Click to edit key"
1423
- }, ' "' + L(w.value) + '" ', 1)) : j("", !0),
1424
- u.keyName && n.value ? oe((C(), A("input", {
1423
+ }, ' "' + j(C.value) + '" ', 1)) : X("", !0),
1424
+ b.keyName && n.value ? ve((x(), N("input", {
1425
1425
  key: 1,
1426
- "onUpdate:modelValue": i[0] || (i[0] = (y) => l.value = y),
1426
+ "onUpdate:modelValue": d[0] || (d[0] = (_) => i.value = _),
1427
1427
  onKeyup: [
1428
- Y(K, ["enter"]),
1429
- Y(X, ["escape"])
1428
+ le(D, ["enter"]),
1429
+ le(ie, ["escape"])
1430
1430
  ],
1431
- onBlur: K,
1431
+ onBlur: D,
1432
1432
  class: "json-node__key-input"
1433
1433
  }, null, 544)), [
1434
- [se, l.value]
1435
- ]) : j("", !0),
1436
- u.keyName ? (C(), A("span", Le, ": ")) : j("", !0),
1437
- N("span", {
1434
+ [_e, i.value]
1435
+ ]) : X("", !0),
1436
+ b.keyName ? (x(), N("span", gt, ": ")) : X("", !0),
1437
+ E("span", {
1438
1438
  class: "json-node__bracket json-node__bracket--clickable",
1439
- onClick: z,
1440
- title: b.value ? "Click to collapse" : "Click to expand"
1441
- }, L(S.value), 9, Ue),
1442
- b.value ? j("", !0) : (C(), A("span", Me, [
1443
- ce(L(I.value) + " ", 1),
1444
- N("span", {
1439
+ onClick: V,
1440
+ title: m.value ? "Click to collapse" : "Click to expand"
1441
+ }, j(O.value), 9, bt),
1442
+ m.value ? X("", !0) : (x(), N("span", mt, [
1443
+ Se(j(M.value) + " ", 1),
1444
+ E("span", {
1445
1445
  class: "json-node__bracket json-node__bracket--clickable",
1446
- onClick: z
1447
- }, L(B.value), 1)
1446
+ onClick: V
1447
+ }, j(P.value), 1)
1448
1448
  ])),
1449
- !b.value && !u.isLast ? (C(), A("span", Ve, ",")) : j("", !0)
1449
+ !m.value && !b.isLast ? (x(), N("span", yt, ",")) : X("", !0)
1450
1450
  ]),
1451
- b.value ? (C(), A("div", He, [
1452
- N("div", Fe, [
1453
- (C(!0), A(ve, null, me(u.value, (y, p) => (C(), A("div", {
1454
- key: p,
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,
1455
1455
  class: "json-node__child"
1456
1456
  }, [
1457
- fe(c, {
1458
- value: y,
1459
- "key-name": g.value ? "" : String(p),
1460
- level: u.level + 1,
1461
- path: ee(String(p)),
1462
- expanded: u.expanded,
1463
- theme: u.theme,
1464
- "onUpdate:value": i[1] || (i[1] = (v, E) => u.$emit("update:value", v, E)),
1465
- onToggleExpand: i[2] || (i[2] = (v) => u.$emit("toggle-expand", v)),
1466
- onCopy: i[3] || (i[3] = (v) => u.$emit("copy", v)),
1467
- "onUpdate:key": i[4] || (i[4] = (v, E) => u.$emit("update:key", v, E)),
1468
- "is-last": te(String(p))
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": U(String(v))
1469
1469
  }, null, 8, ["value", "key-name", "level", "path", "expanded", "theme", "is-last"])
1470
1470
  ]))), 128))
1471
1471
  ]),
1472
- N("div", Ke, [
1473
- N("span", Xe, L(B.value), 1),
1474
- u.isLast ? j("", !0) : (C(), A("span", Qe, ","))
1472
+ E("div", _t, [
1473
+ E("span", xt, j(P.value), 1),
1474
+ b.isLast ? X("", !0) : (x(), N("span", Nt, ","))
1475
1475
  ])
1476
- ])) : j("", !0)
1477
- ])) : (C(), A("div", Ye, [
1478
- u.keyName && !n.value ? (C(), A("span", {
1476
+ ])) : X("", !0)
1477
+ ])) : (x(), N("div", kt, [
1478
+ b.keyName && !n.value ? (x(), N("span", {
1479
1479
  key: 0,
1480
1480
  class: "json-node__key",
1481
- onClick: G,
1481
+ onClick: Y,
1482
1482
  title: "Click to edit key"
1483
- }, ' "' + L(w.value) + '" ', 1)) : j("", !0),
1484
- u.keyName && n.value ? oe((C(), A("input", {
1483
+ }, ' "' + j(C.value) + '" ', 1)) : X("", !0),
1484
+ b.keyName && n.value ? ve((x(), N("input", {
1485
1485
  key: 1,
1486
- "onUpdate:modelValue": i[5] || (i[5] = (y) => l.value = y),
1486
+ "onUpdate:modelValue": d[5] || (d[5] = (_) => i.value = _),
1487
1487
  onKeyup: [
1488
- Y(K, ["enter"]),
1489
- Y(X, ["escape"])
1488
+ le(D, ["enter"]),
1489
+ le(ie, ["escape"])
1490
1490
  ],
1491
- onBlur: K,
1491
+ onBlur: D,
1492
1492
  class: "json-node__key-input"
1493
1493
  }, null, 544)), [
1494
- [se, l.value]
1495
- ]) : j("", !0),
1496
- u.keyName ? (C(), A("span", qe, ": ")) : j("", !0),
1497
- a.value ? j("", !0) : (C(), A("span", {
1494
+ [_e, i.value]
1495
+ ]) : X("", !0),
1496
+ b.keyName ? (x(), N("span", wt, ": ")) : X("", !0),
1497
+ o.value ? X("", !0) : (x(), N("span", {
1498
1498
  key: 3,
1499
- class: pe(["json-node__value", Z.value]),
1500
- onClick: re,
1501
- onDblclick: i[6] || (i[6] = (y) => u.$emit("copy", u.value)),
1502
- title: H.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
1503
1503
  }, [
1504
- ce(L(J.value), 1),
1505
- u.isLast ? j("", !0) : (C(), A("span", Ge, ","))
1506
- ], 42, ze)),
1507
- a.value ? oe((C(), A("input", {
1504
+ Se(j(S.value), 1),
1505
+ b.isLast ? X("", !0) : (x(), N("span", Ct, ","))
1506
+ ], 42, At)),
1507
+ o.value ? ve((x(), N("input", {
1508
1508
  key: 4,
1509
- "onUpdate:modelValue": i[7] || (i[7] = (y) => f.value = y),
1509
+ "onUpdate:modelValue": d[7] || (d[7] = (_) => u.value = _),
1510
1510
  onKeyup: [
1511
- Y(F, ["enter"]),
1512
- Y(ne, ["escape"])
1511
+ le(J, ["enter"]),
1512
+ le(Ee, ["escape"])
1513
1513
  ],
1514
- onBlur: F,
1514
+ onBlur: J,
1515
1515
  class: "json-node__value-input"
1516
1516
  }, null, 544)), [
1517
- [se, f.value]
1518
- ]) : j("", !0)
1517
+ [_e, u.value]
1518
+ ]) : X("", !0)
1519
1519
  ]))
1520
1520
  ]);
1521
1521
  };
1522
1522
  }
1523
- }), ye = (r, e) => {
1523
+ }), me = (r, e) => {
1524
1524
  const t = r.__vccOpts || r;
1525
- for (const [o, n] of e)
1526
- t[o] = n;
1525
+ for (const [s, n] of e)
1526
+ t[s] = n;
1527
1527
  return t;
1528
- }, Ze = /* @__PURE__ */ ye(We, [["__scopeId", "data-v-860beb35"]]), be = {
1528
+ }, Tt = /* @__PURE__ */ me(Ot, [["__scopeId", "data-v-860beb35"]]), He = {
1529
1529
  name: "github-light",
1530
1530
  colors: {
1531
1531
  // 背景色
@@ -1564,7 +1564,7 @@ const $e = { class: "json-node" }, Ie = {
1564
1564
  // 缩进线
1565
1565
  indentLine: "#d0d7de"
1566
1566
  }
1567
- }, Je = {
1567
+ }, Pt = {
1568
1568
  name: "github-dark",
1569
1569
  colors: {
1570
1570
  // 背景色
@@ -1603,7 +1603,7 @@ const $e = { class: "json-node" }, Ie = {
1603
1603
  // 缩进线
1604
1604
  indentLine: "#30363d"
1605
1605
  }
1606
- }, et = {
1606
+ }, St = {
1607
1607
  name: "min-light",
1608
1608
  colors: {
1609
1609
  // 背景色 - 纯白简洁
@@ -1642,7 +1642,7 @@ const $e = { class: "json-node" }, Ie = {
1642
1642
  // 缩进线
1643
1643
  indentLine: "#e5e7eb"
1644
1644
  }
1645
- }, tt = {
1645
+ }, It = {
1646
1646
  name: "slack-ochin",
1647
1647
  colors: {
1648
1648
  // 背景色 - 温暖的米色调
@@ -1681,34 +1681,34 @@ const $e = { class: "json-node" }, Ie = {
1681
1681
  // 缩进线
1682
1682
  indentLine: "#e8d5b7"
1683
1683
  }
1684
- }, rt = {
1685
- "github-light": be,
1686
- "github-dark": Je,
1687
- "min-light": et,
1688
- "slack-ochin": tt
1684
+ }, $t = {
1685
+ "github-light": He,
1686
+ "github-dark": Pt,
1687
+ "min-light": St,
1688
+ "slack-ochin": It
1689
1689
  };
1690
- function nt(r = "github-light") {
1691
- return rt[r] || be;
1690
+ function Bt(r = "github-light") {
1691
+ return $t[r] || He;
1692
1692
  }
1693
- const ot = {
1693
+ const Lt = {
1694
1694
  key: 0,
1695
1695
  class: "json-format__toolbar"
1696
- }, st = { class: "json-format__actions" }, it = ["disabled"], at = ["disabled"], lt = ["disabled"], ct = ["disabled"], ut = { class: "json-format__info" }, dt = {
1696
+ }, Vt = { class: "json-format__actions" }, Rt = ["disabled"], jt = ["disabled"], Mt = ["disabled"], Ut = ["disabled"], Ft = { class: "json-format__info" }, Xt = {
1697
1697
  key: 0,
1698
1698
  class: "json-format__status json-format__status--success"
1699
- }, ht = {
1699
+ }, Ht = {
1700
1700
  key: 1,
1701
1701
  class: "json-format__status json-format__status--error"
1702
- }, ft = { class: "json-format__content" }, pt = {
1702
+ }, Kt = { class: "json-format__content" }, Yt = {
1703
1703
  key: 0,
1704
1704
  class: "json-format__error"
1705
- }, yt = {
1705
+ }, qt = {
1706
1706
  key: 1,
1707
1707
  class: "json-format__error"
1708
- }, bt = {
1708
+ }, Qt = {
1709
1709
  key: 2,
1710
1710
  class: "json-format__viewer"
1711
- }, gt = /* @__PURE__ */ de({
1711
+ }, Gt = /* @__PURE__ */ be({
1712
1712
  name: "JsonFormat",
1713
1713
  __name: "index",
1714
1714
  props: {
@@ -1720,330 +1720,2199 @@ const ot = {
1720
1720
  },
1721
1721
  emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress"],
1722
1722
  setup(r, { expose: e, emit: t }) {
1723
- he((i) => ({
1724
- "50e4672c": g.value.colors.border,
1725
- "64d14328": g.value.colors.background,
1726
- "668c94eb": g.value.colors.text,
1727
- "8370c286": g.value.colors.surfaceBackground,
1728
- "1698e888": g.value.colors.buttonBorder,
1729
- "584924be": g.value.colors.buttonBackground,
1730
- "325e00bd": g.value.colors.buttonText,
1731
- "2430fb1e": g.value.colors.buttonBackgroundHover,
1732
- ea0e2f1c: g.value.colors.buttonPrimary,
1733
- "3b0b67ea": g.value.colors.buttonPrimaryHover,
1734
- "2e7b3e93": g.value.colors.successBackground,
1735
- b24220f6: g.value.colors.success,
1736
- "0c7db250": g.value.colors.errorBackground,
1737
- "6a387a0a": g.value.colors.error,
1738
- "2c13c5fa": g.value.colors.scrollbarTrack,
1739
- "2c1c44e4": g.value.colors.scrollbarThumb,
1740
- "8ba97764": g.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
1741
1741
  }));
1742
- const o = r, n = t, a = U(null), l = U(""), f = U(/* @__PURE__ */ new Set()), d = U(null), h = U(""), m = D(() => l.value === ""), g = D(() => nt(o.theme)), _ = D(() => h.value ? null : d.value !== null ? d.value : a.value), b = (i) => {
1743
- if (!i.trim()) {
1744
- a.value = null, l.value = "", d.value = null, h.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 = "";
1745
1745
  return;
1746
1746
  }
1747
1747
  try {
1748
- let c = i;
1749
- const y = /(:\s*|,\s*|\[\s*)-?\d{16,}/.test(c), p = /(:\s*|,\s*|\[\s*)-?\d+\.\d*0+\s*[,}\]\s]*/.test(c);
1750
- if (!y && !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)
1751
1751
  try {
1752
- a.value = JSON.parse(c), l.value = "", d.value = null, h.value = "", W(() => {
1753
- _.value !== null && H();
1752
+ o.value = JSON.parse(p), i.value = "", a.value = null, l.value = "", ce(() => {
1753
+ y.value !== null && g();
1754
1754
  });
1755
1755
  return;
1756
1756
  } catch {
1757
1757
  }
1758
- c = ((E) => {
1759
- let k = "", P = !1, T = !1, R = 0;
1760
- for (; R < E.length; ) {
1761
- const Q = E[R];
1762
- if (P)
1763
- T ? T = !1 : Q === "\\" ? T = !0 : Q === '"' && (P = !1), k += Q, R++;
1764
- else if (Q === '"')
1765
- P = !0, k += Q, 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++;
1766
1766
  else {
1767
- const le = E.slice(R);
1768
- let $ = le.match(/^([:,\[\s]*)(-?\d{16,})(\s*[,\}\]\s]|$)/);
1769
- if ($) {
1770
- k += $[1] + '{"__protected_number__":"' + $[2] + '"}' + $[3], R += $[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;
1771
1771
  continue;
1772
1772
  }
1773
- if ($ = le.match(/^([:,\[\s]*)(-?\d+\.\d*0+)(\s*[,\}\]\s]|$)/), $) {
1774
- k += $[1] + '{"__protected_number__":"' + $[2] + '"}' + $[3], R += $[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;
1775
1775
  continue;
1776
1776
  }
1777
- k += Q, R++;
1777
+ B += ae, z++;
1778
1778
  }
1779
1779
  }
1780
- return k;
1781
- })(c), a.value = JSON.parse(c), l.value = "", d.value = null, h.value = "", W(() => {
1782
- _.value !== null && H();
1780
+ return B;
1781
+ })(p), o.value = JSON.parse(p), i.value = "", a.value = null, l.value = "", ce(() => {
1782
+ y.value !== null && g();
1783
1783
  });
1784
- } catch (c) {
1785
- l.value = c instanceof Error ? c.message : "Unknown parsing error", a.value = null, d.value = null, h.value = "";
1784
+ } catch (p) {
1785
+ i.value = p instanceof Error ? p.message : "Unknown parsing error", o.value = null, a.value = null, l.value = "";
1786
1786
  }
1787
- }, w = (i) => {
1788
- if (!i || !i.expression.trim()) {
1789
- S();
1787
+ }, C = (d) => {
1788
+ if (!d || !d.expression.trim()) {
1789
+ O();
1790
1790
  return;
1791
1791
  }
1792
- if (!a.value) {
1793
- h.value = "No valid JSON data to filter";
1792
+ if (!o.value) {
1793
+ l.value = "No valid JSON data to filter";
1794
1794
  return;
1795
1795
  }
1796
1796
  try {
1797
- let c;
1798
- if (i.type === "jsonpath")
1799
- c = x({ path: i.expression, json: a.value }), c.length === 1 && i.expression.includes("$[") === !1 && !i.expression.endsWith("[*]") ? d.value = c[0] : d.value = c;
1800
- else if (i.type === "js")
1801
- c = 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", `
1802
1802
  try {
1803
- return ${i.expression};
1803
+ return ${d.expression};
1804
1804
  } catch (error) {
1805
1805
  throw new Error('JavaScript expression error: ' + error.message);
1806
1806
  }
1807
- `)(a.value), d.value = c;
1807
+ `)(o.value), a.value = p;
1808
1808
  else
1809
- throw new Error(`Unsupported filter type: ${i.type}`);
1810
- h.value = "", W(() => {
1811
- H();
1809
+ throw new Error(`Unsupported filter type: ${d.type}`);
1810
+ l.value = "", ce(() => {
1811
+ g();
1812
1812
  });
1813
- } catch (c) {
1814
- h.value = c instanceof Error ? c.message : "Filter execution error", d.value = null;
1813
+ } catch (p) {
1814
+ l.value = p instanceof Error ? p.message : "Filter execution error", a.value = null;
1815
1815
  }
1816
- }, S = () => {
1817
- d.value = null, h.value = "";
1816
+ }, O = () => {
1817
+ a.value = null, l.value = "";
1818
1818
  };
1819
- Ee(() => o.modelValue, (i) => {
1820
- b(i);
1819
+ Fe(() => s.modelValue, (d) => {
1820
+ m(d);
1821
1821
  }, { immediate: !0 });
1822
- const B = (i, c, y) => {
1823
- const p = (k) => {
1824
- if (k === null || typeof k != "object")
1825
- return k;
1826
- if (!Array.isArray(k) && "__protected_number__" in k && Object.keys(k).length === 1)
1827
- return `__PROTECTED_NUMBER_${k.__protected_number__}_PROTECTED_NUMBER__`;
1828
- if (Array.isArray(k))
1829
- return k.map((T) => p(T));
1830
- const P = {};
1831
- for (const [T, R] of Object.entries(k))
1832
- P[T] = p(R);
1833
- return P;
1834
- }, v = p(i);
1835
- return JSON.stringify(v, c, y).replace(/"__PROTECTED_NUMBER_(.+?)_PROTECTED_NUMBER__"/g, "$1");
1836
- }, I = (i, c) => {
1837
- if (!o.readonly)
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) => {
1837
+ if (!s.readonly)
1838
1838
  try {
1839
- const y = Z(a.value, i, c), p = B(y, null, 2);
1840
- n("update:modelValue", p);
1841
- } catch (y) {
1842
- console.error("Failed to update JSON:", y);
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:", _);
1843
1843
  }
1844
- }, Z = (i, c, y) => {
1845
- if (!c || c === "root") return y;
1846
- const p = c.split("."), v = F(i, p.slice(0, -1));
1847
- let E = v;
1848
- for (let P = 0; P < p.length - 1; P++) {
1849
- const T = p[P];
1850
- T !== "root" && (Array.isArray(E) ? E = E[parseInt(T)] : E = E[T]);
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]);
1851
1851
  }
1852
- const k = p[p.length - 1];
1853
- return k === "root" ? y : (Array.isArray(E) ? E[parseInt(k)] = y : E[k] = y, v);
1854
- }, J = (i) => {
1855
- f.value.has(i) ? f.value.delete(i) : f.value.add(i);
1856
- }, H = () => {
1857
- const i = /* @__PURE__ */ new Set(), c = (y, p = "") => {
1858
- y !== null && typeof y == "object" && (i.add(p || "root"), Array.isArray(y) ? y.forEach((v, E) => {
1859
- const k = p ? `${p}.${E}` : `${E}`;
1860
- c(v, k);
1861
- }) : Object.keys(y).forEach((v) => {
1862
- const E = p ? `${p}.${v}` : v;
1863
- c(y[v], E);
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);
1864
1864
  }));
1865
1865
  };
1866
- c(_.value), f.value = i, n("expand-all");
1867
- }, ee = () => {
1868
- f.value = /* @__PURE__ */ new Set(["root"]), n("collapse-all");
1869
- }, te = async () => {
1870
- if (m.value)
1866
+ p(y.value), u.value = d, n("expand-all");
1867
+ }, T = () => {
1868
+ u.value = /* @__PURE__ */ new Set(["root"]), n("collapse-all");
1869
+ }, U = async () => {
1870
+ if (h.value)
1871
1871
  try {
1872
- const i = _.value, c = B(i, null, 2);
1873
- await navigator.clipboard.writeText(c), n("copy-success", c);
1874
- } catch (i) {
1875
- 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"));
1876
1876
  }
1877
- }, z = () => {
1878
- if (m.value)
1877
+ }, V = () => {
1878
+ if (h.value)
1879
1879
  try {
1880
- const i = _.value, c = B(i);
1881
- n("update:modelValue", c), n("compress", c);
1882
- } catch (i) {
1883
- 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);
1884
1884
  }
1885
- }, G = async (i) => {
1885
+ }, Y = async (d) => {
1886
1886
  try {
1887
- let c;
1888
- typeof i == "object" && i !== null && !Array.isArray(i) && "__protected_number__" in i && Object.keys(i).length === 1 ? c = i.__protected_number__ : typeof i == "string" ? c = `"${i}"` : c = JSON.stringify(i), await navigator.clipboard.writeText(c);
1889
- } catch (c) {
1890
- console.error("Failed to copy value:", c);
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);
1891
1891
  }
1892
- }, re = (i, c) => {
1893
- if (!o.readonly)
1892
+ }, Z = (d, p) => {
1893
+ if (!s.readonly)
1894
1894
  try {
1895
- const y = K(a.value, i, c), p = B(y, null, 2);
1896
- n("update:modelValue", p), u(i, c);
1897
- } catch (y) {
1898
- console.error("Failed to rename key:", y);
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:", _);
1899
1899
  }
1900
- }, K = (i, c, y) => {
1901
- if (!c || c === "root") return i;
1902
- const p = c.split("."), v = F(i, p.slice(0, -1));
1903
- if (p.length === 1) {
1904
- const P = p[0];
1905
- return v && typeof v == "object" && !Array.isArray(v) ? X(v, P, y) : v;
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;
1906
1906
  }
1907
- let E = v;
1908
- for (let P = 0; P < p.length - 1; P++) {
1909
- const T = p[P];
1910
- Array.isArray(E) ? E = E[parseInt(T)] : E = E[T];
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];
1911
1911
  }
1912
- const k = p[p.length - 1];
1913
- if (!Array.isArray(E) && E && typeof E == "object") {
1914
- const P = X(E, k, y), T = p.slice(0, -1);
1915
- T.length > 0 && ne(v, T, P);
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);
1916
1916
  }
1917
- return v;
1918
- }, F = (i, c) => {
1919
- if (c.length === 0) return i;
1920
- if (Array.isArray(i)) {
1921
- const y = [...i], p = c[0], v = parseInt(p);
1922
- return c.length === 1 || (y[v] = F(i[v], c.slice(1))), y;
1923
- } else if (i && typeof i == "object") {
1924
- const y = { ...i }, p = c[0];
1925
- return c.length === 1 || (y[p] = F(i[p], c.slice(1))), y;
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))), _;
1926
1926
  }
1927
- return i;
1928
- }, X = (i, c, y) => {
1929
- if (!i || typeof i != "object" || Array.isArray(i))
1930
- return i;
1931
- const p = Object.keys(i), v = {};
1932
- for (const E of p)
1933
- E === c ? v[y] = i[E] : v[E] = i[E];
1934
- return v;
1935
- }, ne = (i, c, y) => {
1936
- let p = i;
1937
- for (let E = 0; E < c.length - 1; E++) {
1938
- const k = c[E];
1939
- Array.isArray(p) ? p = p[parseInt(k)] : p = p[k];
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];
1940
1940
  }
1941
- const v = c[c.length - 1];
1942
- Array.isArray(p) ? p[parseInt(v)] = y : p[v] = y;
1943
- }, u = (i, c) => {
1944
- const y = /* @__PURE__ */ new Set();
1945
- f.value.forEach((p) => {
1946
- if (p === i) {
1947
- const v = i.split(".");
1948
- v[v.length - 1] = c, y.add(v.join("."));
1949
- } else if (p.startsWith(i + ".")) {
1950
- const v = i.split(".");
1951
- v[v.length - 1] = c;
1952
- const E = v.join("."), k = p.substring(i.length);
1953
- y.add(E + k);
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);
1954
1954
  } else
1955
- y.add(p);
1956
- }), f.value = y;
1955
+ _.add(v);
1956
+ }), u.value = _;
1957
1957
  };
1958
1958
  return e({
1959
1959
  // 核心操作方法
1960
- copyJson: te,
1961
- compressSource: z,
1962
- expandAll: H,
1963
- collapseAll: ee,
1964
- toggleExpand: J,
1965
- updateValue: I,
1966
- updateKey: re,
1960
+ copyJson: U,
1961
+ compressSource: V,
1962
+ expandAll: g,
1963
+ collapseAll: T,
1964
+ toggleExpand: S,
1965
+ updateValue: M,
1966
+ updateKey: Z,
1967
1967
  // Filter 相关方法
1968
- filter: w,
1969
- clearFilter: S,
1968
+ filter: C,
1969
+ clearFilter: O,
1970
1970
  // 状态访问方法
1971
- isValidJson: () => m.value,
1972
- getParsedJson: () => a.value,
1973
- getFilteredJson: () => d.value,
1974
- getExpandedNodes: () => f.value,
1975
- getParseError: () => l.value,
1976
- getFilterError: () => h.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,
1977
1977
  // 工具方法
1978
- parseJson: (i) => b(i),
1979
- copyValue: (i) => G(i)
1980
- }), (i, c) => (C(), A("div", {
1981
- class: pe(["json-format", `json-format--${g.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}`])
1982
1982
  }, [
1983
- i.showToolbar ? (C(), A("div", ot, [
1984
- N("div", st, [
1985
- N("button", {
1983
+ d.showToolbar ? (x(), N("div", Lt, [
1984
+ E("div", Vt, [
1985
+ E("button", {
1986
1986
  class: "json-format__btn json-format__btn--primary",
1987
- onClick: te,
1988
- disabled: !m.value,
1987
+ onClick: U,
1988
+ disabled: !h.value,
1989
1989
  title: "Copy JSON"
1990
- }, " 📋 Copy ", 8, it),
1991
- N("button", {
1990
+ }, " 📋 Copy ", 8, Rt),
1991
+ E("button", {
1992
1992
  class: "json-format__btn json-format__btn--secondary",
1993
- onClick: H,
1994
- disabled: !m.value,
1993
+ onClick: g,
1994
+ disabled: !h.value,
1995
1995
  title: "Expand All"
1996
- }, " ⬇️ Expand All ", 8, at),
1997
- N("button", {
1996
+ }, " ⬇️ Expand All ", 8, jt),
1997
+ E("button", {
1998
1998
  class: "json-format__btn json-format__btn--secondary",
1999
- onClick: ee,
2000
- disabled: !m.value,
1999
+ onClick: T,
2000
+ disabled: !h.value,
2001
2001
  title: "Collapse All"
2002
- }, " ➡️ Collapse All ", 8, lt),
2003
- N("button", {
2002
+ }, " ➡️ Collapse All ", 8, Mt),
2003
+ E("button", {
2004
2004
  class: "json-format__btn json-format__btn--secondary",
2005
- onClick: z,
2006
- disabled: !m.value,
2005
+ onClick: V,
2006
+ disabled: !h.value,
2007
2007
  title: "Compress JSON"
2008
- }, " 📦 Compress ", 8, ct)
2008
+ }, " 📦 Compress ", 8, Ut)
2009
2009
  ]),
2010
- N("div", ut, [
2011
- m.value ? (C(), A("span", dt, " ✅ Valid JSON ")) : (C(), A("span", ht, " ❌ Invalid JSON "))
2010
+ E("div", Ft, [
2011
+ h.value ? (x(), N("span", Xt, " ✅ Valid JSON ")) : (x(), N("span", Ht, " ❌ Invalid JSON "))
2012
2012
  ])
2013
- ])) : j("", !0),
2014
- N("div", ft, [
2015
- m.value ? h.value ? (C(), A("div", yt, [
2016
- c[1] || (c[1] = N("h4", null, "Filter Error:", -1)),
2017
- N("pre", null, L(h.value), 1)
2018
- ])) : (C(), A("div", bt, [
2019
- fe(Ze, {
2020
- value: _.value,
2013
+ ])) : X("", !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, j(l.value), 1)
2018
+ ])) : (x(), N("div", Qt, [
2019
+ Ue(Tt, {
2020
+ value: y.value,
2021
2021
  "key-name": "",
2022
2022
  level: 0,
2023
- expanded: f.value,
2023
+ expanded: u.value,
2024
2024
  "is-last": !0,
2025
- theme: g.value,
2026
- "onUpdate:value": I,
2027
- onToggleExpand: J,
2028
- onCopy: G,
2029
- "onUpdate:key": re
2025
+ theme: f.value,
2026
+ "onUpdate:value": M,
2027
+ onToggleExpand: S,
2028
+ onCopy: Y,
2029
+ "onUpdate:key": Z
2030
2030
  }, null, 8, ["value", "expanded", "theme"])
2031
- ])) : (C(), A("div", pt, [
2032
- c[0] || (c[0] = N("h4", null, "JSON Parse Error:", -1)),
2033
- N("pre", null, L(l.value), 1)
2031
+ ])) : (x(), N("div", Yt, [
2032
+ p[0] || (p[0] = E("h4", null, "JSON Parse Error:", -1)),
2033
+ E("pre", null, j(i.value), 1)
2034
2034
  ]))
2035
2035
  ])
2036
2036
  ], 2));
2037
2037
  }
2038
- }), vt = /* @__PURE__ */ ye(gt, [["__scopeId", "data-v-7a477244"]]), mt = [vt], Et = (r) => {
2039
- mt.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.", F("InvalidTag", f, q(r, o));
2087
+ }
2088
+ const l = nr(r, o);
2089
+ if (l === !1)
2090
+ return F("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 F(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 F("InvalidTag", "Closing tag '" + a + "' can't have attributes or invalid starting.", q(r, i));
2104
+ if (t.length === 0)
2105
+ return F("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 F(
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 F("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 F(f.err.code, f.err.msg, q(r, o - h.length + f.err.line));
2123
+ if (n === !0)
2124
+ return F("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 F("InvalidChar", "char '&' is not expected.", q(r, o));
2140
+ o = f;
2141
+ } else if (n === !0 && !$e(r[o]))
2142
+ return F("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 F("InvalidChar", "char '" + r[o] + "' is not expected.", q(r, o));
2149
+ }
2150
+ if (s) {
2151
+ if (t.length == 1)
2152
+ return F("InvalidTag", "Unclosed tag '" + t[0].tagName + "'.", q(r, t[0].tagStartPos));
2153
+ if (t.length > 0)
2154
+ return F("InvalidXml", "Invalid '" + JSON.stringify(t.map((o) => o.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
2155
+ } else return F("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 F("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 F("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 F("InvalidAttr", "Attribute '" + t[n][2] + "' is without value.", de(t[n]));
2226
+ if (t[n][3] === void 0 && !e.allowBooleanAttributes)
2227
+ return F("InvalidAttr", "boolean attribute '" + t[n][2] + "' is not allowed.", de(t[n]));
2228
+ const o = t[n][2];
2229
+ if (!ar(o))
2230
+ return F("InvalidAttr", "Attribute '" + o + "' is an invalid name.", de(t[n]));
2231
+ if (!s.hasOwnProperty(o))
2232
+ s[o] = 1;
2233
+ else
2234
+ return F("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 F(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 U = t.value[T];
3330
+ Array.isArray(U) ? U.forEach((V) => {
3331
+ g.push({ tagName: T, value: V });
3332
+ }) : g.push({ tagName: T, value: U });
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) => {
3337
+ let U = 0;
3338
+ for (let V = 0; V < T; V++)
3339
+ C.value[V].tagName === g && U++;
3340
+ return `${n.value}.${g}[${U}]`;
3341
+ }, S = (g, T) => `${g.tagName}-${T}`;
3342
+ return (g, T) => {
3343
+ const U = Me("XmlNode", !0);
3344
+ return x(), N("div", {
3345
+ class: "xml-node",
3346
+ style: I({ paddingLeft: g.level > 0 ? "16px" : "0" })
3347
+ }, [
3348
+ i.value ? (x(), N("div", en, [
3349
+ P.value ? (x(), N("div", tn, [
3350
+ E("span", {
3351
+ class: "xml-node__bracket",
3352
+ style: I({ color: g.theme.colors.xmlBracket })
3353
+ }, "<", 4),
3354
+ E("span", {
3355
+ class: "xml-node__tag",
3356
+ style: I({ color: g.theme.colors.xmlTag })
3357
+ }, j(g.tagName), 5),
3358
+ (x(!0), N(he, null, pe(h.value, (V, Y) => (x(), N("span", {
3359
+ key: Y,
3360
+ class: "xml-node__attribute"
3361
+ }, [
3362
+ E("span", {
3363
+ class: "xml-node__attr-name",
3364
+ style: I({ color: g.theme.colors.xmlAttribute })
3365
+ }, j(Y), 5),
3366
+ E("span", {
3367
+ class: "xml-node__equals",
3368
+ style: I({ color: g.theme.colors.xmlEquals })
3369
+ }, "=", 4),
3370
+ E("span", {
3371
+ class: "xml-node__quote",
3372
+ style: I({ color: g.theme.colors.xmlQuote })
3373
+ }, '"', 4),
3374
+ E("span", {
3375
+ class: "xml-node__attr-value",
3376
+ style: I({ color: g.theme.colors.xmlAttributeValue })
3377
+ }, j(V), 5),
3378
+ E("span", {
3379
+ class: "xml-node__quote",
3380
+ style: I({ color: g.theme.colors.xmlQuote })
3381
+ }, '"', 4)
3382
+ ]))), 128)),
3383
+ E("span", {
3384
+ class: "xml-node__bracket",
3385
+ style: I({ color: g.theme.colors.xmlBracket })
3386
+ }, ">", 4),
3387
+ E("span", {
3388
+ class: "xml-node__text-content",
3389
+ style: I({ color: g.theme.colors.xmlText })
3390
+ }, j(f.value), 5),
3391
+ E("span", {
3392
+ class: "xml-node__bracket",
3393
+ style: I({ color: g.theme.colors.xmlBracket })
3394
+ }, "</", 4),
3395
+ E("span", {
3396
+ class: "xml-node__tag",
3397
+ style: I({ color: g.theme.colors.xmlTag })
3398
+ }, j(g.tagName), 5),
3399
+ E("span", {
3400
+ class: "xml-node__bracket",
3401
+ style: I({ color: g.theme.colors.xmlBracket })
3402
+ }, ">", 4)
3403
+ ])) : (x(), N("div", rn, [
3404
+ E("div", nn, [
3405
+ O.value ? (x(), N("span", {
3406
+ key: 0,
3407
+ class: "xml-node__clickable-part",
3408
+ onClick: T[0] || (T[0] = (V) => M()),
3409
+ title: o.value ? "Click to collapse" : "Click to expand"
3410
+ }, [
3411
+ E("span", {
3412
+ class: "xml-node__bracket",
3413
+ style: I({ color: g.theme.colors.xmlBracket })
3414
+ }, "<", 4),
3415
+ E("span", {
3416
+ class: "xml-node__tag",
3417
+ style: I({ color: g.theme.colors.xmlTag })
3418
+ }, j(g.tagName), 5)
3419
+ ], 8, sn)) : (x(), N("span", on, [
3420
+ E("span", {
3421
+ class: "xml-node__bracket",
3422
+ style: I({ color: g.theme.colors.xmlBracket })
3423
+ }, "<", 4),
3424
+ E("span", {
3425
+ class: "xml-node__tag",
3426
+ style: I({ color: g.theme.colors.xmlTag })
3427
+ }, j(g.tagName), 5)
3428
+ ])),
3429
+ (x(!0), N(he, null, pe(h.value, (V, Y) => (x(), N("span", {
3430
+ key: Y,
3431
+ class: "xml-node__attribute"
3432
+ }, [
3433
+ E("span", {
3434
+ class: "xml-node__attr-name",
3435
+ style: I({ color: g.theme.colors.xmlAttribute })
3436
+ }, j(Y), 5),
3437
+ E("span", {
3438
+ class: "xml-node__equals",
3439
+ style: I({ color: g.theme.colors.xmlEquals })
3440
+ }, "=", 4),
3441
+ E("span", {
3442
+ class: "xml-node__quote",
3443
+ style: I({ color: g.theme.colors.xmlQuote })
3444
+ }, '"', 4),
3445
+ E("span", {
3446
+ class: "xml-node__attr-value",
3447
+ style: I({ color: g.theme.colors.xmlAttributeValue })
3448
+ }, j(V), 5),
3449
+ E("span", {
3450
+ class: "xml-node__quote",
3451
+ style: I({ color: g.theme.colors.xmlQuote })
3452
+ }, '"', 4)
3453
+ ]))), 128)),
3454
+ O.value ? (x(), N("span", {
3455
+ key: 2,
3456
+ class: "xml-node__clickable-part",
3457
+ onClick: T[1] || (T[1] = (V) => M()),
3458
+ title: o.value ? "Click to collapse" : "Click to expand"
3459
+ }, [
3460
+ E("span", {
3461
+ class: "xml-node__bracket",
3462
+ style: I({ color: g.theme.colors.xmlBracket })
3463
+ }, ">", 4)
3464
+ ], 8, an)) : (x(), N("span", {
3465
+ key: 3,
3466
+ class: "xml-node__bracket",
3467
+ style: I({ color: g.theme.colors.xmlBracket })
3468
+ }, j(O.value ? ">" : "/>"), 5)),
3469
+ !o.value && O.value ? (x(), N("span", {
3470
+ key: 4,
3471
+ class: "xml-node__collapsed xml-node__collapsed--clickable",
3472
+ style: I({ color: g.theme.colors.textSecondary }),
3473
+ onClick: T[2] || (T[2] = (V) => M()),
3474
+ title: "Click to expand"
3475
+ }, "...", 4)) : X("", !0)
3476
+ ]),
3477
+ o.value && O.value ? (x(), N("div", ln, [
3478
+ C.value.length === 0 && f.value.trim() ? (x(), N("div", un, [
3479
+ E("span", {
3480
+ class: "xml-node__text-content",
3481
+ style: I({ color: g.theme.colors.xmlText })
3482
+ }, j(f.value), 5)
3483
+ ])) : X("", !0),
3484
+ (x(!0), N(he, null, pe(C.value, (V, Y) => (x(), Xe(U, {
3485
+ key: S(V, Y),
3486
+ value: V.value,
3487
+ "tag-name": V.tagName,
3488
+ level: g.level + 1,
3489
+ path: k(V.tagName, Y),
3490
+ expanded: g.expanded,
3491
+ theme: g.theme,
3492
+ onToggleExpand: T[3] || (T[3] = (Z) => g.$emit("toggle-expand", Z)),
3493
+ onCopy: T[4] || (T[4] = (Z) => g.$emit("copy", Z))
3494
+ }, null, 8, ["value", "tag-name", "level", "path", "expanded", "theme"]))), 128))
3495
+ ])) : X("", !0),
3496
+ o.value && O.value ? (x(), N("div", cn, [
3497
+ E("span", {
3498
+ class: "xml-node__clickable-part",
3499
+ onClick: T[5] || (T[5] = (V) => M()),
3500
+ title: "Click to collapse"
3501
+ }, [
3502
+ E("span", {
3503
+ class: "xml-node__bracket",
3504
+ style: I({ color: g.theme.colors.xmlBracket })
3505
+ }, "</", 4),
3506
+ E("span", {
3507
+ class: "xml-node__tag",
3508
+ style: I({ color: g.theme.colors.xmlTag })
3509
+ }, j(g.tagName), 5),
3510
+ E("span", {
3511
+ class: "xml-node__bracket",
3512
+ style: I({ color: g.theme.colors.xmlBracket })
3513
+ }, ">", 4)
3514
+ ])
3515
+ ])) : X("", !0)
3516
+ ]))
3517
+ ])) : u.value ? (x(), N("div", dn, [
3518
+ E("span", {
3519
+ class: "xml-node__text-content",
3520
+ style: I({ color: g.theme.colors.xmlText })
3521
+ }, j(f.value), 5)
3522
+ ])) : a.value ? (x(), N("div", fn, [
3523
+ E("span", {
3524
+ style: I({ color: g.theme.colors.xmlComment })
3525
+ }, " <!-- " + j(y.value) + " --> ", 5)
3526
+ ])) : l.value ? (x(), N("div", hn, [
3527
+ E("span", {
3528
+ style: I({ color: g.theme.colors.xmlCdata })
3529
+ }, " <![CDATA[" + j(m.value) + "]]> ", 5)
3530
+ ])) : X("", !0)
3531
+ ], 4);
3532
+ };
3533
+ }
3534
+ }), gn = /* @__PURE__ */ me(pn, [["__scopeId", "data-v-c8f9132d"]]), bn = {
3535
+ name: "github-light",
3536
+ colors: {
3537
+ // 背景色
3538
+ background: "#ffffff",
3539
+ surfaceBackground: "#f6f8fa",
3540
+ // 边框色
3541
+ border: "#d0d7de",
3542
+ // 文本色
3543
+ text: "#24292f",
3544
+ textSecondary: "#57606a",
3545
+ // 按钮样式
3546
+ buttonBackground: "#f6f8fa",
3547
+ buttonBackgroundHover: "#f3f4f6",
3548
+ buttonBorder: "#d0d7de",
3549
+ buttonText: "#24292f",
3550
+ buttonPrimary: "#1f883d",
3551
+ buttonPrimaryHover: "#1a7f37",
3552
+ // 状态指示
3553
+ success: "#1f883d",
3554
+ successBackground: "#dafbe1",
3555
+ error: "#cf222e",
3556
+ errorBackground: "#ffebe9",
3557
+ // XML 语法高亮
3558
+ xmlTag: "#116329",
3559
+ // 标签名 - 绿色
3560
+ xmlAttribute: "#0550ae",
3561
+ // 属性名 - 蓝色
3562
+ xmlAttributeValue: "#0a3069",
3563
+ // 属性值 - 深蓝
3564
+ xmlText: "#24292f",
3565
+ // 文本内容 - 黑色
3566
+ xmlComment: "#6e7781",
3567
+ // 注释 - 灰色
3568
+ xmlCdata: "#8250df",
3569
+ // CDATA - 紫色
3570
+ xmlDeclaration: "#953800",
3571
+ // 声明 - 橙色
3572
+ xmlBracket: "#6e7781",
3573
+ // 括号 - 灰色
3574
+ xmlEquals: "#6e7781",
3575
+ // 等号 - 灰色
3576
+ xmlQuote: "#0550ae"
3577
+ // 引号 - 蓝色
3578
+ }
3579
+ }, mn = {
3580
+ name: "github-dark",
3581
+ colors: {
3582
+ // 背景色
3583
+ background: "#0d1117",
3584
+ surfaceBackground: "#161b22",
3585
+ // 边框色
3586
+ border: "#30363d",
3587
+ // 文本色
3588
+ text: "#c9d1d9",
3589
+ textSecondary: "#8b949e",
3590
+ // 按钮样式
3591
+ buttonBackground: "#21262d",
3592
+ buttonBackgroundHover: "#30363d",
3593
+ buttonBorder: "#30363d",
3594
+ buttonText: "#c9d1d9",
3595
+ buttonPrimary: "#238636",
3596
+ buttonPrimaryHover: "#2ea043",
3597
+ // 状态指示
3598
+ success: "#3fb950",
3599
+ successBackground: "#0f2e1c",
3600
+ error: "#f85149",
3601
+ errorBackground: "#3d1319",
3602
+ // XML 语法高亮
3603
+ xmlTag: "#7ee787",
3604
+ // 标签名 - 亮绿色
3605
+ xmlAttribute: "#79c0ff",
3606
+ // 属性名 - 亮蓝色
3607
+ xmlAttributeValue: "#a5d6ff",
3608
+ // 属性值 - 淡蓝色
3609
+ xmlText: "#c9d1d9",
3610
+ // 文本内容 - 白色
3611
+ xmlComment: "#8b949e",
3612
+ // 注释 - 灰色
3613
+ xmlCdata: "#d2a8ff",
3614
+ // CDATA - 紫色
3615
+ xmlDeclaration: "#ffa657",
3616
+ // 声明 - 橙色
3617
+ xmlBracket: "#8b949e",
3618
+ // 括号 - 灰色
3619
+ xmlEquals: "#8b949e",
3620
+ // 等号 - 灰色
3621
+ xmlQuote: "#79c0ff"
3622
+ // 引号 - 亮蓝色
3623
+ }
3624
+ }, yn = {
3625
+ name: "min-light",
3626
+ colors: {
3627
+ // 背景色
3628
+ background: "#ffffff",
3629
+ surfaceBackground: "#fafafa",
3630
+ // 边框色
3631
+ border: "#e5e5e5",
3632
+ // 文本色
3633
+ text: "#171717",
3634
+ textSecondary: "#737373",
3635
+ // 按钮样式
3636
+ buttonBackground: "#fafafa",
3637
+ buttonBackgroundHover: "#f5f5f5",
3638
+ buttonBorder: "#e5e5e5",
3639
+ buttonText: "#171717",
3640
+ buttonPrimary: "#22c55e",
3641
+ buttonPrimaryHover: "#16a34a",
3642
+ // 状态指示
3643
+ success: "#22c55e",
3644
+ successBackground: "#dcfce7",
3645
+ error: "#ef4444",
3646
+ errorBackground: "#fee2e2",
3647
+ // XML 语法高亮
3648
+ xmlTag: "#16a34a",
3649
+ // 标签名 - 绿色
3650
+ xmlAttribute: "#2563eb",
3651
+ // 属性名 - 蓝色
3652
+ xmlAttributeValue: "#1e40af",
3653
+ // 属性值 - 深蓝
3654
+ xmlText: "#171717",
3655
+ // 文本内容 - 黑色
3656
+ xmlComment: "#737373",
3657
+ // 注释 - 灰色
3658
+ xmlCdata: "#9333ea",
3659
+ // CDATA - 紫色
3660
+ xmlDeclaration: "#ea580c",
3661
+ // 声明 - 橙色
3662
+ xmlBracket: "#737373",
3663
+ // 括号 - 灰色
3664
+ xmlEquals: "#737373",
3665
+ // 等号 - 灰色
3666
+ xmlQuote: "#2563eb"
3667
+ // 引号 - 蓝色
3668
+ }
3669
+ }, En = {
3670
+ name: "slack-ochin",
3671
+ colors: {
3672
+ // 背景色
3673
+ background: "#fef5ed",
3674
+ surfaceBackground: "#fef9f3",
3675
+ // 边框色
3676
+ border: "#e9dcc9",
3677
+ // 文本色
3678
+ text: "#3d3c40",
3679
+ textSecondary: "#616061",
3680
+ // 按钮样式
3681
+ buttonBackground: "#fef9f3",
3682
+ buttonBackgroundHover: "#f9f0e5",
3683
+ buttonBorder: "#e9dcc9",
3684
+ buttonText: "#3d3c40",
3685
+ buttonPrimary: "#007a5a",
3686
+ buttonPrimaryHover: "#006644",
3687
+ // 状态指示
3688
+ success: "#007a5a",
3689
+ successBackground: "#d1f4e0",
3690
+ error: "#e01e5a",
3691
+ errorBackground: "#ffdbea",
3692
+ // XML 语法高亮
3693
+ xmlTag: "#007a5a",
3694
+ // 标签名 - 绿色
3695
+ xmlAttribute: "#1264a3",
3696
+ // 属性名 - 蓝色
3697
+ xmlAttributeValue: "#0b4c8c",
3698
+ // 属性值 - 深蓝
3699
+ xmlText: "#3d3c40",
3700
+ // 文本内容 - 黑色
3701
+ xmlComment: "#616061",
3702
+ // 注释 - 灰色
3703
+ xmlCdata: "#8b2eff",
3704
+ // CDATA - 紫色
3705
+ xmlDeclaration: "#e8912d",
3706
+ // 声明 - 橙色
3707
+ xmlBracket: "#616061",
3708
+ // 括号 - 灰色
3709
+ xmlEquals: "#616061",
3710
+ // 等号 - 灰色
3711
+ xmlQuote: "#1264a3"
3712
+ // 引号 - 蓝色
3713
+ }
3714
+ }, je = {
3715
+ "github-light": bn,
3716
+ "github-dark": mn,
3717
+ "min-light": yn,
3718
+ "slack-ochin": En
3719
+ }, vn = (r) => je[r] || je["github-light"], _n = {
3720
+ key: 0,
3721
+ class: "xml-format__toolbar"
3722
+ }, xn = { class: "xml-format__actions" }, Nn = ["disabled"], kn = ["disabled"], wn = ["disabled"], An = ["disabled"], Cn = ["disabled"], On = { class: "xml-format__info" }, Tn = {
3723
+ key: 0,
3724
+ class: "xml-format__status xml-format__status--success"
3725
+ }, Pn = {
3726
+ key: 1,
3727
+ class: "xml-format__status xml-format__status--error"
3728
+ }, Sn = { class: "xml-format__content" }, In = {
3729
+ key: 0,
3730
+ class: "xml-format__error"
3731
+ }, $n = {
3732
+ key: 1,
3733
+ class: "xml-format__viewer"
3734
+ }, Bn = /* @__PURE__ */ be({
3735
+ __name: "index",
3736
+ props: {
3737
+ modelValue: { default: "" },
3738
+ readonly: { type: Boolean, default: !1 },
3739
+ maxDepth: { default: 10 },
3740
+ showToolbar: { type: Boolean, default: !0 },
3741
+ theme: { default: "github-light" },
3742
+ showComments: { type: Boolean, default: !0 },
3743
+ showCdata: { type: Boolean, default: !0 },
3744
+ preserveWhitespace: { type: Boolean, default: !1 }
3745
+ },
3746
+ emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress", "format"],
3747
+ setup(r, { emit: e }) {
3748
+ Ce((k) => ({
3749
+ 19083852: a.value.colors.border,
3750
+ "9aacd358": a.value.colors.background,
3751
+ "34ab9c56": a.value.colors.surfaceBackground,
3752
+ "43d12cb8": a.value.colors.buttonBorder,
3753
+ "0f3bcea6": a.value.colors.buttonBackground,
3754
+ "177038a5": a.value.colors.buttonText,
3755
+ "39377b94": a.value.colors.buttonBackgroundHover,
3756
+ "63de70ec": a.value.colors.buttonPrimary,
3757
+ "0009905c": a.value.colors.buttonPrimaryHover,
3758
+ d69bfec6: a.value.colors.success,
3759
+ "55ddd1ab": a.value.colors.successBackground,
3760
+ "4b4cf122": a.value.colors.error,
3761
+ "5344c020": a.value.colors.errorBackground,
3762
+ "3400dad3": a.value.colors.text
3763
+ }));
3764
+ 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(() => {
3765
+ if (!n.value) return {};
3766
+ const k = {};
3767
+ return Object.keys(n.value).forEach((S) => {
3768
+ !S.startsWith("?") && !S.startsWith("#") && (k[S] = n.value[S]);
3769
+ }), k;
3770
+ }), h = (k) => {
3771
+ if (!k || !k.trim()) {
3772
+ o.value = "", n.value = null;
3773
+ return;
3774
+ }
3775
+ try {
3776
+ const S = Wr(k);
3777
+ if (!S.valid) {
3778
+ o.value = S.error || "Invalid XML", n.value = null;
3779
+ return;
3780
+ }
3781
+ n.value = ze(k), o.value = "", ce(() => {
3782
+ y();
3783
+ });
3784
+ } catch (S) {
3785
+ o.value = S instanceof Error ? S.message : "Unknown parse error", n.value = null;
3786
+ }
3787
+ }, f = (k) => {
3788
+ i.value.has(k) ? i.value.delete(k) : i.value.add(k);
3789
+ }, y = () => {
3790
+ const k = /* @__PURE__ */ new Set(), S = (g, T = "") => {
3791
+ g !== null && typeof g == "object" && (T && k.add(T), Object.keys(g).forEach((U) => {
3792
+ if (U.startsWith("@_") || U === "#text") return;
3793
+ const V = g[U], Y = T ? `${T}.${U}[0]` : U;
3794
+ Array.isArray(V) ? V.forEach((Z, D) => {
3795
+ const J = T ? `${T}.${U}[${D}]` : `${U}[${D}]`;
3796
+ S(Z, J);
3797
+ }) : S(V, Y);
3798
+ }));
3799
+ };
3800
+ Object.keys(l.value).forEach((g) => {
3801
+ S(l.value[g], g);
3802
+ }), i.value = k, s("expand-all");
3803
+ }, m = () => {
3804
+ i.value.clear(), s("collapse-all");
3805
+ }, C = async () => {
3806
+ if (!(!u.value || !n.value))
3807
+ try {
3808
+ const k = Te(n.value, {
3809
+ format: !0,
3810
+ indentBy: " "
3811
+ });
3812
+ await navigator.clipboard.writeText(k), s("copy-success", k);
3813
+ } catch (k) {
3814
+ const S = k instanceof Error ? k : new Error("Copy failed");
3815
+ s("copy-error", S), console.error("Failed to copy XML:", k);
3816
+ }
3817
+ }, O = () => {
3818
+ if (!(!u.value || !n.value))
3819
+ try {
3820
+ const k = Zr(n.value);
3821
+ s("update:modelValue", k), s("compress", k);
3822
+ } catch (k) {
3823
+ console.error("Failed to compress XML:", k);
3824
+ }
3825
+ }, P = () => {
3826
+ if (u.value)
3827
+ try {
3828
+ const k = zr(t.modelValue, {
3829
+ format: !0,
3830
+ indentBy: " "
3831
+ });
3832
+ s("update:modelValue", k), s("format", k);
3833
+ } catch (k) {
3834
+ console.error("Failed to format XML:", k);
3835
+ }
3836
+ }, M = async (k) => {
3837
+ try {
3838
+ const S = typeof k == "string" ? k : JSON.stringify(k, null, 2);
3839
+ await navigator.clipboard.writeText(S), s("copy-success", S);
3840
+ } catch (S) {
3841
+ const g = S instanceof Error ? S : new Error("Copy failed");
3842
+ s("copy-error", g), console.error("Failed to copy value:", S);
3843
+ }
3844
+ };
3845
+ return Fe(() => t.modelValue, (k) => {
3846
+ h(k);
3847
+ }, { immediate: !0 }), (k, S) => (x(), N("div", {
3848
+ class: Oe(["xml-format", `xml-format--${a.value.name}`])
3849
+ }, [
3850
+ k.showToolbar ? (x(), N("div", _n, [
3851
+ E("div", xn, [
3852
+ E("button", {
3853
+ class: "xml-format__btn xml-format__btn--primary",
3854
+ onClick: C,
3855
+ disabled: !u.value,
3856
+ title: "Copy XML"
3857
+ }, " 📋 Copy ", 8, Nn),
3858
+ E("button", {
3859
+ class: "xml-format__btn xml-format__btn--secondary",
3860
+ onClick: y,
3861
+ disabled: !u.value,
3862
+ title: "Expand All"
3863
+ }, " ⬇️ Expand All ", 8, kn),
3864
+ E("button", {
3865
+ class: "xml-format__btn xml-format__btn--secondary",
3866
+ onClick: m,
3867
+ disabled: !u.value,
3868
+ title: "Collapse All"
3869
+ }, " ➡️ Collapse All ", 8, wn),
3870
+ E("button", {
3871
+ class: "xml-format__btn xml-format__btn--secondary",
3872
+ onClick: O,
3873
+ disabled: !u.value,
3874
+ title: "Compress XML"
3875
+ }, " 📦 Compress ", 8, An),
3876
+ E("button", {
3877
+ class: "xml-format__btn xml-format__btn--secondary",
3878
+ onClick: P,
3879
+ disabled: !u.value,
3880
+ title: "Format XML"
3881
+ }, " ✨ Format ", 8, Cn)
3882
+ ]),
3883
+ E("div", On, [
3884
+ u.value ? (x(), N("span", Tn, " ✅ Valid XML ")) : (x(), N("span", Pn, " ❌ Invalid XML "))
3885
+ ])
3886
+ ])) : X("", !0),
3887
+ E("div", Sn, [
3888
+ u.value ? (x(), N("div", $n, [
3889
+ (x(!0), N(he, null, pe(l.value, (g, T) => (x(), Xe(gn, {
3890
+ key: String(T),
3891
+ value: g,
3892
+ "tag-name": String(T),
3893
+ level: 0,
3894
+ expanded: i.value,
3895
+ theme: a.value,
3896
+ onToggleExpand: f,
3897
+ onCopy: M
3898
+ }, null, 8, ["value", "tag-name", "expanded", "theme"]))), 128))
3899
+ ])) : (x(), N("div", In, [
3900
+ S[0] || (S[0] = E("h4", null, "XML Parse Error:", -1)),
3901
+ E("pre", null, j(o.value), 1)
3902
+ ]))
3903
+ ])
3904
+ ], 2));
3905
+ }
3906
+ }), Un = /* @__PURE__ */ me(Bn, [["__scopeId", "data-v-ec8763a7"]]), Ln = [Wt], Vn = (r) => {
3907
+ Ln.forEach((e) => {
2040
3908
  const t = e.name || e.__name || "UnknownComponent";
2041
3909
  r.component(t, e);
2042
3910
  });
2043
- }, kt = {
2044
- install: Et
3911
+ }, Fn = {
3912
+ install: Vn
2045
3913
  };
2046
3914
  export {
2047
- vt as JsonFormat,
2048
- kt as default
3915
+ Wt as JsonFormat,
3916
+ Un as XmlFormat,
3917
+ Fn as default
2049
3918
  };