@stellartrack/custom-data-table
Version:
A high-performance virtualized React data table with Excel export and filtering
1,325 lines • 483 kB
JavaScript
import { jsx as Fe, jsxs as cr, Fragment as Ds } from "react/jsx-runtime";
import Qe, { createElement as Qt, PureComponent as ks, Component as Ls, useState as Tt, useEffect as Nn, useRef as Dn, useMemo as Ni } from "react";
function $n() {
return $n = Object.assign ? Object.assign.bind() : function(e) {
for (var t = 1; t < arguments.length; t++) {
var r = arguments[t];
for (var n in r) ({}).hasOwnProperty.call(r, n) && (e[n] = r[n]);
}
return e;
}, $n.apply(null, arguments);
}
function Di(e) {
if (e === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e;
}
function jn(e, t) {
return jn = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, n) {
return r.__proto__ = n, r;
}, jn(e, t);
}
function Ps(e, t) {
e.prototype = Object.create(t.prototype), e.prototype.constructor = e, jn(e, t);
}
var ki = Number.isNaN || function(t) {
return typeof t == "number" && t !== t;
};
function Ms(e, t) {
return !!(e === t || ki(e) && ki(t));
}
function Bs(e, t) {
if (e.length !== t.length)
return !1;
for (var r = 0; r < e.length; r++)
if (!Ms(e[r], t[r]))
return !1;
return !0;
}
function kn(e, t) {
t === void 0 && (t = Bs);
var r, n = [], i, a = !1;
function s() {
for (var f = [], l = 0; l < arguments.length; l++)
f[l] = arguments[l];
return a && r === this && t(f, n) || (i = e.apply(this, f), a = !0, r = this, n = f), i;
}
return s;
}
var bs = typeof performance == "object" && typeof performance.now == "function", Li = bs ? function() {
return performance.now();
} : function() {
return Date.now();
};
function Pi(e) {
cancelAnimationFrame(e.id);
}
function Us(e, t) {
var r = Li();
function n() {
Li() - r >= t ? e.call(null) : i.id = requestAnimationFrame(n);
}
var i = {
id: requestAnimationFrame(n)
};
return i;
}
var Ln = -1;
function Mi(e) {
if (e === void 0 && (e = !1), Ln === -1 || e) {
var t = document.createElement("div"), r = t.style;
r.width = "50px", r.height = "50px", r.overflow = "scroll", document.body.appendChild(t), Ln = t.offsetWidth - t.clientWidth, document.body.removeChild(t);
}
return Ln;
}
var rt = null;
function Bi(e) {
if (e === void 0 && (e = !1), rt === null || e) {
var t = document.createElement("div"), r = t.style;
r.width = "50px", r.height = "50px", r.overflow = "scroll", r.direction = "rtl";
var n = document.createElement("div"), i = n.style;
return i.width = "100px", i.height = "100px", t.appendChild(n), document.body.appendChild(t), t.scrollLeft > 0 ? rt = "positive-descending" : (t.scrollLeft = 1, t.scrollLeft === 0 ? rt = "negative" : rt = "positive-ascending"), document.body.removeChild(t), rt;
}
return rt;
}
process.env.NODE_ENV;
var Ws = 150, Hs = function(t, r) {
return t;
}, en = null, rn = null;
process.env.NODE_ENV !== "production" && typeof window < "u" && typeof window.WeakSet < "u" && (en = /* @__PURE__ */ new WeakSet(), rn = /* @__PURE__ */ new WeakSet());
function zs(e) {
var t, r = e.getItemOffset, n = e.getEstimatedTotalSize, i = e.getItemSize, a = e.getOffsetForIndexAndAlignment, s = e.getStartIndexForOffset, f = e.getStopIndexForStartIndex, l = e.initInstanceProps, o = e.shouldResetStyleCacheOnItemSizeChange, c = e.validateProps;
return t = /* @__PURE__ */ function(p) {
Ps(u, p);
function u(g) {
var h;
return h = p.call(this, g) || this, h._instanceProps = l(h.props, Di(h)), h._outerRef = void 0, h._resetIsScrollingTimeoutId = null, h.state = {
instance: Di(h),
isScrolling: !1,
scrollDirection: "forward",
scrollOffset: typeof h.props.initialScrollOffset == "number" ? h.props.initialScrollOffset : 0,
scrollUpdateWasRequested: !1
}, h._callOnItemsRendered = void 0, h._callOnItemsRendered = kn(function(v, S, y, A) {
return h.props.onItemsRendered({
overscanStartIndex: v,
overscanStopIndex: S,
visibleStartIndex: y,
visibleStopIndex: A
});
}), h._callOnScroll = void 0, h._callOnScroll = kn(function(v, S, y) {
return h.props.onScroll({
scrollDirection: v,
scrollOffset: S,
scrollUpdateWasRequested: y
});
}), h._getItemStyle = void 0, h._getItemStyle = function(v) {
var S = h.props, y = S.direction, A = S.itemSize, R = S.layout, B = h._getItemStyleCache(o && A, o && R, o && y), j;
if (B.hasOwnProperty(v))
j = B[v];
else {
var I = r(h.props, v, h._instanceProps), U = i(h.props, v, h._instanceProps), k = y === "horizontal" || R === "horizontal", H = y === "rtl", G = k ? I : 0;
B[v] = j = {
position: "absolute",
left: H ? void 0 : G,
right: H ? G : void 0,
top: k ? 0 : I,
height: k ? "100%" : U,
width: k ? U : "100%"
};
}
return j;
}, h._getItemStyleCache = void 0, h._getItemStyleCache = kn(function(v, S, y) {
return {};
}), h._onScrollHorizontal = function(v) {
var S = v.currentTarget, y = S.clientWidth, A = S.scrollLeft, R = S.scrollWidth;
h.setState(function(B) {
if (B.scrollOffset === A)
return null;
var j = h.props.direction, I = A;
if (j === "rtl")
switch (Bi()) {
case "negative":
I = -A;
break;
case "positive-descending":
I = R - y - A;
break;
}
return I = Math.max(0, Math.min(I, R - y)), {
isScrolling: !0,
scrollDirection: B.scrollOffset < I ? "forward" : "backward",
scrollOffset: I,
scrollUpdateWasRequested: !1
};
}, h._resetIsScrollingDebounced);
}, h._onScrollVertical = function(v) {
var S = v.currentTarget, y = S.clientHeight, A = S.scrollHeight, R = S.scrollTop;
h.setState(function(B) {
if (B.scrollOffset === R)
return null;
var j = Math.max(0, Math.min(R, A - y));
return {
isScrolling: !0,
scrollDirection: B.scrollOffset < j ? "forward" : "backward",
scrollOffset: j,
scrollUpdateWasRequested: !1
};
}, h._resetIsScrollingDebounced);
}, h._outerRefSetter = function(v) {
var S = h.props.outerRef;
h._outerRef = v, typeof S == "function" ? S(v) : S != null && typeof S == "object" && S.hasOwnProperty("current") && (S.current = v);
}, h._resetIsScrollingDebounced = function() {
h._resetIsScrollingTimeoutId !== null && Pi(h._resetIsScrollingTimeoutId), h._resetIsScrollingTimeoutId = Us(h._resetIsScrolling, Ws);
}, h._resetIsScrolling = function() {
h._resetIsScrollingTimeoutId = null, h.setState({
isScrolling: !1
}, function() {
h._getItemStyleCache(-1, null);
});
}, h;
}
u.getDerivedStateFromProps = function(h, v) {
return Vs(h, v), c(h), null;
};
var x = u.prototype;
return x.scrollTo = function(h) {
h = Math.max(0, h), this.setState(function(v) {
return v.scrollOffset === h ? null : {
scrollDirection: v.scrollOffset < h ? "forward" : "backward",
scrollOffset: h,
scrollUpdateWasRequested: !0
};
}, this._resetIsScrollingDebounced);
}, x.scrollToItem = function(h, v) {
v === void 0 && (v = "auto");
var S = this.props, y = S.itemCount, A = S.layout, R = this.state.scrollOffset;
h = Math.max(0, Math.min(h, y - 1));
var B = 0;
if (this._outerRef) {
var j = this._outerRef;
A === "vertical" ? B = j.scrollWidth > j.clientWidth ? Mi() : 0 : B = j.scrollHeight > j.clientHeight ? Mi() : 0;
}
this.scrollTo(a(this.props, h, v, R, this._instanceProps, B));
}, x.componentDidMount = function() {
var h = this.props, v = h.direction, S = h.initialScrollOffset, y = h.layout;
if (typeof S == "number" && this._outerRef != null) {
var A = this._outerRef;
v === "horizontal" || y === "horizontal" ? A.scrollLeft = S : A.scrollTop = S;
}
this._callPropsCallbacks();
}, x.componentDidUpdate = function() {
var h = this.props, v = h.direction, S = h.layout, y = this.state, A = y.scrollOffset, R = y.scrollUpdateWasRequested;
if (R && this._outerRef != null) {
var B = this._outerRef;
if (v === "horizontal" || S === "horizontal")
if (v === "rtl")
switch (Bi()) {
case "negative":
B.scrollLeft = -A;
break;
case "positive-ascending":
B.scrollLeft = A;
break;
default:
var j = B.clientWidth, I = B.scrollWidth;
B.scrollLeft = I - j - A;
break;
}
else
B.scrollLeft = A;
else
B.scrollTop = A;
}
this._callPropsCallbacks();
}, x.componentWillUnmount = function() {
this._resetIsScrollingTimeoutId !== null && Pi(this._resetIsScrollingTimeoutId);
}, x.render = function() {
var h = this.props, v = h.children, S = h.className, y = h.direction, A = h.height, R = h.innerRef, B = h.innerElementType, j = h.innerTagName, I = h.itemCount, U = h.itemData, k = h.itemKey, H = k === void 0 ? Hs : k, G = h.layout, X = h.outerElementType, Q = h.outerTagName, ve = h.style, le = h.useIsScrolling, ne = h.width, fe = this.state.isScrolling, xe = y === "horizontal" || G === "horizontal", ue = xe ? this._onScrollHorizontal : this._onScrollVertical, de = this._getRangeToRender(), me = de[0], F = de[1], N = [];
if (I > 0)
for (var C = me; C <= F; C++)
N.push(Qt(v, {
data: U,
key: H(C, U),
index: C,
isScrolling: le ? fe : void 0,
style: this._getItemStyle(C)
}));
var O = n(this.props, this._instanceProps);
return Qt(X || Q || "div", {
className: S,
onScroll: ue,
ref: this._outerRefSetter,
style: $n({
position: "relative",
height: A,
width: ne,
overflow: "auto",
WebkitOverflowScrolling: "touch",
willChange: "transform",
direction: y
}, ve)
}, Qt(B || j || "div", {
children: N,
ref: R,
style: {
height: xe ? "100%" : O,
pointerEvents: fe ? "none" : void 0,
width: xe ? O : "100%"
}
}));
}, x._callPropsCallbacks = function() {
if (typeof this.props.onItemsRendered == "function") {
var h = this.props.itemCount;
if (h > 0) {
var v = this._getRangeToRender(), S = v[0], y = v[1], A = v[2], R = v[3];
this._callOnItemsRendered(S, y, A, R);
}
}
if (typeof this.props.onScroll == "function") {
var B = this.state, j = B.scrollDirection, I = B.scrollOffset, U = B.scrollUpdateWasRequested;
this._callOnScroll(j, I, U);
}
}, x._getRangeToRender = function() {
var h = this.props, v = h.itemCount, S = h.overscanCount, y = this.state, A = y.isScrolling, R = y.scrollDirection, B = y.scrollOffset;
if (v === 0)
return [0, 0, 0, 0];
var j = s(this.props, B, this._instanceProps), I = f(this.props, j, B, this._instanceProps), U = !A || R === "backward" ? Math.max(1, S) : 1, k = !A || R === "forward" ? Math.max(1, S) : 1;
return [Math.max(0, j - U), Math.max(0, Math.min(v - 1, I + k)), j, I];
}, u;
}(ks), t.defaultProps = {
direction: "ltr",
itemData: void 0,
layout: "vertical",
overscanCount: 2,
useIsScrolling: !1
}, t;
}
var Vs = function(t, r) {
var n = t.children, i = t.direction, a = t.height, s = t.layout, f = t.innerTagName, l = t.outerTagName, o = t.width, c = r.instance;
if (process.env.NODE_ENV !== "production") {
(f != null || l != null) && rn && !rn.has(c) && (rn.add(c), console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));
var p = i === "horizontal" || s === "horizontal";
switch (i) {
case "horizontal":
case "vertical":
en && !en.has(c) && (en.add(c), console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));
break;
case "ltr":
case "rtl":
break;
default:
throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". ' + ('"' + i + '" was specified.'));
}
switch (s) {
case "horizontal":
case "vertical":
break;
default:
throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". ' + ('"' + s + '" was specified.'));
}
if (n == null)
throw Error('An invalid "children" prop has been specified. Value should be a React component. ' + ('"' + (n === null ? "null" : typeof n) + '" was specified.'));
if (p && typeof o != "number")
throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. ' + ('"' + (o === null ? "null" : typeof o) + '" was specified.'));
if (!p && typeof a != "number")
throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. ' + ('"' + (a === null ? "null" : typeof a) + '" was specified.'));
}
}, Gs = 50, st = function(t, r, n) {
var i = t, a = i.itemSize, s = n.itemMetadataMap, f = n.lastMeasuredIndex;
if (r > f) {
var l = 0;
if (f >= 0) {
var o = s[f];
l = o.offset + o.size;
}
for (var c = f + 1; c <= r; c++) {
var p = a(c);
s[c] = {
offset: l,
size: p
}, l += p;
}
n.lastMeasuredIndex = r;
}
return s[r];
}, Xs = function(t, r, n) {
var i = r.itemMetadataMap, a = r.lastMeasuredIndex, s = a > 0 ? i[a].offset : 0;
return s >= n ? Na(t, r, a, 0, n) : $s(t, r, Math.max(0, a), n);
}, Na = function(t, r, n, i, a) {
for (; i <= n; ) {
var s = i + Math.floor((n - i) / 2), f = st(t, s, r).offset;
if (f === a)
return s;
f < a ? i = s + 1 : f > a && (n = s - 1);
}
return i > 0 ? i - 1 : 0;
}, $s = function(t, r, n, i) {
for (var a = t.itemCount, s = 1; n < a && st(t, n, r).offset < i; )
n += s, s *= 2;
return Na(t, r, Math.min(n, a - 1), Math.floor(n / 2), i);
}, bi = function(t, r) {
var n = t.itemCount, i = r.itemMetadataMap, a = r.estimatedItemSize, s = r.lastMeasuredIndex, f = 0;
if (s >= n && (s = n - 1), s >= 0) {
var l = i[s];
f = l.offset + l.size;
}
var o = n - s - 1, c = o * a;
return f + c;
}, js = /* @__PURE__ */ zs({
getItemOffset: function(t, r, n) {
return st(t, r, n).offset;
},
getItemSize: function(t, r, n) {
return n.itemMetadataMap[r].size;
},
getEstimatedTotalSize: bi,
getOffsetForIndexAndAlignment: function(t, r, n, i, a, s) {
var f = t.direction, l = t.height, o = t.layout, c = t.width, p = f === "horizontal" || o === "horizontal", u = p ? c : l, x = st(t, r, a), g = bi(t, a), h = Math.max(0, Math.min(g - u, x.offset)), v = Math.max(0, x.offset - u + x.size + s);
switch (n === "smart" && (i >= v - u && i <= h + u ? n = "auto" : n = "center"), n) {
case "start":
return h;
case "end":
return v;
case "center":
return Math.round(v + (h - v) / 2);
case "auto":
default:
return i >= v && i <= h ? i : i < v ? v : h;
}
},
getStartIndexForOffset: function(t, r, n) {
return Xs(t, n, r);
},
getStopIndexForStartIndex: function(t, r, n, i) {
for (var a = t.direction, s = t.height, f = t.itemCount, l = t.layout, o = t.width, c = a === "horizontal" || l === "horizontal", p = c ? o : s, u = st(t, r, i), x = n + p, g = u.offset + u.size, h = r; h < f - 1 && g < x; )
h++, g += st(t, h, i).size;
return h;
},
initInstanceProps: function(t, r) {
var n = t, i = n.estimatedItemSize, a = {
itemMetadataMap: {},
estimatedItemSize: i || Gs,
lastMeasuredIndex: -1
};
return r.resetAfterIndex = function(s, f) {
f === void 0 && (f = !0), a.lastMeasuredIndex = Math.min(a.lastMeasuredIndex, s - 1), r._getItemStyleCache(-1), f && r.forceUpdate();
}, a;
},
shouldResetStyleCacheOnItemSizeChange: !1,
validateProps: function(t) {
var r = t.itemSize;
if (process.env.NODE_ENV !== "production" && typeof r != "function")
throw Error('An invalid "itemSize" prop has been specified. Value should be a function. ' + ('"' + (r === null ? "null" : typeof r) + '" was specified.'));
}
}), Da = {
color: void 0,
size: void 0,
className: void 0,
style: void 0,
attr: void 0
}, Ui = Qe.createContext && Qe.createContext(Da), Mr = function() {
return Mr = Object.assign || function(e) {
for (var t, r = 1, n = arguments.length; r < n; r++) {
t = arguments[r];
for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
}
return e;
}, Mr.apply(this, arguments);
}, Ks = function(e, t) {
var r = {};
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (r[n[i]] = e[n[i]]);
return r;
};
function ka(e) {
return e && e.map(function(t, r) {
return Qe.createElement(t.tag, Mr({
key: r
}, t.attr), ka(t.child));
});
}
function Ys(e) {
return function(t) {
return Qe.createElement(Js, Mr({
attr: Mr({}, e.attr)
}, t), ka(e.child));
};
}
function Js(e) {
var t = function(r) {
var n = e.attr, i = e.size, a = e.title, s = Ks(e, ["attr", "size", "title"]), f = i || r.size || "1em", l;
return r.className && (l = r.className), e.className && (l = (l ? l + " " : "") + e.className), Qe.createElement("svg", Mr({
stroke: "currentColor",
fill: "currentColor",
strokeWidth: "0"
}, r.attr, n, s, {
className: l,
style: Mr(Mr({
color: e.color || r.color
}, r.style), e.style),
height: f,
width: f,
xmlns: "http://www.w3.org/2000/svg"
}), a && Qe.createElement("title", null, a), e.children);
};
return Ui !== void 0 ? Qe.createElement(Ui.Consumer, null, function(r) {
return t(r);
}) : t(Da);
}
function qs(e) {
return Ys({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm60.1 106.5L224 336l60.1 93.5c5.1 8-.6 18.5-10.1 18.5h-34.9c-4.4 0-8.5-2.4-10.6-6.3C208.9 405.5 192 373 192 373c-6.4 14.8-10 20-36.6 68.8-2.1 3.9-6.1 6.3-10.5 6.3H110c-9.5 0-15.2-10.5-10.1-18.5l60.3-93.5-60.3-93.5c-5.2-8 .6-18.5 10.1-18.5h34.8c4.4 0 8.5 2.4 10.6 6.3 26.1 48.8 20 33.6 36.6 68.5 0 0 6.1-11.7 36.6-68.5 2.1-3.9 6.2-6.3 10.6-6.3H274c9.5-.1 15.2 10.4 10.1 18.4zM384 121.9v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z" } }] })(e);
}
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
var tn = {};
tn.version = "0.18.5";
var La = 1252, Zs = [874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1e4], Pa = function(e) {
Zs.indexOf(e) != -1 && (La = e);
};
function Qs() {
Pa(1252);
}
var Rt = function(e) {
Pa(e);
};
function ef() {
Rt(1200), Qs();
}
var Xt = function(t) {
return String.fromCharCode(t);
}, Wi = function(t) {
return String.fromCharCode(t);
}, nn, Lr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
function Nt(e) {
for (var t = "", r = 0, n = 0, i = 0, a = 0, s = 0, f = 0, l = 0, o = 0; o < e.length; )
r = e.charCodeAt(o++), a = r >> 2, n = e.charCodeAt(o++), s = (r & 3) << 4 | n >> 4, i = e.charCodeAt(o++), f = (n & 15) << 2 | i >> 6, l = i & 63, isNaN(n) ? f = l = 64 : isNaN(i) && (l = 64), t += Lr.charAt(a) + Lr.charAt(s) + Lr.charAt(f) + Lr.charAt(l);
return t;
}
function Rr(e) {
var t = "", r = 0, n = 0, i = 0, a = 0, s = 0, f = 0, l = 0;
e = e.replace(/[^\w\+\/\=]/g, "");
for (var o = 0; o < e.length; )
a = Lr.indexOf(e.charAt(o++)), s = Lr.indexOf(e.charAt(o++)), r = a << 2 | s >> 4, t += String.fromCharCode(r), f = Lr.indexOf(e.charAt(o++)), n = (s & 15) << 4 | f >> 2, f !== 64 && (t += String.fromCharCode(n)), l = Lr.indexOf(e.charAt(o++)), i = (f & 3) << 6 | l, l !== 64 && (t += String.fromCharCode(i));
return t;
}
var _e = /* @__PURE__ */ function() {
return typeof Buffer < "u" && typeof process < "u" && typeof process.versions < "u" && !!process.versions.node;
}(), Dr = /* @__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 $r(e) {
return _e ? Buffer.alloc ? Buffer.alloc(e) : new Buffer(e) : typeof Uint8Array < "u" ? new Uint8Array(e) : new Array(e);
}
function Hi(e) {
return _e ? Buffer.allocUnsafe ? Buffer.allocUnsafe(e) : new Buffer(e) : typeof Uint8Array < "u" ? new Uint8Array(e) : new Array(e);
}
var mr = function(t) {
return _e ? Dr(t, "binary") : t.split("").map(function(r) {
return r.charCodeAt(0) & 255;
});
};
function gn(e) {
if (typeof ArrayBuffer > "u") return mr(e);
for (var t = new ArrayBuffer(e.length), r = new Uint8Array(t), n = 0; n != e.length; ++n) r[n] = e.charCodeAt(n) & 255;
return t;
}
function Bt(e) {
if (Array.isArray(e)) return e.map(function(n) {
return String.fromCharCode(n);
}).join("");
for (var t = [], r = 0; r < e.length; ++r) t[r] = String.fromCharCode(e[r]);
return t.join("");
}
function rf(e) {
if (typeof Uint8Array > "u") throw new Error("Unsupported");
return new Uint8Array(e);
}
var Ve = _e ? function(e) {
return Buffer.concat(e.map(function(t) {
return Buffer.isBuffer(t) ? t : Dr(t);
}));
} : function(e) {
if (typeof Uint8Array < "u") {
var t = 0, r = 0;
for (t = 0; t < e.length; ++t) r += e[t].length;
var n = new Uint8Array(r), i = 0;
for (t = 0, r = 0; t < e.length; r += i, ++t)
if (i = e[t].length, e[t] instanceof Uint8Array) n.set(e[t], r);
else {
if (typeof e[t] == "string")
throw "wtf";
n.set(new Uint8Array(e[t]), r);
}
return n;
}
return [].concat.apply([], e.map(function(a) {
return Array.isArray(a) ? a : [].slice.call(a);
}));
};
function tf(e) {
for (var t = [], r = 0, n = e.length + 250, i = $r(e.length + 255), a = 0; a < e.length; ++a) {
var s = e.charCodeAt(a);
if (s < 128) i[r++] = s;
else if (s < 2048)
i[r++] = 192 | s >> 6 & 31, i[r++] = 128 | s & 63;
else if (s >= 55296 && s < 57344) {
s = (s & 1023) + 64;
var f = e.charCodeAt(++a) & 1023;
i[r++] = 240 | s >> 8 & 7, i[r++] = 128 | s >> 2 & 63, i[r++] = 128 | f >> 6 & 15 | (s & 3) << 4, i[r++] = 128 | f & 63;
} else
i[r++] = 224 | s >> 12 & 15, i[r++] = 128 | s >> 6 & 63, i[r++] = 128 | s & 63;
r > n && (t.push(i.slice(0, r)), r = 0, i = $r(65535), n = 65530);
}
return t.push(i.slice(0, r)), Ve(t);
}
var At = /\u0000/g, $t = /[\u0001-\u0006]/g;
function ot(e) {
for (var t = "", r = e.length - 1; r >= 0; ) t += e.charAt(r--);
return t;
}
function gr(e, t) {
var r = "" + e;
return r.length >= t ? r : De("0", t - r.length) + r;
}
function ei(e, t) {
var r = "" + e;
return r.length >= t ? r : De(" ", t - r.length) + r;
}
function an(e, t) {
var r = "" + e;
return r.length >= t ? r : r + De(" ", t - r.length);
}
function nf(e, t) {
var r = "" + Math.round(e);
return r.length >= t ? r : De("0", t - r.length) + r;
}
function af(e, t) {
var r = "" + e;
return r.length >= t ? r : De("0", t - r.length) + r;
}
var zi = /* @__PURE__ */ Math.pow(2, 32);
function tt(e, t) {
if (e > zi || e < -zi) return nf(e, t);
var r = Math.round(e);
return af(r, t);
}
function sn(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 Vi = [
["Sun", "Sunday"],
["Mon", "Monday"],
["Tue", "Tuesday"],
["Wed", "Wednesday"],
["Thu", "Thursday"],
["Fri", "Friday"],
["Sat", "Saturday"]
], Pn = [
["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 sf(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 ke = {
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"秒 "'
}, Gi = {
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)
}, ff = {
// 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 fn(e, t, r) {
for (var n = e < 0 ? -1 : 1, i = e * n, a = 0, s = 1, f = 0, l = 1, o = 0, c = 0, p = Math.floor(i); o < t && (p = Math.floor(i), f = p * s + a, c = p * o + l, !(i - p < 5e-8)); )
i = 1 / (i - p), a = s, s = f, l = o, o = c;
if (c > t && (o > t ? (c = l, f = a) : (c = o, f = s)), !r) return [0, n * f, c];
var u = Math.floor(n * f / c);
return [u, n * f - u * c, c];
}
function jt(e, t, r) {
if (e > 2958465 || e < 0) return null;
var n = e | 0, i = Math.floor(86400 * (e - n)), a = 0, s = [], f = { D: n, T: i, u: 86400 * (e - n) - i, 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 && (n += 1462), f.u > 0.9999 && (f.u = 0, ++i == 86400 && (f.T = i = 0, ++n, ++f.D)), n === 60)
s = r ? [1317, 10, 29] : [1900, 2, 29], a = 3;
else if (n === 0)
s = r ? [1317, 8, 29] : [1900, 1, 0], a = 6;
else {
n > 60 && --n;
var l = new Date(1900, 0, 1);
l.setDate(l.getDate() + n - 1), s = [l.getFullYear(), l.getMonth() + 1, l.getDate()], a = l.getDay(), n < 60 && (a = (a + 6) % 7), r && (a = df(l, s));
}
return f.y = s[0], f.m = s[1], f.d = s[2], f.S = i % 60, i = Math.floor(i / 60), f.M = i % 60, i = Math.floor(i / 60), f.H = i, f.q = a, f;
}
var Ma = /* @__PURE__ */ new Date(1899, 11, 31, 0, 0, 0), of = /* @__PURE__ */ Ma.getTime(), lf = /* @__PURE__ */ new Date(1900, 2, 1, 0, 0, 0);
function Ba(e, t) {
var r = /* @__PURE__ */ e.getTime();
return t ? r -= 1461 * 24 * 60 * 60 * 1e3 : e >= lf && (r += 24 * 60 * 60 * 1e3), (r - (of + (/* @__PURE__ */ e.getTimezoneOffset() - /* @__PURE__ */ Ma.getTimezoneOffset()) * 6e4)) / (24 * 60 * 60 * 1e3);
}
function ri(e) {
return e.indexOf(".") == -1 ? e : e.replace(/(?:\.0*|(\.\d*[1-9])0+)$/, "$1");
}
function cf(e) {
return e.indexOf("E") == -1 ? e : e.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/, "$1E").replace(/(E[+-])(\d)$/, "$10$2");
}
function hf(e) {
var t = e < 0 ? 12 : 11, r = ri(e.toFixed(12));
return r.length <= t || (r = e.toPrecision(10), r.length <= t) ? r : e.toExponential(5);
}
function uf(e) {
var t = ri(e.toFixed(11));
return t.length > (e < 0 ? 12 : 11) || t === "0" || t === "-0" ? e.toPrecision(6) : t;
}
function xf(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 = hf(e) : t === 10 ? r = e.toFixed(10).substr(0, 12) : r = uf(e), ri(cf(r.toUpperCase()));
}
function Kn(e, t) {
switch (typeof e) {
case "string":
return e;
case "boolean":
return e ? "TRUE" : "FALSE";
case "number":
return (e | 0) === e ? e.toString(10) : xf(e);
case "undefined":
return "";
case "object":
if (e == null) return "";
if (e instanceof Date) return Br(14, Ba(e, t && t.date1904), t);
}
throw new Error("unsupported value in General format: " + e);
}
function df(e, t) {
t[0] -= 581;
var r = e.getDay();
return e < 60 && (r = (r + 6) % 7), r;
}
function pf(e, t, r, n) {
var i = "", a = 0, s = 0, f = r.y, l, o = 0;
switch (e) {
case 98:
f = r.y + 543;
case 121:
switch (t.length) {
case 1:
case 2:
l = f % 100, o = 2;
break;
default:
l = f % 1e4, o = 4;
break;
}
break;
case 109:
switch (t.length) {
case 1:
case 2:
l = r.m, o = t.length;
break;
case 3:
return Pn[r.m - 1][1];
case 5:
return Pn[r.m - 1][0];
default:
return Pn[r.m - 1][2];
}
break;
case 100:
switch (t.length) {
case 1:
case 2:
l = r.d, o = t.length;
break;
case 3:
return Vi[r.q][0];
default:
return Vi[r.q][1];
}
break;
case 104:
switch (t.length) {
case 1:
case 2:
l = 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:
l = r.H, o = t.length;
break;
default:
throw "bad hour format: " + t;
}
break;
case 77:
switch (t.length) {
case 1:
case 2:
l = 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") ? gr(r.S, t.length) : (n >= 2 ? s = n === 3 ? 1e3 : 100 : s = n === 1 ? 10 : 1, a = Math.round(s * (r.S + r.u)), a >= 60 * s && (a = 0), t === "s" ? a === 0 ? "0" : "" + a / s : (i = gr(a, 2 + n), t === "ss" ? i.substr(0, 2) : "." + i.substr(2, t.length - 1)));
case 90:
switch (t) {
case "[h]":
case "[hh]":
l = r.D * 24 + r.H;
break;
case "[m]":
case "[mm]":
l = (r.D * 24 + r.H) * 60 + r.M;
break;
case "[s]":
case "[ss]":
l = ((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:
l = f, o = 1;
break;
}
var c = o > 0 ? gr(l, o) : "";
return c;
}
function Pr(e) {
var t = 3;
if (e.length <= t) return e;
for (var r = e.length % t, n = e.substr(0, r); r != e.length; r += t) n += (n.length > 0 ? "," : "") + e.substr(r, t);
return n;
}
var ba = /%/g;
function vf(e, t, r) {
var n = t.replace(ba, ""), i = t.length - n.length;
return Cr(e, n, r * Math.pow(10, 2 * i)) + De("%", i);
}
function mf(e, t, r) {
for (var n = t.length - 1; t.charCodeAt(n - 1) === 44; ) --n;
return Cr(e, t.substr(0, n), r / Math.pow(10, 3 * (t.length - n)));
}
function Ua(e, t) {
var r, n = e.indexOf("E") - e.indexOf(".") - 1;
if (e.match(/^#+0.0E\+0$/)) {
if (t == 0) return "0.0E+0";
if (t < 0) return "-" + Ua(e, -t);
var i = e.indexOf(".");
i === -1 && (i = e.indexOf("E"));
var a = Math.floor(Math.log(t) * Math.LOG10E) % i;
if (a < 0 && (a += i), r = (t / Math.pow(10, a)).toPrecision(n + 1 + (i + a) % i), 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 + a) : r += "E+" + (s - a); r.substr(0, 2) === "0."; )
r = r.charAt(0) + r.substr(2, i) + "." + r.substr(2 + i), r = r.replace(/^0+([1-9])/, "$1").replace(/^0+\./, "0.");
r = r.replace(/\+-/, "-");
}
r = r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function(f, l, o, c) {
return l + o + c.substr(0, (i + a) % i) + "." + c.substr(a) + "E";
});
} else r = t.toExponential(n);
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 Wa = /# (\?+)( ?)\/( ?)(\d+)/;
function gf(e, t, r) {
var n = parseInt(e[4], 10), i = Math.round(t * n), a = Math.floor(i / n), s = i - a * n, f = n;
return r + (a === 0 ? "" : "" + a) + " " + (s === 0 ? De(" ", e[1].length + 1 + e[4].length) : ei(s, e[1].length) + e[2] + "/" + e[3] + gr(f, e[4].length));
}
function _f(e, t, r) {
return r + (t === 0 ? "" : "" + t) + De(" ", e[1].length + 2 + e[4].length);
}
var Ha = /^#*0*\.([0#]+)/, za = /\).*[0#]/, Va = /\(###\) ###\\?-####/;
function qe(e) {
for (var t = "", r, n = 0; n != e.length; ++n) switch (r = e.charCodeAt(n)) {
case 35:
break;
case 63:
t += " ";
break;
case 48:
t += "0";
break;
default:
t += String.fromCharCode(r);
}
return t;
}
function Xi(e, t) {
var r = Math.pow(10, t);
return "" + Math.round(e * r) / r;
}
function $i(e, t) {
var r = e - Math.floor(e), n = Math.pow(10, t);
return t < ("" + Math.round(r * n)).length ? 0 : Math.round(r * n);
}
function Tf(e, t) {
return t < ("" + Math.round((e - Math.floor(e)) * Math.pow(10, t))).length ? 1 : 0;
}
function Ef(e) {
return e < 2147483647 && e > -2147483648 ? "" + (e >= 0 ? e | 0 : e - 1 | 0) : "" + Math.floor(e);
}
function hr(e, t, r) {
if (e.charCodeAt(0) === 40 && !t.match(za)) {
var n = t.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
return r >= 0 ? hr("n", n, r) : "(" + hr("n", n, -r) + ")";
}
if (t.charCodeAt(t.length - 1) === 44) return mf(e, t, r);
if (t.indexOf("%") !== -1) return vf(e, t, r);
if (t.indexOf("E") !== -1) return Ua(t, r);
if (t.charCodeAt(0) === 36) return "$" + hr(e, t.substr(t.charAt(1) == " " ? 2 : 1), r);
var i, a, s, f, l = Math.abs(r), o = r < 0 ? "-" : "";
if (t.match(/^00+$/)) return o + tt(l, t.length);
if (t.match(/^[#?]+$/))
return i = tt(r, 0), i === "0" && (i = ""), i.length > t.length ? i : qe(t.substr(0, t.length - i.length)) + i;
if (a = t.match(Wa)) return gf(a, l, o);
if (t.match(/^#+0+$/)) return o + tt(l, t.length - t.indexOf("0"));
if (a = t.match(Ha))
return i = Xi(r, a[1].length).replace(/^([^\.]+)$/, "$1." + qe(a[1])).replace(/\.$/, "." + qe(a[1])).replace(/\.(\d*)$/, function(g, h) {
return "." + h + De("0", qe(
/*::(*/
a[1]
).length - h.length);
}), t.indexOf("0.") !== -1 ? i : i.replace(/^0\./, ".");
if (t = t.replace(/^#+([0.])/, "$1"), a = t.match(/^(0*)\.(#*)$/))
return o + Xi(l, a[2].length).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, a[1].length ? "0." : ".");
if (a = t.match(/^#{1,3},##0(\.?)$/)) return o + Pr(tt(l, 0));
if (a = t.match(/^#,##0\.([#0]*0)$/))
return r < 0 ? "-" + hr(e, t, -r) : Pr("" + (Math.floor(r) + Tf(r, a[1].length))) + "." + gr($i(r, a[1].length), a[1].length);
if (a = t.match(/^#,#*,#0/)) return hr(e, t.replace(/^#,#*,/, ""), r);
if (a = t.match(/^([0#]+)(\\?-([0#]+))+$/))
return i = ot(hr(e, t.replace(/[\\-]/g, ""), r)), s = 0, ot(ot(t.replace(/\\/g, "")).replace(/[0#]/g, function(g) {
return s < i.length ? i.charAt(s++) : g === "0" ? "0" : "";
}));
if (t.match(Va))
return i = hr(e, "##########", r), "(" + i.substr(0, 3) + ") " + i.substr(3, 3) + "-" + i.substr(6);
var c = "";
if (a = t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))
return s = Math.min(
/*::String(*/
a[4].length,
7
), f = fn(l, Math.pow(10, s) - 1, !1), i = "" + o, c = Cr(
"n",
/*::String(*/
a[1],
f[1]
), c.charAt(c.length - 1) == " " && (c = c.substr(0, c.length - 1) + "0"), i += c + /*::String(*/
a[2] + "/" + /*::String(*/
a[3], c = an(f[2], s), c.length < a[4].length && (c = qe(a[4].substr(a[4].length - c.length)) + c), i += c, i;
if (a = t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))
return s = Math.min(Math.max(a[1].length, a[4].length), 7), f = fn(l, Math.pow(10, s) - 1, !0), o + (f[0] || (f[1] ? "" : "0")) + " " + (f[1] ? ei(f[1], s) + a[2] + "/" + a[3] + an(f[2], s) : De(" ", 2 * s + 1 + a[2].length + a[3].length));
if (a = t.match(/^[#0?]+$/))
return i = tt(r, 0), t.length <= i.length ? i : qe(t.substr(0, t.length - i.length)) + i;
if (a = t.match(/^([#0?]+)\.([#0]+)$/)) {
i = "" + r.toFixed(Math.min(a[2].length, 10)).replace(/([^0])0+$/, "$1"), s = i.indexOf(".");
var p = t.indexOf(".") - s, u = t.length - i.length - p;
return qe(t.substr(0, p) + i + t.substr(t.length - u));
}
if (a = t.match(/^00,000\.([#0]*0)$/))
return s = $i(r, a[1].length), r < 0 ? "-" + hr(e, t, -r) : Pr(Ef(r)).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function(g) {
return "00," + (g.length < 3 ? gr(0, 3 - g.length) : "") + g;
}) + "." + gr(s, a[1].length);
switch (t) {
case "###,##0.00":
return hr(e, "#,##0.00", r);
case "###,###":
case "##,###":
case "#,###":
var x = Pr(tt(l, 0));
return x !== "0" ? o + x : "";
case "###,###.00":
return hr(e, "###,##0.00", r).replace(/^0\./, ".");
case "#,###.00":
return hr(e, "#,##0.00", r).replace(/^0\./, ".");
}
throw new Error("unsupported format |" + t + "|");
}
function wf(e, t, r) {
for (var n = t.length - 1; t.charCodeAt(n - 1) === 44; ) --n;
return Cr(e, t.substr(0, n), r / Math.pow(10, 3 * (t.length - n)));
}
function Sf(e, t, r) {
var n = t.replace(ba, ""), i = t.length - n.length;
return Cr(e, n, r * Math.pow(10, 2 * i)) + De("%", i);
}
function Ga(e, t) {
var r, n = e.indexOf("E") - e.indexOf(".") - 1;
if (e.match(/^#+0.0E\+0$/)) {
if (t == 0) return "0.0E+0";
if (t < 0) return "-" + Ga(e, -t);
var i = e.indexOf(".");
i === -1 && (i = e.indexOf("E"));
var a = Math.floor(Math.log(t) * Math.LOG10E) % i;
if (a < 0 && (a += i), r = (t / Math.pow(10, a)).toPrecision(n + 1 + (i + a) % i), !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 + a) : r += "E+" + (s - a), r = r.replace(/\+-/, "-");
}
r = r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function(f, l, o, c) {
return l + o + c.substr(0, (i + a) % i) + "." + c.substr(a) + "E";
});
} else r = t.toExponential(n);
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 Er(e, t, r) {
if (e.charCodeAt(0) === 40 && !t.match(za)) {
var n = t.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
return r >= 0 ? Er("n", n, r) : "(" + Er("n", n, -r) + ")";
}
if (t.charCodeAt(t.length - 1) === 44) return wf(e, t, r);
if (t.indexOf("%") !== -1) return Sf(e, t, r);
if (t.indexOf("E") !== -1) return Ga(t, r);
if (t.charCodeAt(0) === 36) return "$" + Er(e, t.substr(t.charAt(1) == " " ? 2 : 1), r);
var i, a, s, f, l = Math.abs(r), o = r < 0 ? "-" : "";
if (t.match(/^00+$/)) return o + gr(l, t.length);
if (t.match(/^[#?]+$/))
return i = "" + r, r === 0 && (i = ""), i.length > t.length ? i : qe(t.substr(0, t.length - i.length)) + i;
if (a = t.match(Wa)) return _f(a, l, o);
if (t.match(/^#+0+$/)) return o + gr(l, t.length - t.indexOf("0"));
if (a = t.match(Ha))
return i = ("" + r).replace(/^([^\.]+)$/, "$1." + qe(a[1])).replace(/\.$/, "." + qe(a[1])), i = i.replace(/\.(\d*)$/, function(g, h) {
return "." + h + De("0", qe(a[1]).length - h.length);
}), t.indexOf("0.") !== -1 ? i : i.replace(/^0\./, ".");
if (t = t.replace(/^#+([0.])/, "$1"), a = t.match(/^(0*)\.(#*)$/))
return o + ("" + l).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, a[1].length ? "0." : ".");
if (a = t.match(/^#{1,3},##0(\.?)$/)) return o + Pr("" + l);
if (a = t.match(/^#,##0\.([#0]*0)$/))
return r < 0 ? "-" + Er(e, t, -r) : Pr("" + r) + "." + De("0", a[1].length);
if (a = t.match(/^#,#*,#0/)) return Er(e, t.replace(/^#,#*,/, ""), r);
if (a = t.match(/^([0#]+)(\\?-([0#]+))+$/))
return i = ot(Er(e, t.replace(/[\\-]/g, ""), r)), s = 0, ot(ot(t.replace(/\\/g, "")).replace(/[0#]/g, function(g) {
return s < i.length ? i.charAt(s++) : g === "0" ? "0" : "";
}));
if (t.match(Va))
return i = Er(e, "##########", r), "(" + i.substr(0, 3) + ") " + i.substr(3, 3) + "-" + i.substr(6);
var c = "";
if (a = t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))
return s = Math.min(
/*::String(*/
a[4].length,
7
), f = fn(l, Math.pow(10, s) - 1, !1), i = "" + o, c = Cr(
"n",
/*::String(*/
a[1],
f[1]
), c.charAt(c.length - 1) == " " && (c = c.substr(0, c.length - 1) + "0"), i += c + /*::String(*/
a[2] + "/" + /*::String(*/
a[3], c = an(f[2], s), c.length < a[4].length && (c = qe(a[4].substr(a[4].length - c.length)) + c), i += c, i;
if (a = t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))
return s = Math.min(Math.max(a[1].length, a[4].length), 7), f = fn(l, Math.pow(10, s) - 1, !0), o + (f[0] || (f[1] ? "" : "0")) + " " + (f[1] ? ei(f[1], s) + a[2] + "/" + a[3] + an(f[2], s) : De(" ", 2 * s + 1 + a[2].length + a[3].length));
if (a = t.match(/^[#0?]+$/))
return i = "" + r, t.length <= i.length ? i : qe(t.substr(0, t.length - i.length)) + i;
if (a = t.match(/^([#0]+)\.([#0]+)$/)) {
i = "" + r.toFixed(Math.min(a[2].length, 10)).replace(/([^0])0+$/, "$1"), s = i.indexOf(".");
var p = t.indexOf(".") - s, u = t.length - i.length - p;
return qe(t.substr(0, p) + i + t.substr(t.length - u));
}
if (a = t.match(/^00,000\.([#0]*0)$/))
return r < 0 ? "-" + Er(e, t, -r) : Pr("" + r).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function(g) {
return "00," + (g.length < 3 ? gr(0, 3 - g.length) : "") + g;
}) + "." + gr(0, a[1].length);
switch (t) {
case "###,###":
case "##,###":
case "#,###":
var x = Pr("" + l);
return x !== "0" ? o + x : "";
default:
if (t.match(/\.[0#?]*$/)) return Er(e, t.slice(0, t.lastIndexOf(".")), r) + qe(t.slice(t.lastIndexOf(".")));
}
throw new Error("unsupported format |" + t + "|");
}
function Cr(e, t, r) {
return (r | 0) === r ? Er(e, t, r) : hr(e, t, r);
}
function Af(e) {
for (var t = [], r = !1, n = 0, i = 0; n < e.length; ++n) switch (
/*cc=*/
e.charCodeAt(n)
) {
case 34:
r = !r;
break;
case 95:
case 42:
case 92:
++n;
break;
case 59:
t[t.length] = e.substr(i, n - i), i = n + 1;
}
if (t[t.length] = e.substr(i), r === !0) throw new Error("Format |" + e + "| unterminated string ");
return t;
}
var Xa = /\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;
function $a(e) {
for (var t = 0, r = "", n = ""; t < e.length; )
switch (r = e.charAt(t)) {
case "G":
sn(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 (n = r; e.charAt(t++) !== "]" && t < e.length; ) n += e.charAt(t);
if (n.match(Xa)) 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 Ff(e, t, r, n) {
for (var i = [], a = "", s = 0, f = "", l = "t", o, c, p, u = "H"; s < e.length; )
switch (f = e.charAt(s)) {
case "G":
if (!sn(e, s)) throw new Error("unrecognized character " + f + " in " + e);
i[i.length] = { t: "G", v: "General" }, s += 7;
break;
case '"':
for (a = ""; (p = e.charCodeAt(++s)) !== 34 && s < e.length; ) a += String.fromCharCode(p);
i[i.length] = { t: "t", v: a }, ++s;
break;
case "\\":
var x = e.charAt(++s), g = x === "(" || x === ")" ? x : "t";
i[i.length] = { t: g, v: x }, ++s;
break;
case "_":
i[i.length] = { t: "t", v: " " }, s += 2;
break;
case "@":
i[i.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 = jt(t, r, e.charAt(s + 1) === "2"), o == null))
return "";
i[i.length] = { t: "X", v: e.substr(s, 2) }, l = 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 = jt(t, r), o == null))
return "";
for (a = f; ++s < e.length && e.charAt(s).toLowerCase() === f; ) a += f;
f === "m" && l.toLowerCase() === "h" && (f = "M"), f === "h" && (f = u), i[i.length] = { t: f, v: a }, l = f;
break;
case "A":
case "a":
case "上":
var h = { t: f, v: f };
if (o == null && (o = jt(t, r)), e.substr(s, 3).toUpperCase() === "A/P" ? (o != null && (h.v = o.H >= 12 ? "P" : "A"), h.t = "T", u = "h", s += 3) : e.substr(s, 5).toUpperCase() === "AM/PM" ? (o != null && (h.v = o.H >= 12 ? "PM" : "AM"), h.t = "T", s += 5, u = "h") : e.substr(s, 5).toUpperCase() === "上午/下午" ? (o != null && (h.v = o.H >=