lone-format 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lone-format.css +1 -1
- package/dist/lone-format.js +1332 -1205
- package/dist/lone-format.umd.cjs +11 -11
- package/package.json +1 -1
package/dist/lone-format.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
class
|
|
1
|
+
import { defineComponent as be, useCssVars as Ce, ref as W, computed as V, resolveComponent as je, createElementBlock as A, openBlock as k, createElementVNode as y, createCommentVNode as H, withKeys as de, withModifiers as Ee, toDisplayString as B, Fragment as re, renderList as ae, createVNode as Me, normalizeClass as Oe, nextTick as he, watch as Ue, normalizeStyle as N, createBlock as Fe } from "vue";
|
|
2
|
+
class ze {
|
|
3
3
|
/**
|
|
4
4
|
* @callback HookCallback
|
|
5
5
|
* @this {*|Jsep} this
|
|
@@ -42,7 +42,7 @@ class Je {
|
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
class
|
|
45
|
+
class De {
|
|
46
46
|
constructor(e) {
|
|
47
47
|
this.jsep = e, this.registered = {};
|
|
48
48
|
}
|
|
@@ -69,7 +69,7 @@ class et {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
class
|
|
72
|
+
class u {
|
|
73
73
|
/**
|
|
74
74
|
* @returns {string}
|
|
75
75
|
*/
|
|
@@ -80,7 +80,7 @@ class c {
|
|
|
80
80
|
* @returns {string}
|
|
81
81
|
*/
|
|
82
82
|
static toString() {
|
|
83
|
-
return "JavaScript Expression Parser (JSEP) v" +
|
|
83
|
+
return "JavaScript Expression Parser (JSEP) v" + u.version;
|
|
84
84
|
}
|
|
85
85
|
// ==================== CONFIG ================================
|
|
86
86
|
/**
|
|
@@ -89,7 +89,7 @@ class c {
|
|
|
89
89
|
* @returns {Jsep}
|
|
90
90
|
*/
|
|
91
91
|
static addUnaryOp(e) {
|
|
92
|
-
return
|
|
92
|
+
return u.max_unop_len = Math.max(e.length, u.max_unop_len), u.unary_ops[e] = 1, u;
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* @method jsep.addBinaryOp
|
|
@@ -99,7 +99,7 @@ class c {
|
|
|
99
99
|
* @returns {Jsep}
|
|
100
100
|
*/
|
|
101
101
|
static addBinaryOp(e, t, s) {
|
|
102
|
-
return
|
|
102
|
+
return u.max_binop_len = Math.max(e.length, u.max_binop_len), u.binary_ops[e] = t, s ? u.right_associative.add(e) : u.right_associative.delete(e), u;
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
105
|
* @method addIdentifierChar
|
|
@@ -107,7 +107,7 @@ class c {
|
|
|
107
107
|
* @returns {Jsep}
|
|
108
108
|
*/
|
|
109
109
|
static addIdentifierChar(e) {
|
|
110
|
-
return
|
|
110
|
+
return u.additional_identifier_chars.add(e), u;
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
113
|
* @method addLiteral
|
|
@@ -116,7 +116,7 @@ class c {
|
|
|
116
116
|
* @returns {Jsep}
|
|
117
117
|
*/
|
|
118
118
|
static addLiteral(e, t) {
|
|
119
|
-
return
|
|
119
|
+
return u.literals[e] = t, u;
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
122
|
* @method removeUnaryOp
|
|
@@ -124,14 +124,14 @@ class c {
|
|
|
124
124
|
* @returns {Jsep}
|
|
125
125
|
*/
|
|
126
126
|
static removeUnaryOp(e) {
|
|
127
|
-
return delete
|
|
127
|
+
return delete u.unary_ops[e], e.length === u.max_unop_len && (u.max_unop_len = u.getMaxKeyLen(u.unary_ops)), u;
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
130
|
* @method removeAllUnaryOps
|
|
131
131
|
* @returns {Jsep}
|
|
132
132
|
*/
|
|
133
133
|
static removeAllUnaryOps() {
|
|
134
|
-
return
|
|
134
|
+
return u.unary_ops = {}, u.max_unop_len = 0, u;
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
137
|
* @method removeIdentifierChar
|
|
@@ -139,7 +139,7 @@ class c {
|
|
|
139
139
|
* @returns {Jsep}
|
|
140
140
|
*/
|
|
141
141
|
static removeIdentifierChar(e) {
|
|
142
|
-
return
|
|
142
|
+
return u.additional_identifier_chars.delete(e), u;
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
145
145
|
* @method removeBinaryOp
|
|
@@ -147,14 +147,14 @@ class c {
|
|
|
147
147
|
* @returns {Jsep}
|
|
148
148
|
*/
|
|
149
149
|
static removeBinaryOp(e) {
|
|
150
|
-
return delete
|
|
150
|
+
return delete u.binary_ops[e], e.length === u.max_binop_len && (u.max_binop_len = u.getMaxKeyLen(u.binary_ops)), u.right_associative.delete(e), u;
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
153
|
* @method removeAllBinaryOps
|
|
154
154
|
* @returns {Jsep}
|
|
155
155
|
*/
|
|
156
156
|
static removeAllBinaryOps() {
|
|
157
|
-
return
|
|
157
|
+
return u.binary_ops = {}, u.max_binop_len = 0, u;
|
|
158
158
|
}
|
|
159
159
|
/**
|
|
160
160
|
* @method removeLiteral
|
|
@@ -162,14 +162,14 @@ class c {
|
|
|
162
162
|
* @returns {Jsep}
|
|
163
163
|
*/
|
|
164
164
|
static removeLiteral(e) {
|
|
165
|
-
return delete
|
|
165
|
+
return delete u.literals[e], u;
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
168
|
* @method removeAllLiterals
|
|
169
169
|
* @returns {Jsep}
|
|
170
170
|
*/
|
|
171
171
|
static removeAllLiterals() {
|
|
172
|
-
return
|
|
172
|
+
return u.literals = {}, u;
|
|
173
173
|
}
|
|
174
174
|
// ==================== END CONFIG ============================
|
|
175
175
|
/**
|
|
@@ -196,7 +196,7 @@ class c {
|
|
|
196
196
|
* @returns {jsep.Expression}
|
|
197
197
|
*/
|
|
198
198
|
static parse(e) {
|
|
199
|
-
return new
|
|
199
|
+
return new u(e).parse();
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
202
|
* Get the longest key length of any object
|
|
@@ -220,7 +220,7 @@ class c {
|
|
|
220
220
|
* @returns {number}
|
|
221
221
|
*/
|
|
222
222
|
static binaryPrecedence(e) {
|
|
223
|
-
return
|
|
223
|
+
return u.binary_ops[e] || 0;
|
|
224
224
|
}
|
|
225
225
|
/**
|
|
226
226
|
* Looks for start of identifier
|
|
@@ -230,15 +230,15 @@ class c {
|
|
|
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 && !
|
|
234
|
-
|
|
233
|
+
e >= 128 && !u.binary_ops[String.fromCharCode(e)] || // any non-ASCII that is not an operator
|
|
234
|
+
u.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
|
|
241
|
+
return u.isIdentifierStart(e) || u.isDecimalDigit(e);
|
|
242
242
|
}
|
|
243
243
|
/**
|
|
244
244
|
* throw error at index of the expression
|
|
@@ -256,12 +256,12 @@ class c {
|
|
|
256
256
|
* @returns {?jsep.Expression}
|
|
257
257
|
*/
|
|
258
258
|
runHook(e, t) {
|
|
259
|
-
if (
|
|
259
|
+
if (u.hooks[e]) {
|
|
260
260
|
const s = {
|
|
261
261
|
context: this,
|
|
262
262
|
node: t
|
|
263
263
|
};
|
|
264
|
-
return
|
|
264
|
+
return u.hooks.run(e, s), s.node;
|
|
265
265
|
}
|
|
266
266
|
return t;
|
|
267
267
|
}
|
|
@@ -271,11 +271,11 @@ class c {
|
|
|
271
271
|
* @returns {?jsep.Expression}
|
|
272
272
|
*/
|
|
273
273
|
searchHook(e) {
|
|
274
|
-
if (
|
|
274
|
+
if (u.hooks[e]) {
|
|
275
275
|
const t = {
|
|
276
276
|
context: this
|
|
277
277
|
};
|
|
278
|
-
return
|
|
278
|
+
return u.hooks[e].find(function(s) {
|
|
279
279
|
return s.call(t.context, t), t.node;
|
|
280
280
|
}), t.node;
|
|
281
281
|
}
|
|
@@ -285,7 +285,7 @@ class c {
|
|
|
285
285
|
*/
|
|
286
286
|
gobbleSpaces() {
|
|
287
287
|
let e = this.code;
|
|
288
|
-
for (; e ===
|
|
288
|
+
for (; e === u.SPACE_CODE || e === u.TAB_CODE || e === u.LF_CODE || e === u.CR_CODE; )
|
|
289
289
|
e = this.expr.charCodeAt(++this.index);
|
|
290
290
|
this.runHook("gobble-spaces");
|
|
291
291
|
}
|
|
@@ -296,7 +296,7 @@ class c {
|
|
|
296
296
|
parse() {
|
|
297
297
|
this.runHook("before-all");
|
|
298
298
|
const e = this.gobbleExpressions(), t = e.length === 1 ? e[0] : {
|
|
299
|
-
type:
|
|
299
|
+
type: u.COMPOUND,
|
|
300
300
|
body: e
|
|
301
301
|
};
|
|
302
302
|
return this.runHook("after-all", t);
|
|
@@ -309,7 +309,7 @@ class c {
|
|
|
309
309
|
gobbleExpressions(e) {
|
|
310
310
|
let t = [], s, n;
|
|
311
311
|
for (; this.index < this.expr.length; )
|
|
312
|
-
if (s = this.code, s ===
|
|
312
|
+
if (s = this.code, s === u.SEMCOL_CODE || s === u.COMMA_CODE)
|
|
313
313
|
this.index++;
|
|
314
314
|
else if (n = this.gobbleExpression())
|
|
315
315
|
t.push(n);
|
|
@@ -337,9 +337,9 @@ class c {
|
|
|
337
337
|
*/
|
|
338
338
|
gobbleBinaryOp() {
|
|
339
339
|
this.gobbleSpaces();
|
|
340
|
-
let e = this.expr.substr(this.index,
|
|
340
|
+
let e = this.expr.substr(this.index, u.max_binop_len), t = e.length;
|
|
341
341
|
for (; t > 0; ) {
|
|
342
|
-
if (
|
|
342
|
+
if (u.binary_ops.hasOwnProperty(e) && (!u.isIdentifierStart(this.code) || this.index + e.length < this.expr.length && !u.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,36 +351,36 @@ class c {
|
|
|
351
351
|
* @returns {?jsep.BinaryExpression}
|
|
352
352
|
*/
|
|
353
353
|
gobbleBinaryExpression() {
|
|
354
|
-
let e, t, s, n, o, i,
|
|
354
|
+
let e, t, s, n, o, i, c, a, l;
|
|
355
355
|
if (i = this.gobbleToken(), !i || (t = this.gobbleBinaryOp(), !t))
|
|
356
356
|
return i;
|
|
357
357
|
for (o = {
|
|
358
358
|
value: t,
|
|
359
|
-
prec:
|
|
360
|
-
right_a:
|
|
361
|
-
},
|
|
362
|
-
if (s =
|
|
359
|
+
prec: u.binaryPrecedence(t),
|
|
360
|
+
right_a: u.right_associative.has(t)
|
|
361
|
+
}, c = this.gobbleToken(), c || this.throwError("Expected expression after " + t), n = [i, o, c]; t = this.gobbleBinaryOp(); ) {
|
|
362
|
+
if (s = u.binaryPrecedence(t), s === 0) {
|
|
363
363
|
this.index -= t.length;
|
|
364
364
|
break;
|
|
365
365
|
}
|
|
366
366
|
o = {
|
|
367
367
|
value: t,
|
|
368
368
|
prec: s,
|
|
369
|
-
right_a:
|
|
369
|
+
right_a: u.right_associative.has(t)
|
|
370
370
|
}, l = t;
|
|
371
371
|
const h = (f) => o.right_a && f.right_a ? s > f.prec : s <= f.prec;
|
|
372
372
|
for (; n.length > 2 && h(n[n.length - 2]); )
|
|
373
|
-
|
|
374
|
-
type:
|
|
373
|
+
c = n.pop(), t = n.pop().value, i = n.pop(), e = {
|
|
374
|
+
type: u.BINARY_EXP,
|
|
375
375
|
operator: t,
|
|
376
376
|
left: i,
|
|
377
|
-
right:
|
|
377
|
+
right: c
|
|
378
378
|
}, n.push(e);
|
|
379
379
|
e = this.gobbleToken(), e || this.throwError("Expected expression after " + l), n.push(o, e);
|
|
380
380
|
}
|
|
381
381
|
for (a = n.length - 1, e = n[a]; a > 1; )
|
|
382
382
|
e = {
|
|
383
|
-
type:
|
|
383
|
+
type: u.BINARY_EXP,
|
|
384
384
|
operator: n[a - 1].value,
|
|
385
385
|
left: n[a - 2],
|
|
386
386
|
right: e
|
|
@@ -396,19 +396,19 @@ class c {
|
|
|
396
396
|
let e, t, s, n;
|
|
397
397
|
if (this.gobbleSpaces(), n = this.searchHook("gobble-token"), n)
|
|
398
398
|
return this.runHook("after-token", n);
|
|
399
|
-
if (e = this.code,
|
|
399
|
+
if (e = this.code, u.isDecimalDigit(e) || e === u.PERIOD_CODE)
|
|
400
400
|
return this.gobbleNumericLiteral();
|
|
401
|
-
if (e ===
|
|
401
|
+
if (e === u.SQUOTE_CODE || e === u.DQUOTE_CODE)
|
|
402
402
|
n = this.gobbleStringLiteral();
|
|
403
|
-
else if (e ===
|
|
403
|
+
else if (e === u.OBRACK_CODE)
|
|
404
404
|
n = this.gobbleArray();
|
|
405
405
|
else {
|
|
406
|
-
for (t = this.expr.substr(this.index,
|
|
407
|
-
if (
|
|
406
|
+
for (t = this.expr.substr(this.index, u.max_unop_len), s = t.length; s > 0; ) {
|
|
407
|
+
if (u.unary_ops.hasOwnProperty(t) && (!u.isIdentifierStart(this.code) || this.index + t.length < this.expr.length && !u.isIdentifierPart(this.expr.charCodeAt(this.index + t.length)))) {
|
|
408
408
|
this.index += s;
|
|
409
409
|
const o = this.gobbleToken();
|
|
410
410
|
return o || this.throwError("missing unaryOp argument"), this.runHook("after-token", {
|
|
411
|
-
type:
|
|
411
|
+
type: u.UNARY_EXP,
|
|
412
412
|
operator: t,
|
|
413
413
|
argument: o,
|
|
414
414
|
prefix: !0
|
|
@@ -416,13 +416,13 @@ class c {
|
|
|
416
416
|
}
|
|
417
417
|
t = t.substr(0, --s);
|
|
418
418
|
}
|
|
419
|
-
|
|
420
|
-
type:
|
|
421
|
-
value:
|
|
419
|
+
u.isIdentifierStart(e) ? (n = this.gobbleIdentifier(), u.literals.hasOwnProperty(n.name) ? n = {
|
|
420
|
+
type: u.LITERAL,
|
|
421
|
+
value: u.literals[n.name],
|
|
422
422
|
raw: n.name
|
|
423
|
-
} : n.name ===
|
|
424
|
-
type:
|
|
425
|
-
})) : e ===
|
|
423
|
+
} : n.name === u.this_str && (n = {
|
|
424
|
+
type: u.THIS_EXP
|
|
425
|
+
})) : e === u.OPAREN_CODE && (n = this.gobbleGroup());
|
|
426
426
|
}
|
|
427
427
|
return n ? (n = this.gobbleTokenProperty(n), this.runHook("after-token", n)) : this.runHook("after-token", !1);
|
|
428
428
|
}
|
|
@@ -437,24 +437,24 @@ class c {
|
|
|
437
437
|
gobbleTokenProperty(e) {
|
|
438
438
|
this.gobbleSpaces();
|
|
439
439
|
let t = this.code;
|
|
440
|
-
for (; t ===
|
|
440
|
+
for (; t === u.PERIOD_CODE || t === u.OBRACK_CODE || t === u.OPAREN_CODE || t === u.QUMARK_CODE; ) {
|
|
441
441
|
let s;
|
|
442
|
-
if (t ===
|
|
443
|
-
if (this.expr.charCodeAt(this.index + 1) !==
|
|
442
|
+
if (t === u.QUMARK_CODE) {
|
|
443
|
+
if (this.expr.charCodeAt(this.index + 1) !== u.PERIOD_CODE)
|
|
444
444
|
break;
|
|
445
445
|
s = !0, this.index += 2, this.gobbleSpaces(), t = this.code;
|
|
446
446
|
}
|
|
447
|
-
this.index++, t ===
|
|
448
|
-
type:
|
|
447
|
+
this.index++, t === u.OBRACK_CODE ? (e = {
|
|
448
|
+
type: u.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 !==
|
|
453
|
-
type:
|
|
454
|
-
arguments: this.gobbleArguments(
|
|
452
|
+
}, e.property || this.throwError('Unexpected "' + this.char + '"'), this.gobbleSpaces(), t = this.code, t !== u.CBRACK_CODE && this.throwError("Unclosed ["), this.index++) : t === u.OPAREN_CODE ? e = {
|
|
453
|
+
type: u.CALL_EXP,
|
|
454
|
+
arguments: this.gobbleArguments(u.CPAREN_CODE),
|
|
455
455
|
callee: e
|
|
456
|
-
} : (t ===
|
|
457
|
-
type:
|
|
456
|
+
} : (t === u.PERIOD_CODE || s) && (s && this.index--, this.gobbleSpaces(), e = {
|
|
457
|
+
type: u.MEMBER_EXP,
|
|
458
458
|
computed: !1,
|
|
459
459
|
object: e,
|
|
460
460
|
property: this.gobbleIdentifier()
|
|
@@ -469,18 +469,18 @@ class c {
|
|
|
469
469
|
*/
|
|
470
470
|
gobbleNumericLiteral() {
|
|
471
471
|
let e = "", t, s;
|
|
472
|
-
for (;
|
|
472
|
+
for (; u.isDecimalDigit(this.code); )
|
|
473
473
|
e += this.expr.charAt(this.index++);
|
|
474
|
-
if (this.code ===
|
|
475
|
-
for (e += this.expr.charAt(this.index++);
|
|
474
|
+
if (this.code === u.PERIOD_CODE)
|
|
475
|
+
for (e += this.expr.charAt(this.index++); u.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++));
|
|
478
|
+
for (e += this.expr.charAt(this.index++), t = this.char, (t === "+" || t === "-") && (e += this.expr.charAt(this.index++)); u.isDecimalDigit(this.code); )
|
|
479
479
|
e += this.expr.charAt(this.index++);
|
|
480
|
-
|
|
480
|
+
u.isDecimalDigit(this.expr.charCodeAt(this.index - 1)) || this.throwError("Expected exponent (" + e + this.char + ")");
|
|
481
481
|
}
|
|
482
|
-
return s = this.code,
|
|
483
|
-
type:
|
|
482
|
+
return s = this.code, u.isIdentifierStart(s) ? this.throwError("Variable names cannot start with a number (" + e + this.char + ")") : (s === u.PERIOD_CODE || e.length === 1 && e.charCodeAt(0) === u.PERIOD_CODE) && this.throwError("Unexpected period"), {
|
|
483
|
+
type: u.LITERAL,
|
|
484
484
|
value: parseFloat(e),
|
|
485
485
|
raw: e
|
|
486
486
|
};
|
|
@@ -527,7 +527,7 @@ class c {
|
|
|
527
527
|
e += o;
|
|
528
528
|
}
|
|
529
529
|
return n || this.throwError('Unclosed quote after "' + e + '"'), {
|
|
530
|
-
type:
|
|
530
|
+
type: u.LITERAL,
|
|
531
531
|
value: e,
|
|
532
532
|
raw: this.expr.substring(t, this.index)
|
|
533
533
|
};
|
|
@@ -541,10 +541,10 @@ class c {
|
|
|
541
541
|
*/
|
|
542
542
|
gobbleIdentifier() {
|
|
543
543
|
let e = this.code, t = this.index;
|
|
544
|
-
for (
|
|
544
|
+
for (u.isIdentifierStart(e) ? this.index++ : this.throwError("Unexpected " + this.char); this.index < this.expr.length && (e = this.code, u.isIdentifierPart(e)); )
|
|
545
545
|
this.index++;
|
|
546
546
|
return {
|
|
547
|
-
type:
|
|
547
|
+
type: u.IDENTIFIER,
|
|
548
548
|
name: this.expr.slice(t, this.index)
|
|
549
549
|
};
|
|
550
550
|
}
|
|
@@ -564,13 +564,13 @@ class c {
|
|
|
564
564
|
this.gobbleSpaces();
|
|
565
565
|
let o = this.code;
|
|
566
566
|
if (o === e) {
|
|
567
|
-
s = !0, this.index++, e ===
|
|
567
|
+
s = !0, this.index++, e === u.CPAREN_CODE && n && n >= t.length && this.throwError("Unexpected token " + String.fromCharCode(e));
|
|
568
568
|
break;
|
|
569
|
-
} else if (o ===
|
|
569
|
+
} else if (o === u.COMMA_CODE) {
|
|
570
570
|
if (this.index++, n++, n !== t.length) {
|
|
571
|
-
if (e ===
|
|
571
|
+
if (e === u.CPAREN_CODE)
|
|
572
572
|
this.throwError("Unexpected token ,");
|
|
573
|
-
else if (e ===
|
|
573
|
+
else if (e === u.CBRACK_CODE)
|
|
574
574
|
for (let i = t.length; i < n; i++)
|
|
575
575
|
t.push(null);
|
|
576
576
|
}
|
|
@@ -578,7 +578,7 @@ class c {
|
|
|
578
578
|
this.throwError("Expected comma");
|
|
579
579
|
else {
|
|
580
580
|
const i = this.gobbleExpression();
|
|
581
|
-
(!i || i.type ===
|
|
581
|
+
(!i || i.type === u.COMPOUND) && this.throwError("Expected comma"), t.push(i);
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
584
|
return s || this.throwError("Expected " + String.fromCharCode(e)), t;
|
|
@@ -594,10 +594,10 @@ class c {
|
|
|
594
594
|
*/
|
|
595
595
|
gobbleGroup() {
|
|
596
596
|
this.index++;
|
|
597
|
-
let e = this.gobbleExpressions(
|
|
598
|
-
if (this.code ===
|
|
597
|
+
let e = this.gobbleExpressions(u.CPAREN_CODE);
|
|
598
|
+
if (this.code === u.CPAREN_CODE)
|
|
599
599
|
return this.index++, e.length === 1 ? e[0] : e.length ? {
|
|
600
|
-
type:
|
|
600
|
+
type: u.SEQUENCE_EXP,
|
|
601
601
|
expressions: e
|
|
602
602
|
} : !1;
|
|
603
603
|
this.throwError("Unclosed (");
|
|
@@ -610,15 +610,15 @@ class c {
|
|
|
610
610
|
*/
|
|
611
611
|
gobbleArray() {
|
|
612
612
|
return this.index++, {
|
|
613
|
-
type:
|
|
614
|
-
elements: this.gobbleArguments(
|
|
613
|
+
type: u.ARRAY_EXP,
|
|
614
|
+
elements: this.gobbleArguments(u.CBRACK_CODE)
|
|
615
615
|
};
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
-
const
|
|
619
|
-
Object.assign(
|
|
620
|
-
hooks:
|
|
621
|
-
plugins: new
|
|
618
|
+
const Je = new ze();
|
|
619
|
+
Object.assign(u, {
|
|
620
|
+
hooks: Je,
|
|
621
|
+
plugins: new De(u),
|
|
622
622
|
// Node Types
|
|
623
623
|
// ----------
|
|
624
624
|
// This is the full set of types that any JSEP node can be.
|
|
@@ -712,16 +712,16 @@ Object.assign(c, {
|
|
|
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
|
-
|
|
716
|
-
|
|
717
|
-
const
|
|
715
|
+
u.max_unop_len = u.getMaxKeyLen(u.unary_ops);
|
|
716
|
+
u.max_binop_len = u.getMaxKeyLen(u.binary_ops);
|
|
717
|
+
const ee = (r) => new u(r).parse(), et = Object.getOwnPropertyNames(class {
|
|
718
718
|
});
|
|
719
|
-
Object.getOwnPropertyNames(
|
|
720
|
-
|
|
719
|
+
Object.getOwnPropertyNames(u).filter((r) => !et.includes(r) && ee[r] === void 0).forEach((r) => {
|
|
720
|
+
ee[r] = u[r];
|
|
721
721
|
});
|
|
722
|
-
|
|
723
|
-
const
|
|
724
|
-
var
|
|
722
|
+
ee.Jsep = u;
|
|
723
|
+
const tt = "ConditionalExpression";
|
|
724
|
+
var rt = {
|
|
725
725
|
name: "ternary",
|
|
726
726
|
init(r) {
|
|
727
727
|
r.hooks.add("after-expression", function(t) {
|
|
@@ -732,7 +732,7 @@ var st = {
|
|
|
732
732
|
this.index++;
|
|
733
733
|
const o = this.gobbleExpression();
|
|
734
734
|
if (o || this.throwError("Expected expression"), t.node = {
|
|
735
|
-
type:
|
|
735
|
+
type: tt,
|
|
736
736
|
test: s,
|
|
737
737
|
consequent: n,
|
|
738
738
|
alternate: o
|
|
@@ -748,17 +748,17 @@ var st = {
|
|
|
748
748
|
});
|
|
749
749
|
}
|
|
750
750
|
};
|
|
751
|
-
|
|
752
|
-
const
|
|
753
|
-
var
|
|
751
|
+
ee.plugins.register(rt);
|
|
752
|
+
const $e = 47, nt = 92;
|
|
753
|
+
var st = {
|
|
754
754
|
name: "regex",
|
|
755
755
|
init(r) {
|
|
756
756
|
r.hooks.add("gobble-token", function(t) {
|
|
757
|
-
if (this.code ===
|
|
757
|
+
if (this.code === $e) {
|
|
758
758
|
const s = ++this.index;
|
|
759
759
|
let n = !1;
|
|
760
760
|
for (; this.index < this.expr.length; ) {
|
|
761
|
-
if (this.code ===
|
|
761
|
+
if (this.code === $e && !n) {
|
|
762
762
|
const o = this.expr.slice(s, this.index);
|
|
763
763
|
let i = "";
|
|
764
764
|
for (; ++this.index < this.expr.length; ) {
|
|
@@ -768,46 +768,46 @@ var it = {
|
|
|
768
768
|
else
|
|
769
769
|
break;
|
|
770
770
|
}
|
|
771
|
-
let
|
|
771
|
+
let c;
|
|
772
772
|
try {
|
|
773
|
-
|
|
773
|
+
c = new RegExp(o, i);
|
|
774
774
|
} catch (a) {
|
|
775
775
|
this.throwError(a.message);
|
|
776
776
|
}
|
|
777
777
|
return t.node = {
|
|
778
778
|
type: r.LITERAL,
|
|
779
|
-
value:
|
|
779
|
+
value: c,
|
|
780
780
|
raw: this.expr.slice(s - 1, this.index)
|
|
781
781
|
}, t.node = this.gobbleTokenProperty(t.node), t.node;
|
|
782
782
|
}
|
|
783
|
-
this.code === r.OBRACK_CODE ? n = !0 : n && this.code === r.CBRACK_CODE && (n = !1), this.index += this.code ===
|
|
783
|
+
this.code === r.OBRACK_CODE ? n = !0 : n && this.code === r.CBRACK_CODE && (n = !1), this.index += this.code === nt ? 2 : 1;
|
|
784
784
|
}
|
|
785
785
|
this.throwError("Unclosed Regex");
|
|
786
786
|
}
|
|
787
787
|
});
|
|
788
788
|
}
|
|
789
789
|
};
|
|
790
|
-
const
|
|
790
|
+
const xe = 43, ot = 45, fe = {
|
|
791
791
|
name: "assignment",
|
|
792
792
|
assignmentOperators: /* @__PURE__ */ new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "||=", "&&=", "??="]),
|
|
793
|
-
updateOperators: [
|
|
793
|
+
updateOperators: [xe, ot],
|
|
794
794
|
assignmentPrecedence: 0.9,
|
|
795
795
|
init(r) {
|
|
796
796
|
const e = [r.IDENTIFIER, r.MEMBER_EXP];
|
|
797
|
-
|
|
797
|
+
fe.assignmentOperators.forEach((s) => r.addBinaryOp(s, fe.assignmentPrecedence, !0)), r.hooks.add("gobble-token", function(n) {
|
|
798
798
|
const o = this.code;
|
|
799
|
-
|
|
799
|
+
fe.updateOperators.some((i) => i === o && i === this.expr.charCodeAt(this.index + 1)) && (this.index += 2, n.node = {
|
|
800
800
|
type: "UpdateExpression",
|
|
801
|
-
operator: o ===
|
|
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
807
|
const o = this.code;
|
|
808
|
-
|
|
808
|
+
fe.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: o ===
|
|
810
|
+
operator: o === xe ? "++" : "--",
|
|
811
811
|
argument: n.node,
|
|
812
812
|
prefix: !1
|
|
813
813
|
});
|
|
@@ -816,17 +816,17 @@ const Ne = 43, at = 45, ce = {
|
|
|
816
816
|
n.node && t(n.node);
|
|
817
817
|
});
|
|
818
818
|
function t(s) {
|
|
819
|
-
|
|
819
|
+
fe.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
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
const
|
|
825
|
+
ee.plugins.register(st, fe);
|
|
826
|
+
ee.addUnaryOp("typeof");
|
|
827
|
+
ee.addLiteral("null", null);
|
|
828
|
+
ee.addLiteral("undefined", void 0);
|
|
829
|
+
const it = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__"]), j = {
|
|
830
830
|
/**
|
|
831
831
|
* @param {jsep.Expression} ast
|
|
832
832
|
* @param {Record<string, any>} subs
|
|
@@ -835,25 +835,25 @@ const lt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
|
|
|
835
835
|
switch (r.type) {
|
|
836
836
|
case "BinaryExpression":
|
|
837
837
|
case "LogicalExpression":
|
|
838
|
-
return
|
|
838
|
+
return j.evalBinaryExpression(r, e);
|
|
839
839
|
case "Compound":
|
|
840
|
-
return
|
|
840
|
+
return j.evalCompound(r, e);
|
|
841
841
|
case "ConditionalExpression":
|
|
842
|
-
return
|
|
842
|
+
return j.evalConditionalExpression(r, e);
|
|
843
843
|
case "Identifier":
|
|
844
|
-
return
|
|
844
|
+
return j.evalIdentifier(r, e);
|
|
845
845
|
case "Literal":
|
|
846
|
-
return
|
|
846
|
+
return j.evalLiteral(r, e);
|
|
847
847
|
case "MemberExpression":
|
|
848
|
-
return
|
|
848
|
+
return j.evalMemberExpression(r, e);
|
|
849
849
|
case "UnaryExpression":
|
|
850
|
-
return
|
|
850
|
+
return j.evalUnaryExpression(r, e);
|
|
851
851
|
case "ArrayExpression":
|
|
852
|
-
return
|
|
852
|
+
return j.evalArrayExpression(r, e);
|
|
853
853
|
case "CallExpression":
|
|
854
|
-
return
|
|
854
|
+
return j.evalCallExpression(r, e);
|
|
855
855
|
case "AssignmentExpression":
|
|
856
|
-
return
|
|
856
|
+
return j.evalAssignmentExpression(r, e);
|
|
857
857
|
default:
|
|
858
858
|
throw SyntaxError("Unexpected expression", r);
|
|
859
859
|
}
|
|
@@ -883,19 +883,19 @@ const lt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
|
|
|
883
883
|
"*": (s, n) => s * n(),
|
|
884
884
|
"/": (s, n) => s / n(),
|
|
885
885
|
"%": (s, n) => s % n()
|
|
886
|
-
}[r.operator](
|
|
886
|
+
}[r.operator](j.evalAst(r.left, e), () => j.evalAst(r.right, e));
|
|
887
887
|
},
|
|
888
888
|
evalCompound(r, e) {
|
|
889
889
|
let t;
|
|
890
890
|
for (let s = 0; s < r.body.length; s++) {
|
|
891
891
|
r.body[s].type === "Identifier" && ["var", "let", "const"].includes(r.body[s].name) && r.body[s + 1] && r.body[s + 1].type === "AssignmentExpression" && (s += 1);
|
|
892
892
|
const n = r.body[s];
|
|
893
|
-
t =
|
|
893
|
+
t = j.evalAst(n, e);
|
|
894
894
|
}
|
|
895
895
|
return t;
|
|
896
896
|
},
|
|
897
897
|
evalConditionalExpression(r, e) {
|
|
898
|
-
return
|
|
898
|
+
return j.evalAst(r.test, e) ? j.evalAst(r.consequent, e) : j.evalAst(r.alternate, e);
|
|
899
899
|
},
|
|
900
900
|
evalIdentifier(r, e) {
|
|
901
901
|
if (Object.hasOwn(e, r.name))
|
|
@@ -910,46 +910,46 @@ const lt = /* @__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 ?
|
|
913
|
+
r.computed ? j.evalAst(r.property) : r.property.name
|
|
914
914
|
// `object.property` property is Identifier
|
|
915
|
-
), s =
|
|
915
|
+
), s = j.evalAst(r.object, e);
|
|
916
916
|
if (s == null)
|
|
917
917
|
throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);
|
|
918
|
-
if (!Object.hasOwn(s, t) &&
|
|
918
|
+
if (!Object.hasOwn(s, t) && it.has(t))
|
|
919
919
|
throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);
|
|
920
920
|
const n = s[t];
|
|
921
921
|
return typeof n == "function" ? n.bind(s) : n;
|
|
922
922
|
},
|
|
923
923
|
evalUnaryExpression(r, e) {
|
|
924
924
|
return {
|
|
925
|
-
"-": (s) => -
|
|
926
|
-
"!": (s) => !
|
|
927
|
-
"~": (s) => ~
|
|
925
|
+
"-": (s) => -j.evalAst(s, e),
|
|
926
|
+
"!": (s) => !j.evalAst(s, e),
|
|
927
|
+
"~": (s) => ~j.evalAst(s, e),
|
|
928
928
|
// eslint-disable-next-line no-implicit-coercion -- API
|
|
929
|
-
"+": (s) => +
|
|
930
|
-
typeof: (s) => typeof
|
|
929
|
+
"+": (s) => +j.evalAst(s, e),
|
|
930
|
+
typeof: (s) => typeof j.evalAst(s, e)
|
|
931
931
|
}[r.operator](r.argument);
|
|
932
932
|
},
|
|
933
933
|
evalArrayExpression(r, e) {
|
|
934
|
-
return r.elements.map((t) =>
|
|
934
|
+
return r.elements.map((t) => j.evalAst(t, e));
|
|
935
935
|
},
|
|
936
936
|
evalCallExpression(r, e) {
|
|
937
|
-
const t = r.arguments.map((n) =>
|
|
938
|
-
return
|
|
937
|
+
const t = r.arguments.map((n) => j.evalAst(n, e));
|
|
938
|
+
return j.evalAst(r.callee, e)(...t);
|
|
939
939
|
},
|
|
940
940
|
evalAssignmentExpression(r, e) {
|
|
941
941
|
if (r.left.type !== "Identifier")
|
|
942
942
|
throw SyntaxError("Invalid left-hand side in assignment");
|
|
943
|
-
const t = r.left.name, s =
|
|
943
|
+
const t = r.left.name, s = j.evalAst(r.right, e);
|
|
944
944
|
return e[t] = s, e[t];
|
|
945
945
|
}
|
|
946
946
|
};
|
|
947
|
-
class
|
|
947
|
+
class at {
|
|
948
948
|
/**
|
|
949
949
|
* @param {string} expr Expression to evaluate
|
|
950
950
|
*/
|
|
951
951
|
constructor(e) {
|
|
952
|
-
this.code = e, this.ast =
|
|
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 ut {
|
|
|
958
958
|
*/
|
|
959
959
|
runInNewContext(e) {
|
|
960
960
|
const t = Object.assign(/* @__PURE__ */ Object.create(null), e);
|
|
961
|
-
return
|
|
961
|
+
return j.evalAst(this.ast, t);
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
function
|
|
964
|
+
function te(r, e) {
|
|
965
965
|
return r = r.slice(), r.push(e), r;
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function Ne(r, e) {
|
|
968
968
|
return e = e.slice(), e.unshift(r), e;
|
|
969
969
|
}
|
|
970
|
-
class
|
|
970
|
+
class lt extends Error {
|
|
971
971
|
/**
|
|
972
972
|
* @param {AnyResult} value The evaluated scalar value
|
|
973
973
|
*/
|
|
@@ -975,10 +975,10 @@ class ct 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
|
|
979
|
-
if (!(this instanceof
|
|
978
|
+
function L(r, e, t, s, n) {
|
|
979
|
+
if (!(this instanceof L))
|
|
980
980
|
try {
|
|
981
|
-
return new
|
|
981
|
+
return new L(r, e, t, s, n);
|
|
982
982
|
} catch (i) {
|
|
983
983
|
if (!i.avoidNew)
|
|
984
984
|
throw i;
|
|
@@ -993,16 +993,16 @@ function B(r, e, t, s, n) {
|
|
|
993
993
|
path: o ? r.path : e
|
|
994
994
|
};
|
|
995
995
|
o ? "json" in r && (i.json = r.json) : i.json = t;
|
|
996
|
-
const
|
|
997
|
-
if (!
|
|
998
|
-
throw new
|
|
999
|
-
return
|
|
996
|
+
const c = this.evaluate(i);
|
|
997
|
+
if (!c || typeof c != "object")
|
|
998
|
+
throw new lt(c);
|
|
999
|
+
return c;
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
-
|
|
1002
|
+
L.prototype.evaluate = function(r, e, t, s) {
|
|
1003
1003
|
let n = this.parent, o = this.parentProperty, {
|
|
1004
1004
|
flatten: i,
|
|
1005
|
-
wrap:
|
|
1005
|
+
wrap: c
|
|
1006
1006
|
} = this;
|
|
1007
1007
|
if (this.currResultType = this.resultType, this.currEval = this.eval, this.currSandbox = this.sandbox, t = t || this.callback, this.currOtherTypeCallback = s || this.otherTypeCallback, e = e || this.json, r = r || this.path, r && typeof r == "object" && !Array.isArray(r)) {
|
|
1008
1008
|
if (!r.path && r.path !== "")
|
|
@@ -1011,46 +1011,46 @@ B.prototype.evaluate = function(r, e, t, s) {
|
|
|
1011
1011
|
throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');
|
|
1012
1012
|
({
|
|
1013
1013
|
json: e
|
|
1014
|
-
} = r), 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,
|
|
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, c = Object.hasOwn(r, "wrap") ? r.wrap : c, 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, o = o || null, Array.isArray(r) && (r =
|
|
1016
|
+
if (n = n || null, o = o || null, Array.isArray(r) && (r = L.toPathString(r)), !r && r !== "" || !e)
|
|
1017
1017
|
return;
|
|
1018
|
-
const a =
|
|
1018
|
+
const a = L.toPathArray(r);
|
|
1019
1019
|
a[0] === "$" && a.length > 1 && a.shift(), this._hasParentSelector = null;
|
|
1020
1020
|
const l = this._trace(a, e, ["$"], n, o, t).filter(function(h) {
|
|
1021
1021
|
return h && !h.isParentSelector;
|
|
1022
1022
|
});
|
|
1023
|
-
return l.length ? !
|
|
1024
|
-
const
|
|
1025
|
-
return i && Array.isArray(
|
|
1026
|
-
}, []) :
|
|
1023
|
+
return l.length ? !c && l.length === 1 && !l[0].hasArrExpr ? this._getPreferredOutput(l[0]) : l.reduce((h, f) => {
|
|
1024
|
+
const E = this._getPreferredOutput(f);
|
|
1025
|
+
return i && Array.isArray(E) ? h = h.concat(E) : h.push(E), h;
|
|
1026
|
+
}, []) : c ? [] : void 0;
|
|
1027
1027
|
};
|
|
1028
|
-
|
|
1028
|
+
L.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 :
|
|
1033
|
-
return r.pointer =
|
|
1032
|
+
const t = Array.isArray(r.path) ? r.path : L.toPathArray(r.path);
|
|
1033
|
+
return r.pointer = L.toPointer(t), r.path = typeof r.path == "string" ? r.path : L.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
|
|
1040
|
+
return L.toPathString(r[e]);
|
|
1041
1041
|
case "pointer":
|
|
1042
|
-
return
|
|
1042
|
+
return L.toPointer(r.path);
|
|
1043
1043
|
default:
|
|
1044
1044
|
throw new TypeError("Unknown result type");
|
|
1045
1045
|
}
|
|
1046
1046
|
};
|
|
1047
|
-
|
|
1047
|
+
L.prototype._handleCallback = function(r, e, t) {
|
|
1048
1048
|
if (e) {
|
|
1049
1049
|
const s = this._getPreferredOutput(r);
|
|
1050
|
-
r.path = typeof r.path == "string" ? r.path :
|
|
1050
|
+
r.path = typeof r.path == "string" ? r.path : L.toPathString(r.path), e(s, t, r);
|
|
1051
1051
|
}
|
|
1052
1052
|
};
|
|
1053
|
-
|
|
1053
|
+
L.prototype._trace = function(r, e, t, s, n, o, i, c) {
|
|
1054
1054
|
let a;
|
|
1055
1055
|
if (!r.length)
|
|
1056
1056
|
return a = {
|
|
@@ -1061,20 +1061,20 @@ B.prototype._trace = function(r, e, t, s, n, o, i, u) {
|
|
|
1061
1061
|
hasArrExpr: i
|
|
1062
1062
|
}, this._handleCallback(a, o, "value"), a;
|
|
1063
1063
|
const l = r[0], h = r.slice(1), f = [];
|
|
1064
|
-
function
|
|
1065
|
-
Array.isArray(
|
|
1064
|
+
function E(_) {
|
|
1065
|
+
Array.isArray(_) ? _.forEach((w) => {
|
|
1066
1066
|
f.push(w);
|
|
1067
|
-
}) : f.push(
|
|
1067
|
+
}) : f.push(_);
|
|
1068
1068
|
}
|
|
1069
|
-
if ((typeof l != "string" ||
|
|
1070
|
-
|
|
1069
|
+
if ((typeof l != "string" || c) && e && Object.hasOwn(e, l))
|
|
1070
|
+
E(this._trace(h, e[l], te(t, l), e, l, o, i));
|
|
1071
1071
|
else if (l === "*")
|
|
1072
|
-
this._walk(e, (
|
|
1073
|
-
|
|
1072
|
+
this._walk(e, (_) => {
|
|
1073
|
+
E(this._trace(h, e[_], te(t, _), e, _, o, !0, !0));
|
|
1074
1074
|
});
|
|
1075
1075
|
else if (l === "..")
|
|
1076
|
-
|
|
1077
|
-
typeof e[
|
|
1076
|
+
E(this._trace(h, e, t, s, n, o, i)), this._walk(e, (_) => {
|
|
1077
|
+
typeof e[_] == "object" && E(this._trace(r.slice(), e[_], te(t, _), e, _, o, !0));
|
|
1078
1078
|
});
|
|
1079
1079
|
else {
|
|
1080
1080
|
if (l === "^")
|
|
@@ -1085,68 +1085,68 @@ B.prototype._trace = function(r, e, t, s, n, o, i, u) {
|
|
|
1085
1085
|
};
|
|
1086
1086
|
if (l === "~")
|
|
1087
1087
|
return a = {
|
|
1088
|
-
path:
|
|
1088
|
+
path: te(t, l),
|
|
1089
1089
|
value: n,
|
|
1090
1090
|
parent: s,
|
|
1091
1091
|
parentProperty: null
|
|
1092
1092
|
}, this._handleCallback(a, o, "property"), a;
|
|
1093
1093
|
if (l === "$")
|
|
1094
|
-
|
|
1094
|
+
E(this._trace(h, e, t, null, null, o, i));
|
|
1095
1095
|
else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(l))
|
|
1096
|
-
|
|
1096
|
+
E(this._slice(l, h, e, t, s, n, o));
|
|
1097
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
|
|
1101
|
-
w ? this._walk(e, (
|
|
1102
|
-
const
|
|
1103
|
-
this._trace(
|
|
1104
|
-
}) : this._walk(e, (
|
|
1105
|
-
this._eval(
|
|
1100
|
+
const _ = l.replace(/^\?\((.*?)\)$/u, "$1"), w = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(_);
|
|
1101
|
+
w ? this._walk(e, (O) => {
|
|
1102
|
+
const x = [w[2]], S = w[1] ? e[O][w[1]] : e[O];
|
|
1103
|
+
this._trace(x, S, t, s, n, o, !0).length > 0 && E(this._trace(h, e[O], te(t, O), e, O, o, !0));
|
|
1104
|
+
}) : this._walk(e, (O) => {
|
|
1105
|
+
this._eval(_, e[O], O, t, s, n) && E(this._trace(h, e[O], te(t, O), e, O, o, !0));
|
|
1106
1106
|
});
|
|
1107
1107
|
} else if (l[0] === "(") {
|
|
1108
1108
|
if (this.currEval === !1)
|
|
1109
1109
|
throw new Error("Eval [(expr)] prevented in JSONPath expression.");
|
|
1110
|
-
|
|
1110
|
+
E(this._trace(Ne(this._eval(l, e, t.at(-1), t.slice(0, -1), s, n), h), e, t, s, n, o, i));
|
|
1111
1111
|
} else if (l[0] === "@") {
|
|
1112
|
-
let
|
|
1112
|
+
let _ = !1;
|
|
1113
1113
|
const w = l.slice(1, -2);
|
|
1114
1114
|
switch (w) {
|
|
1115
1115
|
case "scalar":
|
|
1116
|
-
(!e || !["object", "function"].includes(typeof e)) && (
|
|
1116
|
+
(!e || !["object", "function"].includes(typeof e)) && (_ = !0);
|
|
1117
1117
|
break;
|
|
1118
1118
|
case "boolean":
|
|
1119
1119
|
case "string":
|
|
1120
1120
|
case "undefined":
|
|
1121
1121
|
case "function":
|
|
1122
|
-
typeof e === w && (
|
|
1122
|
+
typeof e === w && (_ = !0);
|
|
1123
1123
|
break;
|
|
1124
1124
|
case "integer":
|
|
1125
|
-
Number.isFinite(e) && !(e % 1) && (
|
|
1125
|
+
Number.isFinite(e) && !(e % 1) && (_ = !0);
|
|
1126
1126
|
break;
|
|
1127
1127
|
case "number":
|
|
1128
|
-
Number.isFinite(e) && (
|
|
1128
|
+
Number.isFinite(e) && (_ = !0);
|
|
1129
1129
|
break;
|
|
1130
1130
|
case "nonFinite":
|
|
1131
|
-
typeof e == "number" && !Number.isFinite(e) && (
|
|
1131
|
+
typeof e == "number" && !Number.isFinite(e) && (_ = !0);
|
|
1132
1132
|
break;
|
|
1133
1133
|
case "object":
|
|
1134
|
-
e && typeof e === w && (
|
|
1134
|
+
e && typeof e === w && (_ = !0);
|
|
1135
1135
|
break;
|
|
1136
1136
|
case "array":
|
|
1137
|
-
Array.isArray(e) && (
|
|
1137
|
+
Array.isArray(e) && (_ = !0);
|
|
1138
1138
|
break;
|
|
1139
1139
|
case "other":
|
|
1140
|
-
|
|
1140
|
+
_ = this.currOtherTypeCallback(e, t, s, n);
|
|
1141
1141
|
break;
|
|
1142
1142
|
case "null":
|
|
1143
|
-
e === null && (
|
|
1143
|
+
e === null && (_ = !0);
|
|
1144
1144
|
break;
|
|
1145
1145
|
/* c8 ignore next 2 */
|
|
1146
1146
|
default:
|
|
1147
1147
|
throw new TypeError("Unknown value type " + w);
|
|
1148
1148
|
}
|
|
1149
|
-
if (
|
|
1149
|
+
if (_)
|
|
1150
1150
|
return a = {
|
|
1151
1151
|
path: t,
|
|
1152
1152
|
value: e,
|
|
@@ -1154,31 +1154,31 @@ B.prototype._trace = function(r, e, t, s, n, o, i, u) {
|
|
|
1154
1154
|
parentProperty: n
|
|
1155
1155
|
}, this._handleCallback(a, o, "value"), a;
|
|
1156
1156
|
} else if (l[0] === "`" && e && Object.hasOwn(e, l.slice(1))) {
|
|
1157
|
-
const
|
|
1158
|
-
|
|
1157
|
+
const _ = l.slice(1);
|
|
1158
|
+
E(this._trace(h, e[_], te(t, _), e, _, o, i, !0));
|
|
1159
1159
|
} else if (l.includes(",")) {
|
|
1160
|
-
const
|
|
1161
|
-
for (const w of
|
|
1162
|
-
|
|
1163
|
-
} else !
|
|
1160
|
+
const _ = l.split(",");
|
|
1161
|
+
for (const w of _)
|
|
1162
|
+
E(this._trace(Ne(w, h), e, t, s, n, o, !0));
|
|
1163
|
+
} else !c && e && Object.hasOwn(e, l) && E(this._trace(h, e[l], te(t, l), e, l, o, i, !0));
|
|
1164
1164
|
}
|
|
1165
1165
|
if (this._hasParentSelector)
|
|
1166
|
-
for (let
|
|
1167
|
-
const w = f[
|
|
1166
|
+
for (let _ = 0; _ < f.length; _++) {
|
|
1167
|
+
const w = f[_];
|
|
1168
1168
|
if (w && w.isParentSelector) {
|
|
1169
|
-
const
|
|
1170
|
-
if (Array.isArray(
|
|
1171
|
-
f[
|
|
1172
|
-
const
|
|
1173
|
-
for (let
|
|
1174
|
-
|
|
1169
|
+
const O = this._trace(w.expr, e, w.path, s, n, o, i);
|
|
1170
|
+
if (Array.isArray(O)) {
|
|
1171
|
+
f[_] = O[0];
|
|
1172
|
+
const x = O.length;
|
|
1173
|
+
for (let S = 1; S < x; S++)
|
|
1174
|
+
_++, f.splice(_, 0, O[S]);
|
|
1175
1175
|
} else
|
|
1176
|
-
f[
|
|
1176
|
+
f[_] = O;
|
|
1177
1177
|
}
|
|
1178
1178
|
}
|
|
1179
1179
|
return f;
|
|
1180
1180
|
};
|
|
1181
|
-
|
|
1181
|
+
L.prototype._walk = function(r, e) {
|
|
1182
1182
|
if (Array.isArray(r)) {
|
|
1183
1183
|
const t = r.length;
|
|
1184
1184
|
for (let s = 0; s < t; s++)
|
|
@@ -1187,67 +1187,67 @@ B.prototype._walk = function(r, e) {
|
|
|
1187
1187
|
e(t);
|
|
1188
1188
|
});
|
|
1189
1189
|
};
|
|
1190
|
-
|
|
1190
|
+
L.prototype._slice = function(r, e, t, s, n, o, i) {
|
|
1191
1191
|
if (!Array.isArray(t))
|
|
1192
1192
|
return;
|
|
1193
|
-
const
|
|
1194
|
-
let h = a[0] && Number.parseInt(a[0]) || 0, f = a[1] && Number.parseInt(a[1]) ||
|
|
1195
|
-
h = h < 0 ? Math.max(0, h +
|
|
1196
|
-
const
|
|
1197
|
-
for (let
|
|
1198
|
-
this._trace(
|
|
1199
|
-
|
|
1193
|
+
const c = 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]) || c;
|
|
1195
|
+
h = h < 0 ? Math.max(0, h + c) : Math.min(c, h), f = f < 0 ? Math.max(0, f + c) : Math.min(c, f);
|
|
1196
|
+
const E = [];
|
|
1197
|
+
for (let _ = h; _ < f; _ += l)
|
|
1198
|
+
this._trace(Ne(_, e), t, s, n, o, i, !0).forEach((O) => {
|
|
1199
|
+
E.push(O);
|
|
1200
1200
|
});
|
|
1201
|
-
return
|
|
1201
|
+
return E;
|
|
1202
1202
|
};
|
|
1203
|
-
|
|
1203
|
+
L.prototype._eval = function(r, e, t, s, n, o) {
|
|
1204
1204
|
this.currSandbox._$_parentProperty = o, this.currSandbox._$_parent = n, this.currSandbox._$_property = t, this.currSandbox._$_root = this.json, this.currSandbox._$_v = e;
|
|
1205
1205
|
const i = r.includes("@path");
|
|
1206
|
-
i && (this.currSandbox._$_path =
|
|
1207
|
-
const
|
|
1208
|
-
if (!
|
|
1206
|
+
i && (this.currSandbox._$_path = L.toPathString(s.concat([t])));
|
|
1207
|
+
const c = this.currEval + "Script:" + r;
|
|
1208
|
+
if (!L.cache[c]) {
|
|
1209
1209
|
let a = r.replaceAll("@parentProperty", "_$_parentProperty").replaceAll("@parent", "_$_parent").replaceAll("@property", "_$_property").replaceAll("@root", "_$_root").replaceAll(/@([.\s)[])/gu, "_$_v$1");
|
|
1210
1210
|
if (i && (a = a.replaceAll("@path", "_$_path")), this.currEval === "safe" || this.currEval === !0 || this.currEval === void 0)
|
|
1211
|
-
|
|
1211
|
+
L.cache[c] = new this.safeVm.Script(a);
|
|
1212
1212
|
else if (this.currEval === "native")
|
|
1213
|
-
|
|
1213
|
+
L.cache[c] = new this.vm.Script(a);
|
|
1214
1214
|
else if (typeof this.currEval == "function" && this.currEval.prototype && Object.hasOwn(this.currEval.prototype, "runInNewContext")) {
|
|
1215
1215
|
const l = this.currEval;
|
|
1216
|
-
|
|
1216
|
+
L.cache[c] = new l(a);
|
|
1217
1217
|
} else if (typeof this.currEval == "function")
|
|
1218
|
-
|
|
1218
|
+
L.cache[c] = {
|
|
1219
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
|
|
1225
|
+
return L.cache[c].runInNewContext(this.currSandbox);
|
|
1226
1226
|
} catch (a) {
|
|
1227
1227
|
if (this.ignoreEvalErrors)
|
|
1228
1228
|
return !1;
|
|
1229
1229
|
throw new Error("jsonPath: " + a.message + ": " + r);
|
|
1230
1230
|
}
|
|
1231
1231
|
};
|
|
1232
|
-
|
|
1233
|
-
|
|
1232
|
+
L.cache = {};
|
|
1233
|
+
L.toPathString = function(r) {
|
|
1234
1234
|
const e = r, t = e.length;
|
|
1235
1235
|
let s = "$";
|
|
1236
1236
|
for (let n = 1; n < t; n++)
|
|
1237
1237
|
/^(~|\^|@.*?\(\))$/u.test(e[n]) || (s += /^[0-9*]+$/u.test(e[n]) ? "[" + e[n] + "]" : "['" + e[n] + "']");
|
|
1238
1238
|
return s;
|
|
1239
1239
|
};
|
|
1240
|
-
|
|
1240
|
+
L.toPointer = function(r) {
|
|
1241
1241
|
const e = r, t = e.length;
|
|
1242
1242
|
let s = "";
|
|
1243
1243
|
for (let n = 1; n < t; n++)
|
|
1244
1244
|
/^(~|\^|@.*?\(\))$/u.test(e[n]) || (s += "/" + e[n].toString().replaceAll("~", "~0").replaceAll("/", "~1"));
|
|
1245
1245
|
return s;
|
|
1246
1246
|
};
|
|
1247
|
-
|
|
1247
|
+
L.toPathArray = function(r) {
|
|
1248
1248
|
const {
|
|
1249
1249
|
cache: e
|
|
1250
|
-
} =
|
|
1250
|
+
} = L;
|
|
1251
1251
|
if (e[r])
|
|
1252
1252
|
return e[r].concat();
|
|
1253
1253
|
const t = [], n = r.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu, function(o, i) {
|
|
@@ -1262,17 +1262,17 @@ B.toPathArray = function(r) {
|
|
|
1262
1262
|
});
|
|
1263
1263
|
return e[r] = n, e[r].concat();
|
|
1264
1264
|
};
|
|
1265
|
-
|
|
1266
|
-
Script:
|
|
1265
|
+
L.prototype.safeVm = {
|
|
1266
|
+
Script: at
|
|
1267
1267
|
};
|
|
1268
|
-
const
|
|
1268
|
+
const ct = function(r, e, t) {
|
|
1269
1269
|
const s = r.length;
|
|
1270
1270
|
for (let n = 0; n < s; n++) {
|
|
1271
1271
|
const o = r[n];
|
|
1272
1272
|
t(o) && e.push(r.splice(n--, 1)[0]);
|
|
1273
1273
|
}
|
|
1274
1274
|
};
|
|
1275
|
-
class
|
|
1275
|
+
class ut {
|
|
1276
1276
|
/**
|
|
1277
1277
|
* @param {string} expr Expression to evaluate
|
|
1278
1278
|
*/
|
|
@@ -1287,47 +1287,44 @@ class ft {
|
|
|
1287
1287
|
runInNewContext(e) {
|
|
1288
1288
|
let t = this.code;
|
|
1289
1289
|
const s = Object.keys(e), n = [];
|
|
1290
|
-
|
|
1290
|
+
ct(s, n, (l) => typeof e[l] == "function");
|
|
1291
1291
|
const o = s.map((l) => e[l]);
|
|
1292
1292
|
t = n.reduce((l, h) => {
|
|
1293
1293
|
let f = e[h].toString();
|
|
1294
1294
|
return /function/u.test(f) || (f = "function " + f), "var " + h + "=" + f + ";" + l;
|
|
1295
1295
|
}, "") + t, !/(['"])use strict\1/u.test(t) && !s.includes("arguments") && (t = "var arguments = undefined;" + t), t = t.replace(/;\s*$/u, "");
|
|
1296
|
-
const
|
|
1296
|
+
const c = t.lastIndexOf(";"), a = c !== -1 ? t.slice(0, c + 1) + " return " + t.slice(c + 1) : " return " + t;
|
|
1297
1297
|
return new Function(...s, a)(...o);
|
|
1298
1298
|
}
|
|
1299
1299
|
}
|
|
1300
|
-
|
|
1301
|
-
Script:
|
|
1300
|
+
L.prototype.vm = {
|
|
1301
|
+
Script: ut
|
|
1302
1302
|
};
|
|
1303
|
-
const
|
|
1303
|
+
const dt = { class: "json-node" }, ft = {
|
|
1304
1304
|
key: 0,
|
|
1305
1305
|
class: "json-node__container"
|
|
1306
|
-
},
|
|
1307
|
-
key:
|
|
1306
|
+
}, ht = { class: "json-node__line" }, pt = ["contenteditable", "onKeydown"], gt = {
|
|
1307
|
+
key: 1,
|
|
1308
1308
|
class: "json-node__colon"
|
|
1309
|
-
},
|
|
1310
|
-
key: 3,
|
|
1311
|
-
class: "json-node__collapsed"
|
|
1312
|
-
}, vt = {
|
|
1309
|
+
}, mt = ["title"], bt = ["title"], yt = {
|
|
1313
1310
|
key: 4,
|
|
1314
1311
|
class: "json-node__comma"
|
|
1315
|
-
},
|
|
1312
|
+
}, vt = {
|
|
1316
1313
|
key: 0,
|
|
1317
1314
|
class: "json-node__children"
|
|
1318
|
-
}, _t = { class: "json-node__children-content" },
|
|
1315
|
+
}, _t = { class: "json-node__children-content" }, Et = { class: "json-node__line json-node__closing-bracket" }, xt = { class: "json-node__bracket" }, kt = {
|
|
1319
1316
|
key: 0,
|
|
1320
1317
|
class: "json-node__comma"
|
|
1321
|
-
},
|
|
1318
|
+
}, Nt = {
|
|
1322
1319
|
key: 1,
|
|
1323
1320
|
class: "json-node__primitive"
|
|
1324
|
-
}, wt = {
|
|
1325
|
-
key:
|
|
1321
|
+
}, At = ["contenteditable", "onKeydown"], wt = {
|
|
1322
|
+
key: 1,
|
|
1326
1323
|
class: "json-node__colon"
|
|
1327
|
-
}, Ct = ["title"], Ot = {
|
|
1324
|
+
}, Ct = ["title"], Ot = ["contenteditable", "onKeydown"], Tt = {
|
|
1328
1325
|
key: 0,
|
|
1329
1326
|
class: "json-node__comma"
|
|
1330
|
-
},
|
|
1327
|
+
}, Pt = /* @__PURE__ */ be({
|
|
1331
1328
|
name: "JsonNode",
|
|
1332
1329
|
__name: "JsonNode",
|
|
1333
1330
|
props: {
|
|
@@ -1341,191 +1338,202 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1341
1338
|
},
|
|
1342
1339
|
emits: ["update:value", "toggle-expand", "copy", "update:key"],
|
|
1343
1340
|
setup(r, { emit: e }) {
|
|
1344
|
-
|
|
1345
|
-
"
|
|
1346
|
-
"
|
|
1347
|
-
"
|
|
1348
|
-
|
|
1349
|
-
"
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
"
|
|
1353
|
-
|
|
1354
|
-
"
|
|
1355
|
-
|
|
1341
|
+
Ce((d) => ({
|
|
1342
|
+
"2a18b018": d.level,
|
|
1343
|
+
"58a14b93": d.theme.colors.syntaxKey,
|
|
1344
|
+
"46fe1b3e": d.theme.colors.hoverBackground,
|
|
1345
|
+
fbe2c048: d.theme.colors.syntaxBracket,
|
|
1346
|
+
"4bd524bb": d.theme.colors.collapsedText,
|
|
1347
|
+
"3308d23c": d.theme.colors.collapsedBackground,
|
|
1348
|
+
"36380c60": d.theme.colors.collapsedBackgroundHover,
|
|
1349
|
+
"0892365d": d.theme.colors.syntaxString,
|
|
1350
|
+
"0015b195": d.theme.colors.syntaxNumber,
|
|
1351
|
+
"7db95f5c": d.theme.colors.syntaxBoolean,
|
|
1352
|
+
"88ec825a": d.theme.colors.syntaxNull,
|
|
1353
|
+
"537157f7": d.theme.colors.background,
|
|
1354
|
+
"3cee3331": d.theme.colors.selectionBackground,
|
|
1355
|
+
"81323cee": d.theme.colors.indentLine
|
|
1356
1356
|
}));
|
|
1357
|
-
const t = r, s = e, n =
|
|
1357
|
+
const t = r, s = e, n = W(!1), o = W(!1), i = W(""), c = W(""), a = W("string"), l = W(null), h = W(null), f = (d) => d !== null && typeof d == "object" && !Array.isArray(d) && "__protected_number__" in d && Object.keys(d).length === 1, E = (d) => f(d) ? d.__protected_number__ : "", _ = V(() => f(t.value) ? !1 : t.value !== null && typeof t.value == "object"), w = V(() => Array.isArray(t.value)), O = V(() => t.path ? t.path : t.keyName ? t.keyName : "root"), x = V(() => t.expanded.has(O.value)), S = V(() => t.keyName), X = V(() => w.value ? "[" : "{"), Z = V(() => w.value ? "]" : "}"), p = V(() => {
|
|
1358
1358
|
if (!t.value) return "";
|
|
1359
|
-
const
|
|
1360
|
-
return
|
|
1361
|
-
}),
|
|
1362
|
-
const
|
|
1363
|
-
return t.value === null ? "json-node__value--null" :
|
|
1364
|
-
}),
|
|
1365
|
-
const
|
|
1366
|
-
return
|
|
1367
|
-
},
|
|
1368
|
-
s("toggle-expand",
|
|
1369
|
-
},
|
|
1359
|
+
const m = Object.keys(t.value).length;
|
|
1360
|
+
return w.value ? m > 0 ? ` ${m} items ` : " " : m > 0 ? ` ${m} keys ` : " ";
|
|
1361
|
+
}), g = V(() => {
|
|
1362
|
+
const d = typeof t.value;
|
|
1363
|
+
return t.value === null ? "json-node__value--null" : d === "boolean" ? "json-node__value--boolean" : d === "number" || f(t.value) ? "json-node__value--number" : d === "string" ? "json-node__value--string" : "";
|
|
1364
|
+
}), C = V(() => t.value === null ? "null" : typeof t.value == "boolean" || typeof t.value == "number" ? String(t.value) : f(t.value) ? E(t.value) : typeof t.value == "string" ? `"${t.value}"` : String(t.value)), $ = V(() => "Double-click to edit"), R = (d) => t.level === 0 ? d : O.value ? `${O.value}.${d}` : d, K = (d) => {
|
|
1365
|
+
const m = Object.keys(t.value);
|
|
1366
|
+
return m.indexOf(d) === m.length - 1;
|
|
1367
|
+
}, Y = () => {
|
|
1368
|
+
s("toggle-expand", O.value);
|
|
1369
|
+
}, q = () => {
|
|
1370
1370
|
t.level !== 0 && (n.value = !0, i.value = t.keyName, he(() => {
|
|
1371
|
-
|
|
1372
|
-
|
|
1371
|
+
if (l.value) {
|
|
1372
|
+
l.value.focus();
|
|
1373
|
+
const d = document.createRange();
|
|
1374
|
+
d.selectNodeContents(l.value);
|
|
1375
|
+
const m = window.getSelection();
|
|
1376
|
+
m?.removeAllRanges(), m?.addRange(d);
|
|
1377
|
+
}
|
|
1373
1378
|
}));
|
|
1374
|
-
},
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1379
|
+
}, se = () => {
|
|
1380
|
+
_.value || (o.value = !0, t.value === null ? a.value = "null" : f(t.value) ? a.value = "protected-number" : typeof t.value == "string" ? a.value = "string" : typeof t.value == "number" ? a.value = "number" : typeof t.value == "boolean" && (a.value = "boolean"), f(t.value) ? c.value = E(t.value) : typeof t.value == "string" ? c.value = t.value : c.value = String(t.value), he(() => {
|
|
1381
|
+
if (h.value) {
|
|
1382
|
+
h.value.focus();
|
|
1383
|
+
const d = document.createRange();
|
|
1384
|
+
d.selectNodeContents(h.value);
|
|
1385
|
+
const m = window.getSelection();
|
|
1386
|
+
m?.removeAllRanges(), m?.addRange(d);
|
|
1387
|
+
}
|
|
1378
1388
|
}));
|
|
1379
|
-
},
|
|
1389
|
+
}, J = () => {
|
|
1380
1390
|
if (t.level === 0 || !n.value) return;
|
|
1381
|
-
const
|
|
1382
|
-
if (!
|
|
1383
|
-
|
|
1391
|
+
const d = l.value?.innerText.trim() || "";
|
|
1392
|
+
if (!d) {
|
|
1393
|
+
b();
|
|
1384
1394
|
return;
|
|
1385
1395
|
}
|
|
1386
|
-
if (
|
|
1396
|
+
if (d === t.keyName) {
|
|
1387
1397
|
n.value = !1;
|
|
1388
1398
|
return;
|
|
1389
1399
|
}
|
|
1390
|
-
n.value = !1, s("update:key",
|
|
1391
|
-
},
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1400
|
+
n.value = !1, s("update:key", O.value, d);
|
|
1401
|
+
}, oe = () => {
|
|
1402
|
+
if (o.value)
|
|
1403
|
+
try {
|
|
1404
|
+
let d;
|
|
1405
|
+
const m = h.value?.innerText.trim() || "";
|
|
1406
|
+
if (a.value === "string")
|
|
1407
|
+
m === "null" ? d = null : m === "true" || m === "false" ? d = m === "true" : d = m;
|
|
1408
|
+
else if (a.value === "protected-number")
|
|
1409
|
+
d = { __protected_number__: m };
|
|
1410
|
+
else if (m === "null")
|
|
1411
|
+
d = null;
|
|
1412
|
+
else if (m === "true" || m === "false")
|
|
1413
|
+
d = m === "true";
|
|
1414
|
+
else if (!isNaN(Number(m)) && m !== "") {
|
|
1415
|
+
const T = Number(m);
|
|
1416
|
+
!Number.isSafeInteger(T) || m.length > 15 ? d = { __protected_number__: m } : d = T;
|
|
1417
|
+
} else
|
|
1418
|
+
d = m;
|
|
1419
|
+
s("update:value", O.value, d), o.value = !1;
|
|
1420
|
+
} catch (d) {
|
|
1421
|
+
console.error("Failed to parse value:", d), o.value = !1;
|
|
1422
|
+
}
|
|
1423
|
+
}, b = () => {
|
|
1409
1424
|
n.value = !1, i.value = t.keyName;
|
|
1410
|
-
},
|
|
1411
|
-
o.value = !1,
|
|
1425
|
+
}, v = () => {
|
|
1426
|
+
o.value = !1, f(t.value) ? c.value = E(t.value) : typeof t.value == "string" ? c.value = t.value : c.value = String(t.value);
|
|
1412
1427
|
};
|
|
1413
|
-
return (
|
|
1414
|
-
const
|
|
1415
|
-
return
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1428
|
+
return (d, m) => {
|
|
1429
|
+
const T = je("JsonNode", !0);
|
|
1430
|
+
return k(), A("div", dt, [
|
|
1431
|
+
_.value ? (k(), A("div", ft, [
|
|
1432
|
+
y("div", ht, [
|
|
1433
|
+
d.keyName ? (k(), A("span", {
|
|
1419
1434
|
key: 0,
|
|
1420
1435
|
class: "json-node__key",
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
"onUpdate:modelValue": d[0] || (d[0] = (k) => i.value = k),
|
|
1427
|
-
onKeyup: [
|
|
1428
|
-
ue(Y, ["enter"]),
|
|
1429
|
-
ue(ee, ["escape"])
|
|
1436
|
+
contenteditable: n.value,
|
|
1437
|
+
onDblclick: q,
|
|
1438
|
+
onKeydown: [
|
|
1439
|
+
de(Ee(J, ["prevent"]), ["enter"]),
|
|
1440
|
+
de(b, ["escape"])
|
|
1430
1441
|
],
|
|
1431
|
-
onBlur:
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1442
|
+
onBlur: J,
|
|
1443
|
+
ref_key: "keyRef",
|
|
1444
|
+
ref: l,
|
|
1445
|
+
title: "Double-click to edit key"
|
|
1446
|
+
}, B(n.value ? i.value : `"${S.value}"`), 41, pt)) : H("", !0),
|
|
1447
|
+
d.keyName ? (k(), A("span", gt, ": ")) : H("", !0),
|
|
1448
|
+
y("span", {
|
|
1449
|
+
class: "json-node__bracket json-node__bracket--clickable",
|
|
1450
|
+
onClick: Y,
|
|
1451
|
+
title: x.value ? "Click to collapse" : "Click to expand"
|
|
1452
|
+
}, B(X.value), 9, mt),
|
|
1453
|
+
x.value ? H("", !0) : (k(), A("span", {
|
|
1454
|
+
key: 2,
|
|
1455
|
+
class: "json-node__collapsed-info",
|
|
1456
|
+
onClick: Y,
|
|
1457
|
+
title: `Click to expand ${p.value.trim()}`
|
|
1458
|
+
}, B(p.value), 9, bt)),
|
|
1459
|
+
x.value ? H("", !0) : (k(), A("span", {
|
|
1460
|
+
key: 3,
|
|
1438
1461
|
class: "json-node__bracket json-node__bracket--clickable",
|
|
1439
|
-
onClick:
|
|
1440
|
-
title:
|
|
1441
|
-
},
|
|
1442
|
-
|
|
1443
|
-
Se(R(j.value) + " ", 1),
|
|
1444
|
-
v("span", {
|
|
1445
|
-
class: "json-node__bracket json-node__bracket--clickable",
|
|
1446
|
-
onClick: I
|
|
1447
|
-
}, R(_.value), 1)
|
|
1448
|
-
])),
|
|
1449
|
-
!m.value && !y.isLast ? (x(), A("span", vt, ",")) : F("", !0)
|
|
1462
|
+
onClick: Y,
|
|
1463
|
+
title: "Click to expand"
|
|
1464
|
+
}, B(Z.value), 1)),
|
|
1465
|
+
!x.value && !d.isLast ? (k(), A("span", yt, ",")) : H("", !0)
|
|
1450
1466
|
]),
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
(
|
|
1454
|
-
key:
|
|
1467
|
+
x.value ? (k(), A("div", vt, [
|
|
1468
|
+
y("div", _t, [
|
|
1469
|
+
(k(!0), A(re, null, ae(d.value, (P, I) => (k(), A("div", {
|
|
1470
|
+
key: I,
|
|
1455
1471
|
class: "json-node__child"
|
|
1456
1472
|
}, [
|
|
1457
|
-
|
|
1458
|
-
value:
|
|
1459
|
-
"key-name":
|
|
1460
|
-
level:
|
|
1461
|
-
path:
|
|
1462
|
-
expanded:
|
|
1463
|
-
theme:
|
|
1464
|
-
"onUpdate:value":
|
|
1465
|
-
onToggleExpand:
|
|
1466
|
-
onCopy:
|
|
1467
|
-
"onUpdate:key":
|
|
1468
|
-
"is-last":
|
|
1473
|
+
Me(T, {
|
|
1474
|
+
value: P,
|
|
1475
|
+
"key-name": w.value ? "" : String(I),
|
|
1476
|
+
level: d.level + 1,
|
|
1477
|
+
path: R(String(I)),
|
|
1478
|
+
expanded: d.expanded,
|
|
1479
|
+
theme: d.theme,
|
|
1480
|
+
"onUpdate:value": m[0] || (m[0] = (M, U) => d.$emit("update:value", M, U)),
|
|
1481
|
+
onToggleExpand: m[1] || (m[1] = (M) => d.$emit("toggle-expand", M)),
|
|
1482
|
+
onCopy: m[2] || (m[2] = (M) => d.$emit("copy", M)),
|
|
1483
|
+
"onUpdate:key": m[3] || (m[3] = (M, U) => d.$emit("update:key", M, U)),
|
|
1484
|
+
"is-last": K(String(I))
|
|
1469
1485
|
}, null, 8, ["value", "key-name", "level", "path", "expanded", "theme", "is-last"])
|
|
1470
1486
|
]))), 128))
|
|
1471
1487
|
]),
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1488
|
+
y("div", Et, [
|
|
1489
|
+
y("span", xt, B(Z.value), 1),
|
|
1490
|
+
d.isLast ? H("", !0) : (k(), A("span", kt, ","))
|
|
1475
1491
|
])
|
|
1476
|
-
])) :
|
|
1477
|
-
])) : (
|
|
1478
|
-
|
|
1492
|
+
])) : H("", !0)
|
|
1493
|
+
])) : (k(), A("div", Nt, [
|
|
1494
|
+
d.keyName ? (k(), A("span", {
|
|
1479
1495
|
key: 0,
|
|
1480
1496
|
class: "json-node__key",
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
"onUpdate:modelValue": d[5] || (d[5] = (k) => i.value = k),
|
|
1487
|
-
onKeyup: [
|
|
1488
|
-
ue(Y, ["enter"]),
|
|
1489
|
-
ue(ee, ["escape"])
|
|
1497
|
+
contenteditable: n.value,
|
|
1498
|
+
onDblclick: q,
|
|
1499
|
+
onKeydown: [
|
|
1500
|
+
de(Ee(J, ["prevent"]), ["enter"]),
|
|
1501
|
+
de(b, ["escape"])
|
|
1490
1502
|
],
|
|
1491
|
-
onBlur:
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
onClick: Z,
|
|
1501
|
-
onDblclick: d[6] || (d[6] = (k) => y.$emit("copy", y.value)),
|
|
1503
|
+
onBlur: J,
|
|
1504
|
+
ref_key: "keyRef",
|
|
1505
|
+
ref: l,
|
|
1506
|
+
title: "Double-click to edit key"
|
|
1507
|
+
}, B(n.value ? i.value : `"${S.value}"`), 41, At)) : H("", !0),
|
|
1508
|
+
d.keyName ? (k(), A("span", wt, ": ")) : H("", !0),
|
|
1509
|
+
y("span", {
|
|
1510
|
+
class: Oe(["json-node__value-wrapper", g.value]),
|
|
1511
|
+
onDblclick: se,
|
|
1502
1512
|
title: $.value
|
|
1503
1513
|
}, [
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
[xe, u.value]
|
|
1518
|
-
]) : F("", !0)
|
|
1514
|
+
y("span", {
|
|
1515
|
+
class: "json-node__value",
|
|
1516
|
+
contenteditable: o.value,
|
|
1517
|
+
onKeydown: [
|
|
1518
|
+
de(Ee(oe, ["prevent"]), ["enter"]),
|
|
1519
|
+
de(v, ["escape"])
|
|
1520
|
+
],
|
|
1521
|
+
onBlur: oe,
|
|
1522
|
+
ref_key: "valueRef",
|
|
1523
|
+
ref: h
|
|
1524
|
+
}, B(o.value ? c.value : C.value), 41, Ot),
|
|
1525
|
+
d.isLast ? H("", !0) : (k(), A("span", Tt, ","))
|
|
1526
|
+
], 42, Ct)
|
|
1519
1527
|
]))
|
|
1520
1528
|
]);
|
|
1521
1529
|
};
|
|
1522
1530
|
}
|
|
1523
|
-
}),
|
|
1531
|
+
}), ye = (r, e) => {
|
|
1524
1532
|
const t = r.__vccOpts || r;
|
|
1525
1533
|
for (const [s, n] of e)
|
|
1526
1534
|
t[s] = n;
|
|
1527
1535
|
return t;
|
|
1528
|
-
},
|
|
1536
|
+
}, $t = /* @__PURE__ */ ye(Pt, [["__scopeId", "data-v-1472a8af"]]), Xe = {
|
|
1529
1537
|
name: "github-light",
|
|
1530
1538
|
colors: {
|
|
1531
1539
|
// 背景色
|
|
@@ -1557,10 +1565,16 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1557
1565
|
syntaxBracket: "#24292f",
|
|
1558
1566
|
// 悬停效果
|
|
1559
1567
|
hoverBackground: "#f6f8fa",
|
|
1568
|
+
// 选中背景色
|
|
1569
|
+
selectionBackground: "rgba(9, 105, 218, 0.2)",
|
|
1570
|
+
// 折叠信息样式
|
|
1571
|
+
collapsedBackground: "#ddf4ff",
|
|
1572
|
+
collapsedBackgroundHover: "#b6e3ff",
|
|
1573
|
+
collapsedText: "#0969da",
|
|
1560
1574
|
// 缩进线
|
|
1561
1575
|
indentLine: "#d0d7de"
|
|
1562
1576
|
}
|
|
1563
|
-
},
|
|
1577
|
+
}, St = {
|
|
1564
1578
|
name: "github-dark",
|
|
1565
1579
|
colors: {
|
|
1566
1580
|
// 背景色
|
|
@@ -1592,10 +1606,16 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1592
1606
|
syntaxBracket: "#e6edf3",
|
|
1593
1607
|
// 悬停效果
|
|
1594
1608
|
hoverBackground: "#161b22",
|
|
1609
|
+
// 选中背景色
|
|
1610
|
+
selectionBackground: "rgba(121, 192, 255, 0.2)",
|
|
1611
|
+
// 折叠信息样式
|
|
1612
|
+
collapsedBackground: "#1c2128",
|
|
1613
|
+
collapsedBackgroundHover: "#2d333b",
|
|
1614
|
+
collapsedText: "#79c0ff",
|
|
1595
1615
|
// 缩进线
|
|
1596
1616
|
indentLine: "#30363d"
|
|
1597
1617
|
}
|
|
1598
|
-
},
|
|
1618
|
+
}, Bt = {
|
|
1599
1619
|
name: "min-light",
|
|
1600
1620
|
colors: {
|
|
1601
1621
|
// 背景色 - 纯白简洁
|
|
@@ -1627,6 +1647,12 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1627
1647
|
syntaxBracket: "#374151",
|
|
1628
1648
|
// 悬停效果
|
|
1629
1649
|
hoverBackground: "#f9f9f9",
|
|
1650
|
+
// 选中背景色
|
|
1651
|
+
selectionBackground: "rgba(59, 130, 246, 0.2)",
|
|
1652
|
+
// 折叠信息样式
|
|
1653
|
+
collapsedBackground: "#e0f2fe",
|
|
1654
|
+
collapsedBackgroundHover: "#bae6fd",
|
|
1655
|
+
collapsedText: "#0284c7",
|
|
1630
1656
|
// 缩进线
|
|
1631
1657
|
indentLine: "#e5e7eb"
|
|
1632
1658
|
}
|
|
@@ -1662,37 +1688,43 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1662
1688
|
syntaxBracket: "#6b5444",
|
|
1663
1689
|
// 悬停效果
|
|
1664
1690
|
hoverBackground: "#f8f2eb",
|
|
1691
|
+
// 选中背景色
|
|
1692
|
+
selectionBackground: "rgba(255, 107, 53, 0.2)",
|
|
1693
|
+
// 折叠信息样式
|
|
1694
|
+
collapsedBackground: "#ffe8d6",
|
|
1695
|
+
collapsedBackgroundHover: "#ffd4b0",
|
|
1696
|
+
collapsedText: "#d73502",
|
|
1665
1697
|
// 缩进线
|
|
1666
1698
|
indentLine: "#e8d5b7"
|
|
1667
1699
|
}
|
|
1668
|
-
},
|
|
1669
|
-
"github-light":
|
|
1670
|
-
"github-dark":
|
|
1671
|
-
"min-light":
|
|
1700
|
+
}, Vt = {
|
|
1701
|
+
"github-light": Xe,
|
|
1702
|
+
"github-dark": St,
|
|
1703
|
+
"min-light": Bt,
|
|
1672
1704
|
"slack-ochin": It
|
|
1673
1705
|
};
|
|
1674
|
-
function
|
|
1675
|
-
return
|
|
1706
|
+
function Lt(r = "github-light") {
|
|
1707
|
+
return Vt[r] || Xe;
|
|
1676
1708
|
}
|
|
1677
|
-
const
|
|
1709
|
+
const Rt = {
|
|
1678
1710
|
key: 0,
|
|
1679
1711
|
class: "json-format__toolbar"
|
|
1680
|
-
},
|
|
1712
|
+
}, jt = { class: "json-format__actions" }, Mt = ["disabled"], Ut = ["disabled"], Ft = ["disabled"], Xt = ["disabled"], Ht = { class: "json-format__info" }, Kt = {
|
|
1681
1713
|
key: 0,
|
|
1682
1714
|
class: "json-format__status json-format__status--success"
|
|
1683
|
-
},
|
|
1715
|
+
}, qt = {
|
|
1684
1716
|
key: 1,
|
|
1685
1717
|
class: "json-format__status json-format__status--error"
|
|
1686
|
-
},
|
|
1718
|
+
}, Qt = { class: "json-format__content" }, Wt = {
|
|
1687
1719
|
key: 0,
|
|
1688
1720
|
class: "json-format__error"
|
|
1689
|
-
},
|
|
1721
|
+
}, Yt = {
|
|
1690
1722
|
key: 1,
|
|
1691
1723
|
class: "json-format__error"
|
|
1692
|
-
},
|
|
1724
|
+
}, Gt = {
|
|
1693
1725
|
key: 2,
|
|
1694
1726
|
class: "json-format__viewer"
|
|
1695
|
-
},
|
|
1727
|
+
}, Zt = /* @__PURE__ */ be({
|
|
1696
1728
|
name: "JsonFormat",
|
|
1697
1729
|
__name: "index",
|
|
1698
1730
|
props: {
|
|
@@ -1704,7 +1736,7 @@ const Lt = {
|
|
|
1704
1736
|
},
|
|
1705
1737
|
emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress"],
|
|
1706
1738
|
setup(r, { expose: e, emit: t }) {
|
|
1707
|
-
|
|
1739
|
+
Ce((b) => ({
|
|
1708
1740
|
"325d5f6b": f.value.colors.border,
|
|
1709
1741
|
"407388ed": f.value.colors.background,
|
|
1710
1742
|
"1276f42c": f.value.colors.text,
|
|
@@ -1720,54 +1752,54 @@ const Lt = {
|
|
|
1720
1752
|
"781064f7": f.value.colors.errorBackground,
|
|
1721
1753
|
"3b9a02e9": f.value.colors.error
|
|
1722
1754
|
}));
|
|
1723
|
-
const s = r, n = t, o =
|
|
1724
|
-
if (!
|
|
1755
|
+
const s = r, n = t, o = W(null), i = W(""), c = W(/* @__PURE__ */ new Set()), a = W(null), l = W(""), h = V(() => i.value === ""), f = V(() => Lt(s.theme)), E = V(() => l.value ? null : a.value !== null ? a.value : o.value), _ = (b) => {
|
|
1756
|
+
if (!b.trim()) {
|
|
1725
1757
|
o.value = null, i.value = "", a.value = null, l.value = "";
|
|
1726
1758
|
return;
|
|
1727
1759
|
}
|
|
1728
1760
|
try {
|
|
1729
|
-
let
|
|
1730
|
-
const
|
|
1731
|
-
if (!
|
|
1761
|
+
let v = b;
|
|
1762
|
+
const d = /(:\s*|,\s*|\[\s*)-?\d{16,}/.test(v), m = /(:\s*|,\s*|\[\s*)-?\d+\.\d*0+\s*[,}\]\s]*/.test(v);
|
|
1763
|
+
if (!d && !m)
|
|
1732
1764
|
try {
|
|
1733
|
-
o.value = JSON.parse(
|
|
1734
|
-
|
|
1765
|
+
o.value = JSON.parse(v), i.value = "", a.value = null, l.value = "", he(() => {
|
|
1766
|
+
E.value !== null && p();
|
|
1735
1767
|
});
|
|
1736
1768
|
return;
|
|
1737
1769
|
} catch {
|
|
1738
1770
|
}
|
|
1739
|
-
|
|
1740
|
-
let
|
|
1741
|
-
for (;
|
|
1742
|
-
const
|
|
1743
|
-
if (
|
|
1744
|
-
|
|
1745
|
-
else if (
|
|
1746
|
-
|
|
1771
|
+
v = ((P) => {
|
|
1772
|
+
let I = "", M = !1, U = !1, D = 0;
|
|
1773
|
+
for (; D < P.length; ) {
|
|
1774
|
+
const ue = P[D];
|
|
1775
|
+
if (M)
|
|
1776
|
+
U ? U = !1 : ue === "\\" ? U = !0 : ue === '"' && (M = !1), I += ue, D++;
|
|
1777
|
+
else if (ue === '"')
|
|
1778
|
+
M = !0, I += ue, D++;
|
|
1747
1779
|
else {
|
|
1748
|
-
const
|
|
1749
|
-
let
|
|
1750
|
-
if (
|
|
1751
|
-
|
|
1780
|
+
const Pe = P.slice(D);
|
|
1781
|
+
let z = Pe.match(/^([:,\[\s]*)(-?\d{16,})(\s*[,\}\]\s]|$)/);
|
|
1782
|
+
if (z) {
|
|
1783
|
+
I += z[1] + '{"__protected_number__":"' + z[2] + '"}' + z[3], D += z[0].length;
|
|
1752
1784
|
continue;
|
|
1753
1785
|
}
|
|
1754
|
-
if (
|
|
1755
|
-
|
|
1786
|
+
if (z = Pe.match(/^([:,\[\s]*)(-?\d+\.\d*0+)(\s*[,\}\]\s]|$)/), z) {
|
|
1787
|
+
I += z[1] + '{"__protected_number__":"' + z[2] + '"}' + z[3], D += z[0].length;
|
|
1756
1788
|
continue;
|
|
1757
1789
|
}
|
|
1758
|
-
|
|
1790
|
+
I += ue, D++;
|
|
1759
1791
|
}
|
|
1760
1792
|
}
|
|
1761
|
-
return
|
|
1762
|
-
})(
|
|
1763
|
-
|
|
1793
|
+
return I;
|
|
1794
|
+
})(v), o.value = JSON.parse(v), i.value = "", a.value = null, l.value = "", he(() => {
|
|
1795
|
+
E.value !== null && p();
|
|
1764
1796
|
});
|
|
1765
|
-
} catch (
|
|
1766
|
-
i.value =
|
|
1797
|
+
} catch (v) {
|
|
1798
|
+
i.value = v instanceof Error ? v.message : "Unknown parsing error", o.value = null, a.value = null, l.value = "";
|
|
1767
1799
|
}
|
|
1768
|
-
}, w = (
|
|
1769
|
-
if (!
|
|
1770
|
-
|
|
1800
|
+
}, w = (b) => {
|
|
1801
|
+
if (!b || !b.expression.trim()) {
|
|
1802
|
+
O();
|
|
1771
1803
|
return;
|
|
1772
1804
|
}
|
|
1773
1805
|
if (!o.value) {
|
|
@@ -1775,272 +1807,275 @@ const Lt = {
|
|
|
1775
1807
|
return;
|
|
1776
1808
|
}
|
|
1777
1809
|
try {
|
|
1778
|
-
let
|
|
1779
|
-
if (
|
|
1780
|
-
|
|
1781
|
-
else if (
|
|
1782
|
-
|
|
1810
|
+
let v;
|
|
1811
|
+
if (b.type === "jsonpath")
|
|
1812
|
+
v = L({ path: b.expression, json: o.value }), v.length === 1 && b.expression.includes("$[") === !1 && !b.expression.endsWith("[*]") ? a.value = v[0] : a.value = v;
|
|
1813
|
+
else if (b.type === "js")
|
|
1814
|
+
v = new Function("data", `
|
|
1783
1815
|
try {
|
|
1784
|
-
return ${
|
|
1816
|
+
return ${b.expression};
|
|
1785
1817
|
} catch (error) {
|
|
1786
1818
|
throw new Error('JavaScript expression error: ' + error.message);
|
|
1787
1819
|
}
|
|
1788
|
-
`)(o.value), a.value =
|
|
1820
|
+
`)(o.value), a.value = v;
|
|
1789
1821
|
else
|
|
1790
|
-
throw new Error(`Unsupported filter type: ${
|
|
1822
|
+
throw new Error(`Unsupported filter type: ${b.type}`);
|
|
1791
1823
|
l.value = "", he(() => {
|
|
1792
|
-
|
|
1824
|
+
p();
|
|
1793
1825
|
});
|
|
1794
|
-
} catch (
|
|
1795
|
-
l.value =
|
|
1826
|
+
} catch (v) {
|
|
1827
|
+
l.value = v instanceof Error ? v.message : "Filter execution error", a.value = null;
|
|
1796
1828
|
}
|
|
1797
|
-
},
|
|
1829
|
+
}, O = () => {
|
|
1798
1830
|
a.value = null, l.value = "";
|
|
1799
1831
|
};
|
|
1800
|
-
|
|
1801
|
-
|
|
1832
|
+
Ue(() => s.modelValue, (b) => {
|
|
1833
|
+
_(b);
|
|
1802
1834
|
}, { immediate: !0 });
|
|
1803
|
-
const
|
|
1804
|
-
const
|
|
1805
|
-
if (
|
|
1806
|
-
return
|
|
1807
|
-
if (!Array.isArray(
|
|
1808
|
-
return `__PROTECTED_NUMBER_${
|
|
1809
|
-
if (Array.isArray(
|
|
1810
|
-
return
|
|
1811
|
-
const
|
|
1812
|
-
for (const [
|
|
1813
|
-
|
|
1814
|
-
return
|
|
1815
|
-
},
|
|
1816
|
-
return JSON.stringify(
|
|
1817
|
-
},
|
|
1835
|
+
const x = (b, v, d) => {
|
|
1836
|
+
const m = (I) => {
|
|
1837
|
+
if (I === null || typeof I != "object")
|
|
1838
|
+
return I;
|
|
1839
|
+
if (!Array.isArray(I) && "__protected_number__" in I && Object.keys(I).length === 1)
|
|
1840
|
+
return `__PROTECTED_NUMBER_${I.__protected_number__}_PROTECTED_NUMBER__`;
|
|
1841
|
+
if (Array.isArray(I))
|
|
1842
|
+
return I.map((U) => m(U));
|
|
1843
|
+
const M = {};
|
|
1844
|
+
for (const [U, D] of Object.entries(I))
|
|
1845
|
+
M[U] = m(D);
|
|
1846
|
+
return M;
|
|
1847
|
+
}, T = m(b);
|
|
1848
|
+
return JSON.stringify(T, v, d).replace(/"__PROTECTED_NUMBER_(.+?)_PROTECTED_NUMBER__"/g, "$1");
|
|
1849
|
+
}, S = (b, v) => {
|
|
1818
1850
|
if (!s.readonly)
|
|
1819
1851
|
try {
|
|
1820
|
-
const
|
|
1821
|
-
n("update:modelValue",
|
|
1822
|
-
} catch (
|
|
1823
|
-
console.error("Failed to update JSON:",
|
|
1852
|
+
const d = X(o.value, b, v), m = x(d, null, 2);
|
|
1853
|
+
n("update:modelValue", m);
|
|
1854
|
+
} catch (d) {
|
|
1855
|
+
console.error("Failed to update JSON:", d);
|
|
1824
1856
|
}
|
|
1825
|
-
},
|
|
1826
|
-
if (!
|
|
1827
|
-
const
|
|
1828
|
-
let
|
|
1829
|
-
for (let
|
|
1830
|
-
const
|
|
1831
|
-
|
|
1857
|
+
}, X = (b, v, d) => {
|
|
1858
|
+
if (!v || v === "root") return d;
|
|
1859
|
+
const m = v.split("."), T = q(b, m.slice(0, -1));
|
|
1860
|
+
let P = T;
|
|
1861
|
+
for (let M = 0; M < m.length - 1; M++) {
|
|
1862
|
+
const U = m[M];
|
|
1863
|
+
U !== "root" && (Array.isArray(P) ? P = P[parseInt(U)] : P = P[U]);
|
|
1832
1864
|
}
|
|
1833
|
-
const
|
|
1834
|
-
return
|
|
1835
|
-
},
|
|
1836
|
-
|
|
1837
|
-
},
|
|
1838
|
-
const
|
|
1839
|
-
|
|
1840
|
-
const
|
|
1841
|
-
|
|
1842
|
-
}) : Object.keys(
|
|
1843
|
-
const
|
|
1844
|
-
|
|
1865
|
+
const I = m[m.length - 1];
|
|
1866
|
+
return I === "root" ? d : (Array.isArray(P) ? P[parseInt(I)] = d : P[I] = d, T);
|
|
1867
|
+
}, Z = (b) => {
|
|
1868
|
+
c.value.has(b) ? c.value.delete(b) : c.value.add(b);
|
|
1869
|
+
}, p = () => {
|
|
1870
|
+
const b = /* @__PURE__ */ new Set(), v = (d, m = "") => {
|
|
1871
|
+
d !== null && typeof d == "object" && (b.add(m || "root"), Array.isArray(d) ? d.forEach((T, P) => {
|
|
1872
|
+
const I = m ? `${m}.${P}` : `${P}`;
|
|
1873
|
+
v(T, I);
|
|
1874
|
+
}) : Object.keys(d).forEach((T) => {
|
|
1875
|
+
const P = m ? `${m}.${T}` : T;
|
|
1876
|
+
v(d[T], P);
|
|
1845
1877
|
}));
|
|
1846
1878
|
};
|
|
1847
|
-
|
|
1848
|
-
},
|
|
1849
|
-
|
|
1850
|
-
},
|
|
1879
|
+
v(E.value), c.value = b, n("expand-all");
|
|
1880
|
+
}, g = () => {
|
|
1881
|
+
c.value = /* @__PURE__ */ new Set(["root"]), n("collapse-all");
|
|
1882
|
+
}, C = async () => {
|
|
1851
1883
|
if (h.value)
|
|
1852
1884
|
try {
|
|
1853
|
-
const
|
|
1854
|
-
await navigator.clipboard.writeText(
|
|
1855
|
-
} catch (
|
|
1856
|
-
console.error("Failed to copy JSON:",
|
|
1885
|
+
const b = E.value, v = x(b, null, 2);
|
|
1886
|
+
await navigator.clipboard.writeText(v), n("copy-success", v);
|
|
1887
|
+
} catch (b) {
|
|
1888
|
+
console.error("Failed to copy JSON:", b), n("copy-error", b instanceof Error ? b : new Error("Failed to copy JSON"));
|
|
1857
1889
|
}
|
|
1858
|
-
},
|
|
1890
|
+
}, $ = () => {
|
|
1859
1891
|
if (h.value)
|
|
1860
1892
|
try {
|
|
1861
|
-
const
|
|
1862
|
-
n("update:modelValue",
|
|
1863
|
-
} catch (
|
|
1864
|
-
console.error("Failed to compress JSON:",
|
|
1893
|
+
const b = E.value, v = x(b);
|
|
1894
|
+
n("update:modelValue", v), n("compress", v);
|
|
1895
|
+
} catch (b) {
|
|
1896
|
+
console.error("Failed to compress JSON:", b);
|
|
1865
1897
|
}
|
|
1866
|
-
},
|
|
1898
|
+
}, R = async (b) => {
|
|
1867
1899
|
try {
|
|
1868
|
-
let
|
|
1869
|
-
typeof
|
|
1870
|
-
} catch (
|
|
1871
|
-
console.error("Failed to copy value:",
|
|
1900
|
+
let v;
|
|
1901
|
+
typeof b == "object" && b !== null && !Array.isArray(b) && "__protected_number__" in b && Object.keys(b).length === 1 ? v = b.__protected_number__ : typeof b == "string" ? v = `"${b}"` : v = JSON.stringify(b), await navigator.clipboard.writeText(v);
|
|
1902
|
+
} catch (v) {
|
|
1903
|
+
console.error("Failed to copy value:", v);
|
|
1872
1904
|
}
|
|
1873
|
-
},
|
|
1905
|
+
}, K = (b, v) => {
|
|
1874
1906
|
if (!s.readonly)
|
|
1875
1907
|
try {
|
|
1876
|
-
const
|
|
1877
|
-
n("update:modelValue",
|
|
1878
|
-
} catch (
|
|
1879
|
-
console.error("Failed to rename key:",
|
|
1908
|
+
const d = Y(o.value, b, v), m = x(d, null, 2);
|
|
1909
|
+
n("update:modelValue", m), oe(b, v);
|
|
1910
|
+
} catch (d) {
|
|
1911
|
+
console.error("Failed to rename key:", d);
|
|
1880
1912
|
}
|
|
1881
|
-
}, Y = (
|
|
1882
|
-
if (!
|
|
1883
|
-
const
|
|
1884
|
-
if (
|
|
1885
|
-
const
|
|
1886
|
-
return
|
|
1913
|
+
}, Y = (b, v, d) => {
|
|
1914
|
+
if (!v || v === "root") return b;
|
|
1915
|
+
const m = v.split("."), T = q(b, m.slice(0, -1));
|
|
1916
|
+
if (m.length === 1) {
|
|
1917
|
+
const M = m[0];
|
|
1918
|
+
return T && typeof T == "object" && !Array.isArray(T) ? se(T, M, d) : T;
|
|
1887
1919
|
}
|
|
1888
|
-
let
|
|
1889
|
-
for (let
|
|
1890
|
-
const
|
|
1891
|
-
Array.isArray(
|
|
1920
|
+
let P = T;
|
|
1921
|
+
for (let M = 0; M < m.length - 1; M++) {
|
|
1922
|
+
const U = m[M];
|
|
1923
|
+
Array.isArray(P) ? P = P[parseInt(U)] : P = P[U];
|
|
1892
1924
|
}
|
|
1893
|
-
const
|
|
1894
|
-
if (!Array.isArray(
|
|
1895
|
-
const
|
|
1896
|
-
|
|
1925
|
+
const I = m[m.length - 1];
|
|
1926
|
+
if (!Array.isArray(P) && P && typeof P == "object") {
|
|
1927
|
+
const M = se(P, I, d), U = m.slice(0, -1);
|
|
1928
|
+
U.length > 0 && J(T, U, M);
|
|
1897
1929
|
}
|
|
1898
|
-
return
|
|
1899
|
-
},
|
|
1900
|
-
if (
|
|
1901
|
-
if (Array.isArray(
|
|
1902
|
-
const
|
|
1903
|
-
return
|
|
1904
|
-
} else if (
|
|
1905
|
-
const
|
|
1906
|
-
return
|
|
1930
|
+
return T;
|
|
1931
|
+
}, q = (b, v) => {
|
|
1932
|
+
if (v.length === 0) return b;
|
|
1933
|
+
if (Array.isArray(b)) {
|
|
1934
|
+
const d = [...b], m = v[0], T = parseInt(m);
|
|
1935
|
+
return v.length === 1 || (d[T] = q(b[T], v.slice(1))), d;
|
|
1936
|
+
} else if (b && typeof b == "object") {
|
|
1937
|
+
const d = { ...b }, m = v[0];
|
|
1938
|
+
return v.length === 1 || (d[m] = q(b[m], v.slice(1))), d;
|
|
1907
1939
|
}
|
|
1908
|
-
return
|
|
1909
|
-
},
|
|
1910
|
-
if (!
|
|
1911
|
-
return
|
|
1912
|
-
const
|
|
1913
|
-
for (const
|
|
1914
|
-
|
|
1915
|
-
return
|
|
1916
|
-
},
|
|
1917
|
-
let
|
|
1918
|
-
for (let
|
|
1919
|
-
const
|
|
1920
|
-
Array.isArray(
|
|
1940
|
+
return b;
|
|
1941
|
+
}, se = (b, v, d) => {
|
|
1942
|
+
if (!b || typeof b != "object" || Array.isArray(b))
|
|
1943
|
+
return b;
|
|
1944
|
+
const m = Object.keys(b), T = {};
|
|
1945
|
+
for (const P of m)
|
|
1946
|
+
P === v ? T[d] = b[P] : T[P] = b[P];
|
|
1947
|
+
return T;
|
|
1948
|
+
}, J = (b, v, d) => {
|
|
1949
|
+
let m = b;
|
|
1950
|
+
for (let P = 0; P < v.length - 1; P++) {
|
|
1951
|
+
const I = v[P];
|
|
1952
|
+
Array.isArray(m) ? m = m[parseInt(I)] : m = m[I];
|
|
1921
1953
|
}
|
|
1922
|
-
const
|
|
1923
|
-
Array.isArray(
|
|
1924
|
-
},
|
|
1925
|
-
const
|
|
1926
|
-
|
|
1927
|
-
if (
|
|
1928
|
-
const
|
|
1929
|
-
|
|
1930
|
-
} else if (
|
|
1931
|
-
const
|
|
1932
|
-
|
|
1933
|
-
const
|
|
1934
|
-
|
|
1954
|
+
const T = v[v.length - 1];
|
|
1955
|
+
Array.isArray(m) ? m[parseInt(T)] = d : m[T] = d;
|
|
1956
|
+
}, oe = (b, v) => {
|
|
1957
|
+
const d = /* @__PURE__ */ new Set();
|
|
1958
|
+
c.value.forEach((m) => {
|
|
1959
|
+
if (m === b) {
|
|
1960
|
+
const T = b.split(".");
|
|
1961
|
+
T[T.length - 1] = v, d.add(T.join("."));
|
|
1962
|
+
} else if (m.startsWith(b + ".")) {
|
|
1963
|
+
const T = b.split(".");
|
|
1964
|
+
T[T.length - 1] = v;
|
|
1965
|
+
const P = T.join("."), I = m.substring(b.length);
|
|
1966
|
+
d.add(P + I);
|
|
1935
1967
|
} else
|
|
1936
|
-
|
|
1937
|
-
}),
|
|
1968
|
+
d.add(m);
|
|
1969
|
+
}), c.value = d;
|
|
1938
1970
|
};
|
|
1939
1971
|
return e({
|
|
1940
1972
|
// 核心操作方法
|
|
1941
|
-
copyJson:
|
|
1942
|
-
compressSource:
|
|
1943
|
-
expandAll:
|
|
1944
|
-
collapseAll:
|
|
1945
|
-
toggleExpand:
|
|
1946
|
-
updateValue:
|
|
1947
|
-
updateKey:
|
|
1973
|
+
copyJson: C,
|
|
1974
|
+
compressSource: $,
|
|
1975
|
+
expandAll: p,
|
|
1976
|
+
collapseAll: g,
|
|
1977
|
+
toggleExpand: Z,
|
|
1978
|
+
updateValue: S,
|
|
1979
|
+
updateKey: K,
|
|
1948
1980
|
// Filter 相关方法
|
|
1949
1981
|
filter: w,
|
|
1950
|
-
clearFilter:
|
|
1982
|
+
clearFilter: O,
|
|
1951
1983
|
// 状态访问方法
|
|
1952
1984
|
isValidJson: () => h.value,
|
|
1953
1985
|
getParsedJson: () => o.value,
|
|
1954
1986
|
getFilteredJson: () => a.value,
|
|
1955
|
-
getExpandedNodes: () =>
|
|
1987
|
+
getExpandedNodes: () => c.value,
|
|
1956
1988
|
getParseError: () => i.value,
|
|
1957
1989
|
getFilterError: () => l.value,
|
|
1958
1990
|
// 工具方法
|
|
1959
|
-
parseJson: (
|
|
1960
|
-
copyValue: (
|
|
1961
|
-
}), (
|
|
1962
|
-
class:
|
|
1991
|
+
parseJson: (b) => _(b),
|
|
1992
|
+
copyValue: (b) => R(b)
|
|
1993
|
+
}), (b, v) => (k(), A("div", {
|
|
1994
|
+
class: Oe(["json-format", `json-format--${f.value.name}`])
|
|
1963
1995
|
}, [
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1996
|
+
b.showToolbar ? (k(), A("div", Rt, [
|
|
1997
|
+
y("div", jt, [
|
|
1998
|
+
y("button", {
|
|
1967
1999
|
class: "json-format__btn json-format__btn--primary",
|
|
1968
|
-
onClick:
|
|
2000
|
+
onClick: C,
|
|
1969
2001
|
disabled: !h.value,
|
|
1970
2002
|
title: "Copy JSON"
|
|
1971
|
-
}, " 📋 Copy ", 8,
|
|
1972
|
-
|
|
2003
|
+
}, " 📋 Copy ", 8, Mt),
|
|
2004
|
+
y("button", {
|
|
1973
2005
|
class: "json-format__btn json-format__btn--secondary",
|
|
1974
|
-
onClick:
|
|
2006
|
+
onClick: p,
|
|
1975
2007
|
disabled: !h.value,
|
|
1976
2008
|
title: "Expand All"
|
|
1977
|
-
}, " ⬇️ Expand All ", 8,
|
|
1978
|
-
|
|
2009
|
+
}, " ⬇️ Expand All ", 8, Ut),
|
|
2010
|
+
y("button", {
|
|
1979
2011
|
class: "json-format__btn json-format__btn--secondary",
|
|
1980
|
-
onClick:
|
|
2012
|
+
onClick: g,
|
|
1981
2013
|
disabled: !h.value,
|
|
1982
2014
|
title: "Collapse All"
|
|
1983
|
-
}, " ➡️ Collapse All ", 8,
|
|
1984
|
-
|
|
2015
|
+
}, " ➡️ Collapse All ", 8, Ft),
|
|
2016
|
+
y("button", {
|
|
1985
2017
|
class: "json-format__btn json-format__btn--secondary",
|
|
1986
|
-
onClick:
|
|
2018
|
+
onClick: $,
|
|
1987
2019
|
disabled: !h.value,
|
|
1988
2020
|
title: "Compress JSON"
|
|
1989
|
-
}, " 📦 Compress ", 8,
|
|
2021
|
+
}, " 📦 Compress ", 8, Xt)
|
|
1990
2022
|
]),
|
|
1991
|
-
|
|
1992
|
-
h.value ? (
|
|
2023
|
+
y("div", Ht, [
|
|
2024
|
+
h.value ? (k(), A("span", Kt, " ✅ Valid JSON ")) : (k(), A("span", qt, " ❌ Invalid JSON "))
|
|
1993
2025
|
])
|
|
1994
|
-
])) :
|
|
1995
|
-
|
|
1996
|
-
h.value ? l.value ? (
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
])) : (
|
|
2000
|
-
|
|
2001
|
-
value:
|
|
2026
|
+
])) : H("", !0),
|
|
2027
|
+
y("div", Qt, [
|
|
2028
|
+
h.value ? l.value ? (k(), A("div", Yt, [
|
|
2029
|
+
v[1] || (v[1] = y("h4", null, "Filter Error:", -1)),
|
|
2030
|
+
y("pre", null, B(l.value), 1)
|
|
2031
|
+
])) : (k(), A("div", Gt, [
|
|
2032
|
+
Me($t, {
|
|
2033
|
+
value: E.value,
|
|
2002
2034
|
"key-name": "",
|
|
2003
2035
|
level: 0,
|
|
2004
|
-
expanded:
|
|
2036
|
+
expanded: c.value,
|
|
2005
2037
|
"is-last": !0,
|
|
2006
2038
|
theme: f.value,
|
|
2007
|
-
"onUpdate:value":
|
|
2008
|
-
onToggleExpand:
|
|
2009
|
-
onCopy:
|
|
2010
|
-
"onUpdate:key":
|
|
2039
|
+
"onUpdate:value": S,
|
|
2040
|
+
onToggleExpand: Z,
|
|
2041
|
+
onCopy: R,
|
|
2042
|
+
"onUpdate:key": K
|
|
2011
2043
|
}, null, 8, ["value", "expanded", "theme"])
|
|
2012
|
-
])) : (
|
|
2013
|
-
|
|
2014
|
-
|
|
2044
|
+
])) : (k(), A("div", Wt, [
|
|
2045
|
+
v[0] || (v[0] = y("h4", null, "JSON Parse Error:", -1)),
|
|
2046
|
+
y("pre", null, B(i.value), 1)
|
|
2015
2047
|
]))
|
|
2016
2048
|
])
|
|
2017
2049
|
], 2));
|
|
2018
2050
|
}
|
|
2019
|
-
}),
|
|
2051
|
+
}), zt = /* @__PURE__ */ ye(Zt, [["__scopeId", "data-v-b956002c"]]), Dt = {
|
|
2020
2052
|
key: 0,
|
|
2021
2053
|
class: "xml-node__comment"
|
|
2022
|
-
},
|
|
2054
|
+
}, Jt = {
|
|
2023
2055
|
key: 1,
|
|
2024
2056
|
class: "xml-node__cdata"
|
|
2025
|
-
},
|
|
2057
|
+
}, er = {
|
|
2026
2058
|
key: 2,
|
|
2027
2059
|
class: "xml-node__element"
|
|
2028
|
-
},
|
|
2060
|
+
}, tr = {
|
|
2029
2061
|
key: 0,
|
|
2030
2062
|
class: "xml-node__line"
|
|
2031
|
-
},
|
|
2063
|
+
}, rr = {
|
|
2032
2064
|
key: 1,
|
|
2033
2065
|
class: "xml-node__line"
|
|
2034
|
-
},
|
|
2066
|
+
}, nr = { key: 2 }, sr = {
|
|
2067
|
+
key: 0,
|
|
2068
|
+
class: "xml-node__line"
|
|
2069
|
+
}, or = ["title"], ir = { class: "xml-node__line" }, ar = ["title"], lr = { key: 1 }, cr = ["title"], ur = {
|
|
2035
2070
|
key: 0,
|
|
2036
2071
|
class: "xml-node__children"
|
|
2037
|
-
},
|
|
2072
|
+
}, dr = {
|
|
2038
2073
|
key: 0,
|
|
2039
2074
|
class: "xml-node__text"
|
|
2040
|
-
},
|
|
2075
|
+
}, fr = {
|
|
2041
2076
|
key: 1,
|
|
2042
2077
|
class: "xml-node__line"
|
|
2043
|
-
},
|
|
2078
|
+
}, hr = /* @__PURE__ */ be({
|
|
2044
2079
|
__name: "XmlNode",
|
|
2045
2080
|
props: {
|
|
2046
2081
|
node: {},
|
|
@@ -2052,279 +2087,351 @@ const Lt = {
|
|
|
2052
2087
|
},
|
|
2053
2088
|
emits: ["toggle-expand", "copy"],
|
|
2054
2089
|
setup(r, { emit: e }) {
|
|
2055
|
-
const t = r, s = e, n = V(() => Object.keys(t.node).find((
|
|
2056
|
-
const p = t.node[":@"] || {},
|
|
2057
|
-
return Object.keys(p).forEach((
|
|
2058
|
-
|
|
2059
|
-
}),
|
|
2090
|
+
const t = r, s = e, n = V(() => Object.keys(t.node).find((g) => !g.startsWith(":") && !g.startsWith("#")) || ""), o = V(() => n.value ? t.parentPath ? `${t.parentPath}[${t.index}]` : `${n.value}[${t.index}]` : ""), i = V(() => t.expanded.has(o.value)), c = V(() => t.node["#comment"] ? "comment" : t.node.__cdata ? "cdata" : n.value ? "element" : "unknown"), a = V(() => {
|
|
2091
|
+
const p = t.node[":@"] || {}, g = {};
|
|
2092
|
+
return Object.keys(p).forEach((C) => {
|
|
2093
|
+
C.startsWith("@_") && (g[C.substring(2)] = p[C]);
|
|
2094
|
+
}), g;
|
|
2060
2095
|
}), l = V(() => {
|
|
2061
|
-
if (
|
|
2096
|
+
if (c.value !== "element" || !n.value) return [];
|
|
2062
2097
|
const p = t.node[n.value];
|
|
2063
2098
|
return Array.isArray(p) ? p : [];
|
|
2064
2099
|
}), h = V(() => l.value.some((p) => p.__cdata)), f = V(() => {
|
|
2065
2100
|
if (!h.value) return "";
|
|
2066
|
-
const p = l.value.find((
|
|
2101
|
+
const p = l.value.find((g) => g.__cdata);
|
|
2067
2102
|
if (p && Array.isArray(p.__cdata)) {
|
|
2068
|
-
const
|
|
2069
|
-
if (
|
|
2070
|
-
return
|
|
2103
|
+
const g = p.__cdata;
|
|
2104
|
+
if (g.length > 0 && g[0]["#text"])
|
|
2105
|
+
return g[0]["#text"];
|
|
2071
2106
|
}
|
|
2072
2107
|
return "";
|
|
2073
|
-
}),
|
|
2074
|
-
if (
|
|
2108
|
+
}), E = V(() => {
|
|
2109
|
+
if (c.value !== "element" || !n.value || h.value) return "";
|
|
2075
2110
|
const p = t.node[n.value];
|
|
2076
2111
|
if (!Array.isArray(p)) return "";
|
|
2077
|
-
const
|
|
2078
|
-
return
|
|
2079
|
-
}),
|
|
2080
|
-
if (
|
|
2112
|
+
const g = p.find((C) => C["#text"]);
|
|
2113
|
+
return g ? g["#text"] : "";
|
|
2114
|
+
}), _ = V(() => {
|
|
2115
|
+
if (c.value !== "comment") return "";
|
|
2081
2116
|
const p = t.node["#comment"];
|
|
2082
2117
|
return Array.isArray(p) && p.length > 0 && p[0]["#text"] || "";
|
|
2083
|
-
}), w = V(() => l.value.some((p) => Object.keys(p).some((
|
|
2118
|
+
}), w = V(() => l.value.some((p) => Object.keys(p).some((C) => !C.startsWith("#") && !C.startsWith(":")))), O = V(() => w.value ? l.value.filter((p) => Object.keys(p).some((C) => !C.startsWith("#") && !C.startsWith(":"))).length : 0), x = V(() => c.value === "element" && !w.value && E.value.trim() !== ""), S = () => {
|
|
2084
2119
|
w.value && s("toggle-expand", o.value);
|
|
2085
|
-
},
|
|
2086
|
-
return (p,
|
|
2087
|
-
const
|
|
2088
|
-
return
|
|
2120
|
+
}, X = (p, g) => `${o.value}-child-${g}`, Z = () => `${o.value}.${n.value}`;
|
|
2121
|
+
return (p, g) => {
|
|
2122
|
+
const C = je("XmlNode", !0);
|
|
2123
|
+
return k(), A("div", {
|
|
2089
2124
|
class: "xml-node",
|
|
2090
|
-
style:
|
|
2125
|
+
style: N({ paddingLeft: p.level > 0 ? "16px" : "0" })
|
|
2091
2126
|
}, [
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
style:
|
|
2095
|
-
}, " <!-- " +
|
|
2096
|
-
])) :
|
|
2097
|
-
|
|
2098
|
-
style:
|
|
2099
|
-
}, " <![CDATA[" +
|
|
2100
|
-
])) :
|
|
2101
|
-
h.value ? (
|
|
2102
|
-
|
|
2127
|
+
c.value === "comment" ? (k(), A("div", Dt, [
|
|
2128
|
+
y("span", {
|
|
2129
|
+
style: N({ color: p.theme.colors.xmlComment })
|
|
2130
|
+
}, " <!-- " + B(_.value) + " --> ", 5)
|
|
2131
|
+
])) : c.value === "cdata" ? (k(), A("div", Jt, [
|
|
2132
|
+
y("span", {
|
|
2133
|
+
style: N({ color: p.theme.colors.xmlCdata })
|
|
2134
|
+
}, " <![CDATA[" + B(p.node.__cdata) + "]]> ", 5)
|
|
2135
|
+
])) : c.value === "element" ? (k(), A("div", er, [
|
|
2136
|
+
h.value ? (k(), A("div", tr, [
|
|
2137
|
+
y("span", {
|
|
2103
2138
|
class: "xml-node__bracket",
|
|
2104
|
-
style:
|
|
2139
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2105
2140
|
}, "<", 4),
|
|
2106
|
-
|
|
2141
|
+
y("span", {
|
|
2107
2142
|
class: "xml-node__tag",
|
|
2108
|
-
style:
|
|
2109
|
-
},
|
|
2110
|
-
(
|
|
2111
|
-
key:
|
|
2143
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2144
|
+
}, B(n.value), 5),
|
|
2145
|
+
(k(!0), A(re, null, ae(a.value, ($, R) => (k(), A("span", {
|
|
2146
|
+
key: R,
|
|
2112
2147
|
class: "xml-node__attribute"
|
|
2113
2148
|
}, [
|
|
2114
|
-
|
|
2149
|
+
y("span", {
|
|
2115
2150
|
class: "xml-node__attr-name",
|
|
2116
|
-
style:
|
|
2117
|
-
}, R
|
|
2118
|
-
|
|
2151
|
+
style: N({ color: p.theme.colors.xmlAttribute })
|
|
2152
|
+
}, B(R), 5),
|
|
2153
|
+
y("span", {
|
|
2119
2154
|
class: "xml-node__equals",
|
|
2120
|
-
style:
|
|
2155
|
+
style: N({ color: p.theme.colors.xmlEquals })
|
|
2121
2156
|
}, "=", 4),
|
|
2122
|
-
|
|
2157
|
+
y("span", {
|
|
2123
2158
|
class: "xml-node__quote",
|
|
2124
|
-
style:
|
|
2159
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2125
2160
|
}, '"', 4),
|
|
2126
|
-
|
|
2161
|
+
y("span", {
|
|
2127
2162
|
class: "xml-node__attr-value",
|
|
2128
|
-
style:
|
|
2129
|
-
},
|
|
2130
|
-
|
|
2163
|
+
style: N({ color: p.theme.colors.xmlAttributeValue })
|
|
2164
|
+
}, B($), 5),
|
|
2165
|
+
y("span", {
|
|
2131
2166
|
class: "xml-node__quote",
|
|
2132
|
-
style:
|
|
2167
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2133
2168
|
}, '"', 4)
|
|
2134
2169
|
]))), 128)),
|
|
2135
|
-
|
|
2170
|
+
y("span", {
|
|
2136
2171
|
class: "xml-node__bracket",
|
|
2137
|
-
style:
|
|
2172
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2138
2173
|
}, ">", 4),
|
|
2139
|
-
|
|
2174
|
+
y("span", {
|
|
2140
2175
|
class: "xml-node__cdata",
|
|
2141
|
-
style:
|
|
2142
|
-
}, "<![CDATA[" +
|
|
2143
|
-
|
|
2176
|
+
style: N({ color: p.theme.colors.xmlCdata })
|
|
2177
|
+
}, "<![CDATA[" + B(f.value) + "]]>", 5),
|
|
2178
|
+
y("span", {
|
|
2144
2179
|
class: "xml-node__bracket",
|
|
2145
|
-
style:
|
|
2180
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2146
2181
|
}, "</", 4),
|
|
2147
|
-
|
|
2182
|
+
y("span", {
|
|
2148
2183
|
class: "xml-node__tag",
|
|
2149
|
-
style:
|
|
2150
|
-
},
|
|
2151
|
-
|
|
2184
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2185
|
+
}, B(n.value), 5),
|
|
2186
|
+
y("span", {
|
|
2152
2187
|
class: "xml-node__bracket",
|
|
2153
|
-
style:
|
|
2188
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2154
2189
|
}, ">", 4)
|
|
2155
|
-
])) :
|
|
2156
|
-
|
|
2190
|
+
])) : x.value ? (k(), A("div", rr, [
|
|
2191
|
+
y("span", {
|
|
2157
2192
|
class: "xml-node__bracket",
|
|
2158
|
-
style:
|
|
2193
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2159
2194
|
}, "<", 4),
|
|
2160
|
-
|
|
2195
|
+
y("span", {
|
|
2161
2196
|
class: "xml-node__tag",
|
|
2162
|
-
style:
|
|
2163
|
-
},
|
|
2164
|
-
(
|
|
2165
|
-
key:
|
|
2197
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2198
|
+
}, B(n.value), 5),
|
|
2199
|
+
(k(!0), A(re, null, ae(a.value, ($, R) => (k(), A("span", {
|
|
2200
|
+
key: R,
|
|
2166
2201
|
class: "xml-node__attribute"
|
|
2167
2202
|
}, [
|
|
2168
|
-
|
|
2203
|
+
y("span", {
|
|
2169
2204
|
class: "xml-node__attr-name",
|
|
2170
|
-
style:
|
|
2171
|
-
}, R
|
|
2172
|
-
|
|
2205
|
+
style: N({ color: p.theme.colors.xmlAttribute })
|
|
2206
|
+
}, B(R), 5),
|
|
2207
|
+
y("span", {
|
|
2173
2208
|
class: "xml-node__equals",
|
|
2174
|
-
style:
|
|
2209
|
+
style: N({ color: p.theme.colors.xmlEquals })
|
|
2175
2210
|
}, "=", 4),
|
|
2176
|
-
|
|
2211
|
+
y("span", {
|
|
2177
2212
|
class: "xml-node__quote",
|
|
2178
|
-
style:
|
|
2213
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2179
2214
|
}, '"', 4),
|
|
2180
|
-
|
|
2215
|
+
y("span", {
|
|
2181
2216
|
class: "xml-node__attr-value",
|
|
2182
|
-
style:
|
|
2183
|
-
},
|
|
2184
|
-
|
|
2217
|
+
style: N({ color: p.theme.colors.xmlAttributeValue })
|
|
2218
|
+
}, B($), 5),
|
|
2219
|
+
y("span", {
|
|
2185
2220
|
class: "xml-node__quote",
|
|
2186
|
-
style:
|
|
2221
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2187
2222
|
}, '"', 4)
|
|
2188
2223
|
]))), 128)),
|
|
2189
|
-
|
|
2224
|
+
y("span", {
|
|
2190
2225
|
class: "xml-node__bracket",
|
|
2191
|
-
style:
|
|
2226
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2192
2227
|
}, ">", 4),
|
|
2193
|
-
|
|
2228
|
+
y("span", {
|
|
2194
2229
|
class: "xml-node__text-content",
|
|
2195
|
-
style:
|
|
2196
|
-
},
|
|
2197
|
-
|
|
2230
|
+
style: N({ color: p.theme.colors.xmlText })
|
|
2231
|
+
}, B(E.value), 5),
|
|
2232
|
+
y("span", {
|
|
2198
2233
|
class: "xml-node__bracket",
|
|
2199
|
-
style:
|
|
2234
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2200
2235
|
}, "</", 4),
|
|
2201
|
-
|
|
2236
|
+
y("span", {
|
|
2202
2237
|
class: "xml-node__tag",
|
|
2203
|
-
style:
|
|
2204
|
-
},
|
|
2205
|
-
|
|
2238
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2239
|
+
}, B(n.value), 5),
|
|
2240
|
+
y("span", {
|
|
2206
2241
|
class: "xml-node__bracket",
|
|
2207
|
-
style:
|
|
2242
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2208
2243
|
}, ">", 4)
|
|
2209
|
-
])) : (
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
key: 0,
|
|
2244
|
+
])) : (k(), A("div", nr, [
|
|
2245
|
+
!i.value && w.value ? (k(), A("div", sr, [
|
|
2246
|
+
y("span", {
|
|
2213
2247
|
class: "xml-node__clickable-part",
|
|
2214
|
-
onClick:
|
|
2215
|
-
title:
|
|
2248
|
+
onClick: g[0] || (g[0] = ($) => S()),
|
|
2249
|
+
title: "Click to expand"
|
|
2216
2250
|
}, [
|
|
2217
|
-
|
|
2251
|
+
y("span", {
|
|
2218
2252
|
class: "xml-node__bracket",
|
|
2219
|
-
style:
|
|
2253
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2220
2254
|
}, "<", 4),
|
|
2221
|
-
|
|
2255
|
+
y("span", {
|
|
2222
2256
|
class: "xml-node__tag",
|
|
2223
|
-
style:
|
|
2224
|
-
},
|
|
2225
|
-
]
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
style: P({ color: p.theme.colors.xmlBracket })
|
|
2229
|
-
}, "<", 4),
|
|
2230
|
-
v("span", {
|
|
2231
|
-
class: "xml-node__tag",
|
|
2232
|
-
style: P({ color: p.theme.colors.xmlTag })
|
|
2233
|
-
}, R(n.value), 5)
|
|
2234
|
-
])),
|
|
2235
|
-
(x(!0), A(de, null, fe(a.value, (O, I) => (x(), A("span", {
|
|
2236
|
-
key: I,
|
|
2257
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2258
|
+
}, B(n.value), 5)
|
|
2259
|
+
]),
|
|
2260
|
+
(k(!0), A(re, null, ae(a.value, ($, R) => (k(), A("span", {
|
|
2261
|
+
key: R,
|
|
2237
2262
|
class: "xml-node__attribute"
|
|
2238
2263
|
}, [
|
|
2239
|
-
|
|
2264
|
+
y("span", {
|
|
2240
2265
|
class: "xml-node__attr-name",
|
|
2241
|
-
style:
|
|
2242
|
-
}, R
|
|
2243
|
-
|
|
2266
|
+
style: N({ color: p.theme.colors.xmlAttribute })
|
|
2267
|
+
}, B(R), 5),
|
|
2268
|
+
y("span", {
|
|
2244
2269
|
class: "xml-node__equals",
|
|
2245
|
-
style:
|
|
2270
|
+
style: N({ color: p.theme.colors.xmlEquals })
|
|
2246
2271
|
}, "=", 4),
|
|
2247
|
-
|
|
2272
|
+
y("span", {
|
|
2248
2273
|
class: "xml-node__quote",
|
|
2249
|
-
style:
|
|
2274
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2250
2275
|
}, '"', 4),
|
|
2251
|
-
|
|
2276
|
+
y("span", {
|
|
2252
2277
|
class: "xml-node__attr-value",
|
|
2253
|
-
style:
|
|
2254
|
-
},
|
|
2255
|
-
|
|
2278
|
+
style: N({ color: p.theme.colors.xmlAttributeValue })
|
|
2279
|
+
}, B($), 5),
|
|
2280
|
+
y("span", {
|
|
2256
2281
|
class: "xml-node__quote",
|
|
2257
|
-
style:
|
|
2282
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2258
2283
|
}, '"', 4)
|
|
2259
2284
|
]))), 128)),
|
|
2260
|
-
|
|
2261
|
-
key: 2,
|
|
2285
|
+
y("span", {
|
|
2262
2286
|
class: "xml-node__clickable-part",
|
|
2263
|
-
onClick:
|
|
2264
|
-
title:
|
|
2287
|
+
onClick: g[1] || (g[1] = ($) => S()),
|
|
2288
|
+
title: "Click to expand"
|
|
2265
2289
|
}, [
|
|
2266
|
-
|
|
2290
|
+
y("span", {
|
|
2267
2291
|
class: "xml-node__bracket",
|
|
2268
|
-
style:
|
|
2292
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2269
2293
|
}, ">", 4)
|
|
2270
|
-
]
|
|
2271
|
-
|
|
2272
|
-
class: "xml-
|
|
2273
|
-
style:
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
}, "...", 4)) : F("", !0)
|
|
2282
|
-
]),
|
|
2283
|
-
i.value && w.value ? (x(), A("div", ar, [
|
|
2284
|
-
l.value.length === 0 && b.value.trim() ? (x(), A("div", lr, [
|
|
2285
|
-
v("span", {
|
|
2286
|
-
class: "xml-node__text-content",
|
|
2287
|
-
style: P({ color: p.theme.colors.xmlText })
|
|
2288
|
-
}, R(b.value), 5)
|
|
2289
|
-
])) : F("", !0),
|
|
2290
|
-
(x(!0), A(de, null, fe(l.value, (O, I) => (x(), He(E, {
|
|
2291
|
-
key: j(O, I),
|
|
2292
|
-
node: O,
|
|
2293
|
-
index: I,
|
|
2294
|
-
level: p.level + 1,
|
|
2295
|
-
"parent-path": H(),
|
|
2296
|
-
expanded: p.expanded,
|
|
2297
|
-
theme: p.theme,
|
|
2298
|
-
onToggleExpand: $[3] || ($[3] = (X) => p.$emit("toggle-expand", X)),
|
|
2299
|
-
onCopy: $[4] || ($[4] = (X) => p.$emit("copy", X))
|
|
2300
|
-
}, null, 8, ["node", "index", "level", "parent-path", "expanded", "theme"]))), 128))
|
|
2301
|
-
])) : F("", !0),
|
|
2302
|
-
i.value && w.value ? (x(), A("div", ur, [
|
|
2303
|
-
v("span", {
|
|
2294
|
+
]),
|
|
2295
|
+
y("span", {
|
|
2296
|
+
class: "xml-node__collapsed-badge",
|
|
2297
|
+
style: N({
|
|
2298
|
+
backgroundColor: p.theme.colors.collapsedBackground,
|
|
2299
|
+
color: p.theme.colors.collapsedText
|
|
2300
|
+
}),
|
|
2301
|
+
onClick: g[2] || (g[2] = ($) => S()),
|
|
2302
|
+
title: `Click to expand ${O.value} child element${O.value > 1 ? "s" : ""}`
|
|
2303
|
+
}, B(O.value) + " child" + B(O.value > 1 ? "ren" : ""), 13, or),
|
|
2304
|
+
y("span", {
|
|
2304
2305
|
class: "xml-node__clickable-part",
|
|
2305
|
-
onClick:
|
|
2306
|
-
title: "Click to
|
|
2306
|
+
onClick: g[3] || (g[3] = ($) => S()),
|
|
2307
|
+
title: "Click to expand"
|
|
2307
2308
|
}, [
|
|
2308
|
-
|
|
2309
|
+
y("span", {
|
|
2309
2310
|
class: "xml-node__bracket",
|
|
2310
|
-
style:
|
|
2311
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2311
2312
|
}, "</", 4),
|
|
2312
|
-
|
|
2313
|
+
y("span", {
|
|
2313
2314
|
class: "xml-node__tag",
|
|
2314
|
-
style:
|
|
2315
|
-
},
|
|
2316
|
-
|
|
2315
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2316
|
+
}, B(n.value), 5),
|
|
2317
|
+
y("span", {
|
|
2317
2318
|
class: "xml-node__bracket",
|
|
2318
|
-
style:
|
|
2319
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2319
2320
|
}, ">", 4)
|
|
2320
2321
|
])
|
|
2321
|
-
])) :
|
|
2322
|
+
])) : (k(), A(re, { key: 1 }, [
|
|
2323
|
+
y("div", ir, [
|
|
2324
|
+
w.value ? (k(), A("span", {
|
|
2325
|
+
key: 0,
|
|
2326
|
+
class: "xml-node__clickable-part",
|
|
2327
|
+
onClick: g[4] || (g[4] = ($) => S()),
|
|
2328
|
+
title: i.value ? "Click to collapse" : "Click to expand"
|
|
2329
|
+
}, [
|
|
2330
|
+
y("span", {
|
|
2331
|
+
class: "xml-node__bracket",
|
|
2332
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2333
|
+
}, "<", 4),
|
|
2334
|
+
y("span", {
|
|
2335
|
+
class: "xml-node__tag",
|
|
2336
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2337
|
+
}, B(n.value), 5)
|
|
2338
|
+
], 8, ar)) : (k(), A("span", lr, [
|
|
2339
|
+
y("span", {
|
|
2340
|
+
class: "xml-node__bracket",
|
|
2341
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2342
|
+
}, "<", 4),
|
|
2343
|
+
y("span", {
|
|
2344
|
+
class: "xml-node__tag",
|
|
2345
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2346
|
+
}, B(n.value), 5)
|
|
2347
|
+
])),
|
|
2348
|
+
(k(!0), A(re, null, ae(a.value, ($, R) => (k(), A("span", {
|
|
2349
|
+
key: R,
|
|
2350
|
+
class: "xml-node__attribute"
|
|
2351
|
+
}, [
|
|
2352
|
+
y("span", {
|
|
2353
|
+
class: "xml-node__attr-name",
|
|
2354
|
+
style: N({ color: p.theme.colors.xmlAttribute })
|
|
2355
|
+
}, B(R), 5),
|
|
2356
|
+
y("span", {
|
|
2357
|
+
class: "xml-node__equals",
|
|
2358
|
+
style: N({ color: p.theme.colors.xmlEquals })
|
|
2359
|
+
}, "=", 4),
|
|
2360
|
+
y("span", {
|
|
2361
|
+
class: "xml-node__quote",
|
|
2362
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2363
|
+
}, '"', 4),
|
|
2364
|
+
y("span", {
|
|
2365
|
+
class: "xml-node__attr-value",
|
|
2366
|
+
style: N({ color: p.theme.colors.xmlAttributeValue })
|
|
2367
|
+
}, B($), 5),
|
|
2368
|
+
y("span", {
|
|
2369
|
+
class: "xml-node__quote",
|
|
2370
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2371
|
+
}, '"', 4)
|
|
2372
|
+
]))), 128)),
|
|
2373
|
+
w.value ? (k(), A("span", {
|
|
2374
|
+
key: 2,
|
|
2375
|
+
class: "xml-node__clickable-part",
|
|
2376
|
+
onClick: g[5] || (g[5] = ($) => S()),
|
|
2377
|
+
title: i.value ? "Click to collapse" : "Click to expand"
|
|
2378
|
+
}, [
|
|
2379
|
+
y("span", {
|
|
2380
|
+
class: "xml-node__bracket",
|
|
2381
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2382
|
+
}, ">", 4)
|
|
2383
|
+
], 8, cr)) : (k(), A("span", {
|
|
2384
|
+
key: 3,
|
|
2385
|
+
class: "xml-node__bracket",
|
|
2386
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2387
|
+
}, B(w.value ? ">" : "/>"), 5))
|
|
2388
|
+
]),
|
|
2389
|
+
i.value && w.value ? (k(), A("div", ur, [
|
|
2390
|
+
l.value.length === 0 && E.value.trim() ? (k(), A("div", dr, [
|
|
2391
|
+
y("span", {
|
|
2392
|
+
class: "xml-node__text-content",
|
|
2393
|
+
style: N({ color: p.theme.colors.xmlText })
|
|
2394
|
+
}, B(E.value), 5)
|
|
2395
|
+
])) : H("", !0),
|
|
2396
|
+
(k(!0), A(re, null, ae(l.value, ($, R) => (k(), Fe(C, {
|
|
2397
|
+
key: X($, R),
|
|
2398
|
+
node: $,
|
|
2399
|
+
index: R,
|
|
2400
|
+
level: p.level + 1,
|
|
2401
|
+
"parent-path": Z(),
|
|
2402
|
+
expanded: p.expanded,
|
|
2403
|
+
theme: p.theme,
|
|
2404
|
+
onToggleExpand: g[6] || (g[6] = (K) => p.$emit("toggle-expand", K)),
|
|
2405
|
+
onCopy: g[7] || (g[7] = (K) => p.$emit("copy", K))
|
|
2406
|
+
}, null, 8, ["node", "index", "level", "parent-path", "expanded", "theme"]))), 128))
|
|
2407
|
+
])) : H("", !0),
|
|
2408
|
+
i.value && w.value ? (k(), A("div", fr, [
|
|
2409
|
+
y("span", {
|
|
2410
|
+
class: "xml-node__clickable-part",
|
|
2411
|
+
onClick: g[8] || (g[8] = ($) => S()),
|
|
2412
|
+
title: "Click to collapse"
|
|
2413
|
+
}, [
|
|
2414
|
+
y("span", {
|
|
2415
|
+
class: "xml-node__bracket",
|
|
2416
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2417
|
+
}, "</", 4),
|
|
2418
|
+
y("span", {
|
|
2419
|
+
class: "xml-node__tag",
|
|
2420
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2421
|
+
}, B(n.value), 5),
|
|
2422
|
+
y("span", {
|
|
2423
|
+
class: "xml-node__bracket",
|
|
2424
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2425
|
+
}, ">", 4)
|
|
2426
|
+
])
|
|
2427
|
+
])) : H("", !0)
|
|
2428
|
+
], 64))
|
|
2322
2429
|
]))
|
|
2323
|
-
])) :
|
|
2430
|
+
])) : H("", !0)
|
|
2324
2431
|
], 4);
|
|
2325
2432
|
};
|
|
2326
2433
|
}
|
|
2327
|
-
}),
|
|
2434
|
+
}), pr = /* @__PURE__ */ ye(hr, [["__scopeId", "data-v-afb7b2ab"]]), gr = {
|
|
2328
2435
|
name: "github-light",
|
|
2329
2436
|
colors: {
|
|
2330
2437
|
// 背景色
|
|
@@ -2366,10 +2473,15 @@ const Lt = {
|
|
|
2366
2473
|
// 括号 - 灰色
|
|
2367
2474
|
xmlEquals: "#6e7781",
|
|
2368
2475
|
// 等号 - 灰色
|
|
2369
|
-
xmlQuote: "#0550ae"
|
|
2476
|
+
xmlQuote: "#0550ae",
|
|
2370
2477
|
// 引号 - 蓝色
|
|
2478
|
+
// 折叠效果
|
|
2479
|
+
collapsedBackground: "#ddf4ff",
|
|
2480
|
+
// 折叠信息背景色 - 浅蓝
|
|
2481
|
+
collapsedText: "#0969da"
|
|
2482
|
+
// 折叠信息文本色 - 蓝色
|
|
2371
2483
|
}
|
|
2372
|
-
},
|
|
2484
|
+
}, mr = {
|
|
2373
2485
|
name: "github-dark",
|
|
2374
2486
|
colors: {
|
|
2375
2487
|
// 背景色
|
|
@@ -2411,10 +2523,15 @@ const Lt = {
|
|
|
2411
2523
|
// 括号 - 灰色
|
|
2412
2524
|
xmlEquals: "#8b949e",
|
|
2413
2525
|
// 等号 - 灰色
|
|
2414
|
-
xmlQuote: "#79c0ff"
|
|
2526
|
+
xmlQuote: "#79c0ff",
|
|
2415
2527
|
// 引号 - 亮蓝色
|
|
2528
|
+
// 折叠效果
|
|
2529
|
+
collapsedBackground: "#1c2d41",
|
|
2530
|
+
// 折叠信息背景色 - 深蓝
|
|
2531
|
+
collapsedText: "#58a6ff"
|
|
2532
|
+
// 折叠信息文本色 - 亮蓝
|
|
2416
2533
|
}
|
|
2417
|
-
},
|
|
2534
|
+
}, br = {
|
|
2418
2535
|
name: "min-light",
|
|
2419
2536
|
colors: {
|
|
2420
2537
|
// 背景色
|
|
@@ -2456,10 +2573,15 @@ const Lt = {
|
|
|
2456
2573
|
// 括号 - 灰色
|
|
2457
2574
|
xmlEquals: "#737373",
|
|
2458
2575
|
// 等号 - 灰色
|
|
2459
|
-
xmlQuote: "#2563eb"
|
|
2576
|
+
xmlQuote: "#2563eb",
|
|
2460
2577
|
// 引号 - 蓝色
|
|
2578
|
+
// 折叠效果
|
|
2579
|
+
collapsedBackground: "#dbeafe",
|
|
2580
|
+
// 折叠信息背景色 - 浅蓝
|
|
2581
|
+
collapsedText: "#1d4ed8"
|
|
2582
|
+
// 折叠信息文本色 - 蓝色
|
|
2461
2583
|
}
|
|
2462
|
-
},
|
|
2584
|
+
}, yr = {
|
|
2463
2585
|
name: "slack-ochin",
|
|
2464
2586
|
colors: {
|
|
2465
2587
|
// 背景色
|
|
@@ -2501,16 +2623,21 @@ const Lt = {
|
|
|
2501
2623
|
// 括号 - 灰色
|
|
2502
2624
|
xmlEquals: "#616061",
|
|
2503
2625
|
// 等号 - 灰色
|
|
2504
|
-
xmlQuote: "#1264a3"
|
|
2626
|
+
xmlQuote: "#1264a3",
|
|
2505
2627
|
// 引号 - 蓝色
|
|
2628
|
+
// 折叠效果
|
|
2629
|
+
collapsedBackground: "#d8eaf5",
|
|
2630
|
+
// 折叠信息背景色 - 浅蓝
|
|
2631
|
+
collapsedText: "#0b4c8c"
|
|
2632
|
+
// 折叠信息文本色 - 深蓝
|
|
2506
2633
|
}
|
|
2507
|
-
},
|
|
2508
|
-
"github-light":
|
|
2509
|
-
"github-dark":
|
|
2510
|
-
"min-light":
|
|
2511
|
-
"slack-ochin":
|
|
2512
|
-
},
|
|
2513
|
-
function
|
|
2634
|
+
}, Se = {
|
|
2635
|
+
"github-light": gr,
|
|
2636
|
+
"github-dark": mr,
|
|
2637
|
+
"min-light": br,
|
|
2638
|
+
"slack-ochin": yr
|
|
2639
|
+
}, vr = (r) => Se[r] || Se["github-light"], He = ":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", _r = He + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", Er = "[" + He + "][" + _r + "]*", xr = new RegExp("^" + Er + "$");
|
|
2640
|
+
function Ke(r, e) {
|
|
2514
2641
|
const t = [];
|
|
2515
2642
|
let s = e.exec(r);
|
|
2516
2643
|
for (; s; ) {
|
|
@@ -2524,122 +2651,122 @@ function Ye(r, e) {
|
|
|
2524
2651
|
return t;
|
|
2525
2652
|
}
|
|
2526
2653
|
const ve = function(r) {
|
|
2527
|
-
const e =
|
|
2654
|
+
const e = xr.exec(r);
|
|
2528
2655
|
return !(e === null || typeof e > "u");
|
|
2529
2656
|
};
|
|
2530
|
-
function
|
|
2657
|
+
function kr(r) {
|
|
2531
2658
|
return typeof r < "u";
|
|
2532
2659
|
}
|
|
2533
|
-
const
|
|
2660
|
+
const Nr = {
|
|
2534
2661
|
allowBooleanAttributes: !1,
|
|
2535
2662
|
//A tag can have attributes without any value
|
|
2536
2663
|
unpairedTags: []
|
|
2537
2664
|
};
|
|
2538
|
-
function
|
|
2539
|
-
e = Object.assign({},
|
|
2665
|
+
function qe(r, e) {
|
|
2666
|
+
e = Object.assign({}, Nr, e);
|
|
2540
2667
|
const t = [];
|
|
2541
2668
|
let s = !1, n = !1;
|
|
2542
2669
|
r[0] === "\uFEFF" && (r = r.substr(1));
|
|
2543
2670
|
for (let o = 0; o < r.length; o++)
|
|
2544
2671
|
if (r[o] === "<" && r[o + 1] === "?") {
|
|
2545
|
-
if (o += 2, o =
|
|
2672
|
+
if (o += 2, o = Ie(r, o), o.err) return o;
|
|
2546
2673
|
} else if (r[o] === "<") {
|
|
2547
2674
|
let i = o;
|
|
2548
2675
|
if (o++, r[o] === "!") {
|
|
2549
|
-
o =
|
|
2676
|
+
o = Ve(r, o);
|
|
2550
2677
|
continue;
|
|
2551
2678
|
} else {
|
|
2552
|
-
let
|
|
2553
|
-
r[o] === "/" && (
|
|
2679
|
+
let c = !1;
|
|
2680
|
+
r[o] === "/" && (c = !0, o++);
|
|
2554
2681
|
let a = "";
|
|
2555
2682
|
for (; o < r.length && r[o] !== ">" && r[o] !== " " && r[o] !== " " && r[o] !== `
|
|
2556
2683
|
` && r[o] !== "\r"; o++)
|
|
2557
2684
|
a += r[o];
|
|
2558
|
-
if (a = a.trim(), a[a.length - 1] === "/" && (a = a.substring(0, a.length - 1), o--), !
|
|
2685
|
+
if (a = a.trim(), a[a.length - 1] === "/" && (a = a.substring(0, a.length - 1), o--), !Sr(a)) {
|
|
2559
2686
|
let f;
|
|
2560
|
-
return a.trim().length === 0 ? f = "Invalid space after '<'." : f = "Tag '" + a + "' is an invalid name.",
|
|
2687
|
+
return a.trim().length === 0 ? f = "Invalid space after '<'." : f = "Tag '" + a + "' is an invalid name.", F("InvalidTag", f, Q(r, o));
|
|
2561
2688
|
}
|
|
2562
|
-
const l =
|
|
2689
|
+
const l = Cr(r, o);
|
|
2563
2690
|
if (l === !1)
|
|
2564
|
-
return
|
|
2691
|
+
return F("InvalidAttr", "Attributes for '" + a + "' have open quote.", Q(r, o));
|
|
2565
2692
|
let h = l.value;
|
|
2566
2693
|
if (o = l.index, h[h.length - 1] === "/") {
|
|
2567
2694
|
const f = o - h.length;
|
|
2568
2695
|
h = h.substring(0, h.length - 1);
|
|
2569
|
-
const
|
|
2570
|
-
if (
|
|
2696
|
+
const E = Le(h, e);
|
|
2697
|
+
if (E === !0)
|
|
2571
2698
|
s = !0;
|
|
2572
2699
|
else
|
|
2573
|
-
return
|
|
2574
|
-
} else if (
|
|
2700
|
+
return F(E.err.code, E.err.msg, Q(r, f + E.err.line));
|
|
2701
|
+
} else if (c)
|
|
2575
2702
|
if (l.tagClosed) {
|
|
2576
2703
|
if (h.trim().length > 0)
|
|
2577
|
-
return
|
|
2704
|
+
return F("InvalidTag", "Closing tag '" + a + "' can't have attributes or invalid starting.", Q(r, i));
|
|
2578
2705
|
if (t.length === 0)
|
|
2579
|
-
return
|
|
2706
|
+
return F("InvalidTag", "Closing tag '" + a + "' has not been opened.", Q(r, i));
|
|
2580
2707
|
{
|
|
2581
2708
|
const f = t.pop();
|
|
2582
2709
|
if (a !== f.tagName) {
|
|
2583
|
-
let
|
|
2584
|
-
return
|
|
2710
|
+
let E = Q(r, f.tagStartPos);
|
|
2711
|
+
return F(
|
|
2585
2712
|
"InvalidTag",
|
|
2586
|
-
"Expected closing tag '" + f.tagName + "' (opened in line " +
|
|
2587
|
-
|
|
2713
|
+
"Expected closing tag '" + f.tagName + "' (opened in line " + E.line + ", col " + E.col + ") instead of closing tag '" + a + "'.",
|
|
2714
|
+
Q(r, i)
|
|
2588
2715
|
);
|
|
2589
2716
|
}
|
|
2590
2717
|
t.length == 0 && (n = !0);
|
|
2591
2718
|
}
|
|
2592
|
-
} else return
|
|
2719
|
+
} else return F("InvalidTag", "Closing tag '" + a + "' doesn't have proper closing.", Q(r, o));
|
|
2593
2720
|
else {
|
|
2594
|
-
const f =
|
|
2721
|
+
const f = Le(h, e);
|
|
2595
2722
|
if (f !== !0)
|
|
2596
|
-
return
|
|
2723
|
+
return F(f.err.code, f.err.msg, Q(r, o - h.length + f.err.line));
|
|
2597
2724
|
if (n === !0)
|
|
2598
|
-
return
|
|
2725
|
+
return F("InvalidXml", "Multiple possible root nodes found.", Q(r, o));
|
|
2599
2726
|
e.unpairedTags.indexOf(a) !== -1 || t.push({ tagName: a, tagStartPos: i }), s = !0;
|
|
2600
2727
|
}
|
|
2601
2728
|
for (o++; o < r.length; o++)
|
|
2602
2729
|
if (r[o] === "<")
|
|
2603
2730
|
if (r[o + 1] === "!") {
|
|
2604
|
-
o++, o =
|
|
2731
|
+
o++, o = Ve(r, o);
|
|
2605
2732
|
continue;
|
|
2606
2733
|
} else if (r[o + 1] === "?") {
|
|
2607
|
-
if (o =
|
|
2734
|
+
if (o = Ie(r, ++o), o.err) return o;
|
|
2608
2735
|
} else
|
|
2609
2736
|
break;
|
|
2610
2737
|
else if (r[o] === "&") {
|
|
2611
|
-
const f =
|
|
2738
|
+
const f = Pr(r, o);
|
|
2612
2739
|
if (f == -1)
|
|
2613
|
-
return
|
|
2740
|
+
return F("InvalidChar", "char '&' is not expected.", Q(r, o));
|
|
2614
2741
|
o = f;
|
|
2615
|
-
} else if (n === !0 && !
|
|
2616
|
-
return
|
|
2742
|
+
} else if (n === !0 && !Be(r[o]))
|
|
2743
|
+
return F("InvalidXml", "Extra text at the end", Q(r, o));
|
|
2617
2744
|
r[o] === "<" && o--;
|
|
2618
2745
|
}
|
|
2619
2746
|
} else {
|
|
2620
|
-
if (
|
|
2747
|
+
if (Be(r[o]))
|
|
2621
2748
|
continue;
|
|
2622
|
-
return
|
|
2749
|
+
return F("InvalidChar", "char '" + r[o] + "' is not expected.", Q(r, o));
|
|
2623
2750
|
}
|
|
2624
2751
|
if (s) {
|
|
2625
2752
|
if (t.length == 1)
|
|
2626
|
-
return
|
|
2753
|
+
return F("InvalidTag", "Unclosed tag '" + t[0].tagName + "'.", Q(r, t[0].tagStartPos));
|
|
2627
2754
|
if (t.length > 0)
|
|
2628
|
-
return
|
|
2629
|
-
} else return
|
|
2755
|
+
return F("InvalidXml", "Invalid '" + JSON.stringify(t.map((o) => o.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
|
|
2756
|
+
} else return F("InvalidXml", "Start tag expected.", 1);
|
|
2630
2757
|
return !0;
|
|
2631
2758
|
}
|
|
2632
|
-
function
|
|
2759
|
+
function Be(r) {
|
|
2633
2760
|
return r === " " || r === " " || r === `
|
|
2634
2761
|
` || r === "\r";
|
|
2635
2762
|
}
|
|
2636
|
-
function
|
|
2763
|
+
function Ie(r, e) {
|
|
2637
2764
|
const t = e;
|
|
2638
2765
|
for (; e < r.length; e++)
|
|
2639
2766
|
if (r[e] == "?" || r[e] == " ") {
|
|
2640
2767
|
const s = r.substr(t, e - t);
|
|
2641
2768
|
if (e > 5 && s === "xml")
|
|
2642
|
-
return
|
|
2769
|
+
return F("InvalidXml", "XML declaration allowed only at the start of the document.", Q(r, e));
|
|
2643
2770
|
if (r[e] == "?" && r[e + 1] == ">") {
|
|
2644
2771
|
e++;
|
|
2645
2772
|
break;
|
|
@@ -2648,7 +2775,7 @@ function Le(r, e) {
|
|
|
2648
2775
|
}
|
|
2649
2776
|
return e;
|
|
2650
2777
|
}
|
|
2651
|
-
function
|
|
2778
|
+
function Ve(r, e) {
|
|
2652
2779
|
if (r.length > e + 5 && r[e + 1] === "-" && r[e + 2] === "-") {
|
|
2653
2780
|
for (e += 3; e < r.length; e++)
|
|
2654
2781
|
if (r[e] === "-" && r[e + 1] === "-" && r[e + 2] === ">") {
|
|
@@ -2671,11 +2798,11 @@ function Re(r, e) {
|
|
|
2671
2798
|
}
|
|
2672
2799
|
return e;
|
|
2673
2800
|
}
|
|
2674
|
-
const
|
|
2675
|
-
function
|
|
2801
|
+
const Ar = '"', wr = "'";
|
|
2802
|
+
function Cr(r, e) {
|
|
2676
2803
|
let t = "", s = "", n = !1;
|
|
2677
2804
|
for (; e < r.length; e++) {
|
|
2678
|
-
if (r[e] ===
|
|
2805
|
+
if (r[e] === Ar || r[e] === wr)
|
|
2679
2806
|
s === "" ? s = r[e] : s !== r[e] || (s = "");
|
|
2680
2807
|
else if (r[e] === ">" && s === "") {
|
|
2681
2808
|
n = !0;
|
|
@@ -2689,27 +2816,27 @@ function Ar(r, e) {
|
|
|
2689
2816
|
tagClosed: n
|
|
2690
2817
|
};
|
|
2691
2818
|
}
|
|
2692
|
-
const
|
|
2693
|
-
function
|
|
2694
|
-
const t =
|
|
2819
|
+
const Or = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
|
|
2820
|
+
function Le(r, e) {
|
|
2821
|
+
const t = Ke(r, Or), s = {};
|
|
2695
2822
|
for (let n = 0; n < t.length; n++) {
|
|
2696
2823
|
if (t[n][1].length === 0)
|
|
2697
|
-
return
|
|
2824
|
+
return F("InvalidAttr", "Attribute '" + t[n][2] + "' has no space in starting.", pe(t[n]));
|
|
2698
2825
|
if (t[n][3] !== void 0 && t[n][4] === void 0)
|
|
2699
|
-
return
|
|
2826
|
+
return F("InvalidAttr", "Attribute '" + t[n][2] + "' is without value.", pe(t[n]));
|
|
2700
2827
|
if (t[n][3] === void 0 && !e.allowBooleanAttributes)
|
|
2701
|
-
return
|
|
2828
|
+
return F("InvalidAttr", "boolean attribute '" + t[n][2] + "' is not allowed.", pe(t[n]));
|
|
2702
2829
|
const o = t[n][2];
|
|
2703
|
-
if (
|
|
2704
|
-
return
|
|
2830
|
+
if (!$r(o))
|
|
2831
|
+
return F("InvalidAttr", "Attribute '" + o + "' is an invalid name.", pe(t[n]));
|
|
2705
2832
|
if (!s.hasOwnProperty(o))
|
|
2706
2833
|
s[o] = 1;
|
|
2707
2834
|
else
|
|
2708
|
-
return
|
|
2835
|
+
return F("InvalidAttr", "Attribute '" + o + "' is repeated.", pe(t[n]));
|
|
2709
2836
|
}
|
|
2710
2837
|
return !0;
|
|
2711
2838
|
}
|
|
2712
|
-
function
|
|
2839
|
+
function Tr(r, e) {
|
|
2713
2840
|
let t = /\d/;
|
|
2714
2841
|
for (r[e] === "x" && (e++, t = /[\da-fA-F]/); e < r.length; e++) {
|
|
2715
2842
|
if (r[e] === ";")
|
|
@@ -2719,11 +2846,11 @@ function wr(r, e) {
|
|
|
2719
2846
|
}
|
|
2720
2847
|
return -1;
|
|
2721
2848
|
}
|
|
2722
|
-
function
|
|
2849
|
+
function Pr(r, e) {
|
|
2723
2850
|
if (e++, r[e] === ";")
|
|
2724
2851
|
return -1;
|
|
2725
2852
|
if (r[e] === "#")
|
|
2726
|
-
return e++,
|
|
2853
|
+
return e++, Tr(r, e);
|
|
2727
2854
|
let t = 0;
|
|
2728
2855
|
for (; e < r.length; e++, t++)
|
|
2729
2856
|
if (!(r[e].match(/\w/) && t < 20)) {
|
|
@@ -2733,7 +2860,7 @@ function Cr(r, e) {
|
|
|
2733
2860
|
}
|
|
2734
2861
|
return e;
|
|
2735
2862
|
}
|
|
2736
|
-
function
|
|
2863
|
+
function F(r, e, t) {
|
|
2737
2864
|
return {
|
|
2738
2865
|
err: {
|
|
2739
2866
|
code: r,
|
|
@@ -2743,13 +2870,13 @@ function U(r, e, t) {
|
|
|
2743
2870
|
}
|
|
2744
2871
|
};
|
|
2745
2872
|
}
|
|
2746
|
-
function
|
|
2873
|
+
function $r(r) {
|
|
2747
2874
|
return ve(r);
|
|
2748
2875
|
}
|
|
2749
|
-
function
|
|
2876
|
+
function Sr(r) {
|
|
2750
2877
|
return ve(r);
|
|
2751
2878
|
}
|
|
2752
|
-
function
|
|
2879
|
+
function Q(r, e) {
|
|
2753
2880
|
const t = r.substring(0, e).split(/\r?\n/);
|
|
2754
2881
|
return {
|
|
2755
2882
|
line: t.length,
|
|
@@ -2760,7 +2887,7 @@ function W(r, e) {
|
|
|
2760
2887
|
function pe(r) {
|
|
2761
2888
|
return r.startIndex + r[1].length;
|
|
2762
2889
|
}
|
|
2763
|
-
const
|
|
2890
|
+
const Br = {
|
|
2764
2891
|
preserveOrder: !1,
|
|
2765
2892
|
attributeNamePrefix: "@_",
|
|
2766
2893
|
attributesGroupName: !1,
|
|
@@ -2804,12 +2931,12 @@ const Pr = {
|
|
|
2804
2931
|
},
|
|
2805
2932
|
// skipEmptyListItem: false
|
|
2806
2933
|
captureMetaData: !1
|
|
2807
|
-
},
|
|
2808
|
-
return Object.assign({},
|
|
2934
|
+
}, Ir = function(r) {
|
|
2935
|
+
return Object.assign({}, Br, r);
|
|
2809
2936
|
};
|
|
2810
2937
|
let me;
|
|
2811
2938
|
typeof Symbol != "function" ? me = "@@xmlMetadata" : me = Symbol("XML Node Metadata");
|
|
2812
|
-
class
|
|
2939
|
+
class le {
|
|
2813
2940
|
constructor(e) {
|
|
2814
2941
|
this.tagname = e, this.child = [], this[":@"] = {};
|
|
2815
2942
|
}
|
|
@@ -2824,7 +2951,7 @@ class oe {
|
|
|
2824
2951
|
return me;
|
|
2825
2952
|
}
|
|
2826
2953
|
}
|
|
2827
|
-
class
|
|
2954
|
+
class Vr {
|
|
2828
2955
|
constructor(e) {
|
|
2829
2956
|
this.suppressValidationErr = !e;
|
|
2830
2957
|
}
|
|
@@ -2832,33 +2959,33 @@ class Sr {
|
|
|
2832
2959
|
const s = {};
|
|
2833
2960
|
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") {
|
|
2834
2961
|
t = t + 9;
|
|
2835
|
-
let n = 1, o = !1, i = !1,
|
|
2962
|
+
let n = 1, o = !1, i = !1, c = "";
|
|
2836
2963
|
for (; t < e.length; t++)
|
|
2837
2964
|
if (e[t] === "<" && !i) {
|
|
2838
|
-
if (o &&
|
|
2965
|
+
if (o && ie(e, "!ENTITY", t)) {
|
|
2839
2966
|
t += 7;
|
|
2840
2967
|
let a, l;
|
|
2841
2968
|
[a, l, t] = this.readEntityExp(e, t + 1, this.suppressValidationErr), l.indexOf("&") === -1 && (s[a] = {
|
|
2842
2969
|
regx: RegExp(`&${a};`, "g"),
|
|
2843
2970
|
val: l
|
|
2844
2971
|
});
|
|
2845
|
-
} else if (o &&
|
|
2972
|
+
} else if (o && ie(e, "!ELEMENT", t)) {
|
|
2846
2973
|
t += 8;
|
|
2847
2974
|
const { index: a } = this.readElementExp(e, t + 1);
|
|
2848
2975
|
t = a;
|
|
2849
|
-
} else if (o &&
|
|
2976
|
+
} else if (o && ie(e, "!ATTLIST", t))
|
|
2850
2977
|
t += 8;
|
|
2851
|
-
else if (o &&
|
|
2978
|
+
else if (o && ie(e, "!NOTATION", t)) {
|
|
2852
2979
|
t += 9;
|
|
2853
2980
|
const { index: a } = this.readNotationExp(e, t + 1, this.suppressValidationErr);
|
|
2854
2981
|
t = a;
|
|
2855
|
-
} else if (
|
|
2982
|
+
} else if (ie(e, "!--", t)) i = !0;
|
|
2856
2983
|
else throw new Error("Invalid DOCTYPE");
|
|
2857
|
-
n++,
|
|
2984
|
+
n++, c = "";
|
|
2858
2985
|
} else if (e[t] === ">") {
|
|
2859
2986
|
if (i ? e[t - 1] === "-" && e[t - 2] === "-" && (i = !1, n--) : n--, n === 0)
|
|
2860
2987
|
break;
|
|
2861
|
-
} else e[t] === "[" ? o = !0 :
|
|
2988
|
+
} else e[t] === "[" ? o = !0 : c += e[t];
|
|
2862
2989
|
if (n !== 0)
|
|
2863
2990
|
throw new Error("Unclosed DOCTYPE");
|
|
2864
2991
|
} else
|
|
@@ -2916,8 +3043,8 @@ class Sr {
|
|
|
2916
3043
|
throw new Error(`Invalid element name: "${s}"`);
|
|
2917
3044
|
t = G(e, t);
|
|
2918
3045
|
let n = "";
|
|
2919
|
-
if (e[t] === "E" &&
|
|
2920
|
-
else if (e[t] === "A" &&
|
|
3046
|
+
if (e[t] === "E" && ie(e, "MPTY", t)) t += 4;
|
|
3047
|
+
else if (e[t] === "A" && ie(e, "NY", t)) t += 2;
|
|
2921
3048
|
else if (e[t] === "(") {
|
|
2922
3049
|
for (t++; t < e.length && e[t] !== ")"; )
|
|
2923
3050
|
n += e[t], t++;
|
|
@@ -2948,23 +3075,23 @@ class Sr {
|
|
|
2948
3075
|
if (o = "NOTATION", t += 8, t = G(e, t), e[t] !== "(")
|
|
2949
3076
|
throw new Error(`Expected '(', found "${e[t]}"`);
|
|
2950
3077
|
t++;
|
|
2951
|
-
let
|
|
3078
|
+
let c = [];
|
|
2952
3079
|
for (; t < e.length && e[t] !== ")"; ) {
|
|
2953
3080
|
let a = "";
|
|
2954
3081
|
for (; t < e.length && e[t] !== "|" && e[t] !== ")"; )
|
|
2955
3082
|
a += e[t], t++;
|
|
2956
3083
|
if (a = a.trim(), !ge(a))
|
|
2957
3084
|
throw new Error(`Invalid notation name: "${a}"`);
|
|
2958
|
-
|
|
3085
|
+
c.push(a), e[t] === "|" && (t++, t = G(e, t));
|
|
2959
3086
|
}
|
|
2960
3087
|
if (e[t] !== ")")
|
|
2961
3088
|
throw new Error("Unterminated list of notations");
|
|
2962
|
-
t++, o += " (" +
|
|
3089
|
+
t++, o += " (" + c.join("|") + ")";
|
|
2963
3090
|
} else {
|
|
2964
3091
|
for (; t < e.length && !/\s/.test(e[t]); )
|
|
2965
3092
|
o += e[t], t++;
|
|
2966
|
-
const
|
|
2967
|
-
if (!this.suppressValidationErr && !
|
|
3093
|
+
const c = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
|
|
3094
|
+
if (!this.suppressValidationErr && !c.includes(o.toUpperCase()))
|
|
2968
3095
|
throw new Error(`Invalid attribute type: "${o}"`);
|
|
2969
3096
|
}
|
|
2970
3097
|
t = G(e, t);
|
|
@@ -2983,7 +3110,7 @@ const G = (r, e) => {
|
|
|
2983
3110
|
e++;
|
|
2984
3111
|
return e;
|
|
2985
3112
|
};
|
|
2986
|
-
function
|
|
3113
|
+
function ie(r, e, t) {
|
|
2987
3114
|
for (let s = 0; s < e.length; s++)
|
|
2988
3115
|
if (e[s] !== r[t + s + 1]) return !1;
|
|
2989
3116
|
return !0;
|
|
@@ -2993,7 +3120,7 @@ function ge(r) {
|
|
|
2993
3120
|
return r;
|
|
2994
3121
|
throw new Error(`Invalid entity name ${r}`);
|
|
2995
3122
|
}
|
|
2996
|
-
const
|
|
3123
|
+
const Lr = /^[-+]?0x[a-fA-F0-9]+$/, Rr = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, jr = {
|
|
2997
3124
|
hex: !0,
|
|
2998
3125
|
// oct: false,
|
|
2999
3126
|
leadingZeros: !0,
|
|
@@ -3001,25 +3128,25 @@ const Ir = /^[-+]?0x[a-fA-F0-9]+$/, Br = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, V
|
|
|
3001
3128
|
eNotation: !0
|
|
3002
3129
|
//skipLike: /regex/
|
|
3003
3130
|
};
|
|
3004
|
-
function
|
|
3005
|
-
if (e = Object.assign({},
|
|
3131
|
+
function Mr(r, e = {}) {
|
|
3132
|
+
if (e = Object.assign({}, jr, e), !r || typeof r != "string") return r;
|
|
3006
3133
|
let t = r.trim();
|
|
3007
3134
|
if (e.skipLike !== void 0 && e.skipLike.test(t)) return r;
|
|
3008
3135
|
if (r === "0") return 0;
|
|
3009
|
-
if (e.hex &&
|
|
3010
|
-
return
|
|
3136
|
+
if (e.hex && Lr.test(t))
|
|
3137
|
+
return Hr(t, 16);
|
|
3011
3138
|
if (t.search(/.+[eE].+/) !== -1)
|
|
3012
|
-
return
|
|
3139
|
+
return Fr(r, t, e);
|
|
3013
3140
|
{
|
|
3014
|
-
const s =
|
|
3141
|
+
const s = Rr.exec(t);
|
|
3015
3142
|
if (s) {
|
|
3016
3143
|
const n = s[1] || "", o = s[2];
|
|
3017
|
-
let i =
|
|
3018
|
-
const
|
|
3144
|
+
let i = Xr(s[3]);
|
|
3145
|
+
const c = n ? (
|
|
3019
3146
|
// 0., -00., 000.
|
|
3020
3147
|
r[o.length + 1] === "."
|
|
3021
3148
|
) : r[o.length] === ".";
|
|
3022
|
-
if (!e.leadingZeros && (o.length > 1 || o.length === 1 && !
|
|
3149
|
+
if (!e.leadingZeros && (o.length > 1 || o.length === 1 && !c))
|
|
3023
3150
|
return r;
|
|
3024
3151
|
{
|
|
3025
3152
|
const a = Number(t), l = String(a);
|
|
@@ -3035,37 +3162,37 @@ function Lr(r, e = {}) {
|
|
|
3035
3162
|
return r;
|
|
3036
3163
|
}
|
|
3037
3164
|
}
|
|
3038
|
-
const
|
|
3039
|
-
function
|
|
3165
|
+
const Ur = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
|
|
3166
|
+
function Fr(r, e, t) {
|
|
3040
3167
|
if (!t.eNotation) return r;
|
|
3041
|
-
const s = e.match(
|
|
3168
|
+
const s = e.match(Ur);
|
|
3042
3169
|
if (s) {
|
|
3043
3170
|
let n = s[1] || "";
|
|
3044
|
-
const o = s[3].indexOf("e") === -1 ? "E" : "e", i = s[2],
|
|
3171
|
+
const o = s[3].indexOf("e") === -1 ? "E" : "e", i = s[2], c = n ? (
|
|
3045
3172
|
// 0E.
|
|
3046
3173
|
r[i.length + 1] === o
|
|
3047
3174
|
) : r[i.length] === o;
|
|
3048
|
-
return i.length > 1 &&
|
|
3175
|
+
return i.length > 1 && c ? r : i.length === 1 && (s[3].startsWith(`.${o}`) || s[3][0] === o) ? Number(e) : t.leadingZeros && !c ? (e = (s[1] || "") + s[3], Number(e)) : r;
|
|
3049
3176
|
} else
|
|
3050
3177
|
return r;
|
|
3051
3178
|
}
|
|
3052
|
-
function
|
|
3179
|
+
function Xr(r) {
|
|
3053
3180
|
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;
|
|
3054
3181
|
}
|
|
3055
|
-
function
|
|
3182
|
+
function Hr(r, e) {
|
|
3056
3183
|
if (parseInt) return parseInt(r, e);
|
|
3057
3184
|
if (Number.parseInt) return Number.parseInt(r, e);
|
|
3058
3185
|
if (window && window.parseInt) return window.parseInt(r, e);
|
|
3059
3186
|
throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
|
|
3060
3187
|
}
|
|
3061
|
-
function
|
|
3188
|
+
function Qe(r) {
|
|
3062
3189
|
return typeof r == "function" ? r : Array.isArray(r) ? (e) => {
|
|
3063
3190
|
for (const t of r)
|
|
3064
3191
|
if (typeof t == "string" && e === t || t instanceof RegExp && t.test(e))
|
|
3065
3192
|
return !0;
|
|
3066
3193
|
} : () => !1;
|
|
3067
3194
|
}
|
|
3068
|
-
class
|
|
3195
|
+
class Kr {
|
|
3069
3196
|
constructor(e) {
|
|
3070
3197
|
this.options = e, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
|
|
3071
3198
|
apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
|
|
@@ -3088,10 +3215,10 @@ class Fr {
|
|
|
3088
3215
|
inr: { regex: /&(inr|#8377);/g, val: "₹" },
|
|
3089
3216
|
num_dec: { regex: /&#([0-9]{1,7});/g, val: (t, s) => String.fromCodePoint(Number.parseInt(s, 10)) },
|
|
3090
3217
|
num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t, s) => String.fromCodePoint(Number.parseInt(s, 16)) }
|
|
3091
|
-
}, this.addExternalEntities =
|
|
3218
|
+
}, this.addExternalEntities = qr, this.parseXml = Zr, this.parseTextData = Qr, this.resolveNameSpace = Wr, this.buildAttributesMap = Gr, this.isItStopNode = en, this.replaceEntitiesValue = Dr, this.readStopNodeData = rn, this.saveTextToParentTag = Jr, this.addChild = zr, this.ignoreAttributesFn = Qe(this.options.ignoreAttributes);
|
|
3092
3219
|
}
|
|
3093
3220
|
}
|
|
3094
|
-
function
|
|
3221
|
+
function qr(r) {
|
|
3095
3222
|
const e = Object.keys(r);
|
|
3096
3223
|
for (let t = 0; t < e.length; t++) {
|
|
3097
3224
|
const s = e[t];
|
|
@@ -3101,14 +3228,14 @@ function Xr(r) {
|
|
|
3101
3228
|
};
|
|
3102
3229
|
}
|
|
3103
3230
|
}
|
|
3104
|
-
function
|
|
3231
|
+
function Qr(r, e, t, s, n, o, i) {
|
|
3105
3232
|
if (r !== void 0 && (this.options.trimValues && !s && (r = r.trim()), r.length > 0)) {
|
|
3106
3233
|
i || (r = this.replaceEntitiesValue(r));
|
|
3107
|
-
const
|
|
3108
|
-
return
|
|
3234
|
+
const c = this.options.tagValueProcessor(e, r, t, n, o);
|
|
3235
|
+
return c == null ? r : typeof c != typeof r || c !== r ? c : this.options.trimValues ? we(r, this.options.parseTagValue, this.options.numberParseOptions) : r.trim() === r ? we(r, this.options.parseTagValue, this.options.numberParseOptions) : r;
|
|
3109
3236
|
}
|
|
3110
3237
|
}
|
|
3111
|
-
function
|
|
3238
|
+
function Wr(r) {
|
|
3112
3239
|
if (this.options.removeNSPrefix) {
|
|
3113
3240
|
const e = r.split(":"), t = r.charAt(0) === "/" ? "/" : "";
|
|
3114
3241
|
if (e[0] === "xmlns")
|
|
@@ -3117,20 +3244,20 @@ function Kr(r) {
|
|
|
3117
3244
|
}
|
|
3118
3245
|
return r;
|
|
3119
3246
|
}
|
|
3120
|
-
const
|
|
3121
|
-
function
|
|
3247
|
+
const Yr = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
3248
|
+
function Gr(r, e, t) {
|
|
3122
3249
|
if (this.options.ignoreAttributes !== !0 && typeof r == "string") {
|
|
3123
|
-
const s =
|
|
3250
|
+
const s = Ke(r, Yr), n = s.length, o = {};
|
|
3124
3251
|
for (let i = 0; i < n; i++) {
|
|
3125
|
-
const
|
|
3126
|
-
if (this.ignoreAttributesFn(
|
|
3252
|
+
const c = this.resolveNameSpace(s[i][1]);
|
|
3253
|
+
if (this.ignoreAttributesFn(c, e))
|
|
3127
3254
|
continue;
|
|
3128
|
-
let a = s[i][4], l = this.options.attributeNamePrefix +
|
|
3129
|
-
if (
|
|
3255
|
+
let a = s[i][4], l = this.options.attributeNamePrefix + c;
|
|
3256
|
+
if (c.length)
|
|
3130
3257
|
if (this.options.transformAttributeName && (l = this.options.transformAttributeName(l)), l === "__proto__" && (l = "#__proto__"), a !== void 0) {
|
|
3131
3258
|
this.options.trimValues && (a = a.trim()), a = this.replaceEntitiesValue(a);
|
|
3132
|
-
const h = this.options.attributeValueProcessor(
|
|
3133
|
-
h == null ? o[l] = a : typeof h != typeof a || h !== a ? o[l] = h : o[l] =
|
|
3259
|
+
const h = this.options.attributeValueProcessor(c, a, e);
|
|
3260
|
+
h == null ? o[l] = a : typeof h != typeof a || h !== a ? o[l] = h : o[l] = we(
|
|
3134
3261
|
a,
|
|
3135
3262
|
this.options.parseAttributeValue,
|
|
3136
3263
|
this.options.numberParseOptions
|
|
@@ -3146,20 +3273,20 @@ function Yr(r, e, t) {
|
|
|
3146
3273
|
return o;
|
|
3147
3274
|
}
|
|
3148
3275
|
}
|
|
3149
|
-
const
|
|
3276
|
+
const Zr = function(r) {
|
|
3150
3277
|
r = r.replace(/\r\n?/g, `
|
|
3151
3278
|
`);
|
|
3152
|
-
const e = new
|
|
3279
|
+
const e = new le("!xml");
|
|
3153
3280
|
let t = e, s = "", n = "";
|
|
3154
|
-
const o = new
|
|
3281
|
+
const o = new Vr(this.options.processEntities);
|
|
3155
3282
|
for (let i = 0; i < r.length; i++)
|
|
3156
3283
|
if (r[i] === "<")
|
|
3157
3284
|
if (r[i + 1] === "/") {
|
|
3158
|
-
const a =
|
|
3285
|
+
const a = ce(r, ">", i, "Closing Tag is not closed.");
|
|
3159
3286
|
let l = r.substring(i + 2, a).trim();
|
|
3160
3287
|
if (this.options.removeNSPrefix) {
|
|
3161
|
-
const
|
|
3162
|
-
|
|
3288
|
+
const E = l.indexOf(":");
|
|
3289
|
+
E !== -1 && (l = l.substr(E + 1));
|
|
3163
3290
|
}
|
|
3164
3291
|
this.options.transformTagName && (l = this.options.transformTagName(l)), t && (s = this.saveTextToParentTag(s, t, n));
|
|
3165
3292
|
const h = n.substring(n.lastIndexOf(".") + 1);
|
|
@@ -3168,15 +3295,15 @@ const Qr = function(r) {
|
|
|
3168
3295
|
let f = 0;
|
|
3169
3296
|
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;
|
|
3170
3297
|
} else if (r[i + 1] === "?") {
|
|
3171
|
-
let a =
|
|
3298
|
+
let a = Ae(r, i, !1, "?>");
|
|
3172
3299
|
if (!a) throw new Error("Pi Tag is not closed.");
|
|
3173
3300
|
if (s = this.saveTextToParentTag(s, t, n), !(this.options.ignoreDeclaration && a.tagName === "?xml" || this.options.ignorePiTags)) {
|
|
3174
|
-
const l = new
|
|
3301
|
+
const l = new le(a.tagName);
|
|
3175
3302
|
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);
|
|
3176
3303
|
}
|
|
3177
3304
|
i = a.closeIndex + 1;
|
|
3178
3305
|
} else if (r.substr(i + 1, 3) === "!--") {
|
|
3179
|
-
const a =
|
|
3306
|
+
const a = ce(r, "-->", i + 4, "Comment is not closed.");
|
|
3180
3307
|
if (this.options.commentPropName) {
|
|
3181
3308
|
const l = r.substring(i + 4, a - 2);
|
|
3182
3309
|
s = this.saveTextToParentTag(s, t, n), t.add(this.options.commentPropName, [{ [this.options.textNodeName]: l }]);
|
|
@@ -3186,53 +3313,53 @@ const Qr = function(r) {
|
|
|
3186
3313
|
const a = o.readDocType(r, i);
|
|
3187
3314
|
this.docTypeEntities = a.entities, i = a.i;
|
|
3188
3315
|
} else if (r.substr(i + 1, 2) === "![") {
|
|
3189
|
-
const a =
|
|
3316
|
+
const a = ce(r, "]]>", i, "CDATA is not closed.") - 2, l = r.substring(i + 9, a);
|
|
3190
3317
|
s = this.saveTextToParentTag(s, t, n);
|
|
3191
3318
|
let h = this.parseTextData(l, t.tagname, n, !0, !1, !0, !0);
|
|
3192
3319
|
h == null && (h = ""), this.options.cdataPropName ? t.add(this.options.cdataPropName, [{ [this.options.textNodeName]: l }]) : t.add(this.options.textNodeName, h), i = a + 2;
|
|
3193
3320
|
} else {
|
|
3194
|
-
let a =
|
|
3321
|
+
let a = Ae(r, i, this.options.removeNSPrefix), l = a.tagName;
|
|
3195
3322
|
const h = a.rawTagName;
|
|
3196
|
-
let f = a.tagExp,
|
|
3323
|
+
let f = a.tagExp, E = a.attrExpPresent, _ = a.closeIndex;
|
|
3197
3324
|
this.options.transformTagName && (l = this.options.transformTagName(l)), t && s && t.tagname !== "!xml" && (s = this.saveTextToParentTag(s, t, n, !1));
|
|
3198
3325
|
const w = t;
|
|
3199
3326
|
w && this.options.unpairedTags.indexOf(w.tagname) !== -1 && (t = this.tagsNodeStack.pop(), n = n.substring(0, n.lastIndexOf("."))), l !== e.tagname && (n += n ? "." + l : l);
|
|
3200
|
-
const
|
|
3327
|
+
const O = i;
|
|
3201
3328
|
if (this.isItStopNode(this.options.stopNodes, n, l)) {
|
|
3202
|
-
let
|
|
3329
|
+
let x = "";
|
|
3203
3330
|
if (f.length > 0 && f.lastIndexOf("/") === f.length - 1)
|
|
3204
3331
|
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;
|
|
3205
3332
|
else if (this.options.unpairedTags.indexOf(l) !== -1)
|
|
3206
3333
|
i = a.closeIndex;
|
|
3207
3334
|
else {
|
|
3208
|
-
const
|
|
3209
|
-
if (!
|
|
3210
|
-
i =
|
|
3335
|
+
const X = this.readStopNodeData(r, h, _ + 1);
|
|
3336
|
+
if (!X) throw new Error(`Unexpected end of ${h}`);
|
|
3337
|
+
i = X.i, x = X.tagContent;
|
|
3211
3338
|
}
|
|
3212
|
-
const
|
|
3213
|
-
l !== f &&
|
|
3339
|
+
const S = new le(l);
|
|
3340
|
+
l !== f && E && (S[":@"] = this.buildAttributesMap(f, n, l)), x && (x = this.parseTextData(x, l, n, !0, E, !0, !0)), n = n.substr(0, n.lastIndexOf(".")), S.add(this.options.textNodeName, x), this.addChild(t, S, n, O);
|
|
3214
3341
|
} else {
|
|
3215
3342
|
if (f.length > 0 && f.lastIndexOf("/") === f.length - 1) {
|
|
3216
3343
|
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));
|
|
3217
|
-
const
|
|
3218
|
-
l !== f &&
|
|
3344
|
+
const x = new le(l);
|
|
3345
|
+
l !== f && E && (x[":@"] = this.buildAttributesMap(f, n, l)), this.addChild(t, x, n, O), n = n.substr(0, n.lastIndexOf("."));
|
|
3219
3346
|
} else {
|
|
3220
|
-
const
|
|
3221
|
-
this.tagsNodeStack.push(t), l !== f &&
|
|
3347
|
+
const x = new le(l);
|
|
3348
|
+
this.tagsNodeStack.push(t), l !== f && E && (x[":@"] = this.buildAttributesMap(f, n, l)), this.addChild(t, x, n, O), t = x;
|
|
3222
3349
|
}
|
|
3223
|
-
s = "", i =
|
|
3350
|
+
s = "", i = _;
|
|
3224
3351
|
}
|
|
3225
3352
|
}
|
|
3226
3353
|
else
|
|
3227
3354
|
s += r[i];
|
|
3228
3355
|
return e.child;
|
|
3229
3356
|
};
|
|
3230
|
-
function
|
|
3357
|
+
function zr(r, e, t, s) {
|
|
3231
3358
|
this.options.captureMetaData || (s = void 0);
|
|
3232
3359
|
const n = this.options.updateTag(e.tagname, t, e[":@"]);
|
|
3233
3360
|
n === !1 || (typeof n == "string" && (e.tagname = n), r.addChild(e, s));
|
|
3234
3361
|
}
|
|
3235
|
-
const
|
|
3362
|
+
const Dr = function(r) {
|
|
3236
3363
|
if (this.options.processEntities) {
|
|
3237
3364
|
for (let e in this.docTypeEntities) {
|
|
3238
3365
|
const t = this.docTypeEntities[e];
|
|
@@ -3251,7 +3378,7 @@ const Gr = function(r) {
|
|
|
3251
3378
|
}
|
|
3252
3379
|
return r;
|
|
3253
3380
|
};
|
|
3254
|
-
function
|
|
3381
|
+
function Jr(r, e, t, s) {
|
|
3255
3382
|
return r && (s === void 0 && (s = e.child.length === 0), r = this.parseTextData(
|
|
3256
3383
|
r,
|
|
3257
3384
|
e.tagname,
|
|
@@ -3261,7 +3388,7 @@ function Zr(r, e, t, s) {
|
|
|
3261
3388
|
s
|
|
3262
3389
|
), r !== void 0 && r !== "" && e.add(this.options.textNodeName, r), r = ""), r;
|
|
3263
3390
|
}
|
|
3264
|
-
function
|
|
3391
|
+
function en(r, e, t) {
|
|
3265
3392
|
const s = "*." + t;
|
|
3266
3393
|
for (const n in r) {
|
|
3267
3394
|
const o = r[n];
|
|
@@ -3269,7 +3396,7 @@ function zr(r, e, t) {
|
|
|
3269
3396
|
}
|
|
3270
3397
|
return !1;
|
|
3271
3398
|
}
|
|
3272
|
-
function
|
|
3399
|
+
function tn(r, e, t = ">") {
|
|
3273
3400
|
let s, n = "";
|
|
3274
3401
|
for (let o = e; o < r.length; o++) {
|
|
3275
3402
|
let i = r[o];
|
|
@@ -3293,19 +3420,19 @@ function Dr(r, e, t = ">") {
|
|
|
3293
3420
|
n += i;
|
|
3294
3421
|
}
|
|
3295
3422
|
}
|
|
3296
|
-
function
|
|
3423
|
+
function ce(r, e, t, s) {
|
|
3297
3424
|
const n = r.indexOf(e, t);
|
|
3298
3425
|
if (n === -1)
|
|
3299
3426
|
throw new Error(s);
|
|
3300
3427
|
return n + e.length - 1;
|
|
3301
3428
|
}
|
|
3302
|
-
function
|
|
3303
|
-
const n =
|
|
3429
|
+
function Ae(r, e, t, s = ">") {
|
|
3430
|
+
const n = tn(r, e + 1, s);
|
|
3304
3431
|
if (!n) return;
|
|
3305
3432
|
let o = n.data;
|
|
3306
|
-
const i = n.index,
|
|
3433
|
+
const i = n.index, c = o.search(/\s/);
|
|
3307
3434
|
let a = o, l = !0;
|
|
3308
|
-
|
|
3435
|
+
c !== -1 && (a = o.substring(0, c), o = o.substring(c + 1).trimStart());
|
|
3309
3436
|
const h = a;
|
|
3310
3437
|
if (t) {
|
|
3311
3438
|
const f = a.indexOf(":");
|
|
@@ -3319,13 +3446,13 @@ function we(r, e, t, s = ">") {
|
|
|
3319
3446
|
rawTagName: h
|
|
3320
3447
|
};
|
|
3321
3448
|
}
|
|
3322
|
-
function
|
|
3449
|
+
function rn(r, e, t) {
|
|
3323
3450
|
const s = t;
|
|
3324
3451
|
let n = 1;
|
|
3325
3452
|
for (; t < r.length; t++)
|
|
3326
3453
|
if (r[t] === "<")
|
|
3327
3454
|
if (r[t + 1] === "/") {
|
|
3328
|
-
const o =
|
|
3455
|
+
const o = ce(r, ">", t, `${e} is not closed`);
|
|
3329
3456
|
if (r.substring(t + 2, o).trim() === e && (n--, n === 0))
|
|
3330
3457
|
return {
|
|
3331
3458
|
tagContent: r.substring(s, t),
|
|
@@ -3333,70 +3460,70 @@ function Jr(r, e, t) {
|
|
|
3333
3460
|
};
|
|
3334
3461
|
t = o;
|
|
3335
3462
|
} else if (r[t + 1] === "?")
|
|
3336
|
-
t =
|
|
3463
|
+
t = ce(r, "?>", t + 1, "StopNode is not closed.");
|
|
3337
3464
|
else if (r.substr(t + 1, 3) === "!--")
|
|
3338
|
-
t =
|
|
3465
|
+
t = ce(r, "-->", t + 3, "StopNode is not closed.");
|
|
3339
3466
|
else if (r.substr(t + 1, 2) === "![")
|
|
3340
|
-
t =
|
|
3467
|
+
t = ce(r, "]]>", t, "StopNode is not closed.") - 2;
|
|
3341
3468
|
else {
|
|
3342
|
-
const o =
|
|
3469
|
+
const o = Ae(r, t, ">");
|
|
3343
3470
|
o && ((o && o.tagName) === e && o.tagExp[o.tagExp.length - 1] !== "/" && n++, t = o.closeIndex);
|
|
3344
3471
|
}
|
|
3345
3472
|
}
|
|
3346
|
-
function
|
|
3473
|
+
function we(r, e, t) {
|
|
3347
3474
|
if (e && typeof r == "string") {
|
|
3348
3475
|
const s = r.trim();
|
|
3349
|
-
return s === "true" ? !0 : s === "false" ? !1 :
|
|
3476
|
+
return s === "true" ? !0 : s === "false" ? !1 : Mr(r, t);
|
|
3350
3477
|
} else
|
|
3351
|
-
return
|
|
3478
|
+
return kr(r) ? r : "";
|
|
3352
3479
|
}
|
|
3353
|
-
const
|
|
3354
|
-
function
|
|
3355
|
-
return
|
|
3480
|
+
const ke = le.getMetaDataSymbol();
|
|
3481
|
+
function nn(r, e) {
|
|
3482
|
+
return We(r, e);
|
|
3356
3483
|
}
|
|
3357
|
-
function
|
|
3484
|
+
function We(r, e, t) {
|
|
3358
3485
|
let s;
|
|
3359
3486
|
const n = {};
|
|
3360
3487
|
for (let o = 0; o < r.length; o++) {
|
|
3361
|
-
const i = r[o],
|
|
3488
|
+
const i = r[o], c = sn(i);
|
|
3362
3489
|
let a = "";
|
|
3363
|
-
if (t === void 0 ? a =
|
|
3364
|
-
s === void 0 ? s = i[
|
|
3490
|
+
if (t === void 0 ? a = c : a = t + "." + c, c === e.textNodeName)
|
|
3491
|
+
s === void 0 ? s = i[c] : s += "" + i[c];
|
|
3365
3492
|
else {
|
|
3366
|
-
if (
|
|
3493
|
+
if (c === void 0)
|
|
3367
3494
|
continue;
|
|
3368
|
-
if (i[
|
|
3369
|
-
let l =
|
|
3370
|
-
const h =
|
|
3371
|
-
i[
|
|
3495
|
+
if (i[c]) {
|
|
3496
|
+
let l = We(i[c], e, a);
|
|
3497
|
+
const h = an(l, e);
|
|
3498
|
+
i[ke] !== void 0 && (l[ke] = i[ke]), i[":@"] ? on(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[c] !== void 0 && n.hasOwnProperty(c) ? (Array.isArray(n[c]) || (n[c] = [n[c]]), n[c].push(l)) : e.isArray(c, a, h) ? n[c] = [l] : n[c] = l;
|
|
3372
3499
|
}
|
|
3373
3500
|
}
|
|
3374
3501
|
}
|
|
3375
3502
|
return typeof s == "string" ? s.length > 0 && (n[e.textNodeName] = s) : s !== void 0 && (n[e.textNodeName] = s), n;
|
|
3376
3503
|
}
|
|
3377
|
-
function
|
|
3504
|
+
function sn(r) {
|
|
3378
3505
|
const e = Object.keys(r);
|
|
3379
3506
|
for (let t = 0; t < e.length; t++) {
|
|
3380
3507
|
const s = e[t];
|
|
3381
3508
|
if (s !== ":@") return s;
|
|
3382
3509
|
}
|
|
3383
3510
|
}
|
|
3384
|
-
function
|
|
3511
|
+
function on(r, e, t, s) {
|
|
3385
3512
|
if (e) {
|
|
3386
3513
|
const n = Object.keys(e), o = n.length;
|
|
3387
3514
|
for (let i = 0; i < o; i++) {
|
|
3388
|
-
const
|
|
3389
|
-
s.isArray(
|
|
3515
|
+
const c = n[i];
|
|
3516
|
+
s.isArray(c, t + "." + c, !0, !0) ? r[c] = [e[c]] : r[c] = e[c];
|
|
3390
3517
|
}
|
|
3391
3518
|
}
|
|
3392
3519
|
}
|
|
3393
|
-
function
|
|
3520
|
+
function an(r, e) {
|
|
3394
3521
|
const { textNodeName: t } = e, s = Object.keys(r).length;
|
|
3395
3522
|
return !!(s === 0 || s === 1 && (r[t] || typeof r[t] == "boolean" || r[t] === 0));
|
|
3396
3523
|
}
|
|
3397
|
-
class
|
|
3524
|
+
class ln {
|
|
3398
3525
|
constructor(e) {
|
|
3399
|
-
this.externalEntities = {}, this.options =
|
|
3526
|
+
this.externalEntities = {}, this.options = Ir(e);
|
|
3400
3527
|
}
|
|
3401
3528
|
/**
|
|
3402
3529
|
* Parse XML dats to JS object
|
|
@@ -3410,14 +3537,14 @@ class sn {
|
|
|
3410
3537
|
throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
3411
3538
|
if (t) {
|
|
3412
3539
|
t === !0 && (t = {});
|
|
3413
|
-
const o =
|
|
3540
|
+
const o = qe(e, t);
|
|
3414
3541
|
if (o !== !0)
|
|
3415
3542
|
throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`);
|
|
3416
3543
|
}
|
|
3417
|
-
const s = new
|
|
3544
|
+
const s = new Kr(this.options);
|
|
3418
3545
|
s.addExternalEntities(this.externalEntities);
|
|
3419
3546
|
const n = s.parseXml(e);
|
|
3420
|
-
return this.options.preserveOrder || n === void 0 ? n :
|
|
3547
|
+
return this.options.preserveOrder || n === void 0 ? n : nn(n, this.options);
|
|
3421
3548
|
}
|
|
3422
3549
|
/**
|
|
3423
3550
|
* Add Entity which is not by default supported by this library
|
|
@@ -3444,45 +3571,45 @@ class sn {
|
|
|
3444
3571
|
* is true in the options.
|
|
3445
3572
|
*/
|
|
3446
3573
|
static getMetaDataSymbol() {
|
|
3447
|
-
return
|
|
3574
|
+
return le.getMetaDataSymbol();
|
|
3448
3575
|
}
|
|
3449
3576
|
}
|
|
3450
|
-
const
|
|
3577
|
+
const cn = `
|
|
3451
3578
|
`;
|
|
3452
|
-
function
|
|
3579
|
+
function un(r, e) {
|
|
3453
3580
|
let t = "";
|
|
3454
|
-
return e.format && e.indentBy.length > 0 && (t =
|
|
3581
|
+
return e.format && e.indentBy.length > 0 && (t = cn), Ye(r, e, "", t);
|
|
3455
3582
|
}
|
|
3456
|
-
function
|
|
3583
|
+
function Ye(r, e, t, s) {
|
|
3457
3584
|
let n = "", o = !1;
|
|
3458
3585
|
for (let i = 0; i < r.length; i++) {
|
|
3459
|
-
const
|
|
3586
|
+
const c = r[i], a = dn(c);
|
|
3460
3587
|
if (a === void 0) continue;
|
|
3461
3588
|
let l = "";
|
|
3462
3589
|
if (t.length === 0 ? l = a : l = `${t}.${a}`, a === e.textNodeName) {
|
|
3463
|
-
let w =
|
|
3464
|
-
|
|
3590
|
+
let w = c[a];
|
|
3591
|
+
fn(l, e) || (w = e.tagValueProcessor(a, w), w = Ge(w, e)), o && (n += s), n += w, o = !1;
|
|
3465
3592
|
continue;
|
|
3466
3593
|
} else if (a === e.cdataPropName) {
|
|
3467
|
-
o && (n += s), n += `<![CDATA[${
|
|
3594
|
+
o && (n += s), n += `<![CDATA[${c[a][0][e.textNodeName]}]]>`, o = !1;
|
|
3468
3595
|
continue;
|
|
3469
3596
|
} else if (a === e.commentPropName) {
|
|
3470
|
-
n += s + `<!--${
|
|
3597
|
+
n += s + `<!--${c[a][0][e.textNodeName]}-->`, o = !0;
|
|
3471
3598
|
continue;
|
|
3472
3599
|
} else if (a[0] === "?") {
|
|
3473
|
-
const w =
|
|
3474
|
-
let
|
|
3475
|
-
|
|
3600
|
+
const w = Re(c[":@"], e), O = a === "?xml" ? "" : s;
|
|
3601
|
+
let x = c[a][0][e.textNodeName];
|
|
3602
|
+
x = x.length !== 0 ? " " + x : "", n += O + `<${a}${x}${w}?>`, o = !0;
|
|
3476
3603
|
continue;
|
|
3477
3604
|
}
|
|
3478
3605
|
let h = s;
|
|
3479
3606
|
h !== "" && (h += e.indentBy);
|
|
3480
|
-
const f =
|
|
3481
|
-
e.unpairedTags.indexOf(a) !== -1 ? e.suppressUnpairedNode ? n +=
|
|
3607
|
+
const f = Re(c[":@"], e), E = s + `<${a}${f}`, _ = Ye(c[a], e, l, h);
|
|
3608
|
+
e.unpairedTags.indexOf(a) !== -1 ? e.suppressUnpairedNode ? n += E + ">" : n += E + "/>" : (!_ || _.length === 0) && e.suppressEmptyNode ? n += E + "/>" : _ && _.endsWith(">") ? n += E + `>${_}${s}</${a}>` : (n += E + ">", _ && s !== "" && (_.includes("/>") || _.includes("</")) ? n += s + e.indentBy + _ + s : n += _, n += `</${a}>`), o = !0;
|
|
3482
3609
|
}
|
|
3483
3610
|
return n;
|
|
3484
3611
|
}
|
|
3485
|
-
function
|
|
3612
|
+
function dn(r) {
|
|
3486
3613
|
const e = Object.keys(r);
|
|
3487
3614
|
for (let t = 0; t < e.length; t++) {
|
|
3488
3615
|
const s = e[t];
|
|
@@ -3490,24 +3617,24 @@ function ln(r) {
|
|
|
3490
3617
|
return s;
|
|
3491
3618
|
}
|
|
3492
3619
|
}
|
|
3493
|
-
function
|
|
3620
|
+
function Re(r, e) {
|
|
3494
3621
|
let t = "";
|
|
3495
3622
|
if (r && !e.ignoreAttributes)
|
|
3496
3623
|
for (let s in r) {
|
|
3497
3624
|
if (!r.hasOwnProperty(s)) continue;
|
|
3498
3625
|
let n = e.attributeValueProcessor(s, r[s]);
|
|
3499
|
-
n =
|
|
3626
|
+
n = Ge(n, e), n === !0 && e.suppressBooleanAttributes ? t += ` ${s.substr(e.attributeNamePrefix.length)}` : t += ` ${s.substr(e.attributeNamePrefix.length)}="${n}"`;
|
|
3500
3627
|
}
|
|
3501
3628
|
return t;
|
|
3502
3629
|
}
|
|
3503
|
-
function
|
|
3630
|
+
function fn(r, e) {
|
|
3504
3631
|
r = r.substr(0, r.length - e.textNodeName.length - 1);
|
|
3505
3632
|
let t = r.substr(r.lastIndexOf(".") + 1);
|
|
3506
3633
|
for (let s in e.stopNodes)
|
|
3507
3634
|
if (e.stopNodes[s] === r || e.stopNodes[s] === "*." + t) return !0;
|
|
3508
3635
|
return !1;
|
|
3509
3636
|
}
|
|
3510
|
-
function
|
|
3637
|
+
function Ge(r, e) {
|
|
3511
3638
|
if (r && r.length > 0 && e.processEntities)
|
|
3512
3639
|
for (let t = 0; t < e.entities.length; t++) {
|
|
3513
3640
|
const s = e.entities[t];
|
|
@@ -3515,7 +3642,7 @@ function ze(r, e) {
|
|
|
3515
3642
|
}
|
|
3516
3643
|
return r;
|
|
3517
3644
|
}
|
|
3518
|
-
const
|
|
3645
|
+
const hn = {
|
|
3519
3646
|
attributeNamePrefix: "@_",
|
|
3520
3647
|
attributesGroupName: !1,
|
|
3521
3648
|
textNodeName: "#text",
|
|
@@ -3550,16 +3677,16 @@ const cn = {
|
|
|
3550
3677
|
oneListGroup: !1
|
|
3551
3678
|
};
|
|
3552
3679
|
function ne(r) {
|
|
3553
|
-
this.options = Object.assign({},
|
|
3680
|
+
this.options = Object.assign({}, hn, r), this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
|
|
3554
3681
|
return !1;
|
|
3555
|
-
} : (this.ignoreAttributesFn =
|
|
3682
|
+
} : (this.ignoreAttributesFn = Qe(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = mn), this.processTextOrObjNode = pn, this.options.format ? (this.indentate = gn, this.tagEndChar = `>
|
|
3556
3683
|
`, this.newLine = `
|
|
3557
3684
|
`) : (this.indentate = function() {
|
|
3558
3685
|
return "";
|
|
3559
3686
|
}, this.tagEndChar = ">", this.newLine = "");
|
|
3560
3687
|
}
|
|
3561
3688
|
ne.prototype.build = function(r) {
|
|
3562
|
-
return this.options.preserveOrder ?
|
|
3689
|
+
return this.options.preserveOrder ? un(r, this.options) : (Array.isArray(r) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (r = {
|
|
3563
3690
|
[this.options.arrayNodeName]: r
|
|
3564
3691
|
}), this.j2x(r, 0, []).val);
|
|
3565
3692
|
};
|
|
@@ -3575,39 +3702,39 @@ ne.prototype.j2x = function(r, e, t) {
|
|
|
3575
3702
|
else if (r[i] instanceof Date)
|
|
3576
3703
|
n += this.buildTextValNode(r[i], i, "", e);
|
|
3577
3704
|
else if (typeof r[i] != "object") {
|
|
3578
|
-
const
|
|
3579
|
-
if (
|
|
3580
|
-
s += this.buildAttrPairStr(
|
|
3581
|
-
else if (!
|
|
3705
|
+
const c = this.isAttribute(i);
|
|
3706
|
+
if (c && !this.ignoreAttributesFn(c, o))
|
|
3707
|
+
s += this.buildAttrPairStr(c, "" + r[i]);
|
|
3708
|
+
else if (!c)
|
|
3582
3709
|
if (i === this.options.textNodeName) {
|
|
3583
3710
|
let a = this.options.tagValueProcessor(i, "" + r[i]);
|
|
3584
3711
|
n += this.replaceEntitiesValue(a);
|
|
3585
3712
|
} else
|
|
3586
3713
|
n += this.buildTextValNode(r[i], i, "", e);
|
|
3587
3714
|
} else if (Array.isArray(r[i])) {
|
|
3588
|
-
const
|
|
3715
|
+
const c = r[i].length;
|
|
3589
3716
|
let a = "", l = "";
|
|
3590
|
-
for (let h = 0; h <
|
|
3717
|
+
for (let h = 0; h < c; h++) {
|
|
3591
3718
|
const f = r[i][h];
|
|
3592
3719
|
if (!(typeof f > "u")) if (f === null)
|
|
3593
3720
|
i[0] === "?" ? n += this.indentate(e) + "<" + i + "?" + this.tagEndChar : n += this.indentate(e) + "<" + i + "/" + this.tagEndChar;
|
|
3594
3721
|
else if (typeof f == "object")
|
|
3595
3722
|
if (this.options.oneListGroup) {
|
|
3596
|
-
const
|
|
3597
|
-
a +=
|
|
3723
|
+
const E = this.j2x(f, e + 1, t.concat(i));
|
|
3724
|
+
a += E.val, this.options.attributesGroupName && f.hasOwnProperty(this.options.attributesGroupName) && (l += E.attrStr);
|
|
3598
3725
|
} else
|
|
3599
3726
|
a += this.processTextOrObjNode(f, i, e, t);
|
|
3600
3727
|
else if (this.options.oneListGroup) {
|
|
3601
|
-
let
|
|
3602
|
-
|
|
3728
|
+
let E = this.options.tagValueProcessor(i, f);
|
|
3729
|
+
E = this.replaceEntitiesValue(E), a += E;
|
|
3603
3730
|
} else
|
|
3604
3731
|
a += this.buildTextValNode(f, i, "", e);
|
|
3605
3732
|
}
|
|
3606
3733
|
this.options.oneListGroup && (a = this.buildObjectNode(a, i, l, e)), n += a;
|
|
3607
3734
|
} else if (this.options.attributesGroupName && i === this.options.attributesGroupName) {
|
|
3608
|
-
const
|
|
3735
|
+
const c = Object.keys(r[i]), a = c.length;
|
|
3609
3736
|
for (let l = 0; l < a; l++)
|
|
3610
|
-
s += this.buildAttrPairStr(
|
|
3737
|
+
s += this.buildAttrPairStr(c[l], "" + r[i][c[l]]);
|
|
3611
3738
|
} else
|
|
3612
3739
|
n += this.processTextOrObjNode(r[i], i, e, t);
|
|
3613
3740
|
return { attrStr: s, val: n };
|
|
@@ -3615,7 +3742,7 @@ ne.prototype.j2x = function(r, e, t) {
|
|
|
3615
3742
|
ne.prototype.buildAttrPairStr = function(r, e) {
|
|
3616
3743
|
return e = this.options.attributeValueProcessor(r, "" + e), e = this.replaceEntitiesValue(e), this.options.suppressBooleanAttributes && e === "true" ? " " + r : " " + r + '="' + e + '"';
|
|
3617
3744
|
};
|
|
3618
|
-
function
|
|
3745
|
+
function pn(r, e, t, s) {
|
|
3619
3746
|
const n = this.j2x(r, t + 1, s.concat(e));
|
|
3620
3747
|
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);
|
|
3621
3748
|
}
|
|
@@ -3651,15 +3778,15 @@ ne.prototype.replaceEntitiesValue = function(r) {
|
|
|
3651
3778
|
}
|
|
3652
3779
|
return r;
|
|
3653
3780
|
};
|
|
3654
|
-
function
|
|
3781
|
+
function gn(r) {
|
|
3655
3782
|
return this.options.indentBy.repeat(r);
|
|
3656
3783
|
}
|
|
3657
|
-
function
|
|
3784
|
+
function mn(r) {
|
|
3658
3785
|
return r.startsWith(this.options.attributeNamePrefix) && r !== this.options.textNodeName ? r.substr(this.attrPrefixLen) : !1;
|
|
3659
3786
|
}
|
|
3660
|
-
const
|
|
3661
|
-
validate:
|
|
3662
|
-
},
|
|
3787
|
+
const bn = {
|
|
3788
|
+
validate: qe
|
|
3789
|
+
}, yn = {
|
|
3663
3790
|
ignoreAttributes: !1,
|
|
3664
3791
|
// 保留属性
|
|
3665
3792
|
attributeNamePrefix: "@_",
|
|
@@ -3694,7 +3821,7 @@ const pn = {
|
|
|
3694
3821
|
// 停止解析的节点
|
|
3695
3822
|
alwaysCreateTextNode: !1
|
|
3696
3823
|
// 仅在有文本时创建文本节点
|
|
3697
|
-
},
|
|
3824
|
+
}, vn = {
|
|
3698
3825
|
ignoreAttributes: !1,
|
|
3699
3826
|
attributeNamePrefix: "@_",
|
|
3700
3827
|
textNodeName: "#text",
|
|
@@ -3706,9 +3833,9 @@ const pn = {
|
|
|
3706
3833
|
// 不抑制空节点
|
|
3707
3834
|
suppressBooleanAttributes: !1,
|
|
3708
3835
|
suppressUnpairedNode: !1
|
|
3709
|
-
},
|
|
3836
|
+
}, _n = (r) => {
|
|
3710
3837
|
try {
|
|
3711
|
-
const e =
|
|
3838
|
+
const e = bn.validate(r, {
|
|
3712
3839
|
allowBooleanAttributes: !0
|
|
3713
3840
|
});
|
|
3714
3841
|
return e === !0 ? { valid: !0 } : {
|
|
@@ -3721,10 +3848,10 @@ const pn = {
|
|
|
3721
3848
|
error: e instanceof Error ? e.message : "Unknown validation error"
|
|
3722
3849
|
};
|
|
3723
3850
|
}
|
|
3724
|
-
},
|
|
3851
|
+
}, Ze = (r, e) => {
|
|
3725
3852
|
try {
|
|
3726
|
-
return new
|
|
3727
|
-
...
|
|
3853
|
+
return new ln({
|
|
3854
|
+
...yn,
|
|
3728
3855
|
...e
|
|
3729
3856
|
}).parse(r);
|
|
3730
3857
|
} catch (t) {
|
|
@@ -3732,10 +3859,10 @@ const pn = {
|
|
|
3732
3859
|
`XML 解析失败: ${t instanceof Error ? t.message : "Unknown error"}`
|
|
3733
3860
|
);
|
|
3734
3861
|
}
|
|
3735
|
-
},
|
|
3862
|
+
}, Te = (r, e) => {
|
|
3736
3863
|
try {
|
|
3737
3864
|
let s = new ne({
|
|
3738
|
-
...
|
|
3865
|
+
...vn,
|
|
3739
3866
|
format: e?.format ?? !0,
|
|
3740
3867
|
indentBy: e?.indentBy ?? " "
|
|
3741
3868
|
}).build(r);
|
|
@@ -3746,66 +3873,66 @@ const pn = {
|
|
|
3746
3873
|
`XML 构建失败: ${t instanceof Error ? t.message : "Unknown error"}`
|
|
3747
3874
|
);
|
|
3748
3875
|
}
|
|
3749
|
-
},
|
|
3750
|
-
const t =
|
|
3751
|
-
return Array.isArray(t) ?
|
|
3876
|
+
}, En = (r) => Array.isArray(r) ? _e(r, { format: !1 }) : Te(r, { format: !1, showDeclaration: !1 }), xn = (r, e) => {
|
|
3877
|
+
const t = Ze(r);
|
|
3878
|
+
return Array.isArray(t) ? _e(t, {
|
|
3752
3879
|
indent: e?.indentBy
|
|
3753
|
-
}) :
|
|
3754
|
-
},
|
|
3880
|
+
}) : Te(t, e);
|
|
3881
|
+
}, _e = (r, e = {}) => {
|
|
3755
3882
|
const t = e.indent !== void 0 ? e.indent : " ", s = e.level || 0, n = e.format !== !1, o = n ? t.repeat(s) : "", i = n ? `
|
|
3756
3883
|
` : "";
|
|
3757
|
-
let
|
|
3884
|
+
let c = "";
|
|
3758
3885
|
for (const a of r) {
|
|
3759
3886
|
if (a["?xml"]) {
|
|
3760
|
-
const
|
|
3761
|
-
|
|
3887
|
+
const x = a[":@"] || {}, S = Object.entries(x).map(([X, Z]) => `${X.startsWith("@_") ? X.substring(2) : X}="${Z}"`).join(" ");
|
|
3888
|
+
c += `<?xml ${S}?>${i}`;
|
|
3762
3889
|
continue;
|
|
3763
3890
|
}
|
|
3764
3891
|
if (a["#comment"]) {
|
|
3765
|
-
const
|
|
3766
|
-
if (Array.isArray(
|
|
3767
|
-
const
|
|
3768
|
-
|
|
3892
|
+
const x = a["#comment"];
|
|
3893
|
+
if (Array.isArray(x) && x.length > 0) {
|
|
3894
|
+
const S = x[0]["#text"] || x[0];
|
|
3895
|
+
c += `${o}<!--${S}-->${i}`;
|
|
3769
3896
|
}
|
|
3770
3897
|
continue;
|
|
3771
3898
|
}
|
|
3772
|
-
const l = Object.keys(a).find((
|
|
3899
|
+
const l = Object.keys(a).find((x) => !x.startsWith(":") && !x.startsWith("#") && !x.startsWith("__"));
|
|
3773
3900
|
if (!l) continue;
|
|
3774
|
-
const h = a[l], f = a[":@"] || {},
|
|
3901
|
+
const h = a[l], f = a[":@"] || {}, E = Object.entries(f).map(([x, S]) => `${x.startsWith("@_") ? x.substring(2) : x}="${S}"`).join(" "), _ = E ? " " + E : "";
|
|
3775
3902
|
if (!Array.isArray(h) || h.length === 0) {
|
|
3776
|
-
|
|
3903
|
+
c += `${o}<${l}${_}/>${i}`;
|
|
3777
3904
|
continue;
|
|
3778
3905
|
}
|
|
3779
3906
|
const w = h.length === 1 && h[0]["#text"] !== void 0;
|
|
3780
|
-
if (h.some((
|
|
3781
|
-
const
|
|
3782
|
-
if (
|
|
3783
|
-
const
|
|
3784
|
-
|
|
3907
|
+
if (h.some((x) => x.__cdata)) {
|
|
3908
|
+
const x = h.find((S) => S.__cdata);
|
|
3909
|
+
if (x) {
|
|
3910
|
+
const S = x.__cdata[0]["#text"] || "";
|
|
3911
|
+
c += `${o}<${l}${_}><![CDATA[${S}]]></${l}>${i}`;
|
|
3785
3912
|
}
|
|
3786
3913
|
} else if (w) {
|
|
3787
|
-
const
|
|
3788
|
-
|
|
3914
|
+
const x = h[0]["#text"];
|
|
3915
|
+
c += `${o}<${l}${_}>${x}</${l}>${i}`;
|
|
3789
3916
|
} else
|
|
3790
|
-
|
|
3917
|
+
c += `${o}<${l}${_}>${i}`, c += _e(h, { indent: t, level: s + 1, format: n }), c += `${o}</${l}>${i}`;
|
|
3791
3918
|
}
|
|
3792
|
-
return
|
|
3793
|
-
},
|
|
3919
|
+
return c;
|
|
3920
|
+
}, kn = {
|
|
3794
3921
|
key: 0,
|
|
3795
3922
|
class: "xml-format__toolbar"
|
|
3796
|
-
},
|
|
3923
|
+
}, Nn = { class: "xml-format__actions" }, An = ["disabled"], wn = ["disabled"], Cn = ["disabled"], On = ["disabled"], Tn = ["disabled"], Pn = { class: "xml-format__info" }, $n = {
|
|
3797
3924
|
key: 0,
|
|
3798
3925
|
class: "xml-format__status xml-format__status--success"
|
|
3799
|
-
},
|
|
3926
|
+
}, Sn = {
|
|
3800
3927
|
key: 1,
|
|
3801
3928
|
class: "xml-format__status xml-format__status--error"
|
|
3802
|
-
},
|
|
3929
|
+
}, Bn = { class: "xml-format__content" }, In = {
|
|
3803
3930
|
key: 0,
|
|
3804
3931
|
class: "xml-format__error"
|
|
3805
|
-
},
|
|
3932
|
+
}, Vn = {
|
|
3806
3933
|
key: 1,
|
|
3807
3934
|
class: "xml-format__viewer"
|
|
3808
|
-
},
|
|
3935
|
+
}, Ln = /* @__PURE__ */ be({
|
|
3809
3936
|
__name: "index",
|
|
3810
3937
|
props: {
|
|
3811
3938
|
modelValue: { default: "" },
|
|
@@ -3819,7 +3946,7 @@ const pn = {
|
|
|
3819
3946
|
},
|
|
3820
3947
|
emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress", "format"],
|
|
3821
3948
|
setup(r, { expose: e, emit: t }) {
|
|
3822
|
-
|
|
3949
|
+
Ce((g) => ({
|
|
3823
3950
|
"0db40539": l.value.colors.border,
|
|
3824
3951
|
bd72d08a: l.value.colors.background,
|
|
3825
3952
|
"1738b57a": l.value.colors.text,
|
|
@@ -3835,182 +3962,182 @@ const pn = {
|
|
|
3835
3962
|
"61df294a": l.value.colors.error,
|
|
3836
3963
|
"3307322e": l.value.colors.errorBackground
|
|
3837
3964
|
}));
|
|
3838
|
-
const s = r, n = t, o =
|
|
3965
|
+
const s = r, n = t, o = W(null), i = W(""), c = W(/* @__PURE__ */ new Set()), a = V(() => i.value === ""), l = V(() => vr(s.theme)), h = V(() => !o.value || !Array.isArray(o.value) ? [] : o.value.filter((g) => !g["?xml"])), f = V(() => {
|
|
3839
3966
|
if (!o.value || !Array.isArray(o.value)) return null;
|
|
3840
|
-
const
|
|
3841
|
-
if (!
|
|
3842
|
-
const
|
|
3843
|
-
return
|
|
3844
|
-
}),
|
|
3845
|
-
if (!
|
|
3967
|
+
const g = o.value.find((R) => R["?xml"]);
|
|
3968
|
+
if (!g || !g[":@"]) return null;
|
|
3969
|
+
const C = g[":@"], $ = [];
|
|
3970
|
+
return C["@_version"] && $.push(`version="${C["@_version"]}"`), C["@_encoding"] && $.push(`encoding="${C["@_encoding"]}"`), C["@_standalone"] && $.push(`standalone="${C["@_standalone"]}"`), $.length > 0 ? `<?xml ${$.join(" ")}?>` : null;
|
|
3971
|
+
}), E = V(() => h.value), _ = (g) => {
|
|
3972
|
+
if (!g || !g.trim()) {
|
|
3846
3973
|
i.value = "", o.value = null;
|
|
3847
3974
|
return;
|
|
3848
3975
|
}
|
|
3849
3976
|
try {
|
|
3850
|
-
const
|
|
3851
|
-
if (!
|
|
3852
|
-
i.value =
|
|
3977
|
+
const C = _n(g);
|
|
3978
|
+
if (!C.valid) {
|
|
3979
|
+
i.value = C.error || "Invalid XML", o.value = null;
|
|
3853
3980
|
return;
|
|
3854
3981
|
}
|
|
3855
|
-
o.value =
|
|
3856
|
-
|
|
3982
|
+
o.value = Ze(g), i.value = "", he(() => {
|
|
3983
|
+
O();
|
|
3857
3984
|
});
|
|
3858
|
-
} catch (
|
|
3859
|
-
i.value =
|
|
3985
|
+
} catch (C) {
|
|
3986
|
+
i.value = C instanceof Error ? C.message : "Unknown parse error", o.value = null;
|
|
3860
3987
|
}
|
|
3861
|
-
}, w = (
|
|
3862
|
-
|
|
3863
|
-
},
|
|
3864
|
-
const
|
|
3865
|
-
Array.isArray(
|
|
3866
|
-
const
|
|
3867
|
-
if (!
|
|
3868
|
-
const
|
|
3869
|
-
|
|
3870
|
-
const
|
|
3871
|
-
Array.isArray(
|
|
3988
|
+
}, w = (g) => {
|
|
3989
|
+
c.value.has(g) ? c.value.delete(g) : c.value.add(g);
|
|
3990
|
+
}, O = () => {
|
|
3991
|
+
const g = /* @__PURE__ */ new Set(), C = ($, R = "") => {
|
|
3992
|
+
Array.isArray($) && $.forEach((K, Y) => {
|
|
3993
|
+
const q = Object.keys(K).find((oe) => !oe.startsWith(":") && !oe.startsWith("#"));
|
|
3994
|
+
if (!q) return;
|
|
3995
|
+
const se = R ? `${R}[${Y}]` : `${q}[${Y}]`;
|
|
3996
|
+
g.add(se);
|
|
3997
|
+
const J = K[q];
|
|
3998
|
+
Array.isArray(J) && C(J, se + "." + q);
|
|
3872
3999
|
});
|
|
3873
4000
|
};
|
|
3874
|
-
h.value.forEach((
|
|
3875
|
-
const
|
|
3876
|
-
if (
|
|
3877
|
-
const Y = `${
|
|
3878
|
-
|
|
3879
|
-
const
|
|
3880
|
-
Array.isArray(
|
|
4001
|
+
h.value.forEach(($, R) => {
|
|
4002
|
+
const K = Object.keys($).find((Y) => !Y.startsWith(":") && !Y.startsWith("#"));
|
|
4003
|
+
if (K) {
|
|
4004
|
+
const Y = `${K}[${R}]`;
|
|
4005
|
+
g.add(Y);
|
|
4006
|
+
const q = $[K];
|
|
4007
|
+
Array.isArray(q) && C(q, Y + "." + K);
|
|
3881
4008
|
}
|
|
3882
|
-
}),
|
|
3883
|
-
},
|
|
3884
|
-
|
|
3885
|
-
},
|
|
4009
|
+
}), c.value = g, n("expand-all");
|
|
4010
|
+
}, x = () => {
|
|
4011
|
+
c.value.clear(), n("collapse-all");
|
|
4012
|
+
}, S = async () => {
|
|
3886
4013
|
if (!(!a.value || !o.value))
|
|
3887
4014
|
try {
|
|
3888
|
-
const
|
|
3889
|
-
await navigator.clipboard.writeText(
|
|
3890
|
-
} catch (
|
|
3891
|
-
const
|
|
3892
|
-
n("copy-error",
|
|
4015
|
+
const g = Array.isArray(o.value) ? _e(o.value, { indent: " " }) : Te(o.value, { format: !0, indentBy: " " });
|
|
4016
|
+
await navigator.clipboard.writeText(g), n("copy-success", g);
|
|
4017
|
+
} catch (g) {
|
|
4018
|
+
const C = g instanceof Error ? g : new Error("Copy failed");
|
|
4019
|
+
n("copy-error", C), console.error("Failed to copy XML:", g);
|
|
3893
4020
|
}
|
|
3894
|
-
},
|
|
4021
|
+
}, X = () => {
|
|
3895
4022
|
if (!(!a.value || !o.value))
|
|
3896
4023
|
try {
|
|
3897
|
-
const
|
|
3898
|
-
n("update:modelValue",
|
|
3899
|
-
} catch (
|
|
3900
|
-
console.error("Failed to compress XML:",
|
|
4024
|
+
const g = En(o.value);
|
|
4025
|
+
n("update:modelValue", g), n("compress", g);
|
|
4026
|
+
} catch (g) {
|
|
4027
|
+
console.error("Failed to compress XML:", g);
|
|
3901
4028
|
}
|
|
3902
|
-
},
|
|
4029
|
+
}, Z = () => {
|
|
3903
4030
|
if (a.value)
|
|
3904
4031
|
try {
|
|
3905
|
-
const
|
|
4032
|
+
const g = xn(s.modelValue, {
|
|
3906
4033
|
format: !0,
|
|
3907
4034
|
indentBy: " "
|
|
3908
4035
|
});
|
|
3909
|
-
n("update:modelValue",
|
|
3910
|
-
} catch (
|
|
3911
|
-
console.error("Failed to format XML:",
|
|
4036
|
+
n("update:modelValue", g), n("format", g);
|
|
4037
|
+
} catch (g) {
|
|
4038
|
+
console.error("Failed to format XML:", g);
|
|
3912
4039
|
}
|
|
3913
|
-
},
|
|
4040
|
+
}, p = async (g) => {
|
|
3914
4041
|
try {
|
|
3915
|
-
const
|
|
3916
|
-
await navigator.clipboard.writeText(
|
|
3917
|
-
} catch (
|
|
3918
|
-
const
|
|
3919
|
-
n("copy-error",
|
|
4042
|
+
const C = typeof g == "string" ? g : JSON.stringify(g, null, 2);
|
|
4043
|
+
await navigator.clipboard.writeText(C), n("copy-success", C);
|
|
4044
|
+
} catch (C) {
|
|
4045
|
+
const $ = C instanceof Error ? C : new Error("Copy failed");
|
|
4046
|
+
n("copy-error", $), console.error("Failed to copy value:", C);
|
|
3920
4047
|
}
|
|
3921
4048
|
};
|
|
3922
|
-
return
|
|
3923
|
-
|
|
4049
|
+
return Ue(() => s.modelValue, (g) => {
|
|
4050
|
+
_(g);
|
|
3924
4051
|
}, { immediate: !0 }), e({
|
|
3925
4052
|
// 核心操作方法
|
|
3926
|
-
copyXml:
|
|
3927
|
-
compressSource:
|
|
3928
|
-
formatSource:
|
|
3929
|
-
expandAll:
|
|
3930
|
-
collapseAll:
|
|
4053
|
+
copyXml: S,
|
|
4054
|
+
compressSource: X,
|
|
4055
|
+
formatSource: Z,
|
|
4056
|
+
expandAll: O,
|
|
4057
|
+
collapseAll: x,
|
|
3931
4058
|
toggleExpand: w,
|
|
3932
4059
|
// 状态访问方法
|
|
3933
4060
|
isValidXml: () => a.value,
|
|
3934
4061
|
getParsedXml: () => o.value,
|
|
3935
|
-
getExpandedNodes: () =>
|
|
4062
|
+
getExpandedNodes: () => c.value,
|
|
3936
4063
|
getParseError: () => i.value,
|
|
3937
4064
|
// 工具方法
|
|
3938
|
-
parseXmlString: (
|
|
3939
|
-
copyValue: (
|
|
3940
|
-
}), (
|
|
3941
|
-
class:
|
|
4065
|
+
parseXmlString: (g) => _(g),
|
|
4066
|
+
copyValue: (g) => p(g)
|
|
4067
|
+
}), (g, C) => (k(), A("div", {
|
|
4068
|
+
class: Oe(["xml-format", `xml-format--${l.value.name}`])
|
|
3942
4069
|
}, [
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
4070
|
+
g.showToolbar ? (k(), A("div", kn, [
|
|
4071
|
+
y("div", Nn, [
|
|
4072
|
+
y("button", {
|
|
3946
4073
|
class: "xml-format__btn xml-format__btn--primary",
|
|
3947
|
-
onClick:
|
|
4074
|
+
onClick: S,
|
|
3948
4075
|
disabled: !a.value,
|
|
3949
4076
|
title: "Copy XML"
|
|
3950
|
-
}, " 📋 Copy ", 8,
|
|
3951
|
-
|
|
4077
|
+
}, " 📋 Copy ", 8, An),
|
|
4078
|
+
y("button", {
|
|
3952
4079
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
3953
|
-
onClick:
|
|
4080
|
+
onClick: O,
|
|
3954
4081
|
disabled: !a.value,
|
|
3955
4082
|
title: "Expand All"
|
|
3956
|
-
}, " ⬇️ Expand All ", 8,
|
|
3957
|
-
|
|
4083
|
+
}, " ⬇️ Expand All ", 8, wn),
|
|
4084
|
+
y("button", {
|
|
3958
4085
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
3959
|
-
onClick:
|
|
4086
|
+
onClick: x,
|
|
3960
4087
|
disabled: !a.value,
|
|
3961
4088
|
title: "Collapse All"
|
|
3962
|
-
}, " ➡️ Collapse All ", 8,
|
|
3963
|
-
|
|
4089
|
+
}, " ➡️ Collapse All ", 8, Cn),
|
|
4090
|
+
y("button", {
|
|
3964
4091
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
3965
|
-
onClick:
|
|
4092
|
+
onClick: X,
|
|
3966
4093
|
disabled: !a.value,
|
|
3967
4094
|
title: "Compress XML"
|
|
3968
|
-
}, " 📦 Compress ", 8,
|
|
3969
|
-
|
|
4095
|
+
}, " 📦 Compress ", 8, On),
|
|
4096
|
+
y("button", {
|
|
3970
4097
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
3971
|
-
onClick:
|
|
4098
|
+
onClick: Z,
|
|
3972
4099
|
disabled: !a.value,
|
|
3973
4100
|
title: "Format XML"
|
|
3974
|
-
}, " ✨ Format ", 8,
|
|
4101
|
+
}, " ✨ Format ", 8, Tn)
|
|
3975
4102
|
]),
|
|
3976
|
-
|
|
3977
|
-
a.value ? (
|
|
4103
|
+
y("div", Pn, [
|
|
4104
|
+
a.value ? (k(), A("span", $n, " ✅ Valid XML ")) : (k(), A("span", Sn, " ❌ Invalid XML "))
|
|
3978
4105
|
])
|
|
3979
|
-
])) :
|
|
3980
|
-
|
|
3981
|
-
a.value ? (
|
|
3982
|
-
f.value ? (
|
|
4106
|
+
])) : H("", !0),
|
|
4107
|
+
y("div", Bn, [
|
|
4108
|
+
a.value ? (k(), A("div", Vn, [
|
|
4109
|
+
f.value ? (k(), A("div", {
|
|
3983
4110
|
key: 0,
|
|
3984
4111
|
class: "xml-declaration",
|
|
3985
|
-
style:
|
|
3986
|
-
},
|
|
3987
|
-
(
|
|
3988
|
-
key:
|
|
3989
|
-
node:
|
|
3990
|
-
index:
|
|
4112
|
+
style: N({ color: l.value.colors.xmlDeclaration })
|
|
4113
|
+
}, B(f.value), 5)) : H("", !0),
|
|
4114
|
+
(k(!0), A(re, null, ae(E.value, ($, R) => (k(), Fe(pr, {
|
|
4115
|
+
key: R,
|
|
4116
|
+
node: $,
|
|
4117
|
+
index: R,
|
|
3991
4118
|
level: 0,
|
|
3992
|
-
expanded:
|
|
4119
|
+
expanded: c.value,
|
|
3993
4120
|
theme: l.value,
|
|
3994
4121
|
onToggleExpand: w,
|
|
3995
|
-
onCopy:
|
|
4122
|
+
onCopy: p
|
|
3996
4123
|
}, null, 8, ["node", "index", "expanded", "theme"]))), 128))
|
|
3997
|
-
])) : (
|
|
3998
|
-
|
|
3999
|
-
|
|
4124
|
+
])) : (k(), A("div", In, [
|
|
4125
|
+
C[0] || (C[0] = y("h4", null, "XML Parse Error:", -1)),
|
|
4126
|
+
y("pre", null, B(i.value), 1)
|
|
4000
4127
|
]))
|
|
4001
4128
|
])
|
|
4002
4129
|
], 2));
|
|
4003
4130
|
}
|
|
4004
|
-
}),
|
|
4005
|
-
|
|
4131
|
+
}), Fn = /* @__PURE__ */ ye(Ln, [["__scopeId", "data-v-f9125514"]]), Rn = [zt], jn = (r) => {
|
|
4132
|
+
Rn.forEach((e) => {
|
|
4006
4133
|
const t = e.name || e.__name || "UnknownComponent";
|
|
4007
4134
|
r.component(t, e);
|
|
4008
4135
|
});
|
|
4009
|
-
},
|
|
4010
|
-
install:
|
|
4136
|
+
}, Xn = {
|
|
4137
|
+
install: jn
|
|
4011
4138
|
};
|
|
4012
4139
|
export {
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4140
|
+
zt as JsonFormat,
|
|
4141
|
+
Fn as XmlFormat,
|
|
4142
|
+
Xn as default
|
|
4016
4143
|
};
|