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