UNPKG

303 kBJavaScriptView Raw
1"use strict";
2
3// dist/_third-party.js.cjs.js
4var __getOwnPropNames = Object.getOwnPropertyNames;
5var __commonJS = (cb, mod) => function __require() {
6 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = {
7 exports: {}
8 }).exports, mod), mod.exports;
9};
10var require_resolve_from = __commonJS({
11 "node_modules/import-fresh/node_modules/resolve-from/index.js"(exports2, module2) {
12 "use strict";
13 var path = require("path");
14 var Module = require("module");
15 var fs = require("fs");
16 var resolveFrom = (fromDir, moduleId, silent) => {
17 if (typeof fromDir !== "string") {
18 throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDir}\``);
19 }
20 if (typeof moduleId !== "string") {
21 throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
22 }
23 try {
24 fromDir = fs.realpathSync(fromDir);
25 } catch (err) {
26 if (err.code === "ENOENT") {
27 fromDir = path.resolve(fromDir);
28 } else if (silent) {
29 return null;
30 } else {
31 throw err;
32 }
33 }
34 const fromFile = path.join(fromDir, "noop.js");
35 const resolveFileName = () => Module._resolveFilename(moduleId, {
36 id: fromFile,
37 filename: fromFile,
38 paths: Module._nodeModulePaths(fromDir)
39 });
40 if (silent) {
41 try {
42 return resolveFileName();
43 } catch (err) {
44 return null;
45 }
46 }
47 return resolveFileName();
48 };
49 module2.exports = (fromDir, moduleId) => resolveFrom(fromDir, moduleId);
50 module2.exports.silent = (fromDir, moduleId) => resolveFrom(fromDir, moduleId, true);
51 }
52});
53var require_parent_module = __commonJS({
54 "scripts/build/shims/parent-module.cjs"(exports2, module2) {
55 "use strict";
56 module2.exports = (file) => file;
57 }
58});
59var require_import_fresh = __commonJS({
60 "node_modules/import-fresh/index.js"(exports2, module2) {
61 "use strict";
62 var path = require("path");
63 var resolveFrom = require_resolve_from();
64 var parentModule = require_parent_module();
65 module2.exports = (moduleId) => {
66 if (typeof moduleId !== "string") {
67 throw new TypeError("Expected a string");
68 }
69 const parentPath = parentModule(__filename);
70 const cwd = parentPath ? path.dirname(parentPath) : __dirname;
71 const filePath = resolveFrom(cwd, moduleId);
72 const oldModule = require.cache[filePath];
73 if (oldModule && oldModule.parent) {
74 let i = oldModule.parent.children.length;
75 while (i--) {
76 if (oldModule.parent.children[i].id === filePath) {
77 oldModule.parent.children.splice(i, 1);
78 }
79 }
80 }
81 delete require.cache[filePath];
82 const parent = require.cache[parentPath];
83 return parent === void 0 ? require(filePath) : parent.require(filePath);
84 };
85 }
86});
87var require_is_arrayish = __commonJS({
88 "node_modules/is-arrayish/index.js"(exports2, module2) {
89 "use strict";
90 module2.exports = function isArrayish(obj) {
91 if (!obj) {
92 return false;
93 }
94 return obj instanceof Array || Array.isArray(obj) || obj.length >= 0 && obj.splice instanceof Function;
95 };
96 }
97});
98var require_error_ex = __commonJS({
99 "node_modules/error-ex/index.js"(exports2, module2) {
100 "use strict";
101 var util = require("util");
102 var isArrayish = require_is_arrayish();
103 var errorEx = function errorEx2(name, properties) {
104 if (!name || name.constructor !== String) {
105 properties = name || {};
106 name = Error.name;
107 }
108 var errorExError = function ErrorEXError(message) {
109 if (!this) {
110 return new ErrorEXError(message);
111 }
112 message = message instanceof Error ? message.message : message || this.message;
113 Error.call(this, message);
114 Error.captureStackTrace(this, errorExError);
115 this.name = name;
116 Object.defineProperty(this, "message", {
117 configurable: true,
118 enumerable: false,
119 get: function() {
120 var newMessage = message.split(/\r?\n/g);
121 for (var key in properties) {
122 if (!properties.hasOwnProperty(key)) {
123 continue;
124 }
125 var modifier = properties[key];
126 if ("message" in modifier) {
127 newMessage = modifier.message(this[key], newMessage) || newMessage;
128 if (!isArrayish(newMessage)) {
129 newMessage = [newMessage];
130 }
131 }
132 }
133 return newMessage.join("\n");
134 },
135 set: function(v) {
136 message = v;
137 }
138 });
139 var overwrittenStack = null;
140 var stackDescriptor = Object.getOwnPropertyDescriptor(this, "stack");
141 var stackGetter = stackDescriptor.get;
142 var stackValue = stackDescriptor.value;
143 delete stackDescriptor.value;
144 delete stackDescriptor.writable;
145 stackDescriptor.set = function(newstack) {
146 overwrittenStack = newstack;
147 };
148 stackDescriptor.get = function() {
149 var stack = (overwrittenStack || (stackGetter ? stackGetter.call(this) : stackValue)).split(/\r?\n+/g);
150 if (!overwrittenStack) {
151 stack[0] = this.name + ": " + this.message;
152 }
153 var lineCount = 1;
154 for (var key in properties) {
155 if (!properties.hasOwnProperty(key)) {
156 continue;
157 }
158 var modifier = properties[key];
159 if ("line" in modifier) {
160 var line = modifier.line(this[key]);
161 if (line) {
162 stack.splice(lineCount++, 0, " " + line);
163 }
164 }
165 if ("stack" in modifier) {
166 modifier.stack(this[key], stack);
167 }
168 }
169 return stack.join("\n");
170 };
171 Object.defineProperty(this, "stack", stackDescriptor);
172 };
173 if (Object.setPrototypeOf) {
174 Object.setPrototypeOf(errorExError.prototype, Error.prototype);
175 Object.setPrototypeOf(errorExError, Error);
176 } else {
177 util.inherits(errorExError, Error);
178 }
179 return errorExError;
180 };
181 errorEx.append = function(str, def) {
182 return {
183 message: function(v, message) {
184 v = v || def;
185 if (v) {
186 message[0] += " " + str.replace("%s", v.toString());
187 }
188 return message;
189 }
190 };
191 };
192 errorEx.line = function(str, def) {
193 return {
194 line: function(v) {
195 v = v || def;
196 if (v) {
197 return str.replace("%s", v.toString());
198 }
199 return null;
200 }
201 };
202 };
203 module2.exports = errorEx;
204 }
205});
206var require_json_parse_even_better_errors = __commonJS({
207 "node_modules/json-parse-even-better-errors/index.js"(exports2, module2) {
208 "use strict";
209 var hexify = (char) => {
210 const h = char.charCodeAt(0).toString(16).toUpperCase();
211 return "0x" + (h.length % 2 ? "0" : "") + h;
212 };
213 var parseError = (e, txt, context) => {
214 if (!txt) {
215 return {
216 message: e.message + " while parsing empty string",
217 position: 0
218 };
219 }
220 const badToken = e.message.match(/^Unexpected token (.) .*position\s+(\d+)/i);
221 const errIdx = badToken ? +badToken[2] : e.message.match(/^Unexpected end of JSON.*/i) ? txt.length - 1 : null;
222 const msg = badToken ? e.message.replace(/^Unexpected token ./, `Unexpected token ${JSON.stringify(badToken[1])} (${hexify(badToken[1])})`) : e.message;
223 if (errIdx !== null && errIdx !== void 0) {
224 const start = errIdx <= context ? 0 : errIdx - context;
225 const end = errIdx + context >= txt.length ? txt.length : errIdx + context;
226 const slice = (start === 0 ? "" : "...") + txt.slice(start, end) + (end === txt.length ? "" : "...");
227 const near = txt === slice ? "" : "near ";
228 return {
229 message: msg + ` while parsing ${near}${JSON.stringify(slice)}`,
230 position: errIdx
231 };
232 } else {
233 return {
234 message: msg + ` while parsing '${txt.slice(0, context * 2)}'`,
235 position: 0
236 };
237 }
238 };
239 var JSONParseError = class extends SyntaxError {
240 constructor(er, txt, context, caller) {
241 context = context || 20;
242 const metadata = parseError(er, txt, context);
243 super(metadata.message);
244 Object.assign(this, metadata);
245 this.code = "EJSONPARSE";
246 this.systemError = er;
247 Error.captureStackTrace(this, caller || this.constructor);
248 }
249 get name() {
250 return this.constructor.name;
251 }
252 set name(n) {
253 }
254 get [Symbol.toStringTag]() {
255 return this.constructor.name;
256 }
257 };
258 var kIndent = Symbol.for("indent");
259 var kNewline = Symbol.for("newline");
260 var formatRE = /^\s*[{\[]((?:\r?\n)+)([\s\t]*)/;
261 var emptyRE = /^(?:\{\}|\[\])((?:\r?\n)+)?$/;
262 var parseJson = (txt, reviver, context) => {
263 const parseText = stripBOM(txt);
264 context = context || 20;
265 try {
266 const [, newline = "\n", indent = " "] = parseText.match(emptyRE) || parseText.match(formatRE) || [, "", ""];
267 const result = JSON.parse(parseText, reviver);
268 if (result && typeof result === "object") {
269 result[kNewline] = newline;
270 result[kIndent] = indent;
271 }
272 return result;
273 } catch (e) {
274 if (typeof txt !== "string" && !Buffer.isBuffer(txt)) {
275 const isEmptyArray = Array.isArray(txt) && txt.length === 0;
276 throw Object.assign(new TypeError(`Cannot parse ${isEmptyArray ? "an empty array" : String(txt)}`), {
277 code: "EJSONPARSE",
278 systemError: e
279 });
280 }
281 throw new JSONParseError(e, parseText, context, parseJson);
282 }
283 };
284 var stripBOM = (txt) => String(txt).replace(/^\uFEFF/, "");
285 module2.exports = parseJson;
286 parseJson.JSONParseError = JSONParseError;
287 parseJson.noExceptions = (txt, reviver) => {
288 try {
289 return JSON.parse(stripBOM(txt), reviver);
290 } catch (e) {
291 }
292 };
293 }
294});
295var require_build = __commonJS({
296 "node_modules/parse-json/node_modules/lines-and-columns/build/index.js"(exports2) {
297 "use strict";
298 exports2.__esModule = true;
299 exports2.LinesAndColumns = void 0;
300 var LF = "\n";
301 var CR = "\r";
302 var LinesAndColumns = function() {
303 function LinesAndColumns2(string) {
304 this.string = string;
305 var offsets = [0];
306 for (var offset = 0; offset < string.length; ) {
307 switch (string[offset]) {
308 case LF:
309 offset += LF.length;
310 offsets.push(offset);
311 break;
312 case CR:
313 offset += CR.length;
314 if (string[offset] === LF) {
315 offset += LF.length;
316 }
317 offsets.push(offset);
318 break;
319 default:
320 offset++;
321 break;
322 }
323 }
324 this.offsets = offsets;
325 }
326 LinesAndColumns2.prototype.locationForIndex = function(index) {
327 if (index < 0 || index > this.string.length) {
328 return null;
329 }
330 var line = 0;
331 var offsets = this.offsets;
332 while (offsets[line + 1] <= index) {
333 line++;
334 }
335 var column = index - offsets[line];
336 return {
337 line,
338 column
339 };
340 };
341 LinesAndColumns2.prototype.indexForLocation = function(location) {
342 var line = location.line, column = location.column;
343 if (line < 0 || line >= this.offsets.length) {
344 return null;
345 }
346 if (column < 0 || column > this.lengthOfLine(line)) {
347 return null;
348 }
349 return this.offsets[line] + column;
350 };
351 LinesAndColumns2.prototype.lengthOfLine = function(line) {
352 var offset = this.offsets[line];
353 var nextOffset = line === this.offsets.length - 1 ? this.string.length : this.offsets[line + 1];
354 return nextOffset - offset;
355 };
356 return LinesAndColumns2;
357 }();
358 exports2.LinesAndColumns = LinesAndColumns;
359 exports2["default"] = LinesAndColumns;
360 }
361});
362var require_js_tokens = __commonJS({
363 "node_modules/js-tokens/index.js"(exports2) {
364 Object.defineProperty(exports2, "__esModule", {
365 value: true
366 });
367 exports2.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
368 exports2.matchToToken = function(match) {
369 var token = {
370 type: "invalid",
371 value: match[0],
372 closed: void 0
373 };
374 if (match[1])
375 token.type = "string", token.closed = !!(match[3] || match[4]);
376 else if (match[5])
377 token.type = "comment";
378 else if (match[6])
379 token.type = "comment", token.closed = !!match[7];
380 else if (match[8])
381 token.type = "regex";
382 else if (match[9])
383 token.type = "number";
384 else if (match[10])
385 token.type = "name";
386 else if (match[11])
387 token.type = "punctuator";
388 else if (match[12])
389 token.type = "whitespace";
390 return token;
391 };
392 }
393});
394var require_identifier = __commonJS({
395 "node_modules/@babel/helper-validator-identifier/lib/identifier.js"(exports2) {
396 "use strict";
397 Object.defineProperty(exports2, "__esModule", {
398 value: true
399 });
400 exports2.isIdentifierChar = isIdentifierChar;
401 exports2.isIdentifierName = isIdentifierName;
402 exports2.isIdentifierStart = isIdentifierStart;
403 var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC";
404 var nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F";
405 var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
406 var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
407 nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
408 var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938, 6, 4191];
409 var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 81, 2, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
410 function isInAstralSet(code, set) {
411 let pos = 65536;
412 for (let i = 0, length = set.length; i < length; i += 2) {
413 pos += set[i];
414 if (pos > code)
415 return false;
416 pos += set[i + 1];
417 if (pos >= code)
418 return true;
419 }
420 return false;
421 }
422 function isIdentifierStart(code) {
423 if (code < 65)
424 return code === 36;
425 if (code <= 90)
426 return true;
427 if (code < 97)
428 return code === 95;
429 if (code <= 122)
430 return true;
431 if (code <= 65535) {
432 return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
433 }
434 return isInAstralSet(code, astralIdentifierStartCodes);
435 }
436 function isIdentifierChar(code) {
437 if (code < 48)
438 return code === 36;
439 if (code < 58)
440 return true;
441 if (code < 65)
442 return false;
443 if (code <= 90)
444 return true;
445 if (code < 97)
446 return code === 95;
447 if (code <= 122)
448 return true;
449 if (code <= 65535) {
450 return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
451 }
452 return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
453 }
454 function isIdentifierName(name) {
455 let isFirst = true;
456 for (let i = 0; i < name.length; i++) {
457 let cp = name.charCodeAt(i);
458 if ((cp & 64512) === 55296 && i + 1 < name.length) {
459 const trail = name.charCodeAt(++i);
460 if ((trail & 64512) === 56320) {
461 cp = 65536 + ((cp & 1023) << 10) + (trail & 1023);
462 }
463 }
464 if (isFirst) {
465 isFirst = false;
466 if (!isIdentifierStart(cp)) {
467 return false;
468 }
469 } else if (!isIdentifierChar(cp)) {
470 return false;
471 }
472 }
473 return !isFirst;
474 }
475 }
476});
477var require_keyword = __commonJS({
478 "node_modules/@babel/helper-validator-identifier/lib/keyword.js"(exports2) {
479 "use strict";
480 Object.defineProperty(exports2, "__esModule", {
481 value: true
482 });
483 exports2.isKeyword = isKeyword;
484 exports2.isReservedWord = isReservedWord;
485 exports2.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
486 exports2.isStrictBindReservedWord = isStrictBindReservedWord;
487 exports2.isStrictReservedWord = isStrictReservedWord;
488 var reservedWords = {
489 keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
490 strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
491 strictBind: ["eval", "arguments"]
492 };
493 var keywords = new Set(reservedWords.keyword);
494 var reservedWordsStrictSet = new Set(reservedWords.strict);
495 var reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
496 function isReservedWord(word, inModule) {
497 return inModule && word === "await" || word === "enum";
498 }
499 function isStrictReservedWord(word, inModule) {
500 return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
501 }
502 function isStrictBindOnlyReservedWord(word) {
503 return reservedWordsStrictBindSet.has(word);
504 }
505 function isStrictBindReservedWord(word, inModule) {
506 return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
507 }
508 function isKeyword(word) {
509 return keywords.has(word);
510 }
511 }
512});
513var require_lib = __commonJS({
514 "node_modules/@babel/helper-validator-identifier/lib/index.js"(exports2) {
515 "use strict";
516 Object.defineProperty(exports2, "__esModule", {
517 value: true
518 });
519 Object.defineProperty(exports2, "isIdentifierChar", {
520 enumerable: true,
521 get: function() {
522 return _identifier.isIdentifierChar;
523 }
524 });
525 Object.defineProperty(exports2, "isIdentifierName", {
526 enumerable: true,
527 get: function() {
528 return _identifier.isIdentifierName;
529 }
530 });
531 Object.defineProperty(exports2, "isIdentifierStart", {
532 enumerable: true,
533 get: function() {
534 return _identifier.isIdentifierStart;
535 }
536 });
537 Object.defineProperty(exports2, "isKeyword", {
538 enumerable: true,
539 get: function() {
540 return _keyword.isKeyword;
541 }
542 });
543 Object.defineProperty(exports2, "isReservedWord", {
544 enumerable: true,
545 get: function() {
546 return _keyword.isReservedWord;
547 }
548 });
549 Object.defineProperty(exports2, "isStrictBindOnlyReservedWord", {
550 enumerable: true,
551 get: function() {
552 return _keyword.isStrictBindOnlyReservedWord;
553 }
554 });
555 Object.defineProperty(exports2, "isStrictBindReservedWord", {
556 enumerable: true,
557 get: function() {
558 return _keyword.isStrictBindReservedWord;
559 }
560 });
561 Object.defineProperty(exports2, "isStrictReservedWord", {
562 enumerable: true,
563 get: function() {
564 return _keyword.isStrictReservedWord;
565 }
566 });
567 var _identifier = require_identifier();
568 var _keyword = require_keyword();
569 }
570});
571var require_escape_string_regexp = __commonJS({
572 "node_modules/@babel/highlight/node_modules/escape-string-regexp/index.js"(exports2, module2) {
573 "use strict";
574 var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
575 module2.exports = function(str) {
576 if (typeof str !== "string") {
577 throw new TypeError("Expected a string");
578 }
579 return str.replace(matchOperatorsRe, "\\$&");
580 };
581 }
582});
583var require_color_name = __commonJS({
584 "node_modules/color-name/index.js"(exports2, module2) {
585 "use strict";
586 module2.exports = {
587 "aliceblue": [240, 248, 255],
588 "antiquewhite": [250, 235, 215],
589 "aqua": [0, 255, 255],
590 "aquamarine": [127, 255, 212],
591 "azure": [240, 255, 255],
592 "beige": [245, 245, 220],
593 "bisque": [255, 228, 196],
594 "black": [0, 0, 0],
595 "blanchedalmond": [255, 235, 205],
596 "blue": [0, 0, 255],
597 "blueviolet": [138, 43, 226],
598 "brown": [165, 42, 42],
599 "burlywood": [222, 184, 135],
600 "cadetblue": [95, 158, 160],
601 "chartreuse": [127, 255, 0],
602 "chocolate": [210, 105, 30],
603 "coral": [255, 127, 80],
604 "cornflowerblue": [100, 149, 237],
605 "cornsilk": [255, 248, 220],
606 "crimson": [220, 20, 60],
607 "cyan": [0, 255, 255],
608 "darkblue": [0, 0, 139],
609 "darkcyan": [0, 139, 139],
610 "darkgoldenrod": [184, 134, 11],
611 "darkgray": [169, 169, 169],
612 "darkgreen": [0, 100, 0],
613 "darkgrey": [169, 169, 169],
614 "darkkhaki": [189, 183, 107],
615 "darkmagenta": [139, 0, 139],
616 "darkolivegreen": [85, 107, 47],
617 "darkorange": [255, 140, 0],
618 "darkorchid": [153, 50, 204],
619 "darkred": [139, 0, 0],
620 "darksalmon": [233, 150, 122],
621 "darkseagreen": [143, 188, 143],
622 "darkslateblue": [72, 61, 139],
623 "darkslategray": [47, 79, 79],
624 "darkslategrey": [47, 79, 79],
625 "darkturquoise": [0, 206, 209],
626 "darkviolet": [148, 0, 211],
627 "deeppink": [255, 20, 147],
628 "deepskyblue": [0, 191, 255],
629 "dimgray": [105, 105, 105],
630 "dimgrey": [105, 105, 105],
631 "dodgerblue": [30, 144, 255],
632 "firebrick": [178, 34, 34],
633 "floralwhite": [255, 250, 240],
634 "forestgreen": [34, 139, 34],
635 "fuchsia": [255, 0, 255],
636 "gainsboro": [220, 220, 220],
637 "ghostwhite": [248, 248, 255],
638 "gold": [255, 215, 0],
639 "goldenrod": [218, 165, 32],
640 "gray": [128, 128, 128],
641 "green": [0, 128, 0],
642 "greenyellow": [173, 255, 47],
643 "grey": [128, 128, 128],
644 "honeydew": [240, 255, 240],
645 "hotpink": [255, 105, 180],
646 "indianred": [205, 92, 92],
647 "indigo": [75, 0, 130],
648 "ivory": [255, 255, 240],
649 "khaki": [240, 230, 140],
650 "lavender": [230, 230, 250],
651 "lavenderblush": [255, 240, 245],
652 "lawngreen": [124, 252, 0],
653 "lemonchiffon": [255, 250, 205],
654 "lightblue": [173, 216, 230],
655 "lightcoral": [240, 128, 128],
656 "lightcyan": [224, 255, 255],
657 "lightgoldenrodyellow": [250, 250, 210],
658 "lightgray": [211, 211, 211],
659 "lightgreen": [144, 238, 144],
660 "lightgrey": [211, 211, 211],
661 "lightpink": [255, 182, 193],
662 "lightsalmon": [255, 160, 122],
663 "lightseagreen": [32, 178, 170],
664 "lightskyblue": [135, 206, 250],
665 "lightslategray": [119, 136, 153],
666 "lightslategrey": [119, 136, 153],
667 "lightsteelblue": [176, 196, 222],
668 "lightyellow": [255, 255, 224],
669 "lime": [0, 255, 0],
670 "limegreen": [50, 205, 50],
671 "linen": [250, 240, 230],
672 "magenta": [255, 0, 255],
673 "maroon": [128, 0, 0],
674 "mediumaquamarine": [102, 205, 170],
675 "mediumblue": [0, 0, 205],
676 "mediumorchid": [186, 85, 211],
677 "mediumpurple": [147, 112, 219],
678 "mediumseagreen": [60, 179, 113],
679 "mediumslateblue": [123, 104, 238],
680 "mediumspringgreen": [0, 250, 154],
681 "mediumturquoise": [72, 209, 204],
682 "mediumvioletred": [199, 21, 133],
683 "midnightblue": [25, 25, 112],
684 "mintcream": [245, 255, 250],
685 "mistyrose": [255, 228, 225],
686 "moccasin": [255, 228, 181],
687 "navajowhite": [255, 222, 173],
688 "navy": [0, 0, 128],
689 "oldlace": [253, 245, 230],
690 "olive": [128, 128, 0],
691 "olivedrab": [107, 142, 35],
692 "orange": [255, 165, 0],
693 "orangered": [255, 69, 0],
694 "orchid": [218, 112, 214],
695 "palegoldenrod": [238, 232, 170],
696 "palegreen": [152, 251, 152],
697 "paleturquoise": [175, 238, 238],
698 "palevioletred": [219, 112, 147],
699 "papayawhip": [255, 239, 213],
700 "peachpuff": [255, 218, 185],
701 "peru": [205, 133, 63],
702 "pink": [255, 192, 203],
703 "plum": [221, 160, 221],
704 "powderblue": [176, 224, 230],
705 "purple": [128, 0, 128],
706 "rebeccapurple": [102, 51, 153],
707 "red": [255, 0, 0],
708 "rosybrown": [188, 143, 143],
709 "royalblue": [65, 105, 225],
710 "saddlebrown": [139, 69, 19],
711 "salmon": [250, 128, 114],
712 "sandybrown": [244, 164, 96],
713 "seagreen": [46, 139, 87],
714 "seashell": [255, 245, 238],
715 "sienna": [160, 82, 45],
716 "silver": [192, 192, 192],
717 "skyblue": [135, 206, 235],
718 "slateblue": [106, 90, 205],
719 "slategray": [112, 128, 144],
720 "slategrey": [112, 128, 144],
721 "snow": [255, 250, 250],
722 "springgreen": [0, 255, 127],
723 "steelblue": [70, 130, 180],
724 "tan": [210, 180, 140],
725 "teal": [0, 128, 128],
726 "thistle": [216, 191, 216],
727 "tomato": [255, 99, 71],
728 "turquoise": [64, 224, 208],
729 "violet": [238, 130, 238],
730 "wheat": [245, 222, 179],
731 "white": [255, 255, 255],
732 "whitesmoke": [245, 245, 245],
733 "yellow": [255, 255, 0],
734 "yellowgreen": [154, 205, 50]
735 };
736 }
737});
738var require_conversions = __commonJS({
739 "node_modules/color-convert/conversions.js"(exports2, module2) {
740 var cssKeywords = require_color_name();
741 var reverseKeywords = {};
742 for (key in cssKeywords) {
743 if (cssKeywords.hasOwnProperty(key)) {
744 reverseKeywords[cssKeywords[key]] = key;
745 }
746 }
747 var key;
748 var convert = module2.exports = {
749 rgb: {
750 channels: 3,
751 labels: "rgb"
752 },
753 hsl: {
754 channels: 3,
755 labels: "hsl"
756 },
757 hsv: {
758 channels: 3,
759 labels: "hsv"
760 },
761 hwb: {
762 channels: 3,
763 labels: "hwb"
764 },
765 cmyk: {
766 channels: 4,
767 labels: "cmyk"
768 },
769 xyz: {
770 channels: 3,
771 labels: "xyz"
772 },
773 lab: {
774 channels: 3,
775 labels: "lab"
776 },
777 lch: {
778 channels: 3,
779 labels: "lch"
780 },
781 hex: {
782 channels: 1,
783 labels: ["hex"]
784 },
785 keyword: {
786 channels: 1,
787 labels: ["keyword"]
788 },
789 ansi16: {
790 channels: 1,
791 labels: ["ansi16"]
792 },
793 ansi256: {
794 channels: 1,
795 labels: ["ansi256"]
796 },
797 hcg: {
798 channels: 3,
799 labels: ["h", "c", "g"]
800 },
801 apple: {
802 channels: 3,
803 labels: ["r16", "g16", "b16"]
804 },
805 gray: {
806 channels: 1,
807 labels: ["gray"]
808 }
809 };
810 for (model in convert) {
811 if (convert.hasOwnProperty(model)) {
812 if (!("channels" in convert[model])) {
813 throw new Error("missing channels property: " + model);
814 }
815 if (!("labels" in convert[model])) {
816 throw new Error("missing channel labels property: " + model);
817 }
818 if (convert[model].labels.length !== convert[model].channels) {
819 throw new Error("channel and label counts mismatch: " + model);
820 }
821 channels = convert[model].channels;
822 labels = convert[model].labels;
823 delete convert[model].channels;
824 delete convert[model].labels;
825 Object.defineProperty(convert[model], "channels", {
826 value: channels
827 });
828 Object.defineProperty(convert[model], "labels", {
829 value: labels
830 });
831 }
832 }
833 var channels;
834 var labels;
835 var model;
836 convert.rgb.hsl = function(rgb) {
837 var r = rgb[0] / 255;
838 var g = rgb[1] / 255;
839 var b = rgb[2] / 255;
840 var min = Math.min(r, g, b);
841 var max = Math.max(r, g, b);
842 var delta = max - min;
843 var h;
844 var s;
845 var l;
846 if (max === min) {
847 h = 0;
848 } else if (r === max) {
849 h = (g - b) / delta;
850 } else if (g === max) {
851 h = 2 + (b - r) / delta;
852 } else if (b === max) {
853 h = 4 + (r - g) / delta;
854 }
855 h = Math.min(h * 60, 360);
856 if (h < 0) {
857 h += 360;
858 }
859 l = (min + max) / 2;
860 if (max === min) {
861 s = 0;
862 } else if (l <= 0.5) {
863 s = delta / (max + min);
864 } else {
865 s = delta / (2 - max - min);
866 }
867 return [h, s * 100, l * 100];
868 };
869 convert.rgb.hsv = function(rgb) {
870 var rdif;
871 var gdif;
872 var bdif;
873 var h;
874 var s;
875 var r = rgb[0] / 255;
876 var g = rgb[1] / 255;
877 var b = rgb[2] / 255;
878 var v = Math.max(r, g, b);
879 var diff = v - Math.min(r, g, b);
880 var diffc = function(c) {
881 return (v - c) / 6 / diff + 1 / 2;
882 };
883 if (diff === 0) {
884 h = s = 0;
885 } else {
886 s = diff / v;
887 rdif = diffc(r);
888 gdif = diffc(g);
889 bdif = diffc(b);
890 if (r === v) {
891 h = bdif - gdif;
892 } else if (g === v) {
893 h = 1 / 3 + rdif - bdif;
894 } else if (b === v) {
895 h = 2 / 3 + gdif - rdif;
896 }
897 if (h < 0) {
898 h += 1;
899 } else if (h > 1) {
900 h -= 1;
901 }
902 }
903 return [h * 360, s * 100, v * 100];
904 };
905 convert.rgb.hwb = function(rgb) {
906 var r = rgb[0];
907 var g = rgb[1];
908 var b = rgb[2];
909 var h = convert.rgb.hsl(rgb)[0];
910 var w = 1 / 255 * Math.min(r, Math.min(g, b));
911 b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
912 return [h, w * 100, b * 100];
913 };
914 convert.rgb.cmyk = function(rgb) {
915 var r = rgb[0] / 255;
916 var g = rgb[1] / 255;
917 var b = rgb[2] / 255;
918 var c;
919 var m;
920 var y;
921 var k;
922 k = Math.min(1 - r, 1 - g, 1 - b);
923 c = (1 - r - k) / (1 - k) || 0;
924 m = (1 - g - k) / (1 - k) || 0;
925 y = (1 - b - k) / (1 - k) || 0;
926 return [c * 100, m * 100, y * 100, k * 100];
927 };
928 function comparativeDistance(x, y) {
929 return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
930 }
931 convert.rgb.keyword = function(rgb) {
932 var reversed = reverseKeywords[rgb];
933 if (reversed) {
934 return reversed;
935 }
936 var currentClosestDistance = Infinity;
937 var currentClosestKeyword;
938 for (var keyword in cssKeywords) {
939 if (cssKeywords.hasOwnProperty(keyword)) {
940 var value = cssKeywords[keyword];
941 var distance = comparativeDistance(rgb, value);
942 if (distance < currentClosestDistance) {
943 currentClosestDistance = distance;
944 currentClosestKeyword = keyword;
945 }
946 }
947 }
948 return currentClosestKeyword;
949 };
950 convert.keyword.rgb = function(keyword) {
951 return cssKeywords[keyword];
952 };
953 convert.rgb.xyz = function(rgb) {
954 var r = rgb[0] / 255;
955 var g = rgb[1] / 255;
956 var b = rgb[2] / 255;
957 r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
958 g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
959 b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
960 var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
961 var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
962 var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
963 return [x * 100, y * 100, z * 100];
964 };
965 convert.rgb.lab = function(rgb) {
966 var xyz = convert.rgb.xyz(rgb);
967 var x = xyz[0];
968 var y = xyz[1];
969 var z = xyz[2];
970 var l;
971 var a;
972 var b;
973 x /= 95.047;
974 y /= 100;
975 z /= 108.883;
976 x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
977 y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
978 z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
979 l = 116 * y - 16;
980 a = 500 * (x - y);
981 b = 200 * (y - z);
982 return [l, a, b];
983 };
984 convert.hsl.rgb = function(hsl) {
985 var h = hsl[0] / 360;
986 var s = hsl[1] / 100;
987 var l = hsl[2] / 100;
988 var t1;
989 var t2;
990 var t3;
991 var rgb;
992 var val;
993 if (s === 0) {
994 val = l * 255;
995 return [val, val, val];
996 }
997 if (l < 0.5) {
998 t2 = l * (1 + s);
999 } else {
1000 t2 = l + s - l * s;
1001 }
1002 t1 = 2 * l - t2;
1003 rgb = [0, 0, 0];
1004 for (var i = 0; i < 3; i++) {
1005 t3 = h + 1 / 3 * -(i - 1);
1006 if (t3 < 0) {
1007 t3++;
1008 }
1009 if (t3 > 1) {
1010 t3--;
1011 }
1012 if (6 * t3 < 1) {
1013 val = t1 + (t2 - t1) * 6 * t3;
1014 } else if (2 * t3 < 1) {
1015 val = t2;
1016 } else if (3 * t3 < 2) {
1017 val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
1018 } else {
1019 val = t1;
1020 }
1021 rgb[i] = val * 255;
1022 }
1023 return rgb;
1024 };
1025 convert.hsl.hsv = function(hsl) {
1026 var h = hsl[0];
1027 var s = hsl[1] / 100;
1028 var l = hsl[2] / 100;
1029 var smin = s;
1030 var lmin = Math.max(l, 0.01);
1031 var sv;
1032 var v;
1033 l *= 2;
1034 s *= l <= 1 ? l : 2 - l;
1035 smin *= lmin <= 1 ? lmin : 2 - lmin;
1036 v = (l + s) / 2;
1037 sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
1038 return [h, sv * 100, v * 100];
1039 };
1040 convert.hsv.rgb = function(hsv) {
1041 var h = hsv[0] / 60;
1042 var s = hsv[1] / 100;
1043 var v = hsv[2] / 100;
1044 var hi = Math.floor(h) % 6;
1045 var f = h - Math.floor(h);
1046 var p = 255 * v * (1 - s);
1047 var q = 255 * v * (1 - s * f);
1048 var t = 255 * v * (1 - s * (1 - f));
1049 v *= 255;
1050 switch (hi) {
1051 case 0:
1052 return [v, t, p];
1053 case 1:
1054 return [q, v, p];
1055 case 2:
1056 return [p, v, t];
1057 case 3:
1058 return [p, q, v];
1059 case 4:
1060 return [t, p, v];
1061 case 5:
1062 return [v, p, q];
1063 }
1064 };
1065 convert.hsv.hsl = function(hsv) {
1066 var h = hsv[0];
1067 var s = hsv[1] / 100;
1068 var v = hsv[2] / 100;
1069 var vmin = Math.max(v, 0.01);
1070 var lmin;
1071 var sl;
1072 var l;
1073 l = (2 - s) * v;
1074 lmin = (2 - s) * vmin;
1075 sl = s * vmin;
1076 sl /= lmin <= 1 ? lmin : 2 - lmin;
1077 sl = sl || 0;
1078 l /= 2;
1079 return [h, sl * 100, l * 100];
1080 };
1081 convert.hwb.rgb = function(hwb) {
1082 var h = hwb[0] / 360;
1083 var wh = hwb[1] / 100;
1084 var bl = hwb[2] / 100;
1085 var ratio = wh + bl;
1086 var i;
1087 var v;
1088 var f;
1089 var n;
1090 if (ratio > 1) {
1091 wh /= ratio;
1092 bl /= ratio;
1093 }
1094 i = Math.floor(6 * h);
1095 v = 1 - bl;
1096 f = 6 * h - i;
1097 if ((i & 1) !== 0) {
1098 f = 1 - f;
1099 }
1100 n = wh + f * (v - wh);
1101 var r;
1102 var g;
1103 var b;
1104 switch (i) {
1105 default:
1106 case 6:
1107 case 0:
1108 r = v;
1109 g = n;
1110 b = wh;
1111 break;
1112 case 1:
1113 r = n;
1114 g = v;
1115 b = wh;
1116 break;
1117 case 2:
1118 r = wh;
1119 g = v;
1120 b = n;
1121 break;
1122 case 3:
1123 r = wh;
1124 g = n;
1125 b = v;
1126 break;
1127 case 4:
1128 r = n;
1129 g = wh;
1130 b = v;
1131 break;
1132 case 5:
1133 r = v;
1134 g = wh;
1135 b = n;
1136 break;
1137 }
1138 return [r * 255, g * 255, b * 255];
1139 };
1140 convert.cmyk.rgb = function(cmyk) {
1141 var c = cmyk[0] / 100;
1142 var m = cmyk[1] / 100;
1143 var y = cmyk[2] / 100;
1144 var k = cmyk[3] / 100;
1145 var r;
1146 var g;
1147 var b;
1148 r = 1 - Math.min(1, c * (1 - k) + k);
1149 g = 1 - Math.min(1, m * (1 - k) + k);
1150 b = 1 - Math.min(1, y * (1 - k) + k);
1151 return [r * 255, g * 255, b * 255];
1152 };
1153 convert.xyz.rgb = function(xyz) {
1154 var x = xyz[0] / 100;
1155 var y = xyz[1] / 100;
1156 var z = xyz[2] / 100;
1157 var r;
1158 var g;
1159 var b;
1160 r = x * 3.2406 + y * -1.5372 + z * -0.4986;
1161 g = x * -0.9689 + y * 1.8758 + z * 0.0415;
1162 b = x * 0.0557 + y * -0.204 + z * 1.057;
1163 r = r > 31308e-7 ? 1.055 * Math.pow(r, 1 / 2.4) - 0.055 : r * 12.92;
1164 g = g > 31308e-7 ? 1.055 * Math.pow(g, 1 / 2.4) - 0.055 : g * 12.92;
1165 b = b > 31308e-7 ? 1.055 * Math.pow(b, 1 / 2.4) - 0.055 : b * 12.92;
1166 r = Math.min(Math.max(0, r), 1);
1167 g = Math.min(Math.max(0, g), 1);
1168 b = Math.min(Math.max(0, b), 1);
1169 return [r * 255, g * 255, b * 255];
1170 };
1171 convert.xyz.lab = function(xyz) {
1172 var x = xyz[0];
1173 var y = xyz[1];
1174 var z = xyz[2];
1175 var l;
1176 var a;
1177 var b;
1178 x /= 95.047;
1179 y /= 100;
1180 z /= 108.883;
1181 x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
1182 y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
1183 z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
1184 l = 116 * y - 16;
1185 a = 500 * (x - y);
1186 b = 200 * (y - z);
1187 return [l, a, b];
1188 };
1189 convert.lab.xyz = function(lab) {
1190 var l = lab[0];
1191 var a = lab[1];
1192 var b = lab[2];
1193 var x;
1194 var y;
1195 var z;
1196 y = (l + 16) / 116;
1197 x = a / 500 + y;
1198 z = y - b / 200;
1199 var y2 = Math.pow(y, 3);
1200 var x2 = Math.pow(x, 3);
1201 var z2 = Math.pow(z, 3);
1202 y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
1203 x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
1204 z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
1205 x *= 95.047;
1206 y *= 100;
1207 z *= 108.883;
1208 return [x, y, z];
1209 };
1210 convert.lab.lch = function(lab) {
1211 var l = lab[0];
1212 var a = lab[1];
1213 var b = lab[2];
1214 var hr;
1215 var h;
1216 var c;
1217 hr = Math.atan2(b, a);
1218 h = hr * 360 / 2 / Math.PI;
1219 if (h < 0) {
1220 h += 360;
1221 }
1222 c = Math.sqrt(a * a + b * b);
1223 return [l, c, h];
1224 };
1225 convert.lch.lab = function(lch) {
1226 var l = lch[0];
1227 var c = lch[1];
1228 var h = lch[2];
1229 var a;
1230 var b;
1231 var hr;
1232 hr = h / 360 * 2 * Math.PI;
1233 a = c * Math.cos(hr);
1234 b = c * Math.sin(hr);
1235 return [l, a, b];
1236 };
1237 convert.rgb.ansi16 = function(args) {
1238 var r = args[0];
1239 var g = args[1];
1240 var b = args[2];
1241 var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2];
1242 value = Math.round(value / 50);
1243 if (value === 0) {
1244 return 30;
1245 }
1246 var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
1247 if (value === 2) {
1248 ansi += 60;
1249 }
1250 return ansi;
1251 };
1252 convert.hsv.ansi16 = function(args) {
1253 return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
1254 };
1255 convert.rgb.ansi256 = function(args) {
1256 var r = args[0];
1257 var g = args[1];
1258 var b = args[2];
1259 if (r === g && g === b) {
1260 if (r < 8) {
1261 return 16;
1262 }
1263 if (r > 248) {
1264 return 231;
1265 }
1266 return Math.round((r - 8) / 247 * 24) + 232;
1267 }
1268 var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
1269 return ansi;
1270 };
1271 convert.ansi16.rgb = function(args) {
1272 var color = args % 10;
1273 if (color === 0 || color === 7) {
1274 if (args > 50) {
1275 color += 3.5;
1276 }
1277 color = color / 10.5 * 255;
1278 return [color, color, color];
1279 }
1280 var mult = (~~(args > 50) + 1) * 0.5;
1281 var r = (color & 1) * mult * 255;
1282 var g = (color >> 1 & 1) * mult * 255;
1283 var b = (color >> 2 & 1) * mult * 255;
1284 return [r, g, b];
1285 };
1286 convert.ansi256.rgb = function(args) {
1287 if (args >= 232) {
1288 var c = (args - 232) * 10 + 8;
1289 return [c, c, c];
1290 }
1291 args -= 16;
1292 var rem;
1293 var r = Math.floor(args / 36) / 5 * 255;
1294 var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
1295 var b = rem % 6 / 5 * 255;
1296 return [r, g, b];
1297 };
1298 convert.rgb.hex = function(args) {
1299 var integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
1300 var string = integer.toString(16).toUpperCase();
1301 return "000000".substring(string.length) + string;
1302 };
1303 convert.hex.rgb = function(args) {
1304 var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
1305 if (!match) {
1306 return [0, 0, 0];
1307 }
1308 var colorString = match[0];
1309 if (match[0].length === 3) {
1310 colorString = colorString.split("").map(function(char) {
1311 return char + char;
1312 }).join("");
1313 }
1314 var integer = parseInt(colorString, 16);
1315 var r = integer >> 16 & 255;
1316 var g = integer >> 8 & 255;
1317 var b = integer & 255;
1318 return [r, g, b];
1319 };
1320 convert.rgb.hcg = function(rgb) {
1321 var r = rgb[0] / 255;
1322 var g = rgb[1] / 255;
1323 var b = rgb[2] / 255;
1324 var max = Math.max(Math.max(r, g), b);
1325 var min = Math.min(Math.min(r, g), b);
1326 var chroma = max - min;
1327 var grayscale;
1328 var hue;
1329 if (chroma < 1) {
1330 grayscale = min / (1 - chroma);
1331 } else {
1332 grayscale = 0;
1333 }
1334 if (chroma <= 0) {
1335 hue = 0;
1336 } else if (max === r) {
1337 hue = (g - b) / chroma % 6;
1338 } else if (max === g) {
1339 hue = 2 + (b - r) / chroma;
1340 } else {
1341 hue = 4 + (r - g) / chroma + 4;
1342 }
1343 hue /= 6;
1344 hue %= 1;
1345 return [hue * 360, chroma * 100, grayscale * 100];
1346 };
1347 convert.hsl.hcg = function(hsl) {
1348 var s = hsl[1] / 100;
1349 var l = hsl[2] / 100;
1350 var c = 1;
1351 var f = 0;
1352 if (l < 0.5) {
1353 c = 2 * s * l;
1354 } else {
1355 c = 2 * s * (1 - l);
1356 }
1357 if (c < 1) {
1358 f = (l - 0.5 * c) / (1 - c);
1359 }
1360 return [hsl[0], c * 100, f * 100];
1361 };
1362 convert.hsv.hcg = function(hsv) {
1363 var s = hsv[1] / 100;
1364 var v = hsv[2] / 100;
1365 var c = s * v;
1366 var f = 0;
1367 if (c < 1) {
1368 f = (v - c) / (1 - c);
1369 }
1370 return [hsv[0], c * 100, f * 100];
1371 };
1372 convert.hcg.rgb = function(hcg) {
1373 var h = hcg[0] / 360;
1374 var c = hcg[1] / 100;
1375 var g = hcg[2] / 100;
1376 if (c === 0) {
1377 return [g * 255, g * 255, g * 255];
1378 }
1379 var pure = [0, 0, 0];
1380 var hi = h % 1 * 6;
1381 var v = hi % 1;
1382 var w = 1 - v;
1383 var mg = 0;
1384 switch (Math.floor(hi)) {
1385 case 0:
1386 pure[0] = 1;
1387 pure[1] = v;
1388 pure[2] = 0;
1389 break;
1390 case 1:
1391 pure[0] = w;
1392 pure[1] = 1;
1393 pure[2] = 0;
1394 break;
1395 case 2:
1396 pure[0] = 0;
1397 pure[1] = 1;
1398 pure[2] = v;
1399 break;
1400 case 3:
1401 pure[0] = 0;
1402 pure[1] = w;
1403 pure[2] = 1;
1404 break;
1405 case 4:
1406 pure[0] = v;
1407 pure[1] = 0;
1408 pure[2] = 1;
1409 break;
1410 default:
1411 pure[0] = 1;
1412 pure[1] = 0;
1413 pure[2] = w;
1414 }
1415 mg = (1 - c) * g;
1416 return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
1417 };
1418 convert.hcg.hsv = function(hcg) {
1419 var c = hcg[1] / 100;
1420 var g = hcg[2] / 100;
1421 var v = c + g * (1 - c);
1422 var f = 0;
1423 if (v > 0) {
1424 f = c / v;
1425 }
1426 return [hcg[0], f * 100, v * 100];
1427 };
1428 convert.hcg.hsl = function(hcg) {
1429 var c = hcg[1] / 100;
1430 var g = hcg[2] / 100;
1431 var l = g * (1 - c) + 0.5 * c;
1432 var s = 0;
1433 if (l > 0 && l < 0.5) {
1434 s = c / (2 * l);
1435 } else if (l >= 0.5 && l < 1) {
1436 s = c / (2 * (1 - l));
1437 }
1438 return [hcg[0], s * 100, l * 100];
1439 };
1440 convert.hcg.hwb = function(hcg) {
1441 var c = hcg[1] / 100;
1442 var g = hcg[2] / 100;
1443 var v = c + g * (1 - c);
1444 return [hcg[0], (v - c) * 100, (1 - v) * 100];
1445 };
1446 convert.hwb.hcg = function(hwb) {
1447 var w = hwb[1] / 100;
1448 var b = hwb[2] / 100;
1449 var v = 1 - b;
1450 var c = v - w;
1451 var g = 0;
1452 if (c < 1) {
1453 g = (v - c) / (1 - c);
1454 }
1455 return [hwb[0], c * 100, g * 100];
1456 };
1457 convert.apple.rgb = function(apple) {
1458 return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
1459 };
1460 convert.rgb.apple = function(rgb) {
1461 return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
1462 };
1463 convert.gray.rgb = function(args) {
1464 return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
1465 };
1466 convert.gray.hsl = convert.gray.hsv = function(args) {
1467 return [0, 0, args[0]];
1468 };
1469 convert.gray.hwb = function(gray) {
1470 return [0, 100, gray[0]];
1471 };
1472 convert.gray.cmyk = function(gray) {
1473 return [0, 0, 0, gray[0]];
1474 };
1475 convert.gray.lab = function(gray) {
1476 return [gray[0], 0, 0];
1477 };
1478 convert.gray.hex = function(gray) {
1479 var val = Math.round(gray[0] / 100 * 255) & 255;
1480 var integer = (val << 16) + (val << 8) + val;
1481 var string = integer.toString(16).toUpperCase();
1482 return "000000".substring(string.length) + string;
1483 };
1484 convert.rgb.gray = function(rgb) {
1485 var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
1486 return [val / 255 * 100];
1487 };
1488 }
1489});
1490var require_route = __commonJS({
1491 "node_modules/color-convert/route.js"(exports2, module2) {
1492 var conversions = require_conversions();
1493 function buildGraph() {
1494 var graph = {};
1495 var models = Object.keys(conversions);
1496 for (var len = models.length, i = 0; i < len; i++) {
1497 graph[models[i]] = {
1498 distance: -1,
1499 parent: null
1500 };
1501 }
1502 return graph;
1503 }
1504 function deriveBFS(fromModel) {
1505 var graph = buildGraph();
1506 var queue = [fromModel];
1507 graph[fromModel].distance = 0;
1508 while (queue.length) {
1509 var current = queue.pop();
1510 var adjacents = Object.keys(conversions[current]);
1511 for (var len = adjacents.length, i = 0; i < len; i++) {
1512 var adjacent = adjacents[i];
1513 var node = graph[adjacent];
1514 if (node.distance === -1) {
1515 node.distance = graph[current].distance + 1;
1516 node.parent = current;
1517 queue.unshift(adjacent);
1518 }
1519 }
1520 }
1521 return graph;
1522 }
1523 function link(from, to) {
1524 return function(args) {
1525 return to(from(args));
1526 };
1527 }
1528 function wrapConversion(toModel, graph) {
1529 var path = [graph[toModel].parent, toModel];
1530 var fn = conversions[graph[toModel].parent][toModel];
1531 var cur = graph[toModel].parent;
1532 while (graph[cur].parent) {
1533 path.unshift(graph[cur].parent);
1534 fn = link(conversions[graph[cur].parent][cur], fn);
1535 cur = graph[cur].parent;
1536 }
1537 fn.conversion = path;
1538 return fn;
1539 }
1540 module2.exports = function(fromModel) {
1541 var graph = deriveBFS(fromModel);
1542 var conversion = {};
1543 var models = Object.keys(graph);
1544 for (var len = models.length, i = 0; i < len; i++) {
1545 var toModel = models[i];
1546 var node = graph[toModel];
1547 if (node.parent === null) {
1548 continue;
1549 }
1550 conversion[toModel] = wrapConversion(toModel, graph);
1551 }
1552 return conversion;
1553 };
1554 }
1555});
1556var require_color_convert = __commonJS({
1557 "node_modules/color-convert/index.js"(exports2, module2) {
1558 var conversions = require_conversions();
1559 var route = require_route();
1560 var convert = {};
1561 var models = Object.keys(conversions);
1562 function wrapRaw(fn) {
1563 var wrappedFn = function(args) {
1564 if (args === void 0 || args === null) {
1565 return args;
1566 }
1567 if (arguments.length > 1) {
1568 args = Array.prototype.slice.call(arguments);
1569 }
1570 return fn(args);
1571 };
1572 if ("conversion" in fn) {
1573 wrappedFn.conversion = fn.conversion;
1574 }
1575 return wrappedFn;
1576 }
1577 function wrapRounded(fn) {
1578 var wrappedFn = function(args) {
1579 if (args === void 0 || args === null) {
1580 return args;
1581 }
1582 if (arguments.length > 1) {
1583 args = Array.prototype.slice.call(arguments);
1584 }
1585 var result = fn(args);
1586 if (typeof result === "object") {
1587 for (var len = result.length, i = 0; i < len; i++) {
1588 result[i] = Math.round(result[i]);
1589 }
1590 }
1591 return result;
1592 };
1593 if ("conversion" in fn) {
1594 wrappedFn.conversion = fn.conversion;
1595 }
1596 return wrappedFn;
1597 }
1598 models.forEach(function(fromModel) {
1599 convert[fromModel] = {};
1600 Object.defineProperty(convert[fromModel], "channels", {
1601 value: conversions[fromModel].channels
1602 });
1603 Object.defineProperty(convert[fromModel], "labels", {
1604 value: conversions[fromModel].labels
1605 });
1606 var routes = route(fromModel);
1607 var routeModels = Object.keys(routes);
1608 routeModels.forEach(function(toModel) {
1609 var fn = routes[toModel];
1610 convert[fromModel][toModel] = wrapRounded(fn);
1611 convert[fromModel][toModel].raw = wrapRaw(fn);
1612 });
1613 });
1614 module2.exports = convert;
1615 }
1616});
1617var require_ansi_styles = __commonJS({
1618 "node_modules/ansi-styles/index.js"(exports2, module2) {
1619 "use strict";
1620 var colorConvert = require_color_convert();
1621 var wrapAnsi16 = (fn, offset) => function() {
1622 const code = fn.apply(colorConvert, arguments);
1623 return `\x1B[${code + offset}m`;
1624 };
1625 var wrapAnsi256 = (fn, offset) => function() {
1626 const code = fn.apply(colorConvert, arguments);
1627 return `\x1B[${38 + offset};5;${code}m`;
1628 };
1629 var wrapAnsi16m = (fn, offset) => function() {
1630 const rgb = fn.apply(colorConvert, arguments);
1631 return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
1632 };
1633 function assembleStyles() {
1634 const codes = /* @__PURE__ */ new Map();
1635 const styles = {
1636 modifier: {
1637 reset: [0, 0],
1638 bold: [1, 22],
1639 dim: [2, 22],
1640 italic: [3, 23],
1641 underline: [4, 24],
1642 inverse: [7, 27],
1643 hidden: [8, 28],
1644 strikethrough: [9, 29]
1645 },
1646 color: {
1647 black: [30, 39],
1648 red: [31, 39],
1649 green: [32, 39],
1650 yellow: [33, 39],
1651 blue: [34, 39],
1652 magenta: [35, 39],
1653 cyan: [36, 39],
1654 white: [37, 39],
1655 gray: [90, 39],
1656 redBright: [91, 39],
1657 greenBright: [92, 39],
1658 yellowBright: [93, 39],
1659 blueBright: [94, 39],
1660 magentaBright: [95, 39],
1661 cyanBright: [96, 39],
1662 whiteBright: [97, 39]
1663 },
1664 bgColor: {
1665 bgBlack: [40, 49],
1666 bgRed: [41, 49],
1667 bgGreen: [42, 49],
1668 bgYellow: [43, 49],
1669 bgBlue: [44, 49],
1670 bgMagenta: [45, 49],
1671 bgCyan: [46, 49],
1672 bgWhite: [47, 49],
1673 bgBlackBright: [100, 49],
1674 bgRedBright: [101, 49],
1675 bgGreenBright: [102, 49],
1676 bgYellowBright: [103, 49],
1677 bgBlueBright: [104, 49],
1678 bgMagentaBright: [105, 49],
1679 bgCyanBright: [106, 49],
1680 bgWhiteBright: [107, 49]
1681 }
1682 };
1683 styles.color.grey = styles.color.gray;
1684 for (const groupName of Object.keys(styles)) {
1685 const group = styles[groupName];
1686 for (const styleName of Object.keys(group)) {
1687 const style = group[styleName];
1688 styles[styleName] = {
1689 open: `\x1B[${style[0]}m`,
1690 close: `\x1B[${style[1]}m`
1691 };
1692 group[styleName] = styles[styleName];
1693 codes.set(style[0], style[1]);
1694 }
1695 Object.defineProperty(styles, groupName, {
1696 value: group,
1697 enumerable: false
1698 });
1699 Object.defineProperty(styles, "codes", {
1700 value: codes,
1701 enumerable: false
1702 });
1703 }
1704 const ansi2ansi = (n) => n;
1705 const rgb2rgb = (r, g, b) => [r, g, b];
1706 styles.color.close = "\x1B[39m";
1707 styles.bgColor.close = "\x1B[49m";
1708 styles.color.ansi = {
1709 ansi: wrapAnsi16(ansi2ansi, 0)
1710 };
1711 styles.color.ansi256 = {
1712 ansi256: wrapAnsi256(ansi2ansi, 0)
1713 };
1714 styles.color.ansi16m = {
1715 rgb: wrapAnsi16m(rgb2rgb, 0)
1716 };
1717 styles.bgColor.ansi = {
1718 ansi: wrapAnsi16(ansi2ansi, 10)
1719 };
1720 styles.bgColor.ansi256 = {
1721 ansi256: wrapAnsi256(ansi2ansi, 10)
1722 };
1723 styles.bgColor.ansi16m = {
1724 rgb: wrapAnsi16m(rgb2rgb, 10)
1725 };
1726 for (let key of Object.keys(colorConvert)) {
1727 if (typeof colorConvert[key] !== "object") {
1728 continue;
1729 }
1730 const suite = colorConvert[key];
1731 if (key === "ansi16") {
1732 key = "ansi";
1733 }
1734 if ("ansi16" in suite) {
1735 styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
1736 styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
1737 }
1738 if ("ansi256" in suite) {
1739 styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
1740 styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
1741 }
1742 if ("rgb" in suite) {
1743 styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
1744 styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
1745 }
1746 }
1747 return styles;
1748 }
1749 Object.defineProperty(module2, "exports", {
1750 enumerable: true,
1751 get: assembleStyles
1752 });
1753 }
1754});
1755var require_has_flag = __commonJS({
1756 "node_modules/@babel/highlight/node_modules/has-flag/index.js"(exports2, module2) {
1757 "use strict";
1758 module2.exports = (flag, argv) => {
1759 argv = argv || process.argv;
1760 const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
1761 const pos = argv.indexOf(prefix + flag);
1762 const terminatorPos = argv.indexOf("--");
1763 return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
1764 };
1765 }
1766});
1767var require_supports_color = __commonJS({
1768 "node_modules/@babel/highlight/node_modules/supports-color/index.js"(exports2, module2) {
1769 "use strict";
1770 var os = require("os");
1771 var hasFlag = require_has_flag();
1772 var env = process.env;
1773 var forceColor;
1774 if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
1775 forceColor = false;
1776 } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
1777 forceColor = true;
1778 }
1779 if ("FORCE_COLOR" in env) {
1780 forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
1781 }
1782 function translateLevel(level) {
1783 if (level === 0) {
1784 return false;
1785 }
1786 return {
1787 level,
1788 hasBasic: true,
1789 has256: level >= 2,
1790 has16m: level >= 3
1791 };
1792 }
1793 function supportsColor(stream) {
1794 if (forceColor === false) {
1795 return 0;
1796 }
1797 if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
1798 return 3;
1799 }
1800 if (hasFlag("color=256")) {
1801 return 2;
1802 }
1803 if (stream && !stream.isTTY && forceColor !== true) {
1804 return 0;
1805 }
1806 const min = forceColor ? 1 : 0;
1807 if (process.platform === "win32") {
1808 const osRelease = os.release().split(".");
1809 if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
1810 return Number(osRelease[2]) >= 14931 ? 3 : 2;
1811 }
1812 return 1;
1813 }
1814 if ("CI" in env) {
1815 if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
1816 return 1;
1817 }
1818 return min;
1819 }
1820 if ("TEAMCITY_VERSION" in env) {
1821 return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
1822 }
1823 if (env.COLORTERM === "truecolor") {
1824 return 3;
1825 }
1826 if ("TERM_PROGRAM" in env) {
1827 const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
1828 switch (env.TERM_PROGRAM) {
1829 case "iTerm.app":
1830 return version >= 3 ? 3 : 2;
1831 case "Apple_Terminal":
1832 return 2;
1833 }
1834 }
1835 if (/-256(color)?$/i.test(env.TERM)) {
1836 return 2;
1837 }
1838 if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
1839 return 1;
1840 }
1841 if ("COLORTERM" in env) {
1842 return 1;
1843 }
1844 if (env.TERM === "dumb") {
1845 return min;
1846 }
1847 return min;
1848 }
1849 function getSupportLevel(stream) {
1850 const level = supportsColor(stream);
1851 return translateLevel(level);
1852 }
1853 module2.exports = {
1854 supportsColor: getSupportLevel,
1855 stdout: getSupportLevel(process.stdout),
1856 stderr: getSupportLevel(process.stderr)
1857 };
1858 }
1859});
1860var require_templates = __commonJS({
1861 "node_modules/@babel/highlight/node_modules/chalk/templates.js"(exports2, module2) {
1862 "use strict";
1863 var TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
1864 var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
1865 var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
1866 var ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
1867 var ESCAPES = /* @__PURE__ */ new Map([["n", "\n"], ["r", "\r"], ["t", " "], ["b", "\b"], ["f", "\f"], ["v", "\v"], ["0", "\0"], ["\\", "\\"], ["e", "\x1B"], ["a", "\x07"]]);
1868 function unescape(c) {
1869 if (c[0] === "u" && c.length === 5 || c[0] === "x" && c.length === 3) {
1870 return String.fromCharCode(parseInt(c.slice(1), 16));
1871 }
1872 return ESCAPES.get(c) || c;
1873 }
1874 function parseArguments(name, args) {
1875 const results = [];
1876 const chunks = args.trim().split(/\s*,\s*/g);
1877 let matches;
1878 for (const chunk of chunks) {
1879 if (!isNaN(chunk)) {
1880 results.push(Number(chunk));
1881 } else if (matches = chunk.match(STRING_REGEX)) {
1882 results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
1883 } else {
1884 throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
1885 }
1886 }
1887 return results;
1888 }
1889 function parseStyle(style) {
1890 STYLE_REGEX.lastIndex = 0;
1891 const results = [];
1892 let matches;
1893 while ((matches = STYLE_REGEX.exec(style)) !== null) {
1894 const name = matches[1];
1895 if (matches[2]) {
1896 const args = parseArguments(name, matches[2]);
1897 results.push([name].concat(args));
1898 } else {
1899 results.push([name]);
1900 }
1901 }
1902 return results;
1903 }
1904 function buildStyle(chalk, styles) {
1905 const enabled = {};
1906 for (const layer of styles) {
1907 for (const style of layer.styles) {
1908 enabled[style[0]] = layer.inverse ? null : style.slice(1);
1909 }
1910 }
1911 let current = chalk;
1912 for (const styleName of Object.keys(enabled)) {
1913 if (Array.isArray(enabled[styleName])) {
1914 if (!(styleName in current)) {
1915 throw new Error(`Unknown Chalk style: ${styleName}`);
1916 }
1917 if (enabled[styleName].length > 0) {
1918 current = current[styleName].apply(current, enabled[styleName]);
1919 } else {
1920 current = current[styleName];
1921 }
1922 }
1923 }
1924 return current;
1925 }
1926 module2.exports = (chalk, tmp) => {
1927 const styles = [];
1928 const chunks = [];
1929 let chunk = [];
1930 tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
1931 if (escapeChar) {
1932 chunk.push(unescape(escapeChar));
1933 } else if (style) {
1934 const str = chunk.join("");
1935 chunk = [];
1936 chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
1937 styles.push({
1938 inverse,
1939 styles: parseStyle(style)
1940 });
1941 } else if (close) {
1942 if (styles.length === 0) {
1943 throw new Error("Found extraneous } in Chalk template literal");
1944 }
1945 chunks.push(buildStyle(chalk, styles)(chunk.join("")));
1946 chunk = [];
1947 styles.pop();
1948 } else {
1949 chunk.push(chr);
1950 }
1951 });
1952 chunks.push(chunk.join(""));
1953 if (styles.length > 0) {
1954 const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
1955 throw new Error(errMsg);
1956 }
1957 return chunks.join("");
1958 };
1959 }
1960});
1961var require_chalk = __commonJS({
1962 "node_modules/@babel/highlight/node_modules/chalk/index.js"(exports2, module2) {
1963 "use strict";
1964 var escapeStringRegexp = require_escape_string_regexp();
1965 var ansiStyles = require_ansi_styles();
1966 var stdoutColor = require_supports_color().stdout;
1967 var template = require_templates();
1968 var isSimpleWindowsTerm = process.platform === "win32" && !(process.env.TERM || "").toLowerCase().startsWith("xterm");
1969 var levelMapping = ["ansi", "ansi", "ansi256", "ansi16m"];
1970 var skipModels = /* @__PURE__ */ new Set(["gray"]);
1971 var styles = /* @__PURE__ */ Object.create(null);
1972 function applyOptions(obj, options) {
1973 options = options || {};
1974 const scLevel = stdoutColor ? stdoutColor.level : 0;
1975 obj.level = options.level === void 0 ? scLevel : options.level;
1976 obj.enabled = "enabled" in options ? options.enabled : obj.level > 0;
1977 }
1978 function Chalk(options) {
1979 if (!this || !(this instanceof Chalk) || this.template) {
1980 const chalk = {};
1981 applyOptions(chalk, options);
1982 chalk.template = function() {
1983 const args = [].slice.call(arguments);
1984 return chalkTag.apply(null, [chalk.template].concat(args));
1985 };
1986 Object.setPrototypeOf(chalk, Chalk.prototype);
1987 Object.setPrototypeOf(chalk.template, chalk);
1988 chalk.template.constructor = Chalk;
1989 return chalk.template;
1990 }
1991 applyOptions(this, options);
1992 }
1993 if (isSimpleWindowsTerm) {
1994 ansiStyles.blue.open = "\x1B[94m";
1995 }
1996 for (const key of Object.keys(ansiStyles)) {
1997 ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), "g");
1998 styles[key] = {
1999 get() {
2000 const codes = ansiStyles[key];
2001 return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
2002 }
2003 };
2004 }
2005 styles.visible = {
2006 get() {
2007 return build.call(this, this._styles || [], true, "visible");
2008 }
2009 };
2010 ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), "g");
2011 for (const model of Object.keys(ansiStyles.color.ansi)) {
2012 if (skipModels.has(model)) {
2013 continue;
2014 }
2015 styles[model] = {
2016 get() {
2017 const level = this.level;
2018 return function() {
2019 const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
2020 const codes = {
2021 open,
2022 close: ansiStyles.color.close,
2023 closeRe: ansiStyles.color.closeRe
2024 };
2025 return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
2026 };
2027 }
2028 };
2029 }
2030 ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), "g");
2031 for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
2032 if (skipModels.has(model)) {
2033 continue;
2034 }
2035 const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
2036 styles[bgModel] = {
2037 get() {
2038 const level = this.level;
2039 return function() {
2040 const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
2041 const codes = {
2042 open,
2043 close: ansiStyles.bgColor.close,
2044 closeRe: ansiStyles.bgColor.closeRe
2045 };
2046 return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
2047 };
2048 }
2049 };
2050 }
2051 var proto = Object.defineProperties(() => {
2052 }, styles);
2053 function build(_styles, _empty, key) {
2054 const builder = function() {
2055 return applyStyle.apply(builder, arguments);
2056 };
2057 builder._styles = _styles;
2058 builder._empty = _empty;
2059 const self = this;
2060 Object.defineProperty(builder, "level", {
2061 enumerable: true,
2062 get() {
2063 return self.level;
2064 },
2065 set(level) {
2066 self.level = level;
2067 }
2068 });
2069 Object.defineProperty(builder, "enabled", {
2070 enumerable: true,
2071 get() {
2072 return self.enabled;
2073 },
2074 set(enabled) {
2075 self.enabled = enabled;
2076 }
2077 });
2078 builder.hasGrey = this.hasGrey || key === "gray" || key === "grey";
2079 builder.__proto__ = proto;
2080 return builder;
2081 }
2082 function applyStyle() {
2083 const args = arguments;
2084 const argsLen = args.length;
2085 let str = String(arguments[0]);
2086 if (argsLen === 0) {
2087 return "";
2088 }
2089 if (argsLen > 1) {
2090 for (let a = 1; a < argsLen; a++) {
2091 str += " " + args[a];
2092 }
2093 }
2094 if (!this.enabled || this.level <= 0 || !str) {
2095 return this._empty ? "" : str;
2096 }
2097 const originalDim = ansiStyles.dim.open;
2098 if (isSimpleWindowsTerm && this.hasGrey) {
2099 ansiStyles.dim.open = "";
2100 }
2101 for (const code of this._styles.slice().reverse()) {
2102 str = code.open + str.replace(code.closeRe, code.open) + code.close;
2103 str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
2104 }
2105 ansiStyles.dim.open = originalDim;
2106 return str;
2107 }
2108 function chalkTag(chalk, strings) {
2109 if (!Array.isArray(strings)) {
2110 return [].slice.call(arguments, 1).join(" ");
2111 }
2112 const args = [].slice.call(arguments, 2);
2113 const parts = [strings.raw[0]];
2114 for (let i = 1; i < strings.length; i++) {
2115 parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
2116 parts.push(String(strings.raw[i]));
2117 }
2118 return template(chalk, parts.join(""));
2119 }
2120 Object.defineProperties(Chalk.prototype, styles);
2121 module2.exports = Chalk();
2122 module2.exports.supportsColor = stdoutColor;
2123 module2.exports.default = module2.exports;
2124 }
2125});
2126var require_lib2 = __commonJS({
2127 "node_modules/@babel/highlight/lib/index.js"(exports2) {
2128 "use strict";
2129 Object.defineProperty(exports2, "__esModule", {
2130 value: true
2131 });
2132 exports2.default = highlight;
2133 exports2.getChalk = getChalk;
2134 exports2.shouldHighlight = shouldHighlight;
2135 var _jsTokens = require_js_tokens();
2136 var _helperValidatorIdentifier = require_lib();
2137 var _chalk = require_chalk();
2138 var sometimesKeywords = /* @__PURE__ */ new Set(["as", "async", "from", "get", "of", "set"]);
2139 function getDefs(chalk) {
2140 return {
2141 keyword: chalk.cyan,
2142 capitalized: chalk.yellow,
2143 jsxIdentifier: chalk.yellow,
2144 punctuator: chalk.yellow,
2145 number: chalk.magenta,
2146 string: chalk.green,
2147 regex: chalk.magenta,
2148 comment: chalk.grey,
2149 invalid: chalk.white.bgRed.bold
2150 };
2151 }
2152 var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
2153 var BRACKET = /^[()[\]{}]$/;
2154 var tokenize;
2155 {
2156 const JSX_TAG = /^[a-z][\w-]*$/i;
2157 const getTokenType = function(token, offset, text) {
2158 if (token.type === "name") {
2159 if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
2160 return "keyword";
2161 }
2162 if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) == "</")) {
2163 return "jsxIdentifier";
2164 }
2165 if (token.value[0] !== token.value[0].toLowerCase()) {
2166 return "capitalized";
2167 }
2168 }
2169 if (token.type === "punctuator" && BRACKET.test(token.value)) {
2170 return "bracket";
2171 }
2172 if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
2173 return "punctuator";
2174 }
2175 return token.type;
2176 };
2177 tokenize = function* (text) {
2178 let match;
2179 while (match = _jsTokens.default.exec(text)) {
2180 const token = _jsTokens.matchToToken(match);
2181 yield {
2182 type: getTokenType(token, match.index, text),
2183 value: token.value
2184 };
2185 }
2186 };
2187 }
2188 function highlightTokens(defs, text) {
2189 let highlighted = "";
2190 for (const {
2191 type,
2192 value
2193 } of tokenize(text)) {
2194 const colorize = defs[type];
2195 if (colorize) {
2196 highlighted += value.split(NEWLINE).map((str) => colorize(str)).join("\n");
2197 } else {
2198 highlighted += value;
2199 }
2200 }
2201 return highlighted;
2202 }
2203 function shouldHighlight(options) {
2204 return !!_chalk.supportsColor || options.forceColor;
2205 }
2206 function getChalk(options) {
2207 return options.forceColor ? new _chalk.constructor({
2208 enabled: true,
2209 level: 1
2210 }) : _chalk;
2211 }
2212 function highlight(code, options = {}) {
2213 if (code !== "" && shouldHighlight(options)) {
2214 const chalk = getChalk(options);
2215 const defs = getDefs(chalk);
2216 return highlightTokens(defs, code);
2217 } else {
2218 return code;
2219 }
2220 }
2221 }
2222});
2223var require_lib3 = __commonJS({
2224 "node_modules/@babel/code-frame/lib/index.js"(exports2) {
2225 "use strict";
2226 Object.defineProperty(exports2, "__esModule", {
2227 value: true
2228 });
2229 exports2.codeFrameColumns = codeFrameColumns;
2230 exports2.default = _default;
2231 var _highlight = require_lib2();
2232 var deprecationWarningShown = false;
2233 function getDefs(chalk) {
2234 return {
2235 gutter: chalk.grey,
2236 marker: chalk.red.bold,
2237 message: chalk.red.bold
2238 };
2239 }
2240 var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
2241 function getMarkerLines(loc, source, opts) {
2242 const startLoc = Object.assign({
2243 column: 0,
2244 line: -1
2245 }, loc.start);
2246 const endLoc = Object.assign({}, startLoc, loc.end);
2247 const {
2248 linesAbove = 2,
2249 linesBelow = 3
2250 } = opts || {};
2251 const startLine = startLoc.line;
2252 const startColumn = startLoc.column;
2253 const endLine = endLoc.line;
2254 const endColumn = endLoc.column;
2255 let start = Math.max(startLine - (linesAbove + 1), 0);
2256 let end = Math.min(source.length, endLine + linesBelow);
2257 if (startLine === -1) {
2258 start = 0;
2259 }
2260 if (endLine === -1) {
2261 end = source.length;
2262 }
2263 const lineDiff = endLine - startLine;
2264 const markerLines = {};
2265 if (lineDiff) {
2266 for (let i = 0; i <= lineDiff; i++) {
2267 const lineNumber = i + startLine;
2268 if (!startColumn) {
2269 markerLines[lineNumber] = true;
2270 } else if (i === 0) {
2271 const sourceLength = source[lineNumber - 1].length;
2272 markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
2273 } else if (i === lineDiff) {
2274 markerLines[lineNumber] = [0, endColumn];
2275 } else {
2276 const sourceLength = source[lineNumber - i].length;
2277 markerLines[lineNumber] = [0, sourceLength];
2278 }
2279 }
2280 } else {
2281 if (startColumn === endColumn) {
2282 if (startColumn) {
2283 markerLines[startLine] = [startColumn, 0];
2284 } else {
2285 markerLines[startLine] = true;
2286 }
2287 } else {
2288 markerLines[startLine] = [startColumn, endColumn - startColumn];
2289 }
2290 }
2291 return {
2292 start,
2293 end,
2294 markerLines
2295 };
2296 }
2297 function codeFrameColumns(rawLines, loc, opts = {}) {
2298 const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
2299 const chalk = (0, _highlight.getChalk)(opts);
2300 const defs = getDefs(chalk);
2301 const maybeHighlight = (chalkFn, string) => {
2302 return highlighted ? chalkFn(string) : string;
2303 };
2304 const lines = rawLines.split(NEWLINE);
2305 const {
2306 start,
2307 end,
2308 markerLines
2309 } = getMarkerLines(loc, lines, opts);
2310 const hasColumns = loc.start && typeof loc.start.column === "number";
2311 const numberMaxWidth = String(end).length;
2312 const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
2313 let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
2314 const number = start + 1 + index;
2315 const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
2316 const gutter = ` ${paddedNumber} |`;
2317 const hasMarker = markerLines[number];
2318 const lastMarkerLine = !markerLines[number + 1];
2319 if (hasMarker) {
2320 let markerLine = "";
2321 if (Array.isArray(hasMarker)) {
2322 const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
2323 const numberOfMarkers = hasMarker[1] || 1;
2324 markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
2325 if (lastMarkerLine && opts.message) {
2326 markerLine += " " + maybeHighlight(defs.message, opts.message);
2327 }
2328 }
2329 return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
2330 } else {
2331 return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`;
2332 }
2333 }).join("\n");
2334 if (opts.message && !hasColumns) {
2335 frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}
2336${frame}`;
2337 }
2338 if (highlighted) {
2339 return chalk.reset(frame);
2340 } else {
2341 return frame;
2342 }
2343 }
2344 function _default(rawLines, lineNumber, colNumber, opts = {}) {
2345 if (!deprecationWarningShown) {
2346 deprecationWarningShown = true;
2347 const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
2348 if (process.emitWarning) {
2349 process.emitWarning(message, "DeprecationWarning");
2350 } else {
2351 const deprecationError = new Error(message);
2352 deprecationError.name = "DeprecationWarning";
2353 console.warn(new Error(message));
2354 }
2355 }
2356 colNumber = Math.max(colNumber, 0);
2357 const location = {
2358 start: {
2359 column: colNumber,
2360 line: lineNumber
2361 }
2362 };
2363 return codeFrameColumns(rawLines, location, opts);
2364 }
2365 }
2366});
2367var require_parse_json = __commonJS({
2368 "node_modules/parse-json/index.js"(exports2, module2) {
2369 "use strict";
2370 var errorEx = require_error_ex();
2371 var fallback = require_json_parse_even_better_errors();
2372 var {
2373 default: LinesAndColumns
2374 } = require_build();
2375 var {
2376 codeFrameColumns
2377 } = require_lib3();
2378 var JSONError = errorEx("JSONError", {
2379 fileName: errorEx.append("in %s"),
2380 codeFrame: errorEx.append("\n\n%s\n")
2381 });
2382 var parseJson = (string, reviver, filename) => {
2383 if (typeof reviver === "string") {
2384 filename = reviver;
2385 reviver = null;
2386 }
2387 try {
2388 try {
2389 return JSON.parse(string, reviver);
2390 } catch (error) {
2391 fallback(string, reviver);
2392 throw error;
2393 }
2394 } catch (error) {
2395 error.message = error.message.replace(/\n/g, "");
2396 const indexMatch = error.message.match(/in JSON at position (\d+) while parsing/);
2397 const jsonError = new JSONError(error);
2398 if (filename) {
2399 jsonError.fileName = filename;
2400 }
2401 if (indexMatch && indexMatch.length > 0) {
2402 const lines = new LinesAndColumns(string);
2403 const index = Number(indexMatch[1]);
2404 const location = lines.locationForIndex(index);
2405 const codeFrame = codeFrameColumns(string, {
2406 start: {
2407 line: location.line + 1,
2408 column: location.column + 1
2409 }
2410 }, {
2411 highlightCode: true
2412 });
2413 jsonError.codeFrame = codeFrame;
2414 }
2415 throw jsonError;
2416 }
2417 };
2418 parseJson.JSONError = JSONError;
2419 module2.exports = parseJson;
2420 }
2421});
2422var require_PlainValue_ec8e588e = __commonJS({
2423 "node_modules/yaml/dist/PlainValue-ec8e588e.js"(exports2) {
2424 "use strict";
2425 var Char = {
2426 ANCHOR: "&",
2427 COMMENT: "#",
2428 TAG: "!",
2429 DIRECTIVES_END: "-",
2430 DOCUMENT_END: "."
2431 };
2432 var Type = {
2433 ALIAS: "ALIAS",
2434 BLANK_LINE: "BLANK_LINE",
2435 BLOCK_FOLDED: "BLOCK_FOLDED",
2436 BLOCK_LITERAL: "BLOCK_LITERAL",
2437 COMMENT: "COMMENT",
2438 DIRECTIVE: "DIRECTIVE",
2439 DOCUMENT: "DOCUMENT",
2440 FLOW_MAP: "FLOW_MAP",
2441 FLOW_SEQ: "FLOW_SEQ",
2442 MAP: "MAP",
2443 MAP_KEY: "MAP_KEY",
2444 MAP_VALUE: "MAP_VALUE",
2445 PLAIN: "PLAIN",
2446 QUOTE_DOUBLE: "QUOTE_DOUBLE",
2447 QUOTE_SINGLE: "QUOTE_SINGLE",
2448 SEQ: "SEQ",
2449 SEQ_ITEM: "SEQ_ITEM"
2450 };
2451 var defaultTagPrefix = "tag:yaml.org,2002:";
2452 var defaultTags = {
2453 MAP: "tag:yaml.org,2002:map",
2454 SEQ: "tag:yaml.org,2002:seq",
2455 STR: "tag:yaml.org,2002:str"
2456 };
2457 function findLineStarts(src) {
2458 const ls = [0];
2459 let offset = src.indexOf("\n");
2460 while (offset !== -1) {
2461 offset += 1;
2462 ls.push(offset);
2463 offset = src.indexOf("\n", offset);
2464 }
2465 return ls;
2466 }
2467 function getSrcInfo(cst) {
2468 let lineStarts, src;
2469 if (typeof cst === "string") {
2470 lineStarts = findLineStarts(cst);
2471 src = cst;
2472 } else {
2473 if (Array.isArray(cst))
2474 cst = cst[0];
2475 if (cst && cst.context) {
2476 if (!cst.lineStarts)
2477 cst.lineStarts = findLineStarts(cst.context.src);
2478 lineStarts = cst.lineStarts;
2479 src = cst.context.src;
2480 }
2481 }
2482 return {
2483 lineStarts,
2484 src
2485 };
2486 }
2487 function getLinePos(offset, cst) {
2488 if (typeof offset !== "number" || offset < 0)
2489 return null;
2490 const {
2491 lineStarts,
2492 src
2493 } = getSrcInfo(cst);
2494 if (!lineStarts || !src || offset > src.length)
2495 return null;
2496 for (let i = 0; i < lineStarts.length; ++i) {
2497 const start = lineStarts[i];
2498 if (offset < start) {
2499 return {
2500 line: i,
2501 col: offset - lineStarts[i - 1] + 1
2502 };
2503 }
2504 if (offset === start)
2505 return {
2506 line: i + 1,
2507 col: 1
2508 };
2509 }
2510 const line = lineStarts.length;
2511 return {
2512 line,
2513 col: offset - lineStarts[line - 1] + 1
2514 };
2515 }
2516 function getLine(line, cst) {
2517 const {
2518 lineStarts,
2519 src
2520 } = getSrcInfo(cst);
2521 if (!lineStarts || !(line >= 1) || line > lineStarts.length)
2522 return null;
2523 const start = lineStarts[line - 1];
2524 let end = lineStarts[line];
2525 while (end && end > start && src[end - 1] === "\n")
2526 --end;
2527 return src.slice(start, end);
2528 }
2529 function getPrettyContext({
2530 start,
2531 end
2532 }, cst, maxWidth = 80) {
2533 let src = getLine(start.line, cst);
2534 if (!src)
2535 return null;
2536 let {
2537 col
2538 } = start;
2539 if (src.length > maxWidth) {
2540 if (col <= maxWidth - 10) {
2541 src = src.substr(0, maxWidth - 1) + "\u2026";
2542 } else {
2543 const halfWidth = Math.round(maxWidth / 2);
2544 if (src.length > col + halfWidth)
2545 src = src.substr(0, col + halfWidth - 1) + "\u2026";
2546 col -= src.length - maxWidth;
2547 src = "\u2026" + src.substr(1 - maxWidth);
2548 }
2549 }
2550 let errLen = 1;
2551 let errEnd = "";
2552 if (end) {
2553 if (end.line === start.line && col + (end.col - start.col) <= maxWidth + 1) {
2554 errLen = end.col - start.col;
2555 } else {
2556 errLen = Math.min(src.length + 1, maxWidth) - col;
2557 errEnd = "\u2026";
2558 }
2559 }
2560 const offset = col > 1 ? " ".repeat(col - 1) : "";
2561 const err = "^".repeat(errLen);
2562 return `${src}
2563${offset}${err}${errEnd}`;
2564 }
2565 var Range = class {
2566 static copy(orig) {
2567 return new Range(orig.start, orig.end);
2568 }
2569 constructor(start, end) {
2570 this.start = start;
2571 this.end = end || start;
2572 }
2573 isEmpty() {
2574 return typeof this.start !== "number" || !this.end || this.end <= this.start;
2575 }
2576 setOrigRange(cr, offset) {
2577 const {
2578 start,
2579 end
2580 } = this;
2581 if (cr.length === 0 || end <= cr[0]) {
2582 this.origStart = start;
2583 this.origEnd = end;
2584 return offset;
2585 }
2586 let i = offset;
2587 while (i < cr.length) {
2588 if (cr[i] > start)
2589 break;
2590 else
2591 ++i;
2592 }
2593 this.origStart = start + i;
2594 const nextOffset = i;
2595 while (i < cr.length) {
2596 if (cr[i] >= end)
2597 break;
2598 else
2599 ++i;
2600 }
2601 this.origEnd = end + i;
2602 return nextOffset;
2603 }
2604 };
2605 var Node = class {
2606 static addStringTerminator(src, offset, str) {
2607 if (str[str.length - 1] === "\n")
2608 return str;
2609 const next = Node.endOfWhiteSpace(src, offset);
2610 return next >= src.length || src[next] === "\n" ? str + "\n" : str;
2611 }
2612 static atDocumentBoundary(src, offset, sep) {
2613 const ch0 = src[offset];
2614 if (!ch0)
2615 return true;
2616 const prev = src[offset - 1];
2617 if (prev && prev !== "\n")
2618 return false;
2619 if (sep) {
2620 if (ch0 !== sep)
2621 return false;
2622 } else {
2623 if (ch0 !== Char.DIRECTIVES_END && ch0 !== Char.DOCUMENT_END)
2624 return false;
2625 }
2626 const ch1 = src[offset + 1];
2627 const ch2 = src[offset + 2];
2628 if (ch1 !== ch0 || ch2 !== ch0)
2629 return false;
2630 const ch3 = src[offset + 3];
2631 return !ch3 || ch3 === "\n" || ch3 === " " || ch3 === " ";
2632 }
2633 static endOfIdentifier(src, offset) {
2634 let ch = src[offset];
2635 const isVerbatim = ch === "<";
2636 const notOk = isVerbatim ? ["\n", " ", " ", ">"] : ["\n", " ", " ", "[", "]", "{", "}", ","];
2637 while (ch && notOk.indexOf(ch) === -1)
2638 ch = src[offset += 1];
2639 if (isVerbatim && ch === ">")
2640 offset += 1;
2641 return offset;
2642 }
2643 static endOfIndent(src, offset) {
2644 let ch = src[offset];
2645 while (ch === " ")
2646 ch = src[offset += 1];
2647 return offset;
2648 }
2649 static endOfLine(src, offset) {
2650 let ch = src[offset];
2651 while (ch && ch !== "\n")
2652 ch = src[offset += 1];
2653 return offset;
2654 }
2655 static endOfWhiteSpace(src, offset) {
2656 let ch = src[offset];
2657 while (ch === " " || ch === " ")
2658 ch = src[offset += 1];
2659 return offset;
2660 }
2661 static startOfLine(src, offset) {
2662 let ch = src[offset - 1];
2663 if (ch === "\n")
2664 return offset;
2665 while (ch && ch !== "\n")
2666 ch = src[offset -= 1];
2667 return offset + 1;
2668 }
2669 static endOfBlockIndent(src, indent, lineStart) {
2670 const inEnd = Node.endOfIndent(src, lineStart);
2671 if (inEnd > lineStart + indent) {
2672 return inEnd;
2673 } else {
2674 const wsEnd = Node.endOfWhiteSpace(src, inEnd);
2675 const ch = src[wsEnd];
2676 if (!ch || ch === "\n")
2677 return wsEnd;
2678 }
2679 return null;
2680 }
2681 static atBlank(src, offset, endAsBlank) {
2682 const ch = src[offset];
2683 return ch === "\n" || ch === " " || ch === " " || endAsBlank && !ch;
2684 }
2685 static nextNodeIsIndented(ch, indentDiff, indicatorAsIndent) {
2686 if (!ch || indentDiff < 0)
2687 return false;
2688 if (indentDiff > 0)
2689 return true;
2690 return indicatorAsIndent && ch === "-";
2691 }
2692 static normalizeOffset(src, offset) {
2693 const ch = src[offset];
2694 return !ch ? offset : ch !== "\n" && src[offset - 1] === "\n" ? offset - 1 : Node.endOfWhiteSpace(src, offset);
2695 }
2696 static foldNewline(src, offset, indent) {
2697 let inCount = 0;
2698 let error = false;
2699 let fold = "";
2700 let ch = src[offset + 1];
2701 while (ch === " " || ch === " " || ch === "\n") {
2702 switch (ch) {
2703 case "\n":
2704 inCount = 0;
2705 offset += 1;
2706 fold += "\n";
2707 break;
2708 case " ":
2709 if (inCount <= indent)
2710 error = true;
2711 offset = Node.endOfWhiteSpace(src, offset + 2) - 1;
2712 break;
2713 case " ":
2714 inCount += 1;
2715 offset += 1;
2716 break;
2717 }
2718 ch = src[offset + 1];
2719 }
2720 if (!fold)
2721 fold = " ";
2722 if (ch && inCount <= indent)
2723 error = true;
2724 return {
2725 fold,
2726 offset,
2727 error
2728 };
2729 }
2730 constructor(type, props, context) {
2731 Object.defineProperty(this, "context", {
2732 value: context || null,
2733 writable: true
2734 });
2735 this.error = null;
2736 this.range = null;
2737 this.valueRange = null;
2738 this.props = props || [];
2739 this.type = type;
2740 this.value = null;
2741 }
2742 getPropValue(idx, key, skipKey) {
2743 if (!this.context)
2744 return null;
2745 const {
2746 src
2747 } = this.context;
2748 const prop = this.props[idx];
2749 return prop && src[prop.start] === key ? src.slice(prop.start + (skipKey ? 1 : 0), prop.end) : null;
2750 }
2751 get anchor() {
2752 for (let i = 0; i < this.props.length; ++i) {
2753 const anchor = this.getPropValue(i, Char.ANCHOR, true);
2754 if (anchor != null)
2755 return anchor;
2756 }
2757 return null;
2758 }
2759 get comment() {
2760 const comments = [];
2761 for (let i = 0; i < this.props.length; ++i) {
2762 const comment = this.getPropValue(i, Char.COMMENT, true);
2763 if (comment != null)
2764 comments.push(comment);
2765 }
2766 return comments.length > 0 ? comments.join("\n") : null;
2767 }
2768 commentHasRequiredWhitespace(start) {
2769 const {
2770 src
2771 } = this.context;
2772 if (this.header && start === this.header.end)
2773 return false;
2774 if (!this.valueRange)
2775 return false;
2776 const {
2777 end
2778 } = this.valueRange;
2779 return start !== end || Node.atBlank(src, end - 1);
2780 }
2781 get hasComment() {
2782 if (this.context) {
2783 const {
2784 src
2785 } = this.context;
2786 for (let i = 0; i < this.props.length; ++i) {
2787 if (src[this.props[i].start] === Char.COMMENT)
2788 return true;
2789 }
2790 }
2791 return false;
2792 }
2793 get hasProps() {
2794 if (this.context) {
2795 const {
2796 src
2797 } = this.context;
2798 for (let i = 0; i < this.props.length; ++i) {
2799 if (src[this.props[i].start] !== Char.COMMENT)
2800 return true;
2801 }
2802 }
2803 return false;
2804 }
2805 get includesTrailingLines() {
2806 return false;
2807 }
2808 get jsonLike() {
2809 const jsonLikeTypes = [Type.FLOW_MAP, Type.FLOW_SEQ, Type.QUOTE_DOUBLE, Type.QUOTE_SINGLE];
2810 return jsonLikeTypes.indexOf(this.type) !== -1;
2811 }
2812 get rangeAsLinePos() {
2813 if (!this.range || !this.context)
2814 return void 0;
2815 const start = getLinePos(this.range.start, this.context.root);
2816 if (!start)
2817 return void 0;
2818 const end = getLinePos(this.range.end, this.context.root);
2819 return {
2820 start,
2821 end
2822 };
2823 }
2824 get rawValue() {
2825 if (!this.valueRange || !this.context)
2826 return null;
2827 const {
2828 start,
2829 end
2830 } = this.valueRange;
2831 return this.context.src.slice(start, end);
2832 }
2833 get tag() {
2834 for (let i = 0; i < this.props.length; ++i) {
2835 const tag = this.getPropValue(i, Char.TAG, false);
2836 if (tag != null) {
2837 if (tag[1] === "<") {
2838 return {
2839 verbatim: tag.slice(2, -1)
2840 };
2841 } else {
2842 const [_, handle, suffix] = tag.match(/^(.*!)([^!]*)$/);
2843 return {
2844 handle,
2845 suffix
2846 };
2847 }
2848 }
2849 }
2850 return null;
2851 }
2852 get valueRangeContainsNewline() {
2853 if (!this.valueRange || !this.context)
2854 return false;
2855 const {
2856 start,
2857 end
2858 } = this.valueRange;
2859 const {
2860 src
2861 } = this.context;
2862 for (let i = start; i < end; ++i) {
2863 if (src[i] === "\n")
2864 return true;
2865 }
2866 return false;
2867 }
2868 parseComment(start) {
2869 const {
2870 src
2871 } = this.context;
2872 if (src[start] === Char.COMMENT) {
2873 const end = Node.endOfLine(src, start + 1);
2874 const commentRange = new Range(start, end);
2875 this.props.push(commentRange);
2876 return end;
2877 }
2878 return start;
2879 }
2880 setOrigRanges(cr, offset) {
2881 if (this.range)
2882 offset = this.range.setOrigRange(cr, offset);
2883 if (this.valueRange)
2884 this.valueRange.setOrigRange(cr, offset);
2885 this.props.forEach((prop) => prop.setOrigRange(cr, offset));
2886 return offset;
2887 }
2888 toString() {
2889 const {
2890 context: {
2891 src
2892 },
2893 range,
2894 value
2895 } = this;
2896 if (value != null)
2897 return value;
2898 const str = src.slice(range.start, range.end);
2899 return Node.addStringTerminator(src, range.end, str);
2900 }
2901 };
2902 var YAMLError = class extends Error {
2903 constructor(name, source, message) {
2904 if (!message || !(source instanceof Node))
2905 throw new Error(`Invalid arguments for new ${name}`);
2906 super();
2907 this.name = name;
2908 this.message = message;
2909 this.source = source;
2910 }
2911 makePretty() {
2912 if (!this.source)
2913 return;
2914 this.nodeType = this.source.type;
2915 const cst = this.source.context && this.source.context.root;
2916 if (typeof this.offset === "number") {
2917 this.range = new Range(this.offset, this.offset + 1);
2918 const start = cst && getLinePos(this.offset, cst);
2919 if (start) {
2920 const end = {
2921 line: start.line,
2922 col: start.col + 1
2923 };
2924 this.linePos = {
2925 start,
2926 end
2927 };
2928 }
2929 delete this.offset;
2930 } else {
2931 this.range = this.source.range;
2932 this.linePos = this.source.rangeAsLinePos;
2933 }
2934 if (this.linePos) {
2935 const {
2936 line,
2937 col
2938 } = this.linePos.start;
2939 this.message += ` at line ${line}, column ${col}`;
2940 const ctx = cst && getPrettyContext(this.linePos, cst);
2941 if (ctx)
2942 this.message += `:
2943
2944${ctx}
2945`;
2946 }
2947 delete this.source;
2948 }
2949 };
2950 var YAMLReferenceError = class extends YAMLError {
2951 constructor(source, message) {
2952 super("YAMLReferenceError", source, message);
2953 }
2954 };
2955 var YAMLSemanticError = class extends YAMLError {
2956 constructor(source, message) {
2957 super("YAMLSemanticError", source, message);
2958 }
2959 };
2960 var YAMLSyntaxError = class extends YAMLError {
2961 constructor(source, message) {
2962 super("YAMLSyntaxError", source, message);
2963 }
2964 };
2965 var YAMLWarning = class extends YAMLError {
2966 constructor(source, message) {
2967 super("YAMLWarning", source, message);
2968 }
2969 };
2970 function _defineProperty(obj, key, value) {
2971 if (key in obj) {
2972 Object.defineProperty(obj, key, {
2973 value,
2974 enumerable: true,
2975 configurable: true,
2976 writable: true
2977 });
2978 } else {
2979 obj[key] = value;
2980 }
2981 return obj;
2982 }
2983 var PlainValue = class extends Node {
2984 static endOfLine(src, start, inFlow) {
2985 let ch = src[start];
2986 let offset = start;
2987 while (ch && ch !== "\n") {
2988 if (inFlow && (ch === "[" || ch === "]" || ch === "{" || ch === "}" || ch === ","))
2989 break;
2990 const next = src[offset + 1];
2991 if (ch === ":" && (!next || next === "\n" || next === " " || next === " " || inFlow && next === ","))
2992 break;
2993 if ((ch === " " || ch === " ") && next === "#")
2994 break;
2995 offset += 1;
2996 ch = next;
2997 }
2998 return offset;
2999 }
3000 get strValue() {
3001 if (!this.valueRange || !this.context)
3002 return null;
3003 let {
3004 start,
3005 end
3006 } = this.valueRange;
3007 const {
3008 src
3009 } = this.context;
3010 let ch = src[end - 1];
3011 while (start < end && (ch === "\n" || ch === " " || ch === " "))
3012 ch = src[--end - 1];
3013 let str = "";
3014 for (let i = start; i < end; ++i) {
3015 const ch2 = src[i];
3016 if (ch2 === "\n") {
3017 const {
3018 fold,
3019 offset
3020 } = Node.foldNewline(src, i, -1);
3021 str += fold;
3022 i = offset;
3023 } else if (ch2 === " " || ch2 === " ") {
3024 const wsStart = i;
3025 let next = src[i + 1];
3026 while (i < end && (next === " " || next === " ")) {
3027 i += 1;
3028 next = src[i + 1];
3029 }
3030 if (next !== "\n")
3031 str += i > wsStart ? src.slice(wsStart, i + 1) : ch2;
3032 } else {
3033 str += ch2;
3034 }
3035 }
3036 const ch0 = src[start];
3037 switch (ch0) {
3038 case " ": {
3039 const msg = "Plain value cannot start with a tab character";
3040 const errors = [new YAMLSemanticError(this, msg)];
3041 return {
3042 errors,
3043 str
3044 };
3045 }
3046 case "@":
3047 case "`": {
3048 const msg = `Plain value cannot start with reserved character ${ch0}`;
3049 const errors = [new YAMLSemanticError(this, msg)];
3050 return {
3051 errors,
3052 str
3053 };
3054 }
3055 default:
3056 return str;
3057 }
3058 }
3059 parseBlockValue(start) {
3060 const {
3061 indent,
3062 inFlow,
3063 src
3064 } = this.context;
3065 let offset = start;
3066 let valueEnd = start;
3067 for (let ch = src[offset]; ch === "\n"; ch = src[offset]) {
3068 if (Node.atDocumentBoundary(src, offset + 1))
3069 break;
3070 const end = Node.endOfBlockIndent(src, indent, offset + 1);
3071 if (end === null || src[end] === "#")
3072 break;
3073 if (src[end] === "\n") {
3074 offset = end;
3075 } else {
3076 valueEnd = PlainValue.endOfLine(src, end, inFlow);
3077 offset = valueEnd;
3078 }
3079 }
3080 if (this.valueRange.isEmpty())
3081 this.valueRange.start = start;
3082 this.valueRange.end = valueEnd;
3083 return valueEnd;
3084 }
3085 parse(context, start) {
3086 this.context = context;
3087 const {
3088 inFlow,
3089 src
3090 } = context;
3091 let offset = start;
3092 const ch = src[offset];
3093 if (ch && ch !== "#" && ch !== "\n") {
3094 offset = PlainValue.endOfLine(src, start, inFlow);
3095 }
3096 this.valueRange = new Range(start, offset);
3097 offset = Node.endOfWhiteSpace(src, offset);
3098 offset = this.parseComment(offset);
3099 if (!this.hasComment || this.valueRange.isEmpty()) {
3100 offset = this.parseBlockValue(offset);
3101 }
3102 return offset;
3103 }
3104 };
3105 exports2.Char = Char;
3106 exports2.Node = Node;
3107 exports2.PlainValue = PlainValue;
3108 exports2.Range = Range;
3109 exports2.Type = Type;
3110 exports2.YAMLError = YAMLError;
3111 exports2.YAMLReferenceError = YAMLReferenceError;
3112 exports2.YAMLSemanticError = YAMLSemanticError;
3113 exports2.YAMLSyntaxError = YAMLSyntaxError;
3114 exports2.YAMLWarning = YAMLWarning;
3115 exports2._defineProperty = _defineProperty;
3116 exports2.defaultTagPrefix = defaultTagPrefix;
3117 exports2.defaultTags = defaultTags;
3118 }
3119});
3120var require_parse_cst = __commonJS({
3121 "node_modules/yaml/dist/parse-cst.js"(exports2) {
3122 "use strict";
3123 var PlainValue = require_PlainValue_ec8e588e();
3124 var BlankLine = class extends PlainValue.Node {
3125 constructor() {
3126 super(PlainValue.Type.BLANK_LINE);
3127 }
3128 get includesTrailingLines() {
3129 return true;
3130 }
3131 parse(context, start) {
3132 this.context = context;
3133 this.range = new PlainValue.Range(start, start + 1);
3134 return start + 1;
3135 }
3136 };
3137 var CollectionItem = class extends PlainValue.Node {
3138 constructor(type, props) {
3139 super(type, props);
3140 this.node = null;
3141 }
3142 get includesTrailingLines() {
3143 return !!this.node && this.node.includesTrailingLines;
3144 }
3145 parse(context, start) {
3146 this.context = context;
3147 const {
3148 parseNode,
3149 src
3150 } = context;
3151 let {
3152 atLineStart,
3153 lineStart
3154 } = context;
3155 if (!atLineStart && this.type === PlainValue.Type.SEQ_ITEM)
3156 this.error = new PlainValue.YAMLSemanticError(this, "Sequence items must not have preceding content on the same line");
3157 const indent = atLineStart ? start - lineStart : context.indent;
3158 let offset = PlainValue.Node.endOfWhiteSpace(src, start + 1);
3159 let ch = src[offset];
3160 const inlineComment = ch === "#";
3161 const comments = [];
3162 let blankLine = null;
3163 while (ch === "\n" || ch === "#") {
3164 if (ch === "#") {
3165 const end2 = PlainValue.Node.endOfLine(src, offset + 1);
3166 comments.push(new PlainValue.Range(offset, end2));
3167 offset = end2;
3168 } else {
3169 atLineStart = true;
3170 lineStart = offset + 1;
3171 const wsEnd = PlainValue.Node.endOfWhiteSpace(src, lineStart);
3172 if (src[wsEnd] === "\n" && comments.length === 0) {
3173 blankLine = new BlankLine();
3174 lineStart = blankLine.parse({
3175 src
3176 }, lineStart);
3177 }
3178 offset = PlainValue.Node.endOfIndent(src, lineStart);
3179 }
3180 ch = src[offset];
3181 }
3182 if (PlainValue.Node.nextNodeIsIndented(ch, offset - (lineStart + indent), this.type !== PlainValue.Type.SEQ_ITEM)) {
3183 this.node = parseNode({
3184 atLineStart,
3185 inCollection: false,
3186 indent,
3187 lineStart,
3188 parent: this
3189 }, offset);
3190 } else if (ch && lineStart > start + 1) {
3191 offset = lineStart - 1;
3192 }
3193 if (this.node) {
3194 if (blankLine) {
3195 const items = context.parent.items || context.parent.contents;
3196 if (items)
3197 items.push(blankLine);
3198 }
3199 if (comments.length)
3200 Array.prototype.push.apply(this.props, comments);
3201 offset = this.node.range.end;
3202 } else {
3203 if (inlineComment) {
3204 const c = comments[0];
3205 this.props.push(c);
3206 offset = c.end;
3207 } else {
3208 offset = PlainValue.Node.endOfLine(src, start + 1);
3209 }
3210 }
3211 const end = this.node ? this.node.valueRange.end : offset;
3212 this.valueRange = new PlainValue.Range(start, end);
3213 return offset;
3214 }
3215 setOrigRanges(cr, offset) {
3216 offset = super.setOrigRanges(cr, offset);
3217 return this.node ? this.node.setOrigRanges(cr, offset) : offset;
3218 }
3219 toString() {
3220 const {
3221 context: {
3222 src
3223 },
3224 node,
3225 range,
3226 value
3227 } = this;
3228 if (value != null)
3229 return value;
3230 const str = node ? src.slice(range.start, node.range.start) + String(node) : src.slice(range.start, range.end);
3231 return PlainValue.Node.addStringTerminator(src, range.end, str);
3232 }
3233 };
3234 var Comment = class extends PlainValue.Node {
3235 constructor() {
3236 super(PlainValue.Type.COMMENT);
3237 }
3238 parse(context, start) {
3239 this.context = context;
3240 const offset = this.parseComment(start);
3241 this.range = new PlainValue.Range(start, offset);
3242 return offset;
3243 }
3244 };
3245 function grabCollectionEndComments(node) {
3246 let cnode = node;
3247 while (cnode instanceof CollectionItem)
3248 cnode = cnode.node;
3249 if (!(cnode instanceof Collection))
3250 return null;
3251 const len = cnode.items.length;
3252 let ci = -1;
3253 for (let i = len - 1; i >= 0; --i) {
3254 const n = cnode.items[i];
3255 if (n.type === PlainValue.Type.COMMENT) {
3256 const {
3257 indent,
3258 lineStart
3259 } = n.context;
3260 if (indent > 0 && n.range.start >= lineStart + indent)
3261 break;
3262 ci = i;
3263 } else if (n.type === PlainValue.Type.BLANK_LINE)
3264 ci = i;
3265 else
3266 break;
3267 }
3268 if (ci === -1)
3269 return null;
3270 const ca = cnode.items.splice(ci, len - ci);
3271 const prevEnd = ca[0].range.start;
3272 while (true) {
3273 cnode.range.end = prevEnd;
3274 if (cnode.valueRange && cnode.valueRange.end > prevEnd)
3275 cnode.valueRange.end = prevEnd;
3276 if (cnode === node)
3277 break;
3278 cnode = cnode.context.parent;
3279 }
3280 return ca;
3281 }
3282 var Collection = class extends PlainValue.Node {
3283 static nextContentHasIndent(src, offset, indent) {
3284 const lineStart = PlainValue.Node.endOfLine(src, offset) + 1;
3285 offset = PlainValue.Node.endOfWhiteSpace(src, lineStart);
3286 const ch = src[offset];
3287 if (!ch)
3288 return false;
3289 if (offset >= lineStart + indent)
3290 return true;
3291 if (ch !== "#" && ch !== "\n")
3292 return false;
3293 return Collection.nextContentHasIndent(src, offset, indent);
3294 }
3295 constructor(firstItem) {
3296 super(firstItem.type === PlainValue.Type.SEQ_ITEM ? PlainValue.Type.SEQ : PlainValue.Type.MAP);
3297 for (let i = firstItem.props.length - 1; i >= 0; --i) {
3298 if (firstItem.props[i].start < firstItem.context.lineStart) {
3299 this.props = firstItem.props.slice(0, i + 1);
3300 firstItem.props = firstItem.props.slice(i + 1);
3301 const itemRange = firstItem.props[0] || firstItem.valueRange;
3302 firstItem.range.start = itemRange.start;
3303 break;
3304 }
3305 }
3306 this.items = [firstItem];
3307 const ec = grabCollectionEndComments(firstItem);
3308 if (ec)
3309 Array.prototype.push.apply(this.items, ec);
3310 }
3311 get includesTrailingLines() {
3312 return this.items.length > 0;
3313 }
3314 parse(context, start) {
3315 this.context = context;
3316 const {
3317 parseNode,
3318 src
3319 } = context;
3320 let lineStart = PlainValue.Node.startOfLine(src, start);
3321 const firstItem = this.items[0];
3322 firstItem.context.parent = this;
3323 this.valueRange = PlainValue.Range.copy(firstItem.valueRange);
3324 const indent = firstItem.range.start - firstItem.context.lineStart;
3325 let offset = start;
3326 offset = PlainValue.Node.normalizeOffset(src, offset);
3327 let ch = src[offset];
3328 let atLineStart = PlainValue.Node.endOfWhiteSpace(src, lineStart) === offset;
3329 let prevIncludesTrailingLines = false;
3330 while (ch) {
3331 while (ch === "\n" || ch === "#") {
3332 if (atLineStart && ch === "\n" && !prevIncludesTrailingLines) {
3333 const blankLine = new BlankLine();
3334 offset = blankLine.parse({
3335 src
3336 }, offset);
3337 this.valueRange.end = offset;
3338 if (offset >= src.length) {
3339 ch = null;
3340 break;
3341 }
3342 this.items.push(blankLine);
3343 offset -= 1;
3344 } else if (ch === "#") {
3345 if (offset < lineStart + indent && !Collection.nextContentHasIndent(src, offset, indent)) {
3346 return offset;
3347 }
3348 const comment = new Comment();
3349 offset = comment.parse({
3350 indent,
3351 lineStart,
3352 src
3353 }, offset);
3354 this.items.push(comment);
3355 this.valueRange.end = offset;
3356 if (offset >= src.length) {
3357 ch = null;
3358 break;
3359 }
3360 }
3361 lineStart = offset + 1;
3362 offset = PlainValue.Node.endOfIndent(src, lineStart);
3363 if (PlainValue.Node.atBlank(src, offset)) {
3364 const wsEnd = PlainValue.Node.endOfWhiteSpace(src, offset);
3365 const next = src[wsEnd];
3366 if (!next || next === "\n" || next === "#") {
3367 offset = wsEnd;
3368 }
3369 }
3370 ch = src[offset];
3371 atLineStart = true;
3372 }
3373 if (!ch) {
3374 break;
3375 }
3376 if (offset !== lineStart + indent && (atLineStart || ch !== ":")) {
3377 if (offset < lineStart + indent) {
3378 if (lineStart > start)
3379 offset = lineStart;
3380 break;
3381 } else if (!this.error) {
3382 const msg = "All collection items must start at the same column";
3383 this.error = new PlainValue.YAMLSyntaxError(this, msg);
3384 }
3385 }
3386 if (firstItem.type === PlainValue.Type.SEQ_ITEM) {
3387 if (ch !== "-") {
3388 if (lineStart > start)
3389 offset = lineStart;
3390 break;
3391 }
3392 } else if (ch === "-" && !this.error) {
3393 const next = src[offset + 1];
3394 if (!next || next === "\n" || next === " " || next === " ") {
3395 const msg = "A collection cannot be both a mapping and a sequence";
3396 this.error = new PlainValue.YAMLSyntaxError(this, msg);
3397 }
3398 }
3399 const node = parseNode({
3400 atLineStart,
3401 inCollection: true,
3402 indent,
3403 lineStart,
3404 parent: this
3405 }, offset);
3406 if (!node)
3407 return offset;
3408 this.items.push(node);
3409 this.valueRange.end = node.valueRange.end;
3410 offset = PlainValue.Node.normalizeOffset(src, node.range.end);
3411 ch = src[offset];
3412 atLineStart = false;
3413 prevIncludesTrailingLines = node.includesTrailingLines;
3414 if (ch) {
3415 let ls = offset - 1;
3416 let prev = src[ls];
3417 while (prev === " " || prev === " ")
3418 prev = src[--ls];
3419 if (prev === "\n") {
3420 lineStart = ls + 1;
3421 atLineStart = true;
3422 }
3423 }
3424 const ec = grabCollectionEndComments(node);
3425 if (ec)
3426 Array.prototype.push.apply(this.items, ec);
3427 }
3428 return offset;
3429 }
3430 setOrigRanges(cr, offset) {
3431 offset = super.setOrigRanges(cr, offset);
3432 this.items.forEach((node) => {
3433 offset = node.setOrigRanges(cr, offset);
3434 });
3435 return offset;
3436 }
3437 toString() {
3438 const {
3439 context: {
3440 src
3441 },
3442 items,
3443 range,
3444 value
3445 } = this;
3446 if (value != null)
3447 return value;
3448 let str = src.slice(range.start, items[0].range.start) + String(items[0]);
3449 for (let i = 1; i < items.length; ++i) {
3450 const item = items[i];
3451 const {
3452 atLineStart,
3453 indent
3454 } = item.context;
3455 if (atLineStart)
3456 for (let i2 = 0; i2 < indent; ++i2)
3457 str += " ";
3458 str += String(item);
3459 }
3460 return PlainValue.Node.addStringTerminator(src, range.end, str);
3461 }
3462 };
3463 var Directive = class extends PlainValue.Node {
3464 constructor() {
3465 super(PlainValue.Type.DIRECTIVE);
3466 this.name = null;
3467 }
3468 get parameters() {
3469 const raw = this.rawValue;
3470 return raw ? raw.trim().split(/[ \t]+/) : [];
3471 }
3472 parseName(start) {
3473 const {
3474 src
3475 } = this.context;
3476 let offset = start;
3477 let ch = src[offset];
3478 while (ch && ch !== "\n" && ch !== " " && ch !== " ")
3479 ch = src[offset += 1];
3480 this.name = src.slice(start, offset);
3481 return offset;
3482 }
3483 parseParameters(start) {
3484 const {
3485 src
3486 } = this.context;
3487 let offset = start;
3488 let ch = src[offset];
3489 while (ch && ch !== "\n" && ch !== "#")
3490 ch = src[offset += 1];
3491 this.valueRange = new PlainValue.Range(start, offset);
3492 return offset;
3493 }
3494 parse(context, start) {
3495 this.context = context;
3496 let offset = this.parseName(start + 1);
3497 offset = this.parseParameters(offset);
3498 offset = this.parseComment(offset);
3499 this.range = new PlainValue.Range(start, offset);
3500 return offset;
3501 }
3502 };
3503 var Document = class extends PlainValue.Node {
3504 static startCommentOrEndBlankLine(src, start) {
3505 const offset = PlainValue.Node.endOfWhiteSpace(src, start);
3506 const ch = src[offset];
3507 return ch === "#" || ch === "\n" ? offset : start;
3508 }
3509 constructor() {
3510 super(PlainValue.Type.DOCUMENT);
3511 this.directives = null;
3512 this.contents = null;
3513 this.directivesEndMarker = null;
3514 this.documentEndMarker = null;
3515 }
3516 parseDirectives(start) {
3517 const {
3518 src
3519 } = this.context;
3520 this.directives = [];
3521 let atLineStart = true;
3522 let hasDirectives = false;
3523 let offset = start;
3524 while (!PlainValue.Node.atDocumentBoundary(src, offset, PlainValue.Char.DIRECTIVES_END)) {
3525 offset = Document.startCommentOrEndBlankLine(src, offset);
3526 switch (src[offset]) {
3527 case "\n":
3528 if (atLineStart) {
3529 const blankLine = new BlankLine();
3530 offset = blankLine.parse({
3531 src
3532 }, offset);
3533 if (offset < src.length) {
3534 this.directives.push(blankLine);
3535 }
3536 } else {
3537 offset += 1;
3538 atLineStart = true;
3539 }
3540 break;
3541 case "#":
3542 {
3543 const comment = new Comment();
3544 offset = comment.parse({
3545 src
3546 }, offset);
3547 this.directives.push(comment);
3548 atLineStart = false;
3549 }
3550 break;
3551 case "%":
3552 {
3553 const directive = new Directive();
3554 offset = directive.parse({
3555 parent: this,
3556 src
3557 }, offset);
3558 this.directives.push(directive);
3559 hasDirectives = true;
3560 atLineStart = false;
3561 }
3562 break;
3563 default:
3564 if (hasDirectives) {
3565 this.error = new PlainValue.YAMLSemanticError(this, "Missing directives-end indicator line");
3566 } else if (this.directives.length > 0) {
3567 this.contents = this.directives;
3568 this.directives = [];
3569 }
3570 return offset;
3571 }
3572 }
3573 if (src[offset]) {
3574 this.directivesEndMarker = new PlainValue.Range(offset, offset + 3);
3575 return offset + 3;
3576 }
3577 if (hasDirectives) {
3578 this.error = new PlainValue.YAMLSemanticError(this, "Missing directives-end indicator line");
3579 } else if (this.directives.length > 0) {
3580 this.contents = this.directives;
3581 this.directives = [];
3582 }
3583 return offset;
3584 }
3585 parseContents(start) {
3586 const {
3587 parseNode,
3588 src
3589 } = this.context;
3590 if (!this.contents)
3591 this.contents = [];
3592 let lineStart = start;
3593 while (src[lineStart - 1] === "-")
3594 lineStart -= 1;
3595 let offset = PlainValue.Node.endOfWhiteSpace(src, start);
3596 let atLineStart = lineStart === start;
3597 this.valueRange = new PlainValue.Range(offset);
3598 while (!PlainValue.Node.atDocumentBoundary(src, offset, PlainValue.Char.DOCUMENT_END)) {
3599 switch (src[offset]) {
3600 case "\n":
3601 if (atLineStart) {
3602 const blankLine = new BlankLine();
3603 offset = blankLine.parse({
3604 src
3605 }, offset);
3606 if (offset < src.length) {
3607 this.contents.push(blankLine);
3608 }
3609 } else {
3610 offset += 1;
3611 atLineStart = true;
3612 }
3613 lineStart = offset;
3614 break;
3615 case "#":
3616 {
3617 const comment = new Comment();
3618 offset = comment.parse({
3619 src
3620 }, offset);
3621 this.contents.push(comment);
3622 atLineStart = false;
3623 }
3624 break;
3625 default: {
3626 const iEnd = PlainValue.Node.endOfIndent(src, offset);
3627 const context = {
3628 atLineStart,
3629 indent: -1,
3630 inFlow: false,
3631 inCollection: false,
3632 lineStart,
3633 parent: this
3634 };
3635 const node = parseNode(context, iEnd);
3636 if (!node)
3637 return this.valueRange.end = iEnd;
3638 this.contents.push(node);
3639 offset = node.range.end;
3640 atLineStart = false;
3641 const ec = grabCollectionEndComments(node);
3642 if (ec)
3643 Array.prototype.push.apply(this.contents, ec);
3644 }
3645 }
3646 offset = Document.startCommentOrEndBlankLine(src, offset);
3647 }
3648 this.valueRange.end = offset;
3649 if (src[offset]) {
3650 this.documentEndMarker = new PlainValue.Range(offset, offset + 3);
3651 offset += 3;
3652 if (src[offset]) {
3653 offset = PlainValue.Node.endOfWhiteSpace(src, offset);
3654 if (src[offset] === "#") {
3655 const comment = new Comment();
3656 offset = comment.parse({
3657 src
3658 }, offset);
3659 this.contents.push(comment);
3660 }
3661 switch (src[offset]) {
3662 case "\n":
3663 offset += 1;
3664 break;
3665 case void 0:
3666 break;
3667 default:
3668 this.error = new PlainValue.YAMLSyntaxError(this, "Document end marker line cannot have a non-comment suffix");
3669 }
3670 }
3671 }
3672 return offset;
3673 }
3674 parse(context, start) {
3675 context.root = this;
3676 this.context = context;
3677 const {
3678 src
3679 } = context;
3680 let offset = src.charCodeAt(start) === 65279 ? start + 1 : start;
3681 offset = this.parseDirectives(offset);
3682 offset = this.parseContents(offset);
3683 return offset;
3684 }
3685 setOrigRanges(cr, offset) {
3686 offset = super.setOrigRanges(cr, offset);
3687 this.directives.forEach((node) => {
3688 offset = node.setOrigRanges(cr, offset);
3689 });
3690 if (this.directivesEndMarker)
3691 offset = this.directivesEndMarker.setOrigRange(cr, offset);
3692 this.contents.forEach((node) => {
3693 offset = node.setOrigRanges(cr, offset);
3694 });
3695 if (this.documentEndMarker)
3696 offset = this.documentEndMarker.setOrigRange(cr, offset);
3697 return offset;
3698 }
3699 toString() {
3700 const {
3701 contents,
3702 directives,
3703 value
3704 } = this;
3705 if (value != null)
3706 return value;
3707 let str = directives.join("");
3708 if (contents.length > 0) {
3709 if (directives.length > 0 || contents[0].type === PlainValue.Type.COMMENT)
3710 str += "---\n";
3711 str += contents.join("");
3712 }
3713 if (str[str.length - 1] !== "\n")
3714 str += "\n";
3715 return str;
3716 }
3717 };
3718 var Alias = class extends PlainValue.Node {
3719 parse(context, start) {
3720 this.context = context;
3721 const {
3722 src
3723 } = context;
3724 let offset = PlainValue.Node.endOfIdentifier(src, start + 1);
3725 this.valueRange = new PlainValue.Range(start + 1, offset);
3726 offset = PlainValue.Node.endOfWhiteSpace(src, offset);
3727 offset = this.parseComment(offset);
3728 return offset;
3729 }
3730 };
3731 var Chomp = {
3732 CLIP: "CLIP",
3733 KEEP: "KEEP",
3734 STRIP: "STRIP"
3735 };
3736 var BlockValue = class extends PlainValue.Node {
3737 constructor(type, props) {
3738 super(type, props);
3739 this.blockIndent = null;
3740 this.chomping = Chomp.CLIP;
3741 this.header = null;
3742 }
3743 get includesTrailingLines() {
3744 return this.chomping === Chomp.KEEP;
3745 }
3746 get strValue() {
3747 if (!this.valueRange || !this.context)
3748 return null;
3749 let {
3750 start,
3751 end
3752 } = this.valueRange;
3753 const {
3754 indent,
3755 src
3756 } = this.context;
3757 if (this.valueRange.isEmpty())
3758 return "";
3759 let lastNewLine = null;
3760 let ch = src[end - 1];
3761 while (ch === "\n" || ch === " " || ch === " ") {
3762 end -= 1;
3763 if (end <= start) {
3764 if (this.chomping === Chomp.KEEP)
3765 break;
3766 else
3767 return "";
3768 }
3769 if (ch === "\n")
3770 lastNewLine = end;
3771 ch = src[end - 1];
3772 }
3773 let keepStart = end + 1;
3774 if (lastNewLine) {
3775 if (this.chomping === Chomp.KEEP) {
3776 keepStart = lastNewLine;
3777 end = this.valueRange.end;
3778 } else {
3779 end = lastNewLine;
3780 }
3781 }
3782 const bi = indent + this.blockIndent;
3783 const folded = this.type === PlainValue.Type.BLOCK_FOLDED;
3784 let atStart = true;
3785 let str = "";
3786 let sep = "";
3787 let prevMoreIndented = false;
3788 for (let i = start; i < end; ++i) {
3789 for (let j = 0; j < bi; ++j) {
3790 if (src[i] !== " ")
3791 break;
3792 i += 1;
3793 }
3794 const ch2 = src[i];
3795 if (ch2 === "\n") {
3796 if (sep === "\n")
3797 str += "\n";
3798 else
3799 sep = "\n";
3800 } else {
3801 const lineEnd = PlainValue.Node.endOfLine(src, i);
3802 const line = src.slice(i, lineEnd);
3803 i = lineEnd;
3804 if (folded && (ch2 === " " || ch2 === " ") && i < keepStart) {
3805 if (sep === " ")
3806 sep = "\n";
3807 else if (!prevMoreIndented && !atStart && sep === "\n")
3808 sep = "\n\n";
3809 str += sep + line;
3810 sep = lineEnd < end && src[lineEnd] || "";
3811 prevMoreIndented = true;
3812 } else {
3813 str += sep + line;
3814 sep = folded && i < keepStart ? " " : "\n";
3815 prevMoreIndented = false;
3816 }
3817 if (atStart && line !== "")
3818 atStart = false;
3819 }
3820 }
3821 return this.chomping === Chomp.STRIP ? str : str + "\n";
3822 }
3823 parseBlockHeader(start) {
3824 const {
3825 src
3826 } = this.context;
3827 let offset = start + 1;
3828 let bi = "";
3829 while (true) {
3830 const ch = src[offset];
3831 switch (ch) {
3832 case "-":
3833 this.chomping = Chomp.STRIP;
3834 break;
3835 case "+":
3836 this.chomping = Chomp.KEEP;
3837 break;
3838 case "0":
3839 case "1":
3840 case "2":
3841 case "3":
3842 case "4":
3843 case "5":
3844 case "6":
3845 case "7":
3846 case "8":
3847 case "9":
3848 bi += ch;
3849 break;
3850 default:
3851 this.blockIndent = Number(bi) || null;
3852 this.header = new PlainValue.Range(start, offset);
3853 return offset;
3854 }
3855 offset += 1;
3856 }
3857 }
3858 parseBlockValue(start) {
3859 const {
3860 indent,
3861 src
3862 } = this.context;
3863 const explicit = !!this.blockIndent;
3864 let offset = start;
3865 let valueEnd = start;
3866 let minBlockIndent = 1;
3867 for (let ch = src[offset]; ch === "\n"; ch = src[offset]) {
3868 offset += 1;
3869 if (PlainValue.Node.atDocumentBoundary(src, offset))
3870 break;
3871 const end = PlainValue.Node.endOfBlockIndent(src, indent, offset);
3872 if (end === null)
3873 break;
3874 const ch2 = src[end];
3875 const lineIndent = end - (offset + indent);
3876 if (!this.blockIndent) {
3877 if (src[end] !== "\n") {
3878 if (lineIndent < minBlockIndent) {
3879 const msg = "Block scalars with more-indented leading empty lines must use an explicit indentation indicator";
3880 this.error = new PlainValue.YAMLSemanticError(this, msg);
3881 }
3882 this.blockIndent = lineIndent;
3883 } else if (lineIndent > minBlockIndent) {
3884 minBlockIndent = lineIndent;
3885 }
3886 } else if (ch2 && ch2 !== "\n" && lineIndent < this.blockIndent) {
3887 if (src[end] === "#")
3888 break;
3889 if (!this.error) {
3890 const src2 = explicit ? "explicit indentation indicator" : "first line";
3891 const msg = `Block scalars must not be less indented than their ${src2}`;
3892 this.error = new PlainValue.YAMLSemanticError(this, msg);
3893 }
3894 }
3895 if (src[end] === "\n") {
3896 offset = end;
3897 } else {
3898 offset = valueEnd = PlainValue.Node.endOfLine(src, end);
3899 }
3900 }
3901 if (this.chomping !== Chomp.KEEP) {
3902 offset = src[valueEnd] ? valueEnd + 1 : valueEnd;
3903 }
3904 this.valueRange = new PlainValue.Range(start + 1, offset);
3905 return offset;
3906 }
3907 parse(context, start) {
3908 this.context = context;
3909 const {
3910 src
3911 } = context;
3912 let offset = this.parseBlockHeader(start);
3913 offset = PlainValue.Node.endOfWhiteSpace(src, offset);
3914 offset = this.parseComment(offset);
3915 offset = this.parseBlockValue(offset);
3916 return offset;
3917 }
3918 setOrigRanges(cr, offset) {
3919 offset = super.setOrigRanges(cr, offset);
3920 return this.header ? this.header.setOrigRange(cr, offset) : offset;
3921 }
3922 };
3923 var FlowCollection = class extends PlainValue.Node {
3924 constructor(type, props) {
3925 super(type, props);
3926 this.items = null;
3927 }
3928 prevNodeIsJsonLike(idx = this.items.length) {
3929 const node = this.items[idx - 1];
3930 return !!node && (node.jsonLike || node.type === PlainValue.Type.COMMENT && this.prevNodeIsJsonLike(idx - 1));
3931 }
3932 parse(context, start) {
3933 this.context = context;
3934 const {
3935 parseNode,
3936 src
3937 } = context;
3938 let {
3939 indent,
3940 lineStart
3941 } = context;
3942 let char = src[start];
3943 this.items = [{
3944 char,
3945 offset: start
3946 }];
3947 let offset = PlainValue.Node.endOfWhiteSpace(src, start + 1);
3948 char = src[offset];
3949 while (char && char !== "]" && char !== "}") {
3950 switch (char) {
3951 case "\n":
3952 {
3953 lineStart = offset + 1;
3954 const wsEnd = PlainValue.Node.endOfWhiteSpace(src, lineStart);
3955 if (src[wsEnd] === "\n") {
3956 const blankLine = new BlankLine();
3957 lineStart = blankLine.parse({
3958 src
3959 }, lineStart);
3960 this.items.push(blankLine);
3961 }
3962 offset = PlainValue.Node.endOfIndent(src, lineStart);
3963 if (offset <= lineStart + indent) {
3964 char = src[offset];
3965 if (offset < lineStart + indent || char !== "]" && char !== "}") {
3966 const msg = "Insufficient indentation in flow collection";
3967 this.error = new PlainValue.YAMLSemanticError(this, msg);
3968 }
3969 }
3970 }
3971 break;
3972 case ",":
3973 {
3974 this.items.push({
3975 char,
3976 offset
3977 });
3978 offset += 1;
3979 }
3980 break;
3981 case "#":
3982 {
3983 const comment = new Comment();
3984 offset = comment.parse({
3985 src
3986 }, offset);
3987 this.items.push(comment);
3988 }
3989 break;
3990 case "?":
3991 case ":": {
3992 const next = src[offset + 1];
3993 if (next === "\n" || next === " " || next === " " || next === "," || char === ":" && this.prevNodeIsJsonLike()) {
3994 this.items.push({
3995 char,
3996 offset
3997 });
3998 offset += 1;
3999 break;
4000 }
4001 }
4002 default: {
4003 const node = parseNode({
4004 atLineStart: false,
4005 inCollection: false,
4006 inFlow: true,
4007 indent: -1,
4008 lineStart,
4009 parent: this
4010 }, offset);
4011 if (!node) {
4012 this.valueRange = new PlainValue.Range(start, offset);
4013 return offset;
4014 }
4015 this.items.push(node);
4016 offset = PlainValue.Node.normalizeOffset(src, node.range.end);
4017 }
4018 }
4019 offset = PlainValue.Node.endOfWhiteSpace(src, offset);
4020 char = src[offset];
4021 }
4022 this.valueRange = new PlainValue.Range(start, offset + 1);
4023 if (char) {
4024 this.items.push({
4025 char,
4026 offset
4027 });
4028 offset = PlainValue.Node.endOfWhiteSpace(src, offset + 1);
4029 offset = this.parseComment(offset);
4030 }
4031 return offset;
4032 }
4033 setOrigRanges(cr, offset) {
4034 offset = super.setOrigRanges(cr, offset);
4035 this.items.forEach((node) => {
4036 if (node instanceof PlainValue.Node) {
4037 offset = node.setOrigRanges(cr, offset);
4038 } else if (cr.length === 0) {
4039 node.origOffset = node.offset;
4040 } else {
4041 let i = offset;
4042 while (i < cr.length) {
4043 if (cr[i] > node.offset)
4044 break;
4045 else
4046 ++i;
4047 }
4048 node.origOffset = node.offset + i;
4049 offset = i;
4050 }
4051 });
4052 return offset;
4053 }
4054 toString() {
4055 const {
4056 context: {
4057 src
4058 },
4059 items,
4060 range,
4061 value
4062 } = this;
4063 if (value != null)
4064 return value;
4065 const nodes = items.filter((item) => item instanceof PlainValue.Node);
4066 let str = "";
4067 let prevEnd = range.start;
4068 nodes.forEach((node) => {
4069 const prefix = src.slice(prevEnd, node.range.start);
4070 prevEnd = node.range.end;
4071 str += prefix + String(node);
4072 if (str[str.length - 1] === "\n" && src[prevEnd - 1] !== "\n" && src[prevEnd] === "\n") {
4073 prevEnd += 1;
4074 }
4075 });
4076 str += src.slice(prevEnd, range.end);
4077 return PlainValue.Node.addStringTerminator(src, range.end, str);
4078 }
4079 };
4080 var QuoteDouble = class extends PlainValue.Node {
4081 static endOfQuote(src, offset) {
4082 let ch = src[offset];
4083 while (ch && ch !== '"') {
4084 offset += ch === "\\" ? 2 : 1;
4085 ch = src[offset];
4086 }
4087 return offset + 1;
4088 }
4089 get strValue() {
4090 if (!this.valueRange || !this.context)
4091 return null;
4092 const errors = [];
4093 const {
4094 start,
4095 end
4096 } = this.valueRange;
4097 const {
4098 indent,
4099 src
4100 } = this.context;
4101 if (src[end - 1] !== '"')
4102 errors.push(new PlainValue.YAMLSyntaxError(this, 'Missing closing "quote'));
4103 let str = "";
4104 for (let i = start + 1; i < end - 1; ++i) {
4105 const ch = src[i];
4106 if (ch === "\n") {
4107 if (PlainValue.Node.atDocumentBoundary(src, i + 1))
4108 errors.push(new PlainValue.YAMLSemanticError(this, "Document boundary indicators are not allowed within string values"));
4109 const {
4110 fold,
4111 offset,
4112 error
4113 } = PlainValue.Node.foldNewline(src, i, indent);
4114 str += fold;
4115 i = offset;
4116 if (error)
4117 errors.push(new PlainValue.YAMLSemanticError(this, "Multi-line double-quoted string needs to be sufficiently indented"));
4118 } else if (ch === "\\") {
4119 i += 1;
4120 switch (src[i]) {
4121 case "0":
4122 str += "\0";
4123 break;
4124 case "a":
4125 str += "\x07";
4126 break;
4127 case "b":
4128 str += "\b";
4129 break;
4130 case "e":
4131 str += "\x1B";
4132 break;
4133 case "f":
4134 str += "\f";
4135 break;
4136 case "n":
4137 str += "\n";
4138 break;
4139 case "r":
4140 str += "\r";
4141 break;
4142 case "t":
4143 str += " ";
4144 break;
4145 case "v":
4146 str += "\v";
4147 break;
4148 case "N":
4149 str += "\x85";
4150 break;
4151 case "_":
4152 str += "\xA0";
4153 break;
4154 case "L":
4155 str += "\u2028";
4156 break;
4157 case "P":
4158 str += "\u2029";
4159 break;
4160 case " ":
4161 str += " ";
4162 break;
4163 case '"':
4164 str += '"';
4165 break;
4166 case "/":
4167 str += "/";
4168 break;
4169 case "\\":
4170 str += "\\";
4171 break;
4172 case " ":
4173 str += " ";
4174 break;
4175 case "x":
4176 str += this.parseCharCode(i + 1, 2, errors);
4177 i += 2;
4178 break;
4179 case "u":
4180 str += this.parseCharCode(i + 1, 4, errors);
4181 i += 4;
4182 break;
4183 case "U":
4184 str += this.parseCharCode(i + 1, 8, errors);
4185 i += 8;
4186 break;
4187 case "\n":
4188 while (src[i + 1] === " " || src[i + 1] === " ")
4189 i += 1;
4190 break;
4191 default:
4192 errors.push(new PlainValue.YAMLSyntaxError(this, `Invalid escape sequence ${src.substr(i - 1, 2)}`));
4193 str += "\\" + src[i];
4194 }
4195 } else if (ch === " " || ch === " ") {
4196 const wsStart = i;
4197 let next = src[i + 1];
4198 while (next === " " || next === " ") {
4199 i += 1;
4200 next = src[i + 1];
4201 }
4202 if (next !== "\n")
4203 str += i > wsStart ? src.slice(wsStart, i + 1) : ch;
4204 } else {
4205 str += ch;
4206 }
4207 }
4208 return errors.length > 0 ? {
4209 errors,
4210 str
4211 } : str;
4212 }
4213 parseCharCode(offset, length, errors) {
4214 const {
4215 src
4216 } = this.context;
4217 const cc = src.substr(offset, length);
4218 const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
4219 const code = ok ? parseInt(cc, 16) : NaN;
4220 if (isNaN(code)) {
4221 errors.push(new PlainValue.YAMLSyntaxError(this, `Invalid escape sequence ${src.substr(offset - 2, length + 2)}`));
4222 return src.substr(offset - 2, length + 2);
4223 }
4224 return String.fromCodePoint(code);
4225 }
4226 parse(context, start) {
4227 this.context = context;
4228 const {
4229 src
4230 } = context;
4231 let offset = QuoteDouble.endOfQuote(src, start + 1);
4232 this.valueRange = new PlainValue.Range(start, offset);
4233 offset = PlainValue.Node.endOfWhiteSpace(src, offset);
4234 offset = this.parseComment(offset);
4235 return offset;
4236 }
4237 };
4238 var QuoteSingle = class extends PlainValue.Node {
4239 static endOfQuote(src, offset) {
4240 let ch = src[offset];
4241 while (ch) {
4242 if (ch === "'") {
4243 if (src[offset + 1] !== "'")
4244 break;
4245 ch = src[offset += 2];
4246 } else {
4247 ch = src[offset += 1];
4248 }
4249 }
4250 return offset + 1;
4251 }
4252 get strValue() {
4253 if (!this.valueRange || !this.context)
4254 return null;
4255 const errors = [];
4256 const {
4257 start,
4258 end
4259 } = this.valueRange;
4260 const {
4261 indent,
4262 src
4263 } = this.context;
4264 if (src[end - 1] !== "'")
4265 errors.push(new PlainValue.YAMLSyntaxError(this, "Missing closing 'quote"));
4266 let str = "";
4267 for (let i = start + 1; i < end - 1; ++i) {
4268 const ch = src[i];
4269 if (ch === "\n") {
4270 if (PlainValue.Node.atDocumentBoundary(src, i + 1))
4271 errors.push(new PlainValue.YAMLSemanticError(this, "Document boundary indicators are not allowed within string values"));
4272 const {
4273 fold,
4274 offset,
4275 error
4276 } = PlainValue.Node.foldNewline(src, i, indent);
4277 str += fold;
4278 i = offset;
4279 if (error)
4280 errors.push(new PlainValue.YAMLSemanticError(this, "Multi-line single-quoted string needs to be sufficiently indented"));
4281 } else if (ch === "'") {
4282 str += ch;
4283 i += 1;
4284 if (src[i] !== "'")
4285 errors.push(new PlainValue.YAMLSyntaxError(this, "Unescaped single quote? This should not happen."));
4286 } else if (ch === " " || ch === " ") {
4287 const wsStart = i;
4288 let next = src[i + 1];
4289 while (next === " " || next === " ") {
4290 i += 1;
4291 next = src[i + 1];
4292 }
4293 if (next !== "\n")
4294 str += i > wsStart ? src.slice(wsStart, i + 1) : ch;
4295 } else {
4296 str += ch;
4297 }
4298 }
4299 return errors.length > 0 ? {
4300 errors,
4301 str
4302 } : str;
4303 }
4304 parse(context, start) {
4305 this.context = context;
4306 const {
4307 src
4308 } = context;
4309 let offset = QuoteSingle.endOfQuote(src, start + 1);
4310 this.valueRange = new PlainValue.Range(start, offset);
4311 offset = PlainValue.Node.endOfWhiteSpace(src, offset);
4312 offset = this.parseComment(offset);
4313 return offset;
4314 }
4315 };
4316 function createNewNode(type, props) {
4317 switch (type) {
4318 case PlainValue.Type.ALIAS:
4319 return new Alias(type, props);
4320 case PlainValue.Type.BLOCK_FOLDED:
4321 case PlainValue.Type.BLOCK_LITERAL:
4322 return new BlockValue(type, props);
4323 case PlainValue.Type.FLOW_MAP:
4324 case PlainValue.Type.FLOW_SEQ:
4325 return new FlowCollection(type, props);
4326 case PlainValue.Type.MAP_KEY:
4327 case PlainValue.Type.MAP_VALUE:
4328 case PlainValue.Type.SEQ_ITEM:
4329 return new CollectionItem(type, props);
4330 case PlainValue.Type.COMMENT:
4331 case PlainValue.Type.PLAIN:
4332 return new PlainValue.PlainValue(type, props);
4333 case PlainValue.Type.QUOTE_DOUBLE:
4334 return new QuoteDouble(type, props);
4335 case PlainValue.Type.QUOTE_SINGLE:
4336 return new QuoteSingle(type, props);
4337 default:
4338 return null;
4339 }
4340 }
4341 var ParseContext = class {
4342 static parseType(src, offset, inFlow) {
4343 switch (src[offset]) {
4344 case "*":
4345 return PlainValue.Type.ALIAS;
4346 case ">":
4347 return PlainValue.Type.BLOCK_FOLDED;
4348 case "|":
4349 return PlainValue.Type.BLOCK_LITERAL;
4350 case "{":
4351 return PlainValue.Type.FLOW_MAP;
4352 case "[":
4353 return PlainValue.Type.FLOW_SEQ;
4354 case "?":
4355 return !inFlow && PlainValue.Node.atBlank(src, offset + 1, true) ? PlainValue.Type.MAP_KEY : PlainValue.Type.PLAIN;
4356 case ":":
4357 return !inFlow && PlainValue.Node.atBlank(src, offset + 1, true) ? PlainValue.Type.MAP_VALUE : PlainValue.Type.PLAIN;
4358 case "-":
4359 return !inFlow && PlainValue.Node.atBlank(src, offset + 1, true) ? PlainValue.Type.SEQ_ITEM : PlainValue.Type.PLAIN;
4360 case '"':
4361 return PlainValue.Type.QUOTE_DOUBLE;
4362 case "'":
4363 return PlainValue.Type.QUOTE_SINGLE;
4364 default:
4365 return PlainValue.Type.PLAIN;
4366 }
4367 }
4368 constructor(orig = {}, {
4369 atLineStart,
4370 inCollection,
4371 inFlow,
4372 indent,
4373 lineStart,
4374 parent
4375 } = {}) {
4376 PlainValue._defineProperty(this, "parseNode", (overlay, start) => {
4377 if (PlainValue.Node.atDocumentBoundary(this.src, start))
4378 return null;
4379 const context = new ParseContext(this, overlay);
4380 const {
4381 props,
4382 type,
4383 valueStart
4384 } = context.parseProps(start);
4385 const node = createNewNode(type, props);
4386 let offset = node.parse(context, valueStart);
4387 node.range = new PlainValue.Range(start, offset);
4388 if (offset <= start) {
4389 node.error = new Error(`Node#parse consumed no characters`);
4390 node.error.parseEnd = offset;
4391 node.error.source = node;
4392 node.range.end = start + 1;
4393 }
4394 if (context.nodeStartsCollection(node)) {
4395 if (!node.error && !context.atLineStart && context.parent.type === PlainValue.Type.DOCUMENT) {
4396 node.error = new PlainValue.YAMLSyntaxError(node, "Block collection must not have preceding content here (e.g. directives-end indicator)");
4397 }
4398 const collection = new Collection(node);
4399 offset = collection.parse(new ParseContext(context), offset);
4400 collection.range = new PlainValue.Range(start, offset);
4401 return collection;
4402 }
4403 return node;
4404 });
4405 this.atLineStart = atLineStart != null ? atLineStart : orig.atLineStart || false;
4406 this.inCollection = inCollection != null ? inCollection : orig.inCollection || false;
4407 this.inFlow = inFlow != null ? inFlow : orig.inFlow || false;
4408 this.indent = indent != null ? indent : orig.indent;
4409 this.lineStart = lineStart != null ? lineStart : orig.lineStart;
4410 this.parent = parent != null ? parent : orig.parent || {};
4411 this.root = orig.root;
4412 this.src = orig.src;
4413 }
4414 nodeStartsCollection(node) {
4415 const {
4416 inCollection,
4417 inFlow,
4418 src
4419 } = this;
4420 if (inCollection || inFlow)
4421 return false;
4422 if (node instanceof CollectionItem)
4423 return true;
4424 let offset = node.range.end;
4425 if (src[offset] === "\n" || src[offset - 1] === "\n")
4426 return false;
4427 offset = PlainValue.Node.endOfWhiteSpace(src, offset);
4428 return src[offset] === ":";
4429 }
4430 parseProps(offset) {
4431 const {
4432 inFlow,
4433 parent,
4434 src
4435 } = this;
4436 const props = [];
4437 let lineHasProps = false;
4438 offset = this.atLineStart ? PlainValue.Node.endOfIndent(src, offset) : PlainValue.Node.endOfWhiteSpace(src, offset);
4439 let ch = src[offset];
4440 while (ch === PlainValue.Char.ANCHOR || ch === PlainValue.Char.COMMENT || ch === PlainValue.Char.TAG || ch === "\n") {
4441 if (ch === "\n") {
4442 let inEnd = offset;
4443 let lineStart;
4444 do {
4445 lineStart = inEnd + 1;
4446 inEnd = PlainValue.Node.endOfIndent(src, lineStart);
4447 } while (src[inEnd] === "\n");
4448 const indentDiff = inEnd - (lineStart + this.indent);
4449 const noIndicatorAsIndent = parent.type === PlainValue.Type.SEQ_ITEM && parent.context.atLineStart;
4450 if (src[inEnd] !== "#" && !PlainValue.Node.nextNodeIsIndented(src[inEnd], indentDiff, !noIndicatorAsIndent))
4451 break;
4452 this.atLineStart = true;
4453 this.lineStart = lineStart;
4454 lineHasProps = false;
4455 offset = inEnd;
4456 } else if (ch === PlainValue.Char.COMMENT) {
4457 const end = PlainValue.Node.endOfLine(src, offset + 1);
4458 props.push(new PlainValue.Range(offset, end));
4459 offset = end;
4460 } else {
4461 let end = PlainValue.Node.endOfIdentifier(src, offset + 1);
4462 if (ch === PlainValue.Char.TAG && src[end] === "," && /^[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+,\d\d\d\d(-\d\d){0,2}\/\S/.test(src.slice(offset + 1, end + 13))) {
4463 end = PlainValue.Node.endOfIdentifier(src, end + 5);
4464 }
4465 props.push(new PlainValue.Range(offset, end));
4466 lineHasProps = true;
4467 offset = PlainValue.Node.endOfWhiteSpace(src, end);
4468 }
4469 ch = src[offset];
4470 }
4471 if (lineHasProps && ch === ":" && PlainValue.Node.atBlank(src, offset + 1, true))
4472 offset -= 1;
4473 const type = ParseContext.parseType(src, offset, inFlow);
4474 return {
4475 props,
4476 type,
4477 valueStart: offset
4478 };
4479 }
4480 };
4481 function parse(src) {
4482 const cr = [];
4483 if (src.indexOf("\r") !== -1) {
4484 src = src.replace(/\r\n?/g, (match, offset2) => {
4485 if (match.length > 1)
4486 cr.push(offset2);
4487 return "\n";
4488 });
4489 }
4490 const documents = [];
4491 let offset = 0;
4492 do {
4493 const doc = new Document();
4494 const context = new ParseContext({
4495 src
4496 });
4497 offset = doc.parse(context, offset);
4498 documents.push(doc);
4499 } while (offset < src.length);
4500 documents.setOrigRanges = () => {
4501 if (cr.length === 0)
4502 return false;
4503 for (let i = 1; i < cr.length; ++i)
4504 cr[i] -= i;
4505 let crOffset = 0;
4506 for (let i = 0; i < documents.length; ++i) {
4507 crOffset = documents[i].setOrigRanges(cr, crOffset);
4508 }
4509 cr.splice(0, cr.length);
4510 return true;
4511 };
4512 documents.toString = () => documents.join("...\n");
4513 return documents;
4514 }
4515 exports2.parse = parse;
4516 }
4517});
4518var require_resolveSeq_d03cb037 = __commonJS({
4519 "node_modules/yaml/dist/resolveSeq-d03cb037.js"(exports2) {
4520 "use strict";
4521 var PlainValue = require_PlainValue_ec8e588e();
4522 function addCommentBefore(str, indent, comment) {
4523 if (!comment)
4524 return str;
4525 const cc = comment.replace(/[\s\S]^/gm, `$&${indent}#`);
4526 return `#${cc}
4527${indent}${str}`;
4528 }
4529 function addComment(str, indent, comment) {
4530 return !comment ? str : comment.indexOf("\n") === -1 ? `${str} #${comment}` : `${str}
4531` + comment.replace(/^/gm, `${indent || ""}#`);
4532 }
4533 var Node = class {
4534 };
4535 function toJSON(value, arg, ctx) {
4536 if (Array.isArray(value))
4537 return value.map((v, i) => toJSON(v, String(i), ctx));
4538 if (value && typeof value.toJSON === "function") {
4539 const anchor = ctx && ctx.anchors && ctx.anchors.get(value);
4540 if (anchor)
4541 ctx.onCreate = (res2) => {
4542 anchor.res = res2;
4543 delete ctx.onCreate;
4544 };
4545 const res = value.toJSON(arg, ctx);
4546 if (anchor && ctx.onCreate)
4547 ctx.onCreate(res);
4548 return res;
4549 }
4550 if ((!ctx || !ctx.keep) && typeof value === "bigint")
4551 return Number(value);
4552 return value;
4553 }
4554 var Scalar = class extends Node {
4555 constructor(value) {
4556 super();
4557 this.value = value;
4558 }
4559 toJSON(arg, ctx) {
4560 return ctx && ctx.keep ? this.value : toJSON(this.value, arg, ctx);
4561 }
4562 toString() {
4563 return String(this.value);
4564 }
4565 };
4566 function collectionFromPath(schema, path, value) {
4567 let v = value;
4568 for (let i = path.length - 1; i >= 0; --i) {
4569 const k = path[i];
4570 if (Number.isInteger(k) && k >= 0) {
4571 const a = [];
4572 a[k] = v;
4573 v = a;
4574 } else {
4575 const o = {};
4576 Object.defineProperty(o, k, {
4577 value: v,
4578 writable: true,
4579 enumerable: true,
4580 configurable: true
4581 });
4582 v = o;
4583 }
4584 }
4585 return schema.createNode(v, false);
4586 }
4587 var isEmptyPath = (path) => path == null || typeof path === "object" && path[Symbol.iterator]().next().done;
4588 var Collection = class extends Node {
4589 constructor(schema) {
4590 super();
4591 PlainValue._defineProperty(this, "items", []);
4592 this.schema = schema;
4593 }
4594 addIn(path, value) {
4595 if (isEmptyPath(path))
4596 this.add(value);
4597 else {
4598 const [key, ...rest] = path;
4599 const node = this.get(key, true);
4600 if (node instanceof Collection)
4601 node.addIn(rest, value);
4602 else if (node === void 0 && this.schema)
4603 this.set(key, collectionFromPath(this.schema, rest, value));
4604 else
4605 throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
4606 }
4607 }
4608 deleteIn([key, ...rest]) {
4609 if (rest.length === 0)
4610 return this.delete(key);
4611 const node = this.get(key, true);
4612 if (node instanceof Collection)
4613 return node.deleteIn(rest);
4614 else
4615 throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
4616 }
4617 getIn([key, ...rest], keepScalar) {
4618 const node = this.get(key, true);
4619 if (rest.length === 0)
4620 return !keepScalar && node instanceof Scalar ? node.value : node;
4621 else
4622 return node instanceof Collection ? node.getIn(rest, keepScalar) : void 0;
4623 }
4624 hasAllNullValues() {
4625 return this.items.every((node) => {
4626 if (!node || node.type !== "PAIR")
4627 return false;
4628 const n = node.value;
4629 return n == null || n instanceof Scalar && n.value == null && !n.commentBefore && !n.comment && !n.tag;
4630 });
4631 }
4632 hasIn([key, ...rest]) {
4633 if (rest.length === 0)
4634 return this.has(key);
4635 const node = this.get(key, true);
4636 return node instanceof Collection ? node.hasIn(rest) : false;
4637 }
4638 setIn([key, ...rest], value) {
4639 if (rest.length === 0) {
4640 this.set(key, value);
4641 } else {
4642 const node = this.get(key, true);
4643 if (node instanceof Collection)
4644 node.setIn(rest, value);
4645 else if (node === void 0 && this.schema)
4646 this.set(key, collectionFromPath(this.schema, rest, value));
4647 else
4648 throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
4649 }
4650 }
4651 toJSON() {
4652 return null;
4653 }
4654 toString(ctx, {
4655 blockItem,
4656 flowChars,
4657 isMap,
4658 itemIndent
4659 }, onComment, onChompKeep) {
4660 const {
4661 indent,
4662 indentStep,
4663 stringify
4664 } = ctx;
4665 const inFlow = this.type === PlainValue.Type.FLOW_MAP || this.type === PlainValue.Type.FLOW_SEQ || ctx.inFlow;
4666 if (inFlow)
4667 itemIndent += indentStep;
4668 const allNullValues = isMap && this.hasAllNullValues();
4669 ctx = Object.assign({}, ctx, {
4670 allNullValues,
4671 indent: itemIndent,
4672 inFlow,
4673 type: null
4674 });
4675 let chompKeep = false;
4676 let hasItemWithNewLine = false;
4677 const nodes = this.items.reduce((nodes2, item, i) => {
4678 let comment;
4679 if (item) {
4680 if (!chompKeep && item.spaceBefore)
4681 nodes2.push({
4682 type: "comment",
4683 str: ""
4684 });
4685 if (item.commentBefore)
4686 item.commentBefore.match(/^.*$/gm).forEach((line) => {
4687 nodes2.push({
4688 type: "comment",
4689 str: `#${line}`
4690 });
4691 });
4692 if (item.comment)
4693 comment = item.comment;
4694 if (inFlow && (!chompKeep && item.spaceBefore || item.commentBefore || item.comment || item.key && (item.key.commentBefore || item.key.comment) || item.value && (item.value.commentBefore || item.value.comment)))
4695 hasItemWithNewLine = true;
4696 }
4697 chompKeep = false;
4698 let str2 = stringify(item, ctx, () => comment = null, () => chompKeep = true);
4699 if (inFlow && !hasItemWithNewLine && str2.includes("\n"))
4700 hasItemWithNewLine = true;
4701 if (inFlow && i < this.items.length - 1)
4702 str2 += ",";
4703 str2 = addComment(str2, itemIndent, comment);
4704 if (chompKeep && (comment || inFlow))
4705 chompKeep = false;
4706 nodes2.push({
4707 type: "item",
4708 str: str2
4709 });
4710 return nodes2;
4711 }, []);
4712 let str;
4713 if (nodes.length === 0) {
4714 str = flowChars.start + flowChars.end;
4715 } else if (inFlow) {
4716 const {
4717 start,
4718 end
4719 } = flowChars;
4720 const strings = nodes.map((n) => n.str);
4721 if (hasItemWithNewLine || strings.reduce((sum, str2) => sum + str2.length + 2, 2) > Collection.maxFlowStringSingleLineLength) {
4722 str = start;
4723 for (const s of strings) {
4724 str += s ? `
4725${indentStep}${indent}${s}` : "\n";
4726 }
4727 str += `
4728${indent}${end}`;
4729 } else {
4730 str = `${start} ${strings.join(" ")} ${end}`;
4731 }
4732 } else {
4733 const strings = nodes.map(blockItem);
4734 str = strings.shift();
4735 for (const s of strings)
4736 str += s ? `
4737${indent}${s}` : "\n";
4738 }
4739 if (this.comment) {
4740 str += "\n" + this.comment.replace(/^/gm, `${indent}#`);
4741 if (onComment)
4742 onComment();
4743 } else if (chompKeep && onChompKeep)
4744 onChompKeep();
4745 return str;
4746 }
4747 };
4748 PlainValue._defineProperty(Collection, "maxFlowStringSingleLineLength", 60);
4749 function asItemIndex(key) {
4750 let idx = key instanceof Scalar ? key.value : key;
4751 if (idx && typeof idx === "string")
4752 idx = Number(idx);
4753 return Number.isInteger(idx) && idx >= 0 ? idx : null;
4754 }
4755 var YAMLSeq = class extends Collection {
4756 add(value) {
4757 this.items.push(value);
4758 }
4759 delete(key) {
4760 const idx = asItemIndex(key);
4761 if (typeof idx !== "number")
4762 return false;
4763 const del = this.items.splice(idx, 1);
4764 return del.length > 0;
4765 }
4766 get(key, keepScalar) {
4767 const idx = asItemIndex(key);
4768 if (typeof idx !== "number")
4769 return void 0;
4770 const it = this.items[idx];
4771 return !keepScalar && it instanceof Scalar ? it.value : it;
4772 }
4773 has(key) {
4774 const idx = asItemIndex(key);
4775 return typeof idx === "number" && idx < this.items.length;
4776 }
4777 set(key, value) {
4778 const idx = asItemIndex(key);
4779 if (typeof idx !== "number")
4780 throw new Error(`Expected a valid index, not ${key}.`);
4781 this.items[idx] = value;
4782 }
4783 toJSON(_, ctx) {
4784 const seq = [];
4785 if (ctx && ctx.onCreate)
4786 ctx.onCreate(seq);
4787 let i = 0;
4788 for (const item of this.items)
4789 seq.push(toJSON(item, String(i++), ctx));
4790 return seq;
4791 }
4792 toString(ctx, onComment, onChompKeep) {
4793 if (!ctx)
4794 return JSON.stringify(this);
4795 return super.toString(ctx, {
4796 blockItem: (n) => n.type === "comment" ? n.str : `- ${n.str}`,
4797 flowChars: {
4798 start: "[",
4799 end: "]"
4800 },
4801 isMap: false,
4802 itemIndent: (ctx.indent || "") + " "
4803 }, onComment, onChompKeep);
4804 }
4805 };
4806 var stringifyKey = (key, jsKey, ctx) => {
4807 if (jsKey === null)
4808 return "";
4809 if (typeof jsKey !== "object")
4810 return String(jsKey);
4811 if (key instanceof Node && ctx && ctx.doc)
4812 return key.toString({
4813 anchors: /* @__PURE__ */ Object.create(null),
4814 doc: ctx.doc,
4815 indent: "",
4816 indentStep: ctx.indentStep,
4817 inFlow: true,
4818 inStringifyKey: true,
4819 stringify: ctx.stringify
4820 });
4821 return JSON.stringify(jsKey);
4822 };
4823 var Pair = class extends Node {
4824 constructor(key, value = null) {
4825 super();
4826 this.key = key;
4827 this.value = value;
4828 this.type = Pair.Type.PAIR;
4829 }
4830 get commentBefore() {
4831 return this.key instanceof Node ? this.key.commentBefore : void 0;
4832 }
4833 set commentBefore(cb) {
4834 if (this.key == null)
4835 this.key = new Scalar(null);
4836 if (this.key instanceof Node)
4837 this.key.commentBefore = cb;
4838 else {
4839 const msg = "Pair.commentBefore is an alias for Pair.key.commentBefore. To set it, the key must be a Node.";
4840 throw new Error(msg);
4841 }
4842 }
4843 addToJSMap(ctx, map) {
4844 const key = toJSON(this.key, "", ctx);
4845 if (map instanceof Map) {
4846 const value = toJSON(this.value, key, ctx);
4847 map.set(key, value);
4848 } else if (map instanceof Set) {
4849 map.add(key);
4850 } else {
4851 const stringKey = stringifyKey(this.key, key, ctx);
4852 const value = toJSON(this.value, stringKey, ctx);
4853 if (stringKey in map)
4854 Object.defineProperty(map, stringKey, {
4855 value,
4856 writable: true,
4857 enumerable: true,
4858 configurable: true
4859 });
4860 else
4861 map[stringKey] = value;
4862 }
4863 return map;
4864 }
4865 toJSON(_, ctx) {
4866 const pair = ctx && ctx.mapAsMap ? /* @__PURE__ */ new Map() : {};
4867 return this.addToJSMap(ctx, pair);
4868 }
4869 toString(ctx, onComment, onChompKeep) {
4870 if (!ctx || !ctx.doc)
4871 return JSON.stringify(this);
4872 const {
4873 indent: indentSize,
4874 indentSeq,
4875 simpleKeys
4876 } = ctx.doc.options;
4877 let {
4878 key,
4879 value
4880 } = this;
4881 let keyComment = key instanceof Node && key.comment;
4882 if (simpleKeys) {
4883 if (keyComment) {
4884 throw new Error("With simple keys, key nodes cannot have comments");
4885 }
4886 if (key instanceof Collection) {
4887 const msg = "With simple keys, collection cannot be used as a key value";
4888 throw new Error(msg);
4889 }
4890 }
4891 let explicitKey = !simpleKeys && (!key || keyComment || (key instanceof Node ? key instanceof Collection || key.type === PlainValue.Type.BLOCK_FOLDED || key.type === PlainValue.Type.BLOCK_LITERAL : typeof key === "object"));
4892 const {
4893 doc,
4894 indent,
4895 indentStep,
4896 stringify
4897 } = ctx;
4898 ctx = Object.assign({}, ctx, {
4899 implicitKey: !explicitKey,
4900 indent: indent + indentStep
4901 });
4902 let chompKeep = false;
4903 let str = stringify(key, ctx, () => keyComment = null, () => chompKeep = true);
4904 str = addComment(str, ctx.indent, keyComment);
4905 if (!explicitKey && str.length > 1024) {
4906 if (simpleKeys)
4907 throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
4908 explicitKey = true;
4909 }
4910 if (ctx.allNullValues && !simpleKeys) {
4911 if (this.comment) {
4912 str = addComment(str, ctx.indent, this.comment);
4913 if (onComment)
4914 onComment();
4915 } else if (chompKeep && !keyComment && onChompKeep)
4916 onChompKeep();
4917 return ctx.inFlow && !explicitKey ? str : `? ${str}`;
4918 }
4919 str = explicitKey ? `? ${str}
4920${indent}:` : `${str}:`;
4921 if (this.comment) {
4922 str = addComment(str, ctx.indent, this.comment);
4923 if (onComment)
4924 onComment();
4925 }
4926 let vcb = "";
4927 let valueComment = null;
4928 if (value instanceof Node) {
4929 if (value.spaceBefore)
4930 vcb = "\n";
4931 if (value.commentBefore) {
4932 const cs = value.commentBefore.replace(/^/gm, `${ctx.indent}#`);
4933 vcb += `
4934${cs}`;
4935 }
4936 valueComment = value.comment;
4937 } else if (value && typeof value === "object") {
4938 value = doc.schema.createNode(value, true);
4939 }
4940 ctx.implicitKey = false;
4941 if (!explicitKey && !this.comment && value instanceof Scalar)
4942 ctx.indentAtStart = str.length + 1;
4943 chompKeep = false;
4944 if (!indentSeq && indentSize >= 2 && !ctx.inFlow && !explicitKey && value instanceof YAMLSeq && value.type !== PlainValue.Type.FLOW_SEQ && !value.tag && !doc.anchors.getName(value)) {
4945 ctx.indent = ctx.indent.substr(2);
4946 }
4947 const valueStr = stringify(value, ctx, () => valueComment = null, () => chompKeep = true);
4948 let ws = " ";
4949 if (vcb || this.comment) {
4950 ws = `${vcb}
4951${ctx.indent}`;
4952 } else if (!explicitKey && value instanceof Collection) {
4953 const flow = valueStr[0] === "[" || valueStr[0] === "{";
4954 if (!flow || valueStr.includes("\n"))
4955 ws = `
4956${ctx.indent}`;
4957 } else if (valueStr[0] === "\n")
4958 ws = "";
4959 if (chompKeep && !valueComment && onChompKeep)
4960 onChompKeep();
4961 return addComment(str + ws + valueStr, ctx.indent, valueComment);
4962 }
4963 };
4964 PlainValue._defineProperty(Pair, "Type", {
4965 PAIR: "PAIR",
4966 MERGE_PAIR: "MERGE_PAIR"
4967 });
4968 var getAliasCount = (node, anchors) => {
4969 if (node instanceof Alias) {
4970 const anchor = anchors.get(node.source);
4971 return anchor.count * anchor.aliasCount;
4972 } else if (node instanceof Collection) {
4973 let count = 0;
4974 for (const item of node.items) {
4975 const c = getAliasCount(item, anchors);
4976 if (c > count)
4977 count = c;
4978 }
4979 return count;
4980 } else if (node instanceof Pair) {
4981 const kc = getAliasCount(node.key, anchors);
4982 const vc = getAliasCount(node.value, anchors);
4983 return Math.max(kc, vc);
4984 }
4985 return 1;
4986 };
4987 var Alias = class extends Node {
4988 static stringify({
4989 range,
4990 source
4991 }, {
4992 anchors,
4993 doc,
4994 implicitKey,
4995 inStringifyKey
4996 }) {
4997 let anchor = Object.keys(anchors).find((a) => anchors[a] === source);
4998 if (!anchor && inStringifyKey)
4999 anchor = doc.anchors.getName(source) || doc.anchors.newName();
5000 if (anchor)
5001 return `*${anchor}${implicitKey ? " " : ""}`;
5002 const msg = doc.anchors.getName(source) ? "Alias node must be after source node" : "Source node not found for alias node";
5003 throw new Error(`${msg} [${range}]`);
5004 }
5005 constructor(source) {
5006 super();
5007 this.source = source;
5008 this.type = PlainValue.Type.ALIAS;
5009 }
5010 set tag(t) {
5011 throw new Error("Alias nodes cannot have tags");
5012 }
5013 toJSON(arg, ctx) {
5014 if (!ctx)
5015 return toJSON(this.source, arg, ctx);
5016 const {
5017 anchors,
5018 maxAliasCount
5019 } = ctx;
5020 const anchor = anchors.get(this.source);
5021 if (!anchor || anchor.res === void 0) {
5022 const msg = "This should not happen: Alias anchor was not resolved?";
5023 if (this.cstNode)
5024 throw new PlainValue.YAMLReferenceError(this.cstNode, msg);
5025 else
5026 throw new ReferenceError(msg);
5027 }
5028 if (maxAliasCount >= 0) {
5029 anchor.count += 1;
5030 if (anchor.aliasCount === 0)
5031 anchor.aliasCount = getAliasCount(this.source, anchors);
5032 if (anchor.count * anchor.aliasCount > maxAliasCount) {
5033 const msg = "Excessive alias count indicates a resource exhaustion attack";
5034 if (this.cstNode)
5035 throw new PlainValue.YAMLReferenceError(this.cstNode, msg);
5036 else
5037 throw new ReferenceError(msg);
5038 }
5039 }
5040 return anchor.res;
5041 }
5042 toString(ctx) {
5043 return Alias.stringify(this, ctx);
5044 }
5045 };
5046 PlainValue._defineProperty(Alias, "default", true);
5047 function findPair(items, key) {
5048 const k = key instanceof Scalar ? key.value : key;
5049 for (const it of items) {
5050 if (it instanceof Pair) {
5051 if (it.key === key || it.key === k)
5052 return it;
5053 if (it.key && it.key.value === k)
5054 return it;
5055 }
5056 }
5057 return void 0;
5058 }
5059 var YAMLMap = class extends Collection {
5060 add(pair, overwrite) {
5061 if (!pair)
5062 pair = new Pair(pair);
5063 else if (!(pair instanceof Pair))
5064 pair = new Pair(pair.key || pair, pair.value);
5065 const prev = findPair(this.items, pair.key);
5066 const sortEntries = this.schema && this.schema.sortMapEntries;
5067 if (prev) {
5068 if (overwrite)
5069 prev.value = pair.value;
5070 else
5071 throw new Error(`Key ${pair.key} already set`);
5072 } else if (sortEntries) {
5073 const i = this.items.findIndex((item) => sortEntries(pair, item) < 0);
5074 if (i === -1)
5075 this.items.push(pair);
5076 else
5077 this.items.splice(i, 0, pair);
5078 } else {
5079 this.items.push(pair);
5080 }
5081 }
5082 delete(key) {
5083 const it = findPair(this.items, key);
5084 if (!it)
5085 return false;
5086 const del = this.items.splice(this.items.indexOf(it), 1);
5087 return del.length > 0;
5088 }
5089 get(key, keepScalar) {
5090 const it = findPair(this.items, key);
5091 const node = it && it.value;
5092 return !keepScalar && node instanceof Scalar ? node.value : node;
5093 }
5094 has(key) {
5095 return !!findPair(this.items, key);
5096 }
5097 set(key, value) {
5098 this.add(new Pair(key, value), true);
5099 }
5100 toJSON(_, ctx, Type) {
5101 const map = Type ? new Type() : ctx && ctx.mapAsMap ? /* @__PURE__ */ new Map() : {};
5102 if (ctx && ctx.onCreate)
5103 ctx.onCreate(map);
5104 for (const item of this.items)
5105 item.addToJSMap(ctx, map);
5106 return map;
5107 }
5108 toString(ctx, onComment, onChompKeep) {
5109 if (!ctx)
5110 return JSON.stringify(this);
5111 for (const item of this.items) {
5112 if (!(item instanceof Pair))
5113 throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
5114 }
5115 return super.toString(ctx, {
5116 blockItem: (n) => n.str,
5117 flowChars: {
5118 start: "{",
5119 end: "}"
5120 },
5121 isMap: true,
5122 itemIndent: ctx.indent || ""
5123 }, onComment, onChompKeep);
5124 }
5125 };
5126 var MERGE_KEY = "<<";
5127 var Merge = class extends Pair {
5128 constructor(pair) {
5129 if (pair instanceof Pair) {
5130 let seq = pair.value;
5131 if (!(seq instanceof YAMLSeq)) {
5132 seq = new YAMLSeq();
5133 seq.items.push(pair.value);
5134 seq.range = pair.value.range;
5135 }
5136 super(pair.key, seq);
5137 this.range = pair.range;
5138 } else {
5139 super(new Scalar(MERGE_KEY), new YAMLSeq());
5140 }
5141 this.type = Pair.Type.MERGE_PAIR;
5142 }
5143 addToJSMap(ctx, map) {
5144 for (const {
5145 source
5146 } of this.value.items) {
5147 if (!(source instanceof YAMLMap))
5148 throw new Error("Merge sources must be maps");
5149 const srcMap = source.toJSON(null, ctx, Map);
5150 for (const [key, value] of srcMap) {
5151 if (map instanceof Map) {
5152 if (!map.has(key))
5153 map.set(key, value);
5154 } else if (map instanceof Set) {
5155 map.add(key);
5156 } else if (!Object.prototype.hasOwnProperty.call(map, key)) {
5157 Object.defineProperty(map, key, {
5158 value,
5159 writable: true,
5160 enumerable: true,
5161 configurable: true
5162 });
5163 }
5164 }
5165 }
5166 return map;
5167 }
5168 toString(ctx, onComment) {
5169 const seq = this.value;
5170 if (seq.items.length > 1)
5171 return super.toString(ctx, onComment);
5172 this.value = seq.items[0];
5173 const str = super.toString(ctx, onComment);
5174 this.value = seq;
5175 return str;
5176 }
5177 };
5178 var binaryOptions = {
5179 defaultType: PlainValue.Type.BLOCK_LITERAL,
5180 lineWidth: 76
5181 };
5182 var boolOptions = {
5183 trueStr: "true",
5184 falseStr: "false"
5185 };
5186 var intOptions = {
5187 asBigInt: false
5188 };
5189 var nullOptions = {
5190 nullStr: "null"
5191 };
5192 var strOptions = {
5193 defaultType: PlainValue.Type.PLAIN,
5194 doubleQuoted: {
5195 jsonEncoding: false,
5196 minMultiLineLength: 40
5197 },
5198 fold: {
5199 lineWidth: 80,
5200 minContentWidth: 20
5201 }
5202 };
5203 function resolveScalar(str, tags, scalarFallback) {
5204 for (const {
5205 format,
5206 test,
5207 resolve
5208 } of tags) {
5209 if (test) {
5210 const match = str.match(test);
5211 if (match) {
5212 let res = resolve.apply(null, match);
5213 if (!(res instanceof Scalar))
5214 res = new Scalar(res);
5215 if (format)
5216 res.format = format;
5217 return res;
5218 }
5219 }
5220 }
5221 if (scalarFallback)
5222 str = scalarFallback(str);
5223 return new Scalar(str);
5224 }
5225 var FOLD_FLOW = "flow";
5226 var FOLD_BLOCK = "block";
5227 var FOLD_QUOTED = "quoted";
5228 var consumeMoreIndentedLines = (text, i) => {
5229 let ch = text[i + 1];
5230 while (ch === " " || ch === " ") {
5231 do {
5232 ch = text[i += 1];
5233 } while (ch && ch !== "\n");
5234 ch = text[i + 1];
5235 }
5236 return i;
5237 };
5238 function foldFlowLines(text, indent, mode, {
5239 indentAtStart,
5240 lineWidth = 80,
5241 minContentWidth = 20,
5242 onFold,
5243 onOverflow
5244 }) {
5245 if (!lineWidth || lineWidth < 0)
5246 return text;
5247 const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
5248 if (text.length <= endStep)
5249 return text;
5250 const folds = [];
5251 const escapedFolds = {};
5252 let end = lineWidth - indent.length;
5253 if (typeof indentAtStart === "number") {
5254 if (indentAtStart > lineWidth - Math.max(2, minContentWidth))
5255 folds.push(0);
5256 else
5257 end = lineWidth - indentAtStart;
5258 }
5259 let split = void 0;
5260 let prev = void 0;
5261 let overflow = false;
5262 let i = -1;
5263 let escStart = -1;
5264 let escEnd = -1;
5265 if (mode === FOLD_BLOCK) {
5266 i = consumeMoreIndentedLines(text, i);
5267 if (i !== -1)
5268 end = i + endStep;
5269 }
5270 for (let ch; ch = text[i += 1]; ) {
5271 if (mode === FOLD_QUOTED && ch === "\\") {
5272 escStart = i;
5273 switch (text[i + 1]) {
5274 case "x":
5275 i += 3;
5276 break;
5277 case "u":
5278 i += 5;
5279 break;
5280 case "U":
5281 i += 9;
5282 break;
5283 default:
5284 i += 1;
5285 }
5286 escEnd = i;
5287 }
5288 if (ch === "\n") {
5289 if (mode === FOLD_BLOCK)
5290 i = consumeMoreIndentedLines(text, i);
5291 end = i + endStep;
5292 split = void 0;
5293 } else {
5294 if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
5295 const next = text[i + 1];
5296 if (next && next !== " " && next !== "\n" && next !== " ")
5297 split = i;
5298 }
5299 if (i >= end) {
5300 if (split) {
5301 folds.push(split);
5302 end = split + endStep;
5303 split = void 0;
5304 } else if (mode === FOLD_QUOTED) {
5305 while (prev === " " || prev === " ") {
5306 prev = ch;
5307 ch = text[i += 1];
5308 overflow = true;
5309 }
5310 const j = i > escEnd + 1 ? i - 2 : escStart - 1;
5311 if (escapedFolds[j])
5312 return text;
5313 folds.push(j);
5314 escapedFolds[j] = true;
5315 end = j + endStep;
5316 split = void 0;
5317 } else {
5318 overflow = true;
5319 }
5320 }
5321 }
5322 prev = ch;
5323 }
5324 if (overflow && onOverflow)
5325 onOverflow();
5326 if (folds.length === 0)
5327 return text;
5328 if (onFold)
5329 onFold();
5330 let res = text.slice(0, folds[0]);
5331 for (let i2 = 0; i2 < folds.length; ++i2) {
5332 const fold = folds[i2];
5333 const end2 = folds[i2 + 1] || text.length;
5334 if (fold === 0)
5335 res = `
5336${indent}${text.slice(0, end2)}`;
5337 else {
5338 if (mode === FOLD_QUOTED && escapedFolds[fold])
5339 res += `${text[fold]}\\`;
5340 res += `
5341${indent}${text.slice(fold + 1, end2)}`;
5342 }
5343 }
5344 return res;
5345 }
5346 var getFoldOptions = ({
5347 indentAtStart
5348 }) => indentAtStart ? Object.assign({
5349 indentAtStart
5350 }, strOptions.fold) : strOptions.fold;
5351 var containsDocumentMarker = (str) => /^(%|---|\.\.\.)/m.test(str);
5352 function lineLengthOverLimit(str, lineWidth, indentLength) {
5353 if (!lineWidth || lineWidth < 0)
5354 return false;
5355 const limit = lineWidth - indentLength;
5356 const strLen = str.length;
5357 if (strLen <= limit)
5358 return false;
5359 for (let i = 0, start = 0; i < strLen; ++i) {
5360 if (str[i] === "\n") {
5361 if (i - start > limit)
5362 return true;
5363 start = i + 1;
5364 if (strLen - start <= limit)
5365 return false;
5366 }
5367 }
5368 return true;
5369 }
5370 function doubleQuotedString(value, ctx) {
5371 const {
5372 implicitKey
5373 } = ctx;
5374 const {
5375 jsonEncoding,
5376 minMultiLineLength
5377 } = strOptions.doubleQuoted;
5378 const json = JSON.stringify(value);
5379 if (jsonEncoding)
5380 return json;
5381 const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
5382 let str = "";
5383 let start = 0;
5384 for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
5385 if (ch === " " && json[i + 1] === "\\" && json[i + 2] === "n") {
5386 str += json.slice(start, i) + "\\ ";
5387 i += 1;
5388 start = i;
5389 ch = "\\";
5390 }
5391 if (ch === "\\")
5392 switch (json[i + 1]) {
5393 case "u":
5394 {
5395 str += json.slice(start, i);
5396 const code = json.substr(i + 2, 4);
5397 switch (code) {
5398 case "0000":
5399 str += "\\0";
5400 break;
5401 case "0007":
5402 str += "\\a";
5403 break;
5404 case "000b":
5405 str += "\\v";
5406 break;
5407 case "001b":
5408 str += "\\e";
5409 break;
5410 case "0085":
5411 str += "\\N";
5412 break;
5413 case "00a0":
5414 str += "\\_";
5415 break;
5416 case "2028":
5417 str += "\\L";
5418 break;
5419 case "2029":
5420 str += "\\P";
5421 break;
5422 default:
5423 if (code.substr(0, 2) === "00")
5424 str += "\\x" + code.substr(2);
5425 else
5426 str += json.substr(i, 6);
5427 }
5428 i += 5;
5429 start = i + 1;
5430 }
5431 break;
5432 case "n":
5433 if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) {
5434 i += 1;
5435 } else {
5436 str += json.slice(start, i) + "\n\n";
5437 while (json[i + 2] === "\\" && json[i + 3] === "n" && json[i + 4] !== '"') {
5438 str += "\n";
5439 i += 2;
5440 }
5441 str += indent;
5442 if (json[i + 2] === " ")
5443 str += "\\";
5444 i += 1;
5445 start = i + 1;
5446 }
5447 break;
5448 default:
5449 i += 1;
5450 }
5451 }
5452 str = start ? str + json.slice(start) : json;
5453 return implicitKey ? str : foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx));
5454 }
5455 function singleQuotedString(value, ctx) {
5456 if (ctx.implicitKey) {
5457 if (/\n/.test(value))
5458 return doubleQuotedString(value, ctx);
5459 } else {
5460 if (/[ \t]\n|\n[ \t]/.test(value))
5461 return doubleQuotedString(value, ctx);
5462 }
5463 const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
5464 const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&
5465${indent}`) + "'";
5466 return ctx.implicitKey ? res : foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx));
5467 }
5468 function blockString({
5469 comment,
5470 type,
5471 value
5472 }, ctx, onComment, onChompKeep) {
5473 if (/\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
5474 return doubleQuotedString(value, ctx);
5475 }
5476 const indent = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? " " : "");
5477 const indentSize = indent ? "2" : "1";
5478 const literal = type === PlainValue.Type.BLOCK_FOLDED ? false : type === PlainValue.Type.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, strOptions.fold.lineWidth, indent.length);
5479 let header = literal ? "|" : ">";
5480 if (!value)
5481 return header + "\n";
5482 let wsStart = "";
5483 let wsEnd = "";
5484 value = value.replace(/[\n\t ]*$/, (ws) => {
5485 const n = ws.indexOf("\n");
5486 if (n === -1) {
5487 header += "-";
5488 } else if (value === ws || n !== ws.length - 1) {
5489 header += "+";
5490 if (onChompKeep)
5491 onChompKeep();
5492 }
5493 wsEnd = ws.replace(/\n$/, "");
5494 return "";
5495 }).replace(/^[\n ]*/, (ws) => {
5496 if (ws.indexOf(" ") !== -1)
5497 header += indentSize;
5498 const m = ws.match(/ +$/);
5499 if (m) {
5500 wsStart = ws.slice(0, -m[0].length);
5501 return m[0];
5502 } else {
5503 wsStart = ws;
5504 return "";
5505 }
5506 });
5507 if (wsEnd)
5508 wsEnd = wsEnd.replace(/\n+(?!\n|$)/g, `$&${indent}`);
5509 if (wsStart)
5510 wsStart = wsStart.replace(/\n+/g, `$&${indent}`);
5511 if (comment) {
5512 header += " #" + comment.replace(/ ?[\r\n]+/g, " ");
5513 if (onComment)
5514 onComment();
5515 }
5516 if (!value)
5517 return `${header}${indentSize}
5518${indent}${wsEnd}`;
5519 if (literal) {
5520 value = value.replace(/\n+/g, `$&${indent}`);
5521 return `${header}
5522${indent}${wsStart}${value}${wsEnd}`;
5523 }
5524 value = value.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${indent}`);
5525 const body = foldFlowLines(`${wsStart}${value}${wsEnd}`, indent, FOLD_BLOCK, strOptions.fold);
5526 return `${header}
5527${indent}${body}`;
5528 }
5529 function plainString(item, ctx, onComment, onChompKeep) {
5530 const {
5531 comment,
5532 type,
5533 value
5534 } = item;
5535 const {
5536 actualString,
5537 implicitKey,
5538 indent,
5539 inFlow
5540 } = ctx;
5541 if (implicitKey && /[\n[\]{},]/.test(value) || inFlow && /[[\]{},]/.test(value)) {
5542 return doubleQuotedString(value, ctx);
5543 }
5544 if (!value || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
5545 return implicitKey || inFlow || value.indexOf("\n") === -1 ? value.indexOf('"') !== -1 && value.indexOf("'") === -1 ? singleQuotedString(value, ctx) : doubleQuotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep);
5546 }
5547 if (!implicitKey && !inFlow && type !== PlainValue.Type.PLAIN && value.indexOf("\n") !== -1) {
5548 return blockString(item, ctx, onComment, onChompKeep);
5549 }
5550 if (indent === "" && containsDocumentMarker(value)) {
5551 ctx.forceBlockIndent = true;
5552 return blockString(item, ctx, onComment, onChompKeep);
5553 }
5554 const str = value.replace(/\n+/g, `$&
5555${indent}`);
5556 if (actualString) {
5557 const {
5558 tags
5559 } = ctx.doc.schema;
5560 const resolved = resolveScalar(str, tags, tags.scalarFallback).value;
5561 if (typeof resolved !== "string")
5562 return doubleQuotedString(value, ctx);
5563 }
5564 const body = implicitKey ? str : foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx));
5565 if (comment && !inFlow && (body.indexOf("\n") !== -1 || comment.indexOf("\n") !== -1)) {
5566 if (onComment)
5567 onComment();
5568 return addCommentBefore(body, indent, comment);
5569 }
5570 return body;
5571 }
5572 function stringifyString(item, ctx, onComment, onChompKeep) {
5573 const {
5574 defaultType
5575 } = strOptions;
5576 const {
5577 implicitKey,
5578 inFlow
5579 } = ctx;
5580 let {
5581 type,
5582 value
5583 } = item;
5584 if (typeof value !== "string") {
5585 value = String(value);
5586 item = Object.assign({}, item, {
5587 value
5588 });
5589 }
5590 const _stringify = (_type) => {
5591 switch (_type) {
5592 case PlainValue.Type.BLOCK_FOLDED:
5593 case PlainValue.Type.BLOCK_LITERAL:
5594 return blockString(item, ctx, onComment, onChompKeep);
5595 case PlainValue.Type.QUOTE_DOUBLE:
5596 return doubleQuotedString(value, ctx);
5597 case PlainValue.Type.QUOTE_SINGLE:
5598 return singleQuotedString(value, ctx);
5599 case PlainValue.Type.PLAIN:
5600 return plainString(item, ctx, onComment, onChompKeep);
5601 default:
5602 return null;
5603 }
5604 };
5605 if (type !== PlainValue.Type.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(value)) {
5606 type = PlainValue.Type.QUOTE_DOUBLE;
5607 } else if ((implicitKey || inFlow) && (type === PlainValue.Type.BLOCK_FOLDED || type === PlainValue.Type.BLOCK_LITERAL)) {
5608 type = PlainValue.Type.QUOTE_DOUBLE;
5609 }
5610 let res = _stringify(type);
5611 if (res === null) {
5612 res = _stringify(defaultType);
5613 if (res === null)
5614 throw new Error(`Unsupported default string type ${defaultType}`);
5615 }
5616 return res;
5617 }
5618 function stringifyNumber({
5619 format,
5620 minFractionDigits,
5621 tag,
5622 value
5623 }) {
5624 if (typeof value === "bigint")
5625 return String(value);
5626 if (!isFinite(value))
5627 return isNaN(value) ? ".nan" : value < 0 ? "-.inf" : ".inf";
5628 let n = JSON.stringify(value);
5629 if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n)) {
5630 let i = n.indexOf(".");
5631 if (i < 0) {
5632 i = n.length;
5633 n += ".";
5634 }
5635 let d = minFractionDigits - (n.length - i - 1);
5636 while (d-- > 0)
5637 n += "0";
5638 }
5639 return n;
5640 }
5641 function checkFlowCollectionEnd(errors, cst) {
5642 let char, name;
5643 switch (cst.type) {
5644 case PlainValue.Type.FLOW_MAP:
5645 char = "}";
5646 name = "flow map";
5647 break;
5648 case PlainValue.Type.FLOW_SEQ:
5649 char = "]";
5650 name = "flow sequence";
5651 break;
5652 default:
5653 errors.push(new PlainValue.YAMLSemanticError(cst, "Not a flow collection!?"));
5654 return;
5655 }
5656 let lastItem;
5657 for (let i = cst.items.length - 1; i >= 0; --i) {
5658 const item = cst.items[i];
5659 if (!item || item.type !== PlainValue.Type.COMMENT) {
5660 lastItem = item;
5661 break;
5662 }
5663 }
5664 if (lastItem && lastItem.char !== char) {
5665 const msg = `Expected ${name} to end with ${char}`;
5666 let err;
5667 if (typeof lastItem.offset === "number") {
5668 err = new PlainValue.YAMLSemanticError(cst, msg);
5669 err.offset = lastItem.offset + 1;
5670 } else {
5671 err = new PlainValue.YAMLSemanticError(lastItem, msg);
5672 if (lastItem.range && lastItem.range.end)
5673 err.offset = lastItem.range.end - lastItem.range.start;
5674 }
5675 errors.push(err);
5676 }
5677 }
5678 function checkFlowCommentSpace(errors, comment) {
5679 const prev = comment.context.src[comment.range.start - 1];
5680 if (prev !== "\n" && prev !== " " && prev !== " ") {
5681 const msg = "Comments must be separated from other tokens by white space characters";
5682 errors.push(new PlainValue.YAMLSemanticError(comment, msg));
5683 }
5684 }
5685 function getLongKeyError(source, key) {
5686 const sk = String(key);
5687 const k = sk.substr(0, 8) + "..." + sk.substr(-8);
5688 return new PlainValue.YAMLSemanticError(source, `The "${k}" key is too long`);
5689 }
5690 function resolveComments(collection, comments) {
5691 for (const {
5692 afterKey,
5693 before,
5694 comment
5695 } of comments) {
5696 let item = collection.items[before];
5697 if (!item) {
5698 if (comment !== void 0) {
5699 if (collection.comment)
5700 collection.comment += "\n" + comment;
5701 else
5702 collection.comment = comment;
5703 }
5704 } else {
5705 if (afterKey && item.value)
5706 item = item.value;
5707 if (comment === void 0) {
5708 if (afterKey || !item.commentBefore)
5709 item.spaceBefore = true;
5710 } else {
5711 if (item.commentBefore)
5712 item.commentBefore += "\n" + comment;
5713 else
5714 item.commentBefore = comment;
5715 }
5716 }
5717 }
5718 }
5719 function resolveString(doc, node) {
5720 const res = node.strValue;
5721 if (!res)
5722 return "";
5723 if (typeof res === "string")
5724 return res;
5725 res.errors.forEach((error) => {
5726 if (!error.source)
5727 error.source = node;
5728 doc.errors.push(error);
5729 });
5730 return res.str;
5731 }
5732 function resolveTagHandle(doc, node) {
5733 const {
5734 handle,
5735 suffix
5736 } = node.tag;
5737 let prefix = doc.tagPrefixes.find((p) => p.handle === handle);
5738 if (!prefix) {
5739 const dtp = doc.getDefaults().tagPrefixes;
5740 if (dtp)
5741 prefix = dtp.find((p) => p.handle === handle);
5742 if (!prefix)
5743 throw new PlainValue.YAMLSemanticError(node, `The ${handle} tag handle is non-default and was not declared.`);
5744 }
5745 if (!suffix)
5746 throw new PlainValue.YAMLSemanticError(node, `The ${handle} tag has no suffix.`);
5747 if (handle === "!" && (doc.version || doc.options.version) === "1.0") {
5748 if (suffix[0] === "^") {
5749 doc.warnings.push(new PlainValue.YAMLWarning(node, "YAML 1.0 ^ tag expansion is not supported"));
5750 return suffix;
5751 }
5752 if (/[:/]/.test(suffix)) {
5753 const vocab = suffix.match(/^([a-z0-9-]+)\/(.*)/i);
5754 return vocab ? `tag:${vocab[1]}.yaml.org,2002:${vocab[2]}` : `tag:${suffix}`;
5755 }
5756 }
5757 return prefix.prefix + decodeURIComponent(suffix);
5758 }
5759 function resolveTagName(doc, node) {
5760 const {
5761 tag,
5762 type
5763 } = node;
5764 let nonSpecific = false;
5765 if (tag) {
5766 const {
5767 handle,
5768 suffix,
5769 verbatim
5770 } = tag;
5771 if (verbatim) {
5772 if (verbatim !== "!" && verbatim !== "!!")
5773 return verbatim;
5774 const msg = `Verbatim tags aren't resolved, so ${verbatim} is invalid.`;
5775 doc.errors.push(new PlainValue.YAMLSemanticError(node, msg));
5776 } else if (handle === "!" && !suffix) {
5777 nonSpecific = true;
5778 } else {
5779 try {
5780 return resolveTagHandle(doc, node);
5781 } catch (error) {
5782 doc.errors.push(error);
5783 }
5784 }
5785 }
5786 switch (type) {
5787 case PlainValue.Type.BLOCK_FOLDED:
5788 case PlainValue.Type.BLOCK_LITERAL:
5789 case PlainValue.Type.QUOTE_DOUBLE:
5790 case PlainValue.Type.QUOTE_SINGLE:
5791 return PlainValue.defaultTags.STR;
5792 case PlainValue.Type.FLOW_MAP:
5793 case PlainValue.Type.MAP:
5794 return PlainValue.defaultTags.MAP;
5795 case PlainValue.Type.FLOW_SEQ:
5796 case PlainValue.Type.SEQ:
5797 return PlainValue.defaultTags.SEQ;
5798 case PlainValue.Type.PLAIN:
5799 return nonSpecific ? PlainValue.defaultTags.STR : null;
5800 default:
5801 return null;
5802 }
5803 }
5804 function resolveByTagName(doc, node, tagName) {
5805 const {
5806 tags
5807 } = doc.schema;
5808 const matchWithTest = [];
5809 for (const tag of tags) {
5810 if (tag.tag === tagName) {
5811 if (tag.test)
5812 matchWithTest.push(tag);
5813 else {
5814 const res = tag.resolve(doc, node);
5815 return res instanceof Collection ? res : new Scalar(res);
5816 }
5817 }
5818 }
5819 const str = resolveString(doc, node);
5820 if (typeof str === "string" && matchWithTest.length > 0)
5821 return resolveScalar(str, matchWithTest, tags.scalarFallback);
5822 return null;
5823 }
5824 function getFallbackTagName({
5825 type
5826 }) {
5827 switch (type) {
5828 case PlainValue.Type.FLOW_MAP:
5829 case PlainValue.Type.MAP:
5830 return PlainValue.defaultTags.MAP;
5831 case PlainValue.Type.FLOW_SEQ:
5832 case PlainValue.Type.SEQ:
5833 return PlainValue.defaultTags.SEQ;
5834 default:
5835 return PlainValue.defaultTags.STR;
5836 }
5837 }
5838 function resolveTag(doc, node, tagName) {
5839 try {
5840 const res = resolveByTagName(doc, node, tagName);
5841 if (res) {
5842 if (tagName && node.tag)
5843 res.tag = tagName;
5844 return res;
5845 }
5846 } catch (error) {
5847 if (!error.source)
5848 error.source = node;
5849 doc.errors.push(error);
5850 return null;
5851 }
5852 try {
5853 const fallback = getFallbackTagName(node);
5854 if (!fallback)
5855 throw new Error(`The tag ${tagName} is unavailable`);
5856 const msg = `The tag ${tagName} is unavailable, falling back to ${fallback}`;
5857 doc.warnings.push(new PlainValue.YAMLWarning(node, msg));
5858 const res = resolveByTagName(doc, node, fallback);
5859 res.tag = tagName;
5860 return res;
5861 } catch (error) {
5862 const refError = new PlainValue.YAMLReferenceError(node, error.message);
5863 refError.stack = error.stack;
5864 doc.errors.push(refError);
5865 return null;
5866 }
5867 }
5868 var isCollectionItem = (node) => {
5869 if (!node)
5870 return false;
5871 const {
5872 type
5873 } = node;
5874 return type === PlainValue.Type.MAP_KEY || type === PlainValue.Type.MAP_VALUE || type === PlainValue.Type.SEQ_ITEM;
5875 };
5876 function resolveNodeProps(errors, node) {
5877 const comments = {
5878 before: [],
5879 after: []
5880 };
5881 let hasAnchor = false;
5882 let hasTag = false;
5883 const props = isCollectionItem(node.context.parent) ? node.context.parent.props.concat(node.props) : node.props;
5884 for (const {
5885 start,
5886 end
5887 } of props) {
5888 switch (node.context.src[start]) {
5889 case PlainValue.Char.COMMENT: {
5890 if (!node.commentHasRequiredWhitespace(start)) {
5891 const msg = "Comments must be separated from other tokens by white space characters";
5892 errors.push(new PlainValue.YAMLSemanticError(node, msg));
5893 }
5894 const {
5895 header,
5896 valueRange
5897 } = node;
5898 const cc = valueRange && (start > valueRange.start || header && start > header.start) ? comments.after : comments.before;
5899 cc.push(node.context.src.slice(start + 1, end));
5900 break;
5901 }
5902 case PlainValue.Char.ANCHOR:
5903 if (hasAnchor) {
5904 const msg = "A node can have at most one anchor";
5905 errors.push(new PlainValue.YAMLSemanticError(node, msg));
5906 }
5907 hasAnchor = true;
5908 break;
5909 case PlainValue.Char.TAG:
5910 if (hasTag) {
5911 const msg = "A node can have at most one tag";
5912 errors.push(new PlainValue.YAMLSemanticError(node, msg));
5913 }
5914 hasTag = true;
5915 break;
5916 }
5917 }
5918 return {
5919 comments,
5920 hasAnchor,
5921 hasTag
5922 };
5923 }
5924 function resolveNodeValue(doc, node) {
5925 const {
5926 anchors,
5927 errors,
5928 schema
5929 } = doc;
5930 if (node.type === PlainValue.Type.ALIAS) {
5931 const name = node.rawValue;
5932 const src = anchors.getNode(name);
5933 if (!src) {
5934 const msg = `Aliased anchor not found: ${name}`;
5935 errors.push(new PlainValue.YAMLReferenceError(node, msg));
5936 return null;
5937 }
5938 const res = new Alias(src);
5939 anchors._cstAliases.push(res);
5940 return res;
5941 }
5942 const tagName = resolveTagName(doc, node);
5943 if (tagName)
5944 return resolveTag(doc, node, tagName);
5945 if (node.type !== PlainValue.Type.PLAIN) {
5946 const msg = `Failed to resolve ${node.type} node here`;
5947 errors.push(new PlainValue.YAMLSyntaxError(node, msg));
5948 return null;
5949 }
5950 try {
5951 const str = resolveString(doc, node);
5952 return resolveScalar(str, schema.tags, schema.tags.scalarFallback);
5953 } catch (error) {
5954 if (!error.source)
5955 error.source = node;
5956 errors.push(error);
5957 return null;
5958 }
5959 }
5960 function resolveNode(doc, node) {
5961 if (!node)
5962 return null;
5963 if (node.error)
5964 doc.errors.push(node.error);
5965 const {
5966 comments,
5967 hasAnchor,
5968 hasTag
5969 } = resolveNodeProps(doc.errors, node);
5970 if (hasAnchor) {
5971 const {
5972 anchors
5973 } = doc;
5974 const name = node.anchor;
5975 const prev = anchors.getNode(name);
5976 if (prev)
5977 anchors.map[anchors.newName(name)] = prev;
5978 anchors.map[name] = node;
5979 }
5980 if (node.type === PlainValue.Type.ALIAS && (hasAnchor || hasTag)) {
5981 const msg = "An alias node must not specify any properties";
5982 doc.errors.push(new PlainValue.YAMLSemanticError(node, msg));
5983 }
5984 const res = resolveNodeValue(doc, node);
5985 if (res) {
5986 res.range = [node.range.start, node.range.end];
5987 if (doc.options.keepCstNodes)
5988 res.cstNode = node;
5989 if (doc.options.keepNodeTypes)
5990 res.type = node.type;
5991 const cb = comments.before.join("\n");
5992 if (cb) {
5993 res.commentBefore = res.commentBefore ? `${res.commentBefore}
5994${cb}` : cb;
5995 }
5996 const ca = comments.after.join("\n");
5997 if (ca)
5998 res.comment = res.comment ? `${res.comment}
5999${ca}` : ca;
6000 }
6001 return node.resolved = res;
6002 }
6003 function resolveMap(doc, cst) {
6004 if (cst.type !== PlainValue.Type.MAP && cst.type !== PlainValue.Type.FLOW_MAP) {
6005 const msg = `A ${cst.type} node cannot be resolved as a mapping`;
6006 doc.errors.push(new PlainValue.YAMLSyntaxError(cst, msg));
6007 return null;
6008 }
6009 const {
6010 comments,
6011 items
6012 } = cst.type === PlainValue.Type.FLOW_MAP ? resolveFlowMapItems(doc, cst) : resolveBlockMapItems(doc, cst);
6013 const map = new YAMLMap();
6014 map.items = items;
6015 resolveComments(map, comments);
6016 let hasCollectionKey = false;
6017 for (let i = 0; i < items.length; ++i) {
6018 const {
6019 key: iKey
6020 } = items[i];
6021 if (iKey instanceof Collection)
6022 hasCollectionKey = true;
6023 if (doc.schema.merge && iKey && iKey.value === MERGE_KEY) {
6024 items[i] = new Merge(items[i]);
6025 const sources = items[i].value.items;
6026 let error = null;
6027 sources.some((node) => {
6028 if (node instanceof Alias) {
6029 const {
6030 type
6031 } = node.source;
6032 if (type === PlainValue.Type.MAP || type === PlainValue.Type.FLOW_MAP)
6033 return false;
6034 return error = "Merge nodes aliases can only point to maps";
6035 }
6036 return error = "Merge nodes can only have Alias nodes as values";
6037 });
6038 if (error)
6039 doc.errors.push(new PlainValue.YAMLSemanticError(cst, error));
6040 } else {
6041 for (let j = i + 1; j < items.length; ++j) {
6042 const {
6043 key: jKey
6044 } = items[j];
6045 if (iKey === jKey || iKey && jKey && Object.prototype.hasOwnProperty.call(iKey, "value") && iKey.value === jKey.value) {
6046 const msg = `Map keys must be unique; "${iKey}" is repeated`;
6047 doc.errors.push(new PlainValue.YAMLSemanticError(cst, msg));
6048 break;
6049 }
6050 }
6051 }
6052 }
6053 if (hasCollectionKey && !doc.options.mapAsMap) {
6054 const warn = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.";
6055 doc.warnings.push(new PlainValue.YAMLWarning(cst, warn));
6056 }
6057 cst.resolved = map;
6058 return map;
6059 }
6060 var valueHasPairComment = ({
6061 context: {
6062 lineStart,
6063 node,
6064 src
6065 },
6066 props
6067 }) => {
6068 if (props.length === 0)
6069 return false;
6070 const {
6071 start
6072 } = props[0];
6073 if (node && start > node.valueRange.start)
6074 return false;
6075 if (src[start] !== PlainValue.Char.COMMENT)
6076 return false;
6077 for (let i = lineStart; i < start; ++i)
6078 if (src[i] === "\n")
6079 return false;
6080 return true;
6081 };
6082 function resolvePairComment(item, pair) {
6083 if (!valueHasPairComment(item))
6084 return;
6085 const comment = item.getPropValue(0, PlainValue.Char.COMMENT, true);
6086 let found = false;
6087 const cb = pair.value.commentBefore;
6088 if (cb && cb.startsWith(comment)) {
6089 pair.value.commentBefore = cb.substr(comment.length + 1);
6090 found = true;
6091 } else {
6092 const cc = pair.value.comment;
6093 if (!item.node && cc && cc.startsWith(comment)) {
6094 pair.value.comment = cc.substr(comment.length + 1);
6095 found = true;
6096 }
6097 }
6098 if (found)
6099 pair.comment = comment;
6100 }
6101 function resolveBlockMapItems(doc, cst) {
6102 const comments = [];
6103 const items = [];
6104 let key = void 0;
6105 let keyStart = null;
6106 for (let i = 0; i < cst.items.length; ++i) {
6107 const item = cst.items[i];
6108 switch (item.type) {
6109 case PlainValue.Type.BLANK_LINE:
6110 comments.push({
6111 afterKey: !!key,
6112 before: items.length
6113 });
6114 break;
6115 case PlainValue.Type.COMMENT:
6116 comments.push({
6117 afterKey: !!key,
6118 before: items.length,
6119 comment: item.comment
6120 });
6121 break;
6122 case PlainValue.Type.MAP_KEY:
6123 if (key !== void 0)
6124 items.push(new Pair(key));
6125 if (item.error)
6126 doc.errors.push(item.error);
6127 key = resolveNode(doc, item.node);
6128 keyStart = null;
6129 break;
6130 case PlainValue.Type.MAP_VALUE:
6131 {
6132 if (key === void 0)
6133 key = null;
6134 if (item.error)
6135 doc.errors.push(item.error);
6136 if (!item.context.atLineStart && item.node && item.node.type === PlainValue.Type.MAP && !item.node.context.atLineStart) {
6137 const msg = "Nested mappings are not allowed in compact mappings";
6138 doc.errors.push(new PlainValue.YAMLSemanticError(item.node, msg));
6139 }
6140 let valueNode = item.node;
6141 if (!valueNode && item.props.length > 0) {
6142 valueNode = new PlainValue.PlainValue(PlainValue.Type.PLAIN, []);
6143 valueNode.context = {
6144 parent: item,
6145 src: item.context.src
6146 };
6147 const pos = item.range.start + 1;
6148 valueNode.range = {
6149 start: pos,
6150 end: pos
6151 };
6152 valueNode.valueRange = {
6153 start: pos,
6154 end: pos
6155 };
6156 if (typeof item.range.origStart === "number") {
6157 const origPos = item.range.origStart + 1;
6158 valueNode.range.origStart = valueNode.range.origEnd = origPos;
6159 valueNode.valueRange.origStart = valueNode.valueRange.origEnd = origPos;
6160 }
6161 }
6162 const pair = new Pair(key, resolveNode(doc, valueNode));
6163 resolvePairComment(item, pair);
6164 items.push(pair);
6165 if (key && typeof keyStart === "number") {
6166 if (item.range.start > keyStart + 1024)
6167 doc.errors.push(getLongKeyError(cst, key));
6168 }
6169 key = void 0;
6170 keyStart = null;
6171 }
6172 break;
6173 default:
6174 if (key !== void 0)
6175 items.push(new Pair(key));
6176 key = resolveNode(doc, item);
6177 keyStart = item.range.start;
6178 if (item.error)
6179 doc.errors.push(item.error);
6180 next:
6181 for (let j = i + 1; ; ++j) {
6182 const nextItem = cst.items[j];
6183 switch (nextItem && nextItem.type) {
6184 case PlainValue.Type.BLANK_LINE:
6185 case PlainValue.Type.COMMENT:
6186 continue next;
6187 case PlainValue.Type.MAP_VALUE:
6188 break next;
6189 default: {
6190 const msg = "Implicit map keys need to be followed by map values";
6191 doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
6192 break next;
6193 }
6194 }
6195 }
6196 if (item.valueRangeContainsNewline) {
6197 const msg = "Implicit map keys need to be on a single line";
6198 doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
6199 }
6200 }
6201 }
6202 if (key !== void 0)
6203 items.push(new Pair(key));
6204 return {
6205 comments,
6206 items
6207 };
6208 }
6209 function resolveFlowMapItems(doc, cst) {
6210 const comments = [];
6211 const items = [];
6212 let key = void 0;
6213 let explicitKey = false;
6214 let next = "{";
6215 for (let i = 0; i < cst.items.length; ++i) {
6216 const item = cst.items[i];
6217 if (typeof item.char === "string") {
6218 const {
6219 char,
6220 offset
6221 } = item;
6222 if (char === "?" && key === void 0 && !explicitKey) {
6223 explicitKey = true;
6224 next = ":";
6225 continue;
6226 }
6227 if (char === ":") {
6228 if (key === void 0)
6229 key = null;
6230 if (next === ":") {
6231 next = ",";
6232 continue;
6233 }
6234 } else {
6235 if (explicitKey) {
6236 if (key === void 0 && char !== ",")
6237 key = null;
6238 explicitKey = false;
6239 }
6240 if (key !== void 0) {
6241 items.push(new Pair(key));
6242 key = void 0;
6243 if (char === ",") {
6244 next = ":";
6245 continue;
6246 }
6247 }
6248 }
6249 if (char === "}") {
6250 if (i === cst.items.length - 1)
6251 continue;
6252 } else if (char === next) {
6253 next = ":";
6254 continue;
6255 }
6256 const msg = `Flow map contains an unexpected ${char}`;
6257 const err = new PlainValue.YAMLSyntaxError(cst, msg);
6258 err.offset = offset;
6259 doc.errors.push(err);
6260 } else if (item.type === PlainValue.Type.BLANK_LINE) {
6261 comments.push({
6262 afterKey: !!key,
6263 before: items.length
6264 });
6265 } else if (item.type === PlainValue.Type.COMMENT) {
6266 checkFlowCommentSpace(doc.errors, item);
6267 comments.push({
6268 afterKey: !!key,
6269 before: items.length,
6270 comment: item.comment
6271 });
6272 } else if (key === void 0) {
6273 if (next === ",")
6274 doc.errors.push(new PlainValue.YAMLSemanticError(item, "Separator , missing in flow map"));
6275 key = resolveNode(doc, item);
6276 } else {
6277 if (next !== ",")
6278 doc.errors.push(new PlainValue.YAMLSemanticError(item, "Indicator : missing in flow map entry"));
6279 items.push(new Pair(key, resolveNode(doc, item)));
6280 key = void 0;
6281 explicitKey = false;
6282 }
6283 }
6284 checkFlowCollectionEnd(doc.errors, cst);
6285 if (key !== void 0)
6286 items.push(new Pair(key));
6287 return {
6288 comments,
6289 items
6290 };
6291 }
6292 function resolveSeq(doc, cst) {
6293 if (cst.type !== PlainValue.Type.SEQ && cst.type !== PlainValue.Type.FLOW_SEQ) {
6294 const msg = `A ${cst.type} node cannot be resolved as a sequence`;
6295 doc.errors.push(new PlainValue.YAMLSyntaxError(cst, msg));
6296 return null;
6297 }
6298 const {
6299 comments,
6300 items
6301 } = cst.type === PlainValue.Type.FLOW_SEQ ? resolveFlowSeqItems(doc, cst) : resolveBlockSeqItems(doc, cst);
6302 const seq = new YAMLSeq();
6303 seq.items = items;
6304 resolveComments(seq, comments);
6305 if (!doc.options.mapAsMap && items.some((it) => it instanceof Pair && it.key instanceof Collection)) {
6306 const warn = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.";
6307 doc.warnings.push(new PlainValue.YAMLWarning(cst, warn));
6308 }
6309 cst.resolved = seq;
6310 return seq;
6311 }
6312 function resolveBlockSeqItems(doc, cst) {
6313 const comments = [];
6314 const items = [];
6315 for (let i = 0; i < cst.items.length; ++i) {
6316 const item = cst.items[i];
6317 switch (item.type) {
6318 case PlainValue.Type.BLANK_LINE:
6319 comments.push({
6320 before: items.length
6321 });
6322 break;
6323 case PlainValue.Type.COMMENT:
6324 comments.push({
6325 comment: item.comment,
6326 before: items.length
6327 });
6328 break;
6329 case PlainValue.Type.SEQ_ITEM:
6330 if (item.error)
6331 doc.errors.push(item.error);
6332 items.push(resolveNode(doc, item.node));
6333 if (item.hasProps) {
6334 const msg = "Sequence items cannot have tags or anchors before the - indicator";
6335 doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
6336 }
6337 break;
6338 default:
6339 if (item.error)
6340 doc.errors.push(item.error);
6341 doc.errors.push(new PlainValue.YAMLSyntaxError(item, `Unexpected ${item.type} node in sequence`));
6342 }
6343 }
6344 return {
6345 comments,
6346 items
6347 };
6348 }
6349 function resolveFlowSeqItems(doc, cst) {
6350 const comments = [];
6351 const items = [];
6352 let explicitKey = false;
6353 let key = void 0;
6354 let keyStart = null;
6355 let next = "[";
6356 let prevItem = null;
6357 for (let i = 0; i < cst.items.length; ++i) {
6358 const item = cst.items[i];
6359 if (typeof item.char === "string") {
6360 const {
6361 char,
6362 offset
6363 } = item;
6364 if (char !== ":" && (explicitKey || key !== void 0)) {
6365 if (explicitKey && key === void 0)
6366 key = next ? items.pop() : null;
6367 items.push(new Pair(key));
6368 explicitKey = false;
6369 key = void 0;
6370 keyStart = null;
6371 }
6372 if (char === next) {
6373 next = null;
6374 } else if (!next && char === "?") {
6375 explicitKey = true;
6376 } else if (next !== "[" && char === ":" && key === void 0) {
6377 if (next === ",") {
6378 key = items.pop();
6379 if (key instanceof Pair) {
6380 const msg = "Chaining flow sequence pairs is invalid";
6381 const err = new PlainValue.YAMLSemanticError(cst, msg);
6382 err.offset = offset;
6383 doc.errors.push(err);
6384 }
6385 if (!explicitKey && typeof keyStart === "number") {
6386 const keyEnd = item.range ? item.range.start : item.offset;
6387 if (keyEnd > keyStart + 1024)
6388 doc.errors.push(getLongKeyError(cst, key));
6389 const {
6390 src
6391 } = prevItem.context;
6392 for (let i2 = keyStart; i2 < keyEnd; ++i2)
6393 if (src[i2] === "\n") {
6394 const msg = "Implicit keys of flow sequence pairs need to be on a single line";
6395 doc.errors.push(new PlainValue.YAMLSemanticError(prevItem, msg));
6396 break;
6397 }
6398 }
6399 } else {
6400 key = null;
6401 }
6402 keyStart = null;
6403 explicitKey = false;
6404 next = null;
6405 } else if (next === "[" || char !== "]" || i < cst.items.length - 1) {
6406 const msg = `Flow sequence contains an unexpected ${char}`;
6407 const err = new PlainValue.YAMLSyntaxError(cst, msg);
6408 err.offset = offset;
6409 doc.errors.push(err);
6410 }
6411 } else if (item.type === PlainValue.Type.BLANK_LINE) {
6412 comments.push({
6413 before: items.length
6414 });
6415 } else if (item.type === PlainValue.Type.COMMENT) {
6416 checkFlowCommentSpace(doc.errors, item);
6417 comments.push({
6418 comment: item.comment,
6419 before: items.length
6420 });
6421 } else {
6422 if (next) {
6423 const msg = `Expected a ${next} in flow sequence`;
6424 doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
6425 }
6426 const value = resolveNode(doc, item);
6427 if (key === void 0) {
6428 items.push(value);
6429 prevItem = item;
6430 } else {
6431 items.push(new Pair(key, value));
6432 key = void 0;
6433 }
6434 keyStart = item.range.start;
6435 next = ",";
6436 }
6437 }
6438 checkFlowCollectionEnd(doc.errors, cst);
6439 if (key !== void 0)
6440 items.push(new Pair(key));
6441 return {
6442 comments,
6443 items
6444 };
6445 }
6446 exports2.Alias = Alias;
6447 exports2.Collection = Collection;
6448 exports2.Merge = Merge;
6449 exports2.Node = Node;
6450 exports2.Pair = Pair;
6451 exports2.Scalar = Scalar;
6452 exports2.YAMLMap = YAMLMap;
6453 exports2.YAMLSeq = YAMLSeq;
6454 exports2.addComment = addComment;
6455 exports2.binaryOptions = binaryOptions;
6456 exports2.boolOptions = boolOptions;
6457 exports2.findPair = findPair;
6458 exports2.intOptions = intOptions;
6459 exports2.isEmptyPath = isEmptyPath;
6460 exports2.nullOptions = nullOptions;
6461 exports2.resolveMap = resolveMap;
6462 exports2.resolveNode = resolveNode;
6463 exports2.resolveSeq = resolveSeq;
6464 exports2.resolveString = resolveString;
6465 exports2.strOptions = strOptions;
6466 exports2.stringifyNumber = stringifyNumber;
6467 exports2.stringifyString = stringifyString;
6468 exports2.toJSON = toJSON;
6469 }
6470});
6471var require_warnings_1000a372 = __commonJS({
6472 "node_modules/yaml/dist/warnings-1000a372.js"(exports2) {
6473 "use strict";
6474 var PlainValue = require_PlainValue_ec8e588e();
6475 var resolveSeq = require_resolveSeq_d03cb037();
6476 var binary = {
6477 identify: (value) => value instanceof Uint8Array,
6478 default: false,
6479 tag: "tag:yaml.org,2002:binary",
6480 resolve: (doc, node) => {
6481 const src = resolveSeq.resolveString(doc, node);
6482 if (typeof Buffer === "function") {
6483 return Buffer.from(src, "base64");
6484 } else if (typeof atob === "function") {
6485 const str = atob(src.replace(/[\n\r]/g, ""));
6486 const buffer = new Uint8Array(str.length);
6487 for (let i = 0; i < str.length; ++i)
6488 buffer[i] = str.charCodeAt(i);
6489 return buffer;
6490 } else {
6491 const msg = "This environment does not support reading binary tags; either Buffer or atob is required";
6492 doc.errors.push(new PlainValue.YAMLReferenceError(node, msg));
6493 return null;
6494 }
6495 },
6496 options: resolveSeq.binaryOptions,
6497 stringify: ({
6498 comment,
6499 type,
6500 value
6501 }, ctx, onComment, onChompKeep) => {
6502 let src;
6503 if (typeof Buffer === "function") {
6504 src = value instanceof Buffer ? value.toString("base64") : Buffer.from(value.buffer).toString("base64");
6505 } else if (typeof btoa === "function") {
6506 let s = "";
6507 for (let i = 0; i < value.length; ++i)
6508 s += String.fromCharCode(value[i]);
6509 src = btoa(s);
6510 } else {
6511 throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
6512 }
6513 if (!type)
6514 type = resolveSeq.binaryOptions.defaultType;
6515 if (type === PlainValue.Type.QUOTE_DOUBLE) {
6516 value = src;
6517 } else {
6518 const {
6519 lineWidth
6520 } = resolveSeq.binaryOptions;
6521 const n = Math.ceil(src.length / lineWidth);
6522 const lines = new Array(n);
6523 for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
6524 lines[i] = src.substr(o, lineWidth);
6525 }
6526 value = lines.join(type === PlainValue.Type.BLOCK_LITERAL ? "\n" : " ");
6527 }
6528 return resolveSeq.stringifyString({
6529 comment,
6530 type,
6531 value
6532 }, ctx, onComment, onChompKeep);
6533 }
6534 };
6535 function parsePairs(doc, cst) {
6536 const seq = resolveSeq.resolveSeq(doc, cst);
6537 for (let i = 0; i < seq.items.length; ++i) {
6538 let item = seq.items[i];
6539 if (item instanceof resolveSeq.Pair)
6540 continue;
6541 else if (item instanceof resolveSeq.YAMLMap) {
6542 if (item.items.length > 1) {
6543 const msg = "Each pair must have its own sequence indicator";
6544 throw new PlainValue.YAMLSemanticError(cst, msg);
6545 }
6546 const pair = item.items[0] || new resolveSeq.Pair();
6547 if (item.commentBefore)
6548 pair.commentBefore = pair.commentBefore ? `${item.commentBefore}
6549${pair.commentBefore}` : item.commentBefore;
6550 if (item.comment)
6551 pair.comment = pair.comment ? `${item.comment}
6552${pair.comment}` : item.comment;
6553 item = pair;
6554 }
6555 seq.items[i] = item instanceof resolveSeq.Pair ? item : new resolveSeq.Pair(item);
6556 }
6557 return seq;
6558 }
6559 function createPairs(schema, iterable, ctx) {
6560 const pairs2 = new resolveSeq.YAMLSeq(schema);
6561 pairs2.tag = "tag:yaml.org,2002:pairs";
6562 for (const it of iterable) {
6563 let key, value;
6564 if (Array.isArray(it)) {
6565 if (it.length === 2) {
6566 key = it[0];
6567 value = it[1];
6568 } else
6569 throw new TypeError(`Expected [key, value] tuple: ${it}`);
6570 } else if (it && it instanceof Object) {
6571 const keys = Object.keys(it);
6572 if (keys.length === 1) {
6573 key = keys[0];
6574 value = it[key];
6575 } else
6576 throw new TypeError(`Expected { key: value } tuple: ${it}`);
6577 } else {
6578 key = it;
6579 }
6580 const pair = schema.createPair(key, value, ctx);
6581 pairs2.items.push(pair);
6582 }
6583 return pairs2;
6584 }
6585 var pairs = {
6586 default: false,
6587 tag: "tag:yaml.org,2002:pairs",
6588 resolve: parsePairs,
6589 createNode: createPairs
6590 };
6591 var YAMLOMap = class extends resolveSeq.YAMLSeq {
6592 constructor() {
6593 super();
6594 PlainValue._defineProperty(this, "add", resolveSeq.YAMLMap.prototype.add.bind(this));
6595 PlainValue._defineProperty(this, "delete", resolveSeq.YAMLMap.prototype.delete.bind(this));
6596 PlainValue._defineProperty(this, "get", resolveSeq.YAMLMap.prototype.get.bind(this));
6597 PlainValue._defineProperty(this, "has", resolveSeq.YAMLMap.prototype.has.bind(this));
6598 PlainValue._defineProperty(this, "set", resolveSeq.YAMLMap.prototype.set.bind(this));
6599 this.tag = YAMLOMap.tag;
6600 }
6601 toJSON(_, ctx) {
6602 const map = /* @__PURE__ */ new Map();
6603 if (ctx && ctx.onCreate)
6604 ctx.onCreate(map);
6605 for (const pair of this.items) {
6606 let key, value;
6607 if (pair instanceof resolveSeq.Pair) {
6608 key = resolveSeq.toJSON(pair.key, "", ctx);
6609 value = resolveSeq.toJSON(pair.value, key, ctx);
6610 } else {
6611 key = resolveSeq.toJSON(pair, "", ctx);
6612 }
6613 if (map.has(key))
6614 throw new Error("Ordered maps must not include duplicate keys");
6615 map.set(key, value);
6616 }
6617 return map;
6618 }
6619 };
6620 PlainValue._defineProperty(YAMLOMap, "tag", "tag:yaml.org,2002:omap");
6621 function parseOMap(doc, cst) {
6622 const pairs2 = parsePairs(doc, cst);
6623 const seenKeys = [];
6624 for (const {
6625 key
6626 } of pairs2.items) {
6627 if (key instanceof resolveSeq.Scalar) {
6628 if (seenKeys.includes(key.value)) {
6629 const msg = "Ordered maps must not include duplicate keys";
6630 throw new PlainValue.YAMLSemanticError(cst, msg);
6631 } else {
6632 seenKeys.push(key.value);
6633 }
6634 }
6635 }
6636 return Object.assign(new YAMLOMap(), pairs2);
6637 }
6638 function createOMap(schema, iterable, ctx) {
6639 const pairs2 = createPairs(schema, iterable, ctx);
6640 const omap2 = new YAMLOMap();
6641 omap2.items = pairs2.items;
6642 return omap2;
6643 }
6644 var omap = {
6645 identify: (value) => value instanceof Map,
6646 nodeClass: YAMLOMap,
6647 default: false,
6648 tag: "tag:yaml.org,2002:omap",
6649 resolve: parseOMap,
6650 createNode: createOMap
6651 };
6652 var YAMLSet = class extends resolveSeq.YAMLMap {
6653 constructor() {
6654 super();
6655 this.tag = YAMLSet.tag;
6656 }
6657 add(key) {
6658 const pair = key instanceof resolveSeq.Pair ? key : new resolveSeq.Pair(key);
6659 const prev = resolveSeq.findPair(this.items, pair.key);
6660 if (!prev)
6661 this.items.push(pair);
6662 }
6663 get(key, keepPair) {
6664 const pair = resolveSeq.findPair(this.items, key);
6665 return !keepPair && pair instanceof resolveSeq.Pair ? pair.key instanceof resolveSeq.Scalar ? pair.key.value : pair.key : pair;
6666 }
6667 set(key, value) {
6668 if (typeof value !== "boolean")
6669 throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
6670 const prev = resolveSeq.findPair(this.items, key);
6671 if (prev && !value) {
6672 this.items.splice(this.items.indexOf(prev), 1);
6673 } else if (!prev && value) {
6674 this.items.push(new resolveSeq.Pair(key));
6675 }
6676 }
6677 toJSON(_, ctx) {
6678 return super.toJSON(_, ctx, Set);
6679 }
6680 toString(ctx, onComment, onChompKeep) {
6681 if (!ctx)
6682 return JSON.stringify(this);
6683 if (this.hasAllNullValues())
6684 return super.toString(ctx, onComment, onChompKeep);
6685 else
6686 throw new Error("Set items must all have null values");
6687 }
6688 };
6689 PlainValue._defineProperty(YAMLSet, "tag", "tag:yaml.org,2002:set");
6690 function parseSet(doc, cst) {
6691 const map = resolveSeq.resolveMap(doc, cst);
6692 if (!map.hasAllNullValues())
6693 throw new PlainValue.YAMLSemanticError(cst, "Set items must all have null values");
6694 return Object.assign(new YAMLSet(), map);
6695 }
6696 function createSet(schema, iterable, ctx) {
6697 const set2 = new YAMLSet();
6698 for (const value of iterable)
6699 set2.items.push(schema.createPair(value, null, ctx));
6700 return set2;
6701 }
6702 var set = {
6703 identify: (value) => value instanceof Set,
6704 nodeClass: YAMLSet,
6705 default: false,
6706 tag: "tag:yaml.org,2002:set",
6707 resolve: parseSet,
6708 createNode: createSet
6709 };
6710 var parseSexagesimal = (sign, parts) => {
6711 const n = parts.split(":").reduce((n2, p) => n2 * 60 + Number(p), 0);
6712 return sign === "-" ? -n : n;
6713 };
6714 var stringifySexagesimal = ({
6715 value
6716 }) => {
6717 if (isNaN(value) || !isFinite(value))
6718 return resolveSeq.stringifyNumber(value);
6719 let sign = "";
6720 if (value < 0) {
6721 sign = "-";
6722 value = Math.abs(value);
6723 }
6724 const parts = [value % 60];
6725 if (value < 60) {
6726 parts.unshift(0);
6727 } else {
6728 value = Math.round((value - parts[0]) / 60);
6729 parts.unshift(value % 60);
6730 if (value >= 60) {
6731 value = Math.round((value - parts[0]) / 60);
6732 parts.unshift(value);
6733 }
6734 }
6735 return sign + parts.map((n) => n < 10 ? "0" + String(n) : String(n)).join(":").replace(/000000\d*$/, "");
6736 };
6737 var intTime = {
6738 identify: (value) => typeof value === "number",
6739 default: true,
6740 tag: "tag:yaml.org,2002:int",
6741 format: "TIME",
6742 test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/,
6743 resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, "")),
6744 stringify: stringifySexagesimal
6745 };
6746 var floatTime = {
6747 identify: (value) => typeof value === "number",
6748 default: true,
6749 tag: "tag:yaml.org,2002:float",
6750 format: "TIME",
6751 test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/,
6752 resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, "")),
6753 stringify: stringifySexagesimal
6754 };
6755 var timestamp = {
6756 identify: (value) => value instanceof Date,
6757 default: true,
6758 tag: "tag:yaml.org,2002:timestamp",
6759 test: RegExp("^(?:([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?)$"),
6760 resolve: (str, year, month, day, hour, minute, second, millisec, tz) => {
6761 if (millisec)
6762 millisec = (millisec + "00").substr(1, 3);
6763 let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec || 0);
6764 if (tz && tz !== "Z") {
6765 let d = parseSexagesimal(tz[0], tz.slice(1));
6766 if (Math.abs(d) < 30)
6767 d *= 60;
6768 date -= 6e4 * d;
6769 }
6770 return new Date(date);
6771 },
6772 stringify: ({
6773 value
6774 }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, "")
6775 };
6776 function shouldWarn(deprecation) {
6777 const env = typeof process !== "undefined" && process.env || {};
6778 if (deprecation) {
6779 if (typeof YAML_SILENCE_DEPRECATION_WARNINGS !== "undefined")
6780 return !YAML_SILENCE_DEPRECATION_WARNINGS;
6781 return !env.YAML_SILENCE_DEPRECATION_WARNINGS;
6782 }
6783 if (typeof YAML_SILENCE_WARNINGS !== "undefined")
6784 return !YAML_SILENCE_WARNINGS;
6785 return !env.YAML_SILENCE_WARNINGS;
6786 }
6787 function warn(warning, type) {
6788 if (shouldWarn(false)) {
6789 const emit = typeof process !== "undefined" && process.emitWarning;
6790 if (emit)
6791 emit(warning, type);
6792 else {
6793 console.warn(type ? `${type}: ${warning}` : warning);
6794 }
6795 }
6796 }
6797 function warnFileDeprecation(filename) {
6798 if (shouldWarn(true)) {
6799 const path = filename.replace(/.*yaml[/\\]/i, "").replace(/\.js$/, "").replace(/\\/g, "/");
6800 warn(`The endpoint 'yaml/${path}' will be removed in a future release.`, "DeprecationWarning");
6801 }
6802 }
6803 var warned = {};
6804 function warnOptionDeprecation(name, alternative) {
6805 if (!warned[name] && shouldWarn(true)) {
6806 warned[name] = true;
6807 let msg = `The option '${name}' will be removed in a future release`;
6808 msg += alternative ? `, use '${alternative}' instead.` : ".";
6809 warn(msg, "DeprecationWarning");
6810 }
6811 }
6812 exports2.binary = binary;
6813 exports2.floatTime = floatTime;
6814 exports2.intTime = intTime;
6815 exports2.omap = omap;
6816 exports2.pairs = pairs;
6817 exports2.set = set;
6818 exports2.timestamp = timestamp;
6819 exports2.warn = warn;
6820 exports2.warnFileDeprecation = warnFileDeprecation;
6821 exports2.warnOptionDeprecation = warnOptionDeprecation;
6822 }
6823});
6824var require_Schema_88e323a7 = __commonJS({
6825 "node_modules/yaml/dist/Schema-88e323a7.js"(exports2) {
6826 "use strict";
6827 var PlainValue = require_PlainValue_ec8e588e();
6828 var resolveSeq = require_resolveSeq_d03cb037();
6829 var warnings = require_warnings_1000a372();
6830 function createMap(schema, obj, ctx) {
6831 const map2 = new resolveSeq.YAMLMap(schema);
6832 if (obj instanceof Map) {
6833 for (const [key, value] of obj)
6834 map2.items.push(schema.createPair(key, value, ctx));
6835 } else if (obj && typeof obj === "object") {
6836 for (const key of Object.keys(obj))
6837 map2.items.push(schema.createPair(key, obj[key], ctx));
6838 }
6839 if (typeof schema.sortMapEntries === "function") {
6840 map2.items.sort(schema.sortMapEntries);
6841 }
6842 return map2;
6843 }
6844 var map = {
6845 createNode: createMap,
6846 default: true,
6847 nodeClass: resolveSeq.YAMLMap,
6848 tag: "tag:yaml.org,2002:map",
6849 resolve: resolveSeq.resolveMap
6850 };
6851 function createSeq(schema, obj, ctx) {
6852 const seq2 = new resolveSeq.YAMLSeq(schema);
6853 if (obj && obj[Symbol.iterator]) {
6854 for (const it of obj) {
6855 const v = schema.createNode(it, ctx.wrapScalars, null, ctx);
6856 seq2.items.push(v);
6857 }
6858 }
6859 return seq2;
6860 }
6861 var seq = {
6862 createNode: createSeq,
6863 default: true,
6864 nodeClass: resolveSeq.YAMLSeq,
6865 tag: "tag:yaml.org,2002:seq",
6866 resolve: resolveSeq.resolveSeq
6867 };
6868 var string = {
6869 identify: (value) => typeof value === "string",
6870 default: true,
6871 tag: "tag:yaml.org,2002:str",
6872 resolve: resolveSeq.resolveString,
6873 stringify(item, ctx, onComment, onChompKeep) {
6874 ctx = Object.assign({
6875 actualString: true
6876 }, ctx);
6877 return resolveSeq.stringifyString(item, ctx, onComment, onChompKeep);
6878 },
6879 options: resolveSeq.strOptions
6880 };
6881 var failsafe = [map, seq, string];
6882 var intIdentify$2 = (value) => typeof value === "bigint" || Number.isInteger(value);
6883 var intResolve$1 = (src, part, radix) => resolveSeq.intOptions.asBigInt ? BigInt(src) : parseInt(part, radix);
6884 function intStringify$1(node, radix, prefix) {
6885 const {
6886 value
6887 } = node;
6888 if (intIdentify$2(value) && value >= 0)
6889 return prefix + value.toString(radix);
6890 return resolveSeq.stringifyNumber(node);
6891 }
6892 var nullObj = {
6893 identify: (value) => value == null,
6894 createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null,
6895 default: true,
6896 tag: "tag:yaml.org,2002:null",
6897 test: /^(?:~|[Nn]ull|NULL)?$/,
6898 resolve: () => null,
6899 options: resolveSeq.nullOptions,
6900 stringify: () => resolveSeq.nullOptions.nullStr
6901 };
6902 var boolObj = {
6903 identify: (value) => typeof value === "boolean",
6904 default: true,
6905 tag: "tag:yaml.org,2002:bool",
6906 test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
6907 resolve: (str) => str[0] === "t" || str[0] === "T",
6908 options: resolveSeq.boolOptions,
6909 stringify: ({
6910 value
6911 }) => value ? resolveSeq.boolOptions.trueStr : resolveSeq.boolOptions.falseStr
6912 };
6913 var octObj = {
6914 identify: (value) => intIdentify$2(value) && value >= 0,
6915 default: true,
6916 tag: "tag:yaml.org,2002:int",
6917 format: "OCT",
6918 test: /^0o([0-7]+)$/,
6919 resolve: (str, oct) => intResolve$1(str, oct, 8),
6920 options: resolveSeq.intOptions,
6921 stringify: (node) => intStringify$1(node, 8, "0o")
6922 };
6923 var intObj = {
6924 identify: intIdentify$2,
6925 default: true,
6926 tag: "tag:yaml.org,2002:int",
6927 test: /^[-+]?[0-9]+$/,
6928 resolve: (str) => intResolve$1(str, str, 10),
6929 options: resolveSeq.intOptions,
6930 stringify: resolveSeq.stringifyNumber
6931 };
6932 var hexObj = {
6933 identify: (value) => intIdentify$2(value) && value >= 0,
6934 default: true,
6935 tag: "tag:yaml.org,2002:int",
6936 format: "HEX",
6937 test: /^0x([0-9a-fA-F]+)$/,
6938 resolve: (str, hex) => intResolve$1(str, hex, 16),
6939 options: resolveSeq.intOptions,
6940 stringify: (node) => intStringify$1(node, 16, "0x")
6941 };
6942 var nanObj = {
6943 identify: (value) => typeof value === "number",
6944 default: true,
6945 tag: "tag:yaml.org,2002:float",
6946 test: /^(?:[-+]?\.inf|(\.nan))$/i,
6947 resolve: (str, nan) => nan ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
6948 stringify: resolveSeq.stringifyNumber
6949 };
6950 var expObj = {
6951 identify: (value) => typeof value === "number",
6952 default: true,
6953 tag: "tag:yaml.org,2002:float",
6954 format: "EXP",
6955 test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
6956 resolve: (str) => parseFloat(str),
6957 stringify: ({
6958 value
6959 }) => Number(value).toExponential()
6960 };
6961 var floatObj = {
6962 identify: (value) => typeof value === "number",
6963 default: true,
6964 tag: "tag:yaml.org,2002:float",
6965 test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/,
6966 resolve(str, frac1, frac2) {
6967 const frac = frac1 || frac2;
6968 const node = new resolveSeq.Scalar(parseFloat(str));
6969 if (frac && frac[frac.length - 1] === "0")
6970 node.minFractionDigits = frac.length;
6971 return node;
6972 },
6973 stringify: resolveSeq.stringifyNumber
6974 };
6975 var core = failsafe.concat([nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj]);
6976 var intIdentify$1 = (value) => typeof value === "bigint" || Number.isInteger(value);
6977 var stringifyJSON = ({
6978 value
6979 }) => JSON.stringify(value);
6980 var json = [map, seq, {
6981 identify: (value) => typeof value === "string",
6982 default: true,
6983 tag: "tag:yaml.org,2002:str",
6984 resolve: resolveSeq.resolveString,
6985 stringify: stringifyJSON
6986 }, {
6987 identify: (value) => value == null,
6988 createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null,
6989 default: true,
6990 tag: "tag:yaml.org,2002:null",
6991 test: /^null$/,
6992 resolve: () => null,
6993 stringify: stringifyJSON
6994 }, {
6995 identify: (value) => typeof value === "boolean",
6996 default: true,
6997 tag: "tag:yaml.org,2002:bool",
6998 test: /^true|false$/,
6999 resolve: (str) => str === "true",
7000 stringify: stringifyJSON
7001 }, {
7002 identify: intIdentify$1,
7003 default: true,
7004 tag: "tag:yaml.org,2002:int",
7005 test: /^-?(?:0|[1-9][0-9]*)$/,
7006 resolve: (str) => resolveSeq.intOptions.asBigInt ? BigInt(str) : parseInt(str, 10),
7007 stringify: ({
7008 value
7009 }) => intIdentify$1(value) ? value.toString() : JSON.stringify(value)
7010 }, {
7011 identify: (value) => typeof value === "number",
7012 default: true,
7013 tag: "tag:yaml.org,2002:float",
7014 test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
7015 resolve: (str) => parseFloat(str),
7016 stringify: stringifyJSON
7017 }];
7018 json.scalarFallback = (str) => {
7019 throw new SyntaxError(`Unresolved plain scalar ${JSON.stringify(str)}`);
7020 };
7021 var boolStringify = ({
7022 value
7023 }) => value ? resolveSeq.boolOptions.trueStr : resolveSeq.boolOptions.falseStr;
7024 var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
7025 function intResolve(sign, src, radix) {
7026 let str = src.replace(/_/g, "");
7027 if (resolveSeq.intOptions.asBigInt) {
7028 switch (radix) {
7029 case 2:
7030 str = `0b${str}`;
7031 break;
7032 case 8:
7033 str = `0o${str}`;
7034 break;
7035 case 16:
7036 str = `0x${str}`;
7037 break;
7038 }
7039 const n2 = BigInt(str);
7040 return sign === "-" ? BigInt(-1) * n2 : n2;
7041 }
7042 const n = parseInt(str, radix);
7043 return sign === "-" ? -1 * n : n;
7044 }
7045 function intStringify(node, radix, prefix) {
7046 const {
7047 value
7048 } = node;
7049 if (intIdentify(value)) {
7050 const str = value.toString(radix);
7051 return value < 0 ? "-" + prefix + str.substr(1) : prefix + str;
7052 }
7053 return resolveSeq.stringifyNumber(node);
7054 }
7055 var yaml11 = failsafe.concat([{
7056 identify: (value) => value == null,
7057 createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null,
7058 default: true,
7059 tag: "tag:yaml.org,2002:null",
7060 test: /^(?:~|[Nn]ull|NULL)?$/,
7061 resolve: () => null,
7062 options: resolveSeq.nullOptions,
7063 stringify: () => resolveSeq.nullOptions.nullStr
7064 }, {
7065 identify: (value) => typeof value === "boolean",
7066 default: true,
7067 tag: "tag:yaml.org,2002:bool",
7068 test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
7069 resolve: () => true,
7070 options: resolveSeq.boolOptions,
7071 stringify: boolStringify
7072 }, {
7073 identify: (value) => typeof value === "boolean",
7074 default: true,
7075 tag: "tag:yaml.org,2002:bool",
7076 test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
7077 resolve: () => false,
7078 options: resolveSeq.boolOptions,
7079 stringify: boolStringify
7080 }, {
7081 identify: intIdentify,
7082 default: true,
7083 tag: "tag:yaml.org,2002:int",
7084 format: "BIN",
7085 test: /^([-+]?)0b([0-1_]+)$/,
7086 resolve: (str, sign, bin) => intResolve(sign, bin, 2),
7087 stringify: (node) => intStringify(node, 2, "0b")
7088 }, {
7089 identify: intIdentify,
7090 default: true,
7091 tag: "tag:yaml.org,2002:int",
7092 format: "OCT",
7093 test: /^([-+]?)0([0-7_]+)$/,
7094 resolve: (str, sign, oct) => intResolve(sign, oct, 8),
7095 stringify: (node) => intStringify(node, 8, "0")
7096 }, {
7097 identify: intIdentify,
7098 default: true,
7099 tag: "tag:yaml.org,2002:int",
7100 test: /^([-+]?)([0-9][0-9_]*)$/,
7101 resolve: (str, sign, abs) => intResolve(sign, abs, 10),
7102 stringify: resolveSeq.stringifyNumber
7103 }, {
7104 identify: intIdentify,
7105 default: true,
7106 tag: "tag:yaml.org,2002:int",
7107 format: "HEX",
7108 test: /^([-+]?)0x([0-9a-fA-F_]+)$/,
7109 resolve: (str, sign, hex) => intResolve(sign, hex, 16),
7110 stringify: (node) => intStringify(node, 16, "0x")
7111 }, {
7112 identify: (value) => typeof value === "number",
7113 default: true,
7114 tag: "tag:yaml.org,2002:float",
7115 test: /^(?:[-+]?\.inf|(\.nan))$/i,
7116 resolve: (str, nan) => nan ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
7117 stringify: resolveSeq.stringifyNumber
7118 }, {
7119 identify: (value) => typeof value === "number",
7120 default: true,
7121 tag: "tag:yaml.org,2002:float",
7122 format: "EXP",
7123 test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/,
7124 resolve: (str) => parseFloat(str.replace(/_/g, "")),
7125 stringify: ({
7126 value
7127 }) => Number(value).toExponential()
7128 }, {
7129 identify: (value) => typeof value === "number",
7130 default: true,
7131 tag: "tag:yaml.org,2002:float",
7132 test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/,
7133 resolve(str, frac) {
7134 const node = new resolveSeq.Scalar(parseFloat(str.replace(/_/g, "")));
7135 if (frac) {
7136 const f = frac.replace(/_/g, "");
7137 if (f[f.length - 1] === "0")
7138 node.minFractionDigits = f.length;
7139 }
7140 return node;
7141 },
7142 stringify: resolveSeq.stringifyNumber
7143 }], warnings.binary, warnings.omap, warnings.pairs, warnings.set, warnings.intTime, warnings.floatTime, warnings.timestamp);
7144 var schemas = {
7145 core,
7146 failsafe,
7147 json,
7148 yaml11
7149 };
7150 var tags = {
7151 binary: warnings.binary,
7152 bool: boolObj,
7153 float: floatObj,
7154 floatExp: expObj,
7155 floatNaN: nanObj,
7156 floatTime: warnings.floatTime,
7157 int: intObj,
7158 intHex: hexObj,
7159 intOct: octObj,
7160 intTime: warnings.intTime,
7161 map,
7162 null: nullObj,
7163 omap: warnings.omap,
7164 pairs: warnings.pairs,
7165 seq,
7166 set: warnings.set,
7167 timestamp: warnings.timestamp
7168 };
7169 function findTagObject(value, tagName, tags2) {
7170 if (tagName) {
7171 const match = tags2.filter((t) => t.tag === tagName);
7172 const tagObj = match.find((t) => !t.format) || match[0];
7173 if (!tagObj)
7174 throw new Error(`Tag ${tagName} not found`);
7175 return tagObj;
7176 }
7177 return tags2.find((t) => (t.identify && t.identify(value) || t.class && value instanceof t.class) && !t.format);
7178 }
7179 function createNode(value, tagName, ctx) {
7180 if (value instanceof resolveSeq.Node)
7181 return value;
7182 const {
7183 defaultPrefix,
7184 onTagObj,
7185 prevObjects,
7186 schema,
7187 wrapScalars
7188 } = ctx;
7189 if (tagName && tagName.startsWith("!!"))
7190 tagName = defaultPrefix + tagName.slice(2);
7191 let tagObj = findTagObject(value, tagName, schema.tags);
7192 if (!tagObj) {
7193 if (typeof value.toJSON === "function")
7194 value = value.toJSON();
7195 if (!value || typeof value !== "object")
7196 return wrapScalars ? new resolveSeq.Scalar(value) : value;
7197 tagObj = value instanceof Map ? map : value[Symbol.iterator] ? seq : map;
7198 }
7199 if (onTagObj) {
7200 onTagObj(tagObj);
7201 delete ctx.onTagObj;
7202 }
7203 const obj = {
7204 value: void 0,
7205 node: void 0
7206 };
7207 if (value && typeof value === "object" && prevObjects) {
7208 const prev = prevObjects.get(value);
7209 if (prev) {
7210 const alias = new resolveSeq.Alias(prev);
7211 ctx.aliasNodes.push(alias);
7212 return alias;
7213 }
7214 obj.value = value;
7215 prevObjects.set(value, obj);
7216 }
7217 obj.node = tagObj.createNode ? tagObj.createNode(ctx.schema, value, ctx) : wrapScalars ? new resolveSeq.Scalar(value) : value;
7218 if (tagName && obj.node instanceof resolveSeq.Node)
7219 obj.node.tag = tagName;
7220 return obj.node;
7221 }
7222 function getSchemaTags(schemas2, knownTags, customTags, schemaId) {
7223 let tags2 = schemas2[schemaId.replace(/\W/g, "")];
7224 if (!tags2) {
7225 const keys = Object.keys(schemas2).map((key) => JSON.stringify(key)).join(", ");
7226 throw new Error(`Unknown schema "${schemaId}"; use one of ${keys}`);
7227 }
7228 if (Array.isArray(customTags)) {
7229 for (const tag of customTags)
7230 tags2 = tags2.concat(tag);
7231 } else if (typeof customTags === "function") {
7232 tags2 = customTags(tags2.slice());
7233 }
7234 for (let i = 0; i < tags2.length; ++i) {
7235 const tag = tags2[i];
7236 if (typeof tag === "string") {
7237 const tagObj = knownTags[tag];
7238 if (!tagObj) {
7239 const keys = Object.keys(knownTags).map((key) => JSON.stringify(key)).join(", ");
7240 throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
7241 }
7242 tags2[i] = tagObj;
7243 }
7244 }
7245 return tags2;
7246 }
7247 var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
7248 var Schema = class {
7249 constructor({
7250 customTags,
7251 merge,
7252 schema,
7253 sortMapEntries,
7254 tags: deprecatedCustomTags
7255 }) {
7256 this.merge = !!merge;
7257 this.name = schema;
7258 this.sortMapEntries = sortMapEntries === true ? sortMapEntriesByKey : sortMapEntries || null;
7259 if (!customTags && deprecatedCustomTags)
7260 warnings.warnOptionDeprecation("tags", "customTags");
7261 this.tags = getSchemaTags(schemas, tags, customTags || deprecatedCustomTags, schema);
7262 }
7263 createNode(value, wrapScalars, tagName, ctx) {
7264 const baseCtx = {
7265 defaultPrefix: Schema.defaultPrefix,
7266 schema: this,
7267 wrapScalars
7268 };
7269 const createCtx = ctx ? Object.assign(ctx, baseCtx) : baseCtx;
7270 return createNode(value, tagName, createCtx);
7271 }
7272 createPair(key, value, ctx) {
7273 if (!ctx)
7274 ctx = {
7275 wrapScalars: true
7276 };
7277 const k = this.createNode(key, ctx.wrapScalars, null, ctx);
7278 const v = this.createNode(value, ctx.wrapScalars, null, ctx);
7279 return new resolveSeq.Pair(k, v);
7280 }
7281 };
7282 PlainValue._defineProperty(Schema, "defaultPrefix", PlainValue.defaultTagPrefix);
7283 PlainValue._defineProperty(Schema, "defaultTags", PlainValue.defaultTags);
7284 exports2.Schema = Schema;
7285 }
7286});
7287var require_Document_9b4560a1 = __commonJS({
7288 "node_modules/yaml/dist/Document-9b4560a1.js"(exports2) {
7289 "use strict";
7290 var PlainValue = require_PlainValue_ec8e588e();
7291 var resolveSeq = require_resolveSeq_d03cb037();
7292 var Schema = require_Schema_88e323a7();
7293 var defaultOptions = {
7294 anchorPrefix: "a",
7295 customTags: null,
7296 indent: 2,
7297 indentSeq: true,
7298 keepCstNodes: false,
7299 keepNodeTypes: true,
7300 keepBlobsInJSON: true,
7301 mapAsMap: false,
7302 maxAliasCount: 100,
7303 prettyErrors: false,
7304 simpleKeys: false,
7305 version: "1.2"
7306 };
7307 var scalarOptions = {
7308 get binary() {
7309 return resolveSeq.binaryOptions;
7310 },
7311 set binary(opt) {
7312 Object.assign(resolveSeq.binaryOptions, opt);
7313 },
7314 get bool() {
7315 return resolveSeq.boolOptions;
7316 },
7317 set bool(opt) {
7318 Object.assign(resolveSeq.boolOptions, opt);
7319 },
7320 get int() {
7321 return resolveSeq.intOptions;
7322 },
7323 set int(opt) {
7324 Object.assign(resolveSeq.intOptions, opt);
7325 },
7326 get null() {
7327 return resolveSeq.nullOptions;
7328 },
7329 set null(opt) {
7330 Object.assign(resolveSeq.nullOptions, opt);
7331 },
7332 get str() {
7333 return resolveSeq.strOptions;
7334 },
7335 set str(opt) {
7336 Object.assign(resolveSeq.strOptions, opt);
7337 }
7338 };
7339 var documentOptions = {
7340 "1.0": {
7341 schema: "yaml-1.1",
7342 merge: true,
7343 tagPrefixes: [{
7344 handle: "!",
7345 prefix: PlainValue.defaultTagPrefix
7346 }, {
7347 handle: "!!",
7348 prefix: "tag:private.yaml.org,2002:"
7349 }]
7350 },
7351 1.1: {
7352 schema: "yaml-1.1",
7353 merge: true,
7354 tagPrefixes: [{
7355 handle: "!",
7356 prefix: "!"
7357 }, {
7358 handle: "!!",
7359 prefix: PlainValue.defaultTagPrefix
7360 }]
7361 },
7362 1.2: {
7363 schema: "core",
7364 merge: false,
7365 tagPrefixes: [{
7366 handle: "!",
7367 prefix: "!"
7368 }, {
7369 handle: "!!",
7370 prefix: PlainValue.defaultTagPrefix
7371 }]
7372 }
7373 };
7374 function stringifyTag(doc, tag) {
7375 if ((doc.version || doc.options.version) === "1.0") {
7376 const priv = tag.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/);
7377 if (priv)
7378 return "!" + priv[1];
7379 const vocab = tag.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/);
7380 return vocab ? `!${vocab[1]}/${vocab[2]}` : `!${tag.replace(/^tag:/, "")}`;
7381 }
7382 let p = doc.tagPrefixes.find((p2) => tag.indexOf(p2.prefix) === 0);
7383 if (!p) {
7384 const dtp = doc.getDefaults().tagPrefixes;
7385 p = dtp && dtp.find((p2) => tag.indexOf(p2.prefix) === 0);
7386 }
7387 if (!p)
7388 return tag[0] === "!" ? tag : `!<${tag}>`;
7389 const suffix = tag.substr(p.prefix.length).replace(/[!,[\]{}]/g, (ch) => ({
7390 "!": "%21",
7391 ",": "%2C",
7392 "[": "%5B",
7393 "]": "%5D",
7394 "{": "%7B",
7395 "}": "%7D"
7396 })[ch]);
7397 return p.handle + suffix;
7398 }
7399 function getTagObject(tags, item) {
7400 if (item instanceof resolveSeq.Alias)
7401 return resolveSeq.Alias;
7402 if (item.tag) {
7403 const match = tags.filter((t) => t.tag === item.tag);
7404 if (match.length > 0)
7405 return match.find((t) => t.format === item.format) || match[0];
7406 }
7407 let tagObj, obj;
7408 if (item instanceof resolveSeq.Scalar) {
7409 obj = item.value;
7410 const match = tags.filter((t) => t.identify && t.identify(obj) || t.class && obj instanceof t.class);
7411 tagObj = match.find((t) => t.format === item.format) || match.find((t) => !t.format);
7412 } else {
7413 obj = item;
7414 tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
7415 }
7416 if (!tagObj) {
7417 const name = obj && obj.constructor ? obj.constructor.name : typeof obj;
7418 throw new Error(`Tag not resolved for ${name} value`);
7419 }
7420 return tagObj;
7421 }
7422 function stringifyProps(node, tagObj, {
7423 anchors,
7424 doc
7425 }) {
7426 const props = [];
7427 const anchor = doc.anchors.getName(node);
7428 if (anchor) {
7429 anchors[anchor] = node;
7430 props.push(`&${anchor}`);
7431 }
7432 if (node.tag) {
7433 props.push(stringifyTag(doc, node.tag));
7434 } else if (!tagObj.default) {
7435 props.push(stringifyTag(doc, tagObj.tag));
7436 }
7437 return props.join(" ");
7438 }
7439 function stringify(item, ctx, onComment, onChompKeep) {
7440 const {
7441 anchors,
7442 schema
7443 } = ctx.doc;
7444 let tagObj;
7445 if (!(item instanceof resolveSeq.Node)) {
7446 const createCtx = {
7447 aliasNodes: [],
7448 onTagObj: (o) => tagObj = o,
7449 prevObjects: /* @__PURE__ */ new Map()
7450 };
7451 item = schema.createNode(item, true, null, createCtx);
7452 for (const alias of createCtx.aliasNodes) {
7453 alias.source = alias.source.node;
7454 let name = anchors.getName(alias.source);
7455 if (!name) {
7456 name = anchors.newName();
7457 anchors.map[name] = alias.source;
7458 }
7459 }
7460 }
7461 if (item instanceof resolveSeq.Pair)
7462 return item.toString(ctx, onComment, onChompKeep);
7463 if (!tagObj)
7464 tagObj = getTagObject(schema.tags, item);
7465 const props = stringifyProps(item, tagObj, ctx);
7466 if (props.length > 0)
7467 ctx.indentAtStart = (ctx.indentAtStart || 0) + props.length + 1;
7468 const str = typeof tagObj.stringify === "function" ? tagObj.stringify(item, ctx, onComment, onChompKeep) : item instanceof resolveSeq.Scalar ? resolveSeq.stringifyString(item, ctx, onComment, onChompKeep) : item.toString(ctx, onComment, onChompKeep);
7469 if (!props)
7470 return str;
7471 return item instanceof resolveSeq.Scalar || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}
7472${ctx.indent}${str}`;
7473 }
7474 var Anchors = class {
7475 static validAnchorNode(node) {
7476 return node instanceof resolveSeq.Scalar || node instanceof resolveSeq.YAMLSeq || node instanceof resolveSeq.YAMLMap;
7477 }
7478 constructor(prefix) {
7479 PlainValue._defineProperty(this, "map", /* @__PURE__ */ Object.create(null));
7480 this.prefix = prefix;
7481 }
7482 createAlias(node, name) {
7483 this.setAnchor(node, name);
7484 return new resolveSeq.Alias(node);
7485 }
7486 createMergePair(...sources) {
7487 const merge = new resolveSeq.Merge();
7488 merge.value.items = sources.map((s) => {
7489 if (s instanceof resolveSeq.Alias) {
7490 if (s.source instanceof resolveSeq.YAMLMap)
7491 return s;
7492 } else if (s instanceof resolveSeq.YAMLMap) {
7493 return this.createAlias(s);
7494 }
7495 throw new Error("Merge sources must be Map nodes or their Aliases");
7496 });
7497 return merge;
7498 }
7499 getName(node) {
7500 const {
7501 map
7502 } = this;
7503 return Object.keys(map).find((a) => map[a] === node);
7504 }
7505 getNames() {
7506 return Object.keys(this.map);
7507 }
7508 getNode(name) {
7509 return this.map[name];
7510 }
7511 newName(prefix) {
7512 if (!prefix)
7513 prefix = this.prefix;
7514 const names = Object.keys(this.map);
7515 for (let i = 1; true; ++i) {
7516 const name = `${prefix}${i}`;
7517 if (!names.includes(name))
7518 return name;
7519 }
7520 }
7521 resolveNodes() {
7522 const {
7523 map,
7524 _cstAliases
7525 } = this;
7526 Object.keys(map).forEach((a) => {
7527 map[a] = map[a].resolved;
7528 });
7529 _cstAliases.forEach((a) => {
7530 a.source = a.source.resolved;
7531 });
7532 delete this._cstAliases;
7533 }
7534 setAnchor(node, name) {
7535 if (node != null && !Anchors.validAnchorNode(node)) {
7536 throw new Error("Anchors may only be set for Scalar, Seq and Map nodes");
7537 }
7538 if (name && /[\x00-\x19\s,[\]{}]/.test(name)) {
7539 throw new Error("Anchor names must not contain whitespace or control characters");
7540 }
7541 const {
7542 map
7543 } = this;
7544 const prev = node && Object.keys(map).find((a) => map[a] === node);
7545 if (prev) {
7546 if (!name) {
7547 return prev;
7548 } else if (prev !== name) {
7549 delete map[prev];
7550 map[name] = node;
7551 }
7552 } else {
7553 if (!name) {
7554 if (!node)
7555 return null;
7556 name = this.newName();
7557 }
7558 map[name] = node;
7559 }
7560 return name;
7561 }
7562 };
7563 var visit = (node, tags) => {
7564 if (node && typeof node === "object") {
7565 const {
7566 tag
7567 } = node;
7568 if (node instanceof resolveSeq.Collection) {
7569 if (tag)
7570 tags[tag] = true;
7571 node.items.forEach((n) => visit(n, tags));
7572 } else if (node instanceof resolveSeq.Pair) {
7573 visit(node.key, tags);
7574 visit(node.value, tags);
7575 } else if (node instanceof resolveSeq.Scalar) {
7576 if (tag)
7577 tags[tag] = true;
7578 }
7579 }
7580 return tags;
7581 };
7582 var listTagNames = (node) => Object.keys(visit(node, {}));
7583 function parseContents(doc, contents) {
7584 const comments = {
7585 before: [],
7586 after: []
7587 };
7588 let body = void 0;
7589 let spaceBefore = false;
7590 for (const node of contents) {
7591 if (node.valueRange) {
7592 if (body !== void 0) {
7593 const msg = "Document contains trailing content not separated by a ... or --- line";
7594 doc.errors.push(new PlainValue.YAMLSyntaxError(node, msg));
7595 break;
7596 }
7597 const res = resolveSeq.resolveNode(doc, node);
7598 if (spaceBefore) {
7599 res.spaceBefore = true;
7600 spaceBefore = false;
7601 }
7602 body = res;
7603 } else if (node.comment !== null) {
7604 const cc = body === void 0 ? comments.before : comments.after;
7605 cc.push(node.comment);
7606 } else if (node.type === PlainValue.Type.BLANK_LINE) {
7607 spaceBefore = true;
7608 if (body === void 0 && comments.before.length > 0 && !doc.commentBefore) {
7609 doc.commentBefore = comments.before.join("\n");
7610 comments.before = [];
7611 }
7612 }
7613 }
7614 doc.contents = body || null;
7615 if (!body) {
7616 doc.comment = comments.before.concat(comments.after).join("\n") || null;
7617 } else {
7618 const cb = comments.before.join("\n");
7619 if (cb) {
7620 const cbNode = body instanceof resolveSeq.Collection && body.items[0] ? body.items[0] : body;
7621 cbNode.commentBefore = cbNode.commentBefore ? `${cb}
7622${cbNode.commentBefore}` : cb;
7623 }
7624 doc.comment = comments.after.join("\n") || null;
7625 }
7626 }
7627 function resolveTagDirective({
7628 tagPrefixes
7629 }, directive) {
7630 const [handle, prefix] = directive.parameters;
7631 if (!handle || !prefix) {
7632 const msg = "Insufficient parameters given for %TAG directive";
7633 throw new PlainValue.YAMLSemanticError(directive, msg);
7634 }
7635 if (tagPrefixes.some((p) => p.handle === handle)) {
7636 const msg = "The %TAG directive must only be given at most once per handle in the same document.";
7637 throw new PlainValue.YAMLSemanticError(directive, msg);
7638 }
7639 return {
7640 handle,
7641 prefix
7642 };
7643 }
7644 function resolveYamlDirective(doc, directive) {
7645 let [version] = directive.parameters;
7646 if (directive.name === "YAML:1.0")
7647 version = "1.0";
7648 if (!version) {
7649 const msg = "Insufficient parameters given for %YAML directive";
7650 throw new PlainValue.YAMLSemanticError(directive, msg);
7651 }
7652 if (!documentOptions[version]) {
7653 const v0 = doc.version || doc.options.version;
7654 const msg = `Document will be parsed as YAML ${v0} rather than YAML ${version}`;
7655 doc.warnings.push(new PlainValue.YAMLWarning(directive, msg));
7656 }
7657 return version;
7658 }
7659 function parseDirectives(doc, directives, prevDoc) {
7660 const directiveComments = [];
7661 let hasDirectives = false;
7662 for (const directive of directives) {
7663 const {
7664 comment,
7665 name
7666 } = directive;
7667 switch (name) {
7668 case "TAG":
7669 try {
7670 doc.tagPrefixes.push(resolveTagDirective(doc, directive));
7671 } catch (error) {
7672 doc.errors.push(error);
7673 }
7674 hasDirectives = true;
7675 break;
7676 case "YAML":
7677 case "YAML:1.0":
7678 if (doc.version) {
7679 const msg = "The %YAML directive must only be given at most once per document.";
7680 doc.errors.push(new PlainValue.YAMLSemanticError(directive, msg));
7681 }
7682 try {
7683 doc.version = resolveYamlDirective(doc, directive);
7684 } catch (error) {
7685 doc.errors.push(error);
7686 }
7687 hasDirectives = true;
7688 break;
7689 default:
7690 if (name) {
7691 const msg = `YAML only supports %TAG and %YAML directives, and not %${name}`;
7692 doc.warnings.push(new PlainValue.YAMLWarning(directive, msg));
7693 }
7694 }
7695 if (comment)
7696 directiveComments.push(comment);
7697 }
7698 if (prevDoc && !hasDirectives && "1.1" === (doc.version || prevDoc.version || doc.options.version)) {
7699 const copyTagPrefix = ({
7700 handle,
7701 prefix
7702 }) => ({
7703 handle,
7704 prefix
7705 });
7706 doc.tagPrefixes = prevDoc.tagPrefixes.map(copyTagPrefix);
7707 doc.version = prevDoc.version;
7708 }
7709 doc.commentBefore = directiveComments.join("\n") || null;
7710 }
7711 function assertCollection(contents) {
7712 if (contents instanceof resolveSeq.Collection)
7713 return true;
7714 throw new Error("Expected a YAML collection as document contents");
7715 }
7716 var Document = class {
7717 constructor(options) {
7718 this.anchors = new Anchors(options.anchorPrefix);
7719 this.commentBefore = null;
7720 this.comment = null;
7721 this.contents = null;
7722 this.directivesEndMarker = null;
7723 this.errors = [];
7724 this.options = options;
7725 this.schema = null;
7726 this.tagPrefixes = [];
7727 this.version = null;
7728 this.warnings = [];
7729 }
7730 add(value) {
7731 assertCollection(this.contents);
7732 return this.contents.add(value);
7733 }
7734 addIn(path, value) {
7735 assertCollection(this.contents);
7736 this.contents.addIn(path, value);
7737 }
7738 delete(key) {
7739 assertCollection(this.contents);
7740 return this.contents.delete(key);
7741 }
7742 deleteIn(path) {
7743 if (resolveSeq.isEmptyPath(path)) {
7744 if (this.contents == null)
7745 return false;
7746 this.contents = null;
7747 return true;
7748 }
7749 assertCollection(this.contents);
7750 return this.contents.deleteIn(path);
7751 }
7752 getDefaults() {
7753 return Document.defaults[this.version] || Document.defaults[this.options.version] || {};
7754 }
7755 get(key, keepScalar) {
7756 return this.contents instanceof resolveSeq.Collection ? this.contents.get(key, keepScalar) : void 0;
7757 }
7758 getIn(path, keepScalar) {
7759 if (resolveSeq.isEmptyPath(path))
7760 return !keepScalar && this.contents instanceof resolveSeq.Scalar ? this.contents.value : this.contents;
7761 return this.contents instanceof resolveSeq.Collection ? this.contents.getIn(path, keepScalar) : void 0;
7762 }
7763 has(key) {
7764 return this.contents instanceof resolveSeq.Collection ? this.contents.has(key) : false;
7765 }
7766 hasIn(path) {
7767 if (resolveSeq.isEmptyPath(path))
7768 return this.contents !== void 0;
7769 return this.contents instanceof resolveSeq.Collection ? this.contents.hasIn(path) : false;
7770 }
7771 set(key, value) {
7772 assertCollection(this.contents);
7773 this.contents.set(key, value);
7774 }
7775 setIn(path, value) {
7776 if (resolveSeq.isEmptyPath(path))
7777 this.contents = value;
7778 else {
7779 assertCollection(this.contents);
7780 this.contents.setIn(path, value);
7781 }
7782 }
7783 setSchema(id, customTags) {
7784 if (!id && !customTags && this.schema)
7785 return;
7786 if (typeof id === "number")
7787 id = id.toFixed(1);
7788 if (id === "1.0" || id === "1.1" || id === "1.2") {
7789 if (this.version)
7790 this.version = id;
7791 else
7792 this.options.version = id;
7793 delete this.options.schema;
7794 } else if (id && typeof id === "string") {
7795 this.options.schema = id;
7796 }
7797 if (Array.isArray(customTags))
7798 this.options.customTags = customTags;
7799 const opt = Object.assign({}, this.getDefaults(), this.options);
7800 this.schema = new Schema.Schema(opt);
7801 }
7802 parse(node, prevDoc) {
7803 if (this.options.keepCstNodes)
7804 this.cstNode = node;
7805 if (this.options.keepNodeTypes)
7806 this.type = "DOCUMENT";
7807 const {
7808 directives = [],
7809 contents = [],
7810 directivesEndMarker,
7811 error,
7812 valueRange
7813 } = node;
7814 if (error) {
7815 if (!error.source)
7816 error.source = this;
7817 this.errors.push(error);
7818 }
7819 parseDirectives(this, directives, prevDoc);
7820 if (directivesEndMarker)
7821 this.directivesEndMarker = true;
7822 this.range = valueRange ? [valueRange.start, valueRange.end] : null;
7823 this.setSchema();
7824 this.anchors._cstAliases = [];
7825 parseContents(this, contents);
7826 this.anchors.resolveNodes();
7827 if (this.options.prettyErrors) {
7828 for (const error2 of this.errors)
7829 if (error2 instanceof PlainValue.YAMLError)
7830 error2.makePretty();
7831 for (const warn of this.warnings)
7832 if (warn instanceof PlainValue.YAMLError)
7833 warn.makePretty();
7834 }
7835 return this;
7836 }
7837 listNonDefaultTags() {
7838 return listTagNames(this.contents).filter((t) => t.indexOf(Schema.Schema.defaultPrefix) !== 0);
7839 }
7840 setTagPrefix(handle, prefix) {
7841 if (handle[0] !== "!" || handle[handle.length - 1] !== "!")
7842 throw new Error("Handle must start and end with !");
7843 if (prefix) {
7844 const prev = this.tagPrefixes.find((p) => p.handle === handle);
7845 if (prev)
7846 prev.prefix = prefix;
7847 else
7848 this.tagPrefixes.push({
7849 handle,
7850 prefix
7851 });
7852 } else {
7853 this.tagPrefixes = this.tagPrefixes.filter((p) => p.handle !== handle);
7854 }
7855 }
7856 toJSON(arg, onAnchor) {
7857 const {
7858 keepBlobsInJSON,
7859 mapAsMap,
7860 maxAliasCount
7861 } = this.options;
7862 const keep = keepBlobsInJSON && (typeof arg !== "string" || !(this.contents instanceof resolveSeq.Scalar));
7863 const ctx = {
7864 doc: this,
7865 indentStep: " ",
7866 keep,
7867 mapAsMap: keep && !!mapAsMap,
7868 maxAliasCount,
7869 stringify
7870 };
7871 const anchorNames = Object.keys(this.anchors.map);
7872 if (anchorNames.length > 0)
7873 ctx.anchors = new Map(anchorNames.map((name) => [this.anchors.map[name], {
7874 alias: [],
7875 aliasCount: 0,
7876 count: 1
7877 }]));
7878 const res = resolveSeq.toJSON(this.contents, arg, ctx);
7879 if (typeof onAnchor === "function" && ctx.anchors)
7880 for (const {
7881 count,
7882 res: res2
7883 } of ctx.anchors.values())
7884 onAnchor(res2, count);
7885 return res;
7886 }
7887 toString() {
7888 if (this.errors.length > 0)
7889 throw new Error("Document with errors cannot be stringified");
7890 const indentSize = this.options.indent;
7891 if (!Number.isInteger(indentSize) || indentSize <= 0) {
7892 const s = JSON.stringify(indentSize);
7893 throw new Error(`"indent" option must be a positive integer, not ${s}`);
7894 }
7895 this.setSchema();
7896 const lines = [];
7897 let hasDirectives = false;
7898 if (this.version) {
7899 let vd = "%YAML 1.2";
7900 if (this.schema.name === "yaml-1.1") {
7901 if (this.version === "1.0")
7902 vd = "%YAML:1.0";
7903 else if (this.version === "1.1")
7904 vd = "%YAML 1.1";
7905 }
7906 lines.push(vd);
7907 hasDirectives = true;
7908 }
7909 const tagNames = this.listNonDefaultTags();
7910 this.tagPrefixes.forEach(({
7911 handle,
7912 prefix
7913 }) => {
7914 if (tagNames.some((t) => t.indexOf(prefix) === 0)) {
7915 lines.push(`%TAG ${handle} ${prefix}`);
7916 hasDirectives = true;
7917 }
7918 });
7919 if (hasDirectives || this.directivesEndMarker)
7920 lines.push("---");
7921 if (this.commentBefore) {
7922 if (hasDirectives || !this.directivesEndMarker)
7923 lines.unshift("");
7924 lines.unshift(this.commentBefore.replace(/^/gm, "#"));
7925 }
7926 const ctx = {
7927 anchors: /* @__PURE__ */ Object.create(null),
7928 doc: this,
7929 indent: "",
7930 indentStep: " ".repeat(indentSize),
7931 stringify
7932 };
7933 let chompKeep = false;
7934 let contentComment = null;
7935 if (this.contents) {
7936 if (this.contents instanceof resolveSeq.Node) {
7937 if (this.contents.spaceBefore && (hasDirectives || this.directivesEndMarker))
7938 lines.push("");
7939 if (this.contents.commentBefore)
7940 lines.push(this.contents.commentBefore.replace(/^/gm, "#"));
7941 ctx.forceBlockIndent = !!this.comment;
7942 contentComment = this.contents.comment;
7943 }
7944 const onChompKeep = contentComment ? null : () => chompKeep = true;
7945 const body = stringify(this.contents, ctx, () => contentComment = null, onChompKeep);
7946 lines.push(resolveSeq.addComment(body, "", contentComment));
7947 } else if (this.contents !== void 0) {
7948 lines.push(stringify(this.contents, ctx));
7949 }
7950 if (this.comment) {
7951 if ((!chompKeep || contentComment) && lines[lines.length - 1] !== "")
7952 lines.push("");
7953 lines.push(this.comment.replace(/^/gm, "#"));
7954 }
7955 return lines.join("\n") + "\n";
7956 }
7957 };
7958 PlainValue._defineProperty(Document, "defaults", documentOptions);
7959 exports2.Document = Document;
7960 exports2.defaultOptions = defaultOptions;
7961 exports2.scalarOptions = scalarOptions;
7962 }
7963});
7964var require_dist = __commonJS({
7965 "node_modules/yaml/dist/index.js"(exports2) {
7966 "use strict";
7967 var parseCst = require_parse_cst();
7968 var Document$1 = require_Document_9b4560a1();
7969 var Schema = require_Schema_88e323a7();
7970 var PlainValue = require_PlainValue_ec8e588e();
7971 var warnings = require_warnings_1000a372();
7972 require_resolveSeq_d03cb037();
7973 function createNode(value, wrapScalars = true, tag) {
7974 if (tag === void 0 && typeof wrapScalars === "string") {
7975 tag = wrapScalars;
7976 wrapScalars = true;
7977 }
7978 const options = Object.assign({}, Document$1.Document.defaults[Document$1.defaultOptions.version], Document$1.defaultOptions);
7979 const schema = new Schema.Schema(options);
7980 return schema.createNode(value, wrapScalars, tag);
7981 }
7982 var Document = class extends Document$1.Document {
7983 constructor(options) {
7984 super(Object.assign({}, Document$1.defaultOptions, options));
7985 }
7986 };
7987 function parseAllDocuments(src, options) {
7988 const stream = [];
7989 let prev;
7990 for (const cstDoc of parseCst.parse(src)) {
7991 const doc = new Document(options);
7992 doc.parse(cstDoc, prev);
7993 stream.push(doc);
7994 prev = doc;
7995 }
7996 return stream;
7997 }
7998 function parseDocument(src, options) {
7999 const cst = parseCst.parse(src);
8000 const doc = new Document(options).parse(cst[0]);
8001 if (cst.length > 1) {
8002 const errMsg = "Source contains multiple documents; please use YAML.parseAllDocuments()";
8003 doc.errors.unshift(new PlainValue.YAMLSemanticError(cst[1], errMsg));
8004 }
8005 return doc;
8006 }
8007 function parse(src, options) {
8008 const doc = parseDocument(src, options);
8009 doc.warnings.forEach((warning) => warnings.warn(warning));
8010 if (doc.errors.length > 0)
8011 throw doc.errors[0];
8012 return doc.toJSON();
8013 }
8014 function stringify(value, options) {
8015 const doc = new Document(options);
8016 doc.contents = value;
8017 return String(doc);
8018 }
8019 var YAML = {
8020 createNode,
8021 defaultOptions: Document$1.defaultOptions,
8022 Document,
8023 parse,
8024 parseAllDocuments,
8025 parseCST: parseCst.parse,
8026 parseDocument,
8027 scalarOptions: Document$1.scalarOptions,
8028 stringify
8029 };
8030 exports2.YAML = YAML;
8031 }
8032});
8033var require_yaml = __commonJS({
8034 "node_modules/yaml/index.js"(exports2, module2) {
8035 module2.exports = require_dist().YAML;
8036 }
8037});
8038var require_loaders = __commonJS({
8039 "node_modules/cosmiconfig/dist/loaders.js"(exports2) {
8040 "use strict";
8041 Object.defineProperty(exports2, "__esModule", {
8042 value: true
8043 });
8044 exports2.loaders = void 0;
8045 var importFresh;
8046 var loadJs = function loadJs2(filepath) {
8047 if (importFresh === void 0) {
8048 importFresh = require_import_fresh();
8049 }
8050 const result = importFresh(filepath);
8051 return result;
8052 };
8053 var parseJson;
8054 var loadJson = function loadJson2(filepath, content) {
8055 if (parseJson === void 0) {
8056 parseJson = require_parse_json();
8057 }
8058 try {
8059 const result = parseJson(content);
8060 return result;
8061 } catch (error) {
8062 error.message = `JSON Error in ${filepath}:
8063${error.message}`;
8064 throw error;
8065 }
8066 };
8067 var yaml;
8068 var loadYaml = function loadYaml2(filepath, content) {
8069 if (yaml === void 0) {
8070 yaml = require_yaml();
8071 }
8072 try {
8073 const result = yaml.parse(content, {
8074 prettyErrors: true
8075 });
8076 return result;
8077 } catch (error) {
8078 error.message = `YAML Error in ${filepath}:
8079${error.message}`;
8080 throw error;
8081 }
8082 };
8083 var loaders = {
8084 loadJs,
8085 loadJson,
8086 loadYaml
8087 };
8088 exports2.loaders = loaders;
8089 }
8090});
8091var require_getPropertyByPath = __commonJS({
8092 "node_modules/cosmiconfig/dist/getPropertyByPath.js"(exports2) {
8093 "use strict";
8094 Object.defineProperty(exports2, "__esModule", {
8095 value: true
8096 });
8097 exports2.getPropertyByPath = getPropertyByPath;
8098 function getPropertyByPath(source, path) {
8099 if (typeof path === "string" && Object.prototype.hasOwnProperty.call(source, path)) {
8100 return source[path];
8101 }
8102 const parsedPath = typeof path === "string" ? path.split(".") : path;
8103 return parsedPath.reduce((previous, key) => {
8104 if (previous === void 0) {
8105 return previous;
8106 }
8107 return previous[key];
8108 }, source);
8109 }
8110 }
8111});
8112var require_ExplorerBase = __commonJS({
8113 "node_modules/cosmiconfig/dist/ExplorerBase.js"(exports2) {
8114 "use strict";
8115 Object.defineProperty(exports2, "__esModule", {
8116 value: true
8117 });
8118 exports2.getExtensionDescription = getExtensionDescription;
8119 exports2.ExplorerBase = void 0;
8120 var _path = _interopRequireDefault(require("path"));
8121 var _loaders = require_loaders();
8122 var _getPropertyByPath = require_getPropertyByPath();
8123 function _interopRequireDefault(obj) {
8124 return obj && obj.__esModule ? obj : {
8125 default: obj
8126 };
8127 }
8128 var ExplorerBase = class {
8129 constructor(options) {
8130 if (options.cache === true) {
8131 this.loadCache = /* @__PURE__ */ new Map();
8132 this.searchCache = /* @__PURE__ */ new Map();
8133 }
8134 this.config = options;
8135 this.validateConfig();
8136 }
8137 clearLoadCache() {
8138 if (this.loadCache) {
8139 this.loadCache.clear();
8140 }
8141 }
8142 clearSearchCache() {
8143 if (this.searchCache) {
8144 this.searchCache.clear();
8145 }
8146 }
8147 clearCaches() {
8148 this.clearLoadCache();
8149 this.clearSearchCache();
8150 }
8151 validateConfig() {
8152 const config = this.config;
8153 config.searchPlaces.forEach((place) => {
8154 const loaderKey = _path.default.extname(place) || "noExt";
8155 const loader = config.loaders[loaderKey];
8156 if (!loader) {
8157 throw new Error(`No loader specified for ${getExtensionDescription(place)}, so searchPlaces item "${place}" is invalid`);
8158 }
8159 if (typeof loader !== "function") {
8160 throw new Error(`loader for ${getExtensionDescription(place)} is not a function (type provided: "${typeof loader}"), so searchPlaces item "${place}" is invalid`);
8161 }
8162 });
8163 }
8164 shouldSearchStopWithResult(result) {
8165 if (result === null)
8166 return false;
8167 if (result.isEmpty && this.config.ignoreEmptySearchPlaces)
8168 return false;
8169 return true;
8170 }
8171 nextDirectoryToSearch(currentDir, currentResult) {
8172 if (this.shouldSearchStopWithResult(currentResult)) {
8173 return null;
8174 }
8175 const nextDir = nextDirUp(currentDir);
8176 if (nextDir === currentDir || currentDir === this.config.stopDir) {
8177 return null;
8178 }
8179 return nextDir;
8180 }
8181 loadPackageProp(filepath, content) {
8182 const parsedContent = _loaders.loaders.loadJson(filepath, content);
8183 const packagePropValue = (0, _getPropertyByPath.getPropertyByPath)(parsedContent, this.config.packageProp);
8184 return packagePropValue || null;
8185 }
8186 getLoaderEntryForFile(filepath) {
8187 if (_path.default.basename(filepath) === "package.json") {
8188 const loader2 = this.loadPackageProp.bind(this);
8189 return loader2;
8190 }
8191 const loaderKey = _path.default.extname(filepath) || "noExt";
8192 const loader = this.config.loaders[loaderKey];
8193 if (!loader) {
8194 throw new Error(`No loader specified for ${getExtensionDescription(filepath)}`);
8195 }
8196 return loader;
8197 }
8198 loadedContentToCosmiconfigResult(filepath, loadedContent) {
8199 if (loadedContent === null) {
8200 return null;
8201 }
8202 if (loadedContent === void 0) {
8203 return {
8204 filepath,
8205 config: void 0,
8206 isEmpty: true
8207 };
8208 }
8209 return {
8210 config: loadedContent,
8211 filepath
8212 };
8213 }
8214 validateFilePath(filepath) {
8215 if (!filepath) {
8216 throw new Error("load must pass a non-empty string");
8217 }
8218 }
8219 };
8220 exports2.ExplorerBase = ExplorerBase;
8221 function nextDirUp(dir) {
8222 return _path.default.dirname(dir);
8223 }
8224 function getExtensionDescription(filepath) {
8225 const ext = _path.default.extname(filepath);
8226 return ext ? `extension "${ext}"` : "files without extensions";
8227 }
8228 }
8229});
8230var require_readFile = __commonJS({
8231 "node_modules/cosmiconfig/dist/readFile.js"(exports2) {
8232 "use strict";
8233 Object.defineProperty(exports2, "__esModule", {
8234 value: true
8235 });
8236 exports2.readFile = readFile;
8237 exports2.readFileSync = readFileSync;
8238 var _fs = _interopRequireDefault(require("fs"));
8239 function _interopRequireDefault(obj) {
8240 return obj && obj.__esModule ? obj : {
8241 default: obj
8242 };
8243 }
8244 async function fsReadFileAsync(pathname, encoding) {
8245 return new Promise((resolve, reject) => {
8246 _fs.default.readFile(pathname, encoding, (error, contents) => {
8247 if (error) {
8248 reject(error);
8249 return;
8250 }
8251 resolve(contents);
8252 });
8253 });
8254 }
8255 async function readFile(filepath, options = {}) {
8256 const throwNotFound = options.throwNotFound === true;
8257 try {
8258 const content = await fsReadFileAsync(filepath, "utf8");
8259 return content;
8260 } catch (error) {
8261 if (throwNotFound === false && (error.code === "ENOENT" || error.code === "EISDIR")) {
8262 return null;
8263 }
8264 throw error;
8265 }
8266 }
8267 function readFileSync(filepath, options = {}) {
8268 const throwNotFound = options.throwNotFound === true;
8269 try {
8270 const content = _fs.default.readFileSync(filepath, "utf8");
8271 return content;
8272 } catch (error) {
8273 if (throwNotFound === false && (error.code === "ENOENT" || error.code === "EISDIR")) {
8274 return null;
8275 }
8276 throw error;
8277 }
8278 }
8279 }
8280});
8281var require_cacheWrapper = __commonJS({
8282 "node_modules/cosmiconfig/dist/cacheWrapper.js"(exports2) {
8283 "use strict";
8284 Object.defineProperty(exports2, "__esModule", {
8285 value: true
8286 });
8287 exports2.cacheWrapper = cacheWrapper;
8288 exports2.cacheWrapperSync = cacheWrapperSync;
8289 async function cacheWrapper(cache, key, fn) {
8290 const cached = cache.get(key);
8291 if (cached !== void 0) {
8292 return cached;
8293 }
8294 const result = await fn();
8295 cache.set(key, result);
8296 return result;
8297 }
8298 function cacheWrapperSync(cache, key, fn) {
8299 const cached = cache.get(key);
8300 if (cached !== void 0) {
8301 return cached;
8302 }
8303 const result = fn();
8304 cache.set(key, result);
8305 return result;
8306 }
8307 }
8308});
8309var require_path_type = __commonJS({
8310 "node_modules/path-type/index.js"(exports2) {
8311 "use strict";
8312 var {
8313 promisify
8314 } = require("util");
8315 var fs = require("fs");
8316 async function isType(fsStatType, statsMethodName, filePath) {
8317 if (typeof filePath !== "string") {
8318 throw new TypeError(`Expected a string, got ${typeof filePath}`);
8319 }
8320 try {
8321 const stats = await promisify(fs[fsStatType])(filePath);
8322 return stats[statsMethodName]();
8323 } catch (error) {
8324 if (error.code === "ENOENT") {
8325 return false;
8326 }
8327 throw error;
8328 }
8329 }
8330 function isTypeSync(fsStatType, statsMethodName, filePath) {
8331 if (typeof filePath !== "string") {
8332 throw new TypeError(`Expected a string, got ${typeof filePath}`);
8333 }
8334 try {
8335 return fs[fsStatType](filePath)[statsMethodName]();
8336 } catch (error) {
8337 if (error.code === "ENOENT") {
8338 return false;
8339 }
8340 throw error;
8341 }
8342 }
8343 exports2.isFile = isType.bind(null, "stat", "isFile");
8344 exports2.isDirectory = isType.bind(null, "stat", "isDirectory");
8345 exports2.isSymlink = isType.bind(null, "lstat", "isSymbolicLink");
8346 exports2.isFileSync = isTypeSync.bind(null, "statSync", "isFile");
8347 exports2.isDirectorySync = isTypeSync.bind(null, "statSync", "isDirectory");
8348 exports2.isSymlinkSync = isTypeSync.bind(null, "lstatSync", "isSymbolicLink");
8349 }
8350});
8351var require_getDirectory = __commonJS({
8352 "node_modules/cosmiconfig/dist/getDirectory.js"(exports2) {
8353 "use strict";
8354 Object.defineProperty(exports2, "__esModule", {
8355 value: true
8356 });
8357 exports2.getDirectory = getDirectory;
8358 exports2.getDirectorySync = getDirectorySync;
8359 var _path = _interopRequireDefault(require("path"));
8360 var _pathType = require_path_type();
8361 function _interopRequireDefault(obj) {
8362 return obj && obj.__esModule ? obj : {
8363 default: obj
8364 };
8365 }
8366 async function getDirectory(filepath) {
8367 const filePathIsDirectory = await (0, _pathType.isDirectory)(filepath);
8368 if (filePathIsDirectory === true) {
8369 return filepath;
8370 }
8371 const directory = _path.default.dirname(filepath);
8372 return directory;
8373 }
8374 function getDirectorySync(filepath) {
8375 const filePathIsDirectory = (0, _pathType.isDirectorySync)(filepath);
8376 if (filePathIsDirectory === true) {
8377 return filepath;
8378 }
8379 const directory = _path.default.dirname(filepath);
8380 return directory;
8381 }
8382 }
8383});
8384var require_Explorer = __commonJS({
8385 "node_modules/cosmiconfig/dist/Explorer.js"(exports2) {
8386 "use strict";
8387 Object.defineProperty(exports2, "__esModule", {
8388 value: true
8389 });
8390 exports2.Explorer = void 0;
8391 var _path = _interopRequireDefault(require("path"));
8392 var _ExplorerBase = require_ExplorerBase();
8393 var _readFile = require_readFile();
8394 var _cacheWrapper = require_cacheWrapper();
8395 var _getDirectory = require_getDirectory();
8396 function _interopRequireDefault(obj) {
8397 return obj && obj.__esModule ? obj : {
8398 default: obj
8399 };
8400 }
8401 var Explorer = class extends _ExplorerBase.ExplorerBase {
8402 constructor(options) {
8403 super(options);
8404 }
8405 async search(searchFrom = process.cwd()) {
8406 const startDirectory = await (0, _getDirectory.getDirectory)(searchFrom);
8407 const result = await this.searchFromDirectory(startDirectory);
8408 return result;
8409 }
8410 async searchFromDirectory(dir) {
8411 const absoluteDir = _path.default.resolve(process.cwd(), dir);
8412 const run = async () => {
8413 const result = await this.searchDirectory(absoluteDir);
8414 const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
8415 if (nextDir) {
8416 return this.searchFromDirectory(nextDir);
8417 }
8418 const transformResult = await this.config.transform(result);
8419 return transformResult;
8420 };
8421 if (this.searchCache) {
8422 return (0, _cacheWrapper.cacheWrapper)(this.searchCache, absoluteDir, run);
8423 }
8424 return run();
8425 }
8426 async searchDirectory(dir) {
8427 for await (const place of this.config.searchPlaces) {
8428 const placeResult = await this.loadSearchPlace(dir, place);
8429 if (this.shouldSearchStopWithResult(placeResult) === true) {
8430 return placeResult;
8431 }
8432 }
8433 return null;
8434 }
8435 async loadSearchPlace(dir, place) {
8436 const filepath = _path.default.join(dir, place);
8437 const fileContents = await (0, _readFile.readFile)(filepath);
8438 const result = await this.createCosmiconfigResult(filepath, fileContents);
8439 return result;
8440 }
8441 async loadFileContent(filepath, content) {
8442 if (content === null) {
8443 return null;
8444 }
8445 if (content.trim() === "") {
8446 return void 0;
8447 }
8448 const loader = this.getLoaderEntryForFile(filepath);
8449 const loaderResult = await loader(filepath, content);
8450 return loaderResult;
8451 }
8452 async createCosmiconfigResult(filepath, content) {
8453 const fileContent = await this.loadFileContent(filepath, content);
8454 const result = this.loadedContentToCosmiconfigResult(filepath, fileContent);
8455 return result;
8456 }
8457 async load(filepath) {
8458 this.validateFilePath(filepath);
8459 const absoluteFilePath = _path.default.resolve(process.cwd(), filepath);
8460 const runLoad = async () => {
8461 const fileContents = await (0, _readFile.readFile)(absoluteFilePath, {
8462 throwNotFound: true
8463 });
8464 const result = await this.createCosmiconfigResult(absoluteFilePath, fileContents);
8465 const transformResult = await this.config.transform(result);
8466 return transformResult;
8467 };
8468 if (this.loadCache) {
8469 return (0, _cacheWrapper.cacheWrapper)(this.loadCache, absoluteFilePath, runLoad);
8470 }
8471 return runLoad();
8472 }
8473 };
8474 exports2.Explorer = Explorer;
8475 }
8476});
8477var require_ExplorerSync = __commonJS({
8478 "node_modules/cosmiconfig/dist/ExplorerSync.js"(exports2) {
8479 "use strict";
8480 Object.defineProperty(exports2, "__esModule", {
8481 value: true
8482 });
8483 exports2.ExplorerSync = void 0;
8484 var _path = _interopRequireDefault(require("path"));
8485 var _ExplorerBase = require_ExplorerBase();
8486 var _readFile = require_readFile();
8487 var _cacheWrapper = require_cacheWrapper();
8488 var _getDirectory = require_getDirectory();
8489 function _interopRequireDefault(obj) {
8490 return obj && obj.__esModule ? obj : {
8491 default: obj
8492 };
8493 }
8494 var ExplorerSync = class extends _ExplorerBase.ExplorerBase {
8495 constructor(options) {
8496 super(options);
8497 }
8498 searchSync(searchFrom = process.cwd()) {
8499 const startDirectory = (0, _getDirectory.getDirectorySync)(searchFrom);
8500 const result = this.searchFromDirectorySync(startDirectory);
8501 return result;
8502 }
8503 searchFromDirectorySync(dir) {
8504 const absoluteDir = _path.default.resolve(process.cwd(), dir);
8505 const run = () => {
8506 const result = this.searchDirectorySync(absoluteDir);
8507 const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
8508 if (nextDir) {
8509 return this.searchFromDirectorySync(nextDir);
8510 }
8511 const transformResult = this.config.transform(result);
8512 return transformResult;
8513 };
8514 if (this.searchCache) {
8515 return (0, _cacheWrapper.cacheWrapperSync)(this.searchCache, absoluteDir, run);
8516 }
8517 return run();
8518 }
8519 searchDirectorySync(dir) {
8520 for (const place of this.config.searchPlaces) {
8521 const placeResult = this.loadSearchPlaceSync(dir, place);
8522 if (this.shouldSearchStopWithResult(placeResult) === true) {
8523 return placeResult;
8524 }
8525 }
8526 return null;
8527 }
8528 loadSearchPlaceSync(dir, place) {
8529 const filepath = _path.default.join(dir, place);
8530 const content = (0, _readFile.readFileSync)(filepath);
8531 const result = this.createCosmiconfigResultSync(filepath, content);
8532 return result;
8533 }
8534 loadFileContentSync(filepath, content) {
8535 if (content === null) {
8536 return null;
8537 }
8538 if (content.trim() === "") {
8539 return void 0;
8540 }
8541 const loader = this.getLoaderEntryForFile(filepath);
8542 const loaderResult = loader(filepath, content);
8543 return loaderResult;
8544 }
8545 createCosmiconfigResultSync(filepath, content) {
8546 const fileContent = this.loadFileContentSync(filepath, content);
8547 const result = this.loadedContentToCosmiconfigResult(filepath, fileContent);
8548 return result;
8549 }
8550 loadSync(filepath) {
8551 this.validateFilePath(filepath);
8552 const absoluteFilePath = _path.default.resolve(process.cwd(), filepath);
8553 const runLoadSync = () => {
8554 const content = (0, _readFile.readFileSync)(absoluteFilePath, {
8555 throwNotFound: true
8556 });
8557 const cosmiconfigResult = this.createCosmiconfigResultSync(absoluteFilePath, content);
8558 const transformResult = this.config.transform(cosmiconfigResult);
8559 return transformResult;
8560 };
8561 if (this.loadCache) {
8562 return (0, _cacheWrapper.cacheWrapperSync)(this.loadCache, absoluteFilePath, runLoadSync);
8563 }
8564 return runLoadSync();
8565 }
8566 };
8567 exports2.ExplorerSync = ExplorerSync;
8568 }
8569});
8570var require_types = __commonJS({
8571 "node_modules/cosmiconfig/dist/types.js"(exports2) {
8572 "use strict";
8573 Object.defineProperty(exports2, "__esModule", {
8574 value: true
8575 });
8576 }
8577});
8578var require_dist2 = __commonJS({
8579 "node_modules/cosmiconfig/dist/index.js"(exports2) {
8580 "use strict";
8581 Object.defineProperty(exports2, "__esModule", {
8582 value: true
8583 });
8584 exports2.cosmiconfig = cosmiconfig;
8585 exports2.cosmiconfigSync = cosmiconfigSync;
8586 exports2.defaultLoaders = void 0;
8587 var _os = _interopRequireDefault(require("os"));
8588 var _Explorer = require_Explorer();
8589 var _ExplorerSync = require_ExplorerSync();
8590 var _loaders = require_loaders();
8591 var _types = require_types();
8592 function _interopRequireDefault(obj) {
8593 return obj && obj.__esModule ? obj : {
8594 default: obj
8595 };
8596 }
8597 function cosmiconfig(moduleName, options = {}) {
8598 const normalizedOptions = normalizeOptions(moduleName, options);
8599 const explorer = new _Explorer.Explorer(normalizedOptions);
8600 return {
8601 search: explorer.search.bind(explorer),
8602 load: explorer.load.bind(explorer),
8603 clearLoadCache: explorer.clearLoadCache.bind(explorer),
8604 clearSearchCache: explorer.clearSearchCache.bind(explorer),
8605 clearCaches: explorer.clearCaches.bind(explorer)
8606 };
8607 }
8608 function cosmiconfigSync(moduleName, options = {}) {
8609 const normalizedOptions = normalizeOptions(moduleName, options);
8610 const explorerSync = new _ExplorerSync.ExplorerSync(normalizedOptions);
8611 return {
8612 search: explorerSync.searchSync.bind(explorerSync),
8613 load: explorerSync.loadSync.bind(explorerSync),
8614 clearLoadCache: explorerSync.clearLoadCache.bind(explorerSync),
8615 clearSearchCache: explorerSync.clearSearchCache.bind(explorerSync),
8616 clearCaches: explorerSync.clearCaches.bind(explorerSync)
8617 };
8618 }
8619 var defaultLoaders = Object.freeze({
8620 ".cjs": _loaders.loaders.loadJs,
8621 ".js": _loaders.loaders.loadJs,
8622 ".json": _loaders.loaders.loadJson,
8623 ".yaml": _loaders.loaders.loadYaml,
8624 ".yml": _loaders.loaders.loadYaml,
8625 noExt: _loaders.loaders.loadYaml
8626 });
8627 exports2.defaultLoaders = defaultLoaders;
8628 var identity = function identity2(x) {
8629 return x;
8630 };
8631 function normalizeOptions(moduleName, options) {
8632 const defaults = {
8633 packageProp: moduleName,
8634 searchPlaces: ["package.json", `.${moduleName}rc`, `.${moduleName}rc.json`, `.${moduleName}rc.yaml`, `.${moduleName}rc.yml`, `.${moduleName}rc.js`, `.${moduleName}rc.cjs`, `${moduleName}.config.js`, `${moduleName}.config.cjs`],
8635 ignoreEmptySearchPlaces: true,
8636 stopDir: _os.default.homedir(),
8637 cache: true,
8638 transform: identity,
8639 loaders: defaultLoaders
8640 };
8641 const normalizedOptions = Object.assign(Object.assign(Object.assign({}, defaults), options), {}, {
8642 loaders: Object.assign(Object.assign({}, defaults.loaders), options.loaders)
8643 });
8644 return normalizedOptions;
8645 }
8646 }
8647});
8648var require_find_parent_dir = __commonJS({
8649 "node_modules/find-parent-dir/index.js"(exports2, module2) {
8650 "use strict";
8651 var path = require("path");
8652 var fs = require("fs");
8653 var exists = fs.exists || path.exists;
8654 var existsSync = fs.existsSync || path.existsSync;
8655 function splitPath(path2) {
8656 var parts = path2.split(/(\/|\\)/);
8657 if (!parts.length)
8658 return parts;
8659 return !parts[0].length ? parts.slice(1) : parts;
8660 }
8661 exports2 = module2.exports = function(currentFullPath, clue, cb) {
8662 function testDir(parts) {
8663 if (parts.length === 0)
8664 return cb(null, null);
8665 var p = parts.join("");
8666 exists(path.join(p, clue), function(itdoes) {
8667 if (itdoes)
8668 return cb(null, p);
8669 testDir(parts.slice(0, -1));
8670 });
8671 }
8672 testDir(splitPath(currentFullPath));
8673 };
8674 exports2.sync = function(currentFullPath, clue) {
8675 function testDir(parts) {
8676 if (parts.length === 0)
8677 return null;
8678 var p = parts.join("");
8679 var itdoes = existsSync(path.join(p, clue));
8680 return itdoes ? p : testDir(parts.slice(0, -1));
8681 }
8682 return testDir(splitPath(currentFullPath));
8683 };
8684 }
8685});
8686var require_get_stdin = __commonJS({
8687 "node_modules/get-stdin/index.js"(exports2, module2) {
8688 "use strict";
8689 var {
8690 stdin
8691 } = process;
8692 module2.exports = async () => {
8693 let result = "";
8694 if (stdin.isTTY) {
8695 return result;
8696 }
8697 stdin.setEncoding("utf8");
8698 for await (const chunk of stdin) {
8699 result += chunk;
8700 }
8701 return result;
8702 };
8703 module2.exports.buffer = async () => {
8704 const result = [];
8705 let length = 0;
8706 if (stdin.isTTY) {
8707 return Buffer.concat([]);
8708 }
8709 for await (const chunk of stdin) {
8710 result.push(chunk);
8711 length += chunk.length;
8712 }
8713 return Buffer.concat(result, length);
8714 };
8715 }
8716});
8717var require_vendors = __commonJS({
8718 "node_modules/ci-info/vendors.json"(exports2, module2) {
8719 module2.exports = [{
8720 name: "AppVeyor",
8721 constant: "APPVEYOR",
8722 env: "APPVEYOR",
8723 pr: "APPVEYOR_PULL_REQUEST_NUMBER"
8724 }, {
8725 name: "Azure Pipelines",
8726 constant: "AZURE_PIPELINES",
8727 env: "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",
8728 pr: "SYSTEM_PULLREQUEST_PULLREQUESTID"
8729 }, {
8730 name: "Appcircle",
8731 constant: "APPCIRCLE",
8732 env: "AC_APPCIRCLE"
8733 }, {
8734 name: "Bamboo",
8735 constant: "BAMBOO",
8736 env: "bamboo_planKey"
8737 }, {
8738 name: "Bitbucket Pipelines",
8739 constant: "BITBUCKET",
8740 env: "BITBUCKET_COMMIT",
8741 pr: "BITBUCKET_PR_ID"
8742 }, {
8743 name: "Bitrise",
8744 constant: "BITRISE",
8745 env: "BITRISE_IO",
8746 pr: "BITRISE_PULL_REQUEST"
8747 }, {
8748 name: "Buddy",
8749 constant: "BUDDY",
8750 env: "BUDDY_WORKSPACE_ID",
8751 pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
8752 }, {
8753 name: "Buildkite",
8754 constant: "BUILDKITE",
8755 env: "BUILDKITE",
8756 pr: {
8757 env: "BUILDKITE_PULL_REQUEST",
8758 ne: "false"
8759 }
8760 }, {
8761 name: "CircleCI",
8762 constant: "CIRCLE",
8763 env: "CIRCLECI",
8764 pr: "CIRCLE_PULL_REQUEST"
8765 }, {
8766 name: "Cirrus CI",
8767 constant: "CIRRUS",
8768 env: "CIRRUS_CI",
8769 pr: "CIRRUS_PR"
8770 }, {
8771 name: "AWS CodeBuild",
8772 constant: "CODEBUILD",
8773 env: "CODEBUILD_BUILD_ARN"
8774 }, {
8775 name: "Codefresh",
8776 constant: "CODEFRESH",
8777 env: "CF_BUILD_ID",
8778 pr: {
8779 any: ["CF_PULL_REQUEST_NUMBER", "CF_PULL_REQUEST_ID"]
8780 }
8781 }, {
8782 name: "Codeship",
8783 constant: "CODESHIP",
8784 env: {
8785 CI_NAME: "codeship"
8786 }
8787 }, {
8788 name: "Drone",
8789 constant: "DRONE",
8790 env: "DRONE",
8791 pr: {
8792 DRONE_BUILD_EVENT: "pull_request"
8793 }
8794 }, {
8795 name: "dsari",
8796 constant: "DSARI",
8797 env: "DSARI"
8798 }, {
8799 name: "Expo Application Services",
8800 constant: "EAS",
8801 env: "EAS_BUILD"
8802 }, {
8803 name: "GitHub Actions",
8804 constant: "GITHUB_ACTIONS",
8805 env: "GITHUB_ACTIONS",
8806 pr: {
8807 GITHUB_EVENT_NAME: "pull_request"
8808 }
8809 }, {
8810 name: "GitLab CI",
8811 constant: "GITLAB",
8812 env: "GITLAB_CI",
8813 pr: "CI_MERGE_REQUEST_ID"
8814 }, {
8815 name: "GoCD",
8816 constant: "GOCD",
8817 env: "GO_PIPELINE_LABEL"
8818 }, {
8819 name: "LayerCI",
8820 constant: "LAYERCI",
8821 env: "LAYERCI",
8822 pr: "LAYERCI_PULL_REQUEST"
8823 }, {
8824 name: "Hudson",
8825 constant: "HUDSON",
8826 env: "HUDSON_URL"
8827 }, {
8828 name: "Jenkins",
8829 constant: "JENKINS",
8830 env: ["JENKINS_URL", "BUILD_ID"],
8831 pr: {
8832 any: ["ghprbPullId", "CHANGE_ID"]
8833 }
8834 }, {
8835 name: "Magnum CI",
8836 constant: "MAGNUM",
8837 env: "MAGNUM"
8838 }, {
8839 name: "Netlify CI",
8840 constant: "NETLIFY",
8841 env: "NETLIFY",
8842 pr: {
8843 env: "PULL_REQUEST",
8844 ne: "false"
8845 }
8846 }, {
8847 name: "Nevercode",
8848 constant: "NEVERCODE",
8849 env: "NEVERCODE",
8850 pr: {
8851 env: "NEVERCODE_PULL_REQUEST",
8852 ne: "false"
8853 }
8854 }, {
8855 name: "Render",
8856 constant: "RENDER",
8857 env: "RENDER",
8858 pr: {
8859 IS_PULL_REQUEST: "true"
8860 }
8861 }, {
8862 name: "Sail CI",
8863 constant: "SAIL",
8864 env: "SAILCI",
8865 pr: "SAIL_PULL_REQUEST_NUMBER"
8866 }, {
8867 name: "Semaphore",
8868 constant: "SEMAPHORE",
8869 env: "SEMAPHORE",
8870 pr: "PULL_REQUEST_NUMBER"
8871 }, {
8872 name: "Screwdriver",
8873 constant: "SCREWDRIVER",
8874 env: "SCREWDRIVER",
8875 pr: {
8876 env: "SD_PULL_REQUEST",
8877 ne: "false"
8878 }
8879 }, {
8880 name: "Shippable",
8881 constant: "SHIPPABLE",
8882 env: "SHIPPABLE",
8883 pr: {
8884 IS_PULL_REQUEST: "true"
8885 }
8886 }, {
8887 name: "Solano CI",
8888 constant: "SOLANO",
8889 env: "TDDIUM",
8890 pr: "TDDIUM_PR_ID"
8891 }, {
8892 name: "Strider CD",
8893 constant: "STRIDER",
8894 env: "STRIDER"
8895 }, {
8896 name: "TaskCluster",
8897 constant: "TASKCLUSTER",
8898 env: ["TASK_ID", "RUN_ID"]
8899 }, {
8900 name: "TeamCity",
8901 constant: "TEAMCITY",
8902 env: "TEAMCITY_VERSION"
8903 }, {
8904 name: "Travis CI",
8905 constant: "TRAVIS",
8906 env: "TRAVIS",
8907 pr: {
8908 env: "TRAVIS_PULL_REQUEST",
8909 ne: "false"
8910 }
8911 }, {
8912 name: "Vercel",
8913 constant: "VERCEL",
8914 env: "NOW_BUILDER"
8915 }, {
8916 name: "Visual Studio App Center",
8917 constant: "APPCENTER",
8918 env: "APPCENTER_BUILD_ID"
8919 }];
8920 }
8921});
8922var require_ci_info = __commonJS({
8923 "node_modules/ci-info/index.js"(exports2) {
8924 "use strict";
8925 var vendors = require_vendors();
8926 var env = process.env;
8927 Object.defineProperty(exports2, "_vendors", {
8928 value: vendors.map(function(v) {
8929 return v.constant;
8930 })
8931 });
8932 exports2.name = null;
8933 exports2.isPR = null;
8934 vendors.forEach(function(vendor) {
8935 const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
8936 const isCI = envs.every(function(obj) {
8937 return checkEnv(obj);
8938 });
8939 exports2[vendor.constant] = isCI;
8940 if (isCI) {
8941 exports2.name = vendor.name;
8942 switch (typeof vendor.pr) {
8943 case "string":
8944 exports2.isPR = !!env[vendor.pr];
8945 break;
8946 case "object":
8947 if ("env" in vendor.pr) {
8948 exports2.isPR = vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne;
8949 } else if ("any" in vendor.pr) {
8950 exports2.isPR = vendor.pr.any.some(function(key) {
8951 return !!env[key];
8952 });
8953 } else {
8954 exports2.isPR = checkEnv(vendor.pr);
8955 }
8956 break;
8957 default:
8958 exports2.isPR = null;
8959 }
8960 }
8961 });
8962 exports2.isCI = !!(env.CI || env.CONTINUOUS_INTEGRATION || env.BUILD_NUMBER || env.RUN_ID || exports2.name || false);
8963 function checkEnv(obj) {
8964 if (typeof obj === "string")
8965 return !!env[obj];
8966 return Object.keys(obj).every(function(k) {
8967 return env[k] === obj[k];
8968 });
8969 }
8970 }
8971});
8972module.exports = {
8973 cosmiconfig: require_dist2().cosmiconfig,
8974 cosmiconfigSync: require_dist2().cosmiconfigSync,
8975 findParentDir: require_find_parent_dir().sync,
8976 getStdin: require_get_stdin(),
8977 isCI: () => require_ci_info().isCI
8978};