@sheetxl/sdk 0.8.0-beta.7 → 0.8.0-beta.9
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/browser/cjs/BAtZ8a7H7zsRvWqe.cjs +90 -0
- package/browser/cjs/CQPMWBxBUmkORmxV.cjs +1 -0
- package/browser/cjs/{E08wpSuqr-UadjSZ.cjs → CvQ1tIq7wZ7HIGPq.cjs} +1 -1
- package/browser/cjs/CwvGOe42j8KpAF0v.cjs +1 -0
- package/browser/cjs/{O6F5xVsoF2hTiprv.cjs → DCOqoH-T4Ux_1dQj.cjs} +1 -1
- package/browser/cjs/index.cjs +2 -2
- package/browser/esm/{tBEZ_r7Bkp7CrFLF.mjs → BdHD3v-u8irI1XhZ.mjs} +2 -2
- package/browser/esm/{bSQdR4WlmM40WWFR.mjs → C8btlUQcQwNyzHY3.mjs} +2 -2
- package/browser/esm/{B7v0PdbyuBlceMLG.mjs → CF3VfWX7bJu8kO_Z.mjs} +2 -2
- package/browser/esm/{BADV_AABAw-3U9iO.mjs → D3ll0ybMQOP4uPyW.mjs} +1 -1
- package/browser/esm/{DRpWwH6CWI0QaNlp.mjs → DXmFrSnh3xSBfoD7.mjs} +8146 -7694
- package/browser/esm/{CFDfAmU2o5HFRTu4.mjs → DzgIc4oyekwA-fkl.mjs} +96 -96
- package/browser/esm/{DkHfJEJlvjDJnXEU.mjs → Iw280tlGmTHKDqzd.mjs} +2 -2
- package/browser/esm/index.mjs +919 -593
- package/node/esm/{CWJELJxqO-1z0tJU.mjs → B_FOXd5PSfVcg0ED.mjs} +1 -1
- package/node/esm/{HMR0po5avaUU1XUZ.mjs → BzgnLKSVfN-mrMSW.mjs} +1 -1
- package/node/esm/{BShIHUY7pxerJVT8.mjs → D4PsEIRHxAahp5kn.mjs} +1 -1
- package/node/esm/{DbAKZ-Ythj1VwgyS.mjs → dinqlP3jU8gDOjso.mjs} +1 -1
- package/node/esm/index.mjs +11373 -10575
- package/package.json +7 -6
- package/resources/locales/de/model.msg.json +19 -0
- package/resources/locales/en/model.msg.json +25 -0
- package/types/scripting-api.json +6847 -6401
- package/types/scripting-enums.json +101 -21
- package/types/scripting.d.ts +1949 -457
- package/types/src/calculation/Calculation.d.ts +37 -45
- package/types/src/calculation/grid/CalcGrid.d.ts +12 -4
- package/types/src/calculation/grid/CalcGridBackend.d.ts +0 -6
- package/types/src/calculation/grid/CalcGridProxy.d.ts +1 -6
- package/types/src/calculation/grid/ICalcGrid.d.ts +12 -4
- package/types/src/calculation/grid/_CalcRequest.d.ts +4 -9
- package/types/src/cell/ICell.d.ts +3 -3
- package/types/src/cell/ICellHeader.d.ts +24 -2
- package/types/src/cellRange/ICellRange.d.ts +67 -3
- package/types/src/cellRange/ICellRanges.d.ts +12 -12
- package/types/src/chart/Chart.d.ts +2 -13
- package/types/src/condition/AnchoredConditional.d.ts +2 -0
- package/types/src/condition/BuiltInOperators/ColorOperator.d.ts +4 -0
- package/types/src/condition/BuiltInOperators/IconOperator.d.ts +4 -0
- package/types/src/condition/ICondition.d.ts +36 -28
- package/types/src/condition/_ConditionUtils.d.ts +32 -8
- package/types/src/fill/IFill.d.ts +46 -11
- package/types/src/fill/IStroke.d.ts +34 -42
- package/types/src/filter/IFilter.d.ts +51 -6
- package/types/src/hyperlink/IHyperlink.d.ts +8 -0
- package/types/src/index.d.ts +1 -0
- package/types/src/movable/AbstractMovableContent.d.ts +6 -0
- package/types/src/movable/FormControl.d.ts +206 -0
- package/types/src/movable/IFormControl.d.ts +424 -0
- package/types/src/movable/IMovable.d.ts +37 -8
- package/types/src/movable/IMovableCollection.d.ts +19 -1
- package/types/src/movable/Movable.d.ts +20 -0
- package/types/src/movable/MovableContentRegistry.d.ts +64 -0
- package/types/src/movable/_BuiltInContents.d.ts +2 -0
- package/types/src/movable/_DrawnBounds.d.ts +33 -0
- package/types/src/movable/_RotatedFrame.d.ts +20 -0
- package/types/src/movable/index.d.ts +6 -4
- package/types/src/numFmt/BuiltInFormats.d.ts +5 -0
- package/types/src/numFmt/_NumFmtUtils.d.ts +0 -1
- package/types/src/numFmt/vendor/numfmt/_sheetxl.d.ts +6 -0
- package/types/src/outline/IOutline.d.ts +186 -0
- package/types/src/outline/Outline.d.ts +157 -0
- package/types/src/outline/index.d.ts +2 -0
- package/types/src/shape/GeometryPreset.d.ts +197 -0
- package/types/src/shape/IGeometry.d.ts +398 -0
- package/types/src/shape/IShape.d.ts +177 -204
- package/types/src/shape/Shape.d.ts +39 -13
- package/types/src/shape/ShapeStyleUtils.d.ts +48 -0
- package/types/src/shape/_Geometry.d.ts +14 -0
- package/types/src/shape/_GeometryLoader.d.ts +21 -0
- package/types/src/shape/_builtIn/_BuiltInChunks.d.ts +10 -0
- package/types/src/shape/_builtIn/_BuiltInDef.d.ts +9 -0
- package/types/src/shape/_builtIn/arrows.d.ts +6 -0
- package/types/src/shape/_builtIn/basic.d.ts +6 -0
- package/types/src/shape/_builtIn/callouts.d.ts +6 -0
- package/types/src/shape/_builtIn/flowchart.d.ts +6 -0
- package/types/src/shape/_builtIn/lines.d.ts +6 -0
- package/types/src/shape/_builtIn/math.d.ts +6 -0
- package/types/src/shape/_builtIn/other.d.ts +6 -0
- package/types/src/shape/_builtIn/rectangles.d.ts +6 -0
- package/types/src/shape/_builtIn/starsBanners.d.ts +6 -0
- package/types/src/shape/geometry/_strokeEnds.d.ts +7 -0
- package/types/src/shape/geometry/format.d.ts +3 -0
- package/types/src/shape/geometry/geometry.d.ts +84 -0
- package/types/src/shape/geometry/guides.d.ts +54 -0
- package/types/src/shape/geometry/handles.d.ts +14 -0
- package/types/src/shape/geometry/index.d.ts +7 -0
- package/types/src/shape/geometry/lineEnds.d.ts +53 -0
- package/types/src/shape/geometry/paths.d.ts +35 -0
- package/types/src/shape/geometry/segments.d.ts +114 -0
- package/types/src/shape/index.d.ts +2 -0
- package/types/src/sheet/ISheet.d.ts +10 -45
- package/types/src/sheet/Sheet.d.ts +19 -5
- package/types/src/sheet/SheetRange.d.ts +16 -1
- package/types/src/sheet/_SheetUtils.d.ts +10 -2
- package/types/src/sheetHeader/ISheetHeader.d.ts +4 -0
- package/types/src/sheetHeader/SheetCellHeader.d.ts +4 -0
- package/types/src/sheetHeader/SheetHeader.d.ts +10 -0
- package/types/src/sheetHeader/_HeaderUtils.d.ts +3 -1
- package/types/src/sheetView/ISheetView.d.ts +17 -0
- package/types/src/sheetView/SheetView.d.ts +4 -0
- package/types/src/table/AnchoredTable.d.ts +7 -2
- package/types/src/text/IText.d.ts +182 -0
- package/types/src/text/ITextFrame.d.ts +85 -0
- package/types/src/text/TextRotation.d.ts +3 -3
- package/types/src/text/TextStacked.d.ts +2 -2
- package/types/src/theme/ITheme.d.ts +24 -0
- package/types/src/workbook/Workbook.d.ts +16 -5
- package/browser/cjs/CrcmEew-dr51xpf9.cjs +0 -1
- package/browser/cjs/CwzIjMpnMKeypivl.cjs +0 -1
- package/browser/cjs/D3Vlh9UOBKtvlXBL.cjs +0 -93
- package/types/src/movable/Control.d.ts +0 -55
- package/types/src/movable/IControl.d.ts +0 -86
- package/types/src/movable/IGroup.d.ts +0 -30
- package/types/src/shape/_ShapeXml.d.ts +0 -28
package/browser/esm/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.
|
|
2
|
+
* @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.9
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
|
-
import { n as e } from "./
|
|
8
|
-
import { $t as t, A as n, An as r, At as i, Bt as a, C as o, Cn as s, Ct as c, D as l, Dn as u, Dt as d, E as f, En as p, Et as m, F as h, Fn as g, Ft as _, Gt as v, Ht as y, I as b, In as x, It as S, Jt as C, Kt as ee, L as te,
|
|
9
|
-
import { FormulaError as
|
|
10
|
-
import { BufferUtils as
|
|
7
|
+
import { n as e } from "./D3ll0ybMQOP4uPyW.mjs";
|
|
8
|
+
import { $t as t, A as n, An as r, At as i, Bt as a, C as o, Cn as s, Ct as c, D as l, Dn as u, Dt as d, E as f, En as p, Et as m, F as h, Fn as g, Ft as _, Gt as v, Ht as y, I as b, In as x, It as S, Jt as C, Kt as ee, L as te, Ln as ne, Lt as re, M as ie, Mn as w, Mt as ae, N as oe, Nn as se, Nt as ce, O as le, On as ue, Ot as de, P as fe, Pn as pe, Pt as me, Qt as he, R as ge, Rn as _e, Rt as ve, S as ye, Sn as be, St as xe, T as Se, Tn as Ce, Tt as we, Ut as Te, Vt as Ee, Wt as De, Xt as Oe, Yt as ke, Zt as T, _ as Ae, _n as je, _t as Me, a as E, an as Ne, at as Pe, b as Fe, bn as Ie, bt as Le, c as Re, cn as D, ct as ze, d as Be, dn as Ve, en as He, f as Ue, fn as O, g as We, gn as Ge, gt as Ke, h as qe, hn as Je, ht as Ye, i as Xe, in as Ze, it as Qe, j as $e, jn as k, jt as et, k as tt, kn as nt, kt as rt, l as it, ln as at, lt as ot, m as st, mn as ct, mt as lt, n as ut, nn as dt, o as A, on as ft, ot as pt, p as mt, pn as ht, qt as gt, r as _t, rn as vt, rt as yt, s as bt, sn as j, st as xt, t as St, tn as Ct, u as M, un as wt, v as Tt, vn as Et, vt as Dt, w as Ot, wn as kt, wt as At, x as jt, xn as Mt, xt as Nt, y as Pt, yn as Ft, z as It, zt as Lt } from "./DXmFrSnh3xSBfoD7.mjs";
|
|
9
|
+
import { FormulaError as Rt, ScalarType as N } from "@sheetxl/primitives";
|
|
10
|
+
import { BufferUtils as zt, CommonUtils as P, CoordUtils as F, DOMUtils as Bt, DefaultLanguagePackService as Vt, ExpectedError as I, InvalidPasswordError as Ht, MimeType as Ut, Notifier as Wt, NullNotAllowedError as Gt, OutOfBoundsError as L, PasswordRequiredError as Kt, ProtectedError as R, UndoManager as qt, messageKey as z, t as B } from "@sheetxl/utils";
|
|
11
11
|
export * from "@sheetxl/primitives";
|
|
12
12
|
export * from "@sheetxl/utils";
|
|
13
|
-
var
|
|
13
|
+
var Jt, Yt = class extends qt {
|
|
14
14
|
constructor(e, t = 50) {
|
|
15
15
|
super(t), this._transactions = e, this._floorId = e ? e.getCurrentCommit(!1).getId() : null, this._removeListener = e?.addListener({ onCommitChange: () => this._notifyOnStackChange() });
|
|
16
16
|
}
|
|
@@ -103,9 +103,9 @@ var Wt, Gt = class extends Ut {
|
|
|
103
103
|
close() {
|
|
104
104
|
this._removeListener?.();
|
|
105
105
|
}
|
|
106
|
-
},
|
|
106
|
+
}, Xt = class {
|
|
107
107
|
constructor(e, t) {
|
|
108
|
-
this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new
|
|
108
|
+
this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new x(this);
|
|
109
109
|
let n = this;
|
|
110
110
|
this._removeStoreListener = e.addListener({
|
|
111
111
|
onCommitEnd() {
|
|
@@ -141,10 +141,10 @@ var Wt, Gt = class extends Ut {
|
|
|
141
141
|
this._removeStoreListener?.(), this._removeCommitListener?.(), this._emitter.close();
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
|
-
|
|
145
|
-
var
|
|
144
|
+
Jt ||= {};
|
|
145
|
+
var V = class e {
|
|
146
146
|
constructor(t, n = {}) {
|
|
147
|
-
this._password = null, this._emitter = new
|
|
147
|
+
this._password = null, this._emitter = new x(this), this._path = t ?? null, this._name = n.name ?? null, this._format = n.format ?? null, this._size = n.size ?? null, this._lastModified = n.lastModified ?? null, this._canWrite = n.canWrite ?? e._defaultCanWrite(this._path), this._encryption = n.encryption ?? null;
|
|
148
148
|
}
|
|
149
149
|
static _defaultCanWrite(e) {
|
|
150
150
|
return !!e && !/^(https?:|data:|blob:)/i.test(e);
|
|
@@ -155,7 +155,7 @@ var U = class e {
|
|
|
155
155
|
getName() {
|
|
156
156
|
if (this._name !== null && this._name !== void 0) return this._name;
|
|
157
157
|
let e = this._cleanPath();
|
|
158
|
-
return e &&
|
|
158
|
+
return e && r(e) || null;
|
|
159
159
|
}
|
|
160
160
|
getPath() {
|
|
161
161
|
return this._path;
|
|
@@ -216,59 +216,59 @@ var U = class e {
|
|
|
216
216
|
];
|
|
217
217
|
return `${t} ${(n / 1024 ** r).toFixed(2)}${i[Math.min(r, i.length - 1)]}`;
|
|
218
218
|
}
|
|
219
|
-
},
|
|
219
|
+
}, H = /* @__PURE__ */ new WeakMap(), Zt = /* @__PURE__ */ new Set(), Qt = (e) => H.get(e) ?? null, $t = () => Array.from(Zt, (e) => e.getOrigin()), en = class e {
|
|
220
220
|
constructor(t) {
|
|
221
|
-
this._released = !1, e._assertFree(t), this._emitter = new
|
|
221
|
+
this._released = !1, e._assertFree(t), this._emitter = new x(this), this._origin = t, H.set(t, this), Zt.add(this);
|
|
222
222
|
}
|
|
223
223
|
getOrigin() {
|
|
224
224
|
return this._origin;
|
|
225
225
|
}
|
|
226
226
|
setOrigin(t) {
|
|
227
|
-
t !== this._origin && (e._assertFree(t), this._released || (
|
|
227
|
+
t !== this._origin && (e._assertFree(t), this._released || (H.delete(this._origin), H.set(t, this)), this._origin = t, this._emitter.notify("onOriginChange"));
|
|
228
228
|
}
|
|
229
229
|
release() {
|
|
230
|
-
this._released || (this._released = !0,
|
|
230
|
+
this._released || (this._released = !0, H.get(this._origin) === this && H.delete(this._origin), Zt.delete(this));
|
|
231
231
|
}
|
|
232
232
|
addListeners(e, t) {
|
|
233
233
|
return this._emitter.addListeners(e, t);
|
|
234
234
|
}
|
|
235
235
|
static _assertFree(e) {
|
|
236
|
-
if (
|
|
236
|
+
if (H.has(e)) throw Error("This origin already backs an open workbook; an origin backs one workbook at a time.");
|
|
237
237
|
}
|
|
238
|
-
},
|
|
238
|
+
}, tn = class {
|
|
239
239
|
constructor() {
|
|
240
240
|
this._defaultStringSourceType = "filepath";
|
|
241
241
|
}
|
|
242
242
|
async read(e) {
|
|
243
243
|
let t = e.options ?? {}, n = e.source;
|
|
244
244
|
if (typeof n == "function" && (n = n()), n && typeof n == "object" && typeof n.then == "function" && (n = await Promise.resolve(n)), n == null && (n = await this.resolveSource(e), n == null)) return null;
|
|
245
|
-
let
|
|
246
|
-
|
|
247
|
-
let
|
|
248
|
-
if (!
|
|
249
|
-
let
|
|
250
|
-
if (
|
|
245
|
+
let i = n, a = await this.fileFromHandle(n);
|
|
246
|
+
a && (n = a);
|
|
247
|
+
let o = t.format, s = this._detectSourceType(n);
|
|
248
|
+
if (!s) throw Error("Unable to detect source type from provided input.");
|
|
249
|
+
let c, l, u = !1;
|
|
250
|
+
if (s === "filepath") {
|
|
251
251
|
let e = typeof n == "string" && n.startsWith("file://") ? n.slice(7) : n;
|
|
252
|
-
n = await this.filePathToFile(e),
|
|
252
|
+
n = await this.filePathToFile(e), s = "file", u = !0;
|
|
253
253
|
}
|
|
254
|
-
switch (
|
|
254
|
+
switch (s) {
|
|
255
255
|
case "file": {
|
|
256
|
-
let e = n,
|
|
257
|
-
|
|
258
|
-
format:
|
|
259
|
-
ext: k(
|
|
260
|
-
name:
|
|
261
|
-
absolutePath:
|
|
256
|
+
let e = n, i = e?.name, s = i ? `${r(i)}` : "";
|
|
257
|
+
c = await e.arrayBuffer(), l = {
|
|
258
|
+
format: o,
|
|
259
|
+
ext: k(i),
|
|
260
|
+
name: s,
|
|
261
|
+
absolutePath: i,
|
|
262
262
|
size: e.size,
|
|
263
263
|
lastModified: e.lastModified,
|
|
264
|
-
canWrite: !t.asCopy && (!!
|
|
264
|
+
canWrite: !t.asCopy && (!!a || u && this._canWriteLocalPath())
|
|
265
265
|
};
|
|
266
266
|
break;
|
|
267
267
|
}
|
|
268
268
|
case "blob": {
|
|
269
269
|
let e = n;
|
|
270
|
-
|
|
271
|
-
format:
|
|
270
|
+
c = await e.arrayBuffer(), l = {
|
|
271
|
+
format: o,
|
|
272
272
|
size: e.size
|
|
273
273
|
};
|
|
274
274
|
break;
|
|
@@ -280,44 +280,44 @@ var U = class e {
|
|
|
280
280
|
let [, t] = n.split(",");
|
|
281
281
|
e = t;
|
|
282
282
|
} else e = n;
|
|
283
|
-
|
|
284
|
-
format:
|
|
283
|
+
c = zt.base64ToArrayBuffer(e), l = {
|
|
284
|
+
format: o,
|
|
285
285
|
size: e.length
|
|
286
286
|
};
|
|
287
287
|
break;
|
|
288
288
|
}
|
|
289
289
|
case "fetch": {
|
|
290
|
-
let e, t,
|
|
290
|
+
let e, t, i;
|
|
291
291
|
if (typeof n == "string") e = n;
|
|
292
292
|
else {
|
|
293
293
|
if (!n || typeof n != "object" || !("input" in n)) throw Error("Invalid fetch source provided.");
|
|
294
294
|
{
|
|
295
|
-
let
|
|
296
|
-
e =
|
|
295
|
+
let r = n;
|
|
296
|
+
e = r.input, t = r.init, i = r.timeout;
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
let
|
|
299
|
+
let a = i || 3e4, s = new AbortController(), u = setTimeout(() => s.abort(), a), d = typeof e == "string" ? e : e.toString(), f = k(d);
|
|
300
300
|
try {
|
|
301
301
|
let n = await fetch(e, {
|
|
302
302
|
...t,
|
|
303
|
-
signal:
|
|
303
|
+
signal: s.signal
|
|
304
304
|
});
|
|
305
|
-
if (clearTimeout(
|
|
306
|
-
let
|
|
307
|
-
if (!
|
|
308
|
-
|
|
309
|
-
format:
|
|
310
|
-
ext:
|
|
311
|
-
name:
|
|
312
|
-
absolutePath:
|
|
305
|
+
if (clearTimeout(u), !n.ok) throw Error(`Failed to fetch: ${n.status} ${n.statusText}`);
|
|
306
|
+
let i = await n.arrayBuffer();
|
|
307
|
+
if (!i) throw Error(`Unable to fetched content: ${d}`);
|
|
308
|
+
c = i, l = {
|
|
309
|
+
format: o,
|
|
310
|
+
ext: f,
|
|
311
|
+
name: r(d, !0),
|
|
312
|
+
absolutePath: d
|
|
313
313
|
};
|
|
314
314
|
} catch (e) {
|
|
315
|
-
throw clearTimeout(
|
|
315
|
+
throw clearTimeout(u), e.name === "AbortError" ? Error(`Fetch timeout after ${a}ms: ${d}`) : e;
|
|
316
316
|
}
|
|
317
317
|
break;
|
|
318
318
|
}
|
|
319
319
|
case "buffer":
|
|
320
|
-
|
|
320
|
+
c = n, l = { format: o };
|
|
321
321
|
break;
|
|
322
322
|
case "stream": {
|
|
323
323
|
let e = n.getReader(), t = [], r = 0;
|
|
@@ -330,25 +330,25 @@ var U = class e {
|
|
|
330
330
|
} finally {
|
|
331
331
|
e.releaseLock();
|
|
332
332
|
}
|
|
333
|
-
let i = new ArrayBuffer(r),
|
|
334
|
-
for (let e of t)
|
|
335
|
-
|
|
333
|
+
let i = new ArrayBuffer(r), a = new Uint8Array(i), s = 0;
|
|
334
|
+
for (let e of t) a.set(e, s), s += e.length;
|
|
335
|
+
c = i, l = { format: o };
|
|
336
336
|
break;
|
|
337
337
|
}
|
|
338
|
-
default: throw Error(`Unsupported source type: ${
|
|
338
|
+
default: throw Error(`Unsupported source type: ${s}`);
|
|
339
339
|
}
|
|
340
|
-
|
|
341
|
-
let
|
|
342
|
-
sourceType:
|
|
343
|
-
...
|
|
340
|
+
l.canWrite && await this.findOpenOrigin(i, l) && (l.canWrite = !1);
|
|
341
|
+
let d = await e.decode(c, {
|
|
342
|
+
sourceType: s,
|
|
343
|
+
...l
|
|
344
344
|
});
|
|
345
|
-
return
|
|
345
|
+
return d ? (await this.onWorkbookRead(d, i), d) : null;
|
|
346
346
|
}
|
|
347
347
|
async findOpenOrigin(e, t) {
|
|
348
348
|
return t.absolutePath ? this.findOpenPath(t.absolutePath) : null;
|
|
349
349
|
}
|
|
350
350
|
findOpenPath(e, t) {
|
|
351
|
-
return
|
|
351
|
+
return $t().find((n) => {
|
|
352
352
|
if (n === t || !n.canWrite()) return !1;
|
|
353
353
|
let r = n.getPath();
|
|
354
354
|
return !!r && this.isSamePath(r, e);
|
|
@@ -379,21 +379,21 @@ var U = class e {
|
|
|
379
379
|
}
|
|
380
380
|
if (typeof File < "u" && e instanceof File) return "file";
|
|
381
381
|
if (typeof Blob < "u" && e instanceof Blob) return "blob";
|
|
382
|
-
let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", n = ArrayBuffer.isView(e), r =
|
|
382
|
+
let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", n = ArrayBuffer.isView(e), r = zt.isNodeBuffer(e);
|
|
383
383
|
return t || n || r ? "buffer" : typeof ReadableStream < "u" && e instanceof ReadableStream || Object.prototype.toString.call(e) === "[object ReadableStream]" || e && typeof e.getReader == "function" && e.locked !== void 0 ? "stream" : null;
|
|
384
384
|
}
|
|
385
|
-
},
|
|
385
|
+
}, nn = class extends tn {
|
|
386
386
|
constructor(e, t) {
|
|
387
387
|
super(), this._getWriteFormats = e, this._getReadFormats = t, this._defaultStringSourceType = "fetch", this._handleCache = /* @__PURE__ */ new WeakMap();
|
|
388
388
|
}
|
|
389
389
|
async fileFromHandle(e) {
|
|
390
|
-
return
|
|
390
|
+
return an(e) ? e.getFile() : null;
|
|
391
391
|
}
|
|
392
392
|
async resolveSource() {
|
|
393
393
|
let e = await this._getReadFormats?.() ?? [];
|
|
394
394
|
if (typeof globalThis.showOpenFilePicker == "function") try {
|
|
395
395
|
let t = function(e) {
|
|
396
|
-
let t =
|
|
396
|
+
let t = rn(e);
|
|
397
397
|
if (t.length <= 1) return t;
|
|
398
398
|
let n = /* @__PURE__ */ new Set(), r = {};
|
|
399
399
|
for (let e of t) for (let [t, i] of Object.entries(e.accept)) for (let e of i) n.has(e) || (n.add(e), (r[t] ??= []).push(e));
|
|
@@ -408,13 +408,13 @@ var U = class e {
|
|
|
408
408
|
throw e;
|
|
409
409
|
}
|
|
410
410
|
let t = e.flatMap((e) => e.exts.map((e) => "." + e)).join(", ");
|
|
411
|
-
return
|
|
411
|
+
return Bt.openFileDialog(t);
|
|
412
412
|
}
|
|
413
413
|
async findOpenOrigin(e) {
|
|
414
|
-
return
|
|
414
|
+
return an(e) ? this._findOpenHandle(e) : null;
|
|
415
415
|
}
|
|
416
416
|
async _findOpenHandle(e, t) {
|
|
417
|
-
for (let n of
|
|
417
|
+
for (let n of $t()) {
|
|
418
418
|
if (n === t || !n.canWrite()) continue;
|
|
419
419
|
let r = this._handleCache.get(n);
|
|
420
420
|
if (r && typeof r.isSameEntry == "function" && await r.isSameEntry(e)) return n;
|
|
@@ -422,7 +422,7 @@ var U = class e {
|
|
|
422
422
|
return null;
|
|
423
423
|
}
|
|
424
424
|
async onWorkbookRead(e, t) {
|
|
425
|
-
if (!
|
|
425
|
+
if (!an(t)) return;
|
|
426
426
|
let n = e.getOrigin?.();
|
|
427
427
|
n?.canWrite() && this._handleCache.set(n, t);
|
|
428
428
|
}
|
|
@@ -449,18 +449,18 @@ var U = class e {
|
|
|
449
449
|
if (!a) {
|
|
450
450
|
c = await globalThis.showSaveFilePicker({
|
|
451
451
|
suggestedName: n,
|
|
452
|
-
types:
|
|
452
|
+
types: rn(o)
|
|
453
453
|
});
|
|
454
454
|
let t = await this._findOpenHandle(c, e.workbook?.getOrigin?.());
|
|
455
|
-
if (t) throw new
|
|
455
|
+
if (t) throw new I(B("error.io.openElsewhere", { name: t.getName() ?? c.name ?? "" }));
|
|
456
456
|
}
|
|
457
|
-
let s =
|
|
457
|
+
let s = sn(c.name ?? n), l = o.find((e) => e.exts.some((e) => e.toLowerCase() === s)) ?? r, u = a ? t : new V(c.name ?? n, {
|
|
458
458
|
format: l.key,
|
|
459
459
|
canWrite: !0
|
|
460
460
|
}), d = await i(l.key, u);
|
|
461
461
|
if (!d) return null;
|
|
462
|
-
let f = new Blob([
|
|
463
|
-
if (await p.write(f), await p.close(), this._handleCache.set(u, c), u instanceof
|
|
462
|
+
let f = new Blob([on(d)], { type: l.mimeType || "application/octet-stream" }), p = await c.createWritable();
|
|
463
|
+
if (await p.write(f), await p.close(), this._handleCache.set(u, c), u instanceof V) {
|
|
464
464
|
let e = await Promise.resolve(c.getFile?.()).then((e) => e?.lastModified ?? null, () => null);
|
|
465
465
|
u.update({
|
|
466
466
|
size: f.size,
|
|
@@ -470,21 +470,21 @@ var U = class e {
|
|
|
470
470
|
return u;
|
|
471
471
|
} catch (e) {
|
|
472
472
|
if (e?.name === "AbortError") return null;
|
|
473
|
-
if (e instanceof
|
|
473
|
+
if (e instanceof I) throw e;
|
|
474
474
|
}
|
|
475
|
-
let l = t.getPath(), u = l ? l.split(/[/\\]/).pop() : null, d = u && r.exts.some((e) => e.toLowerCase() ===
|
|
475
|
+
let l = t.getPath(), u = l ? l.split(/[/\\]/).pop() : null, d = u && r.exts.some((e) => e.toLowerCase() === sn(u)) ? u : n, f = l !== d || t.canWrite() ? new V(d, {
|
|
476
476
|
format: r.key,
|
|
477
477
|
canWrite: !1
|
|
478
478
|
}) : t, p = await i(r.key, f);
|
|
479
479
|
if (!p) return null;
|
|
480
|
-
let m = new Blob([
|
|
480
|
+
let m = new Blob([on(p)], { type: r.mimeType || "application/octet-stream" });
|
|
481
481
|
return function(e, t) {
|
|
482
482
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
483
483
|
r.style.display = "none", r.href = n, r.download = t, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
|
|
484
|
-
}(m, d), f instanceof
|
|
484
|
+
}(m, d), f instanceof V && f.update({ size: m.size }), f;
|
|
485
485
|
}
|
|
486
486
|
};
|
|
487
|
-
function
|
|
487
|
+
function rn(e) {
|
|
488
488
|
return e.map((e) => {
|
|
489
489
|
let t = e.mimeType && e.mimeType.includes("/") ? e.mimeType : "application/octet-stream";
|
|
490
490
|
return {
|
|
@@ -493,21 +493,21 @@ function Qt(e) {
|
|
|
493
493
|
};
|
|
494
494
|
});
|
|
495
495
|
}
|
|
496
|
-
function
|
|
496
|
+
function an(e) {
|
|
497
497
|
return !!e && e.kind === "file" && typeof e.getFile == "function";
|
|
498
498
|
}
|
|
499
|
-
function
|
|
499
|
+
function on(e) {
|
|
500
500
|
if (typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) {
|
|
501
501
|
let t = new ArrayBuffer(e.byteLength);
|
|
502
502
|
return new Uint8Array(t).set(new Uint8Array(e)), t;
|
|
503
503
|
}
|
|
504
504
|
return e;
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function sn(e) {
|
|
507
507
|
let t = e.lastIndexOf(".");
|
|
508
508
|
return t >= 0 ? e.slice(t + 1).toLowerCase() : "";
|
|
509
509
|
}
|
|
510
|
-
var
|
|
510
|
+
var cn = class {
|
|
511
511
|
constructor(e) {
|
|
512
512
|
this._private = { input: e }, typeof e == "string" ? this._private.name = e : Object.assign(this._private, e);
|
|
513
513
|
}
|
|
@@ -529,11 +529,11 @@ var tn = class {
|
|
|
529
529
|
get isIFont() {
|
|
530
530
|
return !0;
|
|
531
531
|
}
|
|
532
|
-
},
|
|
533
|
-
findBestMatch: () =>
|
|
534
|
-
getFontList: () =>
|
|
535
|
-
setFontList: () =>
|
|
536
|
-
}),
|
|
532
|
+
}, ln = e({
|
|
533
|
+
findBestMatch: () => _n,
|
|
534
|
+
getFontList: () => hn,
|
|
535
|
+
setFontList: () => mn
|
|
536
|
+
}), un = [
|
|
537
537
|
"Arial",
|
|
538
538
|
"Arial Black",
|
|
539
539
|
"Brush Script MT",
|
|
@@ -549,55 +549,55 @@ var tn = class {
|
|
|
549
549
|
"Times New Roman",
|
|
550
550
|
"Trebuchet MS",
|
|
551
551
|
"Verdana"
|
|
552
|
-
],
|
|
553
|
-
|
|
554
|
-
var
|
|
555
|
-
|
|
556
|
-
var
|
|
557
|
-
function
|
|
558
|
-
e ||
|
|
552
|
+
], U = /* @__PURE__ */ new Map();
|
|
553
|
+
U.set(O.GenericName.Serif, ["Tahoma"]), U.set(O.GenericName.SanSerif, ["Calibri"]), U.set(O.GenericName.MonoSpace, ["Courier New"]), U.set(O.GenericName.Cursive, ["Comic Sans MS"]), U.set(O.GenericName.Fantasy, ["Luminari"]), U.set(O.GenericName.UISystem, ["Arial"]), U.set(O.GenericName.UISerif, ["Tahoma"]), U.set(O.GenericName.UISanSerif, ["Arial"]), U.set(O.GenericName.UIMonoSpace, ["Courier New"]), U.set(O.GenericName.UIRounded, ["Arial"]), U.set(O.GenericName.Math, []), U.set(O.GenericName.Emoji, []), U.set(O.GenericName.Fangsong, []);
|
|
554
|
+
var dn = /* @__PURE__ */ new Map(), fn = [];
|
|
555
|
+
mn(un);
|
|
556
|
+
var pn = eval;
|
|
557
|
+
function mn(e) {
|
|
558
|
+
e || mn(un);
|
|
559
559
|
let t = [];
|
|
560
560
|
for (let n = 0; n < e.length; n++) {
|
|
561
561
|
let r = e[n];
|
|
562
|
-
typeof r == "string" && (r = new
|
|
562
|
+
typeof r == "string" && (r = new cn(r));
|
|
563
563
|
let i = !0;
|
|
564
564
|
try {
|
|
565
|
-
i =
|
|
565
|
+
i = pn(`document.fonts.check('12px ${r.getFamily()}')`);
|
|
566
566
|
} catch {}
|
|
567
567
|
let a = {
|
|
568
568
|
fontRef: r,
|
|
569
569
|
loaded: i
|
|
570
570
|
};
|
|
571
|
-
t.push(a),
|
|
571
|
+
t.push(a), dn.set(r.getFamily(), a);
|
|
572
572
|
}
|
|
573
|
-
|
|
573
|
+
fn = Object.freeze(t);
|
|
574
574
|
}
|
|
575
|
-
function
|
|
576
|
-
return
|
|
575
|
+
function hn() {
|
|
576
|
+
return fn;
|
|
577
577
|
}
|
|
578
|
-
var
|
|
579
|
-
function
|
|
580
|
-
let n =
|
|
578
|
+
var gn = /* @__PURE__ */ new Map();
|
|
579
|
+
function _n(e, t) {
|
|
580
|
+
let n = gn.get(e);
|
|
581
581
|
if (n) return n.fontRef === null ? null : n;
|
|
582
582
|
let r = [e];
|
|
583
583
|
t?.fallbacks && (r = r.concat(t.fallbacks));
|
|
584
584
|
let i = null;
|
|
585
585
|
for (let e = 0; !i && e < r.length; e++) {
|
|
586
586
|
let t = r[e];
|
|
587
|
-
if (i =
|
|
588
|
-
let e =
|
|
589
|
-
if (e) for (let t = 0; !i && t < e.length; t++) i =
|
|
587
|
+
if (i = dn.get(t), !i) {
|
|
588
|
+
let e = U.get(t);
|
|
589
|
+
if (e) for (let t = 0; !i && t < e.length; t++) i = dn.get(e[t]);
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
|
-
return i ?
|
|
592
|
+
return i ? gn.set(e, i) : gn.set(e, {
|
|
593
593
|
fontRef: null,
|
|
594
594
|
loaded: !1
|
|
595
595
|
}), i;
|
|
596
596
|
}
|
|
597
|
-
var
|
|
598
|
-
DefaultFontSizes: () =>
|
|
599
|
-
findNextFontSize: () =>
|
|
600
|
-
}),
|
|
597
|
+
var vn, yn, W, bn, xn = e({
|
|
598
|
+
DefaultFontSizes: () => Sn,
|
|
599
|
+
findNextFontSize: () => Cn
|
|
600
|
+
}), Sn = Object.freeze([
|
|
601
601
|
8,
|
|
602
602
|
9,
|
|
603
603
|
10,
|
|
@@ -616,42 +616,48 @@ var fn, pn, J, mn, hn = e({
|
|
|
616
616
|
48,
|
|
617
617
|
72
|
|
618
618
|
]);
|
|
619
|
-
function
|
|
619
|
+
function Cn(e, t = !0, n = Sn) {
|
|
620
620
|
if (!n || n.length === 0) return e;
|
|
621
621
|
if (e === void 0) return n[0];
|
|
622
622
|
if (t && e >= n[n.length - 1] || !t && e <= n[0]) return e;
|
|
623
|
-
let r =
|
|
623
|
+
let r = P.findEqualOrGreater(n, e);
|
|
624
624
|
return t ? (n[r] === e && (r += 1), n[r] || --r, n[r]) : (--r, n[r]);
|
|
625
625
|
}
|
|
626
|
-
(
|
|
626
|
+
(vn ||= {}).SortOn = {
|
|
627
627
|
Value: "value",
|
|
628
628
|
FillColor: "fillColor",
|
|
629
629
|
FontColor: "fontColor",
|
|
630
630
|
Icon: "icon"
|
|
631
|
-
}, (
|
|
631
|
+
}, (W = yn ||= {}).LineEndType = {
|
|
632
|
+
None: "none",
|
|
633
|
+
Triangle: "triangle",
|
|
634
|
+
Stealth: "stealth",
|
|
635
|
+
Diamond: "diamond",
|
|
636
|
+
Oval: "oval",
|
|
637
|
+
Arrow: "arrow"
|
|
638
|
+
}, W.LineEndSize = {
|
|
639
|
+
Small: "sm",
|
|
640
|
+
Medium: "med",
|
|
641
|
+
Large: "lg"
|
|
642
|
+
}, W.Compound = {
|
|
632
643
|
Single: "sng",
|
|
633
644
|
Double: "dbl",
|
|
634
645
|
ThickThin: "thickThin",
|
|
635
646
|
ThinThick: "thinThick",
|
|
636
647
|
Triple: "tri"
|
|
637
|
-
},
|
|
648
|
+
}, W.Align = {
|
|
638
649
|
Center: "ctr",
|
|
639
650
|
Inset: "in",
|
|
640
651
|
Outset: "outset"
|
|
641
|
-
},
|
|
652
|
+
}, W.LineCap = {
|
|
642
653
|
Butt: "butt",
|
|
643
654
|
Round: "round",
|
|
644
655
|
Square: "square"
|
|
645
|
-
},
|
|
656
|
+
}, W.LineJoin = {
|
|
646
657
|
Bevel: "bevel",
|
|
647
658
|
Miter: "miter",
|
|
648
659
|
Round: "round"
|
|
649
|
-
},
|
|
650
|
-
Single: "none",
|
|
651
|
-
Double: "double",
|
|
652
|
-
ThickThin: "thickThin",
|
|
653
|
-
ThinThick: "thinThick"
|
|
654
|
-
}, J.StrokeStyle = {
|
|
660
|
+
}, W.StrokeStyle = {
|
|
655
661
|
None: "none",
|
|
656
662
|
Dashed: "dashed",
|
|
657
663
|
Dotted: "dotted",
|
|
@@ -663,7 +669,7 @@ function _n(e, t = !0, n = gn) {
|
|
|
663
669
|
SysDashDot: "sysDashDot",
|
|
664
670
|
SysDashDotDot: "sysDashDotDot",
|
|
665
671
|
SysDot: "sysDot"
|
|
666
|
-
}, (
|
|
672
|
+
}, (bn ||= {}).Type = {
|
|
667
673
|
OuterShadow: "outerShadow",
|
|
668
674
|
InnerShadow: "innerShadow",
|
|
669
675
|
PresetShadow: "presetShadow",
|
|
@@ -671,53 +677,53 @@ function _n(e, t = !0, n = gn) {
|
|
|
671
677
|
SoftEdge: "softEdge",
|
|
672
678
|
Reflection: "reflection"
|
|
673
679
|
};
|
|
674
|
-
var
|
|
675
|
-
[
|
|
676
|
-
[
|
|
677
|
-
[
|
|
678
|
-
[
|
|
679
|
-
[
|
|
680
|
-
[
|
|
681
|
-
[
|
|
682
|
-
[
|
|
683
|
-
[
|
|
684
|
-
[
|
|
685
|
-
[
|
|
686
|
-
[
|
|
687
|
-
[
|
|
688
|
-
[
|
|
689
|
-
[
|
|
690
|
-
[
|
|
691
|
-
[
|
|
692
|
-
[
|
|
693
|
-
[
|
|
694
|
-
[
|
|
695
|
-
[
|
|
696
|
-
},
|
|
697
|
-
function
|
|
698
|
-
let t =
|
|
680
|
+
var G = Oe.BuiltInName, wn = {
|
|
681
|
+
[G.Normal]: z("style.builtin.normal"),
|
|
682
|
+
[G.Comma]: z("style.builtin.comma"),
|
|
683
|
+
[G.Currency]: z("style.builtin.currency"),
|
|
684
|
+
[G.Percent]: z("style.builtin.percent"),
|
|
685
|
+
[G.Comma0]: z("style.builtin.comma0"),
|
|
686
|
+
[G.Currency0]: z("style.builtin.currency0"),
|
|
687
|
+
[G.Hyperlink]: z("style.builtin.hyperlink"),
|
|
688
|
+
[G.FollowedHyperlink]: z("style.builtin.followedHyperlink"),
|
|
689
|
+
[G.Note]: z("style.builtin.note"),
|
|
690
|
+
[G.WarningText]: z("style.builtin.warningText"),
|
|
691
|
+
[G.Title]: z("style.builtin.title"),
|
|
692
|
+
[G.Input]: z("style.builtin.input"),
|
|
693
|
+
[G.Output]: z("style.builtin.output"),
|
|
694
|
+
[G.Calculation]: z("style.builtin.calculation"),
|
|
695
|
+
[G.CheckCell]: z("style.builtin.checkCell"),
|
|
696
|
+
[G.LinkedCell]: z("style.builtin.linkedCell"),
|
|
697
|
+
[G.Total]: z("style.builtin.total"),
|
|
698
|
+
[G.Good]: z("style.builtin.good"),
|
|
699
|
+
[G.Bad]: z("style.builtin.bad"),
|
|
700
|
+
[G.Neutral]: z("style.builtin.neutral"),
|
|
701
|
+
[G.ExplanatoryText]: z("style.builtin.explanatoryText")
|
|
702
|
+
}, Tn = z("style.builtin.heading"), En = z("style.builtin.accent"), Dn = z("style.builtin.accentTint"), On = /^Heading ([1-4])$/, kn = /^Accent([1-6])$/, An = /^(20|40|60)% - Accent([1-6])$/;
|
|
703
|
+
function jn(e) {
|
|
704
|
+
let t = wn[e];
|
|
699
705
|
if (t) return { key: t };
|
|
700
|
-
let n =
|
|
706
|
+
let n = On.exec(e);
|
|
701
707
|
return n ? {
|
|
702
|
-
key:
|
|
708
|
+
key: Tn,
|
|
703
709
|
params: { n: +n[1] }
|
|
704
|
-
} : (n =
|
|
705
|
-
key:
|
|
710
|
+
} : (n = kn.exec(e), n ? {
|
|
711
|
+
key: En,
|
|
706
712
|
params: { n: +n[1] }
|
|
707
|
-
} : (n =
|
|
708
|
-
key:
|
|
713
|
+
} : (n = An.exec(e), n ? {
|
|
714
|
+
key: Dn,
|
|
709
715
|
params: {
|
|
710
716
|
pct: +n[1],
|
|
711
717
|
n: +n[2]
|
|
712
718
|
}
|
|
713
719
|
} : null));
|
|
714
720
|
}
|
|
715
|
-
var
|
|
721
|
+
var Mn, Nn, Pn, Fn, In = (e, t, n, r, i) => {
|
|
716
722
|
let a = JSON.parse(JSON.stringify(e.definition));
|
|
717
723
|
a.adjs ||= [];
|
|
718
724
|
let o = "", s = 0, c = 0;
|
|
719
|
-
t > 0 ? (c = t, s = 100 - t, o =
|
|
720
|
-
let l = new
|
|
725
|
+
t > 0 ? (c = t, s = 100 - t, o = B("op.lighterPercent", { percent: t })) : t < 0 && (s = 100 + t, o = B("op.darkerPercent", { percent: -t })), s && a.adjs.push({ [He.AdjustmentType.LumMod]: s }), c && a.adjs.push({ [He.AdjustmentType.LumOff]: c });
|
|
726
|
+
let l = new he({
|
|
721
727
|
val: a.val,
|
|
722
728
|
adjs: a.adjs
|
|
723
729
|
}, n), u = l.toString();
|
|
@@ -728,14 +734,14 @@ var En, Dn, On, kn, An = (e, t, n, r, i) => {
|
|
|
728
734
|
definition: a
|
|
729
735
|
};
|
|
730
736
|
};
|
|
731
|
-
function
|
|
737
|
+
function Ln(e, t, n, r) {
|
|
732
738
|
let i = [];
|
|
733
739
|
for (let a = 0; a < e.length; a++) {
|
|
734
740
|
let o = [];
|
|
735
741
|
i.push(o);
|
|
736
742
|
let s = (i) => {
|
|
737
|
-
for (let s = 0; s < i.length; s++) o.push(
|
|
738
|
-
}, c = new
|
|
743
|
+
for (let s = 0; s < i.length; s++) o.push(In(e[a], i[s], t, n, r));
|
|
744
|
+
}, c = new he({
|
|
739
745
|
val: e[a].definition.val,
|
|
740
746
|
adjs: e[a].definition.adjs
|
|
741
747
|
}, t).toHSLA().lum;
|
|
@@ -773,26 +779,26 @@ function jn(e, t, n, r) {
|
|
|
773
779
|
}
|
|
774
780
|
return i;
|
|
775
781
|
}
|
|
776
|
-
(
|
|
777
|
-
var
|
|
778
|
-
function
|
|
779
|
-
if (!
|
|
780
|
-
let e = import("./
|
|
782
|
+
(Mn ||= {}).buildPalette = Ln, Nn ||= {}, Pn ||= {}, Fn ||= {};
|
|
783
|
+
var K, q = null;
|
|
784
|
+
function Rn() {
|
|
785
|
+
if (!q) {
|
|
786
|
+
let e = import("./CF3VfWX7bJu8kO_Z.mjs").then(({ initializeFunctions: e }) => {
|
|
781
787
|
let t = e(() => null);
|
|
782
788
|
return Object.freeze(Array.from(t.keys()));
|
|
783
789
|
});
|
|
784
790
|
e.catch(() => {
|
|
785
|
-
|
|
786
|
-
}),
|
|
791
|
+
q = null;
|
|
792
|
+
}), q = e;
|
|
787
793
|
}
|
|
788
|
-
return
|
|
794
|
+
return q;
|
|
789
795
|
}
|
|
790
|
-
function
|
|
796
|
+
function zn(e) {
|
|
791
797
|
let t = e.trim();
|
|
792
798
|
if (!t) return;
|
|
793
799
|
let n;
|
|
794
800
|
try {
|
|
795
|
-
let e =
|
|
801
|
+
let e = Dt.shared().tokenize(t, !1);
|
|
796
802
|
if (e.errors.length > 0) return;
|
|
797
803
|
n = e.tokens;
|
|
798
804
|
} catch {
|
|
@@ -810,33 +816,359 @@ function Nn(e) {
|
|
|
810
816
|
case "NumberToken":
|
|
811
817
|
case "ScientificDigit":
|
|
812
818
|
case "DigitToken": {
|
|
813
|
-
let e =
|
|
819
|
+
let e = Ke(o).value;
|
|
814
820
|
return r === 0 ? e : r * e;
|
|
815
821
|
}
|
|
816
|
-
case "StringToken": return r === 0 ?
|
|
817
|
-
case "BooleanToken": return r === 0 ?
|
|
822
|
+
case "StringToken": return r === 0 ? Me(o).value : void 0;
|
|
823
|
+
case "BooleanToken": return r === 0 ? lt(o).value : void 0;
|
|
818
824
|
case "LiteralError":
|
|
819
|
-
case "RefError": return r === 0 ?
|
|
825
|
+
case "RefError": return r === 0 ? Ye(o).value : void 0;
|
|
820
826
|
default: return;
|
|
821
827
|
}
|
|
822
828
|
} catch {
|
|
823
829
|
return;
|
|
824
830
|
}
|
|
825
831
|
}
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
832
|
+
(K ||= {}).Type = {
|
|
833
|
+
Shape: "shape",
|
|
834
|
+
Connector: "connector",
|
|
835
|
+
Group: "group",
|
|
836
|
+
Picture: "picture"
|
|
837
|
+
};
|
|
838
|
+
var Bn, J, Vn = Object.freeze({
|
|
839
|
+
AccentBorderCallout1: "accentBorderCallout1",
|
|
840
|
+
AccentBorderCallout2: "accentBorderCallout2",
|
|
841
|
+
AccentBorderCallout3: "accentBorderCallout3",
|
|
842
|
+
AccentCallout1: "accentCallout1",
|
|
843
|
+
AccentCallout2: "accentCallout2",
|
|
844
|
+
AccentCallout3: "accentCallout3",
|
|
845
|
+
ActionButtonBackPrevious: "actionButtonBackPrevious",
|
|
846
|
+
ActionButtonBeginning: "actionButtonBeginning",
|
|
847
|
+
ActionButtonBlank: "actionButtonBlank",
|
|
848
|
+
ActionButtonDocument: "actionButtonDocument",
|
|
849
|
+
ActionButtonEnd: "actionButtonEnd",
|
|
850
|
+
ActionButtonForwardNext: "actionButtonForwardNext",
|
|
851
|
+
ActionButtonHelp: "actionButtonHelp",
|
|
852
|
+
ActionButtonHome: "actionButtonHome",
|
|
853
|
+
ActionButtonInformation: "actionButtonInformation",
|
|
854
|
+
ActionButtonMovie: "actionButtonMovie",
|
|
855
|
+
ActionButtonReturn: "actionButtonReturn",
|
|
856
|
+
ActionButtonSound: "actionButtonSound",
|
|
857
|
+
Arc: "arc",
|
|
858
|
+
BentArrow: "bentArrow",
|
|
859
|
+
BentConnector2: "bentConnector2",
|
|
860
|
+
BentConnector3: "bentConnector3",
|
|
861
|
+
BentConnector4: "bentConnector4",
|
|
862
|
+
BentConnector5: "bentConnector5",
|
|
863
|
+
BentUpArrow: "bentUpArrow",
|
|
864
|
+
Bevel: "bevel",
|
|
865
|
+
BlockArc: "blockArc",
|
|
866
|
+
BorderCallout1: "borderCallout1",
|
|
867
|
+
BorderCallout2: "borderCallout2",
|
|
868
|
+
BorderCallout3: "borderCallout3",
|
|
869
|
+
BracePair: "bracePair",
|
|
870
|
+
BracketPair: "bracketPair",
|
|
871
|
+
Callout1: "callout1",
|
|
872
|
+
Callout2: "callout2",
|
|
873
|
+
Callout3: "callout3",
|
|
874
|
+
Can: "can",
|
|
875
|
+
ChartPlus: "chartPlus",
|
|
876
|
+
ChartStar: "chartStar",
|
|
877
|
+
ChartX: "chartX",
|
|
878
|
+
Chevron: "chevron",
|
|
879
|
+
Chord: "chord",
|
|
880
|
+
CircularArrow: "circularArrow",
|
|
881
|
+
Cloud: "cloud",
|
|
882
|
+
CloudCallout: "cloudCallout",
|
|
883
|
+
Corner: "corner",
|
|
884
|
+
CornerTabs: "cornerTabs",
|
|
885
|
+
Cube: "cube",
|
|
886
|
+
CurvedConnector2: "curvedConnector2",
|
|
887
|
+
CurvedConnector3: "curvedConnector3",
|
|
888
|
+
CurvedConnector4: "curvedConnector4",
|
|
889
|
+
CurvedConnector5: "curvedConnector5",
|
|
890
|
+
CurvedDownArrow: "curvedDownArrow",
|
|
891
|
+
CurvedLeftArrow: "curvedLeftArrow",
|
|
892
|
+
CurvedRightArrow: "curvedRightArrow",
|
|
893
|
+
CurvedUpArrow: "curvedUpArrow",
|
|
894
|
+
Decagon: "decagon",
|
|
895
|
+
DiagStripe: "diagStripe",
|
|
896
|
+
Diamond: "diamond",
|
|
897
|
+
Dodecagon: "dodecagon",
|
|
898
|
+
Donut: "donut",
|
|
899
|
+
DoubleWave: "doubleWave",
|
|
900
|
+
DownArrow: "downArrow",
|
|
901
|
+
DownArrowCallout: "downArrowCallout",
|
|
902
|
+
Ellipse: "ellipse",
|
|
903
|
+
EllipseRibbon: "ellipseRibbon",
|
|
904
|
+
EllipseRibbon2: "ellipseRibbon2",
|
|
905
|
+
FlowChartAlternateProcess: "flowChartAlternateProcess",
|
|
906
|
+
FlowChartCollate: "flowChartCollate",
|
|
907
|
+
FlowChartConnector: "flowChartConnector",
|
|
908
|
+
FlowChartDecision: "flowChartDecision",
|
|
909
|
+
FlowChartDelay: "flowChartDelay",
|
|
910
|
+
FlowChartDisplay: "flowChartDisplay",
|
|
911
|
+
FlowChartDocument: "flowChartDocument",
|
|
912
|
+
FlowChartExtract: "flowChartExtract",
|
|
913
|
+
FlowChartInputOutput: "flowChartInputOutput",
|
|
914
|
+
FlowChartInternalStorage: "flowChartInternalStorage",
|
|
915
|
+
FlowChartMagneticDisk: "flowChartMagneticDisk",
|
|
916
|
+
FlowChartMagneticDrum: "flowChartMagneticDrum",
|
|
917
|
+
FlowChartMagneticTape: "flowChartMagneticTape",
|
|
918
|
+
FlowChartManualInput: "flowChartManualInput",
|
|
919
|
+
FlowChartManualOperation: "flowChartManualOperation",
|
|
920
|
+
FlowChartMerge: "flowChartMerge",
|
|
921
|
+
FlowChartMultidocument: "flowChartMultidocument",
|
|
922
|
+
FlowChartOfflineStorage: "flowChartOfflineStorage",
|
|
923
|
+
FlowChartOffpageConnector: "flowChartOffpageConnector",
|
|
924
|
+
FlowChartOnlineStorage: "flowChartOnlineStorage",
|
|
925
|
+
FlowChartOr: "flowChartOr",
|
|
926
|
+
FlowChartPredefinedProcess: "flowChartPredefinedProcess",
|
|
927
|
+
FlowChartPreparation: "flowChartPreparation",
|
|
928
|
+
FlowChartProcess: "flowChartProcess",
|
|
929
|
+
FlowChartPunchedCard: "flowChartPunchedCard",
|
|
930
|
+
FlowChartPunchedTape: "flowChartPunchedTape",
|
|
931
|
+
FlowChartSort: "flowChartSort",
|
|
932
|
+
FlowChartSummingJunction: "flowChartSummingJunction",
|
|
933
|
+
FlowChartTerminator: "flowChartTerminator",
|
|
934
|
+
FoldedCorner: "foldedCorner",
|
|
935
|
+
Frame: "frame",
|
|
936
|
+
Funnel: "funnel",
|
|
937
|
+
Gear6: "gear6",
|
|
938
|
+
Gear9: "gear9",
|
|
939
|
+
HalfFrame: "halfFrame",
|
|
940
|
+
Heart: "heart",
|
|
941
|
+
Heptagon: "heptagon",
|
|
942
|
+
Hexagon: "hexagon",
|
|
943
|
+
HomePlate: "homePlate",
|
|
944
|
+
HorizontalScroll: "horizontalScroll",
|
|
945
|
+
IrregularSeal1: "irregularSeal1",
|
|
946
|
+
IrregularSeal2: "irregularSeal2",
|
|
947
|
+
LeftArrow: "leftArrow",
|
|
948
|
+
LeftArrowCallout: "leftArrowCallout",
|
|
949
|
+
LeftBrace: "leftBrace",
|
|
950
|
+
LeftBracket: "leftBracket",
|
|
951
|
+
LeftCircularArrow: "leftCircularArrow",
|
|
952
|
+
LeftRightArrow: "leftRightArrow",
|
|
953
|
+
LeftRightArrowCallout: "leftRightArrowCallout",
|
|
954
|
+
LeftRightCircularArrow: "leftRightCircularArrow",
|
|
955
|
+
LeftRightRibbon: "leftRightRibbon",
|
|
956
|
+
LeftRightUpArrow: "leftRightUpArrow",
|
|
957
|
+
LeftUpArrow: "leftUpArrow",
|
|
958
|
+
LightningBolt: "lightningBolt",
|
|
959
|
+
Line: "line",
|
|
960
|
+
LineInv: "lineInv",
|
|
961
|
+
MathDivide: "mathDivide",
|
|
962
|
+
MathEqual: "mathEqual",
|
|
963
|
+
MathMinus: "mathMinus",
|
|
964
|
+
MathMultiply: "mathMultiply",
|
|
965
|
+
MathNotEqual: "mathNotEqual",
|
|
966
|
+
MathPlus: "mathPlus",
|
|
967
|
+
Moon: "moon",
|
|
968
|
+
NoSmoking: "noSmoking",
|
|
969
|
+
NonIsoscelesTrapezoid: "nonIsoscelesTrapezoid",
|
|
970
|
+
NotchedRightArrow: "notchedRightArrow",
|
|
971
|
+
Octagon: "octagon",
|
|
972
|
+
Parallelogram: "parallelogram",
|
|
973
|
+
Pentagon: "pentagon",
|
|
974
|
+
Pie: "pie",
|
|
975
|
+
PieWedge: "pieWedge",
|
|
976
|
+
Plaque: "plaque",
|
|
977
|
+
PlaqueTabs: "plaqueTabs",
|
|
978
|
+
Plus: "plus",
|
|
979
|
+
QuadArrow: "quadArrow",
|
|
980
|
+
QuadArrowCallout: "quadArrowCallout",
|
|
981
|
+
Rect: "rect",
|
|
982
|
+
Ribbon: "ribbon",
|
|
983
|
+
Ribbon2: "ribbon2",
|
|
984
|
+
RightArrow: "rightArrow",
|
|
985
|
+
RightArrowCallout: "rightArrowCallout",
|
|
986
|
+
RightBrace: "rightBrace",
|
|
987
|
+
RightBracket: "rightBracket",
|
|
988
|
+
Round1Rect: "round1Rect",
|
|
989
|
+
Round2DiagRect: "round2DiagRect",
|
|
990
|
+
Round2SameRect: "round2SameRect",
|
|
991
|
+
RoundRect: "roundRect",
|
|
992
|
+
RtTriangle: "rtTriangle",
|
|
993
|
+
SmileyFace: "smileyFace",
|
|
994
|
+
Snip1Rect: "snip1Rect",
|
|
995
|
+
Snip2DiagRect: "snip2DiagRect",
|
|
996
|
+
Snip2SameRect: "snip2SameRect",
|
|
997
|
+
SnipRoundRect: "snipRoundRect",
|
|
998
|
+
SquareTabs: "squareTabs",
|
|
999
|
+
Star10: "star10",
|
|
1000
|
+
Star12: "star12",
|
|
1001
|
+
Star16: "star16",
|
|
1002
|
+
Star24: "star24",
|
|
1003
|
+
Star32: "star32",
|
|
1004
|
+
Star4: "star4",
|
|
1005
|
+
Star5: "star5",
|
|
1006
|
+
Star6: "star6",
|
|
1007
|
+
Star7: "star7",
|
|
1008
|
+
Star8: "star8",
|
|
1009
|
+
StraightConnector1: "straightConnector1",
|
|
1010
|
+
StripedRightArrow: "stripedRightArrow",
|
|
1011
|
+
Sun: "sun",
|
|
1012
|
+
SwooshArrow: "swooshArrow",
|
|
1013
|
+
Teardrop: "teardrop",
|
|
1014
|
+
Trapezoid: "trapezoid",
|
|
1015
|
+
Triangle: "triangle",
|
|
1016
|
+
UpArrow: "upArrow",
|
|
1017
|
+
UpArrowCallout: "upArrowCallout",
|
|
1018
|
+
UpDownArrow: "upDownArrow",
|
|
1019
|
+
UpDownArrowCallout: "upDownArrowCallout",
|
|
1020
|
+
UturnArrow: "uturnArrow",
|
|
1021
|
+
VerticalScroll: "verticalScroll",
|
|
1022
|
+
Wave: "wave",
|
|
1023
|
+
WedgeEllipseCallout: "wedgeEllipseCallout",
|
|
1024
|
+
WedgeRectCallout: "wedgeRectCallout",
|
|
1025
|
+
WedgeRoundRectCallout: "wedgeRoundRectCallout"
|
|
1026
|
+
});
|
|
1027
|
+
(J = Bn ||= {}).Preset = Vn, J.PathLayer = {
|
|
1028
|
+
Fill: "fill",
|
|
1029
|
+
Stroke: "stroke",
|
|
1030
|
+
Marker: "marker"
|
|
1031
|
+
}, J.FillTransfer = Object.freeze({
|
|
1032
|
+
norm: [1, 0],
|
|
1033
|
+
darken: [.6, 0],
|
|
1034
|
+
darkenLess: [.8, 0],
|
|
1035
|
+
lighten: [.6, .4],
|
|
1036
|
+
lightenLess: [.8, .2]
|
|
1037
|
+
}), J.HandleType = {
|
|
1038
|
+
XY: "xy",
|
|
1039
|
+
Polar: "polar"
|
|
1040
|
+
};
|
|
1041
|
+
var Hn = e({
|
|
1042
|
+
TEXT_DEFAULTS: () => Zn,
|
|
1043
|
+
defaultStyleRefs: () => Yn,
|
|
1044
|
+
inheritedTextSize: () => Qn,
|
|
1045
|
+
resolve: () => nr,
|
|
1046
|
+
withoutDefaultStyleRefs: () => Xn
|
|
1047
|
+
}), Un = .75, Y = {
|
|
1048
|
+
type: T.Type.Solid,
|
|
1049
|
+
color: "phClr"
|
|
1050
|
+
}, Wn = [
|
|
1051
|
+
Y,
|
|
1052
|
+
Y,
|
|
1053
|
+
Y
|
|
1054
|
+
], Gn = [
|
|
1055
|
+
.5,
|
|
1056
|
+
1,
|
|
1057
|
+
1.5
|
|
1058
|
+
].map((e) => ({
|
|
1059
|
+
width: e,
|
|
1060
|
+
fill: Y
|
|
1061
|
+
})), Kn = Object.freeze({
|
|
1062
|
+
fill: {
|
|
1063
|
+
index: 1,
|
|
1064
|
+
color: "accent1"
|
|
1065
|
+
},
|
|
1066
|
+
stroke: {
|
|
1067
|
+
index: 2,
|
|
1068
|
+
color: "accent1 shade 15"
|
|
1069
|
+
},
|
|
1070
|
+
effect: {
|
|
1071
|
+
index: 0,
|
|
1072
|
+
color: "accent1"
|
|
1073
|
+
},
|
|
1074
|
+
font: {
|
|
1075
|
+
index: O.Scheme.Minor,
|
|
1076
|
+
color: "lt1"
|
|
1077
|
+
}
|
|
1078
|
+
}), qn = Object.freeze({
|
|
1079
|
+
fill: {
|
|
1080
|
+
index: 0,
|
|
1081
|
+
color: "accent1"
|
|
1082
|
+
},
|
|
1083
|
+
stroke: {
|
|
1084
|
+
index: 1,
|
|
1085
|
+
color: "accent1"
|
|
1086
|
+
},
|
|
1087
|
+
effect: {
|
|
1088
|
+
index: 0,
|
|
1089
|
+
color: "accent1"
|
|
1090
|
+
},
|
|
1091
|
+
font: {
|
|
1092
|
+
index: O.Scheme.Minor,
|
|
1093
|
+
color: "tx1"
|
|
1094
|
+
}
|
|
1095
|
+
}), Jn = Object.freeze({});
|
|
1096
|
+
function Yn(e) {
|
|
1097
|
+
return e?.type === K.Type.Connector ? qn : e?.type === K.Type.Picture ? Jn : Kn;
|
|
1098
|
+
}
|
|
1099
|
+
function Xn(e) {
|
|
1100
|
+
let t = e.style;
|
|
1101
|
+
if (!t) return t;
|
|
1102
|
+
let n = Yn(e), r = {};
|
|
1103
|
+
for (let e of [
|
|
1104
|
+
"fill",
|
|
1105
|
+
"stroke",
|
|
1106
|
+
"effect",
|
|
1107
|
+
"font"
|
|
1108
|
+
]) {
|
|
1109
|
+
let i = t[e], a = n[e];
|
|
1110
|
+
!i || a && i.index === a.index && i.color === a.color || (r[e] = i);
|
|
1111
|
+
}
|
|
1112
|
+
return Object.keys(r).length > 0 ? r : void 0;
|
|
1113
|
+
}
|
|
1114
|
+
var Zn = Object.freeze({
|
|
1115
|
+
verticalOverflow: w.Overflow.Clip,
|
|
1116
|
+
horizontalOverflow: w.Overflow.Clip,
|
|
1117
|
+
size: 11
|
|
1118
|
+
});
|
|
1119
|
+
function Qn(e, t) {
|
|
1120
|
+
let n = e.listStyle;
|
|
1121
|
+
return t.defaultRun?.size ?? n?.levels?.[t.level ?? 0]?.defaultRun?.size ?? n?.default?.defaultRun?.size;
|
|
1122
|
+
}
|
|
1123
|
+
var X = (e, t) => typeof e == "string" && e.startsWith("phClr") ? (t ?? "tx1") + e.slice(5) : e, $n = (e, t) => {
|
|
1124
|
+
let n = { ...e };
|
|
1125
|
+
return "color" in n && (n.color = X(n.color, t)), "foreground" in n && (n.foreground = X(n.foreground, t)), "background" in n && (n.background = X(n.background, t)), Array.isArray(n.stops) && (n.stops = n.stops.map((e) => typeof e == "string" ? X(e, t) : {
|
|
1126
|
+
...e,
|
|
1127
|
+
color: X(e.color, t)
|
|
1128
|
+
})), n;
|
|
1129
|
+
}, er = (e, t) => {
|
|
1130
|
+
if (!e) return;
|
|
1131
|
+
if (e.index <= 0) return { type: T.Type.None };
|
|
1132
|
+
let n = t?.fillStyleLst?.length ? t.fillStyleLst : Wn, r = n[Math.min(e.index, n.length) - 1];
|
|
1133
|
+
return r ? $n(r, e.color) : void 0;
|
|
1134
|
+
}, tr = (e, t) => {
|
|
1135
|
+
if (!e) return;
|
|
1136
|
+
if (e.index <= 0) return { fill: { type: T.Type.None } };
|
|
1137
|
+
let n = t?.lnStyleLst?.length ? t.lnStyleLst : Gn, r = n[Math.min(e.index, n.length) - 1];
|
|
1138
|
+
if (!r) return;
|
|
1139
|
+
let i = { ...r };
|
|
1140
|
+
return i.fill &&= $n(i.fill, e.color), i;
|
|
1141
|
+
};
|
|
1142
|
+
function nr(e, t) {
|
|
1143
|
+
let n = e?.style === null ? {} : {
|
|
1144
|
+
...Yn(e),
|
|
1145
|
+
...e?.style
|
|
1146
|
+
}, r = e?.fill ?? er(n.fill, t), i = tr(n.stroke, t), a = e?.stroke, o = a || i ? {
|
|
1147
|
+
...i,
|
|
1148
|
+
...a,
|
|
1149
|
+
fill: a?.fill ?? i?.fill
|
|
1150
|
+
} : void 0;
|
|
1151
|
+
return {
|
|
1152
|
+
fill: r,
|
|
1153
|
+
stroke: o,
|
|
1154
|
+
strokeWidth: typeof o?.width == "number" ? o.width : Un,
|
|
1155
|
+
fontColor: n.font?.color ?? (r && r.type !== T.Type.None ? "lt1" : "tx1")
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
function rr(e, t) {
|
|
1159
|
+
let n = ir(e), r = ir(t);
|
|
1160
|
+
return n === r ? e === t ? 0 : typeof e == "number" && typeof t == "number" ? e < t ? -1 : 1 : typeof e == "string" && typeof t == "string" ? e < t ? -1 : +(e > t) : typeof e == "boolean" ? e ? 1 : -1 : Rt.isError(e) && Rt.isError(t) ? e.getCode() - t.getCode() : 0 : n - r;
|
|
829
1161
|
}
|
|
830
|
-
function
|
|
1162
|
+
function ir(e) {
|
|
831
1163
|
if (e === null) return 0;
|
|
832
1164
|
switch (typeof e) {
|
|
833
1165
|
case "number": return 1;
|
|
834
1166
|
case "string": return 2;
|
|
835
1167
|
case "boolean": return 3;
|
|
836
|
-
default: return
|
|
1168
|
+
default: return Rt.isError(e) ? 4 : 5;
|
|
837
1169
|
}
|
|
838
1170
|
}
|
|
839
|
-
var
|
|
1171
|
+
var ar = class {
|
|
840
1172
|
constructor(e) {
|
|
841
1173
|
this._children = e;
|
|
842
1174
|
}
|
|
@@ -881,19 +1213,19 @@ var In = class {
|
|
|
881
1213
|
let n = t[e].getSortedNumbers().getValues();
|
|
882
1214
|
n.length > 0 && r.push(n);
|
|
883
1215
|
}
|
|
884
|
-
e = new
|
|
1216
|
+
e = new St(function(e) {
|
|
885
1217
|
let t = e.length;
|
|
886
|
-
if (t === 0) return
|
|
1218
|
+
if (t === 0) return or;
|
|
887
1219
|
if (t === 1) return e[0];
|
|
888
1220
|
let n = e[0];
|
|
889
|
-
for (let r = 1; r < t; r++) n =
|
|
1221
|
+
for (let r = 1; r < t; r++) n = sr(n, e[r]);
|
|
890
1222
|
return Object.freeze(n);
|
|
891
1223
|
}(r)), this._sortedNumbers = e;
|
|
892
1224
|
}
|
|
893
1225
|
return e;
|
|
894
1226
|
}
|
|
895
1227
|
getRanked(e) {
|
|
896
|
-
return
|
|
1228
|
+
return ut(this._children, e, rr)[Symbol.iterator]();
|
|
897
1229
|
}
|
|
898
1230
|
getFrequencies(e) {
|
|
899
1231
|
if (e) return this._mergeFrequencies(e);
|
|
@@ -901,7 +1233,7 @@ var In = class {
|
|
|
901
1233
|
return t || (t = this._mergeFrequencies(), this._frequencies = t), t;
|
|
902
1234
|
}
|
|
903
1235
|
_mergeFrequencies(e) {
|
|
904
|
-
let t = e?.keyFn ??
|
|
1236
|
+
let t = e?.keyFn ?? xe, n = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, a = i.length, o = 0, s = 0, c = !1;
|
|
905
1237
|
for (let l = 0; l < a; l++) {
|
|
906
1238
|
let a = i[l].getFrequencies(e);
|
|
907
1239
|
o += a.getVisitedCount(), s += a.getTotalCount(), c ||= a.isTruncated();
|
|
@@ -914,22 +1246,22 @@ var In = class {
|
|
|
914
1246
|
}) : c = !0, d = u.next();
|
|
915
1247
|
}
|
|
916
1248
|
}
|
|
917
|
-
return Nt.fromGroups(r, t, e,
|
|
1249
|
+
return Nt.fromGroups(r, t, e, rr, o, s, c);
|
|
918
1250
|
}
|
|
919
1251
|
getTypedCounts(e) {
|
|
920
1252
|
let t = this._typedCounts;
|
|
921
1253
|
if (!t) {
|
|
922
1254
|
let e = {
|
|
923
|
-
[
|
|
924
|
-
[
|
|
925
|
-
[
|
|
926
|
-
[
|
|
927
|
-
[
|
|
928
|
-
[
|
|
1255
|
+
[N.Number]: 0,
|
|
1256
|
+
[N.String]: 0,
|
|
1257
|
+
[N.Boolean]: 0,
|
|
1258
|
+
[N.Error]: 0,
|
|
1259
|
+
[N.RichData]: 0,
|
|
1260
|
+
[N.Null]: 0
|
|
929
1261
|
}, n = this._children, r = n.length;
|
|
930
1262
|
for (let t = 0; t < r; t++) {
|
|
931
1263
|
let r = n[t].getTypedCounts();
|
|
932
|
-
e[
|
|
1264
|
+
e[N.Number] += r[N.Number] ?? 0, e[N.String] += r[N.String] ?? 0, e[N.Boolean] += r[N.Boolean] ?? 0, e[N.Error] += r[N.Error] ?? 0, e[N.RichData] += r[N.RichData] ?? 0, e[N.Null] += r[N.Null] ?? 0;
|
|
933
1265
|
}
|
|
934
1266
|
t = Object.freeze(e), this._typedCounts = t;
|
|
935
1267
|
}
|
|
@@ -950,12 +1282,12 @@ var In = class {
|
|
|
950
1282
|
sum: 0,
|
|
951
1283
|
sumSq: 0,
|
|
952
1284
|
typed: {
|
|
953
|
-
[
|
|
954
|
-
[
|
|
955
|
-
[
|
|
956
|
-
[
|
|
957
|
-
[
|
|
958
|
-
[
|
|
1285
|
+
[N.Number]: 0,
|
|
1286
|
+
[N.String]: 0,
|
|
1287
|
+
[N.Boolean]: 0,
|
|
1288
|
+
[N.Error]: 0,
|
|
1289
|
+
[N.RichData]: 0,
|
|
1290
|
+
[N.Null]: 0
|
|
959
1291
|
}
|
|
960
1292
|
};
|
|
961
1293
|
for (let i = 0; i < n; i++) {
|
|
@@ -964,17 +1296,17 @@ var In = class {
|
|
|
964
1296
|
let a = n.numericalCount;
|
|
965
1297
|
a <= 0 || (r.numericalCount += a, r.sum += n.sum, r.sumSq += n.varP * a + n.sum * n.sum / a, (r.min === void 0 || n.min < r.min) && (r.min = n.min), (r.max === void 0 || n.max > r.max) && (r.max = n.max));
|
|
966
1298
|
}
|
|
967
|
-
return
|
|
1299
|
+
return _t(r);
|
|
968
1300
|
}
|
|
969
|
-
},
|
|
970
|
-
function
|
|
1301
|
+
}, or = Object.freeze([]);
|
|
1302
|
+
function sr(e, t) {
|
|
971
1303
|
let n = e.length, r = t.length, i = Array(n + r), a = 0, o = 0, s = 0;
|
|
972
1304
|
for (; a < n && o < r;) i[s++] = e[a] <= t[o] ? e[a++] : t[o++];
|
|
973
1305
|
for (; a < n;) i[s++] = e[a++];
|
|
974
1306
|
for (; o < r;) i[s++] = t[o++];
|
|
975
1307
|
return i;
|
|
976
1308
|
}
|
|
977
|
-
var
|
|
1309
|
+
var cr = class {
|
|
978
1310
|
constructor(e, t) {
|
|
979
1311
|
this._deleted = !1, this._json = { ...e }, this._deleteFromCollection = t ?? null;
|
|
980
1312
|
}
|
|
@@ -1008,7 +1340,7 @@ var zn = class {
|
|
|
1008
1340
|
get isIPerson() {
|
|
1009
1341
|
return !0;
|
|
1010
1342
|
}
|
|
1011
|
-
},
|
|
1343
|
+
}, lr = class extends g {
|
|
1012
1344
|
constructor(e) {
|
|
1013
1345
|
super(), this._byId = /* @__PURE__ */ new Map(), this._byDisplayName = /* @__PURE__ */ new Map(), this._items = null, this._current = null, e && this.fromJSON(e);
|
|
1014
1346
|
}
|
|
@@ -1029,10 +1361,10 @@ var zn = class {
|
|
|
1029
1361
|
let e = this._byDisplayName.get(r);
|
|
1030
1362
|
if (e) return e;
|
|
1031
1363
|
}
|
|
1032
|
-
let i = new
|
|
1364
|
+
let i = new cr({
|
|
1033
1365
|
...t,
|
|
1034
1366
|
displayName: r,
|
|
1035
|
-
id: n ??
|
|
1367
|
+
id: n ?? P.uuidV4().toUpperCase()
|
|
1036
1368
|
}, (e) => this._remove(e));
|
|
1037
1369
|
return this._byId.set(i.getId(), i), r && !this._byDisplayName.has(r) && this._byDisplayName.set(r, i), this._items = null, this._notifyCollectionChange(), i;
|
|
1038
1370
|
}
|
|
@@ -1072,7 +1404,7 @@ var zn = class {
|
|
|
1072
1404
|
get isIPersonCollection() {
|
|
1073
1405
|
return !0;
|
|
1074
1406
|
}
|
|
1075
|
-
},
|
|
1407
|
+
}, ur = (e, t) => {
|
|
1076
1408
|
let n = [0];
|
|
1077
1409
|
for (let t = 0; t < e.length; t++) e[t] === "\n" && n.push(t + 1);
|
|
1078
1410
|
let r = t.map((e) => ` ${((e) => {
|
|
@@ -1084,9 +1416,9 @@ var zn = class {
|
|
|
1084
1416
|
return `${t + 1}:${e - n[t] + 1}`;
|
|
1085
1417
|
})(e.start)} ${e.code}: ${e.message}`), i = t.length;
|
|
1086
1418
|
return `Script has ${i} compile error${i === 1 ? "" : "s"}:\n${r.join("\n")}`;
|
|
1087
|
-
},
|
|
1419
|
+
}, dr = class {
|
|
1088
1420
|
constructor(e) {
|
|
1089
|
-
this._options = e, this._emitter = new
|
|
1421
|
+
this._options = e, this._emitter = new x(this), this._initState();
|
|
1090
1422
|
}
|
|
1091
1423
|
_initState() {}
|
|
1092
1424
|
getModules() {
|
|
@@ -1095,12 +1427,12 @@ var zn = class {
|
|
|
1095
1427
|
_builtInNames() {
|
|
1096
1428
|
try {
|
|
1097
1429
|
let e = this._options.getBuiltInFunctions?.();
|
|
1098
|
-
if (!e) return
|
|
1430
|
+
if (!e) return P.EmptyArray;
|
|
1099
1431
|
let t = [];
|
|
1100
1432
|
for (let n of e.getItems()) n.isBuiltIn() && t.push(n.getName());
|
|
1101
1433
|
return t;
|
|
1102
1434
|
} catch {
|
|
1103
|
-
return
|
|
1435
|
+
return P.EmptyArray;
|
|
1104
1436
|
}
|
|
1105
1437
|
}
|
|
1106
1438
|
async createModule(e) {
|
|
@@ -1109,14 +1441,14 @@ var zn = class {
|
|
|
1109
1441
|
minify: !0,
|
|
1110
1442
|
...e
|
|
1111
1443
|
});
|
|
1112
|
-
return t.module ? await
|
|
1444
|
+
return t.module ? await n(ie.DEFAULT_MODULE, t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
|
|
1113
1445
|
}
|
|
1114
1446
|
addModule(e, t, n) {
|
|
1115
1447
|
this._modules.add(e, t, n);
|
|
1116
1448
|
}
|
|
1117
|
-
async addModuleFromJSON(e, t,
|
|
1118
|
-
let
|
|
1119
|
-
return this.addModule(e,
|
|
1449
|
+
async addModuleFromJSON(e, t, r) {
|
|
1450
|
+
let i = await n(e, t);
|
|
1451
|
+
return this.addModule(e, i, r), i;
|
|
1120
1452
|
}
|
|
1121
1453
|
executeMacro(e, t, n) {
|
|
1122
1454
|
let r = this._modules.getItems({ name: t }), i = r.length;
|
|
@@ -1131,7 +1463,7 @@ var zn = class {
|
|
|
1131
1463
|
}
|
|
1132
1464
|
async run(e, t) {
|
|
1133
1465
|
try {
|
|
1134
|
-
let r = typeof e == "string" ? await this.createModule({ source: e }) : await
|
|
1466
|
+
let r = typeof e == "string" ? await this.createModule({ source: e }) : await n(ie.DEFAULT_MODULE, e), i = typeof e == "string" ? e : e?.source ?? "";
|
|
1135
1467
|
return await this._runModule(r, i, t);
|
|
1136
1468
|
} catch (e) {
|
|
1137
1469
|
return {
|
|
@@ -1148,7 +1480,7 @@ var zn = class {
|
|
|
1148
1480
|
};
|
|
1149
1481
|
let i = e.getDiagnostics(), a = i.filter((e) => e.severity === "error");
|
|
1150
1482
|
if (a.length > 0) {
|
|
1151
|
-
let e = Error(
|
|
1483
|
+
let e = Error(ur(t, a));
|
|
1152
1484
|
return e.diagnostics = a, {
|
|
1153
1485
|
ok: !1,
|
|
1154
1486
|
error: e,
|
|
@@ -1184,7 +1516,7 @@ var zn = class {
|
|
|
1184
1516
|
async searchFunctions(e) {
|
|
1185
1517
|
await this._emitter.notify("onBeforeSearch", { async: !0 });
|
|
1186
1518
|
let t = await this._searchable(e);
|
|
1187
|
-
if (t.length === 0) return
|
|
1519
|
+
if (t.length === 0) return P.EmptyArray;
|
|
1188
1520
|
let n = e?.limit, r = n === void 0 ? e : {
|
|
1189
1521
|
...e,
|
|
1190
1522
|
limit: void 0
|
|
@@ -1199,14 +1531,14 @@ var zn = class {
|
|
|
1199
1531
|
}
|
|
1200
1532
|
}
|
|
1201
1533
|
}
|
|
1202
|
-
if (!i || i.length === 0) return
|
|
1534
|
+
if (!i || i.length === 0) return P.EmptyArray;
|
|
1203
1535
|
let o = e?.text ? e.text.trim().toUpperCase() : null;
|
|
1204
|
-
return o && t.length > 1 &&
|
|
1536
|
+
return o && t.length > 1 && $e(i, o), n !== void 0 && i.length > n ? i.slice(0, n) : i;
|
|
1205
1537
|
}
|
|
1206
1538
|
async getFunctionCategories(e) {
|
|
1207
1539
|
await this._emitter.notify("onBeforeSearch", { async: !0 });
|
|
1208
1540
|
let t = await this._searchable(e);
|
|
1209
|
-
if (t.length === 0) return
|
|
1541
|
+
if (t.length === 0) return P.EmptyArray;
|
|
1210
1542
|
if (t.length === 1) return t[0].getCategories(e);
|
|
1211
1543
|
let n = e?.includeDeprecated ?? !1, r = /* @__PURE__ */ new Map(), i = (e) => {
|
|
1212
1544
|
let t = e.toUpperCase(), n = r.get(t);
|
|
@@ -1238,40 +1570,40 @@ var zn = class {
|
|
|
1238
1570
|
})), this._startPromise;
|
|
1239
1571
|
}
|
|
1240
1572
|
async _doStart() {
|
|
1241
|
-
let e = this._options?.workbook, t = this._options?.json,
|
|
1573
|
+
let e = this._options?.workbook, t = this._options?.json, r = {};
|
|
1242
1574
|
if (t) {
|
|
1243
|
-
let
|
|
1244
|
-
for (let
|
|
1245
|
-
let
|
|
1575
|
+
let i = Object.keys(t);
|
|
1576
|
+
for (let a = 0; a < i.length; a++) {
|
|
1577
|
+
let o = i[a], s = t[o];
|
|
1246
1578
|
try {
|
|
1247
|
-
|
|
1579
|
+
r[o] = await n(o, s, !1, [], s?.scope === "workbook" ? e : null);
|
|
1248
1580
|
} catch (e) {
|
|
1249
|
-
|
|
1581
|
+
Wt.error(`Could not load script '${o}'; it will be unavailable.`, e);
|
|
1250
1582
|
}
|
|
1251
1583
|
}
|
|
1252
1584
|
}
|
|
1253
|
-
let
|
|
1585
|
+
let i = this, a = new h({
|
|
1254
1586
|
transactions: this._options?.transactions,
|
|
1255
|
-
initial:
|
|
1256
|
-
isReadOnly: () =>
|
|
1587
|
+
initial: r,
|
|
1588
|
+
isReadOnly: () => i.isReadOnly(),
|
|
1257
1589
|
onRemove: (e, t) => {
|
|
1258
|
-
|
|
1590
|
+
i._options?.onRemove?.(e, t);
|
|
1259
1591
|
},
|
|
1260
1592
|
onAdd: (e, t) => {
|
|
1261
|
-
|
|
1593
|
+
i._emitter.notify("onChange"), i._options?.onAdd?.(e, t);
|
|
1262
1594
|
}
|
|
1263
1595
|
});
|
|
1264
|
-
this._modules =
|
|
1265
|
-
let
|
|
1266
|
-
if (
|
|
1267
|
-
let
|
|
1268
|
-
for (let t = 0; t <
|
|
1269
|
-
let n =
|
|
1596
|
+
this._modules = a;
|
|
1597
|
+
let o = a.getItems();
|
|
1598
|
+
if (o.length === 0) return Promise.resolve(P.EmptyArray);
|
|
1599
|
+
let s = o.length;
|
|
1600
|
+
for (let t = 0; t < s; t++) {
|
|
1601
|
+
let n = o[t];
|
|
1270
1602
|
try {
|
|
1271
1603
|
let t = await n.getFunctions().search({ type: "autoRun" }), r = t.length;
|
|
1272
1604
|
for (let n = 0; n < r; n++) await t[n].execute(e);
|
|
1273
1605
|
} catch (e) {
|
|
1274
|
-
|
|
1606
|
+
Wt.error("Error executing autoRun script:", e);
|
|
1275
1607
|
}
|
|
1276
1608
|
}
|
|
1277
1609
|
}
|
|
@@ -1290,9 +1622,9 @@ var zn = class {
|
|
|
1290
1622
|
get isIScript() {
|
|
1291
1623
|
return !0;
|
|
1292
1624
|
}
|
|
1293
|
-
},
|
|
1625
|
+
}, fr = class {
|
|
1294
1626
|
constructor(e, t, n, r) {
|
|
1295
|
-
this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ??
|
|
1627
|
+
this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ?? F.EmptyCell, this._sheet = new M({
|
|
1296
1628
|
runtime: e,
|
|
1297
1629
|
styles: this._styles,
|
|
1298
1630
|
calcOnLoad: "none",
|
|
@@ -1305,43 +1637,43 @@ var zn = class {
|
|
|
1305
1637
|
applyCSSStyle(e, t) {
|
|
1306
1638
|
let n = !1;
|
|
1307
1639
|
e.style || (e.style = {}, n = !0);
|
|
1308
|
-
let
|
|
1640
|
+
let r = e.style, i = { ...t };
|
|
1309
1641
|
if (t.msoIgnore) {
|
|
1310
|
-
let e = t.msoIgnore.split(","), n = Object.keys(
|
|
1642
|
+
let e = t.msoIgnore.split(","), n = Object.keys(i);
|
|
1311
1643
|
for (let t = 0; t < n.length; t++) {
|
|
1312
1644
|
let r = n[t];
|
|
1313
|
-
e.includes(r) && delete
|
|
1645
|
+
e.includes(r) && delete i[r];
|
|
1314
1646
|
}
|
|
1315
1647
|
}
|
|
1316
|
-
let
|
|
1317
|
-
|
|
1318
|
-
let
|
|
1319
|
-
|
|
1320
|
-
let
|
|
1321
|
-
if (
|
|
1322
|
-
let e =
|
|
1323
|
-
e && (e.patternType ===
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
let
|
|
1327
|
-
e && (
|
|
1648
|
+
let a = Lt(i.fontFamily);
|
|
1649
|
+
r.font = {}, a && (r.font.family = a.family, r.font.fallbacks = a.fallbacks, r.font.size = a.size), r.font.size = i.fontSize, r.font.weight = i.fontWeight, r.font.style = i.fontStyle, r.font.color = i.color;
|
|
1650
|
+
let o = S(i.textDecoration);
|
|
1651
|
+
r.font.underline = o.underline, r.font.strike = o.strike, i.textUnderlineStyle && (r.font.underline = re(i.textUnderlineStyle)), r.alignment = {}, i?.textAlign && (r.alignment.horizontal = _(i.textAlign)), i?.textAlign && !r.alignment.horizontal && i?.textAlign !== "general" && (i.textAlign === "center-across" ? r.alignment.horizontal = w.HorizontalAlignment.CenterContinuous : i.textAlign === "fill" ? r.alignment.horizontal = w.HorizontalAlignment.Fill : i.textAlign === "121" || i.textAlign === "010" ? (r.alignment.horizontal = w.HorizontalAlignment.Distributed, r.alignment.justifyLastLine = i.textAlign === "121") : console.warn("unknown text-align", i.textAlign)), i.verticalAlign && (i.verticalAlign.toLowerCase() === "super" ? r.font.verticalAlign = O.VerticalAlignment.Super : i.verticalAlign.toLowerCase() === "sup" ? r.font.verticalAlign = O.VerticalAlignment.Sub : r.alignment.vertical = ve(i.verticalAlign), r.alignment.vertical || (i.verticalAlign === "121" ? r.alignment.vertical = w.VerticalAlignment.Distributed : console.warn("unknown vertical-align", i.verticalAlign))), i.msoCharIndentCount && (r.alignment.indent = i.msoCharIndentCount), i.whiteSpace && (r.alignment.overflow = i.whiteSpace === "no-wrap" || i.whiteSpace === "nowrap" ? w.Overflow.Visible : w.Overflow.Wrap), i.msoTextControl === "shrinktofit" && (r.alignment.overflow = w.Overflow.Shrink);
|
|
1652
|
+
let s = null;
|
|
1653
|
+
if (i.background ? s = i.background : i.backgroundColor && (s = i.backgroundColor), s && (r.fill = { color: s }), i.msoPattern) {
|
|
1654
|
+
let e = Ee(i.msoPattern);
|
|
1655
|
+
e && (e.patternType === T.BuiltInSheetPattern.Solid ? r.fill = { color: e.foreground } : e.patternType !== T.BuiltInSheetPattern.None && (s && (e.background = s), r.fill = e));
|
|
1656
|
+
}
|
|
1657
|
+
i.layoutFlow === "vertical" || i.layoutFlow === "vertical-ideographic" ? r.alignment.stacked = !0 : i.msoRotate !== void 0 && (r.alignment.rotation = me(i.msoRotate));
|
|
1658
|
+
let c = (e, t) => {
|
|
1659
|
+
e && (r.borders ||= {}, r.borders[e] = t);
|
|
1328
1660
|
};
|
|
1329
|
-
|
|
1330
|
-
let
|
|
1331
|
-
|
|
1661
|
+
i.border && i.border !== "none" && (c("top", i.border), c("left", i.border), c("right", i.border), c("bottom", i.border)), i.borderTop && c("top", i.borderTop), i.borderLeft && c("left", i.borderLeft), i.borderRight && c("right", i.borderRight), i.borderBottom && c("bottom", i.borderBottom), i.msoDiagonalUp && c("diagonalUp", i.msoDiagonalUp), i.msoDiagonalDown && c("diagonalDown", i.msoDiagonalDown);
|
|
1662
|
+
let l = r.numberFormat;
|
|
1663
|
+
i.msoNumberFormat && (l = y(i.msoNumberFormat), l.includes("\\") ? l = null : l === "Fixed" ? l = D.Styles.lookupStyle(r.numberFormat).formatType === D.Type.Number ? null : D.Type.Number : l === "Percent" && (l = D.Styles.lookupStyle(r.numberFormat).formatType === D.Type.Percentage ? null : D.Type.Percentage)), l && (r.numberFormat = l), e.style = this._styles.normalize(r), n && Object.keys(e.style).length === 0 && delete e.style;
|
|
1332
1664
|
}
|
|
1333
1665
|
onCell(e, t, n, r, i) {
|
|
1334
1666
|
let a = r(i), o = { value: t === void 0 ? n ?? "" : t };
|
|
1335
1667
|
if (typeof o.value == "string" && o.value.length === 0 && (o.value = void 0), a && this.applyCSSStyle(o, a), i?.tagName.toUpperCase() === "TD") {
|
|
1336
1668
|
let e = o.style, t = e?.font ?? {};
|
|
1337
|
-
(i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike = !0), i.querySelectorAll("sub").length > 0 && (t.verticalAlign =
|
|
1669
|
+
(i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike = !0), i.querySelectorAll("sub").length > 0 && (t.verticalAlign = O.VerticalAlignment.Sub), i.querySelectorAll("sup").length > 0 && (t.verticalAlign = O.VerticalAlignment.Super), (i.querySelectorAll("b").length > 0 || i.querySelectorAll("strong").length > 0) && (t.weight = 700), i.querySelectorAll("i").length > 0 && (t.style = O.Style.Italic), i.querySelectorAll("u").length > 0 && (t.underline = O.UnderlineStyle.Single), Object.keys(t).length > 0 && (e || (e = {}, o.style = e), e.font ||= t);
|
|
1338
1670
|
let n = i.querySelectorAll("a");
|
|
1339
1671
|
if (n.length > 0) {
|
|
1340
1672
|
let e = n[0].getAttribute("href");
|
|
1341
1673
|
e && (o.hyperlink = e);
|
|
1342
1674
|
}
|
|
1343
1675
|
}
|
|
1344
|
-
if (!
|
|
1676
|
+
if (!F.isSingleCell(e)) {
|
|
1345
1677
|
let t = {
|
|
1346
1678
|
rowStart: this._topLeft.rowIndex + e.rowStart,
|
|
1347
1679
|
colStart: this._topLeft.colIndex + e.colStart,
|
|
@@ -1352,7 +1684,7 @@ var zn = class {
|
|
|
1352
1684
|
}
|
|
1353
1685
|
if (o.value === void 0 && !o.style && Object.keys(o).length <= 1) return;
|
|
1354
1686
|
let s = this._builder, c = this._topLeft;
|
|
1355
|
-
if (s.pushAt(c.rowIndex + e.rowStart, c.colIndex + e.colStart, o), !
|
|
1687
|
+
if (s.pushAt(c.rowIndex + e.rowStart, c.colIndex + e.colStart, o), !F.isSingleCell(e) && a.msoIgnore) {
|
|
1356
1688
|
if (a.msoIgnore.includes("colspan")) {
|
|
1357
1689
|
let t = {};
|
|
1358
1690
|
a && this.applyCSSStyle(t, a);
|
|
@@ -1380,29 +1712,29 @@ var zn = class {
|
|
|
1380
1712
|
onRowStart(e, t, n, r) {
|
|
1381
1713
|
let i = n(r);
|
|
1382
1714
|
if (i.msoHeightSource !== "userset" || !r) return;
|
|
1383
|
-
let
|
|
1384
|
-
if (
|
|
1385
|
-
let t = r.cells[e], i =
|
|
1386
|
-
i !== null && (
|
|
1715
|
+
let o = r.getAttribute("height") ?? i.height, s = null;
|
|
1716
|
+
if (o && (s = a(o, this._styles.getNormal().getFont().getSize(), "px")), s === null) for (let e = 0; e < r.cells.length; e++) {
|
|
1717
|
+
let t = r.cells[e], i = a(t.getAttribute("height") ?? n(t).height, this._styles.getNormal().getFont().getSize(), "px");
|
|
1718
|
+
i !== null && (s = Math.max(i, s ?? 0));
|
|
1387
1719
|
}
|
|
1388
|
-
|
|
1720
|
+
s !== null && this._rowsReading.push({
|
|
1389
1721
|
address: {
|
|
1390
1722
|
min: this._topLeft.rowIndex + e,
|
|
1391
1723
|
max: this._topLeft.rowIndex + e + t - 1
|
|
1392
1724
|
},
|
|
1393
|
-
update: { size:
|
|
1725
|
+
update: { size: s * O.getDeviceScale() }
|
|
1394
1726
|
});
|
|
1395
1727
|
}
|
|
1396
1728
|
onColumn(e, t, n, r) {
|
|
1397
1729
|
let i = n(r);
|
|
1398
1730
|
if (i.msoWidthSource !== "userset" || !r) return;
|
|
1399
|
-
let
|
|
1400
|
-
|
|
1731
|
+
let o = r.getAttribute("width") ?? i.width, s = null;
|
|
1732
|
+
o && (s = a(o, this._styles.getNormal().getFont().getSize(), "px")), s !== null && this._colsReading.push({
|
|
1401
1733
|
address: {
|
|
1402
1734
|
min: this._topLeft.colIndex + e,
|
|
1403
1735
|
max: this._topLeft.colIndex + e + t - 1
|
|
1404
1736
|
},
|
|
1405
|
-
update: { size:
|
|
1737
|
+
update: { size: s * O.getDeviceScale() }
|
|
1406
1738
|
});
|
|
1407
1739
|
}
|
|
1408
1740
|
onDone() {
|
|
@@ -1413,9 +1745,9 @@ var zn = class {
|
|
|
1413
1745
|
sheet() {
|
|
1414
1746
|
return this._sheet;
|
|
1415
1747
|
}
|
|
1416
|
-
},
|
|
1748
|
+
}, pr = class {
|
|
1417
1749
|
constructor(e) {
|
|
1418
|
-
if (!e) throw new
|
|
1750
|
+
if (!e) throw new Gt("snapshot is required.");
|
|
1419
1751
|
this._snapshot = e;
|
|
1420
1752
|
}
|
|
1421
1753
|
getItemType() {
|
|
@@ -1445,10 +1777,10 @@ var zn = class {
|
|
|
1445
1777
|
get isClipboardItem() {
|
|
1446
1778
|
return !0;
|
|
1447
1779
|
}
|
|
1448
|
-
},
|
|
1780
|
+
}, mr = class {
|
|
1449
1781
|
constructor(e, t, n, r, i) {
|
|
1450
|
-
if (this._parsed = void 0, this._runtime = e, !t) throw new
|
|
1451
|
-
this._topLeft = n ??
|
|
1782
|
+
if (this._parsed = void 0, this._runtime = e, !t) throw new Gt("nativeItems are required.");
|
|
1783
|
+
this._topLeft = n ?? F.EmptyCell, this._native = t, this._markOptions = Object.freeze(r ?? {}), this._styles = i;
|
|
1452
1784
|
}
|
|
1453
1785
|
getItemType() {
|
|
1454
1786
|
return "range";
|
|
@@ -1489,15 +1821,15 @@ var zn = class {
|
|
|
1489
1821
|
async parse() {
|
|
1490
1822
|
let e, t = this._native?.text, n = this._native.html;
|
|
1491
1823
|
if (n === null && t && t.includes("<table")) try {
|
|
1492
|
-
let e = new DOMParser().parseFromString(t,
|
|
1493
|
-
if (r) throw new
|
|
1824
|
+
let e = new DOMParser().parseFromString(t, Ut.Html), r = e.querySelector("parsererror");
|
|
1825
|
+
if (r) throw new I("Unable to parse: " + r);
|
|
1494
1826
|
n = e, t = null;
|
|
1495
1827
|
} catch {
|
|
1496
1828
|
console.warn("Discovered text as html table but could could not parse.");
|
|
1497
1829
|
}
|
|
1498
1830
|
try {
|
|
1499
|
-
let r = new
|
|
1500
|
-
if (
|
|
1831
|
+
let r = new fr(this._runtime, this._topLeft, this._styles, n ? "HTML" : "Text"), i = await Promise.resolve(t ? qe(t) : [[]]), a;
|
|
1832
|
+
if (st(n, i, r) ? (e = r.sheet(), a = e.getUsedRange()) : n = null, a) return this._parsed = {
|
|
1501
1833
|
copyTo: async (e, t) => (await e.copyFrom(a, t))?.getCoords() ?? null,
|
|
1502
1834
|
getCoords: () => a.getCoords(),
|
|
1503
1835
|
getSource: () => e,
|
|
@@ -1512,7 +1844,7 @@ var zn = class {
|
|
|
1512
1844
|
async copyTo(t, n) {
|
|
1513
1845
|
let r = t.getSheet(), i = await e._native.image.arrayBuffer(), a = await r.getMovables().addPicture({ source: { buffer: i } }, {
|
|
1514
1846
|
type: "picture",
|
|
1515
|
-
description:
|
|
1847
|
+
description: z("op.copyImageFromClipboard")
|
|
1516
1848
|
});
|
|
1517
1849
|
return r.getView().selectMovables([a]), null;
|
|
1518
1850
|
},
|
|
@@ -1524,7 +1856,7 @@ var zn = class {
|
|
|
1524
1856
|
get isClipboardItem() {
|
|
1525
1857
|
return !0;
|
|
1526
1858
|
}
|
|
1527
|
-
},
|
|
1859
|
+
}, hr = {
|
|
1528
1860
|
showFormulaBar: !0,
|
|
1529
1861
|
showTabs: !0,
|
|
1530
1862
|
tabRatio: 600,
|
|
@@ -1532,9 +1864,9 @@ var zn = class {
|
|
|
1532
1864
|
showVerticalScrollbar: !0,
|
|
1533
1865
|
showStatusBar: !0,
|
|
1534
1866
|
activeSheetId: 0
|
|
1535
|
-
},
|
|
1867
|
+
}, gr = class {
|
|
1536
1868
|
constructor(e) {
|
|
1537
|
-
this._id =
|
|
1869
|
+
this._id = P.uuidV4(), this._emitter = new x(this), this._state = { ...hr }, e?.json && this._fromJSON(e?.json);
|
|
1538
1870
|
}
|
|
1539
1871
|
getId() {
|
|
1540
1872
|
return this._id;
|
|
@@ -1589,7 +1921,7 @@ var zn = class {
|
|
|
1589
1921
|
let e = {}, t = Object.keys(this._state), n = t.length;
|
|
1590
1922
|
for (let r = 0; r < n; r++) {
|
|
1591
1923
|
let n = t[r], i = this._state[n];
|
|
1592
|
-
i != null && i !==
|
|
1924
|
+
i != null && i !== hr[n] && (e[n] = i);
|
|
1593
1925
|
}
|
|
1594
1926
|
return Object.keys(e).length === 0 && (e = null), e;
|
|
1595
1927
|
}
|
|
@@ -1599,7 +1931,7 @@ var zn = class {
|
|
|
1599
1931
|
}
|
|
1600
1932
|
update(e, t = !0) {
|
|
1601
1933
|
this._state = {
|
|
1602
|
-
...
|
|
1934
|
+
...hr,
|
|
1603
1935
|
...this._state,
|
|
1604
1936
|
...e
|
|
1605
1937
|
}, t && this._emitter.notify("onViewChange");
|
|
@@ -1614,13 +1946,13 @@ var zn = class {
|
|
|
1614
1946
|
get isIWorkbookView() {
|
|
1615
1947
|
return !0;
|
|
1616
1948
|
}
|
|
1617
|
-
},
|
|
1949
|
+
}, _r = Object.freeze({
|
|
1618
1950
|
structure: !1,
|
|
1619
1951
|
windows: !1,
|
|
1620
1952
|
revision: !1,
|
|
1621
1953
|
password: null,
|
|
1622
1954
|
revisionsPassword: null
|
|
1623
|
-
}),
|
|
1955
|
+
}), vr = class extends ae {
|
|
1624
1956
|
isWindowsAllowed() {
|
|
1625
1957
|
return this._isPropertyAllowed("windows");
|
|
1626
1958
|
}
|
|
@@ -1642,7 +1974,7 @@ var zn = class {
|
|
|
1642
1974
|
let n = Object.keys(t), r = n.length;
|
|
1643
1975
|
for (let i = 0; i < r; i++) {
|
|
1644
1976
|
let r = n[i], a = t[r];
|
|
1645
|
-
a != null && a !==
|
|
1977
|
+
a != null && a !== _r[r] && (e[r] = a);
|
|
1646
1978
|
}
|
|
1647
1979
|
}
|
|
1648
1980
|
return super._toJSON(e);
|
|
@@ -1655,9 +1987,9 @@ var zn = class {
|
|
|
1655
1987
|
}
|
|
1656
1988
|
};
|
|
1657
1989
|
function Z(e) {
|
|
1658
|
-
return
|
|
1990
|
+
return B("error.workbook.invalidSheetKey", { key: e });
|
|
1659
1991
|
}
|
|
1660
|
-
var
|
|
1992
|
+
var yr = class extends g {
|
|
1661
1993
|
constructor(e, t, n) {
|
|
1662
1994
|
super(), this._add = e, this._get = t, this._addListeners = n;
|
|
1663
1995
|
}
|
|
@@ -1676,39 +2008,39 @@ var Xn = class extends w {
|
|
|
1676
2008
|
get isISheetCollection() {
|
|
1677
2009
|
return !0;
|
|
1678
2010
|
}
|
|
1679
|
-
},
|
|
1680
|
-
function
|
|
1681
|
-
let t =
|
|
2011
|
+
}, br = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), xr = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
|
|
2012
|
+
function Sr(e) {
|
|
2013
|
+
let t = B(z("workbook.defaultSheetName"), { n: e + 1 });
|
|
1682
2014
|
return t === "workbook.defaultSheetName" ? `Sheet${e + 1}` : t;
|
|
1683
2015
|
}
|
|
1684
|
-
function
|
|
2016
|
+
function Cr(e, t) {
|
|
1685
2017
|
return {
|
|
1686
|
-
...
|
|
2018
|
+
...bt,
|
|
1687
2019
|
getSheet: () => null,
|
|
1688
|
-
toString: () =>
|
|
2020
|
+
toString: () => vt(e, t)
|
|
1689
2021
|
};
|
|
1690
2022
|
}
|
|
1691
|
-
function
|
|
1692
|
-
if (!e) throw Error(
|
|
1693
|
-
if (
|
|
2023
|
+
function wr(e, t = !1) {
|
|
2024
|
+
if (!e) throw Error(B("error.workbook.sheetNameBlank"));
|
|
2025
|
+
if (br.test(e)) {
|
|
1694
2026
|
if (!t) throw Error(function(e) {
|
|
1695
|
-
return e ?
|
|
2027
|
+
return e ? B("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : B("error.workbook.sheetNameInvalidChars");
|
|
1696
2028
|
}(e));
|
|
1697
|
-
e = e.replace(
|
|
2029
|
+
e = e.replace(br, "");
|
|
1698
2030
|
}
|
|
1699
|
-
if (e.length === 0) throw Error(
|
|
2031
|
+
if (e.length === 0) throw Error(B("error.workbook.sheetNameBlank"));
|
|
1700
2032
|
let n = e.length;
|
|
1701
2033
|
if (n > 31) {
|
|
1702
|
-
if (!t) throw Error(
|
|
2034
|
+
if (!t) throw Error(B("error.workbook.sheetNameTooLong"));
|
|
1703
2035
|
e = e.substring(0, 31);
|
|
1704
2036
|
}
|
|
1705
2037
|
if (e.charAt(0) === "'" || e.charAt(n - 1) === "'") {
|
|
1706
|
-
if (!t) throw Error(
|
|
2038
|
+
if (!t) throw Error(B("error.workbook.sheetNameQuotes"));
|
|
1707
2039
|
e = e.replace(/^'|'$/g, "");
|
|
1708
2040
|
}
|
|
1709
2041
|
return e;
|
|
1710
2042
|
}
|
|
1711
|
-
var
|
|
2043
|
+
var Tr, Er, Dr = "workbook.activeSheet", Or = class e extends it {
|
|
1712
2044
|
constructor(e, t, n, r) {
|
|
1713
2045
|
super(e, t, r), this._workbook = n;
|
|
1714
2046
|
}
|
|
@@ -1722,20 +2054,20 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1722
2054
|
getOptions: A(this._options?.getOptions, n)
|
|
1723
2055
|
}), new e(t, this._internal, this._workbook, r);
|
|
1724
2056
|
}
|
|
1725
|
-
_createRange(e,
|
|
1726
|
-
let
|
|
1727
|
-
if (!
|
|
2057
|
+
_createRange(e, t) {
|
|
2058
|
+
let n = e ? { ...e } : null, r = n ? this._workbook._getSheetRef(n.scope, j.Visibility.VeryHidden) : null;
|
|
2059
|
+
if (!r) {
|
|
1728
2060
|
let e = this._workbook.getSelectedSheet();
|
|
1729
|
-
return delete
|
|
1730
|
-
scope:
|
|
2061
|
+
return delete n?.scope, Cr(n, n ? {
|
|
2062
|
+
scope: Ct,
|
|
1731
2063
|
...e.getEntireRange().getCoords()
|
|
1732
2064
|
} : null);
|
|
1733
2065
|
}
|
|
1734
|
-
let
|
|
1735
|
-
return
|
|
2066
|
+
let i = this._options;
|
|
2067
|
+
return t && (i = {
|
|
1736
2068
|
...this._options,
|
|
1737
|
-
getOptions: A(this._options.getOptions,
|
|
1738
|
-
}), new
|
|
2069
|
+
getOptions: A(this._options.getOptions, t)
|
|
2070
|
+
}), new kr(e, E(r.sheet), this._workbook, i);
|
|
1739
2071
|
}
|
|
1740
2072
|
async select(e) {
|
|
1741
2073
|
let t = [], n = null, r = this.getCoords();
|
|
@@ -1759,15 +2091,15 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1759
2091
|
}
|
|
1760
2092
|
getAddress(e) {
|
|
1761
2093
|
let t = this._internal.getSheet(), n = t.getEntireRange().getCoords();
|
|
1762
|
-
return
|
|
2094
|
+
return dt(this.getCoords(), {
|
|
1763
2095
|
...n,
|
|
1764
2096
|
scope: t.getName()
|
|
1765
|
-
},
|
|
2097
|
+
}, vt, Ne, e);
|
|
1766
2098
|
}
|
|
1767
2099
|
toString() {
|
|
1768
2100
|
return this.getAddress();
|
|
1769
2101
|
}
|
|
1770
|
-
},
|
|
2102
|
+
}, kr = class e extends Tt {
|
|
1771
2103
|
constructor(e, t, n, r) {
|
|
1772
2104
|
super(e, t, r), this._workbook = n;
|
|
1773
2105
|
}
|
|
@@ -1776,12 +2108,12 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1776
2108
|
return t && (n = {
|
|
1777
2109
|
...this._options,
|
|
1778
2110
|
getOptions: A(this._options?.getOptions, t)
|
|
1779
|
-
}), new
|
|
2111
|
+
}), new Or(e, this._internal, this._workbook, n);
|
|
1780
2112
|
}
|
|
1781
2113
|
_createRange(t, n) {
|
|
1782
2114
|
let r = this._internal;
|
|
1783
|
-
if (!t) return
|
|
1784
|
-
if (r.validateCoords(t), r.getSheet().isClosed()) return
|
|
2115
|
+
if (!t) return Xe(r.getSheet(), r.getSheet().getEntireCoords());
|
|
2116
|
+
if (r.validateCoords(t), r.getSheet().isClosed()) return Xe(null, r.getSheet().getEntireCoords(), t);
|
|
1785
2117
|
let i = this._options;
|
|
1786
2118
|
return n && (i = {
|
|
1787
2119
|
...this._options,
|
|
@@ -1798,7 +2130,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1798
2130
|
}
|
|
1799
2131
|
getAddress(e) {
|
|
1800
2132
|
let t = this._internal.getSheet(), n = t?.getEntireRange().getCoords() ?? null;
|
|
1801
|
-
return
|
|
2133
|
+
return vt(this.getCoords(), {
|
|
1802
2134
|
...n,
|
|
1803
2135
|
scope: t.getName()
|
|
1804
2136
|
});
|
|
@@ -1806,13 +2138,13 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1806
2138
|
toString() {
|
|
1807
2139
|
return this.getAddress();
|
|
1808
2140
|
}
|
|
1809
|
-
},
|
|
2141
|
+
}, Ar = (e) => !!e && typeof e == "object" && typeof e.getOrigin == "function", jr = class {
|
|
1810
2142
|
constructor(e) {
|
|
1811
|
-
this._isLoadingSheets = !1, this._lastTransactionUUID = null, this._starting = null, this._closed = !1, this._listenerOriginProvider = null, this._listenerOrigin = null, this._lastOriginName = null, this._initializing = !0, this._pivotCaches = [], this._pivotTableCollection = new
|
|
2143
|
+
this._isLoadingSheets = !1, this._lastTransactionUUID = null, this._starting = null, this._closed = !1, this._listenerOriginProvider = null, this._listenerOrigin = null, this._lastOriginName = null, this._initializing = !0, this._pivotCaches = [], this._pivotTableCollection = new Se(() => {
|
|
1812
2144
|
let e = [];
|
|
1813
2145
|
for (let t of this.getSheets()) e.push(...t.getPivotTables());
|
|
1814
2146
|
return e;
|
|
1815
|
-
}), this._people = new
|
|
2147
|
+
}), this._people = new lr(), this._commentCollection = new Fe(null, (e, t, n) => {
|
|
1816
2148
|
let r = [];
|
|
1817
2149
|
for (let i of this.getSheets()) r.push(...i.getComments().getItems(e ? {
|
|
1818
2150
|
address: e,
|
|
@@ -1825,24 +2157,24 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1825
2157
|
return r;
|
|
1826
2158
|
}, (e, t) => this.addListeners({ onSheetsChange: e.onCollectionChange ? () => {
|
|
1827
2159
|
e.onCollectionChange(this._commentCollection);
|
|
1828
|
-
} : void 0 }, t)), this.
|
|
2160
|
+
} : void 0 }, t)), this._isDate1904 = !1, this._codeName = null, this._updateLinks = null, this._locale = null, this._localeOverrides = null;
|
|
1829
2161
|
let t = typeof e == "string" ? { origin: e } : { ...e }, n = t.origin;
|
|
1830
|
-
this._ownOriginProvider = !
|
|
2162
|
+
this._ownOriginProvider = !Ar(n), this._originProvider = Ar(n) ? n : new en(typeof n == "string" ? new V(null, { name: n }) : n ?? new V(null)), delete t.origin, this._bindOrigin(this._originProvider.getOrigin()), this._listenerOriginProvider = this._originProvider.addListeners({ onOriginChange: () => this._onOriginChange() });
|
|
1831
2163
|
let r = t.json;
|
|
1832
|
-
delete t.json, this._transactions = t.transactions ?? new
|
|
2164
|
+
delete t.json, this._transactions = t.transactions ?? new _e(), this._id = this._transactions.create(), this._ownTransactions = !t.transactions, this._emitter = new x(this, this._transactions), this._runtime = t.runtime ?? new Mt("Workbook Runtime", {
|
|
1833
2165
|
isDate1904: () => this._isDate1904,
|
|
1834
2166
|
getNow: () => this._transactions.getCurrentCommit().getTimestamp(),
|
|
1835
|
-
getLocale: () => this._locale ??
|
|
2167
|
+
getLocale: () => this._locale ?? s() ?? be(),
|
|
1836
2168
|
getLocaleOverrides: () => this._localeOverrides
|
|
1837
|
-
}), this._listenerLanguage =
|
|
2169
|
+
}), this._listenerLanguage = Vt.addChangeListener(() => {
|
|
1838
2170
|
this._closed || this._notifyAllChange();
|
|
1839
2171
|
});
|
|
1840
|
-
let i = this, a = this._beginCommit({ description:
|
|
2172
|
+
let i = this, a = this._beginCommit({ description: z(r ? "op.openWorkbook" : "op.newWorkbook") });
|
|
1841
2173
|
try {
|
|
1842
|
-
this._strings = t.strings ?? new
|
|
2174
|
+
this._strings = t.strings ?? new d(), this._ownStrings = !t.strings, this._resources = t.resources ?? new de(), this._ownResources = !t.resources, this._createSheetName = t.createSheetNameCallback ?? Sr;
|
|
1843
2175
|
let e = t.createSheetCallback;
|
|
1844
|
-
e ||= (e) => new M(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, n, r, a, o, s) => {
|
|
1845
|
-
let
|
|
2176
|
+
e ||= (e) => new M(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, n, r, a, o, s, c) => {
|
|
2177
|
+
let l = null, u = {
|
|
1846
2178
|
runtime: i._runtime,
|
|
1847
2179
|
readonly: i._options.readonly ?? !1,
|
|
1848
2180
|
disableLoadAutoFit: i._options.disableLoadAutoFit ?? !1,
|
|
@@ -1857,64 +2189,64 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1857
2189
|
resolveRange: (e) => i._options.resolveRange?.(e) ?? i.getRange(e),
|
|
1858
2190
|
container: {
|
|
1859
2191
|
beforeFromJSON: (e) => {
|
|
1860
|
-
|
|
2192
|
+
l = e, i._addSheetRef({
|
|
1861
2193
|
name: n,
|
|
1862
2194
|
id: t,
|
|
1863
|
-
visibility: r ??
|
|
2195
|
+
visibility: r ?? j.Visibility.Visible,
|
|
1864
2196
|
sheetId: o,
|
|
1865
2197
|
sheet: e
|
|
1866
2198
|
}, a);
|
|
1867
2199
|
},
|
|
1868
2200
|
getName: () => {
|
|
1869
|
-
let e = i._getSheetRef(
|
|
2201
|
+
let e = i._getSheetRef(l);
|
|
1870
2202
|
return e ? e.name : n;
|
|
1871
2203
|
},
|
|
1872
2204
|
setName: (e, t) => {
|
|
1873
|
-
i._getSheetRef(
|
|
2205
|
+
i._getSheetRef(l) && i._setSheetName(l, e, t);
|
|
1874
2206
|
},
|
|
1875
2207
|
setNameChangeCallback: (e) => {
|
|
1876
2208
|
i._sheetOnNameChange.set(t, e);
|
|
1877
2209
|
},
|
|
1878
2210
|
getVisibility: () => {
|
|
1879
|
-
let e = i._getSheetRef(
|
|
1880
|
-
return e ? e.visibility :
|
|
2211
|
+
let e = i._getSheetRef(l);
|
|
2212
|
+
return e ? e.visibility : j.Visibility.Visible;
|
|
1881
2213
|
},
|
|
1882
2214
|
setVisibility: (e, t) => {
|
|
1883
|
-
i._setSheetVisibility(
|
|
2215
|
+
i._setSheetVisibility(l, e, t);
|
|
1884
2216
|
},
|
|
1885
2217
|
setVisibilityCallback: (e) => {
|
|
1886
2218
|
i._sheetOnVisibilityChange.set(t, e);
|
|
1887
2219
|
},
|
|
1888
|
-
duplicate: () => i._duplicateSheet(
|
|
2220
|
+
duplicate: () => i._duplicateSheet(l),
|
|
1889
2221
|
getIndex: () => {
|
|
1890
|
-
let e = i._getSheetRef(
|
|
1891
|
-
return e ? i._getOffsetForId(e.id, i._getSheetRefs(
|
|
2222
|
+
let e = i._getSheetRef(l);
|
|
2223
|
+
return e ? i._getOffsetForId(e.id, i._getSheetRefs(j.Visibility.VeryHidden)) : a;
|
|
1892
2224
|
},
|
|
1893
2225
|
setIndex: (e, t) => {
|
|
1894
|
-
let n = i._getSheetRef(
|
|
2226
|
+
let n = i._getSheetRef(l, j.Visibility.VeryHidden);
|
|
1895
2227
|
return !!n && (i._moveSheet(n, e, t), !0);
|
|
1896
2228
|
},
|
|
1897
2229
|
setIndexCallback: (e) => {
|
|
1898
2230
|
i._sheetOnIndexChange.set(t, e);
|
|
1899
2231
|
},
|
|
1900
|
-
requestSelect: async () => (i._setSelectedSheet(
|
|
2232
|
+
requestSelect: async () => (i._setSelectedSheet(l), await this._emitter.notify("onRequestSelect", {
|
|
1901
2233
|
source: i,
|
|
1902
|
-
params:
|
|
2234
|
+
params: l,
|
|
1903
2235
|
async: !0
|
|
1904
|
-
}), i.getSelectedSheet() ===
|
|
2236
|
+
}), i.getSelectedSheet() === l)
|
|
1905
2237
|
}
|
|
1906
2238
|
};
|
|
1907
|
-
return s && (
|
|
1908
|
-
}, this._namedTableSource = new
|
|
1909
|
-
getSheets: () => i._sheets ? i.getSheets().getItems() :
|
|
2239
|
+
return s && (u.json = s), c !== void 0 && (u.uid = () => c), l = e(u, n, a, r), l;
|
|
2240
|
+
}, this._namedTableSource = new we({
|
|
2241
|
+
getSheets: () => i._sheets ? i.getSheets().getItems() : P.EmptyArray,
|
|
1910
2242
|
addSheetsListener: (e, t) => i.addListeners({ onSheetsChange: e }, t)
|
|
1911
|
-
}), this._names = t.names ?? new
|
|
2243
|
+
}), this._names = t.names ?? new tt({
|
|
1912
2244
|
addressToRanges: (e) => i.getRanges(e),
|
|
1913
2245
|
getCurrentScope: () => i.getSelectedSheet().getName(),
|
|
1914
2246
|
isReadOnly: () => (i._options.readonly ?? !1) || i._isStructureProtected(),
|
|
1915
2247
|
transactions: i._transactions,
|
|
1916
|
-
getSources: () => i._calculation ? [i._calculation.getNamedFormulas(), i._namedTableSource] :
|
|
1917
|
-
}), this._ownNames = !t.names, this._calculation = t.calculation ?? new
|
|
2248
|
+
getSources: () => i._calculation ? [i._calculation.getNamedFormulas(), i._namedTableSource] : P.EmptyArray
|
|
2249
|
+
}), this._ownNames = !t.names, this._calculation = t.calculation ?? new Ue({
|
|
1918
2250
|
runtime: i._runtime,
|
|
1919
2251
|
functions: t.functions,
|
|
1920
2252
|
json: r?.calc,
|
|
@@ -1933,19 +2265,19 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1933
2265
|
getSheetIndex: (e) => {
|
|
1934
2266
|
if (e === void 0) {
|
|
1935
2267
|
let e = i.getSelectedSheet();
|
|
1936
|
-
return e ? this._getSheetRefs(
|
|
2268
|
+
return e ? this._getSheetRefs(j.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
|
|
1937
2269
|
}
|
|
1938
|
-
let t = this._getSheetRefs(
|
|
2270
|
+
let t = this._getSheetRefs(j.Visibility.VeryHidden);
|
|
1939
2271
|
e = e.toLowerCase();
|
|
1940
2272
|
let n = t.length;
|
|
1941
2273
|
for (let r = 0; r < n; r++) if (t[r].name.toLowerCase() === e) return r;
|
|
1942
2274
|
try {
|
|
1943
|
-
|
|
1944
|
-
let t = this._names.getItems(
|
|
2275
|
+
Mr.address = e;
|
|
2276
|
+
let t = this._names.getItems(Mr);
|
|
1945
2277
|
if (!t || t.length === 0) return -1;
|
|
1946
2278
|
let n = t[0].getRanges?.()?.getCoords()?.[0]?.scope;
|
|
1947
2279
|
if (!n) return -1;
|
|
1948
|
-
let r = this._getSheetRefs(
|
|
2280
|
+
let r = this._getSheetRefs(j.Visibility.VeryHidden);
|
|
1949
2281
|
n = n.toLowerCase();
|
|
1950
2282
|
let i = r.length;
|
|
1951
2283
|
for (let e = 0; e < i; e++) if (r[e].name.toLowerCase() === n) return e;
|
|
@@ -1954,16 +2286,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1954
2286
|
}
|
|
1955
2287
|
return -1;
|
|
1956
2288
|
},
|
|
1957
|
-
getSheetCount: () => i.getSheets().getItems({ visibility:
|
|
1958
|
-
getSheetIds: () => i._sheets?.getItems({ visibility: O.Visibility.VeryHidden }).map((e) => e.getId()) ?? [],
|
|
1959
|
-
addSheetsListener: (e, t) => i.addListeners({ onSheetsChange: () => {
|
|
1960
|
-
i._restoringSheets || e();
|
|
1961
|
-
} }, t),
|
|
1962
|
-
getSheetById: (e) => {
|
|
1963
|
-
let t = i.getSheets().getItems({ visibility: O.Visibility.VeryHidden }), n = t.length;
|
|
1964
|
-
for (let r = 0; r < n; r++) if (t[r].getId() === e) return t[r];
|
|
1965
|
-
return null;
|
|
1966
|
-
},
|
|
2289
|
+
getSheetCount: () => i.getSheets().getItems({ visibility: j.Visibility.VeryHidden }).length,
|
|
1967
2290
|
externalBooks: r?.externalBooks,
|
|
1968
2291
|
externalBookResolver: t.externalBookResolver,
|
|
1969
2292
|
namedCollection: i._names,
|
|
@@ -1971,18 +2294,20 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1971
2294
|
transactions: i._transactions,
|
|
1972
2295
|
names: r?.names
|
|
1973
2296
|
}), this._ownCalculation = !t.calculation, this._scripts = this._createScripts(r?.modules), this._ownNames = !t.names, this._options = Object.freeze({ ...t });
|
|
1974
|
-
let n =
|
|
2297
|
+
let n = r?.sheets?.length ? r.sheets.map((e) => e.name) : [this._createSheetName(0)], o = n.map((e) => e + "-" + P.uuidV4());
|
|
2298
|
+
this._calculation._setSheets(n.map((e, t) => [o[t], e]));
|
|
2299
|
+
let s = t.calcOnLoad ?? "auto", c = !1, l = (async () => {
|
|
1975
2300
|
try {
|
|
1976
|
-
if (this._ownCalculation &&
|
|
2301
|
+
if (this._ownCalculation && s !== "none" && (s === "full" || s === "auto" && !0 === r?.calc?.fullCalcOnLoad ? await this._calculation.calculate({ full: !0 }) : await this._calculation.start(), this._closed)) return;
|
|
1977
2302
|
await this._scripts.start();
|
|
1978
2303
|
} finally {
|
|
1979
|
-
|
|
2304
|
+
c = !0, this._starting = null;
|
|
1980
2305
|
}
|
|
1981
2306
|
})();
|
|
1982
|
-
|
|
2307
|
+
c || (this._starting = l), this._starting?.catch(() => {}), r ? this._fromJSON(r, o) : (this._initState(), this._addSheet(!1, n[0], null, o[0])), this._sheets = new yr((e) => i._addSheetOptions(e), (e, t) => {
|
|
1983
2308
|
if (e) {
|
|
1984
2309
|
let n = this._getSheetRef(e, t);
|
|
1985
|
-
return n ? [n.sheet] :
|
|
2310
|
+
return n ? [n.sheet] : P.EmptyArray;
|
|
1986
2311
|
}
|
|
1987
2312
|
return this._getSheets(t);
|
|
1988
2313
|
}, (e, t) => {
|
|
@@ -2005,22 +2330,14 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2005
2330
|
let e = this._getSheetRefs();
|
|
2006
2331
|
for (let t = (e ? e.length : 0) - 1; t >= 0; t--);
|
|
2007
2332
|
let t = this._options;
|
|
2008
|
-
this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new
|
|
2333
|
+
this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new C().getDefaultTheme(), this._styles = t?.styles ?? new ce(this._theme), this._ownStyles = !t.styles, this._styles.getTheme() || this._styles.setTheme(this.getTheme()), this._activeSheetOffset = 0, this.setView(new gr()), this._listenerProtection?.(), this._protection = new vr(void 0, this._options.readonly ?? !1), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
|
|
2009
2334
|
n._emitter.notify("onProtectionChange");
|
|
2010
2335
|
} });
|
|
2011
2336
|
let n = this;
|
|
2012
2337
|
this._transactionsRemoveListener = this._transactions.addStateListener(this._id, {
|
|
2013
2338
|
async onAfterStateChange(e, t, r, i, a) {
|
|
2014
|
-
let o = n._view, s = a?.[
|
|
2015
|
-
|
|
2016
|
-
n._restoringSheets = !0;
|
|
2017
|
-
try {
|
|
2018
|
-
n._emitter.notify("onSheetsChange");
|
|
2019
|
-
} finally {
|
|
2020
|
-
n._restoringSheets = !1;
|
|
2021
|
-
}
|
|
2022
|
-
}
|
|
2023
|
-
n._emitter.notify("onSelectedSheetChange"), n._emitter.notify("onViewChange");
|
|
2339
|
+
let o = n._view, s = a?.[Dr], c = r ? s?.before : s?.after, l = s?.viewId === o.getId() && c != null, u = l ? c : o.getActiveSheetId(), d = l && t.getId() === n._lastTransactionUUID ? n._getSheetRef({ id: u }) : null;
|
|
2340
|
+
d ? await d.sheet.select() : n._resyncActiveSheet(u, e), n._lastTransactionUUID = t.getId(), (r || i) && n._emitter.notify("onSheetsChange"), n._emitter.notify("onSelectedSheetChange"), n._emitter.notify("onViewChange");
|
|
2024
2341
|
},
|
|
2025
2342
|
onRestoreOrRevert() {
|
|
2026
2343
|
n._ownCalculation, n._emitter.notify("onInvalidated");
|
|
@@ -2074,8 +2391,8 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2074
2391
|
return this._view;
|
|
2075
2392
|
}
|
|
2076
2393
|
setView(e) {
|
|
2077
|
-
if (this._closed) throw Error(
|
|
2078
|
-
if (!e) throw new
|
|
2394
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2395
|
+
if (!e) throw new I(B("error.sheet.emptyView"));
|
|
2079
2396
|
this._listenerWorkbookView?.();
|
|
2080
2397
|
let t = this, n = -1;
|
|
2081
2398
|
return this._listenerWorkbookView = e.addListeners({ onViewChange: (e) => {
|
|
@@ -2087,7 +2404,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2087
2404
|
return this._runtime;
|
|
2088
2405
|
}
|
|
2089
2406
|
setDate1904(e) {
|
|
2090
|
-
if (this._closed) throw Error(
|
|
2407
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2091
2408
|
return this._isDate1904 === e || (this._isDate1904 = e, this._emitter.notify("onRegionalChange")), this;
|
|
2092
2409
|
}
|
|
2093
2410
|
getLocale() {
|
|
@@ -2097,11 +2414,11 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2097
2414
|
return this._locale;
|
|
2098
2415
|
}
|
|
2099
2416
|
setLocale(e) {
|
|
2100
|
-
if (this._closed) throw Error(
|
|
2417
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2101
2418
|
if (e) try {
|
|
2102
2419
|
new Intl.Locale(e);
|
|
2103
2420
|
} catch {
|
|
2104
|
-
throw Error(
|
|
2421
|
+
throw Error(B("error.workbook.invalidLocale", { locale: e }));
|
|
2105
2422
|
}
|
|
2106
2423
|
return this._locale === e || (this._locale = e, this._emitter.notify("onRegionalChange")), this;
|
|
2107
2424
|
}
|
|
@@ -2109,7 +2426,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2109
2426
|
return this._localeOverrides;
|
|
2110
2427
|
}
|
|
2111
2428
|
setLocaleOverrides(e) {
|
|
2112
|
-
if (this._closed) throw Error(
|
|
2429
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2113
2430
|
let t = e && Object.keys(e).length > 0 ? e : null;
|
|
2114
2431
|
return this._localeOverrides = t, this._emitter.notify("onRegionalChange"), this;
|
|
2115
2432
|
}
|
|
@@ -2132,7 +2449,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2132
2449
|
return this._updateLinks;
|
|
2133
2450
|
}
|
|
2134
2451
|
setUpdateLinks(e) {
|
|
2135
|
-
if (this._closed) throw Error(
|
|
2452
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2136
2453
|
return this._updateLinks = e, this;
|
|
2137
2454
|
}
|
|
2138
2455
|
getPivotTables() {
|
|
@@ -2148,8 +2465,8 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2148
2465
|
return this._theme;
|
|
2149
2466
|
}
|
|
2150
2467
|
setTheme(e) {
|
|
2151
|
-
if (this._closed) throw Error(
|
|
2152
|
-
if (!e) throw new
|
|
2468
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2469
|
+
if (!e) throw new I(B("error.workbook.notSetValue"));
|
|
2153
2470
|
let t = this._theme;
|
|
2154
2471
|
return this._theme = e, this.getStyles().setTheme(e), this._emitter.notify("onThemeChange"), t;
|
|
2155
2472
|
}
|
|
@@ -2160,17 +2477,17 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2160
2477
|
let e = this._getSheetRef(this.getSelectedSheetIndex());
|
|
2161
2478
|
return e ? e?.sheet : null;
|
|
2162
2479
|
}
|
|
2163
|
-
getSheet(e, t =
|
|
2480
|
+
getSheet(e, t = j.Visibility.Visible) {
|
|
2164
2481
|
if (e === void 0) return this.getSelectedSheet();
|
|
2165
|
-
if (!e) throw Error(
|
|
2482
|
+
if (!e) throw Error(B("error.workbook.sheetNameNotProvided"));
|
|
2166
2483
|
let n = this._getSheetRef(e, t);
|
|
2167
|
-
if (!n) throw new
|
|
2484
|
+
if (!n) throw new L(B("error.workbook.sheetNameNotFound", { sheetName: e }));
|
|
2168
2485
|
return n.sheet;
|
|
2169
2486
|
}
|
|
2170
|
-
getSheetAt(e, t =
|
|
2487
|
+
getSheetAt(e, t = j.Visibility.Visible) {
|
|
2171
2488
|
let n = this._getSheetRef(e, t);
|
|
2172
|
-
if (!n) throw new
|
|
2173
|
-
return
|
|
2489
|
+
if (!n) throw new L(function(e) {
|
|
2490
|
+
return B("error.workbook.sheetIndexNotFound", { index: e });
|
|
2174
2491
|
}(e));
|
|
2175
2492
|
return n.sheet;
|
|
2176
2493
|
}
|
|
@@ -2180,32 +2497,32 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2180
2497
|
addSheet(e) {
|
|
2181
2498
|
return this.getSheets().add(e);
|
|
2182
2499
|
}
|
|
2183
|
-
_getSheets(e =
|
|
2500
|
+
_getSheets(e = j.Visibility.Visible) {
|
|
2184
2501
|
let t = this._getSheetRefs(e), n = [], r = t.length;
|
|
2185
2502
|
for (let e = 0; e < r; e++) n.push(t[e].sheet);
|
|
2186
2503
|
return n;
|
|
2187
2504
|
}
|
|
2188
|
-
_getSheetRefs(e =
|
|
2505
|
+
_getSheetRefs(e = j.Visibility.Visible) {
|
|
2189
2506
|
let t = this._getState();
|
|
2190
|
-
return t ? e ===
|
|
2507
|
+
return t ? e === j.Visibility.Visible ? t.sheetRefsVisible : e === j.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === j.Visibility.VeryHidden ? t.sheetRefsAll : P.EmptyArray : [];
|
|
2191
2508
|
}
|
|
2192
|
-
_getSheetRef(e, t =
|
|
2509
|
+
_getSheetRef(e, t = j.Visibility.Visible) {
|
|
2193
2510
|
let n = null;
|
|
2194
2511
|
return typeof e == "number" ? this._getSheetRefs(t)[e] : (typeof e == "string" ? n = this._getState().refsByLowerCaseName.get(e.toLowerCase()) : e instanceof M ? n = this._getState().refsByInstance.get(e) : e?.id !== void 0 && (n = this._getState().refsById.get(e.id)), n);
|
|
2195
2512
|
}
|
|
2196
2513
|
_validateNewSheetName(e, t = !0) {
|
|
2197
2514
|
if (e == null) return e;
|
|
2198
|
-
if (
|
|
2515
|
+
if (wr(e), t && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new I(B("error.workbook.nameTaken"));
|
|
2199
2516
|
return e.substring(0, 31);
|
|
2200
2517
|
}
|
|
2201
2518
|
findValidSheetName(e) {
|
|
2202
|
-
e &&=
|
|
2519
|
+
e &&= wr(e, !0);
|
|
2203
2520
|
try {
|
|
2204
2521
|
return function(e, t) {
|
|
2205
2522
|
try {
|
|
2206
2523
|
if (t(e)) return e;
|
|
2207
2524
|
} catch {}
|
|
2208
|
-
let n, r, i =
|
|
2525
|
+
let n, r, i = xr.exec(e);
|
|
2209
2526
|
for (i === null ? (n = e + " ", r = 1) : (n = e.substring(0, i.index), r = parseFloat(i[1])); r < 256;) {
|
|
2210
2527
|
r++;
|
|
2211
2528
|
let e = "(" + r + ")", i = n.substring(0, 31 - e.length) + e;
|
|
@@ -2220,25 +2537,25 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2220
2537
|
}
|
|
2221
2538
|
}
|
|
2222
2539
|
isValidSheetNameCharacter(e) {
|
|
2223
|
-
return !
|
|
2540
|
+
return !br.test(e);
|
|
2224
2541
|
}
|
|
2225
2542
|
_isStructureProtected() {
|
|
2226
2543
|
return !this._initializing && !this.getProtection().isStructureAllowed();
|
|
2227
2544
|
}
|
|
2228
2545
|
_addSheetOptions(e) {
|
|
2229
|
-
if (this._closed) throw Error(
|
|
2230
|
-
if (!this.getProtection().isStructureAllowed()) throw new B(
|
|
2546
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2547
|
+
if (!this.getProtection().isStructureAllowed()) throw new R(B("error.workbook.protection"));
|
|
2231
2548
|
let t, n = null;
|
|
2232
2549
|
t = typeof e == "string" ? { name: e } : typeof e == "number" ? { index: e } : e, t = {
|
|
2233
2550
|
...t,
|
|
2234
|
-
description: t?.description ??
|
|
2551
|
+
description: t?.description ?? z("op.addSheet")
|
|
2235
2552
|
};
|
|
2236
2553
|
let r = this.beginCommit(t);
|
|
2237
2554
|
try {
|
|
2238
2555
|
let e = t?.autoSelect ?? !1;
|
|
2239
2556
|
n = this._addSheet(!0, t.name, t.index ?? null);
|
|
2240
2557
|
let i = this.getView().getActiveSheetId();
|
|
2241
|
-
if (e && this._recordActiveSheet(r, i, this._getSheetRef(n).id), r.commit({ description:
|
|
2558
|
+
if (e && this._recordActiveSheet(r, i, this._getSheetRef(n).id), r.commit({ description: B("op.addSheetNamed", { name: n.getName() }) }), !1 !== e) {
|
|
2242
2559
|
let t = typeof e == "boolean" ? void 0 : e;
|
|
2243
2560
|
n.select(t);
|
|
2244
2561
|
}
|
|
@@ -2249,8 +2566,8 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2249
2566
|
}
|
|
2250
2567
|
_nextSheetName(e = null) {
|
|
2251
2568
|
let t = e ? e.toLowerCase() : null, n = this._getState(), r = n.sheetsByLowerCaseName;
|
|
2252
|
-
if (e && r.has(t)) throw new
|
|
2253
|
-
return
|
|
2569
|
+
if (e && r.has(t)) throw new I(function(e) {
|
|
2570
|
+
return B("error.workbook.nameDuplicate", { sheetName: e });
|
|
2254
2571
|
}(e));
|
|
2255
2572
|
t = (e = this._validateNewSheetName(e)) ? e.toLowerCase() : null;
|
|
2256
2573
|
let i = n.lastId + 1;
|
|
@@ -2260,23 +2577,28 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2260
2577
|
}
|
|
2261
2578
|
return this._updateState({ lastId: i }), e;
|
|
2262
2579
|
}
|
|
2263
|
-
_addSheet(e, t = null, n = null) {
|
|
2580
|
+
_addSheet(e, t = null, n = null, r) {
|
|
2264
2581
|
t = this._nextSheetName(t);
|
|
2265
|
-
let
|
|
2266
|
-
if (!
|
|
2267
|
-
return e && this._emitter.notify("onSheetsChange"),
|
|
2582
|
+
let i = this._getState(), a = this._createSheet(i.lastId, t, j.Visibility.Visible, n, void 0, null, r);
|
|
2583
|
+
if (!a) throw new I(B("error.workbook.sheetNameBlank"));
|
|
2584
|
+
return e && (this._tellSheets(), this._emitter.notify("onSheetsChange")), a;
|
|
2268
2585
|
}
|
|
2269
2586
|
_updateSheetRefStates(e) {
|
|
2270
|
-
if (this._closed) throw Error(
|
|
2271
|
-
if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new B(
|
|
2587
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2588
|
+
if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new R(B("error.workbook.protection"));
|
|
2272
2589
|
let t = e, n = [], r = [], i = t.length;
|
|
2273
|
-
for (let e = 0; e < i; e++) t[e].visibility ===
|
|
2590
|
+
for (let e = 0; e < i; e++) t[e].visibility === j.Visibility.Visible ? (n.push(t[e]), r.push(t[e])) : t[e].visibility === j.Visibility.Hidden && r.push(t[e]);
|
|
2274
2591
|
this._updateState({
|
|
2275
2592
|
sheetRefsAll: t,
|
|
2276
2593
|
sheetRefsVisible: n,
|
|
2277
2594
|
sheetRefsVisibleAndHidden: r
|
|
2278
2595
|
});
|
|
2279
2596
|
}
|
|
2597
|
+
_tellSheets() {
|
|
2598
|
+
if (this._isLoadingSheets) return;
|
|
2599
|
+
let e = this._getState().sheetRefsAll;
|
|
2600
|
+
this._calculation._setSheets(e.map((e) => [e.sheet.getId(), e.name]));
|
|
2601
|
+
}
|
|
2280
2602
|
_addSheetRef(e, t = null) {
|
|
2281
2603
|
let n = this._getState(), r = n.sheetRefsAll, i = Math.max(0, Math.min(r.length, t ?? r.length)), a = [
|
|
2282
2604
|
...r.slice(0, i),
|
|
@@ -2301,9 +2623,9 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2301
2623
|
p._validateDeleteSheet(e);
|
|
2302
2624
|
},
|
|
2303
2625
|
onDelete(e) {
|
|
2304
|
-
let t = p._getSheetRef(e,
|
|
2626
|
+
let t = p._getSheetRef(e, j.Visibility.VeryHidden);
|
|
2305
2627
|
if (!t) return;
|
|
2306
|
-
let n = p._beginCommit({ description:
|
|
2628
|
+
let n = p._beginCommit({ description: B("op.deleteSheet", { name: t.name }) });
|
|
2307
2629
|
try {
|
|
2308
2630
|
let r = p._getState(), i = r.sheetRefsAll, a = p._getOffsetForId(t.id, i), s = [...i];
|
|
2309
2631
|
s.splice(a, 1), p._updateSheetRefStates(s);
|
|
@@ -2318,7 +2640,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2318
2640
|
let m = new Map(r.refsByInstance);
|
|
2319
2641
|
m.delete(e), r.listenersSheets.get(t.id)();
|
|
2320
2642
|
let h = new Map(r.listenersSheets);
|
|
2321
|
-
h.delete(t.id), p._adjustRemoveSelectionIfRequired(a, t.id), p._adjustSheetNamesIfRequired(), p._sheetOnNameChange.delete(t.id), p._sheetOnVisibilityChange.delete(t.id), p._sheetOnIndexChange.delete(t.id), p._emitter.notify("onSheetsChange");
|
|
2643
|
+
h.delete(t.id), p._adjustRemoveSelectionIfRequired(a, t.id), p._adjustSheetNamesIfRequired(), p._sheetOnNameChange.delete(t.id), p._sheetOnVisibilityChange.delete(t.id), p._sheetOnIndexChange.delete(t.id), p._tellSheets(), p._emitter.notify("onSheetsChange");
|
|
2322
2644
|
let g = new Set(r.sheetsCreated);
|
|
2323
2645
|
g.has(o) && g.delete(o), p._updateState({
|
|
2324
2646
|
refsById: c,
|
|
@@ -2353,11 +2675,11 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2353
2675
|
listenersSheets: m
|
|
2354
2676
|
}), this._adjustSheetNamesIfRequired();
|
|
2355
2677
|
let g = new Set(this._getState().sheetsCreated);
|
|
2356
|
-
return g.add(e.sheet), this._updateState({ sheetsCreated: g }), e;
|
|
2678
|
+
return g.add(e.sheet), this._updateState({ sheetsCreated: g }), this._tellSheets(), e;
|
|
2357
2679
|
}
|
|
2358
2680
|
_recordActiveSheet(e, t, n) {
|
|
2359
2681
|
let r = this.getView().getId();
|
|
2360
|
-
e.setIntent(
|
|
2682
|
+
e.setIntent(Dr, (e) => ({
|
|
2361
2683
|
viewId: r,
|
|
2362
2684
|
before: e?.before ?? t,
|
|
2363
2685
|
after: n
|
|
@@ -2387,25 +2709,25 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2387
2709
|
let n = this._view.getActiveSheetId();
|
|
2388
2710
|
n ??= (this._view.setActiveSheetId(t), t);
|
|
2389
2711
|
let r = e.refsById.get(n);
|
|
2390
|
-
r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), n = t), r.visibility ===
|
|
2712
|
+
r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), n = t), r.visibility === j.Visibility.Visible && (this._activeSheetOffset = this._getOffsetForId(n, e.sheetRefsVisible));
|
|
2391
2713
|
}
|
|
2392
2714
|
_validateDeleteSheet(e) {
|
|
2393
|
-
if (this._closed) throw Error(
|
|
2394
|
-
if (!this.getProtection().isStructureAllowed()) throw new B(
|
|
2715
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2716
|
+
if (!this.getProtection().isStructureAllowed()) throw new R(B("error.workbook.protection"));
|
|
2395
2717
|
let t = this._getSheetRef(e);
|
|
2396
|
-
if (!t) throw new
|
|
2397
|
-
return
|
|
2718
|
+
if (!t) throw new I(function(e) {
|
|
2719
|
+
return B("error.workbook.deleteKey", { key: e });
|
|
2398
2720
|
}(e));
|
|
2399
2721
|
let n = this._getState().sheetRefsVisible;
|
|
2400
|
-
if (n.length === 1 && n[0].id === t.id) throw new
|
|
2722
|
+
if (n.length === 1 && n[0].id === t.id) throw new I(B("error.workbook.sheetOne"));
|
|
2401
2723
|
}
|
|
2402
2724
|
_getOffsetForId(e, t) {
|
|
2403
2725
|
let n = t.length;
|
|
2404
2726
|
for (let r = 0; r < n; r++) if (t[r].id === e) return r;
|
|
2405
|
-
throw new
|
|
2727
|
+
throw new I(B("error.workbook.noVisibleRefs"));
|
|
2406
2728
|
}
|
|
2407
2729
|
find(e) {
|
|
2408
|
-
if (this._closed) throw Error(
|
|
2730
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2409
2731
|
let t = this._getSheets();
|
|
2410
2732
|
if (t.length === 1) return t[0].find(e);
|
|
2411
2733
|
typeof e == "string" && (e = { text: e });
|
|
@@ -2422,7 +2744,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2422
2744
|
rowIndex: t[0].rowStart
|
|
2423
2745
|
};
|
|
2424
2746
|
}
|
|
2425
|
-
let f =
|
|
2747
|
+
let f = F.createCellComparator(e?.axis, e?.reverse);
|
|
2426
2748
|
delete (e = { ...e }).from;
|
|
2427
2749
|
let p = () => {
|
|
2428
2750
|
if (!d && u.done && (s && a === i ? d = !0 : n ? (a++, a > t.length - 1 && (a = 0, s = !0)) : (a--, a < 0 && (a = t.length - 1, s = !0)), r && s && (d = !0), d || c || !s || a !== i || (d = !0), !d)) {
|
|
@@ -2432,7 +2754,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2432
2754
|
}
|
|
2433
2755
|
if (!d && s && a === i && (u.done || !c || !u.done && f(u.value.getCoords(), c) >= 0) && (d = !0), d) {
|
|
2434
2756
|
let e = u;
|
|
2435
|
-
return u =
|
|
2757
|
+
return u = Ie, e;
|
|
2436
2758
|
}
|
|
2437
2759
|
let p = u;
|
|
2438
2760
|
return u = l.next(), p;
|
|
@@ -2444,24 +2766,24 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2444
2766
|
} };
|
|
2445
2767
|
}
|
|
2446
2768
|
replace(e, t, n) {
|
|
2447
|
-
let r = 0, i = null, a = typeof t == "function", o = n?.maxCount ?? 2 ** 53 - 1, s = !n?.maxCount, c = "", l = typeof t == "string" ?
|
|
2769
|
+
let r = 0, i = null, a = typeof t == "function", o = n?.maxCount ?? 2 ** 53 - 1, s = !n?.maxCount, c = "", l = typeof t == "string" ? nt(t) : null, u = n?.description ?? z("op.replace"), d = this._transactions.beginCommit({ description: u });
|
|
2448
2770
|
try {
|
|
2449
|
-
let u = null,
|
|
2771
|
+
let u = null, f = null, p = e.next();
|
|
2450
2772
|
for (; !p.done && r < o;) {
|
|
2451
2773
|
let o = p.value, s = o.getSheet();
|
|
2452
|
-
s !== u && (u = s,
|
|
2774
|
+
s !== u && (u = s, f !== null && f.apply(), f = u.getEntireRange().createSparseBuilder({
|
|
2453
2775
|
axis: n?.axis,
|
|
2454
2776
|
allowUnorderedWrites: !0
|
|
2455
2777
|
}));
|
|
2456
2778
|
let c = a ? t(o) : t;
|
|
2457
|
-
c !== void 0 && c !== o && (
|
|
2779
|
+
c !== void 0 && c !== o && (f.push(o, c), r++, i = o), p = e.next();
|
|
2458
2780
|
}
|
|
2459
|
-
|
|
2781
|
+
f?.apply(), r === 1 && o === 1 && i && (c = i.getAddress()), r === 0 ? d.rollback() : d.commit({ description: n?.description ?? (s ? l === null ? z("op.replaceAll") : B("op.replaceAllWith", { value: l }) : c ? l === null ? B("op.replaceAt", { address: c }) : B("op.replaceAtWith", {
|
|
2460
2782
|
address: c,
|
|
2461
2783
|
value: l
|
|
2462
|
-
}) : l === null ?
|
|
2784
|
+
}) : l === null ? z("op.replace") : B("op.replaceWith", { value: l })) });
|
|
2463
2785
|
} catch (e) {
|
|
2464
|
-
throw
|
|
2786
|
+
throw d.rollback(), e;
|
|
2465
2787
|
}
|
|
2466
2788
|
return {
|
|
2467
2789
|
count: r,
|
|
@@ -2477,27 +2799,27 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2477
2799
|
return n === 1 ? 0 : (e === void 0 && (e = this.getSelectedSheetIndex()), (e = Math.max(0, Math.min(e, n - 1))) <= 0 ? n - 1 : e - 1);
|
|
2478
2800
|
}
|
|
2479
2801
|
getNextSheet(e) {
|
|
2480
|
-
if (this._closed) throw Error(
|
|
2802
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2481
2803
|
let t = this._getSheetRefs();
|
|
2482
2804
|
return t[this._nextSheetIndex(e, t)]?.sheet ?? null;
|
|
2483
2805
|
}
|
|
2484
2806
|
getPreviousSheet(e) {
|
|
2485
|
-
if (this._closed) throw Error(
|
|
2807
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2486
2808
|
let t = this._getSheetRefs();
|
|
2487
2809
|
return t[this._prevSheetIndex(e, t)]?.sheet ?? null;
|
|
2488
2810
|
}
|
|
2489
2811
|
async _duplicateSheet(e) {
|
|
2490
|
-
if (this._closed) throw Error(
|
|
2491
|
-
if (!this.getProtection().isStructureAllowed()) throw new B(
|
|
2812
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2813
|
+
if (!this.getProtection().isStructureAllowed()) throw new R(B("error.workbook.protection"));
|
|
2492
2814
|
let t = this._getSheetRefs(), n = this.getSelectedSheetIndex(), r = null;
|
|
2493
2815
|
if (e) {
|
|
2494
|
-
if (r = this._getSheetRef(e), !r) throw new
|
|
2816
|
+
if (r = this._getSheetRef(e), !r) throw new I(Z(r));
|
|
2495
2817
|
} else r = t[n];
|
|
2496
2818
|
if (!r) return null;
|
|
2497
|
-
let i = r.sheet, a = this._strings.beginPersist(), o = this.getResources().beginPersist(), s = this.getStyles().beginPersist(), c = null, l = this.beginCommit(
|
|
2819
|
+
let i = r.sheet, a = this._strings.beginPersist(), o = this.getResources().beginPersist(), s = this.getStyles().beginPersist(), c = null, l = this.beginCommit(B("op.duplicateNamed", { name: i.getName() }));
|
|
2498
2820
|
try {
|
|
2499
2821
|
let e = this._getState().refsByInstance.get(i), r = await i.toJSON(), a = t.length + 1, o = this.findValidSheetName(e.name), s = this._createSheet(a, o, e.visibility, n, void 0, r);
|
|
2500
|
-
this._emitter.notify("onSheetsChange"), c = s, l.commit();
|
|
2822
|
+
this._tellSheets(), this._emitter.notify("onSheetsChange"), c = s, l.commit();
|
|
2501
2823
|
} catch (e) {
|
|
2502
2824
|
throw l.rollback(), e;
|
|
2503
2825
|
} finally {
|
|
@@ -2505,59 +2827,59 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2505
2827
|
}
|
|
2506
2828
|
return c;
|
|
2507
2829
|
}
|
|
2508
|
-
_createRange(e,
|
|
2509
|
-
let
|
|
2510
|
-
if (!
|
|
2830
|
+
_createRange(e, t) {
|
|
2831
|
+
let n = e ? { ...e } : null, r = n ? this._getSheetRef(n.scope, j.Visibility.VeryHidden) : null;
|
|
2832
|
+
if (!r) {
|
|
2511
2833
|
let e = this.getSelectedSheet();
|
|
2512
|
-
return e ? (delete
|
|
2513
|
-
scope:
|
|
2834
|
+
return e ? (delete n?.scope, Cr(n, n ? {
|
|
2835
|
+
scope: Ct,
|
|
2514
2836
|
...e.getEntireRange().getCoords()
|
|
2515
|
-
} : null)) : void console.warn(
|
|
2837
|
+
} : null)) : void console.warn(B("error.workbook.noVisibleRefs"));
|
|
2516
2838
|
}
|
|
2517
|
-
let
|
|
2518
|
-
return
|
|
2839
|
+
let i = r.sheet, a = null;
|
|
2840
|
+
return t && (a = { getOptions: t }), new kr(e, E(i), this, a);
|
|
2519
2841
|
}
|
|
2520
2842
|
_createRanges(e, t) {
|
|
2521
2843
|
let n = this.getSelectedSheet(), r = null;
|
|
2522
|
-
return t && (r = { getOptions: t }), new
|
|
2844
|
+
return t && (r = { getOptions: t }), new Or(e, E(n), this, r);
|
|
2523
2845
|
}
|
|
2524
2846
|
getRange(e, t) {
|
|
2525
2847
|
if (e === void 0) return this.getSelectedRange(t);
|
|
2526
2848
|
try {
|
|
2527
2849
|
let n = this._rangesAddressToCoords(e);
|
|
2528
|
-
if (n.length !== 1) throw new
|
|
2850
|
+
if (n.length !== 1) throw new I(B("error.address.singleRangeOnlyAlt"));
|
|
2529
2851
|
return this._createRange(n[0], t);
|
|
2530
2852
|
} catch (t) {
|
|
2531
|
-
throw t instanceof
|
|
2853
|
+
throw t instanceof L ? new L(t.message) : new I(t.message ?? et(e));
|
|
2532
2854
|
}
|
|
2533
2855
|
}
|
|
2534
2856
|
getCell(e) {
|
|
2535
2857
|
if (e === void 0) return this.getSelectedCell();
|
|
2536
2858
|
let t = this.getRange(e);
|
|
2537
|
-
if (t.size > 1) throw new
|
|
2859
|
+
if (t.size > 1) throw new I(B("error.address.singleCellOnly"));
|
|
2538
2860
|
return t.getCell();
|
|
2539
2861
|
}
|
|
2540
2862
|
getRanges(e, t) {
|
|
2541
2863
|
let n = this._rangesAddressToCoords(e);
|
|
2542
|
-
if (n.length === 0) throw new
|
|
2864
|
+
if (n.length === 0) throw new I(et(e));
|
|
2543
2865
|
return this._createRanges(n, t);
|
|
2544
2866
|
}
|
|
2545
2867
|
_createGraphRanges(e, t) {
|
|
2546
2868
|
let n = [], r = this.getCalculation()?.getNamedFormulas() ?? null;
|
|
2547
2869
|
for (let e = 0; e < t.length; e++) {
|
|
2548
|
-
let i = t[e], a = (i.sheetName ? this._getSheetRef(i.sheetName,
|
|
2549
|
-
a && n.push(new
|
|
2870
|
+
let i = t[e], a = (i.sheetName ? this._getSheetRef(i.sheetName, j.Visibility.VeryHidden) : null)?.sheet ?? this.getSelectedSheet();
|
|
2871
|
+
a && n.push(new Ae(i, r, E(a), null));
|
|
2550
2872
|
}
|
|
2551
2873
|
for (let t = 0; t < e.length; t++) n.push(e[t]);
|
|
2552
|
-
return n.length === 0 ? null : new
|
|
2874
|
+
return n.length === 0 ? null : new Or(n, E(this.getSelectedSheet()), this, null);
|
|
2553
2875
|
}
|
|
2554
2876
|
getStats(e) {
|
|
2555
|
-
if (this._closed) throw Error(
|
|
2556
|
-
let t = this._getSheets(
|
|
2877
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2878
|
+
let t = this._getSheets(j.Visibility.VeryHidden), n = t.length;
|
|
2557
2879
|
if (n === 1) return t[0].getStats(e);
|
|
2558
2880
|
let r = Array(n);
|
|
2559
2881
|
for (let i = 0; i < n; i++) r[i] = t[i].getStats(e);
|
|
2560
|
-
return new
|
|
2882
|
+
return new ar(r);
|
|
2561
2883
|
}
|
|
2562
2884
|
_activeRangeCoords() {
|
|
2563
2885
|
let e = this.getSelectedSheet(), t = e.getSelection().getRanges().getCoords(), n = e.getName(), r = t.length, i = Array(r);
|
|
@@ -2582,8 +2904,8 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2582
2904
|
getSelectedCell() {
|
|
2583
2905
|
return this.getSelectedSheet().getSelectedCell();
|
|
2584
2906
|
}
|
|
2585
|
-
_rangesAddressToCoords(e, t = !0, n =
|
|
2586
|
-
if (!e) throw new
|
|
2907
|
+
_rangesAddressToCoords(e, t = !0, n = j.Visibility.Hidden) {
|
|
2908
|
+
if (!e) throw new I(B("error.address.noAddress"));
|
|
2587
2909
|
let r = this.getSelectedSheet(), i = { ...r?.getEntireRange().getCoords() }, a = r?.getName();
|
|
2588
2910
|
if (a && (i.scope = a), typeof e == "string") {
|
|
2589
2911
|
let t = e.trim().toLowerCase();
|
|
@@ -2592,22 +2914,22 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2592
2914
|
t === "r" ? r.rowStart = r.rowEnd = n.rowIndex : r.colStart = r.colEnd = n.colIndex, e = r;
|
|
2593
2915
|
}
|
|
2594
2916
|
}
|
|
2595
|
-
let o = this, s =
|
|
2917
|
+
let o = this, s = Ze(e, i, ft, (e) => {
|
|
2596
2918
|
if (!t) return null;
|
|
2597
2919
|
if (typeof e == "string") {
|
|
2598
2920
|
let t = o.getNames().getByName(e)?.getRanges?.();
|
|
2599
2921
|
if (t) return t.getCoords();
|
|
2600
2922
|
}
|
|
2601
|
-
throw new
|
|
2923
|
+
throw new I(`Invalid sheet reference '${e}'.`);
|
|
2602
2924
|
}), c = s.length;
|
|
2603
2925
|
for (let e = 0; e < c; e++) this._validateCoords(s[e], n);
|
|
2604
2926
|
return s;
|
|
2605
2927
|
}
|
|
2606
|
-
_validateCoords(e, t =
|
|
2928
|
+
_validateCoords(e, t = j.Visibility.Visible, n = B("error.sheet.oobRange")) {
|
|
2607
2929
|
if (e === null) return;
|
|
2608
2930
|
let r = this.getSheet(e.scope, t).getEntireRange().getCoords();
|
|
2609
|
-
if (!
|
|
2610
|
-
if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new
|
|
2931
|
+
if (!F.isRangeWithinRange(e, r)) throw new L(n);
|
|
2932
|
+
if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new I(B("error.address.invalidRangeInverted"));
|
|
2611
2933
|
}
|
|
2612
2934
|
_updateSheetRef(e, t) {
|
|
2613
2935
|
let n = this._getState(), r = [...n.sheetRefsAll];
|
|
@@ -2624,19 +2946,19 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2624
2946
|
refsByLowerCaseName: s,
|
|
2625
2947
|
sheetsByLowerCaseName: c,
|
|
2626
2948
|
refsByInstance: u
|
|
2627
|
-
}), t;
|
|
2949
|
+
}), this._tellSheets(), t;
|
|
2628
2950
|
}
|
|
2629
2951
|
_setSheetName(e, t, n) {
|
|
2630
|
-
if (this._closed) throw Error(
|
|
2631
|
-
if (!this.getProtection().isStructureAllowed()) throw new B(
|
|
2952
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2953
|
+
if (!this.getProtection().isStructureAllowed()) throw new R(B("error.workbook.protection"));
|
|
2632
2954
|
let r = this._getSheetRef(e);
|
|
2633
|
-
if (!r) throw new
|
|
2955
|
+
if (!r) throw new I(Z(e));
|
|
2634
2956
|
if (t === r.name) return r.sheet;
|
|
2635
|
-
if ((t = this._validateNewSheetName(t)) == null) throw new
|
|
2957
|
+
if ((t = this._validateNewSheetName(t)) == null) throw new I(B("error.workbook.sheetNameNotProvided"));
|
|
2636
2958
|
let i = Object.freeze({
|
|
2637
2959
|
...r,
|
|
2638
2960
|
name: t
|
|
2639
|
-
}), a = null, o = this.beginCommit(
|
|
2961
|
+
}), a = null, o = this.beginCommit(z("op.renameSheet"));
|
|
2640
2962
|
try {
|
|
2641
2963
|
let e = this._updateSheetRef(r, i);
|
|
2642
2964
|
this._adjustSheetNamesIfRequired(), this._sheetOnNameChange.forEach((e, t) => {
|
|
@@ -2647,23 +2969,23 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2647
2969
|
}
|
|
2648
2970
|
return a;
|
|
2649
2971
|
}
|
|
2650
|
-
_setSheetVisibility(e, t =
|
|
2651
|
-
if (this._closed) throw Error(
|
|
2652
|
-
if (!this.getProtection().isStructureAllowed()) throw new B(
|
|
2653
|
-
let r = this._getSheetRef(e,
|
|
2972
|
+
_setSheetVisibility(e, t = j.Visibility.Visible, n) {
|
|
2973
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2974
|
+
if (!this.getProtection().isStructureAllowed()) throw new R(B("error.workbook.protection"));
|
|
2975
|
+
let r = this._getSheetRef(e, j.Visibility.VeryHidden);
|
|
2654
2976
|
if (!r) return null;
|
|
2655
2977
|
if (t === r.visibility) return;
|
|
2656
2978
|
let i = null, a = "";
|
|
2657
|
-
t ===
|
|
2979
|
+
t === j.Visibility.Visible ? a = z("op.unhideSheet") : t === j.Visibility.Hidden ? a = z("op.hideSheet") : t === j.Visibility.VeryHidden && (a = z("op.veryHideSheet"));
|
|
2658
2980
|
let o = this.beginCommit(a);
|
|
2659
2981
|
try {
|
|
2660
2982
|
let e = this._getState().sheetRefsVisible;
|
|
2661
|
-
if (t !==
|
|
2983
|
+
if (t !== j.Visibility.Visible && e.length === 1 && e[0].id === r.id) throw new I(B("error.workbook.sheetOne"));
|
|
2662
2984
|
let a = {
|
|
2663
2985
|
...r,
|
|
2664
2986
|
visibility: t
|
|
2665
2987
|
}, s = -1;
|
|
2666
|
-
t !==
|
|
2988
|
+
t !== j.Visibility.Visible && (s = this._getOffsetForId(r.id, e)), i = this._updateSheetRef(r, a).sheet, t !== j.Visibility.Visible && this._adjustRemoveSelectionIfRequired(s, r.id), this._adjustSheetNamesIfRequired(), o.commit(n);
|
|
2667
2989
|
} catch (e) {
|
|
2668
2990
|
throw o.rollback(), e;
|
|
2669
2991
|
}
|
|
@@ -2672,29 +2994,29 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2672
2994
|
}), this._emitter.notify("onSheetsChange"), i;
|
|
2673
2995
|
}
|
|
2674
2996
|
_moveSheet(e, t, n) {
|
|
2675
|
-
if (this._closed) throw Error(
|
|
2676
|
-
if (!this.getProtection().isStructureAllowed()) throw new B(
|
|
2677
|
-
let r = null, i = this.beginCommit(
|
|
2997
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2998
|
+
if (!this.getProtection().isStructureAllowed()) throw new R(B("error.workbook.protection"));
|
|
2999
|
+
let r = null, i = this.beginCommit(B("op.moveSheetNamed", { name: e.name }));
|
|
2678
3000
|
try {
|
|
2679
3001
|
let a = this._getState(), o = a.sheetRefsVisible;
|
|
2680
|
-
if (t < 0 || t > o.length - 1) throw new
|
|
3002
|
+
if (t < 0 || t > o.length - 1) throw new I(`Invalid to index: ${t}`);
|
|
2681
3003
|
let s = this.getView().getActiveSheetId(), c = a.sheetRefsAll, l = this._getOffsetForId(e.id, c), u = this._getOffsetForId(o[t].id, c);
|
|
2682
3004
|
if (l === u) return;
|
|
2683
3005
|
let d = c[l], f = [...c];
|
|
2684
3006
|
f.splice(l, 1), f.splice(u, 0, d), this._updateSheetRefStates(f), this._calculation._replaceSheetSpans?.(c.map((e) => e.sheet.getId()), f.map((e) => e.sheet.getId()), d.sheet.getId()), this._adjustSheetNamesIfRequired(), this._sheetOnIndexChange.forEach((e, t) => {
|
|
2685
3007
|
t >= l && t <= u && e();
|
|
2686
|
-
}), this._emitter.notify("onSheetsChange"), r = d.sheet, this._recordActiveSheet(i, s, this.getView().getActiveSheetId()), i.commit(n);
|
|
3008
|
+
}), this._tellSheets(), this._emitter.notify("onSheetsChange"), r = d.sheet, this._recordActiveSheet(i, s, this.getView().getActiveSheetId()), i.commit(n);
|
|
2687
3009
|
} catch (e) {
|
|
2688
3010
|
throw i.rollback(), e;
|
|
2689
3011
|
}
|
|
2690
3012
|
return r;
|
|
2691
3013
|
}
|
|
2692
3014
|
_setSelectedSheet(e) {
|
|
2693
|
-
if (this._closed) throw Error(
|
|
3015
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2694
3016
|
let t = this._getSheetRef(e);
|
|
2695
|
-
if (!t) throw new
|
|
3017
|
+
if (!t) throw new I(Z(e));
|
|
2696
3018
|
let n = null;
|
|
2697
|
-
return t.visibility !==
|
|
3019
|
+
return t.visibility !== j.Visibility.Visible && this._setSheetVisibility(t, j.Visibility.Visible), this._view.setActiveSheetId(t.id), n = t.sheet, n;
|
|
2698
3020
|
}
|
|
2699
3021
|
getProtection() {
|
|
2700
3022
|
return this._protection;
|
|
@@ -2768,63 +3090,63 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2768
3090
|
});
|
|
2769
3091
|
};
|
|
2770
3092
|
}
|
|
2771
|
-
_fromJSON(e) {
|
|
2772
|
-
if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new
|
|
2773
|
-
e.theme && (this._theme = new
|
|
2774
|
-
let
|
|
3093
|
+
_fromJSON(e, t) {
|
|
3094
|
+
if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new I(B("error.workbook.sheetOne"));
|
|
3095
|
+
e.theme && (this._theme = new gt(e.theme), this._styles.setTheme(this._theme));
|
|
3096
|
+
let n = this._strings.beginPersist(), r = this._resources.beginPersist(), i = this._styles.beginPersist();
|
|
2775
3097
|
try {
|
|
2776
|
-
|
|
2777
|
-
let
|
|
2778
|
-
if (
|
|
2779
|
-
let e =
|
|
2780
|
-
for (let t = 0; t <
|
|
2781
|
-
let n =
|
|
2782
|
-
n && typeof n.cacheId == "number" &&
|
|
3098
|
+
n.fromJSON(e.strings), r.fromJSON(e.resources), i.fromJSON(e.styles), e.date1904 && (this._isDate1904 = !0), this._codeName = e.codeName ?? null, this._updateLinks = e.updateLinks ?? null, e.locale && (this._locale = e.locale), e.localeOverrides && (this._localeOverrides = e.localeOverrides), e.view ||= {};
|
|
3099
|
+
let a = [], o = e.pivotCaches;
|
|
3100
|
+
if (o) {
|
|
3101
|
+
let e = r.fromResourceId.bind(r);
|
|
3102
|
+
for (let t = 0; t < o.length; t++) {
|
|
3103
|
+
let n = o[t];
|
|
3104
|
+
n && typeof n.cacheId == "number" && a.push({
|
|
2783
3105
|
cacheId: n.cacheId,
|
|
2784
3106
|
part: f.fromJSON(n.part, e)
|
|
2785
3107
|
});
|
|
2786
3108
|
}
|
|
2787
3109
|
}
|
|
2788
|
-
this._pivotCaches =
|
|
2789
|
-
let
|
|
2790
|
-
|
|
2791
|
-
let
|
|
3110
|
+
this._pivotCaches = a, this._people.fromJSON(e.people);
|
|
3111
|
+
let s = e.sheets, c = s.length, l = e.view.activeSheetId ?? null;
|
|
3112
|
+
l !== null && (l = Math.min(Math.max(0, l), c - 1));
|
|
3113
|
+
let u = null, d = null;
|
|
2792
3114
|
this._isLoadingSheets = !0;
|
|
2793
|
-
for (let e = 0; e <
|
|
2794
|
-
let
|
|
2795
|
-
|
|
3115
|
+
for (let e = 0; e < c; e++) {
|
|
3116
|
+
let n = s[e], r = n.visibility || j.Visibility.Visible, i = e;
|
|
3117
|
+
d = i, r === j.Visibility.Visible ? u === null && (u = i) : l !== null && l === i && (l = null);
|
|
2796
3118
|
try {
|
|
2797
|
-
this._createSheet(
|
|
3119
|
+
this._createSheet(i, n.name, r, e, n.sheetId, n.sheet, t?.[e]);
|
|
2798
3120
|
} catch (e) {
|
|
2799
3121
|
throw this._isLoadingSheets = !1, e;
|
|
2800
3122
|
}
|
|
2801
3123
|
}
|
|
2802
|
-
this._isLoadingSheets = !1, this._updateState({ lastId:
|
|
2803
|
-
let
|
|
2804
|
-
this._protection = new
|
|
2805
|
-
|
|
3124
|
+
this._isLoadingSheets = !1, this._tellSheets(), this._updateState({ lastId: d }), e.view.activeSheetId = l ?? u, this.setView(new gr({ json: e.view })), this._adjustSheetNamesIfRequired(), this._listenerProtection?.();
|
|
3125
|
+
let p = this;
|
|
3126
|
+
this._protection = new vr(e?.protection, this._options?.readonly), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
|
|
3127
|
+
p._emitter.notify("onProtectionChange", { source: e });
|
|
2806
3128
|
} }), this._emitter.notify("onLoad");
|
|
2807
3129
|
} finally {
|
|
2808
|
-
|
|
3130
|
+
i.endPersist(), r.endPersist(), n.endPersist();
|
|
2809
3131
|
}
|
|
2810
3132
|
}
|
|
2811
3133
|
_createScripts(e) {
|
|
2812
3134
|
let t = this;
|
|
2813
|
-
return new
|
|
3135
|
+
return new dr({
|
|
2814
3136
|
transactions: this._transactions,
|
|
2815
3137
|
json: e,
|
|
2816
3138
|
workbook: t,
|
|
2817
3139
|
getBuiltInFunctions: () => t._calculation?.getFunctions(),
|
|
2818
3140
|
onAdd: (e, n) => {
|
|
2819
3141
|
let r = t._calculation;
|
|
2820
|
-
r.getStatus() !==
|
|
3142
|
+
r.getStatus() !== Le.Status.Off && r.start().then(async () => {
|
|
2821
3143
|
let e = n.getFunctions().getItems({ type: "formula" }), t = e.length;
|
|
2822
3144
|
for (let n = 0; n < t; n++) {
|
|
2823
3145
|
let t = e[n];
|
|
2824
3146
|
try {
|
|
2825
3147
|
await this._calculation.getFunctions().add(t);
|
|
2826
3148
|
} catch (e) {
|
|
2827
|
-
|
|
3149
|
+
Wt.error(e?.message ?? String(e), e);
|
|
2828
3150
|
}
|
|
2829
3151
|
}
|
|
2830
3152
|
}).catch(() => {});
|
|
@@ -2833,10 +3155,10 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2833
3155
|
});
|
|
2834
3156
|
}
|
|
2835
3157
|
async toJSON(e) {
|
|
2836
|
-
if (this._closed) throw Error(
|
|
3158
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2837
3159
|
await Promise.resolve(this._starting);
|
|
2838
3160
|
let t = this.getCalculation();
|
|
2839
|
-
t.getStatus() !==
|
|
3161
|
+
t.getStatus() !== Le.Status.Off && (await t.ready(), await t._whenRequestsSettled?.()), await this._emitter.notify("onBeforeSave", { async: !0 });
|
|
2840
3162
|
let n = { sheets: [] }, r = e?.ignoreStyles ?? !1;
|
|
2841
3163
|
if (!r) {
|
|
2842
3164
|
let e = this._theme.toJSON();
|
|
@@ -2855,7 +3177,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2855
3177
|
name: i.name,
|
|
2856
3178
|
sheet: o
|
|
2857
3179
|
};
|
|
2858
|
-
i.sheetId !== void 0 && (s.sheetId = i.sheetId), i.visibility ===
|
|
3180
|
+
i.sheetId !== void 0 && (s.sheetId = i.sheetId), i.visibility === j.Visibility.Visible ? u === null && (u = a) : s.visibility = i.visibility, i.id === t && (l = a), n.sheets.push(s);
|
|
2859
3181
|
}
|
|
2860
3182
|
if (!r) {
|
|
2861
3183
|
let e = c.toJSON();
|
|
@@ -2908,16 +3230,16 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2908
3230
|
} catch (e) {
|
|
2909
3231
|
console.warn("error on close", e);
|
|
2910
3232
|
}
|
|
2911
|
-
this._ownResources, this._ownNames && this._names.close(), this._ownCalculation && this._calculation.close(), this._ownStyles, this._transactionsRemoveListener?.(), this._listenerLanguage?.(), this._listenerOrigin?.(), this._listenerOriginProvider?.(), this._ownOriginProvider && this._originProvider instanceof
|
|
3233
|
+
this._ownResources, this._ownNames && this._names.close(), this._ownCalculation && this._calculation.close(), this._ownStyles, this._transactionsRemoveListener?.(), this._listenerLanguage?.(), this._listenerOrigin?.(), this._listenerOriginProvider?.(), this._ownOriginProvider && this._originProvider instanceof en && this._originProvider.release(), this._closed = !0;
|
|
2912
3234
|
}
|
|
2913
3235
|
beginCommit(e) {
|
|
2914
|
-
if (this._closed) throw Error(
|
|
3236
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2915
3237
|
return this._beginCommit(typeof e == "string" ? { description: e } : e);
|
|
2916
3238
|
}
|
|
2917
3239
|
doBatch(e, t) {
|
|
2918
3240
|
let n = this;
|
|
2919
3241
|
return t = typeof t == "string" ? { description: t } : {
|
|
2920
|
-
description:
|
|
3242
|
+
description: z("op.updateWorkbook"),
|
|
2921
3243
|
...t
|
|
2922
3244
|
}, this._transactions.doBatch(e, t, (e, t) => {
|
|
2923
3245
|
e.getDepth() === 0 && (n._lastTransactionUUID = e.getId());
|
|
@@ -2932,7 +3254,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2932
3254
|
_getState() {
|
|
2933
3255
|
return this._transactions.getState(this._id);
|
|
2934
3256
|
}
|
|
2935
|
-
_updateState(e, t =
|
|
3257
|
+
_updateState(e, t = z("op.updateWorkbook"), n) {
|
|
2936
3258
|
if (!e) return;
|
|
2937
3259
|
let r = this._beginCommit(t);
|
|
2938
3260
|
try {
|
|
@@ -2953,7 +3275,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2953
3275
|
get isIWorkbook() {
|
|
2954
3276
|
return !0;
|
|
2955
3277
|
}
|
|
2956
|
-
},
|
|
3278
|
+
}, Mr = { address: null }, Nr = class {
|
|
2957
3279
|
constructor() {
|
|
2958
3280
|
this._readFormats = [], this._writeFormats = [], this._encryptions = [];
|
|
2959
3281
|
}
|
|
@@ -3029,9 +3351,9 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3029
3351
|
return !0;
|
|
3030
3352
|
});
|
|
3031
3353
|
}
|
|
3032
|
-
},
|
|
3354
|
+
}, Pr = /* @__PURE__ */ new WeakMap(), Fr = (e) => !!e && typeof e == "object" && typeof e.getPath == "function" && typeof e.canWrite == "function", Ir = class {
|
|
3033
3355
|
constructor() {
|
|
3034
|
-
this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new
|
|
3356
|
+
this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new x(this), this._registry = new Nr(), this._defaultStore = new nn(() => this.getWriteFormats(), () => this.getReadFormats());
|
|
3035
3357
|
}
|
|
3036
3358
|
getBackingStore() {
|
|
3037
3359
|
return this._backingStore ?? this._defaultStore;
|
|
@@ -3066,15 +3388,15 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3066
3388
|
return this._registry.getWriteFormats(e);
|
|
3067
3389
|
}
|
|
3068
3390
|
getOrigin(e) {
|
|
3069
|
-
return new
|
|
3391
|
+
return new V(e);
|
|
3070
3392
|
}
|
|
3071
3393
|
async read(e) {
|
|
3072
3394
|
let t = null;
|
|
3073
3395
|
if (typeof e == "string") e = { source: e };
|
|
3074
|
-
else if (
|
|
3396
|
+
else if (Fr(e)) {
|
|
3075
3397
|
let n = e.getPath();
|
|
3076
3398
|
if (!n) throw Error("Cannot read from an unbound origin (no path).");
|
|
3077
|
-
|
|
3399
|
+
Qt(e) ? e = {
|
|
3078
3400
|
source: n,
|
|
3079
3401
|
asCopy: !0
|
|
3080
3402
|
} : (t = e, e = { source: n });
|
|
@@ -3093,20 +3415,20 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3093
3415
|
search: i,
|
|
3094
3416
|
ext: a
|
|
3095
3417
|
}))[0];
|
|
3096
|
-
if (!o) throw new
|
|
3418
|
+
if (!o) throw new I(B("error.io.readFormatUnavailable", { format: i ?? a }));
|
|
3097
3419
|
let s = n?.typedCreateWorkbookOptions, c = s ? Object.keys(s).find((e) => e.toLowerCase() === o.key.toLowerCase()) : void 0, l = {
|
|
3098
3420
|
...n,
|
|
3099
3421
|
...c === void 0 ? void 0 : s[c]
|
|
3100
3422
|
};
|
|
3101
3423
|
delete l.typedCreateWorkbookOptions, delete l.source, delete l.asCopy;
|
|
3102
|
-
let u = r ?? new
|
|
3424
|
+
let u = r ?? new V(t.absolutePath ?? null, {
|
|
3103
3425
|
name: t.name ?? null,
|
|
3104
3426
|
format: o.key,
|
|
3105
3427
|
size: t.size ?? null,
|
|
3106
3428
|
lastModified: t.lastModified ?? null,
|
|
3107
3429
|
canWrite: t.canWrite ?? !1
|
|
3108
3430
|
});
|
|
3109
|
-
r instanceof
|
|
3431
|
+
r instanceof V && r.update({
|
|
3110
3432
|
format: o.key,
|
|
3111
3433
|
size: t.size ?? null,
|
|
3112
3434
|
lastModified: t.lastModified ?? null
|
|
@@ -3140,7 +3462,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3140
3462
|
}
|
|
3141
3463
|
async _decrypt(e, t, n) {
|
|
3142
3464
|
let r = await this._registry.detectEncryption(e);
|
|
3143
|
-
if (t instanceof
|
|
3465
|
+
if (t instanceof V && t.update({ encryption: r ? r.key : null }), !r) return {
|
|
3144
3466
|
bytes: e,
|
|
3145
3467
|
password: null
|
|
3146
3468
|
};
|
|
@@ -3148,7 +3470,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3148
3470
|
try {
|
|
3149
3471
|
return i = await r.decode(e, t), !0;
|
|
3150
3472
|
} catch (e) {
|
|
3151
|
-
if (!(e instanceof
|
|
3473
|
+
if (!(e instanceof Ht)) throw e;
|
|
3152
3474
|
return !1;
|
|
3153
3475
|
}
|
|
3154
3476
|
};
|
|
@@ -3158,7 +3480,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3158
3480
|
};
|
|
3159
3481
|
if (!n?.onPassword) {
|
|
3160
3482
|
let e = t.getName();
|
|
3161
|
-
throw new
|
|
3483
|
+
throw new Kt(e ? B("error.io.passwordRequired", { name: e }) : B("error.io.passwordRequiredUnnamed"));
|
|
3162
3484
|
}
|
|
3163
3485
|
let o = await Promise.resolve(n.onPassword({
|
|
3164
3486
|
origin: t,
|
|
@@ -3170,16 +3492,16 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3170
3492
|
bytes: i,
|
|
3171
3493
|
password: o
|
|
3172
3494
|
};
|
|
3173
|
-
throw new
|
|
3495
|
+
throw new Ht(B("error.io.passwordIncorrect"));
|
|
3174
3496
|
}
|
|
3175
3497
|
async writeArrayBuffer(e, t) {
|
|
3176
3498
|
if (!t?.format) throw Error("A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).");
|
|
3177
3499
|
let n = (await this._registry.getWriteFormats({ search: t.format }))[0];
|
|
3178
|
-
if (!n) throw new
|
|
3500
|
+
if (!n) throw new I(B("error.io.writeFormatUnavailable", { format: t.format }));
|
|
3179
3501
|
return this._writeArrayBuffer(e, n, t);
|
|
3180
3502
|
}
|
|
3181
3503
|
async write(e, t, n) {
|
|
3182
|
-
return typeof t == "string" ||
|
|
3504
|
+
return typeof t == "string" || Fr(t) ? this._write(e, t, !1, n) : this._write(e, e?.getOrigin?.(), !0, t ?? n);
|
|
3183
3505
|
}
|
|
3184
3506
|
async writeAs(e, t, n) {
|
|
3185
3507
|
if (!t) throw Error("A target must be provided for writeAs (use write(workbook) for a plain save).");
|
|
@@ -3189,13 +3511,13 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3189
3511
|
if (!e) throw Error("Workbook must be provided.");
|
|
3190
3512
|
if (!e.isIWorkbook) throw Error("Invalid workbook model provided. Must be an instance of IWorkbook.");
|
|
3191
3513
|
let i = typeof t == "string" ? this.getOrigin(t) : t, a = i.getFormat(), o;
|
|
3192
|
-
if ((r?.format || a) && (o = (await this._registry.getWriteFormats({ search: r?.format ?? a ?? void 0 }))[0]), o || i.getPath() && i.canWrite() && i.getExtension() || (o = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !o) throw new
|
|
3514
|
+
if ((r?.format || a) && (o = (await this._registry.getWriteFormats({ search: r?.format ?? a ?? void 0 }))[0]), o || i.getPath() && i.canWrite() && i.getExtension() || (o = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !o) throw new I(B("error.io.writeFormatUnresolved"));
|
|
3193
3515
|
let s = i.getExtension();
|
|
3194
3516
|
if (r?.format && s && i.getPath() && i.canWrite() && !o.exts.includes(s)) {
|
|
3195
3517
|
let e = (await this._registry.getWriteFormats({ ext: s }))[0];
|
|
3196
3518
|
if (e && e.key !== o.key) {
|
|
3197
3519
|
let e = i.getPath().split(/[/\\]/).pop();
|
|
3198
|
-
throw new
|
|
3520
|
+
throw new I(B("error.io.writeFormatMismatch", {
|
|
3199
3521
|
format: r.format,
|
|
3200
3522
|
file: e
|
|
3201
3523
|
}));
|
|
@@ -3203,16 +3525,16 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3203
3525
|
}
|
|
3204
3526
|
if (typeof t == "string") {
|
|
3205
3527
|
let e = i.getPath();
|
|
3206
|
-
i = new
|
|
3528
|
+
i = new V(k(e) ? e : `${e}.${o.exts[0]}`, { format: o.key });
|
|
3207
3529
|
}
|
|
3208
|
-
let c = i.getEncryption(), l = e.getOrigin?.(), u = (i instanceof
|
|
3530
|
+
let c = i.getEncryption(), l = e.getOrigin?.(), u = (i instanceof V ? i.getPassword() : null) ?? (l instanceof V ? l.getPassword() : null), d = i.isEncrypted() || (l?.isEncrypted() ?? !1), f = r?.password === void 0 ? u ?? (d ? void 0 : null) : r.password, p = null;
|
|
3209
3531
|
if (f === void 0) {
|
|
3210
3532
|
if (d) {
|
|
3211
3533
|
let e = i.getName();
|
|
3212
|
-
throw new
|
|
3534
|
+
throw new Kt(e ? B("error.io.passwordRequiredSave", { name: e }) : B("error.io.passwordRequiredSaveUnnamed"));
|
|
3213
3535
|
}
|
|
3214
|
-
} else if (f !== null && (p = await this._registry.getEncryption(c), !p)) throw new
|
|
3215
|
-
let m = `${i.getName() ??
|
|
3536
|
+
} else if (f !== null && (p = await this._registry.getEncryption(c), !p)) throw new I(B("error.io.encryptionUnavailable"));
|
|
3537
|
+
let m = `${i.getName() ?? B("workbook.defaultName")}.${o.exts[0]}`, h = r?.progress, g = !i.getPath() || !i.canWrite() || !!r?.prompt, _ = !1, v = this, y = null, b = [], x = {
|
|
3216
3538
|
workbook: e,
|
|
3217
3539
|
format: o,
|
|
3218
3540
|
origin: i,
|
|
@@ -3237,7 +3559,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3237
3559
|
}))(h, l), d = await v._writeArrayBuffer(e, c, {
|
|
3238
3560
|
...r,
|
|
3239
3561
|
progress: u
|
|
3240
|
-
}), m =
|
|
3562
|
+
}), m = Pr.get(s);
|
|
3241
3563
|
if (l.some((e) => !m?.has(e.message)) && r?.onWarnings) {
|
|
3242
3564
|
let t = await Promise.resolve(r.onWarnings({
|
|
3243
3565
|
workbook: e,
|
|
@@ -3255,12 +3577,12 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3255
3577
|
let t = this.getBackingStore();
|
|
3256
3578
|
if (!t.write) throw Error("The active backing store is read-only (no write implementation).");
|
|
3257
3579
|
if (S = await t.write(x), S) {
|
|
3258
|
-
if (f !== void 0 && S instanceof
|
|
3259
|
-
let e =
|
|
3580
|
+
if (f !== void 0 && S instanceof V && (S.setPassword(f), S.update({ encryption: p ? p.key : null })), b.length) {
|
|
3581
|
+
let e = Pr.get(S) ?? /* @__PURE__ */ new Set();
|
|
3260
3582
|
for (let t of b) e.add(t.message);
|
|
3261
|
-
|
|
3583
|
+
Pr.set(S, e);
|
|
3262
3584
|
}
|
|
3263
|
-
n && S !== e.getOrigin() &&
|
|
3585
|
+
n && S !== e.getOrigin() && Qt(e.getOrigin())?.setOrigin(S);
|
|
3264
3586
|
let t = y ?? e.getTransactions?.()?.getCurrentCommit() ?? null;
|
|
3265
3587
|
this._emitter.notify("onWrite", {
|
|
3266
3588
|
params: {
|
|
@@ -3275,7 +3597,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3275
3597
|
h?.onComplete && await Promise.resolve(h.onComplete(S));
|
|
3276
3598
|
} catch (e) {
|
|
3277
3599
|
let t = e instanceof Error ? e : Error(String(e));
|
|
3278
|
-
throw h?.onError && await Promise.resolve(h.onError(t)), h?.onComplete && await Promise.resolve(h.onComplete(null)), t instanceof
|
|
3600
|
+
throw h?.onError && await Promise.resolve(h.onError(t)), h?.onComplete && await Promise.resolve(h.onComplete(null)), t instanceof I ? t : Error(B("error.io.writeFailed", { reason: t.message }), { cause: e });
|
|
3279
3601
|
}
|
|
3280
3602
|
return S;
|
|
3281
3603
|
}
|
|
@@ -3300,14 +3622,14 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3300
3622
|
async _readArrayBuffer(e, t, n) {
|
|
3301
3623
|
if (!e) throw Error("ArrayBuffer must be specified.");
|
|
3302
3624
|
if (!t) throw Error("format must be specified.");
|
|
3303
|
-
if (e.byteLength === 0) return new
|
|
3625
|
+
if (e.byteLength === 0) return new jr(n?.createWorkbookOptions);
|
|
3304
3626
|
let r = t.handler;
|
|
3305
3627
|
if (!r) throw Error(`Unable to resolve a read handler for '${t.key}'.`);
|
|
3306
3628
|
let i;
|
|
3307
3629
|
try {
|
|
3308
3630
|
i = await r(e, n);
|
|
3309
3631
|
} catch (e) {
|
|
3310
|
-
throw e instanceof
|
|
3632
|
+
throw e instanceof I ? e : new I(B("error.io.readFailed", {
|
|
3311
3633
|
format: t.description ?? t.key,
|
|
3312
3634
|
reason: e?.message ?? String(e)
|
|
3313
3635
|
}), { cause: e });
|
|
@@ -3317,7 +3639,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3317
3639
|
get isIWorkbookIO() {
|
|
3318
3640
|
return !0;
|
|
3319
3641
|
}
|
|
3320
|
-
},
|
|
3642
|
+
}, Lr = new Ir(), Rr = class {
|
|
3321
3643
|
constructor() {
|
|
3322
3644
|
this._buffer = null, this._formatKey = null;
|
|
3323
3645
|
}
|
|
@@ -3331,8 +3653,8 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3331
3653
|
async read(e) {
|
|
3332
3654
|
return this._buffer ? e.decode(this._buffer, { format: this._formatKey ?? void 0 }) : null;
|
|
3333
3655
|
}
|
|
3334
|
-
},
|
|
3335
|
-
kind:
|
|
3656
|
+
}, zr = "locales", Br = "fonts", Vr = [{
|
|
3657
|
+
kind: zr,
|
|
3336
3658
|
files: [{
|
|
3337
3659
|
suffix: ".msg.json",
|
|
3338
3660
|
async extract(e) {
|
|
@@ -3345,7 +3667,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3345
3667
|
place: (e, t) => t ? `${t}/${e}` : null
|
|
3346
3668
|
}]
|
|
3347
3669
|
}, {
|
|
3348
|
-
kind:
|
|
3670
|
+
kind: Br,
|
|
3349
3671
|
files: [
|
|
3350
3672
|
".woff2",
|
|
3351
3673
|
".woff",
|
|
@@ -3357,42 +3679,46 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3357
3679
|
place: (e, t) => t ? `${t}/${e}` : e
|
|
3358
3680
|
}))
|
|
3359
3681
|
}];
|
|
3360
|
-
|
|
3361
|
-
Darken: "darken",
|
|
3362
|
-
DarkenLess: "darkenLess",
|
|
3363
|
-
Lighten: "lighten",
|
|
3364
|
-
LightenLess: "lightenLess",
|
|
3365
|
-
None: "none",
|
|
3366
|
-
Normal: "normal"
|
|
3367
|
-
}, ar.PresetGeometry = {
|
|
3368
|
-
Line: "line",
|
|
3369
|
-
LineInv: "lineInv",
|
|
3370
|
-
triangle: "triangle",
|
|
3371
|
-
rtTriangle: "rtTriangle",
|
|
3372
|
-
Rect: "rect"
|
|
3373
|
-
};
|
|
3682
|
+
Tr ||= {}, Er ||= {};
|
|
3374
3683
|
var Q = null;
|
|
3375
|
-
function
|
|
3684
|
+
function Hr() {
|
|
3376
3685
|
if (!Q) {
|
|
3377
|
-
let e = import("./
|
|
3686
|
+
let e = import("./C8btlUQcQwNyzHY3.mjs").then((e) => e.loadScriptingDeclarations());
|
|
3378
3687
|
e.catch(() => {
|
|
3379
3688
|
Q = null;
|
|
3380
3689
|
}), Q = e;
|
|
3381
3690
|
}
|
|
3382
3691
|
return Q;
|
|
3383
3692
|
}
|
|
3384
|
-
var
|
|
3385
|
-
function
|
|
3693
|
+
var Ur, Wr, Gr, $ = null;
|
|
3694
|
+
function Kr() {
|
|
3386
3695
|
if (!$) {
|
|
3387
|
-
let e = import("./
|
|
3696
|
+
let e = import("./C8btlUQcQwNyzHY3.mjs").then((e) => e.loadScriptingApi()).then((e) => JSON.parse(e));
|
|
3388
3697
|
e.catch(() => {
|
|
3389
3698
|
$ = null;
|
|
3390
3699
|
}), $ = e;
|
|
3391
3700
|
}
|
|
3392
3701
|
return $;
|
|
3393
3702
|
}
|
|
3394
|
-
|
|
3395
|
-
|
|
3703
|
+
Ur ||= {}, (Wr ||= {}).Type = {
|
|
3704
|
+
Button: "button",
|
|
3705
|
+
CheckBox: "checkBox",
|
|
3706
|
+
OptionButton: "optionButton",
|
|
3707
|
+
ListBox: "listBox",
|
|
3708
|
+
DropDown: "dropDown",
|
|
3709
|
+
ScrollBar: "scrollBar",
|
|
3710
|
+
Spinner: "spinner",
|
|
3711
|
+
GroupBox: "groupBox",
|
|
3712
|
+
Label: "label",
|
|
3713
|
+
EditBox: "editBox",
|
|
3714
|
+
Dialog: "dialog",
|
|
3715
|
+
Unknown: "formControl"
|
|
3716
|
+
}, (Gr ||= {}).DropStyle = {
|
|
3717
|
+
Combo: "combo",
|
|
3718
|
+
ComboEdit: "comboEdit",
|
|
3719
|
+
Simple: "simple"
|
|
3720
|
+
};
|
|
3721
|
+
var qr = class extends b {
|
|
3396
3722
|
constructor(e) {
|
|
3397
3723
|
super(e);
|
|
3398
3724
|
}
|
|
@@ -3405,8 +3731,8 @@ var wr = class extends ue {
|
|
|
3405
3731
|
colEnd: (e?.size?.width ?? 5) - 1,
|
|
3406
3732
|
rowEnd: (e?.size?.height ?? 5) - 1
|
|
3407
3733
|
},
|
|
3408
|
-
getRanges: (e) => new
|
|
3734
|
+
getRanges: (e) => new Re(null)
|
|
3409
3735
|
}, super._initializeOptions(e);
|
|
3410
3736
|
}
|
|
3411
|
-
},
|
|
3412
|
-
export {
|
|
3737
|
+
}, Jr = "0.8.0-beta.9", Yr = "2026-10-05T18:18:33.079Z";
|
|
3738
|
+
export { g as AbstractCollection, le as AbstractMovableContent, o as AddressUtils, Rr as ArrayBackingStore, mt as AutoFill, Yr as BUILD_DATE, he as Color, te as Condition, at as DateUtils, Ir as DefaultWorkbookIO, yt as EXTERNAL_LINK_PATH_REL_TYPE, mr as ExternalRangeClipboardItem, Br as FONTS_KIND, xn as FontUtils, ge as FormulaText, It as FunctionDeclarations, We as GeomUtils, m as IAnchored, Ve as IBorders, Le as ICalculation, Ot as ICell, Fn as ICellHeaderRange, At as ICellRange, Pn as ICellRanges, He as IColor, c as ICondition, ye as IConditionalFormat, jt as IDataValidation, Gr as IDropDown, bn as IEffect, T as IFill, O as IFont, ln as IFontCollection, Wr as IFormControl, Bn as IGeometry, Ur as IMovable, Er as IPicture, Tr as IPrint, Nn as IResource, ie as IScript, K as IShape, j as ISheet, Pt as ISheetView, vn as ISort, yn as IStroke, Oe as IStyle, ee as ITable, v as ITableStyle, se as IText, w as ITextFrame, Mn as ITheme, ke as IThemeCollection, Jt as IWorkbookIO, zr as LOCALES_KIND, i as LicenseManager, l as MovableContentRegistry, De as NamedStyleCollection, D as NumberFormat, lr as PersonCollection, pr as RangeClipboardItem, pe as Registry, rt as Resource, de as ResourceCollection, Vr as SHEETXL_RESOURCE_KINDS, t as SYSTEM_COLOR_CSS_PREFIX, Hn as ShapeStyleUtils, M as Sheet, cn as SimpleFontFace, wt as Sort, d as StringCollection, ce as StyleCollection, qr as Table, Te as TableStyleCollection, u as TextRotation, p as TextStacked, ue as TextUtils, gt as Theme, C as ThemeCollection, ne as TransactionConflictError, Xt as TransactionSaveStateManager, _e as TransactionStore, Yt as TransactionUndoManager, Ft as Tuple, Jr as VERSION, jr as Workbook, Lr as WorkbookIO, V as WorkbookOrigin, gr as WorkbookView, jn as builtInStyleNameDisplay, Be as createCellRangeCounts, Qe as externalBookClosedName, Pe as externalBookFileName, pt as externalBookLocation, xt as externalBookOpenName, Rn as getBuiltInFunctionNames, ct as getLanguagePack, kt as getLocaleProfile, oe as getScriptRuntime, Kr as getScriptingApi, Hr as getScriptingDeclarations, Je as localizeBoolean, Ge as localizeErrorLabel, Ce as makeLocaleProfile, je as parseBooleanLocal, Et as parseErrorLocal, ze as parseExternalScope, zn as parseFormulaLiteral, ht as registerSdkLocales, ot as sourceEntryFromPath, fe as withScriptRuntime };
|