gagen 0.0.4

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 (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +553 -0
  3. package/esm/_dnt.polyfills.d.ts +12 -0
  4. package/esm/_dnt.polyfills.d.ts.map +1 -0
  5. package/esm/_dnt.polyfills.js +15 -0
  6. package/esm/_dnt.test_shims.d.ts.map +1 -0
  7. package/esm/artifact.d.ts +20 -0
  8. package/esm/artifact.d.ts.map +1 -0
  9. package/esm/artifact.js +62 -0
  10. package/esm/deps/jsr.io/@std/assert/1.0.18/almost_equals.d.ts.map +1 -0
  11. package/esm/deps/jsr.io/@std/assert/1.0.18/array_includes.d.ts.map +1 -0
  12. package/esm/deps/jsr.io/@std/assert/1.0.18/assert.d.ts.map +1 -0
  13. package/esm/deps/jsr.io/@std/assert/1.0.18/assertion_error.d.ts.map +1 -0
  14. package/esm/deps/jsr.io/@std/assert/1.0.18/equal.d.ts.map +1 -0
  15. package/esm/deps/jsr.io/@std/assert/1.0.18/equals.d.ts.map +1 -0
  16. package/esm/deps/jsr.io/@std/assert/1.0.18/exists.d.ts.map +1 -0
  17. package/esm/deps/jsr.io/@std/assert/1.0.18/fail.d.ts.map +1 -0
  18. package/esm/deps/jsr.io/@std/assert/1.0.18/false.d.ts.map +1 -0
  19. package/esm/deps/jsr.io/@std/assert/1.0.18/greater.d.ts.map +1 -0
  20. package/esm/deps/jsr.io/@std/assert/1.0.18/greater_or_equal.d.ts.map +1 -0
  21. package/esm/deps/jsr.io/@std/assert/1.0.18/instance_of.d.ts.map +1 -0
  22. package/esm/deps/jsr.io/@std/assert/1.0.18/is_error.d.ts.map +1 -0
  23. package/esm/deps/jsr.io/@std/assert/1.0.18/less.d.ts.map +1 -0
  24. package/esm/deps/jsr.io/@std/assert/1.0.18/less_or_equal.d.ts.map +1 -0
  25. package/esm/deps/jsr.io/@std/assert/1.0.18/match.d.ts.map +1 -0
  26. package/esm/deps/jsr.io/@std/assert/1.0.18/mod.d.ts.map +1 -0
  27. package/esm/deps/jsr.io/@std/assert/1.0.18/not_equals.d.ts.map +1 -0
  28. package/esm/deps/jsr.io/@std/assert/1.0.18/not_instance_of.d.ts.map +1 -0
  29. package/esm/deps/jsr.io/@std/assert/1.0.18/not_match.d.ts.map +1 -0
  30. package/esm/deps/jsr.io/@std/assert/1.0.18/not_strict_equals.d.ts.map +1 -0
  31. package/esm/deps/jsr.io/@std/assert/1.0.18/object_match.d.ts.map +1 -0
  32. package/esm/deps/jsr.io/@std/assert/1.0.18/rejects.d.ts.map +1 -0
  33. package/esm/deps/jsr.io/@std/assert/1.0.18/strict_equals.d.ts.map +1 -0
  34. package/esm/deps/jsr.io/@std/assert/1.0.18/string_includes.d.ts.map +1 -0
  35. package/esm/deps/jsr.io/@std/assert/1.0.18/throws.d.ts.map +1 -0
  36. package/esm/deps/jsr.io/@std/assert/1.0.18/unimplemented.d.ts.map +1 -0
  37. package/esm/deps/jsr.io/@std/assert/1.0.18/unreachable.d.ts.map +1 -0
  38. package/esm/deps/jsr.io/@std/internal/1.0.12/build_message.d.ts.map +1 -0
  39. package/esm/deps/jsr.io/@std/internal/1.0.12/diff.d.ts.map +1 -0
  40. package/esm/deps/jsr.io/@std/internal/1.0.12/diff_str.d.ts.map +1 -0
  41. package/esm/deps/jsr.io/@std/internal/1.0.12/format.d.ts.map +1 -0
  42. package/esm/deps/jsr.io/@std/internal/1.0.12/styles.d.ts.map +1 -0
  43. package/esm/deps/jsr.io/@std/internal/1.0.12/types.d.ts.map +1 -0
  44. package/esm/deps/jsr.io/@std/yaml/1.0.11/_chars.d.ts +33 -0
  45. package/esm/deps/jsr.io/@std/yaml/1.0.11/_chars.d.ts.map +1 -0
  46. package/esm/deps/jsr.io/@std/yaml/1.0.11/_chars.js +48 -0
  47. package/esm/deps/jsr.io/@std/yaml/1.0.11/_dumper_state.d.ts +106 -0
  48. package/esm/deps/jsr.io/@std/yaml/1.0.11/_dumper_state.d.ts.map +1 -0
  49. package/esm/deps/jsr.io/@std/yaml/1.0.11/_dumper_state.js +712 -0
  50. package/esm/deps/jsr.io/@std/yaml/1.0.11/_loader_state.d.ts +69 -0
  51. package/esm/deps/jsr.io/@std/yaml/1.0.11/_loader_state.d.ts.map +1 -0
  52. package/esm/deps/jsr.io/@std/yaml/1.0.11/_loader_state.js +1404 -0
  53. package/esm/deps/jsr.io/@std/yaml/1.0.11/_schema.d.ts +44 -0
  54. package/esm/deps/jsr.io/@std/yaml/1.0.11/_schema.d.ts.map +1 -0
  55. package/esm/deps/jsr.io/@std/yaml/1.0.11/_schema.js +117 -0
  56. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/binary.d.ts +3 -0
  57. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/binary.d.ts.map +1 -0
  58. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/binary.js +103 -0
  59. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/bool.d.ts +3 -0
  60. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/bool.d.ts.map +1 -0
  61. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/bool.js +32 -0
  62. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/float.d.ts +3 -0
  63. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/float.d.ts.map +1 -0
  64. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/float.js +96 -0
  65. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/int.d.ts +3 -0
  66. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/int.d.ts.map +1 -0
  67. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/int.js +159 -0
  68. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/map.d.ts +3 -0
  69. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/map.d.ts.map +1 -0
  70. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/map.js +14 -0
  71. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/merge.d.ts +3 -0
  72. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/merge.d.ts.map +1 -0
  73. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/merge.js +10 -0
  74. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/nil.d.ts +3 -0
  75. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/nil.d.ts.map +1 -0
  76. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/nil.js +22 -0
  77. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/omap.d.ts +3 -0
  78. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/omap.d.ts.map +1 -0
  79. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/omap.js +29 -0
  80. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/pairs.d.ts +3 -0
  81. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/pairs.d.ts.map +1 -0
  82. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/pairs.js +19 -0
  83. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/regexp.d.ts +3 -0
  84. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/regexp.d.ts.map +1 -0
  85. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/regexp.js +30 -0
  86. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/seq.d.ts +3 -0
  87. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/seq.d.ts.map +1 -0
  88. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/seq.js +10 -0
  89. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/set.d.ts +3 -0
  90. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/set.d.ts.map +1 -0
  91. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/set.js +14 -0
  92. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/str.d.ts +3 -0
  93. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/str.d.ts.map +1 -0
  94. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/str.js +9 -0
  95. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/timestamp.d.ts +3 -0
  96. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/timestamp.d.ts.map +1 -0
  97. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/timestamp.js +81 -0
  98. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/undefined.d.ts +3 -0
  99. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/undefined.d.ts.map +1 -0
  100. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type/undefined.js +20 -0
  101. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type.d.ts +32 -0
  102. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type.d.ts.map +1 -0
  103. package/esm/deps/jsr.io/@std/yaml/1.0.11/_type.js +6 -0
  104. package/esm/deps/jsr.io/@std/yaml/1.0.11/_utils.d.ts +4 -0
  105. package/esm/deps/jsr.io/@std/yaml/1.0.11/_utils.d.ts.map +1 -0
  106. package/esm/deps/jsr.io/@std/yaml/1.0.11/_utils.js +13 -0
  107. package/esm/deps/jsr.io/@std/yaml/1.0.11/parse.d.ts +76 -0
  108. package/esm/deps/jsr.io/@std/yaml/1.0.11/parse.d.ts.map +1 -0
  109. package/esm/deps/jsr.io/@std/yaml/1.0.11/parse.js +93 -0
  110. package/esm/deps/jsr.io/@std/yaml/1.0.11/stringify.d.ts +100 -0
  111. package/esm/deps/jsr.io/@std/yaml/1.0.11/stringify.d.ts.map +1 -0
  112. package/esm/deps/jsr.io/@std/yaml/1.0.11/stringify.js +33 -0
  113. package/esm/expression.d.ts +157 -0
  114. package/esm/expression.d.ts.map +1 -0
  115. package/esm/expression.js +393 -0
  116. package/esm/expression_test.d.ts.map +1 -0
  117. package/esm/job.d.ts +77 -0
  118. package/esm/job.d.ts.map +1 -0
  119. package/esm/job.js +906 -0
  120. package/esm/matrix.d.ts +15 -0
  121. package/esm/matrix.d.ts.map +1 -0
  122. package/esm/matrix.js +44 -0
  123. package/esm/mod.d.ts +14 -0
  124. package/esm/mod.d.ts.map +1 -0
  125. package/esm/mod.js +7 -0
  126. package/esm/mod_test.d.ts.map +1 -0
  127. package/esm/package.json +3 -0
  128. package/esm/permissions.d.ts +4 -0
  129. package/esm/permissions.d.ts.map +1 -0
  130. package/esm/permissions.js +1 -0
  131. package/esm/step.d.ts +48 -0
  132. package/esm/step.d.ts.map +1 -0
  133. package/esm/step.js +226 -0
  134. package/esm/workflow.d.ts +71 -0
  135. package/esm/workflow.d.ts.map +1 -0
  136. package/esm/workflow.js +136 -0
  137. package/package.json +28 -0
@@ -0,0 +1,1404 @@
1
+ // Ported from js-yaml v3.13.1:
2
+ // https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
3
+ // Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
4
+ // Copyright 2018-2026 the Deno authors. MIT license.
5
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
6
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
7
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
8
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
9
+ };
10
+ var _LoaderState_instances, _LoaderState_createError;
11
+ import { AMPERSAND, ASTERISK, BACKSLASH, CARRIAGE_RETURN, COLON, COMMA, COMMERCIAL_AT, DOT, DOUBLE_QUOTE, EXCLAMATION, GRAVE_ACCENT, GREATER_THAN, isEOL, isFlowIndicator, isWhiteSpace, isWhiteSpaceOrEOL, LEFT_CURLY_BRACKET, LEFT_SQUARE_BRACKET, LINE_FEED, MINUS, PERCENT, PLUS, QUESTION, RIGHT_CURLY_BRACKET, RIGHT_SQUARE_BRACKET, SHARP, SINGLE_QUOTE, SMALLER_THAN, SPACE, VERTICAL_LINE, } from "./_chars.js";
12
+ import { DEFAULT_SCHEMA } from "./_schema.js";
13
+ import { isObject, isPlainObject } from "./_utils.js";
14
+ const CONTEXT_FLOW_IN = 1;
15
+ const CONTEXT_FLOW_OUT = 2;
16
+ const CONTEXT_BLOCK_IN = 3;
17
+ const CONTEXT_BLOCK_OUT = 4;
18
+ const CHOMPING_CLIP = 1;
19
+ const CHOMPING_STRIP = 2;
20
+ const CHOMPING_KEEP = 3;
21
+ const PATTERN_NON_PRINTABLE =
22
+ // deno-lint-ignore no-control-regex
23
+ /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
24
+ const PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
25
+ const PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
26
+ const PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
27
+ const PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
28
+ const ESCAPED_HEX_LENGTHS = new Map([
29
+ [0x78, 2], // x
30
+ [0x75, 4], // u
31
+ [0x55, 8], // U
32
+ ]);
33
+ const SIMPLE_ESCAPE_SEQUENCES = new Map([
34
+ [0x30, "\x00"], // 0
35
+ [0x61, "\x07"], // a
36
+ [0x62, "\x08"], // b
37
+ [0x74, "\x09"], // t
38
+ [0x09, "\x09"], // Tab
39
+ [0x6e, "\x0A"], // n
40
+ [0x76, "\x0B"], // v
41
+ [0x66, "\x0C"], // f
42
+ [0x72, "\x0D"], // r
43
+ [0x65, "\x1B"], // e
44
+ [0x20, " "], // Space
45
+ [0x22, '"'], // "
46
+ [0x2f, "/"], // /
47
+ [0x5c, "\\"], // \
48
+ [0x4e, "\x85"], // N
49
+ [0x5f, "\xA0"], // _
50
+ [0x4c, "\u2028"], // L
51
+ [0x50, "\u2029"], // P
52
+ ]);
53
+ /**
54
+ * Converts a hexadecimal character code to its decimal value.
55
+ */
56
+ function hexCharCodeToNumber(charCode) {
57
+ // Check if the character code is in the range for '0' to '9'
58
+ if (0x30 <= charCode && charCode <= 0x39)
59
+ return charCode - 0x30; // Convert '0'-'9' to 0-9
60
+ // Normalize the character code to lowercase if it's a letter
61
+ const lc = charCode | 0x20;
62
+ // Check if the character code is in the range for 'a' to 'f'
63
+ if (0x61 <= lc && lc <= 0x66)
64
+ return lc - 0x61 + 10; // Convert 'a'-'f' to 10-15
65
+ return -1;
66
+ }
67
+ /**
68
+ * Converts a decimal character code to its decimal value.
69
+ */
70
+ function decimalCharCodeToNumber(charCode) {
71
+ // Check if the character code is in the range for '0' to '9'
72
+ if (0x30 <= charCode && charCode <= 0x39)
73
+ return charCode - 0x30; // Convert '0'-'9' to 0-9
74
+ return -1;
75
+ }
76
+ /**
77
+ * Converts a Unicode code point to a string.
78
+ */
79
+ function codepointToChar(codepoint) {
80
+ // Check if the code point is within the Basic Multilingual Plane (BMP)
81
+ if (codepoint <= 0xffff)
82
+ return String.fromCharCode(codepoint); // Convert BMP code point to character
83
+ // Encode UTF-16 surrogate pair for code points beyond BMP
84
+ // Reference: https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
85
+ return String.fromCharCode(((codepoint - 0x010000) >> 10) + 0xd800, // High surrogate
86
+ ((codepoint - 0x010000) & 0x03ff) + 0xdc00);
87
+ }
88
+ const INDENT = 4;
89
+ const MAX_LENGTH = 75;
90
+ const DELIMITERS = "\x00\r\n\x85\u2028\u2029";
91
+ function getSnippet(buffer, position) {
92
+ if (!buffer)
93
+ return null;
94
+ let start = position;
95
+ let end = position;
96
+ let head = "";
97
+ let tail = "";
98
+ while (start > 0 && !DELIMITERS.includes(buffer.charAt(start - 1))) {
99
+ start--;
100
+ if (position - start > MAX_LENGTH / 2 - 1) {
101
+ head = " ... ";
102
+ start += 5;
103
+ break;
104
+ }
105
+ }
106
+ while (end < buffer.length && !DELIMITERS.includes(buffer.charAt(end))) {
107
+ end++;
108
+ if (end - position > MAX_LENGTH / 2 - 1) {
109
+ tail = " ... ";
110
+ end -= 5;
111
+ break;
112
+ }
113
+ }
114
+ const snippet = buffer.slice(start, end);
115
+ const indent = " ".repeat(INDENT);
116
+ const caretIndent = " ".repeat(INDENT + position - start + head.length);
117
+ return `${indent + head + snippet + tail}\n${caretIndent}^`;
118
+ }
119
+ function markToString(buffer, position, line, column) {
120
+ let where = `at line ${line + 1}, column ${column + 1}`;
121
+ const snippet = getSnippet(buffer, position);
122
+ if (snippet)
123
+ where += `:\n${snippet}`;
124
+ return where;
125
+ }
126
+ function getIndentStatus(lineIndent, parentIndent) {
127
+ if (lineIndent > parentIndent)
128
+ return 1;
129
+ if (lineIndent < parentIndent)
130
+ return -1;
131
+ return 0;
132
+ }
133
+ function writeFoldedLines(count) {
134
+ if (count === 1)
135
+ return " ";
136
+ if (count > 1)
137
+ return "\n".repeat(count - 1);
138
+ return "";
139
+ }
140
+ export class LoaderState {
141
+ constructor(input, { schema = DEFAULT_SCHEMA, onWarning, allowDuplicateKeys = false, }) {
142
+ _LoaderState_instances.add(this);
143
+ Object.defineProperty(this, "input", {
144
+ enumerable: true,
145
+ configurable: true,
146
+ writable: true,
147
+ value: void 0
148
+ });
149
+ Object.defineProperty(this, "length", {
150
+ enumerable: true,
151
+ configurable: true,
152
+ writable: true,
153
+ value: void 0
154
+ });
155
+ Object.defineProperty(this, "lineIndent", {
156
+ enumerable: true,
157
+ configurable: true,
158
+ writable: true,
159
+ value: 0
160
+ });
161
+ Object.defineProperty(this, "lineStart", {
162
+ enumerable: true,
163
+ configurable: true,
164
+ writable: true,
165
+ value: 0
166
+ });
167
+ Object.defineProperty(this, "position", {
168
+ enumerable: true,
169
+ configurable: true,
170
+ writable: true,
171
+ value: 0
172
+ });
173
+ Object.defineProperty(this, "line", {
174
+ enumerable: true,
175
+ configurable: true,
176
+ writable: true,
177
+ value: 0
178
+ });
179
+ Object.defineProperty(this, "onWarning", {
180
+ enumerable: true,
181
+ configurable: true,
182
+ writable: true,
183
+ value: void 0
184
+ });
185
+ Object.defineProperty(this, "allowDuplicateKeys", {
186
+ enumerable: true,
187
+ configurable: true,
188
+ writable: true,
189
+ value: void 0
190
+ });
191
+ Object.defineProperty(this, "implicitTypes", {
192
+ enumerable: true,
193
+ configurable: true,
194
+ writable: true,
195
+ value: void 0
196
+ });
197
+ Object.defineProperty(this, "typeMap", {
198
+ enumerable: true,
199
+ configurable: true,
200
+ writable: true,
201
+ value: void 0
202
+ });
203
+ Object.defineProperty(this, "checkLineBreaks", {
204
+ enumerable: true,
205
+ configurable: true,
206
+ writable: true,
207
+ value: false
208
+ });
209
+ Object.defineProperty(this, "tagMap", {
210
+ enumerable: true,
211
+ configurable: true,
212
+ writable: true,
213
+ value: new Map()
214
+ });
215
+ Object.defineProperty(this, "anchorMap", {
216
+ enumerable: true,
217
+ configurable: true,
218
+ writable: true,
219
+ value: new Map()
220
+ });
221
+ this.input = input;
222
+ this.onWarning = onWarning;
223
+ this.allowDuplicateKeys = allowDuplicateKeys;
224
+ this.implicitTypes = schema.implicitTypes;
225
+ this.typeMap = schema.typeMap;
226
+ this.length = input.length;
227
+ this.readIndent();
228
+ }
229
+ skipWhitespaces() {
230
+ let ch = this.peek();
231
+ while (isWhiteSpace(ch)) {
232
+ ch = this.next();
233
+ }
234
+ }
235
+ skipComment() {
236
+ let ch = this.peek();
237
+ if (ch !== SHARP)
238
+ return;
239
+ ch = this.next();
240
+ while (ch !== 0 && !isEOL(ch)) {
241
+ ch = this.next();
242
+ }
243
+ }
244
+ readIndent() {
245
+ let char = this.peek();
246
+ while (char === SPACE) {
247
+ this.lineIndent += 1;
248
+ char = this.next();
249
+ }
250
+ }
251
+ peek(offset = 0) {
252
+ return this.input.charCodeAt(this.position + offset);
253
+ }
254
+ next() {
255
+ this.position += 1;
256
+ return this.peek();
257
+ }
258
+ dispatchWarning(message) {
259
+ const error = __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, message);
260
+ this.onWarning?.(error);
261
+ }
262
+ yamlDirectiveHandler(args) {
263
+ if (args.length !== 1) {
264
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot handle YAML directive: YAML directive accepts exactly one argument");
265
+ }
266
+ const match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
267
+ if (match === null) {
268
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot handle YAML directive: ill-formed argument");
269
+ }
270
+ const major = parseInt(match[1], 10);
271
+ const minor = parseInt(match[2], 10);
272
+ if (major !== 1) {
273
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot handle YAML directive: unacceptable YAML version");
274
+ }
275
+ this.checkLineBreaks = minor < 2;
276
+ if (minor !== 1 && minor !== 2) {
277
+ this.dispatchWarning("Cannot handle YAML directive: unsupported YAML version");
278
+ }
279
+ return args[0] ?? null;
280
+ }
281
+ tagDirectiveHandler(args) {
282
+ if (args.length !== 2) {
283
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot handle tag directive: directive accepts exactly two arguments, received ${args.length}`);
284
+ }
285
+ const handle = args[0];
286
+ const prefix = args[1];
287
+ if (!PATTERN_TAG_HANDLE.test(handle)) {
288
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot handle tag directive: ill-formed handle (first argument) in "${handle}"`);
289
+ }
290
+ if (this.tagMap.has(handle)) {
291
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot handle tag directive: previously declared suffix for "${handle}" tag handle`);
292
+ }
293
+ if (!PATTERN_TAG_URI.test(prefix)) {
294
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot handle tag directive: ill-formed tag prefix (second argument) of the TAG directive");
295
+ }
296
+ this.tagMap.set(handle, prefix);
297
+ }
298
+ captureSegment(start, end, checkJson) {
299
+ if (start < end) {
300
+ const result = this.input.slice(start, end);
301
+ if (checkJson) {
302
+ for (let position = 0; position < result.length; position++) {
303
+ const character = result.charCodeAt(position);
304
+ if (!(character === 0x09 ||
305
+ (0x20 <= character && character <= 0x10ffff))) {
306
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Expected valid JSON character: received "${character}"`);
307
+ }
308
+ }
309
+ }
310
+ else if (PATTERN_NON_PRINTABLE.test(result)) {
311
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Stream contains non-printable characters");
312
+ }
313
+ return result;
314
+ }
315
+ }
316
+ readBlockSequence(tag, anchor, nodeIndent) {
317
+ let detected = false;
318
+ const result = [];
319
+ if (anchor !== null)
320
+ this.anchorMap.set(anchor, result);
321
+ let ch = this.peek();
322
+ while (ch !== 0) {
323
+ if (ch !== MINUS) {
324
+ break;
325
+ }
326
+ const following = this.peek(1);
327
+ if (!isWhiteSpaceOrEOL(following)) {
328
+ break;
329
+ }
330
+ detected = true;
331
+ this.position++;
332
+ if (this.skipSeparationSpace(true, -1)) {
333
+ if (this.lineIndent <= nodeIndent) {
334
+ result.push(null);
335
+ ch = this.peek();
336
+ continue;
337
+ }
338
+ }
339
+ const line = this.line;
340
+ const newState = this.composeNode({
341
+ parentIndent: nodeIndent,
342
+ nodeContext: CONTEXT_BLOCK_IN,
343
+ allowToSeek: false,
344
+ allowCompact: true,
345
+ });
346
+ if (newState)
347
+ result.push(newState.result);
348
+ this.skipSeparationSpace(true, -1);
349
+ ch = this.peek();
350
+ if ((this.line === line || this.lineIndent > nodeIndent) && ch !== 0) {
351
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read block sequence: bad indentation of a sequence entry");
352
+ }
353
+ else if (this.lineIndent < nodeIndent) {
354
+ break;
355
+ }
356
+ }
357
+ if (detected)
358
+ return { tag, anchor, kind: "sequence", result };
359
+ }
360
+ mergeMappings(destination, source, overridableKeys) {
361
+ if (!isObject(source)) {
362
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot merge mappings: the provided source object is unacceptable");
363
+ }
364
+ for (const [key, value] of Object.entries(source)) {
365
+ if (Object.hasOwn(destination, key))
366
+ continue;
367
+ Object.defineProperty(destination, key, {
368
+ value,
369
+ writable: true,
370
+ enumerable: true,
371
+ configurable: true,
372
+ });
373
+ overridableKeys.add(key);
374
+ }
375
+ }
376
+ storeMappingPair(result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
377
+ // The output is a plain object here, so keys can only be strings.
378
+ // We need to convert keyNode to a string, but doing so can hang the process
379
+ // (deeply nested arrays that explode exponentially using aliases).
380
+ if (Array.isArray(keyNode)) {
381
+ keyNode = Array.prototype.slice.call(keyNode);
382
+ for (let index = 0; index < keyNode.length; index++) {
383
+ if (Array.isArray(keyNode[index])) {
384
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot store mapping pair: nested arrays are not supported inside keys");
385
+ }
386
+ if (typeof keyNode === "object" && isPlainObject(keyNode[index])) {
387
+ keyNode[index] = "[object Object]";
388
+ }
389
+ }
390
+ }
391
+ // Avoid code execution in load() via toString property
392
+ // (still use its own toString for arrays, timestamps,
393
+ // and whatever user schema extensions happen to have @@toStringTag)
394
+ if (typeof keyNode === "object" && isPlainObject(keyNode)) {
395
+ keyNode = "[object Object]";
396
+ }
397
+ keyNode = String(keyNode);
398
+ if (keyTag === "tag:yaml.org,2002:merge") {
399
+ if (Array.isArray(valueNode)) {
400
+ for (let index = 0; index < valueNode.length; index++) {
401
+ this.mergeMappings(result, valueNode[index], overridableKeys);
402
+ }
403
+ }
404
+ else {
405
+ this.mergeMappings(result, valueNode, overridableKeys);
406
+ }
407
+ }
408
+ else {
409
+ if (!this.allowDuplicateKeys &&
410
+ !overridableKeys.has(keyNode) &&
411
+ Object.hasOwn(result, keyNode)) {
412
+ this.line = startLine || this.line;
413
+ this.position = startPos || this.position;
414
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot store mapping pair: duplicated key");
415
+ }
416
+ Object.defineProperty(result, keyNode, {
417
+ value: valueNode,
418
+ writable: true,
419
+ enumerable: true,
420
+ configurable: true,
421
+ });
422
+ overridableKeys.delete(keyNode);
423
+ }
424
+ return result;
425
+ }
426
+ readLineBreak() {
427
+ const ch = this.peek();
428
+ if (ch === LINE_FEED) {
429
+ this.position++;
430
+ }
431
+ else if (ch === CARRIAGE_RETURN) {
432
+ this.position++;
433
+ if (this.peek() === LINE_FEED) {
434
+ this.position++;
435
+ }
436
+ }
437
+ else {
438
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read line: line break not found");
439
+ }
440
+ this.line += 1;
441
+ this.lineStart = this.position;
442
+ }
443
+ skipSeparationSpace(allowComments, checkIndent) {
444
+ let lineBreaks = 0;
445
+ let ch = this.peek();
446
+ while (ch !== 0) {
447
+ this.skipWhitespaces();
448
+ ch = this.peek();
449
+ if (allowComments) {
450
+ this.skipComment();
451
+ ch = this.peek();
452
+ }
453
+ if (isEOL(ch)) {
454
+ this.readLineBreak();
455
+ ch = this.peek();
456
+ lineBreaks++;
457
+ this.lineIndent = 0;
458
+ this.readIndent();
459
+ ch = this.peek();
460
+ }
461
+ else {
462
+ break;
463
+ }
464
+ }
465
+ if (checkIndent !== -1 &&
466
+ lineBreaks !== 0 &&
467
+ this.lineIndent < checkIndent) {
468
+ this.dispatchWarning("deficient indentation");
469
+ }
470
+ return lineBreaks;
471
+ }
472
+ testDocumentSeparator() {
473
+ let ch = this.peek();
474
+ // Condition this.position === this.lineStart is tested
475
+ // in parent on each call, for efficiency. No needs to test here again.
476
+ if ((ch === MINUS || ch === DOT) &&
477
+ ch === this.peek(1) &&
478
+ ch === this.peek(2)) {
479
+ ch = this.peek(3);
480
+ if (ch === 0 || isWhiteSpaceOrEOL(ch)) {
481
+ return true;
482
+ }
483
+ }
484
+ return false;
485
+ }
486
+ readPlainScalar(tag, anchor, nodeIndent, withinFlowCollection) {
487
+ let ch = this.peek();
488
+ if (isWhiteSpaceOrEOL(ch) ||
489
+ isFlowIndicator(ch) ||
490
+ ch === SHARP ||
491
+ ch === AMPERSAND ||
492
+ ch === ASTERISK ||
493
+ ch === EXCLAMATION ||
494
+ ch === VERTICAL_LINE ||
495
+ ch === GREATER_THAN ||
496
+ ch === SINGLE_QUOTE ||
497
+ ch === DOUBLE_QUOTE ||
498
+ ch === PERCENT ||
499
+ ch === COMMERCIAL_AT ||
500
+ ch === GRAVE_ACCENT) {
501
+ return;
502
+ }
503
+ let following;
504
+ if (ch === QUESTION || ch === MINUS) {
505
+ following = this.peek(1);
506
+ if (isWhiteSpaceOrEOL(following) ||
507
+ (withinFlowCollection && isFlowIndicator(following))) {
508
+ return;
509
+ }
510
+ }
511
+ let result = "";
512
+ let captureEnd = this.position;
513
+ let captureStart = this.position;
514
+ let hasPendingContent = false;
515
+ let line = 0;
516
+ while (ch !== 0) {
517
+ if (ch === COLON) {
518
+ following = this.peek(1);
519
+ if (isWhiteSpaceOrEOL(following) ||
520
+ (withinFlowCollection && isFlowIndicator(following))) {
521
+ break;
522
+ }
523
+ }
524
+ else if (ch === SHARP) {
525
+ const preceding = this.peek(-1);
526
+ if (isWhiteSpaceOrEOL(preceding)) {
527
+ break;
528
+ }
529
+ }
530
+ else if ((this.position === this.lineStart && this.testDocumentSeparator()) ||
531
+ (withinFlowCollection && isFlowIndicator(ch))) {
532
+ break;
533
+ }
534
+ else if (isEOL(ch)) {
535
+ line = this.line;
536
+ const lineStart = this.lineStart;
537
+ const lineIndent = this.lineIndent;
538
+ this.skipSeparationSpace(false, -1);
539
+ if (this.lineIndent >= nodeIndent) {
540
+ hasPendingContent = true;
541
+ ch = this.peek();
542
+ continue;
543
+ }
544
+ else {
545
+ this.position = captureEnd;
546
+ this.line = line;
547
+ this.lineStart = lineStart;
548
+ this.lineIndent = lineIndent;
549
+ break;
550
+ }
551
+ }
552
+ if (hasPendingContent) {
553
+ const segment = this.captureSegment(captureStart, captureEnd, false);
554
+ if (segment)
555
+ result += segment;
556
+ result += writeFoldedLines(this.line - line);
557
+ captureStart = captureEnd = this.position;
558
+ hasPendingContent = false;
559
+ }
560
+ if (!isWhiteSpace(ch)) {
561
+ captureEnd = this.position + 1;
562
+ }
563
+ ch = this.next();
564
+ }
565
+ const segment = this.captureSegment(captureStart, captureEnd, false);
566
+ if (segment)
567
+ result += segment;
568
+ if (anchor !== null)
569
+ this.anchorMap.set(anchor, result);
570
+ if (result)
571
+ return { tag, anchor, kind: "scalar", result };
572
+ }
573
+ readSingleQuotedScalar(tag, anchor, nodeIndent) {
574
+ let ch = this.peek();
575
+ if (ch !== SINGLE_QUOTE)
576
+ return;
577
+ let result = "";
578
+ this.position++;
579
+ let captureStart = this.position;
580
+ let captureEnd = this.position;
581
+ ch = this.peek();
582
+ while (ch !== 0) {
583
+ if (ch === SINGLE_QUOTE) {
584
+ const segment = this.captureSegment(captureStart, this.position, true);
585
+ if (segment)
586
+ result += segment;
587
+ ch = this.next();
588
+ if (ch === SINGLE_QUOTE) {
589
+ captureStart = this.position;
590
+ this.position++;
591
+ captureEnd = this.position;
592
+ }
593
+ else {
594
+ if (anchor !== null)
595
+ this.anchorMap.set(anchor, result);
596
+ return { tag, anchor, kind: "scalar", result };
597
+ }
598
+ }
599
+ else if (isEOL(ch)) {
600
+ const segment = this.captureSegment(captureStart, captureEnd, true);
601
+ if (segment)
602
+ result += segment;
603
+ result += writeFoldedLines(this.skipSeparationSpace(false, nodeIndent));
604
+ captureStart = captureEnd = this.position;
605
+ }
606
+ else if (this.position === this.lineStart &&
607
+ this.testDocumentSeparator()) {
608
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Unexpected end of the document within a single quoted scalar");
609
+ }
610
+ else {
611
+ this.position++;
612
+ captureEnd = this.position;
613
+ }
614
+ ch = this.peek();
615
+ }
616
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Unexpected end of the stream within a single quoted scalar");
617
+ }
618
+ readDoubleQuotedScalar(tag, anchor, nodeIndent) {
619
+ let ch = this.peek();
620
+ if (ch !== DOUBLE_QUOTE)
621
+ return;
622
+ let result = "";
623
+ this.position++;
624
+ let captureEnd = this.position;
625
+ let captureStart = this.position;
626
+ let tmp;
627
+ ch = this.peek();
628
+ while (ch !== 0) {
629
+ if (ch === DOUBLE_QUOTE) {
630
+ const segment = this.captureSegment(captureStart, this.position, true);
631
+ if (segment)
632
+ result += segment;
633
+ this.position++;
634
+ if (anchor !== null)
635
+ this.anchorMap.set(anchor, result);
636
+ return { tag, anchor, kind: "scalar", result };
637
+ }
638
+ if (ch === BACKSLASH) {
639
+ const segment = this.captureSegment(captureStart, this.position, true);
640
+ if (segment)
641
+ result += segment;
642
+ ch = this.next();
643
+ if (isEOL(ch)) {
644
+ this.skipSeparationSpace(false, nodeIndent);
645
+ }
646
+ else if (ch < 256 && SIMPLE_ESCAPE_SEQUENCES.has(ch)) {
647
+ result += SIMPLE_ESCAPE_SEQUENCES.get(ch);
648
+ this.position++;
649
+ }
650
+ else if ((tmp = ESCAPED_HEX_LENGTHS.get(ch) ?? 0) > 0) {
651
+ let hexLength = tmp;
652
+ let hexResult = 0;
653
+ for (; hexLength > 0; hexLength--) {
654
+ ch = this.next();
655
+ if ((tmp = hexCharCodeToNumber(ch)) >= 0) {
656
+ hexResult = (hexResult << 4) + tmp;
657
+ }
658
+ else {
659
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read double quoted scalar: expected hexadecimal character");
660
+ }
661
+ }
662
+ result += codepointToChar(hexResult);
663
+ this.position++;
664
+ }
665
+ else {
666
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read double quoted scalar: unknown escape sequence");
667
+ }
668
+ captureStart = captureEnd = this.position;
669
+ }
670
+ else if (isEOL(ch)) {
671
+ const segment = this.captureSegment(captureStart, captureEnd, true);
672
+ if (segment)
673
+ result += segment;
674
+ result += writeFoldedLines(this.skipSeparationSpace(false, nodeIndent));
675
+ captureStart = captureEnd = this.position;
676
+ }
677
+ else if (this.position === this.lineStart &&
678
+ this.testDocumentSeparator()) {
679
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Unexpected end of the document within a double quoted scalar");
680
+ }
681
+ else {
682
+ this.position++;
683
+ captureEnd = this.position;
684
+ }
685
+ ch = this.peek();
686
+ }
687
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Unexpected end of the stream within a double quoted scalar");
688
+ }
689
+ readFlowCollection(tag, anchor, nodeIndent) {
690
+ let ch = this.peek();
691
+ let terminator;
692
+ let isMapping = true;
693
+ let result = {};
694
+ if (ch === LEFT_SQUARE_BRACKET) {
695
+ terminator = RIGHT_SQUARE_BRACKET;
696
+ isMapping = false;
697
+ result = [];
698
+ }
699
+ else if (ch === LEFT_CURLY_BRACKET) {
700
+ terminator = RIGHT_CURLY_BRACKET;
701
+ }
702
+ else {
703
+ return;
704
+ }
705
+ if (anchor !== null)
706
+ this.anchorMap.set(anchor, result);
707
+ ch = this.next();
708
+ let readNext = true;
709
+ let valueNode = null;
710
+ let keyNode = null;
711
+ let keyTag = null;
712
+ let isExplicitPair = false;
713
+ let isPair = false;
714
+ let following = 0;
715
+ let line = 0;
716
+ const overridableKeys = new Set();
717
+ while (ch !== 0) {
718
+ this.skipSeparationSpace(true, nodeIndent);
719
+ ch = this.peek();
720
+ if (ch === terminator) {
721
+ this.position++;
722
+ const kind = isMapping ? "mapping" : "sequence";
723
+ return { tag, anchor, kind, result };
724
+ }
725
+ if (!readNext) {
726
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read flow collection: missing comma between flow collection entries");
727
+ }
728
+ keyTag = keyNode = valueNode = null;
729
+ isPair = isExplicitPair = false;
730
+ if (ch === QUESTION) {
731
+ following = this.peek(1);
732
+ if (isWhiteSpaceOrEOL(following)) {
733
+ isPair = isExplicitPair = true;
734
+ this.position++;
735
+ this.skipSeparationSpace(true, nodeIndent);
736
+ }
737
+ }
738
+ line = this.line;
739
+ const newState = this.composeNode({
740
+ parentIndent: nodeIndent,
741
+ nodeContext: CONTEXT_FLOW_IN,
742
+ allowToSeek: false,
743
+ allowCompact: true,
744
+ });
745
+ if (newState) {
746
+ keyTag = newState.tag || null;
747
+ keyNode = newState.result;
748
+ }
749
+ this.skipSeparationSpace(true, nodeIndent);
750
+ ch = this.peek();
751
+ if ((isExplicitPair || this.line === line) && ch === COLON) {
752
+ isPair = true;
753
+ ch = this.next();
754
+ this.skipSeparationSpace(true, nodeIndent);
755
+ const newState = this.composeNode({
756
+ parentIndent: nodeIndent,
757
+ nodeContext: CONTEXT_FLOW_IN,
758
+ allowToSeek: false,
759
+ allowCompact: true,
760
+ });
761
+ if (newState)
762
+ valueNode = newState.result;
763
+ }
764
+ if (isMapping) {
765
+ this.storeMappingPair(result, overridableKeys, keyTag, keyNode, valueNode);
766
+ }
767
+ else if (isPair) {
768
+ result.push(this.storeMappingPair({}, overridableKeys, keyTag, keyNode, valueNode));
769
+ }
770
+ else {
771
+ result.push(keyNode);
772
+ }
773
+ this.skipSeparationSpace(true, nodeIndent);
774
+ ch = this.peek();
775
+ if (ch === COMMA) {
776
+ readNext = true;
777
+ ch = this.next();
778
+ }
779
+ else {
780
+ readNext = false;
781
+ }
782
+ }
783
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read flow collection: unexpected end of the stream within a flow collection");
784
+ }
785
+ // Handles block scaler styles: e.g. '|', '>', '|-' and '>-'.
786
+ // https://yaml.org/spec/1.2.2/#81-block-scalar-styles
787
+ readBlockScalar(tag, anchor, nodeIndent) {
788
+ let chomping = CHOMPING_CLIP;
789
+ let didReadContent = false;
790
+ let detectedIndent = false;
791
+ let textIndent = nodeIndent;
792
+ let emptyLines = 0;
793
+ let atMoreIndented = false;
794
+ let ch = this.peek();
795
+ let folding = false;
796
+ if (ch === VERTICAL_LINE) {
797
+ folding = false;
798
+ }
799
+ else if (ch === GREATER_THAN) {
800
+ folding = true;
801
+ }
802
+ else {
803
+ return;
804
+ }
805
+ let result = "";
806
+ let tmp = 0;
807
+ while (ch !== 0) {
808
+ ch = this.next();
809
+ if (ch === PLUS || ch === MINUS) {
810
+ if (CHOMPING_CLIP === chomping) {
811
+ chomping = ch === PLUS ? CHOMPING_KEEP : CHOMPING_STRIP;
812
+ }
813
+ else {
814
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read block: chomping mode identifier repeated");
815
+ }
816
+ }
817
+ else if ((tmp = decimalCharCodeToNumber(ch)) >= 0) {
818
+ if (tmp === 0) {
819
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read block: indentation width must be greater than 0");
820
+ }
821
+ else if (!detectedIndent) {
822
+ textIndent = nodeIndent + tmp - 1;
823
+ detectedIndent = true;
824
+ }
825
+ else {
826
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read block: indentation width identifier repeated");
827
+ }
828
+ }
829
+ else {
830
+ break;
831
+ }
832
+ }
833
+ if (isWhiteSpace(ch)) {
834
+ this.skipWhitespaces();
835
+ this.skipComment();
836
+ ch = this.peek();
837
+ }
838
+ while (ch !== 0) {
839
+ this.readLineBreak();
840
+ this.lineIndent = 0;
841
+ ch = this.peek();
842
+ while ((!detectedIndent || this.lineIndent < textIndent) &&
843
+ ch === SPACE) {
844
+ this.lineIndent++;
845
+ ch = this.next();
846
+ }
847
+ if (!detectedIndent && this.lineIndent > textIndent) {
848
+ textIndent = this.lineIndent;
849
+ }
850
+ if (isEOL(ch)) {
851
+ emptyLines++;
852
+ continue;
853
+ }
854
+ // End of the scalar.
855
+ if (this.lineIndent < textIndent) {
856
+ // Perform the chomping.
857
+ if (chomping === CHOMPING_KEEP) {
858
+ result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
859
+ }
860
+ else if (chomping === CHOMPING_CLIP) {
861
+ if (didReadContent) {
862
+ // i.e. only if the scalar is not empty.
863
+ result += "\n";
864
+ }
865
+ }
866
+ // Break this `while` cycle and go to the function's epilogue.
867
+ break;
868
+ }
869
+ // Folded style: use fancy rules to handle line breaks.
870
+ if (folding) {
871
+ // Lines starting with white space characters (more-indented lines) are not folded.
872
+ if (isWhiteSpace(ch)) {
873
+ atMoreIndented = true;
874
+ // except for the first content line (cf. Example 8.1)
875
+ result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
876
+ // End of more-indented block.
877
+ }
878
+ else if (atMoreIndented) {
879
+ atMoreIndented = false;
880
+ result += "\n".repeat(emptyLines + 1);
881
+ // Just one line break - perceive as the same line.
882
+ }
883
+ else if (emptyLines === 0) {
884
+ if (didReadContent) {
885
+ // i.e. only if we have already read some scalar content.
886
+ result += " ";
887
+ }
888
+ // Several line breaks - perceive as different lines.
889
+ }
890
+ else {
891
+ result += "\n".repeat(emptyLines);
892
+ }
893
+ // Literal style: just add exact number of line breaks between content lines.
894
+ }
895
+ else {
896
+ // Keep all line breaks except the header line break.
897
+ result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
898
+ }
899
+ didReadContent = true;
900
+ detectedIndent = true;
901
+ emptyLines = 0;
902
+ const captureStart = this.position;
903
+ while (!isEOL(ch) && ch !== 0) {
904
+ ch = this.next();
905
+ }
906
+ const segment = this.captureSegment(captureStart, this.position, false);
907
+ if (segment)
908
+ result += segment;
909
+ }
910
+ if (anchor !== null)
911
+ this.anchorMap.set(anchor, result);
912
+ return { tag, anchor, kind: "scalar", result };
913
+ }
914
+ readBlockMapping(tag, anchor, nodeIndent, flowIndent) {
915
+ const result = {};
916
+ const overridableKeys = new Set();
917
+ let allowCompact = false;
918
+ let line;
919
+ let pos;
920
+ let keyTag = null;
921
+ let keyNode = null;
922
+ let valueNode = null;
923
+ let atExplicitKey = false;
924
+ let detected = false;
925
+ if (anchor !== null)
926
+ this.anchorMap.set(anchor, result);
927
+ let ch = this.peek();
928
+ while (ch !== 0) {
929
+ const following = this.peek(1);
930
+ line = this.line; // Save the current line.
931
+ pos = this.position;
932
+ //
933
+ // Explicit notation case. There are two separate blocks:
934
+ // first for the key (denoted by "?") and second for the value (denoted by ":")
935
+ //
936
+ if ((ch === QUESTION || ch === COLON) && isWhiteSpaceOrEOL(following)) {
937
+ if (ch === QUESTION) {
938
+ if (atExplicitKey) {
939
+ this.storeMappingPair(result, overridableKeys, keyTag, keyNode, null);
940
+ keyTag = null;
941
+ keyNode = null;
942
+ valueNode = null;
943
+ }
944
+ detected = true;
945
+ atExplicitKey = true;
946
+ allowCompact = true;
947
+ }
948
+ else if (atExplicitKey) {
949
+ // i.e. 0x3A/* : */ === character after the explicit key.
950
+ atExplicitKey = false;
951
+ allowCompact = true;
952
+ }
953
+ else {
954
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read block as explicit mapping pair is incomplete: a key node is missed or followed by a non-tabulated empty line");
955
+ }
956
+ this.position += 1;
957
+ ch = following;
958
+ //
959
+ // Implicit notation case. Flow-style node as the key first, then ":", and the value.
960
+ //
961
+ }
962
+ else {
963
+ const newState = this.composeNode({
964
+ parentIndent: flowIndent,
965
+ nodeContext: CONTEXT_FLOW_OUT,
966
+ allowToSeek: false,
967
+ allowCompact: true,
968
+ });
969
+ if (!newState)
970
+ break; // Reading is done. Go to the epilogue.
971
+ if (this.line === line) {
972
+ ch = this.peek();
973
+ this.skipWhitespaces();
974
+ ch = this.peek();
975
+ if (ch === COLON) {
976
+ ch = this.next();
977
+ if (!isWhiteSpaceOrEOL(ch)) {
978
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read block: a whitespace character is expected after the key-value separator within a block mapping");
979
+ }
980
+ if (atExplicitKey) {
981
+ this.storeMappingPair(result, overridableKeys, keyTag, keyNode, null);
982
+ keyTag = null;
983
+ keyNode = null;
984
+ valueNode = null;
985
+ }
986
+ detected = true;
987
+ atExplicitKey = false;
988
+ allowCompact = false;
989
+ keyTag = newState.tag;
990
+ keyNode = newState.result;
991
+ }
992
+ else if (detected) {
993
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read an implicit mapping pair: missing colon");
994
+ }
995
+ else {
996
+ const { kind, result } = newState;
997
+ return { tag, anchor, kind, result }; // Keep the result of `composeNode`.
998
+ }
999
+ }
1000
+ else if (detected) {
1001
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read a block mapping entry: a multiline key may not be an implicit key");
1002
+ }
1003
+ else {
1004
+ const { kind, result } = newState;
1005
+ return { tag, anchor, kind, result }; // Keep the result of `composeNode`.
1006
+ }
1007
+ }
1008
+ //
1009
+ // Common reading code for both explicit and implicit notations.
1010
+ //
1011
+ if (this.line === line || this.lineIndent > nodeIndent) {
1012
+ const newState = this.composeNode({
1013
+ parentIndent: nodeIndent,
1014
+ nodeContext: CONTEXT_BLOCK_OUT,
1015
+ allowToSeek: true,
1016
+ allowCompact,
1017
+ });
1018
+ if (newState) {
1019
+ if (atExplicitKey) {
1020
+ keyNode = newState.result;
1021
+ }
1022
+ else {
1023
+ valueNode = newState.result;
1024
+ }
1025
+ }
1026
+ if (!atExplicitKey) {
1027
+ this.storeMappingPair(result, overridableKeys, keyTag, keyNode, valueNode, line, pos);
1028
+ keyTag = keyNode = valueNode = null;
1029
+ }
1030
+ this.skipSeparationSpace(true, -1);
1031
+ ch = this.peek();
1032
+ }
1033
+ if (this.lineIndent > nodeIndent && ch !== 0) {
1034
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read block: bad indentation of a mapping entry");
1035
+ }
1036
+ else if (this.lineIndent < nodeIndent) {
1037
+ break;
1038
+ }
1039
+ }
1040
+ //
1041
+ // Epilogue.
1042
+ //
1043
+ // Special case: last mapping's node contains only the key in explicit notation.
1044
+ if (atExplicitKey) {
1045
+ this.storeMappingPair(result, overridableKeys, keyTag, keyNode, null);
1046
+ }
1047
+ // Expose the resulting mapping.
1048
+ if (detected)
1049
+ return { tag, anchor, kind: "mapping", result };
1050
+ }
1051
+ readTagProperty(tag) {
1052
+ let isVerbatim = false;
1053
+ let isNamed = false;
1054
+ let tagHandle = "";
1055
+ let tagName;
1056
+ let ch = this.peek();
1057
+ if (ch !== EXCLAMATION)
1058
+ return;
1059
+ if (tag !== null) {
1060
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read tag property: duplication of a tag property");
1061
+ }
1062
+ ch = this.next();
1063
+ if (ch === SMALLER_THAN) {
1064
+ isVerbatim = true;
1065
+ ch = this.next();
1066
+ }
1067
+ else if (ch === EXCLAMATION) {
1068
+ isNamed = true;
1069
+ tagHandle = "!!";
1070
+ ch = this.next();
1071
+ }
1072
+ else {
1073
+ tagHandle = "!";
1074
+ }
1075
+ let position = this.position;
1076
+ if (isVerbatim) {
1077
+ do {
1078
+ ch = this.next();
1079
+ } while (ch !== 0 && ch !== GREATER_THAN);
1080
+ if (this.position < this.length) {
1081
+ tagName = this.input.slice(position, this.position);
1082
+ ch = this.next();
1083
+ }
1084
+ else {
1085
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read tag property: unexpected end of stream");
1086
+ }
1087
+ }
1088
+ else {
1089
+ while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) {
1090
+ if (ch === EXCLAMATION) {
1091
+ if (!isNamed) {
1092
+ tagHandle = this.input.slice(position - 1, this.position + 1);
1093
+ if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
1094
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read tag property: named tag handle contains invalid characters");
1095
+ }
1096
+ isNamed = true;
1097
+ position = this.position + 1;
1098
+ }
1099
+ else {
1100
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read tag property: tag suffix cannot contain an exclamation mark");
1101
+ }
1102
+ }
1103
+ ch = this.next();
1104
+ }
1105
+ tagName = this.input.slice(position, this.position);
1106
+ if (PATTERN_FLOW_INDICATORS.test(tagName)) {
1107
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read tag property: tag suffix cannot contain flow indicator characters");
1108
+ }
1109
+ }
1110
+ if (tagName && !PATTERN_TAG_URI.test(tagName)) {
1111
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot read tag property: invalid characters in tag name "${tagName}"`);
1112
+ }
1113
+ if (isVerbatim) {
1114
+ return tagName;
1115
+ }
1116
+ else if (this.tagMap.has(tagHandle)) {
1117
+ return this.tagMap.get(tagHandle) + tagName;
1118
+ }
1119
+ else if (tagHandle === "!") {
1120
+ return `!${tagName}`;
1121
+ }
1122
+ else if (tagHandle === "!!") {
1123
+ return `tag:yaml.org,2002:${tagName}`;
1124
+ }
1125
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot read tag property: undeclared tag handle "${tagHandle}"`);
1126
+ }
1127
+ readAnchorProperty(anchor) {
1128
+ let ch = this.peek();
1129
+ if (ch !== AMPERSAND)
1130
+ return;
1131
+ if (anchor !== null) {
1132
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read anchor property: duplicate anchor property");
1133
+ }
1134
+ ch = this.next();
1135
+ const position = this.position;
1136
+ while (ch !== 0 && !isWhiteSpaceOrEOL(ch) && !isFlowIndicator(ch)) {
1137
+ ch = this.next();
1138
+ }
1139
+ if (this.position === position) {
1140
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read anchor property: name of an anchor node must contain at least one character");
1141
+ }
1142
+ return this.input.slice(position, this.position);
1143
+ }
1144
+ readAlias() {
1145
+ if (this.peek() !== ASTERISK)
1146
+ return;
1147
+ let ch = this.next();
1148
+ const position = this.position;
1149
+ while (ch !== 0 && !isWhiteSpaceOrEOL(ch) && !isFlowIndicator(ch)) {
1150
+ ch = this.next();
1151
+ }
1152
+ if (this.position === position) {
1153
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read alias: alias name must contain at least one character");
1154
+ }
1155
+ const alias = this.input.slice(position, this.position);
1156
+ if (!this.anchorMap.has(alias)) {
1157
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot read alias: unidentified alias "${alias}"`);
1158
+ }
1159
+ this.skipSeparationSpace(true, -1);
1160
+ return this.anchorMap.get(alias);
1161
+ }
1162
+ resolveTag(state) {
1163
+ switch (state.tag) {
1164
+ case null:
1165
+ case "!":
1166
+ return state;
1167
+ case "?": {
1168
+ for (const type of this.implicitTypes) {
1169
+ // Implicit resolving is not allowed for non-scalar types, and '?'
1170
+ // non-specific tag is only assigned to plain scalars. So, it isn't
1171
+ // needed to check for 'kind' conformity.
1172
+ if (!type.resolve(state.result))
1173
+ continue;
1174
+ // `state.result` updated in resolver if matched
1175
+ const result = type.construct(state.result);
1176
+ state.result = result;
1177
+ state.tag = type.tag;
1178
+ const { anchor } = state;
1179
+ if (anchor !== null)
1180
+ this.anchorMap.set(anchor, result);
1181
+ return state;
1182
+ }
1183
+ return state;
1184
+ }
1185
+ }
1186
+ const kind = state.kind ?? "fallback";
1187
+ const map = this.typeMap[kind];
1188
+ const type = map.get(state.tag);
1189
+ if (!type) {
1190
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot resolve unknown tag !<${state.tag}>`);
1191
+ }
1192
+ if (state.result !== null && type.kind !== state.kind) {
1193
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Unacceptable node kind for !<${state.tag}> tag: it should be "${type.kind}", not "${state.kind}"`);
1194
+ }
1195
+ if (!type.resolve(state.result)) {
1196
+ // `state.result` updated in resolver if matched
1197
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot resolve a node with !<${state.tag}> explicit tag`);
1198
+ }
1199
+ const result = type.construct(state.result);
1200
+ state.result = result;
1201
+ const { anchor } = state;
1202
+ if (anchor !== null)
1203
+ this.anchorMap.set(anchor, result);
1204
+ return state;
1205
+ }
1206
+ composeNode({ parentIndent, nodeContext, allowToSeek, allowCompact }) {
1207
+ let indentStatus = 1; // 1: this>parent, 0: this=parent, -1: this<parent
1208
+ let atNewLine = false;
1209
+ const allowBlockScalars = CONTEXT_BLOCK_OUT === nodeContext ||
1210
+ CONTEXT_BLOCK_IN === nodeContext;
1211
+ let allowBlockCollections = allowBlockScalars;
1212
+ const allowBlockStyles = allowBlockScalars;
1213
+ if (allowToSeek) {
1214
+ if (this.skipSeparationSpace(true, -1)) {
1215
+ atNewLine = true;
1216
+ indentStatus = getIndentStatus(this.lineIndent, parentIndent);
1217
+ }
1218
+ }
1219
+ let tag = null;
1220
+ let anchor = null;
1221
+ if (indentStatus === 1) {
1222
+ while (true) {
1223
+ const newTag = this.readTagProperty(tag);
1224
+ if (newTag) {
1225
+ tag = newTag;
1226
+ }
1227
+ else {
1228
+ const newAnchor = this.readAnchorProperty(anchor);
1229
+ if (!newAnchor)
1230
+ break;
1231
+ anchor = newAnchor;
1232
+ }
1233
+ if (this.skipSeparationSpace(true, -1)) {
1234
+ atNewLine = true;
1235
+ allowBlockCollections = allowBlockStyles;
1236
+ indentStatus = getIndentStatus(this.lineIndent, parentIndent);
1237
+ }
1238
+ else {
1239
+ allowBlockCollections = false;
1240
+ }
1241
+ }
1242
+ }
1243
+ if (allowBlockCollections) {
1244
+ allowBlockCollections = atNewLine || allowCompact;
1245
+ }
1246
+ if (indentStatus === 1) {
1247
+ const cond = CONTEXT_FLOW_IN === nodeContext ||
1248
+ CONTEXT_FLOW_OUT === nodeContext;
1249
+ const flowIndent = cond ? parentIndent : parentIndent + 1;
1250
+ if (allowBlockCollections) {
1251
+ const blockIndent = this.position - this.lineStart;
1252
+ const blockSequenceState = this.readBlockSequence(tag, anchor, blockIndent);
1253
+ if (blockSequenceState)
1254
+ return this.resolveTag(blockSequenceState);
1255
+ const blockMappingState = this.readBlockMapping(tag, anchor, blockIndent, flowIndent);
1256
+ if (blockMappingState)
1257
+ return this.resolveTag(blockMappingState);
1258
+ }
1259
+ const flowCollectionState = this.readFlowCollection(tag, anchor, flowIndent);
1260
+ if (flowCollectionState)
1261
+ return this.resolveTag(flowCollectionState);
1262
+ if (allowBlockScalars) {
1263
+ const blockScalarState = this.readBlockScalar(tag, anchor, flowIndent);
1264
+ if (blockScalarState)
1265
+ return this.resolveTag(blockScalarState);
1266
+ }
1267
+ const singleQuoteState = this.readSingleQuotedScalar(tag, anchor, flowIndent);
1268
+ if (singleQuoteState)
1269
+ return this.resolveTag(singleQuoteState);
1270
+ const doubleQuoteState = this.readDoubleQuotedScalar(tag, anchor, flowIndent);
1271
+ if (doubleQuoteState)
1272
+ return this.resolveTag(doubleQuoteState);
1273
+ const alias = this.readAlias();
1274
+ if (alias) {
1275
+ if (tag !== null || anchor !== null) {
1276
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot compose node: alias node should not have any properties");
1277
+ }
1278
+ return this.resolveTag({ tag, anchor, kind: null, result: alias });
1279
+ }
1280
+ const plainScalarState = this.readPlainScalar(tag, anchor, flowIndent, CONTEXT_FLOW_IN === nodeContext);
1281
+ if (plainScalarState) {
1282
+ plainScalarState.tag ??= "?";
1283
+ return this.resolveTag(plainScalarState);
1284
+ }
1285
+ }
1286
+ else if (indentStatus === 0 &&
1287
+ CONTEXT_BLOCK_OUT === nodeContext &&
1288
+ allowBlockCollections) {
1289
+ // Special case: block sequences are allowed to have same indentation level as the parent.
1290
+ // http://www.yaml.org/spec/1.2/spec.html#id2799784
1291
+ const blockIndent = this.position - this.lineStart;
1292
+ const newState = this.readBlockSequence(tag, anchor, blockIndent);
1293
+ if (newState)
1294
+ return this.resolveTag(newState);
1295
+ }
1296
+ const newState = this.resolveTag({ tag, anchor, kind: null, result: null });
1297
+ if (newState.tag !== null || newState.anchor !== null)
1298
+ return newState;
1299
+ }
1300
+ readDirectives() {
1301
+ let hasDirectives = false;
1302
+ let version = null;
1303
+ let ch = this.peek();
1304
+ while (ch !== 0) {
1305
+ this.skipSeparationSpace(true, -1);
1306
+ ch = this.peek();
1307
+ if (this.lineIndent > 0 || ch !== PERCENT) {
1308
+ break;
1309
+ }
1310
+ hasDirectives = true;
1311
+ ch = this.next();
1312
+ let position = this.position;
1313
+ while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) {
1314
+ ch = this.next();
1315
+ }
1316
+ const directiveName = this.input.slice(position, this.position);
1317
+ const directiveArgs = [];
1318
+ if (directiveName.length < 1) {
1319
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read document: directive name length must be greater than zero");
1320
+ }
1321
+ while (ch !== 0) {
1322
+ this.skipWhitespaces();
1323
+ this.skipComment();
1324
+ ch = this.peek();
1325
+ if (isEOL(ch))
1326
+ break;
1327
+ position = this.position;
1328
+ while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) {
1329
+ ch = this.next();
1330
+ }
1331
+ directiveArgs.push(this.input.slice(position, this.position));
1332
+ }
1333
+ if (ch !== 0)
1334
+ this.readLineBreak();
1335
+ switch (directiveName) {
1336
+ case "YAML":
1337
+ if (version !== null) {
1338
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot handle YAML directive: duplication of %YAML directive");
1339
+ }
1340
+ version = this.yamlDirectiveHandler(directiveArgs);
1341
+ break;
1342
+ case "TAG":
1343
+ this.tagDirectiveHandler(directiveArgs);
1344
+ break;
1345
+ default:
1346
+ this.dispatchWarning(`unknown document directive "${directiveName}"`);
1347
+ break;
1348
+ }
1349
+ ch = this.peek();
1350
+ }
1351
+ return hasDirectives;
1352
+ }
1353
+ readDocument() {
1354
+ const documentStart = this.position;
1355
+ this.checkLineBreaks = false;
1356
+ this.tagMap = new Map();
1357
+ this.anchorMap = new Map();
1358
+ const hasDirectives = this.readDirectives();
1359
+ this.skipSeparationSpace(true, -1);
1360
+ let result = null;
1361
+ if (this.lineIndent === 0 &&
1362
+ this.peek() === MINUS &&
1363
+ this.peek(1) === MINUS &&
1364
+ this.peek(2) === MINUS) {
1365
+ this.position += 3;
1366
+ this.skipSeparationSpace(true, -1);
1367
+ }
1368
+ else if (hasDirectives) {
1369
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read document: directives end mark is expected");
1370
+ }
1371
+ const newState = this.composeNode({
1372
+ parentIndent: this.lineIndent - 1,
1373
+ nodeContext: CONTEXT_BLOCK_OUT,
1374
+ allowToSeek: false,
1375
+ allowCompact: true,
1376
+ });
1377
+ if (newState)
1378
+ result = newState.result;
1379
+ this.skipSeparationSpace(true, -1);
1380
+ if (this.checkLineBreaks &&
1381
+ PATTERN_NON_ASCII_LINE_BREAKS.test(this.input.slice(documentStart, this.position))) {
1382
+ this.dispatchWarning("non-ASCII line breaks are interpreted as content");
1383
+ }
1384
+ if (this.position === this.lineStart && this.testDocumentSeparator()) {
1385
+ if (this.peek() === DOT) {
1386
+ this.position += 3;
1387
+ this.skipSeparationSpace(true, -1);
1388
+ }
1389
+ }
1390
+ else if (this.position < this.length - 1) {
1391
+ throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read document: end of the stream or a document separator is expected");
1392
+ }
1393
+ return result;
1394
+ }
1395
+ *readDocuments() {
1396
+ while (this.position < this.length - 1) {
1397
+ yield this.readDocument();
1398
+ }
1399
+ }
1400
+ }
1401
+ _LoaderState_instances = new WeakSet(), _LoaderState_createError = function _LoaderState_createError(message) {
1402
+ const mark = markToString(this.input, this.position, this.line, this.position - this.lineStart);
1403
+ return new SyntaxError(`${message} ${mark}`);
1404
+ };