@drzl/validation-core 3.0.0 → 3.2.0

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