UNPKG

@modern-js/utils

Version:

A Progressive React Framework for modern web development.

1,549 lines (1,548 loc) 69.5 kB
/*! LICENSE: index.mjs.LICENSE.txt */ var e = {}; (()=>{ e.d = (t, r)=>{ for(var i in r)if (e.o(r, i) && !e.o(t, i)) Object.defineProperty(t, i, { enumerable: true, get: r[i] }); }; })(); (()=>{ e.o = (e, t)=>Object.prototype.hasOwnProperty.call(e, t); })(); if (void 0 !== e) e.ab = new URL(".", import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1) + "/"; var t = {}; e.d(t, { Ay: ()=>ot, Bh: ()=>et, Hh: ()=>ze, N5: ()=>nt, OU: ()=>Ve, Qd: ()=>it, Sj: ()=>Qe, ZU: ()=>Ke, bk: ()=>at, gK: ()=>rt, gh: ()=>Xe, my: ()=>Je, rQ: ()=>Ge, tB: ()=>tt, uH: ()=>Ze }); /*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */ function isNothing(e) { return null == e; } function isObject(e) { return "object" == typeof e && null !== e; } function toArray(e) { if (Array.isArray(e)) return e; if (isNothing(e)) return []; return [ e ]; } function extend(e, t) { var r, i, n, a; if (t) { a = Object.keys(t); for(r = 0, i = a.length; r < i; r += 1){ n = a[r]; e[n] = t[n]; } } return e; } function repeat(e, t) { var r = "", i; for(i = 0; i < t; i += 1)r += e; return r; } function isNegativeZero(e) { return 0 === e && -1 / 0 === 1 / e; } var r = isNothing; var i = isObject; var n = toArray; var a = repeat; var o = isNegativeZero; var l = extend; var s = { isNothing: r, isObject: i, toArray: n, repeat: a, isNegativeZero: o, extend: l }; function formatError(e, t) { var r = "", i = e.reason || "(unknown reason)"; if (!e.mark) return i; if (e.mark.name) r += 'in "' + e.mark.name + '" '; r += "(" + (e.mark.line + 1) + ":" + (e.mark.column + 1) + ")"; if (!t && e.mark.snippet) r += "\n\n" + e.mark.snippet; return i + " " + r; } function YAMLException$1(e, t) { Error.call(this); this.name = "YAMLException"; this.reason = e; this.mark = t; this.message = formatError(this, false); if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor); else this.stack = (new Error).stack || ""; } YAMLException$1.prototype = Object.create(Error.prototype); YAMLException$1.prototype.constructor = YAMLException$1; YAMLException$1.prototype.toString = function(e) { return this.name + ": " + formatError(this, e); }; var c = YAMLException$1; function getLine(e, t, r, i, n) { var a = ""; var o = ""; var l = Math.floor(n / 2) - 1; if (i - t > l) { a = " ... "; t = i - l + a.length; } if (r - i > l) { o = " ..."; r = i + l - o.length; } return { str: a + e.slice(t, r).replace(/\t/g, "→") + o, pos: i - t + a.length }; } function padStart(e, t) { return s.repeat(" ", t - e.length) + e; } function makeSnippet(e, t) { t = Object.create(t || null); if (!e.buffer) return null; if (!t.maxLength) t.maxLength = 79; if ("number" != typeof t.indent) t.indent = 1; if ("number" != typeof t.linesBefore) t.linesBefore = 3; if ("number" != typeof t.linesAfter) t.linesAfter = 2; var r = /\r?\n|\r|\0/g; var i = [ 0 ]; var n = []; var a; var o = -1; while(a = r.exec(e.buffer)){ n.push(a.index); i.push(a.index + a[0].length); if (e.position <= a.index && o < 0) o = i.length - 2; } if (o < 0) o = i.length - 1; var l = "", c, u; var f = Math.min(e.line + t.linesAfter, n.length).toString().length; var p = t.maxLength - (t.indent + f + 3); for(c = 1; c <= t.linesBefore; c++){ if (o - c < 0) break; u = getLine(e.buffer, i[o - c], n[o - c], e.position - (i[o] - i[o - c]), p); l = s.repeat(" ", t.indent) + padStart((e.line - c + 1).toString(), f) + " | " + u.str + "\n" + l; } u = getLine(e.buffer, i[o], n[o], e.position, p); l += s.repeat(" ", t.indent) + padStart((e.line + 1).toString(), f) + " | " + u.str + "\n"; l += s.repeat("-", t.indent + f + 3 + u.pos) + "^\n"; for(c = 1; c <= t.linesAfter; c++){ if (o + c >= n.length) break; u = getLine(e.buffer, i[o + c], n[o + c], e.position - (i[o] - i[o + c]), p); l += s.repeat(" ", t.indent) + padStart((e.line + c + 1).toString(), f) + " | " + u.str + "\n"; } return l.replace(/\n$/, ""); } var u = makeSnippet; var f = [ "kind", "multi", "resolve", "construct", "instanceOf", "predicate", "represent", "representName", "defaultStyle", "styleAliases" ]; var p = [ "scalar", "sequence", "mapping" ]; function compileStyleAliases(e) { var t = {}; if (null !== e) Object.keys(e).forEach(function(r) { e[r].forEach(function(e) { t[String(e)] = r; }); }); return t; } function Type$1(e, t) { t = t || {}; Object.keys(t).forEach(function(t) { if (-1 === f.indexOf(t)) throw new c('Unknown option "' + t + '" is met in definition of "' + e + '" YAML type.'); }); this.options = t; this.tag = e; this.kind = t["kind"] || null; this.resolve = t["resolve"] || function() { return true; }; this.construct = t["construct"] || function(e) { return e; }; this.instanceOf = t["instanceOf"] || null; this.predicate = t["predicate"] || null; this.represent = t["represent"] || null; this.representName = t["representName"] || null; this.defaultStyle = t["defaultStyle"] || null; this.multi = t["multi"] || false; this.styleAliases = compileStyleAliases(t["styleAliases"] || null); if (-1 === p.indexOf(this.kind)) throw new c('Unknown kind "' + this.kind + '" is specified for "' + e + '" YAML type.'); } var d = Type$1; function compileList(e, t) { var r = []; e[t].forEach(function(e) { var t = r.length; r.forEach(function(r, i) { if (r.tag === e.tag && r.kind === e.kind && r.multi === e.multi) t = i; }); r[t] = e; }); return r; } function compileMap() { var e = { scalar: {}, sequence: {}, mapping: {}, fallback: {}, multi: { scalar: [], sequence: [], mapping: [], fallback: [] } }, t, r; function collectType(t) { if (t.multi) { e.multi[t.kind].push(t); e.multi["fallback"].push(t); } else e[t.kind][t.tag] = e["fallback"][t.tag] = t; } for(t = 0, r = arguments.length; t < r; t += 1)arguments[t].forEach(collectType); return e; } function Schema$1(e) { return this.extend(e); } Schema$1.prototype.extend = function(e) { var t = []; var r = []; if (e instanceof d) r.push(e); else if (Array.isArray(e)) r = r.concat(e); else if (e && (Array.isArray(e.implicit) || Array.isArray(e.explicit))) { if (e.implicit) t = t.concat(e.implicit); if (e.explicit) r = r.concat(e.explicit); } else throw new c("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })"); t.forEach(function(e) { if (!(e instanceof d)) throw new c("Specified list of YAML types (or a single Type object) contains a non-Type object."); if (e.loadKind && "scalar" !== e.loadKind) throw new c("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported."); if (e.multi) throw new c("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit."); }); r.forEach(function(e) { if (!(e instanceof d)) throw new c("Specified list of YAML types (or a single Type object) contains a non-Type object."); }); var i = Object.create(Schema$1.prototype); i.implicit = (this.implicit || []).concat(t); i.explicit = (this.explicit || []).concat(r); i.compiledImplicit = compileList(i, "implicit"); i.compiledExplicit = compileList(i, "explicit"); i.compiledTypeMap = compileMap(i.compiledImplicit, i.compiledExplicit); return i; }; var h = Schema$1; var m = new d("tag:yaml.org,2002:str", { kind: "scalar", construct: function(e) { return null !== e ? e : ""; } }); var g = new d("tag:yaml.org,2002:seq", { kind: "sequence", construct: function(e) { return null !== e ? e : []; } }); var v = new d("tag:yaml.org,2002:map", { kind: "mapping", construct: function(e) { return null !== e ? e : {}; } }); var w = new h({ explicit: [ m, g, v ] }); function resolveYamlNull(e) { if (null === e) return true; var t = e.length; return 1 === t && "~" === e || 4 === t && ("null" === e || "Null" === e || "NULL" === e); } function constructYamlNull() { return null; } function isNull(e) { return null === e; } var y = new d("tag:yaml.org,2002:null", { kind: "scalar", resolve: resolveYamlNull, construct: constructYamlNull, predicate: isNull, represent: { canonical: function() { return "~"; }, lowercase: function() { return "null"; }, uppercase: function() { return "NULL"; }, camelcase: function() { return "Null"; }, empty: function() { return ""; } }, defaultStyle: "lowercase" }); function resolveYamlBoolean(e) { if (null === e) return false; var t = e.length; return 4 === t && ("true" === e || "True" === e || "TRUE" === e) || 5 === t && ("false" === e || "False" === e || "FALSE" === e); } function constructYamlBoolean(e) { return "true" === e || "True" === e || "TRUE" === e; } function isBoolean(e) { return "[object Boolean]" === Object.prototype.toString.call(e); } var S = new d("tag:yaml.org,2002:bool", { kind: "scalar", resolve: resolveYamlBoolean, construct: constructYamlBoolean, predicate: isBoolean, represent: { lowercase: function(e) { return e ? "true" : "false"; }, uppercase: function(e) { return e ? "TRUE" : "FALSE"; }, camelcase: function(e) { return e ? "True" : "False"; } }, defaultStyle: "lowercase" }); function isHexCode(e) { return 48 <= e && e <= 57 || 65 <= e && e <= 70 || 97 <= e && e <= 102; } function isOctCode(e) { return 48 <= e && e <= 55; } function isDecCode(e) { return 48 <= e && e <= 57; } function resolveYamlInteger(e) { if (null === e) return false; var t = e.length, r = 0, i = false, n; if (!t) return false; n = e[r]; if ("-" === n || "+" === n) n = e[++r]; if ("0" === n) { if (r + 1 === t) return true; n = e[++r]; if ("b" === n) { r++; for(; r < t; r++){ n = e[r]; if ("_" !== n) { if ("0" !== n && "1" !== n) return false; i = true; } } return i && "_" !== n; } if ("x" === n) { r++; for(; r < t; r++){ n = e[r]; if ("_" !== n) { if (!isHexCode(e.charCodeAt(r))) return false; i = true; } } return i && "_" !== n; } if ("o" === n) { r++; for(; r < t; r++){ n = e[r]; if ("_" !== n) { if (!isOctCode(e.charCodeAt(r))) return false; i = true; } } return i && "_" !== n; } } if ("_" === n) return false; for(; r < t; r++){ n = e[r]; if ("_" !== n) { if (!isDecCode(e.charCodeAt(r))) return false; i = true; } } if (!i || "_" === n) return false; return true; } function constructYamlInteger(e) { var t = e, r = 1, i; if (-1 !== t.indexOf("_")) t = t.replace(/_/g, ""); i = t[0]; if ("-" === i || "+" === i) { if ("-" === i) r = -1; t = t.slice(1); i = t[0]; } if ("0" === t) return 0; if ("0" === i) { if ("b" === t[1]) return r * parseInt(t.slice(2), 2); if ("x" === t[1]) return r * parseInt(t.slice(2), 16); if ("o" === t[1]) return r * parseInt(t.slice(2), 8); } return r * parseInt(t, 10); } function isInteger(e) { return "[object Number]" === Object.prototype.toString.call(e) && e % 1 === 0 && !s.isNegativeZero(e); } var A = new d("tag:yaml.org,2002:int", { kind: "scalar", resolve: resolveYamlInteger, construct: constructYamlInteger, predicate: isInteger, represent: { binary: function(e) { return e >= 0 ? "0b" + e.toString(2) : "-0b" + e.toString(2).slice(1); }, octal: function(e) { return e >= 0 ? "0o" + e.toString(8) : "-0o" + e.toString(8).slice(1); }, decimal: function(e) { return e.toString(10); }, hexadecimal: function(e) { return e >= 0 ? "0x" + e.toString(16).toUpperCase() : "-0x" + e.toString(16).toUpperCase().slice(1); } }, defaultStyle: "decimal", styleAliases: { binary: [ 2, "bin" ], octal: [ 8, "oct" ], decimal: [ 10, "dec" ], hexadecimal: [ 16, "hex" ] } }); var b = new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"); function resolveYamlFloat(e) { if (null === e) return false; if (!b.test(e) || "_" === e[e.length - 1]) return false; return true; } function constructYamlFloat(e) { var t, r; t = e.replace(/_/g, "").toLowerCase(); r = "-" === t[0] ? -1 : 1; if ("+-".indexOf(t[0]) >= 0) t = t.slice(1); if (".inf" === t) return 1 === r ? 1 / 0 : -1 / 0; if (".nan" === t) return NaN; return r * parseFloat(t, 10); } var E = /^[-+]?[0-9]+e/; function representYamlFloat(e, t) { var r; if (isNaN(e)) switch(t){ case "lowercase": return ".nan"; case "uppercase": return ".NAN"; case "camelcase": return ".NaN"; } else if (1 / 0 === e) switch(t){ case "lowercase": return ".inf"; case "uppercase": return ".INF"; case "camelcase": return ".Inf"; } else if (-1 / 0 === e) switch(t){ case "lowercase": return "-.inf"; case "uppercase": return "-.INF"; case "camelcase": return "-.Inf"; } else if (s.isNegativeZero(e)) return "-0.0"; r = e.toString(10); return E.test(r) ? r.replace("e", ".e") : r; } function isFloat(e) { return "[object Number]" === Object.prototype.toString.call(e) && (e % 1 !== 0 || s.isNegativeZero(e)); } var k = new d("tag:yaml.org,2002:float", { kind: "scalar", resolve: resolveYamlFloat, construct: constructYamlFloat, predicate: isFloat, represent: representYamlFloat, defaultStyle: "lowercase" }); var O = w.extend({ implicit: [ y, S, A, k ] }); var C = O; var _ = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"); var I = 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]))?))?$"); function resolveYamlTimestamp(e) { if (null === e) return false; if (null !== _.exec(e)) return true; if (null !== I.exec(e)) return true; return false; } function constructYamlTimestamp(e) { var t, r, i, n, a, o, l, s = 0, c = null, u, f, p; t = _.exec(e); if (null === t) t = I.exec(e); if (null === t) throw new Error("Date resolve error"); r = +t[1]; i = t[2] - 1; n = +t[3]; if (!t[4]) return new Date(Date.UTC(r, i, n)); a = +t[4]; o = +t[5]; l = +t[6]; if (t[7]) { s = t[7].slice(0, 3); while(s.length < 3)s += "0"; s *= 1; } if (t[9]) { u = +t[10]; f = +(t[11] || 0); c = (60 * u + f) * 6e4; if ("-" === t[9]) c = -c; } p = new Date(Date.UTC(r, i, n, a, o, l, s)); if (c) p.setTime(p.getTime() - c); return p; } function representYamlTimestamp(e) { return e.toISOString(); } var x = new d("tag:yaml.org,2002:timestamp", { kind: "scalar", resolve: resolveYamlTimestamp, construct: constructYamlTimestamp, instanceOf: Date, represent: representYamlTimestamp }); function resolveYamlMerge(e) { return "<<" === e || null === e; } var L = new d("tag:yaml.org,2002:merge", { kind: "scalar", resolve: resolveYamlMerge }); var N = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r"; function resolveYamlBinary(e) { if (null === e) return false; var t, r, i = 0, n = e.length, a = N; for(r = 0; r < n; r++){ t = a.indexOf(e.charAt(r)); if (!(t > 64)) { if (t < 0) return false; i += 6; } } return i % 8 === 0; } function constructYamlBinary(e) { var t, r, i = e.replace(/[\r\n=]/g, ""), n = i.length, a = N, o = 0, l = []; for(t = 0; t < n; t++){ if (t % 4 === 0 && t) { l.push(o >> 16 & 255); l.push(o >> 8 & 255); l.push(255 & o); } o = o << 6 | a.indexOf(i.charAt(t)); } r = n % 4 * 6; if (0 === r) { l.push(o >> 16 & 255); l.push(o >> 8 & 255); l.push(255 & o); } else if (18 === r) { l.push(o >> 10 & 255); l.push(o >> 2 & 255); } else if (12 === r) l.push(o >> 4 & 255); return new Uint8Array(l); } function representYamlBinary(e) { var t = "", r = 0, i, n, a = e.length, o = N; for(i = 0; i < a; i++){ if (i % 3 === 0 && i) { t += o[r >> 18 & 63]; t += o[r >> 12 & 63]; t += o[r >> 6 & 63]; t += o[63 & r]; } r = (r << 8) + e[i]; } n = a % 3; if (0 === n) { t += o[r >> 18 & 63]; t += o[r >> 12 & 63]; t += o[r >> 6 & 63]; t += o[63 & r]; } else if (2 === n) { t += o[r >> 10 & 63]; t += o[r >> 4 & 63]; t += o[r << 2 & 63]; t += o[64]; } else if (1 === n) { t += o[r >> 2 & 63]; t += o[r << 4 & 63]; t += o[64]; t += o[64]; } return t; } function isBinary(e) { return "[object Uint8Array]" === Object.prototype.toString.call(e); } var T = new d("tag:yaml.org,2002:binary", { kind: "scalar", resolve: resolveYamlBinary, construct: constructYamlBinary, predicate: isBinary, represent: representYamlBinary }); var F = Object.prototype.hasOwnProperty; var M = Object.prototype.toString; function resolveYamlOmap(e) { if (null === e) return true; var t = [], r, i, n, a, o, l = e; for(r = 0, i = l.length; r < i; r += 1){ n = l[r]; o = false; if ("[object Object]" !== M.call(n)) return false; for(a in n)if (F.call(n, a)) if (o) return false; else o = true; if (!o) return false; if (-1 !== t.indexOf(a)) return false; t.push(a); } return true; } function constructYamlOmap(e) { return null !== e ? e : []; } var j = new d("tag:yaml.org,2002:omap", { kind: "sequence", resolve: resolveYamlOmap, construct: constructYamlOmap }); var Y = Object.prototype.toString; function resolveYamlPairs(e) { if (null === e) return true; var t, r, i, n, a, o = e; a = new Array(o.length); for(t = 0, r = o.length; t < r; t += 1){ i = o[t]; if ("[object Object]" !== Y.call(i)) return false; n = Object.keys(i); if (1 !== n.length) return false; a[t] = [ n[0], i[n[0]] ]; } return true; } function constructYamlPairs(e) { if (null === e) return []; var t, r, i, n, a, o = e; a = new Array(o.length); for(t = 0, r = o.length; t < r; t += 1){ i = o[t]; n = Object.keys(i); a[t] = [ n[0], i[n[0]] ]; } return a; } var P = new d("tag:yaml.org,2002:pairs", { kind: "sequence", resolve: resolveYamlPairs, construct: constructYamlPairs }); var W = Object.prototype.hasOwnProperty; function resolveYamlSet(e) { if (null === e) return true; var t, r = e; for(t in r)if (W.call(r, t)) { if (null !== r[t]) return false; } return true; } function constructYamlSet(e) { return null !== e ? e : {}; } var D = new d("tag:yaml.org,2002:set", { kind: "mapping", resolve: resolveYamlSet, construct: constructYamlSet }); var B = C.extend({ implicit: [ x, L ], explicit: [ T, j, P, D ] }); var R = Object.prototype.hasOwnProperty; var q = 1; var H = 2; var $ = 3; var U = 4; var K = 1; var Q = 2; var Z = 3; var G = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; var V = /[\x85\u2028\u2029]/; var J = /[,\[\]\{\}]/; var z = /^(?:!|!!|![a-z\-]+!)$/i; var X = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; function _class(e) { return Object.prototype.toString.call(e); } function is_EOL(e) { return 10 === e || 13 === e; } function is_WHITE_SPACE(e) { return 9 === e || 32 === e; } function is_WS_OR_EOL(e) { return 9 === e || 32 === e || 10 === e || 13 === e; } function is_FLOW_INDICATOR(e) { return 44 === e || 91 === e || 93 === e || 123 === e || 125 === e; } function fromHexCode(e) { var t; if (48 <= e && e <= 57) return e - 48; t = 32 | e; if (97 <= t && t <= 102) return t - 97 + 10; return -1; } function escapedHexLen(e) { if (120 === e) return 2; if (117 === e) return 4; if (85 === e) return 8; return 0; } function fromDecimalCode(e) { if (48 <= e && e <= 57) return e - 48; return -1; } function simpleEscapeSequence(e) { return 48 === e ? "\0" : 97 === e ? "" : 98 === e ? "\b" : 116 === e ? "\t" : 9 === e ? "\t" : 110 === e ? "\n" : 118 === e ? "\v" : 102 === e ? "\f" : 114 === e ? "\r" : 101 === e ? "" : 32 === e ? " " : 34 === e ? '"' : 47 === e ? "/" : 92 === e ? "\\" : 78 === e ? "…" : 95 === e ? " " : 76 === e ? "\u2028" : 80 === e ? "\u2029" : ""; } function charFromCodepoint(e) { if (e <= 65535) return String.fromCharCode(e); return String.fromCharCode((e - 65536 >> 10) + 55296, (e - 65536 & 1023) + 56320); } function setProperty(e, t, r) { if ("__proto__" === t) Object.defineProperty(e, t, { configurable: true, enumerable: true, writable: true, value: r }); else e[t] = r; } var ee = new Array(256); var te = new Array(256); for(var re = 0; re < 256; re++){ ee[re] = simpleEscapeSequence(re) ? 1 : 0; te[re] = simpleEscapeSequence(re); } function State$1(e, t) { this.input = e; this.filename = t["filename"] || null; this.schema = t["schema"] || B; this.onWarning = t["onWarning"] || null; this.legacy = t["legacy"] || false; this.json = t["json"] || false; this.listener = t["listener"] || null; this.implicitTypes = this.schema.compiledImplicit; this.typeMap = this.schema.compiledTypeMap; this.length = e.length; this.position = 0; this.line = 0; this.lineStart = 0; this.lineIndent = 0; this.firstTabInLine = -1; this.documents = []; } function generateError(e, t) { var r = { name: e.filename, buffer: e.input.slice(0, -1), position: e.position, line: e.line, column: e.position - e.lineStart }; r.snippet = u(r); return new c(t, r); } function throwError(e, t) { throw generateError(e, t); } function throwWarning(e, t) { if (e.onWarning) e.onWarning.call(null, generateError(e, t)); } var ie = { YAML: function(e, t, r) { var i, n, a; if (null !== e.version) throwError(e, "duplication of %YAML directive"); if (1 !== r.length) throwError(e, "YAML directive accepts exactly one argument"); i = /^([0-9]+)\.([0-9]+)$/.exec(r[0]); if (null === i) throwError(e, "ill-formed argument of the YAML directive"); n = parseInt(i[1], 10); a = parseInt(i[2], 10); if (1 !== n) throwError(e, "unacceptable YAML version of the document"); e.version = r[0]; e.checkLineBreaks = a < 2; if (1 !== a && 2 !== a) throwWarning(e, "unsupported YAML version of the document"); }, TAG: function(e, t, r) { var i, n; if (2 !== r.length) throwError(e, "TAG directive accepts exactly two arguments"); i = r[0]; n = r[1]; if (!z.test(i)) throwError(e, "ill-formed tag handle (first argument) of the TAG directive"); if (R.call(e.tagMap, i)) throwError(e, 'there is a previously declared suffix for "' + i + '" tag handle'); if (!X.test(n)) throwError(e, "ill-formed tag prefix (second argument) of the TAG directive"); try { n = decodeURIComponent(n); } catch (t) { throwError(e, "tag prefix is malformed: " + n); } e.tagMap[i] = n; } }; function captureSegment(e, t, r, i) { var n, a, o, l; if (t < r) { l = e.input.slice(t, r); if (i) for(n = 0, a = l.length; n < a; n += 1){ o = l.charCodeAt(n); if (!(9 === o || 32 <= o && o <= 1114111)) throwError(e, "expected valid JSON character"); } else if (G.test(l)) throwError(e, "the stream contains non-printable characters"); e.result += l; } } function mergeMappings(e, t, r, i) { var n, a, o, l; if (!s.isObject(r)) throwError(e, "cannot merge mappings; the provided source object is unacceptable"); n = Object.keys(r); for(o = 0, l = n.length; o < l; o += 1){ a = n[o]; if (!R.call(t, a)) { setProperty(t, a, r[a]); i[a] = true; } } } function storeMappingPair(e, t, r, i, n, a, o, l, s) { var c, u; if (Array.isArray(n)) { n = Array.prototype.slice.call(n); for(c = 0, u = n.length; c < u; c += 1){ if (Array.isArray(n[c])) throwError(e, "nested arrays are not supported inside keys"); if ("object" == typeof n && "[object Object]" === _class(n[c])) n[c] = "[object Object]"; } } if ("object" == typeof n && "[object Object]" === _class(n)) n = "[object Object]"; n = String(n); if (null === t) t = {}; if ("tag:yaml.org,2002:merge" === i) if (Array.isArray(a)) for(c = 0, u = a.length; c < u; c += 1)mergeMappings(e, t, a[c], r); else mergeMappings(e, t, a, r); else { if (!e.json && !R.call(r, n) && R.call(t, n)) { e.line = o || e.line; e.lineStart = l || e.lineStart; e.position = s || e.position; throwError(e, "duplicated mapping key"); } setProperty(t, n, a); delete r[n]; } return t; } function readLineBreak(e) { var t; t = e.input.charCodeAt(e.position); if (10 === t) e.position++; else if (13 === t) { e.position++; if (10 === e.input.charCodeAt(e.position)) e.position++; } else throwError(e, "a line break is expected"); e.line += 1; e.lineStart = e.position; e.firstTabInLine = -1; } function skipSeparationSpace(e, t, r) { var i = 0, n = e.input.charCodeAt(e.position); while(0 !== n){ while(is_WHITE_SPACE(n)){ if (9 === n && -1 === e.firstTabInLine) e.firstTabInLine = e.position; n = e.input.charCodeAt(++e.position); } if (t && 35 === n) do n = e.input.charCodeAt(++e.position); while (10 !== n && 13 !== n && 0 !== n); if (is_EOL(n)) { readLineBreak(e); n = e.input.charCodeAt(e.position); i++; e.lineIndent = 0; while(32 === n){ e.lineIndent++; n = e.input.charCodeAt(++e.position); } } else break; } if (-1 !== r && 0 !== i && e.lineIndent < r) throwWarning(e, "deficient indentation"); return i; } function testDocumentSeparator(e) { var t = e.position, r; r = e.input.charCodeAt(t); if ((45 === r || 46 === r) && r === e.input.charCodeAt(t + 1) && r === e.input.charCodeAt(t + 2)) { t += 3; r = e.input.charCodeAt(t); if (0 === r || is_WS_OR_EOL(r)) return true; } return false; } function writeFoldedLines(e, t) { if (1 === t) e.result += " "; else if (t > 1) e.result += s.repeat("\n", t - 1); } function readPlainScalar(e, t, r) { var i, n, a, o, l, s, c, u, f = e.kind, p = e.result, d; d = e.input.charCodeAt(e.position); if (is_WS_OR_EOL(d) || is_FLOW_INDICATOR(d) || 35 === d || 38 === d || 42 === d || 33 === d || 124 === d || 62 === d || 39 === d || 34 === d || 37 === d || 64 === d || 96 === d) return false; if (63 === d || 45 === d) { n = e.input.charCodeAt(e.position + 1); if (is_WS_OR_EOL(n) || r && is_FLOW_INDICATOR(n)) return false; } e.kind = "scalar"; e.result = ""; a = o = e.position; l = false; while(0 !== d){ if (58 === d) { n = e.input.charCodeAt(e.position + 1); if (is_WS_OR_EOL(n) || r && is_FLOW_INDICATOR(n)) break; } else if (35 === d) { i = e.input.charCodeAt(e.position - 1); if (is_WS_OR_EOL(i)) break; } else if (e.position === e.lineStart && testDocumentSeparator(e) || r && is_FLOW_INDICATOR(d)) break; else if (is_EOL(d)) { s = e.line; c = e.lineStart; u = e.lineIndent; skipSeparationSpace(e, false, -1); if (e.lineIndent >= t) { l = true; d = e.input.charCodeAt(e.position); continue; } e.position = o; e.line = s; e.lineStart = c; e.lineIndent = u; break; } if (l) { captureSegment(e, a, o, false); writeFoldedLines(e, e.line - s); a = o = e.position; l = false; } if (!is_WHITE_SPACE(d)) o = e.position + 1; d = e.input.charCodeAt(++e.position); } captureSegment(e, a, o, false); if (e.result) return true; e.kind = f; e.result = p; return false; } function readSingleQuotedScalar(e, t) { var r, i, n; r = e.input.charCodeAt(e.position); if (39 !== r) return false; e.kind = "scalar"; e.result = ""; e.position++; i = n = e.position; while(0 !== (r = e.input.charCodeAt(e.position)))if (39 === r) { captureSegment(e, i, e.position, true); r = e.input.charCodeAt(++e.position); if (39 !== r) return true; i = e.position; e.position++; n = e.position; } else if (is_EOL(r)) { captureSegment(e, i, n, true); writeFoldedLines(e, skipSeparationSpace(e, false, t)); i = n = e.position; } else if (e.position === e.lineStart && testDocumentSeparator(e)) throwError(e, "unexpected end of the document within a single quoted scalar"); else { e.position++; n = e.position; } throwError(e, "unexpected end of the stream within a single quoted scalar"); } function readDoubleQuotedScalar(e, t) { var r, i, n, a, o, l; l = e.input.charCodeAt(e.position); if (34 !== l) return false; e.kind = "scalar"; e.result = ""; e.position++; r = i = e.position; while(0 !== (l = e.input.charCodeAt(e.position)))if (34 === l) { captureSegment(e, r, e.position, true); e.position++; return true; } else if (92 === l) { captureSegment(e, r, e.position, true); l = e.input.charCodeAt(++e.position); if (is_EOL(l)) skipSeparationSpace(e, false, t); else if (l < 256 && ee[l]) { e.result += te[l]; e.position++; } else if ((o = escapedHexLen(l)) > 0) { n = o; a = 0; for(; n > 0; n--){ l = e.input.charCodeAt(++e.position); if ((o = fromHexCode(l)) >= 0) a = (a << 4) + o; else throwError(e, "expected hexadecimal character"); } e.result += charFromCodepoint(a); e.position++; } else throwError(e, "unknown escape sequence"); r = i = e.position; } else if (is_EOL(l)) { captureSegment(e, r, i, true); writeFoldedLines(e, skipSeparationSpace(e, false, t)); r = i = e.position; } else if (e.position === e.lineStart && testDocumentSeparator(e)) throwError(e, "unexpected end of the document within a double quoted scalar"); else { e.position++; i = e.position; } throwError(e, "unexpected end of the stream within a double quoted scalar"); } function readFlowCollection(e, t) { var r = true, i, n, a, o = e.tag, l, s = e.anchor, c, u, f, p, d, h = Object.create(null), m, g, v, w; w = e.input.charCodeAt(e.position); if (91 === w) { u = 93; d = false; l = []; } else { if (123 !== w) return false; u = 125; d = true; l = {}; } if (null !== e.anchor) e.anchorMap[e.anchor] = l; w = e.input.charCodeAt(++e.position); while(0 !== w){ skipSeparationSpace(e, true, t); w = e.input.charCodeAt(e.position); if (w === u) { e.position++; e.tag = o; e.anchor = s; e.kind = d ? "mapping" : "sequence"; e.result = l; return true; } if (r) { if (44 === w) throwError(e, "expected the node content, but found ','"); } else throwError(e, "missed comma between flow collection entries"); g = m = v = null; f = p = false; if (63 === w) { c = e.input.charCodeAt(e.position + 1); if (is_WS_OR_EOL(c)) { f = p = true; e.position++; skipSeparationSpace(e, true, t); } } i = e.line; n = e.lineStart; a = e.position; composeNode(e, t, q, false, true); g = e.tag; m = e.result; skipSeparationSpace(e, true, t); w = e.input.charCodeAt(e.position); if ((p || e.line === i) && 58 === w) { f = true; w = e.input.charCodeAt(++e.position); skipSeparationSpace(e, true, t); composeNode(e, t, q, false, true); v = e.result; } if (d) storeMappingPair(e, l, h, g, m, v, i, n, a); else if (f) l.push(storeMappingPair(e, null, h, g, m, v, i, n, a)); else l.push(m); skipSeparationSpace(e, true, t); w = e.input.charCodeAt(e.position); if (44 === w) { r = true; w = e.input.charCodeAt(++e.position); } else r = false; } throwError(e, "unexpected end of the stream within a flow collection"); } function readBlockScalar(e, t) { var r, i, n = K, a = false, o = false, l = t, c = 0, u = false, f, p; p = e.input.charCodeAt(e.position); if (124 === p) i = false; else { if (62 !== p) return false; i = true; } e.kind = "scalar"; e.result = ""; while(0 !== p){ p = e.input.charCodeAt(++e.position); if (43 === p || 45 === p) if (K === n) n = 43 === p ? Z : Q; else throwError(e, "repeat of a chomping mode identifier"); else if ((f = fromDecimalCode(p)) >= 0) if (0 === f) throwError(e, "bad explicit indentation width of a block scalar; it cannot be less than one"); else if (o) throwError(e, "repeat of an indentation width identifier"); else { l = t + f - 1; o = true; } else break; } if (is_WHITE_SPACE(p)) { do p = e.input.charCodeAt(++e.position); while (is_WHITE_SPACE(p)); if (35 === p) do p = e.input.charCodeAt(++e.position); while (!is_EOL(p) && 0 !== p); } while(0 !== p){ readLineBreak(e); e.lineIndent = 0; p = e.input.charCodeAt(e.position); while((!o || e.lineIndent < l) && 32 === p){ e.lineIndent++; p = e.input.charCodeAt(++e.position); } if (!o && e.lineIndent > l) l = e.lineIndent; if (is_EOL(p)) { c++; continue; } if (e.lineIndent < l) { if (n === Z) e.result += s.repeat("\n", a ? 1 + c : c); else if (n === K) { if (a) e.result += "\n"; } break; } if (i) if (is_WHITE_SPACE(p)) { u = true; e.result += s.repeat("\n", a ? 1 + c : c); } else if (u) { u = false; e.result += s.repeat("\n", c + 1); } else if (0 === c) { if (a) e.result += " "; } else e.result += s.repeat("\n", c); else e.result += s.repeat("\n", a ? 1 + c : c); a = true; o = true; c = 0; r = e.position; while(!is_EOL(p) && 0 !== p)p = e.input.charCodeAt(++e.position); captureSegment(e, r, e.position, false); } return true; } function readBlockSequence(e, t) { var r, i = e.tag, n = e.anchor, a = [], o, l = false, s; if (-1 !== e.firstTabInLine) return false; if (null !== e.anchor) e.anchorMap[e.anchor] = a; s = e.input.charCodeAt(e.position); while(0 !== s){ if (-1 !== e.firstTabInLine) { e.position = e.firstTabInLine; throwError(e, "tab characters must not be used in indentation"); } if (45 !== s) break; o = e.input.charCodeAt(e.position + 1); if (!is_WS_OR_EOL(o)) break; l = true; e.position++; if (skipSeparationSpace(e, true, -1)) { if (e.lineIndent <= t) { a.push(null); s = e.input.charCodeAt(e.position); continue; } } r = e.line; composeNode(e, t, $, false, true); a.push(e.result); skipSeparationSpace(e, true, -1); s = e.input.charCodeAt(e.position); if ((e.line === r || e.lineIndent > t) && 0 !== s) throwError(e, "bad indentation of a sequence entry"); else if (e.lineIndent < t) break; } if (l) { e.tag = i; e.anchor = n; e.kind = "sequence"; e.result = a; return true; } return false; } function readBlockMapping(e, t, r) { var i, n, a, o, l, s, c = e.tag, u = e.anchor, f = {}, p = Object.create(null), d = null, h = null, m = null, g = false, v = false, w; if (-1 !== e.firstTabInLine) return false; if (null !== e.anchor) e.anchorMap[e.anchor] = f; w = e.input.charCodeAt(e.position); while(0 !== w){ if (!g && -1 !== e.firstTabInLine) { e.position = e.firstTabInLine; throwError(e, "tab characters must not be used in indentation"); } i = e.input.charCodeAt(e.position + 1); a = e.line; if ((63 === w || 58 === w) && is_WS_OR_EOL(i)) { if (63 === w) { if (g) { storeMappingPair(e, f, p, d, h, null, o, l, s); d = h = m = null; } v = true; g = true; n = true; } else if (g) { g = false; n = true; } else throwError(e, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"); e.position += 1; w = i; } else { o = e.line; l = e.lineStart; s = e.position; if (!composeNode(e, r, H, false, true)) break; if (e.line === a) { w = e.input.charCodeAt(e.position); while(is_WHITE_SPACE(w))w = e.input.charCodeAt(++e.position); if (58 === w) { w = e.input.charCodeAt(++e.position); if (!is_WS_OR_EOL(w)) throwError(e, "a whitespace character is expected after the key-value separator within a block mapping"); if (g) { storeMappingPair(e, f, p, d, h, null, o, l, s); d = h = m = null; } v = true; g = false; n = false; d = e.tag; h = e.result; } else if (v) throwError(e, "can not read an implicit mapping pair; a colon is missed"); else { e.tag = c; e.anchor = u; return true; } } else if (v) throwError(e, "can not read a block mapping entry; a multiline key may not be an implicit key"); else { e.tag = c; e.anchor = u; return true; } } if (e.line === a || e.lineIndent > t) { if (g) { o = e.line; l = e.lineStart; s = e.position; } if (composeNode(e, t, U, true, n)) if (g) h = e.result; else m = e.result; if (!g) { storeMappingPair(e, f, p, d, h, m, o, l, s); d = h = m = null; } skipSeparationSpace(e, true, -1); w = e.input.charCodeAt(e.position); } if ((e.line === a || e.lineIndent > t) && 0 !== w) throwError(e, "bad indentation of a mapping entry"); else if (e.lineIndent < t) break; } if (g) storeMappingPair(e, f, p, d, h, null, o, l, s); if (v) { e.tag = c; e.anchor = u; e.kind = "mapping"; e.result = f; } return v; } function readTagProperty(e) { var t, r = false, i = false, n, a, o; o = e.input.charCodeAt(e.position); if (33 !== o) return false; if (null !== e.tag) throwError(e, "duplication of a tag property"); o = e.input.charCodeAt(++e.position); if (60 === o) { r = true; o = e.input.charCodeAt(++e.position); } else if (33 === o) { i = true; n = "!!"; o = e.input.charCodeAt(++e.position); } else n = "!"; t = e.position; if (r) { do o = e.input.charCodeAt(++e.position); while (0 !== o && 62 !== o); if (e.position < e.length) { a = e.input.slice(t, e.position); o = e.input.charCodeAt(++e.position); } else throwError(e, "unexpected end of the stream within a verbatim tag"); } else { while(0 !== o && !is_WS_OR_EOL(o)){ if (33 === o) if (i) throwError(e, "tag suffix cannot contain exclamation marks"); else { n = e.input.slice(t - 1, e.position + 1); if (!z.test(n)) throwError(e, "named tag handle cannot contain such characters"); i = true; t = e.position + 1; } o = e.input.charCodeAt(++e.position); } a = e.input.slice(t, e.position); if (J.test(a)) throwError(e, "tag suffix cannot contain flow indicator characters"); } if (a && !X.test(a)) throwError(e, "tag name cannot contain such characters: " + a); try { a = decodeURIComponent(a); } catch (t) { throwError(e, "tag name is malformed: " + a); } if (r) e.tag = a; else if (R.call(e.tagMap, n)) e.tag = e.tagMap[n] + a; else if ("!" === n) e.tag = "!" + a; else if ("!!" === n) e.tag = "tag:yaml.org,2002:" + a; else throwError(e, 'undeclared tag handle "' + n + '"'); return true; } function readAnchorProperty(e) { var t, r; r = e.input.charCodeAt(e.position); if (38 !== r) return false; if (null !== e.anchor) throwError(e, "duplication of an anchor property"); r = e.input.charCodeAt(++e.position); t = e.position; while(0 !== r && !is_WS_OR_EOL(r) && !is_FLOW_INDICATOR(r))r = e.input.charCodeAt(++e.position); if (e.position === t) throwError(e, "name of an anchor node must contain at least one character"); e.anchor = e.input.slice(t, e.position); return true; } function readAlias(e) { var t, r, i; i = e.input.charCodeAt(e.position); if (42 !== i) return false; i = e.input.charCodeAt(++e.position); t = e.position; while(0 !== i && !is_WS_OR_EOL(i) && !is_FLOW_INDICATOR(i))i = e.input.charCodeAt(++e.position); if (e.position === t) throwError(e, "name of an alias node must contain at least one character"); r = e.input.slice(t, e.position); if (!R.call(e.anchorMap, r)) throwError(e, 'unidentified alias "' + r + '"'); e.result = e.anchorMap[r]; skipSeparationSpace(e, true, -1); return true; } function composeNode(e, t, r, i, n) { var a, o, l, s = 1, c = false, u = false, f, p, d, h, m, g; if (null !== e.listener) e.listener("open", e); e.tag = null; e.anchor = null; e.kind = null; e.result = null; a = o = l = U === r || $ === r; if (i) { if (skipSeparationSpace(e, true, -1)) { c = true; if (e.lineIndent > t) s = 1; else if (e.lineIndent === t) s = 0; else if (e.lineIndent < t) s = -1; } } if (1 === s) while(readTagProperty(e) || readAnchorProperty(e))if (skipSeparationSpace(e, true, -1)) { c = true; l = a; if (e.lineIndent > t) s = 1; else if (e.lineIndent === t) s = 0; else if (e.lineIndent < t) s = -1; } else l = false; if (l) l = c || n; if (1 === s || U === r) { m = q === r || H === r ? t : t + 1; g = e.position - e.lineStart; if (1 === s) if (l && (readBlockSequence(e, g) || readBlockMapping(e, g, m)) || readFlowCollection(e, m)) u = true; else { if (o && readBlockScalar(e, m) || readSingleQuotedScalar(e, m) || readDoubleQuotedScalar(e, m)) u = true; else if (readAlias(e)) { u = true; if (null !== e.tag || null !== e.anchor) throwError(e, "alias node should not have any properties"); } else if (readPlainScalar(e, m, q === r)) { u = true; if (null === e.tag) e.tag = "?"; } if (null !== e.anchor) e.anchorMap[e.anchor] = e.result; } else if (0 === s) u = l && readBlockSequence(e, g); } if (null === e.tag) { if (null !== e.anchor) e.anchorMap[e.anchor] = e.result; } else if ("?" === e.tag) { if (null !== e.result && "scalar" !== e.kind) throwError(e, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + e.kind + '"'); for(f = 0, p = e.implicitTypes.length; f < p; f += 1){ h = e.implicitTypes[f]; if (h.resolve(e.result)) { e.result = h.construct(e.result); e.tag = h.tag; if (null !== e.anchor) e.anchorMap[e.anchor] = e.result; break; } } } else if ("!" !== e.tag) { if (R.call(e.typeMap[e.kind || "fallback"], e.tag)) h = e.typeMap[e.kind || "fallback"][e.tag]; else { h = null; d = e.typeMap.multi[e.kind || "fallback"]; for(f = 0, p = d.length; f < p; f += 1)if (e.tag.slice(0, d[f].tag.length) === d[f].tag) { h = d[f]; break; } } if (!h) throwError(e, "unknown tag !<" + e.tag + ">"); if (null !== e.result && h.kind !== e.kind) throwError(e, "unacceptable node kind for !<" + e.tag + '> tag; it should be "' + h.kind + '", not "' + e.kind + '"'); if (h.resolve(e.result, e.tag)) { e.result = h.construct(e.result, e.tag); if (null !== e.anchor) e.anchorMap[e.anchor] = e.result; } else throwError(e, "cannot resolve a node with !<" + e.tag + "> explicit tag"); } if (null !== e.listener) e.listener("close", e); return null !== e.tag || null !== e.anchor || u; } function readDocument(e) { var t = e.position, r, i, n, a = false, o; e.version = null; e.checkLineBreaks = e.legacy; e.tagMap = Object.create(null); e.anchorMap = Object.create(null); while(0 !== (o = e.input.charCodeAt(e.position))){ skipSeparationSpace(e, true, -1); o = e.input.charCodeAt(e.position); if (e.lineIndent > 0 || 37 !== o) break; a = true; o = e.input.charCodeAt(++e.position); r = e.position; while(0 !== o && !is_WS_OR_EOL(o))o = e.input.charCodeAt(++e.position); i = e.input.slice(r, e.position); n = []; if (i.length < 1) throwError(e, "directive name must not be less than one character in length"); while(0 !== o){ while(is_WHITE_SPACE(o))o = e.input.charCodeAt(++e.position); if (35 === o) { do o = e.input.charCodeAt(++e.position); while (0 !== o && !is_EOL(o)); break; } if (is_EOL(o)) break;