ndlkotenocr-lite-worker
Version:
NDLKotenOCR Web版のWeb Worker対応版
1,245 lines (1,244 loc) • 57.6 kB
JavaScript
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
function Ee(e) {
return typeof e > "u" || e === null;
}
function vn(e) {
return typeof e == "object" && e !== null;
}
function An(e) {
return Array.isArray(e) ? e : Ee(e) ? [] : [e];
}
function yn(e, n) {
var r, l, i, u;
if (n)
for (u = Object.keys(n), r = 0, l = u.length; r < l; r += 1)
i = u[r], e[i] = n[i];
return e;
}
function wn(e, n) {
var r = "", l;
for (l = 0; l < n; l += 1)
r += e;
return r;
}
function _n(e) {
return e === 0 && Number.NEGATIVE_INFINITY === 1 / e;
}
var Cn = Ee, bn = vn, Sn = An, xn = wn, En = _n, Tn = yn, w = {
isNothing: Cn,
isObject: bn,
toArray: Sn,
repeat: xn,
isNegativeZero: En,
extend: Tn
};
function Te(e, n) {
var r = "", l = e.reason || "(unknown reason)";
return e.mark ? (e.mark.name && (r += 'in "' + e.mark.name + '" '), r += "(" + (e.mark.line + 1) + ":" + (e.mark.column + 1) + ")", !n && e.mark.snippet && (r += `
` + e.mark.snippet), l + " " + r) : l;
}
function D(e, n) {
Error.call(this), this.name = "YAMLException", this.reason = e, this.mark = n, this.message = Te(this, !1), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack || "";
}
D.prototype = Object.create(Error.prototype);
D.prototype.constructor = D;
D.prototype.toString = function(n) {
return this.name + ": " + Te(this, n);
};
var b = D;
function X(e, n, r, l, i) {
var u = "", o = "", c = Math.floor(i / 2) - 1;
return l - n > c && (u = " ... ", n = l - c + u.length), r - l > c && (o = " ...", r = l + c - o.length), {
str: u + e.slice(n, r).replace(/\t/g, "→") + o,
pos: l - n + u.length
// relative position
};
}
function Z(e, n) {
return w.repeat(" ", n - e.length) + e;
}
function On(e, n) {
if (n = Object.create(n || null), !e.buffer) return null;
n.maxLength || (n.maxLength = 79), typeof n.indent != "number" && (n.indent = 1), typeof n.linesBefore != "number" && (n.linesBefore = 3), typeof n.linesAfter != "number" && (n.linesAfter = 2);
for (var r = /\r?\n|\r|\0/g, l = [0], i = [], u, o = -1; u = r.exec(e.buffer); )
i.push(u.index), l.push(u.index + u[0].length), e.position <= u.index && o < 0 && (o = l.length - 2);
o < 0 && (o = l.length - 1);
var c = "", f, t, p = Math.min(e.line + n.linesAfter, i.length).toString().length, a = n.maxLength - (n.indent + p + 3);
for (f = 1; f <= n.linesBefore && !(o - f < 0); f++)
t = X(
e.buffer,
l[o - f],
i[o - f],
e.position - (l[o] - l[o - f]),
a
), c = w.repeat(" ", n.indent) + Z((e.line - f + 1).toString(), p) + " | " + t.str + `
` + c;
for (t = X(e.buffer, l[o], i[o], e.position, a), c += w.repeat(" ", n.indent) + Z((e.line + 1).toString(), p) + " | " + t.str + `
`, c += w.repeat("-", n.indent + p + 3 + t.pos) + `^
`, f = 1; f <= n.linesAfter && !(o + f >= i.length); f++)
t = X(
e.buffer,
l[o + f],
i[o + f],
e.position - (l[o] - l[o + f]),
a
), c += w.repeat(" ", n.indent) + Z((e.line + f + 1).toString(), p) + " | " + t.str + `
`;
return c.replace(/\n$/, "");
}
var kn = On, In = [
"kind",
"multi",
"resolve",
"construct",
"instanceOf",
"predicate",
"represent",
"representName",
"defaultStyle",
"styleAliases"
], Ln = [
"scalar",
"sequence",
"mapping"
];
function Nn(e) {
var n = {};
return e !== null && Object.keys(e).forEach(function(r) {
e[r].forEach(function(l) {
n[String(l)] = r;
});
}), n;
}
function Mn(e, n) {
if (n = n || {}, Object.keys(n).forEach(function(r) {
if (In.indexOf(r) === -1)
throw new b('Unknown option "' + r + '" is met in definition of "' + e + '" YAML type.');
}), this.options = n, this.tag = e, this.kind = n.kind || null, this.resolve = n.resolve || function() {
return !0;
}, this.construct = n.construct || function(r) {
return r;
}, this.instanceOf = n.instanceOf || null, this.predicate = n.predicate || null, this.represent = n.represent || null, this.representName = n.representName || null, this.defaultStyle = n.defaultStyle || null, this.multi = n.multi || !1, this.styleAliases = Nn(n.styleAliases || null), Ln.indexOf(this.kind) === -1)
throw new b('Unknown kind "' + this.kind + '" is specified for "' + e + '" YAML type.');
}
var _ = Mn;
function ae(e, n) {
var r = [];
return e[n].forEach(function(l) {
var i = r.length;
r.forEach(function(u, o) {
u.tag === l.tag && u.kind === l.kind && u.multi === l.multi && (i = o);
}), r[i] = l;
}), r;
}
function Rn() {
var e = {
scalar: {},
sequence: {},
mapping: {},
fallback: {},
multi: {
scalar: [],
sequence: [],
mapping: [],
fallback: []
}
}, n, r;
function l(i) {
i.multi ? (e.multi[i.kind].push(i), e.multi.fallback.push(i)) : e[i.kind][i.tag] = e.fallback[i.tag] = i;
}
for (n = 0, r = arguments.length; n < r; n += 1)
arguments[n].forEach(l);
return e;
}
function J(e) {
return this.extend(e);
}
J.prototype.extend = function(n) {
var r = [], l = [];
if (n instanceof _)
l.push(n);
else if (Array.isArray(n))
l = l.concat(n);
else if (n && (Array.isArray(n.implicit) || Array.isArray(n.explicit)))
n.implicit && (r = r.concat(n.implicit)), n.explicit && (l = l.concat(n.explicit));
else
throw new b("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
r.forEach(function(u) {
if (!(u instanceof _))
throw new b("Specified list of YAML types (or a single Type object) contains a non-Type object.");
if (u.loadKind && u.loadKind !== "scalar")
throw new b("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
if (u.multi)
throw new b("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
}), l.forEach(function(u) {
if (!(u instanceof _))
throw new b("Specified list of YAML types (or a single Type object) contains a non-Type object.");
});
var i = Object.create(J.prototype);
return i.implicit = (this.implicit || []).concat(r), i.explicit = (this.explicit || []).concat(l), i.compiledImplicit = ae(i, "implicit"), i.compiledExplicit = ae(i, "explicit"), i.compiledTypeMap = Rn(i.compiledImplicit, i.compiledExplicit), i;
};
var Oe = J, ke = new _("tag:yaml.org,2002:str", {
kind: "scalar",
construct: function(e) {
return e !== null ? e : "";
}
}), Ie = new _("tag:yaml.org,2002:seq", {
kind: "sequence",
construct: function(e) {
return e !== null ? e : [];
}
}), Le = new _("tag:yaml.org,2002:map", {
kind: "mapping",
construct: function(e) {
return e !== null ? e : {};
}
}), Ne = new Oe({
explicit: [
ke,
Ie,
Le
]
});
function Fn(e) {
if (e === null) return !0;
var n = e.length;
return n === 1 && e === "~" || n === 4 && (e === "null" || e === "Null" || e === "NULL");
}
function Pn() {
return null;
}
function Yn(e) {
return e === null;
}
var Me = new _("tag:yaml.org,2002:null", {
kind: "scalar",
resolve: Fn,
construct: Pn,
predicate: Yn,
represent: {
canonical: function() {
return "~";
},
lowercase: function() {
return "null";
},
uppercase: function() {
return "NULL";
},
camelcase: function() {
return "Null";
},
empty: function() {
return "";
}
},
defaultStyle: "lowercase"
});
function jn(e) {
if (e === null) return !1;
var n = e.length;
return n === 4 && (e === "true" || e === "True" || e === "TRUE") || n === 5 && (e === "false" || e === "False" || e === "FALSE");
}
function Dn(e) {
return e === "true" || e === "True" || e === "TRUE";
}
function Bn(e) {
return Object.prototype.toString.call(e) === "[object Boolean]";
}
var Re = new _("tag:yaml.org,2002:bool", {
kind: "scalar",
resolve: jn,
construct: Dn,
predicate: Bn,
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 Un(e) {
return 48 <= e && e <= 57 || 65 <= e && e <= 70 || 97 <= e && e <= 102;
}
function Hn(e) {
return 48 <= e && e <= 55;
}
function Kn(e) {
return 48 <= e && e <= 57;
}
function qn(e) {
if (e === null) return !1;
var n = e.length, r = 0, l = !1, i;
if (!n) return !1;
if (i = e[r], (i === "-" || i === "+") && (i = e[++r]), i === "0") {
if (r + 1 === n) return !0;
if (i = e[++r], i === "b") {
for (r++; r < n; r++)
if (i = e[r], i !== "_") {
if (i !== "0" && i !== "1") return !1;
l = !0;
}
return l && i !== "_";
}
if (i === "x") {
for (r++; r < n; r++)
if (i = e[r], i !== "_") {
if (!Un(e.charCodeAt(r))) return !1;
l = !0;
}
return l && i !== "_";
}
if (i === "o") {
for (r++; r < n; r++)
if (i = e[r], i !== "_") {
if (!Hn(e.charCodeAt(r))) return !1;
l = !0;
}
return l && i !== "_";
}
}
if (i === "_") return !1;
for (; r < n; r++)
if (i = e[r], i !== "_") {
if (!Kn(e.charCodeAt(r)))
return !1;
l = !0;
}
return !(!l || i === "_");
}
function $n(e) {
var n = e, r = 1, l;
if (n.indexOf("_") !== -1 && (n = n.replace(/_/g, "")), l = n[0], (l === "-" || l === "+") && (l === "-" && (r = -1), n = n.slice(1), l = n[0]), n === "0") return 0;
if (l === "0") {
if (n[1] === "b") return r * parseInt(n.slice(2), 2);
if (n[1] === "x") return r * parseInt(n.slice(2), 16);
if (n[1] === "o") return r * parseInt(n.slice(2), 8);
}
return r * parseInt(n, 10);
}
function Gn(e) {
return Object.prototype.toString.call(e) === "[object Number]" && e % 1 === 0 && !w.isNegativeZero(e);
}
var Fe = new _("tag:yaml.org,2002:int", {
kind: "scalar",
resolve: qn,
construct: $n,
predicate: Gn,
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);
},
/* eslint-disable max-len */
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"]
}
}), Wn = new RegExp(
// 2.5e4, 2.5 and integers
"^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
);
function Qn(e) {
return !(e === null || !Wn.test(e) || // Quick hack to not allow integers end with `_`
// Probably should update regexp & check speed
e[e.length - 1] === "_");
}
function Vn(e) {
var n, r;
return n = e.replace(/_/g, "").toLowerCase(), r = n[0] === "-" ? -1 : 1, "+-".indexOf(n[0]) >= 0 && (n = n.slice(1)), n === ".inf" ? r === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY : n === ".nan" ? NaN : r * parseFloat(n, 10);
}
var Xn = /^[-+]?[0-9]+e/;
function Zn(e, n) {
var r;
if (isNaN(e))
switch (n) {
case "lowercase":
return ".nan";
case "uppercase":
return ".NAN";
case "camelcase":
return ".NaN";
}
else if (Number.POSITIVE_INFINITY === e)
switch (n) {
case "lowercase":
return ".inf";
case "uppercase":
return ".INF";
case "camelcase":
return ".Inf";
}
else if (Number.NEGATIVE_INFINITY === e)
switch (n) {
case "lowercase":
return "-.inf";
case "uppercase":
return "-.INF";
case "camelcase":
return "-.Inf";
}
else if (w.isNegativeZero(e))
return "-0.0";
return r = e.toString(10), Xn.test(r) ? r.replace("e", ".e") : r;
}
function zn(e) {
return Object.prototype.toString.call(e) === "[object Number]" && (e % 1 !== 0 || w.isNegativeZero(e));
}
var Pe = new _("tag:yaml.org,2002:float", {
kind: "scalar",
resolve: Qn,
construct: Vn,
predicate: zn,
represent: Zn,
defaultStyle: "lowercase"
}), Ye = Ne.extend({
implicit: [
Me,
Re,
Fe,
Pe
]
}), je = Ye, De = new RegExp(
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
), Be = 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 Jn(e) {
return e === null ? !1 : De.exec(e) !== null || Be.exec(e) !== null;
}
function er(e) {
var n, r, l, i, u, o, c, f = 0, t = null, p, a, s;
if (n = De.exec(e), n === null && (n = Be.exec(e)), n === null) throw new Error("Date resolve error");
if (r = +n[1], l = +n[2] - 1, i = +n[3], !n[4])
return new Date(Date.UTC(r, l, i));
if (u = +n[4], o = +n[5], c = +n[6], n[7]) {
for (f = n[7].slice(0, 3); f.length < 3; )
f += "0";
f = +f;
}
return n[9] && (p = +n[10], a = +(n[11] || 0), t = (p * 60 + a) * 6e4, n[9] === "-" && (t = -t)), s = new Date(Date.UTC(r, l, i, u, o, c, f)), t && s.setTime(s.getTime() - t), s;
}
function nr(e) {
return e.toISOString();
}
var Ue = new _("tag:yaml.org,2002:timestamp", {
kind: "scalar",
resolve: Jn,
construct: er,
instanceOf: Date,
represent: nr
});
function rr(e) {
return e === "<<" || e === null;
}
var He = new _("tag:yaml.org,2002:merge", {
kind: "scalar",
resolve: rr
}), le = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
\r`;
function ir(e) {
if (e === null) return !1;
var n, r, l = 0, i = e.length, u = le;
for (r = 0; r < i; r++)
if (n = u.indexOf(e.charAt(r)), !(n > 64)) {
if (n < 0) return !1;
l += 6;
}
return l % 8 === 0;
}
function lr(e) {
var n, r, l = e.replace(/[\r\n=]/g, ""), i = l.length, u = le, o = 0, c = [];
for (n = 0; n < i; n++)
n % 4 === 0 && n && (c.push(o >> 16 & 255), c.push(o >> 8 & 255), c.push(o & 255)), o = o << 6 | u.indexOf(l.charAt(n));
return r = i % 4 * 6, r === 0 ? (c.push(o >> 16 & 255), c.push(o >> 8 & 255), c.push(o & 255)) : r === 18 ? (c.push(o >> 10 & 255), c.push(o >> 2 & 255)) : r === 12 && c.push(o >> 4 & 255), new Uint8Array(c);
}
function or(e) {
var n = "", r = 0, l, i, u = e.length, o = le;
for (l = 0; l < u; l++)
l % 3 === 0 && l && (n += o[r >> 18 & 63], n += o[r >> 12 & 63], n += o[r >> 6 & 63], n += o[r & 63]), r = (r << 8) + e[l];
return i = u % 3, i === 0 ? (n += o[r >> 18 & 63], n += o[r >> 12 & 63], n += o[r >> 6 & 63], n += o[r & 63]) : i === 2 ? (n += o[r >> 10 & 63], n += o[r >> 4 & 63], n += o[r << 2 & 63], n += o[64]) : i === 1 && (n += o[r >> 2 & 63], n += o[r << 4 & 63], n += o[64], n += o[64]), n;
}
function ur(e) {
return Object.prototype.toString.call(e) === "[object Uint8Array]";
}
var Ke = new _("tag:yaml.org,2002:binary", {
kind: "scalar",
resolve: ir,
construct: lr,
predicate: ur,
represent: or
}), cr = Object.prototype.hasOwnProperty, fr = Object.prototype.toString;
function tr(e) {
if (e === null) return !0;
var n = [], r, l, i, u, o, c = e;
for (r = 0, l = c.length; r < l; r += 1) {
if (i = c[r], o = !1, fr.call(i) !== "[object Object]") return !1;
for (u in i)
if (cr.call(i, u))
if (!o) o = !0;
else return !1;
if (!o) return !1;
if (n.indexOf(u) === -1) n.push(u);
else return !1;
}
return !0;
}
function ar(e) {
return e !== null ? e : [];
}
var qe = new _("tag:yaml.org,2002:omap", {
kind: "sequence",
resolve: tr,
construct: ar
}), pr = Object.prototype.toString;
function hr(e) {
if (e === null) return !0;
var n, r, l, i, u, o = e;
for (u = new Array(o.length), n = 0, r = o.length; n < r; n += 1) {
if (l = o[n], pr.call(l) !== "[object Object]" || (i = Object.keys(l), i.length !== 1)) return !1;
u[n] = [i[0], l[i[0]]];
}
return !0;
}
function sr(e) {
if (e === null) return [];
var n, r, l, i, u, o = e;
for (u = new Array(o.length), n = 0, r = o.length; n < r; n += 1)
l = o[n], i = Object.keys(l), u[n] = [i[0], l[i[0]]];
return u;
}
var $e = new _("tag:yaml.org,2002:pairs", {
kind: "sequence",
resolve: hr,
construct: sr
}), dr = Object.prototype.hasOwnProperty;
function mr(e) {
if (e === null) return !0;
var n, r = e;
for (n in r)
if (dr.call(r, n) && r[n] !== null)
return !1;
return !0;
}
function gr(e) {
return e !== null ? e : {};
}
var Ge = new _("tag:yaml.org,2002:set", {
kind: "mapping",
resolve: mr,
construct: gr
}), oe = je.extend({
implicit: [
Ue,
He
],
explicit: [
Ke,
qe,
$e,
Ge
]
}), I = Object.prototype.hasOwnProperty, K = 1, We = 2, Qe = 3, q = 4, z = 1, vr = 2, pe = 3, Ar = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/, yr = /[\x85\u2028\u2029]/, wr = /[,\[\]\{\}]/, Ve = /^(?:!|!!|![a-z\-]+!)$/i, Xe = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
function he(e) {
return Object.prototype.toString.call(e);
}
function E(e) {
return e === 10 || e === 13;
}
function N(e) {
return e === 9 || e === 32;
}
function S(e) {
return e === 9 || e === 32 || e === 10 || e === 13;
}
function F(e) {
return e === 44 || e === 91 || e === 93 || e === 123 || e === 125;
}
function _r(e) {
var n;
return 48 <= e && e <= 57 ? e - 48 : (n = e | 32, 97 <= n && n <= 102 ? n - 97 + 10 : -1);
}
function Cr(e) {
return e === 120 ? 2 : e === 117 ? 4 : e === 85 ? 8 : 0;
}
function br(e) {
return 48 <= e && e <= 57 ? e - 48 : -1;
}
function se(e) {
return e === 48 ? "\0" : e === 97 ? "\x07" : e === 98 ? "\b" : e === 116 || e === 9 ? " " : e === 110 ? `
` : e === 118 ? "\v" : e === 102 ? "\f" : e === 114 ? "\r" : e === 101 ? "\x1B" : e === 32 ? " " : e === 34 ? '"' : e === 47 ? "/" : e === 92 ? "\\" : e === 78 ? "
" : e === 95 ? " " : e === 76 ? "\u2028" : e === 80 ? "\u2029" : "";
}
function Sr(e) {
return e <= 65535 ? String.fromCharCode(e) : String.fromCharCode(
(e - 65536 >> 10) + 55296,
(e - 65536 & 1023) + 56320
);
}
var Ze = new Array(256), ze = new Array(256);
for (var M = 0; M < 256; M++)
Ze[M] = se(M) ? 1 : 0, ze[M] = se(M);
function xr(e, n) {
this.input = e, this.filename = n.filename || null, this.schema = n.schema || oe, this.onWarning = n.onWarning || null, this.legacy = n.legacy || !1, this.json = n.json || !1, this.listener = n.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 Je(e, n) {
var r = {
name: e.filename,
buffer: e.input.slice(0, -1),
// omit trailing \0
position: e.position,
line: e.line,
column: e.position - e.lineStart
};
return r.snippet = kn(r), new b(n, r);
}
function h(e, n) {
throw Je(e, n);
}
function $(e, n) {
e.onWarning && e.onWarning.call(null, Je(e, n));
}
var de = {
YAML: function(n, r, l) {
var i, u, o;
n.version !== null && h(n, "duplication of %YAML directive"), l.length !== 1 && h(n, "YAML directive accepts exactly one argument"), i = /^([0-9]+)\.([0-9]+)$/.exec(l[0]), i === null && h(n, "ill-formed argument of the YAML directive"), u = parseInt(i[1], 10), o = parseInt(i[2], 10), u !== 1 && h(n, "unacceptable YAML version of the document"), n.version = l[0], n.checkLineBreaks = o < 2, o !== 1 && o !== 2 && $(n, "unsupported YAML version of the document");
},
TAG: function(n, r, l) {
var i, u;
l.length !== 2 && h(n, "TAG directive accepts exactly two arguments"), i = l[0], u = l[1], Ve.test(i) || h(n, "ill-formed tag handle (first argument) of the TAG directive"), I.call(n.tagMap, i) && h(n, 'there is a previously declared suffix for "' + i + '" tag handle'), Xe.test(u) || h(n, "ill-formed tag prefix (second argument) of the TAG directive");
try {
u = decodeURIComponent(u);
} catch {
h(n, "tag prefix is malformed: " + u);
}
n.tagMap[i] = u;
}
};
function k(e, n, r, l) {
var i, u, o, c;
if (n < r) {
if (c = e.input.slice(n, r), l)
for (i = 0, u = c.length; i < u; i += 1)
o = c.charCodeAt(i), o === 9 || 32 <= o && o <= 1114111 || h(e, "expected valid JSON character");
else Ar.test(c) && h(e, "the stream contains non-printable characters");
e.result += c;
}
}
function me(e, n, r, l) {
var i, u, o, c;
for (w.isObject(r) || h(e, "cannot merge mappings; the provided source object is unacceptable"), i = Object.keys(r), o = 0, c = i.length; o < c; o += 1)
u = i[o], I.call(n, u) || (n[u] = r[u], l[u] = !0);
}
function P(e, n, r, l, i, u, o, c, f) {
var t, p;
if (Array.isArray(i))
for (i = Array.prototype.slice.call(i), t = 0, p = i.length; t < p; t += 1)
Array.isArray(i[t]) && h(e, "nested arrays are not supported inside keys"), typeof i == "object" && he(i[t]) === "[object Object]" && (i[t] = "[object Object]");
if (typeof i == "object" && he(i) === "[object Object]" && (i = "[object Object]"), i = String(i), n === null && (n = {}), l === "tag:yaml.org,2002:merge")
if (Array.isArray(u))
for (t = 0, p = u.length; t < p; t += 1)
me(e, n, u[t], r);
else
me(e, n, u, r);
else
!e.json && !I.call(r, i) && I.call(n, i) && (e.line = o || e.line, e.lineStart = c || e.lineStart, e.position = f || e.position, h(e, "duplicated mapping key")), i === "__proto__" ? Object.defineProperty(n, i, {
configurable: !0,
enumerable: !0,
writable: !0,
value: u
}) : n[i] = u, delete r[i];
return n;
}
function ue(e) {
var n;
n = e.input.charCodeAt(e.position), n === 10 ? e.position++ : n === 13 ? (e.position++, e.input.charCodeAt(e.position) === 10 && e.position++) : h(e, "a line break is expected"), e.line += 1, e.lineStart = e.position, e.firstTabInLine = -1;
}
function y(e, n, r) {
for (var l = 0, i = e.input.charCodeAt(e.position); i !== 0; ) {
for (; N(i); )
i === 9 && e.firstTabInLine === -1 && (e.firstTabInLine = e.position), i = e.input.charCodeAt(++e.position);
if (n && i === 35)
do
i = e.input.charCodeAt(++e.position);
while (i !== 10 && i !== 13 && i !== 0);
if (E(i))
for (ue(e), i = e.input.charCodeAt(e.position), l++, e.lineIndent = 0; i === 32; )
e.lineIndent++, i = e.input.charCodeAt(++e.position);
else
break;
}
return r !== -1 && l !== 0 && e.lineIndent < r && $(e, "deficient indentation"), l;
}
function Q(e) {
var n = e.position, r;
return r = e.input.charCodeAt(n), !!((r === 45 || r === 46) && r === e.input.charCodeAt(n + 1) && r === e.input.charCodeAt(n + 2) && (n += 3, r = e.input.charCodeAt(n), r === 0 || S(r)));
}
function ce(e, n) {
n === 1 ? e.result += " " : n > 1 && (e.result += w.repeat(`
`, n - 1));
}
function Er(e, n, r) {
var l, i, u, o, c, f, t, p, a = e.kind, s = e.result, d;
if (d = e.input.charCodeAt(e.position), S(d) || F(d) || d === 35 || d === 38 || d === 42 || d === 33 || d === 124 || d === 62 || d === 39 || d === 34 || d === 37 || d === 64 || d === 96 || (d === 63 || d === 45) && (i = e.input.charCodeAt(e.position + 1), S(i) || r && F(i)))
return !1;
for (e.kind = "scalar", e.result = "", u = o = e.position, c = !1; d !== 0; ) {
if (d === 58) {
if (i = e.input.charCodeAt(e.position + 1), S(i) || r && F(i))
break;
} else if (d === 35) {
if (l = e.input.charCodeAt(e.position - 1), S(l))
break;
} else {
if (e.position === e.lineStart && Q(e) || r && F(d))
break;
if (E(d))
if (f = e.line, t = e.lineStart, p = e.lineIndent, y(e, !1, -1), e.lineIndent >= n) {
c = !0, d = e.input.charCodeAt(e.position);
continue;
} else {
e.position = o, e.line = f, e.lineStart = t, e.lineIndent = p;
break;
}
}
c && (k(e, u, o, !1), ce(e, e.line - f), u = o = e.position, c = !1), N(d) || (o = e.position + 1), d = e.input.charCodeAt(++e.position);
}
return k(e, u, o, !1), e.result ? !0 : (e.kind = a, e.result = s, !1);
}
function Tr(e, n) {
var r, l, i;
if (r = e.input.charCodeAt(e.position), r !== 39)
return !1;
for (e.kind = "scalar", e.result = "", e.position++, l = i = e.position; (r = e.input.charCodeAt(e.position)) !== 0; )
if (r === 39)
if (k(e, l, e.position, !0), r = e.input.charCodeAt(++e.position), r === 39)
l = e.position, e.position++, i = e.position;
else
return !0;
else E(r) ? (k(e, l, i, !0), ce(e, y(e, !1, n)), l = i = e.position) : e.position === e.lineStart && Q(e) ? h(e, "unexpected end of the document within a single quoted scalar") : (e.position++, i = e.position);
h(e, "unexpected end of the stream within a single quoted scalar");
}
function Or(e, n) {
var r, l, i, u, o, c;
if (c = e.input.charCodeAt(e.position), c !== 34)
return !1;
for (e.kind = "scalar", e.result = "", e.position++, r = l = e.position; (c = e.input.charCodeAt(e.position)) !== 0; ) {
if (c === 34)
return k(e, r, e.position, !0), e.position++, !0;
if (c === 92) {
if (k(e, r, e.position, !0), c = e.input.charCodeAt(++e.position), E(c))
y(e, !1, n);
else if (c < 256 && Ze[c])
e.result += ze[c], e.position++;
else if ((o = Cr(c)) > 0) {
for (i = o, u = 0; i > 0; i--)
c = e.input.charCodeAt(++e.position), (o = _r(c)) >= 0 ? u = (u << 4) + o : h(e, "expected hexadecimal character");
e.result += Sr(u), e.position++;
} else
h(e, "unknown escape sequence");
r = l = e.position;
} else E(c) ? (k(e, r, l, !0), ce(e, y(e, !1, n)), r = l = e.position) : e.position === e.lineStart && Q(e) ? h(e, "unexpected end of the document within a double quoted scalar") : (e.position++, l = e.position);
}
h(e, "unexpected end of the stream within a double quoted scalar");
}
function kr(e, n) {
var r = !0, l, i, u, o = e.tag, c, f = e.anchor, t, p, a, s, d, m = /* @__PURE__ */ Object.create(null), v, A, x, g;
if (g = e.input.charCodeAt(e.position), g === 91)
p = 93, d = !1, c = [];
else if (g === 123)
p = 125, d = !0, c = {};
else
return !1;
for (e.anchor !== null && (e.anchorMap[e.anchor] = c), g = e.input.charCodeAt(++e.position); g !== 0; ) {
if (y(e, !0, n), g = e.input.charCodeAt(e.position), g === p)
return e.position++, e.tag = o, e.anchor = f, e.kind = d ? "mapping" : "sequence", e.result = c, !0;
r ? g === 44 && h(e, "expected the node content, but found ','") : h(e, "missed comma between flow collection entries"), A = v = x = null, a = s = !1, g === 63 && (t = e.input.charCodeAt(e.position + 1), S(t) && (a = s = !0, e.position++, y(e, !0, n))), l = e.line, i = e.lineStart, u = e.position, Y(e, n, K, !1, !0), A = e.tag, v = e.result, y(e, !0, n), g = e.input.charCodeAt(e.position), (s || e.line === l) && g === 58 && (a = !0, g = e.input.charCodeAt(++e.position), y(e, !0, n), Y(e, n, K, !1, !0), x = e.result), d ? P(e, c, m, A, v, x, l, i, u) : a ? c.push(P(e, null, m, A, v, x, l, i, u)) : c.push(v), y(e, !0, n), g = e.input.charCodeAt(e.position), g === 44 ? (r = !0, g = e.input.charCodeAt(++e.position)) : r = !1;
}
h(e, "unexpected end of the stream within a flow collection");
}
function Ir(e, n) {
var r, l, i = z, u = !1, o = !1, c = n, f = 0, t = !1, p, a;
if (a = e.input.charCodeAt(e.position), a === 124)
l = !1;
else if (a === 62)
l = !0;
else
return !1;
for (e.kind = "scalar", e.result = ""; a !== 0; )
if (a = e.input.charCodeAt(++e.position), a === 43 || a === 45)
z === i ? i = a === 43 ? pe : vr : h(e, "repeat of a chomping mode identifier");
else if ((p = br(a)) >= 0)
p === 0 ? h(e, "bad explicit indentation width of a block scalar; it cannot be less than one") : o ? h(e, "repeat of an indentation width identifier") : (c = n + p - 1, o = !0);
else
break;
if (N(a)) {
do
a = e.input.charCodeAt(++e.position);
while (N(a));
if (a === 35)
do
a = e.input.charCodeAt(++e.position);
while (!E(a) && a !== 0);
}
for (; a !== 0; ) {
for (ue(e), e.lineIndent = 0, a = e.input.charCodeAt(e.position); (!o || e.lineIndent < c) && a === 32; )
e.lineIndent++, a = e.input.charCodeAt(++e.position);
if (!o && e.lineIndent > c && (c = e.lineIndent), E(a)) {
f++;
continue;
}
if (e.lineIndent < c) {
i === pe ? e.result += w.repeat(`
`, u ? 1 + f : f) : i === z && u && (e.result += `
`);
break;
}
for (l ? N(a) ? (t = !0, e.result += w.repeat(`
`, u ? 1 + f : f)) : t ? (t = !1, e.result += w.repeat(`
`, f + 1)) : f === 0 ? u && (e.result += " ") : e.result += w.repeat(`
`, f) : e.result += w.repeat(`
`, u ? 1 + f : f), u = !0, o = !0, f = 0, r = e.position; !E(a) && a !== 0; )
a = e.input.charCodeAt(++e.position);
k(e, r, e.position, !1);
}
return !0;
}
function ge(e, n) {
var r, l = e.tag, i = e.anchor, u = [], o, c = !1, f;
if (e.firstTabInLine !== -1) return !1;
for (e.anchor !== null && (e.anchorMap[e.anchor] = u), f = e.input.charCodeAt(e.position); f !== 0 && (e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, h(e, "tab characters must not be used in indentation")), !(f !== 45 || (o = e.input.charCodeAt(e.position + 1), !S(o)))); ) {
if (c = !0, e.position++, y(e, !0, -1) && e.lineIndent <= n) {
u.push(null), f = e.input.charCodeAt(e.position);
continue;
}
if (r = e.line, Y(e, n, Qe, !1, !0), u.push(e.result), y(e, !0, -1), f = e.input.charCodeAt(e.position), (e.line === r || e.lineIndent > n) && f !== 0)
h(e, "bad indentation of a sequence entry");
else if (e.lineIndent < n)
break;
}
return c ? (e.tag = l, e.anchor = i, e.kind = "sequence", e.result = u, !0) : !1;
}
function Lr(e, n, r) {
var l, i, u, o, c, f, t = e.tag, p = e.anchor, a = {}, s = /* @__PURE__ */ Object.create(null), d = null, m = null, v = null, A = !1, x = !1, g;
if (e.firstTabInLine !== -1) return !1;
for (e.anchor !== null && (e.anchorMap[e.anchor] = a), g = e.input.charCodeAt(e.position); g !== 0; ) {
if (!A && e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, h(e, "tab characters must not be used in indentation")), l = e.input.charCodeAt(e.position + 1), u = e.line, (g === 63 || g === 58) && S(l))
g === 63 ? (A && (P(e, a, s, d, m, null, o, c, f), d = m = v = null), x = !0, A = !0, i = !0) : A ? (A = !1, i = !0) : h(e, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"), e.position += 1, g = l;
else {
if (o = e.line, c = e.lineStart, f = e.position, !Y(e, r, We, !1, !0))
break;
if (e.line === u) {
for (g = e.input.charCodeAt(e.position); N(g); )
g = e.input.charCodeAt(++e.position);
if (g === 58)
g = e.input.charCodeAt(++e.position), S(g) || h(e, "a whitespace character is expected after the key-value separator within a block mapping"), A && (P(e, a, s, d, m, null, o, c, f), d = m = v = null), x = !0, A = !1, i = !1, d = e.tag, m = e.result;
else if (x)
h(e, "can not read an implicit mapping pair; a colon is missed");
else
return e.tag = t, e.anchor = p, !0;
} else if (x)
h(e, "can not read a block mapping entry; a multiline key may not be an implicit key");
else
return e.tag = t, e.anchor = p, !0;
}
if ((e.line === u || e.lineIndent > n) && (A && (o = e.line, c = e.lineStart, f = e.position), Y(e, n, q, !0, i) && (A ? m = e.result : v = e.result), A || (P(e, a, s, d, m, v, o, c, f), d = m = v = null), y(e, !0, -1), g = e.input.charCodeAt(e.position)), (e.line === u || e.lineIndent > n) && g !== 0)
h(e, "bad indentation of a mapping entry");
else if (e.lineIndent < n)
break;
}
return A && P(e, a, s, d, m, null, o, c, f), x && (e.tag = t, e.anchor = p, e.kind = "mapping", e.result = a), x;
}
function Nr(e) {
var n, r = !1, l = !1, i, u, o;
if (o = e.input.charCodeAt(e.position), o !== 33) return !1;
if (e.tag !== null && h(e, "duplication of a tag property"), o = e.input.charCodeAt(++e.position), o === 60 ? (r = !0, o = e.input.charCodeAt(++e.position)) : o === 33 ? (l = !0, i = "!!", o = e.input.charCodeAt(++e.position)) : i = "!", n = e.position, r) {
do
o = e.input.charCodeAt(++e.position);
while (o !== 0 && o !== 62);
e.position < e.length ? (u = e.input.slice(n, e.position), o = e.input.charCodeAt(++e.position)) : h(e, "unexpected end of the stream within a verbatim tag");
} else {
for (; o !== 0 && !S(o); )
o === 33 && (l ? h(e, "tag suffix cannot contain exclamation marks") : (i = e.input.slice(n - 1, e.position + 1), Ve.test(i) || h(e, "named tag handle cannot contain such characters"), l = !0, n = e.position + 1)), o = e.input.charCodeAt(++e.position);
u = e.input.slice(n, e.position), wr.test(u) && h(e, "tag suffix cannot contain flow indicator characters");
}
u && !Xe.test(u) && h(e, "tag name cannot contain such characters: " + u);
try {
u = decodeURIComponent(u);
} catch {
h(e, "tag name is malformed: " + u);
}
return r ? e.tag = u : I.call(e.tagMap, i) ? e.tag = e.tagMap[i] + u : i === "!" ? e.tag = "!" + u : i === "!!" ? e.tag = "tag:yaml.org,2002:" + u : h(e, 'undeclared tag handle "' + i + '"'), !0;
}
function Mr(e) {
var n, r;
if (r = e.input.charCodeAt(e.position), r !== 38) return !1;
for (e.anchor !== null && h(e, "duplication of an anchor property"), r = e.input.charCodeAt(++e.position), n = e.position; r !== 0 && !S(r) && !F(r); )
r = e.input.charCodeAt(++e.position);
return e.position === n && h(e, "name of an anchor node must contain at least one character"), e.anchor = e.input.slice(n, e.position), !0;
}
function Rr(e) {
var n, r, l;
if (l = e.input.charCodeAt(e.position), l !== 42) return !1;
for (l = e.input.charCodeAt(++e.position), n = e.position; l !== 0 && !S(l) && !F(l); )
l = e.input.charCodeAt(++e.position);
return e.position === n && h(e, "name of an alias node must contain at least one character"), r = e.input.slice(n, e.position), I.call(e.anchorMap, r) || h(e, 'unidentified alias "' + r + '"'), e.result = e.anchorMap[r], y(e, !0, -1), !0;
}
function Y(e, n, r, l, i) {
var u, o, c, f = 1, t = !1, p = !1, a, s, d, m, v, A;
if (e.listener !== null && e.listener("open", e), e.tag = null, e.anchor = null, e.kind = null, e.result = null, u = o = c = q === r || Qe === r, l && y(e, !0, -1) && (t = !0, e.lineIndent > n ? f = 1 : e.lineIndent === n ? f = 0 : e.lineIndent < n && (f = -1)), f === 1)
for (; Nr(e) || Mr(e); )
y(e, !0, -1) ? (t = !0, c = u, e.lineIndent > n ? f = 1 : e.lineIndent === n ? f = 0 : e.lineIndent < n && (f = -1)) : c = !1;
if (c && (c = t || i), (f === 1 || q === r) && (K === r || We === r ? v = n : v = n + 1, A = e.position - e.lineStart, f === 1 ? c && (ge(e, A) || Lr(e, A, v)) || kr(e, v) ? p = !0 : (o && Ir(e, v) || Tr(e, v) || Or(e, v) ? p = !0 : Rr(e) ? (p = !0, (e.tag !== null || e.anchor !== null) && h(e, "alias node should not have any properties")) : Er(e, v, K === r) && (p = !0, e.tag === null && (e.tag = "?")), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : f === 0 && (p = c && ge(e, A))), e.tag === null)
e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
else if (e.tag === "?") {
for (e.result !== null && e.kind !== "scalar" && h(e, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + e.kind + '"'), a = 0, s = e.implicitTypes.length; a < s; a += 1)
if (m = e.implicitTypes[a], m.resolve(e.result)) {
e.result = m.construct(e.result), e.tag = m.tag, e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
break;
}
} else if (e.tag !== "!") {
if (I.call(e.typeMap[e.kind || "fallback"], e.tag))
m = e.typeMap[e.kind || "fallback"][e.tag];
else
for (m = null, d = e.typeMap.multi[e.kind || "fallback"], a = 0, s = d.length; a < s; a += 1)
if (e.tag.slice(0, d[a].tag.length) === d[a].tag) {
m = d[a];
break;
}
m || h(e, "unknown tag !<" + e.tag + ">"), e.result !== null && m.kind !== e.kind && h(e, "unacceptable node kind for !<" + e.tag + '> tag; it should be "' + m.kind + '", not "' + e.kind + '"'), m.resolve(e.result, e.tag) ? (e.result = m.construct(e.result, e.tag), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : h(e, "cannot resolve a node with !<" + e.tag + "> explicit tag");
}
return e.listener !== null && e.listener("close", e), e.tag !== null || e.anchor !== null || p;
}
function Fr(e) {
var n = e.position, r, l, i, u = !1, o;
for (e.version = null, e.checkLineBreaks = e.legacy, e.tagMap = /* @__PURE__ */ Object.create(null), e.anchorMap = /* @__PURE__ */ Object.create(null); (o = e.input.charCodeAt(e.position)) !== 0 && (y(e, !0, -1), o = e.input.charCodeAt(e.position), !(e.lineIndent > 0 || o !== 37)); ) {
for (u = !0, o = e.input.charCodeAt(++e.position), r = e.position; o !== 0 && !S(o); )
o = e.input.charCodeAt(++e.position);
for (l = e.input.slice(r, e.position), i = [], l.length < 1 && h(e, "directive name must not be less than one character in length"); o !== 0; ) {
for (; N(o); )
o = e.input.charCodeAt(++e.position);
if (o === 35) {
do
o = e.input.charCodeAt(++e.position);
while (o !== 0 && !E(o));
break;
}
if (E(o)) break;
for (r = e.position; o !== 0 && !S(o); )
o = e.input.charCodeAt(++e.position);
i.push(e.input.slice(r, e.position));
}
o !== 0 && ue(e), I.call(de, l) ? de[l](e, l, i) : $(e, 'unknown document directive "' + l + '"');
}
if (y(e, !0, -1), e.lineIndent === 0 && e.input.charCodeAt(e.position) === 45 && e.input.charCodeAt(e.position + 1) === 45 && e.input.charCodeAt(e.position + 2) === 45 ? (e.position += 3, y(e, !0, -1)) : u && h(e, "directives end mark is expected"), Y(e, e.lineIndent - 1, q, !1, !0), y(e, !0, -1), e.checkLineBreaks && yr.test(e.input.slice(n, e.position)) && $(e, "non-ASCII line breaks are interpreted as content"), e.documents.push(e.result), e.position === e.lineStart && Q(e)) {
e.input.charCodeAt(e.position) === 46 && (e.position += 3, y(e, !0, -1));
return;
}
if (e.position < e.length - 1)
h(e, "end of the stream or a document separator is expected");
else
return;
}
function en(e, n) {
e = String(e), n = n || {}, e.length !== 0 && (e.charCodeAt(e.length - 1) !== 10 && e.charCodeAt(e.length - 1) !== 13 && (e += `
`), e.charCodeAt(0) === 65279 && (e = e.slice(1)));
var r = new xr(e, n), l = e.indexOf("\0");
for (l !== -1 && (r.position = l, h(r, "null byte is not allowed in input")), r.input += "\0"; r.input.charCodeAt(r.position) === 32; )
r.lineIndent += 1, r.position += 1;
for (; r.position < r.length - 1; )
Fr(r);
return r.documents;
}
function Pr(e, n, r) {
n !== null && typeof n == "object" && typeof r > "u" && (r = n, n = null);
var l = en(e, r);
if (typeof n != "function")
return l;
for (var i = 0, u = l.length; i < u; i += 1)
n(l[i]);
}
function Yr(e, n) {
var r = en(e, n);
if (r.length !== 0) {
if (r.length === 1)
return r[0];
throw new b("expected a single document in the stream, but found more");
}
}
var jr = Pr, Dr = Yr, nn = {
loadAll: jr,
load: Dr
}, rn = Object.prototype.toString, ln = Object.prototype.hasOwnProperty, fe = 65279, Br = 9, B = 10, Ur = 13, Hr = 32, Kr = 33, qr = 34, ee = 35, $r = 37, Gr = 38, Wr = 39, Qr = 42, on = 44, Vr = 45, G = 58, Xr = 61, Zr = 62, zr = 63, Jr = 64, un = 91, cn = 93, ei = 96, fn = 123, ni = 124, tn = 125, C = {};
C[0] = "\\0";
C[7] = "\\a";
C[8] = "\\b";
C[9] = "\\t";
C[10] = "\\n";
C[11] = "\\v";
C[12] = "\\f";
C[13] = "\\r";
C[27] = "\\e";
C[34] = '\\"';
C[92] = "\\\\";
C[133] = "\\N";
C[160] = "\\_";
C[8232] = "\\L";
C[8233] = "\\P";
var ri = [
"y",
"Y",
"yes",
"Yes",
"YES",
"on",
"On",
"ON",
"n",
"N",
"no",
"No",
"NO",
"off",
"Off",
"OFF"
], ii = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
function li(e, n) {
var r, l, i, u, o, c, f;
if (n === null) return {};
for (r = {}, l = Object.keys(n), i = 0, u = l.length; i < u; i += 1)
o = l[i], c = String(n[o]), o.slice(0, 2) === "!!" && (o = "tag:yaml.org,2002:" + o.slice(2)), f = e.compiledTypeMap.fallback[o], f && ln.call(f.styleAliases, c) && (c = f.styleAliases[c]), r[o] = c;
return r;
}
function oi(e) {
var n, r, l;
if (n = e.toString(16).toUpperCase(), e <= 255)
r = "x", l = 2;
else if (e <= 65535)
r = "u", l = 4;
else if (e <= 4294967295)
r = "U", l = 8;
else
throw new b("code point within a string may not be greater than 0xFFFFFFFF");
return "\\" + r + w.repeat("0", l - n.length) + n;
}
var ui = 1, U = 2;
function ci(e) {
this.schema = e.schema || oe, this.indent = Math.max(1, e.indent || 2), this.noArrayIndent = e.noArrayIndent || !1, this.skipInvalid = e.skipInvalid || !1, this.flowLevel = w.isNothing(e.flowLevel) ? -1 : e.flowLevel, this.styleMap = li(this.schema, e.styles || null), this.sortKeys = e.sortKeys || !1, this.lineWidth = e.lineWidth || 80, this.noRefs = e.noRefs || !1, this.noCompatMode = e.noCompatMode || !1, this.condenseFlow = e.condenseFlow || !1, this.quotingType = e.quotingType === '"' ? U : ui, this.forceQuotes = e.forceQuotes || !1, this.replacer = typeof e.replacer == "function" ? e.replacer : null, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null;
}
function ve(e, n) {
for (var r = w.repeat(" ", n), l = 0, i = -1, u = "", o, c = e.length; l < c; )
i = e.indexOf(`
`, l), i === -1 ? (o = e.slice(l), l = c) : (o = e.slice(l, i + 1), l = i + 1), o.length && o !== `
` && (u += r), u += o;
return u;
}
function ne(e, n) {
return `
` + w.repeat(" ", e.indent * n);
}
function fi(e, n) {
var r, l, i;
for (r = 0, l = e.implicitTypes.length; r < l; r += 1)
if (i = e.implicitTypes[r], i.resolve(n))
return !0;
return !1;
}
function W(e) {
return e === Hr || e === Br;
}
function H(e) {
return 32 <= e && e <= 126 || 161 <= e && e <= 55295 && e !== 8232 && e !== 8233 || 57344 <= e && e <= 65533 && e !== fe || 65536 <= e && e <= 1114111;
}
function Ae(e) {
return H(e) && e !== fe && e !== Ur && e !== B;
}
function ye(e, n, r) {
var l = Ae(e), i = l && !W(e);
return (
// ns-plain-safe
(r ? (
// c = flow-in
l
) : l && e !== on && e !== un && e !== cn && e !== fn && e !== tn) && e !== ee && !(n === G && !i) || Ae(n) && !W(n) && e === ee || n === G && i
);
}
function ti(e) {
return H(e) && e !== fe && !W(e) && e !== Vr && e !== zr && e !== G && e !== on && e !== un && e !== cn && e !== fn && e !== tn && e !== ee && e !== Gr && e !== Qr && e !== Kr && e !== ni && e !== Xr && e !== Zr && e !== Wr && e !== qr && e !== $r && e !== Jr && e !== ei;
}
function ai(e) {
return !W(e) && e !== G;
}
function j(e, n) {
var r = e.charCodeAt(n), l;
return r >= 55296 && r <= 56319 && n + 1 < e.length && (l = e.charCodeAt(n + 1), l >= 56320 && l <= 57343) ? (r - 55296) * 1024 + l - 56320 + 65536 : r;
}
function an(e) {
var n = /^\n* /;
return n.test(e);
}
var pn = 1, re = 2, hn = 3, sn = 4, R = 5;
function pi(e, n, r, l, i, u, o, c) {
var f, t = 0, p = null, a = !1, s = !1, d = l !== -1, m = -1, v = ti(j(e, 0)) && ai(j(e, e.length - 1));
if (n || o)
for (f = 0; f < e.length; t >= 65536 ? f += 2 : f++) {
if (t = j(e, f), !H(t))
return R;
v = v && ye(t, p, c), p = t;
}
else {
for (f = 0; f < e.length; t >= 65536 ? f += 2 : f++) {
if (t = j(e, f), t === B)
a = !0, d && (s = s || // Foldable line = too long, and not more-indented.
f - m - 1 > l && e[m + 1] !== " ", m = f);
else if (!H(t))
return R;
v = v && ye(t, p, c), p = t;
}
s = s || d && f - m - 1 > l && e[m + 1] !== " ";
}
return !a && !s ? v && !o && !i(e) ? pn : u === U ? R : re : r > 9 && an(e) ? R : o ? u === U ? R : re : s ? sn : hn;
}
function hi(e, n, r, l, i) {
e.dump = function() {
if (n.length === 0)
return e.quotingType === U ? '""' : "''";
if (!e.noCompatMode && (ri.indexOf(n) !== -1 || ii.test(n)))
return e.quotingType === U ? '"' + n + '"' : "'" + n + "'";
var u = e.indent * Math.max(1, r), o = e.lineWidth === -1 ? -1 : Math.max(Math.min(e.lineWidth, 40), e.lineWidth - u), c = l || e.flowLevel > -1 && r >= e.flowLevel;
function f(t) {
return fi(e, t);
}
switch (pi(
n,
c,
e.indent,
o,
f,
e.quotingType,
e.forceQuotes && !l,
i
)) {
case pn:
return n;
case re:
return "'" + n.replace(/'/g, "''") + "'";
case hn:
return "|" + we(n, e.indent) + _e(ve(n, u));
case sn:
return ">" + we(n, e.indent) + _e(ve(si(n, o), u));
case R:
return '"' + di(n) + '"';
default:
throw new b("impossible error: invalid scalar style");
}
}();
}
function we(e, n) {
var r = an(e) ? String(n) : "", l = e[e.length - 1] === `
`, i = l && (e[e.length - 2] === `
` || e === `
`), u = i ? "+" : l ? "" : "-";
return r + u + `
`;
}
function _e(e) {
return e[e.length - 1] === `
` ? e.slice(0, -1) : e;
}
function si(e, n) {
for (var r = /(\n+)([^\n]*)/g, l = function() {
var t = e.indexOf(`
`);
return t = t !== -1 ? t : e.length, r.lastIndex = t, Ce(e.slice(0, t), n);
}(), i = e[0] === `
` || e[0] === " ", u, o; o = r.exec(e); ) {
var c = o[1], f = o[2];
u = f[0] === " ", l += c + (!i && !u && f !== "" ? `
` : "") + Ce(f, n), i = u;
}
return l;
}
function Ce(e, n) {
if (e === "" || e[0] === " ") return e;
for (var r = / [^ ]/g, l, i = 0, u, o = 0, c = 0, f = ""; l = r.exec(e); )
c = l.index, c - i > n && (u = o > i ? o : c, f += `
` + e.slice(i, u), i = u + 1), o = c;
return f += `
`, e.length - i > n && o > i ? f += e.slice(i, o) + `
` + e.slice(o + 1) : f += e.slice(i), f.slice(1);
}
function di(e) {
for (var n = "", r = 0, l, i = 0; i < e.length; r >= 65536 ? i += 2 : i++)
r = j(e, i), l = C[r], !l && H(r) ? (n += e[i], r >= 65536 && (n += e[i + 1])) : n += l || oi(r);
return n;
}
function mi(e, n, r) {
var l = "", i = e.tag, u, o, c;
for (u = 0, o = r.length; u < o; u += 1)
c = r[u], e.replacer && (c = e.replacer.call(r, String(u), c)), (O(e, n, c, !1, !1) || typeof c > "u" && O(e, n, null, !1, !1)) && (l !== "" && (l += "," + (e.condenseFlow ? "" : " ")), l += e.dump);
e.tag = i, e.dump = "[" + l + "]";
}
function be(e, n, r, l) {
var i = "", u = e.tag, o, c, f;
for (o = 0, c = r.length; o < c; o += 1)
f = r[o], e.replacer && (f = e.replacer.call(r, String(o), f)), (O(e, n + 1, f, !0, !0, !1, !0) || typeof f > "u" && O(e, n + 1, null, !0, !0, !1, !0)) && ((!l || i !== "") && (i += ne(e, n)), e.dump && B === e.dump.charCodeAt(0) ? i += "-" : i += "- ", i += e.dump);
e.tag = u, e.dump = i || "[]";
}
function gi(e, n, r) {
var l = "", i = e.tag, u = Object.keys(r), o, c, f, t, p;
for (o = 0, c = u.length; o < c; o += 1)
p = "", l !== "" && (p += ", "), e.condenseFlow && (p += '"'), f = u[o], t = r[f], e.replacer && (t = e.replacer.call(r, f, t)), O(e, n, f, !1, !1) && (e.dump.length > 1024 && (p += "? "), p += e.dump + (e.condenseFlow ? '"' : "") + ":" + (e.condenseFlow ? "" : " "), O(e, n, t, !1, !1) && (p += e.dump, l += p));
e.tag = i, e.dump = "{" + l + "}";
}
function vi(e, n, r, l) {
var i = "", u = e.tag, o = Object.keys(r), c, f, t, p, a, s;
if (e.sortKeys === !0)
o.sort();
else if (typeof e.sortKeys == "function")
o.sort(e.sortKeys);
else if (e.sortKeys)
throw new b("sortKeys must be a boolean or a function");
for (c = 0, f = o.length; c < f; c += 1)
s = "", (!l || i !== "") && (s += ne(e, n)), t = o[c], p = r[t], e.replacer && (p = e.replacer.call(r, t, p)), O(e, n + 1, t, !0, !0, !0) && (a = e.tag !== null && e.tag !== "?" || e.dump && e.dump.length > 1024, a && (e.dump && B === e.dump.charCodeAt(0) ? s += "?" : s += "? "), s += e.dump, a && (s += ne(e, n)), O(e, n + 1, p, !0, a) && (e.dump && B === e.dump.charCodeAt(0) ? s += ":" : s += ": ", s += e.dump, i += s));
e.tag = u, e.dump = i || "{}";
}
function Se(e, n, r) {
var l, i, u, o, c, f;
for (i = r ? e.explicitTypes : e.implicitTypes, u = 0, o = i.length; u < o; u += 1)
if (c = i[u], (c.instanceOf || c.predicate) && (!c.instanceOf || typeof n == "object" && n instanceof c.instanceOf) && (!c.predicate || c.predicate(n))) {
if (r ? c.multi && c.representName ? e.tag = c.representName(n) : e.tag = c.tag : e.tag = "?", c.represent) {
if (f = e.styleMap[c.tag] || c.defaultStyle, rn.call(c.represent) === "[object Function]")
l = c.represent(n, f);
else if (ln.call(c.represent, f))
l = c.represent[f](n, f);
else
throw new b("!<" + c.tag + '> tag resolver accepts not "' + f + '" style');
e.dump = l;
}
return !0;
}
return !1;
}
function O(e, n, r, l, i, u, o) {
e.tag = null, e.dump = r, Se(e, r, !1) || Se(e, r, !0);
var c = rn.call(e.dump), f = l, t;
l && (l = e.flowLevel < 0 || e.flowLevel > n);
var p = c === "[object Object]" || c === "[object Array]", a, s;
if (p && (a = e.duplicates.indexOf(r), s = a !== -1), (e.tag !==