markedin-parser 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/markedin.browser.js +4295 -0
- package/dist/markedin.browser.min.js +126 -0
- package/package.json +4 -2
- package/parse.js +12 -10
|
@@ -0,0 +1,4295 @@
|
|
|
1
|
+
var markedin = (() => {
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __esm = (fn, res) => function __init() {
|
|
7
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
8
|
+
};
|
|
9
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
};
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
|
|
26
|
+
// node_modules/js-yaml/lib/common.js
|
|
27
|
+
var require_common = __commonJS({
|
|
28
|
+
"node_modules/js-yaml/lib/common.js"(exports, module) {
|
|
29
|
+
"use strict";
|
|
30
|
+
function isNothing(subject) {
|
|
31
|
+
return typeof subject === "undefined" || subject === null;
|
|
32
|
+
}
|
|
33
|
+
function isObject(subject) {
|
|
34
|
+
return typeof subject === "object" && subject !== null;
|
|
35
|
+
}
|
|
36
|
+
function toArray(sequence) {
|
|
37
|
+
if (Array.isArray(sequence)) return sequence;
|
|
38
|
+
else if (isNothing(sequence)) return [];
|
|
39
|
+
return [sequence];
|
|
40
|
+
}
|
|
41
|
+
function extend(target, source) {
|
|
42
|
+
var index, length, key, sourceKeys;
|
|
43
|
+
if (source) {
|
|
44
|
+
sourceKeys = Object.keys(source);
|
|
45
|
+
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
46
|
+
key = sourceKeys[index];
|
|
47
|
+
target[key] = source[key];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return target;
|
|
51
|
+
}
|
|
52
|
+
function repeat(string, count) {
|
|
53
|
+
var result = "", cycle;
|
|
54
|
+
for (cycle = 0; cycle < count; cycle += 1) {
|
|
55
|
+
result += string;
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
function isNegativeZero(number) {
|
|
60
|
+
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
61
|
+
}
|
|
62
|
+
module.exports.isNothing = isNothing;
|
|
63
|
+
module.exports.isObject = isObject;
|
|
64
|
+
module.exports.toArray = toArray;
|
|
65
|
+
module.exports.repeat = repeat;
|
|
66
|
+
module.exports.isNegativeZero = isNegativeZero;
|
|
67
|
+
module.exports.extend = extend;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// node_modules/js-yaml/lib/exception.js
|
|
72
|
+
var require_exception = __commonJS({
|
|
73
|
+
"node_modules/js-yaml/lib/exception.js"(exports, module) {
|
|
74
|
+
"use strict";
|
|
75
|
+
function formatError(exception, compact) {
|
|
76
|
+
var where = "", message = exception.reason || "(unknown reason)";
|
|
77
|
+
if (!exception.mark) return message;
|
|
78
|
+
if (exception.mark.name) {
|
|
79
|
+
where += 'in "' + exception.mark.name + '" ';
|
|
80
|
+
}
|
|
81
|
+
where += "(" + (exception.mark.line + 1) + ":" + (exception.mark.column + 1) + ")";
|
|
82
|
+
if (!compact && exception.mark.snippet) {
|
|
83
|
+
where += "\n\n" + exception.mark.snippet;
|
|
84
|
+
}
|
|
85
|
+
return message + " " + where;
|
|
86
|
+
}
|
|
87
|
+
function YAMLException(reason, mark) {
|
|
88
|
+
Error.call(this);
|
|
89
|
+
this.name = "YAMLException";
|
|
90
|
+
this.reason = reason;
|
|
91
|
+
this.mark = mark;
|
|
92
|
+
this.message = formatError(this, false);
|
|
93
|
+
if (Error.captureStackTrace) {
|
|
94
|
+
Error.captureStackTrace(this, this.constructor);
|
|
95
|
+
} else {
|
|
96
|
+
this.stack = new Error().stack || "";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
YAMLException.prototype = Object.create(Error.prototype);
|
|
100
|
+
YAMLException.prototype.constructor = YAMLException;
|
|
101
|
+
YAMLException.prototype.toString = function toString(compact) {
|
|
102
|
+
return this.name + ": " + formatError(this, compact);
|
|
103
|
+
};
|
|
104
|
+
module.exports = YAMLException;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// node_modules/js-yaml/lib/snippet.js
|
|
109
|
+
var require_snippet = __commonJS({
|
|
110
|
+
"node_modules/js-yaml/lib/snippet.js"(exports, module) {
|
|
111
|
+
"use strict";
|
|
112
|
+
var common = require_common();
|
|
113
|
+
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
114
|
+
var head = "";
|
|
115
|
+
var tail = "";
|
|
116
|
+
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
117
|
+
if (position - lineStart > maxHalfLength) {
|
|
118
|
+
head = " ... ";
|
|
119
|
+
lineStart = position - maxHalfLength + head.length;
|
|
120
|
+
}
|
|
121
|
+
if (lineEnd - position > maxHalfLength) {
|
|
122
|
+
tail = " ...";
|
|
123
|
+
lineEnd = position + maxHalfLength - tail.length;
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
|
|
127
|
+
pos: position - lineStart + head.length
|
|
128
|
+
// relative position
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function padStart(string, max) {
|
|
132
|
+
return common.repeat(" ", max - string.length) + string;
|
|
133
|
+
}
|
|
134
|
+
function makeSnippet(mark, options) {
|
|
135
|
+
options = Object.create(options || null);
|
|
136
|
+
if (!mark.buffer) return null;
|
|
137
|
+
if (!options.maxLength) options.maxLength = 79;
|
|
138
|
+
if (typeof options.indent !== "number") options.indent = 1;
|
|
139
|
+
if (typeof options.linesBefore !== "number") options.linesBefore = 3;
|
|
140
|
+
if (typeof options.linesAfter !== "number") options.linesAfter = 2;
|
|
141
|
+
var re2 = /\r?\n|\r|\0/g;
|
|
142
|
+
var lineStarts = [0];
|
|
143
|
+
var lineEnds = [];
|
|
144
|
+
var match;
|
|
145
|
+
var foundLineNo = -1;
|
|
146
|
+
while (match = re2.exec(mark.buffer)) {
|
|
147
|
+
lineEnds.push(match.index);
|
|
148
|
+
lineStarts.push(match.index + match[0].length);
|
|
149
|
+
if (mark.position <= match.index && foundLineNo < 0) {
|
|
150
|
+
foundLineNo = lineStarts.length - 2;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
|
154
|
+
var result = "", i, line;
|
|
155
|
+
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
|
156
|
+
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
|
157
|
+
for (i = 1; i <= options.linesBefore; i++) {
|
|
158
|
+
if (foundLineNo - i < 0) break;
|
|
159
|
+
line = getLine(
|
|
160
|
+
mark.buffer,
|
|
161
|
+
lineStarts[foundLineNo - i],
|
|
162
|
+
lineEnds[foundLineNo - i],
|
|
163
|
+
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
|
|
164
|
+
maxLineLength
|
|
165
|
+
);
|
|
166
|
+
result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
|
|
167
|
+
}
|
|
168
|
+
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
169
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
170
|
+
result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
|
|
171
|
+
for (i = 1; i <= options.linesAfter; i++) {
|
|
172
|
+
if (foundLineNo + i >= lineEnds.length) break;
|
|
173
|
+
line = getLine(
|
|
174
|
+
mark.buffer,
|
|
175
|
+
lineStarts[foundLineNo + i],
|
|
176
|
+
lineEnds[foundLineNo + i],
|
|
177
|
+
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
|
|
178
|
+
maxLineLength
|
|
179
|
+
);
|
|
180
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
181
|
+
}
|
|
182
|
+
return result.replace(/\n$/, "");
|
|
183
|
+
}
|
|
184
|
+
module.exports = makeSnippet;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// node_modules/js-yaml/lib/type.js
|
|
189
|
+
var require_type = __commonJS({
|
|
190
|
+
"node_modules/js-yaml/lib/type.js"(exports, module) {
|
|
191
|
+
"use strict";
|
|
192
|
+
var YAMLException = require_exception();
|
|
193
|
+
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
194
|
+
"kind",
|
|
195
|
+
"multi",
|
|
196
|
+
"resolve",
|
|
197
|
+
"construct",
|
|
198
|
+
"instanceOf",
|
|
199
|
+
"predicate",
|
|
200
|
+
"represent",
|
|
201
|
+
"representName",
|
|
202
|
+
"defaultStyle",
|
|
203
|
+
"styleAliases"
|
|
204
|
+
];
|
|
205
|
+
var YAML_NODE_KINDS = [
|
|
206
|
+
"scalar",
|
|
207
|
+
"sequence",
|
|
208
|
+
"mapping"
|
|
209
|
+
];
|
|
210
|
+
function compileStyleAliases(map) {
|
|
211
|
+
var result = {};
|
|
212
|
+
if (map !== null) {
|
|
213
|
+
Object.keys(map).forEach(function(style) {
|
|
214
|
+
map[style].forEach(function(alias) {
|
|
215
|
+
result[String(alias)] = style;
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
return result;
|
|
220
|
+
}
|
|
221
|
+
function Type(tag, options) {
|
|
222
|
+
options = options || {};
|
|
223
|
+
Object.keys(options).forEach(function(name) {
|
|
224
|
+
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
225
|
+
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
this.options = options;
|
|
229
|
+
this.tag = tag;
|
|
230
|
+
this.kind = options["kind"] || null;
|
|
231
|
+
this.resolve = options["resolve"] || function() {
|
|
232
|
+
return true;
|
|
233
|
+
};
|
|
234
|
+
this.construct = options["construct"] || function(data) {
|
|
235
|
+
return data;
|
|
236
|
+
};
|
|
237
|
+
this.instanceOf = options["instanceOf"] || null;
|
|
238
|
+
this.predicate = options["predicate"] || null;
|
|
239
|
+
this.represent = options["represent"] || null;
|
|
240
|
+
this.representName = options["representName"] || null;
|
|
241
|
+
this.defaultStyle = options["defaultStyle"] || null;
|
|
242
|
+
this.multi = options["multi"] || false;
|
|
243
|
+
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
|
244
|
+
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
|
245
|
+
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
module.exports = Type;
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
// node_modules/js-yaml/lib/schema.js
|
|
253
|
+
var require_schema = __commonJS({
|
|
254
|
+
"node_modules/js-yaml/lib/schema.js"(exports, module) {
|
|
255
|
+
"use strict";
|
|
256
|
+
var YAMLException = require_exception();
|
|
257
|
+
var Type = require_type();
|
|
258
|
+
function compileList(schema, name) {
|
|
259
|
+
var result = [];
|
|
260
|
+
schema[name].forEach(function(currentType) {
|
|
261
|
+
var newIndex = result.length;
|
|
262
|
+
result.forEach(function(previousType, previousIndex) {
|
|
263
|
+
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
264
|
+
newIndex = previousIndex;
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
result[newIndex] = currentType;
|
|
268
|
+
});
|
|
269
|
+
return result;
|
|
270
|
+
}
|
|
271
|
+
function compileMap() {
|
|
272
|
+
var result = {
|
|
273
|
+
scalar: {},
|
|
274
|
+
sequence: {},
|
|
275
|
+
mapping: {},
|
|
276
|
+
fallback: {},
|
|
277
|
+
multi: {
|
|
278
|
+
scalar: [],
|
|
279
|
+
sequence: [],
|
|
280
|
+
mapping: [],
|
|
281
|
+
fallback: []
|
|
282
|
+
}
|
|
283
|
+
}, index, length;
|
|
284
|
+
function collectType(type) {
|
|
285
|
+
if (type.multi) {
|
|
286
|
+
result.multi[type.kind].push(type);
|
|
287
|
+
result.multi["fallback"].push(type);
|
|
288
|
+
} else {
|
|
289
|
+
result[type.kind][type.tag] = result["fallback"][type.tag] = type;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
for (index = 0, length = arguments.length; index < length; index += 1) {
|
|
293
|
+
arguments[index].forEach(collectType);
|
|
294
|
+
}
|
|
295
|
+
return result;
|
|
296
|
+
}
|
|
297
|
+
function Schema(definition) {
|
|
298
|
+
return this.extend(definition);
|
|
299
|
+
}
|
|
300
|
+
Schema.prototype.extend = function extend(definition) {
|
|
301
|
+
var implicit = [];
|
|
302
|
+
var explicit = [];
|
|
303
|
+
if (definition instanceof Type) {
|
|
304
|
+
explicit.push(definition);
|
|
305
|
+
} else if (Array.isArray(definition)) {
|
|
306
|
+
explicit = explicit.concat(definition);
|
|
307
|
+
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
|
308
|
+
if (definition.implicit) implicit = implicit.concat(definition.implicit);
|
|
309
|
+
if (definition.explicit) explicit = explicit.concat(definition.explicit);
|
|
310
|
+
} else {
|
|
311
|
+
throw new YAMLException("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
312
|
+
}
|
|
313
|
+
implicit.forEach(function(type) {
|
|
314
|
+
if (!(type instanceof Type)) {
|
|
315
|
+
throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
316
|
+
}
|
|
317
|
+
if (type.loadKind && type.loadKind !== "scalar") {
|
|
318
|
+
throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
319
|
+
}
|
|
320
|
+
if (type.multi) {
|
|
321
|
+
throw new YAMLException("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
explicit.forEach(function(type) {
|
|
325
|
+
if (!(type instanceof Type)) {
|
|
326
|
+
throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
var result = Object.create(Schema.prototype);
|
|
330
|
+
result.implicit = (this.implicit || []).concat(implicit);
|
|
331
|
+
result.explicit = (this.explicit || []).concat(explicit);
|
|
332
|
+
result.compiledImplicit = compileList(result, "implicit");
|
|
333
|
+
result.compiledExplicit = compileList(result, "explicit");
|
|
334
|
+
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
|
335
|
+
return result;
|
|
336
|
+
};
|
|
337
|
+
module.exports = Schema;
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
// node_modules/js-yaml/lib/type/str.js
|
|
342
|
+
var require_str = __commonJS({
|
|
343
|
+
"node_modules/js-yaml/lib/type/str.js"(exports, module) {
|
|
344
|
+
"use strict";
|
|
345
|
+
var Type = require_type();
|
|
346
|
+
module.exports = new Type("tag:yaml.org,2002:str", {
|
|
347
|
+
kind: "scalar",
|
|
348
|
+
construct: function(data) {
|
|
349
|
+
return data !== null ? data : "";
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
// node_modules/js-yaml/lib/type/seq.js
|
|
356
|
+
var require_seq = __commonJS({
|
|
357
|
+
"node_modules/js-yaml/lib/type/seq.js"(exports, module) {
|
|
358
|
+
"use strict";
|
|
359
|
+
var Type = require_type();
|
|
360
|
+
module.exports = new Type("tag:yaml.org,2002:seq", {
|
|
361
|
+
kind: "sequence",
|
|
362
|
+
construct: function(data) {
|
|
363
|
+
return data !== null ? data : [];
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
// node_modules/js-yaml/lib/type/map.js
|
|
370
|
+
var require_map = __commonJS({
|
|
371
|
+
"node_modules/js-yaml/lib/type/map.js"(exports, module) {
|
|
372
|
+
"use strict";
|
|
373
|
+
var Type = require_type();
|
|
374
|
+
module.exports = new Type("tag:yaml.org,2002:map", {
|
|
375
|
+
kind: "mapping",
|
|
376
|
+
construct: function(data) {
|
|
377
|
+
return data !== null ? data : {};
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
// node_modules/js-yaml/lib/schema/failsafe.js
|
|
384
|
+
var require_failsafe = __commonJS({
|
|
385
|
+
"node_modules/js-yaml/lib/schema/failsafe.js"(exports, module) {
|
|
386
|
+
"use strict";
|
|
387
|
+
var Schema = require_schema();
|
|
388
|
+
module.exports = new Schema({
|
|
389
|
+
explicit: [
|
|
390
|
+
require_str(),
|
|
391
|
+
require_seq(),
|
|
392
|
+
require_map()
|
|
393
|
+
]
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
// node_modules/js-yaml/lib/type/null.js
|
|
399
|
+
var require_null = __commonJS({
|
|
400
|
+
"node_modules/js-yaml/lib/type/null.js"(exports, module) {
|
|
401
|
+
"use strict";
|
|
402
|
+
var Type = require_type();
|
|
403
|
+
function resolveYamlNull(data) {
|
|
404
|
+
if (data === null) return true;
|
|
405
|
+
var max = data.length;
|
|
406
|
+
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
|
407
|
+
}
|
|
408
|
+
function constructYamlNull() {
|
|
409
|
+
return null;
|
|
410
|
+
}
|
|
411
|
+
function isNull(object) {
|
|
412
|
+
return object === null;
|
|
413
|
+
}
|
|
414
|
+
module.exports = new Type("tag:yaml.org,2002:null", {
|
|
415
|
+
kind: "scalar",
|
|
416
|
+
resolve: resolveYamlNull,
|
|
417
|
+
construct: constructYamlNull,
|
|
418
|
+
predicate: isNull,
|
|
419
|
+
represent: {
|
|
420
|
+
canonical: function() {
|
|
421
|
+
return "~";
|
|
422
|
+
},
|
|
423
|
+
lowercase: function() {
|
|
424
|
+
return "null";
|
|
425
|
+
},
|
|
426
|
+
uppercase: function() {
|
|
427
|
+
return "NULL";
|
|
428
|
+
},
|
|
429
|
+
camelcase: function() {
|
|
430
|
+
return "Null";
|
|
431
|
+
},
|
|
432
|
+
empty: function() {
|
|
433
|
+
return "";
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
defaultStyle: "lowercase"
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
// node_modules/js-yaml/lib/type/bool.js
|
|
442
|
+
var require_bool = __commonJS({
|
|
443
|
+
"node_modules/js-yaml/lib/type/bool.js"(exports, module) {
|
|
444
|
+
"use strict";
|
|
445
|
+
var Type = require_type();
|
|
446
|
+
function resolveYamlBoolean(data) {
|
|
447
|
+
if (data === null) return false;
|
|
448
|
+
var max = data.length;
|
|
449
|
+
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
|
450
|
+
}
|
|
451
|
+
function constructYamlBoolean(data) {
|
|
452
|
+
return data === "true" || data === "True" || data === "TRUE";
|
|
453
|
+
}
|
|
454
|
+
function isBoolean(object) {
|
|
455
|
+
return Object.prototype.toString.call(object) === "[object Boolean]";
|
|
456
|
+
}
|
|
457
|
+
module.exports = new Type("tag:yaml.org,2002:bool", {
|
|
458
|
+
kind: "scalar",
|
|
459
|
+
resolve: resolveYamlBoolean,
|
|
460
|
+
construct: constructYamlBoolean,
|
|
461
|
+
predicate: isBoolean,
|
|
462
|
+
represent: {
|
|
463
|
+
lowercase: function(object) {
|
|
464
|
+
return object ? "true" : "false";
|
|
465
|
+
},
|
|
466
|
+
uppercase: function(object) {
|
|
467
|
+
return object ? "TRUE" : "FALSE";
|
|
468
|
+
},
|
|
469
|
+
camelcase: function(object) {
|
|
470
|
+
return object ? "True" : "False";
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
defaultStyle: "lowercase"
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
// node_modules/js-yaml/lib/type/int.js
|
|
479
|
+
var require_int = __commonJS({
|
|
480
|
+
"node_modules/js-yaml/lib/type/int.js"(exports, module) {
|
|
481
|
+
"use strict";
|
|
482
|
+
var common = require_common();
|
|
483
|
+
var Type = require_type();
|
|
484
|
+
function isHexCode(c) {
|
|
485
|
+
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
|
486
|
+
}
|
|
487
|
+
function isOctCode(c) {
|
|
488
|
+
return 48 <= c && c <= 55;
|
|
489
|
+
}
|
|
490
|
+
function isDecCode(c) {
|
|
491
|
+
return 48 <= c && c <= 57;
|
|
492
|
+
}
|
|
493
|
+
function resolveYamlInteger(data) {
|
|
494
|
+
if (data === null) return false;
|
|
495
|
+
var max = data.length, index = 0, hasDigits = false, ch;
|
|
496
|
+
if (!max) return false;
|
|
497
|
+
ch = data[index];
|
|
498
|
+
if (ch === "-" || ch === "+") {
|
|
499
|
+
ch = data[++index];
|
|
500
|
+
}
|
|
501
|
+
if (ch === "0") {
|
|
502
|
+
if (index + 1 === max) return true;
|
|
503
|
+
ch = data[++index];
|
|
504
|
+
if (ch === "b") {
|
|
505
|
+
index++;
|
|
506
|
+
for (; index < max; index++) {
|
|
507
|
+
ch = data[index];
|
|
508
|
+
if (ch === "_") continue;
|
|
509
|
+
if (ch !== "0" && ch !== "1") return false;
|
|
510
|
+
hasDigits = true;
|
|
511
|
+
}
|
|
512
|
+
return hasDigits && ch !== "_";
|
|
513
|
+
}
|
|
514
|
+
if (ch === "x") {
|
|
515
|
+
index++;
|
|
516
|
+
for (; index < max; index++) {
|
|
517
|
+
ch = data[index];
|
|
518
|
+
if (ch === "_") continue;
|
|
519
|
+
if (!isHexCode(data.charCodeAt(index))) return false;
|
|
520
|
+
hasDigits = true;
|
|
521
|
+
}
|
|
522
|
+
return hasDigits && ch !== "_";
|
|
523
|
+
}
|
|
524
|
+
if (ch === "o") {
|
|
525
|
+
index++;
|
|
526
|
+
for (; index < max; index++) {
|
|
527
|
+
ch = data[index];
|
|
528
|
+
if (ch === "_") continue;
|
|
529
|
+
if (!isOctCode(data.charCodeAt(index))) return false;
|
|
530
|
+
hasDigits = true;
|
|
531
|
+
}
|
|
532
|
+
return hasDigits && ch !== "_";
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
if (ch === "_") return false;
|
|
536
|
+
for (; index < max; index++) {
|
|
537
|
+
ch = data[index];
|
|
538
|
+
if (ch === "_") continue;
|
|
539
|
+
if (!isDecCode(data.charCodeAt(index))) {
|
|
540
|
+
return false;
|
|
541
|
+
}
|
|
542
|
+
hasDigits = true;
|
|
543
|
+
}
|
|
544
|
+
if (!hasDigits || ch === "_") return false;
|
|
545
|
+
return true;
|
|
546
|
+
}
|
|
547
|
+
function constructYamlInteger(data) {
|
|
548
|
+
var value = data, sign = 1, ch;
|
|
549
|
+
if (value.indexOf("_") !== -1) {
|
|
550
|
+
value = value.replace(/_/g, "");
|
|
551
|
+
}
|
|
552
|
+
ch = value[0];
|
|
553
|
+
if (ch === "-" || ch === "+") {
|
|
554
|
+
if (ch === "-") sign = -1;
|
|
555
|
+
value = value.slice(1);
|
|
556
|
+
ch = value[0];
|
|
557
|
+
}
|
|
558
|
+
if (value === "0") return 0;
|
|
559
|
+
if (ch === "0") {
|
|
560
|
+
if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
|
|
561
|
+
if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
|
|
562
|
+
if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
|
|
563
|
+
}
|
|
564
|
+
return sign * parseInt(value, 10);
|
|
565
|
+
}
|
|
566
|
+
function isInteger(object) {
|
|
567
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
|
568
|
+
}
|
|
569
|
+
module.exports = new Type("tag:yaml.org,2002:int", {
|
|
570
|
+
kind: "scalar",
|
|
571
|
+
resolve: resolveYamlInteger,
|
|
572
|
+
construct: constructYamlInteger,
|
|
573
|
+
predicate: isInteger,
|
|
574
|
+
represent: {
|
|
575
|
+
binary: function(obj) {
|
|
576
|
+
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
577
|
+
},
|
|
578
|
+
octal: function(obj) {
|
|
579
|
+
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
|
580
|
+
},
|
|
581
|
+
decimal: function(obj) {
|
|
582
|
+
return obj.toString(10);
|
|
583
|
+
},
|
|
584
|
+
/* eslint-disable max-len */
|
|
585
|
+
hexadecimal: function(obj) {
|
|
586
|
+
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
defaultStyle: "decimal",
|
|
590
|
+
styleAliases: {
|
|
591
|
+
binary: [2, "bin"],
|
|
592
|
+
octal: [8, "oct"],
|
|
593
|
+
decimal: [10, "dec"],
|
|
594
|
+
hexadecimal: [16, "hex"]
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
// node_modules/js-yaml/lib/type/float.js
|
|
601
|
+
var require_float = __commonJS({
|
|
602
|
+
"node_modules/js-yaml/lib/type/float.js"(exports, module) {
|
|
603
|
+
"use strict";
|
|
604
|
+
var common = require_common();
|
|
605
|
+
var Type = require_type();
|
|
606
|
+
var YAML_FLOAT_PATTERN = new RegExp(
|
|
607
|
+
// 2.5e4, 2.5 and integers
|
|
608
|
+
"^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
|
609
|
+
);
|
|
610
|
+
function resolveYamlFloat(data) {
|
|
611
|
+
if (data === null) return false;
|
|
612
|
+
if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
|
|
613
|
+
// Probably should update regexp & check speed
|
|
614
|
+
data[data.length - 1] === "_") {
|
|
615
|
+
return false;
|
|
616
|
+
}
|
|
617
|
+
return true;
|
|
618
|
+
}
|
|
619
|
+
function constructYamlFloat(data) {
|
|
620
|
+
var value, sign;
|
|
621
|
+
value = data.replace(/_/g, "").toLowerCase();
|
|
622
|
+
sign = value[0] === "-" ? -1 : 1;
|
|
623
|
+
if ("+-".indexOf(value[0]) >= 0) {
|
|
624
|
+
value = value.slice(1);
|
|
625
|
+
}
|
|
626
|
+
if (value === ".inf") {
|
|
627
|
+
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
628
|
+
} else if (value === ".nan") {
|
|
629
|
+
return NaN;
|
|
630
|
+
}
|
|
631
|
+
return sign * parseFloat(value, 10);
|
|
632
|
+
}
|
|
633
|
+
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
634
|
+
function representYamlFloat(object, style) {
|
|
635
|
+
var res;
|
|
636
|
+
if (isNaN(object)) {
|
|
637
|
+
switch (style) {
|
|
638
|
+
case "lowercase":
|
|
639
|
+
return ".nan";
|
|
640
|
+
case "uppercase":
|
|
641
|
+
return ".NAN";
|
|
642
|
+
case "camelcase":
|
|
643
|
+
return ".NaN";
|
|
644
|
+
}
|
|
645
|
+
} else if (Number.POSITIVE_INFINITY === object) {
|
|
646
|
+
switch (style) {
|
|
647
|
+
case "lowercase":
|
|
648
|
+
return ".inf";
|
|
649
|
+
case "uppercase":
|
|
650
|
+
return ".INF";
|
|
651
|
+
case "camelcase":
|
|
652
|
+
return ".Inf";
|
|
653
|
+
}
|
|
654
|
+
} else if (Number.NEGATIVE_INFINITY === object) {
|
|
655
|
+
switch (style) {
|
|
656
|
+
case "lowercase":
|
|
657
|
+
return "-.inf";
|
|
658
|
+
case "uppercase":
|
|
659
|
+
return "-.INF";
|
|
660
|
+
case "camelcase":
|
|
661
|
+
return "-.Inf";
|
|
662
|
+
}
|
|
663
|
+
} else if (common.isNegativeZero(object)) {
|
|
664
|
+
return "-0.0";
|
|
665
|
+
}
|
|
666
|
+
res = object.toString(10);
|
|
667
|
+
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
668
|
+
}
|
|
669
|
+
function isFloat(object) {
|
|
670
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
|
671
|
+
}
|
|
672
|
+
module.exports = new Type("tag:yaml.org,2002:float", {
|
|
673
|
+
kind: "scalar",
|
|
674
|
+
resolve: resolveYamlFloat,
|
|
675
|
+
construct: constructYamlFloat,
|
|
676
|
+
predicate: isFloat,
|
|
677
|
+
represent: representYamlFloat,
|
|
678
|
+
defaultStyle: "lowercase"
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
// node_modules/js-yaml/lib/schema/json.js
|
|
684
|
+
var require_json = __commonJS({
|
|
685
|
+
"node_modules/js-yaml/lib/schema/json.js"(exports, module) {
|
|
686
|
+
"use strict";
|
|
687
|
+
module.exports = require_failsafe().extend({
|
|
688
|
+
implicit: [
|
|
689
|
+
require_null(),
|
|
690
|
+
require_bool(),
|
|
691
|
+
require_int(),
|
|
692
|
+
require_float()
|
|
693
|
+
]
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
|
|
698
|
+
// node_modules/js-yaml/lib/schema/core.js
|
|
699
|
+
var require_core = __commonJS({
|
|
700
|
+
"node_modules/js-yaml/lib/schema/core.js"(exports, module) {
|
|
701
|
+
"use strict";
|
|
702
|
+
module.exports = require_json();
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
|
|
706
|
+
// node_modules/js-yaml/lib/type/timestamp.js
|
|
707
|
+
var require_timestamp = __commonJS({
|
|
708
|
+
"node_modules/js-yaml/lib/type/timestamp.js"(exports, module) {
|
|
709
|
+
"use strict";
|
|
710
|
+
var Type = require_type();
|
|
711
|
+
var YAML_DATE_REGEXP = new RegExp(
|
|
712
|
+
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
|
713
|
+
);
|
|
714
|
+
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
|
715
|
+
"^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
|
|
716
|
+
);
|
|
717
|
+
function resolveYamlTimestamp(data) {
|
|
718
|
+
if (data === null) return false;
|
|
719
|
+
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
|
720
|
+
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
|
721
|
+
return false;
|
|
722
|
+
}
|
|
723
|
+
function constructYamlTimestamp(data) {
|
|
724
|
+
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
|
725
|
+
match = YAML_DATE_REGEXP.exec(data);
|
|
726
|
+
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
727
|
+
if (match === null) throw new Error("Date resolve error");
|
|
728
|
+
year = +match[1];
|
|
729
|
+
month = +match[2] - 1;
|
|
730
|
+
day = +match[3];
|
|
731
|
+
if (!match[4]) {
|
|
732
|
+
return new Date(Date.UTC(year, month, day));
|
|
733
|
+
}
|
|
734
|
+
hour = +match[4];
|
|
735
|
+
minute = +match[5];
|
|
736
|
+
second = +match[6];
|
|
737
|
+
if (match[7]) {
|
|
738
|
+
fraction = match[7].slice(0, 3);
|
|
739
|
+
while (fraction.length < 3) {
|
|
740
|
+
fraction += "0";
|
|
741
|
+
}
|
|
742
|
+
fraction = +fraction;
|
|
743
|
+
}
|
|
744
|
+
if (match[9]) {
|
|
745
|
+
tz_hour = +match[10];
|
|
746
|
+
tz_minute = +(match[11] || 0);
|
|
747
|
+
delta = (tz_hour * 60 + tz_minute) * 6e4;
|
|
748
|
+
if (match[9] === "-") delta = -delta;
|
|
749
|
+
}
|
|
750
|
+
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
751
|
+
if (delta) date.setTime(date.getTime() - delta);
|
|
752
|
+
return date;
|
|
753
|
+
}
|
|
754
|
+
function representYamlTimestamp(object) {
|
|
755
|
+
return object.toISOString();
|
|
756
|
+
}
|
|
757
|
+
module.exports = new Type("tag:yaml.org,2002:timestamp", {
|
|
758
|
+
kind: "scalar",
|
|
759
|
+
resolve: resolveYamlTimestamp,
|
|
760
|
+
construct: constructYamlTimestamp,
|
|
761
|
+
instanceOf: Date,
|
|
762
|
+
represent: representYamlTimestamp
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
// node_modules/js-yaml/lib/type/merge.js
|
|
768
|
+
var require_merge = __commonJS({
|
|
769
|
+
"node_modules/js-yaml/lib/type/merge.js"(exports, module) {
|
|
770
|
+
"use strict";
|
|
771
|
+
var Type = require_type();
|
|
772
|
+
function resolveYamlMerge(data) {
|
|
773
|
+
return data === "<<" || data === null;
|
|
774
|
+
}
|
|
775
|
+
module.exports = new Type("tag:yaml.org,2002:merge", {
|
|
776
|
+
kind: "scalar",
|
|
777
|
+
resolve: resolveYamlMerge
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
|
|
782
|
+
// node_modules/js-yaml/lib/type/binary.js
|
|
783
|
+
var require_binary = __commonJS({
|
|
784
|
+
"node_modules/js-yaml/lib/type/binary.js"(exports, module) {
|
|
785
|
+
"use strict";
|
|
786
|
+
var Type = require_type();
|
|
787
|
+
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
788
|
+
function resolveYamlBinary(data) {
|
|
789
|
+
if (data === null) return false;
|
|
790
|
+
var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
|
|
791
|
+
for (idx = 0; idx < max; idx++) {
|
|
792
|
+
code = map.indexOf(data.charAt(idx));
|
|
793
|
+
if (code > 64) continue;
|
|
794
|
+
if (code < 0) return false;
|
|
795
|
+
bitlen += 6;
|
|
796
|
+
}
|
|
797
|
+
return bitlen % 8 === 0;
|
|
798
|
+
}
|
|
799
|
+
function constructYamlBinary(data) {
|
|
800
|
+
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map = BASE64_MAP, bits = 0, result = [];
|
|
801
|
+
for (idx = 0; idx < max; idx++) {
|
|
802
|
+
if (idx % 4 === 0 && idx) {
|
|
803
|
+
result.push(bits >> 16 & 255);
|
|
804
|
+
result.push(bits >> 8 & 255);
|
|
805
|
+
result.push(bits & 255);
|
|
806
|
+
}
|
|
807
|
+
bits = bits << 6 | map.indexOf(input.charAt(idx));
|
|
808
|
+
}
|
|
809
|
+
tailbits = max % 4 * 6;
|
|
810
|
+
if (tailbits === 0) {
|
|
811
|
+
result.push(bits >> 16 & 255);
|
|
812
|
+
result.push(bits >> 8 & 255);
|
|
813
|
+
result.push(bits & 255);
|
|
814
|
+
} else if (tailbits === 18) {
|
|
815
|
+
result.push(bits >> 10 & 255);
|
|
816
|
+
result.push(bits >> 2 & 255);
|
|
817
|
+
} else if (tailbits === 12) {
|
|
818
|
+
result.push(bits >> 4 & 255);
|
|
819
|
+
}
|
|
820
|
+
return new Uint8Array(result);
|
|
821
|
+
}
|
|
822
|
+
function representYamlBinary(object) {
|
|
823
|
+
var result = "", bits = 0, idx, tail, max = object.length, map = BASE64_MAP;
|
|
824
|
+
for (idx = 0; idx < max; idx++) {
|
|
825
|
+
if (idx % 3 === 0 && idx) {
|
|
826
|
+
result += map[bits >> 18 & 63];
|
|
827
|
+
result += map[bits >> 12 & 63];
|
|
828
|
+
result += map[bits >> 6 & 63];
|
|
829
|
+
result += map[bits & 63];
|
|
830
|
+
}
|
|
831
|
+
bits = (bits << 8) + object[idx];
|
|
832
|
+
}
|
|
833
|
+
tail = max % 3;
|
|
834
|
+
if (tail === 0) {
|
|
835
|
+
result += map[bits >> 18 & 63];
|
|
836
|
+
result += map[bits >> 12 & 63];
|
|
837
|
+
result += map[bits >> 6 & 63];
|
|
838
|
+
result += map[bits & 63];
|
|
839
|
+
} else if (tail === 2) {
|
|
840
|
+
result += map[bits >> 10 & 63];
|
|
841
|
+
result += map[bits >> 4 & 63];
|
|
842
|
+
result += map[bits << 2 & 63];
|
|
843
|
+
result += map[64];
|
|
844
|
+
} else if (tail === 1) {
|
|
845
|
+
result += map[bits >> 2 & 63];
|
|
846
|
+
result += map[bits << 4 & 63];
|
|
847
|
+
result += map[64];
|
|
848
|
+
result += map[64];
|
|
849
|
+
}
|
|
850
|
+
return result;
|
|
851
|
+
}
|
|
852
|
+
function isBinary(obj) {
|
|
853
|
+
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
|
854
|
+
}
|
|
855
|
+
module.exports = new Type("tag:yaml.org,2002:binary", {
|
|
856
|
+
kind: "scalar",
|
|
857
|
+
resolve: resolveYamlBinary,
|
|
858
|
+
construct: constructYamlBinary,
|
|
859
|
+
predicate: isBinary,
|
|
860
|
+
represent: representYamlBinary
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
|
|
865
|
+
// node_modules/js-yaml/lib/type/omap.js
|
|
866
|
+
var require_omap = __commonJS({
|
|
867
|
+
"node_modules/js-yaml/lib/type/omap.js"(exports, module) {
|
|
868
|
+
"use strict";
|
|
869
|
+
var Type = require_type();
|
|
870
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
871
|
+
var _toString = Object.prototype.toString;
|
|
872
|
+
function resolveYamlOmap(data) {
|
|
873
|
+
if (data === null) return true;
|
|
874
|
+
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
|
|
875
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
876
|
+
pair = object[index];
|
|
877
|
+
pairHasKey = false;
|
|
878
|
+
if (_toString.call(pair) !== "[object Object]") return false;
|
|
879
|
+
for (pairKey in pair) {
|
|
880
|
+
if (_hasOwnProperty.call(pair, pairKey)) {
|
|
881
|
+
if (!pairHasKey) pairHasKey = true;
|
|
882
|
+
else return false;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
if (!pairHasKey) return false;
|
|
886
|
+
if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
|
|
887
|
+
else return false;
|
|
888
|
+
}
|
|
889
|
+
return true;
|
|
890
|
+
}
|
|
891
|
+
function constructYamlOmap(data) {
|
|
892
|
+
return data !== null ? data : [];
|
|
893
|
+
}
|
|
894
|
+
module.exports = new Type("tag:yaml.org,2002:omap", {
|
|
895
|
+
kind: "sequence",
|
|
896
|
+
resolve: resolveYamlOmap,
|
|
897
|
+
construct: constructYamlOmap
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
|
|
902
|
+
// node_modules/js-yaml/lib/type/pairs.js
|
|
903
|
+
var require_pairs = __commonJS({
|
|
904
|
+
"node_modules/js-yaml/lib/type/pairs.js"(exports, module) {
|
|
905
|
+
"use strict";
|
|
906
|
+
var Type = require_type();
|
|
907
|
+
var _toString = Object.prototype.toString;
|
|
908
|
+
function resolveYamlPairs(data) {
|
|
909
|
+
if (data === null) return true;
|
|
910
|
+
var index, length, pair, keys, result, object = data;
|
|
911
|
+
result = new Array(object.length);
|
|
912
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
913
|
+
pair = object[index];
|
|
914
|
+
if (_toString.call(pair) !== "[object Object]") return false;
|
|
915
|
+
keys = Object.keys(pair);
|
|
916
|
+
if (keys.length !== 1) return false;
|
|
917
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
918
|
+
}
|
|
919
|
+
return true;
|
|
920
|
+
}
|
|
921
|
+
function constructYamlPairs(data) {
|
|
922
|
+
if (data === null) return [];
|
|
923
|
+
var index, length, pair, keys, result, object = data;
|
|
924
|
+
result = new Array(object.length);
|
|
925
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
926
|
+
pair = object[index];
|
|
927
|
+
keys = Object.keys(pair);
|
|
928
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
929
|
+
}
|
|
930
|
+
return result;
|
|
931
|
+
}
|
|
932
|
+
module.exports = new Type("tag:yaml.org,2002:pairs", {
|
|
933
|
+
kind: "sequence",
|
|
934
|
+
resolve: resolveYamlPairs,
|
|
935
|
+
construct: constructYamlPairs
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
});
|
|
939
|
+
|
|
940
|
+
// node_modules/js-yaml/lib/type/set.js
|
|
941
|
+
var require_set = __commonJS({
|
|
942
|
+
"node_modules/js-yaml/lib/type/set.js"(exports, module) {
|
|
943
|
+
"use strict";
|
|
944
|
+
var Type = require_type();
|
|
945
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
946
|
+
function resolveYamlSet(data) {
|
|
947
|
+
if (data === null) return true;
|
|
948
|
+
var key, object = data;
|
|
949
|
+
for (key in object) {
|
|
950
|
+
if (_hasOwnProperty.call(object, key)) {
|
|
951
|
+
if (object[key] !== null) return false;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
return true;
|
|
955
|
+
}
|
|
956
|
+
function constructYamlSet(data) {
|
|
957
|
+
return data !== null ? data : {};
|
|
958
|
+
}
|
|
959
|
+
module.exports = new Type("tag:yaml.org,2002:set", {
|
|
960
|
+
kind: "mapping",
|
|
961
|
+
resolve: resolveYamlSet,
|
|
962
|
+
construct: constructYamlSet
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
});
|
|
966
|
+
|
|
967
|
+
// node_modules/js-yaml/lib/schema/default.js
|
|
968
|
+
var require_default = __commonJS({
|
|
969
|
+
"node_modules/js-yaml/lib/schema/default.js"(exports, module) {
|
|
970
|
+
"use strict";
|
|
971
|
+
module.exports = require_core().extend({
|
|
972
|
+
implicit: [
|
|
973
|
+
require_timestamp(),
|
|
974
|
+
require_merge()
|
|
975
|
+
],
|
|
976
|
+
explicit: [
|
|
977
|
+
require_binary(),
|
|
978
|
+
require_omap(),
|
|
979
|
+
require_pairs(),
|
|
980
|
+
require_set()
|
|
981
|
+
]
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
});
|
|
985
|
+
|
|
986
|
+
// node_modules/js-yaml/lib/loader.js
|
|
987
|
+
var require_loader = __commonJS({
|
|
988
|
+
"node_modules/js-yaml/lib/loader.js"(exports, module) {
|
|
989
|
+
"use strict";
|
|
990
|
+
var common = require_common();
|
|
991
|
+
var YAMLException = require_exception();
|
|
992
|
+
var makeSnippet = require_snippet();
|
|
993
|
+
var DEFAULT_SCHEMA = require_default();
|
|
994
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
995
|
+
var CONTEXT_FLOW_IN = 1;
|
|
996
|
+
var CONTEXT_FLOW_OUT = 2;
|
|
997
|
+
var CONTEXT_BLOCK_IN = 3;
|
|
998
|
+
var CONTEXT_BLOCK_OUT = 4;
|
|
999
|
+
var CHOMPING_CLIP = 1;
|
|
1000
|
+
var CHOMPING_STRIP = 2;
|
|
1001
|
+
var CHOMPING_KEEP = 3;
|
|
1002
|
+
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
1003
|
+
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
1004
|
+
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
1005
|
+
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
1006
|
+
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
1007
|
+
function _class(obj) {
|
|
1008
|
+
return Object.prototype.toString.call(obj);
|
|
1009
|
+
}
|
|
1010
|
+
function is_EOL(c) {
|
|
1011
|
+
return c === 10 || c === 13;
|
|
1012
|
+
}
|
|
1013
|
+
function is_WHITE_SPACE(c) {
|
|
1014
|
+
return c === 9 || c === 32;
|
|
1015
|
+
}
|
|
1016
|
+
function is_WS_OR_EOL(c) {
|
|
1017
|
+
return c === 9 || c === 32 || c === 10 || c === 13;
|
|
1018
|
+
}
|
|
1019
|
+
function is_FLOW_INDICATOR(c) {
|
|
1020
|
+
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
1021
|
+
}
|
|
1022
|
+
function fromHexCode(c) {
|
|
1023
|
+
var lc;
|
|
1024
|
+
if (48 <= c && c <= 57) {
|
|
1025
|
+
return c - 48;
|
|
1026
|
+
}
|
|
1027
|
+
lc = c | 32;
|
|
1028
|
+
if (97 <= lc && lc <= 102) {
|
|
1029
|
+
return lc - 97 + 10;
|
|
1030
|
+
}
|
|
1031
|
+
return -1;
|
|
1032
|
+
}
|
|
1033
|
+
function escapedHexLen(c) {
|
|
1034
|
+
if (c === 120) {
|
|
1035
|
+
return 2;
|
|
1036
|
+
}
|
|
1037
|
+
if (c === 117) {
|
|
1038
|
+
return 4;
|
|
1039
|
+
}
|
|
1040
|
+
if (c === 85) {
|
|
1041
|
+
return 8;
|
|
1042
|
+
}
|
|
1043
|
+
return 0;
|
|
1044
|
+
}
|
|
1045
|
+
function fromDecimalCode(c) {
|
|
1046
|
+
if (48 <= c && c <= 57) {
|
|
1047
|
+
return c - 48;
|
|
1048
|
+
}
|
|
1049
|
+
return -1;
|
|
1050
|
+
}
|
|
1051
|
+
function simpleEscapeSequence(c) {
|
|
1052
|
+
return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
|
|
1053
|
+
}
|
|
1054
|
+
function charFromCodepoint(c) {
|
|
1055
|
+
if (c <= 65535) {
|
|
1056
|
+
return String.fromCharCode(c);
|
|
1057
|
+
}
|
|
1058
|
+
return String.fromCharCode(
|
|
1059
|
+
(c - 65536 >> 10) + 55296,
|
|
1060
|
+
(c - 65536 & 1023) + 56320
|
|
1061
|
+
);
|
|
1062
|
+
}
|
|
1063
|
+
function setProperty(object, key, value) {
|
|
1064
|
+
if (key === "__proto__") {
|
|
1065
|
+
Object.defineProperty(object, key, {
|
|
1066
|
+
configurable: true,
|
|
1067
|
+
enumerable: true,
|
|
1068
|
+
writable: true,
|
|
1069
|
+
value
|
|
1070
|
+
});
|
|
1071
|
+
} else {
|
|
1072
|
+
object[key] = value;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
var simpleEscapeCheck = new Array(256);
|
|
1076
|
+
var simpleEscapeMap = new Array(256);
|
|
1077
|
+
for (i = 0; i < 256; i++) {
|
|
1078
|
+
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
1079
|
+
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
1080
|
+
}
|
|
1081
|
+
var i;
|
|
1082
|
+
function State(input, options) {
|
|
1083
|
+
this.input = input;
|
|
1084
|
+
this.filename = options["filename"] || null;
|
|
1085
|
+
this.schema = options["schema"] || DEFAULT_SCHEMA;
|
|
1086
|
+
this.onWarning = options["onWarning"] || null;
|
|
1087
|
+
this.legacy = options["legacy"] || false;
|
|
1088
|
+
this.json = options["json"] || false;
|
|
1089
|
+
this.listener = options["listener"] || null;
|
|
1090
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
1091
|
+
this.typeMap = this.schema.compiledTypeMap;
|
|
1092
|
+
this.length = input.length;
|
|
1093
|
+
this.position = 0;
|
|
1094
|
+
this.line = 0;
|
|
1095
|
+
this.lineStart = 0;
|
|
1096
|
+
this.lineIndent = 0;
|
|
1097
|
+
this.firstTabInLine = -1;
|
|
1098
|
+
this.documents = [];
|
|
1099
|
+
}
|
|
1100
|
+
function generateError(state, message) {
|
|
1101
|
+
var mark = {
|
|
1102
|
+
name: state.filename,
|
|
1103
|
+
buffer: state.input.slice(0, -1),
|
|
1104
|
+
// omit trailing \0
|
|
1105
|
+
position: state.position,
|
|
1106
|
+
line: state.line,
|
|
1107
|
+
column: state.position - state.lineStart
|
|
1108
|
+
};
|
|
1109
|
+
mark.snippet = makeSnippet(mark);
|
|
1110
|
+
return new YAMLException(message, mark);
|
|
1111
|
+
}
|
|
1112
|
+
function throwError(state, message) {
|
|
1113
|
+
throw generateError(state, message);
|
|
1114
|
+
}
|
|
1115
|
+
function throwWarning(state, message) {
|
|
1116
|
+
if (state.onWarning) {
|
|
1117
|
+
state.onWarning.call(null, generateError(state, message));
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
var directiveHandlers = {
|
|
1121
|
+
YAML: function handleYamlDirective(state, name, args) {
|
|
1122
|
+
var match, major, minor;
|
|
1123
|
+
if (state.version !== null) {
|
|
1124
|
+
throwError(state, "duplication of %YAML directive");
|
|
1125
|
+
}
|
|
1126
|
+
if (args.length !== 1) {
|
|
1127
|
+
throwError(state, "YAML directive accepts exactly one argument");
|
|
1128
|
+
}
|
|
1129
|
+
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
1130
|
+
if (match === null) {
|
|
1131
|
+
throwError(state, "ill-formed argument of the YAML directive");
|
|
1132
|
+
}
|
|
1133
|
+
major = parseInt(match[1], 10);
|
|
1134
|
+
minor = parseInt(match[2], 10);
|
|
1135
|
+
if (major !== 1) {
|
|
1136
|
+
throwError(state, "unacceptable YAML version of the document");
|
|
1137
|
+
}
|
|
1138
|
+
state.version = args[0];
|
|
1139
|
+
state.checkLineBreaks = minor < 2;
|
|
1140
|
+
if (minor !== 1 && minor !== 2) {
|
|
1141
|
+
throwWarning(state, "unsupported YAML version of the document");
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1144
|
+
TAG: function handleTagDirective(state, name, args) {
|
|
1145
|
+
var handle, prefix;
|
|
1146
|
+
if (args.length !== 2) {
|
|
1147
|
+
throwError(state, "TAG directive accepts exactly two arguments");
|
|
1148
|
+
}
|
|
1149
|
+
handle = args[0];
|
|
1150
|
+
prefix = args[1];
|
|
1151
|
+
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
1152
|
+
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
1153
|
+
}
|
|
1154
|
+
if (_hasOwnProperty.call(state.tagMap, handle)) {
|
|
1155
|
+
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
1156
|
+
}
|
|
1157
|
+
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
1158
|
+
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
1159
|
+
}
|
|
1160
|
+
try {
|
|
1161
|
+
prefix = decodeURIComponent(prefix);
|
|
1162
|
+
} catch (err) {
|
|
1163
|
+
throwError(state, "tag prefix is malformed: " + prefix);
|
|
1164
|
+
}
|
|
1165
|
+
state.tagMap[handle] = prefix;
|
|
1166
|
+
}
|
|
1167
|
+
};
|
|
1168
|
+
function captureSegment(state, start, end, checkJson) {
|
|
1169
|
+
var _position, _length, _character, _result;
|
|
1170
|
+
if (start < end) {
|
|
1171
|
+
_result = state.input.slice(start, end);
|
|
1172
|
+
if (checkJson) {
|
|
1173
|
+
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
1174
|
+
_character = _result.charCodeAt(_position);
|
|
1175
|
+
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
1176
|
+
throwError(state, "expected valid JSON character");
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
1180
|
+
throwError(state, "the stream contains non-printable characters");
|
|
1181
|
+
}
|
|
1182
|
+
state.result += _result;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
function mergeMappings(state, destination, source, overridableKeys) {
|
|
1186
|
+
var sourceKeys, key, index, quantity;
|
|
1187
|
+
if (!common.isObject(source)) {
|
|
1188
|
+
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
1189
|
+
}
|
|
1190
|
+
sourceKeys = Object.keys(source);
|
|
1191
|
+
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
1192
|
+
key = sourceKeys[index];
|
|
1193
|
+
if (!_hasOwnProperty.call(destination, key)) {
|
|
1194
|
+
setProperty(destination, key, source[key]);
|
|
1195
|
+
overridableKeys[key] = true;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
|
|
1200
|
+
var index, quantity;
|
|
1201
|
+
if (Array.isArray(keyNode)) {
|
|
1202
|
+
keyNode = Array.prototype.slice.call(keyNode);
|
|
1203
|
+
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
|
1204
|
+
if (Array.isArray(keyNode[index])) {
|
|
1205
|
+
throwError(state, "nested arrays are not supported inside keys");
|
|
1206
|
+
}
|
|
1207
|
+
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
1208
|
+
keyNode[index] = "[object Object]";
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
|
1213
|
+
keyNode = "[object Object]";
|
|
1214
|
+
}
|
|
1215
|
+
keyNode = String(keyNode);
|
|
1216
|
+
if (_result === null) {
|
|
1217
|
+
_result = {};
|
|
1218
|
+
}
|
|
1219
|
+
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
1220
|
+
if (Array.isArray(valueNode)) {
|
|
1221
|
+
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
|
1222
|
+
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
1223
|
+
}
|
|
1224
|
+
} else {
|
|
1225
|
+
mergeMappings(state, _result, valueNode, overridableKeys);
|
|
1226
|
+
}
|
|
1227
|
+
} else {
|
|
1228
|
+
if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
|
|
1229
|
+
state.line = startLine || state.line;
|
|
1230
|
+
state.lineStart = startLineStart || state.lineStart;
|
|
1231
|
+
state.position = startPos || state.position;
|
|
1232
|
+
throwError(state, "duplicated mapping key");
|
|
1233
|
+
}
|
|
1234
|
+
setProperty(_result, keyNode, valueNode);
|
|
1235
|
+
delete overridableKeys[keyNode];
|
|
1236
|
+
}
|
|
1237
|
+
return _result;
|
|
1238
|
+
}
|
|
1239
|
+
function readLineBreak(state) {
|
|
1240
|
+
var ch;
|
|
1241
|
+
ch = state.input.charCodeAt(state.position);
|
|
1242
|
+
if (ch === 10) {
|
|
1243
|
+
state.position++;
|
|
1244
|
+
} else if (ch === 13) {
|
|
1245
|
+
state.position++;
|
|
1246
|
+
if (state.input.charCodeAt(state.position) === 10) {
|
|
1247
|
+
state.position++;
|
|
1248
|
+
}
|
|
1249
|
+
} else {
|
|
1250
|
+
throwError(state, "a line break is expected");
|
|
1251
|
+
}
|
|
1252
|
+
state.line += 1;
|
|
1253
|
+
state.lineStart = state.position;
|
|
1254
|
+
state.firstTabInLine = -1;
|
|
1255
|
+
}
|
|
1256
|
+
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
1257
|
+
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
|
1258
|
+
while (ch !== 0) {
|
|
1259
|
+
while (is_WHITE_SPACE(ch)) {
|
|
1260
|
+
if (ch === 9 && state.firstTabInLine === -1) {
|
|
1261
|
+
state.firstTabInLine = state.position;
|
|
1262
|
+
}
|
|
1263
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1264
|
+
}
|
|
1265
|
+
if (allowComments && ch === 35) {
|
|
1266
|
+
do {
|
|
1267
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1268
|
+
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
1269
|
+
}
|
|
1270
|
+
if (is_EOL(ch)) {
|
|
1271
|
+
readLineBreak(state);
|
|
1272
|
+
ch = state.input.charCodeAt(state.position);
|
|
1273
|
+
lineBreaks++;
|
|
1274
|
+
state.lineIndent = 0;
|
|
1275
|
+
while (ch === 32) {
|
|
1276
|
+
state.lineIndent++;
|
|
1277
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1278
|
+
}
|
|
1279
|
+
} else {
|
|
1280
|
+
break;
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
1284
|
+
throwWarning(state, "deficient indentation");
|
|
1285
|
+
}
|
|
1286
|
+
return lineBreaks;
|
|
1287
|
+
}
|
|
1288
|
+
function testDocumentSeparator(state) {
|
|
1289
|
+
var _position = state.position, ch;
|
|
1290
|
+
ch = state.input.charCodeAt(_position);
|
|
1291
|
+
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
1292
|
+
_position += 3;
|
|
1293
|
+
ch = state.input.charCodeAt(_position);
|
|
1294
|
+
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
|
1295
|
+
return true;
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
return false;
|
|
1299
|
+
}
|
|
1300
|
+
function writeFoldedLines(state, count) {
|
|
1301
|
+
if (count === 1) {
|
|
1302
|
+
state.result += " ";
|
|
1303
|
+
} else if (count > 1) {
|
|
1304
|
+
state.result += common.repeat("\n", count - 1);
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
1308
|
+
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
|
1309
|
+
ch = state.input.charCodeAt(state.position);
|
|
1310
|
+
if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
|
1311
|
+
return false;
|
|
1312
|
+
}
|
|
1313
|
+
if (ch === 63 || ch === 45) {
|
|
1314
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1315
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
1316
|
+
return false;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
state.kind = "scalar";
|
|
1320
|
+
state.result = "";
|
|
1321
|
+
captureStart = captureEnd = state.position;
|
|
1322
|
+
hasPendingContent = false;
|
|
1323
|
+
while (ch !== 0) {
|
|
1324
|
+
if (ch === 58) {
|
|
1325
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1326
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
1327
|
+
break;
|
|
1328
|
+
}
|
|
1329
|
+
} else if (ch === 35) {
|
|
1330
|
+
preceding = state.input.charCodeAt(state.position - 1);
|
|
1331
|
+
if (is_WS_OR_EOL(preceding)) {
|
|
1332
|
+
break;
|
|
1333
|
+
}
|
|
1334
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
|
1335
|
+
break;
|
|
1336
|
+
} else if (is_EOL(ch)) {
|
|
1337
|
+
_line = state.line;
|
|
1338
|
+
_lineStart = state.lineStart;
|
|
1339
|
+
_lineIndent = state.lineIndent;
|
|
1340
|
+
skipSeparationSpace(state, false, -1);
|
|
1341
|
+
if (state.lineIndent >= nodeIndent) {
|
|
1342
|
+
hasPendingContent = true;
|
|
1343
|
+
ch = state.input.charCodeAt(state.position);
|
|
1344
|
+
continue;
|
|
1345
|
+
} else {
|
|
1346
|
+
state.position = captureEnd;
|
|
1347
|
+
state.line = _line;
|
|
1348
|
+
state.lineStart = _lineStart;
|
|
1349
|
+
state.lineIndent = _lineIndent;
|
|
1350
|
+
break;
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
if (hasPendingContent) {
|
|
1354
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
1355
|
+
writeFoldedLines(state, state.line - _line);
|
|
1356
|
+
captureStart = captureEnd = state.position;
|
|
1357
|
+
hasPendingContent = false;
|
|
1358
|
+
}
|
|
1359
|
+
if (!is_WHITE_SPACE(ch)) {
|
|
1360
|
+
captureEnd = state.position + 1;
|
|
1361
|
+
}
|
|
1362
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1363
|
+
}
|
|
1364
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
1365
|
+
if (state.result) {
|
|
1366
|
+
return true;
|
|
1367
|
+
}
|
|
1368
|
+
state.kind = _kind;
|
|
1369
|
+
state.result = _result;
|
|
1370
|
+
return false;
|
|
1371
|
+
}
|
|
1372
|
+
function readSingleQuotedScalar(state, nodeIndent) {
|
|
1373
|
+
var ch, captureStart, captureEnd;
|
|
1374
|
+
ch = state.input.charCodeAt(state.position);
|
|
1375
|
+
if (ch !== 39) {
|
|
1376
|
+
return false;
|
|
1377
|
+
}
|
|
1378
|
+
state.kind = "scalar";
|
|
1379
|
+
state.result = "";
|
|
1380
|
+
state.position++;
|
|
1381
|
+
captureStart = captureEnd = state.position;
|
|
1382
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1383
|
+
if (ch === 39) {
|
|
1384
|
+
captureSegment(state, captureStart, state.position, true);
|
|
1385
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1386
|
+
if (ch === 39) {
|
|
1387
|
+
captureStart = state.position;
|
|
1388
|
+
state.position++;
|
|
1389
|
+
captureEnd = state.position;
|
|
1390
|
+
} else {
|
|
1391
|
+
return true;
|
|
1392
|
+
}
|
|
1393
|
+
} else if (is_EOL(ch)) {
|
|
1394
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
1395
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
1396
|
+
captureStart = captureEnd = state.position;
|
|
1397
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
1398
|
+
throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
1399
|
+
} else {
|
|
1400
|
+
state.position++;
|
|
1401
|
+
captureEnd = state.position;
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
1405
|
+
}
|
|
1406
|
+
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
1407
|
+
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
1408
|
+
ch = state.input.charCodeAt(state.position);
|
|
1409
|
+
if (ch !== 34) {
|
|
1410
|
+
return false;
|
|
1411
|
+
}
|
|
1412
|
+
state.kind = "scalar";
|
|
1413
|
+
state.result = "";
|
|
1414
|
+
state.position++;
|
|
1415
|
+
captureStart = captureEnd = state.position;
|
|
1416
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1417
|
+
if (ch === 34) {
|
|
1418
|
+
captureSegment(state, captureStart, state.position, true);
|
|
1419
|
+
state.position++;
|
|
1420
|
+
return true;
|
|
1421
|
+
} else if (ch === 92) {
|
|
1422
|
+
captureSegment(state, captureStart, state.position, true);
|
|
1423
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1424
|
+
if (is_EOL(ch)) {
|
|
1425
|
+
skipSeparationSpace(state, false, nodeIndent);
|
|
1426
|
+
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
1427
|
+
state.result += simpleEscapeMap[ch];
|
|
1428
|
+
state.position++;
|
|
1429
|
+
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
1430
|
+
hexLength = tmp;
|
|
1431
|
+
hexResult = 0;
|
|
1432
|
+
for (; hexLength > 0; hexLength--) {
|
|
1433
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1434
|
+
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
1435
|
+
hexResult = (hexResult << 4) + tmp;
|
|
1436
|
+
} else {
|
|
1437
|
+
throwError(state, "expected hexadecimal character");
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
state.result += charFromCodepoint(hexResult);
|
|
1441
|
+
state.position++;
|
|
1442
|
+
} else {
|
|
1443
|
+
throwError(state, "unknown escape sequence");
|
|
1444
|
+
}
|
|
1445
|
+
captureStart = captureEnd = state.position;
|
|
1446
|
+
} else if (is_EOL(ch)) {
|
|
1447
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
1448
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
1449
|
+
captureStart = captureEnd = state.position;
|
|
1450
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
1451
|
+
throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
1452
|
+
} else {
|
|
1453
|
+
state.position++;
|
|
1454
|
+
captureEnd = state.position;
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
1458
|
+
}
|
|
1459
|
+
function readFlowCollection(state, nodeIndent) {
|
|
1460
|
+
var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
|
|
1461
|
+
ch = state.input.charCodeAt(state.position);
|
|
1462
|
+
if (ch === 91) {
|
|
1463
|
+
terminator = 93;
|
|
1464
|
+
isMapping = false;
|
|
1465
|
+
_result = [];
|
|
1466
|
+
} else if (ch === 123) {
|
|
1467
|
+
terminator = 125;
|
|
1468
|
+
isMapping = true;
|
|
1469
|
+
_result = {};
|
|
1470
|
+
} else {
|
|
1471
|
+
return false;
|
|
1472
|
+
}
|
|
1473
|
+
if (state.anchor !== null) {
|
|
1474
|
+
state.anchorMap[state.anchor] = _result;
|
|
1475
|
+
}
|
|
1476
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1477
|
+
while (ch !== 0) {
|
|
1478
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
1479
|
+
ch = state.input.charCodeAt(state.position);
|
|
1480
|
+
if (ch === terminator) {
|
|
1481
|
+
state.position++;
|
|
1482
|
+
state.tag = _tag;
|
|
1483
|
+
state.anchor = _anchor;
|
|
1484
|
+
state.kind = isMapping ? "mapping" : "sequence";
|
|
1485
|
+
state.result = _result;
|
|
1486
|
+
return true;
|
|
1487
|
+
} else if (!readNext) {
|
|
1488
|
+
throwError(state, "missed comma between flow collection entries");
|
|
1489
|
+
} else if (ch === 44) {
|
|
1490
|
+
throwError(state, "expected the node content, but found ','");
|
|
1491
|
+
}
|
|
1492
|
+
keyTag = keyNode = valueNode = null;
|
|
1493
|
+
isPair = isExplicitPair = false;
|
|
1494
|
+
if (ch === 63) {
|
|
1495
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1496
|
+
if (is_WS_OR_EOL(following)) {
|
|
1497
|
+
isPair = isExplicitPair = true;
|
|
1498
|
+
state.position++;
|
|
1499
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
_line = state.line;
|
|
1503
|
+
_lineStart = state.lineStart;
|
|
1504
|
+
_pos = state.position;
|
|
1505
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
1506
|
+
keyTag = state.tag;
|
|
1507
|
+
keyNode = state.result;
|
|
1508
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
1509
|
+
ch = state.input.charCodeAt(state.position);
|
|
1510
|
+
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
|
1511
|
+
isPair = true;
|
|
1512
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1513
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
1514
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
1515
|
+
valueNode = state.result;
|
|
1516
|
+
}
|
|
1517
|
+
if (isMapping) {
|
|
1518
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
|
1519
|
+
} else if (isPair) {
|
|
1520
|
+
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
|
1521
|
+
} else {
|
|
1522
|
+
_result.push(keyNode);
|
|
1523
|
+
}
|
|
1524
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
1525
|
+
ch = state.input.charCodeAt(state.position);
|
|
1526
|
+
if (ch === 44) {
|
|
1527
|
+
readNext = true;
|
|
1528
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1529
|
+
} else {
|
|
1530
|
+
readNext = false;
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
throwError(state, "unexpected end of the stream within a flow collection");
|
|
1534
|
+
}
|
|
1535
|
+
function readBlockScalar(state, nodeIndent) {
|
|
1536
|
+
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
|
1537
|
+
ch = state.input.charCodeAt(state.position);
|
|
1538
|
+
if (ch === 124) {
|
|
1539
|
+
folding = false;
|
|
1540
|
+
} else if (ch === 62) {
|
|
1541
|
+
folding = true;
|
|
1542
|
+
} else {
|
|
1543
|
+
return false;
|
|
1544
|
+
}
|
|
1545
|
+
state.kind = "scalar";
|
|
1546
|
+
state.result = "";
|
|
1547
|
+
while (ch !== 0) {
|
|
1548
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1549
|
+
if (ch === 43 || ch === 45) {
|
|
1550
|
+
if (CHOMPING_CLIP === chomping) {
|
|
1551
|
+
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
1552
|
+
} else {
|
|
1553
|
+
throwError(state, "repeat of a chomping mode identifier");
|
|
1554
|
+
}
|
|
1555
|
+
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
|
1556
|
+
if (tmp === 0) {
|
|
1557
|
+
throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
1558
|
+
} else if (!detectedIndent) {
|
|
1559
|
+
textIndent = nodeIndent + tmp - 1;
|
|
1560
|
+
detectedIndent = true;
|
|
1561
|
+
} else {
|
|
1562
|
+
throwError(state, "repeat of an indentation width identifier");
|
|
1563
|
+
}
|
|
1564
|
+
} else {
|
|
1565
|
+
break;
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
if (is_WHITE_SPACE(ch)) {
|
|
1569
|
+
do {
|
|
1570
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1571
|
+
} while (is_WHITE_SPACE(ch));
|
|
1572
|
+
if (ch === 35) {
|
|
1573
|
+
do {
|
|
1574
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1575
|
+
} while (!is_EOL(ch) && ch !== 0);
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
while (ch !== 0) {
|
|
1579
|
+
readLineBreak(state);
|
|
1580
|
+
state.lineIndent = 0;
|
|
1581
|
+
ch = state.input.charCodeAt(state.position);
|
|
1582
|
+
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
|
1583
|
+
state.lineIndent++;
|
|
1584
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1585
|
+
}
|
|
1586
|
+
if (!detectedIndent && state.lineIndent > textIndent) {
|
|
1587
|
+
textIndent = state.lineIndent;
|
|
1588
|
+
}
|
|
1589
|
+
if (is_EOL(ch)) {
|
|
1590
|
+
emptyLines++;
|
|
1591
|
+
continue;
|
|
1592
|
+
}
|
|
1593
|
+
if (state.lineIndent < textIndent) {
|
|
1594
|
+
if (chomping === CHOMPING_KEEP) {
|
|
1595
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
1596
|
+
} else if (chomping === CHOMPING_CLIP) {
|
|
1597
|
+
if (didReadContent) {
|
|
1598
|
+
state.result += "\n";
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
break;
|
|
1602
|
+
}
|
|
1603
|
+
if (folding) {
|
|
1604
|
+
if (is_WHITE_SPACE(ch)) {
|
|
1605
|
+
atMoreIndented = true;
|
|
1606
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
1607
|
+
} else if (atMoreIndented) {
|
|
1608
|
+
atMoreIndented = false;
|
|
1609
|
+
state.result += common.repeat("\n", emptyLines + 1);
|
|
1610
|
+
} else if (emptyLines === 0) {
|
|
1611
|
+
if (didReadContent) {
|
|
1612
|
+
state.result += " ";
|
|
1613
|
+
}
|
|
1614
|
+
} else {
|
|
1615
|
+
state.result += common.repeat("\n", emptyLines);
|
|
1616
|
+
}
|
|
1617
|
+
} else {
|
|
1618
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
1619
|
+
}
|
|
1620
|
+
didReadContent = true;
|
|
1621
|
+
detectedIndent = true;
|
|
1622
|
+
emptyLines = 0;
|
|
1623
|
+
captureStart = state.position;
|
|
1624
|
+
while (!is_EOL(ch) && ch !== 0) {
|
|
1625
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1626
|
+
}
|
|
1627
|
+
captureSegment(state, captureStart, state.position, false);
|
|
1628
|
+
}
|
|
1629
|
+
return true;
|
|
1630
|
+
}
|
|
1631
|
+
function readBlockSequence(state, nodeIndent) {
|
|
1632
|
+
var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
|
|
1633
|
+
if (state.firstTabInLine !== -1) return false;
|
|
1634
|
+
if (state.anchor !== null) {
|
|
1635
|
+
state.anchorMap[state.anchor] = _result;
|
|
1636
|
+
}
|
|
1637
|
+
ch = state.input.charCodeAt(state.position);
|
|
1638
|
+
while (ch !== 0) {
|
|
1639
|
+
if (state.firstTabInLine !== -1) {
|
|
1640
|
+
state.position = state.firstTabInLine;
|
|
1641
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
1642
|
+
}
|
|
1643
|
+
if (ch !== 45) {
|
|
1644
|
+
break;
|
|
1645
|
+
}
|
|
1646
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1647
|
+
if (!is_WS_OR_EOL(following)) {
|
|
1648
|
+
break;
|
|
1649
|
+
}
|
|
1650
|
+
detected = true;
|
|
1651
|
+
state.position++;
|
|
1652
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
1653
|
+
if (state.lineIndent <= nodeIndent) {
|
|
1654
|
+
_result.push(null);
|
|
1655
|
+
ch = state.input.charCodeAt(state.position);
|
|
1656
|
+
continue;
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
_line = state.line;
|
|
1660
|
+
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
1661
|
+
_result.push(state.result);
|
|
1662
|
+
skipSeparationSpace(state, true, -1);
|
|
1663
|
+
ch = state.input.charCodeAt(state.position);
|
|
1664
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
1665
|
+
throwError(state, "bad indentation of a sequence entry");
|
|
1666
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
1667
|
+
break;
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
if (detected) {
|
|
1671
|
+
state.tag = _tag;
|
|
1672
|
+
state.anchor = _anchor;
|
|
1673
|
+
state.kind = "sequence";
|
|
1674
|
+
state.result = _result;
|
|
1675
|
+
return true;
|
|
1676
|
+
}
|
|
1677
|
+
return false;
|
|
1678
|
+
}
|
|
1679
|
+
function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
1680
|
+
var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
|
1681
|
+
if (state.firstTabInLine !== -1) return false;
|
|
1682
|
+
if (state.anchor !== null) {
|
|
1683
|
+
state.anchorMap[state.anchor] = _result;
|
|
1684
|
+
}
|
|
1685
|
+
ch = state.input.charCodeAt(state.position);
|
|
1686
|
+
while (ch !== 0) {
|
|
1687
|
+
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
1688
|
+
state.position = state.firstTabInLine;
|
|
1689
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
1690
|
+
}
|
|
1691
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1692
|
+
_line = state.line;
|
|
1693
|
+
if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
|
1694
|
+
if (ch === 63) {
|
|
1695
|
+
if (atExplicitKey) {
|
|
1696
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
1697
|
+
keyTag = keyNode = valueNode = null;
|
|
1698
|
+
}
|
|
1699
|
+
detected = true;
|
|
1700
|
+
atExplicitKey = true;
|
|
1701
|
+
allowCompact = true;
|
|
1702
|
+
} else if (atExplicitKey) {
|
|
1703
|
+
atExplicitKey = false;
|
|
1704
|
+
allowCompact = true;
|
|
1705
|
+
} else {
|
|
1706
|
+
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
1707
|
+
}
|
|
1708
|
+
state.position += 1;
|
|
1709
|
+
ch = following;
|
|
1710
|
+
} else {
|
|
1711
|
+
_keyLine = state.line;
|
|
1712
|
+
_keyLineStart = state.lineStart;
|
|
1713
|
+
_keyPos = state.position;
|
|
1714
|
+
if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
|
1715
|
+
break;
|
|
1716
|
+
}
|
|
1717
|
+
if (state.line === _line) {
|
|
1718
|
+
ch = state.input.charCodeAt(state.position);
|
|
1719
|
+
while (is_WHITE_SPACE(ch)) {
|
|
1720
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1721
|
+
}
|
|
1722
|
+
if (ch === 58) {
|
|
1723
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1724
|
+
if (!is_WS_OR_EOL(ch)) {
|
|
1725
|
+
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
1726
|
+
}
|
|
1727
|
+
if (atExplicitKey) {
|
|
1728
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
1729
|
+
keyTag = keyNode = valueNode = null;
|
|
1730
|
+
}
|
|
1731
|
+
detected = true;
|
|
1732
|
+
atExplicitKey = false;
|
|
1733
|
+
allowCompact = false;
|
|
1734
|
+
keyTag = state.tag;
|
|
1735
|
+
keyNode = state.result;
|
|
1736
|
+
} else if (detected) {
|
|
1737
|
+
throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
1738
|
+
} else {
|
|
1739
|
+
state.tag = _tag;
|
|
1740
|
+
state.anchor = _anchor;
|
|
1741
|
+
return true;
|
|
1742
|
+
}
|
|
1743
|
+
} else if (detected) {
|
|
1744
|
+
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
1745
|
+
} else {
|
|
1746
|
+
state.tag = _tag;
|
|
1747
|
+
state.anchor = _anchor;
|
|
1748
|
+
return true;
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
if (state.line === _line || state.lineIndent > nodeIndent) {
|
|
1752
|
+
if (atExplicitKey) {
|
|
1753
|
+
_keyLine = state.line;
|
|
1754
|
+
_keyLineStart = state.lineStart;
|
|
1755
|
+
_keyPos = state.position;
|
|
1756
|
+
}
|
|
1757
|
+
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
|
1758
|
+
if (atExplicitKey) {
|
|
1759
|
+
keyNode = state.result;
|
|
1760
|
+
} else {
|
|
1761
|
+
valueNode = state.result;
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
if (!atExplicitKey) {
|
|
1765
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
|
1766
|
+
keyTag = keyNode = valueNode = null;
|
|
1767
|
+
}
|
|
1768
|
+
skipSeparationSpace(state, true, -1);
|
|
1769
|
+
ch = state.input.charCodeAt(state.position);
|
|
1770
|
+
}
|
|
1771
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
1772
|
+
throwError(state, "bad indentation of a mapping entry");
|
|
1773
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
1774
|
+
break;
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
if (atExplicitKey) {
|
|
1778
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
1779
|
+
}
|
|
1780
|
+
if (detected) {
|
|
1781
|
+
state.tag = _tag;
|
|
1782
|
+
state.anchor = _anchor;
|
|
1783
|
+
state.kind = "mapping";
|
|
1784
|
+
state.result = _result;
|
|
1785
|
+
}
|
|
1786
|
+
return detected;
|
|
1787
|
+
}
|
|
1788
|
+
function readTagProperty(state) {
|
|
1789
|
+
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
|
1790
|
+
ch = state.input.charCodeAt(state.position);
|
|
1791
|
+
if (ch !== 33) return false;
|
|
1792
|
+
if (state.tag !== null) {
|
|
1793
|
+
throwError(state, "duplication of a tag property");
|
|
1794
|
+
}
|
|
1795
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1796
|
+
if (ch === 60) {
|
|
1797
|
+
isVerbatim = true;
|
|
1798
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1799
|
+
} else if (ch === 33) {
|
|
1800
|
+
isNamed = true;
|
|
1801
|
+
tagHandle = "!!";
|
|
1802
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1803
|
+
} else {
|
|
1804
|
+
tagHandle = "!";
|
|
1805
|
+
}
|
|
1806
|
+
_position = state.position;
|
|
1807
|
+
if (isVerbatim) {
|
|
1808
|
+
do {
|
|
1809
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1810
|
+
} while (ch !== 0 && ch !== 62);
|
|
1811
|
+
if (state.position < state.length) {
|
|
1812
|
+
tagName = state.input.slice(_position, state.position);
|
|
1813
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1814
|
+
} else {
|
|
1815
|
+
throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
1816
|
+
}
|
|
1817
|
+
} else {
|
|
1818
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
1819
|
+
if (ch === 33) {
|
|
1820
|
+
if (!isNamed) {
|
|
1821
|
+
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
1822
|
+
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
1823
|
+
throwError(state, "named tag handle cannot contain such characters");
|
|
1824
|
+
}
|
|
1825
|
+
isNamed = true;
|
|
1826
|
+
_position = state.position + 1;
|
|
1827
|
+
} else {
|
|
1828
|
+
throwError(state, "tag suffix cannot contain exclamation marks");
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1832
|
+
}
|
|
1833
|
+
tagName = state.input.slice(_position, state.position);
|
|
1834
|
+
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
1835
|
+
throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
1839
|
+
throwError(state, "tag name cannot contain such characters: " + tagName);
|
|
1840
|
+
}
|
|
1841
|
+
try {
|
|
1842
|
+
tagName = decodeURIComponent(tagName);
|
|
1843
|
+
} catch (err) {
|
|
1844
|
+
throwError(state, "tag name is malformed: " + tagName);
|
|
1845
|
+
}
|
|
1846
|
+
if (isVerbatim) {
|
|
1847
|
+
state.tag = tagName;
|
|
1848
|
+
} else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
|
|
1849
|
+
state.tag = state.tagMap[tagHandle] + tagName;
|
|
1850
|
+
} else if (tagHandle === "!") {
|
|
1851
|
+
state.tag = "!" + tagName;
|
|
1852
|
+
} else if (tagHandle === "!!") {
|
|
1853
|
+
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
1854
|
+
} else {
|
|
1855
|
+
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
1856
|
+
}
|
|
1857
|
+
return true;
|
|
1858
|
+
}
|
|
1859
|
+
function readAnchorProperty(state) {
|
|
1860
|
+
var _position, ch;
|
|
1861
|
+
ch = state.input.charCodeAt(state.position);
|
|
1862
|
+
if (ch !== 38) return false;
|
|
1863
|
+
if (state.anchor !== null) {
|
|
1864
|
+
throwError(state, "duplication of an anchor property");
|
|
1865
|
+
}
|
|
1866
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1867
|
+
_position = state.position;
|
|
1868
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
1869
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1870
|
+
}
|
|
1871
|
+
if (state.position === _position) {
|
|
1872
|
+
throwError(state, "name of an anchor node must contain at least one character");
|
|
1873
|
+
}
|
|
1874
|
+
state.anchor = state.input.slice(_position, state.position);
|
|
1875
|
+
return true;
|
|
1876
|
+
}
|
|
1877
|
+
function readAlias(state) {
|
|
1878
|
+
var _position, alias, ch;
|
|
1879
|
+
ch = state.input.charCodeAt(state.position);
|
|
1880
|
+
if (ch !== 42) return false;
|
|
1881
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1882
|
+
_position = state.position;
|
|
1883
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
1884
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1885
|
+
}
|
|
1886
|
+
if (state.position === _position) {
|
|
1887
|
+
throwError(state, "name of an alias node must contain at least one character");
|
|
1888
|
+
}
|
|
1889
|
+
alias = state.input.slice(_position, state.position);
|
|
1890
|
+
if (!_hasOwnProperty.call(state.anchorMap, alias)) {
|
|
1891
|
+
throwError(state, 'unidentified alias "' + alias + '"');
|
|
1892
|
+
}
|
|
1893
|
+
state.result = state.anchorMap[alias];
|
|
1894
|
+
skipSeparationSpace(state, true, -1);
|
|
1895
|
+
return true;
|
|
1896
|
+
}
|
|
1897
|
+
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
|
1898
|
+
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type, flowIndent, blockIndent;
|
|
1899
|
+
if (state.listener !== null) {
|
|
1900
|
+
state.listener("open", state);
|
|
1901
|
+
}
|
|
1902
|
+
state.tag = null;
|
|
1903
|
+
state.anchor = null;
|
|
1904
|
+
state.kind = null;
|
|
1905
|
+
state.result = null;
|
|
1906
|
+
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
|
1907
|
+
if (allowToSeek) {
|
|
1908
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
1909
|
+
atNewLine = true;
|
|
1910
|
+
if (state.lineIndent > parentIndent) {
|
|
1911
|
+
indentStatus = 1;
|
|
1912
|
+
} else if (state.lineIndent === parentIndent) {
|
|
1913
|
+
indentStatus = 0;
|
|
1914
|
+
} else if (state.lineIndent < parentIndent) {
|
|
1915
|
+
indentStatus = -1;
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
if (indentStatus === 1) {
|
|
1920
|
+
while (readTagProperty(state) || readAnchorProperty(state)) {
|
|
1921
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
1922
|
+
atNewLine = true;
|
|
1923
|
+
allowBlockCollections = allowBlockStyles;
|
|
1924
|
+
if (state.lineIndent > parentIndent) {
|
|
1925
|
+
indentStatus = 1;
|
|
1926
|
+
} else if (state.lineIndent === parentIndent) {
|
|
1927
|
+
indentStatus = 0;
|
|
1928
|
+
} else if (state.lineIndent < parentIndent) {
|
|
1929
|
+
indentStatus = -1;
|
|
1930
|
+
}
|
|
1931
|
+
} else {
|
|
1932
|
+
allowBlockCollections = false;
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
if (allowBlockCollections) {
|
|
1937
|
+
allowBlockCollections = atNewLine || allowCompact;
|
|
1938
|
+
}
|
|
1939
|
+
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
|
1940
|
+
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
|
1941
|
+
flowIndent = parentIndent;
|
|
1942
|
+
} else {
|
|
1943
|
+
flowIndent = parentIndent + 1;
|
|
1944
|
+
}
|
|
1945
|
+
blockIndent = state.position - state.lineStart;
|
|
1946
|
+
if (indentStatus === 1) {
|
|
1947
|
+
if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
|
|
1948
|
+
hasContent = true;
|
|
1949
|
+
} else {
|
|
1950
|
+
if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
|
|
1951
|
+
hasContent = true;
|
|
1952
|
+
} else if (readAlias(state)) {
|
|
1953
|
+
hasContent = true;
|
|
1954
|
+
if (state.tag !== null || state.anchor !== null) {
|
|
1955
|
+
throwError(state, "alias node should not have any properties");
|
|
1956
|
+
}
|
|
1957
|
+
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
1958
|
+
hasContent = true;
|
|
1959
|
+
if (state.tag === null) {
|
|
1960
|
+
state.tag = "?";
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
if (state.anchor !== null) {
|
|
1964
|
+
state.anchorMap[state.anchor] = state.result;
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
} else if (indentStatus === 0) {
|
|
1968
|
+
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
if (state.tag === null) {
|
|
1972
|
+
if (state.anchor !== null) {
|
|
1973
|
+
state.anchorMap[state.anchor] = state.result;
|
|
1974
|
+
}
|
|
1975
|
+
} else if (state.tag === "?") {
|
|
1976
|
+
if (state.result !== null && state.kind !== "scalar") {
|
|
1977
|
+
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
|
1978
|
+
}
|
|
1979
|
+
for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
1980
|
+
type = state.implicitTypes[typeIndex];
|
|
1981
|
+
if (type.resolve(state.result)) {
|
|
1982
|
+
state.result = type.construct(state.result);
|
|
1983
|
+
state.tag = type.tag;
|
|
1984
|
+
if (state.anchor !== null) {
|
|
1985
|
+
state.anchorMap[state.anchor] = state.result;
|
|
1986
|
+
}
|
|
1987
|
+
break;
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
} else if (state.tag !== "!") {
|
|
1991
|
+
if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
|
1992
|
+
type = state.typeMap[state.kind || "fallback"][state.tag];
|
|
1993
|
+
} else {
|
|
1994
|
+
type = null;
|
|
1995
|
+
typeList = state.typeMap.multi[state.kind || "fallback"];
|
|
1996
|
+
for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
1997
|
+
if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
|
|
1998
|
+
type = typeList[typeIndex];
|
|
1999
|
+
break;
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
if (!type) {
|
|
2004
|
+
throwError(state, "unknown tag !<" + state.tag + ">");
|
|
2005
|
+
}
|
|
2006
|
+
if (state.result !== null && type.kind !== state.kind) {
|
|
2007
|
+
throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
|
|
2008
|
+
}
|
|
2009
|
+
if (!type.resolve(state.result, state.tag)) {
|
|
2010
|
+
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
2011
|
+
} else {
|
|
2012
|
+
state.result = type.construct(state.result, state.tag);
|
|
2013
|
+
if (state.anchor !== null) {
|
|
2014
|
+
state.anchorMap[state.anchor] = state.result;
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
if (state.listener !== null) {
|
|
2019
|
+
state.listener("close", state);
|
|
2020
|
+
}
|
|
2021
|
+
return state.tag !== null || state.anchor !== null || hasContent;
|
|
2022
|
+
}
|
|
2023
|
+
function readDocument(state) {
|
|
2024
|
+
var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
|
2025
|
+
state.version = null;
|
|
2026
|
+
state.checkLineBreaks = state.legacy;
|
|
2027
|
+
state.tagMap = /* @__PURE__ */ Object.create(null);
|
|
2028
|
+
state.anchorMap = /* @__PURE__ */ Object.create(null);
|
|
2029
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
2030
|
+
skipSeparationSpace(state, true, -1);
|
|
2031
|
+
ch = state.input.charCodeAt(state.position);
|
|
2032
|
+
if (state.lineIndent > 0 || ch !== 37) {
|
|
2033
|
+
break;
|
|
2034
|
+
}
|
|
2035
|
+
hasDirectives = true;
|
|
2036
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2037
|
+
_position = state.position;
|
|
2038
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
2039
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2040
|
+
}
|
|
2041
|
+
directiveName = state.input.slice(_position, state.position);
|
|
2042
|
+
directiveArgs = [];
|
|
2043
|
+
if (directiveName.length < 1) {
|
|
2044
|
+
throwError(state, "directive name must not be less than one character in length");
|
|
2045
|
+
}
|
|
2046
|
+
while (ch !== 0) {
|
|
2047
|
+
while (is_WHITE_SPACE(ch)) {
|
|
2048
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2049
|
+
}
|
|
2050
|
+
if (ch === 35) {
|
|
2051
|
+
do {
|
|
2052
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2053
|
+
} while (ch !== 0 && !is_EOL(ch));
|
|
2054
|
+
break;
|
|
2055
|
+
}
|
|
2056
|
+
if (is_EOL(ch)) break;
|
|
2057
|
+
_position = state.position;
|
|
2058
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
2059
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2060
|
+
}
|
|
2061
|
+
directiveArgs.push(state.input.slice(_position, state.position));
|
|
2062
|
+
}
|
|
2063
|
+
if (ch !== 0) readLineBreak(state);
|
|
2064
|
+
if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
|
|
2065
|
+
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
2066
|
+
} else {
|
|
2067
|
+
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
skipSeparationSpace(state, true, -1);
|
|
2071
|
+
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
|
2072
|
+
state.position += 3;
|
|
2073
|
+
skipSeparationSpace(state, true, -1);
|
|
2074
|
+
} else if (hasDirectives) {
|
|
2075
|
+
throwError(state, "directives end mark is expected");
|
|
2076
|
+
}
|
|
2077
|
+
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
2078
|
+
skipSeparationSpace(state, true, -1);
|
|
2079
|
+
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
|
2080
|
+
throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
|
2081
|
+
}
|
|
2082
|
+
state.documents.push(state.result);
|
|
2083
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2084
|
+
if (state.input.charCodeAt(state.position) === 46) {
|
|
2085
|
+
state.position += 3;
|
|
2086
|
+
skipSeparationSpace(state, true, -1);
|
|
2087
|
+
}
|
|
2088
|
+
return;
|
|
2089
|
+
}
|
|
2090
|
+
if (state.position < state.length - 1) {
|
|
2091
|
+
throwError(state, "end of the stream or a document separator is expected");
|
|
2092
|
+
} else {
|
|
2093
|
+
return;
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
function loadDocuments(input, options) {
|
|
2097
|
+
input = String(input);
|
|
2098
|
+
options = options || {};
|
|
2099
|
+
if (input.length !== 0) {
|
|
2100
|
+
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
2101
|
+
input += "\n";
|
|
2102
|
+
}
|
|
2103
|
+
if (input.charCodeAt(0) === 65279) {
|
|
2104
|
+
input = input.slice(1);
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
var state = new State(input, options);
|
|
2108
|
+
var nullpos = input.indexOf("\0");
|
|
2109
|
+
if (nullpos !== -1) {
|
|
2110
|
+
state.position = nullpos;
|
|
2111
|
+
throwError(state, "null byte is not allowed in input");
|
|
2112
|
+
}
|
|
2113
|
+
state.input += "\0";
|
|
2114
|
+
while (state.input.charCodeAt(state.position) === 32) {
|
|
2115
|
+
state.lineIndent += 1;
|
|
2116
|
+
state.position += 1;
|
|
2117
|
+
}
|
|
2118
|
+
while (state.position < state.length - 1) {
|
|
2119
|
+
readDocument(state);
|
|
2120
|
+
}
|
|
2121
|
+
return state.documents;
|
|
2122
|
+
}
|
|
2123
|
+
function loadAll(input, iterator, options) {
|
|
2124
|
+
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
|
2125
|
+
options = iterator;
|
|
2126
|
+
iterator = null;
|
|
2127
|
+
}
|
|
2128
|
+
var documents = loadDocuments(input, options);
|
|
2129
|
+
if (typeof iterator !== "function") {
|
|
2130
|
+
return documents;
|
|
2131
|
+
}
|
|
2132
|
+
for (var index = 0, length = documents.length; index < length; index += 1) {
|
|
2133
|
+
iterator(documents[index]);
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
function load(input, options) {
|
|
2137
|
+
var documents = loadDocuments(input, options);
|
|
2138
|
+
if (documents.length === 0) {
|
|
2139
|
+
return void 0;
|
|
2140
|
+
} else if (documents.length === 1) {
|
|
2141
|
+
return documents[0];
|
|
2142
|
+
}
|
|
2143
|
+
throw new YAMLException("expected a single document in the stream, but found more");
|
|
2144
|
+
}
|
|
2145
|
+
module.exports.loadAll = loadAll;
|
|
2146
|
+
module.exports.load = load;
|
|
2147
|
+
}
|
|
2148
|
+
});
|
|
2149
|
+
|
|
2150
|
+
// node_modules/js-yaml/lib/dumper.js
|
|
2151
|
+
var require_dumper = __commonJS({
|
|
2152
|
+
"node_modules/js-yaml/lib/dumper.js"(exports, module) {
|
|
2153
|
+
"use strict";
|
|
2154
|
+
var common = require_common();
|
|
2155
|
+
var YAMLException = require_exception();
|
|
2156
|
+
var DEFAULT_SCHEMA = require_default();
|
|
2157
|
+
var _toString = Object.prototype.toString;
|
|
2158
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2159
|
+
var CHAR_BOM = 65279;
|
|
2160
|
+
var CHAR_TAB = 9;
|
|
2161
|
+
var CHAR_LINE_FEED = 10;
|
|
2162
|
+
var CHAR_CARRIAGE_RETURN = 13;
|
|
2163
|
+
var CHAR_SPACE = 32;
|
|
2164
|
+
var CHAR_EXCLAMATION = 33;
|
|
2165
|
+
var CHAR_DOUBLE_QUOTE = 34;
|
|
2166
|
+
var CHAR_SHARP = 35;
|
|
2167
|
+
var CHAR_PERCENT = 37;
|
|
2168
|
+
var CHAR_AMPERSAND = 38;
|
|
2169
|
+
var CHAR_SINGLE_QUOTE = 39;
|
|
2170
|
+
var CHAR_ASTERISK = 42;
|
|
2171
|
+
var CHAR_COMMA = 44;
|
|
2172
|
+
var CHAR_MINUS = 45;
|
|
2173
|
+
var CHAR_COLON = 58;
|
|
2174
|
+
var CHAR_EQUALS = 61;
|
|
2175
|
+
var CHAR_GREATER_THAN = 62;
|
|
2176
|
+
var CHAR_QUESTION = 63;
|
|
2177
|
+
var CHAR_COMMERCIAL_AT = 64;
|
|
2178
|
+
var CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
2179
|
+
var CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
2180
|
+
var CHAR_GRAVE_ACCENT = 96;
|
|
2181
|
+
var CHAR_LEFT_CURLY_BRACKET = 123;
|
|
2182
|
+
var CHAR_VERTICAL_LINE = 124;
|
|
2183
|
+
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
2184
|
+
var ESCAPE_SEQUENCES = {};
|
|
2185
|
+
ESCAPE_SEQUENCES[0] = "\\0";
|
|
2186
|
+
ESCAPE_SEQUENCES[7] = "\\a";
|
|
2187
|
+
ESCAPE_SEQUENCES[8] = "\\b";
|
|
2188
|
+
ESCAPE_SEQUENCES[9] = "\\t";
|
|
2189
|
+
ESCAPE_SEQUENCES[10] = "\\n";
|
|
2190
|
+
ESCAPE_SEQUENCES[11] = "\\v";
|
|
2191
|
+
ESCAPE_SEQUENCES[12] = "\\f";
|
|
2192
|
+
ESCAPE_SEQUENCES[13] = "\\r";
|
|
2193
|
+
ESCAPE_SEQUENCES[27] = "\\e";
|
|
2194
|
+
ESCAPE_SEQUENCES[34] = '\\"';
|
|
2195
|
+
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
2196
|
+
ESCAPE_SEQUENCES[133] = "\\N";
|
|
2197
|
+
ESCAPE_SEQUENCES[160] = "\\_";
|
|
2198
|
+
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
2199
|
+
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
2200
|
+
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
2201
|
+
"y",
|
|
2202
|
+
"Y",
|
|
2203
|
+
"yes",
|
|
2204
|
+
"Yes",
|
|
2205
|
+
"YES",
|
|
2206
|
+
"on",
|
|
2207
|
+
"On",
|
|
2208
|
+
"ON",
|
|
2209
|
+
"n",
|
|
2210
|
+
"N",
|
|
2211
|
+
"no",
|
|
2212
|
+
"No",
|
|
2213
|
+
"NO",
|
|
2214
|
+
"off",
|
|
2215
|
+
"Off",
|
|
2216
|
+
"OFF"
|
|
2217
|
+
];
|
|
2218
|
+
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
2219
|
+
function compileStyleMap(schema, map) {
|
|
2220
|
+
var result, keys, index, length, tag, style, type;
|
|
2221
|
+
if (map === null) return {};
|
|
2222
|
+
result = {};
|
|
2223
|
+
keys = Object.keys(map);
|
|
2224
|
+
for (index = 0, length = keys.length; index < length; index += 1) {
|
|
2225
|
+
tag = keys[index];
|
|
2226
|
+
style = String(map[tag]);
|
|
2227
|
+
if (tag.slice(0, 2) === "!!") {
|
|
2228
|
+
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
2229
|
+
}
|
|
2230
|
+
type = schema.compiledTypeMap["fallback"][tag];
|
|
2231
|
+
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
|
2232
|
+
style = type.styleAliases[style];
|
|
2233
|
+
}
|
|
2234
|
+
result[tag] = style;
|
|
2235
|
+
}
|
|
2236
|
+
return result;
|
|
2237
|
+
}
|
|
2238
|
+
function encodeHex(character) {
|
|
2239
|
+
var string, handle, length;
|
|
2240
|
+
string = character.toString(16).toUpperCase();
|
|
2241
|
+
if (character <= 255) {
|
|
2242
|
+
handle = "x";
|
|
2243
|
+
length = 2;
|
|
2244
|
+
} else if (character <= 65535) {
|
|
2245
|
+
handle = "u";
|
|
2246
|
+
length = 4;
|
|
2247
|
+
} else if (character <= 4294967295) {
|
|
2248
|
+
handle = "U";
|
|
2249
|
+
length = 8;
|
|
2250
|
+
} else {
|
|
2251
|
+
throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
|
|
2252
|
+
}
|
|
2253
|
+
return "\\" + handle + common.repeat("0", length - string.length) + string;
|
|
2254
|
+
}
|
|
2255
|
+
var QUOTING_TYPE_SINGLE = 1;
|
|
2256
|
+
var QUOTING_TYPE_DOUBLE = 2;
|
|
2257
|
+
function State(options) {
|
|
2258
|
+
this.schema = options["schema"] || DEFAULT_SCHEMA;
|
|
2259
|
+
this.indent = Math.max(1, options["indent"] || 2);
|
|
2260
|
+
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
2261
|
+
this.skipInvalid = options["skipInvalid"] || false;
|
|
2262
|
+
this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
2263
|
+
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
|
2264
|
+
this.sortKeys = options["sortKeys"] || false;
|
|
2265
|
+
this.lineWidth = options["lineWidth"] || 80;
|
|
2266
|
+
this.noRefs = options["noRefs"] || false;
|
|
2267
|
+
this.noCompatMode = options["noCompatMode"] || false;
|
|
2268
|
+
this.condenseFlow = options["condenseFlow"] || false;
|
|
2269
|
+
this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
|
|
2270
|
+
this.forceQuotes = options["forceQuotes"] || false;
|
|
2271
|
+
this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
|
|
2272
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
2273
|
+
this.explicitTypes = this.schema.compiledExplicit;
|
|
2274
|
+
this.tag = null;
|
|
2275
|
+
this.result = "";
|
|
2276
|
+
this.duplicates = [];
|
|
2277
|
+
this.usedDuplicates = null;
|
|
2278
|
+
}
|
|
2279
|
+
function indentString(string, spaces) {
|
|
2280
|
+
var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
|
|
2281
|
+
while (position < length) {
|
|
2282
|
+
next = string.indexOf("\n", position);
|
|
2283
|
+
if (next === -1) {
|
|
2284
|
+
line = string.slice(position);
|
|
2285
|
+
position = length;
|
|
2286
|
+
} else {
|
|
2287
|
+
line = string.slice(position, next + 1);
|
|
2288
|
+
position = next + 1;
|
|
2289
|
+
}
|
|
2290
|
+
if (line.length && line !== "\n") result += ind;
|
|
2291
|
+
result += line;
|
|
2292
|
+
}
|
|
2293
|
+
return result;
|
|
2294
|
+
}
|
|
2295
|
+
function generateNextLine(state, level) {
|
|
2296
|
+
return "\n" + common.repeat(" ", state.indent * level);
|
|
2297
|
+
}
|
|
2298
|
+
function testImplicitResolving(state, str) {
|
|
2299
|
+
var index, length, type;
|
|
2300
|
+
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
|
2301
|
+
type = state.implicitTypes[index];
|
|
2302
|
+
if (type.resolve(str)) {
|
|
2303
|
+
return true;
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
return false;
|
|
2307
|
+
}
|
|
2308
|
+
function isWhitespace(c) {
|
|
2309
|
+
return c === CHAR_SPACE || c === CHAR_TAB;
|
|
2310
|
+
}
|
|
2311
|
+
function isPrintable(c) {
|
|
2312
|
+
return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM || 65536 <= c && c <= 1114111;
|
|
2313
|
+
}
|
|
2314
|
+
function isNsCharOrWhitespace(c) {
|
|
2315
|
+
return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
|
|
2316
|
+
}
|
|
2317
|
+
function isPlainSafe(c, prev, inblock) {
|
|
2318
|
+
var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
|
|
2319
|
+
var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
|
|
2320
|
+
return (
|
|
2321
|
+
// ns-plain-safe
|
|
2322
|
+
(inblock ? (
|
|
2323
|
+
// c = flow-in
|
|
2324
|
+
cIsNsCharOrWhitespace
|
|
2325
|
+
) : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar
|
|
2326
|
+
);
|
|
2327
|
+
}
|
|
2328
|
+
function isPlainSafeFirst(c) {
|
|
2329
|
+
return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
|
|
2330
|
+
}
|
|
2331
|
+
function isPlainSafeLast(c) {
|
|
2332
|
+
return !isWhitespace(c) && c !== CHAR_COLON;
|
|
2333
|
+
}
|
|
2334
|
+
function codePointAt(string, pos) {
|
|
2335
|
+
var first = string.charCodeAt(pos), second;
|
|
2336
|
+
if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
|
|
2337
|
+
second = string.charCodeAt(pos + 1);
|
|
2338
|
+
if (second >= 56320 && second <= 57343) {
|
|
2339
|
+
return (first - 55296) * 1024 + second - 56320 + 65536;
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
return first;
|
|
2343
|
+
}
|
|
2344
|
+
function needIndentIndicator(string) {
|
|
2345
|
+
var leadingSpaceRe = /^\n* /;
|
|
2346
|
+
return leadingSpaceRe.test(string);
|
|
2347
|
+
}
|
|
2348
|
+
var STYLE_PLAIN = 1;
|
|
2349
|
+
var STYLE_SINGLE = 2;
|
|
2350
|
+
var STYLE_LITERAL = 3;
|
|
2351
|
+
var STYLE_FOLDED = 4;
|
|
2352
|
+
var STYLE_DOUBLE = 5;
|
|
2353
|
+
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
|
|
2354
|
+
var i;
|
|
2355
|
+
var char = 0;
|
|
2356
|
+
var prevChar = null;
|
|
2357
|
+
var hasLineBreak = false;
|
|
2358
|
+
var hasFoldableLine = false;
|
|
2359
|
+
var shouldTrackWidth = lineWidth !== -1;
|
|
2360
|
+
var previousLineBreak = -1;
|
|
2361
|
+
var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
|
|
2362
|
+
if (singleLineOnly || forceQuotes) {
|
|
2363
|
+
for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
2364
|
+
char = codePointAt(string, i);
|
|
2365
|
+
if (!isPrintable(char)) {
|
|
2366
|
+
return STYLE_DOUBLE;
|
|
2367
|
+
}
|
|
2368
|
+
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
2369
|
+
prevChar = char;
|
|
2370
|
+
}
|
|
2371
|
+
} else {
|
|
2372
|
+
for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
2373
|
+
char = codePointAt(string, i);
|
|
2374
|
+
if (char === CHAR_LINE_FEED) {
|
|
2375
|
+
hasLineBreak = true;
|
|
2376
|
+
if (shouldTrackWidth) {
|
|
2377
|
+
hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
|
|
2378
|
+
i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
2379
|
+
previousLineBreak = i;
|
|
2380
|
+
}
|
|
2381
|
+
} else if (!isPrintable(char)) {
|
|
2382
|
+
return STYLE_DOUBLE;
|
|
2383
|
+
}
|
|
2384
|
+
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
2385
|
+
prevChar = char;
|
|
2386
|
+
}
|
|
2387
|
+
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
|
|
2388
|
+
}
|
|
2389
|
+
if (!hasLineBreak && !hasFoldableLine) {
|
|
2390
|
+
if (plain && !forceQuotes && !testAmbiguousType(string)) {
|
|
2391
|
+
return STYLE_PLAIN;
|
|
2392
|
+
}
|
|
2393
|
+
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
2394
|
+
}
|
|
2395
|
+
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
|
2396
|
+
return STYLE_DOUBLE;
|
|
2397
|
+
}
|
|
2398
|
+
if (!forceQuotes) {
|
|
2399
|
+
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
2400
|
+
}
|
|
2401
|
+
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
2402
|
+
}
|
|
2403
|
+
function writeScalar(state, string, level, iskey, inblock) {
|
|
2404
|
+
state.dump = (function() {
|
|
2405
|
+
if (string.length === 0) {
|
|
2406
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
|
|
2407
|
+
}
|
|
2408
|
+
if (!state.noCompatMode) {
|
|
2409
|
+
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
|
|
2410
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
var indent = state.indent * Math.max(1, level);
|
|
2414
|
+
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
2415
|
+
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
2416
|
+
function testAmbiguity(string2) {
|
|
2417
|
+
return testImplicitResolving(state, string2);
|
|
2418
|
+
}
|
|
2419
|
+
switch (chooseScalarStyle(
|
|
2420
|
+
string,
|
|
2421
|
+
singleLineOnly,
|
|
2422
|
+
state.indent,
|
|
2423
|
+
lineWidth,
|
|
2424
|
+
testAmbiguity,
|
|
2425
|
+
state.quotingType,
|
|
2426
|
+
state.forceQuotes && !iskey,
|
|
2427
|
+
inblock
|
|
2428
|
+
)) {
|
|
2429
|
+
case STYLE_PLAIN:
|
|
2430
|
+
return string;
|
|
2431
|
+
case STYLE_SINGLE:
|
|
2432
|
+
return "'" + string.replace(/'/g, "''") + "'";
|
|
2433
|
+
case STYLE_LITERAL:
|
|
2434
|
+
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
|
2435
|
+
case STYLE_FOLDED:
|
|
2436
|
+
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
2437
|
+
case STYLE_DOUBLE:
|
|
2438
|
+
return '"' + escapeString(string, lineWidth) + '"';
|
|
2439
|
+
default:
|
|
2440
|
+
throw new YAMLException("impossible error: invalid scalar style");
|
|
2441
|
+
}
|
|
2442
|
+
})();
|
|
2443
|
+
}
|
|
2444
|
+
function blockHeader(string, indentPerLevel) {
|
|
2445
|
+
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
|
|
2446
|
+
var clip = string[string.length - 1] === "\n";
|
|
2447
|
+
var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
|
|
2448
|
+
var chomp = keep ? "+" : clip ? "" : "-";
|
|
2449
|
+
return indentIndicator + chomp + "\n";
|
|
2450
|
+
}
|
|
2451
|
+
function dropEndingNewline(string) {
|
|
2452
|
+
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
2453
|
+
}
|
|
2454
|
+
function foldString(string, width) {
|
|
2455
|
+
var lineRe = /(\n+)([^\n]*)/g;
|
|
2456
|
+
var result = (function() {
|
|
2457
|
+
var nextLF = string.indexOf("\n");
|
|
2458
|
+
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
2459
|
+
lineRe.lastIndex = nextLF;
|
|
2460
|
+
return foldLine(string.slice(0, nextLF), width);
|
|
2461
|
+
})();
|
|
2462
|
+
var prevMoreIndented = string[0] === "\n" || string[0] === " ";
|
|
2463
|
+
var moreIndented;
|
|
2464
|
+
var match;
|
|
2465
|
+
while (match = lineRe.exec(string)) {
|
|
2466
|
+
var prefix = match[1], line = match[2];
|
|
2467
|
+
moreIndented = line[0] === " ";
|
|
2468
|
+
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
2469
|
+
prevMoreIndented = moreIndented;
|
|
2470
|
+
}
|
|
2471
|
+
return result;
|
|
2472
|
+
}
|
|
2473
|
+
function foldLine(line, width) {
|
|
2474
|
+
if (line === "" || line[0] === " ") return line;
|
|
2475
|
+
var breakRe = / [^ ]/g;
|
|
2476
|
+
var match;
|
|
2477
|
+
var start = 0, end, curr = 0, next = 0;
|
|
2478
|
+
var result = "";
|
|
2479
|
+
while (match = breakRe.exec(line)) {
|
|
2480
|
+
next = match.index;
|
|
2481
|
+
if (next - start > width) {
|
|
2482
|
+
end = curr > start ? curr : next;
|
|
2483
|
+
result += "\n" + line.slice(start, end);
|
|
2484
|
+
start = end + 1;
|
|
2485
|
+
}
|
|
2486
|
+
curr = next;
|
|
2487
|
+
}
|
|
2488
|
+
result += "\n";
|
|
2489
|
+
if (line.length - start > width && curr > start) {
|
|
2490
|
+
result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
|
2491
|
+
} else {
|
|
2492
|
+
result += line.slice(start);
|
|
2493
|
+
}
|
|
2494
|
+
return result.slice(1);
|
|
2495
|
+
}
|
|
2496
|
+
function escapeString(string) {
|
|
2497
|
+
var result = "";
|
|
2498
|
+
var char = 0;
|
|
2499
|
+
var escapeSeq;
|
|
2500
|
+
for (var i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
2501
|
+
char = codePointAt(string, i);
|
|
2502
|
+
escapeSeq = ESCAPE_SEQUENCES[char];
|
|
2503
|
+
if (!escapeSeq && isPrintable(char)) {
|
|
2504
|
+
result += string[i];
|
|
2505
|
+
if (char >= 65536) result += string[i + 1];
|
|
2506
|
+
} else {
|
|
2507
|
+
result += escapeSeq || encodeHex(char);
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
return result;
|
|
2511
|
+
}
|
|
2512
|
+
function writeFlowSequence(state, level, object) {
|
|
2513
|
+
var _result = "", _tag = state.tag, index, length, value;
|
|
2514
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
2515
|
+
value = object[index];
|
|
2516
|
+
if (state.replacer) {
|
|
2517
|
+
value = state.replacer.call(object, String(index), value);
|
|
2518
|
+
}
|
|
2519
|
+
if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
|
|
2520
|
+
if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
|
|
2521
|
+
_result += state.dump;
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
state.tag = _tag;
|
|
2525
|
+
state.dump = "[" + _result + "]";
|
|
2526
|
+
}
|
|
2527
|
+
function writeBlockSequence(state, level, object, compact) {
|
|
2528
|
+
var _result = "", _tag = state.tag, index, length, value;
|
|
2529
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
2530
|
+
value = object[index];
|
|
2531
|
+
if (state.replacer) {
|
|
2532
|
+
value = state.replacer.call(object, String(index), value);
|
|
2533
|
+
}
|
|
2534
|
+
if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
|
|
2535
|
+
if (!compact || _result !== "") {
|
|
2536
|
+
_result += generateNextLine(state, level);
|
|
2537
|
+
}
|
|
2538
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
2539
|
+
_result += "-";
|
|
2540
|
+
} else {
|
|
2541
|
+
_result += "- ";
|
|
2542
|
+
}
|
|
2543
|
+
_result += state.dump;
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
state.tag = _tag;
|
|
2547
|
+
state.dump = _result || "[]";
|
|
2548
|
+
}
|
|
2549
|
+
function writeFlowMapping(state, level, object) {
|
|
2550
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
|
|
2551
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
2552
|
+
pairBuffer = "";
|
|
2553
|
+
if (_result !== "") pairBuffer += ", ";
|
|
2554
|
+
if (state.condenseFlow) pairBuffer += '"';
|
|
2555
|
+
objectKey = objectKeyList[index];
|
|
2556
|
+
objectValue = object[objectKey];
|
|
2557
|
+
if (state.replacer) {
|
|
2558
|
+
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
2559
|
+
}
|
|
2560
|
+
if (!writeNode(state, level, objectKey, false, false)) {
|
|
2561
|
+
continue;
|
|
2562
|
+
}
|
|
2563
|
+
if (state.dump.length > 1024) pairBuffer += "? ";
|
|
2564
|
+
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
2565
|
+
if (!writeNode(state, level, objectValue, false, false)) {
|
|
2566
|
+
continue;
|
|
2567
|
+
}
|
|
2568
|
+
pairBuffer += state.dump;
|
|
2569
|
+
_result += pairBuffer;
|
|
2570
|
+
}
|
|
2571
|
+
state.tag = _tag;
|
|
2572
|
+
state.dump = "{" + _result + "}";
|
|
2573
|
+
}
|
|
2574
|
+
function writeBlockMapping(state, level, object, compact) {
|
|
2575
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
|
|
2576
|
+
if (state.sortKeys === true) {
|
|
2577
|
+
objectKeyList.sort();
|
|
2578
|
+
} else if (typeof state.sortKeys === "function") {
|
|
2579
|
+
objectKeyList.sort(state.sortKeys);
|
|
2580
|
+
} else if (state.sortKeys) {
|
|
2581
|
+
throw new YAMLException("sortKeys must be a boolean or a function");
|
|
2582
|
+
}
|
|
2583
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
2584
|
+
pairBuffer = "";
|
|
2585
|
+
if (!compact || _result !== "") {
|
|
2586
|
+
pairBuffer += generateNextLine(state, level);
|
|
2587
|
+
}
|
|
2588
|
+
objectKey = objectKeyList[index];
|
|
2589
|
+
objectValue = object[objectKey];
|
|
2590
|
+
if (state.replacer) {
|
|
2591
|
+
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
2592
|
+
}
|
|
2593
|
+
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
2594
|
+
continue;
|
|
2595
|
+
}
|
|
2596
|
+
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
2597
|
+
if (explicitPair) {
|
|
2598
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
2599
|
+
pairBuffer += "?";
|
|
2600
|
+
} else {
|
|
2601
|
+
pairBuffer += "? ";
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
pairBuffer += state.dump;
|
|
2605
|
+
if (explicitPair) {
|
|
2606
|
+
pairBuffer += generateNextLine(state, level);
|
|
2607
|
+
}
|
|
2608
|
+
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
2609
|
+
continue;
|
|
2610
|
+
}
|
|
2611
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
2612
|
+
pairBuffer += ":";
|
|
2613
|
+
} else {
|
|
2614
|
+
pairBuffer += ": ";
|
|
2615
|
+
}
|
|
2616
|
+
pairBuffer += state.dump;
|
|
2617
|
+
_result += pairBuffer;
|
|
2618
|
+
}
|
|
2619
|
+
state.tag = _tag;
|
|
2620
|
+
state.dump = _result || "{}";
|
|
2621
|
+
}
|
|
2622
|
+
function detectType(state, object, explicit) {
|
|
2623
|
+
var _result, typeList, index, length, type, style;
|
|
2624
|
+
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
2625
|
+
for (index = 0, length = typeList.length; index < length; index += 1) {
|
|
2626
|
+
type = typeList[index];
|
|
2627
|
+
if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
|
|
2628
|
+
if (explicit) {
|
|
2629
|
+
if (type.multi && type.representName) {
|
|
2630
|
+
state.tag = type.representName(object);
|
|
2631
|
+
} else {
|
|
2632
|
+
state.tag = type.tag;
|
|
2633
|
+
}
|
|
2634
|
+
} else {
|
|
2635
|
+
state.tag = "?";
|
|
2636
|
+
}
|
|
2637
|
+
if (type.represent) {
|
|
2638
|
+
style = state.styleMap[type.tag] || type.defaultStyle;
|
|
2639
|
+
if (_toString.call(type.represent) === "[object Function]") {
|
|
2640
|
+
_result = type.represent(object, style);
|
|
2641
|
+
} else if (_hasOwnProperty.call(type.represent, style)) {
|
|
2642
|
+
_result = type.represent[style](object, style);
|
|
2643
|
+
} else {
|
|
2644
|
+
throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style');
|
|
2645
|
+
}
|
|
2646
|
+
state.dump = _result;
|
|
2647
|
+
}
|
|
2648
|
+
return true;
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
return false;
|
|
2652
|
+
}
|
|
2653
|
+
function writeNode(state, level, object, block, compact, iskey, isblockseq) {
|
|
2654
|
+
state.tag = null;
|
|
2655
|
+
state.dump = object;
|
|
2656
|
+
if (!detectType(state, object, false)) {
|
|
2657
|
+
detectType(state, object, true);
|
|
2658
|
+
}
|
|
2659
|
+
var type = _toString.call(state.dump);
|
|
2660
|
+
var inblock = block;
|
|
2661
|
+
var tagStr;
|
|
2662
|
+
if (block) {
|
|
2663
|
+
block = state.flowLevel < 0 || state.flowLevel > level;
|
|
2664
|
+
}
|
|
2665
|
+
var objectOrArray = type === "[object Object]" || type === "[object Array]", duplicateIndex, duplicate;
|
|
2666
|
+
if (objectOrArray) {
|
|
2667
|
+
duplicateIndex = state.duplicates.indexOf(object);
|
|
2668
|
+
duplicate = duplicateIndex !== -1;
|
|
2669
|
+
}
|
|
2670
|
+
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
|
2671
|
+
compact = false;
|
|
2672
|
+
}
|
|
2673
|
+
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
2674
|
+
state.dump = "*ref_" + duplicateIndex;
|
|
2675
|
+
} else {
|
|
2676
|
+
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
2677
|
+
state.usedDuplicates[duplicateIndex] = true;
|
|
2678
|
+
}
|
|
2679
|
+
if (type === "[object Object]") {
|
|
2680
|
+
if (block && Object.keys(state.dump).length !== 0) {
|
|
2681
|
+
writeBlockMapping(state, level, state.dump, compact);
|
|
2682
|
+
if (duplicate) {
|
|
2683
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
2684
|
+
}
|
|
2685
|
+
} else {
|
|
2686
|
+
writeFlowMapping(state, level, state.dump);
|
|
2687
|
+
if (duplicate) {
|
|
2688
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
} else if (type === "[object Array]") {
|
|
2692
|
+
if (block && state.dump.length !== 0) {
|
|
2693
|
+
if (state.noArrayIndent && !isblockseq && level > 0) {
|
|
2694
|
+
writeBlockSequence(state, level - 1, state.dump, compact);
|
|
2695
|
+
} else {
|
|
2696
|
+
writeBlockSequence(state, level, state.dump, compact);
|
|
2697
|
+
}
|
|
2698
|
+
if (duplicate) {
|
|
2699
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
2700
|
+
}
|
|
2701
|
+
} else {
|
|
2702
|
+
writeFlowSequence(state, level, state.dump);
|
|
2703
|
+
if (duplicate) {
|
|
2704
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
} else if (type === "[object String]") {
|
|
2708
|
+
if (state.tag !== "?") {
|
|
2709
|
+
writeScalar(state, state.dump, level, iskey, inblock);
|
|
2710
|
+
}
|
|
2711
|
+
} else if (type === "[object Undefined]") {
|
|
2712
|
+
return false;
|
|
2713
|
+
} else {
|
|
2714
|
+
if (state.skipInvalid) return false;
|
|
2715
|
+
throw new YAMLException("unacceptable kind of an object to dump " + type);
|
|
2716
|
+
}
|
|
2717
|
+
if (state.tag !== null && state.tag !== "?") {
|
|
2718
|
+
tagStr = encodeURI(
|
|
2719
|
+
state.tag[0] === "!" ? state.tag.slice(1) : state.tag
|
|
2720
|
+
).replace(/!/g, "%21");
|
|
2721
|
+
if (state.tag[0] === "!") {
|
|
2722
|
+
tagStr = "!" + tagStr;
|
|
2723
|
+
} else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
|
|
2724
|
+
tagStr = "!!" + tagStr.slice(18);
|
|
2725
|
+
} else {
|
|
2726
|
+
tagStr = "!<" + tagStr + ">";
|
|
2727
|
+
}
|
|
2728
|
+
state.dump = tagStr + " " + state.dump;
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
return true;
|
|
2732
|
+
}
|
|
2733
|
+
function getDuplicateReferences(object, state) {
|
|
2734
|
+
var objects = [], duplicatesIndexes = [], index, length;
|
|
2735
|
+
inspectNode(object, objects, duplicatesIndexes);
|
|
2736
|
+
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
|
|
2737
|
+
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
2738
|
+
}
|
|
2739
|
+
state.usedDuplicates = new Array(length);
|
|
2740
|
+
}
|
|
2741
|
+
function inspectNode(object, objects, duplicatesIndexes) {
|
|
2742
|
+
var objectKeyList, index, length;
|
|
2743
|
+
if (object !== null && typeof object === "object") {
|
|
2744
|
+
index = objects.indexOf(object);
|
|
2745
|
+
if (index !== -1) {
|
|
2746
|
+
if (duplicatesIndexes.indexOf(index) === -1) {
|
|
2747
|
+
duplicatesIndexes.push(index);
|
|
2748
|
+
}
|
|
2749
|
+
} else {
|
|
2750
|
+
objects.push(object);
|
|
2751
|
+
if (Array.isArray(object)) {
|
|
2752
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
2753
|
+
inspectNode(object[index], objects, duplicatesIndexes);
|
|
2754
|
+
}
|
|
2755
|
+
} else {
|
|
2756
|
+
objectKeyList = Object.keys(object);
|
|
2757
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
2758
|
+
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
function dump(input, options) {
|
|
2765
|
+
options = options || {};
|
|
2766
|
+
var state = new State(options);
|
|
2767
|
+
if (!state.noRefs) getDuplicateReferences(input, state);
|
|
2768
|
+
var value = input;
|
|
2769
|
+
if (state.replacer) {
|
|
2770
|
+
value = state.replacer.call({ "": value }, "", value);
|
|
2771
|
+
}
|
|
2772
|
+
if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
|
|
2773
|
+
return "";
|
|
2774
|
+
}
|
|
2775
|
+
module.exports.dump = dump;
|
|
2776
|
+
}
|
|
2777
|
+
});
|
|
2778
|
+
|
|
2779
|
+
// node_modules/js-yaml/index.js
|
|
2780
|
+
var require_js_yaml = __commonJS({
|
|
2781
|
+
"node_modules/js-yaml/index.js"(exports, module) {
|
|
2782
|
+
"use strict";
|
|
2783
|
+
var loader = require_loader();
|
|
2784
|
+
var dumper = require_dumper();
|
|
2785
|
+
function renamed(from, to) {
|
|
2786
|
+
return function() {
|
|
2787
|
+
throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
|
|
2788
|
+
};
|
|
2789
|
+
}
|
|
2790
|
+
module.exports.Type = require_type();
|
|
2791
|
+
module.exports.Schema = require_schema();
|
|
2792
|
+
module.exports.FAILSAFE_SCHEMA = require_failsafe();
|
|
2793
|
+
module.exports.JSON_SCHEMA = require_json();
|
|
2794
|
+
module.exports.CORE_SCHEMA = require_core();
|
|
2795
|
+
module.exports.DEFAULT_SCHEMA = require_default();
|
|
2796
|
+
module.exports.load = loader.load;
|
|
2797
|
+
module.exports.loadAll = loader.loadAll;
|
|
2798
|
+
module.exports.dump = dumper.dump;
|
|
2799
|
+
module.exports.YAMLException = require_exception();
|
|
2800
|
+
module.exports.types = {
|
|
2801
|
+
binary: require_binary(),
|
|
2802
|
+
float: require_float(),
|
|
2803
|
+
map: require_map(),
|
|
2804
|
+
null: require_null(),
|
|
2805
|
+
pairs: require_pairs(),
|
|
2806
|
+
set: require_set(),
|
|
2807
|
+
timestamp: require_timestamp(),
|
|
2808
|
+
bool: require_bool(),
|
|
2809
|
+
int: require_int(),
|
|
2810
|
+
merge: require_merge(),
|
|
2811
|
+
omap: require_omap(),
|
|
2812
|
+
seq: require_seq(),
|
|
2813
|
+
str: require_str()
|
|
2814
|
+
};
|
|
2815
|
+
module.exports.safeLoad = renamed("safeLoad", "load");
|
|
2816
|
+
module.exports.safeLoadAll = renamed("safeLoadAll", "loadAll");
|
|
2817
|
+
module.exports.safeDump = renamed("safeDump", "dump");
|
|
2818
|
+
}
|
|
2819
|
+
});
|
|
2820
|
+
|
|
2821
|
+
// node_modules/marked/lib/marked.esm.js
|
|
2822
|
+
var marked_esm_exports = {};
|
|
2823
|
+
__export(marked_esm_exports, {
|
|
2824
|
+
Hooks: () => P,
|
|
2825
|
+
Lexer: () => x,
|
|
2826
|
+
Marked: () => B,
|
|
2827
|
+
Parser: () => b,
|
|
2828
|
+
Renderer: () => y,
|
|
2829
|
+
TextRenderer: () => $,
|
|
2830
|
+
Tokenizer: () => w,
|
|
2831
|
+
defaults: () => T,
|
|
2832
|
+
getDefaults: () => M,
|
|
2833
|
+
lexer: () => en,
|
|
2834
|
+
marked: () => g,
|
|
2835
|
+
options: () => Ut,
|
|
2836
|
+
parse: () => Vt,
|
|
2837
|
+
parseInline: () => Jt,
|
|
2838
|
+
parser: () => Yt,
|
|
2839
|
+
setOptions: () => Kt,
|
|
2840
|
+
use: () => Wt,
|
|
2841
|
+
walkTokens: () => Xt
|
|
2842
|
+
});
|
|
2843
|
+
function M() {
|
|
2844
|
+
return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
|
|
2845
|
+
}
|
|
2846
|
+
function G(u3) {
|
|
2847
|
+
T = u3;
|
|
2848
|
+
}
|
|
2849
|
+
function k(u3, e = "") {
|
|
2850
|
+
let t = typeof u3 == "string" ? u3 : u3.source, n = { replace: (r, i) => {
|
|
2851
|
+
let s = typeof i == "string" ? i : i.source;
|
|
2852
|
+
return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
|
|
2853
|
+
}, getRegex: () => new RegExp(t, e) };
|
|
2854
|
+
return n;
|
|
2855
|
+
}
|
|
2856
|
+
function O(u3, e) {
|
|
2857
|
+
if (e) {
|
|
2858
|
+
if (m.escapeTest.test(u3)) return u3.replace(m.escapeReplace, de);
|
|
2859
|
+
} else if (m.escapeTestNoEncode.test(u3)) return u3.replace(m.escapeReplaceNoEncode, de);
|
|
2860
|
+
return u3;
|
|
2861
|
+
}
|
|
2862
|
+
function X(u3) {
|
|
2863
|
+
try {
|
|
2864
|
+
u3 = encodeURI(u3).replace(m.percentDecode, "%");
|
|
2865
|
+
} catch {
|
|
2866
|
+
return null;
|
|
2867
|
+
}
|
|
2868
|
+
return u3;
|
|
2869
|
+
}
|
|
2870
|
+
function J(u3, e) {
|
|
2871
|
+
let t = u3.replace(m.findPipe, (i, s, a) => {
|
|
2872
|
+
let o = false, l = s;
|
|
2873
|
+
for (; --l >= 0 && a[l] === "\\"; ) o = !o;
|
|
2874
|
+
return o ? "|" : " |";
|
|
2875
|
+
}), n = t.split(m.splitPipe), r = 0;
|
|
2876
|
+
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
|
|
2877
|
+
else for (; n.length < e; ) n.push("");
|
|
2878
|
+
for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
|
|
2879
|
+
return n;
|
|
2880
|
+
}
|
|
2881
|
+
function E(u3, e, t) {
|
|
2882
|
+
let n = u3.length;
|
|
2883
|
+
if (n === 0) return "";
|
|
2884
|
+
let r = 0;
|
|
2885
|
+
for (; r < n; ) {
|
|
2886
|
+
let i = u3.charAt(n - r - 1);
|
|
2887
|
+
if (i === e && !t) r++;
|
|
2888
|
+
else if (i !== e && t) r++;
|
|
2889
|
+
else break;
|
|
2890
|
+
}
|
|
2891
|
+
return u3.slice(0, n - r);
|
|
2892
|
+
}
|
|
2893
|
+
function ge(u3, e) {
|
|
2894
|
+
if (u3.indexOf(e[1]) === -1) return -1;
|
|
2895
|
+
let t = 0;
|
|
2896
|
+
for (let n = 0; n < u3.length; n++) if (u3[n] === "\\") n++;
|
|
2897
|
+
else if (u3[n] === e[0]) t++;
|
|
2898
|
+
else if (u3[n] === e[1] && (t--, t < 0)) return n;
|
|
2899
|
+
return t > 0 ? -2 : -1;
|
|
2900
|
+
}
|
|
2901
|
+
function fe(u3, e = 0) {
|
|
2902
|
+
let t = e, n = "";
|
|
2903
|
+
for (let r of u3) if (r === " ") {
|
|
2904
|
+
let i = 4 - t % 4;
|
|
2905
|
+
n += " ".repeat(i), t += i;
|
|
2906
|
+
} else n += r, t++;
|
|
2907
|
+
return n;
|
|
2908
|
+
}
|
|
2909
|
+
function me(u3, e, t, n, r) {
|
|
2910
|
+
let i = e.href, s = e.title || null, a = u3[1].replace(r.other.outputLinkReplace, "$1");
|
|
2911
|
+
n.state.inLink = true;
|
|
2912
|
+
let o = { type: u3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: s, text: a, tokens: n.inlineTokens(a) };
|
|
2913
|
+
return n.state.inLink = false, o;
|
|
2914
|
+
}
|
|
2915
|
+
function it(u3, e, t) {
|
|
2916
|
+
let n = u3.match(t.other.indentCodeCompensation);
|
|
2917
|
+
if (n === null) return e;
|
|
2918
|
+
let r = n[1];
|
|
2919
|
+
return e.split(`
|
|
2920
|
+
`).map((i) => {
|
|
2921
|
+
let s = i.match(t.other.beginningSpace);
|
|
2922
|
+
if (s === null) return i;
|
|
2923
|
+
let [a] = s;
|
|
2924
|
+
return a.length >= r.length ? i.slice(r.length) : i;
|
|
2925
|
+
}).join(`
|
|
2926
|
+
`);
|
|
2927
|
+
}
|
|
2928
|
+
function g(u3, e) {
|
|
2929
|
+
return L.parse(u3, e);
|
|
2930
|
+
}
|
|
2931
|
+
var T, _, Re, m, Te, Oe, we, A, ye, N, re, se, Pe, Q, Se, j, $e, _e, q, F, Le, ie, Me, U, te, ze, Ee, Ie, Ae, oe, Ce, v, K, ae, Be, le, De, qe, ue, ve, He, Ge, pe, Ze, Ne, ce, Qe, je, Fe, Ue, Ke, We, Xe, Je, Ve, Ye, D, et, he, ke, tt, ne, W, nt, Z, rt, C, z, st, de, w, x, y, $, b, P, B, L, Ut, Kt, Wt, Xt, Jt, Vt, Yt, en;
|
|
2932
|
+
var init_marked_esm = __esm({
|
|
2933
|
+
"node_modules/marked/lib/marked.esm.js"() {
|
|
2934
|
+
T = M();
|
|
2935
|
+
_ = { exec: () => null };
|
|
2936
|
+
Re = (() => {
|
|
2937
|
+
try {
|
|
2938
|
+
return !!new RegExp("(?<=1)(?<!1)");
|
|
2939
|
+
} catch {
|
|
2940
|
+
return false;
|
|
2941
|
+
}
|
|
2942
|
+
})();
|
|
2943
|
+
m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (u3) => new RegExp(`^( {0,3}${u3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}#`), htmlBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}>`) };
|
|
2944
|
+
Te = /^(?:[ \t]*(?:\n|$))+/;
|
|
2945
|
+
Oe = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
2946
|
+
we = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
2947
|
+
A = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
2948
|
+
ye = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
2949
|
+
N = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
|
|
2950
|
+
re = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
|
|
2951
|
+
se = k(re).replace(/bull/g, N).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
|
|
2952
|
+
Pe = k(re).replace(/bull/g, N).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
|
|
2953
|
+
Q = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
|
2954
|
+
Se = /^[^\n]+/;
|
|
2955
|
+
j = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
|
|
2956
|
+
$e = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", j).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
2957
|
+
_e = k(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, N).getRegex();
|
|
2958
|
+
q = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
|
|
2959
|
+
F = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
2960
|
+
Le = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", F).replace("tag", q).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
2961
|
+
ie = k(Q).replace("hr", A).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex();
|
|
2962
|
+
Me = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ie).getRegex();
|
|
2963
|
+
U = { blockquote: Me, code: Oe, def: $e, fences: we, heading: ye, hr: A, html: Le, lheading: se, list: _e, newline: Te, paragraph: ie, table: _, text: Se };
|
|
2964
|
+
te = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", A).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex();
|
|
2965
|
+
ze = { ...U, lheading: Pe, table: te, paragraph: k(Q).replace("hr", A).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", te).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex() };
|
|
2966
|
+
Ee = { ...U, html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", F).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: _, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: k(Q).replace("hr", A).replace("heading", ` *#{1,6} *[^
|
|
2967
|
+
]`).replace("lheading", se).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
|
|
2968
|
+
Ie = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
2969
|
+
Ae = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
2970
|
+
oe = /^( {2,}|\\)\n(?!\s*$)/;
|
|
2971
|
+
Ce = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
2972
|
+
v = /[\p{P}\p{S}]/u;
|
|
2973
|
+
K = /[\s\p{P}\p{S}]/u;
|
|
2974
|
+
ae = /[^\s\p{P}\p{S}]/u;
|
|
2975
|
+
Be = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, K).getRegex();
|
|
2976
|
+
le = /(?!~)[\p{P}\p{S}]/u;
|
|
2977
|
+
De = /(?!~)[\s\p{P}\p{S}]/u;
|
|
2978
|
+
qe = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
2979
|
+
ue = /(?![*_])[\p{P}\p{S}]/u;
|
|
2980
|
+
ve = /(?![*_])[\s\p{P}\p{S}]/u;
|
|
2981
|
+
He = /(?:[^\s\p{P}\p{S}]|[*_])/u;
|
|
2982
|
+
Ge = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Re ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
|
|
2983
|
+
pe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
|
|
2984
|
+
Ze = k(pe, "u").replace(/punct/g, v).getRegex();
|
|
2985
|
+
Ne = k(pe, "u").replace(/punct/g, le).getRegex();
|
|
2986
|
+
ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
|
|
2987
|
+
Qe = k(ce, "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, v).getRegex();
|
|
2988
|
+
je = k(ce, "gu").replace(/notPunctSpace/g, qe).replace(/punctSpace/g, De).replace(/punct/g, le).getRegex();
|
|
2989
|
+
Fe = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, v).getRegex();
|
|
2990
|
+
Ue = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, ue).getRegex();
|
|
2991
|
+
Ke = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";
|
|
2992
|
+
We = k(Ke, "gu").replace(/notPunctSpace/g, He).replace(/punctSpace/g, ve).replace(/punct/g, ue).getRegex();
|
|
2993
|
+
Xe = k(/\\(punct)/, "gu").replace(/punct/g, v).getRegex();
|
|
2994
|
+
Je = k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
|
|
2995
|
+
Ve = k(F).replace("(?:-->|$)", "-->").getRegex();
|
|
2996
|
+
Ye = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Ve).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
2997
|
+
D = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/;
|
|
2998
|
+
et = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", D).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
|
|
2999
|
+
he = k(/^!?\[(label)\]\[(ref)\]/).replace("label", D).replace("ref", j).getRegex();
|
|
3000
|
+
ke = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", j).getRegex();
|
|
3001
|
+
tt = k("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink", ke).getRegex();
|
|
3002
|
+
ne = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
|
|
3003
|
+
W = { _backpedal: _, anyPunctuation: Xe, autolink: Je, blockSkip: Ge, br: oe, code: Ae, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: Ze, emStrongRDelimAst: Qe, emStrongRDelimUnd: Fe, escape: Ie, link: et, nolink: ke, punctuation: Be, reflink: he, reflinkSearch: tt, tag: Ye, text: Ce, url: _ };
|
|
3004
|
+
nt = { ...W, link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", D).getRegex(), reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", D).getRegex() };
|
|
3005
|
+
Z = { ...W, emStrongRDelimAst: je, emStrongLDelim: Ne, delLDelim: Ue, delRDelim: We, url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ne).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ne).getRegex() };
|
|
3006
|
+
rt = { ...Z, br: k(oe).replace("{2,}", "*").getRegex(), text: k(Z.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
|
|
3007
|
+
C = { normal: U, gfm: ze, pedantic: Ee };
|
|
3008
|
+
z = { normal: W, gfm: Z, breaks: rt, pedantic: nt };
|
|
3009
|
+
st = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
|
3010
|
+
de = (u3) => st[u3];
|
|
3011
|
+
w = class {
|
|
3012
|
+
options;
|
|
3013
|
+
rules;
|
|
3014
|
+
lexer;
|
|
3015
|
+
constructor(e) {
|
|
3016
|
+
this.options = e || T;
|
|
3017
|
+
}
|
|
3018
|
+
space(e) {
|
|
3019
|
+
let t = this.rules.block.newline.exec(e);
|
|
3020
|
+
if (t && t[0].length > 0) return { type: "space", raw: t[0] };
|
|
3021
|
+
}
|
|
3022
|
+
code(e) {
|
|
3023
|
+
let t = this.rules.block.code.exec(e);
|
|
3024
|
+
if (t) {
|
|
3025
|
+
let n = t[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
3026
|
+
return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : E(n, `
|
|
3027
|
+
`) };
|
|
3028
|
+
}
|
|
3029
|
+
}
|
|
3030
|
+
fences(e) {
|
|
3031
|
+
let t = this.rules.block.fences.exec(e);
|
|
3032
|
+
if (t) {
|
|
3033
|
+
let n = t[0], r = it(n, t[3] || "", this.rules);
|
|
3034
|
+
return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: r };
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
3037
|
+
heading(e) {
|
|
3038
|
+
let t = this.rules.block.heading.exec(e);
|
|
3039
|
+
if (t) {
|
|
3040
|
+
let n = t[2].trim();
|
|
3041
|
+
if (this.rules.other.endingHash.test(n)) {
|
|
3042
|
+
let r = E(n, "#");
|
|
3043
|
+
(this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
|
|
3044
|
+
}
|
|
3045
|
+
return { type: "heading", raw: t[0], depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
hr(e) {
|
|
3049
|
+
let t = this.rules.block.hr.exec(e);
|
|
3050
|
+
if (t) return { type: "hr", raw: E(t[0], `
|
|
3051
|
+
`) };
|
|
3052
|
+
}
|
|
3053
|
+
blockquote(e) {
|
|
3054
|
+
let t = this.rules.block.blockquote.exec(e);
|
|
3055
|
+
if (t) {
|
|
3056
|
+
let n = E(t[0], `
|
|
3057
|
+
`).split(`
|
|
3058
|
+
`), r = "", i = "", s = [];
|
|
3059
|
+
for (; n.length > 0; ) {
|
|
3060
|
+
let a = false, o = [], l;
|
|
3061
|
+
for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l])) o.push(n[l]), a = true;
|
|
3062
|
+
else if (!a) o.push(n[l]);
|
|
3063
|
+
else break;
|
|
3064
|
+
n = n.slice(l);
|
|
3065
|
+
let p = o.join(`
|
|
3066
|
+
`), c = p.replace(this.rules.other.blockquoteSetextReplace, `
|
|
3067
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
3068
|
+
r = r ? `${r}
|
|
3069
|
+
${p}` : p, i = i ? `${i}
|
|
3070
|
+
${c}` : c;
|
|
3071
|
+
let d = this.lexer.state.top;
|
|
3072
|
+
if (this.lexer.state.top = true, this.lexer.blockTokens(c, s, true), this.lexer.state.top = d, n.length === 0) break;
|
|
3073
|
+
let h = s.at(-1);
|
|
3074
|
+
if (h?.type === "code") break;
|
|
3075
|
+
if (h?.type === "blockquote") {
|
|
3076
|
+
let R = h, f = R.raw + `
|
|
3077
|
+
` + n.join(`
|
|
3078
|
+
`), S = this.blockquote(f);
|
|
3079
|
+
s[s.length - 1] = S, r = r.substring(0, r.length - R.raw.length) + S.raw, i = i.substring(0, i.length - R.text.length) + S.text;
|
|
3080
|
+
break;
|
|
3081
|
+
} else if (h?.type === "list") {
|
|
3082
|
+
let R = h, f = R.raw + `
|
|
3083
|
+
` + n.join(`
|
|
3084
|
+
`), S = this.list(f);
|
|
3085
|
+
s[s.length - 1] = S, r = r.substring(0, r.length - h.raw.length) + S.raw, i = i.substring(0, i.length - R.raw.length) + S.raw, n = f.substring(s.at(-1).raw.length).split(`
|
|
3086
|
+
`);
|
|
3087
|
+
continue;
|
|
3088
|
+
}
|
|
3089
|
+
}
|
|
3090
|
+
return { type: "blockquote", raw: r, tokens: s, text: i };
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3093
|
+
list(e) {
|
|
3094
|
+
let t = this.rules.block.list.exec(e);
|
|
3095
|
+
if (t) {
|
|
3096
|
+
let n = t[1].trim(), r = n.length > 1, i = { type: "list", raw: "", ordered: r, start: r ? +n.slice(0, -1) : "", loose: false, items: [] };
|
|
3097
|
+
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
3098
|
+
let s = this.rules.other.listItemRegex(n), a = false;
|
|
3099
|
+
for (; e; ) {
|
|
3100
|
+
let l = false, p = "", c = "";
|
|
3101
|
+
if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
3102
|
+
p = t[0], e = e.substring(p.length);
|
|
3103
|
+
let d = fe(t[2].split(`
|
|
3104
|
+
`, 1)[0], t[1].length), h = e.split(`
|
|
3105
|
+
`, 1)[0], R = !d.trim(), f = 0;
|
|
3106
|
+
if (this.options.pedantic ? (f = 2, c = d.trimStart()) : R ? f = t[1].length + 1 : (f = d.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = d.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (p += h + `
|
|
3107
|
+
`, e = e.substring(h.length + 1), l = true), !l) {
|
|
3108
|
+
let S = this.rules.other.nextBulletRegex(f), V = this.rules.other.hrRegex(f), Y = this.rules.other.fencesBeginRegex(f), ee = this.rules.other.headingBeginRegex(f), xe = this.rules.other.htmlBeginRegex(f), be = this.rules.other.blockquoteBeginRegex(f);
|
|
3109
|
+
for (; e; ) {
|
|
3110
|
+
let H = e.split(`
|
|
3111
|
+
`, 1)[0], I;
|
|
3112
|
+
if (h = H, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), I = h) : I = h.replace(this.rules.other.tabCharGlobal, " "), Y.test(h) || ee.test(h) || xe.test(h) || be.test(h) || S.test(h) || V.test(h)) break;
|
|
3113
|
+
if (I.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) c += `
|
|
3114
|
+
` + I.slice(f);
|
|
3115
|
+
else {
|
|
3116
|
+
if (R || d.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Y.test(d) || ee.test(d) || V.test(d)) break;
|
|
3117
|
+
c += `
|
|
3118
|
+
` + h;
|
|
3119
|
+
}
|
|
3120
|
+
R = !h.trim(), p += H + `
|
|
3121
|
+
`, e = e.substring(H.length + 1), d = I.slice(f);
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3124
|
+
i.loose || (a ? i.loose = true : this.rules.other.doubleBlankLine.test(p) && (a = true)), i.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(c), loose: false, text: c, tokens: [] }), i.raw += p;
|
|
3125
|
+
}
|
|
3126
|
+
let o = i.items.at(-1);
|
|
3127
|
+
if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
|
|
3128
|
+
else return;
|
|
3129
|
+
i.raw = i.raw.trimEnd();
|
|
3130
|
+
for (let l of i.items) {
|
|
3131
|
+
if (this.lexer.state.top = false, l.tokens = this.lexer.blockTokens(l.text, []), l.task) {
|
|
3132
|
+
if (l.text = l.text.replace(this.rules.other.listReplaceTask, ""), l.tokens[0]?.type === "text" || l.tokens[0]?.type === "paragraph") {
|
|
3133
|
+
l.tokens[0].raw = l.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), l.tokens[0].text = l.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
3134
|
+
for (let c = this.lexer.inlineQueue.length - 1; c >= 0; c--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)) {
|
|
3135
|
+
this.lexer.inlineQueue[c].src = this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask, "");
|
|
3136
|
+
break;
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
let p = this.rules.other.listTaskCheckbox.exec(l.raw);
|
|
3140
|
+
if (p) {
|
|
3141
|
+
let c = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
|
|
3142
|
+
l.checked = c.checked, i.loose ? l.tokens[0] && ["paragraph", "text"].includes(l.tokens[0].type) && "tokens" in l.tokens[0] && l.tokens[0].tokens ? (l.tokens[0].raw = c.raw + l.tokens[0].raw, l.tokens[0].text = c.raw + l.tokens[0].text, l.tokens[0].tokens.unshift(c)) : l.tokens.unshift({ type: "paragraph", raw: c.raw, text: c.raw, tokens: [c] }) : l.tokens.unshift(c);
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
if (!i.loose) {
|
|
3146
|
+
let p = l.tokens.filter((d) => d.type === "space"), c = p.length > 0 && p.some((d) => this.rules.other.anyLine.test(d.raw));
|
|
3147
|
+
i.loose = c;
|
|
3148
|
+
}
|
|
3149
|
+
}
|
|
3150
|
+
if (i.loose) for (let l of i.items) {
|
|
3151
|
+
l.loose = true;
|
|
3152
|
+
for (let p of l.tokens) p.type === "text" && (p.type = "paragraph");
|
|
3153
|
+
}
|
|
3154
|
+
return i;
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
html(e) {
|
|
3158
|
+
let t = this.rules.block.html.exec(e);
|
|
3159
|
+
if (t) return { type: "html", block: true, raw: t[0], pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: t[0] };
|
|
3160
|
+
}
|
|
3161
|
+
def(e) {
|
|
3162
|
+
let t = this.rules.block.def.exec(e);
|
|
3163
|
+
if (t) {
|
|
3164
|
+
let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
3165
|
+
return { type: "def", tag: n, raw: t[0], href: r, title: i };
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
table(e) {
|
|
3169
|
+
let t = this.rules.block.table.exec(e);
|
|
3170
|
+
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
3171
|
+
let n = J(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
3172
|
+
`) : [], s = { type: "table", raw: t[0], header: [], align: [], rows: [] };
|
|
3173
|
+
if (n.length === r.length) {
|
|
3174
|
+
for (let a of r) this.rules.other.tableAlignRight.test(a) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? s.align.push("left") : s.align.push(null);
|
|
3175
|
+
for (let a = 0; a < n.length; a++) s.header.push({ text: n[a], tokens: this.lexer.inline(n[a]), header: true, align: s.align[a] });
|
|
3176
|
+
for (let a of i) s.rows.push(J(a, s.header.length).map((o, l) => ({ text: o, tokens: this.lexer.inline(o), header: false, align: s.align[l] })));
|
|
3177
|
+
return s;
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
lheading(e) {
|
|
3181
|
+
let t = this.rules.block.lheading.exec(e);
|
|
3182
|
+
if (t) return { type: "heading", raw: t[0], depth: t[2].charAt(0) === "=" ? 1 : 2, text: t[1], tokens: this.lexer.inline(t[1]) };
|
|
3183
|
+
}
|
|
3184
|
+
paragraph(e) {
|
|
3185
|
+
let t = this.rules.block.paragraph.exec(e);
|
|
3186
|
+
if (t) {
|
|
3187
|
+
let n = t[1].charAt(t[1].length - 1) === `
|
|
3188
|
+
` ? t[1].slice(0, -1) : t[1];
|
|
3189
|
+
return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
|
|
3190
|
+
}
|
|
3191
|
+
}
|
|
3192
|
+
text(e) {
|
|
3193
|
+
let t = this.rules.block.text.exec(e);
|
|
3194
|
+
if (t) return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
|
|
3195
|
+
}
|
|
3196
|
+
escape(e) {
|
|
3197
|
+
let t = this.rules.inline.escape.exec(e);
|
|
3198
|
+
if (t) return { type: "escape", raw: t[0], text: t[1] };
|
|
3199
|
+
}
|
|
3200
|
+
tag(e) {
|
|
3201
|
+
let t = this.rules.inline.tag.exec(e);
|
|
3202
|
+
if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t[0] };
|
|
3203
|
+
}
|
|
3204
|
+
link(e) {
|
|
3205
|
+
let t = this.rules.inline.link.exec(e);
|
|
3206
|
+
if (t) {
|
|
3207
|
+
let n = t[2].trim();
|
|
3208
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
3209
|
+
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
3210
|
+
let s = E(n.slice(0, -1), "\\");
|
|
3211
|
+
if ((n.length - s.length) % 2 === 0) return;
|
|
3212
|
+
} else {
|
|
3213
|
+
let s = ge(t[2], "()");
|
|
3214
|
+
if (s === -2) return;
|
|
3215
|
+
if (s > -1) {
|
|
3216
|
+
let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
|
|
3217
|
+
t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, o).trim(), t[3] = "";
|
|
3218
|
+
}
|
|
3219
|
+
}
|
|
3220
|
+
let r = t[2], i = "";
|
|
3221
|
+
if (this.options.pedantic) {
|
|
3222
|
+
let s = this.rules.other.pedanticHrefTitle.exec(r);
|
|
3223
|
+
s && (r = s[1], i = s[3]);
|
|
3224
|
+
} else i = t[3] ? t[3].slice(1, -1) : "";
|
|
3225
|
+
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), me(t, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: i && i.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
reflink(e, t) {
|
|
3229
|
+
let n;
|
|
3230
|
+
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
3231
|
+
let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = t[r.toLowerCase()];
|
|
3232
|
+
if (!i) {
|
|
3233
|
+
let s = n[0].charAt(0);
|
|
3234
|
+
return { type: "text", raw: s, text: s };
|
|
3235
|
+
}
|
|
3236
|
+
return me(n, i, n[0], this.lexer, this.rules);
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
emStrong(e, t, n = "") {
|
|
3240
|
+
let r = this.rules.inline.emStrongLDelim.exec(e);
|
|
3241
|
+
if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
3242
|
+
if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
3243
|
+
let s = [...r[0]].length - 1, a, o, l = s, p = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
3244
|
+
for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) != null; ) {
|
|
3245
|
+
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
|
|
3246
|
+
if (o = [...a].length, r[3] || r[4]) {
|
|
3247
|
+
l += o;
|
|
3248
|
+
continue;
|
|
3249
|
+
} else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
|
|
3250
|
+
p += o;
|
|
3251
|
+
continue;
|
|
3252
|
+
}
|
|
3253
|
+
if (l -= o, l > 0) continue;
|
|
3254
|
+
o = Math.min(o, o + l + p);
|
|
3255
|
+
let d = [...r[0]][0].length, h = e.slice(0, s + r.index + d + o);
|
|
3256
|
+
if (Math.min(s, o) % 2) {
|
|
3257
|
+
let f = h.slice(1, -1);
|
|
3258
|
+
return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
3259
|
+
}
|
|
3260
|
+
let R = h.slice(2, -2);
|
|
3261
|
+
return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
|
|
3262
|
+
}
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
codespan(e) {
|
|
3266
|
+
let t = this.rules.inline.code.exec(e);
|
|
3267
|
+
if (t) {
|
|
3268
|
+
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(n), i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
3269
|
+
return r && i && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3272
|
+
br(e) {
|
|
3273
|
+
let t = this.rules.inline.br.exec(e);
|
|
3274
|
+
if (t) return { type: "br", raw: t[0] };
|
|
3275
|
+
}
|
|
3276
|
+
del(e, t, n = "") {
|
|
3277
|
+
let r = this.rules.inline.delLDelim.exec(e);
|
|
3278
|
+
if (!r) return;
|
|
3279
|
+
if (!(r[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
3280
|
+
let s = [...r[0]].length - 1, a, o, l = s, p = this.rules.inline.delRDelim;
|
|
3281
|
+
for (p.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = p.exec(t)) != null; ) {
|
|
3282
|
+
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a || (o = [...a].length, o !== s)) continue;
|
|
3283
|
+
if (r[3] || r[4]) {
|
|
3284
|
+
l += o;
|
|
3285
|
+
continue;
|
|
3286
|
+
}
|
|
3287
|
+
if (l -= o, l > 0) continue;
|
|
3288
|
+
o = Math.min(o, o + l);
|
|
3289
|
+
let c = [...r[0]][0].length, d = e.slice(0, s + r.index + c + o), h = d.slice(s, -s);
|
|
3290
|
+
return { type: "del", raw: d, text: h, tokens: this.lexer.inlineTokens(h) };
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
}
|
|
3294
|
+
autolink(e) {
|
|
3295
|
+
let t = this.rules.inline.autolink.exec(e);
|
|
3296
|
+
if (t) {
|
|
3297
|
+
let n, r;
|
|
3298
|
+
return t[2] === "@" ? (n = t[1], r = "mailto:" + n) : (n = t[1], r = n), { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
|
|
3299
|
+
}
|
|
3300
|
+
}
|
|
3301
|
+
url(e) {
|
|
3302
|
+
let t;
|
|
3303
|
+
if (t = this.rules.inline.url.exec(e)) {
|
|
3304
|
+
let n, r;
|
|
3305
|
+
if (t[2] === "@") n = t[0], r = "mailto:" + n;
|
|
3306
|
+
else {
|
|
3307
|
+
let i;
|
|
3308
|
+
do
|
|
3309
|
+
i = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
3310
|
+
while (i !== t[0]);
|
|
3311
|
+
n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
|
|
3312
|
+
}
|
|
3313
|
+
return { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
inlineText(e) {
|
|
3317
|
+
let t = this.rules.inline.text.exec(e);
|
|
3318
|
+
if (t) {
|
|
3319
|
+
let n = this.lexer.state.inRawBlock;
|
|
3320
|
+
return { type: "text", raw: t[0], text: t[0], escaped: n };
|
|
3321
|
+
}
|
|
3322
|
+
}
|
|
3323
|
+
};
|
|
3324
|
+
x = class u {
|
|
3325
|
+
tokens;
|
|
3326
|
+
options;
|
|
3327
|
+
state;
|
|
3328
|
+
inlineQueue;
|
|
3329
|
+
tokenizer;
|
|
3330
|
+
constructor(e) {
|
|
3331
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new w(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
|
|
3332
|
+
let t = { other: m, block: C.normal, inline: z.normal };
|
|
3333
|
+
this.options.pedantic ? (t.block = C.pedantic, t.inline = z.pedantic) : this.options.gfm && (t.block = C.gfm, this.options.breaks ? t.inline = z.breaks : t.inline = z.gfm), this.tokenizer.rules = t;
|
|
3334
|
+
}
|
|
3335
|
+
static get rules() {
|
|
3336
|
+
return { block: C, inline: z };
|
|
3337
|
+
}
|
|
3338
|
+
static lex(e, t) {
|
|
3339
|
+
return new u(t).lex(e);
|
|
3340
|
+
}
|
|
3341
|
+
static lexInline(e, t) {
|
|
3342
|
+
return new u(t).inlineTokens(e);
|
|
3343
|
+
}
|
|
3344
|
+
lex(e) {
|
|
3345
|
+
e = e.replace(m.carriageReturn, `
|
|
3346
|
+
`), this.blockTokens(e, this.tokens);
|
|
3347
|
+
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
3348
|
+
let n = this.inlineQueue[t];
|
|
3349
|
+
this.inlineTokens(n.src, n.tokens);
|
|
3350
|
+
}
|
|
3351
|
+
return this.inlineQueue = [], this.tokens;
|
|
3352
|
+
}
|
|
3353
|
+
blockTokens(e, t = [], n = false) {
|
|
3354
|
+
for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e; ) {
|
|
3355
|
+
let r;
|
|
3356
|
+
if (this.options.extensions?.block?.some((s) => (r = s.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false)) continue;
|
|
3357
|
+
if (r = this.tokenizer.space(e)) {
|
|
3358
|
+
e = e.substring(r.raw.length);
|
|
3359
|
+
let s = t.at(-1);
|
|
3360
|
+
r.raw.length === 1 && s !== void 0 ? s.raw += `
|
|
3361
|
+
` : t.push(r);
|
|
3362
|
+
continue;
|
|
3363
|
+
}
|
|
3364
|
+
if (r = this.tokenizer.code(e)) {
|
|
3365
|
+
e = e.substring(r.raw.length);
|
|
3366
|
+
let s = t.at(-1);
|
|
3367
|
+
s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
3368
|
+
`) ? "" : `
|
|
3369
|
+
`) + r.raw, s.text += `
|
|
3370
|
+
` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
3371
|
+
continue;
|
|
3372
|
+
}
|
|
3373
|
+
if (r = this.tokenizer.fences(e)) {
|
|
3374
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3375
|
+
continue;
|
|
3376
|
+
}
|
|
3377
|
+
if (r = this.tokenizer.heading(e)) {
|
|
3378
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3379
|
+
continue;
|
|
3380
|
+
}
|
|
3381
|
+
if (r = this.tokenizer.hr(e)) {
|
|
3382
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3383
|
+
continue;
|
|
3384
|
+
}
|
|
3385
|
+
if (r = this.tokenizer.blockquote(e)) {
|
|
3386
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3387
|
+
continue;
|
|
3388
|
+
}
|
|
3389
|
+
if (r = this.tokenizer.list(e)) {
|
|
3390
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3391
|
+
continue;
|
|
3392
|
+
}
|
|
3393
|
+
if (r = this.tokenizer.html(e)) {
|
|
3394
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3395
|
+
continue;
|
|
3396
|
+
}
|
|
3397
|
+
if (r = this.tokenizer.def(e)) {
|
|
3398
|
+
e = e.substring(r.raw.length);
|
|
3399
|
+
let s = t.at(-1);
|
|
3400
|
+
s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
3401
|
+
`) ? "" : `
|
|
3402
|
+
`) + r.raw, s.text += `
|
|
3403
|
+
` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
|
|
3404
|
+
continue;
|
|
3405
|
+
}
|
|
3406
|
+
if (r = this.tokenizer.table(e)) {
|
|
3407
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3408
|
+
continue;
|
|
3409
|
+
}
|
|
3410
|
+
if (r = this.tokenizer.lheading(e)) {
|
|
3411
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3412
|
+
continue;
|
|
3413
|
+
}
|
|
3414
|
+
let i = e;
|
|
3415
|
+
if (this.options.extensions?.startBlock) {
|
|
3416
|
+
let s = 1 / 0, a = e.slice(1), o;
|
|
3417
|
+
this.options.extensions.startBlock.forEach((l) => {
|
|
3418
|
+
o = l.call({ lexer: this }, a), typeof o == "number" && o >= 0 && (s = Math.min(s, o));
|
|
3419
|
+
}), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
|
|
3420
|
+
}
|
|
3421
|
+
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
3422
|
+
let s = t.at(-1);
|
|
3423
|
+
n && s?.type === "paragraph" ? (s.raw += (s.raw.endsWith(`
|
|
3424
|
+
`) ? "" : `
|
|
3425
|
+
`) + r.raw, s.text += `
|
|
3426
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
|
|
3427
|
+
continue;
|
|
3428
|
+
}
|
|
3429
|
+
if (r = this.tokenizer.text(e)) {
|
|
3430
|
+
e = e.substring(r.raw.length);
|
|
3431
|
+
let s = t.at(-1);
|
|
3432
|
+
s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
3433
|
+
`) ? "" : `
|
|
3434
|
+
`) + r.raw, s.text += `
|
|
3435
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
3436
|
+
continue;
|
|
3437
|
+
}
|
|
3438
|
+
if (e) {
|
|
3439
|
+
let s = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
3440
|
+
if (this.options.silent) {
|
|
3441
|
+
console.error(s);
|
|
3442
|
+
break;
|
|
3443
|
+
} else throw new Error(s);
|
|
3444
|
+
}
|
|
3445
|
+
}
|
|
3446
|
+
return this.state.top = true, t;
|
|
3447
|
+
}
|
|
3448
|
+
inline(e, t = []) {
|
|
3449
|
+
return this.inlineQueue.push({ src: e, tokens: t }), t;
|
|
3450
|
+
}
|
|
3451
|
+
inlineTokens(e, t = []) {
|
|
3452
|
+
let n = e, r = null;
|
|
3453
|
+
if (this.tokens.links) {
|
|
3454
|
+
let o = Object.keys(this.tokens.links);
|
|
3455
|
+
if (o.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null; ) o.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
3456
|
+
}
|
|
3457
|
+
for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; ) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
3458
|
+
let i;
|
|
3459
|
+
for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; ) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
3460
|
+
n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
3461
|
+
let s = false, a = "";
|
|
3462
|
+
for (; e; ) {
|
|
3463
|
+
s || (a = ""), s = false;
|
|
3464
|
+
let o;
|
|
3465
|
+
if (this.options.extensions?.inline?.some((p) => (o = p.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
|
|
3466
|
+
if (o = this.tokenizer.escape(e)) {
|
|
3467
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
3468
|
+
continue;
|
|
3469
|
+
}
|
|
3470
|
+
if (o = this.tokenizer.tag(e)) {
|
|
3471
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
3472
|
+
continue;
|
|
3473
|
+
}
|
|
3474
|
+
if (o = this.tokenizer.link(e)) {
|
|
3475
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
3476
|
+
continue;
|
|
3477
|
+
}
|
|
3478
|
+
if (o = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
3479
|
+
e = e.substring(o.raw.length);
|
|
3480
|
+
let p = t.at(-1);
|
|
3481
|
+
o.type === "text" && p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
|
|
3482
|
+
continue;
|
|
3483
|
+
}
|
|
3484
|
+
if (o = this.tokenizer.emStrong(e, n, a)) {
|
|
3485
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
3486
|
+
continue;
|
|
3487
|
+
}
|
|
3488
|
+
if (o = this.tokenizer.codespan(e)) {
|
|
3489
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
3490
|
+
continue;
|
|
3491
|
+
}
|
|
3492
|
+
if (o = this.tokenizer.br(e)) {
|
|
3493
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
3494
|
+
continue;
|
|
3495
|
+
}
|
|
3496
|
+
if (o = this.tokenizer.del(e, n, a)) {
|
|
3497
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
3498
|
+
continue;
|
|
3499
|
+
}
|
|
3500
|
+
if (o = this.tokenizer.autolink(e)) {
|
|
3501
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
3502
|
+
continue;
|
|
3503
|
+
}
|
|
3504
|
+
if (!this.state.inLink && (o = this.tokenizer.url(e))) {
|
|
3505
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
3506
|
+
continue;
|
|
3507
|
+
}
|
|
3508
|
+
let l = e;
|
|
3509
|
+
if (this.options.extensions?.startInline) {
|
|
3510
|
+
let p = 1 / 0, c = e.slice(1), d;
|
|
3511
|
+
this.options.extensions.startInline.forEach((h) => {
|
|
3512
|
+
d = h.call({ lexer: this }, c), typeof d == "number" && d >= 0 && (p = Math.min(p, d));
|
|
3513
|
+
}), p < 1 / 0 && p >= 0 && (l = e.substring(0, p + 1));
|
|
3514
|
+
}
|
|
3515
|
+
if (o = this.tokenizer.inlineText(l)) {
|
|
3516
|
+
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), s = true;
|
|
3517
|
+
let p = t.at(-1);
|
|
3518
|
+
p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
|
|
3519
|
+
continue;
|
|
3520
|
+
}
|
|
3521
|
+
if (e) {
|
|
3522
|
+
let p = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
3523
|
+
if (this.options.silent) {
|
|
3524
|
+
console.error(p);
|
|
3525
|
+
break;
|
|
3526
|
+
} else throw new Error(p);
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3529
|
+
return t;
|
|
3530
|
+
}
|
|
3531
|
+
};
|
|
3532
|
+
y = class {
|
|
3533
|
+
options;
|
|
3534
|
+
parser;
|
|
3535
|
+
constructor(e) {
|
|
3536
|
+
this.options = e || T;
|
|
3537
|
+
}
|
|
3538
|
+
space(e) {
|
|
3539
|
+
return "";
|
|
3540
|
+
}
|
|
3541
|
+
code({ text: e, lang: t, escaped: n }) {
|
|
3542
|
+
let r = (t || "").match(m.notSpaceStart)?.[0], i = e.replace(m.endingNewline, "") + `
|
|
3543
|
+
`;
|
|
3544
|
+
return r ? '<pre><code class="language-' + O(r) + '">' + (n ? i : O(i, true)) + `</code></pre>
|
|
3545
|
+
` : "<pre><code>" + (n ? i : O(i, true)) + `</code></pre>
|
|
3546
|
+
`;
|
|
3547
|
+
}
|
|
3548
|
+
blockquote({ tokens: e }) {
|
|
3549
|
+
return `<blockquote>
|
|
3550
|
+
${this.parser.parse(e)}</blockquote>
|
|
3551
|
+
`;
|
|
3552
|
+
}
|
|
3553
|
+
html({ text: e }) {
|
|
3554
|
+
return e;
|
|
3555
|
+
}
|
|
3556
|
+
def(e) {
|
|
3557
|
+
return "";
|
|
3558
|
+
}
|
|
3559
|
+
heading({ tokens: e, depth: t }) {
|
|
3560
|
+
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
3561
|
+
`;
|
|
3562
|
+
}
|
|
3563
|
+
hr(e) {
|
|
3564
|
+
return `<hr>
|
|
3565
|
+
`;
|
|
3566
|
+
}
|
|
3567
|
+
list(e) {
|
|
3568
|
+
let t = e.ordered, n = e.start, r = "";
|
|
3569
|
+
for (let a = 0; a < e.items.length; a++) {
|
|
3570
|
+
let o = e.items[a];
|
|
3571
|
+
r += this.listitem(o);
|
|
3572
|
+
}
|
|
3573
|
+
let i = t ? "ol" : "ul", s = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
3574
|
+
return "<" + i + s + `>
|
|
3575
|
+
` + r + "</" + i + `>
|
|
3576
|
+
`;
|
|
3577
|
+
}
|
|
3578
|
+
listitem(e) {
|
|
3579
|
+
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
3580
|
+
`;
|
|
3581
|
+
}
|
|
3582
|
+
checkbox({ checked: e }) {
|
|
3583
|
+
return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
3584
|
+
}
|
|
3585
|
+
paragraph({ tokens: e }) {
|
|
3586
|
+
return `<p>${this.parser.parseInline(e)}</p>
|
|
3587
|
+
`;
|
|
3588
|
+
}
|
|
3589
|
+
table(e) {
|
|
3590
|
+
let t = "", n = "";
|
|
3591
|
+
for (let i = 0; i < e.header.length; i++) n += this.tablecell(e.header[i]);
|
|
3592
|
+
t += this.tablerow({ text: n });
|
|
3593
|
+
let r = "";
|
|
3594
|
+
for (let i = 0; i < e.rows.length; i++) {
|
|
3595
|
+
let s = e.rows[i];
|
|
3596
|
+
n = "";
|
|
3597
|
+
for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
|
|
3598
|
+
r += this.tablerow({ text: n });
|
|
3599
|
+
}
|
|
3600
|
+
return r && (r = `<tbody>${r}</tbody>`), `<table>
|
|
3601
|
+
<thead>
|
|
3602
|
+
` + t + `</thead>
|
|
3603
|
+
` + r + `</table>
|
|
3604
|
+
`;
|
|
3605
|
+
}
|
|
3606
|
+
tablerow({ text: e }) {
|
|
3607
|
+
return `<tr>
|
|
3608
|
+
${e}</tr>
|
|
3609
|
+
`;
|
|
3610
|
+
}
|
|
3611
|
+
tablecell(e) {
|
|
3612
|
+
let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
3613
|
+
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
3614
|
+
`;
|
|
3615
|
+
}
|
|
3616
|
+
strong({ tokens: e }) {
|
|
3617
|
+
return `<strong>${this.parser.parseInline(e)}</strong>`;
|
|
3618
|
+
}
|
|
3619
|
+
em({ tokens: e }) {
|
|
3620
|
+
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
3621
|
+
}
|
|
3622
|
+
codespan({ text: e }) {
|
|
3623
|
+
return `<code>${O(e, true)}</code>`;
|
|
3624
|
+
}
|
|
3625
|
+
br(e) {
|
|
3626
|
+
return "<br>";
|
|
3627
|
+
}
|
|
3628
|
+
del({ tokens: e }) {
|
|
3629
|
+
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
3630
|
+
}
|
|
3631
|
+
link({ href: e, title: t, tokens: n }) {
|
|
3632
|
+
let r = this.parser.parseInline(n), i = X(e);
|
|
3633
|
+
if (i === null) return r;
|
|
3634
|
+
e = i;
|
|
3635
|
+
let s = '<a href="' + e + '"';
|
|
3636
|
+
return t && (s += ' title="' + O(t) + '"'), s += ">" + r + "</a>", s;
|
|
3637
|
+
}
|
|
3638
|
+
image({ href: e, title: t, text: n, tokens: r }) {
|
|
3639
|
+
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
3640
|
+
let i = X(e);
|
|
3641
|
+
if (i === null) return O(n);
|
|
3642
|
+
e = i;
|
|
3643
|
+
let s = `<img src="${e}" alt="${O(n)}"`;
|
|
3644
|
+
return t && (s += ` title="${O(t)}"`), s += ">", s;
|
|
3645
|
+
}
|
|
3646
|
+
text(e) {
|
|
3647
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O(e.text);
|
|
3648
|
+
}
|
|
3649
|
+
};
|
|
3650
|
+
$ = class {
|
|
3651
|
+
strong({ text: e }) {
|
|
3652
|
+
return e;
|
|
3653
|
+
}
|
|
3654
|
+
em({ text: e }) {
|
|
3655
|
+
return e;
|
|
3656
|
+
}
|
|
3657
|
+
codespan({ text: e }) {
|
|
3658
|
+
return e;
|
|
3659
|
+
}
|
|
3660
|
+
del({ text: e }) {
|
|
3661
|
+
return e;
|
|
3662
|
+
}
|
|
3663
|
+
html({ text: e }) {
|
|
3664
|
+
return e;
|
|
3665
|
+
}
|
|
3666
|
+
text({ text: e }) {
|
|
3667
|
+
return e;
|
|
3668
|
+
}
|
|
3669
|
+
link({ text: e }) {
|
|
3670
|
+
return "" + e;
|
|
3671
|
+
}
|
|
3672
|
+
image({ text: e }) {
|
|
3673
|
+
return "" + e;
|
|
3674
|
+
}
|
|
3675
|
+
br() {
|
|
3676
|
+
return "";
|
|
3677
|
+
}
|
|
3678
|
+
checkbox({ raw: e }) {
|
|
3679
|
+
return e;
|
|
3680
|
+
}
|
|
3681
|
+
};
|
|
3682
|
+
b = class u2 {
|
|
3683
|
+
options;
|
|
3684
|
+
renderer;
|
|
3685
|
+
textRenderer;
|
|
3686
|
+
constructor(e) {
|
|
3687
|
+
this.options = e || T, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
|
|
3688
|
+
}
|
|
3689
|
+
static parse(e, t) {
|
|
3690
|
+
return new u2(t).parse(e);
|
|
3691
|
+
}
|
|
3692
|
+
static parseInline(e, t) {
|
|
3693
|
+
return new u2(t).parseInline(e);
|
|
3694
|
+
}
|
|
3695
|
+
parse(e) {
|
|
3696
|
+
let t = "";
|
|
3697
|
+
for (let n = 0; n < e.length; n++) {
|
|
3698
|
+
let r = e[n];
|
|
3699
|
+
if (this.options.extensions?.renderers?.[r.type]) {
|
|
3700
|
+
let s = r, a = this.options.extensions.renderers[s.type].call({ parser: this }, s);
|
|
3701
|
+
if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(s.type)) {
|
|
3702
|
+
t += a || "";
|
|
3703
|
+
continue;
|
|
3704
|
+
}
|
|
3705
|
+
}
|
|
3706
|
+
let i = r;
|
|
3707
|
+
switch (i.type) {
|
|
3708
|
+
case "space": {
|
|
3709
|
+
t += this.renderer.space(i);
|
|
3710
|
+
break;
|
|
3711
|
+
}
|
|
3712
|
+
case "hr": {
|
|
3713
|
+
t += this.renderer.hr(i);
|
|
3714
|
+
break;
|
|
3715
|
+
}
|
|
3716
|
+
case "heading": {
|
|
3717
|
+
t += this.renderer.heading(i);
|
|
3718
|
+
break;
|
|
3719
|
+
}
|
|
3720
|
+
case "code": {
|
|
3721
|
+
t += this.renderer.code(i);
|
|
3722
|
+
break;
|
|
3723
|
+
}
|
|
3724
|
+
case "table": {
|
|
3725
|
+
t += this.renderer.table(i);
|
|
3726
|
+
break;
|
|
3727
|
+
}
|
|
3728
|
+
case "blockquote": {
|
|
3729
|
+
t += this.renderer.blockquote(i);
|
|
3730
|
+
break;
|
|
3731
|
+
}
|
|
3732
|
+
case "list": {
|
|
3733
|
+
t += this.renderer.list(i);
|
|
3734
|
+
break;
|
|
3735
|
+
}
|
|
3736
|
+
case "checkbox": {
|
|
3737
|
+
t += this.renderer.checkbox(i);
|
|
3738
|
+
break;
|
|
3739
|
+
}
|
|
3740
|
+
case "html": {
|
|
3741
|
+
t += this.renderer.html(i);
|
|
3742
|
+
break;
|
|
3743
|
+
}
|
|
3744
|
+
case "def": {
|
|
3745
|
+
t += this.renderer.def(i);
|
|
3746
|
+
break;
|
|
3747
|
+
}
|
|
3748
|
+
case "paragraph": {
|
|
3749
|
+
t += this.renderer.paragraph(i);
|
|
3750
|
+
break;
|
|
3751
|
+
}
|
|
3752
|
+
case "text": {
|
|
3753
|
+
t += this.renderer.text(i);
|
|
3754
|
+
break;
|
|
3755
|
+
}
|
|
3756
|
+
default: {
|
|
3757
|
+
let s = 'Token with "' + i.type + '" type was not found.';
|
|
3758
|
+
if (this.options.silent) return console.error(s), "";
|
|
3759
|
+
throw new Error(s);
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3762
|
+
}
|
|
3763
|
+
return t;
|
|
3764
|
+
}
|
|
3765
|
+
parseInline(e, t = this.renderer) {
|
|
3766
|
+
let n = "";
|
|
3767
|
+
for (let r = 0; r < e.length; r++) {
|
|
3768
|
+
let i = e[r];
|
|
3769
|
+
if (this.options.extensions?.renderers?.[i.type]) {
|
|
3770
|
+
let a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
3771
|
+
if (a !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
|
|
3772
|
+
n += a || "";
|
|
3773
|
+
continue;
|
|
3774
|
+
}
|
|
3775
|
+
}
|
|
3776
|
+
let s = i;
|
|
3777
|
+
switch (s.type) {
|
|
3778
|
+
case "escape": {
|
|
3779
|
+
n += t.text(s);
|
|
3780
|
+
break;
|
|
3781
|
+
}
|
|
3782
|
+
case "html": {
|
|
3783
|
+
n += t.html(s);
|
|
3784
|
+
break;
|
|
3785
|
+
}
|
|
3786
|
+
case "link": {
|
|
3787
|
+
n += t.link(s);
|
|
3788
|
+
break;
|
|
3789
|
+
}
|
|
3790
|
+
case "image": {
|
|
3791
|
+
n += t.image(s);
|
|
3792
|
+
break;
|
|
3793
|
+
}
|
|
3794
|
+
case "checkbox": {
|
|
3795
|
+
n += t.checkbox(s);
|
|
3796
|
+
break;
|
|
3797
|
+
}
|
|
3798
|
+
case "strong": {
|
|
3799
|
+
n += t.strong(s);
|
|
3800
|
+
break;
|
|
3801
|
+
}
|
|
3802
|
+
case "em": {
|
|
3803
|
+
n += t.em(s);
|
|
3804
|
+
break;
|
|
3805
|
+
}
|
|
3806
|
+
case "codespan": {
|
|
3807
|
+
n += t.codespan(s);
|
|
3808
|
+
break;
|
|
3809
|
+
}
|
|
3810
|
+
case "br": {
|
|
3811
|
+
n += t.br(s);
|
|
3812
|
+
break;
|
|
3813
|
+
}
|
|
3814
|
+
case "del": {
|
|
3815
|
+
n += t.del(s);
|
|
3816
|
+
break;
|
|
3817
|
+
}
|
|
3818
|
+
case "text": {
|
|
3819
|
+
n += t.text(s);
|
|
3820
|
+
break;
|
|
3821
|
+
}
|
|
3822
|
+
default: {
|
|
3823
|
+
let a = 'Token with "' + s.type + '" type was not found.';
|
|
3824
|
+
if (this.options.silent) return console.error(a), "";
|
|
3825
|
+
throw new Error(a);
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
return n;
|
|
3830
|
+
}
|
|
3831
|
+
};
|
|
3832
|
+
P = class {
|
|
3833
|
+
options;
|
|
3834
|
+
block;
|
|
3835
|
+
constructor(e) {
|
|
3836
|
+
this.options = e || T;
|
|
3837
|
+
}
|
|
3838
|
+
static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
|
|
3839
|
+
static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
3840
|
+
preprocess(e) {
|
|
3841
|
+
return e;
|
|
3842
|
+
}
|
|
3843
|
+
postprocess(e) {
|
|
3844
|
+
return e;
|
|
3845
|
+
}
|
|
3846
|
+
processAllTokens(e) {
|
|
3847
|
+
return e;
|
|
3848
|
+
}
|
|
3849
|
+
emStrongMask(e) {
|
|
3850
|
+
return e;
|
|
3851
|
+
}
|
|
3852
|
+
provideLexer() {
|
|
3853
|
+
return this.block ? x.lex : x.lexInline;
|
|
3854
|
+
}
|
|
3855
|
+
provideParser() {
|
|
3856
|
+
return this.block ? b.parse : b.parseInline;
|
|
3857
|
+
}
|
|
3858
|
+
};
|
|
3859
|
+
B = class {
|
|
3860
|
+
defaults = M();
|
|
3861
|
+
options = this.setOptions;
|
|
3862
|
+
parse = this.parseMarkdown(true);
|
|
3863
|
+
parseInline = this.parseMarkdown(false);
|
|
3864
|
+
Parser = b;
|
|
3865
|
+
Renderer = y;
|
|
3866
|
+
TextRenderer = $;
|
|
3867
|
+
Lexer = x;
|
|
3868
|
+
Tokenizer = w;
|
|
3869
|
+
Hooks = P;
|
|
3870
|
+
constructor(...e) {
|
|
3871
|
+
this.use(...e);
|
|
3872
|
+
}
|
|
3873
|
+
walkTokens(e, t) {
|
|
3874
|
+
let n = [];
|
|
3875
|
+
for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
|
|
3876
|
+
case "table": {
|
|
3877
|
+
let i = r;
|
|
3878
|
+
for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
|
|
3879
|
+
for (let s of i.rows) for (let a of s) n = n.concat(this.walkTokens(a.tokens, t));
|
|
3880
|
+
break;
|
|
3881
|
+
}
|
|
3882
|
+
case "list": {
|
|
3883
|
+
let i = r;
|
|
3884
|
+
n = n.concat(this.walkTokens(i.items, t));
|
|
3885
|
+
break;
|
|
3886
|
+
}
|
|
3887
|
+
default: {
|
|
3888
|
+
let i = r;
|
|
3889
|
+
this.defaults.extensions?.childTokens?.[i.type] ? this.defaults.extensions.childTokens[i.type].forEach((s) => {
|
|
3890
|
+
let a = i[s].flat(1 / 0);
|
|
3891
|
+
n = n.concat(this.walkTokens(a, t));
|
|
3892
|
+
}) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
return n;
|
|
3896
|
+
}
|
|
3897
|
+
use(...e) {
|
|
3898
|
+
let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
3899
|
+
return e.forEach((n) => {
|
|
3900
|
+
let r = { ...n };
|
|
3901
|
+
if (r.async = this.defaults.async || r.async || false, n.extensions && (n.extensions.forEach((i) => {
|
|
3902
|
+
if (!i.name) throw new Error("extension name required");
|
|
3903
|
+
if ("renderer" in i) {
|
|
3904
|
+
let s = t.renderers[i.name];
|
|
3905
|
+
s ? t.renderers[i.name] = function(...a) {
|
|
3906
|
+
let o = i.renderer.apply(this, a);
|
|
3907
|
+
return o === false && (o = s.apply(this, a)), o;
|
|
3908
|
+
} : t.renderers[i.name] = i.renderer;
|
|
3909
|
+
}
|
|
3910
|
+
if ("tokenizer" in i) {
|
|
3911
|
+
if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
3912
|
+
let s = t[i.level];
|
|
3913
|
+
s ? s.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start]));
|
|
3914
|
+
}
|
|
3915
|
+
"childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
|
|
3916
|
+
}), r.extensions = t), n.renderer) {
|
|
3917
|
+
let i = this.defaults.renderer || new y(this.defaults);
|
|
3918
|
+
for (let s in n.renderer) {
|
|
3919
|
+
if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
|
|
3920
|
+
if (["options", "parser"].includes(s)) continue;
|
|
3921
|
+
let a = s, o = n.renderer[a], l = i[a];
|
|
3922
|
+
i[a] = (...p) => {
|
|
3923
|
+
let c = o.apply(i, p);
|
|
3924
|
+
return c === false && (c = l.apply(i, p)), c || "";
|
|
3925
|
+
};
|
|
3926
|
+
}
|
|
3927
|
+
r.renderer = i;
|
|
3928
|
+
}
|
|
3929
|
+
if (n.tokenizer) {
|
|
3930
|
+
let i = this.defaults.tokenizer || new w(this.defaults);
|
|
3931
|
+
for (let s in n.tokenizer) {
|
|
3932
|
+
if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
|
|
3933
|
+
if (["options", "rules", "lexer"].includes(s)) continue;
|
|
3934
|
+
let a = s, o = n.tokenizer[a], l = i[a];
|
|
3935
|
+
i[a] = (...p) => {
|
|
3936
|
+
let c = o.apply(i, p);
|
|
3937
|
+
return c === false && (c = l.apply(i, p)), c;
|
|
3938
|
+
};
|
|
3939
|
+
}
|
|
3940
|
+
r.tokenizer = i;
|
|
3941
|
+
}
|
|
3942
|
+
if (n.hooks) {
|
|
3943
|
+
let i = this.defaults.hooks || new P();
|
|
3944
|
+
for (let s in n.hooks) {
|
|
3945
|
+
if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
|
|
3946
|
+
if (["options", "block"].includes(s)) continue;
|
|
3947
|
+
let a = s, o = n.hooks[a], l = i[a];
|
|
3948
|
+
P.passThroughHooks.has(s) ? i[a] = (p) => {
|
|
3949
|
+
if (this.defaults.async && P.passThroughHooksRespectAsync.has(s)) return (async () => {
|
|
3950
|
+
let d = await o.call(i, p);
|
|
3951
|
+
return l.call(i, d);
|
|
3952
|
+
})();
|
|
3953
|
+
let c = o.call(i, p);
|
|
3954
|
+
return l.call(i, c);
|
|
3955
|
+
} : i[a] = (...p) => {
|
|
3956
|
+
if (this.defaults.async) return (async () => {
|
|
3957
|
+
let d = await o.apply(i, p);
|
|
3958
|
+
return d === false && (d = await l.apply(i, p)), d;
|
|
3959
|
+
})();
|
|
3960
|
+
let c = o.apply(i, p);
|
|
3961
|
+
return c === false && (c = l.apply(i, p)), c;
|
|
3962
|
+
};
|
|
3963
|
+
}
|
|
3964
|
+
r.hooks = i;
|
|
3965
|
+
}
|
|
3966
|
+
if (n.walkTokens) {
|
|
3967
|
+
let i = this.defaults.walkTokens, s = n.walkTokens;
|
|
3968
|
+
r.walkTokens = function(a) {
|
|
3969
|
+
let o = [];
|
|
3970
|
+
return o.push(s.call(this, a)), i && (o = o.concat(i.call(this, a))), o;
|
|
3971
|
+
};
|
|
3972
|
+
}
|
|
3973
|
+
this.defaults = { ...this.defaults, ...r };
|
|
3974
|
+
}), this;
|
|
3975
|
+
}
|
|
3976
|
+
setOptions(e) {
|
|
3977
|
+
return this.defaults = { ...this.defaults, ...e }, this;
|
|
3978
|
+
}
|
|
3979
|
+
lexer(e, t) {
|
|
3980
|
+
return x.lex(e, t ?? this.defaults);
|
|
3981
|
+
}
|
|
3982
|
+
parser(e, t) {
|
|
3983
|
+
return b.parse(e, t ?? this.defaults);
|
|
3984
|
+
}
|
|
3985
|
+
parseMarkdown(e) {
|
|
3986
|
+
return (n, r) => {
|
|
3987
|
+
let i = { ...r }, s = { ...this.defaults, ...i }, a = this.onError(!!s.silent, !!s.async);
|
|
3988
|
+
if (this.defaults.async === true && i.async === false) return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
3989
|
+
if (typeof n > "u" || n === null) return a(new Error("marked(): input parameter is undefined or null"));
|
|
3990
|
+
if (typeof n != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
3991
|
+
if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
|
|
3992
|
+
let o = s.hooks ? await s.hooks.preprocess(n) : n, p = await (s.hooks ? await s.hooks.provideLexer() : e ? x.lex : x.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(p) : p;
|
|
3993
|
+
s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
|
|
3994
|
+
let h = await (s.hooks ? await s.hooks.provideParser() : e ? b.parse : b.parseInline)(c, s);
|
|
3995
|
+
return s.hooks ? await s.hooks.postprocess(h) : h;
|
|
3996
|
+
})().catch(a);
|
|
3997
|
+
try {
|
|
3998
|
+
s.hooks && (n = s.hooks.preprocess(n));
|
|
3999
|
+
let l = (s.hooks ? s.hooks.provideLexer() : e ? x.lex : x.lexInline)(n, s);
|
|
4000
|
+
s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
|
|
4001
|
+
let c = (s.hooks ? s.hooks.provideParser() : e ? b.parse : b.parseInline)(l, s);
|
|
4002
|
+
return s.hooks && (c = s.hooks.postprocess(c)), c;
|
|
4003
|
+
} catch (o) {
|
|
4004
|
+
return a(o);
|
|
4005
|
+
}
|
|
4006
|
+
};
|
|
4007
|
+
}
|
|
4008
|
+
onError(e, t) {
|
|
4009
|
+
return (n) => {
|
|
4010
|
+
if (n.message += `
|
|
4011
|
+
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
4012
|
+
let r = "<p>An error occurred:</p><pre>" + O(n.message + "", true) + "</pre>";
|
|
4013
|
+
return t ? Promise.resolve(r) : r;
|
|
4014
|
+
}
|
|
4015
|
+
if (t) return Promise.reject(n);
|
|
4016
|
+
throw n;
|
|
4017
|
+
};
|
|
4018
|
+
}
|
|
4019
|
+
};
|
|
4020
|
+
L = new B();
|
|
4021
|
+
g.options = g.setOptions = function(u3) {
|
|
4022
|
+
return L.setOptions(u3), g.defaults = L.defaults, G(g.defaults), g;
|
|
4023
|
+
};
|
|
4024
|
+
g.getDefaults = M;
|
|
4025
|
+
g.defaults = T;
|
|
4026
|
+
g.use = function(...u3) {
|
|
4027
|
+
return L.use(...u3), g.defaults = L.defaults, G(g.defaults), g;
|
|
4028
|
+
};
|
|
4029
|
+
g.walkTokens = function(u3, e) {
|
|
4030
|
+
return L.walkTokens(u3, e);
|
|
4031
|
+
};
|
|
4032
|
+
g.parseInline = L.parseInline;
|
|
4033
|
+
g.Parser = b;
|
|
4034
|
+
g.parser = b.parse;
|
|
4035
|
+
g.Renderer = y;
|
|
4036
|
+
g.TextRenderer = $;
|
|
4037
|
+
g.Lexer = x;
|
|
4038
|
+
g.lexer = x.lex;
|
|
4039
|
+
g.Tokenizer = w;
|
|
4040
|
+
g.Hooks = P;
|
|
4041
|
+
g.parse = g;
|
|
4042
|
+
Ut = g.options;
|
|
4043
|
+
Kt = g.setOptions;
|
|
4044
|
+
Wt = g.use;
|
|
4045
|
+
Xt = g.walkTokens;
|
|
4046
|
+
Jt = g.parseInline;
|
|
4047
|
+
Vt = g;
|
|
4048
|
+
Yt = b.parse;
|
|
4049
|
+
en = x.lex;
|
|
4050
|
+
}
|
|
4051
|
+
});
|
|
4052
|
+
|
|
4053
|
+
// parse.js
|
|
4054
|
+
var require_parse = __commonJS({
|
|
4055
|
+
"parse.js"(exports, module) {
|
|
4056
|
+
var SPEC_VERSION = "0.4.0";
|
|
4057
|
+
var yaml = require_js_yaml();
|
|
4058
|
+
var { marked } = (init_marked_esm(), __toCommonJS(marked_esm_exports));
|
|
4059
|
+
function parse(source) {
|
|
4060
|
+
const EMPTY_FM_RE = /^---\r?\n---\r?\n?([\s\S]*)$/;
|
|
4061
|
+
const emptyMatch = source.match(EMPTY_FM_RE);
|
|
4062
|
+
if (emptyMatch) return { data: {}, body: emptyMatch[1] };
|
|
4063
|
+
const FM_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/;
|
|
4064
|
+
const match = source.match(FM_RE);
|
|
4065
|
+
if (!match) {
|
|
4066
|
+
return { data: {}, body: source };
|
|
4067
|
+
}
|
|
4068
|
+
const data = yaml.load(match[1]) ?? {};
|
|
4069
|
+
const body = match[2];
|
|
4070
|
+
return { data, body };
|
|
4071
|
+
}
|
|
4072
|
+
function resolvePath(obj, path) {
|
|
4073
|
+
const parts = path.replace(/\[(\d+)\]/g, ".$1").split(".");
|
|
4074
|
+
let cur = obj;
|
|
4075
|
+
for (const part of parts) {
|
|
4076
|
+
if (cur == null) return void 0;
|
|
4077
|
+
cur = cur[part];
|
|
4078
|
+
}
|
|
4079
|
+
return cur;
|
|
4080
|
+
}
|
|
4081
|
+
function isTruthy(val) {
|
|
4082
|
+
if (val == null) return false;
|
|
4083
|
+
if (typeof val === "boolean") return val;
|
|
4084
|
+
if (typeof val === "number") return val !== 0;
|
|
4085
|
+
if (typeof val === "string") return val !== "";
|
|
4086
|
+
if (Array.isArray(val)) return val.length > 0;
|
|
4087
|
+
if (typeof val === "object") return Object.keys(val).length > 0;
|
|
4088
|
+
return true;
|
|
4089
|
+
}
|
|
4090
|
+
function formatValue(val) {
|
|
4091
|
+
if (val == null) return "";
|
|
4092
|
+
if (Array.isArray(val)) return val.join(", ");
|
|
4093
|
+
if (typeof val === "object") return JSON.stringify(val);
|
|
4094
|
+
return String(val);
|
|
4095
|
+
}
|
|
4096
|
+
function isStandalone(str, tagStart, tagEnd) {
|
|
4097
|
+
let lineStart = tagStart;
|
|
4098
|
+
while (lineStart > 0 && str[lineStart - 1] !== "\n") lineStart--;
|
|
4099
|
+
for (let i = lineStart; i < tagStart; i++) {
|
|
4100
|
+
if (str[i] !== " " && str[i] !== " ") return null;
|
|
4101
|
+
}
|
|
4102
|
+
let pos = tagEnd;
|
|
4103
|
+
while (pos < str.length && str[pos] !== "\n" && str[pos] !== "\r") {
|
|
4104
|
+
if (str[pos] !== " " && str[pos] !== " ") return null;
|
|
4105
|
+
pos++;
|
|
4106
|
+
}
|
|
4107
|
+
if (pos < str.length && str[pos] === "\r") pos++;
|
|
4108
|
+
if (pos < str.length && str[pos] === "\n") pos++;
|
|
4109
|
+
return { lineStart, lineEnd: pos };
|
|
4110
|
+
}
|
|
4111
|
+
function findClose(str, nestedOpenRe, closeTag, from) {
|
|
4112
|
+
let depth = 1;
|
|
4113
|
+
let pos = from;
|
|
4114
|
+
while (depth > 0) {
|
|
4115
|
+
const closeIdx = str.indexOf(closeTag, pos);
|
|
4116
|
+
if (closeIdx === -1) return -1;
|
|
4117
|
+
nestedOpenRe.lastIndex = pos;
|
|
4118
|
+
let nm;
|
|
4119
|
+
while ((nm = nestedOpenRe.exec(str)) !== null && nm.index < closeIdx) {
|
|
4120
|
+
depth++;
|
|
4121
|
+
}
|
|
4122
|
+
if (--depth === 0) return closeIdx;
|
|
4123
|
+
pos = closeIdx + closeTag.length;
|
|
4124
|
+
}
|
|
4125
|
+
return -1;
|
|
4126
|
+
}
|
|
4127
|
+
function findTopLevelElse(content) {
|
|
4128
|
+
const re2 = /\{\{#if [\w.[\]]+\}\}|\{\{\/if\}\}|\{\{else\}\}/g;
|
|
4129
|
+
let depth = 0, m2;
|
|
4130
|
+
while ((m2 = re2.exec(content)) !== null) {
|
|
4131
|
+
if (m2[0].startsWith("{{#if ")) depth++;
|
|
4132
|
+
else if (m2[0] === "{{/if}}") depth--;
|
|
4133
|
+
else if (m2[0] === "{{else}}" && depth === 0) return m2.index;
|
|
4134
|
+
}
|
|
4135
|
+
return -1;
|
|
4136
|
+
}
|
|
4137
|
+
function processBlocks(str, openRe, nestedOpenRe, closeTag, fn) {
|
|
4138
|
+
let result = "";
|
|
4139
|
+
let lastEnd = 0;
|
|
4140
|
+
let m2;
|
|
4141
|
+
while ((m2 = openRe.exec(str)) !== null) {
|
|
4142
|
+
const openStart = m2.index;
|
|
4143
|
+
const openEnd = m2.index + m2[0].length;
|
|
4144
|
+
const closeIdx = findClose(str, nestedOpenRe, closeTag, openEnd);
|
|
4145
|
+
if (closeIdx === -1) continue;
|
|
4146
|
+
const closeEnd = closeIdx + closeTag.length;
|
|
4147
|
+
let consumeFrom = openStart;
|
|
4148
|
+
let consumeTo = closeEnd;
|
|
4149
|
+
let innerStart = openEnd;
|
|
4150
|
+
let innerEnd = closeIdx;
|
|
4151
|
+
const openSA = isStandalone(str, openStart, openEnd);
|
|
4152
|
+
if (openSA) {
|
|
4153
|
+
consumeFrom = openSA.lineStart;
|
|
4154
|
+
innerStart = openSA.lineEnd;
|
|
4155
|
+
}
|
|
4156
|
+
const closeSA = isStandalone(str, closeIdx, closeEnd);
|
|
4157
|
+
if (closeSA) {
|
|
4158
|
+
consumeTo = closeSA.lineEnd;
|
|
4159
|
+
}
|
|
4160
|
+
const inner = str.slice(innerStart, innerEnd);
|
|
4161
|
+
result += str.slice(lastEnd, consumeFrom);
|
|
4162
|
+
result += fn(m2[1], inner);
|
|
4163
|
+
lastEnd = consumeTo;
|
|
4164
|
+
openRe.lastIndex = lastEnd;
|
|
4165
|
+
}
|
|
4166
|
+
return result + str.slice(lastEnd);
|
|
4167
|
+
}
|
|
4168
|
+
function render(source, { embed = false } = {}) {
|
|
4169
|
+
const { data, body } = parse(source);
|
|
4170
|
+
let out = renderTemplate(body, data);
|
|
4171
|
+
if (embed) {
|
|
4172
|
+
out = out.trimEnd() + "\n\n<!-- frontmatter\n" + JSON.stringify(data, null, 2) + "\n-->\n";
|
|
4173
|
+
}
|
|
4174
|
+
return out;
|
|
4175
|
+
}
|
|
4176
|
+
function renderHtmlFrag(source) {
|
|
4177
|
+
const md = render(source);
|
|
4178
|
+
return marked.parse(md, { gfm: true });
|
|
4179
|
+
}
|
|
4180
|
+
function renderHtml(source, { embed = false } = {}) {
|
|
4181
|
+
const { data, body } = parse(source);
|
|
4182
|
+
const rendered = renderTemplate(body, data);
|
|
4183
|
+
const htmlBody = marked.parse(rendered, { gfm: true });
|
|
4184
|
+
const title = data.title || "";
|
|
4185
|
+
let dataBlock = "";
|
|
4186
|
+
if (embed) {
|
|
4187
|
+
dataBlock = '\n<script type="application/json" id="frontmatter">\n' + JSON.stringify(data, null, 2) + "\n<\/script>";
|
|
4188
|
+
}
|
|
4189
|
+
return HTML_TEMPLATE.replace("%TITLE%", title).replace("%DATA_BLOCK%", dataBlock).replace("%BODY%", htmlBody);
|
|
4190
|
+
}
|
|
4191
|
+
var HTML_TEMPLATE = `<!doctype html>
|
|
4192
|
+
<html lang="en">
|
|
4193
|
+
<head>
|
|
4194
|
+
<meta charset="UTF-8" />
|
|
4195
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
4196
|
+
<title>%TITLE%</title>%DATA_BLOCK%
|
|
4197
|
+
<style>
|
|
4198
|
+
body { max-width: 720px; margin: 0 auto; padding: 3rem 1.5rem; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 1.0625rem; line-height: 1.65; color: #1f2937; }
|
|
4199
|
+
h1, h2, h3 { color: #111827; letter-spacing: -.02em; }
|
|
4200
|
+
h1 { font-size: 2rem; margin-bottom: .5rem; }
|
|
4201
|
+
h2 { font-size: 1.4rem; margin-top: 2.5rem; }
|
|
4202
|
+
h3 { font-size: 1.1rem; margin-top: 2rem; }
|
|
4203
|
+
code { font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: .875em; background: #f3f4f6; padding: .1em .35em; border-radius: 3px; }
|
|
4204
|
+
pre { background: #f3f4f6; border-radius: 6px; padding: 1.25rem; overflow-x: auto; }
|
|
4205
|
+
pre code { background: none; padding: 0; }
|
|
4206
|
+
table { border-collapse: collapse; width: 100%; }
|
|
4207
|
+
th, td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid #e5e7eb; }
|
|
4208
|
+
th { font-size: .8125rem; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; }
|
|
4209
|
+
a { color: #2563eb; }
|
|
4210
|
+
hr { border: none; border-top: 1px solid #e5e7eb; margin: 2.5rem 0; }
|
|
4211
|
+
</style>
|
|
4212
|
+
</head>
|
|
4213
|
+
<body>
|
|
4214
|
+
%BODY%
|
|
4215
|
+
</body>
|
|
4216
|
+
</html>`;
|
|
4217
|
+
var _registry;
|
|
4218
|
+
var _seq;
|
|
4219
|
+
function renderTemplate(template, ctx, _isRoot) {
|
|
4220
|
+
const isRoot = _isRoot !== false;
|
|
4221
|
+
if (isRoot) {
|
|
4222
|
+
_registry = /* @__PURE__ */ new Map();
|
|
4223
|
+
_seq = 0;
|
|
4224
|
+
}
|
|
4225
|
+
function protect(str) {
|
|
4226
|
+
const tok = `${_seq++}`;
|
|
4227
|
+
_registry.set(tok, str);
|
|
4228
|
+
return tok;
|
|
4229
|
+
}
|
|
4230
|
+
function restore(str) {
|
|
4231
|
+
let out2 = str;
|
|
4232
|
+
for (const [tok, val] of [..._registry.entries()].reverse()) {
|
|
4233
|
+
out2 = out2.split(tok).join(val);
|
|
4234
|
+
}
|
|
4235
|
+
return out2;
|
|
4236
|
+
}
|
|
4237
|
+
let out = template;
|
|
4238
|
+
out = out.replace(/\\\{\{/g, () => protect("{{"));
|
|
4239
|
+
out = processBlocks(
|
|
4240
|
+
out,
|
|
4241
|
+
/\{\{#each ([\w.[\]]+)\}\}/g,
|
|
4242
|
+
/\{\{#each [\w.[\]]+\}\}/g,
|
|
4243
|
+
"{{/each}}",
|
|
4244
|
+
(key, inner) => {
|
|
4245
|
+
const arr = resolvePath(ctx, key);
|
|
4246
|
+
if (!Array.isArray(arr)) return protect("");
|
|
4247
|
+
return protect(arr.map((item, i) => {
|
|
4248
|
+
const itemCtx = { ...ctx, this: item, "@index": i, "@first": i === 0, "@last": i === arr.length - 1 };
|
|
4249
|
+
if (item && typeof item === "object" && !Array.isArray(item)) Object.assign(itemCtx, item);
|
|
4250
|
+
return renderTemplate(inner, itemCtx, false);
|
|
4251
|
+
}).join(""));
|
|
4252
|
+
}
|
|
4253
|
+
);
|
|
4254
|
+
out = processBlocks(
|
|
4255
|
+
out,
|
|
4256
|
+
/\{\{#if ([\w.[\]]+)\}\}/g,
|
|
4257
|
+
/\{\{#if [\w.[\]]+\}\}/g,
|
|
4258
|
+
"{{/if}}",
|
|
4259
|
+
(key, inner) => {
|
|
4260
|
+
const val = resolvePath(ctx, key);
|
|
4261
|
+
const elseIdx = findTopLevelElse(inner);
|
|
4262
|
+
let truthy, falsy;
|
|
4263
|
+
if (elseIdx === -1) {
|
|
4264
|
+
truthy = inner;
|
|
4265
|
+
falsy = "";
|
|
4266
|
+
} else {
|
|
4267
|
+
const elseEnd = elseIdx + "{{else}}".length;
|
|
4268
|
+
const elseSA = isStandalone(inner, elseIdx, elseEnd);
|
|
4269
|
+
if (elseSA) {
|
|
4270
|
+
truthy = inner.slice(0, elseSA.lineStart);
|
|
4271
|
+
falsy = inner.slice(elseSA.lineEnd);
|
|
4272
|
+
} else {
|
|
4273
|
+
truthy = inner.slice(0, elseIdx);
|
|
4274
|
+
falsy = inner.slice(elseEnd);
|
|
4275
|
+
}
|
|
4276
|
+
}
|
|
4277
|
+
return protect(renderTemplate(isTruthy(val) ? truthy : falsy, ctx, false));
|
|
4278
|
+
}
|
|
4279
|
+
);
|
|
4280
|
+
out = out.replace(/\{\{> ?([\w.[\]]+)\}\}/g, (_2, path) => {
|
|
4281
|
+
const val = resolvePath(ctx, path);
|
|
4282
|
+
return val != null ? protect(String(val)) : "";
|
|
4283
|
+
});
|
|
4284
|
+
out = out.replace(/\{\{([\w.[\]@]+)\}\}/g, (_2, path) => {
|
|
4285
|
+
const val = resolvePath(ctx, path);
|
|
4286
|
+
if (val == null) return "";
|
|
4287
|
+
return protect(formatValue(val));
|
|
4288
|
+
});
|
|
4289
|
+
return isRoot ? restore(out) : out;
|
|
4290
|
+
}
|
|
4291
|
+
module.exports = { SPEC_VERSION, parse, render, renderHtmlFrag, renderHtml, renderTemplate, resolvePath, yaml, marked };
|
|
4292
|
+
}
|
|
4293
|
+
});
|
|
4294
|
+
return require_parse();
|
|
4295
|
+
})();
|