@fileverse-dev/dsheet 2.1.3-package-cleanup-3 → 2.1.3-package-cleanup-100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1537 @@
1
+ import { g as Ze } from "./executeStringFunction-CIx20yEd.js";
2
+ import * as Je from "yjs";
3
+ import { m as Qe, y as Ke, r as et } from "./index-CMC8cMib.js";
4
+ import { n as tt } from "./xlsx-hyperlink-inline-DzewAypN.js";
5
+ import { toast as Ie } from "@fileverse/ui";
6
+ var ze = { exports: {} };
7
+ (function(y) {
8
+ var u = {}, g = function(p) {
9
+ p.version = "0.11.2";
10
+ function v(t) {
11
+ for (var r = "", n = t.length - 1; n >= 0; ) r += t.charAt(n--);
12
+ return r;
13
+ }
14
+ function $(t, r) {
15
+ for (var n = ""; n.length < r; ) n += t;
16
+ return n;
17
+ }
18
+ function N(t, r) {
19
+ var n = "" + t;
20
+ return n.length >= r ? n : $("0", r - n.length) + n;
21
+ }
22
+ function R(t, r) {
23
+ var n = "" + t;
24
+ return n.length >= r ? n : $(" ", r - n.length) + n;
25
+ }
26
+ function I(t, r) {
27
+ var n = "" + t;
28
+ return n.length >= r ? n : n + $(" ", r - n.length);
29
+ }
30
+ function J(t, r) {
31
+ var n = "" + Math.round(t);
32
+ return n.length >= r ? n : $("0", r - n.length) + n;
33
+ }
34
+ function F(t, r) {
35
+ var n = "" + t;
36
+ return n.length >= r ? n : $("0", r - n.length) + n;
37
+ }
38
+ var ie = Math.pow(2, 32);
39
+ function re(t, r) {
40
+ if (t > ie || t < -ie) return J(t, r);
41
+ var n = Math.round(t);
42
+ return F(n, r);
43
+ }
44
+ function fe(t, r) {
45
+ return r = r || 0, t.length >= 7 + r && (t.charCodeAt(r) | 32) === 103 && (t.charCodeAt(r + 1) | 32) === 101 && (t.charCodeAt(r + 2) | 32) === 110 && (t.charCodeAt(r + 3) | 32) === 101 && (t.charCodeAt(r + 4) | 32) === 114 && (t.charCodeAt(r + 5) | 32) === 97 && (t.charCodeAt(r + 6) | 32) === 108;
46
+ }
47
+ var Ce = [
48
+ ["Sun", "Sunday"],
49
+ ["Mon", "Monday"],
50
+ ["Tue", "Tuesday"],
51
+ ["Wed", "Wednesday"],
52
+ ["Thu", "Thursday"],
53
+ ["Fri", "Friday"],
54
+ ["Sat", "Saturday"]
55
+ ], Ae = [
56
+ ["J", "Jan", "January"],
57
+ ["F", "Feb", "February"],
58
+ ["M", "Mar", "March"],
59
+ ["A", "Apr", "April"],
60
+ ["M", "May", "May"],
61
+ ["J", "Jun", "June"],
62
+ ["J", "Jul", "July"],
63
+ ["A", "Aug", "August"],
64
+ ["S", "Sep", "September"],
65
+ ["O", "Oct", "October"],
66
+ ["N", "Nov", "November"],
67
+ ["D", "Dec", "December"]
68
+ ];
69
+ function Ee(t) {
70
+ t[0] = "General", t[1] = "0", t[2] = "0.00", t[3] = "#,##0", t[4] = "#,##0.00", t[9] = "0%", t[10] = "0.00%", t[11] = "0.00E+00", t[12] = "# ?/?", t[13] = "# ??/??", t[14] = "m/d/yy", t[15] = "d-mmm-yy", t[16] = "d-mmm", t[17] = "mmm-yy", t[18] = "h:mm AM/PM", t[19] = "h:mm:ss AM/PM", t[20] = "h:mm", t[21] = "h:mm:ss", t[22] = "m/d/yy h:mm", t[37] = "#,##0 ;(#,##0)", t[38] = "#,##0 ;[Red](#,##0)", t[39] = "#,##0.00;(#,##0.00)", t[40] = "#,##0.00;[Red](#,##0.00)", t[45] = "mm:ss", t[46] = "[h]:mm:ss", t[47] = "mmss.0", t[48] = "##0.0E+0", t[49] = "@", t[56] = '"上午/下午 "hh"時"mm"分"ss"秒 "';
71
+ }
72
+ var ce = {};
73
+ Ee(ce);
74
+ var Q = [], M = 0;
75
+ for (M = 5; M <= 8; ++M) Q[M] = 32 + M;
76
+ for (M = 23; M <= 26; ++M) Q[M] = 0;
77
+ for (M = 27; M <= 31; ++M) Q[M] = 14;
78
+ for (M = 50; M <= 58; ++M) Q[M] = 14;
79
+ for (M = 59; M <= 62; ++M) Q[M] = M - 58;
80
+ for (M = 67; M <= 68; ++M) Q[M] = M - 58;
81
+ for (M = 72; M <= 75; ++M) Q[M] = M - 58;
82
+ for (M = 67; M <= 68; ++M) Q[M] = M - 57;
83
+ for (M = 76; M <= 78; ++M) Q[M] = M - 56;
84
+ for (M = 79; M <= 81; ++M) Q[M] = M - 34;
85
+ var G = [];
86
+ G[5] = G[63] = '"$"#,##0_);\\("$"#,##0\\)', G[6] = G[64] = '"$"#,##0_);[Red]\\("$"#,##0\\)', G[7] = G[65] = '"$"#,##0.00_);\\("$"#,##0.00\\)', G[8] = G[66] = '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', G[41] = '_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)', G[42] = '_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)', G[43] = '_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)', G[44] = '_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)';
87
+ function we(t, r, n) {
88
+ for (var m = t < 0 ? -1 : 1, e = t * m, d = 0, a = 1, f = 0, C = 1, l = 0, _ = 0, A = Math.floor(e); l < r && (A = Math.floor(e), f = A * a + d, _ = A * l + C, !(e - A < 5e-8)); )
89
+ e = 1 / (e - A), d = a, a = f, C = l, l = _;
90
+ if (_ > r && (l > r ? (_ = C, f = d) : (_ = l, f = a)), !n) return [0, m * f, _];
91
+ var D = Math.floor(m * f / _);
92
+ return [D, m * f - D * _, _];
93
+ }
94
+ function ye(t, r, n) {
95
+ if (t > 2958465 || t < 0) return null;
96
+ var m = t | 0, e = Math.floor(86400 * (t - m)), d = 0, a = [], f = { D: m, T: e, u: 86400 * (t - m) - e, y: 0, m: 0, d: 0, H: 0, M: 0, S: 0, q: 0 };
97
+ if (Math.abs(f.u) < 1e-6 && (f.u = 0), r && r.date1904 && (m += 1462), f.u > 0.9999 && (f.u = 0, ++e == 86400 && (f.T = e = 0, ++m, ++f.D)), m === 60)
98
+ a = n ? [1317, 10, 29] : [1900, 2, 29], d = 3;
99
+ else if (m === 0)
100
+ a = n ? [1317, 8, 29] : [1900, 1, 0], d = 6;
101
+ else {
102
+ m > 60 && --m;
103
+ var C = new Date(1900, 0, 1);
104
+ C.setDate(C.getDate() + m - 1), a = [C.getFullYear(), C.getMonth() + 1, C.getDate()], d = C.getDay(), m < 60 && (d = (d + 6) % 7), n && (d = Fe(C, a));
105
+ }
106
+ return f.y = a[0], f.m = a[1], f.d = a[2], f.S = e % 60, e = Math.floor(e / 60), f.M = e % 60, e = Math.floor(e / 60), f.H = e, f.q = d, f;
107
+ }
108
+ p.parse_date_code = ye;
109
+ var Se = new Date(1899, 11, 31, 0, 0, 0), Re = Se.getTime(), Le = new Date(1900, 2, 1, 0, 0, 0);
110
+ function Ne(t, r) {
111
+ var n = t.getTime();
112
+ return r ? n -= 1262304e5 : t >= Le && (n += 864e5), (n - (Re + (t.getTimezoneOffset() - Se.getTimezoneOffset()) * 6e4)) / 864e5;
113
+ }
114
+ function He(t) {
115
+ return t.toString(10);
116
+ }
117
+ p._general_int = He;
118
+ var Te = /* @__PURE__ */ function() {
119
+ var r = /(?:\.0*|(\.\d*[1-9])0+)$/;
120
+ function n(l) {
121
+ return l.indexOf(".") == -1 ? l : l.replace(r, "$1");
122
+ }
123
+ var m = /(?:\.0*|(\.\d*[1-9])0+)[Ee]/, e = /(E[+-])(\d)$/;
124
+ function d(l) {
125
+ return l.indexOf("E") == -1 ? l : l.replace(m, "$1E").replace(e, "$10$2");
126
+ }
127
+ function a(l) {
128
+ var _ = l < 0 ? 12 : 11, A = n(l.toFixed(12));
129
+ return A.length <= _ || (A = l.toPrecision(10), A.length <= _) ? A : l.toExponential(5);
130
+ }
131
+ function f(l) {
132
+ var _ = n(l.toFixed(11));
133
+ return _.length > (l < 0 ? 12 : 11) || _ === "0" || _ === "-0" ? l.toPrecision(6) : _;
134
+ }
135
+ function C(l) {
136
+ var _ = Math.floor(Math.log(Math.abs(l)) * Math.LOG10E), A;
137
+ return _ >= -4 && _ <= -1 ? A = l.toPrecision(10 + _) : Math.abs(_) <= 9 ? A = a(l) : _ === 10 ? A = l.toFixed(10).substr(0, 12) : A = f(l), n(d(A.toUpperCase()));
138
+ }
139
+ return C;
140
+ }();
141
+ p._general_num = Te;
142
+ function ge(t, r) {
143
+ switch (typeof t) {
144
+ case "string":
145
+ return t;
146
+ case "boolean":
147
+ return t ? "TRUE" : "FALSE";
148
+ case "number":
149
+ return (t | 0) === t ? t.toString(10) : Te(t);
150
+ case "undefined":
151
+ return "";
152
+ case "object":
153
+ if (t == null) return "";
154
+ if (t instanceof Date) return de(14, Ne(t, r && r.date1904), r);
155
+ }
156
+ throw new Error("unsupported value in General format: " + t);
157
+ }
158
+ p._general = ge;
159
+ function Fe(t, r) {
160
+ r[0] -= 581;
161
+ var n = t.getDay();
162
+ return t < 60 && (n = (n + 6) % 7), n;
163
+ }
164
+ function Ve(t, r, n, m) {
165
+ var e = "", d = 0, a = 0, f = n.y, C, l = 0;
166
+ switch (t) {
167
+ case 98:
168
+ f = n.y + 543;
169
+ case 121:
170
+ switch (r.length) {
171
+ case 1:
172
+ case 2:
173
+ C = f % 100, l = 2;
174
+ break;
175
+ default:
176
+ C = f % 1e4, l = 4;
177
+ break;
178
+ }
179
+ break;
180
+ case 109:
181
+ switch (r.length) {
182
+ case 1:
183
+ case 2:
184
+ C = n.m, l = r.length;
185
+ break;
186
+ case 3:
187
+ return Ae[n.m - 1][1];
188
+ case 5:
189
+ return Ae[n.m - 1][0];
190
+ default:
191
+ return Ae[n.m - 1][2];
192
+ }
193
+ break;
194
+ case 100:
195
+ switch (r.length) {
196
+ case 1:
197
+ case 2:
198
+ C = n.d, l = r.length;
199
+ break;
200
+ case 3:
201
+ return Ce[n.q][0];
202
+ default:
203
+ return Ce[n.q][1];
204
+ }
205
+ break;
206
+ case 104:
207
+ switch (r.length) {
208
+ case 1:
209
+ case 2:
210
+ C = 1 + (n.H + 11) % 12, l = r.length;
211
+ break;
212
+ default:
213
+ throw "bad hour format: " + r;
214
+ }
215
+ break;
216
+ case 72:
217
+ switch (r.length) {
218
+ case 1:
219
+ case 2:
220
+ C = n.H, l = r.length;
221
+ break;
222
+ default:
223
+ throw "bad hour format: " + r;
224
+ }
225
+ break;
226
+ case 77:
227
+ switch (r.length) {
228
+ case 1:
229
+ case 2:
230
+ C = n.M, l = r.length;
231
+ break;
232
+ default:
233
+ throw "bad minute format: " + r;
234
+ }
235
+ break;
236
+ case 115:
237
+ if (r != "s" && r != "ss" && r != ".0" && r != ".00" && r != ".000") throw "bad second format: " + r;
238
+ return n.u === 0 && (r == "s" || r == "ss") ? N(n.S, r.length) : (m >= 2 ? a = m === 3 ? 1e3 : 100 : a = m === 1 ? 10 : 1, d = Math.round(a * (n.S + n.u)), d >= 60 * a && (d = 0), r === "s" ? d === 0 ? "0" : "" + d / a : (e = N(d, 2 + m), r === "ss" ? e.substr(0, 2) : "." + e.substr(2, r.length - 1)));
239
+ case 90:
240
+ switch (r) {
241
+ case "[h]":
242
+ case "[hh]":
243
+ C = n.D * 24 + n.H;
244
+ break;
245
+ case "[m]":
246
+ case "[mm]":
247
+ C = (n.D * 24 + n.H) * 60 + n.M;
248
+ break;
249
+ case "[s]":
250
+ case "[ss]":
251
+ C = ((n.D * 24 + n.H) * 60 + n.M) * 60 + Math.round(n.S + n.u);
252
+ break;
253
+ default:
254
+ throw "bad abstime format: " + r;
255
+ }
256
+ l = r.length === 3 ? 1 : 2;
257
+ break;
258
+ case 101:
259
+ C = f, l = 1;
260
+ break;
261
+ }
262
+ var _ = l > 0 ? N(C, l) : "";
263
+ return _;
264
+ }
265
+ function oe(t) {
266
+ var r = 3;
267
+ if (t.length <= r) return t;
268
+ for (var n = t.length % r, m = t.substr(0, n); n != t.length; n += r) m += (m.length > 0 ? "," : "") + t.substr(n, r);
269
+ return m;
270
+ }
271
+ var ne = /* @__PURE__ */ function() {
272
+ var r = /%/g;
273
+ function n(h, i, c) {
274
+ var k = i.replace(r, ""), o = i.length - k.length;
275
+ return ne(h, k, c * Math.pow(10, 2 * o)) + $("%", o);
276
+ }
277
+ function m(h, i, c) {
278
+ for (var k = i.length - 1; i.charCodeAt(k - 1) === 44; ) --k;
279
+ return ne(h, i.substr(0, k), c / Math.pow(10, 3 * (i.length - k)));
280
+ }
281
+ function e(h, i) {
282
+ var c, k = h.indexOf("E") - h.indexOf(".") - 1;
283
+ if (h.match(/^#+0.0E\+0$/)) {
284
+ if (i == 0) return "0.0E+0";
285
+ if (i < 0) return "-" + e(h, -i);
286
+ var o = h.indexOf(".");
287
+ o === -1 && (o = h.indexOf("E"));
288
+ var s = Math.floor(Math.log(i) * Math.LOG10E) % o;
289
+ if (s < 0 && (s += o), c = (i / Math.pow(10, s)).toPrecision(k + 1 + (o + s) % o), c.indexOf("e") === -1) {
290
+ var E = Math.floor(Math.log(i) * Math.LOG10E);
291
+ for (c.indexOf(".") === -1 ? c = c.charAt(0) + "." + c.substr(1) + "E+" + (E - c.length + s) : c += "E+" + (E - s); c.substr(0, 2) === "0."; )
292
+ c = c.charAt(0) + c.substr(2, o) + "." + c.substr(2 + o), c = c.replace(/^0+([1-9])/, "$1").replace(/^0+\./, "0.");
293
+ c = c.replace(/\+-/, "-");
294
+ }
295
+ c = c.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function(H, j, W, S) {
296
+ return j + W + S.substr(0, (o + s) % o) + "." + S.substr(s) + "E";
297
+ });
298
+ } else c = i.toExponential(k);
299
+ return h.match(/E\+00$/) && c.match(/e[+-]\d$/) && (c = c.substr(0, c.length - 1) + "0" + c.charAt(c.length - 1)), h.match(/E\-/) && c.match(/e\+/) && (c = c.replace(/e\+/, "e")), c.replace("e", "E");
300
+ }
301
+ var d = /# (\?+)( ?)\/( ?)(\d+)/;
302
+ function a(h, i, c) {
303
+ var k = parseInt(h[4], 10), o = Math.round(i * k), s = Math.floor(o / k), E = o - s * k, H = k;
304
+ return c + (s === 0 ? "" : "" + s) + " " + (E === 0 ? $(" ", h[1].length + 1 + h[4].length) : R(E, h[1].length) + h[2] + "/" + h[3] + N(H, h[4].length));
305
+ }
306
+ function f(h, i, c) {
307
+ return c + (i === 0 ? "" : "" + i) + $(" ", h[1].length + 2 + h[4].length);
308
+ }
309
+ var C = /^#*0*\.([0#]+)/, l = /\).*[0#]/, _ = /\(###\) ###\\?-####/;
310
+ function A(h) {
311
+ for (var i = "", c, k = 0; k != h.length; ++k) switch (c = h.charCodeAt(k)) {
312
+ case 35:
313
+ break;
314
+ case 63:
315
+ i += " ";
316
+ break;
317
+ case 48:
318
+ i += "0";
319
+ break;
320
+ default:
321
+ i += String.fromCharCode(c);
322
+ }
323
+ return i;
324
+ }
325
+ function D(h, i) {
326
+ var c = Math.pow(10, i);
327
+ return "" + Math.round(h * c) / c;
328
+ }
329
+ function U(h, i) {
330
+ var c = h - Math.floor(h), k = Math.pow(10, i);
331
+ return i < ("" + Math.round(c * k)).length ? 0 : Math.round(c * k);
332
+ }
333
+ function T(h, i) {
334
+ return i < ("" + Math.round((h - Math.floor(h)) * Math.pow(10, i))).length ? 1 : 0;
335
+ }
336
+ function L(h) {
337
+ return h < 2147483647 && h > -2147483648 ? "" + (h >= 0 ? h | 0 : h - 1 | 0) : "" + Math.floor(h);
338
+ }
339
+ function O(h, i, c) {
340
+ if (h.charCodeAt(0) === 40 && !i.match(l)) {
341
+ var k = i.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
342
+ return c >= 0 ? O("n", k, c) : "(" + O("n", k, -c) + ")";
343
+ }
344
+ if (i.charCodeAt(i.length - 1) === 44) return m(h, i, c);
345
+ if (i.indexOf("%") !== -1) return n(h, i, c);
346
+ if (i.indexOf("E") !== -1) return e(i, c);
347
+ if (i.charCodeAt(0) === 36) return "$" + O(h, i.substr(i.charAt(1) == " " ? 2 : 1), c);
348
+ var o, s, E, H, j = Math.abs(c), W = c < 0 ? "-" : "";
349
+ if (i.match(/^00+$/)) return W + re(j, i.length);
350
+ if (i.match(/^[#?]+$/))
351
+ return o = re(c, 0), o === "0" && (o = ""), o.length > i.length ? o : A(i.substr(0, i.length - o.length)) + o;
352
+ if (s = i.match(d)) return a(s, j, W);
353
+ if (i.match(/^#+0+$/)) return W + re(j, i.length - i.indexOf("0"));
354
+ if (s = i.match(C))
355
+ return o = D(c, s[1].length).replace(/^([^\.]+)$/, "$1." + A(s[1])).replace(/\.$/, "." + A(s[1])).replace(/\.(\d*)$/, function(z, pe) {
356
+ return "." + pe + $("0", A(s[1]).length - pe.length);
357
+ }), i.indexOf("0.") !== -1 ? o : o.replace(/^0\./, ".");
358
+ if (i = i.replace(/^#+([0.])/, "$1"), s = i.match(/^(0*)\.(#*)$/))
359
+ return W + D(j, s[2].length).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, s[1].length ? "0." : ".");
360
+ if (s = i.match(/^#{1,3},##0(\.?)$/)) return W + oe(re(j, 0));
361
+ if (s = i.match(/^#,##0\.([#0]*0)$/))
362
+ return c < 0 ? "-" + O(h, i, -c) : oe("" + (Math.floor(c) + T(c, s[1].length))) + "." + N(U(c, s[1].length), s[1].length);
363
+ if (s = i.match(/^#,#*,#0/)) return O(h, i.replace(/^#,#*,/, ""), c);
364
+ if (s = i.match(/^([0#]+)(\\?-([0#]+))+$/))
365
+ return o = v(O(h, i.replace(/[\\-]/g, ""), c)), E = 0, v(v(i.replace(/\\/g, "")).replace(/[0#]/g, function(z) {
366
+ return E < o.length ? o.charAt(E++) : z === "0" ? "0" : "";
367
+ }));
368
+ if (i.match(_))
369
+ return o = O(h, "##########", c), "(" + o.substr(0, 3) + ") " + o.substr(3, 3) + "-" + o.substr(6);
370
+ var S = "";
371
+ if (s = i.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))
372
+ return E = Math.min(s[4].length, 7), H = we(j, Math.pow(10, E) - 1, !1), o = "" + W, S = ne("n", s[1], H[1]), S.charAt(S.length - 1) == " " && (S = S.substr(0, S.length - 1) + "0"), o += S + s[2] + "/" + s[3], S = I(H[2], E), S.length < s[4].length && (S = A(s[4].substr(s[4].length - S.length)) + S), o += S, o;
373
+ if (s = i.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))
374
+ return E = Math.min(Math.max(s[1].length, s[4].length), 7), H = we(j, Math.pow(10, E) - 1, !0), W + (H[0] || (H[1] ? "" : "0")) + " " + (H[1] ? R(H[1], E) + s[2] + "/" + s[3] + I(H[2], E) : $(" ", 2 * E + 1 + s[2].length + s[3].length));
375
+ if (s = i.match(/^[#0?]+$/))
376
+ return o = re(c, 0), i.length <= o.length ? o : A(i.substr(0, i.length - o.length)) + o;
377
+ if (s = i.match(/^([#0?]+)\.([#0]+)$/)) {
378
+ o = "" + c.toFixed(Math.min(s[2].length, 10)).replace(/([^0])0+$/, "$1"), E = o.indexOf(".");
379
+ var be = i.indexOf(".") - E, ve = i.length - o.length - be;
380
+ return A(i.substr(0, be) + o + i.substr(i.length - ve));
381
+ }
382
+ if (s = i.match(/^00,000\.([#0]*0)$/))
383
+ return E = U(c, s[1].length), c < 0 ? "-" + O(h, i, -c) : oe(L(c)).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function(z) {
384
+ return "00," + (z.length < 3 ? N(0, 3 - z.length) : "") + z;
385
+ }) + "." + N(E, s[1].length);
386
+ switch (i) {
387
+ case "###,##0.00":
388
+ return O(h, "#,##0.00", c);
389
+ case "###,###":
390
+ case "##,###":
391
+ case "#,###":
392
+ var me = oe(re(j, 0));
393
+ return me !== "0" ? W + me : "";
394
+ case "###,###.00":
395
+ return O(h, "###,##0.00", c).replace(/^0\./, ".");
396
+ case "#,###.00":
397
+ return O(h, "#,##0.00", c).replace(/^0\./, ".");
398
+ }
399
+ throw new Error("unsupported format |" + i + "|");
400
+ }
401
+ function se(h, i, c) {
402
+ for (var k = i.length - 1; i.charCodeAt(k - 1) === 44; ) --k;
403
+ return ne(h, i.substr(0, k), c / Math.pow(10, 3 * (i.length - k)));
404
+ }
405
+ function ue(h, i, c) {
406
+ var k = i.replace(r, ""), o = i.length - k.length;
407
+ return ne(h, k, c * Math.pow(10, 2 * o)) + $("%", o);
408
+ }
409
+ function Z(h, i) {
410
+ var c, k = h.indexOf("E") - h.indexOf(".") - 1;
411
+ if (h.match(/^#+0.0E\+0$/)) {
412
+ if (i == 0) return "0.0E+0";
413
+ if (i < 0) return "-" + Z(h, -i);
414
+ var o = h.indexOf(".");
415
+ o === -1 && (o = h.indexOf("E"));
416
+ var s = Math.floor(Math.log(i) * Math.LOG10E) % o;
417
+ if (s < 0 && (s += o), c = (i / Math.pow(10, s)).toPrecision(k + 1 + (o + s) % o), !c.match(/[Ee]/)) {
418
+ var E = Math.floor(Math.log(i) * Math.LOG10E);
419
+ c.indexOf(".") === -1 ? c = c.charAt(0) + "." + c.substr(1) + "E+" + (E - c.length + s) : c += "E+" + (E - s), c = c.replace(/\+-/, "-");
420
+ }
421
+ c = c.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function(H, j, W, S) {
422
+ return j + W + S.substr(0, (o + s) % o) + "." + S.substr(s) + "E";
423
+ });
424
+ } else c = i.toExponential(k);
425
+ return h.match(/E\+00$/) && c.match(/e[+-]\d$/) && (c = c.substr(0, c.length - 1) + "0" + c.charAt(c.length - 1)), h.match(/E\-/) && c.match(/e\+/) && (c = c.replace(/e\+/, "e")), c.replace("e", "E");
426
+ }
427
+ function x(h, i, c) {
428
+ if (h.charCodeAt(0) === 40 && !i.match(l)) {
429
+ var k = i.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
430
+ return c >= 0 ? x("n", k, c) : "(" + x("n", k, -c) + ")";
431
+ }
432
+ if (i.charCodeAt(i.length - 1) === 44) return se(h, i, c);
433
+ if (i.indexOf("%") !== -1) return ue(h, i, c);
434
+ if (i.indexOf("E") !== -1) return Z(i, c);
435
+ if (i.charCodeAt(0) === 36) return "$" + x(h, i.substr(i.charAt(1) == " " ? 2 : 1), c);
436
+ var o, s, E, H, j = Math.abs(c), W = c < 0 ? "-" : "";
437
+ if (i.match(/^00+$/)) return W + N(j, i.length);
438
+ if (i.match(/^[#?]+$/))
439
+ return o = "" + c, c === 0 && (o = ""), o.length > i.length ? o : A(i.substr(0, i.length - o.length)) + o;
440
+ if (s = i.match(d)) return f(s, j, W);
441
+ if (i.match(/^#+0+$/)) return W + N(j, i.length - i.indexOf("0"));
442
+ if (s = i.match(C))
443
+ return o = ("" + c).replace(/^([^\.]+)$/, "$1." + A(s[1])).replace(/\.$/, "." + A(s[1])), o = o.replace(/\.(\d*)$/, function(z, pe) {
444
+ return "." + pe + $("0", A(s[1]).length - pe.length);
445
+ }), i.indexOf("0.") !== -1 ? o : o.replace(/^0\./, ".");
446
+ if (i = i.replace(/^#+([0.])/, "$1"), s = i.match(/^(0*)\.(#*)$/))
447
+ return W + ("" + j).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, s[1].length ? "0." : ".");
448
+ if (s = i.match(/^#{1,3},##0(\.?)$/)) return W + oe("" + j);
449
+ if (s = i.match(/^#,##0\.([#0]*0)$/))
450
+ return c < 0 ? "-" + x(h, i, -c) : oe("" + c) + "." + $("0", s[1].length);
451
+ if (s = i.match(/^#,#*,#0/)) return x(h, i.replace(/^#,#*,/, ""), c);
452
+ if (s = i.match(/^([0#]+)(\\?-([0#]+))+$/))
453
+ return o = v(x(h, i.replace(/[\\-]/g, ""), c)), E = 0, v(v(i.replace(/\\/g, "")).replace(/[0#]/g, function(z) {
454
+ return E < o.length ? o.charAt(E++) : z === "0" ? "0" : "";
455
+ }));
456
+ if (i.match(_))
457
+ return o = x(h, "##########", c), "(" + o.substr(0, 3) + ") " + o.substr(3, 3) + "-" + o.substr(6);
458
+ var S = "";
459
+ if (s = i.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))
460
+ return E = Math.min(s[4].length, 7), H = we(j, Math.pow(10, E) - 1, !1), o = "" + W, S = ne("n", s[1], H[1]), S.charAt(S.length - 1) == " " && (S = S.substr(0, S.length - 1) + "0"), o += S + s[2] + "/" + s[3], S = I(H[2], E), S.length < s[4].length && (S = A(s[4].substr(s[4].length - S.length)) + S), o += S, o;
461
+ if (s = i.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))
462
+ return E = Math.min(Math.max(s[1].length, s[4].length), 7), H = we(j, Math.pow(10, E) - 1, !0), W + (H[0] || (H[1] ? "" : "0")) + " " + (H[1] ? R(H[1], E) + s[2] + "/" + s[3] + I(H[2], E) : $(" ", 2 * E + 1 + s[2].length + s[3].length));
463
+ if (s = i.match(/^[#0?]+$/))
464
+ return o = "" + c, i.length <= o.length ? o : A(i.substr(0, i.length - o.length)) + o;
465
+ if (s = i.match(/^([#0]+)\.([#0]+)$/)) {
466
+ o = "" + c.toFixed(Math.min(s[2].length, 10)).replace(/([^0])0+$/, "$1"), E = o.indexOf(".");
467
+ var be = i.indexOf(".") - E, ve = i.length - o.length - be;
468
+ return A(i.substr(0, be) + o + i.substr(i.length - ve));
469
+ }
470
+ if (s = i.match(/^00,000\.([#0]*0)$/))
471
+ return c < 0 ? "-" + x(h, i, -c) : oe("" + c).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function(z) {
472
+ return "00," + (z.length < 3 ? N(0, 3 - z.length) : "") + z;
473
+ }) + "." + N(0, s[1].length);
474
+ switch (i) {
475
+ case "###,###":
476
+ case "##,###":
477
+ case "#,###":
478
+ var me = oe("" + j);
479
+ return me !== "0" ? W + me : "";
480
+ default:
481
+ if (i.match(/\.[0#?]*$/)) return x(h, i.slice(0, i.lastIndexOf(".")), c) + A(i.slice(i.lastIndexOf(".")));
482
+ }
483
+ throw new Error("unsupported format |" + i + "|");
484
+ }
485
+ return function(i, c, k) {
486
+ return (k | 0) === k ? x(i, c, k) : O(i, c, k);
487
+ };
488
+ }();
489
+ function ke(t) {
490
+ for (var r = [], n = !1, m = 0, e = 0; m < t.length; ++m) switch (
491
+ /*cc=*/
492
+ t.charCodeAt(m)
493
+ ) {
494
+ case 34:
495
+ n = !n;
496
+ break;
497
+ case 95:
498
+ case 42:
499
+ case 92:
500
+ ++m;
501
+ break;
502
+ case 59:
503
+ r[r.length] = t.substr(e, m - e), e = m + 1;
504
+ }
505
+ if (r[r.length] = t.substr(e), n === !0) throw new Error("Format |" + t + "| unterminated string ");
506
+ return r;
507
+ }
508
+ p._split = ke;
509
+ var _e = /\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;
510
+ function xe(t) {
511
+ for (var r = 0, n = "", m = ""; r < t.length; )
512
+ switch (n = t.charAt(r)) {
513
+ case "G":
514
+ fe(t, r) && (r += 6), r++;
515
+ break;
516
+ case '"':
517
+ for (
518
+ ;
519
+ /*cc=*/
520
+ t.charCodeAt(++r) !== 34 && r < t.length;
521
+ )
522
+ ;
523
+ ++r;
524
+ break;
525
+ case "\\":
526
+ r += 2;
527
+ break;
528
+ case "_":
529
+ r += 2;
530
+ break;
531
+ case "@":
532
+ ++r;
533
+ break;
534
+ case "B":
535
+ case "b":
536
+ if (t.charAt(r + 1) === "1" || t.charAt(r + 1) === "2") return !0;
537
+ case "M":
538
+ case "D":
539
+ case "Y":
540
+ case "H":
541
+ case "S":
542
+ case "E":
543
+ case "m":
544
+ case "d":
545
+ case "y":
546
+ case "h":
547
+ case "s":
548
+ case "e":
549
+ case "g":
550
+ return !0;
551
+ case "A":
552
+ case "a":
553
+ case "上":
554
+ if (t.substr(r, 3).toUpperCase() === "A/P" || t.substr(r, 5).toUpperCase() === "AM/PM" || t.substr(r, 5).toUpperCase() === "上午/下午") return !0;
555
+ ++r;
556
+ break;
557
+ case "[":
558
+ for (m = n; t.charAt(r++) !== "]" && r < t.length; ) m += t.charAt(r);
559
+ if (m.match(_e)) return !0;
560
+ break;
561
+ case ".":
562
+ case "0":
563
+ case "#":
564
+ for (; r < t.length && ("0#?.,E+-%".indexOf(n = t.charAt(++r)) > -1 || n == "\\" && t.charAt(r + 1) == "-" && "0#".indexOf(t.charAt(r + 2)) > -1); )
565
+ ;
566
+ break;
567
+ case "?":
568
+ for (; t.charAt(++r) === n; )
569
+ ;
570
+ break;
571
+ case "*":
572
+ ++r, (t.charAt(r) == " " || t.charAt(r) == "*") && ++r;
573
+ break;
574
+ case "(":
575
+ case ")":
576
+ ++r;
577
+ break;
578
+ case "1":
579
+ case "2":
580
+ case "3":
581
+ case "4":
582
+ case "5":
583
+ case "6":
584
+ case "7":
585
+ case "8":
586
+ case "9":
587
+ for (; r < t.length && "0123456789".indexOf(t.charAt(++r)) > -1; )
588
+ ;
589
+ break;
590
+ case " ":
591
+ ++r;
592
+ break;
593
+ default:
594
+ ++r;
595
+ break;
596
+ }
597
+ return !1;
598
+ }
599
+ p.is_date = xe;
600
+ function $e(t, r, n, m) {
601
+ for (var e = [], d = "", a = 0, f = "", C = "t", l, _, A, D = "H"; a < t.length; )
602
+ switch (f = t.charAt(a)) {
603
+ case "G":
604
+ if (!fe(t, a)) throw new Error("unrecognized character " + f + " in " + t);
605
+ e[e.length] = { t: "G", v: "General" }, a += 7;
606
+ break;
607
+ case '"':
608
+ for (d = ""; (A = t.charCodeAt(++a)) !== 34 && a < t.length; ) d += String.fromCharCode(A);
609
+ e[e.length] = { t: "t", v: d }, ++a;
610
+ break;
611
+ case "\\":
612
+ var U = t.charAt(++a), T = U === "(" || U === ")" ? U : "t";
613
+ e[e.length] = { t: T, v: U }, ++a;
614
+ break;
615
+ case "_":
616
+ e[e.length] = { t: "t", v: " " }, a += 2;
617
+ break;
618
+ case "@":
619
+ e[e.length] = { t: "T", v: r }, ++a;
620
+ break;
621
+ case "B":
622
+ case "b":
623
+ if (t.charAt(a + 1) === "1" || t.charAt(a + 1) === "2") {
624
+ if (l == null && (l = ye(r, n, t.charAt(a + 1) === "2"), l == null))
625
+ return "";
626
+ e[e.length] = { t: "X", v: t.substr(a, 2) }, C = f, a += 2;
627
+ break;
628
+ }
629
+ case "M":
630
+ case "D":
631
+ case "Y":
632
+ case "H":
633
+ case "S":
634
+ case "E":
635
+ f = f.toLowerCase();
636
+ case "m":
637
+ case "d":
638
+ case "y":
639
+ case "h":
640
+ case "s":
641
+ case "e":
642
+ case "g":
643
+ if (r < 0 || l == null && (l = ye(r, n), l == null))
644
+ return "";
645
+ for (d = f; ++a < t.length && t.charAt(a).toLowerCase() === f; ) d += f;
646
+ f === "m" && C.toLowerCase() === "h" && (f = "M"), f === "h" && (f = D), e[e.length] = { t: f, v: d }, C = f;
647
+ break;
648
+ case "A":
649
+ case "a":
650
+ case "上":
651
+ var L = { t: f, v: f };
652
+ if (l == null && (l = ye(r, n)), t.substr(a, 3).toUpperCase() === "A/P" ? (l != null && (L.v = l.H >= 12 ? "P" : "A"), L.t = "T", D = "h", a += 3) : t.substr(a, 5).toUpperCase() === "AM/PM" ? (l != null && (L.v = l.H >= 12 ? "PM" : "AM"), L.t = "T", a += 5, D = "h") : t.substr(a, 5).toUpperCase() === "上午/下午" ? (l != null && (L.v = l.H >= 12 ? "下午" : "上午"), L.t = "T", a += 5, D = "h") : (L.t = "t", ++a), l == null && L.t === "T") return "";
653
+ e[e.length] = L, C = f;
654
+ break;
655
+ case "[":
656
+ for (d = f; t.charAt(a++) !== "]" && a < t.length; ) d += t.charAt(a);
657
+ if (d.slice(-1) !== "]") throw 'unterminated "[" block: |' + d + "|";
658
+ if (d.match(_e)) {
659
+ if (l == null && (l = ye(r, n), l == null))
660
+ return "";
661
+ e[e.length] = { t: "Z", v: d.toLowerCase() }, C = d.charAt(1);
662
+ } else d.indexOf("$") > -1 && (d = (d.match(/\$([^-\[\]]*)/) || [])[1] || "$", xe(t) || (e[e.length] = { t: "t", v: d }));
663
+ break;
664
+ case ".":
665
+ if (l != null) {
666
+ for (d = f; ++a < t.length && (f = t.charAt(a)) === "0"; ) d += f;
667
+ e[e.length] = { t: "s", v: d };
668
+ break;
669
+ }
670
+ case "0":
671
+ case "#":
672
+ for (d = f; ++a < t.length && "0#?.,E+-%".indexOf(f = t.charAt(a)) > -1; ) d += f;
673
+ e[e.length] = { t: "n", v: d };
674
+ break;
675
+ case "?":
676
+ for (d = f; t.charAt(++a) === f; ) d += f;
677
+ e[e.length] = { t: f, v: d }, C = f;
678
+ break;
679
+ case "*":
680
+ ++a, (t.charAt(a) == " " || t.charAt(a) == "*") && ++a;
681
+ break;
682
+ case "(":
683
+ case ")":
684
+ e[e.length] = { t: m === 1 ? "t" : f, v: f }, ++a;
685
+ break;
686
+ case "1":
687
+ case "2":
688
+ case "3":
689
+ case "4":
690
+ case "5":
691
+ case "6":
692
+ case "7":
693
+ case "8":
694
+ case "9":
695
+ for (d = f; a < t.length && "0123456789".indexOf(t.charAt(++a)) > -1; ) d += t.charAt(a);
696
+ e[e.length] = { t: "D", v: d };
697
+ break;
698
+ case " ":
699
+ e[e.length] = { t: f, v: f }, ++a;
700
+ break;
701
+ case "$":
702
+ e[e.length] = { t: "t", v: "$" }, ++a;
703
+ break;
704
+ default:
705
+ if (",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(f) === -1) throw new Error("unrecognized character " + f + " in " + t);
706
+ e[e.length] = { t: "t", v: f }, ++a;
707
+ break;
708
+ }
709
+ var O = 0, se = 0, ue;
710
+ for (a = e.length - 1, C = "t"; a >= 0; --a)
711
+ switch (e[a].t) {
712
+ case "h":
713
+ case "H":
714
+ e[a].t = D, C = "h", O < 1 && (O = 1);
715
+ break;
716
+ case "s":
717
+ (ue = e[a].v.match(/\.0+$/)) && (se = Math.max(se, ue[0].length - 1)), O < 3 && (O = 3);
718
+ case "d":
719
+ case "y":
720
+ case "M":
721
+ case "e":
722
+ C = e[a].t;
723
+ break;
724
+ case "m":
725
+ C === "s" && (e[a].t = "M", O < 2 && (O = 2));
726
+ break;
727
+ case "X":
728
+ break;
729
+ case "Z":
730
+ O < 1 && e[a].v.match(/[Hh]/) && (O = 1), O < 2 && e[a].v.match(/[Mm]/) && (O = 2), O < 3 && e[a].v.match(/[Ss]/) && (O = 3);
731
+ }
732
+ switch (O) {
733
+ case 0:
734
+ break;
735
+ case 1:
736
+ l.u >= 0.5 && (l.u = 0, ++l.S), l.S >= 60 && (l.S = 0, ++l.M), l.M >= 60 && (l.M = 0, ++l.H);
737
+ break;
738
+ case 2:
739
+ l.u >= 0.5 && (l.u = 0, ++l.S), l.S >= 60 && (l.S = 0, ++l.M);
740
+ break;
741
+ }
742
+ var Z = "", x;
743
+ for (a = 0; a < e.length; ++a)
744
+ switch (e[a].t) {
745
+ case "t":
746
+ case "T":
747
+ case " ":
748
+ case "D":
749
+ break;
750
+ case "X":
751
+ e[a].v = "", e[a].t = ";";
752
+ break;
753
+ case "d":
754
+ case "m":
755
+ case "y":
756
+ case "h":
757
+ case "H":
758
+ case "M":
759
+ case "s":
760
+ case "e":
761
+ case "b":
762
+ case "Z":
763
+ e[a].v = Ve(e[a].t.charCodeAt(0), e[a].v, l, se), e[a].t = "t";
764
+ break;
765
+ case "n":
766
+ case "?":
767
+ for (x = a + 1; e[x] != null && ((f = e[x].t) === "?" || f === "D" || (f === " " || f === "t") && e[x + 1] != null && (e[x + 1].t === "?" || e[x + 1].t === "t" && e[x + 1].v === "/") || e[a].t === "(" && (f === " " || f === "n" || f === ")") || f === "t" && (e[x].v === "/" || e[x].v === " " && e[x + 1] != null && e[x + 1].t == "?")); )
768
+ e[a].v += e[x].v, e[x] = { v: "", t: ";" }, ++x;
769
+ Z += e[a].v, a = x - 1;
770
+ break;
771
+ case "G":
772
+ e[a].t = "t", e[a].v = ge(r, n);
773
+ break;
774
+ }
775
+ var h = "", i, c;
776
+ if (Z.length > 0) {
777
+ Z.charCodeAt(0) == 40 ? (i = r < 0 && Z.charCodeAt(0) === 45 ? -r : r, c = ne("n", Z, i)) : (i = r < 0 && m > 1 ? -r : r, c = ne("n", Z, i), i < 0 && e[0] && e[0].t == "t" && (c = c.substr(1), e[0].v = "-" + e[0].v)), x = c.length - 1;
778
+ var k = e.length;
779
+ for (a = 0; a < e.length; ++a) if (e[a] != null && e[a].t != "t" && e[a].v.indexOf(".") > -1) {
780
+ k = a;
781
+ break;
782
+ }
783
+ var o = e.length;
784
+ if (k === e.length && c.indexOf("E") === -1) {
785
+ for (a = e.length - 1; a >= 0; --a)
786
+ e[a] == null || "n?".indexOf(e[a].t) === -1 || (x >= e[a].v.length - 1 ? (x -= e[a].v.length, e[a].v = c.substr(x + 1, e[a].v.length)) : x < 0 ? e[a].v = "" : (e[a].v = c.substr(0, x + 1), x = -1), e[a].t = "t", o = a);
787
+ x >= 0 && o < e.length && (e[o].v = c.substr(0, x + 1) + e[o].v);
788
+ } else if (k !== e.length && c.indexOf("E") === -1) {
789
+ for (x = c.indexOf(".") - 1, a = k; a >= 0; --a)
790
+ if (!(e[a] == null || "n?".indexOf(e[a].t) === -1)) {
791
+ for (_ = e[a].v.indexOf(".") > -1 && a === k ? e[a].v.indexOf(".") - 1 : e[a].v.length - 1, h = e[a].v.substr(_ + 1); _ >= 0; --_)
792
+ x >= 0 && (e[a].v.charAt(_) === "0" || e[a].v.charAt(_) === "#") && (h = c.charAt(x--) + h);
793
+ e[a].v = h, e[a].t = "t", o = a;
794
+ }
795
+ for (x >= 0 && o < e.length && (e[o].v = c.substr(0, x + 1) + e[o].v), x = c.indexOf(".") + 1, a = k; a < e.length; ++a)
796
+ if (!(e[a] == null || "n?(".indexOf(e[a].t) === -1 && a !== k)) {
797
+ for (_ = e[a].v.indexOf(".") > -1 && a === k ? e[a].v.indexOf(".") + 1 : 0, h = e[a].v.substr(0, _); _ < e[a].v.length; ++_)
798
+ x < c.length && (h += c.charAt(x++));
799
+ e[a].v = h, e[a].t = "t", o = a;
800
+ }
801
+ }
802
+ }
803
+ for (a = 0; a < e.length; ++a) e[a] != null && "n?".indexOf(e[a].t) > -1 && (i = m > 1 && r < 0 && a > 0 && e[a - 1].v === "-" ? -r : r, e[a].v = ne(e[a].t, e[a].v, i), e[a].t = "t");
804
+ var s = "";
805
+ for (a = 0; a !== e.length; ++a) e[a] != null && (s += e[a].v);
806
+ return s;
807
+ }
808
+ p._eval = $e;
809
+ var Me = /\[[=<>]/, X = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;
810
+ function ae(t, r) {
811
+ if (r == null) return !1;
812
+ var n = parseFloat(r[2]);
813
+ switch (r[1]) {
814
+ case "=":
815
+ if (t == n) return !0;
816
+ break;
817
+ case ">":
818
+ if (t > n) return !0;
819
+ break;
820
+ case "<":
821
+ if (t < n) return !0;
822
+ break;
823
+ case "<>":
824
+ if (t != n) return !0;
825
+ break;
826
+ case ">=":
827
+ if (t >= n) return !0;
828
+ break;
829
+ case "<=":
830
+ if (t <= n) return !0;
831
+ break;
832
+ }
833
+ return !1;
834
+ }
835
+ function ee(t, r) {
836
+ var n = ke(t), m = n.length, e = n[m - 1].indexOf("@");
837
+ if (m < 4 && e > -1 && --m, n.length > 4) throw new Error("cannot find right format for |" + n.join("|") + "|");
838
+ if (typeof r != "number") return [4, n.length === 4 || e > -1 ? n[n.length - 1] : "@"];
839
+ switch (n.length) {
840
+ case 1:
841
+ n = e > -1 ? ["General", "General", "General", n[0]] : [n[0], n[0], n[0], "@"];
842
+ break;
843
+ case 2:
844
+ n = e > -1 ? [n[0], n[0], n[0], n[1]] : [n[0], n[1], n[0], "@"];
845
+ break;
846
+ case 3:
847
+ n = e > -1 ? [n[0], n[1], n[0], n[2]] : [n[0], n[1], n[2], "@"];
848
+ break;
849
+ }
850
+ var d = r > 0 ? n[0] : r < 0 ? n[1] : n[2];
851
+ if (n[0].indexOf("[") === -1 && n[1].indexOf("[") === -1) return [m, d];
852
+ if (n[0].match(Me) != null || n[1].match(Me) != null) {
853
+ var a = n[0].match(X), f = n[1].match(X);
854
+ return ae(r, a) ? [m, n[0]] : ae(r, f) ? [m, n[1]] : [m, n[a != null && f != null ? 2 : 1]];
855
+ }
856
+ return [m, d];
857
+ }
858
+ function de(t, r, n) {
859
+ n == null && (n = {});
860
+ var m = "";
861
+ switch (typeof t) {
862
+ case "string":
863
+ t == "m/d/yy" && n.dateNF ? m = n.dateNF : m = t;
864
+ break;
865
+ case "number":
866
+ t == 14 && n.dateNF ? m = n.dateNF : m = (n.table != null ? n.table : ce)[t], m == null && (m = n.table && n.table[Q[t]] || ce[Q[t]]), m == null && (m = G[t] || "General");
867
+ break;
868
+ }
869
+ if (fe(m, 0)) return ge(r, n);
870
+ r instanceof Date && (r = Ne(r, n.date1904));
871
+ var e = ee(m, r);
872
+ if (fe(e[1])) return ge(r, n);
873
+ if (r === !0) r = "TRUE";
874
+ else if (r === !1) r = "FALSE";
875
+ else if (r === "" || r == null) return "";
876
+ return $e(e[1], r, n, e[0]);
877
+ }
878
+ function le(t, r) {
879
+ if (typeof r != "number") {
880
+ r = +r || -1;
881
+ for (var n = 0; n < 392; ++n) {
882
+ if (ce[n] == null) {
883
+ r < 0 && (r = n);
884
+ continue;
885
+ }
886
+ if (ce[n] == t) {
887
+ r = n;
888
+ break;
889
+ }
890
+ }
891
+ r < 0 && (r = 391);
892
+ }
893
+ return ce[r] = t, r;
894
+ }
895
+ p.load = le, p._table = ce, p.get_table = function() {
896
+ return ce;
897
+ }, p.load_table = function(r) {
898
+ for (var n = 0; n != 392; ++n)
899
+ r[n] !== void 0 && le(r[n], n);
900
+ }, p.init_table = Ee, p.format = de;
901
+ };
902
+ g(u), typeof DO_NOT_EXPORT_SSF > "u" && (y.exports = u);
903
+ })(ze);
904
+ var rt = ze.exports;
905
+ const Pe = /* @__PURE__ */ Ze(rt), Be = [
906
+ "228, 232, 237",
907
+ // Light Gray
908
+ "219, 233, 236",
909
+ // White
910
+ "244, 217, 227",
911
+ // Pink
912
+ "247, 229, 207",
913
+ // Peach
914
+ "217, 234, 244",
915
+ // Blue
916
+ "222, 239, 222",
917
+ // Green
918
+ "239, 239, 239",
919
+ // Light Green
920
+ "244, 230, 230",
921
+ // Rose
922
+ "247, 239, 217",
923
+ // Yellow
924
+ "230, 230, 244",
925
+ // Purple
926
+ "217, 244, 244",
927
+ // Cyan
928
+ "244, 239, 234"
929
+ // Cream
930
+ ], Ue = Be[0], nt = [
931
+ ["true", "false"],
932
+ ["yes", "no"],
933
+ ["1", "0"]
934
+ ];
935
+ function at(y, u) {
936
+ const g = y.toLowerCase(), w = u.toLowerCase();
937
+ return nt.some(([p, v]) => g === p && w === v);
938
+ }
939
+ const it = 200;
940
+ function ct() {
941
+ return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `sheet-${Date.now()}-${Math.random().toString(36).slice(2)}`;
942
+ }
943
+ function ot(y) {
944
+ if (!Array.isArray(y) || y.length === 0) return null;
945
+ const u = y.map((w) => String((w == null ? void 0 : w.v) ?? "")).join("");
946
+ return u.trim() ? u : null;
947
+ }
948
+ function lt(y) {
949
+ return y ? "TRUE" : "FALSE";
950
+ }
951
+ function st(y) {
952
+ let u = !1, g = 0;
953
+ const w = () => {
954
+ if (u) return !0;
955
+ const v = y.current;
956
+ if (!(v != null && v.getWorkbookContext) || !v.recalculateAllFormulas) return !1;
957
+ const $ = v.getWorkbookContext(), N = $ == null ? void 0 : $.luckysheetfile;
958
+ return !(N != null && N.length) || !N.some(
959
+ (I) => Array.isArray(I.data) && I.data.length > 0
960
+ ) ? !1 : (v.recalculateAllFormulas(), u = !0, !0);
961
+ }, p = () => {
962
+ var v, $;
963
+ w() || (g += 1, g < it ? requestAnimationFrame(p) : (($ = (v = y.current) == null ? void 0 : v.recalculateAllFormulas) == null || $.call(v), u = !0));
964
+ };
965
+ requestAnimationFrame(() => requestAnimationFrame(p));
966
+ for (const v of [120, 400, 1200])
967
+ window.setTimeout(() => {
968
+ u || w();
969
+ }, v);
970
+ }
971
+ function ut(y) {
972
+ return y <= 0 ? Ue : y > Be.length ? Array(y).fill(Ue).join(", ") : Be.slice(0, y).join(", ");
973
+ }
974
+ function je(y) {
975
+ const u = y.match(/^([A-Z]+)(\d+)$/i);
976
+ if (!u) return null;
977
+ const g = u[1].toUpperCase(), w = u[2];
978
+ let p = 0;
979
+ for (let N = 0; N < g.length; N++)
980
+ p = p * 26 + (g.charCodeAt(N) - 64);
981
+ const v = parseInt(w, 10) - 1, $ = p - 1;
982
+ return { row: v, col: $ };
983
+ }
984
+ function ht(y, u) {
985
+ const g = je(y);
986
+ if (!g) return null;
987
+ const { row: w, col: p } = g, v = `${w}_${p}`, $ = Array.isArray(u.formulae) && u.formulae.length > 0 ? String(u.formulae[0]).replace(/^["']|["']$/g, "").replace(/["']/g, "") : "", N = $.split(",").map((fe) => fe.trim()).filter(Boolean);
988
+ let R = u.type === "list" ? "dropdown" : u.type || "dropdown", I = $, J = "";
989
+ u.type === "list" && N.length === 2 && at(N[0], N[1]) && (R = "checkbox", I = N[0], J = N[1]);
990
+ const F = R === "checkbox" ? 1 : I ? I.split(",").length : 0, ie = ut(F || 1), re = {
991
+ type: R,
992
+ type2: "",
993
+ rangeTxt: y,
994
+ value1: I,
995
+ value2: J,
996
+ validity: "",
997
+ remote: !1,
998
+ prohibitInput: u.type === "list",
999
+ hintShow: !!u.showInputMessage,
1000
+ hintValue: u.prompt ?? "",
1001
+ color: ie,
1002
+ checked: !1
1003
+ };
1004
+ return { rowColKey: v, entry: re };
1005
+ }
1006
+ function ft(y) {
1007
+ const u = y.split(":"), g = je(u[0].trim());
1008
+ if (!g) return null;
1009
+ const w = u.length > 1 ? je(u[1].trim()) : g;
1010
+ return w ? {
1011
+ row: [Math.min(g.row, w.row), Math.max(g.row, w.row)],
1012
+ column: [Math.min(g.col, w.col), Math.max(g.col, w.col)]
1013
+ } : null;
1014
+ }
1015
+ function gt(y) {
1016
+ return String(y || "").split(/[,\s]+/).map((u) => u.trim()).filter(Boolean).map((u) => ft(u)).filter(
1017
+ (u) => !!u
1018
+ );
1019
+ }
1020
+ function Ye(y) {
1021
+ const u = gt(y);
1022
+ return u.length ? u.map((g) => {
1023
+ const [w, p] = g.row, [v, $] = g.column;
1024
+ return {
1025
+ left: 0,
1026
+ width: 104,
1027
+ top: 0,
1028
+ height: 23,
1029
+ left_move: 0,
1030
+ width_move: 104,
1031
+ top_move: 0,
1032
+ height_move: 11999,
1033
+ row: [w, p],
1034
+ column: [v, $],
1035
+ row_focus: w,
1036
+ column_focus: v,
1037
+ column_select: !0
1038
+ };
1039
+ }) : null;
1040
+ }
1041
+ function Ge(y) {
1042
+ var $, N;
1043
+ const u = {
1044
+ textColor: "#000000",
1045
+ cellColor: "#ffffff",
1046
+ bold: !1,
1047
+ italic: !1,
1048
+ underline: !1,
1049
+ strikethrough: !1
1050
+ };
1051
+ if (!y) return u;
1052
+ const g = y.font, w = y.fill;
1053
+ let p = u.textColor, v = u.cellColor;
1054
+ if (($ = g == null ? void 0 : g.color) != null && $.argb) {
1055
+ const R = g.color.argb;
1056
+ p = "#" + (R.length >= 6 ? R.slice(-6) : R);
1057
+ }
1058
+ if ((w == null ? void 0 : w.type) === "pattern" && w.pattern === "solid" && ((N = w.fgColor) != null && N.argb)) {
1059
+ const R = w.fgColor.argb;
1060
+ v = "#" + (R.length >= 6 ? R.slice(-6) : R);
1061
+ }
1062
+ return {
1063
+ textColor: p,
1064
+ cellColor: v,
1065
+ bold: !!(g != null && g.bold),
1066
+ italic: !!(g != null && g.italic),
1067
+ underline: !!(g != null && g.underline),
1068
+ strikethrough: !1
1069
+ };
1070
+ }
1071
+ function qe(y) {
1072
+ if (!y || typeof y != "string") return "";
1073
+ const u = y.trim().replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, "&").replace(/^=/, ""), g = u.match(/(?:^|[^A-Z])SEARCH\s*\([\s(]*"((?:[^"]|"")*)"/i);
1074
+ if (g) return (g[1] ?? "").replace(/""/g, '"');
1075
+ const w = u.match(/(?:^|[^A-Z])SEARCH\s*\([\s(]*'([^']*)'/i);
1076
+ return w ? w[1] ?? "" : "";
1077
+ }
1078
+ function De(y) {
1079
+ if (!y || typeof y != "string") return "";
1080
+ const u = y.trim().replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/^=/, ""), g = u.match(/"((?:[^"]|"")*)"/);
1081
+ if (g) return (g[1] ?? "").replace(/""/g, '"');
1082
+ const w = u.match(/'([^']*)'/);
1083
+ return w ? w[1] ?? "" : "";
1084
+ }
1085
+ function dt(y) {
1086
+ if (!y || typeof y != "string") return null;
1087
+ const u = y.trim().toUpperCase(), g = qe(y) || De(y);
1088
+ return g ? u.includes("SEARCH(") ? u.includes("ISERROR(SEARCH(") || u.includes("NOTNUMBER(SEARCH(") ? { conditionName: "textDoesNotContain", conditionValue: [g] } : { conditionName: "textContains", conditionValue: [g] } : u.includes("LEFT(") ? { conditionName: "textStartsWith", conditionValue: [g] } : u.includes("RIGHT(") ? { conditionName: "textEndsWith", conditionValue: [g] } : u.includes("EXACT(") || u.includes('="') ? { conditionName: "textExactly", conditionValue: [g] } : null : null;
1089
+ }
1090
+ function bt(y, u, g) {
1091
+ const w = (y || "").toLowerCase();
1092
+ if (w === "cellis") {
1093
+ const p = (u || "").toLowerCase();
1094
+ return p === "greaterthan" ? { conditionName: "greaterThan", conditionValue: [] } : p === "greaterthanorequal" ? { conditionName: "greaterThanOrEqual", conditionValue: [] } : p === "lessthan" ? { conditionName: "lessThan", conditionValue: [] } : p === "lessthanorequal" ? { conditionName: "lessThanOrEqual", conditionValue: [] } : p === "equal" ? { conditionName: "equal", conditionValue: [] } : p === "notequal" ? { conditionName: "notEqual", conditionValue: [] } : p === "between" ? { conditionName: "between", conditionValue: [] } : p === "notbetween" ? { conditionName: "notBetween", conditionValue: [] } : null;
1095
+ }
1096
+ if (w === "containstext" || w === "notcontainstext" || w === "beginswith" || w === "endswith" || w === "containsblanks" || w === "notcontainsblanks") {
1097
+ const p = (u ?? "").toLowerCase();
1098
+ if (w === "containsblanks" || p === "containsblanks")
1099
+ return { conditionName: "empty", conditionValue: [""] };
1100
+ if (w === "notcontainsblanks" || p === "notcontainsblanks")
1101
+ return { conditionName: "notEmpty", conditionValue: [""] };
1102
+ if (w === "notcontainstext" || p === "notcontainstext" || p === "notcontains")
1103
+ return { conditionName: "textDoesNotContain", conditionValue: [] };
1104
+ if (w === "beginswith" || p === "beginswith")
1105
+ return { conditionName: "textStartsWith", conditionValue: [] };
1106
+ if (w === "endswith" || p === "endswith")
1107
+ return { conditionName: "textEndsWith", conditionValue: [] };
1108
+ if (p === "equal")
1109
+ return { conditionName: "textExactly", conditionValue: [] };
1110
+ const v = (g == null ? void 0 : g.text) ?? "";
1111
+ return {
1112
+ conditionName: "textContains",
1113
+ conditionValue: v ? [v] : []
1114
+ };
1115
+ }
1116
+ if (w === "duplicatevalues")
1117
+ return { conditionName: "duplicateValue", conditionValue: ["0"] };
1118
+ if (w === "uniquevalues")
1119
+ return { conditionName: "duplicateValue", conditionValue: ["1"] };
1120
+ if (w === "top10") {
1121
+ const p = (g == null ? void 0 : g.rank) ?? 10;
1122
+ return g != null && g.percent && (g != null && g.bottom) ? {
1123
+ conditionName: "last10_percent",
1124
+ conditionValue: [String(p)]
1125
+ } : g != null && g.percent ? { conditionName: "top10_percent", conditionValue: [String(p)] } : g != null && g.bottom ? { conditionName: "last10", conditionValue: [String(p)] } : { conditionName: "top10", conditionValue: [String(p)] };
1126
+ }
1127
+ if (w === "aboveaverage")
1128
+ return (g == null ? void 0 : g.aboveAverage) === !1 ? { conditionName: "belowAverage", conditionValue: [] } : { conditionName: "aboveAverage", conditionValue: [] };
1129
+ if (w === "timeperiod") {
1130
+ const p = ((g == null ? void 0 : g.timePeriod) ?? "").toLowerCase();
1131
+ return p === "today" || p === "tomorrow" || p === "yesterday" ? {
1132
+ conditionName: "dateIs",
1133
+ conditionValue: [`preset:${p}`, "", "DD/MM/YYYY"]
1134
+ } : p === "last7days" ? {
1135
+ conditionName: "dateIs",
1136
+ conditionValue: ["preset:pastWeek", "", "DD/MM/YYYY"]
1137
+ } : p === "lastmonth" ? {
1138
+ conditionName: "dateIs",
1139
+ conditionValue: ["preset:pastMonth", "", "DD/MM/YYYY"]
1140
+ } : p === "lastyear" ? {
1141
+ conditionName: "dateIs",
1142
+ conditionValue: ["preset:pastYear", "", "DD/MM/YYYY"]
1143
+ } : null;
1144
+ }
1145
+ return null;
1146
+ }
1147
+ function mt(y, u) {
1148
+ if (!u.type) return null;
1149
+ let g = (u.text ?? "").trim();
1150
+ const w = Array.isArray(u.formulae) && u.formulae[0] ? String(u.formulae[0]) : void 0, p = (u.type.toLowerCase() === "expression" || u.type.toLowerCase() === "customformula") && dt(w);
1151
+ if (p) {
1152
+ const I = Ye(y);
1153
+ if (!I) return null;
1154
+ const J = Ge(u.style);
1155
+ return {
1156
+ type: "default",
1157
+ cellrange: I,
1158
+ format: {
1159
+ textColor: J.textColor,
1160
+ cellColor: J.cellColor,
1161
+ bold: J.bold,
1162
+ italic: J.italic,
1163
+ underline: J.underline,
1164
+ strikethrough: J.strikethrough
1165
+ },
1166
+ conditionName: p.conditionName,
1167
+ conditionRange: [],
1168
+ conditionValue: p.conditionValue
1169
+ };
1170
+ }
1171
+ (u.type === "containsText" || u.type === "notContainsText" || u.type === "beginsWith" || u.type === "endsWith") && !g && (g = qe(w), g || (g = De(w)));
1172
+ const v = bt(u.type, u.operator, {
1173
+ percent: u.percent,
1174
+ bottom: u.bottom,
1175
+ rank: u.rank,
1176
+ aboveAverage: u.aboveAverage,
1177
+ text: g || u.text,
1178
+ timePeriod: u.timePeriod
1179
+ });
1180
+ if (!v) return null;
1181
+ let $;
1182
+ u.type === "cellIs" && Array.isArray(u.formulae) && u.formulae.length > 0 ? $ = u.formulae.map((I) => String(I ?? "")) : v.conditionName === "empty" || v.conditionName === "notEmpty" ? $ = [""] : u.type === "containsText" || u.type === "notContainsText" || u.type === "beginsWith" || u.type === "endsWith" ? $ = g ? [g] : De(w) ? [De(w)] : [] : $ = v.conditionValue.map(
1183
+ (I) => I == null ? "" : String(I)
1184
+ );
1185
+ const N = Ye(y);
1186
+ if (!N) return null;
1187
+ const R = Ge(u.style);
1188
+ return {
1189
+ type: "default",
1190
+ cellrange: N,
1191
+ format: {
1192
+ textColor: R.textColor,
1193
+ cellColor: R.cellColor,
1194
+ bold: R.bold,
1195
+ italic: R.italic,
1196
+ underline: R.underline,
1197
+ strikethrough: R.strikethrough
1198
+ },
1199
+ conditionName: v.conditionName,
1200
+ conditionRange: [],
1201
+ conditionValue: $
1202
+ };
1203
+ }
1204
+ async function _t({
1205
+ sheetEditorRef: y,
1206
+ ydocRef: u,
1207
+ setForceSheetRender: g,
1208
+ dsheetId: w,
1209
+ currentDataRef: p,
1210
+ updateDocumentTitle: v,
1211
+ filterToastShown: $,
1212
+ setFilterToastShown: N
1213
+ }, R, I, J, F) {
1214
+ var Ee, ce;
1215
+ const ie = R == null ? void 0 : R.target;
1216
+ if (!((Ee = ie == null ? void 0 : ie.files) != null && Ee.length) && !I)
1217
+ return Promise.resolve();
1218
+ const re = ((ce = ie == null ? void 0 : ie.files) == null ? void 0 : ce[0]) || I, fe = {}, Ce = {};
1219
+ let Ae = !1;
1220
+ return new Promise((Q, M) => {
1221
+ const G = new FileReader();
1222
+ G.onerror = () => M(new Error("Failed to read file")), G.onload = async (we) => {
1223
+ var Fe, Ve, oe, ne;
1224
+ if (!we.target) {
1225
+ console.error("FileReader event target is null"), M(new Error("FileReader event target is null"));
1226
+ return;
1227
+ }
1228
+ const ye = we.target.result, [{ Workbook: Se }, Re, Le] = await Promise.all([
1229
+ import("exceljs"),
1230
+ // @ts-expect-error — luckyexcel ships without TypeScript types
1231
+ import("luckyexcel"),
1232
+ import("./xlsx-image-utils-Cvg0qxRA.js")
1233
+ ]), Ne = Re.default.transformExcelToLucky, { extractImagesFromWorksheet: He, convertRawImagesToFortuneSheet: Te } = Le, ge = new Se();
1234
+ try {
1235
+ await ge.xlsx.load(ye);
1236
+ const ke = (ne = (oe = (Ve = (Fe = ge.model) == null ? void 0 : Fe.styles) == null ? void 0 : Ve.fonts) == null ? void 0 : oe[0]) == null ? void 0 : ne.size, _e = {}, xe = {}, $e = {}, Me = {};
1237
+ ge.eachSheet((X, ae) => {
1238
+ var a, f, C;
1239
+ const ee = ae - 1, de = {}, le = X.views;
1240
+ if (le && le.length > 0) {
1241
+ const l = le[0];
1242
+ if (l.state === "frozen") {
1243
+ const _ = l.xSplit || 0, A = l.ySplit || 0;
1244
+ let D = null;
1245
+ _ > 0 && A > 0 ? D = "rangeBoth" : A > 0 ? D = "rangeRow" : _ > 0 && (D = "rangeColumn"), D && (xe[ee] = {
1246
+ type: D,
1247
+ range: {
1248
+ row_focus: A - 1,
1249
+ column_focus: _ - 1
1250
+ }
1251
+ });
1252
+ }
1253
+ }
1254
+ const t = {};
1255
+ X.eachRow({ includeEmpty: !1 }, (l, _) => {
1256
+ l.eachCell({ includeEmpty: !1 }, (A, D) => {
1257
+ var se, ue, Z;
1258
+ const U = `${_ - 1}_${D - 1}`;
1259
+ A.hyperlink && (de[U] = [
1260
+ {
1261
+ linkType: "webpage",
1262
+ linkAddress: A.hyperlink
1263
+ }
1264
+ ]);
1265
+ const T = (se = A.style) == null ? void 0 : se.font, L = (ue = A.style) == null ? void 0 : ue.fill, O = {};
1266
+ if (T) {
1267
+ T.bold && (O.bl = 1), T.italic && (O.it = 1), T.underline && (O.un = 1);
1268
+ const x = T.size ?? ke;
1269
+ if (x && (O.fs = x), T.name && (O.ff = T.name), (Z = T.color) != null && Z.argb) {
1270
+ const h = T.color.argb, i = "#" + h.substring(h.length - 6);
1271
+ O.fc = i;
1272
+ }
1273
+ }
1274
+ if ((L == null ? void 0 : L.type) === "pattern" && L.pattern === "solid" && L.fgColor && L.fgColor.argb) {
1275
+ const x = L.fgColor.argb, h = "#" + x.substring(x.length - 6);
1276
+ O.bg = h;
1277
+ }
1278
+ Object.keys(O).length > 0 && (t[U] = O);
1279
+ });
1280
+ }), Object.keys(de).length > 0 && (_e[ee] = de), Object.keys(t).length > 0 && ($e[ee] = t);
1281
+ const r = He(X, ge);
1282
+ r.length > 0 && (Me[ee] = r);
1283
+ const n = X.tables;
1284
+ n && Object.keys(n).length > 0 && ((a = F == null ? void 0 : F.onWarning) == null || a.call(
1285
+ F,
1286
+ "Tables are not fully supported. Table styles will not be applied."
1287
+ ), F != null && F.suppressUiWarnings || Ie({
1288
+ title: "Tables are not fully supported",
1289
+ description: "Table styles will not be applied",
1290
+ variant: "warning",
1291
+ showCloseButton: !0,
1292
+ duration: 40 * 1e3
1293
+ }));
1294
+ const m = (f = X.dataValidations) == null ? void 0 : f.model;
1295
+ if (m && typeof m == "object") {
1296
+ const l = {};
1297
+ for (const [_, A] of Object.entries(m)) {
1298
+ const U = ht(_, A);
1299
+ U && (l[U.rowColKey] = U.entry);
1300
+ }
1301
+ Object.keys(l).length > 0 && (fe[ee] = l);
1302
+ }
1303
+ const e = X.conditionalFormattings;
1304
+ if (Array.isArray(e) && e.length > 0) {
1305
+ const l = [];
1306
+ for (const _ of e) {
1307
+ const A = _.ref, D = _.rules || [];
1308
+ for (const U of D) {
1309
+ const T = U;
1310
+ console.log("[XLSX CF RAW]", {
1311
+ ref: A,
1312
+ type: T.type,
1313
+ operator: T.operator,
1314
+ formulae: T.formulae,
1315
+ text: T.text,
1316
+ timePeriod: T.timePeriod,
1317
+ percent: T.percent,
1318
+ bottom: T.bottom,
1319
+ rank: T.rank,
1320
+ aboveAverage: T.aboveAverage
1321
+ });
1322
+ const L = T.type ? mt(A, T) : null;
1323
+ L ? console.log("[XLSX CF MAPPED] accepted", L) : console.log("[XLSX CF MAPPED] skipped", {
1324
+ ref: A,
1325
+ type: T.type,
1326
+ operator: T.operator,
1327
+ formulae: T.formulae,
1328
+ text: T.text
1329
+ }), L && l.push(L);
1330
+ }
1331
+ }
1332
+ l.length > 0 && (Ce[ee] = l);
1333
+ }
1334
+ X.autoFilter && (Ae || (Ae = !0, (C = F == null ? void 0 : F.onWarning) == null || C.call(
1335
+ F,
1336
+ "Filters are not supported in imported files."
1337
+ )), $ || (N(!0), F != null && F.suppressUiWarnings || Ie({
1338
+ title: "Filters are not supported in imported files",
1339
+ variant: "warning",
1340
+ showCloseButton: !0,
1341
+ duration: 30 * 1e3
1342
+ })));
1343
+ }), Ne(
1344
+ re,
1345
+ function(X) {
1346
+ var m;
1347
+ let ae = X.sheets;
1348
+ if (ae.forEach((e, d) => {
1349
+ const a = fe[d];
1350
+ a && Object.keys(a).length > 0 && (e.dataVerification = a);
1351
+ const f = Ce[d];
1352
+ e.luckysheet_conditionformat_save = Array.isArray(f) && f.length > 0 ? f : [];
1353
+ }), !u.current) {
1354
+ console.error("ydocRef.current is null");
1355
+ return;
1356
+ }
1357
+ const ee = u.current.getArray(w), de = Array.from(ee), le = /* @__PURE__ */ new Map();
1358
+ ae = ae.map((e, d) => {
1359
+ var T, L, O, se, ue, Z, x, h, i, c, k, o, s, E, H, j, W, S, be, ve, me, z, pe, We;
1360
+ const a = (T = e == null ? void 0 : e.celldata) == null ? void 0 : T[e.celldata.length - 1], f = (a == null ? void 0 : a.r) ?? 0, C = (a == null ? void 0 : a.c) ?? 0;
1361
+ if (e.row = Math.max(f, 500), e.column = Math.max(C, 36), e.id || (e.id = ((L = F == null ? void 0 : F.generateSheetId) == null ? void 0 : L.call(F)) ?? ((O = y.current) == null ? void 0 : O.getSettings().generateSheetId()) ?? ct()), xe[d] && (e.frozen = xe[d]), _e[d] && (e.hyperlink = {
1362
+ ...e.hyperlink || {},
1363
+ ..._e[d]
1364
+ }), (se = e.config) != null && se.columnlen) {
1365
+ const b = {};
1366
+ Object.entries(e.config.columnlen).forEach(
1367
+ ([P, V]) => {
1368
+ const Y = (Number(V) - 5) / 8 + 0.83;
1369
+ b[P] = Math.round(Y * 7 + 5);
1370
+ }
1371
+ ), e.config.columnlen = b;
1372
+ }
1373
+ if ((ue = e.config) != null && ue.rowlen) {
1374
+ const b = Math.round(
1375
+ Number(e.defaultRowHeight) || 21
1376
+ ), P = {};
1377
+ Object.entries(e.config.rowlen).forEach(([V, Y]) => {
1378
+ Math.abs(Math.round(Number(Y)) - b) > 1 && (P[V] = Number(Y));
1379
+ }), e.config.rowlen = P;
1380
+ }
1381
+ if ((Z = e.config) != null && Z.customHeight) {
1382
+ const b = new Set(
1383
+ Object.keys(e.config.rowlen || {})
1384
+ ), P = {};
1385
+ Object.entries(e.config.customHeight).forEach(
1386
+ ([V, Y]) => {
1387
+ b.has(V) && Number(Y) === 1 && (P[V] = 1);
1388
+ }
1389
+ ), e.config.customHeight = P;
1390
+ }
1391
+ if (Me[d]) {
1392
+ const b = Number(e.defaultColWidth) || Number(
1393
+ (i = (h = (x = y.current) == null ? void 0 : x.getSettings) == null ? void 0 : h.call(x)) == null ? void 0 : i.defaultColWidth
1394
+ ) || 99, P = Number(e.defaultRowHeight) || Number(
1395
+ (o = (k = (c = y.current) == null ? void 0 : c.getSettings) == null ? void 0 : k.call(c)) == null ? void 0 : o.defaultRowHeight
1396
+ ) || 21;
1397
+ e.images = Te(
1398
+ Me[d],
1399
+ e,
1400
+ b,
1401
+ P
1402
+ );
1403
+ }
1404
+ const l = _e[d], _ = $e[d], A = [], D = (b, P) => {
1405
+ const V = `${b}_${P}`;
1406
+ D._seen == null && (D._seen = /* @__PURE__ */ new Set());
1407
+ const Y = D._seen;
1408
+ Y.has(V) || (Y.add(V), A.push({ r: b, c: P, id: e.id }));
1409
+ }, U = (s = e.config) != null && s.merge ? /* @__PURE__ */ new Map() : null;
1410
+ if (e.celldata)
1411
+ for (const b of e.celldata) {
1412
+ const P = `${b.r}_${b.c}`;
1413
+ if (U == null || U.set(
1414
+ P,
1415
+ b
1416
+ ), b.v) {
1417
+ if (b.v.f) {
1418
+ const B = String(b.v.f);
1419
+ B.startsWith("=") || (b.v.f = `=${B}`);
1420
+ }
1421
+ if (b.v.f && ((E = b.v.ct) == null ? void 0 : E.t) !== "d" && (b.v.ct = { ...b.v.ct ?? {}, t: "str" }, D(b.r, b.c)), _ != null && _[P]) {
1422
+ const B = _[P];
1423
+ if (!!(l != null && l[P])) {
1424
+ const { fc: K, un: Oe, ...Xe } = B;
1425
+ Object.assign(b.v, Xe);
1426
+ } else
1427
+ Object.assign(b.v, B);
1428
+ }
1429
+ if (l != null && l[P] && !b.v.f) {
1430
+ const B = l[P][0];
1431
+ B && tt(
1432
+ b.v,
1433
+ B
1434
+ );
1435
+ }
1436
+ const V = (H = b.v.ct) == null ? void 0 : H.fa, Y = typeof V == "string" ? V.trim().toLowerCase() : "", te = Y === "general" || ((j = b.v.ct) == null ? void 0 : j.t) === "g", he = Y === "@" || ((W = b.v.ct) == null ? void 0 : W.t) === "s";
1437
+ if (V && !le.has(V) && le.set(V, Pe.is_date(V)), !b.v.f && V && le.get(V)) {
1438
+ const B = typeof b.v.v == "string" ? parseFloat(b.v.v) : b.v.v;
1439
+ if (typeof B == "number" && !isNaN(B))
1440
+ try {
1441
+ b.v.v = B, b.v.m = Pe.format(V, B), b.v.ct = { ...b.v.ct, t: "d" };
1442
+ } catch {
1443
+ }
1444
+ } else if (!b.v.f && typeof b.v.v == "string" && !he && !te) {
1445
+ const B = b.v.v.trim();
1446
+ if (/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?$/.test(
1447
+ B
1448
+ )) {
1449
+ const K = Number(B);
1450
+ if (!isFinite(K))
1451
+ continue;
1452
+ if (b.v.v = K, b.v.ht == null && (b.v.ht = 2), !V)
1453
+ b.v.m = String(K);
1454
+ else
1455
+ try {
1456
+ b.v.m = Pe.format(V, K);
1457
+ } catch {
1458
+ }
1459
+ }
1460
+ } else !b.v.f && typeof b.v.v == "number" && isFinite(b.v.v) && ((S = b.v.ct) == null ? void 0 : S.t) !== "s" && ((be = b.v.ct) == null ? void 0 : be.t) !== "d" && b.v.ht == null && (b.v.ht = 2);
1461
+ if (!b.v.f && (b.v.m === void 0 || b.v.m === null) && ((ve = b.v.ct) == null ? void 0 : ve.t) !== "d") {
1462
+ const B = ot((me = b.v.ct) == null ? void 0 : me.s), q = b.v.v;
1463
+ if (!(q == null || String(q).trim() === ""))
1464
+ if (B != null)
1465
+ b.v.m = B;
1466
+ else if (typeof q == "boolean")
1467
+ b.v.m = lt(q);
1468
+ else if (typeof q == "number" && isFinite(q)) {
1469
+ const Oe = (z = b.v.ct) == null ? void 0 : z.fa;
1470
+ if (typeof Oe == "string" && Oe && le.get(Oe) === !1)
1471
+ try {
1472
+ b.v.m = Pe.format(Oe, q);
1473
+ } catch {
1474
+ b.v.m = String(q);
1475
+ }
1476
+ else
1477
+ b.v.m = String(q);
1478
+ } else typeof q == "object" || (b.v.m = String(q));
1479
+ }
1480
+ }
1481
+ }
1482
+ if (Array.isArray(e.data)) {
1483
+ const b = e.data;
1484
+ for (let P = 0; P < b.length; P++) {
1485
+ const V = b[P];
1486
+ if (Array.isArray(V))
1487
+ for (let Y = 0; Y < V.length; Y++) {
1488
+ const te = V[Y];
1489
+ if (!te || typeof te != "object" || !te.f) continue;
1490
+ const he = String(te.f);
1491
+ he.startsWith("=") || (te.f = `=${he}`), ((pe = te.ct) == null ? void 0 : pe.t) !== "d" && (te.ct = { ...te.ct ?? {}, t: "str" }, D(P, Y));
1492
+ }
1493
+ }
1494
+ }
1495
+ if (e.calcChain = A, U && ((We = e.config) != null && We.merge) && e.celldata)
1496
+ for (const b of Object.values(e.config.merge)) {
1497
+ const { r: P, c: V, rs: Y, cs: te } = b;
1498
+ for (let he = 0; he < Y; he++)
1499
+ for (let B = 0; B < te; B++) {
1500
+ const q = `${P + he}_${V + B}`;
1501
+ let K = U.get(q);
1502
+ K || (K = { r: P + he, c: V + B, v: {} }, e.celldata.push(K), U.set(q, K)), K.v || (K.v = {}), K.v.mc = he === 0 && B === 0 ? { r: P, c: V, rs: Y, cs: te } : { r: P, c: V };
1503
+ }
1504
+ }
1505
+ return e;
1506
+ }), console.log("[xlsx-import] parsed sheets data", {
1507
+ fileName: re.name,
1508
+ sheetCount: ae.length,
1509
+ sheets: ae
1510
+ });
1511
+ let t;
1512
+ if (J === "merge-current-dsheet" ? t = [...de, ...ae] : t = [...ae], t = t.map((e, d) => (e.order = d, e)), u.current.transact(() => {
1513
+ J !== "merge-current-dsheet" && ee.delete(0, ee.length), t.forEach((e) => {
1514
+ if (e instanceof Je.Map) return;
1515
+ const d = Qe(e);
1516
+ ee.push([d()]);
1517
+ });
1518
+ }), u != null && u.current) {
1519
+ const e = u.current.getArray(w), d = Ke(e);
1520
+ p.current = d, g((a) => a + 1);
1521
+ }
1522
+ F != null && F.headless || st(y);
1523
+ const n = et((m = X == null ? void 0 : X.info) == null ? void 0 : m.name);
1524
+ v == null || v(n), Q();
1525
+ }
1526
+ );
1527
+ } catch (ke) {
1528
+ console.error("Error loading the workbook", ke), !(F != null && F.suppressUiWarnings) && typeof alert < "u" && alert(
1529
+ "Error loading the workbook. Please ensure it is a valid .xlsx file."
1530
+ ), M(ke);
1531
+ }
1532
+ }, G.readAsArrayBuffer(re);
1533
+ });
1534
+ }
1535
+ export {
1536
+ _t as runXlsxFileUpload
1537
+ };