@nfdi4plants/arctrl 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/ts/ts/CWL/CWLTypes.d.ts +162 -45
  2. package/dist/ts/ts/CWL/CWLTypes.d.ts.map +1 -1
  3. package/dist/ts/ts/CWL/CWLTypes.js +495 -104
  4. package/dist/ts/ts/CWL/Decode.d.ts +291 -48
  5. package/dist/ts/ts/CWL/Decode.d.ts.map +1 -1
  6. package/dist/ts/ts/CWL/Decode.js +911 -568
  7. package/dist/ts/ts/CWL/DynamicObjHelpers.d.ts +37 -0
  8. package/dist/ts/ts/CWL/DynamicObjHelpers.d.ts.map +1 -0
  9. package/dist/ts/ts/CWL/DynamicObjHelpers.js +57 -0
  10. package/dist/ts/ts/CWL/Encode.d.ts +117 -2
  11. package/dist/ts/ts/CWL/Encode.d.ts.map +1 -1
  12. package/dist/ts/ts/CWL/Encode.js +399 -163
  13. package/dist/ts/ts/CWL/ExpressionToolDescription.d.ts +2 -0
  14. package/dist/ts/ts/CWL/ExpressionToolDescription.d.ts.map +1 -1
  15. package/dist/ts/ts/CWL/ExpressionToolDescription.js +7 -0
  16. package/dist/ts/ts/CWL/Inputs.d.ts +65 -14
  17. package/dist/ts/ts/CWL/Inputs.d.ts.map +1 -1
  18. package/dist/ts/ts/CWL/Inputs.js +194 -51
  19. package/dist/ts/ts/CWL/OperationDescription.d.ts +2 -0
  20. package/dist/ts/ts/CWL/OperationDescription.d.ts.map +1 -1
  21. package/dist/ts/ts/CWL/OperationDescription.js +7 -0
  22. package/dist/ts/ts/CWL/Outputs.d.ts +51 -12
  23. package/dist/ts/ts/CWL/Outputs.d.ts.map +1 -1
  24. package/dist/ts/ts/CWL/Outputs.js +152 -76
  25. package/dist/ts/ts/CWL/ParameterReference.d.ts +4 -1
  26. package/dist/ts/ts/CWL/ParameterReference.d.ts.map +1 -1
  27. package/dist/ts/ts/CWL/ParameterReference.js +17 -6
  28. package/dist/ts/ts/CWL/Requirements.d.ts +140 -51
  29. package/dist/ts/ts/CWL/Requirements.d.ts.map +1 -1
  30. package/dist/ts/ts/CWL/Requirements.js +458 -128
  31. package/dist/ts/ts/CWL/ToolDescription.d.ts +27 -2
  32. package/dist/ts/ts/CWL/ToolDescription.d.ts.map +1 -1
  33. package/dist/ts/ts/CWL/ToolDescription.js +74 -4
  34. package/dist/ts/ts/CWL/WorkflowDescription.d.ts +2 -0
  35. package/dist/ts/ts/CWL/WorkflowDescription.d.ts.map +1 -1
  36. package/dist/ts/ts/CWL/WorkflowDescription.js +7 -0
  37. package/dist/ts/ts/CWL/WorkflowSteps.d.ts +50 -19
  38. package/dist/ts/ts/CWL/WorkflowSteps.d.ts.map +1 -1
  39. package/dist/ts/ts/CWL/WorkflowSteps.js +152 -23
  40. package/dist/ts/ts/ContractIO/ContractIO.d.ts.map +1 -1
  41. package/dist/ts/ts/ContractIO/ContractIO.js +4 -1
  42. package/dist/ts/ts/Conversion/Assay.d.ts.map +1 -1
  43. package/dist/ts/ts/Conversion/Assay.js +4 -3
  44. package/dist/ts/ts/Conversion/Investigation.js +2 -2
  45. package/dist/ts/ts/Conversion/Person.d.ts +1 -1
  46. package/dist/ts/ts/Conversion/Person.d.ts.map +1 -1
  47. package/dist/ts/ts/Conversion/Person.js +27 -11
  48. package/dist/ts/ts/Conversion/Run.d.ts.map +1 -1
  49. package/dist/ts/ts/Conversion/Run.js +3 -2
  50. package/dist/ts/ts/Conversion/ScholarlyArticle.d.ts.map +1 -1
  51. package/dist/ts/ts/Conversion/ScholarlyArticle.js +2 -1
  52. package/dist/ts/ts/Conversion/Study.d.ts.map +1 -1
  53. package/dist/ts/ts/Conversion/Study.js +5 -4
  54. package/dist/ts/ts/Conversion/Workflow.d.ts.map +1 -1
  55. package/dist/ts/ts/Conversion/Workflow.js +13 -12
  56. package/dist/ts/ts/Conversion.d.ts +14 -10
  57. package/dist/ts/ts/Conversion.d.ts.map +1 -1
  58. package/dist/ts/ts/Conversion.js +18 -11
  59. package/dist/ts/ts/Core/ArcTypes.d.ts.map +1 -1
  60. package/dist/ts/ts/Core/ArcTypes.js +18 -0
  61. package/dist/ts/ts/Json.d.ts +2 -2
  62. package/dist/ts/ts/Json.d.ts.map +1 -1
  63. package/dist/ts/ts/Json.js +3 -3
  64. package/dist/ts/ts/WorkflowGraph/ReferenceParsing.d.ts.map +1 -1
  65. package/dist/ts/ts/WorkflowGraph/ReferenceParsing.js +2 -1
  66. package/dist/ts/ts/Yaml/ValidationPackage.d.ts +1 -1
  67. package/dist/ts/ts/Yaml/ValidationPackage.d.ts.map +1 -1
  68. package/dist/ts/ts/Yaml/ValidationPackage.js +5 -5
  69. package/dist/ts/ts/Yaml/ValidationPackagesConfig.d.ts +1 -1
  70. package/dist/ts/ts/Yaml/ValidationPackagesConfig.d.ts.map +1 -1
  71. package/dist/ts/ts/Yaml/ValidationPackagesConfig.js +5 -5
  72. package/dist/ts/ts/Yaml.js +1 -1
  73. package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.7 → YAMLicious.1.0.0-alpha.11}/Decode.fs.js +5 -33
  74. package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.7 → YAMLicious.1.0.0-alpha.11}/Persil.fs.js +11 -159
  75. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.11/Preprocessing.fs.js +319 -0
  76. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.11/Reader.fs.js +1867 -0
  77. package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.7 → YAMLicious.1.0.0-alpha.11}/Regex.fs.js +1 -1
  78. package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.7 → YAMLicious.1.0.0-alpha.11}/RegexActivePatterns.fs.js +2 -2
  79. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.11/Syntax.fs.js +819 -0
  80. package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.7 → YAMLicious.1.0.0-alpha.11}/Writer.fs.js +75 -48
  81. package/package.json +1 -1
  82. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.7/FlowToBlock.fs.js +0 -956
  83. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.7/Preprocessing.fs.js +0 -181
  84. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.7/Reader.fs.js +0 -1493
  85. /package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.7 → YAMLicious.1.0.0-alpha.11}/Encode.fs.js +0 -0
  86. /package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.7 → YAMLicious.1.0.0-alpha.11}/Escapes.fs.js +0 -0
  87. /package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.7 → YAMLicious.1.0.0-alpha.11}/Interop/JsInterop.fs.js +0 -0
  88. /package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.7 → YAMLicious.1.0.0-alpha.11}/StringBuffer.fs.js +0 -0
  89. /package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.7 → YAMLicious.1.0.0-alpha.11}/YAMLiciousTypes.fs.js +0 -0
@@ -0,0 +1,1867 @@
1
+ import { unescapeDoubleQuoted } from './Escapes.fs.js';
2
+ import { PreprocessorElement_Line, ScalarStyle_DoubleQuoted, ScalarStyle_SingleQuoted, YAMLContent_create_Z1C3A29C9, YAMLContent, ScalarStyle_Plain, YAMLElement_Comment, YAMLElement_Nil, YAMLElement_Value, YAMLElement_Mapping, YAMLElement_Object, YAMLElement_Sequence, ScalarStyle_Block, YAMLElement_Alias } from './YAMLiciousTypes.fs.js';
3
+ import { match, create, replace } from '../../../node_modules/@fable-org/fable-library-js/RegExp.js';
4
+ import { parse } from '../../../node_modules/@fable-org/fable-library-js/Int32.js';
5
+ import { map, value, unwrap, bind } from '../../../node_modules/@fable-org/fable-library-js/Option.js';
6
+ import { getItemFromDict } from '../../../node_modules/@fable-org/fable-library-js/MapUtil.js';
7
+ import { isEmpty, head, tail, empty, cons, append, singleton as singleton$1, collect, reverse, length, filter, map as map$1, ofArrayWithTail, exists, ofArray } from '../../../node_modules/@fable-org/fable-library-js/List.js';
8
+ import { $007CYamlComment$007C_$007C, $007CSequenceMinusOpener$007C_$007C, $007CKey$007C_$007C, $007CKeyValue$007C_$007C, $007CDocumentEnd$007C_$007C, $007CYamlValue$007C_$007C, $007CAliasNode$007C_$007C, $007CSchemaNamespace$007C_$007C, $007CInlineSequence$007C_$007C, $007CSequenceSquareOpener$007C_$007C, $007CSequenceSquareCloser$007C_$007C, $007CInlineJSON$007C_$007C, $007CJSONKeyOpener$007C_$007C, $007CJSONCloser$007C_$007C, $007CExplicitKey$007C_$007C, $007CExplicitValue$007C_$007C } from './RegexActivePatterns.fs.js';
9
+ import { toList, delay, append as append$1, singleton, empty as empty$1, takeWhile, skipWhile, map as map$2 } from '../../../node_modules/@fable-org/fable-library-js/Seq.js';
10
+ import { toFail, printf, substring, join, trimStart, split } from '../../../node_modules/@fable-org/fable-library-js/String.js';
11
+ import { VerbatimTagPattern, AnchorPattern } from './Regex.fs.js';
12
+ import { tryFind } from '../../../node_modules/@fable-org/fable-library-js/Map.js';
13
+ import { Placeholder_splitTrailingComment, BlockScalar_parseHeader, BlockScalar_buildContent, Placeholder_tryParseComment, FlowTokens_tokenize, Document_isTopLevelMarker, Document_isStart, Document_tryInlineContentAfterStartMarker, Document_isDirectivePreludeOnly, Document_isEnd, BlockScalar_tryDetectHeaderIndent, Line_countLeadingSpaces, Line_normalizeNewlines } from './Syntax.fs.js';
14
+ import { Queue$1_$ctor_BB573A, Queue$1__Dequeue } from '../../../node_modules/@fable-org/fable-library-js/System.Collections.Generic.js';
15
+ import { read as read$1 } from './Preprocessing.fs.js';
16
+
17
+ function restoreScalarPlaceholderValue(entry) {
18
+ if (entry.Kind.tag === /* DoubleQuotedString */
19
+ 1) {
20
+ return unescapeDoubleQuoted(entry.Value);
21
+ } else {
22
+ return entry.Value;
23
+ }
24
+ }
25
+ function restoreBlockScalarPlaceholderValue(entry) {
26
+ if (entry.Kind.tag === /* DoubleQuotedString */
27
+ 1) {
28
+ return '"' + entry.Value + '"';
29
+ } else {
30
+ return "'" + entry.Value + "'";
31
+ }
32
+ }
33
+ function tryParseExactPlaceholderIndex(v) {
34
+ const m = match(create(`^${"<s f=(?<index>\\d+)\\/>"}$`), v.trim());
35
+ if (m != null) {
36
+ return parse(m.groups && m.groups.index || "", 511, false, 32);
37
+ } else {
38
+ return void 0;
39
+ }
40
+ }
41
+ function restoreStringReplace(stringDict, v) {
42
+ return replace(v, "<s f=(?<index>\\d+)\\/>", (m) => restoreScalarPlaceholderValue(getItemFromDict(stringDict, parse(m.groups && m.groups.index || "", 511, false, 32))));
43
+ }
44
+ function restoreCommentReplace(commentDict, commentId) {
45
+ return map((id) => getItemFromDict(commentDict, id), commentId);
46
+ }
47
+ function isBlankLineElement(_arg) {
48
+ let line;
49
+ let matchResult, line_1;
50
+ if (_arg.tag === /* Line */
51
+ 2) {
52
+ if (line = _arg.fields[0], line.trim() === "") {
53
+ matchResult = 0;
54
+ line_1 = _arg.fields[0];
55
+ } else {
56
+ matchResult = 1;
57
+ }
58
+ } else {
59
+ matchResult = 1;
60
+ }
61
+ switch (matchResult) {
62
+ case 0:
63
+ return true;
64
+ default:
65
+ return false;
66
+ }
67
+ }
68
+ function takeLeadingSequenceItemPrefix(eles) {
69
+ let matchResult, line_1, rest_1, commentElement, rest_2;
70
+ if (!isEmpty(eles)) {
71
+ if (isBlankLineElement(head(eles))) {
72
+ matchResult = 0;
73
+ line_1 = head(eles);
74
+ rest_1 = tail(eles);
75
+ } else if ($007CYamlComment$007C_$007C(head(eles)) != null) {
76
+ matchResult = 1;
77
+ commentElement = head(eles);
78
+ rest_2 = tail(eles);
79
+ } else {
80
+ matchResult = 2;
81
+ }
82
+ } else {
83
+ matchResult = 2;
84
+ }
85
+ switch (matchResult) {
86
+ case 0: {
87
+ const patternInput = takeLeadingSequenceItemPrefix(rest_1);
88
+ return [patternInput[0], patternInput[1], true];
89
+ }
90
+ case 1: {
91
+ const patternInput_1 = takeLeadingSequenceItemPrefix(rest_2);
92
+ return [cons(commentElement, patternInput_1[0]), patternInput_1[1], true];
93
+ }
94
+ default:
95
+ return [empty(), eles, false];
96
+ }
97
+ }
98
+ function splitLeadingSequenceItemContinuation(eles) {
99
+ const patternInput = takeLeadingSequenceItemPrefix(eles);
100
+ const afterPrefix = patternInput[1];
101
+ let matchResult, tail$1, yamlAstList;
102
+ if (patternInput[2]) {
103
+ if (!isEmpty(afterPrefix)) {
104
+ if (head(afterPrefix).tag === /* Intendation */
105
+ 1) {
106
+ matchResult = 0;
107
+ tail$1 = tail(afterPrefix);
108
+ yamlAstList = head(afterPrefix).fields[0];
109
+ } else {
110
+ matchResult = 1;
111
+ }
112
+ } else {
113
+ matchResult = 1;
114
+ }
115
+ } else {
116
+ matchResult = 1;
117
+ }
118
+ switch (matchResult) {
119
+ case 0:
120
+ return [append(patternInput[0], yamlAstList), tail$1];
121
+ default:
122
+ return void 0;
123
+ }
124
+ }
125
+ function collectSequenceElements(eles_mut) {
126
+ collectSequenceElements:
127
+ while (true) {
128
+ const eles = eles_mut;
129
+ let matchResult, line_1, rest_1, rest_2, v, yamlAstList;
130
+ if (!isEmpty(eles)) {
131
+ if (isBlankLineElement(head(eles))) {
132
+ matchResult = 0;
133
+ line_1 = head(eles);
134
+ rest_1 = tail(eles);
135
+ } else {
136
+ const activePatternResult = $007CSequenceMinusOpener$007C_$007C(head(eles));
137
+ if (activePatternResult != null) {
138
+ if (!isEmpty(tail(eles))) {
139
+ if (head(tail(eles)).tag === /* Intendation */
140
+ 1) {
141
+ matchResult = 1;
142
+ rest_2 = tail(tail(eles));
143
+ v = value(activePatternResult);
144
+ yamlAstList = head(tail(eles)).fields[0];
145
+ } else {
146
+ matchResult = 2;
147
+ }
148
+ } else {
149
+ matchResult = 2;
150
+ }
151
+ } else {
152
+ matchResult = 2;
153
+ }
154
+ }
155
+ } else {
156
+ matchResult = 2;
157
+ }
158
+ switch (matchResult) {
159
+ case 0: {
160
+ eles_mut = rest_1;
161
+ continue collectSequenceElements;
162
+ }
163
+ case 1:
164
+ return toList(delay(() => append$1(v.Value != null ? singleton(cons(PreprocessorElement_Line(value(v.Value)), yamlAstList)) : singleton(yamlAstList), delay(() => collectSequenceElements(rest_2)))));
165
+ default:
166
+ if (isEmpty(eles)) {
167
+ return empty();
168
+ } else {
169
+ const activePatternResult_1 = $007CSequenceMinusOpener$007C_$007C(head(eles));
170
+ if (activePatternResult_1 != null) {
171
+ const v_1 = value(activePatternResult_1);
172
+ const matchValue = splitLeadingSequenceItemContinuation(tail(eles));
173
+ if (matchValue != null) {
174
+ const tail = value(matchValue)[1];
175
+ const continuation = value(matchValue)[0];
176
+ return toList(delay(() => append$1(singleton(toList(delay(() => append$1(v_1.Value != null ? singleton(PreprocessorElement_Line(value(v_1.Value))) : empty$1(), delay(() => continuation))))), delay(() => collectSequenceElements(tail)))));
177
+ } else {
178
+ return toList(delay(() => append$1(v_1.Value != null ? singleton(singleton$1(PreprocessorElement_Line(value(v_1.Value)))) : singleton(empty()), delay(() => collectSequenceElements(tail(eles))))));
179
+ }
180
+ } else if ($007CYamlComment$007C_$007C(head(eles)) != null) {
181
+ return toList(delay(() => append$1(singleton(singleton$1(head(eles))), delay(() => collectSequenceElements(tail(eles))))));
182
+ } else {
183
+ return toFail(printf("Unknown pattern for sequence elements: %A"))(eles);
184
+ }
185
+ }
186
+ }
187
+ break;
188
+ }
189
+ }
190
+ function isSequenceElement(e) {
191
+ let matchResult;
192
+ if (e.tag === /* Intendation */
193
+ 1) {
194
+ matchResult = 0;
195
+ } else if ($007CSequenceMinusOpener$007C_$007C(e) != null) {
196
+ matchResult = 0;
197
+ } else if ($007CYamlComment$007C_$007C(e) != null) {
198
+ matchResult = 0;
199
+ } else {
200
+ matchResult = 1;
201
+ }
202
+ switch (matchResult) {
203
+ case 0:
204
+ return true;
205
+ default:
206
+ if (isBlankLineElement(e)) {
207
+ return true;
208
+ } else {
209
+ return false;
210
+ }
211
+ }
212
+ }
213
+ function tokenize(yamlList, stringDict, commentDict, handles) {
214
+ const flattenFlowContent = (elements) => collect((_arg) => {
215
+ switch (_arg.tag) {
216
+ case /* Line */
217
+ 2: {
218
+ const s = _arg.fields[0];
219
+ return singleton$1(s.trim());
220
+ }
221
+ case /* Intendation */
222
+ 1:
223
+ return flattenFlowContent(_arg.fields[0]);
224
+ default:
225
+ return empty();
226
+ }
227
+ }, elements);
228
+ const restoreInlinePlaceholders = (line) => replace(replace(line, "<s f=(?<index>\\d+)\\/>", (m) => restoreBlockScalarPlaceholderValue(getItemFromDict(stringDict, parse(m.groups && m.groups.index || "", 511, false, 32)))), "<c f=(?<comment>\\d+)\\/>", (m_1) => "#" + getItemFromDict(commentDict, parse(m_1.groups && m_1.groups.comment || "", 511, false, 32)));
229
+ const flattenBlockScalarWithDepth = (depth, eles) => collect((_arg_1) => {
230
+ switch (_arg_1.tag) {
231
+ case /* Line */
232
+ 2: {
233
+ const s_1 = _arg_1.fields[0];
234
+ return singleton$1((s_1 === "" ? "" : Array(depth * 2 + 1).join(" ")) + restoreInlinePlaceholders(s_1));
235
+ }
236
+ case /* Intendation */
237
+ 1:
238
+ return flattenBlockScalarWithDepth(depth + 1, _arg_1.fields[0]);
239
+ default:
240
+ return empty();
241
+ }
242
+ }, eles);
243
+ const flattenBlockScalar = (eles_1) => flattenBlockScalarWithDepth(0, eles_1);
244
+ const flattenBlockScalarContentWithDepth = (depth_1, eles_2) => collect((_arg_2) => {
245
+ switch (_arg_2.tag) {
246
+ case /* Line */
247
+ 2: {
248
+ const s_2 = _arg_2.fields[0];
249
+ return singleton$1((s_2 === "" ? "" : Array((depth_1 + 1) * 2 + 1).join(" ")) + restoreInlinePlaceholders(s_2));
250
+ }
251
+ case /* Intendation */
252
+ 1:
253
+ return flattenBlockScalarContentWithDepth(depth_1 + 1, _arg_2.fields[0]);
254
+ default:
255
+ return empty();
256
+ }
257
+ }, eles_2);
258
+ const flattenBlockScalarContent = (eles_3) => flattenBlockScalarContentWithDepth(0, eles_3);
259
+ const restoreScalarWithStyle = (raw) => {
260
+ const matchValue = tryParseExactPlaceholderIndex(raw);
261
+ if (matchValue == null) {
262
+ return [restoreStringReplace(stringDict, raw), void 0];
263
+ } else {
264
+ const entry = getItemFromDict(stringDict, value(matchValue));
265
+ return [restoreScalarPlaceholderValue(entry), entry.Kind.tag === /* DoubleQuotedString */
266
+ 1 ? ScalarStyle_DoubleQuoted() : ScalarStyle_SingleQuoted()];
267
+ }
268
+ };
269
+ const extractProperties = (handles_2, v) => {
270
+ let shorthand, m_2, handle, suffix, matchValue_2;
271
+ let current = v.trim();
272
+ let tag = void 0;
273
+ let anchor = void 0;
274
+ let changed = true;
275
+ while (changed) {
276
+ changed = false;
277
+ const mTag = match(create(VerbatimTagPattern), current);
278
+ if (mTag != null) {
279
+ tag = mTag.groups && mTag.groups.tag || "";
280
+ current = substring(current, mTag[0].length).trim();
281
+ changed = true;
282
+ } else {
283
+ const mShort = match(/^(!\S*)/gu, current);
284
+ if (mShort != null) {
285
+ const raw_1 = mShort[1] || "";
286
+ tag = (shorthand = raw_1, shorthand === "!" ? "!" : (m_2 = match(/^(![\w-]+!|!!|!)(.*)/gu, shorthand), m_2 != null ? (handle = m_2[1] || "", suffix = m_2[2] || "", matchValue_2 = tryFind(handle, handles_2), matchValue_2 == null ? shorthand : value(matchValue_2) + suffix) : shorthand));
287
+ current = substring(current, mShort[0].length).trim();
288
+ changed = true;
289
+ }
290
+ }
291
+ const mAnchor = match(create(AnchorPattern), current);
292
+ if (mAnchor != null && current.startsWith("&")) {
293
+ anchor = mAnchor.groups && mAnchor.groups.anchor || "";
294
+ current = substring(current, mAnchor[0].length).trim();
295
+ changed = true;
296
+ }
297
+ }
298
+ return {
299
+ Anchor: unwrap(anchor),
300
+ Tag: unwrap(tag),
301
+ Value: current
302
+ };
303
+ };
304
+ const createScalarContent = (raw_2, comment) => {
305
+ const props = extractProperties(handles, raw_2);
306
+ const patternInput = restoreScalarWithStyle(props.Value);
307
+ return YAMLContent_create_Z1C3A29C9(patternInput[0], unwrap(comment), unwrap(props.Anchor), unwrap(props.Tag), unwrap(patternInput[1]));
308
+ };
309
+ const isBlockScalarHeaderCandidate = (rawHeader) => {
310
+ const props_1 = extractProperties(handles, Placeholder_splitTrailingComment(rawHeader)[0]);
311
+ if (props_1.Value.startsWith("|")) {
312
+ return true;
313
+ } else {
314
+ return props_1.Value.startsWith(">");
315
+ }
316
+ };
317
+ const tryReadBlockScalar = (rawHeader_1, headerIndent, baseCommentId, block) => {
318
+ const patternInput_2 = Placeholder_splitTrailingComment(rawHeader_1);
319
+ const props_2 = extractProperties(handles, patternInput_2[0]);
320
+ const commentId = baseCommentId == null ? patternInput_2[1] : baseCommentId;
321
+ const matchValue_3 = BlockScalar_parseHeader(props_2.Value);
322
+ if (matchValue_3 == null) {
323
+ return void 0;
324
+ } else {
325
+ const header = value(matchValue_3);
326
+ const value_4 = BlockScalar_buildContent(header.Style, header.Chomp, headerIndent, header.Indent, flattenBlockScalarContent(block));
327
+ return {
328
+ Chomp: header.Chomp,
329
+ Comment: unwrap(restoreCommentReplace(commentDict, commentId)),
330
+ Indent: unwrap(header.Indent),
331
+ Props: props_2,
332
+ Style: header.Style,
333
+ Value: value_4
334
+ };
335
+ }
336
+ };
337
+ const tryCollapsePlainScalarContent = (hasInlineFirstLine, block_1, parsed) => {
338
+ let values, renderedBlockLines;
339
+ let matchValue_6;
340
+ const element = parsed;
341
+ const loop = (allowMetadata_1_mut, items_mut, acc_mut) => {
342
+ let content, matchValue_4;
343
+ loop:
344
+ while (true) {
345
+ const allowMetadata_1 = allowMetadata_1_mut, items = items_mut, acc = acc_mut;
346
+ let matchResult, content_2, rest_1;
347
+ if (!isEmpty(items)) {
348
+ if (head(items).tag === /* Value */
349
+ 1) {
350
+ if (content = head(items).fields[0], (matchValue_4 = content.Style, matchValue_4 != null ? value(matchValue_4).tag === /* Plain */
351
+ 0 : true) && (allowMetadata_1 ? true : content.Comment == null && content.Anchor == null && content.Tag == null)) {
352
+ matchResult = 1;
353
+ content_2 = head(items).fields[0];
354
+ rest_1 = tail(items);
355
+ } else {
356
+ matchResult = 2;
357
+ }
358
+ } else {
359
+ matchResult = 2;
360
+ }
361
+ } else {
362
+ matchResult = 0;
363
+ }
364
+ switch (matchResult) {
365
+ case 0: {
366
+ const matchValue_5 = reverse(acc);
367
+ if (isEmpty(matchValue_5)) {
368
+ return void 0;
369
+ } else {
370
+ return matchValue_5;
371
+ }
372
+ }
373
+ case 1: {
374
+ allowMetadata_1_mut = false;
375
+ items_mut = rest_1;
376
+ acc_mut = cons(content_2, acc);
377
+ continue loop;
378
+ }
379
+ default:
380
+ return void 0;
381
+ }
382
+ break;
383
+ }
384
+ };
385
+ matchValue_6 = element.tag === /* Object */
386
+ 3 ? loop(true, element.fields[0], empty()) : void 0;
387
+ let matchResult_1, firstSegment, segments_1;
388
+ if (matchValue_6 != null) {
389
+ if (!isEmpty(value(matchValue_6))) {
390
+ matchResult_1 = 0;
391
+ firstSegment = head(value(matchValue_6));
392
+ segments_1 = value(matchValue_6);
393
+ } else {
394
+ matchResult_1 = 1;
395
+ }
396
+ } else {
397
+ matchResult_1 = 1;
398
+ }
399
+ switch (matchResult_1) {
400
+ case 0: {
401
+ const rawBlockLines = flattenBlockScalarContent(block_1);
402
+ const rawValue = join("\n", (hasInlineFirstLine ? length(segments_1) - 1 : length(segments_1)) === length(filter((line_1) => line_1.trim() !== "", rawBlockLines)) ? (values = Queue$1_$ctor_BB573A(hasInlineFirstLine ? tail(segments_1) : segments_1), renderedBlockLines = map$1((rawLine) => {
403
+ if (rawLine.trim() === "") {
404
+ return "";
405
+ } else {
406
+ return Queue$1__Dequeue(values).Value;
407
+ }
408
+ }, rawBlockLines), hasInlineFirstLine ? cons(firstSegment.Value, renderedBlockLines) : renderedBlockLines) : map$1((segment) => segment.Value, segments_1));
409
+ return new YAMLContent(rawValue, firstSegment.Comment, firstSegment.Anchor, firstSegment.Tag, rawValue.indexOf("\n") >= 0 ? ScalarStyle_Plain() : firstSegment.Style);
410
+ }
411
+ default:
412
+ return void 0;
413
+ }
414
+ };
415
+ const takePlainScalarContinuationContents = (elements_1_mut, acc_1_mut) => {
416
+ let v_1;
417
+ takePlainScalarContinuationContents:
418
+ while (true) {
419
+ const elements_1 = elements_1_mut, acc_1 = acc_1_mut;
420
+ let matchResult_2;
421
+ if (isEmpty(elements_1)) {
422
+ matchResult_2 = 0;
423
+ } else if ($007CKey$007C_$007C(head(elements_1)) != null) {
424
+ matchResult_2 = 0;
425
+ } else if ($007CKeyValue$007C_$007C(head(elements_1)) != null) {
426
+ matchResult_2 = 0;
427
+ } else if ($007CSequenceMinusOpener$007C_$007C(head(elements_1)) != null) {
428
+ matchResult_2 = 0;
429
+ } else if ($007CYamlComment$007C_$007C(head(elements_1)) != null) {
430
+ matchResult_2 = 0;
431
+ } else if ($007CDocumentEnd$007C_$007C(head(elements_1)) != null) {
432
+ matchResult_2 = 0;
433
+ } else {
434
+ matchResult_2 = 1;
435
+ }
436
+ switch (matchResult_2) {
437
+ case 0:
438
+ return [reverse(acc_1), elements_1];
439
+ default: {
440
+ let matchResult_3, rest_3, v_2;
441
+ if (!isEmpty(elements_1)) {
442
+ const activePatternResult_5 = $007CYamlValue$007C_$007C(head(elements_1));
443
+ if (activePatternResult_5 != null) {
444
+ if (v_1 = value(activePatternResult_5), v_1.Value !== "" && v_1.Comment == null) {
445
+ matchResult_3 = 0;
446
+ rest_3 = tail(elements_1);
447
+ v_2 = value(activePatternResult_5);
448
+ } else {
449
+ matchResult_3 = 1;
450
+ }
451
+ } else {
452
+ matchResult_3 = 1;
453
+ }
454
+ } else {
455
+ matchResult_3 = 1;
456
+ }
457
+ switch (matchResult_3) {
458
+ case 0: {
459
+ const content_3 = createScalarContent(v_2.Value, void 0);
460
+ const matchValue_7 = content_3.Style;
461
+ const matchValue_8 = content_3.Comment;
462
+ const matchValue_9 = content_3.Anchor;
463
+ const matchValue_10 = content_3.Tag;
464
+ let matchResult_4;
465
+ if (matchValue_7 != null) {
466
+ if (value(matchValue_7).tag === /* Plain */
467
+ 0) {
468
+ if (matchValue_8 == null) {
469
+ if (matchValue_9 == null) {
470
+ if (matchValue_10 == null) {
471
+ matchResult_4 = 0;
472
+ } else {
473
+ matchResult_4 = 1;
474
+ }
475
+ } else {
476
+ matchResult_4 = 1;
477
+ }
478
+ } else {
479
+ matchResult_4 = 1;
480
+ }
481
+ } else {
482
+ matchResult_4 = 1;
483
+ }
484
+ } else if (matchValue_8 == null) {
485
+ if (matchValue_9 == null) {
486
+ if (matchValue_10 == null) {
487
+ matchResult_4 = 0;
488
+ } else {
489
+ matchResult_4 = 1;
490
+ }
491
+ } else {
492
+ matchResult_4 = 1;
493
+ }
494
+ } else {
495
+ matchResult_4 = 1;
496
+ }
497
+ switch (matchResult_4) {
498
+ case 0: {
499
+ elements_1_mut = rest_3;
500
+ acc_1_mut = cons(content_3, acc_1);
501
+ continue takePlainScalarContinuationContents;
502
+ }
503
+ default:
504
+ return [reverse(acc_1), elements_1];
505
+ }
506
+ }
507
+ default:
508
+ return [reverse(acc_1), elements_1];
509
+ }
510
+ }
511
+ }
512
+ break;
513
+ }
514
+ };
515
+ const takeLeadingComments = (elements_2_mut) => {
516
+ takeLeadingComments:
517
+ while (true) {
518
+ const elements_2 = elements_2_mut;
519
+ let matchResult_5, line_3, rest_5, commentElement, rest_6;
520
+ if (!isEmpty(elements_2)) {
521
+ if (isBlankLineElement(head(elements_2))) {
522
+ matchResult_5 = 0;
523
+ line_3 = head(elements_2);
524
+ rest_5 = tail(elements_2);
525
+ } else if ($007CYamlComment$007C_$007C(head(elements_2)) != null) {
526
+ matchResult_5 = 1;
527
+ commentElement = head(elements_2);
528
+ rest_6 = tail(elements_2);
529
+ } else {
530
+ matchResult_5 = 2;
531
+ }
532
+ } else {
533
+ matchResult_5 = 2;
534
+ }
535
+ switch (matchResult_5) {
536
+ case 0: {
537
+ elements_2_mut = rest_5;
538
+ continue takeLeadingComments;
539
+ }
540
+ case 1: {
541
+ const patternInput_3 = takeLeadingComments(rest_6);
542
+ return [cons(commentElement, patternInput_3[0]), patternInput_3[1]];
543
+ }
544
+ default:
545
+ return [empty(), elements_2];
546
+ }
547
+ break;
548
+ }
549
+ };
550
+ const commentTokensToYaml = (comments_1) => map$1((_arg_3) => {
551
+ const activePatternResult_7 = $007CYamlComment$007C_$007C(_arg_3);
552
+ if (activePatternResult_7 != null) {
553
+ const comment_2 = value(activePatternResult_7);
554
+ return YAMLElement_Comment(getItemFromDict(commentDict, comment_2.Comment));
555
+ } else {
556
+ return toFail(printf("Expected leading comment token, got: %A"))(_arg_3);
557
+ }
558
+ }, comments_1);
559
+ const parseFlowNode = (tokens) => {
560
+ let matchResult_6, rest_7, rest_8;
561
+ if (!isEmpty(tokens)) {
562
+ switch (head(tokens).tag) {
563
+ case /* OpenBrace */
564
+ 0: {
565
+ matchResult_6 = 0;
566
+ rest_7 = tail(tokens);
567
+ break;
568
+ }
569
+ case /* OpenBracket */
570
+ 2: {
571
+ matchResult_6 = 1;
572
+ rest_8 = tail(tokens);
573
+ break;
574
+ }
575
+ case /* String */
576
+ 6: {
577
+ matchResult_6 = 2;
578
+ break;
579
+ }
580
+ case /* Colon */
581
+ 4: {
582
+ matchResult_6 = 3;
583
+ break;
584
+ }
585
+ case /* EOF */
586
+ 7: {
587
+ matchResult_6 = 4;
588
+ break;
589
+ }
590
+ default:
591
+ matchResult_6 = 5;
592
+ }
593
+ } else {
594
+ matchResult_6 = 5;
595
+ }
596
+ switch (matchResult_6) {
597
+ case 0:
598
+ return parseFlowObject(rest_7);
599
+ case 1:
600
+ return parseFlowArray(rest_8);
601
+ case 2:
602
+ return parseFlowScalar(tokens)(empty());
603
+ case 3:
604
+ return parseFlowScalar(tokens)(empty());
605
+ case 4:
606
+ return [YAMLElement_Nil(), tokens];
607
+ default:
608
+ return toFail(printf("Unexpected flow token: %A"))(tokens);
609
+ }
610
+ };
611
+ const tryCommentElementFromFlowString = (value_5) => map((id) => YAMLElement_Comment(getItemFromDict(commentDict, id)), Placeholder_tryParseComment(value_5));
612
+ const parseFlowScalar = (tokens_1) => (acc_2) => {
613
+ let matchResult_7, rest_10, value_7, rest_11, value_8, rest_12;
614
+ if (!isEmpty(tokens_1)) {
615
+ switch (head(tokens_1).tag) {
616
+ case /* String */
617
+ 6: {
618
+ if (tryCommentElementFromFlowString(head(tokens_1).fields[0]) != null) {
619
+ matchResult_7 = 0;
620
+ rest_10 = tail(tokens_1);
621
+ value_7 = head(tokens_1).fields[0];
622
+ } else {
623
+ matchResult_7 = 1;
624
+ rest_11 = tail(tokens_1);
625
+ value_8 = head(tokens_1).fields[0];
626
+ }
627
+ break;
628
+ }
629
+ case /* Colon */
630
+ 4: {
631
+ matchResult_7 = 2;
632
+ rest_12 = tail(tokens_1);
633
+ break;
634
+ }
635
+ default:
636
+ matchResult_7 = 3;
637
+ }
638
+ } else {
639
+ matchResult_7 = 3;
640
+ }
641
+ switch (matchResult_7) {
642
+ case 0: {
643
+ const matchValue_12 = reverse(acc_2);
644
+ return isEmpty(matchValue_12) ? [value(tryCommentElementFromFlowString(value_7)), rest_10] : [YAMLElement_Value(createScalarContent(join("", matchValue_12), void 0)), tokens_1];
645
+ }
646
+ case 1:
647
+ return parseFlowScalar(rest_11)(cons(value_8, acc_2));
648
+ case 2:
649
+ return parseFlowScalar(rest_12)(cons(":", acc_2));
650
+ default: {
651
+ const matchValue_13 = reverse(acc_2);
652
+ return isEmpty(matchValue_13) ? [YAMLElement_Nil(), tokens_1] : [YAMLElement_Value(createScalarContent(join("", matchValue_13), void 0)), tokens_1];
653
+ }
654
+ }
655
+ };
656
+ const parseFlowObject = (tokens_2) => {
657
+ const loop_1 = (remaining_mut, acc_3_mut) => {
658
+ loop_1:
659
+ while (true) {
660
+ const remaining = remaining_mut, acc_3 = acc_3_mut;
661
+ let matchResult_8, rest_14, rest_15, rest_16, value_10, key, rest_17;
662
+ if (!isEmpty(remaining)) {
663
+ switch (head(remaining).tag) {
664
+ case /* CloseBrace */
665
+ 1: {
666
+ matchResult_8 = 0;
667
+ rest_14 = tail(remaining);
668
+ break;
669
+ }
670
+ case /* Comma */
671
+ 5: {
672
+ matchResult_8 = 1;
673
+ rest_15 = tail(remaining);
674
+ break;
675
+ }
676
+ case /* EOF */
677
+ 7: {
678
+ matchResult_8 = 2;
679
+ break;
680
+ }
681
+ case /* String */
682
+ 6: {
683
+ if (tryCommentElementFromFlowString(head(remaining).fields[0]) != null) {
684
+ matchResult_8 = 3;
685
+ rest_16 = tail(remaining);
686
+ value_10 = head(remaining).fields[0];
687
+ } else if (!isEmpty(tail(remaining))) {
688
+ if (head(tail(remaining)).tag === /* Colon */
689
+ 4) {
690
+ matchResult_8 = 4;
691
+ key = head(remaining).fields[0];
692
+ rest_17 = tail(tail(remaining));
693
+ } else {
694
+ matchResult_8 = 5;
695
+ }
696
+ } else {
697
+ matchResult_8 = 5;
698
+ }
699
+ break;
700
+ }
701
+ default:
702
+ matchResult_8 = 5;
703
+ }
704
+ } else {
705
+ matchResult_8 = 5;
706
+ }
707
+ switch (matchResult_8) {
708
+ case 0:
709
+ return [YAMLElement_Object(reverse(acc_3)), rest_14];
710
+ case 1: {
711
+ remaining_mut = rest_15;
712
+ acc_3_mut = acc_3;
713
+ continue loop_1;
714
+ }
715
+ case 2:
716
+ return [YAMLElement_Object(reverse(acc_3)), remaining];
717
+ case 3: {
718
+ remaining_mut = rest_16;
719
+ acc_3_mut = cons(value(tryCommentElementFromFlowString(value_10)), acc_3);
720
+ continue loop_1;
721
+ }
722
+ case 4: {
723
+ const keyContent = createScalarContent(key, void 0);
724
+ const patternInput_4 = parseFlowNode(rest_17);
725
+ const value_11 = patternInput_4[0];
726
+ remaining_mut = patternInput_4[1];
727
+ acc_3_mut = cons(YAMLElement_Mapping(keyContent, value_11.tag === /* Object */
728
+ 3 ? value_11 : value_11.tag === /* Sequence */
729
+ 2 ? YAMLElement_Object(singleton$1(value_11)) : value_11.tag === /* Value */
730
+ 1 ? YAMLElement_Object(singleton$1(value_11)) : value_11), acc_3);
731
+ continue loop_1;
732
+ }
733
+ default:
734
+ return toFail(printf("Expected flow mapping key or close brace, got: %A"))(remaining);
735
+ }
736
+ break;
737
+ }
738
+ };
739
+ return loop_1(tokens_2, empty());
740
+ };
741
+ const parseFlowArray = (tokens_3) => {
742
+ const loop_2 = (remaining_1_mut, acc_4_mut) => {
743
+ loop_2:
744
+ while (true) {
745
+ const remaining_1 = remaining_1_mut, acc_4 = acc_4_mut;
746
+ let matchResult_9, rest_19, rest_20, rest_21, value_13;
747
+ if (!isEmpty(remaining_1)) {
748
+ switch (head(remaining_1).tag) {
749
+ case /* CloseBracket */
750
+ 3: {
751
+ matchResult_9 = 0;
752
+ rest_19 = tail(remaining_1);
753
+ break;
754
+ }
755
+ case /* Comma */
756
+ 5: {
757
+ matchResult_9 = 1;
758
+ rest_20 = tail(remaining_1);
759
+ break;
760
+ }
761
+ case /* EOF */
762
+ 7: {
763
+ matchResult_9 = 2;
764
+ break;
765
+ }
766
+ case /* String */
767
+ 6: {
768
+ if (tryCommentElementFromFlowString(head(remaining_1).fields[0]) != null) {
769
+ matchResult_9 = 3;
770
+ rest_21 = tail(remaining_1);
771
+ value_13 = head(remaining_1).fields[0];
772
+ } else {
773
+ matchResult_9 = 4;
774
+ }
775
+ break;
776
+ }
777
+ default:
778
+ matchResult_9 = 4;
779
+ }
780
+ } else {
781
+ matchResult_9 = 4;
782
+ }
783
+ switch (matchResult_9) {
784
+ case 0:
785
+ return [YAMLElement_Sequence(reverse(acc_4)), rest_19];
786
+ case 1: {
787
+ remaining_1_mut = rest_20;
788
+ acc_4_mut = acc_4;
789
+ continue loop_2;
790
+ }
791
+ case 2:
792
+ return [YAMLElement_Sequence(reverse(acc_4)), remaining_1];
793
+ case 3: {
794
+ remaining_1_mut = rest_21;
795
+ acc_4_mut = cons(YAMLElement_Object(singleton$1(value(tryCommentElementFromFlowString(value_13)))), acc_4);
796
+ continue loop_2;
797
+ }
798
+ default: {
799
+ const patternInput_5 = parseFlowNode(remaining_1);
800
+ const item = patternInput_5[0];
801
+ remaining_1_mut = patternInput_5[1];
802
+ acc_4_mut = cons(item.tag === /* Value */
803
+ 1 ? YAMLElement_Object(singleton$1(item)) : item.tag === /* Sequence */
804
+ 2 ? YAMLElement_Object(singleton$1(item)) : item, acc_4);
805
+ continue loop_2;
806
+ }
807
+ }
808
+ break;
809
+ }
810
+ };
811
+ return loop_2(tokens_3, empty());
812
+ };
813
+ const parseFlowSource = (source) => parseFlowNode(FlowTokens_tokenize(source))[0];
814
+ const prependRootFlow = (comment_4, node_2, acc_5) => append(reverse(toList(delay(() => {
815
+ let matchValue_19;
816
+ return append$1((matchValue_19 = comment_4, matchValue_19 == null ? empty$1() : singleton(YAMLElement_Comment(value(matchValue_19)))), delay(() => {
817
+ const matchValue_20 = node_2;
818
+ switch (matchValue_20.tag) {
819
+ case /* Object */
820
+ 3:
821
+ return matchValue_20.fields[0];
822
+ case /* Nil */
823
+ 8: {
824
+ return empty$1();
825
+ }
826
+ default:
827
+ return singleton(matchValue_20);
828
+ }
829
+ }));
830
+ }))), acc_5);
831
+ const loopRead = (handles_3_mut, restlist_mut, acc_6_mut) => {
832
+ let c2_2, c1_2, c1_1, c2_1, s_3, s_4, matchValue_30, content_4, continuations, matchValue_36, single, v_25, block_5, block_2, iList_2, closer_2, yamlAstList_1, v_4;
833
+ loopRead:
834
+ while (true) {
835
+ const handles_3 = handles_3_mut, restlist = restlist_mut, acc_6 = acc_6_mut;
836
+ let matchResult_10, alias, rest_25;
837
+ if (!isEmpty(restlist)) {
838
+ const activePatternResult_8 = $007CAliasNode$007C_$007C(head(restlist));
839
+ if (activePatternResult_8 != null) {
840
+ matchResult_10 = 0;
841
+ alias = value(activePatternResult_8);
842
+ rest_25 = tail(restlist);
843
+ } else if ($007CDocumentEnd$007C_$007C(head(restlist)) != null) {
844
+ matchResult_10 = 1;
845
+ } else {
846
+ matchResult_10 = 2;
847
+ }
848
+ } else {
849
+ matchResult_10 = 2;
850
+ }
851
+ switch (matchResult_10) {
852
+ case 0: {
853
+ handles_3_mut = handles_3;
854
+ restlist_mut = rest_25;
855
+ acc_6_mut = cons(YAMLElement_Alias(alias), acc_6);
856
+ continue loopRead;
857
+ }
858
+ case 1:
859
+ return YAMLElement_Object(reverse(acc_6));
860
+ default: {
861
+ let matchResult_11, rest0, v_3, yamlAstList;
862
+ if (!isEmpty(restlist)) {
863
+ const activePatternResult_10 = $007CSchemaNamespace$007C_$007C(head(restlist));
864
+ if (activePatternResult_10 != null) {
865
+ if (!isEmpty(tail(restlist))) {
866
+ if (head(tail(restlist)).tag === /* Intendation */
867
+ 1) {
868
+ matchResult_11 = 0;
869
+ rest0 = tail(tail(restlist));
870
+ v_3 = value(activePatternResult_10);
871
+ yamlAstList = head(tail(restlist)).fields[0];
872
+ } else {
873
+ matchResult_11 = 1;
874
+ }
875
+ } else {
876
+ matchResult_11 = 1;
877
+ }
878
+ } else {
879
+ matchResult_11 = 1;
880
+ }
881
+ } else {
882
+ matchResult_11 = 1;
883
+ }
884
+ switch (matchResult_11) {
885
+ case 0: {
886
+ const sequenceElements = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0)));
887
+ handles_3_mut = handles_3;
888
+ restlist_mut = toList(skipWhile(isSequenceElement, rest0));
889
+ acc_6_mut = cons(YAMLElement_Sequence(toList(delay(() => append$1(singleton(loopRead(handles_3, cons(PreprocessorElement_Line(v_3.Key), yamlAstList), empty())), delay(() => map$2((i) => loopRead(handles_3, i, empty()), sequenceElements)))))), acc_6);
890
+ continue loopRead;
891
+ }
892
+ default: {
893
+ let matchResult_12, rest0_2, v_5, rest0_3, v_6, yamlAstList_2;
894
+ if (!isEmpty(restlist)) {
895
+ const activePatternResult_11 = $007CSchemaNamespace$007C_$007C(head(restlist));
896
+ if (activePatternResult_11 != null) {
897
+ matchResult_12 = 0;
898
+ rest0_2 = tail(restlist);
899
+ v_5 = value(activePatternResult_11);
900
+ } else {
901
+ const activePatternResult_12 = $007CSequenceMinusOpener$007C_$007C(head(restlist));
902
+ if (activePatternResult_12 != null) {
903
+ if (!isEmpty(tail(restlist))) {
904
+ if (head(tail(restlist)).tag === /* Intendation */
905
+ 1) {
906
+ if (yamlAstList_1 = head(tail(restlist)).fields[0], v_4 = value(activePatternResult_12), v_4.Value != null && isBlockScalarHeaderCandidate(value(v_4.Value))) {
907
+ matchResult_12 = 1;
908
+ rest0_3 = tail(tail(restlist));
909
+ v_6 = value(activePatternResult_12);
910
+ yamlAstList_2 = head(tail(restlist)).fields[0];
911
+ } else {
912
+ matchResult_12 = 2;
913
+ }
914
+ } else {
915
+ matchResult_12 = 2;
916
+ }
917
+ } else {
918
+ matchResult_12 = 2;
919
+ }
920
+ } else {
921
+ matchResult_12 = 2;
922
+ }
923
+ }
924
+ } else {
925
+ matchResult_12 = 2;
926
+ }
927
+ switch (matchResult_12) {
928
+ case 0: {
929
+ const sequenceElements_1 = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0_2)));
930
+ handles_3_mut = handles_3;
931
+ restlist_mut = toList(skipWhile(isSequenceElement, rest0_2));
932
+ acc_6_mut = cons(YAMLElement_Sequence(toList(delay(() => append$1(singleton(loopRead(handles_3, singleton$1(PreprocessorElement_Line(v_5.Key)), empty())), delay(() => map$2((i_1) => loopRead(handles_3, i_1, empty()), sequenceElements_1)))))), acc_6);
933
+ continue loopRead;
934
+ }
935
+ case 1: {
936
+ const matchValue_21 = tryReadBlockScalar(value(v_6.Value), v_6.Indent, void 0, yamlAstList_2);
937
+ if (matchValue_21 == null) {
938
+ const arg_3 = value(v_6.Value);
939
+ return toFail(printf("Invalid sequence block scalar header: %s"))(arg_3);
940
+ } else {
941
+ const blockScalar = value(matchValue_21);
942
+ const sequenceElements_2 = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0_3)));
943
+ const rest_28 = toList(skipWhile(isSequenceElement, rest0_3));
944
+ const firstItem = YAMLElement_Object(singleton$1(YAMLElement_Value(YAMLContent_create_Z1C3A29C9(blockScalar.Value, unwrap(blockScalar.Comment), unwrap(blockScalar.Props.Anchor), unwrap(blockScalar.Props.Tag), ScalarStyle_Block(blockScalar.Style, blockScalar.Chomp, blockScalar.Indent)))));
945
+ handles_3_mut = handles_3;
946
+ restlist_mut = rest_28;
947
+ acc_6_mut = cons(YAMLElement_Sequence(toList(delay(() => append$1(singleton(firstItem), delay(() => map$2((i_2) => loopRead(handles_3, i_2, empty()), sequenceElements_2)))))), acc_6);
948
+ continue loopRead;
949
+ }
950
+ }
951
+ default: {
952
+ let matchResult_13, rest0_4, v_7, yamlAstList_3;
953
+ if (!isEmpty(restlist)) {
954
+ const activePatternResult_13 = $007CSequenceMinusOpener$007C_$007C(head(restlist));
955
+ if (activePatternResult_13 != null) {
956
+ if (!isEmpty(tail(restlist))) {
957
+ if (head(tail(restlist)).tag === /* Intendation */
958
+ 1) {
959
+ matchResult_13 = 0;
960
+ rest0_4 = tail(tail(restlist));
961
+ v_7 = value(activePatternResult_13);
962
+ yamlAstList_3 = head(tail(restlist)).fields[0];
963
+ } else {
964
+ matchResult_13 = 1;
965
+ }
966
+ } else {
967
+ matchResult_13 = 1;
968
+ }
969
+ } else {
970
+ matchResult_13 = 1;
971
+ }
972
+ } else {
973
+ matchResult_13 = 1;
974
+ }
975
+ switch (matchResult_13) {
976
+ case 0: {
977
+ let firstItem_1;
978
+ const matchValue_22 = bind((value_14) => {
979
+ let matchValue_15;
980
+ const patternInput_7 = Placeholder_splitTrailingComment(value_14);
981
+ const commentId_1 = patternInput_7[1];
982
+ const matchValue_14 = patternInput_7[0].trim();
983
+ matchValue_15 = matchValue_14 === "[" ? ["[", "]", commentId_1] : matchValue_14 === "{" ? ["{", "}", commentId_1] : void 0;
984
+ if (matchValue_15 == null) {
985
+ return void 0;
986
+ } else {
987
+ const opening = value(matchValue_15)[0];
988
+ const openerCommentId = value(matchValue_15)[2];
989
+ let matchValue_16;
990
+ const closing = value(matchValue_15)[1];
991
+ const loop_3 = (suffix_1_mut, remainingReversed_mut) => {
992
+ loop_3:
993
+ while (true) {
994
+ const suffix_1 = suffix_1_mut, remainingReversed = remainingReversed_mut;
995
+ if (!isEmpty(remainingReversed)) {
996
+ if (head(remainingReversed).trim() === "") {
997
+ suffix_1_mut = cons(head(remainingReversed), suffix_1);
998
+ remainingReversed_mut = tail(remainingReversed);
999
+ continue loop_3;
1000
+ } else {
1001
+ const patternInput_8 = Placeholder_splitTrailingComment(head(remainingReversed));
1002
+ if (patternInput_8[0].trim() === closing) {
1003
+ return [append(reverse(tail(remainingReversed)), append(singleton$1(closing), suffix_1)), patternInput_8[1]];
1004
+ } else {
1005
+ return void 0;
1006
+ }
1007
+ }
1008
+ } else {
1009
+ return void 0;
1010
+ }
1011
+ break;
1012
+ }
1013
+ };
1014
+ matchValue_16 = loop_3(empty(), reverse(flattenFlowContent(yamlAstList_3)));
1015
+ if (matchValue_16 == null) {
1016
+ return void 0;
1017
+ } else {
1018
+ const closerCommentId = value(matchValue_16)[1];
1019
+ return [parseFlowSource(join("\n", cons(opening, value(matchValue_16)[0]))), openerCommentId, closerCommentId];
1020
+ }
1021
+ }
1022
+ }, v_7.Value);
1023
+ if (matchValue_22 == null) {
1024
+ const parsedFirstItem = loopRead(handles_3, v_7.Value != null ? cons(PreprocessorElement_Line(value(v_7.Value)), yamlAstList_3) : yamlAstList_3, empty());
1025
+ const matchValue_23 = tryCollapsePlainScalarContent(v_7.Value != null, yamlAstList_3, parsedFirstItem);
1026
+ firstItem_1 = matchValue_23 == null ? parsedFirstItem : YAMLElement_Object(singleton$1(YAMLElement_Value(value(matchValue_23))));
1027
+ } else {
1028
+ const closerCommentId_1 = value(matchValue_22)[2];
1029
+ const node_1 = value(matchValue_22)[0];
1030
+ let commentsBefore;
1031
+ const matchValue_17 = restoreCommentReplace(commentDict, value(matchValue_22)[1]);
1032
+ commentsBefore = matchValue_17 == null ? empty() : singleton$1(YAMLElement_Comment(value(matchValue_17)));
1033
+ let commentsAfter;
1034
+ const matchValue_18 = restoreCommentReplace(commentDict, closerCommentId_1);
1035
+ commentsAfter = matchValue_18 == null ? empty() : singleton$1(YAMLElement_Comment(value(matchValue_18)));
1036
+ firstItem_1 = node_1.tag === /* Object */
1037
+ 3 ? YAMLElement_Object(append(commentsBefore, append(node_1.fields[0], commentsAfter))) : node_1.tag === /* Nil */
1038
+ 8 ? YAMLElement_Object(append(commentsBefore, commentsAfter)) : YAMLElement_Object(append(commentsBefore, append(singleton$1(node_1), commentsAfter)));
1039
+ }
1040
+ const sequenceElements_3 = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0_4)));
1041
+ handles_3_mut = handles_3;
1042
+ restlist_mut = toList(skipWhile(isSequenceElement, rest0_4));
1043
+ acc_6_mut = cons(YAMLElement_Sequence(toList(delay(() => append$1(singleton(firstItem_1), delay(() => map$2((i_3) => loopRead(handles_3, i_3, empty()), sequenceElements_3)))))), acc_6);
1044
+ continue loopRead;
1045
+ }
1046
+ default: {
1047
+ let matchResult_14, rest0_5, v_8, rest_31, v_9, closer, iList, opener, rest_32;
1048
+ if (!isEmpty(restlist)) {
1049
+ const activePatternResult_14 = $007CSequenceMinusOpener$007C_$007C(head(restlist));
1050
+ if (activePatternResult_14 != null) {
1051
+ matchResult_14 = 0;
1052
+ rest0_5 = tail(restlist);
1053
+ v_8 = value(activePatternResult_14);
1054
+ } else {
1055
+ const activePatternResult_15 = $007CInlineSequence$007C_$007C(head(restlist));
1056
+ if (activePatternResult_15 != null) {
1057
+ matchResult_14 = 1;
1058
+ rest_31 = tail(restlist);
1059
+ v_9 = value(activePatternResult_15);
1060
+ } else {
1061
+ const activePatternResult_16 = $007CSequenceSquareOpener$007C_$007C(head(restlist));
1062
+ if (activePatternResult_16 != null) {
1063
+ if (!isEmpty(tail(restlist))) {
1064
+ if (head(tail(restlist)).tag === /* Intendation */
1065
+ 1) {
1066
+ if (!isEmpty(tail(tail(restlist)))) {
1067
+ const activePatternResult_17 = $007CSequenceSquareCloser$007C_$007C(head(tail(tail(restlist))));
1068
+ if (activePatternResult_17 != null) {
1069
+ matchResult_14 = 2;
1070
+ closer = value(activePatternResult_17);
1071
+ iList = head(tail(restlist)).fields[0];
1072
+ opener = value(activePatternResult_16);
1073
+ rest_32 = tail(tail(tail(restlist)));
1074
+ } else {
1075
+ matchResult_14 = 3;
1076
+ }
1077
+ } else {
1078
+ matchResult_14 = 3;
1079
+ }
1080
+ } else {
1081
+ matchResult_14 = 3;
1082
+ }
1083
+ } else {
1084
+ matchResult_14 = 3;
1085
+ }
1086
+ } else {
1087
+ matchResult_14 = 3;
1088
+ }
1089
+ }
1090
+ }
1091
+ } else {
1092
+ matchResult_14 = 3;
1093
+ }
1094
+ switch (matchResult_14) {
1095
+ case 0: {
1096
+ const initialObjectList = v_8.Value != null ? singleton$1(PreprocessorElement_Line(value(v_8.Value))) : empty();
1097
+ let patternInput_9;
1098
+ const matchValue_24 = splitLeadingSequenceItemContinuation(rest0_5);
1099
+ if (matchValue_24 == null) {
1100
+ patternInput_9 = [initialObjectList, rest0_5];
1101
+ } else {
1102
+ const tail_1 = value(matchValue_24)[1];
1103
+ patternInput_9 = [append(initialObjectList, value(matchValue_24)[0]), tail_1];
1104
+ }
1105
+ const sequenceSource = patternInput_9[1];
1106
+ const sequenceElements_4 = collectSequenceElements(toList(takeWhile(isSequenceElement, sequenceSource)));
1107
+ handles_3_mut = handles_3;
1108
+ restlist_mut = toList(skipWhile(isSequenceElement, sequenceSource));
1109
+ acc_6_mut = cons(YAMLElement_Sequence(toList(delay(() => append$1(singleton(loopRead(handles_3, patternInput_9[0], empty())), delay(() => map$2((i_4) => loopRead(handles_3, i_4, empty()), sequenceElements_4)))))), acc_6);
1110
+ continue loopRead;
1111
+ }
1112
+ case 1: {
1113
+ handles_3_mut = handles_3;
1114
+ restlist_mut = rest_31;
1115
+ acc_6_mut = prependRootFlow(restoreCommentReplace(commentDict, v_9.Comment), parseFlowSource("[" + v_9.Value + "]"), acc_6);
1116
+ continue loopRead;
1117
+ }
1118
+ case 2: {
1119
+ const c1 = restoreCommentReplace(commentDict, opener.Comment);
1120
+ const c2 = restoreCommentReplace(commentDict, closer.Comment);
1121
+ const current_7 = parseFlowSource("[" + join("\n", flattenFlowContent(iList)) + "]");
1122
+ handles_3_mut = handles_3;
1123
+ restlist_mut = rest_32;
1124
+ acc_6_mut = c1 == null ? c2 == null ? cons(current_7, acc_6) : (c2_2 = value(c2), ofArrayWithTail([YAMLElement_Comment(c2_2), current_7], acc_6)) : c2 == null ? (c1_2 = value(c1), ofArrayWithTail([current_7, YAMLElement_Comment(c1_2)], acc_6)) : (c1_1 = value(c1), c2_1 = value(c2), ofArrayWithTail([YAMLElement_Comment(c2_1), current_7, YAMLElement_Comment(c1_1)], acc_6));
1125
+ continue loopRead;
1126
+ }
1127
+ default: {
1128
+ let matchResult_15, rest_33, v_10, closer_1, iList_1, opener_1, rest_34;
1129
+ if (!isEmpty(restlist)) {
1130
+ const activePatternResult_18 = $007CInlineJSON$007C_$007C(head(restlist));
1131
+ if (activePatternResult_18 != null) {
1132
+ matchResult_15 = 0;
1133
+ rest_33 = tail(restlist);
1134
+ v_10 = value(activePatternResult_18);
1135
+ } else {
1136
+ const activePatternResult_19 = $007CJSONKeyOpener$007C_$007C(head(restlist));
1137
+ if (activePatternResult_19 != null) {
1138
+ if (!isEmpty(tail(restlist))) {
1139
+ if (head(tail(restlist)).tag === /* Intendation */
1140
+ 1) {
1141
+ if (!isEmpty(tail(tail(restlist)))) {
1142
+ const activePatternResult_20 = $007CJSONCloser$007C_$007C(head(tail(tail(restlist))));
1143
+ if (activePatternResult_20 != null) {
1144
+ matchResult_15 = 1;
1145
+ closer_1 = value(activePatternResult_20);
1146
+ iList_1 = head(tail(restlist)).fields[0];
1147
+ opener_1 = value(activePatternResult_19);
1148
+ rest_34 = tail(tail(tail(restlist)));
1149
+ } else {
1150
+ matchResult_15 = 2;
1151
+ }
1152
+ } else {
1153
+ matchResult_15 = 2;
1154
+ }
1155
+ } else {
1156
+ matchResult_15 = 2;
1157
+ }
1158
+ } else {
1159
+ matchResult_15 = 2;
1160
+ }
1161
+ } else {
1162
+ matchResult_15 = 2;
1163
+ }
1164
+ }
1165
+ } else {
1166
+ matchResult_15 = 2;
1167
+ }
1168
+ switch (matchResult_15) {
1169
+ case 0: {
1170
+ handles_3_mut = handles_3;
1171
+ restlist_mut = rest_33;
1172
+ acc_6_mut = prependRootFlow(restoreCommentReplace(commentDict, v_10.Comment), parseFlowSource("{" + v_10.Value + "}"), acc_6);
1173
+ continue loopRead;
1174
+ }
1175
+ case 1: {
1176
+ const keyComment = restoreCommentReplace(commentDict, opener_1.Comment);
1177
+ const closerComment = restoreCommentReplace(commentDict, closer_1.Comment);
1178
+ const current_9 = YAMLElement_Mapping(createScalarContent(opener_1.Key, keyComment), parseFlowSource("{" + join("\n", flattenFlowContent(iList_1)) + "}"));
1179
+ handles_3_mut = handles_3;
1180
+ restlist_mut = rest_34;
1181
+ acc_6_mut = closerComment == null ? cons(current_9, acc_6) : ofArrayWithTail([YAMLElement_Comment(value(closerComment)), current_9], acc_6);
1182
+ continue loopRead;
1183
+ }
1184
+ default: {
1185
+ let matchResult_16, closer_3, iList_3, opener_3, rest_36;
1186
+ if (!isEmpty(restlist)) {
1187
+ const activePatternResult_21 = $007CYamlValue$007C_$007C(head(restlist));
1188
+ if (activePatternResult_21 != null) {
1189
+ if (!isEmpty(tail(restlist))) {
1190
+ if (head(tail(restlist)).tag === /* Intendation */
1191
+ 1) {
1192
+ if (!isEmpty(tail(tail(restlist)))) {
1193
+ const activePatternResult_22 = $007CJSONCloser$007C_$007C(head(tail(tail(restlist))));
1194
+ if (activePatternResult_22 != null) {
1195
+ if (iList_2 = head(tail(restlist)).fields[0], closer_2 = value(activePatternResult_22), value(activePatternResult_21).Value === "{") {
1196
+ matchResult_16 = 0;
1197
+ closer_3 = value(activePatternResult_22);
1198
+ iList_3 = head(tail(restlist)).fields[0];
1199
+ opener_3 = value(activePatternResult_21);
1200
+ rest_36 = tail(tail(tail(restlist)));
1201
+ } else {
1202
+ matchResult_16 = 1;
1203
+ }
1204
+ } else {
1205
+ matchResult_16 = 1;
1206
+ }
1207
+ } else {
1208
+ matchResult_16 = 1;
1209
+ }
1210
+ } else {
1211
+ matchResult_16 = 1;
1212
+ }
1213
+ } else {
1214
+ matchResult_16 = 1;
1215
+ }
1216
+ } else {
1217
+ matchResult_16 = 1;
1218
+ }
1219
+ } else {
1220
+ matchResult_16 = 1;
1221
+ }
1222
+ switch (matchResult_16) {
1223
+ case 0: {
1224
+ const c1_3 = restoreCommentReplace(commentDict, opener_3.Comment);
1225
+ const c2_3 = restoreCommentReplace(commentDict, closer_3.Comment);
1226
+ const current_10 = parseFlowSource("{" + join("\n", flattenFlowContent(iList_3)) + "}");
1227
+ handles_3_mut = handles_3;
1228
+ restlist_mut = rest_36;
1229
+ acc_6_mut = append(reverse(toList(delay(() => {
1230
+ let matchValue_26;
1231
+ return append$1((matchValue_26 = c1_3, matchValue_26 == null ? empty$1() : singleton(YAMLElement_Comment(value(matchValue_26)))), delay(() => {
1232
+ let matchValue_27;
1233
+ return append$1((matchValue_27 = current_10, matchValue_27.tag === /* Object */
1234
+ 3 ? matchValue_27.fields[0] : matchValue_27.tag === /* Nil */
1235
+ 8 ? empty$1() : singleton(matchValue_27)), delay(() => {
1236
+ const matchValue_28 = c2_3;
1237
+ if (matchValue_28 == null) {
1238
+ return empty$1();
1239
+ } else {
1240
+ return singleton(YAMLElement_Comment(value(matchValue_28)));
1241
+ }
1242
+ }));
1243
+ }));
1244
+ }))), acc_6);
1245
+ continue loopRead;
1246
+ }
1247
+ default: {
1248
+ let matchResult_17, k, rest_37, rest_38, v_15, yamlAstList_4;
1249
+ if (!isEmpty(restlist)) {
1250
+ const activePatternResult_23 = $007CExplicitKey$007C_$007C(head(restlist));
1251
+ if (activePatternResult_23 != null) {
1252
+ matchResult_17 = 0;
1253
+ k = value(activePatternResult_23);
1254
+ rest_37 = tail(restlist);
1255
+ } else {
1256
+ const activePatternResult_24 = $007CKey$007C_$007C(head(restlist));
1257
+ if (activePatternResult_24 != null) {
1258
+ if (!isEmpty(tail(restlist))) {
1259
+ if (head(tail(restlist)).tag === /* Intendation */
1260
+ 1) {
1261
+ matchResult_17 = 1;
1262
+ rest_38 = tail(tail(restlist));
1263
+ v_15 = value(activePatternResult_24);
1264
+ yamlAstList_4 = head(tail(restlist)).fields[0];
1265
+ } else {
1266
+ matchResult_17 = 2;
1267
+ }
1268
+ } else {
1269
+ matchResult_17 = 2;
1270
+ }
1271
+ } else {
1272
+ matchResult_17 = 2;
1273
+ }
1274
+ }
1275
+ } else {
1276
+ matchResult_17 = 2;
1277
+ }
1278
+ switch (matchResult_17) {
1279
+ case 0: {
1280
+ const parseValue = (vStr) => {
1281
+ let matchValue_29;
1282
+ return loopRead(handles_3, (matchValue_29 = read$1(vStr).AST, matchValue_29.tag === /* Level */
1283
+ 0 ? matchValue_29.fields[0] : empty()), empty());
1284
+ };
1285
+ let matchResult_18, iList_4, keyBody, tail_2, v_11;
1286
+ if (!isEmpty(rest_37)) {
1287
+ if (head(rest_37).tag === /* Intendation */
1288
+ 1) {
1289
+ if (!isEmpty(tail(rest_37))) {
1290
+ const activePatternResult_25 = $007CExplicitValue$007C_$007C(head(tail(rest_37)));
1291
+ if (activePatternResult_25 != null) {
1292
+ if (!isEmpty(tail(tail(rest_37)))) {
1293
+ if (head(tail(tail(rest_37))).tag === /* Intendation */
1294
+ 1) {
1295
+ matchResult_18 = 0;
1296
+ iList_4 = head(tail(tail(rest_37))).fields[0];
1297
+ keyBody = head(rest_37).fields[0];
1298
+ tail_2 = tail(tail(tail(rest_37)));
1299
+ v_11 = value(activePatternResult_25);
1300
+ } else {
1301
+ matchResult_18 = 1;
1302
+ }
1303
+ } else {
1304
+ matchResult_18 = 1;
1305
+ }
1306
+ } else {
1307
+ matchResult_18 = 1;
1308
+ }
1309
+ } else {
1310
+ matchResult_18 = 1;
1311
+ }
1312
+ } else {
1313
+ matchResult_18 = 1;
1314
+ }
1315
+ } else {
1316
+ matchResult_18 = 1;
1317
+ }
1318
+ switch (matchResult_18) {
1319
+ case 0: {
1320
+ const simplifiedKey = join("\n", flattenBlockScalar(keyBody));
1321
+ const keyContent_2 = createScalarContent(k == null ? simplifiedKey : (s_3 = value(k), s_3 + (s_3 !== "" ? "\n" : "") + simplifiedKey), void 0);
1322
+ const separator = (trimStart(v_11).startsWith("[") ? true : trimStart(v_11).startsWith("{")) ? " " : "\n";
1323
+ handles_3_mut = handles_3;
1324
+ restlist_mut = tail_2;
1325
+ acc_6_mut = cons(YAMLElement_Mapping(keyContent_2, parseValue(v_11 + separator + join(separator, flattenBlockScalar(iList_4)))), acc_6);
1326
+ continue loopRead;
1327
+ }
1328
+ default: {
1329
+ let matchResult_19, keyBody_1, tail_3, v_12, iList_5, tail_4, v_13;
1330
+ if (!isEmpty(rest_37)) {
1331
+ if (head(rest_37).tag === /* Intendation */
1332
+ 1) {
1333
+ if (!isEmpty(tail(rest_37))) {
1334
+ const activePatternResult_26 = $007CExplicitValue$007C_$007C(head(tail(rest_37)));
1335
+ if (activePatternResult_26 != null) {
1336
+ matchResult_19 = 0;
1337
+ keyBody_1 = head(rest_37).fields[0];
1338
+ tail_3 = tail(tail(rest_37));
1339
+ v_12 = value(activePatternResult_26);
1340
+ } else if (head(tail(rest_37)).tag === /* Intendation */
1341
+ 1) {
1342
+ const activePatternResult_27 = $007CExplicitValue$007C_$007C(head(rest_37));
1343
+ if (activePatternResult_27 != null) {
1344
+ matchResult_19 = 1;
1345
+ iList_5 = head(tail(rest_37)).fields[0];
1346
+ tail_4 = tail(tail(rest_37));
1347
+ v_13 = value(activePatternResult_27);
1348
+ } else {
1349
+ matchResult_19 = 2;
1350
+ }
1351
+ } else {
1352
+ matchResult_19 = 2;
1353
+ }
1354
+ } else {
1355
+ matchResult_19 = 2;
1356
+ }
1357
+ } else {
1358
+ const activePatternResult_28 = $007CExplicitValue$007C_$007C(head(rest_37));
1359
+ if (activePatternResult_28 != null) {
1360
+ if (!isEmpty(tail(rest_37))) {
1361
+ if (head(tail(rest_37)).tag === /* Intendation */
1362
+ 1) {
1363
+ matchResult_19 = 1;
1364
+ iList_5 = head(tail(rest_37)).fields[0];
1365
+ tail_4 = tail(tail(rest_37));
1366
+ v_13 = value(activePatternResult_28);
1367
+ } else {
1368
+ matchResult_19 = 2;
1369
+ }
1370
+ } else {
1371
+ matchResult_19 = 2;
1372
+ }
1373
+ } else {
1374
+ matchResult_19 = 2;
1375
+ }
1376
+ }
1377
+ } else {
1378
+ matchResult_19 = 2;
1379
+ }
1380
+ switch (matchResult_19) {
1381
+ case 0: {
1382
+ const simplifiedKey_1 = join("\n", flattenBlockScalar(keyBody_1));
1383
+ handles_3_mut = handles_3;
1384
+ restlist_mut = tail_3;
1385
+ acc_6_mut = cons(YAMLElement_Mapping(createScalarContent(k == null ? simplifiedKey_1 : (s_4 = value(k), s_4 + (s_4 !== "" ? "\n" : "") + simplifiedKey_1), void 0), parseValue(v_12)), acc_6);
1386
+ continue loopRead;
1387
+ }
1388
+ case 1: {
1389
+ handles_3_mut = handles_3;
1390
+ restlist_mut = tail_4;
1391
+ acc_6_mut = cons(YAMLElement_Mapping(k == null ? YAMLContent_create_Z1C3A29C9("") : createScalarContent(value(k), void 0), parseValue(v_13 + "\n" + join("\n", flattenBlockScalar(iList_5)))), acc_6);
1392
+ continue loopRead;
1393
+ }
1394
+ default: {
1395
+ let matchResult_20, tail_5, v_14;
1396
+ if (!isEmpty(rest_37)) {
1397
+ const activePatternResult_29 = $007CExplicitValue$007C_$007C(head(rest_37));
1398
+ if (activePatternResult_29 != null) {
1399
+ matchResult_20 = 0;
1400
+ tail_5 = tail(rest_37);
1401
+ v_14 = value(activePatternResult_29);
1402
+ } else {
1403
+ matchResult_20 = 1;
1404
+ }
1405
+ } else {
1406
+ matchResult_20 = 1;
1407
+ }
1408
+ switch (matchResult_20) {
1409
+ case 0: {
1410
+ handles_3_mut = handles_3;
1411
+ restlist_mut = tail_5;
1412
+ acc_6_mut = cons(YAMLElement_Mapping(k == null ? YAMLContent_create_Z1C3A29C9("") : createScalarContent(value(k), void 0), parseValue(v_14)), acc_6);
1413
+ continue loopRead;
1414
+ }
1415
+ default: {
1416
+ handles_3_mut = handles_3;
1417
+ restlist_mut = rest_37;
1418
+ acc_6_mut = cons(YAMLElement_Mapping(k == null ? YAMLContent_create_Z1C3A29C9("") : createScalarContent(value(k), void 0), YAMLElement_Nil()), acc_6);
1419
+ continue loopRead;
1420
+ }
1421
+ }
1422
+ }
1423
+ }
1424
+ }
1425
+ }
1426
+ }
1427
+ case 1: {
1428
+ const keyContent_7 = createScalarContent(v_15.Key, restoreCommentReplace(commentDict, v_15.Comment));
1429
+ const parsedValue = loopRead(handles_3, yamlAstList_4, empty());
1430
+ handles_3_mut = handles_3;
1431
+ restlist_mut = rest_38;
1432
+ acc_6_mut = cons(YAMLElement_Mapping(keyContent_7, (matchValue_30 = tryCollapsePlainScalarContent(false, yamlAstList_4, parsedValue), matchValue_30 == null ? parsedValue : YAMLElement_Object(singleton$1(YAMLElement_Value(value(matchValue_30)))))), acc_6);
1433
+ continue loopRead;
1434
+ }
1435
+ default: {
1436
+ let matchResult_21, rest0_6, v_17, block_3, rest_42, v_18;
1437
+ if (!isEmpty(restlist)) {
1438
+ const activePatternResult_30 = $007CKey$007C_$007C(head(restlist));
1439
+ if (activePatternResult_30 != null) {
1440
+ matchResult_21 = 0;
1441
+ rest0_6 = tail(restlist);
1442
+ v_17 = value(activePatternResult_30);
1443
+ } else {
1444
+ const activePatternResult_31 = $007CKeyValue$007C_$007C(head(restlist));
1445
+ if (activePatternResult_31 != null) {
1446
+ if (!isEmpty(tail(restlist))) {
1447
+ if (head(tail(restlist)).tag === /* Intendation */
1448
+ 1) {
1449
+ if (block_2 = head(tail(restlist)).fields[0], isBlockScalarHeaderCandidate(value(activePatternResult_31).Value)) {
1450
+ matchResult_21 = 1;
1451
+ block_3 = head(tail(restlist)).fields[0];
1452
+ rest_42 = tail(tail(restlist));
1453
+ v_18 = value(activePatternResult_31);
1454
+ } else {
1455
+ matchResult_21 = 2;
1456
+ }
1457
+ } else {
1458
+ matchResult_21 = 2;
1459
+ }
1460
+ } else {
1461
+ matchResult_21 = 2;
1462
+ }
1463
+ } else {
1464
+ matchResult_21 = 2;
1465
+ }
1466
+ }
1467
+ } else {
1468
+ matchResult_21 = 2;
1469
+ }
1470
+ switch (matchResult_21) {
1471
+ case 0: {
1472
+ const patternInput_10 = takeLeadingComments(rest0_6);
1473
+ const leadingComments = patternInput_10[0];
1474
+ const afterComments = patternInput_10[1];
1475
+ let matchResult_22, tail_6, w, yamlAstList_5;
1476
+ if (!isEmpty(afterComments)) {
1477
+ const activePatternResult_32 = $007CSequenceMinusOpener$007C_$007C(head(afterComments));
1478
+ if (activePatternResult_32 != null) {
1479
+ if (!isEmpty(tail(afterComments))) {
1480
+ if (head(tail(afterComments)).tag === /* Intendation */
1481
+ 1) {
1482
+ matchResult_22 = 0;
1483
+ tail_6 = tail(tail(afterComments));
1484
+ w = value(activePatternResult_32);
1485
+ yamlAstList_5 = head(tail(afterComments)).fields[0];
1486
+ } else {
1487
+ matchResult_22 = 1;
1488
+ }
1489
+ } else {
1490
+ matchResult_22 = 1;
1491
+ }
1492
+ } else {
1493
+ matchResult_22 = 1;
1494
+ }
1495
+ } else {
1496
+ matchResult_22 = 1;
1497
+ }
1498
+ switch (matchResult_22) {
1499
+ case 0: {
1500
+ const keyContent_8 = createScalarContent(v_17.Key, restoreCommentReplace(commentDict, v_17.Comment));
1501
+ const objectList_3 = w.Value != null ? cons(PreprocessorElement_Line(value(w.Value)), yamlAstList_5) : yamlAstList_5;
1502
+ const sequenceElements_5 = collectSequenceElements(toList(takeWhile(isSequenceElement, tail_6)));
1503
+ const rest_40 = toList(skipWhile(isSequenceElement, tail_6));
1504
+ const seq = YAMLElement_Sequence(toList(delay(() => append$1(singleton(loopRead(handles_3, objectList_3, empty())), delay(() => map$2((element_1) => loopRead(handles_3, element_1, empty()), sequenceElements_5))))));
1505
+ handles_3_mut = handles_3;
1506
+ restlist_mut = rest_40;
1507
+ acc_6_mut = cons(YAMLElement_Mapping(keyContent_8, YAMLElement_Object(append(commentTokensToYaml(leadingComments), singleton$1(seq)))), acc_6);
1508
+ continue loopRead;
1509
+ }
1510
+ default: {
1511
+ let matchResult_23, tail_7, w_1;
1512
+ if (!isEmpty(afterComments)) {
1513
+ const activePatternResult_33 = $007CSequenceMinusOpener$007C_$007C(head(afterComments));
1514
+ if (activePatternResult_33 != null) {
1515
+ matchResult_23 = 0;
1516
+ tail_7 = tail(afterComments);
1517
+ w_1 = value(activePatternResult_33);
1518
+ } else {
1519
+ matchResult_23 = 1;
1520
+ }
1521
+ } else {
1522
+ matchResult_23 = 1;
1523
+ }
1524
+ switch (matchResult_23) {
1525
+ case 0: {
1526
+ const keyContent_9 = createScalarContent(v_17.Key, restoreCommentReplace(commentDict, v_17.Comment));
1527
+ let initialObjectList_1;
1528
+ const matchValue_31 = w_1.Value;
1529
+ initialObjectList_1 = matchValue_31 == null ? empty() : singleton$1(PreprocessorElement_Line(value(matchValue_31)));
1530
+ let patternInput_11;
1531
+ const matchValue_32 = splitLeadingSequenceItemContinuation(tail_7);
1532
+ if (matchValue_32 == null) {
1533
+ patternInput_11 = [initialObjectList_1, tail_7];
1534
+ } else {
1535
+ const remaining_2 = value(matchValue_32)[1];
1536
+ patternInput_11 = [append(initialObjectList_1, value(matchValue_32)[0]), remaining_2];
1537
+ }
1538
+ const sequenceSource_1 = patternInput_11[1];
1539
+ const sequenceElements_6 = collectSequenceElements(toList(takeWhile(isSequenceElement, sequenceSource_1)));
1540
+ const rest_41 = toList(skipWhile(isSequenceElement, sequenceSource_1));
1541
+ const seq_1 = YAMLElement_Sequence(toList(delay(() => append$1(singleton(loopRead(handles_3, patternInput_11[0], empty())), delay(() => map$2((element_2) => loopRead(handles_3, element_2, empty()), sequenceElements_6))))));
1542
+ handles_3_mut = handles_3;
1543
+ restlist_mut = rest_41;
1544
+ acc_6_mut = cons(YAMLElement_Mapping(keyContent_9, YAMLElement_Object(append(commentTokensToYaml(leadingComments), singleton$1(seq_1)))), acc_6);
1545
+ continue loopRead;
1546
+ }
1547
+ default: {
1548
+ const current_19 = YAMLElement_Value(YAMLContent_create_Z1C3A29C9(v_17.Key + ":", unwrap(restoreCommentReplace(commentDict, v_17.Comment))));
1549
+ handles_3_mut = handles_3;
1550
+ restlist_mut = afterComments;
1551
+ acc_6_mut = append(reverse(commentTokensToYaml(leadingComments)), cons(current_19, acc_6));
1552
+ continue loopRead;
1553
+ }
1554
+ }
1555
+ }
1556
+ }
1557
+ }
1558
+ case 1: {
1559
+ const matchValue_33 = tryReadBlockScalar(v_18.Value, v_18.Indent, void 0, block_3);
1560
+ if (matchValue_33 == null) {
1561
+ return toFail(printf("Invalid block scalar header: %s"))(v_18.Value);
1562
+ } else {
1563
+ const blockScalar_1 = value(matchValue_33);
1564
+ handles_3_mut = handles_3;
1565
+ restlist_mut = rest_42;
1566
+ acc_6_mut = cons(YAMLElement_Mapping(createScalarContent(v_18.Key, void 0), YAMLElement_Value(YAMLContent_create_Z1C3A29C9(blockScalar_1.Value, unwrap(blockScalar_1.Comment), unwrap(blockScalar_1.Props.Anchor), unwrap(blockScalar_1.Props.Tag), ScalarStyle_Block(blockScalar_1.Style, blockScalar_1.Chomp, blockScalar_1.Indent)))), acc_6);
1567
+ continue loopRead;
1568
+ }
1569
+ }
1570
+ default: {
1571
+ let matchResult_24, block_4, rest_43, v_19;
1572
+ if (!isEmpty(restlist)) {
1573
+ const activePatternResult_34 = $007CKeyValue$007C_$007C(head(restlist));
1574
+ if (activePatternResult_34 != null) {
1575
+ if (!isEmpty(tail(restlist))) {
1576
+ if (head(tail(restlist)).tag === /* Intendation */
1577
+ 1) {
1578
+ matchResult_24 = 0;
1579
+ block_4 = head(tail(restlist)).fields[0];
1580
+ rest_43 = tail(tail(restlist));
1581
+ v_19 = value(activePatternResult_34);
1582
+ } else {
1583
+ matchResult_24 = 1;
1584
+ }
1585
+ } else {
1586
+ matchResult_24 = 1;
1587
+ }
1588
+ } else {
1589
+ matchResult_24 = 1;
1590
+ }
1591
+ } else {
1592
+ matchResult_24 = 1;
1593
+ }
1594
+ switch (matchResult_24) {
1595
+ case 0: {
1596
+ const keyContent_11 = createScalarContent(v_19.Key, void 0);
1597
+ const parsedValue_1 = loopRead(handles_3, cons(PreprocessorElement_Line(v_19.Value), block_4), empty());
1598
+ let patternInput_13;
1599
+ const matchValue_34 = tryCollapsePlainScalarContent(true, block_4, parsedValue_1);
1600
+ if (matchValue_34 == null) {
1601
+ patternInput_13 = [parsedValue_1, rest_43];
1602
+ } else {
1603
+ const content_7 = value(matchValue_34);
1604
+ const patternInput_12 = takePlainScalarContinuationContents(rest_43, empty());
1605
+ patternInput_13 = [YAMLElement_Object(singleton$1(YAMLElement_Value((content_4 = content_7, continuations = patternInput_12[0], isEmpty(continuations) ? content_4 : new YAMLContent(join("\n", map$1((segment_1) => segment_1.Value, cons(content_4, continuations))), content_4.Comment, content_4.Anchor, content_4.Tag, ScalarStyle_Plain()))))), patternInput_12[1]];
1606
+ }
1607
+ handles_3_mut = handles_3;
1608
+ restlist_mut = patternInput_13[1];
1609
+ acc_6_mut = cons(YAMLElement_Mapping(keyContent_11, patternInput_13[0]), acc_6);
1610
+ continue loopRead;
1611
+ }
1612
+ default: {
1613
+ let matchResult_25, rest_45, v_21, rest_46, v_22, block_6, rest_47, v_23;
1614
+ if (!isEmpty(restlist)) {
1615
+ const activePatternResult_35 = $007CKeyValue$007C_$007C(head(restlist));
1616
+ if (activePatternResult_35 != null) {
1617
+ matchResult_25 = 0;
1618
+ rest_45 = tail(restlist);
1619
+ v_21 = value(activePatternResult_35);
1620
+ } else {
1621
+ const activePatternResult_36 = $007CYamlComment$007C_$007C(head(restlist));
1622
+ if (activePatternResult_36 != null) {
1623
+ matchResult_25 = 1;
1624
+ rest_46 = tail(restlist);
1625
+ v_22 = value(activePatternResult_36);
1626
+ } else {
1627
+ const activePatternResult_37 = $007CYamlValue$007C_$007C(head(restlist));
1628
+ if (activePatternResult_37 != null) {
1629
+ if (!isEmpty(tail(restlist))) {
1630
+ if (head(tail(restlist)).tag === /* Intendation */
1631
+ 1) {
1632
+ if (block_5 = head(tail(restlist)).fields[0], isBlockScalarHeaderCandidate(value(activePatternResult_37).Value)) {
1633
+ matchResult_25 = 2;
1634
+ block_6 = head(tail(restlist)).fields[0];
1635
+ rest_47 = tail(tail(restlist));
1636
+ v_23 = value(activePatternResult_37);
1637
+ } else {
1638
+ matchResult_25 = 3;
1639
+ }
1640
+ } else {
1641
+ matchResult_25 = 3;
1642
+ }
1643
+ } else {
1644
+ matchResult_25 = 3;
1645
+ }
1646
+ } else {
1647
+ matchResult_25 = 3;
1648
+ }
1649
+ }
1650
+ }
1651
+ } else {
1652
+ matchResult_25 = 3;
1653
+ }
1654
+ switch (matchResult_25) {
1655
+ case 0: {
1656
+ handles_3_mut = handles_3;
1657
+ restlist_mut = rest_45;
1658
+ acc_6_mut = cons(YAMLElement_Mapping(createScalarContent(v_21.Key, void 0), loopRead(handles_3, singleton$1(PreprocessorElement_Line(v_21.Value)), empty())), acc_6);
1659
+ continue loopRead;
1660
+ }
1661
+ case 1: {
1662
+ handles_3_mut = handles_3;
1663
+ restlist_mut = rest_46;
1664
+ acc_6_mut = cons(YAMLElement_Comment(getItemFromDict(commentDict, v_22.Comment)), acc_6);
1665
+ continue loopRead;
1666
+ }
1667
+ case 2: {
1668
+ const matchValue_35 = tryReadBlockScalar(v_23.Value, v_23.Indent, v_23.Comment, block_6);
1669
+ if (matchValue_35 == null) {
1670
+ return toFail(printf("Invalid block scalar header: %s"))(v_23.Value);
1671
+ } else {
1672
+ const blockScalar_2 = value(matchValue_35);
1673
+ handles_3_mut = handles_3;
1674
+ restlist_mut = rest_47;
1675
+ acc_6_mut = cons(YAMLElement_Value(YAMLContent_create_Z1C3A29C9(blockScalar_2.Value, unwrap(blockScalar_2.Comment), unwrap(blockScalar_2.Props.Anchor), unwrap(blockScalar_2.Props.Tag), ScalarStyle_Block(blockScalar_2.Style, blockScalar_2.Chomp, blockScalar_2.Indent))), acc_6);
1676
+ continue loopRead;
1677
+ }
1678
+ }
1679
+ default: {
1680
+ let matchResult_26, block_7, rest_48, v_24;
1681
+ if (!isEmpty(restlist)) {
1682
+ const activePatternResult_38 = $007CYamlValue$007C_$007C(head(restlist));
1683
+ if (activePatternResult_38 != null) {
1684
+ if (!isEmpty(tail(restlist))) {
1685
+ if (head(tail(restlist)).tag === /* Intendation */
1686
+ 1) {
1687
+ matchResult_26 = 0;
1688
+ block_7 = head(tail(restlist)).fields[0];
1689
+ rest_48 = tail(tail(restlist));
1690
+ v_24 = value(activePatternResult_38);
1691
+ } else {
1692
+ matchResult_26 = 1;
1693
+ }
1694
+ } else {
1695
+ matchResult_26 = 1;
1696
+ }
1697
+ } else {
1698
+ matchResult_26 = 1;
1699
+ }
1700
+ } else {
1701
+ matchResult_26 = 1;
1702
+ }
1703
+ switch (matchResult_26) {
1704
+ case 0: {
1705
+ const parsedValue_2 = loopRead(handles_3, cons(PreprocessorElement_Line(v_24.Value), block_7), empty());
1706
+ handles_3_mut = handles_3;
1707
+ restlist_mut = rest_48;
1708
+ acc_6_mut = cons((matchValue_36 = tryCollapsePlainScalarContent(true, block_7, parsedValue_2), matchValue_36 == null ? parsedValue_2.tag === /* Object */
1709
+ 3 ? !isEmpty(parsedValue_2.fields[0]) ? isEmpty(tail(parsedValue_2.fields[0])) ? (single = head(parsedValue_2.fields[0]), single) : toFail(printf("Unknown pattern: %A"))(cons(PreprocessorElement_Line(v_24.Value), block_7)) : toFail(printf("Unknown pattern: %A"))(cons(PreprocessorElement_Line(v_24.Value), block_7)) : toFail(printf("Unknown pattern: %A"))(cons(PreprocessorElement_Line(v_24.Value), block_7)) : YAMLElement_Value(value(matchValue_36))), acc_6);
1710
+ continue loopRead;
1711
+ }
1712
+ default: {
1713
+ let matchResult_27, rest_50, v_26;
1714
+ if (!isEmpty(restlist)) {
1715
+ const activePatternResult_39 = $007CYamlValue$007C_$007C(head(restlist));
1716
+ if (activePatternResult_39 != null) {
1717
+ if (v_25 = value(activePatternResult_39), v_25.Value === "" && v_25.Comment == null) {
1718
+ matchResult_27 = 0;
1719
+ rest_50 = tail(restlist);
1720
+ v_26 = value(activePatternResult_39);
1721
+ } else {
1722
+ matchResult_27 = 1;
1723
+ }
1724
+ } else {
1725
+ matchResult_27 = 1;
1726
+ }
1727
+ } else {
1728
+ matchResult_27 = 1;
1729
+ }
1730
+ switch (matchResult_27) {
1731
+ case 0: {
1732
+ handles_3_mut = handles_3;
1733
+ restlist_mut = rest_50;
1734
+ acc_6_mut = acc_6;
1735
+ continue loopRead;
1736
+ }
1737
+ default:
1738
+ if (isEmpty(restlist)) {
1739
+ return YAMLElement_Object(reverse(acc_6));
1740
+ } else {
1741
+ const activePatternResult_40 = $007CYamlValue$007C_$007C(head(restlist));
1742
+ if (activePatternResult_40 != null) {
1743
+ const v_27 = value(activePatternResult_40);
1744
+ const c_13 = restoreCommentReplace(commentDict, v_27.Comment);
1745
+ const props_3 = extractProperties(handles_3, v_27.Value);
1746
+ const patternInput_14 = restoreScalarWithStyle(props_3.Value);
1747
+ handles_3_mut = handles_3;
1748
+ restlist_mut = tail(restlist);
1749
+ acc_6_mut = cons(YAMLElement_Value(YAMLContent_create_Z1C3A29C9(patternInput_14[0], unwrap(c_13), unwrap(props_3.Anchor), unwrap(props_3.Tag), unwrap(patternInput_14[1]))), acc_6);
1750
+ continue loopRead;
1751
+ } else {
1752
+ return toFail(printf("Unknown pattern: %A"))(restlist);
1753
+ }
1754
+ }
1755
+ }
1756
+ }
1757
+ }
1758
+ }
1759
+ }
1760
+ }
1761
+ }
1762
+ }
1763
+ }
1764
+ }
1765
+ }
1766
+ }
1767
+ }
1768
+ }
1769
+ }
1770
+ }
1771
+ }
1772
+ }
1773
+ }
1774
+ }
1775
+ }
1776
+ }
1777
+ }
1778
+ }
1779
+ }
1780
+ break;
1781
+ }
1782
+ };
1783
+ return loopRead(handles, yamlList, empty());
1784
+ }
1785
+ function read(yaml) {
1786
+ const ast = read$1(yaml);
1787
+ const matchValue = ast.AST;
1788
+ if (matchValue.tag === /* Level */
1789
+ 0) {
1790
+ return tokenize(matchValue.fields[0], ast.StringMap, ast.CommentMap, ast.TagHandles);
1791
+ } else {
1792
+ throw new Error("Not a root!");
1793
+ }
1794
+ }
1795
+ function readDocuments(yaml) {
1796
+ const appendCurrentDocument = (currentDoc, docs) => {
1797
+ if (isEmpty(currentDoc)) {
1798
+ return docs;
1799
+ } else {
1800
+ return cons(reverse(currentDoc), docs);
1801
+ }
1802
+ };
1803
+ const splitDocuments = (remaining_mut, currentDoc_1_mut, docs_1_mut, blockHeaderIndent_mut) => {
1804
+ let matchValue;
1805
+ splitDocuments:
1806
+ while (true) {
1807
+ const remaining = remaining_mut, currentDoc_1 = currentDoc_1_mut, docs_1 = docs_1_mut, blockHeaderIndent = blockHeaderIndent_mut;
1808
+ if (!isEmpty(remaining)) {
1809
+ const rest = tail(remaining);
1810
+ const line = head(remaining);
1811
+ if (blockHeaderIndent == null) {
1812
+ if (Document_isTopLevelMarker(Document_isStart, line)) {
1813
+ const inlineContent = Document_tryInlineContentAfterStartMarker(line);
1814
+ if (isEmpty(currentDoc_1) ? true : Document_isDirectivePreludeOnly(currentDoc_1)) {
1815
+ const preludeDirectives = filter((l) => trimStart(l).startsWith("%"), currentDoc_1);
1816
+ remaining_mut = rest;
1817
+ currentDoc_1_mut = inlineContent == null ? preludeDirectives : cons(value(inlineContent), preludeDirectives);
1818
+ docs_1_mut = docs_1;
1819
+ blockHeaderIndent_mut = void 0;
1820
+ continue splitDocuments;
1821
+ } else {
1822
+ const docs$0027 = appendCurrentDocument(currentDoc_1, docs_1);
1823
+ remaining_mut = rest;
1824
+ currentDoc_1_mut = inlineContent == null ? empty() : singleton$1(value(inlineContent));
1825
+ docs_1_mut = docs$0027;
1826
+ blockHeaderIndent_mut = void 0;
1827
+ continue splitDocuments;
1828
+ }
1829
+ } else if (Document_isTopLevelMarker(Document_isEnd, line)) {
1830
+ remaining_mut = rest;
1831
+ currentDoc_1_mut = empty();
1832
+ docs_1_mut = appendCurrentDocument(currentDoc_1, docs_1);
1833
+ blockHeaderIndent_mut = void 0;
1834
+ continue splitDocuments;
1835
+ } else {
1836
+ remaining_mut = rest;
1837
+ currentDoc_1_mut = cons(line, currentDoc_1);
1838
+ docs_1_mut = docs_1;
1839
+ blockHeaderIndent_mut = (matchValue = BlockScalar_tryDetectHeaderIndent(line), matchValue == null ? void 0 : value(matchValue));
1840
+ continue splitDocuments;
1841
+ }
1842
+ } else {
1843
+ const headerIndent = value(blockHeaderIndent) | 0;
1844
+ if (line.trim() === "" ? true : Line_countLeadingSpaces(line) > headerIndent) {
1845
+ remaining_mut = rest;
1846
+ currentDoc_1_mut = cons(line, currentDoc_1);
1847
+ docs_1_mut = docs_1;
1848
+ blockHeaderIndent_mut = blockHeaderIndent;
1849
+ continue splitDocuments;
1850
+ } else {
1851
+ remaining_mut = remaining;
1852
+ currentDoc_1_mut = currentDoc_1;
1853
+ docs_1_mut = docs_1;
1854
+ blockHeaderIndent_mut = void 0;
1855
+ continue splitDocuments;
1856
+ }
1857
+ }
1858
+ } else {
1859
+ return reverse(appendCurrentDocument(currentDoc_1, docs_1));
1860
+ }
1861
+ break;
1862
+ }
1863
+ };
1864
+ return map$1((docLines) => read(join("\n", docLines)), filter((doc) => exists((l_1) => l_1.trim() !== "", doc), splitDocuments(ofArray(split(Line_normalizeNewlines(yaml), ["\n"], void 0, 0)), empty(), empty(), void 0)));
1865
+ }
1866
+
1867
+ export { collectSequenceElements, isSequenceElement, read, readDocuments };