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