zudoku 0.4.2-dev.10 → 0.4.2-dev.12
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/app/demo.js +1 -1
- package/dist/app/demo.js.map +1 -1
- package/dist/app/main.js +2 -0
- package/dist/app/main.js.map +1 -1
- package/lib/{index-pI9JkN46.js → assets/index-B9EWVYfo.js} +843 -818
- package/lib/assets/index-B9EWVYfo.js.map +1 -0
- package/lib/assets/{worker-CzHUifWA.js → worker-4PRCYVz5.js} +6570 -5639
- package/lib/assets/worker-4PRCYVz5.js.map +1 -0
- package/lib/{assets/index-BPdJm2ty.js → index-CLd8ycZz.js} +862 -837
- package/lib/index-CLd8ycZz.js.map +1 -0
- package/lib/zudoku.openapi-worker.js +6768 -5837
- package/lib/zudoku.openapi-worker.js.map +1 -1
- package/package.json +3 -3
- package/src/app/demo.tsx +1 -1
- package/src/app/main.tsx +4 -0
- package/lib/assets/index-BPdJm2ty.js.map +0 -1
- package/lib/assets/worker-CzHUifWA.js.map +0 -1
- package/lib/index-pI9JkN46.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const ut = Symbol.for("yaml.alias"), rt = Symbol.for("yaml.document"),
|
|
2
|
-
function
|
|
1
|
+
const ut = Symbol.for("yaml.alias"), rt = Symbol.for("yaml.document"), V = Symbol.for("yaml.map"), Kt = Symbol.for("yaml.pair"), R = Symbol.for("yaml.scalar"), fe = Symbol.for("yaml.seq"), K = Symbol.for("yaml.node.type"), Z = (s) => !!s && typeof s == "object" && s[K] === ut, ue = (s) => !!s && typeof s == "object" && s[K] === rt, he = (s) => !!s && typeof s == "object" && s[K] === V, I = (s) => !!s && typeof s == "object" && s[K] === Kt, E = (s) => !!s && typeof s == "object" && s[K] === R, de = (s) => !!s && typeof s == "object" && s[K] === fe;
|
|
2
|
+
function L(s) {
|
|
3
3
|
if (s && typeof s == "object")
|
|
4
4
|
switch (s[K]) {
|
|
5
|
-
case
|
|
5
|
+
case V:
|
|
6
6
|
case fe:
|
|
7
7
|
return !0;
|
|
8
8
|
}
|
|
@@ -12,27 +12,27 @@ function $(s) {
|
|
|
12
12
|
if (s && typeof s == "object")
|
|
13
13
|
switch (s[K]) {
|
|
14
14
|
case ut:
|
|
15
|
-
case Y:
|
|
16
15
|
case V:
|
|
16
|
+
case R:
|
|
17
17
|
case fe:
|
|
18
18
|
return !0;
|
|
19
19
|
}
|
|
20
20
|
return !1;
|
|
21
21
|
}
|
|
22
|
-
const $s = (s) => (
|
|
22
|
+
const $s = (s) => (E(s) || L(s)) && !!s.anchor, M = Symbol("break visit"), Dt = Symbol("skip children"), U = Symbol("remove node");
|
|
23
23
|
function J(s, e) {
|
|
24
|
-
const t =
|
|
24
|
+
const t = qt(e);
|
|
25
25
|
ue(s) ? se(null, s.contents, t, Object.freeze([s])) === U && (s.contents = null) : se(null, s, t, Object.freeze([]));
|
|
26
26
|
}
|
|
27
27
|
J.BREAK = M;
|
|
28
|
-
J.SKIP =
|
|
28
|
+
J.SKIP = Dt;
|
|
29
29
|
J.REMOVE = U;
|
|
30
30
|
function se(s, e, t, n) {
|
|
31
31
|
const i = Ut(s, e, t, n);
|
|
32
|
-
if ($(i) ||
|
|
33
|
-
return
|
|
32
|
+
if ($(i) || I(i))
|
|
33
|
+
return Ft(s, n, i), se(s, i, t, n);
|
|
34
34
|
if (typeof i != "symbol") {
|
|
35
|
-
if (
|
|
35
|
+
if (L(e)) {
|
|
36
36
|
n = Object.freeze(n.concat(e));
|
|
37
37
|
for (let r = 0; r < e.items.length; ++r) {
|
|
38
38
|
const o = se(r, e.items[r], t, n);
|
|
@@ -44,7 +44,7 @@ function se(s, e, t, n) {
|
|
|
44
44
|
o === U && (e.items.splice(r, 1), r -= 1);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
} else if (
|
|
47
|
+
} else if (I(e)) {
|
|
48
48
|
n = Object.freeze(n.concat(e));
|
|
49
49
|
const r = se("key", e.key, t, n);
|
|
50
50
|
if (r === M)
|
|
@@ -59,18 +59,18 @@ function se(s, e, t, n) {
|
|
|
59
59
|
return i;
|
|
60
60
|
}
|
|
61
61
|
async function De(s, e) {
|
|
62
|
-
const t =
|
|
62
|
+
const t = qt(e);
|
|
63
63
|
ue(s) ? await ne(null, s.contents, t, Object.freeze([s])) === U && (s.contents = null) : await ne(null, s, t, Object.freeze([]));
|
|
64
64
|
}
|
|
65
65
|
De.BREAK = M;
|
|
66
|
-
De.SKIP =
|
|
66
|
+
De.SKIP = Dt;
|
|
67
67
|
De.REMOVE = U;
|
|
68
68
|
async function ne(s, e, t, n) {
|
|
69
69
|
const i = await Ut(s, e, t, n);
|
|
70
|
-
if ($(i) ||
|
|
71
|
-
return
|
|
70
|
+
if ($(i) || I(i))
|
|
71
|
+
return Ft(s, n, i), ne(s, i, t, n);
|
|
72
72
|
if (typeof i != "symbol") {
|
|
73
|
-
if (
|
|
73
|
+
if (L(e)) {
|
|
74
74
|
n = Object.freeze(n.concat(e));
|
|
75
75
|
for (let r = 0; r < e.items.length; ++r) {
|
|
76
76
|
const o = await ne(r, e.items[r], t, n);
|
|
@@ -82,7 +82,7 @@ async function ne(s, e, t, n) {
|
|
|
82
82
|
o === U && (e.items.splice(r, 1), r -= 1);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
} else if (
|
|
85
|
+
} else if (I(e)) {
|
|
86
86
|
n = Object.freeze(n.concat(e));
|
|
87
87
|
const r = await ne("key", e.key, t, n);
|
|
88
88
|
if (r === M)
|
|
@@ -96,7 +96,7 @@ async function ne(s, e, t, n) {
|
|
|
96
96
|
}
|
|
97
97
|
return i;
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function qt(s) {
|
|
100
100
|
return typeof s == "object" && (s.Collection || s.Node || s.Value) ? Object.assign({
|
|
101
101
|
Alias: s.Node,
|
|
102
102
|
Map: s.Node,
|
|
@@ -119,18 +119,18 @@ function Ut(s, e, t, n) {
|
|
|
119
119
|
return (i = t.Map) == null ? void 0 : i.call(t, s, e, n);
|
|
120
120
|
if (de(e))
|
|
121
121
|
return (r = t.Seq) == null ? void 0 : r.call(t, s, e, n);
|
|
122
|
-
if (
|
|
122
|
+
if (I(e))
|
|
123
123
|
return (o = t.Pair) == null ? void 0 : o.call(t, s, e, n);
|
|
124
|
-
if (
|
|
124
|
+
if (E(e))
|
|
125
125
|
return (l = t.Scalar) == null ? void 0 : l.call(t, s, e, n);
|
|
126
126
|
if (Z(e))
|
|
127
127
|
return (a = t.Alias) == null ? void 0 : a.call(t, s, e, n);
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function Ft(s, e, t) {
|
|
130
130
|
const n = e[e.length - 1];
|
|
131
|
-
if (
|
|
131
|
+
if (L(n))
|
|
132
132
|
n.items[s] = t;
|
|
133
|
-
else if (
|
|
133
|
+
else if (I(n))
|
|
134
134
|
s === "key" ? n.key = t : n.value = t;
|
|
135
135
|
else if (ue(n))
|
|
136
136
|
n.contents = t;
|
|
@@ -139,14 +139,14 @@ function Rt(s, e, t) {
|
|
|
139
139
|
throw new Error(`Cannot replace node with ${i} parent`);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
const
|
|
142
|
+
const _s = {
|
|
143
143
|
"!": "%21",
|
|
144
144
|
",": "%2C",
|
|
145
145
|
"[": "%5B",
|
|
146
146
|
"]": "%5D",
|
|
147
147
|
"{": "%7B",
|
|
148
148
|
"}": "%7D"
|
|
149
|
-
},
|
|
149
|
+
}, Cs = (s) => s.replace(/[!,[\]{}]/g, (e) => _s[e]);
|
|
150
150
|
class B {
|
|
151
151
|
constructor(e, t) {
|
|
152
152
|
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, B.defaultYaml, e), this.tags = Object.assign({}, B.defaultTags, t);
|
|
@@ -236,7 +236,7 @@ class B {
|
|
|
236
236
|
tagString(e) {
|
|
237
237
|
for (const [t, n] of Object.entries(this.tags))
|
|
238
238
|
if (e.startsWith(n))
|
|
239
|
-
return t +
|
|
239
|
+
return t + Cs(e.substring(n.length));
|
|
240
240
|
return e[0] === "!" ? e : `!<${e}>`;
|
|
241
241
|
}
|
|
242
242
|
toString(e) {
|
|
@@ -257,14 +257,14 @@ class B {
|
|
|
257
257
|
}
|
|
258
258
|
B.defaultYaml = { explicit: !1, version: "1.2" };
|
|
259
259
|
B.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
260
|
-
function
|
|
260
|
+
function Rt(s) {
|
|
261
261
|
if (/[\x00-\x19\s,[\]{}]/.test(s)) {
|
|
262
262
|
const t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;
|
|
263
263
|
throw new Error(t);
|
|
264
264
|
}
|
|
265
265
|
return !0;
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function Vt(s) {
|
|
268
268
|
const e = /* @__PURE__ */ new Set();
|
|
269
269
|
return J(s, {
|
|
270
270
|
Value(t, n) {
|
|
@@ -284,7 +284,7 @@ function vs(s, e) {
|
|
|
284
284
|
let i = null;
|
|
285
285
|
return {
|
|
286
286
|
onAnchor: (r) => {
|
|
287
|
-
t.push(r), i || (i =
|
|
287
|
+
t.push(r), i || (i = Vt(s));
|
|
288
288
|
const o = Jt(e, i);
|
|
289
289
|
return i.add(o), o;
|
|
290
290
|
},
|
|
@@ -296,7 +296,7 @@ function vs(s, e) {
|
|
|
296
296
|
setAnchors: () => {
|
|
297
297
|
for (const r of t) {
|
|
298
298
|
const o = n.get(r);
|
|
299
|
-
if (typeof o == "object" && o.anchor && (
|
|
299
|
+
if (typeof o == "object" && o.anchor && (E(o.node) || L(o.node)))
|
|
300
300
|
o.node.anchor = o.anchor;
|
|
301
301
|
else {
|
|
302
302
|
const l = new Error("Failed to resolve repeated object (this should not happen)");
|
|
@@ -331,9 +331,9 @@ function ie(s, e, t, n) {
|
|
|
331
331
|
}
|
|
332
332
|
return s.call(e, t, n);
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function j(s, e, t) {
|
|
335
335
|
if (Array.isArray(s))
|
|
336
|
-
return s.map((n, i) =>
|
|
336
|
+
return s.map((n, i) => j(n, String(i), t));
|
|
337
337
|
if (s && typeof s.toJSON == "function") {
|
|
338
338
|
if (!t || !$s(s))
|
|
339
339
|
return s.toJSON(e, t);
|
|
@@ -366,14 +366,14 @@ class ht {
|
|
|
366
366
|
mapAsMap: t === !0,
|
|
367
367
|
mapKeyWarned: !1,
|
|
368
368
|
maxAliasCount: typeof n == "number" ? n : 100
|
|
369
|
-
}, l =
|
|
369
|
+
}, l = j(this, "", o);
|
|
370
370
|
if (typeof i == "function")
|
|
371
371
|
for (const { count: a, res: c } of o.anchors.values())
|
|
372
372
|
i(c, a);
|
|
373
373
|
return typeof r == "function" ? ie(r, { "": l }, "", l) : l;
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
class
|
|
376
|
+
class qe extends ht {
|
|
377
377
|
constructor(e) {
|
|
378
378
|
super(ut), this.source = e, Object.defineProperty(this, "tag", {
|
|
379
379
|
set() {
|
|
@@ -404,11 +404,11 @@ class Ke extends ht {
|
|
|
404
404
|
throw new ReferenceError(a);
|
|
405
405
|
}
|
|
406
406
|
let l = n.get(o);
|
|
407
|
-
if (l || (
|
|
407
|
+
if (l || (j(o, null, t), l = n.get(o)), !l || l.res === void 0) {
|
|
408
408
|
const a = "This should not happen: Alias anchor was not resolved?";
|
|
409
409
|
throw new ReferenceError(a);
|
|
410
410
|
}
|
|
411
|
-
if (r >= 0 && (l.count += 1, l.aliasCount === 0 && (l.aliasCount =
|
|
411
|
+
if (r >= 0 && (l.count += 1, l.aliasCount === 0 && (l.aliasCount = _e(i, o, n)), l.count * l.aliasCount > r)) {
|
|
412
412
|
const a = "Excessive alias count indicates a resource exhaustion attack";
|
|
413
413
|
throw new ReferenceError(a);
|
|
414
414
|
}
|
|
@@ -417,7 +417,7 @@ class Ke extends ht {
|
|
|
417
417
|
toString(e, t, n) {
|
|
418
418
|
const i = `*${this.source}`;
|
|
419
419
|
if (e) {
|
|
420
|
-
if (
|
|
420
|
+
if (Rt(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
|
|
421
421
|
const r = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
422
422
|
throw new Error(r);
|
|
423
423
|
}
|
|
@@ -427,40 +427,40 @@ class Ke extends ht {
|
|
|
427
427
|
return i;
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
|
-
function
|
|
430
|
+
function _e(s, e, t) {
|
|
431
431
|
if (Z(e)) {
|
|
432
432
|
const n = e.resolve(s), i = t && n && t.get(n);
|
|
433
433
|
return i ? i.count * i.aliasCount : 0;
|
|
434
|
-
} else if (
|
|
434
|
+
} else if (L(e)) {
|
|
435
435
|
let n = 0;
|
|
436
436
|
for (const i of e.items) {
|
|
437
|
-
const r =
|
|
437
|
+
const r = _e(s, i, t);
|
|
438
438
|
r > n && (n = r);
|
|
439
439
|
}
|
|
440
440
|
return n;
|
|
441
|
-
} else if (
|
|
442
|
-
const n =
|
|
441
|
+
} else if (I(e)) {
|
|
442
|
+
const n = _e(s, e.key, t), i = _e(s, e.value, t);
|
|
443
443
|
return Math.max(n, i);
|
|
444
444
|
}
|
|
445
445
|
return 1;
|
|
446
446
|
}
|
|
447
|
-
const
|
|
448
|
-
class
|
|
447
|
+
const Yt = (s) => !s || typeof s != "function" && typeof s != "object";
|
|
448
|
+
class O extends ht {
|
|
449
449
|
constructor(e) {
|
|
450
|
-
super(
|
|
450
|
+
super(R), this.value = e;
|
|
451
451
|
}
|
|
452
452
|
toJSON(e, t) {
|
|
453
|
-
return t != null && t.keep ? this.value :
|
|
453
|
+
return t != null && t.keep ? this.value : j(this.value, e, t);
|
|
454
454
|
}
|
|
455
455
|
toString() {
|
|
456
456
|
return String(this.value);
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
459
|
+
O.BLOCK_FOLDED = "BLOCK_FOLDED";
|
|
460
|
+
O.BLOCK_LITERAL = "BLOCK_LITERAL";
|
|
461
|
+
O.PLAIN = "PLAIN";
|
|
462
|
+
O.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
463
|
+
O.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
464
464
|
const Bs = "tag:yaml.org,2002:";
|
|
465
465
|
function Ms(s, e, t) {
|
|
466
466
|
if (e) {
|
|
@@ -475,35 +475,35 @@ function Ms(s, e, t) {
|
|
|
475
475
|
});
|
|
476
476
|
}
|
|
477
477
|
function Se(s, e, t) {
|
|
478
|
-
var f,
|
|
478
|
+
var f, d, h;
|
|
479
479
|
if (ue(s) && (s = s.contents), $(s))
|
|
480
480
|
return s;
|
|
481
|
-
if (
|
|
482
|
-
const
|
|
483
|
-
return
|
|
481
|
+
if (I(s)) {
|
|
482
|
+
const y = (d = (f = t.schema[V]).createNode) == null ? void 0 : d.call(f, t.schema, null, t);
|
|
483
|
+
return y.items.push(s), y;
|
|
484
484
|
}
|
|
485
485
|
(s instanceof String || s instanceof Number || s instanceof Boolean || typeof BigInt < "u" && s instanceof BigInt) && (s = s.valueOf());
|
|
486
486
|
const { aliasDuplicateObjects: n, onAnchor: i, onTagObj: r, schema: o, sourceObjects: l } = t;
|
|
487
487
|
let a;
|
|
488
488
|
if (n && s && typeof s == "object") {
|
|
489
489
|
if (a = l.get(s), a)
|
|
490
|
-
return a.anchor || (a.anchor = i(s)), new
|
|
490
|
+
return a.anchor || (a.anchor = i(s)), new qe(a.anchor);
|
|
491
491
|
a = { anchor: null, node: null }, l.set(s, a);
|
|
492
492
|
}
|
|
493
493
|
e != null && e.startsWith("!!") && (e = Bs + e.slice(2));
|
|
494
494
|
let c = Ms(s, e, o.tags);
|
|
495
495
|
if (!c) {
|
|
496
496
|
if (s && typeof s.toJSON == "function" && (s = s.toJSON()), !s || typeof s != "object") {
|
|
497
|
-
const
|
|
498
|
-
return a && (a.node =
|
|
497
|
+
const y = new O(s);
|
|
498
|
+
return a && (a.node = y), y;
|
|
499
499
|
}
|
|
500
|
-
c = s instanceof Map ? o[
|
|
500
|
+
c = s instanceof Map ? o[V] : Symbol.iterator in Object(s) ? o[fe] : o[V];
|
|
501
501
|
}
|
|
502
502
|
r && (r(c), delete t.onTagObj);
|
|
503
|
-
const
|
|
504
|
-
return e ?
|
|
503
|
+
const m = c != null && c.createNode ? c.createNode(t.schema, s, t) : typeof ((h = c == null ? void 0 : c.nodeClass) == null ? void 0 : h.from) == "function" ? c.nodeClass.from(t.schema, s, t) : new O(s);
|
|
504
|
+
return e ? m.tag = e : c.default || (m.tag = c.tag), a && (a.node = m), m;
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function Me(s, e, t) {
|
|
507
507
|
let n = t;
|
|
508
508
|
for (let i = e.length - 1; i >= 0; --i) {
|
|
509
509
|
const r = e[i];
|
|
@@ -524,7 +524,7 @@ function Be(s, e, t) {
|
|
|
524
524
|
});
|
|
525
525
|
}
|
|
526
526
|
const be = (s) => s == null || typeof s == "object" && !!s[Symbol.iterator]().next().done;
|
|
527
|
-
class
|
|
527
|
+
class Gt extends ht {
|
|
528
528
|
constructor(e, t) {
|
|
529
529
|
super(e), Object.defineProperty(this, "schema", {
|
|
530
530
|
value: t,
|
|
@@ -540,7 +540,7 @@ class dt extends ht {
|
|
|
540
540
|
*/
|
|
541
541
|
clone(e) {
|
|
542
542
|
const t = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
543
|
-
return e && (t.schema = e), t.items = t.items.map((n) => $(n) ||
|
|
543
|
+
return e && (t.schema = e), t.items = t.items.map((n) => $(n) || I(n) ? n.clone(e) : n), this.range && (t.range = this.range.slice()), t;
|
|
544
544
|
}
|
|
545
545
|
/**
|
|
546
546
|
* Adds a value to the collection. For `!!map` and `!!omap` the value must
|
|
@@ -552,10 +552,10 @@ class dt extends ht {
|
|
|
552
552
|
this.add(t);
|
|
553
553
|
else {
|
|
554
554
|
const [n, ...i] = e, r = this.get(n, !0);
|
|
555
|
-
if (
|
|
555
|
+
if (L(r))
|
|
556
556
|
r.addIn(i, t);
|
|
557
557
|
else if (r === void 0 && this.schema)
|
|
558
|
-
this.set(n,
|
|
558
|
+
this.set(n, Me(this.schema, i, t));
|
|
559
559
|
else
|
|
560
560
|
throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
|
|
561
561
|
}
|
|
@@ -569,7 +569,7 @@ class dt extends ht {
|
|
|
569
569
|
if (n.length === 0)
|
|
570
570
|
return this.delete(t);
|
|
571
571
|
const i = this.get(t, !0);
|
|
572
|
-
if (
|
|
572
|
+
if (L(i))
|
|
573
573
|
return i.deleteIn(n);
|
|
574
574
|
throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`);
|
|
575
575
|
}
|
|
@@ -580,14 +580,14 @@ class dt extends ht {
|
|
|
580
580
|
*/
|
|
581
581
|
getIn(e, t) {
|
|
582
582
|
const [n, ...i] = e, r = this.get(n, !0);
|
|
583
|
-
return i.length === 0 ? !t &&
|
|
583
|
+
return i.length === 0 ? !t && E(r) ? r.value : r : L(r) ? r.getIn(i, t) : void 0;
|
|
584
584
|
}
|
|
585
585
|
hasAllNullValues(e) {
|
|
586
586
|
return this.items.every((t) => {
|
|
587
|
-
if (!
|
|
587
|
+
if (!I(t))
|
|
588
588
|
return !1;
|
|
589
589
|
const n = t.value;
|
|
590
|
-
return n == null || e &&
|
|
590
|
+
return n == null || e && E(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
591
591
|
});
|
|
592
592
|
}
|
|
593
593
|
/**
|
|
@@ -598,7 +598,7 @@ class dt extends ht {
|
|
|
598
598
|
if (n.length === 0)
|
|
599
599
|
return this.has(t);
|
|
600
600
|
const i = this.get(t, !0);
|
|
601
|
-
return
|
|
601
|
+
return L(i) ? i.hasIn(n) : !1;
|
|
602
602
|
}
|
|
603
603
|
/**
|
|
604
604
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
@@ -610,86 +610,86 @@ class dt extends ht {
|
|
|
610
610
|
this.set(n, t);
|
|
611
611
|
else {
|
|
612
612
|
const r = this.get(n, !0);
|
|
613
|
-
if (
|
|
613
|
+
if (L(r))
|
|
614
614
|
r.setIn(i, t);
|
|
615
615
|
else if (r === void 0 && this.schema)
|
|
616
|
-
this.set(n,
|
|
616
|
+
this.set(n, Me(this.schema, i, t));
|
|
617
617
|
else
|
|
618
618
|
throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
|
-
dt.maxFlowStringSingleLineLength = 60;
|
|
623
622
|
const Ps = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
|
|
624
|
-
function
|
|
623
|
+
function F(s, e) {
|
|
625
624
|
return /^\n+$/.test(s) ? s.substring(1) : e ? s.replace(/^(?! *$)/gm, e) : s;
|
|
626
625
|
}
|
|
627
|
-
const
|
|
628
|
-
`) ?
|
|
626
|
+
const W = (s, e, t) => s.endsWith(`
|
|
627
|
+
`) ? F(t, e) : t.includes(`
|
|
629
628
|
`) ? `
|
|
630
|
-
` +
|
|
631
|
-
function
|
|
629
|
+
` + F(t, e) : (s.endsWith(" ") ? "" : " ") + t, Qt = "flow", ot = "block", Ce = "quoted";
|
|
630
|
+
function Ue(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: l } = {}) {
|
|
632
631
|
if (!i || i < 0)
|
|
633
632
|
return s;
|
|
633
|
+
i < r && (r = 0);
|
|
634
634
|
const a = Math.max(1 + r, 1 + i - e.length);
|
|
635
635
|
if (s.length <= a)
|
|
636
636
|
return s;
|
|
637
|
-
const c = [],
|
|
637
|
+
const c = [], m = {};
|
|
638
638
|
let f = i - e.length;
|
|
639
639
|
typeof n == "number" && (n > i - Math.max(2, r) ? c.push(0) : f = i - n);
|
|
640
|
-
let
|
|
641
|
-
t === ot && (
|
|
642
|
-
for (let
|
|
643
|
-
if (t === Ce &&
|
|
644
|
-
switch (
|
|
640
|
+
let d, h, y = !1, u = -1, p = -1, g = -1;
|
|
641
|
+
t === ot && (u = It(s, u, e.length), u !== -1 && (f = u + a));
|
|
642
|
+
for (let N; N = s[u += 1]; ) {
|
|
643
|
+
if (t === Ce && N === "\\") {
|
|
644
|
+
switch (p = u, s[u + 1]) {
|
|
645
645
|
case "x":
|
|
646
|
-
|
|
646
|
+
u += 3;
|
|
647
647
|
break;
|
|
648
648
|
case "u":
|
|
649
|
-
|
|
649
|
+
u += 5;
|
|
650
650
|
break;
|
|
651
651
|
case "U":
|
|
652
|
-
|
|
652
|
+
u += 9;
|
|
653
653
|
break;
|
|
654
654
|
default:
|
|
655
|
-
|
|
655
|
+
u += 1;
|
|
656
656
|
}
|
|
657
|
-
|
|
657
|
+
g = u;
|
|
658
658
|
}
|
|
659
|
-
if (
|
|
659
|
+
if (N === `
|
|
660
660
|
`)
|
|
661
|
-
t === ot && (
|
|
661
|
+
t === ot && (u = It(s, u, e.length)), f = u + e.length + a, d = void 0;
|
|
662
662
|
else {
|
|
663
|
-
if (
|
|
664
|
-
` &&
|
|
665
|
-
const S = s[
|
|
663
|
+
if (N === " " && h && h !== " " && h !== `
|
|
664
|
+
` && h !== " ") {
|
|
665
|
+
const S = s[u + 1];
|
|
666
666
|
S && S !== " " && S !== `
|
|
667
|
-
` && S !== " " && (
|
|
667
|
+
` && S !== " " && (d = u);
|
|
668
668
|
}
|
|
669
|
-
if (
|
|
670
|
-
if (
|
|
671
|
-
c.push(
|
|
669
|
+
if (u >= f)
|
|
670
|
+
if (d)
|
|
671
|
+
c.push(d), f = d + a, d = void 0;
|
|
672
672
|
else if (t === Ce) {
|
|
673
|
-
for (;
|
|
674
|
-
|
|
675
|
-
const S =
|
|
676
|
-
if (
|
|
673
|
+
for (; h === " " || h === " "; )
|
|
674
|
+
h = N, N = s[u += 1], y = !0;
|
|
675
|
+
const S = u > g + 1 ? u - 2 : p - 1;
|
|
676
|
+
if (m[S])
|
|
677
677
|
return s;
|
|
678
|
-
c.push(S),
|
|
678
|
+
c.push(S), m[S] = !0, f = S + a, d = void 0;
|
|
679
679
|
} else
|
|
680
|
-
|
|
680
|
+
y = !0;
|
|
681
681
|
}
|
|
682
|
-
|
|
682
|
+
h = N;
|
|
683
683
|
}
|
|
684
|
-
if (
|
|
684
|
+
if (y && l && l(), c.length === 0)
|
|
685
685
|
return s;
|
|
686
686
|
o && o();
|
|
687
687
|
let w = s.slice(0, c[0]);
|
|
688
|
-
for (let
|
|
689
|
-
const S = c[
|
|
688
|
+
for (let N = 0; N < c.length; ++N) {
|
|
689
|
+
const S = c[N], A = c[N + 1] || s.length;
|
|
690
690
|
S === 0 ? w = `
|
|
691
|
-
${e}${s.slice(0,
|
|
692
|
-
${e}${s.slice(S + 1,
|
|
691
|
+
${e}${s.slice(0, A)}` : (t === Ce && m[S] && (w += `${s[S]}\\`), w += `
|
|
692
|
+
${e}${s.slice(S + 1, A)}`);
|
|
693
693
|
}
|
|
694
694
|
return w;
|
|
695
695
|
}
|
|
@@ -711,7 +711,7 @@ const Fe = (s, e) => ({
|
|
|
711
711
|
indentAtStart: e ? s.indent.length : s.indentAtStart,
|
|
712
712
|
lineWidth: s.options.lineWidth,
|
|
713
713
|
minContentWidth: s.options.minContentWidth
|
|
714
|
-
}),
|
|
714
|
+
}), Re = (s) => /^(%|---|\.\.\.)/m.test(s);
|
|
715
715
|
function js(s, e, t) {
|
|
716
716
|
if (!e || e < 0)
|
|
717
717
|
return !1;
|
|
@@ -732,7 +732,7 @@ function we(s, e) {
|
|
|
732
732
|
const t = JSON.stringify(s);
|
|
733
733
|
if (e.options.doubleQuotedAsJSON)
|
|
734
734
|
return t;
|
|
735
|
-
const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (
|
|
735
|
+
const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (Re(s) ? " " : "");
|
|
736
736
|
let o = "", l = 0;
|
|
737
737
|
for (let a = 0, c = t[a]; c; c = t[++a])
|
|
738
738
|
if (c === " " && t[a + 1] === "\\" && t[a + 2] === "n" && (o += t.slice(l, a) + "\\ ", a += 1, l = a, c = "\\"), c === "\\")
|
|
@@ -740,8 +740,8 @@ function we(s, e) {
|
|
|
740
740
|
case "u":
|
|
741
741
|
{
|
|
742
742
|
o += t.slice(l, a);
|
|
743
|
-
const
|
|
744
|
-
switch (
|
|
743
|
+
const m = t.substr(a + 2, 4);
|
|
744
|
+
switch (m) {
|
|
745
745
|
case "0000":
|
|
746
746
|
o += "\\0";
|
|
747
747
|
break;
|
|
@@ -767,7 +767,7 @@ function we(s, e) {
|
|
|
767
767
|
o += "\\P";
|
|
768
768
|
break;
|
|
769
769
|
default:
|
|
770
|
-
|
|
770
|
+
m.substr(0, 2) === "00" ? o += "\\x" + m.substr(2) : o += t.substr(a, 6);
|
|
771
771
|
}
|
|
772
772
|
a += 5, l = a + 1;
|
|
773
773
|
}
|
|
@@ -787,15 +787,15 @@ function we(s, e) {
|
|
|
787
787
|
default:
|
|
788
788
|
a += 1;
|
|
789
789
|
}
|
|
790
|
-
return o = l ? o + t.slice(l) : t, n ? o :
|
|
790
|
+
return o = l ? o + t.slice(l) : t, n ? o : Ue(o, r, Ce, Fe(e, !1));
|
|
791
791
|
}
|
|
792
792
|
function lt(s, e) {
|
|
793
793
|
if (e.options.singleQuote === !1 || e.implicitKey && s.includes(`
|
|
794
794
|
`) || /[ \t]\n|\n[ \t]/.test(s))
|
|
795
795
|
return we(s, e);
|
|
796
|
-
const t = e.indent || (
|
|
796
|
+
const t = e.indent || (Re(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
|
|
797
797
|
${t}`) + "'";
|
|
798
|
-
return e.implicitKey ? n :
|
|
798
|
+
return e.implicitKey ? n : Ue(n, t, Qt, Fe(e, !1));
|
|
799
799
|
}
|
|
800
800
|
function re(s, e) {
|
|
801
801
|
const { singleQuote: t } = e.options;
|
|
@@ -817,107 +817,107 @@ try {
|
|
|
817
817
|
} catch {
|
|
818
818
|
at = /\n+(?!\n|$)/g;
|
|
819
819
|
}
|
|
820
|
-
function
|
|
820
|
+
function ve({ comment: s, type: e, value: t }, n, i, r) {
|
|
821
821
|
const { blockQuote: o, commentString: l, lineWidth: a } = n.options;
|
|
822
822
|
if (!o || /\n[\t ]+$/.test(t) || /^\s*$/.test(t))
|
|
823
823
|
return re(t, n);
|
|
824
|
-
const c = n.indent || (n.forceBlockIndent ||
|
|
824
|
+
const c = n.indent || (n.forceBlockIndent || Re(t) ? " " : ""), m = o === "literal" ? !0 : o === "folded" || e === O.BLOCK_FOLDED ? !1 : e === O.BLOCK_LITERAL ? !0 : !js(t, a, c.length);
|
|
825
825
|
if (!t)
|
|
826
|
-
return
|
|
826
|
+
return m ? `|
|
|
827
827
|
` : `>
|
|
828
828
|
`;
|
|
829
|
-
let f,
|
|
830
|
-
for (
|
|
831
|
-
const
|
|
832
|
-
if (
|
|
833
|
-
` &&
|
|
829
|
+
let f, d;
|
|
830
|
+
for (d = t.length; d > 0; --d) {
|
|
831
|
+
const k = t[d - 1];
|
|
832
|
+
if (k !== `
|
|
833
|
+
` && k !== " " && k !== " ")
|
|
834
834
|
break;
|
|
835
835
|
}
|
|
836
|
-
let
|
|
837
|
-
const
|
|
836
|
+
let h = t.substring(d);
|
|
837
|
+
const y = h.indexOf(`
|
|
838
838
|
`);
|
|
839
|
-
|
|
840
|
-
` && (
|
|
841
|
-
let
|
|
842
|
-
for (
|
|
843
|
-
const
|
|
844
|
-
if (
|
|
845
|
-
|
|
846
|
-
else if (
|
|
839
|
+
y === -1 ? f = "-" : t === h || y !== h.length - 1 ? (f = "+", r && r()) : f = "", h && (t = t.slice(0, -h.length), h[h.length - 1] === `
|
|
840
|
+
` && (h = h.slice(0, -1)), h = h.replace(at, `$&${c}`));
|
|
841
|
+
let u = !1, p, g = -1;
|
|
842
|
+
for (p = 0; p < t.length; ++p) {
|
|
843
|
+
const k = t[p];
|
|
844
|
+
if (k === " ")
|
|
845
|
+
u = !0;
|
|
846
|
+
else if (k === `
|
|
847
847
|
`)
|
|
848
|
-
|
|
848
|
+
g = p;
|
|
849
849
|
else
|
|
850
850
|
break;
|
|
851
851
|
}
|
|
852
|
-
let w = t.substring(0,
|
|
852
|
+
let w = t.substring(0, g < p ? g + 1 : p);
|
|
853
853
|
w && (t = t.substring(w.length), w = w.replace(/\n+/g, `$&${c}`));
|
|
854
|
-
let S = (
|
|
855
|
-
if (s && (S += " " + l(s.replace(/ ?[\r\n]+/g, " ")), i && i()),
|
|
854
|
+
let S = (m ? "|" : ">") + (u ? c ? "2" : "1" : "") + f;
|
|
855
|
+
if (s && (S += " " + l(s.replace(/ ?[\r\n]+/g, " ")), i && i()), m)
|
|
856
856
|
return t = t.replace(/\n+/g, `$&${c}`), `${S}
|
|
857
|
-
${c}${w}${t}${
|
|
857
|
+
${c}${w}${t}${h}`;
|
|
858
858
|
t = t.replace(/\n+/g, `
|
|
859
859
|
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${c}`);
|
|
860
|
-
const
|
|
860
|
+
const A = Ue(`${w}${t}${h}`, c, ot, Fe(n, !0));
|
|
861
861
|
return `${S}
|
|
862
|
-
${c}${
|
|
862
|
+
${c}${A}`;
|
|
863
863
|
}
|
|
864
|
-
function
|
|
865
|
-
const { type: i, value: r } = s, { actualString: o, implicitKey: l, indent: a, indentStep: c, inFlow:
|
|
864
|
+
function Ks(s, e, t, n) {
|
|
865
|
+
const { type: i, value: r } = s, { actualString: o, implicitKey: l, indent: a, indentStep: c, inFlow: m } = e;
|
|
866
866
|
if (l && r.includes(`
|
|
867
|
-
`) ||
|
|
867
|
+
`) || m && /[[\]{},]/.test(r))
|
|
868
868
|
return re(r, e);
|
|
869
869
|
if (!r || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))
|
|
870
|
-
return l ||
|
|
871
|
-
`) ? re(r, e) :
|
|
872
|
-
if (!l && !
|
|
870
|
+
return l || m || !r.includes(`
|
|
871
|
+
`) ? re(r, e) : ve(s, e, t, n);
|
|
872
|
+
if (!l && !m && i !== O.PLAIN && r.includes(`
|
|
873
873
|
`))
|
|
874
|
-
return
|
|
875
|
-
if (
|
|
874
|
+
return ve(s, e, t, n);
|
|
875
|
+
if (Re(r)) {
|
|
876
876
|
if (a === "")
|
|
877
|
-
return e.forceBlockIndent = !0,
|
|
877
|
+
return e.forceBlockIndent = !0, ve(s, e, t, n);
|
|
878
878
|
if (l && a === c)
|
|
879
879
|
return re(r, e);
|
|
880
880
|
}
|
|
881
881
|
const f = r.replace(/\n+/g, `$&
|
|
882
882
|
${a}`);
|
|
883
883
|
if (o) {
|
|
884
|
-
const
|
|
885
|
-
var
|
|
886
|
-
return
|
|
887
|
-
}, { compat:
|
|
888
|
-
if (
|
|
884
|
+
const d = (u) => {
|
|
885
|
+
var p;
|
|
886
|
+
return u.default && u.tag !== "tag:yaml.org,2002:str" && ((p = u.test) == null ? void 0 : p.test(f));
|
|
887
|
+
}, { compat: h, tags: y } = e.doc.schema;
|
|
888
|
+
if (y.some(d) || h != null && h.some(d))
|
|
889
889
|
return re(r, e);
|
|
890
890
|
}
|
|
891
|
-
return l ? f :
|
|
891
|
+
return l ? f : Ue(f, a, Qt, Fe(e, !1));
|
|
892
892
|
}
|
|
893
893
|
function Oe(s, e, t, n) {
|
|
894
894
|
const { implicitKey: i, inFlow: r } = e, o = typeof s.value == "string" ? s : Object.assign({}, s, { value: String(s.value) });
|
|
895
895
|
let { type: l } = s;
|
|
896
|
-
l !==
|
|
897
|
-
const a = (
|
|
898
|
-
switch (
|
|
899
|
-
case
|
|
900
|
-
case
|
|
901
|
-
return i || r ? re(o.value, e) :
|
|
902
|
-
case
|
|
896
|
+
l !== O.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (l = O.QUOTE_DOUBLE);
|
|
897
|
+
const a = (m) => {
|
|
898
|
+
switch (m) {
|
|
899
|
+
case O.BLOCK_FOLDED:
|
|
900
|
+
case O.BLOCK_LITERAL:
|
|
901
|
+
return i || r ? re(o.value, e) : ve(o, e, t, n);
|
|
902
|
+
case O.QUOTE_DOUBLE:
|
|
903
903
|
return we(o.value, e);
|
|
904
|
-
case
|
|
904
|
+
case O.QUOTE_SINGLE:
|
|
905
905
|
return lt(o.value, e);
|
|
906
|
-
case
|
|
907
|
-
return
|
|
906
|
+
case O.PLAIN:
|
|
907
|
+
return Ks(o, e, t, n);
|
|
908
908
|
default:
|
|
909
909
|
return null;
|
|
910
910
|
}
|
|
911
911
|
};
|
|
912
912
|
let c = a(l);
|
|
913
913
|
if (c === null) {
|
|
914
|
-
const { defaultKeyType:
|
|
915
|
-
if (c = a(
|
|
916
|
-
throw new Error(`Unsupported default string type ${
|
|
914
|
+
const { defaultKeyType: m, defaultStringType: f } = e.options, d = i && m || f;
|
|
915
|
+
if (c = a(d), c === null)
|
|
916
|
+
throw new Error(`Unsupported default string type ${d}`);
|
|
917
917
|
}
|
|
918
918
|
return c;
|
|
919
919
|
}
|
|
920
|
-
function
|
|
920
|
+
function Wt(s, e) {
|
|
921
921
|
const t = Object.assign({
|
|
922
922
|
blockQuote: !0,
|
|
923
923
|
commentString: Ps,
|
|
@@ -958,7 +958,7 @@ function Qt(s, e) {
|
|
|
958
958
|
options: t
|
|
959
959
|
};
|
|
960
960
|
}
|
|
961
|
-
function
|
|
961
|
+
function Ds(s, e) {
|
|
962
962
|
var i;
|
|
963
963
|
if (e.tag) {
|
|
964
964
|
const r = s.filter((o) => o.tag === e.tag);
|
|
@@ -966,7 +966,7 @@ function Ks(s, e) {
|
|
|
966
966
|
return r.find((o) => o.format === e.format) ?? r[0];
|
|
967
967
|
}
|
|
968
968
|
let t, n;
|
|
969
|
-
if (
|
|
969
|
+
if (E(e)) {
|
|
970
970
|
n = e.value;
|
|
971
971
|
const r = s.filter((o) => {
|
|
972
972
|
var l;
|
|
@@ -984,14 +984,14 @@ function Ks(s, e) {
|
|
|
984
984
|
function qs(s, e, { anchors: t, doc: n }) {
|
|
985
985
|
if (!n.directives)
|
|
986
986
|
return "";
|
|
987
|
-
const i = [], r = (
|
|
988
|
-
r &&
|
|
987
|
+
const i = [], r = (E(s) || L(s)) && s.anchor;
|
|
988
|
+
r && Rt(r) && (t.add(r), i.push(`&${r}`));
|
|
989
989
|
const o = s.tag ? s.tag : e.default ? null : e.tag;
|
|
990
990
|
return o && i.push(n.directives.tagString(o)), i.join(" ");
|
|
991
991
|
}
|
|
992
992
|
function ae(s, e, t, n) {
|
|
993
993
|
var a;
|
|
994
|
-
if (
|
|
994
|
+
if (I(s))
|
|
995
995
|
return s.toString(e, t, n);
|
|
996
996
|
if (Z(s)) {
|
|
997
997
|
if (e.doc.directives)
|
|
@@ -1002,98 +1002,98 @@ function ae(s, e, t, n) {
|
|
|
1002
1002
|
}
|
|
1003
1003
|
let i;
|
|
1004
1004
|
const r = $(s) ? s : e.doc.createNode(s, { onTagObj: (c) => i = c });
|
|
1005
|
-
i || (i =
|
|
1005
|
+
i || (i = Ds(e.doc.schema.tags, r));
|
|
1006
1006
|
const o = qs(r, i, e);
|
|
1007
1007
|
o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
|
|
1008
|
-
const l = typeof i.stringify == "function" ? i.stringify(r, e, t, n) :
|
|
1009
|
-
return o ?
|
|
1008
|
+
const l = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : E(r) ? Oe(r, e, t, n) : r.toString(e, t, n);
|
|
1009
|
+
return o ? E(r) || l[0] === "{" || l[0] === "[" ? `${o} ${l}` : `${o}
|
|
1010
1010
|
${e.indent}${l}` : l;
|
|
1011
1011
|
}
|
|
1012
|
-
function
|
|
1013
|
-
const { allNullValues: r, doc: o, indent: l, indentStep: a, options: { commentString: c, indentSeq:
|
|
1014
|
-
let
|
|
1012
|
+
function Us({ key: s, value: e }, t, n, i) {
|
|
1013
|
+
const { allNullValues: r, doc: o, indent: l, indentStep: a, options: { commentString: c, indentSeq: m, simpleKeys: f } } = t;
|
|
1014
|
+
let d = $(s) && s.comment || null;
|
|
1015
1015
|
if (f) {
|
|
1016
|
-
if (
|
|
1016
|
+
if (d)
|
|
1017
1017
|
throw new Error("With simple keys, key nodes cannot have comments");
|
|
1018
|
-
if (
|
|
1019
|
-
const
|
|
1020
|
-
throw new Error(
|
|
1018
|
+
if (L(s) || !$(s) && typeof s == "object") {
|
|
1019
|
+
const T = "With simple keys, collection cannot be used as a key value";
|
|
1020
|
+
throw new Error(T);
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
1023
|
-
let
|
|
1023
|
+
let h = !f && (!s || d && e == null && !t.inFlow || L(s) || (E(s) ? s.type === O.BLOCK_FOLDED || s.type === O.BLOCK_LITERAL : typeof s == "object"));
|
|
1024
1024
|
t = Object.assign({}, t, {
|
|
1025
1025
|
allNullValues: !1,
|
|
1026
|
-
implicitKey: !
|
|
1026
|
+
implicitKey: !h && (f || !r),
|
|
1027
1027
|
indent: l + a
|
|
1028
1028
|
});
|
|
1029
|
-
let
|
|
1030
|
-
if (!
|
|
1029
|
+
let y = !1, u = !1, p = ae(s, t, () => y = !0, () => u = !0);
|
|
1030
|
+
if (!h && !t.inFlow && p.length > 1024) {
|
|
1031
1031
|
if (f)
|
|
1032
1032
|
throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
|
|
1033
|
-
|
|
1033
|
+
h = !0;
|
|
1034
1034
|
}
|
|
1035
1035
|
if (t.inFlow) {
|
|
1036
1036
|
if (r || e == null)
|
|
1037
|
-
return
|
|
1038
|
-
} else if (r && !f || e == null &&
|
|
1039
|
-
return
|
|
1040
|
-
|
|
1041
|
-
${l}:`) : (
|
|
1042
|
-
let
|
|
1043
|
-
$(e) ? (
|
|
1037
|
+
return y && n && n(), p === "" ? "?" : h ? `? ${p}` : p;
|
|
1038
|
+
} else if (r && !f || e == null && h)
|
|
1039
|
+
return p = `? ${p}`, d && !y ? p += W(p, t.indent, c(d)) : u && i && i(), p;
|
|
1040
|
+
y && (d = null), h ? (d && (p += W(p, t.indent, c(d))), p = `? ${p}
|
|
1041
|
+
${l}:`) : (p = `${p}:`, d && (p += W(p, t.indent, c(d))));
|
|
1042
|
+
let g, w, N;
|
|
1043
|
+
$(e) ? (g = !!e.spaceBefore, w = e.commentBefore, N = e.comment) : (g = !1, w = null, N = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !h && !d && E(e) && (t.indentAtStart = p.length + 1), u = !1, !m && a.length >= 2 && !t.inFlow && !h && de(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
|
|
1044
1044
|
let S = !1;
|
|
1045
|
-
const
|
|
1046
|
-
let
|
|
1047
|
-
if (
|
|
1048
|
-
if (
|
|
1045
|
+
const A = ae(e, t, () => S = !0, () => u = !0);
|
|
1046
|
+
let k = " ";
|
|
1047
|
+
if (d || g || w) {
|
|
1048
|
+
if (k = g ? `
|
|
1049
1049
|
` : "", w) {
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1052
|
-
${
|
|
1050
|
+
const T = c(w);
|
|
1051
|
+
k += `
|
|
1052
|
+
${F(T, t.indent)}`;
|
|
1053
1053
|
}
|
|
1054
|
-
|
|
1055
|
-
` && (
|
|
1054
|
+
A === "" && !t.inFlow ? k === `
|
|
1055
|
+
` && (k = `
|
|
1056
1056
|
|
|
1057
|
-
`) :
|
|
1057
|
+
`) : k += `
|
|
1058
1058
|
${t.indent}`;
|
|
1059
|
-
} else if (!
|
|
1060
|
-
const
|
|
1061
|
-
`), _ =
|
|
1062
|
-
if (_ || !
|
|
1059
|
+
} else if (!h && L(e)) {
|
|
1060
|
+
const T = A[0], b = A.indexOf(`
|
|
1061
|
+
`), _ = b !== -1, G = t.inFlow ?? e.flow ?? e.items.length === 0;
|
|
1062
|
+
if (_ || !G) {
|
|
1063
1063
|
let x = !1;
|
|
1064
|
-
if (_ && (
|
|
1065
|
-
let C =
|
|
1066
|
-
|
|
1064
|
+
if (_ && (T === "&" || T === "!")) {
|
|
1065
|
+
let C = A.indexOf(" ");
|
|
1066
|
+
T === "&" && C !== -1 && C < b && A[C + 1] === "!" && (C = A.indexOf(" ", C + 1)), (C === -1 || b < C) && (x = !0);
|
|
1067
1067
|
}
|
|
1068
|
-
x || (
|
|
1068
|
+
x || (k = `
|
|
1069
1069
|
${t.indent}`);
|
|
1070
1070
|
}
|
|
1071
|
-
} else (
|
|
1072
|
-
`) && (
|
|
1073
|
-
return
|
|
1071
|
+
} else (A === "" || A[0] === `
|
|
1072
|
+
`) && (k = "");
|
|
1073
|
+
return p += k + A, t.inFlow ? S && n && n() : N && !S ? p += W(p, t.indent, c(N)) : u && i && i(), p;
|
|
1074
1074
|
}
|
|
1075
1075
|
function Ht(s, e) {
|
|
1076
1076
|
(s === "debug" || s === "warn") && (typeof process < "u" && process.emitWarning ? process.emitWarning(e) : console.warn(e));
|
|
1077
1077
|
}
|
|
1078
1078
|
const Tt = "<<";
|
|
1079
1079
|
function Xt(s, e, { key: t, value: n }) {
|
|
1080
|
-
if (s != null && s.doc.schema.merge &&
|
|
1080
|
+
if (s != null && s.doc.schema.merge && Fs(t))
|
|
1081
1081
|
if (n = Z(n) ? n.resolve(s.doc) : n, de(n))
|
|
1082
1082
|
for (const i of n.items)
|
|
1083
|
-
|
|
1083
|
+
Ze(s, e, i);
|
|
1084
1084
|
else if (Array.isArray(n))
|
|
1085
1085
|
for (const i of n)
|
|
1086
|
-
|
|
1086
|
+
Ze(s, e, i);
|
|
1087
1087
|
else
|
|
1088
|
-
|
|
1088
|
+
Ze(s, e, n);
|
|
1089
1089
|
else {
|
|
1090
|
-
const i =
|
|
1090
|
+
const i = j(t, "", s);
|
|
1091
1091
|
if (e instanceof Map)
|
|
1092
|
-
e.set(i,
|
|
1092
|
+
e.set(i, j(n, i, s));
|
|
1093
1093
|
else if (e instanceof Set)
|
|
1094
1094
|
e.add(i);
|
|
1095
1095
|
else {
|
|
1096
|
-
const r = Rs(t, i, s), o =
|
|
1096
|
+
const r = Rs(t, i, s), o = j(n, r, s);
|
|
1097
1097
|
r in e ? Object.defineProperty(e, r, {
|
|
1098
1098
|
value: o,
|
|
1099
1099
|
writable: !0,
|
|
@@ -1104,8 +1104,8 @@ function Xt(s, e, { key: t, value: n }) {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
return e;
|
|
1106
1106
|
}
|
|
1107
|
-
const
|
|
1108
|
-
function
|
|
1107
|
+
const Fs = (s) => s === Tt || E(s) && s.value === Tt && (!s.type || s.type === O.PLAIN);
|
|
1108
|
+
function Ze(s, e, t) {
|
|
1109
1109
|
const n = s && Z(t) ? t.resolve(s.doc) : t;
|
|
1110
1110
|
if (!he(n))
|
|
1111
1111
|
throw new Error("Merge sources must be maps or map aliases");
|
|
@@ -1125,7 +1125,7 @@ function Rs(s, e, t) {
|
|
|
1125
1125
|
if (typeof e != "object")
|
|
1126
1126
|
return String(e);
|
|
1127
1127
|
if ($(s) && (t != null && t.doc)) {
|
|
1128
|
-
const n =
|
|
1128
|
+
const n = Wt(t.doc, {});
|
|
1129
1129
|
n.anchors = /* @__PURE__ */ new Set();
|
|
1130
1130
|
for (const r of t.anchors.keys())
|
|
1131
1131
|
n.anchors.add(r.anchor);
|
|
@@ -1139,7 +1139,7 @@ function Rs(s, e, t) {
|
|
|
1139
1139
|
}
|
|
1140
1140
|
return JSON.stringify(e);
|
|
1141
1141
|
}
|
|
1142
|
-
function
|
|
1142
|
+
function dt(s, e, t) {
|
|
1143
1143
|
const n = Se(s, void 0, t), i = Se(e, void 0, t);
|
|
1144
1144
|
return new v(n, i);
|
|
1145
1145
|
}
|
|
@@ -1156,45 +1156,45 @@ class v {
|
|
|
1156
1156
|
return Xt(t, n, this);
|
|
1157
1157
|
}
|
|
1158
1158
|
toString(e, t, n) {
|
|
1159
|
-
return e != null && e.doc ?
|
|
1159
|
+
return e != null && e.doc ? Us(this, e, t, n) : JSON.stringify(this);
|
|
1160
1160
|
}
|
|
1161
1161
|
}
|
|
1162
1162
|
function zt(s, e, t) {
|
|
1163
|
-
return (e.inFlow ?? s.flow ?
|
|
1163
|
+
return (e.inFlow ?? s.flow ? Js : Vs)(s, e, t);
|
|
1164
1164
|
}
|
|
1165
1165
|
function Vs({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: l }) {
|
|
1166
|
-
const { indent: a, options: { commentString: c } } = t,
|
|
1166
|
+
const { indent: a, options: { commentString: c } } = t, m = Object.assign({}, t, { indent: r, type: null });
|
|
1167
1167
|
let f = !1;
|
|
1168
|
-
const
|
|
1169
|
-
for (let
|
|
1170
|
-
const
|
|
1171
|
-
let
|
|
1172
|
-
if ($(
|
|
1173
|
-
!f &&
|
|
1174
|
-
else if (
|
|
1175
|
-
const w = $(
|
|
1176
|
-
w && (!f && w.spaceBefore &&
|
|
1168
|
+
const d = [];
|
|
1169
|
+
for (let y = 0; y < e.length; ++y) {
|
|
1170
|
+
const u = e[y];
|
|
1171
|
+
let p = null;
|
|
1172
|
+
if ($(u))
|
|
1173
|
+
!f && u.spaceBefore && d.push(""), Pe(t, d, u.commentBefore, f), u.comment && (p = u.comment);
|
|
1174
|
+
else if (I(u)) {
|
|
1175
|
+
const w = $(u.key) ? u.key : null;
|
|
1176
|
+
w && (!f && w.spaceBefore && d.push(""), Pe(t, d, w.commentBefore, f));
|
|
1177
1177
|
}
|
|
1178
1178
|
f = !1;
|
|
1179
|
-
let
|
|
1180
|
-
|
|
1179
|
+
let g = ae(u, m, () => p = null, () => f = !0);
|
|
1180
|
+
p && (g += W(g, r, c(p))), f && p && (f = !1), d.push(n + g);
|
|
1181
1181
|
}
|
|
1182
|
-
let
|
|
1183
|
-
if (
|
|
1184
|
-
|
|
1182
|
+
let h;
|
|
1183
|
+
if (d.length === 0)
|
|
1184
|
+
h = i.start + i.end;
|
|
1185
1185
|
else {
|
|
1186
|
-
|
|
1187
|
-
for (let
|
|
1188
|
-
const
|
|
1189
|
-
|
|
1190
|
-
${a}${
|
|
1186
|
+
h = d[0];
|
|
1187
|
+
for (let y = 1; y < d.length; ++y) {
|
|
1188
|
+
const u = d[y];
|
|
1189
|
+
h += u ? `
|
|
1190
|
+
${a}${u}` : `
|
|
1191
1191
|
`;
|
|
1192
1192
|
}
|
|
1193
1193
|
}
|
|
1194
|
-
return s ? (
|
|
1195
|
-
` +
|
|
1194
|
+
return s ? (h += `
|
|
1195
|
+
` + F(c(s), a), l && l()) : f && o && o(), h;
|
|
1196
1196
|
}
|
|
1197
|
-
function
|
|
1197
|
+
function Js({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
1198
1198
|
const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString: l } } = e;
|
|
1199
1199
|
n += r;
|
|
1200
1200
|
const a = Object.assign({}, e, {
|
|
@@ -1202,60 +1202,60 @@ function Ys({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
|
1202
1202
|
inFlow: !0,
|
|
1203
1203
|
type: null
|
|
1204
1204
|
});
|
|
1205
|
-
let c = !1,
|
|
1205
|
+
let c = !1, m = 0;
|
|
1206
1206
|
const f = [];
|
|
1207
|
-
for (let
|
|
1208
|
-
const
|
|
1209
|
-
let
|
|
1210
|
-
if ($(
|
|
1211
|
-
|
|
1212
|
-
else if (
|
|
1213
|
-
const w = $(
|
|
1214
|
-
w && (w.spaceBefore && f.push(""),
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1207
|
+
for (let y = 0; y < s.length; ++y) {
|
|
1208
|
+
const u = s[y];
|
|
1209
|
+
let p = null;
|
|
1210
|
+
if ($(u))
|
|
1211
|
+
u.spaceBefore && f.push(""), Pe(e, f, u.commentBefore, !1), u.comment && (p = u.comment);
|
|
1212
|
+
else if (I(u)) {
|
|
1213
|
+
const w = $(u.key) ? u.key : null;
|
|
1214
|
+
w && (w.spaceBefore && f.push(""), Pe(e, f, w.commentBefore, !1), w.comment && (c = !0));
|
|
1215
|
+
const N = $(u.value) ? u.value : null;
|
|
1216
|
+
N ? (N.comment && (p = N.comment), N.commentBefore && (c = !0)) : u.value == null && (w != null && w.comment) && (p = w.comment);
|
|
1217
1217
|
}
|
|
1218
|
-
|
|
1219
|
-
let
|
|
1220
|
-
|
|
1221
|
-
`)) && (c = !0), f.push(
|
|
1218
|
+
p && (c = !0);
|
|
1219
|
+
let g = ae(u, a, () => p = null);
|
|
1220
|
+
y < s.length - 1 && (g += ","), p && (g += W(g, n, l(p))), !c && (f.length > m || g.includes(`
|
|
1221
|
+
`)) && (c = !0), f.push(g), m = f.length;
|
|
1222
1222
|
}
|
|
1223
|
-
const { start:
|
|
1223
|
+
const { start: d, end: h } = t;
|
|
1224
1224
|
if (f.length === 0)
|
|
1225
|
-
return
|
|
1225
|
+
return d + h;
|
|
1226
1226
|
if (!c) {
|
|
1227
|
-
const
|
|
1228
|
-
c = e.options.lineWidth > 0 &&
|
|
1227
|
+
const y = f.reduce((u, p) => u + p.length + 2, 2);
|
|
1228
|
+
c = e.options.lineWidth > 0 && y > e.options.lineWidth;
|
|
1229
1229
|
}
|
|
1230
1230
|
if (c) {
|
|
1231
|
-
let
|
|
1232
|
-
for (const
|
|
1233
|
-
|
|
1234
|
-
${r}${i}${
|
|
1231
|
+
let y = d;
|
|
1232
|
+
for (const u of f)
|
|
1233
|
+
y += u ? `
|
|
1234
|
+
${r}${i}${u}` : `
|
|
1235
1235
|
`;
|
|
1236
|
-
return `${
|
|
1237
|
-
${i}${
|
|
1236
|
+
return `${y}
|
|
1237
|
+
${i}${h}`;
|
|
1238
1238
|
} else
|
|
1239
|
-
return `${
|
|
1239
|
+
return `${d}${o}${f.join(" ")}${o}${h}`;
|
|
1240
1240
|
}
|
|
1241
|
-
function
|
|
1241
|
+
function Pe({ indent: s, options: { commentString: e } }, t, n, i) {
|
|
1242
1242
|
if (n && i && (n = n.replace(/^\n+/, "")), n) {
|
|
1243
|
-
const r =
|
|
1243
|
+
const r = F(e(n), s);
|
|
1244
1244
|
t.push(r.trimStart());
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
1247
1247
|
function H(s, e) {
|
|
1248
|
-
const t =
|
|
1248
|
+
const t = E(e) ? e.value : e;
|
|
1249
1249
|
for (const n of s)
|
|
1250
|
-
if (
|
|
1250
|
+
if (I(n) && (n.key === e || n.key === t || E(n.key) && n.key.value === t))
|
|
1251
1251
|
return n;
|
|
1252
1252
|
}
|
|
1253
|
-
class P extends
|
|
1253
|
+
class P extends Gt {
|
|
1254
1254
|
static get tagName() {
|
|
1255
1255
|
return "tag:yaml.org,2002:map";
|
|
1256
1256
|
}
|
|
1257
1257
|
constructor(e) {
|
|
1258
|
-
super(
|
|
1258
|
+
super(V, e), this.items = [];
|
|
1259
1259
|
}
|
|
1260
1260
|
/**
|
|
1261
1261
|
* A generic collection parsing method that can be extended
|
|
@@ -1267,7 +1267,7 @@ class P extends dt {
|
|
|
1267
1267
|
c = r.call(t, a, c);
|
|
1268
1268
|
else if (Array.isArray(r) && !r.includes(a))
|
|
1269
1269
|
return;
|
|
1270
|
-
(c !== void 0 || i) && o.items.push(
|
|
1270
|
+
(c !== void 0 || i) && o.items.push(dt(a, c, n));
|
|
1271
1271
|
};
|
|
1272
1272
|
if (t instanceof Map)
|
|
1273
1273
|
for (const [a, c] of t)
|
|
@@ -1286,12 +1286,12 @@ class P extends dt {
|
|
|
1286
1286
|
add(e, t) {
|
|
1287
1287
|
var o;
|
|
1288
1288
|
let n;
|
|
1289
|
-
|
|
1289
|
+
I(e) ? n = e : !e || typeof e != "object" || !("key" in e) ? n = new v(e, e == null ? void 0 : e.value) : n = new v(e.key, e.value);
|
|
1290
1290
|
const i = H(this.items, n.key), r = (o = this.schema) == null ? void 0 : o.sortMapEntries;
|
|
1291
1291
|
if (i) {
|
|
1292
1292
|
if (!t)
|
|
1293
1293
|
throw new Error(`Key ${n.key} already set`);
|
|
1294
|
-
|
|
1294
|
+
E(i.value) && Yt(n.value) ? i.value.value = n.value : i.value = n.value;
|
|
1295
1295
|
} else if (r) {
|
|
1296
1296
|
const l = this.items.findIndex((a) => r(n, a) < 0);
|
|
1297
1297
|
l === -1 ? this.items.push(n) : this.items.splice(l, 0, n);
|
|
@@ -1304,7 +1304,7 @@ class P extends dt {
|
|
|
1304
1304
|
}
|
|
1305
1305
|
get(e, t) {
|
|
1306
1306
|
const n = H(this.items, e), i = n == null ? void 0 : n.value;
|
|
1307
|
-
return (!t &&
|
|
1307
|
+
return (!t && E(i) ? i.value : i) ?? void 0;
|
|
1308
1308
|
}
|
|
1309
1309
|
has(e) {
|
|
1310
1310
|
return !!H(this.items, e);
|
|
@@ -1328,7 +1328,7 @@ class P extends dt {
|
|
|
1328
1328
|
if (!e)
|
|
1329
1329
|
return JSON.stringify(this);
|
|
1330
1330
|
for (const i of this.items)
|
|
1331
|
-
if (!
|
|
1331
|
+
if (!I(i))
|
|
1332
1332
|
throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);
|
|
1333
1333
|
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), zt(this, e, {
|
|
1334
1334
|
blockItemPrefix: "",
|
|
@@ -1349,7 +1349,7 @@ const pe = {
|
|
|
1349
1349
|
},
|
|
1350
1350
|
createNode: (s, e, t) => P.from(s, e, t)
|
|
1351
1351
|
};
|
|
1352
|
-
class
|
|
1352
|
+
class Y extends Gt {
|
|
1353
1353
|
static get tagName() {
|
|
1354
1354
|
return "tag:yaml.org,2002:seq";
|
|
1355
1355
|
}
|
|
@@ -1368,15 +1368,15 @@ class G extends dt {
|
|
|
1368
1368
|
* @returns `true` if the item was found and removed.
|
|
1369
1369
|
*/
|
|
1370
1370
|
delete(e) {
|
|
1371
|
-
const t =
|
|
1371
|
+
const t = Ie(e);
|
|
1372
1372
|
return typeof t != "number" ? !1 : this.items.splice(t, 1).length > 0;
|
|
1373
1373
|
}
|
|
1374
1374
|
get(e, t) {
|
|
1375
|
-
const n =
|
|
1375
|
+
const n = Ie(e);
|
|
1376
1376
|
if (typeof n != "number")
|
|
1377
1377
|
return;
|
|
1378
1378
|
const i = this.items[n];
|
|
1379
|
-
return !t &&
|
|
1379
|
+
return !t && E(i) ? i.value : i;
|
|
1380
1380
|
}
|
|
1381
1381
|
/**
|
|
1382
1382
|
* Checks if the collection includes a value with the key `key`.
|
|
@@ -1385,7 +1385,7 @@ class G extends dt {
|
|
|
1385
1385
|
* It may be wrapped in a `Scalar`.
|
|
1386
1386
|
*/
|
|
1387
1387
|
has(e) {
|
|
1388
|
-
const t =
|
|
1388
|
+
const t = Ie(e);
|
|
1389
1389
|
return typeof t == "number" && t < this.items.length;
|
|
1390
1390
|
}
|
|
1391
1391
|
/**
|
|
@@ -1396,18 +1396,18 @@ class G extends dt {
|
|
|
1396
1396
|
* It may be wrapped in a `Scalar`.
|
|
1397
1397
|
*/
|
|
1398
1398
|
set(e, t) {
|
|
1399
|
-
const n =
|
|
1399
|
+
const n = Ie(e);
|
|
1400
1400
|
if (typeof n != "number")
|
|
1401
1401
|
throw new Error(`Expected a valid index, not ${e}.`);
|
|
1402
1402
|
const i = this.items[n];
|
|
1403
|
-
|
|
1403
|
+
E(i) && Yt(t) ? i.value = t : this.items[n] = t;
|
|
1404
1404
|
}
|
|
1405
1405
|
toJSON(e, t) {
|
|
1406
1406
|
const n = [];
|
|
1407
1407
|
t != null && t.onCreate && t.onCreate(n);
|
|
1408
1408
|
let i = 0;
|
|
1409
1409
|
for (const r of this.items)
|
|
1410
|
-
n.push(
|
|
1410
|
+
n.push(j(r, String(i++), t));
|
|
1411
1411
|
return n;
|
|
1412
1412
|
}
|
|
1413
1413
|
toString(e, t, n) {
|
|
@@ -1434,20 +1434,20 @@ class G extends dt {
|
|
|
1434
1434
|
return r;
|
|
1435
1435
|
}
|
|
1436
1436
|
}
|
|
1437
|
-
function
|
|
1438
|
-
let e =
|
|
1437
|
+
function Ie(s) {
|
|
1438
|
+
let e = E(s) ? s.value : s;
|
|
1439
1439
|
return e && typeof e == "string" && (e = Number(e)), typeof e == "number" && Number.isInteger(e) && e >= 0 ? e : null;
|
|
1440
1440
|
}
|
|
1441
1441
|
const me = {
|
|
1442
1442
|
collection: "seq",
|
|
1443
1443
|
default: !0,
|
|
1444
|
-
nodeClass:
|
|
1444
|
+
nodeClass: Y,
|
|
1445
1445
|
tag: "tag:yaml.org,2002:seq",
|
|
1446
1446
|
resolve(s, e) {
|
|
1447
1447
|
return de(s) || e("Expected a sequence for this tag"), s;
|
|
1448
1448
|
},
|
|
1449
|
-
createNode: (s, e, t) =>
|
|
1450
|
-
},
|
|
1449
|
+
createNode: (s, e, t) => Y.from(s, e, t)
|
|
1450
|
+
}, Ve = {
|
|
1451
1451
|
identify: (s) => typeof s == "string",
|
|
1452
1452
|
default: !0,
|
|
1453
1453
|
tag: "tag:yaml.org,2002:str",
|
|
@@ -1455,22 +1455,22 @@ const me = {
|
|
|
1455
1455
|
stringify(s, e, t, n) {
|
|
1456
1456
|
return e = Object.assign({ actualString: !0 }, e), Oe(s, e, t, n);
|
|
1457
1457
|
}
|
|
1458
|
-
},
|
|
1458
|
+
}, Je = {
|
|
1459
1459
|
identify: (s) => s == null,
|
|
1460
|
-
createNode: () => new
|
|
1460
|
+
createNode: () => new O(null),
|
|
1461
1461
|
default: !0,
|
|
1462
1462
|
tag: "tag:yaml.org,2002:null",
|
|
1463
1463
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
1464
|
-
resolve: () => new
|
|
1465
|
-
stringify: ({ source: s }, e) => typeof s == "string" &&
|
|
1466
|
-
},
|
|
1464
|
+
resolve: () => new O(null),
|
|
1465
|
+
stringify: ({ source: s }, e) => typeof s == "string" && Je.test.test(s) ? s : e.options.nullStr
|
|
1466
|
+
}, pt = {
|
|
1467
1467
|
identify: (s) => typeof s == "boolean",
|
|
1468
1468
|
default: !0,
|
|
1469
1469
|
tag: "tag:yaml.org,2002:bool",
|
|
1470
1470
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
1471
|
-
resolve: (s) => new
|
|
1471
|
+
resolve: (s) => new O(s[0] === "t" || s[0] === "T"),
|
|
1472
1472
|
stringify({ source: s, value: e }, t) {
|
|
1473
|
-
if (s &&
|
|
1473
|
+
if (s && pt.test.test(s)) {
|
|
1474
1474
|
const n = s[0] === "t" || s[0] === "T";
|
|
1475
1475
|
if (e === n)
|
|
1476
1476
|
return s;
|
|
@@ -1478,7 +1478,7 @@ const me = {
|
|
|
1478
1478
|
return e ? t.options.trueStr : t.options.falseStr;
|
|
1479
1479
|
}
|
|
1480
1480
|
};
|
|
1481
|
-
function
|
|
1481
|
+
function q({ format: s, minFractionDigits: e, tag: t, value: n }) {
|
|
1482
1482
|
if (typeof n == "bigint")
|
|
1483
1483
|
return String(n);
|
|
1484
1484
|
const i = typeof n == "number" ? n : Number(n);
|
|
@@ -1498,9 +1498,9 @@ const Zt = {
|
|
|
1498
1498
|
identify: (s) => typeof s == "number",
|
|
1499
1499
|
default: !0,
|
|
1500
1500
|
tag: "tag:yaml.org,2002:float",
|
|
1501
|
-
test: /^(?:[-+]?\.(?:inf|Inf|INF
|
|
1501
|
+
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
1502
1502
|
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
1503
|
-
stringify:
|
|
1503
|
+
stringify: q
|
|
1504
1504
|
}, xt = {
|
|
1505
1505
|
identify: (s) => typeof s == "number",
|
|
1506
1506
|
default: !0,
|
|
@@ -1510,7 +1510,7 @@ const Zt = {
|
|
|
1510
1510
|
resolve: (s) => parseFloat(s),
|
|
1511
1511
|
stringify(s) {
|
|
1512
1512
|
const e = Number(s.value);
|
|
1513
|
-
return isFinite(e) ? e.toExponential() :
|
|
1513
|
+
return isFinite(e) ? e.toExponential() : q(s);
|
|
1514
1514
|
}
|
|
1515
1515
|
}, es = {
|
|
1516
1516
|
identify: (s) => typeof s == "number",
|
|
@@ -1518,14 +1518,14 @@ const Zt = {
|
|
|
1518
1518
|
tag: "tag:yaml.org,2002:float",
|
|
1519
1519
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
1520
1520
|
resolve(s) {
|
|
1521
|
-
const e = new
|
|
1521
|
+
const e = new O(parseFloat(s)), t = s.indexOf(".");
|
|
1522
1522
|
return t !== -1 && s[s.length - 1] === "0" && (e.minFractionDigits = s.length - t - 1), e;
|
|
1523
1523
|
},
|
|
1524
|
-
stringify:
|
|
1525
|
-
}, Ye = (s) => typeof s == "bigint" || Number.isInteger(s),
|
|
1524
|
+
stringify: q
|
|
1525
|
+
}, Ye = (s) => typeof s == "bigint" || Number.isInteger(s), mt = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
|
|
1526
1526
|
function ts(s, e, t) {
|
|
1527
1527
|
const { value: n } = s;
|
|
1528
|
-
return Ye(n) && n >= 0 ? t + n.toString(e) :
|
|
1528
|
+
return Ye(n) && n >= 0 ? t + n.toString(e) : q(s);
|
|
1529
1529
|
}
|
|
1530
1530
|
const ss = {
|
|
1531
1531
|
identify: (s) => Ye(s) && s >= 0,
|
|
@@ -1533,29 +1533,29 @@ const ss = {
|
|
|
1533
1533
|
tag: "tag:yaml.org,2002:int",
|
|
1534
1534
|
format: "OCT",
|
|
1535
1535
|
test: /^0o[0-7]+$/,
|
|
1536
|
-
resolve: (s, e, t) =>
|
|
1536
|
+
resolve: (s, e, t) => mt(s, 2, 8, t),
|
|
1537
1537
|
stringify: (s) => ts(s, 8, "0o")
|
|
1538
1538
|
}, ns = {
|
|
1539
1539
|
identify: Ye,
|
|
1540
1540
|
default: !0,
|
|
1541
1541
|
tag: "tag:yaml.org,2002:int",
|
|
1542
1542
|
test: /^[-+]?[0-9]+$/,
|
|
1543
|
-
resolve: (s, e, t) =>
|
|
1544
|
-
stringify:
|
|
1543
|
+
resolve: (s, e, t) => mt(s, 0, 10, t),
|
|
1544
|
+
stringify: q
|
|
1545
1545
|
}, is = {
|
|
1546
1546
|
identify: (s) => Ye(s) && s >= 0,
|
|
1547
1547
|
default: !0,
|
|
1548
1548
|
tag: "tag:yaml.org,2002:int",
|
|
1549
1549
|
format: "HEX",
|
|
1550
1550
|
test: /^0x[0-9a-fA-F]+$/,
|
|
1551
|
-
resolve: (s, e, t) =>
|
|
1551
|
+
resolve: (s, e, t) => mt(s, 2, 16, t),
|
|
1552
1552
|
stringify: (s) => ts(s, 16, "0x")
|
|
1553
|
-
},
|
|
1553
|
+
}, Ys = [
|
|
1554
1554
|
pe,
|
|
1555
1555
|
me,
|
|
1556
|
-
Re,
|
|
1557
1556
|
Ve,
|
|
1558
|
-
|
|
1557
|
+
Je,
|
|
1558
|
+
pt,
|
|
1559
1559
|
ss,
|
|
1560
1560
|
ns,
|
|
1561
1561
|
is,
|
|
@@ -1563,25 +1563,25 @@ const ss = {
|
|
|
1563
1563
|
xt,
|
|
1564
1564
|
es
|
|
1565
1565
|
];
|
|
1566
|
-
function
|
|
1566
|
+
function Lt(s) {
|
|
1567
1567
|
return typeof s == "bigint" || Number.isInteger(s);
|
|
1568
1568
|
}
|
|
1569
|
-
const
|
|
1569
|
+
const Te = ({ value: s }) => JSON.stringify(s), Gs = [
|
|
1570
1570
|
{
|
|
1571
1571
|
identify: (s) => typeof s == "string",
|
|
1572
1572
|
default: !0,
|
|
1573
1573
|
tag: "tag:yaml.org,2002:str",
|
|
1574
1574
|
resolve: (s) => s,
|
|
1575
|
-
stringify:
|
|
1575
|
+
stringify: Te
|
|
1576
1576
|
},
|
|
1577
1577
|
{
|
|
1578
1578
|
identify: (s) => s == null,
|
|
1579
|
-
createNode: () => new
|
|
1579
|
+
createNode: () => new O(null),
|
|
1580
1580
|
default: !0,
|
|
1581
1581
|
tag: "tag:yaml.org,2002:null",
|
|
1582
1582
|
test: /^null$/,
|
|
1583
1583
|
resolve: () => null,
|
|
1584
|
-
stringify:
|
|
1584
|
+
stringify: Te
|
|
1585
1585
|
},
|
|
1586
1586
|
{
|
|
1587
1587
|
identify: (s) => typeof s == "boolean",
|
|
@@ -1589,15 +1589,15 @@ const Ie = ({ value: s }) => JSON.stringify(s), Gs = [
|
|
|
1589
1589
|
tag: "tag:yaml.org,2002:bool",
|
|
1590
1590
|
test: /^true|false$/,
|
|
1591
1591
|
resolve: (s) => s === "true",
|
|
1592
|
-
stringify:
|
|
1592
|
+
stringify: Te
|
|
1593
1593
|
},
|
|
1594
1594
|
{
|
|
1595
|
-
identify:
|
|
1595
|
+
identify: Lt,
|
|
1596
1596
|
default: !0,
|
|
1597
1597
|
tag: "tag:yaml.org,2002:int",
|
|
1598
1598
|
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
1599
1599
|
resolve: (s, e, { intAsBigInt: t }) => t ? BigInt(s) : parseInt(s, 10),
|
|
1600
|
-
stringify: ({ value: s }) =>
|
|
1600
|
+
stringify: ({ value: s }) => Lt(s) ? s.toString() : JSON.stringify(s)
|
|
1601
1601
|
},
|
|
1602
1602
|
{
|
|
1603
1603
|
identify: (s) => typeof s == "number",
|
|
@@ -1605,16 +1605,16 @@ const Ie = ({ value: s }) => JSON.stringify(s), Gs = [
|
|
|
1605
1605
|
tag: "tag:yaml.org,2002:float",
|
|
1606
1606
|
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
|
1607
1607
|
resolve: (s) => parseFloat(s),
|
|
1608
|
-
stringify:
|
|
1608
|
+
stringify: Te
|
|
1609
1609
|
}
|
|
1610
|
-
],
|
|
1610
|
+
], Qs = {
|
|
1611
1611
|
default: !0,
|
|
1612
1612
|
tag: "",
|
|
1613
1613
|
test: /^/,
|
|
1614
1614
|
resolve(s, e) {
|
|
1615
1615
|
return e(`Unresolved plain scalar ${JSON.stringify(s)}`), s;
|
|
1616
1616
|
}
|
|
1617
|
-
},
|
|
1617
|
+
}, Ws = [pe, me].concat(Gs, Qs), yt = {
|
|
1618
1618
|
identify: (s) => s instanceof Uint8Array,
|
|
1619
1619
|
// Buffer inherits from Uint8Array
|
|
1620
1620
|
default: !1,
|
|
@@ -1650,11 +1650,11 @@ const Ie = ({ value: s }) => JSON.stringify(s), Gs = [
|
|
|
1650
1650
|
l = btoa(a);
|
|
1651
1651
|
} else
|
|
1652
1652
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
1653
|
-
if (e || (e =
|
|
1654
|
-
const a = Math.max(n.options.lineWidth - n.indent.length, n.options.minContentWidth), c = Math.ceil(l.length / a),
|
|
1655
|
-
for (let f = 0,
|
|
1656
|
-
|
|
1657
|
-
l =
|
|
1653
|
+
if (e || (e = O.BLOCK_LITERAL), e !== O.QUOTE_DOUBLE) {
|
|
1654
|
+
const a = Math.max(n.options.lineWidth - n.indent.length, n.options.minContentWidth), c = Math.ceil(l.length / a), m = new Array(c);
|
|
1655
|
+
for (let f = 0, d = 0; f < c; ++f, d += a)
|
|
1656
|
+
m[f] = l.substr(d, a);
|
|
1657
|
+
l = m.join(e === O.BLOCK_LITERAL ? `
|
|
1658
1658
|
` : " ");
|
|
1659
1659
|
}
|
|
1660
1660
|
return Oe({ comment: s, type: e, value: l }, n, i, r);
|
|
@@ -1664,10 +1664,10 @@ function rs(s, e) {
|
|
|
1664
1664
|
if (de(s))
|
|
1665
1665
|
for (let t = 0; t < s.items.length; ++t) {
|
|
1666
1666
|
let n = s.items[t];
|
|
1667
|
-
if (!
|
|
1667
|
+
if (!I(n)) {
|
|
1668
1668
|
if (he(n)) {
|
|
1669
1669
|
n.items.length > 1 && e("Each pair must have its own sequence indicator");
|
|
1670
|
-
const i = n.items[0] || new v(new
|
|
1670
|
+
const i = n.items[0] || new v(new O(null));
|
|
1671
1671
|
if (n.commentBefore && (i.key.commentBefore = i.key.commentBefore ? `${n.commentBefore}
|
|
1672
1672
|
${i.key.commentBefore}` : n.commentBefore), n.comment) {
|
|
1673
1673
|
const r = i.value ?? i.key;
|
|
@@ -1676,7 +1676,7 @@ ${r.comment}` : n.comment;
|
|
|
1676
1676
|
}
|
|
1677
1677
|
n = i;
|
|
1678
1678
|
}
|
|
1679
|
-
s.items[t] =
|
|
1679
|
+
s.items[t] = I(n) ? n : new v(n);
|
|
1680
1680
|
}
|
|
1681
1681
|
}
|
|
1682
1682
|
else
|
|
@@ -1684,7 +1684,7 @@ ${r.comment}` : n.comment;
|
|
|
1684
1684
|
return s;
|
|
1685
1685
|
}
|
|
1686
1686
|
function os(s, e, t) {
|
|
1687
|
-
const { replacer: n } = t, i = new
|
|
1687
|
+
const { replacer: n } = t, i = new Y(s);
|
|
1688
1688
|
i.tag = "tag:yaml.org,2002:pairs";
|
|
1689
1689
|
let r = 0;
|
|
1690
1690
|
if (e && Symbol.iterator in Object(e))
|
|
@@ -1704,18 +1704,18 @@ function os(s, e, t) {
|
|
|
1704
1704
|
throw new TypeError(`Expected tuple with one key, not ${c.length} keys`);
|
|
1705
1705
|
} else
|
|
1706
1706
|
l = o;
|
|
1707
|
-
i.items.push(
|
|
1707
|
+
i.items.push(dt(l, a, t));
|
|
1708
1708
|
}
|
|
1709
1709
|
return i;
|
|
1710
1710
|
}
|
|
1711
|
-
const
|
|
1711
|
+
const gt = {
|
|
1712
1712
|
collection: "seq",
|
|
1713
1713
|
default: !1,
|
|
1714
1714
|
tag: "tag:yaml.org,2002:pairs",
|
|
1715
1715
|
resolve: rs,
|
|
1716
1716
|
createNode: os
|
|
1717
1717
|
};
|
|
1718
|
-
class oe extends
|
|
1718
|
+
class oe extends Y {
|
|
1719
1719
|
constructor() {
|
|
1720
1720
|
super(), this.add = P.prototype.add.bind(this), this.delete = P.prototype.delete.bind(this), this.get = P.prototype.get.bind(this), this.has = P.prototype.has.bind(this), this.set = P.prototype.set.bind(this), this.tag = oe.tag;
|
|
1721
1721
|
}
|
|
@@ -1730,7 +1730,7 @@ class oe extends G {
|
|
|
1730
1730
|
t != null && t.onCreate && t.onCreate(n);
|
|
1731
1731
|
for (const i of this.items) {
|
|
1732
1732
|
let r, o;
|
|
1733
|
-
if (
|
|
1733
|
+
if (I(i) ? (r = j(i.key, "", t), o = j(i.value, r, t)) : r = j(i, "", t), n.has(r))
|
|
1734
1734
|
throw new Error("Ordered maps must not include duplicate keys");
|
|
1735
1735
|
n.set(r, o);
|
|
1736
1736
|
}
|
|
@@ -1742,7 +1742,7 @@ class oe extends G {
|
|
|
1742
1742
|
}
|
|
1743
1743
|
}
|
|
1744
1744
|
oe.tag = "tag:yaml.org,2002:omap";
|
|
1745
|
-
const
|
|
1745
|
+
const bt = {
|
|
1746
1746
|
collection: "seq",
|
|
1747
1747
|
identify: (s) => s instanceof Map,
|
|
1748
1748
|
nodeClass: oe,
|
|
@@ -1751,7 +1751,7 @@ const wt = {
|
|
|
1751
1751
|
resolve(s, e) {
|
|
1752
1752
|
const t = rs(s, e), n = [];
|
|
1753
1753
|
for (const { key: i } of t.items)
|
|
1754
|
-
|
|
1754
|
+
E(i) && (n.includes(i.value) ? e(`Ordered maps must not include duplicate keys: ${i.value}`) : n.push(i.value));
|
|
1755
1755
|
return Object.assign(new oe(), t);
|
|
1756
1756
|
},
|
|
1757
1757
|
createNode: (s, e, t) => oe.from(s, e, t)
|
|
@@ -1764,22 +1764,22 @@ const as = {
|
|
|
1764
1764
|
default: !0,
|
|
1765
1765
|
tag: "tag:yaml.org,2002:bool",
|
|
1766
1766
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
1767
|
-
resolve: () => new
|
|
1767
|
+
resolve: () => new O(!0),
|
|
1768
1768
|
stringify: ls
|
|
1769
1769
|
}, cs = {
|
|
1770
1770
|
identify: (s) => s === !1,
|
|
1771
1771
|
default: !0,
|
|
1772
1772
|
tag: "tag:yaml.org,2002:bool",
|
|
1773
|
-
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)
|
|
1774
|
-
resolve: () => new
|
|
1773
|
+
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
|
|
1774
|
+
resolve: () => new O(!1),
|
|
1775
1775
|
stringify: ls
|
|
1776
1776
|
}, Hs = {
|
|
1777
1777
|
identify: (s) => typeof s == "number",
|
|
1778
1778
|
default: !0,
|
|
1779
1779
|
tag: "tag:yaml.org,2002:float",
|
|
1780
|
-
test: /^[-+]?\.(?:inf|Inf|INF
|
|
1780
|
+
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
1781
1781
|
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
1782
|
-
stringify:
|
|
1782
|
+
stringify: q
|
|
1783
1783
|
}, Xs = {
|
|
1784
1784
|
identify: (s) => typeof s == "number",
|
|
1785
1785
|
default: !0,
|
|
@@ -1789,7 +1789,7 @@ const as = {
|
|
|
1789
1789
|
resolve: (s) => parseFloat(s.replace(/_/g, "")),
|
|
1790
1790
|
stringify(s) {
|
|
1791
1791
|
const e = Number(s.value);
|
|
1792
|
-
return isFinite(e) ? e.toExponential() :
|
|
1792
|
+
return isFinite(e) ? e.toExponential() : q(s);
|
|
1793
1793
|
}
|
|
1794
1794
|
}, zs = {
|
|
1795
1795
|
identify: (s) => typeof s == "number",
|
|
@@ -1797,16 +1797,16 @@ const as = {
|
|
|
1797
1797
|
tag: "tag:yaml.org,2002:float",
|
|
1798
1798
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
1799
1799
|
resolve(s) {
|
|
1800
|
-
const e = new
|
|
1800
|
+
const e = new O(parseFloat(s.replace(/_/g, ""))), t = s.indexOf(".");
|
|
1801
1801
|
if (t !== -1) {
|
|
1802
1802
|
const n = s.substring(t + 1).replace(/_/g, "");
|
|
1803
1803
|
n[n.length - 1] === "0" && (e.minFractionDigits = n.length);
|
|
1804
1804
|
}
|
|
1805
1805
|
return e;
|
|
1806
1806
|
},
|
|
1807
|
-
stringify:
|
|
1807
|
+
stringify: q
|
|
1808
1808
|
}, Ae = (s) => typeof s == "bigint" || Number.isInteger(s);
|
|
1809
|
-
function
|
|
1809
|
+
function Ge(s, e, t, { intAsBigInt: n }) {
|
|
1810
1810
|
const i = s[0];
|
|
1811
1811
|
if ((i === "-" || i === "+") && (e += 1), s = s.substring(e).replace(/_/g, ""), n) {
|
|
1812
1812
|
switch (t) {
|
|
@@ -1826,13 +1826,13 @@ function Je(s, e, t, { intAsBigInt: n }) {
|
|
|
1826
1826
|
const r = parseInt(s, t);
|
|
1827
1827
|
return i === "-" ? -1 * r : r;
|
|
1828
1828
|
}
|
|
1829
|
-
function
|
|
1829
|
+
function wt(s, e, t) {
|
|
1830
1830
|
const { value: n } = s;
|
|
1831
1831
|
if (Ae(n)) {
|
|
1832
1832
|
const i = n.toString(e);
|
|
1833
1833
|
return n < 0 ? "-" + t + i.substr(1) : t + i;
|
|
1834
1834
|
}
|
|
1835
|
-
return
|
|
1835
|
+
return q(s);
|
|
1836
1836
|
}
|
|
1837
1837
|
const Zs = {
|
|
1838
1838
|
identify: Ae,
|
|
@@ -1840,31 +1840,31 @@ const Zs = {
|
|
|
1840
1840
|
tag: "tag:yaml.org,2002:int",
|
|
1841
1841
|
format: "BIN",
|
|
1842
1842
|
test: /^[-+]?0b[0-1_]+$/,
|
|
1843
|
-
resolve: (s, e, t) =>
|
|
1844
|
-
stringify: (s) =>
|
|
1843
|
+
resolve: (s, e, t) => Ge(s, 2, 2, t),
|
|
1844
|
+
stringify: (s) => wt(s, 2, "0b")
|
|
1845
1845
|
}, xs = {
|
|
1846
1846
|
identify: Ae,
|
|
1847
1847
|
default: !0,
|
|
1848
1848
|
tag: "tag:yaml.org,2002:int",
|
|
1849
1849
|
format: "OCT",
|
|
1850
1850
|
test: /^[-+]?0[0-7_]+$/,
|
|
1851
|
-
resolve: (s, e, t) =>
|
|
1852
|
-
stringify: (s) =>
|
|
1851
|
+
resolve: (s, e, t) => Ge(s, 1, 8, t),
|
|
1852
|
+
stringify: (s) => wt(s, 8, "0")
|
|
1853
1853
|
}, en = {
|
|
1854
1854
|
identify: Ae,
|
|
1855
1855
|
default: !0,
|
|
1856
1856
|
tag: "tag:yaml.org,2002:int",
|
|
1857
1857
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
1858
|
-
resolve: (s, e, t) =>
|
|
1859
|
-
stringify:
|
|
1858
|
+
resolve: (s, e, t) => Ge(s, 0, 10, t),
|
|
1859
|
+
stringify: q
|
|
1860
1860
|
}, tn = {
|
|
1861
1861
|
identify: Ae,
|
|
1862
1862
|
default: !0,
|
|
1863
1863
|
tag: "tag:yaml.org,2002:int",
|
|
1864
1864
|
format: "HEX",
|
|
1865
1865
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
1866
|
-
resolve: (s, e, t) =>
|
|
1867
|
-
stringify: (s) =>
|
|
1866
|
+
resolve: (s, e, t) => Ge(s, 2, 16, t),
|
|
1867
|
+
stringify: (s) => wt(s, 16, "0x")
|
|
1868
1868
|
};
|
|
1869
1869
|
class le extends P {
|
|
1870
1870
|
constructor(e) {
|
|
@@ -1872,7 +1872,7 @@ class le extends P {
|
|
|
1872
1872
|
}
|
|
1873
1873
|
add(e) {
|
|
1874
1874
|
let t;
|
|
1875
|
-
|
|
1875
|
+
I(e) ? t = e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? t = new v(e.key, null) : t = new v(e, null), H(this.items, t.key) || this.items.push(t);
|
|
1876
1876
|
}
|
|
1877
1877
|
/**
|
|
1878
1878
|
* If `keepPair` is `true`, returns the Pair matching `key`.
|
|
@@ -1880,7 +1880,7 @@ class le extends P {
|
|
|
1880
1880
|
*/
|
|
1881
1881
|
get(e, t) {
|
|
1882
1882
|
const n = H(this.items, e);
|
|
1883
|
-
return !t &&
|
|
1883
|
+
return !t && I(n) ? E(n.key) ? n.key.value : n.key : n;
|
|
1884
1884
|
}
|
|
1885
1885
|
set(e, t) {
|
|
1886
1886
|
if (typeof t != "boolean")
|
|
@@ -1902,12 +1902,12 @@ class le extends P {
|
|
|
1902
1902
|
const { replacer: i } = n, r = new this(e);
|
|
1903
1903
|
if (t && Symbol.iterator in Object(t))
|
|
1904
1904
|
for (let o of t)
|
|
1905
|
-
typeof i == "function" && (o = i.call(t, o, o)), r.items.push(
|
|
1905
|
+
typeof i == "function" && (o = i.call(t, o, o)), r.items.push(dt(o, null, n));
|
|
1906
1906
|
return r;
|
|
1907
1907
|
}
|
|
1908
1908
|
}
|
|
1909
1909
|
le.tag = "tag:yaml.org,2002:set";
|
|
1910
|
-
const
|
|
1910
|
+
const St = {
|
|
1911
1911
|
collection: "map",
|
|
1912
1912
|
identify: (s) => s instanceof Set,
|
|
1913
1913
|
nodeClass: le,
|
|
@@ -1924,7 +1924,7 @@ const kt = {
|
|
|
1924
1924
|
return s;
|
|
1925
1925
|
}
|
|
1926
1926
|
};
|
|
1927
|
-
function
|
|
1927
|
+
function kt(s, e) {
|
|
1928
1928
|
const t = s[0], n = t === "-" || t === "+" ? s.substring(1) : s, i = (o) => e ? BigInt(o) : Number(o), r = n.replace(/_/g, "").split(":").reduce((o, l) => o * i(60) + i(l), i(0));
|
|
1929
1929
|
return t === "-" ? i(-1) * r : r;
|
|
1930
1930
|
}
|
|
@@ -1933,7 +1933,7 @@ function fs(s) {
|
|
|
1933
1933
|
if (typeof e == "bigint")
|
|
1934
1934
|
t = (o) => BigInt(o);
|
|
1935
1935
|
else if (isNaN(e) || !isFinite(e))
|
|
1936
|
-
return
|
|
1936
|
+
return q(s);
|
|
1937
1937
|
let n = "";
|
|
1938
1938
|
e < 0 && (n = "-", e *= t(-1));
|
|
1939
1939
|
const i = t(60), r = [e % i];
|
|
@@ -1945,7 +1945,7 @@ const us = {
|
|
|
1945
1945
|
tag: "tag:yaml.org,2002:int",
|
|
1946
1946
|
format: "TIME",
|
|
1947
1947
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
1948
|
-
resolve: (s, e, { intAsBigInt: t }) =>
|
|
1948
|
+
resolve: (s, e, { intAsBigInt: t }) => kt(s, t),
|
|
1949
1949
|
stringify: fs
|
|
1950
1950
|
}, hs = {
|
|
1951
1951
|
identify: (s) => typeof s == "number",
|
|
@@ -1953,9 +1953,9 @@ const us = {
|
|
|
1953
1953
|
tag: "tag:yaml.org,2002:float",
|
|
1954
1954
|
format: "TIME",
|
|
1955
1955
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
1956
|
-
resolve: (s) =>
|
|
1956
|
+
resolve: (s) => kt(s, !1),
|
|
1957
1957
|
stringify: fs
|
|
1958
|
-
},
|
|
1958
|
+
}, Qe = {
|
|
1959
1959
|
identify: (s) => s instanceof Date,
|
|
1960
1960
|
default: !0,
|
|
1961
1961
|
tag: "tag:yaml.org,2002:timestamp",
|
|
@@ -1964,24 +1964,24 @@ const us = {
|
|
|
1964
1964
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
1965
1965
|
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
1966
1966
|
resolve(s) {
|
|
1967
|
-
const e = s.match(
|
|
1967
|
+
const e = s.match(Qe.test);
|
|
1968
1968
|
if (!e)
|
|
1969
1969
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
1970
1970
|
const [, t, n, i, r, o, l] = e.map(Number), a = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
|
|
1971
1971
|
let c = Date.UTC(t, n - 1, i, r || 0, o || 0, l || 0, a);
|
|
1972
|
-
const
|
|
1973
|
-
if (
|
|
1974
|
-
let f =
|
|
1972
|
+
const m = e[8];
|
|
1973
|
+
if (m && m !== "Z") {
|
|
1974
|
+
let f = kt(m, !1);
|
|
1975
1975
|
Math.abs(f) < 30 && (f *= 60), c -= 6e4 * f;
|
|
1976
1976
|
}
|
|
1977
1977
|
return new Date(c);
|
|
1978
1978
|
},
|
|
1979
1979
|
stringify: ({ value: s }) => s.toISOString().replace(/((T00:00)?:00)?\.000Z$/, "")
|
|
1980
|
-
},
|
|
1980
|
+
}, $t = [
|
|
1981
1981
|
pe,
|
|
1982
1982
|
me,
|
|
1983
|
-
Re,
|
|
1984
1983
|
Ve,
|
|
1984
|
+
Je,
|
|
1985
1985
|
as,
|
|
1986
1986
|
cs,
|
|
1987
1987
|
Zs,
|
|
@@ -1991,22 +1991,22 @@ const us = {
|
|
|
1991
1991
|
Hs,
|
|
1992
1992
|
Xs,
|
|
1993
1993
|
zs,
|
|
1994
|
-
|
|
1995
|
-
wt,
|
|
1994
|
+
yt,
|
|
1996
1995
|
bt,
|
|
1997
|
-
|
|
1996
|
+
gt,
|
|
1997
|
+
St,
|
|
1998
1998
|
us,
|
|
1999
1999
|
hs,
|
|
2000
|
-
|
|
2000
|
+
Qe
|
|
2001
2001
|
], _t = /* @__PURE__ */ new Map([
|
|
2002
|
-
["core",
|
|
2003
|
-
["failsafe", [pe, me,
|
|
2004
|
-
["json",
|
|
2005
|
-
["yaml11",
|
|
2006
|
-
["yaml-1.1",
|
|
2007
|
-
]),
|
|
2008
|
-
binary:
|
|
2009
|
-
bool:
|
|
2002
|
+
["core", Ys],
|
|
2003
|
+
["failsafe", [pe, me, Ve]],
|
|
2004
|
+
["json", Ws],
|
|
2005
|
+
["yaml11", $t],
|
|
2006
|
+
["yaml-1.1", $t]
|
|
2007
|
+
]), Ct = {
|
|
2008
|
+
binary: yt,
|
|
2009
|
+
bool: pt,
|
|
2010
2010
|
float: es,
|
|
2011
2011
|
floatExp: xt,
|
|
2012
2012
|
floatNaN: Zt,
|
|
@@ -2016,20 +2016,20 @@ const us = {
|
|
|
2016
2016
|
intOct: ss,
|
|
2017
2017
|
intTime: us,
|
|
2018
2018
|
map: pe,
|
|
2019
|
-
null:
|
|
2020
|
-
omap:
|
|
2021
|
-
pairs:
|
|
2019
|
+
null: Je,
|
|
2020
|
+
omap: bt,
|
|
2021
|
+
pairs: gt,
|
|
2022
2022
|
seq: me,
|
|
2023
|
-
set:
|
|
2024
|
-
timestamp:
|
|
2023
|
+
set: St,
|
|
2024
|
+
timestamp: Qe
|
|
2025
2025
|
}, sn = {
|
|
2026
|
-
"tag:yaml.org,2002:binary":
|
|
2027
|
-
"tag:yaml.org,2002:omap":
|
|
2028
|
-
"tag:yaml.org,2002:pairs":
|
|
2029
|
-
"tag:yaml.org,2002:set":
|
|
2030
|
-
"tag:yaml.org,2002:timestamp":
|
|
2026
|
+
"tag:yaml.org,2002:binary": yt,
|
|
2027
|
+
"tag:yaml.org,2002:omap": bt,
|
|
2028
|
+
"tag:yaml.org,2002:pairs": gt,
|
|
2029
|
+
"tag:yaml.org,2002:set": St,
|
|
2030
|
+
"tag:yaml.org,2002:timestamp": Qe
|
|
2031
2031
|
};
|
|
2032
|
-
function
|
|
2032
|
+
function xe(s, e) {
|
|
2033
2033
|
let t = _t.get(e);
|
|
2034
2034
|
if (!t)
|
|
2035
2035
|
if (Array.isArray(s))
|
|
@@ -2045,17 +2045,17 @@ function Ze(s, e) {
|
|
|
2045
2045
|
return t.map((n) => {
|
|
2046
2046
|
if (typeof n != "string")
|
|
2047
2047
|
return n;
|
|
2048
|
-
const i =
|
|
2048
|
+
const i = Ct[n];
|
|
2049
2049
|
if (i)
|
|
2050
2050
|
return i;
|
|
2051
|
-
const r = Object.keys(
|
|
2051
|
+
const r = Object.keys(Ct).map((o) => JSON.stringify(o)).join(", ");
|
|
2052
2052
|
throw new Error(`Unknown custom tag "${n}"; use one of ${r}`);
|
|
2053
2053
|
});
|
|
2054
2054
|
}
|
|
2055
2055
|
const nn = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
|
|
2056
2056
|
class We {
|
|
2057
2057
|
constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: l }) {
|
|
2058
|
-
this.compat = Array.isArray(e) ?
|
|
2058
|
+
this.compat = Array.isArray(e) ? xe(e, "compat") : e ? xe(null, e) : null, this.merge = !!n, this.name = typeof r == "string" && r || "core", this.knownTags = i ? sn : {}, this.tags = xe(t, this.name), this.toStringOptions = l ?? null, Object.defineProperty(this, V, { value: pe }), Object.defineProperty(this, R, { value: Ve }), Object.defineProperty(this, fe, { value: me }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? nn : null;
|
|
2059
2059
|
}
|
|
2060
2060
|
clone() {
|
|
2061
2061
|
const e = Object.create(We.prototype, Object.getOwnPropertyDescriptors(this));
|
|
@@ -2071,36 +2071,36 @@ function rn(s, e) {
|
|
|
2071
2071
|
c ? (t.push(c), n = !0) : s.directives.docStart && (n = !0);
|
|
2072
2072
|
}
|
|
2073
2073
|
n && t.push("---");
|
|
2074
|
-
const i =
|
|
2074
|
+
const i = Wt(s, e), { commentString: r } = i.options;
|
|
2075
2075
|
if (s.commentBefore) {
|
|
2076
2076
|
t.length !== 1 && t.unshift("");
|
|
2077
2077
|
const c = r(s.commentBefore);
|
|
2078
|
-
t.unshift(
|
|
2078
|
+
t.unshift(F(c, ""));
|
|
2079
2079
|
}
|
|
2080
2080
|
let o = !1, l = null;
|
|
2081
2081
|
if (s.contents) {
|
|
2082
2082
|
if ($(s.contents)) {
|
|
2083
2083
|
if (s.contents.spaceBefore && n && t.push(""), s.contents.commentBefore) {
|
|
2084
2084
|
const f = r(s.contents.commentBefore);
|
|
2085
|
-
t.push(
|
|
2085
|
+
t.push(F(f, ""));
|
|
2086
2086
|
}
|
|
2087
2087
|
i.forceBlockIndent = !!s.comment, l = s.contents.comment;
|
|
2088
2088
|
}
|
|
2089
2089
|
const c = l ? void 0 : () => o = !0;
|
|
2090
|
-
let
|
|
2091
|
-
l && (
|
|
2090
|
+
let m = ae(s.contents, i, () => l = null, c);
|
|
2091
|
+
l && (m += W(m, "", r(l))), (m[0] === "|" || m[0] === ">") && t[t.length - 1] === "---" ? t[t.length - 1] = `--- ${m}` : t.push(m);
|
|
2092
2092
|
} else
|
|
2093
2093
|
t.push(ae(s.contents, i));
|
|
2094
2094
|
if ((a = s.directives) != null && a.docEnd)
|
|
2095
2095
|
if (s.comment) {
|
|
2096
2096
|
const c = r(s.comment);
|
|
2097
2097
|
c.includes(`
|
|
2098
|
-
`) ? (t.push("..."), t.push(
|
|
2098
|
+
`) ? (t.push("..."), t.push(F(c, ""))) : t.push(`... ${c}`);
|
|
2099
2099
|
} else
|
|
2100
2100
|
t.push("...");
|
|
2101
2101
|
else {
|
|
2102
2102
|
let c = s.comment;
|
|
2103
|
-
c && o && (c = c.replace(/^\n+/, "")), c && ((!o || l) && t[t.length - 1] !== "" && t.push(""), t.push(
|
|
2103
|
+
c && o && (c = c.replace(/^\n+/, "")), c && ((!o || l) && t[t.length - 1] !== "" && t.push(""), t.push(F(r(c), "")));
|
|
2104
2104
|
}
|
|
2105
2105
|
return t.join(`
|
|
2106
2106
|
`) + `
|
|
@@ -2154,34 +2154,34 @@ class ye {
|
|
|
2154
2154
|
*/
|
|
2155
2155
|
createAlias(e, t) {
|
|
2156
2156
|
if (!e.anchor) {
|
|
2157
|
-
const n =
|
|
2157
|
+
const n = Vt(this);
|
|
2158
2158
|
e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2159
2159
|
!t || n.has(t) ? Jt(t || "a", n) : t;
|
|
2160
2160
|
}
|
|
2161
|
-
return new
|
|
2161
|
+
return new qe(e.anchor);
|
|
2162
2162
|
}
|
|
2163
2163
|
createNode(e, t, n) {
|
|
2164
2164
|
let i;
|
|
2165
2165
|
if (typeof t == "function")
|
|
2166
2166
|
e = t.call({ "": e }, "", e), i = t;
|
|
2167
2167
|
else if (Array.isArray(t)) {
|
|
2168
|
-
const
|
|
2169
|
-
|
|
2168
|
+
const p = (w) => typeof w == "number" || w instanceof String || w instanceof Number, g = t.filter(p).map(String);
|
|
2169
|
+
g.length > 0 && (t = t.concat(g)), i = t;
|
|
2170
2170
|
} else n === void 0 && t && (n = t, t = void 0);
|
|
2171
|
-
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: l, keepUndefined: a, onTagObj: c, tag:
|
|
2171
|
+
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: l, keepUndefined: a, onTagObj: c, tag: m } = n ?? {}, { onAnchor: f, setAnchors: d, sourceObjects: h } = vs(
|
|
2172
2172
|
this,
|
|
2173
2173
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2174
2174
|
o || "a"
|
|
2175
|
-
),
|
|
2175
|
+
), y = {
|
|
2176
2176
|
aliasDuplicateObjects: r ?? !0,
|
|
2177
2177
|
keepUndefined: a ?? !1,
|
|
2178
2178
|
onAnchor: f,
|
|
2179
2179
|
onTagObj: c,
|
|
2180
2180
|
replacer: i,
|
|
2181
2181
|
schema: this.schema,
|
|
2182
|
-
sourceObjects:
|
|
2183
|
-
},
|
|
2184
|
-
return l &&
|
|
2182
|
+
sourceObjects: h
|
|
2183
|
+
}, u = Se(e, m, y);
|
|
2184
|
+
return l && L(u) && (u.flow = !0), d(), u;
|
|
2185
2185
|
}
|
|
2186
2186
|
/**
|
|
2187
2187
|
* Convert a key and a value into a `Pair` using the current schema,
|
|
@@ -2211,7 +2211,7 @@ class ye {
|
|
|
2211
2211
|
* `true` (collections are always returned intact).
|
|
2212
2212
|
*/
|
|
2213
2213
|
get(e, t) {
|
|
2214
|
-
return
|
|
2214
|
+
return L(this.contents) ? this.contents.get(e, t) : void 0;
|
|
2215
2215
|
}
|
|
2216
2216
|
/**
|
|
2217
2217
|
* Returns item at `path`, or `undefined` if not found. By default unwraps
|
|
@@ -2219,33 +2219,33 @@ class ye {
|
|
|
2219
2219
|
* `true` (collections are always returned intact).
|
|
2220
2220
|
*/
|
|
2221
2221
|
getIn(e, t) {
|
|
2222
|
-
return be(e) ? !t &&
|
|
2222
|
+
return be(e) ? !t && E(this.contents) ? this.contents.value : this.contents : L(this.contents) ? this.contents.getIn(e, t) : void 0;
|
|
2223
2223
|
}
|
|
2224
2224
|
/**
|
|
2225
2225
|
* Checks if the document includes a value with the key `key`.
|
|
2226
2226
|
*/
|
|
2227
2227
|
has(e) {
|
|
2228
|
-
return
|
|
2228
|
+
return L(this.contents) ? this.contents.has(e) : !1;
|
|
2229
2229
|
}
|
|
2230
2230
|
/**
|
|
2231
2231
|
* Checks if the document includes a value at `path`.
|
|
2232
2232
|
*/
|
|
2233
2233
|
hasIn(e) {
|
|
2234
|
-
return be(e) ? this.contents !== void 0 :
|
|
2234
|
+
return be(e) ? this.contents !== void 0 : L(this.contents) ? this.contents.hasIn(e) : !1;
|
|
2235
2235
|
}
|
|
2236
2236
|
/**
|
|
2237
2237
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
2238
2238
|
* boolean to add/remove the item from the set.
|
|
2239
2239
|
*/
|
|
2240
2240
|
set(e, t) {
|
|
2241
|
-
this.contents == null ? this.contents =
|
|
2241
|
+
this.contents == null ? this.contents = Me(this.schema, [e], t) : ee(this.contents) && this.contents.set(e, t);
|
|
2242
2242
|
}
|
|
2243
2243
|
/**
|
|
2244
2244
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
2245
2245
|
* boolean to add/remove the item from the set.
|
|
2246
2246
|
*/
|
|
2247
2247
|
setIn(e, t) {
|
|
2248
|
-
be(e) ? this.contents = t : this.contents == null ? this.contents =
|
|
2248
|
+
be(e) ? this.contents = t : this.contents == null ? this.contents = Me(this.schema, Array.from(e), t) : ee(this.contents) && this.contents.setIn(e, t);
|
|
2249
2249
|
}
|
|
2250
2250
|
/**
|
|
2251
2251
|
* Change the YAML version and schema used by the document.
|
|
@@ -2289,10 +2289,10 @@ class ye {
|
|
|
2289
2289
|
mapAsMap: n === !0,
|
|
2290
2290
|
mapKeyWarned: !1,
|
|
2291
2291
|
maxAliasCount: typeof i == "number" ? i : 100
|
|
2292
|
-
}, a =
|
|
2292
|
+
}, a = j(this.contents, t ?? "", l);
|
|
2293
2293
|
if (typeof r == "function")
|
|
2294
|
-
for (const { count: c, res:
|
|
2295
|
-
r(
|
|
2294
|
+
for (const { count: c, res: m } of l.anchors.values())
|
|
2295
|
+
r(m, c);
|
|
2296
2296
|
return typeof o == "function" ? ie(o, { "": a }, "", a) : a;
|
|
2297
2297
|
}
|
|
2298
2298
|
/**
|
|
@@ -2316,26 +2316,26 @@ class ye {
|
|
|
2316
2316
|
}
|
|
2317
2317
|
}
|
|
2318
2318
|
function ee(s) {
|
|
2319
|
-
if (
|
|
2319
|
+
if (L(s))
|
|
2320
2320
|
return !0;
|
|
2321
2321
|
throw new Error("Expected a YAML collection as document contents");
|
|
2322
2322
|
}
|
|
2323
|
-
class
|
|
2323
|
+
class Nt extends Error {
|
|
2324
2324
|
constructor(e, t, n, i) {
|
|
2325
2325
|
super(), this.name = e, this.code = n, this.message = i, this.pos = t;
|
|
2326
2326
|
}
|
|
2327
2327
|
}
|
|
2328
|
-
class X extends
|
|
2328
|
+
class X extends Nt {
|
|
2329
2329
|
constructor(e, t, n) {
|
|
2330
2330
|
super("YAMLParseError", e, t, n);
|
|
2331
2331
|
}
|
|
2332
2332
|
}
|
|
2333
|
-
class ds extends
|
|
2333
|
+
class ds extends Nt {
|
|
2334
2334
|
constructor(e, t, n) {
|
|
2335
2335
|
super("YAMLWarning", e, t, n);
|
|
2336
2336
|
}
|
|
2337
2337
|
}
|
|
2338
|
-
const
|
|
2338
|
+
const je = (s, e) => (t) => {
|
|
2339
2339
|
if (t.pos[0] === -1)
|
|
2340
2340
|
return;
|
|
2341
2341
|
t.linePos = t.pos.map((l) => e.linePos(l));
|
|
@@ -2363,52 +2363,52 @@ ${c}
|
|
|
2363
2363
|
`;
|
|
2364
2364
|
}
|
|
2365
2365
|
};
|
|
2366
|
-
function ce(s, { flow: e, indicator: t, next: n, offset: i, onError: r,
|
|
2367
|
-
let
|
|
2368
|
-
for (const
|
|
2369
|
-
switch (
|
|
2366
|
+
function ce(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIndent: o, startOnNewline: l }) {
|
|
2367
|
+
let a = !1, c = l, m = l, f = "", d = "", h = !1, y = !1, u = null, p = null, g = null, w = null, N = null, S = null, A = null;
|
|
2368
|
+
for (const b of s)
|
|
2369
|
+
switch (y && (b.type !== "space" && b.type !== "newline" && b.type !== "comma" && r(b.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), y = !1), u && (c && b.type !== "comment" && b.type !== "newline" && r(u, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), u = null), b.type) {
|
|
2370
2370
|
case "space":
|
|
2371
|
-
!e &&
|
|
2371
|
+
!e && (t !== "doc-start" || (n == null ? void 0 : n.type) !== "flow-collection") && b.source.includes(" ") && (u = b), m = !0;
|
|
2372
2372
|
break;
|
|
2373
2373
|
case "comment": {
|
|
2374
|
-
|
|
2375
|
-
const
|
|
2376
|
-
|
|
2374
|
+
m || r(b, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
|
|
2375
|
+
const _ = b.source.substring(1) || " ";
|
|
2376
|
+
f ? f += d + _ : f = _, d = "", c = !1;
|
|
2377
2377
|
break;
|
|
2378
2378
|
}
|
|
2379
2379
|
case "newline":
|
|
2380
|
-
|
|
2380
|
+
c ? f ? f += b.source : a = !0 : d += b.source, c = !0, h = !0, (p || g) && (w = b), m = !0;
|
|
2381
2381
|
break;
|
|
2382
2382
|
case "anchor":
|
|
2383
|
-
|
|
2383
|
+
p && r(b, "MULTIPLE_ANCHORS", "A node can have at most one anchor"), b.source.endsWith(":") && r(b.offset + b.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", !0), p = b, A === null && (A = b.offset), c = !1, m = !1, y = !0;
|
|
2384
2384
|
break;
|
|
2385
2385
|
case "tag": {
|
|
2386
|
-
|
|
2386
|
+
g && r(b, "MULTIPLE_TAGS", "A node can have at most one tag"), g = b, A === null && (A = b.offset), c = !1, m = !1, y = !0;
|
|
2387
2387
|
break;
|
|
2388
2388
|
}
|
|
2389
2389
|
case t:
|
|
2390
|
-
(
|
|
2390
|
+
(p || g) && r(b, "BAD_PROP_ORDER", `Anchors and tags must be after the ${b.source} indicator`), S && r(b, "UNEXPECTED_TOKEN", `Unexpected ${b.source} in ${e ?? "collection"}`), S = b, c = t === "seq-item-ind" || t === "explicit-key-ind", m = !1;
|
|
2391
2391
|
break;
|
|
2392
2392
|
case "comma":
|
|
2393
2393
|
if (e) {
|
|
2394
|
-
|
|
2394
|
+
N && r(b, "UNEXPECTED_TOKEN", `Unexpected , in ${e}`), N = b, c = !1, m = !1;
|
|
2395
2395
|
break;
|
|
2396
2396
|
}
|
|
2397
2397
|
default:
|
|
2398
|
-
r(
|
|
2398
|
+
r(b, "UNEXPECTED_TOKEN", `Unexpected ${b.type} token`), c = !1, m = !1;
|
|
2399
2399
|
}
|
|
2400
|
-
const
|
|
2401
|
-
return
|
|
2402
|
-
comma:
|
|
2403
|
-
found:
|
|
2404
|
-
spaceBefore:
|
|
2405
|
-
comment:
|
|
2406
|
-
hasNewline:
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
end:
|
|
2411
|
-
start:
|
|
2400
|
+
const k = s[s.length - 1], T = k ? k.offset + k.source.length : i;
|
|
2401
|
+
return y && n && n.type !== "space" && n.type !== "newline" && n.type !== "comma" && (n.type !== "scalar" || n.source !== "") && r(n.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), u && (c && u.indent <= o || (n == null ? void 0 : n.type) === "block-map" || (n == null ? void 0 : n.type) === "block-seq") && r(u, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), {
|
|
2402
|
+
comma: N,
|
|
2403
|
+
found: S,
|
|
2404
|
+
spaceBefore: a,
|
|
2405
|
+
comment: f,
|
|
2406
|
+
hasNewline: h,
|
|
2407
|
+
anchor: p,
|
|
2408
|
+
tag: g,
|
|
2409
|
+
newlineAfterProp: w,
|
|
2410
|
+
end: T,
|
|
2411
|
+
start: A ?? T
|
|
2412
2412
|
};
|
|
2413
2413
|
}
|
|
2414
2414
|
function ke(s) {
|
|
@@ -2456,76 +2456,79 @@ function ps(s, e, t) {
|
|
|
2456
2456
|
const { uniqueKeys: n } = s.options;
|
|
2457
2457
|
if (n === !1)
|
|
2458
2458
|
return !1;
|
|
2459
|
-
const i = typeof n == "function" ? n : (r, o) => r === o ||
|
|
2459
|
+
const i = typeof n == "function" ? n : (r, o) => r === o || E(r) && E(o) && r.value === o.value && !(r.value === "<<" && s.schema.merge);
|
|
2460
2460
|
return e.some((r) => i(r.key, t));
|
|
2461
2461
|
}
|
|
2462
|
-
const
|
|
2462
|
+
const vt = "All mapping items must start at the same column";
|
|
2463
2463
|
function on({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2464
|
-
var
|
|
2464
|
+
var m;
|
|
2465
2465
|
const o = (r == null ? void 0 : r.nodeClass) ?? P, l = new o(t.schema);
|
|
2466
2466
|
t.atRoot && (t.atRoot = !1);
|
|
2467
2467
|
let a = n.offset, c = null;
|
|
2468
2468
|
for (const f of n.items) {
|
|
2469
|
-
const { start:
|
|
2469
|
+
const { start: d, key: h, sep: y, value: u } = f, p = ce(d, {
|
|
2470
2470
|
indicator: "explicit-key-ind",
|
|
2471
|
-
next:
|
|
2471
|
+
next: h ?? (y == null ? void 0 : y[0]),
|
|
2472
2472
|
offset: a,
|
|
2473
2473
|
onError: i,
|
|
2474
|
+
parentIndent: n.indent,
|
|
2474
2475
|
startOnNewline: !0
|
|
2475
|
-
}),
|
|
2476
|
-
if (
|
|
2477
|
-
if (
|
|
2478
|
-
c =
|
|
2479
|
-
` +
|
|
2476
|
+
}), g = !p.found;
|
|
2477
|
+
if (g) {
|
|
2478
|
+
if (h && (h.type === "block-seq" ? i(a, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in h && h.indent !== n.indent && i(a, "BAD_INDENT", vt)), !p.anchor && !p.tag && !y) {
|
|
2479
|
+
c = p.end, p.comment && (l.comment ? l.comment += `
|
|
2480
|
+
` + p.comment : l.comment = p.comment);
|
|
2480
2481
|
continue;
|
|
2481
2482
|
}
|
|
2482
|
-
(
|
|
2483
|
-
} else ((
|
|
2484
|
-
const w =
|
|
2485
|
-
t.schema.compat && ct(n.indent,
|
|
2486
|
-
const S = ce(
|
|
2483
|
+
(p.newlineAfterProp || ke(h)) && i(h ?? d[d.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
|
|
2484
|
+
} else ((m = p.found) == null ? void 0 : m.indent) !== n.indent && i(a, "BAD_INDENT", vt);
|
|
2485
|
+
const w = p.end, N = h ? s(t, h, p, i) : e(t, w, d, null, p, i);
|
|
2486
|
+
t.schema.compat && ct(n.indent, h, i), ps(t, l.items, N) && i(w, "DUPLICATE_KEY", "Map keys must be unique");
|
|
2487
|
+
const S = ce(y ?? [], {
|
|
2487
2488
|
indicator: "map-value-ind",
|
|
2488
|
-
next:
|
|
2489
|
-
offset:
|
|
2489
|
+
next: u,
|
|
2490
|
+
offset: N.range[2],
|
|
2490
2491
|
onError: i,
|
|
2491
|
-
|
|
2492
|
+
parentIndent: n.indent,
|
|
2493
|
+
startOnNewline: !h || h.type === "block-scalar"
|
|
2492
2494
|
});
|
|
2493
2495
|
if (a = S.end, S.found) {
|
|
2494
|
-
|
|
2495
|
-
const
|
|
2496
|
-
t.schema.compat && ct(n.indent,
|
|
2497
|
-
const
|
|
2498
|
-
t.options.keepSourceTokens && (
|
|
2496
|
+
g && ((u == null ? void 0 : u.type) === "block-map" && !S.hasNewline && i(a, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && p.start < S.found.offset - 1024 && i(N.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
|
|
2497
|
+
const A = u ? s(t, u, S, i) : e(t, a, y, null, S, i);
|
|
2498
|
+
t.schema.compat && ct(n.indent, u, i), a = A.range[2];
|
|
2499
|
+
const k = new v(N, A);
|
|
2500
|
+
t.options.keepSourceTokens && (k.srcToken = f), l.items.push(k);
|
|
2499
2501
|
} else {
|
|
2500
|
-
|
|
2501
|
-
` + S.comment :
|
|
2502
|
-
const
|
|
2503
|
-
t.options.keepSourceTokens && (
|
|
2502
|
+
g && i(N.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"), S.comment && (N.comment ? N.comment += `
|
|
2503
|
+
` + S.comment : N.comment = S.comment);
|
|
2504
|
+
const A = new v(N);
|
|
2505
|
+
t.options.keepSourceTokens && (A.srcToken = f), l.items.push(A);
|
|
2504
2506
|
}
|
|
2505
2507
|
}
|
|
2506
2508
|
return c && c < a && i(c, "IMPOSSIBLE", "Map comment with trailing content"), l.range = [n.offset, a, c ?? a], l;
|
|
2507
2509
|
}
|
|
2508
2510
|
function ln({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2509
|
-
const o = (r == null ? void 0 : r.nodeClass) ??
|
|
2511
|
+
const o = (r == null ? void 0 : r.nodeClass) ?? Y, l = new o(t.schema);
|
|
2510
2512
|
t.atRoot && (t.atRoot = !1);
|
|
2511
2513
|
let a = n.offset, c = null;
|
|
2512
|
-
for (const { start:
|
|
2513
|
-
const
|
|
2514
|
+
for (const { start: m, value: f } of n.items) {
|
|
2515
|
+
const d = ce(m, {
|
|
2514
2516
|
indicator: "seq-item-ind",
|
|
2515
2517
|
next: f,
|
|
2516
2518
|
offset: a,
|
|
2517
2519
|
onError: i,
|
|
2520
|
+
parentIndent: n.indent,
|
|
2518
2521
|
startOnNewline: !0
|
|
2519
2522
|
});
|
|
2520
|
-
if (!
|
|
2521
|
-
if (
|
|
2522
|
-
f && f.type === "block-seq" ? i(
|
|
2523
|
+
if (!d.found)
|
|
2524
|
+
if (d.anchor || d.tag || f)
|
|
2525
|
+
f && f.type === "block-seq" ? i(d.end, "BAD_INDENT", "All sequence items must start at the same column") : i(a, "MISSING_CHAR", "Sequence item without - indicator");
|
|
2523
2526
|
else {
|
|
2524
|
-
c =
|
|
2527
|
+
c = d.end, d.comment && (l.comment = d.comment);
|
|
2525
2528
|
continue;
|
|
2526
2529
|
}
|
|
2527
|
-
const
|
|
2528
|
-
t.schema.compat && ct(n.indent, f, i), a =
|
|
2530
|
+
const h = f ? s(t, f, d, i) : e(t, d.end, m, null, d, i);
|
|
2531
|
+
t.schema.compat && ct(n.indent, f, i), a = h.range[2], l.items.push(h);
|
|
2529
2532
|
}
|
|
2530
2533
|
return l.range = [n.offset, a, c ?? a], l;
|
|
2531
2534
|
}
|
|
@@ -2541,8 +2544,8 @@ function Ee(s, e, t, n) {
|
|
|
2541
2544
|
break;
|
|
2542
2545
|
case "comment": {
|
|
2543
2546
|
t && !r && n(l, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
|
|
2544
|
-
const
|
|
2545
|
-
i ? i += o +
|
|
2547
|
+
const m = a.substring(1) || " ";
|
|
2548
|
+
i ? i += o + m : i = m, o = "";
|
|
2546
2549
|
break;
|
|
2547
2550
|
}
|
|
2548
2551
|
case "newline":
|
|
@@ -2556,72 +2559,74 @@ function Ee(s, e, t, n) {
|
|
|
2556
2559
|
}
|
|
2557
2560
|
return { comment: i, offset: e };
|
|
2558
2561
|
}
|
|
2559
|
-
const
|
|
2562
|
+
const et = "Block collections are not allowed within flow collections", tt = (s) => s && (s.type === "block-map" || s.type === "block-seq");
|
|
2560
2563
|
function an({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2561
|
-
const o = n.start.source === "{", l = o ? "flow map" : "flow sequence", a = (r == null ? void 0 : r.nodeClass) ?? (o ? P :
|
|
2564
|
+
const o = n.start.source === "{", l = o ? "flow map" : "flow sequence", a = (r == null ? void 0 : r.nodeClass) ?? (o ? P : Y), c = new a(t.schema);
|
|
2562
2565
|
c.flow = !0;
|
|
2563
|
-
const
|
|
2564
|
-
|
|
2566
|
+
const m = t.atRoot;
|
|
2567
|
+
m && (t.atRoot = !1);
|
|
2565
2568
|
let f = n.offset + n.start.source.length;
|
|
2566
|
-
for (let
|
|
2567
|
-
const
|
|
2569
|
+
for (let p = 0; p < n.items.length; ++p) {
|
|
2570
|
+
const g = n.items[p], { start: w, key: N, sep: S, value: A } = g, k = ce(w, {
|
|
2568
2571
|
flow: l,
|
|
2569
2572
|
indicator: "explicit-key-ind",
|
|
2570
|
-
next:
|
|
2573
|
+
next: N ?? (S == null ? void 0 : S[0]),
|
|
2571
2574
|
offset: f,
|
|
2572
2575
|
onError: i,
|
|
2576
|
+
parentIndent: n.indent,
|
|
2573
2577
|
startOnNewline: !1
|
|
2574
2578
|
});
|
|
2575
|
-
if (!
|
|
2576
|
-
if (!
|
|
2577
|
-
|
|
2578
|
-
` +
|
|
2579
|
+
if (!k.found) {
|
|
2580
|
+
if (!k.anchor && !k.tag && !S && !A) {
|
|
2581
|
+
p === 0 && k.comma ? i(k.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${l}`) : p < n.items.length - 1 && i(k.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${l}`), k.comment && (c.comment ? c.comment += `
|
|
2582
|
+
` + k.comment : c.comment = k.comment), f = k.end;
|
|
2579
2583
|
continue;
|
|
2580
2584
|
}
|
|
2581
|
-
!o && t.options.strict && ke(
|
|
2582
|
-
|
|
2585
|
+
!o && t.options.strict && ke(N) && i(
|
|
2586
|
+
N,
|
|
2583
2587
|
// checked by containsNewline()
|
|
2584
2588
|
"MULTILINE_IMPLICIT_KEY",
|
|
2585
2589
|
"Implicit keys of flow sequence pairs need to be on a single line"
|
|
2586
2590
|
);
|
|
2587
2591
|
}
|
|
2588
|
-
if (
|
|
2589
|
-
|
|
2590
|
-
else if (
|
|
2591
|
-
let
|
|
2592
|
-
e: for (const
|
|
2593
|
-
switch (
|
|
2592
|
+
if (p === 0)
|
|
2593
|
+
k.comma && i(k.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${l}`);
|
|
2594
|
+
else if (k.comma || i(k.start, "MISSING_CHAR", `Missing , between ${l} items`), k.comment) {
|
|
2595
|
+
let T = "";
|
|
2596
|
+
e: for (const b of w)
|
|
2597
|
+
switch (b.type) {
|
|
2594
2598
|
case "comma":
|
|
2595
2599
|
case "space":
|
|
2596
2600
|
break;
|
|
2597
2601
|
case "comment":
|
|
2598
|
-
|
|
2602
|
+
T = b.source.substring(1);
|
|
2599
2603
|
break e;
|
|
2600
2604
|
default:
|
|
2601
2605
|
break e;
|
|
2602
2606
|
}
|
|
2603
|
-
if (
|
|
2604
|
-
let
|
|
2605
|
-
|
|
2606
|
-
` +
|
|
2607
|
+
if (T) {
|
|
2608
|
+
let b = c.items[c.items.length - 1];
|
|
2609
|
+
I(b) && (b = b.value ?? b.key), b.comment ? b.comment += `
|
|
2610
|
+
` + T : b.comment = T, k.comment = k.comment.substring(T.length + 1);
|
|
2607
2611
|
}
|
|
2608
2612
|
}
|
|
2609
|
-
if (!o && !S && !
|
|
2610
|
-
const
|
|
2611
|
-
c.items.push(
|
|
2613
|
+
if (!o && !S && !k.found) {
|
|
2614
|
+
const T = A ? s(t, A, k, i) : e(t, k.end, S, null, k, i);
|
|
2615
|
+
c.items.push(T), f = T.range[2], tt(A) && i(T.range, "BLOCK_IN_FLOW", et);
|
|
2612
2616
|
} else {
|
|
2613
|
-
const
|
|
2614
|
-
|
|
2617
|
+
const T = k.end, b = N ? s(t, N, k, i) : e(t, T, w, null, k, i);
|
|
2618
|
+
tt(N) && i(b.range, "BLOCK_IN_FLOW", et);
|
|
2615
2619
|
const _ = ce(S ?? [], {
|
|
2616
2620
|
flow: l,
|
|
2617
2621
|
indicator: "map-value-ind",
|
|
2618
|
-
next:
|
|
2619
|
-
offset:
|
|
2622
|
+
next: A,
|
|
2623
|
+
offset: b.range[2],
|
|
2620
2624
|
onError: i,
|
|
2625
|
+
parentIndent: n.indent,
|
|
2621
2626
|
startOnNewline: !1
|
|
2622
2627
|
});
|
|
2623
2628
|
if (_.found) {
|
|
2624
|
-
if (!o && !
|
|
2629
|
+
if (!o && !k.found && t.options.strict) {
|
|
2625
2630
|
if (S)
|
|
2626
2631
|
for (const C of S) {
|
|
2627
2632
|
if (C === _.found)
|
|
@@ -2631,121 +2636,126 @@ function an({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2631
2636
|
break;
|
|
2632
2637
|
}
|
|
2633
2638
|
}
|
|
2634
|
-
|
|
2639
|
+
k.start < _.found.offset - 1024 && i(_.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
|
|
2635
2640
|
}
|
|
2636
|
-
} else
|
|
2637
|
-
const
|
|
2638
|
-
|
|
2639
|
-
` + _.comment :
|
|
2640
|
-
const x = new v(
|
|
2641
|
-
if (t.options.keepSourceTokens && (x.srcToken =
|
|
2641
|
+
} else A && ("source" in A && A.source && A.source[0] === ":" ? i(A, "MISSING_CHAR", `Missing space after : in ${l}`) : i(_.start, "MISSING_CHAR", `Missing , or : between ${l} items`));
|
|
2642
|
+
const G = A ? s(t, A, _, i) : _.found ? e(t, _.end, S, null, _, i) : null;
|
|
2643
|
+
G ? tt(A) && i(G.range, "BLOCK_IN_FLOW", et) : _.comment && (b.comment ? b.comment += `
|
|
2644
|
+
` + _.comment : b.comment = _.comment);
|
|
2645
|
+
const x = new v(b, G);
|
|
2646
|
+
if (t.options.keepSourceTokens && (x.srcToken = g), o) {
|
|
2642
2647
|
const C = c;
|
|
2643
|
-
ps(t, C.items,
|
|
2648
|
+
ps(t, C.items, b) && i(T, "DUPLICATE_KEY", "Map keys must be unique"), C.items.push(x);
|
|
2644
2649
|
} else {
|
|
2645
2650
|
const C = new P(t.schema);
|
|
2646
2651
|
C.flow = !0, C.items.push(x), c.items.push(C);
|
|
2647
2652
|
}
|
|
2648
|
-
f =
|
|
2653
|
+
f = G ? G.range[2] : _.end;
|
|
2649
2654
|
}
|
|
2650
2655
|
}
|
|
2651
|
-
const
|
|
2652
|
-
let
|
|
2653
|
-
if (
|
|
2654
|
-
|
|
2656
|
+
const d = o ? "}" : "]", [h, ...y] = n.end;
|
|
2657
|
+
let u = f;
|
|
2658
|
+
if (h && h.source === d)
|
|
2659
|
+
u = h.offset + h.source.length;
|
|
2655
2660
|
else {
|
|
2656
|
-
const
|
|
2657
|
-
i(f,
|
|
2661
|
+
const p = l[0].toUpperCase() + l.substring(1), g = m ? `${p} must end with a ${d}` : `${p} in block collection must be sufficiently indented and end with a ${d}`;
|
|
2662
|
+
i(f, m ? "MISSING_CHAR" : "BAD_INDENT", g), h && h.source.length !== 1 && y.unshift(h);
|
|
2658
2663
|
}
|
|
2659
|
-
if (
|
|
2660
|
-
const
|
|
2661
|
-
|
|
2662
|
-
` +
|
|
2664
|
+
if (y.length > 0) {
|
|
2665
|
+
const p = Ee(y, u, t.options.strict, i);
|
|
2666
|
+
p.comment && (c.comment ? c.comment += `
|
|
2667
|
+
` + p.comment : c.comment = p.comment), c.range = [n.offset, u, p.offset];
|
|
2663
2668
|
} else
|
|
2664
|
-
c.range = [n.offset,
|
|
2669
|
+
c.range = [n.offset, u, u];
|
|
2665
2670
|
return c;
|
|
2666
2671
|
}
|
|
2667
|
-
function
|
|
2672
|
+
function st(s, e, t, n, i, r) {
|
|
2668
2673
|
const o = t.type === "block-map" ? on(s, e, t, n, r) : t.type === "block-seq" ? ln(s, e, t, n, r) : an(s, e, t, n, r), l = o.constructor;
|
|
2669
2674
|
return i === "!" || i === l.tagName ? (o.tag = l.tagName, o) : (i && (o.tag = i), o);
|
|
2670
2675
|
}
|
|
2671
2676
|
function cn(s, e, t, n, i) {
|
|
2672
|
-
var
|
|
2673
|
-
const r = n ? e.directives.tagName(
|
|
2674
|
-
if (
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2677
|
+
var d;
|
|
2678
|
+
const r = n.tag, o = r ? e.directives.tagName(r.source, (h) => i(r, "TAG_RESOLVE_FAILED", h)) : null;
|
|
2679
|
+
if (t.type === "block-seq") {
|
|
2680
|
+
const { anchor: h, newlineAfterProp: y } = n, u = h && r ? h.offset > r.offset ? h : r : h ?? r;
|
|
2681
|
+
u && (!y || y.offset < u.offset) && i(u, "MISSING_CHAR", "Missing newline after block sequence props");
|
|
2682
|
+
}
|
|
2683
|
+
const l = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
|
|
2684
|
+
if (!r || !o || o === "!" || o === P.tagName && l === "map" || o === Y.tagName && l === "seq")
|
|
2685
|
+
return st(s, e, t, i, o);
|
|
2686
|
+
let a = e.schema.tags.find((h) => h.tag === o && h.collection === l);
|
|
2687
|
+
if (!a) {
|
|
2688
|
+
const h = e.schema.knownTags[o];
|
|
2689
|
+
if (h && h.collection === l)
|
|
2690
|
+
e.schema.tags.push(Object.assign({}, h, { default: !1 })), a = h;
|
|
2681
2691
|
else
|
|
2682
|
-
return
|
|
2692
|
+
return h != null && h.collection ? i(r, "BAD_COLLECTION_TYPE", `${h.tag} used for ${l} collection, but expects ${h.collection}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), st(s, e, t, i, o);
|
|
2683
2693
|
}
|
|
2684
|
-
const
|
|
2685
|
-
return
|
|
2694
|
+
const c = st(s, e, t, i, o, a), m = ((d = a.resolve) == null ? void 0 : d.call(a, c, (h) => i(r, "TAG_RESOLVE_FAILED", h), e.options)) ?? c, f = $(m) ? m : new O(m);
|
|
2695
|
+
return f.range = c.range, f.tag = o, a != null && a.format && (f.format = a.format), f;
|
|
2686
2696
|
}
|
|
2687
2697
|
function ms(s, e, t) {
|
|
2688
|
-
const n =
|
|
2698
|
+
const n = e.offset, i = fn(e, s.options.strict, t);
|
|
2689
2699
|
if (!i)
|
|
2690
2700
|
return { value: "", type: null, comment: "", range: [n, n, n] };
|
|
2691
|
-
const r = i.mode === ">" ?
|
|
2701
|
+
const r = i.mode === ">" ? O.BLOCK_FOLDED : O.BLOCK_LITERAL, o = e.source ? un(e.source) : [];
|
|
2692
2702
|
let l = o.length;
|
|
2693
|
-
for (let
|
|
2694
|
-
const
|
|
2695
|
-
if (
|
|
2696
|
-
l =
|
|
2703
|
+
for (let u = o.length - 1; u >= 0; --u) {
|
|
2704
|
+
const p = o[u][1];
|
|
2705
|
+
if (p === "" || p === "\r")
|
|
2706
|
+
l = u;
|
|
2697
2707
|
else
|
|
2698
2708
|
break;
|
|
2699
2709
|
}
|
|
2700
2710
|
if (l === 0) {
|
|
2701
|
-
const
|
|
2711
|
+
const u = i.chomp === "+" && o.length > 0 ? `
|
|
2702
2712
|
`.repeat(Math.max(1, o.length - 1)) : "";
|
|
2703
|
-
let
|
|
2704
|
-
return
|
|
2705
|
-
}
|
|
2706
|
-
let a =
|
|
2707
|
-
for (let
|
|
2708
|
-
const [
|
|
2709
|
-
if (
|
|
2710
|
-
i.indent === 0 &&
|
|
2713
|
+
let p = n + i.length;
|
|
2714
|
+
return e.source && (p += e.source.length), { value: u, type: r, comment: i.comment, range: [n, p, p] };
|
|
2715
|
+
}
|
|
2716
|
+
let a = e.indent + i.indent, c = e.offset + i.length, m = 0;
|
|
2717
|
+
for (let u = 0; u < l; ++u) {
|
|
2718
|
+
const [p, g] = o[u];
|
|
2719
|
+
if (g === "" || g === "\r")
|
|
2720
|
+
i.indent === 0 && p.length > a && (a = p.length);
|
|
2711
2721
|
else {
|
|
2712
|
-
|
|
2722
|
+
p.length < a && t(c + p.length, "MISSING_CHAR", "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"), i.indent === 0 && (a = p.length), m = u, a === 0 && !s.atRoot && t(c, "BAD_INDENT", "Block scalar values in collections must be indented");
|
|
2713
2723
|
break;
|
|
2714
2724
|
}
|
|
2715
|
-
c +=
|
|
2725
|
+
c += p.length + g.length + 1;
|
|
2716
2726
|
}
|
|
2717
|
-
for (let
|
|
2718
|
-
o[
|
|
2719
|
-
let f = "",
|
|
2720
|
-
for (let
|
|
2721
|
-
f += o[
|
|
2727
|
+
for (let u = o.length - 1; u >= l; --u)
|
|
2728
|
+
o[u][0].length > a && (l = u + 1);
|
|
2729
|
+
let f = "", d = "", h = !1;
|
|
2730
|
+
for (let u = 0; u < m; ++u)
|
|
2731
|
+
f += o[u][0].slice(a) + `
|
|
2722
2732
|
`;
|
|
2723
|
-
for (let
|
|
2724
|
-
let [
|
|
2725
|
-
c +=
|
|
2726
|
-
const w =
|
|
2727
|
-
if (w && (
|
|
2733
|
+
for (let u = m; u < l; ++u) {
|
|
2734
|
+
let [p, g] = o[u];
|
|
2735
|
+
c += p.length + g.length + 1;
|
|
2736
|
+
const w = g[g.length - 1] === "\r";
|
|
2737
|
+
if (w && (g = g.slice(0, -1)), g && p.length < a) {
|
|
2728
2738
|
const S = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
|
|
2729
|
-
t(c -
|
|
2739
|
+
t(c - g.length - (w ? 2 : 1), "BAD_INDENT", S), p = "";
|
|
2730
2740
|
}
|
|
2731
|
-
r ===
|
|
2732
|
-
`) :
|
|
2733
|
-
` : !
|
|
2734
|
-
` && (
|
|
2741
|
+
r === O.BLOCK_LITERAL ? (f += d + p.slice(a) + g, d = `
|
|
2742
|
+
`) : p.length > a || g[0] === " " ? (d === " " ? d = `
|
|
2743
|
+
` : !h && d === `
|
|
2744
|
+
` && (d = `
|
|
2735
2745
|
|
|
2736
|
-
`), f +=
|
|
2737
|
-
`,
|
|
2746
|
+
`), f += d + p.slice(a) + g, d = `
|
|
2747
|
+
`, h = !0) : g === "" ? d === `
|
|
2738
2748
|
` ? f += `
|
|
2739
|
-
` :
|
|
2740
|
-
` : (f +=
|
|
2749
|
+
` : d = `
|
|
2750
|
+
` : (f += d + g, d = " ", h = !1);
|
|
2741
2751
|
}
|
|
2742
2752
|
switch (i.chomp) {
|
|
2743
2753
|
case "-":
|
|
2744
2754
|
break;
|
|
2745
2755
|
case "+":
|
|
2746
|
-
for (let
|
|
2756
|
+
for (let u = l; u < o.length; ++u)
|
|
2747
2757
|
f += `
|
|
2748
|
-
` + o[
|
|
2758
|
+
` + o[u][0].slice(a);
|
|
2749
2759
|
f[f.length - 1] !== `
|
|
2750
2760
|
` && (f += `
|
|
2751
2761
|
`);
|
|
@@ -2754,48 +2764,48 @@ function ms(s, e, t) {
|
|
|
2754
2764
|
f += `
|
|
2755
2765
|
`;
|
|
2756
2766
|
}
|
|
2757
|
-
const
|
|
2758
|
-
return { value: f, type: r, comment: i.comment, range: [n,
|
|
2767
|
+
const y = n + i.length + e.source.length;
|
|
2768
|
+
return { value: f, type: r, comment: i.comment, range: [n, y, y] };
|
|
2759
2769
|
}
|
|
2760
2770
|
function fn({ offset: s, props: e }, t, n) {
|
|
2761
2771
|
if (e[0].type !== "block-scalar-header")
|
|
2762
2772
|
return n(e[0], "IMPOSSIBLE", "Block scalar header not found"), null;
|
|
2763
2773
|
const { source: i } = e[0], r = i[0];
|
|
2764
2774
|
let o = 0, l = "", a = -1;
|
|
2765
|
-
for (let
|
|
2766
|
-
const
|
|
2767
|
-
if (!l && (
|
|
2768
|
-
l =
|
|
2775
|
+
for (let d = 1; d < i.length; ++d) {
|
|
2776
|
+
const h = i[d];
|
|
2777
|
+
if (!l && (h === "-" || h === "+"))
|
|
2778
|
+
l = h;
|
|
2769
2779
|
else {
|
|
2770
|
-
const
|
|
2771
|
-
!o &&
|
|
2780
|
+
const y = Number(h);
|
|
2781
|
+
!o && y ? o = y : a === -1 && (a = s + d);
|
|
2772
2782
|
}
|
|
2773
2783
|
}
|
|
2774
2784
|
a !== -1 && n(a, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${i}`);
|
|
2775
|
-
let c = !1,
|
|
2776
|
-
for (let
|
|
2777
|
-
const
|
|
2778
|
-
switch (
|
|
2785
|
+
let c = !1, m = "", f = i.length;
|
|
2786
|
+
for (let d = 1; d < e.length; ++d) {
|
|
2787
|
+
const h = e[d];
|
|
2788
|
+
switch (h.type) {
|
|
2779
2789
|
case "space":
|
|
2780
2790
|
c = !0;
|
|
2781
2791
|
case "newline":
|
|
2782
|
-
f +=
|
|
2792
|
+
f += h.source.length;
|
|
2783
2793
|
break;
|
|
2784
2794
|
case "comment":
|
|
2785
|
-
t && !c && n(
|
|
2795
|
+
t && !c && n(h, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters"), f += h.source.length, m = h.source.substring(1);
|
|
2786
2796
|
break;
|
|
2787
2797
|
case "error":
|
|
2788
|
-
n(
|
|
2798
|
+
n(h, "UNEXPECTED_TOKEN", h.message), f += h.source.length;
|
|
2789
2799
|
break;
|
|
2790
2800
|
default: {
|
|
2791
|
-
const
|
|
2792
|
-
n(
|
|
2793
|
-
const
|
|
2794
|
-
|
|
2801
|
+
const y = `Unexpected token in block scalar header: ${h.type}`;
|
|
2802
|
+
n(h, "UNEXPECTED_TOKEN", y);
|
|
2803
|
+
const u = h.source;
|
|
2804
|
+
u && typeof u == "string" && (f += u.length);
|
|
2795
2805
|
}
|
|
2796
2806
|
}
|
|
2797
2807
|
}
|
|
2798
|
-
return { mode: r, indent: o, chomp: l, comment:
|
|
2808
|
+
return { mode: r, indent: o, chomp: l, comment: m, length: f };
|
|
2799
2809
|
}
|
|
2800
2810
|
function un(s) {
|
|
2801
2811
|
const e = s.split(/\n( *)/), t = e[0], n = t.match(/^( *)/), r = [n != null && n[1] ? [n[1], t.slice(n[1].length)] : ["", t]];
|
|
@@ -2806,16 +2816,16 @@ function un(s) {
|
|
|
2806
2816
|
function ys(s, e, t) {
|
|
2807
2817
|
const { offset: n, type: i, source: r, end: o } = s;
|
|
2808
2818
|
let l, a;
|
|
2809
|
-
const c = (
|
|
2819
|
+
const c = (d, h, y) => t(n + d, h, y);
|
|
2810
2820
|
switch (i) {
|
|
2811
2821
|
case "scalar":
|
|
2812
|
-
l =
|
|
2822
|
+
l = O.PLAIN, a = hn(r, c);
|
|
2813
2823
|
break;
|
|
2814
2824
|
case "single-quoted-scalar":
|
|
2815
|
-
l =
|
|
2825
|
+
l = O.QUOTE_SINGLE, a = dn(r, c);
|
|
2816
2826
|
break;
|
|
2817
2827
|
case "double-quoted-scalar":
|
|
2818
|
-
l =
|
|
2828
|
+
l = O.QUOTE_DOUBLE, a = pn(r, c);
|
|
2819
2829
|
break;
|
|
2820
2830
|
default:
|
|
2821
2831
|
return t(s, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${i}`), {
|
|
@@ -2825,12 +2835,12 @@ function ys(s, e, t) {
|
|
|
2825
2835
|
range: [n, n + r.length, n + r.length]
|
|
2826
2836
|
};
|
|
2827
2837
|
}
|
|
2828
|
-
const
|
|
2838
|
+
const m = n + r.length, f = Ee(o, m, e, t);
|
|
2829
2839
|
return {
|
|
2830
2840
|
value: a,
|
|
2831
2841
|
type: l,
|
|
2832
2842
|
comment: f.comment,
|
|
2833
|
-
range: [n,
|
|
2843
|
+
range: [n, m, f.offset]
|
|
2834
2844
|
};
|
|
2835
2845
|
}
|
|
2836
2846
|
function hn(s, e) {
|
|
@@ -2977,21 +2987,21 @@ function gn(s, e, t, n) {
|
|
|
2977
2987
|
return String.fromCodePoint(o);
|
|
2978
2988
|
}
|
|
2979
2989
|
function bs(s, e, t, n) {
|
|
2980
|
-
const { value: i, type: r, comment: o, range: l } = e.type === "block-scalar" ? ms(
|
|
2981
|
-
let
|
|
2990
|
+
const { value: i, type: r, comment: o, range: l } = e.type === "block-scalar" ? ms(s, e, n) : ys(e, s.options.strict, n), a = t ? s.directives.tagName(t.source, (f) => n(t, "TAG_RESOLVE_FAILED", f)) : null, c = t && a ? bn(s.schema, i, a, t, n) : e.type === "scalar" ? wn(s, i, e, n) : s.schema[R];
|
|
2991
|
+
let m;
|
|
2982
2992
|
try {
|
|
2983
|
-
const f = c.resolve(i, (
|
|
2984
|
-
|
|
2993
|
+
const f = c.resolve(i, (d) => n(t ?? e, "TAG_RESOLVE_FAILED", d), s.options);
|
|
2994
|
+
m = E(f) ? f : new O(f);
|
|
2985
2995
|
} catch (f) {
|
|
2986
|
-
const
|
|
2987
|
-
n(t ?? e, "TAG_RESOLVE_FAILED",
|
|
2996
|
+
const d = f instanceof Error ? f.message : String(f);
|
|
2997
|
+
n(t ?? e, "TAG_RESOLVE_FAILED", d), m = new O(i);
|
|
2988
2998
|
}
|
|
2989
|
-
return
|
|
2999
|
+
return m.range = l, m.source = i, r && (m.type = r), a && (m.tag = a), c.format && (m.format = c.format), o && (m.comment = o), m;
|
|
2990
3000
|
}
|
|
2991
3001
|
function bn(s, e, t, n, i) {
|
|
2992
3002
|
var l;
|
|
2993
3003
|
if (t === "!")
|
|
2994
|
-
return s[
|
|
3004
|
+
return s[R];
|
|
2995
3005
|
const r = [];
|
|
2996
3006
|
for (const a of s.tags)
|
|
2997
3007
|
if (!a.collection && a.tag === t)
|
|
@@ -3003,18 +3013,18 @@ function bn(s, e, t, n, i) {
|
|
|
3003
3013
|
if ((l = a.test) != null && l.test(e))
|
|
3004
3014
|
return a;
|
|
3005
3015
|
const o = s.knownTags[t];
|
|
3006
|
-
return o && !o.collection ? (s.tags.push(Object.assign({}, o, { default: !1, test: void 0 })), o) : (i(n, "TAG_RESOLVE_FAILED", `Unresolved tag: ${t}`, t !== "tag:yaml.org,2002:str"), s[
|
|
3016
|
+
return o && !o.collection ? (s.tags.push(Object.assign({}, o, { default: !1, test: void 0 })), o) : (i(n, "TAG_RESOLVE_FAILED", `Unresolved tag: ${t}`, t !== "tag:yaml.org,2002:str"), s[R]);
|
|
3007
3017
|
}
|
|
3008
3018
|
function wn({ directives: s, schema: e }, t, n, i) {
|
|
3009
3019
|
const r = e.tags.find((o) => {
|
|
3010
3020
|
var l;
|
|
3011
3021
|
return o.default && ((l = o.test) == null ? void 0 : l.test(t));
|
|
3012
|
-
}) || e[
|
|
3022
|
+
}) || e[R];
|
|
3013
3023
|
if (e.compat) {
|
|
3014
3024
|
const o = e.compat.find((l) => {
|
|
3015
3025
|
var a;
|
|
3016
3026
|
return l.default && ((a = l.test) == null ? void 0 : a.test(t));
|
|
3017
|
-
}) ?? e[
|
|
3027
|
+
}) ?? e[R];
|
|
3018
3028
|
if (r.tag !== o.tag) {
|
|
3019
3029
|
const l = s.tagString(r.tag), a = s.tagString(o.tag), c = `Value may be parsed as either ${l} or ${a}`;
|
|
3020
3030
|
i(n, "TAG_RESOLVE_FAILED", c, !0);
|
|
@@ -3041,7 +3051,7 @@ function Sn(s, e, t) {
|
|
|
3041
3051
|
}
|
|
3042
3052
|
return s;
|
|
3043
3053
|
}
|
|
3044
|
-
const kn = { composeNode: ws, composeEmptyNode:
|
|
3054
|
+
const kn = { composeNode: ws, composeEmptyNode: Ot };
|
|
3045
3055
|
function ws(s, e, t, n) {
|
|
3046
3056
|
const { spaceBefore: i, comment: r, anchor: o, tag: l } = t;
|
|
3047
3057
|
let a, c = !0;
|
|
@@ -3058,26 +3068,26 @@ function ws(s, e, t, n) {
|
|
|
3058
3068
|
case "block-map":
|
|
3059
3069
|
case "block-seq":
|
|
3060
3070
|
case "flow-collection":
|
|
3061
|
-
a = cn(kn, s, e,
|
|
3071
|
+
a = cn(kn, s, e, t, n), o && (a.anchor = o.source.substring(1));
|
|
3062
3072
|
break;
|
|
3063
3073
|
default: {
|
|
3064
|
-
const
|
|
3065
|
-
n(e, "UNEXPECTED_TOKEN",
|
|
3074
|
+
const m = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
|
|
3075
|
+
n(e, "UNEXPECTED_TOKEN", m), a = Ot(s, e.offset, void 0, null, t, n), c = !1;
|
|
3066
3076
|
}
|
|
3067
3077
|
}
|
|
3068
3078
|
return o && a.anchor === "" && n(o, "BAD_ALIAS", "Anchor cannot be an empty string"), i && (a.spaceBefore = !0), r && (e.type === "scalar" && e.source === "" ? a.comment = r : a.commentBefore = r), s.options.keepSourceTokens && c && (a.srcToken = e), a;
|
|
3069
3079
|
}
|
|
3070
|
-
function
|
|
3071
|
-
const
|
|
3080
|
+
function Ot(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: l, end: a }, c) {
|
|
3081
|
+
const m = {
|
|
3072
3082
|
type: "scalar",
|
|
3073
3083
|
offset: Sn(e, t, n),
|
|
3074
3084
|
indent: -1,
|
|
3075
3085
|
source: ""
|
|
3076
|
-
}, f = bs(s,
|
|
3086
|
+
}, f = bs(s, m, l, c);
|
|
3077
3087
|
return o && (f.anchor = o.source.substring(1), f.anchor === "" && c(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (f.spaceBefore = !0), r && (f.comment = r, f.range[2] = a), f;
|
|
3078
3088
|
}
|
|
3079
3089
|
function Nn({ options: s }, { offset: e, source: t, end: n }, i) {
|
|
3080
|
-
const r = new
|
|
3090
|
+
const r = new qe(t.substring(1));
|
|
3081
3091
|
r.source === "" && i(e, "BAD_ALIAS", "Alias cannot be an empty string"), r.source.endsWith(":") && i(e + t.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", !0);
|
|
3082
3092
|
const o = e + t.length, l = Ee(n, o, s.strict, i);
|
|
3083
3093
|
return r.range = [e, o, l.offset], l.comment && (r.comment = l.comment), r;
|
|
@@ -3088,16 +3098,17 @@ function On(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
|
3088
3098
|
directives: a.directives,
|
|
3089
3099
|
options: a.options,
|
|
3090
3100
|
schema: a.schema
|
|
3091
|
-
},
|
|
3101
|
+
}, m = ce(n, {
|
|
3092
3102
|
indicator: "doc-start",
|
|
3093
3103
|
next: i ?? (r == null ? void 0 : r[0]),
|
|
3094
3104
|
offset: t,
|
|
3095
3105
|
onError: o,
|
|
3106
|
+
parentIndent: 0,
|
|
3096
3107
|
startOnNewline: !0
|
|
3097
3108
|
});
|
|
3098
|
-
|
|
3099
|
-
const f = a.contents.range[2],
|
|
3100
|
-
return
|
|
3109
|
+
m.found && (a.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !m.hasNewline && o(m.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), a.contents = i ? ws(c, i, m, o) : Ot(c, m.end, n, null, m, o);
|
|
3110
|
+
const f = a.contents.range[2], d = Ee(r, f, !1, o);
|
|
3111
|
+
return d.comment && (a.comment = d.comment), a.range = [t, f, d.offset], a;
|
|
3101
3112
|
}
|
|
3102
3113
|
function ge(s) {
|
|
3103
3114
|
if (typeof s == "number")
|
|
@@ -3107,7 +3118,7 @@ function ge(s) {
|
|
|
3107
3118
|
const { offset: e, source: t } = s;
|
|
3108
3119
|
return [e, e + (typeof t == "string" ? t.length : 1)];
|
|
3109
3120
|
}
|
|
3110
|
-
function
|
|
3121
|
+
function Bt(s) {
|
|
3111
3122
|
var i;
|
|
3112
3123
|
let e = "", t = !1, n = !1;
|
|
3113
3124
|
for (let r = 0; r < s.length; ++r) {
|
|
@@ -3128,7 +3139,7 @@ function Mt(s) {
|
|
|
3128
3139
|
}
|
|
3129
3140
|
return { comment: e, afterEmptyLine: n };
|
|
3130
3141
|
}
|
|
3131
|
-
class
|
|
3142
|
+
class At {
|
|
3132
3143
|
constructor(e = {}) {
|
|
3133
3144
|
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t, n, i, r) => {
|
|
3134
3145
|
const o = ge(t);
|
|
@@ -3136,7 +3147,7 @@ class Et {
|
|
|
3136
3147
|
}, this.directives = new B({ version: e.version || "1.2" }), this.options = e;
|
|
3137
3148
|
}
|
|
3138
3149
|
decorate(e, t) {
|
|
3139
|
-
const { comment: n, afterEmptyLine: i } =
|
|
3150
|
+
const { comment: n, afterEmptyLine: i } = Bt(this.prelude);
|
|
3140
3151
|
if (n) {
|
|
3141
3152
|
const r = e.contents;
|
|
3142
3153
|
if (t)
|
|
@@ -3144,9 +3155,9 @@ class Et {
|
|
|
3144
3155
|
${n}` : n;
|
|
3145
3156
|
else if (i || e.directives.docStart || !r)
|
|
3146
3157
|
e.commentBefore = n;
|
|
3147
|
-
else if (
|
|
3158
|
+
else if (L(r) && !r.flow && r.items.length > 0) {
|
|
3148
3159
|
let o = r.items[0];
|
|
3149
|
-
|
|
3160
|
+
I(o) && (o = o.key);
|
|
3150
3161
|
const l = o.commentBefore;
|
|
3151
3162
|
o.commentBefore = l ? `${n}
|
|
3152
3163
|
${l}` : n;
|
|
@@ -3165,7 +3176,7 @@ ${o}` : n;
|
|
|
3165
3176
|
*/
|
|
3166
3177
|
streamInfo() {
|
|
3167
3178
|
return {
|
|
3168
|
-
comment:
|
|
3179
|
+
comment: Bt(this.prelude).comment,
|
|
3169
3180
|
directives: this.directives,
|
|
3170
3181
|
errors: this.errors,
|
|
3171
3182
|
warnings: this.warnings
|
|
@@ -3258,7 +3269,7 @@ function An(s, e = !0, t) {
|
|
|
3258
3269
|
case "double-quoted-scalar":
|
|
3259
3270
|
return ys(s, e, n);
|
|
3260
3271
|
case "block-scalar":
|
|
3261
|
-
return ms(
|
|
3272
|
+
return ms({ options: { strict: e } }, s, n);
|
|
3262
3273
|
}
|
|
3263
3274
|
}
|
|
3264
3275
|
return null;
|
|
@@ -3277,12 +3288,12 @@ function En(s, e) {
|
|
|
3277
3288
|
case "|":
|
|
3278
3289
|
case ">": {
|
|
3279
3290
|
const c = l.indexOf(`
|
|
3280
|
-
`),
|
|
3281
|
-
`,
|
|
3282
|
-
{ type: "block-scalar-header", offset: r, indent: n, source:
|
|
3291
|
+
`), m = l.substring(0, c), f = l.substring(c + 1) + `
|
|
3292
|
+
`, d = [
|
|
3293
|
+
{ type: "block-scalar-header", offset: r, indent: n, source: m }
|
|
3283
3294
|
];
|
|
3284
|
-
return Ss(
|
|
3285
|
-
` }), { type: "block-scalar", offset: r, indent: n, props:
|
|
3295
|
+
return Ss(d, a) || d.push({ type: "newline", offset: -1, indent: n, source: `
|
|
3296
|
+
` }), { type: "block-scalar", offset: r, indent: n, props: d, source: f };
|
|
3286
3297
|
}
|
|
3287
3298
|
case '"':
|
|
3288
3299
|
return { type: "double-quoted-scalar", offset: r, indent: n, source: l, end: a };
|
|
@@ -3292,7 +3303,7 @@ function En(s, e) {
|
|
|
3292
3303
|
return { type: "scalar", offset: r, indent: n, source: l, end: a };
|
|
3293
3304
|
}
|
|
3294
3305
|
}
|
|
3295
|
-
function
|
|
3306
|
+
function In(s, e, t = {}) {
|
|
3296
3307
|
let { afterKey: n = !1, implicitKey: i = !1, inFlow: r = !1, type: o } = t, l = "indent" in s ? s.indent : null;
|
|
3297
3308
|
if (n && typeof l == "number" && (l += 2), !o)
|
|
3298
3309
|
switch (s.type) {
|
|
@@ -3321,19 +3332,19 @@ function Ln(s, e, t = {}) {
|
|
|
3321
3332
|
switch (a[0]) {
|
|
3322
3333
|
case "|":
|
|
3323
3334
|
case ">":
|
|
3324
|
-
|
|
3335
|
+
Tn(s, a);
|
|
3325
3336
|
break;
|
|
3326
3337
|
case '"':
|
|
3327
|
-
|
|
3338
|
+
nt(s, a, "double-quoted-scalar");
|
|
3328
3339
|
break;
|
|
3329
3340
|
case "'":
|
|
3330
|
-
|
|
3341
|
+
nt(s, a, "single-quoted-scalar");
|
|
3331
3342
|
break;
|
|
3332
3343
|
default:
|
|
3333
|
-
|
|
3344
|
+
nt(s, a, "scalar");
|
|
3334
3345
|
}
|
|
3335
3346
|
}
|
|
3336
|
-
function
|
|
3347
|
+
function Tn(s, e) {
|
|
3337
3348
|
const t = e.indexOf(`
|
|
3338
3349
|
`), n = e.substring(0, t), i = e.substring(t + 1) + `
|
|
3339
3350
|
`;
|
|
@@ -3366,7 +3377,7 @@ function Ss(s, e) {
|
|
|
3366
3377
|
}
|
|
3367
3378
|
return !1;
|
|
3368
3379
|
}
|
|
3369
|
-
function
|
|
3380
|
+
function nt(s, e, t) {
|
|
3370
3381
|
switch (s.type) {
|
|
3371
3382
|
case "scalar":
|
|
3372
3383
|
case "double-quoted-scalar":
|
|
@@ -3397,32 +3408,32 @@ function st(s, e, t) {
|
|
|
3397
3408
|
}
|
|
3398
3409
|
}
|
|
3399
3410
|
}
|
|
3400
|
-
const
|
|
3401
|
-
function
|
|
3411
|
+
const Ln = (s) => "type" in s ? Ke(s) : Be(s);
|
|
3412
|
+
function Ke(s) {
|
|
3402
3413
|
switch (s.type) {
|
|
3403
3414
|
case "block-scalar": {
|
|
3404
3415
|
let e = "";
|
|
3405
3416
|
for (const t of s.props)
|
|
3406
|
-
e +=
|
|
3417
|
+
e += Ke(t);
|
|
3407
3418
|
return e + s.source;
|
|
3408
3419
|
}
|
|
3409
3420
|
case "block-map":
|
|
3410
3421
|
case "block-seq": {
|
|
3411
3422
|
let e = "";
|
|
3412
3423
|
for (const t of s.items)
|
|
3413
|
-
e +=
|
|
3424
|
+
e += Be(t);
|
|
3414
3425
|
return e;
|
|
3415
3426
|
}
|
|
3416
3427
|
case "flow-collection": {
|
|
3417
3428
|
let e = s.start.source;
|
|
3418
3429
|
for (const t of s.items)
|
|
3419
|
-
e +=
|
|
3430
|
+
e += Be(t);
|
|
3420
3431
|
for (const t of s.end)
|
|
3421
3432
|
e += t.source;
|
|
3422
3433
|
return e;
|
|
3423
3434
|
}
|
|
3424
3435
|
case "document": {
|
|
3425
|
-
let e =
|
|
3436
|
+
let e = Be(s);
|
|
3426
3437
|
if (s.end)
|
|
3427
3438
|
for (const t of s.end)
|
|
3428
3439
|
e += t.source;
|
|
@@ -3437,14 +3448,14 @@ function je(s) {
|
|
|
3437
3448
|
}
|
|
3438
3449
|
}
|
|
3439
3450
|
}
|
|
3440
|
-
function
|
|
3451
|
+
function Be({ start: s, key: e, sep: t, value: n }) {
|
|
3441
3452
|
let i = "";
|
|
3442
3453
|
for (const r of s)
|
|
3443
3454
|
i += r.source;
|
|
3444
|
-
if (e && (i +=
|
|
3455
|
+
if (e && (i += Ke(e)), t)
|
|
3445
3456
|
for (const r of t)
|
|
3446
3457
|
i += r.source;
|
|
3447
|
-
return n && (i +=
|
|
3458
|
+
return n && (i += Ke(n)), i;
|
|
3448
3459
|
}
|
|
3449
3460
|
const ft = Symbol("break visit"), $n = Symbol("skip children"), ks = Symbol("remove item");
|
|
3450
3461
|
function z(s, e) {
|
|
@@ -3492,14 +3503,14 @@ function Ns(s, e, t) {
|
|
|
3492
3503
|
}
|
|
3493
3504
|
return typeof n == "function" ? n(e, s) : n;
|
|
3494
3505
|
}
|
|
3495
|
-
const
|
|
3506
|
+
const He = "\uFEFF", Xe = "", ze = "", Ne = "", _n = (s) => !!s && "items" in s, Cn = (s) => !!s && (s.type === "scalar" || s.type === "single-quoted-scalar" || s.type === "double-quoted-scalar" || s.type === "block-scalar");
|
|
3496
3507
|
function vn(s) {
|
|
3497
3508
|
switch (s) {
|
|
3498
|
-
case Qe:
|
|
3499
|
-
return "<BOM>";
|
|
3500
3509
|
case He:
|
|
3501
|
-
return "<
|
|
3510
|
+
return "<BOM>";
|
|
3502
3511
|
case Xe:
|
|
3512
|
+
return "<DOC>";
|
|
3513
|
+
case ze:
|
|
3503
3514
|
return "<FLOW_END>";
|
|
3504
3515
|
case Ne:
|
|
3505
3516
|
return "<SCALAR>";
|
|
@@ -3509,11 +3520,11 @@ function vn(s) {
|
|
|
3509
3520
|
}
|
|
3510
3521
|
function Os(s) {
|
|
3511
3522
|
switch (s) {
|
|
3512
|
-
case Qe:
|
|
3513
|
-
return "byte-order-mark";
|
|
3514
3523
|
case He:
|
|
3515
|
-
return "
|
|
3524
|
+
return "byte-order-mark";
|
|
3516
3525
|
case Xe:
|
|
3526
|
+
return "doc-mode";
|
|
3527
|
+
case ze:
|
|
3517
3528
|
return "flow-error-end";
|
|
3518
3529
|
case Ne:
|
|
3519
3530
|
return "scalar";
|
|
@@ -3568,23 +3579,23 @@ function Os(s) {
|
|
|
3568
3579
|
}
|
|
3569
3580
|
return null;
|
|
3570
3581
|
}
|
|
3571
|
-
|
|
3582
|
+
const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3572
3583
|
__proto__: null,
|
|
3573
|
-
BOM:
|
|
3574
|
-
DOCUMENT:
|
|
3575
|
-
FLOW_END:
|
|
3584
|
+
BOM: He,
|
|
3585
|
+
DOCUMENT: Xe,
|
|
3586
|
+
FLOW_END: ze,
|
|
3576
3587
|
SCALAR: Ne,
|
|
3577
3588
|
createScalarToken: En,
|
|
3578
|
-
isCollection:
|
|
3579
|
-
isScalar:
|
|
3589
|
+
isCollection: _n,
|
|
3590
|
+
isScalar: Cn,
|
|
3580
3591
|
prettyToken: vn,
|
|
3581
3592
|
resolveAsScalar: An,
|
|
3582
|
-
setScalarValue:
|
|
3583
|
-
stringify:
|
|
3593
|
+
setScalarValue: In,
|
|
3594
|
+
stringify: Ln,
|
|
3584
3595
|
tokenType: Os,
|
|
3585
3596
|
visit: z
|
|
3586
|
-
});
|
|
3587
|
-
function
|
|
3597
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3598
|
+
function D(s) {
|
|
3588
3599
|
switch (s) {
|
|
3589
3600
|
case void 0:
|
|
3590
3601
|
case " ":
|
|
@@ -3597,8 +3608,8 @@ function j(s) {
|
|
|
3597
3608
|
return !1;
|
|
3598
3609
|
}
|
|
3599
3610
|
}
|
|
3600
|
-
const
|
|
3601
|
-
\r
|
|
3611
|
+
const Mt = new Set("0123456789ABCDEFabcdef"), Mn = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), Le = new Set(",[]{}"), Pn = new Set(` ,[]{}
|
|
3612
|
+
\r `), it = (s) => !s || Pn.has(s);
|
|
3602
3613
|
class As {
|
|
3603
3614
|
constructor() {
|
|
3604
3615
|
this.atEnd = !1, this.blockScalarIndent = -1, this.blockScalarKeep = !1, this.buffer = "", this.flowKey = !1, this.flowLevel = 0, this.indentNext = 0, this.indentValue = 0, this.lineEndPos = null, this.next = null, this.pos = 0;
|
|
@@ -3610,7 +3621,12 @@ class As {
|
|
|
3610
3621
|
* @returns A generator of lexical tokens
|
|
3611
3622
|
*/
|
|
3612
3623
|
*lex(e, t = !1) {
|
|
3613
|
-
|
|
3624
|
+
if (e) {
|
|
3625
|
+
if (typeof e != "string")
|
|
3626
|
+
throw TypeError("source is not a string");
|
|
3627
|
+
this.buffer = this.buffer ? this.buffer + e : e, this.lineEndPos = null;
|
|
3628
|
+
}
|
|
3629
|
+
this.atEnd = !t;
|
|
3614
3630
|
let n = this.next ?? "stream";
|
|
3615
3631
|
for (; n && (t || this.hasChars(1)); )
|
|
3616
3632
|
n = yield* this.parseNext(n);
|
|
@@ -3643,7 +3659,7 @@ class As {
|
|
|
3643
3659
|
}
|
|
3644
3660
|
if (t === "-" || t === ".") {
|
|
3645
3661
|
const n = this.buffer.substr(e, 3);
|
|
3646
|
-
if ((n === "---" || n === "...") &&
|
|
3662
|
+
if ((n === "---" || n === "...") && D(this.buffer[e + 3]))
|
|
3647
3663
|
return -1;
|
|
3648
3664
|
}
|
|
3649
3665
|
return e;
|
|
@@ -3686,12 +3702,15 @@ class As {
|
|
|
3686
3702
|
let e = this.getLine();
|
|
3687
3703
|
if (e === null)
|
|
3688
3704
|
return this.setNext("stream");
|
|
3689
|
-
if (e[0] ===
|
|
3690
|
-
let t = e.length;
|
|
3691
|
-
|
|
3692
|
-
if (n !== -1) {
|
|
3705
|
+
if (e[0] === He && (yield* this.pushCount(1), e = e.substring(1)), e[0] === "%") {
|
|
3706
|
+
let t = e.length, n = e.indexOf("#");
|
|
3707
|
+
for (; n !== -1; ) {
|
|
3693
3708
|
const r = e[n - 1];
|
|
3694
|
-
(r === " " || r === " ")
|
|
3709
|
+
if (r === " " || r === " ") {
|
|
3710
|
+
t = n - 1;
|
|
3711
|
+
break;
|
|
3712
|
+
} else
|
|
3713
|
+
n = e.indexOf("#", n + 1);
|
|
3695
3714
|
}
|
|
3696
3715
|
for (; ; ) {
|
|
3697
3716
|
const r = e[t - 1];
|
|
@@ -3707,7 +3726,7 @@ class As {
|
|
|
3707
3726
|
const t = yield* this.pushSpaces(!0);
|
|
3708
3727
|
return yield* this.pushCount(e.length - t), yield* this.pushNewline(), "stream";
|
|
3709
3728
|
}
|
|
3710
|
-
return yield
|
|
3729
|
+
return yield Xe, yield* this.parseLineStart();
|
|
3711
3730
|
}
|
|
3712
3731
|
*parseLineStart() {
|
|
3713
3732
|
const e = this.charAt(0);
|
|
@@ -3717,18 +3736,16 @@ class As {
|
|
|
3717
3736
|
if (!this.atEnd && !this.hasChars(4))
|
|
3718
3737
|
return this.setNext("line-start");
|
|
3719
3738
|
const t = this.peek(3);
|
|
3720
|
-
if (t === "---" &&
|
|
3721
|
-
return yield* this.pushCount(3), this.indentValue = 0, this.indentNext = 0, "doc";
|
|
3722
|
-
if (t === "..." && j(this.charAt(3)))
|
|
3723
|
-
return yield* this.pushCount(3), "stream";
|
|
3739
|
+
if ((t === "---" || t === "...") && D(this.charAt(3)))
|
|
3740
|
+
return yield* this.pushCount(3), this.indentValue = 0, this.indentNext = 0, t === "---" ? "doc" : "stream";
|
|
3724
3741
|
}
|
|
3725
|
-
return this.indentValue = yield* this.pushSpaces(!1), this.indentNext > this.indentValue && !
|
|
3742
|
+
return this.indentValue = yield* this.pushSpaces(!1), this.indentNext > this.indentValue && !D(this.charAt(1)) && (this.indentNext = this.indentValue), yield* this.parseBlockStart();
|
|
3726
3743
|
}
|
|
3727
3744
|
*parseBlockStart() {
|
|
3728
3745
|
const [e, t] = this.peek(2);
|
|
3729
3746
|
if (!t && !this.atEnd)
|
|
3730
3747
|
return this.setNext("block-start");
|
|
3731
|
-
if ((e === "-" || e === "?" || e === ":") &&
|
|
3748
|
+
if ((e === "-" || e === "?" || e === ":") && D(t)) {
|
|
3732
3749
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0));
|
|
3733
3750
|
return this.indentNext = this.indentValue + 1, this.indentValue += n, yield* this.parseBlockStart();
|
|
3734
3751
|
}
|
|
@@ -3771,8 +3788,8 @@ class As {
|
|
|
3771
3788
|
const i = this.getLine();
|
|
3772
3789
|
if (i === null)
|
|
3773
3790
|
return this.setNext("flow");
|
|
3774
|
-
if ((n !== -1 && n < this.indentNext && i[0] !== "#" || n === 0 && (i.startsWith("---") || i.startsWith("...")) &&
|
|
3775
|
-
return this.flowLevel = 0, yield
|
|
3791
|
+
if ((n !== -1 && n < this.indentNext && i[0] !== "#" || n === 0 && (i.startsWith("---") || i.startsWith("...")) && D(i[3])) && !(n === this.indentNext - 1 && this.flowLevel === 1 && (i[0] === "]" || i[0] === "}")))
|
|
3792
|
+
return this.flowLevel = 0, yield ze, yield* this.parseLineStart();
|
|
3776
3793
|
let r = 0;
|
|
3777
3794
|
for (; i[r] === ","; )
|
|
3778
3795
|
r += yield* this.pushCount(1), r += yield* this.pushSpaces(!0), this.flowKey = !1;
|
|
@@ -3794,7 +3811,7 @@ class As {
|
|
|
3794
3811
|
return this.flowKey = !0, yield* this.parseQuotedScalar();
|
|
3795
3812
|
case ":": {
|
|
3796
3813
|
const o = this.charAt(1);
|
|
3797
|
-
if (this.flowKey ||
|
|
3814
|
+
if (this.flowKey || D(o) || o === ",")
|
|
3798
3815
|
return this.flowKey = !1, yield* this.pushCount(1), yield* this.pushSpaces(!0), "flow";
|
|
3799
3816
|
}
|
|
3800
3817
|
default:
|
|
@@ -3848,24 +3865,24 @@ class As {
|
|
|
3848
3865
|
else if (t !== "-")
|
|
3849
3866
|
break;
|
|
3850
3867
|
}
|
|
3851
|
-
return yield* this.pushUntil((t) =>
|
|
3868
|
+
return yield* this.pushUntil((t) => D(t) || t === "#");
|
|
3852
3869
|
}
|
|
3853
3870
|
*parseBlockScalar() {
|
|
3854
3871
|
let e = this.pos - 1, t = 0, n;
|
|
3855
|
-
e: for (let
|
|
3872
|
+
e: for (let r = this.pos; n = this.buffer[r]; ++r)
|
|
3856
3873
|
switch (n) {
|
|
3857
3874
|
case " ":
|
|
3858
3875
|
t += 1;
|
|
3859
3876
|
break;
|
|
3860
3877
|
case `
|
|
3861
3878
|
`:
|
|
3862
|
-
e =
|
|
3879
|
+
e = r, t = 0;
|
|
3863
3880
|
break;
|
|
3864
3881
|
case "\r": {
|
|
3865
|
-
const
|
|
3866
|
-
if (!
|
|
3882
|
+
const o = this.buffer[r + 1];
|
|
3883
|
+
if (!o && !this.atEnd)
|
|
3867
3884
|
return this.setNext("block-scalar");
|
|
3868
|
-
if (
|
|
3885
|
+
if (o === `
|
|
3869
3886
|
`)
|
|
3870
3887
|
break;
|
|
3871
3888
|
}
|
|
@@ -3875,13 +3892,13 @@ class As {
|
|
|
3875
3892
|
if (!n && !this.atEnd)
|
|
3876
3893
|
return this.setNext("block-scalar");
|
|
3877
3894
|
if (t >= this.indentNext) {
|
|
3878
|
-
this.blockScalarIndent === -1 ? this.indentNext = t : this.indentNext
|
|
3895
|
+
this.blockScalarIndent === -1 ? this.indentNext = t : this.indentNext = this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);
|
|
3879
3896
|
do {
|
|
3880
|
-
const
|
|
3881
|
-
if (
|
|
3897
|
+
const r = this.continueScalar(e + 1);
|
|
3898
|
+
if (r === -1)
|
|
3882
3899
|
break;
|
|
3883
3900
|
e = this.buffer.indexOf(`
|
|
3884
|
-
`,
|
|
3901
|
+
`, r);
|
|
3885
3902
|
} while (e !== -1);
|
|
3886
3903
|
if (e === -1) {
|
|
3887
3904
|
if (!this.atEnd)
|
|
@@ -3889,16 +3906,24 @@ class As {
|
|
|
3889
3906
|
e = this.buffer.length;
|
|
3890
3907
|
}
|
|
3891
3908
|
}
|
|
3892
|
-
|
|
3909
|
+
let i = e + 1;
|
|
3910
|
+
for (n = this.buffer[i]; n === " "; )
|
|
3911
|
+
n = this.buffer[++i];
|
|
3912
|
+
if (n === " ") {
|
|
3913
|
+
for (; n === " " || n === " " || n === "\r" || n === `
|
|
3914
|
+
`; )
|
|
3915
|
+
n = this.buffer[++i];
|
|
3916
|
+
e = i - 1;
|
|
3917
|
+
} else if (!this.blockScalarKeep)
|
|
3893
3918
|
do {
|
|
3894
|
-
let
|
|
3895
|
-
|
|
3896
|
-
const
|
|
3897
|
-
for (;
|
|
3898
|
-
|
|
3899
|
-
if (
|
|
3900
|
-
` &&
|
|
3901
|
-
e =
|
|
3919
|
+
let r = e - 1, o = this.buffer[r];
|
|
3920
|
+
o === "\r" && (o = this.buffer[--r]);
|
|
3921
|
+
const l = r;
|
|
3922
|
+
for (; o === " "; )
|
|
3923
|
+
o = this.buffer[--r];
|
|
3924
|
+
if (o === `
|
|
3925
|
+
` && r >= this.pos && r + 1 + t > l)
|
|
3926
|
+
e = r;
|
|
3902
3927
|
else
|
|
3903
3928
|
break;
|
|
3904
3929
|
} while (!0);
|
|
@@ -3910,14 +3935,14 @@ class As {
|
|
|
3910
3935
|
for (; i = this.buffer[++n]; )
|
|
3911
3936
|
if (i === ":") {
|
|
3912
3937
|
const r = this.buffer[n + 1];
|
|
3913
|
-
if (
|
|
3938
|
+
if (D(r) || e && Le.has(r))
|
|
3914
3939
|
break;
|
|
3915
3940
|
t = n;
|
|
3916
|
-
} else if (
|
|
3941
|
+
} else if (D(i)) {
|
|
3917
3942
|
let r = this.buffer[n + 1];
|
|
3918
3943
|
if (i === "\r" && (r === `
|
|
3919
3944
|
` ? (n += 1, i = `
|
|
3920
|
-
`, r = this.buffer[n + 1]) : t = n), r === "#" || e &&
|
|
3945
|
+
`, r = this.buffer[n + 1]) : t = n), r === "#" || e && Le.has(r))
|
|
3921
3946
|
break;
|
|
3922
3947
|
if (i === `
|
|
3923
3948
|
`) {
|
|
@@ -3927,7 +3952,7 @@ class As {
|
|
|
3927
3952
|
n = Math.max(n, o - 2);
|
|
3928
3953
|
}
|
|
3929
3954
|
} else {
|
|
3930
|
-
if (e &&
|
|
3955
|
+
if (e && Le.has(i))
|
|
3931
3956
|
break;
|
|
3932
3957
|
t = n;
|
|
3933
3958
|
}
|
|
@@ -3950,7 +3975,7 @@ class As {
|
|
|
3950
3975
|
case "?":
|
|
3951
3976
|
case ":": {
|
|
3952
3977
|
const e = this.flowLevel > 0, t = this.charAt(1);
|
|
3953
|
-
if (
|
|
3978
|
+
if (D(t) || e && Le.has(t))
|
|
3954
3979
|
return e ? this.flowKey && (this.flowKey = !1) : this.indentNext = this.indentValue + 1, (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
3955
3980
|
}
|
|
3956
3981
|
}
|
|
@@ -3959,15 +3984,15 @@ class As {
|
|
|
3959
3984
|
*pushTag() {
|
|
3960
3985
|
if (this.charAt(1) === "<") {
|
|
3961
3986
|
let e = this.pos + 2, t = this.buffer[e];
|
|
3962
|
-
for (; !
|
|
3987
|
+
for (; !D(t) && t !== ">"; )
|
|
3963
3988
|
t = this.buffer[++e];
|
|
3964
3989
|
return yield* this.pushToIndex(t === ">" ? e + 1 : e, !1);
|
|
3965
3990
|
} else {
|
|
3966
3991
|
let e = this.pos + 1, t = this.buffer[e];
|
|
3967
3992
|
for (; t; )
|
|
3968
|
-
if (Mn.
|
|
3993
|
+
if (Mn.has(t))
|
|
3969
3994
|
t = this.buffer[++e];
|
|
3970
|
-
else if (t === "%" &&
|
|
3995
|
+
else if (t === "%" && Mt.has(this.buffer[e + 1]) && Mt.has(this.buffer[e + 2]))
|
|
3971
3996
|
t = this.buffer[e += 3];
|
|
3972
3997
|
else
|
|
3973
3998
|
break;
|
|
@@ -4012,13 +4037,13 @@ class Es {
|
|
|
4012
4037
|
};
|
|
4013
4038
|
}
|
|
4014
4039
|
}
|
|
4015
|
-
function
|
|
4040
|
+
function Q(s, e) {
|
|
4016
4041
|
for (let t = 0; t < s.length; ++t)
|
|
4017
4042
|
if (s[t].type === e)
|
|
4018
4043
|
return !0;
|
|
4019
4044
|
return !1;
|
|
4020
4045
|
}
|
|
4021
|
-
function
|
|
4046
|
+
function Pt(s) {
|
|
4022
4047
|
for (let e = 0; e < s.length; ++e)
|
|
4023
4048
|
switch (s[e].type) {
|
|
4024
4049
|
case "space":
|
|
@@ -4030,7 +4055,7 @@ function jt(s) {
|
|
|
4030
4055
|
}
|
|
4031
4056
|
return -1;
|
|
4032
4057
|
}
|
|
4033
|
-
function
|
|
4058
|
+
function Is(s) {
|
|
4034
4059
|
switch (s == null ? void 0 : s.type) {
|
|
4035
4060
|
case "alias":
|
|
4036
4061
|
case "scalar":
|
|
@@ -4042,7 +4067,7 @@ function Ls(s) {
|
|
|
4042
4067
|
return !1;
|
|
4043
4068
|
}
|
|
4044
4069
|
}
|
|
4045
|
-
function
|
|
4070
|
+
function $e(s) {
|
|
4046
4071
|
switch (s.type) {
|
|
4047
4072
|
case "document":
|
|
4048
4073
|
return s.start;
|
|
@@ -4074,12 +4099,12 @@ function te(s) {
|
|
|
4074
4099
|
;
|
|
4075
4100
|
return s.splice(e, s.length);
|
|
4076
4101
|
}
|
|
4077
|
-
function
|
|
4102
|
+
function jt(s) {
|
|
4078
4103
|
if (s.start.type === "flow-seq-start")
|
|
4079
4104
|
for (const e of s.items)
|
|
4080
|
-
e.sep && !e.value && !
|
|
4105
|
+
e.sep && !e.value && !Q(e.start, "explicit-key-ind") && !Q(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key, Is(e.value) ? e.value.end ? Array.prototype.push.apply(e.value.end, e.sep) : e.value.end = e.sep : Array.prototype.push.apply(e.start, e.sep), delete e.sep);
|
|
4081
4106
|
}
|
|
4082
|
-
class
|
|
4107
|
+
class Et {
|
|
4083
4108
|
/**
|
|
4084
4109
|
* @param onNewLine - If defined, called separately with the start position of
|
|
4085
4110
|
* each new line (in `parse()`, including the start of input).
|
|
@@ -4198,7 +4223,7 @@ class Lt {
|
|
|
4198
4223
|
yield t;
|
|
4199
4224
|
else {
|
|
4200
4225
|
const n = this.peek(1);
|
|
4201
|
-
switch (t.type === "block-scalar" ? t.indent = "indent" in n ? n.indent : 0 : t.type === "flow-collection" && n.type === "document" && (t.indent = 0), t.type === "flow-collection" &&
|
|
4226
|
+
switch (t.type === "block-scalar" ? t.indent = "indent" in n ? n.indent : 0 : t.type === "flow-collection" && n.type === "document" && (t.indent = 0), t.type === "flow-collection" && jt(t), n.type) {
|
|
4202
4227
|
case "document":
|
|
4203
4228
|
n.value = t;
|
|
4204
4229
|
break;
|
|
@@ -4213,7 +4238,7 @@ class Lt {
|
|
|
4213
4238
|
} else if (i.sep)
|
|
4214
4239
|
i.value = t;
|
|
4215
4240
|
else {
|
|
4216
|
-
Object.assign(i, { key: t, sep: [] }), this.onKeyLine = !
|
|
4241
|
+
Object.assign(i, { key: t, sep: [] }), this.onKeyLine = !i.explicitKey;
|
|
4217
4242
|
return;
|
|
4218
4243
|
}
|
|
4219
4244
|
break;
|
|
@@ -4233,7 +4258,7 @@ class Lt {
|
|
|
4233
4258
|
}
|
|
4234
4259
|
if ((n.type === "document" || n.type === "block-map" || n.type === "block-seq") && (t.type === "block-map" || t.type === "block-seq")) {
|
|
4235
4260
|
const i = t.items[t.items.length - 1];
|
|
4236
|
-
i && !i.sep && !i.value && i.start.length > 0 &&
|
|
4261
|
+
i && !i.sep && !i.value && i.start.length > 0 && Pt(i.start) === -1 && (t.indent === 0 || i.start.every((r) => r.type !== "comment" || r.indent < t.indent)) && (n.type === "document" ? n.end = i.start : n.items.push({ start: i.start }), t.items.splice(-1, 1));
|
|
4237
4262
|
}
|
|
4238
4263
|
}
|
|
4239
4264
|
}
|
|
@@ -4271,7 +4296,7 @@ class Lt {
|
|
|
4271
4296
|
return yield* this.lineEnd(e);
|
|
4272
4297
|
switch (this.type) {
|
|
4273
4298
|
case "doc-start": {
|
|
4274
|
-
|
|
4299
|
+
Pt(e.start) !== -1 ? (yield* this.pop(), yield* this.step()) : e.start.push(this.sourceToken);
|
|
4275
4300
|
return;
|
|
4276
4301
|
}
|
|
4277
4302
|
case "anchor":
|
|
@@ -4292,7 +4317,7 @@ class Lt {
|
|
|
4292
4317
|
}
|
|
4293
4318
|
*scalar(e) {
|
|
4294
4319
|
if (this.type === "map-value-ind") {
|
|
4295
|
-
const t =
|
|
4320
|
+
const t = $e(this.peek(2)), n = te(t);
|
|
4296
4321
|
let i;
|
|
4297
4322
|
e.end ? (i = e.end, i.push(this.sourceToken), delete e.end) : i = [this.sourceToken];
|
|
4298
4323
|
const r = {
|
|
@@ -4355,74 +4380,74 @@ class Lt {
|
|
|
4355
4380
|
return;
|
|
4356
4381
|
}
|
|
4357
4382
|
if (this.indent >= e.indent) {
|
|
4358
|
-
const i = !this.onKeyLine && this.indent === e.indent && t.sep && this.type !== "seq-item-ind";
|
|
4359
|
-
let
|
|
4360
|
-
if (
|
|
4361
|
-
const
|
|
4362
|
-
for (let
|
|
4363
|
-
const
|
|
4364
|
-
switch (
|
|
4383
|
+
const i = !this.onKeyLine && this.indent === e.indent, r = i && (t.sep || t.explicitKey) && this.type !== "seq-item-ind";
|
|
4384
|
+
let o = [];
|
|
4385
|
+
if (r && t.sep && !t.value) {
|
|
4386
|
+
const l = [];
|
|
4387
|
+
for (let a = 0; a < t.sep.length; ++a) {
|
|
4388
|
+
const c = t.sep[a];
|
|
4389
|
+
switch (c.type) {
|
|
4365
4390
|
case "newline":
|
|
4366
|
-
|
|
4391
|
+
l.push(a);
|
|
4367
4392
|
break;
|
|
4368
4393
|
case "space":
|
|
4369
4394
|
break;
|
|
4370
4395
|
case "comment":
|
|
4371
|
-
|
|
4396
|
+
c.indent > e.indent && (l.length = 0);
|
|
4372
4397
|
break;
|
|
4373
4398
|
default:
|
|
4374
|
-
|
|
4399
|
+
l.length = 0;
|
|
4375
4400
|
}
|
|
4376
4401
|
}
|
|
4377
|
-
|
|
4402
|
+
l.length >= 2 && (o = t.sep.splice(l[1]));
|
|
4378
4403
|
}
|
|
4379
4404
|
switch (this.type) {
|
|
4380
4405
|
case "anchor":
|
|
4381
4406
|
case "tag":
|
|
4382
|
-
|
|
4407
|
+
r || t.value ? (o.push(this.sourceToken), e.items.push({ start: o }), this.onKeyLine = !0) : t.sep ? t.sep.push(this.sourceToken) : t.start.push(this.sourceToken);
|
|
4383
4408
|
return;
|
|
4384
4409
|
case "explicit-key-ind":
|
|
4385
|
-
!t.sep && !
|
|
4410
|
+
!t.sep && !t.explicitKey ? (t.start.push(this.sourceToken), t.explicitKey = !0) : r || t.value ? (o.push(this.sourceToken), e.items.push({ start: o, explicitKey: !0 })) : this.stack.push({
|
|
4386
4411
|
type: "block-map",
|
|
4387
4412
|
offset: this.offset,
|
|
4388
4413
|
indent: this.indent,
|
|
4389
|
-
items: [{ start: [this.sourceToken] }]
|
|
4414
|
+
items: [{ start: [this.sourceToken], explicitKey: !0 }]
|
|
4390
4415
|
}), this.onKeyLine = !0;
|
|
4391
4416
|
return;
|
|
4392
4417
|
case "map-value-ind":
|
|
4393
|
-
if (
|
|
4418
|
+
if (t.explicitKey)
|
|
4394
4419
|
if (t.sep)
|
|
4395
4420
|
if (t.value)
|
|
4396
4421
|
e.items.push({ start: [], key: null, sep: [this.sourceToken] });
|
|
4397
|
-
else if (
|
|
4422
|
+
else if (Q(t.sep, "map-value-ind"))
|
|
4398
4423
|
this.stack.push({
|
|
4399
4424
|
type: "block-map",
|
|
4400
4425
|
offset: this.offset,
|
|
4401
4426
|
indent: this.indent,
|
|
4402
|
-
items: [{ start:
|
|
4427
|
+
items: [{ start: o, key: null, sep: [this.sourceToken] }]
|
|
4403
4428
|
});
|
|
4404
|
-
else if (
|
|
4405
|
-
const
|
|
4406
|
-
|
|
4429
|
+
else if (Is(t.key) && !Q(t.sep, "newline")) {
|
|
4430
|
+
const l = te(t.start), a = t.key, c = t.sep;
|
|
4431
|
+
c.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
|
|
4407
4432
|
type: "block-map",
|
|
4408
4433
|
offset: this.offset,
|
|
4409
4434
|
indent: this.indent,
|
|
4410
|
-
items: [{ start:
|
|
4435
|
+
items: [{ start: l, key: a, sep: c }]
|
|
4411
4436
|
});
|
|
4412
|
-
} else
|
|
4413
|
-
else if (
|
|
4437
|
+
} else o.length > 0 ? t.sep = t.sep.concat(o, this.sourceToken) : t.sep.push(this.sourceToken);
|
|
4438
|
+
else if (Q(t.start, "newline"))
|
|
4414
4439
|
Object.assign(t, { key: null, sep: [this.sourceToken] });
|
|
4415
4440
|
else {
|
|
4416
|
-
const
|
|
4441
|
+
const l = te(t.start);
|
|
4417
4442
|
this.stack.push({
|
|
4418
4443
|
type: "block-map",
|
|
4419
4444
|
offset: this.offset,
|
|
4420
4445
|
indent: this.indent,
|
|
4421
|
-
items: [{ start:
|
|
4446
|
+
items: [{ start: l, key: null, sep: [this.sourceToken] }]
|
|
4422
4447
|
});
|
|
4423
4448
|
}
|
|
4424
4449
|
else
|
|
4425
|
-
t.sep ? t.value ||
|
|
4450
|
+
t.sep ? t.value || r ? e.items.push({ start: o, key: null, sep: [this.sourceToken] }) : Q(t.sep, "map-value-ind") ? this.stack.push({
|
|
4426
4451
|
type: "block-map",
|
|
4427
4452
|
offset: this.offset,
|
|
4428
4453
|
indent: this.indent,
|
|
@@ -4434,14 +4459,14 @@ class Lt {
|
|
|
4434
4459
|
case "scalar":
|
|
4435
4460
|
case "single-quoted-scalar":
|
|
4436
4461
|
case "double-quoted-scalar": {
|
|
4437
|
-
const
|
|
4438
|
-
|
|
4462
|
+
const l = this.flowScalar(this.type);
|
|
4463
|
+
r || t.value ? (e.items.push({ start: o, key: l, sep: [] }), this.onKeyLine = !0) : t.sep ? this.stack.push(l) : (Object.assign(t, { key: l, sep: [] }), this.onKeyLine = !0);
|
|
4439
4464
|
return;
|
|
4440
4465
|
}
|
|
4441
4466
|
default: {
|
|
4442
|
-
const
|
|
4443
|
-
if (
|
|
4444
|
-
i &&
|
|
4467
|
+
const l = this.startBlockValue(e);
|
|
4468
|
+
if (l) {
|
|
4469
|
+
i && l.type !== "block-seq" && e.items.push({ start: o }), this.stack.push(l);
|
|
4445
4470
|
return;
|
|
4446
4471
|
}
|
|
4447
4472
|
}
|
|
@@ -4484,7 +4509,7 @@ class Lt {
|
|
|
4484
4509
|
case "seq-item-ind":
|
|
4485
4510
|
if (this.indent !== e.indent)
|
|
4486
4511
|
break;
|
|
4487
|
-
t.value ||
|
|
4512
|
+
t.value || Q(t.start, "seq-item-ind") ? e.items.push({ start: [this.sourceToken] }) : t.start.push(this.sourceToken);
|
|
4488
4513
|
return;
|
|
4489
4514
|
}
|
|
4490
4515
|
if (this.indent > e.indent) {
|
|
@@ -4539,8 +4564,8 @@ class Lt {
|
|
|
4539
4564
|
if (n.type === "block-map" && (this.type === "map-value-ind" && n.indent === e.indent || this.type === "newline" && !n.items[n.items.length - 1].sep))
|
|
4540
4565
|
yield* this.pop(), yield* this.step();
|
|
4541
4566
|
else if (this.type === "map-value-ind" && n.type !== "flow-collection") {
|
|
4542
|
-
const i =
|
|
4543
|
-
|
|
4567
|
+
const i = $e(n), r = te(i);
|
|
4568
|
+
jt(e);
|
|
4544
4569
|
const o = e.end.splice(1, e.end.length);
|
|
4545
4570
|
o.push(this.sourceToken);
|
|
4546
4571
|
const l = {
|
|
@@ -4603,17 +4628,17 @@ class Lt {
|
|
|
4603
4628
|
};
|
|
4604
4629
|
case "explicit-key-ind": {
|
|
4605
4630
|
this.onKeyLine = !0;
|
|
4606
|
-
const t =
|
|
4631
|
+
const t = $e(e), n = te(t);
|
|
4607
4632
|
return n.push(this.sourceToken), {
|
|
4608
4633
|
type: "block-map",
|
|
4609
4634
|
offset: this.offset,
|
|
4610
4635
|
indent: this.indent,
|
|
4611
|
-
items: [{ start: n }]
|
|
4636
|
+
items: [{ start: n, explicitKey: !0 }]
|
|
4612
4637
|
};
|
|
4613
4638
|
}
|
|
4614
4639
|
case "map-value-ind": {
|
|
4615
4640
|
this.onKeyLine = !0;
|
|
4616
|
-
const t =
|
|
4641
|
+
const t = $e(e), n = te(t);
|
|
4617
4642
|
return {
|
|
4618
4643
|
type: "block-map",
|
|
4619
4644
|
offset: this.offset,
|
|
@@ -4649,19 +4674,19 @@ class Lt {
|
|
|
4649
4674
|
}
|
|
4650
4675
|
}
|
|
4651
4676
|
}
|
|
4652
|
-
function
|
|
4677
|
+
function Ts(s) {
|
|
4653
4678
|
const e = s.prettyErrors !== !1;
|
|
4654
4679
|
return { lineCounter: s.lineCounter || e && new Es() || null, prettyErrors: e };
|
|
4655
4680
|
}
|
|
4656
4681
|
function jn(s, e = {}) {
|
|
4657
|
-
const { lineCounter: t, prettyErrors: n } =
|
|
4682
|
+
const { lineCounter: t, prettyErrors: n } = Ts(e), i = new Et(t == null ? void 0 : t.addNewLine), r = new At(e), o = Array.from(r.compose(i.parse(s)));
|
|
4658
4683
|
if (n && t)
|
|
4659
4684
|
for (const l of o)
|
|
4660
|
-
l.errors.forEach(
|
|
4685
|
+
l.errors.forEach(je(s, t)), l.warnings.forEach(je(s, t));
|
|
4661
4686
|
return o.length > 0 ? o : Object.assign([], { empty: !0 }, r.streamInfo());
|
|
4662
4687
|
}
|
|
4663
|
-
function
|
|
4664
|
-
const { lineCounter: t, prettyErrors: n } =
|
|
4688
|
+
function Ls(s, e = {}) {
|
|
4689
|
+
const { lineCounter: t, prettyErrors: n } = Ts(e), i = new Et(t == null ? void 0 : t.addNewLine), r = new At(e);
|
|
4665
4690
|
let o = null;
|
|
4666
4691
|
for (const l of r.compose(i.parse(s), !0, s.length))
|
|
4667
4692
|
if (!o)
|
|
@@ -4670,12 +4695,12 @@ function Ts(s, e = {}) {
|
|
|
4670
4695
|
o.errors.push(new X(l.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
4671
4696
|
break;
|
|
4672
4697
|
}
|
|
4673
|
-
return n && t && (o.errors.forEach(
|
|
4698
|
+
return n && t && (o.errors.forEach(je(s, t)), o.warnings.forEach(je(s, t))), o;
|
|
4674
4699
|
}
|
|
4675
|
-
function
|
|
4700
|
+
function Kn(s, e, t) {
|
|
4676
4701
|
let n;
|
|
4677
4702
|
typeof e == "function" ? n = e : t === void 0 && e && typeof e == "object" && (t = e);
|
|
4678
|
-
const i =
|
|
4703
|
+
const i = Ls(s, t);
|
|
4679
4704
|
if (!i)
|
|
4680
4705
|
return null;
|
|
4681
4706
|
if (i.warnings.forEach((r) => Ht(i.options.logLevel, r)), i.errors.length > 0) {
|
|
@@ -4685,7 +4710,7 @@ function Dn(s, e, t) {
|
|
|
4685
4710
|
}
|
|
4686
4711
|
return i.toJS(Object.assign({ reviver: n }, t));
|
|
4687
4712
|
}
|
|
4688
|
-
function
|
|
4713
|
+
function Dn(s, e, t) {
|
|
4689
4714
|
let n = null;
|
|
4690
4715
|
if (typeof e == "function" || Array.isArray(e) ? n = e : t === void 0 && e && (t = e), typeof t == "string" && (t = t.length), typeof t == "number") {
|
|
4691
4716
|
const i = Math.round(t);
|
|
@@ -4698,68 +4723,68 @@ function Kn(s, e, t) {
|
|
|
4698
4723
|
}
|
|
4699
4724
|
return new ye(s, n, t).toString(t);
|
|
4700
4725
|
}
|
|
4701
|
-
|
|
4726
|
+
const qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4702
4727
|
__proto__: null,
|
|
4703
|
-
Alias:
|
|
4728
|
+
Alias: qe,
|
|
4704
4729
|
CST: Bn,
|
|
4705
|
-
Composer:
|
|
4730
|
+
Composer: At,
|
|
4706
4731
|
Document: ye,
|
|
4707
4732
|
Lexer: As,
|
|
4708
4733
|
LineCounter: Es,
|
|
4709
4734
|
Pair: v,
|
|
4710
|
-
Parser:
|
|
4711
|
-
Scalar:
|
|
4735
|
+
Parser: Et,
|
|
4736
|
+
Scalar: O,
|
|
4712
4737
|
Schema: We,
|
|
4713
|
-
YAMLError:
|
|
4738
|
+
YAMLError: Nt,
|
|
4714
4739
|
YAMLMap: P,
|
|
4715
4740
|
YAMLParseError: X,
|
|
4716
|
-
YAMLSeq:
|
|
4741
|
+
YAMLSeq: Y,
|
|
4717
4742
|
YAMLWarning: ds,
|
|
4718
4743
|
isAlias: Z,
|
|
4719
|
-
isCollection:
|
|
4744
|
+
isCollection: L,
|
|
4720
4745
|
isDocument: ue,
|
|
4721
4746
|
isMap: he,
|
|
4722
4747
|
isNode: $,
|
|
4723
|
-
isPair:
|
|
4724
|
-
isScalar:
|
|
4748
|
+
isPair: I,
|
|
4749
|
+
isScalar: E,
|
|
4725
4750
|
isSeq: de,
|
|
4726
|
-
parse:
|
|
4751
|
+
parse: Kn,
|
|
4727
4752
|
parseAllDocuments: jn,
|
|
4728
|
-
parseDocument:
|
|
4729
|
-
stringify:
|
|
4753
|
+
parseDocument: Ls,
|
|
4754
|
+
stringify: Dn,
|
|
4730
4755
|
visit: J,
|
|
4731
4756
|
visitAsync: De
|
|
4732
|
-
});
|
|
4757
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4733
4758
|
export {
|
|
4734
|
-
|
|
4759
|
+
qe as Alias,
|
|
4735
4760
|
Bn as CST,
|
|
4736
|
-
|
|
4761
|
+
At as Composer,
|
|
4737
4762
|
ye as Document,
|
|
4738
4763
|
As as Lexer,
|
|
4739
4764
|
Es as LineCounter,
|
|
4740
4765
|
v as Pair,
|
|
4741
|
-
|
|
4742
|
-
|
|
4766
|
+
Et as Parser,
|
|
4767
|
+
O as Scalar,
|
|
4743
4768
|
We as Schema,
|
|
4744
|
-
|
|
4769
|
+
Nt as YAMLError,
|
|
4745
4770
|
P as YAMLMap,
|
|
4746
4771
|
X as YAMLParseError,
|
|
4747
|
-
|
|
4772
|
+
Y as YAMLSeq,
|
|
4748
4773
|
ds as YAMLWarning,
|
|
4749
4774
|
qn as default,
|
|
4750
4775
|
Z as isAlias,
|
|
4751
|
-
|
|
4776
|
+
L as isCollection,
|
|
4752
4777
|
ue as isDocument,
|
|
4753
4778
|
he as isMap,
|
|
4754
4779
|
$ as isNode,
|
|
4755
|
-
|
|
4756
|
-
|
|
4780
|
+
I as isPair,
|
|
4781
|
+
E as isScalar,
|
|
4757
4782
|
de as isSeq,
|
|
4758
|
-
|
|
4783
|
+
Kn as parse,
|
|
4759
4784
|
jn as parseAllDocuments,
|
|
4760
|
-
|
|
4761
|
-
|
|
4785
|
+
Ls as parseDocument,
|
|
4786
|
+
Dn as stringify,
|
|
4762
4787
|
J as visit,
|
|
4763
4788
|
De as visitAsync
|
|
4764
4789
|
};
|
|
4765
|
-
//# sourceMappingURL=index-
|
|
4790
|
+
//# sourceMappingURL=index-CLd8ycZz.js.map
|