lone-format 0.5.1 → 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 +1200 -1192
- 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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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
|
-
const
|
|
372
|
-
for (; n.length > 2 &&
|
|
373
|
-
|
|
374
|
-
type:
|
|
371
|
+
const h = (f) => o.right_a && f.right_a ? s > f.prec : s <= f.prec;
|
|
372
|
+
for (; n.length > 2 && h(n[n.length - 2]); )
|
|
373
|
+
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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 d {
|
|
|
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(d, {
|
|
|
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,29 +768,29 @@ 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];
|
|
@@ -798,7 +798,7 @@ const ke = 43, at = 45, fe = {
|
|
|
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}`));
|
|
@@ -807,7 +807,7 @@ const ke = 43, at = 45, fe = {
|
|
|
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
|
});
|
|
@@ -822,11 +822,11 @@ const ke = 43, at = 45, fe = {
|
|
|
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
|
*/
|
|
@@ -993,16 +993,16 @@ function L(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,19 +1011,19 @@ L.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
1016
|
if (n = n || null, o = o || null, Array.isArray(r) && (r = L.toPathString(r)), !r && r !== "" || !e)
|
|
1017
1017
|
return;
|
|
1018
1018
|
const a = L.toPathArray(r);
|
|
1019
1019
|
a[0] === "$" && a.length > 1 && a.shift(), this._hasParentSelector = null;
|
|
1020
|
-
const l = this._trace(a, e, ["$"], n, o, t).filter(function(
|
|
1021
|
-
return
|
|
1020
|
+
const l = this._trace(a, e, ["$"], n, o, t).filter(function(h) {
|
|
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;
|
|
@@ -1050,7 +1050,7 @@ L.prototype._handleCallback = function(r, e, t) {
|
|
|
1050
1050
|
r.path = typeof r.path == "string" ? r.path : L.toPathString(r.path), e(s, t, r);
|
|
1051
1051
|
}
|
|
1052
1052
|
};
|
|
1053
|
-
L.prototype._trace = function(r, e, t, s, n, o, i,
|
|
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 = {
|
|
@@ -1060,93 +1060,93 @@ L.prototype._trace = function(r, e, t, s, n, o, i, u) {
|
|
|
1060
1060
|
parentProperty: n,
|
|
1061
1061
|
hasArrExpr: i
|
|
1062
1062
|
}, this._handleCallback(a, o, "value"), a;
|
|
1063
|
-
const l = r[0],
|
|
1064
|
-
function
|
|
1065
|
-
Array.isArray(
|
|
1066
|
-
|
|
1067
|
-
}) :
|
|
1063
|
+
const l = r[0], h = r.slice(1), f = [];
|
|
1064
|
+
function E(_) {
|
|
1065
|
+
Array.isArray(_) ? _.forEach((w) => {
|
|
1066
|
+
f.push(w);
|
|
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 === "^")
|
|
1081
1081
|
return this._hasParentSelector = !0, {
|
|
1082
1082
|
path: t.slice(0, -1),
|
|
1083
|
-
expr:
|
|
1083
|
+
expr: h,
|
|
1084
1084
|
isParentSelector: !0
|
|
1085
1085
|
};
|
|
1086
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
|
-
|
|
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
|
|
1113
|
-
const
|
|
1114
|
-
switch (
|
|
1112
|
+
let _ = !1;
|
|
1113
|
+
const w = l.slice(1, -2);
|
|
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 ===
|
|
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 ===
|
|
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
|
-
throw new TypeError("Unknown value type " +
|
|
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,29 +1154,29 @@ L.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
|
|
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
|
|
1168
|
-
if (
|
|
1169
|
-
const
|
|
1170
|
-
if (Array.isArray(
|
|
1171
|
-
|
|
1172
|
-
const
|
|
1173
|
-
for (let S = 1; S <
|
|
1174
|
-
|
|
1166
|
+
for (let _ = 0; _ < f.length; _++) {
|
|
1167
|
+
const w = f[_];
|
|
1168
|
+
if (w && w.isParentSelector) {
|
|
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
|
-
|
|
1176
|
+
f[_] = O;
|
|
1177
1177
|
}
|
|
1178
1178
|
}
|
|
1179
|
-
return
|
|
1179
|
+
return f;
|
|
1180
1180
|
};
|
|
1181
1181
|
L.prototype._walk = function(r, e) {
|
|
1182
1182
|
if (Array.isArray(r)) {
|
|
@@ -1190,39 +1190,39 @@ L.prototype._walk = function(r, e) {
|
|
|
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
|
|
1195
|
-
|
|
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
1206
|
i && (this.currSandbox._$_path = L.toPathString(s.concat([t])));
|
|
1207
|
-
const
|
|
1208
|
-
if (!L.cache[
|
|
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
|
-
L.cache[
|
|
1211
|
+
L.cache[c] = new this.safeVm.Script(a);
|
|
1212
1212
|
else if (this.currEval === "native")
|
|
1213
|
-
L.cache[
|
|
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
|
-
L.cache[
|
|
1216
|
+
L.cache[c] = new l(a);
|
|
1217
1217
|
} else if (typeof this.currEval == "function")
|
|
1218
|
-
L.cache[
|
|
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 L.cache[
|
|
1225
|
+
return L.cache[c].runInNewContext(this.currSandbox);
|
|
1226
1226
|
} catch (a) {
|
|
1227
1227
|
if (this.ignoreEvalErrors)
|
|
1228
1228
|
return !1;
|
|
@@ -1263,16 +1263,16 @@ L.toPathArray = function(r) {
|
|
|
1263
1263
|
return e[r] = n, e[r].concat();
|
|
1264
1264
|
};
|
|
1265
1265
|
L.prototype.safeVm = {
|
|
1266
|
-
Script:
|
|
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,44 +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
|
-
t = n.reduce((l,
|
|
1293
|
-
let
|
|
1294
|
-
return /function/u.test(
|
|
1292
|
+
t = n.reduce((l, h) => {
|
|
1293
|
+
let f = e[h].toString();
|
|
1294
|
+
return /function/u.test(f) || (f = "function " + f), "var " + h + "=" + f + ";" + l;
|
|
1295
1295
|
}, "") + t, !/(['"])use strict\1/u.test(t) && !s.includes("arguments") && (t = "var arguments = undefined;" + t), t = t.replace(/;\s*$/u, "");
|
|
1296
|
-
const
|
|
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
1300
|
L.prototype.vm = {
|
|
1301
|
-
Script:
|
|
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:
|
|
1309
|
+
}, mt = ["title"], bt = ["title"], yt = {
|
|
1310
|
+
key: 4,
|
|
1311
1311
|
class: "json-node__comma"
|
|
1312
|
-
},
|
|
1312
|
+
}, vt = {
|
|
1313
1313
|
key: 0,
|
|
1314
1314
|
class: "json-node__children"
|
|
1315
|
-
},
|
|
1315
|
+
}, _t = { class: "json-node__children-content" }, Et = { class: "json-node__line json-node__closing-bracket" }, xt = { class: "json-node__bracket" }, kt = {
|
|
1316
1316
|
key: 0,
|
|
1317
1317
|
class: "json-node__comma"
|
|
1318
|
-
},
|
|
1318
|
+
}, Nt = {
|
|
1319
1319
|
key: 1,
|
|
1320
1320
|
class: "json-node__primitive"
|
|
1321
|
-
}, wt = {
|
|
1322
|
-
key:
|
|
1321
|
+
}, At = ["contenteditable", "onKeydown"], wt = {
|
|
1322
|
+
key: 1,
|
|
1323
1323
|
class: "json-node__colon"
|
|
1324
|
-
}, Ct = ["title"], Ot = {
|
|
1324
|
+
}, Ct = ["title"], Ot = ["contenteditable", "onKeydown"], Tt = {
|
|
1325
1325
|
key: 0,
|
|
1326
1326
|
class: "json-node__comma"
|
|
1327
|
-
},
|
|
1327
|
+
}, Pt = /* @__PURE__ */ be({
|
|
1328
1328
|
name: "JsonNode",
|
|
1329
1329
|
__name: "JsonNode",
|
|
1330
1330
|
props: {
|
|
@@ -1338,202 +1338,202 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1338
1338
|
},
|
|
1339
1339
|
emits: ["update:value", "toggle-expand", "copy", "update:key"],
|
|
1340
1340
|
setup(r, { emit: e }) {
|
|
1341
|
-
|
|
1342
|
-
"
|
|
1343
|
-
"
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
"
|
|
1347
|
-
"
|
|
1348
|
-
|
|
1349
|
-
"
|
|
1350
|
-
"
|
|
1351
|
-
|
|
1352
|
-
"
|
|
1353
|
-
"
|
|
1354
|
-
"
|
|
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
|
|
1355
1356
|
}));
|
|
1356
|
-
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(() => {
|
|
1357
1358
|
if (!t.value) return "";
|
|
1358
|
-
const
|
|
1359
|
-
return
|
|
1360
|
-
}),
|
|
1361
|
-
const
|
|
1362
|
-
return t.value === null ? "json-node__value--null" :
|
|
1363
|
-
}),
|
|
1364
|
-
const
|
|
1365
|
-
return
|
|
1366
|
-
},
|
|
1367
|
-
s("toggle-expand",
|
|
1368
|
-
},
|
|
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 = () => {
|
|
1369
1370
|
t.level !== 0 && (n.value = !0, i.value = t.keyName, he(() => {
|
|
1370
|
-
|
|
1371
|
-
|
|
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
|
+
}
|
|
1372
1378
|
}));
|
|
1373
|
-
},
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
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
|
+
}
|
|
1377
1388
|
}));
|
|
1378
|
-
},
|
|
1389
|
+
}, J = () => {
|
|
1379
1390
|
if (t.level === 0 || !n.value) return;
|
|
1380
|
-
const
|
|
1381
|
-
if (!
|
|
1382
|
-
|
|
1391
|
+
const d = l.value?.innerText.trim() || "";
|
|
1392
|
+
if (!d) {
|
|
1393
|
+
b();
|
|
1383
1394
|
return;
|
|
1384
1395
|
}
|
|
1385
|
-
if (
|
|
1396
|
+
if (d === t.keyName) {
|
|
1386
1397
|
n.value = !1;
|
|
1387
1398
|
return;
|
|
1388
1399
|
}
|
|
1389
|
-
n.value = !1, s("update:key",
|
|
1390
|
-
},
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
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 = () => {
|
|
1412
1424
|
n.value = !1, i.value = t.keyName;
|
|
1413
|
-
},
|
|
1414
|
-
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);
|
|
1415
1427
|
};
|
|
1416
|
-
return (
|
|
1417
|
-
const
|
|
1418
|
-
return
|
|
1419
|
-
|
|
1420
|
-
y("div",
|
|
1421
|
-
|
|
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", {
|
|
1422
1434
|
key: 0,
|
|
1423
1435
|
class: "json-node__key",
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
"onUpdate:modelValue": f[0] || (f[0] = (E) => i.value = E),
|
|
1430
|
-
onKeyup: [
|
|
1431
|
-
de(K, ["enter"]),
|
|
1432
|
-
de(te, ["escape"])
|
|
1436
|
+
contenteditable: n.value,
|
|
1437
|
+
onDblclick: q,
|
|
1438
|
+
onKeydown: [
|
|
1439
|
+
de(Ee(J, ["prevent"]), ["enter"]),
|
|
1440
|
+
de(b, ["escape"])
|
|
1433
1441
|
],
|
|
1434
|
-
onBlur:
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
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),
|
|
1440
1448
|
y("span", {
|
|
1441
1449
|
class: "json-node__bracket json-node__bracket--clickable",
|
|
1442
|
-
onClick:
|
|
1443
|
-
title:
|
|
1444
|
-
}, B(
|
|
1445
|
-
|
|
1446
|
-
key:
|
|
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,
|
|
1447
1455
|
class: "json-node__collapsed-info",
|
|
1448
|
-
onClick:
|
|
1449
|
-
title: `Click to expand ${
|
|
1450
|
-
}, B(
|
|
1451
|
-
|
|
1452
|
-
key:
|
|
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,
|
|
1453
1461
|
class: "json-node__bracket json-node__bracket--clickable",
|
|
1454
|
-
onClick:
|
|
1462
|
+
onClick: Y,
|
|
1455
1463
|
title: "Click to expand"
|
|
1456
|
-
}, B(
|
|
1457
|
-
!
|
|
1464
|
+
}, B(Z.value), 1)),
|
|
1465
|
+
!x.value && !d.isLast ? (k(), A("span", yt, ",")) : H("", !0)
|
|
1458
1466
|
]),
|
|
1459
|
-
|
|
1460
|
-
y("div",
|
|
1461
|
-
(
|
|
1462
|
-
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,
|
|
1463
1471
|
class: "json-node__child"
|
|
1464
1472
|
}, [
|
|
1465
|
-
|
|
1466
|
-
value:
|
|
1467
|
-
"key-name":
|
|
1468
|
-
level:
|
|
1469
|
-
path:
|
|
1470
|
-
expanded:
|
|
1471
|
-
theme:
|
|
1472
|
-
"onUpdate:value":
|
|
1473
|
-
onToggleExpand:
|
|
1474
|
-
onCopy:
|
|
1475
|
-
"onUpdate:key":
|
|
1476
|
-
"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))
|
|
1477
1485
|
}, null, 8, ["value", "key-name", "level", "path", "expanded", "theme", "is-last"])
|
|
1478
1486
|
]))), 128))
|
|
1479
1487
|
]),
|
|
1480
|
-
y("div",
|
|
1481
|
-
y("span",
|
|
1482
|
-
|
|
1488
|
+
y("div", Et, [
|
|
1489
|
+
y("span", xt, B(Z.value), 1),
|
|
1490
|
+
d.isLast ? H("", !0) : (k(), A("span", kt, ","))
|
|
1483
1491
|
])
|
|
1484
|
-
])) :
|
|
1485
|
-
])) : (
|
|
1486
|
-
|
|
1492
|
+
])) : H("", !0)
|
|
1493
|
+
])) : (k(), A("div", Nt, [
|
|
1494
|
+
d.keyName ? (k(), A("span", {
|
|
1487
1495
|
key: 0,
|
|
1488
1496
|
class: "json-node__key",
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
"onUpdate:modelValue": f[5] || (f[5] = (E) => i.value = E),
|
|
1495
|
-
onKeyup: [
|
|
1496
|
-
de(K, ["enter"]),
|
|
1497
|
-
de(te, ["escape"])
|
|
1497
|
+
contenteditable: n.value,
|
|
1498
|
+
onDblclick: q,
|
|
1499
|
+
onKeydown: [
|
|
1500
|
+
de(Ee(J, ["prevent"]), ["enter"]),
|
|
1501
|
+
de(b, ["escape"])
|
|
1498
1502
|
],
|
|
1499
|
-
onBlur:
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
onDblclick: f[6] || (f[6] = (E) => c.$emit("copy", c.value)),
|
|
1510
|
-
title: m.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,
|
|
1512
|
+
title: $.value
|
|
1511
1513
|
}, [
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
[xe, u.value]
|
|
1526
|
-
]) : U("", !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)
|
|
1527
1527
|
]))
|
|
1528
1528
|
]);
|
|
1529
1529
|
};
|
|
1530
1530
|
}
|
|
1531
|
-
}),
|
|
1531
|
+
}), ye = (r, e) => {
|
|
1532
1532
|
const t = r.__vccOpts || r;
|
|
1533
1533
|
for (const [s, n] of e)
|
|
1534
1534
|
t[s] = n;
|
|
1535
1535
|
return t;
|
|
1536
|
-
},
|
|
1536
|
+
}, $t = /* @__PURE__ */ ye(Pt, [["__scopeId", "data-v-1472a8af"]]), Xe = {
|
|
1537
1537
|
name: "github-light",
|
|
1538
1538
|
colors: {
|
|
1539
1539
|
// 背景色
|
|
@@ -1565,6 +1565,8 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1565
1565
|
syntaxBracket: "#24292f",
|
|
1566
1566
|
// 悬停效果
|
|
1567
1567
|
hoverBackground: "#f6f8fa",
|
|
1568
|
+
// 选中背景色
|
|
1569
|
+
selectionBackground: "rgba(9, 105, 218, 0.2)",
|
|
1568
1570
|
// 折叠信息样式
|
|
1569
1571
|
collapsedBackground: "#ddf4ff",
|
|
1570
1572
|
collapsedBackgroundHover: "#b6e3ff",
|
|
@@ -1572,7 +1574,7 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1572
1574
|
// 缩进线
|
|
1573
1575
|
indentLine: "#d0d7de"
|
|
1574
1576
|
}
|
|
1575
|
-
},
|
|
1577
|
+
}, St = {
|
|
1576
1578
|
name: "github-dark",
|
|
1577
1579
|
colors: {
|
|
1578
1580
|
// 背景色
|
|
@@ -1604,6 +1606,8 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1604
1606
|
syntaxBracket: "#e6edf3",
|
|
1605
1607
|
// 悬停效果
|
|
1606
1608
|
hoverBackground: "#161b22",
|
|
1609
|
+
// 选中背景色
|
|
1610
|
+
selectionBackground: "rgba(121, 192, 255, 0.2)",
|
|
1607
1611
|
// 折叠信息样式
|
|
1608
1612
|
collapsedBackground: "#1c2128",
|
|
1609
1613
|
collapsedBackgroundHover: "#2d333b",
|
|
@@ -1611,7 +1615,7 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1611
1615
|
// 缩进线
|
|
1612
1616
|
indentLine: "#30363d"
|
|
1613
1617
|
}
|
|
1614
|
-
},
|
|
1618
|
+
}, Bt = {
|
|
1615
1619
|
name: "min-light",
|
|
1616
1620
|
colors: {
|
|
1617
1621
|
// 背景色 - 纯白简洁
|
|
@@ -1643,6 +1647,8 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1643
1647
|
syntaxBracket: "#374151",
|
|
1644
1648
|
// 悬停效果
|
|
1645
1649
|
hoverBackground: "#f9f9f9",
|
|
1650
|
+
// 选中背景色
|
|
1651
|
+
selectionBackground: "rgba(59, 130, 246, 0.2)",
|
|
1646
1652
|
// 折叠信息样式
|
|
1647
1653
|
collapsedBackground: "#e0f2fe",
|
|
1648
1654
|
collapsedBackgroundHover: "#bae6fd",
|
|
@@ -1650,7 +1656,7 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1650
1656
|
// 缩进线
|
|
1651
1657
|
indentLine: "#e5e7eb"
|
|
1652
1658
|
}
|
|
1653
|
-
},
|
|
1659
|
+
}, It = {
|
|
1654
1660
|
name: "slack-ochin",
|
|
1655
1661
|
colors: {
|
|
1656
1662
|
// 背景色 - 温暖的米色调
|
|
@@ -1682,6 +1688,8 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1682
1688
|
syntaxBracket: "#6b5444",
|
|
1683
1689
|
// 悬停效果
|
|
1684
1690
|
hoverBackground: "#f8f2eb",
|
|
1691
|
+
// 选中背景色
|
|
1692
|
+
selectionBackground: "rgba(255, 107, 53, 0.2)",
|
|
1685
1693
|
// 折叠信息样式
|
|
1686
1694
|
collapsedBackground: "#ffe8d6",
|
|
1687
1695
|
collapsedBackgroundHover: "#ffd4b0",
|
|
@@ -1689,34 +1697,34 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1689
1697
|
// 缩进线
|
|
1690
1698
|
indentLine: "#e8d5b7"
|
|
1691
1699
|
}
|
|
1692
|
-
},
|
|
1693
|
-
"github-light":
|
|
1694
|
-
"github-dark":
|
|
1695
|
-
"min-light":
|
|
1696
|
-
"slack-ochin":
|
|
1700
|
+
}, Vt = {
|
|
1701
|
+
"github-light": Xe,
|
|
1702
|
+
"github-dark": St,
|
|
1703
|
+
"min-light": Bt,
|
|
1704
|
+
"slack-ochin": It
|
|
1697
1705
|
};
|
|
1698
|
-
function
|
|
1699
|
-
return
|
|
1706
|
+
function Lt(r = "github-light") {
|
|
1707
|
+
return Vt[r] || Xe;
|
|
1700
1708
|
}
|
|
1701
|
-
const
|
|
1709
|
+
const Rt = {
|
|
1702
1710
|
key: 0,
|
|
1703
1711
|
class: "json-format__toolbar"
|
|
1704
|
-
}, jt = { class: "json-format__actions" },
|
|
1712
|
+
}, jt = { class: "json-format__actions" }, Mt = ["disabled"], Ut = ["disabled"], Ft = ["disabled"], Xt = ["disabled"], Ht = { class: "json-format__info" }, Kt = {
|
|
1705
1713
|
key: 0,
|
|
1706
1714
|
class: "json-format__status json-format__status--success"
|
|
1707
|
-
},
|
|
1715
|
+
}, qt = {
|
|
1708
1716
|
key: 1,
|
|
1709
1717
|
class: "json-format__status json-format__status--error"
|
|
1710
|
-
},
|
|
1718
|
+
}, Qt = { class: "json-format__content" }, Wt = {
|
|
1711
1719
|
key: 0,
|
|
1712
1720
|
class: "json-format__error"
|
|
1713
|
-
},
|
|
1721
|
+
}, Yt = {
|
|
1714
1722
|
key: 1,
|
|
1715
1723
|
class: "json-format__error"
|
|
1716
|
-
},
|
|
1724
|
+
}, Gt = {
|
|
1717
1725
|
key: 2,
|
|
1718
1726
|
class: "json-format__viewer"
|
|
1719
|
-
},
|
|
1727
|
+
}, Zt = /* @__PURE__ */ be({
|
|
1720
1728
|
name: "JsonFormat",
|
|
1721
1729
|
__name: "index",
|
|
1722
1730
|
props: {
|
|
@@ -1728,70 +1736,70 @@ const Lt = {
|
|
|
1728
1736
|
},
|
|
1729
1737
|
emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress"],
|
|
1730
1738
|
setup(r, { expose: e, emit: t }) {
|
|
1731
|
-
|
|
1732
|
-
"325d5f6b":
|
|
1733
|
-
"407388ed":
|
|
1734
|
-
"1276f42c":
|
|
1735
|
-
"34805dc8":
|
|
1736
|
-
"212f19fd":
|
|
1737
|
-
b83cab02:
|
|
1738
|
-
b58ba984:
|
|
1739
|
-
d50a3406:
|
|
1740
|
-
"2421bb5e":
|
|
1741
|
-
"0299816b":
|
|
1742
|
-
"55f370f2":
|
|
1743
|
-
b3fc86b8:
|
|
1744
|
-
"781064f7":
|
|
1745
|
-
"3b9a02e9":
|
|
1739
|
+
Ce((b) => ({
|
|
1740
|
+
"325d5f6b": f.value.colors.border,
|
|
1741
|
+
"407388ed": f.value.colors.background,
|
|
1742
|
+
"1276f42c": f.value.colors.text,
|
|
1743
|
+
"34805dc8": f.value.colors.surfaceBackground,
|
|
1744
|
+
"212f19fd": f.value.colors.buttonBorder,
|
|
1745
|
+
b83cab02: f.value.colors.buttonBackground,
|
|
1746
|
+
b58ba984: f.value.colors.buttonText,
|
|
1747
|
+
d50a3406: f.value.colors.buttonBackgroundHover,
|
|
1748
|
+
"2421bb5e": f.value.colors.buttonPrimary,
|
|
1749
|
+
"0299816b": f.value.colors.buttonPrimaryHover,
|
|
1750
|
+
"55f370f2": f.value.colors.successBackground,
|
|
1751
|
+
b3fc86b8: f.value.colors.success,
|
|
1752
|
+
"781064f7": f.value.colors.errorBackground,
|
|
1753
|
+
"3b9a02e9": f.value.colors.error
|
|
1746
1754
|
}));
|
|
1747
|
-
const s = r, n = t, o =
|
|
1748
|
-
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()) {
|
|
1749
1757
|
o.value = null, i.value = "", a.value = null, l.value = "";
|
|
1750
1758
|
return;
|
|
1751
1759
|
}
|
|
1752
1760
|
try {
|
|
1753
|
-
let
|
|
1754
|
-
const
|
|
1755
|
-
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)
|
|
1756
1764
|
try {
|
|
1757
|
-
o.value = JSON.parse(
|
|
1758
|
-
|
|
1765
|
+
o.value = JSON.parse(v), i.value = "", a.value = null, l.value = "", he(() => {
|
|
1766
|
+
E.value !== null && p();
|
|
1759
1767
|
});
|
|
1760
1768
|
return;
|
|
1761
1769
|
} catch {
|
|
1762
1770
|
}
|
|
1763
|
-
|
|
1764
|
-
let I = "",
|
|
1765
|
-
for (; D <
|
|
1766
|
-
const
|
|
1767
|
-
if (
|
|
1768
|
-
|
|
1769
|
-
else if (
|
|
1770
|
-
|
|
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++;
|
|
1771
1779
|
else {
|
|
1772
|
-
const
|
|
1773
|
-
let z =
|
|
1780
|
+
const Pe = P.slice(D);
|
|
1781
|
+
let z = Pe.match(/^([:,\[\s]*)(-?\d{16,})(\s*[,\}\]\s]|$)/);
|
|
1774
1782
|
if (z) {
|
|
1775
1783
|
I += z[1] + '{"__protected_number__":"' + z[2] + '"}' + z[3], D += z[0].length;
|
|
1776
1784
|
continue;
|
|
1777
1785
|
}
|
|
1778
|
-
if (z =
|
|
1786
|
+
if (z = Pe.match(/^([:,\[\s]*)(-?\d+\.\d*0+)(\s*[,\}\]\s]|$)/), z) {
|
|
1779
1787
|
I += z[1] + '{"__protected_number__":"' + z[2] + '"}' + z[3], D += z[0].length;
|
|
1780
1788
|
continue;
|
|
1781
1789
|
}
|
|
1782
|
-
I +=
|
|
1790
|
+
I += ue, D++;
|
|
1783
1791
|
}
|
|
1784
1792
|
}
|
|
1785
1793
|
return I;
|
|
1786
|
-
})(
|
|
1787
|
-
|
|
1794
|
+
})(v), o.value = JSON.parse(v), i.value = "", a.value = null, l.value = "", he(() => {
|
|
1795
|
+
E.value !== null && p();
|
|
1788
1796
|
});
|
|
1789
|
-
} catch (
|
|
1790
|
-
i.value =
|
|
1797
|
+
} catch (v) {
|
|
1798
|
+
i.value = v instanceof Error ? v.message : "Unknown parsing error", o.value = null, a.value = null, l.value = "";
|
|
1791
1799
|
}
|
|
1792
|
-
},
|
|
1793
|
-
if (!
|
|
1794
|
-
|
|
1800
|
+
}, w = (b) => {
|
|
1801
|
+
if (!b || !b.expression.trim()) {
|
|
1802
|
+
O();
|
|
1795
1803
|
return;
|
|
1796
1804
|
}
|
|
1797
1805
|
if (!o.value) {
|
|
@@ -1799,275 +1807,275 @@ const Lt = {
|
|
|
1799
1807
|
return;
|
|
1800
1808
|
}
|
|
1801
1809
|
try {
|
|
1802
|
-
let
|
|
1803
|
-
if (
|
|
1804
|
-
|
|
1805
|
-
else if (
|
|
1806
|
-
|
|
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", `
|
|
1807
1815
|
try {
|
|
1808
|
-
return ${
|
|
1816
|
+
return ${b.expression};
|
|
1809
1817
|
} catch (error) {
|
|
1810
1818
|
throw new Error('JavaScript expression error: ' + error.message);
|
|
1811
1819
|
}
|
|
1812
|
-
`)(o.value), a.value =
|
|
1820
|
+
`)(o.value), a.value = v;
|
|
1813
1821
|
else
|
|
1814
|
-
throw new Error(`Unsupported filter type: ${
|
|
1822
|
+
throw new Error(`Unsupported filter type: ${b.type}`);
|
|
1815
1823
|
l.value = "", he(() => {
|
|
1816
|
-
|
|
1824
|
+
p();
|
|
1817
1825
|
});
|
|
1818
|
-
} catch (
|
|
1819
|
-
l.value =
|
|
1826
|
+
} catch (v) {
|
|
1827
|
+
l.value = v instanceof Error ? v.message : "Filter execution error", a.value = null;
|
|
1820
1828
|
}
|
|
1821
|
-
},
|
|
1829
|
+
}, O = () => {
|
|
1822
1830
|
a.value = null, l.value = "";
|
|
1823
1831
|
};
|
|
1824
|
-
|
|
1825
|
-
b
|
|
1832
|
+
Ue(() => s.modelValue, (b) => {
|
|
1833
|
+
_(b);
|
|
1826
1834
|
}, { immediate: !0 });
|
|
1827
|
-
const
|
|
1828
|
-
const
|
|
1835
|
+
const x = (b, v, d) => {
|
|
1836
|
+
const m = (I) => {
|
|
1829
1837
|
if (I === null || typeof I != "object")
|
|
1830
1838
|
return I;
|
|
1831
1839
|
if (!Array.isArray(I) && "__protected_number__" in I && Object.keys(I).length === 1)
|
|
1832
1840
|
return `__PROTECTED_NUMBER_${I.__protected_number__}_PROTECTED_NUMBER__`;
|
|
1833
1841
|
if (Array.isArray(I))
|
|
1834
|
-
return I.map((
|
|
1835
|
-
const
|
|
1836
|
-
for (const [
|
|
1837
|
-
|
|
1838
|
-
return
|
|
1839
|
-
}, T =
|
|
1840
|
-
return JSON.stringify(T,
|
|
1841
|
-
}, S = (
|
|
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) => {
|
|
1842
1850
|
if (!s.readonly)
|
|
1843
1851
|
try {
|
|
1844
|
-
const
|
|
1845
|
-
n("update:modelValue",
|
|
1846
|
-
} catch (
|
|
1847
|
-
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);
|
|
1848
1856
|
}
|
|
1849
|
-
},
|
|
1850
|
-
if (!
|
|
1851
|
-
const
|
|
1852
|
-
let
|
|
1853
|
-
for (let
|
|
1854
|
-
const
|
|
1855
|
-
|
|
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]);
|
|
1856
1864
|
}
|
|
1857
|
-
const I =
|
|
1858
|
-
return I === "root" ?
|
|
1859
|
-
}, Z = (
|
|
1860
|
-
|
|
1861
|
-
},
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1864
|
-
const I =
|
|
1865
|
-
|
|
1866
|
-
}) : Object.keys(
|
|
1867
|
-
const
|
|
1868
|
-
|
|
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);
|
|
1869
1877
|
}));
|
|
1870
1878
|
};
|
|
1871
|
-
|
|
1872
|
-
},
|
|
1873
|
-
|
|
1874
|
-
},
|
|
1875
|
-
if (
|
|
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 () => {
|
|
1883
|
+
if (h.value)
|
|
1876
1884
|
try {
|
|
1877
|
-
const
|
|
1878
|
-
await navigator.clipboard.writeText(
|
|
1879
|
-
} catch (
|
|
1880
|
-
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"));
|
|
1881
1889
|
}
|
|
1882
1890
|
}, $ = () => {
|
|
1883
|
-
if (
|
|
1891
|
+
if (h.value)
|
|
1884
1892
|
try {
|
|
1885
|
-
const
|
|
1886
|
-
n("update:modelValue",
|
|
1887
|
-
} catch (
|
|
1888
|
-
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);
|
|
1889
1897
|
}
|
|
1890
|
-
},
|
|
1898
|
+
}, R = async (b) => {
|
|
1891
1899
|
try {
|
|
1892
|
-
let
|
|
1893
|
-
typeof
|
|
1894
|
-
} catch (
|
|
1895
|
-
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);
|
|
1896
1904
|
}
|
|
1897
|
-
},
|
|
1905
|
+
}, K = (b, v) => {
|
|
1898
1906
|
if (!s.readonly)
|
|
1899
1907
|
try {
|
|
1900
|
-
const
|
|
1901
|
-
n("update:modelValue",
|
|
1902
|
-
} catch (
|
|
1903
|
-
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);
|
|
1904
1912
|
}
|
|
1905
|
-
},
|
|
1906
|
-
if (!
|
|
1907
|
-
const
|
|
1908
|
-
if (
|
|
1909
|
-
const
|
|
1910
|
-
return T && typeof T == "object" && !Array.isArray(T) ?
|
|
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;
|
|
1911
1919
|
}
|
|
1912
|
-
let
|
|
1913
|
-
for (let
|
|
1914
|
-
const
|
|
1915
|
-
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];
|
|
1916
1924
|
}
|
|
1917
|
-
const I =
|
|
1918
|
-
if (!Array.isArray(
|
|
1919
|
-
const
|
|
1920
|
-
|
|
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);
|
|
1921
1929
|
}
|
|
1922
1930
|
return T;
|
|
1923
|
-
},
|
|
1924
|
-
if (
|
|
1925
|
-
if (Array.isArray(
|
|
1926
|
-
const
|
|
1927
|
-
return
|
|
1928
|
-
} else if (
|
|
1929
|
-
const
|
|
1930
|
-
return
|
|
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;
|
|
1931
1939
|
}
|
|
1932
|
-
return
|
|
1933
|
-
},
|
|
1934
|
-
if (!
|
|
1935
|
-
return
|
|
1936
|
-
const
|
|
1937
|
-
for (const
|
|
1938
|
-
|
|
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];
|
|
1939
1947
|
return T;
|
|
1940
|
-
},
|
|
1941
|
-
let
|
|
1942
|
-
for (let
|
|
1943
|
-
const I =
|
|
1944
|
-
Array.isArray(
|
|
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];
|
|
1945
1953
|
}
|
|
1946
|
-
const T =
|
|
1947
|
-
Array.isArray(
|
|
1948
|
-
},
|
|
1949
|
-
const
|
|
1950
|
-
|
|
1951
|
-
if (
|
|
1952
|
-
const T =
|
|
1953
|
-
T[T.length - 1] =
|
|
1954
|
-
} else if (
|
|
1955
|
-
const T =
|
|
1956
|
-
T[T.length - 1] =
|
|
1957
|
-
const
|
|
1958
|
-
|
|
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);
|
|
1959
1967
|
} else
|
|
1960
|
-
|
|
1961
|
-
}),
|
|
1968
|
+
d.add(m);
|
|
1969
|
+
}), c.value = d;
|
|
1962
1970
|
};
|
|
1963
1971
|
return e({
|
|
1964
1972
|
// 核心操作方法
|
|
1965
|
-
copyJson:
|
|
1973
|
+
copyJson: C,
|
|
1966
1974
|
compressSource: $,
|
|
1967
|
-
expandAll:
|
|
1968
|
-
collapseAll:
|
|
1975
|
+
expandAll: p,
|
|
1976
|
+
collapseAll: g,
|
|
1969
1977
|
toggleExpand: Z,
|
|
1970
1978
|
updateValue: S,
|
|
1971
|
-
updateKey:
|
|
1979
|
+
updateKey: K,
|
|
1972
1980
|
// Filter 相关方法
|
|
1973
|
-
filter:
|
|
1974
|
-
clearFilter:
|
|
1981
|
+
filter: w,
|
|
1982
|
+
clearFilter: O,
|
|
1975
1983
|
// 状态访问方法
|
|
1976
|
-
isValidJson: () =>
|
|
1984
|
+
isValidJson: () => h.value,
|
|
1977
1985
|
getParsedJson: () => o.value,
|
|
1978
1986
|
getFilteredJson: () => a.value,
|
|
1979
|
-
getExpandedNodes: () =>
|
|
1987
|
+
getExpandedNodes: () => c.value,
|
|
1980
1988
|
getParseError: () => i.value,
|
|
1981
1989
|
getFilterError: () => l.value,
|
|
1982
1990
|
// 工具方法
|
|
1983
|
-
parseJson: (
|
|
1984
|
-
copyValue: (
|
|
1985
|
-
}), (
|
|
1986
|
-
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}`])
|
|
1987
1995
|
}, [
|
|
1988
|
-
|
|
1996
|
+
b.showToolbar ? (k(), A("div", Rt, [
|
|
1989
1997
|
y("div", jt, [
|
|
1990
1998
|
y("button", {
|
|
1991
1999
|
class: "json-format__btn json-format__btn--primary",
|
|
1992
|
-
onClick:
|
|
1993
|
-
disabled: !
|
|
2000
|
+
onClick: C,
|
|
2001
|
+
disabled: !h.value,
|
|
1994
2002
|
title: "Copy JSON"
|
|
1995
|
-
}, " 📋 Copy ", 8,
|
|
2003
|
+
}, " 📋 Copy ", 8, Mt),
|
|
1996
2004
|
y("button", {
|
|
1997
2005
|
class: "json-format__btn json-format__btn--secondary",
|
|
1998
|
-
onClick:
|
|
1999
|
-
disabled: !
|
|
2006
|
+
onClick: p,
|
|
2007
|
+
disabled: !h.value,
|
|
2000
2008
|
title: "Expand All"
|
|
2001
|
-
}, " ⬇️ Expand All ", 8,
|
|
2009
|
+
}, " ⬇️ Expand All ", 8, Ut),
|
|
2002
2010
|
y("button", {
|
|
2003
2011
|
class: "json-format__btn json-format__btn--secondary",
|
|
2004
|
-
onClick:
|
|
2005
|
-
disabled: !
|
|
2012
|
+
onClick: g,
|
|
2013
|
+
disabled: !h.value,
|
|
2006
2014
|
title: "Collapse All"
|
|
2007
|
-
}, " ➡️ Collapse All ", 8,
|
|
2015
|
+
}, " ➡️ Collapse All ", 8, Ft),
|
|
2008
2016
|
y("button", {
|
|
2009
2017
|
class: "json-format__btn json-format__btn--secondary",
|
|
2010
2018
|
onClick: $,
|
|
2011
|
-
disabled: !
|
|
2019
|
+
disabled: !h.value,
|
|
2012
2020
|
title: "Compress JSON"
|
|
2013
|
-
}, " 📦 Compress ", 8,
|
|
2021
|
+
}, " 📦 Compress ", 8, Xt)
|
|
2014
2022
|
]),
|
|
2015
|
-
y("div",
|
|
2016
|
-
|
|
2023
|
+
y("div", Ht, [
|
|
2024
|
+
h.value ? (k(), A("span", Kt, " ✅ Valid JSON ")) : (k(), A("span", qt, " ❌ Invalid JSON "))
|
|
2017
2025
|
])
|
|
2018
|
-
])) :
|
|
2019
|
-
y("div",
|
|
2020
|
-
|
|
2021
|
-
|
|
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)),
|
|
2022
2030
|
y("pre", null, B(l.value), 1)
|
|
2023
|
-
])) : (
|
|
2024
|
-
|
|
2025
|
-
value:
|
|
2031
|
+
])) : (k(), A("div", Gt, [
|
|
2032
|
+
Me($t, {
|
|
2033
|
+
value: E.value,
|
|
2026
2034
|
"key-name": "",
|
|
2027
2035
|
level: 0,
|
|
2028
|
-
expanded:
|
|
2036
|
+
expanded: c.value,
|
|
2029
2037
|
"is-last": !0,
|
|
2030
|
-
theme:
|
|
2038
|
+
theme: f.value,
|
|
2031
2039
|
"onUpdate:value": S,
|
|
2032
2040
|
onToggleExpand: Z,
|
|
2033
|
-
onCopy:
|
|
2034
|
-
"onUpdate:key":
|
|
2041
|
+
onCopy: R,
|
|
2042
|
+
"onUpdate:key": K
|
|
2035
2043
|
}, null, 8, ["value", "expanded", "theme"])
|
|
2036
|
-
])) : (
|
|
2037
|
-
|
|
2044
|
+
])) : (k(), A("div", Wt, [
|
|
2045
|
+
v[0] || (v[0] = y("h4", null, "JSON Parse Error:", -1)),
|
|
2038
2046
|
y("pre", null, B(i.value), 1)
|
|
2039
2047
|
]))
|
|
2040
2048
|
])
|
|
2041
2049
|
], 2));
|
|
2042
2050
|
}
|
|
2043
|
-
}),
|
|
2051
|
+
}), zt = /* @__PURE__ */ ye(Zt, [["__scopeId", "data-v-b956002c"]]), Dt = {
|
|
2044
2052
|
key: 0,
|
|
2045
2053
|
class: "xml-node__comment"
|
|
2046
|
-
},
|
|
2054
|
+
}, Jt = {
|
|
2047
2055
|
key: 1,
|
|
2048
2056
|
class: "xml-node__cdata"
|
|
2049
|
-
},
|
|
2057
|
+
}, er = {
|
|
2050
2058
|
key: 2,
|
|
2051
2059
|
class: "xml-node__element"
|
|
2052
|
-
},
|
|
2060
|
+
}, tr = {
|
|
2053
2061
|
key: 0,
|
|
2054
2062
|
class: "xml-node__line"
|
|
2055
|
-
},
|
|
2063
|
+
}, rr = {
|
|
2056
2064
|
key: 1,
|
|
2057
2065
|
class: "xml-node__line"
|
|
2058
|
-
},
|
|
2066
|
+
}, nr = { key: 2 }, sr = {
|
|
2059
2067
|
key: 0,
|
|
2060
2068
|
class: "xml-node__line"
|
|
2061
|
-
},
|
|
2069
|
+
}, or = ["title"], ir = { class: "xml-node__line" }, ar = ["title"], lr = { key: 1 }, cr = ["title"], ur = {
|
|
2062
2070
|
key: 0,
|
|
2063
2071
|
class: "xml-node__children"
|
|
2064
|
-
},
|
|
2072
|
+
}, dr = {
|
|
2065
2073
|
key: 0,
|
|
2066
2074
|
class: "xml-node__text"
|
|
2067
|
-
},
|
|
2075
|
+
}, fr = {
|
|
2068
2076
|
key: 1,
|
|
2069
2077
|
class: "xml-node__line"
|
|
2070
|
-
},
|
|
2078
|
+
}, hr = /* @__PURE__ */ be({
|
|
2071
2079
|
__name: "XmlNode",
|
|
2072
2080
|
props: {
|
|
2073
2081
|
node: {},
|
|
@@ -2079,351 +2087,351 @@ const Lt = {
|
|
|
2079
2087
|
},
|
|
2080
2088
|
emits: ["toggle-expand", "copy"],
|
|
2081
2089
|
setup(r, { emit: e }) {
|
|
2082
|
-
const t = r, s = e, n = V(() => Object.keys(t.node).find((
|
|
2083
|
-
const
|
|
2084
|
-
return Object.keys(
|
|
2085
|
-
|
|
2086
|
-
}),
|
|
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;
|
|
2087
2095
|
}), l = V(() => {
|
|
2088
|
-
if (
|
|
2089
|
-
const
|
|
2090
|
-
return Array.isArray(
|
|
2091
|
-
}),
|
|
2092
|
-
if (!
|
|
2093
|
-
const
|
|
2094
|
-
if (
|
|
2095
|
-
const
|
|
2096
|
-
if (
|
|
2097
|
-
return
|
|
2096
|
+
if (c.value !== "element" || !n.value) return [];
|
|
2097
|
+
const p = t.node[n.value];
|
|
2098
|
+
return Array.isArray(p) ? p : [];
|
|
2099
|
+
}), h = V(() => l.value.some((p) => p.__cdata)), f = V(() => {
|
|
2100
|
+
if (!h.value) return "";
|
|
2101
|
+
const p = l.value.find((g) => g.__cdata);
|
|
2102
|
+
if (p && Array.isArray(p.__cdata)) {
|
|
2103
|
+
const g = p.__cdata;
|
|
2104
|
+
if (g.length > 0 && g[0]["#text"])
|
|
2105
|
+
return g[0]["#text"];
|
|
2098
2106
|
}
|
|
2099
2107
|
return "";
|
|
2100
|
-
}),
|
|
2101
|
-
if (
|
|
2102
|
-
const
|
|
2103
|
-
if (!Array.isArray(
|
|
2104
|
-
const
|
|
2105
|
-
return
|
|
2106
|
-
}),
|
|
2107
|
-
if (
|
|
2108
|
-
const
|
|
2109
|
-
return Array.isArray(
|
|
2110
|
-
}),
|
|
2111
|
-
|
|
2112
|
-
},
|
|
2113
|
-
return (
|
|
2114
|
-
const
|
|
2115
|
-
return
|
|
2108
|
+
}), E = V(() => {
|
|
2109
|
+
if (c.value !== "element" || !n.value || h.value) return "";
|
|
2110
|
+
const p = t.node[n.value];
|
|
2111
|
+
if (!Array.isArray(p)) return "";
|
|
2112
|
+
const g = p.find((C) => C["#text"]);
|
|
2113
|
+
return g ? g["#text"] : "";
|
|
2114
|
+
}), _ = V(() => {
|
|
2115
|
+
if (c.value !== "comment") return "";
|
|
2116
|
+
const p = t.node["#comment"];
|
|
2117
|
+
return Array.isArray(p) && p.length > 0 && p[0]["#text"] || "";
|
|
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 = () => {
|
|
2119
|
+
w.value && s("toggle-expand", o.value);
|
|
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", {
|
|
2116
2124
|
class: "xml-node",
|
|
2117
|
-
style: N({ paddingLeft:
|
|
2125
|
+
style: N({ paddingLeft: p.level > 0 ? "16px" : "0" })
|
|
2118
2126
|
}, [
|
|
2119
|
-
|
|
2127
|
+
c.value === "comment" ? (k(), A("div", Dt, [
|
|
2120
2128
|
y("span", {
|
|
2121
|
-
style: N({ color:
|
|
2122
|
-
}, " <!-- " + B(
|
|
2123
|
-
])) :
|
|
2129
|
+
style: N({ color: p.theme.colors.xmlComment })
|
|
2130
|
+
}, " <!-- " + B(_.value) + " --> ", 5)
|
|
2131
|
+
])) : c.value === "cdata" ? (k(), A("div", Jt, [
|
|
2124
2132
|
y("span", {
|
|
2125
|
-
style: N({ color:
|
|
2126
|
-
}, " <![CDATA[" + B(
|
|
2127
|
-
])) :
|
|
2128
|
-
|
|
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, [
|
|
2129
2137
|
y("span", {
|
|
2130
2138
|
class: "xml-node__bracket",
|
|
2131
|
-
style: N({ color:
|
|
2139
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2132
2140
|
}, "<", 4),
|
|
2133
2141
|
y("span", {
|
|
2134
2142
|
class: "xml-node__tag",
|
|
2135
|
-
style: N({ color:
|
|
2143
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2136
2144
|
}, B(n.value), 5),
|
|
2137
|
-
(
|
|
2138
|
-
key:
|
|
2145
|
+
(k(!0), A(re, null, ae(a.value, ($, R) => (k(), A("span", {
|
|
2146
|
+
key: R,
|
|
2139
2147
|
class: "xml-node__attribute"
|
|
2140
2148
|
}, [
|
|
2141
2149
|
y("span", {
|
|
2142
2150
|
class: "xml-node__attr-name",
|
|
2143
|
-
style: N({ color:
|
|
2144
|
-
}, B(
|
|
2151
|
+
style: N({ color: p.theme.colors.xmlAttribute })
|
|
2152
|
+
}, B(R), 5),
|
|
2145
2153
|
y("span", {
|
|
2146
2154
|
class: "xml-node__equals",
|
|
2147
|
-
style: N({ color:
|
|
2155
|
+
style: N({ color: p.theme.colors.xmlEquals })
|
|
2148
2156
|
}, "=", 4),
|
|
2149
2157
|
y("span", {
|
|
2150
2158
|
class: "xml-node__quote",
|
|
2151
|
-
style: N({ color:
|
|
2159
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2152
2160
|
}, '"', 4),
|
|
2153
2161
|
y("span", {
|
|
2154
2162
|
class: "xml-node__attr-value",
|
|
2155
|
-
style: N({ color:
|
|
2163
|
+
style: N({ color: p.theme.colors.xmlAttributeValue })
|
|
2156
2164
|
}, B($), 5),
|
|
2157
2165
|
y("span", {
|
|
2158
2166
|
class: "xml-node__quote",
|
|
2159
|
-
style: N({ color:
|
|
2167
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2160
2168
|
}, '"', 4)
|
|
2161
2169
|
]))), 128)),
|
|
2162
2170
|
y("span", {
|
|
2163
2171
|
class: "xml-node__bracket",
|
|
2164
|
-
style: N({ color:
|
|
2172
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2165
2173
|
}, ">", 4),
|
|
2166
2174
|
y("span", {
|
|
2167
2175
|
class: "xml-node__cdata",
|
|
2168
|
-
style: N({ color:
|
|
2169
|
-
}, "<![CDATA[" + B(
|
|
2176
|
+
style: N({ color: p.theme.colors.xmlCdata })
|
|
2177
|
+
}, "<![CDATA[" + B(f.value) + "]]>", 5),
|
|
2170
2178
|
y("span", {
|
|
2171
2179
|
class: "xml-node__bracket",
|
|
2172
|
-
style: N({ color:
|
|
2180
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2173
2181
|
}, "</", 4),
|
|
2174
2182
|
y("span", {
|
|
2175
2183
|
class: "xml-node__tag",
|
|
2176
|
-
style: N({ color:
|
|
2184
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2177
2185
|
}, B(n.value), 5),
|
|
2178
2186
|
y("span", {
|
|
2179
2187
|
class: "xml-node__bracket",
|
|
2180
|
-
style: N({ color:
|
|
2188
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2181
2189
|
}, ">", 4)
|
|
2182
|
-
])) :
|
|
2190
|
+
])) : x.value ? (k(), A("div", rr, [
|
|
2183
2191
|
y("span", {
|
|
2184
2192
|
class: "xml-node__bracket",
|
|
2185
|
-
style: N({ color:
|
|
2193
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2186
2194
|
}, "<", 4),
|
|
2187
2195
|
y("span", {
|
|
2188
2196
|
class: "xml-node__tag",
|
|
2189
|
-
style: N({ color:
|
|
2197
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2190
2198
|
}, B(n.value), 5),
|
|
2191
|
-
(
|
|
2192
|
-
key:
|
|
2199
|
+
(k(!0), A(re, null, ae(a.value, ($, R) => (k(), A("span", {
|
|
2200
|
+
key: R,
|
|
2193
2201
|
class: "xml-node__attribute"
|
|
2194
2202
|
}, [
|
|
2195
2203
|
y("span", {
|
|
2196
2204
|
class: "xml-node__attr-name",
|
|
2197
|
-
style: N({ color:
|
|
2198
|
-
}, B(
|
|
2205
|
+
style: N({ color: p.theme.colors.xmlAttribute })
|
|
2206
|
+
}, B(R), 5),
|
|
2199
2207
|
y("span", {
|
|
2200
2208
|
class: "xml-node__equals",
|
|
2201
|
-
style: N({ color:
|
|
2209
|
+
style: N({ color: p.theme.colors.xmlEquals })
|
|
2202
2210
|
}, "=", 4),
|
|
2203
2211
|
y("span", {
|
|
2204
2212
|
class: "xml-node__quote",
|
|
2205
|
-
style: N({ color:
|
|
2213
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2206
2214
|
}, '"', 4),
|
|
2207
2215
|
y("span", {
|
|
2208
2216
|
class: "xml-node__attr-value",
|
|
2209
|
-
style: N({ color:
|
|
2217
|
+
style: N({ color: p.theme.colors.xmlAttributeValue })
|
|
2210
2218
|
}, B($), 5),
|
|
2211
2219
|
y("span", {
|
|
2212
2220
|
class: "xml-node__quote",
|
|
2213
|
-
style: N({ color:
|
|
2221
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2214
2222
|
}, '"', 4)
|
|
2215
2223
|
]))), 128)),
|
|
2216
2224
|
y("span", {
|
|
2217
2225
|
class: "xml-node__bracket",
|
|
2218
|
-
style: N({ color:
|
|
2226
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2219
2227
|
}, ">", 4),
|
|
2220
2228
|
y("span", {
|
|
2221
2229
|
class: "xml-node__text-content",
|
|
2222
|
-
style: N({ color:
|
|
2223
|
-
}, B(
|
|
2230
|
+
style: N({ color: p.theme.colors.xmlText })
|
|
2231
|
+
}, B(E.value), 5),
|
|
2224
2232
|
y("span", {
|
|
2225
2233
|
class: "xml-node__bracket",
|
|
2226
|
-
style: N({ color:
|
|
2234
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2227
2235
|
}, "</", 4),
|
|
2228
2236
|
y("span", {
|
|
2229
2237
|
class: "xml-node__tag",
|
|
2230
|
-
style: N({ color:
|
|
2238
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2231
2239
|
}, B(n.value), 5),
|
|
2232
2240
|
y("span", {
|
|
2233
2241
|
class: "xml-node__bracket",
|
|
2234
|
-
style: N({ color:
|
|
2242
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2235
2243
|
}, ">", 4)
|
|
2236
|
-
])) : (
|
|
2237
|
-
!i.value &&
|
|
2244
|
+
])) : (k(), A("div", nr, [
|
|
2245
|
+
!i.value && w.value ? (k(), A("div", sr, [
|
|
2238
2246
|
y("span", {
|
|
2239
2247
|
class: "xml-node__clickable-part",
|
|
2240
|
-
onClick:
|
|
2248
|
+
onClick: g[0] || (g[0] = ($) => S()),
|
|
2241
2249
|
title: "Click to expand"
|
|
2242
2250
|
}, [
|
|
2243
2251
|
y("span", {
|
|
2244
2252
|
class: "xml-node__bracket",
|
|
2245
|
-
style: N({ color:
|
|
2253
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2246
2254
|
}, "<", 4),
|
|
2247
2255
|
y("span", {
|
|
2248
2256
|
class: "xml-node__tag",
|
|
2249
|
-
style: N({ color:
|
|
2257
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2250
2258
|
}, B(n.value), 5)
|
|
2251
2259
|
]),
|
|
2252
|
-
(
|
|
2253
|
-
key:
|
|
2260
|
+
(k(!0), A(re, null, ae(a.value, ($, R) => (k(), A("span", {
|
|
2261
|
+
key: R,
|
|
2254
2262
|
class: "xml-node__attribute"
|
|
2255
2263
|
}, [
|
|
2256
2264
|
y("span", {
|
|
2257
2265
|
class: "xml-node__attr-name",
|
|
2258
|
-
style: N({ color:
|
|
2259
|
-
}, B(
|
|
2266
|
+
style: N({ color: p.theme.colors.xmlAttribute })
|
|
2267
|
+
}, B(R), 5),
|
|
2260
2268
|
y("span", {
|
|
2261
2269
|
class: "xml-node__equals",
|
|
2262
|
-
style: N({ color:
|
|
2270
|
+
style: N({ color: p.theme.colors.xmlEquals })
|
|
2263
2271
|
}, "=", 4),
|
|
2264
2272
|
y("span", {
|
|
2265
2273
|
class: "xml-node__quote",
|
|
2266
|
-
style: N({ color:
|
|
2274
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2267
2275
|
}, '"', 4),
|
|
2268
2276
|
y("span", {
|
|
2269
2277
|
class: "xml-node__attr-value",
|
|
2270
|
-
style: N({ color:
|
|
2278
|
+
style: N({ color: p.theme.colors.xmlAttributeValue })
|
|
2271
2279
|
}, B($), 5),
|
|
2272
2280
|
y("span", {
|
|
2273
2281
|
class: "xml-node__quote",
|
|
2274
|
-
style: N({ color:
|
|
2282
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2275
2283
|
}, '"', 4)
|
|
2276
2284
|
]))), 128)),
|
|
2277
2285
|
y("span", {
|
|
2278
2286
|
class: "xml-node__clickable-part",
|
|
2279
|
-
onClick:
|
|
2287
|
+
onClick: g[1] || (g[1] = ($) => S()),
|
|
2280
2288
|
title: "Click to expand"
|
|
2281
2289
|
}, [
|
|
2282
2290
|
y("span", {
|
|
2283
2291
|
class: "xml-node__bracket",
|
|
2284
|
-
style: N({ color:
|
|
2292
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2285
2293
|
}, ">", 4)
|
|
2286
2294
|
]),
|
|
2287
2295
|
y("span", {
|
|
2288
2296
|
class: "xml-node__collapsed-badge",
|
|
2289
2297
|
style: N({
|
|
2290
|
-
backgroundColor:
|
|
2291
|
-
color:
|
|
2298
|
+
backgroundColor: p.theme.colors.collapsedBackground,
|
|
2299
|
+
color: p.theme.colors.collapsedText
|
|
2292
2300
|
}),
|
|
2293
|
-
onClick:
|
|
2294
|
-
title: `Click to expand ${
|
|
2295
|
-
}, B(
|
|
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),
|
|
2296
2304
|
y("span", {
|
|
2297
2305
|
class: "xml-node__clickable-part",
|
|
2298
|
-
onClick:
|
|
2306
|
+
onClick: g[3] || (g[3] = ($) => S()),
|
|
2299
2307
|
title: "Click to expand"
|
|
2300
2308
|
}, [
|
|
2301
2309
|
y("span", {
|
|
2302
2310
|
class: "xml-node__bracket",
|
|
2303
|
-
style: N({ color:
|
|
2311
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2304
2312
|
}, "</", 4),
|
|
2305
2313
|
y("span", {
|
|
2306
2314
|
class: "xml-node__tag",
|
|
2307
|
-
style: N({ color:
|
|
2315
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2308
2316
|
}, B(n.value), 5),
|
|
2309
2317
|
y("span", {
|
|
2310
2318
|
class: "xml-node__bracket",
|
|
2311
|
-
style: N({ color:
|
|
2319
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2312
2320
|
}, ">", 4)
|
|
2313
2321
|
])
|
|
2314
|
-
])) : (
|
|
2315
|
-
y("div",
|
|
2316
|
-
|
|
2322
|
+
])) : (k(), A(re, { key: 1 }, [
|
|
2323
|
+
y("div", ir, [
|
|
2324
|
+
w.value ? (k(), A("span", {
|
|
2317
2325
|
key: 0,
|
|
2318
2326
|
class: "xml-node__clickable-part",
|
|
2319
|
-
onClick:
|
|
2327
|
+
onClick: g[4] || (g[4] = ($) => S()),
|
|
2320
2328
|
title: i.value ? "Click to collapse" : "Click to expand"
|
|
2321
2329
|
}, [
|
|
2322
2330
|
y("span", {
|
|
2323
2331
|
class: "xml-node__bracket",
|
|
2324
|
-
style: N({ color:
|
|
2332
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2325
2333
|
}, "<", 4),
|
|
2326
2334
|
y("span", {
|
|
2327
2335
|
class: "xml-node__tag",
|
|
2328
|
-
style: N({ color:
|
|
2336
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2329
2337
|
}, B(n.value), 5)
|
|
2330
|
-
], 8,
|
|
2338
|
+
], 8, ar)) : (k(), A("span", lr, [
|
|
2331
2339
|
y("span", {
|
|
2332
2340
|
class: "xml-node__bracket",
|
|
2333
|
-
style: N({ color:
|
|
2341
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2334
2342
|
}, "<", 4),
|
|
2335
2343
|
y("span", {
|
|
2336
2344
|
class: "xml-node__tag",
|
|
2337
|
-
style: N({ color:
|
|
2345
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2338
2346
|
}, B(n.value), 5)
|
|
2339
2347
|
])),
|
|
2340
|
-
(
|
|
2341
|
-
key:
|
|
2348
|
+
(k(!0), A(re, null, ae(a.value, ($, R) => (k(), A("span", {
|
|
2349
|
+
key: R,
|
|
2342
2350
|
class: "xml-node__attribute"
|
|
2343
2351
|
}, [
|
|
2344
2352
|
y("span", {
|
|
2345
2353
|
class: "xml-node__attr-name",
|
|
2346
|
-
style: N({ color:
|
|
2347
|
-
}, B(
|
|
2354
|
+
style: N({ color: p.theme.colors.xmlAttribute })
|
|
2355
|
+
}, B(R), 5),
|
|
2348
2356
|
y("span", {
|
|
2349
2357
|
class: "xml-node__equals",
|
|
2350
|
-
style: N({ color:
|
|
2358
|
+
style: N({ color: p.theme.colors.xmlEquals })
|
|
2351
2359
|
}, "=", 4),
|
|
2352
2360
|
y("span", {
|
|
2353
2361
|
class: "xml-node__quote",
|
|
2354
|
-
style: N({ color:
|
|
2362
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2355
2363
|
}, '"', 4),
|
|
2356
2364
|
y("span", {
|
|
2357
2365
|
class: "xml-node__attr-value",
|
|
2358
|
-
style: N({ color:
|
|
2366
|
+
style: N({ color: p.theme.colors.xmlAttributeValue })
|
|
2359
2367
|
}, B($), 5),
|
|
2360
2368
|
y("span", {
|
|
2361
2369
|
class: "xml-node__quote",
|
|
2362
|
-
style: N({ color:
|
|
2370
|
+
style: N({ color: p.theme.colors.xmlQuote })
|
|
2363
2371
|
}, '"', 4)
|
|
2364
2372
|
]))), 128)),
|
|
2365
|
-
|
|
2373
|
+
w.value ? (k(), A("span", {
|
|
2366
2374
|
key: 2,
|
|
2367
2375
|
class: "xml-node__clickable-part",
|
|
2368
|
-
onClick:
|
|
2376
|
+
onClick: g[5] || (g[5] = ($) => S()),
|
|
2369
2377
|
title: i.value ? "Click to collapse" : "Click to expand"
|
|
2370
2378
|
}, [
|
|
2371
2379
|
y("span", {
|
|
2372
2380
|
class: "xml-node__bracket",
|
|
2373
|
-
style: N({ color:
|
|
2381
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2374
2382
|
}, ">", 4)
|
|
2375
|
-
], 8,
|
|
2383
|
+
], 8, cr)) : (k(), A("span", {
|
|
2376
2384
|
key: 3,
|
|
2377
2385
|
class: "xml-node__bracket",
|
|
2378
|
-
style: N({ color:
|
|
2379
|
-
}, B(
|
|
2386
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2387
|
+
}, B(w.value ? ">" : "/>"), 5))
|
|
2380
2388
|
]),
|
|
2381
|
-
i.value &&
|
|
2382
|
-
l.value.length === 0 &&
|
|
2389
|
+
i.value && w.value ? (k(), A("div", ur, [
|
|
2390
|
+
l.value.length === 0 && E.value.trim() ? (k(), A("div", dr, [
|
|
2383
2391
|
y("span", {
|
|
2384
2392
|
class: "xml-node__text-content",
|
|
2385
|
-
style: N({ color:
|
|
2386
|
-
}, B(
|
|
2387
|
-
])) :
|
|
2388
|
-
(
|
|
2389
|
-
key:
|
|
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),
|
|
2390
2398
|
node: $,
|
|
2391
|
-
index:
|
|
2392
|
-
level:
|
|
2399
|
+
index: R,
|
|
2400
|
+
level: p.level + 1,
|
|
2393
2401
|
"parent-path": Z(),
|
|
2394
|
-
expanded:
|
|
2395
|
-
theme:
|
|
2396
|
-
onToggleExpand:
|
|
2397
|
-
onCopy:
|
|
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))
|
|
2398
2406
|
}, null, 8, ["node", "index", "level", "parent-path", "expanded", "theme"]))), 128))
|
|
2399
|
-
])) :
|
|
2400
|
-
i.value &&
|
|
2407
|
+
])) : H("", !0),
|
|
2408
|
+
i.value && w.value ? (k(), A("div", fr, [
|
|
2401
2409
|
y("span", {
|
|
2402
2410
|
class: "xml-node__clickable-part",
|
|
2403
|
-
onClick:
|
|
2411
|
+
onClick: g[8] || (g[8] = ($) => S()),
|
|
2404
2412
|
title: "Click to collapse"
|
|
2405
2413
|
}, [
|
|
2406
2414
|
y("span", {
|
|
2407
2415
|
class: "xml-node__bracket",
|
|
2408
|
-
style: N({ color:
|
|
2416
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2409
2417
|
}, "</", 4),
|
|
2410
2418
|
y("span", {
|
|
2411
2419
|
class: "xml-node__tag",
|
|
2412
|
-
style: N({ color:
|
|
2420
|
+
style: N({ color: p.theme.colors.xmlTag })
|
|
2413
2421
|
}, B(n.value), 5),
|
|
2414
2422
|
y("span", {
|
|
2415
2423
|
class: "xml-node__bracket",
|
|
2416
|
-
style: N({ color:
|
|
2424
|
+
style: N({ color: p.theme.colors.xmlBracket })
|
|
2417
2425
|
}, ">", 4)
|
|
2418
2426
|
])
|
|
2419
|
-
])) :
|
|
2427
|
+
])) : H("", !0)
|
|
2420
2428
|
], 64))
|
|
2421
2429
|
]))
|
|
2422
|
-
])) :
|
|
2430
|
+
])) : H("", !0)
|
|
2423
2431
|
], 4);
|
|
2424
2432
|
};
|
|
2425
2433
|
}
|
|
2426
|
-
}),
|
|
2434
|
+
}), pr = /* @__PURE__ */ ye(hr, [["__scopeId", "data-v-afb7b2ab"]]), gr = {
|
|
2427
2435
|
name: "github-light",
|
|
2428
2436
|
colors: {
|
|
2429
2437
|
// 背景色
|
|
@@ -2473,7 +2481,7 @@ const Lt = {
|
|
|
2473
2481
|
collapsedText: "#0969da"
|
|
2474
2482
|
// 折叠信息文本色 - 蓝色
|
|
2475
2483
|
}
|
|
2476
|
-
},
|
|
2484
|
+
}, mr = {
|
|
2477
2485
|
name: "github-dark",
|
|
2478
2486
|
colors: {
|
|
2479
2487
|
// 背景色
|
|
@@ -2523,7 +2531,7 @@ const Lt = {
|
|
|
2523
2531
|
collapsedText: "#58a6ff"
|
|
2524
2532
|
// 折叠信息文本色 - 亮蓝
|
|
2525
2533
|
}
|
|
2526
|
-
},
|
|
2534
|
+
}, br = {
|
|
2527
2535
|
name: "min-light",
|
|
2528
2536
|
colors: {
|
|
2529
2537
|
// 背景色
|
|
@@ -2623,13 +2631,13 @@ const Lt = {
|
|
|
2623
2631
|
collapsedText: "#0b4c8c"
|
|
2624
2632
|
// 折叠信息文本色 - 深蓝
|
|
2625
2633
|
}
|
|
2626
|
-
},
|
|
2627
|
-
"github-light":
|
|
2628
|
-
"github-dark":
|
|
2629
|
-
"min-light":
|
|
2634
|
+
}, Se = {
|
|
2635
|
+
"github-light": gr,
|
|
2636
|
+
"github-dark": mr,
|
|
2637
|
+
"min-light": br,
|
|
2630
2638
|
"slack-ochin": yr
|
|
2631
|
-
},
|
|
2632
|
-
function
|
|
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) {
|
|
2633
2641
|
const t = [];
|
|
2634
2642
|
let s = e.exec(r);
|
|
2635
2643
|
for (; s; ) {
|
|
@@ -2643,122 +2651,122 @@ function qe(r, e) {
|
|
|
2643
2651
|
return t;
|
|
2644
2652
|
}
|
|
2645
2653
|
const ve = function(r) {
|
|
2646
|
-
const e =
|
|
2654
|
+
const e = xr.exec(r);
|
|
2647
2655
|
return !(e === null || typeof e > "u");
|
|
2648
2656
|
};
|
|
2649
|
-
function
|
|
2657
|
+
function kr(r) {
|
|
2650
2658
|
return typeof r < "u";
|
|
2651
2659
|
}
|
|
2652
|
-
const
|
|
2660
|
+
const Nr = {
|
|
2653
2661
|
allowBooleanAttributes: !1,
|
|
2654
2662
|
//A tag can have attributes without any value
|
|
2655
2663
|
unpairedTags: []
|
|
2656
2664
|
};
|
|
2657
|
-
function
|
|
2658
|
-
e = Object.assign({},
|
|
2665
|
+
function qe(r, e) {
|
|
2666
|
+
e = Object.assign({}, Nr, e);
|
|
2659
2667
|
const t = [];
|
|
2660
2668
|
let s = !1, n = !1;
|
|
2661
2669
|
r[0] === "\uFEFF" && (r = r.substr(1));
|
|
2662
2670
|
for (let o = 0; o < r.length; o++)
|
|
2663
2671
|
if (r[o] === "<" && r[o + 1] === "?") {
|
|
2664
|
-
if (o += 2, o =
|
|
2672
|
+
if (o += 2, o = Ie(r, o), o.err) return o;
|
|
2665
2673
|
} else if (r[o] === "<") {
|
|
2666
2674
|
let i = o;
|
|
2667
2675
|
if (o++, r[o] === "!") {
|
|
2668
|
-
o =
|
|
2676
|
+
o = Ve(r, o);
|
|
2669
2677
|
continue;
|
|
2670
2678
|
} else {
|
|
2671
|
-
let
|
|
2672
|
-
r[o] === "/" && (
|
|
2679
|
+
let c = !1;
|
|
2680
|
+
r[o] === "/" && (c = !0, o++);
|
|
2673
2681
|
let a = "";
|
|
2674
2682
|
for (; o < r.length && r[o] !== ">" && r[o] !== " " && r[o] !== " " && r[o] !== `
|
|
2675
2683
|
` && r[o] !== "\r"; o++)
|
|
2676
2684
|
a += r[o];
|
|
2677
|
-
if (a = a.trim(), a[a.length - 1] === "/" && (a = a.substring(0, a.length - 1), o--),
|
|
2678
|
-
let
|
|
2679
|
-
return a.trim().length === 0 ?
|
|
2685
|
+
if (a = a.trim(), a[a.length - 1] === "/" && (a = a.substring(0, a.length - 1), o--), !Sr(a)) {
|
|
2686
|
+
let f;
|
|
2687
|
+
return a.trim().length === 0 ? f = "Invalid space after '<'." : f = "Tag '" + a + "' is an invalid name.", F("InvalidTag", f, Q(r, o));
|
|
2680
2688
|
}
|
|
2681
|
-
const l =
|
|
2689
|
+
const l = Cr(r, o);
|
|
2682
2690
|
if (l === !1)
|
|
2683
|
-
return
|
|
2684
|
-
let
|
|
2685
|
-
if (o = l.index,
|
|
2686
|
-
const
|
|
2687
|
-
|
|
2688
|
-
const
|
|
2689
|
-
if (
|
|
2691
|
+
return F("InvalidAttr", "Attributes for '" + a + "' have open quote.", Q(r, o));
|
|
2692
|
+
let h = l.value;
|
|
2693
|
+
if (o = l.index, h[h.length - 1] === "/") {
|
|
2694
|
+
const f = o - h.length;
|
|
2695
|
+
h = h.substring(0, h.length - 1);
|
|
2696
|
+
const E = Le(h, e);
|
|
2697
|
+
if (E === !0)
|
|
2690
2698
|
s = !0;
|
|
2691
2699
|
else
|
|
2692
|
-
return
|
|
2693
|
-
} else if (
|
|
2700
|
+
return F(E.err.code, E.err.msg, Q(r, f + E.err.line));
|
|
2701
|
+
} else if (c)
|
|
2694
2702
|
if (l.tagClosed) {
|
|
2695
|
-
if (
|
|
2696
|
-
return
|
|
2703
|
+
if (h.trim().length > 0)
|
|
2704
|
+
return F("InvalidTag", "Closing tag '" + a + "' can't have attributes or invalid starting.", Q(r, i));
|
|
2697
2705
|
if (t.length === 0)
|
|
2698
|
-
return
|
|
2706
|
+
return F("InvalidTag", "Closing tag '" + a + "' has not been opened.", Q(r, i));
|
|
2699
2707
|
{
|
|
2700
|
-
const
|
|
2701
|
-
if (a !==
|
|
2702
|
-
let
|
|
2703
|
-
return
|
|
2708
|
+
const f = t.pop();
|
|
2709
|
+
if (a !== f.tagName) {
|
|
2710
|
+
let E = Q(r, f.tagStartPos);
|
|
2711
|
+
return F(
|
|
2704
2712
|
"InvalidTag",
|
|
2705
|
-
"Expected closing tag '" +
|
|
2713
|
+
"Expected closing tag '" + f.tagName + "' (opened in line " + E.line + ", col " + E.col + ") instead of closing tag '" + a + "'.",
|
|
2706
2714
|
Q(r, i)
|
|
2707
2715
|
);
|
|
2708
2716
|
}
|
|
2709
2717
|
t.length == 0 && (n = !0);
|
|
2710
2718
|
}
|
|
2711
|
-
} else return
|
|
2719
|
+
} else return F("InvalidTag", "Closing tag '" + a + "' doesn't have proper closing.", Q(r, o));
|
|
2712
2720
|
else {
|
|
2713
|
-
const
|
|
2714
|
-
if (
|
|
2715
|
-
return
|
|
2721
|
+
const f = Le(h, e);
|
|
2722
|
+
if (f !== !0)
|
|
2723
|
+
return F(f.err.code, f.err.msg, Q(r, o - h.length + f.err.line));
|
|
2716
2724
|
if (n === !0)
|
|
2717
|
-
return
|
|
2725
|
+
return F("InvalidXml", "Multiple possible root nodes found.", Q(r, o));
|
|
2718
2726
|
e.unpairedTags.indexOf(a) !== -1 || t.push({ tagName: a, tagStartPos: i }), s = !0;
|
|
2719
2727
|
}
|
|
2720
2728
|
for (o++; o < r.length; o++)
|
|
2721
2729
|
if (r[o] === "<")
|
|
2722
2730
|
if (r[o + 1] === "!") {
|
|
2723
|
-
o++, o =
|
|
2731
|
+
o++, o = Ve(r, o);
|
|
2724
2732
|
continue;
|
|
2725
2733
|
} else if (r[o + 1] === "?") {
|
|
2726
|
-
if (o =
|
|
2734
|
+
if (o = Ie(r, ++o), o.err) return o;
|
|
2727
2735
|
} else
|
|
2728
2736
|
break;
|
|
2729
2737
|
else if (r[o] === "&") {
|
|
2730
|
-
const
|
|
2731
|
-
if (
|
|
2732
|
-
return
|
|
2733
|
-
o =
|
|
2734
|
-
} else if (n === !0 && !
|
|
2735
|
-
return
|
|
2738
|
+
const f = Pr(r, o);
|
|
2739
|
+
if (f == -1)
|
|
2740
|
+
return F("InvalidChar", "char '&' is not expected.", Q(r, o));
|
|
2741
|
+
o = f;
|
|
2742
|
+
} else if (n === !0 && !Be(r[o]))
|
|
2743
|
+
return F("InvalidXml", "Extra text at the end", Q(r, o));
|
|
2736
2744
|
r[o] === "<" && o--;
|
|
2737
2745
|
}
|
|
2738
2746
|
} else {
|
|
2739
|
-
if (
|
|
2747
|
+
if (Be(r[o]))
|
|
2740
2748
|
continue;
|
|
2741
|
-
return
|
|
2749
|
+
return F("InvalidChar", "char '" + r[o] + "' is not expected.", Q(r, o));
|
|
2742
2750
|
}
|
|
2743
2751
|
if (s) {
|
|
2744
2752
|
if (t.length == 1)
|
|
2745
|
-
return
|
|
2753
|
+
return F("InvalidTag", "Unclosed tag '" + t[0].tagName + "'.", Q(r, t[0].tagStartPos));
|
|
2746
2754
|
if (t.length > 0)
|
|
2747
|
-
return
|
|
2748
|
-
} 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);
|
|
2749
2757
|
return !0;
|
|
2750
2758
|
}
|
|
2751
|
-
function
|
|
2759
|
+
function Be(r) {
|
|
2752
2760
|
return r === " " || r === " " || r === `
|
|
2753
2761
|
` || r === "\r";
|
|
2754
2762
|
}
|
|
2755
|
-
function
|
|
2763
|
+
function Ie(r, e) {
|
|
2756
2764
|
const t = e;
|
|
2757
2765
|
for (; e < r.length; e++)
|
|
2758
2766
|
if (r[e] == "?" || r[e] == " ") {
|
|
2759
2767
|
const s = r.substr(t, e - t);
|
|
2760
2768
|
if (e > 5 && s === "xml")
|
|
2761
|
-
return
|
|
2769
|
+
return F("InvalidXml", "XML declaration allowed only at the start of the document.", Q(r, e));
|
|
2762
2770
|
if (r[e] == "?" && r[e + 1] == ">") {
|
|
2763
2771
|
e++;
|
|
2764
2772
|
break;
|
|
@@ -2767,7 +2775,7 @@ function Ve(r, e) {
|
|
|
2767
2775
|
}
|
|
2768
2776
|
return e;
|
|
2769
2777
|
}
|
|
2770
|
-
function
|
|
2778
|
+
function Ve(r, e) {
|
|
2771
2779
|
if (r.length > e + 5 && r[e + 1] === "-" && r[e + 2] === "-") {
|
|
2772
2780
|
for (e += 3; e < r.length; e++)
|
|
2773
2781
|
if (r[e] === "-" && r[e + 1] === "-" && r[e + 2] === ">") {
|
|
@@ -2790,11 +2798,11 @@ function Le(r, e) {
|
|
|
2790
2798
|
}
|
|
2791
2799
|
return e;
|
|
2792
2800
|
}
|
|
2793
|
-
const
|
|
2794
|
-
function
|
|
2801
|
+
const Ar = '"', wr = "'";
|
|
2802
|
+
function Cr(r, e) {
|
|
2795
2803
|
let t = "", s = "", n = !1;
|
|
2796
2804
|
for (; e < r.length; e++) {
|
|
2797
|
-
if (r[e] ===
|
|
2805
|
+
if (r[e] === Ar || r[e] === wr)
|
|
2798
2806
|
s === "" ? s = r[e] : s !== r[e] || (s = "");
|
|
2799
2807
|
else if (r[e] === ">" && s === "") {
|
|
2800
2808
|
n = !0;
|
|
@@ -2808,27 +2816,27 @@ function wr(r, e) {
|
|
|
2808
2816
|
tagClosed: n
|
|
2809
2817
|
};
|
|
2810
2818
|
}
|
|
2811
|
-
const
|
|
2812
|
-
function
|
|
2813
|
-
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 = {};
|
|
2814
2822
|
for (let n = 0; n < t.length; n++) {
|
|
2815
2823
|
if (t[n][1].length === 0)
|
|
2816
|
-
return
|
|
2824
|
+
return F("InvalidAttr", "Attribute '" + t[n][2] + "' has no space in starting.", pe(t[n]));
|
|
2817
2825
|
if (t[n][3] !== void 0 && t[n][4] === void 0)
|
|
2818
|
-
return
|
|
2826
|
+
return F("InvalidAttr", "Attribute '" + t[n][2] + "' is without value.", pe(t[n]));
|
|
2819
2827
|
if (t[n][3] === void 0 && !e.allowBooleanAttributes)
|
|
2820
|
-
return
|
|
2828
|
+
return F("InvalidAttr", "boolean attribute '" + t[n][2] + "' is not allowed.", pe(t[n]));
|
|
2821
2829
|
const o = t[n][2];
|
|
2822
|
-
if (
|
|
2823
|
-
return
|
|
2830
|
+
if (!$r(o))
|
|
2831
|
+
return F("InvalidAttr", "Attribute '" + o + "' is an invalid name.", pe(t[n]));
|
|
2824
2832
|
if (!s.hasOwnProperty(o))
|
|
2825
2833
|
s[o] = 1;
|
|
2826
2834
|
else
|
|
2827
|
-
return
|
|
2835
|
+
return F("InvalidAttr", "Attribute '" + o + "' is repeated.", pe(t[n]));
|
|
2828
2836
|
}
|
|
2829
2837
|
return !0;
|
|
2830
2838
|
}
|
|
2831
|
-
function
|
|
2839
|
+
function Tr(r, e) {
|
|
2832
2840
|
let t = /\d/;
|
|
2833
2841
|
for (r[e] === "x" && (e++, t = /[\da-fA-F]/); e < r.length; e++) {
|
|
2834
2842
|
if (r[e] === ";")
|
|
@@ -2838,11 +2846,11 @@ function Or(r, e) {
|
|
|
2838
2846
|
}
|
|
2839
2847
|
return -1;
|
|
2840
2848
|
}
|
|
2841
|
-
function
|
|
2849
|
+
function Pr(r, e) {
|
|
2842
2850
|
if (e++, r[e] === ";")
|
|
2843
2851
|
return -1;
|
|
2844
2852
|
if (r[e] === "#")
|
|
2845
|
-
return e++,
|
|
2853
|
+
return e++, Tr(r, e);
|
|
2846
2854
|
let t = 0;
|
|
2847
2855
|
for (; e < r.length; e++, t++)
|
|
2848
2856
|
if (!(r[e].match(/\w/) && t < 20)) {
|
|
@@ -2852,7 +2860,7 @@ function Tr(r, e) {
|
|
|
2852
2860
|
}
|
|
2853
2861
|
return e;
|
|
2854
2862
|
}
|
|
2855
|
-
function
|
|
2863
|
+
function F(r, e, t) {
|
|
2856
2864
|
return {
|
|
2857
2865
|
err: {
|
|
2858
2866
|
code: r,
|
|
@@ -2862,10 +2870,10 @@ function M(r, e, t) {
|
|
|
2862
2870
|
}
|
|
2863
2871
|
};
|
|
2864
2872
|
}
|
|
2865
|
-
function
|
|
2873
|
+
function $r(r) {
|
|
2866
2874
|
return ve(r);
|
|
2867
2875
|
}
|
|
2868
|
-
function
|
|
2876
|
+
function Sr(r) {
|
|
2869
2877
|
return ve(r);
|
|
2870
2878
|
}
|
|
2871
2879
|
function Q(r, e) {
|
|
@@ -2879,7 +2887,7 @@ function Q(r, e) {
|
|
|
2879
2887
|
function pe(r) {
|
|
2880
2888
|
return r.startIndex + r[1].length;
|
|
2881
2889
|
}
|
|
2882
|
-
const
|
|
2890
|
+
const Br = {
|
|
2883
2891
|
preserveOrder: !1,
|
|
2884
2892
|
attributeNamePrefix: "@_",
|
|
2885
2893
|
attributesGroupName: !1,
|
|
@@ -2923,12 +2931,12 @@ const Sr = {
|
|
|
2923
2931
|
},
|
|
2924
2932
|
// skipEmptyListItem: false
|
|
2925
2933
|
captureMetaData: !1
|
|
2926
|
-
},
|
|
2927
|
-
return Object.assign({},
|
|
2934
|
+
}, Ir = function(r) {
|
|
2935
|
+
return Object.assign({}, Br, r);
|
|
2928
2936
|
};
|
|
2929
2937
|
let me;
|
|
2930
2938
|
typeof Symbol != "function" ? me = "@@xmlMetadata" : me = Symbol("XML Node Metadata");
|
|
2931
|
-
class
|
|
2939
|
+
class le {
|
|
2932
2940
|
constructor(e) {
|
|
2933
2941
|
this.tagname = e, this.child = [], this[":@"] = {};
|
|
2934
2942
|
}
|
|
@@ -2943,7 +2951,7 @@ class ae {
|
|
|
2943
2951
|
return me;
|
|
2944
2952
|
}
|
|
2945
2953
|
}
|
|
2946
|
-
class
|
|
2954
|
+
class Vr {
|
|
2947
2955
|
constructor(e) {
|
|
2948
2956
|
this.suppressValidationErr = !e;
|
|
2949
2957
|
}
|
|
@@ -2951,33 +2959,33 @@ class Ir {
|
|
|
2951
2959
|
const s = {};
|
|
2952
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") {
|
|
2953
2961
|
t = t + 9;
|
|
2954
|
-
let n = 1, o = !1, i = !1,
|
|
2962
|
+
let n = 1, o = !1, i = !1, c = "";
|
|
2955
2963
|
for (; t < e.length; t++)
|
|
2956
2964
|
if (e[t] === "<" && !i) {
|
|
2957
|
-
if (o &&
|
|
2965
|
+
if (o && ie(e, "!ENTITY", t)) {
|
|
2958
2966
|
t += 7;
|
|
2959
2967
|
let a, l;
|
|
2960
2968
|
[a, l, t] = this.readEntityExp(e, t + 1, this.suppressValidationErr), l.indexOf("&") === -1 && (s[a] = {
|
|
2961
2969
|
regx: RegExp(`&${a};`, "g"),
|
|
2962
2970
|
val: l
|
|
2963
2971
|
});
|
|
2964
|
-
} else if (o &&
|
|
2972
|
+
} else if (o && ie(e, "!ELEMENT", t)) {
|
|
2965
2973
|
t += 8;
|
|
2966
2974
|
const { index: a } = this.readElementExp(e, t + 1);
|
|
2967
2975
|
t = a;
|
|
2968
|
-
} else if (o &&
|
|
2976
|
+
} else if (o && ie(e, "!ATTLIST", t))
|
|
2969
2977
|
t += 8;
|
|
2970
|
-
else if (o &&
|
|
2978
|
+
else if (o && ie(e, "!NOTATION", t)) {
|
|
2971
2979
|
t += 9;
|
|
2972
2980
|
const { index: a } = this.readNotationExp(e, t + 1, this.suppressValidationErr);
|
|
2973
2981
|
t = a;
|
|
2974
|
-
} else if (
|
|
2982
|
+
} else if (ie(e, "!--", t)) i = !0;
|
|
2975
2983
|
else throw new Error("Invalid DOCTYPE");
|
|
2976
|
-
n++,
|
|
2984
|
+
n++, c = "";
|
|
2977
2985
|
} else if (e[t] === ">") {
|
|
2978
2986
|
if (i ? e[t - 1] === "-" && e[t - 2] === "-" && (i = !1, n--) : n--, n === 0)
|
|
2979
2987
|
break;
|
|
2980
|
-
} else e[t] === "[" ? o = !0 :
|
|
2988
|
+
} else e[t] === "[" ? o = !0 : c += e[t];
|
|
2981
2989
|
if (n !== 0)
|
|
2982
2990
|
throw new Error("Unclosed DOCTYPE");
|
|
2983
2991
|
} else
|
|
@@ -2985,11 +2993,11 @@ class Ir {
|
|
|
2985
2993
|
return { entities: s, i: t };
|
|
2986
2994
|
}
|
|
2987
2995
|
readEntityExp(e, t) {
|
|
2988
|
-
t =
|
|
2996
|
+
t = G(e, t);
|
|
2989
2997
|
let s = "";
|
|
2990
2998
|
for (; t < e.length && !/\s/.test(e[t]) && e[t] !== '"' && e[t] !== "'"; )
|
|
2991
2999
|
s += e[t], t++;
|
|
2992
|
-
if (ge(s), t =
|
|
3000
|
+
if (ge(s), t = G(e, t), !this.suppressValidationErr) {
|
|
2993
3001
|
if (e.substring(t, t + 6).toUpperCase() === "SYSTEM")
|
|
2994
3002
|
throw new Error("External entities are not supported");
|
|
2995
3003
|
if (e[t] === "%")
|
|
@@ -2999,18 +3007,18 @@ class Ir {
|
|
|
2999
3007
|
return [t, n] = this.readIdentifierVal(e, t, "entity"), t--, [s, n, t];
|
|
3000
3008
|
}
|
|
3001
3009
|
readNotationExp(e, t) {
|
|
3002
|
-
t =
|
|
3010
|
+
t = G(e, t);
|
|
3003
3011
|
let s = "";
|
|
3004
3012
|
for (; t < e.length && !/\s/.test(e[t]); )
|
|
3005
3013
|
s += e[t], t++;
|
|
3006
|
-
!this.suppressValidationErr && ge(s), t =
|
|
3014
|
+
!this.suppressValidationErr && ge(s), t = G(e, t);
|
|
3007
3015
|
const n = e.substring(t, t + 6).toUpperCase();
|
|
3008
3016
|
if (!this.suppressValidationErr && n !== "SYSTEM" && n !== "PUBLIC")
|
|
3009
3017
|
throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);
|
|
3010
|
-
t += n.length, t =
|
|
3018
|
+
t += n.length, t = G(e, t);
|
|
3011
3019
|
let o = null, i = null;
|
|
3012
3020
|
if (n === "PUBLIC")
|
|
3013
|
-
[t, o] = this.readIdentifierVal(e, t, "publicIdentifier"), t =
|
|
3021
|
+
[t, o] = this.readIdentifierVal(e, t, "publicIdentifier"), t = G(e, t), (e[t] === '"' || e[t] === "'") && ([t, i] = this.readIdentifierVal(e, t, "systemIdentifier"));
|
|
3014
3022
|
else if (n === "SYSTEM" && ([t, i] = this.readIdentifierVal(e, t, "systemIdentifier"), !this.suppressValidationErr && !i))
|
|
3015
3023
|
throw new Error("Missing mandatory system identifier for SYSTEM notation");
|
|
3016
3024
|
return { notationName: s, publicIdentifier: o, systemIdentifier: i, index: --t };
|
|
@@ -3027,16 +3035,16 @@ class Ir {
|
|
|
3027
3035
|
return t++, [t, n];
|
|
3028
3036
|
}
|
|
3029
3037
|
readElementExp(e, t) {
|
|
3030
|
-
t =
|
|
3038
|
+
t = G(e, t);
|
|
3031
3039
|
let s = "";
|
|
3032
3040
|
for (; t < e.length && !/\s/.test(e[t]); )
|
|
3033
3041
|
s += e[t], t++;
|
|
3034
3042
|
if (!this.suppressValidationErr && !ve(s))
|
|
3035
3043
|
throw new Error(`Invalid element name: "${s}"`);
|
|
3036
|
-
t =
|
|
3044
|
+
t = G(e, t);
|
|
3037
3045
|
let n = "";
|
|
3038
|
-
if (e[t] === "E" &&
|
|
3039
|
-
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;
|
|
3040
3048
|
else if (e[t] === "(") {
|
|
3041
3049
|
for (t++; t < e.length && e[t] !== ")"; )
|
|
3042
3050
|
n += e[t], t++;
|
|
@@ -3051,42 +3059,42 @@ class Ir {
|
|
|
3051
3059
|
};
|
|
3052
3060
|
}
|
|
3053
3061
|
readAttlistExp(e, t) {
|
|
3054
|
-
t =
|
|
3062
|
+
t = G(e, t);
|
|
3055
3063
|
let s = "";
|
|
3056
3064
|
for (; t < e.length && !/\s/.test(e[t]); )
|
|
3057
3065
|
s += e[t], t++;
|
|
3058
|
-
ge(s), t =
|
|
3066
|
+
ge(s), t = G(e, t);
|
|
3059
3067
|
let n = "";
|
|
3060
3068
|
for (; t < e.length && !/\s/.test(e[t]); )
|
|
3061
3069
|
n += e[t], t++;
|
|
3062
3070
|
if (!ge(n))
|
|
3063
3071
|
throw new Error(`Invalid attribute name: "${n}"`);
|
|
3064
|
-
t =
|
|
3072
|
+
t = G(e, t);
|
|
3065
3073
|
let o = "";
|
|
3066
3074
|
if (e.substring(t, t + 8).toUpperCase() === "NOTATION") {
|
|
3067
|
-
if (o = "NOTATION", t += 8, t =
|
|
3075
|
+
if (o = "NOTATION", t += 8, t = G(e, t), e[t] !== "(")
|
|
3068
3076
|
throw new Error(`Expected '(', found "${e[t]}"`);
|
|
3069
3077
|
t++;
|
|
3070
|
-
let
|
|
3078
|
+
let c = [];
|
|
3071
3079
|
for (; t < e.length && e[t] !== ")"; ) {
|
|
3072
3080
|
let a = "";
|
|
3073
3081
|
for (; t < e.length && e[t] !== "|" && e[t] !== ")"; )
|
|
3074
3082
|
a += e[t], t++;
|
|
3075
3083
|
if (a = a.trim(), !ge(a))
|
|
3076
3084
|
throw new Error(`Invalid notation name: "${a}"`);
|
|
3077
|
-
|
|
3085
|
+
c.push(a), e[t] === "|" && (t++, t = G(e, t));
|
|
3078
3086
|
}
|
|
3079
3087
|
if (e[t] !== ")")
|
|
3080
3088
|
throw new Error("Unterminated list of notations");
|
|
3081
|
-
t++, o += " (" +
|
|
3089
|
+
t++, o += " (" + c.join("|") + ")";
|
|
3082
3090
|
} else {
|
|
3083
3091
|
for (; t < e.length && !/\s/.test(e[t]); )
|
|
3084
3092
|
o += e[t], t++;
|
|
3085
|
-
const
|
|
3086
|
-
if (!this.suppressValidationErr && !
|
|
3093
|
+
const c = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
|
|
3094
|
+
if (!this.suppressValidationErr && !c.includes(o.toUpperCase()))
|
|
3087
3095
|
throw new Error(`Invalid attribute type: "${o}"`);
|
|
3088
3096
|
}
|
|
3089
|
-
t =
|
|
3097
|
+
t = G(e, t);
|
|
3090
3098
|
let i = "";
|
|
3091
3099
|
return e.substring(t, t + 8).toUpperCase() === "#REQUIRED" ? (i = "#REQUIRED", t += 8) : e.substring(t, t + 7).toUpperCase() === "#IMPLIED" ? (i = "#IMPLIED", t += 7) : [t, i] = this.readIdentifierVal(e, t, "ATTLIST"), {
|
|
3092
3100
|
elementName: s,
|
|
@@ -3097,12 +3105,12 @@ class Ir {
|
|
|
3097
3105
|
};
|
|
3098
3106
|
}
|
|
3099
3107
|
}
|
|
3100
|
-
const
|
|
3108
|
+
const G = (r, e) => {
|
|
3101
3109
|
for (; e < r.length && /\s/.test(r[e]); )
|
|
3102
3110
|
e++;
|
|
3103
3111
|
return e;
|
|
3104
3112
|
};
|
|
3105
|
-
function
|
|
3113
|
+
function ie(r, e, t) {
|
|
3106
3114
|
for (let s = 0; s < e.length; s++)
|
|
3107
3115
|
if (e[s] !== r[t + s + 1]) return !1;
|
|
3108
3116
|
return !0;
|
|
@@ -3112,7 +3120,7 @@ function ge(r) {
|
|
|
3112
3120
|
return r;
|
|
3113
3121
|
throw new Error(`Invalid entity name ${r}`);
|
|
3114
3122
|
}
|
|
3115
|
-
const
|
|
3123
|
+
const Lr = /^[-+]?0x[a-fA-F0-9]+$/, Rr = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, jr = {
|
|
3116
3124
|
hex: !0,
|
|
3117
3125
|
// oct: false,
|
|
3118
3126
|
leadingZeros: !0,
|
|
@@ -3120,25 +3128,25 @@ const Vr = /^[-+]?0x[a-fA-F0-9]+$/, Lr = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, j
|
|
|
3120
3128
|
eNotation: !0
|
|
3121
3129
|
//skipLike: /regex/
|
|
3122
3130
|
};
|
|
3123
|
-
function
|
|
3131
|
+
function Mr(r, e = {}) {
|
|
3124
3132
|
if (e = Object.assign({}, jr, e), !r || typeof r != "string") return r;
|
|
3125
3133
|
let t = r.trim();
|
|
3126
3134
|
if (e.skipLike !== void 0 && e.skipLike.test(t)) return r;
|
|
3127
3135
|
if (r === "0") return 0;
|
|
3128
|
-
if (e.hex &&
|
|
3129
|
-
return
|
|
3136
|
+
if (e.hex && Lr.test(t))
|
|
3137
|
+
return Hr(t, 16);
|
|
3130
3138
|
if (t.search(/.+[eE].+/) !== -1)
|
|
3131
|
-
return
|
|
3139
|
+
return Fr(r, t, e);
|
|
3132
3140
|
{
|
|
3133
|
-
const s =
|
|
3141
|
+
const s = Rr.exec(t);
|
|
3134
3142
|
if (s) {
|
|
3135
3143
|
const n = s[1] || "", o = s[2];
|
|
3136
|
-
let i =
|
|
3137
|
-
const
|
|
3144
|
+
let i = Xr(s[3]);
|
|
3145
|
+
const c = n ? (
|
|
3138
3146
|
// 0., -00., 000.
|
|
3139
3147
|
r[o.length + 1] === "."
|
|
3140
3148
|
) : r[o.length] === ".";
|
|
3141
|
-
if (!e.leadingZeros && (o.length > 1 || o.length === 1 && !
|
|
3149
|
+
if (!e.leadingZeros && (o.length > 1 || o.length === 1 && !c))
|
|
3142
3150
|
return r;
|
|
3143
3151
|
{
|
|
3144
3152
|
const a = Number(t), l = String(a);
|
|
@@ -3147,44 +3155,44 @@ function Rr(r, e = {}) {
|
|
|
3147
3155
|
return e.eNotation ? a : r;
|
|
3148
3156
|
if (t.indexOf(".") !== -1)
|
|
3149
3157
|
return l === "0" || l === i || l === `${n}${i}` ? a : r;
|
|
3150
|
-
let
|
|
3151
|
-
return o ?
|
|
3158
|
+
let h = o ? i : t;
|
|
3159
|
+
return o ? h === l || n + h === l ? a : r : h === l || h === n + l ? a : r;
|
|
3152
3160
|
}
|
|
3153
3161
|
} else
|
|
3154
3162
|
return r;
|
|
3155
3163
|
}
|
|
3156
3164
|
}
|
|
3157
|
-
const
|
|
3158
|
-
function
|
|
3165
|
+
const Ur = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
|
|
3166
|
+
function Fr(r, e, t) {
|
|
3159
3167
|
if (!t.eNotation) return r;
|
|
3160
|
-
const s = e.match(
|
|
3168
|
+
const s = e.match(Ur);
|
|
3161
3169
|
if (s) {
|
|
3162
3170
|
let n = s[1] || "";
|
|
3163
|
-
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 ? (
|
|
3164
3172
|
// 0E.
|
|
3165
3173
|
r[i.length + 1] === o
|
|
3166
3174
|
) : r[i.length] === o;
|
|
3167
|
-
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;
|
|
3168
3176
|
} else
|
|
3169
3177
|
return r;
|
|
3170
3178
|
}
|
|
3171
|
-
function
|
|
3179
|
+
function Xr(r) {
|
|
3172
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;
|
|
3173
3181
|
}
|
|
3174
|
-
function
|
|
3182
|
+
function Hr(r, e) {
|
|
3175
3183
|
if (parseInt) return parseInt(r, e);
|
|
3176
3184
|
if (Number.parseInt) return Number.parseInt(r, e);
|
|
3177
3185
|
if (window && window.parseInt) return window.parseInt(r, e);
|
|
3178
3186
|
throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
|
|
3179
3187
|
}
|
|
3180
|
-
function
|
|
3188
|
+
function Qe(r) {
|
|
3181
3189
|
return typeof r == "function" ? r : Array.isArray(r) ? (e) => {
|
|
3182
3190
|
for (const t of r)
|
|
3183
3191
|
if (typeof t == "string" && e === t || t instanceof RegExp && t.test(e))
|
|
3184
3192
|
return !0;
|
|
3185
3193
|
} : () => !1;
|
|
3186
3194
|
}
|
|
3187
|
-
class
|
|
3195
|
+
class Kr {
|
|
3188
3196
|
constructor(e) {
|
|
3189
3197
|
this.options = e, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
|
|
3190
3198
|
apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
|
|
@@ -3207,10 +3215,10 @@ class Hr {
|
|
|
3207
3215
|
inr: { regex: /&(inr|#8377);/g, val: "₹" },
|
|
3208
3216
|
num_dec: { regex: /&#([0-9]{1,7});/g, val: (t, s) => String.fromCodePoint(Number.parseInt(s, 10)) },
|
|
3209
3217
|
num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t, s) => String.fromCodePoint(Number.parseInt(s, 16)) }
|
|
3210
|
-
}, 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);
|
|
3211
3219
|
}
|
|
3212
3220
|
}
|
|
3213
|
-
function
|
|
3221
|
+
function qr(r) {
|
|
3214
3222
|
const e = Object.keys(r);
|
|
3215
3223
|
for (let t = 0; t < e.length; t++) {
|
|
3216
3224
|
const s = e[t];
|
|
@@ -3220,14 +3228,14 @@ function Kr(r) {
|
|
|
3220
3228
|
};
|
|
3221
3229
|
}
|
|
3222
3230
|
}
|
|
3223
|
-
function
|
|
3231
|
+
function Qr(r, e, t, s, n, o, i) {
|
|
3224
3232
|
if (r !== void 0 && (this.options.trimValues && !s && (r = r.trim()), r.length > 0)) {
|
|
3225
3233
|
i || (r = this.replaceEntitiesValue(r));
|
|
3226
|
-
const
|
|
3227
|
-
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;
|
|
3228
3236
|
}
|
|
3229
3237
|
}
|
|
3230
|
-
function
|
|
3238
|
+
function Wr(r) {
|
|
3231
3239
|
if (this.options.removeNSPrefix) {
|
|
3232
3240
|
const e = r.split(":"), t = r.charAt(0) === "/" ? "/" : "";
|
|
3233
3241
|
if (e[0] === "xmlns")
|
|
@@ -3236,20 +3244,20 @@ function Qr(r) {
|
|
|
3236
3244
|
}
|
|
3237
3245
|
return r;
|
|
3238
3246
|
}
|
|
3239
|
-
const
|
|
3240
|
-
function
|
|
3247
|
+
const Yr = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
3248
|
+
function Gr(r, e, t) {
|
|
3241
3249
|
if (this.options.ignoreAttributes !== !0 && typeof r == "string") {
|
|
3242
|
-
const s =
|
|
3250
|
+
const s = Ke(r, Yr), n = s.length, o = {};
|
|
3243
3251
|
for (let i = 0; i < n; i++) {
|
|
3244
|
-
const
|
|
3245
|
-
if (this.ignoreAttributesFn(
|
|
3252
|
+
const c = this.resolveNameSpace(s[i][1]);
|
|
3253
|
+
if (this.ignoreAttributesFn(c, e))
|
|
3246
3254
|
continue;
|
|
3247
|
-
let a = s[i][4], l = this.options.attributeNamePrefix +
|
|
3248
|
-
if (
|
|
3255
|
+
let a = s[i][4], l = this.options.attributeNamePrefix + c;
|
|
3256
|
+
if (c.length)
|
|
3249
3257
|
if (this.options.transformAttributeName && (l = this.options.transformAttributeName(l)), l === "__proto__" && (l = "#__proto__"), a !== void 0) {
|
|
3250
3258
|
this.options.trimValues && (a = a.trim()), a = this.replaceEntitiesValue(a);
|
|
3251
|
-
const
|
|
3252
|
-
|
|
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(
|
|
3253
3261
|
a,
|
|
3254
3262
|
this.options.parseAttributeValue,
|
|
3255
3263
|
this.options.numberParseOptions
|
|
@@ -3265,37 +3273,37 @@ function Yr(r, e, t) {
|
|
|
3265
3273
|
return o;
|
|
3266
3274
|
}
|
|
3267
3275
|
}
|
|
3268
|
-
const
|
|
3276
|
+
const Zr = function(r) {
|
|
3269
3277
|
r = r.replace(/\r\n?/g, `
|
|
3270
3278
|
`);
|
|
3271
|
-
const e = new
|
|
3279
|
+
const e = new le("!xml");
|
|
3272
3280
|
let t = e, s = "", n = "";
|
|
3273
|
-
const o = new
|
|
3281
|
+
const o = new Vr(this.options.processEntities);
|
|
3274
3282
|
for (let i = 0; i < r.length; i++)
|
|
3275
3283
|
if (r[i] === "<")
|
|
3276
3284
|
if (r[i + 1] === "/") {
|
|
3277
|
-
const a =
|
|
3285
|
+
const a = ce(r, ">", i, "Closing Tag is not closed.");
|
|
3278
3286
|
let l = r.substring(i + 2, a).trim();
|
|
3279
3287
|
if (this.options.removeNSPrefix) {
|
|
3280
|
-
const
|
|
3281
|
-
|
|
3288
|
+
const E = l.indexOf(":");
|
|
3289
|
+
E !== -1 && (l = l.substr(E + 1));
|
|
3282
3290
|
}
|
|
3283
3291
|
this.options.transformTagName && (l = this.options.transformTagName(l)), t && (s = this.saveTextToParentTag(s, t, n));
|
|
3284
|
-
const
|
|
3292
|
+
const h = n.substring(n.lastIndexOf(".") + 1);
|
|
3285
3293
|
if (l && this.options.unpairedTags.indexOf(l) !== -1)
|
|
3286
3294
|
throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);
|
|
3287
|
-
let
|
|
3288
|
-
|
|
3295
|
+
let f = 0;
|
|
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;
|
|
3289
3297
|
} else if (r[i + 1] === "?") {
|
|
3290
|
-
let a =
|
|
3298
|
+
let a = Ae(r, i, !1, "?>");
|
|
3291
3299
|
if (!a) throw new Error("Pi Tag is not closed.");
|
|
3292
3300
|
if (s = this.saveTextToParentTag(s, t, n), !(this.options.ignoreDeclaration && a.tagName === "?xml" || this.options.ignorePiTags)) {
|
|
3293
|
-
const l = new
|
|
3301
|
+
const l = new le(a.tagName);
|
|
3294
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);
|
|
3295
3303
|
}
|
|
3296
3304
|
i = a.closeIndex + 1;
|
|
3297
3305
|
} else if (r.substr(i + 1, 3) === "!--") {
|
|
3298
|
-
const a =
|
|
3306
|
+
const a = ce(r, "-->", i + 4, "Comment is not closed.");
|
|
3299
3307
|
if (this.options.commentPropName) {
|
|
3300
3308
|
const l = r.substring(i + 4, a - 2);
|
|
3301
3309
|
s = this.saveTextToParentTag(s, t, n), t.add(this.options.commentPropName, [{ [this.options.textNodeName]: l }]);
|
|
@@ -3305,53 +3313,53 @@ const Gr = function(r) {
|
|
|
3305
3313
|
const a = o.readDocType(r, i);
|
|
3306
3314
|
this.docTypeEntities = a.entities, i = a.i;
|
|
3307
3315
|
} else if (r.substr(i + 1, 2) === "![") {
|
|
3308
|
-
const a =
|
|
3316
|
+
const a = ce(r, "]]>", i, "CDATA is not closed.") - 2, l = r.substring(i + 9, a);
|
|
3309
3317
|
s = this.saveTextToParentTag(s, t, n);
|
|
3310
|
-
let
|
|
3311
|
-
|
|
3318
|
+
let h = this.parseTextData(l, t.tagname, n, !0, !1, !0, !0);
|
|
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;
|
|
3312
3320
|
} else {
|
|
3313
|
-
let a =
|
|
3314
|
-
const
|
|
3315
|
-
let
|
|
3321
|
+
let a = Ae(r, i, this.options.removeNSPrefix), l = a.tagName;
|
|
3322
|
+
const h = a.rawTagName;
|
|
3323
|
+
let f = a.tagExp, E = a.attrExpPresent, _ = a.closeIndex;
|
|
3316
3324
|
this.options.transformTagName && (l = this.options.transformTagName(l)), t && s && t.tagname !== "!xml" && (s = this.saveTextToParentTag(s, t, n, !1));
|
|
3317
|
-
const
|
|
3318
|
-
|
|
3319
|
-
const
|
|
3325
|
+
const w = t;
|
|
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);
|
|
3327
|
+
const O = i;
|
|
3320
3328
|
if (this.isItStopNode(this.options.stopNodes, n, l)) {
|
|
3321
|
-
let
|
|
3322
|
-
if (
|
|
3323
|
-
l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), n = n.substr(0, n.length - 1),
|
|
3329
|
+
let x = "";
|
|
3330
|
+
if (f.length > 0 && f.lastIndexOf("/") === f.length - 1)
|
|
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;
|
|
3324
3332
|
else if (this.options.unpairedTags.indexOf(l) !== -1)
|
|
3325
3333
|
i = a.closeIndex;
|
|
3326
3334
|
else {
|
|
3327
|
-
const
|
|
3328
|
-
if (!
|
|
3329
|
-
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;
|
|
3330
3338
|
}
|
|
3331
|
-
const S = new
|
|
3332
|
-
l !==
|
|
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);
|
|
3333
3341
|
} else {
|
|
3334
|
-
if (
|
|
3335
|
-
l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), n = n.substr(0, n.length - 1),
|
|
3336
|
-
const
|
|
3337
|
-
l !==
|
|
3342
|
+
if (f.length > 0 && f.lastIndexOf("/") === f.length - 1) {
|
|
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));
|
|
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("."));
|
|
3338
3346
|
} else {
|
|
3339
|
-
const
|
|
3340
|
-
this.tagsNodeStack.push(t), l !==
|
|
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;
|
|
3341
3349
|
}
|
|
3342
|
-
s = "", i =
|
|
3350
|
+
s = "", i = _;
|
|
3343
3351
|
}
|
|
3344
3352
|
}
|
|
3345
3353
|
else
|
|
3346
3354
|
s += r[i];
|
|
3347
3355
|
return e.child;
|
|
3348
3356
|
};
|
|
3349
|
-
function
|
|
3357
|
+
function zr(r, e, t, s) {
|
|
3350
3358
|
this.options.captureMetaData || (s = void 0);
|
|
3351
3359
|
const n = this.options.updateTag(e.tagname, t, e[":@"]);
|
|
3352
3360
|
n === !1 || (typeof n == "string" && (e.tagname = n), r.addChild(e, s));
|
|
3353
3361
|
}
|
|
3354
|
-
const
|
|
3362
|
+
const Dr = function(r) {
|
|
3355
3363
|
if (this.options.processEntities) {
|
|
3356
3364
|
for (let e in this.docTypeEntities) {
|
|
3357
3365
|
const t = this.docTypeEntities[e];
|
|
@@ -3370,7 +3378,7 @@ const zr = function(r) {
|
|
|
3370
3378
|
}
|
|
3371
3379
|
return r;
|
|
3372
3380
|
};
|
|
3373
|
-
function
|
|
3381
|
+
function Jr(r, e, t, s) {
|
|
3374
3382
|
return r && (s === void 0 && (s = e.child.length === 0), r = this.parseTextData(
|
|
3375
3383
|
r,
|
|
3376
3384
|
e.tagname,
|
|
@@ -3380,7 +3388,7 @@ function Dr(r, e, t, s) {
|
|
|
3380
3388
|
s
|
|
3381
3389
|
), r !== void 0 && r !== "" && e.add(this.options.textNodeName, r), r = ""), r;
|
|
3382
3390
|
}
|
|
3383
|
-
function
|
|
3391
|
+
function en(r, e, t) {
|
|
3384
3392
|
const s = "*." + t;
|
|
3385
3393
|
for (const n in r) {
|
|
3386
3394
|
const o = r[n];
|
|
@@ -3388,7 +3396,7 @@ function Jr(r, e, t) {
|
|
|
3388
3396
|
}
|
|
3389
3397
|
return !1;
|
|
3390
3398
|
}
|
|
3391
|
-
function
|
|
3399
|
+
function tn(r, e, t = ">") {
|
|
3392
3400
|
let s, n = "";
|
|
3393
3401
|
for (let o = e; o < r.length; o++) {
|
|
3394
3402
|
let i = r[o];
|
|
@@ -3412,39 +3420,39 @@ function en(r, e, t = ">") {
|
|
|
3412
3420
|
n += i;
|
|
3413
3421
|
}
|
|
3414
3422
|
}
|
|
3415
|
-
function
|
|
3423
|
+
function ce(r, e, t, s) {
|
|
3416
3424
|
const n = r.indexOf(e, t);
|
|
3417
3425
|
if (n === -1)
|
|
3418
3426
|
throw new Error(s);
|
|
3419
3427
|
return n + e.length - 1;
|
|
3420
3428
|
}
|
|
3421
|
-
function
|
|
3422
|
-
const n =
|
|
3429
|
+
function Ae(r, e, t, s = ">") {
|
|
3430
|
+
const n = tn(r, e + 1, s);
|
|
3423
3431
|
if (!n) return;
|
|
3424
3432
|
let o = n.data;
|
|
3425
|
-
const i = n.index,
|
|
3433
|
+
const i = n.index, c = o.search(/\s/);
|
|
3426
3434
|
let a = o, l = !0;
|
|
3427
|
-
|
|
3428
|
-
const
|
|
3435
|
+
c !== -1 && (a = o.substring(0, c), o = o.substring(c + 1).trimStart());
|
|
3436
|
+
const h = a;
|
|
3429
3437
|
if (t) {
|
|
3430
|
-
const
|
|
3431
|
-
|
|
3438
|
+
const f = a.indexOf(":");
|
|
3439
|
+
f !== -1 && (a = a.substr(f + 1), l = a !== n.data.substr(f + 1));
|
|
3432
3440
|
}
|
|
3433
3441
|
return {
|
|
3434
3442
|
tagName: a,
|
|
3435
3443
|
tagExp: o,
|
|
3436
3444
|
closeIndex: i,
|
|
3437
3445
|
attrExpPresent: l,
|
|
3438
|
-
rawTagName:
|
|
3446
|
+
rawTagName: h
|
|
3439
3447
|
};
|
|
3440
3448
|
}
|
|
3441
|
-
function
|
|
3449
|
+
function rn(r, e, t) {
|
|
3442
3450
|
const s = t;
|
|
3443
3451
|
let n = 1;
|
|
3444
3452
|
for (; t < r.length; t++)
|
|
3445
3453
|
if (r[t] === "<")
|
|
3446
3454
|
if (r[t + 1] === "/") {
|
|
3447
|
-
const o =
|
|
3455
|
+
const o = ce(r, ">", t, `${e} is not closed`);
|
|
3448
3456
|
if (r.substring(t + 2, o).trim() === e && (n--, n === 0))
|
|
3449
3457
|
return {
|
|
3450
3458
|
tagContent: r.substring(s, t),
|
|
@@ -3452,70 +3460,70 @@ function tn(r, e, t) {
|
|
|
3452
3460
|
};
|
|
3453
3461
|
t = o;
|
|
3454
3462
|
} else if (r[t + 1] === "?")
|
|
3455
|
-
t =
|
|
3463
|
+
t = ce(r, "?>", t + 1, "StopNode is not closed.");
|
|
3456
3464
|
else if (r.substr(t + 1, 3) === "!--")
|
|
3457
|
-
t =
|
|
3465
|
+
t = ce(r, "-->", t + 3, "StopNode is not closed.");
|
|
3458
3466
|
else if (r.substr(t + 1, 2) === "![")
|
|
3459
|
-
t =
|
|
3467
|
+
t = ce(r, "]]>", t, "StopNode is not closed.") - 2;
|
|
3460
3468
|
else {
|
|
3461
|
-
const o =
|
|
3469
|
+
const o = Ae(r, t, ">");
|
|
3462
3470
|
o && ((o && o.tagName) === e && o.tagExp[o.tagExp.length - 1] !== "/" && n++, t = o.closeIndex);
|
|
3463
3471
|
}
|
|
3464
3472
|
}
|
|
3465
|
-
function
|
|
3473
|
+
function we(r, e, t) {
|
|
3466
3474
|
if (e && typeof r == "string") {
|
|
3467
3475
|
const s = r.trim();
|
|
3468
|
-
return s === "true" ? !0 : s === "false" ? !1 :
|
|
3476
|
+
return s === "true" ? !0 : s === "false" ? !1 : Mr(r, t);
|
|
3469
3477
|
} else
|
|
3470
|
-
return
|
|
3478
|
+
return kr(r) ? r : "";
|
|
3471
3479
|
}
|
|
3472
|
-
const
|
|
3473
|
-
function
|
|
3474
|
-
return
|
|
3480
|
+
const ke = le.getMetaDataSymbol();
|
|
3481
|
+
function nn(r, e) {
|
|
3482
|
+
return We(r, e);
|
|
3475
3483
|
}
|
|
3476
|
-
function
|
|
3484
|
+
function We(r, e, t) {
|
|
3477
3485
|
let s;
|
|
3478
3486
|
const n = {};
|
|
3479
3487
|
for (let o = 0; o < r.length; o++) {
|
|
3480
|
-
const i = r[o],
|
|
3488
|
+
const i = r[o], c = sn(i);
|
|
3481
3489
|
let a = "";
|
|
3482
|
-
if (t === void 0 ? a =
|
|
3483
|
-
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];
|
|
3484
3492
|
else {
|
|
3485
|
-
if (
|
|
3493
|
+
if (c === void 0)
|
|
3486
3494
|
continue;
|
|
3487
|
-
if (i[
|
|
3488
|
-
let l =
|
|
3489
|
-
const
|
|
3490
|
-
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;
|
|
3491
3499
|
}
|
|
3492
3500
|
}
|
|
3493
3501
|
}
|
|
3494
3502
|
return typeof s == "string" ? s.length > 0 && (n[e.textNodeName] = s) : s !== void 0 && (n[e.textNodeName] = s), n;
|
|
3495
3503
|
}
|
|
3496
|
-
function
|
|
3504
|
+
function sn(r) {
|
|
3497
3505
|
const e = Object.keys(r);
|
|
3498
3506
|
for (let t = 0; t < e.length; t++) {
|
|
3499
3507
|
const s = e[t];
|
|
3500
3508
|
if (s !== ":@") return s;
|
|
3501
3509
|
}
|
|
3502
3510
|
}
|
|
3503
|
-
function
|
|
3511
|
+
function on(r, e, t, s) {
|
|
3504
3512
|
if (e) {
|
|
3505
3513
|
const n = Object.keys(e), o = n.length;
|
|
3506
3514
|
for (let i = 0; i < o; i++) {
|
|
3507
|
-
const
|
|
3508
|
-
s.isArray(
|
|
3515
|
+
const c = n[i];
|
|
3516
|
+
s.isArray(c, t + "." + c, !0, !0) ? r[c] = [e[c]] : r[c] = e[c];
|
|
3509
3517
|
}
|
|
3510
3518
|
}
|
|
3511
3519
|
}
|
|
3512
|
-
function
|
|
3520
|
+
function an(r, e) {
|
|
3513
3521
|
const { textNodeName: t } = e, s = Object.keys(r).length;
|
|
3514
3522
|
return !!(s === 0 || s === 1 && (r[t] || typeof r[t] == "boolean" || r[t] === 0));
|
|
3515
3523
|
}
|
|
3516
|
-
class
|
|
3524
|
+
class ln {
|
|
3517
3525
|
constructor(e) {
|
|
3518
|
-
this.externalEntities = {}, this.options =
|
|
3526
|
+
this.externalEntities = {}, this.options = Ir(e);
|
|
3519
3527
|
}
|
|
3520
3528
|
/**
|
|
3521
3529
|
* Parse XML dats to JS object
|
|
@@ -3529,14 +3537,14 @@ class an {
|
|
|
3529
3537
|
throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
3530
3538
|
if (t) {
|
|
3531
3539
|
t === !0 && (t = {});
|
|
3532
|
-
const o =
|
|
3540
|
+
const o = qe(e, t);
|
|
3533
3541
|
if (o !== !0)
|
|
3534
3542
|
throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`);
|
|
3535
3543
|
}
|
|
3536
|
-
const s = new
|
|
3544
|
+
const s = new Kr(this.options);
|
|
3537
3545
|
s.addExternalEntities(this.externalEntities);
|
|
3538
3546
|
const n = s.parseXml(e);
|
|
3539
|
-
return this.options.preserveOrder || n === void 0 ? n :
|
|
3547
|
+
return this.options.preserveOrder || n === void 0 ? n : nn(n, this.options);
|
|
3540
3548
|
}
|
|
3541
3549
|
/**
|
|
3542
3550
|
* Add Entity which is not by default supported by this library
|
|
@@ -3563,45 +3571,45 @@ class an {
|
|
|
3563
3571
|
* is true in the options.
|
|
3564
3572
|
*/
|
|
3565
3573
|
static getMetaDataSymbol() {
|
|
3566
|
-
return
|
|
3574
|
+
return le.getMetaDataSymbol();
|
|
3567
3575
|
}
|
|
3568
3576
|
}
|
|
3569
|
-
const
|
|
3577
|
+
const cn = `
|
|
3570
3578
|
`;
|
|
3571
3579
|
function un(r, e) {
|
|
3572
3580
|
let t = "";
|
|
3573
|
-
return e.format && e.indentBy.length > 0 && (t =
|
|
3581
|
+
return e.format && e.indentBy.length > 0 && (t = cn), Ye(r, e, "", t);
|
|
3574
3582
|
}
|
|
3575
|
-
function
|
|
3583
|
+
function Ye(r, e, t, s) {
|
|
3576
3584
|
let n = "", o = !1;
|
|
3577
3585
|
for (let i = 0; i < r.length; i++) {
|
|
3578
|
-
const
|
|
3586
|
+
const c = r[i], a = dn(c);
|
|
3579
3587
|
if (a === void 0) continue;
|
|
3580
3588
|
let l = "";
|
|
3581
3589
|
if (t.length === 0 ? l = a : l = `${t}.${a}`, a === e.textNodeName) {
|
|
3582
|
-
let
|
|
3583
|
-
|
|
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;
|
|
3584
3592
|
continue;
|
|
3585
3593
|
} else if (a === e.cdataPropName) {
|
|
3586
|
-
o && (n += s), n += `<![CDATA[${
|
|
3594
|
+
o && (n += s), n += `<![CDATA[${c[a][0][e.textNodeName]}]]>`, o = !1;
|
|
3587
3595
|
continue;
|
|
3588
3596
|
} else if (a === e.commentPropName) {
|
|
3589
|
-
n += s + `<!--${
|
|
3597
|
+
n += s + `<!--${c[a][0][e.textNodeName]}-->`, o = !0;
|
|
3590
3598
|
continue;
|
|
3591
3599
|
} else if (a[0] === "?") {
|
|
3592
|
-
const
|
|
3593
|
-
let
|
|
3594
|
-
|
|
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;
|
|
3595
3603
|
continue;
|
|
3596
3604
|
}
|
|
3597
|
-
let
|
|
3598
|
-
|
|
3599
|
-
const
|
|
3600
|
-
e.unpairedTags.indexOf(a) !== -1 ? e.suppressUnpairedNode ? n +=
|
|
3605
|
+
let h = s;
|
|
3606
|
+
h !== "" && (h += e.indentBy);
|
|
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;
|
|
3601
3609
|
}
|
|
3602
3610
|
return n;
|
|
3603
3611
|
}
|
|
3604
|
-
function
|
|
3612
|
+
function dn(r) {
|
|
3605
3613
|
const e = Object.keys(r);
|
|
3606
3614
|
for (let t = 0; t < e.length; t++) {
|
|
3607
3615
|
const s = e[t];
|
|
@@ -3615,18 +3623,18 @@ function Re(r, e) {
|
|
|
3615
3623
|
for (let s in r) {
|
|
3616
3624
|
if (!r.hasOwnProperty(s)) continue;
|
|
3617
3625
|
let n = e.attributeValueProcessor(s, r[s]);
|
|
3618
|
-
n =
|
|
3626
|
+
n = Ge(n, e), n === !0 && e.suppressBooleanAttributes ? t += ` ${s.substr(e.attributeNamePrefix.length)}` : t += ` ${s.substr(e.attributeNamePrefix.length)}="${n}"`;
|
|
3619
3627
|
}
|
|
3620
3628
|
return t;
|
|
3621
3629
|
}
|
|
3622
|
-
function
|
|
3630
|
+
function fn(r, e) {
|
|
3623
3631
|
r = r.substr(0, r.length - e.textNodeName.length - 1);
|
|
3624
3632
|
let t = r.substr(r.lastIndexOf(".") + 1);
|
|
3625
3633
|
for (let s in e.stopNodes)
|
|
3626
3634
|
if (e.stopNodes[s] === r || e.stopNodes[s] === "*." + t) return !0;
|
|
3627
3635
|
return !1;
|
|
3628
3636
|
}
|
|
3629
|
-
function
|
|
3637
|
+
function Ge(r, e) {
|
|
3630
3638
|
if (r && r.length > 0 && e.processEntities)
|
|
3631
3639
|
for (let t = 0; t < e.entities.length; t++) {
|
|
3632
3640
|
const s = e.entities[t];
|
|
@@ -3634,7 +3642,7 @@ function Ze(r, e) {
|
|
|
3634
3642
|
}
|
|
3635
3643
|
return r;
|
|
3636
3644
|
}
|
|
3637
|
-
const
|
|
3645
|
+
const hn = {
|
|
3638
3646
|
attributeNamePrefix: "@_",
|
|
3639
3647
|
attributesGroupName: !1,
|
|
3640
3648
|
textNodeName: "#text",
|
|
@@ -3668,21 +3676,21 @@ const fn = {
|
|
|
3668
3676
|
// transformAttributeName: false,
|
|
3669
3677
|
oneListGroup: !1
|
|
3670
3678
|
};
|
|
3671
|
-
function
|
|
3672
|
-
this.options = Object.assign({},
|
|
3679
|
+
function ne(r) {
|
|
3680
|
+
this.options = Object.assign({}, hn, r), this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
|
|
3673
3681
|
return !1;
|
|
3674
|
-
} : (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 = `>
|
|
3675
3683
|
`, this.newLine = `
|
|
3676
3684
|
`) : (this.indentate = function() {
|
|
3677
3685
|
return "";
|
|
3678
3686
|
}, this.tagEndChar = ">", this.newLine = "");
|
|
3679
3687
|
}
|
|
3680
|
-
|
|
3688
|
+
ne.prototype.build = function(r) {
|
|
3681
3689
|
return this.options.preserveOrder ? un(r, this.options) : (Array.isArray(r) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (r = {
|
|
3682
3690
|
[this.options.arrayNodeName]: r
|
|
3683
3691
|
}), this.j2x(r, 0, []).val);
|
|
3684
3692
|
};
|
|
3685
|
-
|
|
3693
|
+
ne.prototype.j2x = function(r, e, t) {
|
|
3686
3694
|
let s = "", n = "";
|
|
3687
3695
|
const o = t.join(".");
|
|
3688
3696
|
for (let i in r)
|
|
@@ -3694,51 +3702,51 @@ se.prototype.j2x = function(r, e, t) {
|
|
|
3694
3702
|
else if (r[i] instanceof Date)
|
|
3695
3703
|
n += this.buildTextValNode(r[i], i, "", e);
|
|
3696
3704
|
else if (typeof r[i] != "object") {
|
|
3697
|
-
const
|
|
3698
|
-
if (
|
|
3699
|
-
s += this.buildAttrPairStr(
|
|
3700
|
-
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)
|
|
3701
3709
|
if (i === this.options.textNodeName) {
|
|
3702
3710
|
let a = this.options.tagValueProcessor(i, "" + r[i]);
|
|
3703
3711
|
n += this.replaceEntitiesValue(a);
|
|
3704
3712
|
} else
|
|
3705
3713
|
n += this.buildTextValNode(r[i], i, "", e);
|
|
3706
3714
|
} else if (Array.isArray(r[i])) {
|
|
3707
|
-
const
|
|
3715
|
+
const c = r[i].length;
|
|
3708
3716
|
let a = "", l = "";
|
|
3709
|
-
for (let
|
|
3710
|
-
const
|
|
3711
|
-
if (!(typeof
|
|
3717
|
+
for (let h = 0; h < c; h++) {
|
|
3718
|
+
const f = r[i][h];
|
|
3719
|
+
if (!(typeof f > "u")) if (f === null)
|
|
3712
3720
|
i[0] === "?" ? n += this.indentate(e) + "<" + i + "?" + this.tagEndChar : n += this.indentate(e) + "<" + i + "/" + this.tagEndChar;
|
|
3713
|
-
else if (typeof
|
|
3721
|
+
else if (typeof f == "object")
|
|
3714
3722
|
if (this.options.oneListGroup) {
|
|
3715
|
-
const
|
|
3716
|
-
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);
|
|
3717
3725
|
} else
|
|
3718
|
-
a += this.processTextOrObjNode(
|
|
3726
|
+
a += this.processTextOrObjNode(f, i, e, t);
|
|
3719
3727
|
else if (this.options.oneListGroup) {
|
|
3720
|
-
let
|
|
3721
|
-
|
|
3728
|
+
let E = this.options.tagValueProcessor(i, f);
|
|
3729
|
+
E = this.replaceEntitiesValue(E), a += E;
|
|
3722
3730
|
} else
|
|
3723
|
-
a += this.buildTextValNode(
|
|
3731
|
+
a += this.buildTextValNode(f, i, "", e);
|
|
3724
3732
|
}
|
|
3725
3733
|
this.options.oneListGroup && (a = this.buildObjectNode(a, i, l, e)), n += a;
|
|
3726
3734
|
} else if (this.options.attributesGroupName && i === this.options.attributesGroupName) {
|
|
3727
|
-
const
|
|
3735
|
+
const c = Object.keys(r[i]), a = c.length;
|
|
3728
3736
|
for (let l = 0; l < a; l++)
|
|
3729
|
-
s += this.buildAttrPairStr(
|
|
3737
|
+
s += this.buildAttrPairStr(c[l], "" + r[i][c[l]]);
|
|
3730
3738
|
} else
|
|
3731
3739
|
n += this.processTextOrObjNode(r[i], i, e, t);
|
|
3732
3740
|
return { attrStr: s, val: n };
|
|
3733
3741
|
};
|
|
3734
|
-
|
|
3742
|
+
ne.prototype.buildAttrPairStr = function(r, e) {
|
|
3735
3743
|
return e = this.options.attributeValueProcessor(r, "" + e), e = this.replaceEntitiesValue(e), this.options.suppressBooleanAttributes && e === "true" ? " " + r : " " + r + '="' + e + '"';
|
|
3736
3744
|
};
|
|
3737
|
-
function
|
|
3745
|
+
function pn(r, e, t, s) {
|
|
3738
3746
|
const n = this.j2x(r, t + 1, s.concat(e));
|
|
3739
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);
|
|
3740
3748
|
}
|
|
3741
|
-
|
|
3749
|
+
ne.prototype.buildObjectNode = function(r, e, t, s) {
|
|
3742
3750
|
if (r === "")
|
|
3743
3751
|
return e[0] === "?" ? this.indentate(s) + "<" + e + t + "?" + this.tagEndChar : this.indentate(s) + "<" + e + t + this.closeTag(e) + this.tagEndChar;
|
|
3744
3752
|
{
|
|
@@ -3746,11 +3754,11 @@ se.prototype.buildObjectNode = function(r, e, t, s) {
|
|
|
3746
3754
|
return e[0] === "?" && (o = "?", n = ""), (t || t === "") && r.indexOf("<") === -1 ? this.indentate(s) + "<" + e + t + o + ">" + r + n : this.options.commentPropName !== !1 && e === this.options.commentPropName && o.length === 0 ? this.indentate(s) + `<!--${r}-->` + this.newLine : this.indentate(s) + "<" + e + t + o + this.tagEndChar + r + this.indentate(s) + n;
|
|
3747
3755
|
}
|
|
3748
3756
|
};
|
|
3749
|
-
|
|
3757
|
+
ne.prototype.closeTag = function(r) {
|
|
3750
3758
|
let e = "";
|
|
3751
3759
|
return this.options.unpairedTags.indexOf(r) !== -1 ? this.options.suppressUnpairedNode || (e = "/") : this.options.suppressEmptyNode ? e = "/" : e = `></${r}`, e;
|
|
3752
3760
|
};
|
|
3753
|
-
|
|
3761
|
+
ne.prototype.buildTextValNode = function(r, e, t, s) {
|
|
3754
3762
|
if (this.options.cdataPropName !== !1 && e === this.options.cdataPropName)
|
|
3755
3763
|
return this.indentate(s) + `<![CDATA[${r}]]>` + this.newLine;
|
|
3756
3764
|
if (this.options.commentPropName !== !1 && e === this.options.commentPropName)
|
|
@@ -3762,7 +3770,7 @@ se.prototype.buildTextValNode = function(r, e, t, s) {
|
|
|
3762
3770
|
return n = this.replaceEntitiesValue(n), n === "" ? this.indentate(s) + "<" + e + t + this.closeTag(e) + this.tagEndChar : this.indentate(s) + "<" + e + t + ">" + n + "</" + e + this.tagEndChar;
|
|
3763
3771
|
}
|
|
3764
3772
|
};
|
|
3765
|
-
|
|
3773
|
+
ne.prototype.replaceEntitiesValue = function(r) {
|
|
3766
3774
|
if (r && r.length > 0 && this.options.processEntities)
|
|
3767
3775
|
for (let e = 0; e < this.options.entities.length; e++) {
|
|
3768
3776
|
const t = this.options.entities[e];
|
|
@@ -3770,14 +3778,14 @@ se.prototype.replaceEntitiesValue = function(r) {
|
|
|
3770
3778
|
}
|
|
3771
3779
|
return r;
|
|
3772
3780
|
};
|
|
3773
|
-
function
|
|
3781
|
+
function gn(r) {
|
|
3774
3782
|
return this.options.indentBy.repeat(r);
|
|
3775
3783
|
}
|
|
3776
|
-
function
|
|
3784
|
+
function mn(r) {
|
|
3777
3785
|
return r.startsWith(this.options.attributeNamePrefix) && r !== this.options.textNodeName ? r.substr(this.attrPrefixLen) : !1;
|
|
3778
3786
|
}
|
|
3779
|
-
const
|
|
3780
|
-
validate:
|
|
3787
|
+
const bn = {
|
|
3788
|
+
validate: qe
|
|
3781
3789
|
}, yn = {
|
|
3782
3790
|
ignoreAttributes: !1,
|
|
3783
3791
|
// 保留属性
|
|
@@ -3813,7 +3821,7 @@ const mn = {
|
|
|
3813
3821
|
// 停止解析的节点
|
|
3814
3822
|
alwaysCreateTextNode: !1
|
|
3815
3823
|
// 仅在有文本时创建文本节点
|
|
3816
|
-
},
|
|
3824
|
+
}, vn = {
|
|
3817
3825
|
ignoreAttributes: !1,
|
|
3818
3826
|
attributeNamePrefix: "@_",
|
|
3819
3827
|
textNodeName: "#text",
|
|
@@ -3825,9 +3833,9 @@ const mn = {
|
|
|
3825
3833
|
// 不抑制空节点
|
|
3826
3834
|
suppressBooleanAttributes: !1,
|
|
3827
3835
|
suppressUnpairedNode: !1
|
|
3828
|
-
},
|
|
3836
|
+
}, _n = (r) => {
|
|
3829
3837
|
try {
|
|
3830
|
-
const e =
|
|
3838
|
+
const e = bn.validate(r, {
|
|
3831
3839
|
allowBooleanAttributes: !0
|
|
3832
3840
|
});
|
|
3833
3841
|
return e === !0 ? { valid: !0 } : {
|
|
@@ -3840,9 +3848,9 @@ const mn = {
|
|
|
3840
3848
|
error: e instanceof Error ? e.message : "Unknown validation error"
|
|
3841
3849
|
};
|
|
3842
3850
|
}
|
|
3843
|
-
},
|
|
3851
|
+
}, Ze = (r, e) => {
|
|
3844
3852
|
try {
|
|
3845
|
-
return new
|
|
3853
|
+
return new ln({
|
|
3846
3854
|
...yn,
|
|
3847
3855
|
...e
|
|
3848
3856
|
}).parse(r);
|
|
@@ -3851,10 +3859,10 @@ const mn = {
|
|
|
3851
3859
|
`XML 解析失败: ${t instanceof Error ? t.message : "Unknown error"}`
|
|
3852
3860
|
);
|
|
3853
3861
|
}
|
|
3854
|
-
},
|
|
3862
|
+
}, Te = (r, e) => {
|
|
3855
3863
|
try {
|
|
3856
|
-
let s = new
|
|
3857
|
-
...
|
|
3864
|
+
let s = new ne({
|
|
3865
|
+
...vn,
|
|
3858
3866
|
format: e?.format ?? !0,
|
|
3859
3867
|
indentBy: e?.indentBy ?? " "
|
|
3860
3868
|
}).build(r);
|
|
@@ -3865,66 +3873,66 @@ const mn = {
|
|
|
3865
3873
|
`XML 构建失败: ${t instanceof Error ? t.message : "Unknown error"}`
|
|
3866
3874
|
);
|
|
3867
3875
|
}
|
|
3868
|
-
},
|
|
3869
|
-
const 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);
|
|
3870
3878
|
return Array.isArray(t) ? _e(t, {
|
|
3871
3879
|
indent: e?.indentBy
|
|
3872
|
-
}) :
|
|
3880
|
+
}) : Te(t, e);
|
|
3873
3881
|
}, _e = (r, e = {}) => {
|
|
3874
3882
|
const t = e.indent !== void 0 ? e.indent : " ", s = e.level || 0, n = e.format !== !1, o = n ? t.repeat(s) : "", i = n ? `
|
|
3875
3883
|
` : "";
|
|
3876
|
-
let
|
|
3884
|
+
let c = "";
|
|
3877
3885
|
for (const a of r) {
|
|
3878
3886
|
if (a["?xml"]) {
|
|
3879
|
-
const
|
|
3880
|
-
|
|
3887
|
+
const x = a[":@"] || {}, S = Object.entries(x).map(([X, Z]) => `${X.startsWith("@_") ? X.substring(2) : X}="${Z}"`).join(" ");
|
|
3888
|
+
c += `<?xml ${S}?>${i}`;
|
|
3881
3889
|
continue;
|
|
3882
3890
|
}
|
|
3883
3891
|
if (a["#comment"]) {
|
|
3884
|
-
const
|
|
3885
|
-
if (Array.isArray(
|
|
3886
|
-
const S =
|
|
3887
|
-
|
|
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}`;
|
|
3888
3896
|
}
|
|
3889
3897
|
continue;
|
|
3890
3898
|
}
|
|
3891
|
-
const l = Object.keys(a).find((
|
|
3899
|
+
const l = Object.keys(a).find((x) => !x.startsWith(":") && !x.startsWith("#") && !x.startsWith("__"));
|
|
3892
3900
|
if (!l) continue;
|
|
3893
|
-
const
|
|
3894
|
-
if (!Array.isArray(
|
|
3895
|
-
|
|
3901
|
+
const h = a[l], f = a[":@"] || {}, E = Object.entries(f).map(([x, S]) => `${x.startsWith("@_") ? x.substring(2) : x}="${S}"`).join(" "), _ = E ? " " + E : "";
|
|
3902
|
+
if (!Array.isArray(h) || h.length === 0) {
|
|
3903
|
+
c += `${o}<${l}${_}/>${i}`;
|
|
3896
3904
|
continue;
|
|
3897
3905
|
}
|
|
3898
|
-
const
|
|
3899
|
-
if (
|
|
3900
|
-
const
|
|
3901
|
-
if (
|
|
3902
|
-
const S =
|
|
3903
|
-
|
|
3906
|
+
const w = h.length === 1 && h[0]["#text"] !== void 0;
|
|
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}`;
|
|
3904
3912
|
}
|
|
3905
|
-
} else if (
|
|
3906
|
-
const
|
|
3907
|
-
|
|
3913
|
+
} else if (w) {
|
|
3914
|
+
const x = h[0]["#text"];
|
|
3915
|
+
c += `${o}<${l}${_}>${x}</${l}>${i}`;
|
|
3908
3916
|
} else
|
|
3909
|
-
|
|
3917
|
+
c += `${o}<${l}${_}>${i}`, c += _e(h, { indent: t, level: s + 1, format: n }), c += `${o}</${l}>${i}`;
|
|
3910
3918
|
}
|
|
3911
|
-
return
|
|
3912
|
-
},
|
|
3919
|
+
return c;
|
|
3920
|
+
}, kn = {
|
|
3913
3921
|
key: 0,
|
|
3914
3922
|
class: "xml-format__toolbar"
|
|
3915
|
-
},
|
|
3923
|
+
}, Nn = { class: "xml-format__actions" }, An = ["disabled"], wn = ["disabled"], Cn = ["disabled"], On = ["disabled"], Tn = ["disabled"], Pn = { class: "xml-format__info" }, $n = {
|
|
3916
3924
|
key: 0,
|
|
3917
3925
|
class: "xml-format__status xml-format__status--success"
|
|
3918
|
-
},
|
|
3926
|
+
}, Sn = {
|
|
3919
3927
|
key: 1,
|
|
3920
3928
|
class: "xml-format__status xml-format__status--error"
|
|
3921
|
-
},
|
|
3929
|
+
}, Bn = { class: "xml-format__content" }, In = {
|
|
3922
3930
|
key: 0,
|
|
3923
3931
|
class: "xml-format__error"
|
|
3924
|
-
},
|
|
3932
|
+
}, Vn = {
|
|
3925
3933
|
key: 1,
|
|
3926
3934
|
class: "xml-format__viewer"
|
|
3927
|
-
},
|
|
3935
|
+
}, Ln = /* @__PURE__ */ be({
|
|
3928
3936
|
__name: "index",
|
|
3929
3937
|
props: {
|
|
3930
3938
|
modelValue: { default: "" },
|
|
@@ -3938,7 +3946,7 @@ const mn = {
|
|
|
3938
3946
|
},
|
|
3939
3947
|
emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress", "format"],
|
|
3940
3948
|
setup(r, { expose: e, emit: t }) {
|
|
3941
|
-
|
|
3949
|
+
Ce((g) => ({
|
|
3942
3950
|
"0db40539": l.value.colors.border,
|
|
3943
3951
|
bd72d08a: l.value.colors.background,
|
|
3944
3952
|
"1738b57a": l.value.colors.text,
|
|
@@ -3954,182 +3962,182 @@ const mn = {
|
|
|
3954
3962
|
"61df294a": l.value.colors.error,
|
|
3955
3963
|
"3307322e": l.value.colors.errorBackground
|
|
3956
3964
|
}));
|
|
3957
|
-
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(() => {
|
|
3958
3966
|
if (!o.value || !Array.isArray(o.value)) return null;
|
|
3959
|
-
const
|
|
3960
|
-
if (!
|
|
3961
|
-
const
|
|
3962
|
-
return
|
|
3963
|
-
}),
|
|
3964
|
-
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()) {
|
|
3965
3973
|
i.value = "", o.value = null;
|
|
3966
3974
|
return;
|
|
3967
3975
|
}
|
|
3968
3976
|
try {
|
|
3969
|
-
const
|
|
3970
|
-
if (!
|
|
3971
|
-
i.value =
|
|
3977
|
+
const C = _n(g);
|
|
3978
|
+
if (!C.valid) {
|
|
3979
|
+
i.value = C.error || "Invalid XML", o.value = null;
|
|
3972
3980
|
return;
|
|
3973
3981
|
}
|
|
3974
|
-
o.value =
|
|
3975
|
-
|
|
3982
|
+
o.value = Ze(g), i.value = "", he(() => {
|
|
3983
|
+
O();
|
|
3976
3984
|
});
|
|
3977
|
-
} catch (
|
|
3978
|
-
i.value =
|
|
3985
|
+
} catch (C) {
|
|
3986
|
+
i.value = C instanceof Error ? C.message : "Unknown parse error", o.value = null;
|
|
3979
3987
|
}
|
|
3980
|
-
},
|
|
3981
|
-
|
|
3982
|
-
},
|
|
3983
|
-
const
|
|
3984
|
-
Array.isArray($) && $.forEach((
|
|
3985
|
-
const
|
|
3986
|
-
if (!
|
|
3987
|
-
const
|
|
3988
|
-
|
|
3989
|
-
const
|
|
3990
|
-
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);
|
|
3991
3999
|
});
|
|
3992
4000
|
};
|
|
3993
|
-
|
|
3994
|
-
const
|
|
3995
|
-
if (
|
|
3996
|
-
const
|
|
3997
|
-
|
|
3998
|
-
const
|
|
3999
|
-
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);
|
|
4000
4008
|
}
|
|
4001
|
-
}),
|
|
4002
|
-
},
|
|
4003
|
-
|
|
4009
|
+
}), c.value = g, n("expand-all");
|
|
4010
|
+
}, x = () => {
|
|
4011
|
+
c.value.clear(), n("collapse-all");
|
|
4004
4012
|
}, S = async () => {
|
|
4005
4013
|
if (!(!a.value || !o.value))
|
|
4006
4014
|
try {
|
|
4007
|
-
const
|
|
4008
|
-
await navigator.clipboard.writeText(
|
|
4009
|
-
} catch (
|
|
4010
|
-
const
|
|
4011
|
-
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);
|
|
4012
4020
|
}
|
|
4013
|
-
},
|
|
4021
|
+
}, X = () => {
|
|
4014
4022
|
if (!(!a.value || !o.value))
|
|
4015
4023
|
try {
|
|
4016
|
-
const
|
|
4017
|
-
n("update:modelValue",
|
|
4018
|
-
} catch (
|
|
4019
|
-
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);
|
|
4020
4028
|
}
|
|
4021
4029
|
}, Z = () => {
|
|
4022
4030
|
if (a.value)
|
|
4023
4031
|
try {
|
|
4024
|
-
const
|
|
4032
|
+
const g = xn(s.modelValue, {
|
|
4025
4033
|
format: !0,
|
|
4026
4034
|
indentBy: " "
|
|
4027
4035
|
});
|
|
4028
|
-
n("update:modelValue",
|
|
4029
|
-
} catch (
|
|
4030
|
-
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);
|
|
4031
4039
|
}
|
|
4032
|
-
},
|
|
4040
|
+
}, p = async (g) => {
|
|
4033
4041
|
try {
|
|
4034
|
-
const
|
|
4035
|
-
await navigator.clipboard.writeText(
|
|
4036
|
-
} catch (
|
|
4037
|
-
const $ =
|
|
4038
|
-
n("copy-error", $), console.error("Failed to copy value:",
|
|
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);
|
|
4039
4047
|
}
|
|
4040
4048
|
};
|
|
4041
|
-
return
|
|
4042
|
-
|
|
4049
|
+
return Ue(() => s.modelValue, (g) => {
|
|
4050
|
+
_(g);
|
|
4043
4051
|
}, { immediate: !0 }), e({
|
|
4044
4052
|
// 核心操作方法
|
|
4045
4053
|
copyXml: S,
|
|
4046
|
-
compressSource:
|
|
4054
|
+
compressSource: X,
|
|
4047
4055
|
formatSource: Z,
|
|
4048
|
-
expandAll:
|
|
4049
|
-
collapseAll:
|
|
4050
|
-
toggleExpand:
|
|
4056
|
+
expandAll: O,
|
|
4057
|
+
collapseAll: x,
|
|
4058
|
+
toggleExpand: w,
|
|
4051
4059
|
// 状态访问方法
|
|
4052
4060
|
isValidXml: () => a.value,
|
|
4053
4061
|
getParsedXml: () => o.value,
|
|
4054
|
-
getExpandedNodes: () =>
|
|
4062
|
+
getExpandedNodes: () => c.value,
|
|
4055
4063
|
getParseError: () => i.value,
|
|
4056
4064
|
// 工具方法
|
|
4057
|
-
parseXmlString: (
|
|
4058
|
-
copyValue: (
|
|
4059
|
-
}), (
|
|
4060
|
-
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}`])
|
|
4061
4069
|
}, [
|
|
4062
|
-
|
|
4063
|
-
y("div",
|
|
4070
|
+
g.showToolbar ? (k(), A("div", kn, [
|
|
4071
|
+
y("div", Nn, [
|
|
4064
4072
|
y("button", {
|
|
4065
4073
|
class: "xml-format__btn xml-format__btn--primary",
|
|
4066
4074
|
onClick: S,
|
|
4067
4075
|
disabled: !a.value,
|
|
4068
4076
|
title: "Copy XML"
|
|
4069
|
-
}, " 📋 Copy ", 8,
|
|
4077
|
+
}, " 📋 Copy ", 8, An),
|
|
4070
4078
|
y("button", {
|
|
4071
4079
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
4072
|
-
onClick:
|
|
4080
|
+
onClick: O,
|
|
4073
4081
|
disabled: !a.value,
|
|
4074
4082
|
title: "Expand All"
|
|
4075
|
-
}, " ⬇️ Expand All ", 8,
|
|
4083
|
+
}, " ⬇️ Expand All ", 8, wn),
|
|
4076
4084
|
y("button", {
|
|
4077
4085
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
4078
|
-
onClick:
|
|
4086
|
+
onClick: x,
|
|
4079
4087
|
disabled: !a.value,
|
|
4080
4088
|
title: "Collapse All"
|
|
4081
|
-
}, " ➡️ Collapse All ", 8,
|
|
4089
|
+
}, " ➡️ Collapse All ", 8, Cn),
|
|
4082
4090
|
y("button", {
|
|
4083
4091
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
4084
|
-
onClick:
|
|
4092
|
+
onClick: X,
|
|
4085
4093
|
disabled: !a.value,
|
|
4086
4094
|
title: "Compress XML"
|
|
4087
|
-
}, " 📦 Compress ", 8,
|
|
4095
|
+
}, " 📦 Compress ", 8, On),
|
|
4088
4096
|
y("button", {
|
|
4089
4097
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
4090
4098
|
onClick: Z,
|
|
4091
4099
|
disabled: !a.value,
|
|
4092
4100
|
title: "Format XML"
|
|
4093
|
-
}, " ✨ Format ", 8,
|
|
4101
|
+
}, " ✨ Format ", 8, Tn)
|
|
4094
4102
|
]),
|
|
4095
|
-
y("div",
|
|
4096
|
-
a.value ? (
|
|
4103
|
+
y("div", Pn, [
|
|
4104
|
+
a.value ? (k(), A("span", $n, " ✅ Valid XML ")) : (k(), A("span", Sn, " ❌ Invalid XML "))
|
|
4097
4105
|
])
|
|
4098
|
-
])) :
|
|
4099
|
-
y("div",
|
|
4100
|
-
a.value ? (
|
|
4101
|
-
|
|
4106
|
+
])) : H("", !0),
|
|
4107
|
+
y("div", Bn, [
|
|
4108
|
+
a.value ? (k(), A("div", Vn, [
|
|
4109
|
+
f.value ? (k(), A("div", {
|
|
4102
4110
|
key: 0,
|
|
4103
4111
|
class: "xml-declaration",
|
|
4104
4112
|
style: N({ color: l.value.colors.xmlDeclaration })
|
|
4105
|
-
}, B(
|
|
4106
|
-
(
|
|
4107
|
-
key:
|
|
4113
|
+
}, B(f.value), 5)) : H("", !0),
|
|
4114
|
+
(k(!0), A(re, null, ae(E.value, ($, R) => (k(), Fe(pr, {
|
|
4115
|
+
key: R,
|
|
4108
4116
|
node: $,
|
|
4109
|
-
index:
|
|
4117
|
+
index: R,
|
|
4110
4118
|
level: 0,
|
|
4111
|
-
expanded:
|
|
4119
|
+
expanded: c.value,
|
|
4112
4120
|
theme: l.value,
|
|
4113
|
-
onToggleExpand:
|
|
4114
|
-
onCopy:
|
|
4121
|
+
onToggleExpand: w,
|
|
4122
|
+
onCopy: p
|
|
4115
4123
|
}, null, 8, ["node", "index", "expanded", "theme"]))), 128))
|
|
4116
|
-
])) : (
|
|
4117
|
-
|
|
4124
|
+
])) : (k(), A("div", In, [
|
|
4125
|
+
C[0] || (C[0] = y("h4", null, "XML Parse Error:", -1)),
|
|
4118
4126
|
y("pre", null, B(i.value), 1)
|
|
4119
4127
|
]))
|
|
4120
4128
|
])
|
|
4121
4129
|
], 2));
|
|
4122
4130
|
}
|
|
4123
|
-
}),
|
|
4124
|
-
|
|
4131
|
+
}), Fn = /* @__PURE__ */ ye(Ln, [["__scopeId", "data-v-f9125514"]]), Rn = [zt], jn = (r) => {
|
|
4132
|
+
Rn.forEach((e) => {
|
|
4125
4133
|
const t = e.name || e.__name || "UnknownComponent";
|
|
4126
4134
|
r.component(t, e);
|
|
4127
4135
|
});
|
|
4128
|
-
},
|
|
4136
|
+
}, Xn = {
|
|
4129
4137
|
install: jn
|
|
4130
4138
|
};
|
|
4131
4139
|
export {
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4140
|
+
zt as JsonFormat,
|
|
4141
|
+
Fn as XmlFormat,
|
|
4142
|
+
Xn as default
|
|
4135
4143
|
};
|