@hufe921/canvas-editor-plugin-docx
Version:
docx plugin for canvas-editor
1,444 lines (1,443 loc) • 1.18 MB
JavaScript
import { TitleLevel as Gn, ElementType as Vt, ListStyle as lm } from "@hufe921/canvas-editor";
var Ie = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function dm(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
function hm(e) {
if (e.__esModule)
return e;
var t = e.default;
if (typeof t == "function") {
var n = function r() {
if (this instanceof r) {
var i = [null];
i.push.apply(i, arguments);
var o = Function.bind.apply(t, i);
return new o();
}
return t.apply(this, arguments);
};
n.prototype = t.prototype;
} else
n = {};
return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
var i = Object.getOwnPropertyDescriptor(e, r);
Object.defineProperty(n, r, i.get ? i : {
enumerable: !0,
get: function() {
return e[r];
}
});
}), n;
}
var Ch = { exports: {} }, Sh = {
aliceblue: [240, 248, 255],
antiquewhite: [250, 235, 215],
aqua: [0, 255, 255],
aquamarine: [127, 255, 212],
azure: [240, 255, 255],
beige: [245, 245, 220],
bisque: [255, 228, 196],
black: [0, 0, 0],
blanchedalmond: [255, 235, 205],
blue: [0, 0, 255],
blueviolet: [138, 43, 226],
brown: [165, 42, 42],
burlywood: [222, 184, 135],
cadetblue: [95, 158, 160],
chartreuse: [127, 255, 0],
chocolate: [210, 105, 30],
coral: [255, 127, 80],
cornflowerblue: [100, 149, 237],
cornsilk: [255, 248, 220],
crimson: [220, 20, 60],
cyan: [0, 255, 255],
darkblue: [0, 0, 139],
darkcyan: [0, 139, 139],
darkgoldenrod: [184, 134, 11],
darkgray: [169, 169, 169],
darkgreen: [0, 100, 0],
darkgrey: [169, 169, 169],
darkkhaki: [189, 183, 107],
darkmagenta: [139, 0, 139],
darkolivegreen: [85, 107, 47],
darkorange: [255, 140, 0],
darkorchid: [153, 50, 204],
darkred: [139, 0, 0],
darksalmon: [233, 150, 122],
darkseagreen: [143, 188, 143],
darkslateblue: [72, 61, 139],
darkslategray: [47, 79, 79],
darkslategrey: [47, 79, 79],
darkturquoise: [0, 206, 209],
darkviolet: [148, 0, 211],
deeppink: [255, 20, 147],
deepskyblue: [0, 191, 255],
dimgray: [105, 105, 105],
dimgrey: [105, 105, 105],
dodgerblue: [30, 144, 255],
firebrick: [178, 34, 34],
floralwhite: [255, 250, 240],
forestgreen: [34, 139, 34],
fuchsia: [255, 0, 255],
gainsboro: [220, 220, 220],
ghostwhite: [248, 248, 255],
gold: [255, 215, 0],
goldenrod: [218, 165, 32],
gray: [128, 128, 128],
green: [0, 128, 0],
greenyellow: [173, 255, 47],
grey: [128, 128, 128],
honeydew: [240, 255, 240],
hotpink: [255, 105, 180],
indianred: [205, 92, 92],
indigo: [75, 0, 130],
ivory: [255, 255, 240],
khaki: [240, 230, 140],
lavender: [230, 230, 250],
lavenderblush: [255, 240, 245],
lawngreen: [124, 252, 0],
lemonchiffon: [255, 250, 205],
lightblue: [173, 216, 230],
lightcoral: [240, 128, 128],
lightcyan: [224, 255, 255],
lightgoldenrodyellow: [250, 250, 210],
lightgray: [211, 211, 211],
lightgreen: [144, 238, 144],
lightgrey: [211, 211, 211],
lightpink: [255, 182, 193],
lightsalmon: [255, 160, 122],
lightseagreen: [32, 178, 170],
lightskyblue: [135, 206, 250],
lightslategray: [119, 136, 153],
lightslategrey: [119, 136, 153],
lightsteelblue: [176, 196, 222],
lightyellow: [255, 255, 224],
lime: [0, 255, 0],
limegreen: [50, 205, 50],
linen: [250, 240, 230],
magenta: [255, 0, 255],
maroon: [128, 0, 0],
mediumaquamarine: [102, 205, 170],
mediumblue: [0, 0, 205],
mediumorchid: [186, 85, 211],
mediumpurple: [147, 112, 219],
mediumseagreen: [60, 179, 113],
mediumslateblue: [123, 104, 238],
mediumspringgreen: [0, 250, 154],
mediumturquoise: [72, 209, 204],
mediumvioletred: [199, 21, 133],
midnightblue: [25, 25, 112],
mintcream: [245, 255, 250],
mistyrose: [255, 228, 225],
moccasin: [255, 228, 181],
navajowhite: [255, 222, 173],
navy: [0, 0, 128],
oldlace: [253, 245, 230],
olive: [128, 128, 0],
olivedrab: [107, 142, 35],
orange: [255, 165, 0],
orangered: [255, 69, 0],
orchid: [218, 112, 214],
palegoldenrod: [238, 232, 170],
palegreen: [152, 251, 152],
paleturquoise: [175, 238, 238],
palevioletred: [219, 112, 147],
papayawhip: [255, 239, 213],
peachpuff: [255, 218, 185],
peru: [205, 133, 63],
pink: [255, 192, 203],
plum: [221, 160, 221],
powderblue: [176, 224, 230],
purple: [128, 0, 128],
rebeccapurple: [102, 51, 153],
red: [255, 0, 0],
rosybrown: [188, 143, 143],
royalblue: [65, 105, 225],
saddlebrown: [139, 69, 19],
salmon: [250, 128, 114],
sandybrown: [244, 164, 96],
seagreen: [46, 139, 87],
seashell: [255, 245, 238],
sienna: [160, 82, 45],
silver: [192, 192, 192],
skyblue: [135, 206, 235],
slateblue: [106, 90, 205],
slategray: [112, 128, 144],
slategrey: [112, 128, 144],
snow: [255, 250, 250],
springgreen: [0, 255, 127],
steelblue: [70, 130, 180],
tan: [210, 180, 140],
teal: [0, 128, 128],
thistle: [216, 191, 216],
tomato: [255, 99, 71],
turquoise: [64, 224, 208],
violet: [238, 130, 238],
wheat: [245, 222, 179],
white: [255, 255, 255],
whitesmoke: [245, 245, 245],
yellow: [255, 255, 0],
yellowgreen: [154, 205, 50]
}, Fh = { exports: {} }, fm = function(t) {
return !t || typeof t == "string" ? !1 : t instanceof Array || Array.isArray(t) || t.length >= 0 && (t.splice instanceof Function || Object.getOwnPropertyDescriptor(t, t.length - 1) && t.constructor.name !== "String");
}, pm = fm, gm = Array.prototype.concat, mm = Array.prototype.slice, Lu = Fh.exports = function(t) {
for (var n = [], r = 0, i = t.length; r < i; r++) {
var o = t[r];
pm(o) ? n = gm.call(n, mm.call(o)) : n.push(o);
}
return n;
};
Lu.wrap = function(e) {
return function() {
return e(Lu(arguments));
};
};
var ym = Fh.exports, Or = Sh, Gr = ym, kh = Object.hasOwnProperty, Bh = /* @__PURE__ */ Object.create(null);
for (var Ma in Or)
kh.call(Or, Ma) && (Bh[Or[Ma]] = Ma);
var Et = Ch.exports = {
to: {},
get: {}
};
Et.get = function(e) {
var t = e.substring(0, 3).toLowerCase(), n, r;
switch (t) {
case "hsl":
n = Et.get.hsl(e), r = "hsl";
break;
case "hwb":
n = Et.get.hwb(e), r = "hwb";
break;
default:
n = Et.get.rgb(e), r = "rgb";
break;
}
return n ? { model: r, value: n } : null;
};
Et.get.rgb = function(e) {
if (!e)
return null;
var t = /^#([a-f0-9]{3,4})$/i, n = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i, r = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/, i = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/, o = /^(\w+)$/, s = [0, 0, 0, 1], a, c, d;
if (a = e.match(n)) {
for (d = a[2], a = a[1], c = 0; c < 3; c++) {
var y = c * 2;
s[c] = parseInt(a.slice(y, y + 2), 16);
}
d && (s[3] = parseInt(d, 16) / 255);
} else if (a = e.match(t)) {
for (a = a[1], d = a[3], c = 0; c < 3; c++)
s[c] = parseInt(a[c] + a[c], 16);
d && (s[3] = parseInt(d + d, 16) / 255);
} else if (a = e.match(r)) {
for (c = 0; c < 3; c++)
s[c] = parseInt(a[c + 1], 0);
a[4] && (a[5] ? s[3] = parseFloat(a[4]) * 0.01 : s[3] = parseFloat(a[4]));
} else if (a = e.match(i)) {
for (c = 0; c < 3; c++)
s[c] = Math.round(parseFloat(a[c + 1]) * 2.55);
a[4] && (a[5] ? s[3] = parseFloat(a[4]) * 0.01 : s[3] = parseFloat(a[4]));
} else
return (a = e.match(o)) ? a[1] === "transparent" ? [0, 0, 0, 0] : kh.call(Or, a[1]) ? (s = Or[a[1]], s[3] = 1, s) : null : null;
for (c = 0; c < 3; c++)
s[c] = bn(s[c], 0, 255);
return s[3] = bn(s[3], 0, 1), s;
};
Et.get.hsl = function(e) {
if (!e)
return null;
var t = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/, n = e.match(t);
if (n) {
var r = parseFloat(n[4]), i = (parseFloat(n[1]) % 360 + 360) % 360, o = bn(parseFloat(n[2]), 0, 100), s = bn(parseFloat(n[3]), 0, 100), a = bn(isNaN(r) ? 1 : r, 0, 1);
return [i, o, s, a];
}
return null;
};
Et.get.hwb = function(e) {
if (!e)
return null;
var t = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/, n = e.match(t);
if (n) {
var r = parseFloat(n[4]), i = (parseFloat(n[1]) % 360 + 360) % 360, o = bn(parseFloat(n[2]), 0, 100), s = bn(parseFloat(n[3]), 0, 100), a = bn(isNaN(r) ? 1 : r, 0, 1);
return [i, o, s, a];
}
return null;
};
Et.to.hex = function() {
var e = Gr(arguments);
return "#" + si(e[0]) + si(e[1]) + si(e[2]) + (e[3] < 1 ? si(Math.round(e[3] * 255)) : "");
};
Et.to.rgb = function() {
var e = Gr(arguments);
return e.length < 4 || e[3] === 1 ? "rgb(" + Math.round(e[0]) + ", " + Math.round(e[1]) + ", " + Math.round(e[2]) + ")" : "rgba(" + Math.round(e[0]) + ", " + Math.round(e[1]) + ", " + Math.round(e[2]) + ", " + e[3] + ")";
};
Et.to.rgb.percent = function() {
var e = Gr(arguments), t = Math.round(e[0] / 255 * 100), n = Math.round(e[1] / 255 * 100), r = Math.round(e[2] / 255 * 100);
return e.length < 4 || e[3] === 1 ? "rgb(" + t + "%, " + n + "%, " + r + "%)" : "rgba(" + t + "%, " + n + "%, " + r + "%, " + e[3] + ")";
};
Et.to.hsl = function() {
var e = Gr(arguments);
return e.length < 4 || e[3] === 1 ? "hsl(" + e[0] + ", " + e[1] + "%, " + e[2] + "%)" : "hsla(" + e[0] + ", " + e[1] + "%, " + e[2] + "%, " + e[3] + ")";
};
Et.to.hwb = function() {
var e = Gr(arguments), t = "";
return e.length >= 4 && e[3] !== 1 && (t = ", " + e[3]), "hwb(" + e[0] + ", " + e[1] + "%, " + e[2] + "%" + t + ")";
};
Et.to.keyword = function(e) {
return Bh[e.slice(0, 3)];
};
function bn(e, t, n) {
return Math.min(Math.max(t, e), n);
}
function si(e) {
var t = Math.round(e).toString(16).toUpperCase();
return t.length < 2 ? "0" + t : t;
}
var bm = Ch.exports;
const Wr = Sh, Ih = {};
for (const e of Object.keys(Wr))
Ih[Wr[e]] = e;
const Ae = {
rgb: { channels: 3, labels: "rgb" },
hsl: { channels: 3, labels: "hsl" },
hsv: { channels: 3, labels: "hsv" },
hwb: { channels: 3, labels: "hwb" },
cmyk: { channels: 4, labels: "cmyk" },
xyz: { channels: 3, labels: "xyz" },
lab: { channels: 3, labels: "lab" },
lch: { channels: 3, labels: "lch" },
hex: { channels: 1, labels: ["hex"] },
keyword: { channels: 1, labels: ["keyword"] },
ansi16: { channels: 1, labels: ["ansi16"] },
ansi256: { channels: 1, labels: ["ansi256"] },
hcg: { channels: 3, labels: ["h", "c", "g"] },
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
gray: { channels: 1, labels: ["gray"] }
};
var Rh = Ae;
for (const e of Object.keys(Ae)) {
if (!("channels" in Ae[e]))
throw new Error("missing channels property: " + e);
if (!("labels" in Ae[e]))
throw new Error("missing channel labels property: " + e);
if (Ae[e].labels.length !== Ae[e].channels)
throw new Error("channel and label counts mismatch: " + e);
const { channels: t, labels: n } = Ae[e];
delete Ae[e].channels, delete Ae[e].labels, Object.defineProperty(Ae[e], "channels", { value: t }), Object.defineProperty(Ae[e], "labels", { value: n });
}
Ae.rgb.hsl = function(e) {
const t = e[0] / 255, n = e[1] / 255, r = e[2] / 255, i = Math.min(t, n, r), o = Math.max(t, n, r), s = o - i;
let a, c;
o === i ? a = 0 : t === o ? a = (n - r) / s : n === o ? a = 2 + (r - t) / s : r === o && (a = 4 + (t - n) / s), a = Math.min(a * 60, 360), a < 0 && (a += 360);
const d = (i + o) / 2;
return o === i ? c = 0 : d <= 0.5 ? c = s / (o + i) : c = s / (2 - o - i), [a, c * 100, d * 100];
};
Ae.rgb.hsv = function(e) {
let t, n, r, i, o;
const s = e[0] / 255, a = e[1] / 255, c = e[2] / 255, d = Math.max(s, a, c), y = d - Math.min(s, a, c), w = function(x) {
return (d - x) / 6 / y + 1 / 2;
};
return y === 0 ? (i = 0, o = 0) : (o = y / d, t = w(s), n = w(a), r = w(c), s === d ? i = r - n : a === d ? i = 1 / 3 + t - r : c === d && (i = 2 / 3 + n - t), i < 0 ? i += 1 : i > 1 && (i -= 1)), [
i * 360,
o * 100,
d * 100
];
};
Ae.rgb.hwb = function(e) {
const t = e[0], n = e[1];
let r = e[2];
const i = Ae.rgb.hsl(e)[0], o = 1 / 255 * Math.min(t, Math.min(n, r));
return r = 1 - 1 / 255 * Math.max(t, Math.max(n, r)), [i, o * 100, r * 100];
};
Ae.rgb.cmyk = function(e) {
const t = e[0] / 255, n = e[1] / 255, r = e[2] / 255, i = Math.min(1 - t, 1 - n, 1 - r), o = (1 - t - i) / (1 - i) || 0, s = (1 - n - i) / (1 - i) || 0, a = (1 - r - i) / (1 - i) || 0;
return [o * 100, s * 100, a * 100, i * 100];
};
function vm(e, t) {
return (e[0] - t[0]) ** 2 + (e[1] - t[1]) ** 2 + (e[2] - t[2]) ** 2;
}
Ae.rgb.keyword = function(e) {
const t = Ih[e];
if (t)
return t;
let n = 1 / 0, r;
for (const i of Object.keys(Wr)) {
const o = Wr[i], s = vm(e, o);
s < n && (n = s, r = i);
}
return r;
};
Ae.keyword.rgb = function(e) {
return Wr[e];
};
Ae.rgb.xyz = function(e) {
let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255;
t = t > 0.04045 ? ((t + 0.055) / 1.055) ** 2.4 : t / 12.92, n = n > 0.04045 ? ((n + 0.055) / 1.055) ** 2.4 : n / 12.92, r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
const i = t * 0.4124 + n * 0.3576 + r * 0.1805, o = t * 0.2126 + n * 0.7152 + r * 0.0722, s = t * 0.0193 + n * 0.1192 + r * 0.9505;
return [i * 100, o * 100, s * 100];
};
Ae.rgb.lab = function(e) {
const t = Ae.rgb.xyz(e);
let n = t[0], r = t[1], i = t[2];
n /= 95.047, r /= 100, i /= 108.883, n = n > 8856e-6 ? n ** (1 / 3) : 7.787 * n + 16 / 116, r = r > 8856e-6 ? r ** (1 / 3) : 7.787 * r + 16 / 116, i = i > 8856e-6 ? i ** (1 / 3) : 7.787 * i + 16 / 116;
const o = 116 * r - 16, s = 500 * (n - r), a = 200 * (r - i);
return [o, s, a];
};
Ae.hsl.rgb = function(e) {
const t = e[0] / 360, n = e[1] / 100, r = e[2] / 100;
let i, o, s;
if (n === 0)
return s = r * 255, [s, s, s];
r < 0.5 ? i = r * (1 + n) : i = r + n - r * n;
const a = 2 * r - i, c = [0, 0, 0];
for (let d = 0; d < 3; d++)
o = t + 1 / 3 * -(d - 1), o < 0 && o++, o > 1 && o--, 6 * o < 1 ? s = a + (i - a) * 6 * o : 2 * o < 1 ? s = i : 3 * o < 2 ? s = a + (i - a) * (2 / 3 - o) * 6 : s = a, c[d] = s * 255;
return c;
};
Ae.hsl.hsv = function(e) {
const t = e[0];
let n = e[1] / 100, r = e[2] / 100, i = n;
const o = Math.max(r, 0.01);
r *= 2, n *= r <= 1 ? r : 2 - r, i *= o <= 1 ? o : 2 - o;
const s = (r + n) / 2, a = r === 0 ? 2 * i / (o + i) : 2 * n / (r + n);
return [t, a * 100, s * 100];
};
Ae.hsv.rgb = function(e) {
const t = e[0] / 60, n = e[1] / 100;
let r = e[2] / 100;
const i = Math.floor(t) % 6, o = t - Math.floor(t), s = 255 * r * (1 - n), a = 255 * r * (1 - n * o), c = 255 * r * (1 - n * (1 - o));
switch (r *= 255, i) {
case 0:
return [r, c, s];
case 1:
return [a, r, s];
case 2:
return [s, r, c];
case 3:
return [s, a, r];
case 4:
return [c, s, r];
case 5:
return [r, s, a];
}
};
Ae.hsv.hsl = function(e) {
const t = e[0], n = e[1] / 100, r = e[2] / 100, i = Math.max(r, 0.01);
let o, s;
s = (2 - n) * r;
const a = (2 - n) * i;
return o = n * i, o /= a <= 1 ? a : 2 - a, o = o || 0, s /= 2, [t, o * 100, s * 100];
};
Ae.hwb.rgb = function(e) {
const t = e[0] / 360;
let n = e[1] / 100, r = e[2] / 100;
const i = n + r;
let o;
i > 1 && (n /= i, r /= i);
const s = Math.floor(6 * t), a = 1 - r;
o = 6 * t - s, s & 1 && (o = 1 - o);
const c = n + o * (a - n);
let d, y, w;
switch (s) {
default:
case 6:
case 0:
d = a, y = c, w = n;
break;
case 1:
d = c, y = a, w = n;
break;
case 2:
d = n, y = a, w = c;
break;
case 3:
d = n, y = c, w = a;
break;
case 4:
d = c, y = n, w = a;
break;
case 5:
d = a, y = n, w = c;
break;
}
return [d * 255, y * 255, w * 255];
};
Ae.cmyk.rgb = function(e) {
const t = e[0] / 100, n = e[1] / 100, r = e[2] / 100, i = e[3] / 100, o = 1 - Math.min(1, t * (1 - i) + i), s = 1 - Math.min(1, n * (1 - i) + i), a = 1 - Math.min(1, r * (1 - i) + i);
return [o * 255, s * 255, a * 255];
};
Ae.xyz.rgb = function(e) {
const t = e[0] / 100, n = e[1] / 100, r = e[2] / 100;
let i, o, s;
return i = t * 3.2406 + n * -1.5372 + r * -0.4986, o = t * -0.9689 + n * 1.8758 + r * 0.0415, s = t * 0.0557 + n * -0.204 + r * 1.057, i = i > 31308e-7 ? 1.055 * i ** (1 / 2.4) - 0.055 : i * 12.92, o = o > 31308e-7 ? 1.055 * o ** (1 / 2.4) - 0.055 : o * 12.92, s = s > 31308e-7 ? 1.055 * s ** (1 / 2.4) - 0.055 : s * 12.92, i = Math.min(Math.max(0, i), 1), o = Math.min(Math.max(0, o), 1), s = Math.min(Math.max(0, s), 1), [i * 255, o * 255, s * 255];
};
Ae.xyz.lab = function(e) {
let t = e[0], n = e[1], r = e[2];
t /= 95.047, n /= 100, r /= 108.883, t = t > 8856e-6 ? t ** (1 / 3) : 7.787 * t + 16 / 116, n = n > 8856e-6 ? n ** (1 / 3) : 7.787 * n + 16 / 116, r = r > 8856e-6 ? r ** (1 / 3) : 7.787 * r + 16 / 116;
const i = 116 * n - 16, o = 500 * (t - n), s = 200 * (n - r);
return [i, o, s];
};
Ae.lab.xyz = function(e) {
const t = e[0], n = e[1], r = e[2];
let i, o, s;
o = (t + 16) / 116, i = n / 500 + o, s = o - r / 200;
const a = o ** 3, c = i ** 3, d = s ** 3;
return o = a > 8856e-6 ? a : (o - 16 / 116) / 7.787, i = c > 8856e-6 ? c : (i - 16 / 116) / 7.787, s = d > 8856e-6 ? d : (s - 16 / 116) / 7.787, i *= 95.047, o *= 100, s *= 108.883, [i, o, s];
};
Ae.lab.lch = function(e) {
const t = e[0], n = e[1], r = e[2];
let i;
i = Math.atan2(r, n) * 360 / 2 / Math.PI, i < 0 && (i += 360);
const s = Math.sqrt(n * n + r * r);
return [t, s, i];
};
Ae.lch.lab = function(e) {
const t = e[0], n = e[1], i = e[2] / 360 * 2 * Math.PI, o = n * Math.cos(i), s = n * Math.sin(i);
return [t, o, s];
};
Ae.rgb.ansi16 = function(e, t = null) {
const [n, r, i] = e;
let o = t === null ? Ae.rgb.hsv(e)[2] : t;
if (o = Math.round(o / 50), o === 0)
return 30;
let s = 30 + (Math.round(i / 255) << 2 | Math.round(r / 255) << 1 | Math.round(n / 255));
return o === 2 && (s += 60), s;
};
Ae.hsv.ansi16 = function(e) {
return Ae.rgb.ansi16(Ae.hsv.rgb(e), e[2]);
};
Ae.rgb.ansi256 = function(e) {
const t = e[0], n = e[1], r = e[2];
return t === n && n === r ? t < 8 ? 16 : t > 248 ? 231 : Math.round((t - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(t / 255 * 5) + 6 * Math.round(n / 255 * 5) + Math.round(r / 255 * 5);
};
Ae.ansi16.rgb = function(e) {
let t = e % 10;
if (t === 0 || t === 7)
return e > 50 && (t += 3.5), t = t / 10.5 * 255, [t, t, t];
const n = (~~(e > 50) + 1) * 0.5, r = (t & 1) * n * 255, i = (t >> 1 & 1) * n * 255, o = (t >> 2 & 1) * n * 255;
return [r, i, o];
};
Ae.ansi256.rgb = function(e) {
if (e >= 232) {
const o = (e - 232) * 10 + 8;
return [o, o, o];
}
e -= 16;
let t;
const n = Math.floor(e / 36) / 5 * 255, r = Math.floor((t = e % 36) / 6) / 5 * 255, i = t % 6 / 5 * 255;
return [n, r, i];
};
Ae.rgb.hex = function(e) {
const n = (((Math.round(e[0]) & 255) << 16) + ((Math.round(e[1]) & 255) << 8) + (Math.round(e[2]) & 255)).toString(16).toUpperCase();
return "000000".substring(n.length) + n;
};
Ae.hex.rgb = function(e) {
const t = e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
if (!t)
return [0, 0, 0];
let n = t[0];
t[0].length === 3 && (n = n.split("").map((a) => a + a).join(""));
const r = parseInt(n, 16), i = r >> 16 & 255, o = r >> 8 & 255, s = r & 255;
return [i, o, s];
};
Ae.rgb.hcg = function(e) {
const t = e[0] / 255, n = e[1] / 255, r = e[2] / 255, i = Math.max(Math.max(t, n), r), o = Math.min(Math.min(t, n), r), s = i - o;
let a, c;
return s < 1 ? a = o / (1 - s) : a = 0, s <= 0 ? c = 0 : i === t ? c = (n - r) / s % 6 : i === n ? c = 2 + (r - t) / s : c = 4 + (t - n) / s, c /= 6, c %= 1, [c * 360, s * 100, a * 100];
};
Ae.hsl.hcg = function(e) {
const t = e[1] / 100, n = e[2] / 100, r = n < 0.5 ? 2 * t * n : 2 * t * (1 - n);
let i = 0;
return r < 1 && (i = (n - 0.5 * r) / (1 - r)), [e[0], r * 100, i * 100];
};
Ae.hsv.hcg = function(e) {
const t = e[1] / 100, n = e[2] / 100, r = t * n;
let i = 0;
return r < 1 && (i = (n - r) / (1 - r)), [e[0], r * 100, i * 100];
};
Ae.hcg.rgb = function(e) {
const t = e[0] / 360, n = e[1] / 100, r = e[2] / 100;
if (n === 0)
return [r * 255, r * 255, r * 255];
const i = [0, 0, 0], o = t % 1 * 6, s = o % 1, a = 1 - s;
let c = 0;
switch (Math.floor(o)) {
case 0:
i[0] = 1, i[1] = s, i[2] = 0;
break;
case 1:
i[0] = a, i[1] = 1, i[2] = 0;
break;
case 2:
i[0] = 0, i[1] = 1, i[2] = s;
break;
case 3:
i[0] = 0, i[1] = a, i[2] = 1;
break;
case 4:
i[0] = s, i[1] = 0, i[2] = 1;
break;
default:
i[0] = 1, i[1] = 0, i[2] = a;
}
return c = (1 - n) * r, [
(n * i[0] + c) * 255,
(n * i[1] + c) * 255,
(n * i[2] + c) * 255
];
};
Ae.hcg.hsv = function(e) {
const t = e[1] / 100, n = e[2] / 100, r = t + n * (1 - t);
let i = 0;
return r > 0 && (i = t / r), [e[0], i * 100, r * 100];
};
Ae.hcg.hsl = function(e) {
const t = e[1] / 100, r = e[2] / 100 * (1 - t) + 0.5 * t;
let i = 0;
return r > 0 && r < 0.5 ? i = t / (2 * r) : r >= 0.5 && r < 1 && (i = t / (2 * (1 - r))), [e[0], i * 100, r * 100];
};
Ae.hcg.hwb = function(e) {
const t = e[1] / 100, n = e[2] / 100, r = t + n * (1 - t);
return [e[0], (r - t) * 100, (1 - r) * 100];
};
Ae.hwb.hcg = function(e) {
const t = e[1] / 100, r = 1 - e[2] / 100, i = r - t;
let o = 0;
return i < 1 && (o = (r - i) / (1 - i)), [e[0], i * 100, o * 100];
};
Ae.apple.rgb = function(e) {
return [e[0] / 65535 * 255, e[1] / 65535 * 255, e[2] / 65535 * 255];
};
Ae.rgb.apple = function(e) {
return [e[0] / 255 * 65535, e[1] / 255 * 65535, e[2] / 255 * 65535];
};
Ae.gray.rgb = function(e) {
return [e[0] / 100 * 255, e[0] / 100 * 255, e[0] / 100 * 255];
};
Ae.gray.hsl = function(e) {
return [0, 0, e[0]];
};
Ae.gray.hsv = Ae.gray.hsl;
Ae.gray.hwb = function(e) {
return [0, 100, e[0]];
};
Ae.gray.cmyk = function(e) {
return [0, 0, 0, e[0]];
};
Ae.gray.lab = function(e) {
return [e[0], 0, 0];
};
Ae.gray.hex = function(e) {
const t = Math.round(e[0] / 100 * 255) & 255, r = ((t << 16) + (t << 8) + t).toString(16).toUpperCase();
return "000000".substring(r.length) + r;
};
Ae.rgb.gray = function(e) {
return [(e[0] + e[1] + e[2]) / 3 / 255 * 100];
};
const Ui = Rh;
function wm() {
const e = {}, t = Object.keys(Ui);
for (let n = t.length, r = 0; r < n; r++)
e[t[r]] = {
// http://jsperf.com/1-vs-infinity
// micro-opt, but this is simple.
distance: -1,
parent: null
};
return e;
}
function xm(e) {
const t = wm(), n = [e];
for (t[e].distance = 0; n.length; ) {
const r = n.pop(), i = Object.keys(Ui[r]);
for (let o = i.length, s = 0; s < o; s++) {
const a = i[s], c = t[a];
c.distance === -1 && (c.distance = t[r].distance + 1, c.parent = r, n.unshift(a));
}
}
return t;
}
function Dm(e, t) {
return function(n) {
return t(e(n));
};
}
function _m(e, t) {
const n = [t[e].parent, e];
let r = Ui[t[e].parent][e], i = t[e].parent;
for (; t[i].parent; )
n.unshift(t[i].parent), r = Dm(Ui[t[i].parent][i], r), i = t[i].parent;
return r.conversion = n, r;
}
var Tm = function(e) {
const t = xm(e), n = {}, r = Object.keys(t);
for (let i = r.length, o = 0; o < i; o++) {
const s = r[o];
t[s].parent !== null && (n[s] = _m(s, t));
}
return n;
};
const qs = Rh, Em = Tm, Qn = {}, Am = Object.keys(qs);
function Um(e) {
const t = function(...n) {
const r = n[0];
return r == null ? r : (r.length > 1 && (n = r), e(n));
};
return "conversion" in e && (t.conversion = e.conversion), t;
}
function Cm(e) {
const t = function(...n) {
const r = n[0];
if (r == null)
return r;
r.length > 1 && (n = r);
const i = e(n);
if (typeof i == "object")
for (let o = i.length, s = 0; s < o; s++)
i[s] = Math.round(i[s]);
return i;
};
return "conversion" in e && (t.conversion = e.conversion), t;
}
Am.forEach((e) => {
Qn[e] = {}, Object.defineProperty(Qn[e], "channels", { value: qs[e].channels }), Object.defineProperty(Qn[e], "labels", { value: qs[e].labels });
const t = Em(e);
Object.keys(t).forEach((r) => {
const i = t[r];
Qn[e][r] = Cm(i), Qn[e][r].raw = Um(i);
});
});
var Sm = Qn;
const er = bm, Tt = Sm, Nh = [
// To be honest, I don't really feel like keyword belongs in color convert, but eh.
"keyword",
// Gray conflicts with some method names, and has its own method defined.
"gray",
// Shouldn't really be in color-convert either...
"hex"
], Hs = {};
for (const e of Object.keys(Tt))
Hs[[...Tt[e].labels].sort().join("")] = e;
const Ci = {};
function tt(e, t) {
if (!(this instanceof tt))
return new tt(e, t);
if (t && t in Nh && (t = null), t && !(t in Tt))
throw new Error("Unknown model: " + t);
let n, r;
if (e == null)
this.model = "rgb", this.color = [0, 0, 0], this.valpha = 1;
else if (e instanceof tt)
this.model = e.model, this.color = [...e.color], this.valpha = e.valpha;
else if (typeof e == "string") {
const i = er.get(e);
if (i === null)
throw new Error("Unable to parse color from string: " + e);
this.model = i.model, r = Tt[this.model].channels, this.color = i.value.slice(0, r), this.valpha = typeof i.value[r] == "number" ? i.value[r] : 1;
} else if (e.length > 0) {
this.model = t || "rgb", r = Tt[this.model].channels;
const i = Array.prototype.slice.call(e, 0, r);
this.color = Gs(i, r), this.valpha = typeof e[r] == "number" ? e[r] : 1;
} else if (typeof e == "number")
this.model = "rgb", this.color = [
e >> 16 & 255,
e >> 8 & 255,
e & 255
], this.valpha = 1;
else {
this.valpha = 1;
const i = Object.keys(e);
"alpha" in e && (i.splice(i.indexOf("alpha"), 1), this.valpha = typeof e.alpha == "number" ? e.alpha : 0);
const o = i.sort().join("");
if (!(o in Hs))
throw new Error("Unable to parse color from object: " + JSON.stringify(e));
this.model = Hs[o];
const { labels: s } = Tt[this.model], a = [];
for (n = 0; n < s.length; n++)
a.push(e[s[n]]);
this.color = Gs(a);
}
if (Ci[this.model])
for (r = Tt[this.model].channels, n = 0; n < r; n++) {
const i = Ci[this.model][n];
i && (this.color[n] = i(this.color[n]));
}
this.valpha = Math.max(0, Math.min(1, this.valpha)), Object.freeze && Object.freeze(this);
}
tt.prototype = {
toString() {
return this.string();
},
toJSON() {
return this[this.model]();
},
string(e) {
let t = this.model in er.to ? this : this.rgb();
t = t.round(typeof e == "number" ? e : 1);
const n = t.valpha === 1 ? t.color : [...t.color, this.valpha];
return er.to[t.model](n);
},
percentString(e) {
const t = this.rgb().round(typeof e == "number" ? e : 1), n = t.valpha === 1 ? t.color : [...t.color, this.valpha];
return er.to.rgb.percent(n);
},
array() {
return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
},
object() {
const e = {}, { channels: t } = Tt[this.model], { labels: n } = Tt[this.model];
for (let r = 0; r < t; r++)
e[n[r]] = this.color[r];
return this.valpha !== 1 && (e.alpha = this.valpha), e;
},
unitArray() {
const e = this.rgb().color;
return e[0] /= 255, e[1] /= 255, e[2] /= 255, this.valpha !== 1 && e.push(this.valpha), e;
},
unitObject() {
const e = this.rgb().object();
return e.r /= 255, e.g /= 255, e.b /= 255, this.valpha !== 1 && (e.alpha = this.valpha), e;
},
round(e) {
return e = Math.max(e || 0, 0), new tt([...this.color.map(km(e)), this.valpha], this.model);
},
alpha(e) {
return e !== void 0 ? new tt([...this.color, Math.max(0, Math.min(1, e))], this.model) : this.valpha;
},
// Rgb
red: Ve("rgb", 0, Qe(255)),
green: Ve("rgb", 1, Qe(255)),
blue: Ve("rgb", 2, Qe(255)),
hue: Ve(["hsl", "hsv", "hsl", "hwb", "hcg"], 0, (e) => (e % 360 + 360) % 360),
saturationl: Ve("hsl", 1, Qe(100)),
lightness: Ve("hsl", 2, Qe(100)),
saturationv: Ve("hsv", 1, Qe(100)),
value: Ve("hsv", 2, Qe(100)),
chroma: Ve("hcg", 1, Qe(100)),
gray: Ve("hcg", 2, Qe(100)),
white: Ve("hwb", 1, Qe(100)),
wblack: Ve("hwb", 2, Qe(100)),
cyan: Ve("cmyk", 0, Qe(100)),
magenta: Ve("cmyk", 1, Qe(100)),
yellow: Ve("cmyk", 2, Qe(100)),
black: Ve("cmyk", 3, Qe(100)),
x: Ve("xyz", 0, Qe(95.047)),
y: Ve("xyz", 1, Qe(100)),
z: Ve("xyz", 2, Qe(108.833)),
l: Ve("lab", 0, Qe(100)),
a: Ve("lab", 1),
b: Ve("lab", 2),
keyword(e) {
return e !== void 0 ? new tt(e) : Tt[this.model].keyword(this.color);
},
hex(e) {
return e !== void 0 ? new tt(e) : er.to.hex(this.rgb().round().color);
},
hexa(e) {
if (e !== void 0)
return new tt(e);
const t = this.rgb().round().color;
let n = Math.round(this.valpha * 255).toString(16).toUpperCase();
return n.length === 1 && (n = "0" + n), er.to.hex(t) + n;
},
rgbNumber() {
const e = this.rgb().color;
return (e[0] & 255) << 16 | (e[1] & 255) << 8 | e[2] & 255;
},
luminosity() {
const e = this.rgb().color, t = [];
for (const [n, r] of e.entries()) {
const i = r / 255;
t[n] = i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
}
return 0.2126 * t[0] + 0.7152 * t[1] + 0.0722 * t[2];
},
contrast(e) {
const t = this.luminosity(), n = e.luminosity();
return t > n ? (t + 0.05) / (n + 0.05) : (n + 0.05) / (t + 0.05);
},
level(e) {
const t = this.contrast(e);
return t >= 7 ? "AAA" : t >= 4.5 ? "AA" : "";
},
isDark() {
const e = this.rgb().color;
return (e[0] * 2126 + e[1] * 7152 + e[2] * 722) / 1e4 < 128;
},
isLight() {
return !this.isDark();
},
negate() {
const e = this.rgb();
for (let t = 0; t < 3; t++)
e.color[t] = 255 - e.color[t];
return e;
},
lighten(e) {
const t = this.hsl();
return t.color[2] += t.color[2] * e, t;
},
darken(e) {
const t = this.hsl();
return t.color[2] -= t.color[2] * e, t;
},
saturate(e) {
const t = this.hsl();
return t.color[1] += t.color[1] * e, t;
},
desaturate(e) {
const t = this.hsl();
return t.color[1] -= t.color[1] * e, t;
},
whiten(e) {
const t = this.hwb();
return t.color[1] += t.color[1] * e, t;
},
blacken(e) {
const t = this.hwb();
return t.color[2] += t.color[2] * e, t;
},
grayscale() {
const e = this.rgb().color, t = e[0] * 0.3 + e[1] * 0.59 + e[2] * 0.11;
return tt.rgb(t, t, t);
},
fade(e) {
return this.alpha(this.valpha - this.valpha * e);
},
opaquer(e) {
return this.alpha(this.valpha + this.valpha * e);
},
rotate(e) {
const t = this.hsl();
let n = t.color[0];
return n = (n + e) % 360, n = n < 0 ? 360 + n : n, t.color[0] = n, t;
},
mix(e, t) {
if (!e || !e.rgb)
throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof e);
const n = e.rgb(), r = this.rgb(), i = t === void 0 ? 0.5 : t, o = 2 * i - 1, s = n.alpha() - r.alpha(), a = ((o * s === -1 ? o : (o + s) / (1 + o * s)) + 1) / 2, c = 1 - a;
return tt.rgb(
a * n.red() + c * r.red(),
a * n.green() + c * r.green(),
a * n.blue() + c * r.blue(),
n.alpha() * i + r.alpha() * (1 - i)
);
}
};
for (const e of Object.keys(Tt)) {
if (Nh.includes(e))
continue;
const { channels: t } = Tt[e];
tt.prototype[e] = function(...n) {
return this.model === e ? new tt(this) : n.length > 0 ? new tt(n, e) : new tt([...Bm(Tt[this.model][e].raw(this.color)), this.valpha], e);
}, tt[e] = function(...n) {
let r = n[0];
return typeof r == "number" && (r = Gs(n, t)), new tt(r, e);
};
}
function Fm(e, t) {
return Number(e.toFixed(t));
}
function km(e) {
return function(t) {
return Fm(t, e);
};
}
function Ve(e, t, n) {
e = Array.isArray(e) ? e : [e];
for (const r of e)
(Ci[r] || (Ci[r] = []))[t] = n;
return e = e[0], function(r) {
let i;
return r !== void 0 ? (n && (r = n(r)), i = this[e](), i.color[t] = r, i) : (i = this[e]().color[t], n && (i = n(i)), i);
};
}
function Qe(e) {
return function(t) {
return Math.max(0, Math.min(e, t));
};
}
function Bm(e) {
return Array.isArray(e) ? e : [e];
}
function Gs(e, t) {
for (let n = 0; n < t; n++)
typeof e[n] != "number" && (e[n] = 0);
return e;
}
var Im = tt;
const Pu = /* @__PURE__ */ dm(Im);
var Rm = Object.defineProperty, Nm = (e, t, n) => t in e ? Rm(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, me = (e, t, n) => (Nm(e, typeof t != "symbol" ? t + "" : t, n), n);
class Si {
constructor(t) {
me(this, "rootKey"), this.rootKey = t;
}
}
const Om = Object.seal({});
class ge extends Si {
constructor(t) {
super(t), me(this, "root"), this.root = new Array();
}
// This method is called by the formatter to get the XML representation of this component.
// It is called recursively for all child components.
// It is a serializer to be used in the xml library.
// https://www.npmjs.com/package/xml
// Child components can override this method to customize the XML representation, or execute side effects.
prepForXml(t) {
var n;
t.stack.push(this);
const r = this.root.map((i) => i instanceof Si ? i.prepForXml(t) : i).filter((i) => i !== void 0);
return t.stack.pop(), {
[this.rootKey]: r.length ? r.length === 1 && ((n = r[0]) != null && n._attr) ? r[0] : r : Om
};
}
addChildElement(t) {
return this.root.push(t), this;
}
}
class hn extends ge {
prepForXml(t) {
const n = super.prepForXml(t);
if (n && (typeof n[this.rootKey] != "object" || Object.keys(n[this.rootKey]).length))
return n;
}
}
class Te extends Si {
constructor(t) {
super("_attr"), me(this, "xmlKeys"), this.root = t;
}
prepForXml(t) {
const n = {};
return Object.keys(this.root).forEach((r) => {
const i = this.root[r];
if (i !== void 0) {
const o = this.xmlKeys && this.xmlKeys[r] || r;
n[o] = i;
}
}), { _attr: n };
}
}
class Jt extends Si {
constructor(t) {
super("_attr"), this.root = t;
}
prepForXml(t) {
return { _attr: Object.values(this.root).filter(({ value: r }) => r !== void 0).reduce((r, { key: i, value: o }) => ({ ...r, [i]: o }), {}) };
}
}
class Xe extends Te {
constructor() {
super(...arguments), me(this, "xmlKeys", {
val: "w:val",
color: "w:color",
fill: "w:fill",
space: "w:space",
sz: "w:sz",
type: "w:type",
rsidR: "w:rsidR",
rsidRPr: "w:rsidRPr",
rsidSect: "w:rsidSect",
w: "w:w",
h: "w:h",
top: "w:top",
right: "w:right",
bottom: "w:bottom",
left: "w:left",
header: "w:header",
footer: "w:footer",
gutter: "w:gutter",
linePitch: "w:linePitch",
pos: "w:pos"
});
}
}
var Lt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function oc(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var Oh = {}, sc = { exports: {} }, nr = typeof Reflect == "object" ? Reflect : null, Mu = nr && typeof nr.apply == "function" ? nr.apply : function(t, n, r) {
return Function.prototype.apply.call(t, n, r);
}, xi;
nr && typeof nr.ownKeys == "function" ? xi = nr.ownKeys : Object.getOwnPropertySymbols ? xi = function(t) {
return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t));
} : xi = function(t) {
return Object.getOwnPropertyNames(t);
};
function Wm(e) {
console && console.warn && console.warn(e);
}
var Wh = Number.isNaN || function(t) {
return t !== t;
};
function je() {
je.init.call(this);
}
sc.exports = je;
sc.exports.once = jm;
je.EventEmitter = je;
je.prototype._events = void 0;
je.prototype._eventsCount = 0;
je.prototype._maxListeners = void 0;
var ju = 10;
function Mi(e) {
if (typeof e != "function")
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof e);
}
Object.defineProperty(je, "defaultMaxListeners", {
enumerable: !0,
get: function() {
return ju;
},
set: function(e) {
if (typeof e != "number" || e < 0 || Wh(e))
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + e + ".");
ju = e;
}
});
je.init = function() {
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
};
je.prototype.setMaxListeners = function(t) {
if (typeof t != "number" || t < 0 || Wh(t))
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + t + ".");
return this._maxListeners = t, this;
};
function Lh(e) {
return e._maxListeners === void 0 ? je.defaultMaxListeners : e._maxListeners;
}
je.prototype.getMaxListeners = function() {
return Lh(this);
};
je.prototype.emit = function(t) {
for (var n = [], r = 1; r < arguments.length; r++)
n.push(arguments[r]);
var i = t === "error", o = this._events;
if (o !== void 0)
i = i && o.error === void 0;
else if (!i)
return !1;
if (i) {
var s;
if (n.length > 0 && (s = n[0]), s instanceof Error)
throw s;
var a = new Error("Unhandled error." + (s ? " (" + s.message + ")" : ""));
throw a.context = s, a;
}
var c = o[t];
if (c === void 0)
return !1;
if (typeof c == "function")
Mu(c, this, n);
else
for (var d = c.length, y = qh(c, d), r = 0; r < d; ++r)
Mu(y[r], this, n);
return !0;
};
function Ph(e, t, n, r) {
var i, o, s;
if (Mi(n), o = e._events, o === void 0 ? (o = e._events = /* @__PURE__ */ Object.create(null), e._eventsCount = 0) : (o.newListener !== void 0 && (e.emit(
"newListener",
t,
n.listener ? n.listener : n
), o = e._events), s = o[t]), s === void 0)
s = o[t] = n, ++e._eventsCount;
else if (typeof s == "function" ? s = o[t] = r ? [n, s] : [s, n] : r ? s.unshift(n) : s.push(n), i = Lh(e), i > 0 && s.length > i && !s.warned) {
s.warned = !0;
var a = new Error("Possible EventEmitter memory leak detected. " + s.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit");
a.name = "MaxListenersExceededWarning", a.emitter = e, a.type = t, a.count = s.length, Wm(a);
}
return e;
}
je.prototype.addListener = function(t, n) {
return Ph(this, t, n, !1);
};
je.prototype.on = je.prototype.addListener;
je.prototype.prependListener = function(t, n) {
return Ph(this, t, n, !0);
};
function Lm() {
if (!this.fired)
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
}
function Mh(e, t, n) {
var r = { fired: !1, wrapFn: void 0, target: e, type: t, listener: n }, i = Lm.bind(r);
return i.listener = n, r.wrapFn = i, i;
}
je.prototype.once = function(t, n) {
return Mi(n), this.on(t, Mh(this, t, n)), this;
};
je.prototype.prependOnceListener = function(t, n) {
return Mi(n), this.prependListener(t, Mh(this, t, n)), this;
};
je.prototype.removeListener = function(t, n) {
var r, i, o, s, a;
if (Mi(n), i = this._events, i === void 0)
return this;
if (r = i[t], r === void 0)
return this;
if (r === n || r.listener === n)
--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete i[t], i.removeListener && this.emit("removeListener", t, r.listener || n));
else if (typeof r != "function") {
for (o = -1, s = r.length - 1; s >= 0; s--)
if (r[s] === n || r[s].listener === n) {
a = r[s].listener, o = s;
break;
}
if (o < 0)
return this;
o === 0 ? r.shift() : Pm(r, o), r.length === 1 && (i[t] = r[0]), i.removeListener !== void 0 && this.emit("removeListener", t, a || n);
}
return this;
};
je.prototype.off = je.prototype.removeListener;
je.prototype.removeAllListeners = function(t) {
var n, r, i;
if (r = this._events, r === void 0)
return this;
if (r.removeListener === void 0)
return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : r[t] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete r[t]), this;
if (arguments.length === 0) {
var o = Object.keys(r), s;
for (i = 0; i < o.length; ++i)
s = o[i], s !== "removeListener" && this.removeAllListeners(s);
return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
}
if (n = r[t], typeof n == "function")
this.removeListener(t, n);
else if (n !== void 0)
for (i = n.length - 1; i >= 0; i--)
this.removeListener(t, n[i]);
return this;
};
function jh(e, t, n) {
var r = e._events;
if (r === void 0)
return [];
var i = r[t];
return i === void 0 ? [] : typeof i == "function" ? n ? [i.listener || i] : [i] : n ? Mm(i) : qh(i, i.length);
}
je.prototype.listeners = function(t) {
return jh(this, t, !0);
};
je.prototype.rawListeners = function(t) {
return jh(this, t, !1);
};
je.listenerCount = function(e, t) {
return typeof e.listenerCount == "function" ? e.listenerCount(t) : zh.call(e, t);
};
je.prototype.listenerCount = zh;
function zh(e) {
var t = this._events;
if (t !== void 0) {
var n = t[e];
if (typeof n == "function")
return 1;
if (n !== void 0)
return n.length;
}
return 0;
}
je.prototype.eventNames = function() {
return this._eventsCount > 0 ? xi(this._events) : [];
};
function qh(e, t) {
for (var n = new Array(t), r = 0; r < t; ++r)
n[r] = e[r];
return n;
}
function Pm(e, t) {
for (; t + 1 < e.length; t++)
e[t] = e[t + 1];
e.pop();
}
function Mm(e) {
for (var t = new Array(e.length), n = 0; n < t.length; ++n)
t[n] = e[n].listener || e[n];
return t;
}
function jm(e, t) {
return new Promise(function(n, r) {
function i(s) {
e.removeListener(t, o), r(s);
}
function o() {
typeof e.removeListener == "function" && e.removeListener("error", i), n([].slice.call(arguments));
}
Hh(e, t, o, { once: !0 }), t !== "error" && zm(e, i, { once: !0 });
});
}
function zm(e, t, n) {
typeof e.on == "function" && Hh(e, "error", t, n);
}
function Hh(e, t, n, r) {
if (typeof e.on == "function")
r.once ? e.once(t, n) : e.on(t, n);
else if (typeof e.addEventListener == "function")
e.addEventListener(t, function i(o) {
r.once && e.removeEventListener(t, i), n(o);
});
else
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof e);
}
var cc = sc.exports, Vs = { exports: {} };
typeof Object.create == "function" ? Vs.exports = function(t, n) {
n && (t.super_ = n, t.prototype = Object.create(n.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}));
} : Vs.exports = function(t, n) {
if (n) {
t.super_ = n;
var r = function() {
};
r.prototype = n.prototype, t.prototype = new r(), t.prototype.constructor = t;
}
};
var Mn = Vs.exports, ja = {}, Ur = {}, zu;
function qm() {
if (zu)
return Ur;
zu = 1, Ur.byteLength = a, Ur.toByteArray = d, Ur.fromByteArray = x;
for (var e = [], t = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i = 0, o = r.length; i < o; ++i)
e[i] = r[i], t[r.charCodeAt(i)] = i;
t["-".charCodeAt(0)] = 62, t["_".charCodeAt(0)] = 63;
function s(h) {
var v = h.length;
if (v % 4 > 0)
throw new Error("Invalid string. Length must be a multiple of 4");
var u = h.indexOf("=");
u === -1 && (u = v);
var m = u === v ? 0 : 4 - u % 4;
return [u, m];
}
function a(h) {
var v = s(h), u = v[0], m = v[1];
return (u + m) * 3 / 4 - m;
}
function c(h, v, u) {
return (v + u) * 3 / 4 - u;
}
function d(h) {
var v, u = s(h), m = u[0], l = u[1], g = new n(c(h, m, l)), _ = 0, E = l > 0 ? m - 4 : m, U;
for (U = 0; U < E; U += 4)
v = t[h.charCodeAt(U)] << 18 | t[h.charCodeAt(U + 1)] << 12 | t[h.charCodeAt(U + 2)] << 6 | t[h.charCodeAt(U + 3)], g[_++] = v >> 16 & 255, g[_++] = v >> 8 & 255, g[_++] = v & 255;
return l === 2 && (v = t[h.charCodeAt(U)] << 2 | t[h.charCodeAt(U + 1)] >> 4, g[_++] = v & 255), l === 1 && (v = t[h.charCodeAt(U)] << 10 | t[h.charCodeAt(U + 1)] << 4 | t[h.charCodeAt(U + 2)] >> 2, g[_++] = v >> 8 & 255, g[_++] = v & 255), g;
}
function y(h) {
return e[h >> 18 & 63] + e[h >> 12 & 63] + e[h >> 6 & 63] + e[h & 63];
}
function w(h, v, u) {
for (var m, l = [], g = v; g < u; g += 3)
m = (h[g] << 16 & 16711680) + (h[g + 1] << 8 & 65280) + (h[g + 2] & 255), l.push(y(m));
return l.join("");
}
function x(h) {
for (var v, u = h.length, m = u % 3, l = [], g = 16383, _ = 0, E = u - m; _ < E; _ += g)
l.push(w(h, _, _ + g > E ? E : _ + g));
return m === 1 ? (v = h[u - 1], l.push(
e[v >> 2] + e[v << 4 & 63] + "=="
)) : m === 2 && (v = (h[u - 2] << 8) + h[u - 1], l.push(
e[v >> 10] + e[v >> 4 & 63] + e[v << 2 & 63] + "="
)), l.join("");
}
return Ur;
}
var ci = {};
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
var qu;
function Hm() {
return qu || (qu = 1, ci.read = function(e, t, n, r, i) {
var o, s, a = i * 8 - r - 1, c = (1 << a) - 1, d = c >> 1, y = -7, w = n ? i - 1 : 0, x = n ? -1 : 1, h = e[t + w];
for (w += x, o = h & (1 << -y) - 1, h >>= -y, y += a; y > 0; o = o * 256 + e[t + w], w += x, y -= 8)
;
for (s = o & (1 << -y) - 1, o >>= -y, y += r; y > 0; s = s * 256 + e[t + w], w += x, y -= 8)
;
if (o === 0)
o = 1 - d;
else {
if (o === c)
return s ? NaN : (h ? -1 : 1) * (1 / 0);
s = s + Math.pow(2, r), o = o - d;
}
return (h ? -1 : 1) * s * Math.pow(2, o - r);
}, ci.write = function(e, t, n, r, i, o) {
var s, a, c, d = o * 8 - i - 1, y = (1 << d) - 1, w = y >> 1, x = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, h = r ? 0 : o - 1, v = r ? 1 : -1, u = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (a = isNaN(t) ? 1 : 0, s = y) : (s = Math.floor(Math.log(t) / Math.LN2), t * (c = Math.pow(2, -s)) < 1 && (s--, c *= 2), s + w >= 1 ? t += x / c : t += x * Math.pow(2, 1 - w), t * c >= 2 && (s++, c /= 2), s + w >= y ? (a = 0, s = y) : s + w >= 1 ? (a = (t * c - 1) * Math.pow(2, i), s = s + w) : (a = t * Math.pow(2, w - 1) * Math.pow(2, i), s = 0)); i >= 8; e[n + h] = a & 255, h += v, a /= 256, i -= 8)
;
for (s = s << i | a, d += i; d > 0; e[n + h] = s & 255, h += v, s /= 256, d -= 8)
;
e[n + h - v] |= u * 128;
}), ci;
}
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
var Hu;
function Vr() {
return Hu || (Hu = 1, function(e) {
var t = qm(), n = Hm(), r = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
e.Buffer = a, e.SlowBuffer = g, e.INSPECT_MAX_BYTES = 50;
var i = 2147483647;
e.kMaxLength = i, a.TYPED_ARRAY_SUPPORT = o(), !a.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
);
function o() {
try {
var S = new Uint8Array(1), f = { foo: function() {
return 42;
} };
return Object.setPrototypeOf(f, Uint8Array.prototype), Object.setPrototypeOf(S, f), S.foo() === 42;
} catch {
return !1;
}
}
Object.defineProperty(a.prototype, "parent", {
enumerable: !0,
get: function() {
if (a.isBuffer(this))
return this.buffer;
}
}), Object.defineProperty(a.prototype, "offset", {
enumerable: !0,
get: function() {
if (a.isBuffer(this))
return this.byteOffset;
}
});
function s(S) {
if (S > i)
throw new RangeError('The value "' + S + '" is invalid for option "size"');
var f = new Uint8Array(S);
return Object.setPrototypeOf(f, a.prototype), f;
}
function a(S, f, p) {
if (typeof S == "number") {
if (typeof f == "string")
throw new TypeError(
'The "string" argument must be of type string. Received type number'
);
return w(S);
}
return c(S, f, p);
}
a.poolSize = 8192;
function c(S, f, p) {
if (typeof S == "string")
return x(S, f);
if (ArrayBuffer.isView(S))
return v(S);
if (S == null)
throw new TypeError(
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof S
);
if (he(S, ArrayBuffer) || S && he(S.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (he(S, SharedArrayBuffer) || S && he(S.buffer, SharedArrayBuffer)))
return u(S, f, p);
if (typeof S == "number")
throw new TypeError(