quick-excel-json
Version:
Convert Excel (.xlsx, .xls, .csv) files to JSON easily. Fast, lightweight, and perfect for React, Node.js, and web applications. Supports SheetJS and ExcelJS and a simple npm package to convert JSON data to an Excel (.xlsx, .xls) file using SheetJS (xlsx)
1,431 lines • 670 kB
JavaScript
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
var i0 = {};
i0.version = "0.18.5";
var ns = 1252, Dc = [874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1e4], tn = {
/*::[*/
0: 1252,
/* ANSI */
/*::[*/
1: 65001,
/* DEFAULT */
/*::[*/
2: 65001,
/* SYMBOL */
/*::[*/
77: 1e4,
/* MAC */
/*::[*/
128: 932,
/* SHIFTJIS */
/*::[*/
129: 949,
/* HANGUL */
/*::[*/
130: 1361,
/* JOHAB */
/*::[*/
134: 936,
/* GB2312 */
/*::[*/
136: 950,
/* CHINESEBIG5 */
/*::[*/
161: 1253,
/* GREEK */
/*::[*/
162: 1254,
/* TURKISH */
/*::[*/
163: 1258,
/* VIETNAMESE */
/*::[*/
177: 1255,
/* HEBREW */
/*::[*/
178: 1256,
/* ARABIC */
/*::[*/
186: 1257,
/* BALTIC */
/*::[*/
204: 1251,
/* RUSSIAN */
/*::[*/
222: 874,
/* THAI */
/*::[*/
238: 1250,
/* EASTEUROPE */
/*::[*/
255: 1252,
/* OEM */
/*::[*/
69: 6969
/* MISC */
}, an = function(e) {
Dc.indexOf(e) != -1 && (ns = tn[0] = e);
};
function Oc() {
an(1252);
}
var zr = function(e) {
an(e);
};
function nn() {
zr(1200), Oc();
}
function Yn(e) {
for (var t = [], r = 0, a = e.length; r < a; ++r) t[r] = e.charCodeAt(r);
return t;
}
function Ic(e) {
for (var t = [], r = 0; r < e.length >> 1; ++r) t[r] = String.fromCharCode(e.charCodeAt(2 * r) + (e.charCodeAt(2 * r + 1) << 8));
return t.join("");
}
function is(e) {
for (var t = [], r = 0; r < e.length >> 1; ++r) t[r] = String.fromCharCode(e.charCodeAt(2 * r + 1) + (e.charCodeAt(2 * r) << 8));
return t.join("");
}
var va = function(e) {
var t = e.charCodeAt(0), r = e.charCodeAt(1);
return t == 255 && r == 254 ? Ic(e.slice(2)) : t == 254 && r == 255 ? is(e.slice(2)) : t == 65279 ? e.slice(1) : e;
}, Ya = function(t) {
return String.fromCharCode(t);
}, jn = function(t) {
return String.fromCharCode(t);
}, G0, mt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
function Aa(e) {
for (var t = "", r = 0, a = 0, n = 0, i = 0, s = 0, f = 0, c = 0, o = 0; o < e.length; )
r = e.charCodeAt(o++), i = r >> 2, a = e.charCodeAt(o++), s = (r & 3) << 4 | a >> 4, n = e.charCodeAt(o++), f = (a & 15) << 2 | n >> 6, c = n & 63, isNaN(a) ? f = c = 64 : isNaN(n) && (c = 64), t += mt.charAt(i) + mt.charAt(s) + mt.charAt(f) + mt.charAt(c);
return t;
}
function Rr(e) {
var t = "", r = 0, a = 0, n = 0, i = 0, s = 0, f = 0, c = 0;
e = e.replace(/[^\w\+\/\=]/g, "");
for (var o = 0; o < e.length; )
i = mt.indexOf(e.charAt(o++)), s = mt.indexOf(e.charAt(o++)), r = i << 2 | s >> 4, t += String.fromCharCode(r), f = mt.indexOf(e.charAt(o++)), a = (s & 15) << 4 | f >> 2, f !== 64 && (t += String.fromCharCode(a)), c = mt.indexOf(e.charAt(o++)), n = (f & 3) << 6 | c, c !== 64 && (t += String.fromCharCode(n));
return t;
}
var Te = /* @__PURE__ */ function() {
return typeof Buffer < "u" && typeof process < "u" && typeof process.versions < "u" && !!process.versions.node;
}(), ht = /* @__PURE__ */ function() {
if (typeof Buffer < "u") {
var e = !Buffer.from;
if (!e) try {
Buffer.from("foo", "utf8");
} catch {
e = !0;
}
return e ? function(t, r) {
return r ? new Buffer(t, r) : new Buffer(t);
} : Buffer.from.bind(Buffer);
}
return function() {
};
}();
function _t(e) {
return Te ? Buffer.alloc ? Buffer.alloc(e) : new Buffer(e) : typeof Uint8Array < "u" ? new Uint8Array(e) : new Array(e);
}
function Jn(e) {
return Te ? Buffer.allocUnsafe ? Buffer.allocUnsafe(e) : new Buffer(e) : typeof Uint8Array < "u" ? new Uint8Array(e) : new Array(e);
}
var Or = function(t) {
return Te ? ht(t, "binary") : t.split("").map(function(r) {
return r.charCodeAt(0) & 255;
});
};
function g0(e) {
if (typeof ArrayBuffer > "u") return Or(e);
for (var t = new ArrayBuffer(e.length), r = new Uint8Array(t), a = 0; a != e.length; ++a) r[a] = e.charCodeAt(a) & 255;
return t;
}
function Tt(e) {
if (Array.isArray(e)) return e.map(function(a) {
return String.fromCharCode(a);
}).join("");
for (var t = [], r = 0; r < e.length; ++r) t[r] = String.fromCharCode(e[r]);
return t.join("");
}
function Rc(e) {
if (typeof Uint8Array > "u") throw new Error("Unsupported");
return new Uint8Array(e);
}
function sn(e) {
if (typeof ArrayBuffer > "u") throw new Error("Unsupported");
if (e instanceof ArrayBuffer) return sn(new Uint8Array(e));
for (var t = new Array(e.length), r = 0; r < e.length; ++r) t[r] = e[r];
return t;
}
var sr = Te ? function(e) {
return Buffer.concat(e.map(function(t) {
return Buffer.isBuffer(t) ? t : ht(t);
}));
} : function(e) {
if (typeof Uint8Array < "u") {
var t = 0, r = 0;
for (t = 0; t < e.length; ++t) r += e[t].length;
var a = new Uint8Array(r), n = 0;
for (t = 0, r = 0; t < e.length; r += n, ++t)
if (n = e[t].length, e[t] instanceof Uint8Array) a.set(e[t], r);
else {
if (typeof e[t] == "string")
throw "wtf";
a.set(new Uint8Array(e[t]), r);
}
return a;
}
return [].concat.apply([], e.map(function(i) {
return Array.isArray(i) ? i : [].slice.call(i);
}));
};
function Nc(e) {
for (var t = [], r = 0, a = e.length + 250, n = _t(e.length + 255), i = 0; i < e.length; ++i) {
var s = e.charCodeAt(i);
if (s < 128) n[r++] = s;
else if (s < 2048)
n[r++] = 192 | s >> 6 & 31, n[r++] = 128 | s & 63;
else if (s >= 55296 && s < 57344) {
s = (s & 1023) + 64;
var f = e.charCodeAt(++i) & 1023;
n[r++] = 240 | s >> 8 & 7, n[r++] = 128 | s >> 2 & 63, n[r++] = 128 | f >> 6 & 15 | (s & 3) << 4, n[r++] = 128 | f & 63;
} else
n[r++] = 224 | s >> 12 & 15, n[r++] = 128 | s >> 6 & 63, n[r++] = 128 | s & 63;
r > a && (t.push(n.slice(0, r)), r = 0, n = _t(65535), a = 65530);
}
return t.push(n.slice(0, r)), sr(t);
}
var Tr = /\u0000/g, pa = /[\u0001-\u0006]/g;
function qt(e) {
for (var t = "", r = e.length - 1; r >= 0; ) t += e.charAt(r--);
return t;
}
function $r(e, t) {
var r = "" + e;
return r.length >= t ? r : ze("0", t - r.length) + r;
}
function fn(e, t) {
var r = "" + e;
return r.length >= t ? r : ze(" ", t - r.length) + r;
}
function s0(e, t) {
var r = "" + e;
return r.length >= t ? r : r + ze(" ", t - r.length);
}
function bc(e, t) {
var r = "" + Math.round(e);
return r.length >= t ? r : ze("0", t - r.length) + r;
}
function Pc(e, t) {
var r = "" + e;
return r.length >= t ? r : ze("0", t - r.length) + r;
}
var Zn = /* @__PURE__ */ Math.pow(2, 32);
function Kt(e, t) {
if (e > Zn || e < -Zn) return bc(e, t);
var r = Math.round(e);
return Pc(r, t);
}
function f0(e, t) {
return t = t || 0, e.length >= 7 + t && (e.charCodeAt(t) | 32) === 103 && (e.charCodeAt(t + 1) | 32) === 101 && (e.charCodeAt(t + 2) | 32) === 110 && (e.charCodeAt(t + 3) | 32) === 101 && (e.charCodeAt(t + 4) | 32) === 114 && (e.charCodeAt(t + 5) | 32) === 97 && (e.charCodeAt(t + 6) | 32) === 108;
}
var qn = [
["Sun", "Sunday"],
["Mon", "Monday"],
["Tue", "Tuesday"],
["Wed", "Wednesday"],
["Thu", "Thursday"],
["Fri", "Friday"],
["Sat", "Saturday"]
], D0 = [
["J", "Jan", "January"],
["F", "Feb", "February"],
["M", "Mar", "March"],
["A", "Apr", "April"],
["M", "May", "May"],
["J", "Jun", "June"],
["J", "Jul", "July"],
["A", "Aug", "August"],
["S", "Sep", "September"],
["O", "Oct", "October"],
["N", "Nov", "November"],
["D", "Dec", "December"]
];
function Lc(e) {
return e || (e = {}), e[0] = "General", e[1] = "0", e[2] = "0.00", e[3] = "#,##0", e[4] = "#,##0.00", e[9] = "0%", e[10] = "0.00%", e[11] = "0.00E+00", e[12] = "# ?/?", e[13] = "# ??/??", e[14] = "m/d/yy", e[15] = "d-mmm-yy", e[16] = "d-mmm", e[17] = "mmm-yy", e[18] = "h:mm AM/PM", e[19] = "h:mm:ss AM/PM", e[20] = "h:mm", e[21] = "h:mm:ss", e[22] = "m/d/yy h:mm", e[37] = "#,##0 ;(#,##0)", e[38] = "#,##0 ;[Red](#,##0)", e[39] = "#,##0.00;(#,##0.00)", e[40] = "#,##0.00;[Red](#,##0.00)", e[45] = "mm:ss", e[46] = "[h]:mm:ss", e[47] = "mmss.0", e[48] = "##0.0E+0", e[49] = "@", e[56] = '"上午/下午 "hh"時"mm"分"ss"秒 "', e;
}
var ve = {
0: "General",
1: "0",
2: "0.00",
3: "#,##0",
4: "#,##0.00",
9: "0%",
10: "0.00%",
11: "0.00E+00",
12: "# ?/?",
13: "# ??/??",
14: "m/d/yy",
15: "d-mmm-yy",
16: "d-mmm",
17: "mmm-yy",
18: "h:mm AM/PM",
19: "h:mm:ss AM/PM",
20: "h:mm",
21: "h:mm:ss",
22: "m/d/yy h:mm",
37: "#,##0 ;(#,##0)",
38: "#,##0 ;[Red](#,##0)",
39: "#,##0.00;(#,##0.00)",
40: "#,##0.00;[Red](#,##0.00)",
45: "mm:ss",
46: "[h]:mm:ss",
47: "mmss.0",
48: "##0.0E+0",
49: "@",
56: '"上午/下午 "hh"時"mm"分"ss"秒 "'
}, Qn = {
5: 37,
6: 38,
7: 39,
8: 40,
// 5 -> 37 ... 8 -> 40
23: 0,
24: 0,
25: 0,
26: 0,
// 23 -> 0 ... 26 -> 0
27: 14,
28: 14,
29: 14,
30: 14,
31: 14,
// 27 -> 14 ... 31 -> 14
50: 14,
51: 14,
52: 14,
53: 14,
54: 14,
// 50 -> 14 ... 58 -> 14
55: 14,
56: 14,
57: 14,
58: 14,
59: 1,
60: 2,
61: 3,
62: 4,
// 59 -> 1 ... 62 -> 4
67: 9,
68: 10,
// 67 -> 9 ... 68 -> 10
69: 12,
70: 13,
71: 14,
// 69 -> 12 ... 71 -> 14
72: 14,
73: 15,
74: 16,
75: 17,
// 72 -> 14 ... 75 -> 17
76: 20,
77: 21,
78: 22,
// 76 -> 20 ... 78 -> 22
79: 45,
80: 46,
81: 47,
// 79 -> 45 ... 81 -> 47
82: 0
// 82 -> 0 ... 65536 -> 0 (omitted)
}, Bc = {
// 5 -- Currency, 0 decimal, black negative
5: '"$"#,##0_);\\("$"#,##0\\)',
63: '"$"#,##0_);\\("$"#,##0\\)',
// 6 -- Currency, 0 decimal, red negative
6: '"$"#,##0_);[Red]\\("$"#,##0\\)',
64: '"$"#,##0_);[Red]\\("$"#,##0\\)',
// 7 -- Currency, 2 decimal, black negative
7: '"$"#,##0.00_);\\("$"#,##0.00\\)',
65: '"$"#,##0.00_);\\("$"#,##0.00\\)',
// 8 -- Currency, 2 decimal, red negative
8: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',
66: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',
// 41 -- Accounting, 0 decimal, No Symbol
41: '_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',
// 42 -- Accounting, 0 decimal, $ Symbol
42: '_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',
// 43 -- Accounting, 2 decimal, No Symbol
43: '_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',
// 44 -- Accounting, 2 decimal, $ Symbol
44: '_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)'
};
function c0(e, t, r) {
for (var a = e < 0 ? -1 : 1, n = e * a, i = 0, s = 1, f = 0, c = 1, o = 0, l = 0, h = Math.floor(n); o < t && (h = Math.floor(n), f = h * s + i, l = h * o + c, !(n - h < 5e-8)); )
n = 1 / (n - h), i = s, s = f, c = o, o = l;
if (l > t && (o > t ? (l = c, f = i) : (l = o, f = s)), !r) return [0, a * f, l];
var x = Math.floor(a * f / l);
return [x, a * f - x * l, l];
}
function Ot(e, t, r) {
if (e > 2958465 || e < 0) return null;
var a = e | 0, n = Math.floor(86400 * (e - a)), i = 0, s = [], f = { D: a, T: n, u: 86400 * (e - a) - n, y: 0, m: 0, d: 0, H: 0, M: 0, S: 0, q: 0 };
if (Math.abs(f.u) < 1e-6 && (f.u = 0), t && t.date1904 && (a += 1462), f.u > 0.9999 && (f.u = 0, ++n == 86400 && (f.T = n = 0, ++a, ++f.D)), a === 60)
s = r ? [1317, 10, 29] : [1900, 2, 29], i = 3;
else if (a === 0)
s = r ? [1317, 8, 29] : [1900, 1, 0], i = 6;
else {
a > 60 && --a;
var c = new Date(1900, 0, 1);
c.setDate(c.getDate() + a - 1), s = [c.getFullYear(), c.getMonth() + 1, c.getDate()], i = c.getDay(), a < 60 && (i = (i + 6) % 7), r && (i = Gc(c, s));
}
return f.y = s[0], f.m = s[1], f.d = s[2], f.S = n % 60, n = Math.floor(n / 60), f.M = n % 60, n = Math.floor(n / 60), f.H = n, f.q = i, f;
}
var ss = /* @__PURE__ */ new Date(1899, 11, 31, 0, 0, 0), Mc = /* @__PURE__ */ ss.getTime(), Uc = /* @__PURE__ */ new Date(1900, 2, 1, 0, 0, 0);
function fs(e, t) {
var r = /* @__PURE__ */ e.getTime();
return t ? r -= 1461 * 24 * 60 * 60 * 1e3 : e >= Uc && (r += 24 * 60 * 60 * 1e3), (r - (Mc + (/* @__PURE__ */ e.getTimezoneOffset() - /* @__PURE__ */ ss.getTimezoneOffset()) * 6e4)) / (24 * 60 * 60 * 1e3);
}
function cn(e) {
return e.indexOf(".") == -1 ? e : e.replace(/(?:\.0*|(\.\d*[1-9])0+)$/, "$1");
}
function Wc(e) {
return e.indexOf("E") == -1 ? e : e.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/, "$1E").replace(/(E[+-])(\d)$/, "$10$2");
}
function Hc(e) {
var t = e < 0 ? 12 : 11, r = cn(e.toFixed(12));
return r.length <= t || (r = e.toPrecision(10), r.length <= t) ? r : e.toExponential(5);
}
function Vc(e) {
var t = cn(e.toFixed(11));
return t.length > (e < 0 ? 12 : 11) || t === "0" || t === "-0" ? e.toPrecision(6) : t;
}
function ya(e) {
var t = Math.floor(Math.log(Math.abs(e)) * Math.LOG10E), r;
return t >= -4 && t <= -1 ? r = e.toPrecision(10 + t) : Math.abs(t) <= 9 ? r = Hc(e) : t === 10 ? r = e.toFixed(10).substr(0, 12) : r = Vc(e), cn(Wc(r.toUpperCase()));
}
function Pt(e, t) {
switch (typeof e) {
case "string":
return e;
case "boolean":
return e ? "TRUE" : "FALSE";
case "number":
return (e | 0) === e ? e.toString(10) : ya(e);
case "undefined":
return "";
case "object":
if (e == null) return "";
if (e instanceof Date) return Vr(14, fs(e, t && t.date1904), t);
}
throw new Error("unsupported value in General format: " + e);
}
function Gc(e, t) {
t[0] -= 581;
var r = e.getDay();
return e < 60 && (r = (r + 6) % 7), r;
}
function Xc(e, t, r, a) {
var n = "", i = 0, s = 0, f = r.y, c, o = 0;
switch (e) {
case 98:
f = r.y + 543;
case 121:
switch (t.length) {
case 1:
case 2:
c = f % 100, o = 2;
break;
default:
c = f % 1e4, o = 4;
break;
}
break;
case 109:
switch (t.length) {
case 1:
case 2:
c = r.m, o = t.length;
break;
case 3:
return D0[r.m - 1][1];
case 5:
return D0[r.m - 1][0];
default:
return D0[r.m - 1][2];
}
break;
case 100:
switch (t.length) {
case 1:
case 2:
c = r.d, o = t.length;
break;
case 3:
return qn[r.q][0];
default:
return qn[r.q][1];
}
break;
case 104:
switch (t.length) {
case 1:
case 2:
c = 1 + (r.H + 11) % 12, o = t.length;
break;
default:
throw "bad hour format: " + t;
}
break;
case 72:
switch (t.length) {
case 1:
case 2:
c = r.H, o = t.length;
break;
default:
throw "bad hour format: " + t;
}
break;
case 77:
switch (t.length) {
case 1:
case 2:
c = r.M, o = t.length;
break;
default:
throw "bad minute format: " + t;
}
break;
case 115:
if (t != "s" && t != "ss" && t != ".0" && t != ".00" && t != ".000") throw "bad second format: " + t;
return r.u === 0 && (t == "s" || t == "ss") ? $r(r.S, t.length) : (a >= 2 ? s = a === 3 ? 1e3 : 100 : s = a === 1 ? 10 : 1, i = Math.round(s * (r.S + r.u)), i >= 60 * s && (i = 0), t === "s" ? i === 0 ? "0" : "" + i / s : (n = $r(i, 2 + a), t === "ss" ? n.substr(0, 2) : "." + n.substr(2, t.length - 1)));
case 90:
switch (t) {
case "[h]":
case "[hh]":
c = r.D * 24 + r.H;
break;
case "[m]":
case "[mm]":
c = (r.D * 24 + r.H) * 60 + r.M;
break;
case "[s]":
case "[ss]":
c = ((r.D * 24 + r.H) * 60 + r.M) * 60 + Math.round(r.S + r.u);
break;
default:
throw "bad abstime format: " + t;
}
o = t.length === 3 ? 1 : 2;
break;
case 101:
c = f, o = 1;
break;
}
var l = o > 0 ? $r(c, o) : "";
return l;
}
function gt(e) {
var t = 3;
if (e.length <= t) return e;
for (var r = e.length % t, a = e.substr(0, r); r != e.length; r += t) a += (a.length > 0 ? "," : "") + e.substr(r, t);
return a;
}
var cs = /%/g;
function zc(e, t, r) {
var a = t.replace(cs, ""), n = t.length - a.length;
return ft(e, a, r * Math.pow(10, 2 * n)) + ze("%", n);
}
function $c(e, t, r) {
for (var a = t.length - 1; t.charCodeAt(a - 1) === 44; ) --a;
return ft(e, t.substr(0, a), r / Math.pow(10, 3 * (t.length - a)));
}
function os(e, t) {
var r, a = e.indexOf("E") - e.indexOf(".") - 1;
if (e.match(/^#+0.0E\+0$/)) {
if (t == 0) return "0.0E+0";
if (t < 0) return "-" + os(e, -t);
var n = e.indexOf(".");
n === -1 && (n = e.indexOf("E"));
var i = Math.floor(Math.log(t) * Math.LOG10E) % n;
if (i < 0 && (i += n), r = (t / Math.pow(10, i)).toPrecision(a + 1 + (n + i) % n), r.indexOf("e") === -1) {
var s = Math.floor(Math.log(t) * Math.LOG10E);
for (r.indexOf(".") === -1 ? r = r.charAt(0) + "." + r.substr(1) + "E+" + (s - r.length + i) : r += "E+" + (s - i); r.substr(0, 2) === "0."; )
r = r.charAt(0) + r.substr(2, n) + "." + r.substr(2 + n), r = r.replace(/^0+([1-9])/, "$1").replace(/^0+\./, "0.");
r = r.replace(/\+-/, "-");
}
r = r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function(f, c, o, l) {
return c + o + l.substr(0, (n + i) % n) + "." + l.substr(i) + "E";
});
} else r = t.toExponential(a);
return e.match(/E\+00$/) && r.match(/e[+-]\d$/) && (r = r.substr(0, r.length - 1) + "0" + r.charAt(r.length - 1)), e.match(/E\-/) && r.match(/e\+/) && (r = r.replace(/e\+/, "e")), r.replace("e", "E");
}
var ls = /# (\?+)( ?)\/( ?)(\d+)/;
function Kc(e, t, r) {
var a = parseInt(e[4], 10), n = Math.round(t * a), i = Math.floor(n / a), s = n - i * a, f = a;
return r + (i === 0 ? "" : "" + i) + " " + (s === 0 ? ze(" ", e[1].length + 1 + e[4].length) : fn(s, e[1].length) + e[2] + "/" + e[3] + $r(f, e[4].length));
}
function Yc(e, t, r) {
return r + (t === 0 ? "" : "" + t) + ze(" ", e[1].length + 2 + e[4].length);
}
var hs = /^#*0*\.([0#]+)/, us = /\).*[0#]/, xs = /\(###\) ###\\?-####/;
function kr(e) {
for (var t = "", r, a = 0; a != e.length; ++a) switch (r = e.charCodeAt(a)) {
case 35:
break;
case 63:
t += " ";
break;
case 48:
t += "0";
break;
default:
t += String.fromCharCode(r);
}
return t;
}
function ei(e, t) {
var r = Math.pow(10, t);
return "" + Math.round(e * r) / r;
}
function ri(e, t) {
var r = e - Math.floor(e), a = Math.pow(10, t);
return t < ("" + Math.round(r * a)).length ? 0 : Math.round(r * a);
}
function jc(e, t) {
return t < ("" + Math.round((e - Math.floor(e)) * Math.pow(10, t))).length ? 1 : 0;
}
function Jc(e) {
return e < 2147483647 && e > -2147483648 ? "" + (e >= 0 ? e | 0 : e - 1 | 0) : "" + Math.floor(e);
}
function Lr(e, t, r) {
if (e.charCodeAt(0) === 40 && !t.match(us)) {
var a = t.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
return r >= 0 ? Lr("n", a, r) : "(" + Lr("n", a, -r) + ")";
}
if (t.charCodeAt(t.length - 1) === 44) return $c(e, t, r);
if (t.indexOf("%") !== -1) return zc(e, t, r);
if (t.indexOf("E") !== -1) return os(t, r);
if (t.charCodeAt(0) === 36) return "$" + Lr(e, t.substr(t.charAt(1) == " " ? 2 : 1), r);
var n, i, s, f, c = Math.abs(r), o = r < 0 ? "-" : "";
if (t.match(/^00+$/)) return o + Kt(c, t.length);
if (t.match(/^[#?]+$/))
return n = Kt(r, 0), n === "0" && (n = ""), n.length > t.length ? n : kr(t.substr(0, t.length - n.length)) + n;
if (i = t.match(ls)) return Kc(i, c, o);
if (t.match(/^#+0+$/)) return o + Kt(c, t.length - t.indexOf("0"));
if (i = t.match(hs))
return n = ei(r, i[1].length).replace(/^([^\.]+)$/, "$1." + kr(i[1])).replace(/\.$/, "." + kr(i[1])).replace(/\.(\d*)$/, function(v, u) {
return "." + u + ze("0", kr(
/*::(*/
i[1]
).length - u.length);
}), t.indexOf("0.") !== -1 ? n : n.replace(/^0\./, ".");
if (t = t.replace(/^#+([0.])/, "$1"), i = t.match(/^(0*)\.(#*)$/))
return o + ei(c, i[2].length).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, i[1].length ? "0." : ".");
if (i = t.match(/^#{1,3},##0(\.?)$/)) return o + gt(Kt(c, 0));
if (i = t.match(/^#,##0\.([#0]*0)$/))
return r < 0 ? "-" + Lr(e, t, -r) : gt("" + (Math.floor(r) + jc(r, i[1].length))) + "." + $r(ri(r, i[1].length), i[1].length);
if (i = t.match(/^#,#*,#0/)) return Lr(e, t.replace(/^#,#*,/, ""), r);
if (i = t.match(/^([0#]+)(\\?-([0#]+))+$/))
return n = qt(Lr(e, t.replace(/[\\-]/g, ""), r)), s = 0, qt(qt(t.replace(/\\/g, "")).replace(/[0#]/g, function(v) {
return s < n.length ? n.charAt(s++) : v === "0" ? "0" : "";
}));
if (t.match(xs))
return n = Lr(e, "##########", r), "(" + n.substr(0, 3) + ") " + n.substr(3, 3) + "-" + n.substr(6);
var l = "";
if (i = t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))
return s = Math.min(
/*::String(*/
i[4].length,
7
), f = c0(c, Math.pow(10, s) - 1, !1), n = "" + o, l = ft(
"n",
/*::String(*/
i[1],
f[1]
), l.charAt(l.length - 1) == " " && (l = l.substr(0, l.length - 1) + "0"), n += l + /*::String(*/
i[2] + "/" + /*::String(*/
i[3], l = s0(f[2], s), l.length < i[4].length && (l = kr(i[4].substr(i[4].length - l.length)) + l), n += l, n;
if (i = t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))
return s = Math.min(Math.max(i[1].length, i[4].length), 7), f = c0(c, Math.pow(10, s) - 1, !0), o + (f[0] || (f[1] ? "" : "0")) + " " + (f[1] ? fn(f[1], s) + i[2] + "/" + i[3] + s0(f[2], s) : ze(" ", 2 * s + 1 + i[2].length + i[3].length));
if (i = t.match(/^[#0?]+$/))
return n = Kt(r, 0), t.length <= n.length ? n : kr(t.substr(0, t.length - n.length)) + n;
if (i = t.match(/^([#0?]+)\.([#0]+)$/)) {
n = "" + r.toFixed(Math.min(i[2].length, 10)).replace(/([^0])0+$/, "$1"), s = n.indexOf(".");
var h = t.indexOf(".") - s, x = t.length - n.length - h;
return kr(t.substr(0, h) + n + t.substr(t.length - x));
}
if (i = t.match(/^00,000\.([#0]*0)$/))
return s = ri(r, i[1].length), r < 0 ? "-" + Lr(e, t, -r) : gt(Jc(r)).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function(v) {
return "00," + (v.length < 3 ? $r(0, 3 - v.length) : "") + v;
}) + "." + $r(s, i[1].length);
switch (t) {
case "###,##0.00":
return Lr(e, "#,##0.00", r);
case "###,###":
case "##,###":
case "#,###":
var d = gt(Kt(c, 0));
return d !== "0" ? o + d : "";
case "###,###.00":
return Lr(e, "###,##0.00", r).replace(/^0\./, ".");
case "#,###.00":
return Lr(e, "#,##0.00", r).replace(/^0\./, ".");
}
throw new Error("unsupported format |" + t + "|");
}
function Zc(e, t, r) {
for (var a = t.length - 1; t.charCodeAt(a - 1) === 44; ) --a;
return ft(e, t.substr(0, a), r / Math.pow(10, 3 * (t.length - a)));
}
function qc(e, t, r) {
var a = t.replace(cs, ""), n = t.length - a.length;
return ft(e, a, r * Math.pow(10, 2 * n)) + ze("%", n);
}
function ds(e, t) {
var r, a = e.indexOf("E") - e.indexOf(".") - 1;
if (e.match(/^#+0.0E\+0$/)) {
if (t == 0) return "0.0E+0";
if (t < 0) return "-" + ds(e, -t);
var n = e.indexOf(".");
n === -1 && (n = e.indexOf("E"));
var i = Math.floor(Math.log(t) * Math.LOG10E) % n;
if (i < 0 && (i += n), r = (t / Math.pow(10, i)).toPrecision(a + 1 + (n + i) % n), !r.match(/[Ee]/)) {
var s = Math.floor(Math.log(t) * Math.LOG10E);
r.indexOf(".") === -1 ? r = r.charAt(0) + "." + r.substr(1) + "E+" + (s - r.length + i) : r += "E+" + (s - i), r = r.replace(/\+-/, "-");
}
r = r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function(f, c, o, l) {
return c + o + l.substr(0, (n + i) % n) + "." + l.substr(i) + "E";
});
} else r = t.toExponential(a);
return e.match(/E\+00$/) && r.match(/e[+-]\d$/) && (r = r.substr(0, r.length - 1) + "0" + r.charAt(r.length - 1)), e.match(/E\-/) && r.match(/e\+/) && (r = r.replace(/e\+/, "e")), r.replace("e", "E");
}
function qr(e, t, r) {
if (e.charCodeAt(0) === 40 && !t.match(us)) {
var a = t.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
return r >= 0 ? qr("n", a, r) : "(" + qr("n", a, -r) + ")";
}
if (t.charCodeAt(t.length - 1) === 44) return Zc(e, t, r);
if (t.indexOf("%") !== -1) return qc(e, t, r);
if (t.indexOf("E") !== -1) return ds(t, r);
if (t.charCodeAt(0) === 36) return "$" + qr(e, t.substr(t.charAt(1) == " " ? 2 : 1), r);
var n, i, s, f, c = Math.abs(r), o = r < 0 ? "-" : "";
if (t.match(/^00+$/)) return o + $r(c, t.length);
if (t.match(/^[#?]+$/))
return n = "" + r, r === 0 && (n = ""), n.length > t.length ? n : kr(t.substr(0, t.length - n.length)) + n;
if (i = t.match(ls)) return Yc(i, c, o);
if (t.match(/^#+0+$/)) return o + $r(c, t.length - t.indexOf("0"));
if (i = t.match(hs))
return n = ("" + r).replace(/^([^\.]+)$/, "$1." + kr(i[1])).replace(/\.$/, "." + kr(i[1])), n = n.replace(/\.(\d*)$/, function(v, u) {
return "." + u + ze("0", kr(i[1]).length - u.length);
}), t.indexOf("0.") !== -1 ? n : n.replace(/^0\./, ".");
if (t = t.replace(/^#+([0.])/, "$1"), i = t.match(/^(0*)\.(#*)$/))
return o + ("" + c).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, i[1].length ? "0." : ".");
if (i = t.match(/^#{1,3},##0(\.?)$/)) return o + gt("" + c);
if (i = t.match(/^#,##0\.([#0]*0)$/))
return r < 0 ? "-" + qr(e, t, -r) : gt("" + r) + "." + ze("0", i[1].length);
if (i = t.match(/^#,#*,#0/)) return qr(e, t.replace(/^#,#*,/, ""), r);
if (i = t.match(/^([0#]+)(\\?-([0#]+))+$/))
return n = qt(qr(e, t.replace(/[\\-]/g, ""), r)), s = 0, qt(qt(t.replace(/\\/g, "")).replace(/[0#]/g, function(v) {
return s < n.length ? n.charAt(s++) : v === "0" ? "0" : "";
}));
if (t.match(xs))
return n = qr(e, "##########", r), "(" + n.substr(0, 3) + ") " + n.substr(3, 3) + "-" + n.substr(6);
var l = "";
if (i = t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))
return s = Math.min(
/*::String(*/
i[4].length,
7
), f = c0(c, Math.pow(10, s) - 1, !1), n = "" + o, l = ft(
"n",
/*::String(*/
i[1],
f[1]
), l.charAt(l.length - 1) == " " && (l = l.substr(0, l.length - 1) + "0"), n += l + /*::String(*/
i[2] + "/" + /*::String(*/
i[3], l = s0(f[2], s), l.length < i[4].length && (l = kr(i[4].substr(i[4].length - l.length)) + l), n += l, n;
if (i = t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))
return s = Math.min(Math.max(i[1].length, i[4].length), 7), f = c0(c, Math.pow(10, s) - 1, !0), o + (f[0] || (f[1] ? "" : "0")) + " " + (f[1] ? fn(f[1], s) + i[2] + "/" + i[3] + s0(f[2], s) : ze(" ", 2 * s + 1 + i[2].length + i[3].length));
if (i = t.match(/^[#0?]+$/))
return n = "" + r, t.length <= n.length ? n : kr(t.substr(0, t.length - n.length)) + n;
if (i = t.match(/^([#0]+)\.([#0]+)$/)) {
n = "" + r.toFixed(Math.min(i[2].length, 10)).replace(/([^0])0+$/, "$1"), s = n.indexOf(".");
var h = t.indexOf(".") - s, x = t.length - n.length - h;
return kr(t.substr(0, h) + n + t.substr(t.length - x));
}
if (i = t.match(/^00,000\.([#0]*0)$/))
return r < 0 ? "-" + qr(e, t, -r) : gt("" + r).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function(v) {
return "00," + (v.length < 3 ? $r(0, 3 - v.length) : "") + v;
}) + "." + $r(0, i[1].length);
switch (t) {
case "###,###":
case "##,###":
case "#,###":
var d = gt("" + c);
return d !== "0" ? o + d : "";
default:
if (t.match(/\.[0#?]*$/)) return qr(e, t.slice(0, t.lastIndexOf(".")), r) + kr(t.slice(t.lastIndexOf(".")));
}
throw new Error("unsupported format |" + t + "|");
}
function ft(e, t, r) {
return (r | 0) === r ? qr(e, t, r) : Lr(e, t, r);
}
function Qc(e) {
for (var t = [], r = !1, a = 0, n = 0; a < e.length; ++a) switch (
/*cc=*/
e.charCodeAt(a)
) {
case 34:
r = !r;
break;
case 95:
case 42:
case 92:
++a;
break;
case 59:
t[t.length] = e.substr(n, a - n), n = a + 1;
}
if (t[t.length] = e.substr(n), r === !0) throw new Error("Format |" + e + "| unterminated string ");
return t;
}
var vs = /\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;
function ia(e) {
for (var t = 0, r = "", a = ""; t < e.length; )
switch (r = e.charAt(t)) {
case "G":
f0(e, t) && (t += 6), t++;
break;
case '"':
for (
;
/*cc=*/
e.charCodeAt(++t) !== 34 && t < e.length;
)
;
++t;
break;
case "\\":
t += 2;
break;
case "_":
t += 2;
break;
case "@":
++t;
break;
case "B":
case "b":
if (e.charAt(t + 1) === "1" || e.charAt(t + 1) === "2") return !0;
case "M":
case "D":
case "Y":
case "H":
case "S":
case "E":
case "m":
case "d":
case "y":
case "h":
case "s":
case "e":
case "g":
return !0;
case "A":
case "a":
case "上":
if (e.substr(t, 3).toUpperCase() === "A/P" || e.substr(t, 5).toUpperCase() === "AM/PM" || e.substr(t, 5).toUpperCase() === "上午/下午") return !0;
++t;
break;
case "[":
for (a = r; e.charAt(t++) !== "]" && t < e.length; ) a += e.charAt(t);
if (a.match(vs)) return !0;
break;
case ".":
case "0":
case "#":
for (; t < e.length && ("0#?.,E+-%".indexOf(r = e.charAt(++t)) > -1 || r == "\\" && e.charAt(t + 1) == "-" && "0#".indexOf(e.charAt(t + 2)) > -1); )
;
break;
case "?":
for (; e.charAt(++t) === r; )
;
break;
case "*":
++t, (e.charAt(t) == " " || e.charAt(t) == "*") && ++t;
break;
case "(":
case ")":
++t;
break;
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
for (; t < e.length && "0123456789".indexOf(e.charAt(++t)) > -1; )
;
break;
case " ":
++t;
break;
default:
++t;
break;
}
return !1;
}
function eo(e, t, r, a) {
for (var n = [], i = "", s = 0, f = "", c = "t", o, l, h, x = "H"; s < e.length; )
switch (f = e.charAt(s)) {
case "G":
if (!f0(e, s)) throw new Error("unrecognized character " + f + " in " + e);
n[n.length] = { t: "G", v: "General" }, s += 7;
break;
case '"':
for (i = ""; (h = e.charCodeAt(++s)) !== 34 && s < e.length; ) i += String.fromCharCode(h);
n[n.length] = { t: "t", v: i }, ++s;
break;
case "\\":
var d = e.charAt(++s), v = d === "(" || d === ")" ? d : "t";
n[n.length] = { t: v, v: d }, ++s;
break;
case "_":
n[n.length] = { t: "t", v: " " }, s += 2;
break;
case "@":
n[n.length] = { t: "T", v: t }, ++s;
break;
case "B":
case "b":
if (e.charAt(s + 1) === "1" || e.charAt(s + 1) === "2") {
if (o == null && (o = Ot(t, r, e.charAt(s + 1) === "2"), o == null))
return "";
n[n.length] = { t: "X", v: e.substr(s, 2) }, c = f, s += 2;
break;
}
case "M":
case "D":
case "Y":
case "H":
case "S":
case "E":
f = f.toLowerCase();
case "m":
case "d":
case "y":
case "h":
case "s":
case "e":
case "g":
if (t < 0 || o == null && (o = Ot(t, r), o == null))
return "";
for (i = f; ++s < e.length && e.charAt(s).toLowerCase() === f; ) i += f;
f === "m" && c.toLowerCase() === "h" && (f = "M"), f === "h" && (f = x), n[n.length] = { t: f, v: i }, c = f;
break;
case "A":
case "a":
case "上":
var u = { t: f, v: f };
if (o == null && (o = Ot(t, r)), e.substr(s, 3).toUpperCase() === "A/P" ? (o != null && (u.v = o.H >= 12 ? "P" : "A"), u.t = "T", x = "h", s += 3) : e.substr(s, 5).toUpperCase() === "AM/PM" ? (o != null && (u.v = o.H >= 12 ? "PM" : "AM"), u.t = "T", s += 5, x = "h") : e.substr(s, 5).toUpperCase() === "上午/下午" ? (o != null && (u.v = o.H >= 12 ? "下午" : "上午"), u.t = "T", s += 5, x = "h") : (u.t = "t", ++s), o == null && u.t === "T") return "";
n[n.length] = u, c = f;
break;
case "[":
for (i = f; e.charAt(s++) !== "]" && s < e.length; ) i += e.charAt(s);
if (i.slice(-1) !== "]") throw 'unterminated "[" block: |' + i + "|";
if (i.match(vs)) {
if (o == null && (o = Ot(t, r), o == null))
return "";
n[n.length] = { t: "Z", v: i.toLowerCase() }, c = i.charAt(1);
} else i.indexOf("$") > -1 && (i = (i.match(/\$([^-\[\]]*)/) || [])[1] || "$", ia(e) || (n[n.length] = { t: "t", v: i }));
break;
case ".":
if (o != null) {
for (i = f; ++s < e.length && (f = e.charAt(s)) === "0"; ) i += f;
n[n.length] = { t: "s", v: i };
break;
}
case "0":
case "#":
for (i = f; ++s < e.length && "0#?.,E+-%".indexOf(f = e.charAt(s)) > -1; ) i += f;
n[n.length] = { t: "n", v: i };
break;
case "?":
for (i = f; e.charAt(++s) === f; ) i += f;
n[n.length] = { t: f, v: i }, c = f;
break;
case "*":
++s, (e.charAt(s) == " " || e.charAt(s) == "*") && ++s;
break;
case "(":
case ")":
n[n.length] = { t: a === 1 ? "t" : f, v: f }, ++s;
break;
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
for (i = f; s < e.length && "0123456789".indexOf(e.charAt(++s)) > -1; ) i += e.charAt(s);
n[n.length] = { t: "D", v: i };
break;
case " ":
n[n.length] = { t: f, v: f }, ++s;
break;
case "$":
n[n.length] = { t: "t", v: "$" }, ++s;
break;
default:
if (",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(f) === -1) throw new Error("unrecognized character " + f + " in " + e);
n[n.length] = { t: "t", v: f }, ++s;
break;
}
var p = 0, k = 0, A;
for (s = n.length - 1, c = "t"; s >= 0; --s)
switch (n[s].t) {
case "h":
case "H":
n[s].t = x, c = "h", p < 1 && (p = 1);
break;
case "s":
(A = n[s].v.match(/\.0+$/)) && (k = Math.max(k, A[0].length - 1)), p < 3 && (p = 3);
case "d":
case "y":
case "M":
case "e":
c = n[s].t;
break;
case "m":
c === "s" && (n[s].t = "M", p < 2 && (p = 2));
break;
case "X":
break;
case "Z":
p < 1 && n[s].v.match(/[Hh]/) && (p = 1), p < 2 && n[s].v.match(/[Mm]/) && (p = 2), p < 3 && n[s].v.match(/[Ss]/) && (p = 3);
}
switch (p) {
case 0:
break;
case 1:
o.u >= 0.5 && (o.u = 0, ++o.S), o.S >= 60 && (o.S = 0, ++o.M), o.M >= 60 && (o.M = 0, ++o.H);
break;
case 2:
o.u >= 0.5 && (o.u = 0, ++o.S), o.S >= 60 && (o.S = 0, ++o.M);
break;
}
var g = "", O;
for (s = 0; s < n.length; ++s)
switch (n[s].t) {
case "t":
case "T":
case " ":
case "D":
break;
case "X":
n[s].v = "", n[s].t = ";";
break;
case "d":
case "m":
case "y":
case "h":
case "H":
case "M":
case "s":
case "e":
case "b":
case "Z":
n[s].v = Xc(n[s].t.charCodeAt(0), n[s].v, o, k), n[s].t = "t";
break;
case "n":
case "?":
for (O = s + 1; n[O] != null && ((f = n[O].t) === "?" || f === "D" || (f === " " || f === "t") && n[O + 1] != null && (n[O + 1].t === "?" || n[O + 1].t === "t" && n[O + 1].v === "/") || n[s].t === "(" && (f === " " || f === "n" || f === ")") || f === "t" && (n[O].v === "/" || n[O].v === " " && n[O + 1] != null && n[O + 1].t == "?")); )
n[s].v += n[O].v, n[O] = { v: "", t: ";" }, ++O;
g += n[s].v, s = O - 1;
break;
case "G":
n[s].t = "t", n[s].v = Pt(t, r);
break;
}
var b = "", N, F;
if (g.length > 0) {
g.charCodeAt(0) == 40 ? (N = t < 0 && g.charCodeAt(0) === 45 ? -t : t, F = ft("n", g, N)) : (N = t < 0 && a > 1 ? -t : t, F = ft("n", g, N), N < 0 && n[0] && n[0].t == "t" && (F = F.substr(1), n[0].v = "-" + n[0].v)), O = F.length - 1;
var B = n.length;
for (s = 0; s < n.length; ++s) if (n[s] != null && n[s].t != "t" && n[s].v.indexOf(".") > -1) {
B = s;
break;
}
var I = n.length;
if (B === n.length && F.indexOf("E") === -1) {
for (s = n.length - 1; s >= 0; --s)
n[s] == null || "n?".indexOf(n[s].t) === -1 || (O >= n[s].v.length - 1 ? (O -= n[s].v.length, n[s].v = F.substr(O + 1, n[s].v.length)) : O < 0 ? n[s].v = "" : (n[s].v = F.substr(0, O + 1), O = -1), n[s].t = "t", I = s);
O >= 0 && I < n.length && (n[I].v = F.substr(0, O + 1) + n[I].v);
} else if (B !== n.length && F.indexOf("E") === -1) {
for (O = F.indexOf(".") - 1, s = B; s >= 0; --s)
if (!(n[s] == null || "n?".indexOf(n[s].t) === -1)) {
for (l = n[s].v.indexOf(".") > -1 && s === B ? n[s].v.indexOf(".") - 1 : n[s].v.length - 1, b = n[s].v.substr(l + 1); l >= 0; --l)
O >= 0 && (n[s].v.charAt(l) === "0" || n[s].v.charAt(l) === "#") && (b = F.charAt(O--) + b);
n[s].v = b, n[s].t = "t", I = s;
}
for (O >= 0 && I < n.length && (n[I].v = F.substr(0, O + 1) + n[I].v), O = F.indexOf(".") + 1, s = B; s < n.length; ++s)
if (!(n[s] == null || "n?(".indexOf(n[s].t) === -1 && s !== B)) {
for (l = n[s].v.indexOf(".") > -1 && s === B ? n[s].v.indexOf(".") + 1 : 0, b = n[s].v.substr(0, l); l < n[s].v.length; ++l)
O < F.length && (b += F.charAt(O++));
n[s].v = b, n[s].t = "t", I = s;
}
}
}
for (s = 0; s < n.length; ++s) n[s] != null && "n?".indexOf(n[s].t) > -1 && (N = a > 1 && t < 0 && s > 0 && n[s - 1].v === "-" ? -t : t, n[s].v = ft(n[s].t, n[s].v, N), n[s].t = "t");
var z = "";
for (s = 0; s !== n.length; ++s) n[s] != null && (z += n[s].v);
return z;
}
var ti = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;
function ai(e, t) {
if (t == null) return !1;
var r = parseFloat(t[2]);
switch (t[1]) {
case "=":
if (e == r) return !0;
break;
case ">":
if (e > r) return !0;
break;
case "<":
if (e < r) return !0;
break;
case "<>":
if (e != r) return !0;
break;
case ">=":
if (e >= r) return !0;
break;
case "<=":
if (e <= r) return !0;
break;
}
return !1;
}
function ro(e, t) {
var r = Qc(e), a = r.length, n = r[a - 1].indexOf("@");
if (a < 4 && n > -1 && --a, r.length > 4) throw new Error("cannot find right format for |" + r.join("|") + "|");
if (typeof t != "number") return [4, r.length === 4 || n > -1 ? r[r.length - 1] : "@"];
switch (r.length) {
case 1:
r = n > -1 ? ["General", "General", "General", r[0]] : [r[0], r[0], r[0], "@"];
break;
case 2:
r = n > -1 ? [r[0], r[0], r[0], r[1]] : [r[0], r[1], r[0], "@"];
break;
case 3:
r = n > -1 ? [r[0], r[1], r[0], r[2]] : [r[0], r[1], r[2], "@"];
break;
}
var i = t > 0 ? r[0] : t < 0 ? r[1] : r[2];
if (r[0].indexOf("[") === -1 && r[1].indexOf("[") === -1) return [a, i];
if (r[0].match(/\[[=<>]/) != null || r[1].match(/\[[=<>]/) != null) {
var s = r[0].match(ti), f = r[1].match(ti);
return ai(t, s) ? [a, r[0]] : ai(t, f) ? [a, r[1]] : [a, r[s != null && f != null ? 2 : 1]];
}
return [a, i];
}
function Vr(e, t, r) {
r == null && (r = {});
var a = "";
switch (typeof e) {
case "string":
e == "m/d/yy" && r.dateNF ? a = r.dateNF : a = e;
break;
case "number":
e == 14 && r.dateNF ? a = r.dateNF : a = (r.table != null ? r.table : ve)[e], a == null && (a = r.table && r.table[Qn[e]] || ve[Qn[e]]), a == null && (a = Bc[e] || "General");
break;
}
if (f0(a, 0)) return Pt(t, r);
t instanceof Date && (t = fs(t, r.date1904));
var n = ro(a, t);
if (f0(n[1])) return Pt(t, r);
if (t === !0) t = "TRUE";
else if (t === !1) t = "FALSE";
else if (t === "" || t == null) return "";
return eo(n[1], t, r, n[0]);
}
function ct(e, t) {
if (typeof t != "number") {
t = +t || -1;
for (var r = 0; r < 392; ++r) {
if (ve[r] == null) {
t < 0 && (t = r);
continue;
}
if (ve[r] == e) {
t = r;
break;
}
}
t < 0 && (t = 391);
}
return ve[t] = e, t;
}
function _0(e) {
for (var t = 0; t != 392; ++t)
e[t] !== void 0 && ct(e[t], t);
}
function sa() {
ve = Lc();
}
var to = {
5: '"$"#,##0_);\\("$"#,##0\\)',
6: '"$"#,##0_);[Red]\\("$"#,##0\\)',
7: '"$"#,##0.00_);\\("$"#,##0.00\\)',
8: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',
23: "General",
24: "General",
25: "General",
26: "General",
27: "m/d/yy",
28: "m/d/yy",
29: "m/d/yy",
30: "m/d/yy",
31: "m/d/yy",
32: "h:mm:ss",
33: "h:mm:ss",
34: "h:mm:ss",
35: "h:mm:ss",
36: "m/d/yy",
41: '_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',
42: '_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)',
43: '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)',
44: '_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',
50: "m/d/yy",
51: "m/d/yy",
52: "m/d/yy",
53: "m/d/yy",
54: "m/d/yy",
55: "m/d/yy",
56: "m/d/yy",
57: "m/d/yy",
58: "m/d/yy",
59: "0",
60: "0.00",
61: "#,##0",
62: "#,##0.00",
63: '"$"#,##0_);\\("$"#,##0\\)',
64: '"$"#,##0_);[Red]\\("$"#,##0\\)',
65: '"$"#,##0.00_);\\("$"#,##0.00\\)',
66: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',
67: "0%",
68: "0.00%",
69: "# ?/?",
70: "# ??/??",
71: "m/d/yy",
72: "m/d/yy",
73: "d-mmm-yy",
74: "d-mmm",
75: "mmm-yy",
76: "h:mm",
77: "h:mm:ss",
78: "m/d/yy h:mm",
79: "mm:ss",
80: "[h]:mm:ss",
81: "mmss.0"
}, ps = /[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g;
function ao(e) {
var t = typeof e == "number" ? ve[e] : e;
return t = t.replace(ps, "(\\d+)"), new RegExp("^" + t + "$");
}
function no(e, t, r) {
var a = -1, n = -1, i = -1, s = -1, f = -1, c = -1;
(t.match(ps) || []).forEach(function(h, x) {
var d = parseInt(r[x + 1], 10);
switch (h.toLowerCase().charAt(0)) {
case "y":
a = d;
break;
case "d":
i = d;
break;
case "h":
s = d;
break;
case "s":
c = d;
break;
case "m":
s >= 0 ? f = d : n = d;
break;
}
}), c >= 0 && f == -1 && n >= 0 && (f = n, n = -1);
var o = ("" + (a >= 0 ? a : (/* @__PURE__ */ new Date()).getFullYear())).slice(-4) + "-" + ("00" + (n >= 1 ? n : 1)).slice(-2) + "-" + ("00" + (i >= 1 ? i : 1)).slice(-2);
o.length == 7 && (o = "0" + o), o.length == 8 && (o = "20" + o);
var l = ("00" + (s >= 0 ? s : 0)).slice(-2) + ":" + ("00" + (f >= 0 ? f : 0)).slice(-2) + ":" + ("00" + (c >= 0 ? c : 0)).slice(-2);
return s == -1 && f == -1 && c == -1 ? o : a == -1 && n == -1 && i == -1 ? l : o + "T" + l;
}
var io = /* @__PURE__ */ function() {
var e = {};
e.version = "1.2.0";
function t() {
for (var F = 0, B = new Array(256), I = 0; I != 256; ++I)
F = I, F = F & 1 ? -306674912 ^ F >>> 1 : F >>> 1, F = F & 1 ? -306674912 ^ F >>> 1 : F >>> 1, F = F & 1 ? -306674912 ^ F >>> 1 : F >>> 1, F = F & 1 ? -306674912 ^ F >>> 1 : F >>> 1, F = F & 1 ? -306674912 ^ F >>> 1 : F >>> 1, F = F & 1 ? -306674912 ^ F >>> 1 : F >>> 1, F = F & 1 ? -306674912 ^ F >>> 1 : F >>> 1, F = F & 1 ? -306674912 ^ F >>> 1 : F >>> 1, B[I] = F;
return typeof Int32Array < "u" ? new Int32Array(B) : B;
}
var r = t();
function a(F) {
var B = 0, I = 0, z = 0, G = typeof Int32Array < "u" ? new Int32Array(4096) : new Array(4096);
for (z = 0; z != 256; ++z) G[z] = F[z];
for (z = 0; z != 256; ++z)
for (I = F[z], B = 256 + z; B < 4096; B += 256) I = G[B] = I >>> 8 ^ F[I & 255];
var L = [];
for (z = 1; z != 16; ++z) L[z - 1] = typeof Int32Array < "u" ? G.subarray(z * 256, z * 256 + 256) : G.slice(z * 256, z * 256 + 256);
return L;
}
var n = a(r), i = n[0], s = n[1], f = n[2], c = n[3], o = n[4], l = n[5], h = n[6], x = n[7], d = n[8], v = n[9], u = n[10], p = n[11], k = n[12], A = n[13], g = n[14];
function O(F, B) {
for (var I = B ^ -1, z = 0, G = F.length; z < G; ) I = I >>> 8 ^ r[(I ^ F.charCodeAt(z++)) & 255];
return ~I;
}
function b(F, B) {
for (var I = B ^ -1, z = F.length - 15, G = 0; G < z; ) I = g[F[G++] ^ I & 255] ^ A[F[G++] ^ I >> 8 & 255] ^ k[F[G++] ^ I >> 16 & 255] ^ p[F[G++] ^ I >>> 24] ^ u[F[G++]] ^ v[F[G++]] ^ d[F[G++]] ^ x[F[G++]] ^ h[F[G++]] ^ l[F[G++]] ^ o[F[G++]] ^ c[F[G++]] ^ f[F[G++]] ^ s[F[G++]] ^ i[F[G++]] ^ r[F[G++]];
for (z += 15; G < z; ) I = I >>> 8 ^ r[(I ^ F[G++]) & 255];
return ~I;
}
function N(F, B) {
for (var I = B ^ -1, z = 0, G = F.length, L = 0, J = 0; z < G; )
L = F.charCodeAt(z++), L < 128 ? I = I >>> 8 ^ r[(I ^ L) & 255] : L < 2048 ? (I = I >>> 8 ^ r[(I ^ (192 | L >> 6 & 31)) & 255], I = I >>> 8 ^ r[(I ^ (128 | L & 63)) & 255]) : L >= 55296 && L < 57344 ? (L = (L & 1023) + 64, J = F.charCodeAt(z++) & 1023, I = I >>> 8 ^ r[(I ^ (240 | L >> 8 & 7)) & 255], I = I >>> 8 ^ r[(I ^ (128 | L >> 2 & 63)) & 255], I = I >>> 8 ^ r[(I ^ (128 | J >> 6 & 15 | (L & 3) << 4)) & 255], I = I >>> 8 ^ r[(I ^ (128 | J & 63)) & 255]) : (I = I >>> 8 ^ r[(I ^ (224 | L >> 12 & 15)) & 255], I = I >>> 8 ^ r[(I ^ (128 | L >> 6 & 63)) & 255], I = I >>> 8 ^ r[(I ^ (128 | L & 63)) & 255]);
return ~I;
}
return e.table = r, e.bstr = O, e.buf = b, e.str = N, e;
}(), xe = /* @__PURE__ */ function() {
var t = {};
t.version = "1.2.1";
function r(m, E) {
for (var _ = m.split("/"), w = E.split("/"), T = 0, S = 0, U = Math.min(_.length, w.length); T < U; ++T) {
if (S = _[T].length - w[T].length) return S;
if (_[T] != w[T]) return _[T] < w[T] ? -1 : 1;
}
return _.length - w.length;
}
function a(m) {
if (m.charAt(m.length - 1) == "/") return m.slice(0, -1).indexOf("/") === -1 ? m : a(m.slice(0, -1));
var E = m.lastIndexOf("/");
return E === -1 ? m : m.slice(0, E + 1);
}
function n(m) {
if (m.charAt(m.length - 1) == "/") return n(m.slice(0, -1));
var E = m.lastIndexOf("/");
return E === -1 ? m : m.slice(E + 1);
}
function i(m, E) {
typeof E == "string" && (E = new Date(E));
var _ = E.getHours();
_ = _ << 6 | E.getMinutes(), _ = _ << 5 | E.getSeconds() >>> 1, m.write_shift(2, _);
var w = E.getFullYear() - 1980;
w = w << 4 | E.getMonth() + 1, w = w << 5 | E.getDate(), m.write_shift(2, w);
}
function s(m) {
var E = m.read_shift(2) & 65535, _ = m.read_shift(2) & 65535, w = /* @__PURE__ */ new Date(), T = _ & 31;
_ >>>= 5;
var S = _ & 15;
_ >>>= 4, w.setMilliseconds(0), w.setFullYear(_ + 1980), w.setMonth(S - 1), w.setDate(T);
var U = E & 31;
E >>>= 5;
var K = E & 63;
return E >>>= 6, w.setHours(E), w.setMinutes(K), w.setSeconds(U << 1), w;
}
function f(m) {
or(m, 0);
for (var E = (
/*::(*/
{}
), _ = 0; m.l <= m.length - 4; ) {
var w = m.read_shift(2), T = m.read_shift(2), S = m.l + T, U = {};
switch (w) {
case 21589:
_ = m.read_shift(1), _ & 1 && (U.mtime = m.read_shift(4)), T > 5 && (_ & 2 && (U.atime = m.read_shift(4)), _ & 4 && (U.ctime = m.read_shift(4))), U.mtime && (U.mt = new Date(U.mtime * 1e3));
break;
}
m.l = S, E[w] = U;
}
return E;
}
var c;
function o() {
return c || (c = {});
}
function l(m, E) {
if (m[0] == 80 && m[1] == 75) return Kn(m, E);
if ((m[0] | 32) == 109 && (m[1] | 32) == 105) return Tc(m, E);
if (m.length < 512) throw new Error("CFB file size " + m.length + " < 512");
var _ = 3, w = 512, T = 0, S = 0, U = 0, K = 0, M = 0, W = [], H = (
/*::(*/
m.slice(0, 512)
);
or(H, 0);
var q = h(H);
switch (_ = q[0], _) {
case 3:
w = 512;
break;
case 4:
w = 4096;
break;
case 0:
if (q[1] == 0) return Kn(m, E);
default:
throw new Error("Major Version: Expected 3 or 4 saw " + _);
}
w !== 512 && (H = /*::(*/
m.slice(0, w), or(
H,
28
/* blob.l */
));
var se = m.slice(0, w);
x(H, _);
var he = H.read_shift(4, "i");
if (_ === 3 && he !== 0) throw new Error("# Directory Sectors: Expected 0 saw " + he);
H.l += 4, U = H.read_shift(4, "i"), H.l += 4, H.chk("00100000", "Mini Stream Cutoff Size: "), K = H.read_shift(4, "i"), T = H.read_shift(4, "i"), M = H.read_shift(4, "i"), S = H.read_shift(4, "i");
for (var ee = -1, oe = 0; oe < 109 && (ee = H.read_shift(4, "i"), !(ee < 0)); ++oe)
W[oe] = ee;
var _e = d(m, w);
p(M, S, _e, w, W);
var He = A(_e, U, W, w);
He[U].name = "!Directory", T > 0 && K !== J && (He[K].name = "!MiniFAT"), He[W[0]].name = "!FAT", He.fat_addrs = W, He.ssz = w;
var Ve = {}, hr = [], ha = [], ua = [];
g(U, He, _e, hr, T, Ve, ha, K), v(ha, ua, hr), hr.shift();
var xa = {
FileIndex: ha,
FullPaths: ua
};
return E && E.raw && (xa.raw = { header: se, sectors: _e }), xa;
}
function h(m) {
if (m[m.l] == 80 && m[m.l + 1] == 75) return [0, 0];
m.chk(le, "Header Signature: "), m.l += 16;
var E = m.read_shift(2, "u");
return [m.read_shift(2, "u"), E];
}
function x(m, E) {
var _ = 9;
switch (m.l += 2, _ = m.read_shift(2)) {
case 9:
if (E != 3) throw new Error("Sector Shift: Expected 9 saw " + _);
break;
case 12:
if (E != 4) throw new Error("Sector Shift: Expected 12 saw " + _);
break;
default:
throw new Error("Sector Shift: Expected 9 or 12 saw " + _);
}
m.chk("0600", "Mini Sector Shift: "), m.chk("000000000000", "Reserved: ");
}
function d(m, E) {
for (var _ = Math.ceil(m.length / E) - 1, w = [], T