@drzl/validation-core 3.0.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4226 +0,0 @@
1
- import {
2
- __publicField
3
- } from "./chunk-MKBO26DX.js";
4
-
5
- // ../../node_modules/.pnpm/prettier@3.6.2/node_modules/prettier/plugins/yaml.mjs
6
- var Yi = Object.create;
7
- var Nt = Object.defineProperty;
8
- var $i = Object.getOwnPropertyDescriptor;
9
- var Bi = Object.getOwnPropertyNames;
10
- var Fi = Object.getPrototypeOf;
11
- var qi = Object.prototype.hasOwnProperty;
12
- var dr = (t) => {
13
- throw TypeError(t);
14
- };
15
- var Ui = (t, e, n) => e in t ? Nt(t, e, { enumerable: true, configurable: true, writable: true, value: n }) : t[e] = n;
16
- var te = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports);
17
- var yr = (t, e) => {
18
- for (var n in e) Nt(t, n, { get: e[n], enumerable: true });
19
- };
20
- var Ki = (t, e, n, r) => {
21
- if (e && typeof e == "object" || typeof e == "function") for (let s of Bi(e)) !qi.call(t, s) && s !== n && Nt(t, s, { get: () => e[s], enumerable: !(r = $i(e, s)) || r.enumerable });
22
- return t;
23
- };
24
- var cn = (t, e, n) => (n = t != null ? Yi(Fi(t)) : {}, Ki(e || !t || !t.__esModule ? Nt(n, "default", { value: t, enumerable: true }) : n, t));
25
- var ln = (t, e, n) => Ui(t, typeof e != "symbol" ? e + "" : e, n);
26
- var fn = (t, e, n) => e.has(t) || dr("Cannot " + n);
27
- var Te = (t, e, n) => (fn(t, e, "read from private field"), n ? n.call(t) : e.get(t));
28
- var Ot = (t, e, n) => e.has(t) ? dr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n);
29
- var un = (t, e, n, r) => (fn(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n);
30
- var Xe = (t, e, n) => (fn(t, e, "access private method"), n);
31
- var oe = te(($) => {
32
- "use strict";
33
- var re = { ANCHOR: "&", COMMENT: "#", TAG: "!", DIRECTIVES_END: "-", DOCUMENT_END: "." }, pt = { ALIAS: "ALIAS", BLANK_LINE: "BLANK_LINE", BLOCK_FOLDED: "BLOCK_FOLDED", BLOCK_LITERAL: "BLOCK_LITERAL", COMMENT: "COMMENT", DIRECTIVE: "DIRECTIVE", DOCUMENT: "DOCUMENT", FLOW_MAP: "FLOW_MAP", FLOW_SEQ: "FLOW_SEQ", MAP: "MAP", MAP_KEY: "MAP_KEY", MAP_VALUE: "MAP_VALUE", PLAIN: "PLAIN", QUOTE_DOUBLE: "QUOTE_DOUBLE", QUOTE_SINGLE: "QUOTE_SINGLE", SEQ: "SEQ", SEQ_ITEM: "SEQ_ITEM" }, bo = "tag:yaml.org,2002:", No = { MAP: "tag:yaml.org,2002:map", SEQ: "tag:yaml.org,2002:seq", STR: "tag:yaml.org,2002:str" };
34
- function Zr(t) {
35
- let e = [0], n = t.indexOf(`
36
- `);
37
- for (; n !== -1; ) n += 1, e.push(n), n = t.indexOf(`
38
- `, n);
39
- return e;
40
- }
41
- function es(t) {
42
- let e, n;
43
- return typeof t == "string" ? (e = Zr(t), n = t) : (Array.isArray(t) && (t = t[0]), t && t.context && (t.lineStarts || (t.lineStarts = Zr(t.context.src)), e = t.lineStarts, n = t.context.src)), { lineStarts: e, src: n };
44
- }
45
- function Mn(t, e) {
46
- if (typeof t != "number" || t < 0) return null;
47
- let { lineStarts: n, src: r } = es(e);
48
- if (!n || !r || t > r.length) return null;
49
- for (let i = 0; i < n.length; ++i) {
50
- let o = n[i];
51
- if (t < o) return { line: i, col: t - n[i - 1] + 1 };
52
- if (t === o) return { line: i + 1, col: 1 };
53
- }
54
- let s = n.length;
55
- return { line: s, col: t - n[s - 1] + 1 };
56
- }
57
- function Oo(t, e) {
58
- let { lineStarts: n, src: r } = es(e);
59
- if (!n || !(t >= 1) || t > n.length) return null;
60
- let s = n[t - 1], i = n[t];
61
- for (; i && i > s && r[i - 1] === `
62
- `; ) --i;
63
- return r.slice(s, i);
64
- }
65
- function Ao({ start: t, end: e }, n, r = 80) {
66
- let s = Oo(t.line, n);
67
- if (!s) return null;
68
- let { col: i } = t;
69
- if (s.length > r) if (i <= r - 10) s = s.substr(0, r - 1) + "\u2026";
70
- else {
71
- let f = Math.round(r / 2);
72
- s.length > i + f && (s = s.substr(0, i + f - 1) + "\u2026"), i -= s.length - r, s = "\u2026" + s.substr(1 - r);
73
- }
74
- let o = 1, a = "";
75
- e && (e.line === t.line && i + (e.col - t.col) <= r + 1 ? o = e.col - t.col : (o = Math.min(s.length + 1, r) - i, a = "\u2026"));
76
- let c = i > 1 ? " ".repeat(i - 1) : "", l = "^".repeat(o);
77
- return `${s}
78
- ${c}${l}${a}`;
79
- }
80
- var Be = class t {
81
- static copy(e) {
82
- return new t(e.start, e.end);
83
- }
84
- constructor(e, n) {
85
- this.start = e, this.end = n || e;
86
- }
87
- isEmpty() {
88
- return typeof this.start != "number" || !this.end || this.end <= this.start;
89
- }
90
- setOrigRange(e, n) {
91
- let { start: r, end: s } = this;
92
- if (e.length === 0 || s <= e[0]) return this.origStart = r, this.origEnd = s, n;
93
- let i = n;
94
- for (; i < e.length && !(e[i] > r); ) ++i;
95
- this.origStart = r + i;
96
- let o = i;
97
- for (; i < e.length && !(e[i] >= s); ) ++i;
98
- return this.origEnd = s + i, o;
99
- }
100
- }, se = class t {
101
- static addStringTerminator(e, n, r) {
102
- if (r[r.length - 1] === `
103
- `) return r;
104
- let s = t.endOfWhiteSpace(e, n);
105
- return s >= e.length || e[s] === `
106
- ` ? r + `
107
- ` : r;
108
- }
109
- static atDocumentBoundary(e, n, r) {
110
- let s = e[n];
111
- if (!s) return true;
112
- let i = e[n - 1];
113
- if (i && i !== `
114
- `) return false;
115
- if (r) {
116
- if (s !== r) return false;
117
- } else if (s !== re.DIRECTIVES_END && s !== re.DOCUMENT_END) return false;
118
- let o = e[n + 1], a = e[n + 2];
119
- if (o !== s || a !== s) return false;
120
- let c = e[n + 3];
121
- return !c || c === `
122
- ` || c === " " || c === " ";
123
- }
124
- static endOfIdentifier(e, n) {
125
- let r = e[n], s = r === "<", i = s ? [`
126
- `, " ", " ", ">"] : [`
127
- `, " ", " ", "[", "]", "{", "}", ","];
128
- for (; r && i.indexOf(r) === -1; ) r = e[n += 1];
129
- return s && r === ">" && (n += 1), n;
130
- }
131
- static endOfIndent(e, n) {
132
- let r = e[n];
133
- for (; r === " "; ) r = e[n += 1];
134
- return n;
135
- }
136
- static endOfLine(e, n) {
137
- let r = e[n];
138
- for (; r && r !== `
139
- `; ) r = e[n += 1];
140
- return n;
141
- }
142
- static endOfWhiteSpace(e, n) {
143
- let r = e[n];
144
- for (; r === " " || r === " "; ) r = e[n += 1];
145
- return n;
146
- }
147
- static startOfLine(e, n) {
148
- let r = e[n - 1];
149
- if (r === `
150
- `) return n;
151
- for (; r && r !== `
152
- `; ) r = e[n -= 1];
153
- return n + 1;
154
- }
155
- static endOfBlockIndent(e, n, r) {
156
- let s = t.endOfIndent(e, r);
157
- if (s > r + n) return s;
158
- {
159
- let i = t.endOfWhiteSpace(e, s), o = e[i];
160
- if (!o || o === `
161
- `) return i;
162
- }
163
- return null;
164
- }
165
- static atBlank(e, n, r) {
166
- let s = e[n];
167
- return s === `
168
- ` || s === " " || s === " " || r && !s;
169
- }
170
- static nextNodeIsIndented(e, n, r) {
171
- return !e || n < 0 ? false : n > 0 ? true : r && e === "-";
172
- }
173
- static normalizeOffset(e, n) {
174
- let r = e[n];
175
- return r ? r !== `
176
- ` && e[n - 1] === `
177
- ` ? n - 1 : t.endOfWhiteSpace(e, n) : n;
178
- }
179
- static foldNewline(e, n, r) {
180
- let s = 0, i = false, o = "", a = e[n + 1];
181
- for (; a === " " || a === " " || a === `
182
- `; ) {
183
- switch (a) {
184
- case `
185
- `:
186
- s = 0, n += 1, o += `
187
- `;
188
- break;
189
- case " ":
190
- s <= r && (i = true), n = t.endOfWhiteSpace(e, n + 2) - 1;
191
- break;
192
- case " ":
193
- s += 1, n += 1;
194
- break;
195
- }
196
- a = e[n + 1];
197
- }
198
- return o || (o = " "), a && s <= r && (i = true), { fold: o, offset: n, error: i };
199
- }
200
- constructor(e, n, r) {
201
- Object.defineProperty(this, "context", { value: r || null, writable: true }), this.error = null, this.range = null, this.valueRange = null, this.props = n || [], this.type = e, this.value = null;
202
- }
203
- getPropValue(e, n, r) {
204
- if (!this.context) return null;
205
- let { src: s } = this.context, i = this.props[e];
206
- return i && s[i.start] === n ? s.slice(i.start + (r ? 1 : 0), i.end) : null;
207
- }
208
- get anchor() {
209
- for (let e = 0; e < this.props.length; ++e) {
210
- let n = this.getPropValue(e, re.ANCHOR, true);
211
- if (n != null) return n;
212
- }
213
- return null;
214
- }
215
- get comment() {
216
- let e = [];
217
- for (let n = 0; n < this.props.length; ++n) {
218
- let r = this.getPropValue(n, re.COMMENT, true);
219
- r != null && e.push(r);
220
- }
221
- return e.length > 0 ? e.join(`
222
- `) : null;
223
- }
224
- commentHasRequiredWhitespace(e) {
225
- let { src: n } = this.context;
226
- if (this.header && e === this.header.end || !this.valueRange) return false;
227
- let { end: r } = this.valueRange;
228
- return e !== r || t.atBlank(n, r - 1);
229
- }
230
- get hasComment() {
231
- if (this.context) {
232
- let { src: e } = this.context;
233
- for (let n = 0; n < this.props.length; ++n) if (e[this.props[n].start] === re.COMMENT) return true;
234
- }
235
- return false;
236
- }
237
- get hasProps() {
238
- if (this.context) {
239
- let { src: e } = this.context;
240
- for (let n = 0; n < this.props.length; ++n) if (e[this.props[n].start] !== re.COMMENT) return true;
241
- }
242
- return false;
243
- }
244
- get includesTrailingLines() {
245
- return false;
246
- }
247
- get jsonLike() {
248
- return [pt.FLOW_MAP, pt.FLOW_SEQ, pt.QUOTE_DOUBLE, pt.QUOTE_SINGLE].indexOf(this.type) !== -1;
249
- }
250
- get rangeAsLinePos() {
251
- if (!this.range || !this.context) return;
252
- let e = Mn(this.range.start, this.context.root);
253
- if (!e) return;
254
- let n = Mn(this.range.end, this.context.root);
255
- return { start: e, end: n };
256
- }
257
- get rawValue() {
258
- if (!this.valueRange || !this.context) return null;
259
- let { start: e, end: n } = this.valueRange;
260
- return this.context.src.slice(e, n);
261
- }
262
- get tag() {
263
- for (let e = 0; e < this.props.length; ++e) {
264
- let n = this.getPropValue(e, re.TAG, false);
265
- if (n != null) {
266
- if (n[1] === "<") return { verbatim: n.slice(2, -1) };
267
- {
268
- let [r, s, i] = n.match(/^(.*!)([^!]*)$/);
269
- return { handle: s, suffix: i };
270
- }
271
- }
272
- }
273
- return null;
274
- }
275
- get valueRangeContainsNewline() {
276
- if (!this.valueRange || !this.context) return false;
277
- let { start: e, end: n } = this.valueRange, { src: r } = this.context;
278
- for (let s = e; s < n; ++s) if (r[s] === `
279
- `) return true;
280
- return false;
281
- }
282
- parseComment(e) {
283
- let { src: n } = this.context;
284
- if (n[e] === re.COMMENT) {
285
- let r = t.endOfLine(n, e + 1), s = new Be(e, r);
286
- return this.props.push(s), r;
287
- }
288
- return e;
289
- }
290
- setOrigRanges(e, n) {
291
- return this.range && (n = this.range.setOrigRange(e, n)), this.valueRange && this.valueRange.setOrigRange(e, n), this.props.forEach((r) => r.setOrigRange(e, n)), n;
292
- }
293
- toString() {
294
- let { context: { src: e }, range: n, value: r } = this;
295
- if (r != null) return r;
296
- let s = e.slice(n.start, n.end);
297
- return t.addStringTerminator(e, n.end, s);
298
- }
299
- }, ye = class extends Error {
300
- constructor(e, n, r) {
301
- if (!r || !(n instanceof se)) throw new Error(`Invalid arguments for new ${e}`);
302
- super(), this.name = e, this.message = r, this.source = n;
303
- }
304
- makePretty() {
305
- if (!this.source) return;
306
- this.nodeType = this.source.type;
307
- let e = this.source.context && this.source.context.root;
308
- if (typeof this.offset == "number") {
309
- this.range = new Be(this.offset, this.offset + 1);
310
- let n = e && Mn(this.offset, e);
311
- if (n) {
312
- let r = { line: n.line, col: n.col + 1 };
313
- this.linePos = { start: n, end: r };
314
- }
315
- delete this.offset;
316
- } else this.range = this.source.range, this.linePos = this.source.rangeAsLinePos;
317
- if (this.linePos) {
318
- let { line: n, col: r } = this.linePos.start;
319
- this.message += ` at line ${n}, column ${r}`;
320
- let s = e && Ao(this.linePos, e);
321
- s && (this.message += `:
322
-
323
- ${s}
324
- `);
325
- }
326
- delete this.source;
327
- }
328
- }, Cn = class extends ye {
329
- constructor(e, n) {
330
- super("YAMLReferenceError", e, n);
331
- }
332
- }, mt = class extends ye {
333
- constructor(e, n) {
334
- super("YAMLSemanticError", e, n);
335
- }
336
- }, kn = class extends ye {
337
- constructor(e, n) {
338
- super("YAMLSyntaxError", e, n);
339
- }
340
- }, Pn = class extends ye {
341
- constructor(e, n) {
342
- super("YAMLWarning", e, n);
343
- }
344
- };
345
- function Lo(t, e, n) {
346
- return e in t ? Object.defineProperty(t, e, { value: n, enumerable: true, configurable: true, writable: true }) : t[e] = n, t;
347
- }
348
- var In = class t extends se {
349
- static endOfLine(e, n, r) {
350
- let s = e[n], i = n;
351
- for (; s && s !== `
352
- ` && !(r && (s === "[" || s === "]" || s === "{" || s === "}" || s === ",")); ) {
353
- let o = e[i + 1];
354
- if (s === ":" && (!o || o === `
355
- ` || o === " " || o === " " || r && o === ",") || (s === " " || s === " ") && o === "#") break;
356
- i += 1, s = o;
357
- }
358
- return i;
359
- }
360
- get strValue() {
361
- if (!this.valueRange || !this.context) return null;
362
- let { start: e, end: n } = this.valueRange, { src: r } = this.context, s = r[n - 1];
363
- for (; e < n && (s === `
364
- ` || s === " " || s === " "); ) s = r[--n - 1];
365
- let i = "";
366
- for (let a = e; a < n; ++a) {
367
- let c = r[a];
368
- if (c === `
369
- `) {
370
- let { fold: l, offset: f } = se.foldNewline(r, a, -1);
371
- i += l, a = f;
372
- } else if (c === " " || c === " ") {
373
- let l = a, f = r[a + 1];
374
- for (; a < n && (f === " " || f === " "); ) a += 1, f = r[a + 1];
375
- f !== `
376
- ` && (i += a > l ? r.slice(l, a + 1) : c);
377
- } else i += c;
378
- }
379
- let o = r[e];
380
- switch (o) {
381
- case " ": {
382
- let a = "Plain value cannot start with a tab character";
383
- return { errors: [new mt(this, a)], str: i };
384
- }
385
- case "@":
386
- case "`": {
387
- let a = `Plain value cannot start with reserved character ${o}`;
388
- return { errors: [new mt(this, a)], str: i };
389
- }
390
- default:
391
- return i;
392
- }
393
- }
394
- parseBlockValue(e) {
395
- let { indent: n, inFlow: r, src: s } = this.context, i = e, o = e;
396
- for (let a = s[i]; a === `
397
- ` && !se.atDocumentBoundary(s, i + 1); a = s[i]) {
398
- let c = se.endOfBlockIndent(s, n, i + 1);
399
- if (c === null || s[c] === "#") break;
400
- s[c] === `
401
- ` ? i = c : (o = t.endOfLine(s, c, r), i = o);
402
- }
403
- return this.valueRange.isEmpty() && (this.valueRange.start = e), this.valueRange.end = o, o;
404
- }
405
- parse(e, n) {
406
- this.context = e;
407
- let { inFlow: r, src: s } = e, i = n, o = s[i];
408
- return o && o !== "#" && o !== `
409
- ` && (i = t.endOfLine(s, n, r)), this.valueRange = new Be(n, i), i = se.endOfWhiteSpace(s, i), i = this.parseComment(i), (!this.hasComment || this.valueRange.isEmpty()) && (i = this.parseBlockValue(i)), i;
410
- }
411
- };
412
- $.Char = re;
413
- $.Node = se;
414
- $.PlainValue = In;
415
- $.Range = Be;
416
- $.Type = pt;
417
- $.YAMLError = ye;
418
- $.YAMLReferenceError = Cn;
419
- $.YAMLSemanticError = mt;
420
- $.YAMLSyntaxError = kn;
421
- $.YAMLWarning = Pn;
422
- $._defineProperty = Lo;
423
- $.defaultTagPrefix = bo;
424
- $.defaultTags = No;
425
- });
426
- var ns = te((ts) => {
427
- "use strict";
428
- var u = oe(), Se = class extends u.Node {
429
- constructor() {
430
- super(u.Type.BLANK_LINE);
431
- }
432
- get includesTrailingLines() {
433
- return true;
434
- }
435
- parse(e, n) {
436
- return this.context = e, this.range = new u.Range(n, n + 1), n + 1;
437
- }
438
- }, ht = class extends u.Node {
439
- constructor(e, n) {
440
- super(e, n), this.node = null;
441
- }
442
- get includesTrailingLines() {
443
- return !!this.node && this.node.includesTrailingLines;
444
- }
445
- parse(e, n) {
446
- this.context = e;
447
- let { parseNode: r, src: s } = e, { atLineStart: i, lineStart: o } = e;
448
- !i && this.type === u.Type.SEQ_ITEM && (this.error = new u.YAMLSemanticError(this, "Sequence items must not have preceding content on the same line"));
449
- let a = i ? n - o : e.indent, c = u.Node.endOfWhiteSpace(s, n + 1), l = s[c], f = l === "#", m = [], d = null;
450
- for (; l === `
451
- ` || l === "#"; ) {
452
- if (l === "#") {
453
- let h = u.Node.endOfLine(s, c + 1);
454
- m.push(new u.Range(c, h)), c = h;
455
- } else {
456
- i = true, o = c + 1;
457
- let h = u.Node.endOfWhiteSpace(s, o);
458
- s[h] === `
459
- ` && m.length === 0 && (d = new Se(), o = d.parse({ src: s }, o)), c = u.Node.endOfIndent(s, o);
460
- }
461
- l = s[c];
462
- }
463
- if (u.Node.nextNodeIsIndented(l, c - (o + a), this.type !== u.Type.SEQ_ITEM) ? this.node = r({ atLineStart: i, inCollection: false, indent: a, lineStart: o, parent: this }, c) : l && o > n + 1 && (c = o - 1), this.node) {
464
- if (d) {
465
- let h = e.parent.items || e.parent.contents;
466
- h && h.push(d);
467
- }
468
- m.length && Array.prototype.push.apply(this.props, m), c = this.node.range.end;
469
- } else if (f) {
470
- let h = m[0];
471
- this.props.push(h), c = h.end;
472
- } else c = u.Node.endOfLine(s, n + 1);
473
- let y = this.node ? this.node.valueRange.end : c;
474
- return this.valueRange = new u.Range(n, y), c;
475
- }
476
- setOrigRanges(e, n) {
477
- return n = super.setOrigRanges(e, n), this.node ? this.node.setOrigRanges(e, n) : n;
478
- }
479
- toString() {
480
- let { context: { src: e }, node: n, range: r, value: s } = this;
481
- if (s != null) return s;
482
- let i = n ? e.slice(r.start, n.range.start) + String(n) : e.slice(r.start, r.end);
483
- return u.Node.addStringTerminator(e, r.end, i);
484
- }
485
- }, Ee = class extends u.Node {
486
- constructor() {
487
- super(u.Type.COMMENT);
488
- }
489
- parse(e, n) {
490
- this.context = e;
491
- let r = this.parseComment(n);
492
- return this.range = new u.Range(n, r), r;
493
- }
494
- };
495
- function vn(t) {
496
- let e = t;
497
- for (; e instanceof ht; ) e = e.node;
498
- if (!(e instanceof xt)) return null;
499
- let n = e.items.length, r = -1;
500
- for (let o = n - 1; o >= 0; --o) {
501
- let a = e.items[o];
502
- if (a.type === u.Type.COMMENT) {
503
- let { indent: c, lineStart: l } = a.context;
504
- if (c > 0 && a.range.start >= l + c) break;
505
- r = o;
506
- } else if (a.type === u.Type.BLANK_LINE) r = o;
507
- else break;
508
- }
509
- if (r === -1) return null;
510
- let s = e.items.splice(r, n - r), i = s[0].range.start;
511
- for (; e.range.end = i, e.valueRange && e.valueRange.end > i && (e.valueRange.end = i), e !== t; ) e = e.context.parent;
512
- return s;
513
- }
514
- var xt = class t extends u.Node {
515
- static nextContentHasIndent(e, n, r) {
516
- let s = u.Node.endOfLine(e, n) + 1;
517
- n = u.Node.endOfWhiteSpace(e, s);
518
- let i = e[n];
519
- return i ? n >= s + r ? true : i !== "#" && i !== `
520
- ` ? false : t.nextContentHasIndent(e, n, r) : false;
521
- }
522
- constructor(e) {
523
- super(e.type === u.Type.SEQ_ITEM ? u.Type.SEQ : u.Type.MAP);
524
- for (let r = e.props.length - 1; r >= 0; --r) if (e.props[r].start < e.context.lineStart) {
525
- this.props = e.props.slice(0, r + 1), e.props = e.props.slice(r + 1);
526
- let s = e.props[0] || e.valueRange;
527
- e.range.start = s.start;
528
- break;
529
- }
530
- this.items = [e];
531
- let n = vn(e);
532
- n && Array.prototype.push.apply(this.items, n);
533
- }
534
- get includesTrailingLines() {
535
- return this.items.length > 0;
536
- }
537
- parse(e, n) {
538
- this.context = e;
539
- let { parseNode: r, src: s } = e, i = u.Node.startOfLine(s, n), o = this.items[0];
540
- o.context.parent = this, this.valueRange = u.Range.copy(o.valueRange);
541
- let a = o.range.start - o.context.lineStart, c = n;
542
- c = u.Node.normalizeOffset(s, c);
543
- let l = s[c], f = u.Node.endOfWhiteSpace(s, i) === c, m = false;
544
- for (; l; ) {
545
- for (; l === `
546
- ` || l === "#"; ) {
547
- if (f && l === `
548
- ` && !m) {
549
- let h = new Se();
550
- if (c = h.parse({ src: s }, c), this.valueRange.end = c, c >= s.length) {
551
- l = null;
552
- break;
553
- }
554
- this.items.push(h), c -= 1;
555
- } else if (l === "#") {
556
- if (c < i + a && !t.nextContentHasIndent(s, c, a)) return c;
557
- let h = new Ee();
558
- if (c = h.parse({ indent: a, lineStart: i, src: s }, c), this.items.push(h), this.valueRange.end = c, c >= s.length) {
559
- l = null;
560
- break;
561
- }
562
- }
563
- if (i = c + 1, c = u.Node.endOfIndent(s, i), u.Node.atBlank(s, c)) {
564
- let h = u.Node.endOfWhiteSpace(s, c), g = s[h];
565
- (!g || g === `
566
- ` || g === "#") && (c = h);
567
- }
568
- l = s[c], f = true;
569
- }
570
- if (!l) break;
571
- if (c !== i + a && (f || l !== ":")) {
572
- if (c < i + a) {
573
- i > n && (c = i);
574
- break;
575
- } else if (!this.error) {
576
- let h = "All collection items must start at the same column";
577
- this.error = new u.YAMLSyntaxError(this, h);
578
- }
579
- }
580
- if (o.type === u.Type.SEQ_ITEM) {
581
- if (l !== "-") {
582
- i > n && (c = i);
583
- break;
584
- }
585
- } else if (l === "-" && !this.error) {
586
- let h = s[c + 1];
587
- if (!h || h === `
588
- ` || h === " " || h === " ") {
589
- let g = "A collection cannot be both a mapping and a sequence";
590
- this.error = new u.YAMLSyntaxError(this, g);
591
- }
592
- }
593
- let d = r({ atLineStart: f, inCollection: true, indent: a, lineStart: i, parent: this }, c);
594
- if (!d) return c;
595
- if (this.items.push(d), this.valueRange.end = d.valueRange.end, c = u.Node.normalizeOffset(s, d.range.end), l = s[c], f = false, m = d.includesTrailingLines, l) {
596
- let h = c - 1, g = s[h];
597
- for (; g === " " || g === " "; ) g = s[--h];
598
- g === `
599
- ` && (i = h + 1, f = true);
600
- }
601
- let y = vn(d);
602
- y && Array.prototype.push.apply(this.items, y);
603
- }
604
- return c;
605
- }
606
- setOrigRanges(e, n) {
607
- return n = super.setOrigRanges(e, n), this.items.forEach((r) => {
608
- n = r.setOrigRanges(e, n);
609
- }), n;
610
- }
611
- toString() {
612
- let { context: { src: e }, items: n, range: r, value: s } = this;
613
- if (s != null) return s;
614
- let i = e.slice(r.start, n[0].range.start) + String(n[0]);
615
- for (let o = 1; o < n.length; ++o) {
616
- let a = n[o], { atLineStart: c, indent: l } = a.context;
617
- if (c) for (let f = 0; f < l; ++f) i += " ";
618
- i += String(a);
619
- }
620
- return u.Node.addStringTerminator(e, r.end, i);
621
- }
622
- }, _n = class extends u.Node {
623
- constructor() {
624
- super(u.Type.DIRECTIVE), this.name = null;
625
- }
626
- get parameters() {
627
- let e = this.rawValue;
628
- return e ? e.trim().split(/[ \t]+/) : [];
629
- }
630
- parseName(e) {
631
- let { src: n } = this.context, r = e, s = n[r];
632
- for (; s && s !== `
633
- ` && s !== " " && s !== " "; ) s = n[r += 1];
634
- return this.name = n.slice(e, r), r;
635
- }
636
- parseParameters(e) {
637
- let { src: n } = this.context, r = e, s = n[r];
638
- for (; s && s !== `
639
- ` && s !== "#"; ) s = n[r += 1];
640
- return this.valueRange = new u.Range(e, r), r;
641
- }
642
- parse(e, n) {
643
- this.context = e;
644
- let r = this.parseName(n + 1);
645
- return r = this.parseParameters(r), r = this.parseComment(r), this.range = new u.Range(n, r), r;
646
- }
647
- }, Rn = class t extends u.Node {
648
- static startCommentOrEndBlankLine(e, n) {
649
- let r = u.Node.endOfWhiteSpace(e, n), s = e[r];
650
- return s === "#" || s === `
651
- ` ? r : n;
652
- }
653
- constructor() {
654
- super(u.Type.DOCUMENT), this.directives = null, this.contents = null, this.directivesEndMarker = null, this.documentEndMarker = null;
655
- }
656
- parseDirectives(e) {
657
- let { src: n } = this.context;
658
- this.directives = [];
659
- let r = true, s = false, i = e;
660
- for (; !u.Node.atDocumentBoundary(n, i, u.Char.DIRECTIVES_END); ) switch (i = t.startCommentOrEndBlankLine(n, i), n[i]) {
661
- case `
662
- `:
663
- if (r) {
664
- let o = new Se();
665
- i = o.parse({ src: n }, i), i < n.length && this.directives.push(o);
666
- } else i += 1, r = true;
667
- break;
668
- case "#":
669
- {
670
- let o = new Ee();
671
- i = o.parse({ src: n }, i), this.directives.push(o), r = false;
672
- }
673
- break;
674
- case "%":
675
- {
676
- let o = new _n();
677
- i = o.parse({ parent: this, src: n }, i), this.directives.push(o), s = true, r = false;
678
- }
679
- break;
680
- default:
681
- return s ? this.error = new u.YAMLSemanticError(this, "Missing directives-end indicator line") : this.directives.length > 0 && (this.contents = this.directives, this.directives = []), i;
682
- }
683
- return n[i] ? (this.directivesEndMarker = new u.Range(i, i + 3), i + 3) : (s ? this.error = new u.YAMLSemanticError(this, "Missing directives-end indicator line") : this.directives.length > 0 && (this.contents = this.directives, this.directives = []), i);
684
- }
685
- parseContents(e) {
686
- let { parseNode: n, src: r } = this.context;
687
- this.contents || (this.contents = []);
688
- let s = e;
689
- for (; r[s - 1] === "-"; ) s -= 1;
690
- let i = u.Node.endOfWhiteSpace(r, e), o = s === e;
691
- for (this.valueRange = new u.Range(i); !u.Node.atDocumentBoundary(r, i, u.Char.DOCUMENT_END); ) {
692
- switch (r[i]) {
693
- case `
694
- `:
695
- if (o) {
696
- let a = new Se();
697
- i = a.parse({ src: r }, i), i < r.length && this.contents.push(a);
698
- } else i += 1, o = true;
699
- s = i;
700
- break;
701
- case "#":
702
- {
703
- let a = new Ee();
704
- i = a.parse({ src: r }, i), this.contents.push(a), o = false;
705
- }
706
- break;
707
- default: {
708
- let a = u.Node.endOfIndent(r, i), l = n({ atLineStart: o, indent: -1, inFlow: false, inCollection: false, lineStart: s, parent: this }, a);
709
- if (!l) return this.valueRange.end = a;
710
- this.contents.push(l), i = l.range.end, o = false;
711
- let f = vn(l);
712
- f && Array.prototype.push.apply(this.contents, f);
713
- }
714
- }
715
- i = t.startCommentOrEndBlankLine(r, i);
716
- }
717
- if (this.valueRange.end = i, r[i] && (this.documentEndMarker = new u.Range(i, i + 3), i += 3, r[i])) {
718
- if (i = u.Node.endOfWhiteSpace(r, i), r[i] === "#") {
719
- let a = new Ee();
720
- i = a.parse({ src: r }, i), this.contents.push(a);
721
- }
722
- switch (r[i]) {
723
- case `
724
- `:
725
- i += 1;
726
- break;
727
- case void 0:
728
- break;
729
- default:
730
- this.error = new u.YAMLSyntaxError(this, "Document end marker line cannot have a non-comment suffix");
731
- }
732
- }
733
- return i;
734
- }
735
- parse(e, n) {
736
- e.root = this, this.context = e;
737
- let { src: r } = e, s = r.charCodeAt(n) === 65279 ? n + 1 : n;
738
- return s = this.parseDirectives(s), s = this.parseContents(s), s;
739
- }
740
- setOrigRanges(e, n) {
741
- return n = super.setOrigRanges(e, n), this.directives.forEach((r) => {
742
- n = r.setOrigRanges(e, n);
743
- }), this.directivesEndMarker && (n = this.directivesEndMarker.setOrigRange(e, n)), this.contents.forEach((r) => {
744
- n = r.setOrigRanges(e, n);
745
- }), this.documentEndMarker && (n = this.documentEndMarker.setOrigRange(e, n)), n;
746
- }
747
- toString() {
748
- let { contents: e, directives: n, value: r } = this;
749
- if (r != null) return r;
750
- let s = n.join("");
751
- return e.length > 0 && ((n.length > 0 || e[0].type === u.Type.COMMENT) && (s += `---
752
- `), s += e.join("")), s[s.length - 1] !== `
753
- ` && (s += `
754
- `), s;
755
- }
756
- }, xn = class extends u.Node {
757
- parse(e, n) {
758
- this.context = e;
759
- let { src: r } = e, s = u.Node.endOfIdentifier(r, n + 1);
760
- return this.valueRange = new u.Range(n + 1, s), s = u.Node.endOfWhiteSpace(r, s), s = this.parseComment(s), s;
761
- }
762
- }, ae = { CLIP: "CLIP", KEEP: "KEEP", STRIP: "STRIP" }, Dn = class extends u.Node {
763
- constructor(e, n) {
764
- super(e, n), this.blockIndent = null, this.chomping = ae.CLIP, this.header = null;
765
- }
766
- get includesTrailingLines() {
767
- return this.chomping === ae.KEEP;
768
- }
769
- get strValue() {
770
- if (!this.valueRange || !this.context) return null;
771
- let { start: e, end: n } = this.valueRange, { indent: r, src: s } = this.context;
772
- if (this.valueRange.isEmpty()) return "";
773
- let i = null, o = s[n - 1];
774
- for (; o === `
775
- ` || o === " " || o === " "; ) {
776
- if (n -= 1, n <= e) {
777
- if (this.chomping === ae.KEEP) break;
778
- return "";
779
- }
780
- o === `
781
- ` && (i = n), o = s[n - 1];
782
- }
783
- let a = n + 1;
784
- i && (this.chomping === ae.KEEP ? (a = i, n = this.valueRange.end) : n = i);
785
- let c = r + this.blockIndent, l = this.type === u.Type.BLOCK_FOLDED, f = true, m = "", d = "", y = false;
786
- for (let h = e; h < n; ++h) {
787
- for (let w = 0; w < c && s[h] === " "; ++w) h += 1;
788
- let g = s[h];
789
- if (g === `
790
- `) d === `
791
- ` ? m += `
792
- ` : d = `
793
- `;
794
- else {
795
- let w = u.Node.endOfLine(s, h), M = s.slice(h, w);
796
- h = w, l && (g === " " || g === " ") && h < a ? (d === " " ? d = `
797
- ` : !y && !f && d === `
798
- ` && (d = `
799
-
800
- `), m += d + M, d = w < n && s[w] || "", y = true) : (m += d + M, d = l && h < a ? " " : `
801
- `, y = false), f && M !== "" && (f = false);
802
- }
803
- }
804
- return this.chomping === ae.STRIP ? m : m + `
805
- `;
806
- }
807
- parseBlockHeader(e) {
808
- let { src: n } = this.context, r = e + 1, s = "";
809
- for (; ; ) {
810
- let i = n[r];
811
- switch (i) {
812
- case "-":
813
- this.chomping = ae.STRIP;
814
- break;
815
- case "+":
816
- this.chomping = ae.KEEP;
817
- break;
818
- case "0":
819
- case "1":
820
- case "2":
821
- case "3":
822
- case "4":
823
- case "5":
824
- case "6":
825
- case "7":
826
- case "8":
827
- case "9":
828
- s += i;
829
- break;
830
- default:
831
- return this.blockIndent = Number(s) || null, this.header = new u.Range(e, r), r;
832
- }
833
- r += 1;
834
- }
835
- }
836
- parseBlockValue(e) {
837
- let { indent: n, src: r } = this.context, s = !!this.blockIndent, i = e, o = e, a = 1;
838
- for (let c = r[i]; c === `
839
- ` && (i += 1, !u.Node.atDocumentBoundary(r, i)); c = r[i]) {
840
- let l = u.Node.endOfBlockIndent(r, n, i);
841
- if (l === null) break;
842
- let f = r[l], m = l - (i + n);
843
- if (this.blockIndent) {
844
- if (f && f !== `
845
- ` && m < this.blockIndent) {
846
- if (r[l] === "#") break;
847
- if (!this.error) {
848
- let y = `Block scalars must not be less indented than their ${s ? "explicit indentation indicator" : "first line"}`;
849
- this.error = new u.YAMLSemanticError(this, y);
850
- }
851
- }
852
- } else if (r[l] !== `
853
- `) {
854
- if (m < a) {
855
- let d = "Block scalars with more-indented leading empty lines must use an explicit indentation indicator";
856
- this.error = new u.YAMLSemanticError(this, d);
857
- }
858
- this.blockIndent = m;
859
- } else m > a && (a = m);
860
- r[l] === `
861
- ` ? i = l : i = o = u.Node.endOfLine(r, l);
862
- }
863
- return this.chomping !== ae.KEEP && (i = r[o] ? o + 1 : o), this.valueRange = new u.Range(e + 1, i), i;
864
- }
865
- parse(e, n) {
866
- this.context = e;
867
- let { src: r } = e, s = this.parseBlockHeader(n);
868
- return s = u.Node.endOfWhiteSpace(r, s), s = this.parseComment(s), s = this.parseBlockValue(s), s;
869
- }
870
- setOrigRanges(e, n) {
871
- return n = super.setOrigRanges(e, n), this.header ? this.header.setOrigRange(e, n) : n;
872
- }
873
- }, Yn = class extends u.Node {
874
- constructor(e, n) {
875
- super(e, n), this.items = null;
876
- }
877
- prevNodeIsJsonLike(e = this.items.length) {
878
- let n = this.items[e - 1];
879
- return !!n && (n.jsonLike || n.type === u.Type.COMMENT && this.prevNodeIsJsonLike(e - 1));
880
- }
881
- parse(e, n) {
882
- this.context = e;
883
- let { parseNode: r, src: s } = e, { indent: i, lineStart: o } = e, a = s[n];
884
- this.items = [{ char: a, offset: n }];
885
- let c = u.Node.endOfWhiteSpace(s, n + 1);
886
- for (a = s[c]; a && a !== "]" && a !== "}"; ) {
887
- switch (a) {
888
- case `
889
- `:
890
- {
891
- o = c + 1;
892
- let l = u.Node.endOfWhiteSpace(s, o);
893
- if (s[l] === `
894
- `) {
895
- let f = new Se();
896
- o = f.parse({ src: s }, o), this.items.push(f);
897
- }
898
- if (c = u.Node.endOfIndent(s, o), c <= o + i && (a = s[c], c < o + i || a !== "]" && a !== "}")) {
899
- let f = "Insufficient indentation in flow collection";
900
- this.error = new u.YAMLSemanticError(this, f);
901
- }
902
- }
903
- break;
904
- case ",":
905
- this.items.push({ char: a, offset: c }), c += 1;
906
- break;
907
- case "#":
908
- {
909
- let l = new Ee();
910
- c = l.parse({ src: s }, c), this.items.push(l);
911
- }
912
- break;
913
- case "?":
914
- case ":": {
915
- let l = s[c + 1];
916
- if (l === `
917
- ` || l === " " || l === " " || l === "," || a === ":" && this.prevNodeIsJsonLike()) {
918
- this.items.push({ char: a, offset: c }), c += 1;
919
- break;
920
- }
921
- }
922
- default: {
923
- let l = r({ atLineStart: false, inCollection: false, inFlow: true, indent: -1, lineStart: o, parent: this }, c);
924
- if (!l) return this.valueRange = new u.Range(n, c), c;
925
- this.items.push(l), c = u.Node.normalizeOffset(s, l.range.end);
926
- }
927
- }
928
- c = u.Node.endOfWhiteSpace(s, c), a = s[c];
929
- }
930
- return this.valueRange = new u.Range(n, c + 1), a && (this.items.push({ char: a, offset: c }), c = u.Node.endOfWhiteSpace(s, c + 1), c = this.parseComment(c)), c;
931
- }
932
- setOrigRanges(e, n) {
933
- return n = super.setOrigRanges(e, n), this.items.forEach((r) => {
934
- if (r instanceof u.Node) n = r.setOrigRanges(e, n);
935
- else if (e.length === 0) r.origOffset = r.offset;
936
- else {
937
- let s = n;
938
- for (; s < e.length && !(e[s] > r.offset); ) ++s;
939
- r.origOffset = r.offset + s, n = s;
940
- }
941
- }), n;
942
- }
943
- toString() {
944
- let { context: { src: e }, items: n, range: r, value: s } = this;
945
- if (s != null) return s;
946
- let i = n.filter((c) => c instanceof u.Node), o = "", a = r.start;
947
- return i.forEach((c) => {
948
- let l = e.slice(a, c.range.start);
949
- a = c.range.end, o += l + String(c), o[o.length - 1] === `
950
- ` && e[a - 1] !== `
951
- ` && e[a] === `
952
- ` && (a += 1);
953
- }), o += e.slice(a, r.end), u.Node.addStringTerminator(e, r.end, o);
954
- }
955
- }, $n = class t extends u.Node {
956
- static endOfQuote(e, n) {
957
- let r = e[n];
958
- for (; r && r !== '"'; ) n += r === "\\" ? 2 : 1, r = e[n];
959
- return n + 1;
960
- }
961
- get strValue() {
962
- if (!this.valueRange || !this.context) return null;
963
- let e = [], { start: n, end: r } = this.valueRange, { indent: s, src: i } = this.context;
964
- i[r - 1] !== '"' && e.push(new u.YAMLSyntaxError(this, 'Missing closing "quote'));
965
- let o = "";
966
- for (let a = n + 1; a < r - 1; ++a) {
967
- let c = i[a];
968
- if (c === `
969
- `) {
970
- u.Node.atDocumentBoundary(i, a + 1) && e.push(new u.YAMLSemanticError(this, "Document boundary indicators are not allowed within string values"));
971
- let { fold: l, offset: f, error: m } = u.Node.foldNewline(i, a, s);
972
- o += l, a = f, m && e.push(new u.YAMLSemanticError(this, "Multi-line double-quoted string needs to be sufficiently indented"));
973
- } else if (c === "\\") switch (a += 1, i[a]) {
974
- case "0":
975
- o += "\0";
976
- break;
977
- case "a":
978
- o += "\x07";
979
- break;
980
- case "b":
981
- o += "\b";
982
- break;
983
- case "e":
984
- o += "\x1B";
985
- break;
986
- case "f":
987
- o += "\f";
988
- break;
989
- case "n":
990
- o += `
991
- `;
992
- break;
993
- case "r":
994
- o += "\r";
995
- break;
996
- case "t":
997
- o += " ";
998
- break;
999
- case "v":
1000
- o += "\v";
1001
- break;
1002
- case "N":
1003
- o += "\x85";
1004
- break;
1005
- case "_":
1006
- o += "\xA0";
1007
- break;
1008
- case "L":
1009
- o += "\u2028";
1010
- break;
1011
- case "P":
1012
- o += "\u2029";
1013
- break;
1014
- case " ":
1015
- o += " ";
1016
- break;
1017
- case '"':
1018
- o += '"';
1019
- break;
1020
- case "/":
1021
- o += "/";
1022
- break;
1023
- case "\\":
1024
- o += "\\";
1025
- break;
1026
- case " ":
1027
- o += " ";
1028
- break;
1029
- case "x":
1030
- o += this.parseCharCode(a + 1, 2, e), a += 2;
1031
- break;
1032
- case "u":
1033
- o += this.parseCharCode(a + 1, 4, e), a += 4;
1034
- break;
1035
- case "U":
1036
- o += this.parseCharCode(a + 1, 8, e), a += 8;
1037
- break;
1038
- case `
1039
- `:
1040
- for (; i[a + 1] === " " || i[a + 1] === " "; ) a += 1;
1041
- break;
1042
- default:
1043
- e.push(new u.YAMLSyntaxError(this, `Invalid escape sequence ${i.substr(a - 1, 2)}`)), o += "\\" + i[a];
1044
- }
1045
- else if (c === " " || c === " ") {
1046
- let l = a, f = i[a + 1];
1047
- for (; f === " " || f === " "; ) a += 1, f = i[a + 1];
1048
- f !== `
1049
- ` && (o += a > l ? i.slice(l, a + 1) : c);
1050
- } else o += c;
1051
- }
1052
- return e.length > 0 ? { errors: e, str: o } : o;
1053
- }
1054
- parseCharCode(e, n, r) {
1055
- let { src: s } = this.context, i = s.substr(e, n), a = i.length === n && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
1056
- return isNaN(a) ? (r.push(new u.YAMLSyntaxError(this, `Invalid escape sequence ${s.substr(e - 2, n + 2)}`)), s.substr(e - 2, n + 2)) : String.fromCodePoint(a);
1057
- }
1058
- parse(e, n) {
1059
- this.context = e;
1060
- let { src: r } = e, s = t.endOfQuote(r, n + 1);
1061
- return this.valueRange = new u.Range(n, s), s = u.Node.endOfWhiteSpace(r, s), s = this.parseComment(s), s;
1062
- }
1063
- }, Bn = class t extends u.Node {
1064
- static endOfQuote(e, n) {
1065
- let r = e[n];
1066
- for (; r; ) if (r === "'") {
1067
- if (e[n + 1] !== "'") break;
1068
- r = e[n += 2];
1069
- } else r = e[n += 1];
1070
- return n + 1;
1071
- }
1072
- get strValue() {
1073
- if (!this.valueRange || !this.context) return null;
1074
- let e = [], { start: n, end: r } = this.valueRange, { indent: s, src: i } = this.context;
1075
- i[r - 1] !== "'" && e.push(new u.YAMLSyntaxError(this, "Missing closing 'quote"));
1076
- let o = "";
1077
- for (let a = n + 1; a < r - 1; ++a) {
1078
- let c = i[a];
1079
- if (c === `
1080
- `) {
1081
- u.Node.atDocumentBoundary(i, a + 1) && e.push(new u.YAMLSemanticError(this, "Document boundary indicators are not allowed within string values"));
1082
- let { fold: l, offset: f, error: m } = u.Node.foldNewline(i, a, s);
1083
- o += l, a = f, m && e.push(new u.YAMLSemanticError(this, "Multi-line single-quoted string needs to be sufficiently indented"));
1084
- } else if (c === "'") o += c, a += 1, i[a] !== "'" && e.push(new u.YAMLSyntaxError(this, "Unescaped single quote? This should not happen."));
1085
- else if (c === " " || c === " ") {
1086
- let l = a, f = i[a + 1];
1087
- for (; f === " " || f === " "; ) a += 1, f = i[a + 1];
1088
- f !== `
1089
- ` && (o += a > l ? i.slice(l, a + 1) : c);
1090
- } else o += c;
1091
- }
1092
- return e.length > 0 ? { errors: e, str: o } : o;
1093
- }
1094
- parse(e, n) {
1095
- this.context = e;
1096
- let { src: r } = e, s = t.endOfQuote(r, n + 1);
1097
- return this.valueRange = new u.Range(n, s), s = u.Node.endOfWhiteSpace(r, s), s = this.parseComment(s), s;
1098
- }
1099
- };
1100
- function To(t, e) {
1101
- switch (t) {
1102
- case u.Type.ALIAS:
1103
- return new xn(t, e);
1104
- case u.Type.BLOCK_FOLDED:
1105
- case u.Type.BLOCK_LITERAL:
1106
- return new Dn(t, e);
1107
- case u.Type.FLOW_MAP:
1108
- case u.Type.FLOW_SEQ:
1109
- return new Yn(t, e);
1110
- case u.Type.MAP_KEY:
1111
- case u.Type.MAP_VALUE:
1112
- case u.Type.SEQ_ITEM:
1113
- return new ht(t, e);
1114
- case u.Type.COMMENT:
1115
- case u.Type.PLAIN:
1116
- return new u.PlainValue(t, e);
1117
- case u.Type.QUOTE_DOUBLE:
1118
- return new $n(t, e);
1119
- case u.Type.QUOTE_SINGLE:
1120
- return new Bn(t, e);
1121
- default:
1122
- return null;
1123
- }
1124
- }
1125
- var Fn = class t {
1126
- static parseType(e, n, r) {
1127
- switch (e[n]) {
1128
- case "*":
1129
- return u.Type.ALIAS;
1130
- case ">":
1131
- return u.Type.BLOCK_FOLDED;
1132
- case "|":
1133
- return u.Type.BLOCK_LITERAL;
1134
- case "{":
1135
- return u.Type.FLOW_MAP;
1136
- case "[":
1137
- return u.Type.FLOW_SEQ;
1138
- case "?":
1139
- return !r && u.Node.atBlank(e, n + 1, true) ? u.Type.MAP_KEY : u.Type.PLAIN;
1140
- case ":":
1141
- return !r && u.Node.atBlank(e, n + 1, true) ? u.Type.MAP_VALUE : u.Type.PLAIN;
1142
- case "-":
1143
- return !r && u.Node.atBlank(e, n + 1, true) ? u.Type.SEQ_ITEM : u.Type.PLAIN;
1144
- case '"':
1145
- return u.Type.QUOTE_DOUBLE;
1146
- case "'":
1147
- return u.Type.QUOTE_SINGLE;
1148
- default:
1149
- return u.Type.PLAIN;
1150
- }
1151
- }
1152
- constructor(e = {}, { atLineStart: n, inCollection: r, inFlow: s, indent: i, lineStart: o, parent: a } = {}) {
1153
- u._defineProperty(this, "parseNode", (c, l) => {
1154
- if (u.Node.atDocumentBoundary(this.src, l)) return null;
1155
- let f = new t(this, c), { props: m, type: d, valueStart: y } = f.parseProps(l), h = To(d, m), g = h.parse(f, y);
1156
- if (h.range = new u.Range(l, g), g <= l && (h.error = new Error("Node#parse consumed no characters"), h.error.parseEnd = g, h.error.source = h, h.range.end = l + 1), f.nodeStartsCollection(h)) {
1157
- !h.error && !f.atLineStart && f.parent.type === u.Type.DOCUMENT && (h.error = new u.YAMLSyntaxError(h, "Block collection must not have preceding content here (e.g. directives-end indicator)"));
1158
- let w = new xt(h);
1159
- return g = w.parse(new t(f), g), w.range = new u.Range(l, g), w;
1160
- }
1161
- return h;
1162
- }), this.atLineStart = n ?? (e.atLineStart || false), this.inCollection = r ?? (e.inCollection || false), this.inFlow = s ?? (e.inFlow || false), this.indent = i ?? e.indent, this.lineStart = o ?? e.lineStart, this.parent = a ?? (e.parent || {}), this.root = e.root, this.src = e.src;
1163
- }
1164
- nodeStartsCollection(e) {
1165
- let { inCollection: n, inFlow: r, src: s } = this;
1166
- if (n || r) return false;
1167
- if (e instanceof ht) return true;
1168
- let i = e.range.end;
1169
- return s[i] === `
1170
- ` || s[i - 1] === `
1171
- ` ? false : (i = u.Node.endOfWhiteSpace(s, i), s[i] === ":");
1172
- }
1173
- parseProps(e) {
1174
- let { inFlow: n, parent: r, src: s } = this, i = [], o = false;
1175
- e = this.atLineStart ? u.Node.endOfIndent(s, e) : u.Node.endOfWhiteSpace(s, e);
1176
- let a = s[e];
1177
- for (; a === u.Char.ANCHOR || a === u.Char.COMMENT || a === u.Char.TAG || a === `
1178
- `; ) {
1179
- if (a === `
1180
- `) {
1181
- let l = e, f;
1182
- do
1183
- f = l + 1, l = u.Node.endOfIndent(s, f);
1184
- while (s[l] === `
1185
- `);
1186
- let m = l - (f + this.indent), d = r.type === u.Type.SEQ_ITEM && r.context.atLineStart;
1187
- if (s[l] !== "#" && !u.Node.nextNodeIsIndented(s[l], m, !d)) break;
1188
- this.atLineStart = true, this.lineStart = f, o = false, e = l;
1189
- } else if (a === u.Char.COMMENT) {
1190
- let l = u.Node.endOfLine(s, e + 1);
1191
- i.push(new u.Range(e, l)), e = l;
1192
- } else {
1193
- let l = u.Node.endOfIdentifier(s, e + 1);
1194
- a === u.Char.TAG && s[l] === "," && /^[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+,\d\d\d\d(-\d\d){0,2}\/\S/.test(s.slice(e + 1, l + 13)) && (l = u.Node.endOfIdentifier(s, l + 5)), i.push(new u.Range(e, l)), o = true, e = u.Node.endOfWhiteSpace(s, l);
1195
- }
1196
- a = s[e];
1197
- }
1198
- o && a === ":" && u.Node.atBlank(s, e + 1, true) && (e -= 1);
1199
- let c = t.parseType(s, e, n);
1200
- return { props: i, type: c, valueStart: e };
1201
- }
1202
- };
1203
- function Mo(t) {
1204
- let e = [];
1205
- t.indexOf("\r") !== -1 && (t = t.replace(/\r\n?/g, (s, i) => (s.length > 1 && e.push(i), `
1206
- `)));
1207
- let n = [], r = 0;
1208
- do {
1209
- let s = new Rn(), i = new Fn({ src: t });
1210
- r = s.parse(i, r), n.push(s);
1211
- } while (r < t.length);
1212
- return n.setOrigRanges = () => {
1213
- if (e.length === 0) return false;
1214
- for (let i = 1; i < e.length; ++i) e[i] -= i;
1215
- let s = 0;
1216
- for (let i = 0; i < n.length; ++i) s = n[i].setOrigRanges(e, s);
1217
- return e.splice(0, e.length), true;
1218
- }, n.toString = () => n.join(`...
1219
- `), n;
1220
- }
1221
- ts.parse = Mo;
1222
- });
1223
- var qe = te((k) => {
1224
- "use strict";
1225
- var p = oe();
1226
- function Co(t, e, n) {
1227
- return n ? `#${n.replace(/[\s\S]^/gm, `$&${e}#`)}
1228
- ${e}${t}` : t;
1229
- }
1230
- function Fe(t, e, n) {
1231
- return n ? n.indexOf(`
1232
- `) === -1 ? `${t} #${n}` : `${t}
1233
- ` + n.replace(/^/gm, `${e || ""}#`) : t;
1234
- }
1235
- var j = class {
1236
- };
1237
- function ce(t, e, n) {
1238
- if (Array.isArray(t)) return t.map((r, s) => ce(r, String(s), n));
1239
- if (t && typeof t.toJSON == "function") {
1240
- let r = n && n.anchors && n.anchors.get(t);
1241
- r && (n.onCreate = (i) => {
1242
- r.res = i, delete n.onCreate;
1243
- });
1244
- let s = t.toJSON(e, n);
1245
- return r && n.onCreate && n.onCreate(s), s;
1246
- }
1247
- return (!n || !n.keep) && typeof t == "bigint" ? Number(t) : t;
1248
- }
1249
- var _ = class extends j {
1250
- constructor(e) {
1251
- super(), this.value = e;
1252
- }
1253
- toJSON(e, n) {
1254
- return n && n.keep ? this.value : ce(this.value, e, n);
1255
- }
1256
- toString() {
1257
- return String(this.value);
1258
- }
1259
- };
1260
- function rs(t, e, n) {
1261
- let r = n;
1262
- for (let s = e.length - 1; s >= 0; --s) {
1263
- let i = e[s];
1264
- if (Number.isInteger(i) && i >= 0) {
1265
- let o = [];
1266
- o[i] = r, r = o;
1267
- } else {
1268
- let o = {};
1269
- Object.defineProperty(o, i, { value: r, writable: true, enumerable: true, configurable: true }), r = o;
1270
- }
1271
- }
1272
- return t.createNode(r, false);
1273
- }
1274
- var os = (t) => t == null || typeof t == "object" && t[Symbol.iterator]().next().done, W = class t extends j {
1275
- constructor(e) {
1276
- super(), p._defineProperty(this, "items", []), this.schema = e;
1277
- }
1278
- addIn(e, n) {
1279
- if (os(e)) this.add(n);
1280
- else {
1281
- let [r, ...s] = e, i = this.get(r, true);
1282
- if (i instanceof t) i.addIn(s, n);
1283
- else if (i === void 0 && this.schema) this.set(r, rs(this.schema, s, n));
1284
- else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`);
1285
- }
1286
- }
1287
- deleteIn([e, ...n]) {
1288
- if (n.length === 0) return this.delete(e);
1289
- let r = this.get(e, true);
1290
- if (r instanceof t) return r.deleteIn(n);
1291
- throw new Error(`Expected YAML collection at ${e}. Remaining path: ${n}`);
1292
- }
1293
- getIn([e, ...n], r) {
1294
- let s = this.get(e, true);
1295
- return n.length === 0 ? !r && s instanceof _ ? s.value : s : s instanceof t ? s.getIn(n, r) : void 0;
1296
- }
1297
- hasAllNullValues() {
1298
- return this.items.every((e) => {
1299
- if (!e || e.type !== "PAIR") return false;
1300
- let n = e.value;
1301
- return n == null || n instanceof _ && n.value == null && !n.commentBefore && !n.comment && !n.tag;
1302
- });
1303
- }
1304
- hasIn([e, ...n]) {
1305
- if (n.length === 0) return this.has(e);
1306
- let r = this.get(e, true);
1307
- return r instanceof t ? r.hasIn(n) : false;
1308
- }
1309
- setIn([e, ...n], r) {
1310
- if (n.length === 0) this.set(e, r);
1311
- else {
1312
- let s = this.get(e, true);
1313
- if (s instanceof t) s.setIn(n, r);
1314
- else if (s === void 0 && this.schema) this.set(e, rs(this.schema, n, r));
1315
- else throw new Error(`Expected YAML collection at ${e}. Remaining path: ${n}`);
1316
- }
1317
- }
1318
- toJSON() {
1319
- return null;
1320
- }
1321
- toString(e, { blockItem: n, flowChars: r, isMap: s, itemIndent: i }, o, a) {
1322
- let { indent: c, indentStep: l, stringify: f } = e, m = this.type === p.Type.FLOW_MAP || this.type === p.Type.FLOW_SEQ || e.inFlow;
1323
- m && (i += l);
1324
- let d = s && this.hasAllNullValues();
1325
- e = Object.assign({}, e, { allNullValues: d, indent: i, inFlow: m, type: null });
1326
- let y = false, h = false, g = this.items.reduce((M, A, C) => {
1327
- let L;
1328
- A && (!y && A.spaceBefore && M.push({ type: "comment", str: "" }), A.commentBefore && A.commentBefore.match(/^.*$/gm).forEach((Di) => {
1329
- M.push({ type: "comment", str: `#${Di}` });
1330
- }), A.comment && (L = A.comment), m && (!y && A.spaceBefore || A.commentBefore || A.comment || A.key && (A.key.commentBefore || A.key.comment) || A.value && (A.value.commentBefore || A.value.comment)) && (h = true)), y = false;
1331
- let R = f(A, e, () => L = null, () => y = true);
1332
- return m && !h && R.includes(`
1333
- `) && (h = true), m && C < this.items.length - 1 && (R += ","), R = Fe(R, i, L), y && (L || m) && (y = false), M.push({ type: "item", str: R }), M;
1334
- }, []), w;
1335
- if (g.length === 0) w = r.start + r.end;
1336
- else if (m) {
1337
- let { start: M, end: A } = r, C = g.map((L) => L.str);
1338
- if (h || C.reduce((L, R) => L + R.length + 2, 2) > t.maxFlowStringSingleLineLength) {
1339
- w = M;
1340
- for (let L of C) w += L ? `
1341
- ${l}${c}${L}` : `
1342
- `;
1343
- w += `
1344
- ${c}${A}`;
1345
- } else w = `${M} ${C.join(" ")} ${A}`;
1346
- } else {
1347
- let M = g.map(n);
1348
- w = M.shift();
1349
- for (let A of M) w += A ? `
1350
- ${c}${A}` : `
1351
- `;
1352
- }
1353
- return this.comment ? (w += `
1354
- ` + this.comment.replace(/^/gm, `${c}#`), o && o()) : y && a && a(), w;
1355
- }
1356
- };
1357
- p._defineProperty(W, "maxFlowStringSingleLineLength", 60);
1358
- function Dt(t) {
1359
- let e = t instanceof _ ? t.value : t;
1360
- return e && typeof e == "string" && (e = Number(e)), Number.isInteger(e) && e >= 0 ? e : null;
1361
- }
1362
- var le = class extends W {
1363
- add(e) {
1364
- this.items.push(e);
1365
- }
1366
- delete(e) {
1367
- let n = Dt(e);
1368
- return typeof n != "number" ? false : this.items.splice(n, 1).length > 0;
1369
- }
1370
- get(e, n) {
1371
- let r = Dt(e);
1372
- if (typeof r != "number") return;
1373
- let s = this.items[r];
1374
- return !n && s instanceof _ ? s.value : s;
1375
- }
1376
- has(e) {
1377
- let n = Dt(e);
1378
- return typeof n == "number" && n < this.items.length;
1379
- }
1380
- set(e, n) {
1381
- let r = Dt(e);
1382
- if (typeof r != "number") throw new Error(`Expected a valid index, not ${e}.`);
1383
- this.items[r] = n;
1384
- }
1385
- toJSON(e, n) {
1386
- let r = [];
1387
- n && n.onCreate && n.onCreate(r);
1388
- let s = 0;
1389
- for (let i of this.items) r.push(ce(i, String(s++), n));
1390
- return r;
1391
- }
1392
- toString(e, n, r) {
1393
- return e ? super.toString(e, { blockItem: (s) => s.type === "comment" ? s.str : `- ${s.str}`, flowChars: { start: "[", end: "]" }, isMap: false, itemIndent: (e.indent || "") + " " }, n, r) : JSON.stringify(this);
1394
- }
1395
- }, ko = (t, e, n) => e === null ? "" : typeof e != "object" ? String(e) : t instanceof j && n && n.doc ? t.toString({ anchors: /* @__PURE__ */ Object.create(null), doc: n.doc, indent: "", indentStep: n.indentStep, inFlow: true, inStringifyKey: true, stringify: n.stringify }) : JSON.stringify(e), T = class t extends j {
1396
- constructor(e, n = null) {
1397
- super(), this.key = e, this.value = n, this.type = t.Type.PAIR;
1398
- }
1399
- get commentBefore() {
1400
- return this.key instanceof j ? this.key.commentBefore : void 0;
1401
- }
1402
- set commentBefore(e) {
1403
- if (this.key == null && (this.key = new _(null)), this.key instanceof j) this.key.commentBefore = e;
1404
- else {
1405
- let n = "Pair.commentBefore is an alias for Pair.key.commentBefore. To set it, the key must be a Node.";
1406
- throw new Error(n);
1407
- }
1408
- }
1409
- addToJSMap(e, n) {
1410
- let r = ce(this.key, "", e);
1411
- if (n instanceof Map) {
1412
- let s = ce(this.value, r, e);
1413
- n.set(r, s);
1414
- } else if (n instanceof Set) n.add(r);
1415
- else {
1416
- let s = ko(this.key, r, e), i = ce(this.value, s, e);
1417
- s in n ? Object.defineProperty(n, s, { value: i, writable: true, enumerable: true, configurable: true }) : n[s] = i;
1418
- }
1419
- return n;
1420
- }
1421
- toJSON(e, n) {
1422
- let r = n && n.mapAsMap ? /* @__PURE__ */ new Map() : {};
1423
- return this.addToJSMap(n, r);
1424
- }
1425
- toString(e, n, r) {
1426
- if (!e || !e.doc) return JSON.stringify(this);
1427
- let { indent: s, indentSeq: i, simpleKeys: o } = e.doc.options, { key: a, value: c } = this, l = a instanceof j && a.comment;
1428
- if (o) {
1429
- if (l) throw new Error("With simple keys, key nodes cannot have comments");
1430
- if (a instanceof W) {
1431
- let R = "With simple keys, collection cannot be used as a key value";
1432
- throw new Error(R);
1433
- }
1434
- }
1435
- let f = !o && (!a || l || (a instanceof j ? a instanceof W || a.type === p.Type.BLOCK_FOLDED || a.type === p.Type.BLOCK_LITERAL : typeof a == "object")), { doc: m, indent: d, indentStep: y, stringify: h } = e;
1436
- e = Object.assign({}, e, { implicitKey: !f, indent: d + y });
1437
- let g = false, w = h(a, e, () => l = null, () => g = true);
1438
- if (w = Fe(w, e.indent, l), !f && w.length > 1024) {
1439
- if (o) throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
1440
- f = true;
1441
- }
1442
- if (e.allNullValues && !o) return this.comment ? (w = Fe(w, e.indent, this.comment), n && n()) : g && !l && r && r(), e.inFlow && !f ? w : `? ${w}`;
1443
- w = f ? `? ${w}
1444
- ${d}:` : `${w}:`, this.comment && (w = Fe(w, e.indent, this.comment), n && n());
1445
- let M = "", A = null;
1446
- if (c instanceof j) {
1447
- if (c.spaceBefore && (M = `
1448
- `), c.commentBefore) {
1449
- let R = c.commentBefore.replace(/^/gm, `${e.indent}#`);
1450
- M += `
1451
- ${R}`;
1452
- }
1453
- A = c.comment;
1454
- } else c && typeof c == "object" && (c = m.schema.createNode(c, true));
1455
- e.implicitKey = false, !f && !this.comment && c instanceof _ && (e.indentAtStart = w.length + 1), g = false, !i && s >= 2 && !e.inFlow && !f && c instanceof le && c.type !== p.Type.FLOW_SEQ && !c.tag && !m.anchors.getName(c) && (e.indent = e.indent.substr(2));
1456
- let C = h(c, e, () => A = null, () => g = true), L = " ";
1457
- return M || this.comment ? L = `${M}
1458
- ${e.indent}` : !f && c instanceof W ? (!(C[0] === "[" || C[0] === "{") || C.includes(`
1459
- `)) && (L = `
1460
- ${e.indent}`) : C[0] === `
1461
- ` && (L = ""), g && !A && r && r(), Fe(w + L + C, e.indent, A);
1462
- }
1463
- };
1464
- p._defineProperty(T, "Type", { PAIR: "PAIR", MERGE_PAIR: "MERGE_PAIR" });
1465
- var Yt = (t, e) => {
1466
- if (t instanceof be) {
1467
- let n = e.get(t.source);
1468
- return n.count * n.aliasCount;
1469
- } else if (t instanceof W) {
1470
- let n = 0;
1471
- for (let r of t.items) {
1472
- let s = Yt(r, e);
1473
- s > n && (n = s);
1474
- }
1475
- return n;
1476
- } else if (t instanceof T) {
1477
- let n = Yt(t.key, e), r = Yt(t.value, e);
1478
- return Math.max(n, r);
1479
- }
1480
- return 1;
1481
- }, be = class t extends j {
1482
- static stringify({ range: e, source: n }, { anchors: r, doc: s, implicitKey: i, inStringifyKey: o }) {
1483
- let a = Object.keys(r).find((l) => r[l] === n);
1484
- if (!a && o && (a = s.anchors.getName(n) || s.anchors.newName()), a) return `*${a}${i ? " " : ""}`;
1485
- let c = s.anchors.getName(n) ? "Alias node must be after source node" : "Source node not found for alias node";
1486
- throw new Error(`${c} [${e}]`);
1487
- }
1488
- constructor(e) {
1489
- super(), this.source = e, this.type = p.Type.ALIAS;
1490
- }
1491
- set tag(e) {
1492
- throw new Error("Alias nodes cannot have tags");
1493
- }
1494
- toJSON(e, n) {
1495
- if (!n) return ce(this.source, e, n);
1496
- let { anchors: r, maxAliasCount: s } = n, i = r.get(this.source);
1497
- if (!i || i.res === void 0) {
1498
- let o = "This should not happen: Alias anchor was not resolved?";
1499
- throw this.cstNode ? new p.YAMLReferenceError(this.cstNode, o) : new ReferenceError(o);
1500
- }
1501
- if (s >= 0 && (i.count += 1, i.aliasCount === 0 && (i.aliasCount = Yt(this.source, r)), i.count * i.aliasCount > s)) {
1502
- let o = "Excessive alias count indicates a resource exhaustion attack";
1503
- throw this.cstNode ? new p.YAMLReferenceError(this.cstNode, o) : new ReferenceError(o);
1504
- }
1505
- return i.res;
1506
- }
1507
- toString(e) {
1508
- return t.stringify(this, e);
1509
- }
1510
- };
1511
- p._defineProperty(be, "default", true);
1512
- function gt(t, e) {
1513
- let n = e instanceof _ ? e.value : e;
1514
- for (let r of t) if (r instanceof T && (r.key === e || r.key === n || r.key && r.key.value === n)) return r;
1515
- }
1516
- var dt = class extends W {
1517
- add(e, n) {
1518
- e ? e instanceof T || (e = new T(e.key || e, e.value)) : e = new T(e);
1519
- let r = gt(this.items, e.key), s = this.schema && this.schema.sortMapEntries;
1520
- if (r) if (n) r.value = e.value;
1521
- else throw new Error(`Key ${e.key} already set`);
1522
- else if (s) {
1523
- let i = this.items.findIndex((o) => s(e, o) < 0);
1524
- i === -1 ? this.items.push(e) : this.items.splice(i, 0, e);
1525
- } else this.items.push(e);
1526
- }
1527
- delete(e) {
1528
- let n = gt(this.items, e);
1529
- return n ? this.items.splice(this.items.indexOf(n), 1).length > 0 : false;
1530
- }
1531
- get(e, n) {
1532
- let r = gt(this.items, e), s = r && r.value;
1533
- return !n && s instanceof _ ? s.value : s;
1534
- }
1535
- has(e) {
1536
- return !!gt(this.items, e);
1537
- }
1538
- set(e, n) {
1539
- this.add(new T(e, n), true);
1540
- }
1541
- toJSON(e, n, r) {
1542
- let s = r ? new r() : n && n.mapAsMap ? /* @__PURE__ */ new Map() : {};
1543
- n && n.onCreate && n.onCreate(s);
1544
- for (let i of this.items) i.addToJSMap(n, s);
1545
- return s;
1546
- }
1547
- toString(e, n, r) {
1548
- if (!e) return JSON.stringify(this);
1549
- for (let s of this.items) if (!(s instanceof T)) throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);
1550
- return super.toString(e, { blockItem: (s) => s.str, flowChars: { start: "{", end: "}" }, isMap: true, itemIndent: e.indent || "" }, n, r);
1551
- }
1552
- }, as = "<<", Ft = class extends T {
1553
- constructor(e) {
1554
- if (e instanceof T) {
1555
- let n = e.value;
1556
- n instanceof le || (n = new le(), n.items.push(e.value), n.range = e.value.range), super(e.key, n), this.range = e.range;
1557
- } else super(new _(as), new le());
1558
- this.type = T.Type.MERGE_PAIR;
1559
- }
1560
- addToJSMap(e, n) {
1561
- for (let { source: r } of this.value.items) {
1562
- if (!(r instanceof dt)) throw new Error("Merge sources must be maps");
1563
- let s = r.toJSON(null, e, Map);
1564
- for (let [i, o] of s) n instanceof Map ? n.has(i) || n.set(i, o) : n instanceof Set ? n.add(i) : Object.prototype.hasOwnProperty.call(n, i) || Object.defineProperty(n, i, { value: o, writable: true, enumerable: true, configurable: true });
1565
- }
1566
- return n;
1567
- }
1568
- toString(e, n) {
1569
- let r = this.value;
1570
- if (r.items.length > 1) return super.toString(e, n);
1571
- this.value = r.items[0];
1572
- let s = super.toString(e, n);
1573
- return this.value = r, s;
1574
- }
1575
- }, Po = { defaultType: p.Type.BLOCK_LITERAL, lineWidth: 76 }, Io = { trueStr: "true", falseStr: "false" }, vo = { asBigInt: false }, _o = { nullStr: "null" }, Ne = { defaultType: p.Type.PLAIN, doubleQuoted: { jsonEncoding: false, minMultiLineLength: 40 }, fold: { lineWidth: 80, minContentWidth: 20 } };
1576
- function Un(t, e, n) {
1577
- for (let { format: r, test: s, resolve: i } of e) if (s) {
1578
- let o = t.match(s);
1579
- if (o) {
1580
- let a = i.apply(null, o);
1581
- return a instanceof _ || (a = new _(a)), r && (a.format = r), a;
1582
- }
1583
- }
1584
- return n && (t = n(t)), new _(t);
1585
- }
1586
- var cs = "flow", qn = "block", $t = "quoted", ss = (t, e) => {
1587
- let n = t[e + 1];
1588
- for (; n === " " || n === " "; ) {
1589
- do
1590
- n = t[e += 1];
1591
- while (n && n !== `
1592
- `);
1593
- n = t[e + 1];
1594
- }
1595
- return e;
1596
- };
1597
- function qt(t, e, n, { indentAtStart: r, lineWidth: s = 80, minContentWidth: i = 20, onFold: o, onOverflow: a }) {
1598
- if (!s || s < 0) return t;
1599
- let c = Math.max(1 + i, 1 + s - e.length);
1600
- if (t.length <= c) return t;
1601
- let l = [], f = {}, m = s - e.length;
1602
- typeof r == "number" && (r > s - Math.max(2, i) ? l.push(0) : m = s - r);
1603
- let d, y, h = false, g = -1, w = -1, M = -1;
1604
- n === qn && (g = ss(t, g), g !== -1 && (m = g + c));
1605
- for (let C; C = t[g += 1]; ) {
1606
- if (n === $t && C === "\\") {
1607
- switch (w = g, t[g + 1]) {
1608
- case "x":
1609
- g += 3;
1610
- break;
1611
- case "u":
1612
- g += 5;
1613
- break;
1614
- case "U":
1615
- g += 9;
1616
- break;
1617
- default:
1618
- g += 1;
1619
- }
1620
- M = g;
1621
- }
1622
- if (C === `
1623
- `) n === qn && (g = ss(t, g)), m = g + c, d = void 0;
1624
- else {
1625
- if (C === " " && y && y !== " " && y !== `
1626
- ` && y !== " ") {
1627
- let L = t[g + 1];
1628
- L && L !== " " && L !== `
1629
- ` && L !== " " && (d = g);
1630
- }
1631
- if (g >= m) if (d) l.push(d), m = d + c, d = void 0;
1632
- else if (n === $t) {
1633
- for (; y === " " || y === " "; ) y = C, C = t[g += 1], h = true;
1634
- let L = g > M + 1 ? g - 2 : w - 1;
1635
- if (f[L]) return t;
1636
- l.push(L), f[L] = true, m = L + c, d = void 0;
1637
- } else h = true;
1638
- }
1639
- y = C;
1640
- }
1641
- if (h && a && a(), l.length === 0) return t;
1642
- o && o();
1643
- let A = t.slice(0, l[0]);
1644
- for (let C = 0; C < l.length; ++C) {
1645
- let L = l[C], R = l[C + 1] || t.length;
1646
- L === 0 ? A = `
1647
- ${e}${t.slice(0, R)}` : (n === $t && f[L] && (A += `${t[L]}\\`), A += `
1648
- ${e}${t.slice(L + 1, R)}`);
1649
- }
1650
- return A;
1651
- }
1652
- var Kn = ({ indentAtStart: t }) => t ? Object.assign({ indentAtStart: t }, Ne.fold) : Ne.fold, Ut = (t) => /^(%|---|\.\.\.)/m.test(t);
1653
- function Ro(t, e, n) {
1654
- if (!e || e < 0) return false;
1655
- let r = e - n, s = t.length;
1656
- if (s <= r) return false;
1657
- for (let i = 0, o = 0; i < s; ++i) if (t[i] === `
1658
- `) {
1659
- if (i - o > r) return true;
1660
- if (o = i + 1, s - o <= r) return false;
1661
- }
1662
- return true;
1663
- }
1664
- function we(t, e) {
1665
- let { implicitKey: n } = e, { jsonEncoding: r, minMultiLineLength: s } = Ne.doubleQuoted, i = JSON.stringify(t);
1666
- if (r) return i;
1667
- let o = e.indent || (Ut(t) ? " " : ""), a = "", c = 0;
1668
- for (let l = 0, f = i[l]; f; f = i[++l]) if (f === " " && i[l + 1] === "\\" && i[l + 2] === "n" && (a += i.slice(c, l) + "\\ ", l += 1, c = l, f = "\\"), f === "\\") switch (i[l + 1]) {
1669
- case "u":
1670
- {
1671
- a += i.slice(c, l);
1672
- let m = i.substr(l + 2, 4);
1673
- switch (m) {
1674
- case "0000":
1675
- a += "\\0";
1676
- break;
1677
- case "0007":
1678
- a += "\\a";
1679
- break;
1680
- case "000b":
1681
- a += "\\v";
1682
- break;
1683
- case "001b":
1684
- a += "\\e";
1685
- break;
1686
- case "0085":
1687
- a += "\\N";
1688
- break;
1689
- case "00a0":
1690
- a += "\\_";
1691
- break;
1692
- case "2028":
1693
- a += "\\L";
1694
- break;
1695
- case "2029":
1696
- a += "\\P";
1697
- break;
1698
- default:
1699
- m.substr(0, 2) === "00" ? a += "\\x" + m.substr(2) : a += i.substr(l, 6);
1700
- }
1701
- l += 5, c = l + 1;
1702
- }
1703
- break;
1704
- case "n":
1705
- if (n || i[l + 2] === '"' || i.length < s) l += 1;
1706
- else {
1707
- for (a += i.slice(c, l) + `
1708
-
1709
- `; i[l + 2] === "\\" && i[l + 3] === "n" && i[l + 4] !== '"'; ) a += `
1710
- `, l += 2;
1711
- a += o, i[l + 2] === " " && (a += "\\"), l += 1, c = l + 1;
1712
- }
1713
- break;
1714
- default:
1715
- l += 1;
1716
- }
1717
- return a = c ? a + i.slice(c) : i, n ? a : qt(a, o, $t, Kn(e));
1718
- }
1719
- function ls(t, e) {
1720
- if (e.implicitKey) {
1721
- if (/\n/.test(t)) return we(t, e);
1722
- } else if (/[ \t]\n|\n[ \t]/.test(t)) return we(t, e);
1723
- let n = e.indent || (Ut(t) ? " " : ""), r = "'" + t.replace(/'/g, "''").replace(/\n+/g, `$&
1724
- ${n}`) + "'";
1725
- return e.implicitKey ? r : qt(r, n, cs, Kn(e));
1726
- }
1727
- function Bt({ comment: t, type: e, value: n }, r, s, i) {
1728
- if (/\n[\t ]+$/.test(n) || /^\s*$/.test(n)) return we(n, r);
1729
- let o = r.indent || (r.forceBlockIndent || Ut(n) ? " " : ""), a = o ? "2" : "1", c = e === p.Type.BLOCK_FOLDED ? false : e === p.Type.BLOCK_LITERAL ? true : !Ro(n, Ne.fold.lineWidth, o.length), l = c ? "|" : ">";
1730
- if (!n) return l + `
1731
- `;
1732
- let f = "", m = "";
1733
- if (n = n.replace(/[\n\t ]*$/, (y) => {
1734
- let h = y.indexOf(`
1735
- `);
1736
- return h === -1 ? l += "-" : (n === y || h !== y.length - 1) && (l += "+", i && i()), m = y.replace(/\n$/, ""), "";
1737
- }).replace(/^[\n ]*/, (y) => {
1738
- y.indexOf(" ") !== -1 && (l += a);
1739
- let h = y.match(/ +$/);
1740
- return h ? (f = y.slice(0, -h[0].length), h[0]) : (f = y, "");
1741
- }), m && (m = m.replace(/\n+(?!\n|$)/g, `$&${o}`)), f && (f = f.replace(/\n+/g, `$&${o}`)), t && (l += " #" + t.replace(/ ?[\r\n]+/g, " "), s && s()), !n) return `${l}${a}
1742
- ${o}${m}`;
1743
- if (c) return n = n.replace(/\n+/g, `$&${o}`), `${l}
1744
- ${o}${f}${n}${m}`;
1745
- n = n.replace(/\n+/g, `
1746
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${o}`);
1747
- let d = qt(`${f}${n}${m}`, o, qn, Ne.fold);
1748
- return `${l}
1749
- ${o}${d}`;
1750
- }
1751
- function xo(t, e, n, r) {
1752
- let { comment: s, type: i, value: o } = t, { actualString: a, implicitKey: c, indent: l, inFlow: f } = e;
1753
- if (c && /[\n[\]{},]/.test(o) || f && /[[\]{},]/.test(o)) return we(o, e);
1754
- if (!o || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o)) return c || f || o.indexOf(`
1755
- `) === -1 ? o.indexOf('"') !== -1 && o.indexOf("'") === -1 ? ls(o, e) : we(o, e) : Bt(t, e, n, r);
1756
- if (!c && !f && i !== p.Type.PLAIN && o.indexOf(`
1757
- `) !== -1) return Bt(t, e, n, r);
1758
- if (l === "" && Ut(o)) return e.forceBlockIndent = true, Bt(t, e, n, r);
1759
- let m = o.replace(/\n+/g, `$&
1760
- ${l}`);
1761
- if (a) {
1762
- let { tags: y } = e.doc.schema;
1763
- if (typeof Un(m, y, y.scalarFallback).value != "string") return we(o, e);
1764
- }
1765
- let d = c ? m : qt(m, l, cs, Kn(e));
1766
- return s && !f && (d.indexOf(`
1767
- `) !== -1 || s.indexOf(`
1768
- `) !== -1) ? (n && n(), Co(d, l, s)) : d;
1769
- }
1770
- function Do(t, e, n, r) {
1771
- let { defaultType: s } = Ne, { implicitKey: i, inFlow: o } = e, { type: a, value: c } = t;
1772
- typeof c != "string" && (c = String(c), t = Object.assign({}, t, { value: c }));
1773
- let l = (m) => {
1774
- switch (m) {
1775
- case p.Type.BLOCK_FOLDED:
1776
- case p.Type.BLOCK_LITERAL:
1777
- return Bt(t, e, n, r);
1778
- case p.Type.QUOTE_DOUBLE:
1779
- return we(c, e);
1780
- case p.Type.QUOTE_SINGLE:
1781
- return ls(c, e);
1782
- case p.Type.PLAIN:
1783
- return xo(t, e, n, r);
1784
- default:
1785
- return null;
1786
- }
1787
- };
1788
- (a !== p.Type.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(c) || (i || o) && (a === p.Type.BLOCK_FOLDED || a === p.Type.BLOCK_LITERAL)) && (a = p.Type.QUOTE_DOUBLE);
1789
- let f = l(a);
1790
- if (f === null && (f = l(s), f === null)) throw new Error(`Unsupported default string type ${s}`);
1791
- return f;
1792
- }
1793
- function Yo({ format: t, minFractionDigits: e, tag: n, value: r }) {
1794
- if (typeof r == "bigint") return String(r);
1795
- if (!isFinite(r)) return isNaN(r) ? ".nan" : r < 0 ? "-.inf" : ".inf";
1796
- let s = JSON.stringify(r);
1797
- if (!t && e && (!n || n === "tag:yaml.org,2002:float") && /^\d/.test(s)) {
1798
- let i = s.indexOf(".");
1799
- i < 0 && (i = s.length, s += ".");
1800
- let o = e - (s.length - i - 1);
1801
- for (; o-- > 0; ) s += "0";
1802
- }
1803
- return s;
1804
- }
1805
- function fs(t, e) {
1806
- let n, r;
1807
- switch (e.type) {
1808
- case p.Type.FLOW_MAP:
1809
- n = "}", r = "flow map";
1810
- break;
1811
- case p.Type.FLOW_SEQ:
1812
- n = "]", r = "flow sequence";
1813
- break;
1814
- default:
1815
- t.push(new p.YAMLSemanticError(e, "Not a flow collection!?"));
1816
- return;
1817
- }
1818
- let s;
1819
- for (let i = e.items.length - 1; i >= 0; --i) {
1820
- let o = e.items[i];
1821
- if (!o || o.type !== p.Type.COMMENT) {
1822
- s = o;
1823
- break;
1824
- }
1825
- }
1826
- if (s && s.char !== n) {
1827
- let i = `Expected ${r} to end with ${n}`, o;
1828
- typeof s.offset == "number" ? (o = new p.YAMLSemanticError(e, i), o.offset = s.offset + 1) : (o = new p.YAMLSemanticError(s, i), s.range && s.range.end && (o.offset = s.range.end - s.range.start)), t.push(o);
1829
- }
1830
- }
1831
- function us(t, e) {
1832
- let n = e.context.src[e.range.start - 1];
1833
- if (n !== `
1834
- ` && n !== " " && n !== " ") {
1835
- let r = "Comments must be separated from other tokens by white space characters";
1836
- t.push(new p.YAMLSemanticError(e, r));
1837
- }
1838
- }
1839
- function ps(t, e) {
1840
- let n = String(e), r = n.substr(0, 8) + "..." + n.substr(-8);
1841
- return new p.YAMLSemanticError(t, `The "${r}" key is too long`);
1842
- }
1843
- function ms(t, e) {
1844
- for (let { afterKey: n, before: r, comment: s } of e) {
1845
- let i = t.items[r];
1846
- i ? (n && i.value && (i = i.value), s === void 0 ? (n || !i.commentBefore) && (i.spaceBefore = true) : i.commentBefore ? i.commentBefore += `
1847
- ` + s : i.commentBefore = s) : s !== void 0 && (t.comment ? t.comment += `
1848
- ` + s : t.comment = s);
1849
- }
1850
- }
1851
- function Vn(t, e) {
1852
- let n = e.strValue;
1853
- return n ? typeof n == "string" ? n : (n.errors.forEach((r) => {
1854
- r.source || (r.source = e), t.errors.push(r);
1855
- }), n.str) : "";
1856
- }
1857
- function $o(t, e) {
1858
- let { handle: n, suffix: r } = e.tag, s = t.tagPrefixes.find((i) => i.handle === n);
1859
- if (!s) {
1860
- let i = t.getDefaults().tagPrefixes;
1861
- if (i && (s = i.find((o) => o.handle === n)), !s) throw new p.YAMLSemanticError(e, `The ${n} tag handle is non-default and was not declared.`);
1862
- }
1863
- if (!r) throw new p.YAMLSemanticError(e, `The ${n} tag has no suffix.`);
1864
- if (n === "!" && (t.version || t.options.version) === "1.0") {
1865
- if (r[0] === "^") return t.warnings.push(new p.YAMLWarning(e, "YAML 1.0 ^ tag expansion is not supported")), r;
1866
- if (/[:/]/.test(r)) {
1867
- let i = r.match(/^([a-z0-9-]+)\/(.*)/i);
1868
- return i ? `tag:${i[1]}.yaml.org,2002:${i[2]}` : `tag:${r}`;
1869
- }
1870
- }
1871
- return s.prefix + decodeURIComponent(r);
1872
- }
1873
- function Bo(t, e) {
1874
- let { tag: n, type: r } = e, s = false;
1875
- if (n) {
1876
- let { handle: i, suffix: o, verbatim: a } = n;
1877
- if (a) {
1878
- if (a !== "!" && a !== "!!") return a;
1879
- let c = `Verbatim tags aren't resolved, so ${a} is invalid.`;
1880
- t.errors.push(new p.YAMLSemanticError(e, c));
1881
- } else if (i === "!" && !o) s = true;
1882
- else try {
1883
- return $o(t, e);
1884
- } catch (c) {
1885
- t.errors.push(c);
1886
- }
1887
- }
1888
- switch (r) {
1889
- case p.Type.BLOCK_FOLDED:
1890
- case p.Type.BLOCK_LITERAL:
1891
- case p.Type.QUOTE_DOUBLE:
1892
- case p.Type.QUOTE_SINGLE:
1893
- return p.defaultTags.STR;
1894
- case p.Type.FLOW_MAP:
1895
- case p.Type.MAP:
1896
- return p.defaultTags.MAP;
1897
- case p.Type.FLOW_SEQ:
1898
- case p.Type.SEQ:
1899
- return p.defaultTags.SEQ;
1900
- case p.Type.PLAIN:
1901
- return s ? p.defaultTags.STR : null;
1902
- default:
1903
- return null;
1904
- }
1905
- }
1906
- function is(t, e, n) {
1907
- let { tags: r } = t.schema, s = [];
1908
- for (let o of r) if (o.tag === n) if (o.test) s.push(o);
1909
- else {
1910
- let a = o.resolve(t, e);
1911
- return a instanceof W ? a : new _(a);
1912
- }
1913
- let i = Vn(t, e);
1914
- return typeof i == "string" && s.length > 0 ? Un(i, s, r.scalarFallback) : null;
1915
- }
1916
- function Fo({ type: t }) {
1917
- switch (t) {
1918
- case p.Type.FLOW_MAP:
1919
- case p.Type.MAP:
1920
- return p.defaultTags.MAP;
1921
- case p.Type.FLOW_SEQ:
1922
- case p.Type.SEQ:
1923
- return p.defaultTags.SEQ;
1924
- default:
1925
- return p.defaultTags.STR;
1926
- }
1927
- }
1928
- function qo(t, e, n) {
1929
- try {
1930
- let r = is(t, e, n);
1931
- if (r) return n && e.tag && (r.tag = n), r;
1932
- } catch (r) {
1933
- return r.source || (r.source = e), t.errors.push(r), null;
1934
- }
1935
- try {
1936
- let r = Fo(e);
1937
- if (!r) throw new Error(`The tag ${n} is unavailable`);
1938
- let s = `The tag ${n} is unavailable, falling back to ${r}`;
1939
- t.warnings.push(new p.YAMLWarning(e, s));
1940
- let i = is(t, e, r);
1941
- return i.tag = n, i;
1942
- } catch (r) {
1943
- let s = new p.YAMLReferenceError(e, r.message);
1944
- return s.stack = r.stack, t.errors.push(s), null;
1945
- }
1946
- }
1947
- var Uo = (t) => {
1948
- if (!t) return false;
1949
- let { type: e } = t;
1950
- return e === p.Type.MAP_KEY || e === p.Type.MAP_VALUE || e === p.Type.SEQ_ITEM;
1951
- };
1952
- function Ko(t, e) {
1953
- let n = { before: [], after: [] }, r = false, s = false, i = Uo(e.context.parent) ? e.context.parent.props.concat(e.props) : e.props;
1954
- for (let { start: o, end: a } of i) switch (e.context.src[o]) {
1955
- case p.Char.COMMENT: {
1956
- if (!e.commentHasRequiredWhitespace(o)) {
1957
- let m = "Comments must be separated from other tokens by white space characters";
1958
- t.push(new p.YAMLSemanticError(e, m));
1959
- }
1960
- let { header: c, valueRange: l } = e;
1961
- (l && (o > l.start || c && o > c.start) ? n.after : n.before).push(e.context.src.slice(o + 1, a));
1962
- break;
1963
- }
1964
- case p.Char.ANCHOR:
1965
- if (r) {
1966
- let c = "A node can have at most one anchor";
1967
- t.push(new p.YAMLSemanticError(e, c));
1968
- }
1969
- r = true;
1970
- break;
1971
- case p.Char.TAG:
1972
- if (s) {
1973
- let c = "A node can have at most one tag";
1974
- t.push(new p.YAMLSemanticError(e, c));
1975
- }
1976
- s = true;
1977
- break;
1978
- }
1979
- return { comments: n, hasAnchor: r, hasTag: s };
1980
- }
1981
- function Vo(t, e) {
1982
- let { anchors: n, errors: r, schema: s } = t;
1983
- if (e.type === p.Type.ALIAS) {
1984
- let o = e.rawValue, a = n.getNode(o);
1985
- if (!a) {
1986
- let l = `Aliased anchor not found: ${o}`;
1987
- return r.push(new p.YAMLReferenceError(e, l)), null;
1988
- }
1989
- let c = new be(a);
1990
- return n._cstAliases.push(c), c;
1991
- }
1992
- let i = Bo(t, e);
1993
- if (i) return qo(t, e, i);
1994
- if (e.type !== p.Type.PLAIN) {
1995
- let o = `Failed to resolve ${e.type} node here`;
1996
- return r.push(new p.YAMLSyntaxError(e, o)), null;
1997
- }
1998
- try {
1999
- let o = Vn(t, e);
2000
- return Un(o, s.tags, s.tags.scalarFallback);
2001
- } catch (o) {
2002
- return o.source || (o.source = e), r.push(o), null;
2003
- }
2004
- }
2005
- function fe(t, e) {
2006
- if (!e) return null;
2007
- e.error && t.errors.push(e.error);
2008
- let { comments: n, hasAnchor: r, hasTag: s } = Ko(t.errors, e);
2009
- if (r) {
2010
- let { anchors: o } = t, a = e.anchor, c = o.getNode(a);
2011
- c && (o.map[o.newName(a)] = c), o.map[a] = e;
2012
- }
2013
- if (e.type === p.Type.ALIAS && (r || s)) {
2014
- let o = "An alias node must not specify any properties";
2015
- t.errors.push(new p.YAMLSemanticError(e, o));
2016
- }
2017
- let i = Vo(t, e);
2018
- if (i) {
2019
- i.range = [e.range.start, e.range.end], t.options.keepCstNodes && (i.cstNode = e), t.options.keepNodeTypes && (i.type = e.type);
2020
- let o = n.before.join(`
2021
- `);
2022
- o && (i.commentBefore = i.commentBefore ? `${i.commentBefore}
2023
- ${o}` : o);
2024
- let a = n.after.join(`
2025
- `);
2026
- a && (i.comment = i.comment ? `${i.comment}
2027
- ${a}` : a);
2028
- }
2029
- return e.resolved = i;
2030
- }
2031
- function jo(t, e) {
2032
- if (e.type !== p.Type.MAP && e.type !== p.Type.FLOW_MAP) {
2033
- let o = `A ${e.type} node cannot be resolved as a mapping`;
2034
- return t.errors.push(new p.YAMLSyntaxError(e, o)), null;
2035
- }
2036
- let { comments: n, items: r } = e.type === p.Type.FLOW_MAP ? Ho(t, e) : Go(t, e), s = new dt();
2037
- s.items = r, ms(s, n);
2038
- let i = false;
2039
- for (let o = 0; o < r.length; ++o) {
2040
- let { key: a } = r[o];
2041
- if (a instanceof W && (i = true), t.schema.merge && a && a.value === as) {
2042
- r[o] = new Ft(r[o]);
2043
- let c = r[o].value.items, l = null;
2044
- c.some((f) => {
2045
- if (f instanceof be) {
2046
- let { type: m } = f.source;
2047
- return m === p.Type.MAP || m === p.Type.FLOW_MAP ? false : l = "Merge nodes aliases can only point to maps";
2048
- }
2049
- return l = "Merge nodes can only have Alias nodes as values";
2050
- }), l && t.errors.push(new p.YAMLSemanticError(e, l));
2051
- } else for (let c = o + 1; c < r.length; ++c) {
2052
- let { key: l } = r[c];
2053
- if (a === l || a && l && Object.prototype.hasOwnProperty.call(a, "value") && a.value === l.value) {
2054
- let f = `Map keys must be unique; "${a}" is repeated`;
2055
- t.errors.push(new p.YAMLSemanticError(e, f));
2056
- break;
2057
- }
2058
- }
2059
- }
2060
- if (i && !t.options.mapAsMap) {
2061
- let o = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.";
2062
- t.warnings.push(new p.YAMLWarning(e, o));
2063
- }
2064
- return e.resolved = s, s;
2065
- }
2066
- var Wo = ({ context: { lineStart: t, node: e, src: n }, props: r }) => {
2067
- if (r.length === 0) return false;
2068
- let { start: s } = r[0];
2069
- if (e && s > e.valueRange.start || n[s] !== p.Char.COMMENT) return false;
2070
- for (let i = t; i < s; ++i) if (n[i] === `
2071
- `) return false;
2072
- return true;
2073
- };
2074
- function Qo(t, e) {
2075
- if (!Wo(t)) return;
2076
- let n = t.getPropValue(0, p.Char.COMMENT, true), r = false, s = e.value.commentBefore;
2077
- if (s && s.startsWith(n)) e.value.commentBefore = s.substr(n.length + 1), r = true;
2078
- else {
2079
- let i = e.value.comment;
2080
- !t.node && i && i.startsWith(n) && (e.value.comment = i.substr(n.length + 1), r = true);
2081
- }
2082
- r && (e.comment = n);
2083
- }
2084
- function Go(t, e) {
2085
- let n = [], r = [], s, i = null;
2086
- for (let o = 0; o < e.items.length; ++o) {
2087
- let a = e.items[o];
2088
- switch (a.type) {
2089
- case p.Type.BLANK_LINE:
2090
- n.push({ afterKey: !!s, before: r.length });
2091
- break;
2092
- case p.Type.COMMENT:
2093
- n.push({ afterKey: !!s, before: r.length, comment: a.comment });
2094
- break;
2095
- case p.Type.MAP_KEY:
2096
- s !== void 0 && r.push(new T(s)), a.error && t.errors.push(a.error), s = fe(t, a.node), i = null;
2097
- break;
2098
- case p.Type.MAP_VALUE:
2099
- {
2100
- if (s === void 0 && (s = null), a.error && t.errors.push(a.error), !a.context.atLineStart && a.node && a.node.type === p.Type.MAP && !a.node.context.atLineStart) {
2101
- let f = "Nested mappings are not allowed in compact mappings";
2102
- t.errors.push(new p.YAMLSemanticError(a.node, f));
2103
- }
2104
- let c = a.node;
2105
- if (!c && a.props.length > 0) {
2106
- c = new p.PlainValue(p.Type.PLAIN, []), c.context = { parent: a, src: a.context.src };
2107
- let f = a.range.start + 1;
2108
- if (c.range = { start: f, end: f }, c.valueRange = { start: f, end: f }, typeof a.range.origStart == "number") {
2109
- let m = a.range.origStart + 1;
2110
- c.range.origStart = c.range.origEnd = m, c.valueRange.origStart = c.valueRange.origEnd = m;
2111
- }
2112
- }
2113
- let l = new T(s, fe(t, c));
2114
- Qo(a, l), r.push(l), s && typeof i == "number" && a.range.start > i + 1024 && t.errors.push(ps(e, s)), s = void 0, i = null;
2115
- }
2116
- break;
2117
- default:
2118
- s !== void 0 && r.push(new T(s)), s = fe(t, a), i = a.range.start, a.error && t.errors.push(a.error);
2119
- e: for (let c = o + 1; ; ++c) {
2120
- let l = e.items[c];
2121
- switch (l && l.type) {
2122
- case p.Type.BLANK_LINE:
2123
- case p.Type.COMMENT:
2124
- continue e;
2125
- case p.Type.MAP_VALUE:
2126
- break e;
2127
- default: {
2128
- let f = "Implicit map keys need to be followed by map values";
2129
- t.errors.push(new p.YAMLSemanticError(a, f));
2130
- break e;
2131
- }
2132
- }
2133
- }
2134
- if (a.valueRangeContainsNewline) {
2135
- let c = "Implicit map keys need to be on a single line";
2136
- t.errors.push(new p.YAMLSemanticError(a, c));
2137
- }
2138
- }
2139
- }
2140
- return s !== void 0 && r.push(new T(s)), { comments: n, items: r };
2141
- }
2142
- function Ho(t, e) {
2143
- let n = [], r = [], s, i = false, o = "{";
2144
- for (let a = 0; a < e.items.length; ++a) {
2145
- let c = e.items[a];
2146
- if (typeof c.char == "string") {
2147
- let { char: l, offset: f } = c;
2148
- if (l === "?" && s === void 0 && !i) {
2149
- i = true, o = ":";
2150
- continue;
2151
- }
2152
- if (l === ":") {
2153
- if (s === void 0 && (s = null), o === ":") {
2154
- o = ",";
2155
- continue;
2156
- }
2157
- } else if (i && (s === void 0 && l !== "," && (s = null), i = false), s !== void 0 && (r.push(new T(s)), s = void 0, l === ",")) {
2158
- o = ":";
2159
- continue;
2160
- }
2161
- if (l === "}") {
2162
- if (a === e.items.length - 1) continue;
2163
- } else if (l === o) {
2164
- o = ":";
2165
- continue;
2166
- }
2167
- let m = `Flow map contains an unexpected ${l}`, d = new p.YAMLSyntaxError(e, m);
2168
- d.offset = f, t.errors.push(d);
2169
- } else c.type === p.Type.BLANK_LINE ? n.push({ afterKey: !!s, before: r.length }) : c.type === p.Type.COMMENT ? (us(t.errors, c), n.push({ afterKey: !!s, before: r.length, comment: c.comment })) : s === void 0 ? (o === "," && t.errors.push(new p.YAMLSemanticError(c, "Separator , missing in flow map")), s = fe(t, c)) : (o !== "," && t.errors.push(new p.YAMLSemanticError(c, "Indicator : missing in flow map entry")), r.push(new T(s, fe(t, c))), s = void 0, i = false);
2170
- }
2171
- return fs(t.errors, e), s !== void 0 && r.push(new T(s)), { comments: n, items: r };
2172
- }
2173
- function Jo(t, e) {
2174
- if (e.type !== p.Type.SEQ && e.type !== p.Type.FLOW_SEQ) {
2175
- let i = `A ${e.type} node cannot be resolved as a sequence`;
2176
- return t.errors.push(new p.YAMLSyntaxError(e, i)), null;
2177
- }
2178
- let { comments: n, items: r } = e.type === p.Type.FLOW_SEQ ? zo(t, e) : Xo(t, e), s = new le();
2179
- if (s.items = r, ms(s, n), !t.options.mapAsMap && r.some((i) => i instanceof T && i.key instanceof W)) {
2180
- let i = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.";
2181
- t.warnings.push(new p.YAMLWarning(e, i));
2182
- }
2183
- return e.resolved = s, s;
2184
- }
2185
- function Xo(t, e) {
2186
- let n = [], r = [];
2187
- for (let s = 0; s < e.items.length; ++s) {
2188
- let i = e.items[s];
2189
- switch (i.type) {
2190
- case p.Type.BLANK_LINE:
2191
- n.push({ before: r.length });
2192
- break;
2193
- case p.Type.COMMENT:
2194
- n.push({ comment: i.comment, before: r.length });
2195
- break;
2196
- case p.Type.SEQ_ITEM:
2197
- if (i.error && t.errors.push(i.error), r.push(fe(t, i.node)), i.hasProps) {
2198
- let o = "Sequence items cannot have tags or anchors before the - indicator";
2199
- t.errors.push(new p.YAMLSemanticError(i, o));
2200
- }
2201
- break;
2202
- default:
2203
- i.error && t.errors.push(i.error), t.errors.push(new p.YAMLSyntaxError(i, `Unexpected ${i.type} node in sequence`));
2204
- }
2205
- }
2206
- return { comments: n, items: r };
2207
- }
2208
- function zo(t, e) {
2209
- let n = [], r = [], s = false, i, o = null, a = "[", c = null;
2210
- for (let l = 0; l < e.items.length; ++l) {
2211
- let f = e.items[l];
2212
- if (typeof f.char == "string") {
2213
- let { char: m, offset: d } = f;
2214
- if (m !== ":" && (s || i !== void 0) && (s && i === void 0 && (i = a ? r.pop() : null), r.push(new T(i)), s = false, i = void 0, o = null), m === a) a = null;
2215
- else if (!a && m === "?") s = true;
2216
- else if (a !== "[" && m === ":" && i === void 0) {
2217
- if (a === ",") {
2218
- if (i = r.pop(), i instanceof T) {
2219
- let y = "Chaining flow sequence pairs is invalid", h = new p.YAMLSemanticError(e, y);
2220
- h.offset = d, t.errors.push(h);
2221
- }
2222
- if (!s && typeof o == "number") {
2223
- let y = f.range ? f.range.start : f.offset;
2224
- y > o + 1024 && t.errors.push(ps(e, i));
2225
- let { src: h } = c.context;
2226
- for (let g = o; g < y; ++g) if (h[g] === `
2227
- `) {
2228
- let w = "Implicit keys of flow sequence pairs need to be on a single line";
2229
- t.errors.push(new p.YAMLSemanticError(c, w));
2230
- break;
2231
- }
2232
- }
2233
- } else i = null;
2234
- o = null, s = false, a = null;
2235
- } else if (a === "[" || m !== "]" || l < e.items.length - 1) {
2236
- let y = `Flow sequence contains an unexpected ${m}`, h = new p.YAMLSyntaxError(e, y);
2237
- h.offset = d, t.errors.push(h);
2238
- }
2239
- } else if (f.type === p.Type.BLANK_LINE) n.push({ before: r.length });
2240
- else if (f.type === p.Type.COMMENT) us(t.errors, f), n.push({ comment: f.comment, before: r.length });
2241
- else {
2242
- if (a) {
2243
- let d = `Expected a ${a} in flow sequence`;
2244
- t.errors.push(new p.YAMLSemanticError(f, d));
2245
- }
2246
- let m = fe(t, f);
2247
- i === void 0 ? (r.push(m), c = f) : (r.push(new T(i, m)), i = void 0), o = f.range.start, a = ",";
2248
- }
2249
- }
2250
- return fs(t.errors, e), i !== void 0 && r.push(new T(i)), { comments: n, items: r };
2251
- }
2252
- k.Alias = be;
2253
- k.Collection = W;
2254
- k.Merge = Ft;
2255
- k.Node = j;
2256
- k.Pair = T;
2257
- k.Scalar = _;
2258
- k.YAMLMap = dt;
2259
- k.YAMLSeq = le;
2260
- k.addComment = Fe;
2261
- k.binaryOptions = Po;
2262
- k.boolOptions = Io;
2263
- k.findPair = gt;
2264
- k.intOptions = vo;
2265
- k.isEmptyPath = os;
2266
- k.nullOptions = _o;
2267
- k.resolveMap = jo;
2268
- k.resolveNode = fe;
2269
- k.resolveSeq = Jo;
2270
- k.resolveString = Vn;
2271
- k.strOptions = Ne;
2272
- k.stringifyNumber = Yo;
2273
- k.stringifyString = Do;
2274
- k.toJSON = ce;
2275
- });
2276
- var Gn = te((z) => {
2277
- "use strict";
2278
- var Q = oe(), O = qe(), Zo = { identify: (t) => t instanceof Uint8Array, default: false, tag: "tag:yaml.org,2002:binary", resolve: (t, e) => {
2279
- let n = O.resolveString(t, e);
2280
- if (typeof Buffer == "function") return Buffer.from(n, "base64");
2281
- if (typeof atob == "function") {
2282
- let r = atob(n.replace(/[\n\r]/g, "")), s = new Uint8Array(r.length);
2283
- for (let i = 0; i < r.length; ++i) s[i] = r.charCodeAt(i);
2284
- return s;
2285
- } else {
2286
- let r = "This environment does not support reading binary tags; either Buffer or atob is required";
2287
- return t.errors.push(new Q.YAMLReferenceError(e, r)), null;
2288
- }
2289
- }, options: O.binaryOptions, stringify: ({ comment: t, type: e, value: n }, r, s, i) => {
2290
- let o;
2291
- if (typeof Buffer == "function") o = n instanceof Buffer ? n.toString("base64") : Buffer.from(n.buffer).toString("base64");
2292
- else if (typeof btoa == "function") {
2293
- let a = "";
2294
- for (let c = 0; c < n.length; ++c) a += String.fromCharCode(n[c]);
2295
- o = btoa(a);
2296
- } else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
2297
- if (e || (e = O.binaryOptions.defaultType), e === Q.Type.QUOTE_DOUBLE) n = o;
2298
- else {
2299
- let { lineWidth: a } = O.binaryOptions, c = Math.ceil(o.length / a), l = new Array(c);
2300
- for (let f = 0, m = 0; f < c; ++f, m += a) l[f] = o.substr(m, a);
2301
- n = l.join(e === Q.Type.BLOCK_LITERAL ? `
2302
- ` : " ");
2303
- }
2304
- return O.stringifyString({ comment: t, type: e, value: n }, r, s, i);
2305
- } };
2306
- function gs(t, e) {
2307
- let n = O.resolveSeq(t, e);
2308
- for (let r = 0; r < n.items.length; ++r) {
2309
- let s = n.items[r];
2310
- if (!(s instanceof O.Pair)) {
2311
- if (s instanceof O.YAMLMap) {
2312
- if (s.items.length > 1) {
2313
- let o = "Each pair must have its own sequence indicator";
2314
- throw new Q.YAMLSemanticError(e, o);
2315
- }
2316
- let i = s.items[0] || new O.Pair();
2317
- s.commentBefore && (i.commentBefore = i.commentBefore ? `${s.commentBefore}
2318
- ${i.commentBefore}` : s.commentBefore), s.comment && (i.comment = i.comment ? `${s.comment}
2319
- ${i.comment}` : s.comment), s = i;
2320
- }
2321
- n.items[r] = s instanceof O.Pair ? s : new O.Pair(s);
2322
- }
2323
- }
2324
- return n;
2325
- }
2326
- function ds(t, e, n) {
2327
- let r = new O.YAMLSeq(t);
2328
- r.tag = "tag:yaml.org,2002:pairs";
2329
- for (let s of e) {
2330
- let i, o;
2331
- if (Array.isArray(s)) if (s.length === 2) i = s[0], o = s[1];
2332
- else throw new TypeError(`Expected [key, value] tuple: ${s}`);
2333
- else if (s && s instanceof Object) {
2334
- let c = Object.keys(s);
2335
- if (c.length === 1) i = c[0], o = s[i];
2336
- else throw new TypeError(`Expected { key: value } tuple: ${s}`);
2337
- } else i = s;
2338
- let a = t.createPair(i, o, n);
2339
- r.items.push(a);
2340
- }
2341
- return r;
2342
- }
2343
- var ea = { default: false, tag: "tag:yaml.org,2002:pairs", resolve: gs, createNode: ds }, Ue = class t extends O.YAMLSeq {
2344
- constructor() {
2345
- super(), Q._defineProperty(this, "add", O.YAMLMap.prototype.add.bind(this)), Q._defineProperty(this, "delete", O.YAMLMap.prototype.delete.bind(this)), Q._defineProperty(this, "get", O.YAMLMap.prototype.get.bind(this)), Q._defineProperty(this, "has", O.YAMLMap.prototype.has.bind(this)), Q._defineProperty(this, "set", O.YAMLMap.prototype.set.bind(this)), this.tag = t.tag;
2346
- }
2347
- toJSON(e, n) {
2348
- let r = /* @__PURE__ */ new Map();
2349
- n && n.onCreate && n.onCreate(r);
2350
- for (let s of this.items) {
2351
- let i, o;
2352
- if (s instanceof O.Pair ? (i = O.toJSON(s.key, "", n), o = O.toJSON(s.value, i, n)) : i = O.toJSON(s, "", n), r.has(i)) throw new Error("Ordered maps must not include duplicate keys");
2353
- r.set(i, o);
2354
- }
2355
- return r;
2356
- }
2357
- };
2358
- Q._defineProperty(Ue, "tag", "tag:yaml.org,2002:omap");
2359
- function ta(t, e) {
2360
- let n = gs(t, e), r = [];
2361
- for (let { key: s } of n.items) if (s instanceof O.Scalar) if (r.includes(s.value)) {
2362
- let i = "Ordered maps must not include duplicate keys";
2363
- throw new Q.YAMLSemanticError(e, i);
2364
- } else r.push(s.value);
2365
- return Object.assign(new Ue(), n);
2366
- }
2367
- function na(t, e, n) {
2368
- let r = ds(t, e, n), s = new Ue();
2369
- return s.items = r.items, s;
2370
- }
2371
- var ra = { identify: (t) => t instanceof Map, nodeClass: Ue, default: false, tag: "tag:yaml.org,2002:omap", resolve: ta, createNode: na }, Ke = class t extends O.YAMLMap {
2372
- constructor() {
2373
- super(), this.tag = t.tag;
2374
- }
2375
- add(e) {
2376
- let n = e instanceof O.Pair ? e : new O.Pair(e);
2377
- O.findPair(this.items, n.key) || this.items.push(n);
2378
- }
2379
- get(e, n) {
2380
- let r = O.findPair(this.items, e);
2381
- return !n && r instanceof O.Pair ? r.key instanceof O.Scalar ? r.key.value : r.key : r;
2382
- }
2383
- set(e, n) {
2384
- if (typeof n != "boolean") throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);
2385
- let r = O.findPair(this.items, e);
2386
- r && !n ? this.items.splice(this.items.indexOf(r), 1) : !r && n && this.items.push(new O.Pair(e));
2387
- }
2388
- toJSON(e, n) {
2389
- return super.toJSON(e, n, Set);
2390
- }
2391
- toString(e, n, r) {
2392
- if (!e) return JSON.stringify(this);
2393
- if (this.hasAllNullValues()) return super.toString(e, n, r);
2394
- throw new Error("Set items must all have null values");
2395
- }
2396
- };
2397
- Q._defineProperty(Ke, "tag", "tag:yaml.org,2002:set");
2398
- function sa(t, e) {
2399
- let n = O.resolveMap(t, e);
2400
- if (!n.hasAllNullValues()) throw new Q.YAMLSemanticError(e, "Set items must all have null values");
2401
- return Object.assign(new Ke(), n);
2402
- }
2403
- function ia(t, e, n) {
2404
- let r = new Ke();
2405
- for (let s of e) r.items.push(t.createPair(s, null, n));
2406
- return r;
2407
- }
2408
- var oa = { identify: (t) => t instanceof Set, nodeClass: Ke, default: false, tag: "tag:yaml.org,2002:set", resolve: sa, createNode: ia }, jn = (t, e) => {
2409
- let n = e.split(":").reduce((r, s) => r * 60 + Number(s), 0);
2410
- return t === "-" ? -n : n;
2411
- }, ys = ({ value: t }) => {
2412
- if (isNaN(t) || !isFinite(t)) return O.stringifyNumber(t);
2413
- let e = "";
2414
- t < 0 && (e = "-", t = Math.abs(t));
2415
- let n = [t % 60];
2416
- return t < 60 ? n.unshift(0) : (t = Math.round((t - n[0]) / 60), n.unshift(t % 60), t >= 60 && (t = Math.round((t - n[0]) / 60), n.unshift(t))), e + n.map((r) => r < 10 ? "0" + String(r) : String(r)).join(":").replace(/000000\d*$/, "");
2417
- }, aa = { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:int", format: "TIME", test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/, resolve: (t, e, n) => jn(e, n.replace(/_/g, "")), stringify: ys }, ca = { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", format: "TIME", test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/, resolve: (t, e, n) => jn(e, n.replace(/_/g, "")), stringify: ys }, la = { identify: (t) => t instanceof Date, default: true, tag: "tag:yaml.org,2002:timestamp", 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})?))?)?)$"), resolve: (t, e, n, r, s, i, o, a, c) => {
2418
- a && (a = (a + "00").substr(1, 3));
2419
- let l = Date.UTC(e, n - 1, r, s || 0, i || 0, o || 0, a || 0);
2420
- if (c && c !== "Z") {
2421
- let f = jn(c[0], c.slice(1));
2422
- Math.abs(f) < 30 && (f *= 60), l -= 6e4 * f;
2423
- }
2424
- return new Date(l);
2425
- }, stringify: ({ value: t }) => t.toISOString().replace(/((T00:00)?:00)?\.000Z$/, "") };
2426
- function Wn(t) {
2427
- let e = {};
2428
- return t ? typeof YAML_SILENCE_DEPRECATION_WARNINGS < "u" ? !YAML_SILENCE_DEPRECATION_WARNINGS : !e.YAML_SILENCE_DEPRECATION_WARNINGS : typeof YAML_SILENCE_WARNINGS < "u" ? !YAML_SILENCE_WARNINGS : !e.YAML_SILENCE_WARNINGS;
2429
- }
2430
- function Qn(t, e) {
2431
- Wn(false) && console.warn(e ? `${e}: ${t}` : t);
2432
- }
2433
- function fa(t) {
2434
- if (Wn(true)) {
2435
- let e = t.replace(/.*yaml[/\\]/i, "").replace(/\.js$/, "").replace(/\\/g, "/");
2436
- Qn(`The endpoint 'yaml/${e}' will be removed in a future release.`, "DeprecationWarning");
2437
- }
2438
- }
2439
- var hs = {};
2440
- function ua(t, e) {
2441
- if (!hs[t] && Wn(true)) {
2442
- hs[t] = true;
2443
- let n = `The option '${t}' will be removed in a future release`;
2444
- n += e ? `, use '${e}' instead.` : ".", Qn(n, "DeprecationWarning");
2445
- }
2446
- }
2447
- z.binary = Zo;
2448
- z.floatTime = ca;
2449
- z.intTime = aa;
2450
- z.omap = ra;
2451
- z.pairs = ea;
2452
- z.set = oa;
2453
- z.timestamp = la;
2454
- z.warn = Qn;
2455
- z.warnFileDeprecation = fa;
2456
- z.warnOptionDeprecation = ua;
2457
- });
2458
- var zn = te((Ps) => {
2459
- "use strict";
2460
- var jt = oe(), E = qe(), D = Gn();
2461
- function pa(t, e, n) {
2462
- let r = new E.YAMLMap(t);
2463
- if (e instanceof Map) for (let [s, i] of e) r.items.push(t.createPair(s, i, n));
2464
- else if (e && typeof e == "object") for (let s of Object.keys(e)) r.items.push(t.createPair(s, e[s], n));
2465
- return typeof t.sortMapEntries == "function" && r.items.sort(t.sortMapEntries), r;
2466
- }
2467
- var Et = { createNode: pa, default: true, nodeClass: E.YAMLMap, tag: "tag:yaml.org,2002:map", resolve: E.resolveMap };
2468
- function ma(t, e, n) {
2469
- let r = new E.YAMLSeq(t);
2470
- if (e && e[Symbol.iterator]) for (let s of e) {
2471
- let i = t.createNode(s, n.wrapScalars, null, n);
2472
- r.items.push(i);
2473
- }
2474
- return r;
2475
- }
2476
- var Wt = { createNode: ma, default: true, nodeClass: E.YAMLSeq, tag: "tag:yaml.org,2002:seq", resolve: E.resolveSeq }, ha = { identify: (t) => typeof t == "string", default: true, tag: "tag:yaml.org,2002:str", resolve: E.resolveString, stringify(t, e, n, r) {
2477
- return e = Object.assign({ actualString: true }, e), E.stringifyString(t, e, n, r);
2478
- }, options: E.strOptions }, Jn = [Et, Wt, ha], Qt = (t) => typeof t == "bigint" || Number.isInteger(t), Xn = (t, e, n) => E.intOptions.asBigInt ? BigInt(t) : parseInt(e, n);
2479
- function ws(t, e, n) {
2480
- let { value: r } = t;
2481
- return Qt(r) && r >= 0 ? n + r.toString(e) : E.stringifyNumber(t);
2482
- }
2483
- var bs = { identify: (t) => t == null, createNode: (t, e, n) => n.wrapScalars ? new E.Scalar(null) : null, default: true, tag: "tag:yaml.org,2002:null", test: /^(?:~|[Nn]ull|NULL)?$/, resolve: () => null, options: E.nullOptions, stringify: () => E.nullOptions.nullStr }, Ns = { identify: (t) => typeof t == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/, resolve: (t) => t[0] === "t" || t[0] === "T", options: E.boolOptions, stringify: ({ value: t }) => t ? E.boolOptions.trueStr : E.boolOptions.falseStr }, Os = { identify: (t) => Qt(t) && t >= 0, default: true, tag: "tag:yaml.org,2002:int", format: "OCT", test: /^0o([0-7]+)$/, resolve: (t, e) => Xn(t, e, 8), options: E.intOptions, stringify: (t) => ws(t, 8, "0o") }, As = { identify: Qt, default: true, tag: "tag:yaml.org,2002:int", test: /^[-+]?[0-9]+$/, resolve: (t) => Xn(t, t, 10), options: E.intOptions, stringify: E.stringifyNumber }, Ls = { identify: (t) => Qt(t) && t >= 0, default: true, tag: "tag:yaml.org,2002:int", format: "HEX", test: /^0x([0-9a-fA-F]+)$/, resolve: (t, e) => Xn(t, e, 16), options: E.intOptions, stringify: (t) => ws(t, 16, "0x") }, Ts = { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^(?:[-+]?\.inf|(\.nan))$/i, resolve: (t, e) => e ? NaN : t[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, stringify: E.stringifyNumber }, Ms = { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", format: "EXP", test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/, resolve: (t) => parseFloat(t), stringify: ({ value: t }) => Number(t).toExponential() }, Cs = { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/, resolve(t, e, n) {
2484
- let r = e || n, s = new E.Scalar(parseFloat(t));
2485
- return r && r[r.length - 1] === "0" && (s.minFractionDigits = r.length), s;
2486
- }, stringify: E.stringifyNumber }, ga = Jn.concat([bs, Ns, Os, As, Ls, Ts, Ms, Cs]), Es = (t) => typeof t == "bigint" || Number.isInteger(t), Kt = ({ value: t }) => JSON.stringify(t), ks = [Et, Wt, { identify: (t) => typeof t == "string", default: true, tag: "tag:yaml.org,2002:str", resolve: E.resolveString, stringify: Kt }, { identify: (t) => t == null, createNode: (t, e, n) => n.wrapScalars ? new E.Scalar(null) : null, default: true, tag: "tag:yaml.org,2002:null", test: /^null$/, resolve: () => null, stringify: Kt }, { identify: (t) => typeof t == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^true|false$/, resolve: (t) => t === "true", stringify: Kt }, { identify: Es, default: true, tag: "tag:yaml.org,2002:int", test: /^-?(?:0|[1-9][0-9]*)$/, resolve: (t) => E.intOptions.asBigInt ? BigInt(t) : parseInt(t, 10), stringify: ({ value: t }) => Es(t) ? t.toString() : JSON.stringify(t) }, { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/, resolve: (t) => parseFloat(t), stringify: Kt }];
2487
- ks.scalarFallback = (t) => {
2488
- throw new SyntaxError(`Unresolved plain scalar ${JSON.stringify(t)}`);
2489
- };
2490
- var Ss = ({ value: t }) => t ? E.boolOptions.trueStr : E.boolOptions.falseStr, yt = (t) => typeof t == "bigint" || Number.isInteger(t);
2491
- function Vt(t, e, n) {
2492
- let r = e.replace(/_/g, "");
2493
- if (E.intOptions.asBigInt) {
2494
- switch (n) {
2495
- case 2:
2496
- r = `0b${r}`;
2497
- break;
2498
- case 8:
2499
- r = `0o${r}`;
2500
- break;
2501
- case 16:
2502
- r = `0x${r}`;
2503
- break;
2504
- }
2505
- let i = BigInt(r);
2506
- return t === "-" ? BigInt(-1) * i : i;
2507
- }
2508
- let s = parseInt(r, n);
2509
- return t === "-" ? -1 * s : s;
2510
- }
2511
- function Hn(t, e, n) {
2512
- let { value: r } = t;
2513
- if (yt(r)) {
2514
- let s = r.toString(e);
2515
- return r < 0 ? "-" + n + s.substr(1) : n + s;
2516
- }
2517
- return E.stringifyNumber(t);
2518
- }
2519
- var da = Jn.concat([{ identify: (t) => t == null, createNode: (t, e, n) => n.wrapScalars ? new E.Scalar(null) : null, default: true, tag: "tag:yaml.org,2002:null", test: /^(?:~|[Nn]ull|NULL)?$/, resolve: () => null, options: E.nullOptions, stringify: () => E.nullOptions.nullStr }, { identify: (t) => typeof t == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/, resolve: () => true, options: E.boolOptions, stringify: Ss }, { identify: (t) => typeof t == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i, resolve: () => false, options: E.boolOptions, stringify: Ss }, { identify: yt, default: true, tag: "tag:yaml.org,2002:int", format: "BIN", test: /^([-+]?)0b([0-1_]+)$/, resolve: (t, e, n) => Vt(e, n, 2), stringify: (t) => Hn(t, 2, "0b") }, { identify: yt, default: true, tag: "tag:yaml.org,2002:int", format: "OCT", test: /^([-+]?)0([0-7_]+)$/, resolve: (t, e, n) => Vt(e, n, 8), stringify: (t) => Hn(t, 8, "0") }, { identify: yt, default: true, tag: "tag:yaml.org,2002:int", test: /^([-+]?)([0-9][0-9_]*)$/, resolve: (t, e, n) => Vt(e, n, 10), stringify: E.stringifyNumber }, { identify: yt, default: true, tag: "tag:yaml.org,2002:int", format: "HEX", test: /^([-+]?)0x([0-9a-fA-F_]+)$/, resolve: (t, e, n) => Vt(e, n, 16), stringify: (t) => Hn(t, 16, "0x") }, { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^(?:[-+]?\.inf|(\.nan))$/i, resolve: (t, e) => e ? NaN : t[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, stringify: E.stringifyNumber }, { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", format: "EXP", test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/, resolve: (t) => parseFloat(t.replace(/_/g, "")), stringify: ({ value: t }) => Number(t).toExponential() }, { identify: (t) => typeof t == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/, resolve(t, e) {
2520
- let n = new E.Scalar(parseFloat(t.replace(/_/g, "")));
2521
- if (e) {
2522
- let r = e.replace(/_/g, "");
2523
- r[r.length - 1] === "0" && (n.minFractionDigits = r.length);
2524
- }
2525
- return n;
2526
- }, stringify: E.stringifyNumber }], D.binary, D.omap, D.pairs, D.set, D.intTime, D.floatTime, D.timestamp), ya = { core: ga, failsafe: Jn, json: ks, yaml11: da }, Ea = { binary: D.binary, bool: Ns, float: Cs, floatExp: Ms, floatNaN: Ts, floatTime: D.floatTime, int: As, intHex: Ls, intOct: Os, intTime: D.intTime, map: Et, null: bs, omap: D.omap, pairs: D.pairs, seq: Wt, set: D.set, timestamp: D.timestamp };
2527
- function Sa(t, e, n) {
2528
- if (e) {
2529
- let r = n.filter((i) => i.tag === e), s = r.find((i) => !i.format) || r[0];
2530
- if (!s) throw new Error(`Tag ${e} not found`);
2531
- return s;
2532
- }
2533
- return n.find((r) => (r.identify && r.identify(t) || r.class && t instanceof r.class) && !r.format);
2534
- }
2535
- function wa(t, e, n) {
2536
- if (t instanceof E.Node) return t;
2537
- let { defaultPrefix: r, onTagObj: s, prevObjects: i, schema: o, wrapScalars: a } = n;
2538
- e && e.startsWith("!!") && (e = r + e.slice(2));
2539
- let c = Sa(t, e, o.tags);
2540
- if (!c) {
2541
- if (typeof t.toJSON == "function" && (t = t.toJSON()), !t || typeof t != "object") return a ? new E.Scalar(t) : t;
2542
- c = t instanceof Map ? Et : t[Symbol.iterator] ? Wt : Et;
2543
- }
2544
- s && (s(c), delete n.onTagObj);
2545
- let l = { value: void 0, node: void 0 };
2546
- if (t && typeof t == "object" && i) {
2547
- let f = i.get(t);
2548
- if (f) {
2549
- let m = new E.Alias(f);
2550
- return n.aliasNodes.push(m), m;
2551
- }
2552
- l.value = t, i.set(t, l);
2553
- }
2554
- return l.node = c.createNode ? c.createNode(n.schema, t, n) : a ? new E.Scalar(t) : t, e && l.node instanceof E.Node && (l.node.tag = e), l.node;
2555
- }
2556
- function ba(t, e, n, r) {
2557
- let s = t[r.replace(/\W/g, "")];
2558
- if (!s) {
2559
- let i = Object.keys(t).map((o) => JSON.stringify(o)).join(", ");
2560
- throw new Error(`Unknown schema "${r}"; use one of ${i}`);
2561
- }
2562
- if (Array.isArray(n)) for (let i of n) s = s.concat(i);
2563
- else typeof n == "function" && (s = n(s.slice()));
2564
- for (let i = 0; i < s.length; ++i) {
2565
- let o = s[i];
2566
- if (typeof o == "string") {
2567
- let a = e[o];
2568
- if (!a) {
2569
- let c = Object.keys(e).map((l) => JSON.stringify(l)).join(", ");
2570
- throw new Error(`Unknown custom tag "${o}"; use one of ${c}`);
2571
- }
2572
- s[i] = a;
2573
- }
2574
- }
2575
- return s;
2576
- }
2577
- var Na = (t, e) => t.key < e.key ? -1 : t.key > e.key ? 1 : 0, St = class t {
2578
- constructor({ customTags: e, merge: n, schema: r, sortMapEntries: s, tags: i }) {
2579
- this.merge = !!n, this.name = r, this.sortMapEntries = s === true ? Na : s || null, !e && i && D.warnOptionDeprecation("tags", "customTags"), this.tags = ba(ya, Ea, e || i, r);
2580
- }
2581
- createNode(e, n, r, s) {
2582
- let i = { defaultPrefix: t.defaultPrefix, schema: this, wrapScalars: n }, o = s ? Object.assign(s, i) : i;
2583
- return wa(e, r, o);
2584
- }
2585
- createPair(e, n, r) {
2586
- r || (r = { wrapScalars: true });
2587
- let s = this.createNode(e, r.wrapScalars, null, r), i = this.createNode(n, r.wrapScalars, null, r);
2588
- return new E.Pair(s, i);
2589
- }
2590
- };
2591
- jt._defineProperty(St, "defaultPrefix", jt.defaultTagPrefix);
2592
- jt._defineProperty(St, "defaultTags", jt.defaultTags);
2593
- Ps.Schema = St;
2594
- });
2595
- var Rs = te((Xt) => {
2596
- "use strict";
2597
- var Y = oe(), S = qe(), Is = zn(), Oa = { anchorPrefix: "a", customTags: null, indent: 2, indentSeq: true, keepCstNodes: false, keepNodeTypes: true, keepBlobsInJSON: true, mapAsMap: false, maxAliasCount: 100, prettyErrors: false, simpleKeys: false, version: "1.2" }, Aa = { get binary() {
2598
- return S.binaryOptions;
2599
- }, set binary(t) {
2600
- Object.assign(S.binaryOptions, t);
2601
- }, get bool() {
2602
- return S.boolOptions;
2603
- }, set bool(t) {
2604
- Object.assign(S.boolOptions, t);
2605
- }, get int() {
2606
- return S.intOptions;
2607
- }, set int(t) {
2608
- Object.assign(S.intOptions, t);
2609
- }, get null() {
2610
- return S.nullOptions;
2611
- }, set null(t) {
2612
- Object.assign(S.nullOptions, t);
2613
- }, get str() {
2614
- return S.strOptions;
2615
- }, set str(t) {
2616
- Object.assign(S.strOptions, t);
2617
- } }, _s = { "1.0": { schema: "yaml-1.1", merge: true, tagPrefixes: [{ handle: "!", prefix: Y.defaultTagPrefix }, { handle: "!!", prefix: "tag:private.yaml.org,2002:" }] }, 1.1: { schema: "yaml-1.1", merge: true, tagPrefixes: [{ handle: "!", prefix: "!" }, { handle: "!!", prefix: Y.defaultTagPrefix }] }, 1.2: { schema: "core", merge: false, tagPrefixes: [{ handle: "!", prefix: "!" }, { handle: "!!", prefix: Y.defaultTagPrefix }] } };
2618
- function vs(t, e) {
2619
- if ((t.version || t.options.version) === "1.0") {
2620
- let s = e.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/);
2621
- if (s) return "!" + s[1];
2622
- let i = e.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/);
2623
- return i ? `!${i[1]}/${i[2]}` : `!${e.replace(/^tag:/, "")}`;
2624
- }
2625
- let n = t.tagPrefixes.find((s) => e.indexOf(s.prefix) === 0);
2626
- if (!n) {
2627
- let s = t.getDefaults().tagPrefixes;
2628
- n = s && s.find((i) => e.indexOf(i.prefix) === 0);
2629
- }
2630
- if (!n) return e[0] === "!" ? e : `!<${e}>`;
2631
- let r = e.substr(n.prefix.length).replace(/[!,[\]{}]/g, (s) => ({ "!": "%21", ",": "%2C", "[": "%5B", "]": "%5D", "{": "%7B", "}": "%7D" })[s]);
2632
- return n.handle + r;
2633
- }
2634
- function La(t, e) {
2635
- if (e instanceof S.Alias) return S.Alias;
2636
- if (e.tag) {
2637
- let s = t.filter((i) => i.tag === e.tag);
2638
- if (s.length > 0) return s.find((i) => i.format === e.format) || s[0];
2639
- }
2640
- let n, r;
2641
- if (e instanceof S.Scalar) {
2642
- r = e.value;
2643
- let s = t.filter((i) => i.identify && i.identify(r) || i.class && r instanceof i.class);
2644
- n = s.find((i) => i.format === e.format) || s.find((i) => !i.format);
2645
- } else r = e, n = t.find((s) => s.nodeClass && r instanceof s.nodeClass);
2646
- if (!n) {
2647
- let s = r && r.constructor ? r.constructor.name : typeof r;
2648
- throw new Error(`Tag not resolved for ${s} value`);
2649
- }
2650
- return n;
2651
- }
2652
- function Ta(t, e, { anchors: n, doc: r }) {
2653
- let s = [], i = r.anchors.getName(t);
2654
- return i && (n[i] = t, s.push(`&${i}`)), t.tag ? s.push(vs(r, t.tag)) : e.default || s.push(vs(r, e.tag)), s.join(" ");
2655
- }
2656
- function Gt(t, e, n, r) {
2657
- let { anchors: s, schema: i } = e.doc, o;
2658
- if (!(t instanceof S.Node)) {
2659
- let l = { aliasNodes: [], onTagObj: (f) => o = f, prevObjects: /* @__PURE__ */ new Map() };
2660
- t = i.createNode(t, true, null, l);
2661
- for (let f of l.aliasNodes) {
2662
- f.source = f.source.node;
2663
- let m = s.getName(f.source);
2664
- m || (m = s.newName(), s.map[m] = f.source);
2665
- }
2666
- }
2667
- if (t instanceof S.Pair) return t.toString(e, n, r);
2668
- o || (o = La(i.tags, t));
2669
- let a = Ta(t, o, e);
2670
- a.length > 0 && (e.indentAtStart = (e.indentAtStart || 0) + a.length + 1);
2671
- let c = typeof o.stringify == "function" ? o.stringify(t, e, n, r) : t instanceof S.Scalar ? S.stringifyString(t, e, n, r) : t.toString(e, n, r);
2672
- return a ? t instanceof S.Scalar || c[0] === "{" || c[0] === "[" ? `${a} ${c}` : `${a}
2673
- ${e.indent}${c}` : c;
2674
- }
2675
- var Zn = class t {
2676
- static validAnchorNode(e) {
2677
- return e instanceof S.Scalar || e instanceof S.YAMLSeq || e instanceof S.YAMLMap;
2678
- }
2679
- constructor(e) {
2680
- Y._defineProperty(this, "map", /* @__PURE__ */ Object.create(null)), this.prefix = e;
2681
- }
2682
- createAlias(e, n) {
2683
- return this.setAnchor(e, n), new S.Alias(e);
2684
- }
2685
- createMergePair(...e) {
2686
- let n = new S.Merge();
2687
- return n.value.items = e.map((r) => {
2688
- if (r instanceof S.Alias) {
2689
- if (r.source instanceof S.YAMLMap) return r;
2690
- } else if (r instanceof S.YAMLMap) return this.createAlias(r);
2691
- throw new Error("Merge sources must be Map nodes or their Aliases");
2692
- }), n;
2693
- }
2694
- getName(e) {
2695
- let { map: n } = this;
2696
- return Object.keys(n).find((r) => n[r] === e);
2697
- }
2698
- getNames() {
2699
- return Object.keys(this.map);
2700
- }
2701
- getNode(e) {
2702
- return this.map[e];
2703
- }
2704
- newName(e) {
2705
- e || (e = this.prefix);
2706
- let n = Object.keys(this.map);
2707
- for (let r = 1; ; ++r) {
2708
- let s = `${e}${r}`;
2709
- if (!n.includes(s)) return s;
2710
- }
2711
- }
2712
- resolveNodes() {
2713
- let { map: e, _cstAliases: n } = this;
2714
- Object.keys(e).forEach((r) => {
2715
- e[r] = e[r].resolved;
2716
- }), n.forEach((r) => {
2717
- r.source = r.source.resolved;
2718
- }), delete this._cstAliases;
2719
- }
2720
- setAnchor(e, n) {
2721
- if (e != null && !t.validAnchorNode(e)) throw new Error("Anchors may only be set for Scalar, Seq and Map nodes");
2722
- if (n && /[\x00-\x19\s,[\]{}]/.test(n)) throw new Error("Anchor names must not contain whitespace or control characters");
2723
- let { map: r } = this, s = e && Object.keys(r).find((i) => r[i] === e);
2724
- if (s) if (n) s !== n && (delete r[s], r[n] = e);
2725
- else return s;
2726
- else {
2727
- if (!n) {
2728
- if (!e) return null;
2729
- n = this.newName();
2730
- }
2731
- r[n] = e;
2732
- }
2733
- return n;
2734
- }
2735
- }, Ht = (t, e) => {
2736
- if (t && typeof t == "object") {
2737
- let { tag: n } = t;
2738
- t instanceof S.Collection ? (n && (e[n] = true), t.items.forEach((r) => Ht(r, e))) : t instanceof S.Pair ? (Ht(t.key, e), Ht(t.value, e)) : t instanceof S.Scalar && n && (e[n] = true);
2739
- }
2740
- return e;
2741
- }, Ma = (t) => Object.keys(Ht(t, {}));
2742
- function Ca(t, e) {
2743
- let n = { before: [], after: [] }, r, s = false;
2744
- for (let i of e) if (i.valueRange) {
2745
- if (r !== void 0) {
2746
- let a = "Document contains trailing content not separated by a ... or --- line";
2747
- t.errors.push(new Y.YAMLSyntaxError(i, a));
2748
- break;
2749
- }
2750
- let o = S.resolveNode(t, i);
2751
- s && (o.spaceBefore = true, s = false), r = o;
2752
- } else i.comment !== null ? (r === void 0 ? n.before : n.after).push(i.comment) : i.type === Y.Type.BLANK_LINE && (s = true, r === void 0 && n.before.length > 0 && !t.commentBefore && (t.commentBefore = n.before.join(`
2753
- `), n.before = []));
2754
- if (t.contents = r || null, !r) t.comment = n.before.concat(n.after).join(`
2755
- `) || null;
2756
- else {
2757
- let i = n.before.join(`
2758
- `);
2759
- if (i) {
2760
- let o = r instanceof S.Collection && r.items[0] ? r.items[0] : r;
2761
- o.commentBefore = o.commentBefore ? `${i}
2762
- ${o.commentBefore}` : i;
2763
- }
2764
- t.comment = n.after.join(`
2765
- `) || null;
2766
- }
2767
- }
2768
- function ka({ tagPrefixes: t }, e) {
2769
- let [n, r] = e.parameters;
2770
- if (!n || !r) {
2771
- let s = "Insufficient parameters given for %TAG directive";
2772
- throw new Y.YAMLSemanticError(e, s);
2773
- }
2774
- if (t.some((s) => s.handle === n)) {
2775
- let s = "The %TAG directive must only be given at most once per handle in the same document.";
2776
- throw new Y.YAMLSemanticError(e, s);
2777
- }
2778
- return { handle: n, prefix: r };
2779
- }
2780
- function Pa(t, e) {
2781
- let [n] = e.parameters;
2782
- if (e.name === "YAML:1.0" && (n = "1.0"), !n) {
2783
- let r = "Insufficient parameters given for %YAML directive";
2784
- throw new Y.YAMLSemanticError(e, r);
2785
- }
2786
- if (!_s[n]) {
2787
- let s = `Document will be parsed as YAML ${t.version || t.options.version} rather than YAML ${n}`;
2788
- t.warnings.push(new Y.YAMLWarning(e, s));
2789
- }
2790
- return n;
2791
- }
2792
- function Ia(t, e, n) {
2793
- let r = [], s = false;
2794
- for (let i of e) {
2795
- let { comment: o, name: a } = i;
2796
- switch (a) {
2797
- case "TAG":
2798
- try {
2799
- t.tagPrefixes.push(ka(t, i));
2800
- } catch (c) {
2801
- t.errors.push(c);
2802
- }
2803
- s = true;
2804
- break;
2805
- case "YAML":
2806
- case "YAML:1.0":
2807
- if (t.version) {
2808
- let c = "The %YAML directive must only be given at most once per document.";
2809
- t.errors.push(new Y.YAMLSemanticError(i, c));
2810
- }
2811
- try {
2812
- t.version = Pa(t, i);
2813
- } catch (c) {
2814
- t.errors.push(c);
2815
- }
2816
- s = true;
2817
- break;
2818
- default:
2819
- if (a) {
2820
- let c = `YAML only supports %TAG and %YAML directives, and not %${a}`;
2821
- t.warnings.push(new Y.YAMLWarning(i, c));
2822
- }
2823
- }
2824
- o && r.push(o);
2825
- }
2826
- if (n && !s && (t.version || n.version || t.options.version) === "1.1") {
2827
- let i = ({ handle: o, prefix: a }) => ({ handle: o, prefix: a });
2828
- t.tagPrefixes = n.tagPrefixes.map(i), t.version = n.version;
2829
- }
2830
- t.commentBefore = r.join(`
2831
- `) || null;
2832
- }
2833
- function Ve(t) {
2834
- if (t instanceof S.Collection) return true;
2835
- throw new Error("Expected a YAML collection as document contents");
2836
- }
2837
- var Jt = class t {
2838
- constructor(e) {
2839
- this.anchors = new Zn(e.anchorPrefix), this.commentBefore = null, this.comment = null, this.contents = null, this.directivesEndMarker = null, this.errors = [], this.options = e, this.schema = null, this.tagPrefixes = [], this.version = null, this.warnings = [];
2840
- }
2841
- add(e) {
2842
- return Ve(this.contents), this.contents.add(e);
2843
- }
2844
- addIn(e, n) {
2845
- Ve(this.contents), this.contents.addIn(e, n);
2846
- }
2847
- delete(e) {
2848
- return Ve(this.contents), this.contents.delete(e);
2849
- }
2850
- deleteIn(e) {
2851
- return S.isEmptyPath(e) ? this.contents == null ? false : (this.contents = null, true) : (Ve(this.contents), this.contents.deleteIn(e));
2852
- }
2853
- getDefaults() {
2854
- return t.defaults[this.version] || t.defaults[this.options.version] || {};
2855
- }
2856
- get(e, n) {
2857
- return this.contents instanceof S.Collection ? this.contents.get(e, n) : void 0;
2858
- }
2859
- getIn(e, n) {
2860
- return S.isEmptyPath(e) ? !n && this.contents instanceof S.Scalar ? this.contents.value : this.contents : this.contents instanceof S.Collection ? this.contents.getIn(e, n) : void 0;
2861
- }
2862
- has(e) {
2863
- return this.contents instanceof S.Collection ? this.contents.has(e) : false;
2864
- }
2865
- hasIn(e) {
2866
- return S.isEmptyPath(e) ? this.contents !== void 0 : this.contents instanceof S.Collection ? this.contents.hasIn(e) : false;
2867
- }
2868
- set(e, n) {
2869
- Ve(this.contents), this.contents.set(e, n);
2870
- }
2871
- setIn(e, n) {
2872
- S.isEmptyPath(e) ? this.contents = n : (Ve(this.contents), this.contents.setIn(e, n));
2873
- }
2874
- setSchema(e, n) {
2875
- if (!e && !n && this.schema) return;
2876
- typeof e == "number" && (e = e.toFixed(1)), e === "1.0" || e === "1.1" || e === "1.2" ? (this.version ? this.version = e : this.options.version = e, delete this.options.schema) : e && typeof e == "string" && (this.options.schema = e), Array.isArray(n) && (this.options.customTags = n);
2877
- let r = Object.assign({}, this.getDefaults(), this.options);
2878
- this.schema = new Is.Schema(r);
2879
- }
2880
- parse(e, n) {
2881
- this.options.keepCstNodes && (this.cstNode = e), this.options.keepNodeTypes && (this.type = "DOCUMENT");
2882
- let { directives: r = [], contents: s = [], directivesEndMarker: i, error: o, valueRange: a } = e;
2883
- if (o && (o.source || (o.source = this), this.errors.push(o)), Ia(this, r, n), i && (this.directivesEndMarker = true), this.range = a ? [a.start, a.end] : null, this.setSchema(), this.anchors._cstAliases = [], Ca(this, s), this.anchors.resolveNodes(), this.options.prettyErrors) {
2884
- for (let c of this.errors) c instanceof Y.YAMLError && c.makePretty();
2885
- for (let c of this.warnings) c instanceof Y.YAMLError && c.makePretty();
2886
- }
2887
- return this;
2888
- }
2889
- listNonDefaultTags() {
2890
- return Ma(this.contents).filter((e) => e.indexOf(Is.Schema.defaultPrefix) !== 0);
2891
- }
2892
- setTagPrefix(e, n) {
2893
- if (e[0] !== "!" || e[e.length - 1] !== "!") throw new Error("Handle must start and end with !");
2894
- if (n) {
2895
- let r = this.tagPrefixes.find((s) => s.handle === e);
2896
- r ? r.prefix = n : this.tagPrefixes.push({ handle: e, prefix: n });
2897
- } else this.tagPrefixes = this.tagPrefixes.filter((r) => r.handle !== e);
2898
- }
2899
- toJSON(e, n) {
2900
- let { keepBlobsInJSON: r, mapAsMap: s, maxAliasCount: i } = this.options, o = r && (typeof e != "string" || !(this.contents instanceof S.Scalar)), a = { doc: this, indentStep: " ", keep: o, mapAsMap: o && !!s, maxAliasCount: i, stringify: Gt }, c = Object.keys(this.anchors.map);
2901
- c.length > 0 && (a.anchors = new Map(c.map((f) => [this.anchors.map[f], { alias: [], aliasCount: 0, count: 1 }])));
2902
- let l = S.toJSON(this.contents, e, a);
2903
- if (typeof n == "function" && a.anchors) for (let { count: f, res: m } of a.anchors.values()) n(m, f);
2904
- return l;
2905
- }
2906
- toString() {
2907
- if (this.errors.length > 0) throw new Error("Document with errors cannot be stringified");
2908
- let e = this.options.indent;
2909
- if (!Number.isInteger(e) || e <= 0) {
2910
- let c = JSON.stringify(e);
2911
- throw new Error(`"indent" option must be a positive integer, not ${c}`);
2912
- }
2913
- this.setSchema();
2914
- let n = [], r = false;
2915
- if (this.version) {
2916
- let c = "%YAML 1.2";
2917
- this.schema.name === "yaml-1.1" && (this.version === "1.0" ? c = "%YAML:1.0" : this.version === "1.1" && (c = "%YAML 1.1")), n.push(c), r = true;
2918
- }
2919
- let s = this.listNonDefaultTags();
2920
- this.tagPrefixes.forEach(({ handle: c, prefix: l }) => {
2921
- s.some((f) => f.indexOf(l) === 0) && (n.push(`%TAG ${c} ${l}`), r = true);
2922
- }), (r || this.directivesEndMarker) && n.push("---"), this.commentBefore && ((r || !this.directivesEndMarker) && n.unshift(""), n.unshift(this.commentBefore.replace(/^/gm, "#")));
2923
- let i = { anchors: /* @__PURE__ */ Object.create(null), doc: this, indent: "", indentStep: " ".repeat(e), stringify: Gt }, o = false, a = null;
2924
- if (this.contents) {
2925
- this.contents instanceof S.Node && (this.contents.spaceBefore && (r || this.directivesEndMarker) && n.push(""), this.contents.commentBefore && n.push(this.contents.commentBefore.replace(/^/gm, "#")), i.forceBlockIndent = !!this.comment, a = this.contents.comment);
2926
- let c = a ? null : () => o = true, l = Gt(this.contents, i, () => a = null, c);
2927
- n.push(S.addComment(l, "", a));
2928
- } else this.contents !== void 0 && n.push(Gt(this.contents, i));
2929
- return this.comment && ((!o || a) && n[n.length - 1] !== "" && n.push(""), n.push(this.comment.replace(/^/gm, "#"))), n.join(`
2930
- `) + `
2931
- `;
2932
- }
2933
- };
2934
- Y._defineProperty(Jt, "defaults", _s);
2935
- Xt.Document = Jt;
2936
- Xt.defaultOptions = Oa;
2937
- Xt.scalarOptions = Aa;
2938
- });
2939
- var Ys = te((Ds) => {
2940
- "use strict";
2941
- var er = ns(), Oe = Rs(), va = zn(), _a = oe(), Ra = Gn();
2942
- qe();
2943
- function xa(t, e = true, n) {
2944
- n === void 0 && typeof e == "string" && (n = e, e = true);
2945
- let r = Object.assign({}, Oe.Document.defaults[Oe.defaultOptions.version], Oe.defaultOptions);
2946
- return new va.Schema(r).createNode(t, e, n);
2947
- }
2948
- var je = class extends Oe.Document {
2949
- constructor(e) {
2950
- super(Object.assign({}, Oe.defaultOptions, e));
2951
- }
2952
- };
2953
- function Da(t, e) {
2954
- let n = [], r;
2955
- for (let s of er.parse(t)) {
2956
- let i = new je(e);
2957
- i.parse(s, r), n.push(i), r = i;
2958
- }
2959
- return n;
2960
- }
2961
- function xs(t, e) {
2962
- let n = er.parse(t), r = new je(e).parse(n[0]);
2963
- if (n.length > 1) {
2964
- let s = "Source contains multiple documents; please use YAML.parseAllDocuments()";
2965
- r.errors.unshift(new _a.YAMLSemanticError(n[1], s));
2966
- }
2967
- return r;
2968
- }
2969
- function Ya(t, e) {
2970
- let n = xs(t, e);
2971
- if (n.warnings.forEach((r) => Ra.warn(r)), n.errors.length > 0) throw n.errors[0];
2972
- return n.toJSON();
2973
- }
2974
- function $a(t, e) {
2975
- let n = new je(e);
2976
- return n.contents = t, String(n);
2977
- }
2978
- var Ba = { createNode: xa, defaultOptions: Oe.defaultOptions, Document: je, parse: Ya, parseAllDocuments: Da, parseCST: er.parse, parseDocument: xs, scalarOptions: Oe.scalarOptions, stringify: $a };
2979
- Ds.YAML = Ba;
2980
- });
2981
- var tr = te((nf, $s) => {
2982
- $s.exports = Ys().YAML;
2983
- });
2984
- var Bs = te((G) => {
2985
- "use strict";
2986
- var We = qe(), Qe = oe();
2987
- G.findPair = We.findPair;
2988
- G.parseMap = We.resolveMap;
2989
- G.parseSeq = We.resolveSeq;
2990
- G.stringifyNumber = We.stringifyNumber;
2991
- G.stringifyString = We.stringifyString;
2992
- G.toJSON = We.toJSON;
2993
- G.Type = Qe.Type;
2994
- G.YAMLError = Qe.YAMLError;
2995
- G.YAMLReferenceError = Qe.YAMLReferenceError;
2996
- G.YAMLSemanticError = Qe.YAMLSemanticError;
2997
- G.YAMLSyntaxError = Qe.YAMLSyntaxError;
2998
- G.YAMLWarning = Qe.YAMLWarning;
2999
- });
3000
- var gr = {};
3001
- yr(gr, { __parsePrettierYamlConfig: () => sc, languages: () => Xr, options: () => zr, parsers: () => hr, printers: () => rc });
3002
- var Vi = (t, e, n, r) => {
3003
- if (!(t && e == null)) return e.replaceAll ? e.replaceAll(n, r) : n.global ? e.replace(n, r) : e.split(n).join(r);
3004
- };
3005
- var At = Vi;
3006
- var Me = "string";
3007
- var ze = "array";
3008
- var Ze = "cursor";
3009
- var et = "indent";
3010
- var Ce = "align";
3011
- var tt = "trim";
3012
- var ke = "group";
3013
- var Pe = "fill";
3014
- var ge = "if-break";
3015
- var nt = "indent-if-break";
3016
- var Ie = "line-suffix";
3017
- var rt = "line-suffix-boundary";
3018
- var Z = "line";
3019
- var st = "label";
3020
- var ve = "break-parent";
3021
- var Lt = /* @__PURE__ */ new Set([Ze, et, Ce, tt, ke, Pe, ge, nt, Ie, rt, Z, st, ve]);
3022
- var ji = (t, e, n) => {
3023
- if (!(t && e == null)) return Array.isArray(e) || typeof e == "string" ? e[n < 0 ? e.length + n : n] : e.at(n);
3024
- };
3025
- var x = ji;
3026
- function Wi(t) {
3027
- if (typeof t == "string") return Me;
3028
- if (Array.isArray(t)) return ze;
3029
- if (!t) return;
3030
- let { type: e } = t;
3031
- if (Lt.has(e)) return e;
3032
- }
3033
- var _e = Wi;
3034
- var Qi = (t) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(t);
3035
- function Gi(t) {
3036
- let e = t === null ? "null" : typeof t;
3037
- if (e !== "string" && e !== "object") return `Unexpected doc '${e}',
3038
- Expected it to be 'string' or 'object'.`;
3039
- if (_e(t)) throw new Error("doc is valid.");
3040
- let n = Object.prototype.toString.call(t);
3041
- if (n !== "[object Object]") return `Unexpected doc '${n}'.`;
3042
- let r = Qi([...Lt].map((s) => `'${s}'`));
3043
- return `Unexpected doc.type '${t.type}'.
3044
- Expected it to be ${r}.`;
3045
- }
3046
- var pn = class extends Error {
3047
- constructor(e) {
3048
- super(Gi(e));
3049
- __publicField(this, "name", "InvalidDocError");
3050
- this.doc = e;
3051
- }
3052
- };
3053
- var mn = pn;
3054
- function Ji(t, e) {
3055
- if (typeof t == "string") return e(t);
3056
- let n = /* @__PURE__ */ new Map();
3057
- return r(t);
3058
- function r(i) {
3059
- if (n.has(i)) return n.get(i);
3060
- let o = s(i);
3061
- return n.set(i, o), o;
3062
- }
3063
- function s(i) {
3064
- switch (_e(i)) {
3065
- case ze:
3066
- return e(i.map(r));
3067
- case Pe:
3068
- return e({ ...i, parts: i.parts.map(r) });
3069
- case ge:
3070
- return e({ ...i, breakContents: r(i.breakContents), flatContents: r(i.flatContents) });
3071
- case ke: {
3072
- let { expandedStates: o, contents: a } = i;
3073
- return o ? (o = o.map(r), a = o[0]) : a = r(a), e({ ...i, contents: a, expandedStates: o });
3074
- }
3075
- case Ce:
3076
- case et:
3077
- case nt:
3078
- case st:
3079
- case Ie:
3080
- return e({ ...i, contents: r(i.contents) });
3081
- case Me:
3082
- case Ze:
3083
- case tt:
3084
- case rt:
3085
- case Z:
3086
- case ve:
3087
- return e(i);
3088
- default:
3089
- throw new mn(i);
3090
- }
3091
- }
3092
- }
3093
- function Er(t, e = it) {
3094
- return Ji(t, (n) => typeof n == "string" ? P(e, n.split(`
3095
- `)) : n);
3096
- }
3097
- var hn = () => {
3098
- };
3099
- var de = hn;
3100
- var gn = hn;
3101
- var Sr = hn;
3102
- function ot(t, e) {
3103
- return de(e), { type: Ce, contents: e, n: t };
3104
- }
3105
- function Re(t, e = {}) {
3106
- return de(t), gn(e.expandedStates, true), { type: ke, id: e.id, contents: t, break: !!e.shouldBreak, expandedStates: e.expandedStates };
3107
- }
3108
- function dn(t) {
3109
- return ot(Number.NEGATIVE_INFINITY, t);
3110
- }
3111
- function wr(t) {
3112
- return ot({ type: "root" }, t);
3113
- }
3114
- function br(t) {
3115
- return ot(-1, t);
3116
- }
3117
- function yn(t, e) {
3118
- return Re(t[0], { ...e, expandedStates: t });
3119
- }
3120
- function Tt(t) {
3121
- return Sr(t), { type: Pe, parts: t };
3122
- }
3123
- function at(t, e = "", n = {}) {
3124
- return de(t), e !== "" && de(e), { type: ge, breakContents: t, flatContents: e, groupId: n.groupId };
3125
- }
3126
- function Nr(t) {
3127
- return de(t), { type: Ie, contents: t };
3128
- }
3129
- var Mt = { type: ve };
3130
- var Xi = { type: Z, hard: true };
3131
- var zi = { type: Z, hard: true, literal: true };
3132
- var ne = { type: Z };
3133
- var Ct = { type: Z, soft: true };
3134
- var N = [Xi, Mt];
3135
- var it = [zi, Mt];
3136
- function P(t, e) {
3137
- de(t), gn(e);
3138
- let n = [];
3139
- for (let r = 0; r < e.length; r++) r !== 0 && n.push(t), n.push(e[r]);
3140
- return n;
3141
- }
3142
- function kt(t) {
3143
- return (e, n, r) => {
3144
- let s = !!(r != null && r.backwards);
3145
- if (n === false) return false;
3146
- let { length: i } = e, o = n;
3147
- for (; o >= 0 && o < i; ) {
3148
- let a = e.charAt(o);
3149
- if (t instanceof RegExp) {
3150
- if (!t.test(a)) return o;
3151
- } else if (!t.includes(a)) return o;
3152
- s ? o-- : o++;
3153
- }
3154
- return o === -1 || o === i ? o : false;
3155
- };
3156
- }
3157
- var Bc = kt(/\s/u);
3158
- var En = kt(" ");
3159
- var Fc = kt(",; ");
3160
- var qc = kt(/[^\n\r]/u);
3161
- function Zi(t, e, n) {
3162
- let r = !!(n != null && n.backwards);
3163
- if (e === false) return false;
3164
- let s = t.charAt(e);
3165
- if (r) {
3166
- if (t.charAt(e - 1) === "\r" && s === `
3167
- `) return e - 2;
3168
- if (s === `
3169
- ` || s === "\r" || s === "\u2028" || s === "\u2029") return e - 1;
3170
- } else {
3171
- if (s === "\r" && t.charAt(e + 1) === `
3172
- `) return e + 2;
3173
- if (s === `
3174
- ` || s === "\r" || s === "\u2028" || s === "\u2029") return e + 1;
3175
- }
3176
- return e;
3177
- }
3178
- var Sn = Zi;
3179
- function eo(t, e) {
3180
- let n = e - 1;
3181
- n = En(t, n, { backwards: true }), n = Sn(t, n, { backwards: true }), n = En(t, n, { backwards: true });
3182
- let r = Sn(t, n, { backwards: true });
3183
- return n !== r;
3184
- }
3185
- var Or = eo;
3186
- var wn = class extends Error {
3187
- constructor(e, n, r = "type") {
3188
- super(`Unexpected ${n} node ${r}: ${JSON.stringify(e[r])}.`);
3189
- __publicField(this, "name", "UnexpectedNodeError");
3190
- this.node = e;
3191
- }
3192
- };
3193
- var Ar = wn;
3194
- function Lr(t, e) {
3195
- let { node: n } = t;
3196
- if (n.type === "root" && e.filepath && /(?:[/\\]|^)\.(?:prettier|stylelint|lintstaged)rc$/u.test(e.filepath)) return async (r) => {
3197
- let s = await r(e.originalText, { parser: "json" });
3198
- return s ? [s, N] : void 0;
3199
- };
3200
- }
3201
- Lr.getVisitorKeys = () => [];
3202
- var Tr = Lr;
3203
- var ct = null;
3204
- function lt(t) {
3205
- if (ct !== null && typeof ct.property) {
3206
- let e = ct;
3207
- return ct = lt.prototype = null, e;
3208
- }
3209
- return ct = lt.prototype = t ?? /* @__PURE__ */ Object.create(null), new lt();
3210
- }
3211
- var to = 10;
3212
- for (let t = 0; t <= to; t++) lt();
3213
- function bn(t) {
3214
- return lt(t);
3215
- }
3216
- function no(t, e = "type") {
3217
- bn(t);
3218
- function n(r) {
3219
- let s = r[e], i = t[s];
3220
- if (!Array.isArray(i)) throw Object.assign(new Error(`Missing visitor keys for '${s}'.`), { node: r });
3221
- return i;
3222
- }
3223
- return n;
3224
- }
3225
- var Mr = no;
3226
- var ro = Object.fromEntries(Object.entries({ root: ["children"], document: ["head", "body", "children"], documentHead: ["children"], documentBody: ["children"], directive: [], alias: [], blockLiteral: [], blockFolded: ["children"], plain: ["children"], quoteSingle: [], quoteDouble: [], mapping: ["children"], mappingItem: ["key", "value", "children"], mappingKey: ["content", "children"], mappingValue: ["content", "children"], sequence: ["children"], sequenceItem: ["content", "children"], flowMapping: ["children"], flowMappingItem: ["key", "value", "children"], flowSequence: ["children"], flowSequenceItem: ["content", "children"], comment: [], tag: [], anchor: [] }).map(([t, e]) => [t, [...e, "anchor", "tag", "indicatorComment", "leadingComments", "middleComments", "trailingComment", "endComments"]]));
3227
- var Cr = ro;
3228
- var so = Mr(Cr);
3229
- var kr = so;
3230
- function xe(t) {
3231
- return t.position.start.offset;
3232
- }
3233
- function Pr(t) {
3234
- return t.position.end.offset;
3235
- }
3236
- var Ir = "format";
3237
- var vr = /^\s*#[^\S\n]*@(?:noformat|noprettier)\s*?(?:\n|$)/u;
3238
- var _r = /^\s*#[^\S\n]*@(?:format|prettier)\s*?(?:\n|$)/u;
3239
- var Rr = /^\s*@(?:format|prettier)\s*$/u;
3240
- function xr(t) {
3241
- return Rr.test(t);
3242
- }
3243
- function Dr(t) {
3244
- return _r.test(t);
3245
- }
3246
- function Yr(t) {
3247
- return vr.test(t);
3248
- }
3249
- function $r(t) {
3250
- return `# @${Ir}
3251
-
3252
- ${t}`;
3253
- }
3254
- function io(t) {
3255
- return Array.isArray(t) && t.length > 0;
3256
- }
3257
- var De = io;
3258
- function K(t, e) {
3259
- return typeof (t == null ? void 0 : t.type) == "string" && (!e || e.includes(t.type));
3260
- }
3261
- function Nn(t, e, n) {
3262
- return e("children" in t ? { ...t, children: t.children.map((r) => Nn(r, e, t)) } : t, n);
3263
- }
3264
- function Ye(t, e, n) {
3265
- Object.defineProperty(t, e, { get: n, enumerable: false });
3266
- }
3267
- function Fr(t, e) {
3268
- let n = 0, r = e.length;
3269
- for (let s = t.position.end.offset - 1; s < r; s++) {
3270
- let i = e[s];
3271
- if (i === `
3272
- ` && n++, n === 1 && /\S/u.test(i)) return false;
3273
- if (n === 2) return true;
3274
- }
3275
- return false;
3276
- }
3277
- function Pt(t) {
3278
- let { node: e } = t;
3279
- switch (e.type) {
3280
- case "tag":
3281
- case "anchor":
3282
- case "comment":
3283
- return false;
3284
- }
3285
- let n = t.stack.length;
3286
- for (let r = 1; r < n; r++) {
3287
- let s = t.stack[r], i = t.stack[r - 1];
3288
- if (Array.isArray(i) && typeof s == "number" && s !== i.length - 1) return false;
3289
- }
3290
- return true;
3291
- }
3292
- function It(t) {
3293
- return De(t.children) ? It(x(false, t.children, -1)) : t;
3294
- }
3295
- function Br(t) {
3296
- return t.value.trim() === "prettier-ignore";
3297
- }
3298
- function qr(t) {
3299
- let { node: e } = t;
3300
- if (e.type === "documentBody") {
3301
- let n = t.parent.head;
3302
- return I(n) && Br(x(false, n.endComments, -1));
3303
- }
3304
- return ee(e) && Br(x(false, e.leadingComments, -1));
3305
- }
3306
- function $e(t) {
3307
- return !De(t.children) && !oo(t);
3308
- }
3309
- function oo(t) {
3310
- return ee(t) || ie(t) || On(t) || V(t) || I(t);
3311
- }
3312
- function ee(t) {
3313
- return De(t == null ? void 0 : t.leadingComments);
3314
- }
3315
- function ie(t) {
3316
- return De(t == null ? void 0 : t.middleComments);
3317
- }
3318
- function On(t) {
3319
- return t == null ? void 0 : t.indicatorComment;
3320
- }
3321
- function V(t) {
3322
- return t == null ? void 0 : t.trailingComment;
3323
- }
3324
- function I(t) {
3325
- return De(t == null ? void 0 : t.endComments);
3326
- }
3327
- function Ur(t) {
3328
- let e = [], n;
3329
- for (let r of t.split(/( +)/u)) r !== " " ? n === " " ? e.push(r) : e.push((e.pop() || "") + r) : n === void 0 && e.unshift(""), n = r;
3330
- return n === " " && e.push((e.pop() || "") + " "), e[0] === "" && (e.shift(), e.unshift(" " + (e.shift() || ""))), e;
3331
- }
3332
- function Kr(t, e, n) {
3333
- let r = e.split(`
3334
- `).map((s, i, o) => i === 0 && i === o.length - 1 ? s : i !== 0 && i !== o.length - 1 ? s.trim() : i === 0 ? s.trimEnd() : s.trimStart());
3335
- return n.proseWrap === "preserve" ? r.map((s) => s.length === 0 ? [] : [s]) : r.map((s) => s.length === 0 ? [] : Ur(s)).reduce((s, i, o) => o !== 0 && r[o - 1].length > 0 && i.length > 0 && !(t === "quoteDouble" && x(false, x(false, s, -1), -1).endsWith("\\")) ? [...s.slice(0, -1), [...x(false, s, -1), ...i]] : [...s, i], []).map((s) => n.proseWrap === "never" ? [s.join(" ")] : s);
3336
- }
3337
- function Vr(t, { parentIndent: e, isLastDescendant: n, options: r }) {
3338
- let s = t.position.start.line === t.position.end.line ? "" : r.originalText.slice(t.position.start.offset, t.position.end.offset).match(/^[^\n]*\n(.*)$/su)[1], i;
3339
- if (t.indent === null) {
3340
- let c = s.match(/^(?<leadingSpace> *)[^\n\r ]/mu);
3341
- i = c ? c.groups.leadingSpace.length : Number.POSITIVE_INFINITY;
3342
- } else i = t.indent - 1 + e;
3343
- let o = s.split(`
3344
- `).map((c) => c.slice(i));
3345
- if (r.proseWrap === "preserve" || t.type === "blockLiteral") return a(o.map((c) => c.length === 0 ? [] : [c]));
3346
- return a(o.map((c) => c.length === 0 ? [] : Ur(c)).reduce((c, l, f) => f !== 0 && o[f - 1].length > 0 && l.length > 0 && !/^\s/u.test(l[0]) && !/^\s|\s$/u.test(x(false, c, -1)) ? [...c.slice(0, -1), [...x(false, c, -1), ...l]] : [...c, l], []).map((c) => c.reduce((l, f) => l.length > 0 && /\s$/u.test(x(false, l, -1)) ? [...l.slice(0, -1), x(false, l, -1) + " " + f] : [...l, f], [])).map((c) => r.proseWrap === "never" ? [c.join(" ")] : c));
3347
- function a(c) {
3348
- if (t.chomping === "keep") return x(false, c, -1).length === 0 ? c.slice(0, -1) : c;
3349
- let l = 0;
3350
- for (let f = c.length - 1; f >= 0 && c[f].length === 0; f--) l++;
3351
- return l === 0 ? c : l >= 2 && !n ? c.slice(0, -(l - 1)) : c.slice(0, -l);
3352
- }
3353
- }
3354
- function ft(t) {
3355
- if (!t) return true;
3356
- switch (t.type) {
3357
- case "plain":
3358
- case "quoteDouble":
3359
- case "quoteSingle":
3360
- case "alias":
3361
- case "flowMapping":
3362
- case "flowSequence":
3363
- return true;
3364
- default:
3365
- return false;
3366
- }
3367
- }
3368
- var An = /* @__PURE__ */ new WeakMap();
3369
- function vt(t, e) {
3370
- let { node: n, root: r } = t, s;
3371
- return An.has(r) ? s = An.get(r) : (s = /* @__PURE__ */ new Set(), An.set(r, s)), !s.has(n.position.end.line) && (s.add(n.position.end.line), Fr(n, e) && !Ln(t.parent)) ? Ct : "";
3372
- }
3373
- function Ln(t) {
3374
- return I(t) && !K(t, ["documentHead", "documentBody", "flowMapping", "flowSequence"]);
3375
- }
3376
- function v(t, e) {
3377
- return ot(" ".repeat(t), e);
3378
- }
3379
- function ao(t, e, n) {
3380
- let { node: r } = t, s = t.ancestors.filter((l) => l.type === "sequence" || l.type === "mapping").length, i = Pt(t), o = [r.type === "blockFolded" ? ">" : "|"];
3381
- r.indent !== null && o.push(r.indent.toString()), r.chomping !== "clip" && o.push(r.chomping === "keep" ? "+" : "-"), On(r) && o.push(" ", n("indicatorComment"));
3382
- let a = Vr(r, { parentIndent: s, isLastDescendant: i, options: e }), c = [];
3383
- for (let [l, f] of a.entries()) l === 0 && c.push(N), c.push(Tt(P(ne, f))), l !== a.length - 1 ? c.push(f.length === 0 ? N : wr(it)) : r.chomping === "keep" && i && c.push(dn(f.length === 0 ? N : it));
3384
- return r.indent === null ? o.push(br(v(e.tabWidth, c))) : o.push(dn(v(r.indent - 1 + s, c))), o;
3385
- }
3386
- var jr = ao;
3387
- function _t(t, e, n) {
3388
- let { node: r } = t, s = r.type === "flowMapping", i = s ? "{" : "[", o = s ? "}" : "]", a = Ct;
3389
- s && r.children.length > 0 && e.bracketSpacing && (a = ne);
3390
- let c = x(false, r.children, -1), l = (c == null ? void 0 : c.type) === "flowMappingItem" && $e(c.key) && $e(c.value);
3391
- return [i, v(e.tabWidth, [a, co(t, e, n), e.trailingComma === "none" ? "" : at(","), I(r) ? [N, P(N, t.map(n, "endComments"))] : ""]), l ? "" : a, o];
3392
- }
3393
- function co(t, e, n) {
3394
- return t.map(({ isLast: r, node: s, next: i }) => [n(), r ? "" : [",", ne, s.position.start.line !== i.position.start.line ? vt(t, e.originalText) : ""]], "children");
3395
- }
3396
- function lo(t, e, n) {
3397
- var M;
3398
- let { node: r, parent: s } = t, { key: i, value: o } = r, a = $e(i), c = $e(o);
3399
- if (a && c) return ": ";
3400
- let l = n("key"), f = fo(r) ? " " : "";
3401
- if (c) return r.type === "flowMappingItem" && s.type === "flowMapping" ? l : r.type === "mappingItem" && Tn(i.content, e) && !V(i.content) && ((M = s.tag) == null ? void 0 : M.value) !== "tag:yaml.org,2002:set" ? [l, f, ":"] : ["? ", v(2, l)];
3402
- let m = n("value");
3403
- if (a) return [": ", v(2, m)];
3404
- if (ee(o) || !ft(i.content)) return ["? ", v(2, l), N, ...t.map(() => [n(), N], "value", "leadingComments"), ": ", v(2, m)];
3405
- if (uo(i.content) && !ee(i.content) && !ie(i.content) && !V(i.content) && !I(i) && !ee(o.content) && !ie(o.content) && !I(o) && Tn(o.content, e)) return [l, f, ": ", m];
3406
- let d = Symbol("mappingKey"), y = Re([at("? "), Re(v(2, l), { id: d })]), h = [N, ": ", v(2, m)], g = [f, ":"];
3407
- I(o) && o.content && K(o.content, ["flowMapping", "flowSequence"]) && o.content.children.length === 0 ? g.push(" ") : ee(o.content) || I(o) && o.content && !K(o.content, ["mapping", "sequence"]) || s.type === "mapping" && V(i.content) && ft(o.content) || K(o.content, ["mapping", "sequence"]) && o.content.tag === null && o.content.anchor === null ? g.push(N) : o.content ? g.push(ne) : V(o) && g.push(" "), g.push(m);
3408
- let w = v(e.tabWidth, g);
3409
- return Tn(i.content, e) && !ee(i.content) && !ie(i.content) && !I(i) ? yn([[l, w]]) : yn([[y, at(h, w, { groupId: d })]]);
3410
- }
3411
- function Tn(t, e) {
3412
- if (!t) return true;
3413
- switch (t.type) {
3414
- case "plain":
3415
- case "quoteSingle":
3416
- case "quoteDouble":
3417
- break;
3418
- case "alias":
3419
- return true;
3420
- default:
3421
- return false;
3422
- }
3423
- if (e.proseWrap === "preserve") return t.position.start.line === t.position.end.line;
3424
- if (/\\$/mu.test(e.originalText.slice(t.position.start.offset, t.position.end.offset))) return false;
3425
- switch (e.proseWrap) {
3426
- case "never":
3427
- return !t.value.includes(`
3428
- `);
3429
- case "always":
3430
- return !/[\n ]/u.test(t.value);
3431
- default:
3432
- return false;
3433
- }
3434
- }
3435
- function fo(t) {
3436
- var e;
3437
- return ((e = t.key.content) == null ? void 0 : e.type) === "alias";
3438
- }
3439
- function uo(t) {
3440
- if (!t) return true;
3441
- switch (t.type) {
3442
- case "plain":
3443
- case "quoteDouble":
3444
- case "quoteSingle":
3445
- return t.position.start.line === t.position.end.line;
3446
- case "alias":
3447
- return true;
3448
- default:
3449
- return false;
3450
- }
3451
- }
3452
- var Wr = lo;
3453
- function po(t) {
3454
- return Nn(t, mo);
3455
- }
3456
- function mo(t) {
3457
- switch (t.type) {
3458
- case "document":
3459
- Ye(t, "head", () => t.children[0]), Ye(t, "body", () => t.children[1]);
3460
- break;
3461
- case "documentBody":
3462
- case "sequenceItem":
3463
- case "flowSequenceItem":
3464
- case "mappingKey":
3465
- case "mappingValue":
3466
- Ye(t, "content", () => t.children[0]);
3467
- break;
3468
- case "mappingItem":
3469
- case "flowMappingItem":
3470
- Ye(t, "key", () => t.children[0]), Ye(t, "value", () => t.children[1]);
3471
- break;
3472
- }
3473
- return t;
3474
- }
3475
- var Qr = po;
3476
- function ho(t, e, n) {
3477
- let { node: r } = t, s = [];
3478
- r.type !== "mappingValue" && ee(r) && s.push([P(N, t.map(n, "leadingComments")), N]);
3479
- let { tag: i, anchor: o } = r;
3480
- i && s.push(n("tag")), i && o && s.push(" "), o && s.push(n("anchor"));
3481
- let a = "";
3482
- return K(r, ["mapping", "sequence", "comment", "directive", "mappingItem", "sequenceItem"]) && !Pt(t) && (a = vt(t, e.originalText)), (i || o) && (K(r, ["sequence", "mapping"]) && !ie(r) ? s.push(N) : s.push(" ")), ie(r) && s.push([r.middleComments.length === 1 ? "" : N, P(N, t.map(n, "middleComments")), N]), qr(t) ? s.push(Er(e.originalText.slice(r.position.start.offset, r.position.end.offset).trimEnd())) : s.push(Re(go(t, e, n))), V(r) && !K(r, ["document", "documentHead"]) && s.push(Nr([r.type === "mappingValue" && !r.content ? "" : " ", t.parent.type === "mappingKey" && t.getParentNode(2).type === "mapping" && ft(r) ? "" : Mt, n("trailingComment")])), Ln(r) && s.push(v(r.type === "sequenceItem" ? 2 : 0, [N, P(N, t.map(({ node: c }) => [Or(e.originalText, xe(c)) ? N : "", n()], "endComments"))])), s.push(a), s;
3483
- }
3484
- function go(t, e, n) {
3485
- let { node: r } = t;
3486
- switch (r.type) {
3487
- case "root": {
3488
- let s = [];
3489
- t.each(({ node: o, next: a, isFirst: c }) => {
3490
- c || s.push(N), s.push(n()), Gr(o, a) ? (s.push(N, "..."), V(o) && s.push(" ", n("trailingComment"))) : a && !V(a.head) && s.push(N, "---");
3491
- }, "children");
3492
- let i = It(r);
3493
- return (!K(i, ["blockLiteral", "blockFolded"]) || i.chomping !== "keep") && s.push(N), s;
3494
- }
3495
- case "document": {
3496
- let s = [];
3497
- return Eo(t, e) === "head" && ((r.head.children.length > 0 || r.head.endComments.length > 0) && s.push(n("head")), V(r.head) ? s.push(["---", " ", n(["head", "trailingComment"])]) : s.push("---")), yo(r) && s.push(n("body")), P(N, s);
3498
- }
3499
- case "documentHead":
3500
- return P(N, [...t.map(n, "children"), ...t.map(n, "endComments")]);
3501
- case "documentBody": {
3502
- let { children: s, endComments: i } = r, o = "";
3503
- if (s.length > 0 && i.length > 0) {
3504
- let a = It(r);
3505
- K(a, ["blockFolded", "blockLiteral"]) ? a.chomping !== "keep" && (o = [N, N]) : o = N;
3506
- }
3507
- return [P(N, t.map(n, "children")), o, P(N, t.map(n, "endComments"))];
3508
- }
3509
- case "directive":
3510
- return ["%", P(" ", [r.name, ...r.parameters])];
3511
- case "comment":
3512
- return ["#", r.value];
3513
- case "alias":
3514
- return ["*", r.value];
3515
- case "tag":
3516
- return e.originalText.slice(r.position.start.offset, r.position.end.offset);
3517
- case "anchor":
3518
- return ["&", r.value];
3519
- case "plain":
3520
- return ut(r.type, e.originalText.slice(r.position.start.offset, r.position.end.offset), e);
3521
- case "quoteDouble":
3522
- case "quoteSingle": {
3523
- let s = "'", i = '"', o = e.originalText.slice(r.position.start.offset + 1, r.position.end.offset - 1);
3524
- if (r.type === "quoteSingle" && o.includes("\\") || r.type === "quoteDouble" && /\\[^"]/u.test(o)) {
3525
- let c = r.type === "quoteDouble" ? i : s;
3526
- return [c, ut(r.type, o, e), c];
3527
- }
3528
- if (o.includes(i)) return [s, ut(r.type, r.type === "quoteDouble" ? At(false, At(false, o, String.raw`\"`, i), "'", s.repeat(2)) : o, e), s];
3529
- if (o.includes(s)) return [i, ut(r.type, r.type === "quoteSingle" ? At(false, o, "''", s) : o, e), i];
3530
- let a = e.singleQuote ? s : i;
3531
- return [a, ut(r.type, o, e), a];
3532
- }
3533
- case "blockFolded":
3534
- case "blockLiteral":
3535
- return jr(t, e, n);
3536
- case "mapping":
3537
- case "sequence":
3538
- return P(N, t.map(n, "children"));
3539
- case "sequenceItem":
3540
- return ["- ", v(2, r.content ? n("content") : "")];
3541
- case "mappingKey":
3542
- case "mappingValue":
3543
- return r.content ? n("content") : "";
3544
- case "mappingItem":
3545
- case "flowMappingItem":
3546
- return Wr(t, e, n);
3547
- case "flowMapping":
3548
- return _t(t, e, n);
3549
- case "flowSequence":
3550
- return _t(t, e, n);
3551
- case "flowSequenceItem":
3552
- return n("content");
3553
- default:
3554
- throw new Ar(r, "YAML");
3555
- }
3556
- }
3557
- function yo(t) {
3558
- return t.body.children.length > 0 || I(t.body);
3559
- }
3560
- function Gr(t, e) {
3561
- return V(t) || e && (e.head.children.length > 0 || I(e.head));
3562
- }
3563
- function Eo(t, e) {
3564
- let n = t.node;
3565
- if (t.isFirst && /---(?:\s|$)/u.test(e.originalText.slice(xe(n), xe(n) + 4)) || n.head.children.length > 0 || I(n.head) || V(n.head)) return "head";
3566
- let r = t.next;
3567
- return Gr(n, r) ? false : r ? "root" : false;
3568
- }
3569
- function ut(t, e, n) {
3570
- let r = Kr(t, e, n);
3571
- return P(N, r.map((s) => Tt(P(ne, s))));
3572
- }
3573
- function Hr(t, e) {
3574
- if (K(t)) switch (t.type) {
3575
- case "comment":
3576
- if (xr(t.value)) return null;
3577
- break;
3578
- case "quoteDouble":
3579
- case "quoteSingle":
3580
- e.type = "quote";
3581
- break;
3582
- }
3583
- }
3584
- Hr.ignoredProperties = /* @__PURE__ */ new Set(["position"]);
3585
- var So = { preprocess: Qr, embed: Tr, print: ho, massageAstNode: Hr, insertPragma: $r, getVisitorKeys: kr };
3586
- var Jr = So;
3587
- var Xr = [{ name: "YAML", type: "data", extensions: [".yml", ".mir", ".reek", ".rviz", ".sublime-syntax", ".syntax", ".yaml", ".yaml-tmlanguage", ".yaml.sed", ".yml.mysql"], tmScope: "source.yaml", aceMode: "yaml", aliases: ["yml"], codemirrorMode: "yaml", codemirrorMimeType: "text/x-yaml", filenames: [".clang-format", ".clang-tidy", ".clangd", ".gemrc", "CITATION.cff", "glide.lock", "pixi.lock", ".prettierrc", ".stylelintrc", ".lintstagedrc"], parsers: ["yaml"], vscodeLanguageIds: ["yaml", "ansible", "dockercompose", "github-actions-workflow", "home-assistant"], linguistLanguageId: 407 }];
3588
- var Rt = { bracketSpacing: { category: "Common", type: "boolean", default: true, description: "Print spaces between brackets.", oppositeDescription: "Do not print spaces between brackets." }, objectWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap object literals.", choices: [{ value: "preserve", description: "Keep as multi-line, if there is a newline between the opening brace and first property." }, { value: "collapse", description: "Fit to a single line when possible." }] }, singleQuote: { category: "Common", type: "boolean", default: false, description: "Use single quotes instead of double quotes." }, proseWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap prose.", choices: [{ value: "always", description: "Wrap prose if it exceeds the print width." }, { value: "never", description: "Do not wrap prose." }, { value: "preserve", description: "Wrap prose as-is." }] }, bracketSameLine: { category: "Common", type: "boolean", default: false, description: "Put > of opening tags on the last line instead of on a new line." }, singleAttributePerLine: { category: "Common", type: "boolean", default: false, description: "Enforce single attribute per line in HTML, Vue and JSX." } };
3589
- var wo = { bracketSpacing: Rt.bracketSpacing, singleQuote: Rt.singleQuote, proseWrap: Rt.proseWrap };
3590
- var zr = wo;
3591
- var hr = {};
3592
- yr(hr, { yaml: () => nc });
3593
- var mr = cn(tr(), 1);
3594
- var H = cn(Bs(), 1);
3595
- var sf = H.default.findPair;
3596
- var of = H.default.toJSON;
3597
- var af = H.default.parseMap;
3598
- var cf = H.default.parseSeq;
3599
- var lf = H.default.stringifyNumber;
3600
- var ff = H.default.stringifyString;
3601
- var uf = H.default.Type;
3602
- var pf = H.default.YAMLError;
3603
- var mf = H.default.YAMLReferenceError;
3604
- var Fs = H.default.YAMLSemanticError;
3605
- var hf = H.default.YAMLSyntaxError;
3606
- var gf = H.default.YAMLWarning;
3607
- function B(t, e = null) {
3608
- "children" in t && t.children.forEach((n) => B(n, t)), "anchor" in t && t.anchor && B(t.anchor, t), "tag" in t && t.tag && B(t.tag, t), "leadingComments" in t && t.leadingComments.forEach((n) => B(n, t)), "middleComments" in t && t.middleComments.forEach((n) => B(n, t)), "indicatorComment" in t && t.indicatorComment && B(t.indicatorComment, t), "trailingComment" in t && t.trailingComment && B(t.trailingComment, t), "endComments" in t && t.endComments.forEach((n) => B(n, t)), Object.defineProperty(t, "_parent", { value: e, enumerable: false });
3609
- }
3610
- function Ae(t) {
3611
- return `${t.line}:${t.column}`;
3612
- }
3613
- function qs(t) {
3614
- B(t);
3615
- let e = Fa(t), n = t.children.slice();
3616
- t.comments.sort((r, s) => r.position.start.offset - s.position.end.offset).filter((r) => !r._parent).forEach((r) => {
3617
- for (; n.length > 1 && r.position.start.line > n[0].position.end.line; ) n.shift();
3618
- qa(r, e, n[0]);
3619
- });
3620
- }
3621
- function Fa(t) {
3622
- let e = Array.from(new Array(t.position.end.line), () => ({}));
3623
- for (let n of t.comments) e[n.position.start.line - 1].comment = n;
3624
- return Us(e, t), e;
3625
- }
3626
- function Us(t, e) {
3627
- if (e.position.start.offset !== e.position.end.offset) {
3628
- if ("leadingComments" in e) {
3629
- let { start: n } = e.position, { leadingAttachableNode: r } = t[n.line - 1];
3630
- (!r || n.column < r.position.start.column) && (t[n.line - 1].leadingAttachableNode = e);
3631
- }
3632
- if ("trailingComment" in e && e.position.end.column > 1 && e.type !== "document" && e.type !== "documentHead") {
3633
- let { end: n } = e.position, { trailingAttachableNode: r } = t[n.line - 1];
3634
- (!r || n.column >= r.position.end.column) && (t[n.line - 1].trailingAttachableNode = e);
3635
- }
3636
- if (e.type !== "root" && e.type !== "document" && e.type !== "documentHead" && e.type !== "documentBody") {
3637
- let { start: n, end: r } = e.position, s = [r.line].concat(n.line === r.line ? [] : n.line);
3638
- for (let i of s) {
3639
- let o = t[i - 1].trailingNode;
3640
- (!o || r.column >= o.position.end.column) && (t[i - 1].trailingNode = e);
3641
- }
3642
- }
3643
- "children" in e && e.children.forEach((n) => {
3644
- Us(t, n);
3645
- });
3646
- }
3647
- }
3648
- function qa(t, e, n) {
3649
- let r = t.position.start.line, { trailingAttachableNode: s } = e[r - 1];
3650
- if (s) {
3651
- if (s.trailingComment) throw new Error(`Unexpected multiple trailing comment at ${Ae(t.position.start)}`);
3652
- B(t, s), s.trailingComment = t;
3653
- return;
3654
- }
3655
- for (let o = r; o >= n.position.start.line; o--) {
3656
- let { trailingNode: a } = e[o - 1], c;
3657
- if (a) c = a;
3658
- else if (o !== r && e[o - 1].comment) c = e[o - 1].comment._parent;
3659
- else continue;
3660
- if ((c.type === "sequence" || c.type === "mapping") && (c = c.children[0]), c.type === "mappingItem") {
3661
- let [l, f] = c.children;
3662
- c = Ks(l) ? l : f;
3663
- }
3664
- for (; ; ) {
3665
- if (Ua(c, t)) {
3666
- B(t, c), c.endComments.push(t);
3667
- return;
3668
- }
3669
- if (!c._parent) break;
3670
- c = c._parent;
3671
- }
3672
- break;
3673
- }
3674
- for (let o = r + 1; o <= n.position.end.line; o++) {
3675
- let { leadingAttachableNode: a } = e[o - 1];
3676
- if (a) {
3677
- B(t, a), a.leadingComments.push(t);
3678
- return;
3679
- }
3680
- }
3681
- let i = n.children[1];
3682
- B(t, i), i.endComments.push(t);
3683
- }
3684
- function Ua(t, e) {
3685
- if (t.position.start.offset < e.position.start.offset && t.position.end.offset > e.position.end.offset) switch (t.type) {
3686
- case "flowMapping":
3687
- case "flowSequence":
3688
- return t.children.length === 0 || e.position.start.line > t.children[t.children.length - 1].position.end.line;
3689
- }
3690
- if (e.position.end.offset < t.position.end.offset) return false;
3691
- switch (t.type) {
3692
- case "sequenceItem":
3693
- return e.position.start.column > t.position.start.column;
3694
- case "mappingKey":
3695
- case "mappingValue":
3696
- return e.position.start.column > t._parent.position.start.column && (t.children.length === 0 || t.children.length === 1 && t.children[0].type !== "blockFolded" && t.children[0].type !== "blockLiteral") && (t.type === "mappingValue" || Ks(t));
3697
- default:
3698
- return false;
3699
- }
3700
- }
3701
- function Ks(t) {
3702
- return t.position.start !== t.position.end && (t.children.length === 0 || t.position.start.offset !== t.children[0].position.start.offset);
3703
- }
3704
- function b(t, e) {
3705
- return { type: t, position: e };
3706
- }
3707
- function Vs(t, e, n) {
3708
- return { ...b("root", t), children: e, comments: n };
3709
- }
3710
- function wt(t) {
3711
- switch (t.type) {
3712
- case "DOCUMENT":
3713
- for (let e = t.contents.length - 1; e >= 0; e--) t.contents[e].type === "BLANK_LINE" ? t.contents.splice(e, 1) : wt(t.contents[e]);
3714
- for (let e = t.directives.length - 1; e >= 0; e--) t.directives[e].type === "BLANK_LINE" && t.directives.splice(e, 1);
3715
- break;
3716
- case "FLOW_MAP":
3717
- case "FLOW_SEQ":
3718
- case "MAP":
3719
- case "SEQ":
3720
- for (let e = t.items.length - 1; e >= 0; e--) {
3721
- let n = t.items[e];
3722
- "char" in n || (n.type === "BLANK_LINE" ? t.items.splice(e, 1) : wt(n));
3723
- }
3724
- break;
3725
- case "MAP_KEY":
3726
- case "MAP_VALUE":
3727
- case "SEQ_ITEM":
3728
- t.node && wt(t.node);
3729
- break;
3730
- case "ALIAS":
3731
- case "BLANK_LINE":
3732
- case "BLOCK_FOLDED":
3733
- case "BLOCK_LITERAL":
3734
- case "COMMENT":
3735
- case "DIRECTIVE":
3736
- case "PLAIN":
3737
- case "QUOTE_DOUBLE":
3738
- case "QUOTE_SINGLE":
3739
- break;
3740
- default:
3741
- throw new Error(`Unexpected node type ${JSON.stringify(t.type)}`);
3742
- }
3743
- }
3744
- function J(t, e) {
3745
- return { start: t, end: e };
3746
- }
3747
- function nr(t) {
3748
- return { start: t, end: t };
3749
- }
3750
- var ue;
3751
- (function(t) {
3752
- t.Tag = "!", t.Anchor = "&", t.Comment = "#";
3753
- })(ue || (ue = {}));
3754
- function js(t, e) {
3755
- return { ...b("anchor", t), value: e };
3756
- }
3757
- function Ge(t, e) {
3758
- return { ...b("comment", t), value: e };
3759
- }
3760
- function Ws(t, e, n) {
3761
- return { anchor: e, tag: t, middleComments: n };
3762
- }
3763
- function Qs(t, e) {
3764
- return { ...b("tag", t), value: e };
3765
- }
3766
- function zt(t, e, n = () => false) {
3767
- let r = t.cstNode, s = [], i = null, o = null, a = null;
3768
- for (let c of r.props) {
3769
- let l = e.text[c.origStart];
3770
- switch (l) {
3771
- case ue.Tag:
3772
- i = i || c, o = Qs(e.transformRange(c), t.tag);
3773
- break;
3774
- case ue.Anchor:
3775
- i = i || c, a = js(e.transformRange(c), r.anchor);
3776
- break;
3777
- case ue.Comment: {
3778
- let f = Ge(e.transformRange(c), e.text.slice(c.origStart + 1, c.origEnd));
3779
- e.comments.push(f), !n(f) && i && i.origEnd <= c.origStart && c.origEnd <= r.valueRange.origStart && s.push(f);
3780
- break;
3781
- }
3782
- default:
3783
- throw new Error(`Unexpected leading character ${JSON.stringify(l)}`);
3784
- }
3785
- }
3786
- return Ws(o, a, s);
3787
- }
3788
- function X() {
3789
- return { leadingComments: [] };
3790
- }
3791
- function pe(t = null) {
3792
- return { trailingComment: t };
3793
- }
3794
- function F() {
3795
- return { ...X(), ...pe() };
3796
- }
3797
- function Gs(t, e, n) {
3798
- return { ...b("alias", t), ...F(), ...e, value: n };
3799
- }
3800
- function Hs(t, e) {
3801
- let n = t.cstNode;
3802
- return Gs(e.transformRange({ origStart: n.valueRange.origStart - 1, origEnd: n.valueRange.origEnd }), e.transformContent(t), n.rawValue);
3803
- }
3804
- function Js(t) {
3805
- return { ...t, type: "blockFolded" };
3806
- }
3807
- function Xs(t, e, n, r, s, i) {
3808
- return { ...b("blockValue", t), ...X(), ...e, chomping: n, indent: r, value: s, indicatorComment: i };
3809
- }
3810
- var rr;
3811
- (function(t) {
3812
- t.CLIP = "clip", t.STRIP = "strip", t.KEEP = "keep";
3813
- })(rr || (rr = {}));
3814
- function Zt(t, e) {
3815
- let n = t.cstNode, r = 1, s = n.chomping === "CLIP" ? 0 : 1, o = n.header.origEnd - n.header.origStart - r - s !== 0, a = e.transformRange({ origStart: n.header.origStart, origEnd: n.valueRange.origEnd }), c = null, l = zt(t, e, (f) => {
3816
- if (!(a.start.offset < f.position.start.offset && f.position.end.offset < a.end.offset)) return false;
3817
- if (c) throw new Error(`Unexpected multiple indicator comments at ${Ae(f.position.start)}`);
3818
- return c = f, true;
3819
- });
3820
- return Xs(a, l, rr[n.chomping], o ? n.blockIndent : null, n.strValue, c);
3821
- }
3822
- function zs(t, e) {
3823
- return Js(Zt(t, e));
3824
- }
3825
- function Zs(t) {
3826
- return { ...t, type: "blockLiteral" };
3827
- }
3828
- function ei(t, e) {
3829
- return Zs(Zt(t, e));
3830
- }
3831
- function ti(t, e) {
3832
- return Ge(e.transformRange(t.range), t.comment);
3833
- }
3834
- function ni(t, e, n) {
3835
- return { ...b("directive", t), ...F(), name: e, parameters: n };
3836
- }
3837
- function He(t, e) {
3838
- for (let n of t.props) {
3839
- let r = e.text[n.origStart];
3840
- switch (r) {
3841
- case ue.Comment:
3842
- e.comments.push(Ge(e.transformRange(n), e.text.slice(n.origStart + 1, n.origEnd)));
3843
- break;
3844
- default:
3845
- throw new Error(`Unexpected leading character ${JSON.stringify(r)}`);
3846
- }
3847
- }
3848
- }
3849
- function ri(t, e) {
3850
- return He(t, e), ni(e.transformRange(t.range), t.name, t.parameters);
3851
- }
3852
- function si(t, e, n, r) {
3853
- return { ...b("document", t), ...pe(r), children: [e, n] };
3854
- }
3855
- function q(t = []) {
3856
- return { endComments: t };
3857
- }
3858
- function ii(t, e, n) {
3859
- return { ...b("documentBody", t), ...q(n), children: e ? [e] : [] };
3860
- }
3861
- function U(t) {
3862
- return t[t.length - 1];
3863
- }
3864
- function en(t, e) {
3865
- let n = t.match(e);
3866
- return n ? n.index : -1;
3867
- }
3868
- function oi(t, e, n) {
3869
- let r = t.cstNode, { comments: s, endComments: i, documentTrailingComment: o, documentHeadTrailingComment: a } = Ka(r, e, n), c = e.transformNode(t.contents), { position: l, documentEndPoint: f } = Va(r, c, e);
3870
- return e.comments.push(...s, ...i), { documentBody: ii(l, c, i), documentEndPoint: f, documentTrailingComment: o, documentHeadTrailingComment: a };
3871
- }
3872
- function Ka(t, e, n) {
3873
- let r = [], s = [], i = [], o = [], a = false;
3874
- for (let c = t.contents.length - 1; c >= 0; c--) {
3875
- let l = t.contents[c];
3876
- if (l.type === "COMMENT") {
3877
- let f = e.transformNode(l);
3878
- n && n.line === f.position.start.line ? o.unshift(f) : a ? r.unshift(f) : f.position.start.offset >= t.valueRange.origEnd ? i.unshift(f) : r.unshift(f);
3879
- } else a = true;
3880
- }
3881
- if (i.length > 1) throw new Error(`Unexpected multiple document trailing comments at ${Ae(i[1].position.start)}`);
3882
- if (o.length > 1) throw new Error(`Unexpected multiple documentHead trailing comments at ${Ae(o[1].position.start)}`);
3883
- return { comments: r, endComments: s, documentTrailingComment: U(i) || null, documentHeadTrailingComment: U(o) || null };
3884
- }
3885
- function Va(t, e, n) {
3886
- let r = en(n.text.slice(t.valueRange.origEnd), /^\.\.\./), s = r === -1 ? t.valueRange.origEnd : Math.max(0, t.valueRange.origEnd - 1);
3887
- n.text[s - 1] === "\r" && s--;
3888
- let i = n.transformRange({ origStart: e !== null ? e.position.start.offset : s, origEnd: s }), o = r === -1 ? i.end : n.transformOffset(t.valueRange.origEnd + 3);
3889
- return { position: i, documentEndPoint: o };
3890
- }
3891
- function ai(t, e, n, r) {
3892
- return { ...b("documentHead", t), ...q(n), ...pe(r), children: e };
3893
- }
3894
- function ci(t, e) {
3895
- let n = t.cstNode, { directives: r, comments: s, endComments: i } = ja(n, e), { position: o, endMarkerPoint: a } = Wa(n, r, e);
3896
- return e.comments.push(...s, ...i), { createDocumentHeadWithTrailingComment: (l) => (l && e.comments.push(l), ai(o, r, i, l)), documentHeadEndMarkerPoint: a };
3897
- }
3898
- function ja(t, e) {
3899
- let n = [], r = [], s = [], i = false;
3900
- for (let o = t.directives.length - 1; o >= 0; o--) {
3901
- let a = e.transformNode(t.directives[o]);
3902
- a.type === "comment" ? i ? r.unshift(a) : s.unshift(a) : (i = true, n.unshift(a));
3903
- }
3904
- return { directives: n, comments: r, endComments: s };
3905
- }
3906
- function Wa(t, e, n) {
3907
- let r = en(n.text.slice(0, t.valueRange.origStart), /---\s*$/);
3908
- r > 0 && !/[\r\n]/.test(n.text[r - 1]) && (r = -1);
3909
- let s = r === -1 ? { origStart: t.valueRange.origStart, origEnd: t.valueRange.origStart } : { origStart: r, origEnd: r + 3 };
3910
- return e.length !== 0 && (s.origStart = e[0].position.start.offset), { position: n.transformRange(s), endMarkerPoint: r === -1 ? null : n.transformOffset(r) };
3911
- }
3912
- function li(t, e) {
3913
- let { createDocumentHeadWithTrailingComment: n, documentHeadEndMarkerPoint: r } = ci(t, e), { documentBody: s, documentEndPoint: i, documentTrailingComment: o, documentHeadTrailingComment: a } = oi(t, e, r), c = n(a);
3914
- return o && e.comments.push(o), si(J(c.position.start, i), c, s, o);
3915
- }
3916
- function tn(t, e, n) {
3917
- return { ...b("flowCollection", t), ...F(), ...q(), ...e, children: n };
3918
- }
3919
- function fi(t, e, n) {
3920
- return { ...tn(t, e, n), type: "flowMapping" };
3921
- }
3922
- function nn(t, e, n) {
3923
- return { ...b("flowMappingItem", t), ...X(), children: [e, n] };
3924
- }
3925
- function me(t, e) {
3926
- let n = [];
3927
- for (let r of t) r && "type" in r && r.type === "COMMENT" ? e.comments.push(e.transformNode(r)) : n.push(r);
3928
- return n;
3929
- }
3930
- function rn(t) {
3931
- let [e, n] = ["?", ":"].map((r) => {
3932
- let s = t.find((i) => "char" in i && i.char === r);
3933
- return s ? { origStart: s.origOffset, origEnd: s.origOffset + 1 } : null;
3934
- });
3935
- return { additionalKeyRange: e, additionalValueRange: n };
3936
- }
3937
- function sn(t, e) {
3938
- let n = e;
3939
- return (r) => t.slice(n, n = r);
3940
- }
3941
- function on(t) {
3942
- let e = [], n = sn(t, 1), r = false;
3943
- for (let s = 1; s < t.length - 1; s++) {
3944
- let i = t[s];
3945
- if ("char" in i && i.char === ",") {
3946
- e.push(n(s)), n(s + 1), r = false;
3947
- continue;
3948
- }
3949
- r = true;
3950
- }
3951
- return r && e.push(n(t.length - 1)), e;
3952
- }
3953
- function sr(t, e) {
3954
- return { ...b("mappingKey", t), ...pe(), ...q(), children: e ? [e] : [] };
3955
- }
3956
- function ir(t, e) {
3957
- return { ...b("mappingValue", t), ...F(), ...q(), children: e ? [e] : [] };
3958
- }
3959
- function Je(t, e, n, r, s) {
3960
- let i = e.transformNode(t.key), o = e.transformNode(t.value), a = i || r ? sr(e.transformRange({ origStart: r ? r.origStart : i.position.start.offset, origEnd: i ? i.position.end.offset : r.origStart + 1 }), i) : null, c = o || s ? ir(e.transformRange({ origStart: s ? s.origStart : o.position.start.offset, origEnd: o ? o.position.end.offset : s.origStart + 1 }), o) : null;
3961
- return n(J(a ? a.position.start : c.position.start, c ? c.position.end : a.position.end), a || sr(nr(c.position.start), null), c || ir(nr(a.position.end), null));
3962
- }
3963
- function ui(t, e) {
3964
- let n = me(t.cstNode.items, e), r = on(n), s = t.items.map((a, c) => {
3965
- let l = r[c], { additionalKeyRange: f, additionalValueRange: m } = rn(l);
3966
- return Je(a, e, nn, f, m);
3967
- }), i = n[0], o = U(n);
3968
- return fi(e.transformRange({ origStart: i.origOffset, origEnd: o.origOffset + 1 }), e.transformContent(t), s);
3969
- }
3970
- function pi(t, e, n) {
3971
- return { ...tn(t, e, n), type: "flowSequence" };
3972
- }
3973
- function mi(t, e) {
3974
- return { ...b("flowSequenceItem", t), children: [e] };
3975
- }
3976
- function hi(t, e) {
3977
- let n = me(t.cstNode.items, e), r = on(n), s = t.items.map((a, c) => {
3978
- if (a.type !== "PAIR") {
3979
- let l = e.transformNode(a);
3980
- return mi(J(l.position.start, l.position.end), l);
3981
- } else {
3982
- let l = r[c], { additionalKeyRange: f, additionalValueRange: m } = rn(l);
3983
- return Je(a, e, nn, f, m);
3984
- }
3985
- }), i = n[0], o = U(n);
3986
- return pi(e.transformRange({ origStart: i.origOffset, origEnd: o.origOffset + 1 }), e.transformContent(t), s);
3987
- }
3988
- function gi(t, e, n) {
3989
- return { ...b("mapping", t), ...X(), ...e, children: n };
3990
- }
3991
- function di(t, e, n) {
3992
- return { ...b("mappingItem", t), ...X(), children: [e, n] };
3993
- }
3994
- function yi(t, e) {
3995
- let n = t.cstNode;
3996
- n.items.filter((o) => o.type === "MAP_KEY" || o.type === "MAP_VALUE").forEach((o) => He(o, e));
3997
- let r = me(n.items, e), s = Qa(r), i = t.items.map((o, a) => {
3998
- let c = s[a], [l, f] = c[0].type === "MAP_VALUE" ? [null, c[0].range] : [c[0].range, c.length === 1 ? null : c[1].range];
3999
- return Je(o, e, di, l, f);
4000
- });
4001
- return gi(J(i[0].position.start, U(i).position.end), e.transformContent(t), i);
4002
- }
4003
- function Qa(t) {
4004
- let e = [], n = sn(t, 0), r = false;
4005
- for (let s = 0; s < t.length; s++) {
4006
- if (t[s].type === "MAP_VALUE") {
4007
- e.push(n(s + 1)), r = false;
4008
- continue;
4009
- }
4010
- r && e.push(n(s)), r = true;
4011
- }
4012
- return r && e.push(n(1 / 0)), e;
4013
- }
4014
- function Ei(t, e, n) {
4015
- return { ...b("plain", t), ...F(), ...e, value: n };
4016
- }
4017
- function Si(t, e, n) {
4018
- for (let r = e; r >= 0; r--) if (n.test(t[r])) return r;
4019
- return -1;
4020
- }
4021
- function wi(t, e) {
4022
- let n = t.cstNode;
4023
- return Ei(e.transformRange({ origStart: n.valueRange.origStart, origEnd: Si(e.text, n.valueRange.origEnd - 1, /\S/) + 1 }), e.transformContent(t), n.strValue);
4024
- }
4025
- function bi(t) {
4026
- return { ...t, type: "quoteDouble" };
4027
- }
4028
- function Ni(t, e, n) {
4029
- return { ...b("quoteValue", t), ...e, ...F(), value: n };
4030
- }
4031
- function an(t, e) {
4032
- let n = t.cstNode;
4033
- return Ni(e.transformRange(n.valueRange), e.transformContent(t), n.strValue);
4034
- }
4035
- function Oi(t, e) {
4036
- return bi(an(t, e));
4037
- }
4038
- function Ai(t) {
4039
- return { ...t, type: "quoteSingle" };
4040
- }
4041
- function Li(t, e) {
4042
- return Ai(an(t, e));
4043
- }
4044
- function Ti(t, e, n) {
4045
- return { ...b("sequence", t), ...X(), ...q(), ...e, children: n };
4046
- }
4047
- function Mi(t, e) {
4048
- return { ...b("sequenceItem", t), ...F(), ...q(), children: e ? [e] : [] };
4049
- }
4050
- function Ci(t, e) {
4051
- let r = me(t.cstNode.items, e).map((s, i) => {
4052
- He(s, e);
4053
- let o = e.transformNode(t.items[i]);
4054
- return Mi(J(e.transformOffset(s.valueRange.origStart), o === null ? e.transformOffset(s.valueRange.origStart + 1) : o.position.end), o);
4055
- });
4056
- return Ti(J(r[0].position.start, U(r).position.end), e.transformContent(t), r);
4057
- }
4058
- function ki(t, e) {
4059
- if (t === null || t.type === void 0 && t.value === null) return null;
4060
- switch (t.type) {
4061
- case "ALIAS":
4062
- return Hs(t, e);
4063
- case "BLOCK_FOLDED":
4064
- return zs(t, e);
4065
- case "BLOCK_LITERAL":
4066
- return ei(t, e);
4067
- case "COMMENT":
4068
- return ti(t, e);
4069
- case "DIRECTIVE":
4070
- return ri(t, e);
4071
- case "DOCUMENT":
4072
- return li(t, e);
4073
- case "FLOW_MAP":
4074
- return ui(t, e);
4075
- case "FLOW_SEQ":
4076
- return hi(t, e);
4077
- case "MAP":
4078
- return yi(t, e);
4079
- case "PLAIN":
4080
- return wi(t, e);
4081
- case "QUOTE_DOUBLE":
4082
- return Oi(t, e);
4083
- case "QUOTE_SINGLE":
4084
- return Li(t, e);
4085
- case "SEQ":
4086
- return Ci(t, e);
4087
- default:
4088
- throw new Error(`Unexpected node type ${t.type}`);
4089
- }
4090
- }
4091
- var or;
4092
- var Le;
4093
- var bt;
4094
- var he;
4095
- var cr;
4096
- var lr;
4097
- var ar = class {
4098
- constructor(e, n) {
4099
- Ot(this, he);
4100
- ln(this, "text");
4101
- ln(this, "comments", []);
4102
- Ot(this, Le);
4103
- Ot(this, bt);
4104
- this.text = n, un(this, Le, e);
4105
- }
4106
- setOrigRanges() {
4107
- if (!Te(this, Le).setOrigRanges()) for (let e of Te(this, Le)) e.setOrigRanges([], 0);
4108
- }
4109
- transformOffset(e) {
4110
- return Xe(this, he, cr).call(this, { origStart: e, origEnd: e }).start;
4111
- }
4112
- transformRange(e) {
4113
- let { start: n, end: r } = Xe(this, he, cr).call(this, e);
4114
- return J(n, r);
4115
- }
4116
- transformNode(e) {
4117
- return ki(e, this);
4118
- }
4119
- transformContent(e) {
4120
- return zt(e, this);
4121
- }
4122
- };
4123
- Le = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakSet(), cr = function(e) {
4124
- if (!or) {
4125
- let [o] = Te(this, Le), a = Object.getPrototypeOf(Object.getPrototypeOf(o));
4126
- or = Object.getOwnPropertyDescriptor(a, "rangeAsLinePos").get;
4127
- }
4128
- Te(this, bt) ?? un(this, bt, { root: { context: { src: this.text } } });
4129
- let { start: { line: n, col: r }, end: { line: s, col: i } } = or.call({ range: { start: Xe(this, he, lr).call(this, e.origStart), end: Xe(this, he, lr).call(this, e.origEnd) }, context: Te(this, bt) });
4130
- return { start: { offset: e.origStart, line: n, column: r }, end: { offset: e.origEnd, line: s, column: i } };
4131
- }, lr = function(e) {
4132
- return e < 0 ? 0 : e > this.text.length ? this.text.length : e;
4133
- };
4134
- var Pi = ar;
4135
- function Ii(t, e, n) {
4136
- let r = new SyntaxError(t);
4137
- return r.name = "YAMLSyntaxError", r.source = e, r.position = n, r;
4138
- }
4139
- function vi(t, e) {
4140
- let n = t.source.range || t.source.valueRange;
4141
- return Ii(t.message, e.text, e.transformRange(n));
4142
- }
4143
- function fr(t) {
4144
- if ("children" in t) {
4145
- if (t.children.length === 1) {
4146
- let e = t.children[0];
4147
- if (e.type === "plain" && e.tag === null && e.anchor === null && e.value === "") return t.children.splice(0, 1), t;
4148
- }
4149
- t.children.forEach(fr);
4150
- }
4151
- return t;
4152
- }
4153
- function ur(t, e, n, r) {
4154
- let s = e(t);
4155
- return (i) => {
4156
- r(s, i) && n(t, s = i);
4157
- };
4158
- }
4159
- function pr(t) {
4160
- if (t === null || !("children" in t)) return;
4161
- let e = t.children;
4162
- if (e.forEach(pr), t.type === "document") {
4163
- let [i, o] = t.children;
4164
- i.position.start.offset === i.position.end.offset ? i.position.start = i.position.end = o.position.start : o.position.start.offset === o.position.end.offset && (o.position.start = o.position.end = i.position.end);
4165
- }
4166
- let n = ur(t.position, Ga, Ha, za), r = ur(t.position, Ja, Xa, Za);
4167
- "endComments" in t && t.endComments.length !== 0 && (n(t.endComments[0].position.start), r(U(t.endComments).position.end));
4168
- let s = e.filter((i) => i !== null);
4169
- if (s.length !== 0) {
4170
- let i = s[0], o = U(s);
4171
- n(i.position.start), r(o.position.end), "leadingComments" in i && i.leadingComments.length !== 0 && n(i.leadingComments[0].position.start), "tag" in i && i.tag && n(i.tag.position.start), "anchor" in i && i.anchor && n(i.anchor.position.start), "trailingComment" in o && o.trailingComment && r(o.trailingComment.position.end);
4172
- }
4173
- }
4174
- function Ga(t) {
4175
- return t.start;
4176
- }
4177
- function Ha(t, e) {
4178
- t.start = e;
4179
- }
4180
- function Ja(t) {
4181
- return t.end;
4182
- }
4183
- function Xa(t, e) {
4184
- t.end = e;
4185
- }
4186
- function za(t, e) {
4187
- return e.offset < t.offset;
4188
- }
4189
- function Za(t, e) {
4190
- return e.offset > t.offset;
4191
- }
4192
- function _i(t) {
4193
- let e = mr.default.parseCST(t), n = new Pi(e, t);
4194
- n.setOrigRanges();
4195
- let r = e.map((i) => new mr.default.Document({ merge: false, keepCstNodes: true }).parse(i));
4196
- for (let i of r) for (let o of i.errors) if (!(o instanceof Fs && o.message === 'Map keys must be unique; "<<" is repeated')) throw vi(o, n);
4197
- r.forEach((i) => wt(i.cstNode));
4198
- let s = Vs(n.transformRange({ origStart: 0, origEnd: t.length }), r.map((i) => n.transformNode(i)), n.comments);
4199
- return qs(s), pr(s), fr(s), s;
4200
- }
4201
- function ec(t, e) {
4202
- let n = new SyntaxError(t + " (" + e.loc.start.line + ":" + e.loc.start.column + ")");
4203
- return Object.assign(n, e);
4204
- }
4205
- var Ri = ec;
4206
- function tc(t) {
4207
- try {
4208
- let e = _i(t);
4209
- return delete e.comments, e;
4210
- } catch (e) {
4211
- throw e != null && e.position ? Ri(e.message, { loc: e.position, cause: e }) : e;
4212
- }
4213
- }
4214
- var nc = { astFormat: "yaml", parse: tc, hasPragma: Dr, hasIgnorePragma: Yr, locStart: xe, locEnd: Pr };
4215
- var rc = { yaml: Jr };
4216
- var xi = cn(tr(), 1);
4217
- var sc = xi.default.parse;
4218
- var Ih = gr;
4219
- export {
4220
- sc as __parsePrettierYamlConfig,
4221
- Ih as default,
4222
- Xr as languages,
4223
- zr as options,
4224
- hr as parsers,
4225
- rc as printers
4226
- };