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