61f98aa3347578a4d2826688a8363624de5a76c9
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / prettier / third-party.js
1 'use strict';
2
3 Object.defineProperty(exports, '__esModule', { value: true });
4
5 function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
7 var os = _interopDefault(require('os'));
8 var path = _interopDefault(require('path'));
9 var module$1 = _interopDefault(require('module'));
10 var fs = _interopDefault(require('fs'));
11 var util = _interopDefault(require('util'));
12 var stream = _interopDefault(require('stream'));
13
14 function unwrapExports (x) {
15         return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
16 }
17
18 function createCommonjsModule(fn, module) {
19         return module = { exports: {} }, fn(module, module.exports), module.exports;
20 }
21
22 function getCjsExportFromNamespace (n) {
23         return n && n['default'] || n;
24 }
25
26 const resolveFrom = (fromDir, moduleId, silent) => {
27   if (typeof fromDir !== 'string') {
28     throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDir}\``);
29   }
30
31   if (typeof moduleId !== 'string') {
32     throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
33   }
34
35   try {
36     fromDir = fs.realpathSync(fromDir);
37   } catch (err) {
38     if (err.code === 'ENOENT') {
39       fromDir = path.resolve(fromDir);
40     } else if (silent) {
41       return null;
42     } else {
43       throw err;
44     }
45   }
46
47   const fromFile = path.join(fromDir, 'noop.js');
48
49   const resolveFileName = () => module$1._resolveFilename(moduleId, {
50     id: fromFile,
51     filename: fromFile,
52     paths: module$1._nodeModulePaths(fromDir)
53   });
54
55   if (silent) {
56     try {
57       return resolveFileName();
58     } catch (err) {
59       return null;
60     }
61   }
62
63   return resolveFileName();
64 };
65
66 var resolveFrom_1 = (fromDir, moduleId) => resolveFrom(fromDir, moduleId);
67
68 var silent = (fromDir, moduleId) => resolveFrom(fromDir, moduleId, true);
69 resolveFrom_1.silent = silent;
70
71 var importFresh = moduleId => {
72   if (typeof moduleId !== 'string') {
73     throw new TypeError('Expected a string');
74   }
75
76   const parentPath = __filename;
77   const filePath = resolveFrom_1(path.dirname(parentPath), moduleId);
78   const oldModule = eval('require').cache[filePath]; // Delete itself from module parent
79
80   if (oldModule && oldModule.parent) {
81     let i = oldModule.parent.children.length;
82
83     while (i--) {
84       if (oldModule.parent.children[i].id === filePath) {
85         oldModule.parent.children.splice(i, 1);
86       }
87     }
88   }
89
90   delete eval('require').cache[filePath]; // Delete module from cache
91
92   const parent = eval('require').cache[parentPath]; // If `filePath` and `parentPath` are the same, cache will already be deleted so we won't get a memory leak in next step
93
94   return parent === undefined ? eval('require')(filePath) : parent.require(filePath); // In case cache doesn't have parent, fall back to normal require
95 };
96
97 var isArrayish = function isArrayish(obj) {
98   if (!obj) {
99     return false;
100   }
101
102   return obj instanceof Array || Array.isArray(obj) || obj.length >= 0 && obj.splice instanceof Function;
103 };
104
105 var errorEx = function errorEx(name, properties) {
106   if (!name || name.constructor !== String) {
107     properties = name || {};
108     name = Error.name;
109   }
110
111   var errorExError = function ErrorEXError(message) {
112     if (!this) {
113       return new ErrorEXError(message);
114     }
115
116     message = message instanceof Error ? message.message : message || this.message;
117     Error.call(this, message);
118     Error.captureStackTrace(this, errorExError);
119     this.name = name;
120     Object.defineProperty(this, 'message', {
121       configurable: true,
122       enumerable: false,
123       get: function () {
124         var newMessage = message.split(/\r?\n/g);
125
126         for (var key in properties) {
127           if (!properties.hasOwnProperty(key)) {
128             continue;
129           }
130
131           var modifier = properties[key];
132
133           if ('message' in modifier) {
134             newMessage = modifier.message(this[key], newMessage) || newMessage;
135
136             if (!isArrayish(newMessage)) {
137               newMessage = [newMessage];
138             }
139           }
140         }
141
142         return newMessage.join('\n');
143       },
144       set: function (v) {
145         message = v;
146       }
147     });
148     var overwrittenStack = null;
149     var stackDescriptor = Object.getOwnPropertyDescriptor(this, 'stack');
150     var stackGetter = stackDescriptor.get;
151     var stackValue = stackDescriptor.value;
152     delete stackDescriptor.value;
153     delete stackDescriptor.writable;
154
155     stackDescriptor.set = function (newstack) {
156       overwrittenStack = newstack;
157     };
158
159     stackDescriptor.get = function () {
160       var stack = (overwrittenStack || (stackGetter ? stackGetter.call(this) : stackValue)).split(/\r?\n+/g); // starting in Node 7, the stack builder caches the message.
161       // just replace it.
162
163       if (!overwrittenStack) {
164         stack[0] = this.name + ': ' + this.message;
165       }
166
167       var lineCount = 1;
168
169       for (var key in properties) {
170         if (!properties.hasOwnProperty(key)) {
171           continue;
172         }
173
174         var modifier = properties[key];
175
176         if ('line' in modifier) {
177           var line = modifier.line(this[key]);
178
179           if (line) {
180             stack.splice(lineCount++, 0, '    ' + line);
181           }
182         }
183
184         if ('stack' in modifier) {
185           modifier.stack(this[key], stack);
186         }
187       }
188
189       return stack.join('\n');
190     };
191
192     Object.defineProperty(this, 'stack', stackDescriptor);
193   };
194
195   if (Object.setPrototypeOf) {
196     Object.setPrototypeOf(errorExError.prototype, Error.prototype);
197     Object.setPrototypeOf(errorExError, Error);
198   } else {
199     util.inherits(errorExError, Error);
200   }
201
202   return errorExError;
203 };
204
205 errorEx.append = function (str, def) {
206   return {
207     message: function (v, message) {
208       v = v || def;
209
210       if (v) {
211         message[0] += ' ' + str.replace('%s', v.toString());
212       }
213
214       return message;
215     }
216   };
217 };
218
219 errorEx.line = function (str, def) {
220   return {
221     line: function (v) {
222       v = v || def;
223
224       if (v) {
225         return str.replace('%s', v.toString());
226       }
227
228       return null;
229     }
230   };
231 };
232
233 var errorEx_1 = errorEx;
234
235 var jsonParseBetterErrors = parseJson;
236
237 function parseJson(txt, reviver, context) {
238   context = context || 20;
239
240   try {
241     return JSON.parse(txt, reviver);
242   } catch (e) {
243     if (typeof txt !== 'string') {
244       const isEmptyArray = Array.isArray(txt) && txt.length === 0;
245       const errorMessage = 'Cannot parse ' + (isEmptyArray ? 'an empty array' : String(txt));
246       throw new TypeError(errorMessage);
247     }
248
249     const syntaxErr = e.message.match(/^Unexpected token.*position\s+(\d+)/i);
250     const errIdx = syntaxErr ? +syntaxErr[1] : e.message.match(/^Unexpected end of JSON.*/i) ? txt.length - 1 : null;
251
252     if (errIdx != null) {
253       const start = errIdx <= context ? 0 : errIdx - context;
254       const end = errIdx + context >= txt.length ? txt.length : errIdx + context;
255       e.message += ` while parsing near '${start === 0 ? '' : '...'}${txt.slice(start, end)}${end === txt.length ? '' : '...'}'`;
256     } else {
257       e.message += ` while parsing '${txt.slice(0, context * 2)}'`;
258     }
259
260     throw e;
261   }
262 }
263
264 var LF = '\n';
265 var CR = '\r';
266
267 var LinesAndColumns = function () {
268   function LinesAndColumns(string) {
269     this.string = string;
270     var offsets = [0];
271
272     for (var offset = 0; offset < string.length;) {
273       switch (string[offset]) {
274         case LF:
275           offset += LF.length;
276           offsets.push(offset);
277           break;
278
279         case CR:
280           offset += CR.length;
281
282           if (string[offset] === LF) {
283             offset += LF.length;
284           }
285
286           offsets.push(offset);
287           break;
288
289         default:
290           offset++;
291           break;
292       }
293     }
294
295     this.offsets = offsets;
296   }
297
298   LinesAndColumns.prototype.locationForIndex = function (index) {
299     if (index < 0 || index > this.string.length) {
300       return null;
301     }
302
303     var line = 0;
304     var offsets = this.offsets;
305
306     while (offsets[line + 1] <= index) {
307       line++;
308     }
309
310     var column = index - offsets[line];
311     return {
312       line: line,
313       column: column
314     };
315   };
316
317   LinesAndColumns.prototype.indexForLocation = function (location) {
318     var line = location.line,
319         column = location.column;
320
321     if (line < 0 || line >= this.offsets.length) {
322       return null;
323     }
324
325     if (column < 0 || column > this.lengthOfLine(line)) {
326       return null;
327     }
328
329     return this.offsets[line] + column;
330   };
331
332   LinesAndColumns.prototype.lengthOfLine = function (line) {
333     var offset = this.offsets[line];
334     var nextOffset = line === this.offsets.length - 1 ? this.string.length : this.offsets[line + 1];
335     return nextOffset - offset;
336   };
337
338   return LinesAndColumns;
339 }();
340
341 var dist = /*#__PURE__*/Object.freeze({
342         __proto__: null,
343         'default': LinesAndColumns
344 });
345
346 var jsTokens = createCommonjsModule(function (module, exports) {
347   // Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell
348   // License: MIT. (See LICENSE.)
349   Object.defineProperty(exports, "__esModule", {
350     value: true
351   }); // This regex comes from regex.coffee, and is inserted here by generate-index.js
352   // (run `npm run build`).
353
354   exports.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;
355
356   exports.matchToToken = function (match) {
357     var token = {
358       type: "invalid",
359       value: match[0],
360       closed: undefined
361     };
362     if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);else if (match[5]) token.type = "comment";else if (match[6]) token.type = "comment", token.closed = !!match[7];else if (match[8]) token.type = "regex";else if (match[9]) token.type = "number";else if (match[10]) token.type = "name";else if (match[11]) token.type = "punctuator";else if (match[12]) token.type = "whitespace";
363     return token;
364   };
365 });
366 unwrapExports(jsTokens);
367 var jsTokens_1 = jsTokens.matchToToken;
368
369 var ast = createCommonjsModule(function (module) {
370   /*
371     Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
372   
373     Redistribution and use in source and binary forms, with or without
374     modification, are permitted provided that the following conditions are met:
375   
376       * Redistributions of source code must retain the above copyright
377         notice, this list of conditions and the following disclaimer.
378       * Redistributions in binary form must reproduce the above copyright
379         notice, this list of conditions and the following disclaimer in the
380         documentation and/or other materials provided with the distribution.
381   
382     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
383     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
384     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
385     ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
386     DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
387     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
388     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
389     ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
390     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
391     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
392   */
393   (function () {
394
395     function isExpression(node) {
396       if (node == null) {
397         return false;
398       }
399
400       switch (node.type) {
401         case 'ArrayExpression':
402         case 'AssignmentExpression':
403         case 'BinaryExpression':
404         case 'CallExpression':
405         case 'ConditionalExpression':
406         case 'FunctionExpression':
407         case 'Identifier':
408         case 'Literal':
409         case 'LogicalExpression':
410         case 'MemberExpression':
411         case 'NewExpression':
412         case 'ObjectExpression':
413         case 'SequenceExpression':
414         case 'ThisExpression':
415         case 'UnaryExpression':
416         case 'UpdateExpression':
417           return true;
418       }
419
420       return false;
421     }
422
423     function isIterationStatement(node) {
424       if (node == null) {
425         return false;
426       }
427
428       switch (node.type) {
429         case 'DoWhileStatement':
430         case 'ForInStatement':
431         case 'ForStatement':
432         case 'WhileStatement':
433           return true;
434       }
435
436       return false;
437     }
438
439     function isStatement(node) {
440       if (node == null) {
441         return false;
442       }
443
444       switch (node.type) {
445         case 'BlockStatement':
446         case 'BreakStatement':
447         case 'ContinueStatement':
448         case 'DebuggerStatement':
449         case 'DoWhileStatement':
450         case 'EmptyStatement':
451         case 'ExpressionStatement':
452         case 'ForInStatement':
453         case 'ForStatement':
454         case 'IfStatement':
455         case 'LabeledStatement':
456         case 'ReturnStatement':
457         case 'SwitchStatement':
458         case 'ThrowStatement':
459         case 'TryStatement':
460         case 'VariableDeclaration':
461         case 'WhileStatement':
462         case 'WithStatement':
463           return true;
464       }
465
466       return false;
467     }
468
469     function isSourceElement(node) {
470       return isStatement(node) || node != null && node.type === 'FunctionDeclaration';
471     }
472
473     function trailingStatement(node) {
474       switch (node.type) {
475         case 'IfStatement':
476           if (node.alternate != null) {
477             return node.alternate;
478           }
479
480           return node.consequent;
481
482         case 'LabeledStatement':
483         case 'ForStatement':
484         case 'ForInStatement':
485         case 'WhileStatement':
486         case 'WithStatement':
487           return node.body;
488       }
489
490       return null;
491     }
492
493     function isProblematicIfStatement(node) {
494       var current;
495
496       if (node.type !== 'IfStatement') {
497         return false;
498       }
499
500       if (node.alternate == null) {
501         return false;
502       }
503
504       current = node.consequent;
505
506       do {
507         if (current.type === 'IfStatement') {
508           if (current.alternate == null) {
509             return true;
510           }
511         }
512
513         current = trailingStatement(current);
514       } while (current);
515
516       return false;
517     }
518
519     module.exports = {
520       isExpression: isExpression,
521       isStatement: isStatement,
522       isIterationStatement: isIterationStatement,
523       isSourceElement: isSourceElement,
524       isProblematicIfStatement: isProblematicIfStatement,
525       trailingStatement: trailingStatement
526     };
527   })();
528   /* vim: set sw=4 ts=4 et tw=80 : */
529
530 });
531 var ast_1 = ast.isExpression;
532 var ast_2 = ast.isStatement;
533 var ast_3 = ast.isIterationStatement;
534 var ast_4 = ast.isSourceElement;
535 var ast_5 = ast.isProblematicIfStatement;
536 var ast_6 = ast.trailingStatement;
537
538 var code = createCommonjsModule(function (module) {
539   /*
540     Copyright (C) 2013-2014 Yusuke Suzuki <utatane.tea@gmail.com>
541     Copyright (C) 2014 Ivan Nikulin <ifaaan@gmail.com>
542   
543     Redistribution and use in source and binary forms, with or without
544     modification, are permitted provided that the following conditions are met:
545   
546       * Redistributions of source code must retain the above copyright
547         notice, this list of conditions and the following disclaimer.
548       * Redistributions in binary form must reproduce the above copyright
549         notice, this list of conditions and the following disclaimer in the
550         documentation and/or other materials provided with the distribution.
551   
552     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
553     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
554     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
555     ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
556     DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
557     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
558     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
559     ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
560     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
561     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
562   */
563   (function () {
564
565     var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch; // See `tools/generate-identifier-regex.js`.
566
567     ES5Regex = {
568       // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierStart:
569       NonAsciiIdentifierStart: /[\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\u0561-\u0587\u05D0-\u05EA\u05F0-\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\u08A0-\u08B4\u08B6-\u08BD\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\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\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\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\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\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-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\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\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uAB65\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]/,
570       // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierPart:
571       NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\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\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\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\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/
572     };
573     ES6Regex = {
574       // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierStart:
575       NonAsciiIdentifierStart: /[\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\u0561-\u0587\u05D0-\u05EA\u05F0-\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\u08A0-\u08B4\u08B6-\u08BD\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\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\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\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\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\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-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\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-\u2C2E\u2C30-\u2C5E\u2C60-\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-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uAB65\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]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,
576       // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierPart:
577       NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\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\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\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\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
578     };
579
580     function isDecimalDigit(ch) {
581       return 0x30 <= ch && ch <= 0x39; // 0..9
582     }
583
584     function isHexDigit(ch) {
585       return 0x30 <= ch && ch <= 0x39 || // 0..9
586       0x61 <= ch && ch <= 0x66 || // a..f
587       0x41 <= ch && ch <= 0x46; // A..F
588     }
589
590     function isOctalDigit(ch) {
591       return ch >= 0x30 && ch <= 0x37; // 0..7
592     } // 7.2 White Space
593
594
595     NON_ASCII_WHITESPACES = [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF];
596
597     function isWhiteSpace(ch) {
598       return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0;
599     } // 7.3 Line Terminators
600
601
602     function isLineTerminator(ch) {
603       return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
604     } // 7.6 Identifier Names and Identifiers
605
606
607     function fromCodePoint(cp) {
608       if (cp <= 0xFFFF) {
609         return String.fromCharCode(cp);
610       }
611
612       var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800);
613       var cu2 = String.fromCharCode((cp - 0x10000) % 0x400 + 0xDC00);
614       return cu1 + cu2;
615     }
616
617     IDENTIFIER_START = new Array(0x80);
618
619     for (ch = 0; ch < 0x80; ++ch) {
620       IDENTIFIER_START[ch] = ch >= 0x61 && ch <= 0x7A || // a..z
621       ch >= 0x41 && ch <= 0x5A || // A..Z
622       ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
623     }
624
625     IDENTIFIER_PART = new Array(0x80);
626
627     for (ch = 0; ch < 0x80; ++ch) {
628       IDENTIFIER_PART[ch] = ch >= 0x61 && ch <= 0x7A || // a..z
629       ch >= 0x41 && ch <= 0x5A || // A..Z
630       ch >= 0x30 && ch <= 0x39 || // 0..9
631       ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
632     }
633
634     function isIdentifierStartES5(ch) {
635       return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
636     }
637
638     function isIdentifierPartES5(ch) {
639       return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
640     }
641
642     function isIdentifierStartES6(ch) {
643       return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
644     }
645
646     function isIdentifierPartES6(ch) {
647       return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
648     }
649
650     module.exports = {
651       isDecimalDigit: isDecimalDigit,
652       isHexDigit: isHexDigit,
653       isOctalDigit: isOctalDigit,
654       isWhiteSpace: isWhiteSpace,
655       isLineTerminator: isLineTerminator,
656       isIdentifierStartES5: isIdentifierStartES5,
657       isIdentifierPartES5: isIdentifierPartES5,
658       isIdentifierStartES6: isIdentifierStartES6,
659       isIdentifierPartES6: isIdentifierPartES6
660     };
661   })();
662   /* vim: set sw=4 ts=4 et tw=80 : */
663
664 });
665 var code_1 = code.isDecimalDigit;
666 var code_2 = code.isHexDigit;
667 var code_3 = code.isOctalDigit;
668 var code_4 = code.isWhiteSpace;
669 var code_5 = code.isLineTerminator;
670 var code_6 = code.isIdentifierStartES5;
671 var code_7 = code.isIdentifierPartES5;
672 var code_8 = code.isIdentifierStartES6;
673 var code_9 = code.isIdentifierPartES6;
674
675 var keyword = createCommonjsModule(function (module) {
676   /*
677     Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
678   
679     Redistribution and use in source and binary forms, with or without
680     modification, are permitted provided that the following conditions are met:
681   
682       * Redistributions of source code must retain the above copyright
683         notice, this list of conditions and the following disclaimer.
684       * Redistributions in binary form must reproduce the above copyright
685         notice, this list of conditions and the following disclaimer in the
686         documentation and/or other materials provided with the distribution.
687   
688     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
689     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
690     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
691     ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
692     DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
693     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
694     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
695     ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
696     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
697     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
698   */
699   (function () {
700
701     var code$1 = code;
702
703     function isStrictModeReservedWordES6(id) {
704       switch (id) {
705         case 'implements':
706         case 'interface':
707         case 'package':
708         case 'private':
709         case 'protected':
710         case 'public':
711         case 'static':
712         case 'let':
713           return true;
714
715         default:
716           return false;
717       }
718     }
719
720     function isKeywordES5(id, strict) {
721       // yield should not be treated as keyword under non-strict mode.
722       if (!strict && id === 'yield') {
723         return false;
724       }
725
726       return isKeywordES6(id, strict);
727     }
728
729     function isKeywordES6(id, strict) {
730       if (strict && isStrictModeReservedWordES6(id)) {
731         return true;
732       }
733
734       switch (id.length) {
735         case 2:
736           return id === 'if' || id === 'in' || id === 'do';
737
738         case 3:
739           return id === 'var' || id === 'for' || id === 'new' || id === 'try';
740
741         case 4:
742           return id === 'this' || id === 'else' || id === 'case' || id === 'void' || id === 'with' || id === 'enum';
743
744         case 5:
745           return id === 'while' || id === 'break' || id === 'catch' || id === 'throw' || id === 'const' || id === 'yield' || id === 'class' || id === 'super';
746
747         case 6:
748           return id === 'return' || id === 'typeof' || id === 'delete' || id === 'switch' || id === 'export' || id === 'import';
749
750         case 7:
751           return id === 'default' || id === 'finally' || id === 'extends';
752
753         case 8:
754           return id === 'function' || id === 'continue' || id === 'debugger';
755
756         case 10:
757           return id === 'instanceof';
758
759         default:
760           return false;
761       }
762     }
763
764     function isReservedWordES5(id, strict) {
765       return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
766     }
767
768     function isReservedWordES6(id, strict) {
769       return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict);
770     }
771
772     function isRestrictedWord(id) {
773       return id === 'eval' || id === 'arguments';
774     }
775
776     function isIdentifierNameES5(id) {
777       var i, iz, ch;
778
779       if (id.length === 0) {
780         return false;
781       }
782
783       ch = id.charCodeAt(0);
784
785       if (!code$1.isIdentifierStartES5(ch)) {
786         return false;
787       }
788
789       for (i = 1, iz = id.length; i < iz; ++i) {
790         ch = id.charCodeAt(i);
791
792         if (!code$1.isIdentifierPartES5(ch)) {
793           return false;
794         }
795       }
796
797       return true;
798     }
799
800     function decodeUtf16(lead, trail) {
801       return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
802     }
803
804     function isIdentifierNameES6(id) {
805       var i, iz, ch, lowCh, check;
806
807       if (id.length === 0) {
808         return false;
809       }
810
811       check = code$1.isIdentifierStartES6;
812
813       for (i = 0, iz = id.length; i < iz; ++i) {
814         ch = id.charCodeAt(i);
815
816         if (0xD800 <= ch && ch <= 0xDBFF) {
817           ++i;
818
819           if (i >= iz) {
820             return false;
821           }
822
823           lowCh = id.charCodeAt(i);
824
825           if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) {
826             return false;
827           }
828
829           ch = decodeUtf16(ch, lowCh);
830         }
831
832         if (!check(ch)) {
833           return false;
834         }
835
836         check = code$1.isIdentifierPartES6;
837       }
838
839       return true;
840     }
841
842     function isIdentifierES5(id, strict) {
843       return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
844     }
845
846     function isIdentifierES6(id, strict) {
847       return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
848     }
849
850     module.exports = {
851       isKeywordES5: isKeywordES5,
852       isKeywordES6: isKeywordES6,
853       isReservedWordES5: isReservedWordES5,
854       isReservedWordES6: isReservedWordES6,
855       isRestrictedWord: isRestrictedWord,
856       isIdentifierNameES5: isIdentifierNameES5,
857       isIdentifierNameES6: isIdentifierNameES6,
858       isIdentifierES5: isIdentifierES5,
859       isIdentifierES6: isIdentifierES6
860     };
861   })();
862   /* vim: set sw=4 ts=4 et tw=80 : */
863
864 });
865 var keyword_1 = keyword.isKeywordES5;
866 var keyword_2 = keyword.isKeywordES6;
867 var keyword_3 = keyword.isReservedWordES5;
868 var keyword_4 = keyword.isReservedWordES6;
869 var keyword_5 = keyword.isRestrictedWord;
870 var keyword_6 = keyword.isIdentifierNameES5;
871 var keyword_7 = keyword.isIdentifierNameES6;
872 var keyword_8 = keyword.isIdentifierES5;
873 var keyword_9 = keyword.isIdentifierES6;
874
875 var utils = createCommonjsModule(function (module, exports) {
876   /*
877     Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
878   
879     Redistribution and use in source and binary forms, with or without
880     modification, are permitted provided that the following conditions are met:
881   
882       * Redistributions of source code must retain the above copyright
883         notice, this list of conditions and the following disclaimer.
884       * Redistributions in binary form must reproduce the above copyright
885         notice, this list of conditions and the following disclaimer in the
886         documentation and/or other materials provided with the distribution.
887   
888     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
889     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
890     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
891     ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
892     DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
893     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
894     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
895     ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
896     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
897     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
898   */
899   (function () {
900
901     exports.ast = ast;
902     exports.code = code;
903     exports.keyword = keyword;
904   })();
905   /* vim: set sw=4 ts=4 et tw=80 : */
906
907 });
908 var utils_1 = utils.ast;
909 var utils_2 = utils.code;
910 var utils_3 = utils.keyword;
911
912 var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
913
914 var escapeStringRegexp = function (str) {
915   if (typeof str !== 'string') {
916     throw new TypeError('Expected a string');
917   }
918
919   return str.replace(matchOperatorsRe, '\\$&');
920 };
921
922 var colorName = {
923   "aliceblue": [240, 248, 255],
924   "antiquewhite": [250, 235, 215],
925   "aqua": [0, 255, 255],
926   "aquamarine": [127, 255, 212],
927   "azure": [240, 255, 255],
928   "beige": [245, 245, 220],
929   "bisque": [255, 228, 196],
930   "black": [0, 0, 0],
931   "blanchedalmond": [255, 235, 205],
932   "blue": [0, 0, 255],
933   "blueviolet": [138, 43, 226],
934   "brown": [165, 42, 42],
935   "burlywood": [222, 184, 135],
936   "cadetblue": [95, 158, 160],
937   "chartreuse": [127, 255, 0],
938   "chocolate": [210, 105, 30],
939   "coral": [255, 127, 80],
940   "cornflowerblue": [100, 149, 237],
941   "cornsilk": [255, 248, 220],
942   "crimson": [220, 20, 60],
943   "cyan": [0, 255, 255],
944   "darkblue": [0, 0, 139],
945   "darkcyan": [0, 139, 139],
946   "darkgoldenrod": [184, 134, 11],
947   "darkgray": [169, 169, 169],
948   "darkgreen": [0, 100, 0],
949   "darkgrey": [169, 169, 169],
950   "darkkhaki": [189, 183, 107],
951   "darkmagenta": [139, 0, 139],
952   "darkolivegreen": [85, 107, 47],
953   "darkorange": [255, 140, 0],
954   "darkorchid": [153, 50, 204],
955   "darkred": [139, 0, 0],
956   "darksalmon": [233, 150, 122],
957   "darkseagreen": [143, 188, 143],
958   "darkslateblue": [72, 61, 139],
959   "darkslategray": [47, 79, 79],
960   "darkslategrey": [47, 79, 79],
961   "darkturquoise": [0, 206, 209],
962   "darkviolet": [148, 0, 211],
963   "deeppink": [255, 20, 147],
964   "deepskyblue": [0, 191, 255],
965   "dimgray": [105, 105, 105],
966   "dimgrey": [105, 105, 105],
967   "dodgerblue": [30, 144, 255],
968   "firebrick": [178, 34, 34],
969   "floralwhite": [255, 250, 240],
970   "forestgreen": [34, 139, 34],
971   "fuchsia": [255, 0, 255],
972   "gainsboro": [220, 220, 220],
973   "ghostwhite": [248, 248, 255],
974   "gold": [255, 215, 0],
975   "goldenrod": [218, 165, 32],
976   "gray": [128, 128, 128],
977   "green": [0, 128, 0],
978   "greenyellow": [173, 255, 47],
979   "grey": [128, 128, 128],
980   "honeydew": [240, 255, 240],
981   "hotpink": [255, 105, 180],
982   "indianred": [205, 92, 92],
983   "indigo": [75, 0, 130],
984   "ivory": [255, 255, 240],
985   "khaki": [240, 230, 140],
986   "lavender": [230, 230, 250],
987   "lavenderblush": [255, 240, 245],
988   "lawngreen": [124, 252, 0],
989   "lemonchiffon": [255, 250, 205],
990   "lightblue": [173, 216, 230],
991   "lightcoral": [240, 128, 128],
992   "lightcyan": [224, 255, 255],
993   "lightgoldenrodyellow": [250, 250, 210],
994   "lightgray": [211, 211, 211],
995   "lightgreen": [144, 238, 144],
996   "lightgrey": [211, 211, 211],
997   "lightpink": [255, 182, 193],
998   "lightsalmon": [255, 160, 122],
999   "lightseagreen": [32, 178, 170],
1000   "lightskyblue": [135, 206, 250],
1001   "lightslategray": [119, 136, 153],
1002   "lightslategrey": [119, 136, 153],
1003   "lightsteelblue": [176, 196, 222],
1004   "lightyellow": [255, 255, 224],
1005   "lime": [0, 255, 0],
1006   "limegreen": [50, 205, 50],
1007   "linen": [250, 240, 230],
1008   "magenta": [255, 0, 255],
1009   "maroon": [128, 0, 0],
1010   "mediumaquamarine": [102, 205, 170],
1011   "mediumblue": [0, 0, 205],
1012   "mediumorchid": [186, 85, 211],
1013   "mediumpurple": [147, 112, 219],
1014   "mediumseagreen": [60, 179, 113],
1015   "mediumslateblue": [123, 104, 238],
1016   "mediumspringgreen": [0, 250, 154],
1017   "mediumturquoise": [72, 209, 204],
1018   "mediumvioletred": [199, 21, 133],
1019   "midnightblue": [25, 25, 112],
1020   "mintcream": [245, 255, 250],
1021   "mistyrose": [255, 228, 225],
1022   "moccasin": [255, 228, 181],
1023   "navajowhite": [255, 222, 173],
1024   "navy": [0, 0, 128],
1025   "oldlace": [253, 245, 230],
1026   "olive": [128, 128, 0],
1027   "olivedrab": [107, 142, 35],
1028   "orange": [255, 165, 0],
1029   "orangered": [255, 69, 0],
1030   "orchid": [218, 112, 214],
1031   "palegoldenrod": [238, 232, 170],
1032   "palegreen": [152, 251, 152],
1033   "paleturquoise": [175, 238, 238],
1034   "palevioletred": [219, 112, 147],
1035   "papayawhip": [255, 239, 213],
1036   "peachpuff": [255, 218, 185],
1037   "peru": [205, 133, 63],
1038   "pink": [255, 192, 203],
1039   "plum": [221, 160, 221],
1040   "powderblue": [176, 224, 230],
1041   "purple": [128, 0, 128],
1042   "rebeccapurple": [102, 51, 153],
1043   "red": [255, 0, 0],
1044   "rosybrown": [188, 143, 143],
1045   "royalblue": [65, 105, 225],
1046   "saddlebrown": [139, 69, 19],
1047   "salmon": [250, 128, 114],
1048   "sandybrown": [244, 164, 96],
1049   "seagreen": [46, 139, 87],
1050   "seashell": [255, 245, 238],
1051   "sienna": [160, 82, 45],
1052   "silver": [192, 192, 192],
1053   "skyblue": [135, 206, 235],
1054   "slateblue": [106, 90, 205],
1055   "slategray": [112, 128, 144],
1056   "slategrey": [112, 128, 144],
1057   "snow": [255, 250, 250],
1058   "springgreen": [0, 255, 127],
1059   "steelblue": [70, 130, 180],
1060   "tan": [210, 180, 140],
1061   "teal": [0, 128, 128],
1062   "thistle": [216, 191, 216],
1063   "tomato": [255, 99, 71],
1064   "turquoise": [64, 224, 208],
1065   "violet": [238, 130, 238],
1066   "wheat": [245, 222, 179],
1067   "white": [255, 255, 255],
1068   "whitesmoke": [245, 245, 245],
1069   "yellow": [255, 255, 0],
1070   "yellowgreen": [154, 205, 50]
1071 };
1072
1073 var conversions = createCommonjsModule(function (module) {
1074   /* MIT license */
1075   // NOTE: conversions should only return primitive values (i.e. arrays, or
1076   //       values that give correct `typeof` results).
1077   //       do not use box values types (i.e. Number(), String(), etc.)
1078   var reverseKeywords = {};
1079
1080   for (var key in colorName) {
1081     if (colorName.hasOwnProperty(key)) {
1082       reverseKeywords[colorName[key]] = key;
1083     }
1084   }
1085
1086   var convert = module.exports = {
1087     rgb: {
1088       channels: 3,
1089       labels: 'rgb'
1090     },
1091     hsl: {
1092       channels: 3,
1093       labels: 'hsl'
1094     },
1095     hsv: {
1096       channels: 3,
1097       labels: 'hsv'
1098     },
1099     hwb: {
1100       channels: 3,
1101       labels: 'hwb'
1102     },
1103     cmyk: {
1104       channels: 4,
1105       labels: 'cmyk'
1106     },
1107     xyz: {
1108       channels: 3,
1109       labels: 'xyz'
1110     },
1111     lab: {
1112       channels: 3,
1113       labels: 'lab'
1114     },
1115     lch: {
1116       channels: 3,
1117       labels: 'lch'
1118     },
1119     hex: {
1120       channels: 1,
1121       labels: ['hex']
1122     },
1123     keyword: {
1124       channels: 1,
1125       labels: ['keyword']
1126     },
1127     ansi16: {
1128       channels: 1,
1129       labels: ['ansi16']
1130     },
1131     ansi256: {
1132       channels: 1,
1133       labels: ['ansi256']
1134     },
1135     hcg: {
1136       channels: 3,
1137       labels: ['h', 'c', 'g']
1138     },
1139     apple: {
1140       channels: 3,
1141       labels: ['r16', 'g16', 'b16']
1142     },
1143     gray: {
1144       channels: 1,
1145       labels: ['gray']
1146     }
1147   }; // hide .channels and .labels properties
1148
1149   for (var model in convert) {
1150     if (convert.hasOwnProperty(model)) {
1151       if (!('channels' in convert[model])) {
1152         throw new Error('missing channels property: ' + model);
1153       }
1154
1155       if (!('labels' in convert[model])) {
1156         throw new Error('missing channel labels property: ' + model);
1157       }
1158
1159       if (convert[model].labels.length !== convert[model].channels) {
1160         throw new Error('channel and label counts mismatch: ' + model);
1161       }
1162
1163       var channels = convert[model].channels;
1164       var labels = convert[model].labels;
1165       delete convert[model].channels;
1166       delete convert[model].labels;
1167       Object.defineProperty(convert[model], 'channels', {
1168         value: channels
1169       });
1170       Object.defineProperty(convert[model], 'labels', {
1171         value: labels
1172       });
1173     }
1174   }
1175
1176   convert.rgb.hsl = function (rgb) {
1177     var r = rgb[0] / 255;
1178     var g = rgb[1] / 255;
1179     var b = rgb[2] / 255;
1180     var min = Math.min(r, g, b);
1181     var max = Math.max(r, g, b);
1182     var delta = max - min;
1183     var h;
1184     var s;
1185     var l;
1186
1187     if (max === min) {
1188       h = 0;
1189     } else if (r === max) {
1190       h = (g - b) / delta;
1191     } else if (g === max) {
1192       h = 2 + (b - r) / delta;
1193     } else if (b === max) {
1194       h = 4 + (r - g) / delta;
1195     }
1196
1197     h = Math.min(h * 60, 360);
1198
1199     if (h < 0) {
1200       h += 360;
1201     }
1202
1203     l = (min + max) / 2;
1204
1205     if (max === min) {
1206       s = 0;
1207     } else if (l <= 0.5) {
1208       s = delta / (max + min);
1209     } else {
1210       s = delta / (2 - max - min);
1211     }
1212
1213     return [h, s * 100, l * 100];
1214   };
1215
1216   convert.rgb.hsv = function (rgb) {
1217     var rdif;
1218     var gdif;
1219     var bdif;
1220     var h;
1221     var s;
1222     var r = rgb[0] / 255;
1223     var g = rgb[1] / 255;
1224     var b = rgb[2] / 255;
1225     var v = Math.max(r, g, b);
1226     var diff = v - Math.min(r, g, b);
1227
1228     var diffc = function (c) {
1229       return (v - c) / 6 / diff + 1 / 2;
1230     };
1231
1232     if (diff === 0) {
1233       h = s = 0;
1234     } else {
1235       s = diff / v;
1236       rdif = diffc(r);
1237       gdif = diffc(g);
1238       bdif = diffc(b);
1239
1240       if (r === v) {
1241         h = bdif - gdif;
1242       } else if (g === v) {
1243         h = 1 / 3 + rdif - bdif;
1244       } else if (b === v) {
1245         h = 2 / 3 + gdif - rdif;
1246       }
1247
1248       if (h < 0) {
1249         h += 1;
1250       } else if (h > 1) {
1251         h -= 1;
1252       }
1253     }
1254
1255     return [h * 360, s * 100, v * 100];
1256   };
1257
1258   convert.rgb.hwb = function (rgb) {
1259     var r = rgb[0];
1260     var g = rgb[1];
1261     var b = rgb[2];
1262     var h = convert.rgb.hsl(rgb)[0];
1263     var w = 1 / 255 * Math.min(r, Math.min(g, b));
1264     b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
1265     return [h, w * 100, b * 100];
1266   };
1267
1268   convert.rgb.cmyk = function (rgb) {
1269     var r = rgb[0] / 255;
1270     var g = rgb[1] / 255;
1271     var b = rgb[2] / 255;
1272     var c;
1273     var m;
1274     var y;
1275     var k;
1276     k = Math.min(1 - r, 1 - g, 1 - b);
1277     c = (1 - r - k) / (1 - k) || 0;
1278     m = (1 - g - k) / (1 - k) || 0;
1279     y = (1 - b - k) / (1 - k) || 0;
1280     return [c * 100, m * 100, y * 100, k * 100];
1281   };
1282   /**
1283    * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
1284    * */
1285
1286
1287   function comparativeDistance(x, y) {
1288     return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
1289   }
1290
1291   convert.rgb.keyword = function (rgb) {
1292     var reversed = reverseKeywords[rgb];
1293
1294     if (reversed) {
1295       return reversed;
1296     }
1297
1298     var currentClosestDistance = Infinity;
1299     var currentClosestKeyword;
1300
1301     for (var keyword in colorName) {
1302       if (colorName.hasOwnProperty(keyword)) {
1303         var value = colorName[keyword]; // Compute comparative distance
1304
1305         var distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest
1306
1307         if (distance < currentClosestDistance) {
1308           currentClosestDistance = distance;
1309           currentClosestKeyword = keyword;
1310         }
1311       }
1312     }
1313
1314     return currentClosestKeyword;
1315   };
1316
1317   convert.keyword.rgb = function (keyword) {
1318     return colorName[keyword];
1319   };
1320
1321   convert.rgb.xyz = function (rgb) {
1322     var r = rgb[0] / 255;
1323     var g = rgb[1] / 255;
1324     var b = rgb[2] / 255; // assume sRGB
1325
1326     r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
1327     g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
1328     b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
1329     var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
1330     var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
1331     var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
1332     return [x * 100, y * 100, z * 100];
1333   };
1334
1335   convert.rgb.lab = function (rgb) {
1336     var xyz = convert.rgb.xyz(rgb);
1337     var x = xyz[0];
1338     var y = xyz[1];
1339     var z = xyz[2];
1340     var l;
1341     var a;
1342     var b;
1343     x /= 95.047;
1344     y /= 100;
1345     z /= 108.883;
1346     x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
1347     y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
1348     z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
1349     l = 116 * y - 16;
1350     a = 500 * (x - y);
1351     b = 200 * (y - z);
1352     return [l, a, b];
1353   };
1354
1355   convert.hsl.rgb = function (hsl) {
1356     var h = hsl[0] / 360;
1357     var s = hsl[1] / 100;
1358     var l = hsl[2] / 100;
1359     var t1;
1360     var t2;
1361     var t3;
1362     var rgb;
1363     var val;
1364
1365     if (s === 0) {
1366       val = l * 255;
1367       return [val, val, val];
1368     }
1369
1370     if (l < 0.5) {
1371       t2 = l * (1 + s);
1372     } else {
1373       t2 = l + s - l * s;
1374     }
1375
1376     t1 = 2 * l - t2;
1377     rgb = [0, 0, 0];
1378
1379     for (var i = 0; i < 3; i++) {
1380       t3 = h + 1 / 3 * -(i - 1);
1381
1382       if (t3 < 0) {
1383         t3++;
1384       }
1385
1386       if (t3 > 1) {
1387         t3--;
1388       }
1389
1390       if (6 * t3 < 1) {
1391         val = t1 + (t2 - t1) * 6 * t3;
1392       } else if (2 * t3 < 1) {
1393         val = t2;
1394       } else if (3 * t3 < 2) {
1395         val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
1396       } else {
1397         val = t1;
1398       }
1399
1400       rgb[i] = val * 255;
1401     }
1402
1403     return rgb;
1404   };
1405
1406   convert.hsl.hsv = function (hsl) {
1407     var h = hsl[0];
1408     var s = hsl[1] / 100;
1409     var l = hsl[2] / 100;
1410     var smin = s;
1411     var lmin = Math.max(l, 0.01);
1412     var sv;
1413     var v;
1414     l *= 2;
1415     s *= l <= 1 ? l : 2 - l;
1416     smin *= lmin <= 1 ? lmin : 2 - lmin;
1417     v = (l + s) / 2;
1418     sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
1419     return [h, sv * 100, v * 100];
1420   };
1421
1422   convert.hsv.rgb = function (hsv) {
1423     var h = hsv[0] / 60;
1424     var s = hsv[1] / 100;
1425     var v = hsv[2] / 100;
1426     var hi = Math.floor(h) % 6;
1427     var f = h - Math.floor(h);
1428     var p = 255 * v * (1 - s);
1429     var q = 255 * v * (1 - s * f);
1430     var t = 255 * v * (1 - s * (1 - f));
1431     v *= 255;
1432
1433     switch (hi) {
1434       case 0:
1435         return [v, t, p];
1436
1437       case 1:
1438         return [q, v, p];
1439
1440       case 2:
1441         return [p, v, t];
1442
1443       case 3:
1444         return [p, q, v];
1445
1446       case 4:
1447         return [t, p, v];
1448
1449       case 5:
1450         return [v, p, q];
1451     }
1452   };
1453
1454   convert.hsv.hsl = function (hsv) {
1455     var h = hsv[0];
1456     var s = hsv[1] / 100;
1457     var v = hsv[2] / 100;
1458     var vmin = Math.max(v, 0.01);
1459     var lmin;
1460     var sl;
1461     var l;
1462     l = (2 - s) * v;
1463     lmin = (2 - s) * vmin;
1464     sl = s * vmin;
1465     sl /= lmin <= 1 ? lmin : 2 - lmin;
1466     sl = sl || 0;
1467     l /= 2;
1468     return [h, sl * 100, l * 100];
1469   }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
1470
1471
1472   convert.hwb.rgb = function (hwb) {
1473     var h = hwb[0] / 360;
1474     var wh = hwb[1] / 100;
1475     var bl = hwb[2] / 100;
1476     var ratio = wh + bl;
1477     var i;
1478     var v;
1479     var f;
1480     var n; // wh + bl cant be > 1
1481
1482     if (ratio > 1) {
1483       wh /= ratio;
1484       bl /= ratio;
1485     }
1486
1487     i = Math.floor(6 * h);
1488     v = 1 - bl;
1489     f = 6 * h - i;
1490
1491     if ((i & 0x01) !== 0) {
1492       f = 1 - f;
1493     }
1494
1495     n = wh + f * (v - wh); // linear interpolation
1496
1497     var r;
1498     var g;
1499     var b;
1500
1501     switch (i) {
1502       default:
1503       case 6:
1504       case 0:
1505         r = v;
1506         g = n;
1507         b = wh;
1508         break;
1509
1510       case 1:
1511         r = n;
1512         g = v;
1513         b = wh;
1514         break;
1515
1516       case 2:
1517         r = wh;
1518         g = v;
1519         b = n;
1520         break;
1521
1522       case 3:
1523         r = wh;
1524         g = n;
1525         b = v;
1526         break;
1527
1528       case 4:
1529         r = n;
1530         g = wh;
1531         b = v;
1532         break;
1533
1534       case 5:
1535         r = v;
1536         g = wh;
1537         b = n;
1538         break;
1539     }
1540
1541     return [r * 255, g * 255, b * 255];
1542   };
1543
1544   convert.cmyk.rgb = function (cmyk) {
1545     var c = cmyk[0] / 100;
1546     var m = cmyk[1] / 100;
1547     var y = cmyk[2] / 100;
1548     var k = cmyk[3] / 100;
1549     var r;
1550     var g;
1551     var b;
1552     r = 1 - Math.min(1, c * (1 - k) + k);
1553     g = 1 - Math.min(1, m * (1 - k) + k);
1554     b = 1 - Math.min(1, y * (1 - k) + k);
1555     return [r * 255, g * 255, b * 255];
1556   };
1557
1558   convert.xyz.rgb = function (xyz) {
1559     var x = xyz[0] / 100;
1560     var y = xyz[1] / 100;
1561     var z = xyz[2] / 100;
1562     var r;
1563     var g;
1564     var b;
1565     r = x * 3.2406 + y * -1.5372 + z * -0.4986;
1566     g = x * -0.9689 + y * 1.8758 + z * 0.0415;
1567     b = x * 0.0557 + y * -0.2040 + z * 1.0570; // assume sRGB
1568
1569     r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92;
1570     g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92;
1571     b = b > 0.0031308 ? 1.055 * Math.pow(b, 1.0 / 2.4) - 0.055 : b * 12.92;
1572     r = Math.min(Math.max(0, r), 1);
1573     g = Math.min(Math.max(0, g), 1);
1574     b = Math.min(Math.max(0, b), 1);
1575     return [r * 255, g * 255, b * 255];
1576   };
1577
1578   convert.xyz.lab = function (xyz) {
1579     var x = xyz[0];
1580     var y = xyz[1];
1581     var z = xyz[2];
1582     var l;
1583     var a;
1584     var b;
1585     x /= 95.047;
1586     y /= 100;
1587     z /= 108.883;
1588     x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
1589     y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
1590     z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
1591     l = 116 * y - 16;
1592     a = 500 * (x - y);
1593     b = 200 * (y - z);
1594     return [l, a, b];
1595   };
1596
1597   convert.lab.xyz = function (lab) {
1598     var l = lab[0];
1599     var a = lab[1];
1600     var b = lab[2];
1601     var x;
1602     var y;
1603     var z;
1604     y = (l + 16) / 116;
1605     x = a / 500 + y;
1606     z = y - b / 200;
1607     var y2 = Math.pow(y, 3);
1608     var x2 = Math.pow(x, 3);
1609     var z2 = Math.pow(z, 3);
1610     y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
1611     x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
1612     z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
1613     x *= 95.047;
1614     y *= 100;
1615     z *= 108.883;
1616     return [x, y, z];
1617   };
1618
1619   convert.lab.lch = function (lab) {
1620     var l = lab[0];
1621     var a = lab[1];
1622     var b = lab[2];
1623     var hr;
1624     var h;
1625     var c;
1626     hr = Math.atan2(b, a);
1627     h = hr * 360 / 2 / Math.PI;
1628
1629     if (h < 0) {
1630       h += 360;
1631     }
1632
1633     c = Math.sqrt(a * a + b * b);
1634     return [l, c, h];
1635   };
1636
1637   convert.lch.lab = function (lch) {
1638     var l = lch[0];
1639     var c = lch[1];
1640     var h = lch[2];
1641     var a;
1642     var b;
1643     var hr;
1644     hr = h / 360 * 2 * Math.PI;
1645     a = c * Math.cos(hr);
1646     b = c * Math.sin(hr);
1647     return [l, a, b];
1648   };
1649
1650   convert.rgb.ansi16 = function (args) {
1651     var r = args[0];
1652     var g = args[1];
1653     var b = args[2];
1654     var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
1655
1656     value = Math.round(value / 50);
1657
1658     if (value === 0) {
1659       return 30;
1660     }
1661
1662     var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
1663
1664     if (value === 2) {
1665       ansi += 60;
1666     }
1667
1668     return ansi;
1669   };
1670
1671   convert.hsv.ansi16 = function (args) {
1672     // optimization here; we already know the value and don't need to get
1673     // it converted for us.
1674     return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
1675   };
1676
1677   convert.rgb.ansi256 = function (args) {
1678     var r = args[0];
1679     var g = args[1];
1680     var b = args[2]; // we use the extended greyscale palette here, with the exception of
1681     // black and white. normal palette only has 4 greyscale shades.
1682
1683     if (r === g && g === b) {
1684       if (r < 8) {
1685         return 16;
1686       }
1687
1688       if (r > 248) {
1689         return 231;
1690       }
1691
1692       return Math.round((r - 8) / 247 * 24) + 232;
1693     }
1694
1695     var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
1696     return ansi;
1697   };
1698
1699   convert.ansi16.rgb = function (args) {
1700     var color = args % 10; // handle greyscale
1701
1702     if (color === 0 || color === 7) {
1703       if (args > 50) {
1704         color += 3.5;
1705       }
1706
1707       color = color / 10.5 * 255;
1708       return [color, color, color];
1709     }
1710
1711     var mult = (~~(args > 50) + 1) * 0.5;
1712     var r = (color & 1) * mult * 255;
1713     var g = (color >> 1 & 1) * mult * 255;
1714     var b = (color >> 2 & 1) * mult * 255;
1715     return [r, g, b];
1716   };
1717
1718   convert.ansi256.rgb = function (args) {
1719     // handle greyscale
1720     if (args >= 232) {
1721       var c = (args - 232) * 10 + 8;
1722       return [c, c, c];
1723     }
1724
1725     args -= 16;
1726     var rem;
1727     var r = Math.floor(args / 36) / 5 * 255;
1728     var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
1729     var b = rem % 6 / 5 * 255;
1730     return [r, g, b];
1731   };
1732
1733   convert.rgb.hex = function (args) {
1734     var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
1735     var string = integer.toString(16).toUpperCase();
1736     return '000000'.substring(string.length) + string;
1737   };
1738
1739   convert.hex.rgb = function (args) {
1740     var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
1741
1742     if (!match) {
1743       return [0, 0, 0];
1744     }
1745
1746     var colorString = match[0];
1747
1748     if (match[0].length === 3) {
1749       colorString = colorString.split('').map(function (char) {
1750         return char + char;
1751       }).join('');
1752     }
1753
1754     var integer = parseInt(colorString, 16);
1755     var r = integer >> 16 & 0xFF;
1756     var g = integer >> 8 & 0xFF;
1757     var b = integer & 0xFF;
1758     return [r, g, b];
1759   };
1760
1761   convert.rgb.hcg = function (rgb) {
1762     var r = rgb[0] / 255;
1763     var g = rgb[1] / 255;
1764     var b = rgb[2] / 255;
1765     var max = Math.max(Math.max(r, g), b);
1766     var min = Math.min(Math.min(r, g), b);
1767     var chroma = max - min;
1768     var grayscale;
1769     var hue;
1770
1771     if (chroma < 1) {
1772       grayscale = min / (1 - chroma);
1773     } else {
1774       grayscale = 0;
1775     }
1776
1777     if (chroma <= 0) {
1778       hue = 0;
1779     } else if (max === r) {
1780       hue = (g - b) / chroma % 6;
1781     } else if (max === g) {
1782       hue = 2 + (b - r) / chroma;
1783     } else {
1784       hue = 4 + (r - g) / chroma + 4;
1785     }
1786
1787     hue /= 6;
1788     hue %= 1;
1789     return [hue * 360, chroma * 100, grayscale * 100];
1790   };
1791
1792   convert.hsl.hcg = function (hsl) {
1793     var s = hsl[1] / 100;
1794     var l = hsl[2] / 100;
1795     var c = 1;
1796     var f = 0;
1797
1798     if (l < 0.5) {
1799       c = 2.0 * s * l;
1800     } else {
1801       c = 2.0 * s * (1.0 - l);
1802     }
1803
1804     if (c < 1.0) {
1805       f = (l - 0.5 * c) / (1.0 - c);
1806     }
1807
1808     return [hsl[0], c * 100, f * 100];
1809   };
1810
1811   convert.hsv.hcg = function (hsv) {
1812     var s = hsv[1] / 100;
1813     var v = hsv[2] / 100;
1814     var c = s * v;
1815     var f = 0;
1816
1817     if (c < 1.0) {
1818       f = (v - c) / (1 - c);
1819     }
1820
1821     return [hsv[0], c * 100, f * 100];
1822   };
1823
1824   convert.hcg.rgb = function (hcg) {
1825     var h = hcg[0] / 360;
1826     var c = hcg[1] / 100;
1827     var g = hcg[2] / 100;
1828
1829     if (c === 0.0) {
1830       return [g * 255, g * 255, g * 255];
1831     }
1832
1833     var pure = [0, 0, 0];
1834     var hi = h % 1 * 6;
1835     var v = hi % 1;
1836     var w = 1 - v;
1837     var mg = 0;
1838
1839     switch (Math.floor(hi)) {
1840       case 0:
1841         pure[0] = 1;
1842         pure[1] = v;
1843         pure[2] = 0;
1844         break;
1845
1846       case 1:
1847         pure[0] = w;
1848         pure[1] = 1;
1849         pure[2] = 0;
1850         break;
1851
1852       case 2:
1853         pure[0] = 0;
1854         pure[1] = 1;
1855         pure[2] = v;
1856         break;
1857
1858       case 3:
1859         pure[0] = 0;
1860         pure[1] = w;
1861         pure[2] = 1;
1862         break;
1863
1864       case 4:
1865         pure[0] = v;
1866         pure[1] = 0;
1867         pure[2] = 1;
1868         break;
1869
1870       default:
1871         pure[0] = 1;
1872         pure[1] = 0;
1873         pure[2] = w;
1874     }
1875
1876     mg = (1.0 - c) * g;
1877     return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
1878   };
1879
1880   convert.hcg.hsv = function (hcg) {
1881     var c = hcg[1] / 100;
1882     var g = hcg[2] / 100;
1883     var v = c + g * (1.0 - c);
1884     var f = 0;
1885
1886     if (v > 0.0) {
1887       f = c / v;
1888     }
1889
1890     return [hcg[0], f * 100, v * 100];
1891   };
1892
1893   convert.hcg.hsl = function (hcg) {
1894     var c = hcg[1] / 100;
1895     var g = hcg[2] / 100;
1896     var l = g * (1.0 - c) + 0.5 * c;
1897     var s = 0;
1898
1899     if (l > 0.0 && l < 0.5) {
1900       s = c / (2 * l);
1901     } else if (l >= 0.5 && l < 1.0) {
1902       s = c / (2 * (1 - l));
1903     }
1904
1905     return [hcg[0], s * 100, l * 100];
1906   };
1907
1908   convert.hcg.hwb = function (hcg) {
1909     var c = hcg[1] / 100;
1910     var g = hcg[2] / 100;
1911     var v = c + g * (1.0 - c);
1912     return [hcg[0], (v - c) * 100, (1 - v) * 100];
1913   };
1914
1915   convert.hwb.hcg = function (hwb) {
1916     var w = hwb[1] / 100;
1917     var b = hwb[2] / 100;
1918     var v = 1 - b;
1919     var c = v - w;
1920     var g = 0;
1921
1922     if (c < 1) {
1923       g = (v - c) / (1 - c);
1924     }
1925
1926     return [hwb[0], c * 100, g * 100];
1927   };
1928
1929   convert.apple.rgb = function (apple) {
1930     return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
1931   };
1932
1933   convert.rgb.apple = function (rgb) {
1934     return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
1935   };
1936
1937   convert.gray.rgb = function (args) {
1938     return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
1939   };
1940
1941   convert.gray.hsl = convert.gray.hsv = function (args) {
1942     return [0, 0, args[0]];
1943   };
1944
1945   convert.gray.hwb = function (gray) {
1946     return [0, 100, gray[0]];
1947   };
1948
1949   convert.gray.cmyk = function (gray) {
1950     return [0, 0, 0, gray[0]];
1951   };
1952
1953   convert.gray.lab = function (gray) {
1954     return [gray[0], 0, 0];
1955   };
1956
1957   convert.gray.hex = function (gray) {
1958     var val = Math.round(gray[0] / 100 * 255) & 0xFF;
1959     var integer = (val << 16) + (val << 8) + val;
1960     var string = integer.toString(16).toUpperCase();
1961     return '000000'.substring(string.length) + string;
1962   };
1963
1964   convert.rgb.gray = function (rgb) {
1965     var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
1966     return [val / 255 * 100];
1967   };
1968 });
1969 var conversions_1 = conversions.rgb;
1970 var conversions_2 = conversions.hsl;
1971 var conversions_3 = conversions.hsv;
1972 var conversions_4 = conversions.hwb;
1973 var conversions_5 = conversions.cmyk;
1974 var conversions_6 = conversions.xyz;
1975 var conversions_7 = conversions.lab;
1976 var conversions_8 = conversions.lch;
1977 var conversions_9 = conversions.hex;
1978 var conversions_10 = conversions.keyword;
1979 var conversions_11 = conversions.ansi16;
1980 var conversions_12 = conversions.ansi256;
1981 var conversions_13 = conversions.hcg;
1982 var conversions_14 = conversions.apple;
1983 var conversions_15 = conversions.gray;
1984
1985 /*
1986         this function routes a model to all other models.
1987
1988         all functions that are routed have a property `.conversion` attached
1989         to the returned synthetic function. This property is an array
1990         of strings, each with the steps in between the 'from' and 'to'
1991         color models (inclusive).
1992
1993         conversions that are not possible simply are not included.
1994 */
1995
1996 function buildGraph() {
1997   var graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
1998
1999   var models = Object.keys(conversions);
2000
2001   for (var len = models.length, i = 0; i < len; i++) {
2002     graph[models[i]] = {
2003       // http://jsperf.com/1-vs-infinity
2004       // micro-opt, but this is simple.
2005       distance: -1,
2006       parent: null
2007     };
2008   }
2009
2010   return graph;
2011 } // https://en.wikipedia.org/wiki/Breadth-first_search
2012
2013
2014 function deriveBFS(fromModel) {
2015   var graph = buildGraph();
2016   var queue = [fromModel]; // unshift -> queue -> pop
2017
2018   graph[fromModel].distance = 0;
2019
2020   while (queue.length) {
2021     var current = queue.pop();
2022     var adjacents = Object.keys(conversions[current]);
2023
2024     for (var len = adjacents.length, i = 0; i < len; i++) {
2025       var adjacent = adjacents[i];
2026       var node = graph[adjacent];
2027
2028       if (node.distance === -1) {
2029         node.distance = graph[current].distance + 1;
2030         node.parent = current;
2031         queue.unshift(adjacent);
2032       }
2033     }
2034   }
2035
2036   return graph;
2037 }
2038
2039 function link(from, to) {
2040   return function (args) {
2041     return to(from(args));
2042   };
2043 }
2044
2045 function wrapConversion(toModel, graph) {
2046   var path = [graph[toModel].parent, toModel];
2047   var fn = conversions[graph[toModel].parent][toModel];
2048   var cur = graph[toModel].parent;
2049
2050   while (graph[cur].parent) {
2051     path.unshift(graph[cur].parent);
2052     fn = link(conversions[graph[cur].parent][cur], fn);
2053     cur = graph[cur].parent;
2054   }
2055
2056   fn.conversion = path;
2057   return fn;
2058 }
2059
2060 var route = function (fromModel) {
2061   var graph = deriveBFS(fromModel);
2062   var conversion = {};
2063   var models = Object.keys(graph);
2064
2065   for (var len = models.length, i = 0; i < len; i++) {
2066     var toModel = models[i];
2067     var node = graph[toModel];
2068
2069     if (node.parent === null) {
2070       // no possible conversion, or this node is the source model.
2071       continue;
2072     }
2073
2074     conversion[toModel] = wrapConversion(toModel, graph);
2075   }
2076
2077   return conversion;
2078 };
2079
2080 var convert = {};
2081 var models = Object.keys(conversions);
2082
2083 function wrapRaw(fn) {
2084   var wrappedFn = function (args) {
2085     if (args === undefined || args === null) {
2086       return args;
2087     }
2088
2089     if (arguments.length > 1) {
2090       args = Array.prototype.slice.call(arguments);
2091     }
2092
2093     return fn(args);
2094   }; // preserve .conversion property if there is one
2095
2096
2097   if ('conversion' in fn) {
2098     wrappedFn.conversion = fn.conversion;
2099   }
2100
2101   return wrappedFn;
2102 }
2103
2104 function wrapRounded(fn) {
2105   var wrappedFn = function (args) {
2106     if (args === undefined || args === null) {
2107       return args;
2108     }
2109
2110     if (arguments.length > 1) {
2111       args = Array.prototype.slice.call(arguments);
2112     }
2113
2114     var result = fn(args); // we're assuming the result is an array here.
2115     // see notice in conversions.js; don't use box types
2116     // in conversion functions.
2117
2118     if (typeof result === 'object') {
2119       for (var len = result.length, i = 0; i < len; i++) {
2120         result[i] = Math.round(result[i]);
2121       }
2122     }
2123
2124     return result;
2125   }; // preserve .conversion property if there is one
2126
2127
2128   if ('conversion' in fn) {
2129     wrappedFn.conversion = fn.conversion;
2130   }
2131
2132   return wrappedFn;
2133 }
2134
2135 models.forEach(function (fromModel) {
2136   convert[fromModel] = {};
2137   Object.defineProperty(convert[fromModel], 'channels', {
2138     value: conversions[fromModel].channels
2139   });
2140   Object.defineProperty(convert[fromModel], 'labels', {
2141     value: conversions[fromModel].labels
2142   });
2143   var routes = route(fromModel);
2144   var routeModels = Object.keys(routes);
2145   routeModels.forEach(function (toModel) {
2146     var fn = routes[toModel];
2147     convert[fromModel][toModel] = wrapRounded(fn);
2148     convert[fromModel][toModel].raw = wrapRaw(fn);
2149   });
2150 });
2151 var colorConvert = convert;
2152
2153 var ansiStyles = createCommonjsModule(function (module) {
2154
2155   const wrapAnsi16 = (fn, offset) => function () {
2156     const code = fn.apply(colorConvert, arguments);
2157     return `\u001B[${code + offset}m`;
2158   };
2159
2160   const wrapAnsi256 = (fn, offset) => function () {
2161     const code = fn.apply(colorConvert, arguments);
2162     return `\u001B[${38 + offset};5;${code}m`;
2163   };
2164
2165   const wrapAnsi16m = (fn, offset) => function () {
2166     const rgb = fn.apply(colorConvert, arguments);
2167     return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
2168   };
2169
2170   function assembleStyles() {
2171     const codes = new Map();
2172     const styles = {
2173       modifier: {
2174         reset: [0, 0],
2175         // 21 isn't widely supported and 22 does the same thing
2176         bold: [1, 22],
2177         dim: [2, 22],
2178         italic: [3, 23],
2179         underline: [4, 24],
2180         inverse: [7, 27],
2181         hidden: [8, 28],
2182         strikethrough: [9, 29]
2183       },
2184       color: {
2185         black: [30, 39],
2186         red: [31, 39],
2187         green: [32, 39],
2188         yellow: [33, 39],
2189         blue: [34, 39],
2190         magenta: [35, 39],
2191         cyan: [36, 39],
2192         white: [37, 39],
2193         gray: [90, 39],
2194         // Bright color
2195         redBright: [91, 39],
2196         greenBright: [92, 39],
2197         yellowBright: [93, 39],
2198         blueBright: [94, 39],
2199         magentaBright: [95, 39],
2200         cyanBright: [96, 39],
2201         whiteBright: [97, 39]
2202       },
2203       bgColor: {
2204         bgBlack: [40, 49],
2205         bgRed: [41, 49],
2206         bgGreen: [42, 49],
2207         bgYellow: [43, 49],
2208         bgBlue: [44, 49],
2209         bgMagenta: [45, 49],
2210         bgCyan: [46, 49],
2211         bgWhite: [47, 49],
2212         // Bright color
2213         bgBlackBright: [100, 49],
2214         bgRedBright: [101, 49],
2215         bgGreenBright: [102, 49],
2216         bgYellowBright: [103, 49],
2217         bgBlueBright: [104, 49],
2218         bgMagentaBright: [105, 49],
2219         bgCyanBright: [106, 49],
2220         bgWhiteBright: [107, 49]
2221       }
2222     }; // Fix humans
2223
2224     styles.color.grey = styles.color.gray;
2225
2226     for (const groupName of Object.keys(styles)) {
2227       const group = styles[groupName];
2228
2229       for (const styleName of Object.keys(group)) {
2230         const style = group[styleName];
2231         styles[styleName] = {
2232           open: `\u001B[${style[0]}m`,
2233           close: `\u001B[${style[1]}m`
2234         };
2235         group[styleName] = styles[styleName];
2236         codes.set(style[0], style[1]);
2237       }
2238
2239       Object.defineProperty(styles, groupName, {
2240         value: group,
2241         enumerable: false
2242       });
2243       Object.defineProperty(styles, 'codes', {
2244         value: codes,
2245         enumerable: false
2246       });
2247     }
2248
2249     const ansi2ansi = n => n;
2250
2251     const rgb2rgb = (r, g, b) => [r, g, b];
2252
2253     styles.color.close = '\u001B[39m';
2254     styles.bgColor.close = '\u001B[49m';
2255     styles.color.ansi = {
2256       ansi: wrapAnsi16(ansi2ansi, 0)
2257     };
2258     styles.color.ansi256 = {
2259       ansi256: wrapAnsi256(ansi2ansi, 0)
2260     };
2261     styles.color.ansi16m = {
2262       rgb: wrapAnsi16m(rgb2rgb, 0)
2263     };
2264     styles.bgColor.ansi = {
2265       ansi: wrapAnsi16(ansi2ansi, 10)
2266     };
2267     styles.bgColor.ansi256 = {
2268       ansi256: wrapAnsi256(ansi2ansi, 10)
2269     };
2270     styles.bgColor.ansi16m = {
2271       rgb: wrapAnsi16m(rgb2rgb, 10)
2272     };
2273
2274     for (let key of Object.keys(colorConvert)) {
2275       if (typeof colorConvert[key] !== 'object') {
2276         continue;
2277       }
2278
2279       const suite = colorConvert[key];
2280
2281       if (key === 'ansi16') {
2282         key = 'ansi';
2283       }
2284
2285       if ('ansi16' in suite) {
2286         styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
2287         styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
2288       }
2289
2290       if ('ansi256' in suite) {
2291         styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
2292         styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
2293       }
2294
2295       if ('rgb' in suite) {
2296         styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
2297         styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
2298       }
2299     }
2300
2301     return styles;
2302   } // Make the export immutable
2303
2304
2305   Object.defineProperty(module, 'exports', {
2306     enumerable: true,
2307     get: assembleStyles
2308   });
2309 });
2310
2311 var hasFlag = (flag, argv) => {
2312   argv = argv || process.argv;
2313   const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
2314   const pos = argv.indexOf(prefix + flag);
2315   const terminatorPos = argv.indexOf('--');
2316   return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
2317 };
2318
2319 const env = process.env;
2320 let forceColor;
2321
2322 if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
2323   forceColor = false;
2324 } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
2325   forceColor = true;
2326 }
2327
2328 if ('FORCE_COLOR' in env) {
2329   forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
2330 }
2331
2332 function translateLevel(level) {
2333   if (level === 0) {
2334     return false;
2335   }
2336
2337   return {
2338     level,
2339     hasBasic: true,
2340     has256: level >= 2,
2341     has16m: level >= 3
2342   };
2343 }
2344
2345 function supportsColor(stream) {
2346   if (forceColor === false) {
2347     return 0;
2348   }
2349
2350   if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
2351     return 3;
2352   }
2353
2354   if (hasFlag('color=256')) {
2355     return 2;
2356   }
2357
2358   if (stream && !stream.isTTY && forceColor !== true) {
2359     return 0;
2360   }
2361
2362   const min = forceColor ? 1 : 0;
2363
2364   if (process.platform === 'win32') {
2365     // Node.js 7.5.0 is the first version of Node.js to include a patch to
2366     // libuv that enables 256 color output on Windows. Anything earlier and it
2367     // won't work. However, here we target Node.js 8 at minimum as it is an LTS
2368     // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
2369     // release that supports 256 colors. Windows 10 build 14931 is the first release
2370     // that supports 16m/TrueColor.
2371     const osRelease = os.release().split('.');
2372
2373     if (Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
2374       return Number(osRelease[2]) >= 14931 ? 3 : 2;
2375     }
2376
2377     return 1;
2378   }
2379
2380   if ('CI' in env) {
2381     if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
2382       return 1;
2383     }
2384
2385     return min;
2386   }
2387
2388   if ('TEAMCITY_VERSION' in env) {
2389     return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
2390   }
2391
2392   if (env.COLORTERM === 'truecolor') {
2393     return 3;
2394   }
2395
2396   if ('TERM_PROGRAM' in env) {
2397     const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
2398
2399     switch (env.TERM_PROGRAM) {
2400       case 'iTerm.app':
2401         return version >= 3 ? 3 : 2;
2402
2403       case 'Apple_Terminal':
2404         return 2;
2405       // No default
2406     }
2407   }
2408
2409   if (/-256(color)?$/i.test(env.TERM)) {
2410     return 2;
2411   }
2412
2413   if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
2414     return 1;
2415   }
2416
2417   if ('COLORTERM' in env) {
2418     return 1;
2419   }
2420
2421   if (env.TERM === 'dumb') {
2422     return min;
2423   }
2424
2425   return min;
2426 }
2427
2428 function getSupportLevel(stream) {
2429   const level = supportsColor(stream);
2430   return translateLevel(level);
2431 }
2432
2433 var supportsColor_1 = {
2434   supportsColor: getSupportLevel,
2435   stdout: getSupportLevel(process.stdout),
2436   stderr: getSupportLevel(process.stderr)
2437 };
2438
2439 const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
2440 const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
2441 const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
2442 const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
2443 const ESCAPES = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]);
2444
2445 function unescape(c) {
2446   if (c[0] === 'u' && c.length === 5 || c[0] === 'x' && c.length === 3) {
2447     return String.fromCharCode(parseInt(c.slice(1), 16));
2448   }
2449
2450   return ESCAPES.get(c) || c;
2451 }
2452
2453 function parseArguments(name, args) {
2454   const results = [];
2455   const chunks = args.trim().split(/\s*,\s*/g);
2456   let matches;
2457
2458   for (const chunk of chunks) {
2459     if (!isNaN(chunk)) {
2460       results.push(Number(chunk));
2461     } else if (matches = chunk.match(STRING_REGEX)) {
2462       results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
2463     } else {
2464       throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
2465     }
2466   }
2467
2468   return results;
2469 }
2470
2471 function parseStyle(style) {
2472   STYLE_REGEX.lastIndex = 0;
2473   const results = [];
2474   let matches;
2475
2476   while ((matches = STYLE_REGEX.exec(style)) !== null) {
2477     const name = matches[1];
2478
2479     if (matches[2]) {
2480       const args = parseArguments(name, matches[2]);
2481       results.push([name].concat(args));
2482     } else {
2483       results.push([name]);
2484     }
2485   }
2486
2487   return results;
2488 }
2489
2490 function buildStyle(chalk, styles) {
2491   const enabled = {};
2492
2493   for (const layer of styles) {
2494     for (const style of layer.styles) {
2495       enabled[style[0]] = layer.inverse ? null : style.slice(1);
2496     }
2497   }
2498
2499   let current = chalk;
2500
2501   for (const styleName of Object.keys(enabled)) {
2502     if (Array.isArray(enabled[styleName])) {
2503       if (!(styleName in current)) {
2504         throw new Error(`Unknown Chalk style: ${styleName}`);
2505       }
2506
2507       if (enabled[styleName].length > 0) {
2508         current = current[styleName].apply(current, enabled[styleName]);
2509       } else {
2510         current = current[styleName];
2511       }
2512     }
2513   }
2514
2515   return current;
2516 }
2517
2518 var templates = (chalk, tmp) => {
2519   const styles = [];
2520   const chunks = [];
2521   let chunk = []; // eslint-disable-next-line max-params
2522
2523   tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
2524     if (escapeChar) {
2525       chunk.push(unescape(escapeChar));
2526     } else if (style) {
2527       const str = chunk.join('');
2528       chunk = [];
2529       chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
2530       styles.push({
2531         inverse,
2532         styles: parseStyle(style)
2533       });
2534     } else if (close) {
2535       if (styles.length === 0) {
2536         throw new Error('Found extraneous } in Chalk template literal');
2537       }
2538
2539       chunks.push(buildStyle(chalk, styles)(chunk.join('')));
2540       chunk = [];
2541       styles.pop();
2542     } else {
2543       chunk.push(chr);
2544     }
2545   });
2546   chunks.push(chunk.join(''));
2547
2548   if (styles.length > 0) {
2549     const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
2550     throw new Error(errMsg);
2551   }
2552
2553   return chunks.join('');
2554 };
2555
2556 var chalk = createCommonjsModule(function (module) {
2557
2558   const stdoutColor = supportsColor_1.stdout;
2559   const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); // `supportsColor.level` â†’ `ansiStyles.color[name]` mapping
2560
2561   const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; // `color-convert` models to exclude from the Chalk API due to conflicts and such
2562
2563   const skipModels = new Set(['gray']);
2564   const styles = Object.create(null);
2565
2566   function applyOptions(obj, options) {
2567     options = options || {}; // Detect level if not set manually
2568
2569     const scLevel = stdoutColor ? stdoutColor.level : 0;
2570     obj.level = options.level === undefined ? scLevel : options.level;
2571     obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
2572   }
2573
2574   function Chalk(options) {
2575     // We check for this.template here since calling `chalk.constructor()`
2576     // by itself will have a `this` of a previously constructed chalk object
2577     if (!this || !(this instanceof Chalk) || this.template) {
2578       const chalk = {};
2579       applyOptions(chalk, options);
2580
2581       chalk.template = function () {
2582         const args = [].slice.call(arguments);
2583         return chalkTag.apply(null, [chalk.template].concat(args));
2584       };
2585
2586       Object.setPrototypeOf(chalk, Chalk.prototype);
2587       Object.setPrototypeOf(chalk.template, chalk);
2588       chalk.template.constructor = Chalk;
2589       return chalk.template;
2590     }
2591
2592     applyOptions(this, options);
2593   } // Use bright blue on Windows as the normal blue color is illegible
2594
2595
2596   if (isSimpleWindowsTerm) {
2597     ansiStyles.blue.open = '\u001B[94m';
2598   }
2599
2600   for (const key of Object.keys(ansiStyles)) {
2601     ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
2602     styles[key] = {
2603       get() {
2604         const codes = ansiStyles[key];
2605         return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
2606       }
2607
2608     };
2609   }
2610
2611   styles.visible = {
2612     get() {
2613       return build.call(this, this._styles || [], true, 'visible');
2614     }
2615
2616   };
2617   ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
2618
2619   for (const model of Object.keys(ansiStyles.color.ansi)) {
2620     if (skipModels.has(model)) {
2621       continue;
2622     }
2623
2624     styles[model] = {
2625       get() {
2626         const level = this.level;
2627         return function () {
2628           const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
2629           const codes = {
2630             open,
2631             close: ansiStyles.color.close,
2632             closeRe: ansiStyles.color.closeRe
2633           };
2634           return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
2635         };
2636       }
2637
2638     };
2639   }
2640
2641   ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
2642
2643   for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
2644     if (skipModels.has(model)) {
2645       continue;
2646     }
2647
2648     const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
2649     styles[bgModel] = {
2650       get() {
2651         const level = this.level;
2652         return function () {
2653           const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
2654           const codes = {
2655             open,
2656             close: ansiStyles.bgColor.close,
2657             closeRe: ansiStyles.bgColor.closeRe
2658           };
2659           return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
2660         };
2661       }
2662
2663     };
2664   }
2665
2666   const proto = Object.defineProperties(() => {}, styles);
2667
2668   function build(_styles, _empty, key) {
2669     const builder = function () {
2670       return applyStyle.apply(builder, arguments);
2671     };
2672
2673     builder._styles = _styles;
2674     builder._empty = _empty;
2675     const self = this;
2676     Object.defineProperty(builder, 'level', {
2677       enumerable: true,
2678
2679       get() {
2680         return self.level;
2681       },
2682
2683       set(level) {
2684         self.level = level;
2685       }
2686
2687     });
2688     Object.defineProperty(builder, 'enabled', {
2689       enumerable: true,
2690
2691       get() {
2692         return self.enabled;
2693       },
2694
2695       set(enabled) {
2696         self.enabled = enabled;
2697       }
2698
2699     }); // See below for fix regarding invisible grey/dim combination on Windows
2700
2701     builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; // `__proto__` is used because we must return a function, but there is
2702     // no way to create a function with a different prototype
2703
2704     builder.__proto__ = proto; // eslint-disable-line no-proto
2705
2706     return builder;
2707   }
2708
2709   function applyStyle() {
2710     // Support varags, but simply cast to string in case there's only one arg
2711     const args = arguments;
2712     const argsLen = args.length;
2713     let str = String(arguments[0]);
2714
2715     if (argsLen === 0) {
2716       return '';
2717     }
2718
2719     if (argsLen > 1) {
2720       // Don't slice `arguments`, it prevents V8 optimizations
2721       for (let a = 1; a < argsLen; a++) {
2722         str += ' ' + args[a];
2723       }
2724     }
2725
2726     if (!this.enabled || this.level <= 0 || !str) {
2727       return this._empty ? '' : str;
2728     } // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
2729     // see https://github.com/chalk/chalk/issues/58
2730     // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
2731
2732
2733     const originalDim = ansiStyles.dim.open;
2734
2735     if (isSimpleWindowsTerm && this.hasGrey) {
2736       ansiStyles.dim.open = '';
2737     }
2738
2739     for (const code of this._styles.slice().reverse()) {
2740       // Replace any instances already present with a re-opening code
2741       // otherwise only the part of the string until said closing code
2742       // will be colored, and the rest will simply be 'plain'.
2743       str = code.open + str.replace(code.closeRe, code.open) + code.close; // Close the styling before a linebreak and reopen
2744       // after next line to fix a bleed issue on macOS
2745       // https://github.com/chalk/chalk/pull/92
2746
2747       str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
2748     } // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
2749
2750
2751     ansiStyles.dim.open = originalDim;
2752     return str;
2753   }
2754
2755   function chalkTag(chalk, strings) {
2756     if (!Array.isArray(strings)) {
2757       // If chalk() was called by itself or with a string,
2758       // return the string itself as a string.
2759       return [].slice.call(arguments, 1).join(' ');
2760     }
2761
2762     const args = [].slice.call(arguments, 2);
2763     const parts = [strings.raw[0]];
2764
2765     for (let i = 1; i < strings.length; i++) {
2766       parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
2767       parts.push(String(strings.raw[i]));
2768     }
2769
2770     return templates(chalk, parts.join(''));
2771   }
2772
2773   Object.defineProperties(Chalk.prototype, styles);
2774   module.exports = Chalk(); // eslint-disable-line new-cap
2775
2776   module.exports.supportsColor = stdoutColor;
2777   module.exports.default = module.exports; // For TypeScript
2778 });
2779 var chalk_1 = chalk.supportsColor;
2780
2781 var lib = createCommonjsModule(function (module, exports) {
2782
2783   Object.defineProperty(exports, "__esModule", {
2784     value: true
2785   });
2786   exports.shouldHighlight = shouldHighlight;
2787   exports.getChalk = getChalk;
2788   exports.default = highlight;
2789
2790   var _jsTokens = _interopRequireWildcard(jsTokens);
2791
2792   var _esutils = _interopRequireDefault(utils);
2793
2794   var _chalk = _interopRequireDefault(chalk);
2795
2796   function _interopRequireDefault(obj) {
2797     return obj && obj.__esModule ? obj : {
2798       default: obj
2799     };
2800   }
2801
2802   function _getRequireWildcardCache() {
2803     if (typeof WeakMap !== "function") return null;
2804     var cache = new WeakMap();
2805
2806     _getRequireWildcardCache = function () {
2807       return cache;
2808     };
2809
2810     return cache;
2811   }
2812
2813   function _interopRequireWildcard(obj) {
2814     if (obj && obj.__esModule) {
2815       return obj;
2816     }
2817
2818     if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
2819       return {
2820         default: obj
2821       };
2822     }
2823
2824     var cache = _getRequireWildcardCache();
2825
2826     if (cache && cache.has(obj)) {
2827       return cache.get(obj);
2828     }
2829
2830     var newObj = {};
2831     var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
2832
2833     for (var key in obj) {
2834       if (Object.prototype.hasOwnProperty.call(obj, key)) {
2835         var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
2836
2837         if (desc && (desc.get || desc.set)) {
2838           Object.defineProperty(newObj, key, desc);
2839         } else {
2840           newObj[key] = obj[key];
2841         }
2842       }
2843     }
2844
2845     newObj.default = obj;
2846
2847     if (cache) {
2848       cache.set(obj, newObj);
2849     }
2850
2851     return newObj;
2852   }
2853
2854   function getDefs(chalk) {
2855     return {
2856       keyword: chalk.cyan,
2857       capitalized: chalk.yellow,
2858       jsx_tag: chalk.yellow,
2859       punctuator: chalk.yellow,
2860       number: chalk.magenta,
2861       string: chalk.green,
2862       regex: chalk.magenta,
2863       comment: chalk.grey,
2864       invalid: chalk.white.bgRed.bold
2865     };
2866   }
2867
2868   const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
2869   const JSX_TAG = /^[a-z][\w-]*$/i;
2870   const BRACKET = /^[()[\]{}]$/;
2871
2872   function getTokenType(match) {
2873     const [offset, text] = match.slice(-2);
2874     const token = (0, _jsTokens.matchToToken)(match);
2875
2876     if (token.type === "name") {
2877       if (_esutils.default.keyword.isReservedWordES6(token.value)) {
2878         return "keyword";
2879       }
2880
2881       if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
2882         return "jsx_tag";
2883       }
2884
2885       if (token.value[0] !== token.value[0].toLowerCase()) {
2886         return "capitalized";
2887       }
2888     }
2889
2890     if (token.type === "punctuator" && BRACKET.test(token.value)) {
2891       return "bracket";
2892     }
2893
2894     if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
2895       return "punctuator";
2896     }
2897
2898     return token.type;
2899   }
2900
2901   function highlightTokens(defs, text) {
2902     return text.replace(_jsTokens.default, function (...args) {
2903       const type = getTokenType(args);
2904       const colorize = defs[type];
2905
2906       if (colorize) {
2907         return args[0].split(NEWLINE).map(str => colorize(str)).join("\n");
2908       } else {
2909         return args[0];
2910       }
2911     });
2912   }
2913
2914   function shouldHighlight(options) {
2915     return _chalk.default.supportsColor || options.forceColor;
2916   }
2917
2918   function getChalk(options) {
2919     let chalk = _chalk.default;
2920
2921     if (options.forceColor) {
2922       chalk = new _chalk.default.constructor({
2923         enabled: true,
2924         level: 1
2925       });
2926     }
2927
2928     return chalk;
2929   }
2930
2931   function highlight(code, options = {}) {
2932     if (shouldHighlight(options)) {
2933       const chalk = getChalk(options);
2934       const defs = getDefs(chalk);
2935       return highlightTokens(defs, code);
2936     } else {
2937       return code;
2938     }
2939   }
2940 });
2941 unwrapExports(lib);
2942 var lib_1 = lib.shouldHighlight;
2943 var lib_2 = lib.getChalk;
2944
2945 var lib$1 = createCommonjsModule(function (module, exports) {
2946
2947   Object.defineProperty(exports, "__esModule", {
2948     value: true
2949   });
2950   exports.codeFrameColumns = codeFrameColumns;
2951   exports.default = _default;
2952
2953   var _highlight = _interopRequireWildcard(lib);
2954
2955   function _getRequireWildcardCache() {
2956     if (typeof WeakMap !== "function") return null;
2957     var cache = new WeakMap();
2958
2959     _getRequireWildcardCache = function () {
2960       return cache;
2961     };
2962
2963     return cache;
2964   }
2965
2966   function _interopRequireWildcard(obj) {
2967     if (obj && obj.__esModule) {
2968       return obj;
2969     }
2970
2971     if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
2972       return {
2973         default: obj
2974       };
2975     }
2976
2977     var cache = _getRequireWildcardCache();
2978
2979     if (cache && cache.has(obj)) {
2980       return cache.get(obj);
2981     }
2982
2983     var newObj = {};
2984     var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
2985
2986     for (var key in obj) {
2987       if (Object.prototype.hasOwnProperty.call(obj, key)) {
2988         var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
2989
2990         if (desc && (desc.get || desc.set)) {
2991           Object.defineProperty(newObj, key, desc);
2992         } else {
2993           newObj[key] = obj[key];
2994         }
2995       }
2996     }
2997
2998     newObj.default = obj;
2999
3000     if (cache) {
3001       cache.set(obj, newObj);
3002     }
3003
3004     return newObj;
3005   }
3006
3007   let deprecationWarningShown = false;
3008
3009   function getDefs(chalk) {
3010     return {
3011       gutter: chalk.grey,
3012       marker: chalk.red.bold,
3013       message: chalk.red.bold
3014     };
3015   }
3016
3017   const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
3018
3019   function getMarkerLines(loc, source, opts) {
3020     const startLoc = Object.assign({
3021       column: 0,
3022       line: -1
3023     }, loc.start);
3024     const endLoc = Object.assign({}, startLoc, {}, loc.end);
3025     const {
3026       linesAbove = 2,
3027       linesBelow = 3
3028     } = opts || {};
3029     const startLine = startLoc.line;
3030     const startColumn = startLoc.column;
3031     const endLine = endLoc.line;
3032     const endColumn = endLoc.column;
3033     let start = Math.max(startLine - (linesAbove + 1), 0);
3034     let end = Math.min(source.length, endLine + linesBelow);
3035
3036     if (startLine === -1) {
3037       start = 0;
3038     }
3039
3040     if (endLine === -1) {
3041       end = source.length;
3042     }
3043
3044     const lineDiff = endLine - startLine;
3045     const markerLines = {};
3046
3047     if (lineDiff) {
3048       for (let i = 0; i <= lineDiff; i++) {
3049         const lineNumber = i + startLine;
3050
3051         if (!startColumn) {
3052           markerLines[lineNumber] = true;
3053         } else if (i === 0) {
3054           const sourceLength = source[lineNumber - 1].length;
3055           markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
3056         } else if (i === lineDiff) {
3057           markerLines[lineNumber] = [0, endColumn];
3058         } else {
3059           const sourceLength = source[lineNumber - i].length;
3060           markerLines[lineNumber] = [0, sourceLength];
3061         }
3062       }
3063     } else {
3064       if (startColumn === endColumn) {
3065         if (startColumn) {
3066           markerLines[startLine] = [startColumn, 0];
3067         } else {
3068           markerLines[startLine] = true;
3069         }
3070       } else {
3071         markerLines[startLine] = [startColumn, endColumn - startColumn];
3072       }
3073     }
3074
3075     return {
3076       start,
3077       end,
3078       markerLines
3079     };
3080   }
3081
3082   function codeFrameColumns(rawLines, loc, opts = {}) {
3083     const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
3084     const chalk = (0, _highlight.getChalk)(opts);
3085     const defs = getDefs(chalk);
3086
3087     const maybeHighlight = (chalkFn, string) => {
3088       return highlighted ? chalkFn(string) : string;
3089     };
3090
3091     const lines = rawLines.split(NEWLINE);
3092     const {
3093       start,
3094       end,
3095       markerLines
3096     } = getMarkerLines(loc, lines, opts);
3097     const hasColumns = loc.start && typeof loc.start.column === "number";
3098     const numberMaxWidth = String(end).length;
3099     const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
3100     let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
3101       const number = start + 1 + index;
3102       const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
3103       const gutter = ` ${paddedNumber} | `;
3104       const hasMarker = markerLines[number];
3105       const lastMarkerLine = !markerLines[number + 1];
3106
3107       if (hasMarker) {
3108         let markerLine = "";
3109
3110         if (Array.isArray(hasMarker)) {
3111           const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
3112           const numberOfMarkers = hasMarker[1] || 1;
3113           markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
3114
3115           if (lastMarkerLine && opts.message) {
3116             markerLine += " " + maybeHighlight(defs.message, opts.message);
3117           }
3118         }
3119
3120         return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
3121       } else {
3122         return ` ${maybeHighlight(defs.gutter, gutter)}${line}`;
3123       }
3124     }).join("\n");
3125
3126     if (opts.message && !hasColumns) {
3127       frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
3128     }
3129
3130     if (highlighted) {
3131       return chalk.reset(frame);
3132     } else {
3133       return frame;
3134     }
3135   }
3136
3137   function _default(rawLines, lineNumber, colNumber, opts = {}) {
3138     if (!deprecationWarningShown) {
3139       deprecationWarningShown = true;
3140       const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
3141
3142       if (process.emitWarning) {
3143         process.emitWarning(message, "DeprecationWarning");
3144       } else {
3145         const deprecationError = new Error(message);
3146         deprecationError.name = "DeprecationWarning";
3147         console.warn(new Error(message));
3148       }
3149     }
3150
3151     colNumber = Math.max(colNumber, 0);
3152     const location = {
3153       start: {
3154         column: colNumber,
3155         line: lineNumber
3156       }
3157     };
3158     return codeFrameColumns(rawLines, location, opts);
3159   }
3160 });
3161 unwrapExports(lib$1);
3162 var lib_1$1 = lib$1.codeFrameColumns;
3163
3164 var require$$0 = getCjsExportFromNamespace(dist);
3165
3166 const {
3167   default: LinesAndColumns$1
3168 } = require$$0;
3169 const {
3170   codeFrameColumns
3171 } = lib$1;
3172 const JSONError = errorEx_1('JSONError', {
3173   fileName: errorEx_1.append('in %s'),
3174   codeFrame: errorEx_1.append('\n\n%s\n')
3175 });
3176
3177 var parseJson$1 = (string, reviver, filename) => {
3178   if (typeof reviver === 'string') {
3179     filename = reviver;
3180     reviver = null;
3181   }
3182
3183   try {
3184     try {
3185       return JSON.parse(string, reviver);
3186     } catch (error) {
3187       jsonParseBetterErrors(string, reviver);
3188       throw error;
3189     }
3190   } catch (error) {
3191     error.message = error.message.replace(/\n/g, '');
3192     const indexMatch = error.message.match(/in JSON at position (\d+) while parsing near/);
3193     const jsonError = new JSONError(error);
3194
3195     if (filename) {
3196       jsonError.fileName = filename;
3197     }
3198
3199     if (indexMatch && indexMatch.length > 0) {
3200       const lines = new LinesAndColumns$1(string);
3201       const index = Number(indexMatch[1]);
3202       const location = lines.locationForIndex(index);
3203       const codeFrame = codeFrameColumns(string, {
3204         start: {
3205           line: location.line + 1,
3206           column: location.column + 1
3207         }
3208       }, {
3209         highlightCode: true
3210       });
3211       jsonError.codeFrame = codeFrame;
3212     }
3213
3214     throw jsonError;
3215   }
3216 };
3217
3218 var constants = createCommonjsModule(function (module, exports) {
3219
3220   Object.defineProperty(exports, "__esModule", {
3221     value: true
3222   });
3223   exports.Type = exports.Char = void 0;
3224   const Char = {
3225     ANCHOR: '&',
3226     COMMENT: '#',
3227     TAG: '!',
3228     DIRECTIVES_END: '-',
3229     DOCUMENT_END: '.'
3230   };
3231   exports.Char = Char;
3232   const Type = {
3233     ALIAS: 'ALIAS',
3234     BLANK_LINE: 'BLANK_LINE',
3235     BLOCK_FOLDED: 'BLOCK_FOLDED',
3236     BLOCK_LITERAL: 'BLOCK_LITERAL',
3237     COMMENT: 'COMMENT',
3238     DIRECTIVE: 'DIRECTIVE',
3239     DOCUMENT: 'DOCUMENT',
3240     FLOW_MAP: 'FLOW_MAP',
3241     FLOW_SEQ: 'FLOW_SEQ',
3242     MAP: 'MAP',
3243     MAP_KEY: 'MAP_KEY',
3244     MAP_VALUE: 'MAP_VALUE',
3245     PLAIN: 'PLAIN',
3246     QUOTE_DOUBLE: 'QUOTE_DOUBLE',
3247     QUOTE_SINGLE: 'QUOTE_SINGLE',
3248     SEQ: 'SEQ',
3249     SEQ_ITEM: 'SEQ_ITEM'
3250   };
3251   exports.Type = Type;
3252 });
3253 unwrapExports(constants);
3254 var constants_1 = constants.Type;
3255 var constants_2 = constants.Char;
3256
3257 var sourceUtils = createCommonjsModule(function (module, exports) {
3258
3259   Object.defineProperty(exports, "__esModule", {
3260     value: true
3261   });
3262   exports.getLinePos = getLinePos;
3263   exports.getLine = getLine;
3264   exports.getPrettyContext = getPrettyContext;
3265
3266   function findLineStarts(src) {
3267     const ls = [0];
3268     let offset = src.indexOf('\n');
3269
3270     while (offset !== -1) {
3271       offset += 1;
3272       ls.push(offset);
3273       offset = src.indexOf('\n', offset);
3274     }
3275
3276     return ls;
3277   }
3278
3279   function getSrcInfo(cst) {
3280     let lineStarts, src;
3281
3282     if (typeof cst === 'string') {
3283       lineStarts = findLineStarts(cst);
3284       src = cst;
3285     } else {
3286       if (Array.isArray(cst)) cst = cst[0];
3287
3288       if (cst && cst.context) {
3289         if (!cst.lineStarts) cst.lineStarts = findLineStarts(cst.context.src);
3290         lineStarts = cst.lineStarts;
3291         src = cst.context.src;
3292       }
3293     }
3294
3295     return {
3296       lineStarts,
3297       src
3298     };
3299   }
3300   /**
3301    * @typedef {Object} LinePos - One-indexed position in the source
3302    * @property {number} line
3303    * @property {number} col
3304    */
3305
3306   /**
3307    * Determine the line/col position matching a character offset.
3308    *
3309    * Accepts a source string or a CST document as the second parameter. With
3310    * the latter, starting indices for lines are cached in the document as
3311    * `lineStarts: number[]`.
3312    *
3313    * Returns a one-indexed `{ line, col }` location if found, or
3314    * `undefined` otherwise.
3315    *
3316    * @param {number} offset
3317    * @param {string|Document|Document[]} cst
3318    * @returns {?LinePos}
3319    */
3320
3321
3322   function getLinePos(offset, cst) {
3323     if (typeof offset !== 'number' || offset < 0) return null;
3324     const {
3325       lineStarts,
3326       src
3327     } = getSrcInfo(cst);
3328     if (!lineStarts || !src || offset > src.length) return null;
3329
3330     for (let i = 0; i < lineStarts.length; ++i) {
3331       const start = lineStarts[i];
3332
3333       if (offset < start) {
3334         return {
3335           line: i,
3336           col: offset - lineStarts[i - 1] + 1
3337         };
3338       }
3339
3340       if (offset === start) return {
3341         line: i + 1,
3342         col: 1
3343       };
3344     }
3345
3346     const line = lineStarts.length;
3347     return {
3348       line,
3349       col: offset - lineStarts[line - 1] + 1
3350     };
3351   }
3352   /**
3353    * Get a specified line from the source.
3354    *
3355    * Accepts a source string or a CST document as the second parameter. With
3356    * the latter, starting indices for lines are cached in the document as
3357    * `lineStarts: number[]`.
3358    *
3359    * Returns the line as a string if found, or `null` otherwise.
3360    *
3361    * @param {number} line One-indexed line number
3362    * @param {string|Document|Document[]} cst
3363    * @returns {?string}
3364    */
3365
3366
3367   function getLine(line, cst) {
3368     const {
3369       lineStarts,
3370       src
3371     } = getSrcInfo(cst);
3372     if (!lineStarts || !(line >= 1) || line > lineStarts.length) return null;
3373     const start = lineStarts[line - 1];
3374     let end = lineStarts[line]; // undefined for last line; that's ok for slice()
3375
3376     while (end && end > start && src[end - 1] === '\n') --end;
3377
3378     return src.slice(start, end);
3379   }
3380   /**
3381    * Pretty-print the starting line from the source indicated by the range `pos`
3382    *
3383    * Trims output to `maxWidth` chars while keeping the starting column visible,
3384    * using `…` at either end to indicate dropped characters.
3385    *
3386    * Returns a two-line string (or `null`) with `\n` as separator; the second line
3387    * will hold appropriately indented `^` marks indicating the column range.
3388    *
3389    * @param {Object} pos
3390    * @param {LinePos} pos.start
3391    * @param {LinePos} [pos.end]
3392    * @param {string|Document|Document[]*} cst
3393    * @param {number} [maxWidth=80]
3394    * @returns {?string}
3395    */
3396
3397
3398   function getPrettyContext({
3399     start,
3400     end
3401   }, cst, maxWidth = 80) {
3402     let src = getLine(start.line, cst);
3403     if (!src) return null;
3404     let {
3405       col
3406     } = start;
3407
3408     if (src.length > maxWidth) {
3409       if (col <= maxWidth - 10) {
3410         src = src.substr(0, maxWidth - 1) + '…';
3411       } else {
3412         const halfWidth = Math.round(maxWidth / 2);
3413         if (src.length > col + halfWidth) src = src.substr(0, col + halfWidth - 1) + '…';
3414         col -= src.length - maxWidth;
3415         src = '…' + src.substr(1 - maxWidth);
3416       }
3417     }
3418
3419     let errLen = 1;
3420     let errEnd = '';
3421
3422     if (end) {
3423       if (end.line === start.line && col + (end.col - start.col) <= maxWidth + 1) {
3424         errLen = end.col - start.col;
3425       } else {
3426         errLen = Math.min(src.length + 1, maxWidth) - col;
3427         errEnd = '…';
3428       }
3429     }
3430
3431     const offset = col > 1 ? ' '.repeat(col - 1) : '';
3432     const err = '^'.repeat(errLen);
3433     return `${src}\n${offset}${err}${errEnd}`;
3434   }
3435 });
3436 unwrapExports(sourceUtils);
3437 var sourceUtils_1 = sourceUtils.getLinePos;
3438 var sourceUtils_2 = sourceUtils.getLine;
3439 var sourceUtils_3 = sourceUtils.getPrettyContext;
3440
3441 var Range_1 = createCommonjsModule(function (module, exports) {
3442
3443   Object.defineProperty(exports, "__esModule", {
3444     value: true
3445   });
3446   exports.default = void 0;
3447
3448   class Range {
3449     static copy(orig) {
3450       return new Range(orig.start, orig.end);
3451     }
3452
3453     constructor(start, end) {
3454       this.start = start;
3455       this.end = end || start;
3456     }
3457
3458     isEmpty() {
3459       return typeof this.start !== 'number' || !this.end || this.end <= this.start;
3460     }
3461     /**
3462      * Set `origStart` and `origEnd` to point to the original source range for
3463      * this node, which may differ due to dropped CR characters.
3464      *
3465      * @param {number[]} cr - Positions of dropped CR characters
3466      * @param {number} offset - Starting index of `cr` from the last call
3467      * @returns {number} - The next offset, matching the one found for `origStart`
3468      */
3469
3470
3471     setOrigRange(cr, offset) {
3472       const {
3473         start,
3474         end
3475       } = this;
3476
3477       if (cr.length === 0 || end <= cr[0]) {
3478         this.origStart = start;
3479         this.origEnd = end;
3480         return offset;
3481       }
3482
3483       let i = offset;
3484
3485       while (i < cr.length) {
3486         if (cr[i] > start) break;else ++i;
3487       }
3488
3489       this.origStart = start + i;
3490       const nextOffset = i;
3491
3492       while (i < cr.length) {
3493         // if end was at \n, it should now be at \r
3494         if (cr[i] >= end) break;else ++i;
3495       }
3496
3497       this.origEnd = end + i;
3498       return nextOffset;
3499     }
3500
3501   }
3502
3503   exports.default = Range;
3504 });
3505 unwrapExports(Range_1);
3506
3507 var Node_1 = createCommonjsModule(function (module, exports) {
3508
3509   Object.defineProperty(exports, "__esModule", {
3510     value: true
3511   });
3512   exports.default = void 0;
3513
3514   var _Range = _interopRequireDefault(Range_1);
3515
3516   function _interopRequireDefault(obj) {
3517     return obj && obj.__esModule ? obj : {
3518       default: obj
3519     };
3520   }
3521   /** Root class of all nodes */
3522
3523
3524   class Node {
3525     static addStringTerminator(src, offset, str) {
3526       if (str[str.length - 1] === '\n') return str;
3527       const next = Node.endOfWhiteSpace(src, offset);
3528       return next >= src.length || src[next] === '\n' ? str + '\n' : str;
3529     } // ^(---|...)
3530
3531
3532     static atDocumentBoundary(src, offset, sep) {
3533       const ch0 = src[offset];
3534       if (!ch0) return true;
3535       const prev = src[offset - 1];
3536       if (prev && prev !== '\n') return false;
3537
3538       if (sep) {
3539         if (ch0 !== sep) return false;
3540       } else {
3541         if (ch0 !== constants.Char.DIRECTIVES_END && ch0 !== constants.Char.DOCUMENT_END) return false;
3542       }
3543
3544       const ch1 = src[offset + 1];
3545       const ch2 = src[offset + 2];
3546       if (ch1 !== ch0 || ch2 !== ch0) return false;
3547       const ch3 = src[offset + 3];
3548       return !ch3 || ch3 === '\n' || ch3 === '\t' || ch3 === ' ';
3549     }
3550
3551     static endOfIdentifier(src, offset) {
3552       let ch = src[offset];
3553       const isVerbatim = ch === '<';
3554       const notOk = isVerbatim ? ['\n', '\t', ' ', '>'] : ['\n', '\t', ' ', '[', ']', '{', '}', ','];
3555
3556       while (ch && notOk.indexOf(ch) === -1) ch = src[offset += 1];
3557
3558       if (isVerbatim && ch === '>') offset += 1;
3559       return offset;
3560     }
3561
3562     static endOfIndent(src, offset) {
3563       let ch = src[offset];
3564
3565       while (ch === ' ') ch = src[offset += 1];
3566
3567       return offset;
3568     }
3569
3570     static endOfLine(src, offset) {
3571       let ch = src[offset];
3572
3573       while (ch && ch !== '\n') ch = src[offset += 1];
3574
3575       return offset;
3576     }
3577
3578     static endOfWhiteSpace(src, offset) {
3579       let ch = src[offset];
3580
3581       while (ch === '\t' || ch === ' ') ch = src[offset += 1];
3582
3583       return offset;
3584     }
3585
3586     static startOfLine(src, offset) {
3587       let ch = src[offset - 1];
3588       if (ch === '\n') return offset;
3589
3590       while (ch && ch !== '\n') ch = src[offset -= 1];
3591
3592       return offset + 1;
3593     }
3594     /**
3595      * End of indentation, or null if the line's indent level is not more
3596      * than `indent`
3597      *
3598      * @param {string} src
3599      * @param {number} indent
3600      * @param {number} lineStart
3601      * @returns {?number}
3602      */
3603
3604
3605     static endOfBlockIndent(src, indent, lineStart) {
3606       const inEnd = Node.endOfIndent(src, lineStart);
3607
3608       if (inEnd > lineStart + indent) {
3609         return inEnd;
3610       } else {
3611         const wsEnd = Node.endOfWhiteSpace(src, inEnd);
3612         const ch = src[wsEnd];
3613         if (!ch || ch === '\n') return wsEnd;
3614       }
3615
3616       return null;
3617     }
3618
3619     static atBlank(src, offset, endAsBlank) {
3620       const ch = src[offset];
3621       return ch === '\n' || ch === '\t' || ch === ' ' || endAsBlank && !ch;
3622     }
3623
3624     static nextNodeIsIndented(ch, indentDiff, indicatorAsIndent) {
3625       if (!ch || indentDiff < 0) return false;
3626       if (indentDiff > 0) return true;
3627       return indicatorAsIndent && ch === '-';
3628     } // should be at line or string end, or at next non-whitespace char
3629
3630
3631     static normalizeOffset(src, offset) {
3632       const ch = src[offset];
3633       return !ch ? offset : ch !== '\n' && src[offset - 1] === '\n' ? offset - 1 : Node.endOfWhiteSpace(src, offset);
3634     } // fold single newline into space, multiple newlines to N - 1 newlines
3635     // presumes src[offset] === '\n'
3636
3637
3638     static foldNewline(src, offset, indent) {
3639       let inCount = 0;
3640       let error = false;
3641       let fold = '';
3642       let ch = src[offset + 1];
3643
3644       while (ch === ' ' || ch === '\t' || ch === '\n') {
3645         switch (ch) {
3646           case '\n':
3647             inCount = 0;
3648             offset += 1;
3649             fold += '\n';
3650             break;
3651
3652           case '\t':
3653             if (inCount <= indent) error = true;
3654             offset = Node.endOfWhiteSpace(src, offset + 2) - 1;
3655             break;
3656
3657           case ' ':
3658             inCount += 1;
3659             offset += 1;
3660             break;
3661         }
3662
3663         ch = src[offset + 1];
3664       }
3665
3666       if (!fold) fold = ' ';
3667       if (ch && inCount <= indent) error = true;
3668       return {
3669         fold,
3670         offset,
3671         error
3672       };
3673     }
3674
3675     constructor(type, props, context) {
3676       Object.defineProperty(this, 'context', {
3677         value: context || null,
3678         writable: true
3679       });
3680       this.error = null;
3681       this.range = null;
3682       this.valueRange = null;
3683       this.props = props || [];
3684       this.type = type;
3685       this.value = null;
3686     }
3687
3688     getPropValue(idx, key, skipKey) {
3689       if (!this.context) return null;
3690       const {
3691         src
3692       } = this.context;
3693       const prop = this.props[idx];
3694       return prop && src[prop.start] === key ? src.slice(prop.start + (skipKey ? 1 : 0), prop.end) : null;
3695     }
3696
3697     get anchor() {
3698       for (let i = 0; i < this.props.length; ++i) {
3699         const anchor = this.getPropValue(i, constants.Char.ANCHOR, true);
3700         if (anchor != null) return anchor;
3701       }
3702
3703       return null;
3704     }
3705
3706     get comment() {
3707       const comments = [];
3708
3709       for (let i = 0; i < this.props.length; ++i) {
3710         const comment = this.getPropValue(i, constants.Char.COMMENT, true);
3711         if (comment != null) comments.push(comment);
3712       }
3713
3714       return comments.length > 0 ? comments.join('\n') : null;
3715     }
3716
3717     commentHasRequiredWhitespace(start) {
3718       const {
3719         src
3720       } = this.context;
3721       if (this.header && start === this.header.end) return false;
3722       if (!this.valueRange) return false;
3723       const {
3724         end
3725       } = this.valueRange;
3726       return start !== end || Node.atBlank(src, end - 1);
3727     }
3728
3729     get hasComment() {
3730       if (this.context) {
3731         const {
3732           src
3733         } = this.context;
3734
3735         for (let i = 0; i < this.props.length; ++i) {
3736           if (src[this.props[i].start] === constants.Char.COMMENT) return true;
3737         }
3738       }
3739
3740       return false;
3741     }
3742
3743     get hasProps() {
3744       if (this.context) {
3745         const {
3746           src
3747         } = this.context;
3748
3749         for (let i = 0; i < this.props.length; ++i) {
3750           if (src[this.props[i].start] !== constants.Char.COMMENT) return true;
3751         }
3752       }
3753
3754       return false;
3755     }
3756
3757     get includesTrailingLines() {
3758       return false;
3759     }
3760
3761     get jsonLike() {
3762       const jsonLikeTypes = [constants.Type.FLOW_MAP, constants.Type.FLOW_SEQ, constants.Type.QUOTE_DOUBLE, constants.Type.QUOTE_SINGLE];
3763       return jsonLikeTypes.indexOf(this.type) !== -1;
3764     }
3765
3766     get rangeAsLinePos() {
3767       if (!this.range || !this.context) return undefined;
3768       const start = (0, sourceUtils.getLinePos)(this.range.start, this.context.root);
3769       if (!start) return undefined;
3770       const end = (0, sourceUtils.getLinePos)(this.range.end, this.context.root);
3771       return {
3772         start,
3773         end
3774       };
3775     }
3776
3777     get rawValue() {
3778       if (!this.valueRange || !this.context) return null;
3779       const {
3780         start,
3781         end
3782       } = this.valueRange;
3783       return this.context.src.slice(start, end);
3784     }
3785
3786     get tag() {
3787       for (let i = 0; i < this.props.length; ++i) {
3788         const tag = this.getPropValue(i, constants.Char.TAG, false);
3789
3790         if (tag != null) {
3791           if (tag[1] === '<') {
3792             return {
3793               verbatim: tag.slice(2, -1)
3794             };
3795           } else {
3796             // eslint-disable-next-line no-unused-vars
3797             const [_, handle, suffix] = tag.match(/^(.*!)([^!]*)$/);
3798             return {
3799               handle,
3800               suffix
3801             };
3802           }
3803         }
3804       }
3805
3806       return null;
3807     }
3808
3809     get valueRangeContainsNewline() {
3810       if (!this.valueRange || !this.context) return false;
3811       const {
3812         start,
3813         end
3814       } = this.valueRange;
3815       const {
3816         src
3817       } = this.context;
3818
3819       for (let i = start; i < end; ++i) {
3820         if (src[i] === '\n') return true;
3821       }
3822
3823       return false;
3824     }
3825
3826     parseComment(start) {
3827       const {
3828         src
3829       } = this.context;
3830
3831       if (src[start] === constants.Char.COMMENT) {
3832         const end = Node.endOfLine(src, start + 1);
3833         const commentRange = new _Range.default(start, end);
3834         this.props.push(commentRange);
3835         return end;
3836       }
3837
3838       return start;
3839     }
3840     /**
3841      * Populates the `origStart` and `origEnd` values of all ranges for this
3842      * node. Extended by child classes to handle descendant nodes.
3843      *
3844      * @param {number[]} cr - Positions of dropped CR characters
3845      * @param {number} offset - Starting index of `cr` from the last call
3846      * @returns {number} - The next offset, matching the one found for `origStart`
3847      */
3848
3849
3850     setOrigRanges(cr, offset) {
3851       if (this.range) offset = this.range.setOrigRange(cr, offset);
3852       if (this.valueRange) this.valueRange.setOrigRange(cr, offset);
3853       this.props.forEach(prop => prop.setOrigRange(cr, offset));
3854       return offset;
3855     }
3856
3857     toString() {
3858       const {
3859         context: {
3860           src
3861         },
3862         range,
3863         value
3864       } = this;
3865       if (value != null) return value;
3866       const str = src.slice(range.start, range.end);
3867       return Node.addStringTerminator(src, range.end, str);
3868     }
3869
3870   }
3871
3872   exports.default = Node;
3873 });
3874 unwrapExports(Node_1);
3875
3876 var errors = createCommonjsModule(function (module, exports) {
3877
3878   Object.defineProperty(exports, "__esModule", {
3879     value: true
3880   });
3881   exports.YAMLWarning = exports.YAMLSyntaxError = exports.YAMLSemanticError = exports.YAMLReferenceError = exports.YAMLError = void 0;
3882
3883   var _Node = _interopRequireDefault(Node_1);
3884
3885   var _Range = _interopRequireDefault(Range_1);
3886
3887   function _interopRequireDefault(obj) {
3888     return obj && obj.__esModule ? obj : {
3889       default: obj
3890     };
3891   }
3892
3893   class YAMLError extends Error {
3894     constructor(name, source, message) {
3895       if (!message || !(source instanceof _Node.default)) throw new Error(`Invalid arguments for new ${name}`);
3896       super();
3897       this.name = name;
3898       this.message = message;
3899       this.source = source;
3900     }
3901
3902     makePretty() {
3903       if (!this.source) return;
3904       this.nodeType = this.source.type;
3905       const cst = this.source.context && this.source.context.root;
3906
3907       if (typeof this.offset === 'number') {
3908         this.range = new _Range.default(this.offset, this.offset + 1);
3909         const start = cst && (0, sourceUtils.getLinePos)(this.offset, cst);
3910
3911         if (start) {
3912           const end = {
3913             line: start.line,
3914             col: start.col + 1
3915           };
3916           this.linePos = {
3917             start,
3918             end
3919           };
3920         }
3921
3922         delete this.offset;
3923       } else {
3924         this.range = this.source.range;
3925         this.linePos = this.source.rangeAsLinePos;
3926       }
3927
3928       if (this.linePos) {
3929         const {
3930           line,
3931           col
3932         } = this.linePos.start;
3933         this.message += ` at line ${line}, column ${col}`;
3934         const ctx = cst && (0, sourceUtils.getPrettyContext)(this.linePos, cst);
3935         if (ctx) this.message += `:\n\n${ctx}\n`;
3936       }
3937
3938       delete this.source;
3939     }
3940
3941   }
3942
3943   exports.YAMLError = YAMLError;
3944
3945   class YAMLReferenceError extends YAMLError {
3946     constructor(source, message) {
3947       super('YAMLReferenceError', source, message);
3948     }
3949
3950   }
3951
3952   exports.YAMLReferenceError = YAMLReferenceError;
3953
3954   class YAMLSemanticError extends YAMLError {
3955     constructor(source, message) {
3956       super('YAMLSemanticError', source, message);
3957     }
3958
3959   }
3960
3961   exports.YAMLSemanticError = YAMLSemanticError;
3962
3963   class YAMLSyntaxError extends YAMLError {
3964     constructor(source, message) {
3965       super('YAMLSyntaxError', source, message);
3966     }
3967
3968   }
3969
3970   exports.YAMLSyntaxError = YAMLSyntaxError;
3971
3972   class YAMLWarning extends YAMLError {
3973     constructor(source, message) {
3974       super('YAMLWarning', source, message);
3975     }
3976
3977   }
3978
3979   exports.YAMLWarning = YAMLWarning;
3980 });
3981 unwrapExports(errors);
3982 var errors_1 = errors.YAMLWarning;
3983 var errors_2 = errors.YAMLSyntaxError;
3984 var errors_3 = errors.YAMLSemanticError;
3985 var errors_4 = errors.YAMLReferenceError;
3986 var errors_5 = errors.YAMLError;
3987
3988 var BlankLine_1 = createCommonjsModule(function (module, exports) {
3989
3990   Object.defineProperty(exports, "__esModule", {
3991     value: true
3992   });
3993   exports.default = void 0;
3994
3995   var _Node = _interopRequireDefault(Node_1);
3996
3997   var _Range = _interopRequireDefault(Range_1);
3998
3999   function _interopRequireDefault(obj) {
4000     return obj && obj.__esModule ? obj : {
4001       default: obj
4002     };
4003   }
4004
4005   class BlankLine extends _Node.default {
4006     constructor() {
4007       super(constants.Type.BLANK_LINE);
4008     }
4009     /* istanbul ignore next */
4010
4011
4012     get includesTrailingLines() {
4013       // This is never called from anywhere, but if it were,
4014       // this is the value it should return.
4015       return true;
4016     }
4017     /**
4018      * Parses blank lines from the source
4019      *
4020      * @param {ParseContext} context
4021      * @param {number} start - Index of first \n character
4022      * @returns {number} - Index of the character after this
4023      */
4024
4025
4026     parse(context, start) {
4027       this.context = context;
4028       const {
4029         src
4030       } = context;
4031       let offset = start + 1;
4032
4033       while (_Node.default.atBlank(src, offset)) {
4034         const lineEnd = _Node.default.endOfWhiteSpace(src, offset);
4035
4036         if (lineEnd === '\n') offset = lineEnd + 1;else break;
4037       }
4038
4039       this.range = new _Range.default(start, offset);
4040       return offset;
4041     }
4042
4043   }
4044
4045   exports.default = BlankLine;
4046 });
4047 unwrapExports(BlankLine_1);
4048
4049 var CollectionItem_1 = createCommonjsModule(function (module, exports) {
4050
4051   Object.defineProperty(exports, "__esModule", {
4052     value: true
4053   });
4054   exports.default = void 0;
4055
4056   var _BlankLine = _interopRequireDefault(BlankLine_1);
4057
4058   var _Node = _interopRequireDefault(Node_1);
4059
4060   var _Range = _interopRequireDefault(Range_1);
4061
4062   function _interopRequireDefault(obj) {
4063     return obj && obj.__esModule ? obj : {
4064       default: obj
4065     };
4066   }
4067
4068   class CollectionItem extends _Node.default {
4069     constructor(type, props) {
4070       super(type, props);
4071       this.node = null;
4072     }
4073
4074     get includesTrailingLines() {
4075       return !!this.node && this.node.includesTrailingLines;
4076     }
4077     /**
4078      * @param {ParseContext} context
4079      * @param {number} start - Index of first character
4080      * @returns {number} - Index of the character after this
4081      */
4082
4083
4084     parse(context, start) {
4085       this.context = context;
4086       const {
4087         parseNode,
4088         src
4089       } = context;
4090       let {
4091         atLineStart,
4092         lineStart
4093       } = context;
4094       if (!atLineStart && this.type === constants.Type.SEQ_ITEM) this.error = new errors.YAMLSemanticError(this, 'Sequence items must not have preceding content on the same line');
4095       const indent = atLineStart ? start - lineStart : context.indent;
4096
4097       let offset = _Node.default.endOfWhiteSpace(src, start + 1);
4098
4099       let ch = src[offset];
4100       const inlineComment = ch === '#';
4101       const comments = [];
4102       let blankLine = null;
4103
4104       while (ch === '\n' || ch === '#') {
4105         if (ch === '#') {
4106           const end = _Node.default.endOfLine(src, offset + 1);
4107
4108           comments.push(new _Range.default(offset, end));
4109           offset = end;
4110         } else {
4111           atLineStart = true;
4112           lineStart = offset + 1;
4113
4114           const wsEnd = _Node.default.endOfWhiteSpace(src, lineStart);
4115
4116           if (src[wsEnd] === '\n' && comments.length === 0) {
4117             blankLine = new _BlankLine.default();
4118             lineStart = blankLine.parse({
4119               src
4120             }, lineStart);
4121           }
4122
4123           offset = _Node.default.endOfIndent(src, lineStart);
4124         }
4125
4126         ch = src[offset];
4127       }
4128
4129       if (_Node.default.nextNodeIsIndented(ch, offset - (lineStart + indent), this.type !== constants.Type.SEQ_ITEM)) {
4130         this.node = parseNode({
4131           atLineStart,
4132           inCollection: false,
4133           indent,
4134           lineStart,
4135           parent: this
4136         }, offset);
4137       } else if (ch && lineStart > start + 1) {
4138         offset = lineStart - 1;
4139       }
4140
4141       if (this.node) {
4142         if (blankLine) {
4143           // Only blank lines preceding non-empty nodes are captured. Note that
4144           // this means that collection item range start indices do not always
4145           // increase monotonically. -- eemeli/yaml#126
4146           const items = context.parent.items || context.parent.contents;
4147           if (items) items.push(blankLine);
4148         }
4149
4150         if (comments.length) Array.prototype.push.apply(this.props, comments);
4151         offset = this.node.range.end;
4152       } else {
4153         if (inlineComment) {
4154           const c = comments[0];
4155           this.props.push(c);
4156           offset = c.end;
4157         } else {
4158           offset = _Node.default.endOfLine(src, start + 1);
4159         }
4160       }
4161
4162       const end = this.node ? this.node.valueRange.end : offset;
4163       this.valueRange = new _Range.default(start, end);
4164       return offset;
4165     }
4166
4167     setOrigRanges(cr, offset) {
4168       offset = super.setOrigRanges(cr, offset);
4169       return this.node ? this.node.setOrigRanges(cr, offset) : offset;
4170     }
4171
4172     toString() {
4173       const {
4174         context: {
4175           src
4176         },
4177         node,
4178         range,
4179         value
4180       } = this;
4181       if (value != null) return value;
4182       const str = node ? src.slice(range.start, node.range.start) + String(node) : src.slice(range.start, range.end);
4183       return _Node.default.addStringTerminator(src, range.end, str);
4184     }
4185
4186   }
4187
4188   exports.default = CollectionItem;
4189 });
4190 unwrapExports(CollectionItem_1);
4191
4192 var Comment_1 = createCommonjsModule(function (module, exports) {
4193
4194   Object.defineProperty(exports, "__esModule", {
4195     value: true
4196   });
4197   exports.default = void 0;
4198
4199   var _Node = _interopRequireDefault(Node_1);
4200
4201   var _Range = _interopRequireDefault(Range_1);
4202
4203   function _interopRequireDefault(obj) {
4204     return obj && obj.__esModule ? obj : {
4205       default: obj
4206     };
4207   }
4208
4209   class Comment extends _Node.default {
4210     constructor() {
4211       super(constants.Type.COMMENT);
4212     }
4213     /**
4214      * Parses a comment line from the source
4215      *
4216      * @param {ParseContext} context
4217      * @param {number} start - Index of first character
4218      * @returns {number} - Index of the character after this scalar
4219      */
4220
4221
4222     parse(context, start) {
4223       this.context = context;
4224       const offset = this.parseComment(start);
4225       this.range = new _Range.default(start, offset);
4226       return offset;
4227     }
4228
4229   }
4230
4231   exports.default = Comment;
4232 });
4233 unwrapExports(Comment_1);
4234
4235 var Collection_1 = createCommonjsModule(function (module, exports) {
4236
4237   Object.defineProperty(exports, "__esModule", {
4238     value: true
4239   });
4240   exports.grabCollectionEndComments = grabCollectionEndComments;
4241   exports.default = void 0;
4242
4243   var _BlankLine = _interopRequireDefault(BlankLine_1);
4244
4245   var _CollectionItem = _interopRequireDefault(CollectionItem_1);
4246
4247   var _Comment = _interopRequireDefault(Comment_1);
4248
4249   var _Node = _interopRequireDefault(Node_1);
4250
4251   var _Range = _interopRequireDefault(Range_1);
4252
4253   function _interopRequireDefault(obj) {
4254     return obj && obj.__esModule ? obj : {
4255       default: obj
4256     };
4257   }
4258
4259   function grabCollectionEndComments(node) {
4260     let cnode = node;
4261
4262     while (cnode instanceof _CollectionItem.default) cnode = cnode.node;
4263
4264     if (!(cnode instanceof Collection)) return null;
4265     const len = cnode.items.length;
4266     let ci = -1;
4267
4268     for (let i = len - 1; i >= 0; --i) {
4269       const n = cnode.items[i];
4270
4271       if (n.type === constants.Type.COMMENT) {
4272         // Keep sufficiently indented comments with preceding node
4273         const {
4274           indent,
4275           lineStart
4276         } = n.context;
4277         if (indent > 0 && n.range.start >= lineStart + indent) break;
4278         ci = i;
4279       } else if (n.type === constants.Type.BLANK_LINE) ci = i;else break;
4280     }
4281
4282     if (ci === -1) return null;
4283     const ca = cnode.items.splice(ci, len - ci);
4284     const prevEnd = ca[0].range.start;
4285
4286     while (true) {
4287       cnode.range.end = prevEnd;
4288       if (cnode.valueRange && cnode.valueRange.end > prevEnd) cnode.valueRange.end = prevEnd;
4289       if (cnode === node) break;
4290       cnode = cnode.context.parent;
4291     }
4292
4293     return ca;
4294   }
4295
4296   class Collection extends _Node.default {
4297     static nextContentHasIndent(src, offset, indent) {
4298       const lineStart = _Node.default.endOfLine(src, offset) + 1;
4299       offset = _Node.default.endOfWhiteSpace(src, lineStart);
4300       const ch = src[offset];
4301       if (!ch) return false;
4302       if (offset >= lineStart + indent) return true;
4303       if (ch !== '#' && ch !== '\n') return false;
4304       return Collection.nextContentHasIndent(src, offset, indent);
4305     }
4306
4307     constructor(firstItem) {
4308       super(firstItem.type === constants.Type.SEQ_ITEM ? constants.Type.SEQ : constants.Type.MAP);
4309
4310       for (let i = firstItem.props.length - 1; i >= 0; --i) {
4311         if (firstItem.props[i].start < firstItem.context.lineStart) {
4312           // props on previous line are assumed by the collection
4313           this.props = firstItem.props.slice(0, i + 1);
4314           firstItem.props = firstItem.props.slice(i + 1);
4315           const itemRange = firstItem.props[0] || firstItem.valueRange;
4316           firstItem.range.start = itemRange.start;
4317           break;
4318         }
4319       }
4320
4321       this.items = [firstItem];
4322       const ec = grabCollectionEndComments(firstItem);
4323       if (ec) Array.prototype.push.apply(this.items, ec);
4324     }
4325
4326     get includesTrailingLines() {
4327       return this.items.length > 0;
4328     }
4329     /**
4330      * @param {ParseContext} context
4331      * @param {number} start - Index of first character
4332      * @returns {number} - Index of the character after this
4333      */
4334
4335
4336     parse(context, start) {
4337       this.context = context;
4338       const {
4339         parseNode,
4340         src
4341       } = context; // It's easier to recalculate lineStart here rather than tracking down the
4342       // last context from which to read it -- eemeli/yaml#2
4343
4344       let lineStart = _Node.default.startOfLine(src, start);
4345
4346       const firstItem = this.items[0]; // First-item context needs to be correct for later comment handling
4347       // -- eemeli/yaml#17
4348
4349       firstItem.context.parent = this;
4350       this.valueRange = _Range.default.copy(firstItem.valueRange);
4351       const indent = firstItem.range.start - firstItem.context.lineStart;
4352       let offset = start;
4353       offset = _Node.default.normalizeOffset(src, offset);
4354       let ch = src[offset];
4355       let atLineStart = _Node.default.endOfWhiteSpace(src, lineStart) === offset;
4356       let prevIncludesTrailingLines = false;
4357
4358       while (ch) {
4359         while (ch === '\n' || ch === '#') {
4360           if (atLineStart && ch === '\n' && !prevIncludesTrailingLines) {
4361             const blankLine = new _BlankLine.default();
4362             offset = blankLine.parse({
4363               src
4364             }, offset);
4365             this.valueRange.end = offset;
4366
4367             if (offset >= src.length) {
4368               ch = null;
4369               break;
4370             }
4371
4372             this.items.push(blankLine);
4373             offset -= 1; // blankLine.parse() consumes terminal newline
4374           } else if (ch === '#') {
4375             if (offset < lineStart + indent && !Collection.nextContentHasIndent(src, offset, indent)) {
4376               return offset;
4377             }
4378
4379             const comment = new _Comment.default();
4380             offset = comment.parse({
4381               indent,
4382               lineStart,
4383               src
4384             }, offset);
4385             this.items.push(comment);
4386             this.valueRange.end = offset;
4387
4388             if (offset >= src.length) {
4389               ch = null;
4390               break;
4391             }
4392           }
4393
4394           lineStart = offset + 1;
4395           offset = _Node.default.endOfIndent(src, lineStart);
4396
4397           if (_Node.default.atBlank(src, offset)) {
4398             const wsEnd = _Node.default.endOfWhiteSpace(src, offset);
4399
4400             const next = src[wsEnd];
4401
4402             if (!next || next === '\n' || next === '#') {
4403               offset = wsEnd;
4404             }
4405           }
4406
4407           ch = src[offset];
4408           atLineStart = true;
4409         }
4410
4411         if (!ch) {
4412           break;
4413         }
4414
4415         if (offset !== lineStart + indent && (atLineStart || ch !== ':')) {
4416           if (lineStart > start) offset = lineStart;
4417           break;
4418         }
4419
4420         if (firstItem.type === constants.Type.SEQ_ITEM !== (ch === '-')) {
4421           let typeswitch = true;
4422
4423           if (ch === '-') {
4424             // map key may start with -, as long as it's followed by a non-whitespace char
4425             const next = src[offset + 1];
4426             typeswitch = !next || next === '\n' || next === '\t' || next === ' ';
4427           }
4428
4429           if (typeswitch) {
4430             if (lineStart > start) offset = lineStart;
4431             break;
4432           }
4433         }
4434
4435         const node = parseNode({
4436           atLineStart,
4437           inCollection: true,
4438           indent,
4439           lineStart,
4440           parent: this
4441         }, offset);
4442         if (!node) return offset; // at next document start
4443
4444         this.items.push(node);
4445         this.valueRange.end = node.valueRange.end;
4446         offset = _Node.default.normalizeOffset(src, node.range.end);
4447         ch = src[offset];
4448         atLineStart = false;
4449         prevIncludesTrailingLines = node.includesTrailingLines; // Need to reset lineStart and atLineStart here if preceding node's range
4450         // has advanced to check the current line's indentation level
4451         // -- eemeli/yaml#10 & eemeli/yaml#38
4452
4453         if (ch) {
4454           let ls = offset - 1;
4455           let prev = src[ls];
4456
4457           while (prev === ' ' || prev === '\t') prev = src[--ls];
4458
4459           if (prev === '\n') {
4460             lineStart = ls + 1;
4461             atLineStart = true;
4462           }
4463         }
4464
4465         const ec = grabCollectionEndComments(node);
4466         if (ec) Array.prototype.push.apply(this.items, ec);
4467       }
4468
4469       return offset;
4470     }
4471
4472     setOrigRanges(cr, offset) {
4473       offset = super.setOrigRanges(cr, offset);
4474       this.items.forEach(node => {
4475         offset = node.setOrigRanges(cr, offset);
4476       });
4477       return offset;
4478     }
4479
4480     toString() {
4481       const {
4482         context: {
4483           src
4484         },
4485         items,
4486         range,
4487         value
4488       } = this;
4489       if (value != null) return value;
4490       let str = src.slice(range.start, items[0].range.start) + String(items[0]);
4491
4492       for (let i = 1; i < items.length; ++i) {
4493         const item = items[i];
4494         const {
4495           atLineStart,
4496           indent
4497         } = item.context;
4498         if (atLineStart) for (let i = 0; i < indent; ++i) str += ' ';
4499         str += String(item);
4500       }
4501
4502       return _Node.default.addStringTerminator(src, range.end, str);
4503     }
4504
4505   }
4506
4507   exports.default = Collection;
4508 });
4509 unwrapExports(Collection_1);
4510 var Collection_2 = Collection_1.grabCollectionEndComments;
4511
4512 var Directive_1 = createCommonjsModule(function (module, exports) {
4513
4514   Object.defineProperty(exports, "__esModule", {
4515     value: true
4516   });
4517   exports.default = void 0;
4518
4519   var _Node = _interopRequireDefault(Node_1);
4520
4521   var _Range = _interopRequireDefault(Range_1);
4522
4523   function _interopRequireDefault(obj) {
4524     return obj && obj.__esModule ? obj : {
4525       default: obj
4526     };
4527   }
4528
4529   class Directive extends _Node.default {
4530     constructor() {
4531       super(constants.Type.DIRECTIVE);
4532       this.name = null;
4533     }
4534
4535     get parameters() {
4536       const raw = this.rawValue;
4537       return raw ? raw.trim().split(/[ \t]+/) : [];
4538     }
4539
4540     parseName(start) {
4541       const {
4542         src
4543       } = this.context;
4544       let offset = start;
4545       let ch = src[offset];
4546
4547       while (ch && ch !== '\n' && ch !== '\t' && ch !== ' ') ch = src[offset += 1];
4548
4549       this.name = src.slice(start, offset);
4550       return offset;
4551     }
4552
4553     parseParameters(start) {
4554       const {
4555         src
4556       } = this.context;
4557       let offset = start;
4558       let ch = src[offset];
4559
4560       while (ch && ch !== '\n' && ch !== '#') ch = src[offset += 1];
4561
4562       this.valueRange = new _Range.default(start, offset);
4563       return offset;
4564     }
4565
4566     parse(context, start) {
4567       this.context = context;
4568       let offset = this.parseName(start + 1);
4569       offset = this.parseParameters(offset);
4570       offset = this.parseComment(offset);
4571       this.range = new _Range.default(start, offset);
4572       return offset;
4573     }
4574
4575   }
4576
4577   exports.default = Directive;
4578 });
4579 unwrapExports(Directive_1);
4580
4581 var Document_1 = createCommonjsModule(function (module, exports) {
4582
4583   Object.defineProperty(exports, "__esModule", {
4584     value: true
4585   });
4586   exports.default = void 0;
4587
4588   var _BlankLine = _interopRequireDefault(BlankLine_1);
4589
4590   var _Comment = _interopRequireDefault(Comment_1);
4591
4592   var _Directive = _interopRequireDefault(Directive_1);
4593
4594   var _Node = _interopRequireDefault(Node_1);
4595
4596   var _Range = _interopRequireDefault(Range_1);
4597
4598   function _interopRequireDefault(obj) {
4599     return obj && obj.__esModule ? obj : {
4600       default: obj
4601     };
4602   }
4603
4604   class Document extends _Node.default {
4605     static startCommentOrEndBlankLine(src, start) {
4606       const offset = _Node.default.endOfWhiteSpace(src, start);
4607
4608       const ch = src[offset];
4609       return ch === '#' || ch === '\n' ? offset : start;
4610     }
4611
4612     constructor() {
4613       super(constants.Type.DOCUMENT);
4614       this.directives = null;
4615       this.contents = null;
4616       this.directivesEndMarker = null;
4617       this.documentEndMarker = null;
4618     }
4619
4620     parseDirectives(start) {
4621       const {
4622         src
4623       } = this.context;
4624       this.directives = [];
4625       let atLineStart = true;
4626       let hasDirectives = false;
4627       let offset = start;
4628
4629       while (!_Node.default.atDocumentBoundary(src, offset, constants.Char.DIRECTIVES_END)) {
4630         offset = Document.startCommentOrEndBlankLine(src, offset);
4631
4632         switch (src[offset]) {
4633           case '\n':
4634             if (atLineStart) {
4635               const blankLine = new _BlankLine.default();
4636               offset = blankLine.parse({
4637                 src
4638               }, offset);
4639
4640               if (offset < src.length) {
4641                 this.directives.push(blankLine);
4642               }
4643             } else {
4644               offset += 1;
4645               atLineStart = true;
4646             }
4647
4648             break;
4649
4650           case '#':
4651             {
4652               const comment = new _Comment.default();
4653               offset = comment.parse({
4654                 src
4655               }, offset);
4656               this.directives.push(comment);
4657               atLineStart = false;
4658             }
4659             break;
4660
4661           case '%':
4662             {
4663               const directive = new _Directive.default();
4664               offset = directive.parse({
4665                 parent: this,
4666                 src
4667               }, offset);
4668               this.directives.push(directive);
4669               hasDirectives = true;
4670               atLineStart = false;
4671             }
4672             break;
4673
4674           default:
4675             if (hasDirectives) {
4676               this.error = new errors.YAMLSemanticError(this, 'Missing directives-end indicator line');
4677             } else if (this.directives.length > 0) {
4678               this.contents = this.directives;
4679               this.directives = [];
4680             }
4681
4682             return offset;
4683         }
4684       }
4685
4686       if (src[offset]) {
4687         this.directivesEndMarker = new _Range.default(offset, offset + 3);
4688         return offset + 3;
4689       }
4690
4691       if (hasDirectives) {
4692         this.error = new errors.YAMLSemanticError(this, 'Missing directives-end indicator line');
4693       } else if (this.directives.length > 0) {
4694         this.contents = this.directives;
4695         this.directives = [];
4696       }
4697
4698       return offset;
4699     }
4700
4701     parseContents(start) {
4702       const {
4703         parseNode,
4704         src
4705       } = this.context;
4706       if (!this.contents) this.contents = [];
4707       let lineStart = start;
4708
4709       while (src[lineStart - 1] === '-') lineStart -= 1;
4710
4711       let offset = _Node.default.endOfWhiteSpace(src, start);
4712
4713       let atLineStart = lineStart === start;
4714       this.valueRange = new _Range.default(offset);
4715
4716       while (!_Node.default.atDocumentBoundary(src, offset, constants.Char.DOCUMENT_END)) {
4717         switch (src[offset]) {
4718           case '\n':
4719             if (atLineStart) {
4720               const blankLine = new _BlankLine.default();
4721               offset = blankLine.parse({
4722                 src
4723               }, offset);
4724
4725               if (offset < src.length) {
4726                 this.contents.push(blankLine);
4727               }
4728             } else {
4729               offset += 1;
4730               atLineStart = true;
4731             }
4732
4733             lineStart = offset;
4734             break;
4735
4736           case '#':
4737             {
4738               const comment = new _Comment.default();
4739               offset = comment.parse({
4740                 src
4741               }, offset);
4742               this.contents.push(comment);
4743               atLineStart = false;
4744             }
4745             break;
4746
4747           default:
4748             {
4749               const iEnd = _Node.default.endOfIndent(src, offset);
4750
4751               const context = {
4752                 atLineStart,
4753                 indent: -1,
4754                 inFlow: false,
4755                 inCollection: false,
4756                 lineStart,
4757                 parent: this
4758               };
4759               const node = parseNode(context, iEnd);
4760               if (!node) return this.valueRange.end = iEnd; // at next document start
4761
4762               this.contents.push(node);
4763               offset = node.range.end;
4764               atLineStart = false;
4765               const ec = (0, Collection_1.grabCollectionEndComments)(node);
4766               if (ec) Array.prototype.push.apply(this.contents, ec);
4767             }
4768         }
4769
4770         offset = Document.startCommentOrEndBlankLine(src, offset);
4771       }
4772
4773       this.valueRange.end = offset;
4774
4775       if (src[offset]) {
4776         this.documentEndMarker = new _Range.default(offset, offset + 3);
4777         offset += 3;
4778
4779         if (src[offset]) {
4780           offset = _Node.default.endOfWhiteSpace(src, offset);
4781
4782           if (src[offset] === '#') {
4783             const comment = new _Comment.default();
4784             offset = comment.parse({
4785               src
4786             }, offset);
4787             this.contents.push(comment);
4788           }
4789
4790           switch (src[offset]) {
4791             case '\n':
4792               offset += 1;
4793               break;
4794
4795             case undefined:
4796               break;
4797
4798             default:
4799               this.error = new errors.YAMLSyntaxError(this, 'Document end marker line cannot have a non-comment suffix');
4800           }
4801         }
4802       }
4803
4804       return offset;
4805     }
4806     /**
4807      * @param {ParseContext} context
4808      * @param {number} start - Index of first character
4809      * @returns {number} - Index of the character after this
4810      */
4811
4812
4813     parse(context, start) {
4814       context.root = this;
4815       this.context = context;
4816       const {
4817         src
4818       } = context;
4819       let offset = src.charCodeAt(start) === 0xfeff ? start + 1 : start; // skip BOM
4820
4821       offset = this.parseDirectives(offset);
4822       offset = this.parseContents(offset);
4823       return offset;
4824     }
4825
4826     setOrigRanges(cr, offset) {
4827       offset = super.setOrigRanges(cr, offset);
4828       this.directives.forEach(node => {
4829         offset = node.setOrigRanges(cr, offset);
4830       });
4831       if (this.directivesEndMarker) offset = this.directivesEndMarker.setOrigRange(cr, offset);
4832       this.contents.forEach(node => {
4833         offset = node.setOrigRanges(cr, offset);
4834       });
4835       if (this.documentEndMarker) offset = this.documentEndMarker.setOrigRange(cr, offset);
4836       return offset;
4837     }
4838
4839     toString() {
4840       const {
4841         contents,
4842         directives,
4843         value
4844       } = this;
4845       if (value != null) return value;
4846       let str = directives.join('');
4847
4848       if (contents.length > 0) {
4849         if (directives.length > 0 || contents[0].type === constants.Type.COMMENT) str += '---\n';
4850         str += contents.join('');
4851       }
4852
4853       if (str[str.length - 1] !== '\n') str += '\n';
4854       return str;
4855     }
4856
4857   }
4858
4859   exports.default = Document;
4860 });
4861 unwrapExports(Document_1);
4862
4863 var Alias_1 = createCommonjsModule(function (module, exports) {
4864
4865   Object.defineProperty(exports, "__esModule", {
4866     value: true
4867   });
4868   exports.default = void 0;
4869
4870   var _Node = _interopRequireDefault(Node_1);
4871
4872   var _Range = _interopRequireDefault(Range_1);
4873
4874   function _interopRequireDefault(obj) {
4875     return obj && obj.__esModule ? obj : {
4876       default: obj
4877     };
4878   }
4879
4880   class Alias extends _Node.default {
4881     /**
4882      * Parses an *alias from the source
4883      *
4884      * @param {ParseContext} context
4885      * @param {number} start - Index of first character
4886      * @returns {number} - Index of the character after this scalar
4887      */
4888     parse(context, start) {
4889       this.context = context;
4890       const {
4891         src
4892       } = context;
4893
4894       let offset = _Node.default.endOfIdentifier(src, start + 1);
4895
4896       this.valueRange = new _Range.default(start + 1, offset);
4897       offset = _Node.default.endOfWhiteSpace(src, offset);
4898       offset = this.parseComment(offset);
4899       return offset;
4900     }
4901
4902   }
4903
4904   exports.default = Alias;
4905 });
4906 unwrapExports(Alias_1);
4907
4908 var BlockValue_1 = createCommonjsModule(function (module, exports) {
4909
4910   Object.defineProperty(exports, "__esModule", {
4911     value: true
4912   });
4913   exports.default = exports.Chomp = void 0;
4914
4915   var _Node = _interopRequireDefault(Node_1);
4916
4917   var _Range = _interopRequireDefault(Range_1);
4918
4919   function _interopRequireDefault(obj) {
4920     return obj && obj.__esModule ? obj : {
4921       default: obj
4922     };
4923   }
4924
4925   const Chomp = {
4926     CLIP: 'CLIP',
4927     KEEP: 'KEEP',
4928     STRIP: 'STRIP'
4929   };
4930   exports.Chomp = Chomp;
4931
4932   class BlockValue extends _Node.default {
4933     constructor(type, props) {
4934       super(type, props);
4935       this.blockIndent = null;
4936       this.chomping = Chomp.CLIP;
4937       this.header = null;
4938     }
4939
4940     get includesTrailingLines() {
4941       return this.chomping === Chomp.KEEP;
4942     }
4943
4944     get strValue() {
4945       if (!this.valueRange || !this.context) return null;
4946       let {
4947         start,
4948         end
4949       } = this.valueRange;
4950       const {
4951         indent,
4952         src
4953       } = this.context;
4954       if (this.valueRange.isEmpty()) return '';
4955       let lastNewLine = null;
4956       let ch = src[end - 1];
4957
4958       while (ch === '\n' || ch === '\t' || ch === ' ') {
4959         end -= 1;
4960
4961         if (end <= start) {
4962           if (this.chomping === Chomp.KEEP) break;else return ''; // probably never happens
4963         }
4964
4965         if (ch === '\n') lastNewLine = end;
4966         ch = src[end - 1];
4967       }
4968
4969       let keepStart = end + 1;
4970
4971       if (lastNewLine) {
4972         if (this.chomping === Chomp.KEEP) {
4973           keepStart = lastNewLine;
4974           end = this.valueRange.end;
4975         } else {
4976           end = lastNewLine;
4977         }
4978       }
4979
4980       const bi = indent + this.blockIndent;
4981       const folded = this.type === constants.Type.BLOCK_FOLDED;
4982       let atStart = true;
4983       let str = '';
4984       let sep = '';
4985       let prevMoreIndented = false;
4986
4987       for (let i = start; i < end; ++i) {
4988         for (let j = 0; j < bi; ++j) {
4989           if (src[i] !== ' ') break;
4990           i += 1;
4991         }
4992
4993         const ch = src[i];
4994
4995         if (ch === '\n') {
4996           if (sep === '\n') str += '\n';else sep = '\n';
4997         } else {
4998           const lineEnd = _Node.default.endOfLine(src, i);
4999
5000           const line = src.slice(i, lineEnd);
5001           i = lineEnd;
5002
5003           if (folded && (ch === ' ' || ch === '\t') && i < keepStart) {
5004             if (sep === ' ') sep = '\n';else if (!prevMoreIndented && !atStart && sep === '\n') sep = '\n\n';
5005             str += sep + line; //+ ((lineEnd < end && src[lineEnd]) || '')
5006
5007             sep = lineEnd < end && src[lineEnd] || '';
5008             prevMoreIndented = true;
5009           } else {
5010             str += sep + line;
5011             sep = folded && i < keepStart ? ' ' : '\n';
5012             prevMoreIndented = false;
5013           }
5014
5015           if (atStart && line !== '') atStart = false;
5016         }
5017       }
5018
5019       return this.chomping === Chomp.STRIP ? str : str + '\n';
5020     }
5021
5022     parseBlockHeader(start) {
5023       const {
5024         src
5025       } = this.context;
5026       let offset = start + 1;
5027       let bi = '';
5028
5029       while (true) {
5030         const ch = src[offset];
5031
5032         switch (ch) {
5033           case '-':
5034             this.chomping = Chomp.STRIP;
5035             break;
5036
5037           case '+':
5038             this.chomping = Chomp.KEEP;
5039             break;
5040
5041           case '0':
5042           case '1':
5043           case '2':
5044           case '3':
5045           case '4':
5046           case '5':
5047           case '6':
5048           case '7':
5049           case '8':
5050           case '9':
5051             bi += ch;
5052             break;
5053
5054           default:
5055             this.blockIndent = Number(bi) || null;
5056             this.header = new _Range.default(start, offset);
5057             return offset;
5058         }
5059
5060         offset += 1;
5061       }
5062     }
5063
5064     parseBlockValue(start) {
5065       const {
5066         indent,
5067         src
5068       } = this.context;
5069       let offset = start;
5070       let valueEnd = start;
5071       let bi = this.blockIndent ? indent + this.blockIndent - 1 : indent;
5072       let minBlockIndent = 1;
5073
5074       for (let ch = src[offset]; ch === '\n'; ch = src[offset]) {
5075         offset += 1;
5076         if (_Node.default.atDocumentBoundary(src, offset)) break;
5077
5078         const end = _Node.default.endOfBlockIndent(src, bi, offset); // should not include tab?
5079
5080
5081         if (end === null) break;
5082
5083         if (!this.blockIndent) {
5084           // no explicit block indent, none yet detected
5085           const lineIndent = end - (offset + indent);
5086
5087           if (src[end] !== '\n') {
5088             // first line with non-whitespace content
5089             if (lineIndent < minBlockIndent) {
5090               offset -= 1;
5091               break;
5092             }
5093
5094             this.blockIndent = lineIndent;
5095             bi = indent + this.blockIndent - 1;
5096           } else if (lineIndent > minBlockIndent) {
5097             // empty line with more whitespace
5098             minBlockIndent = lineIndent;
5099           }
5100         }
5101
5102         if (src[end] === '\n') {
5103           offset = end;
5104         } else {
5105           offset = valueEnd = _Node.default.endOfLine(src, end);
5106         }
5107       }
5108
5109       if (this.chomping !== Chomp.KEEP) {
5110         offset = src[valueEnd] ? valueEnd + 1 : valueEnd;
5111       }
5112
5113       this.valueRange = new _Range.default(start + 1, offset);
5114       return offset;
5115     }
5116     /**
5117      * Parses a block value from the source
5118      *
5119      * Accepted forms are:
5120      * ```
5121      * BS
5122      * block
5123      * lines
5124      *
5125      * BS #comment
5126      * block
5127      * lines
5128      * ```
5129      * where the block style BS matches the regexp `[|>][-+1-9]*` and block lines
5130      * are empty or have an indent level greater than `indent`.
5131      *
5132      * @param {ParseContext} context
5133      * @param {number} start - Index of first character
5134      * @returns {number} - Index of the character after this block
5135      */
5136
5137
5138     parse(context, start) {
5139       this.context = context;
5140       const {
5141         src
5142       } = context;
5143       let offset = this.parseBlockHeader(start);
5144       offset = _Node.default.endOfWhiteSpace(src, offset);
5145       offset = this.parseComment(offset);
5146       offset = this.parseBlockValue(offset);
5147       return offset;
5148     }
5149
5150     setOrigRanges(cr, offset) {
5151       offset = super.setOrigRanges(cr, offset);
5152       return this.header ? this.header.setOrigRange(cr, offset) : offset;
5153     }
5154
5155   }
5156
5157   exports.default = BlockValue;
5158 });
5159 unwrapExports(BlockValue_1);
5160 var BlockValue_2 = BlockValue_1.Chomp;
5161
5162 var FlowCollection_1 = createCommonjsModule(function (module, exports) {
5163
5164   Object.defineProperty(exports, "__esModule", {
5165     value: true
5166   });
5167   exports.default = void 0;
5168
5169   var _BlankLine = _interopRequireDefault(BlankLine_1);
5170
5171   var _Comment = _interopRequireDefault(Comment_1);
5172
5173   var _Node = _interopRequireDefault(Node_1);
5174
5175   var _Range = _interopRequireDefault(Range_1);
5176
5177   function _interopRequireDefault(obj) {
5178     return obj && obj.__esModule ? obj : {
5179       default: obj
5180     };
5181   }
5182
5183   class FlowCollection extends _Node.default {
5184     constructor(type, props) {
5185       super(type, props);
5186       this.items = null;
5187     }
5188
5189     prevNodeIsJsonLike(idx = this.items.length) {
5190       const node = this.items[idx - 1];
5191       return !!node && (node.jsonLike || node.type === constants.Type.COMMENT && this.nodeIsJsonLike(idx - 1));
5192     }
5193     /**
5194      * @param {ParseContext} context
5195      * @param {number} start - Index of first character
5196      * @returns {number} - Index of the character after this
5197      */
5198
5199
5200     parse(context, start) {
5201       this.context = context;
5202       const {
5203         parseNode,
5204         src
5205       } = context;
5206       let {
5207         indent,
5208         lineStart
5209       } = context;
5210       let char = src[start]; // { or [
5211
5212       this.items = [{
5213         char,
5214         offset: start
5215       }];
5216
5217       let offset = _Node.default.endOfWhiteSpace(src, start + 1);
5218
5219       char = src[offset];
5220
5221       while (char && char !== ']' && char !== '}') {
5222         switch (char) {
5223           case '\n':
5224             {
5225               lineStart = offset + 1;
5226
5227               const wsEnd = _Node.default.endOfWhiteSpace(src, lineStart);
5228
5229               if (src[wsEnd] === '\n') {
5230                 const blankLine = new _BlankLine.default();
5231                 lineStart = blankLine.parse({
5232                   src
5233                 }, lineStart);
5234                 this.items.push(blankLine);
5235               }
5236
5237               offset = _Node.default.endOfIndent(src, lineStart);
5238
5239               if (offset <= lineStart + indent) {
5240                 char = src[offset];
5241
5242                 if (offset < lineStart + indent || char !== ']' && char !== '}') {
5243                   const msg = 'Insufficient indentation in flow collection';
5244                   this.error = new errors.YAMLSemanticError(this, msg);
5245                 }
5246               }
5247             }
5248             break;
5249
5250           case ',':
5251             {
5252               this.items.push({
5253                 char,
5254                 offset
5255               });
5256               offset += 1;
5257             }
5258             break;
5259
5260           case '#':
5261             {
5262               const comment = new _Comment.default();
5263               offset = comment.parse({
5264                 src
5265               }, offset);
5266               this.items.push(comment);
5267             }
5268             break;
5269
5270           case '?':
5271           case ':':
5272             {
5273               const next = src[offset + 1];
5274
5275               if (next === '\n' || next === '\t' || next === ' ' || next === ',' || // in-flow : after JSON-like key does not need to be followed by whitespace
5276               char === ':' && this.prevNodeIsJsonLike()) {
5277                 this.items.push({
5278                   char,
5279                   offset
5280                 });
5281                 offset += 1;
5282                 break;
5283               }
5284             }
5285           // fallthrough
5286
5287           default:
5288             {
5289               const node = parseNode({
5290                 atLineStart: false,
5291                 inCollection: false,
5292                 inFlow: true,
5293                 indent: -1,
5294                 lineStart,
5295                 parent: this
5296               }, offset);
5297
5298               if (!node) {
5299                 // at next document start
5300                 this.valueRange = new _Range.default(start, offset);
5301                 return offset;
5302               }
5303
5304               this.items.push(node);
5305               offset = _Node.default.normalizeOffset(src, node.range.end);
5306             }
5307         }
5308
5309         offset = _Node.default.endOfWhiteSpace(src, offset);
5310         char = src[offset];
5311       }
5312
5313       this.valueRange = new _Range.default(start, offset + 1);
5314
5315       if (char) {
5316         this.items.push({
5317           char,
5318           offset
5319         });
5320         offset = _Node.default.endOfWhiteSpace(src, offset + 1);
5321         offset = this.parseComment(offset);
5322       }
5323
5324       return offset;
5325     }
5326
5327     setOrigRanges(cr, offset) {
5328       offset = super.setOrigRanges(cr, offset);
5329       this.items.forEach(node => {
5330         if (node instanceof _Node.default) {
5331           offset = node.setOrigRanges(cr, offset);
5332         } else if (cr.length === 0) {
5333           node.origOffset = node.offset;
5334         } else {
5335           let i = offset;
5336
5337           while (i < cr.length) {
5338             if (cr[i] > node.offset) break;else ++i;
5339           }
5340
5341           node.origOffset = node.offset + i;
5342           offset = i;
5343         }
5344       });
5345       return offset;
5346     }
5347
5348     toString() {
5349       const {
5350         context: {
5351           src
5352         },
5353         items,
5354         range,
5355         value
5356       } = this;
5357       if (value != null) return value;
5358       const nodes = items.filter(item => item instanceof _Node.default);
5359       let str = '';
5360       let prevEnd = range.start;
5361       nodes.forEach(node => {
5362         const prefix = src.slice(prevEnd, node.range.start);
5363         prevEnd = node.range.end;
5364         str += prefix + String(node);
5365
5366         if (str[str.length - 1] === '\n' && src[prevEnd - 1] !== '\n' && src[prevEnd] === '\n') {
5367           // Comment range does not include the terminal newline, but its
5368           // stringified value does. Without this fix, newlines at comment ends
5369           // get duplicated.
5370           prevEnd += 1;
5371         }
5372       });
5373       str += src.slice(prevEnd, range.end);
5374       return _Node.default.addStringTerminator(src, range.end, str);
5375     }
5376
5377   }
5378
5379   exports.default = FlowCollection;
5380 });
5381 unwrapExports(FlowCollection_1);
5382
5383 var PlainValue_1 = createCommonjsModule(function (module, exports) {
5384
5385   Object.defineProperty(exports, "__esModule", {
5386     value: true
5387   });
5388   exports.default = void 0;
5389
5390   var _Node = _interopRequireDefault(Node_1);
5391
5392   var _Range = _interopRequireDefault(Range_1);
5393
5394   function _interopRequireDefault(obj) {
5395     return obj && obj.__esModule ? obj : {
5396       default: obj
5397     };
5398   }
5399
5400   class PlainValue extends _Node.default {
5401     static endOfLine(src, start, inFlow) {
5402       let ch = src[start];
5403       let offset = start;
5404
5405       while (ch && ch !== '\n') {
5406         if (inFlow && (ch === '[' || ch === ']' || ch === '{' || ch === '}' || ch === ',')) break;
5407         const next = src[offset + 1];
5408         if (ch === ':' && (!next || next === '\n' || next === '\t' || next === ' ' || inFlow && next === ',')) break;
5409         if ((ch === ' ' || ch === '\t') && next === '#') break;
5410         offset += 1;
5411         ch = next;
5412       }
5413
5414       return offset;
5415     }
5416
5417     get strValue() {
5418       if (!this.valueRange || !this.context) return null;
5419       let {
5420         start,
5421         end
5422       } = this.valueRange;
5423       const {
5424         src
5425       } = this.context;
5426       let ch = src[end - 1];
5427
5428       while (start < end && (ch === '\n' || ch === '\t' || ch === ' ')) ch = src[--end - 1];
5429
5430       ch = src[start];
5431
5432       while (start < end && (ch === '\n' || ch === '\t' || ch === ' ')) ch = src[++start];
5433
5434       let str = '';
5435
5436       for (let i = start; i < end; ++i) {
5437         const ch = src[i];
5438
5439         if (ch === '\n') {
5440           const {
5441             fold,
5442             offset
5443           } = _Node.default.foldNewline(src, i, -1);
5444
5445           str += fold;
5446           i = offset;
5447         } else if (ch === ' ' || ch === '\t') {
5448           // trim trailing whitespace
5449           const wsStart = i;
5450           let next = src[i + 1];
5451
5452           while (i < end && (next === ' ' || next === '\t')) {
5453             i += 1;
5454             next = src[i + 1];
5455           }
5456
5457           if (next !== '\n') str += i > wsStart ? src.slice(wsStart, i + 1) : ch;
5458         } else {
5459           str += ch;
5460         }
5461       }
5462
5463       return str;
5464     }
5465
5466     parseBlockValue(start) {
5467       const {
5468         indent,
5469         inFlow,
5470         src
5471       } = this.context;
5472       let offset = start;
5473       let valueEnd = start;
5474
5475       for (let ch = src[offset]; ch === '\n'; ch = src[offset]) {
5476         if (_Node.default.atDocumentBoundary(src, offset + 1)) break;
5477
5478         const end = _Node.default.endOfBlockIndent(src, indent, offset + 1);
5479
5480         if (end === null || src[end] === '#') break;
5481
5482         if (src[end] === '\n') {
5483           offset = end;
5484         } else {
5485           valueEnd = PlainValue.endOfLine(src, end, inFlow);
5486           offset = valueEnd;
5487         }
5488       }
5489
5490       if (this.valueRange.isEmpty()) this.valueRange.start = start;
5491       this.valueRange.end = valueEnd;
5492       return valueEnd;
5493     }
5494     /**
5495      * Parses a plain value from the source
5496      *
5497      * Accepted forms are:
5498      * ```
5499      * #comment
5500      *
5501      * first line
5502      *
5503      * first line #comment
5504      *
5505      * first line
5506      * block
5507      * lines
5508      *
5509      * #comment
5510      * block
5511      * lines
5512      * ```
5513      * where block lines are empty or have an indent level greater than `indent`.
5514      *
5515      * @param {ParseContext} context
5516      * @param {number} start - Index of first character
5517      * @returns {number} - Index of the character after this scalar, may be `\n`
5518      */
5519
5520
5521     parse(context, start) {
5522       this.context = context;
5523       const {
5524         inFlow,
5525         src
5526       } = context;
5527       let offset = start;
5528       const ch = src[offset];
5529
5530       if (ch && ch !== '#' && ch !== '\n') {
5531         offset = PlainValue.endOfLine(src, start, inFlow);
5532       }
5533
5534       this.valueRange = new _Range.default(start, offset);
5535       offset = _Node.default.endOfWhiteSpace(src, offset);
5536       offset = this.parseComment(offset);
5537
5538       if (!this.hasComment || this.valueRange.isEmpty()) {
5539         offset = this.parseBlockValue(offset);
5540       }
5541
5542       return offset;
5543     }
5544
5545   }
5546
5547   exports.default = PlainValue;
5548 });
5549 unwrapExports(PlainValue_1);
5550
5551 var QuoteDouble_1 = createCommonjsModule(function (module, exports) {
5552
5553   Object.defineProperty(exports, "__esModule", {
5554     value: true
5555   });
5556   exports.default = void 0;
5557
5558   var _Node = _interopRequireDefault(Node_1);
5559
5560   var _Range = _interopRequireDefault(Range_1);
5561
5562   function _interopRequireDefault(obj) {
5563     return obj && obj.__esModule ? obj : {
5564       default: obj
5565     };
5566   }
5567
5568   class QuoteDouble extends _Node.default {
5569     static endOfQuote(src, offset) {
5570       let ch = src[offset];
5571
5572       while (ch && ch !== '"') {
5573         offset += ch === '\\' ? 2 : 1;
5574         ch = src[offset];
5575       }
5576
5577       return offset + 1;
5578     }
5579     /**
5580      * @returns {string | { str: string, errors: YAMLSyntaxError[] }}
5581      */
5582
5583
5584     get strValue() {
5585       if (!this.valueRange || !this.context) return null;
5586       const errors$1 = [];
5587       const {
5588         start,
5589         end
5590       } = this.valueRange;
5591       const {
5592         indent,
5593         src
5594       } = this.context;
5595       if (src[end - 1] !== '"') errors$1.push(new errors.YAMLSyntaxError(this, 'Missing closing "quote')); // Using String#replace is too painful with escaped newlines preceded by
5596       // escaped backslashes; also, this should be faster.
5597
5598       let str = '';
5599
5600       for (let i = start + 1; i < end - 1; ++i) {
5601         const ch = src[i];
5602
5603         if (ch === '\n') {
5604           if (_Node.default.atDocumentBoundary(src, i + 1)) errors$1.push(new errors.YAMLSemanticError(this, 'Document boundary indicators are not allowed within string values'));
5605
5606           const {
5607             fold,
5608             offset,
5609             error
5610           } = _Node.default.foldNewline(src, i, indent);
5611
5612           str += fold;
5613           i = offset;
5614           if (error) errors$1.push(new errors.YAMLSemanticError(this, 'Multi-line double-quoted string needs to be sufficiently indented'));
5615         } else if (ch === '\\') {
5616           i += 1;
5617
5618           switch (src[i]) {
5619             case '0':
5620               str += '\0';
5621               break;
5622             // null character
5623
5624             case 'a':
5625               str += '\x07';
5626               break;
5627             // bell character
5628
5629             case 'b':
5630               str += '\b';
5631               break;
5632             // backspace
5633
5634             case 'e':
5635               str += '\x1b';
5636               break;
5637             // escape character
5638
5639             case 'f':
5640               str += '\f';
5641               break;
5642             // form feed
5643
5644             case 'n':
5645               str += '\n';
5646               break;
5647             // line feed
5648
5649             case 'r':
5650               str += '\r';
5651               break;
5652             // carriage return
5653
5654             case 't':
5655               str += '\t';
5656               break;
5657             // horizontal tab
5658
5659             case 'v':
5660               str += '\v';
5661               break;
5662             // vertical tab
5663
5664             case 'N':
5665               str += '\u0085';
5666               break;
5667             // Unicode next line
5668
5669             case '_':
5670               str += '\u00a0';
5671               break;
5672             // Unicode non-breaking space
5673
5674             case 'L':
5675               str += '\u2028';
5676               break;
5677             // Unicode line separator
5678
5679             case 'P':
5680               str += '\u2029';
5681               break;
5682             // Unicode paragraph separator
5683
5684             case ' ':
5685               str += ' ';
5686               break;
5687
5688             case '"':
5689               str += '"';
5690               break;
5691
5692             case '/':
5693               str += '/';
5694               break;
5695
5696             case '\\':
5697               str += '\\';
5698               break;
5699
5700             case '\t':
5701               str += '\t';
5702               break;
5703
5704             case 'x':
5705               str += this.parseCharCode(i + 1, 2, errors$1);
5706               i += 2;
5707               break;
5708
5709             case 'u':
5710               str += this.parseCharCode(i + 1, 4, errors$1);
5711               i += 4;
5712               break;
5713
5714             case 'U':
5715               str += this.parseCharCode(i + 1, 8, errors$1);
5716               i += 8;
5717               break;
5718
5719             case '\n':
5720               // skip escaped newlines, but still trim the following line
5721               while (src[i + 1] === ' ' || src[i + 1] === '\t') i += 1;
5722
5723               break;
5724
5725             default:
5726               errors$1.push(new errors.YAMLSyntaxError(this, `Invalid escape sequence ${src.substr(i - 1, 2)}`));
5727               str += '\\' + src[i];
5728           }
5729         } else if (ch === ' ' || ch === '\t') {
5730           // trim trailing whitespace
5731           const wsStart = i;
5732           let next = src[i + 1];
5733
5734           while (next === ' ' || next === '\t') {
5735             i += 1;
5736             next = src[i + 1];
5737           }
5738
5739           if (next !== '\n') str += i > wsStart ? src.slice(wsStart, i + 1) : ch;
5740         } else {
5741           str += ch;
5742         }
5743       }
5744
5745       return errors$1.length > 0 ? {
5746         errors: errors$1,
5747         str
5748       } : str;
5749     }
5750
5751     parseCharCode(offset, length, errors$1) {
5752       const {
5753         src
5754       } = this.context;
5755       const cc = src.substr(offset, length);
5756       const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
5757       const code = ok ? parseInt(cc, 16) : NaN;
5758
5759       if (isNaN(code)) {
5760         errors$1.push(new errors.YAMLSyntaxError(this, `Invalid escape sequence ${src.substr(offset - 2, length + 2)}`));
5761         return src.substr(offset - 2, length + 2);
5762       }
5763
5764       return String.fromCodePoint(code);
5765     }
5766     /**
5767      * Parses a "double quoted" value from the source
5768      *
5769      * @param {ParseContext} context
5770      * @param {number} start - Index of first character
5771      * @returns {number} - Index of the character after this scalar
5772      */
5773
5774
5775     parse(context, start) {
5776       this.context = context;
5777       const {
5778         src
5779       } = context;
5780       let offset = QuoteDouble.endOfQuote(src, start + 1);
5781       this.valueRange = new _Range.default(start, offset);
5782       offset = _Node.default.endOfWhiteSpace(src, offset);
5783       offset = this.parseComment(offset);
5784       return offset;
5785     }
5786
5787   }
5788
5789   exports.default = QuoteDouble;
5790 });
5791 unwrapExports(QuoteDouble_1);
5792
5793 var QuoteSingle_1 = createCommonjsModule(function (module, exports) {
5794
5795   Object.defineProperty(exports, "__esModule", {
5796     value: true
5797   });
5798   exports.default = void 0;
5799
5800   var _Node = _interopRequireDefault(Node_1);
5801
5802   var _Range = _interopRequireDefault(Range_1);
5803
5804   function _interopRequireDefault(obj) {
5805     return obj && obj.__esModule ? obj : {
5806       default: obj
5807     };
5808   }
5809
5810   class QuoteSingle extends _Node.default {
5811     static endOfQuote(src, offset) {
5812       let ch = src[offset];
5813
5814       while (ch) {
5815         if (ch === "'") {
5816           if (src[offset + 1] !== "'") break;
5817           ch = src[offset += 2];
5818         } else {
5819           ch = src[offset += 1];
5820         }
5821       }
5822
5823       return offset + 1;
5824     }
5825     /**
5826      * @returns {string | { str: string, errors: YAMLSyntaxError[] }}
5827      */
5828
5829
5830     get strValue() {
5831       if (!this.valueRange || !this.context) return null;
5832       const errors$1 = [];
5833       const {
5834         start,
5835         end
5836       } = this.valueRange;
5837       const {
5838         indent,
5839         src
5840       } = this.context;
5841       if (src[end - 1] !== "'") errors$1.push(new errors.YAMLSyntaxError(this, "Missing closing 'quote"));
5842       let str = '';
5843
5844       for (let i = start + 1; i < end - 1; ++i) {
5845         const ch = src[i];
5846
5847         if (ch === '\n') {
5848           if (_Node.default.atDocumentBoundary(src, i + 1)) errors$1.push(new errors.YAMLSemanticError(this, 'Document boundary indicators are not allowed within string values'));
5849
5850           const {
5851             fold,
5852             offset,
5853             error
5854           } = _Node.default.foldNewline(src, i, indent);
5855
5856           str += fold;
5857           i = offset;
5858           if (error) errors$1.push(new errors.YAMLSemanticError(this, 'Multi-line single-quoted string needs to be sufficiently indented'));
5859         } else if (ch === "'") {
5860           str += ch;
5861           i += 1;
5862           if (src[i] !== "'") errors$1.push(new errors.YAMLSyntaxError(this, 'Unescaped single quote? This should not happen.'));
5863         } else if (ch === ' ' || ch === '\t') {
5864           // trim trailing whitespace
5865           const wsStart = i;
5866           let next = src[i + 1];
5867
5868           while (next === ' ' || next === '\t') {
5869             i += 1;
5870             next = src[i + 1];
5871           }
5872
5873           if (next !== '\n') str += i > wsStart ? src.slice(wsStart, i + 1) : ch;
5874         } else {
5875           str += ch;
5876         }
5877       }
5878
5879       return errors$1.length > 0 ? {
5880         errors: errors$1,
5881         str
5882       } : str;
5883     }
5884     /**
5885      * Parses a 'single quoted' value from the source
5886      *
5887      * @param {ParseContext} context
5888      * @param {number} start - Index of first character
5889      * @returns {number} - Index of the character after this scalar
5890      */
5891
5892
5893     parse(context, start) {
5894       this.context = context;
5895       const {
5896         src
5897       } = context;
5898       let offset = QuoteSingle.endOfQuote(src, start + 1);
5899       this.valueRange = new _Range.default(start, offset);
5900       offset = _Node.default.endOfWhiteSpace(src, offset);
5901       offset = this.parseComment(offset);
5902       return offset;
5903     }
5904
5905   }
5906
5907   exports.default = QuoteSingle;
5908 });
5909 unwrapExports(QuoteSingle_1);
5910
5911 var ParseContext_1 = createCommonjsModule(function (module, exports) {
5912
5913   Object.defineProperty(exports, "__esModule", {
5914     value: true
5915   });
5916   exports.default = void 0;
5917
5918   var _Alias = _interopRequireDefault(Alias_1);
5919
5920   var _BlockValue = _interopRequireDefault(BlockValue_1);
5921
5922   var _Collection = _interopRequireDefault(Collection_1);
5923
5924   var _CollectionItem = _interopRequireDefault(CollectionItem_1);
5925
5926   var _FlowCollection = _interopRequireDefault(FlowCollection_1);
5927
5928   var _Node = _interopRequireDefault(Node_1);
5929
5930   var _PlainValue = _interopRequireDefault(PlainValue_1);
5931
5932   var _QuoteDouble = _interopRequireDefault(QuoteDouble_1);
5933
5934   var _QuoteSingle = _interopRequireDefault(QuoteSingle_1);
5935
5936   var _Range = _interopRequireDefault(Range_1);
5937
5938   function _interopRequireDefault(obj) {
5939     return obj && obj.__esModule ? obj : {
5940       default: obj
5941     };
5942   }
5943
5944   function _defineProperty(obj, key, value) {
5945     if (key in obj) {
5946       Object.defineProperty(obj, key, {
5947         value: value,
5948         enumerable: true,
5949         configurable: true,
5950         writable: true
5951       });
5952     } else {
5953       obj[key] = value;
5954     }
5955
5956     return obj;
5957   }
5958
5959   function createNewNode(type, props) {
5960     switch (type) {
5961       case constants.Type.ALIAS:
5962         return new _Alias.default(type, props);
5963
5964       case constants.Type.BLOCK_FOLDED:
5965       case constants.Type.BLOCK_LITERAL:
5966         return new _BlockValue.default(type, props);
5967
5968       case constants.Type.FLOW_MAP:
5969       case constants.Type.FLOW_SEQ:
5970         return new _FlowCollection.default(type, props);
5971
5972       case constants.Type.MAP_KEY:
5973       case constants.Type.MAP_VALUE:
5974       case constants.Type.SEQ_ITEM:
5975         return new _CollectionItem.default(type, props);
5976
5977       case constants.Type.COMMENT:
5978       case constants.Type.PLAIN:
5979         return new _PlainValue.default(type, props);
5980
5981       case constants.Type.QUOTE_DOUBLE:
5982         return new _QuoteDouble.default(type, props);
5983
5984       case constants.Type.QUOTE_SINGLE:
5985         return new _QuoteSingle.default(type, props);
5986
5987       /* istanbul ignore next */
5988
5989       default:
5990         return null;
5991       // should never happen
5992     }
5993   }
5994   /**
5995    * @param {boolean} atLineStart - Node starts at beginning of line
5996    * @param {boolean} inFlow - true if currently in a flow context
5997    * @param {boolean} inCollection - true if currently in a collection context
5998    * @param {number} indent - Current level of indentation
5999    * @param {number} lineStart - Start of the current line
6000    * @param {Node} parent - The parent of the node
6001    * @param {string} src - Source of the YAML document
6002    */
6003
6004
6005   class ParseContext {
6006     static parseType(src, offset, inFlow) {
6007       switch (src[offset]) {
6008         case '*':
6009           return constants.Type.ALIAS;
6010
6011         case '>':
6012           return constants.Type.BLOCK_FOLDED;
6013
6014         case '|':
6015           return constants.Type.BLOCK_LITERAL;
6016
6017         case '{':
6018           return constants.Type.FLOW_MAP;
6019
6020         case '[':
6021           return constants.Type.FLOW_SEQ;
6022
6023         case '?':
6024           return !inFlow && _Node.default.atBlank(src, offset + 1, true) ? constants.Type.MAP_KEY : constants.Type.PLAIN;
6025
6026         case ':':
6027           return !inFlow && _Node.default.atBlank(src, offset + 1, true) ? constants.Type.MAP_VALUE : constants.Type.PLAIN;
6028
6029         case '-':
6030           return !inFlow && _Node.default.atBlank(src, offset + 1, true) ? constants.Type.SEQ_ITEM : constants.Type.PLAIN;
6031
6032         case '"':
6033           return constants.Type.QUOTE_DOUBLE;
6034
6035         case "'":
6036           return constants.Type.QUOTE_SINGLE;
6037
6038         default:
6039           return constants.Type.PLAIN;
6040       }
6041     }
6042
6043     constructor(orig = {}, {
6044       atLineStart,
6045       inCollection,
6046       inFlow,
6047       indent,
6048       lineStart,
6049       parent
6050     } = {}) {
6051       _defineProperty(this, "parseNode", (overlay, start) => {
6052         if (_Node.default.atDocumentBoundary(this.src, start)) return null;
6053         const context = new ParseContext(this, overlay);
6054         const {
6055           props,
6056           type,
6057           valueStart
6058         } = context.parseProps(start);
6059         const node = createNewNode(type, props);
6060         let offset = node.parse(context, valueStart);
6061         node.range = new _Range.default(start, offset);
6062         /* istanbul ignore if */
6063
6064         if (offset <= start) {
6065           // This should never happen, but if it does, let's make sure to at least
6066           // step one character forward to avoid a busy loop.
6067           node.error = new Error(`Node#parse consumed no characters`);
6068           node.error.parseEnd = offset;
6069           node.error.source = node;
6070           node.range.end = start + 1;
6071         }
6072
6073         if (context.nodeStartsCollection(node)) {
6074           if (!node.error && !context.atLineStart && context.parent.type === constants.Type.DOCUMENT) {
6075             node.error = new errors.YAMLSyntaxError(node, 'Block collection must not have preceding content here (e.g. directives-end indicator)');
6076           }
6077
6078           const collection = new _Collection.default(node);
6079           offset = collection.parse(new ParseContext(context), offset);
6080           collection.range = new _Range.default(start, offset);
6081           return collection;
6082         }
6083
6084         return node;
6085       });
6086
6087       this.atLineStart = atLineStart != null ? atLineStart : orig.atLineStart || false;
6088       this.inCollection = inCollection != null ? inCollection : orig.inCollection || false;
6089       this.inFlow = inFlow != null ? inFlow : orig.inFlow || false;
6090       this.indent = indent != null ? indent : orig.indent;
6091       this.lineStart = lineStart != null ? lineStart : orig.lineStart;
6092       this.parent = parent != null ? parent : orig.parent || {};
6093       this.root = orig.root;
6094       this.src = orig.src;
6095     }
6096
6097     nodeStartsCollection(node) {
6098       const {
6099         inCollection,
6100         inFlow,
6101         src
6102       } = this;
6103       if (inCollection || inFlow) return false;
6104       if (node instanceof _CollectionItem.default) return true; // check for implicit key
6105
6106       let offset = node.range.end;
6107       if (src[offset] === '\n' || src[offset - 1] === '\n') return false;
6108       offset = _Node.default.endOfWhiteSpace(src, offset);
6109       return src[offset] === ':';
6110     } // Anchor and tag are before type, which determines the node implementation
6111     // class; hence this intermediate step.
6112
6113
6114     parseProps(offset) {
6115       const {
6116         inFlow,
6117         parent,
6118         src
6119       } = this;
6120       const props = [];
6121       let lineHasProps = false;
6122       offset = _Node.default.endOfWhiteSpace(src, offset);
6123       let ch = src[offset];
6124
6125       while (ch === constants.Char.ANCHOR || ch === constants.Char.COMMENT || ch === constants.Char.TAG || ch === '\n') {
6126         if (ch === '\n') {
6127           const lineStart = offset + 1;
6128
6129           const inEnd = _Node.default.endOfIndent(src, lineStart);
6130
6131           const indentDiff = inEnd - (lineStart + this.indent);
6132           const noIndicatorAsIndent = parent.type === constants.Type.SEQ_ITEM && parent.context.atLineStart;
6133           if (!_Node.default.nextNodeIsIndented(src[inEnd], indentDiff, !noIndicatorAsIndent)) break;
6134           this.atLineStart = true;
6135           this.lineStart = lineStart;
6136           lineHasProps = false;
6137           offset = inEnd;
6138         } else if (ch === constants.Char.COMMENT) {
6139           const end = _Node.default.endOfLine(src, offset + 1);
6140
6141           props.push(new _Range.default(offset, end));
6142           offset = end;
6143         } else {
6144           let end = _Node.default.endOfIdentifier(src, offset + 1);
6145
6146           if (ch === constants.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))) {
6147             // Let's presume we're dealing with a YAML 1.0 domain tag here, rather
6148             // than an empty but 'foo.bar' private-tagged node in a flow collection
6149             // followed without whitespace by a plain string starting with a year
6150             // or date divided by something.
6151             end = _Node.default.endOfIdentifier(src, end + 5);
6152           }
6153
6154           props.push(new _Range.default(offset, end));
6155           lineHasProps = true;
6156           offset = _Node.default.endOfWhiteSpace(src, end);
6157         }
6158
6159         ch = src[offset];
6160       } // '- &a : b' has an anchor on an empty node
6161
6162
6163       if (lineHasProps && ch === ':' && _Node.default.atBlank(src, offset + 1, true)) offset -= 1;
6164       const type = ParseContext.parseType(src, offset, inFlow);
6165       return {
6166         props,
6167         type,
6168         valueStart: offset
6169       };
6170     }
6171     /**
6172      * Parses a node from the source
6173      * @param {ParseContext} overlay
6174      * @param {number} start - Index of first non-whitespace character for the node
6175      * @returns {?Node} - null if at a document boundary
6176      */
6177
6178
6179   }
6180
6181   exports.default = ParseContext;
6182 });
6183 unwrapExports(ParseContext_1);
6184
6185 var parse_1 = createCommonjsModule(function (module, exports) {
6186
6187   Object.defineProperty(exports, "__esModule", {
6188     value: true
6189   });
6190   exports.default = parse;
6191
6192   var _Document = _interopRequireDefault(Document_1);
6193
6194   var _ParseContext = _interopRequireDefault(ParseContext_1);
6195
6196   function _interopRequireDefault(obj) {
6197     return obj && obj.__esModule ? obj : {
6198       default: obj
6199     };
6200   } // Published as 'yaml/parse-cst'
6201
6202
6203   function parse(src) {
6204     const cr = [];
6205
6206     if (src.indexOf('\r') !== -1) {
6207       src = src.replace(/\r\n?/g, (match, offset) => {
6208         if (match.length > 1) cr.push(offset);
6209         return '\n';
6210       });
6211     }
6212
6213     const documents = [];
6214     let offset = 0;
6215
6216     do {
6217       const doc = new _Document.default();
6218       const context = new _ParseContext.default({
6219         src
6220       });
6221       offset = doc.parse(context, offset);
6222       documents.push(doc);
6223     } while (offset < src.length);
6224
6225     documents.setOrigRanges = () => {
6226       if (cr.length === 0) return false;
6227
6228       for (let i = 1; i < cr.length; ++i) cr[i] -= i;
6229
6230       let crOffset = 0;
6231
6232       for (let i = 0; i < documents.length; ++i) {
6233         crOffset = documents[i].setOrigRanges(cr, crOffset);
6234       }
6235
6236       cr.splice(0, cr.length);
6237       return true;
6238     };
6239
6240     documents.toString = () => documents.join('...\n');
6241
6242     return documents;
6243   }
6244 });
6245 unwrapExports(parse_1);
6246
6247 var addComment_1 = createCommonjsModule(function (module, exports) {
6248
6249   Object.defineProperty(exports, "__esModule", {
6250     value: true
6251   });
6252   exports.addCommentBefore = addCommentBefore;
6253   exports.default = addComment;
6254
6255   function addCommentBefore(str, indent, comment) {
6256     if (!comment) return str;
6257     const cc = comment.replace(/[\s\S]^/gm, `$&${indent}#`);
6258     return `#${cc}\n${indent}${str}`;
6259   }
6260
6261   function addComment(str, indent, comment) {
6262     return !comment ? str : comment.indexOf('\n') === -1 ? `${str} #${comment}` : `${str}\n` + comment.replace(/^/gm, `${indent || ''}#`);
6263   }
6264 });
6265 unwrapExports(addComment_1);
6266 var addComment_2 = addComment_1.addCommentBefore;
6267
6268 var toJSON_1 = createCommonjsModule(function (module, exports) {
6269
6270   Object.defineProperty(exports, "__esModule", {
6271     value: true
6272   });
6273   exports.default = toJSON;
6274
6275   function toJSON(value, arg, ctx) {
6276     if (Array.isArray(value)) return value.map((v, i) => toJSON(v, String(i), ctx));
6277
6278     if (value && typeof value.toJSON === 'function') {
6279       const anchor = ctx && ctx.anchors && ctx.anchors.find(a => a.node === value);
6280       if (anchor) ctx.onCreate = res => {
6281         anchor.res = res;
6282         delete ctx.onCreate;
6283       };
6284       const res = value.toJSON(arg, ctx);
6285       if (anchor && ctx.onCreate) ctx.onCreate(res);
6286       return res;
6287     }
6288
6289     return value;
6290   }
6291 });
6292 unwrapExports(toJSON_1);
6293
6294 var Node_1$1 = createCommonjsModule(function (module, exports) {
6295
6296   Object.defineProperty(exports, "__esModule", {
6297     value: true
6298   });
6299   exports.default = void 0;
6300
6301   class Node {}
6302
6303   exports.default = Node;
6304 });
6305 unwrapExports(Node_1$1);
6306
6307 var Scalar_1 = createCommonjsModule(function (module, exports) {
6308
6309   Object.defineProperty(exports, "__esModule", {
6310     value: true
6311   });
6312   exports.default = void 0;
6313
6314   var _toJSON = _interopRequireDefault(toJSON_1);
6315
6316   var _Node = _interopRequireDefault(Node_1$1);
6317
6318   function _interopRequireDefault(obj) {
6319     return obj && obj.__esModule ? obj : {
6320       default: obj
6321     };
6322   } // Published as 'yaml/scalar'
6323
6324
6325   class Scalar extends _Node.default {
6326     constructor(value) {
6327       super();
6328       this.value = value;
6329     }
6330
6331     toJSON(arg, ctx) {
6332       return ctx && ctx.keep ? this.value : (0, _toJSON.default)(this.value, arg, ctx);
6333     }
6334
6335     toString() {
6336       return String(this.value);
6337     }
6338
6339   }
6340
6341   exports.default = Scalar;
6342 });
6343 unwrapExports(Scalar_1);
6344
6345 var Pair_1 = createCommonjsModule(function (module, exports) {
6346
6347   Object.defineProperty(exports, "__esModule", {
6348     value: true
6349   });
6350   exports.default = void 0;
6351
6352   var _addComment = _interopRequireDefault(addComment_1);
6353
6354   var _toJSON = _interopRequireDefault(toJSON_1);
6355
6356   var _Collection = _interopRequireDefault(Collection_1$1);
6357
6358   var _Node = _interopRequireDefault(Node_1$1);
6359
6360   var _Scalar = _interopRequireDefault(Scalar_1);
6361
6362   function _interopRequireDefault(obj) {
6363     return obj && obj.__esModule ? obj : {
6364       default: obj
6365     };
6366   } // Published as 'yaml/pair'
6367
6368
6369   const stringifyKey = (key, jsKey, ctx) => {
6370     if (jsKey === null) return '';
6371     if (typeof jsKey !== 'object') return String(jsKey);
6372     if (key instanceof _Node.default && ctx && ctx.doc) return key.toString({
6373       anchors: {},
6374       doc: ctx.doc,
6375       indent: '',
6376       inFlow: true,
6377       inStringifyKey: true
6378     });
6379     return JSON.stringify(jsKey);
6380   };
6381
6382   class Pair extends _Node.default {
6383     constructor(key, value = null) {
6384       super();
6385       this.key = key;
6386       this.value = value;
6387       this.type = 'PAIR';
6388     }
6389
6390     get commentBefore() {
6391       return this.key && this.key.commentBefore;
6392     }
6393
6394     set commentBefore(cb) {
6395       if (this.key == null) this.key = new _Scalar.default(null);
6396       this.key.commentBefore = cb;
6397     }
6398
6399     addToJSMap(ctx, map) {
6400       const key = (0, _toJSON.default)(this.key, '', ctx);
6401
6402       if (map instanceof Map) {
6403         const value = (0, _toJSON.default)(this.value, key, ctx);
6404         map.set(key, value);
6405       } else if (map instanceof Set) {
6406         map.add(key);
6407       } else {
6408         const stringKey = stringifyKey(this.key, key, ctx);
6409         map[stringKey] = (0, _toJSON.default)(this.value, stringKey, ctx);
6410       }
6411
6412       return map;
6413     }
6414
6415     toJSON(_, ctx) {
6416       const pair = ctx && ctx.mapAsMap ? new Map() : {};
6417       return this.addToJSMap(ctx, pair);
6418     }
6419
6420     toString(ctx, onComment, onChompKeep) {
6421       if (!ctx || !ctx.doc) return JSON.stringify(this);
6422       const {
6423         simpleKeys
6424       } = ctx.doc.options;
6425       let {
6426         key,
6427         value
6428       } = this;
6429       let keyComment = key instanceof _Node.default && key.comment;
6430
6431       if (simpleKeys) {
6432         if (keyComment) {
6433           throw new Error('With simple keys, key nodes cannot have comments');
6434         }
6435
6436         if (key instanceof _Collection.default) {
6437           const msg = 'With simple keys, collection cannot be used as a key value';
6438           throw new Error(msg);
6439         }
6440       }
6441
6442       const explicitKey = !simpleKeys && (!key || keyComment || key instanceof _Collection.default || key.type === constants.Type.BLOCK_FOLDED || key.type === constants.Type.BLOCK_LITERAL);
6443       const {
6444         doc,
6445         indent
6446       } = ctx;
6447       ctx = Object.assign({}, ctx, {
6448         implicitKey: !explicitKey,
6449         indent: indent + '  '
6450       });
6451       let chompKeep = false;
6452       let str = doc.schema.stringify(key, ctx, () => keyComment = null, () => chompKeep = true);
6453       str = (0, _addComment.default)(str, ctx.indent, keyComment);
6454
6455       if (ctx.allNullValues && !simpleKeys) {
6456         if (this.comment) {
6457           str = (0, _addComment.default)(str, ctx.indent, this.comment);
6458           if (onComment) onComment();
6459         } else if (chompKeep && !keyComment && onChompKeep) onChompKeep();
6460
6461         return ctx.inFlow ? str : `? ${str}`;
6462       }
6463
6464       str = explicitKey ? `? ${str}\n${indent}:` : `${str}:`;
6465
6466       if (this.comment) {
6467         // expected (but not strictly required) to be a single-line comment
6468         str = (0, _addComment.default)(str, ctx.indent, this.comment);
6469         if (onComment) onComment();
6470       }
6471
6472       let vcb = '';
6473       let valueComment = null;
6474
6475       if (value instanceof _Node.default) {
6476         if (value.spaceBefore) vcb = '\n';
6477
6478         if (value.commentBefore) {
6479           const cs = value.commentBefore.replace(/^/gm, `${ctx.indent}#`);
6480           vcb += `\n${cs}`;
6481         }
6482
6483         valueComment = value.comment;
6484       } else if (value && typeof value === 'object') {
6485         value = doc.schema.createNode(value, true);
6486       }
6487
6488       ctx.implicitKey = false;
6489       if (!explicitKey && !this.comment && value instanceof _Scalar.default) ctx.indentAtStart = str.length + 1;
6490       chompKeep = false;
6491       const valueStr = doc.schema.stringify(value, ctx, () => valueComment = null, () => chompKeep = true);
6492       let ws = ' ';
6493
6494       if (vcb || this.comment) {
6495         ws = `${vcb}\n${ctx.indent}`;
6496       } else if (!explicitKey && value instanceof _Collection.default) {
6497         const flow = valueStr[0] === '[' || valueStr[0] === '{';
6498         if (!flow || valueStr.includes('\n')) ws = `\n${ctx.indent}`;
6499       }
6500
6501       if (chompKeep && !valueComment && onChompKeep) onChompKeep();
6502       return (0, _addComment.default)(str + ws + valueStr, ctx.indent, valueComment);
6503     }
6504
6505   }
6506
6507   exports.default = Pair;
6508 });
6509 unwrapExports(Pair_1);
6510
6511 var Collection_1$1 = createCommonjsModule(function (module, exports) {
6512
6513   Object.defineProperty(exports, "__esModule", {
6514     value: true
6515   });
6516   exports.default = exports.isEmptyPath = void 0;
6517
6518   var _addComment = _interopRequireDefault(addComment_1);
6519
6520   var _Node = _interopRequireDefault(Node_1$1);
6521
6522   var _Pair = _interopRequireDefault(Pair_1);
6523
6524   var _Scalar = _interopRequireDefault(Scalar_1);
6525
6526   function _interopRequireDefault(obj) {
6527     return obj && obj.__esModule ? obj : {
6528       default: obj
6529     };
6530   }
6531
6532   function _defineProperty(obj, key, value) {
6533     if (key in obj) {
6534       Object.defineProperty(obj, key, {
6535         value: value,
6536         enumerable: true,
6537         configurable: true,
6538         writable: true
6539       });
6540     } else {
6541       obj[key] = value;
6542     }
6543
6544     return obj;
6545   }
6546
6547   function collectionFromPath(schema, path, value) {
6548     let v = value;
6549
6550     for (let i = path.length - 1; i >= 0; --i) {
6551       const k = path[i];
6552       const o = Number.isInteger(k) && k >= 0 ? [] : {};
6553       o[k] = v;
6554       v = o;
6555     }
6556
6557     return schema.createNode(v, false);
6558   } // null, undefined, or an empty non-string iterable (e.g. [])
6559
6560
6561   const isEmptyPath = path => path == null || typeof path === 'object' && path[Symbol.iterator]().next().done;
6562
6563   exports.isEmptyPath = isEmptyPath;
6564
6565   class Collection extends _Node.default {
6566     constructor(schema) {
6567       super();
6568
6569       _defineProperty(this, "items", []);
6570
6571       this.schema = schema;
6572     }
6573
6574     addIn(path, value) {
6575       if (isEmptyPath(path)) this.add(value);else {
6576         const [key, ...rest] = path;
6577         const node = this.get(key, true);
6578         if (node instanceof Collection) node.addIn(rest, value);else if (node === undefined && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
6579       }
6580     }
6581
6582     deleteIn([key, ...rest]) {
6583       if (rest.length === 0) return this.delete(key);
6584       const node = this.get(key, true);
6585       if (node instanceof Collection) return node.deleteIn(rest);else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
6586     }
6587
6588     getIn([key, ...rest], keepScalar) {
6589       const node = this.get(key, true);
6590       if (rest.length === 0) return !keepScalar && node instanceof _Scalar.default ? node.value : node;else return node instanceof Collection ? node.getIn(rest, keepScalar) : undefined;
6591     }
6592
6593     hasAllNullValues() {
6594       return this.items.every(node => {
6595         if (!(node instanceof _Pair.default)) return false;
6596         const n = node.value;
6597         return n == null || n instanceof _Scalar.default && n.value == null && !n.commentBefore && !n.comment && !n.tag;
6598       });
6599     }
6600
6601     hasIn([key, ...rest]) {
6602       if (rest.length === 0) return this.has(key);
6603       const node = this.get(key, true);
6604       return node instanceof Collection ? node.hasIn(rest) : false;
6605     }
6606
6607     setIn([key, ...rest], value) {
6608       if (rest.length === 0) {
6609         this.set(key, value);
6610       } else {
6611         const node = this.get(key, true);
6612         if (node instanceof Collection) node.setIn(rest, value);else if (node === undefined && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
6613       }
6614     } // overridden in implementations
6615
6616     /* istanbul ignore next */
6617
6618
6619     toJSON() {
6620       return null;
6621     }
6622
6623     toString(ctx, {
6624       blockItem,
6625       flowChars,
6626       isMap,
6627       itemIndent
6628     }, onComment, onChompKeep) {
6629       const {
6630         doc,
6631         indent
6632       } = ctx;
6633       const inFlow = this.type && this.type.substr(0, 4) === 'FLOW' || ctx.inFlow;
6634       if (inFlow) itemIndent += '  ';
6635       const allNullValues = isMap && this.hasAllNullValues();
6636       ctx = Object.assign({}, ctx, {
6637         allNullValues,
6638         indent: itemIndent,
6639         inFlow,
6640         type: null
6641       });
6642       let chompKeep = false;
6643       let hasItemWithNewLine = false;
6644       const nodes = this.items.reduce((nodes, item, i) => {
6645         let comment;
6646
6647         if (item) {
6648           if (!chompKeep && item.spaceBefore) nodes.push({
6649             type: 'comment',
6650             str: ''
6651           });
6652           if (item.commentBefore) item.commentBefore.match(/^.*$/gm).forEach(line => {
6653             nodes.push({
6654               type: 'comment',
6655               str: `#${line}`
6656             });
6657           });
6658           if (item.comment) comment = item.comment;
6659           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))) hasItemWithNewLine = true;
6660         }
6661
6662         chompKeep = false;
6663         let str = doc.schema.stringify(item, ctx, () => comment = null, () => chompKeep = true);
6664         if (inFlow && !hasItemWithNewLine && str.includes('\n')) hasItemWithNewLine = true;
6665         if (inFlow && i < this.items.length - 1) str += ',';
6666         str = (0, _addComment.default)(str, itemIndent, comment);
6667         if (chompKeep && (comment || inFlow)) chompKeep = false;
6668         nodes.push({
6669           type: 'item',
6670           str
6671         });
6672         return nodes;
6673       }, []);
6674       let str;
6675
6676       if (nodes.length === 0) {
6677         str = flowChars.start + flowChars.end;
6678       } else if (inFlow) {
6679         const {
6680           start,
6681           end
6682         } = flowChars;
6683         const strings = nodes.map(n => n.str);
6684
6685         if (hasItemWithNewLine || strings.reduce((sum, str) => sum + str.length + 2, 2) > Collection.maxFlowStringSingleLineLength) {
6686           str = start;
6687
6688           for (const s of strings) {
6689             str += s ? `\n  ${indent}${s}` : '\n';
6690           }
6691
6692           str += `\n${indent}${end}`;
6693         } else {
6694           str = `${start} ${strings.join(' ')} ${end}`;
6695         }
6696       } else {
6697         const strings = nodes.map(blockItem);
6698         str = strings.shift();
6699
6700         for (const s of strings) str += s ? `\n${indent}${s}` : '\n';
6701       }
6702
6703       if (this.comment) {
6704         str += '\n' + this.comment.replace(/^/gm, `${indent}#`);
6705         if (onComment) onComment();
6706       } else if (chompKeep && onChompKeep) onChompKeep();
6707
6708       return str;
6709     }
6710
6711   }
6712
6713   exports.default = Collection;
6714
6715   _defineProperty(Collection, "maxFlowStringSingleLineLength", 60);
6716 });
6717 unwrapExports(Collection_1$1);
6718 var Collection_2$1 = Collection_1$1.isEmptyPath;
6719
6720 var Alias_1$1 = createCommonjsModule(function (module, exports) {
6721
6722   Object.defineProperty(exports, "__esModule", {
6723     value: true
6724   });
6725   exports.default = void 0;
6726
6727   var _toJSON = _interopRequireDefault(toJSON_1);
6728
6729   var _Collection = _interopRequireDefault(Collection_1$1);
6730
6731   var _Node = _interopRequireDefault(Node_1$1);
6732
6733   var _Pair = _interopRequireDefault(Pair_1);
6734
6735   function _interopRequireDefault(obj) {
6736     return obj && obj.__esModule ? obj : {
6737       default: obj
6738     };
6739   }
6740
6741   function _defineProperty(obj, key, value) {
6742     if (key in obj) {
6743       Object.defineProperty(obj, key, {
6744         value: value,
6745         enumerable: true,
6746         configurable: true,
6747         writable: true
6748       });
6749     } else {
6750       obj[key] = value;
6751     }
6752
6753     return obj;
6754   }
6755
6756   const getAliasCount = (node, anchors) => {
6757     if (node instanceof Alias) {
6758       const anchor = anchors.find(a => a.node === node.source);
6759       return anchor.count * anchor.aliasCount;
6760     } else if (node instanceof _Collection.default) {
6761       let count = 0;
6762
6763       for (const item of node.items) {
6764         const c = getAliasCount(item, anchors);
6765         if (c > count) count = c;
6766       }
6767
6768       return count;
6769     } else if (node instanceof _Pair.default) {
6770       const kc = getAliasCount(node.key, anchors);
6771       const vc = getAliasCount(node.value, anchors);
6772       return Math.max(kc, vc);
6773     }
6774
6775     return 1;
6776   };
6777
6778   class Alias extends _Node.default {
6779     static stringify({
6780       range,
6781       source
6782     }, {
6783       anchors,
6784       doc,
6785       implicitKey,
6786       inStringifyKey
6787     }) {
6788       let anchor = Object.keys(anchors).find(a => anchors[a] === source);
6789       if (!anchor && inStringifyKey) anchor = doc.anchors.getName(source) || doc.anchors.newName();
6790       if (anchor) return `*${anchor}${implicitKey ? ' ' : ''}`;
6791       const msg = doc.anchors.getName(source) ? 'Alias node must be after source node' : 'Source node not found for alias node';
6792       throw new Error(`${msg} [${range}]`);
6793     }
6794
6795     constructor(source) {
6796       super();
6797       this.source = source;
6798       this.type = constants.Type.ALIAS;
6799     }
6800
6801     set tag(t) {
6802       throw new Error('Alias nodes cannot have tags');
6803     }
6804
6805     toJSON(arg, ctx) {
6806       if (!ctx) return (0, _toJSON.default)(this.source, arg, ctx);
6807       const {
6808         anchors,
6809         maxAliasCount
6810       } = ctx;
6811       const anchor = anchors.find(a => a.node === this.source);
6812       /* istanbul ignore if */
6813
6814       if (!anchor || anchor.res === undefined) {
6815         const msg = 'This should not happen: Alias anchor was not resolved?';
6816         if (this.cstNode) throw new errors.YAMLReferenceError(this.cstNode, msg);else throw new ReferenceError(msg);
6817       }
6818
6819       if (maxAliasCount >= 0) {
6820         anchor.count += 1;
6821         if (anchor.aliasCount === 0) anchor.aliasCount = getAliasCount(this.source, anchors);
6822
6823         if (anchor.count * anchor.aliasCount > maxAliasCount) {
6824           const msg = 'Excessive alias count indicates a resource exhaustion attack';
6825           if (this.cstNode) throw new errors.YAMLReferenceError(this.cstNode, msg);else throw new ReferenceError(msg);
6826         }
6827       }
6828
6829       return anchor.res;
6830     } // Only called when stringifying an alias mapping key while constructing
6831     // Object output.
6832
6833
6834     toString(ctx) {
6835       return Alias.stringify(this, ctx);
6836     }
6837
6838   }
6839
6840   exports.default = Alias;
6841
6842   _defineProperty(Alias, "default", true);
6843 });
6844 unwrapExports(Alias_1$1);
6845
6846 var _Map = createCommonjsModule(function (module, exports) {
6847
6848   Object.defineProperty(exports, "__esModule", {
6849     value: true
6850   });
6851   exports.findPair = findPair;
6852   exports.default = void 0;
6853
6854   var _Collection = _interopRequireDefault(Collection_1$1);
6855
6856   var _Pair = _interopRequireDefault(Pair_1);
6857
6858   var _Scalar = _interopRequireDefault(Scalar_1);
6859
6860   function _interopRequireDefault(obj) {
6861     return obj && obj.__esModule ? obj : {
6862       default: obj
6863     };
6864   }
6865
6866   function findPair(items, key) {
6867     const k = key instanceof _Scalar.default ? key.value : key;
6868
6869     for (const it of items) {
6870       if (it instanceof _Pair.default) {
6871         if (it.key === key || it.key === k) return it;
6872         if (it.key && it.key.value === k) return it;
6873       }
6874     }
6875
6876     return undefined;
6877   }
6878
6879   class YAMLMap extends _Collection.default {
6880     add(pair, overwrite) {
6881       if (!pair) pair = new _Pair.default(pair);else if (!(pair instanceof _Pair.default)) pair = new _Pair.default(pair.key || pair, pair.value);
6882       const prev = findPair(this.items, pair.key);
6883       const sortEntries = this.schema && this.schema.sortMapEntries;
6884
6885       if (prev) {
6886         if (overwrite) prev.value = pair.value;else throw new Error(`Key ${pair.key} already set`);
6887       } else if (sortEntries) {
6888         const i = this.items.findIndex(item => sortEntries(pair, item) < 0);
6889         if (i === -1) this.items.push(pair);else this.items.splice(i, 0, pair);
6890       } else {
6891         this.items.push(pair);
6892       }
6893     }
6894
6895     delete(key) {
6896       const it = findPair(this.items, key);
6897       if (!it) return false;
6898       const del = this.items.splice(this.items.indexOf(it), 1);
6899       return del.length > 0;
6900     }
6901
6902     get(key, keepScalar) {
6903       const it = findPair(this.items, key);
6904       const node = it && it.value;
6905       return !keepScalar && node instanceof _Scalar.default ? node.value : node;
6906     }
6907
6908     has(key) {
6909       return !!findPair(this.items, key);
6910     }
6911
6912     set(key, value) {
6913       this.add(new _Pair.default(key, value), true);
6914     }
6915     /**
6916      * @param {*} arg ignored
6917      * @param {*} ctx Conversion context, originally set in Document#toJSON()
6918      * @param {Class} Type If set, forces the returned collection type
6919      * @returns {*} Instance of Type, Map, or Object
6920      */
6921
6922
6923     toJSON(_, ctx, Type) {
6924       const map = Type ? new Type() : ctx && ctx.mapAsMap ? new Map() : {};
6925       if (ctx && ctx.onCreate) ctx.onCreate(map);
6926
6927       for (const item of this.items) item.addToJSMap(ctx, map);
6928
6929       return map;
6930     }
6931
6932     toString(ctx, onComment, onChompKeep) {
6933       if (!ctx) return JSON.stringify(this);
6934
6935       for (const item of this.items) {
6936         if (!(item instanceof _Pair.default)) throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
6937       }
6938
6939       return super.toString(ctx, {
6940         blockItem: n => n.str,
6941         flowChars: {
6942           start: '{',
6943           end: '}'
6944         },
6945         isMap: true,
6946         itemIndent: ctx.indent || ''
6947       }, onComment, onChompKeep);
6948     }
6949
6950   }
6951
6952   exports.default = YAMLMap;
6953 });
6954
6955 unwrapExports(_Map);
6956 var _Map_1 = _Map.findPair;
6957
6958 var Seq = createCommonjsModule(function (module, exports) {
6959
6960   Object.defineProperty(exports, "__esModule", {
6961     value: true
6962   });
6963   exports.default = void 0;
6964
6965   var _toJSON = _interopRequireDefault(toJSON_1);
6966
6967   var _Collection = _interopRequireDefault(Collection_1$1);
6968
6969   var _Scalar = _interopRequireDefault(Scalar_1);
6970
6971   function _interopRequireDefault(obj) {
6972     return obj && obj.__esModule ? obj : {
6973       default: obj
6974     };
6975   } // Published as 'yaml/seq'
6976
6977
6978   function asItemIndex(key) {
6979     let idx = key instanceof _Scalar.default ? key.value : key;
6980     if (idx && typeof idx === 'string') idx = Number(idx);
6981     return Number.isInteger(idx) && idx >= 0 ? idx : null;
6982   }
6983
6984   class YAMLSeq extends _Collection.default {
6985     add(value) {
6986       this.items.push(value);
6987     }
6988
6989     delete(key) {
6990       const idx = asItemIndex(key);
6991       if (typeof idx !== 'number') return false;
6992       const del = this.items.splice(idx, 1);
6993       return del.length > 0;
6994     }
6995
6996     get(key, keepScalar) {
6997       const idx = asItemIndex(key);
6998       if (typeof idx !== 'number') return undefined;
6999       const it = this.items[idx];
7000       return !keepScalar && it instanceof _Scalar.default ? it.value : it;
7001     }
7002
7003     has(key) {
7004       const idx = asItemIndex(key);
7005       return typeof idx === 'number' && idx < this.items.length;
7006     }
7007
7008     set(key, value) {
7009       const idx = asItemIndex(key);
7010       if (typeof idx !== 'number') throw new Error(`Expected a valid index, not ${key}.`);
7011       this.items[idx] = value;
7012     }
7013
7014     toJSON(_, ctx) {
7015       const seq = [];
7016       if (ctx && ctx.onCreate) ctx.onCreate(seq);
7017       let i = 0;
7018
7019       for (const item of this.items) seq.push((0, _toJSON.default)(item, String(i++), ctx));
7020
7021       return seq;
7022     }
7023
7024     toString(ctx, onComment, onChompKeep) {
7025       if (!ctx) return JSON.stringify(this);
7026       return super.toString(ctx, {
7027         blockItem: n => n.type === 'comment' ? n.str : `- ${n.str}`,
7028         flowChars: {
7029           start: '[',
7030           end: ']'
7031         },
7032         isMap: false,
7033         itemIndent: (ctx.indent || '') + '  '
7034       }, onComment, onChompKeep);
7035     }
7036
7037   }
7038
7039   exports.default = YAMLSeq;
7040 });
7041 unwrapExports(Seq);
7042
7043 var Merge_1 = createCommonjsModule(function (module, exports) {
7044
7045   Object.defineProperty(exports, "__esModule", {
7046     value: true
7047   });
7048   exports.default = exports.MERGE_KEY = void 0;
7049
7050   var _Map$1 = _interopRequireDefault(_Map);
7051
7052   var _Pair = _interopRequireDefault(Pair_1);
7053
7054   var _Scalar = _interopRequireDefault(Scalar_1);
7055
7056   var _Seq = _interopRequireDefault(Seq);
7057
7058   function _interopRequireDefault(obj) {
7059     return obj && obj.__esModule ? obj : {
7060       default: obj
7061     };
7062   }
7063
7064   const MERGE_KEY = '<<';
7065   exports.MERGE_KEY = MERGE_KEY;
7066
7067   class Merge extends _Pair.default {
7068     constructor(pair) {
7069       if (pair instanceof _Pair.default) {
7070         let seq = pair.value;
7071
7072         if (!(seq instanceof _Seq.default)) {
7073           seq = new _Seq.default();
7074           seq.items.push(pair.value);
7075           seq.range = pair.value.range;
7076         }
7077
7078         super(pair.key, seq);
7079         this.range = pair.range;
7080       } else {
7081         super(new _Scalar.default(MERGE_KEY), new _Seq.default());
7082       }
7083
7084       this.type = 'MERGE_PAIR';
7085     } // If the value associated with a merge key is a single mapping node, each of
7086     // its key/value pairs is inserted into the current mapping, unless the key
7087     // already exists in it. If the value associated with the merge key is a
7088     // sequence, then this sequence is expected to contain mapping nodes and each
7089     // of these nodes is merged in turn according to its order in the sequence.
7090     // Keys in mapping nodes earlier in the sequence override keys specified in
7091     // later mapping nodes. -- http://yaml.org/type/merge.html
7092
7093
7094     addToJSMap(ctx, map) {
7095       for (const {
7096         source
7097       } of this.value.items) {
7098         if (!(source instanceof _Map$1.default)) throw new Error('Merge sources must be maps');
7099         const srcMap = source.toJSON(null, ctx, Map);
7100
7101         for (const [key, value] of srcMap) {
7102           if (map instanceof Map) {
7103             if (!map.has(key)) map.set(key, value);
7104           } else if (map instanceof Set) {
7105             map.add(key);
7106           } else {
7107             if (!Object.prototype.hasOwnProperty.call(map, key)) map[key] = value;
7108           }
7109         }
7110       }
7111
7112       return map;
7113     }
7114
7115     toString(ctx, onComment) {
7116       const seq = this.value;
7117       if (seq.items.length > 1) return super.toString(ctx, onComment);
7118       this.value = seq.items[0];
7119       const str = super.toString(ctx, onComment);
7120       this.value = seq;
7121       return str;
7122     }
7123
7124   }
7125
7126   exports.default = Merge;
7127 });
7128 unwrapExports(Merge_1);
7129 var Merge_2 = Merge_1.MERGE_KEY;
7130
7131 var Anchors_1 = createCommonjsModule(function (module, exports) {
7132
7133   Object.defineProperty(exports, "__esModule", {
7134     value: true
7135   });
7136   exports.default = void 0;
7137
7138   var _Alias = _interopRequireDefault(Alias_1$1);
7139
7140   var _Map$1 = _interopRequireDefault(_Map);
7141
7142   var _Merge = _interopRequireDefault(Merge_1);
7143
7144   var _Scalar = _interopRequireDefault(Scalar_1);
7145
7146   var _Seq = _interopRequireDefault(Seq);
7147
7148   function _interopRequireDefault(obj) {
7149     return obj && obj.__esModule ? obj : {
7150       default: obj
7151     };
7152   }
7153
7154   function _defineProperty(obj, key, value) {
7155     if (key in obj) {
7156       Object.defineProperty(obj, key, {
7157         value: value,
7158         enumerable: true,
7159         configurable: true,
7160         writable: true
7161       });
7162     } else {
7163       obj[key] = value;
7164     }
7165
7166     return obj;
7167   }
7168
7169   class Anchors {
7170     static validAnchorNode(node) {
7171       return node instanceof _Scalar.default || node instanceof _Seq.default || node instanceof _Map$1.default;
7172     }
7173
7174     constructor(prefix) {
7175       _defineProperty(this, "map", {});
7176
7177       this.prefix = prefix;
7178     }
7179
7180     createAlias(node, name) {
7181       this.setAnchor(node, name);
7182       return new _Alias.default(node);
7183     }
7184
7185     createMergePair(...sources) {
7186       const merge = new _Merge.default();
7187       merge.value.items = sources.map(s => {
7188         if (s instanceof _Alias.default) {
7189           if (s.source instanceof _Map$1.default) return s;
7190         } else if (s instanceof _Map$1.default) {
7191           return this.createAlias(s);
7192         }
7193
7194         throw new Error('Merge sources must be Map nodes or their Aliases');
7195       });
7196       return merge;
7197     }
7198
7199     getName(node) {
7200       const {
7201         map
7202       } = this;
7203       return Object.keys(map).find(a => map[a] === node);
7204     }
7205
7206     getNode(name) {
7207       return this.map[name];
7208     }
7209
7210     newName(prefix) {
7211       if (!prefix) prefix = this.prefix;
7212       const names = Object.keys(this.map);
7213
7214       for (let i = 1; true; ++i) {
7215         const name = `${prefix}${i}`;
7216         if (!names.includes(name)) return name;
7217       }
7218     } // During parsing, map & aliases contain CST nodes
7219
7220
7221     resolveNodes() {
7222       const {
7223         map,
7224         _cstAliases
7225       } = this;
7226       Object.keys(map).forEach(a => {
7227         map[a] = map[a].resolved;
7228       });
7229
7230       _cstAliases.forEach(a => {
7231         a.source = a.source.resolved;
7232       });
7233
7234       delete this._cstAliases;
7235     }
7236
7237     setAnchor(node, name) {
7238       if (node != null && !Anchors.validAnchorNode(node)) {
7239         throw new Error('Anchors may only be set for Scalar, Seq and Map nodes');
7240       }
7241
7242       if (name && /[\x00-\x19\s,[\]{}]/.test(name)) {
7243         throw new Error('Anchor names must not contain whitespace or control characters');
7244       }
7245
7246       const {
7247         map
7248       } = this;
7249       const prev = node && Object.keys(map).find(a => map[a] === node);
7250
7251       if (prev) {
7252         if (!name) {
7253           return prev;
7254         } else if (prev !== name) {
7255           delete map[prev];
7256           map[name] = node;
7257         }
7258       } else {
7259         if (!name) {
7260           if (!node) return null;
7261           name = this.newName();
7262         }
7263
7264         map[name] = node;
7265       }
7266
7267       return name;
7268     }
7269
7270   }
7271
7272   exports.default = Anchors;
7273 });
7274 unwrapExports(Anchors_1);
7275
7276 var listTagNames = createCommonjsModule(function (module, exports) {
7277
7278   Object.defineProperty(exports, "__esModule", {
7279     value: true
7280   });
7281   exports.default = void 0;
7282
7283   var _Collection = _interopRequireDefault(Collection_1$1);
7284
7285   var _Pair = _interopRequireDefault(Pair_1);
7286
7287   var _Scalar = _interopRequireDefault(Scalar_1);
7288
7289   function _interopRequireDefault(obj) {
7290     return obj && obj.__esModule ? obj : {
7291       default: obj
7292     };
7293   }
7294
7295   const visit = (node, tags) => {
7296     if (node && typeof node === 'object') {
7297       const {
7298         tag
7299       } = node;
7300
7301       if (node instanceof _Collection.default) {
7302         if (tag) tags[tag] = true;
7303         node.items.forEach(n => visit(n, tags));
7304       } else if (node instanceof _Pair.default) {
7305         visit(node.key, tags);
7306         visit(node.value, tags);
7307       } else if (node instanceof _Scalar.default) {
7308         if (tag) tags[tag] = true;
7309       }
7310     }
7311
7312     return tags;
7313   };
7314
7315   var _default = node => Object.keys(visit(node, {}));
7316
7317   exports.default = _default;
7318 });
7319 unwrapExports(listTagNames);
7320
7321 var warnings = createCommonjsModule(function (module, exports) {
7322
7323   Object.defineProperty(exports, "__esModule", {
7324     value: true
7325   });
7326   exports.warn = warn;
7327   exports.warnFileDeprecation = warnFileDeprecation;
7328   exports.warnOptionDeprecation = warnOptionDeprecation;
7329   /* global global, console */
7330
7331   function warn(warning, type) {
7332     if (global && global._YAML_SILENCE_WARNINGS) return;
7333     const {
7334       emitWarning
7335     } = global && global.process; // This will throw in Jest if `warning` is an Error instance due to
7336     // https://github.com/facebook/jest/issues/2549
7337
7338     if (emitWarning) emitWarning(warning, type);else {
7339       // eslint-disable-next-line no-console
7340       console.warn(type ? `${type}: ${warning}` : warning);
7341     }
7342   }
7343
7344   function warnFileDeprecation(filename) {
7345     if (global && global._YAML_SILENCE_DEPRECATION_WARNINGS) return;
7346     const path = filename.replace(/.*yaml[/\\]/i, '').replace(/\.js$/, '').replace(/\\/g, '/');
7347     warn(`The endpoint 'yaml/${path}' will be removed in a future release.`, 'DeprecationWarning');
7348   }
7349
7350   const warned = {};
7351
7352   function warnOptionDeprecation(name, alternative) {
7353     if (global && global._YAML_SILENCE_DEPRECATION_WARNINGS) return;
7354     if (warned[name]) return;
7355     warned[name] = true;
7356     let msg = `The option '${name}' will be removed in a future release`;
7357     msg += alternative ? `, use '${alternative}' instead.` : '.';
7358     warn(msg, 'DeprecationWarning');
7359   }
7360 });
7361 unwrapExports(warnings);
7362 var warnings_1 = warnings.warn;
7363 var warnings_2 = warnings.warnFileDeprecation;
7364 var warnings_3 = warnings.warnOptionDeprecation;
7365
7366 var foldFlowLines_1 = createCommonjsModule(function (module, exports) {
7367
7368   Object.defineProperty(exports, "__esModule", {
7369     value: true
7370   });
7371   exports.default = foldFlowLines;
7372   exports.FOLD_QUOTED = exports.FOLD_BLOCK = exports.FOLD_FLOW = void 0;
7373   const FOLD_FLOW = 'flow';
7374   exports.FOLD_FLOW = FOLD_FLOW;
7375   const FOLD_BLOCK = 'block';
7376   exports.FOLD_BLOCK = FOLD_BLOCK;
7377   const FOLD_QUOTED = 'quoted'; // presumes i+1 is at the start of a line
7378   // returns index of last newline in more-indented block
7379
7380   exports.FOLD_QUOTED = FOLD_QUOTED;
7381
7382   const consumeMoreIndentedLines = (text, i) => {
7383     let ch = text[i + 1];
7384
7385     while (ch === ' ' || ch === '\t') {
7386       do {
7387         ch = text[i += 1];
7388       } while (ch && ch !== '\n');
7389
7390       ch = text[i + 1];
7391     }
7392
7393     return i;
7394   };
7395   /**
7396    * Tries to keep input at up to `lineWidth` characters, splitting only on spaces
7397    * not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
7398    * terminated with `\n` and started with `indent`.
7399    *
7400    * @param {string} text
7401    * @param {string} indent
7402    * @param {string} [mode='flow'] `'block'` prevents more-indented lines
7403    *   from being folded; `'quoted'` allows for `\` escapes, including escaped
7404    *   newlines
7405    * @param {Object} options
7406    * @param {number} [options.indentAtStart] Accounts for leading contents on
7407    *   the first line, defaulting to `indent.length`
7408    * @param {number} [options.lineWidth=80]
7409    * @param {number} [options.minContentWidth=20] Allow highly indented lines to
7410    *   stretch the line width
7411    * @param {function} options.onFold Called once if the text is folded
7412    * @param {function} options.onFold Called once if any line of text exceeds
7413    *   lineWidth characters
7414    */
7415
7416
7417   function foldFlowLines(text, indent, mode, {
7418     indentAtStart,
7419     lineWidth = 80,
7420     minContentWidth = 20,
7421     onFold,
7422     onOverflow
7423   }) {
7424     if (!lineWidth || lineWidth < 0) return text;
7425     const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
7426     if (text.length <= endStep) return text;
7427     const folds = [];
7428     const escapedFolds = {};
7429     let end = lineWidth - (typeof indentAtStart === 'number' ? indentAtStart : indent.length);
7430     let split = undefined;
7431     let prev = undefined;
7432     let overflow = false;
7433     let i = -1;
7434
7435     if (mode === FOLD_BLOCK) {
7436       i = consumeMoreIndentedLines(text, i);
7437       if (i !== -1) end = i + endStep;
7438     }
7439
7440     for (let ch; ch = text[i += 1];) {
7441       if (mode === FOLD_QUOTED && ch === '\\') {
7442         switch (text[i + 1]) {
7443           case 'x':
7444             i += 3;
7445             break;
7446
7447           case 'u':
7448             i += 5;
7449             break;
7450
7451           case 'U':
7452             i += 9;
7453             break;
7454
7455           default:
7456             i += 1;
7457         }
7458       }
7459
7460       if (ch === '\n') {
7461         if (mode === FOLD_BLOCK) i = consumeMoreIndentedLines(text, i);
7462         end = i + endStep;
7463         split = undefined;
7464       } else {
7465         if (ch === ' ' && prev && prev !== ' ' && prev !== '\n' && prev !== '\t') {
7466           // space surrounded by non-space can be replaced with newline + indent
7467           const next = text[i + 1];
7468           if (next && next !== ' ' && next !== '\n' && next !== '\t') split = i;
7469         }
7470
7471         if (i >= end) {
7472           if (split) {
7473             folds.push(split);
7474             end = split + endStep;
7475             split = undefined;
7476           } else if (mode === FOLD_QUOTED) {
7477             // white-space collected at end may stretch past lineWidth
7478             while (prev === ' ' || prev === '\t') {
7479               prev = ch;
7480               ch = text[i += 1];
7481               overflow = true;
7482             } // i - 2 accounts for not-dropped last char + newline-escaping \
7483
7484
7485             folds.push(i - 2);
7486             escapedFolds[i - 2] = true;
7487             end = i - 2 + endStep;
7488             split = undefined;
7489           } else {
7490             overflow = true;
7491           }
7492         }
7493       }
7494
7495       prev = ch;
7496     }
7497
7498     if (overflow && onOverflow) onOverflow();
7499     if (folds.length === 0) return text;
7500     if (onFold) onFold();
7501     let res = text.slice(0, folds[0]);
7502
7503     for (let i = 0; i < folds.length; ++i) {
7504       const fold = folds[i];
7505       const end = folds[i + 1] || text.length;
7506       if (mode === FOLD_QUOTED && escapedFolds[fold]) res += `${text[fold]}\\`;
7507       res += `\n${indent}${text.slice(fold + 1, end)}`;
7508     }
7509
7510     return res;
7511   }
7512 });
7513 unwrapExports(foldFlowLines_1);
7514 var foldFlowLines_2 = foldFlowLines_1.FOLD_QUOTED;
7515 var foldFlowLines_3 = foldFlowLines_1.FOLD_BLOCK;
7516 var foldFlowLines_4 = foldFlowLines_1.FOLD_FLOW;
7517
7518 var options = createCommonjsModule(function (module, exports) {
7519
7520   Object.defineProperty(exports, "__esModule", {
7521     value: true
7522   });
7523   exports.strOptions = exports.nullOptions = exports.boolOptions = exports.binaryOptions = void 0;
7524   const binaryOptions = {
7525     defaultType: constants.Type.BLOCK_LITERAL,
7526     lineWidth: 76
7527   };
7528   exports.binaryOptions = binaryOptions;
7529   const boolOptions = {
7530     trueStr: 'true',
7531     falseStr: 'false'
7532   };
7533   exports.boolOptions = boolOptions;
7534   const nullOptions = {
7535     nullStr: 'null'
7536   };
7537   exports.nullOptions = nullOptions;
7538   const strOptions = {
7539     defaultType: constants.Type.PLAIN,
7540     doubleQuoted: {
7541       jsonEncoding: false,
7542       minMultiLineLength: 40
7543     },
7544     fold: {
7545       lineWidth: 80,
7546       minContentWidth: 20
7547     }
7548   };
7549   exports.strOptions = strOptions;
7550 });
7551 unwrapExports(options);
7552 var options_1 = options.strOptions;
7553 var options_2 = options.nullOptions;
7554 var options_3 = options.boolOptions;
7555 var options_4 = options.binaryOptions;
7556
7557 var stringify = createCommonjsModule(function (module, exports) {
7558
7559   Object.defineProperty(exports, "__esModule", {
7560     value: true
7561   });
7562   exports.stringifyNumber = stringifyNumber;
7563   exports.stringifyString = stringifyString;
7564
7565   var _foldFlowLines = _interopRequireWildcard(foldFlowLines_1);
7566
7567   function _getRequireWildcardCache() {
7568     if (typeof WeakMap !== "function") return null;
7569     var cache = new WeakMap();
7570
7571     _getRequireWildcardCache = function () {
7572       return cache;
7573     };
7574
7575     return cache;
7576   }
7577
7578   function _interopRequireWildcard(obj) {
7579     if (obj && obj.__esModule) {
7580       return obj;
7581     }
7582
7583     if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
7584       return {
7585         default: obj
7586       };
7587     }
7588
7589     var cache = _getRequireWildcardCache();
7590
7591     if (cache && cache.has(obj)) {
7592       return cache.get(obj);
7593     }
7594
7595     var newObj = {};
7596     var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
7597
7598     for (var key in obj) {
7599       if (Object.prototype.hasOwnProperty.call(obj, key)) {
7600         var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
7601
7602         if (desc && (desc.get || desc.set)) {
7603           Object.defineProperty(newObj, key, desc);
7604         } else {
7605           newObj[key] = obj[key];
7606         }
7607       }
7608     }
7609
7610     newObj.default = obj;
7611
7612     if (cache) {
7613       cache.set(obj, newObj);
7614     }
7615
7616     return newObj;
7617   }
7618
7619   const getFoldOptions = ({
7620     indentAtStart
7621   }) => indentAtStart ? Object.assign({
7622     indentAtStart
7623   }, options.strOptions.fold) : options.strOptions.fold;
7624
7625   function stringifyNumber({
7626     format,
7627     minFractionDigits,
7628     tag,
7629     value
7630   }) {
7631     if (!isFinite(value)) return isNaN(value) ? '.nan' : value < 0 ? '-.inf' : '.inf';
7632     let n = JSON.stringify(value);
7633
7634     if (!format && minFractionDigits && (!tag || tag === 'tag:yaml.org,2002:float') && /^\d/.test(n)) {
7635       let i = n.indexOf('.');
7636
7637       if (i < 0) {
7638         i = n.length;
7639         n += '.';
7640       }
7641
7642       let d = minFractionDigits - (n.length - i - 1);
7643
7644       while (d-- > 0) n += '0';
7645     }
7646
7647     return n;
7648   }
7649
7650   function lineLengthOverLimit(str, limit) {
7651     const strLen = str.length;
7652     if (strLen <= limit) return false;
7653
7654     for (let i = 0, start = 0; i < strLen; ++i) {
7655       if (str[i] === '\n') {
7656         if (i - start > limit) return true;
7657         start = i + 1;
7658         if (strLen - start <= limit) return false;
7659       }
7660     }
7661
7662     return true;
7663   }
7664
7665   function doubleQuotedString(value, ctx) {
7666     const {
7667       implicitKey,
7668       indent
7669     } = ctx;
7670     const {
7671       jsonEncoding,
7672       minMultiLineLength
7673     } = options.strOptions.doubleQuoted;
7674     const json = JSON.stringify(value);
7675     if (jsonEncoding) return json;
7676     let str = '';
7677     let start = 0;
7678
7679     for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
7680       if (ch === ' ' && json[i + 1] === '\\' && json[i + 2] === 'n') {
7681         // space before newline needs to be escaped to not be folded
7682         str += json.slice(start, i) + '\\ ';
7683         i += 1;
7684         start = i;
7685         ch = '\\';
7686       }
7687
7688       if (ch === '\\') switch (json[i + 1]) {
7689         case 'u':
7690           {
7691             str += json.slice(start, i);
7692             const code = json.substr(i + 2, 4);
7693
7694             switch (code) {
7695               case '0000':
7696                 str += '\\0';
7697                 break;
7698
7699               case '0007':
7700                 str += '\\a';
7701                 break;
7702
7703               case '000b':
7704                 str += '\\v';
7705                 break;
7706
7707               case '001b':
7708                 str += '\\e';
7709                 break;
7710
7711               case '0085':
7712                 str += '\\N';
7713                 break;
7714
7715               case '00a0':
7716                 str += '\\_';
7717                 break;
7718
7719               case '2028':
7720                 str += '\\L';
7721                 break;
7722
7723               case '2029':
7724                 str += '\\P';
7725                 break;
7726
7727               default:
7728                 if (code.substr(0, 2) === '00') str += '\\x' + code.substr(2);else str += json.substr(i, 6);
7729             }
7730
7731             i += 5;
7732             start = i + 1;
7733           }
7734           break;
7735
7736         case 'n':
7737           if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) {
7738             i += 1;
7739           } else {
7740             // folding will eat first newline
7741             str += json.slice(start, i) + '\n\n';
7742
7743             while (json[i + 2] === '\\' && json[i + 3] === 'n' && json[i + 4] !== '"') {
7744               str += '\n';
7745               i += 2;
7746             }
7747
7748             str += indent; // space after newline needs to be escaped to not be folded
7749
7750             if (json[i + 2] === ' ') str += '\\';
7751             i += 1;
7752             start = i + 1;
7753           }
7754
7755           break;
7756
7757         default:
7758           i += 1;
7759       }
7760     }
7761
7762     str = start ? str + json.slice(start) : json;
7763     return implicitKey ? str : (0, _foldFlowLines.default)(str, indent, _foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx));
7764   }
7765
7766   function singleQuotedString(value, ctx) {
7767     const {
7768       indent,
7769       implicitKey
7770     } = ctx;
7771
7772     if (implicitKey) {
7773       if (/\n/.test(value)) return doubleQuotedString(value, ctx);
7774     } else {
7775       // single quoted string can't have leading or trailing whitespace around newline
7776       if (/[ \t]\n|\n[ \t]/.test(value)) return doubleQuotedString(value, ctx);
7777     }
7778
7779     const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&\n${indent}`) + "'";
7780     return implicitKey ? res : (0, _foldFlowLines.default)(res, indent, _foldFlowLines.FOLD_FLOW, getFoldOptions(ctx));
7781   }
7782
7783   function blockString({
7784     comment,
7785     type,
7786     value
7787   }, ctx, onComment, onChompKeep) {
7788     // 1. Block can't end in whitespace unless the last line is non-empty.
7789     // 2. Strings consisting of only whitespace are best rendered explicitly.
7790     if (/\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
7791       return doubleQuotedString(value, ctx);
7792     }
7793
7794     const indent = ctx.indent || (ctx.forceBlockIndent ? ' ' : '');
7795     const indentSize = indent ? '2' : '1'; // root is at -1
7796
7797     const literal = type === constants.Type.BLOCK_FOLDED ? false : type === constants.Type.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, options.strOptions.fold.lineWidth - indent.length);
7798     let header = literal ? '|' : '>';
7799     if (!value) return header + '\n';
7800     let wsStart = '';
7801     let wsEnd = '';
7802     value = value.replace(/[\n\t ]*$/, ws => {
7803       const n = ws.indexOf('\n');
7804
7805       if (n === -1) {
7806         header += '-'; // strip
7807       } else if (value === ws || n !== ws.length - 1) {
7808         header += '+'; // keep
7809
7810         if (onChompKeep) onChompKeep();
7811       }
7812
7813       wsEnd = ws.replace(/\n$/, '');
7814       return '';
7815     }).replace(/^[\n ]*/, ws => {
7816       if (ws.indexOf(' ') !== -1) header += indentSize;
7817       const m = ws.match(/ +$/);
7818
7819       if (m) {
7820         wsStart = ws.slice(0, -m[0].length);
7821         return m[0];
7822       } else {
7823         wsStart = ws;
7824         return '';
7825       }
7826     });
7827     if (wsEnd) wsEnd = wsEnd.replace(/\n+(?!\n|$)/g, `$&${indent}`);
7828     if (wsStart) wsStart = wsStart.replace(/\n+/g, `$&${indent}`);
7829
7830     if (comment) {
7831       header += ' #' + comment.replace(/ ?[\r\n]+/g, ' ');
7832       if (onComment) onComment();
7833     }
7834
7835     if (!value) return `${header}${indentSize}\n${indent}${wsEnd}`;
7836
7837     if (literal) {
7838       value = value.replace(/\n+/g, `$&${indent}`);
7839       return `${header}\n${indent}${wsStart}${value}${wsEnd}`;
7840     }
7841
7842     value = value.replace(/\n+/g, '\n$&').replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
7843     //         ^ ind.line  ^ empty     ^ capture next empty lines only at end of indent
7844     .replace(/\n+/g, `$&${indent}`);
7845     const body = (0, _foldFlowLines.default)(`${wsStart}${value}${wsEnd}`, indent, _foldFlowLines.FOLD_BLOCK, options.strOptions.fold);
7846     return `${header}\n${indent}${body}`;
7847   }
7848
7849   function plainString(item, ctx, onComment, onChompKeep) {
7850     const {
7851       comment,
7852       type,
7853       value
7854     } = item;
7855     const {
7856       actualString,
7857       implicitKey,
7858       indent,
7859       inFlow,
7860       tags
7861     } = ctx;
7862
7863     if (implicitKey && /[\n[\]{},]/.test(value) || inFlow && /[[\]{},]/.test(value)) {
7864       return doubleQuotedString(value, ctx);
7865     }
7866
7867     if (!value || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
7868       // not allowed:
7869       // - empty string, '-' or '?'
7870       // - start with an indicator character (except [?:-]) or /[?-] /
7871       // - '\n ', ': ' or ' \n' anywhere
7872       // - '#' not preceded by a non-space char
7873       // - end with ' ' or ':'
7874       return implicitKey || inFlow || value.indexOf('\n') === -1 ? value.indexOf('"') !== -1 && value.indexOf("'") === -1 ? singleQuotedString(value, ctx) : doubleQuotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep);
7875     }
7876
7877     if (!implicitKey && !inFlow && type !== constants.Type.PLAIN && value.indexOf('\n') !== -1) {
7878       // Where allowed & type not set explicitly, prefer block style for multiline strings
7879       return blockString(item, ctx, onComment, onChompKeep);
7880     }
7881
7882     const str = value.replace(/\n+/g, `$&\n${indent}`); // Verify that output will be parsed as a string, as e.g. plain numbers and
7883     // booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'),
7884     // and others in v1.1.
7885
7886     if (actualString && typeof tags.resolveScalar(str).value !== 'string') {
7887       return doubleQuotedString(value, ctx);
7888     }
7889
7890     const body = implicitKey ? str : (0, _foldFlowLines.default)(str, indent, _foldFlowLines.FOLD_FLOW, getFoldOptions(ctx));
7891
7892     if (comment && !inFlow && (body.indexOf('\n') !== -1 || comment.indexOf('\n') !== -1)) {
7893       if (onComment) onComment();
7894       return (0, addComment_1.addCommentBefore)(body, indent, comment);
7895     }
7896
7897     return body;
7898   }
7899
7900   function stringifyString(item, ctx, onComment, onChompKeep) {
7901     const {
7902       defaultType
7903     } = options.strOptions;
7904     const {
7905       implicitKey,
7906       inFlow
7907     } = ctx;
7908     let {
7909       type,
7910       value
7911     } = item;
7912
7913     if (typeof value !== 'string') {
7914       value = String(value);
7915       item = Object.assign({}, item, {
7916         value
7917       });
7918     }
7919
7920     const _stringify = _type => {
7921       switch (_type) {
7922         case constants.Type.BLOCK_FOLDED:
7923         case constants.Type.BLOCK_LITERAL:
7924           return blockString(item, ctx, onComment, onChompKeep);
7925
7926         case constants.Type.QUOTE_DOUBLE:
7927           return doubleQuotedString(value, ctx);
7928
7929         case constants.Type.QUOTE_SINGLE:
7930           return singleQuotedString(value, ctx);
7931
7932         case constants.Type.PLAIN:
7933           return plainString(item, ctx, onComment, onChompKeep);
7934
7935         default:
7936           return null;
7937       }
7938     };
7939
7940     if (type !== constants.Type.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(value)) {
7941       // force double quotes on control characters
7942       type = constants.Type.QUOTE_DOUBLE;
7943     } else if ((implicitKey || inFlow) && (type === constants.Type.BLOCK_FOLDED || type === constants.Type.BLOCK_LITERAL)) {
7944       // should not happen; blocks are not valid inside flow containers
7945       type = constants.Type.QUOTE_DOUBLE;
7946     }
7947
7948     let res = _stringify(type);
7949
7950     if (res === null) {
7951       res = _stringify(defaultType);
7952       if (res === null) throw new Error(`Unsupported default string type ${defaultType}`);
7953     }
7954
7955     return res;
7956   }
7957 });
7958 unwrapExports(stringify);
7959 var stringify_1 = stringify.stringifyNumber;
7960 var stringify_2 = stringify.stringifyString;
7961
7962 var parseUtils = createCommonjsModule(function (module, exports) {
7963
7964   Object.defineProperty(exports, "__esModule", {
7965     value: true
7966   });
7967   exports.checkFlowCollectionEnd = checkFlowCollectionEnd;
7968   exports.checkKeyLength = checkKeyLength;
7969   exports.resolveComments = resolveComments;
7970
7971   function checkFlowCollectionEnd(errors$1, cst) {
7972     let char, name;
7973
7974     switch (cst.type) {
7975       case constants.Type.FLOW_MAP:
7976         char = '}';
7977         name = 'flow map';
7978         break;
7979
7980       case constants.Type.FLOW_SEQ:
7981         char = ']';
7982         name = 'flow sequence';
7983         break;
7984
7985       default:
7986         errors$1.push(new errors.YAMLSemanticError(cst, 'Not a flow collection!?'));
7987         return;
7988     }
7989
7990     let lastItem;
7991
7992     for (let i = cst.items.length - 1; i >= 0; --i) {
7993       const item = cst.items[i];
7994
7995       if (!item || item.type !== constants.Type.COMMENT) {
7996         lastItem = item;
7997         break;
7998       }
7999     }
8000
8001     if (lastItem && lastItem.char !== char) {
8002       const msg = `Expected ${name} to end with ${char}`;
8003       let err;
8004
8005       if (typeof lastItem.offset === 'number') {
8006         err = new errors.YAMLSemanticError(cst, msg);
8007         err.offset = lastItem.offset + 1;
8008       } else {
8009         err = new errors.YAMLSemanticError(lastItem, msg);
8010         if (lastItem.range && lastItem.range.end) err.offset = lastItem.range.end - lastItem.range.start;
8011       }
8012
8013       errors$1.push(err);
8014     }
8015   }
8016
8017   function checkKeyLength(errors$1, node, itemIdx, key, keyStart) {
8018     if (!key || typeof keyStart !== 'number') return;
8019     const item = node.items[itemIdx];
8020     let keyEnd = item && item.range && item.range.start;
8021
8022     if (!keyEnd) {
8023       for (let i = itemIdx - 1; i >= 0; --i) {
8024         const it = node.items[i];
8025
8026         if (it && it.range) {
8027           keyEnd = it.range.end + 2 * (itemIdx - i);
8028           break;
8029         }
8030       }
8031     }
8032
8033     if (keyEnd > keyStart + 1024) {
8034       const k = String(key).substr(0, 8) + '...' + String(key).substr(-8);
8035       errors$1.push(new errors.YAMLSemanticError(node, `The "${k}" key is too long`));
8036     }
8037   }
8038
8039   function resolveComments(collection, comments) {
8040     for (const {
8041       afterKey,
8042       before,
8043       comment
8044     } of comments) {
8045       let item = collection.items[before];
8046
8047       if (!item) {
8048         if (comment !== undefined) {
8049           if (collection.comment) collection.comment += '\n' + comment;else collection.comment = comment;
8050         }
8051       } else {
8052         if (afterKey && item.value) item = item.value;
8053
8054         if (comment === undefined) {
8055           if (afterKey || !item.commentBefore) item.spaceBefore = true;
8056         } else {
8057           if (item.commentBefore) item.commentBefore += '\n' + comment;else item.commentBefore = comment;
8058         }
8059       }
8060     }
8061   }
8062 });
8063 unwrapExports(parseUtils);
8064 var parseUtils_1 = parseUtils.checkFlowCollectionEnd;
8065 var parseUtils_2 = parseUtils.checkKeyLength;
8066 var parseUtils_3 = parseUtils.resolveComments;
8067
8068 var parseMap_1 = createCommonjsModule(function (module, exports) {
8069
8070   Object.defineProperty(exports, "__esModule", {
8071     value: true
8072   });
8073   exports.default = parseMap;
8074
8075   var _PlainValue = _interopRequireDefault(PlainValue_1);
8076
8077   var _Map$1 = _interopRequireDefault(_Map);
8078
8079   var _Merge = _interopRequireWildcard(Merge_1);
8080
8081   var _Pair = _interopRequireDefault(Pair_1);
8082
8083   var _Alias = _interopRequireDefault(Alias_1$1);
8084
8085   var _Collection = _interopRequireDefault(Collection_1$1);
8086
8087   function _getRequireWildcardCache() {
8088     if (typeof WeakMap !== "function") return null;
8089     var cache = new WeakMap();
8090
8091     _getRequireWildcardCache = function () {
8092       return cache;
8093     };
8094
8095     return cache;
8096   }
8097
8098   function _interopRequireWildcard(obj) {
8099     if (obj && obj.__esModule) {
8100       return obj;
8101     }
8102
8103     if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
8104       return {
8105         default: obj
8106       };
8107     }
8108
8109     var cache = _getRequireWildcardCache();
8110
8111     if (cache && cache.has(obj)) {
8112       return cache.get(obj);
8113     }
8114
8115     var newObj = {};
8116     var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
8117
8118     for (var key in obj) {
8119       if (Object.prototype.hasOwnProperty.call(obj, key)) {
8120         var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
8121
8122         if (desc && (desc.get || desc.set)) {
8123           Object.defineProperty(newObj, key, desc);
8124         } else {
8125           newObj[key] = obj[key];
8126         }
8127       }
8128     }
8129
8130     newObj.default = obj;
8131
8132     if (cache) {
8133       cache.set(obj, newObj);
8134     }
8135
8136     return newObj;
8137   }
8138
8139   function _interopRequireDefault(obj) {
8140     return obj && obj.__esModule ? obj : {
8141       default: obj
8142     };
8143   }
8144
8145   function parseMap(doc, cst) {
8146     if (cst.type !== constants.Type.MAP && cst.type !== constants.Type.FLOW_MAP) {
8147       const msg = `A ${cst.type} node cannot be resolved as a mapping`;
8148       doc.errors.push(new errors.YAMLSyntaxError(cst, msg));
8149       return null;
8150     }
8151
8152     const {
8153       comments,
8154       items
8155     } = cst.type === constants.Type.FLOW_MAP ? resolveFlowMapItems(doc, cst) : resolveBlockMapItems(doc, cst);
8156     const map = new _Map$1.default();
8157     map.items = items;
8158     (0, parseUtils.resolveComments)(map, comments);
8159     let hasCollectionKey = false;
8160
8161     for (let i = 0; i < items.length; ++i) {
8162       const {
8163         key: iKey
8164       } = items[i];
8165       if (iKey instanceof _Collection.default) hasCollectionKey = true;
8166
8167       if (doc.schema.merge && iKey && iKey.value === _Merge.MERGE_KEY) {
8168         items[i] = new _Merge.default(items[i]);
8169         const sources = items[i].value.items;
8170         let error = null;
8171         sources.some(node => {
8172           if (node instanceof _Alias.default) {
8173             // During parsing, alias sources are CST nodes; to account for
8174             // circular references their resolved values can't be used here.
8175             const {
8176               type
8177             } = node.source;
8178             if (type === constants.Type.MAP || type === constants.Type.FLOW_MAP) return false;
8179             return error = 'Merge nodes aliases can only point to maps';
8180           }
8181
8182           return error = 'Merge nodes can only have Alias nodes as values';
8183         });
8184         if (error) doc.errors.push(new errors.YAMLSemanticError(cst, error));
8185       } else {
8186         for (let j = i + 1; j < items.length; ++j) {
8187           const {
8188             key: jKey
8189           } = items[j];
8190
8191           if (iKey === jKey || iKey && jKey && Object.prototype.hasOwnProperty.call(iKey, 'value') && iKey.value === jKey.value) {
8192             const msg = `Map keys must be unique; "${iKey}" is repeated`;
8193             doc.errors.push(new errors.YAMLSemanticError(cst, msg));
8194             break;
8195           }
8196         }
8197       }
8198     }
8199
8200     if (hasCollectionKey && !doc.options.mapAsMap) {
8201       const warn = 'Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.';
8202       doc.warnings.push(new errors.YAMLWarning(cst, warn));
8203     }
8204
8205     cst.resolved = map;
8206     return map;
8207   }
8208
8209   const valueHasPairComment = ({
8210     context: {
8211       lineStart,
8212       node,
8213       src
8214     },
8215     props
8216   }) => {
8217     if (props.length === 0) return false;
8218     const {
8219       start
8220     } = props[0];
8221     if (node && start > node.valueRange.start) return false;
8222     if (src[start] !== constants.Char.COMMENT) return false;
8223
8224     for (let i = lineStart; i < start; ++i) if (src[i] === '\n') return false;
8225
8226     return true;
8227   };
8228
8229   function resolvePairComment(item, pair) {
8230     if (!valueHasPairComment(item)) return;
8231     const comment = item.getPropValue(0, constants.Char.COMMENT, true);
8232     let found = false;
8233     const cb = pair.value.commentBefore;
8234
8235     if (cb && cb.startsWith(comment)) {
8236       pair.value.commentBefore = cb.substr(comment.length + 1);
8237       found = true;
8238     } else {
8239       const cc = pair.value.comment;
8240
8241       if (!item.node && cc && cc.startsWith(comment)) {
8242         pair.value.comment = cc.substr(comment.length + 1);
8243         found = true;
8244       }
8245     }
8246
8247     if (found) pair.comment = comment;
8248   }
8249
8250   function resolveBlockMapItems(doc, cst) {
8251     const comments = [];
8252     const items = [];
8253     let key = undefined;
8254     let keyStart = null;
8255
8256     for (let i = 0; i < cst.items.length; ++i) {
8257       const item = cst.items[i];
8258
8259       switch (item.type) {
8260         case constants.Type.BLANK_LINE:
8261           comments.push({
8262             afterKey: !!key,
8263             before: items.length
8264           });
8265           break;
8266
8267         case constants.Type.COMMENT:
8268           comments.push({
8269             afterKey: !!key,
8270             before: items.length,
8271             comment: item.comment
8272           });
8273           break;
8274
8275         case constants.Type.MAP_KEY:
8276           if (key !== undefined) items.push(new _Pair.default(key));
8277           if (item.error) doc.errors.push(item.error);
8278           key = doc.resolveNode(item.node);
8279           keyStart = null;
8280           break;
8281
8282         case constants.Type.MAP_VALUE:
8283           {
8284             if (key === undefined) key = null;
8285             if (item.error) doc.errors.push(item.error);
8286
8287             if (!item.context.atLineStart && item.node && item.node.type === constants.Type.MAP && !item.node.context.atLineStart) {
8288               const msg = 'Nested mappings are not allowed in compact mappings';
8289               doc.errors.push(new errors.YAMLSemanticError(item.node, msg));
8290             }
8291
8292             let valueNode = item.node;
8293
8294             if (!valueNode && item.props.length > 0) {
8295               // Comments on an empty mapping value need to be preserved, so we
8296               // need to construct a minimal empty node here to use instead of the
8297               // missing `item.node`. -- eemeli/yaml#19
8298               valueNode = new _PlainValue.default(constants.Type.PLAIN, []);
8299               valueNode.context = {
8300                 parent: item,
8301                 src: item.context.src
8302               };
8303               const pos = item.range.start + 1;
8304               valueNode.range = {
8305                 start: pos,
8306                 end: pos
8307               };
8308               valueNode.valueRange = {
8309                 start: pos,
8310                 end: pos
8311               };
8312
8313               if (typeof item.range.origStart === 'number') {
8314                 const origPos = item.range.origStart + 1;
8315                 valueNode.range.origStart = valueNode.range.origEnd = origPos;
8316                 valueNode.valueRange.origStart = valueNode.valueRange.origEnd = origPos;
8317               }
8318             }
8319
8320             const pair = new _Pair.default(key, doc.resolveNode(valueNode));
8321             resolvePairComment(item, pair);
8322             items.push(pair);
8323             (0, parseUtils.checkKeyLength)(doc.errors, cst, i, key, keyStart);
8324             key = undefined;
8325             keyStart = null;
8326           }
8327           break;
8328
8329         default:
8330           if (key !== undefined) items.push(new _Pair.default(key));
8331           key = doc.resolveNode(item);
8332           keyStart = item.range.start;
8333           if (item.error) doc.errors.push(item.error);
8334
8335           next: for (let j = i + 1;; ++j) {
8336             const nextItem = cst.items[j];
8337
8338             switch (nextItem && nextItem.type) {
8339               case constants.Type.BLANK_LINE:
8340               case constants.Type.COMMENT:
8341                 continue next;
8342
8343               case constants.Type.MAP_VALUE:
8344                 break next;
8345
8346               default:
8347                 doc.errors.push(new errors.YAMLSemanticError(item, 'Implicit map keys need to be followed by map values'));
8348                 break next;
8349             }
8350           }
8351
8352           if (item.valueRangeContainsNewline) {
8353             const msg = 'Implicit map keys need to be on a single line';
8354             doc.errors.push(new errors.YAMLSemanticError(item, msg));
8355           }
8356
8357       }
8358     }
8359
8360     if (key !== undefined) items.push(new _Pair.default(key));
8361     return {
8362       comments,
8363       items
8364     };
8365   }
8366
8367   function resolveFlowMapItems(doc, cst) {
8368     const comments = [];
8369     const items = [];
8370     let key = undefined;
8371     let keyStart = null;
8372     let explicitKey = false;
8373     let next = '{';
8374
8375     for (let i = 0; i < cst.items.length; ++i) {
8376       (0, parseUtils.checkKeyLength)(doc.errors, cst, i, key, keyStart);
8377       const item = cst.items[i];
8378
8379       if (typeof item.char === 'string') {
8380         const {
8381           char,
8382           offset
8383         } = item;
8384
8385         if (char === '?' && key === undefined && !explicitKey) {
8386           explicitKey = true;
8387           next = ':';
8388           continue;
8389         }
8390
8391         if (char === ':') {
8392           if (key === undefined) key = null;
8393
8394           if (next === ':') {
8395             next = ',';
8396             continue;
8397           }
8398         } else {
8399           if (explicitKey) {
8400             if (key === undefined && char !== ',') key = null;
8401             explicitKey = false;
8402           }
8403
8404           if (key !== undefined) {
8405             items.push(new _Pair.default(key));
8406             key = undefined;
8407             keyStart = null;
8408
8409             if (char === ',') {
8410               next = ':';
8411               continue;
8412             }
8413           }
8414         }
8415
8416         if (char === '}') {
8417           if (i === cst.items.length - 1) continue;
8418         } else if (char === next) {
8419           next = ':';
8420           continue;
8421         }
8422
8423         const msg = `Flow map contains an unexpected ${char}`;
8424         const err = new errors.YAMLSyntaxError(cst, msg);
8425         err.offset = offset;
8426         doc.errors.push(err);
8427       } else if (item.type === constants.Type.BLANK_LINE) {
8428         comments.push({
8429           afterKey: !!key,
8430           before: items.length
8431         });
8432       } else if (item.type === constants.Type.COMMENT) {
8433         comments.push({
8434           afterKey: !!key,
8435           before: items.length,
8436           comment: item.comment
8437         });
8438       } else if (key === undefined) {
8439         if (next === ',') doc.errors.push(new errors.YAMLSemanticError(item, 'Separator , missing in flow map'));
8440         key = doc.resolveNode(item);
8441         keyStart = explicitKey ? null : item.range.start; // TODO: add error for non-explicit multiline plain key
8442       } else {
8443         if (next !== ',') doc.errors.push(new errors.YAMLSemanticError(item, 'Indicator : missing in flow map entry'));
8444         items.push(new _Pair.default(key, doc.resolveNode(item)));
8445         key = undefined;
8446         explicitKey = false;
8447       }
8448     }
8449
8450     (0, parseUtils.checkFlowCollectionEnd)(doc.errors, cst);
8451     if (key !== undefined) items.push(new _Pair.default(key));
8452     return {
8453       comments,
8454       items
8455     };
8456   }
8457 });
8458 unwrapExports(parseMap_1);
8459
8460 var map = createCommonjsModule(function (module, exports) {
8461
8462   Object.defineProperty(exports, "__esModule", {
8463     value: true
8464   });
8465   exports.default = void 0;
8466
8467   var _Map$1 = _interopRequireDefault(_Map);
8468
8469   var _parseMap = _interopRequireDefault(parseMap_1);
8470
8471   function _interopRequireDefault(obj) {
8472     return obj && obj.__esModule ? obj : {
8473       default: obj
8474     };
8475   }
8476
8477   function createMap(schema, obj, ctx) {
8478     const map = new _Map$1.default(schema);
8479
8480     if (obj instanceof Map) {
8481       for (const [key, value] of obj) map.items.push(schema.createPair(key, value, ctx));
8482     } else if (obj && typeof obj === 'object') {
8483       for (const key of Object.keys(obj)) map.items.push(schema.createPair(key, obj[key], ctx));
8484     }
8485
8486     if (typeof schema.sortMapEntries === 'function') {
8487       map.items.sort(schema.sortMapEntries);
8488     }
8489
8490     return map;
8491   }
8492
8493   var _default = {
8494     createNode: createMap,
8495     default: true,
8496     nodeClass: _Map$1.default,
8497     tag: 'tag:yaml.org,2002:map',
8498     resolve: _parseMap.default
8499   };
8500   exports.default = _default;
8501 });
8502 unwrapExports(map);
8503
8504 var parseSeq_1 = createCommonjsModule(function (module, exports) {
8505
8506   Object.defineProperty(exports, "__esModule", {
8507     value: true
8508   });
8509   exports.default = parseSeq;
8510
8511   var _Pair = _interopRequireDefault(Pair_1);
8512
8513   var _Seq = _interopRequireDefault(Seq);
8514
8515   var _Collection = _interopRequireDefault(Collection_1$1);
8516
8517   function _interopRequireDefault(obj) {
8518     return obj && obj.__esModule ? obj : {
8519       default: obj
8520     };
8521   }
8522
8523   function parseSeq(doc, cst) {
8524     if (cst.type !== constants.Type.SEQ && cst.type !== constants.Type.FLOW_SEQ) {
8525       const msg = `A ${cst.type} node cannot be resolved as a sequence`;
8526       doc.errors.push(new errors.YAMLSyntaxError(cst, msg));
8527       return null;
8528     }
8529
8530     const {
8531       comments,
8532       items
8533     } = cst.type === constants.Type.FLOW_SEQ ? resolveFlowSeqItems(doc, cst) : resolveBlockSeqItems(doc, cst);
8534     const seq = new _Seq.default();
8535     seq.items = items;
8536     (0, parseUtils.resolveComments)(seq, comments);
8537
8538     if (!doc.options.mapAsMap && items.some(it => it instanceof _Pair.default && it.key instanceof _Collection.default)) {
8539       const warn = 'Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.';
8540       doc.warnings.push(new errors.YAMLWarning(cst, warn));
8541     }
8542
8543     cst.resolved = seq;
8544     return seq;
8545   }
8546
8547   function resolveBlockSeqItems(doc, cst) {
8548     const comments = [];
8549     const items = [];
8550
8551     for (let i = 0; i < cst.items.length; ++i) {
8552       const item = cst.items[i];
8553
8554       switch (item.type) {
8555         case constants.Type.BLANK_LINE:
8556           comments.push({
8557             before: items.length
8558           });
8559           break;
8560
8561         case constants.Type.COMMENT:
8562           comments.push({
8563             comment: item.comment,
8564             before: items.length
8565           });
8566           break;
8567
8568         case constants.Type.SEQ_ITEM:
8569           if (item.error) doc.errors.push(item.error);
8570           items.push(doc.resolveNode(item.node));
8571
8572           if (item.hasProps) {
8573             const msg = 'Sequence items cannot have tags or anchors before the - indicator';
8574             doc.errors.push(new errors.YAMLSemanticError(item, msg));
8575           }
8576
8577           break;
8578
8579         default:
8580           if (item.error) doc.errors.push(item.error);
8581           doc.errors.push(new errors.YAMLSyntaxError(item, `Unexpected ${item.type} node in sequence`));
8582       }
8583     }
8584
8585     return {
8586       comments,
8587       items
8588     };
8589   }
8590
8591   function resolveFlowSeqItems(doc, cst) {
8592     const comments = [];
8593     const items = [];
8594     let explicitKey = false;
8595     let key = undefined;
8596     let keyStart = null;
8597     let next = '[';
8598
8599     for (let i = 0; i < cst.items.length; ++i) {
8600       const item = cst.items[i];
8601
8602       if (typeof item.char === 'string') {
8603         const {
8604           char,
8605           offset
8606         } = item;
8607
8608         if (char !== ':' && (explicitKey || key !== undefined)) {
8609           if (explicitKey && key === undefined) key = next ? items.pop() : null;
8610           items.push(new _Pair.default(key));
8611           explicitKey = false;
8612           key = undefined;
8613           keyStart = null;
8614         }
8615
8616         if (char === next) {
8617           next = null;
8618         } else if (!next && char === '?') {
8619           explicitKey = true;
8620         } else if (next !== '[' && char === ':' && key === undefined) {
8621           if (next === ',') {
8622             key = items.pop();
8623
8624             if (key instanceof _Pair.default) {
8625               const msg = 'Chaining flow sequence pairs is invalid';
8626               const err = new errors.YAMLSemanticError(cst, msg);
8627               err.offset = offset;
8628               doc.errors.push(err);
8629             }
8630
8631             if (!explicitKey) (0, parseUtils.checkKeyLength)(doc.errors, cst, i, key, keyStart);
8632           } else {
8633             key = null;
8634           }
8635
8636           keyStart = null;
8637           explicitKey = false; // TODO: add error for non-explicit multiline plain key
8638
8639           next = null;
8640         } else if (next === '[' || char !== ']' || i < cst.items.length - 1) {
8641           const msg = `Flow sequence contains an unexpected ${char}`;
8642           const err = new errors.YAMLSyntaxError(cst, msg);
8643           err.offset = offset;
8644           doc.errors.push(err);
8645         }
8646       } else if (item.type === constants.Type.BLANK_LINE) {
8647         comments.push({
8648           before: items.length
8649         });
8650       } else if (item.type === constants.Type.COMMENT) {
8651         comments.push({
8652           comment: item.comment,
8653           before: items.length
8654         });
8655       } else {
8656         if (next) {
8657           const msg = `Expected a ${next} in flow sequence`;
8658           doc.errors.push(new errors.YAMLSemanticError(item, msg));
8659         }
8660
8661         const value = doc.resolveNode(item);
8662
8663         if (key === undefined) {
8664           items.push(value);
8665         } else {
8666           items.push(new _Pair.default(key, value));
8667           key = undefined;
8668         }
8669
8670         keyStart = item.range.start;
8671         next = ',';
8672       }
8673     }
8674
8675     (0, parseUtils.checkFlowCollectionEnd)(doc.errors, cst);
8676     if (key !== undefined) items.push(new _Pair.default(key));
8677     return {
8678       comments,
8679       items
8680     };
8681   }
8682 });
8683 unwrapExports(parseSeq_1);
8684
8685 var seq = createCommonjsModule(function (module, exports) {
8686
8687   Object.defineProperty(exports, "__esModule", {
8688     value: true
8689   });
8690   exports.default = void 0;
8691
8692   var _parseSeq = _interopRequireDefault(parseSeq_1);
8693
8694   var _Seq = _interopRequireDefault(Seq);
8695
8696   function _interopRequireDefault(obj) {
8697     return obj && obj.__esModule ? obj : {
8698       default: obj
8699     };
8700   }
8701
8702   function createSeq(schema, obj, ctx) {
8703     const seq = new _Seq.default(schema);
8704
8705     if (obj && obj[Symbol.iterator]) {
8706       for (const it of obj) {
8707         const v = schema.createNode(it, ctx.wrapScalars, null, ctx);
8708         seq.items.push(v);
8709       }
8710     }
8711
8712     return seq;
8713   }
8714
8715   var _default = {
8716     createNode: createSeq,
8717     default: true,
8718     nodeClass: _Seq.default,
8719     tag: 'tag:yaml.org,2002:seq',
8720     resolve: _parseSeq.default
8721   };
8722   exports.default = _default;
8723 });
8724 unwrapExports(seq);
8725
8726 var string = createCommonjsModule(function (module, exports) {
8727
8728   Object.defineProperty(exports, "__esModule", {
8729     value: true
8730   });
8731   exports.default = exports.resolveString = void 0;
8732
8733   const resolveString = (doc, node) => {
8734     // on error, will return { str: string, errors: Error[] }
8735     const res = node.strValue;
8736     if (!res) return '';
8737     if (typeof res === 'string') return res;
8738     res.errors.forEach(error => {
8739       if (!error.source) error.source = node;
8740       doc.errors.push(error);
8741     });
8742     return res.str;
8743   };
8744
8745   exports.resolveString = resolveString;
8746   var _default = {
8747     identify: value => typeof value === 'string',
8748     default: true,
8749     tag: 'tag:yaml.org,2002:str',
8750     resolve: resolveString,
8751
8752     stringify(item, ctx, onComment, onChompKeep) {
8753       ctx = Object.assign({
8754         actualString: true
8755       }, ctx);
8756       return (0, stringify.stringifyString)(item, ctx, onComment, onChompKeep);
8757     },
8758
8759     options: options.strOptions
8760   };
8761   exports.default = _default;
8762 });
8763 unwrapExports(string);
8764 var string_1 = string.resolveString;
8765
8766 var failsafe = createCommonjsModule(function (module, exports) {
8767
8768   Object.defineProperty(exports, "__esModule", {
8769     value: true
8770   });
8771   exports.default = void 0;
8772
8773   var _map = _interopRequireDefault(map);
8774
8775   var _seq = _interopRequireDefault(seq);
8776
8777   var _string = _interopRequireDefault(string);
8778
8779   function _interopRequireDefault(obj) {
8780     return obj && obj.__esModule ? obj : {
8781       default: obj
8782     };
8783   }
8784
8785   var _default = [_map.default, _seq.default, _string.default];
8786   exports.default = _default;
8787 });
8788 unwrapExports(failsafe);
8789
8790 var core = createCommonjsModule(function (module, exports) {
8791
8792   Object.defineProperty(exports, "__esModule", {
8793     value: true
8794   });
8795   exports.default = exports.floatObj = exports.expObj = exports.nanObj = exports.hexObj = exports.intObj = exports.octObj = exports.boolObj = exports.nullObj = void 0;
8796
8797   var _Scalar = _interopRequireDefault(Scalar_1);
8798
8799   var _failsafe = _interopRequireDefault(failsafe);
8800
8801   function _interopRequireDefault(obj) {
8802     return obj && obj.__esModule ? obj : {
8803       default: obj
8804     };
8805   }
8806
8807   const nullObj = {
8808     identify: value => value == null,
8809     createNode: (schema, value, ctx) => ctx.wrapScalars ? new _Scalar.default(null) : null,
8810     default: true,
8811     tag: 'tag:yaml.org,2002:null',
8812     test: /^(?:~|[Nn]ull|NULL)?$/,
8813     resolve: () => null,
8814     options: options.nullOptions,
8815     stringify: () => options.nullOptions.nullStr
8816   };
8817   exports.nullObj = nullObj;
8818   const boolObj = {
8819     identify: value => typeof value === 'boolean',
8820     default: true,
8821     tag: 'tag:yaml.org,2002:bool',
8822     test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
8823     resolve: str => str[0] === 't' || str[0] === 'T',
8824     options: options.boolOptions,
8825     stringify: ({
8826       value
8827     }) => value ? options.boolOptions.trueStr : options.boolOptions.falseStr
8828   };
8829   exports.boolObj = boolObj;
8830   const octObj = {
8831     identify: value => typeof value === 'number',
8832     default: true,
8833     tag: 'tag:yaml.org,2002:int',
8834     format: 'OCT',
8835     test: /^0o([0-7]+)$/,
8836     resolve: (str, oct) => parseInt(oct, 8),
8837     stringify: ({
8838       value
8839     }) => '0o' + value.toString(8)
8840   };
8841   exports.octObj = octObj;
8842   const intObj = {
8843     identify: value => typeof value === 'number',
8844     default: true,
8845     tag: 'tag:yaml.org,2002:int',
8846     test: /^[-+]?[0-9]+$/,
8847     resolve: str => parseInt(str, 10),
8848     stringify: stringify.stringifyNumber
8849   };
8850   exports.intObj = intObj;
8851   const hexObj = {
8852     identify: value => typeof value === 'number',
8853     default: true,
8854     tag: 'tag:yaml.org,2002:int',
8855     format: 'HEX',
8856     test: /^0x([0-9a-fA-F]+)$/,
8857     resolve: (str, hex) => parseInt(hex, 16),
8858     stringify: ({
8859       value
8860     }) => '0x' + value.toString(16)
8861   };
8862   exports.hexObj = hexObj;
8863   const nanObj = {
8864     identify: value => typeof value === 'number',
8865     default: true,
8866     tag: 'tag:yaml.org,2002:float',
8867     test: /^(?:[-+]?\.inf|(\.nan))$/i,
8868     resolve: (str, nan) => nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
8869     stringify: stringify.stringifyNumber
8870   };
8871   exports.nanObj = nanObj;
8872   const expObj = {
8873     identify: value => typeof value === 'number',
8874     default: true,
8875     tag: 'tag:yaml.org,2002:float',
8876     format: 'EXP',
8877     test: /^[-+]?(?:0|[1-9][0-9]*)(\.[0-9]*)?[eE][-+]?[0-9]+$/,
8878     resolve: str => parseFloat(str),
8879     stringify: ({
8880       value
8881     }) => Number(value).toExponential()
8882   };
8883   exports.expObj = expObj;
8884   const floatObj = {
8885     identify: value => typeof value === 'number',
8886     default: true,
8887     tag: 'tag:yaml.org,2002:float',
8888     test: /^[-+]?(?:0|[1-9][0-9]*)\.([0-9]*)$/,
8889
8890     resolve(str, frac) {
8891       const node = new _Scalar.default(parseFloat(str));
8892       if (frac && frac[frac.length - 1] === '0') node.minFractionDigits = frac.length;
8893       return node;
8894     },
8895
8896     stringify: stringify.stringifyNumber
8897   };
8898   exports.floatObj = floatObj;
8899
8900   var _default = _failsafe.default.concat([nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj]);
8901
8902   exports.default = _default;
8903 });
8904 unwrapExports(core);
8905 var core_1 = core.floatObj;
8906 var core_2 = core.expObj;
8907 var core_3 = core.nanObj;
8908 var core_4 = core.hexObj;
8909 var core_5 = core.intObj;
8910 var core_6 = core.octObj;
8911 var core_7 = core.boolObj;
8912 var core_8 = core.nullObj;
8913
8914 var json = createCommonjsModule(function (module, exports) {
8915
8916   Object.defineProperty(exports, "__esModule", {
8917     value: true
8918   });
8919   exports.default = void 0;
8920
8921   var _map = _interopRequireDefault(map);
8922
8923   var _seq = _interopRequireDefault(seq);
8924
8925   var _Scalar = _interopRequireDefault(Scalar_1);
8926
8927   function _interopRequireDefault(obj) {
8928     return obj && obj.__esModule ? obj : {
8929       default: obj
8930     };
8931   }
8932
8933   const schema = [_map.default, _seq.default, {
8934     identify: value => typeof value === 'string',
8935     default: true,
8936     tag: 'tag:yaml.org,2002:str',
8937     resolve: string.resolveString,
8938     stringify: value => JSON.stringify(value)
8939   }, {
8940     identify: value => value == null,
8941     createNode: (schema, value, ctx) => ctx.wrapScalars ? new _Scalar.default(null) : null,
8942     default: true,
8943     tag: 'tag:yaml.org,2002:null',
8944     test: /^null$/,
8945     resolve: () => null,
8946     stringify: value => JSON.stringify(value)
8947   }, {
8948     identify: value => typeof value === 'boolean',
8949     default: true,
8950     tag: 'tag:yaml.org,2002:bool',
8951     test: /^true|false$/,
8952     resolve: str => str === 'true',
8953     stringify: value => JSON.stringify(value)
8954   }, {
8955     identify: value => typeof value === 'number',
8956     default: true,
8957     tag: 'tag:yaml.org,2002:int',
8958     test: /^-?(?:0|[1-9][0-9]*)$/,
8959     resolve: str => parseInt(str, 10),
8960     stringify: value => JSON.stringify(value)
8961   }, {
8962     identify: value => typeof value === 'number',
8963     default: true,
8964     tag: 'tag:yaml.org,2002:float',
8965     test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
8966     resolve: str => parseFloat(str),
8967     stringify: value => JSON.stringify(value)
8968   }];
8969
8970   schema.scalarFallback = str => {
8971     throw new SyntaxError(`Unresolved plain scalar ${JSON.stringify(str)}`);
8972   };
8973
8974   var _default = schema;
8975   exports.default = _default;
8976 });
8977 unwrapExports(json);
8978
8979 var binary = createCommonjsModule(function (module, exports) {
8980
8981   Object.defineProperty(exports, "__esModule", {
8982     value: true
8983   });
8984   exports.default = void 0;
8985   /* global atob, btoa, Buffer */
8986
8987   var _default = {
8988     identify: value => value instanceof Uint8Array,
8989     // Buffer inherits from Uint8Array
8990     default: false,
8991     tag: 'tag:yaml.org,2002:binary',
8992
8993     /**
8994      * Returns a Buffer in node and an Uint8Array in browsers
8995      *
8996      * To use the resulting buffer as an image, you'll want to do something like:
8997      *
8998      *   const blob = new Blob([buffer], { type: 'image/jpeg' })
8999      *   document.querySelector('#photo').src = URL.createObjectURL(blob)
9000      */
9001     resolve: (doc, node) => {
9002       if (typeof Buffer === 'function') {
9003         const src = (0, string.resolveString)(doc, node);
9004         return Buffer.from(src, 'base64');
9005       } else if (typeof atob === 'function') {
9006         const src = atob((0, string.resolveString)(doc, node));
9007         const buffer = new Uint8Array(src.length);
9008
9009         for (let i = 0; i < src.length; ++i) buffer[i] = src.charCodeAt(i);
9010
9011         return buffer;
9012       } else {
9013         doc.errors.push(new errors.YAMLReferenceError(node, 'This environment does not support reading binary tags; either Buffer or atob is required'));
9014         return null;
9015       }
9016     },
9017     options: options.binaryOptions,
9018     stringify: ({
9019       comment,
9020       type,
9021       value
9022     }, ctx, onComment, onChompKeep) => {
9023       let src;
9024
9025       if (typeof Buffer === 'function') {
9026         src = value instanceof Buffer ? value.toString('base64') : Buffer.from(value.buffer).toString('base64');
9027       } else if (typeof btoa === 'function') {
9028         let s = '';
9029
9030         for (let i = 0; i < value.length; ++i) s += String.fromCharCode(value[i]);
9031
9032         src = btoa(s);
9033       } else {
9034         throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
9035       }
9036
9037       if (!type) type = options.binaryOptions.defaultType;
9038
9039       if (type === constants.Type.QUOTE_DOUBLE) {
9040         value = src;
9041       } else {
9042         const {
9043           lineWidth
9044         } = options.binaryOptions;
9045         const n = Math.ceil(src.length / lineWidth);
9046         const lines = new Array(n);
9047
9048         for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
9049           lines[i] = src.substr(o, lineWidth);
9050         }
9051
9052         value = lines.join(type === constants.Type.BLOCK_LITERAL ? '\n' : ' ');
9053       }
9054
9055       return (0, stringify.stringifyString)({
9056         comment,
9057         type,
9058         value
9059       }, ctx, onComment, onChompKeep);
9060     }
9061   };
9062   exports.default = _default;
9063 });
9064 unwrapExports(binary);
9065
9066 var pairs = createCommonjsModule(function (module, exports) {
9067
9068   Object.defineProperty(exports, "__esModule", {
9069     value: true
9070   });
9071   exports.parsePairs = parsePairs;
9072   exports.createPairs = createPairs;
9073   exports.default = void 0;
9074
9075   var _Map$1 = _interopRequireDefault(_Map);
9076
9077   var _Pair = _interopRequireDefault(Pair_1);
9078
9079   var _parseSeq = _interopRequireDefault(parseSeq_1);
9080
9081   var _Seq = _interopRequireDefault(Seq);
9082
9083   function _interopRequireDefault(obj) {
9084     return obj && obj.__esModule ? obj : {
9085       default: obj
9086     };
9087   }
9088
9089   function parsePairs(doc, cst) {
9090     const seq = (0, _parseSeq.default)(doc, cst);
9091
9092     for (let i = 0; i < seq.items.length; ++i) {
9093       let item = seq.items[i];
9094       if (item instanceof _Pair.default) continue;else if (item instanceof _Map$1.default) {
9095         if (item.items.length > 1) {
9096           const msg = 'Each pair must have its own sequence indicator';
9097           throw new errors.YAMLSemanticError(cst, msg);
9098         }
9099
9100         const pair = item.items[0] || new _Pair.default();
9101         if (item.commentBefore) pair.commentBefore = pair.commentBefore ? `${item.commentBefore}\n${pair.commentBefore}` : item.commentBefore;
9102         if (item.comment) pair.comment = pair.comment ? `${item.comment}\n${pair.comment}` : item.comment;
9103         item = pair;
9104       }
9105       seq.items[i] = item instanceof _Pair.default ? item : new _Pair.default(item);
9106     }
9107
9108     return seq;
9109   }
9110
9111   function createPairs(schema, iterable, ctx) {
9112     const pairs = new _Seq.default(schema);
9113     pairs.tag = 'tag:yaml.org,2002:pairs';
9114
9115     for (const it of iterable) {
9116       let key, value;
9117
9118       if (Array.isArray(it)) {
9119         if (it.length === 2) {
9120           key = it[0];
9121           value = it[1];
9122         } else throw new TypeError(`Expected [key, value] tuple: ${it}`);
9123       } else if (it && it instanceof Object) {
9124         const keys = Object.keys(it);
9125
9126         if (keys.length === 1) {
9127           key = keys[0];
9128           value = it[key];
9129         } else throw new TypeError(`Expected { key: value } tuple: ${it}`);
9130       } else {
9131         key = it;
9132       }
9133
9134       const pair = schema.createPair(key, value, ctx);
9135       pairs.items.push(pair);
9136     }
9137
9138     return pairs;
9139   }
9140
9141   var _default = {
9142     default: false,
9143     tag: 'tag:yaml.org,2002:pairs',
9144     resolve: parsePairs,
9145     createNode: createPairs
9146   };
9147   exports.default = _default;
9148 });
9149 unwrapExports(pairs);
9150 var pairs_1 = pairs.parsePairs;
9151 var pairs_2 = pairs.createPairs;
9152
9153 var omap = createCommonjsModule(function (module, exports) {
9154
9155   Object.defineProperty(exports, "__esModule", {
9156     value: true
9157   });
9158   exports.default = exports.YAMLOMap = void 0;
9159
9160   var _toJSON = _interopRequireDefault(toJSON_1);
9161
9162   var _Map$1 = _interopRequireDefault(_Map);
9163
9164   var _Pair = _interopRequireDefault(Pair_1);
9165
9166   var _Scalar = _interopRequireDefault(Scalar_1);
9167
9168   var _Seq = _interopRequireDefault(Seq);
9169
9170   function _interopRequireDefault(obj) {
9171     return obj && obj.__esModule ? obj : {
9172       default: obj
9173     };
9174   }
9175
9176   function _defineProperty(obj, key, value) {
9177     if (key in obj) {
9178       Object.defineProperty(obj, key, {
9179         value: value,
9180         enumerable: true,
9181         configurable: true,
9182         writable: true
9183       });
9184     } else {
9185       obj[key] = value;
9186     }
9187
9188     return obj;
9189   }
9190
9191   class YAMLOMap extends _Seq.default {
9192     constructor() {
9193       super();
9194
9195       _defineProperty(this, "add", _Map$1.default.prototype.add.bind(this));
9196
9197       _defineProperty(this, "delete", _Map$1.default.prototype.delete.bind(this));
9198
9199       _defineProperty(this, "get", _Map$1.default.prototype.get.bind(this));
9200
9201       _defineProperty(this, "has", _Map$1.default.prototype.has.bind(this));
9202
9203       _defineProperty(this, "set", _Map$1.default.prototype.set.bind(this));
9204
9205       this.tag = YAMLOMap.tag;
9206     }
9207
9208     toJSON(_, ctx) {
9209       const map = new Map();
9210       if (ctx && ctx.onCreate) ctx.onCreate(map);
9211
9212       for (const pair of this.items) {
9213         let key, value;
9214
9215         if (pair instanceof _Pair.default) {
9216           key = (0, _toJSON.default)(pair.key, '', ctx);
9217           value = (0, _toJSON.default)(pair.value, key, ctx);
9218         } else {
9219           key = (0, _toJSON.default)(pair, '', ctx);
9220         }
9221
9222         if (map.has(key)) throw new Error('Ordered maps must not include duplicate keys');
9223         map.set(key, value);
9224       }
9225
9226       return map;
9227     }
9228
9229   }
9230
9231   exports.YAMLOMap = YAMLOMap;
9232
9233   _defineProperty(YAMLOMap, "tag", 'tag:yaml.org,2002:omap');
9234
9235   function parseOMap(doc, cst) {
9236     const pairs$1 = (0, pairs.parsePairs)(doc, cst);
9237     const seenKeys = [];
9238
9239     for (const {
9240       key
9241     } of pairs$1.items) {
9242       if (key instanceof _Scalar.default) {
9243         if (seenKeys.includes(key.value)) {
9244           const msg = 'Ordered maps must not include duplicate keys';
9245           throw new errors.YAMLSemanticError(cst, msg);
9246         } else {
9247           seenKeys.push(key.value);
9248         }
9249       }
9250     }
9251
9252     return Object.assign(new YAMLOMap(), pairs$1);
9253   }
9254
9255   function createOMap(schema, iterable, ctx) {
9256     const pairs$1 = (0, pairs.createPairs)(schema, iterable, ctx);
9257     const omap = new YAMLOMap();
9258     omap.items = pairs$1.items;
9259     return omap;
9260   }
9261
9262   var _default = {
9263     identify: value => value instanceof Map,
9264     nodeClass: YAMLOMap,
9265     default: false,
9266     tag: 'tag:yaml.org,2002:omap',
9267     resolve: parseOMap,
9268     createNode: createOMap
9269   };
9270   exports.default = _default;
9271 });
9272 unwrapExports(omap);
9273 var omap_1 = omap.YAMLOMap;
9274
9275 var set = createCommonjsModule(function (module, exports) {
9276
9277   Object.defineProperty(exports, "__esModule", {
9278     value: true
9279   });
9280   exports.default = exports.YAMLSet = void 0;
9281
9282   var _Map$1 = _interopRequireWildcard(_Map);
9283
9284   var _Pair = _interopRequireDefault(Pair_1);
9285
9286   var _parseMap = _interopRequireDefault(parseMap_1);
9287
9288   var _Scalar = _interopRequireDefault(Scalar_1);
9289
9290   function _interopRequireDefault(obj) {
9291     return obj && obj.__esModule ? obj : {
9292       default: obj
9293     };
9294   }
9295
9296   function _getRequireWildcardCache() {
9297     if (typeof WeakMap !== "function") return null;
9298     var cache = new WeakMap();
9299
9300     _getRequireWildcardCache = function () {
9301       return cache;
9302     };
9303
9304     return cache;
9305   }
9306
9307   function _interopRequireWildcard(obj) {
9308     if (obj && obj.__esModule) {
9309       return obj;
9310     }
9311
9312     if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
9313       return {
9314         default: obj
9315       };
9316     }
9317
9318     var cache = _getRequireWildcardCache();
9319
9320     if (cache && cache.has(obj)) {
9321       return cache.get(obj);
9322     }
9323
9324     var newObj = {};
9325     var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
9326
9327     for (var key in obj) {
9328       if (Object.prototype.hasOwnProperty.call(obj, key)) {
9329         var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
9330
9331         if (desc && (desc.get || desc.set)) {
9332           Object.defineProperty(newObj, key, desc);
9333         } else {
9334           newObj[key] = obj[key];
9335         }
9336       }
9337     }
9338
9339     newObj.default = obj;
9340
9341     if (cache) {
9342       cache.set(obj, newObj);
9343     }
9344
9345     return newObj;
9346   }
9347
9348   function _defineProperty(obj, key, value) {
9349     if (key in obj) {
9350       Object.defineProperty(obj, key, {
9351         value: value,
9352         enumerable: true,
9353         configurable: true,
9354         writable: true
9355       });
9356     } else {
9357       obj[key] = value;
9358     }
9359
9360     return obj;
9361   }
9362
9363   class YAMLSet extends _Map$1.default {
9364     constructor() {
9365       super();
9366       this.tag = YAMLSet.tag;
9367     }
9368
9369     add(key) {
9370       const pair = key instanceof _Pair.default ? key : new _Pair.default(key);
9371       const prev = (0, _Map$1.findPair)(this.items, pair.key);
9372       if (!prev) this.items.push(pair);
9373     }
9374
9375     get(key, keepPair) {
9376       const pair = (0, _Map$1.findPair)(this.items, key);
9377       return !keepPair && pair instanceof _Pair.default ? pair.key instanceof _Scalar.default ? pair.key.value : pair.key : pair;
9378     }
9379
9380     set(key, value) {
9381       if (typeof value !== 'boolean') throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
9382       const prev = (0, _Map$1.findPair)(this.items, key);
9383
9384       if (prev && !value) {
9385         this.items.splice(this.items.indexOf(prev), 1);
9386       } else if (!prev && value) {
9387         this.items.push(new _Pair.default(key));
9388       }
9389     }
9390
9391     toJSON(_, ctx) {
9392       return super.toJSON(_, ctx, Set);
9393     }
9394
9395     toString(ctx, onComment, onChompKeep) {
9396       if (!ctx) return JSON.stringify(this);
9397       if (this.hasAllNullValues()) return super.toString(ctx, onComment, onChompKeep);else throw new Error('Set items must all have null values');
9398     }
9399
9400   }
9401
9402   exports.YAMLSet = YAMLSet;
9403
9404   _defineProperty(YAMLSet, "tag", 'tag:yaml.org,2002:set');
9405
9406   function parseSet(doc, cst) {
9407     const map = (0, _parseMap.default)(doc, cst);
9408     if (!map.hasAllNullValues()) throw new errors.YAMLSemanticError(cst, 'Set items must all have null values');
9409     return Object.assign(new YAMLSet(), map);
9410   }
9411
9412   function createSet(schema, iterable, ctx) {
9413     const set = new YAMLSet();
9414
9415     for (const value of iterable) set.items.push(schema.createPair(value, null, ctx));
9416
9417     return set;
9418   }
9419
9420   var _default = {
9421     identify: value => value instanceof Set,
9422     nodeClass: YAMLSet,
9423     default: false,
9424     tag: 'tag:yaml.org,2002:set',
9425     resolve: parseSet,
9426     createNode: createSet
9427   };
9428   exports.default = _default;
9429 });
9430 unwrapExports(set);
9431 var set_1 = set.YAMLSet;
9432
9433 var timestamp_1 = createCommonjsModule(function (module, exports) {
9434
9435   Object.defineProperty(exports, "__esModule", {
9436     value: true
9437   });
9438   exports.timestamp = exports.floatTime = exports.intTime = void 0;
9439
9440   const parseSexagesimal = (sign, parts) => {
9441     const n = parts.split(':').reduce((n, p) => n * 60 + Number(p), 0);
9442     return sign === '-' ? -n : n;
9443   }; // hhhh:mm:ss.sss
9444
9445
9446   const stringifySexagesimal = ({
9447     value
9448   }) => {
9449     if (isNaN(value) || !isFinite(value)) return (0, stringify.stringifyNumber)(value);
9450     let sign = '';
9451
9452     if (value < 0) {
9453       sign = '-';
9454       value = Math.abs(value);
9455     }
9456
9457     const parts = [value % 60]; // seconds, including ms
9458
9459     if (value < 60) {
9460       parts.unshift(0); // at least one : is required
9461     } else {
9462       value = Math.round((value - parts[0]) / 60);
9463       parts.unshift(value % 60); // minutes
9464
9465       if (value >= 60) {
9466         value = Math.round((value - parts[0]) / 60);
9467         parts.unshift(value); // hours
9468       }
9469     }
9470
9471     return sign + parts.map(n => n < 10 ? '0' + String(n) : String(n)).join(':').replace(/000000\d*$/, '') // % 60 may introduce error
9472     ;
9473   };
9474
9475   const intTime = {
9476     identify: value => typeof value === 'number',
9477     default: true,
9478     tag: 'tag:yaml.org,2002:int',
9479     format: 'TIME',
9480     test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/,
9481     resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, '')),
9482     stringify: stringifySexagesimal
9483   };
9484   exports.intTime = intTime;
9485   const floatTime = {
9486     identify: value => typeof value === 'number',
9487     default: true,
9488     tag: 'tag:yaml.org,2002:float',
9489     format: 'TIME',
9490     test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/,
9491     resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, '')),
9492     stringify: stringifySexagesimal
9493   };
9494   exports.floatTime = floatTime;
9495   const timestamp = {
9496     identify: value => value instanceof Date,
9497     default: true,
9498     tag: 'tag:yaml.org,2002:timestamp',
9499     // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
9500     // may be omitted altogether, resulting in a date format. In such a case, the time part is
9501     // assumed to be 00:00:00Z (start of day, UTC).
9502     test: RegExp('^(?:' + '([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})' + // YYYY-Mm-Dd
9503     '(?:(?:t|T|[ \\t]+)' + // t | T | whitespace
9504     '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)' + // Hh:Mm:Ss(.ss)?
9505     '(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30
9506     ')?' + ')$'),
9507     resolve: (str, year, month, day, hour, minute, second, millisec, tz) => {
9508       if (millisec) millisec = (millisec + '00').substr(1, 3);
9509       let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec || 0);
9510
9511       if (tz && tz !== 'Z') {
9512         let d = parseSexagesimal(tz[0], tz.slice(1));
9513         if (Math.abs(d) < 30) d *= 60;
9514         date -= 60000 * d;
9515       }
9516
9517       return new Date(date);
9518     },
9519     stringify: ({
9520       value
9521     }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
9522   };
9523   exports.timestamp = timestamp;
9524 });
9525 unwrapExports(timestamp_1);
9526 var timestamp_2 = timestamp_1.timestamp;
9527 var timestamp_3 = timestamp_1.floatTime;
9528 var timestamp_4 = timestamp_1.intTime;
9529
9530 var yaml1_1 = createCommonjsModule(function (module, exports) {
9531
9532   Object.defineProperty(exports, "__esModule", {
9533     value: true
9534   });
9535   exports.default = void 0;
9536
9537   var _Scalar = _interopRequireDefault(Scalar_1);
9538
9539   var _failsafe = _interopRequireDefault(failsafe);
9540
9541   var _binary = _interopRequireDefault(binary);
9542
9543   var _omap = _interopRequireDefault(omap);
9544
9545   var _pairs = _interopRequireDefault(pairs);
9546
9547   var _set = _interopRequireDefault(set);
9548
9549   function _interopRequireDefault(obj) {
9550     return obj && obj.__esModule ? obj : {
9551       default: obj
9552     };
9553   }
9554
9555   const boolStringify = ({
9556     value
9557   }) => value ? options.boolOptions.trueStr : options.boolOptions.falseStr;
9558
9559   var _default = _failsafe.default.concat([{
9560     identify: value => value == null,
9561     createNode: (schema, value, ctx) => ctx.wrapScalars ? new _Scalar.default(null) : null,
9562     default: true,
9563     tag: 'tag:yaml.org,2002:null',
9564     test: /^(?:~|[Nn]ull|NULL)?$/,
9565     resolve: () => null,
9566     options: options.nullOptions,
9567     stringify: () => options.nullOptions.nullStr
9568   }, {
9569     identify: value => typeof value === 'boolean',
9570     default: true,
9571     tag: 'tag:yaml.org,2002:bool',
9572     test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
9573     resolve: () => true,
9574     options: options.boolOptions,
9575     stringify: boolStringify
9576   }, {
9577     identify: value => typeof value === 'boolean',
9578     default: true,
9579     tag: 'tag:yaml.org,2002:bool',
9580     test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
9581     resolve: () => false,
9582     options: options.boolOptions,
9583     stringify: boolStringify
9584   }, {
9585     identify: value => typeof value === 'number',
9586     default: true,
9587     tag: 'tag:yaml.org,2002:int',
9588     format: 'BIN',
9589     test: /^0b([0-1_]+)$/,
9590     resolve: (str, bin) => parseInt(bin.replace(/_/g, ''), 2),
9591     stringify: ({
9592       value
9593     }) => '0b' + value.toString(2)
9594   }, {
9595     identify: value => typeof value === 'number',
9596     default: true,
9597     tag: 'tag:yaml.org,2002:int',
9598     format: 'OCT',
9599     test: /^[-+]?0([0-7_]+)$/,
9600     resolve: (str, oct) => parseInt(oct.replace(/_/g, ''), 8),
9601     stringify: ({
9602       value
9603     }) => (value < 0 ? '-0' : '0') + value.toString(8)
9604   }, {
9605     identify: value => typeof value === 'number',
9606     default: true,
9607     tag: 'tag:yaml.org,2002:int',
9608     test: /^[-+]?[0-9][0-9_]*$/,
9609     resolve: str => parseInt(str.replace(/_/g, ''), 10),
9610     stringify: stringify.stringifyNumber
9611   }, {
9612     identify: value => typeof value === 'number',
9613     default: true,
9614     tag: 'tag:yaml.org,2002:int',
9615     format: 'HEX',
9616     test: /^0x([0-9a-fA-F_]+)$/,
9617     resolve: (str, hex) => parseInt(hex.replace(/_/g, ''), 16),
9618     stringify: ({
9619       value
9620     }) => (value < 0 ? '-0x' : '0x') + value.toString(16)
9621   }, {
9622     identify: value => typeof value === 'number',
9623     default: true,
9624     tag: 'tag:yaml.org,2002:float',
9625     test: /^(?:[-+]?\.inf|(\.nan))$/i,
9626     resolve: (str, nan) => nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
9627     stringify: stringify.stringifyNumber
9628   }, {
9629     identify: value => typeof value === 'number',
9630     default: true,
9631     tag: 'tag:yaml.org,2002:float',
9632     format: 'EXP',
9633     test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/,
9634     resolve: str => parseFloat(str.replace(/_/g, '')),
9635     stringify: ({
9636       value
9637     }) => Number(value).toExponential()
9638   }, {
9639     identify: value => typeof value === 'number',
9640     default: true,
9641     tag: 'tag:yaml.org,2002:float',
9642     test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/,
9643
9644     resolve(str, frac) {
9645       const node = new _Scalar.default(parseFloat(str.replace(/_/g, '')));
9646
9647       if (frac) {
9648         const f = frac.replace(/_/g, '');
9649         if (f[f.length - 1] === '0') node.minFractionDigits = f.length;
9650       }
9651
9652       return node;
9653     },
9654
9655     stringify: stringify.stringifyNumber
9656   }], _binary.default, _omap.default, _pairs.default, _set.default, timestamp_1.intTime, timestamp_1.floatTime, timestamp_1.timestamp);
9657
9658   exports.default = _default;
9659 });
9660 unwrapExports(yaml1_1);
9661
9662 var tags_1 = createCommonjsModule(function (module, exports) {
9663
9664   Object.defineProperty(exports, "__esModule", {
9665     value: true
9666   });
9667   exports.tags = exports.schemas = void 0;
9668
9669   var _core = _interopRequireWildcard(core);
9670
9671   var _failsafe = _interopRequireDefault(failsafe);
9672
9673   var _json = _interopRequireDefault(json);
9674
9675   var _yaml = _interopRequireDefault(yaml1_1);
9676
9677   var _map = _interopRequireDefault(map);
9678
9679   var _seq = _interopRequireDefault(seq);
9680
9681   var _binary = _interopRequireDefault(binary);
9682
9683   var _omap = _interopRequireDefault(omap);
9684
9685   var _pairs = _interopRequireDefault(pairs);
9686
9687   var _set = _interopRequireDefault(set);
9688
9689   function _interopRequireDefault(obj) {
9690     return obj && obj.__esModule ? obj : {
9691       default: obj
9692     };
9693   }
9694
9695   function _getRequireWildcardCache() {
9696     if (typeof WeakMap !== "function") return null;
9697     var cache = new WeakMap();
9698
9699     _getRequireWildcardCache = function () {
9700       return cache;
9701     };
9702
9703     return cache;
9704   }
9705
9706   function _interopRequireWildcard(obj) {
9707     if (obj && obj.__esModule) {
9708       return obj;
9709     }
9710
9711     if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
9712       return {
9713         default: obj
9714       };
9715     }
9716
9717     var cache = _getRequireWildcardCache();
9718
9719     if (cache && cache.has(obj)) {
9720       return cache.get(obj);
9721     }
9722
9723     var newObj = {};
9724     var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
9725
9726     for (var key in obj) {
9727       if (Object.prototype.hasOwnProperty.call(obj, key)) {
9728         var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
9729
9730         if (desc && (desc.get || desc.set)) {
9731           Object.defineProperty(newObj, key, desc);
9732         } else {
9733           newObj[key] = obj[key];
9734         }
9735       }
9736     }
9737
9738     newObj.default = obj;
9739
9740     if (cache) {
9741       cache.set(obj, newObj);
9742     }
9743
9744     return newObj;
9745   }
9746
9747   const schemas = {
9748     core: _core.default,
9749     failsafe: _failsafe.default,
9750     json: _json.default,
9751     yaml11: _yaml.default
9752   };
9753   exports.schemas = schemas;
9754   const tags = {
9755     binary: _binary.default,
9756     bool: _core.boolObj,
9757     float: _core.floatObj,
9758     floatExp: _core.expObj,
9759     floatNaN: _core.nanObj,
9760     floatTime: timestamp_1.floatTime,
9761     int: _core.intObj,
9762     intHex: _core.hexObj,
9763     intOct: _core.octObj,
9764     intTime: timestamp_1.intTime,
9765     map: _map.default,
9766     null: _core.nullObj,
9767     omap: _omap.default,
9768     pairs: _pairs.default,
9769     seq: _seq.default,
9770     set: _set.default,
9771     timestamp: timestamp_1.timestamp
9772   };
9773   exports.tags = tags;
9774 });
9775 unwrapExports(tags_1);
9776 var tags_2 = tags_1.tags;
9777 var tags_3 = tags_1.schemas;
9778
9779 var schema = createCommonjsModule(function (module, exports) {
9780
9781   Object.defineProperty(exports, "__esModule", {
9782     value: true
9783   });
9784   exports.default = void 0;
9785
9786   var _Alias = _interopRequireDefault(Alias_1$1);
9787
9788   var _Collection = _interopRequireDefault(Collection_1$1);
9789
9790   var _Node = _interopRequireDefault(Node_1$1);
9791
9792   var _Pair = _interopRequireDefault(Pair_1);
9793
9794   var _Scalar = _interopRequireDefault(Scalar_1);
9795
9796   function _interopRequireDefault(obj) {
9797     return obj && obj.__esModule ? obj : {
9798       default: obj
9799     };
9800   }
9801
9802   function _defineProperty(obj, key, value) {
9803     if (key in obj) {
9804       Object.defineProperty(obj, key, {
9805         value: value,
9806         enumerable: true,
9807         configurable: true,
9808         writable: true
9809       });
9810     } else {
9811       obj[key] = value;
9812     }
9813
9814     return obj;
9815   }
9816
9817   const isMap = ({
9818     type
9819   }) => type === constants.Type.FLOW_MAP || type === constants.Type.MAP;
9820
9821   const isSeq = ({
9822     type
9823   }) => type === constants.Type.FLOW_SEQ || type === constants.Type.SEQ;
9824
9825   class Schema {
9826     constructor({
9827       customTags,
9828       merge,
9829       schema,
9830       sortMapEntries,
9831       tags: deprecatedCustomTags
9832     }) {
9833       this.merge = !!merge;
9834       this.name = schema;
9835       this.sortMapEntries = sortMapEntries === true ? (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0 : sortMapEntries || null;
9836       this.tags = tags_1.schemas[schema.replace(/\W/g, '')]; // 'yaml-1.1' -> 'yaml11'
9837
9838       if (!this.tags) {
9839         const keys = Object.keys(tags_1.schemas).map(key => JSON.stringify(key)).join(', ');
9840         throw new Error(`Unknown schema "${schema}"; use one of ${keys}`);
9841       }
9842
9843       if (!customTags && deprecatedCustomTags) {
9844         customTags = deprecatedCustomTags;
9845         (0, warnings.warnOptionDeprecation)('tags', 'customTags');
9846       }
9847
9848       if (Array.isArray(customTags)) {
9849         for (const tag of customTags) this.tags = this.tags.concat(tag);
9850       } else if (typeof customTags === 'function') {
9851         this.tags = customTags(this.tags.slice());
9852       }
9853
9854       for (let i = 0; i < this.tags.length; ++i) {
9855         const tag = this.tags[i];
9856
9857         if (typeof tag === 'string') {
9858           const tagObj = tags_1.tags[tag];
9859
9860           if (!tagObj) {
9861             const keys = Object.keys(tags_1.tags).map(key => JSON.stringify(key)).join(', ');
9862             throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
9863           }
9864
9865           this.tags[i] = tagObj;
9866         }
9867       }
9868     }
9869
9870     createNode(value, wrapScalars, tag, ctx) {
9871       if (value instanceof _Node.default) return value;
9872       let tagObj;
9873
9874       if (tag) {
9875         if (tag.startsWith('!!')) tag = Schema.defaultPrefix + tag.slice(2);
9876         const match = this.tags.filter(t => t.tag === tag);
9877         tagObj = match.find(t => !t.format) || match[0];
9878         if (!tagObj) throw new Error(`Tag ${tag} not found`);
9879       } else {
9880         // TODO: deprecate/remove class check
9881         tagObj = this.tags.find(t => (t.identify && t.identify(value) || t.class && value instanceof t.class) && !t.format);
9882
9883         if (!tagObj) {
9884           if (typeof value.toJSON === 'function') value = value.toJSON();
9885           if (typeof value !== 'object') return wrapScalars ? new _Scalar.default(value) : value;
9886           tagObj = value instanceof Map ? tags_1.tags.map : value[Symbol.iterator] ? tags_1.tags.seq : tags_1.tags.map;
9887         }
9888       }
9889
9890       if (!ctx) ctx = {
9891         wrapScalars
9892       };else ctx.wrapScalars = wrapScalars;
9893
9894       if (ctx.onTagObj) {
9895         ctx.onTagObj(tagObj);
9896         delete ctx.onTagObj;
9897       }
9898
9899       const obj = {};
9900
9901       if (value && typeof value === 'object' && ctx.prevObjects) {
9902         const prev = ctx.prevObjects.get(value);
9903
9904         if (prev) {
9905           const alias = new _Alias.default(prev); // leaves source dirty; must be cleaned by caller
9906
9907           ctx.aliasNodes.push(alias);
9908           return alias;
9909         }
9910
9911         obj.value = value;
9912         ctx.prevObjects.set(value, obj);
9913       }
9914
9915       obj.node = tagObj.createNode ? tagObj.createNode(this, value, ctx) : wrapScalars ? new _Scalar.default(value) : value;
9916       if (tag && obj.node instanceof _Node.default) obj.node.tag = tag;
9917       return obj.node;
9918     }
9919
9920     createPair(key, value, ctx) {
9921       const k = this.createNode(key, ctx.wrapScalars, null, ctx);
9922       const v = this.createNode(value, ctx.wrapScalars, null, ctx);
9923       return new _Pair.default(k, v);
9924     } // falls back to string on no match
9925
9926
9927     resolveScalar(str, tags) {
9928       if (!tags) tags = this.tags;
9929
9930       for (let i = 0; i < tags.length; ++i) {
9931         const {
9932           format,
9933           test,
9934           resolve
9935         } = tags[i];
9936
9937         if (test) {
9938           const match = str.match(test);
9939
9940           if (match) {
9941             let res = resolve.apply(null, match);
9942             if (!(res instanceof _Scalar.default)) res = new _Scalar.default(res);
9943             if (format) res.format = format;
9944             return res;
9945           }
9946         }
9947       }
9948
9949       if (this.tags.scalarFallback) str = this.tags.scalarFallback(str);
9950       return new _Scalar.default(str);
9951     } // sets node.resolved on success
9952
9953
9954     resolveNode(doc, node, tagName) {
9955       const tags = this.tags.filter(({
9956         tag
9957       }) => tag === tagName);
9958       const generic = tags.find(({
9959         test
9960       }) => !test);
9961       if (node.error) doc.errors.push(node.error);
9962
9963       try {
9964         if (generic) {
9965           let res = generic.resolve(doc, node);
9966           if (!(res instanceof _Collection.default)) res = new _Scalar.default(res);
9967           node.resolved = res;
9968         } else {
9969           const str = (0, string.resolveString)(doc, node);
9970
9971           if (typeof str === 'string' && tags.length > 0) {
9972             node.resolved = this.resolveScalar(str, tags);
9973           }
9974         }
9975       } catch (error) {
9976         /* istanbul ignore if */
9977         if (!error.source) error.source = node;
9978         doc.errors.push(error);
9979         node.resolved = null;
9980       }
9981
9982       if (!node.resolved) return null;
9983       if (tagName && node.tag) node.resolved.tag = tagName;
9984       return node.resolved;
9985     }
9986
9987     resolveNodeWithFallback(doc, node, tagName) {
9988       const res = this.resolveNode(doc, node, tagName);
9989       if (Object.prototype.hasOwnProperty.call(node, 'resolved')) return res;
9990       const fallback = isMap(node) ? Schema.defaultTags.MAP : isSeq(node) ? Schema.defaultTags.SEQ : Schema.defaultTags.STR;
9991       /* istanbul ignore else */
9992
9993       if (fallback) {
9994         doc.warnings.push(new errors.YAMLWarning(node, `The tag ${tagName} is unavailable, falling back to ${fallback}`));
9995         const res = this.resolveNode(doc, node, fallback);
9996         res.tag = tagName;
9997         return res;
9998       } else {
9999         doc.errors.push(new errors.YAMLReferenceError(node, `The tag ${tagName} is unavailable`));
10000         return null;
10001       }
10002     }
10003
10004     getTagObject(item) {
10005       if (item instanceof _Alias.default) return _Alias.default;
10006
10007       if (item.tag) {
10008         const match = this.tags.filter(t => t.tag === item.tag);
10009         if (match.length > 0) return match.find(t => t.format === item.format) || match[0];
10010       }
10011
10012       let tagObj, obj;
10013
10014       if (item instanceof _Scalar.default) {
10015         obj = item.value; // TODO: deprecate/remove class check
10016
10017         const match = this.tags.filter(t => t.identify && t.identify(obj) || t.class && obj instanceof t.class);
10018         tagObj = match.find(t => t.format === item.format) || match.find(t => !t.format);
10019       } else {
10020         obj = item;
10021         tagObj = this.tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
10022       }
10023
10024       if (!tagObj) {
10025         const name = obj && obj.constructor ? obj.constructor.name : typeof obj;
10026         throw new Error(`Tag not resolved for ${name} value`);
10027       }
10028
10029       return tagObj;
10030     } // needs to be called before stringifier to allow for circular anchor refs
10031
10032
10033     stringifyProps(node, tagObj, {
10034       anchors,
10035       doc
10036     }) {
10037       const props = [];
10038       const anchor = doc.anchors.getName(node);
10039
10040       if (anchor) {
10041         anchors[anchor] = node;
10042         props.push(`&${anchor}`);
10043       }
10044
10045       if (node.tag) {
10046         props.push(doc.stringifyTag(node.tag));
10047       } else if (!tagObj.default) {
10048         props.push(doc.stringifyTag(tagObj.tag));
10049       }
10050
10051       return props.join(' ');
10052     }
10053
10054     stringify(item, ctx, onComment, onChompKeep) {
10055       let tagObj;
10056
10057       if (!(item instanceof _Node.default)) {
10058         const createCtx = {
10059           aliasNodes: [],
10060           onTagObj: o => tagObj = o,
10061           prevObjects: new Map()
10062         };
10063         item = this.createNode(item, true, null, createCtx);
10064         const {
10065           anchors
10066         } = ctx.doc;
10067
10068         for (const alias of createCtx.aliasNodes) {
10069           alias.source = alias.source.node;
10070           let name = anchors.getName(alias.source);
10071
10072           if (!name) {
10073             name = anchors.newName();
10074             anchors.map[name] = alias.source;
10075           }
10076         }
10077       }
10078
10079       ctx.tags = this;
10080       if (item instanceof _Pair.default) return item.toString(ctx, onComment, onChompKeep);
10081       if (!tagObj) tagObj = this.getTagObject(item);
10082       const props = this.stringifyProps(item, tagObj, ctx);
10083       if (props.length > 0) ctx.indentAtStart = (ctx.indentAtStart || 0) + props.length + 1;
10084       const str = typeof tagObj.stringify === 'function' ? tagObj.stringify(item, ctx, onComment, onChompKeep) : item instanceof _Collection.default ? item.toString(ctx, onComment, onChompKeep) : (0, stringify.stringifyString)(item, ctx, onComment, onChompKeep);
10085       return props ? item instanceof _Collection.default && str[0] !== '{' && str[0] !== '[' ? `${props}\n${ctx.indent}${str}` : `${props} ${str}` : str;
10086     }
10087
10088   }
10089
10090   exports.default = Schema;
10091
10092   _defineProperty(Schema, "defaultPrefix", 'tag:yaml.org,2002:');
10093
10094   _defineProperty(Schema, "defaultTags", {
10095     MAP: 'tag:yaml.org,2002:map',
10096     SEQ: 'tag:yaml.org,2002:seq',
10097     STR: 'tag:yaml.org,2002:str'
10098   });
10099 });
10100 unwrapExports(schema);
10101
10102 var Document_1$1 = createCommonjsModule(function (module, exports) {
10103
10104   Object.defineProperty(exports, "__esModule", {
10105     value: true
10106   });
10107   exports.default = void 0;
10108
10109   var _addComment = _interopRequireDefault(addComment_1);
10110
10111   var _Anchors = _interopRequireDefault(Anchors_1);
10112
10113   var _listTagNames = _interopRequireDefault(listTagNames);
10114
10115   var _schema = _interopRequireDefault(schema);
10116
10117   var _Alias = _interopRequireDefault(Alias_1$1);
10118
10119   var _Collection = _interopRequireWildcard(Collection_1$1);
10120
10121   var _Node = _interopRequireDefault(Node_1$1);
10122
10123   var _Scalar = _interopRequireDefault(Scalar_1);
10124
10125   var _toJSON = _interopRequireDefault(toJSON_1);
10126
10127   function _getRequireWildcardCache() {
10128     if (typeof WeakMap !== "function") return null;
10129     var cache = new WeakMap();
10130
10131     _getRequireWildcardCache = function () {
10132       return cache;
10133     };
10134
10135     return cache;
10136   }
10137
10138   function _interopRequireWildcard(obj) {
10139     if (obj && obj.__esModule) {
10140       return obj;
10141     }
10142
10143     if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
10144       return {
10145         default: obj
10146       };
10147     }
10148
10149     var cache = _getRequireWildcardCache();
10150
10151     if (cache && cache.has(obj)) {
10152       return cache.get(obj);
10153     }
10154
10155     var newObj = {};
10156     var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
10157
10158     for (var key in obj) {
10159       if (Object.prototype.hasOwnProperty.call(obj, key)) {
10160         var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
10161
10162         if (desc && (desc.get || desc.set)) {
10163           Object.defineProperty(newObj, key, desc);
10164         } else {
10165           newObj[key] = obj[key];
10166         }
10167       }
10168     }
10169
10170     newObj.default = obj;
10171
10172     if (cache) {
10173       cache.set(obj, newObj);
10174     }
10175
10176     return newObj;
10177   }
10178
10179   function _interopRequireDefault(obj) {
10180     return obj && obj.__esModule ? obj : {
10181       default: obj
10182     };
10183   }
10184
10185   function _defineProperty(obj, key, value) {
10186     if (key in obj) {
10187       Object.defineProperty(obj, key, {
10188         value: value,
10189         enumerable: true,
10190         configurable: true,
10191         writable: true
10192       });
10193     } else {
10194       obj[key] = value;
10195     }
10196
10197     return obj;
10198   }
10199
10200   const isCollectionItem = node => node && [constants.Type.MAP_KEY, constants.Type.MAP_VALUE, constants.Type.SEQ_ITEM].includes(node.type);
10201
10202   class Document {
10203     constructor(options) {
10204       this.anchors = new _Anchors.default(options.anchorPrefix);
10205       this.commentBefore = null;
10206       this.comment = null;
10207       this.contents = null;
10208       this.directivesEndMarker = null;
10209       this.errors = [];
10210       this.options = options;
10211       this.schema = null;
10212       this.tagPrefixes = [];
10213       this.version = null;
10214       this.warnings = [];
10215     }
10216
10217     assertCollectionContents() {
10218       if (this.contents instanceof _Collection.default) return true;
10219       throw new Error('Expected a YAML collection as document contents');
10220     }
10221
10222     add(value) {
10223       this.assertCollectionContents();
10224       return this.contents.add(value);
10225     }
10226
10227     addIn(path, value) {
10228       this.assertCollectionContents();
10229       this.contents.addIn(path, value);
10230     }
10231
10232     delete(key) {
10233       this.assertCollectionContents();
10234       return this.contents.delete(key);
10235     }
10236
10237     deleteIn(path) {
10238       if ((0, _Collection.isEmptyPath)(path)) {
10239         if (this.contents == null) return false;
10240         this.contents = null;
10241         return true;
10242       }
10243
10244       this.assertCollectionContents();
10245       return this.contents.deleteIn(path);
10246     }
10247
10248     getDefaults() {
10249       return Document.defaults[this.version] || Document.defaults[this.options.version] || {};
10250     }
10251
10252     get(key, keepScalar) {
10253       return this.contents instanceof _Collection.default ? this.contents.get(key, keepScalar) : undefined;
10254     }
10255
10256     getIn(path, keepScalar) {
10257       if ((0, _Collection.isEmptyPath)(path)) return !keepScalar && this.contents instanceof _Scalar.default ? this.contents.value : this.contents;
10258       return this.contents instanceof _Collection.default ? this.contents.getIn(path, keepScalar) : undefined;
10259     }
10260
10261     has(key) {
10262       return this.contents instanceof _Collection.default ? this.contents.has(key) : false;
10263     }
10264
10265     hasIn(path) {
10266       if ((0, _Collection.isEmptyPath)(path)) return this.contents !== undefined;
10267       return this.contents instanceof _Collection.default ? this.contents.hasIn(path) : false;
10268     }
10269
10270     set(key, value) {
10271       this.assertCollectionContents();
10272       this.contents.set(key, value);
10273     }
10274
10275     setIn(path, value) {
10276       if ((0, _Collection.isEmptyPath)(path)) this.contents = value;else {
10277         this.assertCollectionContents();
10278         this.contents.setIn(path, value);
10279       }
10280     }
10281
10282     setSchema(id, customTags) {
10283       if (!id && !customTags && this.schema) return;
10284       if (typeof id === 'number') id = id.toFixed(1);
10285
10286       if (id === '1.0' || id === '1.1' || id === '1.2') {
10287         if (this.version) this.version = id;else this.options.version = id;
10288         delete this.options.schema;
10289       } else if (id && typeof id === 'string') {
10290         this.options.schema = id;
10291       }
10292
10293       if (Array.isArray(customTags)) this.options.customTags = customTags;
10294       const opt = Object.assign({}, this.getDefaults(), this.options);
10295       this.schema = new _schema.default(opt);
10296     }
10297
10298     parse(node, prevDoc) {
10299       if (this.options.keepCstNodes) this.cstNode = node;
10300       if (this.options.keepNodeTypes) this.type = 'DOCUMENT';
10301       const {
10302         directives = [],
10303         contents = [],
10304         directivesEndMarker,
10305         error,
10306         valueRange
10307       } = node;
10308
10309       if (error) {
10310         if (!error.source) error.source = this;
10311         this.errors.push(error);
10312       }
10313
10314       this.parseDirectives(directives, prevDoc);
10315       if (directivesEndMarker) this.directivesEndMarker = true;
10316       this.range = valueRange ? [valueRange.start, valueRange.end] : null;
10317       this.setSchema();
10318       this.anchors._cstAliases = [];
10319       this.parseContents(contents);
10320       this.anchors.resolveNodes();
10321
10322       if (this.options.prettyErrors) {
10323         for (const error of this.errors) if (error instanceof errors.YAMLError) error.makePretty();
10324
10325         for (const warn of this.warnings) if (warn instanceof errors.YAMLError) warn.makePretty();
10326       }
10327
10328       return this;
10329     }
10330
10331     parseDirectives(directives, prevDoc) {
10332       const directiveComments = [];
10333       let hasDirectives = false;
10334       directives.forEach(directive => {
10335         const {
10336           comment,
10337           name
10338         } = directive;
10339
10340         switch (name) {
10341           case 'TAG':
10342             this.resolveTagDirective(directive);
10343             hasDirectives = true;
10344             break;
10345
10346           case 'YAML':
10347           case 'YAML:1.0':
10348             this.resolveYamlDirective(directive);
10349             hasDirectives = true;
10350             break;
10351
10352           default:
10353             if (name) {
10354               const msg = `YAML only supports %TAG and %YAML directives, and not %${name}`;
10355               this.warnings.push(new errors.YAMLWarning(directive, msg));
10356             }
10357
10358         }
10359
10360         if (comment) directiveComments.push(comment);
10361       });
10362
10363       if (prevDoc && !hasDirectives && '1.1' === (this.version || prevDoc.version || this.options.version)) {
10364         const copyTagPrefix = ({
10365           handle,
10366           prefix
10367         }) => ({
10368           handle,
10369           prefix
10370         });
10371
10372         this.tagPrefixes = prevDoc.tagPrefixes.map(copyTagPrefix);
10373         this.version = prevDoc.version;
10374       }
10375
10376       this.commentBefore = directiveComments.join('\n') || null;
10377     }
10378
10379     parseContents(contents) {
10380       const comments = {
10381         before: [],
10382         after: []
10383       };
10384       const contentNodes = [];
10385       let spaceBefore = false;
10386       contents.forEach(node => {
10387         if (node.valueRange) {
10388           if (contentNodes.length === 1) {
10389             const msg = 'Document is not valid YAML (bad indentation?)';
10390             this.errors.push(new errors.YAMLSyntaxError(node, msg));
10391           }
10392
10393           const res = this.resolveNode(node);
10394
10395           if (spaceBefore) {
10396             res.spaceBefore = true;
10397             spaceBefore = false;
10398           }
10399
10400           contentNodes.push(res);
10401         } else if (node.comment !== null) {
10402           const cc = contentNodes.length === 0 ? comments.before : comments.after;
10403           cc.push(node.comment);
10404         } else if (node.type === constants.Type.BLANK_LINE) {
10405           spaceBefore = true;
10406
10407           if (contentNodes.length === 0 && comments.before.length > 0 && !this.commentBefore) {
10408             // space-separated comments at start are parsed as document comments
10409             this.commentBefore = comments.before.join('\n');
10410             comments.before = [];
10411           }
10412         }
10413       });
10414
10415       switch (contentNodes.length) {
10416         case 0:
10417           this.contents = null;
10418           comments.after = comments.before;
10419           break;
10420
10421         case 1:
10422           this.contents = contentNodes[0];
10423
10424           if (this.contents) {
10425             const cb = comments.before.join('\n') || null;
10426
10427             if (cb) {
10428               const cbNode = this.contents instanceof _Collection.default && this.contents.items[0] ? this.contents.items[0] : this.contents;
10429               cbNode.commentBefore = cbNode.commentBefore ? `${cb}\n${cbNode.commentBefore}` : cb;
10430             }
10431           } else {
10432             comments.after = comments.before.concat(comments.after);
10433           }
10434
10435           break;
10436
10437         default:
10438           this.contents = contentNodes;
10439
10440           if (this.contents[0]) {
10441             this.contents[0].commentBefore = comments.before.join('\n') || null;
10442           } else {
10443             comments.after = comments.before.concat(comments.after);
10444           }
10445
10446       }
10447
10448       this.comment = comments.after.join('\n') || null;
10449     }
10450
10451     resolveTagDirective(directive) {
10452       const [handle, prefix] = directive.parameters;
10453
10454       if (handle && prefix) {
10455         if (this.tagPrefixes.every(p => p.handle !== handle)) {
10456           this.tagPrefixes.push({
10457             handle,
10458             prefix
10459           });
10460         } else {
10461           const msg = 'The %TAG directive must only be given at most once per handle in the same document.';
10462           this.errors.push(new errors.YAMLSemanticError(directive, msg));
10463         }
10464       } else {
10465         const msg = 'Insufficient parameters given for %TAG directive';
10466         this.errors.push(new errors.YAMLSemanticError(directive, msg));
10467       }
10468     }
10469
10470     resolveYamlDirective(directive) {
10471       let [version] = directive.parameters;
10472       if (directive.name === 'YAML:1.0') version = '1.0';
10473
10474       if (this.version) {
10475         const msg = 'The %YAML directive must only be given at most once per document.';
10476         this.errors.push(new errors.YAMLSemanticError(directive, msg));
10477       }
10478
10479       if (!version) {
10480         const msg = 'Insufficient parameters given for %YAML directive';
10481         this.errors.push(new errors.YAMLSemanticError(directive, msg));
10482       } else {
10483         if (!Document.defaults[version]) {
10484           const v0 = this.version || this.options.version;
10485           const msg = `Document will be parsed as YAML ${v0} rather than YAML ${version}`;
10486           this.warnings.push(new errors.YAMLWarning(directive, msg));
10487         }
10488
10489         this.version = version;
10490       }
10491     }
10492
10493     resolveTagName(node) {
10494       const {
10495         tag,
10496         type
10497       } = node;
10498       let nonSpecific = false;
10499
10500       if (tag) {
10501         const {
10502           handle,
10503           suffix,
10504           verbatim
10505         } = tag;
10506
10507         if (verbatim) {
10508           if (verbatim !== '!' && verbatim !== '!!') return verbatim;
10509           const msg = `Verbatim tags aren't resolved, so ${verbatim} is invalid.`;
10510           this.errors.push(new errors.YAMLSemanticError(node, msg));
10511         } else if (handle === '!' && !suffix) {
10512           nonSpecific = true;
10513         } else {
10514           let prefix = this.tagPrefixes.find(p => p.handle === handle);
10515
10516           if (!prefix) {
10517             const dtp = this.getDefaults().tagPrefixes;
10518             if (dtp) prefix = dtp.find(p => p.handle === handle);
10519           }
10520
10521           if (prefix) {
10522             if (suffix) {
10523               if (handle === '!' && (this.version || this.options.version) === '1.0') {
10524                 if (suffix[0] === '^') return suffix;
10525
10526                 if (/[:/]/.test(suffix)) {
10527                   // word/foo -> tag:word.yaml.org,2002:foo
10528                   const vocab = suffix.match(/^([a-z0-9-]+)\/(.*)/i);
10529                   return vocab ? `tag:${vocab[1]}.yaml.org,2002:${vocab[2]}` : `tag:${suffix}`;
10530                 }
10531               }
10532
10533               return prefix.prefix + decodeURIComponent(suffix);
10534             }
10535
10536             this.errors.push(new errors.YAMLSemanticError(node, `The ${handle} tag has no suffix.`));
10537           } else {
10538             const msg = `The ${handle} tag handle is non-default and was not declared.`;
10539             this.errors.push(new errors.YAMLSemanticError(node, msg));
10540           }
10541         }
10542       }
10543
10544       switch (type) {
10545         case constants.Type.BLOCK_FOLDED:
10546         case constants.Type.BLOCK_LITERAL:
10547         case constants.Type.QUOTE_DOUBLE:
10548         case constants.Type.QUOTE_SINGLE:
10549           return _schema.default.defaultTags.STR;
10550
10551         case constants.Type.FLOW_MAP:
10552         case constants.Type.MAP:
10553           return _schema.default.defaultTags.MAP;
10554
10555         case constants.Type.FLOW_SEQ:
10556         case constants.Type.SEQ:
10557           return _schema.default.defaultTags.SEQ;
10558
10559         case constants.Type.PLAIN:
10560           return nonSpecific ? _schema.default.defaultTags.STR : null;
10561
10562         default:
10563           return null;
10564       }
10565     }
10566
10567     resolveNode(node) {
10568       if (!node) return null;
10569       const {
10570         anchors,
10571         errors: errors$1,
10572         schema
10573       } = this;
10574       let hasAnchor = false;
10575       let hasTag = false;
10576       const comments = {
10577         before: [],
10578         after: []
10579       };
10580       const props = isCollectionItem(node.context.parent) ? node.context.parent.props.concat(node.props) : node.props;
10581
10582       for (const {
10583         start,
10584         end
10585       } of props) {
10586         switch (node.context.src[start]) {
10587           case constants.Char.COMMENT:
10588             {
10589               if (!node.commentHasRequiredWhitespace(start)) {
10590                 const msg = 'Comments must be separated from other tokens by white space characters';
10591                 errors$1.push(new errors.YAMLSemanticError(node, msg));
10592               }
10593
10594               const c = node.context.src.slice(start + 1, end);
10595               const {
10596                 header,
10597                 valueRange
10598               } = node;
10599
10600               if (valueRange && (start > valueRange.start || header && start > header.start)) {
10601                 comments.after.push(c);
10602               } else {
10603                 comments.before.push(c);
10604               }
10605             }
10606             break;
10607
10608           case constants.Char.ANCHOR:
10609             if (hasAnchor) {
10610               const msg = 'A node can have at most one anchor';
10611               errors$1.push(new errors.YAMLSemanticError(node, msg));
10612             }
10613
10614             hasAnchor = true;
10615             break;
10616
10617           case constants.Char.TAG:
10618             if (hasTag) {
10619               const msg = 'A node can have at most one tag';
10620               errors$1.push(new errors.YAMLSemanticError(node, msg));
10621             }
10622
10623             hasTag = true;
10624             break;
10625         }
10626       }
10627
10628       if (hasAnchor) {
10629         const name = node.anchor;
10630         const prev = anchors.getNode(name); // At this point, aliases for any preceding node with the same anchor
10631         // name have already been resolved, so it may safely be renamed.
10632
10633         if (prev) anchors.map[anchors.newName(name)] = prev; // During parsing, we need to store the CST node in anchors.map as
10634         // anchors need to be available during resolution to allow for
10635         // circular references.
10636
10637         anchors.map[name] = node;
10638       }
10639
10640       let res;
10641
10642       if (node.type === constants.Type.ALIAS) {
10643         if (hasAnchor || hasTag) {
10644           const msg = 'An alias node must not specify any properties';
10645           errors$1.push(new errors.YAMLSemanticError(node, msg));
10646         }
10647
10648         const name = node.rawValue;
10649         const src = anchors.getNode(name);
10650
10651         if (!src) {
10652           const msg = `Aliased anchor not found: ${name}`;
10653           errors$1.push(new errors.YAMLReferenceError(node, msg));
10654           return null;
10655         } // Lazy resolution for circular references
10656
10657
10658         res = new _Alias.default(src);
10659
10660         anchors._cstAliases.push(res);
10661       } else {
10662         const tagName = this.resolveTagName(node);
10663
10664         if (tagName) {
10665           res = schema.resolveNodeWithFallback(this, node, tagName);
10666         } else {
10667           if (node.type !== constants.Type.PLAIN) {
10668             const msg = `Failed to resolve ${node.type} node here`;
10669             errors$1.push(new errors.YAMLSyntaxError(node, msg));
10670             return null;
10671           }
10672
10673           try {
10674             res = schema.resolveScalar(node.strValue || '');
10675           } catch (error) {
10676             if (!error.source) error.source = node;
10677             errors$1.push(error);
10678             return null;
10679           }
10680         }
10681       }
10682
10683       if (res) {
10684         res.range = [node.range.start, node.range.end];
10685         if (this.options.keepCstNodes) res.cstNode = node;
10686         if (this.options.keepNodeTypes) res.type = node.type;
10687         const cb = comments.before.join('\n');
10688
10689         if (cb) {
10690           res.commentBefore = res.commentBefore ? `${res.commentBefore}\n${cb}` : cb;
10691         }
10692
10693         const ca = comments.after.join('\n');
10694         if (ca) res.comment = res.comment ? `${res.comment}\n${ca}` : ca;
10695       }
10696
10697       return node.resolved = res;
10698     }
10699
10700     listNonDefaultTags() {
10701       return (0, _listTagNames.default)(this.contents).filter(t => t.indexOf(_schema.default.defaultPrefix) !== 0);
10702     }
10703
10704     setTagPrefix(handle, prefix) {
10705       if (handle[0] !== '!' || handle[handle.length - 1] !== '!') throw new Error('Handle must start and end with !');
10706
10707       if (prefix) {
10708         const prev = this.tagPrefixes.find(p => p.handle === handle);
10709         if (prev) prev.prefix = prefix;else this.tagPrefixes.push({
10710           handle,
10711           prefix
10712         });
10713       } else {
10714         this.tagPrefixes = this.tagPrefixes.filter(p => p.handle !== handle);
10715       }
10716     }
10717
10718     stringifyTag(tag) {
10719       if ((this.version || this.options.version) === '1.0') {
10720         const priv = tag.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/);
10721         if (priv) return '!' + priv[1];
10722         const vocab = tag.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/);
10723         return vocab ? `!${vocab[1]}/${vocab[2]}` : `!${tag.replace(/^tag:/, '')}`;
10724       } else {
10725         let p = this.tagPrefixes.find(p => tag.indexOf(p.prefix) === 0);
10726
10727         if (!p) {
10728           const dtp = this.getDefaults().tagPrefixes;
10729           p = dtp && dtp.find(p => tag.indexOf(p.prefix) === 0);
10730         }
10731
10732         if (!p) return tag[0] === '!' ? tag : `!<${tag}>`;
10733         const suffix = tag.substr(p.prefix.length).replace(/[!,[\]{}]/g, ch => ({
10734           '!': '%21',
10735           ',': '%2C',
10736           '[': '%5B',
10737           ']': '%5D',
10738           '{': '%7B',
10739           '}': '%7D'
10740         })[ch]);
10741         return p.handle + suffix;
10742       }
10743     }
10744
10745     toJSON(arg) {
10746       const {
10747         keepBlobsInJSON,
10748         mapAsMap,
10749         maxAliasCount
10750       } = this.options;
10751       const keep = keepBlobsInJSON && (typeof arg !== 'string' || !(this.contents instanceof _Scalar.default));
10752       const ctx = {
10753         doc: this,
10754         keep,
10755         mapAsMap: keep && !!mapAsMap,
10756         maxAliasCount
10757       };
10758       const anchorNames = Object.keys(this.anchors.map);
10759       if (anchorNames.length > 0) ctx.anchors = anchorNames.map(name => ({
10760         alias: [],
10761         aliasCount: 0,
10762         count: 1,
10763         node: this.anchors.map[name]
10764       }));
10765       return (0, _toJSON.default)(this.contents, arg, ctx);
10766     }
10767
10768     toString() {
10769       if (this.errors.length > 0) throw new Error('Document with errors cannot be stringified');
10770       this.setSchema();
10771       const lines = [];
10772       let hasDirectives = false;
10773
10774       if (this.version) {
10775         let vd = '%YAML 1.2';
10776
10777         if (this.schema.name === 'yaml-1.1') {
10778           if (this.version === '1.0') vd = '%YAML:1.0';else if (this.version === '1.1') vd = '%YAML 1.1';
10779         }
10780
10781         lines.push(vd);
10782         hasDirectives = true;
10783       }
10784
10785       const tagNames = this.listNonDefaultTags();
10786       this.tagPrefixes.forEach(({
10787         handle,
10788         prefix
10789       }) => {
10790         if (tagNames.some(t => t.indexOf(prefix) === 0)) {
10791           lines.push(`%TAG ${handle} ${prefix}`);
10792           hasDirectives = true;
10793         }
10794       });
10795       if (hasDirectives || this.directivesEndMarker) lines.push('---');
10796
10797       if (this.commentBefore) {
10798         if (hasDirectives || !this.directivesEndMarker) lines.unshift('');
10799         lines.unshift(this.commentBefore.replace(/^/gm, '#'));
10800       }
10801
10802       const ctx = {
10803         anchors: {},
10804         doc: this,
10805         indent: ''
10806       };
10807       let chompKeep = false;
10808       let contentComment = null;
10809
10810       if (this.contents) {
10811         if (this.contents instanceof _Node.default) {
10812           if (this.contents.spaceBefore && (hasDirectives || this.directivesEndMarker)) lines.push('');
10813           if (this.contents.commentBefore) lines.push(this.contents.commentBefore.replace(/^/gm, '#')); // top-level block scalars need to be indented if followed by a comment
10814
10815           ctx.forceBlockIndent = !!this.comment;
10816           contentComment = this.contents.comment;
10817         }
10818
10819         const onChompKeep = contentComment ? null : () => chompKeep = true;
10820         const body = this.schema.stringify(this.contents, ctx, () => contentComment = null, onChompKeep);
10821         lines.push((0, _addComment.default)(body, '', contentComment));
10822       } else if (this.contents !== undefined) {
10823         lines.push(this.schema.stringify(this.contents, ctx));
10824       }
10825
10826       if (this.comment) {
10827         if ((!chompKeep || contentComment) && lines[lines.length - 1] !== '') lines.push('');
10828         lines.push(this.comment.replace(/^/gm, '#'));
10829       }
10830
10831       return lines.join('\n') + '\n';
10832     }
10833
10834   }
10835
10836   exports.default = Document;
10837
10838   _defineProperty(Document, "defaults", {
10839     '1.0': {
10840       schema: 'yaml-1.1',
10841       merge: true,
10842       tagPrefixes: [{
10843         handle: '!',
10844         prefix: _schema.default.defaultPrefix
10845       }, {
10846         handle: '!!',
10847         prefix: 'tag:private.yaml.org,2002:'
10848       }]
10849     },
10850     '1.1': {
10851       schema: 'yaml-1.1',
10852       merge: true,
10853       tagPrefixes: [{
10854         handle: '!',
10855         prefix: '!'
10856       }, {
10857         handle: '!!',
10858         prefix: _schema.default.defaultPrefix
10859       }]
10860     },
10861     '1.2': {
10862       schema: 'core',
10863       merge: false,
10864       tagPrefixes: [{
10865         handle: '!',
10866         prefix: '!'
10867       }, {
10868         handle: '!!',
10869         prefix: _schema.default.defaultPrefix
10870       }]
10871     }
10872   });
10873 });
10874 unwrapExports(Document_1$1);
10875
10876 var dist$1 = createCommonjsModule(function (module, exports) {
10877
10878   Object.defineProperty(exports, "__esModule", {
10879     value: true
10880   });
10881   exports.default = void 0;
10882
10883   var _parse = _interopRequireDefault(parse_1);
10884
10885   var _Document = _interopRequireDefault(Document_1$1);
10886
10887   var _schema = _interopRequireDefault(schema);
10888
10889   function _interopRequireDefault(obj) {
10890     return obj && obj.__esModule ? obj : {
10891       default: obj
10892     };
10893   }
10894
10895   const defaultOptions = {
10896     anchorPrefix: 'a',
10897     customTags: null,
10898     keepCstNodes: false,
10899     keepNodeTypes: true,
10900     keepBlobsInJSON: true,
10901     mapAsMap: false,
10902     maxAliasCount: 100,
10903     prettyErrors: false,
10904     // TODO Set true in v2
10905     simpleKeys: false,
10906     version: '1.2'
10907   };
10908
10909   function createNode(value, wrapScalars = true, tag) {
10910     if (tag === undefined && typeof wrapScalars === 'string') {
10911       tag = wrapScalars;
10912       wrapScalars = true;
10913     }
10914
10915     const options = Object.assign({}, _Document.default.defaults[defaultOptions.version], defaultOptions);
10916     const schema = new _schema.default(options);
10917     return schema.createNode(value, wrapScalars, tag);
10918   }
10919
10920   class Document extends _Document.default {
10921     constructor(options) {
10922       super(Object.assign({}, defaultOptions, options));
10923     }
10924
10925   }
10926
10927   function parseAllDocuments(src, options) {
10928     const stream = [];
10929     let prev;
10930
10931     for (const cstDoc of (0, _parse.default)(src)) {
10932       const doc = new Document(options);
10933       doc.parse(cstDoc, prev);
10934       stream.push(doc);
10935       prev = doc;
10936     }
10937
10938     return stream;
10939   }
10940
10941   function parseDocument(src, options) {
10942     const cst = (0, _parse.default)(src);
10943     const doc = new Document(options).parse(cst[0]);
10944
10945     if (cst.length > 1) {
10946       const errMsg = 'Source contains multiple documents; please use YAML.parseAllDocuments()';
10947       doc.errors.unshift(new errors.YAMLSemanticError(cst[1], errMsg));
10948     }
10949
10950     return doc;
10951   }
10952
10953   function parse(src, options) {
10954     const doc = parseDocument(src, options);
10955     doc.warnings.forEach(warning => (0, warnings.warn)(warning));
10956     if (doc.errors.length > 0) throw doc.errors[0];
10957     return doc.toJSON();
10958   }
10959
10960   function stringify(value, options) {
10961     const doc = new Document(options);
10962     doc.contents = value;
10963     return String(doc);
10964   }
10965
10966   var _default = {
10967     createNode,
10968     defaultOptions,
10969     Document,
10970     parse,
10971     parseAllDocuments,
10972     parseCST: _parse.default,
10973     parseDocument,
10974     stringify
10975   };
10976   exports.default = _default;
10977 });
10978 unwrapExports(dist$1);
10979
10980 var yaml = dist$1.default;
10981
10982 var loaders_1 = createCommonjsModule(function (module, exports) {
10983
10984   Object.defineProperty(exports, "__esModule", {
10985     value: true
10986   });
10987   exports.loaders = void 0;
10988   /* eslint-disable @typescript-eslint/no-require-imports */
10989
10990   let importFresh$1;
10991
10992   const loadJs = function loadJs(filepath) {
10993     if (importFresh$1 === undefined) {
10994       importFresh$1 = importFresh;
10995     }
10996
10997     const result = importFresh$1(filepath);
10998     return result;
10999   };
11000
11001   let parseJson;
11002
11003   const loadJson = function loadJson(filepath, content) {
11004     if (parseJson === undefined) {
11005       parseJson = parseJson$1;
11006     }
11007
11008     try {
11009       const result = parseJson(content);
11010       return result;
11011     } catch (error) {
11012       error.message = `JSON Error in ${filepath}:\n${error.message}`;
11013       throw error;
11014     }
11015   };
11016
11017   let yaml$1;
11018
11019   const loadYaml = function loadYaml(filepath, content) {
11020     if (yaml$1 === undefined) {
11021       yaml$1 = yaml;
11022     }
11023
11024     try {
11025       const result = yaml$1.parse(content, {
11026         prettyErrors: true
11027       });
11028       return result;
11029     } catch (error) {
11030       error.message = `YAML Error in ${filepath}:\n${error.message}`;
11031       throw error;
11032     }
11033   };
11034
11035   const loaders = {
11036     loadJs,
11037     loadJson,
11038     loadYaml
11039   };
11040   exports.loaders = loaders;
11041 });
11042 unwrapExports(loaders_1);
11043 var loaders_2 = loaders_1.loaders;
11044
11045 var getPropertyByPath_1 = createCommonjsModule(function (module, exports) {
11046
11047   Object.defineProperty(exports, "__esModule", {
11048     value: true
11049   });
11050   exports.getPropertyByPath = getPropertyByPath; // Resolves property names or property paths defined with period-delimited
11051   // strings or arrays of strings. Property names that are found on the source
11052   // object are used directly (even if they include a period).
11053   // Nested property names that include periods, within a path, are only
11054   // understood in array paths.
11055
11056   function getPropertyByPath(source, path) {
11057     if (typeof path === 'string' && Object.prototype.hasOwnProperty.call(source, path)) {
11058       return source[path];
11059     }
11060
11061     const parsedPath = typeof path === 'string' ? path.split('.') : path; // eslint-disable-next-line @typescript-eslint/no-explicit-any
11062
11063     return parsedPath.reduce((previous, key) => {
11064       if (previous === undefined) {
11065         return previous;
11066       }
11067
11068       return previous[key];
11069     }, source);
11070   }
11071 });
11072 unwrapExports(getPropertyByPath_1);
11073 var getPropertyByPath_2 = getPropertyByPath_1.getPropertyByPath;
11074
11075 var ExplorerBase_1 = createCommonjsModule(function (module, exports) {
11076
11077   Object.defineProperty(exports, "__esModule", {
11078     value: true
11079   });
11080   exports.getExtensionDescription = getExtensionDescription;
11081   exports.ExplorerBase = void 0;
11082
11083   var _path = _interopRequireDefault(path);
11084
11085   function _interopRequireDefault(obj) {
11086     return obj && obj.__esModule ? obj : {
11087       default: obj
11088     };
11089   }
11090
11091   class ExplorerBase {
11092     constructor(options) {
11093       if (options.cache === true) {
11094         this.loadCache = new Map();
11095         this.searchCache = new Map();
11096       }
11097
11098       this.config = options;
11099       this.validateConfig();
11100     }
11101
11102     clearLoadCache() {
11103       if (this.loadCache) {
11104         this.loadCache.clear();
11105       }
11106     }
11107
11108     clearSearchCache() {
11109       if (this.searchCache) {
11110         this.searchCache.clear();
11111       }
11112     }
11113
11114     clearCaches() {
11115       this.clearLoadCache();
11116       this.clearSearchCache();
11117     }
11118
11119     validateConfig() {
11120       const config = this.config;
11121       config.searchPlaces.forEach(place => {
11122         const loaderKey = _path.default.extname(place) || 'noExt';
11123         const loader = config.loaders[loaderKey];
11124
11125         if (!loader) {
11126           throw new Error(`No loader specified for ${getExtensionDescription(place)}, so searchPlaces item "${place}" is invalid`);
11127         }
11128
11129         if (typeof loader !== 'function') {
11130           throw new Error(`loader for ${getExtensionDescription(place)} is not a function (type provided: "${typeof loader}"), so searchPlaces item "${place}" is invalid`);
11131         }
11132       });
11133     }
11134
11135     shouldSearchStopWithResult(result) {
11136       if (result === null) return false;
11137       if (result.isEmpty && this.config.ignoreEmptySearchPlaces) return false;
11138       return true;
11139     }
11140
11141     nextDirectoryToSearch(currentDir, currentResult) {
11142       if (this.shouldSearchStopWithResult(currentResult)) {
11143         return null;
11144       }
11145
11146       const nextDir = nextDirUp(currentDir);
11147
11148       if (nextDir === currentDir || currentDir === this.config.stopDir) {
11149         return null;
11150       }
11151
11152       return nextDir;
11153     }
11154
11155     loadPackageProp(filepath, content) {
11156       const parsedContent = loaders_1.loaders.loadJson(filepath, content);
11157
11158       const packagePropValue = (0, getPropertyByPath_1.getPropertyByPath)(parsedContent, this.config.packageProp);
11159       return packagePropValue || null;
11160     }
11161
11162     getLoaderEntryForFile(filepath) {
11163       if (_path.default.basename(filepath) === 'package.json') {
11164         const loader = this.loadPackageProp.bind(this);
11165         return loader;
11166       }
11167
11168       const loaderKey = _path.default.extname(filepath) || 'noExt';
11169       const loader = this.config.loaders[loaderKey];
11170
11171       if (!loader) {
11172         throw new Error(`No loader specified for ${getExtensionDescription(filepath)}`);
11173       }
11174
11175       return loader;
11176     }
11177
11178     loadedContentToCosmiconfigResult(filepath, loadedContent) {
11179       if (loadedContent === null) {
11180         return null;
11181       }
11182
11183       if (loadedContent === undefined) {
11184         return {
11185           filepath,
11186           config: undefined,
11187           isEmpty: true
11188         };
11189       }
11190
11191       return {
11192         config: loadedContent,
11193         filepath
11194       };
11195     }
11196
11197     validateFilePath(filepath) {
11198       if (!filepath) {
11199         throw new Error('load must pass a non-empty string');
11200       }
11201     }
11202
11203   }
11204
11205   exports.ExplorerBase = ExplorerBase;
11206
11207   function nextDirUp(dir) {
11208     return _path.default.dirname(dir);
11209   }
11210
11211   function getExtensionDescription(filepath) {
11212     const ext = _path.default.extname(filepath);
11213
11214     return ext ? `extension "${ext}"` : 'files without extensions';
11215   }
11216 });
11217 unwrapExports(ExplorerBase_1);
11218 var ExplorerBase_2 = ExplorerBase_1.getExtensionDescription;
11219 var ExplorerBase_3 = ExplorerBase_1.ExplorerBase;
11220
11221 var readFile_1 = createCommonjsModule(function (module, exports) {
11222
11223   Object.defineProperty(exports, "__esModule", {
11224     value: true
11225   });
11226   exports.readFile = readFile;
11227   exports.readFileSync = readFileSync;
11228
11229   var _fs = _interopRequireDefault(fs);
11230
11231   function _interopRequireDefault(obj) {
11232     return obj && obj.__esModule ? obj : {
11233       default: obj
11234     };
11235   }
11236
11237   async function fsReadFileAsync(pathname, encoding) {
11238     return new Promise((resolve, reject) => {
11239       _fs.default.readFile(pathname, encoding, (error, contents) => {
11240         if (error) {
11241           reject(error);
11242           return;
11243         }
11244
11245         resolve(contents);
11246       });
11247     });
11248   }
11249
11250   async function readFile(filepath, options = {}) {
11251     const throwNotFound = options.throwNotFound === true;
11252
11253     try {
11254       const content = await fsReadFileAsync(filepath, 'utf8');
11255       return content;
11256     } catch (error) {
11257       if (throwNotFound === false && error.code === 'ENOENT') {
11258         return null;
11259       }
11260
11261       throw error;
11262     }
11263   }
11264
11265   function readFileSync(filepath, options = {}) {
11266     const throwNotFound = options.throwNotFound === true;
11267
11268     try {
11269       const content = _fs.default.readFileSync(filepath, 'utf8');
11270
11271       return content;
11272     } catch (error) {
11273       if (throwNotFound === false && error.code === 'ENOENT') {
11274         return null;
11275       }
11276
11277       throw error;
11278     }
11279   }
11280 });
11281 unwrapExports(readFile_1);
11282 var readFile_2 = readFile_1.readFile;
11283 var readFile_3 = readFile_1.readFileSync;
11284
11285 var cacheWrapper_1 = createCommonjsModule(function (module, exports) {
11286
11287   Object.defineProperty(exports, "__esModule", {
11288     value: true
11289   });
11290   exports.cacheWrapper = cacheWrapper;
11291   exports.cacheWrapperSync = cacheWrapperSync;
11292
11293   async function cacheWrapper(cache, key, fn) {
11294     const cached = cache.get(key);
11295
11296     if (cached !== undefined) {
11297       return cached;
11298     }
11299
11300     const result = await fn();
11301     cache.set(key, result);
11302     return result;
11303   }
11304
11305   function cacheWrapperSync(cache, key, fn) {
11306     const cached = cache.get(key);
11307
11308     if (cached !== undefined) {
11309       return cached;
11310     }
11311
11312     const result = fn();
11313     cache.set(key, result);
11314     return result;
11315   }
11316 });
11317 unwrapExports(cacheWrapper_1);
11318 var cacheWrapper_2 = cacheWrapper_1.cacheWrapper;
11319 var cacheWrapper_3 = cacheWrapper_1.cacheWrapperSync;
11320
11321 const {
11322   promisify
11323 } = util;
11324
11325 async function isType(fsStatType, statsMethodName, filePath) {
11326   if (typeof filePath !== 'string') {
11327     throw new TypeError(`Expected a string, got ${typeof filePath}`);
11328   }
11329
11330   try {
11331     const stats = await promisify(fs[fsStatType])(filePath);
11332     return stats[statsMethodName]();
11333   } catch (error) {
11334     if (error.code === 'ENOENT') {
11335       return false;
11336     }
11337
11338     throw error;
11339   }
11340 }
11341
11342 function isTypeSync(fsStatType, statsMethodName, filePath) {
11343   if (typeof filePath !== 'string') {
11344     throw new TypeError(`Expected a string, got ${typeof filePath}`);
11345   }
11346
11347   try {
11348     return fs[fsStatType](filePath)[statsMethodName]();
11349   } catch (error) {
11350     if (error.code === 'ENOENT') {
11351       return false;
11352     }
11353
11354     throw error;
11355   }
11356 }
11357
11358 var isFile = isType.bind(null, 'stat', 'isFile');
11359 var isDirectory = isType.bind(null, 'stat', 'isDirectory');
11360 var isSymlink = isType.bind(null, 'lstat', 'isSymbolicLink');
11361 var isFileSync = isTypeSync.bind(null, 'statSync', 'isFile');
11362 var isDirectorySync = isTypeSync.bind(null, 'statSync', 'isDirectory');
11363 var isSymlinkSync = isTypeSync.bind(null, 'lstatSync', 'isSymbolicLink');
11364 var pathType = {
11365   isFile: isFile,
11366   isDirectory: isDirectory,
11367   isSymlink: isSymlink,
11368   isFileSync: isFileSync,
11369   isDirectorySync: isDirectorySync,
11370   isSymlinkSync: isSymlinkSync
11371 };
11372
11373 var getDirectory_1 = createCommonjsModule(function (module, exports) {
11374
11375   Object.defineProperty(exports, "__esModule", {
11376     value: true
11377   });
11378   exports.getDirectory = getDirectory;
11379   exports.getDirectorySync = getDirectorySync;
11380
11381   var _path = _interopRequireDefault(path);
11382
11383   function _interopRequireDefault(obj) {
11384     return obj && obj.__esModule ? obj : {
11385       default: obj
11386     };
11387   }
11388
11389   async function getDirectory(filepath) {
11390     const filePathIsDirectory = await (0, pathType.isDirectory)(filepath);
11391
11392     if (filePathIsDirectory === true) {
11393       return filepath;
11394     }
11395
11396     const directory = _path.default.dirname(filepath);
11397
11398     return directory;
11399   }
11400
11401   function getDirectorySync(filepath) {
11402     const filePathIsDirectory = (0, pathType.isDirectorySync)(filepath);
11403
11404     if (filePathIsDirectory === true) {
11405       return filepath;
11406     }
11407
11408     const directory = _path.default.dirname(filepath);
11409
11410     return directory;
11411   }
11412 });
11413 unwrapExports(getDirectory_1);
11414 var getDirectory_2 = getDirectory_1.getDirectory;
11415 var getDirectory_3 = getDirectory_1.getDirectorySync;
11416
11417 var Explorer_1 = createCommonjsModule(function (module, exports) {
11418
11419   Object.defineProperty(exports, "__esModule", {
11420     value: true
11421   });
11422   exports.Explorer = void 0;
11423
11424   var _path = _interopRequireDefault(path);
11425
11426   function _interopRequireDefault(obj) {
11427     return obj && obj.__esModule ? obj : {
11428       default: obj
11429     };
11430   }
11431
11432   function _asyncIterator(iterable) {
11433     var method;
11434
11435     if (typeof Symbol !== "undefined") {
11436       if (Symbol.asyncIterator) {
11437         method = iterable[Symbol.asyncIterator];
11438         if (method != null) return method.call(iterable);
11439       }
11440
11441       if (Symbol.iterator) {
11442         method = iterable[Symbol.iterator];
11443         if (method != null) return method.call(iterable);
11444       }
11445     }
11446
11447     throw new TypeError("Object is not async iterable");
11448   }
11449
11450   class Explorer extends ExplorerBase_1.ExplorerBase {
11451     constructor(options) {
11452       super(options);
11453     }
11454
11455     async search(searchFrom = process.cwd()) {
11456       const startDirectory = await (0, getDirectory_1.getDirectory)(searchFrom);
11457       const result = await this.searchFromDirectory(startDirectory);
11458       return result;
11459     }
11460
11461     async searchFromDirectory(dir) {
11462       const absoluteDir = _path.default.resolve(process.cwd(), dir);
11463
11464       const run = async () => {
11465         const result = await this.searchDirectory(absoluteDir);
11466         const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
11467
11468         if (nextDir) {
11469           return this.searchFromDirectory(nextDir);
11470         }
11471
11472         const transformResult = await this.config.transform(result);
11473         return transformResult;
11474       };
11475
11476       if (this.searchCache) {
11477         return (0, cacheWrapper_1.cacheWrapper)(this.searchCache, absoluteDir, run);
11478       }
11479
11480       return run();
11481     }
11482
11483     async searchDirectory(dir) {
11484       var _iteratorNormalCompletion = true;
11485       var _didIteratorError = false;
11486
11487       var _iteratorError;
11488
11489       try {
11490         for (var _iterator = _asyncIterator(this.config.searchPlaces), _step, _value; _step = await _iterator.next(), _iteratorNormalCompletion = _step.done, _value = await _step.value, !_iteratorNormalCompletion; _iteratorNormalCompletion = true) {
11491           const place = _value;
11492           const placeResult = await this.loadSearchPlace(dir, place);
11493
11494           if (this.shouldSearchStopWithResult(placeResult) === true) {
11495             return placeResult;
11496           }
11497         } // config not found
11498
11499       } catch (err) {
11500         _didIteratorError = true;
11501         _iteratorError = err;
11502       } finally {
11503         try {
11504           if (!_iteratorNormalCompletion && _iterator.return != null) {
11505             await _iterator.return();
11506           }
11507         } finally {
11508           if (_didIteratorError) {
11509             throw _iteratorError;
11510           }
11511         }
11512       }
11513
11514       return null;
11515     }
11516
11517     async loadSearchPlace(dir, place) {
11518       const filepath = _path.default.join(dir, place);
11519
11520       const fileContents = await (0, readFile_1.readFile)(filepath);
11521       const result = await this.createCosmiconfigResult(filepath, fileContents);
11522       return result;
11523     }
11524
11525     async loadFileContent(filepath, content) {
11526       if (content === null) {
11527         return null;
11528       }
11529
11530       if (content.trim() === '') {
11531         return undefined;
11532       }
11533
11534       const loader = this.getLoaderEntryForFile(filepath);
11535       const loaderResult = await loader(filepath, content);
11536       return loaderResult;
11537     }
11538
11539     async createCosmiconfigResult(filepath, content) {
11540       const fileContent = await this.loadFileContent(filepath, content);
11541       const result = this.loadedContentToCosmiconfigResult(filepath, fileContent);
11542       return result;
11543     }
11544
11545     async load(filepath) {
11546       this.validateFilePath(filepath);
11547
11548       const absoluteFilePath = _path.default.resolve(process.cwd(), filepath);
11549
11550       const runLoad = async () => {
11551         const fileContents = await (0, readFile_1.readFile)(absoluteFilePath, {
11552           throwNotFound: true
11553         });
11554         const result = await this.createCosmiconfigResult(absoluteFilePath, fileContents);
11555         const transformResult = await this.config.transform(result);
11556         return transformResult;
11557       };
11558
11559       if (this.loadCache) {
11560         return (0, cacheWrapper_1.cacheWrapper)(this.loadCache, absoluteFilePath, runLoad);
11561       }
11562
11563       return runLoad();
11564     }
11565
11566   }
11567
11568   exports.Explorer = Explorer;
11569 });
11570 unwrapExports(Explorer_1);
11571 var Explorer_2 = Explorer_1.Explorer;
11572
11573 var ExplorerSync_1 = createCommonjsModule(function (module, exports) {
11574
11575   Object.defineProperty(exports, "__esModule", {
11576     value: true
11577   });
11578   exports.ExplorerSync = void 0;
11579
11580   var _path = _interopRequireDefault(path);
11581
11582   function _interopRequireDefault(obj) {
11583     return obj && obj.__esModule ? obj : {
11584       default: obj
11585     };
11586   }
11587
11588   class ExplorerSync extends ExplorerBase_1.ExplorerBase {
11589     constructor(options) {
11590       super(options);
11591     }
11592
11593     searchSync(searchFrom = process.cwd()) {
11594       const startDirectory = (0, getDirectory_1.getDirectorySync)(searchFrom);
11595       const result = this.searchFromDirectorySync(startDirectory);
11596       return result;
11597     }
11598
11599     searchFromDirectorySync(dir) {
11600       const absoluteDir = _path.default.resolve(process.cwd(), dir);
11601
11602       const run = () => {
11603         const result = this.searchDirectorySync(absoluteDir);
11604         const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
11605
11606         if (nextDir) {
11607           return this.searchFromDirectorySync(nextDir);
11608         }
11609
11610         const transformResult = this.config.transform(result);
11611         return transformResult;
11612       };
11613
11614       if (this.searchCache) {
11615         return (0, cacheWrapper_1.cacheWrapperSync)(this.searchCache, absoluteDir, run);
11616       }
11617
11618       return run();
11619     }
11620
11621     searchDirectorySync(dir) {
11622       for (const place of this.config.searchPlaces) {
11623         const placeResult = this.loadSearchPlaceSync(dir, place);
11624
11625         if (this.shouldSearchStopWithResult(placeResult) === true) {
11626           return placeResult;
11627         }
11628       } // config not found
11629
11630
11631       return null;
11632     }
11633
11634     loadSearchPlaceSync(dir, place) {
11635       const filepath = _path.default.join(dir, place);
11636
11637       const content = (0, readFile_1.readFileSync)(filepath);
11638       const result = this.createCosmiconfigResultSync(filepath, content);
11639       return result;
11640     }
11641
11642     loadFileContentSync(filepath, content) {
11643       if (content === null) {
11644         return null;
11645       }
11646
11647       if (content.trim() === '') {
11648         return undefined;
11649       }
11650
11651       const loader = this.getLoaderEntryForFile(filepath);
11652       const loaderResult = loader(filepath, content);
11653       return loaderResult;
11654     }
11655
11656     createCosmiconfigResultSync(filepath, content) {
11657       const fileContent = this.loadFileContentSync(filepath, content);
11658       const result = this.loadedContentToCosmiconfigResult(filepath, fileContent);
11659       return result;
11660     }
11661
11662     loadSync(filepath) {
11663       this.validateFilePath(filepath);
11664
11665       const absoluteFilePath = _path.default.resolve(process.cwd(), filepath);
11666
11667       const runLoadSync = () => {
11668         const content = (0, readFile_1.readFileSync)(absoluteFilePath, {
11669           throwNotFound: true
11670         });
11671         const cosmiconfigResult = this.createCosmiconfigResultSync(absoluteFilePath, content);
11672         const transformResult = this.config.transform(cosmiconfigResult);
11673         return transformResult;
11674       };
11675
11676       if (this.loadCache) {
11677         return (0, cacheWrapper_1.cacheWrapperSync)(this.loadCache, absoluteFilePath, runLoadSync);
11678       }
11679
11680       return runLoadSync();
11681     }
11682
11683   }
11684
11685   exports.ExplorerSync = ExplorerSync;
11686 });
11687 unwrapExports(ExplorerSync_1);
11688 var ExplorerSync_2 = ExplorerSync_1.ExplorerSync;
11689
11690 var dist$2 = createCommonjsModule(function (module, exports) {
11691
11692   Object.defineProperty(exports, "__esModule", {
11693     value: true
11694   });
11695   exports.cosmiconfig = cosmiconfig;
11696   exports.cosmiconfigSync = cosmiconfigSync;
11697   exports.defaultLoaders = void 0;
11698
11699   var _os = _interopRequireDefault(os);
11700
11701   function _interopRequireDefault(obj) {
11702     return obj && obj.__esModule ? obj : {
11703       default: obj
11704     };
11705   } // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
11706
11707
11708   function cosmiconfig(moduleName, options = {}) {
11709     const normalizedOptions = normalizeOptions(moduleName, options);
11710     const explorer = new Explorer_1.Explorer(normalizedOptions);
11711     return {
11712       search: explorer.search.bind(explorer),
11713       load: explorer.load.bind(explorer),
11714       clearLoadCache: explorer.clearLoadCache.bind(explorer),
11715       clearSearchCache: explorer.clearSearchCache.bind(explorer),
11716       clearCaches: explorer.clearCaches.bind(explorer)
11717     };
11718   } // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
11719
11720
11721   function cosmiconfigSync(moduleName, options = {}) {
11722     const normalizedOptions = normalizeOptions(moduleName, options);
11723     const explorerSync = new ExplorerSync_1.ExplorerSync(normalizedOptions);
11724     return {
11725       search: explorerSync.searchSync.bind(explorerSync),
11726       load: explorerSync.loadSync.bind(explorerSync),
11727       clearLoadCache: explorerSync.clearLoadCache.bind(explorerSync),
11728       clearSearchCache: explorerSync.clearSearchCache.bind(explorerSync),
11729       clearCaches: explorerSync.clearCaches.bind(explorerSync)
11730     };
11731   } // do not allow mutation of default loaders. Make sure it is set inside options
11732
11733
11734   const defaultLoaders = Object.freeze({
11735     '.js': loaders_1.loaders.loadJs,
11736     '.json': loaders_1.loaders.loadJson,
11737     '.yaml': loaders_1.loaders.loadYaml,
11738     '.yml': loaders_1.loaders.loadYaml,
11739     noExt: loaders_1.loaders.loadYaml
11740   });
11741   exports.defaultLoaders = defaultLoaders;
11742
11743   function normalizeOptions(moduleName, options) {
11744     const defaults = {
11745       packageProp: moduleName,
11746       searchPlaces: ['package.json', `.${moduleName}rc`, `.${moduleName}rc.json`, `.${moduleName}rc.yaml`, `.${moduleName}rc.yml`, `.${moduleName}rc.js`, `${moduleName}.config.js`],
11747       ignoreEmptySearchPlaces: true,
11748       stopDir: _os.default.homedir(),
11749       cache: true,
11750       transform: identity,
11751       loaders: defaultLoaders
11752     };
11753     const normalizedOptions = Object.assign({}, defaults, {}, options, {
11754       loaders: Object.assign({}, defaults.loaders, {}, options.loaders)
11755     });
11756     return normalizedOptions;
11757   }
11758
11759   const identity = function identity(x) {
11760     return x;
11761   };
11762 });
11763 unwrapExports(dist$2);
11764 var dist_1 = dist$2.cosmiconfig;
11765 var dist_2 = dist$2.cosmiconfigSync;
11766 var dist_3 = dist$2.defaultLoaders;
11767
11768 var findParentDir = createCommonjsModule(function (module, exports) {
11769
11770   var exists = fs.exists || path.exists,
11771       existsSync = fs.existsSync || path.existsSync;
11772
11773   function splitPath(path) {
11774     var parts = path.split(/(\/|\\)/);
11775     if (!parts.length) return parts; // when path starts with a slash, the first part is empty string
11776
11777     return !parts[0].length ? parts.slice(1) : parts;
11778   }
11779
11780   exports = module.exports = function (currentFullPath, clue, cb) {
11781     function testDir(parts) {
11782       if (parts.length === 0) return cb(null, null);
11783       var p = parts.join('');
11784       exists(path.join(p, clue), function (itdoes) {
11785         if (itdoes) return cb(null, p);
11786         testDir(parts.slice(0, -1));
11787       });
11788     }
11789
11790     testDir(splitPath(currentFullPath));
11791   };
11792
11793   exports.sync = function (currentFullPath, clue) {
11794     function testDir(parts) {
11795       if (parts.length === 0) return null;
11796       var p = parts.join('');
11797       var itdoes = existsSync(path.join(p, clue));
11798       return itdoes ? p : testDir(parts.slice(0, -1));
11799     }
11800
11801     return testDir(splitPath(currentFullPath));
11802   };
11803 });
11804 var findParentDir_1 = findParentDir.sync;
11805
11806 // Returns a wrapper function that returns a wrapped callback
11807 // The wrapper function should do some stuff, and return a
11808 // presumably different callback function.
11809 // This makes sure that own properties are retained, so that
11810 // decorations and such are not lost along the way.
11811 var wrappy_1 = wrappy;
11812
11813 function wrappy(fn, cb) {
11814   if (fn && cb) return wrappy(fn)(cb);
11815   if (typeof fn !== 'function') throw new TypeError('need wrapper function');
11816   Object.keys(fn).forEach(function (k) {
11817     wrapper[k] = fn[k];
11818   });
11819   return wrapper;
11820
11821   function wrapper() {
11822     var args = new Array(arguments.length);
11823
11824     for (var i = 0; i < args.length; i++) {
11825       args[i] = arguments[i];
11826     }
11827
11828     var ret = fn.apply(this, args);
11829     var cb = args[args.length - 1];
11830
11831     if (typeof ret === 'function' && ret !== cb) {
11832       Object.keys(cb).forEach(function (k) {
11833         ret[k] = cb[k];
11834       });
11835     }
11836
11837     return ret;
11838   }
11839 }
11840
11841 var once_1 = wrappy_1(once);
11842 var strict = wrappy_1(onceStrict);
11843 once.proto = once(function () {
11844   Object.defineProperty(Function.prototype, 'once', {
11845     value: function () {
11846       return once(this);
11847     },
11848     configurable: true
11849   });
11850   Object.defineProperty(Function.prototype, 'onceStrict', {
11851     value: function () {
11852       return onceStrict(this);
11853     },
11854     configurable: true
11855   });
11856 });
11857
11858 function once(fn) {
11859   var f = function () {
11860     if (f.called) return f.value;
11861     f.called = true;
11862     return f.value = fn.apply(this, arguments);
11863   };
11864
11865   f.called = false;
11866   return f;
11867 }
11868
11869 function onceStrict(fn) {
11870   var f = function () {
11871     if (f.called) throw new Error(f.onceError);
11872     f.called = true;
11873     return f.value = fn.apply(this, arguments);
11874   };
11875
11876   var name = fn.name || 'Function wrapped with `once`';
11877   f.onceError = name + " shouldn't be called more than once";
11878   f.called = false;
11879   return f;
11880 }
11881 once_1.strict = strict;
11882
11883 var noop = function () {};
11884
11885 var isRequest = function (stream) {
11886   return stream.setHeader && typeof stream.abort === 'function';
11887 };
11888
11889 var isChildProcess = function (stream) {
11890   return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3;
11891 };
11892
11893 var eos = function (stream, opts, callback) {
11894   if (typeof opts === 'function') return eos(stream, null, opts);
11895   if (!opts) opts = {};
11896   callback = once_1(callback || noop);
11897   var ws = stream._writableState;
11898   var rs = stream._readableState;
11899   var readable = opts.readable || opts.readable !== false && stream.readable;
11900   var writable = opts.writable || opts.writable !== false && stream.writable;
11901   var cancelled = false;
11902
11903   var onlegacyfinish = function () {
11904     if (!stream.writable) onfinish();
11905   };
11906
11907   var onfinish = function () {
11908     writable = false;
11909     if (!readable) callback.call(stream);
11910   };
11911
11912   var onend = function () {
11913     readable = false;
11914     if (!writable) callback.call(stream);
11915   };
11916
11917   var onexit = function (exitCode) {
11918     callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null);
11919   };
11920
11921   var onerror = function (err) {
11922     callback.call(stream, err);
11923   };
11924
11925   var onclose = function () {
11926     process.nextTick(onclosenexttick);
11927   };
11928
11929   var onclosenexttick = function () {
11930     if (cancelled) return;
11931     if (readable && !(rs && rs.ended && !rs.destroyed)) return callback.call(stream, new Error('premature close'));
11932     if (writable && !(ws && ws.ended && !ws.destroyed)) return callback.call(stream, new Error('premature close'));
11933   };
11934
11935   var onrequest = function () {
11936     stream.req.on('finish', onfinish);
11937   };
11938
11939   if (isRequest(stream)) {
11940     stream.on('complete', onfinish);
11941     stream.on('abort', onclose);
11942     if (stream.req) onrequest();else stream.on('request', onrequest);
11943   } else if (writable && !ws) {
11944     // legacy streams
11945     stream.on('end', onlegacyfinish);
11946     stream.on('close', onlegacyfinish);
11947   }
11948
11949   if (isChildProcess(stream)) stream.on('exit', onexit);
11950   stream.on('end', onend);
11951   stream.on('finish', onfinish);
11952   if (opts.error !== false) stream.on('error', onerror);
11953   stream.on('close', onclose);
11954   return function () {
11955     cancelled = true;
11956     stream.removeListener('complete', onfinish);
11957     stream.removeListener('abort', onclose);
11958     stream.removeListener('request', onrequest);
11959     if (stream.req) stream.req.removeListener('finish', onfinish);
11960     stream.removeListener('end', onlegacyfinish);
11961     stream.removeListener('close', onlegacyfinish);
11962     stream.removeListener('finish', onfinish);
11963     stream.removeListener('exit', onexit);
11964     stream.removeListener('end', onend);
11965     stream.removeListener('error', onerror);
11966     stream.removeListener('close', onclose);
11967   };
11968 };
11969
11970 var endOfStream = eos;
11971
11972 var noop$1 = function () {};
11973
11974 var ancient = /^v?\.0/.test(process.version);
11975
11976 var isFn = function (fn) {
11977   return typeof fn === 'function';
11978 };
11979
11980 var isFS = function (stream) {
11981   if (!ancient) return false; // newer node version do not need to care about fs is a special way
11982
11983   if (!fs) return false; // browser
11984
11985   return (stream instanceof (fs.ReadStream || noop$1) || stream instanceof (fs.WriteStream || noop$1)) && isFn(stream.close);
11986 };
11987
11988 var isRequest$1 = function (stream) {
11989   return stream.setHeader && isFn(stream.abort);
11990 };
11991
11992 var destroyer = function (stream, reading, writing, callback) {
11993   callback = once_1(callback);
11994   var closed = false;
11995   stream.on('close', function () {
11996     closed = true;
11997   });
11998   endOfStream(stream, {
11999     readable: reading,
12000     writable: writing
12001   }, function (err) {
12002     if (err) return callback(err);
12003     closed = true;
12004     callback();
12005   });
12006   var destroyed = false;
12007   return function (err) {
12008     if (closed) return;
12009     if (destroyed) return;
12010     destroyed = true;
12011     if (isFS(stream)) return stream.close(noop$1); // use close for fs streams to avoid fd leaks
12012
12013     if (isRequest$1(stream)) return stream.abort(); // request.destroy just do .end - .abort is what we want
12014
12015     if (isFn(stream.destroy)) return stream.destroy();
12016     callback(err || new Error('stream was destroyed'));
12017   };
12018 };
12019
12020 var call = function (fn) {
12021   fn();
12022 };
12023
12024 var pipe = function (from, to) {
12025   return from.pipe(to);
12026 };
12027
12028 var pump = function () {
12029   var streams = Array.prototype.slice.call(arguments);
12030   var callback = isFn(streams[streams.length - 1] || noop$1) && streams.pop() || noop$1;
12031   if (Array.isArray(streams[0])) streams = streams[0];
12032   if (streams.length < 2) throw new Error('pump requires two streams per minimum');
12033   var error;
12034   var destroys = streams.map(function (stream, i) {
12035     var reading = i < streams.length - 1;
12036     var writing = i > 0;
12037     return destroyer(stream, reading, writing, function (err) {
12038       if (!error) error = err;
12039       if (err) destroys.forEach(call);
12040       if (reading) return;
12041       destroys.forEach(call);
12042       callback(error);
12043     });
12044   });
12045   return streams.reduce(pipe);
12046 };
12047
12048 var pump_1 = pump;
12049
12050 const {
12051   PassThrough: PassThroughStream
12052 } = stream;
12053
12054 var bufferStream = options => {
12055   options = Object.assign({}, options);
12056   const {
12057     array
12058   } = options;
12059   let {
12060     encoding
12061   } = options;
12062   const isBuffer = encoding === 'buffer';
12063   let objectMode = false;
12064
12065   if (array) {
12066     objectMode = !(encoding || isBuffer);
12067   } else {
12068     encoding = encoding || 'utf8';
12069   }
12070
12071   if (isBuffer) {
12072     encoding = null;
12073   }
12074
12075   const stream = new PassThroughStream({
12076     objectMode
12077   });
12078
12079   if (encoding) {
12080     stream.setEncoding(encoding);
12081   }
12082
12083   let length = 0;
12084   const chunks = [];
12085   stream.on('data', chunk => {
12086     chunks.push(chunk);
12087
12088     if (objectMode) {
12089       length = chunks.length;
12090     } else {
12091       length += chunk.length;
12092     }
12093   });
12094
12095   stream.getBufferedValue = () => {
12096     if (array) {
12097       return chunks;
12098     }
12099
12100     return isBuffer ? Buffer.concat(chunks, length) : chunks.join('');
12101   };
12102
12103   stream.getBufferedLength = () => length;
12104
12105   return stream;
12106 };
12107
12108 class MaxBufferError extends Error {
12109   constructor() {
12110     super('maxBuffer exceeded');
12111     this.name = 'MaxBufferError';
12112   }
12113
12114 }
12115
12116 async function getStream(inputStream, options) {
12117   if (!inputStream) {
12118     return Promise.reject(new Error('Expected a stream'));
12119   }
12120
12121   options = Object.assign({
12122     maxBuffer: Infinity
12123   }, options);
12124   const {
12125     maxBuffer
12126   } = options;
12127   let stream;
12128   await new Promise((resolve, reject) => {
12129     const rejectPromise = error => {
12130       if (error) {
12131         // A null check
12132         error.bufferedData = stream.getBufferedValue();
12133       }
12134
12135       reject(error);
12136     };
12137
12138     stream = pump_1(inputStream, bufferStream(options), error => {
12139       if (error) {
12140         rejectPromise(error);
12141         return;
12142       }
12143
12144       resolve();
12145     });
12146     stream.on('data', () => {
12147       if (stream.getBufferedLength() > maxBuffer) {
12148         rejectPromise(new MaxBufferError());
12149       }
12150     });
12151   });
12152   return stream.getBufferedValue();
12153 }
12154
12155 var getStream_1 = getStream; // TODO: Remove this for the next major release
12156
12157 var default_1 = getStream;
12158
12159 var buffer = (stream, options) => getStream(stream, Object.assign({}, options, {
12160   encoding: 'buffer'
12161 }));
12162
12163 var array = (stream, options) => getStream(stream, Object.assign({}, options, {
12164   array: true
12165 }));
12166
12167 var MaxBufferError_1 = MaxBufferError;
12168 getStream_1.default = default_1;
12169 getStream_1.buffer = buffer;
12170 getStream_1.array = array;
12171 getStream_1.MaxBufferError = MaxBufferError_1;
12172
12173 var vendors = [
12174         {
12175                 name: "AppVeyor",
12176                 constant: "APPVEYOR",
12177                 env: "APPVEYOR",
12178                 pr: "APPVEYOR_PULL_REQUEST_NUMBER"
12179         },
12180         {
12181                 name: "Azure Pipelines",
12182                 constant: "AZURE_PIPELINES",
12183                 env: "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",
12184                 pr: "SYSTEM_PULLREQUEST_PULLREQUESTID"
12185         },
12186         {
12187                 name: "Bamboo",
12188                 constant: "BAMBOO",
12189                 env: "bamboo_planKey"
12190         },
12191         {
12192                 name: "Bitbucket Pipelines",
12193                 constant: "BITBUCKET",
12194                 env: "BITBUCKET_COMMIT",
12195                 pr: "BITBUCKET_PR_ID"
12196         },
12197         {
12198                 name: "Bitrise",
12199                 constant: "BITRISE",
12200                 env: "BITRISE_IO",
12201                 pr: "BITRISE_PULL_REQUEST"
12202         },
12203         {
12204                 name: "Buddy",
12205                 constant: "BUDDY",
12206                 env: "BUDDY_WORKSPACE_ID",
12207                 pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
12208         },
12209         {
12210                 name: "Buildkite",
12211                 constant: "BUILDKITE",
12212                 env: "BUILDKITE",
12213                 pr: {
12214                         env: "BUILDKITE_PULL_REQUEST",
12215                         ne: "false"
12216                 }
12217         },
12218         {
12219                 name: "CircleCI",
12220                 constant: "CIRCLE",
12221                 env: "CIRCLECI",
12222                 pr: "CIRCLE_PULL_REQUEST"
12223         },
12224         {
12225                 name: "Cirrus CI",
12226                 constant: "CIRRUS",
12227                 env: "CIRRUS_CI",
12228                 pr: "CIRRUS_PR"
12229         },
12230         {
12231                 name: "AWS CodeBuild",
12232                 constant: "CODEBUILD",
12233                 env: "CODEBUILD_BUILD_ARN"
12234         },
12235         {
12236                 name: "Codeship",
12237                 constant: "CODESHIP",
12238                 env: {
12239                         CI_NAME: "codeship"
12240                 }
12241         },
12242         {
12243                 name: "Drone",
12244                 constant: "DRONE",
12245                 env: "DRONE",
12246                 pr: {
12247                         DRONE_BUILD_EVENT: "pull_request"
12248                 }
12249         },
12250         {
12251                 name: "dsari",
12252                 constant: "DSARI",
12253                 env: "DSARI"
12254         },
12255         {
12256                 name: "GitHub Actions",
12257                 constant: "GITHUB_ACTIONS",
12258                 env: "GITHUB_ACTIONS",
12259                 pr: {
12260                         GITHUB_EVENT_NAME: "pull_request"
12261                 }
12262         },
12263         {
12264                 name: "GitLab CI",
12265                 constant: "GITLAB",
12266                 env: "GITLAB_CI"
12267         },
12268         {
12269                 name: "GoCD",
12270                 constant: "GOCD",
12271                 env: "GO_PIPELINE_LABEL"
12272         },
12273         {
12274                 name: "Hudson",
12275                 constant: "HUDSON",
12276                 env: "HUDSON_URL"
12277         },
12278         {
12279                 name: "Jenkins",
12280                 constant: "JENKINS",
12281                 env: [
12282                         "JENKINS_URL",
12283                         "BUILD_ID"
12284                 ],
12285                 pr: {
12286                         any: [
12287                                 "ghprbPullId",
12288                                 "CHANGE_ID"
12289                         ]
12290                 }
12291         },
12292         {
12293                 name: "ZEIT Now",
12294                 constant: "ZEIT_NOW",
12295                 env: "NOW_BUILDER"
12296         },
12297         {
12298                 name: "Magnum CI",
12299                 constant: "MAGNUM",
12300                 env: "MAGNUM"
12301         },
12302         {
12303                 name: "Netlify CI",
12304                 constant: "NETLIFY",
12305                 env: "NETLIFY",
12306                 pr: {
12307                         env: "PULL_REQUEST",
12308                         ne: "false"
12309                 }
12310         },
12311         {
12312                 name: "Nevercode",
12313                 constant: "NEVERCODE",
12314                 env: "NEVERCODE",
12315                 pr: {
12316                         env: "NEVERCODE_PULL_REQUEST",
12317                         ne: "false"
12318                 }
12319         },
12320         {
12321                 name: "Render",
12322                 constant: "RENDER",
12323                 env: "RENDER",
12324                 pr: {
12325                         IS_PULL_REQUEST: "true"
12326                 }
12327         },
12328         {
12329                 name: "Sail CI",
12330                 constant: "SAIL",
12331                 env: "SAILCI",
12332                 pr: "SAIL_PULL_REQUEST_NUMBER"
12333         },
12334         {
12335                 name: "Semaphore",
12336                 constant: "SEMAPHORE",
12337                 env: "SEMAPHORE",
12338                 pr: "PULL_REQUEST_NUMBER"
12339         },
12340         {
12341                 name: "Shippable",
12342                 constant: "SHIPPABLE",
12343                 env: "SHIPPABLE",
12344                 pr: {
12345                         IS_PULL_REQUEST: "true"
12346                 }
12347         },
12348         {
12349                 name: "Solano CI",
12350                 constant: "SOLANO",
12351                 env: "TDDIUM",
12352                 pr: "TDDIUM_PR_ID"
12353         },
12354         {
12355                 name: "Strider CD",
12356                 constant: "STRIDER",
12357                 env: "STRIDER"
12358         },
12359         {
12360                 name: "TaskCluster",
12361                 constant: "TASKCLUSTER",
12362                 env: [
12363                         "TASK_ID",
12364                         "RUN_ID"
12365                 ]
12366         },
12367         {
12368                 name: "TeamCity",
12369                 constant: "TEAMCITY",
12370                 env: "TEAMCITY_VERSION"
12371         },
12372         {
12373                 name: "Travis CI",
12374                 constant: "TRAVIS",
12375                 env: "TRAVIS",
12376                 pr: {
12377                         env: "TRAVIS_PULL_REQUEST",
12378                         ne: "false"
12379                 }
12380         }
12381 ];
12382
12383 var vendors$1 = /*#__PURE__*/Object.freeze({
12384         __proto__: null,
12385         'default': vendors
12386 });
12387
12388 var vendors$2 = getCjsExportFromNamespace(vendors$1);
12389
12390 var ciInfo = createCommonjsModule(function (module, exports) {
12391
12392   var env = process.env; // Used for testing only
12393
12394   Object.defineProperty(exports, '_vendors', {
12395     value: vendors$2.map(function (v) {
12396       return v.constant;
12397     })
12398   });
12399   exports.name = null;
12400   exports.isPR = null;
12401   vendors$2.forEach(function (vendor) {
12402     var envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
12403     var isCI = envs.every(function (obj) {
12404       return checkEnv(obj);
12405     });
12406     exports[vendor.constant] = isCI;
12407
12408     if (isCI) {
12409       exports.name = vendor.name;
12410
12411       switch (typeof vendor.pr) {
12412         case 'string':
12413           // "pr": "CIRRUS_PR"
12414           exports.isPR = !!env[vendor.pr];
12415           break;
12416
12417         case 'object':
12418           if ('env' in vendor.pr) {
12419             // "pr": { "env": "BUILDKITE_PULL_REQUEST", "ne": "false" }
12420             exports.isPR = vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne;
12421           } else if ('any' in vendor.pr) {
12422             // "pr": { "any": ["ghprbPullId", "CHANGE_ID"] }
12423             exports.isPR = vendor.pr.any.some(function (key) {
12424               return !!env[key];
12425             });
12426           } else {
12427             // "pr": { "DRONE_BUILD_EVENT": "pull_request" }
12428             exports.isPR = checkEnv(vendor.pr);
12429           }
12430
12431           break;
12432
12433         default:
12434           // PR detection not supported for this vendor
12435           exports.isPR = null;
12436       }
12437     }
12438   });
12439   exports.isCI = !!(env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari
12440   env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
12441   env.BUILD_NUMBER || // Jenkins, TeamCity
12442   env.RUN_ID || // TaskCluster, dsari
12443   exports.name || false);
12444
12445   function checkEnv(obj) {
12446     if (typeof obj === 'string') return !!env[obj];
12447     return Object.keys(obj).every(function (k) {
12448       return env[k] === obj[k];
12449     });
12450   }
12451 });
12452 var ciInfo_1 = ciInfo.name;
12453 var ciInfo_2 = ciInfo.isPR;
12454 var ciInfo_3 = ciInfo.isCI;
12455
12456 var thirdParty = {
12457   cosmiconfig: dist$2.cosmiconfig,
12458   cosmiconfigSync: dist$2.cosmiconfigSync,
12459   findParentDir: findParentDir.sync,
12460   getStream: getStream_1,
12461   isCI: () => ciInfo.isCI
12462 };
12463 var thirdParty_1 = thirdParty.cosmiconfig;
12464 var thirdParty_2 = thirdParty.cosmiconfigSync;
12465 var thirdParty_3 = thirdParty.findParentDir;
12466 var thirdParty_4 = thirdParty.getStream;
12467 var thirdParty_5 = thirdParty.isCI;
12468
12469 exports.cosmiconfig = thirdParty_1;
12470 exports.cosmiconfigSync = thirdParty_2;
12471 exports.default = thirdParty;
12472 exports.findParentDir = thirdParty_3;
12473 exports.getStream = thirdParty_4;
12474 exports.isCI = thirdParty_5;