@cloud-cli/on 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/dist/on.js +909 -851
  2. package/package.json +1 -1
package/dist/on.js CHANGED
@@ -2,18 +2,20 @@
2
2
  import { createServer as ms } from "node:http";
3
3
  import { parseArgs as gs } from "node:util";
4
4
  import { spawn as ys } from "node:child_process";
5
- import { readFile as et } from "node:fs/promises";
6
- import bt from "node:path";
7
- async function bs(s) {
5
+ import { readFile as tt, mkdtemp as bs, rm as ws } from "node:fs/promises";
6
+ import wt, { join as ks } from "node:path";
7
+ import { existsSync as Ss } from "node:fs";
8
+ import { tmpdir as Ns } from "node:os";
9
+ async function Os(s) {
8
10
  const e = [];
9
11
  for await (const t of s)
10
12
  e.push(Buffer.isBuffer(t) ? t : Buffer.from(t));
11
13
  return Buffer.concat(e).toString("utf8");
12
14
  }
13
- function Fe(s, e, t) {
15
+ function Re(s, e, t) {
14
16
  s.writeHead(e, { "content-type": "application/json" }).end(JSON.stringify(t));
15
17
  }
16
- function ws(s) {
18
+ function As(s) {
17
19
  const e = Number.parseInt(s, 10);
18
20
  if (!Number.isInteger(e) || e < 0 || e > 65535)
19
21
  throw new Error(
@@ -21,51 +23,40 @@ function ws(s) {
21
23
  );
22
24
  return e;
23
25
  }
24
- function tt(s) {
26
+ function st(s) {
25
27
  if (!s || typeof s != "object" || Array.isArray(s))
26
28
  throw new Error("Incoming webhook payload must be a JSON object.");
27
29
  return s;
28
30
  }
29
- function vt(s, e) {
30
- const n = e.trim().replace(/^\$\{/, "").replace(/}$/, "").split(".").filter(Boolean);
31
- let i = s;
32
- for (const r of n) {
33
- if (typeof i != "object" || i === null || !(r in i))
34
- return;
35
- i = i[r];
36
- }
37
- return i;
31
+ function Ce(s, e) {
32
+ const t = Function(
33
+ "context",
34
+ "const { secrets = {}, inputs = {}, step = {}, env } = context;return `" + s + "`;"
35
+ );
36
+ return String(t(e) || "");
38
37
  }
39
- function ks(s, e) {
40
- return s.replace(/\$\{([^}]+)}/g, (t, n) => {
41
- const i = vt(e, n);
42
- return i == null ? "" : String(i);
43
- });
44
- }
45
- function Ss(s, e) {
38
+ function Es(s, e) {
46
39
  if (!e)
47
40
  return { ...s };
48
- const t = { ...s };
49
- for (const [n, i] of Object.entries(e)) {
50
- const r = i.startsWith("${") ? i : `\${${i}}`;
51
- t[n] = vt({ inputs: t }, r);
52
- }
53
- return t;
41
+ const t = { inputs: s };
42
+ for (const [n, i] of Object.entries(e))
43
+ t.inputs[n] = Ce(`\${${i}}`, t);
44
+ return t.inputs;
54
45
  }
55
- const st = /* @__PURE__ */ Symbol.for("yaml.alias"), We = /* @__PURE__ */ Symbol.for("yaml.document"), J = /* @__PURE__ */ Symbol.for("yaml.map"), Ct = /* @__PURE__ */ Symbol.for("yaml.pair"), q = /* @__PURE__ */ Symbol.for("yaml.scalar"), oe = /* @__PURE__ */ Symbol.for("yaml.seq"), j = /* @__PURE__ */ Symbol.for("yaml.node.type"), Q = (s) => !!s && typeof s == "object" && s[j] === st, Ce = (s) => !!s && typeof s == "object" && s[j] === We, ye = (s) => !!s && typeof s == "object" && s[j] === J, $ = (s) => !!s && typeof s == "object" && s[j] === Ct, E = (s) => !!s && typeof s == "object" && s[j] === q, be = (s) => !!s && typeof s == "object" && s[j] === oe;
46
+ const nt = /* @__PURE__ */ Symbol.for("yaml.alias"), Qe = /* @__PURE__ */ Symbol.for("yaml.document"), J = /* @__PURE__ */ Symbol.for("yaml.map"), Ct = /* @__PURE__ */ Symbol.for("yaml.pair"), q = /* @__PURE__ */ Symbol.for("yaml.scalar"), oe = /* @__PURE__ */ Symbol.for("yaml.seq"), P = /* @__PURE__ */ Symbol.for("yaml.node.type"), Q = (s) => !!s && typeof s == "object" && s[P] === nt, _e = (s) => !!s && typeof s == "object" && s[P] === Qe, ye = (s) => !!s && typeof s == "object" && s[P] === J, L = (s) => !!s && typeof s == "object" && s[P] === Ct, T = (s) => !!s && typeof s == "object" && s[P] === q, be = (s) => !!s && typeof s == "object" && s[P] === oe;
56
47
  function I(s) {
57
48
  if (s && typeof s == "object")
58
- switch (s[j]) {
49
+ switch (s[P]) {
59
50
  case J:
60
51
  case oe:
61
52
  return !0;
62
53
  }
63
54
  return !1;
64
55
  }
65
- function L(s) {
56
+ function $(s) {
66
57
  if (s && typeof s == "object")
67
- switch (s[j]) {
68
- case st:
58
+ switch (s[P]) {
59
+ case nt:
69
60
  case J:
70
61
  case q:
71
62
  case oe:
@@ -73,18 +64,18 @@ function L(s) {
73
64
  }
74
65
  return !1;
75
66
  }
76
- const _t = (s) => (E(s) || I(s)) && !!s.anchor, Y = /* @__PURE__ */ Symbol("break visit"), Ns = /* @__PURE__ */ Symbol("skip children"), de = /* @__PURE__ */ Symbol("remove node");
77
- function le(s, e) {
78
- const t = Os(e);
79
- Ce(s) ? Z(null, s.contents, t, Object.freeze([s])) === de && (s.contents = null) : Z(null, s, t, Object.freeze([]));
67
+ const _t = (s) => (T(s) || I(s)) && !!s.anchor, Y = /* @__PURE__ */ Symbol("break visit"), Ts = /* @__PURE__ */ Symbol("skip children"), de = /* @__PURE__ */ Symbol("remove node");
68
+ function ae(s, e) {
69
+ const t = Is(e);
70
+ _e(s) ? Z(null, s.contents, t, Object.freeze([s])) === de && (s.contents = null) : Z(null, s, t, Object.freeze([]));
80
71
  }
81
- le.BREAK = Y;
82
- le.SKIP = Ns;
83
- le.REMOVE = de;
72
+ ae.BREAK = Y;
73
+ ae.SKIP = Ts;
74
+ ae.REMOVE = de;
84
75
  function Z(s, e, t, n) {
85
- const i = As(s, e, t, n);
86
- if (L(i) || $(i))
87
- return Ts(s, n, i), Z(s, i, t, n);
76
+ const i = $s(s, e, t, n);
77
+ if ($(i) || L(i))
78
+ return Ls(s, n, i), Z(s, i, t, n);
88
79
  if (typeof i != "symbol") {
89
80
  if (I(e)) {
90
81
  n = Object.freeze(n.concat(e));
@@ -98,7 +89,7 @@ function Z(s, e, t, n) {
98
89
  o === de && (e.items.splice(r, 1), r -= 1);
99
90
  }
100
91
  }
101
- } else if ($(e)) {
92
+ } else if (L(e)) {
102
93
  n = Object.freeze(n.concat(e));
103
94
  const r = Z("key", e.key, t, n);
104
95
  if (r === Y)
@@ -112,7 +103,7 @@ function Z(s, e, t, n) {
112
103
  }
113
104
  return i;
114
105
  }
115
- function Os(s) {
106
+ function Is(s) {
116
107
  return typeof s == "object" && (s.Collection || s.Node || s.Value) ? Object.assign({
117
108
  Alias: s.Node,
118
109
  Map: s.Node,
@@ -127,41 +118,41 @@ function Os(s) {
127
118
  Seq: s.Collection
128
119
  }, s) : s;
129
120
  }
130
- function As(s, e, t, n) {
121
+ function $s(s, e, t, n) {
131
122
  if (typeof t == "function")
132
123
  return t(s, e, n);
133
124
  if (ye(e))
134
125
  return t.Map?.(s, e, n);
135
126
  if (be(e))
136
127
  return t.Seq?.(s, e, n);
137
- if ($(e))
128
+ if (L(e))
138
129
  return t.Pair?.(s, e, n);
139
- if (E(e))
130
+ if (T(e))
140
131
  return t.Scalar?.(s, e, n);
141
132
  if (Q(e))
142
133
  return t.Alias?.(s, e, n);
143
134
  }
144
- function Ts(s, e, t) {
135
+ function Ls(s, e, t) {
145
136
  const n = e[e.length - 1];
146
137
  if (I(n))
147
138
  n.items[s] = t;
148
- else if ($(n))
139
+ else if (L(n))
149
140
  s === "key" ? n.key = t : n.value = t;
150
- else if (Ce(n))
141
+ else if (_e(n))
151
142
  n.contents = t;
152
143
  else {
153
144
  const i = Q(n) ? "alias" : "scalar";
154
145
  throw new Error(`Cannot replace node with ${i} parent`);
155
146
  }
156
147
  }
157
- const Es = {
148
+ const vs = {
158
149
  "!": "%21",
159
150
  ",": "%2C",
160
151
  "[": "%5B",
161
152
  "]": "%5D",
162
153
  "{": "%7B",
163
154
  "}": "%7D"
164
- }, Is = (s) => s.replace(/[!,[\]{}]/g, (e) => Es[e]);
155
+ }, Cs = (s) => s.replace(/[!,[\]{}]/g, (e) => vs[e]);
165
156
  class _ {
166
157
  constructor(e, t) {
167
158
  this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, _.defaultYaml, e), this.tags = Object.assign({}, _.defaultTags, t);
@@ -251,21 +242,21 @@ class _ {
251
242
  tagString(e) {
252
243
  for (const [t, n] of Object.entries(this.tags))
253
244
  if (e.startsWith(n))
254
- return t + Is(e.substring(n.length));
245
+ return t + Cs(e.substring(n.length));
255
246
  return e[0] === "!" ? e : `!<${e}>`;
256
247
  }
257
248
  toString(e) {
258
249
  const t = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [], n = Object.entries(this.tags);
259
250
  let i;
260
- if (e && n.length > 0 && L(e.contents)) {
251
+ if (e && n.length > 0 && $(e.contents)) {
261
252
  const r = {};
262
- le(e.contents, (o, l) => {
263
- L(l) && l.tag && (r[l.tag] = !0);
253
+ ae(e.contents, (o, a) => {
254
+ $(a) && a.tag && (r[a.tag] = !0);
264
255
  }), i = Object.keys(r);
265
256
  } else
266
257
  i = [];
267
258
  for (const [r, o] of n)
268
- r === "!!" && o === "tag:yaml.org,2002:" || (!e || i.some((l) => l.startsWith(o))) && t.push(`%TAG ${r} ${o}`);
259
+ r === "!!" && o === "tag:yaml.org,2002:" || (!e || i.some((a) => a.startsWith(o))) && t.push(`%TAG ${r} ${o}`);
269
260
  return t.join(`
270
261
  `);
271
262
  }
@@ -281,26 +272,26 @@ function Bt(s) {
281
272
  }
282
273
  function Mt(s) {
283
274
  const e = /* @__PURE__ */ new Set();
284
- return le(s, {
275
+ return ae(s, {
285
276
  Value(t, n) {
286
277
  n.anchor && e.add(n.anchor);
287
278
  }
288
279
  }), e;
289
280
  }
290
- function Pt(s, e) {
281
+ function jt(s, e) {
291
282
  for (let t = 1; ; ++t) {
292
283
  const n = `${s}${t}`;
293
284
  if (!e.has(n))
294
285
  return n;
295
286
  }
296
287
  }
297
- function Ls(s, e) {
288
+ function _s(s, e) {
298
289
  const t = [], n = /* @__PURE__ */ new Map();
299
290
  let i = null;
300
291
  return {
301
292
  onAnchor: (r) => {
302
293
  t.push(r), i ?? (i = Mt(s));
303
- const o = Pt(e, i);
294
+ const o = jt(e, i);
304
295
  return i.add(o), o;
305
296
  },
306
297
  /**
@@ -311,11 +302,11 @@ function Ls(s, e) {
311
302
  setAnchors: () => {
312
303
  for (const r of t) {
313
304
  const o = n.get(r);
314
- if (typeof o == "object" && o.anchor && (E(o.node) || I(o.node)))
305
+ if (typeof o == "object" && o.anchor && (T(o.node) || I(o.node)))
315
306
  o.node.anchor = o.anchor;
316
307
  else {
317
- const l = new Error("Failed to resolve repeated object (this should not happen)");
318
- throw l.source = r, l;
308
+ const a = new Error("Failed to resolve repeated object (this should not happen)");
309
+ throw a.source = r, a;
319
310
  }
320
311
  }
321
312
  },
@@ -326,8 +317,8 @@ function ee(s, e, t, n) {
326
317
  if (n && typeof n == "object")
327
318
  if (Array.isArray(n))
328
319
  for (let i = 0, r = n.length; i < r; ++i) {
329
- const o = n[i], l = ee(s, n, String(i), o);
330
- l === void 0 ? delete n[i] : l !== o && (n[i] = l);
320
+ const o = n[i], a = ee(s, n, String(i), o);
321
+ a === void 0 ? delete n[i] : a !== o && (n[i] = a);
331
322
  }
332
323
  else if (n instanceof Map)
333
324
  for (const i of Array.from(n.keys())) {
@@ -346,9 +337,9 @@ function ee(s, e, t, n) {
346
337
  }
347
338
  return s.call(e, t, n);
348
339
  }
349
- function P(s, e, t) {
340
+ function j(s, e, t) {
350
341
  if (Array.isArray(s))
351
- return s.map((n, i) => P(n, String(i), t));
342
+ return s.map((n, i) => j(n, String(i), t));
352
343
  if (s && typeof s.toJSON == "function") {
353
344
  if (!t || !_t(s))
354
345
  return s.toJSON(e, t);
@@ -361,9 +352,9 @@ function P(s, e, t) {
361
352
  }
362
353
  return typeof s == "bigint" && !t?.keep ? Number(s) : s;
363
354
  }
364
- class nt {
355
+ class it {
365
356
  constructor(e) {
366
- Object.defineProperty(this, j, { value: e });
357
+ Object.defineProperty(this, P, { value: e });
367
358
  }
368
359
  /** Create a copy of this node. */
369
360
  clone() {
@@ -372,7 +363,7 @@ class nt {
372
363
  }
373
364
  /** A plain JavaScript representation of this node. */
374
365
  toJS(e, { mapAsMap: t, maxAliasCount: n, onAnchor: i, reviver: r } = {}) {
375
- if (!Ce(e))
366
+ if (!_e(e))
376
367
  throw new TypeError("A document argument is required");
377
368
  const o = {
378
369
  anchors: /* @__PURE__ */ new Map(),
@@ -381,16 +372,16 @@ class nt {
381
372
  mapAsMap: t === !0,
382
373
  mapKeyWarned: !1,
383
374
  maxAliasCount: typeof n == "number" ? n : 100
384
- }, l = P(this, "", o);
375
+ }, a = j(this, "", o);
385
376
  if (typeof i == "function")
386
- for (const { count: a, res: c } of o.anchors.values())
387
- i(c, a);
388
- return typeof r == "function" ? ee(r, { "": l }, "", l) : l;
377
+ for (const { count: l, res: c } of o.anchors.values())
378
+ i(c, l);
379
+ return typeof r == "function" ? ee(r, { "": a }, "", a) : a;
389
380
  }
390
381
  }
391
- class it extends nt {
382
+ class rt extends it {
392
383
  constructor(e) {
393
- super(st), this.source = e, Object.defineProperty(this, "tag", {
384
+ super(nt), this.source = e, Object.defineProperty(this, "tag", {
394
385
  set() {
395
386
  throw new Error("Alias nodes cannot have tags");
396
387
  }
@@ -402,7 +393,7 @@ class it extends nt {
402
393
  */
403
394
  resolve(e, t) {
404
395
  let n;
405
- t?.aliasResolveCache ? n = t.aliasResolveCache : (n = [], le(e, {
396
+ t?.aliasResolveCache ? n = t.aliasResolveCache : (n = [], ae(e, {
406
397
  Node: (r, o) => {
407
398
  (Q(o) || _t(o)) && n.push(o);
408
399
  }
@@ -420,19 +411,19 @@ class it extends nt {
420
411
  return { source: this.source };
421
412
  const { anchors: n, doc: i, maxAliasCount: r } = t, o = this.resolve(i, t);
422
413
  if (!o) {
423
- const a = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
424
- throw new ReferenceError(a);
414
+ const l = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
415
+ throw new ReferenceError(l);
425
416
  }
426
- let l = n.get(o);
427
- if (l || (P(o, null, t), l = n.get(o)), l?.res === void 0) {
428
- const a = "This should not happen: Alias anchor was not resolved?";
429
- throw new ReferenceError(a);
417
+ let a = n.get(o);
418
+ if (a || (j(o, null, t), a = n.get(o)), a?.res === void 0) {
419
+ const l = "This should not happen: Alias anchor was not resolved?";
420
+ throw new ReferenceError(l);
430
421
  }
431
- if (r >= 0 && (l.count += 1, l.aliasCount === 0 && (l.aliasCount = Ee(i, o, n)), l.count * l.aliasCount > r)) {
432
- const a = "Excessive alias count indicates a resource exhaustion attack";
433
- throw new ReferenceError(a);
422
+ if (r >= 0 && (a.count += 1, a.aliasCount === 0 && (a.aliasCount = Te(i, o, n)), a.count * a.aliasCount > r)) {
423
+ const l = "Excessive alias count indicates a resource exhaustion attack";
424
+ throw new ReferenceError(l);
434
425
  }
435
- return l.res;
426
+ return a.res;
436
427
  }
437
428
  toString(e, t, n) {
438
429
  const i = `*${this.source}`;
@@ -447,30 +438,30 @@ class it extends nt {
447
438
  return i;
448
439
  }
449
440
  }
450
- function Ee(s, e, t) {
441
+ function Te(s, e, t) {
451
442
  if (Q(e)) {
452
443
  const n = e.resolve(s), i = t && n && t.get(n);
453
444
  return i ? i.count * i.aliasCount : 0;
454
445
  } else if (I(e)) {
455
446
  let n = 0;
456
447
  for (const i of e.items) {
457
- const r = Ee(s, i, t);
448
+ const r = Te(s, i, t);
458
449
  r > n && (n = r);
459
450
  }
460
451
  return n;
461
- } else if ($(e)) {
462
- const n = Ee(s, e.key, t), i = Ee(s, e.value, t);
452
+ } else if (L(e)) {
453
+ const n = Te(s, e.key, t), i = Te(s, e.value, t);
463
454
  return Math.max(n, i);
464
455
  }
465
456
  return 1;
466
457
  }
467
- const jt = (s) => !s || typeof s != "function" && typeof s != "object";
468
- class O extends nt {
458
+ const Pt = (s) => !s || typeof s != "function" && typeof s != "object";
459
+ class O extends it {
469
460
  constructor(e) {
470
461
  super(q), this.value = e;
471
462
  }
472
463
  toJSON(e, t) {
473
- return t?.keep ? this.value : P(this.value, e, t);
464
+ return t?.keep ? this.value : j(this.value, e, t);
474
465
  }
475
466
  toString() {
476
467
  return String(this.value);
@@ -481,8 +472,8 @@ O.BLOCK_LITERAL = "BLOCK_LITERAL";
481
472
  O.PLAIN = "PLAIN";
482
473
  O.QUOTE_DOUBLE = "QUOTE_DOUBLE";
483
474
  O.QUOTE_SINGLE = "QUOTE_SINGLE";
484
- const $s = "tag:yaml.org,2002:";
485
- function vs(s, e, t) {
475
+ const Bs = "tag:yaml.org,2002:";
476
+ function Ms(s, e, t) {
486
477
  if (e) {
487
478
  const n = t.filter((r) => r.tag === e), i = n.find((r) => !r.format) ?? n[0];
488
479
  if (!i)
@@ -492,34 +483,34 @@ function vs(s, e, t) {
492
483
  return t.find((n) => n.identify?.(s) && !n.format);
493
484
  }
494
485
  function me(s, e, t) {
495
- if (Ce(s) && (s = s.contents), L(s))
486
+ if (_e(s) && (s = s.contents), $(s))
496
487
  return s;
497
- if ($(s)) {
498
- const f = t.schema[J].createNode?.(t.schema, null, t);
499
- return f.items.push(s), f;
488
+ if (L(s)) {
489
+ const u = t.schema[J].createNode?.(t.schema, null, t);
490
+ return u.items.push(s), u;
500
491
  }
501
492
  (s instanceof String || s instanceof Number || s instanceof Boolean || typeof BigInt < "u" && s instanceof BigInt) && (s = s.valueOf());
502
- const { aliasDuplicateObjects: n, onAnchor: i, onTagObj: r, schema: o, sourceObjects: l } = t;
503
- let a;
493
+ const { aliasDuplicateObjects: n, onAnchor: i, onTagObj: r, schema: o, sourceObjects: a } = t;
494
+ let l;
504
495
  if (n && s && typeof s == "object") {
505
- if (a = l.get(s), a)
506
- return a.anchor ?? (a.anchor = i(s)), new it(a.anchor);
507
- a = { anchor: null, node: null }, l.set(s, a);
496
+ if (l = a.get(s), l)
497
+ return l.anchor ?? (l.anchor = i(s)), new rt(l.anchor);
498
+ l = { anchor: null, node: null }, a.set(s, l);
508
499
  }
509
- e?.startsWith("!!") && (e = $s + e.slice(2));
510
- let c = vs(s, e, o.tags);
500
+ e?.startsWith("!!") && (e = Bs + e.slice(2));
501
+ let c = Ms(s, e, o.tags);
511
502
  if (!c) {
512
503
  if (s && typeof s.toJSON == "function" && (s = s.toJSON()), !s || typeof s != "object") {
513
- const f = new O(s);
514
- return a && (a.node = f), f;
504
+ const u = new O(s);
505
+ return l && (l.node = u), u;
515
506
  }
516
507
  c = s instanceof Map ? o[J] : Symbol.iterator in Object(s) ? o[oe] : o[J];
517
508
  }
518
509
  r && (r(c), delete t.onTagObj);
519
510
  const d = c?.createNode ? c.createNode(t.schema, s, t) : typeof c?.nodeClass?.from == "function" ? c.nodeClass.from(t.schema, s, t) : new O(s);
520
- return e ? d.tag = e : c.default || (d.tag = c.tag), a && (a.node = d), d;
511
+ return e ? d.tag = e : c.default || (d.tag = c.tag), l && (l.node = d), d;
521
512
  }
522
- function $e(s, e, t) {
513
+ function Le(s, e, t) {
523
514
  let n = t;
524
515
  for (let i = e.length - 1; i >= 0; --i) {
525
516
  const r = e[i];
@@ -540,7 +531,7 @@ function $e(s, e, t) {
540
531
  });
541
532
  }
542
533
  const ue = (s) => s == null || typeof s == "object" && !!s[Symbol.iterator]().next().done;
543
- class Kt extends nt {
534
+ class Kt extends it {
544
535
  constructor(e, t) {
545
536
  super(e), Object.defineProperty(this, "schema", {
546
537
  value: t,
@@ -556,7 +547,7 @@ class Kt extends nt {
556
547
  */
557
548
  clone(e) {
558
549
  const t = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
559
- return e && (t.schema = e), t.items = t.items.map((n) => L(n) || $(n) ? n.clone(e) : n), this.range && (t.range = this.range.slice()), t;
550
+ return e && (t.schema = e), t.items = t.items.map((n) => $(n) || L(n) ? n.clone(e) : n), this.range && (t.range = this.range.slice()), t;
560
551
  }
561
552
  /**
562
553
  * Adds a value to the collection. For `!!map` and `!!omap` the value must
@@ -571,7 +562,7 @@ class Kt extends nt {
571
562
  if (I(r))
572
563
  r.addIn(i, t);
573
564
  else if (r === void 0 && this.schema)
574
- this.set(n, $e(this.schema, i, t));
565
+ this.set(n, Le(this.schema, i, t));
575
566
  else
576
567
  throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
577
568
  }
@@ -596,14 +587,14 @@ class Kt extends nt {
596
587
  */
597
588
  getIn(e, t) {
598
589
  const [n, ...i] = e, r = this.get(n, !0);
599
- return i.length === 0 ? !t && E(r) ? r.value : r : I(r) ? r.getIn(i, t) : void 0;
590
+ return i.length === 0 ? !t && T(r) ? r.value : r : I(r) ? r.getIn(i, t) : void 0;
600
591
  }
601
592
  hasAllNullValues(e) {
602
593
  return this.items.every((t) => {
603
- if (!$(t))
594
+ if (!L(t))
604
595
  return !1;
605
596
  const n = t.value;
606
- return n == null || e && E(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
597
+ return n == null || e && T(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
607
598
  });
608
599
  }
609
600
  /**
@@ -629,32 +620,32 @@ class Kt extends nt {
629
620
  if (I(r))
630
621
  r.setIn(i, t);
631
622
  else if (r === void 0 && this.schema)
632
- this.set(n, $e(this.schema, i, t));
623
+ this.set(n, Le(this.schema, i, t));
633
624
  else
634
625
  throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
635
626
  }
636
627
  }
637
628
  }
638
- const Cs = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
639
- function U(s, e) {
629
+ const js = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
630
+ function F(s, e) {
640
631
  return /^\n+$/.test(s) ? s.substring(1) : e ? s.replace(/^(?! *$)/gm, e) : s;
641
632
  }
642
633
  const G = (s, e, t) => s.endsWith(`
643
- `) ? U(t, e) : t.includes(`
634
+ `) ? F(t, e) : t.includes(`
644
635
  `) ? `
645
- ` + U(t, e) : (s.endsWith(" ") ? "" : " ") + t, Dt = "flow", Qe = "block", Ie = "quoted";
646
- function _e(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: l } = {}) {
636
+ ` + F(t, e) : (s.endsWith(" ") ? "" : " ") + t, Dt = "flow", Xe = "block", Ie = "quoted";
637
+ function Be(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: a } = {}) {
647
638
  if (!i || i < 0)
648
639
  return s;
649
640
  i < r && (r = 0);
650
- const a = Math.max(1 + r, 1 + i - e.length);
651
- if (s.length <= a)
641
+ const l = Math.max(1 + r, 1 + i - e.length);
642
+ if (s.length <= l)
652
643
  return s;
653
644
  const c = [], d = {};
654
- let f = i - e.length;
655
- typeof n == "number" && (n > i - Math.max(2, r) ? c.push(0) : f = i - n);
656
- let u, m, g = !1, h = -1, p = -1, b = -1;
657
- t === Qe && (h = wt(s, h, e.length), h !== -1 && (f = h + a));
645
+ let u = i - e.length;
646
+ typeof n == "number" && (n > i - Math.max(2, r) ? c.push(0) : u = i - n);
647
+ let f, m, g = !1, h = -1, p = -1, b = -1;
648
+ t === Xe && (h = kt(s, h, e.length), h !== -1 && (u = h + l));
658
649
  for (let k; k = s[h += 1]; ) {
659
650
  if (t === Ie && k === "\\") {
660
651
  switch (p = h, s[h + 1]) {
@@ -674,30 +665,30 @@ function _e(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
674
665
  }
675
666
  if (k === `
676
667
  `)
677
- t === Qe && (h = wt(s, h, e.length)), f = h + e.length + a, u = void 0;
668
+ t === Xe && (h = kt(s, h, e.length)), u = h + e.length + l, f = void 0;
678
669
  else {
679
670
  if (k === " " && m && m !== " " && m !== `
680
671
  ` && m !== " ") {
681
672
  const S = s[h + 1];
682
673
  S && S !== " " && S !== `
683
- ` && S !== " " && (u = h);
674
+ ` && S !== " " && (f = h);
684
675
  }
685
- if (h >= f)
686
- if (u)
687
- c.push(u), f = u + a, u = void 0;
676
+ if (h >= u)
677
+ if (f)
678
+ c.push(f), u = f + l, f = void 0;
688
679
  else if (t === Ie) {
689
680
  for (; m === " " || m === " "; )
690
681
  m = k, k = s[h += 1], g = !0;
691
682
  const S = h > b + 1 ? h - 2 : p - 1;
692
683
  if (d[S])
693
684
  return s;
694
- c.push(S), d[S] = !0, f = S + a, u = void 0;
685
+ c.push(S), d[S] = !0, u = S + l, f = void 0;
695
686
  } else
696
687
  g = !0;
697
688
  }
698
689
  m = k;
699
690
  }
700
- if (g && l && l(), c.length === 0)
691
+ if (g && a && a(), c.length === 0)
701
692
  return s;
702
693
  o && o();
703
694
  let w = s.slice(0, c[0]);
@@ -709,7 +700,7 @@ ${e}${s.slice(S + 1, N)}`);
709
700
  }
710
701
  return w;
711
702
  }
712
- function wt(s, e, t) {
703
+ function kt(s, e, t) {
713
704
  let n = e, i = e + 1, r = s[i];
714
705
  for (; r === " " || r === " "; )
715
706
  if (e < i + t)
@@ -723,12 +714,12 @@ function wt(s, e, t) {
723
714
  }
724
715
  return n;
725
716
  }
726
- const Be = (s, e) => ({
717
+ const Me = (s, e) => ({
727
718
  indentAtStart: e ? s.indent.length : s.indentAtStart,
728
719
  lineWidth: s.options.lineWidth,
729
720
  minContentWidth: s.options.minContentWidth
730
- }), Me = (s) => /^(%|---|\.\.\.)/m.test(s);
731
- function _s(s, e, t) {
721
+ }), je = (s) => /^(%|---|\.\.\.)/m.test(s);
722
+ function Ps(s, e, t) {
732
723
  if (!e || e < 0)
733
724
  return !1;
734
725
  const n = e - t, i = s.length;
@@ -748,15 +739,15 @@ function pe(s, e) {
748
739
  const t = JSON.stringify(s);
749
740
  if (e.options.doubleQuotedAsJSON)
750
741
  return t;
751
- const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (Me(s) ? " " : "");
752
- let o = "", l = 0;
753
- for (let a = 0, c = t[a]; c; c = t[++a])
754
- if (c === " " && t[a + 1] === "\\" && t[a + 2] === "n" && (o += t.slice(l, a) + "\\ ", a += 1, l = a, c = "\\"), c === "\\")
755
- switch (t[a + 1]) {
742
+ const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (je(s) ? " " : "");
743
+ let o = "", a = 0;
744
+ for (let l = 0, c = t[l]; c; c = t[++l])
745
+ if (c === " " && t[l + 1] === "\\" && t[l + 2] === "n" && (o += t.slice(a, l) + "\\ ", l += 1, a = l, c = "\\"), c === "\\")
746
+ switch (t[l + 1]) {
756
747
  case "u":
757
748
  {
758
- o += t.slice(l, a);
759
- const d = t.substr(a + 2, 4);
749
+ o += t.slice(a, l);
750
+ const d = t.substr(l + 2, 4);
760
751
  switch (d) {
761
752
  case "0000":
762
753
  o += "\\0";
@@ -783,35 +774,35 @@ function pe(s, e) {
783
774
  o += "\\P";
784
775
  break;
785
776
  default:
786
- d.substr(0, 2) === "00" ? o += "\\x" + d.substr(2) : o += t.substr(a, 6);
777
+ d.substr(0, 2) === "00" ? o += "\\x" + d.substr(2) : o += t.substr(l, 6);
787
778
  }
788
- a += 5, l = a + 1;
779
+ l += 5, a = l + 1;
789
780
  }
790
781
  break;
791
782
  case "n":
792
- if (n || t[a + 2] === '"' || t.length < i)
793
- a += 1;
783
+ if (n || t[l + 2] === '"' || t.length < i)
784
+ l += 1;
794
785
  else {
795
- for (o += t.slice(l, a) + `
786
+ for (o += t.slice(a, l) + `
796
787
 
797
- `; t[a + 2] === "\\" && t[a + 3] === "n" && t[a + 4] !== '"'; )
788
+ `; t[l + 2] === "\\" && t[l + 3] === "n" && t[l + 4] !== '"'; )
798
789
  o += `
799
- `, a += 2;
800
- o += r, t[a + 2] === " " && (o += "\\"), a += 1, l = a + 1;
790
+ `, l += 2;
791
+ o += r, t[l + 2] === " " && (o += "\\"), l += 1, a = l + 1;
801
792
  }
802
793
  break;
803
794
  default:
804
- a += 1;
795
+ l += 1;
805
796
  }
806
- return o = l ? o + t.slice(l) : t, n ? o : _e(o, r, Ie, Be(e, !1));
797
+ return o = a ? o + t.slice(a) : t, n ? o : Be(o, r, Ie, Me(e, !1));
807
798
  }
808
- function Xe(s, e) {
799
+ function xe(s, e) {
809
800
  if (e.options.singleQuote === !1 || e.implicitKey && s.includes(`
810
801
  `) || /[ \t]\n|\n[ \t]/.test(s))
811
802
  return pe(s, e);
812
- const t = e.indent || (Me(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
803
+ const t = e.indent || (je(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
813
804
  ${t}`) + "'";
814
- return e.implicitKey ? n : _e(n, t, Dt, Be(e, !1));
805
+ return e.implicitKey ? n : Be(n, t, Dt, Me(e, !1));
815
806
  }
816
807
  function te(s, e) {
817
808
  const { singleQuote: t } = e.options;
@@ -820,40 +811,40 @@ function te(s, e) {
820
811
  n = pe;
821
812
  else {
822
813
  const i = s.includes('"'), r = s.includes("'");
823
- i && !r ? n = Xe : r && !i ? n = pe : n = t ? Xe : pe;
814
+ i && !r ? n = xe : r && !i ? n = pe : n = t ? xe : pe;
824
815
  }
825
816
  return n(s, e);
826
817
  }
827
- let xe;
818
+ let ze;
828
819
  try {
829
- xe = new RegExp(`(^|(?<!
820
+ ze = new RegExp(`(^|(?<!
830
821
  ))
831
822
  +(?!
832
823
  |$)`, "g");
833
824
  } catch {
834
- xe = /\n+(?!\n|$)/g;
825
+ ze = /\n+(?!\n|$)/g;
835
826
  }
836
- function Le({ comment: s, type: e, value: t }, n, i, r) {
837
- const { blockQuote: o, commentString: l, lineWidth: a } = n.options;
827
+ function $e({ comment: s, type: e, value: t }, n, i, r) {
828
+ const { blockQuote: o, commentString: a, lineWidth: l } = n.options;
838
829
  if (!o || /\n[\t ]+$/.test(t))
839
830
  return te(t, n);
840
- const c = n.indent || (n.forceBlockIndent || Me(t) ? " " : ""), d = o === "literal" ? !0 : o === "folded" || e === O.BLOCK_FOLDED ? !1 : e === O.BLOCK_LITERAL ? !0 : !_s(t, a, c.length);
831
+ const c = n.indent || (n.forceBlockIndent || je(t) ? " " : ""), d = o === "literal" ? !0 : o === "folded" || e === O.BLOCK_FOLDED ? !1 : e === O.BLOCK_LITERAL ? !0 : !Ps(t, l, c.length);
841
832
  if (!t)
842
833
  return d ? `|
843
834
  ` : `>
844
835
  `;
845
- let f, u;
846
- for (u = t.length; u > 0; --u) {
847
- const N = t[u - 1];
836
+ let u, f;
837
+ for (f = t.length; f > 0; --f) {
838
+ const N = t[f - 1];
848
839
  if (N !== `
849
840
  ` && N !== " " && N !== " ")
850
841
  break;
851
842
  }
852
- let m = t.substring(u);
843
+ let m = t.substring(f);
853
844
  const g = m.indexOf(`
854
845
  `);
855
- g === -1 ? f = "-" : t === m || g !== m.length - 1 ? (f = "+", r && r()) : f = "", m && (t = t.slice(0, -m.length), m[m.length - 1] === `
856
- ` && (m = m.slice(0, -1)), m = m.replace(xe, `$&${c}`));
846
+ g === -1 ? u = "-" : t === m || g !== m.length - 1 ? (u = "+", r && r()) : u = "", m && (t = t.slice(0, -m.length), m[m.length - 1] === `
847
+ ` && (m = m.slice(0, -1)), m = m.replace(ze, `$&${c}`));
857
848
  let h = !1, p, b = -1;
858
849
  for (p = 0; p < t.length; ++p) {
859
850
  const N = t[p];
@@ -867,16 +858,16 @@ function Le({ comment: s, type: e, value: t }, n, i, r) {
867
858
  }
868
859
  let w = t.substring(0, b < p ? b + 1 : p);
869
860
  w && (t = t.substring(w.length), w = w.replace(/\n+/g, `$&${c}`));
870
- let S = (h ? c ? "2" : "1" : "") + f;
871
- if (s && (S += " " + l(s.replace(/ ?[\r\n]+/g, " ")), i && i()), !d) {
861
+ let S = (h ? c ? "2" : "1" : "") + u;
862
+ if (s && (S += " " + a(s.replace(/ ?[\r\n]+/g, " ")), i && i()), !d) {
872
863
  const N = t.replace(/\n+/g, `
873
864
  $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${c}`);
874
865
  let A = !1;
875
- const T = Be(n, !0);
876
- o !== "folded" && e !== O.BLOCK_FOLDED && (T.onOverflow = () => {
866
+ const E = Me(n, !0);
867
+ o !== "folded" && e !== O.BLOCK_FOLDED && (E.onOverflow = () => {
877
868
  A = !0;
878
869
  });
879
- const y = _e(`${w}${N}${m}`, c, Qe, T);
870
+ const y = Be(`${w}${N}${m}`, c, Xe, E);
880
871
  if (!A)
881
872
  return `>${S}
882
873
  ${c}${y}`;
@@ -884,63 +875,63 @@ ${c}${y}`;
884
875
  return t = t.replace(/\n+/g, `$&${c}`), `|${S}
885
876
  ${c}${w}${t}${m}`;
886
877
  }
887
- function Bs(s, e, t, n) {
888
- const { type: i, value: r } = s, { actualString: o, implicitKey: l, indent: a, indentStep: c, inFlow: d } = e;
889
- if (l && r.includes(`
878
+ function Ks(s, e, t, n) {
879
+ const { type: i, value: r } = s, { actualString: o, implicitKey: a, indent: l, indentStep: c, inFlow: d } = e;
880
+ if (a && r.includes(`
890
881
  `) || d && /[[\]{},]/.test(r))
891
882
  return te(r, e);
892
883
  if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))
893
- return l || d || !r.includes(`
894
- `) ? te(r, e) : Le(s, e, t, n);
895
- if (!l && !d && i !== O.PLAIN && r.includes(`
884
+ return a || d || !r.includes(`
885
+ `) ? te(r, e) : $e(s, e, t, n);
886
+ if (!a && !d && i !== O.PLAIN && r.includes(`
896
887
  `))
897
- return Le(s, e, t, n);
898
- if (Me(r)) {
899
- if (a === "")
900
- return e.forceBlockIndent = !0, Le(s, e, t, n);
901
- if (l && a === c)
888
+ return $e(s, e, t, n);
889
+ if (je(r)) {
890
+ if (l === "")
891
+ return e.forceBlockIndent = !0, $e(s, e, t, n);
892
+ if (a && l === c)
902
893
  return te(r, e);
903
894
  }
904
- const f = r.replace(/\n+/g, `$&
905
- ${a}`);
895
+ const u = r.replace(/\n+/g, `$&
896
+ ${l}`);
906
897
  if (o) {
907
- const u = (h) => h.default && h.tag !== "tag:yaml.org,2002:str" && h.test?.test(f), { compat: m, tags: g } = e.doc.schema;
908
- if (g.some(u) || m?.some(u))
898
+ const f = (h) => h.default && h.tag !== "tag:yaml.org,2002:str" && h.test?.test(u), { compat: m, tags: g } = e.doc.schema;
899
+ if (g.some(f) || m?.some(f))
909
900
  return te(r, e);
910
901
  }
911
- return l ? f : _e(f, a, Dt, Be(e, !1));
902
+ return a ? u : Be(u, l, Dt, Me(e, !1));
912
903
  }
913
- function rt(s, e, t, n) {
904
+ function ot(s, e, t, n) {
914
905
  const { implicitKey: i, inFlow: r } = e, o = typeof s.value == "string" ? s : Object.assign({}, s, { value: String(s.value) });
915
- let { type: l } = s;
916
- l !== O.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (l = O.QUOTE_DOUBLE);
917
- const a = (d) => {
906
+ let { type: a } = s;
907
+ a !== O.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (a = O.QUOTE_DOUBLE);
908
+ const l = (d) => {
918
909
  switch (d) {
919
910
  case O.BLOCK_FOLDED:
920
911
  case O.BLOCK_LITERAL:
921
- return i || r ? te(o.value, e) : Le(o, e, t, n);
912
+ return i || r ? te(o.value, e) : $e(o, e, t, n);
922
913
  case O.QUOTE_DOUBLE:
923
914
  return pe(o.value, e);
924
915
  case O.QUOTE_SINGLE:
925
- return Xe(o.value, e);
916
+ return xe(o.value, e);
926
917
  case O.PLAIN:
927
- return Bs(o, e, t, n);
918
+ return Ks(o, e, t, n);
928
919
  default:
929
920
  return null;
930
921
  }
931
922
  };
932
- let c = a(l);
923
+ let c = l(a);
933
924
  if (c === null) {
934
- const { defaultKeyType: d, defaultStringType: f } = e.options, u = i && d || f;
935
- if (c = a(u), c === null)
936
- throw new Error(`Unsupported default string type ${u}`);
925
+ const { defaultKeyType: d, defaultStringType: u } = e.options, f = i && d || u;
926
+ if (c = l(f), c === null)
927
+ throw new Error(`Unsupported default string type ${f}`);
937
928
  }
938
929
  return c;
939
930
  }
940
931
  function qt(s, e) {
941
932
  const t = Object.assign({
942
933
  blockQuote: !0,
943
- commentString: Cs,
934
+ commentString: js,
944
935
  defaultKeyType: null,
945
936
  defaultStringType: "PLAIN",
946
937
  directives: null,
@@ -978,14 +969,14 @@ function qt(s, e) {
978
969
  options: t
979
970
  };
980
971
  }
981
- function Ms(s, e) {
972
+ function Ds(s, e) {
982
973
  if (e.tag) {
983
974
  const i = s.filter((r) => r.tag === e.tag);
984
975
  if (i.length > 0)
985
976
  return i.find((r) => r.format === e.format) ?? i[0];
986
977
  }
987
978
  let t, n;
988
- if (E(e)) {
979
+ if (T(e)) {
989
980
  n = e.value;
990
981
  let i = s.filter((r) => r.identify?.(n));
991
982
  if (i.length > 1) {
@@ -1001,16 +992,16 @@ function Ms(s, e) {
1001
992
  }
1002
993
  return t;
1003
994
  }
1004
- function Ps(s, e, { anchors: t, doc: n }) {
995
+ function qs(s, e, { anchors: t, doc: n }) {
1005
996
  if (!n.directives)
1006
997
  return "";
1007
- const i = [], r = (E(s) || I(s)) && s.anchor;
998
+ const i = [], r = (T(s) || I(s)) && s.anchor;
1008
999
  r && Bt(r) && (t.add(r), i.push(`&${r}`));
1009
1000
  const o = s.tag ?? (e.default ? null : e.tag);
1010
1001
  return o && i.push(n.directives.tagString(o)), i.join(" ");
1011
1002
  }
1012
1003
  function ie(s, e, t, n) {
1013
- if ($(s))
1004
+ if (L(s))
1014
1005
  return s.toString(e, t, n);
1015
1006
  if (Q(s)) {
1016
1007
  if (e.doc.directives)
@@ -1020,55 +1011,55 @@ function ie(s, e, t, n) {
1020
1011
  e.resolvedAliases ? e.resolvedAliases.add(s) : e.resolvedAliases = /* @__PURE__ */ new Set([s]), s = s.resolve(e.doc);
1021
1012
  }
1022
1013
  let i;
1023
- const r = L(s) ? s : e.doc.createNode(s, { onTagObj: (a) => i = a });
1024
- i ?? (i = Ms(e.doc.schema.tags, r));
1025
- const o = Ps(r, i, e);
1014
+ const r = $(s) ? s : e.doc.createNode(s, { onTagObj: (l) => i = l });
1015
+ i ?? (i = Ds(e.doc.schema.tags, r));
1016
+ const o = qs(r, i, e);
1026
1017
  o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
1027
- const l = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : E(r) ? rt(r, e, t, n) : r.toString(e, t, n);
1028
- return o ? E(r) || l[0] === "{" || l[0] === "[" ? `${o} ${l}` : `${o}
1029
- ${e.indent}${l}` : l;
1030
- }
1031
- function js({ key: s, value: e }, t, n, i) {
1032
- const { allNullValues: r, doc: o, indent: l, indentStep: a, options: { commentString: c, indentSeq: d, simpleKeys: f } } = t;
1033
- let u = L(s) && s.comment || null;
1034
- if (f) {
1035
- if (u)
1018
+ const a = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : T(r) ? ot(r, e, t, n) : r.toString(e, t, n);
1019
+ return o ? T(r) || a[0] === "{" || a[0] === "[" ? `${o} ${a}` : `${o}
1020
+ ${e.indent}${a}` : a;
1021
+ }
1022
+ function Fs({ key: s, value: e }, t, n, i) {
1023
+ const { allNullValues: r, doc: o, indent: a, indentStep: l, options: { commentString: c, indentSeq: d, simpleKeys: u } } = t;
1024
+ let f = $(s) && s.comment || null;
1025
+ if (u) {
1026
+ if (f)
1036
1027
  throw new Error("With simple keys, key nodes cannot have comments");
1037
- if (I(s) || !L(s) && typeof s == "object") {
1038
- const T = "With simple keys, collection cannot be used as a key value";
1039
- throw new Error(T);
1028
+ if (I(s) || !$(s) && typeof s == "object") {
1029
+ const E = "With simple keys, collection cannot be used as a key value";
1030
+ throw new Error(E);
1040
1031
  }
1041
1032
  }
1042
- let m = !f && (!s || u && e == null && !t.inFlow || I(s) || (E(s) ? s.type === O.BLOCK_FOLDED || s.type === O.BLOCK_LITERAL : typeof s == "object"));
1033
+ let m = !u && (!s || f && e == null && !t.inFlow || I(s) || (T(s) ? s.type === O.BLOCK_FOLDED || s.type === O.BLOCK_LITERAL : typeof s == "object"));
1043
1034
  t = Object.assign({}, t, {
1044
1035
  allNullValues: !1,
1045
- implicitKey: !m && (f || !r),
1046
- indent: l + a
1036
+ implicitKey: !m && (u || !r),
1037
+ indent: a + l
1047
1038
  });
1048
1039
  let g = !1, h = !1, p = ie(s, t, () => g = !0, () => h = !0);
1049
1040
  if (!m && !t.inFlow && p.length > 1024) {
1050
- if (f)
1041
+ if (u)
1051
1042
  throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
1052
1043
  m = !0;
1053
1044
  }
1054
1045
  if (t.inFlow) {
1055
1046
  if (r || e == null)
1056
1047
  return g && n && n(), p === "" ? "?" : m ? `? ${p}` : p;
1057
- } else if (r && !f || e == null && m)
1058
- return p = `? ${p}`, u && !g ? p += G(p, t.indent, c(u)) : h && i && i(), p;
1059
- g && (u = null), m ? (u && (p += G(p, t.indent, c(u))), p = `? ${p}
1060
- ${l}:`) : (p = `${p}:`, u && (p += G(p, t.indent, c(u))));
1048
+ } else if (r && !u || e == null && m)
1049
+ return p = `? ${p}`, f && !g ? p += G(p, t.indent, c(f)) : h && i && i(), p;
1050
+ g && (f = null), m ? (f && (p += G(p, t.indent, c(f))), p = `? ${p}
1051
+ ${a}:`) : (p = `${p}:`, f && (p += G(p, t.indent, c(f))));
1061
1052
  let b, w, k;
1062
- L(e) ? (b = !!e.spaceBefore, w = e.commentBefore, k = e.comment) : (b = !1, w = null, k = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !m && !u && E(e) && (t.indentAtStart = p.length + 1), h = !1, !d && a.length >= 2 && !t.inFlow && !m && be(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
1053
+ $(e) ? (b = !!e.spaceBefore, w = e.commentBefore, k = e.comment) : (b = !1, w = null, k = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !m && !f && T(e) && (t.indentAtStart = p.length + 1), h = !1, !d && l.length >= 2 && !t.inFlow && !m && be(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
1063
1054
  let S = !1;
1064
1055
  const N = ie(e, t, () => S = !0, () => h = !0);
1065
1056
  let A = " ";
1066
- if (u || b || w) {
1057
+ if (f || b || w) {
1067
1058
  if (A = b ? `
1068
1059
  ` : "", w) {
1069
- const T = c(w);
1060
+ const E = c(w);
1070
1061
  A += `
1071
- ${U(T, t.indent)}`;
1062
+ ${F(E, t.indent)}`;
1072
1063
  }
1073
1064
  N === "" && !t.inFlow ? A === `
1074
1065
  ` && k && (A = `
@@ -1076,13 +1067,13 @@ ${U(T, t.indent)}`;
1076
1067
  `) : A += `
1077
1068
  ${t.indent}`;
1078
1069
  } else if (!m && I(e)) {
1079
- const T = N[0], y = N.indexOf(`
1070
+ const E = N[0], y = N.indexOf(`
1080
1071
  `), v = y !== -1, R = t.inFlow ?? e.flow ?? e.items.length === 0;
1081
1072
  if (v || !R) {
1082
1073
  let X = !1;
1083
- if (v && (T === "&" || T === "!")) {
1074
+ if (v && (E === "&" || E === "!")) {
1084
1075
  let C = N.indexOf(" ");
1085
- T === "&" && C !== -1 && C < y && N[C + 1] === "!" && (C = N.indexOf(" ", C + 1)), (C === -1 || y < C) && (X = !0);
1076
+ E === "&" && C !== -1 && C < y && N[C + 1] === "!" && (C = N.indexOf(" ", C + 1)), (C === -1 || y < C) && (X = !0);
1086
1077
  }
1087
1078
  X || (A = `
1088
1079
  ${t.indent}`);
@@ -1091,30 +1082,30 @@ ${t.indent}`);
1091
1082
  `) && (A = "");
1092
1083
  return p += A + N, t.inFlow ? S && n && n() : k && !S ? p += G(p, t.indent, c(k)) : h && i && i(), p;
1093
1084
  }
1094
- function Ut(s, e) {
1085
+ function Ft(s, e) {
1095
1086
  (s === "debug" || s === "warn") && console.warn(e);
1096
1087
  }
1097
- const Se = "<<", F = {
1088
+ const Se = "<<", U = {
1098
1089
  identify: (s) => s === Se || typeof s == "symbol" && s.description === Se,
1099
1090
  default: "key",
1100
1091
  tag: "tag:yaml.org,2002:merge",
1101
1092
  test: /^<<$/,
1102
1093
  resolve: () => Object.assign(new O(Symbol(Se)), {
1103
- addToJSMap: Ft
1094
+ addToJSMap: Ut
1104
1095
  }),
1105
1096
  stringify: () => Se
1106
- }, Ks = (s, e) => (F.identify(e) || E(e) && (!e.type || e.type === O.PLAIN) && F.identify(e.value)) && s?.doc.schema.tags.some((t) => t.tag === F.tag && t.default);
1107
- function Ft(s, e, t) {
1097
+ }, Us = (s, e) => (U.identify(e) || T(e) && (!e.type || e.type === O.PLAIN) && U.identify(e.value)) && s?.doc.schema.tags.some((t) => t.tag === U.tag && t.default);
1098
+ function Ut(s, e, t) {
1108
1099
  if (t = s && Q(t) ? t.resolve(s.doc) : t, be(t))
1109
1100
  for (const n of t.items)
1110
- Re(s, e, n);
1101
+ Ve(s, e, n);
1111
1102
  else if (Array.isArray(t))
1112
1103
  for (const n of t)
1113
- Re(s, e, n);
1104
+ Ve(s, e, n);
1114
1105
  else
1115
- Re(s, e, t);
1106
+ Ve(s, e, t);
1116
1107
  }
1117
- function Re(s, e, t) {
1108
+ function Ve(s, e, t) {
1118
1109
  const n = s && Q(t) ? t.resolve(s.doc) : t;
1119
1110
  if (!ye(n))
1120
1111
  throw new Error("Merge sources must be maps or map aliases");
@@ -1129,18 +1120,18 @@ function Re(s, e, t) {
1129
1120
  return e;
1130
1121
  }
1131
1122
  function Rt(s, e, { key: t, value: n }) {
1132
- if (L(t) && t.addToJSMap)
1123
+ if ($(t) && t.addToJSMap)
1133
1124
  t.addToJSMap(s, e, n);
1134
- else if (Ks(s, t))
1135
- Ft(s, e, n);
1125
+ else if (Us(s, t))
1126
+ Ut(s, e, n);
1136
1127
  else {
1137
- const i = P(t, "", s);
1128
+ const i = j(t, "", s);
1138
1129
  if (e instanceof Map)
1139
- e.set(i, P(n, i, s));
1130
+ e.set(i, j(n, i, s));
1140
1131
  else if (e instanceof Set)
1141
1132
  e.add(i);
1142
1133
  else {
1143
- const r = Ds(t, i, s), o = P(n, r, s);
1134
+ const r = Rs(t, i, s), o = j(n, r, s);
1144
1135
  r in e ? Object.defineProperty(e, r, {
1145
1136
  value: o,
1146
1137
  writable: !0,
@@ -1151,12 +1142,12 @@ function Rt(s, e, { key: t, value: n }) {
1151
1142
  }
1152
1143
  return e;
1153
1144
  }
1154
- function Ds(s, e, t) {
1145
+ function Rs(s, e, t) {
1155
1146
  if (e === null)
1156
1147
  return "";
1157
1148
  if (typeof e != "object")
1158
1149
  return String(e);
1159
- if (L(s) && t?.doc) {
1150
+ if ($(s) && t?.doc) {
1160
1151
  const n = qt(t.doc, {});
1161
1152
  n.anchors = /* @__PURE__ */ new Set();
1162
1153
  for (const r of t.anchors.keys())
@@ -1165,121 +1156,121 @@ function Ds(s, e, t) {
1165
1156
  const i = s.toString(n);
1166
1157
  if (!t.mapKeyWarned) {
1167
1158
  let r = JSON.stringify(i);
1168
- r.length > 40 && (r = r.substring(0, 36) + '..."'), Ut(t.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`), t.mapKeyWarned = !0;
1159
+ r.length > 40 && (r = r.substring(0, 36) + '..."'), Ft(t.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`), t.mapKeyWarned = !0;
1169
1160
  }
1170
1161
  return i;
1171
1162
  }
1172
1163
  return JSON.stringify(e);
1173
1164
  }
1174
- function ot(s, e, t) {
1165
+ function at(s, e, t) {
1175
1166
  const n = me(s, void 0, t), i = me(e, void 0, t);
1176
1167
  return new B(n, i);
1177
1168
  }
1178
1169
  class B {
1179
1170
  constructor(e, t = null) {
1180
- Object.defineProperty(this, j, { value: Ct }), this.key = e, this.value = t;
1171
+ Object.defineProperty(this, P, { value: Ct }), this.key = e, this.value = t;
1181
1172
  }
1182
1173
  clone(e) {
1183
1174
  let { key: t, value: n } = this;
1184
- return L(t) && (t = t.clone(e)), L(n) && (n = n.clone(e)), new B(t, n);
1175
+ return $(t) && (t = t.clone(e)), $(n) && (n = n.clone(e)), new B(t, n);
1185
1176
  }
1186
1177
  toJSON(e, t) {
1187
1178
  const n = t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
1188
1179
  return Rt(t, n, this);
1189
1180
  }
1190
1181
  toString(e, t, n) {
1191
- return e?.doc ? js(this, e, t, n) : JSON.stringify(this);
1182
+ return e?.doc ? Fs(this, e, t, n) : JSON.stringify(this);
1192
1183
  }
1193
1184
  }
1194
1185
  function Vt(s, e, t) {
1195
- return (e.inFlow ?? s.flow ? Us : qs)(s, e, t);
1186
+ return (e.inFlow ?? s.flow ? Js : Vs)(s, e, t);
1196
1187
  }
1197
- function qs({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: l }) {
1198
- const { indent: a, options: { commentString: c } } = t, d = Object.assign({}, t, { indent: r, type: null });
1199
- let f = !1;
1200
- const u = [];
1188
+ function Vs({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: a }) {
1189
+ const { indent: l, options: { commentString: c } } = t, d = Object.assign({}, t, { indent: r, type: null });
1190
+ let u = !1;
1191
+ const f = [];
1201
1192
  for (let g = 0; g < e.length; ++g) {
1202
1193
  const h = e[g];
1203
1194
  let p = null;
1204
- if (L(h))
1205
- !f && h.spaceBefore && u.push(""), ve(t, u, h.commentBefore, f), h.comment && (p = h.comment);
1206
- else if ($(h)) {
1207
- const w = L(h.key) ? h.key : null;
1208
- w && (!f && w.spaceBefore && u.push(""), ve(t, u, w.commentBefore, f));
1195
+ if ($(h))
1196
+ !u && h.spaceBefore && f.push(""), ve(t, f, h.commentBefore, u), h.comment && (p = h.comment);
1197
+ else if (L(h)) {
1198
+ const w = $(h.key) ? h.key : null;
1199
+ w && (!u && w.spaceBefore && f.push(""), ve(t, f, w.commentBefore, u));
1209
1200
  }
1210
- f = !1;
1211
- let b = ie(h, d, () => p = null, () => f = !0);
1212
- p && (b += G(b, r, c(p))), f && p && (f = !1), u.push(n + b);
1201
+ u = !1;
1202
+ let b = ie(h, d, () => p = null, () => u = !0);
1203
+ p && (b += G(b, r, c(p))), u && p && (u = !1), f.push(n + b);
1213
1204
  }
1214
1205
  let m;
1215
- if (u.length === 0)
1206
+ if (f.length === 0)
1216
1207
  m = i.start + i.end;
1217
1208
  else {
1218
- m = u[0];
1219
- for (let g = 1; g < u.length; ++g) {
1220
- const h = u[g];
1209
+ m = f[0];
1210
+ for (let g = 1; g < f.length; ++g) {
1211
+ const h = f[g];
1221
1212
  m += h ? `
1222
- ${a}${h}` : `
1213
+ ${l}${h}` : `
1223
1214
  `;
1224
1215
  }
1225
1216
  }
1226
1217
  return s ? (m += `
1227
- ` + U(c(s), a), l && l()) : f && o && o(), m;
1218
+ ` + F(c(s), l), a && a()) : u && o && o(), m;
1228
1219
  }
1229
- function Us({ items: s }, e, { flowChars: t, itemIndent: n }) {
1230
- const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString: l } } = e;
1220
+ function Js({ items: s }, e, { flowChars: t, itemIndent: n }) {
1221
+ const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString: a } } = e;
1231
1222
  n += r;
1232
- const a = Object.assign({}, e, {
1223
+ const l = Object.assign({}, e, {
1233
1224
  indent: n,
1234
1225
  inFlow: !0,
1235
1226
  type: null
1236
1227
  });
1237
1228
  let c = !1, d = 0;
1238
- const f = [];
1229
+ const u = [];
1239
1230
  for (let g = 0; g < s.length; ++g) {
1240
1231
  const h = s[g];
1241
1232
  let p = null;
1242
- if (L(h))
1243
- h.spaceBefore && f.push(""), ve(e, f, h.commentBefore, !1), h.comment && (p = h.comment);
1244
- else if ($(h)) {
1245
- const w = L(h.key) ? h.key : null;
1246
- w && (w.spaceBefore && f.push(""), ve(e, f, w.commentBefore, !1), w.comment && (c = !0));
1247
- const k = L(h.value) ? h.value : null;
1233
+ if ($(h))
1234
+ h.spaceBefore && u.push(""), ve(e, u, h.commentBefore, !1), h.comment && (p = h.comment);
1235
+ else if (L(h)) {
1236
+ const w = $(h.key) ? h.key : null;
1237
+ w && (w.spaceBefore && u.push(""), ve(e, u, w.commentBefore, !1), w.comment && (c = !0));
1238
+ const k = $(h.value) ? h.value : null;
1248
1239
  k ? (k.comment && (p = k.comment), k.commentBefore && (c = !0)) : h.value == null && w?.comment && (p = w.comment);
1249
1240
  }
1250
1241
  p && (c = !0);
1251
- let b = ie(h, a, () => p = null);
1252
- g < s.length - 1 && (b += ","), p && (b += G(b, n, l(p))), !c && (f.length > d || b.includes(`
1253
- `)) && (c = !0), f.push(b), d = f.length;
1242
+ let b = ie(h, l, () => p = null);
1243
+ g < s.length - 1 && (b += ","), p && (b += G(b, n, a(p))), !c && (u.length > d || b.includes(`
1244
+ `)) && (c = !0), u.push(b), d = u.length;
1254
1245
  }
1255
- const { start: u, end: m } = t;
1256
- if (f.length === 0)
1257
- return u + m;
1246
+ const { start: f, end: m } = t;
1247
+ if (u.length === 0)
1248
+ return f + m;
1258
1249
  if (!c) {
1259
- const g = f.reduce((h, p) => h + p.length + 2, 2);
1250
+ const g = u.reduce((h, p) => h + p.length + 2, 2);
1260
1251
  c = e.options.lineWidth > 0 && g > e.options.lineWidth;
1261
1252
  }
1262
1253
  if (c) {
1263
- let g = u;
1264
- for (const h of f)
1254
+ let g = f;
1255
+ for (const h of u)
1265
1256
  g += h ? `
1266
1257
  ${r}${i}${h}` : `
1267
1258
  `;
1268
1259
  return `${g}
1269
1260
  ${i}${m}`;
1270
1261
  } else
1271
- return `${u}${o}${f.join(" ")}${o}${m}`;
1262
+ return `${f}${o}${u.join(" ")}${o}${m}`;
1272
1263
  }
1273
1264
  function ve({ indent: s, options: { commentString: e } }, t, n, i) {
1274
1265
  if (n && i && (n = n.replace(/^\n+/, "")), n) {
1275
- const r = U(e(n), s);
1266
+ const r = F(e(n), s);
1276
1267
  t.push(r.trimStart());
1277
1268
  }
1278
1269
  }
1279
1270
  function H(s, e) {
1280
- const t = E(e) ? e.value : e;
1271
+ const t = T(e) ? e.value : e;
1281
1272
  for (const n of s)
1282
- if ($(n) && (n.key === e || n.key === t || E(n.key) && n.key.value === t))
1273
+ if (L(n) && (n.key === e || n.key === t || T(n.key) && n.key.value === t))
1283
1274
  return n;
1284
1275
  }
1285
1276
  class M extends Kt {
@@ -1294,19 +1285,19 @@ class M extends Kt {
1294
1285
  * to other node classes that inherit from YAMLMap
1295
1286
  */
1296
1287
  static from(e, t, n) {
1297
- const { keepUndefined: i, replacer: r } = n, o = new this(e), l = (a, c) => {
1288
+ const { keepUndefined: i, replacer: r } = n, o = new this(e), a = (l, c) => {
1298
1289
  if (typeof r == "function")
1299
- c = r.call(t, a, c);
1300
- else if (Array.isArray(r) && !r.includes(a))
1290
+ c = r.call(t, l, c);
1291
+ else if (Array.isArray(r) && !r.includes(l))
1301
1292
  return;
1302
- (c !== void 0 || i) && o.items.push(ot(a, c, n));
1293
+ (c !== void 0 || i) && o.items.push(at(l, c, n));
1303
1294
  };
1304
1295
  if (t instanceof Map)
1305
- for (const [a, c] of t)
1306
- l(a, c);
1296
+ for (const [l, c] of t)
1297
+ a(l, c);
1307
1298
  else if (t && typeof t == "object")
1308
- for (const a of Object.keys(t))
1309
- l(a, t[a]);
1299
+ for (const l of Object.keys(t))
1300
+ a(l, t[l]);
1310
1301
  return typeof e.sortMapEntries == "function" && o.items.sort(e.sortMapEntries), o;
1311
1302
  }
1312
1303
  /**
@@ -1317,14 +1308,14 @@ class M extends Kt {
1317
1308
  */
1318
1309
  add(e, t) {
1319
1310
  let n;
1320
- $(e) ? n = e : !e || typeof e != "object" || !("key" in e) ? n = new B(e, e?.value) : n = new B(e.key, e.value);
1311
+ L(e) ? n = e : !e || typeof e != "object" || !("key" in e) ? n = new B(e, e?.value) : n = new B(e.key, e.value);
1321
1312
  const i = H(this.items, n.key), r = this.schema?.sortMapEntries;
1322
1313
  if (i) {
1323
1314
  if (!t)
1324
1315
  throw new Error(`Key ${n.key} already set`);
1325
- E(i.value) && jt(n.value) ? i.value.value = n.value : i.value = n.value;
1316
+ T(i.value) && Pt(n.value) ? i.value.value = n.value : i.value = n.value;
1326
1317
  } else if (r) {
1327
- const o = this.items.findIndex((l) => r(n, l) < 0);
1318
+ const o = this.items.findIndex((a) => r(n, a) < 0);
1328
1319
  o === -1 ? this.items.push(n) : this.items.splice(o, 0, n);
1329
1320
  } else
1330
1321
  this.items.push(n);
@@ -1335,7 +1326,7 @@ class M extends Kt {
1335
1326
  }
1336
1327
  get(e, t) {
1337
1328
  const i = H(this.items, e)?.value;
1338
- return (!t && E(i) ? i.value : i) ?? void 0;
1329
+ return (!t && T(i) ? i.value : i) ?? void 0;
1339
1330
  }
1340
1331
  has(e) {
1341
1332
  return !!H(this.items, e);
@@ -1359,7 +1350,7 @@ class M extends Kt {
1359
1350
  if (!e)
1360
1351
  return JSON.stringify(this);
1361
1352
  for (const i of this.items)
1362
- if (!$(i))
1353
+ if (!L(i))
1363
1354
  throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);
1364
1355
  return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), Vt(this, e, {
1365
1356
  blockItemPrefix: "",
@@ -1370,7 +1361,7 @@ class M extends Kt {
1370
1361
  });
1371
1362
  }
1372
1363
  }
1373
- const ae = {
1364
+ const le = {
1374
1365
  collection: "map",
1375
1366
  default: !0,
1376
1367
  nodeClass: M,
@@ -1407,7 +1398,7 @@ class W extends Kt {
1407
1398
  if (typeof n != "number")
1408
1399
  return;
1409
1400
  const i = this.items[n];
1410
- return !t && E(i) ? i.value : i;
1401
+ return !t && T(i) ? i.value : i;
1411
1402
  }
1412
1403
  /**
1413
1404
  * Checks if the collection includes a value with the key `key`.
@@ -1431,14 +1422,14 @@ class W extends Kt {
1431
1422
  if (typeof n != "number")
1432
1423
  throw new Error(`Expected a valid index, not ${e}.`);
1433
1424
  const i = this.items[n];
1434
- E(i) && jt(t) ? i.value = t : this.items[n] = t;
1425
+ T(i) && Pt(t) ? i.value = t : this.items[n] = t;
1435
1426
  }
1436
1427
  toJSON(e, t) {
1437
1428
  const n = [];
1438
1429
  t?.onCreate && t.onCreate(n);
1439
1430
  let i = 0;
1440
1431
  for (const r of this.items)
1441
- n.push(P(r, String(i++), t));
1432
+ n.push(j(r, String(i++), t));
1442
1433
  return n;
1443
1434
  }
1444
1435
  toString(e, t, n) {
@@ -1454,19 +1445,19 @@ class W extends Kt {
1454
1445
  const { replacer: i } = n, r = new this(e);
1455
1446
  if (t && Symbol.iterator in Object(t)) {
1456
1447
  let o = 0;
1457
- for (let l of t) {
1448
+ for (let a of t) {
1458
1449
  if (typeof i == "function") {
1459
- const a = t instanceof Set ? l : String(o++);
1460
- l = i.call(t, a, l);
1450
+ const l = t instanceof Set ? a : String(o++);
1451
+ a = i.call(t, l, a);
1461
1452
  }
1462
- r.items.push(me(l, void 0, n));
1453
+ r.items.push(me(a, void 0, n));
1463
1454
  }
1464
1455
  }
1465
1456
  return r;
1466
1457
  }
1467
1458
  }
1468
1459
  function Ne(s) {
1469
- let e = E(s) ? s.value : s;
1460
+ let e = T(s) ? s.value : s;
1470
1461
  return e && typeof e == "string" && (e = Number(e)), typeof e == "number" && Number.isInteger(e) && e >= 0 ? e : null;
1471
1462
  }
1472
1463
  const ce = {
@@ -1484,16 +1475,16 @@ const ce = {
1484
1475
  tag: "tag:yaml.org,2002:str",
1485
1476
  resolve: (s) => s,
1486
1477
  stringify(s, e, t, n) {
1487
- return e = Object.assign({ actualString: !0 }, e), rt(s, e, t, n);
1478
+ return e = Object.assign({ actualString: !0 }, e), ot(s, e, t, n);
1488
1479
  }
1489
- }, je = {
1480
+ }, Ke = {
1490
1481
  identify: (s) => s == null,
1491
1482
  createNode: () => new O(null),
1492
1483
  default: !0,
1493
1484
  tag: "tag:yaml.org,2002:null",
1494
1485
  test: /^(?:~|[Nn]ull|NULL)?$/,
1495
1486
  resolve: () => new O(null),
1496
- stringify: ({ source: s }, e) => typeof s == "string" && je.test.test(s) ? s : e.options.nullStr
1487
+ stringify: ({ source: s }, e) => typeof s == "string" && Ke.test.test(s) ? s : e.options.nullStr
1497
1488
  }, lt = {
1498
1489
  identify: (s) => typeof s == "boolean",
1499
1490
  default: !0,
@@ -1519,8 +1510,8 @@ function D({ format: s, minFractionDigits: e, tag: t, value: n }) {
1519
1510
  if (!s && e && (!t || t === "tag:yaml.org,2002:float") && /^\d/.test(r)) {
1520
1511
  let o = r.indexOf(".");
1521
1512
  o < 0 && (o = r.length, r += ".");
1522
- let l = e - (r.length - o - 1);
1523
- for (; l-- > 0; )
1513
+ let a = e - (r.length - o - 1);
1514
+ for (; a-- > 0; )
1524
1515
  r += "0";
1525
1516
  }
1526
1517
  return r;
@@ -1553,39 +1544,39 @@ const Jt = {
1553
1544
  return t !== -1 && s[s.length - 1] === "0" && (e.minFractionDigits = s.length - t - 1), e;
1554
1545
  },
1555
1546
  stringify: D
1556
- }, Ke = (s) => typeof s == "bigint" || Number.isInteger(s), at = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
1547
+ }, De = (s) => typeof s == "bigint" || Number.isInteger(s), ct = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
1557
1548
  function Ht(s, e, t) {
1558
1549
  const { value: n } = s;
1559
- return Ke(n) && n >= 0 ? t + n.toString(e) : D(s);
1550
+ return De(n) && n >= 0 ? t + n.toString(e) : D(s);
1560
1551
  }
1561
1552
  const Wt = {
1562
- identify: (s) => Ke(s) && s >= 0,
1553
+ identify: (s) => De(s) && s >= 0,
1563
1554
  default: !0,
1564
1555
  tag: "tag:yaml.org,2002:int",
1565
1556
  format: "OCT",
1566
1557
  test: /^0o[0-7]+$/,
1567
- resolve: (s, e, t) => at(s, 2, 8, t),
1558
+ resolve: (s, e, t) => ct(s, 2, 8, t),
1568
1559
  stringify: (s) => Ht(s, 8, "0o")
1569
1560
  }, Qt = {
1570
- identify: Ke,
1561
+ identify: De,
1571
1562
  default: !0,
1572
1563
  tag: "tag:yaml.org,2002:int",
1573
1564
  test: /^[-+]?[0-9]+$/,
1574
- resolve: (s, e, t) => at(s, 0, 10, t),
1565
+ resolve: (s, e, t) => ct(s, 0, 10, t),
1575
1566
  stringify: D
1576
1567
  }, Xt = {
1577
- identify: (s) => Ke(s) && s >= 0,
1568
+ identify: (s) => De(s) && s >= 0,
1578
1569
  default: !0,
1579
1570
  tag: "tag:yaml.org,2002:int",
1580
1571
  format: "HEX",
1581
1572
  test: /^0x[0-9a-fA-F]+$/,
1582
- resolve: (s, e, t) => at(s, 2, 16, t),
1573
+ resolve: (s, e, t) => ct(s, 2, 16, t),
1583
1574
  stringify: (s) => Ht(s, 16, "0x")
1584
- }, Fs = [
1585
- ae,
1575
+ }, Ys = [
1576
+ le,
1586
1577
  ce,
1587
1578
  Pe,
1588
- je,
1579
+ Ke,
1589
1580
  lt,
1590
1581
  Wt,
1591
1582
  Qt,
@@ -1594,10 +1585,10 @@ const Wt = {
1594
1585
  Yt,
1595
1586
  Gt
1596
1587
  ];
1597
- function kt(s) {
1588
+ function St(s) {
1598
1589
  return typeof s == "bigint" || Number.isInteger(s);
1599
1590
  }
1600
- const Oe = ({ value: s }) => JSON.stringify(s), Rs = [
1591
+ const Oe = ({ value: s }) => JSON.stringify(s), Gs = [
1601
1592
  {
1602
1593
  identify: (s) => typeof s == "string",
1603
1594
  default: !0,
@@ -1623,12 +1614,12 @@ const Oe = ({ value: s }) => JSON.stringify(s), Rs = [
1623
1614
  stringify: Oe
1624
1615
  },
1625
1616
  {
1626
- identify: kt,
1617
+ identify: St,
1627
1618
  default: !0,
1628
1619
  tag: "tag:yaml.org,2002:int",
1629
1620
  test: /^-?(?:0|[1-9][0-9]*)$/,
1630
1621
  resolve: (s, e, { intAsBigInt: t }) => t ? BigInt(s) : parseInt(s, 10),
1631
- stringify: ({ value: s }) => kt(s) ? s.toString() : JSON.stringify(s)
1622
+ stringify: ({ value: s }) => St(s) ? s.toString() : JSON.stringify(s)
1632
1623
  },
1633
1624
  {
1634
1625
  identify: (s) => typeof s == "number",
@@ -1638,14 +1629,14 @@ const Oe = ({ value: s }) => JSON.stringify(s), Rs = [
1638
1629
  resolve: (s) => parseFloat(s),
1639
1630
  stringify: Oe
1640
1631
  }
1641
- ], Vs = {
1632
+ ], Hs = {
1642
1633
  default: !0,
1643
1634
  tag: "",
1644
1635
  test: /^/,
1645
1636
  resolve(s, e) {
1646
1637
  return e(`Unresolved plain scalar ${JSON.stringify(s)}`), s;
1647
1638
  }
1648
- }, Js = [ae, ce].concat(Rs, Vs), ct = {
1639
+ }, Ws = [le, ce].concat(Gs, Hs), ft = {
1649
1640
  identify: (s) => s instanceof Uint8Array,
1650
1641
  // Buffer inherits from Uint8Array
1651
1642
  default: !1,
@@ -1671,29 +1662,29 @@ const Oe = ({ value: s }) => JSON.stringify(s), Rs = [
1671
1662
  if (!t)
1672
1663
  return "";
1673
1664
  const o = t;
1674
- let l;
1665
+ let a;
1675
1666
  if (typeof btoa == "function") {
1676
- let a = "";
1667
+ let l = "";
1677
1668
  for (let c = 0; c < o.length; ++c)
1678
- a += String.fromCharCode(o[c]);
1679
- l = btoa(a);
1669
+ l += String.fromCharCode(o[c]);
1670
+ a = btoa(l);
1680
1671
  } else
1681
1672
  throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
1682
1673
  if (e ?? (e = O.BLOCK_LITERAL), e !== O.QUOTE_DOUBLE) {
1683
- const a = Math.max(n.options.lineWidth - n.indent.length, n.options.minContentWidth), c = Math.ceil(l.length / a), d = new Array(c);
1684
- for (let f = 0, u = 0; f < c; ++f, u += a)
1685
- d[f] = l.substr(u, a);
1686
- l = d.join(e === O.BLOCK_LITERAL ? `
1674
+ const l = Math.max(n.options.lineWidth - n.indent.length, n.options.minContentWidth), c = Math.ceil(a.length / l), d = new Array(c);
1675
+ for (let u = 0, f = 0; u < c; ++u, f += l)
1676
+ d[u] = a.substr(f, l);
1677
+ a = d.join(e === O.BLOCK_LITERAL ? `
1687
1678
  ` : " ");
1688
1679
  }
1689
- return rt({ comment: s, type: e, value: l }, n, i, r);
1680
+ return ot({ comment: s, type: e, value: a }, n, i, r);
1690
1681
  }
1691
1682
  };
1692
1683
  function xt(s, e) {
1693
1684
  if (be(s))
1694
1685
  for (let t = 0; t < s.items.length; ++t) {
1695
1686
  let n = s.items[t];
1696
- if (!$(n)) {
1687
+ if (!L(n)) {
1697
1688
  if (ye(n)) {
1698
1689
  n.items.length > 1 && e("Each pair must have its own sequence indicator");
1699
1690
  const i = n.items[0] || new B(new O(null));
@@ -1705,7 +1696,7 @@ ${r.comment}` : n.comment;
1705
1696
  }
1706
1697
  n = i;
1707
1698
  }
1708
- s.items[t] = $(n) ? n : new B(n);
1699
+ s.items[t] = L(n) ? n : new B(n);
1709
1700
  }
1710
1701
  }
1711
1702
  else
@@ -1719,25 +1710,25 @@ function zt(s, e, t) {
1719
1710
  if (e && Symbol.iterator in Object(e))
1720
1711
  for (let o of e) {
1721
1712
  typeof n == "function" && (o = n.call(e, String(r++), o));
1722
- let l, a;
1713
+ let a, l;
1723
1714
  if (Array.isArray(o))
1724
1715
  if (o.length === 2)
1725
- l = o[0], a = o[1];
1716
+ a = o[0], l = o[1];
1726
1717
  else
1727
1718
  throw new TypeError(`Expected [key, value] tuple: ${o}`);
1728
1719
  else if (o && o instanceof Object) {
1729
1720
  const c = Object.keys(o);
1730
1721
  if (c.length === 1)
1731
- l = c[0], a = o[l];
1722
+ a = c[0], l = o[a];
1732
1723
  else
1733
1724
  throw new TypeError(`Expected tuple with one key, not ${c.length} keys`);
1734
1725
  } else
1735
- l = o;
1736
- i.items.push(ot(l, a, t));
1726
+ a = o;
1727
+ i.items.push(at(a, l, t));
1737
1728
  }
1738
1729
  return i;
1739
1730
  }
1740
- const ft = {
1731
+ const ut = {
1741
1732
  collection: "seq",
1742
1733
  default: !1,
1743
1734
  tag: "tag:yaml.org,2002:pairs",
@@ -1759,7 +1750,7 @@ class se extends W {
1759
1750
  t?.onCreate && t.onCreate(n);
1760
1751
  for (const i of this.items) {
1761
1752
  let r, o;
1762
- if ($(i) ? (r = P(i.key, "", t), o = P(i.value, r, t)) : r = P(i, "", t), n.has(r))
1753
+ if (L(i) ? (r = j(i.key, "", t), o = j(i.value, r, t)) : r = j(i, "", t), n.has(r))
1763
1754
  throw new Error("Ordered maps must not include duplicate keys");
1764
1755
  n.set(r, o);
1765
1756
  }
@@ -1771,7 +1762,7 @@ class se extends W {
1771
1762
  }
1772
1763
  }
1773
1764
  se.tag = "tag:yaml.org,2002:omap";
1774
- const ut = {
1765
+ const ht = {
1775
1766
  collection: "seq",
1776
1767
  identify: (s) => s instanceof Map,
1777
1768
  nodeClass: se,
@@ -1780,7 +1771,7 @@ const ut = {
1780
1771
  resolve(s, e) {
1781
1772
  const t = xt(s, e), n = [];
1782
1773
  for (const { key: i } of t.items)
1783
- E(i) && (n.includes(i.value) ? e(`Ordered maps must not include duplicate keys: ${i.value}`) : n.push(i.value));
1774
+ T(i) && (n.includes(i.value) ? e(`Ordered maps must not include duplicate keys: ${i.value}`) : n.push(i.value));
1784
1775
  return Object.assign(new se(), t);
1785
1776
  },
1786
1777
  createNode: (s, e, t) => se.from(s, e, t)
@@ -1802,14 +1793,14 @@ const es = {
1802
1793
  test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
1803
1794
  resolve: () => new O(!1),
1804
1795
  stringify: Zt
1805
- }, Ys = {
1796
+ }, Qs = {
1806
1797
  identify: (s) => typeof s == "number",
1807
1798
  default: !0,
1808
1799
  tag: "tag:yaml.org,2002:float",
1809
1800
  test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
1810
1801
  resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
1811
1802
  stringify: D
1812
- }, Gs = {
1803
+ }, Xs = {
1813
1804
  identify: (s) => typeof s == "number",
1814
1805
  default: !0,
1815
1806
  tag: "tag:yaml.org,2002:float",
@@ -1820,7 +1811,7 @@ const es = {
1820
1811
  const e = Number(s.value);
1821
1812
  return isFinite(e) ? e.toExponential() : D(s);
1822
1813
  }
1823
- }, Hs = {
1814
+ }, xs = {
1824
1815
  identify: (s) => typeof s == "number",
1825
1816
  default: !0,
1826
1817
  tag: "tag:yaml.org,2002:float",
@@ -1835,7 +1826,7 @@ const es = {
1835
1826
  },
1836
1827
  stringify: D
1837
1828
  }, we = (s) => typeof s == "bigint" || Number.isInteger(s);
1838
- function De(s, e, t, { intAsBigInt: n }) {
1829
+ function qe(s, e, t, { intAsBigInt: n }) {
1839
1830
  const i = s[0];
1840
1831
  if ((i === "-" || i === "+") && (e += 1), s = s.substring(e).replace(/_/g, ""), n) {
1841
1832
  switch (t) {
@@ -1855,7 +1846,7 @@ function De(s, e, t, { intAsBigInt: n }) {
1855
1846
  const r = parseInt(s, t);
1856
1847
  return i === "-" ? -1 * r : r;
1857
1848
  }
1858
- function ht(s, e, t) {
1849
+ function dt(s, e, t) {
1859
1850
  const { value: n } = s;
1860
1851
  if (we(n)) {
1861
1852
  const i = n.toString(e);
@@ -1863,37 +1854,37 @@ function ht(s, e, t) {
1863
1854
  }
1864
1855
  return D(s);
1865
1856
  }
1866
- const Ws = {
1857
+ const zs = {
1867
1858
  identify: we,
1868
1859
  default: !0,
1869
1860
  tag: "tag:yaml.org,2002:int",
1870
1861
  format: "BIN",
1871
1862
  test: /^[-+]?0b[0-1_]+$/,
1872
- resolve: (s, e, t) => De(s, 2, 2, t),
1873
- stringify: (s) => ht(s, 2, "0b")
1874
- }, Qs = {
1863
+ resolve: (s, e, t) => qe(s, 2, 2, t),
1864
+ stringify: (s) => dt(s, 2, "0b")
1865
+ }, Zs = {
1875
1866
  identify: we,
1876
1867
  default: !0,
1877
1868
  tag: "tag:yaml.org,2002:int",
1878
1869
  format: "OCT",
1879
1870
  test: /^[-+]?0[0-7_]+$/,
1880
- resolve: (s, e, t) => De(s, 1, 8, t),
1881
- stringify: (s) => ht(s, 8, "0")
1882
- }, Xs = {
1871
+ resolve: (s, e, t) => qe(s, 1, 8, t),
1872
+ stringify: (s) => dt(s, 8, "0")
1873
+ }, en = {
1883
1874
  identify: we,
1884
1875
  default: !0,
1885
1876
  tag: "tag:yaml.org,2002:int",
1886
1877
  test: /^[-+]?[0-9][0-9_]*$/,
1887
- resolve: (s, e, t) => De(s, 0, 10, t),
1878
+ resolve: (s, e, t) => qe(s, 0, 10, t),
1888
1879
  stringify: D
1889
- }, xs = {
1880
+ }, tn = {
1890
1881
  identify: we,
1891
1882
  default: !0,
1892
1883
  tag: "tag:yaml.org,2002:int",
1893
1884
  format: "HEX",
1894
1885
  test: /^[-+]?0x[0-9a-fA-F_]+$/,
1895
- resolve: (s, e, t) => De(s, 2, 16, t),
1896
- stringify: (s) => ht(s, 16, "0x")
1886
+ resolve: (s, e, t) => qe(s, 2, 16, t),
1887
+ stringify: (s) => dt(s, 16, "0x")
1897
1888
  };
1898
1889
  class ne extends M {
1899
1890
  constructor(e) {
@@ -1901,7 +1892,7 @@ class ne extends M {
1901
1892
  }
1902
1893
  add(e) {
1903
1894
  let t;
1904
- $(e) ? t = e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? t = new B(e.key, null) : t = new B(e, null), H(this.items, t.key) || this.items.push(t);
1895
+ L(e) ? t = e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? t = new B(e.key, null) : t = new B(e, null), H(this.items, t.key) || this.items.push(t);
1905
1896
  }
1906
1897
  /**
1907
1898
  * If `keepPair` is `true`, returns the Pair matching `key`.
@@ -1909,7 +1900,7 @@ class ne extends M {
1909
1900
  */
1910
1901
  get(e, t) {
1911
1902
  const n = H(this.items, e);
1912
- return !t && $(n) ? E(n.key) ? n.key.value : n.key : n;
1903
+ return !t && L(n) ? T(n.key) ? n.key.value : n.key : n;
1913
1904
  }
1914
1905
  set(e, t) {
1915
1906
  if (typeof t != "boolean")
@@ -1931,12 +1922,12 @@ class ne extends M {
1931
1922
  const { replacer: i } = n, r = new this(e);
1932
1923
  if (t && Symbol.iterator in Object(t))
1933
1924
  for (let o of t)
1934
- typeof i == "function" && (o = i.call(t, o, o)), r.items.push(ot(o, null, n));
1925
+ typeof i == "function" && (o = i.call(t, o, o)), r.items.push(at(o, null, n));
1935
1926
  return r;
1936
1927
  }
1937
1928
  }
1938
1929
  ne.tag = "tag:yaml.org,2002:set";
1939
- const dt = {
1930
+ const pt = {
1940
1931
  collection: "map",
1941
1932
  identify: (s) => s instanceof Set,
1942
1933
  nodeClass: ne,
@@ -1953,8 +1944,8 @@ const dt = {
1953
1944
  return s;
1954
1945
  }
1955
1946
  };
1956
- function pt(s, e) {
1957
- const t = s[0], n = t === "-" || t === "+" ? s.substring(1) : s, i = (o) => e ? BigInt(o) : Number(o), r = n.replace(/_/g, "").split(":").reduce((o, l) => o * i(60) + i(l), i(0));
1947
+ function mt(s, e) {
1948
+ const t = s[0], n = t === "-" || t === "+" ? s.substring(1) : s, i = (o) => e ? BigInt(o) : Number(o), r = n.replace(/_/g, "").split(":").reduce((o, a) => o * i(60) + i(a), i(0));
1958
1949
  return t === "-" ? i(-1) * r : r;
1959
1950
  }
1960
1951
  function ss(s) {
@@ -1974,7 +1965,7 @@ const ns = {
1974
1965
  tag: "tag:yaml.org,2002:int",
1975
1966
  format: "TIME",
1976
1967
  test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
1977
- resolve: (s, e, { intAsBigInt: t }) => pt(s, t),
1968
+ resolve: (s, e, { intAsBigInt: t }) => mt(s, t),
1978
1969
  stringify: ss
1979
1970
  }, is = {
1980
1971
  identify: (s) => typeof s == "number",
@@ -1982,9 +1973,9 @@ const ns = {
1982
1973
  tag: "tag:yaml.org,2002:float",
1983
1974
  format: "TIME",
1984
1975
  test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
1985
- resolve: (s) => pt(s, !1),
1976
+ resolve: (s) => mt(s, !1),
1986
1977
  stringify: ss
1987
- }, qe = {
1978
+ }, Fe = {
1988
1979
  identify: (s) => s instanceof Date,
1989
1980
  default: !0,
1990
1981
  tag: "tag:yaml.org,2002:timestamp",
@@ -1993,49 +1984,49 @@ const ns = {
1993
1984
  // assumed to be 00:00:00Z (start of day, UTC).
1994
1985
  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})?))?)?$"),
1995
1986
  resolve(s) {
1996
- const e = s.match(qe.test);
1987
+ const e = s.match(Fe.test);
1997
1988
  if (!e)
1998
1989
  throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
1999
- const [, t, n, i, r, o, l] = e.map(Number), a = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
2000
- let c = Date.UTC(t, n - 1, i, r || 0, o || 0, l || 0, a);
1990
+ const [, t, n, i, r, o, a] = e.map(Number), l = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
1991
+ let c = Date.UTC(t, n - 1, i, r || 0, o || 0, a || 0, l);
2001
1992
  const d = e[8];
2002
1993
  if (d && d !== "Z") {
2003
- let f = pt(d, !1);
2004
- Math.abs(f) < 30 && (f *= 60), c -= 6e4 * f;
1994
+ let u = mt(d, !1);
1995
+ Math.abs(u) < 30 && (u *= 60), c -= 6e4 * u;
2005
1996
  }
2006
1997
  return new Date(c);
2007
1998
  },
2008
1999
  stringify: ({ value: s }) => s?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
2009
- }, St = [
2010
- ae,
2000
+ }, Nt = [
2001
+ le,
2011
2002
  ce,
2012
2003
  Pe,
2013
- je,
2004
+ Ke,
2014
2005
  es,
2015
2006
  ts,
2016
- Ws,
2007
+ zs,
2008
+ Zs,
2009
+ en,
2010
+ tn,
2017
2011
  Qs,
2018
2012
  Xs,
2019
2013
  xs,
2020
- Ys,
2021
- Gs,
2022
- Hs,
2023
- ct,
2024
- F,
2025
- ut,
2026
2014
  ft,
2027
- dt,
2015
+ U,
2016
+ ht,
2017
+ ut,
2018
+ pt,
2028
2019
  ns,
2029
2020
  is,
2030
- qe
2031
- ], Nt = /* @__PURE__ */ new Map([
2032
- ["core", Fs],
2033
- ["failsafe", [ae, ce, Pe]],
2034
- ["json", Js],
2035
- ["yaml11", St],
2036
- ["yaml-1.1", St]
2037
- ]), Ot = {
2038
- binary: ct,
2021
+ Fe
2022
+ ], Ot = /* @__PURE__ */ new Map([
2023
+ ["core", Ys],
2024
+ ["failsafe", [le, ce, Pe]],
2025
+ ["json", Ws],
2026
+ ["yaml11", Nt],
2027
+ ["yaml-1.1", Nt]
2028
+ ]), At = {
2029
+ binary: ft,
2039
2030
  bool: lt,
2040
2031
  float: Gt,
2041
2032
  floatExp: Yt,
@@ -2045,95 +2036,95 @@ const ns = {
2045
2036
  intHex: Xt,
2046
2037
  intOct: Wt,
2047
2038
  intTime: ns,
2048
- map: ae,
2049
- merge: F,
2050
- null: je,
2051
- omap: ut,
2052
- pairs: ft,
2039
+ map: le,
2040
+ merge: U,
2041
+ null: Ke,
2042
+ omap: ht,
2043
+ pairs: ut,
2053
2044
  seq: ce,
2054
- set: dt,
2055
- timestamp: qe
2056
- }, zs = {
2057
- "tag:yaml.org,2002:binary": ct,
2058
- "tag:yaml.org,2002:merge": F,
2059
- "tag:yaml.org,2002:omap": ut,
2060
- "tag:yaml.org,2002:pairs": ft,
2061
- "tag:yaml.org,2002:set": dt,
2062
- "tag:yaml.org,2002:timestamp": qe
2045
+ set: pt,
2046
+ timestamp: Fe
2047
+ }, sn = {
2048
+ "tag:yaml.org,2002:binary": ft,
2049
+ "tag:yaml.org,2002:merge": U,
2050
+ "tag:yaml.org,2002:omap": ht,
2051
+ "tag:yaml.org,2002:pairs": ut,
2052
+ "tag:yaml.org,2002:set": pt,
2053
+ "tag:yaml.org,2002:timestamp": Fe
2063
2054
  };
2064
- function Ve(s, e, t) {
2065
- const n = Nt.get(e);
2055
+ function Je(s, e, t) {
2056
+ const n = Ot.get(e);
2066
2057
  if (n && !s)
2067
- return t && !n.includes(F) ? n.concat(F) : n.slice();
2058
+ return t && !n.includes(U) ? n.concat(U) : n.slice();
2068
2059
  let i = n;
2069
2060
  if (!i)
2070
2061
  if (Array.isArray(s))
2071
2062
  i = [];
2072
2063
  else {
2073
- const r = Array.from(Nt.keys()).filter((o) => o !== "yaml11").map((o) => JSON.stringify(o)).join(", ");
2064
+ const r = Array.from(Ot.keys()).filter((o) => o !== "yaml11").map((o) => JSON.stringify(o)).join(", ");
2074
2065
  throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`);
2075
2066
  }
2076
2067
  if (Array.isArray(s))
2077
2068
  for (const r of s)
2078
2069
  i = i.concat(r);
2079
2070
  else typeof s == "function" && (i = s(i.slice()));
2080
- return t && (i = i.concat(F)), i.reduce((r, o) => {
2081
- const l = typeof o == "string" ? Ot[o] : o;
2082
- if (!l) {
2083
- const a = JSON.stringify(o), c = Object.keys(Ot).map((d) => JSON.stringify(d)).join(", ");
2084
- throw new Error(`Unknown custom tag ${a}; use one of ${c}`);
2071
+ return t && (i = i.concat(U)), i.reduce((r, o) => {
2072
+ const a = typeof o == "string" ? At[o] : o;
2073
+ if (!a) {
2074
+ const l = JSON.stringify(o), c = Object.keys(At).map((d) => JSON.stringify(d)).join(", ");
2075
+ throw new Error(`Unknown custom tag ${l}; use one of ${c}`);
2085
2076
  }
2086
- return r.includes(l) || r.push(l), r;
2077
+ return r.includes(a) || r.push(a), r;
2087
2078
  }, []);
2088
2079
  }
2089
- const Zs = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
2090
- class mt {
2091
- constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: l }) {
2092
- this.compat = Array.isArray(e) ? Ve(e, "compat") : e ? Ve(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ? zs : {}, this.tags = Ve(t, this.name, n), this.toStringOptions = l ?? null, Object.defineProperty(this, J, { value: ae }), Object.defineProperty(this, q, { value: Pe }), Object.defineProperty(this, oe, { value: ce }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? Zs : null;
2080
+ const nn = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
2081
+ class gt {
2082
+ constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: a }) {
2083
+ this.compat = Array.isArray(e) ? Je(e, "compat") : e ? Je(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ? sn : {}, this.tags = Je(t, this.name, n), this.toStringOptions = a ?? null, Object.defineProperty(this, J, { value: le }), Object.defineProperty(this, q, { value: Pe }), Object.defineProperty(this, oe, { value: ce }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? nn : null;
2093
2084
  }
2094
2085
  clone() {
2095
- const e = Object.create(mt.prototype, Object.getOwnPropertyDescriptors(this));
2086
+ const e = Object.create(gt.prototype, Object.getOwnPropertyDescriptors(this));
2096
2087
  return e.tags = this.tags.slice(), e;
2097
2088
  }
2098
2089
  }
2099
- function en(s, e) {
2090
+ function rn(s, e) {
2100
2091
  const t = [];
2101
2092
  let n = e.directives === !0;
2102
2093
  if (e.directives !== !1 && s.directives) {
2103
- const a = s.directives.toString(s);
2104
- a ? (t.push(a), n = !0) : s.directives.docStart && (n = !0);
2094
+ const l = s.directives.toString(s);
2095
+ l ? (t.push(l), n = !0) : s.directives.docStart && (n = !0);
2105
2096
  }
2106
2097
  n && t.push("---");
2107
2098
  const i = qt(s, e), { commentString: r } = i.options;
2108
2099
  if (s.commentBefore) {
2109
2100
  t.length !== 1 && t.unshift("");
2110
- const a = r(s.commentBefore);
2111
- t.unshift(U(a, ""));
2101
+ const l = r(s.commentBefore);
2102
+ t.unshift(F(l, ""));
2112
2103
  }
2113
- let o = !1, l = null;
2104
+ let o = !1, a = null;
2114
2105
  if (s.contents) {
2115
- if (L(s.contents)) {
2106
+ if ($(s.contents)) {
2116
2107
  if (s.contents.spaceBefore && n && t.push(""), s.contents.commentBefore) {
2117
2108
  const d = r(s.contents.commentBefore);
2118
- t.push(U(d, ""));
2109
+ t.push(F(d, ""));
2119
2110
  }
2120
- i.forceBlockIndent = !!s.comment, l = s.contents.comment;
2111
+ i.forceBlockIndent = !!s.comment, a = s.contents.comment;
2121
2112
  }
2122
- const a = l ? void 0 : () => o = !0;
2123
- let c = ie(s.contents, i, () => l = null, a);
2124
- l && (c += G(c, "", r(l))), (c[0] === "|" || c[0] === ">") && t[t.length - 1] === "---" ? t[t.length - 1] = `--- ${c}` : t.push(c);
2113
+ const l = a ? void 0 : () => o = !0;
2114
+ let c = ie(s.contents, i, () => a = null, l);
2115
+ a && (c += G(c, "", r(a))), (c[0] === "|" || c[0] === ">") && t[t.length - 1] === "---" ? t[t.length - 1] = `--- ${c}` : t.push(c);
2125
2116
  } else
2126
2117
  t.push(ie(s.contents, i));
2127
2118
  if (s.directives?.docEnd)
2128
2119
  if (s.comment) {
2129
- const a = r(s.comment);
2130
- a.includes(`
2131
- `) ? (t.push("..."), t.push(U(a, ""))) : t.push(`... ${a}`);
2120
+ const l = r(s.comment);
2121
+ l.includes(`
2122
+ `) ? (t.push("..."), t.push(F(l, ""))) : t.push(`... ${l}`);
2132
2123
  } else
2133
2124
  t.push("...");
2134
2125
  else {
2135
- let a = s.comment;
2136
- a && o && (a = a.replace(/^\n+/, "")), a && ((!o || l) && t[t.length - 1] !== "" && t.push(""), t.push(U(r(a), "")));
2126
+ let l = s.comment;
2127
+ l && o && (l = l.replace(/^\n+/, "")), l && ((!o || a) && t[t.length - 1] !== "" && t.push(""), t.push(F(r(l), "")));
2137
2128
  }
2138
2129
  return t.join(`
2139
2130
  `) + `
@@ -2141,7 +2132,7 @@ function en(s, e) {
2141
2132
  }
2142
2133
  class Ue {
2143
2134
  constructor(e, t, n) {
2144
- this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, j, { value: We });
2135
+ this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, P, { value: Qe });
2145
2136
  let i = null;
2146
2137
  typeof t == "function" || Array.isArray(t) ? i = t : n === void 0 && t && (n = t, t = void 0);
2147
2138
  const r = Object.assign({
@@ -2165,9 +2156,9 @@ class Ue {
2165
2156
  */
2166
2157
  clone() {
2167
2158
  const e = Object.create(Ue.prototype, {
2168
- [j]: { value: We }
2159
+ [P]: { value: Qe }
2169
2160
  });
2170
- 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 = L(this.contents) ? this.contents.clone(e.schema) : this.contents, this.range && (e.range = this.range.slice()), e;
2161
+ 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;
2171
2162
  }
2172
2163
  /** Adds a value to the document. */
2173
2164
  add(e) {
@@ -2190,9 +2181,9 @@ class Ue {
2190
2181
  if (!e.anchor) {
2191
2182
  const n = Mt(this);
2192
2183
  e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
2193
- !t || n.has(t) ? Pt(t || "a", n) : t;
2184
+ !t || n.has(t) ? jt(t || "a", n) : t;
2194
2185
  }
2195
- return new it(e.anchor);
2186
+ return new rt(e.anchor);
2196
2187
  }
2197
2188
  createNode(e, t, n) {
2198
2189
  let i;
@@ -2202,20 +2193,20 @@ class Ue {
2202
2193
  const p = (w) => typeof w == "number" || w instanceof String || w instanceof Number, b = t.filter(p).map(String);
2203
2194
  b.length > 0 && (t = t.concat(b)), i = t;
2204
2195
  } else n === void 0 && t && (n = t, t = void 0);
2205
- const { aliasDuplicateObjects: r, anchorPrefix: o, flow: l, keepUndefined: a, onTagObj: c, tag: d } = n ?? {}, { onAnchor: f, setAnchors: u, sourceObjects: m } = Ls(
2196
+ const { aliasDuplicateObjects: r, anchorPrefix: o, flow: a, keepUndefined: l, onTagObj: c, tag: d } = n ?? {}, { onAnchor: u, setAnchors: f, sourceObjects: m } = _s(
2206
2197
  this,
2207
2198
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
2208
2199
  o || "a"
2209
2200
  ), g = {
2210
2201
  aliasDuplicateObjects: r ?? !0,
2211
- keepUndefined: a ?? !1,
2212
- onAnchor: f,
2202
+ keepUndefined: l ?? !1,
2203
+ onAnchor: u,
2213
2204
  onTagObj: c,
2214
2205
  replacer: i,
2215
2206
  schema: this.schema,
2216
2207
  sourceObjects: m
2217
2208
  }, h = me(e, d, g);
2218
- return l && I(h) && (h.flow = !0), u(), h;
2209
+ return a && I(h) && (h.flow = !0), f(), h;
2219
2210
  }
2220
2211
  /**
2221
2212
  * Convert a key and a value into a `Pair` using the current schema,
@@ -2253,7 +2244,7 @@ class Ue {
2253
2244
  * `true` (collections are always returned intact).
2254
2245
  */
2255
2246
  getIn(e, t) {
2256
- return ue(e) ? !t && E(this.contents) ? this.contents.value : this.contents : I(this.contents) ? this.contents.getIn(e, t) : void 0;
2247
+ return ue(e) ? !t && T(this.contents) ? this.contents.value : this.contents : I(this.contents) ? this.contents.getIn(e, t) : void 0;
2257
2248
  }
2258
2249
  /**
2259
2250
  * Checks if the document includes a value with the key `key`.
@@ -2272,14 +2263,14 @@ class Ue {
2272
2263
  * boolean to add/remove the item from the set.
2273
2264
  */
2274
2265
  set(e, t) {
2275
- this.contents == null ? this.contents = $e(this.schema, [e], t) : x(this.contents) && this.contents.set(e, t);
2266
+ this.contents == null ? this.contents = Le(this.schema, [e], t) : x(this.contents) && this.contents.set(e, t);
2276
2267
  }
2277
2268
  /**
2278
2269
  * Sets a value in this document. For `!!set`, `value` needs to be a
2279
2270
  * boolean to add/remove the item from the set.
2280
2271
  */
2281
2272
  setIn(e, t) {
2282
- ue(e) ? this.contents = t : this.contents == null ? this.contents = $e(this.schema, Array.from(e), t) : x(this.contents) && this.contents.setIn(e, t);
2273
+ ue(e) ? this.contents = t : this.contents == null ? this.contents = Le(this.schema, Array.from(e), t) : x(this.contents) && this.contents.setIn(e, t);
2283
2274
  }
2284
2275
  /**
2285
2276
  * Change the YAML version and schema used by the document.
@@ -2310,24 +2301,24 @@ class Ue {
2310
2301
  if (t.schema instanceof Object)
2311
2302
  this.schema = t.schema;
2312
2303
  else if (n)
2313
- this.schema = new mt(Object.assign(n, t));
2304
+ this.schema = new gt(Object.assign(n, t));
2314
2305
  else
2315
2306
  throw new Error("With a null YAML version, the { schema: Schema } option is required");
2316
2307
  }
2317
2308
  // json & jsonArg are only used from toJSON()
2318
2309
  toJS({ json: e, jsonArg: t, mapAsMap: n, maxAliasCount: i, onAnchor: r, reviver: o } = {}) {
2319
- const l = {
2310
+ const a = {
2320
2311
  anchors: /* @__PURE__ */ new Map(),
2321
2312
  doc: this,
2322
2313
  keep: !e,
2323
2314
  mapAsMap: n === !0,
2324
2315
  mapKeyWarned: !1,
2325
2316
  maxAliasCount: typeof i == "number" ? i : 100
2326
- }, a = P(this.contents, t ?? "", l);
2317
+ }, l = j(this.contents, t ?? "", a);
2327
2318
  if (typeof r == "function")
2328
- for (const { count: c, res: d } of l.anchors.values())
2319
+ for (const { count: c, res: d } of a.anchors.values())
2329
2320
  r(d, c);
2330
- return typeof o == "function" ? ee(o, { "": a }, "", a) : a;
2321
+ return typeof o == "function" ? ee(o, { "": l }, "", l) : l;
2331
2322
  }
2332
2323
  /**
2333
2324
  * A JSON representation of the document `contents`.
@@ -2346,7 +2337,7 @@ class Ue {
2346
2337
  const t = JSON.stringify(e.indent);
2347
2338
  throw new Error(`"indent" option must be a positive integer, not ${t}`);
2348
2339
  }
2349
- return en(this, e);
2340
+ return rn(this, e);
2350
2341
  }
2351
2342
  }
2352
2343
  function x(s) {
@@ -2364,32 +2355,32 @@ class he extends rs {
2364
2355
  super("YAMLParseError", e, t, n);
2365
2356
  }
2366
2357
  }
2367
- class tn extends rs {
2358
+ class on extends rs {
2368
2359
  constructor(e, t, n) {
2369
2360
  super("YAMLWarning", e, t, n);
2370
2361
  }
2371
2362
  }
2372
- const At = (s, e) => (t) => {
2363
+ const Et = (s, e) => (t) => {
2373
2364
  if (t.pos[0] === -1)
2374
2365
  return;
2375
- t.linePos = t.pos.map((l) => e.linePos(l));
2366
+ t.linePos = t.pos.map((a) => e.linePos(a));
2376
2367
  const { line: n, col: i } = t.linePos[0];
2377
2368
  t.message += ` at line ${n}, column ${i}`;
2378
2369
  let r = i - 1, o = s.substring(e.lineStarts[n - 1], e.lineStarts[n]).replace(/[\n\r]+$/, "");
2379
2370
  if (r >= 60 && o.length > 80) {
2380
- const l = Math.min(r - 39, o.length - 79);
2381
- o = "…" + o.substring(l), r -= l - 1;
2371
+ const a = Math.min(r - 39, o.length - 79);
2372
+ o = "…" + o.substring(a), r -= a - 1;
2382
2373
  }
2383
2374
  if (o.length > 80 && (o = o.substring(0, 79) + "…"), n > 1 && /^ *$/.test(o.substring(0, r))) {
2384
- let l = s.substring(e.lineStarts[n - 2], e.lineStarts[n - 1]);
2385
- l.length > 80 && (l = l.substring(0, 79) + `…
2386
- `), o = l + o;
2375
+ let a = s.substring(e.lineStarts[n - 2], e.lineStarts[n - 1]);
2376
+ a.length > 80 && (a = a.substring(0, 79) + `…
2377
+ `), o = a + o;
2387
2378
  }
2388
2379
  if (/[^ ]/.test(o)) {
2389
- let l = 1;
2390
- const a = t.linePos[1];
2391
- a?.line === n && a.col > i && (l = Math.max(1, Math.min(a.col - i, 80 - r)));
2392
- const c = " ".repeat(r) + "^".repeat(l);
2380
+ let a = 1;
2381
+ const l = t.linePos[1];
2382
+ l?.line === n && l.col > i && (a = Math.max(1, Math.min(l.col - i, 80 - r)));
2383
+ const c = " ".repeat(r) + "^".repeat(a);
2393
2384
  t.message += `:
2394
2385
 
2395
2386
  ${o}
@@ -2397,8 +2388,8 @@ ${c}
2397
2388
  `;
2398
2389
  }
2399
2390
  };
2400
- function re(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIndent: o, startOnNewline: l }) {
2401
- let a = !1, c = l, d = l, f = "", u = "", m = !1, g = !1, h = null, p = null, b = null, w = null, k = null, S = null, N = null;
2391
+ function re(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIndent: o, startOnNewline: a }) {
2392
+ let l = !1, c = a, d = a, u = "", f = "", m = !1, g = !1, h = null, p = null, b = null, w = null, k = null, S = null, N = null;
2402
2393
  for (const y of s)
2403
2394
  switch (g && (y.type !== "space" && y.type !== "newline" && y.type !== "comma" && r(y.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), g = !1), h && (c && y.type !== "comment" && y.type !== "newline" && r(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), h = null), y.type) {
2404
2395
  case "space":
@@ -2407,11 +2398,11 @@ function re(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIn
2407
2398
  case "comment": {
2408
2399
  d || r(y, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
2409
2400
  const v = y.source.substring(1) || " ";
2410
- f ? f += u + v : f = v, u = "", c = !1;
2401
+ u ? u += f + v : u = v, f = "", c = !1;
2411
2402
  break;
2412
2403
  }
2413
2404
  case "newline":
2414
- c ? f ? f += y.source : (!S || t !== "seq-item-ind") && (a = !0) : u += y.source, c = !0, m = !0, (p || b) && (w = y), d = !0;
2405
+ c ? u ? u += y.source : (!S || t !== "seq-item-ind") && (l = !0) : f += y.source, c = !0, m = !0, (p || b) && (w = y), d = !0;
2415
2406
  break;
2416
2407
  case "anchor":
2417
2408
  p && r(y, "MULTIPLE_ANCHORS", "A node can have at most one anchor"), y.source.endsWith(":") && r(y.offset + y.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", !0), p = y, N ?? (N = y.offset), c = !1, d = !1, g = !0;
@@ -2432,18 +2423,18 @@ function re(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIn
2432
2423
  default:
2433
2424
  r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.type} token`), c = !1, d = !1;
2434
2425
  }
2435
- const A = s[s.length - 1], T = A ? A.offset + A.source.length : i;
2426
+ const A = s[s.length - 1], E = A ? A.offset + A.source.length : i;
2436
2427
  return g && n && n.type !== "space" && n.type !== "newline" && n.type !== "comma" && (n.type !== "scalar" || n.source !== "") && r(n.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), h && (c && h.indent <= o || n?.type === "block-map" || n?.type === "block-seq") && r(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), {
2437
2428
  comma: k,
2438
2429
  found: S,
2439
- spaceBefore: a,
2440
- comment: f,
2430
+ spaceBefore: l,
2431
+ comment: u,
2441
2432
  hasNewline: m,
2442
2433
  anchor: p,
2443
2434
  tag: b,
2444
2435
  newlineAfterProp: w,
2445
- end: T,
2446
- start: N ?? T
2436
+ end: E,
2437
+ start: N ?? E
2447
2438
  };
2448
2439
  }
2449
2440
  function ge(s) {
@@ -2481,7 +2472,7 @@ function ge(s) {
2481
2472
  return !0;
2482
2473
  }
2483
2474
  }
2484
- function ze(s, e, t) {
2475
+ function Ze(s, e, t) {
2485
2476
  if (e?.type === "flow-collection") {
2486
2477
  const n = e.end[0];
2487
2478
  n.indent === s && (n.source === "]" || n.source === "}") && ge(e) && t(n, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
@@ -2491,130 +2482,130 @@ function os(s, e, t) {
2491
2482
  const { uniqueKeys: n } = s.options;
2492
2483
  if (n === !1)
2493
2484
  return !1;
2494
- const i = typeof n == "function" ? n : (r, o) => r === o || E(r) && E(o) && r.value === o.value;
2485
+ const i = typeof n == "function" ? n : (r, o) => r === o || T(r) && T(o) && r.value === o.value;
2495
2486
  return e.some((r) => i(r.key, t));
2496
2487
  }
2497
2488
  const Tt = "All mapping items must start at the same column";
2498
- function sn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2499
- const o = r?.nodeClass ?? M, l = new o(t.schema);
2489
+ function an({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2490
+ const o = r?.nodeClass ?? M, a = new o(t.schema);
2500
2491
  t.atRoot && (t.atRoot = !1);
2501
- let a = n.offset, c = null;
2492
+ let l = n.offset, c = null;
2502
2493
  for (const d of n.items) {
2503
- const { start: f, key: u, sep: m, value: g } = d, h = re(f, {
2494
+ const { start: u, key: f, sep: m, value: g } = d, h = re(u, {
2504
2495
  indicator: "explicit-key-ind",
2505
- next: u ?? m?.[0],
2506
- offset: a,
2496
+ next: f ?? m?.[0],
2497
+ offset: l,
2507
2498
  onError: i,
2508
2499
  parentIndent: n.indent,
2509
2500
  startOnNewline: !0
2510
2501
  }), p = !h.found;
2511
2502
  if (p) {
2512
- if (u && (u.type === "block-seq" ? i(a, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in u && u.indent !== n.indent && i(a, "BAD_INDENT", Tt)), !h.anchor && !h.tag && !m) {
2513
- c = h.end, h.comment && (l.comment ? l.comment += `
2514
- ` + h.comment : l.comment = h.comment);
2503
+ if (f && (f.type === "block-seq" ? i(l, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in f && f.indent !== n.indent && i(l, "BAD_INDENT", Tt)), !h.anchor && !h.tag && !m) {
2504
+ c = h.end, h.comment && (a.comment ? a.comment += `
2505
+ ` + h.comment : a.comment = h.comment);
2515
2506
  continue;
2516
2507
  }
2517
- (h.newlineAfterProp || ge(u)) && i(u ?? f[f.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
2518
- } else h.found?.indent !== n.indent && i(a, "BAD_INDENT", Tt);
2508
+ (h.newlineAfterProp || ge(f)) && i(f ?? u[u.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
2509
+ } else h.found?.indent !== n.indent && i(l, "BAD_INDENT", Tt);
2519
2510
  t.atKey = !0;
2520
- const b = h.end, w = u ? s(t, u, h, i) : e(t, b, f, null, h, i);
2521
- t.schema.compat && ze(n.indent, u, i), t.atKey = !1, os(t, l.items, w) && i(b, "DUPLICATE_KEY", "Map keys must be unique");
2511
+ const b = h.end, w = f ? s(t, f, h, i) : e(t, b, u, null, h, i);
2512
+ t.schema.compat && Ze(n.indent, f, i), t.atKey = !1, os(t, a.items, w) && i(b, "DUPLICATE_KEY", "Map keys must be unique");
2522
2513
  const k = re(m ?? [], {
2523
2514
  indicator: "map-value-ind",
2524
2515
  next: g,
2525
2516
  offset: w.range[2],
2526
2517
  onError: i,
2527
2518
  parentIndent: n.indent,
2528
- startOnNewline: !u || u.type === "block-scalar"
2519
+ startOnNewline: !f || f.type === "block-scalar"
2529
2520
  });
2530
- if (a = k.end, k.found) {
2531
- p && (g?.type === "block-map" && !k.hasNewline && i(a, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && h.start < k.found.offset - 1024 && i(w.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
2532
- const S = g ? s(t, g, k, i) : e(t, a, m, null, k, i);
2533
- t.schema.compat && ze(n.indent, g, i), a = S.range[2];
2521
+ if (l = k.end, k.found) {
2522
+ p && (g?.type === "block-map" && !k.hasNewline && i(l, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && h.start < k.found.offset - 1024 && i(w.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
2523
+ const S = g ? s(t, g, k, i) : e(t, l, m, null, k, i);
2524
+ t.schema.compat && Ze(n.indent, g, i), l = S.range[2];
2534
2525
  const N = new B(w, S);
2535
- t.options.keepSourceTokens && (N.srcToken = d), l.items.push(N);
2526
+ t.options.keepSourceTokens && (N.srcToken = d), a.items.push(N);
2536
2527
  } else {
2537
2528
  p && i(w.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"), k.comment && (w.comment ? w.comment += `
2538
2529
  ` + k.comment : w.comment = k.comment);
2539
2530
  const S = new B(w);
2540
- t.options.keepSourceTokens && (S.srcToken = d), l.items.push(S);
2531
+ t.options.keepSourceTokens && (S.srcToken = d), a.items.push(S);
2541
2532
  }
2542
2533
  }
2543
- return c && c < a && i(c, "IMPOSSIBLE", "Map comment with trailing content"), l.range = [n.offset, a, c ?? a], l;
2534
+ return c && c < l && i(c, "IMPOSSIBLE", "Map comment with trailing content"), a.range = [n.offset, l, c ?? l], a;
2544
2535
  }
2545
- function nn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2546
- const o = r?.nodeClass ?? W, l = new o(t.schema);
2536
+ function ln({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2537
+ const o = r?.nodeClass ?? W, a = new o(t.schema);
2547
2538
  t.atRoot && (t.atRoot = !1), t.atKey && (t.atKey = !1);
2548
- let a = n.offset, c = null;
2549
- for (const { start: d, value: f } of n.items) {
2550
- const u = re(d, {
2539
+ let l = n.offset, c = null;
2540
+ for (const { start: d, value: u } of n.items) {
2541
+ const f = re(d, {
2551
2542
  indicator: "seq-item-ind",
2552
- next: f,
2553
- offset: a,
2543
+ next: u,
2544
+ offset: l,
2554
2545
  onError: i,
2555
2546
  parentIndent: n.indent,
2556
2547
  startOnNewline: !0
2557
2548
  });
2558
- if (!u.found)
2559
- if (u.anchor || u.tag || f)
2560
- f?.type === "block-seq" ? i(u.end, "BAD_INDENT", "All sequence items must start at the same column") : i(a, "MISSING_CHAR", "Sequence item without - indicator");
2549
+ if (!f.found)
2550
+ if (f.anchor || f.tag || u)
2551
+ u?.type === "block-seq" ? i(f.end, "BAD_INDENT", "All sequence items must start at the same column") : i(l, "MISSING_CHAR", "Sequence item without - indicator");
2561
2552
  else {
2562
- c = u.end, u.comment && (l.comment = u.comment);
2553
+ c = f.end, f.comment && (a.comment = f.comment);
2563
2554
  continue;
2564
2555
  }
2565
- const m = f ? s(t, f, u, i) : e(t, u.end, d, null, u, i);
2566
- t.schema.compat && ze(n.indent, f, i), a = m.range[2], l.items.push(m);
2556
+ const m = u ? s(t, u, f, i) : e(t, f.end, d, null, f, i);
2557
+ t.schema.compat && Ze(n.indent, u, i), l = m.range[2], a.items.push(m);
2567
2558
  }
2568
- return l.range = [n.offset, a, c ?? a], l;
2559
+ return a.range = [n.offset, l, c ?? l], a;
2569
2560
  }
2570
2561
  function ke(s, e, t, n) {
2571
2562
  let i = "";
2572
2563
  if (s) {
2573
2564
  let r = !1, o = "";
2574
- for (const l of s) {
2575
- const { source: a, type: c } = l;
2565
+ for (const a of s) {
2566
+ const { source: l, type: c } = a;
2576
2567
  switch (c) {
2577
2568
  case "space":
2578
2569
  r = !0;
2579
2570
  break;
2580
2571
  case "comment": {
2581
- t && !r && n(l, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
2582
- const d = a.substring(1) || " ";
2572
+ t && !r && n(a, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
2573
+ const d = l.substring(1) || " ";
2583
2574
  i ? i += o + d : i = d, o = "";
2584
2575
  break;
2585
2576
  }
2586
2577
  case "newline":
2587
- i && (o += a), r = !0;
2578
+ i && (o += l), r = !0;
2588
2579
  break;
2589
2580
  default:
2590
- n(l, "UNEXPECTED_TOKEN", `Unexpected ${c} at node end`);
2581
+ n(a, "UNEXPECTED_TOKEN", `Unexpected ${c} at node end`);
2591
2582
  }
2592
- e += a.length;
2583
+ e += l.length;
2593
2584
  }
2594
2585
  }
2595
2586
  return { comment: i, offset: e };
2596
2587
  }
2597
- const Je = "Block collections are not allowed within flow collections", Ye = (s) => s && (s.type === "block-map" || s.type === "block-seq");
2598
- function rn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2599
- const o = n.start.source === "{", l = o ? "flow map" : "flow sequence", a = r?.nodeClass ?? (o ? M : W), c = new a(t.schema);
2588
+ const Ye = "Block collections are not allowed within flow collections", Ge = (s) => s && (s.type === "block-map" || s.type === "block-seq");
2589
+ function cn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2590
+ const o = n.start.source === "{", a = o ? "flow map" : "flow sequence", l = r?.nodeClass ?? (o ? M : W), c = new l(t.schema);
2600
2591
  c.flow = !0;
2601
2592
  const d = t.atRoot;
2602
2593
  d && (t.atRoot = !1), t.atKey && (t.atKey = !1);
2603
- let f = n.offset + n.start.source.length;
2594
+ let u = n.offset + n.start.source.length;
2604
2595
  for (let p = 0; p < n.items.length; ++p) {
2605
2596
  const b = n.items[p], { start: w, key: k, sep: S, value: N } = b, A = re(w, {
2606
- flow: l,
2597
+ flow: a,
2607
2598
  indicator: "explicit-key-ind",
2608
2599
  next: k ?? S?.[0],
2609
- offset: f,
2600
+ offset: u,
2610
2601
  onError: i,
2611
2602
  parentIndent: n.indent,
2612
2603
  startOnNewline: !1
2613
2604
  });
2614
2605
  if (!A.found) {
2615
2606
  if (!A.anchor && !A.tag && !S && !N) {
2616
- p === 0 && A.comma ? i(A.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${l}`) : p < n.items.length - 1 && i(A.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${l}`), A.comment && (c.comment ? c.comment += `
2617
- ` + A.comment : c.comment = A.comment), f = A.end;
2607
+ p === 0 && A.comma ? i(A.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${a}`) : p < n.items.length - 1 && i(A.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${a}`), A.comment && (c.comment ? c.comment += `
2608
+ ` + A.comment : c.comment = A.comment), u = A.end;
2618
2609
  continue;
2619
2610
  }
2620
2611
  !o && t.options.strict && ge(k) && i(
@@ -2625,35 +2616,35 @@ function rn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2625
2616
  );
2626
2617
  }
2627
2618
  if (p === 0)
2628
- A.comma && i(A.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${l}`);
2629
- else if (A.comma || i(A.start, "MISSING_CHAR", `Missing , between ${l} items`), A.comment) {
2630
- let T = "";
2619
+ A.comma && i(A.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${a}`);
2620
+ else if (A.comma || i(A.start, "MISSING_CHAR", `Missing , between ${a} items`), A.comment) {
2621
+ let E = "";
2631
2622
  e: for (const y of w)
2632
2623
  switch (y.type) {
2633
2624
  case "comma":
2634
2625
  case "space":
2635
2626
  break;
2636
2627
  case "comment":
2637
- T = y.source.substring(1);
2628
+ E = y.source.substring(1);
2638
2629
  break e;
2639
2630
  default:
2640
2631
  break e;
2641
2632
  }
2642
- if (T) {
2633
+ if (E) {
2643
2634
  let y = c.items[c.items.length - 1];
2644
- $(y) && (y = y.value ?? y.key), y.comment ? y.comment += `
2645
- ` + T : y.comment = T, A.comment = A.comment.substring(T.length + 1);
2635
+ L(y) && (y = y.value ?? y.key), y.comment ? y.comment += `
2636
+ ` + E : y.comment = E, A.comment = A.comment.substring(E.length + 1);
2646
2637
  }
2647
2638
  }
2648
2639
  if (!o && !S && !A.found) {
2649
- const T = N ? s(t, N, A, i) : e(t, A.end, S, null, A, i);
2650
- c.items.push(T), f = T.range[2], Ye(N) && i(T.range, "BLOCK_IN_FLOW", Je);
2640
+ const E = N ? s(t, N, A, i) : e(t, A.end, S, null, A, i);
2641
+ c.items.push(E), u = E.range[2], Ge(N) && i(E.range, "BLOCK_IN_FLOW", Ye);
2651
2642
  } else {
2652
2643
  t.atKey = !0;
2653
- const T = A.end, y = k ? s(t, k, A, i) : e(t, T, w, null, A, i);
2654
- Ye(k) && i(y.range, "BLOCK_IN_FLOW", Je), t.atKey = !1;
2644
+ const E = A.end, y = k ? s(t, k, A, i) : e(t, E, w, null, A, i);
2645
+ Ge(k) && i(y.range, "BLOCK_IN_FLOW", Ye), t.atKey = !1;
2655
2646
  const v = re(S ?? [], {
2656
- flow: l,
2647
+ flow: a,
2657
2648
  indicator: "map-value-ind",
2658
2649
  next: N,
2659
2650
  offset: y.range[2],
@@ -2674,30 +2665,30 @@ function rn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2674
2665
  }
2675
2666
  A.start < v.found.offset - 1024 && i(v.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
2676
2667
  }
2677
- } else N && ("source" in N && N.source?.[0] === ":" ? i(N, "MISSING_CHAR", `Missing space after : in ${l}`) : i(v.start, "MISSING_CHAR", `Missing , or : between ${l} items`));
2668
+ } else N && ("source" in N && N.source?.[0] === ":" ? i(N, "MISSING_CHAR", `Missing space after : in ${a}`) : i(v.start, "MISSING_CHAR", `Missing , or : between ${a} items`));
2678
2669
  const R = N ? s(t, N, v, i) : v.found ? e(t, v.end, S, null, v, i) : null;
2679
- R ? Ye(N) && i(R.range, "BLOCK_IN_FLOW", Je) : v.comment && (y.comment ? y.comment += `
2670
+ R ? Ge(N) && i(R.range, "BLOCK_IN_FLOW", Ye) : v.comment && (y.comment ? y.comment += `
2680
2671
  ` + v.comment : y.comment = v.comment);
2681
2672
  const X = new B(y, R);
2682
2673
  if (t.options.keepSourceTokens && (X.srcToken = b), o) {
2683
2674
  const C = c;
2684
- os(t, C.items, y) && i(T, "DUPLICATE_KEY", "Map keys must be unique"), C.items.push(X);
2675
+ os(t, C.items, y) && i(E, "DUPLICATE_KEY", "Map keys must be unique"), C.items.push(X);
2685
2676
  } else {
2686
2677
  const C = new M(t.schema);
2687
2678
  C.flow = !0, C.items.push(X);
2688
- const yt = (R ?? y).range;
2689
- C.range = [y.range[0], yt[1], yt[2]], c.items.push(C);
2679
+ const bt = (R ?? y).range;
2680
+ C.range = [y.range[0], bt[1], bt[2]], c.items.push(C);
2690
2681
  }
2691
- f = R ? R.range[2] : v.end;
2682
+ u = R ? R.range[2] : v.end;
2692
2683
  }
2693
2684
  }
2694
- const u = o ? "}" : "]", [m, ...g] = n.end;
2695
- let h = f;
2696
- if (m?.source === u)
2685
+ const f = o ? "}" : "]", [m, ...g] = n.end;
2686
+ let h = u;
2687
+ if (m?.source === f)
2697
2688
  h = m.offset + m.source.length;
2698
2689
  else {
2699
- const p = l[0].toUpperCase() + l.substring(1), b = d ? `${p} must end with a ${u}` : `${p} in block collection must be sufficiently indented and end with a ${u}`;
2700
- i(f, d ? "MISSING_CHAR" : "BAD_INDENT", b), m && m.source.length !== 1 && g.unshift(m);
2690
+ const p = a[0].toUpperCase() + a.substring(1), b = d ? `${p} must end with a ${f}` : `${p} in block collection must be sufficiently indented and end with a ${f}`;
2691
+ i(u, d ? "MISSING_CHAR" : "BAD_INDENT", b), m && m.source.length !== 1 && g.unshift(m);
2701
2692
  }
2702
2693
  if (g.length > 0) {
2703
2694
  const p = ke(g, h, t.options.strict, i);
@@ -2707,164 +2698,164 @@ function rn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
2707
2698
  c.range = [n.offset, h, h];
2708
2699
  return c;
2709
2700
  }
2710
- function Ge(s, e, t, n, i, r) {
2711
- const o = t.type === "block-map" ? sn(s, e, t, n, r) : t.type === "block-seq" ? nn(s, e, t, n, r) : rn(s, e, t, n, r), l = o.constructor;
2712
- return i === "!" || i === l.tagName ? (o.tag = l.tagName, o) : (i && (o.tag = i), o);
2701
+ function He(s, e, t, n, i, r) {
2702
+ const o = t.type === "block-map" ? an(s, e, t, n, r) : t.type === "block-seq" ? ln(s, e, t, n, r) : cn(s, e, t, n, r), a = o.constructor;
2703
+ return i === "!" || i === a.tagName ? (o.tag = a.tagName, o) : (i && (o.tag = i), o);
2713
2704
  }
2714
- function on(s, e, t, n, i) {
2715
- const r = n.tag, o = r ? e.directives.tagName(r.source, (u) => i(r, "TAG_RESOLVE_FAILED", u)) : null;
2705
+ function fn(s, e, t, n, i) {
2706
+ const r = n.tag, o = r ? e.directives.tagName(r.source, (f) => i(r, "TAG_RESOLVE_FAILED", f)) : null;
2716
2707
  if (t.type === "block-seq") {
2717
- const { anchor: u, newlineAfterProp: m } = n, g = u && r ? u.offset > r.offset ? u : r : u ?? r;
2708
+ const { anchor: f, newlineAfterProp: m } = n, g = f && r ? f.offset > r.offset ? f : r : f ?? r;
2718
2709
  g && (!m || m.offset < g.offset) && i(g, "MISSING_CHAR", "Missing newline after block sequence props");
2719
2710
  }
2720
- const l = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
2721
- if (!r || !o || o === "!" || o === M.tagName && l === "map" || o === W.tagName && l === "seq")
2722
- return Ge(s, e, t, i, o);
2723
- let a = e.schema.tags.find((u) => u.tag === o && u.collection === l);
2724
- if (!a) {
2725
- const u = e.schema.knownTags[o];
2726
- if (u?.collection === l)
2727
- e.schema.tags.push(Object.assign({}, u, { default: !1 })), a = u;
2711
+ const a = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
2712
+ if (!r || !o || o === "!" || o === M.tagName && a === "map" || o === W.tagName && a === "seq")
2713
+ return He(s, e, t, i, o);
2714
+ let l = e.schema.tags.find((f) => f.tag === o && f.collection === a);
2715
+ if (!l) {
2716
+ const f = e.schema.knownTags[o];
2717
+ if (f?.collection === a)
2718
+ e.schema.tags.push(Object.assign({}, f, { default: !1 })), l = f;
2728
2719
  else
2729
- return u ? i(r, "BAD_COLLECTION_TYPE", `${u.tag} used for ${l} collection, but expects ${u.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), Ge(s, e, t, i, o);
2720
+ return f ? i(r, "BAD_COLLECTION_TYPE", `${f.tag} used for ${a} collection, but expects ${f.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), He(s, e, t, i, o);
2730
2721
  }
2731
- const c = Ge(s, e, t, i, o, a), d = a.resolve?.(c, (u) => i(r, "TAG_RESOLVE_FAILED", u), e.options) ?? c, f = L(d) ? d : new O(d);
2732
- return f.range = c.range, f.tag = o, a?.format && (f.format = a.format), f;
2722
+ const c = He(s, e, t, i, o, l), d = l.resolve?.(c, (f) => i(r, "TAG_RESOLVE_FAILED", f), e.options) ?? c, u = $(d) ? d : new O(d);
2723
+ return u.range = c.range, u.tag = o, l?.format && (u.format = l.format), u;
2733
2724
  }
2734
- function ln(s, e, t) {
2735
- const n = e.offset, i = an(e, s.options.strict, t);
2725
+ function un(s, e, t) {
2726
+ const n = e.offset, i = hn(e, s.options.strict, t);
2736
2727
  if (!i)
2737
2728
  return { value: "", type: null, comment: "", range: [n, n, n] };
2738
- const r = i.mode === ">" ? O.BLOCK_FOLDED : O.BLOCK_LITERAL, o = e.source ? cn(e.source) : [];
2739
- let l = o.length;
2729
+ const r = i.mode === ">" ? O.BLOCK_FOLDED : O.BLOCK_LITERAL, o = e.source ? dn(e.source) : [];
2730
+ let a = o.length;
2740
2731
  for (let h = o.length - 1; h >= 0; --h) {
2741
2732
  const p = o[h][1];
2742
2733
  if (p === "" || p === "\r")
2743
- l = h;
2734
+ a = h;
2744
2735
  else
2745
2736
  break;
2746
2737
  }
2747
- if (l === 0) {
2738
+ if (a === 0) {
2748
2739
  const h = i.chomp === "+" && o.length > 0 ? `
2749
2740
  `.repeat(Math.max(1, o.length - 1)) : "";
2750
2741
  let p = n + i.length;
2751
2742
  return e.source && (p += e.source.length), { value: h, type: r, comment: i.comment, range: [n, p, p] };
2752
2743
  }
2753
- let a = e.indent + i.indent, c = e.offset + i.length, d = 0;
2754
- for (let h = 0; h < l; ++h) {
2744
+ let l = e.indent + i.indent, c = e.offset + i.length, d = 0;
2745
+ for (let h = 0; h < a; ++h) {
2755
2746
  const [p, b] = o[h];
2756
2747
  if (b === "" || b === "\r")
2757
- i.indent === 0 && p.length > a && (a = p.length);
2748
+ i.indent === 0 && p.length > l && (l = p.length);
2758
2749
  else {
2759
- p.length < a && t(c + p.length, "MISSING_CHAR", "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"), i.indent === 0 && (a = p.length), d = h, a === 0 && !s.atRoot && t(c, "BAD_INDENT", "Block scalar values in collections must be indented");
2750
+ p.length < l && t(c + p.length, "MISSING_CHAR", "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"), i.indent === 0 && (l = p.length), d = h, l === 0 && !s.atRoot && t(c, "BAD_INDENT", "Block scalar values in collections must be indented");
2760
2751
  break;
2761
2752
  }
2762
2753
  c += p.length + b.length + 1;
2763
2754
  }
2764
- for (let h = o.length - 1; h >= l; --h)
2765
- o[h][0].length > a && (l = h + 1);
2766
- let f = "", u = "", m = !1;
2755
+ for (let h = o.length - 1; h >= a; --h)
2756
+ o[h][0].length > l && (a = h + 1);
2757
+ let u = "", f = "", m = !1;
2767
2758
  for (let h = 0; h < d; ++h)
2768
- f += o[h][0].slice(a) + `
2759
+ u += o[h][0].slice(l) + `
2769
2760
  `;
2770
- for (let h = d; h < l; ++h) {
2761
+ for (let h = d; h < a; ++h) {
2771
2762
  let [p, b] = o[h];
2772
2763
  c += p.length + b.length + 1;
2773
2764
  const w = b[b.length - 1] === "\r";
2774
- if (w && (b = b.slice(0, -1)), b && p.length < a) {
2765
+ if (w && (b = b.slice(0, -1)), b && p.length < l) {
2775
2766
  const S = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
2776
2767
  t(c - b.length - (w ? 2 : 1), "BAD_INDENT", S), p = "";
2777
2768
  }
2778
- r === O.BLOCK_LITERAL ? (f += u + p.slice(a) + b, u = `
2779
- `) : p.length > a || b[0] === " " ? (u === " " ? u = `
2780
- ` : !m && u === `
2781
- ` && (u = `
2769
+ r === O.BLOCK_LITERAL ? (u += f + p.slice(l) + b, f = `
2770
+ `) : p.length > l || b[0] === " " ? (f === " " ? f = `
2771
+ ` : !m && f === `
2772
+ ` && (f = `
2782
2773
 
2783
- `), f += u + p.slice(a) + b, u = `
2784
- `, m = !0) : b === "" ? u === `
2785
- ` ? f += `
2786
- ` : u = `
2787
- ` : (f += u + b, u = " ", m = !1);
2774
+ `), u += f + p.slice(l) + b, f = `
2775
+ `, m = !0) : b === "" ? f === `
2776
+ ` ? u += `
2777
+ ` : f = `
2778
+ ` : (u += f + b, f = " ", m = !1);
2788
2779
  }
2789
2780
  switch (i.chomp) {
2790
2781
  case "-":
2791
2782
  break;
2792
2783
  case "+":
2793
- for (let h = l; h < o.length; ++h)
2794
- f += `
2795
- ` + o[h][0].slice(a);
2796
- f[f.length - 1] !== `
2797
- ` && (f += `
2784
+ for (let h = a; h < o.length; ++h)
2785
+ u += `
2786
+ ` + o[h][0].slice(l);
2787
+ u[u.length - 1] !== `
2788
+ ` && (u += `
2798
2789
  `);
2799
2790
  break;
2800
2791
  default:
2801
- f += `
2792
+ u += `
2802
2793
  `;
2803
2794
  }
2804
2795
  const g = n + i.length + e.source.length;
2805
- return { value: f, type: r, comment: i.comment, range: [n, g, g] };
2796
+ return { value: u, type: r, comment: i.comment, range: [n, g, g] };
2806
2797
  }
2807
- function an({ offset: s, props: e }, t, n) {
2798
+ function hn({ offset: s, props: e }, t, n) {
2808
2799
  if (e[0].type !== "block-scalar-header")
2809
2800
  return n(e[0], "IMPOSSIBLE", "Block scalar header not found"), null;
2810
2801
  const { source: i } = e[0], r = i[0];
2811
- let o = 0, l = "", a = -1;
2812
- for (let u = 1; u < i.length; ++u) {
2813
- const m = i[u];
2814
- if (!l && (m === "-" || m === "+"))
2815
- l = m;
2802
+ let o = 0, a = "", l = -1;
2803
+ for (let f = 1; f < i.length; ++f) {
2804
+ const m = i[f];
2805
+ if (!a && (m === "-" || m === "+"))
2806
+ a = m;
2816
2807
  else {
2817
2808
  const g = Number(m);
2818
- !o && g ? o = g : a === -1 && (a = s + u);
2809
+ !o && g ? o = g : l === -1 && (l = s + f);
2819
2810
  }
2820
2811
  }
2821
- a !== -1 && n(a, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${i}`);
2822
- let c = !1, d = "", f = i.length;
2823
- for (let u = 1; u < e.length; ++u) {
2824
- const m = e[u];
2812
+ l !== -1 && n(l, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${i}`);
2813
+ let c = !1, d = "", u = i.length;
2814
+ for (let f = 1; f < e.length; ++f) {
2815
+ const m = e[f];
2825
2816
  switch (m.type) {
2826
2817
  case "space":
2827
2818
  c = !0;
2828
2819
  // fallthrough
2829
2820
  case "newline":
2830
- f += m.source.length;
2821
+ u += m.source.length;
2831
2822
  break;
2832
2823
  case "comment":
2833
- t && !c && n(m, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters"), f += m.source.length, d = m.source.substring(1);
2824
+ t && !c && n(m, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters"), u += m.source.length, d = m.source.substring(1);
2834
2825
  break;
2835
2826
  case "error":
2836
- n(m, "UNEXPECTED_TOKEN", m.message), f += m.source.length;
2827
+ n(m, "UNEXPECTED_TOKEN", m.message), u += m.source.length;
2837
2828
  break;
2838
2829
  /* istanbul ignore next should not happen */
2839
2830
  default: {
2840
2831
  const g = `Unexpected token in block scalar header: ${m.type}`;
2841
2832
  n(m, "UNEXPECTED_TOKEN", g);
2842
2833
  const h = m.source;
2843
- h && typeof h == "string" && (f += h.length);
2834
+ h && typeof h == "string" && (u += h.length);
2844
2835
  }
2845
2836
  }
2846
2837
  }
2847
- return { mode: r, indent: o, chomp: l, comment: d, length: f };
2838
+ return { mode: r, indent: o, chomp: a, comment: d, length: u };
2848
2839
  }
2849
- function cn(s) {
2840
+ function dn(s) {
2850
2841
  const e = s.split(/\n( *)/), t = e[0], n = t.match(/^( *)/), r = [n?.[1] ? [n[1], t.slice(n[1].length)] : ["", t]];
2851
2842
  for (let o = 1; o < e.length; o += 2)
2852
2843
  r.push([e[o], e[o + 1]]);
2853
2844
  return r;
2854
2845
  }
2855
- function fn(s, e, t) {
2846
+ function pn(s, e, t) {
2856
2847
  const { offset: n, type: i, source: r, end: o } = s;
2857
- let l, a;
2858
- const c = (u, m, g) => t(n + u, m, g);
2848
+ let a, l;
2849
+ const c = (f, m, g) => t(n + f, m, g);
2859
2850
  switch (i) {
2860
2851
  case "scalar":
2861
- l = O.PLAIN, a = un(r, c);
2852
+ a = O.PLAIN, l = mn(r, c);
2862
2853
  break;
2863
2854
  case "single-quoted-scalar":
2864
- l = O.QUOTE_SINGLE, a = hn(r, c);
2855
+ a = O.QUOTE_SINGLE, l = gn(r, c);
2865
2856
  break;
2866
2857
  case "double-quoted-scalar":
2867
- l = O.QUOTE_DOUBLE, a = dn(r, c);
2858
+ a = O.QUOTE_DOUBLE, l = yn(r, c);
2868
2859
  break;
2869
2860
  /* istanbul ignore next should not happen */
2870
2861
  default:
@@ -2875,15 +2866,15 @@ function fn(s, e, t) {
2875
2866
  range: [n, n + r.length, n + r.length]
2876
2867
  };
2877
2868
  }
2878
- const d = n + r.length, f = ke(o, d, e, t);
2869
+ const d = n + r.length, u = ke(o, d, e, t);
2879
2870
  return {
2880
- value: a,
2881
- type: l,
2882
- comment: f.comment,
2883
- range: [n, d, f.offset]
2871
+ value: l,
2872
+ type: a,
2873
+ comment: u.comment,
2874
+ range: [n, d, u.offset]
2884
2875
  };
2885
2876
  }
2886
- function un(s, e) {
2877
+ function mn(s, e) {
2887
2878
  let t = "";
2888
2879
  switch (s[0]) {
2889
2880
  /* istanbul ignore next should not happen */
@@ -2907,12 +2898,12 @@ function un(s, e) {
2907
2898
  break;
2908
2899
  }
2909
2900
  }
2910
- return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), ls(s);
2901
+ return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), as(s);
2911
2902
  }
2912
- function hn(s, e) {
2913
- return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"), ls(s.slice(1, -1)).replace(/''/g, "'");
2903
+ function gn(s, e) {
2904
+ return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"), as(s.slice(1, -1)).replace(/''/g, "'");
2914
2905
  }
2915
- function ls(s) {
2906
+ function as(s) {
2916
2907
  let e, t;
2917
2908
  try {
2918
2909
  e = new RegExp(`(.*?)(?<![ ])[ ]*\r?
@@ -2929,10 +2920,10 @@ function ls(s) {
2929
2920
  n[1] === "" ? r === `
2930
2921
  ` ? i += r : r = `
2931
2922
  ` : (i += r + n[1], r = " "), o = t.lastIndex;
2932
- const l = /[ \t]*(.*)/sy;
2933
- return l.lastIndex = o, n = l.exec(s), i + r + (n?.[1] ?? "");
2923
+ const a = /[ \t]*(.*)/sy;
2924
+ return a.lastIndex = o, n = a.exec(s), i + r + (n?.[1] ?? "");
2934
2925
  }
2935
- function dn(s, e) {
2926
+ function yn(s, e) {
2936
2927
  let t = "";
2937
2928
  for (let n = 1; n < s.length - 1; ++n) {
2938
2929
  const i = s[n];
@@ -2940,11 +2931,11 @@ function dn(s, e) {
2940
2931
  `))
2941
2932
  if (i === `
2942
2933
  `) {
2943
- const { fold: r, offset: o } = pn(s, n);
2934
+ const { fold: r, offset: o } = bn(s, n);
2944
2935
  t += r, n = o;
2945
2936
  } else if (i === "\\") {
2946
2937
  let r = s[++n];
2947
- const o = mn[r];
2938
+ const o = wn[r];
2948
2939
  if (o)
2949
2940
  t += o;
2950
2941
  else if (r === `
@@ -2956,11 +2947,11 @@ function dn(s, e) {
2956
2947
  for (r = s[++n + 1]; r === " " || r === " "; )
2957
2948
  r = s[++n + 1];
2958
2949
  else if (r === "x" || r === "u" || r === "U") {
2959
- const l = { x: 2, u: 4, U: 8 }[r];
2960
- t += gn(s, n + 1, l, e), n += l;
2950
+ const a = { x: 2, u: 4, U: 8 }[r];
2951
+ t += kn(s, n + 1, a, e), n += a;
2961
2952
  } else {
2962
- const l = s.substr(n - 1, 2);
2963
- e(n - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${l}`), t += l;
2953
+ const a = s.substr(n - 1, 2);
2954
+ e(n - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${a}`), t += a;
2964
2955
  }
2965
2956
  } else if (i === " " || i === " ") {
2966
2957
  const r = n;
@@ -2975,7 +2966,7 @@ function dn(s, e) {
2975
2966
  }
2976
2967
  return (s[s.length - 1] !== '"' || s.length === 1) && e(s.length, "MISSING_CHAR", 'Missing closing "quote'), t;
2977
2968
  }
2978
- function pn(s, e) {
2969
+ function bn(s, e) {
2979
2970
  let t = "", n = s[e + 1];
2980
2971
  for (; (n === " " || n === " " || n === `
2981
2972
  ` || n === "\r") && !(n === "\r" && s[e + 2] !== `
@@ -2985,7 +2976,7 @@ function pn(s, e) {
2985
2976
  `), e += 1, n = s[e + 1];
2986
2977
  return t || (t = " "), { fold: t, offset: e };
2987
2978
  }
2988
- const mn = {
2979
+ const wn = {
2989
2980
  0: "\0",
2990
2981
  // null character
2991
2982
  a: "\x07",
@@ -3019,56 +3010,56 @@ const mn = {
3019
3010
  "\\": "\\",
3020
3011
  " ": " "
3021
3012
  };
3022
- function gn(s, e, t, n) {
3013
+ function kn(s, e, t, n) {
3023
3014
  const i = s.substr(e, t), o = i.length === t && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
3024
3015
  if (isNaN(o)) {
3025
- const l = s.substr(e - 2, t + 2);
3026
- return n(e - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${l}`), l;
3016
+ const a = s.substr(e - 2, t + 2);
3017
+ return n(e - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${a}`), a;
3027
3018
  }
3028
3019
  return String.fromCodePoint(o);
3029
3020
  }
3030
- function as(s, e, t, n) {
3031
- const { value: i, type: r, comment: o, range: l } = e.type === "block-scalar" ? ln(s, e, n) : fn(e, s.options.strict, n), a = t ? s.directives.tagName(t.source, (f) => n(t, "TAG_RESOLVE_FAILED", f)) : null;
3021
+ function ls(s, e, t, n) {
3022
+ const { value: i, type: r, comment: o, range: a } = e.type === "block-scalar" ? un(s, e, n) : pn(e, s.options.strict, n), l = t ? s.directives.tagName(t.source, (u) => n(t, "TAG_RESOLVE_FAILED", u)) : null;
3032
3023
  let c;
3033
- s.options.stringKeys && s.atKey ? c = s.schema[q] : a ? c = yn(s.schema, i, a, t, n) : e.type === "scalar" ? c = bn(s, i, e, n) : c = s.schema[q];
3024
+ s.options.stringKeys && s.atKey ? c = s.schema[q] : l ? c = Sn(s.schema, i, l, t, n) : e.type === "scalar" ? c = Nn(s, i, e, n) : c = s.schema[q];
3034
3025
  let d;
3035
3026
  try {
3036
- const f = c.resolve(i, (u) => n(t ?? e, "TAG_RESOLVE_FAILED", u), s.options);
3037
- d = E(f) ? f : new O(f);
3038
- } catch (f) {
3039
- const u = f instanceof Error ? f.message : String(f);
3040
- n(t ?? e, "TAG_RESOLVE_FAILED", u), d = new O(i);
3027
+ const u = c.resolve(i, (f) => n(t ?? e, "TAG_RESOLVE_FAILED", f), s.options);
3028
+ d = T(u) ? u : new O(u);
3029
+ } catch (u) {
3030
+ const f = u instanceof Error ? u.message : String(u);
3031
+ n(t ?? e, "TAG_RESOLVE_FAILED", f), d = new O(i);
3041
3032
  }
3042
- return d.range = l, d.source = i, r && (d.type = r), a && (d.tag = a), c.format && (d.format = c.format), o && (d.comment = o), d;
3033
+ return d.range = a, d.source = i, r && (d.type = r), l && (d.tag = l), c.format && (d.format = c.format), o && (d.comment = o), d;
3043
3034
  }
3044
- function yn(s, e, t, n, i) {
3035
+ function Sn(s, e, t, n, i) {
3045
3036
  if (t === "!")
3046
3037
  return s[q];
3047
3038
  const r = [];
3048
- for (const l of s.tags)
3049
- if (!l.collection && l.tag === t)
3050
- if (l.default && l.test)
3051
- r.push(l);
3039
+ for (const a of s.tags)
3040
+ if (!a.collection && a.tag === t)
3041
+ if (a.default && a.test)
3042
+ r.push(a);
3052
3043
  else
3053
- return l;
3054
- for (const l of r)
3055
- if (l.test?.test(e))
3056
- return l;
3044
+ return a;
3045
+ for (const a of r)
3046
+ if (a.test?.test(e))
3047
+ return a;
3057
3048
  const o = s.knownTags[t];
3058
3049
  return o && !o.collection ? (s.tags.push(Object.assign({}, o, { default: !1, test: void 0 })), o) : (i(n, "TAG_RESOLVE_FAILED", `Unresolved tag: ${t}`, t !== "tag:yaml.org,2002:str"), s[q]);
3059
3050
  }
3060
- function bn({ atKey: s, directives: e, schema: t }, n, i, r) {
3061
- const o = t.tags.find((l) => (l.default === !0 || s && l.default === "key") && l.test?.test(n)) || t[q];
3051
+ function Nn({ atKey: s, directives: e, schema: t }, n, i, r) {
3052
+ const o = t.tags.find((a) => (a.default === !0 || s && a.default === "key") && a.test?.test(n)) || t[q];
3062
3053
  if (t.compat) {
3063
- const l = t.compat.find((a) => a.default && a.test?.test(n)) ?? t[q];
3064
- if (o.tag !== l.tag) {
3065
- const a = e.tagString(o.tag), c = e.tagString(l.tag), d = `Value may be parsed as either ${a} or ${c}`;
3054
+ const a = t.compat.find((l) => l.default && l.test?.test(n)) ?? t[q];
3055
+ if (o.tag !== a.tag) {
3056
+ const l = e.tagString(o.tag), c = e.tagString(a.tag), d = `Value may be parsed as either ${l} or ${c}`;
3066
3057
  r(i, "TAG_RESOLVE_FAILED", d, !0);
3067
3058
  }
3068
3059
  }
3069
3060
  return o;
3070
3061
  }
3071
- function wn(s, e, t) {
3062
+ function On(s, e, t) {
3072
3063
  if (e) {
3073
3064
  t ?? (t = e.length);
3074
3065
  for (let n = t - 1; n >= 0; --n) {
@@ -3087,54 +3078,54 @@ function wn(s, e, t) {
3087
3078
  }
3088
3079
  return s;
3089
3080
  }
3090
- const kn = { composeNode: cs, composeEmptyNode: gt };
3081
+ const An = { composeNode: cs, composeEmptyNode: yt };
3091
3082
  function cs(s, e, t, n) {
3092
- const i = s.atKey, { spaceBefore: r, comment: o, anchor: l, tag: a } = t;
3083
+ const i = s.atKey, { spaceBefore: r, comment: o, anchor: a, tag: l } = t;
3093
3084
  let c, d = !0;
3094
3085
  switch (e.type) {
3095
3086
  case "alias":
3096
- c = Sn(s, e, n), (l || a) && n(e, "ALIAS_PROPS", "An alias node must not specify any properties");
3087
+ c = En(s, e, n), (a || l) && n(e, "ALIAS_PROPS", "An alias node must not specify any properties");
3097
3088
  break;
3098
3089
  case "scalar":
3099
3090
  case "single-quoted-scalar":
3100
3091
  case "double-quoted-scalar":
3101
3092
  case "block-scalar":
3102
- c = as(s, e, a, n), l && (c.anchor = l.source.substring(1));
3093
+ c = ls(s, e, l, n), a && (c.anchor = a.source.substring(1));
3103
3094
  break;
3104
3095
  case "block-map":
3105
3096
  case "block-seq":
3106
3097
  case "flow-collection":
3107
- c = on(kn, s, e, t, n), l && (c.anchor = l.source.substring(1));
3098
+ c = fn(An, s, e, t, n), a && (c.anchor = a.source.substring(1));
3108
3099
  break;
3109
3100
  default: {
3110
- const f = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
3111
- n(e, "UNEXPECTED_TOKEN", f), c = gt(s, e.offset, void 0, null, t, n), d = !1;
3101
+ const u = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
3102
+ n(e, "UNEXPECTED_TOKEN", u), c = yt(s, e.offset, void 0, null, t, n), d = !1;
3112
3103
  }
3113
3104
  }
3114
- return l && c.anchor === "" && n(l, "BAD_ALIAS", "Anchor cannot be an empty string"), i && s.options.stringKeys && (!E(c) || typeof c.value != "string" || c.tag && c.tag !== "tag:yaml.org,2002:str") && n(a ?? e, "NON_STRING_KEY", "With stringKeys, all keys must be strings"), r && (c.spaceBefore = !0), o && (e.type === "scalar" && e.source === "" ? c.comment = o : c.commentBefore = o), s.options.keepSourceTokens && d && (c.srcToken = e), c;
3105
+ return a && c.anchor === "" && n(a, "BAD_ALIAS", "Anchor cannot be an empty string"), i && s.options.stringKeys && (!T(c) || typeof c.value != "string" || c.tag && c.tag !== "tag:yaml.org,2002:str") && n(l ?? e, "NON_STRING_KEY", "With stringKeys, all keys must be strings"), r && (c.spaceBefore = !0), o && (e.type === "scalar" && e.source === "" ? c.comment = o : c.commentBefore = o), s.options.keepSourceTokens && d && (c.srcToken = e), c;
3115
3106
  }
3116
- function gt(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: l, end: a }, c) {
3107
+ function yt(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: a, end: l }, c) {
3117
3108
  const d = {
3118
3109
  type: "scalar",
3119
- offset: wn(e, t, n),
3110
+ offset: On(e, t, n),
3120
3111
  indent: -1,
3121
3112
  source: ""
3122
- }, f = as(s, d, l, c);
3123
- return o && (f.anchor = o.source.substring(1), f.anchor === "" && c(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (f.spaceBefore = !0), r && (f.comment = r, f.range[2] = a), f;
3113
+ }, u = ls(s, d, a, c);
3114
+ return o && (u.anchor = o.source.substring(1), u.anchor === "" && c(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (u.spaceBefore = !0), r && (u.comment = r, u.range[2] = l), u;
3124
3115
  }
3125
- function Sn({ options: s }, { offset: e, source: t, end: n }, i) {
3126
- const r = new it(t.substring(1));
3116
+ function En({ options: s }, { offset: e, source: t, end: n }, i) {
3117
+ const r = new rt(t.substring(1));
3127
3118
  r.source === "" && i(e, "BAD_ALIAS", "Alias cannot be an empty string"), r.source.endsWith(":") && i(e + t.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", !0);
3128
- const o = e + t.length, l = ke(n, o, s.strict, i);
3129
- return r.range = [e, o, l.offset], l.comment && (r.comment = l.comment), r;
3119
+ const o = e + t.length, a = ke(n, o, s.strict, i);
3120
+ return r.range = [e, o, a.offset], a.comment && (r.comment = a.comment), r;
3130
3121
  }
3131
- function Nn(s, e, { offset: t, start: n, value: i, end: r }, o) {
3132
- const l = Object.assign({ _directives: e }, s), a = new Ue(void 0, l), c = {
3122
+ function Tn(s, e, { offset: t, start: n, value: i, end: r }, o) {
3123
+ const a = Object.assign({ _directives: e }, s), l = new Ue(void 0, a), c = {
3133
3124
  atKey: !1,
3134
3125
  atRoot: !0,
3135
- directives: a.directives,
3136
- options: a.options,
3137
- schema: a.schema
3126
+ directives: l.directives,
3127
+ options: l.options,
3128
+ schema: l.schema
3138
3129
  }, d = re(n, {
3139
3130
  indicator: "doc-start",
3140
3131
  next: i ?? r?.[0],
@@ -3143,9 +3134,9 @@ function Nn(s, e, { offset: t, start: n, value: i, end: r }, o) {
3143
3134
  parentIndent: 0,
3144
3135
  startOnNewline: !0
3145
3136
  });
3146
- d.found && (a.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !d.hasNewline && o(d.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), a.contents = i ? cs(c, i, d, o) : gt(c, d.end, n, null, d, o);
3147
- const f = a.contents.range[2], u = ke(r, f, !1, o);
3148
- return u.comment && (a.comment = u.comment), a.range = [t, f, u.offset], a;
3137
+ d.found && (l.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !d.hasNewline && o(d.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), l.contents = i ? cs(c, i, d, o) : yt(c, d.end, n, null, d, o);
3138
+ const u = l.contents.range[2], f = ke(r, u, !1, o);
3139
+ return f.comment && (l.comment = f.comment), l.range = [t, u, f.offset], l;
3149
3140
  }
3150
3141
  function fe(s) {
3151
3142
  if (typeof s == "number")
@@ -3155,7 +3146,7 @@ function fe(s) {
3155
3146
  const { offset: e, source: t } = s;
3156
3147
  return [e, e + (typeof t == "string" ? t.length : 1)];
3157
3148
  }
3158
- function Et(s) {
3149
+ function It(s) {
3159
3150
  let e = "", t = !1, n = !1;
3160
3151
  for (let i = 0; i < s.length; ++i) {
3161
3152
  const r = s[i];
@@ -3175,15 +3166,15 @@ function Et(s) {
3175
3166
  }
3176
3167
  return { comment: e, afterEmptyLine: n };
3177
3168
  }
3178
- class On {
3169
+ class In {
3179
3170
  constructor(e = {}) {
3180
3171
  this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t, n, i, r) => {
3181
3172
  const o = fe(t);
3182
- r ? this.warnings.push(new tn(o, n, i)) : this.errors.push(new he(o, n, i));
3173
+ r ? this.warnings.push(new on(o, n, i)) : this.errors.push(new he(o, n, i));
3183
3174
  }, this.directives = new _({ version: e.version || "1.2" }), this.options = e;
3184
3175
  }
3185
3176
  decorate(e, t) {
3186
- const { comment: n, afterEmptyLine: i } = Et(this.prelude);
3177
+ const { comment: n, afterEmptyLine: i } = It(this.prelude);
3187
3178
  if (n) {
3188
3179
  const r = e.contents;
3189
3180
  if (t)
@@ -3193,10 +3184,10 @@ ${n}` : n;
3193
3184
  e.commentBefore = n;
3194
3185
  else if (I(r) && !r.flow && r.items.length > 0) {
3195
3186
  let o = r.items[0];
3196
- $(o) && (o = o.key);
3197
- const l = o.commentBefore;
3198
- o.commentBefore = l ? `${n}
3199
- ${l}` : n;
3187
+ L(o) && (o = o.key);
3188
+ const a = o.commentBefore;
3189
+ o.commentBefore = a ? `${n}
3190
+ ${a}` : n;
3200
3191
  } else {
3201
3192
  const o = r.commentBefore;
3202
3193
  r.commentBefore = o ? `${n}
@@ -3212,7 +3203,7 @@ ${o}` : n;
3212
3203
  */
3213
3204
  streamInfo() {
3214
3205
  return {
3215
- comment: Et(this.prelude).comment,
3206
+ comment: It(this.prelude).comment,
3216
3207
  directives: this.directives,
3217
3208
  errors: this.errors,
3218
3209
  warnings: this.warnings
@@ -3239,7 +3230,7 @@ ${o}` : n;
3239
3230
  }), this.prelude.push(e.source), this.atDirectives = !0;
3240
3231
  break;
3241
3232
  case "document": {
3242
- const t = Nn(this.options, this.directives, e, this.onError);
3233
+ const t = Tn(this.options, this.directives, e, this.onError);
3243
3234
  this.atDirectives && !t.directives.docStart && this.onError(e, "MISSING_CHAR", "Missing directives-end/doc-start indicator line"), this.decorate(t, !1), this.doc && (yield this.doc), this.doc = t, this.atDirectives = !1;
3244
3235
  break;
3245
3236
  }
@@ -3290,8 +3281,8 @@ ${t.comment}` : t.comment;
3290
3281
  }
3291
3282
  }
3292
3283
  }
3293
- const fs = "\uFEFF", us = "", hs = "", Ze = "";
3294
- function An(s) {
3284
+ const fs = "\uFEFF", us = "", hs = "", et = "";
3285
+ function $n(s) {
3295
3286
  switch (s) {
3296
3287
  case fs:
3297
3288
  return "byte-order-mark";
@@ -3299,7 +3290,7 @@ function An(s) {
3299
3290
  return "doc-mode";
3300
3291
  case hs:
3301
3292
  return "flow-error-end";
3302
- case Ze:
3293
+ case et:
3303
3294
  return "scalar";
3304
3295
  case "---":
3305
3296
  return "doc-start";
@@ -3365,9 +3356,9 @@ function K(s) {
3365
3356
  return !1;
3366
3357
  }
3367
3358
  }
3368
- const It = new Set("0123456789ABCDEFabcdef"), Tn = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), Ae = new Set(",[]{}"), En = new Set(` ,[]{}
3369
- \r `), He = (s) => !s || En.has(s);
3370
- class In {
3359
+ const $t = new Set("0123456789ABCDEFabcdef"), Ln = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), Ae = new Set(",[]{}"), vn = new Set(` ,[]{}
3360
+ \r `), We = (s) => !s || vn.has(s);
3361
+ class Cn {
3371
3362
  constructor() {
3372
3363
  this.atEnd = !1, this.blockScalarIndent = -1, this.blockScalarKeep = !1, this.buffer = "", this.flowKey = !1, this.flowLevel = 0, this.indentNext = 0, this.indentValue = 0, this.lineEndPos = null, this.next = null, this.pos = 0;
3373
3364
  }
@@ -3527,7 +3518,7 @@ class In {
3527
3518
  case "]":
3528
3519
  return yield* this.pushCount(1), "doc";
3529
3520
  case "*":
3530
- return yield* this.pushUntil(He), "doc";
3521
+ return yield* this.pushUntil(We), "doc";
3531
3522
  case '"':
3532
3523
  case "'":
3533
3524
  return yield* this.parseQuotedScalar();
@@ -3563,7 +3554,7 @@ class In {
3563
3554
  case "]":
3564
3555
  return yield* this.pushCount(1), this.flowKey = !0, this.flowLevel -= 1, this.flowLevel ? "flow" : "doc";
3565
3556
  case "*":
3566
- return yield* this.pushUntil(He), "flow";
3557
+ return yield* this.pushUntil(We), "flow";
3567
3558
  case '"':
3568
3559
  case "'":
3569
3560
  return this.flowKey = !0, yield* this.parseQuotedScalar();
@@ -3678,16 +3669,16 @@ class In {
3678
3669
  do {
3679
3670
  let r = e - 1, o = this.buffer[r];
3680
3671
  o === "\r" && (o = this.buffer[--r]);
3681
- const l = r;
3672
+ const a = r;
3682
3673
  for (; o === " "; )
3683
3674
  o = this.buffer[--r];
3684
3675
  if (o === `
3685
- ` && r >= this.pos && r + 1 + t > l)
3676
+ ` && r >= this.pos && r + 1 + t > a)
3686
3677
  e = r;
3687
3678
  else
3688
3679
  break;
3689
3680
  } while (!0);
3690
- return yield Ze, yield* this.pushToIndex(e + 1, !0), yield* this.parseLineStart();
3681
+ return yield et, yield* this.pushToIndex(e + 1, !0), yield* this.parseLineStart();
3691
3682
  }
3692
3683
  *parsePlainScalar() {
3693
3684
  const e = this.flowLevel > 0;
@@ -3716,7 +3707,7 @@ class In {
3716
3707
  break;
3717
3708
  t = n;
3718
3709
  }
3719
- return !i && !this.atEnd ? this.setNext("plain-scalar") : (yield Ze, yield* this.pushToIndex(t + 1, !0), e ? "flow" : "doc");
3710
+ return !i && !this.atEnd ? this.setNext("plain-scalar") : (yield et, yield* this.pushToIndex(t + 1, !0), e ? "flow" : "doc");
3720
3711
  }
3721
3712
  *pushCount(e) {
3722
3713
  return e > 0 ? (yield this.buffer.substr(this.pos, e), this.pos += e, e) : 0;
@@ -3730,7 +3721,7 @@ class In {
3730
3721
  case "!":
3731
3722
  return (yield* this.pushTag()) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
3732
3723
  case "&":
3733
- return (yield* this.pushUntil(He)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
3724
+ return (yield* this.pushUntil(We)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
3734
3725
  case "-":
3735
3726
  // this is an error
3736
3727
  case "?":
@@ -3752,9 +3743,9 @@ class In {
3752
3743
  } else {
3753
3744
  let e = this.pos + 1, t = this.buffer[e];
3754
3745
  for (; t; )
3755
- if (Tn.has(t))
3746
+ if (Ln.has(t))
3756
3747
  t = this.buffer[++e];
3757
- else if (t === "%" && It.has(this.buffer[e + 1]) && It.has(this.buffer[e + 2]))
3748
+ else if (t === "%" && $t.has(this.buffer[e + 1]) && $t.has(this.buffer[e + 2]))
3758
3749
  t = this.buffer[e += 3];
3759
3750
  else
3760
3751
  break;
@@ -3782,7 +3773,7 @@ class In {
3782
3773
  return yield* this.pushToIndex(t, !1);
3783
3774
  }
3784
3775
  }
3785
- class Ln {
3776
+ class _n {
3786
3777
  constructor() {
3787
3778
  this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
3788
3779
  let t = 0, n = this.lineStarts.length;
@@ -3829,7 +3820,7 @@ function ds(s) {
3829
3820
  return !1;
3830
3821
  }
3831
3822
  }
3832
- function Te(s) {
3823
+ function Ee(s) {
3833
3824
  switch (s.type) {
3834
3825
  case "document":
3835
3826
  return s.start;
@@ -3861,18 +3852,18 @@ function z(s) {
3861
3852
  ;
3862
3853
  return s.splice(e, s.length);
3863
3854
  }
3864
- function $t(s) {
3855
+ function vt(s) {
3865
3856
  if (s.start.type === "flow-seq-start")
3866
3857
  for (const e of s.items)
3867
3858
  e.sep && !e.value && !V(e.start, "explicit-key-ind") && !V(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key, ds(e.value) ? e.value.end ? Array.prototype.push.apply(e.value.end, e.sep) : e.value.end = e.sep : Array.prototype.push.apply(e.start, e.sep), delete e.sep);
3868
3859
  }
3869
- class $n {
3860
+ class Bn {
3870
3861
  /**
3871
3862
  * @param onNewLine - If defined, called separately with the start position of
3872
3863
  * each new line (in `parse()`, including the start of input).
3873
3864
  */
3874
3865
  constructor(e) {
3875
- this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new In(), this.onNewLine = e;
3866
+ this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new Cn(), this.onNewLine = e;
3876
3867
  }
3877
3868
  /**
3878
3869
  * Parse `source` as a YAML stream.
@@ -3896,7 +3887,7 @@ class $n {
3896
3887
  this.atScalar = !1, yield* this.step(), this.offset += e.length;
3897
3888
  return;
3898
3889
  }
3899
- const t = An(e);
3890
+ const t = $n(e);
3900
3891
  if (t)
3901
3892
  if (t === "scalar")
3902
3893
  this.atNewLine = !1, this.atScalar = !0, this.type = "scalar";
@@ -3985,7 +3976,7 @@ class $n {
3985
3976
  yield t;
3986
3977
  else {
3987
3978
  const n = this.peek(1);
3988
- switch (t.type === "block-scalar" ? t.indent = "indent" in n ? n.indent : 0 : t.type === "flow-collection" && n.type === "document" && (t.indent = 0), t.type === "flow-collection" && $t(t), n.type) {
3979
+ switch (t.type === "block-scalar" ? t.indent = "indent" in n ? n.indent : 0 : t.type === "flow-collection" && n.type === "document" && (t.indent = 0), t.type === "flow-collection" && vt(t), n.type) {
3989
3980
  case "document":
3990
3981
  n.value = t;
3991
3982
  break;
@@ -4080,7 +4071,7 @@ class $n {
4080
4071
  }
4081
4072
  *scalar(e) {
4082
4073
  if (this.type === "map-value-ind") {
4083
- const t = Te(this.peek(2)), n = z(t);
4074
+ const t = Ee(this.peek(2)), n = z(t);
4084
4075
  let i;
4085
4076
  e.end ? (i = e.end, i.push(this.sourceToken), delete e.end) : i = [this.sourceToken];
4086
4077
  const r = {
@@ -4147,16 +4138,16 @@ class $n {
4147
4138
  let r = [];
4148
4139
  if (i && t.sep && !t.value) {
4149
4140
  const o = [];
4150
- for (let l = 0; l < t.sep.length; ++l) {
4151
- const a = t.sep[l];
4152
- switch (a.type) {
4141
+ for (let a = 0; a < t.sep.length; ++a) {
4142
+ const l = t.sep[a];
4143
+ switch (l.type) {
4153
4144
  case "newline":
4154
- o.push(l);
4145
+ o.push(a);
4155
4146
  break;
4156
4147
  case "space":
4157
4148
  break;
4158
4149
  case "comment":
4159
- a.indent > e.indent && (o.length = 0);
4150
+ l.indent > e.indent && (o.length = 0);
4160
4151
  break;
4161
4152
  default:
4162
4153
  o.length = 0;
@@ -4190,12 +4181,12 @@ class $n {
4190
4181
  items: [{ start: r, key: null, sep: [this.sourceToken] }]
4191
4182
  });
4192
4183
  else if (ds(t.key) && !V(t.sep, "newline")) {
4193
- const o = z(t.start), l = t.key, a = t.sep;
4194
- a.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
4184
+ const o = z(t.start), a = t.key, l = t.sep;
4185
+ l.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
4195
4186
  type: "block-map",
4196
4187
  offset: this.offset,
4197
4188
  indent: this.indent,
4198
- items: [{ start: o, key: l, sep: a }]
4189
+ items: [{ start: o, key: a, sep: l }]
4199
4190
  });
4200
4191
  } else r.length > 0 ? t.sep = t.sep.concat(r, this.sourceToken) : t.sep.push(this.sourceToken);
4201
4192
  else if (V(t.start, "newline"))
@@ -4337,17 +4328,17 @@ class $n {
4337
4328
  if (n.type === "block-map" && (this.type === "map-value-ind" && n.indent === e.indent || this.type === "newline" && !n.items[n.items.length - 1].sep))
4338
4329
  yield* this.pop(), yield* this.step();
4339
4330
  else if (this.type === "map-value-ind" && n.type !== "flow-collection") {
4340
- const i = Te(n), r = z(i);
4341
- $t(e);
4331
+ const i = Ee(n), r = z(i);
4332
+ vt(e);
4342
4333
  const o = e.end.splice(1, e.end.length);
4343
4334
  o.push(this.sourceToken);
4344
- const l = {
4335
+ const a = {
4345
4336
  type: "block-map",
4346
4337
  offset: e.offset,
4347
4338
  indent: e.indent,
4348
4339
  items: [{ start: r, key: e, sep: o }]
4349
4340
  };
4350
- this.onKeyLine = !0, this.stack[this.stack.length - 1] = l;
4341
+ this.onKeyLine = !0, this.stack[this.stack.length - 1] = a;
4351
4342
  } else
4352
4343
  yield* this.lineEnd(e);
4353
4344
  }
@@ -4401,7 +4392,7 @@ class $n {
4401
4392
  };
4402
4393
  case "explicit-key-ind": {
4403
4394
  this.onKeyLine = !0;
4404
- const t = Te(e), n = z(t);
4395
+ const t = Ee(e), n = z(t);
4405
4396
  return n.push(this.sourceToken), {
4406
4397
  type: "block-map",
4407
4398
  offset: this.offset,
@@ -4411,7 +4402,7 @@ class $n {
4411
4402
  }
4412
4403
  case "map-value-ind": {
4413
4404
  this.onKeyLine = !0;
4414
- const t = Te(e), n = z(t);
4405
+ const t = Ee(e), n = z(t);
4415
4406
  return {
4416
4407
  type: "block-map",
4417
4408
  offset: this.offset,
@@ -4445,44 +4436,44 @@ class $n {
4445
4436
  }
4446
4437
  }
4447
4438
  }
4448
- function vn(s) {
4439
+ function Mn(s) {
4449
4440
  const e = s.prettyErrors !== !1;
4450
- return { lineCounter: s.lineCounter || e && new Ln() || null, prettyErrors: e };
4441
+ return { lineCounter: s.lineCounter || e && new _n() || null, prettyErrors: e };
4451
4442
  }
4452
- function Cn(s, e = {}) {
4453
- const { lineCounter: t, prettyErrors: n } = vn(e), i = new $n(t?.addNewLine), r = new On(e);
4443
+ function jn(s, e = {}) {
4444
+ const { lineCounter: t, prettyErrors: n } = Mn(e), i = new Bn(t?.addNewLine), r = new In(e);
4454
4445
  let o = null;
4455
- for (const l of r.compose(i.parse(s), !0, s.length))
4446
+ for (const a of r.compose(i.parse(s), !0, s.length))
4456
4447
  if (!o)
4457
- o = l;
4448
+ o = a;
4458
4449
  else if (o.options.logLevel !== "silent") {
4459
- o.errors.push(new he(l.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
4450
+ o.errors.push(new he(a.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
4460
4451
  break;
4461
4452
  }
4462
- return n && t && (o.errors.forEach(At(s, t)), o.warnings.forEach(At(s, t))), o;
4453
+ return n && t && (o.errors.forEach(Et(s, t)), o.warnings.forEach(Et(s, t))), o;
4463
4454
  }
4464
- function _n(s, e, t) {
4455
+ function Pn(s, e, t) {
4465
4456
  let n;
4466
- const i = Cn(s, t);
4457
+ const i = jn(s, t);
4467
4458
  if (!i)
4468
4459
  return null;
4469
- if (i.warnings.forEach((r) => Ut(i.options.logLevel, r)), i.errors.length > 0) {
4460
+ if (i.warnings.forEach((r) => Ft(i.options.logLevel, r)), i.errors.length > 0) {
4470
4461
  if (i.options.logLevel !== "silent")
4471
4462
  throw i.errors[0];
4472
4463
  i.errors = [];
4473
4464
  }
4474
4465
  return i.toJS(Object.assign({ reviver: n }, t));
4475
4466
  }
4476
- function Bn(s) {
4477
- return bt.isAbsolute(s) ? s : bt.resolve(process.cwd(), s);
4467
+ function Kn(s) {
4468
+ return wt.isAbsolute(s) ? s : wt.resolve(process.cwd(), s);
4478
4469
  }
4479
- async function Mn(s) {
4470
+ async function Dn(s) {
4480
4471
  if (!s)
4481
- return {};
4482
- const e = Bn(s), t = await et(e, "utf8");
4483
- return e.endsWith(".yaml") || e.endsWith(".yml") ? _n(t) ?? {} : JSON.parse(t);
4472
+ return { on: {} };
4473
+ const e = Kn(s), t = await tt(e, "utf8");
4474
+ return e.endsWith(".yaml") || e.endsWith(".yml") ? Pn(t) ?? { on: {} } : JSON.parse(t);
4484
4475
  }
4485
- function Pn(s) {
4476
+ function qn(s) {
4486
4477
  return s.split(/\r?\n/u).map((e) => e.trim()).filter((e) => e.length > 0 && !e.startsWith("#")).reduce((e, t) => {
4487
4478
  const n = t.indexOf("=");
4488
4479
  if (n <= 0)
@@ -4491,23 +4482,23 @@ function Pn(s) {
4491
4482
  return e[i] = r, e;
4492
4483
  }, {});
4493
4484
  }
4494
- async function jn(s) {
4485
+ async function Fn(s) {
4495
4486
  const e = {};
4496
4487
  for (const [t, n] of Object.entries(process.env))
4497
4488
  typeof n == "string" && (e[t] = n);
4498
4489
  for (const t of s ?? []) {
4499
- const n = await et(t, "utf8");
4490
+ const n = await tt(t, "utf8");
4500
4491
  if (t.endsWith(".json")) {
4501
- const i = tt(JSON.parse(n));
4492
+ const i = st(JSON.parse(n));
4502
4493
  for (const [r, o] of Object.entries(i))
4503
4494
  o != null && (e[r] = String(o));
4504
4495
  continue;
4505
4496
  }
4506
- Object.assign(e, Pn(n));
4497
+ Object.assign(e, qn(n));
4507
4498
  }
4508
4499
  return e;
4509
4500
  }
4510
- const Kn = `on - daemonized webhook runner
4501
+ const Un = "/workspace", Rn = `on - daemonized webhook runner
4511
4502
 
4512
4503
  Usage:
4513
4504
  on --port <port> [--host <host>] [--config <path>]
@@ -4518,52 +4509,120 @@ Options:
4518
4509
  --config, -c Path to a YAML/JSON config file
4519
4510
  --help, -h Show this help message
4520
4511
  `;
4521
- async function Dn(s, e) {
4522
- await new Promise((t, n) => {
4523
- const i = ys(s, {
4524
- env: e,
4525
- shell: !0,
4526
- stdio: "inherit"
4527
- });
4528
- i.once("error", n), i.once("exit", (r) => {
4529
- if (r === 0) {
4530
- t();
4512
+ function Vn(s, e) {
4513
+ if (typeof s.run != "string")
4514
+ throw new Error("Each workflow step must have a 'run' command string.");
4515
+ const t = e.workflow.defaults || {};
4516
+ return s.image ||= t.image, s.volumes ||= t.volumes || {}, s.args ||= t.args, s.run = Ce(s.run, { ...e, step: s }), s;
4517
+ }
4518
+ function Jn(s, e) {
4519
+ return (s || []).flatMap(
4520
+ (t) => Object.entries(t).flatMap(([n, i]) => [
4521
+ `--${n}`,
4522
+ Ce(String(i), e)
4523
+ ])
4524
+ );
4525
+ }
4526
+ function Yn(s, e) {
4527
+ return s["."] ||= Un, Object.entries(s).flatMap(([t, n]) => [
4528
+ "-v",
4529
+ `${t === "." ? e.workingDir : t}:${n}`
4530
+ ]);
4531
+ }
4532
+ function Gn(s) {
4533
+ const { workflow: e, secrets: t } = s, n = {
4534
+ ...process.env,
4535
+ ...Object.fromEntries(
4536
+ Object.entries(t).map(([i, r]) => [i, String(r)])
4537
+ ),
4538
+ PWD: s.workingDir
4539
+ };
4540
+ if (e.env) {
4541
+ if (typeof e.env != "object")
4542
+ throw new Error("Workflow env field must be an object.");
4543
+ for (const [i, r] of Object.entries(e.env))
4544
+ n[i] = Ce(r, s);
4545
+ }
4546
+ s.env = n;
4547
+ }
4548
+ async function Hn(s, e) {
4549
+ typeof s == "string" && (s = { run: s });
4550
+ const t = Vn(s, e), { args: n, image: i, volumes: r } = t, o = Yn(r, e), a = Jn(n, e), l = r["."], c = [
4551
+ "run",
4552
+ "-i",
4553
+ "--rm",
4554
+ ...o,
4555
+ ...a,
4556
+ "-w",
4557
+ l,
4558
+ "--entrypoint",
4559
+ "sh",
4560
+ i
4561
+ ];
4562
+ await new Promise((d, u) => {
4563
+ const f = ys("docker", c, { env: e.env });
4564
+ f.stdout?.pipe(process.stdout), f.stderr?.pipe(process.stderr), f.once("error", u), f.once("exit", (m) => {
4565
+ if (m === 0) {
4566
+ d();
4531
4567
  return;
4532
4568
  }
4533
- n(new Error(`Step failed with exit code ${r}: ${s}`));
4534
- });
4569
+ u(new Error(`Step failed with exit code ${m}: ${s}`));
4570
+ }), f.stdin?.write(t.run), f.stdin?.write(`
4571
+ exit $?;
4572
+ `), f.stdin?.end();
4535
4573
  });
4536
4574
  }
4575
+ function Wn(s, e) {
4576
+ const t = Object.keys(s), n = Object.keys(e.on), i = n.find((a) => s[a]), r = i ? e.on[i] : null;
4577
+ if (!r)
4578
+ return console.log(
4579
+ `No workflow defined for event keys: ${t.join(", ")}, only accepting ${n.join(", ")}.`
4580
+ ), null;
4581
+ if (!r.steps || r.steps.length === 0)
4582
+ return console.warn(
4583
+ `Workflow for event ${s.source}:${s.event} has no steps defined, skipping.`
4584
+ ), null;
4585
+ const o = s[i];
4586
+ return {
4587
+ workflow: r,
4588
+ event: o
4589
+ };
4590
+ }
4537
4591
  async function ps(s, e) {
4538
- if (typeof s.source != "string" || typeof s.event != "string")
4539
- throw new Error(
4540
- "Incoming payload must include string fields 'source' and 'event'."
4541
- );
4542
- const t = e.on?.[s.source]?.[s.event];
4592
+ const t = Wn(s, e);
4543
4593
  if (!t)
4544
- throw new Error(
4545
- `No workflow configured for source '${s.source}' and event '${s.event}'.`
4546
- );
4547
- const n = Ss({ ...s }, t.mappings), i = await jn(t.secrets), r = {
4548
- ...process.env,
4549
- ...Object.fromEntries(
4550
- Object.entries(i).map(([l, a]) => [l, String(a)])
4551
- )
4552
- }, o = {
4553
- inputs: n,
4554
- secrets: i
4594
+ return;
4595
+ const { workflow: n, event: i } = t, r = Es(i, n.mappings), o = await Fn(n.secrets), a = await bs(ks(Ns(), "workflow")), l = {
4596
+ inputs: r,
4597
+ secrets: o,
4598
+ workflow: n,
4599
+ env: {},
4600
+ outputs: {},
4601
+ workingDir: a
4555
4602
  };
4556
- for (const [l, a] of Object.entries(t.env ?? {}))
4557
- r[l] = ks(a, o);
4558
- t.defaults?.image && (r.ON_DEFAULT_IMAGE = t.defaults.image), t.defaults?.volumes && (r.ON_DEFAULT_VOLUMES = JSON.stringify(t.defaults.volumes)), t.defaults?.args && (r.ON_DEFAULT_ARGS = JSON.stringify(t.defaults.args));
4559
- for (const l of t.steps ?? [])
4560
- await Dn(l, r);
4561
- for (const l of t.dispatch ?? []) {
4562
- const a = await et(l, "utf8"), c = tt(JSON.parse(a));
4563
- await ps(c, e);
4603
+ Gn(l);
4604
+ try {
4605
+ for (const c of n.steps ?? [])
4606
+ await Hn(c, l);
4607
+ for (const c of n.triggers ?? [])
4608
+ await Qn(c, e);
4609
+ } catch (c) {
4610
+ const d = c instanceof Error ? c.message : String(c);
4611
+ console.error(`Error processing event: ${d}`), console.debug(JSON.stringify(i));
4612
+ } finally {
4613
+ await ws(l.workingDir, { recursive: !0, force: !0 });
4614
+ }
4615
+ return l.outputs;
4616
+ }
4617
+ async function Qn(s, e) {
4618
+ if (!Ss(s)) {
4619
+ console.warn(`Trigger file does not exist: ${s}`);
4620
+ return;
4564
4621
  }
4622
+ const t = await tt(s, "utf8"), n = st(JSON.parse(t));
4623
+ await ps(n, e);
4565
4624
  }
4566
- function qn(s) {
4625
+ function Xn(s) {
4567
4626
  const { values: e } = gs({
4568
4627
  args: s,
4569
4628
  options: {
@@ -4575,33 +4634,32 @@ function qn(s) {
4575
4634
  allowPositionals: !1
4576
4635
  });
4577
4636
  if (e.help)
4578
- return console.log(Kn), null;
4637
+ return console.log(Rn), null;
4579
4638
  if (!e.port)
4580
4639
  throw new Error("Missing required option --port.");
4581
4640
  return {
4582
- port: ws(e.port),
4641
+ port: As(e.port),
4583
4642
  host: e.host,
4584
4643
  configPath: e.config
4585
4644
  };
4586
4645
  }
4587
- async function Un(s) {
4588
- const e = await Mn(s.configPath), t = ms(async (i, r) => {
4646
+ async function xn(s) {
4647
+ const e = await Dn(s.configPath), t = ms(async (i, r) => {
4589
4648
  if (i.method !== "POST") {
4590
- Fe(r, 405, { error: "Only POST webhooks are supported." });
4649
+ Re(r, 405, { error: "Only POST webhooks are supported." });
4591
4650
  return;
4592
4651
  }
4593
4652
  try {
4594
- const o = await bs(i), l = tt(
4653
+ const o = await Os(i), a = st(
4595
4654
  o.length > 0 ? JSON.parse(o) : {}
4596
- );
4597
- await ps(l, e), Fe(r, 202, {
4655
+ ), l = await ps(a, e);
4656
+ Re(r, 202, {
4598
4657
  status: "accepted",
4599
- source: l.source,
4600
- event: l.event
4658
+ outputs: l
4601
4659
  });
4602
4660
  } catch (o) {
4603
- const l = o instanceof Error ? o.message : "Unknown error";
4604
- Fe(r, 400, { error: l });
4661
+ const a = o instanceof Error ? o.message : "Unknown error";
4662
+ Re(r, 400, { error: a });
4605
4663
  }
4606
4664
  });
4607
4665
  await new Promise((i, r) => {
@@ -4612,22 +4670,22 @@ async function Un(s) {
4612
4670
  `on daemon listening on http://${n.address}:${n.port}`
4613
4671
  ), t;
4614
4672
  }
4615
- async function Fn() {
4673
+ async function zn() {
4616
4674
  try {
4617
- const s = qn(process.argv.slice(2));
4675
+ const s = Xn(process.argv.slice(2));
4618
4676
  if (!s) {
4619
4677
  process.exitCode = 0;
4620
4678
  return;
4621
4679
  }
4622
- await Un(s);
4680
+ await xn(s);
4623
4681
  } catch (s) {
4624
4682
  const e = s instanceof Error ? s.message : String(s);
4625
4683
  console.error(`on: ${e}`), process.exitCode = 1;
4626
4684
  }
4627
4685
  }
4628
- Fn();
4686
+ zn();
4629
4687
  export {
4630
- Fn as main,
4631
- qn as parseCliOptions,
4632
- Un as startDaemon
4688
+ zn as main,
4689
+ Xn as parseCliOptions,
4690
+ xn as startDaemon
4633
4691
  };