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