@fileverse-dev/dsheet 3.0.1-yjs-15 → 3.0.2-29July-1

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.
Files changed (37) hide show
  1. package/dist/{constants-Cdz6oSCq.js → constants-Q8nzbvQO.js} +5 -3
  2. package/dist/constants.js +1 -1
  3. package/dist/editor/components/editor-workbook-sync.d.ts +1 -1
  4. package/dist/editor/constants/shared-constants.d.ts +2 -0
  5. package/dist/editor/hooks/use-xlsx-import-impl.d.ts +1 -2
  6. package/dist/editor/hooks/use-xlsx-import.d.ts +1 -2
  7. package/dist/editor/utils/apply-comment-markers.d.ts +22 -0
  8. package/dist/editor/utils/update-ydoc.d.ts +2 -2
  9. package/dist/{executeStringFunction-BHy-_q3d.js → executeStringFunction-C5hEkx9z.js} +9240 -14112
  10. package/dist/formula.js +1 -1
  11. package/dist/{index-OL2_pnvq.js → index-B5OjJYA0.js} +25764 -22624
  12. package/dist/index.es.js +39 -39
  13. package/dist/sheet-engine/core/api/cell.d.ts +20 -0
  14. package/dist/sheet-engine/core/api/common.d.ts +1 -2
  15. package/dist/sheet-engine/core/api/index.d.ts +0 -1
  16. package/dist/sheet-engine/core/api/sheet.d.ts +0 -5
  17. package/dist/sheet-engine/core/modules/formula-worker-bridge.d.ts +0 -1
  18. package/dist/sheet-engine/core/modules/sheet-metadata-hooks.d.ts +0 -4
  19. package/dist/sheet-engine/core/modules/sheet.d.ts +1 -17
  20. package/dist/sheet-engine/core/settings.d.ts +1 -1
  21. package/dist/sheet-engine/core/types.d.ts +0 -3
  22. package/dist/sheet-engine/react/components/Workbook/api.d.ts +1 -8
  23. package/dist/sheet-engine/react/components/Workbook/index.d.ts +1 -5
  24. package/dist/use-xlsx-import-impl-CevfOsNi.js +1556 -0
  25. package/dist/xlsx-export-impl-CiWHN8hx.js +3138 -0
  26. package/package.json +2 -2
  27. package/dist/editor/hooks/use-celldata-compaction.d.ts +0 -23
  28. package/dist/editor/utils/compact-committed-celldata.d.ts +0 -28
  29. package/dist/editor/utils/config-ydoc-update.d.ts +0 -20
  30. package/dist/sheet-engine/core/api/sheet-flowdata-lifecycle.d.ts +0 -17
  31. package/dist/sheet-engine/core/paste/paste-border-utils.d.ts +0 -23
  32. package/dist/sheet-engine/core/utils/border-config-utils.d.ts +0 -16
  33. package/dist/sheet-engine/core/utils/cell-persist-utils.d.ts +0 -10
  34. package/dist/sheet-engine/core/utils/range-format.d.ts +0 -71
  35. package/dist/sheet-engine/core/utils/ydoc-celldata-changes.d.ts +0 -40
  36. package/dist/use-xlsx-import-impl-Bvgo-6F2.js +0 -1554
  37. package/dist/xlsx-export-impl-CxyAa2j_.js +0 -3126
@@ -0,0 +1,1556 @@
1
+ import { g as Je } from "./executeStringFunction-C5hEkx9z.js";
2
+ import * as Ue from "yjs";
3
+ import { m as Qe, y as Ke, r as et } from "./index-B5OjJYA0.js";
4
+ import { n as tt } from "./xlsx-hyperlink-inline-DzewAypN.js";
5
+ import { toast as Ie } from "@fileverse/ui";
6
+ var qe = { exports: {} };
7
+ (function(y) {
8
+ var s = {}, g = function(w) {
9
+ w.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 U(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 ne(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
+ w.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
+ w._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
+ w._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
+ w._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 ae = /* @__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 ae(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 ae(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 u = Math.floor(Math.log(i) * Math.LOG10E) % o;
289
+ if (u < 0 && (u += o), c = (i / Math.pow(10, u)).toPrecision(k + 1 + (o + u) % 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 + u) : c += "E+" + (E - u); 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 + u) % o) + "." + S.substr(u) + "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), u = Math.floor(o / k), E = o - u * k, H = k;
304
+ return c + (u === 0 ? "" : "" + u) + " " + (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 I(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, u, E, H, j = Math.abs(c), W = c < 0 ? "-" : "";
349
+ if (i.match(/^00+$/)) return W + ne(j, i.length);
350
+ if (i.match(/^[#?]+$/))
351
+ return o = ne(c, 0), o === "0" && (o = ""), o.length > i.length ? o : A(i.substr(0, i.length - o.length)) + o;
352
+ if (u = i.match(d)) return a(u, j, W);
353
+ if (i.match(/^#+0+$/)) return W + ne(j, i.length - i.indexOf("0"));
354
+ if (u = i.match(C))
355
+ return o = D(c, u[1].length).replace(/^([^\.]+)$/, "$1." + A(u[1])).replace(/\.$/, "." + A(u[1])).replace(/\.(\d*)$/, function(z, pe) {
356
+ return "." + pe + $("0", A(u[1]).length - pe.length);
357
+ }), i.indexOf("0.") !== -1 ? o : o.replace(/^0\./, ".");
358
+ if (i = i.replace(/^#+([0.])/, "$1"), u = i.match(/^(0*)\.(#*)$/))
359
+ return W + D(j, u[2].length).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, u[1].length ? "0." : ".");
360
+ if (u = i.match(/^#{1,3},##0(\.?)$/)) return W + oe(ne(j, 0));
361
+ if (u = i.match(/^#,##0\.([#0]*0)$/))
362
+ return c < 0 ? "-" + O(h, i, -c) : oe("" + (Math.floor(c) + T(c, u[1].length))) + "." + N(I(c, u[1].length), u[1].length);
363
+ if (u = i.match(/^#,#*,#0/)) return O(h, i.replace(/^#,#*,/, ""), c);
364
+ if (u = 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 (u = i.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))
372
+ return E = Math.min(u[4].length, 7), H = we(j, Math.pow(10, E) - 1, !1), o = "" + W, S = ae("n", u[1], H[1]), S.charAt(S.length - 1) == " " && (S = S.substr(0, S.length - 1) + "0"), o += S + u[2] + "/" + u[3], S = U(H[2], E), S.length < u[4].length && (S = A(u[4].substr(u[4].length - S.length)) + S), o += S, o;
373
+ if (u = i.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))
374
+ return E = Math.min(Math.max(u[1].length, u[4].length), 7), H = we(j, Math.pow(10, E) - 1, !0), W + (H[0] || (H[1] ? "" : "0")) + " " + (H[1] ? R(H[1], E) + u[2] + "/" + u[3] + U(H[2], E) : $(" ", 2 * E + 1 + u[2].length + u[3].length));
375
+ if (u = i.match(/^[#0?]+$/))
376
+ return o = ne(c, 0), i.length <= o.length ? o : A(i.substr(0, i.length - o.length)) + o;
377
+ if (u = i.match(/^([#0?]+)\.([#0]+)$/)) {
378
+ o = "" + c.toFixed(Math.min(u[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 (u = i.match(/^00,000\.([#0]*0)$/))
383
+ return E = I(c, u[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, u[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(ne(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 ae(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 ae(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 u = Math.floor(Math.log(i) * Math.LOG10E) % o;
417
+ if (u < 0 && (u += o), c = (i / Math.pow(10, u)).toPrecision(k + 1 + (o + u) % 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 + u) : c += "E+" + (E - u), c = c.replace(/\+-/, "-");
420
+ }
421
+ c = c.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function(H, j, W, S) {
422
+ return j + W + S.substr(0, (o + u) % o) + "." + S.substr(u) + "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, u, 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 (u = i.match(d)) return f(u, j, W);
441
+ if (i.match(/^#+0+$/)) return W + N(j, i.length - i.indexOf("0"));
442
+ if (u = i.match(C))
443
+ return o = ("" + c).replace(/^([^\.]+)$/, "$1." + A(u[1])).replace(/\.$/, "." + A(u[1])), o = o.replace(/\.(\d*)$/, function(z, pe) {
444
+ return "." + pe + $("0", A(u[1]).length - pe.length);
445
+ }), i.indexOf("0.") !== -1 ? o : o.replace(/^0\./, ".");
446
+ if (i = i.replace(/^#+([0.])/, "$1"), u = i.match(/^(0*)\.(#*)$/))
447
+ return W + ("" + j).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, u[1].length ? "0." : ".");
448
+ if (u = i.match(/^#{1,3},##0(\.?)$/)) return W + oe("" + j);
449
+ if (u = i.match(/^#,##0\.([#0]*0)$/))
450
+ return c < 0 ? "-" + x(h, i, -c) : oe("" + c) + "." + $("0", u[1].length);
451
+ if (u = i.match(/^#,#*,#0/)) return x(h, i.replace(/^#,#*,/, ""), c);
452
+ if (u = 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 (u = i.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))
460
+ return E = Math.min(u[4].length, 7), H = we(j, Math.pow(10, E) - 1, !1), o = "" + W, S = ae("n", u[1], H[1]), S.charAt(S.length - 1) == " " && (S = S.substr(0, S.length - 1) + "0"), o += S + u[2] + "/" + u[3], S = U(H[2], E), S.length < u[4].length && (S = A(u[4].substr(u[4].length - S.length)) + S), o += S, o;
461
+ if (u = i.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))
462
+ return E = Math.min(Math.max(u[1].length, u[4].length), 7), H = we(j, Math.pow(10, E) - 1, !0), W + (H[0] || (H[1] ? "" : "0")) + " " + (H[1] ? R(H[1], E) + u[2] + "/" + u[3] + U(H[2], E) : $(" ", 2 * E + 1 + u[2].length + u[3].length));
463
+ if (u = i.match(/^[#0?]+$/))
464
+ return o = "" + c, i.length <= o.length ? o : A(i.substr(0, i.length - o.length)) + o;
465
+ if (u = i.match(/^([#0]+)\.([#0]+)$/)) {
466
+ o = "" + c.toFixed(Math.min(u[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 (u = 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, u[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
+ w._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
+ w.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 I = t.charAt(++a), T = I === "(" || I === ")" ? I : "t";
613
+ e[e.length] = { t: T, v: I }, ++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 = ae("n", Z, i)) : (i = r < 0 && m > 1 ? -r : r, c = ae("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 = ae(e[a].t, e[a].v, i), e[a].t = "t");
804
+ var u = "";
805
+ for (a = 0; a !== e.length; ++a) e[a] != null && (u += e[a].v);
806
+ return u;
807
+ }
808
+ w._eval = $e;
809
+ var Me = /\[[=<>]/, X = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;
810
+ function ee(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 te(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 ee(r, a) ? [m, n[0]] : ee(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 = te(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
+ w.load = le, w._table = ce, w.get_table = function() {
896
+ return ce;
897
+ }, w.load_table = function(r) {
898
+ for (var n = 0; n != 392; ++n)
899
+ r[n] !== void 0 && le(r[n], n);
900
+ }, w.init_table = Ee, w.format = de;
901
+ };
902
+ g(s), typeof DO_NOT_EXPORT_SSF > "u" && (y.exports = s);
903
+ })(qe);
904
+ var rt = qe.exports;
905
+ const Pe = /* @__PURE__ */ Je(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
+ ], Ye = Be[0], nt = [
931
+ ["true", "false"],
932
+ ["yes", "no"],
933
+ ["1", "0"]
934
+ ];
935
+ function at(y, s) {
936
+ const g = y.toLowerCase(), p = s.toLowerCase();
937
+ return nt.some(([w, v]) => g === w && p === 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, s) {
944
+ if (!s.has(y)) return y;
945
+ let g = 1, p = `${y} (${g})`;
946
+ for (; s.has(p); )
947
+ g += 1, p = `${y} (${g})`;
948
+ return p;
949
+ }
950
+ function lt(y) {
951
+ if (!Array.isArray(y) || y.length === 0) return null;
952
+ const s = y.map((p) => String((p == null ? void 0 : p.v) ?? "")).join("");
953
+ return s.trim() ? s : null;
954
+ }
955
+ function st(y) {
956
+ return y ? "TRUE" : "FALSE";
957
+ }
958
+ function ut(y) {
959
+ let s = !1, g = 0;
960
+ const p = () => {
961
+ if (s) return !0;
962
+ const v = y.current;
963
+ if (!(v != null && v.getWorkbookContext) || !v.recalculateAllFormulas) return !1;
964
+ const $ = v.getWorkbookContext(), N = $ == null ? void 0 : $.luckysheetfile;
965
+ return !(N != null && N.length) || !N.some(
966
+ (U) => Array.isArray(U.data) && U.data.length > 0
967
+ ) ? !1 : (v.recalculateAllFormulas(), s = !0, !0);
968
+ }, w = () => {
969
+ var v, $;
970
+ p() || (g += 1, g < it ? requestAnimationFrame(w) : (($ = (v = y.current) == null ? void 0 : v.recalculateAllFormulas) == null || $.call(v), s = !0));
971
+ };
972
+ requestAnimationFrame(() => requestAnimationFrame(w));
973
+ for (const v of [120, 400, 1200])
974
+ window.setTimeout(() => {
975
+ s || p();
976
+ }, v);
977
+ }
978
+ function ht(y) {
979
+ return y <= 0 ? Ye : y > Be.length ? Array(y).fill(Ye).join(", ") : Be.slice(0, y).join(", ");
980
+ }
981
+ function je(y) {
982
+ const s = y.match(/^([A-Z]+)(\d+)$/i);
983
+ if (!s) return null;
984
+ const g = s[1].toUpperCase(), p = s[2];
985
+ let w = 0;
986
+ for (let N = 0; N < g.length; N++)
987
+ w = w * 26 + (g.charCodeAt(N) - 64);
988
+ const v = parseInt(p, 10) - 1, $ = w - 1;
989
+ return { row: v, col: $ };
990
+ }
991
+ function ft(y, s) {
992
+ const g = je(y);
993
+ if (!g) return null;
994
+ const { row: p, col: w } = g, v = `${p}_${w}`, $ = Array.isArray(s.formulae) && s.formulae.length > 0 ? String(s.formulae[0]).replace(/^["']|["']$/g, "").replace(/["']/g, "") : "", N = $.split(",").map((fe) => fe.trim()).filter(Boolean);
995
+ let R = s.type === "list" ? "dropdown" : s.type || "dropdown", U = $, J = "";
996
+ s.type === "list" && N.length === 2 && at(N[0], N[1]) && (R = "checkbox", U = N[0], J = N[1]);
997
+ const F = R === "checkbox" ? 1 : U ? U.split(",").length : 0, ie = ht(F || 1), ne = {
998
+ type: R,
999
+ type2: "",
1000
+ rangeTxt: y,
1001
+ value1: U,
1002
+ value2: J,
1003
+ validity: "",
1004
+ remote: !1,
1005
+ prohibitInput: s.type === "list",
1006
+ hintShow: !!s.showInputMessage,
1007
+ hintValue: s.prompt ?? "",
1008
+ color: ie,
1009
+ checked: !1
1010
+ };
1011
+ return { rowColKey: v, entry: ne };
1012
+ }
1013
+ function gt(y) {
1014
+ const s = y.split(":"), g = je(s[0].trim());
1015
+ if (!g) return null;
1016
+ const p = s.length > 1 ? je(s[1].trim()) : g;
1017
+ return p ? {
1018
+ row: [Math.min(g.row, p.row), Math.max(g.row, p.row)],
1019
+ column: [Math.min(g.col, p.col), Math.max(g.col, p.col)]
1020
+ } : null;
1021
+ }
1022
+ function dt(y) {
1023
+ return String(y || "").split(/[,\s]+/).map((s) => s.trim()).filter(Boolean).map((s) => gt(s)).filter(
1024
+ (s) => !!s
1025
+ );
1026
+ }
1027
+ function Ge(y) {
1028
+ const s = dt(y);
1029
+ return s.length ? s.map((g) => {
1030
+ const [p, w] = g.row, [v, $] = g.column;
1031
+ return {
1032
+ left: 0,
1033
+ width: 104,
1034
+ top: 0,
1035
+ height: 23,
1036
+ left_move: 0,
1037
+ width_move: 104,
1038
+ top_move: 0,
1039
+ height_move: 11999,
1040
+ row: [p, w],
1041
+ column: [v, $],
1042
+ row_focus: p,
1043
+ column_focus: v,
1044
+ column_select: !0
1045
+ };
1046
+ }) : null;
1047
+ }
1048
+ function ze(y) {
1049
+ var $, N;
1050
+ const s = {
1051
+ textColor: "#000000",
1052
+ cellColor: "#ffffff",
1053
+ bold: !1,
1054
+ italic: !1,
1055
+ underline: !1,
1056
+ strikethrough: !1
1057
+ };
1058
+ if (!y) return s;
1059
+ const g = y.font, p = y.fill;
1060
+ let w = s.textColor, v = s.cellColor;
1061
+ if (($ = g == null ? void 0 : g.color) != null && $.argb) {
1062
+ const R = g.color.argb;
1063
+ w = "#" + (R.length >= 6 ? R.slice(-6) : R);
1064
+ }
1065
+ if ((p == null ? void 0 : p.type) === "pattern" && p.pattern === "solid" && ((N = p.fgColor) != null && N.argb)) {
1066
+ const R = p.fgColor.argb;
1067
+ v = "#" + (R.length >= 6 ? R.slice(-6) : R);
1068
+ }
1069
+ return {
1070
+ textColor: w,
1071
+ cellColor: v,
1072
+ bold: !!(g != null && g.bold),
1073
+ italic: !!(g != null && g.italic),
1074
+ underline: !!(g != null && g.underline),
1075
+ strikethrough: !1
1076
+ };
1077
+ }
1078
+ function Xe(y) {
1079
+ if (!y || typeof y != "string") return "";
1080
+ const s = y.trim().replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, "&").replace(/^=/, ""), g = s.match(/(?:^|[^A-Z])SEARCH\s*\([\s(]*"((?:[^"]|"")*)"/i);
1081
+ if (g) return (g[1] ?? "").replace(/""/g, '"');
1082
+ const p = s.match(/(?:^|[^A-Z])SEARCH\s*\([\s(]*'([^']*)'/i);
1083
+ return p ? p[1] ?? "" : "";
1084
+ }
1085
+ function De(y) {
1086
+ if (!y || typeof y != "string") return "";
1087
+ const s = y.trim().replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/^=/, ""), g = s.match(/"((?:[^"]|"")*)"/);
1088
+ if (g) return (g[1] ?? "").replace(/""/g, '"');
1089
+ const p = s.match(/'([^']*)'/);
1090
+ return p ? p[1] ?? "" : "";
1091
+ }
1092
+ function bt(y) {
1093
+ if (!y || typeof y != "string") return null;
1094
+ const s = y.trim().toUpperCase(), g = Xe(y) || De(y);
1095
+ return g ? s.includes("SEARCH(") ? s.includes("ISERROR(SEARCH(") || s.includes("NOTNUMBER(SEARCH(") ? { conditionName: "textDoesNotContain", conditionValue: [g] } : { conditionName: "textContains", conditionValue: [g] } : s.includes("LEFT(") ? { conditionName: "textStartsWith", conditionValue: [g] } : s.includes("RIGHT(") ? { conditionName: "textEndsWith", conditionValue: [g] } : s.includes("EXACT(") || s.includes('="') ? { conditionName: "textExactly", conditionValue: [g] } : null : null;
1096
+ }
1097
+ function mt(y, s, g) {
1098
+ const p = (y || "").toLowerCase();
1099
+ if (p === "cellis") {
1100
+ const w = (s || "").toLowerCase();
1101
+ return w === "greaterthan" ? { conditionName: "greaterThan", conditionValue: [] } : w === "greaterthanorequal" ? { conditionName: "greaterThanOrEqual", conditionValue: [] } : w === "lessthan" ? { conditionName: "lessThan", conditionValue: [] } : w === "lessthanorequal" ? { conditionName: "lessThanOrEqual", conditionValue: [] } : w === "equal" ? { conditionName: "equal", conditionValue: [] } : w === "notequal" ? { conditionName: "notEqual", conditionValue: [] } : w === "between" ? { conditionName: "between", conditionValue: [] } : w === "notbetween" ? { conditionName: "notBetween", conditionValue: [] } : null;
1102
+ }
1103
+ if (p === "containstext" || p === "notcontainstext" || p === "beginswith" || p === "endswith" || p === "containsblanks" || p === "notcontainsblanks") {
1104
+ const w = (s ?? "").toLowerCase();
1105
+ if (p === "containsblanks" || w === "containsblanks")
1106
+ return { conditionName: "empty", conditionValue: [""] };
1107
+ if (p === "notcontainsblanks" || w === "notcontainsblanks")
1108
+ return { conditionName: "notEmpty", conditionValue: [""] };
1109
+ if (p === "notcontainstext" || w === "notcontainstext" || w === "notcontains")
1110
+ return { conditionName: "textDoesNotContain", conditionValue: [] };
1111
+ if (p === "beginswith" || w === "beginswith")
1112
+ return { conditionName: "textStartsWith", conditionValue: [] };
1113
+ if (p === "endswith" || w === "endswith")
1114
+ return { conditionName: "textEndsWith", conditionValue: [] };
1115
+ if (w === "equal")
1116
+ return { conditionName: "textExactly", conditionValue: [] };
1117
+ const v = (g == null ? void 0 : g.text) ?? "";
1118
+ return {
1119
+ conditionName: "textContains",
1120
+ conditionValue: v ? [v] : []
1121
+ };
1122
+ }
1123
+ if (p === "duplicatevalues")
1124
+ return { conditionName: "duplicateValue", conditionValue: ["0"] };
1125
+ if (p === "uniquevalues")
1126
+ return { conditionName: "duplicateValue", conditionValue: ["1"] };
1127
+ if (p === "top10") {
1128
+ const w = (g == null ? void 0 : g.rank) ?? 10;
1129
+ return g != null && g.percent && (g != null && g.bottom) ? {
1130
+ conditionName: "last10_percent",
1131
+ conditionValue: [String(w)]
1132
+ } : g != null && g.percent ? { conditionName: "top10_percent", conditionValue: [String(w)] } : g != null && g.bottom ? { conditionName: "last10", conditionValue: [String(w)] } : { conditionName: "top10", conditionValue: [String(w)] };
1133
+ }
1134
+ if (p === "aboveaverage")
1135
+ return (g == null ? void 0 : g.aboveAverage) === !1 ? { conditionName: "belowAverage", conditionValue: [] } : { conditionName: "aboveAverage", conditionValue: [] };
1136
+ if (p === "timeperiod") {
1137
+ const w = ((g == null ? void 0 : g.timePeriod) ?? "").toLowerCase();
1138
+ return w === "today" || w === "tomorrow" || w === "yesterday" ? {
1139
+ conditionName: "dateIs",
1140
+ conditionValue: [`preset:${w}`, "", "DD/MM/YYYY"]
1141
+ } : w === "last7days" ? {
1142
+ conditionName: "dateIs",
1143
+ conditionValue: ["preset:pastWeek", "", "DD/MM/YYYY"]
1144
+ } : w === "lastmonth" ? {
1145
+ conditionName: "dateIs",
1146
+ conditionValue: ["preset:pastMonth", "", "DD/MM/YYYY"]
1147
+ } : w === "lastyear" ? {
1148
+ conditionName: "dateIs",
1149
+ conditionValue: ["preset:pastYear", "", "DD/MM/YYYY"]
1150
+ } : null;
1151
+ }
1152
+ return null;
1153
+ }
1154
+ function pt(y, s) {
1155
+ if (!s.type) return null;
1156
+ let g = (s.text ?? "").trim();
1157
+ const p = Array.isArray(s.formulae) && s.formulae[0] ? String(s.formulae[0]) : void 0, w = (s.type.toLowerCase() === "expression" || s.type.toLowerCase() === "customformula") && bt(p);
1158
+ if (w) {
1159
+ const U = Ge(y);
1160
+ if (!U) return null;
1161
+ const J = ze(s.style);
1162
+ return {
1163
+ type: "default",
1164
+ cellrange: U,
1165
+ format: {
1166
+ textColor: J.textColor,
1167
+ cellColor: J.cellColor,
1168
+ bold: J.bold,
1169
+ italic: J.italic,
1170
+ underline: J.underline,
1171
+ strikethrough: J.strikethrough
1172
+ },
1173
+ conditionName: w.conditionName,
1174
+ conditionRange: [],
1175
+ conditionValue: w.conditionValue
1176
+ };
1177
+ }
1178
+ (s.type === "containsText" || s.type === "notContainsText" || s.type === "beginsWith" || s.type === "endsWith") && !g && (g = Xe(p), g || (g = De(p)));
1179
+ const v = mt(s.type, s.operator, {
1180
+ percent: s.percent,
1181
+ bottom: s.bottom,
1182
+ rank: s.rank,
1183
+ aboveAverage: s.aboveAverage,
1184
+ text: g || s.text,
1185
+ timePeriod: s.timePeriod
1186
+ });
1187
+ if (!v) return null;
1188
+ let $;
1189
+ s.type === "cellIs" && Array.isArray(s.formulae) && s.formulae.length > 0 ? $ = s.formulae.map((U) => String(U ?? "")) : v.conditionName === "empty" || v.conditionName === "notEmpty" ? $ = [""] : s.type === "containsText" || s.type === "notContainsText" || s.type === "beginsWith" || s.type === "endsWith" ? $ = g ? [g] : De(p) ? [De(p)] : [] : $ = v.conditionValue.map(
1190
+ (U) => U == null ? "" : String(U)
1191
+ );
1192
+ const N = Ge(y);
1193
+ if (!N) return null;
1194
+ const R = ze(s.style);
1195
+ return {
1196
+ type: "default",
1197
+ cellrange: N,
1198
+ format: {
1199
+ textColor: R.textColor,
1200
+ cellColor: R.cellColor,
1201
+ bold: R.bold,
1202
+ italic: R.italic,
1203
+ underline: R.underline,
1204
+ strikethrough: R.strikethrough
1205
+ },
1206
+ conditionName: v.conditionName,
1207
+ conditionRange: [],
1208
+ conditionValue: $
1209
+ };
1210
+ }
1211
+ async function At({
1212
+ sheetEditorRef: y,
1213
+ ydocRef: s,
1214
+ setForceSheetRender: g,
1215
+ dsheetId: p,
1216
+ currentDataRef: w,
1217
+ updateDocumentTitle: v,
1218
+ filterToastShown: $,
1219
+ setFilterToastShown: N
1220
+ }, R, U, J, F) {
1221
+ var Ee, ce;
1222
+ const ie = R == null ? void 0 : R.target;
1223
+ if (!((Ee = ie == null ? void 0 : ie.files) != null && Ee.length) && !U)
1224
+ return Promise.resolve();
1225
+ const ne = ((ce = ie == null ? void 0 : ie.files) == null ? void 0 : ce[0]) || U, fe = {}, Ce = {};
1226
+ let Ae = !1;
1227
+ return new Promise((Q, M) => {
1228
+ const G = new FileReader();
1229
+ G.onerror = () => M(new Error("Failed to read file")), G.onload = async (we) => {
1230
+ var Fe, Ve, oe, ae;
1231
+ if (!we.target) {
1232
+ console.error("FileReader event target is null"), M(new Error("FileReader event target is null"));
1233
+ return;
1234
+ }
1235
+ const ye = we.target.result, [{ Workbook: Se }, Re, Le] = await Promise.all([
1236
+ import("exceljs"),
1237
+ // @ts-expect-error — luckyexcel ships without TypeScript types
1238
+ import("luckyexcel"),
1239
+ import("./xlsx-image-utils-Cvg0qxRA.js")
1240
+ ]), Ne = Re.default.transformExcelToLucky, { extractImagesFromWorksheet: He, convertRawImagesToFortuneSheet: Te } = Le, ge = new Se();
1241
+ try {
1242
+ await ge.xlsx.load(ye);
1243
+ const ke = (ae = (oe = (Ve = (Fe = ge.model) == null ? void 0 : Fe.styles) == null ? void 0 : Ve.fonts) == null ? void 0 : oe[0]) == null ? void 0 : ae.size, _e = {}, xe = {}, $e = {}, Me = {};
1244
+ ge.eachSheet((X, ee) => {
1245
+ var a, f, C;
1246
+ const te = ee - 1, de = {}, le = X.views;
1247
+ if (le && le.length > 0) {
1248
+ const l = le[0];
1249
+ if (l.state === "frozen") {
1250
+ const _ = l.xSplit || 0, A = l.ySplit || 0;
1251
+ let D = null;
1252
+ _ > 0 && A > 0 ? D = "rangeBoth" : A > 0 ? D = "rangeRow" : _ > 0 && (D = "rangeColumn"), D && (xe[te] = {
1253
+ type: D,
1254
+ range: {
1255
+ row_focus: A - 1,
1256
+ column_focus: _ - 1
1257
+ }
1258
+ });
1259
+ }
1260
+ }
1261
+ const t = {};
1262
+ X.eachRow({ includeEmpty: !1 }, (l, _) => {
1263
+ l.eachCell({ includeEmpty: !1 }, (A, D) => {
1264
+ var se, ue, Z;
1265
+ const I = `${_ - 1}_${D - 1}`;
1266
+ A.hyperlink && (de[I] = [
1267
+ {
1268
+ linkType: "webpage",
1269
+ linkAddress: A.hyperlink
1270
+ }
1271
+ ]);
1272
+ const T = (se = A.style) == null ? void 0 : se.font, L = (ue = A.style) == null ? void 0 : ue.fill, O = {};
1273
+ if (T) {
1274
+ T.bold && (O.bl = 1), T.italic && (O.it = 1), T.underline && (O.un = 1);
1275
+ const x = T.size ?? ke;
1276
+ if (x && (O.fs = x), T.name && (O.ff = T.name), (Z = T.color) != null && Z.argb) {
1277
+ const h = T.color.argb, i = "#" + h.substring(h.length - 6);
1278
+ O.fc = i;
1279
+ }
1280
+ }
1281
+ if ((L == null ? void 0 : L.type) === "pattern" && L.pattern === "solid" && L.fgColor && L.fgColor.argb) {
1282
+ const x = L.fgColor.argb, h = "#" + x.substring(x.length - 6);
1283
+ O.bg = h;
1284
+ }
1285
+ Object.keys(O).length > 0 && (t[I] = O);
1286
+ });
1287
+ }), Object.keys(de).length > 0 && (_e[te] = de), Object.keys(t).length > 0 && ($e[te] = t);
1288
+ const r = He(X, ge);
1289
+ r.length > 0 && (Me[te] = r);
1290
+ const n = X.tables;
1291
+ n && Object.keys(n).length > 0 && ((a = F == null ? void 0 : F.onWarning) == null || a.call(
1292
+ F,
1293
+ "Tables are not fully supported. Table styles will not be applied."
1294
+ ), F != null && F.suppressUiWarnings || Ie({
1295
+ title: "Tables are not fully supported",
1296
+ description: "Table styles will not be applied",
1297
+ variant: "warning",
1298
+ showCloseButton: !0,
1299
+ duration: 40 * 1e3
1300
+ }));
1301
+ const m = (f = X.dataValidations) == null ? void 0 : f.model;
1302
+ if (m && typeof m == "object") {
1303
+ const l = {};
1304
+ for (const [_, A] of Object.entries(m)) {
1305
+ const I = ft(_, A);
1306
+ I && (l[I.rowColKey] = I.entry);
1307
+ }
1308
+ Object.keys(l).length > 0 && (fe[te] = l);
1309
+ }
1310
+ const e = X.conditionalFormattings;
1311
+ if (Array.isArray(e) && e.length > 0) {
1312
+ const l = [];
1313
+ for (const _ of e) {
1314
+ const A = _.ref, D = _.rules || [];
1315
+ for (const I of D) {
1316
+ const T = I;
1317
+ console.log("[XLSX CF RAW]", {
1318
+ ref: A,
1319
+ type: T.type,
1320
+ operator: T.operator,
1321
+ formulae: T.formulae,
1322
+ text: T.text,
1323
+ timePeriod: T.timePeriod,
1324
+ percent: T.percent,
1325
+ bottom: T.bottom,
1326
+ rank: T.rank,
1327
+ aboveAverage: T.aboveAverage
1328
+ });
1329
+ const L = T.type ? pt(A, T) : null;
1330
+ L ? console.log("[XLSX CF MAPPED] accepted", L) : console.log("[XLSX CF MAPPED] skipped", {
1331
+ ref: A,
1332
+ type: T.type,
1333
+ operator: T.operator,
1334
+ formulae: T.formulae,
1335
+ text: T.text
1336
+ }), L && l.push(L);
1337
+ }
1338
+ }
1339
+ l.length > 0 && (Ce[te] = l);
1340
+ }
1341
+ X.autoFilter && (Ae || (Ae = !0, (C = F == null ? void 0 : F.onWarning) == null || C.call(
1342
+ F,
1343
+ "Filters are not supported in imported files."
1344
+ )), $ || (N(!0), F != null && F.suppressUiWarnings || Ie({
1345
+ title: "Filters are not supported in imported files",
1346
+ variant: "warning",
1347
+ showCloseButton: !0,
1348
+ duration: 30 * 1e3
1349
+ })));
1350
+ }), Ne(
1351
+ ne,
1352
+ function(X) {
1353
+ var m;
1354
+ let ee = X.sheets;
1355
+ if (ee.forEach((e, d) => {
1356
+ const a = fe[d];
1357
+ a && Object.keys(a).length > 0 && (e.dataVerification = a);
1358
+ const f = Ce[d];
1359
+ e.luckysheet_conditionformat_save = Array.isArray(f) && f.length > 0 ? f : [];
1360
+ }), !s.current) {
1361
+ console.error("ydocRef.current is null");
1362
+ return;
1363
+ }
1364
+ const te = s.current.getArray(p), de = Array.from(te), le = /* @__PURE__ */ new Map();
1365
+ ee = ee.map((e, d) => {
1366
+ var T, L, O, se, ue, Z, x, h, i, c, k, o, u, E, H, j, W, S, be, ve, me, z, pe, We;
1367
+ 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;
1368
+ 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 = {
1369
+ ...e.hyperlink || {},
1370
+ ..._e[d]
1371
+ }), (se = e.config) != null && se.columnlen) {
1372
+ const b = {};
1373
+ Object.entries(e.config.columnlen).forEach(
1374
+ ([P, V]) => {
1375
+ const Y = (Number(V) - 5) / 8 + 0.83;
1376
+ b[P] = Math.round(Y * 7 + 5);
1377
+ }
1378
+ ), e.config.columnlen = b;
1379
+ }
1380
+ if ((ue = e.config) != null && ue.rowlen) {
1381
+ const b = Math.round(
1382
+ Number(e.defaultRowHeight) || 21
1383
+ ), P = {};
1384
+ Object.entries(e.config.rowlen).forEach(([V, Y]) => {
1385
+ Math.abs(Math.round(Number(Y)) - b) > 1 && (P[V] = Number(Y));
1386
+ }), e.config.rowlen = P;
1387
+ }
1388
+ if ((Z = e.config) != null && Z.customHeight) {
1389
+ const b = new Set(
1390
+ Object.keys(e.config.rowlen || {})
1391
+ ), P = {};
1392
+ Object.entries(e.config.customHeight).forEach(
1393
+ ([V, Y]) => {
1394
+ b.has(V) && Number(Y) === 1 && (P[V] = 1);
1395
+ }
1396
+ ), e.config.customHeight = P;
1397
+ }
1398
+ if (Me[d]) {
1399
+ const b = Number(e.defaultColWidth) || Number(
1400
+ (i = (h = (x = y.current) == null ? void 0 : x.getSettings) == null ? void 0 : h.call(x)) == null ? void 0 : i.defaultColWidth
1401
+ ) || 99, P = Number(e.defaultRowHeight) || Number(
1402
+ (o = (k = (c = y.current) == null ? void 0 : c.getSettings) == null ? void 0 : k.call(c)) == null ? void 0 : o.defaultRowHeight
1403
+ ) || 21;
1404
+ e.images = Te(
1405
+ Me[d],
1406
+ e,
1407
+ b,
1408
+ P
1409
+ );
1410
+ }
1411
+ const l = _e[d], _ = $e[d], A = [], D = (b, P) => {
1412
+ const V = `${b}_${P}`;
1413
+ D._seen == null && (D._seen = /* @__PURE__ */ new Set());
1414
+ const Y = D._seen;
1415
+ Y.has(V) || (Y.add(V), A.push({ r: b, c: P, id: e.id }));
1416
+ }, I = (u = e.config) != null && u.merge ? /* @__PURE__ */ new Map() : null;
1417
+ if (e.celldata)
1418
+ for (const b of e.celldata) {
1419
+ const P = `${b.r}_${b.c}`;
1420
+ if (I == null || I.set(
1421
+ P,
1422
+ b
1423
+ ), b.v) {
1424
+ if (b.v.f) {
1425
+ const B = String(b.v.f);
1426
+ B.startsWith("=") || (b.v.f = `=${B}`);
1427
+ }
1428
+ 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]) {
1429
+ const B = _[P];
1430
+ if (!!(l != null && l[P])) {
1431
+ const { fc: K, un: Oe, ...Ze } = B;
1432
+ Object.assign(b.v, Ze);
1433
+ } else
1434
+ Object.assign(b.v, B);
1435
+ }
1436
+ if (l != null && l[P] && !b.v.f) {
1437
+ const B = l[P][0];
1438
+ B && tt(
1439
+ b.v,
1440
+ B
1441
+ );
1442
+ }
1443
+ const V = (H = b.v.ct) == null ? void 0 : H.fa, Y = typeof V == "string" ? V.trim().toLowerCase() : "", re = Y === "general" || ((j = b.v.ct) == null ? void 0 : j.t) === "g", he = Y === "@" || ((W = b.v.ct) == null ? void 0 : W.t) === "s";
1444
+ if (V && !le.has(V) && le.set(V, Pe.is_date(V)), !b.v.f && V && le.get(V)) {
1445
+ const B = typeof b.v.v == "string" ? parseFloat(b.v.v) : b.v.v;
1446
+ if (typeof B == "number" && !isNaN(B))
1447
+ try {
1448
+ b.v.v = B, b.v.m = Pe.format(V, B), b.v.ct = { ...b.v.ct, t: "d" };
1449
+ } catch {
1450
+ }
1451
+ } else if (!b.v.f && typeof b.v.v == "string" && !he && !re) {
1452
+ const B = b.v.v.trim();
1453
+ if (/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?$/.test(
1454
+ B
1455
+ )) {
1456
+ const K = Number(B);
1457
+ if (!isFinite(K))
1458
+ continue;
1459
+ if (b.v.v = K, b.v.ht == null && (b.v.ht = 2), !V)
1460
+ b.v.m = String(K);
1461
+ else
1462
+ try {
1463
+ b.v.m = Pe.format(V, K);
1464
+ } catch {
1465
+ }
1466
+ }
1467
+ } 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);
1468
+ if (!b.v.f && (b.v.m === void 0 || b.v.m === null) && ((ve = b.v.ct) == null ? void 0 : ve.t) !== "d") {
1469
+ const B = lt((me = b.v.ct) == null ? void 0 : me.s), q = b.v.v;
1470
+ if (!(q == null || String(q).trim() === ""))
1471
+ if (B != null)
1472
+ b.v.m = B;
1473
+ else if (typeof q == "boolean")
1474
+ b.v.m = st(q);
1475
+ else if (typeof q == "number" && isFinite(q)) {
1476
+ const Oe = (z = b.v.ct) == null ? void 0 : z.fa;
1477
+ if (typeof Oe == "string" && Oe && le.get(Oe) === !1)
1478
+ try {
1479
+ b.v.m = Pe.format(Oe, q);
1480
+ } catch {
1481
+ b.v.m = String(q);
1482
+ }
1483
+ else
1484
+ b.v.m = String(q);
1485
+ } else typeof q == "object" || (b.v.m = String(q));
1486
+ }
1487
+ }
1488
+ }
1489
+ if (Array.isArray(e.data)) {
1490
+ const b = e.data;
1491
+ for (let P = 0; P < b.length; P++) {
1492
+ const V = b[P];
1493
+ if (Array.isArray(V))
1494
+ for (let Y = 0; Y < V.length; Y++) {
1495
+ const re = V[Y];
1496
+ if (!re || typeof re != "object" || !re.f) continue;
1497
+ const he = String(re.f);
1498
+ he.startsWith("=") || (re.f = `=${he}`), ((pe = re.ct) == null ? void 0 : pe.t) !== "d" && (re.ct = { ...re.ct ?? {}, t: "str" }, D(P, Y));
1499
+ }
1500
+ }
1501
+ }
1502
+ if (e.calcChain = A, I && ((We = e.config) != null && We.merge) && e.celldata)
1503
+ for (const b of Object.values(e.config.merge)) {
1504
+ const { r: P, c: V, rs: Y, cs: re } = b;
1505
+ for (let he = 0; he < Y; he++)
1506
+ for (let B = 0; B < re; B++) {
1507
+ const q = `${P + he}_${V + B}`;
1508
+ let K = I.get(q);
1509
+ K || (K = { r: P + he, c: V + B, v: {} }, e.celldata.push(K), I.set(q, K)), K.v || (K.v = {}), K.v.mc = he === 0 && B === 0 ? { r: P, c: V, rs: Y, cs: re } : { r: P, c: V };
1510
+ }
1511
+ }
1512
+ return e;
1513
+ }), console.log("[xlsx-import] parsed sheets data", {
1514
+ fileName: ne.name,
1515
+ sheetCount: ee.length,
1516
+ sheets: ee
1517
+ });
1518
+ let t;
1519
+ if (J === "merge-current-dsheet") {
1520
+ const e = new Set(
1521
+ de.map(
1522
+ (d) => d instanceof Ue.Map ? d.get("name") : d.name
1523
+ ).filter(Boolean)
1524
+ );
1525
+ ee.forEach((d) => {
1526
+ const a = d.name ?? "", f = ot(a, e);
1527
+ f !== a && (d.name = f), e.add(f);
1528
+ }), t = [...de, ...ee];
1529
+ } else
1530
+ t = [...ee];
1531
+ if (t = t.map((e, d) => (e.order = d, e)), s.current.transact(() => {
1532
+ J !== "merge-current-dsheet" && te.delete(0, te.length), t.forEach((e) => {
1533
+ if (e instanceof Ue.Map) return;
1534
+ const d = Qe(e);
1535
+ te.push([d()]);
1536
+ });
1537
+ }), s != null && s.current) {
1538
+ const e = s.current.getArray(p), d = Ke(e);
1539
+ w.current = d, g((a) => a + 1);
1540
+ }
1541
+ F != null && F.headless || ut(y);
1542
+ const n = et((m = X == null ? void 0 : X.info) == null ? void 0 : m.name);
1543
+ v == null || v(n), Q();
1544
+ }
1545
+ );
1546
+ } catch (ke) {
1547
+ console.error("Error loading the workbook", ke), !(F != null && F.suppressUiWarnings) && typeof alert < "u" && alert(
1548
+ "Error loading the workbook. Please ensure it is a valid .xlsx file."
1549
+ ), M(ke);
1550
+ }
1551
+ }, G.readAsArrayBuffer(ne);
1552
+ });
1553
+ }
1554
+ export {
1555
+ At as runXlsxFileUpload
1556
+ };