LCOV - code coverage report
Current view: top level - external - remarkable-meta.js (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 444 2672 16.6 %
Date: 2021-03-12 10:43:40 Functions: 10 143 7.0 %

          Line data    Source code
       1           0 : function isNothing(subject) {
       2           0 :     return typeof subject === "undefined" || subject === null;
       3           0 : }
       4           0 : function isObject(subject) {
       5           0 :     return typeof subject === "object" && subject !== null;
       6           0 : }
       7           0 : function toArray(sequence) {
       8           0 :     if (Array.isArray(sequence)) return sequence;
       9           0 :     else if (isNothing(sequence)) return [];
      10           0 :     return [
      11           0 :         sequence
      12           0 :     ];
      13           0 : }
      14           0 : function extend(target, source) {
      15           0 :     var index, length, key, sourceKeys;
      16           0 :     if (source) {
      17           0 :         sourceKeys = Object.keys(source);
      18           0 :         for(index = 0, length = sourceKeys.length; index < length; index += 1){
      19           0 :             key = sourceKeys[index];
      20           0 :             target[key] = source[key];
      21           0 :         }
      22           0 :     }
      23           0 :     return target;
      24           0 : }
      25           0 : function repeat(string, count) {
      26           0 :     var result = "", cycle;
      27           0 :     for(cycle = 0; cycle < count; cycle += 1){
      28           0 :         result += string;
      29           0 :     }
      30           0 :     return result;
      31           0 : }
      32           0 : function isNegativeZero(number) {
      33           0 :     return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
      34           0 : }
      35           1 : var isNothing_1 = isNothing;
      36           1 : var isObject_1 = isObject;
      37           1 : var toArray_1 = toArray;
      38           1 : var repeat_1 = repeat;
      39           1 : var isNegativeZero_1 = isNegativeZero;
      40           1 : var extend_1 = extend;
      41           1 : var common = {
      42           1 :     isNothing: isNothing_1,
      43           1 :     isObject: isObject_1,
      44           1 :     toArray: toArray_1,
      45           1 :     repeat: repeat_1,
      46           1 :     isNegativeZero: isNegativeZero_1,
      47           1 :     extend: extend_1
      48           1 : };
      49           0 : function YAMLException(reason, mark2) {
      50           0 :     Error.call(this);
      51           0 :     this.name = "YAMLException";
      52           0 :     this.reason = reason;
      53           0 :     this.mark = mark2;
      54           0 :     this.message = (this.reason || "(unknown reason)") + (this.mark ? " " + this.mark.toString() : "");
      55           0 :     if (Error.captureStackTrace) {
      56           0 :         Error.captureStackTrace(this, this.constructor);
      57           0 :     } else {
      58           0 :         this.stack = new Error().stack || "";
      59           0 :     }
      60           0 : }
      61           1 : YAMLException.prototype = Object.create(Error.prototype);
      62           1 : YAMLException.prototype.constructor = YAMLException;
      63           0 : YAMLException.prototype.toString = function toString(compact) {
      64           0 :     var result = this.name + ": ";
      65           0 :     result += this.reason || "(unknown reason)";
      66           0 :     if (!compact && this.mark) {
      67           0 :         result += " " + this.mark.toString();
      68           0 :     }
      69           0 :     return result;
      70           0 : };
      71           1 : var exception = YAMLException;
      72           0 : function Mark(name, buffer, position, line, column) {
      73           0 :     this.name = name;
      74           0 :     this.buffer = buffer;
      75           0 :     this.position = position;
      76           0 :     this.line = line;
      77           0 :     this.column = column;
      78           0 : }
      79           0 : Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
      80           0 :     var head, start, tail, end, snippet;
      81           0 :     if (!this.buffer) return null;
      82           0 :     indent = indent || 4;
      83           0 :     maxLength = maxLength || 75;
      84           0 :     head = "";
      85           0 :     start = this.position;
      86           0 :     while(start > 0 && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(start - 1)) === -1){
      87           0 :         start -= 1;
      88           0 :         if (this.position - start > maxLength / 2 - 1) {
      89           0 :             head = " ... ";
      90           0 :             start += 5;
      91           0 :             break;
      92           0 :         }
      93           0 :     }
      94           0 :     tail = "";
      95           0 :     end = this.position;
      96           0 :     while(end < this.buffer.length && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(end)) === -1){
      97           0 :         end += 1;
      98           0 :         if (end - this.position > maxLength / 2 - 1) {
      99           0 :             tail = " ... ";
     100           0 :             end -= 5;
     101           0 :             break;
     102           0 :         }
     103           0 :     }
     104           0 :     snippet = this.buffer.slice(start, end);
     105           0 :     return common.repeat(" ", indent) + head + snippet + tail + "\n" + common.repeat(" ", indent + this.position - start + head.length) + "^";
     106           0 : };
     107           0 : Mark.prototype.toString = function toString2(compact) {
     108           0 :     var snippet, where = "";
     109           0 :     if (this.name) {
     110           0 :         where += 'in "' + this.name + '" ';
     111           0 :     }
     112           0 :     where += "at line " + (this.line + 1) + ", column " + (this.column + 1);
     113           0 :     if (!compact) {
     114           0 :         snippet = this.getSnippet();
     115           0 :         if (snippet) {
     116           0 :             where += ":\n" + snippet;
     117           0 :         }
     118           0 :     }
     119           0 :     return where;
     120           0 : };
     121           1 : var mark = Mark;
     122           1 : var TYPE_CONSTRUCTOR_OPTIONS = [
     123           1 :     "kind",
     124           1 :     "resolve",
     125           1 :     "construct",
     126           1 :     "instanceOf",
     127           1 :     "predicate",
     128           1 :     "represent",
     129           1 :     "defaultStyle",
     130           1 :     "styleAliases"
     131           1 : ];
     132           1 : var YAML_NODE_KINDS = [
     133           1 :     "scalar",
     134           1 :     "sequence",
     135           1 :     "mapping"
     136           1 : ];
     137          17 : function compileStyleAliases(map2) {
     138          17 :     var result = {
     139          17 :     };
     140          17 :     if (map2 !== null) {
     141          18 :         Object.keys(map2).forEach(function(style) {
     142          22 :             map2[style].forEach(function(alias) {
     143          30 :                 result[String(alias)] = style;
     144          22 :             });
     145          18 :         });
     146          17 :     }
     147          17 :     return result;
     148           1 : }
     149          17 : function Type(tag, options) {
     150           0 :     options = options || {
     151           0 :     };
     152          17 :     Object.keys(options).forEach(function(name) {
     153           0 :         if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
     154           0 :             throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
     155           0 :         }
     156          17 :     });
     157          17 :     this.tag = tag;
     158           0 :     this.kind = options["kind"] || null;
     159           0 :     this.resolve = options["resolve"] || function() {
     160           0 :         return true;
     161           0 :     };
     162           0 :     this.construct = options["construct"] || function(data) {
     163           0 :         return data;
     164           0 :     };
     165          17 :     this.instanceOf = options["instanceOf"] || null;
     166          17 :     this.predicate = options["predicate"] || null;
     167          17 :     this.represent = options["represent"] || null;
     168          17 :     this.defaultStyle = options["defaultStyle"] || null;
     169          17 :     this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
     170           0 :     if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
     171           0 :         throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
     172           0 :     }
     173           1 : }
     174           1 : var type = Type;
     175          31 : function compileList(schema2, name, result) {
     176          31 :     var exclude = [];
     177          31 :     schema2.include.forEach(function(includedSchema) {
     178          51 :         result = compileList(includedSchema, name, result);
     179          31 :     });
     180          31 :     schema2[name].forEach(function(currentType) {
     181          77 :         result.forEach(function(previousType, previousIndex) {
     182           0 :             if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
     183           0 :                 exclude.push(previousIndex);
     184           0 :             }
     185          77 :         });
     186          77 :         result.push(currentType);
     187          31 :     });
     188          31 :     return result.filter(function(type2, index) {
     189         137 :         return exclude.indexOf(index) === -1;
     190          31 :     });
     191           1 : }
     192           6 : function compileMap() {
     193           6 :     var result = {
     194           6 :         scalar: {
     195           6 :         },
     196           6 :         sequence: {
     197           6 :         },
     198           6 :         mapping: {
     199           6 :         },
     200           6 :         fallback: {
     201           6 :         }
     202           6 :     }, index, length;
     203           6 :     function collectType(type2) {
     204          52 :         result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
     205           6 :     }
     206           6 :     for(index = 0, length = arguments.length; index < length; index += 1){
     207          16 :         arguments[index].forEach(collectType);
     208           6 :     }
     209           6 :     return result;
     210           1 : }
     211           6 : function Schema(definition) {
     212           6 :     this.include = definition.include || [];
     213           6 :     this.implicit = definition.implicit || [];
     214           6 :     this.explicit = definition.explicit || [];
     215           6 :     this.implicit.forEach(function(type2) {
     216           0 :         if (type2.loadKind && type2.loadKind !== "scalar") {
     217           0 :             throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
     218           0 :         }
     219           6 :     });
     220           6 :     this.compiledImplicit = compileList(this, "implicit", []);
     221           6 :     this.compiledExplicit = compileList(this, "explicit", []);
     222           6 :     this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
     223           1 : }
     224           1 : Schema.DEFAULT = null;
     225           0 : Schema.create = function createSchema() {
     226           0 :     var schemas, types;
     227           0 :     switch(arguments.length){
     228           0 :         case 1:
     229           0 :             schemas = Schema.DEFAULT;
     230           0 :             types = arguments[0];
     231           0 :             break;
     232           0 :         case 2:
     233           0 :             schemas = arguments[0];
     234           0 :             types = arguments[1];
     235           0 :             break;
     236           0 :         default:
     237           0 :             throw new exception("Wrong number of arguments for Schema.create function");
     238           0 :     }
     239           0 :     schemas = common.toArray(schemas);
     240           0 :     types = common.toArray(types);
     241           0 :     if (!schemas.every(function(schema2) {
     242           0 :         return schema2 instanceof Schema;
     243           0 :     })) {
     244           0 :         throw new exception("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
     245           0 :     }
     246           0 :     if (!types.every(function(type$1) {
     247           0 :         return type$1 instanceof type;
     248           0 :     })) {
     249           0 :         throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
     250           0 :     }
     251           0 :     return new Schema({
     252           0 :         include: schemas,
     253           0 :         explicit: types
     254           0 :     });
     255           0 : };
     256           1 : var schema = Schema;
     257           1 : var str = new type("tag:yaml.org,2002:str", {
     258           1 :     kind: "scalar",
     259           0 :     construct: function(data) {
     260           0 :         return data !== null ? data : "";
     261           0 :     }
     262           1 : });
     263           1 : var seq = new type("tag:yaml.org,2002:seq", {
     264           1 :     kind: "sequence",
     265           0 :     construct: function(data) {
     266           0 :         return data !== null ? data : [];
     267           0 :     }
     268           1 : });
     269           1 : var map = new type("tag:yaml.org,2002:map", {
     270           1 :     kind: "mapping",
     271           0 :     construct: function(data) {
     272           0 :         return data !== null ? data : {
     273           0 :         };
     274           0 :     }
     275           1 : });
     276           1 : var failsafe = new schema({
     277           1 :     explicit: [
     278           1 :         str,
     279           1 :         seq,
     280           1 :         map
     281           1 :     ]
     282           1 : });
     283           0 : function resolveYamlNull(data) {
     284           0 :     if (data === null) return true;
     285           0 :     var max = data.length;
     286           0 :     return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
     287           0 : }
     288           0 : function constructYamlNull() {
     289           0 :     return null;
     290           0 : }
     291           0 : function isNull(object) {
     292           0 :     return object === null;
     293           0 : }
     294           1 : var _null = new type("tag:yaml.org,2002:null", {
     295           1 :     kind: "scalar",
     296           1 :     resolve: resolveYamlNull,
     297           1 :     construct: constructYamlNull,
     298           1 :     predicate: isNull,
     299           1 :     represent: {
     300           0 :         canonical: function() {
     301           0 :             return "~";
     302           0 :         },
     303           0 :         lowercase: function() {
     304           0 :             return "null";
     305           0 :         },
     306           0 :         uppercase: function() {
     307           0 :             return "NULL";
     308           0 :         },
     309           0 :         camelcase: function() {
     310           0 :             return "Null";
     311           0 :         }
     312           1 :     },
     313           1 :     defaultStyle: "lowercase"
     314           1 : });
     315           0 : function resolveYamlBoolean(data) {
     316           0 :     if (data === null) return false;
     317           0 :     var max = data.length;
     318           0 :     return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
     319           0 : }
     320           0 : function constructYamlBoolean(data) {
     321           0 :     return data === "true" || data === "True" || data === "TRUE";
     322           0 : }
     323           0 : function isBoolean(object) {
     324           0 :     return Object.prototype.toString.call(object) === "[object Boolean]";
     325           0 : }
     326           1 : var bool = new type("tag:yaml.org,2002:bool", {
     327           1 :     kind: "scalar",
     328           1 :     resolve: resolveYamlBoolean,
     329           1 :     construct: constructYamlBoolean,
     330           1 :     predicate: isBoolean,
     331           1 :     represent: {
     332           0 :         lowercase: function(object) {
     333           0 :             return object ? "true" : "false";
     334           0 :         },
     335           0 :         uppercase: function(object) {
     336           0 :             return object ? "TRUE" : "FALSE";
     337           0 :         },
     338           0 :         camelcase: function(object) {
     339           0 :             return object ? "True" : "False";
     340           0 :         }
     341           1 :     },
     342           1 :     defaultStyle: "lowercase"
     343           1 : });
     344           0 : function isHexCode(c) {
     345           0 :     return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
     346           0 : }
     347           0 : function isOctCode(c) {
     348           0 :     return 48 <= c && c <= 55;
     349           0 : }
     350           0 : function isDecCode(c) {
     351           0 :     return 48 <= c && c <= 57;
     352           0 : }
     353           0 : function resolveYamlInteger(data) {
     354           0 :     if (data === null) return false;
     355           0 :     var max = data.length, index = 0, hasDigits = false, ch;
     356           0 :     if (!max) return false;
     357           0 :     ch = data[index];
     358           0 :     if (ch === "-" || ch === "+") {
     359           0 :         ch = data[++index];
     360           0 :     }
     361           0 :     if (ch === "0") {
     362           0 :         if (index + 1 === max) return true;
     363           0 :         ch = data[++index];
     364           0 :         if (ch === "b") {
     365           0 :             index++;
     366           0 :             for(; index < max; index++){
     367           0 :                 ch = data[index];
     368           0 :                 if (ch === "_") continue;
     369           0 :                 if (ch !== "0" && ch !== "1") return false;
     370           0 :                 hasDigits = true;
     371           0 :             }
     372           0 :             return hasDigits && ch !== "_";
     373           0 :         }
     374           0 :         if (ch === "x") {
     375           0 :             index++;
     376           0 :             for(; index < max; index++){
     377           0 :                 ch = data[index];
     378           0 :                 if (ch === "_") continue;
     379           0 :                 if (!isHexCode(data.charCodeAt(index))) return false;
     380           0 :                 hasDigits = true;
     381           0 :             }
     382           0 :             return hasDigits && ch !== "_";
     383           0 :         }
     384           0 :         for(; index < max; index++){
     385           0 :             ch = data[index];
     386           0 :             if (ch === "_") continue;
     387           0 :             if (!isOctCode(data.charCodeAt(index))) return false;
     388           0 :             hasDigits = true;
     389           0 :         }
     390           0 :         return hasDigits && ch !== "_";
     391           0 :     }
     392           0 :     if (ch === "_") return false;
     393           0 :     for(; index < max; index++){
     394           0 :         ch = data[index];
     395           0 :         if (ch === "_") continue;
     396           0 :         if (ch === ":") break;
     397           0 :         if (!isDecCode(data.charCodeAt(index))) {
     398           0 :             return false;
     399           0 :         }
     400           0 :         hasDigits = true;
     401           0 :     }
     402           0 :     if (!hasDigits || ch === "_") return false;
     403           0 :     if (ch !== ":") return true;
     404           0 :     return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
     405           0 : }
     406           0 : function constructYamlInteger(data) {
     407           0 :     var value = data, sign = 1, ch, base, digits = [];
     408           0 :     if (value.indexOf("_") !== -1) {
     409           0 :         value = value.replace(/_/g, "");
     410           0 :     }
     411           0 :     ch = value[0];
     412           0 :     if (ch === "-" || ch === "+") {
     413           0 :         if (ch === "-") sign = -1;
     414           0 :         value = value.slice(1);
     415           0 :         ch = value[0];
     416           0 :     }
     417           0 :     if (value === "0") return 0;
     418           0 :     if (ch === "0") {
     419           0 :         if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
     420           0 :         if (value[1] === "x") return sign * parseInt(value, 16);
     421           0 :         return sign * parseInt(value, 8);
     422           0 :     }
     423           0 :     if (value.indexOf(":") !== -1) {
     424           0 :         value.split(":").forEach(function(v) {
     425           0 :             digits.unshift(parseInt(v, 10));
     426           0 :         });
     427           0 :         value = 0;
     428           0 :         base = 1;
     429           0 :         digits.forEach(function(d) {
     430           0 :             value += d * base;
     431           0 :             base *= 60;
     432           0 :         });
     433           0 :         return sign * value;
     434           0 :     }
     435           0 :     return sign * parseInt(value, 10);
     436           0 : }
     437           0 : function isInteger(object) {
     438           0 :     return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
     439           0 : }
     440           1 : var int_1 = new type("tag:yaml.org,2002:int", {
     441           1 :     kind: "scalar",
     442           1 :     resolve: resolveYamlInteger,
     443           1 :     construct: constructYamlInteger,
     444           1 :     predicate: isInteger,
     445           1 :     represent: {
     446           0 :         binary: function(obj) {
     447           0 :             return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
     448           0 :         },
     449           0 :         octal: function(obj) {
     450           0 :             return obj >= 0 ? "0" + obj.toString(8) : "-0" + obj.toString(8).slice(1);
     451           0 :         },
     452           0 :         decimal: function(obj) {
     453           0 :             return obj.toString(10);
     454           0 :         },
     455           0 :         hexadecimal: function(obj) {
     456           0 :             return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
     457           0 :         }
     458           1 :     },
     459           1 :     defaultStyle: "decimal",
     460           1 :     styleAliases: {
     461           1 :         binary: [
     462           1 :             2,
     463           1 :             "bin"
     464           1 :         ],
     465           1 :         octal: [
     466           1 :             8,
     467           1 :             "oct"
     468           1 :         ],
     469           1 :         decimal: [
     470           1 :             10,
     471           1 :             "dec"
     472           1 :         ],
     473           1 :         hexadecimal: [
     474           1 :             16,
     475           1 :             "hex"
     476           1 :         ]
     477           1 :     }
     478           1 : });
     479           1 : var YAML_FLOAT_PATTERN = new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
     480           0 : function resolveYamlFloat(data) {
     481           0 :     if (data === null) return false;
     482           0 :     if (!YAML_FLOAT_PATTERN.test(data) || data[data.length - 1] === "_") {
     483           0 :         return false;
     484           0 :     }
     485           0 :     return true;
     486           0 : }
     487           0 : function constructYamlFloat(data) {
     488           0 :     var value, sign, base, digits;
     489           0 :     value = data.replace(/_/g, "").toLowerCase();
     490           0 :     sign = value[0] === "-" ? -1 : 1;
     491           0 :     digits = [];
     492           0 :     if ("+-".indexOf(value[0]) >= 0) {
     493           0 :         value = value.slice(1);
     494           0 :     }
     495           0 :     if (value === ".inf") {
     496           0 :         return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
     497           0 :     } else if (value === ".nan") {
     498           0 :         return NaN;
     499           0 :     } else if (value.indexOf(":") >= 0) {
     500           0 :         value.split(":").forEach(function(v) {
     501           0 :             digits.unshift(parseFloat(v, 10));
     502           0 :         });
     503           0 :         value = 0;
     504           0 :         base = 1;
     505           0 :         digits.forEach(function(d) {
     506           0 :             value += d * base;
     507           0 :             base *= 60;
     508           0 :         });
     509           0 :         return sign * value;
     510           0 :     }
     511           0 :     return sign * parseFloat(value, 10);
     512           0 : }
     513           1 : var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
     514           0 : function representYamlFloat(object, style) {
     515           0 :     var res;
     516           0 :     if (isNaN(object)) {
     517           0 :         switch(style){
     518           0 :             case "lowercase":
     519           0 :                 return ".nan";
     520           0 :             case "uppercase":
     521           0 :                 return ".NAN";
     522           0 :             case "camelcase":
     523           0 :                 return ".NaN";
     524           0 :         }
     525           0 :     } else if (Number.POSITIVE_INFINITY === object) {
     526           0 :         switch(style){
     527           0 :             case "lowercase":
     528           0 :                 return ".inf";
     529           0 :             case "uppercase":
     530           0 :                 return ".INF";
     531           0 :             case "camelcase":
     532           0 :                 return ".Inf";
     533           0 :         }
     534           0 :     } else if (Number.NEGATIVE_INFINITY === object) {
     535           0 :         switch(style){
     536           0 :             case "lowercase":
     537           0 :                 return "-.inf";
     538           0 :             case "uppercase":
     539           0 :                 return "-.INF";
     540           0 :             case "camelcase":
     541           0 :                 return "-.Inf";
     542           0 :         }
     543           0 :     } else if (common.isNegativeZero(object)) {
     544           0 :         return "-0.0";
     545           0 :     }
     546           0 :     res = object.toString(10);
     547           0 :     return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
     548           0 : }
     549           0 : function isFloat(object) {
     550           0 :     return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
     551           0 : }
     552           1 : var float_1 = new type("tag:yaml.org,2002:float", {
     553           1 :     kind: "scalar",
     554           1 :     resolve: resolveYamlFloat,
     555           1 :     construct: constructYamlFloat,
     556           1 :     predicate: isFloat,
     557           1 :     represent: representYamlFloat,
     558           1 :     defaultStyle: "lowercase"
     559           1 : });
     560           1 : var json = new schema({
     561           1 :     include: [
     562           1 :         failsafe
     563           1 :     ],
     564           1 :     implicit: [
     565           1 :         _null,
     566           1 :         bool,
     567           1 :         int_1,
     568           1 :         float_1
     569           1 :     ]
     570           1 : });
     571           1 : var core = new schema({
     572           1 :     include: [
     573           1 :         json
     574           1 :     ]
     575           1 : });
     576           1 : var YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
     577           1 : var YAML_TIMESTAMP_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
     578           0 : function resolveYamlTimestamp(data) {
     579           0 :     if (data === null) return false;
     580           0 :     if (YAML_DATE_REGEXP.exec(data) !== null) return true;
     581           0 :     if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
     582           0 :     return false;
     583           0 : }
     584           0 : function constructYamlTimestamp(data) {
     585           0 :     var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
     586           0 :     match = YAML_DATE_REGEXP.exec(data);
     587           0 :     if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
     588           0 :     if (match === null) throw new Error("Date resolve error");
     589           0 :     year = +match[1];
     590           0 :     month = +match[2] - 1;
     591           0 :     day = +match[3];
     592           0 :     if (!match[4]) {
     593           0 :         return new Date(Date.UTC(year, month, day));
     594           0 :     }
     595           0 :     hour = +match[4];
     596           0 :     minute = +match[5];
     597           0 :     second = +match[6];
     598           0 :     if (match[7]) {
     599           0 :         fraction = match[7].slice(0, 3);
     600           0 :         while(fraction.length < 3){
     601           0 :             fraction += "0";
     602           0 :         }
     603           0 :         fraction = +fraction;
     604           0 :     }
     605           0 :     if (match[9]) {
     606           0 :         tz_hour = +match[10];
     607           0 :         tz_minute = +(match[11] || 0);
     608           0 :         delta = (tz_hour * 60 + tz_minute) * 60000;
     609           0 :         if (match[9] === "-") delta = -delta;
     610           0 :     }
     611           0 :     date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
     612           0 :     if (delta) date.setTime(date.getTime() - delta);
     613           0 :     return date;
     614           0 : }
     615           0 : function representYamlTimestamp(object) {
     616           0 :     return object.toISOString();
     617           0 : }
     618           1 : var timestamp = new type("tag:yaml.org,2002:timestamp", {
     619           1 :     kind: "scalar",
     620           1 :     resolve: resolveYamlTimestamp,
     621           1 :     construct: constructYamlTimestamp,
     622           1 :     instanceOf: Date,
     623           1 :     represent: representYamlTimestamp
     624           1 : });
     625           0 : function resolveYamlMerge(data) {
     626           0 :     return data === "<<" || data === null;
     627           0 : }
     628           1 : var merge = new type("tag:yaml.org,2002:merge", {
     629           1 :     kind: "scalar",
     630           1 :     resolve: resolveYamlMerge
     631           1 : });
     632           3 : function commonjsRequire() {
     633           3 :     throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
     634           1 : }
     635           1 : var NodeBuffer;
     636           1 : try {
     637           1 :     var _require = commonjsRequire;
     638           1 :     NodeBuffer = _require("buffer").Buffer;
     639           1 : } catch (__) {
     640           1 : }
     641           1 : var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
     642           0 : function resolveYamlBinary(data) {
     643           0 :     if (data === null) return false;
     644           0 :     var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
     645           0 :     for(idx = 0; idx < max; idx++){
     646           0 :         code = map2.indexOf(data.charAt(idx));
     647           0 :         if (code > 64) continue;
     648           0 :         if (code < 0) return false;
     649           0 :         bitlen += 6;
     650           0 :     }
     651           0 :     return bitlen % 8 === 0;
     652           0 : }
     653           0 : function constructYamlBinary(data) {
     654           0 :     var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
     655           0 :     for(idx = 0; idx < max; idx++){
     656           0 :         if (idx % 4 === 0 && idx) {
     657           0 :             result.push(bits >> 16 & 255);
     658           0 :             result.push(bits >> 8 & 255);
     659           0 :             result.push(bits & 255);
     660           0 :         }
     661           0 :         bits = bits << 6 | map2.indexOf(input.charAt(idx));
     662           0 :     }
     663           0 :     tailbits = max % 4 * 6;
     664           0 :     if (tailbits === 0) {
     665           0 :         result.push(bits >> 16 & 255);
     666           0 :         result.push(bits >> 8 & 255);
     667           0 :         result.push(bits & 255);
     668           0 :     } else if (tailbits === 18) {
     669           0 :         result.push(bits >> 10 & 255);
     670           0 :         result.push(bits >> 2 & 255);
     671           0 :     } else if (tailbits === 12) {
     672           0 :         result.push(bits >> 4 & 255);
     673           0 :     }
     674           0 :     if (NodeBuffer) {
     675           0 :         return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
     676           0 :     }
     677           0 :     return result;
     678           0 : }
     679           0 : function representYamlBinary(object) {
     680           0 :     var result = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
     681           0 :     for(idx = 0; idx < max; idx++){
     682           0 :         if (idx % 3 === 0 && idx) {
     683           0 :             result += map2[bits >> 18 & 63];
     684           0 :             result += map2[bits >> 12 & 63];
     685           0 :             result += map2[bits >> 6 & 63];
     686           0 :             result += map2[bits & 63];
     687           0 :         }
     688           0 :         bits = (bits << 8) + object[idx];
     689           0 :     }
     690           0 :     tail = max % 3;
     691           0 :     if (tail === 0) {
     692           0 :         result += map2[bits >> 18 & 63];
     693           0 :         result += map2[bits >> 12 & 63];
     694           0 :         result += map2[bits >> 6 & 63];
     695           0 :         result += map2[bits & 63];
     696           0 :     } else if (tail === 2) {
     697           0 :         result += map2[bits >> 10 & 63];
     698           0 :         result += map2[bits >> 4 & 63];
     699           0 :         result += map2[bits << 2 & 63];
     700           0 :         result += map2[64];
     701           0 :     } else if (tail === 1) {
     702           0 :         result += map2[bits >> 2 & 63];
     703           0 :         result += map2[bits << 4 & 63];
     704           0 :         result += map2[64];
     705           0 :         result += map2[64];
     706           0 :     }
     707           0 :     return result;
     708           0 : }
     709           0 : function isBinary(object) {
     710           0 :     return NodeBuffer && NodeBuffer.isBuffer(object);
     711           0 : }
     712           1 : var binary = new type("tag:yaml.org,2002:binary", {
     713           1 :     kind: "scalar",
     714           1 :     resolve: resolveYamlBinary,
     715           1 :     construct: constructYamlBinary,
     716           1 :     predicate: isBinary,
     717           1 :     represent: representYamlBinary
     718           1 : });
     719           1 : var _hasOwnProperty = Object.prototype.hasOwnProperty;
     720           1 : var _toString = Object.prototype.toString;
     721           0 : function resolveYamlOmap(data) {
     722           0 :     if (data === null) return true;
     723           0 :     var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
     724           0 :     for(index = 0, length = object.length; index < length; index += 1){
     725           0 :         pair = object[index];
     726           0 :         pairHasKey = false;
     727           0 :         if (_toString.call(pair) !== "[object Object]") return false;
     728           0 :         for(pairKey in pair){
     729           0 :             if (_hasOwnProperty.call(pair, pairKey)) {
     730           0 :                 if (!pairHasKey) pairHasKey = true;
     731           0 :                 else return false;
     732           0 :             }
     733           0 :         }
     734           0 :         if (!pairHasKey) return false;
     735           0 :         if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
     736           0 :         else return false;
     737           0 :     }
     738           0 :     return true;
     739           0 : }
     740           0 : function constructYamlOmap(data) {
     741           0 :     return data !== null ? data : [];
     742           0 : }
     743           1 : var omap = new type("tag:yaml.org,2002:omap", {
     744           1 :     kind: "sequence",
     745           1 :     resolve: resolveYamlOmap,
     746           1 :     construct: constructYamlOmap
     747           1 : });
     748           1 : var _toString$1 = Object.prototype.toString;
     749           0 : function resolveYamlPairs(data) {
     750           0 :     if (data === null) return true;
     751           0 :     var index, length, pair, keys, result, object = data;
     752           0 :     result = new Array(object.length);
     753           0 :     for(index = 0, length = object.length; index < length; index += 1){
     754           0 :         pair = object[index];
     755           0 :         if (_toString$1.call(pair) !== "[object Object]") return false;
     756           0 :         keys = Object.keys(pair);
     757           0 :         if (keys.length !== 1) return false;
     758           0 :         result[index] = [
     759           0 :             keys[0],
     760           0 :             pair[keys[0]]
     761           0 :         ];
     762           0 :     }
     763           0 :     return true;
     764           0 : }
     765           0 : function constructYamlPairs(data) {
     766           0 :     if (data === null) return [];
     767           0 :     var index, length, pair, keys, result, object = data;
     768           0 :     result = new Array(object.length);
     769           0 :     for(index = 0, length = object.length; index < length; index += 1){
     770           0 :         pair = object[index];
     771           0 :         keys = Object.keys(pair);
     772           0 :         result[index] = [
     773           0 :             keys[0],
     774           0 :             pair[keys[0]]
     775           0 :         ];
     776           0 :     }
     777           0 :     return result;
     778           0 : }
     779           1 : var pairs = new type("tag:yaml.org,2002:pairs", {
     780           1 :     kind: "sequence",
     781           1 :     resolve: resolveYamlPairs,
     782           1 :     construct: constructYamlPairs
     783           1 : });
     784           1 : var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
     785           0 : function resolveYamlSet(data) {
     786           0 :     if (data === null) return true;
     787           0 :     var key, object = data;
     788           0 :     for(key in object){
     789           0 :         if (_hasOwnProperty$1.call(object, key)) {
     790           0 :             if (object[key] !== null) return false;
     791           0 :         }
     792           0 :     }
     793           0 :     return true;
     794           0 : }
     795           0 : function constructYamlSet(data) {
     796           0 :     return data !== null ? data : {
     797           0 :     };
     798           0 : }
     799           1 : var set = new type("tag:yaml.org,2002:set", {
     800           1 :     kind: "mapping",
     801           1 :     resolve: resolveYamlSet,
     802           1 :     construct: constructYamlSet
     803           1 : });
     804           1 : var default_safe = new schema({
     805           1 :     include: [
     806           1 :         core
     807           1 :     ],
     808           1 :     implicit: [
     809           1 :         timestamp,
     810           1 :         merge
     811           1 :     ],
     812           1 :     explicit: [
     813           1 :         binary,
     814           1 :         omap,
     815           1 :         pairs,
     816           1 :         set
     817           1 :     ]
     818           1 : });
     819           0 : function resolveJavascriptUndefined() {
     820           0 :     return true;
     821           0 : }
     822           0 : function constructJavascriptUndefined() {
     823           0 :     return void 0;
     824           0 : }
     825           0 : function representJavascriptUndefined() {
     826           0 :     return "";
     827           0 : }
     828           0 : function isUndefined(object) {
     829           0 :     return typeof object === "undefined";
     830           0 : }
     831           1 : var _undefined = new type("tag:yaml.org,2002:js/undefined", {
     832           1 :     kind: "scalar",
     833           1 :     resolve: resolveJavascriptUndefined,
     834           1 :     construct: constructJavascriptUndefined,
     835           1 :     predicate: isUndefined,
     836           1 :     represent: representJavascriptUndefined
     837           1 : });
     838           0 : function resolveJavascriptRegExp(data) {
     839           0 :     if (data === null) return false;
     840           0 :     if (data.length === 0) return false;
     841           0 :     var regexp2 = data, tail = /\/([gim]*)$/.exec(data), modifiers = "";
     842           0 :     if (regexp2[0] === "/") {
     843           0 :         if (tail) modifiers = tail[1];
     844           0 :         if (modifiers.length > 3) return false;
     845           0 :         if (regexp2[regexp2.length - modifiers.length - 1] !== "/") return false;
     846           0 :     }
     847           0 :     return true;
     848           0 : }
     849           0 : function constructJavascriptRegExp(data) {
     850           0 :     var regexp2 = data, tail = /\/([gim]*)$/.exec(data), modifiers = "";
     851           0 :     if (regexp2[0] === "/") {
     852           0 :         if (tail) modifiers = tail[1];
     853           0 :         regexp2 = regexp2.slice(1, regexp2.length - modifiers.length - 1);
     854           0 :     }
     855           0 :     return new RegExp(regexp2, modifiers);
     856           0 : }
     857           0 : function representJavascriptRegExp(object) {
     858           0 :     var result = "/" + object.source + "/";
     859           0 :     if (object.global) result += "g";
     860           0 :     if (object.multiline) result += "m";
     861           0 :     if (object.ignoreCase) result += "i";
     862           0 :     return result;
     863           0 : }
     864           0 : function isRegExp(object) {
     865           0 :     return Object.prototype.toString.call(object) === "[object RegExp]";
     866           0 : }
     867           1 : var regexp = new type("tag:yaml.org,2002:js/regexp", {
     868           1 :     kind: "scalar",
     869           1 :     resolve: resolveJavascriptRegExp,
     870           1 :     construct: constructJavascriptRegExp,
     871           1 :     predicate: isRegExp,
     872           1 :     represent: representJavascriptRegExp
     873           1 : });
     874           1 : var esprima;
     875           1 : try {
     876           1 :     var _require$1 = commonjsRequire;
     877           1 :     esprima = _require$1("esprima");
     878           1 : } catch (_) {
     879           1 :     if (typeof window !== "undefined") esprima = window.esprima;
     880           1 : }
     881           0 : function resolveJavascriptFunction(data) {
     882           0 :     if (data === null) return false;
     883           0 :     try {
     884           0 :         var source = "(" + data + ")", ast = esprima.parse(source, {
     885           0 :             range: true
     886           0 :         });
     887           0 :         if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") {
     888           0 :             return false;
     889           0 :         }
     890           0 :         return true;
     891           0 :     } catch (err) {
     892           0 :         return false;
     893           0 :     }
     894           0 : }
     895           0 : function constructJavascriptFunction(data) {
     896           0 :     var source = "(" + data + ")", ast = esprima.parse(source, {
     897           0 :         range: true
     898           0 :     }), params = [], body;
     899           0 :     if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") {
     900           0 :         throw new Error("Failed to resolve function");
     901           0 :     }
     902           0 :     ast.body[0].expression.params.forEach(function(param) {
     903           0 :         params.push(param.name);
     904           0 :     });
     905           0 :     body = ast.body[0].expression.body.range;
     906           0 :     if (ast.body[0].expression.body.type === "BlockStatement") {
     907           0 :         return new Function(params, source.slice(body[0] + 1, body[1] - 1));
     908           0 :     }
     909           0 :     return new Function(params, "return " + source.slice(body[0], body[1]));
     910           0 : }
     911           0 : function representJavascriptFunction(object) {
     912           0 :     return object.toString();
     913           0 : }
     914           0 : function isFunction(object) {
     915           0 :     return Object.prototype.toString.call(object) === "[object Function]";
     916           0 : }
     917           1 : var _function = new type("tag:yaml.org,2002:js/function", {
     918           1 :     kind: "scalar",
     919           1 :     resolve: resolveJavascriptFunction,
     920           1 :     construct: constructJavascriptFunction,
     921           1 :     predicate: isFunction,
     922           1 :     represent: representJavascriptFunction
     923           1 : });
     924           1 : var default_full = schema.DEFAULT = new schema({
     925           1 :     include: [
     926           1 :         default_safe
     927           1 :     ],
     928           1 :     explicit: [
     929           1 :         _undefined,
     930           1 :         regexp,
     931           1 :         _function
     932           1 :     ]
     933           1 : });
     934           1 : var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
     935           1 : var CONTEXT_FLOW_IN = 1;
     936           1 : var CONTEXT_FLOW_OUT = 2;
     937           1 : var CONTEXT_BLOCK_IN = 3;
     938           1 : var CONTEXT_BLOCK_OUT = 4;
     939           1 : var CHOMPING_CLIP = 1;
     940           1 : var CHOMPING_STRIP = 2;
     941           1 : var CHOMPING_KEEP = 3;
     942           1 : var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
     943           1 : var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
     944           1 : var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
     945           1 : var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
     946           1 : var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
     947           0 : function _class(obj) {
     948           0 :     return Object.prototype.toString.call(obj);
     949           0 : }
     950           0 : function is_EOL(c) {
     951           0 :     return c === 10 || c === 13;
     952           0 : }
     953           0 : function is_WHITE_SPACE(c) {
     954           0 :     return c === 9 || c === 32;
     955           0 : }
     956           0 : function is_WS_OR_EOL(c) {
     957           0 :     return c === 9 || c === 32 || c === 10 || c === 13;
     958           0 : }
     959           0 : function is_FLOW_INDICATOR(c) {
     960           0 :     return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
     961           0 : }
     962           0 : function fromHexCode(c) {
     963           0 :     var lc;
     964           0 :     if (48 <= c && c <= 57) {
     965           0 :         return c - 48;
     966           0 :     }
     967           0 :     lc = c | 32;
     968           0 :     if (97 <= lc && lc <= 102) {
     969           0 :         return lc - 97 + 10;
     970           0 :     }
     971           0 :     return -1;
     972           0 : }
     973           0 : function escapedHexLen(c) {
     974           0 :     if (c === 120) {
     975           0 :         return 2;
     976           0 :     }
     977           0 :     if (c === 117) {
     978           0 :         return 4;
     979           0 :     }
     980           0 :     if (c === 85) {
     981           0 :         return 8;
     982           0 :     }
     983           0 :     return 0;
     984           0 : }
     985           0 : function fromDecimalCode(c) {
     986           0 :     if (48 <= c && c <= 57) {
     987           0 :         return c - 48;
     988           0 :     }
     989           0 :     return -1;
     990           0 : }
     991         513 : function simpleEscapeSequence(c) {
     992         513 :     return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? "     " : c === 9 ? "       " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
     993           1 : }
     994           0 : function charFromCodepoint(c) {
     995           0 :     if (c <= 65535) {
     996           0 :         return String.fromCharCode(c);
     997           0 :     }
     998           0 :     return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
     999           0 : }
    1000           1 : var simpleEscapeCheck = new Array(256);
    1001           1 : var simpleEscapeMap = new Array(256);
    1002           1 : for(var i = 0; i < 256; i++){
    1003         257 :     simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
    1004         257 :     simpleEscapeMap[i] = simpleEscapeSequence(i);
    1005           1 : }
    1006           0 : function State(input, options) {
    1007           0 :     this.input = input;
    1008           0 :     this.filename = options["filename"] || null;
    1009           0 :     this.schema = options["schema"] || default_full;
    1010           0 :     this.onWarning = options["onWarning"] || null;
    1011           0 :     this.legacy = options["legacy"] || false;
    1012           0 :     this.json = options["json"] || false;
    1013           0 :     this.listener = options["listener"] || null;
    1014           0 :     this.implicitTypes = this.schema.compiledImplicit;
    1015           0 :     this.typeMap = this.schema.compiledTypeMap;
    1016           0 :     this.length = input.length;
    1017           0 :     this.position = 0;
    1018           0 :     this.line = 0;
    1019           0 :     this.lineStart = 0;
    1020           0 :     this.lineIndent = 0;
    1021           0 :     this.documents = [];
    1022           0 : }
    1023           0 : function generateError(state, message) {
    1024           0 :     return new exception(message, new mark(state.filename, state.input, state.position, state.line, state.position - state.lineStart));
    1025           0 : }
    1026           0 : function throwError(state, message) {
    1027           0 :     throw generateError(state, message);
    1028           0 : }
    1029           0 : function throwWarning(state, message) {
    1030           0 :     if (state.onWarning) {
    1031           0 :         state.onWarning.call(null, generateError(state, message));
    1032           0 :     }
    1033           0 : }
    1034           1 : var directiveHandlers = {
    1035           0 :     YAML: function handleYamlDirective(state, name, args) {
    1036           0 :         var match, major, minor;
    1037           0 :         if (state.version !== null) {
    1038           0 :             throwError(state, "duplication of %YAML directive");
    1039           0 :         }
    1040           0 :         if (args.length !== 1) {
    1041           0 :             throwError(state, "YAML directive accepts exactly one argument");
    1042           0 :         }
    1043           0 :         match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
    1044           0 :         if (match === null) {
    1045           0 :             throwError(state, "ill-formed argument of the YAML directive");
    1046           0 :         }
    1047           0 :         major = parseInt(match[1], 10);
    1048           0 :         minor = parseInt(match[2], 10);
    1049           0 :         if (major !== 1) {
    1050           0 :             throwError(state, "unacceptable YAML version of the document");
    1051           0 :         }
    1052           0 :         state.version = args[0];
    1053           0 :         state.checkLineBreaks = minor < 2;
    1054           0 :         if (minor !== 1 && minor !== 2) {
    1055           0 :             throwWarning(state, "unsupported YAML version of the document");
    1056           0 :         }
    1057           0 :     },
    1058           0 :     TAG: function handleTagDirective(state, name, args) {
    1059           0 :         var handle, prefix;
    1060           0 :         if (args.length !== 2) {
    1061           0 :             throwError(state, "TAG directive accepts exactly two arguments");
    1062           0 :         }
    1063           0 :         handle = args[0];
    1064           0 :         prefix = args[1];
    1065           0 :         if (!PATTERN_TAG_HANDLE.test(handle)) {
    1066           0 :             throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
    1067           0 :         }
    1068           0 :         if (_hasOwnProperty$2.call(state.tagMap, handle)) {
    1069           0 :             throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
    1070           0 :         }
    1071           0 :         if (!PATTERN_TAG_URI.test(prefix)) {
    1072           0 :             throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
    1073           0 :         }
    1074           0 :         state.tagMap[handle] = prefix;
    1075           0 :     }
    1076           1 : };
    1077           0 : function captureSegment(state, start, end, checkJson) {
    1078           0 :     var _position, _length, _character, _result;
    1079           0 :     if (start < end) {
    1080           0 :         _result = state.input.slice(start, end);
    1081           0 :         if (checkJson) {
    1082           0 :             for(_position = 0, _length = _result.length; _position < _length; _position += 1){
    1083           0 :                 _character = _result.charCodeAt(_position);
    1084           0 :                 if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
    1085           0 :                     throwError(state, "expected valid JSON character");
    1086           0 :                 }
    1087           0 :             }
    1088           0 :         } else if (PATTERN_NON_PRINTABLE.test(_result)) {
    1089           0 :             throwError(state, "the stream contains non-printable characters");
    1090           0 :         }
    1091           0 :         state.result += _result;
    1092           0 :     }
    1093           0 : }
    1094           0 : function mergeMappings(state, destination, source, overridableKeys) {
    1095           0 :     var sourceKeys, key, index, quantity;
    1096           0 :     if (!common.isObject(source)) {
    1097           0 :         throwError(state, "cannot merge mappings; the provided source object is unacceptable");
    1098           0 :     }
    1099           0 :     sourceKeys = Object.keys(source);
    1100           0 :     for(index = 0, quantity = sourceKeys.length; index < quantity; index += 1){
    1101           0 :         key = sourceKeys[index];
    1102           0 :         if (!_hasOwnProperty$2.call(destination, key)) {
    1103           0 :             destination[key] = source[key];
    1104           0 :             overridableKeys[key] = true;
    1105           0 :         }
    1106           0 :     }
    1107           0 : }
    1108           0 : function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
    1109           0 :     var index, quantity;
    1110           0 :     if (Array.isArray(keyNode)) {
    1111           0 :         keyNode = Array.prototype.slice.call(keyNode);
    1112           0 :         for(index = 0, quantity = keyNode.length; index < quantity; index += 1){
    1113           0 :             if (Array.isArray(keyNode[index])) {
    1114           0 :                 throwError(state, "nested arrays are not supported inside keys");
    1115           0 :             }
    1116           0 :             if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
    1117           0 :                 keyNode[index] = "[object Object]";
    1118           0 :             }
    1119           0 :         }
    1120           0 :     }
    1121           0 :     if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
    1122           0 :         keyNode = "[object Object]";
    1123           0 :     }
    1124           0 :     keyNode = String(keyNode);
    1125           0 :     if (_result === null) {
    1126           0 :         _result = {
    1127           0 :         };
    1128           0 :     }
    1129           0 :     if (keyTag === "tag:yaml.org,2002:merge") {
    1130           0 :         if (Array.isArray(valueNode)) {
    1131           0 :             for(index = 0, quantity = valueNode.length; index < quantity; index += 1){
    1132           0 :                 mergeMappings(state, _result, valueNode[index], overridableKeys);
    1133           0 :             }
    1134           0 :         } else {
    1135           0 :             mergeMappings(state, _result, valueNode, overridableKeys);
    1136           0 :         }
    1137           0 :     } else {
    1138           0 :         if (!state.json && !_hasOwnProperty$2.call(overridableKeys, keyNode) && _hasOwnProperty$2.call(_result, keyNode)) {
    1139           0 :             state.line = startLine || state.line;
    1140           0 :             state.position = startPos || state.position;
    1141           0 :             throwError(state, "duplicated mapping key");
    1142           0 :         }
    1143           0 :         _result[keyNode] = valueNode;
    1144           0 :         delete overridableKeys[keyNode];
    1145           0 :     }
    1146           0 :     return _result;
    1147           0 : }
    1148           0 : function readLineBreak(state) {
    1149           0 :     var ch;
    1150           0 :     ch = state.input.charCodeAt(state.position);
    1151           0 :     if (ch === 10) {
    1152           0 :         state.position++;
    1153           0 :     } else if (ch === 13) {
    1154           0 :         state.position++;
    1155           0 :         if (state.input.charCodeAt(state.position) === 10) {
    1156           0 :             state.position++;
    1157           0 :         }
    1158           0 :     } else {
    1159           0 :         throwError(state, "a line break is expected");
    1160           0 :     }
    1161           0 :     state.line += 1;
    1162           0 :     state.lineStart = state.position;
    1163           0 : }
    1164           0 : function skipSeparationSpace(state, allowComments, checkIndent) {
    1165           0 :     var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
    1166           0 :     while(ch !== 0){
    1167           0 :         while(is_WHITE_SPACE(ch)){
    1168           0 :             ch = state.input.charCodeAt(++state.position);
    1169           0 :         }
    1170           0 :         if (allowComments && ch === 35) {
    1171           0 :             do {
    1172           0 :                 ch = state.input.charCodeAt(++state.position);
    1173           0 :             }while (ch !== 10 && ch !== 13 && ch !== 0)
    1174           0 :         }
    1175           0 :         if (is_EOL(ch)) {
    1176           0 :             readLineBreak(state);
    1177           0 :             ch = state.input.charCodeAt(state.position);
    1178           0 :             lineBreaks++;
    1179           0 :             state.lineIndent = 0;
    1180           0 :             while(ch === 32){
    1181           0 :                 state.lineIndent++;
    1182           0 :                 ch = state.input.charCodeAt(++state.position);
    1183           0 :             }
    1184           0 :         } else {
    1185           0 :             break;
    1186           0 :         }
    1187           0 :     }
    1188           0 :     if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
    1189           0 :         throwWarning(state, "deficient indentation");
    1190           0 :     }
    1191           0 :     return lineBreaks;
    1192           0 : }
    1193           0 : function testDocumentSeparator(state) {
    1194           0 :     var _position = state.position, ch;
    1195           0 :     ch = state.input.charCodeAt(_position);
    1196           0 :     if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
    1197           0 :         _position += 3;
    1198           0 :         ch = state.input.charCodeAt(_position);
    1199           0 :         if (ch === 0 || is_WS_OR_EOL(ch)) {
    1200           0 :             return true;
    1201           0 :         }
    1202           0 :     }
    1203           0 :     return false;
    1204           0 : }
    1205           0 : function writeFoldedLines(state, count) {
    1206           0 :     if (count === 1) {
    1207           0 :         state.result += " ";
    1208           0 :     } else if (count > 1) {
    1209           0 :         state.result += common.repeat("\n", count - 1);
    1210           0 :     }
    1211           0 : }
    1212           0 : function readPlainScalar(state, nodeIndent, withinFlowCollection) {
    1213           0 :     var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
    1214           0 :     ch = state.input.charCodeAt(state.position);
    1215           0 :     if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
    1216           0 :         return false;
    1217           0 :     }
    1218           0 :     if (ch === 63 || ch === 45) {
    1219           0 :         following = state.input.charCodeAt(state.position + 1);
    1220           0 :         if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
    1221           0 :             return false;
    1222           0 :         }
    1223           0 :     }
    1224           0 :     state.kind = "scalar";
    1225           0 :     state.result = "";
    1226           0 :     captureStart = captureEnd = state.position;
    1227           0 :     hasPendingContent = false;
    1228           0 :     while(ch !== 0){
    1229           0 :         if (ch === 58) {
    1230           0 :             following = state.input.charCodeAt(state.position + 1);
    1231           0 :             if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
    1232           0 :                 break;
    1233           0 :             }
    1234           0 :         } else if (ch === 35) {
    1235           0 :             preceding = state.input.charCodeAt(state.position - 1);
    1236           0 :             if (is_WS_OR_EOL(preceding)) {
    1237           0 :                 break;
    1238           0 :             }
    1239           0 :         } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
    1240           0 :             break;
    1241           0 :         } else if (is_EOL(ch)) {
    1242           0 :             _line = state.line;
    1243           0 :             _lineStart = state.lineStart;
    1244           0 :             _lineIndent = state.lineIndent;
    1245           0 :             skipSeparationSpace(state, false, -1);
    1246           0 :             if (state.lineIndent >= nodeIndent) {
    1247           0 :                 hasPendingContent = true;
    1248           0 :                 ch = state.input.charCodeAt(state.position);
    1249           0 :                 continue;
    1250           0 :             } else {
    1251           0 :                 state.position = captureEnd;
    1252           0 :                 state.line = _line;
    1253           0 :                 state.lineStart = _lineStart;
    1254           0 :                 state.lineIndent = _lineIndent;
    1255           0 :                 break;
    1256           0 :             }
    1257           0 :         }
    1258           0 :         if (hasPendingContent) {
    1259           0 :             captureSegment(state, captureStart, captureEnd, false);
    1260           0 :             writeFoldedLines(state, state.line - _line);
    1261           0 :             captureStart = captureEnd = state.position;
    1262           0 :             hasPendingContent = false;
    1263           0 :         }
    1264           0 :         if (!is_WHITE_SPACE(ch)) {
    1265           0 :             captureEnd = state.position + 1;
    1266           0 :         }
    1267           0 :         ch = state.input.charCodeAt(++state.position);
    1268           0 :     }
    1269           0 :     captureSegment(state, captureStart, captureEnd, false);
    1270           0 :     if (state.result) {
    1271           0 :         return true;
    1272           0 :     }
    1273           0 :     state.kind = _kind;
    1274           0 :     state.result = _result;
    1275           0 :     return false;
    1276           0 : }
    1277           0 : function readSingleQuotedScalar(state, nodeIndent) {
    1278           0 :     var ch, captureStart, captureEnd;
    1279           0 :     ch = state.input.charCodeAt(state.position);
    1280           0 :     if (ch !== 39) {
    1281           0 :         return false;
    1282           0 :     }
    1283           0 :     state.kind = "scalar";
    1284           0 :     state.result = "";
    1285           0 :     state.position++;
    1286           0 :     captureStart = captureEnd = state.position;
    1287           0 :     while((ch = state.input.charCodeAt(state.position)) !== 0){
    1288           0 :         if (ch === 39) {
    1289           0 :             captureSegment(state, captureStart, state.position, true);
    1290           0 :             ch = state.input.charCodeAt(++state.position);
    1291           0 :             if (ch === 39) {
    1292           0 :                 captureStart = state.position;
    1293           0 :                 state.position++;
    1294           0 :                 captureEnd = state.position;
    1295           0 :             } else {
    1296           0 :                 return true;
    1297           0 :             }
    1298           0 :         } else if (is_EOL(ch)) {
    1299           0 :             captureSegment(state, captureStart, captureEnd, true);
    1300           0 :             writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
    1301           0 :             captureStart = captureEnd = state.position;
    1302           0 :         } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
    1303           0 :             throwError(state, "unexpected end of the document within a single quoted scalar");
    1304           0 :         } else {
    1305           0 :             state.position++;
    1306           0 :             captureEnd = state.position;
    1307           0 :         }
    1308           0 :     }
    1309           0 :     throwError(state, "unexpected end of the stream within a single quoted scalar");
    1310           0 : }
    1311           0 : function readDoubleQuotedScalar(state, nodeIndent) {
    1312           0 :     var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
    1313           0 :     ch = state.input.charCodeAt(state.position);
    1314           0 :     if (ch !== 34) {
    1315           0 :         return false;
    1316           0 :     }
    1317           0 :     state.kind = "scalar";
    1318           0 :     state.result = "";
    1319           0 :     state.position++;
    1320           0 :     captureStart = captureEnd = state.position;
    1321           0 :     while((ch = state.input.charCodeAt(state.position)) !== 0){
    1322           0 :         if (ch === 34) {
    1323           0 :             captureSegment(state, captureStart, state.position, true);
    1324           0 :             state.position++;
    1325           0 :             return true;
    1326           0 :         } else if (ch === 92) {
    1327           0 :             captureSegment(state, captureStart, state.position, true);
    1328           0 :             ch = state.input.charCodeAt(++state.position);
    1329           0 :             if (is_EOL(ch)) {
    1330           0 :                 skipSeparationSpace(state, false, nodeIndent);
    1331           0 :             } else if (ch < 256 && simpleEscapeCheck[ch]) {
    1332           0 :                 state.result += simpleEscapeMap[ch];
    1333           0 :                 state.position++;
    1334           0 :             } else if ((tmp = escapedHexLen(ch)) > 0) {
    1335           0 :                 hexLength = tmp;
    1336           0 :                 hexResult = 0;
    1337           0 :                 for(; hexLength > 0; hexLength--){
    1338           0 :                     ch = state.input.charCodeAt(++state.position);
    1339           0 :                     if ((tmp = fromHexCode(ch)) >= 0) {
    1340           0 :                         hexResult = (hexResult << 4) + tmp;
    1341           0 :                     } else {
    1342           0 :                         throwError(state, "expected hexadecimal character");
    1343           0 :                     }
    1344           0 :                 }
    1345           0 :                 state.result += charFromCodepoint(hexResult);
    1346           0 :                 state.position++;
    1347           0 :             } else {
    1348           0 :                 throwError(state, "unknown escape sequence");
    1349           0 :             }
    1350           0 :             captureStart = captureEnd = state.position;
    1351           0 :         } else if (is_EOL(ch)) {
    1352           0 :             captureSegment(state, captureStart, captureEnd, true);
    1353           0 :             writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
    1354           0 :             captureStart = captureEnd = state.position;
    1355           0 :         } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
    1356           0 :             throwError(state, "unexpected end of the document within a double quoted scalar");
    1357           0 :         } else {
    1358           0 :             state.position++;
    1359           0 :             captureEnd = state.position;
    1360           0 :         }
    1361           0 :     }
    1362           0 :     throwError(state, "unexpected end of the stream within a double quoted scalar");
    1363           0 : }
    1364           0 : function readFlowCollection(state, nodeIndent) {
    1365           0 :     var readNext = true, _line, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = {
    1366           0 :     }, keyNode, keyTag, valueNode, ch;
    1367           0 :     ch = state.input.charCodeAt(state.position);
    1368           0 :     if (ch === 91) {
    1369           0 :         terminator = 93;
    1370           0 :         isMapping = false;
    1371           0 :         _result = [];
    1372           0 :     } else if (ch === 123) {
    1373           0 :         terminator = 125;
    1374           0 :         isMapping = true;
    1375           0 :         _result = {
    1376           0 :         };
    1377           0 :     } else {
    1378           0 :         return false;
    1379           0 :     }
    1380           0 :     if (state.anchor !== null) {
    1381           0 :         state.anchorMap[state.anchor] = _result;
    1382           0 :     }
    1383           0 :     ch = state.input.charCodeAt(++state.position);
    1384           0 :     while(ch !== 0){
    1385           0 :         skipSeparationSpace(state, true, nodeIndent);
    1386           0 :         ch = state.input.charCodeAt(state.position);
    1387           0 :         if (ch === terminator) {
    1388           0 :             state.position++;
    1389           0 :             state.tag = _tag;
    1390           0 :             state.anchor = _anchor;
    1391           0 :             state.kind = isMapping ? "mapping" : "sequence";
    1392           0 :             state.result = _result;
    1393           0 :             return true;
    1394           0 :         } else if (!readNext) {
    1395           0 :             throwError(state, "missed comma between flow collection entries");
    1396           0 :         }
    1397           0 :         keyTag = keyNode = valueNode = null;
    1398           0 :         isPair = isExplicitPair = false;
    1399           0 :         if (ch === 63) {
    1400           0 :             following = state.input.charCodeAt(state.position + 1);
    1401           0 :             if (is_WS_OR_EOL(following)) {
    1402           0 :                 isPair = isExplicitPair = true;
    1403           0 :                 state.position++;
    1404           0 :                 skipSeparationSpace(state, true, nodeIndent);
    1405           0 :             }
    1406           0 :         }
    1407           0 :         _line = state.line;
    1408           0 :         composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
    1409           0 :         keyTag = state.tag;
    1410           0 :         keyNode = state.result;
    1411           0 :         skipSeparationSpace(state, true, nodeIndent);
    1412           0 :         ch = state.input.charCodeAt(state.position);
    1413           0 :         if ((isExplicitPair || state.line === _line) && ch === 58) {
    1414           0 :             isPair = true;
    1415           0 :             ch = state.input.charCodeAt(++state.position);
    1416           0 :             skipSeparationSpace(state, true, nodeIndent);
    1417           0 :             composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
    1418           0 :             valueNode = state.result;
    1419           0 :         }
    1420           0 :         if (isMapping) {
    1421           0 :             storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
    1422           0 :         } else if (isPair) {
    1423           0 :             _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
    1424           0 :         } else {
    1425           0 :             _result.push(keyNode);
    1426           0 :         }
    1427           0 :         skipSeparationSpace(state, true, nodeIndent);
    1428           0 :         ch = state.input.charCodeAt(state.position);
    1429           0 :         if (ch === 44) {
    1430           0 :             readNext = true;
    1431           0 :             ch = state.input.charCodeAt(++state.position);
    1432           0 :         } else {
    1433           0 :             readNext = false;
    1434           0 :         }
    1435           0 :     }
    1436           0 :     throwError(state, "unexpected end of the stream within a flow collection");
    1437           0 : }
    1438           0 : function readBlockScalar(state, nodeIndent) {
    1439           0 :     var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
    1440           0 :     ch = state.input.charCodeAt(state.position);
    1441           0 :     if (ch === 124) {
    1442           0 :         folding = false;
    1443           0 :     } else if (ch === 62) {
    1444           0 :         folding = true;
    1445           0 :     } else {
    1446           0 :         return false;
    1447           0 :     }
    1448           0 :     state.kind = "scalar";
    1449           0 :     state.result = "";
    1450           0 :     while(ch !== 0){
    1451           0 :         ch = state.input.charCodeAt(++state.position);
    1452           0 :         if (ch === 43 || ch === 45) {
    1453           0 :             if (CHOMPING_CLIP === chomping) {
    1454           0 :                 chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
    1455           0 :             } else {
    1456           0 :                 throwError(state, "repeat of a chomping mode identifier");
    1457           0 :             }
    1458           0 :         } else if ((tmp = fromDecimalCode(ch)) >= 0) {
    1459           0 :             if (tmp === 0) {
    1460           0 :                 throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
    1461           0 :             } else if (!detectedIndent) {
    1462           0 :                 textIndent = nodeIndent + tmp - 1;
    1463           0 :                 detectedIndent = true;
    1464           0 :             } else {
    1465           0 :                 throwError(state, "repeat of an indentation width identifier");
    1466           0 :             }
    1467           0 :         } else {
    1468           0 :             break;
    1469           0 :         }
    1470           0 :     }
    1471           0 :     if (is_WHITE_SPACE(ch)) {
    1472           0 :         do {
    1473           0 :             ch = state.input.charCodeAt(++state.position);
    1474           0 :         }while (is_WHITE_SPACE(ch))
    1475           0 :         if (ch === 35) {
    1476           0 :             do {
    1477           0 :                 ch = state.input.charCodeAt(++state.position);
    1478           0 :             }while (!is_EOL(ch) && ch !== 0)
    1479           0 :         }
    1480           0 :     }
    1481           0 :     while(ch !== 0){
    1482           0 :         readLineBreak(state);
    1483           0 :         state.lineIndent = 0;
    1484           0 :         ch = state.input.charCodeAt(state.position);
    1485           0 :         while((!detectedIndent || state.lineIndent < textIndent) && ch === 32){
    1486           0 :             state.lineIndent++;
    1487           0 :             ch = state.input.charCodeAt(++state.position);
    1488           0 :         }
    1489           0 :         if (!detectedIndent && state.lineIndent > textIndent) {
    1490           0 :             textIndent = state.lineIndent;
    1491           0 :         }
    1492           0 :         if (is_EOL(ch)) {
    1493           0 :             emptyLines++;
    1494           0 :             continue;
    1495           0 :         }
    1496           0 :         if (state.lineIndent < textIndent) {
    1497           0 :             if (chomping === CHOMPING_KEEP) {
    1498           0 :                 state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
    1499           0 :             } else if (chomping === CHOMPING_CLIP) {
    1500           0 :                 if (didReadContent) {
    1501           0 :                     state.result += "\n";
    1502           0 :                 }
    1503           0 :             }
    1504           0 :             break;
    1505           0 :         }
    1506           0 :         if (folding) {
    1507           0 :             if (is_WHITE_SPACE(ch)) {
    1508           0 :                 atMoreIndented = true;
    1509           0 :                 state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
    1510           0 :             } else if (atMoreIndented) {
    1511           0 :                 atMoreIndented = false;
    1512           0 :                 state.result += common.repeat("\n", emptyLines + 1);
    1513           0 :             } else if (emptyLines === 0) {
    1514           0 :                 if (didReadContent) {
    1515           0 :                     state.result += " ";
    1516           0 :                 }
    1517           0 :             } else {
    1518           0 :                 state.result += common.repeat("\n", emptyLines);
    1519           0 :             }
    1520           0 :         } else {
    1521           0 :             state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
    1522           0 :         }
    1523           0 :         didReadContent = true;
    1524           0 :         detectedIndent = true;
    1525           0 :         emptyLines = 0;
    1526           0 :         captureStart = state.position;
    1527           0 :         while(!is_EOL(ch) && ch !== 0){
    1528           0 :             ch = state.input.charCodeAt(++state.position);
    1529           0 :         }
    1530           0 :         captureSegment(state, captureStart, state.position, false);
    1531           0 :     }
    1532           0 :     return true;
    1533           0 : }
    1534           0 : function readBlockSequence(state, nodeIndent) {
    1535           0 :     var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
    1536           0 :     if (state.anchor !== null) {
    1537           0 :         state.anchorMap[state.anchor] = _result;
    1538           0 :     }
    1539           0 :     ch = state.input.charCodeAt(state.position);
    1540           0 :     while(ch !== 0){
    1541           0 :         if (ch !== 45) {
    1542           0 :             break;
    1543           0 :         }
    1544           0 :         following = state.input.charCodeAt(state.position + 1);
    1545           0 :         if (!is_WS_OR_EOL(following)) {
    1546           0 :             break;
    1547           0 :         }
    1548           0 :         detected = true;
    1549           0 :         state.position++;
    1550           0 :         if (skipSeparationSpace(state, true, -1)) {
    1551           0 :             if (state.lineIndent <= nodeIndent) {
    1552           0 :                 _result.push(null);
    1553           0 :                 ch = state.input.charCodeAt(state.position);
    1554           0 :                 continue;
    1555           0 :             }
    1556           0 :         }
    1557           0 :         _line = state.line;
    1558           0 :         composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
    1559           0 :         _result.push(state.result);
    1560           0 :         skipSeparationSpace(state, true, -1);
    1561           0 :         ch = state.input.charCodeAt(state.position);
    1562           0 :         if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
    1563           0 :             throwError(state, "bad indentation of a sequence entry");
    1564           0 :         } else if (state.lineIndent < nodeIndent) {
    1565           0 :             break;
    1566           0 :         }
    1567           0 :     }
    1568           0 :     if (detected) {
    1569           0 :         state.tag = _tag;
    1570           0 :         state.anchor = _anchor;
    1571           0 :         state.kind = "sequence";
    1572           0 :         state.result = _result;
    1573           0 :         return true;
    1574           0 :     }
    1575           0 :     return false;
    1576           0 : }
    1577           0 : function readBlockMapping(state, nodeIndent, flowIndent) {
    1578           0 :     var following, allowCompact, _line, _pos, _tag = state.tag, _anchor = state.anchor, _result = {
    1579           0 :     }, overridableKeys = {
    1580           0 :     }, keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
    1581           0 :     if (state.anchor !== null) {
    1582           0 :         state.anchorMap[state.anchor] = _result;
    1583           0 :     }
    1584           0 :     ch = state.input.charCodeAt(state.position);
    1585           0 :     while(ch !== 0){
    1586           0 :         following = state.input.charCodeAt(state.position + 1);
    1587           0 :         _line = state.line;
    1588           0 :         _pos = state.position;
    1589           0 :         if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
    1590           0 :             if (ch === 63) {
    1591           0 :                 if (atExplicitKey) {
    1592           0 :                     storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
    1593           0 :                     keyTag = keyNode = valueNode = null;
    1594           0 :                 }
    1595           0 :                 detected = true;
    1596           0 :                 atExplicitKey = true;
    1597           0 :                 allowCompact = true;
    1598           0 :             } else if (atExplicitKey) {
    1599           0 :                 atExplicitKey = false;
    1600           0 :                 allowCompact = true;
    1601           0 :             } else {
    1602           0 :                 throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
    1603           0 :             }
    1604           0 :             state.position += 1;
    1605           0 :             ch = following;
    1606           0 :         } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
    1607           0 :             if (state.line === _line) {
    1608           0 :                 ch = state.input.charCodeAt(state.position);
    1609           0 :                 while(is_WHITE_SPACE(ch)){
    1610           0 :                     ch = state.input.charCodeAt(++state.position);
    1611           0 :                 }
    1612           0 :                 if (ch === 58) {
    1613           0 :                     ch = state.input.charCodeAt(++state.position);
    1614           0 :                     if (!is_WS_OR_EOL(ch)) {
    1615           0 :                         throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
    1616           0 :                     }
    1617           0 :                     if (atExplicitKey) {
    1618           0 :                         storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
    1619           0 :                         keyTag = keyNode = valueNode = null;
    1620           0 :                     }
    1621           0 :                     detected = true;
    1622           0 :                     atExplicitKey = false;
    1623           0 :                     allowCompact = false;
    1624           0 :                     keyTag = state.tag;
    1625           0 :                     keyNode = state.result;
    1626           0 :                 } else if (detected) {
    1627           0 :                     throwError(state, "can not read an implicit mapping pair; a colon is missed");
    1628           0 :                 } else {
    1629           0 :                     state.tag = _tag;
    1630           0 :                     state.anchor = _anchor;
    1631           0 :                     return true;
    1632           0 :                 }
    1633           0 :             } else if (detected) {
    1634           0 :                 throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
    1635           0 :             } else {
    1636           0 :                 state.tag = _tag;
    1637           0 :                 state.anchor = _anchor;
    1638           0 :                 return true;
    1639           0 :             }
    1640           0 :         } else {
    1641           0 :             break;
    1642           0 :         }
    1643           0 :         if (state.line === _line || state.lineIndent > nodeIndent) {
    1644           0 :             if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
    1645           0 :                 if (atExplicitKey) {
    1646           0 :                     keyNode = state.result;
    1647           0 :                 } else {
    1648           0 :                     valueNode = state.result;
    1649           0 :                 }
    1650           0 :             }
    1651           0 :             if (!atExplicitKey) {
    1652           0 :                 storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
    1653           0 :                 keyTag = keyNode = valueNode = null;
    1654           0 :             }
    1655           0 :             skipSeparationSpace(state, true, -1);
    1656           0 :             ch = state.input.charCodeAt(state.position);
    1657           0 :         }
    1658           0 :         if (state.lineIndent > nodeIndent && ch !== 0) {
    1659           0 :             throwError(state, "bad indentation of a mapping entry");
    1660           0 :         } else if (state.lineIndent < nodeIndent) {
    1661           0 :             break;
    1662           0 :         }
    1663           0 :     }
    1664           0 :     if (atExplicitKey) {
    1665           0 :         storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
    1666           0 :     }
    1667           0 :     if (detected) {
    1668           0 :         state.tag = _tag;
    1669           0 :         state.anchor = _anchor;
    1670           0 :         state.kind = "mapping";
    1671           0 :         state.result = _result;
    1672           0 :     }
    1673           0 :     return detected;
    1674           0 : }
    1675           0 : function readTagProperty(state) {
    1676           0 :     var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
    1677           0 :     ch = state.input.charCodeAt(state.position);
    1678           0 :     if (ch !== 33) return false;
    1679           0 :     if (state.tag !== null) {
    1680           0 :         throwError(state, "duplication of a tag property");
    1681           0 :     }
    1682           0 :     ch = state.input.charCodeAt(++state.position);
    1683           0 :     if (ch === 60) {
    1684           0 :         isVerbatim = true;
    1685           0 :         ch = state.input.charCodeAt(++state.position);
    1686           0 :     } else if (ch === 33) {
    1687           0 :         isNamed = true;
    1688           0 :         tagHandle = "!!";
    1689           0 :         ch = state.input.charCodeAt(++state.position);
    1690           0 :     } else {
    1691           0 :         tagHandle = "!";
    1692           0 :     }
    1693           0 :     _position = state.position;
    1694           0 :     if (isVerbatim) {
    1695           0 :         do {
    1696           0 :             ch = state.input.charCodeAt(++state.position);
    1697           0 :         }while (ch !== 0 && ch !== 62)
    1698           0 :         if (state.position < state.length) {
    1699           0 :             tagName = state.input.slice(_position, state.position);
    1700           0 :             ch = state.input.charCodeAt(++state.position);
    1701           0 :         } else {
    1702           0 :             throwError(state, "unexpected end of the stream within a verbatim tag");
    1703           0 :         }
    1704           0 :     } else {
    1705           0 :         while(ch !== 0 && !is_WS_OR_EOL(ch)){
    1706           0 :             if (ch === 33) {
    1707           0 :                 if (!isNamed) {
    1708           0 :                     tagHandle = state.input.slice(_position - 1, state.position + 1);
    1709           0 :                     if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
    1710           0 :                         throwError(state, "named tag handle cannot contain such characters");
    1711           0 :                     }
    1712           0 :                     isNamed = true;
    1713           0 :                     _position = state.position + 1;
    1714           0 :                 } else {
    1715           0 :                     throwError(state, "tag suffix cannot contain exclamation marks");
    1716           0 :                 }
    1717           0 :             }
    1718           0 :             ch = state.input.charCodeAt(++state.position);
    1719           0 :         }
    1720           0 :         tagName = state.input.slice(_position, state.position);
    1721           0 :         if (PATTERN_FLOW_INDICATORS.test(tagName)) {
    1722           0 :             throwError(state, "tag suffix cannot contain flow indicator characters");
    1723           0 :         }
    1724           0 :     }
    1725           0 :     if (tagName && !PATTERN_TAG_URI.test(tagName)) {
    1726           0 :         throwError(state, "tag name cannot contain such characters: " + tagName);
    1727           0 :     }
    1728           0 :     if (isVerbatim) {
    1729           0 :         state.tag = tagName;
    1730           0 :     } else if (_hasOwnProperty$2.call(state.tagMap, tagHandle)) {
    1731           0 :         state.tag = state.tagMap[tagHandle] + tagName;
    1732           0 :     } else if (tagHandle === "!") {
    1733           0 :         state.tag = "!" + tagName;
    1734           0 :     } else if (tagHandle === "!!") {
    1735           0 :         state.tag = "tag:yaml.org,2002:" + tagName;
    1736           0 :     } else {
    1737           0 :         throwError(state, 'undeclared tag handle "' + tagHandle + '"');
    1738           0 :     }
    1739           0 :     return true;
    1740           0 : }
    1741           0 : function readAnchorProperty(state) {
    1742           0 :     var _position, ch;
    1743           0 :     ch = state.input.charCodeAt(state.position);
    1744           0 :     if (ch !== 38) return false;
    1745           0 :     if (state.anchor !== null) {
    1746           0 :         throwError(state, "duplication of an anchor property");
    1747           0 :     }
    1748           0 :     ch = state.input.charCodeAt(++state.position);
    1749           0 :     _position = state.position;
    1750           0 :     while(ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)){
    1751           0 :         ch = state.input.charCodeAt(++state.position);
    1752           0 :     }
    1753           0 :     if (state.position === _position) {
    1754           0 :         throwError(state, "name of an anchor node must contain at least one character");
    1755           0 :     }
    1756           0 :     state.anchor = state.input.slice(_position, state.position);
    1757           0 :     return true;
    1758           0 : }
    1759           0 : function readAlias(state) {
    1760           0 :     var _position, alias, ch;
    1761           0 :     ch = state.input.charCodeAt(state.position);
    1762           0 :     if (ch !== 42) return false;
    1763           0 :     ch = state.input.charCodeAt(++state.position);
    1764           0 :     _position = state.position;
    1765           0 :     while(ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)){
    1766           0 :         ch = state.input.charCodeAt(++state.position);
    1767           0 :     }
    1768           0 :     if (state.position === _position) {
    1769           0 :         throwError(state, "name of an alias node must contain at least one character");
    1770           0 :     }
    1771           0 :     alias = state.input.slice(_position, state.position);
    1772           0 :     if (!_hasOwnProperty$2.call(state.anchorMap, alias)) {
    1773           0 :         throwError(state, 'unidentified alias "' + alias + '"');
    1774           0 :     }
    1775           0 :     state.result = state.anchorMap[alias];
    1776           0 :     skipSeparationSpace(state, true, -1);
    1777           0 :     return true;
    1778           0 : }
    1779           0 : function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
    1780           0 :     var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, type2, flowIndent, blockIndent;
    1781           0 :     if (state.listener !== null) {
    1782           0 :         state.listener("open", state);
    1783           0 :     }
    1784           0 :     state.tag = null;
    1785           0 :     state.anchor = null;
    1786           0 :     state.kind = null;
    1787           0 :     state.result = null;
    1788           0 :     allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
    1789           0 :     if (allowToSeek) {
    1790           0 :         if (skipSeparationSpace(state, true, -1)) {
    1791           0 :             atNewLine = true;
    1792           0 :             if (state.lineIndent > parentIndent) {
    1793           0 :                 indentStatus = 1;
    1794           0 :             } else if (state.lineIndent === parentIndent) {
    1795           0 :                 indentStatus = 0;
    1796           0 :             } else if (state.lineIndent < parentIndent) {
    1797           0 :                 indentStatus = -1;
    1798           0 :             }
    1799           0 :         }
    1800           0 :     }
    1801           0 :     if (indentStatus === 1) {
    1802           0 :         while(readTagProperty(state) || readAnchorProperty(state)){
    1803           0 :             if (skipSeparationSpace(state, true, -1)) {
    1804           0 :                 atNewLine = true;
    1805           0 :                 allowBlockCollections = allowBlockStyles;
    1806           0 :                 if (state.lineIndent > parentIndent) {
    1807           0 :                     indentStatus = 1;
    1808           0 :                 } else if (state.lineIndent === parentIndent) {
    1809           0 :                     indentStatus = 0;
    1810           0 :                 } else if (state.lineIndent < parentIndent) {
    1811           0 :                     indentStatus = -1;
    1812           0 :                 }
    1813           0 :             } else {
    1814           0 :                 allowBlockCollections = false;
    1815           0 :             }
    1816           0 :         }
    1817           0 :     }
    1818           0 :     if (allowBlockCollections) {
    1819           0 :         allowBlockCollections = atNewLine || allowCompact;
    1820           0 :     }
    1821           0 :     if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
    1822           0 :         if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
    1823           0 :             flowIndent = parentIndent;
    1824           0 :         } else {
    1825           0 :             flowIndent = parentIndent + 1;
    1826           0 :         }
    1827           0 :         blockIndent = state.position - state.lineStart;
    1828           0 :         if (indentStatus === 1) {
    1829           0 :             if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
    1830           0 :                 hasContent = true;
    1831           0 :             } else {
    1832           0 :                 if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
    1833           0 :                     hasContent = true;
    1834           0 :                 } else if (readAlias(state)) {
    1835           0 :                     hasContent = true;
    1836           0 :                     if (state.tag !== null || state.anchor !== null) {
    1837           0 :                         throwError(state, "alias node should not have any properties");
    1838           0 :                     }
    1839           0 :                 } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
    1840           0 :                     hasContent = true;
    1841           0 :                     if (state.tag === null) {
    1842           0 :                         state.tag = "?";
    1843           0 :                     }
    1844           0 :                 }
    1845           0 :                 if (state.anchor !== null) {
    1846           0 :                     state.anchorMap[state.anchor] = state.result;
    1847           0 :                 }
    1848           0 :             }
    1849           0 :         } else if (indentStatus === 0) {
    1850           0 :             hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
    1851           0 :         }
    1852           0 :     }
    1853           0 :     if (state.tag !== null && state.tag !== "!") {
    1854           0 :         if (state.tag === "?") {
    1855           0 :             if (state.result !== null && state.kind !== "scalar") {
    1856           0 :                 throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
    1857           0 :             }
    1858           0 :             for(typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1){
    1859           0 :                 type2 = state.implicitTypes[typeIndex];
    1860           0 :                 if (type2.resolve(state.result)) {
    1861           0 :                     state.result = type2.construct(state.result);
    1862           0 :                     state.tag = type2.tag;
    1863           0 :                     if (state.anchor !== null) {
    1864           0 :                         state.anchorMap[state.anchor] = state.result;
    1865           0 :                     }
    1866           0 :                     break;
    1867           0 :                 }
    1868           0 :             }
    1869           0 :         } else if (_hasOwnProperty$2.call(state.typeMap[state.kind || "fallback"], state.tag)) {
    1870           0 :             type2 = state.typeMap[state.kind || "fallback"][state.tag];
    1871           0 :             if (state.result !== null && type2.kind !== state.kind) {
    1872           0 :                 throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
    1873           0 :             }
    1874           0 :             if (!type2.resolve(state.result)) {
    1875           0 :                 throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
    1876           0 :             } else {
    1877           0 :                 state.result = type2.construct(state.result);
    1878           0 :                 if (state.anchor !== null) {
    1879           0 :                     state.anchorMap[state.anchor] = state.result;
    1880           0 :                 }
    1881           0 :             }
    1882           0 :         } else {
    1883           0 :             throwError(state, "unknown tag !<" + state.tag + ">");
    1884           0 :         }
    1885           0 :     }
    1886           0 :     if (state.listener !== null) {
    1887           0 :         state.listener("close", state);
    1888           0 :     }
    1889           0 :     return state.tag !== null || state.anchor !== null || hasContent;
    1890           0 : }
    1891           0 : function readDocument(state) {
    1892           0 :     var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
    1893           0 :     state.version = null;
    1894           0 :     state.checkLineBreaks = state.legacy;
    1895           0 :     state.tagMap = {
    1896           0 :     };
    1897           0 :     state.anchorMap = {
    1898           0 :     };
    1899           0 :     while((ch = state.input.charCodeAt(state.position)) !== 0){
    1900           0 :         skipSeparationSpace(state, true, -1);
    1901           0 :         ch = state.input.charCodeAt(state.position);
    1902           0 :         if (state.lineIndent > 0 || ch !== 37) {
    1903           0 :             break;
    1904           0 :         }
    1905           0 :         hasDirectives = true;
    1906           0 :         ch = state.input.charCodeAt(++state.position);
    1907           0 :         _position = state.position;
    1908           0 :         while(ch !== 0 && !is_WS_OR_EOL(ch)){
    1909           0 :             ch = state.input.charCodeAt(++state.position);
    1910           0 :         }
    1911           0 :         directiveName = state.input.slice(_position, state.position);
    1912           0 :         directiveArgs = [];
    1913           0 :         if (directiveName.length < 1) {
    1914           0 :             throwError(state, "directive name must not be less than one character in length");
    1915           0 :         }
    1916           0 :         while(ch !== 0){
    1917           0 :             while(is_WHITE_SPACE(ch)){
    1918           0 :                 ch = state.input.charCodeAt(++state.position);
    1919           0 :             }
    1920           0 :             if (ch === 35) {
    1921           0 :                 do {
    1922           0 :                     ch = state.input.charCodeAt(++state.position);
    1923           0 :                 }while (ch !== 0 && !is_EOL(ch))
    1924           0 :                 break;
    1925           0 :             }
    1926           0 :             if (is_EOL(ch)) break;
    1927           0 :             _position = state.position;
    1928           0 :             while(ch !== 0 && !is_WS_OR_EOL(ch)){
    1929           0 :                 ch = state.input.charCodeAt(++state.position);
    1930           0 :             }
    1931           0 :             directiveArgs.push(state.input.slice(_position, state.position));
    1932           0 :         }
    1933           0 :         if (ch !== 0) readLineBreak(state);
    1934           0 :         if (_hasOwnProperty$2.call(directiveHandlers, directiveName)) {
    1935           0 :             directiveHandlers[directiveName](state, directiveName, directiveArgs);
    1936           0 :         } else {
    1937           0 :             throwWarning(state, 'unknown document directive "' + directiveName + '"');
    1938           0 :         }
    1939           0 :     }
    1940           0 :     skipSeparationSpace(state, true, -1);
    1941           0 :     if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
    1942           0 :         state.position += 3;
    1943           0 :         skipSeparationSpace(state, true, -1);
    1944           0 :     } else if (hasDirectives) {
    1945           0 :         throwError(state, "directives end mark is expected");
    1946           0 :     }
    1947           0 :     composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
    1948           0 :     skipSeparationSpace(state, true, -1);
    1949           0 :     if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
    1950           0 :         throwWarning(state, "non-ASCII line breaks are interpreted as content");
    1951           0 :     }
    1952           0 :     state.documents.push(state.result);
    1953           0 :     if (state.position === state.lineStart && testDocumentSeparator(state)) {
    1954           0 :         if (state.input.charCodeAt(state.position) === 46) {
    1955           0 :             state.position += 3;
    1956           0 :             skipSeparationSpace(state, true, -1);
    1957           0 :         }
    1958           0 :         return;
    1959           0 :     }
    1960           0 :     if (state.position < state.length - 1) {
    1961           0 :         throwError(state, "end of the stream or a document separator is expected");
    1962           0 :     } else {
    1963           0 :         return;
    1964           0 :     }
    1965           0 : }
    1966           0 : function loadDocuments(input, options) {
    1967           0 :     input = String(input);
    1968           0 :     options = options || {
    1969           0 :     };
    1970           0 :     if (input.length !== 0) {
    1971           0 :         if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
    1972           0 :             input += "\n";
    1973           0 :         }
    1974           0 :         if (input.charCodeAt(0) === 65279) {
    1975           0 :             input = input.slice(1);
    1976           0 :         }
    1977           0 :     }
    1978           0 :     var state = new State(input, options);
    1979           0 :     var nullpos = input.indexOf("\0");
    1980           0 :     if (nullpos !== -1) {
    1981           0 :         state.position = nullpos;
    1982           0 :         throwError(state, "null byte is not allowed in input");
    1983           0 :     }
    1984           0 :     state.input += "\0";
    1985           0 :     while(state.input.charCodeAt(state.position) === 32){
    1986           0 :         state.lineIndent += 1;
    1987           0 :         state.position += 1;
    1988           0 :     }
    1989           0 :     while(state.position < state.length - 1){
    1990           0 :         readDocument(state);
    1991           0 :     }
    1992           0 :     return state.documents;
    1993           0 : }
    1994           0 : function loadAll(input, iterator, options) {
    1995           0 :     if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
    1996           0 :         options = iterator;
    1997           0 :         iterator = null;
    1998           0 :     }
    1999           0 :     var documents = loadDocuments(input, options);
    2000           0 :     if (typeof iterator !== "function") {
    2001           0 :         return documents;
    2002           0 :     }
    2003           0 :     for(var index = 0, length = documents.length; index < length; index += 1){
    2004           0 :         iterator(documents[index]);
    2005           0 :     }
    2006           0 : }
    2007           0 : function load(input, options) {
    2008           0 :     var documents = loadDocuments(input, options);
    2009           0 :     if (documents.length === 0) {
    2010           0 :         return void 0;
    2011           0 :     } else if (documents.length === 1) {
    2012           0 :         return documents[0];
    2013           0 :     }
    2014           0 :     throw new exception("expected a single document in the stream, but found more");
    2015           0 : }
    2016           0 : function safeLoadAll(input, iterator, options) {
    2017           0 :     if (typeof iterator === "object" && iterator !== null && typeof options === "undefined") {
    2018           0 :         options = iterator;
    2019           0 :         iterator = null;
    2020           0 :     }
    2021           0 :     return loadAll(input, iterator, common.extend({
    2022           0 :         schema: default_safe
    2023           0 :     }, options));
    2024           0 : }
    2025           0 : function safeLoad(input, options) {
    2026           0 :     return load(input, common.extend({
    2027           0 :         schema: default_safe
    2028           0 :     }, options));
    2029           0 : }
    2030           1 : var loadAll_1 = loadAll;
    2031           1 : var load_1 = load;
    2032           1 : var safeLoadAll_1 = safeLoadAll;
    2033           1 : var safeLoad_1 = safeLoad;
    2034           1 : var loader = {
    2035           1 :     loadAll: loadAll_1,
    2036           1 :     load: load_1,
    2037           1 :     safeLoadAll: safeLoadAll_1,
    2038           1 :     safeLoad: safeLoad_1
    2039           1 : };
    2040           1 : var _toString$2 = Object.prototype.toString;
    2041           1 : var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
    2042           1 : var CHAR_TAB = 9;
    2043           1 : var CHAR_LINE_FEED = 10;
    2044           1 : var CHAR_CARRIAGE_RETURN = 13;
    2045           1 : var CHAR_SPACE = 32;
    2046           1 : var CHAR_EXCLAMATION = 33;
    2047           1 : var CHAR_DOUBLE_QUOTE = 34;
    2048           1 : var CHAR_SHARP = 35;
    2049           1 : var CHAR_PERCENT = 37;
    2050           1 : var CHAR_AMPERSAND = 38;
    2051           1 : var CHAR_SINGLE_QUOTE = 39;
    2052           1 : var CHAR_ASTERISK = 42;
    2053           1 : var CHAR_COMMA = 44;
    2054           1 : var CHAR_MINUS = 45;
    2055           1 : var CHAR_COLON = 58;
    2056           1 : var CHAR_EQUALS = 61;
    2057           1 : var CHAR_GREATER_THAN = 62;
    2058           1 : var CHAR_QUESTION = 63;
    2059           1 : var CHAR_COMMERCIAL_AT = 64;
    2060           1 : var CHAR_LEFT_SQUARE_BRACKET = 91;
    2061           1 : var CHAR_RIGHT_SQUARE_BRACKET = 93;
    2062           1 : var CHAR_GRAVE_ACCENT = 96;
    2063           1 : var CHAR_LEFT_CURLY_BRACKET = 123;
    2064           1 : var CHAR_VERTICAL_LINE = 124;
    2065           1 : var CHAR_RIGHT_CURLY_BRACKET = 125;
    2066           1 : var ESCAPE_SEQUENCES = {
    2067           1 : };
    2068           1 : ESCAPE_SEQUENCES[0] = "\\0";
    2069           1 : ESCAPE_SEQUENCES[7] = "\\a";
    2070           1 : ESCAPE_SEQUENCES[8] = "\\b";
    2071           1 : ESCAPE_SEQUENCES[9] = "\\t";
    2072           1 : ESCAPE_SEQUENCES[10] = "\\n";
    2073           1 : ESCAPE_SEQUENCES[11] = "\\v";
    2074           1 : ESCAPE_SEQUENCES[12] = "\\f";
    2075           1 : ESCAPE_SEQUENCES[13] = "\\r";
    2076           1 : ESCAPE_SEQUENCES[27] = "\\e";
    2077           1 : ESCAPE_SEQUENCES[34] = '\\"';
    2078           1 : ESCAPE_SEQUENCES[92] = "\\\\";
    2079           1 : ESCAPE_SEQUENCES[133] = "\\N";
    2080           1 : ESCAPE_SEQUENCES[160] = "\\_";
    2081           1 : ESCAPE_SEQUENCES[8232] = "\\L";
    2082           1 : ESCAPE_SEQUENCES[8233] = "\\P";
    2083           1 : var DEPRECATED_BOOLEANS_SYNTAX = [
    2084           1 :     "y",
    2085           1 :     "Y",
    2086           1 :     "yes",
    2087           1 :     "Yes",
    2088           1 :     "YES",
    2089           1 :     "on",
    2090           1 :     "On",
    2091           1 :     "ON",
    2092           1 :     "n",
    2093           1 :     "N",
    2094           1 :     "no",
    2095           1 :     "No",
    2096           1 :     "NO",
    2097           1 :     "off",
    2098           1 :     "Off",
    2099           1 :     "OFF"
    2100           1 : ];
    2101           0 : function compileStyleMap(schema2, map2) {
    2102           0 :     var result, keys, index, length, tag, style, type2;
    2103           0 :     if (map2 === null) return {
    2104           0 :     };
    2105           0 :     result = {
    2106           0 :     };
    2107           0 :     keys = Object.keys(map2);
    2108           0 :     for(index = 0, length = keys.length; index < length; index += 1){
    2109           0 :         tag = keys[index];
    2110           0 :         style = String(map2[tag]);
    2111           0 :         if (tag.slice(0, 2) === "!!") {
    2112           0 :             tag = "tag:yaml.org,2002:" + tag.slice(2);
    2113           0 :         }
    2114           0 :         type2 = schema2.compiledTypeMap["fallback"][tag];
    2115           0 :         if (type2 && _hasOwnProperty$3.call(type2.styleAliases, style)) {
    2116           0 :             style = type2.styleAliases[style];
    2117           0 :         }
    2118           0 :         result[tag] = style;
    2119           0 :     }
    2120           0 :     return result;
    2121           0 : }
    2122           0 : function encodeHex(character) {
    2123           0 :     var string, handle, length;
    2124           0 :     string = character.toString(16).toUpperCase();
    2125           0 :     if (character <= 255) {
    2126           0 :         handle = "x";
    2127           0 :         length = 2;
    2128           0 :     } else if (character <= 65535) {
    2129           0 :         handle = "u";
    2130           0 :         length = 4;
    2131           0 :     } else if (character <= 4294967295) {
    2132           0 :         handle = "U";
    2133           0 :         length = 8;
    2134           0 :     } else {
    2135           0 :         throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
    2136           0 :     }
    2137           0 :     return "\\" + handle + common.repeat("0", length - string.length) + string;
    2138           0 : }
    2139           0 : function State$1(options) {
    2140           0 :     this.schema = options["schema"] || default_full;
    2141           0 :     this.indent = Math.max(1, options["indent"] || 2);
    2142           0 :     this.noArrayIndent = options["noArrayIndent"] || false;
    2143           0 :     this.skipInvalid = options["skipInvalid"] || false;
    2144           0 :     this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
    2145           0 :     this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
    2146           0 :     this.sortKeys = options["sortKeys"] || false;
    2147           0 :     this.lineWidth = options["lineWidth"] || 80;
    2148           0 :     this.noRefs = options["noRefs"] || false;
    2149           0 :     this.noCompatMode = options["noCompatMode"] || false;
    2150           0 :     this.condenseFlow = options["condenseFlow"] || false;
    2151           0 :     this.implicitTypes = this.schema.compiledImplicit;
    2152           0 :     this.explicitTypes = this.schema.compiledExplicit;
    2153           0 :     this.tag = null;
    2154           0 :     this.result = "";
    2155           0 :     this.duplicates = [];
    2156           0 :     this.usedDuplicates = null;
    2157           0 : }
    2158           0 : function indentString(string, spaces) {
    2159           0 :     var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
    2160           0 :     while(position < length){
    2161           0 :         next = string.indexOf("\n", position);
    2162           0 :         if (next === -1) {
    2163           0 :             line = string.slice(position);
    2164           0 :             position = length;
    2165           0 :         } else {
    2166           0 :             line = string.slice(position, next + 1);
    2167           0 :             position = next + 1;
    2168           0 :         }
    2169           0 :         if (line.length && line !== "\n") result += ind;
    2170           0 :         result += line;
    2171           0 :     }
    2172           0 :     return result;
    2173           0 : }
    2174           0 : function generateNextLine(state, level) {
    2175           0 :     return "\n" + common.repeat(" ", state.indent * level);
    2176           0 : }
    2177           0 : function testImplicitResolving(state, str2) {
    2178           0 :     var index, length, type2;
    2179           0 :     for(index = 0, length = state.implicitTypes.length; index < length; index += 1){
    2180           0 :         type2 = state.implicitTypes[index];
    2181           0 :         if (type2.resolve(str2)) {
    2182           0 :             return true;
    2183           0 :         }
    2184           0 :     }
    2185           0 :     return false;
    2186           0 : }
    2187           0 : function isWhitespace(c) {
    2188           0 :     return c === CHAR_SPACE || c === CHAR_TAB;
    2189           0 : }
    2190           0 : function isPrintable(c) {
    2191           0 :     return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== 65279 || 65536 <= c && c <= 1114111;
    2192           0 : }
    2193           0 : function isNsChar(c) {
    2194           0 :     return isPrintable(c) && !isWhitespace(c) && c !== 65279 && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
    2195           0 : }
    2196           0 : function isPlainSafe(c, prev) {
    2197           0 :     return isPrintable(c) && c !== 65279 && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_COLON && (c !== CHAR_SHARP || prev && isNsChar(prev));
    2198           0 : }
    2199           0 : function isPlainSafeFirst(c) {
    2200           0 :     return isPrintable(c) && c !== 65279 && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
    2201           0 : }
    2202           0 : function needIndentIndicator(string) {
    2203           0 :     var leadingSpaceRe = /^\n* /;
    2204           0 :     return leadingSpaceRe.test(string);
    2205           0 : }
    2206           1 : var STYLE_PLAIN = 1, STYLE_SINGLE = 2, STYLE_LITERAL = 3, STYLE_FOLDED = 4, STYLE_DOUBLE = 5;
    2207           0 : function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
    2208           0 :     var i1;
    2209           0 :     var __char, prev_char;
    2210           0 :     var hasLineBreak = false;
    2211           0 :     var hasFoldableLine = false;
    2212           0 :     var shouldTrackWidth = lineWidth !== -1;
    2213           0 :     var previousLineBreak = -1;
    2214           0 :     var plain = isPlainSafeFirst(string.charCodeAt(0)) && !isWhitespace(string.charCodeAt(string.length - 1));
    2215           0 :     if (singleLineOnly) {
    2216           0 :         for(i1 = 0; i1 < string.length; i1++){
    2217           0 :             __char = string.charCodeAt(i1);
    2218           0 :             if (!isPrintable(__char)) {
    2219           0 :                 return STYLE_DOUBLE;
    2220           0 :             }
    2221           0 :             prev_char = i1 > 0 ? string.charCodeAt(i1 - 1) : null;
    2222           0 :             plain = plain && isPlainSafe(__char, prev_char);
    2223           0 :         }
    2224           0 :     } else {
    2225           0 :         for(i1 = 0; i1 < string.length; i1++){
    2226           0 :             __char = string.charCodeAt(i1);
    2227           0 :             if (__char === CHAR_LINE_FEED) {
    2228           0 :                 hasLineBreak = true;
    2229           0 :                 if (shouldTrackWidth) {
    2230           0 :                     hasFoldableLine = hasFoldableLine || i1 - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
    2231           0 :                     previousLineBreak = i1;
    2232           0 :                 }
    2233           0 :             } else if (!isPrintable(__char)) {
    2234           0 :                 return STYLE_DOUBLE;
    2235           0 :             }
    2236           0 :             prev_char = i1 > 0 ? string.charCodeAt(i1 - 1) : null;
    2237           0 :             plain = plain && isPlainSafe(__char, prev_char);
    2238           0 :         }
    2239           0 :         hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i1 - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
    2240           0 :     }
    2241           0 :     if (!hasLineBreak && !hasFoldableLine) {
    2242           0 :         return plain && !testAmbiguousType(string) ? STYLE_PLAIN : STYLE_SINGLE;
    2243           0 :     }
    2244           0 :     if (indentPerLevel > 9 && needIndentIndicator(string)) {
    2245           0 :         return STYLE_DOUBLE;
    2246           0 :     }
    2247           0 :     return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
    2248           0 : }
    2249           0 : function writeScalar(state, string, level, iskey) {
    2250           0 :     state.dump = (function() {
    2251           0 :         if (string.length === 0) {
    2252           0 :             return "''";
    2253           0 :         }
    2254           0 :         if (!state.noCompatMode && DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
    2255           0 :             return "'" + string + "'";
    2256           0 :         }
    2257           0 :         var indent = state.indent * Math.max(1, level);
    2258           0 :         var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
    2259           0 :         var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
    2260           0 :         function testAmbiguity(string2) {
    2261           0 :             return testImplicitResolving(state, string2);
    2262           0 :         }
    2263           0 :         switch(chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)){
    2264           0 :             case STYLE_PLAIN:
    2265           0 :                 return string;
    2266           0 :             case STYLE_SINGLE:
    2267           0 :                 return "'" + string.replace(/'/g, "''") + "'";
    2268           0 :             case STYLE_LITERAL:
    2269           0 :                 return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
    2270           0 :             case STYLE_FOLDED:
    2271           0 :                 return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
    2272           0 :             case STYLE_DOUBLE:
    2273           0 :                 return '"' + escapeString(string) + '"';
    2274           0 :             default:
    2275           0 :                 throw new exception("impossible error: invalid scalar style");
    2276           0 :         }
    2277           0 :     })();
    2278           0 : }
    2279           0 : function blockHeader(string, indentPerLevel) {
    2280           0 :     var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
    2281           0 :     var clip = string[string.length - 1] === "\n";
    2282           0 :     var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
    2283           0 :     var chomp = keep ? "+" : clip ? "" : "-";
    2284           0 :     return indentIndicator + chomp + "\n";
    2285           0 : }
    2286           0 : function dropEndingNewline(string) {
    2287           0 :     return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
    2288           0 : }
    2289           0 : function foldString(string, width) {
    2290           0 :     var lineRe = /(\n+)([^\n]*)/g;
    2291           0 :     var result = function() {
    2292           0 :         var nextLF = string.indexOf("\n");
    2293           0 :         nextLF = nextLF !== -1 ? nextLF : string.length;
    2294           0 :         lineRe.lastIndex = nextLF;
    2295           0 :         return foldLine(string.slice(0, nextLF), width);
    2296           0 :     }();
    2297           0 :     var prevMoreIndented = string[0] === "\n" || string[0] === " ";
    2298           0 :     var moreIndented;
    2299           0 :     var match;
    2300           0 :     while(match = lineRe.exec(string)){
    2301           0 :         var prefix = match[1], line = match[2];
    2302           0 :         moreIndented = line[0] === " ";
    2303           0 :         result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
    2304           0 :         prevMoreIndented = moreIndented;
    2305           0 :     }
    2306           0 :     return result;
    2307           0 : }
    2308           0 : function foldLine(line, width) {
    2309           0 :     if (line === "" || line[0] === " ") return line;
    2310           0 :     var breakRe = / [^ ]/g;
    2311           0 :     var match;
    2312           0 :     var start = 0, end, curr = 0, next = 0;
    2313           0 :     var result = "";
    2314           0 :     while(match = breakRe.exec(line)){
    2315           0 :         next = match.index;
    2316           0 :         if (next - start > width) {
    2317           0 :             end = curr > start ? curr : next;
    2318           0 :             result += "\n" + line.slice(start, end);
    2319           0 :             start = end + 1;
    2320           0 :         }
    2321           0 :         curr = next;
    2322           0 :     }
    2323           0 :     result += "\n";
    2324           0 :     if (line.length - start > width && curr > start) {
    2325           0 :         result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
    2326           0 :     } else {
    2327           0 :         result += line.slice(start);
    2328           0 :     }
    2329           0 :     return result.slice(1);
    2330           0 : }
    2331           0 : function escapeString(string) {
    2332           0 :     var result = "";
    2333           0 :     var __char, nextChar;
    2334           0 :     var escapeSeq;
    2335           0 :     for(var i1 = 0; i1 < string.length; i1++){
    2336           0 :         __char = string.charCodeAt(i1);
    2337           0 :         if (__char >= 55296 && __char <= 56319) {
    2338           0 :             nextChar = string.charCodeAt(i1 + 1);
    2339           0 :             if (nextChar >= 56320 && nextChar <= 57343) {
    2340           0 :                 result += encodeHex((__char - 55296) * 1024 + nextChar - 56320 + 65536);
    2341           0 :                 i1++;
    2342           0 :                 continue;
    2343           0 :             }
    2344           0 :         }
    2345           0 :         escapeSeq = ESCAPE_SEQUENCES[__char];
    2346           0 :         result += !escapeSeq && isPrintable(__char) ? string[i1] : escapeSeq || encodeHex(__char);
    2347           0 :     }
    2348           0 :     return result;
    2349           0 : }
    2350           0 : function writeFlowSequence(state, level, object) {
    2351           0 :     var _result = "", _tag = state.tag, index, length;
    2352           0 :     for(index = 0, length = object.length; index < length; index += 1){
    2353           0 :         if (writeNode(state, level, object[index], false, false)) {
    2354           0 :             if (index !== 0) _result += "," + (!state.condenseFlow ? " " : "");
    2355           0 :             _result += state.dump;
    2356           0 :         }
    2357           0 :     }
    2358           0 :     state.tag = _tag;
    2359           0 :     state.dump = "[" + _result + "]";
    2360           0 : }
    2361           0 : function writeBlockSequence(state, level, object, compact) {
    2362           0 :     var _result = "", _tag = state.tag, index, length;
    2363           0 :     for(index = 0, length = object.length; index < length; index += 1){
    2364           0 :         if (writeNode(state, level + 1, object[index], true, true)) {
    2365           0 :             if (!compact || index !== 0) {
    2366           0 :                 _result += generateNextLine(state, level);
    2367           0 :             }
    2368           0 :             if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
    2369           0 :                 _result += "-";
    2370           0 :             } else {
    2371           0 :                 _result += "- ";
    2372           0 :             }
    2373           0 :             _result += state.dump;
    2374           0 :         }
    2375           0 :     }
    2376           0 :     state.tag = _tag;
    2377           0 :     state.dump = _result || "[]";
    2378           0 : }
    2379           0 : function writeFlowMapping(state, level, object) {
    2380           0 :     var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
    2381           0 :     for(index = 0, length = objectKeyList.length; index < length; index += 1){
    2382           0 :         pairBuffer = "";
    2383           0 :         if (index !== 0) pairBuffer += ", ";
    2384           0 :         if (state.condenseFlow) pairBuffer += '"';
    2385           0 :         objectKey = objectKeyList[index];
    2386           0 :         objectValue = object[objectKey];
    2387           0 :         if (!writeNode(state, level, objectKey, false, false)) {
    2388           0 :             continue;
    2389           0 :         }
    2390           0 :         if (state.dump.length > 1024) pairBuffer += "? ";
    2391           0 :         pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
    2392           0 :         if (!writeNode(state, level, objectValue, false, false)) {
    2393           0 :             continue;
    2394           0 :         }
    2395           0 :         pairBuffer += state.dump;
    2396           0 :         _result += pairBuffer;
    2397           0 :     }
    2398           0 :     state.tag = _tag;
    2399           0 :     state.dump = "{" + _result + "}";
    2400           0 : }
    2401           0 : function writeBlockMapping(state, level, object, compact) {
    2402           0 :     var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
    2403           0 :     if (state.sortKeys === true) {
    2404           0 :         objectKeyList.sort();
    2405           0 :     } else if (typeof state.sortKeys === "function") {
    2406           0 :         objectKeyList.sort(state.sortKeys);
    2407           0 :     } else if (state.sortKeys) {
    2408           0 :         throw new exception("sortKeys must be a boolean or a function");
    2409           0 :     }
    2410           0 :     for(index = 0, length = objectKeyList.length; index < length; index += 1){
    2411           0 :         pairBuffer = "";
    2412           0 :         if (!compact || index !== 0) {
    2413           0 :             pairBuffer += generateNextLine(state, level);
    2414           0 :         }
    2415           0 :         objectKey = objectKeyList[index];
    2416           0 :         objectValue = object[objectKey];
    2417           0 :         if (!writeNode(state, level + 1, objectKey, true, true, true)) {
    2418           0 :             continue;
    2419           0 :         }
    2420           0 :         explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
    2421           0 :         if (explicitPair) {
    2422           0 :             if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
    2423           0 :                 pairBuffer += "?";
    2424           0 :             } else {
    2425           0 :                 pairBuffer += "? ";
    2426           0 :             }
    2427           0 :         }
    2428           0 :         pairBuffer += state.dump;
    2429           0 :         if (explicitPair) {
    2430           0 :             pairBuffer += generateNextLine(state, level);
    2431           0 :         }
    2432           0 :         if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
    2433           0 :             continue;
    2434           0 :         }
    2435           0 :         if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
    2436           0 :             pairBuffer += ":";
    2437           0 :         } else {
    2438           0 :             pairBuffer += ": ";
    2439           0 :         }
    2440           0 :         pairBuffer += state.dump;
    2441           0 :         _result += pairBuffer;
    2442           0 :     }
    2443           0 :     state.tag = _tag;
    2444           0 :     state.dump = _result || "{}";
    2445           0 : }
    2446           0 : function detectType(state, object, explicit) {
    2447           0 :     var _result, typeList, index, length, type2, style;
    2448           0 :     typeList = explicit ? state.explicitTypes : state.implicitTypes;
    2449           0 :     for(index = 0, length = typeList.length; index < length; index += 1){
    2450           0 :         type2 = typeList[index];
    2451           0 :         if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
    2452           0 :             state.tag = explicit ? type2.tag : "?";
    2453           0 :             if (type2.represent) {
    2454           0 :                 style = state.styleMap[type2.tag] || type2.defaultStyle;
    2455           0 :                 if (_toString$2.call(type2.represent) === "[object Function]") {
    2456           0 :                     _result = type2.represent(object, style);
    2457           0 :                 } else if (_hasOwnProperty$3.call(type2.represent, style)) {
    2458           0 :                     _result = type2.represent[style](object, style);
    2459           0 :                 } else {
    2460           0 :                     throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
    2461           0 :                 }
    2462           0 :                 state.dump = _result;
    2463           0 :             }
    2464           0 :             return true;
    2465           0 :         }
    2466           0 :     }
    2467           0 :     return false;
    2468           0 : }
    2469           0 : function writeNode(state, level, object, block, compact, iskey) {
    2470           0 :     state.tag = null;
    2471           0 :     state.dump = object;
    2472           0 :     if (!detectType(state, object, false)) {
    2473           0 :         detectType(state, object, true);
    2474           0 :     }
    2475           0 :     var type2 = _toString$2.call(state.dump);
    2476           0 :     if (block) {
    2477           0 :         block = state.flowLevel < 0 || state.flowLevel > level;
    2478           0 :     }
    2479           0 :     var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
    2480           0 :     if (objectOrArray) {
    2481           0 :         duplicateIndex = state.duplicates.indexOf(object);
    2482           0 :         duplicate = duplicateIndex !== -1;
    2483           0 :     }
    2484           0 :     if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
    2485           0 :         compact = false;
    2486           0 :     }
    2487           0 :     if (duplicate && state.usedDuplicates[duplicateIndex]) {
    2488           0 :         state.dump = "*ref_" + duplicateIndex;
    2489           0 :     } else {
    2490           0 :         if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
    2491           0 :             state.usedDuplicates[duplicateIndex] = true;
    2492           0 :         }
    2493           0 :         if (type2 === "[object Object]") {
    2494           0 :             if (block && Object.keys(state.dump).length !== 0) {
    2495           0 :                 writeBlockMapping(state, level, state.dump, compact);
    2496           0 :                 if (duplicate) {
    2497           0 :                     state.dump = "&ref_" + duplicateIndex + state.dump;
    2498           0 :                 }
    2499           0 :             } else {
    2500           0 :                 writeFlowMapping(state, level, state.dump);
    2501           0 :                 if (duplicate) {
    2502           0 :                     state.dump = "&ref_" + duplicateIndex + " " + state.dump;
    2503           0 :                 }
    2504           0 :             }
    2505           0 :         } else if (type2 === "[object Array]") {
    2506           0 :             var arrayLevel = state.noArrayIndent && level > 0 ? level - 1 : level;
    2507           0 :             if (block && state.dump.length !== 0) {
    2508           0 :                 writeBlockSequence(state, arrayLevel, state.dump, compact);
    2509           0 :                 if (duplicate) {
    2510           0 :                     state.dump = "&ref_" + duplicateIndex + state.dump;
    2511           0 :                 }
    2512           0 :             } else {
    2513           0 :                 writeFlowSequence(state, arrayLevel, state.dump);
    2514           0 :                 if (duplicate) {
    2515           0 :                     state.dump = "&ref_" + duplicateIndex + " " + state.dump;
    2516           0 :                 }
    2517           0 :             }
    2518           0 :         } else if (type2 === "[object String]") {
    2519           0 :             if (state.tag !== "?") {
    2520           0 :                 writeScalar(state, state.dump, level, iskey);
    2521           0 :             }
    2522           0 :         } else {
    2523           0 :             if (state.skipInvalid) return false;
    2524           0 :             throw new exception("unacceptable kind of an object to dump " + type2);
    2525           0 :         }
    2526           0 :         if (state.tag !== null && state.tag !== "?") {
    2527           0 :             state.dump = "!<" + state.tag + "> " + state.dump;
    2528           0 :         }
    2529           0 :     }
    2530           0 :     return true;
    2531           0 : }
    2532           0 : function getDuplicateReferences(object, state) {
    2533           0 :     var objects = [], duplicatesIndexes = [], index, length;
    2534           0 :     inspectNode(object, objects, duplicatesIndexes);
    2535           0 :     for(index = 0, length = duplicatesIndexes.length; index < length; index += 1){
    2536           0 :         state.duplicates.push(objects[duplicatesIndexes[index]]);
    2537           0 :     }
    2538           0 :     state.usedDuplicates = new Array(length);
    2539           0 : }
    2540           0 : function inspectNode(object, objects, duplicatesIndexes) {
    2541           0 :     var objectKeyList, index, length;
    2542           0 :     if (object !== null && typeof object === "object") {
    2543           0 :         index = objects.indexOf(object);
    2544           0 :         if (index !== -1) {
    2545           0 :             if (duplicatesIndexes.indexOf(index) === -1) {
    2546           0 :                 duplicatesIndexes.push(index);
    2547           0 :             }
    2548           0 :         } else {
    2549           0 :             objects.push(object);
    2550           0 :             if (Array.isArray(object)) {
    2551           0 :                 for(index = 0, length = object.length; index < length; index += 1){
    2552           0 :                     inspectNode(object[index], objects, duplicatesIndexes);
    2553           0 :                 }
    2554           0 :             } else {
    2555           0 :                 objectKeyList = Object.keys(object);
    2556           0 :                 for(index = 0, length = objectKeyList.length; index < length; index += 1){
    2557           0 :                     inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
    2558           0 :                 }
    2559           0 :             }
    2560           0 :         }
    2561           0 :     }
    2562           0 : }
    2563           0 : function dump(input, options) {
    2564           0 :     options = options || {
    2565           0 :     };
    2566           0 :     var state = new State$1(options);
    2567           0 :     if (!state.noRefs) getDuplicateReferences(input, state);
    2568           0 :     if (writeNode(state, 0, input, true, true)) return state.dump + "\n";
    2569           0 :     return "";
    2570           0 : }
    2571           0 : function safeDump(input, options) {
    2572           0 :     return dump(input, common.extend({
    2573           0 :         schema: default_safe
    2574           0 :     }, options));
    2575           0 : }
    2576           1 : var dump_1 = dump;
    2577           1 : var safeDump_1 = safeDump;
    2578           1 : var dumper = {
    2579           1 :     dump: dump_1,
    2580           1 :     safeDump: safeDump_1
    2581           1 : };
    2582           5 : function deprecated(name) {
    2583           0 :     return function() {
    2584           0 :         throw new Error("Function " + name + " is deprecated and cannot be used.");
    2585           0 :     };
    2586           1 : }
    2587           1 : var Type$1 = type;
    2588           1 : var Schema$1 = schema;
    2589           1 : var FAILSAFE_SCHEMA = failsafe;
    2590           1 : var JSON_SCHEMA = json;
    2591           1 : var CORE_SCHEMA = core;
    2592           1 : var DEFAULT_SAFE_SCHEMA = default_safe;
    2593           1 : var DEFAULT_FULL_SCHEMA = default_full;
    2594           1 : var load$1 = loader.load;
    2595           1 : var loadAll$1 = loader.loadAll;
    2596           1 : var safeLoad$1 = loader.safeLoad;
    2597           1 : var safeLoadAll$1 = loader.safeLoadAll;
    2598           1 : var dump$1 = dumper.dump;
    2599           1 : var safeDump$1 = dumper.safeDump;
    2600           1 : var YAMLException$1 = exception;
    2601           1 : var MINIMAL_SCHEMA = failsafe;
    2602           1 : var SAFE_SCHEMA = default_safe;
    2603           1 : var DEFAULT_SCHEMA = default_full;
    2604           1 : var scan = deprecated("scan");
    2605           1 : var parse = deprecated("parse");
    2606           1 : var compose = deprecated("compose");
    2607           1 : var addConstructor = deprecated("addConstructor");
    2608           1 : var jsYaml = {
    2609           1 :     Type: Type$1,
    2610           1 :     Schema: Schema$1,
    2611           1 :     FAILSAFE_SCHEMA,
    2612           1 :     JSON_SCHEMA,
    2613           1 :     CORE_SCHEMA,
    2614           1 :     DEFAULT_SAFE_SCHEMA,
    2615           1 :     DEFAULT_FULL_SCHEMA,
    2616           1 :     load: load$1,
    2617           1 :     loadAll: loadAll$1,
    2618           1 :     safeLoad: safeLoad$1,
    2619           1 :     safeLoadAll: safeLoadAll$1,
    2620           1 :     dump: dump$1,
    2621           1 :     safeDump: safeDump$1,
    2622           1 :     YAMLException: YAMLException$1,
    2623           1 :     MINIMAL_SCHEMA,
    2624           1 :     SAFE_SCHEMA,
    2625           1 :     DEFAULT_SCHEMA,
    2626           1 :     scan,
    2627           1 :     parse,
    2628           1 :     compose,
    2629           1 :     addConstructor
    2630           1 : };
    2631           1 : var jsYaml$1 = jsYaml;
    2632           1 : const { safeLoad: safeLoad1  } = jsYaml$1;
    2633           1 : var FrontMatterPlugin = function FrontMatterPlugin2(md) {
    2634           0 :     md.block.ruler.before("code", "front-matter", function(state, startLine, endLine) {
    2635           0 :         function get(line2) {
    2636           0 :             var pos = state.bMarks[line2];
    2637           0 :             var max = state.eMarks[line2];
    2638           0 :             return state.src.substr(pos, max - pos);
    2639           0 :         }
    2640           0 :         if (startLine > 0 || state.blkIndent > 0) {
    2641           0 :             return false;
    2642           0 :         }
    2643           0 :         if (state.tShift[startLine] < 0) {
    2644           0 :             return false;
    2645           0 :         }
    2646           0 :         if (!get(startLine).match(/^---$/)) {
    2647           0 :             return false;
    2648           0 :         }
    2649           0 :         var data = [];
    2650           0 :         var line;
    2651           0 :         for(line = startLine + 1; line < endLine; line++){
    2652           0 :             var str1 = get(line);
    2653           0 :             if (str1.match(/^---$/)) {
    2654           0 :                 break;
    2655           0 :             }
    2656           0 :             if (state.tShift[line] < 0) {
    2657           0 :                 break;
    2658           0 :             }
    2659           0 :             data.push(str1);
    2660           0 :         }
    2661           0 :         if (line >= endLine) {
    2662           0 :             return false;
    2663           0 :         }
    2664           0 :         state.env.frontMatter = safeLoad1(data.join("\n")) || {
    2665           0 :         };
    2666           0 :         state.line = ++line;
    2667           0 :         return true;
    2668           0 :     }, {
    2669           2 :     });
    2670           1 : };
    2671           1 : export { FrontMatterPlugin as default };

Generated by: LCOV version 1.15